@react-spectrum/provider 3.9.5 → 3.9.7

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.
Files changed (43) hide show
  1. package/dist/Provider.main.js +181 -0
  2. package/dist/Provider.main.js.map +1 -0
  3. package/dist/Provider.mjs +174 -0
  4. package/dist/Provider.module.js +174 -0
  5. package/dist/Provider.module.js.map +1 -0
  6. package/dist/context.main.js +28 -0
  7. package/dist/context.main.js.map +1 -0
  8. package/dist/context.mjs +19 -0
  9. package/dist/context.module.js +19 -0
  10. package/dist/context.module.js.map +1 -0
  11. package/dist/import.mjs +1 -263
  12. package/dist/main.js +4 -262
  13. package/dist/main.js.map +1 -1
  14. package/dist/mediaQueries.main.js +41 -0
  15. package/dist/mediaQueries.main.js.map +1 -0
  16. package/dist/mediaQueries.mjs +35 -0
  17. package/dist/mediaQueries.module.js +35 -0
  18. package/dist/mediaQueries.module.js.map +1 -0
  19. package/dist/module.js +1 -263
  20. package/dist/module.js.map +1 -1
  21. package/dist/package.main.js +4 -0
  22. package/dist/package.main.js.map +1 -0
  23. package/dist/package.mjs +6 -0
  24. package/dist/package.module.js +6 -0
  25. package/dist/package.module.js.map +1 -0
  26. package/dist/page_vars_css.main.js +26 -0
  27. package/dist/page_vars_css.main.js.map +1 -0
  28. package/dist/page_vars_css.mjs +28 -0
  29. package/dist/page_vars_css.module.js +28 -0
  30. package/dist/page_vars_css.module.js.map +1 -0
  31. package/dist/types.d.ts +2 -1
  32. package/dist/types.d.ts.map +1 -1
  33. package/dist/{main.css → typography.eea3ebfe.css} +13 -99
  34. package/dist/typography.eea3ebfe.css.map +1 -0
  35. package/dist/typography_index_css.main.js +32 -0
  36. package/dist/typography_index_css.main.js.map +1 -0
  37. package/dist/typography_index_css.mjs +34 -0
  38. package/dist/typography_index_css.module.js +34 -0
  39. package/dist/typography_index_css.module.js.map +1 -0
  40. package/dist/vars.3c44f451.css +85 -0
  41. package/dist/vars.3c44f451.css.map +1 -0
  42. package/package.json +8 -8
  43. package/dist/main.css.map +0 -1
@@ -0,0 +1,19 @@
1
+ import $hscZN$react from "react";
2
+
3
+ /*
4
+ * Copyright 2020 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+ const $a8430f637b4ccbce$export$841858b892ce1f4c = (0, $hscZN$react).createContext(null);
15
+ $a8430f637b4ccbce$export$841858b892ce1f4c.displayName = 'ProviderContext';
16
+
17
+
18
+ export {$a8430f637b4ccbce$export$841858b892ce1f4c as Context};
19
+ //# sourceMappingURL=context.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC;AAOM,MAAM,4CAAU,CAAA,GAAA,YAAI,EAAE,aAAa,CAAyB;AACnE,0CAAQ,WAAW,GAAG","sources":["packages/@react-spectrum/provider/src/context.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {ProviderContext} from '@react-types/provider';\nimport React from 'react';\n\n// Context is placed in a separate file to avoid fast refresh issue where the old provider context values\n// are immediately replaced with the null default. Stopgap solution until we fix this in parcel.\nexport const Context = React.createContext<ProviderContext | null>(null);\nContext.displayName = 'ProviderContext';\n"],"names":[],"version":3,"file":"context.module.js.map"}
package/dist/import.mjs CHANGED
@@ -1,19 +1,5 @@
1
- import "./main.css";
2
- import {useMatchedBreakpoints as $b6ncI$useMatchedBreakpoints, useStyleProps as $b6ncI$useStyleProps, BreakpointProvider as $b6ncI$BreakpointProvider, useDOMRef as $b6ncI$useDOMRef, shouldKeepSpectrumClassNames as $b6ncI$shouldKeepSpectrumClassNames, useMediaQuery as $b6ncI$useMediaQuery} from "@react-spectrum/utils";
3
- import $b6ncI$clsx from "clsx";
4
- import {filterDOMProps as $b6ncI$filterDOMProps, RouterProvider as $b6ncI$RouterProvider} from "@react-aria/utils";
5
- import {useLocale as $b6ncI$useLocale, I18nProvider as $b6ncI$I18nProvider} from "@react-aria/i18n";
6
- import {ModalProvider as $b6ncI$ModalProvider, useModalProvider as $b6ncI$useModalProvider} from "@react-aria/overlays";
7
- import $b6ncI$react, {useRef as $b6ncI$useRef, useEffect as $b6ncI$useEffect, useContext as $b6ncI$useContext} from "react";
1
+ import {Provider as $7167f8da3cce35e4$export$2881499e37b75b9a, useProvider as $7167f8da3cce35e4$export$693cdb10cec23617, useProviderProps as $7167f8da3cce35e4$export$521c373ccc32c300} from "./Provider.mjs";
8
2
 
9
-
10
- function $parcel$interopDefault(a) {
11
- return a && a.__esModule ? a.default : a;
12
- }
13
-
14
- function $parcel$export(e, n, v, s) {
15
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
16
- }
17
3
  /*
18
4
  * Copyright 2020 Adobe. All rights reserved.
19
5
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -25,254 +11,6 @@ function $parcel$export(e, n, v, s) {
25
11
  * OF ANY KIND, either express or implied. See the License for the specific language
26
12
  * governing permissions and limitations under the License.
27
13
  */ /// <reference types="css-module-types" />
