@react-aria/color 3.1.5 → 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 (227) hide show
  1. package/dist/import.mjs +6 -8
  2. package/dist/main.js +11 -13
  3. package/dist/main.js.map +1 -1
  4. package/dist/module.js +6 -8
  5. package/dist/module.js.map +1 -1
  6. package/dist/types/src/index.d.ts +10 -0
  7. package/package.json +15 -23
  8. package/src/index.ts +11 -13
  9. package/dist/ar-AE.main.js +0 -11
  10. package/dist/ar-AE.main.js.map +0 -1
  11. package/dist/ar-AE.mjs +0 -13
  12. package/dist/ar-AE.module.js +0 -13
  13. package/dist/ar-AE.module.js.map +0 -1
  14. package/dist/bg-BG.main.js +0 -11
  15. package/dist/bg-BG.main.js.map +0 -1
  16. package/dist/bg-BG.mjs +0 -13
  17. package/dist/bg-BG.module.js +0 -13
  18. package/dist/bg-BG.module.js.map +0 -1
  19. package/dist/cs-CZ.main.js +0 -11
  20. package/dist/cs-CZ.main.js.map +0 -1
  21. package/dist/cs-CZ.mjs +0 -13
  22. package/dist/cs-CZ.module.js +0 -13
  23. package/dist/cs-CZ.module.js.map +0 -1
  24. package/dist/da-DK.main.js +0 -11
  25. package/dist/da-DK.main.js.map +0 -1
  26. package/dist/da-DK.mjs +0 -13
  27. package/dist/da-DK.module.js +0 -13
  28. package/dist/da-DK.module.js.map +0 -1
  29. package/dist/de-DE.main.js +0 -11
  30. package/dist/de-DE.main.js.map +0 -1
  31. package/dist/de-DE.mjs +0 -13
  32. package/dist/de-DE.module.js +0 -13
  33. package/dist/de-DE.module.js.map +0 -1
  34. package/dist/el-GR.main.js +0 -11
  35. package/dist/el-GR.main.js.map +0 -1
  36. package/dist/el-GR.mjs +0 -13
  37. package/dist/el-GR.module.js +0 -13
  38. package/dist/el-GR.module.js.map +0 -1
  39. package/dist/en-US.main.js +0 -11
  40. package/dist/en-US.main.js.map +0 -1
  41. package/dist/en-US.mjs +0 -13
  42. package/dist/en-US.module.js +0 -13
  43. package/dist/en-US.module.js.map +0 -1
  44. package/dist/es-ES.main.js +0 -11
  45. package/dist/es-ES.main.js.map +0 -1
  46. package/dist/es-ES.mjs +0 -13
  47. package/dist/es-ES.module.js +0 -13
  48. package/dist/es-ES.module.js.map +0 -1
  49. package/dist/et-EE.main.js +0 -11
  50. package/dist/et-EE.main.js.map +0 -1
  51. package/dist/et-EE.mjs +0 -13
  52. package/dist/et-EE.module.js +0 -13
  53. package/dist/et-EE.module.js.map +0 -1
  54. package/dist/fi-FI.main.js +0 -11
  55. package/dist/fi-FI.main.js.map +0 -1
  56. package/dist/fi-FI.mjs +0 -13
  57. package/dist/fi-FI.module.js +0 -13
  58. package/dist/fi-FI.module.js.map +0 -1
  59. package/dist/fr-FR.main.js +0 -11
  60. package/dist/fr-FR.main.js.map +0 -1
  61. package/dist/fr-FR.mjs +0 -13
  62. package/dist/fr-FR.module.js +0 -13
  63. package/dist/fr-FR.module.js.map +0 -1
  64. package/dist/he-IL.main.js +0 -11
  65. package/dist/he-IL.main.js.map +0 -1
  66. package/dist/he-IL.mjs +0 -13
  67. package/dist/he-IL.module.js +0 -13
  68. package/dist/he-IL.module.js.map +0 -1
  69. package/dist/hr-HR.main.js +0 -11
  70. package/dist/hr-HR.main.js.map +0 -1
  71. package/dist/hr-HR.mjs +0 -13
  72. package/dist/hr-HR.module.js +0 -13
  73. package/dist/hr-HR.module.js.map +0 -1
  74. package/dist/hu-HU.main.js +0 -11
  75. package/dist/hu-HU.main.js.map +0 -1
  76. package/dist/hu-HU.mjs +0 -13
  77. package/dist/hu-HU.module.js +0 -13
  78. package/dist/hu-HU.module.js.map +0 -1
  79. package/dist/intlStrings.main.js +0 -108
  80. package/dist/intlStrings.main.js.map +0 -1
  81. package/dist/intlStrings.mjs +0 -110
  82. package/dist/intlStrings.module.js +0 -110
  83. package/dist/intlStrings.module.js.map +0 -1
  84. package/dist/it-IT.main.js +0 -11
  85. package/dist/it-IT.main.js.map +0 -1
  86. package/dist/it-IT.mjs +0 -13
  87. package/dist/it-IT.module.js +0 -13
  88. package/dist/it-IT.module.js.map +0 -1
  89. package/dist/ja-JP.main.js +0 -11
  90. package/dist/ja-JP.main.js.map +0 -1
  91. package/dist/ja-JP.mjs +0 -13
  92. package/dist/ja-JP.module.js +0 -13
  93. package/dist/ja-JP.module.js.map +0 -1
  94. package/dist/ko-KR.main.js +0 -11
  95. package/dist/ko-KR.main.js.map +0 -1
  96. package/dist/ko-KR.mjs +0 -13
  97. package/dist/ko-KR.module.js +0 -13
  98. package/dist/ko-KR.module.js.map +0 -1
  99. package/dist/lt-LT.main.js +0 -11
  100. package/dist/lt-LT.main.js.map +0 -1
  101. package/dist/lt-LT.mjs +0 -13
  102. package/dist/lt-LT.module.js +0 -13
  103. package/dist/lt-LT.module.js.map +0 -1
  104. package/dist/lv-LV.main.js +0 -11
  105. package/dist/lv-LV.main.js.map +0 -1
  106. package/dist/lv-LV.mjs +0 -13
  107. package/dist/lv-LV.module.js +0 -13
  108. package/dist/lv-LV.module.js.map +0 -1
  109. package/dist/nb-NO.main.js +0 -11
  110. package/dist/nb-NO.main.js.map +0 -1
  111. package/dist/nb-NO.mjs +0 -13
  112. package/dist/nb-NO.module.js +0 -13
  113. package/dist/nb-NO.module.js.map +0 -1
  114. package/dist/nl-NL.main.js +0 -11
  115. package/dist/nl-NL.main.js.map +0 -1
  116. package/dist/nl-NL.mjs +0 -13
  117. package/dist/nl-NL.module.js +0 -13
  118. package/dist/nl-NL.module.js.map +0 -1
  119. package/dist/pl-PL.main.js +0 -11
  120. package/dist/pl-PL.main.js.map +0 -1
  121. package/dist/pl-PL.mjs +0 -13
  122. package/dist/pl-PL.module.js +0 -13
  123. package/dist/pl-PL.module.js.map +0 -1
  124. package/dist/pt-BR.main.js +0 -11
  125. package/dist/pt-BR.main.js.map +0 -1
  126. package/dist/pt-BR.mjs +0 -13
  127. package/dist/pt-BR.module.js +0 -13
  128. package/dist/pt-BR.module.js.map +0 -1
  129. package/dist/pt-PT.main.js +0 -11
  130. package/dist/pt-PT.main.js.map +0 -1
  131. package/dist/pt-PT.mjs +0 -13
  132. package/dist/pt-PT.module.js +0 -13
  133. package/dist/pt-PT.module.js.map +0 -1
  134. package/dist/ro-RO.main.js +0 -11
  135. package/dist/ro-RO.main.js.map +0 -1
  136. package/dist/ro-RO.mjs +0 -13
  137. package/dist/ro-RO.module.js +0 -13
  138. package/dist/ro-RO.module.js.map +0 -1
  139. package/dist/ru-RU.main.js +0 -11
  140. package/dist/ru-RU.main.js.map +0 -1
  141. package/dist/ru-RU.mjs +0 -13
  142. package/dist/ru-RU.module.js +0 -13
  143. package/dist/ru-RU.module.js.map +0 -1
  144. package/dist/sk-SK.main.js +0 -11
  145. package/dist/sk-SK.main.js.map +0 -1
  146. package/dist/sk-SK.mjs +0 -13
  147. package/dist/sk-SK.module.js +0 -13
  148. package/dist/sk-SK.module.js.map +0 -1
  149. package/dist/sl-SI.main.js +0 -11
  150. package/dist/sl-SI.main.js.map +0 -1
  151. package/dist/sl-SI.mjs +0 -13
  152. package/dist/sl-SI.module.js +0 -13
  153. package/dist/sl-SI.module.js.map +0 -1
  154. package/dist/sr-SP.main.js +0 -11
  155. package/dist/sr-SP.main.js.map +0 -1
  156. package/dist/sr-SP.mjs +0 -13
  157. package/dist/sr-SP.module.js +0 -13
  158. package/dist/sr-SP.module.js.map +0 -1
  159. package/dist/sv-SE.main.js +0 -11
  160. package/dist/sv-SE.main.js.map +0 -1
  161. package/dist/sv-SE.mjs +0 -13
  162. package/dist/sv-SE.module.js +0 -13
  163. package/dist/sv-SE.module.js.map +0 -1
  164. package/dist/tr-TR.main.js +0 -11
  165. package/dist/tr-TR.main.js.map +0 -1
  166. package/dist/tr-TR.mjs +0 -13
  167. package/dist/tr-TR.module.js +0 -13
  168. package/dist/tr-TR.module.js.map +0 -1
  169. package/dist/types.d.ts +0 -119
  170. package/dist/types.d.ts.map +0 -1
  171. package/dist/uk-UA.main.js +0 -11
  172. package/dist/uk-UA.main.js.map +0 -1
  173. package/dist/uk-UA.mjs +0 -13
  174. package/dist/uk-UA.module.js +0 -13
  175. package/dist/uk-UA.module.js.map +0 -1
  176. package/dist/useColorArea.main.js +0 -400
  177. package/dist/useColorArea.main.js.map +0 -1
  178. package/dist/useColorArea.mjs +0 -395
  179. package/dist/useColorArea.module.js +0 -395
  180. package/dist/useColorArea.module.js.map +0 -1
  181. package/dist/useColorAreaGradient.main.js +0 -123
  182. package/dist/useColorAreaGradient.main.js.map +0 -1
  183. package/dist/useColorAreaGradient.mjs +0 -118
  184. package/dist/useColorAreaGradient.module.js +0 -118
  185. package/dist/useColorAreaGradient.module.js.map +0 -1
  186. package/dist/useColorChannelField.main.js +0 -36
  187. package/dist/useColorChannelField.main.js.map +0 -1
  188. package/dist/useColorChannelField.mjs +0 -31
  189. package/dist/useColorChannelField.module.js +0 -31
  190. package/dist/useColorChannelField.module.js.map +0 -1
  191. package/dist/useColorField.main.js +0 -101
  192. package/dist/useColorField.main.js.map +0 -1
  193. package/dist/useColorField.mjs +0 -96
  194. package/dist/useColorField.module.js +0 -96
  195. package/dist/useColorField.module.js.map +0 -1
  196. package/dist/useColorSlider.main.js +0 -133
  197. package/dist/useColorSlider.main.js.map +0 -1
  198. package/dist/useColorSlider.mjs +0 -128
  199. package/dist/useColorSlider.module.js +0 -128
  200. package/dist/useColorSlider.module.js.map +0 -1
  201. package/dist/useColorSwatch.main.js +0 -67
  202. package/dist/useColorSwatch.main.js.map +0 -1
  203. package/dist/useColorSwatch.mjs +0 -62
  204. package/dist/useColorSwatch.module.js +0 -62
  205. package/dist/useColorSwatch.module.js.map +0 -1
  206. package/dist/useColorWheel.main.js +0 -275
  207. package/dist/useColorWheel.main.js.map +0 -1
  208. package/dist/useColorWheel.mjs +0 -270
  209. package/dist/useColorWheel.module.js +0 -270
  210. package/dist/useColorWheel.module.js.map +0 -1
  211. package/dist/zh-CN.main.js +0 -11
  212. package/dist/zh-CN.main.js.map +0 -1
  213. package/dist/zh-CN.mjs +0 -13
  214. package/dist/zh-CN.module.js +0 -13
  215. package/dist/zh-CN.module.js.map +0 -1
  216. package/dist/zh-TW.main.js +0 -11
  217. package/dist/zh-TW.main.js.map +0 -1
  218. package/dist/zh-TW.mjs +0 -13
  219. package/dist/zh-TW.module.js +0 -13
  220. package/dist/zh-TW.module.js.map +0 -1
  221. package/src/useColorArea.ts +0 -467
  222. package/src/useColorAreaGradient.ts +0 -139
  223. package/src/useColorChannelField.ts +0 -36
  224. package/src/useColorField.ts +0 -142
  225. package/src/useColorSlider.ts +0 -151
  226. package/src/useColorSwatch.ts +0 -74
  227. package/src/useColorWheel.ts +0 -345
