@react-aria/color 3.0.0-beta.30 → 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 +11 -0
  2. package/dist/ar-AE.main.js.map +1 -0
  3. package/dist/ar-AE.mjs +13 -0
  4. package/dist/ar-AE.module.js +13 -0
  5. package/dist/ar-AE.module.js.map +1 -0
  6. package/dist/bg-BG.main.js +11 -0
  7. package/dist/bg-BG.main.js.map +1 -0
  8. package/dist/bg-BG.mjs +13 -0
  9. package/dist/bg-BG.module.js +13 -0
  10. package/dist/bg-BG.module.js.map +1 -0
  11. package/dist/cs-CZ.main.js +11 -0
  12. package/dist/cs-CZ.main.js.map +1 -0
  13. package/dist/cs-CZ.mjs +13 -0
  14. package/dist/cs-CZ.module.js +13 -0
  15. package/dist/cs-CZ.module.js.map +1 -0
  16. package/dist/da-DK.main.js +11 -0
  17. package/dist/da-DK.main.js.map +1 -0
  18. package/dist/da-DK.mjs +13 -0
  19. package/dist/da-DK.module.js +13 -0
  20. package/dist/da-DK.module.js.map +1 -0
  21. package/dist/de-DE.main.js +11 -0
  22. package/dist/de-DE.main.js.map +1 -0
  23. package/dist/de-DE.mjs +13 -0
  24. package/dist/de-DE.module.js +13 -0
  25. package/dist/de-DE.module.js.map +1 -0
  26. package/dist/el-GR.main.js +11 -0
  27. package/dist/el-GR.main.js.map +1 -0
  28. package/dist/el-GR.mjs +13 -0
  29. package/dist/el-GR.module.js +13 -0
  30. package/dist/el-GR.module.js.map +1 -0
  31. package/dist/en-US.main.js +11 -0
  32. package/dist/en-US.main.js.map +1 -0
  33. package/dist/en-US.mjs +13 -0
  34. package/dist/en-US.module.js +13 -0
  35. package/dist/en-US.module.js.map +1 -0
  36. package/dist/es-ES.main.js +11 -0
  37. package/dist/es-ES.main.js.map +1 -0
  38. package/dist/es-ES.mjs +13 -0
  39. package/dist/es-ES.module.js +13 -0
  40. package/dist/es-ES.module.js.map +1 -0
  41. package/dist/et-EE.main.js +11 -0
  42. package/dist/et-EE.main.js.map +1 -0
  43. package/dist/et-EE.mjs +13 -0
  44. package/dist/et-EE.module.js +13 -0
  45. package/dist/et-EE.module.js.map +1 -0
  46. package/dist/fi-FI.main.js +11 -0
  47. package/dist/fi-FI.main.js.map +1 -0
  48. package/dist/fi-FI.mjs +13 -0
  49. package/dist/fi-FI.module.js +13 -0
  50. package/dist/fi-FI.module.js.map +1 -0
  51. package/dist/fr-FR.main.js +11 -0
  52. package/dist/fr-FR.main.js.map +1 -0
  53. package/dist/fr-FR.mjs +13 -0
  54. package/dist/fr-FR.module.js +13 -0
  55. package/dist/fr-FR.module.js.map +1 -0
  56. package/dist/he-IL.main.js +11 -0
  57. package/dist/he-IL.main.js.map +1 -0
  58. package/dist/he-IL.mjs +13 -0
  59. package/dist/he-IL.module.js +13 -0
  60. package/dist/he-IL.module.js.map +1 -0
  61. package/dist/hr-HR.main.js +11 -0
  62. package/dist/hr-HR.main.js.map +1 -0
  63. package/dist/hr-HR.mjs +13 -0
  64. package/dist/hr-HR.module.js +13 -0
  65. package/dist/hr-HR.module.js.map +1 -0
  66. package/dist/hu-HU.main.js +11 -0
  67. package/dist/hu-HU.main.js.map +1 -0
  68. package/dist/hu-HU.mjs +13 -0
  69. package/dist/hu-HU.module.js +13 -0
  70. package/dist/hu-HU.module.js.map +1 -0
  71. package/dist/import.mjs +7 -1357
  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 +11 -0
  78. package/dist/it-IT.main.js.map +1 -0
  79. package/dist/it-IT.mjs +13 -0
  80. package/dist/it-IT.module.js +13 -0
  81. package/dist/it-IT.module.js.map +1 -0
  82. package/dist/ja-JP.main.js +11 -0
  83. package/dist/ja-JP.main.js.map +1 -0
  84. package/dist/ja-JP.mjs +13 -0
  85. package/dist/ja-JP.module.js +13 -0
  86. package/dist/ja-JP.module.js.map +1 -0
  87. package/dist/ko-KR.main.js +11 -0
  88. package/dist/ko-KR.main.js.map +1 -0
  89. package/dist/ko-KR.mjs +13 -0
  90. package/dist/ko-KR.module.js +13 -0
  91. package/dist/ko-KR.module.js.map +1 -0
  92. package/dist/lt-LT.main.js +11 -0
  93. package/dist/lt-LT.main.js.map +1 -0
  94. package/dist/lt-LT.mjs +13 -0
  95. package/dist/lt-LT.module.js +13 -0
  96. package/dist/lt-LT.module.js.map +1 -0
  97. package/dist/lv-LV.main.js +11 -0
  98. package/dist/lv-LV.main.js.map +1 -0
  99. package/dist/lv-LV.mjs +13 -0
  100. package/dist/lv-LV.module.js +13 -0
  101. package/dist/lv-LV.module.js.map +1 -0
  102. package/dist/main.js +12 -1360
  103. package/dist/main.js.map +1 -1
  104. package/dist/module.js +7 -1357
  105. package/dist/module.js.map +1 -1
  106. package/dist/nb-NO.main.js +11 -0
  107. package/dist/nb-NO.main.js.map +1 -0
  108. package/dist/nb-NO.mjs +13 -0
  109. package/dist/nb-NO.module.js +13 -0
  110. package/dist/nb-NO.module.js.map +1 -0
  111. package/dist/nl-NL.main.js +11 -0
  112. package/dist/nl-NL.main.js.map +1 -0
  113. package/dist/nl-NL.mjs +13 -0
  114. package/dist/nl-NL.module.js +13 -0
  115. package/dist/nl-NL.module.js.map +1 -0
  116. package/dist/pl-PL.main.js +11 -0
  117. package/dist/pl-PL.main.js.map +1 -0
  118. package/dist/pl-PL.mjs +13 -0
  119. package/dist/pl-PL.module.js +13 -0
  120. package/dist/pl-PL.module.js.map +1 -0
  121. package/dist/pt-BR.main.js +11 -0
  122. package/dist/pt-BR.main.js.map +1 -0
  123. package/dist/pt-BR.mjs +13 -0
  124. package/dist/pt-BR.module.js +13 -0
  125. package/dist/pt-BR.module.js.map +1 -0
  126. package/dist/pt-PT.main.js +11 -0
  127. package/dist/pt-PT.main.js.map +1 -0
  128. package/dist/pt-PT.mjs +13 -0
  129. package/dist/pt-PT.module.js +13 -0
  130. package/dist/pt-PT.module.js.map +1 -0
  131. package/dist/ro-RO.main.js +11 -0
  132. package/dist/ro-RO.main.js.map +1 -0
  133. package/dist/ro-RO.mjs +13 -0
  134. package/dist/ro-RO.module.js +13 -0
  135. package/dist/ro-RO.module.js.map +1 -0
  136. package/dist/ru-RU.main.js +11 -0
  137. package/dist/ru-RU.main.js.map +1 -0
  138. package/dist/ru-RU.mjs +13 -0
  139. package/dist/ru-RU.module.js +13 -0
  140. package/dist/ru-RU.module.js.map +1 -0
  141. package/dist/sk-SK.main.js +11 -0
  142. package/dist/sk-SK.main.js.map +1 -0
  143. package/dist/sk-SK.mjs +13 -0
  144. package/dist/sk-SK.module.js +13 -0
  145. package/dist/sk-SK.module.js.map +1 -0
  146. package/dist/sl-SI.main.js +11 -0
  147. package/dist/sl-SI.main.js.map +1 -0
  148. package/dist/sl-SI.mjs +13 -0
  149. package/dist/sl-SI.module.js +13 -0
  150. package/dist/sl-SI.module.js.map +1 -0
  151. package/dist/sr-SP.main.js +11 -0
  152. package/dist/sr-SP.main.js.map +1 -0
  153. package/dist/sr-SP.mjs +13 -0
  154. package/dist/sr-SP.module.js +13 -0
  155. package/dist/sr-SP.module.js.map +1 -0
  156. package/dist/sv-SE.main.js +11 -0
  157. package/dist/sv-SE.main.js.map +1 -0
  158. package/dist/sv-SE.mjs +13 -0
  159. package/dist/sv-SE.module.js +13 -0
  160. package/dist/sv-SE.module.js.map +1 -0
  161. package/dist/tr-TR.main.js +11 -0
  162. package/dist/tr-TR.main.js.map +1 -0
  163. package/dist/tr-TR.mjs +13 -0
  164. package/dist/tr-TR.module.js +13 -0
  165. package/dist/tr-TR.module.js.map +1 -0
  166. package/dist/types.d.ts +41 -7
  167. package/dist/types.d.ts.map +1 -1
  168. package/dist/uk-UA.main.js +11 -0
  169. package/dist/uk-UA.main.js.map +1 -0
  170. package/dist/uk-UA.mjs +13 -0
  171. package/dist/uk-UA.module.js +13 -0
  172. package/dist/uk-UA.module.js.map +1 -0
  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 +11 -0
  209. package/dist/zh-CN.main.js.map +1 -0
  210. package/dist/zh-CN.mjs +13 -0
  211. package/dist/zh-CN.module.js +13 -0
  212. package/dist/zh-CN.module.js.map +1 -0
  213. package/dist/zh-TW.main.js +11 -0
  214. package/dist/zh-TW.main.js.map +1 -0
  215. package/dist/zh-TW.mjs +13 -0
  216. package/dist/zh-TW.module.js +13 -0
  217. package/dist/zh-TW.module.js.map +1 -0
  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