28
- /*
29
- * Copyright 2020 Adobe. All rights reserved.
30
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
31
- * you may not use this file except in compliance with the License. You may obtain a copy
32
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
33
- *
34
- * Unless required by applicable law or agreed to in writing, software distributed under
35
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
36
- * OF ANY KIND, either express or implied. See the License for the specific language
37
- * governing permissions and limitations under the License.
38
- */
39
-
40
- /*
41
- * Copyright 2020 Adobe. All rights reserved.
42
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
43
- * you may not use this file except in compliance with the License. You may obtain a copy
44
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
45
- *
46
- * Unless required by applicable law or agreed to in writing, software distributed under
47
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
48
- * OF ANY KIND, either express or implied. See the License for the specific language
49
- * governing permissions and limitations under the License.
50
- */
51
- const $a8430f637b4ccbce$export$841858b892ce1f4c = (0, $b6ncI$react).createContext(null);
52
- $a8430f637b4ccbce$export$841858b892ce1f4c.displayName = "ProviderContext";
53
-
54
-
55
-
56
-
57
-
58
-
59
- var $698974e9dd92c2ec$exports = {};
60
-
61
- $parcel$export($698974e9dd92c2ec$exports, "focus-ring", () => $698974e9dd92c2ec$export$f39a09f249340e2a, (v) => $698974e9dd92c2ec$export$f39a09f249340e2a = v);
62
- $parcel$export($698974e9dd92c2ec$exports, "i18nFontFamily", () => $698974e9dd92c2ec$export$8c4ee2c50c22c514, (v) => $698974e9dd92c2ec$export$8c4ee2c50c22c514 = v);
63
- $parcel$export($698974e9dd92c2ec$exports, "spectrum", () => $698974e9dd92c2ec$export$3311ab3a441bc141, (v) => $698974e9dd92c2ec$export$3311ab3a441bc141 = v);
64
- $parcel$export($698974e9dd92c2ec$exports, "spectrum-FocusRing-ring", () => $698974e9dd92c2ec$export$4109102f950813a6, (v) => $698974e9dd92c2ec$export$4109102f950813a6 = v);
65
- $parcel$export($698974e9dd92c2ec$exports, "spectrum-FocusRing", () => $698974e9dd92c2ec$export$24c7f46a6e3605dd, (v) => $698974e9dd92c2ec$export$24c7f46a6e3605dd = v);
66
- $parcel$export($698974e9dd92c2ec$exports, "spectrum-FocusRing--quiet", () => $698974e9dd92c2ec$export$2927016961429360, (v) => $698974e9dd92c2ec$export$2927016961429360 = v);
67
- var $698974e9dd92c2ec$export$f39a09f249340e2a;
68
- var $698974e9dd92c2ec$export$8c4ee2c50c22c514;
69
- var $698974e9dd92c2ec$export$3311ab3a441bc141;
70
- var $698974e9dd92c2ec$export$4109102f950813a6;
71
- var $698974e9dd92c2ec$export$24c7f46a6e3605dd;
72
- var $698974e9dd92c2ec$export$2927016961429360;
73
- $698974e9dd92c2ec$export$f39a09f249340e2a = `JuTe6q_focus-ring`;
74
- $698974e9dd92c2ec$export$8c4ee2c50c22c514 = `JuTe6q_i18nFontFamily`;
75
- $698974e9dd92c2ec$export$3311ab3a441bc141 = `JuTe6q_spectrum`;
76
- $698974e9dd92c2ec$export$4109102f950813a6 = `JuTe6q_spectrum-FocusRing-ring`;
77
- $698974e9dd92c2ec$export$24c7f46a6e3605dd = `JuTe6q_spectrum-FocusRing ${$698974e9dd92c2ec$export$4109102f950813a6}`;
78
- $698974e9dd92c2ec$export$2927016961429360 = `JuTe6q_spectrum-FocusRing--quiet`;
79
-
80
-
81
- var $5cac98e4c80e6707$exports = {};
82
-
83
- $parcel$export($5cac98e4c80e6707$exports, "focus-ring", () => $5cac98e4c80e6707$export$f39a09f249340e2a, (v) => $5cac98e4c80e6707$export$f39a09f249340e2a = v);
84
- $parcel$export($5cac98e4c80e6707$exports, "i18nFontFamily", () => $5cac98e4c80e6707$export$8c4ee2c50c22c514, (v) => $5cac98e4c80e6707$export$8c4ee2c50c22c514 = v);
85
- $parcel$export($5cac98e4c80e6707$exports, "spectrum", () => $5cac98e4c80e6707$export$3311ab3a441bc141, (v) => $5cac98e4c80e6707$export$3311ab3a441bc141 = v);
86
- $parcel$export($5cac98e4c80e6707$exports, "spectrum-Body", () => $5cac98e4c80e6707$export$a30bf7810c8453d1, (v) => $5cac98e4c80e6707$export$a30bf7810c8453d1 = v);
87
- $parcel$export($5cac98e4c80e6707$exports, "spectrum-Body--italic", () => $5cac98e4c80e6707$export$7b2dac1166f6ec4c, (v) => $5cac98e4c80e6707$export$7b2dac1166f6ec4c = v);
88
- $parcel$export($5cac98e4c80e6707$exports, "spectrum-FocusRing-ring", () => $5cac98e4c80e6707$export$4109102f950813a6, (v) => $5cac98e4c80e6707$export$4109102f950813a6 = v);
89
- $parcel$export($5cac98e4c80e6707$exports, "spectrum-FocusRing", () => $5cac98e4c80e6707$export$24c7f46a6e3605dd, (v) => $5cac98e4c80e6707$export$24c7f46a6e3605dd = v);
90
- $parcel$export($5cac98e4c80e6707$exports, "spectrum-FocusRing--quiet", () => $5cac98e4c80e6707$export$2927016961429360, (v) => $5cac98e4c80e6707$export$2927016961429360 = v);
91
- var $5cac98e4c80e6707$export$f39a09f249340e2a;
92
- var $5cac98e4c80e6707$export$8c4ee2c50c22c514;
93
- var $5cac98e4c80e6707$export$3311ab3a441bc141;
94
- var $5cac98e4c80e6707$export$a30bf7810c8453d1;
95
- var $5cac98e4c80e6707$export$7b2dac1166f6ec4c;
96
- var $5cac98e4c80e6707$export$4109102f950813a6;
97
- var $5cac98e4c80e6707$export$24c7f46a6e3605dd;
98
- var $5cac98e4c80e6707$export$2927016961429360;
99
- $5cac98e4c80e6707$export$f39a09f249340e2a = `_5QszkG_focus-ring`;
100
- $5cac98e4c80e6707$export$8c4ee2c50c22c514 = `_5QszkG_i18nFontFamily`;
101
- $5cac98e4c80e6707$export$3311ab3a441bc141 = `_5QszkG_spectrum ${$5cac98e4c80e6707$export$8c4ee2c50c22c514}`;
102
- $5cac98e4c80e6707$export$a30bf7810c8453d1 = `_5QszkG_spectrum-Body`;
103
- $5cac98e4c80e6707$export$7b2dac1166f6ec4c = `_5QszkG_spectrum-Body--italic`;
104
- $5cac98e4c80e6707$export$4109102f950813a6 = `_5QszkG_spectrum-FocusRing-ring`;
105
- $5cac98e4c80e6707$export$24c7f46a6e3605dd = `_5QszkG_spectrum-FocusRing ${$5cac98e4c80e6707$export$4109102f950813a6}`;
106
- $5cac98e4c80e6707$export$2927016961429360 = `_5QszkG_spectrum-FocusRing--quiet`;
107
-
108
-
109
- /*
110
- * Copyright 2020 Adobe. All rights reserved.
111
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
112
- * you may not use this file except in compliance with the License. You may obtain a copy
113
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
114
- *
115
- * Unless required by applicable law or agreed to in writing, software distributed under
116
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
117
- * OF ANY KIND, either express or implied. See the License for the specific language
118
- * governing permissions and limitations under the License.
119
- */
120
- function $d8453c5ae7fac713$export$6343629ee1b29116(theme, defaultColorScheme) {
121
- let matchesDark = (0, $b6ncI$useMediaQuery)("(prefers-color-scheme: dark)");
122
- let matchesLight = (0, $b6ncI$useMediaQuery)("(prefers-color-scheme: light)");
123
- // importance OS > default > omitted
124
- if (theme.dark && matchesDark) return "dark";
125
- if (theme.light && matchesLight) return "light";
126
- if (theme.dark && defaultColorScheme === "dark") return "dark";
127
- if (theme.light && defaultColorScheme === "light") return "light";
128
- if (!theme.dark) return "light";
129
- if (!theme.light) return "dark";
130
- return "light";
131
- }
132
- function $d8453c5ae7fac713$export$a8d2043b2d807f4d(theme) {
133
- let matchesFine = (0, $b6ncI$useMediaQuery)("(any-pointer: fine)");
134
- if (matchesFine && theme.medium) return "medium";
135
- if (theme.large) return "large";
136
- return "medium";
137
- }
138
-
139
-
140
- var $7b22e09dddddd7da$exports = {};
141
- $7b22e09dddddd7da$exports = JSON.parse('{"name":"@react-spectrum/provider","version":"3.9.4","description":"Spectrum UI components in React","license":"Apache-2.0","main":"dist/main.js","module":"dist/module.js","exports":{"types":"./dist/types.d.ts","import":"./dist/import.mjs","require":"./dist/main.js"},"types":"dist/types.d.ts","source":"src/index.ts","files":["dist","src"],"sideEffects":["*.css"],"targets":{"main":{"includeNodeModules":["@adobe/spectrum-css-temp"]},"module":{"includeNodeModules":["@adobe/spectrum-css-temp"]}},"repository":{"type":"git","url":"https://github.com/adobe/react-spectrum"},"dependencies":{"@react-aria/i18n":"^3.10.1","@react-aria/overlays":"^3.21.0","@react-aria/utils":"^3.23.1","@react-spectrum/utils":"^3.11.4","@react-types/provider":"^3.7.1","@react-types/shared":"^3.22.0","@swc/helpers":"^0.5.0","clsx":"^2.0.0"},"devDependencies":{"@adobe/spectrum-css-temp":"3.0.0-alpha.1"},"peerDependencies":{"react":"^16.8.0 || ^17.0.0-rc.1 || ^18.0.0","react-dom":"^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"},"publishConfig":{"access":"public"}}');
142
-
143
-
144
- const $7167f8da3cce35e4$var$DEFAULT_BREAKPOINTS = {
145
- S: 640,
146
- M: 768,
147
- L: 1024,
148
- XL: 1280,
149
- XXL: 1536
150
- };
151
- function $7167f8da3cce35e4$var$Provider(props, ref) {
152
- let prevContext = $7167f8da3cce35e4$export$693cdb10cec23617();
153
- let prevColorScheme = prevContext && prevContext.colorScheme;
154
- let prevBreakpoints = prevContext && prevContext.breakpoints;
155
- let { theme: theme = prevContext && prevContext.theme, defaultColorScheme: defaultColorScheme } = props;
156
- if (!theme) throw new Error("theme not found, the parent provider must have a theme provided");
157
- // Hooks must always be called.
158
- let autoColorScheme = (0, $d8453c5ae7fac713$export$6343629ee1b29116)(theme, defaultColorScheme);
159
- let autoScale = (0, $d8453c5ae7fac713$export$a8d2043b2d807f4d)(theme);
160
- let { locale: prevLocale } = (0, $b6ncI$useLocale)();
161
- // if the new theme doesn't support the prevColorScheme, we must resort to the auto
162
- let usePrevColorScheme = !!theme[prevColorScheme];
163
- // importance of color scheme props > parent > auto:(OS > default > omitted)
164
- let { colorScheme: colorScheme = usePrevColorScheme ? prevColorScheme : autoColorScheme, scale: scale = prevContext ? prevContext.scale : autoScale, locale: locale = prevContext ? prevLocale : null, breakpoints: breakpoints = prevContext ? prevBreakpoints : $7167f8da3cce35e4$var$DEFAULT_BREAKPOINTS, children: children, isQuiet: isQuiet, isEmphasized: isEmphasized, isDisabled: isDisabled, isRequired: isRequired, isReadOnly: isReadOnly, validationState: validationState, router: router, ...otherProps } = props;
165
- // select only the props with values so undefined props don't overwrite prevContext values
166
- let currentProps = {
167
- version: $7b22e09dddddd7da$exports.version,
168
- theme: theme,
169
- breakpoints: breakpoints,
170
- colorScheme: colorScheme,
171
- scale: scale,
172
- isQuiet: isQuiet,
173
- isEmphasized: isEmphasized,
174
- isDisabled: isDisabled,
175
- isRequired: isRequired,
176
- isReadOnly: isReadOnly,
177
- validationState: validationState
178
- };
179
- let matchedBreakpoints = (0, $b6ncI$useMatchedBreakpoints)(breakpoints);
180
- let filteredProps = {};
181
- Object.entries(currentProps).forEach(([key, value])=>value !== undefined && (filteredProps[key] = value));
182
- // Merge options with parent provider
183
- let context = Object.assign({}, prevContext, filteredProps);
184
- // Only wrap in a DOM node if the theme, colorScheme, or scale changed
185
- let contents = children;
186
- let domProps = (0, $b6ncI$filterDOMProps)(otherProps);
187
- let { styleProps: styleProps } = (0, $b6ncI$useStyleProps)(otherProps, undefined, {
188
- matchedBreakpoints: matchedBreakpoints
189
- });
190
- if (!prevContext || props.locale || theme !== prevContext.theme || colorScheme !== prevContext.colorScheme || scale !== prevContext.scale || Object.keys(domProps).length > 0 || otherProps.UNSAFE_className || Object.keys(styleProps.style).length > 0) contents = /*#__PURE__*/ (0, $b6ncI$react).createElement($7167f8da3cce35e4$var$ProviderWrapper, {
191
- ...props,
192
- UNSAFE_style: {
193
- isolation: !prevContext ? "isolate" : undefined,
194
- ...styleProps.style
195
- },
196
- ref: ref
197
- }, contents);
198
- if (router) contents = /*#__PURE__*/ (0, $b6ncI$react).createElement((0, $b6ncI$RouterProvider), router, contents);
199
- return /*#__PURE__*/ (0, $b6ncI$react).createElement((0, $a8430f637b4ccbce$export$841858b892ce1f4c).Provider, {
200
- value: context
201
- }, /*#__PURE__*/ (0, $b6ncI$react).createElement((0, $b6ncI$I18nProvider), {
202
- locale: locale
203
- }, /*#__PURE__*/ (0, $b6ncI$react).createElement((0, $b6ncI$BreakpointProvider), {
204
- matchedBreakpoints: matchedBreakpoints
205
- }, /*#__PURE__*/ (0, $b6ncI$react).createElement((0, $b6ncI$ModalProvider), null, contents))));
206
- }
207
- /**
208
- * Provider is the container for all React Spectrum applications.
209
- * It defines the theme, locale, and other application level settings,
210
- * and can also be used to provide common properties to a group of components.
211
- */ let $7167f8da3cce35e4$export$2881499e37b75b9a = /*#__PURE__*/ (0, $b6ncI$react).forwardRef($7167f8da3cce35e4$var$Provider);
212
- const $7167f8da3cce35e4$var$ProviderWrapper = /*#__PURE__*/ (0, $b6ncI$react).forwardRef(function ProviderWrapper(props, ref) {
213
- let { children: children, ...otherProps } = props;
214
- let { locale: locale, direction: direction } = (0, $b6ncI$useLocale)();
215
- let { theme: theme, colorScheme: colorScheme, scale: scale } = $7167f8da3cce35e4$export$693cdb10cec23617();
216
- let { modalProviderProps: modalProviderProps } = (0, $b6ncI$useModalProvider)();
217
- let { styleProps: styleProps } = (0, $b6ncI$useStyleProps)(otherProps);
218
- let domRef = (0, $b6ncI$useDOMRef)(ref);
219
- let themeKey = Object.keys(theme[colorScheme])[0];
220
- let scaleKey = Object.keys(theme[scale])[0];
221
- let className = (0, $b6ncI$clsx)(styleProps.className, (0, (/*@__PURE__*/$parcel$interopDefault($698974e9dd92c2ec$exports)))["spectrum"], (0, (/*@__PURE__*/$parcel$interopDefault($5cac98e4c80e6707$exports)))["spectrum"], Object.values(theme[colorScheme]), Object.values(theme[scale]), theme.global ? Object.values(theme.global) : null, {
222
- "react-spectrum-provider": (0, $b6ncI$shouldKeepSpectrumClassNames),
223
- spectrum: (0, $b6ncI$shouldKeepSpectrumClassNames),
224
- [themeKey]: (0, $b6ncI$shouldKeepSpectrumClassNames),
225
- [scaleKey]: (0, $b6ncI$shouldKeepSpectrumClassNames)
226
- });
227
- var _props_colorScheme, _ref;
228
- let style = {
229
- ...styleProps.style,
230
- // This ensures that browser native UI like scrollbars are rendered in the right color scheme.
231
- // See https://web.dev/color-scheme/.
232
- colorScheme: (_ref = (_props_colorScheme = props.colorScheme) !== null && _props_colorScheme !== void 0 ? _props_colorScheme : colorScheme) !== null && _ref !== void 0 ? _ref : Object.keys(theme).filter((k)=>k === "light" || k === "dark").join(" ")
233
- };
234
- let hasWarned = (0, $b6ncI$useRef)(false);
235
- (0, $b6ncI$useEffect)(()=>{
236
- if (direction && domRef.current) {
237
- let closestDir = domRef.current.parentElement.closest("[dir]");
238
- let dir = closestDir && closestDir.getAttribute("dir");
239
- if (dir && dir !== direction && !hasWarned.current) {
240
- console.warn(`Language directions cannot be nested. ${direction} inside ${dir}.`);
241
- hasWarned.current = true;
242
- }
243
- }
244
- }, [
245
- direction,
246
- domRef,
247
- hasWarned
248
- ]);
249
- return /*#__PURE__*/ (0, $b6ncI$react).createElement("div", {
250
- ...(0, $b6ncI$filterDOMProps)(otherProps),
251
- ...styleProps,
252
- ...modalProviderProps,
253
- className: className,
254
- style: style,
255
- lang: locale,
256
- dir: direction,
257
- ref: domRef
258
- }, children);
259
- });
260
- function $7167f8da3cce35e4$export$693cdb10cec23617() {
261
- return (0, $b6ncI$useContext)((0, $a8430f637b4ccbce$export$841858b892ce1f4c));
262
- }
263
- function $7167f8da3cce35e4$export$521c373ccc32c300(props) {
264
- let context = $7167f8da3cce35e4$export$693cdb10cec23617();
265
- if (!context) return props;
266
- return Object.assign({}, {
267
- isQuiet: context.isQuiet,
268
- isEmphasized: context.isEmphasized,
269
- isDisabled: context.isDisabled,
270
- isRequired: context.isRequired,
271
- isReadOnly: context.isReadOnly,
272
- validationState: context.validationState
273
- }, props);
274
- }
275
-
276
14
 
