@eightshift/ui-components 0.0.1

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 (112) hide show
  1. package/README.md +27 -0
  2. package/dist/Checkbox-BLcVbhiO.js +178 -0
  3. package/dist/ColorSwatch-Cmlex_kT.js +66 -0
  4. package/dist/FieldError-wtMA4667.js +42 -0
  5. package/dist/FocusScope-1u9yyfIN.js +725 -0
  6. package/dist/Form-Cq3fu75_.js +5 -0
  7. package/dist/GridList-BZPXp3_O.js +1256 -0
  8. package/dist/Group-DyqpTRPe.js +49 -0
  9. package/dist/Input-jsbb4ugq.js +130 -0
  10. package/dist/Label-BPzS-sR7.js +17 -0
  11. package/dist/ListBox-w9gDaJkV.js +4423 -0
  12. package/dist/LiveAnnouncer-IsokfWQ5.js +73 -0
  13. package/dist/NumberFormatter-LzoKy975.js +160 -0
  14. package/dist/RSPContexts-CrNYmadY.js +14 -0
  15. package/dist/Select-49a62830.esm-C-RFtLiD.js +2541 -0
  16. package/dist/SelectionManager-mefd0ThJ.js +2155 -0
  17. package/dist/Separator-DHn0CwdK.js +325 -0
  18. package/dist/Slider-Pyh2V4bY.js +885 -0
  19. package/dist/Text-BM136LvS.js +17 -0
  20. package/dist/VisuallyHidden-BYRI1Lfo.js +51 -0
  21. package/dist/_commonjsHelpers-CUmg6egw.js +6 -0
  22. package/dist/ariaHideOutside-ByKBPHmX.js +113 -0
  23. package/dist/assets/style.css +1 -0
  24. package/dist/button-BkkdyHfJ.js +307 -0
  25. package/dist/components/animated-visibility/animated-visibility.js +7165 -0
  26. package/dist/components/base-control/base-control.js +97 -0
  27. package/dist/components/breakpoint-preview/breakpoint-preview.js +218 -0
  28. package/dist/components/button/button.js +10 -0
  29. package/dist/components/checkbox/checkbox.js +119 -0
  30. package/dist/components/color-pickers/color-picker.js +242 -0
  31. package/dist/components/color-pickers/color-swatch.js +62 -0
  32. package/dist/components/color-pickers/gradient-editor.js +516 -0
  33. package/dist/components/color-pickers/solid-color-picker.js +1633 -0
  34. package/dist/components/component-toggle/component-toggle.js +71 -0
  35. package/dist/components/container-panel/container-panel.js +39 -0
  36. package/dist/components/expandable/expandable.js +144 -0
  37. package/dist/components/input-field/input-field.js +224 -0
  38. package/dist/components/link-input/link-input.js +937 -0
  39. package/dist/components/list-box/list-box.js +152 -0
  40. package/dist/components/matrix-align/matrix-align.js +185 -0
  41. package/dist/components/menu/menu.js +1608 -0
  42. package/dist/components/notice/notice.js +119 -0
  43. package/dist/components/number-picker/number-picker.js +277 -0
  44. package/dist/components/popover/popover.js +9 -0
  45. package/dist/components/radio/radio.js +552 -0
  46. package/dist/components/repeater/repeater-item.js +127 -0
  47. package/dist/components/repeater/repeater.js +248 -0
  48. package/dist/components/responsive/responsive-legacy.js +326 -0
  49. package/dist/components/responsive/responsive.js +499 -0
  50. package/dist/components/responsive-preview/responsive-preview.js +119 -0
  51. package/dist/components/rich-label/rich-label.js +56 -0
  52. package/dist/components/select/async-multi-select.js +144 -0
  53. package/dist/components/select/async-single-select.js +126 -0
  54. package/dist/components/select/custom-select-default-components.js +38 -0
  55. package/dist/components/select/multi-select-components.js +8 -0
  56. package/dist/components/select/multi-select.js +134 -0
  57. package/dist/components/select/react-select-component-wrappers.js +90 -0
  58. package/dist/components/select/shared.js +45 -0
  59. package/dist/components/select/single-select.js +116 -0
  60. package/dist/components/select/styles.js +55 -0
  61. package/dist/components/slider/column-config-slider.js +225 -0
  62. package/dist/components/slider/slider.js +362 -0
  63. package/dist/components/slider/utils.js +45 -0
  64. package/dist/components/spacer/spacer.js +93 -0
  65. package/dist/components/tabs/tabs.js +626 -0
  66. package/dist/components/toggle/switch.js +140 -0
  67. package/dist/components/toggle/toggle.js +58 -0
  68. package/dist/components/toggle-button/toggle-button.js +206 -0
  69. package/dist/components/tooltip/tooltip.js +10 -0
  70. package/dist/context-jMy6xdVq.js +98 -0
  71. package/dist/default-i18n-BhE-OUmt.js +873 -0
  72. package/dist/filterDOMProps-DG2RfOUr.js +30 -0
  73. package/dist/focusSafely-C3K8zAKj.js +743 -0
  74. package/dist/hooks/use-cell-edit-mode.js +35 -0
  75. package/dist/icons/block-icon.js +42 -0
  76. package/dist/icons/generic-color-swatch.js +21 -0
  77. package/dist/icons/icons.js +3636 -0
  78. package/dist/index-Bfb9bWcb.js +28844 -0
  79. package/dist/index-a301f526.esm-Bioi4cGX.js +3576 -0
  80. package/dist/index.js +109 -0
  81. package/dist/intlStrings-CUhoK9EN.js +2484 -0
  82. package/dist/isScrollable-PcyglExV.js +10 -0
  83. package/dist/modifiers.esm-BuJQPI1X.js +31 -0
  84. package/dist/multi-select-components-CjVpCNko.js +3677 -0
  85. package/dist/number-rWqELA8W.js +39 -0
  86. package/dist/popover-Dx3vKXUX.js +1061 -0
  87. package/dist/react-select-async.esm-TFb_ZX6C.js +111 -0
  88. package/dist/react-select.esm-BjRWqf0E.js +15 -0
  89. package/dist/style.js +1 -0
  90. package/dist/textSelection-BosCCRVE.js +89 -0
  91. package/dist/tooltip-CkCndvTI.js +1094 -0
  92. package/dist/useButton-CuG5UzUw.js +74 -0
  93. package/dist/useEvent-DHv-yhOH.js +24 -0
  94. package/dist/useFocusRing-Cc-4eouh.js +41 -0
  95. package/dist/useFocusable-5q1Gek1J.js +81 -0
  96. package/dist/useFormReset-Buc9YJcv.js +23 -0
  97. package/dist/useFormValidationState-BAPPNXic.js +238 -0
  98. package/dist/useHasTabbableChild-D3uUNhJ0.js +37 -0
  99. package/dist/useLabel-CGlkoFG0.js +28 -0
  100. package/dist/useLabels-Dg62M_3P.js +25 -0
  101. package/dist/useListData-BelKu4kx.js +211 -0
  102. package/dist/useListState-Domq0blV.js +137 -0
  103. package/dist/useLocalizedStringFormatter-Prmz0h0A.js +130 -0
  104. package/dist/useNumberFieldState-BLU3uhSR.js +1253 -0
  105. package/dist/useNumberFormatter-BLc2xjZn.js +13 -0
  106. package/dist/usePress-BQgVor4T.js +698 -0
  107. package/dist/useToggle-C9ETOBaZ.js +58 -0
  108. package/dist/useToggleState-DJ_z5E2S.js +21 -0
  109. package/dist/utilities/classnames.js +16 -0
  110. package/dist/utilities/text-helpers.js +79 -0
  111. package/dist/utils-BsiH7-5Y.js +488 -0
  112. package/package.json +71 -0
