@fluentui/react-spinner 0.0.0-nightly-20230317-1454.1 → 0.0.0-nightly-20230321-0440.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.json +13 -13
  2. package/CHANGELOG.md +9 -9
  3. package/lib/Spinner.js +1 -1
  4. package/lib/Spinner.js.map +1 -1
  5. package/lib/components/Spinner/DefaultSvg.js +1 -1
  6. package/lib/components/Spinner/DefaultSvg.js.map +1 -1
  7. package/lib/components/Spinner/Spinner.js +6 -6
  8. package/lib/components/Spinner/Spinner.js.map +1 -1
  9. package/lib/components/Spinner/Spinner.types.js.map +1 -1
  10. package/lib/components/Spinner/index.js +5 -5
  11. package/lib/components/Spinner/index.js.map +1 -1
  12. package/lib/components/Spinner/renderSpinner.js +11 -3
  13. package/lib/components/Spinner/renderSpinner.js.map +1 -1
  14. package/lib/components/Spinner/useSpinner.js +15 -15
  15. package/lib/components/Spinner/useSpinner.js.map +1 -1
  16. package/lib/components/Spinner/useSpinnerStyles.js +25 -25
  17. package/lib/components/Spinner/useSpinnerStyles.js.map +1 -1
  18. package/lib/index.js +1 -1
  19. package/lib/index.js.map +1 -1
  20. package/lib-commonjs/Spinner.js +4 -5
  21. package/lib-commonjs/Spinner.js.map +1 -1
  22. package/lib-commonjs/components/Spinner/DefaultSvg.js +12 -15
  23. package/lib-commonjs/components/Spinner/DefaultSvg.js.map +1 -1
  24. package/lib-commonjs/components/Spinner/Spinner.js +20 -19
  25. package/lib-commonjs/components/Spinner/Spinner.js.map +1 -1
  26. package/lib-commonjs/components/Spinner/Spinner.types.js +2 -3
  27. package/lib-commonjs/components/Spinner/Spinner.types.js.map +1 -1
  28. package/lib-commonjs/components/Spinner/index.js +8 -9
  29. package/lib-commonjs/components/Spinner/index.js.map +1 -1
  30. package/lib-commonjs/components/Spinner/renderSpinner.js +27 -14
  31. package/lib-commonjs/components/Spinner/renderSpinner.js.map +1 -1
  32. package/lib-commonjs/components/Spinner/useSpinner.js +65 -53
  33. package/lib-commonjs/components/Spinner/useSpinner.js.map +1 -1
  34. package/lib-commonjs/components/Spinner/useSpinnerStyles.js +233 -351
  35. package/lib-commonjs/components/Spinner/useSpinnerStyles.js.map +1 -1
  36. package/lib-commonjs/index.js +33 -16
  37. package/lib-commonjs/index.js.map +1 -1
  38. package/package.json +9 -8
  39. package/.swcrc +0 -39
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/components/Spinner/Spinner.js"],"sourcesContent":["import * as React from \"react\";\nimport { useSpinner_unstable } from \"./useSpinner\";\nimport { renderSpinner_unstable } from \"./renderSpinner\";\nimport { useSpinnerStyles_unstable } from \"./useSpinnerStyles\";\nimport { useCustomStyleHooks_unstable } from \"@fluentui/react-shared-contexts\";\n/**\n * Converged Spinner component for the fluentui repo\n */\nexport const Spinner = /*#__PURE__*/React.forwardRef((props, ref) => {\n const state = useSpinner_unstable(props, ref);\n useSpinnerStyles_unstable(state);\n const {\n useSpinnerStyles_unstable: useCustomStyles\n } = useCustomStyleHooks_unstable();\n useCustomStyles(state);\n return renderSpinner_unstable(state);\n});\nSpinner.displayName = \"Spinner\";\n//# sourceMappingURL=Spinner.js.map"],"names":["Spinner","React","forwardRef","props","ref","state","useSpinner_unstable","useSpinnerStyles_unstable","useCustomStyles","useCustomStyleHooks_unstable","renderSpinner_unstable","displayName"],"mappings":";;;;+BAQaA;;aAAAA;;;6DARU;4BACa;+BACG;kCACG;qCACG;AAItC,MAAMA,UAAU,WAAW,GAAEC,OAAMC,UAAU,CAAC,CAACC,OAAOC,MAAQ;IACnE,MAAMC,QAAQC,IAAAA,+BAAmB,EAACH,OAAOC;IACzCG,IAAAA,2CAAyB,EAACF;IAC1B,MAAM,EACJE,2BAA2BC,gBAAe,EAC3C,GAAGC,IAAAA,iDAA4B;IAChCD,gBAAgBH;IAChB,OAAOK,IAAAA,qCAAsB,EAACL;AAChC;AACAL,QAAQW,WAAW,GAAG,WACtB,mCAAmC"}
1
+ {"version":3,"names":["React","require","useSpinner_1","renderSpinner_1","useSpinnerStyles_1","react_shared_contexts_1","exports","Spinner","forwardRef","props","ref","state","useSpinner_unstable","useSpinnerStyles_unstable","useCustomStyles","useCustomStyleHooks_unstable","renderSpinner_unstable","displayName"],"sources":["../../../../../../../../../packages/react-components/react-spinner/src/components/Spinner/Spinner.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useSpinner_unstable } from './useSpinner';\nimport { renderSpinner_unstable } from './renderSpinner';\nimport { useSpinnerStyles_unstable } from './useSpinnerStyles';\nimport type { SpinnerProps } from './Spinner.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHooks_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * Converged Spinner component for the fluentui repo\n */\nexport const Spinner: ForwardRefComponent<SpinnerProps> = React.forwardRef((props, ref) => {\n const state = useSpinner_unstable(props, ref);\n\n useSpinnerStyles_unstable(state);\n\n const { useSpinnerStyles_unstable: useCustomStyles } = useCustomStyleHooks_unstable();\n useCustomStyles(state);\n\n return renderSpinner_unstable(state);\n});\n\nSpinner.displayName = 'Spinner';\n"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AACA,MAAAC,YAAA,gBAAAD,OAAA;AACA,MAAAE,eAAA,gBAAAF,OAAA;AACA,MAAAG,kBAAA,gBAAAH,OAAA;AAGA,MAAAI,uBAAA,gBAAAJ,OAAA;AAEA;;;AAGaK,OAAA,CAAAC,OAAO,gBAAsCP,KAAK,CAACQ,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAI;EACxF,MAAMC,KAAK,GAAGT,YAAA,CAAAU,mBAAmB,CAACH,KAAK,EAAEC,GAAG,CAAC;EAE7CN,kBAAA,CAAAS,yBAAyB,CAACF,KAAK,CAAC;EAEhC,MAAM;IAAEE,yBAAyB,EAAEC;EAAe,CAAE,GAAGT,uBAAA,CAAAU,4BAA4B,EAAE;EACrFD,eAAe,CAACH,KAAK,CAAC;EAEtB,OAAOR,eAAA,CAAAa,sBAAsB,CAACL,KAAK,CAAC;AACtC,CAAC,CAAC;AAEFL,OAAA,CAAAC,OAAO,CAACU,WAAW,GAAG,SAAS"}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
+
2
3
  Object.defineProperty(exports, "__esModule", {
3
- value: true
4
+ value: true
4
5
  });
5
- //# sourceMappingURL=Spinner.types.js.map
6
-
7
6
  //# sourceMappingURL=Spinner.types.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/components/Spinner/Spinner.types.js"],"sourcesContent":["export {};\n//# sourceMappingURL=Spinner.types.js.map"],"names":[],"mappings":";;;;CACA,yCAAyC"}
1
+ {"version":3,"names":[],"sources":["../../../../../../../../../packages/react-components/react-spinner/src/components/Spinner/Spinner.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { Label } from '@fluentui/react-label';\n\nexport type SpinnerSlots = {\n /**\n * The root of the Spinner.\n * The root slot receives the `className` and `style` specified directly on the `<Spinner>`.\n */\n root: NonNullable<Slot<'div'>>;\n /**\n * The slot for the animated svg.\n * The spinner slot receives the `className` and `style` that handles the spinning animation.\n * An svg is also rendered as a child of this slot\n */\n spinner?: Slot<'span'>;\n /**\n * The label of the Slider.\n * The label slot receives the styling related to the text associated with the Spinner.\n */\n label?: Slot<typeof Label>;\n};\n\n/**\n * Spinner Props\n */\nexport type SpinnerProps = Omit<ComponentProps<SpinnerSlots>, 'size'> & {\n /**\n * The appearance of the Spinner.\n * @default 'primary'\n */\n appearance?: 'primary' | 'inverted';\n\n /**\n * Where the label is positioned relative to the Spinner\n * @default 'after'\n */\n labelPosition?: 'above' | 'below' | 'before' | 'after';\n\n /**\n * The size of the spinner.\n * @default 'medium'\n */\n size?: 'tiny' | 'extra-small' | 'small' | 'medium' | 'large' | 'extra-large' | 'huge';\n};\n\n/**\n * State used in rendering Spinner\n */\nexport type SpinnerState = ComponentState<SpinnerSlots> &\n Required<Pick<SpinnerProps, 'appearance' | 'labelPosition' | 'size'>>;\n"],"mappings":""}
@@ -1,13 +1,12 @@
1
1
  "use strict";
2
+
2
3
  Object.defineProperty(exports, "__esModule", {
3
- value: true
4
+ value: true
4
5
  });
5
- const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
- _exportStar(require("./Spinner"), exports);
7
- _exportStar(require("./Spinner.types"), exports);
8
- _exportStar(require("./renderSpinner"), exports);
9
- _exportStar(require("./useSpinner"), exports);
10
- _exportStar(require("./useSpinnerStyles"), exports);
11
- //# sourceMappingURL=index.js.map
12
-
6
+ const tslib_1 = /*#__PURE__*/require("tslib");
7
+ tslib_1.__exportStar(require("./Spinner"), exports);
8
+ tslib_1.__exportStar(require("./Spinner.types"), exports);
9
+ tslib_1.__exportStar(require("./renderSpinner"), exports);
10
+ tslib_1.__exportStar(require("./useSpinner"), exports);
11
+ tslib_1.__exportStar(require("./useSpinnerStyles"), exports);
13
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/components/Spinner/index.js"],"sourcesContent":["export * from \"./Spinner\";\nexport * from \"./Spinner.types\";\nexport * from \"./renderSpinner\";\nexport * from \"./useSpinner\";\nexport * from \"./useSpinnerStyles\";\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;oBACA;CACd,iCAAiC"}
1
+ {"version":3,"names":["tslib_1","__exportStar","require","exports"],"sources":["../../../../../../../../../packages/react-components/react-spinner/src/components/Spinner/index.ts"],"sourcesContent":["export * from './Spinner';\nexport * from './Spinner.types';\nexport * from './renderSpinner';\nexport * from './useSpinner';\nexport * from './useSpinnerStyles';\n"],"mappings":";;;;;;AAAAA,OAAA,CAAAC,YAAA,CAAAC,OAAA,eAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,qBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,qBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,kBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,wBAAAC,OAAA"}
@@ -1,18 +1,31 @@
1
1
  "use strict";
2
+
2
3
  Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "renderSpinner_unstable", {
6
- enumerable: true,
7
- get: ()=>renderSpinner_unstable
4
+ value: true
8
5
  });
