@react-aria/color 3.0.0-beta.31 → 3.0.0-beta.32

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 (226) hide show
  1. package/dist/ar-AE.main.js +3 -1
  2. package/dist/ar-AE.main.js.map +1 -1
  3. package/dist/ar-AE.mjs +4 -2
  4. package/dist/ar-AE.module.js +3 -1
  5. package/dist/ar-AE.module.js.map +1 -1
  6. package/dist/bg-BG.main.js +3 -1
  7. package/dist/bg-BG.main.js.map +1 -1
  8. package/dist/bg-BG.mjs +4 -2
  9. package/dist/bg-BG.module.js +3 -1
  10. package/dist/bg-BG.module.js.map +1 -1
  11. package/dist/cs-CZ.main.js +3 -1
  12. package/dist/cs-CZ.main.js.map +1 -1
  13. package/dist/cs-CZ.mjs +4 -2
  14. package/dist/cs-CZ.module.js +3 -1
  15. package/dist/cs-CZ.module.js.map +1 -1
  16. package/dist/da-DK.main.js +3 -1
  17. package/dist/da-DK.main.js.map +1 -1
  18. package/dist/da-DK.mjs +4 -2
  19. package/dist/da-DK.module.js +3 -1
  20. package/dist/da-DK.module.js.map +1 -1
  21. package/dist/de-DE.main.js +3 -1
  22. package/dist/de-DE.main.js.map +1 -1
  23. package/dist/de-DE.mjs +4 -2
  24. package/dist/de-DE.module.js +3 -1
  25. package/dist/de-DE.module.js.map +1 -1
  26. package/dist/el-GR.main.js +3 -1
  27. package/dist/el-GR.main.js.map +1 -1
  28. package/dist/el-GR.mjs +4 -2
  29. package/dist/el-GR.module.js +3 -1
  30. package/dist/el-GR.module.js.map +1 -1
  31. package/dist/en-US.main.js +3 -1
  32. package/dist/en-US.main.js.map +1 -1
  33. package/dist/en-US.mjs +4 -2
  34. package/dist/en-US.module.js +3 -1
  35. package/dist/en-US.module.js.map +1 -1
  36. package/dist/es-ES.main.js +3 -1
  37. package/dist/es-ES.main.js.map +1 -1
  38. package/dist/es-ES.mjs +4 -2
  39. package/dist/es-ES.module.js +3 -1
  40. package/dist/es-ES.module.js.map +1 -1
  41. package/dist/et-EE.main.js +3 -1
  42. package/dist/et-EE.main.js.map +1 -1
  43. package/dist/et-EE.mjs +4 -2
  44. package/dist/et-EE.module.js +3 -1
  45. package/dist/et-EE.module.js.map +1 -1
  46. package/dist/fi-FI.main.js +3 -1
  47. package/dist/fi-FI.main.js.map +1 -1
  48. package/dist/fi-FI.mjs +4 -2
  49. package/dist/fi-FI.module.js +3 -1
  50. package/dist/fi-FI.module.js.map +1 -1
  51. package/dist/fr-FR.main.js +3 -1
  52. package/dist/fr-FR.main.js.map +1 -1
  53. package/dist/fr-FR.mjs +4 -2
  54. package/dist/fr-FR.module.js +3 -1
  55. package/dist/fr-FR.module.js.map +1 -1
  56. package/dist/he-IL.main.js +3 -1
  57. package/dist/he-IL.main.js.map +1 -1
  58. package/dist/he-IL.mjs +4 -2
  59. package/dist/he-IL.module.js +3 -1
  60. package/dist/he-IL.module.js.map +1 -1
  61. package/dist/hr-HR.main.js +3 -1
  62. package/dist/hr-HR.main.js.map +1 -1
  63. package/dist/hr-HR.mjs +4 -2
  64. package/dist/hr-HR.module.js +3 -1
  65. package/dist/hr-HR.module.js.map +1 -1
  66. package/dist/hu-HU.main.js +3 -1
  67. package/dist/hu-HU.main.js.map +1 -1
  68. package/dist/hu-HU.mjs +4 -2
  69. package/dist/hu-HU.module.js +3 -1
  70. package/dist/hu-HU.module.js.map +1 -1
  71. package/dist/import.mjs +7 -1119
  72. package/dist/intlStrings.main.js +108 -0
  73. package/dist/intlStrings.main.js.map +1 -0
  74. package/dist/intlStrings.mjs +110 -0
  75. package/dist/intlStrings.module.js +110 -0
  76. package/dist/intlStrings.module.js.map +1 -0
  77. package/dist/it-IT.main.js +3 -1
  78. package/dist/it-IT.main.js.map +1 -1
  79. package/dist/it-IT.mjs +4 -2
  80. package/dist/it-IT.module.js +3 -1
  81. package/dist/it-IT.module.js.map +1 -1
  82. package/dist/ja-JP.main.js +3 -1
  83. package/dist/ja-JP.main.js.map +1 -1
  84. package/dist/ja-JP.mjs +4 -2
  85. package/dist/ja-JP.module.js +3 -1
  86. package/dist/ja-JP.module.js.map +1 -1
  87. package/dist/ko-KR.main.js +3 -1
  88. package/dist/ko-KR.main.js.map +1 -1
  89. package/dist/ko-KR.mjs +4 -2
  90. package/dist/ko-KR.module.js +3 -1
  91. package/dist/ko-KR.module.js.map +1 -1
  92. package/dist/lt-LT.main.js +3 -1
  93. package/dist/lt-LT.main.js.map +1 -1
  94. package/dist/lt-LT.mjs +4 -2
  95. package/dist/lt-LT.module.js +3 -1
  96. package/dist/lt-LT.module.js.map +1 -1
  97. package/dist/lv-LV.main.js +3 -1
  98. package/dist/lv-LV.main.js.map +1 -1
  99. package/dist/lv-LV.mjs +4 -2
  100. package/dist/lv-LV.module.js +3 -1
  101. package/dist/lv-LV.module.js.map +1 -1
  102. package/dist/main.js +12 -1122
  103. package/dist/main.js.map +1 -1
  104. package/dist/module.js +7 -1119
  105. package/dist/module.js.map +1 -1
  106. package/dist/nb-NO.main.js +3 -1
  107. package/dist/nb-NO.main.js.map +1 -1
  108. package/dist/nb-NO.mjs +4 -2
  109. package/dist/nb-NO.module.js +3 -1
  110. package/dist/nb-NO.module.js.map +1 -1
  111. package/dist/nl-NL.main.js +3 -1
  112. package/dist/nl-NL.main.js.map +1 -1
  113. package/dist/nl-NL.mjs +4 -2
  114. package/dist/nl-NL.module.js +3 -1
  115. package/dist/nl-NL.module.js.map +1 -1
  116. package/dist/pl-PL.main.js +3 -1
  117. package/dist/pl-PL.main.js.map +1 -1
  118. package/dist/pl-PL.mjs +4 -2
  119. package/dist/pl-PL.module.js +3 -1
  120. package/dist/pl-PL.module.js.map +1 -1
  121. package/dist/pt-BR.main.js +3 -1
  122. package/dist/pt-BR.main.js.map +1 -1
  123. package/dist/pt-BR.mjs +4 -2
  124. package/dist/pt-BR.module.js +3 -1
  125. package/dist/pt-BR.module.js.map +1 -1
  126. package/dist/pt-PT.main.js +3 -1
  127. package/dist/pt-PT.main.js.map +1 -1
  128. package/dist/pt-PT.mjs +4 -2
  129. package/dist/pt-PT.module.js +3 -1
  130. package/dist/pt-PT.module.js.map +1 -1
  131. package/dist/ro-RO.main.js +3 -1
  132. package/dist/ro-RO.main.js.map +1 -1
  133. package/dist/ro-RO.mjs +4 -2
  134. package/dist/ro-RO.module.js +3 -1
  135. package/dist/ro-RO.module.js.map +1 -1
  136. package/dist/ru-RU.main.js +3 -1
  137. package/dist/ru-RU.main.js.map +1 -1
  138. package/dist/ru-RU.mjs +4 -2
  139. package/dist/ru-RU.module.js +3 -1
  140. package/dist/ru-RU.module.js.map +1 -1
  141. package/dist/sk-SK.main.js +3 -1
  142. package/dist/sk-SK.main.js.map +1 -1
  143. package/dist/sk-SK.mjs +4 -2
  144. package/dist/sk-SK.module.js +3 -1
  145. package/dist/sk-SK.module.js.map +1 -1
  146. package/dist/sl-SI.main.js +3 -1
  147. package/dist/sl-SI.main.js.map +1 -1
  148. package/dist/sl-SI.mjs +4 -2
  149. package/dist/sl-SI.module.js +3 -1
  150. package/dist/sl-SI.module.js.map +1 -1
  151. package/dist/sr-SP.main.js +3 -1
  152. package/dist/sr-SP.main.js.map +1 -1
  153. package/dist/sr-SP.mjs +4 -2
  154. package/dist/sr-SP.module.js +3 -1
  155. package/dist/sr-SP.module.js.map +1 -1
  156. package/dist/sv-SE.main.js +3 -1
  157. package/dist/sv-SE.main.js.map +1 -1
  158. package/dist/sv-SE.mjs +4 -2
  159. package/dist/sv-SE.module.js +3 -1
  160. package/dist/sv-SE.module.js.map +1 -1
  161. package/dist/tr-TR.main.js +3 -1
  162. package/dist/tr-TR.main.js.map +1 -1
  163. package/dist/tr-TR.mjs +4 -2
  164. package/dist/tr-TR.module.js +3 -1
  165. package/dist/tr-TR.module.js.map +1 -1
  166. package/dist/types.d.ts +41 -7
  167. package/dist/types.d.ts.map +1 -1
  168. package/dist/uk-UA.main.js +3 -1
  169. package/dist/uk-UA.main.js.map +1 -1
  170. package/dist/uk-UA.mjs +4 -2
  171. package/dist/uk-UA.module.js +3 -1
  172. package/dist/uk-UA.module.js.map +1 -1
  173. package/dist/useColorArea.main.js +404 -0
  174. package/dist/useColorArea.main.js.map +1 -0
  175. package/dist/useColorArea.mjs +399 -0
  176. package/dist/useColorArea.module.js +399 -0
  177. package/dist/useColorArea.module.js.map +1 -0
  178. package/dist/useColorAreaGradient.main.js +123 -0
  179. package/dist/useColorAreaGradient.main.js.map +1 -0
  180. package/dist/useColorAreaGradient.mjs +118 -0
  181. package/dist/useColorAreaGradient.module.js +118 -0
  182. package/dist/useColorAreaGradient.module.js.map +1 -0
  183. package/dist/useColorChannelField.main.js +36 -0
  184. package/dist/useColorChannelField.main.js.map +1 -0
  185. package/dist/useColorChannelField.mjs +31 -0
  186. package/dist/useColorChannelField.module.js +31 -0
  187. package/dist/useColorChannelField.module.js.map +1 -0
  188. package/dist/useColorField.main.js +98 -0
  189. package/dist/useColorField.main.js.map +1 -0
  190. package/dist/useColorField.mjs +93 -0
  191. package/dist/useColorField.module.js +93 -0
  192. package/dist/useColorField.module.js.map +1 -0
  193. package/dist/useColorSlider.main.js +132 -0
  194. package/dist/useColorSlider.main.js.map +1 -0
  195. package/dist/useColorSlider.mjs +127 -0
  196. package/dist/useColorSlider.module.js +127 -0
  197. package/dist/useColorSlider.module.js.map +1 -0
  198. package/dist/useColorSwatch.main.js +67 -0
  199. package/dist/useColorSwatch.main.js.map +1 -0
  200. package/dist/useColorSwatch.mjs +62 -0
  201. package/dist/useColorSwatch.module.js +62 -0
  202. package/dist/useColorSwatch.module.js.map +1 -0
  203. package/dist/useColorWheel.main.js +274 -0
  204. package/dist/useColorWheel.main.js.map +1 -0
  205. package/dist/useColorWheel.mjs +269 -0
  206. package/dist/useColorWheel.module.js +269 -0
  207. package/dist/useColorWheel.module.js.map +1 -0
  208. package/dist/zh-CN.main.js +3 -1
  209. package/dist/zh-CN.main.js.map +1 -1
  210. package/dist/zh-CN.mjs +4 -2
  211. package/dist/zh-CN.module.js +3 -1
  212. package/dist/zh-CN.module.js.map +1 -1
  213. package/dist/zh-TW.main.js +3 -1
  214. package/dist/zh-TW.main.js.map +1 -1
  215. package/dist/zh-TW.mjs +4 -2
  216. package/dist/zh-TW.module.js +3 -1
  217. package/dist/zh-TW.module.js.map +1 -1
  218. package/package.json +14 -13
  219. package/src/index.ts +4 -0
  220. package/src/useColorArea.ts +32 -23
  221. package/src/useColorAreaGradient.ts +66 -189
  222. package/src/useColorChannelField.ts +37 -0
  223. package/src/useColorField.ts +18 -14
  224. package/src/useColorSlider.ts +28 -4
  225. package/src/useColorSwatch.ts +74 -0
  226. package/src/useColorWheel.ts +19 -5