@@ -1,118 +0,0 @@
1
- import {parseColor as $hLqEt$parseColor} from "@react-stately/color";
2
- import {useMemo as $hLqEt$useMemo} from "react";
3
-
4
- /*
5
- * Copyright 2022 Adobe. All rights reserved.
6
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License. You may obtain a copy
8
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software distributed under
11
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
- * OF ANY KIND, either express or implied. See the License for the specific language
13
- * governing permissions and limitations under the License.
14
- */
15
-
16
- const $40297c24c53588e6$var$hue = (color)=>[
17
- 0,
18
- 60,
19
- 120,
20
- 180,
21
- 240,
22
- 300,
23
- 360
24
- ].map((hue)=>color.withChannelValue('hue', hue).toString('css')).join(', ');
25
- const $40297c24c53588e6$var$saturation = (color)=>`${color.withChannelValue('saturation', 0)}, transparent`;
26
- const $40297c24c53588e6$var$hslChannels = {
27
- hue: $40297c24c53588e6$var$hue,
28
- saturation: $40297c24c53588e6$var$saturation,
29
- lightness: ()=>'black, transparent, white'
30
- };
31
- const $40297c24c53588e6$var$hsbChannels = {
32
- hue: $40297c24c53588e6$var$hue,
33
- saturation: $40297c24c53588e6$var$saturation,
34
- brightness: ()=>'black, transparent'
35
- };
36
- function $40297c24c53588e6$export$dd62420467d245ca({ direction: direction, state: state, zChannel: zChannel, xChannel: xChannel, yChannel: yChannel }) {
37
- let returnVal = (0, $hLqEt$useMemo)(()=>{
38
- let end = direction === 'rtl' ? 'left' : 'right';
39
- let colorAreaStyles = {};
40
- let zValue = state.value.getChannelValue(zChannel);
41
- switch(state.value.getColorSpace()){
42
- case 'rgb':
43
- {
44
- let rgb = (0, $hLqEt$parseColor)('rgb(0, 0, 0)');
45
- colorAreaStyles = {
46
- background: [
47
- // The screen blend mode multiplies the inverse of each channel, e.g. 1 - (1 - a) * (1 - b).
48
- // Create a layer for each channel, with the other channels as 0. After blending, this should
49
- // result in the gradients being combined channel by channel.
50
- `linear-gradient(to ${end}, ${rgb.withChannelValue(xChannel, 0)}, ${rgb.withChannelValue(xChannel, 255)})`,
51
- `linear-gradient(to top, ${rgb.withChannelValue(yChannel, 0)}, ${rgb.withChannelValue(yChannel, 255)})`,
52
- rgb.withChannelValue(zChannel, zValue)
53
- ].join(','),
54
- backgroundBlendMode: 'screen'
55
- };
56
- break;
57
- }
58
- case 'hsl':
59
- {
60
- let channels = state.value.getColorChannels();
61
- let value = (0, $hLqEt$parseColor)('hsl(0, 100%, 50%)').withChannelValue(zChannel, zValue);
62
- let bg = channels.filter((c)=>c !== zChannel).map((c)=>`linear-gradient(to ${c === xChannel ? end : 'top'}, ${$40297c24c53588e6$var$hslChannels[c](value)})`).reverse();
63
- if (zChannel === 'hue') bg.push(value.toString('css'));
64
- colorAreaStyles = {
65
- background: bg.join(', ')
66
- };
67
- break;
68
- }
69
- case 'hsb':
70
- {
71
- let channels = state.value.getColorChannels();
72
- let value = (0, $hLqEt$parseColor)('hsb(0, 100%, 100%)').withChannelValue(zChannel, zValue);
73
- let bg = channels.filter((c)=>c !== zChannel).map((c)=>`linear-gradient(to ${c === xChannel ? end : 'top'}, ${$40297c24c53588e6$var$hsbChannels[c](value)})`).reverse();
74
- if (zChannel === 'hue') bg.push(value.toString('css'));
75
- colorAreaStyles = {
76
- background: bg.join(', ')
77
- };
78
- break;
79
- }
80
- }
81
- let { x: x, y: y } = state.getThumbPosition();
82
- if (direction === 'rtl') x = 1 - x;
83
- let forcedColorAdjustNoneStyle = {
84
- forcedColorAdjust: 'none'
85
- };
86
- return {
87
- colorAreaStyleProps: {
88
- style: {
89
- position: 'relative',
90
- touchAction: 'none',
91
- ...forcedColorAdjustNoneStyle,
92
- ...colorAreaStyles
93
- }
94
- },
95
- thumbStyleProps: {
96
- style: {
97
- position: 'absolute',
98
- left: `${x * 100}%`,
99
- top: `${y * 100}%`,
100
- transform: 'translate(-50%, -50%)',
101
- touchAction: 'none',
102
- ...forcedColorAdjustNoneStyle
103
- }
104
- }
105
- };
106
- }, [
107
- direction,
108
- state,
109
- zChannel,
110
- xChannel,
111
- yChannel
112
- ]);
113
- return returnVal;
114
- }
115
-
116
-
117
- export {$40297c24c53588e6$export$dd62420467d245ca as useColorAreaGradient};
118
- //# sourceMappingURL=useColorAreaGradient.module.js.map
@@ -1,118 +0,0 @@
1
- import {parseColor as $hLqEt$parseColor} from "@react-stately/color";
2
- import {useMemo as $hLqEt$useMemo} from "react";
3
-
4
- /*
5
- * Copyright 2022 Adobe. All rights reserved.
6
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License. You may obtain a copy
8
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software distributed under
11
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
- * OF ANY KIND, either express or implied. See the License for the specific language
13
- * governing permissions and limitations under the License.
14
- */
15
-
16
- const $40297c24c53588e6$var$hue = (color)=>[
17
- 0,
18
- 60,
19
- 120,
20
- 180,
21
- 240,
22
- 300,
23
- 360
24
- ].map((hue)=>color.withChannelValue('hue', hue).toString('css')).join(', ');
25
- const $40297c24c53588e6$var$saturation = (color)=>`${color.withChannelValue('saturation', 0)}, transparent`;
26
- const $40297c24c53588e6$var$hslChannels = {
27
- hue: $40297c24c53588e6$var$hue,
28
- saturation: $40297c24c53588e6$var$saturation,
29
- lightness: ()=>'black, transparent, white'
30
- };
31
- const $40297c24c53588e6$var$hsbChannels = {
32
- hue: $40297c24c53588e6$var$hue,
33
- saturation: $40297c24c53588e6$var$saturation,
34
- brightness: ()=>'black, transparent'
35
- };
36
- function $40297c24c53588e6$export$dd62420467d245ca({ direction: direction, state: state, zChannel: zChannel, xChannel: xChannel, yChannel: yChannel }) {
37
- let returnVal = (0, $hLqEt$useMemo)(()=>{
38
- let end = direction === 'rtl' ? 'left' : 'right';
39
- let colorAreaStyles = {};
40
- let zValue = state.value.getChannelValue(zChannel);
41
- switch(state.value.getColorSpace()){
42
- case 'rgb':
43
- {
44
- let rgb = (0, $hLqEt$parseColor)('rgb(0, 0, 0)');
45
- colorAreaStyles = {
46
- background: [
47
- // The screen blend mode multiplies the inverse of each channel, e.g. 1 - (1 - a) * (1 - b).
48
- // Create a layer for each channel, with the other channels as 0. After blending, this should
49
- // result in the gradients being combined channel by channel.
50
- `linear-gradient(to ${end}, ${rgb.withChannelValue(xChannel, 0)}, ${rgb.withChannelValue(xChannel, 255)})`,
51
- `linear-gradient(to top, ${rgb.withChannelValue(yChannel, 0)}, ${rgb.withChannelValue(yChannel, 255)})`,
52
- rgb.withChannelValue(zChannel, zValue)
53
- ].join(','),
54
- backgroundBlendMode: 'screen'
55
- };
56
- break;
57
- }
58
- case 'hsl':
59
- {
60
- let channels = state.value.getColorChannels();
61
- let value = (0, $hLqEt$parseColor)('hsl(0, 100%, 50%)').withChannelValue(zChannel, zValue);
62
- let bg = channels.filter((c)=>c !== zChannel).map((c)=>`linear-gradient(to ${c === xChannel ? end : 'top'}, ${$40297c24c53588e6$var$hslChannels[c](value)})`).reverse();
63
- if (zChannel === 'hue') bg.push(value.toString('css'));
64
- colorAreaStyles = {
65
- background: bg.join(', ')
66
- };
67
- break;
68
- }
69
- case 'hsb':
70
- {
71
- let channels = state.value.getColorChannels();
72
- let value = (0, $hLqEt$parseColor)('hsb(0, 100%, 100%)').withChannelValue(zChannel, zValue);
73
- let bg = channels.filter((c)=>c !== zChannel).map((c)=>`linear-gradient(to ${c === xChannel ? end : 'top'}, ${$40297c24c53588e6$var$hsbChannels[c](value)})`).reverse();
74
- if (zChannel === 'hue') bg.push(value.toString('css'));
75
- colorAreaStyles = {
76
- background: bg.join(', ')
77
- };
78
- break;
79
- }
80
- }
81
- let { x: x, y: y } = state.getThumbPosition();
82
- if (direction === 'rtl') x = 1 - x;
83
- let forcedColorAdjustNoneStyle = {
84
- forcedColorAdjust: 'none'
85
- };
86
- return {
87
- colorAreaStyleProps: {
88
- style: {
89
- position: 'relative',
90
- touchAction: 'none',
91
- ...forcedColorAdjustNoneStyle,
92
- ...colorAreaStyles
93
- }
94
- },
95
- thumbStyleProps: {
96
- style: {
97
- position: 'absolute',
98
- left: `${x * 100}%`,
99
- top: `${y * 100}%`,
100
- transform: 'translate(-50%, -50%)',
101
- touchAction: 'none',
102
- ...forcedColorAdjustNoneStyle
103
- }
104
- }
105
- };
106
- }, [
107
- direction,
108
- state,
109
- zChannel,
110
- xChannel,
111
- yChannel
112
- ]);
113
- return returnVal;
114
- }
115
-
116
-
117
- export {$40297c24c53588e6$export$dd62420467d245ca as useColorAreaGradient};
118
- //# sourceMappingURL=useColorAreaGradient.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;AAUA;;AAMA,MAAM,4BAAM,CAAC,QAAiB;QAAC;QAAG;QAAI;QAAK;QAAK;QAAK;QAAK;KAAI,CAAC,GAAG,CAAC,CAAA,MAAO,MAAM,gBAAgB,CAAC,OAAO,KAAK,QAAQ,CAAC,QAAQ,IAAI,CAAC;AACnI,MAAM,mCAAa,CAAC,QAAiB,GAAG,MAAM,gBAAgB,CAAC,cAAc,GAAG,aAAa,CAAC;AAE9F,MAAM,oCAAc;SAClB;gBACA;IACA,WAAW,IAAM;AACnB;AAEA,MAAM,oCAAc;SAClB;gBACA;IACA,YAAY,IAAM;AACpB;AAmBO,SAAS,0CAAqB,aAAC,SAAS,SAAE,KAAK,YAAE,QAAQ,YAAE,QAAQ,YAAE,QAAQ,EAAyB;IAC3G,IAAI,YAAY,CAAA,GAAA,cAAM,EAAa;QACjC,IAAI,MAAM,cAAc,QAAQ,SAAS;QACzC,IAAI,kBAAkB,CAAC;QACvB,IAAI,SAAS,MAAM,KAAK,CAAC,eAAe,CAAC;QAEzC,OAAQ,MAAM,KAAK,CAAC,aAAa;YAC/B,KAAK;gBAAO;oBACV,IAAI,MAAM,CAAA,GAAA,iBAAS,EAAE;oBACrB,kBAAkB;wBAChB,YAAY;4BACV,4FAA4F;4BAC5F,6FAA6F;4BAC7F,6DAA6D;4BAC7D,CAAC,mBAAmB,EAAE,IAAI,EAAE,EAAE,IAAI,gBAAgB,CAAC,UAAU,GAAG,EAAE,EAAE,IAAI,gBAAgB,CAAC,UAAU,KAAK,CAAC,CAAC;4BAC1G,CAAC,wBAAwB,EAAE,IAAI,gBAAgB,CAAC,UAAU,GAAG,EAAE,EAAE,IAAI,gBAAgB,CAAC,UAAU,KAAK,CAAC,CAAC;4BACvG,IAAI,gBAAgB,CAAC,UAAU;yBAChC,CAAC,IAAI,CAAC;wBACP,qBAAqB;oBACvB;oBACA;gBACF;YACA,KAAK;gBAAO;oBACV,IAAI,WAAW,MAAM,KAAK,CAAC,gBAAgB;oBAC3C,IAAI,QAAQ,CAAA,GAAA,iBAAS,EAAE,qBAAqB,gBAAgB,CAAC,UAAU;oBAEvE,IAAI,KAAK,SACN,MAAM,CAAC,CAAA,IAAK,MAAM,UAClB,GAAG,CAAC,CAAA,IAAK,CAAC,mBAAmB,EAAE,MAAM,WAAW,MAAM,MAAM,EAAE,EAAE,iCAAW,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,EACxF,OAAO;oBACV,IAAI,aAAa,OACf,GAAG,IAAI,CAAC,MAAM,QAAQ,CAAC;oBAGzB,kBAAkB;wBAChB,YAAY,GAAG,IAAI,CAAC;oBACtB;oBACA;gBACF;YACA,KAAK;gBAAO;oBACV,IAAI,WAAW,MAAM,KAAK,CAAC,gBAAgB;oBAC3C,IAAI,QAAQ,CAAA,GAAA,iBAAS,EAAE,sBAAsB,gBAAgB,CAAC,UAAU;oBAExE,IAAI,KAAK,SACN,MAAM,CAAC,CAAA,IAAK,MAAM,UAClB,GAAG,CAAC,CAAA,IAAK,CAAC,mBAAmB,EAAE,MAAM,WAAW,MAAM,MAAM,EAAE,EAAE,iCAAW,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,EACxF,OAAO;oBACV,IAAI,aAAa,OACf,GAAG,IAAI,CAAC,MAAM,QAAQ,CAAC;oBAGzB,kBAAkB;wBAChB,YAAY,GAAG,IAAI,CAAC;oBACtB;oBACA;gBACF;QACF;QAEA,IAAI,KAAC,CAAC,KAAE,CAAC,EAAC,GAAG,MAAM,gBAAgB;QAEnC,IAAI,cAAc,OAChB,IAAI,IAAI;QAGV,IAAI,6BAA6B;YAAC,mBAAmB;QAAM;QAE3D,OAAO;YACL,qBAAqB;gBACnB,OAAO;oBACL,UAAU;oBACV,aAAa;oBACb,GAAG,0BAA0B;oBAC7B,GAAG,eAAe;gBACpB;YACF;YACA,iBAAiB;gBACf,OAAO;oBACL,UAAU;oBACV,MAAM,GAAG,IAAI,IAAI,CAAC,CAAC;oBACnB,KAAK,GAAG,IAAI,IAAI,CAAC,CAAC;oBAClB,WAAW;oBACX,aAAa;oBACb,GAAG,0BAA0B;gBAC/B;YACF;QACF;IACF,GAAG;QAAC;QAAW;QAAO;QAAU;QAAU;KAAS;IAEnD,OAAO;AACT","sources":["packages/@react-aria/color/src/useColorAreaGradient.ts"],"sourcesContent":["/*\n * Copyright 2022 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 {Color, ColorChannel} from '@react-types/color';\nimport {ColorAreaState, parseColor} from '@react-stately/color';\nimport {CSSProperties, useMemo} from 'react';\n\nconst hue = (color: Color) => [0, 60, 120, 180, 240, 300, 360].map(hue => color.withChannelValue('hue', hue).toString('css')).join(', ');\nconst saturation = (color: Color) => `${color.withChannelValue('saturation', 0)}, transparent`;\n\nconst hslChannels = {\n hue,\n saturation,\n lightness: () => 'black, transparent, white'\n};\n\nconst hsbChannels = {\n hue,\n saturation,\n brightness: () => 'black, transparent'\n};\n\ninterface Gradients {\n colorAreaStyleProps: {\n style: CSSProperties\n },\n thumbStyleProps: {\n style: CSSProperties\n }\n}\n\ninterface ColorAreaGradientProps {\n direction: 'ltr' | 'rtl',\n state: ColorAreaState,\n zChannel: ColorChannel,\n xChannel: ColorChannel,\n yChannel: ColorChannel\n}\n\nexport function useColorAreaGradient({direction, state, zChannel, xChannel, yChannel}: ColorAreaGradientProps): Gradients {\n let returnVal = useMemo<Gradients>(() => {\n let end = direction === 'rtl' ? 'left' : 'right';\n let colorAreaStyles = {};\n let zValue = state.value.getChannelValue(zChannel);\n\n switch (state.value.getColorSpace()) {\n case 'rgb': {\n let rgb = parseColor('rgb(0, 0, 0)');\n colorAreaStyles = {\n background: [\n // The screen blend mode multiplies the inverse of each channel, e.g. 1 - (1 - a) * (1 - b).\n // Create a layer for each channel, with the other channels as 0. After blending, this should\n // result in the gradients being combined channel by channel.\n `linear-gradient(to ${end}, ${rgb.withChannelValue(xChannel, 0)}, ${rgb.withChannelValue(xChannel, 255)})`,\n `linear-gradient(to top, ${rgb.withChannelValue(yChannel, 0)}, ${rgb.withChannelValue(yChannel, 255)})`,\n rgb.withChannelValue(zChannel, zValue)\n ].join(','),\n backgroundBlendMode: 'screen'\n };\n break;\n }\n case 'hsl': {\n let channels = state.value.getColorChannels();\n let value = parseColor('hsl(0, 100%, 50%)').withChannelValue(zChannel, zValue);\n\n let bg = channels\n .filter(c => c !== zChannel)\n .map(c => `linear-gradient(to ${c === xChannel ? end : 'top'}, ${hslChannels[c](value)})`)\n .reverse();\n if (zChannel === 'hue') {\n bg.push(value.toString('css'));\n }\n\n colorAreaStyles = {\n background: bg.join(', ')\n };\n break;\n }\n case 'hsb': {\n let channels = state.value.getColorChannels();\n let value = parseColor('hsb(0, 100%, 100%)').withChannelValue(zChannel, zValue);\n\n let bg = channels\n .filter(c => c !== zChannel)\n .map(c => `linear-gradient(to ${c === xChannel ? end : 'top'}, ${hsbChannels[c](value)})`)\n .reverse();\n if (zChannel === 'hue') {\n bg.push(value.toString('css'));\n }\n\n colorAreaStyles = {\n background: bg.join(', ')\n };\n break;\n }\n }\n\n let {x, y} = state.getThumbPosition();\n\n if (direction === 'rtl') {\n x = 1 - x;\n }\n\n let forcedColorAdjustNoneStyle = {forcedColorAdjust: 'none'};\n\n return {\n colorAreaStyleProps: {\n style: {\n position: 'relative',\n touchAction: 'none',\n ...forcedColorAdjustNoneStyle,\n ...colorAreaStyles\n }\n },\n thumbStyleProps: {\n style: {\n position: 'absolute',\n left: `${x * 100}%`,\n top: `${y * 100}%`,\n transform: 'translate(-50%, -50%)',\n touchAction: 'none',\n ...forcedColorAdjustNoneStyle\n }\n }\n };\n }, [direction, state, zChannel, xChannel, yChannel]);\n\n return returnVal;\n}\n\n"],"names":[],"version":3,"file":"useColorAreaGradient.module.js.map"}
@@ -1,36 +0,0 @@
1
- var $bkgtN$reactarianumberfield = require("@react-aria/numberfield");
2
- var $bkgtN$reactariai18n = require("@react-aria/i18n");
3
-
4
-
5
- function $parcel$export(e, n, v, s) {
6
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
- }
8
-
9
- $parcel$export(module.exports, "useColorChannelField", () => $d84c0c836f6e3601$export$e55dd820142d3131);
10
- /*
11
- * Copyright 2024 Adobe. All rights reserved.
12
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13
- * you may not use this file except in compliance with the License. You may obtain a copy
14
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
15
- *
16
- * Unless required by applicable law or agreed to in writing, software distributed under
17
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
18
- * OF ANY KIND, either express or implied. See the License for the specific language
19
- * governing permissions and limitations under the License.
20
- */
21
-
22
- function $d84c0c836f6e3601$export$e55dd820142d3131(props, state, inputRef) {
23
- let { locale: locale } = (0, $bkgtN$reactariai18n.useLocale)();
24
- return (0, $bkgtN$reactarianumberfield.useNumberField)({
25
- ...props,
26
- value: undefined,
27
- defaultValue: undefined,
28
- onChange: undefined,
29
- validate: undefined,
30
- // Provide a default aria-label if no other label is provided.
31
- 'aria-label': props['aria-label'] || (props.label || props['aria-labelledby'] ? undefined : state.colorValue.getChannelName(props.channel, locale))
32
- }, state, inputRef);
33
- }
34
-
35
-
36
- //# sourceMappingURL=useColorChannelField.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAcM,SAAS,0CAAqB,KAAiC,EAAE,KAA6B,EAAE,QAA4C;IACjJ,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,8BAAQ;IACvB,OAAO,CAAA,GAAA,0CAAa,EAAE;QACpB,GAAG,KAAK;QACR,OAAO;QACP,cAAc;QACd,UAAU;QACV,UAAU;QACV,8DAA8D;QAC9D,cAAc,KAAK,CAAC,aAAa,IAAK,CAAA,MAAM,KAAK,IAAI,KAAK,CAAC,kBAAkB,GAAG,YAAY,MAAM,UAAU,CAAC,cAAc,CAAC,MAAM,OAAO,EAAE,OAAM;IACnJ,GAAG,OAAO;AACZ","sources":["packages/@react-aria/color/src/useColorChannelField.ts"],"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 {AriaLabelingProps, RefObject} from '@react-types/shared';\nimport {ColorChannelFieldProps, ColorChannelFieldState} from '@react-stately/color';\nimport {NumberFieldAria, useNumberField} from '@react-aria/numberfield';\nimport {useLocale} from '@react-aria/i18n';\n\nexport interface AriaColorChannelFieldProps extends ColorChannelFieldProps, AriaLabelingProps {}\nexport interface ColorChannelFieldAria extends NumberFieldAria {}\n\n/**\n * Provides the behavior and accessibility implementation for a color channel field, allowing users to edit the\n * value of an individual color channel.\n */\nexport function useColorChannelField(props: AriaColorChannelFieldProps, state: ColorChannelFieldState, inputRef: RefObject<HTMLInputElement | null>): ColorChannelFieldAria {\n let {locale} = useLocale();\n return useNumberField({\n ...props,\n value: undefined,\n defaultValue: undefined,\n onChange: undefined,\n validate: undefined,\n // Provide a default aria-label if no other label is provided.\n 'aria-label': props['aria-label'] || (props.label || props['aria-labelledby'] ? undefined : state.colorValue.getChannelName(props.channel, locale))\n }, state, inputRef);\n}\n"],"names":[],"version":3,"file":"useColorChannelField.main.js.map"}
@@ -1,31 +0,0 @@
1
- import {useNumberField as $5aC6d$useNumberField} from "@react-aria/numberfield";
2
- import {useLocale as $5aC6d$useLocale} from "@react-aria/i18n";
3
-
4
- /*
5
- * Copyright 2024 Adobe. All rights reserved.
6
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License. You may obtain a copy
8
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software distributed under
11
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
- * OF ANY KIND, either express or implied. See the License for the specific language
13
- * governing permissions and limitations under the License.
14
- */
15
-
16
- function $5e632d1ff0188f00$export$e55dd820142d3131(props, state, inputRef) {
17
- let { locale: locale } = (0, $5aC6d$useLocale)();
18
- return (0, $5aC6d$useNumberField)({
19
- ...props,
20
- value: undefined,
21
- defaultValue: undefined,
22
- onChange: undefined,
23
- validate: undefined,
24
- // Provide a default aria-label if no other label is provided.
25
- 'aria-label': props['aria-label'] || (props.label || props['aria-labelledby'] ? undefined : state.colorValue.getChannelName(props.channel, locale))
26
- }, state, inputRef);
27
- }
28
-
29
-
30
- export {$5e632d1ff0188f00$export$e55dd820142d3131 as useColorChannelField};
31
- //# sourceMappingURL=useColorChannelField.module.js.map
@@ -1,31 +0,0 @@
1
- import {useNumberField as $5aC6d$useNumberField} from "@react-aria/numberfield";
2
- import {useLocale as $5aC6d$useLocale} from "@react-aria/i18n";
3
-
4
- /*
5
- * Copyright 2024 Adobe. All rights reserved.
6
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License. You may obtain a copy
8
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software distributed under
11
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
- * OF ANY KIND, either express or implied. See the License for the specific language
13
- * governing permissions and limitations under the License.
14
- */
15
-
16
- function $5e632d1ff0188f00$export$e55dd820142d3131(props, state, inputRef) {
17
- let { locale: locale } = (0, $5aC6d$useLocale)();
18
- return (0, $5aC6d$useNumberField)({
19
- ...props,
20
- value: undefined,
21
- defaultValue: undefined,
22
- onChange: undefined,
23
- validate: undefined,
24
- // Provide a default aria-label if no other label is provided.
25
- 'aria-label': props['aria-label'] || (props.label || props['aria-labelledby'] ? undefined : state.colorValue.getChannelName(props.channel, locale))
26
- }, state, inputRef);
27
- }
28
-
29
-
30
- export {$5e632d1ff0188f00$export$e55dd820142d3131 as useColorChannelField};
31
- //# sourceMappingURL=useColorChannelField.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAcM,SAAS,0CAAqB,KAAiC,EAAE,KAA6B,EAAE,QAA4C;IACjJ,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,gBAAQ;IACvB,OAAO,CAAA,GAAA,qBAAa,EAAE;QACpB,GAAG,KAAK;QACR,OAAO;QACP,cAAc;QACd,UAAU;QACV,UAAU;QACV,8DAA8D;QAC9D,cAAc,KAAK,CAAC,aAAa,IAAK,CAAA,MAAM,KAAK,IAAI,KAAK,CAAC,kBAAkB,GAAG,YAAY,MAAM,UAAU,CAAC,cAAc,CAAC,MAAM,OAAO,EAAE,OAAM;IACnJ,GAAG,OAAO;AACZ","sources":["packages/@react-aria/color/src/useColorChannelField.ts"],"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 {AriaLabelingProps, RefObject} from '@react-types/shared';\nimport {ColorChannelFieldProps, ColorChannelFieldState} from '@react-stately/color';\nimport {NumberFieldAria, useNumberField} from '@react-aria/numberfield';\nimport {useLocale} from '@react-aria/i18n';\n\nexport interface AriaColorChannelFieldProps extends ColorChannelFieldProps, AriaLabelingProps {}\nexport interface ColorChannelFieldAria extends NumberFieldAria {}\n\n/**\n * Provides the behavior and accessibility implementation for a color channel field, allowing users to edit the\n * value of an individual color channel.\n */\nexport function useColorChannelField(props: AriaColorChannelFieldProps, state: ColorChannelFieldState, inputRef: RefObject<HTMLInputElement | null>): ColorChannelFieldAria {\n let {locale} = useLocale();\n return useNumberField({\n ...props,\n value: undefined,\n defaultValue: undefined,\n onChange: undefined,\n validate: undefined,\n // Provide a default aria-label if no other label is provided.\n 'aria-label': props['aria-label'] || (props.label || props['aria-labelledby'] ? undefined : state.colorValue.getChannelName(props.channel, locale))\n }, state, inputRef);\n}\n"],"names":[],"version":3,"file":"useColorChannelField.module.js.map"}
@@ -1,101 +0,0 @@
1
- var $grujV$react = require("react");
2
- var $grujV$reactariautils = require("@react-aria/utils");
3
- var $grujV$reactstatelyform = require("@react-stately/form");
4
- var $grujV$reactariainteractions = require("@react-aria/interactions");
5
- var $grujV$reactariatextfield = require("@react-aria/textfield");
6
- var $grujV$reactariaspinbutton = require("@react-aria/spinbutton");
7
-
8
-
9
- function $parcel$export(e, n, v, s) {
10
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
11
- }
12
-
13
- $parcel$export(module.exports, "useColorField", () => $58c850037bc7a7ce$export$77e32ca575a28fdf);
14
- /*
15
- * Copyright 2020 Adobe. All rights reserved.
16
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
17
- * you may not use this file except in compliance with the License. You may obtain a copy
18
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
19
- *
20
- * Unless required by applicable law or agreed to in writing, software distributed under
21
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
22
- * OF ANY KIND, either express or implied. See the License for the specific language
23
- * governing permissions and limitations under the License.
24
- */
25
-
26
-
27
-
28
-
29
-
30
- function $58c850037bc7a7ce$export$77e32ca575a28fdf(props, state, ref) {
31
- let { isDisabled: isDisabled, isReadOnly: isReadOnly, isRequired: isRequired, isWheelDisabled: isWheelDisabled, validationBehavior: validationBehavior = 'aria' } = props;
32
- let { colorValue: colorValue, inputValue: inputValue, increment: increment, decrement: decrement, incrementToMax: incrementToMax, decrementToMin: decrementToMin, commit: commit } = state;
33
- let inputId = (0, $grujV$reactariautils.useId)();
34
- let { spinButtonProps: spinButtonProps } = (0, $grujV$reactariaspinbutton.useSpinButton)({
35
- isDisabled: isDisabled,
36
- isReadOnly: isReadOnly,
37
- isRequired: isRequired,
38
- maxValue: 0xFFFFFF,
39
- minValue: 0,
40
- onIncrement: increment,
41
- onIncrementToMax: incrementToMax,
42
- onDecrement: decrement,
43
- onDecrementToMin: decrementToMin,
44
- value: colorValue ? colorValue.toHexInt() : undefined,
45
- textValue: colorValue ? colorValue.toString('hex') : undefined
46
- });
47
- let [focusWithin, setFocusWithin] = (0, $grujV$react.useState)(false);
48
- let { focusWithinProps: focusWithinProps } = (0, $grujV$reactariainteractions.useFocusWithin)({
49
- isDisabled: isDisabled,
50
- onFocusWithinChange: setFocusWithin
51
- });
52
- let onWheel = (0, $grujV$react.useCallback)((e)=>{
53
- if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) return;
54
- if (e.deltaY > 0) increment();
55
- else if (e.deltaY < 0) decrement();
56
- }, [
57
- decrement,
58
- increment
59
- ]);
60
- // If the input isn't supposed to receive input, disable scrolling.
61
- let scrollingDisabled = isWheelDisabled || isDisabled || isReadOnly || !focusWithin;
62
- (0, $grujV$reactariainteractions.useScrollWheel)({
63
- onScroll: onWheel,
64
- isDisabled: scrollingDisabled
65
- }, ref);
66
- let onChange = (value)=>{
67
- if (state.validate(value)) state.setInputValue(value);
68
- };
69
- let { inputProps: inputProps, ...otherProps } = (0, $grujV$reactariatextfield.useFormattedTextField)({
70
- ...props,
71
- id: inputId,
72
- value: inputValue,
73
- // Intentionally invalid value that will be ignored by onChange during form reset
74
- // This is handled separately below.
75
- defaultValue: '!',
76
- validate: undefined,
77
- [(0, $grujV$reactstatelyform.privateValidationStateProp)]: state,
78
- type: 'text',
79
- autoComplete: 'off',
80
- onChange: onChange
81
- }, state, ref);
82
- (0, $grujV$reactariautils.useFormReset)(ref, state.defaultColorValue, state.setColorValue);
83
- inputProps = (0, $grujV$reactariautils.mergeProps)(inputProps, spinButtonProps, focusWithinProps, {
84
- role: 'textbox',
85
- 'aria-valuemax': null,
86
- 'aria-valuemin': null,
87
- 'aria-valuenow': null,
88
- 'aria-valuetext': null,
89
- autoCorrect: 'off',
90
- spellCheck: 'false',
91
- onBlur: commit
92
- });
93
- if (validationBehavior === 'native') inputProps['aria-required'] = undefined;
94
- return {
95
- inputProps: inputProps,
96
- ...otherProps
97
- };
98
- }
99
-
100
-
101
- //# sourceMappingURL=useColorField.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAiCM,SAAS,0CACd,KAA0B,EAC1B,KAAsB,EACtB,GAAuC;IAEvC,IAAI,cACF,UAAU,cACV,UAAU,cACV,UAAU,mBACV,eAAe,sBACf,qBAAqB,QACtB,GAAG;IAEJ,IAAI,cACF,UAAU,cACV,UAAU,aACV,SAAS,aACT,SAAS,kBACT,cAAc,kBACd,cAAc,UACd,MAAM,EACP,GAAG;IAEJ,IAAI,UAAU,CAAA,GAAA,2BAAI;IAClB,IAAI,mBAAC,eAAe,EAAC,GAAG,CAAA,GAAA,wCAAY,EAClC;oBACE;oBACA;oBACA;QACA,UAAU;QACV,UAAU;QACV,aAAa;QACb,kBAAkB;QAClB,aAAa;QACb,kBAAkB;QAClB,OAAO,aAAa,WAAW,QAAQ,KAAK;QAC5C,WAAW,aAAa,WAAW,QAAQ,CAAC,SAAS;IACvD;IAGF,IAAI,CAAC,aAAa,eAAe,GAAG,CAAA,GAAA,qBAAO,EAAE;IAC7C,IAAI,oBAAC,gBAAgB,EAAC,GAAG,CAAA,GAAA,2CAAa,EAAE;oBAAC;QAAY,qBAAqB;IAAc;IAExF,IAAI,UAAU,CAAA,GAAA,wBAAU,EAAE,CAAC;QACzB,IAAI,KAAK,GAAG,CAAC,EAAE,MAAM,KAAK,KAAK,GAAG,CAAC,EAAE,MAAM,GACzC;QAEF,IAAI,EAAE,MAAM,GAAG,GACb;aACK,IAAI,EAAE,MAAM,GAAG,GACpB;IAEJ,GAAG;QAAC;QAAW;KAAU;IACzB,mEAAmE;IACnE,IAAI,oBAAoB,mBAAmB,cAAc,cAAc,CAAC;IACxE,CAAA,GAAA,2CAAa,EAAE;QAAC,UAAU;QAAS,YAAY;IAAiB,GAAG;IAEnE,IAAI,WAAW,CAAA;QACb,IAAI,MAAM,QAAQ,CAAC,QACjB,MAAM,aAAa,CAAC;IAExB;IAEA,IAAI,cAAC,UAAU,EAAE,GAAG,YAAW,GAAG,CAAA,GAAA,+CAAoB,EAAE;QACtD,GAAG,KAAK;QACR,IAAI;QACJ,OAAO;QACP,iFAAiF;QACjF,oCAAoC;QACpC,cAAc;QACd,UAAU;QACV,CAAC,CAAA,GAAA,kDAAyB,EAAE,EAAE;QAC9B,MAAM;QACN,cAAc;kBACd;IACF,GAAG,OAAO;IAEV,CAAA,GAAA,kCAAW,EAAE,KAAK,MAAM,iBAAiB,EAAE,MAAM,aAAa;IAE9D,aAAa,CAAA,GAAA,gCAAS,EAAE,YAAY,iBAAiB,kBAAkB;QACrE,MAAM;QACN,iBAAiB;QACjB,iBAAiB;QACjB,iBAAiB;QACjB,kBAAkB;QAClB,aAAa;QACb,YAAY;QACZ,QAAQ;IACV;IAEA,IAAI,uBAAuB,UACzB,UAAU,CAAC,gBAAgB,GAAG;IAGhC,OAAO;oBACL;QACA,GAAG,UAAU;IACf;AACF","sources":["packages/@react-aria/color/src/useColorField.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaColorFieldProps} from '@react-types/color';\nimport {ColorFieldState} from '@react-stately/color';\nimport {DOMAttributes, ValidationResult} from '@react-types/shared';\nimport {\n InputHTMLAttributes,\n LabelHTMLAttributes,\n RefObject,\n useCallback,\n useState\n} from 'react';\nimport {mergeProps, useFormReset, useId} from '@react-aria/utils';\nimport {privateValidationStateProp} from '@react-stately/form';\nimport {useFocusWithin, useScrollWheel} from '@react-aria/interactions';\nimport {useFormattedTextField} from '@react-aria/textfield';\nimport {useSpinButton} from '@react-aria/spinbutton';\n\nexport interface ColorFieldAria extends ValidationResult {\n /** Props for the label element. */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>,\n /** Props for the input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n /** Props for the text field's description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the text field's error message element, if any. */\n errorMessageProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a color field component.\n * Color fields allow users to enter and adjust a hex color value.\n */\nexport function useColorField(\n props: AriaColorFieldProps,\n state: ColorFieldState,\n ref: RefObject<HTMLInputElement | null>\n): ColorFieldAria {\n let {\n isDisabled,\n isReadOnly,\n isRequired,\n isWheelDisabled,\n validationBehavior = 'aria'\n } = props;\n\n let {\n colorValue,\n inputValue,\n increment,\n decrement,\n incrementToMax,\n decrementToMin,\n commit\n } = state;\n\n let inputId = useId();\n let {spinButtonProps} = useSpinButton(\n {\n isDisabled,\n isReadOnly,\n isRequired,\n maxValue: 0xFFFFFF,\n minValue: 0,\n onIncrement: increment,\n onIncrementToMax: incrementToMax,\n onDecrement: decrement,\n onDecrementToMin: decrementToMin,\n value: colorValue ? colorValue.toHexInt() : undefined,\n textValue: colorValue ? colorValue.toString('hex') : undefined\n }\n );\n\n let [focusWithin, setFocusWithin] = useState(false);\n let {focusWithinProps} = useFocusWithin({isDisabled, onFocusWithinChange: setFocusWithin});\n\n let onWheel = useCallback((e) => {\n if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) {\n return;\n }\n if (e.deltaY > 0) {\n increment();\n } else if (e.deltaY < 0) {\n decrement();\n }\n }, [decrement, increment]);\n // If the input isn't supposed to receive input, disable scrolling.\n let scrollingDisabled = isWheelDisabled || isDisabled || isReadOnly || !focusWithin;\n useScrollWheel({onScroll: onWheel, isDisabled: scrollingDisabled}, ref);\n\n let onChange = value => {\n if (state.validate(value)) {\n state.setInputValue(value);\n }\n };\n\n let {inputProps, ...otherProps} = useFormattedTextField({\n ...props,\n id: inputId,\n value: inputValue,\n // Intentionally invalid value that will be ignored by onChange during form reset\n // This is handled separately below.\n defaultValue: '!',\n validate: undefined,\n [privateValidationStateProp]: state,\n type: 'text',\n autoComplete: 'off',\n onChange\n }, state, ref);\n\n useFormReset(ref, state.defaultColorValue, state.setColorValue);\n\n inputProps = mergeProps(inputProps, spinButtonProps, focusWithinProps, {\n role: 'textbox',\n 'aria-valuemax': null,\n 'aria-valuemin': null,\n 'aria-valuenow': null,\n 'aria-valuetext': null,\n autoCorrect: 'off',\n spellCheck: 'false',\n onBlur: commit\n });\n\n if (validationBehavior === 'native') {\n inputProps['aria-required'] = undefined;\n }\n\n return {\n inputProps,\n ...otherProps\n };\n}\n"],"names":[],"version":3,"file":"useColorField.main.js.map"}
@@ -1,96 +0,0 @@
1
- import {useState as $f8mV7$useState, useCallback as $f8mV7$useCallback} from "react";
2
- import {useId as $f8mV7$useId, useFormReset as $f8mV7$useFormReset, mergeProps as $f8mV7$mergeProps} from "@react-aria/utils";
3
- import {privateValidationStateProp as $f8mV7$privateValidationStateProp} from "@react-stately/form";
4
- import {useFocusWithin as $f8mV7$useFocusWithin, useScrollWheel as $f8mV7$useScrollWheel} from "@react-aria/interactions";
5
- import {useFormattedTextField as $f8mV7$useFormattedTextField} from "@react-aria/textfield";
6
- import {useSpinButton as $f8mV7$useSpinButton} from "@react-aria/spinbutton";
7
-
8
- /*
9
- * Copyright 2020 Adobe. All rights reserved.
10
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
11
- * you may not use this file except in compliance with the License. You may obtain a copy
12
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
13
- *
14
- * Unless required by applicable law or agreed to in writing, software distributed under
15
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
16
- * OF ANY KIND, either express or implied. See the License for the specific language
17
- * governing permissions and limitations under the License.
18
- */
19
-
20
-
21
-
22
-
23
-
24
- function $f6896b05b2ecad12$export$77e32ca575a28fdf(props, state, ref) {
25
- let { isDisabled: isDisabled, isReadOnly: isReadOnly, isRequired: isRequired, isWheelDisabled: isWheelDisabled, validationBehavior: validationBehavior = 'aria' } = props;
26
- let { colorValue: colorValue, inputValue: inputValue, increment: increment, decrement: decrement, incrementToMax: incrementToMax, decrementToMin: decrementToMin, commit: commit } = state;
27
- let inputId = (0, $f8mV7$useId)();
28
- let { spinButtonProps: spinButtonProps } = (0, $f8mV7$useSpinButton)({
29
- isDisabled: isDisabled,
30
- isReadOnly: isReadOnly,
31
- isRequired: isRequired,
32
- maxValue: 0xFFFFFF,
33
- minValue: 0,
34
- onIncrement: increment,
35
- onIncrementToMax: incrementToMax,
36
- onDecrement: decrement,
37
- onDecrementToMin: decrementToMin,
38
- value: colorValue ? colorValue.toHexInt() : undefined,
39
- textValue: colorValue ? colorValue.toString('hex') : undefined
40
- });
41
- let [focusWithin, setFocusWithin] = (0, $f8mV7$useState)(false);
42
- let { focusWithinProps: focusWithinProps } = (0, $f8mV7$useFocusWithin)({
43
- isDisabled: isDisabled,
44
- onFocusWithinChange: setFocusWithin
45
- });
46
- let onWheel = (0, $f8mV7$useCallback)((e)=>{
47
- if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) return;
48
- if (e.deltaY > 0) increment();
49
- else if (e.deltaY < 0) decrement();
50
- }, [
51
- decrement,
52
- increment
53
- ]);
54
- // If the input isn't supposed to receive input, disable scrolling.
55
- let scrollingDisabled = isWheelDisabled || isDisabled || isReadOnly || !focusWithin;
56
- (0, $f8mV7$useScrollWheel)({
57
- onScroll: onWheel,
58
- isDisabled: scrollingDisabled
59
- }, ref);
60
- let onChange = (value)=>{
61
- if (state.validate(value)) state.setInputValue(value);
62
- };
63
- let { inputProps: inputProps, ...otherProps } = (0, $f8mV7$useFormattedTextField)({
64
- ...props,
65
- id: inputId,
66
- value: inputValue,
67
- // Intentionally invalid value that will be ignored by onChange during form reset
68
- // This is handled separately below.
69
- defaultValue: '!',
70
- validate: undefined,
71
- [(0, $f8mV7$privateValidationStateProp)]: state,
72
- type: 'text',
73
- autoComplete: 'off',
74
- onChange: onChange
75
- }, state, ref);
76
- (0, $f8mV7$useFormReset)(ref, state.defaultColorValue, state.setColorValue);
77
- inputProps = (0, $f8mV7$mergeProps)(inputProps, spinButtonProps, focusWithinProps, {
78
- role: 'textbox',
79
- 'aria-valuemax': null,
80
- 'aria-valuemin': null,
81
- 'aria-valuenow': null,
82
- 'aria-valuetext': null,
83
- autoCorrect: 'off',
84
- spellCheck: 'false',
85
- onBlur: commit
86
- });
87
- if (validationBehavior === 'native') inputProps['aria-required'] = undefined;
88
- return {
89
- inputProps: inputProps,
90
- ...otherProps
91
- };
92
- }
93
-
94
-
95
- export {$f6896b05b2ecad12$export$77e32ca575a28fdf as useColorField};
96
- //# sourceMappingURL=useColorField.module.js.map