@fluentui/react-spinner 0.0.0-nightly-20240117-0405.1 → 0.0.0-nightly-20240119-0406.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.md CHANGED
@@ -1,24 +1,48 @@
1
1
  # Change Log - @fluentui/react-spinner
2
2
 
3
- This log was last generated on Wed, 17 Jan 2024 04:20:50 GMT and should not be manually modified.
3
+ This log was last generated on Fri, 19 Jan 2024 04:21:31 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## [0.0.0-nightly-20240117-0405.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-spinner_v0.0.0-nightly-20240117-0405.1)
7
+ ## [0.0.0-nightly-20240119-0406.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-spinner_v0.0.0-nightly-20240119-0406.1)
8
8
 
9
- Wed, 17 Jan 2024 04:20:50 GMT
10
- [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-spinner_v9.3.36..@fluentui/react-spinner_v0.0.0-nightly-20240117-0405.1)
9
+ Fri, 19 Jan 2024 04:21:31 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-spinner_v9.3.38..@fluentui/react-spinner_v0.0.0-nightly-20240119-0406.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-20240117-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/796ef93b3ec7eab5cabc0e0e2a8d41412eeb9849) by beachball)
16
- - Bump @fluentui/react-label to v0.0.0-nightly-20240117-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/796ef93b3ec7eab5cabc0e0e2a8d41412eeb9849) by beachball)
17
- - Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20240117-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/796ef93b3ec7eab5cabc0e0e2a8d41412eeb9849) by beachball)
18
- - Bump @fluentui/react-theme to v0.0.0-nightly-20240117-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/796ef93b3ec7eab5cabc0e0e2a8d41412eeb9849) by beachball)
19
- - Bump @fluentui/react-utilities to v0.0.0-nightly-20240117-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/796ef93b3ec7eab5cabc0e0e2a8d41412eeb9849) by beachball)
20
- - Bump @fluentui/react-conformance to v0.0.0-nightly-20240117-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/796ef93b3ec7eab5cabc0e0e2a8d41412eeb9849) by beachball)
21
- - Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20240117-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/796ef93b3ec7eab5cabc0e0e2a8d41412eeb9849) by beachball)
15
+ - Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20240119-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/4b901aea73a8d397f1346de4cadd8ed28aa8eccd) by beachball)
16
+ - Bump @fluentui/react-label to v0.0.0-nightly-20240119-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/4b901aea73a8d397f1346de4cadd8ed28aa8eccd) by beachball)
17
+ - Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20240119-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/4b901aea73a8d397f1346de4cadd8ed28aa8eccd) by beachball)
18
+ - Bump @fluentui/react-theme to v0.0.0-nightly-20240119-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/4b901aea73a8d397f1346de4cadd8ed28aa8eccd) by beachball)
19
+ - Bump @fluentui/react-utilities to v0.0.0-nightly-20240119-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/4b901aea73a8d397f1346de4cadd8ed28aa8eccd) by beachball)
20
+ - Bump @fluentui/react-conformance to v0.0.0-nightly-20240119-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/4b901aea73a8d397f1346de4cadd8ed28aa8eccd) by beachball)
21
+ - Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20240119-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/4b901aea73a8d397f1346de4cadd8ed28aa8eccd) by beachball)
22
+
23
+ ## [9.3.38](https://github.com/microsoft/fluentui/tree/@fluentui/react-spinner_v9.3.38)
24
+
25
+ Thu, 18 Jan 2024 14:25:02 GMT
26
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-spinner_v9.3.37..@fluentui/react-spinner_v9.3.38)
27
+
28
+ ### Patches
29
+
30
+ - fix: Update isVisible initial value to false to prevent Spinner flicker ([PR #30330](https://github.com/microsoft/fluentui/pull/30330) by ololubek@microsoft.com)
31
+ - Bump @fluentui/react-jsx-runtime to v9.0.27 ([PR #30046](https://github.com/microsoft/fluentui/pull/30046) by beachball)
32
+ - Bump @fluentui/react-label to v9.1.58 ([PR #30046](https://github.com/microsoft/fluentui/pull/30046) by beachball)
33
+ - Bump @fluentui/react-shared-contexts to v9.14.0 ([PR #30046](https://github.com/microsoft/fluentui/pull/30046) by beachball)
34
+ - Bump @fluentui/react-utilities to v9.16.1 ([PR #30046](https://github.com/microsoft/fluentui/pull/30046) by beachball)
35
+
36
+ ## [9.3.37](https://github.com/microsoft/fluentui/tree/@fluentui/react-spinner_v9.3.37)
37
+
38
+ Wed, 17 Jan 2024 16:18:50 GMT
39
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-spinner_v9.3.36..@fluentui/react-spinner_v9.3.37)
40
+
41
+ ### Patches
42
+
43
+ - Bump @fluentui/react-jsx-runtime to v9.0.26 ([PR #30339](https://github.com/microsoft/fluentui/pull/30339) by beachball)
44
+ - Bump @fluentui/react-label to v9.1.57 ([PR #30339](https://github.com/microsoft/fluentui/pull/30339) by beachball)
45
+ - Bump @fluentui/react-utilities to v9.16.0 ([PR #30339](https://github.com/microsoft/fluentui/pull/30339) by beachball)
22
46
 
23
47
  ## [9.3.36](https://github.com/microsoft/fluentui/tree/@fluentui/react-spinner_v9.3.36)
24
48
 
@@ -29,15 +29,14 @@ import { useSpinnerContext } from '../../contexts/SpinnerContext';
29
29
  ]), {
30
30
  elementType: 'div'
31
31
  });
32
- const [isVisible, setIsVisible] = React.useState(true);
32
+ const [isShownAfterDelay, setIsShownAfterDelay] = React.useState(false);
33
33
  const [setDelayTimeout, clearDelayTimeout] = useTimeout();
34
34
  React.useEffect(()=>{
35
35
  if (delay <= 0) {
36
36
  return;
37
37
  }
38
- setIsVisible(false);
39
38
  setDelayTimeout(()=>{
40
- setIsVisible(true);
39
+ setIsShownAfterDelay(true);
41
40
  }, delay);
42
41
  return ()=>{
43
42
  clearDelayTimeout();
@@ -70,7 +69,7 @@ import { useSpinnerContext } from '../../contexts/SpinnerContext';
70
69
  delay,
71
70
  labelPosition,
72
71
  size,
73
- shouldRenderSpinner: isVisible,
72
+ shouldRenderSpinner: !delay || isShownAfterDelay,
74
73
  components: {
75
74
  root: 'div',
76
75
  spinner: 'span',
@@ -1 +1 @@
1
- {"version":3,"sources":["useSpinner.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, 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(\n getIntrinsicElementProps(\n 'div',\n {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: ref as React.Ref<HTMLDivElement>,\n role,\n ...rest,\n },\n ['size'],\n ),\n {\n elementType: 'div',\n },\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","getIntrinsicElementProps","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,wBAAwB,EAAEC,KAAK,EAAEC,UAAU,EAAEC,IAAI,QAAQ,4BAA4B;AAE9F,SAASC,KAAK,QAAQ,wBAAwB;AAC9C,SAASC,UAAU,QAAQ,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B,GAAGS,eAAeI,EAAE;IACnD;IACA,MAAMK,QAAsB;QAC1BzB;QACAE;QACAD;QACAH;QACA4B,qBAAqBhB;QACrBiB,YAAY;YAAEC,MAAM;YAAOL,SAAS;YAAQL,OAAO1B;QAAM;QACzDoC,MAAMrB;QACNgB,SAASD;QACTJ,OAAOF;IACT;IACA,OAAOS;AACT,EAAE"}
1
+ {"version":3,"sources":["useSpinner.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, 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(\n getIntrinsicElementProps(\n 'div',\n {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: ref as React.Ref<HTMLDivElement>,\n role,\n ...rest,\n },\n ['size'],\n ),\n {\n elementType: 'div',\n },\n );\n const [isShownAfterDelay, setIsShownAfterDelay] = React.useState(false);\n const [setDelayTimeout, clearDelayTimeout] = useTimeout();\n React.useEffect(() => {\n if (delay <= 0) {\n return;\n }\n setDelayTimeout(() => {\n setIsShownAfterDelay(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: !delay || isShownAfterDelay,\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","getIntrinsicElementProps","useId","useTimeout","slot","Label","DefaultSvg","useSpinnerContext","useSpinner_unstable","props","ref","size","contextSize","appearance","labelPosition","delay","baseId","role","tabIndex","rest","nativeRoot","always","elementType","isShownAfterDelay","setIsShownAfterDelay","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,wBAAwB,EAAEC,KAAK,EAAEC,UAAU,EAAEC,IAAI,QAAQ,4BAA4B;AAE9F,SAASC,KAAK,QAAQ,wBAAwB;AAC9C,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASC,iBAAiB,QAAQ,gCAAgC;AAElE;;;;;;;;CAQC,GACD,OAAO,MAAMC,sBAAsB,CAACC,OAAqBC;IACvD,QAAQ;IACR,MAAM,EAAEC,MAAMC,WAAW,EAAE,GAAGL;IAC9B,MAAM,EAAEM,aAAa,SAAS,EAAEC,gBAAgB,OAAO,EAAEH,OAAOC,wBAAAA,yBAAAA,cAAe,QAAQ,EAAEG,QAAQ,CAAC,EAAE,GAAGN;IACvG,MAAMO,SAASd,MAAM;IAErB,MAAM,EAAEe,OAAO,aAAa,EAAEC,QAAQ,EAAE,GAAGC,MAAM,GAAGV;IACpD,MAAMW,aAAahB,KAAKiB,MAAM,CAC5BpB,yBACE,OACA;QACE,SAAS;QACT,4EAA4E;QAC5E,4FAA4F;QAC5FS,KAAKA;QACLO;QACA,GAAGE,IAAI;IACT,GACA;QAAC;KAAO,GAEV;QACEG,aAAa;IACf;IAEF,MAAM,CAACC,mBAAmBC,qBAAqB,GAAGxB,MAAMyB,QAAQ,CAAC;IACjE,MAAM,CAACC,iBAAiBC,kBAAkB,GAAGxB;IAC7CH,MAAM4B,SAAS,CAAC;QACd,IAAIb,SAAS,GAAG;YACd;QACF;QACAW,gBAAgB;YACdF,qBAAqB;QACvB,GAAGT;QACH,OAAO;YACLY;QACF;IACF,GAAG;QAACD;QAAiBC;QAAmBZ;KAAM;IAC9C,MAAMc,iBAAiBzB,KAAK0B,QAAQ,CAACrB,MAAMsB,KAAK,EAAE;QAChDC,cAAc;YAAEC,IAAIjB;QAAO;QAC3BkB,iBAAiB;QACjBZ,aAAajB;IACf;IACA,MAAM8B,mBAAmB/B,KAAK0B,QAAQ,CAACrB,MAAM2B,OAAO,EAAE;QACpDF,iBAAiB;QACjBF,cAAc;YAAEK,wBAAU,oBAAC/B;YAAeY;QAAS;QACnDI,aAAa;IACf;IACA,IAAIO,kBAAkBT,cAAc,CAACA,UAAU,CAAC,kBAAkB,EAAE;QAClEA,UAAU,CAAC,kBAAkB,GAAGS,eAAeI,EAAE;IACnD;IACA,MAAMK,QAAsB;QAC1BzB;QACAE;QACAD;QACAH;QACA4B,qBAAqB,CAACxB,SAASQ;QAC/BiB,YAAY;YAAEC,MAAM;YAAOL,SAAS;YAAQL,OAAO1B;QAAM;QACzDoC,MAAMrB;QACNgB,SAASD;QACTJ,OAAOF;IACT;IACA,OAAOS;AACT,EAAE"}
@@ -32,15 +32,14 @@ const useSpinner_unstable = (props, ref)=>{
32
32
  ]), {
33
33
  elementType: 'div'
34
34
  });
35
- const [isVisible, setIsVisible] = _react.useState(true);
35
+ const [isShownAfterDelay, setIsShownAfterDelay] = _react.useState(false);
36
36
  const [setDelayTimeout, clearDelayTimeout] = (0, _reactutilities.useTimeout)();
37
37
  _react.useEffect(()=>{
38
38
  if (delay <= 0) {
39
39
  return;
40
40
  }
41
- setIsVisible(false);
42
41
  setDelayTimeout(()=>{
43
- setIsVisible(true);
42
+ setIsShownAfterDelay(true);
44
43
  }, delay);
45
44
  return ()=>{
46
45
  clearDelayTimeout();
@@ -73,7 +72,7 @@ const useSpinner_unstable = (props, ref)=>{
73
72
  delay,
74
73
  labelPosition,
75
74
  size,
76
- shouldRenderSpinner: isVisible,
75
+ shouldRenderSpinner: !delay || isShownAfterDelay,
77
76
  components: {
78
77
  root: 'div',
79
78
  spinner: 'span',
@@ -1 +1 @@
1
- {"version":3,"sources":["useSpinner.js"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, 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(getIntrinsicElementProps('div', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: 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","getIntrinsicElementProps","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;;;eAAAA;;;;iEAbM;gCAC2C;4BAC5C;4BACK;gCACO;AASvB,MAAMA,sBAAsB,CAACC,OAAOC;IAC3C,QAAQ;IACR,MAAM,EAAEC,MAAMC,WAAW,EAAE,GAAGC,IAAAA,iCAAiB;IAC/C,MAAM,EAAEC,aAAa,SAAS,EAAEC,gBAAgB,OAAO,EAAEJ,OAAOC,gBAAgB,QAAQA,gBAAgB,KAAK,IAAIA,cAAc,QAAQ,EAAEI,QAAQ,CAAC,EAAE,GAAGP;IACvJ,MAAMQ,SAASC,IAAAA,qBAAK,EAAC;IACrB,M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pinner.js"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, 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(getIntrinsicElementProps('div', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: ref,\n role,\n ...rest\n }, [\n 'size'\n ]), {\n elementType: 'div'\n });\n const [isShownAfterDelay, setIsShownAfterDelay] = React.useState(false);\n const [setDelayTimeout, clearDelayTimeout] = useTimeout();\n React.useEffect(()=>{\n if (delay <= 0) {\n return;\n }\n setDelayTimeout(()=>{\n setIsShownAfterDelay(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: !delay || isShownAfterDelay,\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","getIntrinsicElementProps","elementType","isShownAfterDelay","setIsShownAfterDelay","React","useState","setDelayTimeout","clearDelayTimeout","useTimeout","useEffect","labelShorthand","optional","label","defaultProps","id","renderByDefault","Label","spinnerShortHand","spinner","children","createElement","DefaultSvg","state","shouldRenderSpinner","components","root"],"mappings":";;;;+BAaiBA;;;eAAAA;;;;iEAbM;gCAC2C;4BAC5C;4BACK;gCACO;AASvB,MAAMA,sBAAsB,CAACC,OAAOC;IAC3C,QAAQ;IACR,MAAM,EAAEC,MAAMC,WAAW,EAAE,GAAGC,IAAAA,iCAAiB;IAC/C,MAAM,EAAEC,aAAa,SAAS,EAAEC,gBAAgB,OAAO,EAAEJ,OAAOC,gBAAgB,QAAQA,gBAAgB,KAAK,IAAIA,cAAc,QAAQ,EAAEI,QAAQ,CAAC,EAAE,GAAGP;IACvJ,MAAMQ,SAASC,IAAAA,qBAAK,EAAC;IACrB,MAAM,EAAEC,OAAO,aAAa,EAAEC,QAAQ,EAAE,GAAGC,MAAM,GAAGZ;IACpD,MAAMa,aAAaC,oBAAI,CAACC,MAAM,CAACC,IAAAA,wCAAwB,EAAC,OAAO;QAC3D,SAAS;QACT,4EAA4E;QAC5E,4FAA4F;QAC5Ff,KAAKA;QACLS;QACA,GAAGE,IAAI;IACX,GAAG;QACC;KACH,GAAG;QACAK,aAAa;IACjB;IACA,MAAM,CAACC,mBAAmBC,qBAAqB,GAAGC,OAAMC,QAAQ,CAAC;IACjE,MAAM,CAACC,iBAAiBC,kBAAkB,GAAGC,IAAAA,0BAAU;IACvDJ,OAAMK,SAAS,CAAC;QACZ,IAAIlB,SAAS,GAAG;YACZ;QACJ;QACAe,gBAAgB;YACZH,qBAAqB;QACzB,GAAGZ;QACH,OAAO;YACHgB;QACJ;IACJ,GAAG;QACCD;QACAC;QACAhB;KACH;IACD,MAAMmB,iBAAiBZ,oBAAI,CAACa,QAAQ,CAAC3B,MAAM4B,KAAK,EAAE;QAC9CC,cAAc;YACVC,IAAItB;QACR;QACAuB,iBAAiB;QACjBd,aAAae,iBAAK;IACtB;IACA,MAAMC,mBAAmBnB,oBAAI,CAACa,QAAQ,CAAC3B,MAAMkC,OAAO,EAAE;QAClDH,iBAAiB;QACjBF,cAAc;YACVM,UAAU,WAAW,GAAGf,OAAMgB,aAAa,CAACC,sBAAU,EAAE;YACxD1B;QACJ;QACAM,aAAa;IACjB;IACA,IAAIS,kBAAkBb,cAAc,CAACA,UAAU,CAAC,kBAAkB,EAAE;QAChEA,UAAU,CAAC,kBAAkB,GAAGa,eAAeI,EAAE;IACrD;IACA,MAAMQ,QAAQ;QACVjC;QACAE;QACAD;QACAJ;QACAqC,qBAAqB,CAAChC,SAASW;QAC/BsB,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-20240117-0405.1",
3
+ "version": "0.0.0-nightly-20240119-0406.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-20240117-0405.1",
31
- "@fluentui/react-conformance-griffel": "0.0.0-nightly-20240117-0405.1",
30
+ "@fluentui/react-conformance": "0.0.0-nightly-20240119-0406.1",
31
+ "@fluentui/react-conformance-griffel": "0.0.0-nightly-20240119-0406.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-20240117-0405.1",
37
- "@fluentui/react-label": "0.0.0-nightly-20240117-0405.1",
38
- "@fluentui/react-shared-contexts": "0.0.0-nightly-20240117-0405.1",
39
- "@fluentui/react-theme": "0.0.0-nightly-20240117-0405.1",
40
- "@fluentui/react-utilities": "0.0.0-nightly-20240117-0405.1",
36
+ "@fluentui/react-jsx-runtime": "0.0.0-nightly-20240119-0406.1",
37
+ "@fluentui/react-label": "0.0.0-nightly-20240119-0406.1",
38
+ "@fluentui/react-shared-contexts": "0.0.0-nightly-20240119-0406.1",
39
+ "@fluentui/react-theme": "0.0.0-nightly-20240119-0406.1",
40
+ "@fluentui/react-utilities": "0.0.0-nightly-20240119-0406.1",
41
41
  "@griffel/react": "^1.5.14",
42
42
  "@swc/helpers": "^0.5.1"
43
43
  },