@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.
- package/CHANGELOG.json +173 -0
- package/CHANGELOG.md +71 -0
- package/LICENSE +15 -0
- package/MIGRATION.md +17 -0
- package/README.md +28 -0
- package/Spec.md +135 -0
- package/dist/react-spinner.d.ts +89 -0
- package/lib/Spinner.d.ts +1 -0
- package/lib/Spinner.js +2 -0
- package/lib/Spinner.js.map +1 -0
- package/lib/components/Spinner/DefaultSvg.d.ts +1 -0
- package/lib/components/Spinner/DefaultSvg.js +10 -0
- package/lib/components/Spinner/DefaultSvg.js.map +1 -0
- package/lib/components/Spinner/Spinner.d.ts +6 -0
- package/lib/components/Spinner/Spinner.js +15 -0
- package/lib/components/Spinner/Spinner.js.map +1 -0
- package/lib/components/Spinner/Spinner.types.d.ts +51 -0
- package/lib/components/Spinner/Spinner.types.js +2 -0
- package/lib/components/Spinner/Spinner.types.js.map +1 -0
- package/lib/components/Spinner/index.d.ts +5 -0
- package/lib/components/Spinner/index.js +6 -0
- package/lib/components/Spinner/index.js.map +1 -0
- package/lib/components/Spinner/renderSpinner.d.ts +5 -0
- package/lib/components/Spinner/renderSpinner.js +22 -0
- package/lib/components/Spinner/renderSpinner.js.map +1 -0
- package/lib/components/Spinner/useSpinner.d.ts +12 -0
- package/lib/components/Spinner/useSpinner.js +66 -0
- package/lib/components/Spinner/useSpinner.js.map +1 -0
- package/lib/components/Spinner/useSpinnerStyles.d.ts +7 -0
- package/lib/components/Spinner/useSpinnerStyles.js +249 -0
- package/lib/components/Spinner/useSpinnerStyles.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -0
- package/lib/tsdoc-metadata.json +11 -0
- package/lib-commonjs/Spinner.d.ts +1 -0
- package/lib-commonjs/Spinner.js +10 -0
- package/lib-commonjs/Spinner.js.map +1 -0
- package/lib-commonjs/components/Spinner/DefaultSvg.d.ts +1 -0
- package/lib-commonjs/components/Spinner/DefaultSvg.js +20 -0
- package/lib-commonjs/components/Spinner/DefaultSvg.js.map +1 -0
- package/lib-commonjs/components/Spinner/Spinner.d.ts +6 -0
- package/lib-commonjs/components/Spinner/Spinner.js +26 -0
- package/lib-commonjs/components/Spinner/Spinner.js.map +1 -0
- package/lib-commonjs/components/Spinner/Spinner.types.d.ts +51 -0
- package/lib-commonjs/components/Spinner/Spinner.types.js +6 -0
- package/lib-commonjs/components/Spinner/Spinner.types.js.map +1 -0
- package/lib-commonjs/components/Spinner/index.d.ts +5 -0
- package/lib-commonjs/components/Spinner/index.js +18 -0
- package/lib-commonjs/components/Spinner/index.js.map +1 -0
- package/lib-commonjs/components/Spinner/renderSpinner.d.ts +5 -0
- package/lib-commonjs/components/Spinner/renderSpinner.js +33 -0
- package/lib-commonjs/components/Spinner/renderSpinner.js.map +1 -0
- package/lib-commonjs/components/Spinner/useSpinner.d.ts +12 -0
- package/lib-commonjs/components/Spinner/useSpinner.js +79 -0
- package/lib-commonjs/components/Spinner/useSpinner.js.map +1 -0
- package/lib-commonjs/components/Spinner/useSpinnerStyles.d.ts +7 -0
- package/lib-commonjs/components/Spinner/useSpinnerStyles.js +260 -0
- package/lib-commonjs/components/Spinner/useSpinnerStyles.js.map +1 -0
- package/lib-commonjs/index.d.ts +2 -0
- package/lib-commonjs/index.js +40 -0
- package/lib-commonjs/index.js.map +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,18 @@
|
|
|
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("./Spinner"), exports);
|
|
10
|
+
|
|
11
|
+
tslib_1.__exportStar(require("./Spinner.types"), exports);
|
|
12
|
+
|
|
13
|
+
tslib_1.__exportStar(require("./renderSpinner"), exports);
|
|
14
|
+
|
|
15
|
+
tslib_1.__exportStar(require("./useSpinner"), exports);
|
|
16
|
+
|
|
17
|
+
tslib_1.__exportStar(require("./useSpinnerStyles"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/Spinner/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,WAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,cAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,oBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './Spinner';\nexport * from './Spinner.types';\nexport * from './renderSpinner';\nexport * from './useSpinner';\nexport * from './useSpinnerStyles';\n"],"sourceRoot":"../src/"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.renderSpinner_unstable = void 0;
|
|
7
|
+
|
|
8
|
+
const React = /*#__PURE__*/require("react");
|
|
9
|
+
|
|
10
|
+
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
|
11
|
+
/**
|
|
12
|
+
* Render the final JSX of Spinner
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
const renderSpinner_unstable = state => {
|
|
17
|
+
const {
|
|
18
|
+
slots,
|
|
19
|
+
slotProps
|
|
20
|
+
} = react_utilities_1.getSlots(state);
|
|
21
|
+
const {
|
|
22
|
+
labelPosition,
|
|
23
|
+
status
|
|
24
|
+
} = state;
|
|
25
|
+
return React.createElement(slots.root, { ...slotProps.root
|
|
26
|
+
}, slots.label && (labelPosition === 'above' || labelPosition === 'before') && React.createElement(slots.label, { ...slotProps.label
|
|
27
|
+
}), slots.spinner && status === 'active' && React.createElement(slots.spinner, { ...slotProps.spinner
|
|
28
|
+
}), slots.label && (labelPosition === 'below' || labelPosition === 'after') && React.createElement(slots.label, { ...slotProps.label
|
|
29
|
+
}));
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
exports.renderSpinner_unstable = renderSpinner_unstable;
|
|
33
|
+
//# sourceMappingURL=renderSpinner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/Spinner/renderSpinner.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,sBAAsB,GAAI,KAAD,IAAwB;AAC5D,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,iBAAA,CAAA,QAAA,CAAuB,KAAvB,CAA7B;AACA,QAAM;AAAE,IAAA,aAAF;AAAiB,IAAA;AAAjB,MAA4B,KAAlC;AACA,SACE,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,KAA4E,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,KAAP,EAAY,EAAA,GAAK,SAAS,CAAC;AAAf,GAAZ,CAD/E,EAEG,KAAK,CAAC,OAAN,IAAiB,MAAM,KAAK,QAA5B,IAAwC,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,KAA2E,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,KAAP,EAAY,EAAA,GAAK,SAAS,CAAC;AAAf,GAAZ,CAH9E,CADF;AAOD,CAVM;;AAAM,OAAA,CAAA,sBAAA,GAAsB,sBAAtB","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,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useSpinner_unstable = void 0;
|
|
7
|
+
|
|
8
|
+
const React = /*#__PURE__*/require("react");
|
|
9
|
+
|
|
10
|
+
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
|
11
|
+
|
|
12
|
+
const react_label_1 = /*#__PURE__*/require("@fluentui/react-label");
|
|
13
|
+
|
|
14
|
+
const DefaultSvg_1 = /*#__PURE__*/require("./DefaultSvg");
|
|
15
|
+
/**
|
|
16
|
+
* Create the state required to render Spinner.
|
|
17
|
+
*
|
|
18
|
+
* The returned state can be modified with hooks such as useSpinnerStyles_unstable,
|
|
19
|
+
* before being passed to renderSpinner_unstable.
|
|
20
|
+
*
|
|
21
|
+
* @param props - props from this instance of Spinner
|
|
22
|
+
* @param ref - reference to root HTMLElement of Spinner
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
const useSpinner_unstable = (props, ref) => {
|
|
27
|
+
// Props
|
|
28
|
+
const {
|
|
29
|
+
appearance = 'primary',
|
|
30
|
+
labelPosition = 'after',
|
|
31
|
+
size = 'medium',
|
|
32
|
+
status = 'active'
|
|
33
|
+
} = props;
|
|
34
|
+
const baseId = react_utilities_1.useId('spinner');
|
|
35
|
+
const {
|
|
36
|
+
tabIndex,
|
|
37
|
+
...rest
|
|
38
|
+
} = props;
|
|
39
|
+
const nativeRoot = react_utilities_1.getNativeElementProps('div', {
|
|
40
|
+
ref,
|
|
41
|
+
...rest
|
|
42
|
+
}, ['size']);
|
|
43
|
+
const labelShorthand = react_utilities_1.resolveShorthand(props.label, {
|
|
44
|
+
defaultProps: {
|
|
45
|
+
id: baseId
|
|
46
|
+
},
|
|
47
|
+
required: false
|
|
48
|
+
});
|
|
49
|
+
const spinnerShortHand = react_utilities_1.resolveShorthand(props.spinner, {
|
|
50
|
+
required: true,
|
|
51
|
+
defaultProps: {
|
|
52
|
+
children: React.createElement(DefaultSvg_1.DefaultSvg, null),
|
|
53
|
+
tabIndex
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
if (labelShorthand && spinnerShortHand && !spinnerShortHand['aria-labelledby']) {
|
|
58
|
+
spinnerShortHand['aria-labelledby'] = labelShorthand.id;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const state = {
|
|
62
|
+
appearance,
|
|
63
|
+
labelPosition,
|
|
64
|
+
size,
|
|
65
|
+
status,
|
|
66
|
+
components: {
|
|
67
|
+
root: 'div',
|
|
68
|
+
spinner: 'span',
|
|
69
|
+
label: react_label_1.Label
|
|
70
|
+
},
|
|
71
|
+
root: nativeRoot,
|
|
72
|
+
spinner: spinnerShortHand,
|
|
73
|
+
label: labelShorthand
|
|
74
|
+
};
|
|
75
|
+
return state;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
exports.useSpinner_unstable = useSpinner_unstable;
|
|
79
|
+
//# sourceMappingURL=useSpinner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/Spinner/useSpinner.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAEA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,MAAA,YAAA,gBAAA,OAAA,CAAA,cAAA,CAAA;AAEA;;;;;;;;AAQG;;;AACI,MAAM,mBAAmB,GAAG,CAAC,KAAD,EAAsB,GAAtB,KAAmE;AACpG;AACA,QAAM;AAAE,IAAA,UAAU,GAAG,SAAf;AAA0B,IAAA,aAAa,GAAG,OAA1C;AAAmD,IAAA,IAAI,GAAG,QAA1D;AAAoE,IAAA,MAAM,GAAG;AAA7E,MAA0F,KAAhG;AACA,QAAM,MAAM,GAAG,iBAAA,CAAA,KAAA,CAAM,SAAN,CAAf;AAEA,QAAM;AAAE,IAAA,QAAF;AAAY,OAAG;AAAf,MAAwB,KAA9B;AACA,QAAM,UAAU,GAAG,iBAAA,CAAA,qBAAA,CAAsB,KAAtB,EAA6B;AAAE,IAAA,GAAF;AAAO,OAAG;AAAV,GAA7B,EAA+C,CAAC,MAAD,CAA/C,CAAnB;AAEA,QAAM,cAAc,GAAG,iBAAA,CAAA,gBAAA,CAAiB,KAAK,CAAC,KAAvB,EAA8B;AACnD,IAAA,YAAY,EAAE;AACZ,MAAA,EAAE,EAAE;AADQ,KADqC;AAInD,IAAA,QAAQ,EAAE;AAJyC,GAA9B,CAAvB;AAOA,QAAM,gBAAgB,GAAG,iBAAA,CAAA,gBAAA,CAAiB,KAAK,CAAC,OAAvB,EAAgC;AACvD,IAAA,QAAQ,EAAE,IAD6C;AAEvD,IAAA,YAAY,EAAE;AACZ,MAAA,QAAQ,EAAE,KAAA,CAAA,aAAA,CAAC,YAAA,CAAA,UAAD,EAAW,IAAX,CADE;AAEZ,MAAA;AAFY;AAFyC,GAAhC,CAAzB;;AAQA,MAAI,cAAc,IAAI,gBAAlB,IAAsC,CAAC,gBAAgB,CAAC,iBAAD,CAA3D,EAAgF;AAC9E,IAAA,gBAAgB,CAAC,iBAAD,CAAhB,GAAsC,cAAc,CAAC,EAArD;AACD;;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,aAAA,CAAA;AAHG,KALc;AAU1B,IAAA,IAAI,EAAE,UAVoB;AAW1B,IAAA,OAAO,EAAE,gBAXiB;AAY1B,IAAA,KAAK,EAAE;AAZmB,GAA5B;AAcA,SAAO,KAAP;AACD,CA1CM;;AAAM,OAAA,CAAA,mBAAA,GAAmB,mBAAnB","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,260 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useSpinnerStyles_unstable = exports.spinnerClassNames = void 0;
|
|
7
|
+
|
|
8
|
+
const react_1 = /*#__PURE__*/require("@griffel/react");
|
|
9
|
+
|
|
10
|
+
const react_theme_1 = /*#__PURE__*/require("@fluentui/react-theme");
|
|
11
|
+
|
|
12
|
+
exports.spinnerClassNames = {
|
|
13
|
+
root: 'fui-Spinner',
|
|
14
|
+
spinner: 'fui-Spinner__spinner',
|
|
15
|
+
label: 'fui-Spinner__label'
|
|
16
|
+
};
|
|
17
|
+
/*
|
|
18
|
+
* TODO: Update with proper tokens when added
|
|
19
|
+
* Radii for the Spinner circles
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
const rValues = {
|
|
23
|
+
tiny: '9',
|
|
24
|
+
extraSmall: '11',
|
|
25
|
+
small: '13',
|
|
26
|
+
medium: '14.5',
|
|
27
|
+
large: '16.5',
|
|
28
|
+
extraLarge: '18.5',
|
|
29
|
+
huge: '20'
|
|
30
|
+
};
|
|
31
|
+
/*
|
|
32
|
+
* TODO: Update with proper tokens when added
|
|
33
|
+
* Sizes for the Spinner
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
const spinnnerSizes = {
|
|
37
|
+
tiny: '20px',
|
|
38
|
+
extraSmall: '24px',
|
|
39
|
+
small: '28px',
|
|
40
|
+
medium: '32px',
|
|
41
|
+
large: '36px',
|
|
42
|
+
extraLarge: '40px',
|
|
43
|
+
huge: '44px'
|
|
44
|
+
};
|
|
45
|
+
/*
|
|
46
|
+
* TODO: Update with proper tokens when added
|
|
47
|
+
* Stroke widths for the Spinner
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
const spinnerStrokeWidth = {
|
|
51
|
+
sWidth: '2px',
|
|
52
|
+
mWidth: '3px',
|
|
53
|
+
lWidth: '4px'
|
|
54
|
+
};
|
|
55
|
+
/*
|
|
56
|
+
* TODO: Update with proper tokens when added
|
|
57
|
+
* Animation for Spinner
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
const spinnerAnimation = {
|
|
61
|
+
container: {
|
|
62
|
+
animationDuration: '3s',
|
|
63
|
+
animationIterationCount: 'infinite',
|
|
64
|
+
animationTimingFunction: 'linear',
|
|
65
|
+
backgroundColor: 'transparent'
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
/*
|
|
69
|
+
* TODO: Update with proper tokens when added
|
|
70
|
+
* Label sizes for the Spinner
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
const labelSizeTokens = {
|
|
74
|
+
body1: {
|
|
75
|
+
fontSize: react_theme_1.tokens.fontSizeBase300,
|
|
76
|
+
lineHeight: react_theme_1.tokens.lineHeightBase300
|
|
77
|
+
},
|
|
78
|
+
subtitle2: {
|
|
79
|
+
fontSize: react_theme_1.tokens.fontSizeBase400,
|
|
80
|
+
lineHeight: react_theme_1.tokens.lineHeightBase400
|
|
81
|
+
},
|
|
82
|
+
subtitle1: {
|
|
83
|
+
fontSize: react_theme_1.tokens.fontSizeBase500,
|
|
84
|
+
lineHeight: react_theme_1.tokens.lineHeightBase500
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Styles for the root slot
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
const useRootStyles = /*#__PURE__*/react_1.__styles({
|
|
92
|
+
"root": {
|
|
93
|
+
"mc9l5x": "f22iagw",
|
|
94
|
+
"Bt984gj": "f122n59",
|
|
95
|
+
"Brf1p80": "f4d9j23",
|
|
96
|
+
"i8kkvl": "f4px1ci",
|
|
97
|
+
"Belr9w4": "fn67r4l"
|
|
98
|
+
},
|
|
99
|
+
"horizontal": {
|
|
100
|
+
"Beiy3e4": "f1063pyq"
|
|
101
|
+
},
|
|
102
|
+
"vertical": {
|
|
103
|
+
"Beiy3e4": "f1vx9l62"
|
|
104
|
+
}
|
|
105
|
+
}, {
|
|
106
|
+
"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;}"]
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
const useLoaderStyles = /*#__PURE__*/react_1.__styles({
|
|
110
|
+
"spinnerSVG": {
|
|
111
|
+
"B486eqv": "f1nahjz1",
|
|
112
|
+
"Bwaue66": ["f5tbecn", "f15qb8s7"],
|
|
113
|
+
"fyp1ls": "fn4mtlg",
|
|
114
|
+
"ag6ruv": "f1y80fxs",
|
|
115
|
+
"osj692": "f1r2crtq",
|
|
116
|
+
"aq5vjd": "f1wsi8sr",
|
|
117
|
+
"d32isg": "f1da2vov",
|
|
118
|
+
"Bsvqbuc": "f11rfva0",
|
|
119
|
+
"b3s3i5": "f1exc66"
|
|
120
|
+
},
|
|
121
|
+
"tiny": {
|
|
122
|
+
"Bah9ito": "f1j4wmu2",
|
|
123
|
+
"ut6tcf": "f1vppzuq",
|
|
124
|
+
"B7p06xz": "f1subliv",
|
|
125
|
+
"B807ibg": "fd2apu6"
|
|
126
|
+
},
|
|
127
|
+
"extraSmall": {
|
|
128
|
+
"Bah9ito": "fmpqlna",
|
|
129
|
+
"ut6tcf": "f15z5jzu",
|
|
130
|
+
"B7p06xz": "f1subliv",
|
|
131
|
+
"B807ibg": "fm96dlc"
|
|
132
|
+
},
|
|
133
|
+
"small": {
|
|
134
|
+
"Bah9ito": "fo52gbo",
|
|
135
|
+
"ut6tcf": "f1b41i3v",
|
|
136
|
+
"B7p06xz": "f1subliv",
|
|
137
|
+
"B807ibg": "f1i91flz"
|
|
138
|
+
},
|
|
139
|
+
"medium": {
|
|
140
|
+
"Bah9ito": "f1aiqagr",
|
|
141
|
+
"ut6tcf": "f1wtx80b",
|
|
142
|
+
"B7p06xz": "f17vzdod",
|
|
143
|
+
"B807ibg": "fjlkznx"
|
|
144
|
+
},
|
|
145
|
+
"large": {
|
|
146
|
+
"Bah9ito": "f1trdq7b",
|
|
147
|
+
"ut6tcf": "f9e0mc5",
|
|
148
|
+
"B7p06xz": "f17vzdod",
|
|
149
|
+
"B807ibg": "f1upeyd8"
|
|
150
|
+
},
|
|
151
|
+
"extraLarge": {
|
|
152
|
+
"Bah9ito": "f89rf2a",
|
|
153
|
+
"ut6tcf": "f1w2xg3q",
|
|
154
|
+
"B7p06xz": "f17vzdod",
|
|
155
|
+
"B807ibg": "f1r2vitc"
|
|
156
|
+
},
|
|
157
|
+
"huge": {
|
|
158
|
+
"Bah9ito": "f1rx7k5y",
|
|
159
|
+
"ut6tcf": "f1vtyt49",
|
|
160
|
+
"B7p06xz": "f1l9ujyx",
|
|
161
|
+
"B807ibg": "fmhqutl"
|
|
162
|
+
}
|
|
163
|
+
}, {
|
|
164
|
+
"i": [".f1nahjz1:focus-visible{outline-style:3px solid transparent;}"],
|
|
165
|
+
"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);}}"],
|
|
166
|
+
"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;}"]
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
const useTrackStyles = /*#__PURE__*/react_1.__styles({
|
|
170
|
+
"inverted": {
|
|
171
|
+
"gwg7kz": "f1jvpmnu",
|
|
172
|
+
"Bvrehnu": "fq8a5sv",
|
|
173
|
+
"Bidp6o": "f1b4lwqj",
|
|
174
|
+
"cq3kgi": "f1najlst",
|
|
175
|
+
"Btwiser": "f10r9z1l",
|
|
176
|
+
"B8001xd": "fu3xdw0",
|
|
177
|
+
"Bdordwa": ["f1ttdh6v", "fmyjox0"],
|
|
178
|
+
"Bo2mdfu": "f1eseayc",
|
|
179
|
+
"Bksq7rz": "f1iqpjmu"
|
|
180
|
+
},
|
|
181
|
+
"primary": {
|
|
182
|
+
"gwg7kz": "f11ditju",
|
|
183
|
+
"B8k2rxp": "f1m9nikz",
|
|
184
|
+
"Bvrehnu": "fq8a5sv",
|
|
185
|
+
"Bidp6o": "f1b4lwqj",
|
|
186
|
+
"cq3kgi": "f1najlst",
|
|
187
|
+
"Btwiser": "f10r9z1l",
|
|
188
|
+
"B8001xd": "fu3xdw0",
|
|
189
|
+
"Bdordwa": ["f1ttdh6v", "fmyjox0"],
|
|
190
|
+
"Bo2mdfu": "f1eseayc",
|
|
191
|
+
"Bksq7rz": "f12uf417",
|
|
192
|
+
"y14cdu": "flglbw1"
|
|
193
|
+
}
|
|
194
|
+
}, {
|
|
195
|
+
"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);}"],
|
|
196
|
+
"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;}}"],
|
|
197
|
+
"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);}}"]
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
const useLabelStyles = /*#__PURE__*/react_1.__styles({
|
|
201
|
+
"tiny": {
|
|
202
|
+
"Be2twd7": "fkhj508",
|
|
203
|
+
"Bg96gwp": "f1i3iumi"
|
|
204
|
+
},
|
|
205
|
+
"extraSmall": {
|
|
206
|
+
"Be2twd7": "fkhj508",
|
|
207
|
+
"Bg96gwp": "f1i3iumi"
|
|
208
|
+
},
|
|
209
|
+
"small": {
|
|
210
|
+
"Be2twd7": "fkhj508",
|
|
211
|
+
"Bg96gwp": "f1i3iumi"
|
|
212
|
+
},
|
|
213
|
+
"medium": {
|
|
214
|
+
"Be2twd7": "fod5ikn",
|
|
215
|
+
"Bg96gwp": "faaz57k"
|
|
216
|
+
},
|
|
217
|
+
"large": {
|
|
218
|
+
"Be2twd7": "fod5ikn",
|
|
219
|
+
"Bg96gwp": "faaz57k"
|
|
220
|
+
},
|
|
221
|
+
"extraLarge": {
|
|
222
|
+
"Be2twd7": "fod5ikn",
|
|
223
|
+
"Bg96gwp": "faaz57k"
|
|
224
|
+
},
|
|
225
|
+
"huge": {
|
|
226
|
+
"Be2twd7": "f1pp30po",
|
|
227
|
+
"Bg96gwp": "f106mvju"
|
|
228
|
+
}
|
|
229
|
+
}, {
|
|
230
|
+
"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);}"]
|
|
231
|
+
});
|
|
232
|
+
/**
|
|
233
|
+
* Apply styling to the Spinner slots based on the state
|
|
234
|
+
*/
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
const useSpinnerStyles_unstable = state => {
|
|
238
|
+
const {
|
|
239
|
+
labelPosition,
|
|
240
|
+
size = 'medium'
|
|
241
|
+
} = state;
|
|
242
|
+
const rootStyles = useRootStyles();
|
|
243
|
+
const spinnerStyles = useLoaderStyles();
|
|
244
|
+
const labelStyles = useLabelStyles();
|
|
245
|
+
const trackStyles = useTrackStyles();
|
|
246
|
+
state.root.className = react_1.mergeClasses(exports.spinnerClassNames.root, rootStyles.root, (labelPosition === 'above' || labelPosition === 'below') && rootStyles.vertical, (labelPosition === 'before' || labelPosition === 'after') && rootStyles.horizontal, state.root.className);
|
|
247
|
+
|
|
248
|
+
if (state.spinner && state.appearance) {
|
|
249
|
+
state.spinner.className = react_1.mergeClasses(exports.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);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
if (state.label) {
|
|
253
|
+
state.label.className = react_1.mergeClasses(exports.spinnerClassNames.label, size === 'extra-small' && labelStyles.extraSmall, size === 'extra-large' && labelStyles.extraLarge, size !== 'extra-large' && size !== 'extra-small' && labelStyles[size], state.label.className);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
return state;
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
exports.useSpinnerStyles_unstable = useSpinnerStyles_unstable;
|
|
260
|
+
//# sourceMappingURL=useSpinnerStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/Spinner/useSpinnerStyles.ts"],"names":[],"mappings":"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","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/"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useSpinnerStyles_unstable = exports.useSpinner_unstable = exports.renderSpinner_unstable = exports.spinnerClassNames = exports.Spinner = void 0;
|
|
7
|
+
|
|
8
|
+
var Spinner_1 = /*#__PURE__*/require("./Spinner");
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(exports, "Spinner", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return Spinner_1.Spinner;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "spinnerClassNames", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () {
|
|
19
|
+
return Spinner_1.spinnerClassNames;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(exports, "renderSpinner_unstable", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () {
|
|
25
|
+
return Spinner_1.renderSpinner_unstable;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports, "useSpinner_unstable", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () {
|
|
31
|
+
return Spinner_1.useSpinner_unstable;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(exports, "useSpinnerStyles_unstable", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function () {
|
|
37
|
+
return Spinner_1.useSpinnerStyles_unstable;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,SAAA,gBAAA,OAAA,CAAA,WAAA,CAAA;;AACE,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,SAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,SAAA,CAAA,OAAA;AAAO;AAAP,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,mBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,SAAA,CAAA,iBAAA;AAAiB;AAAjB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,wBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,SAAA,CAAA,sBAAA;AAAsB;AAAtB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,qBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,SAAA,CAAA,mBAAA;AAAmB;AAAnB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,2BAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,SAAA,CAAA,yBAAA;AAAyB;AAAzB,CAAA","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/"}
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fluentui/react-spinner",
|
|
3
|
+
"version": "0.0.0-nightly-20220422-0419.1",
|
|
4
|
+
"description": "Spinner component for Fluent UI React",
|
|
5
|
+
"main": "lib-commonjs/index.js",
|
|
6
|
+
"module": "lib/index.js",
|
|
7
|
+
"typings": "lib/index.d.ts",
|
|
8
|
+
"sideEffects": false,
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/microsoft/fluentui"
|
|
12
|
+
},
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "just-scripts build",
|
|
16
|
+
"bundle-size": "bundle-size measure",
|
|
17
|
+
"clean": "just-scripts clean",
|
|
18
|
+
"code-style": "just-scripts code-style",
|
|
19
|
+
"just": "just-scripts",
|
|
20
|
+
"lint": "just-scripts lint",
|
|
21
|
+
"start": "yarn storybook",
|
|
22
|
+
"test": "jest --passWithNoTests",
|
|
23
|
+
"docs": "api-extractor run --config=config/api-extractor.local.json --local",
|
|
24
|
+
"build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output ./dist/packages/react-spinner/src && yarn docs",
|
|
25
|
+
"storybook": "node ../../scripts/storybook/runner",
|
|
26
|
+
"type-check": "tsc -b tsconfig.json"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@fluentui/eslint-plugin": "*",
|
|
30
|
+
"@fluentui/react-conformance": "*",
|
|
31
|
+
"@fluentui/react-conformance-griffel": "0.0.0-nightly-20220422-0419.1",
|
|
32
|
+
"@fluentui/scripts": "^1.0.0"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@fluentui/react-theme": "0.0.0-nightly-20220422-0419.1",
|
|
36
|
+
"@fluentui/react-label": "0.0.0-nightly-20220422-0419.1",
|
|
37
|
+
"@fluentui/react-utilities": "0.0.0-nightly-20220422-0419.1",
|
|
38
|
+
"@griffel/react": "1.0.3",
|
|
39
|
+
"tslib": "^2.1.0"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"@types/react": ">=16.8.0 <18.0.0",
|
|
43
|
+
"@types/react-dom": ">=16.8.0 <18.0.0",
|
|
44
|
+
"react": ">=16.8.0 <18.0.0",
|
|
45
|
+
"react-dom": ">=16.8.0 <18.0.0"
|
|
46
|
+
},
|
|
47
|
+
"beachball": {
|
|
48
|
+
"disallowedChangeTypes": [
|
|
49
|
+
"major",
|
|
50
|
+
"minor",
|
|
51
|
+
"patch"
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
"exports": {
|
|
55
|
+
".": {
|
|
56
|
+
"types": "./lib/index.d.ts",
|
|
57
|
+
"import": "./lib/index.js",
|
|
58
|
+
"require": "./lib-commonjs/index.js"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|