@react-spectrum/provider 3.0.0-nightly-641446f65-240905

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +3 -0
  2. package/dist/Provider.main.js +181 -0
  3. package/dist/Provider.main.js.map +1 -0
  4. package/dist/Provider.mjs +174 -0
  5. package/dist/Provider.module.js +174 -0
  6. package/dist/Provider.module.js.map +1 -0
  7. package/dist/context.main.js +28 -0
  8. package/dist/context.main.js.map +1 -0
  9. package/dist/context.mjs +19 -0
  10. package/dist/context.module.js +19 -0
  11. package/dist/context.module.js.map +1 -0
  12. package/dist/import.mjs +18 -0
  13. package/dist/main.js +25 -0
  14. package/dist/main.js.map +1 -0
  15. package/dist/mediaQueries.main.js +41 -0
  16. package/dist/mediaQueries.main.js.map +1 -0
  17. package/dist/mediaQueries.mjs +35 -0
  18. package/dist/mediaQueries.module.js +35 -0
  19. package/dist/mediaQueries.module.js.map +1 -0
  20. package/dist/module.js +18 -0
  21. package/dist/module.js.map +1 -0
  22. package/dist/package.main.js +4 -0
  23. package/dist/package.main.js.map +1 -0
  24. package/dist/package.mjs +6 -0
  25. package/dist/package.module.js +6 -0
  26. package/dist/package.module.js.map +1 -0
  27. package/dist/page_vars_css.main.js +26 -0
  28. package/dist/page_vars_css.main.js.map +1 -0
  29. package/dist/page_vars_css.mjs +28 -0
  30. package/dist/page_vars_css.module.js +28 -0
  31. package/dist/page_vars_css.module.js.map +1 -0
  32. package/dist/types.d.ts +19 -0
  33. package/dist/types.d.ts.map +1 -0
  34. package/dist/typography.eea3ebfe.css +96 -0
  35. package/dist/typography.eea3ebfe.css.map +1 -0
  36. package/dist/typography_index_css.main.js +32 -0
  37. package/dist/typography_index_css.main.js.map +1 -0
  38. package/dist/typography_index_css.mjs +34 -0
  39. package/dist/typography_index_css.module.js +34 -0
  40. package/dist/typography_index_css.module.js.map +1 -0
  41. package/dist/vars.3c44f451.css +85 -0
  42. package/dist/vars.3c44f451.css.map +1 -0
  43. package/package.json +59 -0
  44. package/src/Provider.tsx +215 -0
  45. package/src/context.ts +19 -0
  46. package/src/index.ts +17 -0
  47. package/src/mediaQueries.ts +60 -0