package/dist/main.js CHANGED
@@ -1,724 +1,21 @@
1
- var $f141a15c3076a67b$exports = require("./ar-AE.main.js");
2
- var $435ac2a9fdd2ae5e$exports = require("./bg-BG.main.js");
3
- var $6b29758b432284f5$exports = require("./cs-CZ.main.js");
4
- var $357597bcf4afd6fb$exports = require("./da-DK.main.js");
5
- var $ddc6333960e2b591$exports = require("./de-DE.main.js");
6
- var $417ee93d3ca474c0$exports = require("./el-GR.main.js");
7
- var $519561bc6dcff98b$exports = require("./en-US.main.js");
8
- var $7a34c3fcc03402b8$exports = require("./es-ES.main.js");
9
- var $860f86d6eae22cba$exports = require("./et-EE.main.js");
10
- var $8525d3c77b8a51b0$exports = require("./fi-FI.main.js");
11
- var $8240fe6825e900ec$exports = require("./fr-FR.main.js");
12
- var $377849238307c673$exports = require("./he-IL.main.js");
13
- var $5a6f44e0ec14b083$exports = require("./hr-HR.main.js");
14
- var $82327d6e71e3e273$exports = require("./hu-HU.main.js");
15
- var $b1e297275c248ab8$exports = require("./it-IT.main.js");
16
- var $b39c9f2638b4d2b9$exports = require("./ja-JP.main.js");
17
- var $2d2fbf4195848a62$exports = require("./ko-KR.main.js");
18
- var $ea88350d0828fa2c$exports = require("./lt-LT.main.js");
19
- var $0e0acd541630120a$exports = require("./lv-LV.main.js");
20
- var $952a458224052046$exports = require("./nb-NO.main.js");
21
- var $2d8e195bc5683483$exports = require("./nl-NL.main.js");
22
- var $750d83f83c5f38d4$exports = require("./pl-PL.main.js");
23
- var $656b2846f611067c$exports = require("./pt-BR.main.js");
24
- var $58ce120874d069dd$exports = require("./pt-PT.main.js");
25
- var $fd6c85b4eba18825$exports = require("./ro-RO.main.js");
26
- var $8849a15ecc435984$exports = require("./ru-RU.main.js");
27
- var $5192372f064be783$exports = require("./sk-SK.main.js");
28
- var $094525f9176df65d$exports = require("./sl-SI.main.js");
29
- var $9795aa59b4ad40ed$exports = require("./sr-SP.main.js");
30
- var $9ebaa0b485f13e4d$exports = require("./sv-SE.main.js");
31
- var $ad58e2e4e0f2e750$exports = require("./tr-TR.main.js");
32
- var $dafc19306f8b2dfc$exports = require("./uk-UA.main.js");
33
- var $d31a8b80af5acc16$exports = require("./zh-CN.main.js");
34
- var $7377d28aec5fa200$exports = require("./zh-TW.main.js");
35
- var $kZqDi$reactariautils = require("@react-aria/utils");
36
- var $kZqDi$react = require("react");
37
- var $kZqDi$reactariainteractions = require("@react-aria/interactions");
38
- var $kZqDi$reactariai18n = require("@react-aria/i18n");
39
- var $kZqDi$reactariavisuallyhidden = require("@react-aria/visually-hidden");
40
- var $kZqDi$reactariaslider = require("@react-aria/slider");
41
- var $kZqDi$reactstatelyform = require("@react-stately/form");
42
- var $kZqDi$reactariatextfield = require("@react-aria/textfield");
43
- var $kZqDi$reactariaspinbutton = require("@react-aria/spinbutton");
1
+ var $47925bd68062ac17$exports = require("./useColorArea.main.js");
2
+ var $afbb9647440a7f5b$exports = require("./useColorSlider.main.js");
3
+ var $1d29bf243d4a9a53$exports = require("./useColorWheel.main.js");
4
+ var $58c850037bc7a7ce$exports = require("./useColorField.main.js");
5
+ var $7c947b33be1ec2a6$exports = require("./useColorSwatch.main.js");
6
+ var $d84c0c836f6e3601$exports = require("./useColorChannelField.main.js");
44
7
 
45
8
 
46
9
  function $parcel$export(e, n, v, s) {
47
10
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
48
11
  }
49
12
 