9
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
- const _reactUtilities = require("@fluentui/react-utilities");
12
- const renderSpinner_unstable = (state)=>{
13
- const { slots , slotProps } = (0, _reactUtilities.getSlots)(state);
14
- const { labelPosition } = state;
15
- return /*#__PURE__*/ _react.createElement(slots.root, slotProps.root, slots.label && (labelPosition === "above" || labelPosition === "before") && /*#__PURE__*/ _react.createElement(slots.label, slotProps.label), slots.spinner && /*#__PURE__*/ _react.createElement(slots.spinner, slotProps.spinner), slots.label && (labelPosition === "below" || labelPosition === "after") && /*#__PURE__*/ _react.createElement(slots.label, slotProps.label));
16
- }; //# sourceMappingURL=renderSpinner.js.map
17
-
6
+ exports.renderSpinner_unstable = void 0;
7
+ const React = /*#__PURE__*/require("react");
8
+ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
9
+ /**
10
+ * Render the final JSX of Spinner
11
+ */
12
+ const renderSpinner_unstable = state => {
13
+ const {
14
+ slots,
15
+ slotProps
16
+ } = react_utilities_1.getSlots(state);
17
+ const {
18
+ labelPosition
19
+ } = state;
20
+ return React.createElement(slots.root, {
21
+ ...slotProps.root
22
+ }, slots.label && (labelPosition === 'above' || labelPosition === 'before') && React.createElement(slots.label, {
23
+ ...slotProps.label
24
+ }), slots.spinner && React.createElement(slots.spinner, {
25
+ ...slotProps.spinner
26
+ }), slots.label && (labelPosition === 'below' || labelPosition === 'after') && React.createElement(slots.label, {
27
+ ...slotProps.label
28
+ }));
29
+ };
30
+ exports.renderSpinner_unstable = renderSpinner_unstable;
18
31
  //# sourceMappingURL=renderSpinner.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/components/Spinner/renderSpinner.js"],"sourcesContent":["import * as React from \"react\";\nimport { getSlots } from \"@fluentui/react-utilities\";\n/**\n * Render the final JSX of Spinner\n */\nexport const renderSpinner_unstable = state => {\n const {\n slots,\n slotProps\n } = getSlots(state);\n const {\n labelPosition\n } = state;\n return /*#__PURE__*/React.createElement(slots.root, slotProps.root, slots.label && (labelPosition === \"above\" || labelPosition === \"before\") && /*#__PURE__*/React.createElement(slots.label, slotProps.label), slots.spinner && /*#__PURE__*/React.createElement(slots.spinner, slotProps.spinner), slots.label && (labelPosition === \"below\" || labelPosition === \"after\") && /*#__PURE__*/React.createElement(slots.label, slotProps.label));\n};\n//# sourceMappingURL=renderSpinner.js.map"],"names":["renderSpinner_unstable","state","slots","slotProps","getSlots","labelPosition","React","createElement","root","label","spinner"],"mappings":";;;;+BAKaA;;aAAAA;;;6DALU;gCACE;AAIlB,MAAMA,yBAAyBC,CAAAA,QAAS;IAC7C,MAAM,EACJC,MAAK,EACLC,UAAS,EACV,GAAGC,IAAAA,wBAAQ,EAACH;IACb,MAAM,EACJI,cAAa,EACd,GAAGJ;IACJ,OAAO,WAAW,GAAEK,OAAMC,aAAa,CAACL,MAAMM,IAAI,EAAEL,UAAUK,IAAI,EAAEN,MAAMO,KAAK,IAAKJ,CAAAA,kBAAkB,WAAWA,kBAAkB,QAAO,KAAM,WAAW,GAAEC,OAAMC,aAAa,CAACL,MAAMO,KAAK,EAAEN,UAAUM,KAAK,GAAGP,MAAMQ,OAAO,IAAI,WAAW,GAAEJ,OAAMC,aAAa,CAACL,MAAMQ,OAAO,EAAEP,UAAUO,OAAO,GAAGR,MAAMO,KAAK,IAAKJ,CAAAA,kBAAkB,WAAWA,kBAAkB,OAAM,KAAM,WAAW,GAAEC,OAAMC,aAAa,CAACL,MAAMO,KAAK,EAAEN,UAAUM,KAAK;AAC/a,GACA,yCAAyC"}