277
15
 
278
16
 
package/dist/main.js CHANGED
@@ -1,23 +1,13 @@
1
- require("./main.css");
2
- var $kmRpa$reactspectrumutils = require("@react-spectrum/utils");
3
- var $kmRpa$clsx = require("clsx");
4
- var $kmRpa$reactariautils = require("@react-aria/utils");
5
- var $kmRpa$reactariai18n = require("@react-aria/i18n");
6
- var $kmRpa$reactariaoverlays = require("@react-aria/overlays");
7
- var $kmRpa$react = require("react");
1
+ var $96cabdf5b0aed55b$exports = require("./Provider.main.js");
8
2
 
9
3
 
10
4
  function $parcel$export(e, n, v, s) {
11
5
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
12
6
  }
13
7
 
14
- function $parcel$interopDefault(a) {
15
- return a && a.__esModule ? a.default : a;
16
- }
17
-
18
- $parcel$export(module.exports, "Provider", () => $96cabdf5b0aed55b$export$2881499e37b75b9a);
19
- $parcel$export(module.exports, "useProvider", () => $96cabdf5b0aed55b$export$693cdb10cec23617);
20
- $parcel$export(module.exports, "useProviderProps", () => $96cabdf5b0aed55b$export$521c373ccc32c300);
8
+ $parcel$export(module.exports, "Provider", () => $96cabdf5b0aed55b$exports.Provider);
9
+ $parcel$export(module.exports, "useProvider", () => $96cabdf5b0aed55b$exports.useProvider);
10
+ $parcel$export(module.exports, "useProviderProps", () => $96cabdf5b0aed55b$exports.useProviderProps);
21
11
  /*
22
12
  * Copyright 2020 Adobe. All rights reserved.
23
13
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -29,254 +19,6 @@ $parcel$export(module.exports, "useProviderProps", () => $96cabdf5b0aed55b$expor
29
19
  * OF ANY KIND, either express or implied. See the License for the specific language
30
20
  * governing permissions and limitations under the License.
31
21
  */ /// <reference types="css-module-types" />
