@fluentui/react-provider 9.9.1 → 9.10.2

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 CHANGED
@@ -2,7 +2,138 @@
2
2
  "name": "@fluentui/react-provider",
3
3
  "entries": [
4
4
  {
5
- "date": "Wed, 20 Sep 2023 17:40:48 GMT",
5
+ "date": "Mon, 02 Oct 2023 08:53:04 GMT",
6
+ "tag": "@fluentui/react-provider_v9.10.2",
7
+ "version": "9.10.2",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "vkozlova@microsoft.com",
12
+ "package": "@fluentui/react-provider",
13
+ "commit": "03466e42548781a9f80a3859c13eda0e8bd33a6b",
14
+ "comment": "feat: add custom styling hooks for Breadcrumb component and its sub-components"
15
+ },
16
+ {
17
+ "author": "beachball",
18
+ "package": "@fluentui/react-provider",
19
+ "comment": "Bump @fluentui/react-shared-contexts to v9.9.2",
20
+ "commit": "18ddec93bdb85a009bc1392058c52b2ea336340e"
21
+ },
22
+ {
23
+ "author": "beachball",
24
+ "package": "@fluentui/react-provider",
25
+ "comment": "Bump @fluentui/react-tabster to v9.13.2",
26
+ "commit": "18ddec93bdb85a009bc1392058c52b2ea336340e"
27
+ }
28
+ ]
29
+ }
30
+ },
31
+ {
32
+ "date": "Tue, 26 Sep 2023 17:49:10 GMT",
33
+ "tag": "@fluentui/react-provider_v9.10.1",
34
+ "version": "9.10.1",
35
+ "comments": {
36
+ "patch": [
37
+ {
38
+ "author": "yuanboxue@microsoft.com",
39
+ "package": "@fluentui/react-provider",
40
+ "commit": "05a23f6f5f331841c9ac9fb63764440c543f791d",
41
+ "comment": "chore: trigger manual version bump after broken release"
42
+ },
43
+ {
44
+ "author": "beachball",
45
+ "package": "@fluentui/react-provider",
46
+ "comment": "Bump @fluentui/react-shared-contexts to v9.9.1",
47
+ "commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
48
+ },
49
+ {
50
+ "author": "beachball",
51
+ "package": "@fluentui/react-provider",
52
+ "comment": "Bump @fluentui/react-tabster to v9.13.1",
53
+ "commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
54
+ },
55
+ {
56
+ "author": "beachball",
57
+ "package": "@fluentui/react-provider",
58
+ "comment": "Bump @fluentui/react-theme to v9.1.14",
59
+ "commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
60
+ },
61
+ {
62
+ "author": "beachball",
63
+ "package": "@fluentui/react-provider",
64
+ "comment": "Bump @fluentui/react-utilities to v9.13.5",
65
+ "commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
66
+ },
67
+ {
68
+ "author": "beachball",
69
+ "package": "@fluentui/react-provider",
70
+ "comment": "Bump @fluentui/react-jsx-runtime to v9.0.12",
71
+ "commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
72
+ }
73
+ ]
74
+ }
75
+ },
76
+ {
77
+ "date": "Tue, 26 Sep 2023 15:31:51 GMT",
78
+ "tag": "@fluentui/react-provider_v9.10.0",
79
+ "version": "9.10.0",
80
+ "comments": {
81
+ "patch": [
82
+ {
83
+ "author": "martinhochel@microsoft.com",
84
+ "package": "@fluentui/react-provider",
85
+ "commit": "e61473fa10195f6ebf2308205c1e72e91b711831",
86
+ "comment": "fix: bump swc core to mitigate transpilation memory leaks"
87
+ },
88
+ {
89
+ "author": "ololubek@microsoft.com",
90
+ "package": "@fluentui/react-provider",
91
+ "commit": "a31e7394d9f169bc5aa55430a22cdc65425a1b49",
92
+ "comment": "chore: Update react-icons version to pick up IconDirectionContextProvider updated export"
93
+ }
94
+ ],
95
+ "minor": [
96
+ {
97
+ "author": "yuanboxue@microsoft.com",
98
+ "package": "@fluentui/react-provider",
99
+ "commit": "45ab251870368226b02c57882e8f7ca0deb86c8f",
100
+ "comment": "feat: add custom style hooks for tag components"
101
+ },
102
+ {
103
+ "author": "beachball",
104
+ "package": "@fluentui/react-provider",
105
+ "comment": "Bump @fluentui/react-shared-contexts to v9.9.0",
106
+ "commit": "e16520437e10cd824ac254dd797e32762b5de72d"
107
+ },
108
+ {
109
+ "author": "beachball",
110
+ "package": "@fluentui/react-provider",
111
+ "comment": "Bump @fluentui/react-tabster to v9.13.0",
112
+ "commit": "e16520437e10cd824ac254dd797e32762b5de72d"
113
+ },
114
+ {
115
+ "author": "beachball",
116
+ "package": "@fluentui/react-provider",
117
+ "comment": "Bump @fluentui/react-theme to v9.1.13",
118
+ "commit": "e16520437e10cd824ac254dd797e32762b5de72d"
119
+ },
120
+ {
121
+ "author": "beachball",
122
+ "package": "@fluentui/react-provider",
123
+ "comment": "Bump @fluentui/react-utilities to v9.13.4",
124
+ "commit": "e16520437e10cd824ac254dd797e32762b5de72d"
125
+ },
126
+ {
127
+ "author": "beachball",
128
+ "package": "@fluentui/react-provider",
129
+ "comment": "Bump @fluentui/react-jsx-runtime to v9.0.11",
130
+ "commit": "e16520437e10cd824ac254dd797e32762b5de72d"
131
+ }
132
+ ]
133
+ }
134
+ },
135
+ {
136
+ "date": "Wed, 20 Sep 2023 17:47:41 GMT",
6
137
  "tag": "@fluentui/react-provider_v9.9.1",
7
138
  "version": "9.9.1",
8
139
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,56 @@
1
1
  # Change Log - @fluentui/react-provider
2
2
 
3
- This log was last generated on Wed, 20 Sep 2023 17:40:48 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 02 Oct 2023 08:53:04 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.10.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-provider_v9.10.2)
8
+
9
+ Mon, 02 Oct 2023 08:53:04 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-provider_v9.10.1..@fluentui/react-provider_v9.10.2)
11
+
12
+ ### Patches
13
+
14
+ - feat: add custom styling hooks for Breadcrumb component and its sub-components ([PR #29318](https://github.com/microsoft/fluentui/pull/29318) by vkozlova@microsoft.com)
15
+ - Bump @fluentui/react-shared-contexts to v9.9.2 ([PR #29351](https://github.com/microsoft/fluentui/pull/29351) by beachball)
16
+ - Bump @fluentui/react-tabster to v9.13.2 ([PR #29351](https://github.com/microsoft/fluentui/pull/29351) by beachball)
17
+
18
+ ## [9.10.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-provider_v9.10.1)
19
+
20
+ Tue, 26 Sep 2023 17:49:10 GMT
21
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-provider_v9.10.0..@fluentui/react-provider_v9.10.1)
22
+
23
+ ### Patches
24
+
25
+ - chore: trigger manual version bump after broken release ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by yuanboxue@microsoft.com)
26
+ - Bump @fluentui/react-shared-contexts to v9.9.1 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
27
+ - Bump @fluentui/react-tabster to v9.13.1 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
28
+ - Bump @fluentui/react-theme to v9.1.14 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
29
+ - Bump @fluentui/react-utilities to v9.13.5 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
30
+ - Bump @fluentui/react-jsx-runtime to v9.0.12 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
31
+
32
+ ## [9.10.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-provider_v9.10.0)
33
+
34
+ Tue, 26 Sep 2023 15:31:51 GMT
35
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-provider_v9.9.1..@fluentui/react-provider_v9.10.0)
36
+
37
+ ### Minor changes
38
+
39
+ - feat: add custom style hooks for tag components ([PR #29237](https://github.com/microsoft/fluentui/pull/29237) by yuanboxue@microsoft.com)
40
+ - Bump @fluentui/react-shared-contexts to v9.9.0 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
41
+ - Bump @fluentui/react-tabster to v9.13.0 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
42
+ - Bump @fluentui/react-theme to v9.1.13 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
43
+ - Bump @fluentui/react-utilities to v9.13.4 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
44
+ - Bump @fluentui/react-jsx-runtime to v9.0.11 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
45
+
46
+ ### Patches
47
+
48
+ - fix: bump swc core to mitigate transpilation memory leaks ([PR #29253](https://github.com/microsoft/fluentui/pull/29253) by martinhochel@microsoft.com)
49
+ - chore: Update react-icons version to pick up IconDirectionContextProvider updated export ([PR #29151](https://github.com/microsoft/fluentui/pull/29151) by ololubek@microsoft.com)
50
+
7
51
  ## [9.9.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-provider_v9.9.1)
8
52
 
9
- Wed, 20 Sep 2023 17:40:48 GMT
53
+ Wed, 20 Sep 2023 17:47:41 GMT
10
54
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-provider_v9.9.0..@fluentui/react-provider_v9.9.1)
11
55
 
12
56
  ### Patches
package/dist/index.d.ts CHANGED
@@ -116,6 +116,15 @@ export declare const FluentProvider: React_2.ForwardRefExoticComponent<Omit<Comp
116
116
  useDrawerHeaderTitleStyles_unstable: (state: unknown) => void;
117
117
  useDrawerBodyStyles_unstable: (state: unknown) => void;
118
118
  useDrawerFooterStyles_unstable: (state: unknown) => void;
119
+ useInteractionTagStyles_unstable: (state: unknown) => void;
120
+ useInteractionTagPrimaryStyles_unstable: (state: unknown) => void;
121
+ useInteractionTagSecondaryStyles_unstable: (state: unknown) => void;
122
+ useTagStyles_unstable: (state: unknown) => void;
123
+ useTagGroupStyles_unstable: (state: unknown) => void;
124
+ useBreadcrumbStyles_unstable: (state: unknown) => void;
125
+ useBreadcrumbButtonStyles_unstable: (state: unknown) => void;
126
+ useBreadcrumbItemStyles_unstable: (state: unknown) => void;
127
+ useBreadcrumbDividerStyles_unstable: (state: unknown) => void;
119
128
  }> | undefined;
120
129
  dir?: "ltr" | "rtl" | undefined;
121
130
  targetDocument?: Document | undefined;
@@ -69,9 +69,8 @@ const insertSheet = (tag, rule)=>{
69
69
  }
70
70
  useHandleSSRStyleElements(targetDocument, styleTagId);
71
71
  useInsertionEffect(()=>{
72
- var _targetDocument;
73
72
  // The style element could already have been created during SSR - no need to recreate it
74
- const ssrStyleElement = (_targetDocument = targetDocument) === null || _targetDocument === void 0 ? void 0 : _targetDocument.getElementById(styleTagId);
73
+ const ssrStyleElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.getElementById(styleTagId);
75
74
  if (ssrStyleElement) {
76
75
  styleTag.current = ssrStyleElement;
77
76
  } else {
@@ -1 +1 @@
1
- {"version":3,"sources":["useFluentProviderThemeStyleTag.ts"],"sourcesContent":["import { useId, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport * as React from 'react';\n\nimport { createCSSRuleFromTheme } from './createCSSRuleFromTheme';\nimport type { FluentProviderState } from './FluentProvider.types';\nimport { fluentProviderClassNames } from './useFluentProviderStyles.styles';\n\n// String concatenation is used to prevent bundlers to complain with older versions of React\nconst useInsertionEffect = (React as never)['useInsertion' + 'Effect']\n ? (React as never)['useInsertion' + 'Effect']\n : useIsomorphicLayoutEffect;\n\nconst createStyleTag = (target: Document | undefined, elementAttributes: Record<string, string>) => {\n if (!target) {\n return undefined;\n }\n\n const tag = target.createElement('style');\n\n Object.keys(elementAttributes).forEach(attrName => {\n tag.setAttribute(attrName, elementAttributes[attrName]);\n });\n\n target.head.appendChild(tag);\n return tag;\n};\n\nconst insertSheet = (tag: HTMLStyleElement, rule: string) => {\n const sheet = tag.sheet;\n\n if (sheet) {\n if (sheet.cssRules.length > 0) {\n sheet.deleteRule(0);\n }\n sheet.insertRule(rule, 0);\n } else if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error('FluentProvider: No sheet available on styleTag, styles will not be inserted into DOM.');\n }\n};\n\n/**\n * Writes a theme as css variables in a style tag on the provided targetDocument as a rule applied to a CSS class\n * @internal\n * @returns CSS class to apply the rule\n */\nexport const useFluentProviderThemeStyleTag = (\n options: Pick<FluentProviderState, 'theme' | 'targetDocument'> & { rendererAttributes: Record<string, string> },\n) => {\n const { targetDocument, theme, rendererAttributes } = options;\n\n const styleTag = React.useRef<HTMLStyleElement | undefined | null>();\n\n const styleTagId = useId(fluentProviderClassNames.root);\n const styleElementAttributes = rendererAttributes;\n\n const rule = React.useMemo(() => createCSSRuleFromTheme(`.${styleTagId}`, theme), [theme, styleTagId]);\n\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useMemo(() => {\n // Heads up!\n // .useMemo() is used because it is called during render and DOM for _current_ component is not mounted yet. Also,\n // this allows to do checks with strict mode enabled as .useEffect() will be called with incremented IDs because\n // of double render.\n\n if (targetDocument) {\n const providerSelector = `.${fluentProviderClassNames.root}.${styleTagId}`;\n const providerElements = targetDocument.querySelectorAll(providerSelector);\n\n // In SSR, we will have DOM upfront. To avoid false positives the check on nested style tag is performed\n const isSSR = targetDocument.querySelector(`${providerSelector} > style[id=\"${styleTagId}\"]`) !== null;\n const elementsCount = isSSR ? 1 : 0;\n\n if (providerElements.length > elementsCount) {\n // eslint-disable-next-line no-console\n console.error(\n [\n '@fluentui/react-provider: There are conflicting ids in your DOM.',\n 'Please make sure that you configured your application properly.',\n '\\n',\n '\\n',\n 'Configuration guide: https://aka.ms/fluentui-conflicting-ids',\n ].join(' '),\n );\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n }\n\n useHandleSSRStyleElements(targetDocument, styleTagId);\n useInsertionEffect(() => {\n // The style element could already have been created during SSR - no need to recreate it\n const ssrStyleElement = targetDocument?.getElementById(styleTagId);\n if (ssrStyleElement) {\n styleTag.current = ssrStyleElement as HTMLStyleElement;\n } else {\n styleTag.current = createStyleTag(targetDocument, { ...styleElementAttributes, id: styleTagId });\n if (styleTag.current) {\n insertSheet(styleTag.current, rule);\n }\n }\n\n return () => {\n styleTag.current?.remove();\n };\n }, [styleTagId, targetDocument, rule, styleElementAttributes]);\n\n return { styleTagId, rule };\n};\n\nfunction useHandleSSRStyleElements(targetDocument: Document | undefined | null, styleTagId: string) {\n // Using a state factory so that this logic only runs once per render\n // Each FluentProvider can create its own style element during SSR as a slot\n // Moves all theme style elements to document head during render to avoid hydration errors.\n // Should be strict mode safe since the logic is idempotent.\n React.useState(() => {\n if (!targetDocument) {\n return;\n }\n\n const themeStyleElement = targetDocument.getElementById(styleTagId);\n if (themeStyleElement) {\n targetDocument.head.append(themeStyleElement);\n }\n });\n}\n"],"names":["useId","useIsomorphicLayoutEffect","React","createCSSRuleFromTheme","fluentProviderClassNames","useInsertionEffect","createStyleTag","target","elementAttributes","undefined","tag","createElement","Object","keys","forEach","attrName","setAttribute","head","appendChild","insertSheet","rule","sheet","cssRules","length","deleteRule","insertRule","process","env","NODE_ENV","console","error","useFluentProviderThemeStyleTag","options","targetDocument","theme","rendererAttributes","styleTag","useRef","styleTagId","root","styleElementAttributes","useMemo","providerSelector","providerElements","querySelectorAll","isSSR","querySelector","elementsCount","join","useHandleSSRStyleElements","ssrStyleElement","getElementById","current","id","remove","useState","themeStyleElement","append"],"mappings":"AAAA,SAASA,KAAK,EAAEC,yBAAyB,QAAQ,4BAA4B;AAC7E,YAAYC,WAAW,QAAQ;AAE/B,SAASC,sBAAsB,QAAQ,2BAA2B;AAElE,SAASC,wBAAwB,QAAQ,mCAAmC;AAE5E,4FAA4F;AAC5F,MAAMC,qBAAqB,AAACH,KAAe,CAAC,iBAAiB,SAAS,GAClE,AAACA,KAAe,CAAC,iBAAiB,SAAS,GAC3CD;AAEJ,MAAMK,iBAAiB,CAACC,QAA8BC;IACpD,IAAI,CAACD,QAAQ;QACX,OAAOE;IACT;IAEA,MAAMC,MAAMH,OAAOI,aAAa,CAAC;IAEjCC,OAAOC,IAAI,CAACL,mBAAmBM,OAAO,CAACC,CA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gBAAgBF,QAAQ,IAAI;gBAElC,IAAIF,iBAAiBpB,MAAM,GAAGwB,eAAe;oBAC3C,sCAAsC;oBACtClB,QAAQC,KAAK,CACX;wBACE;wBACA;wBACA;wBACA;wBACA;qBACD,CAACkB,IAAI,CAAC;gBAEX;YACF;QACA,uDAAuD;QACzD,GAAG,EAAE;IACP;IAEAC,0BAA0BhB,gBAAgBK;IAC1CjC,mBAAmB;YAEO4B;QADxB,wFAAwF;QACxF,MAAMiB,mBAAkBjB,kBAAAA,4BAAAA,sCAAAA,gBAAgBkB,cAAc,CAACb;QACvD,IAAIY,iBAAiB;YACnBd,SAASgB,OAAO,GAAGF;QACrB,OAAO;YACLd,SAASgB,OAAO,GAAG9C,eAAe2B,gBAAgB;gBAAE,GAAGO,sBAAsB;gBAAEa,IAAIf;YAAW;YAC9F,IAAIF,SAASgB,OAAO,EAAE;gBACpBjC,YAAYiB,SAASgB,OAAO,EAAEhC;YAChC;QACF;QAEA,OAAO;gBACLgB;aAAAA,oBAAAA,SAASgB,OAAO,cAAhBhB,wCAAAA,kBAAkBkB,MAAM;QAC1B;IACF,GAAG;QAAChB;QAAYL;QAAgBb;QAAMoB;KAAuB;IAE7D,OAAO;QAAEF;QAAYlB;IAAK;AAC5B,EAAE;AAEF,SAAS6B,0BAA0BhB,cAA2C,EAAEK,UAAkB;IAChG,qEAAqE;IACrE,4EAA4E;IAC5E,2FAA2F;IAC3F,4DAA4D;IAC5DpC,MAAMqD,QAAQ,CAAC;QACb,IAAI,CAACtB,gBAAgB;YACnB;QACF;QAEA,MAAMuB,oBAAoBvB,eAAekB,cAAc,CAACb;QACxD,IAAIkB,mBAAmB;YACrBvB,eAAehB,IAAI,CAACwC,MAAM,CAACD;QAC7B;IACF;AACF"}
1
+ {"version":3,"sources":["useFluentProviderThemeStyleTag.ts"],"sourcesContent":["import { useId, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport * as React from 'react';\n\nimport { createCSSRuleFromTheme } from './createCSSRuleFromTheme';\nimport type { FluentProviderState } from './FluentProvider.types';\nimport { fluentProviderClassNames } from './useFluentProviderStyles.styles';\n\n// String concatenation is used to prevent bundlers to complain with older versions of React\nconst useInsertionEffect = (React as never)['useInsertion' + 'Effect']\n ? (React as never)['useInsertion' + 'Effect']\n : useIsomorphicLayoutEffect;\n\nconst createStyleTag = (target: Document | undefined, elementAttributes: Record<string, string>) => {\n if (!target) {\n return undefined;\n }\n\n const tag = target.createElement('style');\n\n Object.keys(elementAttributes).forEach(attrName => {\n tag.setAttribute(attrName, elementAttributes[attrName]);\n });\n\n target.head.appendChild(tag);\n return tag;\n};\n\nconst insertSheet = (tag: HTMLStyleElement, rule: string) => {\n const sheet = tag.sheet;\n\n if (sheet) {\n if (sheet.cssRules.length > 0) {\n sheet.deleteRule(0);\n }\n sheet.insertRule(rule, 0);\n } else if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error('FluentProvider: No sheet available on styleTag, styles will not be inserted into DOM.');\n }\n};\n\n/**\n * Writes a theme as css variables in a style tag on the provided targetDocument as a rule applied to a CSS class\n * @internal\n * @returns CSS class to apply the rule\n */\nexport const useFluentProviderThemeStyleTag = (\n options: Pick<FluentProviderState, 'theme' | 'targetDocument'> & { rendererAttributes: Record<string, string> },\n) => {\n const { targetDocument, theme, rendererAttributes } = options;\n\n const styleTag = React.useRef<HTMLStyleElement | undefined | null>();\n\n const styleTagId = useId(fluentProviderClassNames.root);\n const styleElementAttributes = rendererAttributes;\n\n const rule = React.useMemo(() => createCSSRuleFromTheme(`.${styleTagId}`, theme), [theme, styleTagId]);\n\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useMemo(() => {\n // Heads up!\n // .useMemo() is used because it is called during render and DOM for _current_ component is not mounted yet. Also,\n // this allows to do checks with strict mode enabled as .useEffect() will be called with incremented IDs because\n // of double render.\n\n if (targetDocument) {\n const providerSelector = `.${fluentProviderClassNames.root}.${styleTagId}`;\n const providerElements = targetDocument.querySelectorAll(providerSelector);\n\n // In SSR, we will have DOM upfront. To avoid false positives the check on nested style tag is performed\n const isSSR = targetDocument.querySelector(`${providerSelector} > style[id=\"${styleTagId}\"]`) !== null;\n const elementsCount = isSSR ? 1 : 0;\n\n if (providerElements.length > elementsCount) {\n // eslint-disable-next-line no-console\n console.error(\n [\n '@fluentui/react-provider: There are conflicting ids in your DOM.',\n 'Please make sure that you configured your application properly.',\n '\\n',\n '\\n',\n 'Configuration guide: https://aka.ms/fluentui-conflicting-ids',\n ].join(' '),\n );\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n }\n\n useHandleSSRStyleElements(targetDocument, styleTagId);\n useInsertionEffect(() => {\n // The style element could already have been created during SSR - no need to recreate it\n const ssrStyleElement = targetDocument?.getElementById(styleTagId);\n if (ssrStyleElement) {\n styleTag.current = ssrStyleElement as HTMLStyleElement;\n } else {\n styleTag.current = createStyleTag(targetDocument, { ...styleElementAttributes, id: styleTagId });\n if (styleTag.current) {\n insertSheet(styleTag.current, rule);\n }\n }\n\n return () => {\n styleTag.current?.remove();\n };\n }, [styleTagId, targetDocument, rule, styleElementAttributes]);\n\n return { styleTagId, rule };\n};\n\nfunction useHandleSSRStyleElements(targetDocument: Document | undefined | null, styleTagId: string) {\n // Using a state factory so that this logic only runs once per render\n // Each FluentProvider can create its own style element during SSR as a slot\n // Moves all theme style elements to document head during render to avoid hydration errors.\n // Should be strict mode safe since the logic is idempotent.\n React.useState(() => {\n if (!targetDocument) {\n return;\n }\n\n const themeStyleElement = targetDocument.getElementById(styleTagId);\n if (themeStyleElement) {\n targetDocument.head.append(themeStyleElement);\n }\n });\n}\n"],"names":["useId","useIsomorphicLayoutEffect","React","createCSSRuleFromTheme","fluentProviderClassNames","useInsertionEffect","createStyleTag","target","elementAttributes","undefined","tag","createElement","Object","keys","forEach","attrName","setAttribute","head","appendChild","insertSheet","rule","sheet","cssRules","length","deleteRule","insertRule","process","env","NODE_ENV","console","error","useFluentProviderThemeStyleTag","options","targetDocument","theme","rendererAttributes","styleTag","useRef","styleTagId","root","styleElementAttributes","useMemo","providerSelector","providerElements","querySelectorAll","isSSR","querySelector","elementsCount","join","useHandleSSRStyleElements","ssrStyleElement","getElementById","current","id","remove","useState","themeStyleElement","append"],"mappings":"AAAA,SAASA,KAAK,EAAEC,yBAAyB,QAAQ,4BAA4B;AAC7E,YAAYC,WAAW,QAAQ;AAE/B,SAASC,sBAAsB,QAAQ,2BAA2B;AAElE,SAASC,wBAAwB,QAAQ,mCAAmC;AAE5E,4FAA4F;AAC5F,MAAMC,qBAAqB,AAACH,KAAe,CAAC,iBAAiB,SAAS,GAClE,AAACA,KAAe,CAAC,iBAAiB,SAAS,GAC3CD;AAEJ,MAAMK,iBAAiB,CAACC,QAA8BC;IACpD,IAAI,CAACD,QAAQ;QACX,OAAOE;IACT;IAEA,MAAMC,MAAMH,OAAOI,aAAa,CAAC;IAEjCC,OAAOC,IAAI,CAACL,mBAAmBM,OAAO,CAACC,CAAAA;QACrCL,IAAIM,YAAY,CAACD,UAAUP,iBAAiB,CAACO,SAAS;IACxD;IAEAR,OAAOU,IAAI,CAACC,WAAW,CAACR;IACxB,OAAOA;AACT;AAEA,MAAMS,cAAc,CAACT,KAAuBU;IAC1C,MAAMC,QAAQX,IAAIW,KAAK;IAEvB,IAAIA,OAAO;QACT,IAAIA,MAAMC,QAAQ,CAACC,MAAM,GAAG,GAAG;YAC7BF,MAAMG,UAAU,CAAC;QACnB;QACAH,MAAMI,UAAU,CAACL,MAAM;IACzB,OAAO,IAAIM,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QAChD,sCAAsC;QACtCC,QAAQC,KAAK,CAAC;IAChB;AACF;AAEA;;;;CAIC,GACD,OAAO,MAAMC,iCAAiC,CAC5CC;IAEA,MAAM,EAAEC,cAAc,EAAEC,KAAK,EAAEC,kBAAkB,EAAE,GAAGH;IAEtD,MAAMI,WAAWlC,MAAMmC,MAAM;IAE7B,MAAMC,aAAatC,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ASgB,OAAO,cAAhBhB,wCAAAA,kBAAkBkB,MAAM;QAC1B;IACF,GAAG;QAAChB;QAAYL;QAAgBb;QAAMoB;KAAuB;IAE7D,OAAO;QAAEF;QAAYlB;IAAK;AAC5B,EAAE;AAEF,SAAS6B,0BAA0BhB,cAA2C,EAAEK,UAAkB;IAChG,qEAAqE;IACrE,4EAA4E;IAC5E,2FAA2F;IAC3F,4DAA4D;IAC5DpC,MAAMqD,QAAQ,CAAC;QACb,IAAI,CAACtB,gBAAgB;YACnB;QACF;QAEA,MAAMuB,oBAAoBvB,eAAekB,cAAc,CAACb;QACxD,IAAIkB,mBAAmB;YACrBvB,eAAehB,IAAI,CAACwC,MAAM,CAACD;QAC7B;IACF;AACF"}
@@ -76,9 +76,8 @@ const useFluentProviderThemeStyleTag = (options)=>{
76
76
  }
77
77
  useHandleSSRStyleElements(targetDocument, styleTagId);
78
78
  useInsertionEffect(()=>{
79
- var _targetDocument;
80
79
  // The style element could already have been created during SSR - no need to recreate it
81
- const ssrStyleElement = (_targetDocument = targetDocument) === null || _targetDocument === void 0 ? void 0 : _targetDocument.getElementById(styleTagId);
80
+ const ssrStyleElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.getElementById(styleTagId);
82
81
  if (ssrStyleElement) {
83
82
  styleTag.current = ssrStyleElement;
84
83
  } else {
@@ -1 +1 @@
1
- {"version":3,"sources":["useFluentProviderThemeStyleTag.js"],"sourcesContent":["import { useId, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport * as React from 'react';\nimport { createCSSRuleFromTheme } from './createCSSRuleFromTheme';\nimport { fluentProviderClassNames } from './useFluentProviderStyles.styles';\n// String concatenation is used to prevent bundlers to complain with older versions of React\nconst useInsertionEffect = React['useInsertion' + 'Effect'] ? React['useInsertion' + 'Effect'] : useIsomorphicLayoutEffect;\nconst createStyleTag = (target, elementAttributes)=>{\n if (!target) {\n return undefined;\n }\n const tag = target.createElement('style');\n Object.keys(elementAttributes).forEach((attrName)=>{\n tag.setAttribute(attrName, elementAttributes[attrName]);\n });\n target.head.appendChild(tag);\n return tag;\n};\nconst insertSheet = (tag, rule)=>{\n const sheet = tag.sheet;\n if (sheet) {\n if (sheet.cssRules.length > 0) {\n sheet.deleteRule(0);\n }\n sheet.insertRule(rule, 0);\n } else if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error('FluentProvider: No sheet available on styleTag, styles will not be inserted into DOM.');\n }\n};\n/**\n * Writes a theme as css variables in a style tag on the provided targetDocument as a rule applied to a CSS class\n * @internal\n * @returns CSS class to apply the rule\n */ export const useFluentProviderThemeStyleTag = (options)=>{\n const { targetDocument, theme, rendererAttributes } = options;\n const styleTag = React.useRef();\n const styleTagId = useId(fluentProviderClassNames.root);\n const styleElementAttributes = rendererAttributes;\n const rule = React.useMemo(()=>createCSSRuleFromTheme(`.${styleTagId}`, theme), [\n theme,\n styleTagId\n ]);\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useMemo(()=>{\n // Heads up!\n // .useMemo() is used because it is called during render and DOM for _current_ component is not mounted yet. Also,\n // this allows to do checks with strict mode enabled as .useEffect() will be called with incremented IDs because\n // of double render.\n if (targetDocument) {\n const providerSelector = `.${fluentProviderClassNames.root}.${styleTagId}`;\n const providerElements = targetDocument.querySelectorAll(providerSelector);\n // In SSR, we will have DOM upfront. To avoid false positives the check on nested style tag is performed\n const isSSR = targetDocument.querySelector(`${providerSelector} > style[id=\"${styleTagId}\"]`) !== null;\n const elementsCount = isSSR ? 1 : 0;\n if (providerElements.length > elementsCount) {\n // eslint-disable-next-line no-console\n console.error([\n '@fluentui/react-provider: There are conflicting ids in your DOM.',\n 'Please make sure that you configured your application properly.',\n '\\n',\n '\\n',\n 'Configuration guide: https://aka.ms/fluentui-conflicting-ids'\n ].join(' '));\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n }\n useHandleSSRStyleElements(targetDocument, styleTagId);\n useInsertionEffect(()=>{\n var _targetDocument;\n // The style element could already have been created during SSR - no need to recreate it\n const ssrStyleElement = (_targetDocument = targetDocument) === null || _targetDocument === void 0 ? void 0 : _targetDocument.getElementById(styleTagId);\n if (ssrStyleElement) {\n styleTag.current = ssrStyleElement;\n } else {\n styleTag.current = createStyleTag(targetDocument, {\n ...styleElementAttributes,\n id: styleTagId\n });\n if (styleTag.current) {\n insertSheet(styleTag.current, rule);\n }\n }\n return ()=>{\n var _styleTag_current;\n (_styleTag_current = styleTag.current) === null || _styleTag_current === void 0 ? void 0 : _styleTag_current.remove();\n };\n }, [\n styleTagId,\n targetDocument,\n rule,\n styleElementAttributes\n ]);\n return {\n styleTagId,\n rule\n };\n};\nfunction useHandleSSRStyleElements(targetDocument, styleTagId) {\n // Using a state factory so that this logic only runs once per render\n // Each FluentProvider can create its own style element during SSR as a slot\n // Moves all theme style elements to document head during render to avoid hydration errors.\n // Should be strict mode safe since the logic is idempotent.\n React.useState(()=>{\n if (!targetDocument) {\n return;\n }\n const themeStyleElement = targetDocument.getElementById(styleTagId);\n if (themeStyleElement) {\n targetDocument.head.append(themeStyleElement);\n }\n });\n}\n"],"names":["useFluentProviderThemeStyleTag","useInsertionEffect","React","useIsomorphicLayoutEffect","createStyleTag","target","elementAttributes","undefined","tag","createElement","Object","keys","forEach","attrName","setAttribute","head","appendChild","insertSheet","rule","sheet","cssRules","length","deleteRule","insertRule","process","env","NODE_ENV","console","error","options","targetDocument","theme","rendererAttributes","styleTag","useRef","styleTagId","useId","fluentProviderClassNames","root","styleElementAttributes","useMemo","createCSSRuleFromTheme","providerSelector","providerElements","querySelectorAll","isSSR","querySelector","elementsCount","join","useHandleSSRStyleElements","_targetDocument","ssrStyleElement","getElementById","current","id","_styleTag_current","remove","useState","themeStyleElement","append"],"mappings":";;;;+BAiCiBA;;;eAAAA;;;;gCAjCgC;iEAC1B;wCACgB;+CACE;AACzC,4FAA4F;AAC5F,MAAMC,qBAAqBC,MAAK,CAAC,iBAAiB,SAAS,GA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CAAC3B,gBAAgB;YACjB;QACJ;QACA,MAAM4B,oBAAoB5B,eAAesB,cAAc,CAACjB;QACxD,IAAIuB,mBAAmB;YACnB5B,eAAef,IAAI,CAAC4C,MAAM,CAACD;QAC/B;IACJ;AACJ"}
1
+ {"version":3,"sources":["useFluentProviderThemeStyleTag.js"],"sourcesContent":["import { useId, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport * as React from 'react';\nimport { createCSSRuleFromTheme } from './createCSSRuleFromTheme';\nimport { fluentProviderClassNames } from './useFluentProviderStyles.styles';\n// String concatenation is used to prevent bundlers to complain with older versions of React\nconst useInsertionEffect = React['useInsertion' + 'Effect'] ? React['useInsertion' + 'Effect'] : useIsomorphicLayoutEffect;\nconst createStyleTag = (target, elementAttributes)=>{\n if (!target) {\n return undefined;\n }\n const tag = target.createElement('style');\n Object.keys(elementAttributes).forEach((attrName)=>{\n tag.setAttribute(attrName, elementAttributes[attrName]);\n });\n target.head.appendChild(tag);\n return tag;\n};\nconst insertSheet = (tag, rule)=>{\n const sheet = tag.sheet;\n if (sheet) {\n if (sheet.cssRules.length > 0) {\n sheet.deleteRule(0);\n }\n sheet.insertRule(rule, 0);\n } else if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error('FluentProvider: No sheet available on styleTag, styles will not be inserted into DOM.');\n }\n};\n/**\n * Writes a theme as css variables in a style tag on the provided targetDocument as a rule applied to a CSS class\n * @internal\n * @returns CSS class to apply the rule\n */ export const useFluentProviderThemeStyleTag = (options)=>{\n const { targetDocument, theme, rendererAttributes } = options;\n const styleTag = React.useRef();\n const styleTagId = useId(fluentProviderClassNames.root);\n const styleElementAttributes = rendererAttributes;\n const rule = React.useMemo(()=>createCSSRuleFromTheme(`.${styleTagId}`, theme), [\n theme,\n styleTagId\n ]);\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useMemo(()=>{\n // Heads up!\n // .useMemo() is used because it is called during render and DOM for _current_ component is not mounted yet. Also,\n // this allows to do checks with strict mode enabled as .useEffect() will be called with incremented IDs because\n // of double render.\n if (targetDocument) {\n const providerSelector = `.${fluentProviderClassNames.root}.${styleTagId}`;\n const providerElements = targetDocument.querySelectorAll(providerSelector);\n // In SSR, we will have DOM upfront. To avoid false positives the check on nested style tag is performed\n const isSSR = targetDocument.querySelector(`${providerSelector} > style[id=\"${styleTagId}\"]`) !== null;\n const elementsCount = isSSR ? 1 : 0;\n if (providerElements.length > elementsCount) {\n // eslint-disable-next-line no-console\n console.error([\n '@fluentui/react-provider: There are conflicting ids in your DOM.',\n 'Please make sure that you configured your application properly.',\n '\\n',\n '\\n',\n 'Configuration guide: https://aka.ms/fluentui-conflicting-ids'\n ].join(' '));\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n }\n useHandleSSRStyleElements(targetDocument, styleTagId);\n useInsertionEffect(()=>{\n // The style element could already have been created during SSR - no need to recreate it\n const ssrStyleElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.getElementById(styleTagId);\n if (ssrStyleElement) {\n styleTag.current = ssrStyleElement;\n } else {\n styleTag.current = createStyleTag(targetDocument, {\n ...styleElementAttributes,\n id: styleTagId\n });\n if (styleTag.current) {\n insertSheet(styleTag.current, rule);\n }\n }\n return ()=>{\n var _styleTag_current;\n (_styleTag_current = styleTag.current) === null || _styleTag_current === void 0 ? void 0 : _styleTag_current.remove();\n };\n }, [\n styleTagId,\n targetDocument,\n rule,\n styleElementAttributes\n ]);\n return {\n styleTagId,\n rule\n };\n};\nfunction useHandleSSRStyleElements(targetDocument, styleTagId) {\n // Using a state factory so that this logic only runs once per render\n // Each FluentProvider can create its own style element during SSR as a slot\n // Moves all theme style elements to document head during render to avoid hydration errors.\n // Should be strict mode safe since the logic is idempotent.\n React.useState(()=>{\n if (!targetDocument) {\n return;\n }\n const themeStyleElement = targetDocument.getElementById(styleTagId);\n if (themeStyleElement) {\n targetDocument.head.append(themeStyleElement);\n }\n });\n}\n"],"names":["useFluentProviderThemeStyleTag","useInsertionEffect","React","useIsomorphicLayoutEffect","createStyleTag","target","elementAttributes","undefined","tag","createElement","Object","keys","forEach","attrName","setAttribute","head","appendChild","insertSheet","rule","sheet","cssRules","length","deleteRule","insertRule","process","env","NODE_ENV","console","error","options","targetDocument","theme","rendererAttributes","styleTag","useRef","styleTagId","useId","fluentProviderClassNames","root","styleElementAttributes","useMemo","createCSSRuleFromTheme","providerSelector","providerElements","querySelectorAll","isSSR","querySelector","elementsCount","join","useHandleSSRStyleElements","ssrStyleElement","getElementById","current","id","_styleTag_current","remove","useState","themeStyleElement","append"],"mappings":";;;;+BAiCiBA;;;eAAAA;;;;gCAjCgC;iEAC1B;wCACgB;+CACE;AACzC,4FAA4F;AAC5F,MAAMC,qBAAqBC,MAAK,CAAC,iBAAiB,SAAS,GAAGA,MAAK,CAAC,iBAAiB,SAAS,GAAGC,yCAAyB;AAC1H,MAAMC,iBAAiB,CAACC,QAAQC;IAC5B,IAAI,CAACD,QAAQ;QACT,OAAOE;IACX;IACA,MAAMC,MAAMH,OAAOI,aAAa,CAAC;IACjCC,OAAOC,IAAI,CAACL,mBAAmBM,OAAO,CAAC,CAACC;QACpCL,IAAIM,YAAY,CAACD,UAAUP,iBAAiB,CAACO,SAAS;IAC1D;IACAR,OAAOU,IAAI,CAACC,WAAW,CAACR;IACxB,OAAOA;AACX;AACA,MAAMS,cAAc,CAACT,KAAKU;IACtB,MAAMC,QAAQX,IAAIW,KAAK;IACvB,IAAIA,OAAO;QACP,IAAIA,MAAMC,QAAQ,CAACC,MAAM,GAAG,GAAG;YAC3BF,MAAMG,UAAU,CAAC;QACrB;QACAH,MAAMI,UAAU,CAACL,MAAM;IAC3B,OAAO,IAAIM,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QAC9C,sCAAsC;QACtCC,QAAQC,KAAK,CAAC;IAClB;AACJ;AAKW,MAAM5B,iCAAiC,CAAC6B;IAC/C,MAAM,EAAEC,cAAc,EAAEC,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sBAAsB;gBACzBc,IAAIlB;YACR;YACA,IAAIF,SAASmB,OAAO,EAAE;gBAClBnC,YAAYgB,SAASmB,OAAO,EAAElC;YAClC;QACJ;QACA,OAAO;YACH,IAAIoC;YACHA,CAAAA,oBAAoBrB,SAASmB,OAAO,AAAD,MAAO,QAAQE,sBAAsB,KAAK,IAAI,KAAK,IAAIA,kBAAkBC,MAAM;QACvH;IACJ,GAAG;QACCpB;QACAL;QACAZ;QACAqB;KACH;IACD,OAAO;QACHJ;QACAjB;IACJ;AACJ;AACA,SAAS+B,0BAA0BnB,cAAc,EAAEK,UAAU;IACzD,qEAAqE;IACrE,4EAA4E;IAC5E,2FAA2F;IAC3F,4DAA4D;IAC5DjC,OAAMsD,QAAQ,CAAC;QACX,IAAI,CAAC1B,gBAAgB;YACjB;QACJ;QACA,MAAM2B,oBAAoB3B,eAAeqB,cAAc,CAAChB;QACxD,IAAIsB,mBAAmB;YACnB3B,eAAef,IAAI,CAAC2C,MAAM,CAACD;QAC/B;IACJ;AACJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-provider",
3
- "version": "9.9.1",
3
+ "version": "9.10.2",
4
4
  "description": "Fluent UI React provider component",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -33,12 +33,12 @@
33
33
  "@fluentui/scripts-tasks": "*"
34
34
  },
35
35
  "dependencies": {
36
- "@fluentui/react-icons": "^2.0.207",
37
- "@fluentui/react-shared-contexts": "^9.8.1",
38
- "@fluentui/react-tabster": "^9.12.11",
39
- "@fluentui/react-theme": "^9.1.12",
40
- "@fluentui/react-utilities": "^9.13.3",
41
- "@fluentui/react-jsx-runtime": "^9.0.10",
36
+ "@fluentui/react-icons": "^2.0.217",
37
+ "@fluentui/react-shared-contexts": "^9.9.2",
38
+ "@fluentui/react-tabster": "^9.13.2",
39
+ "@fluentui/react-theme": "^9.1.14",
40
+ "@fluentui/react-utilities": "^9.13.5",
41
+ "@fluentui/react-jsx-runtime": "^9.0.12",
42
42
  "@griffel/core": "^1.14.1",
43
43
  "@griffel/react": "^1.5.14",
44
44
  "@swc/helpers": "^0.5.1"