1
+ {"version":3,"names":["React","require","react_utilities_1","renderSpinner_unstable","state","slots","slotProps","getSlots","labelPosition","createElement","root","label","spinner","exports"],"sources":["../../../../../../../../../packages/react-components/react-spinner/src/components/Spinner/renderSpinner.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { SpinnerState, SpinnerSlots } from './Spinner.types';\n\n/**\n * Render the final JSX of Spinner\n */\nexport const renderSpinner_unstable = (state: SpinnerState) => {\n const { slots, slotProps } = getSlots<SpinnerSlots>(state);\n const { labelPosition } = state;\n return (\n <slots.root {...slotProps.root}>\n {slots.label && (labelPosition === 'above' || labelPosition === 'before') && <slots.label {...slotProps.label} />}\n {slots.spinner && <slots.spinner {...slotProps.spinner} />}\n {slots.label && (labelPosition === 'below' || labelPosition === 'after') && <slots.label {...slotProps.label} />}\n </slots.root>\n );\n};\n"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AACA,MAAAC,iBAAA,gBAAAD,OAAA;AAGA;;;AAGO,MAAME,sBAAsB,GAAIC,KAAmB,IAAI;EAC5D,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAE,GAAGJ,iBAAA,CAAAK,QAAQ,CAAeH,KAAK,CAAC;EAC1D,MAAM;IAAEI;EAAa,CAAE,GAAGJ,KAAK;EAC/B,OACEJ,KAAA,CAAAS,aAAA,CAACJ,KAAK,CAACK,IAAI;IAAA,GAAKJ,SAAS,CAACI;EAAI,GAC3BL,KAAK,CAACM,KAAK,KAAKH,aAAa,KAAK,OAAO,IAAIA,aAAa,KAAK,QAAQ,CAAC,IAAIR,KAAA,CAAAS,aAAA,CAACJ,KAAK,CAACM,KAAK;IAAA,GAAKL,SAAS,CAACK;EAAK,EAAI,EAChHN,KAAK,CAACO,OAAO,IAAIZ,KAAA,CAAAS,aAAA,CAACJ,KAAK,CAACO,OAAO;IAAA,GAAKN,SAAS,CAACM;EAAO,EAAI,EACzDP,KAAK,CAACM,KAAK,KAAKH,aAAa,KAAK,OAAO,IAAIA,aAAa,KAAK,OAAO,CAAC,IAAIR,KAAA,CAAAS,aAAA,CAACJ,KAAK,CAACM,KAAK;IAAA,GAAKL,SAAS,CAACK;EAAK,EAAI,CACrG;AAEjB,CAAC;AAVYE,OAAA,CAAAV,sBAAsB,GAAAA,sBAAA"}
@@ -1,58 +1,70 @@
1
1
  "use strict";
2
+
2
3
  Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "useSpinner_unstable", {
6
- enumerable: true,
7
- get: ()=>useSpinner_unstable
4
+ value: true
8
5
  });
9
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
- const _reactUtilities = require("@fluentui/react-utilities");
12
- const _reactLabel = require("@fluentui/react-label");
13
- const _defaultSvg = require("./DefaultSvg");
14
- const useSpinner_unstable = (props, ref)=>{
15
- // Props
16
- const { appearance ="primary" , labelPosition ="after" , size ="medium" } = props;
17
- const baseId = (0, _reactUtilities.useId)("spinner");
18
- const { role ="progressbar" , tabIndex , ...rest } = props;
19
- const nativeRoot = (0, _reactUtilities.getNativeElementProps)("div", {
20
- ref,
21
- role,
22
- ...rest
23
- }, [
24
- "size"
25
- ]);
26
- const labelShorthand = (0, _reactUtilities.resolveShorthand)(props.label, {
27
- defaultProps: {
28
- id: baseId
29
- },
30
- required: false
31
- });
32
- const spinnerShortHand = (0, _reactUtilities.resolveShorthand)(props.spinner, {
33
- required: true,
34
- defaultProps: {
35
- children: /*#__PURE__*/ _react.createElement(_defaultSvg.DefaultSvg, null),
36
- tabIndex
37
- }
38
- });
39
- if (labelShorthand && nativeRoot && !nativeRoot["aria-labelledby"]) {
40
- nativeRoot["aria-labelledby"] = labelShorthand.id;
6
+ exports.useSpinner_unstable = void 0;
7
+ const React = /*#__PURE__*/require("react");
8
+ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
9
+ const react_label_1 = /*#__PURE__*/require("@fluentui/react-label");
10
+ const DefaultSvg_1 = /*#__PURE__*/require("./DefaultSvg");
11
+ /**
12
+ * Create the state required to render Spinner.
13
+ *
14
+ * The returned state can be modified with hooks such as useSpinnerStyles_unstable,
15
+ * before being passed to renderSpinner_unstable.
16
+ *
17
+ * @param props - props from this instance of Spinner
18
+ * @param ref - reference to root HTMLElement of Spinner
19
+ */
20
+ const useSpinner_unstable = (props, ref) => {
21
+ // Props
22
+ const {
23
+ appearance = 'primary',
24
+ labelPosition = 'after',
25
+ size = 'medium'
26
+ } = props;
27
+ const baseId = react_utilities_1.useId('spinner');
28
+ const {
29
+ role = 'progressbar',
30
+ tabIndex,
31
+ ...rest
32
+ } = props;
33
+ const nativeRoot = react_utilities_1.getNativeElementProps('div', {
34
+ ref,
35
+ role,
36
+ ...rest
37
+ }, ['size']);
38
+ const labelShorthand = react_utilities_1.resolveShorthand(props.label, {
39
+ defaultProps: {
40
+ id: baseId
41
+ },
42
+ required: false
43
+ });
44
+ const spinnerShortHand = react_utilities_1.resolveShorthand(props.spinner, {
45
+ required: true,
46
+ defaultProps: {
47
+ children: React.createElement(DefaultSvg_1.DefaultSvg, null),
48
+ tabIndex
41
49
  }
42
- const state = {
43
- appearance,
44
- labelPosition,
45
- size,
46
- components: {
47
- root: "div",
48
- spinner: "span",
49
- label: _reactLabel.Label
50
- },
51
- root: nativeRoot,
52
- spinner: spinnerShortHand,
53
- label: labelShorthand
54
- };
55
- return state;
56
- }; //# sourceMappingURL=useSpinner.js.map
57
-
50
+ });
51
+ if (labelShorthand && nativeRoot && !nativeRoot['aria-labelledby']) {
52
+ nativeRoot['aria-labelledby'] = labelShorthand.id;
53
+ }
54
+ const state = {
55
+ appearance,
56
+ labelPosition,
57
+ size,
58
+ components: {
59
+ root: 'div',
60
+ spinner: 'span',
61
+ label: react_label_1.Label
62
+ },
63
+ root: nativeRoot,
64
+ spinner: spinnerShortHand,
65
+ label: labelShorthand
66
+ };
67
+ return state;
68
+ };
69
+ exports.useSpinner_unstable = useSpinner_unstable;
58
70
  //# sourceMappingURL=useSpinner.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/components/Spinner/useSpinner.js"],"sourcesContent":["import * as React from \"react\";\nimport { getNativeElementProps, resolveShorthand, useId } from \"@fluentui/react-utilities\";\nimport { Label } from \"@fluentui/react-label\";\nimport { DefaultSvg } from \"./DefaultSvg\";\n/**\n * Create the state required to render Spinner.\n *\n * The returned state can be modified with hooks such as useSpinnerStyles_unstable,\n * before being passed to renderSpinner_unstable.\n *\n * @param props - props from this instance of Spinner\n * @param ref - reference to root HTMLElement of Spinner\n */\nexport const useSpinner_unstable = (props, ref) => {\n // Props\n const {\n appearance = \"primary\",\n labelPosition = \"after\",\n size = \"medium\"\n } = props;\n const baseId = useId(\"spinner\");\n const {\n role = \"progressbar\",\n tabIndex,\n ...rest\n } = props;\n const nativeRoot = getNativeElementProps(\"div\", {\n ref,\n role,\n ...rest\n }, [\"size\"]);\n const labelShorthand = resolveShorthand(props.label, {\n defaultProps: {\n id: baseId\n },\n required: false\n });\n const spinnerShortHand = resolveShorthand(props.spinner, {\n required: true,\n defaultProps: {\n children: /*#__PURE__*/React.createElement(DefaultSvg, null),\n tabIndex\n }\n });\n if (labelShorthand && nativeRoot && !nativeRoot[\"aria-labelledby\"]) {\n nativeRoot[\"aria-labelledby\"] = labelShorthand.id;\n }\n const state = {\n appearance,\n labelPosition,\n size,\n components: {\n root: \"div\",\n spinner: \"span\",\n label: Label\n },\n root: nativeRoot,\n spinner: spinnerShortHand,\n label: labelShorthand\n };\n return state;\n};\n//# sourceMappingURL=useSpinner.js.map"],"names":["useSpinner_unstable","props","ref","appearance","labelPosition","size","baseId","useId","role","tabIndex","rest","nativeRoot","getNativeElementProps","labelShorthand","resolveShorthand","label","defaultProps","id","required","spinnerShortHand","spinner","children","React","createElement","DefaultSvg","state","components","root","Label"],"mappings":";;;;+BAaaA;;aAAAA;;;6DAbU;gCACwC;4BACzC;4BACK;AAUpB,MAAMA,sBAAsB,CAACC,OAAOC,MAAQ;IACjD,QAAQ;IACR,MAAM,EACJC,YAAa,UAAS,EACtBC,eAAgB,QAAO,EACvBC,MAAO,SAAQ,EAChB,GAAGJ;IACJ,MAAMK,SAASC,IAAAA,qBAAK,EAAC;IACrB,MAAM,EACJC,MAAO,cAAa,EACpBC,SAAQ,EACR,GAAGC,MACJ,GAAGT;IACJ,MAAMU,aAAaC,IAAAA,qCAAqB,EAAC,OAAO;QAC9CV;QACAM;QACA,GAAGE,IAAI;IACT,GAAG;QAAC;KAAO;IACX,MAAMG,iBAAiBC,IAAAA,gCAAgB,EAACb,MAAMc,KAAK,EAAE;QACnDC,cAAc;YACZC,IAAIX;QACN;QACAY,UAAU,KAAK;IACjB;IACA,MAAMC,mBAAmBL,IAAAA,gCAAgB,EAACb,MAAMmB,OAAO,EAAE;QACvDF,UAAU,IAAI;QACdF,cAAc;YACZK,UAAU,WAAW,GAAEC,OAAMC,aAAa,CAACC,sBAAU,EAAE,IAAI;YAC3Df;QACF;IACF;IACA,IAAII,kBAAkBF,cAAc,CAACA,UAAU,CAAC,kBAAkB,EAAE;QAClEA,UAAU,CAAC,kBAAkB,GAAGE,eAAeI,EAAE;IACnD,CAAC;IACD,MAAMQ,QAAQ;QACZtB;QACAC;QACAC;QACAqB,YAAY;YACVC,MAAM;YACNP,SAAS;YACTL,OAAOa,iBAAK;QACd;QACAD,MAAMhB;QACNS,SAASD;QACTJ,OAAOF;IACT;IACA,OAAOY;AACT,GACA,sCAAsC"}
1
+ {"version":3,"names":["React","require","react_utilities_1","react_label_1","DefaultSvg_1","useSpinner_unstable","props","ref","appearance","labelPosition","size","baseId","useId","role","tabIndex","rest","nativeRoot","getNativeElementProps","labelShorthand","resolveShorthand","label","defaultProps","id","required","spinnerShortHand","spinner","children","createElement","DefaultSvg","state","components","root","Label","exports"],"sources":["../../../../../../../../../packages/react-components/react-spinner/src/components/Spinner/useSpinner.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand, useId } from '@fluentui/react-utilities';\nimport type { SpinnerProps, SpinnerState } from './Spinner.types';\nimport { Label } from '@fluentui/react-label';\nimport { DefaultSvg } from './DefaultSvg';\n\n/**\n * Create the state required to render Spinner.\n *\n * The returned state can be modified with hooks such as useSpinnerStyles_unstable,\n * before being passed to renderSpinner_unstable.\n *\n * @param props - props from this instance of Spinner\n * @param ref - reference to root HTMLElement of Spinner\n */\nexport const useSpinner_unstable = (props: SpinnerProps, ref: React.Ref<HTMLElement>): SpinnerState => {\n // Props\n const { appearance = 'primary', labelPosition = 'after', size = 'medium' } = props;\n const baseId = useId('spinner');\n\n const { role = 'progressbar', tabIndex, ...rest } = props;\n const nativeRoot = getNativeElementProps('div', { ref, role, ...rest }, ['size']);\n\n const labelShorthand = resolveShorthand(props.label, {\n defaultProps: {\n id: baseId,\n },\n required: false,\n });\n\n const spinnerShortHand = resolveShorthand(props.spinner, {\n required: true,\n defaultProps: {\n children: <DefaultSvg />,\n tabIndex,\n },\n });\n\n if (labelShorthand && nativeRoot && !nativeRoot['aria-labelledby']) {\n nativeRoot['aria-labelledby'] = labelShorthand.id;\n }\n\n const state: SpinnerState = {\n appearance,\n labelPosition,\n size,\n components: {\n root: 'div',\n spinner: 'span',\n label: Label,\n },\n root: nativeRoot,\n spinner: spinnerShortHand,\n label: labelShorthand,\n };\n return state;\n};\n"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AACA,MAAAC,iBAAA,gBAAAD,OAAA;AAEA,MAAAE,aAAA,gBAAAF,OAAA;AACA,MAAAG,YAAA,gBAAAH,OAAA;AAEA;;;;;;;;;AASO,MAAMI,mBAAmB,GAAGA,CAACC,KAAmB,EAAEC,GAA2B,KAAkB;EACpG;EACA,MAAM;IAAEC,UAAU,GAAG,SAAS;IAAEC,aAAa,GAAG,OAAO;IAAEC,IAAI,GAAG;EAAQ,CAAE,GAAGJ,KAAK;EAClF,MAAMK,MAAM,GAAGT,iBAAA,CAAAU,KAAK,CAAC,SAAS,CAAC;EAE/B,MAAM;IAAEC,IAAI,GAAG,aAAa;IAAEC,QAAQ;IAAE,GAAGC;EAAI,CAAE,GAAGT,KAAK;EACzD,MAAMU,UAAU,GAAGd,iBAAA,CAAAe,qBAAqB,CAAC,KAAK,EAAE;IAAEV,GAAG;IAAEM,IAAI;IAAE,GAAGE;EAAI,CAAE,EAAE,CAAC,MAAM,CAAC,CAAC;EAEjF,MAAMG,cAAc,GAAGhB,iBAAA,CAAAiB,gBAAgB,CAACb,KAAK,CAACc,KAAK,EAAE;IACnDC,YAAY,EAAE;MACZC,EAAE,EAAEX;KACL;IACDY,QAAQ,EAAE;GACX,CAAC;EAEF,MAAMC,gBAAgB,GAAGtB,iBAAA,CAAAiB,gBAAgB,CAACb,KAAK,CAACmB,OAAO,EAAE;IACvDF,QAAQ,EAAE,IAAI;IACdF,YAAY,EAAE;MACZK,QAAQ,EAAE1B,KAAA,CAAA2B,aAAA,CAACvB,YAAA,CAAAwB,UAAU,OAAG;MACxBd;;GAEH,CAAC;EAEF,IAAII,cAAc,IAAIF,UAAU,IAAI,CAACA,UAAU,CAAC,iBAAiB,CAAC,EAAE;IAClEA,UAAU,CAAC,iBAAiB,CAAC,GAAGE,cAAc,CAACI,EAAE;;EAGnD,MAAMO,KAAK,GAAiB;IAC1BrB,UAAU;IACVC,aAAa;IACbC,IAAI;IACJoB,UAAU,EAAE;MACVC,IAAI,EAAE,KAAK;MACXN,OAAO,EAAE,MAAM;MACfL,KAAK,EAAEjB,aAAA,CAAA6B;KACR;IACDD,IAAI,EAAEf,UAAU;IAChBS,OAAO,EAAED,gBAAgB;IACzBJ,KAAK,EAAEF;GACR;EACD,OAAOW,KAAK;AACd,CAAC;AAzCYI,OAAA,CAAA5B,mBAAmB,GAAAA,mBAAA"}