@react-spectrum/color 3.1.7 → 3.2.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.
Files changed (290) hide show
  1. package/dist/import.mjs +9 -11
  2. package/dist/main.js +18 -20
  3. package/dist/main.js.map +1 -1
  4. package/dist/module.js +9 -11
  5. package/dist/module.js.map +1 -1
  6. package/dist/types/src/index.d.ts +16 -0
  7. package/package.json +14 -41
  8. package/src/index.ts +17 -15
  9. package/dist/ColorArea.main.js +0 -95
  10. package/dist/ColorArea.main.js.map +0 -1
  11. package/dist/ColorArea.mjs +0 -90
  12. package/dist/ColorArea.module.js +0 -90
  13. package/dist/ColorArea.module.js.map +0 -1
  14. package/dist/ColorEditor.main.js +0 -113
  15. package/dist/ColorEditor.main.js.map +0 -1
  16. package/dist/ColorEditor.mjs +0 -108
  17. package/dist/ColorEditor.module.js +0 -108
  18. package/dist/ColorEditor.module.js.map +0 -1
  19. package/dist/ColorField.main.js +0 -105
  20. package/dist/ColorField.main.js.map +0 -1
  21. package/dist/ColorField.mjs +0 -100
  22. package/dist/ColorField.module.js +0 -100
  23. package/dist/ColorField.module.js.map +0 -1
  24. package/dist/ColorPicker.main.js +0 -123
  25. package/dist/ColorPicker.main.js.map +0 -1
  26. package/dist/ColorPicker.mjs +0 -114
  27. package/dist/ColorPicker.module.js +0 -114
  28. package/dist/ColorPicker.module.js.map +0 -1
  29. package/dist/ColorSlider.main.js +0 -126
  30. package/dist/ColorSlider.main.js.map +0 -1
  31. package/dist/ColorSlider.mjs +0 -121
  32. package/dist/ColorSlider.module.js +0 -121
  33. package/dist/ColorSlider.module.js.map +0 -1
  34. package/dist/ColorSwatch.main.js +0 -91
  35. package/dist/ColorSwatch.main.js.map +0 -1
  36. package/dist/ColorSwatch.mjs +0 -81
  37. package/dist/ColorSwatch.module.js +0 -81
  38. package/dist/ColorSwatch.module.js.map +0 -1
  39. package/dist/ColorSwatchPicker.main.js +0 -112
  40. package/dist/ColorSwatchPicker.main.js.map +0 -1
  41. package/dist/ColorSwatchPicker.mjs +0 -103
  42. package/dist/ColorSwatchPicker.module.js +0 -103
  43. package/dist/ColorSwatchPicker.module.js.map +0 -1
  44. package/dist/ColorThumb.main.js +0 -146
  45. package/dist/ColorThumb.main.js.map +0 -1
  46. package/dist/ColorThumb.mjs +0 -141
  47. package/dist/ColorThumb.module.js +0 -141
  48. package/dist/ColorThumb.module.js.map +0 -1
  49. package/dist/ColorWheel.main.js +0 -114
  50. package/dist/ColorWheel.main.js.map +0 -1
  51. package/dist/ColorWheel.mjs +0 -109
  52. package/dist/ColorWheel.module.js +0 -109
  53. package/dist/ColorWheel.module.js.map +0 -1
  54. package/dist/ar-AE.main.js +0 -10
  55. package/dist/ar-AE.main.js.map +0 -1
  56. package/dist/ar-AE.mjs +0 -12
  57. package/dist/ar-AE.module.js +0 -12
  58. package/dist/ar-AE.module.js.map +0 -1
  59. package/dist/bg-BG.main.js +0 -10
  60. package/dist/bg-BG.main.js.map +0 -1
  61. package/dist/bg-BG.mjs +0 -12
  62. package/dist/bg-BG.module.js +0 -12
  63. package/dist/bg-BG.module.js.map +0 -1
  64. package/dist/color.0da417e8.css +0 -93
  65. package/dist/color.0da417e8.css.map +0 -1
  66. package/dist/color.4034864f.css +0 -120
  67. package/dist/color.4034864f.css.map +0 -1
  68. package/dist/color.51750948.css +0 -356
  69. package/dist/color.51750948.css.map +0 -1
  70. package/dist/color.6dfdb0cd.css +0 -260
  71. package/dist/color.6dfdb0cd.css.map +0 -1
  72. package/dist/color.85d29c28.css +0 -12
  73. package/dist/color.85d29c28.css.map +0 -1
  74. package/dist/color.8e3b650f.css +0 -93
  75. package/dist/color.8e3b650f.css.map +0 -1
  76. package/dist/color.a5310285.css +0 -206
  77. package/dist/color.a5310285.css.map +0 -1
  78. package/dist/color.decac5a6.css +0 -20
  79. package/dist/color.decac5a6.css.map +0 -1
  80. package/dist/color.f801bfa3.css +0 -75
  81. package/dist/color.f801bfa3.css.map +0 -1
  82. package/dist/color.ff589589.css +0 -41
  83. package/dist/color.ff589589.css.map +0 -1
  84. package/dist/colorarea_vars_css.main.js +0 -29
  85. package/dist/colorarea_vars_css.main.js.map +0 -1
  86. package/dist/colorarea_vars_css.mjs +0 -31
  87. package/dist/colorarea_vars_css.module.js +0 -31
  88. package/dist/colorarea_vars_css.module.js.map +0 -1
  89. package/dist/colorfield_css.main.js +0 -11
  90. package/dist/colorfield_css.main.js.map +0 -1
  91. package/dist/colorfield_css.mjs +0 -13
  92. package/dist/colorfield_css.module.js +0 -13
  93. package/dist/colorfield_css.module.js.map +0 -1
  94. package/dist/colorhandle_vars_css.main.js +0 -26
  95. package/dist/colorhandle_vars_css.main.js.map +0 -1
  96. package/dist/colorhandle_vars_css.mjs +0 -28
  97. package/dist/colorhandle_vars_css.module.js +0 -28
  98. package/dist/colorhandle_vars_css.module.js.map +0 -1
  99. package/dist/colorloupe_vars_css.main.js +0 -23
  100. package/dist/colorloupe_vars_css.main.js.map +0 -1
  101. package/dist/colorloupe_vars_css.mjs +0 -25
  102. package/dist/colorloupe_vars_css.module.js +0 -25
  103. package/dist/colorloupe_vars_css.module.js.map +0 -1
  104. package/dist/colorslider_vars_css.main.js +0 -53
  105. package/dist/colorslider_vars_css.main.js.map +0 -1
  106. package/dist/colorslider_vars_css.mjs +0 -55
  107. package/dist/colorslider_vars_css.module.js +0 -55
  108. package/dist/colorslider_vars_css.module.js.map +0 -1
  109. package/dist/colorwheel_vars_css.main.js +0 -35
  110. package/dist/colorwheel_vars_css.main.js.map +0 -1
  111. package/dist/colorwheel_vars_css.mjs +0 -37
  112. package/dist/colorwheel_vars_css.module.js +0 -37
  113. package/dist/colorwheel_vars_css.module.js.map +0 -1
  114. package/dist/cs-CZ.main.js +0 -10
  115. package/dist/cs-CZ.main.js.map +0 -1
  116. package/dist/cs-CZ.mjs +0 -12
  117. package/dist/cs-CZ.module.js +0 -12
  118. package/dist/cs-CZ.module.js.map +0 -1
  119. package/dist/da-DK.main.js +0 -10
  120. package/dist/da-DK.main.js.map +0 -1
  121. package/dist/da-DK.mjs +0 -12
  122. package/dist/da-DK.module.js +0 -12
  123. package/dist/da-DK.module.js.map +0 -1
  124. package/dist/de-DE.main.js +0 -10
  125. package/dist/de-DE.main.js.map +0 -1
  126. package/dist/de-DE.mjs +0 -12
  127. package/dist/de-DE.module.js +0 -12
  128. package/dist/de-DE.module.js.map +0 -1
  129. package/dist/el-GR.main.js +0 -10
  130. package/dist/el-GR.main.js.map +0 -1
  131. package/dist/el-GR.mjs +0 -12
  132. package/dist/el-GR.module.js +0 -12
  133. package/dist/el-GR.module.js.map +0 -1
  134. package/dist/en-US.main.js +0 -10
  135. package/dist/en-US.main.js.map +0 -1
  136. package/dist/en-US.mjs +0 -12
  137. package/dist/en-US.module.js +0 -12
  138. package/dist/en-US.module.js.map +0 -1
  139. package/dist/es-ES.main.js +0 -10
  140. package/dist/es-ES.main.js.map +0 -1
  141. package/dist/es-ES.mjs +0 -12
  142. package/dist/es-ES.module.js +0 -12
  143. package/dist/es-ES.module.js.map +0 -1
  144. package/dist/et-EE.main.js +0 -10
  145. package/dist/et-EE.main.js.map +0 -1
  146. package/dist/et-EE.mjs +0 -12
  147. package/dist/et-EE.module.js +0 -12
  148. package/dist/et-EE.module.js.map +0 -1
  149. package/dist/fi-FI.main.js +0 -10
  150. package/dist/fi-FI.main.js.map +0 -1
  151. package/dist/fi-FI.mjs +0 -12
  152. package/dist/fi-FI.module.js +0 -12
  153. package/dist/fi-FI.module.js.map +0 -1
  154. package/dist/fr-FR.main.js +0 -10
  155. package/dist/fr-FR.main.js.map +0 -1
  156. package/dist/fr-FR.mjs +0 -12
  157. package/dist/fr-FR.module.js +0 -12
  158. package/dist/fr-FR.module.js.map +0 -1
  159. package/dist/he-IL.main.js +0 -10
  160. package/dist/he-IL.main.js.map +0 -1
  161. package/dist/he-IL.mjs +0 -12
  162. package/dist/he-IL.module.js +0 -12
  163. package/dist/he-IL.module.js.map +0 -1
  164. package/dist/hr-HR.main.js +0 -10
  165. package/dist/hr-HR.main.js.map +0 -1
  166. package/dist/hr-HR.mjs +0 -12
  167. package/dist/hr-HR.module.js +0 -12
  168. package/dist/hr-HR.module.js.map +0 -1
  169. package/dist/hu-HU.main.js +0 -10
  170. package/dist/hu-HU.main.js.map +0 -1
  171. package/dist/hu-HU.mjs +0 -12
  172. package/dist/hu-HU.module.js +0 -12
  173. package/dist/hu-HU.module.js.map +0 -1
  174. package/dist/intlStrings.main.js +0 -108
  175. package/dist/intlStrings.main.js.map +0 -1
  176. package/dist/intlStrings.mjs +0 -110
  177. package/dist/intlStrings.module.js +0 -110
  178. package/dist/intlStrings.module.js.map +0 -1
  179. package/dist/it-IT.main.js +0 -10
  180. package/dist/it-IT.main.js.map +0 -1
  181. package/dist/it-IT.mjs +0 -12
  182. package/dist/it-IT.module.js +0 -12
  183. package/dist/it-IT.module.js.map +0 -1
  184. package/dist/ja-JP.main.js +0 -10
  185. package/dist/ja-JP.main.js.map +0 -1
  186. package/dist/ja-JP.mjs +0 -12
  187. package/dist/ja-JP.module.js +0 -12
  188. package/dist/ja-JP.module.js.map +0 -1
  189. package/dist/ko-KR.main.js +0 -10
  190. package/dist/ko-KR.main.js.map +0 -1
  191. package/dist/ko-KR.mjs +0 -12
  192. package/dist/ko-KR.module.js +0 -12
  193. package/dist/ko-KR.module.js.map +0 -1
  194. package/dist/lt-LT.main.js +0 -10
  195. package/dist/lt-LT.main.js.map +0 -1
  196. package/dist/lt-LT.mjs +0 -12
  197. package/dist/lt-LT.module.js +0 -12
  198. package/dist/lt-LT.module.js.map +0 -1
  199. package/dist/lv-LV.main.js +0 -10
  200. package/dist/lv-LV.main.js.map +0 -1
  201. package/dist/lv-LV.mjs +0 -12
  202. package/dist/lv-LV.module.js +0 -12
  203. package/dist/lv-LV.module.js.map +0 -1
  204. package/dist/nb-NO.main.js +0 -10
  205. package/dist/nb-NO.main.js.map +0 -1
  206. package/dist/nb-NO.mjs +0 -12
  207. package/dist/nb-NO.module.js +0 -12
  208. package/dist/nb-NO.module.js.map +0 -1
  209. package/dist/nl-NL.main.js +0 -10
  210. package/dist/nl-NL.main.js.map +0 -1
  211. package/dist/nl-NL.mjs +0 -12
  212. package/dist/nl-NL.module.js +0 -12
  213. package/dist/nl-NL.module.js.map +0 -1
  214. package/dist/pl-PL.main.js +0 -10
  215. package/dist/pl-PL.main.js.map +0 -1
  216. package/dist/pl-PL.mjs +0 -12
  217. package/dist/pl-PL.module.js +0 -12
  218. package/dist/pl-PL.module.js.map +0 -1
  219. package/dist/pt-BR.main.js +0 -10
  220. package/dist/pt-BR.main.js.map +0 -1
  221. package/dist/pt-BR.mjs +0 -12
  222. package/dist/pt-BR.module.js +0 -12
  223. package/dist/pt-BR.module.js.map +0 -1
  224. package/dist/pt-PT.main.js +0 -10
  225. package/dist/pt-PT.main.js.map +0 -1
  226. package/dist/pt-PT.mjs +0 -12
  227. package/dist/pt-PT.module.js +0 -12
  228. package/dist/pt-PT.module.js.map +0 -1
  229. package/dist/ro-RO.main.js +0 -10
  230. package/dist/ro-RO.main.js.map +0 -1
  231. package/dist/ro-RO.mjs +0 -12
  232. package/dist/ro-RO.module.js +0 -12
  233. package/dist/ro-RO.module.js.map +0 -1
  234. package/dist/ru-RU.main.js +0 -10
  235. package/dist/ru-RU.main.js.map +0 -1
  236. package/dist/ru-RU.mjs +0 -12
  237. package/dist/ru-RU.module.js +0 -12
  238. package/dist/ru-RU.module.js.map +0 -1
  239. package/dist/sk-SK.main.js +0 -10
  240. package/dist/sk-SK.main.js.map +0 -1
  241. package/dist/sk-SK.mjs +0 -12
  242. package/dist/sk-SK.module.js +0 -12
  243. package/dist/sk-SK.module.js.map +0 -1
  244. package/dist/sl-SI.main.js +0 -10
  245. package/dist/sl-SI.main.js.map +0 -1
  246. package/dist/sl-SI.mjs +0 -12
  247. package/dist/sl-SI.module.js +0 -12
  248. package/dist/sl-SI.module.js.map +0 -1
  249. package/dist/sr-SP.main.js +0 -10
  250. package/dist/sr-SP.main.js.map +0 -1
  251. package/dist/sr-SP.mjs +0 -12
  252. package/dist/sr-SP.module.js +0 -12
  253. package/dist/sr-SP.module.js.map +0 -1
  254. package/dist/sv-SE.main.js +0 -10
  255. package/dist/sv-SE.main.js.map +0 -1
  256. package/dist/sv-SE.mjs +0 -12
  257. package/dist/sv-SE.module.js +0 -12
  258. package/dist/sv-SE.module.js.map +0 -1
  259. package/dist/tr-TR.main.js +0 -10
  260. package/dist/tr-TR.main.js.map +0 -1
  261. package/dist/tr-TR.mjs +0 -12
  262. package/dist/tr-TR.module.js +0 -12
  263. package/dist/tr-TR.module.js.map +0 -1
  264. package/dist/types.d.ts +0 -96
  265. package/dist/types.d.ts.map +0 -1
  266. package/dist/uk-UA.main.js +0 -10
  267. package/dist/uk-UA.main.js.map +0 -1
  268. package/dist/uk-UA.mjs +0 -12
  269. package/dist/uk-UA.module.js +0 -12
  270. package/dist/uk-UA.module.js.map +0 -1
  271. package/dist/zh-CN.main.js +0 -10
  272. package/dist/zh-CN.main.js.map +0 -1
  273. package/dist/zh-CN.mjs +0 -12
  274. package/dist/zh-CN.module.js +0 -12
  275. package/dist/zh-CN.module.js.map +0 -1
  276. package/dist/zh-TW.main.js +0 -10
  277. package/dist/zh-TW.main.js.map +0 -1
  278. package/dist/zh-TW.mjs +0 -12
  279. package/dist/zh-TW.module.js +0 -12
  280. package/dist/zh-TW.module.js.map +0 -1
  281. package/src/ColorArea.tsx +0 -87
  282. package/src/ColorEditor.tsx +0 -60
  283. package/src/ColorField.tsx +0 -111
  284. package/src/ColorPicker.tsx +0 -120
  285. package/src/ColorSlider.tsx +0 -142
  286. package/src/ColorSwatch.tsx +0 -99
  287. package/src/ColorSwatchPicker.tsx +0 -115
  288. package/src/ColorThumb.tsx +0 -114
  289. package/src/ColorWheel.tsx +0 -110
  290. package/src/colorfield.css +0 -18
