@fluentui/react-spinner 0.0.0-nightly-20230529-0417.1 → 0.0.0-nightly-20230530-0415.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.
- package/CHANGELOG.json +15 -15
- package/CHANGELOG.md +10 -10
- package/lib/Spinner.js +1 -0
- package/lib/Spinner.js.map +1 -1
- package/lib/components/Spinner/DefaultSvg.js +8 -7
- package/lib/components/Spinner/DefaultSvg.js.map +1 -1
- package/lib/components/Spinner/Spinner.js +6 -6
- package/lib/components/Spinner/Spinner.js.map +1 -1
- package/lib/components/Spinner/Spinner.types.js +2 -1
- package/lib/components/Spinner/Spinner.types.js.map +1 -1
- package/lib/components/Spinner/index.js +1 -0
- package/lib/components/Spinner/index.js.map +1 -1
- package/lib/components/Spinner/renderSpinner.js +6 -12
- package/lib/components/Spinner/renderSpinner.js.map +1 -1
- package/lib/components/Spinner/useSpinner.js +61 -64
- package/lib/components/Spinner/useSpinner.js.map +1 -1
- package/lib/components/Spinner/useSpinnerStyles.styles.js.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib-commonjs/Spinner.js.map +1 -1
- package/lib-commonjs/components/Spinner/DefaultSvg.js.map +1 -1
- package/lib-commonjs/components/Spinner/Spinner.js.map +1 -1
- package/lib-commonjs/components/Spinner/Spinner.types.js.map +1 -1
- package/lib-commonjs/components/Spinner/index.js.map +1 -1
- package/lib-commonjs/components/Spinner/renderSpinner.js.map +1 -1
- package/lib-commonjs/components/Spinner/useSpinner.js.map +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.json
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"name": "@fluentui/react-spinner",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
6
|
-
"tag": "@fluentui/react-spinner_v0.0.0-nightly-
|
|
7
|
-
"version": "0.0.0-nightly-
|
|
5
|
+
"date": "Tue, 30 May 2023 04:21:03 GMT",
|
|
6
|
+
"tag": "@fluentui/react-spinner_v0.0.0-nightly-20230530-0415.1",
|
|
7
|
+
"version": "0.0.0-nightly-20230530-0415.1",
|
|
8
8
|
"comments": {
|
|
9
9
|
"prerelease": [
|
|
10
10
|
{
|
|
@@ -16,38 +16,38 @@
|
|
|
16
16
|
{
|
|
17
17
|
"author": "beachball",
|
|
18
18
|
"package": "@fluentui/react-spinner",
|
|
19
|
-
"comment": "Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-
|
|
20
|
-
"commit": "
|
|
19
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20230530-0415.1",
|
|
20
|
+
"commit": "808fbe4052231d4cccf478348a770df18232f4f9"
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
"author": "beachball",
|
|
24
24
|
"package": "@fluentui/react-spinner",
|
|
25
|
-
"comment": "Bump @fluentui/react-label to v0.0.0-nightly-
|
|
26
|
-
"commit": "
|
|
25
|
+
"comment": "Bump @fluentui/react-label to v0.0.0-nightly-20230530-0415.1",
|
|
26
|
+
"commit": "808fbe4052231d4cccf478348a770df18232f4f9"
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
29
|
"author": "beachball",
|
|
30
30
|
"package": "@fluentui/react-spinner",
|
|
31
|
-
"comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightly-
|
|
32
|
-
"commit": "
|
|
31
|
+
"comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20230530-0415.1",
|
|
32
|
+
"commit": "808fbe4052231d4cccf478348a770df18232f4f9"
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
"author": "beachball",
|
|
36
36
|
"package": "@fluentui/react-spinner",
|
|
37
|
-
"comment": "Bump @fluentui/react-theme to v0.0.0-nightly-
|
|
38
|
-
"commit": "
|
|
37
|
+
"comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20230530-0415.1",
|
|
38
|
+
"commit": "808fbe4052231d4cccf478348a770df18232f4f9"
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
"author": "beachball",
|
|
42
42
|
"package": "@fluentui/react-spinner",
|
|
43
|
-
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-
|
|
44
|
-
"commit": "
|
|
43
|
+
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20230530-0415.1",
|
|
44
|
+
"commit": "808fbe4052231d4cccf478348a770df18232f4f9"
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
"author": "beachball",
|
|
48
48
|
"package": "@fluentui/react-spinner",
|
|
49
|
-
"comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-
|
|
50
|
-
"commit": "
|
|
49
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230530-0415.1",
|
|
50
|
+
"commit": "808fbe4052231d4cccf478348a770df18232f4f9"
|
|
51
51
|
}
|
|
52
52
|
]
|
|
53
53
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-spinner
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Tue, 30 May 2023 04:21:03 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## [0.0.0-nightly-
|
|
7
|
+
## [0.0.0-nightly-20230530-0415.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-spinner_v0.0.0-nightly-20230530-0415.1)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-spinner_v9.2.1..@fluentui/react-spinner_v0.0.0-nightly-
|
|
9
|
+
Tue, 30 May 2023 04:21:03 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-spinner_v9.2.1..@fluentui/react-spinner_v0.0.0-nightly-20230530-0415.1)
|
|
11
11
|
|
|
12
12
|
### Changes
|
|
13
13
|
|
|
14
14
|
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
|
|
15
|
-
- Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-
|
|
16
|
-
- Bump @fluentui/react-label to v0.0.0-nightly-
|
|
17
|
-
- Bump @fluentui/react-shared-contexts to v0.0.0-nightly-
|
|
18
|
-
- Bump @fluentui/react-theme to v0.0.0-nightly-
|
|
19
|
-
- Bump @fluentui/react-utilities to v0.0.0-nightly-
|
|
20
|
-
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-
|
|
15
|
+
- Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20230530-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/808fbe4052231d4cccf478348a770df18232f4f9) by beachball)
|
|
16
|
+
- Bump @fluentui/react-label to v0.0.0-nightly-20230530-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/808fbe4052231d4cccf478348a770df18232f4f9) by beachball)
|
|
17
|
+
- Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20230530-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/808fbe4052231d4cccf478348a770df18232f4f9) by beachball)
|
|
18
|
+
- Bump @fluentui/react-theme to v0.0.0-nightly-20230530-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/808fbe4052231d4cccf478348a770df18232f4f9) by beachball)
|
|
19
|
+
- Bump @fluentui/react-utilities to v0.0.0-nightly-20230530-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/808fbe4052231d4cccf478348a770df18232f4f9) by beachball)
|
|
20
|
+
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230530-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/808fbe4052231d4cccf478348a770df18232f4f9) by beachball)
|
|
21
21
|
|
|
22
22
|
## [9.2.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-spinner_v9.2.1)
|
|
23
23
|
|
package/lib/Spinner.js
CHANGED
package/lib/Spinner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/Spinner.ts"],"sourcesContent":["export * from './components/Spinner/index';\n"],"names":[],"mappings":"AAAA,cAAc,6BAA6B"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export const DefaultSvg = ()
|
|
3
|
-
|
|
4
|
-
}, /*#__PURE__*/React.createElement("circle", {
|
|
5
|
-
|
|
6
|
-
}), /*#__PURE__*/React.createElement("circle", {
|
|
7
|
-
|
|
8
|
-
}));
|
|
2
|
+
export const DefaultSvg = ()=>/*#__PURE__*/ React.createElement("svg", {
|
|
3
|
+
className: "fui-Spinner__Progressbar"
|
|
4
|
+
}, /*#__PURE__*/ React.createElement("circle", {
|
|
5
|
+
className: "fui-Spinner__Track"
|
|
6
|
+
}), /*#__PURE__*/ React.createElement("circle", {
|
|
7
|
+
className: "fui-Spinner__Tail"
|
|
8
|
+
}));
|
|
9
|
+
|
|
9
10
|
//# sourceMappingURL=DefaultSvg.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Spinner/DefaultSvg.tsx"],"sourcesContent":["import * as React from 'react';\n\nexport const DefaultSvg = () => (\n <svg className=\"fui-Spinner__Progressbar\">\n <circle className=\"fui-Spinner__Track\" />\n <circle className=\"fui-Spinner__Tail\" />\n </svg>\n);\n"],"names":["React","DefaultSvg","svg","className","circle"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,OAAO,MAAMC,aAAa,kBACxB,oBAACC;QAAIC,WAAU;qBACb,oBAACC;QAAOD,WAAU;sBAClB,oBAACC;QAAOD,WAAU;QAEpB"}
|
|
@@ -5,12 +5,12 @@ import { useSpinnerStyles_unstable } from './useSpinnerStyles.styles';
|
|
|
5
5
|
import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';
|
|
6
6
|
/**
|
|
7
7
|
* Converged Spinner component for the fluentui repo
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return renderSpinner_unstable(state);
|
|
8
|
+
*/ export const Spinner = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
9
|
+
const state = useSpinner_unstable(props, ref);
|
|
10
|
+
useSpinnerStyles_unstable(state);
|
|
11
|
+
useCustomStyleHook_unstable('useSpinnerStyles_unstable')(state);
|
|
12
|
+
return renderSpinner_unstable(state);
|
|
14
13
|
});
|
|
15
14
|
Spinner.displayName = 'Spinner';
|
|
15
|
+
|
|
16
16
|
//# sourceMappingURL=Spinner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../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.styles';\nimport type { SpinnerProps } from './Spinner.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_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 useCustomStyleHook_unstable('useSpinnerStyles_unstable')(state);\n\n return renderSpinner_unstable(state);\n});\n\nSpinner.displayName = 'Spinner';\n"],"names":["React","useSpinner_unstable","renderSpinner_unstable","useSpinnerStyles_unstable","useCustomStyleHook_unstable","Spinner","forwardRef","props","ref","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,mBAAmB,QAAQ,eAAe;AACnD,SAASC,sBAAsB,QAAQ,kBAAkB;AACzD,SAASC,yBAAyB,QAAQ,4BAA4B;AAGtE,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;CAEC,GACD,OAAO,MAAMC,wBAA6CL,MAAMM,UAAU,CAAC,CAACC,OAAOC,MAAQ;IACzF,MAAMC,QAAQR,oBAAoBM,OAAOC;IAEzCL,0BAA0BM;IAE1BL,4BAA4B,6BAA6BK;IAEzD,OAAOP,uBAAuBO;AAChC,GAAG;AAEHJ,QAAQK,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../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 * Time in milliseconds after component mount before spinner is visible.\n * @default 0\n */\n delay?: number;\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' | 'delay' | 'labelPosition' | 'size'>> & {\n /**\n * Should the spinner be rendered in the DOM\n */\n shouldRenderSpinner: boolean;\n };\n"],"names":[],"mappings":"AAAA,WA4DI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Spinner/index.ts"],"sourcesContent":["export * from './Spinner';\nexport * from './Spinner.types';\nexport * from './renderSpinner';\nexport * from './useSpinner';\nexport * from './useSpinnerStyles.styles';\n"],"names":[],"mappings":"AAAA,cAAc,YAAY;AAC1B,cAAc,kBAAkB;AAChC,cAAc,kBAAkB;AAChC,cAAc,eAAe;AAC7B,cAAc,4BAA4B"}
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
/** @jsxRuntime classic */ /** @jsx createElement */import { createElement } from '@fluentui/react-jsx-runtime';
|
|
1
|
+
/** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';
|
|
2
2
|
import { getSlotsNext } from '@fluentui/react-utilities';
|
|
3
3
|
/**
|
|
4
4
|
* Render the final JSX of Spinner
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
slots,
|
|
9
|
-
slotProps
|
|
10
|
-
} = getSlotsNext(state);
|
|
11
|
-
const {
|
|
12
|
-
labelPosition,
|
|
13
|
-
shouldRenderSpinner
|
|
14
|
-
} = state;
|
|
15
|
-
return /*#__PURE__*/createElement(slots.root, slotProps.root, slots.label && shouldRenderSpinner && (labelPosition === 'above' || labelPosition === 'before') && /*#__PURE__*/createElement(slots.label, slotProps.label), slots.spinner && shouldRenderSpinner && /*#__PURE__*/createElement(slots.spinner, slotProps.spinner), slots.label && shouldRenderSpinner && (labelPosition === 'below' || labelPosition === 'after') && /*#__PURE__*/createElement(slots.label, slotProps.label));
|
|
5
|
+
*/ export const renderSpinner_unstable = (state)=>{
|
|
6
|
+
const { slots , slotProps } = getSlotsNext(state);
|
|
7
|
+
const { labelPosition , shouldRenderSpinner } = state;
|
|
8
|
+
return /*#__PURE__*/ createElement(slots.root, slotProps.root, slots.label && shouldRenderSpinner && (labelPosition === 'above' || labelPosition === 'before') && /*#__PURE__*/ createElement(slots.label, slotProps.label), slots.spinner && shouldRenderSpinner && /*#__PURE__*/ createElement(slots.spinner, slotProps.spinner), slots.label && shouldRenderSpinner && (labelPosition === 'below' || labelPosition === 'after') && /*#__PURE__*/ createElement(slots.label, slotProps.label));
|
|
16
9
|
};
|
|
10
|
+
|
|
17
11
|
//# sourceMappingURL=renderSpinner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Spinner/renderSpinner.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\n\nimport { getSlotsNext } 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 } = getSlotsNext<SpinnerSlots>(state);\n const { labelPosition, shouldRenderSpinner } = state;\n return (\n <slots.root {...slotProps.root}>\n {slots.label && shouldRenderSpinner && (labelPosition === 'above' || labelPosition === 'before') && (\n <slots.label {...slotProps.label} />\n )}\n {slots.spinner && shouldRenderSpinner && <slots.spinner {...slotProps.spinner} />}\n {slots.label && shouldRenderSpinner && (labelPosition === 'below' || labelPosition === 'after') && (\n <slots.label {...slotProps.label} />\n )}\n </slots.root>\n );\n};\n"],"names":["createElement","getSlotsNext","renderSpinner_unstable","state","slots","slotProps","labelPosition","shouldRenderSpinner","root","label","spinner"],"mappings":"AAAA,wBAAwB,GACxB,uBAAuB,GAEvB,SAASA,aAAa,QAAQ,8BAA8B;AAE5D,SAASC,YAAY,QAAQ,4BAA4B;AAGzD;;CAEC,GACD,OAAO,MAAMC,yBAAyB,CAACC,QAAwB;IAC7D,MAAM,EAAEC,MAAK,EAAEC,UAAS,EAAE,GAAGJ,aAA2BE;IACxD,MAAM,EAAEG,cAAa,EAAEC,oBAAmB,EAAE,GAAGJ;IAC/C,qBACE,AAdJ,cAcKC,MAAMI,IAAI,EAAKH,UAAUG,IAAI,EAC3BJ,MAAMK,KAAK,IAAIF,uBAAwBD,CAAAA,kBAAkB,WAAWA,kBAAkB,QAAO,mBAC5F,AAhBR,cAgBSF,MAAMK,KAAK,EAAKJ,UAAUI,KAAK,GAEjCL,MAAMM,OAAO,IAAIH,qCAAuB,AAlB/C,cAkBgDH,MAAMM,OAAO,EAAKL,UAAUK,OAAO,GAC5EN,MAAMK,KAAK,IAAIF,uBAAwBD,CAAAA,kBAAkB,WAAWA,kBAAkB,OAAM,mBAC3F,AApBR,cAoBSF,MAAMK,KAAK,EAAKJ,UAAUI,KAAK;AAIxC,EAAE"}
|
|
@@ -10,71 +10,68 @@ import { DefaultSvg } from './DefaultSvg';
|
|
|
10
10
|
*
|
|
11
11
|
* @param props - props from this instance of Spinner
|
|
12
12
|
* @param ref - reference to root HTMLElement of Spinner
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
13
|
+
*/ export const useSpinner_unstable = (props, ref)=>{
|
|
14
|
+
// Props
|
|
15
|
+
const { appearance ='primary' , labelPosition ='after' , size ='medium' , delay =0 } = props;
|
|
16
|
+
const baseId = useId('spinner');
|
|
17
|
+
const { role ='progressbar' , tabIndex , ...rest } = props;
|
|
18
|
+
const nativeRoot = getNativeElementProps('div', {
|
|
19
|
+
ref,
|
|
20
|
+
role,
|
|
21
|
+
...rest
|
|
22
|
+
}, [
|
|
23
|
+
'size'
|
|
24
|
+
]);
|
|
25
|
+
const [isVisible, setIsVisible] = React.useState(true);
|
|
26
|
+
const [setDelayTimeout, clearDelayTimeout] = useTimeout();
|
|
27
|
+
React.useEffect(()=>{
|
|
28
|
+
if (delay <= 0) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
setIsVisible(false);
|
|
32
|
+
setDelayTimeout(()=>{
|
|
33
|
+
setIsVisible(true);
|
|
34
|
+
}, delay);
|
|
35
|
+
return ()=>{
|
|
36
|
+
clearDelayTimeout();
|
|
37
|
+
};
|
|
38
|
+
}, [
|
|
39
|
+
setDelayTimeout,
|
|
40
|
+
clearDelayTimeout,
|
|
41
|
+
delay
|
|
42
|
+
]);
|
|
43
|
+
const labelShorthand = resolveShorthand(props.label, {
|
|
44
|
+
defaultProps: {
|
|
45
|
+
id: baseId
|
|
46
|
+
},
|
|
47
|
+
required: false
|
|
48
|
+
});
|
|
49
|
+
const spinnerShortHand = resolveShorthand(props.spinner, {
|
|
50
|
+
required: true,
|
|
51
|
+
defaultProps: {
|
|
52
|
+
children: /*#__PURE__*/ React.createElement(DefaultSvg, null),
|
|
53
|
+
tabIndex
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
if (labelShorthand && nativeRoot && !nativeRoot['aria-labelledby']) {
|
|
57
|
+
nativeRoot['aria-labelledby'] = labelShorthand.id;
|
|
38
58
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
59
|
+
const state = {
|
|
60
|
+
appearance,
|
|
61
|
+
delay,
|
|
62
|
+
labelPosition,
|
|
63
|
+
size,
|
|
64
|
+
shouldRenderSpinner: isVisible,
|
|
65
|
+
components: {
|
|
66
|
+
root: 'div',
|
|
67
|
+
spinner: 'span',
|
|
68
|
+
label: Label
|
|
69
|
+
},
|
|
70
|
+
root: nativeRoot,
|
|
71
|
+
spinner: spinnerShortHand,
|
|
72
|
+
label: labelShorthand
|
|
45
73
|
};
|
|
46
|
-
|
|
47
|
-
const labelShorthand = resolveShorthand(props.label, {
|
|
48
|
-
defaultProps: {
|
|
49
|
-
id: baseId
|
|
50
|
-
},
|
|
51
|
-
required: false
|
|
52
|
-
});
|
|
53
|
-
const spinnerShortHand = resolveShorthand(props.spinner, {
|
|
54
|
-
required: true,
|
|
55
|
-
defaultProps: {
|
|
56
|
-
children: /*#__PURE__*/React.createElement(DefaultSvg, null),
|
|
57
|
-
tabIndex
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
if (labelShorthand && nativeRoot && !nativeRoot['aria-labelledby']) {
|
|
61
|
-
nativeRoot['aria-labelledby'] = labelShorthand.id;
|
|
62
|
-
}
|
|
63
|
-
const state = {
|
|
64
|
-
appearance,
|
|
65
|
-
delay,
|
|
66
|
-
labelPosition,
|
|
67
|
-
size,
|
|
68
|
-
shouldRenderSpinner: isVisible,
|
|
69
|
-
components: {
|
|
70
|
-
root: 'div',
|
|
71
|
-
spinner: 'span',
|
|
72
|
-
label: Label
|
|
73
|
-
},
|
|
74
|
-
root: nativeRoot,
|
|
75
|
-
spinner: spinnerShortHand,
|
|
76
|
-
label: labelShorthand
|
|
77
|
-
};
|
|
78
|
-
return state;
|
|
74
|
+
return state;
|
|
79
75
|
};
|
|
76
|
+
|
|
80
77
|
//# sourceMappingURL=useSpinner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Spinner/useSpinner.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand, useId, useTimeout } 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', delay = 0 } = 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 [isVisible, setIsVisible] = React.useState(true);\n\n const [setDelayTimeout, clearDelayTimeout] = useTimeout();\n\n React.useEffect(() => {\n if (delay <= 0) {\n return;\n }\n setIsVisible(false);\n setDelayTimeout(() => {\n setIsVisible(true);\n }, delay);\n\n return () => {\n clearDelayTimeout();\n };\n }, [setDelayTimeout, clearDelayTimeout, delay]);\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 delay,\n labelPosition,\n size,\n shouldRenderSpinner: isVisible,\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"],"names":["React","getNativeElementProps","resolveShorthand","useId","useTimeout","Label","DefaultSvg","useSpinner_unstable","props","ref","appearance","labelPosition","size","delay","baseId","role","tabIndex","rest","nativeRoot","isVisible","setIsVisible","useState","setDelayTimeout","clearDelayTimeout","useEffect","labelShorthand","label","defaultProps","id","required","spinnerShortHand","spinner","children","state","shouldRenderSpinner","components","root"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,gBAAgB,EAAEC,KAAK,EAAEC,UAAU,QAAQ,4BAA4B;AAEvG,SAASC,KAAK,QAAQ,wBAAwB;AAC9C,SAASC,UAAU,QAAQ,eAAe;AAE1C;;;;;;;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AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__styles","mergeClasses","shorthands","tokens","typographyStyles","spinnerClassNames","root","spinner","label","rValues","tiny","extraSmall","small","medium","large","extraLarge","huge","spinnnerSizes","spinnerAnimation","container","animationDuration","animationIterationCount","animationTimingFunction","backgroundColor","useRootStyles","mc9l5x","Bt984gj","Brf1p80","Bg96gwp","i8kkvl","Belr9w4","horizontal","Beiy3e4","vertical","d","useLoaderStyles","spinnerSVG","B3aqqti","Brovlpu","Bxa1mx5","Bwaue66","fyp1ls","ag6ruv","osj692","aq5vjd","tlu9e1","J3u96z","d32isg","Bsvqbuc","b3s3i5","Bah9ito","ut6tcf","B7p06xz","B807ibg","f","k","m","useTrackStyles","inverted","gwg7kz","Bvrehnu","Bidp6o","cq3kgi","Btwiser","B8001xd","Bdordwa","Bo2mdfu","E10nrc","Bwl7w15","Bksq7rz","primary","B8k2rxp","y14cdu","useLabelStyles","sj55zd","Bahqtrf","Be2twd7","Bhrd7zp","useSpinnerStyles_unstable","state","labelPosition","size","appearance","rootStyles","spinnerStyles","labelStyles","trackStyles","className"],"sources":["../../../src/components/Spinner/useSpinnerStyles.styles.ts"],"sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens, typographyStyles } 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: '9px',\n extraSmall: '11px',\n small: '13px',\n medium: '14.5px',\n large: '16.5px',\n extraLarge: '18.5px',\n huge: '20px',\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 * 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 * Styles for the root slot\n */\nconst useRootStyles = makeStyles({\n root: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n lineHeight: '0',\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': {\n ...shorthands.outline('3px', 'solid', 'transparent'),\n },\n ['& > svg']: {\n animationName: {\n '0%': { transform: 'rotate(0deg)' },\n '100%': { transform: 'rotate(360deg)' },\n },\n ...spinnerAnimation.container,\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n animationDuration: '0.01ms',\n animationIterationCount: '1',\n },\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: tokens.strokeWidthThick,\n r: rValues.tiny,\n },\n },\n\n 'extra-small': {\n ['& > svg']: {\n height: spinnnerSizes.extraSmall,\n width: spinnnerSizes.extraSmall,\n },\n ['& > svg > circle']: {\n strokeWidth: tokens.strokeWidthThick,\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: tokens.strokeWidthThick,\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: tokens.strokeWidthThicker,\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: tokens.strokeWidthThicker,\n r: rValues.large,\n },\n },\n\n 'extra-large': {\n ['& > svg']: {\n height: spinnnerSizes.extraLarge,\n width: spinnnerSizes.extraLarge,\n },\n ['& > svg > circle']: {\n strokeWidth: tokens.strokeWidthThicker,\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: tokens.strokeWidthThickest,\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: tokens.curveEasyEase,\n strokeLinecap: 'round',\n transform: 'rotate(-90deg)',\n transformOrigin: '50% 50%',\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n animationDuration: '0.01ms',\n animationIterationCount: '1',\n },\n },\n\n ['& > svg > circle.fui-Spinner__Track']: {\n stroke: 'rgba(255, 255, 255, 0.2)', // this is whiteAlpha[20] but that token is not exported\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: tokens.curveEasyEase,\n strokeLinecap: 'round',\n transform: 'rotate(-90deg)',\n transformOrigin: '50% 50%',\n '@media screen and (prefers-reduced-motion: reduce)': {\n animationDuration: '0.01ms',\n animationIterationCount: '1',\n },\n },\n ['& > svg > circle.fui-Spinner__Track']: {\n stroke: tokens.colorBrandStroke2,\n '@media screen and (forced-colors: active)': {\n stroke: tokens.colorNeutralBackgroundInverted,\n },\n },\n },\n});\n\nconst useLabelStyles = makeStyles({\n // style for label\n inverted: {\n color: 'rgba(255, 255, 255, 1)', // This is white alpha but the token is not exported\n },\n\n primary: {}, // no change\n\n tiny: {\n ...typographyStyles.body1,\n },\n\n 'extra-small': {\n ...typographyStyles.body1,\n },\n\n small: {\n ...typographyStyles.body1,\n },\n\n medium: {\n ...typographyStyles.subtitle2,\n },\n\n large: {\n ...typographyStyles.subtitle2,\n },\n\n 'extra-large': {\n ...typographyStyles.subtitle2,\n },\n\n huge: {\n ...typographyStyles.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, appearance = 'primary' } = 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) {\n state.spinner.className = mergeClasses(\n spinnerClassNames.spinner,\n spinnerStyles.spinnerSVG,\n spinnerStyles[size],\n trackStyles[appearance],\n state.spinner.className,\n );\n }\n if (state.label) {\n state.label.className = mergeClasses(\n spinnerClassNames.label,\n labelStyles[size],\n labelStyles[appearance],\n state.label.className,\n );\n }\n\n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BAAA,CAAkBE,OAAO,EACzB6E,aAAA,CAAchD,UAAU,EACxBgD,aAAa,CAACH,IAAA,CAAK,EACnBK,WAAW,CAACJ,UAAA,CAAW,EACvBH,KAAA,CAAMxE,OAAO,CAACgF,SAAS;EAE3B;EACA,IAAIR,KAAA,CAAMvE,KAAK,EAAE;IACfuE,KAAA,CAAMvE,KAAK,CAAC+E,SAAS,GAAGtF,YAAA,CACtBI,iBAAA,CAAkBG,KAAK,EACvB6E,WAAW,CAACJ,IAAA,CAAK,EACjBI,WAAW,CAACH,UAAA,CAAW,EACvBH,KAAA,CAAMvE,KAAK,CAAC+E,SAAS;EAEzB;EAEA,OAAOR,KAAA;AACT"}
|
|
1
|
+
{"version":3,"names":["__styles","mergeClasses","shorthands","tokens","typographyStyles","spinnerClassNames","root","spinner","label","rValues","tiny","extraSmall","small","medium","large","extraLarge","huge","spinnnerSizes","spinnerAnimation","container","animationDuration","animationIterationCount","animationTimingFunction","backgroundColor","useRootStyles","mc9l5x","Bt984gj","Brf1p80","Bg96gwp","i8kkvl","Belr9w4","horizontal","Beiy3e4","vertical","d","useLoaderStyles","spinnerSVG","B3aqqti","Brovlpu","Bxa1mx5","Bwaue66","fyp1ls","ag6ruv","osj692","aq5vjd","tlu9e1","J3u96z","d32isg","Bsvqbuc","b3s3i5","Bah9ito","ut6tcf","B7p06xz","B807ibg","f","k","m","useTrackStyles","inverted","gwg7kz","Bvrehnu","Bidp6o","cq3kgi","Btwiser","B8001xd","Bdordwa","Bo2mdfu","E10nrc","Bwl7w15","Bksq7rz","primary","B8k2rxp","y14cdu","useLabelStyles","sj55zd","Bahqtrf","Be2twd7","Bhrd7zp","useSpinnerStyles_unstable","state","labelPosition","size","appearance","rootStyles","spinnerStyles","labelStyles","trackStyles","className"],"sources":["../../../src/components/Spinner/useSpinnerStyles.styles.ts"],"sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens, typographyStyles } 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: '9px',\n extraSmall: '11px',\n small: '13px',\n medium: '14.5px',\n large: '16.5px',\n extraLarge: '18.5px',\n huge: '20px',\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 * 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 * Styles for the root slot\n */\nconst useRootStyles = makeStyles({\n root: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n lineHeight: '0',\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': {\n ...shorthands.outline('3px', 'solid', 'transparent'),\n },\n ['& > svg']: {\n animationName: {\n '0%': { transform: 'rotate(0deg)' },\n '100%': { transform: 'rotate(360deg)' },\n },\n ...spinnerAnimation.container,\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n animationDuration: '0.01ms',\n animationIterationCount: '1',\n },\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: tokens.strokeWidthThick,\n r: rValues.tiny,\n },\n },\n\n 'extra-small': {\n ['& > svg']: {\n height: spinnnerSizes.extraSmall,\n width: spinnnerSizes.extraSmall,\n },\n ['& > svg > circle']: {\n strokeWidth: tokens.strokeWidthThick,\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: tokens.strokeWidthThick,\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: tokens.strokeWidthThicker,\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: tokens.strokeWidthThicker,\n r: rValues.large,\n },\n },\n\n 'extra-large': {\n ['& > svg']: {\n height: spinnnerSizes.extraLarge,\n width: spinnnerSizes.extraLarge,\n },\n ['& > svg > circle']: {\n strokeWidth: tokens.strokeWidthThicker,\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: tokens.strokeWidthThickest,\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: tokens.curveEasyEase,\n strokeLinecap: 'round',\n transform: 'rotate(-90deg)',\n transformOrigin: '50% 50%',\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n animationDuration: '0.01ms',\n animationIterationCount: '1',\n },\n },\n\n ['& > svg > circle.fui-Spinner__Track']: {\n stroke: 'rgba(255, 255, 255, 0.2)', // this is whiteAlpha[20] but that token is not exported\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: tokens.curveEasyEase,\n strokeLinecap: 'round',\n transform: 'rotate(-90deg)',\n transformOrigin: '50% 50%',\n '@media screen and (prefers-reduced-motion: reduce)': {\n animationDuration: '0.01ms',\n animationIterationCount: '1',\n },\n },\n ['& > svg > circle.fui-Spinner__Track']: {\n stroke: tokens.colorBrandStroke2,\n '@media screen and (forced-colors: active)': {\n stroke: tokens.colorNeutralBackgroundInverted,\n },\n },\n },\n});\n\nconst useLabelStyles = makeStyles({\n // style for label\n inverted: {\n color: 'rgba(255, 255, 255, 1)', // This is white alpha but the token is not exported\n },\n\n primary: {}, // no change\n\n tiny: {\n ...typographyStyles.body1,\n },\n\n 'extra-small': {\n ...typographyStyles.body1,\n },\n\n small: {\n ...typographyStyles.body1,\n },\n\n medium: {\n ...typographyStyles.subtitle2,\n },\n\n large: {\n ...typographyStyles.subtitle2,\n },\n\n 'extra-large': {\n ...typographyStyles.subtitle2,\n },\n\n huge: {\n ...typographyStyles.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, appearance = 'primary' } = 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) {\n state.spinner.className = mergeClasses(\n spinnerClassNames.spinner,\n spinnerStyles.spinnerSVG,\n spinnerStyles[size],\n trackStyles[appearance],\n state.spinner.className,\n );\n }\n if (state.label) {\n state.label.className = mergeClasses(\n spinnerClassNames.label,\n labelStyles[size],\n labelStyles[appearance],\n state.label.className,\n );\n }\n\n return state;\n};\n"],"mappings":"AAAA,SAAAA,QAAA,EAAqBC,YAAY,EAAEC,UAAU,QAAQ;AACrD,SAASC,MAAM,EAAEC,gBAAgB,QAAQ;AAIzC,OAAO,MAAMC,iBAAA,GAAkD;EAC7DC,IAAA,EAAM;EACNC,OAAA,EAAS;EACTC,KAAA,EAAO;AACT;AAEA;;;;AAIA,MAAMC,OAAA,GAAU;EACdC,IAAA,EAAM;EACNC,UAAA,EAAY;EACZC,KAAA,EAAO;EACPC,MAAA,EAAQ;EACRC,KAAA,EAAO;EACPC,UAAA,EAAY;EACZC,IAAA,EAAM;AACR;AAEA;;;;AAIA,MAAMC,aAAA,GAAgB;EACpBP,IAAA,EAAM;EACNC,UAAA,EAAY;EACZC,KAAA,EAAO;EACPC,MAAA,EAAQ;EACRC,KAAA,EAAO;EACPC,UAAA,EAAY;EACZC,IAAA,EAAM;AACR;AAEA;;;;AAIA,MAAME,gBAAA,GAAmB;EACvBC,SAAA,EAAW;IACTC,iBAAA,EAAmB;IACnBC,uBAAA,EAAyB;IACzBC,uBAAA,EAAyB;IACzBC,eAAA,EAAiB;EACnB;AACF;AAEA;;;AAGA,MAAMC,aAAA,gBAAgBxB,QAAA;EAAAM,IAAA;IAAAmB,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA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SAAS,GAAGtF,YAAA,CACrBI,iBAAA,CAAkBC,IAAI,EACtB6E,UAAA,CAAW7E,IAAI,EACf,CAAC0E,aAAA,KAAkB,WAAWA,aAAA,KAAkB,OAAM,KAAMG,UAAA,CAAWlD,QAAQ,EAC/E,CAAC+C,aAAA,KAAkB,YAAYA,aAAA,KAAkB,OAAM,KAAMG,UAAA,CAAWpD,UAAU,EAClFgD,KAAA,CAAMzE,IAAI,CAACiF,SAAS;EAEtB,IAAIR,KAAA,CAAMxE,OAAO,EAAE;IACjBwE,KAAA,CAAMxE,OAAO,CAACgF,SAAS,GAAGtF,YAAA,CACxBI,iBAAA,CAAkBE,OAAO,EACzB6E,aAAA,CAAchD,UAAU,EACxBgD,aAAa,CAACH,IAAA,CAAK,EACnBK,WAAW,CAACJ,UAAA,CAAW,EACvBH,KAAA,CAAMxE,OAAO,CAACgF,SAAS;EAE3B;EACA,IAAIR,KAAA,CAAMvE,KAAK,EAAE;IACfuE,KAAA,CAAMvE,KAAK,CAAC+E,SAAS,GAAGtF,YAAA,CACtBI,iBAAA,CAAkBG,KAAK,EACvB6E,WAAW,CAACJ,IAAA,CAAK,EACjBI,WAAW,CAACH,UAAA,CAAW,EACvBH,KAAA,CAAMvE,KAAK,CAAC+E,SAAS;EAEzB;EAEA,OAAOR,KAAA;AACT"}
|
package/lib/index.js
CHANGED
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"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"],"names":["Spinner","spinnerClassNames","renderSpinner_unstable","useSpinner_unstable","useSpinnerStyles_unstable"],"mappings":"AAAA,SACEA,OAAO,EACPC,iBAAiB,EACjBC,sBAAsB,EACtBC,mBAAmB,EACnBC,yBAAyB,QACpB,YAAY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../lib/Spinner.js"],"sourcesContent":["export * from './components/Spinner/index';\n//# sourceMappingURL=Spinner.js.map"],"names":[],"mappings":";;;;;oBAAc;
|
|
1
|
+
{"version":3,"sources":["../lib/Spinner.js"],"sourcesContent":["export * from './components/Spinner/index';\n\n//# sourceMappingURL=Spinner.js.map"],"names":[],"mappings":";;;;;oBAAc;CAEd,mCAAmC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../lib/components/Spinner/DefaultSvg.js"],"sourcesContent":["import * as React from 'react';\nexport const DefaultSvg = ()
|
|
1
|
+
{"version":3,"sources":["../../../lib/components/Spinner/DefaultSvg.js"],"sourcesContent":["import * as React from 'react';\nexport const DefaultSvg = ()=>/*#__PURE__*/ React.createElement(\"svg\", {\n className: \"fui-Spinner__Progressbar\"\n }, /*#__PURE__*/ React.createElement(\"circle\", {\n className: \"fui-Spinner__Track\"\n }), /*#__PURE__*/ React.createElement(\"circle\", {\n className: \"fui-Spinner__Tail\"\n }));\n\n//# sourceMappingURL=DefaultSvg.js.map"],"names":["DefaultSvg","React","createElement","className"],"mappings":";;;;+BACaA;;aAAAA;;;6DADU;AAChB,MAAMA,aAAa,IAAI,WAAW,GAAGC,OAAMC,aAAa,CAAC,OAAO;QAC/DC,WAAW;IACf,GAAG,WAAW,GAAGF,OAAMC,aAAa,CAAC,UAAU;QAC3CC,WAAW;IACf,IAAI,WAAW,GAAGF,OAAMC,aAAa,CAAC,UAAU;QAC5CC,WAAW;IACf,KAEJ,sCAAsC"}
|
|
@@ -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.styles';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n/**\n * Converged Spinner component for the fluentui repo\n
|
|
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.styles';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n/**\n * Converged Spinner component for the fluentui repo\n */ export const Spinner = /*#__PURE__*/ React.forwardRef((props, ref)=>{\n const state = useSpinner_unstable(props, ref);\n useSpinnerStyles_unstable(state);\n useCustomStyleHook_unstable('useSpinnerStyles_unstable')(state);\n return renderSpinner_unstable(state);\n});\nSpinner.displayName = 'Spinner';\n\n//# sourceMappingURL=Spinner.js.map"],"names":["Spinner","React","forwardRef","props","ref","state","useSpinner_unstable","useSpinnerStyles_unstable","useCustomStyleHook_unstable","renderSpinner_unstable","displayName"],"mappings":";;;;+BAOiBA;;aAAAA;;;6DAPM;4BACa;+BACG;wCACG;qCACE;AAGjC,MAAMA,UAAU,WAAW,GAAGC,OAAMC,UAAU,CAAC,CAACC,OAAOC,MAAM;IACpE,MAAMC,QAAQC,IAAAA,+BAAmB,EAACH,OAAOC;IACzCG,IAAAA,iDAAyB,EAACF;IAC1BG,IAAAA,gDAA2B,EAAC,6BAA6BH;IACzD,OAAOI,IAAAA,qCAAsB,EAACJ;AAClC;AACAL,QAAQU,WAAW,GAAG,WAEtB,mCAAmC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../lib/components/Spinner/Spinner.types.js"],"sourcesContent":["export {};\n//# sourceMappingURL=Spinner.types.js.map"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"sources":["../../../lib/components/Spinner/Spinner.types.js"],"sourcesContent":["export { };\n\n//# sourceMappingURL=Spinner.types.js.map"],"names":[],"mappings":";;;;CAEA,yCAAyC"}
|
|
@@ -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.styles';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;oBACA;
|
|
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.styles';\n\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;oBACA;CAEd,iCAAiC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../lib/components/Spinner/renderSpinner.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsx createElement */import { createElement } from '@fluentui/react-jsx-runtime';\nimport { getSlotsNext } from '@fluentui/react-utilities';\n/**\n * Render the final JSX of Spinner\n
|
|
1
|
+
{"version":3,"sources":["../../../lib/components/Spinner/renderSpinner.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';\nimport { getSlotsNext } from '@fluentui/react-utilities';\n/**\n * Render the final JSX of Spinner\n */ export const renderSpinner_unstable = (state)=>{\n const { slots , slotProps } = getSlotsNext(state);\n const { labelPosition , shouldRenderSpinner } = state;\n return /*#__PURE__*/ createElement(slots.root, slotProps.root, slots.label && shouldRenderSpinner && (labelPosition === 'above' || labelPosition === 'before') && /*#__PURE__*/ createElement(slots.label, slotProps.label), slots.spinner && shouldRenderSpinner && /*#__PURE__*/ createElement(slots.spinner, slotProps.spinner), slots.label && shouldRenderSpinner && (labelPosition === 'below' || labelPosition === 'after') && /*#__PURE__*/ createElement(slots.label, slotProps.label));\n};\n\n//# sourceMappingURL=renderSpinner.js.map"],"names":["renderSpinner_unstable","state","slots","slotProps","getSlotsNext","labelPosition","shouldRenderSpinner","createElement","root","label","spinner"],"mappings":"AAAA,wBAAwB,GAAG,uBAAuB;;;;+BAIjCA;;aAAAA;;iCAJkE;gCACtD;AAGlB,MAAMA,yBAAyB,CAACC,QAAQ;IAC/C,MAAM,EAAEC,MAAK,EAAGC,UAAS,EAAG,GAAGC,IAAAA,4BAAY,EAACH;IAC5C,MAAM,EAAEI,cAAa,EAAGC,oBAAmB,EAAG,GAAGL;IACjD,OAAO,WAAW,GAAGM,IAAAA,8BAAa,EAACL,MAAMM,IAAI,EAAEL,UAAUK,IAAI,EAAEN,MAAMO,KAAK,IAAIH,uBAAwBD,CAAAA,kBAAkB,WAAWA,kBAAkB,QAAO,KAAM,WAAW,GAAGE,IAAAA,8BAAa,EAACL,MAAMO,KAAK,EAAEN,UAAUM,KAAK,GAAGP,MAAMQ,OAAO,IAAIJ,uBAAuB,WAAW,GAAGC,IAAAA,8BAAa,EAACL,MAAMQ,OAAO,EAAEP,UAAUO,OAAO,GAAGR,MAAMO,KAAK,IAAIH,uBAAwBD,CAAAA,kBAAkB,WAAWA,kBAAkB,OAAM,KAAM,WAAW,GAAGE,IAAAA,8BAAa,EAACL,MAAMO,KAAK,EAAEN,UAAUM,KAAK;AACle,GAEA,yCAAyC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../lib/components/Spinner/useSpinner.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand, useId, useTimeout } 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
|
|
1
|
+
{"version":3,"sources":["../../../lib/components/Spinner/useSpinner.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand, useId, useTimeout } 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 */ export const useSpinner_unstable = (props, ref)=>{\n // Props\n const { appearance ='primary' , labelPosition ='after' , size ='medium' , delay =0 } = props;\n const baseId = useId('spinner');\n const { role ='progressbar' , tabIndex , ...rest } = props;\n const nativeRoot = getNativeElementProps('div', {\n ref,\n role,\n ...rest\n }, [\n 'size'\n ]);\n const [isVisible, setIsVisible] = React.useState(true);\n const [setDelayTimeout, clearDelayTimeout] = useTimeout();\n React.useEffect(()=>{\n if (delay <= 0) {\n return;\n }\n setIsVisible(false);\n setDelayTimeout(()=>{\n setIsVisible(true);\n }, delay);\n return ()=>{\n clearDelayTimeout();\n };\n }, [\n setDelayTimeout,\n clearDelayTimeout,\n delay\n ]);\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 delay,\n labelPosition,\n size,\n shouldRenderSpinner: isVisible,\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\n//# sourceMappingURL=useSpinner.js.map"],"names":["useSpinner_unstable","props","ref","appearance","labelPosition","size","delay","baseId","useId","role","tabIndex","rest","nativeRoot","getNativeElementProps","isVisible","setIsVisible","React","useState","setDelayTimeout","clearDelayTimeout","useTimeout","useEffect","labelShorthand","resolveShorthand","label","defaultProps","id","required","spinnerShortHand","spinner","children","createElement","DefaultSvg","state","shouldRenderSpinner","components","root","Label"],"mappings":";;;;+BAYiBA;;aAAAA;;;6DAZM;gCACoD;4BACrD;4BACK;AAShB,MAAMA,sBAAsB,CAACC,OAAOC,MAAM;IACjD,QAAQ;IACR,MAAM,EAAEC,YAAY,UAAS,EAAGC,eAAe,QAAO,EAAGC,MAAM,SAAQ,EAAGC,OAAO,EAAC,EAAG,GAAGL;IACxF,MAAMM,SAASC,IAAAA,qBAAK,EAAC;IACrB,MAAM,EAAEC,MAAM,cAAa,EAAGC,SAAQ,EAAG,GAAGC,MAAM,GAAGV;IACrD,MAAMW,aAAaC,IAAAA,qCAAqB,EAAC,OAAO;QAC5CX;QACAO;QACA,GAAGE,IAAI;IACX,GAAG;QACC;KACH;IACD,MAAM,CAACG,WAAWC,aAAa,GAAGC,OAAMC,QAAQ,CAAC,IAAI;IACrD,MAAM,CAACC,iBAAiBC,kBAAkB,GAAGC,IAAAA,0BAAU;IACvDJ,OAAMK,SAAS,CAAC,IAAI;QAChB,IAAIf,SAAS,GAAG;YACZ;QACJ,CAAC;QACDS,aAAa,KAAK;QAClBG,gBAAgB,IAAI;YAChBH,aAAa,IAAI;QACrB,GAAGT;QACH,OAAO,IAAI;YACPa;QACJ;IACJ,GAAG;QACCD;QACAC;QACAb;KACH;IACD,MAAMgB,iBAAiBC,IAAAA,gCAAgB,EAACtB,MAAMuB,KAAK,EAAE;QACjDC,cAAc;YACVC,IAAInB;QACR;QACAoB,UAAU,KAAK;IACnB;IACA,MAAMC,mBAAmBL,IAAAA,gCAAgB,EAACtB,MAAM4B,OAAO,EAAE;QACrDF,UAAU,IAAI;QACdF,cAAc;YACVK,UAAU,WAAW,GAAGd,OAAMe,aAAa,CAACC,sBAAU,EAAE,IAAI;YAC5DtB;QACJ;IACJ;IACA,IAAIY,kBAAkBV,cAAc,CAACA,UAAU,CAAC,kBAAkB,EAAE;QAChEA,UAAU,CAAC,kBAAkB,GAAGU,eAAeI,EAAE;IACrD,CAAC;IACD,MAAMO,QAAQ;QACV9B;QACAG;QACAF;QACAC;QACA6B,qBAAqBpB;QACrBqB,YAAY;YACRC,MAAM;YACNP,SAAS;YACTL,OAAOa,iBAAK;QAChB;QACAD,MAAMxB;QACNiB,SAASD;QACTJ,OAAOF;IACX;IACA,OAAOW;AACX,GAEA,sCAAsC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../lib/index.js"],"sourcesContent":["export { Spinner, spinnerClassNames, renderSpinner_unstable, useSpinner_unstable, useSpinnerStyles_unstable } from './Spinner';\n//# sourceMappingURL=index.js.map"],"names":["Spinner","spinnerClassNames","renderSpinner_unstable","useSpinner_unstable","useSpinnerStyles_unstable"],"mappings":";;;;;;;;;;;IAASA,OAAO,MAAPA,gBAAO;IAAEC,iBAAiB,MAAjBA,0BAAiB;IAAEC,sBAAsB,MAAtBA,+BAAsB;IAAEC,mBAAmB,MAAnBA,4BAAmB;IAAEC,yBAAyB,MAAzBA,kCAAyB;;yBAAQ;
|
|
1
|
+
{"version":3,"sources":["../lib/index.js"],"sourcesContent":["export { Spinner, spinnerClassNames, renderSpinner_unstable, useSpinner_unstable, useSpinnerStyles_unstable } from './Spinner';\n\n//# sourceMappingURL=index.js.map"],"names":["Spinner","spinnerClassNames","renderSpinner_unstable","useSpinner_unstable","useSpinnerStyles_unstable"],"mappings":";;;;;;;;;;;IAASA,OAAO,MAAPA,gBAAO;IAAEC,iBAAiB,MAAjBA,0BAAiB;IAAEC,sBAAsB,MAAtBA,+BAAsB;IAAEC,mBAAmB,MAAnBA,4BAAmB;IAAEC,yBAAyB,MAAzBA,kCAAyB;;yBAAQ;CAEnH,iCAAiC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-spinner",
|
|
3
|
-
"version": "0.0.0-nightly-
|
|
3
|
+
"version": "0.0.0-nightly-20230530-0415.1",
|
|
4
4
|
"description": "Spinner component for Fluent UI React",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -28,16 +28,16 @@
|
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@fluentui/eslint-plugin": "*",
|
|
30
30
|
"@fluentui/react-conformance": "*",
|
|
31
|
-
"@fluentui/react-conformance-griffel": "0.0.0-nightly-
|
|
31
|
+
"@fluentui/react-conformance-griffel": "0.0.0-nightly-20230530-0415.1",
|
|
32
32
|
"@fluentui/scripts-api-extractor": "*",
|
|
33
33
|
"@fluentui/scripts-tasks": "*"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@fluentui/react-jsx-runtime": "0.0.0-nightly-
|
|
37
|
-
"@fluentui/react-label": "0.0.0-nightly-
|
|
38
|
-
"@fluentui/react-shared-contexts": "0.0.0-nightly-
|
|
39
|
-
"@fluentui/react-theme": "0.0.0-nightly-
|
|
40
|
-
"@fluentui/react-utilities": "0.0.0-nightly-
|
|
36
|
+
"@fluentui/react-jsx-runtime": "0.0.0-nightly-20230530-0415.1",
|
|
37
|
+
"@fluentui/react-label": "0.0.0-nightly-20230530-0415.1",
|
|
38
|
+
"@fluentui/react-shared-contexts": "0.0.0-nightly-20230530-0415.1",
|
|
39
|
+
"@fluentui/react-theme": "0.0.0-nightly-20230530-0415.1",
|
|
40
|
+
"@fluentui/react-utilities": "0.0.0-nightly-20230530-0415.1",
|
|
41
41
|
"@griffel/react": "^1.5.2",
|
|
42
42
|
"@swc/helpers": "^0.4.14"
|
|
43
43
|
},
|