@@ -0,0 +1,1633 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import React__default, { forwardRef, useContext, createContext, useMemo, useRef, useState, useCallback } from "react";
3
+ import { a as $4e85f108e88277b8$export$ebe63fadcdce34ed, b as $4e85f108e88277b8$export$44644b8a16031b5b, c as $4e85f108e88277b8$export$717b2c0a523a0b53 } from "../../RSPContexts-CrNYmadY.js";
4
+ import { c as $64fa3d84918910a7$export$4d86445c2cf5e3, d as $3ef42575df84b30b$export$9d1611c77c2fe928, e as $bdb11010cef70236$export$f680877a34711e37, a as $64fa3d84918910a7$export$29f1550f4b0d4415, j as $64fa3d84918910a7$export$2881499e37b75b9a, h as $64fa3d84918910a7$export$9d4c57ee4c6ffdd8, i as $64fa3d84918910a7$export$ef03459518577ad4 } from "../../utils-BsiH7-5Y.js";
5
+ import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "../../filterDOMProps-DG2RfOUr.js";
6
+ import { $ as $f7dceffc5ad7768b$export$4e328f61c538687f } from "../../useFocusRing-Cc-4eouh.js";
7
+ import { $ as $6179b936705e76d3$export$ae780daf29e6d456, e as $458b0a5536c1a7cf$export$40bfa8c7b0832715, m as $7215afc6de606d6b$export$de79e2c695e052f3, d as $9ab94262bd0047c7$export$420e68273165f4ec, c as $a1ea59d68270f0dd$export$f8168d8dd8fd66e6, j as $c87311424ea30a05$export$fedb369cb70207f1, u as $c87311424ea30a05$export$a11b0059900ceec8 } from "../../focusSafely-C3K8zAKj.js";
8
+ import { $ as $799cddbef784668f$export$6e865ea70d7724f, b as $799cddbef784668f$export$4cde5df63f53f473, a as $3493a52097159720$exports } from "../../intlStrings-CUhoK9EN.js";
9
+ import { a as $9446cca9a3875146$export$cb6e0bb50bc19463, $ as $9446cca9a3875146$export$7d15b64cf5a3a4c4 } from "../../number-rWqELA8W.js";
10
+ import { $ as $03deb23ff14920c4$export$4eaf04e54aa8eed6 } from "../../textSelection-BosCCRVE.js";
11
+ import { $ as $313b98861ee5dd6c$export$d6875122194c7b44 } from "../../useLabels-Dg62M_3P.js";
12
+ import { $ as $99facab73266f662$export$5add1d006293d136 } from "../../useFormReset-Buc9YJcv.js";
13
+ import { a as $46d819fcbaf35654$export$8f71654801c2f7cd } from "../../useFocusable-5q1Gek1J.js";
14
+ import { e as $28f99e3e86e6ec45$export$e5fda3247f5d67f9, f as $e8a7022cf87cba2a$export$36da96379f79f245, g as $bcca50147b47f54d$export$56b2c08e277f365, h as $47b897dc8cdb026b$export$8d15029008292ae, d as $6f909507e6374d18$export$1e7083018727fa60, i as $6f909507e6374d18$export$f1fce0420cc6d8ee, j as $6f909507e6374d18$export$6189c2744041d8f8, a as $6f909507e6374d18$export$105594979f116971 } from "../../Slider-Pyh2V4bY.js";
15
+ import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "../../context-jMy6xdVq.js";
16
+ import { $ as $fca6afa0e843324b$export$f12b703ca79dfbb1 } from "../../useLocalizedStringFormatter-Prmz0h0A.js";
17
+ import { a as $5c3e21d68f1c4674$export$a966af930f325cab } from "../../VisuallyHidden-BYRI1Lfo.js";
18
+ import { $ as $ee014567cb39d3f0$export$ff05c3ac10437e03 } from "../../FieldError-wtMA4667.js";
19
+ import { $ as $3985021b0ad6602f$export$37fb8590cf2c088c, a as $3985021b0ad6602f$export$f5b8910cec6cf069 } from "../../Input-jsbb4ugq.js";
20
+ import { a as $01b77f81d0f07f68$export$75b6ee27786ba447, $ as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../../Label-BPzS-sR7.js";
21
+ import { a as $514c0188e459b4c0$export$9afb8bc826b033ea } from "../../Text-BM136LvS.js";
22
+ import { $ as $e5be200c675c3b3a$export$fc1a364ae1f3ff10, c as $e5be200c675c3b3a$export$a763b9476acd3eb } from "../../useFormValidationState-BAPPNXic.js";
23
+ import { $ as $de67e98908f0c6ee$export$7f629e9dc1ecf37c, b as $d2e8511e6f209edf$export$e908e06f4b8e3402, c as $7d0a636d7a4dcefd$export$2123ff2b87c81ca, d as $d841c8010a73d545$export$4f384c9210e583c3, a as $81397a9303501bda$export$23f548e970bdf099 } from "../../useNumberFieldState-BLU3uhSR.js";
24
+ import { classnames } from "../../utilities/classnames.js";
25
+ import { BaseControl } from "../base-control/base-control.js";
26
+ import { _ as __ } from "../../default-i18n-BhE-OUmt.js";
27
+ import { T as TriggeredPopover } from "../../popover-Dx3vKXUX.js";
28
+ import { icons } from "../../icons/icons.js";
29
+ import { Spacer } from "../spacer/spacer.js";
30
+ const $e2b71ec1d6016406$export$c80c0ea2ca5cb846 = /* @__PURE__ */ createContext(null);
31
+ function $e2b71ec1d6016406$var$ColorThumb(props, ref) {
32
+ let { state, thumbProps, inputXRef, inputYRef, xInputProps, yInputProps, isDisabled = false } = useContext($e2b71ec1d6016406$export$c80c0ea2ca5cb846);
33
+ let { focusProps, isFocused, isFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f();
34
+ let { hoverProps, isHovered } = $6179b936705e76d3$export$ae780daf29e6d456(props);
35
+ let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
36
+ ...props,
37
+ defaultClassName: "react-aria-ColorThumb",
38
+ defaultStyle: {
39
+ ...thumbProps.style,
40
+ backgroundColor: state.getDisplayColor().toString()
41
+ },
42
+ values: {
43
+ color: state.getDisplayColor(),
44
+ isHovered,
45
+ isDragging: state.isDragging,
46
+ isFocused,
47
+ isFocusVisible,
48
+ isDisabled
49
+ }
50
+ });
51
+ let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props);
52
+ delete DOMProps.id;
53
+ return /* @__PURE__ */ React__default.createElement("div", {
54
+ ...$3ef42575df84b30b$export$9d1611c77c2fe928(thumbProps, hoverProps, DOMProps),
55
+ ...renderProps,
56
+ ref,
57
+ "data-hovered": isHovered || void 0,
58
+ "data-dragging": state.isDragging || void 0,
59
+ "data-focused": isFocused || void 0,
60
+ "data-focus-visible": isFocusVisible || void 0,
61
+ "data-disabled": isDisabled || void 0
62
+ }, /* @__PURE__ */ React__default.createElement("input", {
63
+ ref: inputXRef,
64
+ ...xInputProps,
65
+ ...focusProps
66
+ }), yInputProps && /* @__PURE__ */ React__default.createElement("input", {
67
+ ref: inputYRef,
68
+ ...yInputProps,
69
+ ...focusProps
70
+ }), renderProps.children);
71
+ }
72
+ const $e2b71ec1d6016406$export$a3cc47cee1c1ccc = /* @__PURE__ */ forwardRef($e2b71ec1d6016406$var$ColorThumb);
73
+ const $6e14a98a7f67141d$var$DEFAULT_COLOR = $799cddbef784668f$export$6e865ea70d7724f("#ffffff");
74
+ function $6e14a98a7f67141d$export$6df7f0e2cabc7eef(props) {
75
+ let { value, defaultValue, colorSpace, xChannel, yChannel, onChange, onChangeEnd } = props;
76
+ if (!value && !defaultValue)
77
+ defaultValue = $6e14a98a7f67141d$var$DEFAULT_COLOR;
78
+ let [colorValue, setColorState] = $458b0a5536c1a7cf$export$40bfa8c7b0832715(value && $799cddbef784668f$export$4cde5df63f53f473(value), defaultValue && $799cddbef784668f$export$4cde5df63f53f473(defaultValue), onChange);
79
+ let color = useMemo(() => colorSpace && colorValue ? colorValue.toFormat(colorSpace) : colorValue, [
80
+ colorValue,
81
+ colorSpace
82
+ ]);
83
+ let valueRef = useRef(color);
84
+ let setColor = (color2) => {
85
+ valueRef.current = color2;
86
+ setColorState(color2);
87
+ };
88
+ let channels = useMemo(() => color.getColorSpaceAxes({
89
+ xChannel,
90
+ yChannel
91
+ }), [
92
+ color,
93
+ xChannel,
94
+ yChannel
95
+ ]);
96
+ let xChannelRange = color.getChannelRange(channels.xChannel);
97
+ let yChannelRange = color.getChannelRange(channels.yChannel);
98
+ let { minValue: minValueX, maxValue: maxValueX, step: stepX, pageSize: pageSizeX } = xChannelRange;
99
+ let { minValue: minValueY, maxValue: maxValueY, step: stepY, pageSize: pageSizeY } = yChannelRange;
100
+ let [isDragging, setDragging] = useState(false);
101
+ let isDraggingRef = useRef(false);
102
+ let xValue = color.getChannelValue(channels.xChannel);
103
+ let yValue = color.getChannelValue(channels.yChannel);
104
+ let setXValue = (v) => {
105
+ if (v === xValue)
106
+ return;
107
+ let newColor = color.withChannelValue(channels.xChannel, v);
108
+ setColor(newColor);
109
+ };
110
+ let setYValue = (v) => {
111
+ if (v === yValue)
112
+ return;
113
+ let newColor = color.withChannelValue(channels.yChannel, v);
114
+ setColor(newColor);
115
+ };
116
+ return {
117
+ channels,
118
+ xChannelStep: stepX,
119
+ yChannelStep: stepY,
120
+ xChannelPageStep: pageSizeX,
121
+ yChannelPageStep: pageSizeY,
122
+ value: color,
123
+ setValue(value2) {
124
+ setColor($799cddbef784668f$export$4cde5df63f53f473(value2));
125
+ },
126
+ xValue,
127
+ setXValue,
128
+ yValue,
129
+ setYValue,
130
+ setColorFromPoint(x, y) {
131
+ let newXValue = minValueX + $9446cca9a3875146$export$7d15b64cf5a3a4c4(x, 0, 1) * (maxValueX - minValueX);
132
+ let newYValue = minValueY + (1 - $9446cca9a3875146$export$7d15b64cf5a3a4c4(y, 0, 1)) * (maxValueY - minValueY);
133
+ let newColor;
134
+ if (newXValue !== xValue) {
135
+ newXValue = $9446cca9a3875146$export$cb6e0bb50bc19463(newXValue, minValueX, maxValueX, stepX);
136
+ newColor = color.withChannelValue(channels.xChannel, newXValue);
137
+ }
138
+ if (newYValue !== yValue) {
139
+ newYValue = $9446cca9a3875146$export$cb6e0bb50bc19463(newYValue, minValueY, maxValueY, stepY);
140
+ newColor = (newColor || color).withChannelValue(channels.yChannel, newYValue);
141
+ }
142
+ if (newColor)
143
+ setColor(newColor);
144
+ },
145
+ getThumbPosition() {
146
+ let x = (xValue - minValueX) / (maxValueX - minValueX);
147
+ let y = 1 - (yValue - minValueY) / (maxValueY - minValueY);
148
+ return {
149
+ x,
150
+ y
151
+ };
152
+ },
153
+ incrementX(stepSize) {
154
+ setXValue(xValue + stepSize > maxValueX ? maxValueX : $9446cca9a3875146$export$cb6e0bb50bc19463(xValue + stepSize, minValueX, maxValueX, stepX));
155
+ },
156
+ incrementY(stepSize) {
157
+ setYValue(yValue + stepSize > maxValueY ? maxValueY : $9446cca9a3875146$export$cb6e0bb50bc19463(yValue + stepSize, minValueY, maxValueY, stepY));
158
+ },
159
+ decrementX(stepSize) {
160
+ setXValue($9446cca9a3875146$export$cb6e0bb50bc19463(xValue - stepSize, minValueX, maxValueX, stepX));
161
+ },
162
+ decrementY(stepSize) {
163
+ setYValue($9446cca9a3875146$export$cb6e0bb50bc19463(yValue - stepSize, minValueY, maxValueY, stepY));
164
+ },
165
+ setDragging(isDragging2) {
166
+ let wasDragging = isDraggingRef.current;
167
+ isDraggingRef.current = isDragging2;
168
+ if (onChangeEnd && !isDragging2 && wasDragging)
169
+ onChangeEnd(valueRef.current);
170
+ setDragging(isDragging2);
171
+ },
172
+ isDragging,
173
+ getDisplayColor() {
174
+ return color.withChannelValue("alpha", 1);
175
+ }
176
+ };
177
+ }
178
+ function $25a25ac0d1624665$export$57bc203e1c9c6d44(props) {
179
+ let { channel, colorSpace, value, defaultValue, onChange, locale, ...otherProps } = props;
180
+ if (value == null && defaultValue == null)
181
+ throw new Error("useColorSliderState requires a value or defaultValue");
182
+ let [colorValue, setColor] = $458b0a5536c1a7cf$export$40bfa8c7b0832715(value && $799cddbef784668f$export$4cde5df63f53f473(value), defaultValue && $799cddbef784668f$export$4cde5df63f53f473(defaultValue), onChange);
183
+ let color = useMemo(() => colorSpace && colorValue ? colorValue.toFormat(colorSpace) : colorValue, [
184
+ colorValue,
185
+ colorSpace
186
+ ]);
187
+ let sliderState = $28f99e3e86e6ec45$export$e5fda3247f5d67f9({
188
+ ...color.getChannelRange(channel),
189
+ ...otherProps,
190
+ // Unused except in getThumbValueLabel, which is overridden below. null to appease TypeScript.
191
+ numberFormatter: null,
192
+ value: color.getChannelValue(channel),
193
+ onChange(v) {
194
+ setColor(color.withChannelValue(channel, v));
195
+ },
196
+ onChangeEnd(v) {
197
+ if (props.onChangeEnd)
198
+ props.onChangeEnd(color.withChannelValue(channel, v));
199
+ }
200
+ });
201
+ let { step, pageSize } = color.getChannelRange(channel);
202
+ return {
203
+ ...sliderState,
204
+ value: color,
205
+ setValue(value2) {
206
+ setColor($799cddbef784668f$export$4cde5df63f53f473(value2));
207
+ },
208
+ getDisplayColor() {
209
+ switch (channel) {
210
+ case "hue":
211
+ return $799cddbef784668f$export$6e865ea70d7724f(`hsl(${color.getChannelValue("hue")}, 100%, 50%)`);
212
+ case "lightness":
213
+ case "brightness":
214
+ case "saturation":
215
+ case "red":
216
+ case "green":
217
+ case "blue":
218
+ return color.withChannelValue("alpha", 1);
219
+ case "alpha":
220
+ return color;
221
+ default:
222
+ throw new Error("Unknown color channel: " + channel);
223
+ }
224
+ },
225
+ getThumbValueLabel() {
226
+ return color.formatChannelValue(channel, locale);
227
+ },
228
+ step,
229
+ pageSize,
230
+ isDragging: sliderState.isThumbDragging(0)
231
+ };
232
+ }
233
+ function $aa90ad8b2b1d015f$export$5aadd9c0606af5c2(value) {
234
+ return useMemo(() => {
235
+ if (typeof value === "string")
236
+ try {
237
+ return (0, $799cddbef784668f$export$6e865ea70d7724f)(value);
238
+ } catch (err) {
239
+ return void 0;
240
+ }
241
+ return value;
242
+ }, [
243
+ value
244
+ ]);
245
+ }
246
+ const $b335ada08155d9c0$var$MIN_COLOR = $799cddbef784668f$export$6e865ea70d7724f("#000000");
247
+ const $b335ada08155d9c0$var$MAX_COLOR = $799cddbef784668f$export$6e865ea70d7724f("#FFFFFF");
248
+ const $b335ada08155d9c0$var$MIN_COLOR_INT = $b335ada08155d9c0$var$MIN_COLOR.toHexInt();
249
+ const $b335ada08155d9c0$var$MAX_COLOR_INT = $b335ada08155d9c0$var$MAX_COLOR.toHexInt();
250
+ function $b335ada08155d9c0$export$d52a01683abdfcd6(props) {
251
+ let { value, defaultValue, onChange } = props;
252
+ let { step } = $b335ada08155d9c0$var$MIN_COLOR.getChannelRange("red");
253
+ let initialValue = $aa90ad8b2b1d015f$export$5aadd9c0606af5c2(value);
254
+ let initialDefaultValue = $aa90ad8b2b1d015f$export$5aadd9c0606af5c2(defaultValue);
255
+ let [colorValue, setColorValue] = $458b0a5536c1a7cf$export$40bfa8c7b0832715(initialValue, initialDefaultValue, onChange);
256
+ let [inputValue, setInputValue] = useState(() => (value || defaultValue) && colorValue ? colorValue.toString("hex") : "");
257
+ let validation = $e5be200c675c3b3a$export$fc1a364ae1f3ff10({
258
+ ...props,
259
+ value: colorValue
260
+ });
261
+ let safelySetColorValue = (newColor) => {
262
+ if (!colorValue || !newColor) {
263
+ setColorValue(newColor);
264
+ return;
265
+ }
266
+ if (newColor.toHexInt() !== colorValue.toHexInt()) {
267
+ setColorValue(newColor);
268
+ return;
269
+ }
270
+ };
271
+ let [prevValue, setPrevValue] = useState(colorValue);
272
+ if (prevValue !== colorValue) {
273
+ setInputValue(colorValue ? colorValue.toString("hex") : "");
274
+ setPrevValue(colorValue);
275
+ }
276
+ let parsedValue = useMemo(() => {
277
+ let color;
278
+ try {
279
+ color = (0, $799cddbef784668f$export$6e865ea70d7724f)(inputValue.startsWith("#") ? inputValue : `#${inputValue}`);
280
+ } catch (err) {
281
+ color = null;
282
+ }
283
+ return color;
284
+ }, [
285
+ inputValue
286
+ ]);
287
+ let commit = () => {
288
+ if (!inputValue.length) {
289
+ safelySetColorValue(null);
290
+ setInputValue(value === void 0 ? "" : colorValue.toString("hex"));
291
+ return;
292
+ }
293
+ if (parsedValue == null) {
294
+ setInputValue(colorValue ? colorValue.toString("hex") : "");
295
+ return;
296
+ }
297
+ safelySetColorValue(parsedValue);
298
+ let newColorValue = "";
299
+ if (colorValue)
300
+ newColorValue = colorValue.toString("hex");
301
+ setInputValue(newColorValue);
302
+ };
303
+ let increment = () => {
304
+ let newValue = $b335ada08155d9c0$var$addColorValue(parsedValue, step);
305
+ if (newValue === colorValue)
306
+ setInputValue(newValue.toString("hex"));
307
+ safelySetColorValue(newValue);
308
+ validation.commitValidation();
309
+ };
310
+ let decrement = () => {
311
+ let newValue = $b335ada08155d9c0$var$addColorValue(parsedValue, -step);
312
+ if (newValue === colorValue)
313
+ setInputValue(newValue.toString("hex"));
314
+ safelySetColorValue(newValue);
315
+ validation.commitValidation();
316
+ };
317
+ let incrementToMax = () => safelySetColorValue($b335ada08155d9c0$var$MAX_COLOR);
318
+ let decrementToMin = () => safelySetColorValue($b335ada08155d9c0$var$MIN_COLOR);
319
+ let validate = (value2) => {
320
+ var _value_match;
321
+ return value2 === "" || !!((_value_match = value2.match(/^#?[0-9a-f]{0,6}$/i)) === null || _value_match === void 0 ? void 0 : _value_match[0]);
322
+ };
323
+ return {
324
+ ...validation,
325
+ validate,
326
+ colorValue,
327
+ inputValue,
328
+ setInputValue,
329
+ commit,
330
+ increment,
331
+ incrementToMax,
332
+ decrement,
333
+ decrementToMin
334
+ };
335
+ }
336
+ function $b335ada08155d9c0$var$addColorValue(color, step) {
337
+ let newColor = color ? color : $b335ada08155d9c0$var$MIN_COLOR;
338
+ let colorInt = newColor.toHexInt();
339
+ let clampInt = Math.min(Math.max(colorInt + step, $b335ada08155d9c0$var$MIN_COLOR_INT), $b335ada08155d9c0$var$MAX_COLOR_INT);
340
+ if (clampInt !== colorInt) {
341
+ let newColorString = `#${clampInt.toString(16).padStart(6, "0").toUpperCase()}`;
342
+ newColor = $799cddbef784668f$export$6e865ea70d7724f(newColorString);
343
+ }
344
+ return newColor;
345
+ }
346
+ function $31a863bb88e75dd6$export$b9fc0d69c9190c4a(props) {
347
+ let { channel, colorSpace, locale } = props;
348
+ let initialValue = $aa90ad8b2b1d015f$export$5aadd9c0606af5c2(props.value);
349
+ let initialDefaultValue = $aa90ad8b2b1d015f$export$5aadd9c0606af5c2(props.defaultValue || "#0000");
350
+ let [colorValue, setColor] = $458b0a5536c1a7cf$export$40bfa8c7b0832715(initialValue || void 0, initialDefaultValue, props.onChange);
351
+ let color = useMemo(() => colorSpace && colorValue ? colorValue.toFormat(colorSpace) : colorValue, [
352
+ colorValue,
353
+ colorSpace
354
+ ]);
355
+ let value = color.getChannelValue(channel);
356
+ let range = color.getChannelRange(channel);
357
+ let formatOptions = useMemo(() => color.getChannelFormatOptions(channel), [
358
+ color,
359
+ channel
360
+ ]);
361
+ let multiplier = formatOptions.style === "percent" && range.maxValue === 100 ? 100 : 1;
362
+ let numberFieldState = $de67e98908f0c6ee$export$7f629e9dc1ecf37c({
363
+ locale,
364
+ value: value / multiplier,
365
+ onChange: (v) => setColor(color.withChannelValue(channel, v * multiplier)),
366
+ minValue: range.minValue / multiplier,
367
+ maxValue: range.maxValue / multiplier,
368
+ step: range.step / multiplier,
369
+ formatOptions
370
+ });
371
+ return {
372
+ ...numberFieldState,
373
+ colorValue: color
374
+ };
375
+ }
376
+ const $40297c24c53588e6$var$hue = (color) => [
377
+ 0,
378
+ 60,
379
+ 120,
380
+ 180,
381
+ 240,
382
+ 300,
383
+ 360
384
+ ].map((hue) => color.withChannelValue("hue", hue).toString("css")).join(", ");
385
+ const $40297c24c53588e6$var$saturation = (color) => `${color.withChannelValue("saturation", 0)}, transparent`;
386
+ const $40297c24c53588e6$var$hslChannels = {
387
+ hue: $40297c24c53588e6$var$hue,
388
+ saturation: $40297c24c53588e6$var$saturation,
389
+ lightness: () => "black, transparent, white"
390
+ };
391
+ const $40297c24c53588e6$var$hsbChannels = {
392
+ hue: $40297c24c53588e6$var$hue,
393
+ saturation: $40297c24c53588e6$var$saturation,
394
+ brightness: () => "black, transparent"
395
+ };
396
+ function $40297c24c53588e6$export$dd62420467d245ca({ direction, state, zChannel, xChannel, yChannel }) {
397
+ let returnVal = useMemo(() => {
398
+ let end = direction === "rtl" ? "left" : "right";
399
+ let colorAreaStyles = {};
400
+ let zValue = state.value.getChannelValue(zChannel);
401
+ switch (state.value.getColorSpace()) {
402
+ case "rgb": {
403
+ let rgb = $799cddbef784668f$export$6e865ea70d7724f("rgb(0, 0, 0)");
404
+ colorAreaStyles = {
405
+ background: [
406
+ // The screen blend mode multiplies the inverse of each channel, e.g. 1 - (1 - a) * (1 - b).
407
+ // Create a layer for each channel, with the other channels as 0. After blending, this should
408
+ // result in the gradients being combined channel by channel.
409
+ `linear-gradient(to ${end}, ${rgb.withChannelValue(xChannel, 0)}, ${rgb.withChannelValue(xChannel, 255)})`,
410
+ `linear-gradient(to top, ${rgb.withChannelValue(yChannel, 0)}, ${rgb.withChannelValue(yChannel, 255)})`,
411
+ rgb.withChannelValue(zChannel, zValue)
412
+ ].join(","),
413
+ backgroundBlendMode: "screen"
414
+ };
415
+ break;
416
+ }
417
+ case "hsl": {
418
+ let channels = state.value.getColorChannels();
419
+ let value = $799cddbef784668f$export$6e865ea70d7724f("hsl(0, 100%, 50%)").withChannelValue(zChannel, zValue);
420
+ let bg = channels.filter((c) => c !== zChannel).map((c) => `linear-gradient(to ${c === xChannel ? end : "top"}, ${$40297c24c53588e6$var$hslChannels[c](value)})`).reverse();
421
+ if (zChannel === "hue")
422
+ bg.push(value.toString("css"));
423
+ colorAreaStyles = {
424
+ background: bg.join(", ")
425
+ };
426
+ break;
427
+ }
428
+ case "hsb": {
429
+ let channels = state.value.getColorChannels();
430
+ let value = $799cddbef784668f$export$6e865ea70d7724f("hsb(0, 100%, 100%)").withChannelValue(zChannel, zValue);
431
+ let bg = channels.filter((c) => c !== zChannel).map((c) => `linear-gradient(to ${c === xChannel ? end : "top"}, ${$40297c24c53588e6$var$hsbChannels[c](value)})`).reverse();
432
+ if (zChannel === "hue")
433
+ bg.push(value.toString("css"));
434
+ colorAreaStyles = {
435
+ background: bg.join(", ")
436
+ };
437
+ break;
438
+ }
439
+ }
440
+ let { x, y } = state.getThumbPosition();
441
+ if (direction === "rtl")
442
+ x = 1 - x;
443
+ let forcedColorAdjustNoneStyle = {
444
+ forcedColorAdjust: "none"
445
+ };
446
+ return {
447
+ colorAreaStyleProps: {
448
+ style: {
449
+ position: "relative",
450
+ touchAction: "none",
451
+ ...forcedColorAdjustNoneStyle,
452
+ ...colorAreaStyles
453
+ }
454
+ },
455
+ thumbStyleProps: {
456
+ style: {
457
+ position: "absolute",
458
+ left: `${x * 100}%`,
459
+ top: `${y * 100}%`,
460
+ transform: "translate(-50%, -50%)",
461
+ touchAction: "none",
462
+ ...forcedColorAdjustNoneStyle
463
+ }
464
+ }
465
+ };
466
+ }, [
467
+ direction,
468
+ state,
469
+ zChannel,
470
+ xChannel,
471
+ yChannel
472
+ ]);
473
+ return returnVal;
474
+ }
475
+ function $parcel$interopDefault(a) {
476
+ return a && a.__esModule ? a.default : a;
477
+ }
478
+ function $60bd7d6e45dcddfa$export$2f92a7a615a014f6(props, state) {
479
+ let { isDisabled, inputXRef, inputYRef, containerRef, "aria-label": ariaLabel, xName, yName } = props;
480
+ let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1($parcel$interopDefault($3493a52097159720$exports), "@react-aria/color");
481
+ let { addGlobalListener, removeGlobalListener } = $03deb23ff14920c4$export$4eaf04e54aa8eed6();
482
+ let { direction, locale } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
483
+ let [focusedInput, setFocusedInput] = useState(null);
484
+ let focusInput = useCallback((inputRef = inputXRef) => {
485
+ if (inputRef.current)
486
+ $7215afc6de606d6b$export$de79e2c695e052f3(inputRef.current);
487
+ }, [
488
+ inputXRef
489
+ ]);
490
+ $99facab73266f662$export$5add1d006293d136(inputXRef, [
491
+ state.xValue,
492
+ state.yValue
493
+ ], ([x, y]) => {
494
+ let newColor = state.value.withChannelValue(state.channels.xChannel, x).withChannelValue(state.channels.yChannel, y);
495
+ state.setValue(newColor);
496
+ });
497
+ let [valueChangedViaKeyboard, setValueChangedViaKeyboard] = useState(false);
498
+ let [valueChangedViaInputChangeEvent, setValueChangedViaInputChangeEvent] = useState(false);
499
+ let { xChannel, yChannel, zChannel } = state.channels;
500
+ let xChannelStep = state.xChannelStep;
501
+ let yChannelStep = state.yChannelStep;
502
+ let currentPosition = useRef(null);
503
+ let { keyboardProps } = $46d819fcbaf35654$export$8f71654801c2f7cd({
504
+ onKeyDown(e) {
505
+ if (!/^(PageUp|PageDown|Home|End)$/.test(e.key)) {
506
+ e.continuePropagation();
507
+ return;
508
+ }
509
+ e.preventDefault();
510
+ state.setDragging(true);
511
+ setValueChangedViaKeyboard(true);
512
+ let dir;
513
+ switch (e.key) {
514
+ case "PageUp":
515
+ state.incrementY(state.yChannelPageStep);
516
+ dir = "y";
517
+ break;
518
+ case "PageDown":
519
+ state.decrementY(state.yChannelPageStep);
520
+ dir = "y";
521
+ break;
522
+ case "Home":
523
+ direction === "rtl" ? state.incrementX(state.xChannelPageStep) : state.decrementX(state.xChannelPageStep);
524
+ dir = "x";
525
+ break;
526
+ case "End":
527
+ direction === "rtl" ? state.decrementX(state.xChannelPageStep) : state.incrementX(state.xChannelPageStep);
528
+ dir = "x";
529
+ break;
530
+ }
531
+ state.setDragging(false);
532
+ if (dir) {
533
+ let input = dir === "x" ? inputXRef : inputYRef;
534
+ focusInput(input);
535
+ setFocusedInput(dir);
536
+ }
537
+ }
538
+ });
539
+ let moveHandler = {
540
+ onMoveStart() {
541
+ currentPosition.current = null;
542
+ state.setDragging(true);
543
+ },
544
+ onMove({ deltaX, deltaY, pointerType, shiftKey }) {
545
+ var _containerRef_current;
546
+ let { incrementX, decrementX, incrementY, decrementY, xChannelPageStep, xChannelStep: xChannelStep2, yChannelPageStep, yChannelStep: yChannelStep2, getThumbPosition, setColorFromPoint } = state;
547
+ if (currentPosition.current == null)
548
+ currentPosition.current = getThumbPosition();
549
+ let { width, height } = ((_containerRef_current = containerRef.current) === null || _containerRef_current === void 0 ? void 0 : _containerRef_current.getBoundingClientRect()) || {
550
+ width: 0,
551
+ height: 0
552
+ };
553
+ let valueChanged = deltaX !== 0 || deltaY !== 0;
554
+ if (pointerType === "keyboard") {
555
+ let deltaXValue = shiftKey && xChannelPageStep > xChannelStep2 ? xChannelPageStep : xChannelStep2;
556
+ let deltaYValue = shiftKey && yChannelPageStep > yChannelStep2 ? yChannelPageStep : yChannelStep2;
557
+ if (deltaX > 0 && direction === "ltr" || deltaX < 0 && direction === "rtl")
558
+ incrementX(deltaXValue);
559
+ else if (deltaX < 0 && direction === "ltr" || deltaX > 0 && direction === "rtl")
560
+ decrementX(deltaXValue);
561
+ else if (deltaY > 0)
562
+ decrementY(deltaYValue);
563
+ else if (deltaY < 0)
564
+ incrementY(deltaYValue);
565
+ setValueChangedViaKeyboard(valueChanged);
566
+ focusedInput = valueChanged && Math.abs(deltaY) > Math.abs(deltaX) ? "y" : "x";
567
+ setFocusedInput(focusedInput);
568
+ } else {
569
+ currentPosition.current.x += (direction === "rtl" ? -1 : 1) * deltaX / width;
570
+ currentPosition.current.y += deltaY / height;
571
+ setColorFromPoint(currentPosition.current.x, currentPosition.current.y);
572
+ }
573
+ },
574
+ onMoveEnd() {
575
+ isOnColorArea.current = false;
576
+ state.setDragging(false);
577
+ let input = focusedInput === "x" ? inputXRef : inputYRef;
578
+ focusInput(input);
579
+ }
580
+ };
581
+ let { moveProps: movePropsThumb } = $e8a7022cf87cba2a$export$36da96379f79f245(moveHandler);
582
+ let { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec({
583
+ onFocusWithinChange: (focusWithin) => {
584
+ if (!focusWithin) {
585
+ setValueChangedViaKeyboard(false);
586
+ setValueChangedViaInputChangeEvent(false);
587
+ }
588
+ }
589
+ });
590
+ let currentPointer = useRef(void 0);
591
+ let isOnColorArea = useRef(false);
592
+ let { moveProps: movePropsContainer } = $e8a7022cf87cba2a$export$36da96379f79f245({
593
+ onMoveStart() {
594
+ if (isOnColorArea.current)
595
+ moveHandler.onMoveStart();
596
+ },
597
+ onMove(e) {
598
+ if (isOnColorArea.current)
599
+ moveHandler.onMove(e);
600
+ },
601
+ onMoveEnd() {
602
+ if (isOnColorArea.current)
603
+ moveHandler.onMoveEnd();
604
+ }
605
+ });
606
+ let onThumbDown = (id) => {
607
+ if (!state.isDragging) {
608
+ currentPointer.current = id;
609
+ setValueChangedViaKeyboard(false);
610
+ focusInput();
611
+ state.setDragging(true);
612
+ if (typeof PointerEvent !== "undefined")
613
+ addGlobalListener(window, "pointerup", onThumbUp, false);
614
+ else {
615
+ addGlobalListener(window, "mouseup", onThumbUp, false);
616
+ addGlobalListener(window, "touchend", onThumbUp, false);
617
+ }
618
+ }
619
+ };
620
+ let onThumbUp = (e) => {
621
+ var _e_changedTouches;
622
+ var _e_pointerId;
623
+ 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;
624
+ if (id === currentPointer.current) {
625
+ setValueChangedViaKeyboard(false);
626
+ focusInput();
627
+ state.setDragging(false);
628
+ currentPointer.current = void 0;
629
+ isOnColorArea.current = false;
630
+ if (typeof PointerEvent !== "undefined")
631
+ removeGlobalListener(window, "pointerup", onThumbUp, false);
632
+ else {
633
+ removeGlobalListener(window, "mouseup", onThumbUp, false);
634
+ removeGlobalListener(window, "touchend", onThumbUp, false);
635
+ }
636
+ }
637
+ };
638
+ let onColorAreaDown = (colorArea, id, clientX, clientY) => {
639
+ let rect = colorArea.getBoundingClientRect();
640
+ let { width, height } = rect;
641
+ let x = (clientX - rect.x) / width;
642
+ let y = (clientY - rect.y) / height;
643
+ if (direction === "rtl")
644
+ x = 1 - x;
645
+ if (x >= 0 && x <= 1 && y >= 0 && y <= 1 && !state.isDragging && currentPointer.current === void 0) {
646
+ isOnColorArea.current = true;
647
+ setValueChangedViaKeyboard(false);
648
+ currentPointer.current = id;
649
+ state.setColorFromPoint(x, y);
650
+ focusInput();
651
+ state.setDragging(true);
652
+ if (typeof PointerEvent !== "undefined")
653
+ addGlobalListener(window, "pointerup", onColorAreaUp, false);
654
+ else {
655
+ addGlobalListener(window, "mouseup", onColorAreaUp, false);
656
+ addGlobalListener(window, "touchend", onColorAreaUp, false);
657
+ }
658
+ }
659
+ };
660
+ let onColorAreaUp = (e) => {
661
+ var _e_changedTouches;
662
+ var _e_pointerId;
663
+ 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;
664
+ if (isOnColorArea.current && id === currentPointer.current) {
665
+ isOnColorArea.current = false;
666
+ setValueChangedViaKeyboard(false);
667
+ currentPointer.current = void 0;
668
+ state.setDragging(false);
669
+ focusInput();
670
+ if (typeof PointerEvent !== "undefined")
671
+ removeGlobalListener(window, "pointerup", onColorAreaUp, false);
672
+ else {
673
+ removeGlobalListener(window, "mouseup", onColorAreaUp, false);
674
+ removeGlobalListener(window, "touchend", onColorAreaUp, false);
675
+ }
676
+ }
677
+ };
678
+ let colorAreaInteractions = isDisabled ? {} : $3ef42575df84b30b$export$9d1611c77c2fe928({
679
+ ...typeof PointerEvent !== "undefined" ? {
680
+ onPointerDown: (e) => {
681
+ if (e.pointerType === "mouse" && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey))
682
+ return;
683
+ onColorAreaDown(e.currentTarget, e.pointerId, e.clientX, e.clientY);
684
+ }
685
+ } : {
686
+ onMouseDown: (e) => {
687
+ if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)
688
+ return;
689
+ onColorAreaDown(e.currentTarget, void 0, e.clientX, e.clientY);
690
+ },
691
+ onTouchStart: (e) => {
692
+ onColorAreaDown(e.currentTarget, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY);
693
+ }
694
+ }
695
+ }, movePropsContainer);
696
+ let thumbInteractions = isDisabled ? {} : $3ef42575df84b30b$export$9d1611c77c2fe928({
697
+ ...typeof PointerEvent !== "undefined" ? {
698
+ onPointerDown: (e) => {
699
+ if (e.pointerType === "mouse" && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey))
700
+ return;
701
+ onThumbDown(e.pointerId);
702
+ }
703
+ } : {
704
+ onMouseDown: (e) => {
705
+ if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)
706
+ return;
707
+ onThumbDown(void 0);
708
+ },
709
+ onTouchStart: (e) => {
710
+ onThumbDown(e.changedTouches[0].identifier);
711
+ }
712
+ }
713
+ }, focusWithinProps, keyboardProps, movePropsThumb);
714
+ let { focusProps: xInputFocusProps } = $a1ea59d68270f0dd$export$f8168d8dd8fd66e6({
715
+ onFocus: () => {
716
+ setFocusedInput("x");
717
+ }
718
+ });
719
+ let { focusProps: yInputFocusProps } = $a1ea59d68270f0dd$export$f8168d8dd8fd66e6({
720
+ onFocus: () => {
721
+ setFocusedInput("y");
722
+ }
723
+ });
724
+ const onChange = (e) => {
725
+ const { target } = e;
726
+ setValueChangedViaInputChangeEvent(true);
727
+ if (target === inputXRef.current)
728
+ state.setXValue(parseFloat(target.value));
729
+ else if (target === inputYRef.current)
730
+ state.setYValue(parseFloat(target.value));
731
+ };
732
+ let isMobile = $c87311424ea30a05$export$fedb369cb70207f1() || $c87311424ea30a05$export$a11b0059900ceec8();
733
+ let value = state.getDisplayColor();
734
+ const getAriaValueTextForChannel = useCallback((channel) => {
735
+ const isAfterInput = valueChangedViaInputChangeEvent || valueChangedViaKeyboard;
736
+ return `${isAfterInput ? stringFormatter.format("colorNameAndValue", {
737
+ name: value.getChannelName(channel, locale),
738
+ value: value.formatChannelValue(channel, locale)
739
+ }) : [
740
+ stringFormatter.format("colorNameAndValue", {
741
+ name: value.getChannelName(channel, locale),
742
+ value: value.formatChannelValue(channel, locale)
743
+ }),
744
+ stringFormatter.format("colorNameAndValue", {
745
+ name: value.getChannelName(channel === yChannel ? xChannel : yChannel, locale),
746
+ value: value.formatChannelValue(channel === yChannel ? xChannel : yChannel, locale)
747
+ }),
748
+ stringFormatter.format("colorNameAndValue", {
749
+ name: value.getChannelName(zChannel, locale),
750
+ value: value.formatChannelValue(zChannel, locale)
751
+ })
752
+ ].join(", ")}, ${value.getColorName(locale)}`;
753
+ }, [
754
+ locale,
755
+ value,
756
+ stringFormatter,
757
+ valueChangedViaInputChangeEvent,
758
+ valueChangedViaKeyboard,
759
+ xChannel,
760
+ yChannel,
761
+ zChannel
762
+ ]);
763
+ let colorPickerLabel = stringFormatter.format("colorPicker");
764
+ let xInputLabellingProps = $313b98861ee5dd6c$export$d6875122194c7b44({
765
+ ...props,
766
+ "aria-label": ariaLabel ? stringFormatter.format("colorInputLabel", {
767
+ label: ariaLabel,
768
+ channelLabel: colorPickerLabel
769
+ }) : colorPickerLabel
770
+ });
771
+ let yInputLabellingProps = $313b98861ee5dd6c$export$d6875122194c7b44({
772
+ ...props,
773
+ "aria-label": ariaLabel ? stringFormatter.format("colorInputLabel", {
774
+ label: ariaLabel,
775
+ channelLabel: colorPickerLabel
776
+ }) : colorPickerLabel
777
+ });
778
+ let colorAreaLabellingProps = $313b98861ee5dd6c$export$d6875122194c7b44({
779
+ ...props,
780
+ "aria-label": ariaLabel ? `${ariaLabel}, ${colorPickerLabel}` : void 0
781
+ }, isMobile ? colorPickerLabel : void 0);
782
+ let ariaRoleDescription = stringFormatter.format("twoDimensionalSlider");
783
+ let { visuallyHiddenProps } = $5c3e21d68f1c4674$export$a966af930f325cab({
784
+ style: {
785
+ opacity: "0.0001",
786
+ width: "100%",
787
+ height: "100%",
788
+ pointerEvents: "none"
789
+ }
790
+ });
791
+ let { colorAreaStyleProps, thumbStyleProps } = $40297c24c53588e6$export$dd62420467d245ca({
792
+ direction,
793
+ state,
794
+ xChannel,
795
+ yChannel,
796
+ zChannel
797
+ });
798
+ return {
799
+ colorAreaProps: {
800
+ ...colorAreaLabellingProps,
801
+ ...colorAreaInteractions,
802
+ ...colorAreaStyleProps,
803
+ role: "group"
804
+ },
805
+ thumbProps: {
806
+ ...thumbInteractions,
807
+ ...thumbStyleProps,
808
+ role: "presentation"
809
+ },
810
+ xInputProps: {
811
+ ...xInputLabellingProps,
812
+ ...visuallyHiddenProps,
813
+ ...xInputFocusProps,
814
+ type: "range",
815
+ min: state.value.getChannelRange(xChannel).minValue,
816
+ max: state.value.getChannelRange(xChannel).maxValue,
817
+ step: xChannelStep,
818
+ "aria-roledescription": ariaRoleDescription,
819
+ "aria-valuetext": getAriaValueTextForChannel(xChannel),
820
+ "aria-orientation": "horizontal",
821
+ "aria-describedby": props["aria-describedby"],
822
+ "aria-details": props["aria-details"],
823
+ disabled: isDisabled,
824
+ value: state.value.getChannelValue(xChannel),
825
+ name: xName,
826
+ tabIndex: isMobile || !focusedInput || focusedInput === "x" ? void 0 : -1,
827
+ /*
828
+ So that only a single "2d slider" control shows up when listing form elements for screen readers,
829
+ add aria-hidden="true" to the unfocused control when the value has not changed via the keyboard,
830
+ but remove aria-hidden to reveal the input for each channel when the value has changed with the keyboard.
831
+ */
832
+ "aria-hidden": isMobile || !focusedInput || focusedInput === "x" || valueChangedViaKeyboard ? void 0 : "true",
833
+ onChange
834
+ },
835
+ yInputProps: {
836
+ ...yInputLabellingProps,
837
+ ...visuallyHiddenProps,
838
+ ...yInputFocusProps,
839
+ type: "range",
840
+ min: state.value.getChannelRange(yChannel).minValue,
841
+ max: state.value.getChannelRange(yChannel).maxValue,
842
+ step: yChannelStep,
843
+ "aria-roledescription": ariaRoleDescription,
844
+ "aria-valuetext": getAriaValueTextForChannel(yChannel),
845
+ "aria-orientation": "vertical",
846
+ "aria-describedby": props["aria-describedby"],
847
+ "aria-details": props["aria-details"],
848
+ disabled: isDisabled,
849
+ value: state.value.getChannelValue(yChannel),
850
+ name: yName,
851
+ tabIndex: isMobile || focusedInput === "y" ? void 0 : -1,
852
+ /*
853
+ So that only a single "2d slider" control shows up when listing form elements for screen readers,
854
+ add aria-hidden="true" to the unfocused input when the value has not changed via the keyboard,
855
+ but remove aria-hidden to reveal the input for each channel when the value has changed with the keyboard.
856
+ */
857
+ "aria-hidden": isMobile || focusedInput === "y" || valueChangedViaKeyboard ? void 0 : "true",
858
+ onChange
859
+ }
860
+ };
861
+ }
862
+ function $40af666d6c251e36$export$106b7a4e66508f66(props, state) {
863
+ let { trackRef, inputRef, orientation, channel, "aria-label": ariaLabel, name } = props;
864
+ let { locale, direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
865
+ if (!props.label && !ariaLabel && !props["aria-labelledby"])
866
+ ariaLabel = state.value.getChannelName(channel, locale);
867
+ let { groupProps, trackProps, labelProps, outputProps } = $bcca50147b47f54d$export$56b2c08e277f365({
868
+ ...props,
869
+ "aria-label": ariaLabel
870
+ }, state, trackRef);
871
+ let { inputProps, thumbProps } = $47b897dc8cdb026b$export$8d15029008292ae({
872
+ index: 0,
873
+ orientation,
874
+ isDisabled: props.isDisabled,
875
+ name,
876
+ trackRef,
877
+ inputRef
878
+ }, state);
879
+ let value = state.getDisplayColor();
880
+ let generateBackground = () => {
881
+ let to;
882
+ if (orientation === "vertical")
883
+ to = "top";
884
+ else if (direction === "ltr")
885
+ to = "right";
886
+ else
887
+ to = "left";
888
+ switch (channel) {
889
+ case "hue": {
890
+ let stops = [
891
+ 0,
892
+ 60,
893
+ 120,
894
+ 180,
895
+ 240,
896
+ 300,
897
+ 360
898
+ ].map((hue) => value.withChannelValue("hue", hue).toString("css")).join(", ");
899
+ return `linear-gradient(to ${to}, ${stops})`;
900
+ }
901
+ case "lightness": {
902
+ let min = state.getThumbMinValue(0);
903
+ let max = state.getThumbMaxValue(0);
904
+ let start = value.withChannelValue(channel, min).toString("css");
905
+ let middle = value.withChannelValue(channel, (max - min) / 2).toString("css");
906
+ let end = value.withChannelValue(channel, max).toString("css");
907
+ return `linear-gradient(to ${to}, ${start}, ${middle}, ${end})`;
908
+ }
909
+ case "saturation":
910
+ case "brightness":
911
+ case "red":
912
+ case "green":
913
+ case "blue":
914
+ case "alpha": {
915
+ let start = value.withChannelValue(channel, state.getThumbMinValue(0)).toString("css");
916
+ let end = value.withChannelValue(channel, state.getThumbMaxValue(0)).toString("css");
917
+ return `linear-gradient(to ${to}, ${start}, ${end})`;
918
+ }
919
+ default:
920
+ throw new Error("Unknown color channel: " + channel);
921
+ }
922
+ };
923
+ let forcedColorAdjustNoneStyle = {
924
+ forcedColorAdjust: "none"
925
+ };
926
+ if (channel === "hue")
927
+ inputProps["aria-valuetext"] += `, ${value.getHueName(locale)}`;
928
+ else if (channel !== "alpha")
929
+ inputProps["aria-valuetext"] += `, ${value.getColorName(locale)}`;
930
+ let { visuallyHiddenProps } = $5c3e21d68f1c4674$export$a966af930f325cab({
931
+ style: {
932
+ opacity: "0.0001",
933
+ width: "100%",
934
+ height: "100%",
935
+ pointerEvents: "none"
936
+ }
937
+ });
938
+ return {
939
+ trackProps: {
940
+ ...$3ef42575df84b30b$export$9d1611c77c2fe928(groupProps, trackProps),
941
+ style: {
942
+ ...trackProps.style,
943
+ ...forcedColorAdjustNoneStyle,
944
+ background: generateBackground()
945
+ }
946
+ },
947
+ inputProps: {
948
+ ...inputProps,
949
+ style: {
950
+ ...inputProps.style,
951
+ ...visuallyHiddenProps.style
952
+ }
953
+ },
954
+ thumbProps: {
955
+ ...thumbProps,
956
+ style: {
957
+ ...thumbProps.style,
958
+ ...forcedColorAdjustNoneStyle
959
+ }
960
+ },
961
+ labelProps,
962
+ outputProps
963
+ };
964
+ }
965
+ function $f6896b05b2ecad12$export$77e32ca575a28fdf(props, state, ref) {
966
+ let { isDisabled, isReadOnly, isRequired, isWheelDisabled, validationBehavior = "aria" } = props;
967
+ let { colorValue, inputValue, increment, decrement, incrementToMax, decrementToMin, commit } = state;
968
+ let inputId = $bdb11010cef70236$export$f680877a34711e37();
969
+ let { spinButtonProps } = $d2e8511e6f209edf$export$e908e06f4b8e3402({
970
+ isDisabled,
971
+ isReadOnly,
972
+ isRequired,
973
+ maxValue: 16777215,
974
+ minValue: 0,
975
+ onIncrement: increment,
976
+ onIncrementToMax: incrementToMax,
977
+ onDecrement: decrement,
978
+ onDecrementToMin: decrementToMin,
979
+ value: colorValue ? colorValue.toHexInt() : void 0,
980
+ textValue: colorValue ? colorValue.toString("hex") : void 0
981
+ });
982
+ let [focusWithin, setFocusWithin] = useState(false);
983
+ let { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec({
984
+ isDisabled,
985
+ onFocusWithinChange: setFocusWithin
986
+ });
987
+ let onWheel = useCallback((e) => {
988
+ if (Math.abs(e.deltaY) <= Math.abs(e.deltaX))
989
+ return;
990
+ if (e.deltaY > 0)
991
+ increment();
992
+ else if (e.deltaY < 0)
993
+ decrement();
994
+ }, [
995
+ decrement,
996
+ increment
997
+ ]);
998
+ let scrollingDisabled = isWheelDisabled || isDisabled || isReadOnly || !focusWithin;
999
+ $7d0a636d7a4dcefd$export$2123ff2b87c81ca({
1000
+ onScroll: onWheel,
1001
+ isDisabled: scrollingDisabled
1002
+ }, ref);
1003
+ let onChange = (value) => {
1004
+ if (state.validate(value))
1005
+ state.setInputValue(value);
1006
+ };
1007
+ let { inputProps, ...otherProps } = $d841c8010a73d545$export$4f384c9210e583c3({
1008
+ ...props,
1009
+ id: inputId,
1010
+ value: inputValue,
1011
+ defaultValue: void 0,
1012
+ validate: void 0,
1013
+ [$e5be200c675c3b3a$export$a763b9476acd3eb]: state,
1014
+ type: "text",
1015
+ autoComplete: "off",
1016
+ onChange
1017
+ }, state, ref);
1018
+ inputProps = $3ef42575df84b30b$export$9d1611c77c2fe928(inputProps, spinButtonProps, focusWithinProps, {
1019
+ role: "textbox",
1020
+ "aria-valuemax": null,
1021
+ "aria-valuemin": null,
1022
+ "aria-valuenow": null,
1023
+ "aria-valuetext": null,
1024
+ autoCorrect: "off",
1025
+ spellCheck: "false",
1026
+ onBlur: commit
1027
+ });
1028
+ if (validationBehavior === "native")
1029
+ inputProps["aria-required"] = void 0;
1030
+ return {
1031
+ inputProps,
1032
+ ...otherProps
1033
+ };
1034
+ }
1035
+ function $5e632d1ff0188f00$export$e55dd820142d3131(props, state, inputRef) {
1036
+ let { locale } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
1037
+ return $81397a9303501bda$export$23f548e970bdf099({
1038
+ ...props,
1039
+ value: void 0,
1040
+ defaultValue: void 0,
1041
+ onChange: void 0,
1042
+ validate: void 0,
1043
+ // Provide a default aria-label if no other label is provided.
1044
+ "aria-label": props["aria-label"] || (props.label || props["aria-labelledby"] ? void 0 : state.colorValue.getChannelName(props.channel, locale))
1045
+ }, state, inputRef);
1046
+ }
1047
+ const $0de070065d44825d$export$6b32221de49982e = /* @__PURE__ */ createContext(null);
1048
+ function $0de070065d44825d$var$ColorArea(props, ref) {
1049
+ [props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $4e85f108e88277b8$export$ebe63fadcdce34ed);
1050
+ let inputXRef = useRef(null);
1051
+ let inputYRef = useRef(null);
1052
+ let state = $6e14a98a7f67141d$export$6df7f0e2cabc7eef(props);
1053
+ let { colorAreaProps, xInputProps, yInputProps, thumbProps } = $60bd7d6e45dcddfa$export$2f92a7a615a014f6({
1054
+ ...props,
1055
+ inputXRef,
1056
+ inputYRef,
1057
+ containerRef: ref
1058
+ }, state);
1059
+ let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
1060
+ ...props,
1061
+ defaultClassName: "react-aria-ColorArea",
1062
+ defaultStyle: colorAreaProps.style,
1063
+ values: {
1064
+ state,
1065
+ isDisabled: props.isDisabled || false
1066
+ }
1067
+ });
1068
+ let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props);
1069
+ delete DOMProps.id;
1070
+ return /* @__PURE__ */ React__default.createElement("div", {
1071
+ ref,
1072
+ ...colorAreaProps,
1073
+ ...DOMProps,
1074
+ ...renderProps,
1075
+ slot: props.slot || void 0,
1076
+ "data-disabled": props.isDisabled || void 0
1077
+ }, /* @__PURE__ */ React__default.createElement($64fa3d84918910a7$export$2881499e37b75b9a, {
1078
+ values: [
1079
+ [
1080
+ $0de070065d44825d$export$6b32221de49982e,
1081
+ state
1082
+ ],
1083
+ [
1084
+ $e2b71ec1d6016406$export$c80c0ea2ca5cb846,
1085
+ {
1086
+ state,
1087
+ thumbProps,
1088
+ inputXRef,
1089
+ xInputProps,
1090
+ inputYRef,
1091
+ yInputProps,
1092
+ isDisabled: props.isDisabled
1093
+ }
1094
+ ]
1095
+ ]
1096
+ }, renderProps.children));
1097
+ }
1098
+ const $0de070065d44825d$export$b2103f68a961418e = /* @__PURE__ */ forwardRef($0de070065d44825d$var$ColorArea);
1099
+ const $3ada01a82feafb94$export$96b6d32b05a1a8ed = /* @__PURE__ */ createContext(null);
1100
+ function $3ada01a82feafb94$var$ColorField(props, ref) {
1101
+ [props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $4e85f108e88277b8$export$44644b8a16031b5b);
1102
+ if (props.channel)
1103
+ return /* @__PURE__ */ React__default.createElement($3ada01a82feafb94$var$ColorChannelField, {
1104
+ ...props,
1105
+ channel: props.channel,
1106
+ forwardedRef: ref
1107
+ });
1108
+ else
1109
+ return /* @__PURE__ */ React__default.createElement($3ada01a82feafb94$var$HexColorField, {
1110
+ ...props,
1111
+ forwardedRef: ref
1112
+ });
1113
+ }
1114
+ const $3ada01a82feafb94$export$b865d4358897bb17 = /* @__PURE__ */ forwardRef($3ada01a82feafb94$var$ColorField);
1115
+ function $3ada01a82feafb94$var$ColorChannelField(props) {
1116
+ let { locale } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
1117
+ let state = $31a863bb88e75dd6$export$b9fc0d69c9190c4a({
1118
+ ...props,
1119
+ locale
1120
+ });
1121
+ let inputRef = useRef(null);
1122
+ let [labelRef, label] = $64fa3d84918910a7$export$9d4c57ee4c6ffdd8();
1123
+ var _props_validationBehavior;
1124
+ let { labelProps, inputProps, descriptionProps, errorMessageProps, ...validation } = $5e632d1ff0188f00$export$e55dd820142d3131({
1125
+ ...$64fa3d84918910a7$export$ef03459518577ad4(props),
1126
+ label,
1127
+ validationBehavior: (_props_validationBehavior = props.validationBehavior) !== null && _props_validationBehavior !== void 0 ? _props_validationBehavior : "native"
1128
+ }, state, inputRef);
1129
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, $3ada01a82feafb94$var$useChildren(props, state, props.forwardedRef, inputProps, inputRef, labelProps, labelRef, descriptionProps, errorMessageProps, validation), props.name && /* @__PURE__ */ React__default.createElement("input", {
1130
+ type: "hidden",
1131
+ name: props.name,
1132
+ value: isNaN(state.numberValue) ? "" : state.numberValue
1133
+ }));
1134
+ }
1135
+ function $3ada01a82feafb94$var$HexColorField(props) {
1136
+ var _props_validationBehavior;
1137
+ let state = $b335ada08155d9c0$export$d52a01683abdfcd6({
1138
+ ...props,
1139
+ validationBehavior: (_props_validationBehavior = props.validationBehavior) !== null && _props_validationBehavior !== void 0 ? _props_validationBehavior : "native"
1140
+ });
1141
+ let inputRef = useRef(null);
1142
+ let [labelRef, label] = $64fa3d84918910a7$export$9d4c57ee4c6ffdd8();
1143
+ var _props_validationBehavior1;
1144
+ let { labelProps, inputProps, descriptionProps, errorMessageProps, ...validation } = $f6896b05b2ecad12$export$77e32ca575a28fdf({
1145
+ ...$64fa3d84918910a7$export$ef03459518577ad4(props),
1146
+ label,
1147
+ validationBehavior: (_props_validationBehavior1 = props.validationBehavior) !== null && _props_validationBehavior1 !== void 0 ? _props_validationBehavior1 : "native"
1148
+ }, state, inputRef);
1149
+ return $3ada01a82feafb94$var$useChildren(props, state, props.forwardedRef, inputProps, inputRef, labelProps, labelRef, descriptionProps, errorMessageProps, validation);
1150
+ }
1151
+ function $3ada01a82feafb94$var$useChildren(props, state, ref, inputProps, inputRef, labelProps, labelRef, descriptionProps, errorMessageProps, validation) {
1152
+ let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
1153
+ ...props,
1154
+ values: {
1155
+ state,
1156
+ channel: props.channel || "hex",
1157
+ isDisabled: props.isDisabled || false,
1158
+ isInvalid: validation.isInvalid || false
1159
+ },
1160
+ defaultClassName: "react-aria-ColorField"
1161
+ });
1162
+ let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props);
1163
+ delete DOMProps.id;
1164
+ return /* @__PURE__ */ React__default.createElement($64fa3d84918910a7$export$2881499e37b75b9a, {
1165
+ values: [
1166
+ [
1167
+ $3ada01a82feafb94$export$96b6d32b05a1a8ed,
1168
+ state
1169
+ ],
1170
+ [
1171
+ $3985021b0ad6602f$export$37fb8590cf2c088c,
1172
+ {
1173
+ ...inputProps,
1174
+ ref: inputRef
1175
+ }
1176
+ ],
1177
+ [
1178
+ $01b77f81d0f07f68$export$75b6ee27786ba447,
1179
+ {
1180
+ ...labelProps,
1181
+ ref: labelRef
1182
+ }
1183
+ ],
1184
+ [
1185
+ $514c0188e459b4c0$export$9afb8bc826b033ea,
1186
+ {
1187
+ slots: {
1188
+ description: descriptionProps,
1189
+ errorMessage: errorMessageProps
1190
+ }
1191
+ }
1192
+ ],
1193
+ [
1194
+ $ee014567cb39d3f0$export$ff05c3ac10437e03,
1195
+ validation
1196
+ ]
1197
+ ]
1198
+ }, /* @__PURE__ */ React__default.createElement("div", {
1199
+ ...DOMProps,
1200
+ ...renderProps,
1201
+ ref,
1202
+ slot: props.slot || void 0,
1203
+ "data-channel": props.channel || "hex",
1204
+ "data-disabled": props.isDisabled || void 0,
1205
+ "data-invalid": validation.isInvalid || void 0
1206
+ }));
1207
+ }
1208
+ const $1cca5300a3c2e7f9$export$c7fad7ea00194428 = /* @__PURE__ */ createContext(null);
1209
+ function $1cca5300a3c2e7f9$var$ColorSlider(props, ref) {
1210
+ [props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $4e85f108e88277b8$export$717b2c0a523a0b53);
1211
+ let { locale } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
1212
+ let state = $25a25ac0d1624665$export$57bc203e1c9c6d44({
1213
+ ...props,
1214
+ locale
1215
+ });
1216
+ let trackRef = React__default.useRef(null);
1217
+ let inputRef = React__default.useRef(null);
1218
+ let [labelRef, label] = $64fa3d84918910a7$export$9d4c57ee4c6ffdd8();
1219
+ let { trackProps, thumbProps, inputProps, labelProps, outputProps } = $40af666d6c251e36$export$106b7a4e66508f66({
1220
+ ...props,
1221
+ label,
1222
+ trackRef,
1223
+ inputRef
1224
+ }, state);
1225
+ let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
1226
+ ...props,
1227
+ values: {
1228
+ orientation: state.orientation,
1229
+ isDisabled: state.isDisabled,
1230
+ state
1231
+ },
1232
+ defaultClassName: "react-aria-ColorSlider"
1233
+ });
1234
+ let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props);
1235
+ delete DOMProps.id;
1236
+ return /* @__PURE__ */ React__default.createElement($64fa3d84918910a7$export$2881499e37b75b9a, {
1237
+ values: [
1238
+ [
1239
+ $1cca5300a3c2e7f9$export$c7fad7ea00194428,
1240
+ state
1241
+ ],
1242
+ [
1243
+ $6f909507e6374d18$export$1e7083018727fa60,
1244
+ state
1245
+ ],
1246
+ [
1247
+ $6f909507e6374d18$export$f1fce0420cc6d8ee,
1248
+ {
1249
+ ...trackProps,
1250
+ ref: trackRef
1251
+ }
1252
+ ],
1253
+ [
1254
+ $6f909507e6374d18$export$6189c2744041d8f8,
1255
+ outputProps
1256
+ ],
1257
+ [
1258
+ $01b77f81d0f07f68$export$75b6ee27786ba447,
1259
+ {
1260
+ ...labelProps,
1261
+ ref: labelRef,
1262
+ children: state.value.getChannelName(props.channel, locale)
1263
+ }
1264
+ ],
1265
+ [
1266
+ $e2b71ec1d6016406$export$c80c0ea2ca5cb846,
1267
+ {
1268
+ state,
1269
+ thumbProps,
1270
+ inputXRef: inputRef,
1271
+ xInputProps: inputProps,
1272
+ isDisabled: props.isDisabled
1273
+ }
1274
+ ]
1275
+ ]
1276
+ }, /* @__PURE__ */ React__default.createElement("div", {
1277
+ ...DOMProps,
1278
+ ...renderProps,
1279
+ ref,
1280
+ slot: props.slot || void 0,
1281
+ "data-orientation": state.orientation,
1282
+ "data-disabled": state.isDisabled || void 0
1283
+ }));
1284
+ }
1285
+ const $1cca5300a3c2e7f9$export$44fd664bcca5b6fb = /* @__PURE__ */ forwardRef($1cca5300a3c2e7f9$var$ColorSlider);
1286
+ /**
1287
+ * A solid color picker.
1288
+ *
1289
+ * @component
1290
+ * @param {Object} props - Component props.
1291
+ * @param {import('react-aria-components').Color} props.value - The color value. Hex format is preferred, but HSL, HSB, and RGB are also supported.
1292
+ * @param {Function} props.onChange - The change handler.
1293
+ * @param {boolean} [props.disabled] - Whether the color picker is disabled.
1294
+ * @param {Function} [props.onChangeEnd] - The change end handler.
1295
+ * @param {boolean} [props.allowTransparency=false] - Whether the color picker allows transparency.
1296
+ * @param {import('react-aria-components').ColorFormat} [props.outputFormat] - The output format. Default is 'hex' (or 'hexa' if `allowTransparency` is true).
1297
+ *
1298
+ * @returns {JSX.Element} The ButtonGroup component.
1299
+ *
1300
+ * @example
1301
+ * <ButtonGroup
1302
+ *
1303
+ * @preserve
1304
+ */
1305
+ const SolidColorPicker = (props) => {
1306
+ const {
1307
+ value: rawValue,
1308
+ onChange,
1309
+ disabled,
1310
+ onChangeEnd,
1311
+ allowTransparency = false,
1312
+ outputFormat
1313
+ } = props;
1314
+ const value = rawValue == null ? void 0 : rawValue.replace("transparent", "rgba(0, 0, 0, 0)");
1315
+ const defaultColor = $799cddbef784668f$export$6e865ea70d7724f("#00000000").toFormat(allowTransparency ? "hsla" : "hsl");
1316
+ const modifiedValue = value && (value == null ? void 0 : value.length) > 1 ? $799cddbef784668f$export$6e865ea70d7724f(value) : defaultColor;
1317
+ const [color, setColor] = useState(modifiedValue.toFormat(allowTransparency ? "hsla" : "hsl"));
1318
+ let handleChangeEnd;
1319
+ if (onChangeEnd) {
1320
+ handleChangeEnd = (color2) => {
1321
+ setColor(color2 ?? defaultColor);
1322
+ onChange(color2 == null ? void 0 : color2.toString(outputFormat ?? (allowTransparency ? "hexa" : "hex")));
1323
+ };
1324
+ }
1325
+ let handleChange = (color2) => {
1326
+ setColor(color2 ?? defaultColor);
1327
+ onChange(color2 == null ? void 0 : color2.toString(outputFormat ?? (allowTransparency ? "hexa" : "hex")));
1328
+ };
1329
+ const valueInputClassName = classnames(
1330
+ "es-uic-h-8 es-uic-w-12 es-uic-rounded-md es-uic-border es-uic-border-gray-300 es-uic-p-2 es-uic-tabular-nums es-uic-text-sm es-uic-shadow-sm es-uic-transition es-uic-text-right selection:es-uic-bg-teal-500/20 selection:es-uic-text-teal-950",
1331
+ "focus:es-uic-outline-none focus-visible:es-uic-outline-none focus-visible:es-uic-ring focus-visible:es-uic-ring-teal-500 focus-visible:es-uic-ring-opacity-50"
1332
+ );
1333
+ return /* @__PURE__ */ jsxs("div", { className: "es-uic-flex es-uic-flex-col es-uic-items-center es-uic-gap-2", children: [
1334
+ /* @__PURE__ */ jsx(
1335
+ $0de070065d44825d$export$b2103f68a961418e,
1336
+ {
1337
+ value: color,
1338
+ xChannel: "saturation",
1339
+ yChannel: "lightness",
1340
+ className: classnames(
1341
+ "es-uic-size-48 es-uic-rounded-md es-uic-border es-uic-border-gray-300 es-uic-shadow-sm es-uic-transition",
1342
+ '[&:has(>_[data-focus-visible="true"])]:es-uic-ring [&:has(>_[data-focus-visible="true"])]:es-uic-ring-teal-500 [&:has(>_[data-focus-visible="true"])]:es-uic-ring-opacity-50',
1343
+ "disabled:!es-uic-bg-gradient-to-r disabled:es-uic-from-white disabled:es-uic-to-gray-100"
1344
+ ),
1345
+ onChange: handleChange,
1346
+ onChangeEnd: handleChangeEnd,
1347
+ isDisabled: disabled,
1348
+ children: /* @__PURE__ */ jsx(
1349
+ $e2b71ec1d6016406$export$a3cc47cee1c1ccc,
1350
+ {
1351
+ className: classnames(
1352
+ "es-uic-size-5 es-uic-rounded-full es-uic-border es-uic-border-white es-uic-shadow-[0_0_0_1px_black] es-uic-transition",
1353
+ "dragging:!-es-uic-translate-x-1/2 dragging:!-es-uic-translate-y-1/2 dragging:!es-uic-scale-110",
1354
+ "focus-visible:!-es-uic-translate-x-1/2 focus-visible:!-es-uic-translate-y-1/2 focus-visible:!es-uic-scale-125",
1355
+ "disabled:es-uic-invisible"
1356
+ )
1357
+ }
1358
+ )
1359
+ }
1360
+ ),
1361
+ /* @__PURE__ */ jsx(
1362
+ $1cca5300a3c2e7f9$export$44fd664bcca5b6fb,
1363
+ {
1364
+ channel: "hue",
1365
+ value: color,
1366
+ onChange: handleChange,
1367
+ isDisabled: disabled,
1368
+ children: /* @__PURE__ */ jsx(
1369
+ $6f909507e6374d18$export$105594979f116971,
1370
+ {
1371
+ className: classnames(
1372
+ "es-uic-h-7 es-uic-w-48 es-uic-rounded-md es-uic-border es-uic-border-gray-300 es-uic-shadow-sm",
1373
+ '[&:has(>_[data-focus-visible="true"])]:es-uic-ring [&:has(>_[data-focus-visible="true"])]:es-uic-ring-teal-500 [&:has(>_[data-focus-visible="true"])]:es-uic-ring-opacity-50',
1374
+ "disabled:!es-uic-bg-gradient-to-r disabled:es-uic-from-white disabled:es-uic-to-gray-100"
1375
+ ),
1376
+ children: /* @__PURE__ */ jsx(
1377
+ $e2b71ec1d6016406$export$a3cc47cee1c1ccc,
1378
+ {
1379
+ className: classnames(
1380
+ "es-uic-top-3.25",
1381
+ "es-uic-size-5 es-uic-rounded-full es-uic-border es-uic-border-white es-uic-shadow-[0_0_0_1px_black] es-uic-transition",
1382
+ "dragging:!-es-uic-translate-x-1/2 dragging:!-es-uic-translate-y-1/2 dragging:!es-uic-scale-110",
1383
+ "focus-visible:!-es-uic-translate-x-1/2 focus-visible:!-es-uic-translate-y-1/2 focus-visible:!es-uic-scale-125",
1384
+ "disabled:es-uic-invisible"
1385
+ )
1386
+ }
1387
+ )
1388
+ }
1389
+ )
1390
+ }
1391
+ ),
1392
+ allowTransparency && /* @__PURE__ */ jsx(
1393
+ $1cca5300a3c2e7f9$export$44fd664bcca5b6fb,
1394
+ {
1395
+ channel: "alpha",
1396
+ value: color,
1397
+ onChange: handleChange,
1398
+ isDisabled: disabled,
1399
+ children: /* @__PURE__ */ jsx(
1400
+ $6f909507e6374d18$export$105594979f116971,
1401
+ {
1402
+ className: classnames(
1403
+ "es-uic-h-7 es-uic-w-48 es-uic-rounded-md es-uic-border es-uic-border-gray-300 es-uic-shadow-sm",
1404
+ '[&:has(>_[data-focus-visible="true"])]:es-uic-ring [&:has(>_[data-focus-visible="true"])]:es-uic-ring-teal-500 [&:has(>_[data-focus-visible="true"])]:es-uic-ring-opacity-50',
1405
+ "disabled:!es-uic-bg-gradient-to-r disabled:es-uic-from-white disabled:es-uic-to-gray-100"
1406
+ ),
1407
+ style: () => {
1408
+ const startColor = color.clone().withChannelValue("alpha", 0).toString("hsla");
1409
+ const endColor = color.clone().withChannelValue("alpha", 1).toString("hsla");
1410
+ return {
1411
+ background: `linear-gradient(to right, ${startColor}, ${endColor}), repeating-conic-gradient(rgb(204, 204, 204) 0%, rgb(204, 204, 204) 25%, white 0%, white 50%) 50% center / 14px 14px`
1412
+ };
1413
+ },
1414
+ children: /* @__PURE__ */ jsx(
1415
+ $e2b71ec1d6016406$export$a3cc47cee1c1ccc,
1416
+ {
1417
+ className: classnames(
1418
+ "es-uic-top-3.25",
1419
+ "es-uic-size-5 es-uic-rounded-full es-uic-border es-uic-border-white es-uic-shadow-[0_0_0_1px_black] es-uic-transition",
1420
+ "dragging:!-es-uic-translate-x-1/2 dragging:!-es-uic-translate-y-1/2 dragging:!es-uic-scale-110",
1421
+ "focus-visible:!-es-uic-translate-x-1/2 focus-visible:!-es-uic-translate-y-1/2 focus-visible:!es-uic-scale-125",
1422
+ "disabled:es-uic-invisible"
1423
+ )
1424
+ }
1425
+ )
1426
+ }
1427
+ )
1428
+ }
1429
+ ),
1430
+ /* @__PURE__ */ jsxs("div", { className: "es-uic-flex es-uic-items-center es-uic-justify-center es-uic-gap-2", children: [
1431
+ /* @__PURE__ */ jsx(
1432
+ $3ada01a82feafb94$export$b865d4358897bb17,
1433
+ {
1434
+ value: color,
1435
+ onChange: (color2) => handleChange(color2 == null ? void 0 : color2.toFormat("hsl")),
1436
+ "aria-label": __("Hex color value", "eightshift-ui-components"),
1437
+ isDisabled: disabled,
1438
+ children: /* @__PURE__ */ jsx(
1439
+ $3985021b0ad6602f$export$f5b8910cec6cf069,
1440
+ {
1441
+ className: classnames(
1442
+ "es-uic-h-9 es-uic-w-20 es-uic-rounded-md es-uic-border es-uic-border-gray-300 es-uic-p-2 es-uic-tabular-nums es-uic-text-sm es-uic-shadow-sm es-uic-transition",
1443
+ "focus:es-uic-outline-none focus-visible:es-uic-outline-none focus-visible:es-uic-ring focus-visible:es-uic-ring-teal-500 focus-visible:es-uic-ring-opacity-50"
1444
+ )
1445
+ }
1446
+ )
1447
+ }
1448
+ ),
1449
+ /* @__PURE__ */ jsxs(
1450
+ TriggeredPopover,
1451
+ {
1452
+ triggerButtonIcon: icons.options,
1453
+ className: "es-uic-w-48 es-uic-space-y-1 es-uic-p-2",
1454
+ triggerButtonProps: {
1455
+ disabled,
1456
+ tooltip: __("Advanced color options", "eightshift-ui-components")
1457
+ },
1458
+ children: [
1459
+ /* @__PURE__ */ jsx($01b77f81d0f07f68$export$b04be29aa201d4f5, { className: "es-uic-text-sm", children: __("Advanced color options", "eightshift-ui-components") }),
1460
+ /* @__PURE__ */ jsx(
1461
+ Spacer,
1462
+ {
1463
+ border: true,
1464
+ text: "RGB"
1465
+ }
1466
+ ),
1467
+ /* @__PURE__ */ jsx(
1468
+ $3ada01a82feafb94$export$b865d4358897bb17,
1469
+ {
1470
+ value: color == null ? void 0 : color.toFormat(allowTransparency ? "rgba" : "rgb"),
1471
+ onChange: (color2) => handleChange(color2 == null ? void 0 : color2.toFormat("hsl")),
1472
+ channel: "red",
1473
+ children: /* @__PURE__ */ jsx(
1474
+ BaseControl,
1475
+ {
1476
+ label: __("Red", "eightshift-ui-components"),
1477
+ inline: true,
1478
+ children: /* @__PURE__ */ jsx($3985021b0ad6602f$export$f5b8910cec6cf069, { className: valueInputClassName })
1479
+ }
1480
+ )
1481
+ }
1482
+ ),
1483
+ /* @__PURE__ */ jsx(
1484
+ $3ada01a82feafb94$export$b865d4358897bb17,
1485
+ {
1486
+ value: color == null ? void 0 : color.toFormat(allowTransparency ? "rgba" : "rgb"),
1487
+ onChange: (color2) => handleChange(color2 == null ? void 0 : color2.toFormat("hsl")),
1488
+ channel: "green",
1489
+ children: /* @__PURE__ */ jsx(
1490
+ BaseControl,
1491
+ {
1492
+ label: __("Green", "eightshift-ui-components"),
1493
+ inline: true,
1494
+ children: /* @__PURE__ */ jsx($3985021b0ad6602f$export$f5b8910cec6cf069, { className: valueInputClassName })
1495
+ }
1496
+ )
1497
+ }
1498
+ ),
1499
+ /* @__PURE__ */ jsx(
1500
+ $3ada01a82feafb94$export$b865d4358897bb17,
1501
+ {
1502
+ value: color == null ? void 0 : color.toFormat(allowTransparency ? "rgba" : "rgb"),
1503
+ onChange: (color2) => handleChange(color2 == null ? void 0 : color2.toFormat("hsl")),
1504
+ channel: "blue",
1505
+ children: /* @__PURE__ */ jsx(
1506
+ BaseControl,
1507
+ {
1508
+ label: __("Blue", "eightshift-ui-components"),
1509
+ inline: true,
1510
+ children: /* @__PURE__ */ jsx($3985021b0ad6602f$export$f5b8910cec6cf069, { className: valueInputClassName })
1511
+ }
1512
+ )
1513
+ }
1514
+ ),
1515
+ /* @__PURE__ */ jsx(
1516
+ Spacer,
1517
+ {
1518
+ border: true,
1519
+ text: "HSL"
1520
+ }
1521
+ ),
1522
+ /* @__PURE__ */ jsx(
1523
+ $3ada01a82feafb94$export$b865d4358897bb17,
1524
+ {
1525
+ value: color == null ? void 0 : color.toFormat(allowTransparency ? "hsla" : "hsl"),
1526
+ onChange: (color2) => handleChange(color2 == null ? void 0 : color2.toFormat("hsl")),
1527
+ channel: "hue",
1528
+ children: /* @__PURE__ */ jsx(
1529
+ BaseControl,
1530
+ {
1531
+ label: __("Hue", "eightshift-ui-components"),
1532
+ inline: true,
1533
+ children: /* @__PURE__ */ jsx($3985021b0ad6602f$export$f5b8910cec6cf069, { className: valueInputClassName })
1534
+ }
1535
+ )
1536
+ }
1537
+ ),
1538
+ /* @__PURE__ */ jsx(
1539
+ $3ada01a82feafb94$export$b865d4358897bb17,
1540
+ {
1541
+ value: color == null ? void 0 : color.toFormat(allowTransparency ? "hsla" : "hsl"),
1542
+ onChange: (color2) => handleChange(color2 == null ? void 0 : color2.toFormat("hsl")),
1543
+ channel: "saturation",
1544
+ children: /* @__PURE__ */ jsx(
1545
+ BaseControl,
1546
+ {
1547
+ label: __("Saturation", "eightshift-ui-components"),
1548
+ inline: true,
1549
+ children: /* @__PURE__ */ jsx($3985021b0ad6602f$export$f5b8910cec6cf069, { className: valueInputClassName })
1550
+ }
1551
+ )
1552
+ }
1553
+ ),
1554
+ /* @__PURE__ */ jsx(
1555
+ $3ada01a82feafb94$export$b865d4358897bb17,
1556
+ {
1557
+ value: color == null ? void 0 : color.toFormat(allowTransparency ? "hsla" : "hsl"),
1558
+ onChange: (color2) => handleChange(color2 == null ? void 0 : color2.toFormat("hsl")),
1559
+ channel: "lightness",
1560
+ children: /* @__PURE__ */ jsx(
1561
+ BaseControl,
1562
+ {
1563
+ label: __("Lightness", "eightshift-ui-components"),
1564
+ inline: true,
1565
+ children: /* @__PURE__ */ jsx($3985021b0ad6602f$export$f5b8910cec6cf069, { className: valueInputClassName })
1566
+ }
1567
+ )
1568
+ }
1569
+ ),
1570
+ /* @__PURE__ */ jsx(
1571
+ Spacer,
1572
+ {
1573
+ border: true,
1574
+ text: "HSB"
1575
+ }
1576
+ ),
1577
+ /* @__PURE__ */ jsx(
1578
+ $3ada01a82feafb94$export$b865d4358897bb17,
1579
+ {
1580
+ value: color == null ? void 0 : color.toFormat(allowTransparency ? "hsba" : "hsb"),
1581
+ onChange: (color2) => handleChange(color2 == null ? void 0 : color2.toFormat("hsl")),
1582
+ channel: "hue",
1583
+ children: /* @__PURE__ */ jsx(
1584
+ BaseControl,
1585
+ {
1586
+ label: __("Hue", "eightshift-ui-components"),
1587
+ inline: true,
1588
+ children: /* @__PURE__ */ jsx($3985021b0ad6602f$export$f5b8910cec6cf069, { className: valueInputClassName })
1589
+ }
1590
+ )
1591
+ }
1592
+ ),
1593
+ /* @__PURE__ */ jsx(
1594
+ $3ada01a82feafb94$export$b865d4358897bb17,
1595
+ {
1596
+ value: color == null ? void 0 : color.toFormat(allowTransparency ? "hsba" : "hsb"),
1597
+ onChange: (color2) => handleChange(color2 == null ? void 0 : color2.toFormat("hsl")),
1598
+ channel: "saturation",
1599
+ children: /* @__PURE__ */ jsx(
1600
+ BaseControl,
1601
+ {
1602
+ label: __("Saturation", "eightshift-ui-components"),
1603
+ inline: true,
1604
+ children: /* @__PURE__ */ jsx($3985021b0ad6602f$export$f5b8910cec6cf069, { className: valueInputClassName })
1605
+ }
1606
+ )
1607
+ }
1608
+ ),
1609
+ /* @__PURE__ */ jsx(
1610
+ $3ada01a82feafb94$export$b865d4358897bb17,
1611
+ {
1612
+ value: color == null ? void 0 : color.toFormat(allowTransparency ? "hsba" : "hsb"),
1613
+ onChange: (color2) => handleChange(color2 == null ? void 0 : color2.toFormat("hsl")),
1614
+ channel: "brightness",
1615
+ children: /* @__PURE__ */ jsx(
1616
+ BaseControl,
1617
+ {
1618
+ label: __("Brightness", "eightshift-ui-components"),
1619
+ inline: true,
1620
+ children: /* @__PURE__ */ jsx($3985021b0ad6602f$export$f5b8910cec6cf069, { className: valueInputClassName })
1621
+ }
1622
+ )
1623
+ }
1624
+ )
1625
+ ]
1626
+ }
1627
+ )
1628
+ ] })
1629
+ ] });
1630
+ };
1631
+ export {
1632
+ SolidColorPicker
1633
+ };