32
- /*
33
- * Copyright 2020 Adobe. All rights reserved.
34
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
35
- * you may not use this file except in compliance with the License. You may obtain a copy
36
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
37
- *
38
- * Unless required by applicable law or agreed to in writing, software distributed under
39
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
40
- * OF ANY KIND, either express or implied. See the License for the specific language
41
- * governing permissions and limitations under the License.
42
- */
43
-
44
- /*
45
- * Copyright 2020 Adobe. All rights reserved.
46
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
47
- * you may not use this file except in compliance with the License. You may obtain a copy
48
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
49
- *
50
- * Unless required by applicable law or agreed to in writing, software distributed under
51
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
52
- * OF ANY KIND, either express or implied. See the License for the specific language
53
- * governing permissions and limitations under the License.
54
- */
55
- const $a5b4f4e252b5a021$export$841858b892ce1f4c = (0, ($parcel$interopDefault($kmRpa$react))).createContext(null);
56
- $a5b4f4e252b5a021$export$841858b892ce1f4c.displayName = "ProviderContext";
57
-
58
-
59
-
60
-
61
-
62
-
63
- var $22365f0f5f2dcdd5$exports = {};
64
-
65
- $parcel$export($22365f0f5f2dcdd5$exports, "focus-ring", () => $22365f0f5f2dcdd5$export$f39a09f249340e2a, (v) => $22365f0f5f2dcdd5$export$f39a09f249340e2a = v);
66
- $parcel$export($22365f0f5f2dcdd5$exports, "i18nFontFamily", () => $22365f0f5f2dcdd5$export$8c4ee2c50c22c514, (v) => $22365f0f5f2dcdd5$export$8c4ee2c50c22c514 = v);
67
- $parcel$export($22365f0f5f2dcdd5$exports, "spectrum", () => $22365f0f5f2dcdd5$export$3311ab3a441bc141, (v) => $22365f0f5f2dcdd5$export$3311ab3a441bc141 = v);
68
- $parcel$export($22365f0f5f2dcdd5$exports, "spectrum-FocusRing-ring", () => $22365f0f5f2dcdd5$export$4109102f950813a6, (v) => $22365f0f5f2dcdd5$export$4109102f950813a6 = v);
69
- $parcel$export($22365f0f5f2dcdd5$exports, "spectrum-FocusRing", () => $22365f0f5f2dcdd5$export$24c7f46a6e3605dd, (v) => $22365f0f5f2dcdd5$export$24c7f46a6e3605dd = v);
70
- $parcel$export($22365f0f5f2dcdd5$exports, "spectrum-FocusRing--quiet", () => $22365f0f5f2dcdd5$export$2927016961429360, (v) => $22365f0f5f2dcdd5$export$2927016961429360 = v);
71
- var $22365f0f5f2dcdd5$export$f39a09f249340e2a;
72
- var $22365f0f5f2dcdd5$export$8c4ee2c50c22c514;
73
- var $22365f0f5f2dcdd5$export$3311ab3a441bc141;
74
- var $22365f0f5f2dcdd5$export$4109102f950813a6;
75
- var $22365f0f5f2dcdd5$export$24c7f46a6e3605dd;
76
- var $22365f0f5f2dcdd5$export$2927016961429360;
77
- $22365f0f5f2dcdd5$export$f39a09f249340e2a = `JuTe6q_focus-ring`;
78
- $22365f0f5f2dcdd5$export$8c4ee2c50c22c514 = `JuTe6q_i18nFontFamily`;
79
- $22365f0f5f2dcdd5$export$3311ab3a441bc141 = `JuTe6q_spectrum`;
80
- $22365f0f5f2dcdd5$export$4109102f950813a6 = `JuTe6q_spectrum-FocusRing-ring`;
81
- $22365f0f5f2dcdd5$export$24c7f46a6e3605dd = `JuTe6q_spectrum-FocusRing ${$22365f0f5f2dcdd5$export$4109102f950813a6}`;
82
- $22365f0f5f2dcdd5$export$2927016961429360 = `JuTe6q_spectrum-FocusRing--quiet`;
83
-
84
-
85
- var $19fbfce217006b12$exports = {};
86
-
87
- $parcel$export($19fbfce217006b12$exports, "focus-ring", () => $19fbfce217006b12$export$f39a09f249340e2a, (v) => $19fbfce217006b12$export$f39a09f249340e2a = v);
88
- $parcel$export($19fbfce217006b12$exports, "i18nFontFamily", () => $19fbfce217006b12$export$8c4ee2c50c22c514, (v) => $19fbfce217006b12$export$8c4ee2c50c22c514 = v);
89
- $parcel$export($19fbfce217006b12$exports, "spectrum", () => $19fbfce217006b12$export$3311ab3a441bc141, (v) => $19fbfce217006b12$export$3311ab3a441bc141 = v);
90
- $parcel$export($19fbfce217006b12$exports, "spectrum-Body", () => $19fbfce217006b12$export$a30bf7810c8453d1, (v) => $19fbfce217006b12$export$a30bf7810c8453d1 = v);
91
- $parcel$export($19fbfce217006b12$exports, "spectrum-Body--italic", () => $19fbfce217006b12$export$7b2dac1166f6ec4c, (v) => $19fbfce217006b12$export$7b2dac1166f6ec4c = v);
92
- $parcel$export($19fbfce217006b12$exports, "spectrum-FocusRing-ring", () => $19fbfce217006b12$export$4109102f950813a6, (v) => $19fbfce217006b12$export$4109102f950813a6 = v);
93
- $parcel$export($19fbfce217006b12$exports, "spectrum-FocusRing", () => $19fbfce217006b12$export$24c7f46a6e3605dd, (v) => $19fbfce217006b12$export$24c7f46a6e3605dd = v);
94
- $parcel$export($19fbfce217006b12$exports, "spectrum-FocusRing--quiet", () => $19fbfce217006b12$export$2927016961429360, (v) => $19fbfce217006b12$export$2927016961429360 = v);
95
- var $19fbfce217006b12$export$f39a09f249340e2a;
96
- var $19fbfce217006b12$export$8c4ee2c50c22c514;
97
- var $19fbfce217006b12$export$3311ab3a441bc141;
98
- var $19fbfce217006b12$export$a30bf7810c8453d1;
99
- var $19fbfce217006b12$export$7b2dac1166f6ec4c;
100
- var $19fbfce217006b12$export$4109102f950813a6;
101
- var $19fbfce217006b12$export$24c7f46a6e3605dd;
102
- var $19fbfce217006b12$export$2927016961429360;
103
- $19fbfce217006b12$export$f39a09f249340e2a = `_5QszkG_focus-ring`;
104
- $19fbfce217006b12$export$8c4ee2c50c22c514 = `_5QszkG_i18nFontFamily`;
105
- $19fbfce217006b12$export$3311ab3a441bc141 = `_5QszkG_spectrum ${$19fbfce217006b12$export$8c4ee2c50c22c514}`;
106
- $19fbfce217006b12$export$a30bf7810c8453d1 = `_5QszkG_spectrum-Body`;
107
- $19fbfce217006b12$export$7b2dac1166f6ec4c = `_5QszkG_spectrum-Body--italic`;
108
- $19fbfce217006b12$export$4109102f950813a6 = `_5QszkG_spectrum-FocusRing-ring`;
109
- $19fbfce217006b12$export$24c7f46a6e3605dd = `_5QszkG_spectrum-FocusRing ${$19fbfce217006b12$export$4109102f950813a6}`;
110
- $19fbfce217006b12$export$2927016961429360 = `_5QszkG_spectrum-FocusRing--quiet`;
111
-
112
-
113
- /*
114
- * Copyright 2020 Adobe. All rights reserved.
115
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
116
- * you may not use this file except in compliance with the License. You may obtain a copy
117
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
118
- *
119
- * Unless required by applicable law or agreed to in writing, software distributed under
120
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
121
- * OF ANY KIND, either express or implied. See the License for the specific language
122
- * governing permissions and limitations under the License.
123
- */
124
- function $a6e2b5f4621e4690$export$6343629ee1b29116(theme, defaultColorScheme) {
125
- let matchesDark = (0, $kmRpa$reactspectrumutils.useMediaQuery)("(prefers-color-scheme: dark)");
126
- let matchesLight = (0, $kmRpa$reactspectrumutils.useMediaQuery)("(prefers-color-scheme: light)");
127
- // importance OS > default > omitted
128
- if (theme.dark && matchesDark) return "dark";
129
- if (theme.light && matchesLight) return "light";
130
- if (theme.dark && defaultColorScheme === "dark") return "dark";
131
- if (theme.light && defaultColorScheme === "light") return "light";
132
- if (!theme.dark) return "light";
133
- if (!theme.light) return "dark";
134
- return "light";
135
- }
136
- function $a6e2b5f4621e4690$export$a8d2043b2d807f4d(theme) {
137
- let matchesFine = (0, $kmRpa$reactspectrumutils.useMediaQuery)("(any-pointer: fine)");
138
- if (matchesFine && theme.medium) return "medium";
139
- if (theme.large) return "large";
140
- return "medium";
141
- }
142
-
143
-
144
- var $4db360e38265184f$exports = {};
145
- $4db360e38265184f$exports = JSON.parse('{"name":"@react-spectrum/provider","version":"3.9.4","description":"Spectrum UI components in React","license":"Apache-2.0","main":"dist/main.js","module":"dist/module.js","exports":{"types":"./dist/types.d.ts","import":"./dist/import.mjs","require":"./dist/main.js"},"types":"dist/types.d.ts","source":"src/index.ts","files":["dist","src"],"sideEffects":["*.css"],"targets":{"main":{"includeNodeModules":["@adobe/spectrum-css-temp"]},"module":{"includeNodeModules":["@adobe/spectrum-css-temp"]}},"repository":{"type":"git","url":"https://github.com/adobe/react-spectrum"},"dependencies":{"@react-aria/i18n":"^3.10.1","@react-aria/overlays":"^3.21.0","@react-aria/utils":"^3.23.1","@react-spectrum/utils":"^3.11.4","@react-types/provider":"^3.7.1","@react-types/shared":"^3.22.0","@swc/helpers":"^0.5.0","clsx":"^2.0.0"},"devDependencies":{"@adobe/spectrum-css-temp":"3.0.0-alpha.1"},"peerDependencies":{"react":"^16.8.0 || ^17.0.0-rc.1 || ^18.0.0","react-dom":"^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"},"publishConfig":{"access":"public"}}');
146
-
147
-
148
- const $96cabdf5b0aed55b$var$DEFAULT_BREAKPOINTS = {
149
- S: 640,
150
- M: 768,
151
- L: 1024,
152
- XL: 1280,
153
- XXL: 1536
154
- };
155
- function $96cabdf5b0aed55b$var$Provider(props, ref) {
156
- let prevContext = $96cabdf5b0aed55b$export$693cdb10cec23617();
157
- let prevColorScheme = prevContext && prevContext.colorScheme;
158
- let prevBreakpoints = prevContext && prevContext.breakpoints;
159
- let { theme: theme = prevContext && prevContext.theme, defaultColorScheme: defaultColorScheme } = props;
160
- if (!theme) throw new Error("theme not found, the parent provider must have a theme provided");
161
- // Hooks must always be called.
162
- let autoColorScheme = (0, $a6e2b5f4621e4690$export$6343629ee1b29116)(theme, defaultColorScheme);
163
- let autoScale = (0, $a6e2b5f4621e4690$export$a8d2043b2d807f4d)(theme);
164
- let { locale: prevLocale } = (0, $kmRpa$reactariai18n.useLocale)();
165
- // if the new theme doesn't support the prevColorScheme, we must resort to the auto
166
- let usePrevColorScheme = !!theme[prevColorScheme];
167
- // importance of color scheme props > parent > auto:(OS > default > omitted)
168
- let { colorScheme: colorScheme = usePrevColorScheme ? prevColorScheme : autoColorScheme, scale: scale = prevContext ? prevContext.scale : autoScale, locale: locale = prevContext ? prevLocale : null, breakpoints: breakpoints = prevContext ? prevBreakpoints : $96cabdf5b0aed55b$var$DEFAULT_BREAKPOINTS, children: children, isQuiet: isQuiet, isEmphasized: isEmphasized, isDisabled: isDisabled, isRequired: isRequired, isReadOnly: isReadOnly, validationState: validationState, router: router, ...otherProps } = props;
169
- // select only the props with values so undefined props don't overwrite prevContext values
170
- let currentProps = {
171
- version: $4db360e38265184f$exports.version,
172
- theme: theme,
173
- breakpoints: breakpoints,
174
- colorScheme: colorScheme,
175
- scale: scale,
176
- isQuiet: isQuiet,
177
- isEmphasized: isEmphasized,
178
- isDisabled: isDisabled,
179
- isRequired: isRequired,
180
- isReadOnly: isReadOnly,
181
- validationState: validationState
182
- };
183
- let matchedBreakpoints = (0, $kmRpa$reactspectrumutils.useMatchedBreakpoints)(breakpoints);
184
- let filteredProps = {};
185
- Object.entries(currentProps).forEach(([key, value])=>value !== undefined && (filteredProps[key] = value));
186
- // Merge options with parent provider
187
- let context = Object.assign({}, prevContext, filteredProps);
188
- // Only wrap in a DOM node if the theme, colorScheme, or scale changed
189
- let contents = children;
190
- let domProps = (0, $kmRpa$reactariautils.filterDOMProps)(otherProps);
191
- let { styleProps: styleProps } = (0, $kmRpa$reactspectrumutils.useStyleProps)(otherProps, undefined, {
192
- matchedBreakpoints: matchedBreakpoints
193
- });
194
- if (!prevContext || props.locale || theme !== prevContext.theme || colorScheme !== prevContext.colorScheme || scale !== prevContext.scale || Object.keys(domProps).length > 0 || otherProps.UNSAFE_className || Object.keys(styleProps.style).length > 0) contents = /*#__PURE__*/ (0, ($parcel$interopDefault($kmRpa$react))).createElement($96cabdf5b0aed55b$var$ProviderWrapper, {
195
- ...props,
196
- UNSAFE_style: {
197
- isolation: !prevContext ? "isolate" : undefined,
198
- ...styleProps.style
199
- },
200
- ref: ref
201
- }, contents);
202
- if (router) contents = /*#__PURE__*/ (0, ($parcel$interopDefault($kmRpa$react))).createElement((0, $kmRpa$reactariautils.RouterProvider), router, contents);
203
- return /*#__PURE__*/ (0, ($parcel$interopDefault($kmRpa$react))).createElement((0, $a5b4f4e252b5a021$export$841858b892ce1f4c).Provider, {
204
- value: context
205
- }, /*#__PURE__*/ (0, ($parcel$interopDefault($kmRpa$react))).createElement((0, $kmRpa$reactariai18n.I18nProvider), {
206
- locale: locale
207
- }, /*#__PURE__*/ (0, ($parcel$interopDefault($kmRpa$react))).createElement((0, $kmRpa$reactspectrumutils.BreakpointProvider), {
208
- matchedBreakpoints: matchedBreakpoints
209
- }, /*#__PURE__*/ (0, ($parcel$interopDefault($kmRpa$react))).createElement((0, $kmRpa$reactariaoverlays.ModalProvider), null, contents))));
210
- }
211
- /**
212
- * Provider is the container for all React Spectrum applications.
213
- * It defines the theme, locale, and other application level settings,
214
- * and can also be used to provide common properties to a group of components.
215
- */ let $96cabdf5b0aed55b$export$2881499e37b75b9a = /*#__PURE__*/ (0, ($parcel$interopDefault($kmRpa$react))).forwardRef($96cabdf5b0aed55b$var$Provider);
216
- const $96cabdf5b0aed55b$var$ProviderWrapper = /*#__PURE__*/ (0, ($parcel$interopDefault($kmRpa$react))).forwardRef(function ProviderWrapper(props, ref) {
217
- let { children: children, ...otherProps } = props;
218
- let { locale: locale, direction: direction } = (0, $kmRpa$reactariai18n.useLocale)();
219
- let { theme: theme, colorScheme: colorScheme, scale: scale } = $96cabdf5b0aed55b$export$693cdb10cec23617();
220
- let { modalProviderProps: modalProviderProps } = (0, $kmRpa$reactariaoverlays.useModalProvider)();
221
- let { styleProps: styleProps } = (0, $kmRpa$reactspectrumutils.useStyleProps)(otherProps);
222
- let domRef = (0, $kmRpa$reactspectrumutils.useDOMRef)(ref);
223
- let themeKey = Object.keys(theme[colorScheme])[0];
224
- let scaleKey = Object.keys(theme[scale])[0];
225
- let className = (0, ($parcel$interopDefault($kmRpa$clsx)))(styleProps.className, (0, (/*@__PURE__*/$parcel$interopDefault($22365f0f5f2dcdd5$exports)))["spectrum"], (0, (/*@__PURE__*/$parcel$interopDefault($19fbfce217006b12$exports)))["spectrum"], Object.values(theme[colorScheme]), Object.values(theme[scale]), theme.global ? Object.values(theme.global) : null, {
226
- "react-spectrum-provider": (0, $kmRpa$reactspectrumutils.shouldKeepSpectrumClassNames),
227
- spectrum: (0, $kmRpa$reactspectrumutils.shouldKeepSpectrumClassNames),
228
- [themeKey]: (0, $kmRpa$reactspectrumutils.shouldKeepSpectrumClassNames),
229
- [scaleKey]: (0, $kmRpa$reactspectrumutils.shouldKeepSpectrumClassNames)
230
- });
231
- var _props_colorScheme, _ref;
232
- let style = {
233
- ...styleProps.style,
234
- // This ensures that browser native UI like scrollbars are rendered in the right color scheme.
235
- // See https://web.dev/color-scheme/.
236
- colorScheme: (_ref = (_props_colorScheme = props.colorScheme) !== null && _props_colorScheme !== void 0 ? _props_colorScheme : colorScheme) !== null && _ref !== void 0 ? _ref : Object.keys(theme).filter((k)=>k === "light" || k === "dark").join(" ")
237
- };
238
- let hasWarned = (0, $kmRpa$react.useRef)(false);
239
- (0, $kmRpa$react.useEffect)(()=>{
240
- if (direction && domRef.current) {
241
- let closestDir = domRef.current.parentElement.closest("[dir]");
242
- let dir = closestDir && closestDir.getAttribute("dir");
243
- if (dir && dir !== direction && !hasWarned.current) {
244
- console.warn(`Language directions cannot be nested. ${direction} inside ${dir}.`);
245
- hasWarned.current = true;
246
- }
247
- }
248
- }, [
249
- direction,
250
- domRef,
251
- hasWarned
252
- ]);
253
- return /*#__PURE__*/ (0, ($parcel$interopDefault($kmRpa$react))).createElement("div", {
254
- ...(0, $kmRpa$reactariautils.filterDOMProps)(otherProps),
255
- ...styleProps,
256
- ...modalProviderProps,
257
- className: className,
258
- style: style,
259
- lang: locale,
260
- dir: direction,
261
- ref: domRef
262
- }, children);
263
- });
264
- function $96cabdf5b0aed55b$export$693cdb10cec23617() {
265
- return (0, $kmRpa$react.useContext)((0, $a5b4f4e252b5a021$export$841858b892ce1f4c));
266
- }
267
- function $96cabdf5b0aed55b$export$521c373ccc32c300(props) {
268
- let context = $96cabdf5b0aed55b$export$693cdb10cec23617();
269
- if (!context) return props;
270
- return Object.assign({}, {
271
- isQuiet: context.isQuiet,
272
- isEmphasized: context.isEmphasized,
273
- isDisabled: context.isDisabled,
274
- isRequired: context.isRequired,
275
- isReadOnly: context.isReadOnly,
276
- validationState: context.validationState
277
- }, props);
278
- }
279
-
280
22
 
281
23
 
282
24