@fluentui/react-spinner 0.0.0-nightly-20230804-0415.1 → 0.0.0-nightly-20230808-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 +56 -17
- package/CHANGELOG.md +24 -11
- package/lib/components/Spinner/renderSpinner.js +3 -3
- package/lib/components/Spinner/renderSpinner.js.map +1 -1
- package/lib/components/Spinner/useSpinner.js +12 -8
- package/lib/components/Spinner/useSpinner.js.map +1 -1
- package/lib-commonjs/components/Spinner/renderSpinner.js +2 -2
- package/lib-commonjs/components/Spinner/renderSpinner.js.map +1 -1
- package/lib-commonjs/components/Spinner/useSpinner.js +11 -7
- package/lib-commonjs/components/Spinner/useSpinner.js.map +1 -1
- package/package.json +8 -8
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, 08 Aug 2023 04:22:12 GMT",
|
|
6
|
+
"tag": "@fluentui/react-spinner_v0.0.0-nightly-20230808-0415.1",
|
|
7
|
+
"version": "0.0.0-nightly-20230808-0415.1",
|
|
8
8
|
"comments": {
|
|
9
9
|
"prerelease": [
|
|
10
10
|
{
|
|
@@ -16,44 +16,83 @@
|
|
|
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-20230808-0415.1",
|
|
20
|
+
"commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
|
|
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-20230808-0415.1",
|
|
26
|
+
"commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
|
|
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-20230808-0415.1",
|
|
32
|
+
"commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
|
|
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-20230808-0415.1",
|
|
38
|
+
"commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
|
|
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-20230808-0415.1",
|
|
44
|
+
"commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
"author": "beachball",
|
|
48
48
|
"package": "@fluentui/react-spinner",
|
|
49
|
-
"comment": "Bump @fluentui/react-conformance to v0.0.0-nightly-
|
|
50
|
-
"commit": "
|
|
49
|
+
"comment": "Bump @fluentui/react-conformance to v0.0.0-nightly-20230808-0415.1",
|
|
50
|
+
"commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
53
|
"author": "beachball",
|
|
54
54
|
"package": "@fluentui/react-spinner",
|
|
55
|
-
"comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-
|
|
56
|
-
"commit": "
|
|
55
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230808-0415.1",
|
|
56
|
+
"commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"date": "Fri, 04 Aug 2023 08:52:58 GMT",
|
|
63
|
+
"tag": "@fluentui/react-spinner_v9.3.3",
|
|
64
|
+
"version": "9.3.3",
|
|
65
|
+
"comments": {
|
|
66
|
+
"patch": [
|
|
67
|
+
{
|
|
68
|
+
"author": "beachball",
|
|
69
|
+
"package": "@fluentui/react-spinner",
|
|
70
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.13",
|
|
71
|
+
"commit": "0bf7d9438c1d0ff90cd2b28bc4cceb4f807afbca"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"author": "beachball",
|
|
75
|
+
"package": "@fluentui/react-spinner",
|
|
76
|
+
"comment": "Bump @fluentui/react-label to v9.1.23",
|
|
77
|
+
"commit": "0bf7d9438c1d0ff90cd2b28bc4cceb4f807afbca"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"author": "beachball",
|
|
81
|
+
"package": "@fluentui/react-spinner",
|
|
82
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.7.1",
|
|
83
|
+
"commit": "0bf7d9438c1d0ff90cd2b28bc4cceb4f807afbca"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"author": "beachball",
|
|
87
|
+
"package": "@fluentui/react-spinner",
|
|
88
|
+
"comment": "Bump @fluentui/react-theme to v9.1.10",
|
|
89
|
+
"commit": "0bf7d9438c1d0ff90cd2b28bc4cceb4f807afbca"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"author": "beachball",
|
|
93
|
+
"package": "@fluentui/react-spinner",
|
|
94
|
+
"comment": "Bump @fluentui/react-utilities to v9.11.0",
|
|
95
|
+
"commit": "0bf7d9438c1d0ff90cd2b28bc4cceb4f807afbca"
|
|
57
96
|
}
|
|
58
97
|
]
|
|
59
98
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,24 +1,37 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-spinner
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Tue, 08 Aug 2023 04:22:12 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-20230808-0415.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-spinner_v0.0.0-nightly-20230808-0415.1)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-spinner_v9.3.
|
|
9
|
+
Tue, 08 Aug 2023 04:22:12 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-spinner_v9.3.3..@fluentui/react-spinner_v0.0.0-nightly-20230808-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 to v0.0.0-nightly-
|
|
21
|
-
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-
|
|
15
|
+
- Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
|
|
16
|
+
- Bump @fluentui/react-label to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
|
|
17
|
+
- Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
|
|
18
|
+
- Bump @fluentui/react-theme to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
|
|
19
|
+
- Bump @fluentui/react-utilities to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
|
|
20
|
+
- Bump @fluentui/react-conformance to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
|
|
21
|
+
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
|
|
22
|
+
|
|
23
|
+
## [9.3.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-spinner_v9.3.3)
|
|
24
|
+
|
|
25
|
+
Fri, 04 Aug 2023 08:52:58 GMT
|
|
26
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-spinner_v9.3.2..@fluentui/react-spinner_v9.3.3)
|
|
27
|
+
|
|
28
|
+
### Patches
|
|
29
|
+
|
|
30
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.13 ([commit](https://github.com/microsoft/fluentui/commit/0bf7d9438c1d0ff90cd2b28bc4cceb4f807afbca) by beachball)
|
|
31
|
+
- Bump @fluentui/react-label to v9.1.23 ([commit](https://github.com/microsoft/fluentui/commit/0bf7d9438c1d0ff90cd2b28bc4cceb4f807afbca) by beachball)
|
|
32
|
+
- Bump @fluentui/react-shared-contexts to v9.7.1 ([commit](https://github.com/microsoft/fluentui/commit/0bf7d9438c1d0ff90cd2b28bc4cceb4f807afbca) by beachball)
|
|
33
|
+
- Bump @fluentui/react-theme to v9.1.10 ([commit](https://github.com/microsoft/fluentui/commit/0bf7d9438c1d0ff90cd2b28bc4cceb4f807afbca) by beachball)
|
|
34
|
+
- Bump @fluentui/react-utilities to v9.11.0 ([commit](https://github.com/microsoft/fluentui/commit/0bf7d9438c1d0ff90cd2b28bc4cceb4f807afbca) by beachball)
|
|
22
35
|
|
|
23
36
|
## [9.3.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-spinner_v9.3.2)
|
|
24
37
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { assertSlots } from '@fluentui/react-utilities';
|
|
3
3
|
/**
|
|
4
4
|
* Render the final JSX of Spinner
|
|
5
5
|
*/ export const renderSpinner_unstable = (state)=>{
|
|
6
|
-
|
|
6
|
+
assertSlots(state);
|
|
7
7
|
const { labelPosition , shouldRenderSpinner } = state;
|
|
8
|
-
return /*#__PURE__*/ createElement(
|
|
8
|
+
return /*#__PURE__*/ createElement(state.root, null, state.label && shouldRenderSpinner && (labelPosition === 'above' || labelPosition === 'before') && /*#__PURE__*/ createElement(state.label, null), state.spinner && shouldRenderSpinner && /*#__PURE__*/ createElement(state.spinner, null), state.label && shouldRenderSpinner && (labelPosition === 'below' || labelPosition === 'after') && /*#__PURE__*/ createElement(state.label, null));
|
|
9
9
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderSpinner.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\n\nimport {
|
|
1
|
+
{"version":3,"sources":["renderSpinner.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\n\nimport { assertSlots } 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 assertSlots<SpinnerSlots>(state);\n const { labelPosition, shouldRenderSpinner } = state;\n return (\n <state.root>\n {state.label && shouldRenderSpinner && (labelPosition === 'above' || labelPosition === 'before') && (\n <state.label />\n )}\n\n {state.spinner && shouldRenderSpinner && <state.spinner />}\n {state.label && shouldRenderSpinner && (labelPosition === 'below' || labelPosition === 'after') && (\n <state.label />\n )}\n </state.root>\n );\n};\n"],"names":["createElement","assertSlots","renderSpinner_unstable","state","labelPosition","shouldRenderSpinner","root","label","spinner"],"mappings":"AAAA,wBAAwB,GACxB,uBAAuB,GAEvB,SAASA,aAAa,QAAQ,8BAA8B;AAE5D,SAASC,WAAW,QAAQ,4BAA4B;AAGxD;;CAEC,GACD,OAAO,MAAMC,yBAAyB,CAACC,QAAwB;IAC7DF,YAA0BE;IAC1B,MAAM,EAAEC,cAAa,EAAEC,oBAAmB,EAAE,GAAGF;IAC/C,qBACE,AAdJ,cAcKA,MAAMG,IAAI,QACRH,MAAMI,KAAK,IAAIF,uBAAwBD,CAAAA,kBAAkB,WAAWA,kBAAkB,QAAO,mBAC5F,AAhBR,cAgBSD,MAAMI,KAAK,SAGbJ,MAAMK,OAAO,IAAIH,qCAAuB,AAnB/C,cAmBgDF,MAAMK,OAAO,SACtDL,MAAMI,KAAK,IAAIF,uBAAwBD,CAAAA,kBAAkB,WAAWA,kBAAkB,OAAM,mBAC3F,AArBR,cAqBSD,MAAMI,KAAK;AAIpB,EAAE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { getNativeElementProps,
|
|
2
|
+
import { getNativeElementProps, useId, useTimeout, slot } from '@fluentui/react-utilities';
|
|
3
3
|
import { Label } from '@fluentui/react-label';
|
|
4
4
|
import { DefaultSvg } from './DefaultSvg';
|
|
5
5
|
import { useSpinnerContext } from '../../contexts/SpinnerContext';
|
|
@@ -17,13 +17,15 @@ import { useSpinnerContext } from '../../contexts/SpinnerContext';
|
|
|
17
17
|
const { appearance ='primary' , labelPosition ='after' , size =contextSize !== null && contextSize !== void 0 ? contextSize : 'medium' , delay =0 } = props;
|
|
18
18
|
const baseId = useId('spinner');
|
|
19
19
|
const { role ='progressbar' , tabIndex , ...rest } = props;
|
|
20
|
-
const nativeRoot = getNativeElementProps('div', {
|
|
20
|
+
const nativeRoot = slot.always(getNativeElementProps('div', {
|
|
21
21
|
ref,
|
|
22
22
|
role,
|
|
23
23
|
...rest
|
|
24
24
|
}, [
|
|
25
25
|
'size'
|
|
26
|
-
])
|
|
26
|
+
]), {
|
|
27
|
+
elementType: 'div'
|
|
28
|
+
});
|
|
27
29
|
const [isVisible, setIsVisible] = React.useState(true);
|
|
28
30
|
const [setDelayTimeout, clearDelayTimeout] = useTimeout();
|
|
29
31
|
React.useEffect(()=>{
|
|
@@ -42,18 +44,20 @@ import { useSpinnerContext } from '../../contexts/SpinnerContext';
|
|
|
42
44
|
clearDelayTimeout,
|
|
43
45
|
delay
|
|
44
46
|
]);
|
|
45
|
-
const labelShorthand =
|
|
47
|
+
const labelShorthand = slot.optional(props.label, {
|
|
46
48
|
defaultProps: {
|
|
47
49
|
id: baseId
|
|
48
50
|
},
|
|
49
|
-
|
|
51
|
+
renderByDefault: false,
|
|
52
|
+
elementType: Label
|
|
50
53
|
});
|
|
51
|
-
const spinnerShortHand =
|
|
52
|
-
|
|
54
|
+
const spinnerShortHand = slot.optional(props.spinner, {
|
|
55
|
+
renderByDefault: true,
|
|
53
56
|
defaultProps: {
|
|
54
57
|
children: /*#__PURE__*/ React.createElement(DefaultSvg, null),
|
|
55
58
|
tabIndex
|
|
56
|
-
}
|
|
59
|
+
},
|
|
60
|
+
elementType: 'span'
|
|
57
61
|
});
|
|
58
62
|
if (labelShorthand && nativeRoot && !nativeRoot['aria-labelledby']) {
|
|
59
63
|
nativeRoot['aria-labelledby'] = labelShorthand.id;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useSpinner.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps,
|
|
1
|
+
{"version":3,"sources":["useSpinner.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useId, useTimeout, slot } from '@fluentui/react-utilities';\nimport type { SpinnerProps, SpinnerState } from './Spinner.types';\nimport { Label } from '@fluentui/react-label';\nimport { DefaultSvg } from './DefaultSvg';\nimport { useSpinnerContext } from '../../contexts/SpinnerContext';\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 { size: contextSize } = useSpinnerContext();\n const { appearance = 'primary', labelPosition = 'after', size = contextSize ?? 'medium', delay = 0 } = props;\n const baseId = useId('spinner');\n\n const { role = 'progressbar', tabIndex, ...rest } = props;\n const nativeRoot = slot.always(getNativeElementProps('div', { ref, role, ...rest }, ['size']), {\n elementType: 'div',\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 }, [setDelayTimeout, clearDelayTimeout, delay]);\n const labelShorthand = slot.optional(props.label, {\n defaultProps: { id: baseId },\n renderByDefault: false,\n elementType: Label,\n });\n const spinnerShortHand = slot.optional(props.spinner, {\n renderByDefault: true,\n defaultProps: { children: <DefaultSvg />, tabIndex },\n elementType: 'span',\n });\n if (labelShorthand && nativeRoot && !nativeRoot['aria-labelledby']) {\n nativeRoot['aria-labelledby'] = labelShorthand.id;\n }\n const state: SpinnerState = {\n appearance,\n delay,\n labelPosition,\n size,\n shouldRenderSpinner: isVisible,\n components: { root: 'div', spinner: 'span', label: Label },\n root: nativeRoot,\n spinner: spinnerShortHand,\n label: labelShorthand,\n };\n return state;\n};\n"],"names":["React","getNativeElementProps","useId","useTimeout","slot","Label","DefaultSvg","useSpinnerContext","useSpinner_unstable","props","ref","size","contextSize","appearance","labelPosition","delay","baseId","role","tabIndex","rest","nativeRoot","always","elementType","isVisible","setIsVisible","useState","setDelayTimeout","clearDelayTimeout","useEffect","labelShorthand","optional","label","defaultProps","id","renderByDefault","spinnerShortHand","spinner","children","state","shouldRenderSpinner","components","root"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,KAAK,EAAEC,UAAU,EAAEC,IAAI,QAAQ,4BAA4B;AAE3F,SAASC,KAAK,QAAQ,wBAAwB;AAC9C,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASC,iBAAiB,QAAQ,gCAAgC;AAElE;;;;;;;;CAQC,GACD,OAAO,MAAMC,sBAAsB,CAACC,OAAqBC,MAA8C;IACrG,QAAQ;IACR,MAAM,EAAEC,MAAMC,YAAW,EAAE,GAAGL;IAC9B,MAAM,EAAEM,YAAa,UAAS,EAAEC,eAAgB,QAAO,EAAEH,MAAOC,wBAAAA,yBAAAA,cAAe,QAAQ,CAAA,E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-9,7 +9,7 @@ Object.defineProperty(exports, "renderSpinner_unstable", {
|
|
|
9
9
|
const _reactJsxRuntime = require("@fluentui/react-jsx-runtime");
|
|
10
10
|
const _reactUtilities = require("@fluentui/react-utilities");
|
|
11
11
|
const renderSpinner_unstable = (state)=>{
|
|
12
|
-
|
|
12
|
+
(0, _reactUtilities.assertSlots)(state);
|
|
13
13
|
const { labelPosition , shouldRenderSpinner } = state;
|
|
14
|
-
return /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(
|
|
14
|
+
return /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.root, null, state.label && shouldRenderSpinner && (labelPosition === 'above' || labelPosition === 'before') && /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.label, null), state.spinner && shouldRenderSpinner && /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.spinner, null), state.label && shouldRenderSpinner && (labelPosition === 'below' || labelPosition === 'after') && /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.label, null));
|
|
15
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderSpinner.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';\nimport {
|
|
1
|
+
{"version":3,"sources":["renderSpinner.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';\nimport { assertSlots } from '@fluentui/react-utilities';\n/**\n * Render the final JSX of Spinner\n */ export const renderSpinner_unstable = (state)=>{\n assertSlots(state);\n const { labelPosition , shouldRenderSpinner } = state;\n return /*#__PURE__*/ createElement(state.root, null, state.label && shouldRenderSpinner && (labelPosition === 'above' || labelPosition === 'before') && /*#__PURE__*/ createElement(state.label, null), state.spinner && shouldRenderSpinner && /*#__PURE__*/ createElement(state.spinner, null), state.label && shouldRenderSpinner && (labelPosition === 'below' || labelPosition === 'after') && /*#__PURE__*/ createElement(state.label, null));\n};\n"],"names":["renderSpinner_unstable","state","assertSlots","labelPosition","shouldRenderSpinner","createElement","root","label","spinner"],"mappings":"AAAA,wBAAwB,GAAG,uBAAuB;;;;+BAIjCA;;aAAAA;;iCAJkE;gCACvD;AAGjB,MAAMA,yBAAyB,CAACC,QAAQ;IAC/CC,IAAAA,2BAAW,EAACD;IACZ,MAAM,EAAEE,cAAa,EAAGC,oBAAmB,EAAG,GAAGH;IACjD,OAAO,WAAW,GAAGI,IAAAA,8BAAa,EAACJ,MAAMK,IAAI,EAAE,IAAI,EAAEL,MAAMM,KAAK,IAAIH,uBAAwBD,CAAAA,kBAAkB,WAAWA,kBAAkB,QAAO,KAAM,WAAW,GAAGE,IAAAA,8BAAa,EAACJ,MAAMM,KAAK,EAAE,IAAI,GAAGN,MAAMO,OAAO,IAAIJ,uBAAuB,WAAW,GAAGC,IAAAA,8BAAa,EAACJ,MAAMO,OAAO,EAAE,IAAI,GAAGP,MAAMM,KAAK,IAAIH,uBAAwBD,CAAAA,kBAAkB,WAAWA,kBAAkB,OAAM,KAAM,WAAW,GAAGE,IAAAA,8BAAa,EAACJ,MAAMM,KAAK,EAAE,IAAI;AACrb"}
|
|
@@ -18,13 +18,15 @@ const useSpinner_unstable = (props, ref)=>{
|
|
|
18
18
|
const { appearance ='primary' , labelPosition ='after' , size =contextSize !== null && contextSize !== void 0 ? contextSize : 'medium' , delay =0 } = props;
|
|
19
19
|
const baseId = (0, _reactUtilities.useId)('spinner');
|
|
20
20
|
const { role ='progressbar' , tabIndex , ...rest } = props;
|
|
21
|
-
const nativeRoot = (0, _reactUtilities.getNativeElementProps)('div', {
|
|
21
|
+
const nativeRoot = _reactUtilities.slot.always((0, _reactUtilities.getNativeElementProps)('div', {
|
|
22
22
|
ref,
|
|
23
23
|
role,
|
|
24
24
|
...rest
|
|
25
25
|
}, [
|
|
26
26
|
'size'
|
|
27
|
-
])
|
|
27
|
+
]), {
|
|
28
|
+
elementType: 'div'
|
|
29
|
+
});
|
|
28
30
|
const [isVisible, setIsVisible] = _react.useState(true);
|
|
29
31
|
const [setDelayTimeout, clearDelayTimeout] = (0, _reactUtilities.useTimeout)();
|
|
30
32
|
_react.useEffect(()=>{
|
|
@@ -43,18 +45,20 @@ const useSpinner_unstable = (props, ref)=>{
|
|
|
43
45
|
clearDelayTimeout,
|
|
44
46
|
delay
|
|
45
47
|
]);
|
|
46
|
-
const labelShorthand =
|
|
48
|
+
const labelShorthand = _reactUtilities.slot.optional(props.label, {
|
|
47
49
|
defaultProps: {
|
|
48
50
|
id: baseId
|
|
49
51
|
},
|
|
50
|
-
|
|
52
|
+
renderByDefault: false,
|
|
53
|
+
elementType: _reactLabel.Label
|
|
51
54
|
});
|
|
52
|
-
const spinnerShortHand =
|
|
53
|
-
|
|
55
|
+
const spinnerShortHand = _reactUtilities.slot.optional(props.spinner, {
|
|
56
|
+
renderByDefault: true,
|
|
54
57
|
defaultProps: {
|
|
55
58
|
children: /*#__PURE__*/ _react.createElement(_defaultSvg.DefaultSvg, null),
|
|
56
59
|
tabIndex
|
|
57
|
-
}
|
|
60
|
+
},
|
|
61
|
+
elementType: 'span'
|
|
58
62
|
});
|
|
59
63
|
if (labelShorthand && nativeRoot && !nativeRoot['aria-labelledby']) {
|
|
60
64
|
nativeRoot['aria-labelledby'] = labelShorthand.id;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useSpinner.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps,
|
|
1
|
+
{"version":3,"sources":["useSpinner.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useId, useTimeout, slot } from '@fluentui/react-utilities';\nimport { Label } from '@fluentui/react-label';\nimport { DefaultSvg } from './DefaultSvg';\nimport { useSpinnerContext } from '../../contexts/SpinnerContext';\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 { size: contextSize } = useSpinnerContext();\n const { appearance ='primary' , labelPosition ='after' , size =contextSize !== null && contextSize !== void 0 ? contextSize : 'medium' , delay =0 } = props;\n const baseId = useId('spinner');\n const { role ='progressbar' , tabIndex , ...rest } = props;\n const nativeRoot = slot.always(getNativeElementProps('div', {\n ref,\n role,\n ...rest\n }, [\n 'size'\n ]), {\n elementType: 'div'\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 = slot.optional(props.label, {\n defaultProps: {\n id: baseId\n },\n renderByDefault: false,\n elementType: Label\n });\n const spinnerShortHand = slot.optional(props.spinner, {\n renderByDefault: true,\n defaultProps: {\n children: /*#__PURE__*/ React.createElement(DefaultSvg, null),\n tabIndex\n },\n elementType: 'span'\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"],"names":["useSpinner_unstable","props","ref","size","contextSize","useSpinnerContext","appearance","labelPosition","delay","baseId","useId","role","tabIndex","rest","nativeRoot","slot","always","getNativeElementProps","elementType","isVisible","setIsVisible","React","useState","setDelayTimeout","clearDelayTimeout","useTimeout","useEffect","labelShorthand","optional","label","defaultProps","id","renderByDefault","Label","spinnerShortHand","spinner","children","createElement","DefaultSvg","state","shouldRenderSpinner","components","root"],"mappings":";;;;+BAaiBA;;aAAAA;;;6DAbM;gCACwC;4BACzC;4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QACAM,aAAa;IACjB;IACA,IAAIS,kBAAkBb,cAAc,CAACA,UAAU,CAAC,kBAAkB,EAAE;QAChEA,UAAU,CAAC,kBAAkB,GAAGa,eAAeI,EAAE;IACrD,CAAC;IACD,MAAMQ,QAAQ;QACVjC;QACAE;QACAD;QACAJ;QACAqC,qBAAqBrB;QACrBsB,YAAY;YACRC,MAAM;YACNP,SAAS;YACTN,OAAOI,iBAAK;QAChB;QACAS,MAAM5B;QACNqB,SAASD;QACTL,OAAOF;IACX;IACA,OAAOY;AACX"}
|
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-20230808-0415.1",
|
|
4
4
|
"description": "Spinner component for Fluent UI React",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -27,17 +27,17 @@
|
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@fluentui/eslint-plugin": "*",
|
|
30
|
-
"@fluentui/react-conformance": "0.0.0-nightly-
|
|
31
|
-
"@fluentui/react-conformance-griffel": "0.0.0-nightly-
|
|
30
|
+
"@fluentui/react-conformance": "0.0.0-nightly-20230808-0415.1",
|
|
31
|
+
"@fluentui/react-conformance-griffel": "0.0.0-nightly-20230808-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-20230808-0415.1",
|
|
37
|
+
"@fluentui/react-label": "0.0.0-nightly-20230808-0415.1",
|
|
38
|
+
"@fluentui/react-shared-contexts": "0.0.0-nightly-20230808-0415.1",
|
|
39
|
+
"@fluentui/react-theme": "0.0.0-nightly-20230808-0415.1",
|
|
40
|
+
"@fluentui/react-utilities": "0.0.0-nightly-20230808-0415.1",
|
|
41
41
|
"@griffel/react": "^1.5.7",
|
|
42
42
|
"@swc/helpers": "^0.4.14"
|
|
43
43
|
},
|