Initial commit

This commit is contained in:
2025-03-07 19:22:02 +01:00
commit 4a98255d83
55743 changed files with 5280367 additions and 0 deletions
@@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "Skeleton", {
enumerable: true,
get: function() {
return Skeleton;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _useSkeleton = require("./useSkeleton");
const _renderSkeleton = require("./renderSkeleton");
const _useSkeletonStylesstyles = require("./useSkeletonStyles.styles");
const _useSkeletonContextValues = require("./useSkeletonContextValues");
const Skeleton = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
const state = (0, _useSkeleton.useSkeleton_unstable)(props, ref);
const contextValues = (0, _useSkeletonContextValues.useSkeletonContextValues)(state);
(0, _useSkeletonStylesstyles.useSkeletonStyles_unstable)(state);
return (0, _renderSkeleton.renderSkeleton_unstable)(state, contextValues);
});
Skeleton.displayName = 'Skeleton';
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Skeleton/Skeleton.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useSkeleton_unstable } from './useSkeleton';\nimport { renderSkeleton_unstable } from './renderSkeleton';\nimport { useSkeletonStyles_unstable } from './useSkeletonStyles.styles';\nimport { useSkeletonContextValues } from './useSkeletonContextValues';\nimport type { SkeletonProps } from './Skeleton.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * Skeleton component - TODO: add more docs\n */\nexport const Skeleton: ForwardRefComponent<SkeletonProps> = React.forwardRef((props, ref) => {\n const state = useSkeleton_unstable(props, ref);\n const contextValues = useSkeletonContextValues(state);\n\n useSkeletonStyles_unstable(state);\n return renderSkeleton_unstable(state, contextValues);\n});\n\nSkeleton.displayName = 'Skeleton';\n"],"names":["Skeleton","React","forwardRef","props","ref","state","useSkeleton_unstable","contextValues","useSkeletonContextValues","useSkeletonStyles_unstable","renderSkeleton_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWaA;;;eAAAA;;;;iEAXU;6BACc;gCACG;yCACG;0CACF;AAOlC,MAAMA,WAAAA,WAAAA,GAA+CC,OAAMC,UAAU,CAAC,CAACC,OAAOC;IACnF,MAAMC,QAAQC,IAAAA,iCAAAA,EAAqBH,OAAOC;IAC1C,MAAMG,gBAAgBC,IAAAA,kDAAAA,EAAyBH;IAE/CI,IAAAA,mDAAAA,EAA2BJ;IAC3B,OAAOK,IAAAA,uCAAAA,EAAwBL,OAAOE;AACxC;AAEAP,SAASW,WAAW,GAAG"}
@@ -0,0 +1,6 @@
/**
* State used in rendering Skeleton
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Skeleton/Skeleton.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { SkeletonContextValue } from '../../contexts/index';\n\nexport type SkeletonSlots = {\n /**\n * The root slot of the `Skeleton` is the container that will contain the slots that make up a `Skeleton`\n * and any data that the `Skeleton` will load. The default html element is a `div`.\n */\n root: NonNullable<Slot<'div'>>;\n};\n\n/**\n * Skeleton Props\n */\nexport type SkeletonProps = Omit<ComponentProps<Partial<SkeletonSlots>>, 'width'> & {\n /**\n * The animation type for the Skeleton\n * @defaultValue wave\n */\n animation?: 'wave' | 'pulse';\n\n /**\n * Sets the appearance of the Skeleton.\n * @defaultValue opaque\n */\n appearance?: 'opaque' | 'translucent';\n\n /**\n * Sets the width value of the skeleton wrapper.\n * @defaultValue 100%\n * @deprecated Use `className` prop to set width\n */\n width?: number | string;\n};\n\nexport type SkeletonContextValues = {\n skeletonGroup: SkeletonContextValue;\n};\n\n/**\n * State used in rendering Skeleton\n */\nexport type SkeletonState = ComponentState<SkeletonSlots> & Required<Pick<SkeletonProps, 'animation' | 'appearance'>>;\n"],"names":[],"rangeMappings":";;","mappings":"AAuCA;;CAEC"}
@@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
Skeleton: function() {
return _Skeleton.Skeleton;
},
renderSkeleton_unstable: function() {
return _renderSkeleton.renderSkeleton_unstable;
},
skeletonClassNames: function() {
return _useSkeletonStylesstyles.skeletonClassNames;
},
useSkeletonContextValues: function() {
return _useSkeletonContextValues.useSkeletonContextValues;
},
useSkeletonStyles_unstable: function() {
return _useSkeletonStylesstyles.useSkeletonStyles_unstable;
},
useSkeleton_unstable: function() {
return _useSkeleton.useSkeleton_unstable;
}
});
const _Skeleton = require("./Skeleton");
const _renderSkeleton = require("./renderSkeleton");
const _useSkeleton = require("./useSkeleton");
const _useSkeletonContextValues = require("./useSkeletonContextValues");
const _useSkeletonStylesstyles = require("./useSkeletonStyles.styles");
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Skeleton/index.ts"],"sourcesContent":["export { Skeleton } from './Skeleton';\nexport type { SkeletonContextValues, SkeletonProps, SkeletonSlots, SkeletonState } from './Skeleton.types';\nexport { renderSkeleton_unstable } from './renderSkeleton';\nexport { useSkeleton_unstable } from './useSkeleton';\nexport { useSkeletonContextValues } from './useSkeletonContextValues';\nexport { skeletonClassNames, useSkeletonStyles_unstable } from './useSkeletonStyles.styles';\n"],"names":["Skeleton","renderSkeleton_unstable","skeletonClassNames","useSkeletonContextValues","useSkeletonStyles_unstable","useSkeleton_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAASA,QAAQ;eAARA,kBAAQ;;IAERC,uBAAuB;eAAvBA,uCAAuB;;IAGvBC,kBAAkB;eAAlBA,2CAAkB;;IADlBC,wBAAwB;eAAxBA,kDAAwB;;IACJC,0BAA0B;eAA1BA,mDAA0B;;IAF9CC,oBAAoB;eAApBA,iCAAoB;;;0BAHJ;gCAEe;6BACH;0CACI;yCACsB"}
@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "renderSkeleton_unstable", {
enumerable: true,
get: function() {
return renderSkeleton_unstable;
}
});
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
const _reactutilities = require("@fluentui/react-utilities");
const _SkeletonContext = require("../../contexts/SkeletonContext");
const renderSkeleton_unstable = (state, contextValues)=>{
(0, _reactutilities.assertSlots)(state);
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_SkeletonContext.SkeletonContextProvider, {
value: contextValues.skeletonGroup,
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(state.root, {})
});
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Skeleton/renderSkeleton.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { SkeletonContextProvider } from '../../contexts/SkeletonContext';\nimport type { SkeletonContextValues, SkeletonSlots, SkeletonState } from './Skeleton.types';\n\n/**\n * Render the final JSX of Skeleton\n */\nexport const renderSkeleton_unstable = (state: SkeletonState, contextValues: SkeletonContextValues) => {\n assertSlots<SkeletonSlots>(state);\n\n return (\n <SkeletonContextProvider value={contextValues.skeletonGroup}>\n <state.root />\n </SkeletonContextProvider>\n );\n};\n"],"names":["renderSkeleton_unstable","state","contextValues","assertSlots","_jsx","SkeletonContextProvider","value","skeletonGroup","root"],"rangeMappings":";;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAUaA;;;eAAAA;;;4BATb;gCAE4B;iCACY;AAMjC,MAAMA,0BAA0B,CAACC,OAAsBC;IAC5DC,IAAAA,2BAAAA,EAA2BF;IAE3B,OAAA,WAAA,GACEG,IAAAA,eAAA,EAACC,wCAAAA,EAAAA;QAAwBC,OAAOJ,cAAcK,aAAa;kBACzD,WAAA,GAAAH,IAAAA,eAAA,EAACH,MAAMO,IAAI,EAAA,CAAA;;AAGjB"}
@@ -0,0 +1,37 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "useSkeleton_unstable", {
enumerable: true,
get: function() {
return useSkeleton_unstable;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _reactutilities = require("@fluentui/react-utilities");
const _SkeletonContext = require("../../contexts/SkeletonContext");
const useSkeleton_unstable = (props, ref)=>{
const { animation: contextAnimation, appearance: contextAppearance } = (0, _SkeletonContext.useSkeletonContext)();
const { animation = contextAnimation !== null && contextAnimation !== void 0 ? contextAnimation : 'wave', appearance = contextAppearance !== null && contextAppearance !== void 0 ? contextAppearance : 'opaque' } = props;
const root = _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('div', {
// FIXME:
// `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`
// but since it would be a breaking change to fix it, we are casting ref to it's proper type
ref: ref,
role: 'progressbar',
'aria-busy': true,
...props
}), {
elementType: 'div'
});
return {
animation,
appearance,
components: {
root: 'div'
},
root
};
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Skeleton/useSkeleton.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport type { SkeletonProps, SkeletonState } from './Skeleton.types';\nimport { useSkeletonContext } from '../../contexts/SkeletonContext';\n\n/**\n * Create the state required to render Skeleton.\n *\n * The returned state can be modified with hooks such as useSkeletonStyles_unstable,\n * before being passed to renderSkeleton_unstable.\n *\n * @param props - props from this instance of Skeleton\n * @param ref - reference to root HTMLElement of Skeleton\n */\nexport const useSkeleton_unstable = (props: SkeletonProps, ref: React.Ref<HTMLElement>): SkeletonState => {\n const { animation: contextAnimation, appearance: contextAppearance } = useSkeletonContext();\n const { animation = contextAnimation ?? 'wave', appearance = contextAppearance ?? 'opaque' } = props;\n\n const root = slot.always(\n getIntrinsicElementProps('div', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: ref as React.Ref<HTMLDivElement>,\n role: 'progressbar',\n 'aria-busy': true,\n ...props,\n }),\n { elementType: 'div' },\n );\n return { animation, appearance, components: { root: 'div' }, root };\n};\n"],"names":["useSkeleton_unstable","props","ref","animation","contextAnimation","appearance","contextAppearance","useSkeletonContext","root","slot","always","getIntrinsicElementProps","role","elementType","components"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAcaA;;;eAAAA;;;;iEAdU;gCACwB;iCAEZ;AAW5B,MAAMA,uBAAuB,CAACC,OAAsBC;IACzD,MAAM,EAAEC,WAAWC,gBAAgB,EAAEC,YAAYC,iBAAiB,EAAE,GAAGC,IAAAA,mCAAAA;IACvE,MAAM,EAAEJ,YAAYC,qBAAAA,QAAAA,qBAAAA,KAAAA,IAAAA,mBAAoB,MAAM,EAAEC,aAAaC,sBAAAA,QAAAA,sBAAAA,KAAAA,IAAAA,oBAAqB,QAAQ,EAAE,GAAGL;IAE/F,MAAMO,OAAOC,oBAAAA,CAAKC,MAAM,CACtBC,IAAAA,wCAAAA,EAAyB,OAAO;QAC9B,SAAS;QACT,4EAA4E;QAC5E,4FAA4F;QAC5FT,KAAKA;QACLU,MAAM;QACN,aAAa;QACb,GAAGX,KAAK;IACV,IACA;QAAEY,aAAa;IAAM;IAEvB,OAAO;QAAEV;QAAWE;QAAYS,YAAY;YAAEN,MAAM;QAAM;QAAGA;IAAK;AACpE"}
@@ -0,0 +1,25 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "useSkeletonContextValues", {
enumerable: true,
get: function() {
return useSkeletonContextValues;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const useSkeletonContextValues = (state)=>{
const { animation, appearance } = state;
const skeletonGroup = _react.useMemo(()=>({
animation,
appearance
}), [
animation,
appearance
]);
return {
skeletonGroup
};
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Skeleton/useSkeletonContextValues.ts"],"sourcesContent":["import * as React from 'react';\nimport type { SkeletonContextValues, SkeletonState } from '../Skeleton';\n\nexport const useSkeletonContextValues = (state: SkeletonState): SkeletonContextValues => {\n const { animation, appearance } = state;\n\n const skeletonGroup = React.useMemo(\n () => ({\n animation,\n appearance,\n }),\n [animation, appearance],\n );\n\n return { skeletonGroup };\n};\n"],"names":["useSkeletonContextValues","state","animation","appearance","skeletonGroup","React","useMemo"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAGaA;;;eAAAA;;;;iEAHU;AAGhB,MAAMA,2BAA2B,CAACC;IACvC,MAAM,EAAEC,SAAS,EAAEC,UAAU,EAAE,GAAGF;IAElC,MAAMG,gBAAgBC,OAAMC,OAAO,CACjC,IAAO,CAAA;YACLJ;YACAC;QACF,CAAA,GACA;QAACD;QAAWC;KAAW;IAGzB,OAAO;QAAEC;IAAc;AACzB"}
@@ -0,0 +1,27 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
skeletonClassNames: function() {
return skeletonClassNames;
},
useSkeletonStyles_unstable: function() {
return useSkeletonStyles_unstable;
}
});
const _react = require("@griffel/react");
const skeletonClassNames = {
root: 'fui-Skeleton'
};
const useSkeletonStyles_unstable = (state)=>{
'use no memo';
state.root.className = (0, _react.mergeClasses)(skeletonClassNames.root, state.root.className);
return state;
};
@@ -0,0 +1 @@
{"version":3,"sources":["useSkeletonStyles.styles.js"],"sourcesContent":["import { mergeClasses } from '@griffel/react';\nexport const skeletonClassNames = {\n root: 'fui-Skeleton'\n};\n/**\n * Apply styling to the Skeleton slots based on the state\n */ export const useSkeletonStyles_unstable = (state)=>{\n 'use no memo';\n state.root.className = mergeClasses(skeletonClassNames.root, state.root.className);\n return state;\n};\n"],"names":["skeletonClassNames","useSkeletonStyles_unstable","root","state","className","mergeClasses"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IACaA,kBAAkB;eAAlBA;;IAKIC,0BAA0B;eAA1BA;;;uBANY;AACtB,MAAMD,qBAAqB;IAC9BE,MAAM;AACV;AAGW,MAAMD,6BAA8BE,CAAAA;IAC3C;IACAA,MAAMD,IAAI,CAACE,SAAS,GAAGC,IAAAA,mBAAY,EAACL,mBAAmBE,IAAI,EAAEC,MAAMD,IAAI,CAACE,SAAS;IACjF,OAAOD;AACX"}