50
- function $parcel$interopDefault(a) {
51
- return a && a.__esModule ? a.default : a;
52
- }
53
-
54
- $parcel$export(module.exports, "useColorArea", () => $47925bd68062ac17$export$2f92a7a615a014f6);
55
- $parcel$export(module.exports, "useColorSlider", () => $afbb9647440a7f5b$export$106b7a4e66508f66);
56
- $parcel$export(module.exports, "useColorWheel", () => $1d29bf243d4a9a53$export$9064ff4e44b3729a);
57
- $parcel$export(module.exports, "useColorField", () => $58c850037bc7a7ce$export$77e32ca575a28fdf);
58
- /*
59
- * Copyright 2020 Adobe. All rights reserved.
60
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
61
- * you may not use this file except in compliance with the License. You may obtain a copy
62
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
63
- *
64
- * Unless required by applicable law or agreed to in writing, software distributed under
65
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
66
- * OF ANY KIND, either express or implied. See the License for the specific language
67
- * governing permissions and limitations under the License.
68
- */ /*
69
- * Copyright 2020 Adobe. All rights reserved.
70
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
71
- * you may not use this file except in compliance with the License. You may obtain a copy
72
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
73
- *
74
- * Unless required by applicable law or agreed to in writing, software distributed under
75
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
76
- * OF ANY KIND, either express or implied. See the License for the specific language
77
- * governing permissions and limitations under the License.
78
- */
79
- var $4a33e168940636d5$exports = {};
80
-
81
-
82
-
83
-
84
-
85
-
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
-
96
-
97
-
98
-
99
-
100
-
101
-
102
-
103
-
104
-
105
-
106
-
107
-
108
-
109
-
110
-
111
-
112
-
113
-
114
- $4a33e168940636d5$exports = {
115
- "ar-AE": $f141a15c3076a67b$exports,
116
- "bg-BG": $435ac2a9fdd2ae5e$exports,
117
- "cs-CZ": $6b29758b432284f5$exports,
118
- "da-DK": $357597bcf4afd6fb$exports,
119
- "de-DE": $ddc6333960e2b591$exports,
120
- "el-GR": $417ee93d3ca474c0$exports,
121
- "en-US": $519561bc6dcff98b$exports,
122
- "es-ES": $7a34c3fcc03402b8$exports,
123
- "et-EE": $860f86d6eae22cba$exports,
124
- "fi-FI": $8525d3c77b8a51b0$exports,
125
- "fr-FR": $8240fe6825e900ec$exports,
126
- "he-IL": $377849238307c673$exports,
127
- "hr-HR": $5a6f44e0ec14b083$exports,
128
- "hu-HU": $82327d6e71e3e273$exports,
129
- "it-IT": $b1e297275c248ab8$exports,
130
- "ja-JP": $b39c9f2638b4d2b9$exports,
131
- "ko-KR": $2d2fbf4195848a62$exports,
132
- "lt-LT": $ea88350d0828fa2c$exports,
133
- "lv-LV": $0e0acd541630120a$exports,
134
- "nb-NO": $952a458224052046$exports,
135
- "nl-NL": $2d8e195bc5683483$exports,
136
- "pl-PL": $750d83f83c5f38d4$exports,
137
- "pt-BR": $656b2846f611067c$exports,
138
- "pt-PT": $58ce120874d069dd$exports,
139
- "ro-RO": $fd6c85b4eba18825$exports,
140
- "ru-RU": $8849a15ecc435984$exports,
141
- "sk-SK": $5192372f064be783$exports,
142
- "sl-SI": $094525f9176df65d$exports,
143
- "sr-SP": $9795aa59b4ad40ed$exports,
144
- "sv-SE": $9ebaa0b485f13e4d$exports,
145
- "tr-TR": $ad58e2e4e0f2e750$exports,
146
- "uk-UA": $dafc19306f8b2dfc$exports,
147
- "zh-CN": $d31a8b80af5acc16$exports,
148
- "zh-TW": $7377d28aec5fa200$exports
149
- };
150
-
151
-
152
-
153
- /*
154
- * Copyright 2022 Adobe. All rights reserved.
155
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
156
- * you may not use this file except in compliance with the License. You may obtain a copy
157
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
158
- *
159
- * Unless required by applicable law or agreed to in writing, software distributed under
160
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
161
- * OF ANY KIND, either express or implied. See the License for the specific language
162
- * governing permissions and limitations under the License.
163
- */
164
- const $99936ad0bf67c8c4$var$generateRGB_R = (orientation, dir, zValue)=>{
165
- let maskImage = `linear-gradient(to ${orientation[Number(!dir)]}, transparent, #000)`;
166
- let result = {
167
- colorAreaStyles: {
168
- backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(${zValue},0,0),rgb(${zValue},255,0))`
169
- },
170
- gradientStyles: {
171
- backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(${zValue},0,255),rgb(${zValue},255,255))`,
172
- "WebkitMaskImage": maskImage,
173
- maskImage: maskImage
174
- }
175
- };
176
- return result;
177
- };
178
- const $99936ad0bf67c8c4$var$generateRGB_G = (orientation, dir, zValue)=>{
179
- let maskImage = `linear-gradient(to ${orientation[Number(!dir)]}, transparent, #000)`;
180
- let result = {
181
- colorAreaStyles: {
182
- backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(0,${zValue},0),rgb(255,${zValue},0))`
183
- },
184
- gradientStyles: {
185
- backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(0,${zValue},255),rgb(255,${zValue},255))`,
186
- "WebkitMaskImage": maskImage,
187
- maskImage: maskImage
188
- }
189
- };
190
- return result;
191
- };
192
- const $99936ad0bf67c8c4$var$generateRGB_B = (orientation, dir, zValue)=>{
193
- let maskImage = `linear-gradient(to ${orientation[Number(!dir)]}, transparent, #000)`;
194
- let result = {
195
- colorAreaStyles: {
196
- backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(0,0,${zValue}),rgb(255,0,${zValue}))`
197
- },
198
- gradientStyles: {
199
- backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(0,255,${zValue}),rgb(255,255,${zValue}))`,
200
- "WebkitMaskImage": maskImage,
201
- maskImage: maskImage
202
- }
203
- };
204
- return result;
205
- };
206
- const $99936ad0bf67c8c4$var$generateHSL_H = (orientation, dir, zValue)=>{
207
- let result = {
208
- colorAreaStyles: {},
209
- gradientStyles: {
210
- background: [
211
- `linear-gradient(to ${orientation[Number(dir)]}, hsla(0,0%,0%,1) 0%, hsla(0,0%,0%,0) 50%, hsla(0,0%,100%,0) 50%, hsla(0,0%,100%,1) 100%)`,
212
- `linear-gradient(to ${orientation[Number(!dir)]},hsl(0,0%,50%),hsla(0,0%,50%,0))`,
213
- `hsl(${zValue}, 100%, 50%)`
214
- ].join(",")
215
- }
216
- };
217
- return result;
218
- };
219
- const $99936ad0bf67c8c4$var$generateHSL_S = (orientation, dir, alphaValue)=>{
220
- let result = {
221
- colorAreaStyles: {},
222
- gradientStyles: {
223
- background: [
224
- `linear-gradient(to ${orientation[Number(!dir)]}, hsla(0,0%,0%,${alphaValue}) 0%, hsla(0,0%,0%,0) 50%, hsla(0,0%,100%,0) 50%, hsla(0,0%,100%,${alphaValue}) 100%)`,
225
- `linear-gradient(to ${orientation[Number(dir)]},hsla(0,100%,50%,${alphaValue}),hsla(60,100%,50%,${alphaValue}),hsla(120,100%,50%,${alphaValue}),hsla(180,100%,50%,${alphaValue}),hsla(240,100%,50%,${alphaValue}),hsla(300,100%,50%,${alphaValue}),hsla(359,100%,50%,${alphaValue}))`,
226
- "hsl(0, 0%, 50%)"
227
- ].join(",")
228
- }
229
- };
230
- return result;
231
- };
232
- const $99936ad0bf67c8c4$var$generateHSL_L = (orientation, dir, zValue)=>{
233
- let result = {
234
- colorAreaStyles: {},
235
- gradientStyles: {
236
- backgroundImage: [
237
- `linear-gradient(to ${orientation[Number(!dir)]},hsl(0,0%,${zValue}%),hsla(0,0%,${zValue}%,0))`,
238
- `linear-gradient(to ${orientation[Number(dir)]},hsl(0,100%,${zValue}%),hsl(60,100%,${zValue}%),hsl(120,100%,${zValue}%),hsl(180,100%,${zValue}%),hsl(240,100%,${zValue}%),hsl(300,100%,${zValue}%),hsl(360,100%,${zValue}%))`
239
- ].join(",")
240
- }
241
- };
242
- return result;
243
- };
244
- const $99936ad0bf67c8c4$var$generateHSB_H = (orientation, dir, zValue)=>{
245
- let result = {
246
- colorAreaStyles: {},
247
- gradientStyles: {
248
- background: [
249
- `linear-gradient(to ${orientation[Number(dir)]},hsl(0,0%,0%),hsla(0,0%,0%,0))`,
250
- `linear-gradient(to ${orientation[Number(!dir)]},hsl(0,0%,100%),hsla(0,0%,100%,0))`,
251
- `hsl(${zValue}, 100%, 50%)`
252
- ].join(",")
253
- }
254
- };
255
- return result;
256
- };
257
- const $99936ad0bf67c8c4$var$generateHSB_S = (orientation, dir, alphaValue)=>{
258
- let result = {
259
- colorAreaStyles: {},
260
- gradientStyles: {
261
- background: [
262
- `linear-gradient(to ${orientation[Number(!dir)]},hsla(0,0%,0%,${alphaValue}),hsla(0,0%,0%,0))`,
263
- `linear-gradient(to ${orientation[Number(dir)]},hsla(0,100%,50%,${alphaValue}),hsla(60,100%,50%,${alphaValue}),hsla(120,100%,50%,${alphaValue}),hsla(180,100%,50%,${alphaValue}),hsla(240,100%,50%,${alphaValue}),hsla(300,100%,50%,${alphaValue}),hsla(359,100%,50%,${alphaValue}))`,
264
- `linear-gradient(to ${orientation[Number(!dir)]},hsl(0,0%,0%),hsl(0,0%,100%))`
265
- ].join(",")
266
- }
267
- };
268
- return result;
269
- };
270
- const $99936ad0bf67c8c4$var$generateHSB_B = (orientation, dir, alphaValue)=>{
271
- let result = {
272
- colorAreaStyles: {},
273
- gradientStyles: {
274
- background: [
275
- `linear-gradient(to ${orientation[Number(!dir)]},hsla(0,0%,100%,${alphaValue}),hsla(0,0%,100%,0))`,
276
- `linear-gradient(to ${orientation[Number(dir)]},hsla(0,100%,50%,${alphaValue}),hsla(60,100%,50%,${alphaValue}),hsla(120,100%,50%,${alphaValue}),hsla(180,100%,50%,${alphaValue}),hsla(240,100%,50%,${alphaValue}),hsla(300,100%,50%,${alphaValue}),hsla(359,100%,50%,${alphaValue}))`,
277
- "#000"
278
- ].join(",")
279
- }
280
- };
281
- return result;
282
- };
283
- function $99936ad0bf67c8c4$export$dd62420467d245ca({ direction: direction, state: state, zChannel: zChannel, xChannel: xChannel, isDisabled: isDisabled }) {
284
- let returnVal = (0, $kZqDi$react.useMemo)(()=>{
285
- let orientation = [
286
- "top",
287
- direction === "rtl" ? "left" : "right"
288
- ];
289
- let dir = false;
290
- let background = {
291
- colorAreaStyles: {},
292
- gradientStyles: {}
293
- };
294
- let zValue = state.value.getChannelValue(zChannel);
295
- let { minValue: zMin, maxValue: zMax } = state.value.getChannelRange(zChannel);
296
- let alphaValue = (zValue - zMin) / (zMax - zMin);
297
- let isHSL = state.value.getColorSpace() === "hsl";
298
- if (!isDisabled) switch(zChannel){
299
- case "red":
300
- dir = xChannel === "green";
301
- background = $99936ad0bf67c8c4$var$generateRGB_R(orientation, dir, zValue);
302
- break;
303
- case "green":
304
- dir = xChannel === "red";
305
- background = $99936ad0bf67c8c4$var$generateRGB_G(orientation, dir, zValue);
306
- break;
307
- case "blue":
308
- dir = xChannel === "red";
309
- background = $99936ad0bf67c8c4$var$generateRGB_B(orientation, dir, zValue);
310
- break;
311
- case "hue":
312
- dir = xChannel !== "saturation";
313
- if (isHSL) background = $99936ad0bf67c8c4$var$generateHSL_H(orientation, dir, zValue);
314
- else background = $99936ad0bf67c8c4$var$generateHSB_H(orientation, dir, zValue);
315
- break;
316
- case "saturation":
317
- dir = xChannel === "hue";
318
- if (isHSL) background = $99936ad0bf67c8c4$var$generateHSL_S(orientation, dir, alphaValue);
319
- else background = $99936ad0bf67c8c4$var$generateHSB_S(orientation, dir, alphaValue);
320
- break;
321
- case "brightness":
322
- dir = xChannel === "hue";
323
- background = $99936ad0bf67c8c4$var$generateHSB_B(orientation, dir, alphaValue);
324
- break;
325
- case "lightness":
326
- dir = xChannel === "hue";
327
- background = $99936ad0bf67c8c4$var$generateHSL_L(orientation, dir, zValue);
328
- break;
329
- }
330
- let { x: x, y: y } = state.getThumbPosition();
331
- if (direction === "rtl") x = 1 - x;
332
- let forcedColorAdjustNoneStyle = {
333
- forcedColorAdjust: "none"
334
- };
335
- return {
336
- colorAreaStyleProps: {
337
- style: {
338
- position: "relative",
339
- touchAction: "none",
340
- ...forcedColorAdjustNoneStyle,
341
- ...background.colorAreaStyles
342
- }
343
- },
344
- gradientStyleProps: {
345
- style: {
346
- touchAction: "none",
347
- ...forcedColorAdjustNoneStyle,
348
- ...background.gradientStyles
349
- }
350
- },
351
- thumbStyleProps: {
352
- style: {
353
- position: "absolute",
354
- left: `${x * 100}%`,
355
- top: `${y * 100}%`,
356
- transform: "translate(0%, 0%)",
357
- touchAction: "none",
358
- ...forcedColorAdjustNoneStyle
359
- }
360
- }
361
- };
362
- }, [
363
- direction,
364
- state,
365
- zChannel,
366
- xChannel,
367
- isDisabled
368
- ]);
369
- return returnVal;
370
- }
371
-
372
-
373
-
374
-
375
-
376
- function $47925bd68062ac17$export$2f92a7a615a014f6(props, state) {
377
- let { isDisabled: isDisabled, inputXRef: inputXRef, inputYRef: inputYRef, containerRef: containerRef, "aria-label": ariaLabel, xName: xName, yName: yName } = props;
378
- let stringFormatter = (0, $kZqDi$reactariai18n.useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($4a33e168940636d5$exports))), "@react-aria/color");
379
- let { addGlobalListener: addGlobalListener, removeGlobalListener: removeGlobalListener } = (0, $kZqDi$reactariautils.useGlobalListeners)();
380
- let { direction: direction, locale: locale } = (0, $kZqDi$reactariai18n.useLocale)();
381
- let [focusedInput, setFocusedInput] = (0, $kZqDi$react.useState)(null);
382
- let focusInput = (0, $kZqDi$react.useCallback)((inputRef = inputXRef)=>{
383
- if (inputRef.current) (0, $kZqDi$reactariautils.focusWithoutScrolling)(inputRef.current);
384
- }, [
385
- inputXRef
386
- ]);
387
- (0, $kZqDi$reactariautils.useFormReset)(inputXRef, [
388
- state.xValue,
389
- state.yValue
390
- ], ([x, y])=>{
391
- let newColor = state.value.withChannelValue(state.channels.xChannel, x).withChannelValue(state.channels.yChannel, y);
392
- state.setValue(newColor);
393
- });
394
- let [valueChangedViaKeyboard, setValueChangedViaKeyboard] = (0, $kZqDi$react.useState)(false);
395
- let { xChannel: xChannel, yChannel: yChannel, zChannel: zChannel } = state.channels;
396
- let xChannelStep = state.xChannelStep;
397
- let yChannelStep = state.yChannelStep;
398
- let currentPosition = (0, $kZqDi$react.useRef)(null);
399
- let { keyboardProps: keyboardProps } = (0, $kZqDi$reactariainteractions.useKeyboard)({
400
- onKeyDown (e) {
401
- // these are the cases that useMove doesn't handle
402
- if (!/^(PageUp|PageDown|Home|End)$/.test(e.key)) {
403
- e.continuePropagation();
404
- return;
405
- }
406
- // same handling as useMove, don't need to stop propagation, useKeyboard will do that for us
407
- e.preventDefault();
408
- // remember to set this and unset it so that onChangeEnd is fired
409
- state.setDragging(true);
410
- setValueChangedViaKeyboard(true);
411
- let dir;
412
- switch(e.key){
413
- case "PageUp":
414
- state.incrementY(state.yChannelPageStep);
415
- dir = "y";
416
- break;
417
- case "PageDown":
418
- state.decrementY(state.yChannelPageStep);
419
- dir = "y";
420
- break;
421
- case "Home":
422
- direction === "rtl" ? state.incrementX(state.xChannelPageStep) : state.decrementX(state.xChannelPageStep);
423
- dir = "x";
424
- break;
425
- case "End":
426
- direction === "rtl" ? state.decrementX(state.xChannelPageStep) : state.incrementX(state.xChannelPageStep);
427
- dir = "x";
428
- break;
429
- }
430
- state.setDragging(false);
431
- if (dir) {
432
- let input = dir === "x" ? inputXRef : inputYRef;
433
- focusInput(input);
434
- setFocusedInput(dir);
435
- }
436
- }
437
- });
438
- let moveHandler = {
439
- onMoveStart () {
440
- currentPosition.current = null;
441
- state.setDragging(true);
442
- },
443
- onMove ({ deltaX: deltaX, deltaY: deltaY, pointerType: pointerType, shiftKey: shiftKey }) {
444
- var _containerRef_current;
445
- let { incrementX: incrementX, decrementX: decrementX, incrementY: incrementY, decrementY: decrementY, xChannelPageStep: xChannelPageStep, xChannelStep: xChannelStep, yChannelPageStep: yChannelPageStep, yChannelStep: yChannelStep, getThumbPosition: getThumbPosition, setColorFromPoint: setColorFromPoint } = state;
446
- if (currentPosition.current == null) currentPosition.current = getThumbPosition();
447
- let { width: width, height: height } = ((_containerRef_current = containerRef.current) === null || _containerRef_current === void 0 ? void 0 : _containerRef_current.getBoundingClientRect()) || {
448
- width: 0,
449
- height: 0
450
- };
451
- let valueChanged = deltaX !== 0 || deltaY !== 0;
452
- if (pointerType === "keyboard") {
453
- let deltaXValue = shiftKey && xChannelPageStep > xChannelStep ? xChannelPageStep : xChannelStep;
454
- let deltaYValue = shiftKey && yChannelPageStep > yChannelStep ? yChannelPageStep : yChannelStep;
455
- if (deltaX > 0 && direction === "ltr" || deltaX < 0 && direction === "rtl") incrementX(deltaXValue);
456
- else if (deltaX < 0 && direction === "ltr" || deltaX > 0 && direction === "rtl") decrementX(deltaXValue);
457
- else if (deltaY > 0) decrementY(deltaYValue);
458
- else if (deltaY < 0) incrementY(deltaYValue);
459
- setValueChangedViaKeyboard(valueChanged);
460
- // set the focused input based on which axis has the greater delta
461
- focusedInput = valueChanged && Math.abs(deltaY) > Math.abs(deltaX) ? "y" : "x";
462
- setFocusedInput(focusedInput);
463
- } else {
464
- currentPosition.current.x += (direction === "rtl" ? -1 : 1) * deltaX / width;
465
- currentPosition.current.y += deltaY / height;
466
- setColorFromPoint(currentPosition.current.x, currentPosition.current.y);
467
- }
468
- },
469
- onMoveEnd () {
470
- isOnColorArea.current = false;
471
- state.setDragging(false);
472
- let input = focusedInput === "x" ? inputXRef : inputYRef;
473
- focusInput(input);
474
- }
475
- };
476
- let { moveProps: movePropsThumb } = (0, $kZqDi$reactariainteractions.useMove)(moveHandler);
477
- let { focusWithinProps: focusWithinProps } = (0, $kZqDi$reactariainteractions.useFocusWithin)({
478
- onFocusWithinChange: (focusWithin)=>{
479
- if (!focusWithin) setValueChangedViaKeyboard(false);
480
- }
481
- });
482
- let currentPointer = (0, $kZqDi$react.useRef)(undefined);
483
- let isOnColorArea = (0, $kZqDi$react.useRef)(false);
484
- let { moveProps: movePropsContainer } = (0, $kZqDi$reactariainteractions.useMove)({
485
- onMoveStart () {
486
- if (isOnColorArea.current) moveHandler.onMoveStart();
487
- },
488
- onMove (e) {
489
- if (isOnColorArea.current) moveHandler.onMove(e);
490
- },
491
- onMoveEnd () {
492
- if (isOnColorArea.current) moveHandler.onMoveEnd();
493
- }
494
- });
495
- let onThumbDown = (id)=>{
496
- if (!state.isDragging) {
497
- currentPointer.current = id;
498
- setValueChangedViaKeyboard(false);
499
- focusInput();
500
- state.setDragging(true);
501
- if (typeof PointerEvent !== "undefined") addGlobalListener(window, "pointerup", onThumbUp, false);
502
- else {
503
- addGlobalListener(window, "mouseup", onThumbUp, false);
504
- addGlobalListener(window, "touchend", onThumbUp, false);
505
- }
506
- }
507
- };
508
- let onThumbUp = (e)=>{
509
- var _e_changedTouches;
510
- var _e_pointerId;
511
- let id = (_e_pointerId = e.pointerId) !== null && _e_pointerId !== void 0 ? _e_pointerId : (_e_changedTouches = e.changedTouches) === null || _e_changedTouches === void 0 ? void 0 : _e_changedTouches[0].identifier;
512
- if (id === currentPointer.current) {
513
- setValueChangedViaKeyboard(false);
514
- focusInput();
515
- state.setDragging(false);
516
- currentPointer.current = undefined;
517
- isOnColorArea.current = false;
518
- if (typeof PointerEvent !== "undefined") removeGlobalListener(window, "pointerup", onThumbUp, false);
519
- else {
520
- removeGlobalListener(window, "mouseup", onThumbUp, false);
521
- removeGlobalListener(window, "touchend", onThumbUp, false);
522
- }
523
- }
524
- };
525
- let onColorAreaDown = (colorArea, id, clientX, clientY)=>{
526
- let rect = colorArea.getBoundingClientRect();
527
- let { width: width, height: height } = rect;
528
- let x = (clientX - rect.x) / width;
529
- let y = (clientY - rect.y) / height;
530
- if (direction === "rtl") x = 1 - x;
531
- if (x >= 0 && x <= 1 && y >= 0 && y <= 1 && !state.isDragging && currentPointer.current === undefined) {
532
- isOnColorArea.current = true;
533
- setValueChangedViaKeyboard(false);
534
- currentPointer.current = id;
535
- state.setColorFromPoint(x, y);
536
- focusInput();
537
- state.setDragging(true);
538
- if (typeof PointerEvent !== "undefined") addGlobalListener(window, "pointerup", onColorAreaUp, false);
539
- else {
540
- addGlobalListener(window, "mouseup", onColorAreaUp, false);
541
- addGlobalListener(window, "touchend", onColorAreaUp, false);
542
- }
543
- }
544
- };
545
- let onColorAreaUp = (e)=>{
546
- var _e_changedTouches;
547
- var _e_pointerId;
548
- let id = (_e_pointerId = e.pointerId) !== null && _e_pointerId !== void 0 ? _e_pointerId : (_e_changedTouches = e.changedTouches) === null || _e_changedTouches === void 0 ? void 0 : _e_changedTouches[0].identifier;
549
- if (isOnColorArea.current && id === currentPointer.current) {
550
- isOnColorArea.current = false;
551
- setValueChangedViaKeyboard(false);
552
- currentPointer.current = undefined;
553
- state.setDragging(false);
554
- focusInput();
555
- if (typeof PointerEvent !== "undefined") removeGlobalListener(window, "pointerup", onColorAreaUp, false);
556
- else {
557
- removeGlobalListener(window, "mouseup", onColorAreaUp, false);
558
- removeGlobalListener(window, "touchend", onColorAreaUp, false);
559
- }
560
- }
561
- };
562
- let colorAreaInteractions = isDisabled ? {} : (0, $kZqDi$reactariautils.mergeProps)({
563
- ...typeof PointerEvent !== "undefined" ? {
564
- onPointerDown: (e)=>{
565
- if (e.pointerType === "mouse" && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
566
- onColorAreaDown(e.currentTarget, e.pointerId, e.clientX, e.clientY);
567
- }
568
- } : {
569
- onMouseDown: (e)=>{
570
- if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
571
- onColorAreaDown(e.currentTarget, undefined, e.clientX, e.clientY);
572
- },
573
- onTouchStart: (e)=>{
574
- onColorAreaDown(e.currentTarget, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY);
575
- }
576
- }
577
- }, movePropsContainer);
578
- let thumbInteractions = isDisabled ? {} : (0, $kZqDi$reactariautils.mergeProps)({
579
- ...typeof PointerEvent !== "undefined" ? {
580
- onPointerDown: (e)=>{
581
- if (e.pointerType === "mouse" && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
582
- onThumbDown(e.pointerId);
583
- }
584
- } : {
585
- onMouseDown: (e)=>{
586
- if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
587
- onThumbDown(undefined);
588
- },
589
- onTouchStart: (e)=>{
590
- onThumbDown(e.changedTouches[0].identifier);
591
- }
592
- }
593
- }, focusWithinProps, keyboardProps, movePropsThumb);
594
- let { focusProps: xInputFocusProps } = (0, $kZqDi$reactariainteractions.useFocus)({
595
- onFocus: ()=>{
596
- setFocusedInput("x");
597
- }
598
- });
599
- let { focusProps: yInputFocusProps } = (0, $kZqDi$reactariainteractions.useFocus)({
600
- onFocus: ()=>{
601
- setFocusedInput("y");
602
- }
603
- });
604
- let isMobile = (0, $kZqDi$reactariautils.isIOS)() || (0, $kZqDi$reactariautils.isAndroid)();
605
- function getAriaValueTextForChannel(channel) {
606
- return valueChangedViaKeyboard ? stringFormatter.format("colorNameAndValue", {
607
- name: state.value.getChannelName(channel, locale),
608
- value: state.value.formatChannelValue(channel, locale)
609
- }) : [
610
- stringFormatter.format("colorNameAndValue", {
611
- name: state.value.getChannelName(channel, locale),
612
- value: state.value.formatChannelValue(channel, locale)
613
- }),
614
- stringFormatter.format("colorNameAndValue", {
615
- name: state.value.getChannelName(channel === yChannel ? xChannel : yChannel, locale),
616
- value: state.value.formatChannelValue(channel === yChannel ? xChannel : yChannel, locale)
617
- })
618
- ].join(", ");
619
- }
620
- let colorPickerLabel = stringFormatter.format("colorPicker");
621
- let xInputLabellingProps = (0, $kZqDi$reactariautils.useLabels)({
622
- ...props,
623
- "aria-label": ariaLabel ? stringFormatter.format("colorInputLabel", {
624
- label: ariaLabel,
625
- channelLabel: colorPickerLabel
626
- }) : colorPickerLabel
627
- });
628
- let yInputLabellingProps = (0, $kZqDi$reactariautils.useLabels)({
629
- ...props,
630
- "aria-label": ariaLabel ? stringFormatter.format("colorInputLabel", {
631
- label: ariaLabel,
632
- channelLabel: colorPickerLabel
633
- }) : colorPickerLabel
634
- });
635
- let colorAreaLabellingProps = (0, $kZqDi$reactariautils.useLabels)({
636
- ...props,
637
- "aria-label": ariaLabel ? `${ariaLabel}, ${colorPickerLabel}` : undefined
638
- }, isMobile ? colorPickerLabel : undefined);
639
- let ariaRoleDescription = stringFormatter.format("twoDimensionalSlider");
640
- let { visuallyHiddenProps: visuallyHiddenProps } = (0, $kZqDi$reactariavisuallyhidden.useVisuallyHidden)({
641
- style: {
642
- opacity: "0.0001",
643
- width: "100%",
644
- height: "100%",
645
- pointerEvents: "none"
646
- }
647
- });
648
- let { colorAreaStyleProps: colorAreaStyleProps, gradientStyleProps: gradientStyleProps, thumbStyleProps: thumbStyleProps } = (0, $99936ad0bf67c8c4$export$dd62420467d245ca)({
649
- direction: direction,
650
- state: state,
651
- xChannel: xChannel,
652
- zChannel: zChannel,
653
- isDisabled: props.isDisabled
654
- });
655
- return {
656
- colorAreaProps: {
657
- ...colorAreaLabellingProps,
658
- ...colorAreaInteractions,
659
- ...colorAreaStyleProps,
660
- role: "group"
661
- },
662
- gradientProps: {
663
- ...gradientStyleProps,
664
- role: "presentation"
665
- },
666
- thumbProps: {
667
- ...thumbInteractions,
668
- ...thumbStyleProps,
669
- role: "presentation"
670
- },
671
- xInputProps: {
672
- ...xInputLabellingProps,
673
- ...visuallyHiddenProps,
674
- ...xInputFocusProps,
675
- type: "range",
676
- min: state.value.getChannelRange(xChannel).minValue,
677
- max: state.value.getChannelRange(xChannel).maxValue,
678
- step: xChannelStep,
679
- "aria-roledescription": ariaRoleDescription,
680
- "aria-valuetext": getAriaValueTextForChannel(xChannel),
681
- disabled: isDisabled,
682
- value: state.value.getChannelValue(xChannel),
683
- name: xName,
684
- tabIndex: isMobile || !focusedInput || focusedInput === "x" ? undefined : -1,
685
- /*
686
- So that only a single "2d slider" control shows up when listing form elements for screen readers,
687
- add aria-hidden="true" to the unfocused control when the value has not changed via the keyboard,
688
- but remove aria-hidden to reveal the input for each channel when the value has changed with the keyboard.
689
- */ "aria-hidden": isMobile || !focusedInput || focusedInput === "x" || valueChangedViaKeyboard ? undefined : "true",
690
- onChange: (e)=>{
691
- state.setXValue(parseFloat(e.target.value));
692
- }
693
- },
694
- yInputProps: {
695
- ...yInputLabellingProps,
696
- ...visuallyHiddenProps,
697
- ...yInputFocusProps,
698
- type: "range",
699
- min: state.value.getChannelRange(yChannel).minValue,
700
- max: state.value.getChannelRange(yChannel).maxValue,
701
- step: yChannelStep,
702
- "aria-roledescription": ariaRoleDescription,
703
- "aria-valuetext": getAriaValueTextForChannel(yChannel),
704
- "aria-orientation": "vertical",
705
- disabled: isDisabled,
706
- value: state.value.getChannelValue(yChannel),
707
- name: yName,
708
- tabIndex: isMobile || focusedInput === "y" ? undefined : -1,
709
- /*
710
- So that only a single "2d slider" control shows up when listing form elements for screen readers,
711
- add aria-hidden="true" to the unfocused input when the value has not changed via the keyboard,
712
- but remove aria-hidden to reveal the input for each channel when the value has changed with the keyboard.
713
- */ "aria-hidden": isMobile || focusedInput === "y" || valueChangedViaKeyboard ? undefined : "true",
714
- onChange: (e)=>{
715
- state.setYValue(parseFloat(e.target.value));
716
- }
717
- }
718
- };
719
- }
720
-
721
-
13
+ $parcel$export(module.exports, "useColorArea", () => $47925bd68062ac17$exports.useColorArea);
14
+ $parcel$export(module.exports, "useColorSlider", () => $afbb9647440a7f5b$exports.useColorSlider);
15
+ $parcel$export(module.exports, "useColorWheel", () => $1d29bf243d4a9a53$exports.useColorWheel);
16
+ $parcel$export(module.exports, "useColorField", () => $58c850037bc7a7ce$exports.useColorField);
17
+ $parcel$export(module.exports, "useColorSwatch", () => $7c947b33be1ec2a6$exports.useColorSwatch);
18
+ $parcel$export(module.exports, "useColorChannelField", () => $d84c0c836f6e3601$exports.useColorChannelField);
722
19
  /*
723
20
  * Copyright 2020 Adobe. All rights reserved.
724
21
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -732,414 +29,7 @@ function $47925bd68062ac17$export$2f92a7a615a014f6(props, state) {
732
29
  */
733
30
 
734
31
 
735
- function $afbb9647440a7f5b$export$106b7a4e66508f66(props, state) {
736
- let { trackRef: trackRef, inputRef: inputRef, orientation: orientation, channel: channel, "aria-label": ariaLabel, name: name } = props;
737
- let { locale: locale, direction: direction } = (0, $kZqDi$reactariai18n.useLocale)();
738
- // Provide a default aria-label if there is no other label provided.
739
- if (!props.label && !ariaLabel && !props["aria-labelledby"]) ariaLabel = state.value.getChannelName(channel, locale);
740
- // @ts-ignore - ignore unused incompatible props
741
- let { groupProps: groupProps, trackProps: trackProps, labelProps: labelProps, outputProps: outputProps } = (0, $kZqDi$reactariaslider.useSlider)({
742
- ...props,
743
- "aria-label": ariaLabel
744
- }, state, trackRef);
745
- let { inputProps: inputProps, thumbProps: thumbProps } = (0, $kZqDi$reactariaslider.useSliderThumb)({
746
- index: 0,
747
- orientation: orientation,
748
- isDisabled: props.isDisabled,
749
- name: name,
750
- trackRef: trackRef,
751
- inputRef: inputRef
752
- }, state);
753
- let generateBackground = ()=>{
754
- let value = state.getDisplayColor();
755
- let to;
756
- if (orientation === "vertical") to = "top";
757
- else if (direction === "ltr") to = "right";
758
- else to = "left";
759
- switch(channel){
760
- case "hue":
761
- return `linear-gradient(to ${to}, rgb(255, 0, 0) 0%, rgb(255, 255, 0) 17%, rgb(0, 255, 0) 33%, rgb(0, 255, 255) 50%, rgb(0, 0, 255) 67%, rgb(255, 0, 255) 83%, rgb(255, 0, 0) 100%)`;
762
- case "lightness":
763
- {
764
- // We have to add an extra color stop in the middle so that the hue shows up at all.
765
- // Otherwise it will always just be black to white.
766
- let min = state.getThumbMinValue(0);
767
- let max = state.getThumbMaxValue(0);
768
- let start = value.withChannelValue(channel, min).toString("css");
769
- let middle = value.withChannelValue(channel, (max - min) / 2).toString("css");
770
- let end = value.withChannelValue(channel, max).toString("css");
771
- return `linear-gradient(to ${to}, ${start}, ${middle}, ${end})`;
772
- }
773
- case "saturation":
774
- case "brightness":
775
- case "red":
776
- case "green":
777
- case "blue":
778
- case "alpha":
779
- {
780
- let start = value.withChannelValue(channel, state.getThumbMinValue(0)).toString("css");
781
- let end = value.withChannelValue(channel, state.getThumbMaxValue(0)).toString("css");
782
- return `linear-gradient(to ${to}, ${start}, ${end})`;
783
- }
784
- default:
785
- throw new Error("Unknown color channel: " + channel);
786
- }
787
- };
788
- let forcedColorAdjustNoneStyle = {
789
- forcedColorAdjust: "none"
790
- };
791
- return {
792
- trackProps: {
793
- ...(0, $kZqDi$reactariautils.mergeProps)(groupProps, trackProps),
794
- style: {
795
- ...trackProps.style,
796
- ...forcedColorAdjustNoneStyle,
797
- background: generateBackground()
798
- }
799
- },
800
- inputProps: inputProps,
801
- thumbProps: {
802
- ...thumbProps,
803
- style: {
804
- ...thumbProps.style,
805
- ...forcedColorAdjustNoneStyle
806
- }
807
- },
808
- labelProps: labelProps,
809
- outputProps: outputProps
810
- };
811
- }
812
-
813
32
 
814
- /*
815
- * Copyright 2020 Adobe. All rights reserved.
816
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
817
- * you may not use this file except in compliance with the License. You may obtain a copy
818
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
819
- *
820
- * Unless required by applicable law or agreed to in writing, software distributed under
821
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
822
- * OF ANY KIND, either express or implied. See the License for the specific language
823
- * governing permissions and limitations under the License.
824
- */
825
-
826
-
827
-
828
- function $1d29bf243d4a9a53$export$9064ff4e44b3729a(props, state, inputRef) {
829
- let { isDisabled: isDisabled, innerRadius: innerRadius, outerRadius: outerRadius, "aria-label": ariaLabel, name: name } = props;
830
- let { addGlobalListener: addGlobalListener, removeGlobalListener: removeGlobalListener } = (0, $kZqDi$reactariautils.useGlobalListeners)();
831
- let thumbRadius = (innerRadius + outerRadius) / 2;
832
- let focusInput = (0, $kZqDi$react.useCallback)(()=>{
833
- if (inputRef.current) (0, $kZqDi$reactariautils.focusWithoutScrolling)(inputRef.current);
834
- }, [
835
- inputRef
836
- ]);
837
- (0, $kZqDi$reactariautils.useFormReset)(inputRef, state.hue, state.setHue);
838
- let currentPosition = (0, $kZqDi$react.useRef)(null);
839
- let { keyboardProps: keyboardProps } = (0, $kZqDi$reactariainteractions.useKeyboard)({
840
- onKeyDown (e) {
841
- // these are the cases that useMove doesn't handle
842
- if (!/^(PageUp|PageDown)$/.test(e.key)) {
843
- e.continuePropagation();
844
- return;
845
- }
846
- // same handling as useMove, don't need to stop propagation, useKeyboard will do that for us
847
- e.preventDefault();
848
- // remember to set this and unset it so that onChangeEnd is fired
849
- state.setDragging(true);
850
- switch(e.key){
851
- case "PageUp":
852
- e.preventDefault();
853
- state.increment(state.pageStep);
854
- break;
855
- case "PageDown":
856
- e.preventDefault();
857
- state.decrement(state.pageStep);
858
- break;
859
- }
860
- state.setDragging(false);
861
- }
862
- });
863
- let moveHandler = {
864
- onMoveStart () {
865
- currentPosition.current = null;
866
- state.setDragging(true);
867
- },
868
- onMove ({ deltaX: deltaX, deltaY: deltaY, pointerType: pointerType, shiftKey: shiftKey }) {
869
- if (currentPosition.current == null) currentPosition.current = state.getThumbPosition(thumbRadius);
870
- currentPosition.current.x += deltaX;
871
- currentPosition.current.y += deltaY;
872
- if (pointerType === "keyboard") {
873
- if (deltaX > 0 || deltaY < 0) state.increment(shiftKey ? state.pageStep : state.step);
874
- else if (deltaX < 0 || deltaY > 0) state.decrement(shiftKey ? state.pageStep : state.step);
875
- } else state.setHueFromPoint(currentPosition.current.x, currentPosition.current.y, thumbRadius);
876
- },
877
- onMoveEnd () {
878
- isOnTrack.current = false;
879
- state.setDragging(false);
880
- focusInput();
881
- }
882
- };
883
- let { moveProps: movePropsThumb } = (0, $kZqDi$reactariainteractions.useMove)(moveHandler);
884
- let currentPointer = (0, $kZqDi$react.useRef)(undefined);
885
- let isOnTrack = (0, $kZqDi$react.useRef)(false);
886
- let { moveProps: movePropsContainer } = (0, $kZqDi$reactariainteractions.useMove)({
887
- onMoveStart () {
888
- if (isOnTrack.current) moveHandler.onMoveStart();
889
- },
890
- onMove (e) {
891
- if (isOnTrack.current) moveHandler.onMove(e);
892
- },
893
- onMoveEnd () {
894
- if (isOnTrack.current) moveHandler.onMoveEnd();
895
- }
896
- });
897
- let onThumbDown = (id)=>{
898
- if (!state.isDragging) {
899
- currentPointer.current = id;
900
- focusInput();
901
- state.setDragging(true);
902
- if (typeof PointerEvent !== "undefined") addGlobalListener(window, "pointerup", onThumbUp, false);
903
- else {
904
- addGlobalListener(window, "mouseup", onThumbUp, false);
905
- addGlobalListener(window, "touchend", onThumbUp, false);
906
- }
907
- }
908
- };
909
- let onThumbUp = (e)=>{
910
- var _e_changedTouches;
911
- var _e_pointerId;
912
- let id = (_e_pointerId = e.pointerId) !== null && _e_pointerId !== void 0 ? _e_pointerId : (_e_changedTouches = e.changedTouches) === null || _e_changedTouches === void 0 ? void 0 : _e_changedTouches[0].identifier;
913
- if (id === currentPointer.current) {
914
- focusInput();
915
- state.setDragging(false);
916
- currentPointer.current = undefined;
917
- isOnTrack.current = false;
918
- if (typeof PointerEvent !== "undefined") removeGlobalListener(window, "pointerup", onThumbUp, false);
919
- else {
920
- removeGlobalListener(window, "mouseup", onThumbUp, false);
921
- removeGlobalListener(window, "touchend", onThumbUp, false);
922
- }
923
- }
924
- };
925
- let onTrackDown = (track, id, pageX, pageY)=>{
926
- let rect = track.getBoundingClientRect();
927
- let x = pageX - rect.x - rect.width / 2;
928
- let y = pageY - rect.y - rect.height / 2;
929
- let radius = Math.sqrt(x * x + y * y);
930
- if (innerRadius < radius && radius < outerRadius && !state.isDragging && currentPointer.current === undefined) {
931
- isOnTrack.current = true;
932
- currentPointer.current = id;
933
- state.setHueFromPoint(x, y, radius);
934
- focusInput();
935
- state.setDragging(true);
936
- if (typeof PointerEvent !== "undefined") addGlobalListener(window, "pointerup", onTrackUp, false);
937
- else {
938
- addGlobalListener(window, "mouseup", onTrackUp, false);
939
- addGlobalListener(window, "touchend", onTrackUp, false);
940
- }
941
- }
942
- };
943
- let onTrackUp = (e)=>{
944
- var _e_changedTouches;
945
- var _e_pointerId;
946
- let id = (_e_pointerId = e.pointerId) !== null && _e_pointerId !== void 0 ? _e_pointerId : (_e_changedTouches = e.changedTouches) === null || _e_changedTouches === void 0 ? void 0 : _e_changedTouches[0].identifier;
947
- if (isOnTrack.current && id === currentPointer.current) {
948
- isOnTrack.current = false;
949
- currentPointer.current = undefined;
950
- state.setDragging(false);
951
- focusInput();
952
- if (typeof PointerEvent !== "undefined") removeGlobalListener(window, "pointerup", onTrackUp, false);
953
- else {
954
- removeGlobalListener(window, "mouseup", onTrackUp, false);
955
- removeGlobalListener(window, "touchend", onTrackUp, false);
956
- }
957
- }
958
- };
959
- let trackInteractions = isDisabled ? {} : (0, $kZqDi$reactariautils.mergeProps)({
960
- ...typeof PointerEvent !== "undefined" ? {
961
- onPointerDown: (e)=>{
962
- if (e.pointerType === "mouse" && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
963
- onTrackDown(e.currentTarget, e.pointerId, e.clientX, e.clientY);
964
- }
965
- } : {
966
- onMouseDown: (e)=>{
967
- if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
968
- onTrackDown(e.currentTarget, undefined, e.clientX, e.clientY);
969
- },
970
- onTouchStart: (e)=>{
971
- onTrackDown(e.currentTarget, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY);
972
- }
973
- }
974
- }, movePropsContainer);
975
- let thumbInteractions = isDisabled ? {} : (0, $kZqDi$reactariautils.mergeProps)({
976
- onMouseDown: (e)=>{
977
- if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
978
- onThumbDown(undefined);
979
- },
980
- onPointerDown: (e)=>{
981
- if (e.pointerType === "mouse" && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
982
- onThumbDown(e.pointerId);
983
- },
984
- onTouchStart: (e)=>{
985
- onThumbDown(e.changedTouches[0].identifier);
986
- }
987
- }, keyboardProps, movePropsThumb);
988
- let { x: x, y: y } = state.getThumbPosition(thumbRadius);
989
- // Provide a default aria-label if none is given
990
- let { locale: locale } = (0, $kZqDi$reactariai18n.useLocale)();
991
- if (ariaLabel == null && props["aria-labelledby"] == null) ariaLabel = state.value.getChannelName("hue", locale);
992
- let inputLabellingProps = (0, $kZqDi$reactariautils.useLabels)({
993
- ...props,
994
- "aria-label": ariaLabel
995
- });
996
- let { minValue: minValue, maxValue: maxValue, step: step } = state.value.getChannelRange("hue");
997
- let forcedColorAdjustNoneStyle = {
998
- forcedColorAdjust: "none"
999
- };
1000
- return {
1001
- trackProps: {
1002
- ...trackInteractions,
1003
- style: {
1004
- position: "relative",
1005
- touchAction: "none",
1006
- width: outerRadius * 2,
1007
- height: outerRadius * 2,
1008
- background: `
1009
- conic-gradient(
1010
- from 90deg,
1011
- hsl(0, 100%, 50%),
1012
- hsl(30, 100%, 50%),
1013
- hsl(60, 100%, 50%),
1014
- hsl(90, 100%, 50%),
1015
- hsl(120, 100%, 50%),
1016
- hsl(150, 100%, 50%),
1017
- hsl(180, 100%, 50%),
1018
- hsl(210, 100%, 50%),
1019
- hsl(240, 100%, 50%),
1020
- hsl(270, 100%, 50%),
1021
- hsl(300, 100%, 50%),
1022
- hsl(330, 100%, 50%),
1023
- hsl(360, 100%, 50%)
1024
- )
1025
- `,
1026
- clipPath: `path(evenodd, "${$1d29bf243d4a9a53$var$circlePath(outerRadius, outerRadius, outerRadius)} ${$1d29bf243d4a9a53$var$circlePath(outerRadius, outerRadius, innerRadius)}")`,
1027
- ...forcedColorAdjustNoneStyle
1028
- }
1029
- },
1030
- thumbProps: {
1031
- ...thumbInteractions,
1032
- style: {
1033
- position: "absolute",
1034
- left: "50%",
1035
- top: "50%",
1036
- transform: `translate(calc(${x}px - 50%), calc(${y}px - 50%))`,
1037
- touchAction: "none",
1038
- ...forcedColorAdjustNoneStyle
1039
- }
1040
- },
1041
- inputProps: (0, $kZqDi$reactariautils.mergeProps)(inputLabellingProps, {
1042
- type: "range",
1043
- min: String(minValue),
1044
- max: String(maxValue),
1045
- step: String(step),
1046
- "aria-valuetext": state.value.formatChannelValue("hue", locale),
1047
- disabled: isDisabled,
1048
- value: `${state.value.getChannelValue("hue")}`,
1049
- name: name,
1050
- onChange: (e)=>{
1051
- state.setHue(parseFloat(e.target.value));
1052
- }
1053
- })
1054
- };
1055
- }
1056
- // Creates an SVG path string for a circle.
1057
- function $1d29bf243d4a9a53$var$circlePath(cx, cy, r) {
1058
- return `M ${cx}, ${cy} m ${-r}, 0 a ${r}, ${r}, 0, 1, 0, ${r * 2}, 0 a ${r}, ${r}, 0, 1, 0 ${-r * 2}, 0`;
1059
- }
1060
-
1061
-
1062
- /*
1063
- * Copyright 2020 Adobe. All rights reserved.
1064
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
1065
- * you may not use this file except in compliance with the License. You may obtain a copy
1066
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
1067
- *
1068
- * Unless required by applicable law or agreed to in writing, software distributed under
1069
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
1070
- * OF ANY KIND, either express or implied. See the License for the specific language
1071
- * governing permissions and limitations under the License.
1072
- */
1073
-
1074
-
1075
-
1076
-
1077
-
1078
- function $58c850037bc7a7ce$export$77e32ca575a28fdf(props, state, ref) {
1079
- let { isDisabled: isDisabled, isReadOnly: isReadOnly, isRequired: isRequired, isWheelDisabled: isWheelDisabled, validationBehavior: validationBehavior = "aria" } = props;
1080
- let { colorValue: colorValue, inputValue: inputValue, increment: increment, decrement: decrement, incrementToMax: incrementToMax, decrementToMin: decrementToMin, commit: commit } = state;
1081
- let inputId = (0, $kZqDi$reactariautils.useId)();
1082
- let { spinButtonProps: spinButtonProps } = (0, $kZqDi$reactariaspinbutton.useSpinButton)({
1083
- isDisabled: isDisabled,
1084
- isReadOnly: isReadOnly,
1085
- isRequired: isRequired,
1086
- maxValue: 0xFFFFFF,
1087
- minValue: 0,
1088
- onIncrement: increment,
1089
- onIncrementToMax: incrementToMax,
1090
- onDecrement: decrement,
1091
- onDecrementToMin: decrementToMin,
1092
- value: colorValue ? colorValue.toHexInt() : undefined,
1093
- textValue: colorValue ? colorValue.toString("hex") : undefined
1094
- });
1095
- let [focusWithin, setFocusWithin] = (0, $kZqDi$react.useState)(false);
1096
- let { focusWithinProps: focusWithinProps } = (0, $kZqDi$reactariainteractions.useFocusWithin)({
1097
- isDisabled: isDisabled,
1098
- onFocusWithinChange: setFocusWithin
1099
- });
1100
- let onWheel = (0, $kZqDi$react.useCallback)((e)=>{
1101
- if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) return;
1102
- if (e.deltaY > 0) increment();
1103
- else if (e.deltaY < 0) decrement();
1104
- }, [
1105
- decrement,
1106
- increment
1107
- ]);
1108
- // If the input isn't supposed to receive input, disable scrolling.
1109
- let scrollingDisabled = isWheelDisabled || isDisabled || isReadOnly || !focusWithin;
1110
- (0, $kZqDi$reactariainteractions.useScrollWheel)({
1111
- onScroll: onWheel,
1112
- isDisabled: scrollingDisabled
1113
- }, ref);
1114
- let onChange = (value)=>{
1115
- if (state.validate(value)) state.setInputValue(value);
1116
- };
1117
- let { inputProps: inputProps, ...otherProps } = (0, $kZqDi$reactariatextfield.useFormattedTextField)((0, $kZqDi$reactariautils.mergeProps)(props, {
1118
- id: inputId,
1119
- value: inputValue,
1120
- defaultValue: undefined,
1121
- validate: undefined,
1122
- [(0, $kZqDi$reactstatelyform.privateValidationStateProp)]: state,
1123
- type: "text",
1124
- autoComplete: "off",
1125
- onChange: onChange
1126
- }), state, ref);
1127
- inputProps = (0, $kZqDi$reactariautils.mergeProps)(inputProps, spinButtonProps, focusWithinProps, {
1128
- role: "textbox",
1129
- "aria-valuemax": null,
1130
- "aria-valuemin": null,
1131
- "aria-valuenow": null,
1132
- "aria-valuetext": null,
1133
- autoCorrect: "off",
1134
- spellCheck: "false",
1135
- onBlur: commit
1136
- });
1137
- if (validationBehavior === "native") inputProps["aria-required"] = undefined;
1138
- return {
1139
- inputProps: inputProps,
1140
- ...otherProps
1141
- };
1142
- }
1143
33
 
1144
34
 
1145
35