@fluentui/react-spinner 0.0.0-nightly-20220422-0419.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 (63) hide show
  1. package/CHANGELOG.json +173 -0
  2. package/CHANGELOG.md +71 -0
  3. package/LICENSE +15 -0
  4. package/MIGRATION.md +17 -0
  5. package/README.md +28 -0
  6. package/Spec.md +135 -0
  7. package/dist/react-spinner.d.ts +89 -0
  8. package/lib/Spinner.d.ts +1 -0
  9. package/lib/Spinner.js +2 -0
  10. package/lib/Spinner.js.map +1 -0
  11. package/lib/components/Spinner/DefaultSvg.d.ts +1 -0
  12. package/lib/components/Spinner/DefaultSvg.js +10 -0
  13. package/lib/components/Spinner/DefaultSvg.js.map +1 -0
  14. package/lib/components/Spinner/Spinner.d.ts +6 -0
  15. package/lib/components/Spinner/Spinner.js +15 -0
  16. package/lib/components/Spinner/Spinner.js.map +1 -0
  17. package/lib/components/Spinner/Spinner.types.d.ts +51 -0
  18. package/lib/components/Spinner/Spinner.types.js +2 -0
  19. package/lib/components/Spinner/Spinner.types.js.map +1 -0
  20. package/lib/components/Spinner/index.d.ts +5 -0
  21. package/lib/components/Spinner/index.js +6 -0
  22. package/lib/components/Spinner/index.js.map +1 -0
  23. package/lib/components/Spinner/renderSpinner.d.ts +5 -0
  24. package/lib/components/Spinner/renderSpinner.js +22 -0
  25. package/lib/components/Spinner/renderSpinner.js.map +1 -0
  26. package/lib/components/Spinner/useSpinner.d.ts +12 -0
  27. package/lib/components/Spinner/useSpinner.js +66 -0
  28. package/lib/components/Spinner/useSpinner.js.map +1 -0
  29. package/lib/components/Spinner/useSpinnerStyles.d.ts +7 -0
  30. package/lib/components/Spinner/useSpinnerStyles.js +249 -0
  31. package/lib/components/Spinner/useSpinnerStyles.js.map +1 -0
  32. package/lib/index.d.ts +2 -0
  33. package/lib/index.js +2 -0
  34. package/lib/index.js.map +1 -0
  35. package/lib/tsdoc-metadata.json +11 -0
  36. package/lib-commonjs/Spinner.d.ts +1 -0
  37. package/lib-commonjs/Spinner.js +10 -0
  38. package/lib-commonjs/Spinner.js.map +1 -0
  39. package/lib-commonjs/components/Spinner/DefaultSvg.d.ts +1 -0
  40. package/lib-commonjs/components/Spinner/DefaultSvg.js +20 -0
  41. package/lib-commonjs/components/Spinner/DefaultSvg.js.map +1 -0
  42. package/lib-commonjs/components/Spinner/Spinner.d.ts +6 -0
  43. package/lib-commonjs/components/Spinner/Spinner.js +26 -0
  44. package/lib-commonjs/components/Spinner/Spinner.js.map +1 -0
  45. package/lib-commonjs/components/Spinner/Spinner.types.d.ts +51 -0
  46. package/lib-commonjs/components/Spinner/Spinner.types.js +6 -0
  47. package/lib-commonjs/components/Spinner/Spinner.types.js.map +1 -0
  48. package/lib-commonjs/components/Spinner/index.d.ts +5 -0
  49. package/lib-commonjs/components/Spinner/index.js +18 -0
  50. package/lib-commonjs/components/Spinner/index.js.map +1 -0
  51. package/lib-commonjs/components/Spinner/renderSpinner.d.ts +5 -0
  52. package/lib-commonjs/components/Spinner/renderSpinner.js +33 -0
  53. package/lib-commonjs/components/Spinner/renderSpinner.js.map +1 -0
  54. package/lib-commonjs/components/Spinner/useSpinner.d.ts +12 -0
  55. package/lib-commonjs/components/Spinner/useSpinner.js +79 -0
  56. package/lib-commonjs/components/Spinner/useSpinner.js.map +1 -0
  57. package/lib-commonjs/components/Spinner/useSpinnerStyles.d.ts +7 -0
  58. package/lib-commonjs/components/Spinner/useSpinnerStyles.js +260 -0
  59. package/lib-commonjs/components/Spinner/useSpinnerStyles.js.map +1 -0
  60. package/lib-commonjs/index.d.ts +2 -0
  61. package/lib-commonjs/index.js +40 -0
  62. package/lib-commonjs/index.js.map +1 -0
  63. package/package.json +61 -0
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Spinner.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Spinner.types.js","sourceRoot":"../src/","sources":["components/Spinner/Spinner.types.ts"],"names":[],"mappings":"","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\ntype SpinnerCommons = {\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 * The status of the Spinner.\n * @default 'active'\n */\n status?: 'active' | 'inactive';\n};\n\n/**\n * Spinner Props\n */\nexport type SpinnerProps = Omit<ComponentProps<SpinnerSlots>, 'size'> & Partial<SpinnerCommons>;\n\n/**\n * State used in rendering Spinner\n */\nexport type SpinnerState = ComponentState<SpinnerSlots> & SpinnerCommons;\n"]}
@@ -0,0 +1,5 @@
1
+ export * from './Spinner';
2
+ export * from './Spinner.types';
3
+ export * from './renderSpinner';
4
+ export * from './useSpinner';
5
+ export * from './useSpinnerStyles';
@@ -0,0 +1,6 @@
1
+ export * from './Spinner';
2
+ export * from './Spinner.types';
3
+ export * from './renderSpinner';
4
+ export * from './useSpinner';
5
+ export * from './useSpinnerStyles';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/Spinner/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC","sourcesContent":["export * from './Spinner';\nexport * from './Spinner.types';\nexport * from './renderSpinner';\nexport * from './useSpinner';\nexport * from './useSpinnerStyles';\n"]}
@@ -0,0 +1,5 @@
1
+ import type { SpinnerState } from './Spinner.types';
2
+ /**
3
+ * Render the final JSX of Spinner
4
+ */
5
+ export declare const renderSpinner_unstable: (state: SpinnerState) => JSX.Element;
@@ -0,0 +1,22 @@
1
+ import * as React from 'react';
2
+ import { getSlots } from '@fluentui/react-utilities';
3
+ /**
4
+ * Render the final JSX of Spinner
5
+ */
6
+
7
+ export const renderSpinner_unstable = state => {
8
+ const {
9
+ slots,
10
+ slotProps
11
+ } = getSlots(state);
12
+ const {
13
+ labelPosition,
14
+ status
15
+ } = state;
16
+ return /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
17
+ }, slots.label && (labelPosition === 'above' || labelPosition === 'before') && /*#__PURE__*/React.createElement(slots.label, { ...slotProps.label
18
+ }), slots.spinner && status === 'active' && /*#__PURE__*/React.createElement(slots.spinner, { ...slotProps.spinner
19
+ }), slots.label && (labelPosition === 'below' || labelPosition === 'after') && /*#__PURE__*/React.createElement(slots.label, { ...slotProps.label
20
+ }));
21
+ };
22
+ //# sourceMappingURL=renderSpinner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Spinner/renderSpinner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,sBAAsB,GAAI,KAAD,IAAwB;AAC5D,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAe,KAAf,CAArC;AACA,QAAM;AAAE,IAAA,aAAF;AAAiB,IAAA;AAAjB,MAA4B,KAAlC;AACA,sBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,EACG,KAAK,CAAC,KAAN,KAAgB,aAAa,KAAK,OAAlB,IAA6B,aAAa,KAAK,QAA/D,kBAA4E,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,KAAP,EAAY,EAAA,GAAK,SAAS,CAAC;AAAf,GAAZ,CAD/E,EAEG,KAAK,CAAC,OAAN,IAAiB,MAAM,KAAK,QAA5B,iBAAwC,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,OAAP,EAAc,EAAA,GAAK,SAAS,CAAC;AAAf,GAAd,CAF3C,EAGG,KAAK,CAAC,KAAN,KAAgB,aAAa,KAAK,OAAlB,IAA6B,aAAa,KAAK,OAA/D,kBAA2E,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,KAAP,EAAY,EAAA,GAAK,SAAS,CAAC;AAAf,GAAZ,CAH9E,CADF;AAOD,CAVM","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, status } = state;\n return (\n <slots.root {...slotProps.root}>\n {slots.label && (labelPosition === 'above' || labelPosition === 'before') && <slots.label {...slotProps.label} />}\n {slots.spinner && status === 'active' && <slots.spinner {...slotProps.spinner} />}\n {slots.label && (labelPosition === 'below' || labelPosition === 'after') && <slots.label {...slotProps.label} />}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import type { SpinnerProps, SpinnerState } from './Spinner.types';
3
+ /**
4
+ * Create the state required to render Spinner.
5
+ *
6
+ * The returned state can be modified with hooks such as useSpinnerStyles_unstable,
7
+ * before being passed to renderSpinner_unstable.
8
+ *
9
+ * @param props - props from this instance of Spinner
10
+ * @param ref - reference to root HTMLElement of Spinner
11
+ */
12
+ export declare const useSpinner_unstable: (props: SpinnerProps, ref: React.Ref<HTMLElement>) => SpinnerState;
@@ -0,0 +1,66 @@
1
+ import * as React from 'react';
2
+ import { getNativeElementProps, resolveShorthand, useId } from '@fluentui/react-utilities';
3
+ import { Label } from '@fluentui/react-label';
4
+ import { DefaultSvg } from './DefaultSvg';
5
+ /**
6
+ * Create the state required to render Spinner.
7
+ *
8
+ * The returned state can be modified with hooks such as useSpinnerStyles_unstable,
9
+ * before being passed to renderSpinner_unstable.
10
+ *
11
+ * @param props - props from this instance of Spinner
12
+ * @param ref - reference to root HTMLElement of Spinner
13
+ */
14
+
15
+ export const useSpinner_unstable = (props, ref) => {
16
+ // Props
17
+ const {
18
+ appearance = 'primary',
19
+ labelPosition = 'after',
20
+ size = 'medium',
21
+ status = 'active'
22
+ } = props;
23
+ const baseId = useId('spinner');
24
+ const {
25
+ tabIndex,
26
+ ...rest
27
+ } = props;
28
+ const nativeRoot = getNativeElementProps('div', {
29
+ ref,
30
+ ...rest
31
+ }, ['size']);
32
+ const labelShorthand = resolveShorthand(props.label, {
33
+ defaultProps: {
34
+ id: baseId
35
+ },
36
+ required: false
37
+ });
38
+ const spinnerShortHand = resolveShorthand(props.spinner, {
39
+ required: true,
40
+ defaultProps: {
41
+ children: /*#__PURE__*/React.createElement(DefaultSvg, null),
42
+ tabIndex
43
+ }
44
+ });
45
+
46
+ if (labelShorthand && spinnerShortHand && !spinnerShortHand['aria-labelledby']) {
47
+ spinnerShortHand['aria-labelledby'] = labelShorthand.id;
48
+ }
49
+
50
+ const state = {
51
+ appearance,
52
+ labelPosition,
53
+ size,
54
+ status,
55
+ components: {
56
+ root: 'div',
57
+ spinner: 'span',
58
+ label: Label
59
+ },
60
+ root: nativeRoot,
61
+ spinner: spinnerShortHand,
62
+ label: labelShorthand
63
+ };
64
+ return state;
65
+ };
66
+ //# sourceMappingURL=useSpinner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Spinner/use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ACD;;AAED,QAAM,KAAK,GAAiB;AAC1B,IAAA,UAD0B;AAE1B,IAAA,aAF0B;AAG1B,IAAA,IAH0B;AAI1B,IAAA,MAJ0B;AAK1B,IAAA,UAAU,EAAE;AACV,MAAA,IAAI,EAAE,KADI;AAEV,MAAA,OAAO,EAAE,MAFC;AAGV,MAAA,KAAK,EAAE;AAHG,KALc;AAU1B,IAAA,IAAI,EAAE,UAVoB;AAW1B,IAAA,OAAO,EAAE,gBAXiB;AAY1B,IAAA,KAAK,EAAE;AAZmB,GAA5B;AAcA,SAAO,KAAP;AACD,CA1CM","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', status = 'active' } = props;\n const baseId = useId('spinner');\n\n const { tabIndex, ...rest } = props;\n const nativeRoot = getNativeElementProps('div', { ref, ...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 && spinnerShortHand && !spinnerShortHand['aria-labelledby']) {\n spinnerShortHand['aria-labelledby'] = labelShorthand.id;\n }\n\n const state: SpinnerState = {\n appearance,\n labelPosition,\n size,\n status,\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"],"sourceRoot":"../src/"}
@@ -0,0 +1,7 @@
1
+ import type { SpinnerState, SpinnerSlots } from './Spinner.types';
2
+ import type { SlotClassNames } from '@fluentui/react-utilities';
3
+ export declare const spinnerClassNames: SlotClassNames<SpinnerSlots>;
4
+ /**
5
+ * Apply styling to the Spinner slots based on the state
6
+ */
7
+ export declare const useSpinnerStyles_unstable: (state: SpinnerState) => SpinnerState;
@@ -0,0 +1,249 @@
1
+ import { __styles, mergeClasses, shorthands } from '@griffel/react';
2
+ import { tokens } from '@fluentui/react-theme';
3
+ export const spinnerClassNames = {
4
+ root: 'fui-Spinner',
5
+ spinner: 'fui-Spinner__spinner',
6
+ label: 'fui-Spinner__label'
7
+ };
8
+ /*
9
+ * TODO: Update with proper tokens when added
10
+ * Radii for the Spinner circles
11
+ */
12
+
13
+ const rValues = {
14
+ tiny: '9',
15
+ extraSmall: '11',
16
+ small: '13',
17
+ medium: '14.5',
18
+ large: '16.5',
19
+ extraLarge: '18.5',
20
+ huge: '20'
21
+ };
22
+ /*
23
+ * TODO: Update with proper tokens when added
24
+ * Sizes for the Spinner
25
+ */
26
+
27
+ const spinnnerSizes = {
28
+ tiny: '20px',
29
+ extraSmall: '24px',
30
+ small: '28px',
31
+ medium: '32px',
32
+ large: '36px',
33
+ extraLarge: '40px',
34
+ huge: '44px'
35
+ };
36
+ /*
37
+ * TODO: Update with proper tokens when added
38
+ * Stroke widths for the Spinner
39
+ */
40
+
41
+ const spinnerStrokeWidth = {
42
+ sWidth: '2px',
43
+ mWidth: '3px',
44
+ lWidth: '4px'
45
+ };
46
+ /*
47
+ * TODO: Update with proper tokens when added
48
+ * Animation for Spinner
49
+ */
50
+
51
+ const spinnerAnimation = {
52
+ container: {
53
+ animationDuration: '3s',
54
+ animationIterationCount: 'infinite',
55
+ animationTimingFunction: 'linear',
56
+ backgroundColor: 'transparent'
57
+ }
58
+ };
59
+ /*
60
+ * TODO: Update with proper tokens when added
61
+ * Label sizes for the Spinner
62
+ */
63
+
64
+ const labelSizeTokens = {
65
+ body1: {
66
+ fontSize: tokens.fontSizeBase300,
67
+ lineHeight: tokens.lineHeightBase300
68
+ },
69
+ subtitle2: {
70
+ fontSize: tokens.fontSizeBase400,
71
+ lineHeight: tokens.lineHeightBase400
72
+ },
73
+ subtitle1: {
74
+ fontSize: tokens.fontSizeBase500,
75
+ lineHeight: tokens.lineHeightBase500
76
+ }
77
+ };
78
+ /**
79
+ * Styles for the root slot
80
+ */
81
+
82
+ const useRootStyles = /*#__PURE__*/__styles({
83
+ "root": {
84
+ "mc9l5x": "f22iagw",
85
+ "Bt984gj": "f122n59",
86
+ "Brf1p80": "f4d9j23",
87
+ "i8kkvl": "f4px1ci",
88
+ "Belr9w4": "fn67r4l"
89
+ },
90
+ "horizontal": {
91
+ "Beiy3e4": "f1063pyq"
92
+ },
93
+ "vertical": {
94
+ "Beiy3e4": "f1vx9l62"
95
+ }
96
+ }, {
97
+ "d": [".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".f122n59{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}", ".f4d9j23{-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;}", ".f4px1ci{-webkit-column-gap:8px;column-gap:8px;}", ".fn67r4l{row-gap:8px;}", ".f1063pyq{-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;}", ".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}"]
98
+ });
99
+
100
+ const useLoaderStyles = /*#__PURE__*/__styles({
101
+ "spinnerSVG": {
102
+ "B486eqv": "f1nahjz1",
103
+ "Bwaue66": ["f5tbecn", "f15qb8s7"],
104
+ "fyp1ls": "fn4mtlg",
105
+ "ag6ruv": "f1y80fxs",
106
+ "osj692": "f1r2crtq",
107
+ "aq5vjd": "f1wsi8sr",
108
+ "d32isg": "f1da2vov",
109
+ "Bsvqbuc": "f11rfva0",
110
+ "b3s3i5": "f1exc66"
111
+ },
112
+ "tiny": {
113
+ "Bah9ito": "f1j4wmu2",
114
+ "ut6tcf": "f1vppzuq",
115
+ "B7p06xz": "f1subliv",
116
+ "B807ibg": "fd2apu6"
117
+ },
118
+ "extraSmall": {
119
+ "Bah9ito": "fmpqlna",
120
+ "ut6tcf": "f15z5jzu",
121
+ "B7p06xz": "f1subliv",
122
+ "B807ibg": "fm96dlc"
123
+ },
124
+ "small": {
125
+ "Bah9ito": "fo52gbo",
126
+ "ut6tcf": "f1b41i3v",
127
+ "B7p06xz": "f1subliv",
128
+ "B807ibg": "f1i91flz"
129
+ },
130
+ "medium": {
131
+ "Bah9ito": "f1aiqagr",
132
+ "ut6tcf": "f1wtx80b",
133
+ "B7p06xz": "f17vzdod",
134
+ "B807ibg": "fjlkznx"
135
+ },
136
+ "large": {
137
+ "Bah9ito": "f1trdq7b",
138
+ "ut6tcf": "f9e0mc5",
139
+ "B7p06xz": "f17vzdod",
140
+ "B807ibg": "f1upeyd8"
141
+ },
142
+ "extraLarge": {
143
+ "Bah9ito": "f89rf2a",
144
+ "ut6tcf": "f1w2xg3q",
145
+ "B7p06xz": "f17vzdod",
146
+ "B807ibg": "f1r2vitc"
147
+ },
148
+ "huge": {
149
+ "Bah9ito": "f1rx7k5y",
150
+ "ut6tcf": "f1vtyt49",
151
+ "B7p06xz": "f1l9ujyx",
152
+ "B807ibg": "fmhqutl"
153
+ }
154
+ }, {
155
+ "i": [".f1nahjz1:focus-visible{outline-style:3px solid transparent;}"],
156
+ "k": ["@-webkit-keyframes fb7n1on{0%{-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg);}100%{-webkit-transform:rotate(360deg);-moz-transform:rotate(360deg);-ms-transform:rotate(360deg);transform:rotate(360deg);}}", "@-webkit-keyframes f1gx3jof{0%{-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg);}100%{-webkit-transform:rotate(-360deg);-moz-transform:rotate(-360deg);-ms-transform:rotate(-360deg);transform:rotate(-360deg);}}", "@keyframes fb7n1on{0%{-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg);}100%{-webkit-transform:rotate(360deg);-moz-transform:rotate(360deg);-ms-transform:rotate(360deg);transform:rotate(360deg);}}", "@keyframes f1gx3jof{0%{-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg);}100%{-webkit-transform:rotate(-360deg);-moz-transform:rotate(-360deg);-ms-transform:rotate(-360deg);transform:rotate(-360deg);}}"],
157
+ "d": [".f5tbecn>svg{-webkit-animation-name:fb7n1on;animation-name:fb7n1on;}", ".f15qb8s7>svg{-webkit-animation-name:f1gx3jof;animation-name:f1gx3jof;}", ".fn4mtlg>svg{-webkit-animation-duration:3s;animation-duration:3s;}", ".f1y80fxs>svg{-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;}", ".f1r2crtq>svg{-webkit-animation-timing-function:linear;animation-timing-function:linear;}", ".f1wsi8sr>svg{background-color:transparent;}", ".f1da2vov>svg>circle{cx:50%;}", ".f11rfva0>svg>circle{cy:50%;}", ".f1exc66>svg>circle{fill:none;}", ".f1j4wmu2>svg{height:20px;}", ".f1vppzuq>svg{width:20px;}", ".f1subliv>svg>circle{stroke-width:2px;}", ".fd2apu6>svg>circle{r:9;}", ".fmpqlna>svg{height:24px;}", ".f15z5jzu>svg{width:24px;}", ".fm96dlc>svg>circle{r:11;}", ".fo52gbo>svg{height:28px;}", ".f1b41i3v>svg{width:28px;}", ".f1i91flz>svg>circle{r:13;}", ".f1aiqagr>svg{height:32px;}", ".f1wtx80b>svg{width:32px;}", ".f17vzdod>svg>circle{stroke-width:3px;}", ".fjlkznx>svg>circle{r:14.5;}", ".f1trdq7b>svg{height:36px;}", ".f9e0mc5>svg{width:36px;}", ".f1upeyd8>svg>circle{r:16.5;}", ".f89rf2a>svg{height:40px;}", ".f1w2xg3q>svg{width:40px;}", ".f1r2vitc>svg>circle{r:18.5;}", ".f1rx7k5y>svg{height:44px;}", ".f1vtyt49>svg{width:44px;}", ".f1l9ujyx>svg>circle{stroke-width:4px;}", ".fmhqutl>svg>circle{r:20;}"]
158
+ });
159
+
160
+ const useTrackStyles = /*#__PURE__*/__styles({
161
+ "inverted": {
162
+ "gwg7kz": "f1jvpmnu",
163
+ "Bvrehnu": "fq8a5sv",
164
+ "Bidp6o": "f1b4lwqj",
165
+ "cq3kgi": "f1najlst",
166
+ "Btwiser": "f10r9z1l",
167
+ "B8001xd": "fu3xdw0",
168
+ "Bdordwa": ["f1ttdh6v", "fmyjox0"],
169
+ "Bo2mdfu": "f1eseayc",
170
+ "Bksq7rz": "f1iqpjmu"
171
+ },
172
+ "primary": {
173
+ "gwg7kz": "f11ditju",
174
+ "B8k2rxp": "f1m9nikz",
175
+ "Bvrehnu": "fq8a5sv",
176
+ "Bidp6o": "f1b4lwqj",
177
+ "cq3kgi": "f1najlst",
178
+ "Btwiser": "f10r9z1l",
179
+ "B8001xd": "fu3xdw0",
180
+ "Bdordwa": ["f1ttdh6v", "fmyjox0"],
181
+ "Bo2mdfu": "f1eseayc",
182
+ "Bksq7rz": "f12uf417",
183
+ "y14cdu": "flglbw1"
184
+ }
185
+ }, {
186
+ "d": [".f1jvpmnu>svg>circle.fui-Spinner__Tail{stroke:var(--colorNeutralStrokeOnBrand2);}", ".fq8a5sv>svg>circle.fui-Spinner__Tail{-webkit-animation-name:f1v1ql0f;animation-name:f1v1ql0f;}", ".f1b4lwqj>svg>circle.fui-Spinner__Tail{-webkit-animation-duration:1.5s;animation-duration:1.5s;}", ".f1najlst>svg>circle.fui-Spinner__Tail{-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;}", ".f10r9z1l>svg>circle.fui-Spinner__Tail{-webkit-animation-timing-function:cubic-bezier(0.33,0,0.67,1);animation-timing-function:cubic-bezier(0.33,0,0.67,1);}", ".fu3xdw0>svg>circle.fui-Spinner__Tail{stroke-linecap:round;}", ".f1ttdh6v>svg>circle.fui-Spinner__Tail{-webkit-transform:rotate(-90deg);-moz-transform:rotate(-90deg);-ms-transform:rotate(-90deg);transform:rotate(-90deg);}", ".fmyjox0>svg>circle.fui-Spinner__Tail{-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg);}", ".f1eseayc>svg>circle.fui-Spinner__Tail{transform-origin:50% 50%;}", ".f1iqpjmu>svg>circle.fui-Spinner__Track{stroke:var(--colorNeutralBackgroundInverted);}", ".f11ditju>svg>circle.fui-Spinner__Tail{stroke:var(--colorBrandStroke1);}", ".f12uf417>svg>circle.fui-Spinner__Track{stroke:var(--colorNeutralBackground4);}"],
187
+ "k": ["@-webkit-keyframes f1v1ql0f{0%{stroke-dasharray:1,150;stroke-dashoffset:0;}50%{stroke-dasharray:90,150;stroke-dashoffset:-35;}100%{stroke-dasharray:90,150;stroke-dashoffset:-124;}}", "@keyframes f1v1ql0f{0%{stroke-dasharray:1,150;stroke-dashoffset:0;}50%{stroke-dasharray:90,150;stroke-dashoffset:-35;}100%{stroke-dasharray:90,150;stroke-dashoffset:-124;}}"],
188
+ "t": ["@media screen and (forced-colors: active){.f1m9nikz>svg>circle.fui-Spinner__Tail{stroke:var(--colorNeutralStrokeOnBrand2);}}", "@media screen and (forced-colors: active){.flglbw1>svg>circle.fui-Spinner__Track{stroke:var(--colorNeutralBackgroundInverted);}}"]
189
+ });
190
+
191
+ const useLabelStyles = /*#__PURE__*/__styles({
192
+ "tiny": {
193
+ "Be2twd7": "fkhj508",
194
+ "Bg96gwp": "f1i3iumi"
195
+ },
196
+ "extraSmall": {
197
+ "Be2twd7": "fkhj508",
198
+ "Bg96gwp": "f1i3iumi"
199
+ },
200
+ "small": {
201
+ "Be2twd7": "fkhj508",
202
+ "Bg96gwp": "f1i3iumi"
203
+ },
204
+ "medium": {
205
+ "Be2twd7": "fod5ikn",
206
+ "Bg96gwp": "faaz57k"
207
+ },
208
+ "large": {
209
+ "Be2twd7": "fod5ikn",
210
+ "Bg96gwp": "faaz57k"
211
+ },
212
+ "extraLarge": {
213
+ "Be2twd7": "fod5ikn",
214
+ "Bg96gwp": "faaz57k"
215
+ },
216
+ "huge": {
217
+ "Be2twd7": "f1pp30po",
218
+ "Bg96gwp": "f106mvju"
219
+ }
220
+ }, {
221
+ "d": [".fkhj508{font-size:var(--fontSizeBase300);}", ".f1i3iumi{line-height:var(--lineHeightBase300);}", ".fod5ikn{font-size:var(--fontSizeBase400);}", ".faaz57k{line-height:var(--lineHeightBase400);}", ".f1pp30po{font-size:var(--fontSizeBase500);}", ".f106mvju{line-height:var(--lineHeightBase500);}"]
222
+ });
223
+ /**
224
+ * Apply styling to the Spinner slots based on the state
225
+ */
226
+
227
+
228
+ export const useSpinnerStyles_unstable = state => {
229
+ const {
230
+ labelPosition,
231
+ size = 'medium'
232
+ } = state;
233
+ const rootStyles = useRootStyles();
234
+ const spinnerStyles = useLoaderStyles();
235
+ const labelStyles = useLabelStyles();
236
+ const trackStyles = useTrackStyles();
237
+ state.root.className = mergeClasses(spinnerClassNames.root, rootStyles.root, (labelPosition === 'above' || labelPosition === 'below') && rootStyles.vertical, (labelPosition === 'before' || labelPosition === 'after') && rootStyles.horizontal, state.root.className);
238
+
239
+ if (state.spinner && state.appearance) {
240
+ state.spinner.className = mergeClasses(spinnerClassNames.spinner, spinnerStyles.spinnerSVG, size === 'extra-small' && spinnerStyles.extraSmall, size === 'extra-large' && spinnerStyles.extraLarge, size !== 'extra-large' && size !== 'extra-small' && spinnerStyles[size], trackStyles[state.appearance], state.spinner.className);
241
+ }
242
+
243
+ if (state.label) {
244
+ state.label.className = mergeClasses(spinnerClassNames.label, size === 'extra-small' && labelStyles.extraSmall, size === 'extra-large' && labelStyles.extraLarge, size !== 'extra-large' && size !== 'extra-small' && labelStyles[size], state.label.className);
245
+ }
246
+
247
+ return state;
248
+ };
249
+ //# sourceMappingURL=useSpinnerStyles.js.map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AT,IAA0B,WAAW,CAAC,UAFJ,EAGlC,IAAI,KAAK,aAAT,IAA0B,WAAW,CAAC,UAHJ,EAIlC,IAAI,KAAK,aAAT,IAA0B,IAAI,KAAK,aAAnC,IAAoD,WAAW,CAAC,IAAD,CAJ7B,EAKlC,KAAK,CAAC,KAAN,CAAY,SALsB,CAApC;AAOD;;AAED,SAAO,KAAP;AACD,CApCM","sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { SpinnerState, SpinnerSlots } from './Spinner.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const spinnerClassNames: SlotClassNames<SpinnerSlots> = {\n root: 'fui-Spinner',\n spinner: 'fui-Spinner__spinner',\n label: 'fui-Spinner__label',\n};\n\n/*\n * TODO: Update with proper tokens when added\n * Radii for the Spinner circles\n */\nconst rValues = {\n tiny: '9',\n extraSmall: '11',\n small: '13',\n medium: '14.5',\n large: '16.5',\n extraLarge: '18.5',\n huge: '20',\n};\n\n/*\n * TODO: Update with proper tokens when added\n * Sizes for the Spinner\n */\nconst spinnnerSizes = {\n tiny: '20px',\n extraSmall: '24px',\n small: '28px',\n medium: '32px',\n large: '36px',\n extraLarge: '40px',\n huge: '44px',\n};\n\n/*\n * TODO: Update with proper tokens when added\n * Stroke widths for the Spinner\n */\nconst spinnerStrokeWidth = {\n sWidth: '2px',\n mWidth: '3px',\n lWidth: '4px',\n};\n\n/*\n * TODO: Update with proper tokens when added\n * Animation for Spinner\n */\nconst spinnerAnimation = {\n container: {\n animationDuration: '3s',\n animationIterationCount: 'infinite',\n animationTimingFunction: 'linear',\n backgroundColor: 'transparent',\n },\n};\n\n/*\n * TODO: Update with proper tokens when added\n * Label sizes for the Spinner\n */\nconst labelSizeTokens = {\n body1: {\n fontSize: tokens.fontSizeBase300,\n lineHeight: tokens.lineHeightBase300,\n },\n\n subtitle2: {\n fontSize: tokens.fontSizeBase400,\n lineHeight: tokens.lineHeightBase400,\n },\n\n subtitle1: {\n fontSize: tokens.fontSizeBase500,\n lineHeight: tokens.lineHeightBase500,\n },\n};\n\n/**\n * Styles for the root slot\n */\nconst useRootStyles = makeStyles({\n root: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n ...shorthands.gap('8px'),\n },\n\n horizontal: {\n flexDirection: 'row',\n },\n\n vertical: {\n flexDirection: 'column',\n },\n});\n\nconst useLoaderStyles = makeStyles({\n // global SVG class\n spinnerSVG: {\n ':focus-visible': {\n outlineStyle: '3px solid transparent',\n },\n ['& > svg']: {\n animationName: {\n '0%': { transform: 'rotate(0deg)' },\n '100%': { transform: 'rotate(360deg)' },\n },\n ...spinnerAnimation.container,\n },\n ['& > svg > circle']: {\n cx: '50%',\n cy: '50%',\n fill: 'none',\n },\n },\n\n tiny: {\n ['& > svg']: {\n height: spinnnerSizes.tiny,\n width: spinnnerSizes.tiny,\n },\n ['& > svg > circle']: {\n strokeWidth: spinnerStrokeWidth.sWidth,\n r: rValues.tiny,\n },\n },\n\n extraSmall: {\n ['& > svg']: {\n height: spinnnerSizes.extraSmall,\n width: spinnnerSizes.extraSmall,\n },\n ['& > svg > circle']: {\n strokeWidth: spinnerStrokeWidth.sWidth,\n r: rValues.extraSmall,\n },\n },\n\n small: {\n ['& > svg']: {\n height: spinnnerSizes.small,\n width: spinnnerSizes.small,\n },\n ['& > svg > circle']: {\n strokeWidth: spinnerStrokeWidth.sWidth,\n r: rValues.small,\n },\n },\n\n medium: {\n ['& > svg']: {\n height: spinnnerSizes.medium,\n width: spinnnerSizes.medium,\n },\n ['& > svg > circle']: {\n strokeWidth: spinnerStrokeWidth.mWidth,\n r: rValues.medium,\n },\n },\n\n large: {\n ['& > svg']: {\n height: spinnnerSizes.large,\n width: spinnnerSizes.large,\n },\n ['& > svg > circle']: {\n strokeWidth: spinnerStrokeWidth.mWidth,\n r: rValues.large,\n },\n },\n\n extraLarge: {\n ['& > svg']: {\n height: spinnnerSizes.extraLarge,\n width: spinnnerSizes.extraLarge,\n },\n ['& > svg > circle']: {\n strokeWidth: spinnerStrokeWidth.mWidth,\n r: rValues.extraLarge,\n },\n },\n\n huge: {\n ['& > svg']: {\n height: spinnnerSizes.huge,\n width: spinnnerSizes.huge,\n },\n ['& > svg > circle']: {\n strokeWidth: spinnerStrokeWidth.lWidth,\n r: rValues.huge,\n },\n },\n});\n\nconst useTrackStyles = makeStyles({\n inverted: {\n ['& > svg > circle.fui-Spinner__Tail']: {\n stroke: tokens.colorNeutralStrokeOnBrand2,\n animationName: {\n '0%': {\n strokeDasharray: '1,150',\n strokeDashoffset: '0',\n },\n\n '50%': {\n strokeDasharray: '90,150',\n strokeDashoffset: '-35',\n },\n\n '100%': {\n strokeDasharray: '90,150',\n strokeDashoffset: '-124',\n },\n },\n animationDuration: '1.5s',\n animationIterationCount: 'infinite',\n animationTimingFunction: 'cubic-bezier(0.33,0,0.67,1)',\n strokeLinecap: 'round',\n transform: 'rotate(-90deg)',\n transformOrigin: '50% 50%',\n },\n\n ['& > svg > circle.fui-Spinner__Track']: {\n stroke: tokens.colorNeutralBackgroundInverted,\n },\n },\n primary: {\n ['& > svg > circle.fui-Spinner__Tail']: {\n stroke: tokens.colorBrandStroke1,\n '@media screen and (forced-colors: active)': {\n stroke: tokens.colorNeutralStrokeOnBrand2,\n },\n animationName: {\n '0%': {\n strokeDasharray: '1,150',\n strokeDashoffset: '0',\n },\n\n '50%': {\n strokeDasharray: '90,150',\n strokeDashoffset: '-35',\n },\n\n '100%': {\n strokeDasharray: '90,150',\n strokeDashoffset: '-124',\n },\n },\n animationDuration: '1.5s',\n animationIterationCount: 'infinite',\n animationTimingFunction: 'cubic-bezier(0.33,0,0.67,1)',\n strokeLinecap: 'round',\n transform: 'rotate(-90deg)',\n transformOrigin: '50% 50%',\n },\n ['& > svg > circle.fui-Spinner__Track']: {\n stroke: tokens.colorNeutralBackground4,\n '@media screen and (forced-colors: active)': {\n stroke: tokens.colorNeutralBackgroundInverted,\n },\n },\n },\n});\n\nconst useLabelStyles = makeStyles({\n // style for label\n\n tiny: {\n ...labelSizeTokens.body1,\n },\n\n extraSmall: {\n ...labelSizeTokens.body1,\n },\n\n small: {\n ...labelSizeTokens.body1,\n },\n\n medium: {\n ...labelSizeTokens.subtitle2,\n },\n\n large: {\n ...labelSizeTokens.subtitle2,\n },\n\n extraLarge: {\n ...labelSizeTokens.subtitle2,\n },\n\n huge: {\n ...labelSizeTokens.subtitle1,\n },\n});\n\n/**\n * Apply styling to the Spinner slots based on the state\n */\nexport const useSpinnerStyles_unstable = (state: SpinnerState): SpinnerState => {\n const { labelPosition, size = 'medium' } = state;\n const rootStyles = useRootStyles();\n const spinnerStyles = useLoaderStyles();\n const labelStyles = useLabelStyles();\n const trackStyles = useTrackStyles();\n\n state.root.className = mergeClasses(\n spinnerClassNames.root,\n rootStyles.root,\n (labelPosition === 'above' || labelPosition === 'below') && rootStyles.vertical,\n (labelPosition === 'before' || labelPosition === 'after') && rootStyles.horizontal,\n state.root.className,\n );\n if (state.spinner && state.appearance) {\n state.spinner.className = mergeClasses(\n spinnerClassNames.spinner,\n spinnerStyles.spinnerSVG,\n size === 'extra-small' && spinnerStyles.extraSmall,\n size === 'extra-large' && spinnerStyles.extraLarge,\n size !== 'extra-large' && size !== 'extra-small' && spinnerStyles[size],\n trackStyles[state.appearance],\n state.spinner.className,\n );\n }\n if (state.label) {\n state.label.className = mergeClasses(\n spinnerClassNames.label,\n size === 'extra-small' && labelStyles.extraSmall,\n size === 'extra-large' && labelStyles.extraLarge,\n size !== 'extra-large' && size !== 'extra-small' && labelStyles[size],\n state.label.className,\n );\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { Spinner, spinnerClassNames, renderSpinner_unstable, useSpinner_unstable, useSpinnerStyles_unstable, } from './Spinner';
2
+ export type { SpinnerProps, SpinnerSlots, SpinnerState } from './Spinner';
package/lib/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { Spinner, spinnerClassNames, renderSpinner_unstable, useSpinner_unstable, useSpinnerStyles_unstable } from './Spinner';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,SACE,OADF,EAEE,iBAFF,EAGE,sBAHF,EAIE,mBAJF,EAKE,yBALF,QAMO,WANP","sourcesContent":["export {\n Spinner,\n spinnerClassNames,\n renderSpinner_unstable,\n useSpinner_unstable,\n useSpinnerStyles_unstable,\n} from './Spinner';\nexport type { SpinnerProps, SpinnerSlots, SpinnerState } from './Spinner';\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,11 @@
1
+ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
+ // It should be published with your NPM package. It should not be tracked by Git.
3
+ {
4
+ "tsdocVersion": "0.12",
5
+ "toolPackages": [
6
+ {
7
+ "packageName": "@microsoft/api-extractor",
8
+ "packageVersion": "7.18.1"
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1 @@
1
+ export * from './components/Spinner/index';
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ const tslib_1 = /*#__PURE__*/require("tslib");
8
+
9
+ tslib_1.__exportStar(require("./components/Spinner/index"), exports);
10
+ //# sourceMappingURL=Spinner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["Spinner.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,4BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/Spinner/index';\n"],"sourceRoot":"../src/"}
@@ -0,0 +1 @@
1
+ export declare const DefaultSvg: () => JSX.Element;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DefaultSvg = void 0;
7
+
8
+ const React = /*#__PURE__*/require("react");
9
+
10
+ const DefaultSvg = () => React.createElement("svg", {
11
+ role: "progressbar",
12
+ className: "fui-Spinner__Progressbar"
13
+ }, React.createElement("circle", {
14
+ className: "fui-Spinner__Track"
15
+ }), React.createElement("circle", {
16
+ className: "fui-Spinner__Tail"
17
+ }));
18
+
19
+ exports.DefaultSvg = DefaultSvg;
20
+ //# sourceMappingURL=DefaultSvg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Spinner/DefaultSvg.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AAEO,MAAM,UAAU,GAAG,MACxB,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAK,EAAA,IAAI,EAAC,aAAV;AAAwB,EAAA,SAAS,EAAC;AAAlC,CAAA,EACE,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA;AAAQ,EAAA,SAAS,EAAC;AAAlB,CAAA,CADF,EAEE,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA;AAAQ,EAAA,SAAS,EAAC;AAAlB,CAAA,CAFF,CADK;;AAAM,OAAA,CAAA,UAAA,GAAU,UAAV","sourcesContent":["import * as React from 'react';\n\nexport const DefaultSvg = () => (\n <svg role=\"progressbar\" className=\"fui-Spinner__Progressbar\">\n <circle className=\"fui-Spinner__Track\" />\n <circle className=\"fui-Spinner__Tail\" />\n </svg>\n);\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,6 @@
1
+ import type { SpinnerProps } from './Spinner.types';
2
+ import type { ForwardRefComponent } from '@fluentui/react-utilities';
3
+ /**
4
+ * Converged Spinner component for the fluentui repo
5
+ */
6
+ export declare const Spinner: ForwardRefComponent<SpinnerProps>;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Spinner = void 0;
7
+
8
+ const React = /*#__PURE__*/require("react");
9
+
10
+ const useSpinner_1 = /*#__PURE__*/require("./useSpinner");
11
+
12
+ const renderSpinner_1 = /*#__PURE__*/require("./renderSpinner");
13
+
14
+ const useSpinnerStyles_1 = /*#__PURE__*/require("./useSpinnerStyles");
15
+ /**
16
+ * Converged Spinner component for the fluentui repo
17
+ */
18
+
19
+
20
+ exports.Spinner = /*#__PURE__*/React.forwardRef((props, ref) => {
21
+ const state = useSpinner_1.useSpinner_unstable(props, ref);
22
+ useSpinnerStyles_1.useSpinnerStyles_unstable(state);
23
+ return renderSpinner_1.renderSpinner_unstable(state);
24
+ });
25
+ exports.Spinner.displayName = 'Spinner';
26
+ //# sourceMappingURL=Spinner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Spinner/Spinner.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,YAAA,gBAAA,OAAA,CAAA,cAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,iBAAA,CAAA;;AACA,MAAA,kBAAA,gBAAA,OAAA,CAAA,oBAAA,CAAA;AAIA;;AAEG;;;AACU,OAAA,CAAA,OAAA,gBAA6C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACxF,QAAM,KAAK,GAAG,YAAA,CAAA,mBAAA,CAAoB,KAApB,EAA2B,GAA3B,CAAd;AAEA,EAAA,kBAAA,CAAA,yBAAA,CAA0B,KAA1B;AACA,SAAO,eAAA,CAAA,sBAAA,CAAuB,KAAvB,CAAP;AACD,CALyD,CAA7C;AAOb,OAAA,CAAA,OAAA,CAAQ,WAAR,GAAsB,SAAtB","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';\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 return renderSpinner_unstable(state);\n});\n\nSpinner.displayName = 'Spinner';\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,51 @@
1
+ import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
2
+ import { Label } from '@fluentui/react-label';
3
+ export declare type SpinnerSlots = {
4
+ /**
5
+ * The root of the Spinner.
6
+ * The root slot receives the `className` and `style` specified directly on the `<Spinner>`.
7
+ */
8
+ root: NonNullable<Slot<'div'>>;
9
+ /**
10
+ * The slot for the animated svg.
11
+ * The spinner slot receives the `className` and `style` that handles the spinning animation.
12
+ * An svg is also rendered as a child of this slot
13
+ */
14
+ spinner?: Slot<'span'>;
15
+ /**
16
+ * The label of the Slider.
17
+ * The label slot receives the styling related to the text associated with the Spinner.
18
+ */
19
+ label?: Slot<typeof Label>;
20
+ };
21
+ declare type SpinnerCommons = {
22
+ /**
23
+ * The appearance of the Spinner.
24
+ * @default 'primary'
25
+ */
26
+ appearance?: 'primary' | 'inverted';
27
+ /**
28
+ * Where the label is positioned relative to the Spinner
29
+ * @default 'after'
30
+ */
31
+ labelPosition?: 'above' | 'below' | 'before' | 'after';
32
+ /**
33
+ * The size of the spinner.
34
+ * @default 'medium'
35
+ */
36
+ size?: 'tiny' | 'extra-small' | 'small' | 'medium' | 'large' | 'extra-large' | 'huge';
37
+ /**
38
+ * The status of the Spinner.
39
+ * @default 'active'
40
+ */
41
+ status?: 'active' | 'inactive';
42
+ };
43
+ /**
44
+ * Spinner Props
45
+ */
46
+ export declare type SpinnerProps = Omit<ComponentProps<SpinnerSlots>, 'size'> & Partial<SpinnerCommons>;
47
+ /**
48
+ * State used in rendering Spinner
49
+ */
50
+ export declare type SpinnerState = ComponentState<SpinnerSlots> & SpinnerCommons;
51
+ export {};
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=Spinner.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":"../src/"}
@@ -0,0 +1,5 @@
1
+ export * from './Spinner';
2
+ export * from './Spinner.types';
3
+ export * from './renderSpinner';
4
+ export * from './useSpinner';
5
+ export * from './useSpinnerStyles';