@@ -1,121 +0,0 @@
1
- import {ColorThumb as $3a90e89d07d7bbd5$export$a3cc47cee1c1ccc} from "./ColorThumb.mjs";
2
- import "./color.4034864f.css";
3
- import $fxUYb$colorslider_vars_cssmodulejs from "./colorslider_vars_css.mjs";
4
- import {useFocusableRef as $fxUYb$useFocusableRef, useStyleProps as $fxUYb$useStyleProps, classNames as $fxUYb$classNames, SlotProvider as $fxUYb$SlotProvider} from "@react-spectrum/utils";
5
- import {useContextProps as $fxUYb$useContextProps, ColorSliderContext as $fxUYb$ColorSliderContext} from "react-aria-components";
6
- import {Label as $fxUYb$Label} from "@react-spectrum/label";
7
- import $fxUYb$react, {useRef as $fxUYb$useRef, useState as $fxUYb$useState} from "react";
8
- import {useColorSlider as $fxUYb$useColorSlider} from "@react-aria/color";
9
- import {useColorSliderState as $fxUYb$useColorSliderState} from "@react-stately/color";
10
- import {useFocusVisible as $fxUYb$useFocusVisible, useFocus as $fxUYb$useFocus} from "@react-aria/interactions";
11
- import {useLocale as $fxUYb$useLocale} from "@react-aria/i18n";
12
- import {useProviderProps as $fxUYb$useProviderProps} from "@react-spectrum/provider";
13
-
14
-
15
- function $parcel$interopDefault(a) {
16
- return a && a.__esModule ? a.default : a;
17
- }
18
- /*
19
- * Copyright 2020 Adobe. All rights reserved.
20
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
21
- * you may not use this file except in compliance with the License. You may obtain a copy
22
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
23
- *
24
- * Unless required by applicable law or agreed to in writing, software distributed under
25
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
26
- * OF ANY KIND, either express or implied. See the License for the specific language
27
- * governing permissions and limitations under the License.
28
- */
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
- const $3870e4ce67ed7ee1$export$44fd664bcca5b6fb = /*#__PURE__*/ (0, $fxUYb$react).forwardRef(function ColorSlider(props, ref) {
40
- props = (0, $fxUYb$useProviderProps)(props);
41
- let inputRef = (0, $fxUYb$useRef)(null);
42
- let trackRef = (0, $fxUYb$useRef)(null);
43
- let domRef = (0, $fxUYb$useFocusableRef)(ref, inputRef);
44
- [props, domRef] = (0, $fxUYb$useContextProps)(props, domRef, (0, $fxUYb$ColorSliderContext));
45
- let { isDisabled: isDisabled, channel: channel, orientation: orientation, label: label, showValueLabel: showValueLabel, 'aria-label': ariaLabel } = props;
46
- let vertical = orientation === 'vertical';
47
- let { styleProps: styleProps } = (0, $fxUYb$useStyleProps)(props);
48
- let { locale: locale } = (0, $fxUYb$useLocale)();
49
- let state = (0, $fxUYb$useColorSliderState)({
50
- ...props,
51
- locale: locale
52
- });
53
- // If vertical and a label is provided, use it as an aria-label instead.
54
- if (vertical && label) {
55
- ariaLabel = ariaLabel || (typeof label === 'string' ? label : undefined);
56
- label = null;
57
- }
58
- // If no external label, aria-label or aria-labelledby is provided,
59
- // default to displaying the localized channel value.
60
- // Specifically check if label is undefined. If label is `null` then display no visible label.
61
- // A default aria-label is provided by useColorSlider in that case.
62
- if (label === undefined && !ariaLabel && !props['aria-labelledby'] && !vertical) label = state.value.getChannelName(channel, locale);
63
- // Show the value label by default if there is a visible label
64
- if (showValueLabel == null) showValueLabel = !!label;
65
- let { inputProps: inputProps, thumbProps: thumbProps, trackProps: trackProps, labelProps: labelProps, outputProps: outputProps } = (0, $fxUYb$useColorSlider)({
66
- ...props,
67
- label: label,
68
- 'aria-label': ariaLabel,
69
- trackRef: trackRef,
70
- inputRef: inputRef
71
- }, state);
72
- let { isFocusVisible: isFocusVisible } = (0, $fxUYb$useFocusVisible)();
73
- let [isFocused, setIsFocused] = (0, $fxUYb$useState)(false);
74
- let { focusProps: focusProps } = (0, $fxUYb$useFocus)({
75
- isDisabled: isDisabled,
76
- onFocusChange: setIsFocused
77
- });
78
- return /*#__PURE__*/ (0, $fxUYb$react).createElement("div", {
79
- ref: domRef,
80
- ...styleProps,
81
- className: (0, $fxUYb$classNames)((0, ($parcel$interopDefault($fxUYb$colorslider_vars_cssmodulejs))), {
82
- 'spectrum-ColorSlider-container--horizontal': !vertical,
83
- 'spectrum-ColorSlider-container--vertical': vertical
84
- }, styleProps.className)
85
- }, label && /*#__PURE__*/ (0, $fxUYb$react).createElement("div", {
86
- className: (0, $fxUYb$classNames)((0, ($parcel$interopDefault($fxUYb$colorslider_vars_cssmodulejs))), 'spectrum-ColorSlider-labelContainer')
87
- }, /*#__PURE__*/ (0, $fxUYb$react).createElement((0, $fxUYb$Label), labelProps, label), props.contextualHelp && /*#__PURE__*/ (0, $fxUYb$react).createElement((0, $fxUYb$SlotProvider), {
88
- slots: {
89
- actionButton: {
90
- UNSAFE_className: (0, $fxUYb$classNames)((0, ($parcel$interopDefault($fxUYb$colorslider_vars_cssmodulejs))), 'spectrum-ColorSlider-contextualHelp')
91
- }
92
- }
93
- }, props.contextualHelp), showValueLabel && /*#__PURE__*/ (0, $fxUYb$react).createElement((0, $fxUYb$Label), {
94
- elementType: "span",
95
- UNSAFE_className: (0, $fxUYb$classNames)((0, ($parcel$interopDefault($fxUYb$colorslider_vars_cssmodulejs))), 'spectrum-ColorSlider-valueLabel')
96
- }, /*#__PURE__*/ (0, $fxUYb$react).createElement("output", outputProps, state.value.formatChannelValue(channel, locale)))), /*#__PURE__*/ (0, $fxUYb$react).createElement("div", {
97
- ...trackProps,
98
- ref: trackRef,
99
- className: (0, $fxUYb$classNames)((0, ($parcel$interopDefault($fxUYb$colorslider_vars_cssmodulejs))), 'spectrum-ColorSlider', {
100
- 'is-disabled': isDisabled,
101
- 'spectrum-ColorSlider--vertical': vertical
102
- })
103
- }, /*#__PURE__*/ (0, $fxUYb$react).createElement((0, $3a90e89d07d7bbd5$export$a3cc47cee1c1ccc), {
104
- value: state.getDisplayColor(),
105
- isFocused: isFocused && isFocusVisible,
106
- isDisabled: isDisabled,
107
- isDragging: state.isThumbDragging(0),
108
- containerRef: trackRef,
109
- className: (0, $fxUYb$classNames)((0, ($parcel$interopDefault($fxUYb$colorslider_vars_cssmodulejs))), 'spectrum-ColorSlider-handle'),
110
- ...thumbProps
111
- }, /*#__PURE__*/ (0, $fxUYb$react).createElement("input", {
112
- ...inputProps,
113
- ...focusProps,
114
- ref: inputRef,
115
- className: (0, $fxUYb$classNames)((0, ($parcel$interopDefault($fxUYb$colorslider_vars_cssmodulejs))), 'spectrum-ColorSlider-slider')
116
- }))));
117
- });
118
-
119
-
120
- export {$3870e4ce67ed7ee1$export$44fd664bcca5b6fb as ColorSlider};
121
- //# sourceMappingURL=ColorSlider.module.js.map
@@ -1,121 +0,0 @@
1
- import {ColorThumb as $3a90e89d07d7bbd5$export$a3cc47cee1c1ccc} from "./ColorThumb.module.js";
2
- import "./color.4034864f.css";
3
- import $fxUYb$colorslider_vars_cssmodulejs from "./colorslider_vars_css.module.js";
4
- import {useFocusableRef as $fxUYb$useFocusableRef, useStyleProps as $fxUYb$useStyleProps, classNames as $fxUYb$classNames, SlotProvider as $fxUYb$SlotProvider} from "@react-spectrum/utils";
5
- import {useContextProps as $fxUYb$useContextProps, ColorSliderContext as $fxUYb$ColorSliderContext} from "react-aria-components";
6
- import {Label as $fxUYb$Label} from "@react-spectrum/label";
7
- import $fxUYb$react, {useRef as $fxUYb$useRef, useState as $fxUYb$useState} from "react";
8
- import {useColorSlider as $fxUYb$useColorSlider} from "@react-aria/color";
9
- import {useColorSliderState as $fxUYb$useColorSliderState} from "@react-stately/color";
10
- import {useFocusVisible as $fxUYb$useFocusVisible, useFocus as $fxUYb$useFocus} from "@react-aria/interactions";
11
- import {useLocale as $fxUYb$useLocale} from "@react-aria/i18n";
12
- import {useProviderProps as $fxUYb$useProviderProps} from "@react-spectrum/provider";
13
-
14
-
15
- function $parcel$interopDefault(a) {
16
- return a && a.__esModule ? a.default : a;
17
- }
18
- /*
19
- * Copyright 2020 Adobe. All rights reserved.
20
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
21
- * you may not use this file except in compliance with the License. You may obtain a copy
22
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
23
- *
24
- * Unless required by applicable law or agreed to in writing, software distributed under
25
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
26
- * OF ANY KIND, either express or implied. See the License for the specific language
27
- * governing permissions and limitations under the License.
28
- */
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
- const $3870e4ce67ed7ee1$export$44fd664bcca5b6fb = /*#__PURE__*/ (0, $fxUYb$react).forwardRef(function ColorSlider(props, ref) {
40
- props = (0, $fxUYb$useProviderProps)(props);
41
- let inputRef = (0, $fxUYb$useRef)(null);
42
- let trackRef = (0, $fxUYb$useRef)(null);
43
- let domRef = (0, $fxUYb$useFocusableRef)(ref, inputRef);
44
- [props, domRef] = (0, $fxUYb$useContextProps)(props, domRef, (0, $fxUYb$ColorSliderContext));
45
- let { isDisabled: isDisabled, channel: channel, orientation: orientation, label: label, showValueLabel: showValueLabel, 'aria-label': ariaLabel } = props;
46
- let vertical = orientation === 'vertical';
47
- let { styleProps: styleProps } = (0, $fxUYb$useStyleProps)(props);
48
- let { locale: locale } = (0, $fxUYb$useLocale)();
49
- let state = (0, $fxUYb$useColorSliderState)({
50
- ...props,
51
- locale: locale
52
- });
53
- // If vertical and a label is provided, use it as an aria-label instead.
54
- if (vertical && label) {
55
- ariaLabel = ariaLabel || (typeof label === 'string' ? label : undefined);
56
- label = null;
57
- }
58
- // If no external label, aria-label or aria-labelledby is provided,
59
- // default to displaying the localized channel value.
60
- // Specifically check if label is undefined. If label is `null` then display no visible label.
61
- // A default aria-label is provided by useColorSlider in that case.
62
- if (label === undefined && !ariaLabel && !props['aria-labelledby'] && !vertical) label = state.value.getChannelName(channel, locale);
63
- // Show the value label by default if there is a visible label
64
- if (showValueLabel == null) showValueLabel = !!label;
65
- let { inputProps: inputProps, thumbProps: thumbProps, trackProps: trackProps, labelProps: labelProps, outputProps: outputProps } = (0, $fxUYb$useColorSlider)({
66
- ...props,
67
- label: label,
68
- 'aria-label': ariaLabel,
69
- trackRef: trackRef,
70
- inputRef: inputRef
71
- }, state);
72
- let { isFocusVisible: isFocusVisible } = (0, $fxUYb$useFocusVisible)();
73
- let [isFocused, setIsFocused] = (0, $fxUYb$useState)(false);
74
- let { focusProps: focusProps } = (0, $fxUYb$useFocus)({
75
- isDisabled: isDisabled,
76
- onFocusChange: setIsFocused
77
- });
78
- return /*#__PURE__*/ (0, $fxUYb$react).createElement("div", {
79
- ref: domRef,
80
- ...styleProps,
81
- className: (0, $fxUYb$classNames)((0, ($parcel$interopDefault($fxUYb$colorslider_vars_cssmodulejs))), {
82
- 'spectrum-ColorSlider-container--horizontal': !vertical,
83
- 'spectrum-ColorSlider-container--vertical': vertical
84
- }, styleProps.className)
85
- }, label && /*#__PURE__*/ (0, $fxUYb$react).createElement("div", {
86
- className: (0, $fxUYb$classNames)((0, ($parcel$interopDefault($fxUYb$colorslider_vars_cssmodulejs))), 'spectrum-ColorSlider-labelContainer')
87
- }, /*#__PURE__*/ (0, $fxUYb$react).createElement((0, $fxUYb$Label), labelProps, label), props.contextualHelp && /*#__PURE__*/ (0, $fxUYb$react).createElement((0, $fxUYb$SlotProvider), {
88
- slots: {
89
- actionButton: {
90
- UNSAFE_className: (0, $fxUYb$classNames)((0, ($parcel$interopDefault($fxUYb$colorslider_vars_cssmodulejs))), 'spectrum-ColorSlider-contextualHelp')
91
- }
92
- }
93
- }, props.contextualHelp), showValueLabel && /*#__PURE__*/ (0, $fxUYb$react).createElement((0, $fxUYb$Label), {
94
- elementType: "span",
95
- UNSAFE_className: (0, $fxUYb$classNames)((0, ($parcel$interopDefault($fxUYb$colorslider_vars_cssmodulejs))), 'spectrum-ColorSlider-valueLabel')
96
- }, /*#__PURE__*/ (0, $fxUYb$react).createElement("output", outputProps, state.value.formatChannelValue(channel, locale)))), /*#__PURE__*/ (0, $fxUYb$react).createElement("div", {
97
- ...trackProps,
98
- ref: trackRef,
99
- className: (0, $fxUYb$classNames)((0, ($parcel$interopDefault($fxUYb$colorslider_vars_cssmodulejs))), 'spectrum-ColorSlider', {
100
- 'is-disabled': isDisabled,
101
- 'spectrum-ColorSlider--vertical': vertical
102
- })
103
- }, /*#__PURE__*/ (0, $fxUYb$react).createElement((0, $3a90e89d07d7bbd5$export$a3cc47cee1c1ccc), {
104
- value: state.getDisplayColor(),
105
- isFocused: isFocused && isFocusVisible,
106
- isDisabled: isDisabled,
107
- isDragging: state.isThumbDragging(0),
108
- containerRef: trackRef,
109
- className: (0, $fxUYb$classNames)((0, ($parcel$interopDefault($fxUYb$colorslider_vars_cssmodulejs))), 'spectrum-ColorSlider-handle'),
110
- ...thumbProps
111
- }, /*#__PURE__*/ (0, $fxUYb$react).createElement("input", {
112
- ...inputProps,
113
- ...focusProps,
114
- ref: inputRef,
115
- className: (0, $fxUYb$classNames)((0, ($parcel$interopDefault($fxUYb$colorslider_vars_cssmodulejs))), 'spectrum-ColorSlider-slider')
116
- }))));
117
- });
118
-
119
-
120
- export {$3870e4ce67ed7ee1$export$44fd664bcca5b6fb as ColorSlider};
121
- //# sourceMappingURL=ColorSlider.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;AAmBM,MAAM,0DAAc,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,SAAS,YAAY,KAA+B,EAAE,GAAiC;IACjI,QAAQ,CAAA,GAAA,uBAAe,EAAE;IACzB,IAAI,WAAW,CAAA,GAAA,aAAK,EAAE;IACtB,IAAI,WAAW,CAAA,GAAA,aAAK,EAAE;IACtB,IAAI,SAAS,CAAA,GAAA,sBAAc,EAAE,KAAK;IAClC,CAAC,OAAO,OAAO,GAAG,CAAA,GAAA,sBAAc,EAAE,OAAO,QAAQ,CAAA,GAAA,yBAAiB;IAElE,IAAI,cACF,UAAU,WACV,OAAO,eACP,WAAW,SACX,KAAK,kBACL,cAAc,EACd,cAAc,SAAS,EACxB,GAAG;IACJ,IAAI,WAAW,gBAAgB;IAE/B,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,oBAAY,EAAE;IACjC,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAEvB,IAAI,QAAQ,CAAA,GAAA,0BAAkB,EAAE;QAAC,GAAG,KAAK;gBAAE;IAAM;IAEjD,wEAAwE;IACxE,IAAI,YAAY,OAAO;QACrB,YAAY,aAAc,CAAA,OAAO,UAAU,WAAW,QAAQ,SAAQ;QACtE,QAAQ;IACV;IAEA,mEAAmE;IACnE,qDAAqD;IACrD,8FAA8F;IAC9F,mEAAmE;IACnE,IAAI,UAAU,aAAa,CAAC,aAAa,CAAC,KAAK,CAAC,kBAAkB,IAAI,CAAC,UACrE,QAAQ,MAAM,KAAK,CAAC,cAAc,CAAC,SAAS;IAG9C,8DAA8D;IAC9D,IAAI,kBAAkB,MACpB,iBAAiB,CAAC,CAAC;IAGrB,IAAI,cAAC,UAAU,cAAE,UAAU,cAAE,UAAU,cAAE,UAAU,eAAE,WAAW,EAAC,GAAG,CAAA,GAAA,qBAAa,EAAE;QACjF,GAAG,KAAK;eACR;QACA,cAAc;kBACd;kBACA;IACF,GAAG;IAEH,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,sBAAc;IACrC,IAAI,CAAC,WAAW,aAAa,GAAG,CAAA,GAAA,eAAO,EAAE;IACzC,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;oBAC1B;QACA,eAAe;IACjB;IAEA,qBACE,gCAAC;QACC,KAAK;QACJ,GAAG,UAAU;QACd,WAAW,CAAA,GAAA,iBAAS,EAClB,CAAA,GAAA,6DAAK,GACL;YACE,8CAA8C,CAAC;YAC/C,4CAA4C;QAC9C,GACA,WAAW,SAAS;OAErB,uBACC,gCAAC;QAAI,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,6DAAK,GAAG;qBACjC,gCAAC,CAAA,GAAA,YAAI,GAAM,YAAa,QACvB,MAAM,cAAc,kBACnB,gCAAC,CAAA,GAAA,mBAAW;QACV,OAAO;YACL,cAAc;gBACZ,kBAAkB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,6DAAK,GAAG;YACvC;QACF;OACC,MAAM,cAAc,GAGxB,gCACC,gCAAC,CAAA,GAAA,YAAI;QAAE,aAAY;QAAO,kBAAkB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,6DAAK,GAAG;qBAC7D,gCAAC,UAAW,aAAc,MAAM,KAAK,CAAC,kBAAkB,CAAC,SAAS,0BAK1E,gCAAC;QACE,GAAG,UAAU;QACd,KAAK;QACL,WAAW,CAAA,GAAA,iBAAS,EAClB,CAAA,GAAA,6DAAK,GACL,wBAAwB;YACtB,eAAe;YACf,kCAAkC;QACpC;qBAGF,gCAAC,CAAA,GAAA,wCAAS;QACR,OAAO,MAAM,eAAe;QAC5B,WAAW,aAAa;QACxB,YAAY;QACZ,YAAY,MAAM,eAAe,CAAC;QAClC,cAAc;QACd,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,6DAAK,GAAG;QAC7B,GAAG,UAAU;qBACd,gCAAC;QAAO,GAAG,UAAU;QAAG,GAAG,UAAU;QAAE,KAAK;QAAU,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,6DAAK,GAAG;;AAK9F","sources":["packages/@react-spectrum/color/src/ColorSlider.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {classNames, SlotProvider, useFocusableRef, useStyleProps} from '@react-spectrum/utils';\nimport {ColorSliderContext, useContextProps} from 'react-aria-components';\nimport {ColorThumb} from './ColorThumb';\nimport {FocusableRef} from '@react-types/shared';\nimport {Label} from '@react-spectrum/label';\nimport React, {useRef, useState} from 'react';\nimport {SpectrumColorSliderProps} from '@react-types/color';\nimport styles from '@adobe/spectrum-css-temp/components/colorslider/vars.css';\nimport {useColorSlider} from '@react-aria/color';\nimport {useColorSliderState} from '@react-stately/color';\nimport {useFocus, useFocusVisible} from '@react-aria/interactions';\nimport {useLocale} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\n\n/**\n * ColorSliders allow users to adjust an individual channel of a color value.\n */\nexport const ColorSlider = React.forwardRef(function ColorSlider(props: SpectrumColorSliderProps, ref: FocusableRef<HTMLDivElement>) {\n props = useProviderProps(props);\n let inputRef = useRef(null);\n let trackRef = useRef(null);\n let domRef = useFocusableRef(ref, inputRef);\n [props, domRef] = useContextProps(props, domRef, ColorSliderContext);\n\n let {\n isDisabled,\n channel,\n orientation,\n label,\n showValueLabel,\n 'aria-label': ariaLabel\n } = props;\n let vertical = orientation === 'vertical';\n\n let {styleProps} = useStyleProps(props);\n let {locale} = useLocale();\n\n let state = useColorSliderState({...props, locale});\n\n // If vertical and a label is provided, use it as an aria-label instead.\n if (vertical && label) {\n ariaLabel = ariaLabel || (typeof label === 'string' ? label : undefined);\n label = null;\n }\n\n // If no external label, aria-label or aria-labelledby is provided,\n // default to displaying the localized channel value.\n // Specifically check if label is undefined. If label is `null` then display no visible label.\n // A default aria-label is provided by useColorSlider in that case.\n if (label === undefined && !ariaLabel && !props['aria-labelledby'] && !vertical) {\n label = state.value.getChannelName(channel, locale);\n }\n\n // Show the value label by default if there is a visible label\n if (showValueLabel == null) {\n showValueLabel = !!label;\n }\n\n let {inputProps, thumbProps, trackProps, labelProps, outputProps} = useColorSlider({\n ...props,\n label,\n 'aria-label': ariaLabel,\n trackRef,\n inputRef\n }, state);\n\n let {isFocusVisible} = useFocusVisible();\n let [isFocused, setIsFocused] = useState(false);\n let {focusProps} = useFocus({\n isDisabled,\n onFocusChange: setIsFocused\n });\n\n return (\n <div\n ref={domRef}\n {...styleProps}\n className={classNames(\n styles,\n {\n 'spectrum-ColorSlider-container--horizontal': !vertical,\n 'spectrum-ColorSlider-container--vertical': vertical\n },\n styleProps.className\n )}>\n {label &&\n <div className={classNames(styles, 'spectrum-ColorSlider-labelContainer')}>\n <Label {...labelProps}>{label}</Label>\n {props.contextualHelp &&\n <SlotProvider\n slots={{\n actionButton: {\n UNSAFE_className: classNames(styles, 'spectrum-ColorSlider-contextualHelp')\n }\n }}>\n {props.contextualHelp}\n </SlotProvider>\n }\n {showValueLabel && (\n <Label elementType=\"span\" UNSAFE_className={classNames(styles, 'spectrum-ColorSlider-valueLabel')}>\n <output {...outputProps}>{state.value.formatChannelValue(channel, locale)}</output>\n </Label>\n )}\n </div>\n }\n <div\n {...trackProps}\n ref={trackRef}\n className={classNames(\n styles,\n 'spectrum-ColorSlider', {\n 'is-disabled': isDisabled,\n 'spectrum-ColorSlider--vertical': vertical\n }\n )\n }>\n <ColorThumb\n value={state.getDisplayColor()}\n isFocused={isFocused && isFocusVisible}\n isDisabled={isDisabled}\n isDragging={state.isThumbDragging(0)}\n containerRef={trackRef}\n className={classNames(styles, 'spectrum-ColorSlider-handle')}\n {...thumbProps}>\n <input {...inputProps} {...focusProps} ref={inputRef} className={classNames(styles, 'spectrum-ColorSlider-slider')} />\n </ColorThumb>\n </div>\n </div>\n );\n});\n"],"names":[],"version":3,"file":"ColorSlider.module.js.map"}
@@ -1,91 +0,0 @@
1
- require("./color.6dfdb0cd.css");
2
- var $ikjCA$reactariacolor = require("@react-aria/color");
3
- var $ikjCA$reactariacomponents = require("react-aria-components");
4
- var $ikjCA$react = require("react");
5
- var $ikjCA$reactspectrumutils = require("@react-spectrum/utils");
6
-
7
-
8
- function $parcel$interopDefault(a) {
9
- return a && a.__esModule ? a.default : a;
10
- }
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
- $parcel$export(module.exports, "SpectrumColorSwatchContext", () => $f076f5c85640192a$export$8529d7908a78c058);
17
- $parcel$export(module.exports, "ColorSwatch", () => $f076f5c85640192a$export$cae13e90592f246a);
18
- /*
19
- * Copyright 2024 Adobe. All rights reserved.
20
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
21
- * you may not use this file except in compliance with the License. You may obtain a copy
22
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
23
- *
24
- * Unless required by applicable law or agreed to in writing, software distributed under
25
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
26
- * OF ANY KIND, either express or implied. See the License for the specific language
27
- * governing permissions and limitations under the License.
28
- */
29
-
30
-
31
-
32
- const $f076f5c85640192a$export$8529d7908a78c058 = /*#__PURE__*/ (0, $ikjCA$react.createContext)(null);
33
- const $f076f5c85640192a$export$cae13e90592f246a = /*#__PURE__*/ (0, $ikjCA$react.forwardRef)(function ColorSwatch(props, ref) {
34
- let domRef = (0, $ikjCA$reactspectrumutils.useDOMRef)(ref);
35
- [props, domRef] = (0, $ikjCA$reactariacomponents.useContextProps)(props, domRef, (0, $ikjCA$reactariacomponents.ColorSwatchContext));
36
- let { colorSwatchProps: colorSwatchProps, color: color } = (0, $ikjCA$reactariacolor.useColorSwatch)(props);
37
- let { styleProps: styleProps } = (0, $ikjCA$reactspectrumutils.useStyleProps)(props);
38
- let ctx = (0, $ikjCA$react.useContext)($f076f5c85640192a$export$8529d7908a78c058);
39
- let { size: size = (ctx === null || ctx === void 0 ? void 0 : ctx.size) || 'M', rounding: rounding = (ctx === null || ctx === void 0 ? void 0 : ctx.rounding) || 'default' } = props;
40
- let swatch = /*#__PURE__*/ (0, ($parcel$interopDefault($ikjCA$react))).createElement("div", {
41
- ...colorSwatchProps,
42
- ...styleProps,
43
- ref: domRef,
44
- style: {
45
- ...styleProps.style,
46
- // TODO: should there be a distinction between transparent and no value (e.g. null)?
47
- background: color.getChannelValue('alpha') > 0 ? `linear-gradient(${color}, ${color}), repeating-conic-gradient(#e6e6e6 0% 25%, white 0% 50%) 0% 50% / 16px 16px` : 'linear-gradient(to bottom right, transparent calc(50% - 2px), var(--spectrum-red-900) calc(50% - 2px) calc(50% + 2px), transparent calc(50% + 2px)) no-repeat'
48
- },
49
- className: styleProps.className + function anonymous(props) {
50
- let rules = "";
51
- if (props.size === "L") rules += ' s1-os1-k';
52
- else if (props.size === "M") rules += ' s1-os1-i';
53
- else if (props.size === "S") rules += ' s1-os1-g';
54
- else if (props.size === "XS") rules += ' s1-os1-e';
55
- if (props.size === "L") rules += ' s1-ns1-k';
56
- else if (props.size === "M") rules += ' s1-ns1-i';
57
- else if (props.size === "S") rules += ' s1-ns1-g';
58
- else if (props.size === "XS") rules += ' s1-ns1-e';
59
- if (props.rounding === "full") rules += ' s1-_qs1-f';
60
- else if (props.rounding === "none") rules += ' s1-_qs1-a';
61
- else if (props.rounding === "default") rules += ' s1-_qs1-c';
62
- if (props.rounding === "full") rules += ' s1-_rs1-f';
63
- else if (props.rounding === "none") rules += ' s1-_rs1-a';
64
- else if (props.rounding === "default") rules += ' s1-_rs1-c';
65
- if (props.rounding === "full") rules += ' s1-_ss1-f';
66
- else if (props.rounding === "none") rules += ' s1-_ss1-a';
67
- else if (props.rounding === "default") rules += ' s1-_ss1-c';
68
- if (props.rounding === "full") rules += ' s1-_ts1-f';
69
- else if (props.rounding === "none") rules += ' s1-_ts1-a';
70
- else if (props.rounding === "default") rules += ' s1-_ts1-c';
71
- rules += ' s1-c-1n5whoe';
72
- rules += ' s1-ws1-b';
73
- rules += ' s1-xs1-b';
74
- rules += ' s1-us1-b';
75
- rules += ' s1-vs1-b';
76
- rules += ' s1-As1-a';
77
- rules += ' s1-__ls1-a';
78
- rules += ' s1-_us1-b';
79
- return rules;
80
- }({
81
- size: size,
82
- rounding: rounding
83
- })
84
- });
85
- // ColorSwatchPicker needs to wrap the swatch in a ListBoxItem.
86
- if (ctx) return ctx.useWrapper(swatch, color, rounding);
87
- return swatch;
88
- });
89
-
90
-
91
- //# sourceMappingURL=ColorSwatch.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AA2BM,MAAM,0DAA6B,CAAA,GAAA,0BAAY,EAA0C;AAKzF,MAAM,0DAAc,CAAA,GAAA,uBAAS,EAAE,SAAS,YAAY,KAA+B,EAAE,GAA2B;IACrH,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IACvB,CAAC,OAAO,OAAO,GAAG,CAAA,GAAA,0CAAc,EAAE,OAAO,QAAQ,CAAA,GAAA,6CAAiB;IAClE,IAAI,oBAAC,gBAAgB,SAAE,KAAK,EAAC,GAAG,CAAA,GAAA,oCAAa,EAAE;IAC/C,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,uCAAY,EAAE;IACjC,IAAI,MAAM,CAAA,GAAA,uBAAS,EAAE;IACrB,IAAI,QACF,OAAO,CAAA,gBAAA,0BAAA,IAAK,IAAI,KAAI,eACpB,WAAW,CAAA,gBAAA,0BAAA,IAAK,QAAQ,KAAI,WAC7B,GAAG;IAEJ,IAAI,uBACF,0DAAC;QACE,GAAG,gBAAgB;QACnB,GAAG,UAAU;QACd,KAAK;QACL,OAAO;YACL,GAAG,WAAW,KAAK;YACnB,oFAAoF;YACpF,YAAY,MAAM,eAAe,CAAC,WAAW,IACzC,CAAC,gBAAgB,EAAE,MAAM,EAAE,EAAE,MAAM,4EAA4E,CAAC,GAEhH;QACN;QACA,WAAW,WAAW,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAuB/B;kBAAC;sBAAM;QAAQ;;IAGtB,+DAA+D;IAC/D,IAAI,KACF,OAAO,IAAI,UAAU,CAAC,QAAQ,OAAO;IAGvC,OAAO;AACT","sources":["packages/@react-spectrum/color/src/ColorSwatch.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 {AriaColorSwatchProps, useColorSwatch} from '@react-aria/color';\nimport {Color} from '@react-types/color';\nimport {ColorSwatchContext, useContextProps} from 'react-aria-components';\nimport {DOMRef, StyleProps} from '@react-types/shared';\nimport React, {createContext, forwardRef, JSX, ReactElement, useContext} from 'react';\nimport {style} from '@react-spectrum/style-macro-s1' with {type: 'macro'};\nimport {useDOMRef, useStyleProps} from '@react-spectrum/utils';\n\nexport interface SpectrumColorSwatchProps extends AriaColorSwatchProps, StyleProps {\n /**\n * The size of the ColorSwatch.\n * @default \"M\"\n */\n size?: 'XS' | 'S' | 'M' | 'L',\n /**\n * The corner rounding of the ColorSwatch.\n * @default \"default\"\n */\n rounding?: 'default' | 'none' | 'full'\n}\n\ninterface SpectrumColorSwatchContextValue extends Pick<SpectrumColorSwatchProps, 'size' | 'rounding'> {\n useWrapper: (swatch: ReactElement, color: Color, rounding: SpectrumColorSwatchProps['rounding']) => JSX.Element\n}\n\nexport const SpectrumColorSwatchContext = createContext<SpectrumColorSwatchContextValue | null>(null);\n\n/**\n * A ColorSwatch displays a preview of a selected color.\n */\nexport const ColorSwatch = forwardRef(function ColorSwatch(props: SpectrumColorSwatchProps, ref: DOMRef<HTMLDivElement>): JSX.Element {\n let domRef = useDOMRef(ref);\n [props, domRef] = useContextProps(props, domRef, ColorSwatchContext);\n let {colorSwatchProps, color} = useColorSwatch(props);\n let {styleProps} = useStyleProps(props);\n let ctx = useContext(SpectrumColorSwatchContext);\n let {\n size = ctx?.size || 'M',\n rounding = ctx?.rounding || 'default'\n } = props;\n\n let swatch = (\n <div\n {...colorSwatchProps}\n {...styleProps}\n ref={domRef}\n style={{\n ...styleProps.style,\n // TODO: should there be a distinction between transparent and no value (e.g. null)?\n background: color.getChannelValue('alpha') > 0\n ? `linear-gradient(${color}, ${color}), repeating-conic-gradient(#e6e6e6 0% 25%, white 0% 50%) 0% 50% / 16px 16px`\n // Red slash to indicate there is no selected color.\n : 'linear-gradient(to bottom right, transparent calc(50% - 2px), var(--spectrum-red-900) calc(50% - 2px) calc(50% + 2px), transparent calc(50% + 2px)) no-repeat'\n }}\n className={styleProps.className + style({\n size: {\n size: {\n XS: 4,\n S: 6,\n M: 8,\n L: 10\n }\n },\n borderRadius: {\n rounding: {\n default: 'default',\n none: 'none',\n full: 'full'\n }\n },\n // Trick to create a partially transparent color from a variable.\n // Ideally we'd use relative color syntax for this but it's not in Firefox yet.\n borderColor: '[color-mix(in srgb, var(--spectrum-gray-900), transparent 49%)]',\n borderWidth: 1,\n borderStyle: 'solid',\n boxSizing: 'border-box',\n forcedColorAdjust: 'none'\n })({size, rounding})} />\n );\n\n // ColorSwatchPicker needs to wrap the swatch in a ListBoxItem.\n if (ctx) {\n return ctx.useWrapper(swatch, color, rounding);\n }\n\n return swatch;\n});\n"],"names":[],"version":3,"file":"ColorSwatch.main.js.map"}
@@ -1,81 +0,0 @@
1
- import "./color.6dfdb0cd.css";
2
- import {useColorSwatch as $5Pjc1$useColorSwatch} from "@react-aria/color";
3
- import {useContextProps as $5Pjc1$useContextProps, ColorSwatchContext as $5Pjc1$ColorSwatchContext} from "react-aria-components";
4
- import $5Pjc1$react, {createContext as $5Pjc1$createContext, forwardRef as $5Pjc1$forwardRef, useContext as $5Pjc1$useContext} from "react";
5
- import {useDOMRef as $5Pjc1$useDOMRef, useStyleProps as $5Pjc1$useStyleProps} from "@react-spectrum/utils";
6
-
7
- /*
8
- * Copyright 2024 Adobe. All rights reserved.
9
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
10
- * you may not use this file except in compliance with the License. You may obtain a copy
11
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing, software distributed under
14
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
15
- * OF ANY KIND, either express or implied. See the License for the specific language
16
- * governing permissions and limitations under the License.
17
- */
18
-
19
-
20
-
21
- const $d68786ae409fa722$export$8529d7908a78c058 = /*#__PURE__*/ (0, $5Pjc1$createContext)(null);
22
- const $d68786ae409fa722$export$cae13e90592f246a = /*#__PURE__*/ (0, $5Pjc1$forwardRef)(function ColorSwatch(props, ref) {
23
- let domRef = (0, $5Pjc1$useDOMRef)(ref);
24
- [props, domRef] = (0, $5Pjc1$useContextProps)(props, domRef, (0, $5Pjc1$ColorSwatchContext));
25
- let { colorSwatchProps: colorSwatchProps, color: color } = (0, $5Pjc1$useColorSwatch)(props);
26
- let { styleProps: styleProps } = (0, $5Pjc1$useStyleProps)(props);
27
- let ctx = (0, $5Pjc1$useContext)($d68786ae409fa722$export$8529d7908a78c058);
28
- let { size: size = (ctx === null || ctx === void 0 ? void 0 : ctx.size) || 'M', rounding: rounding = (ctx === null || ctx === void 0 ? void 0 : ctx.rounding) || 'default' } = props;
29
- let swatch = /*#__PURE__*/ (0, $5Pjc1$react).createElement("div", {
30
- ...colorSwatchProps,
31
- ...styleProps,
32
- ref: domRef,
33
- style: {
34
- ...styleProps.style,
35
- // TODO: should there be a distinction between transparent and no value (e.g. null)?
36
- background: color.getChannelValue('alpha') > 0 ? `linear-gradient(${color}, ${color}), repeating-conic-gradient(#e6e6e6 0% 25%, white 0% 50%) 0% 50% / 16px 16px` : 'linear-gradient(to bottom right, transparent calc(50% - 2px), var(--spectrum-red-900) calc(50% - 2px) calc(50% + 2px), transparent calc(50% + 2px)) no-repeat'
37
- },
38
- className: styleProps.className + function anonymous(props) {
39
- let rules = "";
40
- if (props.size === "L") rules += ' s1-os1-k';
41
- else if (props.size === "M") rules += ' s1-os1-i';
42
- else if (props.size === "S") rules += ' s1-os1-g';
43
- else if (props.size === "XS") rules += ' s1-os1-e';
44
- if (props.size === "L") rules += ' s1-ns1-k';
45
- else if (props.size === "M") rules += ' s1-ns1-i';
46
- else if (props.size === "S") rules += ' s1-ns1-g';
47
- else if (props.size === "XS") rules += ' s1-ns1-e';
48
- if (props.rounding === "full") rules += ' s1-_qs1-f';
49
- else if (props.rounding === "none") rules += ' s1-_qs1-a';
50
- else if (props.rounding === "default") rules += ' s1-_qs1-c';
51
- if (props.rounding === "full") rules += ' s1-_rs1-f';
52
- else if (props.rounding === "none") rules += ' s1-_rs1-a';
53
- else if (props.rounding === "default") rules += ' s1-_rs1-c';
54
- if (props.rounding === "full") rules += ' s1-_ss1-f';
55
- else if (props.rounding === "none") rules += ' s1-_ss1-a';
56
- else if (props.rounding === "default") rules += ' s1-_ss1-c';
57
- if (props.rounding === "full") rules += ' s1-_ts1-f';
58
- else if (props.rounding === "none") rules += ' s1-_ts1-a';
59
- else if (props.rounding === "default") rules += ' s1-_ts1-c';
60
- rules += ' s1-c-1n5whoe';
61
- rules += ' s1-ws1-b';
62
- rules += ' s1-xs1-b';
63
- rules += ' s1-us1-b';
64
- rules += ' s1-vs1-b';
65
- rules += ' s1-As1-a';
66
- rules += ' s1-__ls1-a';
67
- rules += ' s1-_us1-b';
68
- return rules;
69
- }({
70
- size: size,
71
- rounding: rounding
72
- })
73
- });
74
- // ColorSwatchPicker needs to wrap the swatch in a ListBoxItem.
75
- if (ctx) return ctx.useWrapper(swatch, color, rounding);
76
- return swatch;
77
- });
78
-
79
-
80
- export {$d68786ae409fa722$export$8529d7908a78c058 as SpectrumColorSwatchContext, $d68786ae409fa722$export$cae13e90592f246a as ColorSwatch};
81
- //# sourceMappingURL=ColorSwatch.module.js.map
@@ -1,81 +0,0 @@
1
- import "./color.6dfdb0cd.css";
2
- import {useColorSwatch as $5Pjc1$useColorSwatch} from "@react-aria/color";
3
- import {useContextProps as $5Pjc1$useContextProps, ColorSwatchContext as $5Pjc1$ColorSwatchContext} from "react-aria-components";
4
- import $5Pjc1$react, {createContext as $5Pjc1$createContext, forwardRef as $5Pjc1$forwardRef, useContext as $5Pjc1$useContext} from "react";
5
- import {useDOMRef as $5Pjc1$useDOMRef, useStyleProps as $5Pjc1$useStyleProps} from "@react-spectrum/utils";
6
-
7
- /*
8
- * Copyright 2024 Adobe. All rights reserved.
9
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
10
- * you may not use this file except in compliance with the License. You may obtain a copy
11
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing, software distributed under
14
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
15
- * OF ANY KIND, either express or implied. See the License for the specific language
16
- * governing permissions and limitations under the License.
17
- */
18
-
19
-
20
-
21
- const $d68786ae409fa722$export$8529d7908a78c058 = /*#__PURE__*/ (0, $5Pjc1$createContext)(null);
22
- const $d68786ae409fa722$export$cae13e90592f246a = /*#__PURE__*/ (0, $5Pjc1$forwardRef)(function ColorSwatch(props, ref) {
23
- let domRef = (0, $5Pjc1$useDOMRef)(ref);
24
- [props, domRef] = (0, $5Pjc1$useContextProps)(props, domRef, (0, $5Pjc1$ColorSwatchContext));
25
- let { colorSwatchProps: colorSwatchProps, color: color } = (0, $5Pjc1$useColorSwatch)(props);
26
- let { styleProps: styleProps } = (0, $5Pjc1$useStyleProps)(props);
27
- let ctx = (0, $5Pjc1$useContext)($d68786ae409fa722$export$8529d7908a78c058);
28
- let { size: size = (ctx === null || ctx === void 0 ? void 0 : ctx.size) || 'M', rounding: rounding = (ctx === null || ctx === void 0 ? void 0 : ctx.rounding) || 'default' } = props;
29
- let swatch = /*#__PURE__*/ (0, $5Pjc1$react).createElement("div", {
30
- ...colorSwatchProps,
31
- ...styleProps,
32
- ref: domRef,
33
- style: {
34
- ...styleProps.style,
35
- // TODO: should there be a distinction between transparent and no value (e.g. null)?
36
- background: color.getChannelValue('alpha') > 0 ? `linear-gradient(${color}, ${color}), repeating-conic-gradient(#e6e6e6 0% 25%, white 0% 50%) 0% 50% / 16px 16px` : 'linear-gradient(to bottom right, transparent calc(50% - 2px), var(--spectrum-red-900) calc(50% - 2px) calc(50% + 2px), transparent calc(50% + 2px)) no-repeat'
37
- },
38
- className: styleProps.className + function anonymous(props) {
39
- let rules = "";
40
- if (props.size === "L") rules += ' s1-os1-k';
41
- else if (props.size === "M") rules += ' s1-os1-i';
42
- else if (props.size === "S") rules += ' s1-os1-g';
43
- else if (props.size === "XS") rules += ' s1-os1-e';
44
- if (props.size === "L") rules += ' s1-ns1-k';
45
- else if (props.size === "M") rules += ' s1-ns1-i';
46
- else if (props.size === "S") rules += ' s1-ns1-g';
47
- else if (props.size === "XS") rules += ' s1-ns1-e';
48
- if (props.rounding === "full") rules += ' s1-_qs1-f';
49
- else if (props.rounding === "none") rules += ' s1-_qs1-a';
50
- else if (props.rounding === "default") rules += ' s1-_qs1-c';
51
- if (props.rounding === "full") rules += ' s1-_rs1-f';
52
- else if (props.rounding === "none") rules += ' s1-_rs1-a';
53
- else if (props.rounding === "default") rules += ' s1-_rs1-c';
54
- if (props.rounding === "full") rules += ' s1-_ss1-f';
55
- else if (props.rounding === "none") rules += ' s1-_ss1-a';
56
- else if (props.rounding === "default") rules += ' s1-_ss1-c';
57
- if (props.rounding === "full") rules += ' s1-_ts1-f';
58
- else if (props.rounding === "none") rules += ' s1-_ts1-a';
59
- else if (props.rounding === "default") rules += ' s1-_ts1-c';
60
- rules += ' s1-c-1n5whoe';
61
- rules += ' s1-ws1-b';
62
- rules += ' s1-xs1-b';
63
- rules += ' s1-us1-b';
64
- rules += ' s1-vs1-b';
65
- rules += ' s1-As1-a';
66
- rules += ' s1-__ls1-a';
67
- rules += ' s1-_us1-b';
68
- return rules;
69
- }({
70
- size: size,
71
- rounding: rounding
72
- })
73
- });
74
- // ColorSwatchPicker needs to wrap the swatch in a ListBoxItem.
75
- if (ctx) return ctx.useWrapper(swatch, color, rounding);
76
- return swatch;
77
- });
78
-
79
-
80
- export {$d68786ae409fa722$export$8529d7908a78c058 as SpectrumColorSwatchContext, $d68786ae409fa722$export$cae13e90592f246a as ColorSwatch};
81
- //# sourceMappingURL=ColorSwatch.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;AA2BM,MAAM,0DAA6B,CAAA,GAAA,oBAAY,EAA0C;AAKzF,MAAM,0DAAc,CAAA,GAAA,iBAAS,EAAE,SAAS,YAAY,KAA+B,EAAE,GAA2B;IACrH,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE;IACvB,CAAC,OAAO,OAAO,GAAG,CAAA,GAAA,sBAAc,EAAE,OAAO,QAAQ,CAAA,GAAA,yBAAiB;IAClE,IAAI,oBAAC,gBAAgB,SAAE,KAAK,EAAC,GAAG,CAAA,GAAA,qBAAa,EAAE;IAC/C,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,oBAAY,EAAE;IACjC,IAAI,MAAM,CAAA,GAAA,iBAAS,EAAE;IACrB,IAAI,QACF,OAAO,CAAA,gBAAA,0BAAA,IAAK,IAAI,KAAI,eACpB,WAAW,CAAA,gBAAA,0BAAA,IAAK,QAAQ,KAAI,WAC7B,GAAG;IAEJ,IAAI,uBACF,gCAAC;QACE,GAAG,gBAAgB;QACnB,GAAG,UAAU;QACd,KAAK;QACL,OAAO;YACL,GAAG,WAAW,KAAK;YACnB,oFAAoF;YACpF,YAAY,MAAM,eAAe,CAAC,WAAW,IACzC,CAAC,gBAAgB,EAAE,MAAM,EAAE,EAAE,MAAM,4EAA4E,CAAC,GAEhH;QACN;QACA,WAAW,WAAW,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAuB/B;kBAAC;sBAAM;QAAQ;;IAGtB,+DAA+D;IAC/D,IAAI,KACF,OAAO,IAAI,UAAU,CAAC,QAAQ,OAAO;IAGvC,OAAO;AACT","sources":["packages/@react-spectrum/color/src/ColorSwatch.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 {AriaColorSwatchProps, useColorSwatch} from '@react-aria/color';\nimport {Color} from '@react-types/color';\nimport {ColorSwatchContext, useContextProps} from 'react-aria-components';\nimport {DOMRef, StyleProps} from '@react-types/shared';\nimport React, {createContext, forwardRef, JSX, ReactElement, useContext} from 'react';\nimport {style} from '@react-spectrum/style-macro-s1' with {type: 'macro'};\nimport {useDOMRef, useStyleProps} from '@react-spectrum/utils';\n\nexport interface SpectrumColorSwatchProps extends AriaColorSwatchProps, StyleProps {\n /**\n * The size of the ColorSwatch.\n * @default \"M\"\n */\n size?: 'XS' | 'S' | 'M' | 'L',\n /**\n * The corner rounding of the ColorSwatch.\n * @default \"default\"\n */\n rounding?: 'default' | 'none' | 'full'\n}\n\ninterface SpectrumColorSwatchContextValue extends Pick<SpectrumColorSwatchProps, 'size' | 'rounding'> {\n useWrapper: (swatch: ReactElement, color: Color, rounding: SpectrumColorSwatchProps['rounding']) => JSX.Element\n}\n\nexport const SpectrumColorSwatchContext = createContext<SpectrumColorSwatchContextValue | null>(null);\n\n/**\n * A ColorSwatch displays a preview of a selected color.\n */\nexport const ColorSwatch = forwardRef(function ColorSwatch(props: SpectrumColorSwatchProps, ref: DOMRef<HTMLDivElement>): JSX.Element {\n let domRef = useDOMRef(ref);\n [props, domRef] = useContextProps(props, domRef, ColorSwatchContext);\n let {colorSwatchProps, color} = useColorSwatch(props);\n let {styleProps} = useStyleProps(props);\n let ctx = useContext(SpectrumColorSwatchContext);\n let {\n size = ctx?.size || 'M',\n rounding = ctx?.rounding || 'default'\n } = props;\n\n let swatch = (\n <div\n {...colorSwatchProps}\n {...styleProps}\n ref={domRef}\n style={{\n ...styleProps.style,\n // TODO: should there be a distinction between transparent and no value (e.g. null)?\n background: color.getChannelValue('alpha') > 0\n ? `linear-gradient(${color}, ${color}), repeating-conic-gradient(#e6e6e6 0% 25%, white 0% 50%) 0% 50% / 16px 16px`\n // Red slash to indicate there is no selected color.\n : 'linear-gradient(to bottom right, transparent calc(50% - 2px), var(--spectrum-red-900) calc(50% - 2px) calc(50% + 2px), transparent calc(50% + 2px)) no-repeat'\n }}\n className={styleProps.className + style({\n size: {\n size: {\n XS: 4,\n S: 6,\n M: 8,\n L: 10\n }\n },\n borderRadius: {\n rounding: {\n default: 'default',\n none: 'none',\n full: 'full'\n }\n },\n // Trick to create a partially transparent color from a variable.\n // Ideally we'd use relative color syntax for this but it's not in Firefox yet.\n borderColor: '[color-mix(in srgb, var(--spectrum-gray-900), transparent 49%)]',\n borderWidth: 1,\n borderStyle: 'solid',\n boxSizing: 'border-box',\n forcedColorAdjust: 'none'\n })({size, rounding})} />\n );\n\n // ColorSwatchPicker needs to wrap the swatch in a ListBoxItem.\n if (ctx) {\n return ctx.useWrapper(swatch, color, rounding);\n }\n\n return swatch;\n});\n"],"names":[],"version":3,"file":"ColorSwatch.module.js.map"}