@@ -0,0 +1,34 @@
1
+
2
+ function $parcel$export(e, n, v, s) {
3
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
4
+ }
5
+ var $5cac98e4c80e6707$exports = {};
6
+
7
+ $parcel$export($5cac98e4c80e6707$exports, "focus-ring", () => $5cac98e4c80e6707$export$f39a09f249340e2a, (v) => $5cac98e4c80e6707$export$f39a09f249340e2a = v);
8
+ $parcel$export($5cac98e4c80e6707$exports, "i18nFontFamily", () => $5cac98e4c80e6707$export$8c4ee2c50c22c514, (v) => $5cac98e4c80e6707$export$8c4ee2c50c22c514 = v);
9
+ $parcel$export($5cac98e4c80e6707$exports, "spectrum", () => $5cac98e4c80e6707$export$3311ab3a441bc141, (v) => $5cac98e4c80e6707$export$3311ab3a441bc141 = v);
10
+ $parcel$export($5cac98e4c80e6707$exports, "spectrum-Body", () => $5cac98e4c80e6707$export$a30bf7810c8453d1, (v) => $5cac98e4c80e6707$export$a30bf7810c8453d1 = v);
11
+ $parcel$export($5cac98e4c80e6707$exports, "spectrum-Body--italic", () => $5cac98e4c80e6707$export$7b2dac1166f6ec4c, (v) => $5cac98e4c80e6707$export$7b2dac1166f6ec4c = v);
12
+ $parcel$export($5cac98e4c80e6707$exports, "spectrum-FocusRing-ring", () => $5cac98e4c80e6707$export$4109102f950813a6, (v) => $5cac98e4c80e6707$export$4109102f950813a6 = v);
13
+ $parcel$export($5cac98e4c80e6707$exports, "spectrum-FocusRing", () => $5cac98e4c80e6707$export$24c7f46a6e3605dd, (v) => $5cac98e4c80e6707$export$24c7f46a6e3605dd = v);
14
+ $parcel$export($5cac98e4c80e6707$exports, "spectrum-FocusRing--quiet", () => $5cac98e4c80e6707$export$2927016961429360, (v) => $5cac98e4c80e6707$export$2927016961429360 = v);
15
+ var $5cac98e4c80e6707$export$f39a09f249340e2a;
16
+ var $5cac98e4c80e6707$export$8c4ee2c50c22c514;
17
+ var $5cac98e4c80e6707$export$3311ab3a441bc141;
18
+ var $5cac98e4c80e6707$export$a30bf7810c8453d1;
19
+ var $5cac98e4c80e6707$export$7b2dac1166f6ec4c;
20
+ var $5cac98e4c80e6707$export$4109102f950813a6;
21
+ var $5cac98e4c80e6707$export$24c7f46a6e3605dd;
22
+ var $5cac98e4c80e6707$export$2927016961429360;
23
+ $5cac98e4c80e6707$export$f39a09f249340e2a = `_5QszkG_focus-ring`;
24
+ $5cac98e4c80e6707$export$8c4ee2c50c22c514 = `_5QszkG_i18nFontFamily`;
25
+ $5cac98e4c80e6707$export$3311ab3a441bc141 = `_5QszkG_spectrum ${$5cac98e4c80e6707$export$8c4ee2c50c22c514}`;
26
+ $5cac98e4c80e6707$export$a30bf7810c8453d1 = `_5QszkG_spectrum-Body`;
27
+ $5cac98e4c80e6707$export$7b2dac1166f6ec4c = `_5QszkG_spectrum-Body--italic`;
28
+ $5cac98e4c80e6707$export$4109102f950813a6 = `_5QszkG_spectrum-FocusRing-ring`;
29
+ $5cac98e4c80e6707$export$24c7f46a6e3605dd = `_5QszkG_spectrum-FocusRing ${$5cac98e4c80e6707$export$4109102f950813a6}`;
30
+ $5cac98e4c80e6707$export$2927016961429360 = `_5QszkG_spectrum-FocusRing--quiet`;
31
+
32
+
33
+ export {$5cac98e4c80e6707$exports as default};
34
+ //# sourceMappingURL=typography_index_css.module.js.map
@@ -0,0 +1,34 @@
1
+
2
+ function $parcel$export(e, n, v, s) {
3
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
4
+ }
5
+ var $5cac98e4c80e6707$exports = {};
6
+
7
+ $parcel$export($5cac98e4c80e6707$exports, "focus-ring", () => $5cac98e4c80e6707$export$f39a09f249340e2a, (v) => $5cac98e4c80e6707$export$f39a09f249340e2a = v);
8
+ $parcel$export($5cac98e4c80e6707$exports, "i18nFontFamily", () => $5cac98e4c80e6707$export$8c4ee2c50c22c514, (v) => $5cac98e4c80e6707$export$8c4ee2c50c22c514 = v);
9
+ $parcel$export($5cac98e4c80e6707$exports, "spectrum", () => $5cac98e4c80e6707$export$3311ab3a441bc141, (v) => $5cac98e4c80e6707$export$3311ab3a441bc141 = v);
10
+ $parcel$export($5cac98e4c80e6707$exports, "spectrum-Body", () => $5cac98e4c80e6707$export$a30bf7810c8453d1, (v) => $5cac98e4c80e6707$export$a30bf7810c8453d1 = v);
11
+ $parcel$export($5cac98e4c80e6707$exports, "spectrum-Body--italic", () => $5cac98e4c80e6707$export$7b2dac1166f6ec4c, (v) => $5cac98e4c80e6707$export$7b2dac1166f6ec4c = v);
12
+ $parcel$export($5cac98e4c80e6707$exports, "spectrum-FocusRing-ring", () => $5cac98e4c80e6707$export$4109102f950813a6, (v) => $5cac98e4c80e6707$export$4109102f950813a6 = v);
13
+ $parcel$export($5cac98e4c80e6707$exports, "spectrum-FocusRing", () => $5cac98e4c80e6707$export$24c7f46a6e3605dd, (v) => $5cac98e4c80e6707$export$24c7f46a6e3605dd = v);
14
+ $parcel$export($5cac98e4c80e6707$exports, "spectrum-FocusRing--quiet", () => $5cac98e4c80e6707$export$2927016961429360, (v) => $5cac98e4c80e6707$export$2927016961429360 = v);
15
+ var $5cac98e4c80e6707$export$f39a09f249340e2a;
16
+ var $5cac98e4c80e6707$export$8c4ee2c50c22c514;
17
+ var $5cac98e4c80e6707$export$3311ab3a441bc141;
18
+ var $5cac98e4c80e6707$export$a30bf7810c8453d1;
19
+ var $5cac98e4c80e6707$export$7b2dac1166f6ec4c;
20
+ var $5cac98e4c80e6707$export$4109102f950813a6;
21
+ var $5cac98e4c80e6707$export$24c7f46a6e3605dd;
22
+ var $5cac98e4c80e6707$export$2927016961429360;
23
+ $5cac98e4c80e6707$export$f39a09f249340e2a = `_5QszkG_focus-ring`;
24
+ $5cac98e4c80e6707$export$8c4ee2c50c22c514 = `_5QszkG_i18nFontFamily`;
25
+ $5cac98e4c80e6707$export$3311ab3a441bc141 = `_5QszkG_spectrum ${$5cac98e4c80e6707$export$8c4ee2c50c22c514}`;
26
+ $5cac98e4c80e6707$export$a30bf7810c8453d1 = `_5QszkG_spectrum-Body`;
27
+ $5cac98e4c80e6707$export$7b2dac1166f6ec4c = `_5QszkG_spectrum-Body--italic`;
28
+ $5cac98e4c80e6707$export$4109102f950813a6 = `_5QszkG_spectrum-FocusRing-ring`;
29
+ $5cac98e4c80e6707$export$24c7f46a6e3605dd = `_5QszkG_spectrum-FocusRing ${$5cac98e4c80e6707$export$4109102f950813a6}`;
30
+ $5cac98e4c80e6707$export$2927016961429360 = `_5QszkG_spectrum-FocusRing--quiet`;
31
+
32
+
33
+ export {$5cac98e4c80e6707$exports as default};
34
+ //# sourceMappingURL=typography_index_css.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;AAAA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AAPA,4CAA+B,CAAC,kBAAkB,CAAC;AACnD,4CAAmC,CAAC,sBAAsB,CAAC;AAC3D,4CAA6B,CAAC,iBAAiB,EAAE,0CAAiC,CAAC;AACnF,4CAAkC,CAAC,qBAAqB,CAAC;AACzD,4CAA0C,CAAC,6BAA6B,CAAC;AACzE,4CAA4C,CAAC,+BAA+B,CAAC;AAC7E,4CAAuC,CAAC,2BAA2B,EAAE,0CAA0C,CAAC;AAChH,4CAA8C,CAAC,iCAAiC,CAAC","sources":["packages/@adobe/spectrum-css-temp/components/typography/index.css"],"sourcesContent":["/*\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"],"names":[],"version":3,"file":"typography_index_css.module.js.map"}
@@ -0,0 +1,85 @@
1
+ .JuTe6q_i18nFontFamily {
2
+ font-synthesis: weight;
3
+ font-family: adobe-clean, Source Sans Pro, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Ubuntu, Trebuchet MS, Lucida Grande, sans-serif;
4
+ }
5
+
6
+ .JuTe6q_i18nFontFamily:lang(ar) {
7
+ font-family: myriad-arabic, adobe-clean, Source Sans Pro, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Ubuntu, Trebuchet MS, Lucida Grande, sans-serif;
8
+ }
9
+
10
+ .JuTe6q_i18nFontFamily:lang(he) {
11
+ font-family: myriad-hebrew, adobe-clean, Source Sans Pro, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Ubuntu, Trebuchet MS, Lucida Grande, sans-serif;
12
+ }
13
+
14
+ .JuTe6q_i18nFontFamily:lang(zh) {
15
+ font-family: adobe-clean-han-traditional, source-han-traditional, MingLiu, Heiti TC Light, sans-serif;
16
+ }
17
+
18
+ .JuTe6q_i18nFontFamily:lang(zh-Hans) {
19
+ font-family: adobe-clean-han-simplified-c, source-han-simplified-c, SimSun, Heiti SC Light, sans-serif;
20
+ }
21
+
22
+ .JuTe6q_i18nFontFamily:lang(zh-Hant) {
23
+ font-family: adobe-clean-han-traditional, source-han-traditional, MingLiu, Microsoft JhengHei UI, Microsoft JhengHei, Heiti TC Light, sans-serif;
24
+ }
25
+
26
+ .JuTe6q_i18nFontFamily:lang(zh-SG), .JuTe6q_i18nFontFamily:lang(zh-CN) {
27
+ font-family: adobe-clean-han-simplified-c, source-han-simplified-c, SimSun, Heiti SC Light, sans-serif;
28
+ }
29
+
30
+ .JuTe6q_i18nFontFamily:lang(ko) {
31
+ font-family: adobe-clean-han-korean, source-han-korean, Malgun Gothic, Apple Gothic, sans-serif;
32
+ }
33
+
34
+ .JuTe6q_i18nFontFamily:lang(ja) {
35
+ font-family: adobe-clean-han-japanese, Hiragino Kaku Gothic ProN, ヒラギノ角ゴ ProN W3, Osaka, YuGothic, Yu Gothic, メイリオ, Meiryo, MS Pゴシック, MS PGothic, sans-serif;
36
+ }
37
+
38
+ .JuTe6q_spectrum-FocusRing-ring {
39
+ --spectrum-focus-ring-border-radius: var(--spectrum-textfield-border-radius, var(--spectrum-alias-border-radius-regular));
40
+ --spectrum-focus-ring-gap: var(--spectrum-alias-input-focusring-gap);
41
+ --spectrum-focus-ring-size: var(--spectrum-alias-input-focusring-size);
42
+ --spectrum-focus-ring-border-size: 0px;
43
+ --spectrum-focus-ring-color: var(--spectrum-high-contrast-focus-ring-color, var(--spectrum-alias-focus-ring-color, var(--spectrum-alias-focus-color)));
44
+ }
45
+
46
+ .JuTe6q_spectrum-FocusRing-ring:after {
47
+ border-radius: calc(var(--spectrum-focus-ring-border-radius) + var(--spectrum-focus-ring-gap));
48
+ content: "";
49
+ margin: calc(-1 * var(--spectrum-focus-ring-border-size));
50
+ pointer-events: none;
51
+ transition: box-shadow var(--spectrum-global-animation-duration-100, .13s) ease-out, margin var(--spectrum-global-animation-duration-100, .13s) ease-out;
52
+ display: block;
53
+ position: absolute;
54
+ inset: 0;
55
+ }
56
+
57
+ .JuTe6q_spectrum-FocusRing.JuTe6q_focus-ring:after {
58
+ margin: calc(var(--spectrum-focus-ring-gap) * -1 - var(--spectrum-focus-ring-border-size));
59
+ box-shadow: 0 0 0 var(--spectrum-focus-ring-size) var(--spectrum-focus-ring-color);
60
+ }
61
+
62
+ .JuTe6q_spectrum-FocusRing--quiet:after {
63
+ border-radius: 0;
64
+ }
65
+
66
+ .JuTe6q_spectrum-FocusRing--quiet.JuTe6q_focus-ring:after {
67
+ margin: 0 0 calc(var(--spectrum-focus-ring-gap) * -1 - var(--spectrum-focus-ring-border-size)) 0;
68
+ box-shadow: 0 var(--spectrum-focus-ring-size) 0 var(--spectrum-focus-ring-color);
69
+ }
70
+
71
+ @media (forced-colors: active) {
72
+ .JuTe6q_spectrum-FocusRing, .JuTe6q_spectrum-FocusRing-ring, .JuTe6q_spectrum-FocusRing--quiet {
73
+ --spectrum-high-contrast-focus-ring-color: Highlight;
74
+ }
75
+
76
+ :is(.JuTe6q_spectrum-FocusRing, .JuTe6q_spectrum-FocusRing-ring, .JuTe6q_spectrum-FocusRing--quiet):after {
77
+ forced-color-adjust: none;
78
+ }
79
+ }
80
+
81
+ .JuTe6q_spectrum {
82
+ background-color: var(--spectrum-alias-background-color-default, var(--spectrum-global-color-gray-100));
83
+ -webkit-tap-highlight-color: #0000;
84
+ }
85
+ /*# sourceMappingURL=vars.3c44f451.css.map */
@@ -0,0 +1 @@
1
+ {"mappings":"AA4DA;;;;;AAIE;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAQA;;;;AAIA;;;;AAKF;;;;;;;;AAOE;;;;;;;;;;;AAqBE;;;;;AAQF;;;;AAKE;;;;;AAOJ;EACE;;;;EAIE;;;;;AAkBJ","sources":["packages/@adobe/spectrum-css-temp/components/page/vars.css"],"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@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"vars.3c44f451.css.map"}
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@react-spectrum/provider",
3
+ "version": "3.0.0-nightly-641446f65-240905",
4
+ "description": "Spectrum UI components in React",
5
+ "license": "Apache-2.0",
6
+ "main": "dist/main.js",
7
+ "module": "dist/module.js",
8
+ "exports": {
9
+ "types": "./dist/types.d.ts",
10
+ "import": "./dist/import.mjs",
11
+ "require": "./dist/main.js"
12
+ },
13
+ "types": "dist/types.d.ts",
14
+ "source": "src/index.ts",
15
+ "files": [
16
+ "dist",
17
+ "src"
18
+ ],
19
+ "sideEffects": [
20
+ "*.css"
21
+ ],
22
+ "targets": {
23
+ "main": {
24
+ "includeNodeModules": [
25
+ "@adobe/spectrum-css-temp"
26
+ ]
27
+ },
28
+ "module": {
29
+ "includeNodeModules": [
30
+ "@adobe/spectrum-css-temp"
31
+ ]
32
+ }
33
+ },
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "https://github.com/adobe/react-spectrum"
37
+ },
38
+ "dependencies": {
39
+ "@react-aria/i18n": "^3.0.0-nightly-641446f65-240905",
40
+ "@react-aria/overlays": "^3.0.0-nightly-641446f65-240905",
41
+ "@react-aria/utils": "^3.0.0-nightly-641446f65-240905",
42
+ "@react-spectrum/utils": "^3.0.0-nightly-641446f65-240905",
43
+ "@react-types/provider": "^3.0.0-nightly-641446f65-240905",
44
+ "@react-types/shared": "^3.0.0-nightly-641446f65-240905",
45
+ "@swc/helpers": "^0.5.0",
46
+ "clsx": "^2.0.0"
47
+ },
48
+ "devDependencies": {
49
+ "@adobe/spectrum-css-temp": "3.0.0-alpha.1"
50
+ },
51
+ "peerDependencies": {
52
+ "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0",
53
+ "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
54
+ },
55
+ "publishConfig": {
56
+ "access": "public"
57
+ },
58
+ "stableVersion": "3.9.10"
59
+ }
@@ -0,0 +1,215 @@
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 {
14
+ BreakpointProvider,
15
+ shouldKeepSpectrumClassNames,
16
+ useDOMRef,
17
+ useMatchedBreakpoints,
18
+ useStyleProps
19
+ } from '@react-spectrum/utils';
20
+ import clsx from 'clsx';
21
+ import {Context} from './context';
22
+ import {DOMRef} from '@react-types/shared';
23
+ import {filterDOMProps, RouterProvider} from '@react-aria/utils';
24
+ import {I18nProvider, useLocale} from '@react-aria/i18n';
25
+ import {ModalProvider, useModalProvider} from '@react-aria/overlays';
26
+ import {ProviderContext, ProviderProps} from '@react-types/provider';
27
+ import React, {useContext, useEffect, useRef} from 'react';
28
+ import styles from '@adobe/spectrum-css-temp/components/page/vars.css';
29
+ import typographyStyles from '@adobe/spectrum-css-temp/components/typography/index.css';
30
+ import {useColorScheme, useScale} from './mediaQueries';
31
+ // @ts-ignore
32
+ import {version} from '../package.json';
33
+
34
+ const DEFAULT_BREAKPOINTS = {S: 640, M: 768, L: 1024, XL: 1280, XXL: 1536};
35
+
36
+ function Provider(props: ProviderProps, ref: DOMRef<HTMLDivElement>) {
37
+ let prevContext = useProvider();
38
+ let prevColorScheme = prevContext && prevContext.colorScheme;
39
+ let prevBreakpoints = prevContext && prevContext.breakpoints;
40
+ let {
41
+ theme = prevContext && prevContext.theme,
42
+ defaultColorScheme
43
+ } = props;
44
+ if (!theme) {
45
+ throw new Error('theme not found, the parent provider must have a theme provided');
46
+ }
47
+ // Hooks must always be called.
48
+ let autoColorScheme = useColorScheme(theme, defaultColorScheme);
49
+ let autoScale = useScale(theme);
50
+ let {locale: prevLocale} = useLocale();
51
+ // if the new theme doesn't support the prevColorScheme, we must resort to the auto
52
+ let usePrevColorScheme = !!theme[prevColorScheme];
53
+
54
+ // importance of color scheme props > parent > auto:(OS > default > omitted)
55
+ let {
56
+ colorScheme = usePrevColorScheme ? prevColorScheme : autoColorScheme,
57
+ scale = prevContext ? prevContext.scale : autoScale,
58
+ locale = prevContext ? prevLocale : null,
59
+ breakpoints = prevContext ? prevBreakpoints : DEFAULT_BREAKPOINTS,
60
+ children,
61
+ isQuiet,
62
+ isEmphasized,
63
+ isDisabled,
64
+ isRequired,
65
+ isReadOnly,
66
+ validationState,
67
+ router,
68
+ ...otherProps
69
+ } = props;
70
+
71
+ // select only the props with values so undefined props don't overwrite prevContext values
72
+ let currentProps = {
73
+ version,
74
+ theme,
75
+ breakpoints,
76
+ colorScheme,
77
+ scale,
78
+ isQuiet,
79
+ isEmphasized,
80
+ isDisabled,
81
+ isRequired,
82
+ isReadOnly,
83
+ validationState
84
+ };
85
+
86
+ let matchedBreakpoints = useMatchedBreakpoints(breakpoints);
87
+ let filteredProps = {};
88
+ Object.entries(currentProps).forEach(([key, value]) => value !== undefined && (filteredProps[key] = value));
89
+
90
+ // Merge options with parent provider
91
+ let context = Object.assign({}, prevContext, filteredProps);
92
+
93
+ // Only wrap in a DOM node if the theme, colorScheme, or scale changed
94
+ let contents = children;
95
+ let domProps = filterDOMProps(otherProps);
96
+ let {styleProps} = useStyleProps(otherProps, undefined, {matchedBreakpoints});
97
+ 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) {
98
+ contents = (
99
+ <ProviderWrapper {...props} UNSAFE_style={{isolation: !prevContext ? 'isolate' : undefined, ...styleProps.style}} ref={ref}>
100
+ {contents}
101
+ </ProviderWrapper>
102
+ );
103
+ }
104
+
105
+ if (router) {
106
+ contents = <RouterProvider {...router}>{contents}</RouterProvider>;
107
+ }
108
+
109
+ return (
110
+ <Context.Provider value={context}>
111
+ <I18nProvider locale={locale}>
112
+ <BreakpointProvider matchedBreakpoints={matchedBreakpoints}>
113
+ <ModalProvider>
114
+ {contents}
115
+ </ModalProvider>
116
+ </BreakpointProvider>
117
+ </I18nProvider>
118
+ </Context.Provider>
119
+ );
120
+ }
121
+
122
+ /**
123
+ * Provider is the container for all React Spectrum applications.
124
+ * It defines the theme, locale, and other application level settings,
125
+ * and can also be used to provide common properties to a group of components.
126
+ */
127
+ let _Provider = React.forwardRef(Provider);
128
+ export {_Provider as Provider};
129
+
130
+ const ProviderWrapper = React.forwardRef(function ProviderWrapper(props: ProviderProps, ref: DOMRef<HTMLDivElement>) {
131
+ let {
132
+ children,
133
+ ...otherProps
134
+ } = props;
135
+ let {locale, direction} = useLocale();
136
+ let {theme, colorScheme, scale} = useProvider();
137
+ let {modalProviderProps} = useModalProvider();
138
+ let {styleProps} = useStyleProps(otherProps);
139
+ let domRef = useDOMRef(ref);
140
+
141
+ let themeKey = Object.keys(theme[colorScheme])[0];
142
+ let scaleKey = Object.keys(theme[scale])[0];
143
+
144
+ let className = clsx(
145
+ styleProps.className,
146
+ styles['spectrum'],
147
+ typographyStyles['spectrum'],
148
+ Object.values(theme[colorScheme]),
149
+ Object.values(theme[scale]),
150
+ theme.global ? Object.values(theme.global) : null,
151
+ {
152
+ 'react-spectrum-provider': shouldKeepSpectrumClassNames,
153
+ spectrum: shouldKeepSpectrumClassNames,
154
+ [themeKey]: shouldKeepSpectrumClassNames,
155
+ [scaleKey]: shouldKeepSpectrumClassNames
156
+ }
157
+ );
158
+
159
+ let style = {
160
+ ...styleProps.style,
161
+ // This ensures that browser native UI like scrollbars are rendered in the right color scheme.
162
+ // See https://web.dev/color-scheme/.
163
+ colorScheme: props.colorScheme ?? colorScheme ?? Object.keys(theme).filter(k => k === 'light' || k === 'dark').join(' ')
164
+ };
165
+
166
+ let hasWarned = useRef(false);
167
+ useEffect(() => {
168
+ if (direction && domRef.current) {
169
+ let closestDir = domRef.current.parentElement.closest('[dir]');
170
+ let dir = closestDir && closestDir.getAttribute('dir');
171
+ if (dir && dir !== direction && !hasWarned.current) {
172
+ console.warn(`Language directions cannot be nested. ${direction} inside ${dir}.`);
173
+ hasWarned.current = true;
174
+ }
175
+ }
176
+ }, [direction, domRef, hasWarned]);
177
+
178
+
179
+ return (
180
+ <div
181
+ {...filterDOMProps(otherProps)}
182
+ {...styleProps}
183
+ {...modalProviderProps}
184
+ className={className}
185
+ style={style}
186
+ lang={locale}
187
+ dir={direction}
188
+ ref={domRef}>
189
+ {children}
190
+ </div>
191
+ );
192
+ });
193
+
194
+ /**
195
+ * Returns the various settings and styles applied by the nearest parent Provider.
196
+ * Properties explicitly set by the nearest parent Provider override those provided by preceeding Providers.
197
+ */
198
+ export function useProvider(): ProviderContext {
199
+ return useContext(Context);
200
+ }
201
+
202
+ export function useProviderProps<T>(props: T) : T {
203
+ let context = useProvider();
204
+ if (!context) {
205
+ return props;
206
+ }
207
+ return Object.assign({}, {
208
+ isQuiet: context.isQuiet,
209
+ isEmphasized: context.isEmphasized,
210
+ isDisabled: context.isDisabled,
211
+ isRequired: context.isRequired,
212
+ isReadOnly: context.isReadOnly,
213
+ validationState: context.validationState
214
+ }, props);
215
+ }
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';
package/src/index.ts ADDED
@@ -0,0 +1,17 @@
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
+ /// <reference types="css-module-types" />
14
+
15
+ export {Provider, useProvider, useProviderProps} from './Provider';
16
+ export type {ProviderContext} from '@react-types/provider';
17
+ export type {ProviderProps} from '@react-types/provider';
@@ -0,0 +1,60 @@
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 {ColorScheme, Scale, Theme} from '@react-types/provider';
14
+ import {useMediaQuery} from '@react-spectrum/utils';
15
+
16
+ export function useColorScheme(theme: Theme, defaultColorScheme: ColorScheme): ColorScheme {
17
+ let matchesDark = useMediaQuery('(prefers-color-scheme: dark)');
18
+ let matchesLight = useMediaQuery('(prefers-color-scheme: light)');
19
+
20
+ // importance OS > default > omitted
21
+
22
+ if (theme.dark && matchesDark) {
23
+ return 'dark';
24
+ }
25
+
26
+ if (theme.light && matchesLight) {
27
+ return 'light';
28
+ }
29
+
30
+ if (theme.dark && defaultColorScheme === 'dark') {
31
+ return 'dark';
32
+ }
33
+
34
+ if (theme.light && defaultColorScheme === 'light') {
35
+ return 'light';
36
+ }
37
+
38
+ if (!theme.dark) {
39
+ return 'light';
40
+ }
41
+
42
+ if (!theme.light) {
43
+ return 'dark';
44
+ }
45
+
46
+ return 'light';
47
+ }
48
+
49
+ export function useScale(theme: Theme): Scale {
50
+ let matchesFine = useMediaQuery('(any-pointer: fine)');
51
+ if (matchesFine && theme.medium) {
52
+ return 'medium';
53
+ }
54
+
55
+ if (theme.large) {
56
+ return 'large';
57
+ }
58
+
59
+ return 'medium';
60
+ }