@react-spectrum/provider 3.6.0 → 3.7.0
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/dist/import.mjs +247 -0
- package/dist/main.js +99 -60
- package/dist/main.js.map +1 -1
- package/dist/module.js +99 -60
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +14 -9
- package/src/Provider.tsx +1 -3
- package/src/context.ts +19 -0
package/dist/import.mjs
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
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} 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";
|
|
8
|
+
|
|
9
|
+
function $parcel$interopDefault(a) {
|
|
10
|
+
return a && a.__esModule ? a.default : a;
|
|
11
|
+
}
|
|
12
|
+
function $parcel$export(e, n, v, s) {
|
|
13
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
14
|
+
}
|
|
15
|
+
/*
|
|
16
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
17
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
18
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
19
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
20
|
+
*
|
|
21
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
22
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
23
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
24
|
+
* governing permissions and limitations under the License.
|
|
25
|
+
*/ /// <reference types="css-module-types" />
|
|
26
|
+
/*
|
|
27
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
28
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
29
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
30
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
31
|
+
*
|
|
32
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
33
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
34
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
35
|
+
* governing permissions and limitations under the License.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/*
|
|
39
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
40
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
41
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
42
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
43
|
+
*
|
|
44
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
45
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
46
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
47
|
+
* governing permissions and limitations under the License.
|
|
48
|
+
*/
|
|
49
|
+
const $a8430f637b4ccbce$export$841858b892ce1f4c = (0, $b6ncI$react).createContext(null);
|
|
50
|
+
$a8430f637b4ccbce$export$841858b892ce1f4c.displayName = "ProviderContext";
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
var $698974e9dd92c2ec$exports = {};
|
|
58
|
+
|
|
59
|
+
$parcel$export($698974e9dd92c2ec$exports, "spectrum", () => $698974e9dd92c2ec$export$3311ab3a441bc141, (v) => $698974e9dd92c2ec$export$3311ab3a441bc141 = v);
|
|
60
|
+
var $698974e9dd92c2ec$export$3311ab3a441bc141;
|
|
61
|
+
$698974e9dd92c2ec$export$3311ab3a441bc141 = "spectrum_b37d53";
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
var $5cac98e4c80e6707$exports = {};
|
|
65
|
+
|
|
66
|
+
$parcel$export($5cac98e4c80e6707$exports, "spectrum", () => $5cac98e4c80e6707$export$3311ab3a441bc141, (v) => $5cac98e4c80e6707$export$3311ab3a441bc141 = v);
|
|
67
|
+
$parcel$export($5cac98e4c80e6707$exports, "spectrum-Body", () => $5cac98e4c80e6707$export$a30bf7810c8453d1, (v) => $5cac98e4c80e6707$export$a30bf7810c8453d1 = v);
|
|
68
|
+
$parcel$export($5cac98e4c80e6707$exports, "spectrum-Body--italic", () => $5cac98e4c80e6707$export$7b2dac1166f6ec4c, (v) => $5cac98e4c80e6707$export$7b2dac1166f6ec4c = v);
|
|
69
|
+
var $5cac98e4c80e6707$export$3311ab3a441bc141;
|
|
70
|
+
var $5cac98e4c80e6707$export$a30bf7810c8453d1;
|
|
71
|
+
var $5cac98e4c80e6707$export$7b2dac1166f6ec4c;
|
|
72
|
+
$5cac98e4c80e6707$export$3311ab3a441bc141 = "spectrum_2a241c";
|
|
73
|
+
$5cac98e4c80e6707$export$a30bf7810c8453d1 = "spectrum-Body_2a241c";
|
|
74
|
+
$5cac98e4c80e6707$export$7b2dac1166f6ec4c = "spectrum-Body--italic_2a241c";
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
/*
|
|
78
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
79
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
80
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
81
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
82
|
+
*
|
|
83
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
84
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
85
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
86
|
+
* governing permissions and limitations under the License.
|
|
87
|
+
*/
|
|
88
|
+
function $d8453c5ae7fac713$export$6343629ee1b29116(theme, defaultColorScheme) {
|
|
89
|
+
let matchesDark = (0, $b6ncI$useMediaQuery)("(prefers-color-scheme: dark)");
|
|
90
|
+
let matchesLight = (0, $b6ncI$useMediaQuery)("(prefers-color-scheme: light)");
|
|
91
|
+
// importance OS > default > omitted
|
|
92
|
+
if (theme.dark && matchesDark) return "dark";
|
|
93
|
+
if (theme.light && matchesLight) return "light";
|
|
94
|
+
if (theme.dark && defaultColorScheme === "dark") return "dark";
|
|
95
|
+
if (theme.light && defaultColorScheme === "light") return "light";
|
|
96
|
+
if (!theme.dark) return "light";
|
|
97
|
+
if (!theme.light) return "dark";
|
|
98
|
+
return "light";
|
|
99
|
+
}
|
|
100
|
+
function $d8453c5ae7fac713$export$a8d2043b2d807f4d(theme) {
|
|
101
|
+
let matchesFine = (0, $b6ncI$useMediaQuery)("(any-pointer: fine)");
|
|
102
|
+
if (matchesFine && theme.medium) return "medium";
|
|
103
|
+
if (theme.large) return "large";
|
|
104
|
+
return "medium";
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
var $7b22e09dddddd7da$exports = {};
|
|
109
|
+
$7b22e09dddddd7da$exports = JSON.parse('{"name":"@react-spectrum/provider","version":"3.6.1","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.6.3","@react-aria/overlays":"^3.12.1","@react-aria/utils":"^3.14.2","@react-spectrum/utils":"^3.8.1","@react-types/provider":"^3.5.5","@react-types/shared":"^3.16.0","@swc/helpers":"^0.4.14","clsx":"^1.1.1"},"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"}}');
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
const $7167f8da3cce35e4$var$DEFAULT_BREAKPOINTS = {
|
|
113
|
+
S: 640,
|
|
114
|
+
M: 768,
|
|
115
|
+
L: 1024,
|
|
116
|
+
XL: 1280,
|
|
117
|
+
XXL: 1536
|
|
118
|
+
};
|
|
119
|
+
function $7167f8da3cce35e4$var$Provider(props, ref) {
|
|
120
|
+
let prevContext = $7167f8da3cce35e4$export$693cdb10cec23617();
|
|
121
|
+
let prevColorScheme = prevContext && prevContext.colorScheme;
|
|
122
|
+
let prevBreakpoints = prevContext && prevContext.breakpoints;
|
|
123
|
+
let { theme: theme = prevContext && prevContext.theme , defaultColorScheme: defaultColorScheme } = props;
|
|
124
|
+
if (!theme) throw new Error("theme not found, the parent provider must have a theme provided");
|
|
125
|
+
// Hooks must always be called.
|
|
126
|
+
let autoColorScheme = (0, $d8453c5ae7fac713$export$6343629ee1b29116)(theme, defaultColorScheme);
|
|
127
|
+
let autoScale = (0, $d8453c5ae7fac713$export$a8d2043b2d807f4d)(theme);
|
|
128
|
+
let { locale: prevLocale } = (0, $b6ncI$useLocale)();
|
|
129
|
+
// if the new theme doesn't support the prevColorScheme, we must resort to the auto
|
|
130
|
+
let usePrevColorScheme = !!theme[prevColorScheme];
|
|
131
|
+
// importance of color scheme props > parent > auto:(OS > default > omitted)
|
|
132
|
+
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 , ...otherProps } = props;
|
|
133
|
+
// select only the props with values so undefined props don't overwrite prevContext values
|
|
134
|
+
let currentProps = {
|
|
135
|
+
version: $7b22e09dddddd7da$exports.version,
|
|
136
|
+
theme: theme,
|
|
137
|
+
breakpoints: breakpoints,
|
|
138
|
+
colorScheme: colorScheme,
|
|
139
|
+
scale: scale,
|
|
140
|
+
isQuiet: isQuiet,
|
|
141
|
+
isEmphasized: isEmphasized,
|
|
142
|
+
isDisabled: isDisabled,
|
|
143
|
+
isRequired: isRequired,
|
|
144
|
+
isReadOnly: isReadOnly,
|
|
145
|
+
validationState: validationState
|
|
146
|
+
};
|
|
147
|
+
let matchedBreakpoints = (0, $b6ncI$useMatchedBreakpoints)(breakpoints);
|
|
148
|
+
let filteredProps = {};
|
|
149
|
+
Object.entries(currentProps).forEach(([key, value])=>value !== undefined && (filteredProps[key] = value));
|
|
150
|
+
// Merge options with parent provider
|
|
151
|
+
let context = Object.assign({}, prevContext, filteredProps);
|
|
152
|
+
// Only wrap in a DOM node if the theme, colorScheme, or scale changed
|
|
153
|
+
let contents = children;
|
|
154
|
+
let domProps = (0, $b6ncI$filterDOMProps)(otherProps);
|
|
155
|
+
let { styleProps: styleProps } = (0, $b6ncI$useStyleProps)(otherProps, undefined, {
|
|
156
|
+
matchedBreakpoints: matchedBreakpoints
|
|
157
|
+
});
|
|
158
|
+
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, {
|
|
159
|
+
...props,
|
|
160
|
+
UNSAFE_style: {
|
|
161
|
+
isolation: !prevContext ? "isolate" : undefined,
|
|
162
|
+
...styleProps.style
|
|
163
|
+
},
|
|
164
|
+
ref: ref
|
|
165
|
+
}, contents);
|
|
166
|
+
return /*#__PURE__*/ (0, $b6ncI$react).createElement((0, $a8430f637b4ccbce$export$841858b892ce1f4c).Provider, {
|
|
167
|
+
value: context
|
|
168
|
+
}, /*#__PURE__*/ (0, $b6ncI$react).createElement((0, $b6ncI$I18nProvider), {
|
|
169
|
+
locale: locale
|
|
170
|
+
}, /*#__PURE__*/ (0, $b6ncI$react).createElement((0, $b6ncI$BreakpointProvider), {
|
|
171
|
+
matchedBreakpoints: matchedBreakpoints
|
|
172
|
+
}, /*#__PURE__*/ (0, $b6ncI$react).createElement((0, $b6ncI$ModalProvider), null, contents))));
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Provider is the container for all React Spectrum applications.
|
|
176
|
+
* It defines the theme, locale, and other application level settings,
|
|
177
|
+
* and can also be used to provide common properties to a group of components.
|
|
178
|
+
*/ let $7167f8da3cce35e4$export$2881499e37b75b9a = /*#__PURE__*/ (0, $b6ncI$react).forwardRef($7167f8da3cce35e4$var$Provider);
|
|
179
|
+
const $7167f8da3cce35e4$var$ProviderWrapper = /*#__PURE__*/ (0, $b6ncI$react).forwardRef(function ProviderWrapper(props, ref) {
|
|
180
|
+
let { children: children , ...otherProps } = props;
|
|
181
|
+
let { locale: locale , direction: direction } = (0, $b6ncI$useLocale)();
|
|
182
|
+
let { theme: theme , colorScheme: colorScheme , scale: scale } = $7167f8da3cce35e4$export$693cdb10cec23617();
|
|
183
|
+
let { modalProviderProps: modalProviderProps } = (0, $b6ncI$useModalProvider)();
|
|
184
|
+
let { styleProps: styleProps } = (0, $b6ncI$useStyleProps)(otherProps);
|
|
185
|
+
let domRef = (0, $b6ncI$useDOMRef)(ref);
|
|
186
|
+
let themeKey = Object.keys(theme[colorScheme])[0];
|
|
187
|
+
let scaleKey = Object.keys(theme[scale])[0];
|
|
188
|
+
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, {
|
|
189
|
+
"react-spectrum-provider": (0, $b6ncI$shouldKeepSpectrumClassNames),
|
|
190
|
+
spectrum: (0, $b6ncI$shouldKeepSpectrumClassNames),
|
|
191
|
+
[themeKey]: (0, $b6ncI$shouldKeepSpectrumClassNames),
|
|
192
|
+
[scaleKey]: (0, $b6ncI$shouldKeepSpectrumClassNames)
|
|
193
|
+
});
|
|
194
|
+
var _props_colorScheme, _ref;
|
|
195
|
+
let style = {
|
|
196
|
+
...styleProps.style,
|
|
197
|
+
// This ensures that browser native UI like scrollbars are rendered in the right color scheme.
|
|
198
|
+
// See https://web.dev/color-scheme/.
|
|
199
|
+
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(" ")
|
|
200
|
+
};
|
|
201
|
+
let hasWarned = (0, $b6ncI$useRef)(false);
|
|
202
|
+
(0, $b6ncI$useEffect)(()=>{
|
|
203
|
+
if (direction && domRef.current) {
|
|
204
|
+
let closestDir = domRef.current.parentElement.closest("[dir]");
|
|
205
|
+
let dir = closestDir && closestDir.getAttribute("dir");
|
|
206
|
+
if (dir && dir !== direction && !hasWarned.current) {
|
|
207
|
+
console.warn(`Language directions cannot be nested. ${direction} inside ${dir}.`);
|
|
208
|
+
hasWarned.current = true;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}, [
|
|
212
|
+
direction,
|
|
213
|
+
domRef,
|
|
214
|
+
hasWarned
|
|
215
|
+
]);
|
|
216
|
+
return /*#__PURE__*/ (0, $b6ncI$react).createElement("div", {
|
|
217
|
+
...(0, $b6ncI$filterDOMProps)(otherProps),
|
|
218
|
+
...styleProps,
|
|
219
|
+
...modalProviderProps,
|
|
220
|
+
className: className,
|
|
221
|
+
style: style,
|
|
222
|
+
lang: locale,
|
|
223
|
+
dir: direction,
|
|
224
|
+
ref: domRef
|
|
225
|
+
}, children);
|
|
226
|
+
});
|
|
227
|
+
function $7167f8da3cce35e4$export$693cdb10cec23617() {
|
|
228
|
+
return (0, $b6ncI$useContext)((0, $a8430f637b4ccbce$export$841858b892ce1f4c));
|
|
229
|
+
}
|
|
230
|
+
function $7167f8da3cce35e4$export$521c373ccc32c300(props) {
|
|
231
|
+
let context = $7167f8da3cce35e4$export$693cdb10cec23617();
|
|
232
|
+
if (!context) return props;
|
|
233
|
+
return Object.assign({}, {
|
|
234
|
+
isQuiet: context.isQuiet,
|
|
235
|
+
isEmphasized: context.isEmphasized,
|
|
236
|
+
isDisabled: context.isDisabled,
|
|
237
|
+
isRequired: context.isRequired,
|
|
238
|
+
isReadOnly: context.isReadOnly,
|
|
239
|
+
validationState: context.validationState
|
|
240
|
+
}, props);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
export {$7167f8da3cce35e4$export$2881499e37b75b9a as Provider, $7167f8da3cce35e4$export$693cdb10cec23617 as useProvider, $7167f8da3cce35e4$export$521c373ccc32c300 as useProviderProps};
|
|
247
|
+
//# sourceMappingURL=module.js.map
|
package/dist/main.js
CHANGED
|
@@ -16,6 +16,42 @@ function $parcel$interopDefault(a) {
|
|
|
16
16
|
$parcel$export(module.exports, "Provider", () => $96cabdf5b0aed55b$export$2881499e37b75b9a);
|
|
17
17
|
$parcel$export(module.exports, "useProvider", () => $96cabdf5b0aed55b$export$693cdb10cec23617);
|
|
18
18
|
$parcel$export(module.exports, "useProviderProps", () => $96cabdf5b0aed55b$export$521c373ccc32c300);
|
|
19
|
+
/*
|
|
20
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
21
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
22
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
23
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
24
|
+
*
|
|
25
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
26
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
27
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
28
|
+
* governing permissions and limitations under the License.
|
|
29
|
+
*/ /// <reference types="css-module-types" />
|
|
30
|
+
/*
|
|
31
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
32
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
33
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
34
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
35
|
+
*
|
|
36
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
37
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
38
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
39
|
+
* governing permissions and limitations under the License.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
/*
|
|
43
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
44
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
45
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
46
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
47
|
+
*
|
|
48
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
49
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
50
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
51
|
+
* governing permissions and limitations under the License.
|
|
52
|
+
*/
|
|
53
|
+
const $a5b4f4e252b5a021$export$841858b892ce1f4c = (0, ($parcel$interopDefault($kmRpa$react))).createContext(null);
|
|
54
|
+
$a5b4f4e252b5a021$export$841858b892ce1f4c.displayName = "ProviderContext";
|
|
19
55
|
|
|
20
56
|
|
|
21
57
|
|
|
@@ -42,33 +78,41 @@ $19fbfce217006b12$export$a30bf7810c8453d1 = "spectrum-Body_2a241c";
|
|
|
42
78
|
$19fbfce217006b12$export$7b2dac1166f6ec4c = "spectrum-Body--italic_2a241c";
|
|
43
79
|
|
|
44
80
|
|
|
45
|
-
|
|
81
|
+
/*
|
|
82
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
83
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
84
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
85
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
86
|
+
*
|
|
87
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
88
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
89
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
90
|
+
* governing permissions and limitations under the License.
|
|
91
|
+
*/
|
|
46
92
|
function $a6e2b5f4621e4690$export$6343629ee1b29116(theme, defaultColorScheme) {
|
|
47
|
-
let matchesDark = $kmRpa$reactspectrumutils.useMediaQuery(
|
|
48
|
-
let matchesLight = $kmRpa$reactspectrumutils.useMediaQuery(
|
|
93
|
+
let matchesDark = (0, $kmRpa$reactspectrumutils.useMediaQuery)("(prefers-color-scheme: dark)");
|
|
94
|
+
let matchesLight = (0, $kmRpa$reactspectrumutils.useMediaQuery)("(prefers-color-scheme: light)");
|
|
49
95
|
// importance OS > default > omitted
|
|
50
|
-
if (theme.dark && matchesDark) return
|
|
51
|
-
if (theme.light && matchesLight) return
|
|
52
|
-
if (theme.dark && defaultColorScheme ===
|
|
53
|
-
if (theme.light && defaultColorScheme ===
|
|
54
|
-
if (!theme.dark) return
|
|
55
|
-
if (!theme.light) return
|
|
56
|
-
return
|
|
96
|
+
if (theme.dark && matchesDark) return "dark";
|
|
97
|
+
if (theme.light && matchesLight) return "light";
|
|
98
|
+
if (theme.dark && defaultColorScheme === "dark") return "dark";
|
|
99
|
+
if (theme.light && defaultColorScheme === "light") return "light";
|
|
100
|
+
if (!theme.dark) return "light";
|
|
101
|
+
if (!theme.light) return "dark";
|
|
102
|
+
return "light";
|
|
57
103
|
}
|
|
58
104
|
function $a6e2b5f4621e4690$export$a8d2043b2d807f4d(theme) {
|
|
59
|
-
let matchesFine = $kmRpa$reactspectrumutils.useMediaQuery(
|
|
60
|
-
if (matchesFine && theme.medium) return
|
|
61
|
-
if (theme.large) return
|
|
62
|
-
return
|
|
105
|
+
let matchesFine = (0, $kmRpa$reactspectrumutils.useMediaQuery)("(any-pointer: fine)");
|
|
106
|
+
if (matchesFine && theme.medium) return "medium";
|
|
107
|
+
if (theme.large) return "large";
|
|
108
|
+
return "medium";
|
|
63
109
|
}
|
|
64
110
|
|
|
65
111
|
|
|
66
112
|
var $4db360e38265184f$exports = {};
|
|
67
|
-
$4db360e38265184f$exports = JSON.parse(
|
|
113
|
+
$4db360e38265184f$exports = JSON.parse('{"name":"@react-spectrum/provider","version":"3.6.1","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.6.3","@react-aria/overlays":"^3.12.1","@react-aria/utils":"^3.14.2","@react-spectrum/utils":"^3.8.1","@react-types/provider":"^3.5.5","@react-types/shared":"^3.16.0","@swc/helpers":"^0.4.14","clsx":"^1.1.1"},"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"}}');
|
|
68
114
|
|
|
69
115
|
|
|
70
|
-
const $96cabdf5b0aed55b$var$Context = /*#__PURE__*/ ($parcel$interopDefault($kmRpa$react)).createContext(null);
|
|
71
|
-
$96cabdf5b0aed55b$var$Context.displayName = 'ProviderContext';
|
|
72
116
|
const $96cabdf5b0aed55b$var$DEFAULT_BREAKPOINTS = {
|
|
73
117
|
S: 640,
|
|
74
118
|
M: 768,
|
|
@@ -81,11 +125,11 @@ function $96cabdf5b0aed55b$var$Provider(props, ref) {
|
|
|
81
125
|
let prevColorScheme = prevContext && prevContext.colorScheme;
|
|
82
126
|
let prevBreakpoints = prevContext && prevContext.breakpoints;
|
|
83
127
|
let { theme: theme = prevContext && prevContext.theme , defaultColorScheme: defaultColorScheme } = props;
|
|
84
|
-
if (!theme) throw new Error(
|
|
128
|
+
if (!theme) throw new Error("theme not found, the parent provider must have a theme provided");
|
|
85
129
|
// Hooks must always be called.
|
|
86
|
-
let autoColorScheme = $a6e2b5f4621e4690$export$6343629ee1b29116(theme, defaultColorScheme);
|
|
87
|
-
let autoScale = $a6e2b5f4621e4690$export$a8d2043b2d807f4d(theme);
|
|
88
|
-
let { locale: prevLocale } = $kmRpa$reactariai18n.useLocale();
|
|
130
|
+
let autoColorScheme = (0, $a6e2b5f4621e4690$export$6343629ee1b29116)(theme, defaultColorScheme);
|
|
131
|
+
let autoScale = (0, $a6e2b5f4621e4690$export$a8d2043b2d807f4d)(theme);
|
|
132
|
+
let { locale: prevLocale } = (0, $kmRpa$reactariai18n.useLocale)();
|
|
89
133
|
// if the new theme doesn't support the prevColorScheme, we must resort to the auto
|
|
90
134
|
let usePrevColorScheme = !!theme[prevColorScheme];
|
|
91
135
|
// importance of color scheme props > parent > auto:(OS > default > omitted)
|
|
@@ -104,69 +148,65 @@ function $96cabdf5b0aed55b$var$Provider(props, ref) {
|
|
|
104
148
|
isReadOnly: isReadOnly,
|
|
105
149
|
validationState: validationState
|
|
106
150
|
};
|
|
107
|
-
let matchedBreakpoints = $kmRpa$reactspectrumutils.useMatchedBreakpoints(breakpoints);
|
|
108
|
-
let filteredProps = {
|
|
109
|
-
|
|
110
|
-
Object.entries(currentProps).forEach(([key, value])=>value !== undefined && (filteredProps[key] = value)
|
|
111
|
-
);
|
|
151
|
+
let matchedBreakpoints = (0, $kmRpa$reactspectrumutils.useMatchedBreakpoints)(breakpoints);
|
|
152
|
+
let filteredProps = {};
|
|
153
|
+
Object.entries(currentProps).forEach(([key, value])=>value !== undefined && (filteredProps[key] = value));
|
|
112
154
|
// Merge options with parent provider
|
|
113
|
-
let context = Object.assign({
|
|
114
|
-
}, prevContext, filteredProps);
|
|
155
|
+
let context = Object.assign({}, prevContext, filteredProps);
|
|
115
156
|
// Only wrap in a DOM node if the theme, colorScheme, or scale changed
|
|
116
157
|
let contents = children;
|
|
117
|
-
let domProps = $kmRpa$reactariautils.filterDOMProps(otherProps);
|
|
118
|
-
let { styleProps: styleProps } = $kmRpa$reactspectrumutils.useStyleProps(otherProps, undefined, {
|
|
158
|
+
let domProps = (0, $kmRpa$reactariautils.filterDOMProps)(otherProps);
|
|
159
|
+
let { styleProps: styleProps } = (0, $kmRpa$reactspectrumutils.useStyleProps)(otherProps, undefined, {
|
|
119
160
|
matchedBreakpoints: matchedBreakpoints
|
|
120
161
|
});
|
|
121
|
-
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__*/ ($parcel$interopDefault($kmRpa$react)).createElement($96cabdf5b0aed55b$var$ProviderWrapper, {
|
|
162
|
+
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, {
|
|
122
163
|
...props,
|
|
123
164
|
UNSAFE_style: {
|
|
124
|
-
isolation: !prevContext ?
|
|
165
|
+
isolation: !prevContext ? "isolate" : undefined,
|
|
125
166
|
...styleProps.style
|
|
126
167
|
},
|
|
127
168
|
ref: ref
|
|
128
169
|
}, contents);
|
|
129
|
-
return
|
|
170
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($kmRpa$react))).createElement((0, $a5b4f4e252b5a021$export$841858b892ce1f4c).Provider, {
|
|
130
171
|
value: context
|
|
131
|
-
}, /*#__PURE__*/ ($parcel$interopDefault($kmRpa$react)).createElement($kmRpa$reactariai18n.I18nProvider, {
|
|
172
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($kmRpa$react))).createElement((0, $kmRpa$reactariai18n.I18nProvider), {
|
|
132
173
|
locale: locale
|
|
133
|
-
}, /*#__PURE__*/ ($parcel$interopDefault($kmRpa$react)).createElement($kmRpa$reactspectrumutils.BreakpointProvider, {
|
|
174
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($kmRpa$react))).createElement((0, $kmRpa$reactspectrumutils.BreakpointProvider), {
|
|
134
175
|
matchedBreakpoints: matchedBreakpoints
|
|
135
|
-
}, /*#__PURE__*/ ($parcel$interopDefault($kmRpa$react)).createElement($kmRpa$reactariaoverlays.ModalProvider, null, contents))))
|
|
176
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($kmRpa$react))).createElement((0, $kmRpa$reactariaoverlays.ModalProvider), null, contents))));
|
|
136
177
|
}
|
|
137
178
|
/**
|
|
138
179
|
* Provider is the container for all React Spectrum applications.
|
|
139
180
|
* It defines the theme, locale, and other application level settings,
|
|
140
181
|
* and can also be used to provide common properties to a group of components.
|
|
141
|
-
*/ let $96cabdf5b0aed55b$export$2881499e37b75b9a = /*#__PURE__*/ ($parcel$interopDefault($kmRpa$react)).forwardRef($96cabdf5b0aed55b$var$Provider);
|
|
142
|
-
const $96cabdf5b0aed55b$var$ProviderWrapper = /*#__PURE__*/ ($parcel$interopDefault($kmRpa$react)).forwardRef(function ProviderWrapper(props, ref) {
|
|
182
|
+
*/ let $96cabdf5b0aed55b$export$2881499e37b75b9a = /*#__PURE__*/ (0, ($parcel$interopDefault($kmRpa$react))).forwardRef($96cabdf5b0aed55b$var$Provider);
|
|
183
|
+
const $96cabdf5b0aed55b$var$ProviderWrapper = /*#__PURE__*/ (0, ($parcel$interopDefault($kmRpa$react))).forwardRef(function ProviderWrapper(props, ref) {
|
|
143
184
|
let { children: children , ...otherProps } = props;
|
|
144
|
-
let { locale: locale , direction: direction } = $kmRpa$reactariai18n.useLocale();
|
|
185
|
+
let { locale: locale , direction: direction } = (0, $kmRpa$reactariai18n.useLocale)();
|
|
145
186
|
let { theme: theme , colorScheme: colorScheme , scale: scale } = $96cabdf5b0aed55b$export$693cdb10cec23617();
|
|
146
|
-
let { modalProviderProps: modalProviderProps } = $kmRpa$reactariaoverlays.useModalProvider();
|
|
147
|
-
let { styleProps: styleProps } = $kmRpa$reactspectrumutils.useStyleProps(otherProps);
|
|
148
|
-
let domRef = $kmRpa$reactspectrumutils.useDOMRef(ref);
|
|
187
|
+
let { modalProviderProps: modalProviderProps } = (0, $kmRpa$reactariaoverlays.useModalProvider)();
|
|
188
|
+
let { styleProps: styleProps } = (0, $kmRpa$reactspectrumutils.useStyleProps)(otherProps);
|
|
189
|
+
let domRef = (0, $kmRpa$reactspectrumutils.useDOMRef)(ref);
|
|
149
190
|
let themeKey = Object.keys(theme[colorScheme])[0];
|
|
150
191
|
let scaleKey = Object.keys(theme[scale])[0];
|
|
151
|
-
let className = ($parcel$interopDefault($kmRpa$clsx))(styleProps.className, (/*@__PURE__*/$parcel$interopDefault($22365f0f5f2dcdd5$exports))[
|
|
152
|
-
|
|
153
|
-
spectrum: $kmRpa$reactspectrumutils.shouldKeepSpectrumClassNames,
|
|
154
|
-
[themeKey]: $kmRpa$reactspectrumutils.shouldKeepSpectrumClassNames,
|
|
155
|
-
[scaleKey]: $kmRpa$reactspectrumutils.shouldKeepSpectrumClassNames
|
|
192
|
+
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, {
|
|
193
|
+
"react-spectrum-provider": (0, $kmRpa$reactspectrumutils.shouldKeepSpectrumClassNames),
|
|
194
|
+
spectrum: (0, $kmRpa$reactspectrumutils.shouldKeepSpectrumClassNames),
|
|
195
|
+
[themeKey]: (0, $kmRpa$reactspectrumutils.shouldKeepSpectrumClassNames),
|
|
196
|
+
[scaleKey]: (0, $kmRpa$reactspectrumutils.shouldKeepSpectrumClassNames)
|
|
156
197
|
});
|
|
157
|
-
var
|
|
198
|
+
var _props_colorScheme, _ref;
|
|
158
199
|
let style = {
|
|
159
200
|
...styleProps.style,
|
|
160
201
|
// This ensures that browser native UI like scrollbars are rendered in the right color scheme.
|
|
161
202
|
// See https://web.dev/color-scheme/.
|
|
162
|
-
colorScheme: (
|
|
163
|
-
).join(' ')
|
|
203
|
+
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(" ")
|
|
164
204
|
};
|
|
165
|
-
let hasWarned = $kmRpa$react.useRef(false);
|
|
166
|
-
$kmRpa$react.useEffect(()=>{
|
|
205
|
+
let hasWarned = (0, $kmRpa$react.useRef)(false);
|
|
206
|
+
(0, $kmRpa$react.useEffect)(()=>{
|
|
167
207
|
if (direction && domRef.current) {
|
|
168
|
-
let closestDir = domRef.current.parentElement.closest(
|
|
169
|
-
let dir = closestDir && closestDir.getAttribute(
|
|
208
|
+
let closestDir = domRef.current.parentElement.closest("[dir]");
|
|
209
|
+
let dir = closestDir && closestDir.getAttribute("dir");
|
|
170
210
|
if (dir && dir !== direction && !hasWarned.current) {
|
|
171
211
|
console.warn(`Language directions cannot be nested. ${direction} inside ${dir}.`);
|
|
172
212
|
hasWarned.current = true;
|
|
@@ -177,8 +217,8 @@ const $96cabdf5b0aed55b$var$ProviderWrapper = /*#__PURE__*/ ($parcel$interopDefa
|
|
|
177
217
|
domRef,
|
|
178
218
|
hasWarned
|
|
179
219
|
]);
|
|
180
|
-
return
|
|
181
|
-
|
|
220
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($kmRpa$react))).createElement("div", {
|
|
221
|
+
...(0, $kmRpa$reactariautils.filterDOMProps)(otherProps),
|
|
182
222
|
...styleProps,
|
|
183
223
|
...modalProviderProps,
|
|
184
224
|
className: className,
|
|
@@ -186,16 +226,15 @@ const $96cabdf5b0aed55b$var$ProviderWrapper = /*#__PURE__*/ ($parcel$interopDefa
|
|
|
186
226
|
lang: locale,
|
|
187
227
|
dir: direction,
|
|
188
228
|
ref: domRef
|
|
189
|
-
}, children)
|
|
229
|
+
}, children);
|
|
190
230
|
});
|
|
191
231
|
function $96cabdf5b0aed55b$export$693cdb10cec23617() {
|
|
192
|
-
return $kmRpa$react.useContext($
|
|
232
|
+
return (0, $kmRpa$react.useContext)((0, $a5b4f4e252b5a021$export$841858b892ce1f4c));
|
|
193
233
|
}
|
|
194
234
|
function $96cabdf5b0aed55b$export$521c373ccc32c300(props) {
|
|
195
235
|
let context = $96cabdf5b0aed55b$export$693cdb10cec23617();
|
|
196
236
|
if (!context) return props;
|
|
197
|
-
return Object.assign({
|
|
198
|
-
}, {
|
|
237
|
+
return Object.assign({}, {
|
|
199
238
|
isQuiet: context.isQuiet,
|
|
200
239
|
isEmphasized: context.isEmphasized,
|
|
201
240
|
isDisabled: context.isDisabled,
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AEAA,GAA0B;AAA1B,yCAA0B,GAAG,CAAiB;;;;;;;;ACA9C,GAA0B;AAC1B,GAA+B;AAC/B,GAAuC;AAFvC,yCAA0B,GAAG,CAAiB;AAC9C,yCAA+B,GAAG,CAAsB;AACxD,yCAAuC,GAAG,CAA8B;;;;SCcxD,yCAAc,CAAC,KAAY,EAAE,kBAA+B,EAAe,CAAC;IAC1F,GAAG,CAAC,WAAW,GAAG,uCAAa,CAAC,CAA8B;IAC9D,GAAG,CAAC,YAAY,GAAG,uCAAa,CAAC,CAA+B;IAEhE,EAAoC,AAApC,kCAAoC;IAEpC,EAAE,EAAE,KAAK,CAAC,IAAI,IAAI,WAAW,EAC3B,MAAM,CAAC,CAAM;IAGf,EAAE,EAAE,KAAK,CAAC,KAAK,IAAI,YAAY,EAC7B,MAAM,CAAC,CAAO;IAGhB,EAAE,EAAE,KAAK,CAAC,IAAI,IAAI,kBAAkB,KAAK,CAAM,OAC7C,MAAM,CAAC,CAAM;IAGf,EAAE,EAAE,KAAK,CAAC,KAAK,IAAI,kBAAkB,KAAK,CAAO,QAC/C,MAAM,CAAC,CAAO;IAGhB,EAAE,GAAG,KAAK,CAAC,IAAI,EACb,MAAM,CAAC,CAAO;IAGhB,EAAE,GAAG,KAAK,CAAC,KAAK,EACd,MAAM,CAAC,CAAM;IAGf,MAAM,CAAC,CAAO;AAChB,CAAC;SAEe,yCAAQ,CAAC,KAAY,EAAS,CAAC;IAC7C,GAAG,CAAC,WAAW,GAAG,uCAAa,CA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-spectrum/provider/src/Provider.tsx","packages/@adobe/spectrum-css-temp/components/page/vars.css","packages/@adobe/spectrum-css-temp/components/typography/index.css","packages/@react-spectrum/provider/src/mediaQueries.ts","packages/@react-spectrum/provider/package.json"],"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\n/// <reference types=\"css-module-types\" />\n\nexport {Provider, useProvider, useProviderProps} from './Provider';\nexport type {ProviderContext} from '@react-types/provider';\nexport type {ProviderProps} from '@react-types/provider';\n","/*\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 {\n BreakpointProvider,\n shouldKeepSpectrumClassNames,\n useDOMRef,\n useMatchedBreakpoints,\n useStyleProps\n} from '@react-spectrum/utils';\nimport clsx from 'clsx';\nimport {DOMRef} from '@react-types/shared';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {I18nProvider, useLocale} from '@react-aria/i18n';\nimport {ModalProvider, useModalProvider} from '@react-aria/overlays';\nimport {ProviderContext, ProviderProps} from '@react-types/provider';\nimport React, {useContext, useEffect, useRef} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/page/vars.css';\nimport typographyStyles from '@adobe/spectrum-css-temp/components/typography/index.css';\nimport {useColorScheme, useScale} from './mediaQueries';\n// @ts-ignore\nimport {version} from '../package.json';\n\nconst Context = React.createContext<ProviderContext | null>(null);\nContext.displayName = 'ProviderContext';\n\nconst DEFAULT_BREAKPOINTS = {S: 640, M: 768, L: 1024, XL: 1280, XXL: 1536};\n\nfunction Provider(props: ProviderProps, ref: DOMRef<HTMLDivElement>) {\n let prevContext = useProvider();\n let prevColorScheme = prevContext && prevContext.colorScheme;\n let prevBreakpoints = prevContext && prevContext.breakpoints;\n let {\n theme = prevContext && prevContext.theme,\n defaultColorScheme\n } = props;\n if (!theme) {\n throw new Error('theme not found, the parent provider must have a theme provided');\n }\n // Hooks must always be called.\n let autoColorScheme = useColorScheme(theme, defaultColorScheme);\n let autoScale = useScale(theme);\n let {locale: prevLocale} = useLocale();\n // if the new theme doesn't support the prevColorScheme, we must resort to the auto\n let usePrevColorScheme = !!theme[prevColorScheme];\n\n // importance of color scheme props > parent > auto:(OS > default > omitted)\n let {\n colorScheme = usePrevColorScheme ? prevColorScheme : autoColorScheme,\n scale = prevContext ? prevContext.scale : autoScale,\n locale = prevContext ? prevLocale : null,\n breakpoints = prevContext ? prevBreakpoints : DEFAULT_BREAKPOINTS,\n children,\n isQuiet,\n isEmphasized,\n isDisabled,\n isRequired,\n isReadOnly,\n validationState,\n ...otherProps\n } = props;\n\n // select only the props with values so undefined props don't overwrite prevContext values\n let currentProps = {\n version,\n theme,\n breakpoints,\n colorScheme,\n scale,\n isQuiet,\n isEmphasized,\n isDisabled,\n isRequired,\n isReadOnly,\n validationState\n };\n\n let matchedBreakpoints = useMatchedBreakpoints(breakpoints);\n let filteredProps = {};\n Object.entries(currentProps).forEach(([key, value]) => value !== undefined && (filteredProps[key] = value));\n\n // Merge options with parent provider\n let context = Object.assign({}, prevContext, filteredProps);\n\n // Only wrap in a DOM node if the theme, colorScheme, or scale changed\n let contents = children;\n let domProps = filterDOMProps(otherProps);\n let {styleProps} = useStyleProps(otherProps, undefined, {matchedBreakpoints});\n 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) {\n contents = (\n <ProviderWrapper {...props} UNSAFE_style={{isolation: !prevContext ? 'isolate' : undefined, ...styleProps.style}} ref={ref}>\n {contents}\n </ProviderWrapper>\n );\n }\n\n return (\n <Context.Provider value={context}>\n <I18nProvider locale={locale}>\n <BreakpointProvider matchedBreakpoints={matchedBreakpoints}>\n <ModalProvider>\n {contents}\n </ModalProvider>\n </BreakpointProvider>\n </I18nProvider>\n </Context.Provider>\n );\n}\n\n/**\n * Provider is the container for all React Spectrum applications.\n * It defines the theme, locale, and other application level settings,\n * and can also be used to provide common properties to a group of components.\n */\nlet _Provider = React.forwardRef(Provider);\nexport {_Provider as Provider};\n\nconst ProviderWrapper = React.forwardRef(function ProviderWrapper(props: ProviderProps, ref: DOMRef<HTMLDivElement>) {\n let {\n children,\n ...otherProps\n } = props;\n let {locale, direction} = useLocale();\n let {theme, colorScheme, scale} = useProvider();\n let {modalProviderProps} = useModalProvider();\n let {styleProps} = useStyleProps(otherProps);\n let domRef = useDOMRef(ref);\n\n let themeKey = Object.keys(theme[colorScheme])[0];\n let scaleKey = Object.keys(theme[scale])[0];\n\n let className = clsx(\n styleProps.className,\n styles['spectrum'],\n typographyStyles['spectrum'],\n Object.values(theme[colorScheme]),\n Object.values(theme[scale]),\n theme.global ? Object.values(theme.global) : null,\n {\n 'react-spectrum-provider': shouldKeepSpectrumClassNames,\n spectrum: shouldKeepSpectrumClassNames,\n [themeKey]: shouldKeepSpectrumClassNames,\n [scaleKey]: shouldKeepSpectrumClassNames\n }\n );\n\n let style = {\n ...styleProps.style,\n // This ensures that browser native UI like scrollbars are rendered in the right color scheme.\n // See https://web.dev/color-scheme/.\n colorScheme: props.colorScheme ?? colorScheme ?? Object.keys(theme).filter(k => k === 'light' || k === 'dark').join(' ')\n };\n\n let hasWarned = useRef(false);\n useEffect(() => {\n if (direction && domRef.current) {\n let closestDir = domRef.current.parentElement.closest('[dir]');\n let dir = closestDir && closestDir.getAttribute('dir');\n if (dir && dir !== direction && !hasWarned.current) {\n console.warn(`Language directions cannot be nested. ${direction} inside ${dir}.`);\n hasWarned.current = true;\n }\n }\n }, [direction, domRef, hasWarned]);\n\n\n return (\n <div\n {...filterDOMProps(otherProps)}\n {...styleProps}\n {...modalProviderProps}\n className={className}\n style={style}\n lang={locale}\n dir={direction}\n ref={domRef}>\n {children}\n </div>\n );\n});\n\n/**\n * Returns the various settings and styles applied by the nearest parent Provider.\n * Properties explicitly set by the nearest parent Provider override those provided by preceeding Providers.\n */\nexport function useProvider(): ProviderContext {\n return useContext(Context);\n}\n\nexport function useProviderProps<T>(props: T) : T {\n let context = useProvider();\n if (!context) {\n return props;\n }\n return Object.assign({}, {\n isQuiet: context.isQuiet,\n isEmphasized: context.isEmphasized,\n isDisabled: context.isDisabled,\n isRequired: context.isRequired,\n isReadOnly: context.isReadOnly,\n validationState: context.validationState\n }, props);\n}\n","/*\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\n@import './index.css';\n@import './skin.css';\n","/*\nCopyright 2019 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\n@import '../commons/index.css';\n@import 'font.css';\n\n/*@mixin typography .spectrum-Body1 {}\n@mixin typography .spectrum-Body2 {}\n@mixin typography .spectrum-Body3 {}\n@mixin typography .spectrum-Body4 {}\n@mixin typography .spectrum-Body5 {}\n@mixin typography .spectrum-Heading1 {}\n@mixin typography .spectrum-Heading2 {}\n@mixin typography .spectrum-Heading3 {}\n@mixin typography .spectrum-Heading4 {}\n@mixin typography .spectrum-Heading5 {}\n@mixin typography .spectrum-Heading6 {}\n@mixin typography .spectrum-Subheading {}\n@mixin typography .spectrum-Detail {}\n@mixin typography .spectrum-Heading1--quiet, heading-quiet-1 {}\n@mixin typography .spectrum-Heading2--quiet, heading-quiet-2 {}\n@mixin typography .spectrum-Heading1--strong, heading-strong-1 {}\n@mixin typography .spectrum-Heading2--strong, heading-strong-2 {}\n@mixin typography .spectrum-Heading1--display, display-1 {}\n@mixin typography .spectrum-Heading2--display, display-2 {}\n@mixin typography .spectrum-Heading1--display.spectrum-Heading1--strong, display-strong-1 {}\n@mixin typography .spectrum-Heading2--display.spectrum-Heading2--strong, display-strong-2 {}\n@mixin typography .spectrum-Heading1--display.spectrum-Heading1--quiet, display-quiet-1 {}\n@mixin typography .spectrum-Heading2--display.spectrum-Heading2--quiet, display-quiet-2 {}\n\n.spectrum-Typography {\n @mixin typographyMargins .spectrum-Body1 {}\n @mixin typographyMargins .spectrum-Body2 {}\n @mixin typographyMargins .spectrum-Body3 {}\n @mixin typographyMargins .spectrum-Body4 {}\n @mixin typographyMargins .spectrum-Body5 {}\n @mixin typographyMargins .spectrum-Heading1 {}\n @mixin typographyMargins .spectrum-Heading2 {}\n @mixin typographyMargins .spectrum-Heading3 {}\n @mixin typographyMargins .spectrum-Heading4 {}\n @mixin typographyMargins .spectrum-Heading5 {}\n @mixin typographyMargins .spectrum-Heading6 {}\n @mixin typographyMargins .spectrum-Subheading {}\n @mixin typographyMargins .spectrum-Detail {}\n @mixin typographyMargins .spectrum-Heading1--quiet, heading-quiet-1 {}\n @mixin typographyMargins .spectrum-Heading2--quiet, heading-quiet-2 {}\n @mixin typographyMargins .spectrum-Heading1--strong, heading-strong-1 {}\n @mixin typographyMargins .spectrum-Heading2--strong, heading-strong-2 {}\n @mixin typographyMargins .spectrum-Heading1--display, display-1 {}\n @mixin typographyMargins .spectrum-Heading2--display, display-2 {}\n @mixin typographyMargins .spectrum-Heading1--display.spectrum-Heading1--strong, display-strong-1 {}\n @mixin typographyMargins .spectrum-Heading2--display.spectrum-Heading2--strong, display-strong-2 {}\n @mixin typographyMargins .spectrum-Heading1--display.spectrum-Heading1--quiet, display-quiet-1 {}\n @mixin typographyMargins .spectrum-Heading2--display.spectrum-Heading2--quiet, display-quiet-2 {}\n}\n\n.spectrum-Article {\n font-family: var(--spectrum-body-article-1-text-font-family);\n @mixin typography .spectrum-Body1, body-article-1 {}\n @mixin typography .spectrum-Body2, body-article-2 {}\n @mixin typography .spectrum-Body3, body-article-3 {}\n @mixin typography .spectrum-Body4, body-article-4 {}\n @mixin typography .spectrum-Body5, body-article-5 {}\n @mixin typography .spectrum-Heading1, heading-article-1 {}\n @mixin typography .spectrum-Heading2, heading-article-2 {}\n @mixin typography .spectrum-Heading3, heading-article-3 {}\n @mixin typography .spectrum-Heading4, heading-article-4 {}\n @mixin typography .spectrum-Heading5, heading-article-5 {}\n @mixin typography .spectrum-Heading6, heading-article-6 {}\n @mixin typography .spectrum-Subheading, subheading-article {}\n @mixin typography .spectrum-Detail, detail-article {}\n @mixin typography .spectrum-Heading1--quiet, heading-quiet-article-1 {}\n @mixin typography .spectrum-Heading2--quiet, heading-quiet-article-2 {}\n @mixin typography .spectrum-Heading1--display, display-article-1 {}\n @mixin typography .spectrum-Heading2--display, display-article-2 {}\n @mixin typography .spectrum-Heading1--display.spectrum-Heading1--quiet, display-quiet-article-1 {}\n @mixin typography .spectrum-Heading2--display.spectrum-Heading2--quiet, display-quiet-article-2 {}\n}\n.spectrum {\n &:lang(ja),\n &:lang(ko),\n &:lang(zh) {\n @mixin typography .spectrum-Body1, body-han-1 {}\n @mixin typography .spectrum-Body2, body-han-2 {}\n @mixin typography .spectrum-Body3, body-han-3 {}\n @mixin typography .spectrum-Body4, body-han-4 {}\n @mixin typography .spectrum-Body5, body-han-5 {}\n @mixin typography .spectrum-Heading1, heading-han-1 {}\n @mixin typography .spectrum-Heading2, heading-han-2 {}\n @mixin typography .spectrum-Heading3, heading-han-3 {}\n @mixin typography .spectrum-Heading4, heading-han-4 {}\n @mixin typography .spectrum-Heading5, heading-han-5 {}\n @mixin typography .spectrum-Heading6, heading-han-6 {}\n @mixin typography .spectrum-Subheading, subheading-han {}\n @mixin typography .spectrum-Detail, detail-han {}\n @mixin typography .spectrum-Heading1--quiet, heading-quiet-han-1 {}\n @mixin typography .spectrum-Heading2--quiet, heading-quiet-han-2 {}\n @mixin typography .spectrum-Heading1--strong, heading-strong-han-1 {}\n @mixin typography .spectrum-Heading2--strong, heading-strong-han-2 {}\n @mixin typography .spectrum-Heading1--display, display-han-1 {}\n @mixin typography .spectrum-Heading2--display, display-han-2 {}\n @mixin typography .spectrum-Heading1--display.spectrum-Heading1--strong, display-strong-han-1 {}\n @mixin typography .spectrum-Heading2--display.spectrum-Heading2--strong, display-strong-han-2 {}\n @mixin typography .spectrum-Heading1--display.spectrum-Heading1--quiet, display-quiet-han-1 {}\n @mixin typography .spectrum-Heading2--display.spectrum-Heading2--quiet, display-quiet-han-2 {}\n }\n}\n@mixin typography .spectrum-Code1, body-code-1, true {\n font-family: var(--spectrum-body-code-1-text-font-family);\n}\n@mixin typography .spectrum-Code2, body-code-2, true {\n font-family: var(--spectrum-body-code-2-text-font-family);\n}\n@mixin typography .spectrum-Code3, body-code-3, true {\n font-family: var(--spectrum-body-code-3-text-font-family);\n}\n@mixin typography .spectrum-Code4, body-code-4, true {\n font-family: var(--spectrum-body-code-4-text-font-family);\n}\n@mixin typography .spectrum-Code5, body-code-5, true {\n font-family: var(--spectrum-body-code-5-text-font-family);\n}*/\n\n/*\n The &.spectrum makes it so users can do <div class=\"spectrum spectrum--large\"> and still get the right font sizes\n Without this, they would have to do <div class=\"spectrum--large\"><div class=\"spectrum\">, which makes no sense\n*/\n&.spectrum,\n&.spectrum-Body,\n.spectrum,\n.spectrum-Body {\n font-size: var(--spectrum-body-4-text-size);\n font-weight: var(--spectrum-body-4-text-font-weight);\n line-height: var(--spectrum-body-4-text-line-height);\n font-style: var(--spectrum-body-4-text-font-style);\n}\n\n.spectrum-Body--italic {\n font-style: var(--spectrum-body-4-emphasis-text-font-style);\n}\n\n/*\n.spectrum-Body--large {\n @extend .spectrum-Body2;\n}\n\n.spectrum-Body--small {\n @extend .spectrum-Body5;\n}\n\n.spectrum-Body--secondary {\n @extend .spectrum-Body4;\n}\n\n.spectrum-Heading--display {\n @extend .spectrum-Heading2--display.spectrum-Heading2--quiet;\n}\n\n.spectrum-Heading--pageTitle {\n @extend .spectrum-Heading2--quiet;\n}\n\n.spectrum-Heading--subtitle1 {\n @extend .spectrum-Heading4;\n}\n\n.spectrum-Heading--subtitle2 {\n @extend .spectrum-Heading6;\n}\n\n.spectrum-Heading--subtitle3 {\n @extend .spectrum-Subheading;\n}*/\n","/*\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 {ColorScheme, Scale} from '@react-types/provider';\nimport {Theme} from '@react-types/provider';\nimport {useMediaQuery} from '@react-spectrum/utils';\n\nexport function useColorScheme(theme: Theme, defaultColorScheme: ColorScheme): ColorScheme {\n let matchesDark = useMediaQuery('(prefers-color-scheme: dark)');\n let matchesLight = useMediaQuery('(prefers-color-scheme: light)');\n\n // importance OS > default > omitted\n\n if (theme.dark && matchesDark) {\n return 'dark';\n }\n\n if (theme.light && matchesLight) {\n return 'light';\n }\n\n if (theme.dark && defaultColorScheme === 'dark') {\n return 'dark';\n }\n\n if (theme.light && defaultColorScheme === 'light') {\n return 'light';\n }\n\n if (!theme.dark) {\n return 'light';\n }\n\n if (!theme.light) {\n return 'dark';\n }\n\n return 'light';\n}\n\nexport function useScale(theme: Theme): Scale {\n let matchesFine = useMediaQuery('(any-pointer: fine)');\n if (matchesFine && theme.medium) {\n return 'medium';\n }\n\n if (theme.large) {\n return 'large';\n }\n\n return 'medium';\n}\n","{\n \"name\": \"@react-spectrum/provider\",\n \"version\": \"3.6.0\",\n \"description\": \"Spectrum UI components in React\",\n \"license\": \"Apache-2.0\",\n \"main\": \"dist/main.js\",\n \"module\": \"dist/module.js\",\n \"types\": \"dist/types.d.ts\",\n \"source\": \"src/index.ts\",\n \"files\": [\n \"dist\",\n \"src\"\n ],\n \"sideEffects\": [\n \"*.css\"\n ],\n \"targets\": {\n \"main\": {\n \"includeNodeModules\": [\n \"@adobe/spectrum-css-temp\"\n ]\n },\n \"module\": {\n \"includeNodeModules\": [\n \"@adobe/spectrum-css-temp\"\n ]\n }\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/adobe/react-spectrum\"\n },\n \"dependencies\": {\n \"@babel/runtime\": \"^7.6.2\",\n \"@react-aria/i18n\": \"^3.6.2\",\n \"@react-aria/overlays\": \"^3.12.0\",\n \"@react-aria/utils\": \"^3.14.1\",\n \"@react-spectrum/utils\": \"^3.8.0\",\n \"@react-types/provider\": \"^3.5.5\",\n \"@react-types/shared\": \"^3.16.0\",\n \"clsx\": \"^1.1.1\"\n },\n \"devDependencies\": {\n \"@adobe/spectrum-css-temp\": \"3.0.0-alpha.1\"\n },\n \"peerDependencies\": {\n \"react\": \"^16.8.0 || ^17.0.0-rc.1 || ^18.0.0\",\n \"react-dom\": \"^16.8.0 || ^17.0.0-rc.1 || ^18.0.0\"\n },\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AC1B,CAAC;QACH,CAAC;IACH,GAAG;QAAC;QAAW;QAAQ;KAAU;IAGjC,qBACE,0DAAC;QACE,GAAG,CAAA,GAAA,oCAAc,AAAD,EAAE,WAAW;QAC7B,GAAG,UAAU;QACb,GAAG,kBAAkB;QACtB,WAAW;QACX,OAAO;QACP,MAAM;QACN,KAAK;QACL,KAAK;OACJ;AAGP;AAMO,SAAS,4CAA+B;IAC7C,OAAO,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,yCAAO,AAAD;AAC1B;AAEO,SAAS,0CAAoB,KAAQ,EAAM;IAChD,IAAI,UAAU;IACd,IAAI,CAAC,SACH,OAAO;IAET,OAAO,OAAO,MAAM,CAAC,CAAC,GAAG;QACvB,SAAS,QAAQ,OAAO;QACxB,cAAc,QAAQ,YAAY;QAClC,YAAY,QAAQ,UAAU;QAC9B,YAAY,QAAQ,UAAU;QAC9B,YAAY,QAAQ,UAAU;QAC9B,iBAAiB,QAAQ,eAAe;IAC1C,GAAG;AACL;;ADnMA","sources":["packages/@react-spectrum/provider/src/index.ts","packages/@react-spectrum/provider/src/Provider.tsx","packages/@react-spectrum/provider/src/context.ts","packages/@adobe/spectrum-css-temp/components/page/vars.css","packages/@adobe/spectrum-css-temp/components/typography/index.css","packages/@react-spectrum/provider/src/mediaQueries.ts","packages/@react-spectrum/provider/package.json"],"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\n/// <reference types=\"css-module-types\" />\n\nexport {Provider, useProvider, useProviderProps} from './Provider';\nexport type {ProviderContext} from '@react-types/provider';\nexport type {ProviderProps} from '@react-types/provider';\n","/*\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 {\n BreakpointProvider,\n shouldKeepSpectrumClassNames,\n useDOMRef,\n useMatchedBreakpoints,\n useStyleProps\n} from '@react-spectrum/utils';\nimport clsx from 'clsx';\nimport {Context} from './context';\nimport {DOMRef} from '@react-types/shared';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {I18nProvider, useLocale} from '@react-aria/i18n';\nimport {ModalProvider, useModalProvider} from '@react-aria/overlays';\nimport {ProviderContext, ProviderProps} from '@react-types/provider';\nimport React, {useContext, useEffect, useRef} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/page/vars.css';\nimport typographyStyles from '@adobe/spectrum-css-temp/components/typography/index.css';\nimport {useColorScheme, useScale} from './mediaQueries';\n// @ts-ignore\nimport {version} from '../package.json';\n\nconst DEFAULT_BREAKPOINTS = {S: 640, M: 768, L: 1024, XL: 1280, XXL: 1536};\n\nfunction Provider(props: ProviderProps, ref: DOMRef<HTMLDivElement>) {\n let prevContext = useProvider();\n let prevColorScheme = prevContext && prevContext.colorScheme;\n let prevBreakpoints = prevContext && prevContext.breakpoints;\n let {\n theme = prevContext && prevContext.theme,\n defaultColorScheme\n } = props;\n if (!theme) {\n throw new Error('theme not found, the parent provider must have a theme provided');\n }\n // Hooks must always be called.\n let autoColorScheme = useColorScheme(theme, defaultColorScheme);\n let autoScale = useScale(theme);\n let {locale: prevLocale} = useLocale();\n // if the new theme doesn't support the prevColorScheme, we must resort to the auto\n let usePrevColorScheme = !!theme[prevColorScheme];\n\n // importance of color scheme props > parent > auto:(OS > default > omitted)\n let {\n colorScheme = usePrevColorScheme ? prevColorScheme : autoColorScheme,\n scale = prevContext ? prevContext.scale : autoScale,\n locale = prevContext ? prevLocale : null,\n breakpoints = prevContext ? prevBreakpoints : DEFAULT_BREAKPOINTS,\n children,\n isQuiet,\n isEmphasized,\n isDisabled,\n isRequired,\n isReadOnly,\n validationState,\n ...otherProps\n } = props;\n\n // select only the props with values so undefined props don't overwrite prevContext values\n let currentProps = {\n version,\n theme,\n breakpoints,\n colorScheme,\n scale,\n isQuiet,\n isEmphasized,\n isDisabled,\n isRequired,\n isReadOnly,\n validationState\n };\n\n let matchedBreakpoints = useMatchedBreakpoints(breakpoints);\n let filteredProps = {};\n Object.entries(currentProps).forEach(([key, value]) => value !== undefined && (filteredProps[key] = value));\n\n // Merge options with parent provider\n let context = Object.assign({}, prevContext, filteredProps);\n\n // Only wrap in a DOM node if the theme, colorScheme, or scale changed\n let contents = children;\n let domProps = filterDOMProps(otherProps);\n let {styleProps} = useStyleProps(otherProps, undefined, {matchedBreakpoints});\n 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) {\n contents = (\n <ProviderWrapper {...props} UNSAFE_style={{isolation: !prevContext ? 'isolate' : undefined, ...styleProps.style}} ref={ref}>\n {contents}\n </ProviderWrapper>\n );\n }\n\n return (\n <Context.Provider value={context}>\n <I18nProvider locale={locale}>\n <BreakpointProvider matchedBreakpoints={matchedBreakpoints}>\n <ModalProvider>\n {contents}\n </ModalProvider>\n </BreakpointProvider>\n </I18nProvider>\n </Context.Provider>\n );\n}\n\n/**\n * Provider is the container for all React Spectrum applications.\n * It defines the theme, locale, and other application level settings,\n * and can also be used to provide common properties to a group of components.\n */\nlet _Provider = React.forwardRef(Provider);\nexport {_Provider as Provider};\n\nconst ProviderWrapper = React.forwardRef(function ProviderWrapper(props: ProviderProps, ref: DOMRef<HTMLDivElement>) {\n let {\n children,\n ...otherProps\n } = props;\n let {locale, direction} = useLocale();\n let {theme, colorScheme, scale} = useProvider();\n let {modalProviderProps} = useModalProvider();\n let {styleProps} = useStyleProps(otherProps);\n let domRef = useDOMRef(ref);\n\n let themeKey = Object.keys(theme[colorScheme])[0];\n let scaleKey = Object.keys(theme[scale])[0];\n\n let className = clsx(\n styleProps.className,\n styles['spectrum'],\n typographyStyles['spectrum'],\n Object.values(theme[colorScheme]),\n Object.values(theme[scale]),\n theme.global ? Object.values(theme.global) : null,\n {\n 'react-spectrum-provider': shouldKeepSpectrumClassNames,\n spectrum: shouldKeepSpectrumClassNames,\n [themeKey]: shouldKeepSpectrumClassNames,\n [scaleKey]: shouldKeepSpectrumClassNames\n }\n );\n\n let style = {\n ...styleProps.style,\n // This ensures that browser native UI like scrollbars are rendered in the right color scheme.\n // See https://web.dev/color-scheme/.\n colorScheme: props.colorScheme ?? colorScheme ?? Object.keys(theme).filter(k => k === 'light' || k === 'dark').join(' ')\n };\n\n let hasWarned = useRef(false);\n useEffect(() => {\n if (direction && domRef.current) {\n let closestDir = domRef.current.parentElement.closest('[dir]');\n let dir = closestDir && closestDir.getAttribute('dir');\n if (dir && dir !== direction && !hasWarned.current) {\n console.warn(`Language directions cannot be nested. ${direction} inside ${dir}.`);\n hasWarned.current = true;\n }\n }\n }, [direction, domRef, hasWarned]);\n\n\n return (\n <div\n {...filterDOMProps(otherProps)}\n {...styleProps}\n {...modalProviderProps}\n className={className}\n style={style}\n lang={locale}\n dir={direction}\n ref={domRef}>\n {children}\n </div>\n );\n});\n\n/**\n * Returns the various settings and styles applied by the nearest parent Provider.\n * Properties explicitly set by the nearest parent Provider override those provided by preceeding Providers.\n */\nexport function useProvider(): ProviderContext {\n return useContext(Context);\n}\n\nexport function useProviderProps<T>(props: T) : T {\n let context = useProvider();\n if (!context) {\n return props;\n }\n return Object.assign({}, {\n isQuiet: context.isQuiet,\n isEmphasized: context.isEmphasized,\n isDisabled: context.isDisabled,\n isRequired: context.isRequired,\n isReadOnly: context.isReadOnly,\n validationState: context.validationState\n }, props);\n}\n","/*\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","/*\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\n@import './index.css';\n@import './skin.css';\n","/*\nCopyright 2019 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\n@import '../commons/index.css';\n@import 'font.css';\n\n/*@mixin typography .spectrum-Body1 {}\n@mixin typography .spectrum-Body2 {}\n@mixin typography .spectrum-Body3 {}\n@mixin typography .spectrum-Body4 {}\n@mixin typography .spectrum-Body5 {}\n@mixin typography .spectrum-Heading1 {}\n@mixin typography .spectrum-Heading2 {}\n@mixin typography .spectrum-Heading3 {}\n@mixin typography .spectrum-Heading4 {}\n@mixin typography .spectrum-Heading5 {}\n@mixin typography .spectrum-Heading6 {}\n@mixin typography .spectrum-Subheading {}\n@mixin typography .spectrum-Detail {}\n@mixin typography .spectrum-Heading1--quiet, heading-quiet-1 {}\n@mixin typography .spectrum-Heading2--quiet, heading-quiet-2 {}\n@mixin typography .spectrum-Heading1--strong, heading-strong-1 {}\n@mixin typography .spectrum-Heading2--strong, heading-strong-2 {}\n@mixin typography .spectrum-Heading1--display, display-1 {}\n@mixin typography .spectrum-Heading2--display, display-2 {}\n@mixin typography .spectrum-Heading1--display.spectrum-Heading1--strong, display-strong-1 {}\n@mixin typography .spectrum-Heading2--display.spectrum-Heading2--strong, display-strong-2 {}\n@mixin typography .spectrum-Heading1--display.spectrum-Heading1--quiet, display-quiet-1 {}\n@mixin typography .spectrum-Heading2--display.spectrum-Heading2--quiet, display-quiet-2 {}\n\n.spectrum-Typography {\n @mixin typographyMargins .spectrum-Body1 {}\n @mixin typographyMargins .spectrum-Body2 {}\n @mixin typographyMargins .spectrum-Body3 {}\n @mixin typographyMargins .spectrum-Body4 {}\n @mixin typographyMargins .spectrum-Body5 {}\n @mixin typographyMargins .spectrum-Heading1 {}\n @mixin typographyMargins .spectrum-Heading2 {}\n @mixin typographyMargins .spectrum-Heading3 {}\n @mixin typographyMargins .spectrum-Heading4 {}\n @mixin typographyMargins .spectrum-Heading5 {}\n @mixin typographyMargins .spectrum-Heading6 {}\n @mixin typographyMargins .spectrum-Subheading {}\n @mixin typographyMargins .spectrum-Detail {}\n @mixin typographyMargins .spectrum-Heading1--quiet, heading-quiet-1 {}\n @mixin typographyMargins .spectrum-Heading2--quiet, heading-quiet-2 {}\n @mixin typographyMargins .spectrum-Heading1--strong, heading-strong-1 {}\n @mixin typographyMargins .spectrum-Heading2--strong, heading-strong-2 {}\n @mixin typographyMargins .spectrum-Heading1--display, display-1 {}\n @mixin typographyMargins .spectrum-Heading2--display, display-2 {}\n @mixin typographyMargins .spectrum-Heading1--display.spectrum-Heading1--strong, display-strong-1 {}\n @mixin typographyMargins .spectrum-Heading2--display.spectrum-Heading2--strong, display-strong-2 {}\n @mixin typographyMargins .spectrum-Heading1--display.spectrum-Heading1--quiet, display-quiet-1 {}\n @mixin typographyMargins .spectrum-Heading2--display.spectrum-Heading2--quiet, display-quiet-2 {}\n}\n\n.spectrum-Article {\n font-family: var(--spectrum-body-article-1-text-font-family);\n @mixin typography .spectrum-Body1, body-article-1 {}\n @mixin typography .spectrum-Body2, body-article-2 {}\n @mixin typography .spectrum-Body3, body-article-3 {}\n @mixin typography .spectrum-Body4, body-article-4 {}\n @mixin typography .spectrum-Body5, body-article-5 {}\n @mixin typography .spectrum-Heading1, heading-article-1 {}\n @mixin typography .spectrum-Heading2, heading-article-2 {}\n @mixin typography .spectrum-Heading3, heading-article-3 {}\n @mixin typography .spectrum-Heading4, heading-article-4 {}\n @mixin typography .spectrum-Heading5, heading-article-5 {}\n @mixin typography .spectrum-Heading6, heading-article-6 {}\n @mixin typography .spectrum-Subheading, subheading-article {}\n @mixin typography .spectrum-Detail, detail-article {}\n @mixin typography .spectrum-Heading1--quiet, heading-quiet-article-1 {}\n @mixin typography .spectrum-Heading2--quiet, heading-quiet-article-2 {}\n @mixin typography .spectrum-Heading1--display, display-article-1 {}\n @mixin typography .spectrum-Heading2--display, display-article-2 {}\n @mixin typography .spectrum-Heading1--display.spectrum-Heading1--quiet, display-quiet-article-1 {}\n @mixin typography .spectrum-Heading2--display.spectrum-Heading2--quiet, display-quiet-article-2 {}\n}\n.spectrum {\n &:lang(ja),\n &:lang(ko),\n &:lang(zh) {\n @mixin typography .spectrum-Body1, body-han-1 {}\n @mixin typography .spectrum-Body2, body-han-2 {}\n @mixin typography .spectrum-Body3, body-han-3 {}\n @mixin typography .spectrum-Body4, body-han-4 {}\n @mixin typography .spectrum-Body5, body-han-5 {}\n @mixin typography .spectrum-Heading1, heading-han-1 {}\n @mixin typography .spectrum-Heading2, heading-han-2 {}\n @mixin typography .spectrum-Heading3, heading-han-3 {}\n @mixin typography .spectrum-Heading4, heading-han-4 {}\n @mixin typography .spectrum-Heading5, heading-han-5 {}\n @mixin typography .spectrum-Heading6, heading-han-6 {}\n @mixin typography .spectrum-Subheading, subheading-han {}\n @mixin typography .spectrum-Detail, detail-han {}\n @mixin typography .spectrum-Heading1--quiet, heading-quiet-han-1 {}\n @mixin typography .spectrum-Heading2--quiet, heading-quiet-han-2 {}\n @mixin typography .spectrum-Heading1--strong, heading-strong-han-1 {}\n @mixin typography .spectrum-Heading2--strong, heading-strong-han-2 {}\n @mixin typography .spectrum-Heading1--display, display-han-1 {}\n @mixin typography .spectrum-Heading2--display, display-han-2 {}\n @mixin typography .spectrum-Heading1--display.spectrum-Heading1--strong, display-strong-han-1 {}\n @mixin typography .spectrum-Heading2--display.spectrum-Heading2--strong, display-strong-han-2 {}\n @mixin typography .spectrum-Heading1--display.spectrum-Heading1--quiet, display-quiet-han-1 {}\n @mixin typography .spectrum-Heading2--display.spectrum-Heading2--quiet, display-quiet-han-2 {}\n }\n}\n@mixin typography .spectrum-Code1, body-code-1, true {\n font-family: var(--spectrum-body-code-1-text-font-family);\n}\n@mixin typography .spectrum-Code2, body-code-2, true {\n font-family: var(--spectrum-body-code-2-text-font-family);\n}\n@mixin typography .spectrum-Code3, body-code-3, true {\n font-family: var(--spectrum-body-code-3-text-font-family);\n}\n@mixin typography .spectrum-Code4, body-code-4, true {\n font-family: var(--spectrum-body-code-4-text-font-family);\n}\n@mixin typography .spectrum-Code5, body-code-5, true {\n font-family: var(--spectrum-body-code-5-text-font-family);\n}*/\n\n/*\n The &.spectrum makes it so users can do <div class=\"spectrum spectrum--large\"> and still get the right font sizes\n Without this, they would have to do <div class=\"spectrum--large\"><div class=\"spectrum\">, which makes no sense\n*/\n&.spectrum,\n&.spectrum-Body,\n.spectrum,\n.spectrum-Body {\n font-size: var(--spectrum-body-4-text-size);\n font-weight: var(--spectrum-body-4-text-font-weight);\n line-height: var(--spectrum-body-4-text-line-height);\n font-style: var(--spectrum-body-4-text-font-style);\n}\n\n.spectrum-Body--italic {\n font-style: var(--spectrum-body-4-emphasis-text-font-style);\n}\n\n/*\n.spectrum-Body--large {\n @extend .spectrum-Body2;\n}\n\n.spectrum-Body--small {\n @extend .spectrum-Body5;\n}\n\n.spectrum-Body--secondary {\n @extend .spectrum-Body4;\n}\n\n.spectrum-Heading--display {\n @extend .spectrum-Heading2--display.spectrum-Heading2--quiet;\n}\n\n.spectrum-Heading--pageTitle {\n @extend .spectrum-Heading2--quiet;\n}\n\n.spectrum-Heading--subtitle1 {\n @extend .spectrum-Heading4;\n}\n\n.spectrum-Heading--subtitle2 {\n @extend .spectrum-Heading6;\n}\n\n.spectrum-Heading--subtitle3 {\n @extend .spectrum-Subheading;\n}*/\n","/*\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 {ColorScheme, Scale} from '@react-types/provider';\nimport {Theme} from '@react-types/provider';\nimport {useMediaQuery} from '@react-spectrum/utils';\n\nexport function useColorScheme(theme: Theme, defaultColorScheme: ColorScheme): ColorScheme {\n let matchesDark = useMediaQuery('(prefers-color-scheme: dark)');\n let matchesLight = useMediaQuery('(prefers-color-scheme: light)');\n\n // importance OS > default > omitted\n\n if (theme.dark && matchesDark) {\n return 'dark';\n }\n\n if (theme.light && matchesLight) {\n return 'light';\n }\n\n if (theme.dark && defaultColorScheme === 'dark') {\n return 'dark';\n }\n\n if (theme.light && defaultColorScheme === 'light') {\n return 'light';\n }\n\n if (!theme.dark) {\n return 'light';\n }\n\n if (!theme.light) {\n return 'dark';\n }\n\n return 'light';\n}\n\nexport function useScale(theme: Theme): Scale {\n let matchesFine = useMediaQuery('(any-pointer: fine)');\n if (matchesFine && theme.medium) {\n return 'medium';\n }\n\n if (theme.large) {\n return 'large';\n }\n\n return 'medium';\n}\n","{\n \"name\": \"@react-spectrum/provider\",\n \"version\": \"3.6.1\",\n \"description\": \"Spectrum UI components in React\",\n \"license\": \"Apache-2.0\",\n \"main\": \"dist/main.js\",\n \"module\": \"dist/module.js\",\n \"exports\": {\n \"types\": \"./dist/types.d.ts\",\n \"import\": \"./dist/import.mjs\",\n \"require\": \"./dist/main.js\"\n },\n \"types\": \"dist/types.d.ts\",\n \"source\": \"src/index.ts\",\n \"files\": [\n \"dist\",\n \"src\"\n ],\n \"sideEffects\": [\n \"*.css\"\n ],\n \"targets\": {\n \"main\": {\n \"includeNodeModules\": [\n \"@adobe/spectrum-css-temp\"\n ]\n },\n \"module\": {\n \"includeNodeModules\": [\n \"@adobe/spectrum-css-temp\"\n ]\n }\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/adobe/react-spectrum\"\n },\n \"dependencies\": {\n \"@react-aria/i18n\": \"^3.6.3\",\n \"@react-aria/overlays\": \"^3.12.1\",\n \"@react-aria/utils\": \"^3.14.2\",\n \"@react-spectrum/utils\": \"^3.8.1\",\n \"@react-types/provider\": \"^3.5.5\",\n \"@react-types/shared\": \"^3.16.0\",\n \"@swc/helpers\": \"^0.4.14\",\n \"clsx\": \"^1.1.1\"\n },\n \"devDependencies\": {\n \"@adobe/spectrum-css-temp\": \"3.0.0-alpha.1\"\n },\n \"peerDependencies\": {\n \"react\": \"^16.8.0 || ^17.0.0-rc.1 || ^18.0.0\",\n \"react-dom\": \"^16.8.0 || ^17.0.0-rc.1 || ^18.0.0\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n }\n}\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -12,6 +12,42 @@ function $parcel$interopDefault(a) {
|
|
|
12
12
|
function $parcel$export(e, n, v, s) {
|
|
13
13
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
14
14
|
}
|
|
15
|
+
/*
|
|
16
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
17
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
18
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
19
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
20
|
+
*
|
|
21
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
22
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
23
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
24
|
+
* governing permissions and limitations under the License.
|
|
25
|
+
*/ /// <reference types="css-module-types" />
|
|
26
|
+
/*
|
|
27
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
28
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
29
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
30
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
31
|
+
*
|
|
32
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
33
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
34
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
35
|
+
* governing permissions and limitations under the License.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/*
|
|
39
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
40
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
41
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
42
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
43
|
+
*
|
|
44
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
45
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
46
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
47
|
+
* governing permissions and limitations under the License.
|
|
48
|
+
*/
|
|
49
|
+
const $a8430f637b4ccbce$export$841858b892ce1f4c = (0, $b6ncI$react).createContext(null);
|
|
50
|
+
$a8430f637b4ccbce$export$841858b892ce1f4c.displayName = "ProviderContext";
|
|
15
51
|
|
|
16
52
|
|
|
17
53
|
|
|
@@ -38,33 +74,41 @@ $5cac98e4c80e6707$export$a30bf7810c8453d1 = "spectrum-Body_2a241c";
|
|
|
38
74
|
$5cac98e4c80e6707$export$7b2dac1166f6ec4c = "spectrum-Body--italic_2a241c";
|
|
39
75
|
|
|
40
76
|
|
|
41
|
-
|
|
77
|
+
/*
|
|
78
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
79
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
80
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
81
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
82
|
+
*
|
|
83
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
84
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
85
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
86
|
+
* governing permissions and limitations under the License.
|
|
87
|
+
*/
|
|
42
88
|
function $d8453c5ae7fac713$export$6343629ee1b29116(theme, defaultColorScheme) {
|
|
43
|
-
let matchesDark = $b6ncI$useMediaQuery(
|
|
44
|
-
let matchesLight = $b6ncI$useMediaQuery(
|
|
89
|
+
let matchesDark = (0, $b6ncI$useMediaQuery)("(prefers-color-scheme: dark)");
|
|
90
|
+
let matchesLight = (0, $b6ncI$useMediaQuery)("(prefers-color-scheme: light)");
|
|
45
91
|
// importance OS > default > omitted
|
|
46
|
-
if (theme.dark && matchesDark) return
|
|
47
|
-
if (theme.light && matchesLight) return
|
|
48
|
-
if (theme.dark && defaultColorScheme ===
|
|
49
|
-
if (theme.light && defaultColorScheme ===
|
|
50
|
-
if (!theme.dark) return
|
|
51
|
-
if (!theme.light) return
|
|
52
|
-
return
|
|
92
|
+
if (theme.dark && matchesDark) return "dark";
|
|
93
|
+
if (theme.light && matchesLight) return "light";
|
|
94
|
+
if (theme.dark && defaultColorScheme === "dark") return "dark";
|
|
95
|
+
if (theme.light && defaultColorScheme === "light") return "light";
|
|
96
|
+
if (!theme.dark) return "light";
|
|
97
|
+
if (!theme.light) return "dark";
|
|
98
|
+
return "light";
|
|
53
99
|
}
|
|
54
100
|
function $d8453c5ae7fac713$export$a8d2043b2d807f4d(theme) {
|
|
55
|
-
let matchesFine = $b6ncI$useMediaQuery(
|
|
56
|
-
if (matchesFine && theme.medium) return
|
|
57
|
-
if (theme.large) return
|
|
58
|
-
return
|
|
101
|
+
let matchesFine = (0, $b6ncI$useMediaQuery)("(any-pointer: fine)");
|
|
102
|
+
if (matchesFine && theme.medium) return "medium";
|
|
103
|
+
if (theme.large) return "large";
|
|
104
|
+
return "medium";
|
|
59
105
|
}
|
|
60
106
|
|
|
61
107
|
|
|
62
108
|
var $7b22e09dddddd7da$exports = {};
|
|
63
|
-
$7b22e09dddddd7da$exports = JSON.parse(
|
|
109
|
+
$7b22e09dddddd7da$exports = JSON.parse('{"name":"@react-spectrum/provider","version":"3.6.1","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.6.3","@react-aria/overlays":"^3.12.1","@react-aria/utils":"^3.14.2","@react-spectrum/utils":"^3.8.1","@react-types/provider":"^3.5.5","@react-types/shared":"^3.16.0","@swc/helpers":"^0.4.14","clsx":"^1.1.1"},"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"}}');
|
|
64
110
|
|
|
65
111
|
|
|
66
|
-
const $7167f8da3cce35e4$var$Context = /*#__PURE__*/ $b6ncI$react.createContext(null);
|
|
67
|
-
$7167f8da3cce35e4$var$Context.displayName = 'ProviderContext';
|
|
68
112
|
const $7167f8da3cce35e4$var$DEFAULT_BREAKPOINTS = {
|
|
69
113
|
S: 640,
|
|
70
114
|
M: 768,
|
|
@@ -77,11 +121,11 @@ function $7167f8da3cce35e4$var$Provider(props, ref) {
|
|
|
77
121
|
let prevColorScheme = prevContext && prevContext.colorScheme;
|
|
78
122
|
let prevBreakpoints = prevContext && prevContext.breakpoints;
|
|
79
123
|
let { theme: theme = prevContext && prevContext.theme , defaultColorScheme: defaultColorScheme } = props;
|
|
80
|
-
if (!theme) throw new Error(
|
|
124
|
+
if (!theme) throw new Error("theme not found, the parent provider must have a theme provided");
|
|
81
125
|
// Hooks must always be called.
|
|
82
|
-
let autoColorScheme = $d8453c5ae7fac713$export$6343629ee1b29116(theme, defaultColorScheme);
|
|
83
|
-
let autoScale = $d8453c5ae7fac713$export$a8d2043b2d807f4d(theme);
|
|
84
|
-
let { locale: prevLocale } = $b6ncI$useLocale();
|
|
126
|
+
let autoColorScheme = (0, $d8453c5ae7fac713$export$6343629ee1b29116)(theme, defaultColorScheme);
|
|
127
|
+
let autoScale = (0, $d8453c5ae7fac713$export$a8d2043b2d807f4d)(theme);
|
|
128
|
+
let { locale: prevLocale } = (0, $b6ncI$useLocale)();
|
|
85
129
|
// if the new theme doesn't support the prevColorScheme, we must resort to the auto
|
|
86
130
|
let usePrevColorScheme = !!theme[prevColorScheme];
|
|
87
131
|
// importance of color scheme props > parent > auto:(OS > default > omitted)
|
|
@@ -100,69 +144,65 @@ function $7167f8da3cce35e4$var$Provider(props, ref) {
|
|
|
100
144
|
isReadOnly: isReadOnly,
|
|
101
145
|
validationState: validationState
|
|
102
146
|
};
|
|
103
|
-
let matchedBreakpoints = $b6ncI$useMatchedBreakpoints(breakpoints);
|
|
104
|
-
let filteredProps = {
|
|
105
|
-
|
|
106
|
-
Object.entries(currentProps).forEach(([key, value])=>value !== undefined && (filteredProps[key] = value)
|
|
107
|
-
);
|
|
147
|
+
let matchedBreakpoints = (0, $b6ncI$useMatchedBreakpoints)(breakpoints);
|
|
148
|
+
let filteredProps = {};
|
|
149
|
+
Object.entries(currentProps).forEach(([key, value])=>value !== undefined && (filteredProps[key] = value));
|
|
108
150
|
// Merge options with parent provider
|
|
109
|
-
let context = Object.assign({
|
|
110
|
-
}, prevContext, filteredProps);
|
|
151
|
+
let context = Object.assign({}, prevContext, filteredProps);
|
|
111
152
|
// Only wrap in a DOM node if the theme, colorScheme, or scale changed
|
|
112
153
|
let contents = children;
|
|
113
|
-
let domProps = $b6ncI$filterDOMProps(otherProps);
|
|
114
|
-
let { styleProps: styleProps } = $b6ncI$useStyleProps(otherProps, undefined, {
|
|
154
|
+
let domProps = (0, $b6ncI$filterDOMProps)(otherProps);
|
|
155
|
+
let { styleProps: styleProps } = (0, $b6ncI$useStyleProps)(otherProps, undefined, {
|
|
115
156
|
matchedBreakpoints: matchedBreakpoints
|
|
116
157
|
});
|
|
117
|
-
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__*/ $b6ncI$react.createElement($7167f8da3cce35e4$var$ProviderWrapper, {
|
|
158
|
+
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, {
|
|
118
159
|
...props,
|
|
119
160
|
UNSAFE_style: {
|
|
120
|
-
isolation: !prevContext ?
|
|
161
|
+
isolation: !prevContext ? "isolate" : undefined,
|
|
121
162
|
...styleProps.style
|
|
122
163
|
},
|
|
123
164
|
ref: ref
|
|
124
165
|
}, contents);
|
|
125
|
-
return
|
|
166
|
+
return /*#__PURE__*/ (0, $b6ncI$react).createElement((0, $a8430f637b4ccbce$export$841858b892ce1f4c).Provider, {
|
|
126
167
|
value: context
|
|
127
|
-
}, /*#__PURE__*/ $b6ncI$react.createElement($b6ncI$I18nProvider, {
|
|
168
|
+
}, /*#__PURE__*/ (0, $b6ncI$react).createElement((0, $b6ncI$I18nProvider), {
|
|
128
169
|
locale: locale
|
|
129
|
-
}, /*#__PURE__*/ $b6ncI$react.createElement($b6ncI$BreakpointProvider, {
|
|
170
|
+
}, /*#__PURE__*/ (0, $b6ncI$react).createElement((0, $b6ncI$BreakpointProvider), {
|
|
130
171
|
matchedBreakpoints: matchedBreakpoints
|
|
131
|
-
}, /*#__PURE__*/ $b6ncI$react.createElement($b6ncI$ModalProvider, null, contents))))
|
|
172
|
+
}, /*#__PURE__*/ (0, $b6ncI$react).createElement((0, $b6ncI$ModalProvider), null, contents))));
|
|
132
173
|
}
|
|
133
174
|
/**
|
|
134
175
|
* Provider is the container for all React Spectrum applications.
|
|
135
176
|
* It defines the theme, locale, and other application level settings,
|
|
136
177
|
* and can also be used to provide common properties to a group of components.
|
|
137
|
-
*/ let $7167f8da3cce35e4$export$2881499e37b75b9a = /*#__PURE__*/ $b6ncI$react.forwardRef($7167f8da3cce35e4$var$Provider);
|
|
138
|
-
const $7167f8da3cce35e4$var$ProviderWrapper = /*#__PURE__*/ $b6ncI$react.forwardRef(function ProviderWrapper(props, ref) {
|
|
178
|
+
*/ let $7167f8da3cce35e4$export$2881499e37b75b9a = /*#__PURE__*/ (0, $b6ncI$react).forwardRef($7167f8da3cce35e4$var$Provider);
|
|
179
|
+
const $7167f8da3cce35e4$var$ProviderWrapper = /*#__PURE__*/ (0, $b6ncI$react).forwardRef(function ProviderWrapper(props, ref) {
|
|
139
180
|
let { children: children , ...otherProps } = props;
|
|
140
|
-
let { locale: locale , direction: direction } = $b6ncI$useLocale();
|
|
181
|
+
let { locale: locale , direction: direction } = (0, $b6ncI$useLocale)();
|
|
141
182
|
let { theme: theme , colorScheme: colorScheme , scale: scale } = $7167f8da3cce35e4$export$693cdb10cec23617();
|
|
142
|
-
let { modalProviderProps: modalProviderProps } = $b6ncI$useModalProvider();
|
|
143
|
-
let { styleProps: styleProps } = $b6ncI$useStyleProps(otherProps);
|
|
144
|
-
let domRef = $b6ncI$useDOMRef(ref);
|
|
183
|
+
let { modalProviderProps: modalProviderProps } = (0, $b6ncI$useModalProvider)();
|
|
184
|
+
let { styleProps: styleProps } = (0, $b6ncI$useStyleProps)(otherProps);
|
|
185
|
+
let domRef = (0, $b6ncI$useDOMRef)(ref);
|
|
145
186
|
let themeKey = Object.keys(theme[colorScheme])[0];
|
|
146
187
|
let scaleKey = Object.keys(theme[scale])[0];
|
|
147
|
-
let className = $b6ncI$clsx(styleProps.className, (/*@__PURE__*/$parcel$interopDefault($698974e9dd92c2ec$exports))[
|
|
148
|
-
|
|
149
|
-
spectrum: $b6ncI$shouldKeepSpectrumClassNames,
|
|
150
|
-
[themeKey]: $b6ncI$shouldKeepSpectrumClassNames,
|
|
151
|
-
[scaleKey]: $b6ncI$shouldKeepSpectrumClassNames
|
|
188
|
+
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, {
|
|
189
|
+
"react-spectrum-provider": (0, $b6ncI$shouldKeepSpectrumClassNames),
|
|
190
|
+
spectrum: (0, $b6ncI$shouldKeepSpectrumClassNames),
|
|
191
|
+
[themeKey]: (0, $b6ncI$shouldKeepSpectrumClassNames),
|
|
192
|
+
[scaleKey]: (0, $b6ncI$shouldKeepSpectrumClassNames)
|
|
152
193
|
});
|
|
153
|
-
var
|
|
194
|
+
var _props_colorScheme, _ref;
|
|
154
195
|
let style = {
|
|
155
196
|
...styleProps.style,
|
|
156
197
|
// This ensures that browser native UI like scrollbars are rendered in the right color scheme.
|
|
157
198
|
// See https://web.dev/color-scheme/.
|
|
158
|
-
colorScheme: (
|
|
159
|
-
).join(' ')
|
|
199
|
+
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(" ")
|
|
160
200
|
};
|
|
161
|
-
let hasWarned = $b6ncI$useRef(false);
|
|
162
|
-
$b6ncI$useEffect(()=>{
|
|
201
|
+
let hasWarned = (0, $b6ncI$useRef)(false);
|
|
202
|
+
(0, $b6ncI$useEffect)(()=>{
|
|
163
203
|
if (direction && domRef.current) {
|
|
164
|
-
let closestDir = domRef.current.parentElement.closest(
|
|
165
|
-
let dir = closestDir && closestDir.getAttribute(
|
|
204
|
+
let closestDir = domRef.current.parentElement.closest("[dir]");
|
|
205
|
+
let dir = closestDir && closestDir.getAttribute("dir");
|
|
166
206
|
if (dir && dir !== direction && !hasWarned.current) {
|
|
167
207
|
console.warn(`Language directions cannot be nested. ${direction} inside ${dir}.`);
|
|
168
208
|
hasWarned.current = true;
|
|
@@ -173,8 +213,8 @@ const $7167f8da3cce35e4$var$ProviderWrapper = /*#__PURE__*/ $b6ncI$react.forward
|
|
|
173
213
|
domRef,
|
|
174
214
|
hasWarned
|
|
175
215
|
]);
|
|
176
|
-
return
|
|
177
|
-
|
|
216
|
+
return /*#__PURE__*/ (0, $b6ncI$react).createElement("div", {
|
|
217
|
+
...(0, $b6ncI$filterDOMProps)(otherProps),
|
|
178
218
|
...styleProps,
|
|
179
219
|
...modalProviderProps,
|
|
180
220
|
className: className,
|
|
@@ -182,16 +222,15 @@ const $7167f8da3cce35e4$var$ProviderWrapper = /*#__PURE__*/ $b6ncI$react.forward
|
|
|
182
222
|
lang: locale,
|
|
183
223
|
dir: direction,
|
|
184
224
|
ref: domRef
|
|
185
|
-
}, children)
|
|
225
|
+
}, children);
|
|
186
226
|
});
|
|
187
227
|
function $7167f8da3cce35e4$export$693cdb10cec23617() {
|
|
188
|
-
return $b6ncI$useContext($
|
|
228
|
+
return (0, $b6ncI$useContext)((0, $a8430f637b4ccbce$export$841858b892ce1f4c));
|
|
189
229
|
}
|
|
190
230
|
function $7167f8da3cce35e4$export$521c373ccc32c300(props) {
|
|
191
231
|
let context = $7167f8da3cce35e4$export$693cdb10cec23617();
|
|
192
232
|
if (!context) return props;
|
|
193
|
-
return Object.assign({
|
|
194
|
-
}, {
|
|
233
|
+
return Object.assign({}, {
|
|
195
234
|
isQuiet: context.isQuiet,
|
|
196
235
|
isEmphasized: context.isEmphasized,
|
|
197
236
|
isDisabled: context.isDisabled,
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;AEAA,GAA0B;AAA1B,yCAA0B,GAAG,CAAiB;;;;;;;;ACA9C,GAA0B;AAC1B,GAA+B;AAC/B,GAAuC;AAFvC,yCAA0B,GAAG,CAAiB;AAC9C,yCAA+B,GAAG,CAAsB;AACxD,yCAAuC,GAAG,CAA8B;;;;SCcxD,yCAAc,CAAC,KAAY,EAAE,kBAA+B,EAAe,CAAC;IAC1F,GAAG,CAAC,WAAW,GAAG,oBAAa,CAAC,CAA8B;IAC9D,GAAG,CAAC,YAAY,GAAG,oBAAa,C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AM;OACV,QAAQ;AAGf,CAAC;SAMe,yCAAW,GAAoB,CAAC;IAC9C,MAAM,CAAC,iBAAU,CAAC,6BAAO;AAC3B,CAAC;SAEe,yCAAgB,CAAI,KAAQ,EAAM,CAAC;IACjD,GAAG,CAAC,OAAO,GAAG,yCAAW;IACzB,EAAE,GAAG,OAAO,EACV,MAAM,CAAC,KAAK;IAEd,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAAA,CAAC,EAAE,CAAC;QACxB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,eAAe,EAAE,OAAO,CAAC,eAAe;IAC1C,CAAC,EAAE,KAAK;AACV,CAAC","sources":["packages/@react-spectrum/provider/src/index.ts","packages/@react-spectrum/provider/src/Provider.tsx","packages/@adobe/spectrum-css-temp/components/page/vars.css","packages/@adobe/spectrum-css-temp/components/typography/index.css","packages/@react-spectrum/provider/src/mediaQueries.ts","packages/@react-spectrum/provider/package.json"],"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\n/// <reference types=\"css-module-types\" />\n\nexport {Provider, useProvider, useProviderProps} from './Provider';\nexport type {ProviderContext} from '@react-types/provider';\nexport type {ProviderProps} from '@react-types/provider';\n","/*\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 {\n BreakpointProvider,\n shouldKeepSpectrumClassNames,\n useDOMRef,\n useMatchedBreakpoints,\n useStyleProps\n} from '@react-spectrum/utils';\nimport clsx from 'clsx';\nimport {DOMRef} from '@react-types/shared';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {I18nProvider, useLocale} from '@react-aria/i18n';\nimport {ModalProvider, useModalProvider} from '@react-aria/overlays';\nimport {ProviderContext, ProviderProps} from '@react-types/provider';\nimport React, {useContext, useEffect, useRef} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/page/vars.css';\nimport typographyStyles from '@adobe/spectrum-css-temp/components/typography/index.css';\nimport {useColorScheme, useScale} from './mediaQueries';\n// @ts-ignore\nimport {version} from '../package.json';\n\nconst Context = React.createContext<ProviderContext | null>(null);\nContext.displayName = 'ProviderContext';\n\nconst DEFAULT_BREAKPOINTS = {S: 640, M: 768, L: 1024, XL: 1280, XXL: 1536};\n\nfunction Provider(props: ProviderProps, ref: DOMRef<HTMLDivElement>) {\n let prevContext = useProvider();\n let prevColorScheme = prevContext && prevContext.colorScheme;\n let prevBreakpoints = prevContext && prevContext.breakpoints;\n let {\n theme = prevContext && prevContext.theme,\n defaultColorScheme\n } = props;\n if (!theme) {\n throw new Error('theme not found, the parent provider must have a theme provided');\n }\n // Hooks must always be called.\n let autoColorScheme = useColorScheme(theme, defaultColorScheme);\n let autoScale = useScale(theme);\n let {locale: prevLocale} = useLocale();\n // if the new theme doesn't support the prevColorScheme, we must resort to the auto\n let usePrevColorScheme = !!theme[prevColorScheme];\n\n // importance of color scheme props > parent > auto:(OS > default > omitted)\n let {\n colorScheme = usePrevColorScheme ? prevColorScheme : autoColorScheme,\n scale = prevContext ? prevContext.scale : autoScale,\n locale = prevContext ? prevLocale : null,\n breakpoints = prevContext ? prevBreakpoints : DEFAULT_BREAKPOINTS,\n children,\n isQuiet,\n isEmphasized,\n isDisabled,\n isRequired,\n isReadOnly,\n validationState,\n ...otherProps\n } = props;\n\n // select only the props with values so undefined props don't overwrite prevContext values\n let currentProps = {\n version,\n theme,\n breakpoints,\n colorScheme,\n scale,\n isQuiet,\n isEmphasized,\n isDisabled,\n isRequired,\n isReadOnly,\n validationState\n };\n\n let matchedBreakpoints = useMatchedBreakpoints(breakpoints);\n let filteredProps = {};\n Object.entries(currentProps).forEach(([key, value]) => value !== undefined && (filteredProps[key] = value));\n\n // Merge options with parent provider\n let context = Object.assign({}, prevContext, filteredProps);\n\n // Only wrap in a DOM node if the theme, colorScheme, or scale changed\n let contents = children;\n let domProps = filterDOMProps(otherProps);\n let {styleProps} = useStyleProps(otherProps, undefined, {matchedBreakpoints});\n 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) {\n contents = (\n <ProviderWrapper {...props} UNSAFE_style={{isolation: !prevContext ? 'isolate' : undefined, ...styleProps.style}} ref={ref}>\n {contents}\n </ProviderWrapper>\n );\n }\n\n return (\n <Context.Provider value={context}>\n <I18nProvider locale={locale}>\n <BreakpointProvider matchedBreakpoints={matchedBreakpoints}>\n <ModalProvider>\n {contents}\n </ModalProvider>\n </BreakpointProvider>\n </I18nProvider>\n </Context.Provider>\n );\n}\n\n/**\n * Provider is the container for all React Spectrum applications.\n * It defines the theme, locale, and other application level settings,\n * and can also be used to provide common properties to a group of components.\n */\nlet _Provider = React.forwardRef(Provider);\nexport {_Provider as Provider};\n\nconst ProviderWrapper = React.forwardRef(function ProviderWrapper(props: ProviderProps, ref: DOMRef<HTMLDivElement>) {\n let {\n children,\n ...otherProps\n } = props;\n let {locale, direction} = useLocale();\n let {theme, colorScheme, scale} = useProvider();\n let {modalProviderProps} = useModalProvider();\n let {styleProps} = useStyleProps(otherProps);\n let domRef = useDOMRef(ref);\n\n let themeKey = Object.keys(theme[colorScheme])[0];\n let scaleKey = Object.keys(theme[scale])[0];\n\n let className = clsx(\n styleProps.className,\n styles['spectrum'],\n typographyStyles['spectrum'],\n Object.values(theme[colorScheme]),\n Object.values(theme[scale]),\n theme.global ? Object.values(theme.global) : null,\n {\n 'react-spectrum-provider': shouldKeepSpectrumClassNames,\n spectrum: shouldKeepSpectrumClassNames,\n [themeKey]: shouldKeepSpectrumClassNames,\n [scaleKey]: shouldKeepSpectrumClassNames\n }\n );\n\n let style = {\n ...styleProps.style,\n // This ensures that browser native UI like scrollbars are rendered in the right color scheme.\n // See https://web.dev/color-scheme/.\n colorScheme: props.colorScheme ?? colorScheme ?? Object.keys(theme).filter(k => k === 'light' || k === 'dark').join(' ')\n };\n\n let hasWarned = useRef(false);\n useEffect(() => {\n if (direction && domRef.current) {\n let closestDir = domRef.current.parentElement.closest('[dir]');\n let dir = closestDir && closestDir.getAttribute('dir');\n if (dir && dir !== direction && !hasWarned.current) {\n console.warn(`Language directions cannot be nested. ${direction} inside ${dir}.`);\n hasWarned.current = true;\n }\n }\n }, [direction, domRef, hasWarned]);\n\n\n return (\n <div\n {...filterDOMProps(otherProps)}\n {...styleProps}\n {...modalProviderProps}\n className={className}\n style={style}\n lang={locale}\n dir={direction}\n ref={domRef}>\n {children}\n </div>\n );\n});\n\n/**\n * Returns the various settings and styles applied by the nearest parent Provider.\n * Properties explicitly set by the nearest parent Provider override those provided by preceeding Providers.\n */\nexport function useProvider(): ProviderContext {\n return useContext(Context);\n}\n\nexport function useProviderProps<T>(props: T) : T {\n let context = useProvider();\n if (!context) {\n return props;\n }\n return Object.assign({}, {\n isQuiet: context.isQuiet,\n isEmphasized: context.isEmphasized,\n isDisabled: context.isDisabled,\n isRequired: context.isRequired,\n isReadOnly: context.isReadOnly,\n validationState: context.validationState\n }, props);\n}\n","/*\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\n@import './index.css';\n@import './skin.css';\n","/*\nCopyright 2019 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\n@import '../commons/index.css';\n@import 'font.css';\n\n/*@mixin typography .spectrum-Body1 {}\n@mixin typography .spectrum-Body2 {}\n@mixin typography .spectrum-Body3 {}\n@mixin typography .spectrum-Body4 {}\n@mixin typography .spectrum-Body5 {}\n@mixin typography .spectrum-Heading1 {}\n@mixin typography .spectrum-Heading2 {}\n@mixin typography .spectrum-Heading3 {}\n@mixin typography .spectrum-Heading4 {}\n@mixin typography .spectrum-Heading5 {}\n@mixin typography .spectrum-Heading6 {}\n@mixin typography .spectrum-Subheading {}\n@mixin typography .spectrum-Detail {}\n@mixin typography .spectrum-Heading1--quiet, heading-quiet-1 {}\n@mixin typography .spectrum-Heading2--quiet, heading-quiet-2 {}\n@mixin typography .spectrum-Heading1--strong, heading-strong-1 {}\n@mixin typography .spectrum-Heading2--strong, heading-strong-2 {}\n@mixin typography .spectrum-Heading1--display, display-1 {}\n@mixin typography .spectrum-Heading2--display, display-2 {}\n@mixin typography .spectrum-Heading1--display.spectrum-Heading1--strong, display-strong-1 {}\n@mixin typography .spectrum-Heading2--display.spectrum-Heading2--strong, display-strong-2 {}\n@mixin typography .spectrum-Heading1--display.spectrum-Heading1--quiet, display-quiet-1 {}\n@mixin typography .spectrum-Heading2--display.spectrum-Heading2--quiet, display-quiet-2 {}\n\n.spectrum-Typography {\n @mixin typographyMargins .spectrum-Body1 {}\n @mixin typographyMargins .spectrum-Body2 {}\n @mixin typographyMargins .spectrum-Body3 {}\n @mixin typographyMargins .spectrum-Body4 {}\n @mixin typographyMargins .spectrum-Body5 {}\n @mixin typographyMargins .spectrum-Heading1 {}\n @mixin typographyMargins .spectrum-Heading2 {}\n @mixin typographyMargins .spectrum-Heading3 {}\n @mixin typographyMargins .spectrum-Heading4 {}\n @mixin typographyMargins .spectrum-Heading5 {}\n @mixin typographyMargins .spectrum-Heading6 {}\n @mixin typographyMargins .spectrum-Subheading {}\n @mixin typographyMargins .spectrum-Detail {}\n @mixin typographyMargins .spectrum-Heading1--quiet, heading-quiet-1 {}\n @mixin typographyMargins .spectrum-Heading2--quiet, heading-quiet-2 {}\n @mixin typographyMargins .spectrum-Heading1--strong, heading-strong-1 {}\n @mixin typographyMargins .spectrum-Heading2--strong, heading-strong-2 {}\n @mixin typographyMargins .spectrum-Heading1--display, display-1 {}\n @mixin typographyMargins .spectrum-Heading2--display, display-2 {}\n @mixin typographyMargins .spectrum-Heading1--display.spectrum-Heading1--strong, display-strong-1 {}\n @mixin typographyMargins .spectrum-Heading2--display.spectrum-Heading2--strong, display-strong-2 {}\n @mixin typographyMargins .spectrum-Heading1--display.spectrum-Heading1--quiet, display-quiet-1 {}\n @mixin typographyMargins .spectrum-Heading2--display.spectrum-Heading2--quiet, display-quiet-2 {}\n}\n\n.spectrum-Article {\n font-family: var(--spectrum-body-article-1-text-font-family);\n @mixin typography .spectrum-Body1, body-article-1 {}\n @mixin typography .spectrum-Body2, body-article-2 {}\n @mixin typography .spectrum-Body3, body-article-3 {}\n @mixin typography .spectrum-Body4, body-article-4 {}\n @mixin typography .spectrum-Body5, body-article-5 {}\n @mixin typography .spectrum-Heading1, heading-article-1 {}\n @mixin typography .spectrum-Heading2, heading-article-2 {}\n @mixin typography .spectrum-Heading3, heading-article-3 {}\n @mixin typography .spectrum-Heading4, heading-article-4 {}\n @mixin typography .spectrum-Heading5, heading-article-5 {}\n @mixin typography .spectrum-Heading6, heading-article-6 {}\n @mixin typography .spectrum-Subheading, subheading-article {}\n @mixin typography .spectrum-Detail, detail-article {}\n @mixin typography .spectrum-Heading1--quiet, heading-quiet-article-1 {}\n @mixin typography .spectrum-Heading2--quiet, heading-quiet-article-2 {}\n @mixin typography .spectrum-Heading1--display, display-article-1 {}\n @mixin typography .spectrum-Heading2--display, display-article-2 {}\n @mixin typography .spectrum-Heading1--display.spectrum-Heading1--quiet, display-quiet-article-1 {}\n @mixin typography .spectrum-Heading2--display.spectrum-Heading2--quiet, display-quiet-article-2 {}\n}\n.spectrum {\n &:lang(ja),\n &:lang(ko),\n &:lang(zh) {\n @mixin typography .spectrum-Body1, body-han-1 {}\n @mixin typography .spectrum-Body2, body-han-2 {}\n @mixin typography .spectrum-Body3, body-han-3 {}\n @mixin typography .spectrum-Body4, body-han-4 {}\n @mixin typography .spectrum-Body5, body-han-5 {}\n @mixin typography .spectrum-Heading1, heading-han-1 {}\n @mixin typography .spectrum-Heading2, heading-han-2 {}\n @mixin typography .spectrum-Heading3, heading-han-3 {}\n @mixin typography .spectrum-Heading4, heading-han-4 {}\n @mixin typography .spectrum-Heading5, heading-han-5 {}\n @mixin typography .spectrum-Heading6, heading-han-6 {}\n @mixin typography .spectrum-Subheading, subheading-han {}\n @mixin typography .spectrum-Detail, detail-han {}\n @mixin typography .spectrum-Heading1--quiet, heading-quiet-han-1 {}\n @mixin typography .spectrum-Heading2--quiet, heading-quiet-han-2 {}\n @mixin typography .spectrum-Heading1--strong, heading-strong-han-1 {}\n @mixin typography .spectrum-Heading2--strong, heading-strong-han-2 {}\n @mixin typography .spectrum-Heading1--display, display-han-1 {}\n @mixin typography .spectrum-Heading2--display, display-han-2 {}\n @mixin typography .spectrum-Heading1--display.spectrum-Heading1--strong, display-strong-han-1 {}\n @mixin typography .spectrum-Heading2--display.spectrum-Heading2--strong, display-strong-han-2 {}\n @mixin typography .spectrum-Heading1--display.spectrum-Heading1--quiet, display-quiet-han-1 {}\n @mixin typography .spectrum-Heading2--display.spectrum-Heading2--quiet, display-quiet-han-2 {}\n }\n}\n@mixin typography .spectrum-Code1, body-code-1, true {\n font-family: var(--spectrum-body-code-1-text-font-family);\n}\n@mixin typography .spectrum-Code2, body-code-2, true {\n font-family: var(--spectrum-body-code-2-text-font-family);\n}\n@mixin typography .spectrum-Code3, body-code-3, true {\n font-family: var(--spectrum-body-code-3-text-font-family);\n}\n@mixin typography .spectrum-Code4, body-code-4, true {\n font-family: var(--spectrum-body-code-4-text-font-family);\n}\n@mixin typography .spectrum-Code5, body-code-5, true {\n font-family: var(--spectrum-body-code-5-text-font-family);\n}*/\n\n/*\n The &.spectrum makes it so users can do <div class=\"spectrum spectrum--large\"> and still get the right font sizes\n Without this, they would have to do <div class=\"spectrum--large\"><div class=\"spectrum\">, which makes no sense\n*/\n&.spectrum,\n&.spectrum-Body,\n.spectrum,\n.spectrum-Body {\n font-size: var(--spectrum-body-4-text-size);\n font-weight: var(--spectrum-body-4-text-font-weight);\n line-height: var(--spectrum-body-4-text-line-height);\n font-style: var(--spectrum-body-4-text-font-style);\n}\n\n.spectrum-Body--italic {\n font-style: var(--spectrum-body-4-emphasis-text-font-style);\n}\n\n/*\n.spectrum-Body--large {\n @extend .spectrum-Body2;\n}\n\n.spectrum-Body--small {\n @extend .spectrum-Body5;\n}\n\n.spectrum-Body--secondary {\n @extend .spectrum-Body4;\n}\n\n.spectrum-Heading--display {\n @extend .spectrum-Heading2--display.spectrum-Heading2--quiet;\n}\n\n.spectrum-Heading--pageTitle {\n @extend .spectrum-Heading2--quiet;\n}\n\n.spectrum-Heading--subtitle1 {\n @extend .spectrum-Heading4;\n}\n\n.spectrum-Heading--subtitle2 {\n @extend .spectrum-Heading6;\n}\n\n.spectrum-Heading--subtitle3 {\n @extend .spectrum-Subheading;\n}*/\n","/*\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 {ColorScheme, Scale} from '@react-types/provider';\nimport {Theme} from '@react-types/provider';\nimport {useMediaQuery} from '@react-spectrum/utils';\n\nexport function useColorScheme(theme: Theme, defaultColorScheme: ColorScheme): ColorScheme {\n let matchesDark = useMediaQuery('(prefers-color-scheme: dark)');\n let matchesLight = useMediaQuery('(prefers-color-scheme: light)');\n\n // importance OS > default > omitted\n\n if (theme.dark && matchesDark) {\n return 'dark';\n }\n\n if (theme.light && matchesLight) {\n return 'light';\n }\n\n if (theme.dark && defaultColorScheme === 'dark') {\n return 'dark';\n }\n\n if (theme.light && defaultColorScheme === 'light') {\n return 'light';\n }\n\n if (!theme.dark) {\n return 'light';\n }\n\n if (!theme.light) {\n return 'dark';\n }\n\n return 'light';\n}\n\nexport function useScale(theme: Theme): Scale {\n let matchesFine = useMediaQuery('(any-pointer: fine)');\n if (matchesFine && theme.medium) {\n return 'medium';\n }\n\n if (theme.large) {\n return 'large';\n }\n\n return 'medium';\n}\n","{\n \"name\": \"@react-spectrum/provider\",\n \"version\": \"3.6.0\",\n \"description\": \"Spectrum UI components in React\",\n \"license\": \"Apache-2.0\",\n \"main\": \"dist/main.js\",\n \"module\": \"dist/module.js\",\n \"types\": \"dist/types.d.ts\",\n \"source\": \"src/index.ts\",\n \"files\": [\n \"dist\",\n \"src\"\n ],\n \"sideEffects\": [\n \"*.css\"\n ],\n \"targets\": {\n \"main\": {\n \"includeNodeModules\": [\n \"@adobe/spectrum-css-temp\"\n ]\n },\n \"module\": {\n \"includeNodeModules\": [\n \"@adobe/spectrum-css-temp\"\n ]\n }\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/adobe/react-spectrum\"\n },\n \"dependencies\": {\n \"@babel/runtime\": \"^7.6.2\",\n \"@react-aria/i18n\": \"^3.6.2\",\n \"@react-aria/overlays\": \"^3.12.0\",\n \"@react-aria/utils\": \"^3.14.1\",\n \"@react-spectrum/utils\": \"^3.8.0\",\n \"@react-types/provider\": \"^3.5.5\",\n \"@react-types/shared\": \"^3.16.0\",\n \"clsx\": \"^1.1.1\"\n },\n \"devDependencies\": {\n \"@adobe/spectrum-css-temp\": \"3.0.0-alpha.1\"\n },\n \"peerDependencies\": {\n \"react\": \"^16.8.0 || ^17.0.0-rc.1 || ^18.0.0\",\n \"react-dom\": \"^16.8.0 || ^17.0.0-rc.1 || ^18.0.0\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n }\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,0CAA0C;ACZ1C;;;;;;;;;;CAUC,GAED;;ACZA;;;;;;;;;;CAUC,GAED;AAKO,MAAM,4CAAU,CAAA,GAAA,YAAK,AAAD,EAAE,aAAa,CAAyB,IAAI;AACvE,0CAAQ,WAAW,GAAG;;;;;;;;;;AClBtB,IAAA;AAAA,4CAA6B;;;;;;;;ACA7B,IAAA;AACA,IAAA;AACA,IAAA;AAFA,4CAA6B;AAC7B,4CAAkC;AAClC,4CAA0C;;;ACF1C;;;;;;;;;;CAUC,GAED;AAIO,SAAS,0CAAe,KAAY,EAAE,kBAA+B,EAAe;IACzF,IAAI,cAAc,CAAA,GAAA,oBAAY,EAAE;IAChC,IAAI,eAAe,CAAA,GAAA,oBAAY,EAAE;IAEjC,oCAAoC;IAEpC,IAAI,MAAM,IAAI,IAAI,aAChB,O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provider/src/index.ts","packages/@react-spectrum/provider/src/Provider.tsx","packages/@react-spectrum/provider/src/context.ts","packages/@adobe/spectrum-css-temp/components/page/vars.css","packages/@adobe/spectrum-css-temp/components/typography/index.css","packages/@react-spectrum/provider/src/mediaQueries.ts","packages/@react-spectrum/provider/package.json"],"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\n/// <reference types=\"css-module-types\" />\n\nexport {Provider, useProvider, useProviderProps} from './Provider';\nexport type {ProviderContext} from '@react-types/provider';\nexport type {ProviderProps} from '@react-types/provider';\n","/*\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 {\n BreakpointProvider,\n shouldKeepSpectrumClassNames,\n useDOMRef,\n useMatchedBreakpoints,\n useStyleProps\n} from '@react-spectrum/utils';\nimport clsx from 'clsx';\nimport {Context} from './context';\nimport {DOMRef} from '@react-types/shared';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {I18nProvider, useLocale} from '@react-aria/i18n';\nimport {ModalProvider, useModalProvider} from '@react-aria/overlays';\nimport {ProviderContext, ProviderProps} from '@react-types/provider';\nimport React, {useContext, useEffect, useRef} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/page/vars.css';\nimport typographyStyles from '@adobe/spectrum-css-temp/components/typography/index.css';\nimport {useColorScheme, useScale} from './mediaQueries';\n// @ts-ignore\nimport {version} from '../package.json';\n\nconst DEFAULT_BREAKPOINTS = {S: 640, M: 768, L: 1024, XL: 1280, XXL: 1536};\n\nfunction Provider(props: ProviderProps, ref: DOMRef<HTMLDivElement>) {\n let prevContext = useProvider();\n let prevColorScheme = prevContext && prevContext.colorScheme;\n let prevBreakpoints = prevContext && prevContext.breakpoints;\n let {\n theme = prevContext && prevContext.theme,\n defaultColorScheme\n } = props;\n if (!theme) {\n throw new Error('theme not found, the parent provider must have a theme provided');\n }\n // Hooks must always be called.\n let autoColorScheme = useColorScheme(theme, defaultColorScheme);\n let autoScale = useScale(theme);\n let {locale: prevLocale} = useLocale();\n // if the new theme doesn't support the prevColorScheme, we must resort to the auto\n let usePrevColorScheme = !!theme[prevColorScheme];\n\n // importance of color scheme props > parent > auto:(OS > default > omitted)\n let {\n colorScheme = usePrevColorScheme ? prevColorScheme : autoColorScheme,\n scale = prevContext ? prevContext.scale : autoScale,\n locale = prevContext ? prevLocale : null,\n breakpoints = prevContext ? prevBreakpoints : DEFAULT_BREAKPOINTS,\n children,\n isQuiet,\n isEmphasized,\n isDisabled,\n isRequired,\n isReadOnly,\n validationState,\n ...otherProps\n } = props;\n\n // select only the props with values so undefined props don't overwrite prevContext values\n let currentProps = {\n version,\n theme,\n breakpoints,\n colorScheme,\n scale,\n isQuiet,\n isEmphasized,\n isDisabled,\n isRequired,\n isReadOnly,\n validationState\n };\n\n let matchedBreakpoints = useMatchedBreakpoints(breakpoints);\n let filteredProps = {};\n Object.entries(currentProps).forEach(([key, value]) => value !== undefined && (filteredProps[key] = value));\n\n // Merge options with parent provider\n let context = Object.assign({}, prevContext, filteredProps);\n\n // Only wrap in a DOM node if the theme, colorScheme, or scale changed\n let contents = children;\n let domProps = filterDOMProps(otherProps);\n let {styleProps} = useStyleProps(otherProps, undefined, {matchedBreakpoints});\n 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) {\n contents = (\n <ProviderWrapper {...props} UNSAFE_style={{isolation: !prevContext ? 'isolate' : undefined, ...styleProps.style}} ref={ref}>\n {contents}\n </ProviderWrapper>\n );\n }\n\n return (\n <Context.Provider value={context}>\n <I18nProvider locale={locale}>\n <BreakpointProvider matchedBreakpoints={matchedBreakpoints}>\n <ModalProvider>\n {contents}\n </ModalProvider>\n </BreakpointProvider>\n </I18nProvider>\n </Context.Provider>\n );\n}\n\n/**\n * Provider is the container for all React Spectrum applications.\n * It defines the theme, locale, and other application level settings,\n * and can also be used to provide common properties to a group of components.\n */\nlet _Provider = React.forwardRef(Provider);\nexport {_Provider as Provider};\n\nconst ProviderWrapper = React.forwardRef(function ProviderWrapper(props: ProviderProps, ref: DOMRef<HTMLDivElement>) {\n let {\n children,\n ...otherProps\n } = props;\n let {locale, direction} = useLocale();\n let {theme, colorScheme, scale} = useProvider();\n let {modalProviderProps} = useModalProvider();\n let {styleProps} = useStyleProps(otherProps);\n let domRef = useDOMRef(ref);\n\n let themeKey = Object.keys(theme[colorScheme])[0];\n let scaleKey = Object.keys(theme[scale])[0];\n\n let className = clsx(\n styleProps.className,\n styles['spectrum'],\n typographyStyles['spectrum'],\n Object.values(theme[colorScheme]),\n Object.values(theme[scale]),\n theme.global ? Object.values(theme.global) : null,\n {\n 'react-spectrum-provider': shouldKeepSpectrumClassNames,\n spectrum: shouldKeepSpectrumClassNames,\n [themeKey]: shouldKeepSpectrumClassNames,\n [scaleKey]: shouldKeepSpectrumClassNames\n }\n );\n\n let style = {\n ...styleProps.style,\n // This ensures that browser native UI like scrollbars are rendered in the right color scheme.\n // See https://web.dev/color-scheme/.\n colorScheme: props.colorScheme ?? colorScheme ?? Object.keys(theme).filter(k => k === 'light' || k === 'dark').join(' ')\n };\n\n let hasWarned = useRef(false);\n useEffect(() => {\n if (direction && domRef.current) {\n let closestDir = domRef.current.parentElement.closest('[dir]');\n let dir = closestDir && closestDir.getAttribute('dir');\n if (dir && dir !== direction && !hasWarned.current) {\n console.warn(`Language directions cannot be nested. ${direction} inside ${dir}.`);\n hasWarned.current = true;\n }\n }\n }, [direction, domRef, hasWarned]);\n\n\n return (\n <div\n {...filterDOMProps(otherProps)}\n {...styleProps}\n {...modalProviderProps}\n className={className}\n style={style}\n lang={locale}\n dir={direction}\n ref={domRef}>\n {children}\n </div>\n );\n});\n\n/**\n * Returns the various settings and styles applied by the nearest parent Provider.\n * Properties explicitly set by the nearest parent Provider override those provided by preceeding Providers.\n */\nexport function useProvider(): ProviderContext {\n return useContext(Context);\n}\n\nexport function useProviderProps<T>(props: T) : T {\n let context = useProvider();\n if (!context) {\n return props;\n }\n return Object.assign({}, {\n isQuiet: context.isQuiet,\n isEmphasized: context.isEmphasized,\n isDisabled: context.isDisabled,\n isRequired: context.isRequired,\n isReadOnly: context.isReadOnly,\n validationState: context.validationState\n }, props);\n}\n","/*\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","/*\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\n@import './index.css';\n@import './skin.css';\n","/*\nCopyright 2019 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\n@import '../commons/index.css';\n@import 'font.css';\n\n/*@mixin typography .spectrum-Body1 {}\n@mixin typography .spectrum-Body2 {}\n@mixin typography .spectrum-Body3 {}\n@mixin typography .spectrum-Body4 {}\n@mixin typography .spectrum-Body5 {}\n@mixin typography .spectrum-Heading1 {}\n@mixin typography .spectrum-Heading2 {}\n@mixin typography .spectrum-Heading3 {}\n@mixin typography .spectrum-Heading4 {}\n@mixin typography .spectrum-Heading5 {}\n@mixin typography .spectrum-Heading6 {}\n@mixin typography .spectrum-Subheading {}\n@mixin typography .spectrum-Detail {}\n@mixin typography .spectrum-Heading1--quiet, heading-quiet-1 {}\n@mixin typography .spectrum-Heading2--quiet, heading-quiet-2 {}\n@mixin typography .spectrum-Heading1--strong, heading-strong-1 {}\n@mixin typography .spectrum-Heading2--strong, heading-strong-2 {}\n@mixin typography .spectrum-Heading1--display, display-1 {}\n@mixin typography .spectrum-Heading2--display, display-2 {}\n@mixin typography .spectrum-Heading1--display.spectrum-Heading1--strong, display-strong-1 {}\n@mixin typography .spectrum-Heading2--display.spectrum-Heading2--strong, display-strong-2 {}\n@mixin typography .spectrum-Heading1--display.spectrum-Heading1--quiet, display-quiet-1 {}\n@mixin typography .spectrum-Heading2--display.spectrum-Heading2--quiet, display-quiet-2 {}\n\n.spectrum-Typography {\n @mixin typographyMargins .spectrum-Body1 {}\n @mixin typographyMargins .spectrum-Body2 {}\n @mixin typographyMargins .spectrum-Body3 {}\n @mixin typographyMargins .spectrum-Body4 {}\n @mixin typographyMargins .spectrum-Body5 {}\n @mixin typographyMargins .spectrum-Heading1 {}\n @mixin typographyMargins .spectrum-Heading2 {}\n @mixin typographyMargins .spectrum-Heading3 {}\n @mixin typographyMargins .spectrum-Heading4 {}\n @mixin typographyMargins .spectrum-Heading5 {}\n @mixin typographyMargins .spectrum-Heading6 {}\n @mixin typographyMargins .spectrum-Subheading {}\n @mixin typographyMargins .spectrum-Detail {}\n @mixin typographyMargins .spectrum-Heading1--quiet, heading-quiet-1 {}\n @mixin typographyMargins .spectrum-Heading2--quiet, heading-quiet-2 {}\n @mixin typographyMargins .spectrum-Heading1--strong, heading-strong-1 {}\n @mixin typographyMargins .spectrum-Heading2--strong, heading-strong-2 {}\n @mixin typographyMargins .spectrum-Heading1--display, display-1 {}\n @mixin typographyMargins .spectrum-Heading2--display, display-2 {}\n @mixin typographyMargins .spectrum-Heading1--display.spectrum-Heading1--strong, display-strong-1 {}\n @mixin typographyMargins .spectrum-Heading2--display.spectrum-Heading2--strong, display-strong-2 {}\n @mixin typographyMargins .spectrum-Heading1--display.spectrum-Heading1--quiet, display-quiet-1 {}\n @mixin typographyMargins .spectrum-Heading2--display.spectrum-Heading2--quiet, display-quiet-2 {}\n}\n\n.spectrum-Article {\n font-family: var(--spectrum-body-article-1-text-font-family);\n @mixin typography .spectrum-Body1, body-article-1 {}\n @mixin typography .spectrum-Body2, body-article-2 {}\n @mixin typography .spectrum-Body3, body-article-3 {}\n @mixin typography .spectrum-Body4, body-article-4 {}\n @mixin typography .spectrum-Body5, body-article-5 {}\n @mixin typography .spectrum-Heading1, heading-article-1 {}\n @mixin typography .spectrum-Heading2, heading-article-2 {}\n @mixin typography .spectrum-Heading3, heading-article-3 {}\n @mixin typography .spectrum-Heading4, heading-article-4 {}\n @mixin typography .spectrum-Heading5, heading-article-5 {}\n @mixin typography .spectrum-Heading6, heading-article-6 {}\n @mixin typography .spectrum-Subheading, subheading-article {}\n @mixin typography .spectrum-Detail, detail-article {}\n @mixin typography .spectrum-Heading1--quiet, heading-quiet-article-1 {}\n @mixin typography .spectrum-Heading2--quiet, heading-quiet-article-2 {}\n @mixin typography .spectrum-Heading1--display, display-article-1 {}\n @mixin typography .spectrum-Heading2--display, display-article-2 {}\n @mixin typography .spectrum-Heading1--display.spectrum-Heading1--quiet, display-quiet-article-1 {}\n @mixin typography .spectrum-Heading2--display.spectrum-Heading2--quiet, display-quiet-article-2 {}\n}\n.spectrum {\n &:lang(ja),\n &:lang(ko),\n &:lang(zh) {\n @mixin typography .spectrum-Body1, body-han-1 {}\n @mixin typography .spectrum-Body2, body-han-2 {}\n @mixin typography .spectrum-Body3, body-han-3 {}\n @mixin typography .spectrum-Body4, body-han-4 {}\n @mixin typography .spectrum-Body5, body-han-5 {}\n @mixin typography .spectrum-Heading1, heading-han-1 {}\n @mixin typography .spectrum-Heading2, heading-han-2 {}\n @mixin typography .spectrum-Heading3, heading-han-3 {}\n @mixin typography .spectrum-Heading4, heading-han-4 {}\n @mixin typography .spectrum-Heading5, heading-han-5 {}\n @mixin typography .spectrum-Heading6, heading-han-6 {}\n @mixin typography .spectrum-Subheading, subheading-han {}\n @mixin typography .spectrum-Detail, detail-han {}\n @mixin typography .spectrum-Heading1--quiet, heading-quiet-han-1 {}\n @mixin typography .spectrum-Heading2--quiet, heading-quiet-han-2 {}\n @mixin typography .spectrum-Heading1--strong, heading-strong-han-1 {}\n @mixin typography .spectrum-Heading2--strong, heading-strong-han-2 {}\n @mixin typography .spectrum-Heading1--display, display-han-1 {}\n @mixin typography .spectrum-Heading2--display, display-han-2 {}\n @mixin typography .spectrum-Heading1--display.spectrum-Heading1--strong, display-strong-han-1 {}\n @mixin typography .spectrum-Heading2--display.spectrum-Heading2--strong, display-strong-han-2 {}\n @mixin typography .spectrum-Heading1--display.spectrum-Heading1--quiet, display-quiet-han-1 {}\n @mixin typography .spectrum-Heading2--display.spectrum-Heading2--quiet, display-quiet-han-2 {}\n }\n}\n@mixin typography .spectrum-Code1, body-code-1, true {\n font-family: var(--spectrum-body-code-1-text-font-family);\n}\n@mixin typography .spectrum-Code2, body-code-2, true {\n font-family: var(--spectrum-body-code-2-text-font-family);\n}\n@mixin typography .spectrum-Code3, body-code-3, true {\n font-family: var(--spectrum-body-code-3-text-font-family);\n}\n@mixin typography .spectrum-Code4, body-code-4, true {\n font-family: var(--spectrum-body-code-4-text-font-family);\n}\n@mixin typography .spectrum-Code5, body-code-5, true {\n font-family: var(--spectrum-body-code-5-text-font-family);\n}*/\n\n/*\n The &.spectrum makes it so users can do <div class=\"spectrum spectrum--large\"> and still get the right font sizes\n Without this, they would have to do <div class=\"spectrum--large\"><div class=\"spectrum\">, which makes no sense\n*/\n&.spectrum,\n&.spectrum-Body,\n.spectrum,\n.spectrum-Body {\n font-size: var(--spectrum-body-4-text-size);\n font-weight: var(--spectrum-body-4-text-font-weight);\n line-height: var(--spectrum-body-4-text-line-height);\n font-style: var(--spectrum-body-4-text-font-style);\n}\n\n.spectrum-Body--italic {\n font-style: var(--spectrum-body-4-emphasis-text-font-style);\n}\n\n/*\n.spectrum-Body--large {\n @extend .spectrum-Body2;\n}\n\n.spectrum-Body--small {\n @extend .spectrum-Body5;\n}\n\n.spectrum-Body--secondary {\n @extend .spectrum-Body4;\n}\n\n.spectrum-Heading--display {\n @extend .spectrum-Heading2--display.spectrum-Heading2--quiet;\n}\n\n.spectrum-Heading--pageTitle {\n @extend .spectrum-Heading2--quiet;\n}\n\n.spectrum-Heading--subtitle1 {\n @extend .spectrum-Heading4;\n}\n\n.spectrum-Heading--subtitle2 {\n @extend .spectrum-Heading6;\n}\n\n.spectrum-Heading--subtitle3 {\n @extend .spectrum-Subheading;\n}*/\n","/*\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 {ColorScheme, Scale} from '@react-types/provider';\nimport {Theme} from '@react-types/provider';\nimport {useMediaQuery} from '@react-spectrum/utils';\n\nexport function useColorScheme(theme: Theme, defaultColorScheme: ColorScheme): ColorScheme {\n let matchesDark = useMediaQuery('(prefers-color-scheme: dark)');\n let matchesLight = useMediaQuery('(prefers-color-scheme: light)');\n\n // importance OS > default > omitted\n\n if (theme.dark && matchesDark) {\n return 'dark';\n }\n\n if (theme.light && matchesLight) {\n return 'light';\n }\n\n if (theme.dark && defaultColorScheme === 'dark') {\n return 'dark';\n }\n\n if (theme.light && defaultColorScheme === 'light') {\n return 'light';\n }\n\n if (!theme.dark) {\n return 'light';\n }\n\n if (!theme.light) {\n return 'dark';\n }\n\n return 'light';\n}\n\nexport function useScale(theme: Theme): Scale {\n let matchesFine = useMediaQuery('(any-pointer: fine)');\n if (matchesFine && theme.medium) {\n return 'medium';\n }\n\n if (theme.large) {\n return 'large';\n }\n\n return 'medium';\n}\n","{\n \"name\": \"@react-spectrum/provider\",\n \"version\": \"3.6.1\",\n \"description\": \"Spectrum UI components in React\",\n \"license\": \"Apache-2.0\",\n \"main\": \"dist/main.js\",\n \"module\": \"dist/module.js\",\n \"exports\": {\n \"types\": \"./dist/types.d.ts\",\n \"import\": \"./dist/import.mjs\",\n \"require\": \"./dist/main.js\"\n },\n \"types\": \"dist/types.d.ts\",\n \"source\": \"src/index.ts\",\n \"files\": [\n \"dist\",\n \"src\"\n ],\n \"sideEffects\": [\n \"*.css\"\n ],\n \"targets\": {\n \"main\": {\n \"includeNodeModules\": [\n \"@adobe/spectrum-css-temp\"\n ]\n },\n \"module\": {\n \"includeNodeModules\": [\n \"@adobe/spectrum-css-temp\"\n ]\n }\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/adobe/react-spectrum\"\n },\n \"dependencies\": {\n \"@react-aria/i18n\": \"^3.6.3\",\n \"@react-aria/overlays\": \"^3.12.1\",\n \"@react-aria/utils\": \"^3.14.2\",\n \"@react-spectrum/utils\": \"^3.8.1\",\n \"@react-types/provider\": \"^3.5.5\",\n \"@react-types/shared\": \"^3.16.0\",\n \"@swc/helpers\": \"^0.4.14\",\n \"clsx\": \"^1.1.1\"\n },\n \"devDependencies\": {\n \"@adobe/spectrum-css-temp\": \"3.0.0-alpha.1\"\n },\n \"peerDependencies\": {\n \"react\": \"^16.8.0 || ^17.0.0-rc.1 || ^18.0.0\",\n \"react-dom\": \"^16.8.0 || ^17.0.0-rc.1 || ^18.0.0\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n }\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;
|
|
1
|
+
{"mappings":";;AEoHA;;;;GAIG;AACH,OAAA,IAAI,yIAAsC,CAAC;AAmE3C;;;GAGG;AACH,+BAA+B,eAAe,CAE7C;AAED,iCAAiC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAI,CAAC,CAahD;AClMD,YAAY,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAC;AAC3D,YAAY,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC","sources":["packages/@react-spectrum/provider/src/packages/@react-spectrum/provider/src/context.ts","packages/@react-spectrum/provider/src/packages/@react-spectrum/provider/src/mediaQueries.ts","packages/@react-spectrum/provider/src/packages/@react-spectrum/provider/src/Provider.tsx","packages/@react-spectrum/provider/src/packages/@react-spectrum/provider/src/index.ts","packages/@react-spectrum/provider/src/index.ts"],"sourcesContent":[null,null,null,null,"/*\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\n/// <reference types=\"css-module-types\" />\n\nexport {Provider, useProvider, useProviderProps} from './Provider';\nexport type {ProviderContext} from '@react-types/provider';\nexport type {ProviderProps} from '@react-types/provider';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-spectrum/provider",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
7
7
|
"module": "dist/module.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
"types": "./dist/types.d.ts",
|
|
10
|
+
"import": "./dist/import.mjs",
|
|
11
|
+
"require": "./dist/main.js"
|
|
12
|
+
},
|
|
8
13
|
"types": "dist/types.d.ts",
|
|
9
14
|
"source": "src/index.ts",
|
|
10
15
|
"files": [
|
|
@@ -31,13 +36,13 @@
|
|
|
31
36
|
"url": "https://github.com/adobe/react-spectrum"
|
|
32
37
|
},
|
|
33
38
|
"dependencies": {
|
|
34
|
-
"@
|
|
35
|
-
"@react-aria/
|
|
36
|
-
"@react-aria/
|
|
37
|
-
"@react-
|
|
38
|
-
"@react-
|
|
39
|
-
"@react-types/
|
|
40
|
-
"@
|
|
39
|
+
"@react-aria/i18n": "^3.7.0",
|
|
40
|
+
"@react-aria/overlays": "^3.13.0",
|
|
41
|
+
"@react-aria/utils": "^3.15.0",
|
|
42
|
+
"@react-spectrum/utils": "^3.9.0",
|
|
43
|
+
"@react-types/provider": "^3.6.0",
|
|
44
|
+
"@react-types/shared": "^3.17.0",
|
|
45
|
+
"@swc/helpers": "^0.4.14",
|
|
41
46
|
"clsx": "^1.1.1"
|
|
42
47
|
},
|
|
43
48
|
"devDependencies": {
|
|
@@ -50,5 +55,5 @@
|
|
|
50
55
|
"publishConfig": {
|
|
51
56
|
"access": "public"
|
|
52
57
|
},
|
|
53
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "a0efee84aa178cb1a202951dfd6d8de02b292307"
|
|
54
59
|
}
|
package/src/Provider.tsx
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
useStyleProps
|
|
19
19
|
} from '@react-spectrum/utils';
|
|
20
20
|
import clsx from 'clsx';
|
|
21
|
+
import {Context} from './context';
|
|
21
22
|
import {DOMRef} from '@react-types/shared';
|
|
22
23
|
import {filterDOMProps} from '@react-aria/utils';
|
|
23
24
|
import {I18nProvider, useLocale} from '@react-aria/i18n';
|
|
@@ -30,9 +31,6 @@ import {useColorScheme, useScale} from './mediaQueries';
|
|
|
30
31
|
// @ts-ignore
|
|
31
32
|
import {version} from '../package.json';
|
|
32
33
|
|
|
33
|
-
const Context = React.createContext<ProviderContext | null>(null);
|
|
34
|
-
Context.displayName = 'ProviderContext';
|
|
35
|
-
|
|
36
34
|
const DEFAULT_BREAKPOINTS = {S: 640, M: 768, L: 1024, XL: 1280, XXL: 1536};
|
|
37
35
|
|
|
38
36
|
function Provider(props: ProviderProps, ref: DOMRef<HTMLDivElement>) {
|
package/src/context.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import {ProviderContext} from '@react-types/provider';
|
|
14
|
+
import React from 'react';
|
|
15
|
+
|
|
16
|
+
// Context is placed in a separate file to avoid fast refresh issue where the old provider context values
|
|
17
|
+
// are immediately replaced with the null default. Stopgap solution until we fix this in parcel.
|
|
18
|
+
export const Context = React.createContext<ProviderContext | null>(null);
|
|
19
|
+
Context.displayName = 'ProviderContext';
|