@@ -0,0 +1,269 @@
1
+ import {useGlobalListeners as $hcgPp$useGlobalListeners, focusWithoutScrolling as $hcgPp$focusWithoutScrolling, useFormReset as $hcgPp$useFormReset, mergeProps as $hcgPp$mergeProps, useLabels as $hcgPp$useLabels} from "@react-aria/utils";
2
+ import {useCallback as $hcgPp$useCallback, useRef as $hcgPp$useRef} from "react";
3
+ import {useKeyboard as $hcgPp$useKeyboard, useMove as $hcgPp$useMove} from "@react-aria/interactions";
4
+ import {useLocale as $hcgPp$useLocale} from "@react-aria/i18n";
5
+ import {useVisuallyHidden as $hcgPp$useVisuallyHidden} from "@react-aria/visually-hidden";
6
+
7
+ /*
8
+ * Copyright 2020 Adobe. All rights reserved.
9
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
10
+ * you may not use this file except in compliance with the License. You may obtain a copy
11
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software distributed under
14
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
15
+ * OF ANY KIND, either express or implied. See the License for the specific language
16
+ * governing permissions and limitations under the License.
17
+ */
18
+
19
+
20
+
21
+
22
+ function $b4a0a4fdc900495e$export$9064ff4e44b3729a(props, state, inputRef) {
23
+ let { isDisabled: isDisabled, innerRadius: innerRadius, outerRadius: outerRadius, "aria-label": ariaLabel, name: name } = props;
24
+ let { addGlobalListener: addGlobalListener, removeGlobalListener: removeGlobalListener } = (0, $hcgPp$useGlobalListeners)();
25
+ let thumbRadius = (innerRadius + outerRadius) / 2;
26
+ let focusInput = (0, $hcgPp$useCallback)(()=>{
27
+ if (inputRef.current) (0, $hcgPp$focusWithoutScrolling)(inputRef.current);
28
+ }, [
29
+ inputRef
30
+ ]);
31
+ (0, $hcgPp$useFormReset)(inputRef, state.hue, state.setHue);
32
+ let currentPosition = (0, $hcgPp$useRef)(null);
33
+ let { keyboardProps: keyboardProps } = (0, $hcgPp$useKeyboard)({
34
+ onKeyDown (e) {
35
+ // these are the cases that useMove doesn't handle
36
+ if (!/^(PageUp|PageDown)$/.test(e.key)) {
37
+ e.continuePropagation();
38
+ return;
39
+ }
40
+ // same handling as useMove, don't need to stop propagation, useKeyboard will do that for us
41
+ e.preventDefault();
42
+ // remember to set this and unset it so that onChangeEnd is fired
43
+ state.setDragging(true);
44
+ switch(e.key){
45
+ case "PageUp":
46
+ e.preventDefault();
47
+ state.increment(state.pageStep);
48
+ break;
49
+ case "PageDown":
50
+ e.preventDefault();
51
+ state.decrement(state.pageStep);
52
+ break;
53
+ }
54
+ state.setDragging(false);
55
+ }
56
+ });
57
+ let moveHandler = {
58
+ onMoveStart () {
59
+ currentPosition.current = null;
60
+ state.setDragging(true);
61
+ },
62
+ onMove ({ deltaX: deltaX, deltaY: deltaY, pointerType: pointerType, shiftKey: shiftKey }) {
63
+ if (currentPosition.current == null) currentPosition.current = state.getThumbPosition(thumbRadius);
64
+ currentPosition.current.x += deltaX;
65
+ currentPosition.current.y += deltaY;
66
+ if (pointerType === "keyboard") {
67
+ if (deltaX > 0 || deltaY < 0) state.increment(shiftKey ? state.pageStep : state.step);
68
+ else if (deltaX < 0 || deltaY > 0) state.decrement(shiftKey ? state.pageStep : state.step);
69
+ } else state.setHueFromPoint(currentPosition.current.x, currentPosition.current.y, thumbRadius);
70
+ },
71
+ onMoveEnd () {
72
+ isOnTrack.current = false;
73
+ state.setDragging(false);
74
+ focusInput();
75
+ }
76
+ };
77
+ let { moveProps: movePropsThumb } = (0, $hcgPp$useMove)(moveHandler);
78
+ let currentPointer = (0, $hcgPp$useRef)(undefined);
79
+ let isOnTrack = (0, $hcgPp$useRef)(false);
80
+ let { moveProps: movePropsContainer } = (0, $hcgPp$useMove)({
81
+ onMoveStart () {
82
+ if (isOnTrack.current) moveHandler.onMoveStart();
83
+ },
84
+ onMove (e) {
85
+ if (isOnTrack.current) moveHandler.onMove(e);
86
+ },
87
+ onMoveEnd () {
88
+ if (isOnTrack.current) moveHandler.onMoveEnd();
89
+ }
90
+ });
91
+ let onThumbDown = (id)=>{
92
+ if (!state.isDragging) {
93
+ currentPointer.current = id;
94
+ focusInput();
95
+ state.setDragging(true);
96
+ if (typeof PointerEvent !== "undefined") addGlobalListener(window, "pointerup", onThumbUp, false);
97
+ else {
98
+ addGlobalListener(window, "mouseup", onThumbUp, false);
99
+ addGlobalListener(window, "touchend", onThumbUp, false);
100
+ }
101
+ }
102
+ };
103
+ let onThumbUp = (e)=>{
104
+ var _e_changedTouches;
105
+ var _e_pointerId;
106
+ 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;
107
+ if (id === currentPointer.current) {
108
+ focusInput();
109
+ state.setDragging(false);
110
+ currentPointer.current = undefined;
111
+ isOnTrack.current = false;
112
+ if (typeof PointerEvent !== "undefined") removeGlobalListener(window, "pointerup", onThumbUp, false);
113
+ else {
114
+ removeGlobalListener(window, "mouseup", onThumbUp, false);
115
+ removeGlobalListener(window, "touchend", onThumbUp, false);
116
+ }
117
+ }
118
+ };
119
+ let onTrackDown = (track, id, pageX, pageY)=>{
120
+ let rect = track.getBoundingClientRect();
121
+ let x = pageX - rect.x - rect.width / 2;
122
+ let y = pageY - rect.y - rect.height / 2;
123
+ let radius = Math.sqrt(x * x + y * y);
124
+ if (innerRadius < radius && radius < outerRadius && !state.isDragging && currentPointer.current === undefined) {
125
+ isOnTrack.current = true;
126
+ currentPointer.current = id;
127
+ state.setHueFromPoint(x, y, radius);
128
+ focusInput();
129
+ state.setDragging(true);
130
+ if (typeof PointerEvent !== "undefined") addGlobalListener(window, "pointerup", onTrackUp, false);
131
+ else {
132
+ addGlobalListener(window, "mouseup", onTrackUp, false);
133
+ addGlobalListener(window, "touchend", onTrackUp, false);
134
+ }
135
+ }
136
+ };
137
+ let onTrackUp = (e)=>{
138
+ var _e_changedTouches;
139
+ var _e_pointerId;
140
+ 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;
141
+ if (isOnTrack.current && id === currentPointer.current) {
142
+ isOnTrack.current = false;
143
+ currentPointer.current = undefined;
144
+ state.setDragging(false);
145
+ focusInput();
146
+ if (typeof PointerEvent !== "undefined") removeGlobalListener(window, "pointerup", onTrackUp, false);
147
+ else {
148
+ removeGlobalListener(window, "mouseup", onTrackUp, false);
149
+ removeGlobalListener(window, "touchend", onTrackUp, false);
150
+ }
151
+ }
152
+ };
153
+ let trackInteractions = isDisabled ? {} : (0, $hcgPp$mergeProps)({
154
+ ...typeof PointerEvent !== "undefined" ? {
155
+ onPointerDown: (e)=>{
156
+ if (e.pointerType === "mouse" && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
157
+ onTrackDown(e.currentTarget, e.pointerId, e.clientX, e.clientY);
158
+ }
159
+ } : {
160
+ onMouseDown: (e)=>{
161
+ if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
162
+ onTrackDown(e.currentTarget, undefined, e.clientX, e.clientY);
163
+ },
164
+ onTouchStart: (e)=>{
165
+ onTrackDown(e.currentTarget, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY);
166
+ }
167
+ }
168
+ }, movePropsContainer);
169
+ let thumbInteractions = isDisabled ? {} : (0, $hcgPp$mergeProps)({
170
+ onMouseDown: (e)=>{
171
+ if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
172
+ onThumbDown(undefined);
173
+ },
174
+ onPointerDown: (e)=>{
175
+ if (e.pointerType === "mouse" && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
176
+ onThumbDown(e.pointerId);
177
+ },
178
+ onTouchStart: (e)=>{
179
+ onThumbDown(e.changedTouches[0].identifier);
180
+ }
181
+ }, keyboardProps, movePropsThumb);
182
+ let { x: x, y: y } = state.getThumbPosition(thumbRadius);
183
+ // Provide a default aria-label if none is given
184
+ let { locale: locale } = (0, $hcgPp$useLocale)();
185
+ if (ariaLabel == null && props["aria-labelledby"] == null) ariaLabel = state.value.getChannelName("hue", locale);
186
+ let inputLabellingProps = (0, $hcgPp$useLabels)({
187
+ ...props,
188
+ "aria-label": ariaLabel
189
+ });
190
+ let { minValue: minValue, maxValue: maxValue, step: step } = state.value.getChannelRange("hue");
191
+ let forcedColorAdjustNoneStyle = {
192
+ forcedColorAdjust: "none"
193
+ };
194
+ let { visuallyHiddenProps: visuallyHiddenProps } = (0, $hcgPp$useVisuallyHidden)({
195
+ style: {
196
+ opacity: "0.0001",
197
+ width: "100%",
198
+ height: "100%",
199
+ pointerEvents: "none"
200
+ }
201
+ });
202
+ return {
203
+ trackProps: {
204
+ ...trackInteractions,
205
+ style: {
206
+ position: "relative",
207
+ touchAction: "none",
208
+ width: outerRadius * 2,
209
+ height: outerRadius * 2,
210
+ background: `
211
+ conic-gradient(
212
+ from 90deg,
213
+ hsl(0, 100%, 50%),
214
+ hsl(30, 100%, 50%),
215
+ hsl(60, 100%, 50%),
216
+ hsl(90, 100%, 50%),
217
+ hsl(120, 100%, 50%),
218
+ hsl(150, 100%, 50%),
219
+ hsl(180, 100%, 50%),
220
+ hsl(210, 100%, 50%),
221
+ hsl(240, 100%, 50%),
222
+ hsl(270, 100%, 50%),
223
+ hsl(300, 100%, 50%),
224
+ hsl(330, 100%, 50%),
225
+ hsl(360, 100%, 50%)
226
+ )
227
+ `,
228
+ clipPath: `path(evenodd, "${$b4a0a4fdc900495e$var$circlePath(outerRadius, outerRadius, outerRadius)} ${$b4a0a4fdc900495e$var$circlePath(outerRadius, outerRadius, innerRadius)}")`,
229
+ ...forcedColorAdjustNoneStyle
230
+ }
231
+ },
232
+ thumbProps: {
233
+ ...thumbInteractions,
234
+ style: {
235
+ position: "absolute",
236
+ left: outerRadius + x,
237
+ top: outerRadius + y,
238
+ transform: "translate(-50%, -50%)",
239
+ touchAction: "none",
240
+ ...forcedColorAdjustNoneStyle
241
+ }
242
+ },
243
+ inputProps: (0, $hcgPp$mergeProps)(inputLabellingProps, {
244
+ type: "range",
245
+ min: String(minValue),
246
+ max: String(maxValue),
247
+ step: String(step),
248
+ "aria-valuetext": `${state.value.formatChannelValue("hue", locale)}, ${state.value.getHueName(locale)}`,
249
+ disabled: isDisabled,
250
+ value: `${state.value.getChannelValue("hue")}`,
251
+ name: name,
252
+ onChange: (e)=>{
253
+ state.setHue(parseFloat(e.target.value));
254
+ },
255
+ style: visuallyHiddenProps.style,
256
+ "aria-errormessage": props["aria-errormessage"],
257
+ "aria-describedby": props["aria-describedby"],
258
+ "aria-details": props["aria-details"]
259
+ })
260
+ };
261
+ }
262
+ // Creates an SVG path string for a circle.
263
+ function $b4a0a4fdc900495e$var$circlePath(cx, cy, r) {
264
+ 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`;
265
+ }
266
+
267
+
268
+ export {$b4a0a4fdc900495e$export$9064ff4e44b3729a as useColorWheel};
269
+ //# sourceMappingURL=useColorWheel.mjs.map
@@ -0,0 +1,269 @@
1
+ import {useGlobalListeners as $hcgPp$useGlobalListeners, focusWithoutScrolling as $hcgPp$focusWithoutScrolling, useFormReset as $hcgPp$useFormReset, mergeProps as $hcgPp$mergeProps, useLabels as $hcgPp$useLabels} from "@react-aria/utils";
2
+ import {useCallback as $hcgPp$useCallback, useRef as $hcgPp$useRef} from "react";
3
+ import {useKeyboard as $hcgPp$useKeyboard, useMove as $hcgPp$useMove} from "@react-aria/interactions";
4
+ import {useLocale as $hcgPp$useLocale} from "@react-aria/i18n";
5
+ import {useVisuallyHidden as $hcgPp$useVisuallyHidden} from "@react-aria/visually-hidden";
6
+
7
+ /*
8
+ * Copyright 2020 Adobe. All rights reserved.
9
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
10
+ * you may not use this file except in compliance with the License. You may obtain a copy
11
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software distributed under
14
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
15
+ * OF ANY KIND, either express or implied. See the License for the specific language
16
+ * governing permissions and limitations under the License.
17
+ */
18
+
19
+
20
+
21
+
22
+ function $b4a0a4fdc900495e$export$9064ff4e44b3729a(props, state, inputRef) {
23
+ let { isDisabled: isDisabled, innerRadius: innerRadius, outerRadius: outerRadius, "aria-label": ariaLabel, name: name } = props;
24
+ let { addGlobalListener: addGlobalListener, removeGlobalListener: removeGlobalListener } = (0, $hcgPp$useGlobalListeners)();
25
+ let thumbRadius = (innerRadius + outerRadius) / 2;
26
+ let focusInput = (0, $hcgPp$useCallback)(()=>{
27
+ if (inputRef.current) (0, $hcgPp$focusWithoutScrolling)(inputRef.current);
28
+ }, [
29
+ inputRef
30
+ ]);
31
+ (0, $hcgPp$useFormReset)(inputRef, state.hue, state.setHue);
32
+ let currentPosition = (0, $hcgPp$useRef)(null);
33
+ let { keyboardProps: keyboardProps } = (0, $hcgPp$useKeyboard)({
34
+ onKeyDown (e) {
35
+ // these are the cases that useMove doesn't handle
36
+ if (!/^(PageUp|PageDown)$/.test(e.key)) {
37
+ e.continuePropagation();
38
+ return;
39
+ }
40
+ // same handling as useMove, don't need to stop propagation, useKeyboard will do that for us
41
+ e.preventDefault();
42
+ // remember to set this and unset it so that onChangeEnd is fired
43
+ state.setDragging(true);
44
+ switch(e.key){
45
+ case "PageUp":
46
+ e.preventDefault();
47
+ state.increment(state.pageStep);
48
+ break;
49
+ case "PageDown":
50
+ e.preventDefault();
51
+ state.decrement(state.pageStep);
52
+ break;
53
+ }
54
+ state.setDragging(false);
55
+ }
56
+ });
57
+ let moveHandler = {
58
+ onMoveStart () {
59
+ currentPosition.current = null;
60
+ state.setDragging(true);
61
+ },
62
+ onMove ({ deltaX: deltaX, deltaY: deltaY, pointerType: pointerType, shiftKey: shiftKey }) {
63
+ if (currentPosition.current == null) currentPosition.current = state.getThumbPosition(thumbRadius);
64
+ currentPosition.current.x += deltaX;
65
+ currentPosition.current.y += deltaY;
66
+ if (pointerType === "keyboard") {
67
+ if (deltaX > 0 || deltaY < 0) state.increment(shiftKey ? state.pageStep : state.step);
68
+ else if (deltaX < 0 || deltaY > 0) state.decrement(shiftKey ? state.pageStep : state.step);
69
+ } else state.setHueFromPoint(currentPosition.current.x, currentPosition.current.y, thumbRadius);
70
+ },
71
+ onMoveEnd () {
72
+ isOnTrack.current = false;
73
+ state.setDragging(false);
74
+ focusInput();
75
+ }
76
+ };
77
+ let { moveProps: movePropsThumb } = (0, $hcgPp$useMove)(moveHandler);
78
+ let currentPointer = (0, $hcgPp$useRef)(undefined);
79
+ let isOnTrack = (0, $hcgPp$useRef)(false);
80
+ let { moveProps: movePropsContainer } = (0, $hcgPp$useMove)({
81
+ onMoveStart () {
82
+ if (isOnTrack.current) moveHandler.onMoveStart();
83
+ },
84
+ onMove (e) {
85
+ if (isOnTrack.current) moveHandler.onMove(e);
86
+ },
87
+ onMoveEnd () {
88
+ if (isOnTrack.current) moveHandler.onMoveEnd();
89
+ }
90
+ });
91
+ let onThumbDown = (id)=>{
92
+ if (!state.isDragging) {
93
+ currentPointer.current = id;
94
+ focusInput();
95
+ state.setDragging(true);
96
+ if (typeof PointerEvent !== "undefined") addGlobalListener(window, "pointerup", onThumbUp, false);
97
+ else {
98
+ addGlobalListener(window, "mouseup", onThumbUp, false);
99
+ addGlobalListener(window, "touchend", onThumbUp, false);
100
+ }
101
+ }
102
+ };
103
+ let onThumbUp = (e)=>{
104
+ var _e_changedTouches;
105
+ var _e_pointerId;
106
+ 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;
107
+ if (id === currentPointer.current) {
108
+ focusInput();
109
+ state.setDragging(false);
110
+ currentPointer.current = undefined;
111
+ isOnTrack.current = false;
112
+ if (typeof PointerEvent !== "undefined") removeGlobalListener(window, "pointerup", onThumbUp, false);
113
+ else {
114
+ removeGlobalListener(window, "mouseup", onThumbUp, false);
115
+ removeGlobalListener(window, "touchend", onThumbUp, false);
116
+ }
117
+ }
118
+ };
119
+ let onTrackDown = (track, id, pageX, pageY)=>{
120
+ let rect = track.getBoundingClientRect();
121
+ let x = pageX - rect.x - rect.width / 2;
122
+ let y = pageY - rect.y - rect.height / 2;
123
+ let radius = Math.sqrt(x * x + y * y);
124
+ if (innerRadius < radius && radius < outerRadius && !state.isDragging && currentPointer.current === undefined) {
125
+ isOnTrack.current = true;
126
+ currentPointer.current = id;
127
+ state.setHueFromPoint(x, y, radius);
128
+ focusInput();
129
+ state.setDragging(true);
130
+ if (typeof PointerEvent !== "undefined") addGlobalListener(window, "pointerup", onTrackUp, false);
131
+ else {
132
+ addGlobalListener(window, "mouseup", onTrackUp, false);
133
+ addGlobalListener(window, "touchend", onTrackUp, false);
134
+ }
135
+ }
136
+ };
137
+ let onTrackUp = (e)=>{
138
+ var _e_changedTouches;
139
+ var _e_pointerId;
140
+ 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;
141
+ if (isOnTrack.current && id === currentPointer.current) {
142
+ isOnTrack.current = false;
143
+ currentPointer.current = undefined;
144
+ state.setDragging(false);
145
+ focusInput();
146
+ if (typeof PointerEvent !== "undefined") removeGlobalListener(window, "pointerup", onTrackUp, false);
147
+ else {
148
+ removeGlobalListener(window, "mouseup", onTrackUp, false);
149
+ removeGlobalListener(window, "touchend", onTrackUp, false);
150
+ }
151
+ }
152
+ };
153
+ let trackInteractions = isDisabled ? {} : (0, $hcgPp$mergeProps)({
154
+ ...typeof PointerEvent !== "undefined" ? {
155
+ onPointerDown: (e)=>{
156
+ if (e.pointerType === "mouse" && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
157
+ onTrackDown(e.currentTarget, e.pointerId, e.clientX, e.clientY);
158
+ }
159
+ } : {
160
+ onMouseDown: (e)=>{
161
+ if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
162
+ onTrackDown(e.currentTarget, undefined, e.clientX, e.clientY);
163
+ },
164
+ onTouchStart: (e)=>{
165
+ onTrackDown(e.currentTarget, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY);
166
+ }
167
+ }
168
+ }, movePropsContainer);
169
+ let thumbInteractions = isDisabled ? {} : (0, $hcgPp$mergeProps)({
170
+ onMouseDown: (e)=>{
171
+ if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
172
+ onThumbDown(undefined);
173
+ },
174
+ onPointerDown: (e)=>{
175
+ if (e.pointerType === "mouse" && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
176
+ onThumbDown(e.pointerId);
177
+ },
178
+ onTouchStart: (e)=>{
179
+ onThumbDown(e.changedTouches[0].identifier);
180
+ }
181
+ }, keyboardProps, movePropsThumb);
182
+ let { x: x, y: y } = state.getThumbPosition(thumbRadius);
183
+ // Provide a default aria-label if none is given
184
+ let { locale: locale } = (0, $hcgPp$useLocale)();
185
+ if (ariaLabel == null && props["aria-labelledby"] == null) ariaLabel = state.value.getChannelName("hue", locale);
186
+ let inputLabellingProps = (0, $hcgPp$useLabels)({
187
+ ...props,
188
+ "aria-label": ariaLabel
189
+ });
190
+ let { minValue: minValue, maxValue: maxValue, step: step } = state.value.getChannelRange("hue");
191
+ let forcedColorAdjustNoneStyle = {
192
+ forcedColorAdjust: "none"
193
+ };
194
+ let { visuallyHiddenProps: visuallyHiddenProps } = (0, $hcgPp$useVisuallyHidden)({
195
+ style: {
196
+ opacity: "0.0001",
197
+ width: "100%",
198
+ height: "100%",
199
+ pointerEvents: "none"
200
+ }
201
+ });
202
+ return {
203
+ trackProps: {
204
+ ...trackInteractions,
205
+ style: {
206
+ position: "relative",
207
+ touchAction: "none",
208
+ width: outerRadius * 2,
209
+ height: outerRadius * 2,
210
+ background: `
211
+ conic-gradient(
212
+ from 90deg,
213
+ hsl(0, 100%, 50%),
214
+ hsl(30, 100%, 50%),
215
+ hsl(60, 100%, 50%),
216
+ hsl(90, 100%, 50%),
217
+ hsl(120, 100%, 50%),
218
+ hsl(150, 100%, 50%),
219
+ hsl(180, 100%, 50%),
220
+ hsl(210, 100%, 50%),
221
+ hsl(240, 100%, 50%),
222
+ hsl(270, 100%, 50%),
223
+ hsl(300, 100%, 50%),
224
+ hsl(330, 100%, 50%),
225
+ hsl(360, 100%, 50%)
226
+ )
227
+ `,
228
+ clipPath: `path(evenodd, "${$b4a0a4fdc900495e$var$circlePath(outerRadius, outerRadius, outerRadius)} ${$b4a0a4fdc900495e$var$circlePath(outerRadius, outerRadius, innerRadius)}")`,
229
+ ...forcedColorAdjustNoneStyle
230
+ }
231
+ },
232
+ thumbProps: {
233
+ ...thumbInteractions,
234
+ style: {
235
+ position: "absolute",
236
+ left: outerRadius + x,
237
+ top: outerRadius + y,
238
+ transform: "translate(-50%, -50%)",
239
+ touchAction: "none",
240
+ ...forcedColorAdjustNoneStyle
241
+ }
242
+ },
243
+ inputProps: (0, $hcgPp$mergeProps)(inputLabellingProps, {
244
+ type: "range",
245
+ min: String(minValue),
246
+ max: String(maxValue),
247
+ step: String(step),
248
+ "aria-valuetext": `${state.value.formatChannelValue("hue", locale)}, ${state.value.getHueName(locale)}`,
249
+ disabled: isDisabled,
250
+ value: `${state.value.getChannelValue("hue")}`,
251
+ name: name,
252
+ onChange: (e)=>{
253
+ state.setHue(parseFloat(e.target.value));
254
+ },
255
+ style: visuallyHiddenProps.style,
256
+ "aria-errormessage": props["aria-errormessage"],
257
+ "aria-describedby": props["aria-describedby"],
258
+ "aria-details": props["aria-details"]
259
+ })
260
+ };
261
+ }
262
+ // Creates an SVG path string for a circle.
263
+ function $b4a0a4fdc900495e$var$circlePath(cx, cy, r) {
264
+ 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`;
265
+ }
266
+
267
+
268
+ export {$b4a0a4fdc900495e$export$9064ff4e44b3729a as useColorWheel};
269
+ //# sourceMappingURL=useColorWheel.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AA+BM,SAAS,0CAAc,KAA4B,EAAE,KAAsB,EAAE,QAAqC;IACvH,IAAI,cACF,UAAU,eACV,WAAW,eACX,WAAW,EACX,cAAc,SAAS,QACvB,IAAI,EACL,GAAG;IAEJ,IAAI,qBAAC,iBAAiB,wBAAE,oBAAoB,EAAC,GAAG,CAAA,GAAA,yBAAiB;IAEjE,IAAI,cAAc,AAAC,CAAA,cAAc,WAAU,IAAK;IAEhD,IAAI,aAAa,CAAA,GAAA,kBAAU,EAAE;QAC3B,IAAI,SAAS,OAAO,EAClB,CAAA,GAAA,4BAAoB,EAAE,SAAS,OAAO;IAE1C,GAAG;QAAC;KAAS;IAEb,CAAA,GAAA,mBAAW,EAAE,UAAU,MAAM,GAAG,EAAE,MAAM,MAAM;IAE9C,IAAI,kBAAkB,CAAA,GAAA,aAAK,EAAiC;IAE5D,IAAI,iBAAC,aAAa,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,EAAE,EAAE,GAAG,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC;AAC1G","sources":["packages/@react-aria/color/src/useColorWheel.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 {AriaColorWheelProps} from '@react-types/color';\nimport {ColorWheelState} from '@react-stately/color';\nimport {DOMAttributes} from '@react-types/shared';\nimport {focusWithoutScrolling, mergeProps, useFormReset, useGlobalListeners, useLabels} from '@react-aria/utils';\nimport React, {ChangeEvent, InputHTMLAttributes, RefObject, useCallback, useRef} from 'react';\nimport {useKeyboard, useMove} from '@react-aria/interactions';\nimport {useLocale} from '@react-aria/i18n';\nimport {useVisuallyHidden} from '@react-aria/visually-hidden';\n\nexport interface AriaColorWheelOptions extends AriaColorWheelProps {\n /** The outer radius of the color wheel. */\n outerRadius: number,\n /** The inner radius of the color wheel. */\n innerRadius: number\n}\n\nexport interface ColorWheelAria {\n /** Props for the track element. */\n trackProps: DOMAttributes,\n /** Props for the thumb element. */\n thumbProps: DOMAttributes,\n /** Props for the visually hidden range input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a color wheel component.\n * Color wheels allow users to adjust the hue of an HSL or HSB color value on a circular track.\n */\nexport function useColorWheel(props: AriaColorWheelOptions, state: ColorWheelState, inputRef: RefObject<HTMLInputElement>): ColorWheelAria {\n let {\n isDisabled,\n innerRadius,\n outerRadius,\n 'aria-label': ariaLabel,\n name\n } = props;\n\n let {addGlobalListener, removeGlobalListener} = useGlobalListeners();\n\n let thumbRadius = (innerRadius + outerRadius) / 2;\n\n let focusInput = useCallback(() => {\n if (inputRef.current) {\n focusWithoutScrolling(inputRef.current);\n }\n }, [inputRef]);\n\n useFormReset(inputRef, state.hue, state.setHue);\n\n let currentPosition = useRef<{x: number, y: number} | null>(null);\n\n let {keyboardProps} = useKeyboard({\n onKeyDown(e) {\n // these are the cases that useMove doesn't handle\n if (!/^(PageUp|PageDown)$/.test(e.key)) {\n e.continuePropagation();\n return;\n }\n // same handling as useMove, don't need to stop propagation, useKeyboard will do that for us\n e.preventDefault();\n // remember to set this and unset it so that onChangeEnd is fired\n state.setDragging(true);\n switch (e.key) {\n case 'PageUp':\n e.preventDefault();\n state.increment(state.pageStep);\n break;\n case 'PageDown':\n e.preventDefault();\n state.decrement(state.pageStep);\n break;\n }\n state.setDragging(false);\n }\n });\n\n let moveHandler = {\n onMoveStart() {\n currentPosition.current = null;\n state.setDragging(true);\n },\n onMove({deltaX, deltaY, pointerType, shiftKey}) {\n if (currentPosition.current == null) {\n currentPosition.current = state.getThumbPosition(thumbRadius);\n }\n currentPosition.current.x += deltaX;\n currentPosition.current.y += deltaY;\n if (pointerType === 'keyboard') {\n if (deltaX > 0 || deltaY < 0) {\n state.increment(shiftKey ? state.pageStep : state.step);\n } else if (deltaX < 0 || deltaY > 0) {\n state.decrement(shiftKey ? state.pageStep : state.step);\n }\n } else {\n state.setHueFromPoint(currentPosition.current.x, currentPosition.current.y, thumbRadius);\n }\n },\n onMoveEnd() {\n isOnTrack.current = false;\n state.setDragging(false);\n focusInput();\n }\n };\n let {moveProps: movePropsThumb} = useMove(moveHandler);\n\n let currentPointer = useRef<number | null | undefined>(undefined);\n let isOnTrack = useRef<boolean>(false);\n let {moveProps: movePropsContainer} = useMove({\n onMoveStart() {\n if (isOnTrack.current) {\n moveHandler.onMoveStart();\n }\n },\n onMove(e) {\n if (isOnTrack.current) {\n moveHandler.onMove(e);\n }\n },\n onMoveEnd() {\n if (isOnTrack.current) {\n moveHandler.onMoveEnd();\n }\n }\n });\n\n let onThumbDown = (id: number | null | undefined) => {\n if (!state.isDragging) {\n currentPointer.current = id;\n focusInput();\n state.setDragging(true);\n\n if (typeof PointerEvent !== 'undefined') {\n addGlobalListener(window, 'pointerup', onThumbUp, false);\n } else {\n addGlobalListener(window, 'mouseup', onThumbUp, false);\n addGlobalListener(window, 'touchend', onThumbUp, false);\n }\n }\n };\n\n let onThumbUp = (e) => {\n let id = e.pointerId ?? e.changedTouches?.[0].identifier;\n if (id === currentPointer.current) {\n focusInput();\n state.setDragging(false);\n currentPointer.current = undefined;\n isOnTrack.current = false;\n\n if (typeof PointerEvent !== 'undefined') {\n removeGlobalListener(window, 'pointerup', onThumbUp, false);\n } else {\n removeGlobalListener(window, 'mouseup', onThumbUp, false);\n removeGlobalListener(window, 'touchend', onThumbUp, false);\n }\n }\n };\n\n let onTrackDown = (track: Element, id: number | null | undefined, pageX: number, pageY: number) => {\n let rect = track.getBoundingClientRect();\n let x = pageX - rect.x - rect.width / 2;\n let y = pageY - rect.y - rect.height / 2;\n let radius = Math.sqrt(x * x + y * y);\n if (innerRadius < radius && radius < outerRadius && !state.isDragging && currentPointer.current === undefined) {\n isOnTrack.current = true;\n currentPointer.current = id;\n state.setHueFromPoint(x, y, radius);\n\n focusInput();\n state.setDragging(true);\n\n if (typeof PointerEvent !== 'undefined') {\n addGlobalListener(window, 'pointerup', onTrackUp, false);\n } else {\n addGlobalListener(window, 'mouseup', onTrackUp, false);\n addGlobalListener(window, 'touchend', onTrackUp, false);\n }\n }\n };\n\n let onTrackUp = (e) => {\n let id = e.pointerId ?? e.changedTouches?.[0].identifier;\n if (isOnTrack.current && id === currentPointer.current) {\n isOnTrack.current = false;\n currentPointer.current = undefined;\n state.setDragging(false);\n focusInput();\n\n\n if (typeof PointerEvent !== 'undefined') {\n removeGlobalListener(window, 'pointerup', onTrackUp, false);\n } else {\n removeGlobalListener(window, 'mouseup', onTrackUp, false);\n removeGlobalListener(window, 'touchend', onTrackUp, false);\n }\n }\n };\n\n let trackInteractions = isDisabled ? {} : mergeProps({\n ...(typeof PointerEvent !== 'undefined' ? {\n onPointerDown: (e: React.PointerEvent) => {\n if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) {\n return;\n }\n onTrackDown(e.currentTarget, e.pointerId, e.clientX, e.clientY);\n }} : {\n onMouseDown: (e: React.MouseEvent) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onTrackDown(e.currentTarget, undefined, e.clientX, e.clientY);\n },\n onTouchStart: (e: React.TouchEvent) => {\n onTrackDown(e.currentTarget, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY);\n }\n })\n }, movePropsContainer);\n\n let thumbInteractions = isDisabled ? {} : mergeProps({\n onMouseDown: (e: React.MouseEvent) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onThumbDown(undefined);\n },\n onPointerDown: (e: React.PointerEvent) => {\n if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) {\n return;\n }\n onThumbDown(e.pointerId);\n },\n onTouchStart: (e: React.TouchEvent) => {\n onThumbDown(e.changedTouches[0].identifier);\n }\n }, keyboardProps, movePropsThumb);\n let {x, y} = state.getThumbPosition(thumbRadius);\n\n // Provide a default aria-label if none is given\n let {locale} = useLocale();\n if (ariaLabel == null && props['aria-labelledby'] == null) {\n ariaLabel = state.value.getChannelName('hue', locale);\n }\n\n let inputLabellingProps = useLabels({\n ...props,\n 'aria-label': ariaLabel\n });\n\n let {minValue, maxValue, step} = state.value.getChannelRange('hue');\n\n let forcedColorAdjustNoneStyle = {\n forcedColorAdjust: 'none'\n };\n\n let {visuallyHiddenProps} = useVisuallyHidden({\n style: {\n opacity: '0.0001',\n width: '100%',\n height: '100%',\n pointerEvents: 'none'\n }\n });\n\n return {\n trackProps: {\n ...trackInteractions,\n style: {\n position: 'relative',\n touchAction: 'none',\n width: outerRadius * 2,\n height: outerRadius * 2,\n background: `\n conic-gradient(\n from 90deg,\n hsl(0, 100%, 50%),\n hsl(30, 100%, 50%),\n hsl(60, 100%, 50%),\n hsl(90, 100%, 50%),\n hsl(120, 100%, 50%),\n hsl(150, 100%, 50%),\n hsl(180, 100%, 50%),\n hsl(210, 100%, 50%),\n hsl(240, 100%, 50%),\n hsl(270, 100%, 50%),\n hsl(300, 100%, 50%),\n hsl(330, 100%, 50%),\n hsl(360, 100%, 50%)\n )\n `,\n clipPath: `path(evenodd, \"${circlePath(outerRadius, outerRadius, outerRadius)} ${circlePath(outerRadius, outerRadius, innerRadius)}\")`,\n ...forcedColorAdjustNoneStyle\n }\n },\n thumbProps: {\n ...thumbInteractions,\n style: {\n position: 'absolute',\n left: outerRadius + x,\n top: outerRadius + y,\n transform: 'translate(-50%, -50%)',\n touchAction: 'none',\n ...forcedColorAdjustNoneStyle\n }\n },\n inputProps: mergeProps(\n inputLabellingProps,\n {\n type: 'range',\n min: String(minValue),\n max: String(maxValue),\n step: String(step),\n 'aria-valuetext': `${state.value.formatChannelValue('hue', locale)}, ${state.value.getHueName(locale)}`,\n disabled: isDisabled,\n value: `${state.value.getChannelValue('hue')}`,\n name,\n onChange: (e: ChangeEvent<HTMLInputElement>) => {\n state.setHue(parseFloat(e.target.value));\n },\n style: visuallyHiddenProps.style,\n 'aria-errormessage': props['aria-errormessage'],\n 'aria-describedby': props['aria-describedby'],\n 'aria-details': props['aria-details']\n }\n )\n };\n}\n\n// Creates an SVG path string for a circle.\nfunction circlePath(cx: number, cy: number, r: number) {\n 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`;\n}\n"],"names":[],"version":3,"file":"useColorWheel.module.js.map"}
@@ -0,0 +1,11 @@
1
+ module.exports = {
2
+ "colorInputLabel": (args)=>`${args.label}\u{3001}${args.channelLabel}`,
3
+ "colorNameAndValue": (args)=>`${args.name}\u{FF1A}${args.value}`,
4
+ "colorPicker": `\u{62FE}\u{8272}\u{5668}`,
5
+ "twoDimensionalSlider": `2D \u{6ED1}\u{5757}`,
6
+ "colorSwatch": `color swatch`,
7
+ "transparent": `transparent`
8
+ };
9
+
10
+
11
+ //# sourceMappingURL=zh-CN.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":"AAAA,iBAAiB;IAAG,mBAAmB,CAAC,OAAS,CAAC,EAAE,KAAK,KAAK,CAAC,QAAC,EAAE,KAAK,YAAY,CAAC,CAAC;IACnF,qBAAqB,CAAC,OAAS,CAAC,EAAE,KAAK,IAAI,CAAC,QAAC,EAAE,KAAK,KAAK,CAAC,CAAC;IAC3D,eAAe,CAAC,wBAAG,CAAC;IACpB,wBAAwB,CAAC,mBAAK,CAAC;IAC/B,eAAe,CAAC,YAAY,CAAC;IAC7B,eAAe,CAAC,WAAW,CAAC;AAC9B","sources":["packages/@react-aria/color/intl/zh-CN.json"],"sourcesContent":["{\n \"colorInputLabel\": \"{label}、{channelLabel}\",\n \"colorNameAndValue\": \"{name}:{value}\",\n \"colorPicker\": \"拾色器\",\n \"twoDimensionalSlider\": \"2D 滑块\",\n \"colorSwatch\": \"color swatch\",\n \"transparent\": \"transparent\"\n}\n"],"names":[],"version":3,"file":"zh-CN.main.js.map"}
package/dist/zh-CN.mjs ADDED
@@ -0,0 +1,13 @@
1
+ var $4e1dbc65a687dd93$exports = {};
2
+ $4e1dbc65a687dd93$exports = {
3
+ "colorInputLabel": (args)=>`${args.label}\u{3001}${args.channelLabel}`,
4
+ "colorNameAndValue": (args)=>`${args.name}\u{FF1A}${args.value}`,
5
+ "colorPicker": `\u{62FE}\u{8272}\u{5668}`,
6
+ "twoDimensionalSlider": `2D \u{6ED1}\u{5757}`,
7
+ "colorSwatch": `color swatch`,
8
+ "transparent": `transparent`
9
+ };
10
+
11
+
12
+ export {$4e1dbc65a687dd93$exports as default};
13
+ //# sourceMappingURL=zh-CN.mjs.map
@@ -0,0 +1,13 @@
1
+ var $4e1dbc65a687dd93$exports = {};
2
+ $4e1dbc65a687dd93$exports = {
3
+ "colorInputLabel": (args)=>`${args.label}\u{3001}${args.channelLabel}`,
4
+ "colorNameAndValue": (args)=>`${args.name}\u{FF1A}${args.value}`,
5
+ "colorPicker": `\u{62FE}\u{8272}\u{5668}`,
6
+ "twoDimensionalSlider": `2D \u{6ED1}\u{5757}`,
7
+ "colorSwatch": `color swatch`,
8
+ "transparent": `transparent`
9
+ };
10
+
11
+
12
+ export {$4e1dbc65a687dd93$exports as default};
13
+ //# sourceMappingURL=zh-CN.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";AAAA,4BAAiB;IAAG,mBAAmB,CAAC,OAAS,CAAC,EAAE,KAAK,KAAK,CAAC,QAAC,EAAE,KAAK,YAAY,CAAC,CAAC;IACnF,qBAAqB,CAAC,OAAS,CAAC,EAAE,KAAK,IAAI,CAAC,QAAC,EAAE,KAAK,KAAK,CAAC,CAAC;IAC3D,eAAe,CAAC,wBAAG,CAAC;IACpB,wBAAwB,CAAC,mBAAK,CAAC;IAC/B,eAAe,CAAC,YAAY,CAAC;IAC7B,eAAe,CAAC,WAAW,CAAC;AAC9B","sources":["packages/@react-aria/color/intl/zh-CN.json"],"sourcesContent":["{\n \"colorInputLabel\": \"{label}、{channelLabel}\",\n \"colorNameAndValue\": \"{name}:{value}\",\n \"colorPicker\": \"拾色器\",\n \"twoDimensionalSlider\": \"2D 滑块\",\n \"colorSwatch\": \"color swatch\",\n \"transparent\": \"transparent\"\n}\n"],"names":[],"version":3,"file":"zh-CN.module.js.map"}
@@ -0,0 +1,11 @@
1
+ module.exports = {
2
+ "colorInputLabel": (args)=>`${args.label}\u{FF0C}${args.channelLabel}`,
3
+ "colorNameAndValue": (args)=>`${args.name}\u{FF1A}${args.value}`,
4
+ "colorPicker": `\u{6AA2}\u{8272}\u{5668}`,
5
+ "twoDimensionalSlider": `2D \u{6ED1}\u{687F}`,
6
+ "colorSwatch": `color swatch`,
7
+ "transparent": `transparent`
8
+ };
9
+
10
+
11
+ //# sourceMappingURL=zh-TW.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":"AAAA,iBAAiB;IAAG,mBAAmB,CAAC,OAAS,CAAC,EAAE,KAAK,KAAK,CAAC,QAAC,EAAE,KAAK,YAAY,CAAC,CAAC;IACnF,qBAAqB,CAAC,OAAS,CAAC,EAAE,KAAK,IAAI,CAAC,QAAC,EAAE,KAAK,KAAK,CAAC,CAAC;IAC3D,eAAe,CAAC,wBAAG,CAAC;IACpB,wBAAwB,CAAC,mBAAK,CAAC;IAC/B,eAAe,CAAC,YAAY,CAAC;IAC7B,eAAe,CAAC,WAAW,CAAC;AAC9B","sources":["packages/@react-aria/color/intl/zh-TW.json"],"sourcesContent":["{\n \"colorInputLabel\": \"{label},{channelLabel}\",\n \"colorNameAndValue\": \"{name}:{value}\",\n \"colorPicker\": \"檢色器\",\n \"twoDimensionalSlider\": \"2D 滑桿\",\n \"colorSwatch\": \"color swatch\",\n \"transparent\": \"transparent\"\n}\n"],"names":[],"version":3,"file":"zh-TW.main.js.map"}
package/dist/zh-TW.mjs ADDED
@@ -0,0 +1,13 @@
1
+ var $b0fef28529309aa6$exports = {};
2
+ $b0fef28529309aa6$exports = {
3
+ "colorInputLabel": (args)=>`${args.label}\u{FF0C}${args.channelLabel}`,
4
+ "colorNameAndValue": (args)=>`${args.name}\u{FF1A}${args.value}`,
5
+ "colorPicker": `\u{6AA2}\u{8272}\u{5668}`,
6
+ "twoDimensionalSlider": `2D \u{6ED1}\u{687F}`,
7
+ "colorSwatch": `color swatch`,
8
+ "transparent": `transparent`
9
+ };
10
+
11
+
12
+ export {$b0fef28529309aa6$exports as default};
13
+ //# sourceMappingURL=zh-TW.mjs.map