ropav 0.0.8 → 0.0.10

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 (232) hide show
  1. package/dist/accordion.css +10 -10
  2. package/dist/accordion.js +2 -2
  3. package/dist/alert.css +109 -0
  4. package/dist/alert.js +168 -0
  5. package/dist/aspect-ratio.css +17 -0
  6. package/dist/aspect-ratio.js +26 -0
  7. package/dist/avatar.css +97 -0
  8. package/dist/avatar.js +161 -0
  9. package/dist/badge.css +40 -115
  10. package/dist/badge.js +19 -16
  11. package/dist/base.css +609 -180
  12. package/dist/button-link.css +161 -0
  13. package/dist/button-link.js +108 -0
  14. package/dist/button.css +50 -229
  15. package/dist/button.js +7 -9
  16. package/dist/card.css +12 -12
  17. package/dist/check.js +12 -0
  18. package/dist/checkbox.css +16 -57
  19. package/dist/checkbox.js +14 -31
  20. package/dist/collapse.css +2 -2
  21. package/dist/collapse.js +1 -1
  22. package/dist/color-input.css +108 -0
  23. package/dist/color-input.js +349 -0
  24. package/dist/color-picker.css +304 -0
  25. package/dist/color-picker.js +797 -0
  26. package/dist/color-picker2.js +18 -0
  27. package/dist/color-swatch.css +50 -0
  28. package/dist/color-swatch.js +73 -0
  29. package/dist/color.js +190 -0
  30. package/dist/componentColors.js +206 -13
  31. package/dist/components/accordion/accordion-item.d.ts +4 -4
  32. package/dist/components/accordion/accordion.d.ts +1 -1
  33. package/dist/components/accordion/index.d.ts +4 -4
  34. package/dist/components/accordion/types.d.ts +1 -1
  35. package/dist/components/accordion/useAccordion.d.ts +1 -1
  36. package/dist/components/alert/alert.d.ts +30 -0
  37. package/dist/components/alert/index.d.ts +3 -0
  38. package/dist/components/alert/index.js +2 -0
  39. package/dist/components/alert/types.d.ts +20 -0
  40. package/dist/components/alert/useAlertColor.d.ts +3 -0
  41. package/dist/components/aspect-ratio/aspect-ratio.d.ts +21 -0
  42. package/dist/components/aspect-ratio/index.d.ts +2 -0
  43. package/dist/components/aspect-ratio/index.js +2 -0
  44. package/dist/components/aspect-ratio/types.d.ts +3 -0
  45. package/dist/components/avatar/avatar.d.ts +24 -0
  46. package/dist/components/avatar/index.d.ts +3 -0
  47. package/dist/components/avatar/index.js +2 -0
  48. package/dist/components/avatar/types.d.ts +20 -0
  49. package/dist/components/avatar/useAvatarColor.d.ts +3 -0
  50. package/dist/components/badge/badge.d.ts +1 -1
  51. package/dist/components/badge/index.d.ts +3 -3
  52. package/dist/components/badge/types.d.ts +3 -2
  53. package/dist/components/badge/useBadgeColor.d.ts +3 -8
  54. package/dist/components/button/button.d.ts +1 -1
  55. package/dist/components/button/index.d.ts +2 -2
  56. package/dist/components/button/types.d.ts +2 -1
  57. package/dist/components/button/useButtonColor.d.ts +3 -13
  58. package/dist/components/button-group/button-group.d.ts +1 -1
  59. package/dist/components/button-group/index.d.ts +2 -2
  60. package/dist/components/button-link/button-link.d.ts +27 -0
  61. package/dist/components/button-link/index.d.ts +2 -0
  62. package/dist/components/button-link/index.js +2 -0
  63. package/dist/components/button-link/types.d.ts +20 -0
  64. package/dist/components/card/card.d.ts +1 -1
  65. package/dist/components/card/index.d.ts +2 -2
  66. package/dist/components/checkbox/checkbox.d.ts +1 -1
  67. package/dist/components/checkbox/index.d.ts +2 -2
  68. package/dist/components/checkbox/types.d.ts +2 -1
  69. package/dist/components/checkbox/useCheckbox.d.ts +4 -6
  70. package/dist/components/collapse/collapse.d.ts +2 -2
  71. package/dist/components/collapse/index.d.ts +3 -3
  72. package/dist/components/collapse/useCollapse.d.ts +1 -1
  73. package/dist/components/color-input/color-input.d.ts +29 -0
  74. package/dist/components/color-input/index.d.ts +2 -0
  75. package/dist/components/color-input/index.js +2 -0
  76. package/dist/components/color-input/types.d.ts +35 -0
  77. package/dist/components/color-input/useColorInput.d.ts +27 -0
  78. package/dist/components/color-input/useColorInputEyeDropper.d.ts +13 -0
  79. package/dist/components/color-input/useColorInputPopover.d.ts +11 -0
  80. package/dist/components/color-input/useColorInputValue.d.ts +8 -0
  81. package/dist/components/color-picker/color-picker-saturation.d.ts +21 -0
  82. package/dist/components/color-picker/color-picker-slider.d.ts +21 -0
  83. package/dist/components/color-picker/color-picker-utils.d.ts +23 -0
  84. package/dist/components/color-picker/color-picker.d.ts +23 -0
  85. package/dist/components/color-picker/index.d.ts +3 -0
  86. package/dist/components/color-picker/index.js +3 -0
  87. package/dist/components/color-picker/types.d.ts +39 -0
  88. package/dist/components/color-picker/useColorPickerDrag.d.ts +16 -0
  89. package/dist/components/color-picker/useColorPickerSwatches.d.ts +21 -0
  90. package/dist/components/color-picker/useColorPickerValue.d.ts +15 -0
  91. package/dist/components/color-swatch/color-swatch.d.ts +21 -0
  92. package/dist/components/color-swatch/index.d.ts +2 -0
  93. package/dist/components/color-swatch/index.js +2 -0
  94. package/dist/components/color-swatch/types.d.ts +6 -0
  95. package/dist/components/color-swatch/useColorSwatchColor.d.ts +5 -0
  96. package/dist/components/dropdown-menu/dropdown-menu-items.d.ts +15 -6
  97. package/dist/components/dropdown-menu/dropdown-menu-utils.d.ts +1 -1
  98. package/dist/components/dropdown-menu/dropdown-menu.d.ts +3 -3
  99. package/dist/components/dropdown-menu/index.d.ts +3 -3
  100. package/dist/components/dropdown-menu/useDropdownMenu.d.ts +11 -10
  101. package/dist/components/dropdown-menu/useDropdownMenuDisclosure.d.ts +2 -2
  102. package/dist/components/dropdown-menu/useDropdownMenuDom.d.ts +2 -2
  103. package/dist/components/dropdown-menu/useDropdownMenuHoverIntent.d.ts +2 -2
  104. package/dist/components/dropdown-menu/useDropdownMenuInteractions.d.ts +2 -2
  105. package/dist/components/dropdown-menu/useDropdownMenuNavigation.d.ts +3 -3
  106. package/dist/components/dropdown-menu/useDropdownMenuRenderItems.d.ts +12 -4
  107. package/dist/components/dropdown-menu/useDropdownSubmenus.d.ts +3 -3
  108. package/dist/components/field/field.d.ts +2 -2
  109. package/dist/components/field/index.d.ts +2 -2
  110. package/dist/components/field/types.d.ts +0 -2
  111. package/dist/components/field/useField.d.ts +1 -3
  112. package/dist/components/icon-button/icon-button.d.ts +1 -1
  113. package/dist/components/icon-button/index.d.ts +2 -2
  114. package/dist/components/icon-button/types.d.ts +2 -1
  115. package/dist/components/input/index.d.ts +2 -2
  116. package/dist/components/input/input.d.ts +1 -1
  117. package/dist/components/input/types.d.ts +3 -0
  118. package/dist/components/input/useInput.d.ts +2 -2
  119. package/dist/components/modal/index.d.ts +2 -2
  120. package/dist/components/modal/modal.d.ts +1 -1
  121. package/dist/components/modal/types.d.ts +1 -1
  122. package/dist/components/modal/useModal.d.ts +1 -1
  123. package/dist/components/number-input/index.d.ts +2 -0
  124. package/dist/components/number-input/index.js +2 -0
  125. package/dist/components/number-input/number-input.d.ts +29 -0
  126. package/dist/components/number-input/types.d.ts +34 -0
  127. package/dist/components/number-input/useNumberInput.d.ts +31 -0
  128. package/dist/components/overlay/index.d.ts +2 -2
  129. package/dist/components/overlay/overlay.d.ts +1 -1
  130. package/dist/components/overlay/useOverlay.d.ts +1 -1
  131. package/dist/components/popover/index.d.ts +3 -2
  132. package/dist/components/popover/index.js +2 -1
  133. package/dist/components/popover/popover.d.ts +2 -2
  134. package/dist/components/popover/types.d.ts +3 -1
  135. package/dist/components/popover/usePopover.d.ts +2 -1
  136. package/dist/components/progress/index.d.ts +3 -3
  137. package/dist/components/progress/progress.d.ts +1 -1
  138. package/dist/components/progress/types.d.ts +2 -2
  139. package/dist/components/progress/useProgress.d.ts +2 -2
  140. package/dist/components/radio/index.d.ts +3 -3
  141. package/dist/components/radio/radio-group.d.ts +1 -1
  142. package/dist/components/radio/radio.d.ts +1 -1
  143. package/dist/components/radio/types.d.ts +4 -1
  144. package/dist/components/radio/useRadio.d.ts +4 -6
  145. package/dist/components/select/index.d.ts +2 -2
  146. package/dist/components/select/select.d.ts +1 -1
  147. package/dist/components/select/types.d.ts +3 -0
  148. package/dist/components/select/useSelect.d.ts +2 -2
  149. package/dist/components/slider/index.d.ts +4 -3
  150. package/dist/components/slider/index.js +2 -2
  151. package/dist/components/slider/range-slider-tooltip.d.ts +34 -0
  152. package/dist/components/slider/range-slider.d.ts +37 -0
  153. package/dist/components/slider/slider.d.ts +1 -1
  154. package/dist/components/slider/sliderCore.d.ts +35 -0
  155. package/dist/components/slider/types.d.ts +15 -6
  156. package/dist/components/slider/useRangeSlider.d.ts +57 -0
  157. package/dist/components/slider/useRangeSliderPointer.d.ts +19 -0
  158. package/dist/components/slider/useRangeSliderTooltipCollision.d.ts +36 -0
  159. package/dist/components/slider/useRangeSliderTooltipState.d.ts +23 -0
  160. package/dist/components/slider/useSlider.d.ts +11 -15
  161. package/dist/components/switch/index.d.ts +2 -2
  162. package/dist/components/switch/switch.d.ts +1 -1
  163. package/dist/components/switch/types.d.ts +1 -1
  164. package/dist/components/switch/useSwitch.d.ts +4 -5
  165. package/dist/components/tabs/index.d.ts +6 -6
  166. package/dist/components/tabs/tabs-content.d.ts +2 -2
  167. package/dist/components/tabs/tabs-list.d.ts +4 -4
  168. package/dist/components/tabs/tabs-trigger.d.ts +5 -5
  169. package/dist/components/tabs/tabs.d.ts +5 -5
  170. package/dist/components/tabs/useTabs.d.ts +1 -1
  171. package/dist/components/textarea/index.d.ts +2 -2
  172. package/dist/components/textarea/textarea.d.ts +1 -1
  173. package/dist/components/textarea/useTextarea.d.ts +2 -2
  174. package/dist/components/toast/defaults.d.ts +7 -0
  175. package/dist/components/toast/index.d.ts +7 -0
  176. package/dist/components/toast/index.js +2 -0
  177. package/dist/components/toast/toast-provider.d.ts +21 -0
  178. package/dist/components/toast/toast-viewport.d.ts +34 -0
  179. package/dist/components/toast/toast.d.ts +31 -0
  180. package/dist/components/toast/types.d.ts +106 -0
  181. package/dist/components/toast/useToast.d.ts +4 -0
  182. package/dist/components/toast/useToastColor.d.ts +3 -0
  183. package/dist/components/toast/useToastState.d.ts +2 -0
  184. package/dist/components/tooltip/index.d.ts +2 -2
  185. package/dist/components/tooltip/tooltip.d.ts +2 -2
  186. package/dist/components/tooltip/types.d.ts +2 -1
  187. package/dist/components/tooltip/useTooltip.d.ts +3 -1
  188. package/dist/dropdown-menu.css +17 -17
  189. package/dist/dropdown-menu.js +160 -39
  190. package/dist/field.css +15 -18
  191. package/dist/field.js +17 -35
  192. package/dist/icon-button.css +57 -236
  193. package/dist/icon-button.js +5 -6
  194. package/dist/index.d.ts +31 -22
  195. package/dist/index.js +17 -4
  196. package/dist/input.css +40 -46
  197. package/dist/input.js +39 -21
  198. package/dist/minus.js +12 -0
  199. package/dist/modal.css +9 -9
  200. package/dist/modal.js +1 -1
  201. package/dist/number-input.css +86 -0
  202. package/dist/number-input.js +350 -0
  203. package/dist/overlay.css +5 -5
  204. package/dist/overlay.js +3 -3
  205. package/dist/popover.css +62 -29
  206. package/dist/popover.js +33 -19
  207. package/dist/popover2.js +17 -0
  208. package/dist/progress.css +9 -30
  209. package/dist/progress.js +3 -6
  210. package/dist/radio.css +34 -62
  211. package/dist/radio.js +28 -16
  212. package/dist/rafScheduler.js +34 -0
  213. package/dist/select.css +105 -61
  214. package/dist/select.js +12 -8
  215. package/dist/slider.css +719 -125
  216. package/dist/slider.js +1251 -149
  217. package/dist/switch.css +19 -44
  218. package/dist/switch.js +4 -5
  219. package/dist/tabs.css +36 -36
  220. package/dist/tabs.js +1 -1
  221. package/dist/textarea.css +33 -25
  222. package/dist/textarea.js +8 -2
  223. package/dist/toast.css +232 -0
  224. package/dist/toast.js +679 -0
  225. package/dist/tooltip.css +7 -35
  226. package/dist/tooltip.js +30 -18
  227. package/dist/useButtonColor.js +16 -14
  228. package/dist/utils/componentColors.d.ts +60 -0
  229. package/package.json +55 -15
  230. package/src/styles/_mixins.scss +25 -41
  231. package/src/styles/_tokens.scss +615 -182
  232. package/src/styles/_variables.scss +177 -49
@@ -0,0 +1,797 @@
1
+ import './color-picker.css';
2
+ import { t as bem } from "./bem.js";
3
+ import { t as parseCssColor } from "./color.js";
4
+ import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
5
+ import { t as check_default } from "./check.js";
6
+ import { t as color_swatch_default } from "./color-swatch.js";
7
+ import { child, computed, createComponent, createFor, createIf, createInvoker, createSlot, createTemplateRefSetter, defineVaporComponent, delegateEvents, extend, next, on, onBeforeUnmount, ref, renderEffect, setAttr, setClass, setDynamicProps, setInsertionState, setProp, setStyle, setValue, template, unref, useAttrs } from "vue";
8
+ function clamp(value, min, max) {
9
+ return Math.min(max, Math.max(min, value));
10
+ }
11
+ function clampPercent(value) {
12
+ return clamp(Number.isFinite(value) ? value : 0, 0, 100);
13
+ }
14
+ function normalizeHue(value) {
15
+ if (!Number.isFinite(value)) return 0;
16
+ return (value % 360 + 360) % 360;
17
+ }
18
+ function normalizeHueForColor(value) {
19
+ const hue = normalizeHue(value);
20
+ return hue === 359 ? 360 : hue;
21
+ }
22
+ function clampHue(value) {
23
+ return clamp(Number.isFinite(value) ? value : 0, 0, 359);
24
+ }
25
+ function clampOpacity(value) {
26
+ return clamp(Number.isFinite(value) ? value : 100, 0, 100);
27
+ }
28
+ function roundPercent(value) {
29
+ return Math.round(value * 100) / 100;
30
+ }
31
+ function isColorPickerAlphaFormat(format) {
32
+ return format === "hexa" || format === "rgba" || format === "hsla";
33
+ }
34
+ function parseColorPickerValue(value) {
35
+ const rgb = parseCssColor(value);
36
+ if (!rgb) return void 0;
37
+ return rgbToHsv(rgb);
38
+ }
39
+ function formatColorPickerValue(color, format) {
40
+ const rgb = hsvToRgb(color.hue, color.saturation, color.value);
41
+ const opacity = clampOpacity(color.opacity);
42
+ switch (format) {
43
+ case "hex": return `#${toHexChannel(rgb.red)}${toHexChannel(rgb.green)}${toHexChannel(rgb.blue)}`;
44
+ case "hexa": return `#${toHexChannel(rgb.red)}${toHexChannel(rgb.green)}${toHexChannel(rgb.blue)}${toHexChannel(Math.round(opacity / 100 * 255))}`;
45
+ case "rgb": return `rgb(${rgb.red}, ${rgb.green}, ${rgb.blue})`;
46
+ case "rgba": return `rgba(${rgb.red}, ${rgb.green}, ${rgb.blue}, ${formatAlpha(opacity)})`;
47
+ case "hsl": {
48
+ const hsl = rgbToHsl(rgb);
49
+ return `hsl(${formatNumber(hsl.hue)}, ${formatNumber(hsl.saturation)}%, ${formatNumber(hsl.lightness)}%)`;
50
+ }
51
+ case "hsla": {
52
+ const hsl = rgbToHsl(rgb);
53
+ return `hsla(${formatNumber(hsl.hue)}, ${formatNumber(hsl.saturation)}%, ${formatNumber(hsl.lightness)}%, ${formatAlpha(opacity)})`;
54
+ }
55
+ }
56
+ }
57
+ function getHsvCssColor(hue, saturation, value) {
58
+ const rgb = hsvToRgb(hue, saturation, value);
59
+ return `rgb(${rgb.red} ${rgb.green} ${rgb.blue})`;
60
+ }
61
+ function hsvToRgb(hue, saturation, value) {
62
+ const normalizedHue = normalizeHueForColor(hue);
63
+ const s = clampPercent(saturation) / 100;
64
+ const v = clampPercent(value) / 100;
65
+ const c = v * s;
66
+ const x = c * (1 - Math.abs(normalizedHue / 60 % 2 - 1));
67
+ const m = v - c;
68
+ let r = 0;
69
+ let g = 0;
70
+ let b = 0;
71
+ if (normalizedHue < 60) {
72
+ r = c;
73
+ g = x;
74
+ } else if (normalizedHue < 120) {
75
+ r = x;
76
+ g = c;
77
+ } else if (normalizedHue < 180) {
78
+ g = c;
79
+ b = x;
80
+ } else if (normalizedHue < 240) {
81
+ g = x;
82
+ b = c;
83
+ } else if (normalizedHue < 300) {
84
+ r = x;
85
+ b = c;
86
+ } else {
87
+ r = c;
88
+ b = x;
89
+ }
90
+ return {
91
+ red: Math.round((r + m) * 255),
92
+ green: Math.round((g + m) * 255),
93
+ blue: Math.round((b + m) * 255)
94
+ };
95
+ }
96
+ function rgbToHsv({ red, green, blue, opacity }) {
97
+ const r = red / 255;
98
+ const g = green / 255;
99
+ const b = blue / 255;
100
+ const max = Math.max(r, g, b);
101
+ const delta = max - Math.min(r, g, b);
102
+ let hue = 0;
103
+ if (delta) if (max === r) hue = 60 * ((g - b) / delta % 6);
104
+ else if (max === g) hue = 60 * ((b - r) / delta + 2);
105
+ else hue = 60 * ((r - g) / delta + 4);
106
+ return {
107
+ hue: normalizeHue(hue),
108
+ saturation: roundPercent(max === 0 ? 0 : delta / max * 100),
109
+ value: roundPercent(max * 100),
110
+ opacity: roundPercent(opacity)
111
+ };
112
+ }
113
+ function rgbToHsl({ red, green, blue }) {
114
+ const r = red / 255;
115
+ const g = green / 255;
116
+ const b = blue / 255;
117
+ const max = Math.max(r, g, b);
118
+ const min = Math.min(r, g, b);
119
+ const delta = max - min;
120
+ const lightness = (max + min) / 2;
121
+ if (!delta) return {
122
+ hue: 0,
123
+ saturation: 0,
124
+ lightness: roundPercent(lightness * 100)
125
+ };
126
+ let hue;
127
+ if (max === r) hue = 60 * ((g - b) / delta % 6);
128
+ else if (max === g) hue = 60 * ((b - r) / delta + 2);
129
+ else hue = 60 * ((r - g) / delta + 4);
130
+ const saturation = delta / (1 - Math.abs(2 * lightness - 1));
131
+ return {
132
+ hue: roundPercent(normalizeHue(hue)),
133
+ saturation: roundPercent(saturation * 100),
134
+ lightness: roundPercent(lightness * 100)
135
+ };
136
+ }
137
+ function toHexChannel(value) {
138
+ return clamp(value, 0, 255).toString(16).padStart(2, "0");
139
+ }
140
+ function formatAlpha(opacity) {
141
+ return formatNumber(clampOpacity(opacity) / 100);
142
+ }
143
+ function formatNumber(value) {
144
+ return String(Math.round(value * 100) / 100);
145
+ }
146
+ //#endregion
147
+ //#region src/components/color-picker/useColorPickerDrag.ts
148
+ function getPointerId(event) {
149
+ return Number.isFinite(event.pointerId) ? event.pointerId : void 0;
150
+ }
151
+ function useColorPickerDrag({ target, focusTarget, readonly, isGeometryValid, updateFromPointer }) {
152
+ let session;
153
+ let frameWindow = null;
154
+ let frameId;
155
+ let geometryDirty = false;
156
+ let pendingPointer;
157
+ function isCurrentPointer(event) {
158
+ const currentSession = session;
159
+ if (!currentSession) return false;
160
+ const pointerId = getPointerId(event);
161
+ return currentSession.pointerId === void 0 || pointerId === currentSession.pointerId;
162
+ }
163
+ function cancelScheduledFrame() {
164
+ if (frameId !== void 0) frameWindow?.cancelAnimationFrame(frameId);
165
+ frameWindow = null;
166
+ frameId = void 0;
167
+ }
168
+ function applyScheduledUpdate(currentSession) {
169
+ if (session !== currentSession) return;
170
+ if (geometryDirty) {
171
+ const rect = currentSession.element.getBoundingClientRect();
172
+ if (!isGeometryValid(rect)) return;
173
+ currentSession.rect = rect;
174
+ geometryDirty = false;
175
+ }
176
+ const pointer = pendingPointer;
177
+ pendingPointer = void 0;
178
+ if (pointer) updateFromPointer(pointer, currentSession.rect);
179
+ }
180
+ function flushScheduledUpdate() {
181
+ const currentSession = session;
182
+ cancelScheduledFrame();
183
+ if (currentSession) applyScheduledUpdate(currentSession);
184
+ }
185
+ function scheduleUpdate() {
186
+ const currentSession = session;
187
+ if (!currentSession) return;
188
+ const view = currentSession.view;
189
+ if (!view?.requestAnimationFrame) {
190
+ applyScheduledUpdate(currentSession);
191
+ return;
192
+ }
193
+ if (frameId !== void 0) return;
194
+ frameWindow = view;
195
+ frameId = view.requestAnimationFrame(() => {
196
+ frameWindow = null;
197
+ frameId = void 0;
198
+ applyScheduledUpdate(currentSession);
199
+ });
200
+ }
201
+ function onGeometryChange() {
202
+ if (!session) return;
203
+ geometryDirty = true;
204
+ scheduleUpdate();
205
+ }
206
+ function stopDragging() {
207
+ const stoppedSession = session;
208
+ if (!stoppedSession) return;
209
+ stoppedSession.view?.removeEventListener("pointermove", onPointerMove);
210
+ stoppedSession.view?.removeEventListener("pointerup", onPointerEnd);
211
+ stoppedSession.view?.removeEventListener("pointercancel", onPointerEnd);
212
+ stoppedSession.view?.removeEventListener("resize", onGeometryChange);
213
+ stoppedSession.view?.removeEventListener("scroll", onGeometryChange, true);
214
+ cancelScheduledFrame();
215
+ geometryDirty = false;
216
+ pendingPointer = void 0;
217
+ session = void 0;
218
+ }
219
+ function onPointerMove(event) {
220
+ if (!isCurrentPointer(event)) return;
221
+ pendingPointer = {
222
+ clientX: event.clientX,
223
+ clientY: event.clientY
224
+ };
225
+ scheduleUpdate();
226
+ }
227
+ function onPointerEnd(event) {
228
+ if (!isCurrentPointer(event)) return;
229
+ if (event.type === "pointerup") flushScheduledUpdate();
230
+ stopDragging();
231
+ }
232
+ function onPointerDown(event) {
233
+ if (readonly() || event.button !== 0 || event.isPrimary === false) return;
234
+ const el = target.value;
235
+ if (!el) return;
236
+ event.preventDefault();
237
+ (focusTarget?.value ?? el).focus();
238
+ stopDragging();
239
+ const nextSession = {
240
+ element: el,
241
+ pointerId: getPointerId(event),
242
+ rect: el.getBoundingClientRect(),
243
+ view: el.ownerDocument.defaultView
244
+ };
245
+ session = nextSession;
246
+ geometryDirty = !isGeometryValid(nextSession.rect);
247
+ if (!geometryDirty) updateFromPointer({
248
+ clientX: event.clientX,
249
+ clientY: event.clientY
250
+ }, nextSession.rect);
251
+ if (session !== nextSession) return;
252
+ nextSession.view?.addEventListener("pointermove", onPointerMove);
253
+ nextSession.view?.addEventListener("pointerup", onPointerEnd);
254
+ nextSession.view?.addEventListener("pointercancel", onPointerEnd);
255
+ nextSession.view?.addEventListener("resize", onGeometryChange);
256
+ nextSession.view?.addEventListener("scroll", onGeometryChange, true);
257
+ }
258
+ onBeforeUnmount(stopDragging);
259
+ return { onPointerDown };
260
+ }
261
+ //#endregion
262
+ //#region src/components/color-picker/color-picker-saturation.vue?vue&type=script&setup=true&vapor=true&lang.ts
263
+ var t0$2 = template("<div data-v-ae77cf79 class=rp-color-picker__saturation role=group><input data-v-ae77cf79 class=\"rp-color-picker__axis-input rp-color-picker__axis-input--saturation\"type=range min=0 max=100 step=1 aria-label=Saturation aria-orientation=horizontal><input data-v-ae77cf79 class=\"rp-color-picker__axis-input rp-color-picker__axis-input--value\"type=range min=0 max=100 step=1 aria-label=Value aria-orientation=vertical><span data-v-ae77cf79 class=rp-color-picker__surface aria-hidden=true></span><span data-v-ae77cf79 class=rp-color-picker__handle aria-hidden=true>", 1);
264
+ delegateEvents("input", "keydown", "pointerdown");
265
+ //#endregion
266
+ //#region src/components/color-picker/color-picker-saturation.vue
267
+ var color_picker_saturation_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineVaporComponent({
268
+ name: "RpColorPickerSaturation",
269
+ __name: "color-picker-saturation",
270
+ props: {
271
+ id: {},
272
+ modelValue: {},
273
+ hue: { default: 0 },
274
+ readonly: {
275
+ type: Boolean,
276
+ default: false
277
+ },
278
+ ariaLabel: {},
279
+ describedby: {},
280
+ labelledby: {}
281
+ },
282
+ emits: ["update:modelValue"],
283
+ setup(__props, { emit: __emit }) {
284
+ const props = __props;
285
+ const emit = __emit;
286
+ const saturationRef = ref(null);
287
+ const saturationInputRef = ref(null);
288
+ const saturation = computed(() => clampPercent(props.modelValue.saturation));
289
+ const value = computed(() => clampPercent(props.modelValue.value));
290
+ const hue = computed(() => normalizeHue(props.hue));
291
+ const saturationStyle = computed(() => ({
292
+ "--_rp-color-picker-hue": String(normalizeHueForColor(hue.value)),
293
+ "--_rp-color-picker-saturation-x": `${saturation.value}%`,
294
+ "--_rp-color-picker-saturation-y": `${100 - value.value}%`,
295
+ "--_rp-color-picker-current": getHsvCssColor(hue.value, saturation.value, value.value)
296
+ }));
297
+ const ariaValueText = computed(() => `${Math.round(saturation.value)}% saturation, ${Math.round(value.value)}% value`);
298
+ const groupAriaLabel = computed(() => props.labelledby ? void 0 : props.ariaLabel || "Color area");
299
+ function updateValue(nextSaturation, nextValue) {
300
+ if (props.readonly) return;
301
+ const normalizedSaturation = roundPercent(clampPercent(nextSaturation));
302
+ const normalizedValue = roundPercent(clampPercent(nextValue));
303
+ if (normalizedSaturation === saturation.value && normalizedValue === value.value) return;
304
+ emit("update:modelValue", {
305
+ saturation: normalizedSaturation,
306
+ value: normalizedValue
307
+ });
308
+ }
309
+ function updateFromPointer(e, rect) {
310
+ if (rect.width <= 0 || rect.height <= 0) return;
311
+ updateValue((e.clientX - rect.left) / rect.width * 100, 100 - (e.clientY - rect.top) / rect.height * 100);
312
+ }
313
+ const { onPointerDown } = useColorPickerDrag({
314
+ target: saturationRef,
315
+ focusTarget: saturationInputRef,
316
+ readonly: () => props.readonly,
317
+ isGeometryValid: (rect) => rect.width > 0 && rect.height > 0,
318
+ updateFromPointer
319
+ });
320
+ function onAxisKeydown(event, axis) {
321
+ const currentValue = axis === "saturation" ? saturation.value : value.value;
322
+ const step = event.shiftKey ? 10 : 1;
323
+ let nextValue;
324
+ switch (event.key) {
325
+ case "ArrowRight":
326
+ case "ArrowUp":
327
+ nextValue = currentValue + step;
328
+ break;
329
+ case "ArrowLeft":
330
+ case "ArrowDown":
331
+ nextValue = currentValue - step;
332
+ break;
333
+ case "Home":
334
+ nextValue = 0;
335
+ break;
336
+ case "End":
337
+ nextValue = 100;
338
+ break;
339
+ }
340
+ if (nextValue === void 0) return;
341
+ event.preventDefault();
342
+ if (!props.readonly) updateAxis(axis, nextValue);
343
+ }
344
+ function onAxisInput(event, axis) {
345
+ const input = event.currentTarget;
346
+ if (!(input instanceof HTMLInputElement)) return;
347
+ if (props.readonly) {
348
+ input.value = String(axis === "saturation" ? saturation.value : value.value);
349
+ return;
350
+ }
351
+ updateAxis(axis, Number(input.value));
352
+ }
353
+ function updateAxis(axis, nextValue) {
354
+ if (axis === "saturation") updateValue(nextValue, value.value);
355
+ else updateValue(saturation.value, nextValue);
356
+ }
357
+ const _setTemplateRef = createTemplateRefSetter();
358
+ const n2 = t0$2();
359
+ const n0 = child(n2);
360
+ const n1 = next(n0, 1);
361
+ n0.$evtinput = createInvoker(($event) => onAxisInput($event, "saturation"));
362
+ n0.$evtkeydown = createInvoker(($event) => onAxisKeydown($event, "saturation"));
363
+ _setTemplateRef(n0, saturationInputRef, null, "saturationInputRef");
364
+ n1.$evtinput = createInvoker(($event) => onAxisInput($event, "value"));
365
+ n1.$evtkeydown = createInvoker(($event) => onAxisKeydown($event, "value"));
366
+ n2.$evtpointerdown = createInvoker((e) => unref(onPointerDown)(e));
367
+ _setTemplateRef(n2, saturationRef, null, "saturationRef");
368
+ renderEffect(() => {
369
+ const _describedby = __props.describedby;
370
+ const _id = __props.id;
371
+ const _saturation = saturation.value;
372
+ const _ariaValueText = ariaValueText.value;
373
+ const _value = value.value;
374
+ setStyle(n2, saturationStyle.value);
375
+ setAttr(n2, "aria-label", groupAriaLabel.value);
376
+ setAttr(n2, "aria-labelledby", __props.labelledby);
377
+ setAttr(n2, "aria-describedby", _describedby);
378
+ setAttr(n2, "aria-readonly", __props.readonly || void 0);
379
+ setAttr(n2, "data-readonly", __props.readonly || void 0);
380
+ setProp(n0, "id", _id);
381
+ setValue(n0, _saturation);
382
+ setAttr(n0, "aria-valuenow", Math.round(_saturation));
383
+ setAttr(n0, "aria-valuetext", _ariaValueText);
384
+ setAttr(n0, "aria-describedby", _describedby);
385
+ setAttr(n0, "aria-readonly", __props.readonly || void 0);
386
+ setProp(n1, "id", _id ? `${_id}-value` : void 0);
387
+ setValue(n1, _value);
388
+ setAttr(n1, "aria-valuenow", Math.round(_value));
389
+ setAttr(n1, "aria-valuetext", _ariaValueText);
390
+ setAttr(n1, "aria-describedby", _describedby);
391
+ setAttr(n1, "aria-readonly", __props.readonly || void 0);
392
+ });
393
+ return n2;
394
+ }
395
+ }), [["__scopeId", "data-v-ae77cf79"]]);
396
+ //#endregion
397
+ //#region src/components/color-picker/color-picker-slider.vue?vue&type=script&setup=true&vapor=true&lang.ts
398
+ var t0$1 = template("<div data-v-2de2d9f2 role=slider tabindex=0 aria-orientation=horizontal aria-valuemin=0><span data-v-2de2d9f2 aria-hidden=true></span><span data-v-2de2d9f2 aria-hidden=true>", 1);
399
+ delegateEvents("pointerdown", "keydown");
400
+ //#endregion
401
+ //#region src/components/color-picker/color-picker-slider.vue
402
+ var color_picker_slider_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineVaporComponent({
403
+ name: "RpColorPickerSlider",
404
+ __name: "color-picker-slider",
405
+ props: {
406
+ variant: {},
407
+ value: { default: 0 },
408
+ color: {},
409
+ readonly: {
410
+ type: Boolean,
411
+ default: false
412
+ }
413
+ },
414
+ emits: ["update:value"],
415
+ setup(__props, { emit: __emit }) {
416
+ const props = __props;
417
+ const emit = __emit;
418
+ const sliderRef = ref(null);
419
+ const isHue = computed(() => props.variant === "hue");
420
+ const max = computed(() => isHue.value ? 359 : 100);
421
+ const rootClass = computed(() => `rp-color-picker__${props.variant}`);
422
+ const surfaceClass = computed(() => ["rp-color-picker__slider-surface", `rp-color-picker__${props.variant}-surface`]);
423
+ const handleClass = computed(() => ["rp-color-picker__slider-handle", `rp-color-picker__${props.variant}-handle`]);
424
+ const normalizedValue = computed(() => isHue.value ? normalizeHue(props.value) : clampOpacity(props.value));
425
+ const currentOutputValue = computed(() => normalizeOutputValue(normalizedValue.value));
426
+ const sliderStyle = computed(() => {
427
+ const style = { "--_rp-color-picker-slider-x": `${currentOutputValue.value / max.value * 100}%` };
428
+ if (isHue.value) style["--_rp-color-picker-hue"] = String(normalizeHueForColor(currentOutputValue.value));
429
+ else style["--_rp-color-picker-opacity-color"] = props.color;
430
+ return style;
431
+ });
432
+ const ariaLabel = computed(() => isHue.value ? "Hue" : "Opacity");
433
+ const ariaValueText = computed(() => isHue.value ? `${Math.round(normalizedValue.value)} degrees hue` : `${Math.round(normalizedValue.value)}% opacity`);
434
+ function updateValue(nextValue) {
435
+ if (props.readonly) return;
436
+ const normalizedNextValue = normalizeOutputValue(nextValue);
437
+ if (normalizedNextValue === currentOutputValue.value) return;
438
+ emit("update:value", normalizedNextValue);
439
+ }
440
+ function updateFromPointer(e, rect) {
441
+ if (rect.width <= 0) return;
442
+ updateValue((e.clientX - rect.left) / rect.width * max.value);
443
+ }
444
+ const { onPointerDown } = useColorPickerDrag({
445
+ target: sliderRef,
446
+ readonly: () => props.readonly,
447
+ isGeometryValid: (rect) => rect.width > 0,
448
+ updateFromPointer
449
+ });
450
+ function onKeydown(e) {
451
+ if (props.readonly) return;
452
+ const step = e.shiftKey ? 10 : 1;
453
+ switch (e.key) {
454
+ case "ArrowRight":
455
+ case "ArrowUp":
456
+ e.preventDefault();
457
+ updateValue(normalizedValue.value + step);
458
+ break;
459
+ case "ArrowLeft":
460
+ case "ArrowDown":
461
+ e.preventDefault();
462
+ updateValue(normalizedValue.value - step);
463
+ break;
464
+ case "Home":
465
+ e.preventDefault();
466
+ updateValue(0);
467
+ break;
468
+ case "End":
469
+ e.preventDefault();
470
+ updateValue(max.value);
471
+ break;
472
+ }
473
+ }
474
+ function normalizeOutputValue(value) {
475
+ return isHue.value ? Math.round(clampHue(value)) : roundPercent(clampOpacity(value));
476
+ }
477
+ const _setTemplateRef = createTemplateRefSetter();
478
+ const n2 = t0$1();
479
+ const n0 = child(n2);
480
+ const n1 = next(n0, 1);
481
+ n2.$evtpointerdown = createInvoker((e) => unref(onPointerDown)(e));
482
+ n2.$evtkeydown = createInvoker(onKeydown);
483
+ _setTemplateRef(n2, sliderRef, null, "sliderRef");
484
+ renderEffect(() => {
485
+ setClass(n2, rootClass.value);
486
+ setStyle(n2, sliderStyle.value);
487
+ setAttr(n2, "aria-label", ariaLabel.value);
488
+ setAttr(n2, "aria-valuemax", max.value);
489
+ setAttr(n2, "aria-valuenow", Math.round(normalizedValue.value));
490
+ setAttr(n2, "aria-valuetext", ariaValueText.value);
491
+ setAttr(n2, "aria-readonly", __props.readonly || void 0);
492
+ setAttr(n2, "data-readonly", __props.readonly || void 0);
493
+ setClass(n0, surfaceClass.value);
494
+ setClass(n1, handleClass.value);
495
+ });
496
+ return n2;
497
+ }
498
+ }), [["__scopeId", "data-v-2de2d9f2"]]);
499
+ //#endregion
500
+ //#region src/components/color-picker/useColorPickerSwatches.ts
501
+ var MAX_SWATCHES_PER_ROW = 15;
502
+ function useColorPickerSwatches(props, options) {
503
+ const swatchesRef = ref(null);
504
+ const focusedSwatchIndex = ref(null);
505
+ const normalizedSwatchesPerRow = computed(() => normalizeSwatchesPerRow(props.swatchesPerRow));
506
+ const validSwatches = computed(() => (props.swatches ?? []).filter((swatch) => Boolean(parseColorPickerValue(swatch))));
507
+ const swatchesStyle = computed(() => {
508
+ const swatchesPerRow = normalizedSwatchesPerRow.value;
509
+ if (!swatchesPerRow) return void 0;
510
+ return { "--_rp-color-picker-swatches-per-row": String(swatchesPerRow) };
511
+ });
512
+ const swatchSize = computed(() => normalizedSwatchesPerRow.value ? "100%" : "var(--_rp-color-picker-swatch-size)");
513
+ const selectedSwatchIndex = computed(() => validSwatches.value.findIndex((swatch) => options.isSelected(swatch)));
514
+ const tabbableSwatchIndex = computed(() => {
515
+ const focusedIndex = focusedSwatchIndex.value;
516
+ if (focusedIndex != null && focusedIndex < validSwatches.value.length) return focusedIndex;
517
+ return selectedSwatchIndex.value >= 0 ? selectedSwatchIndex.value : 0;
518
+ });
519
+ function isSwatchSelected(index) {
520
+ return selectedSwatchIndex.value === index;
521
+ }
522
+ function getSwatchTabindex(index) {
523
+ return tabbableSwatchIndex.value === index ? 0 : -1;
524
+ }
525
+ function selectSwatch(swatch) {
526
+ options.select(swatch);
527
+ }
528
+ function onSwatchFocus(index) {
529
+ focusedSwatchIndex.value = index;
530
+ }
531
+ function onSwatchesFocusout(event) {
532
+ const group = event.currentTarget;
533
+ const nextTarget = event.relatedTarget;
534
+ if (group instanceof HTMLElement && nextTarget instanceof Node && group.contains(nextTarget)) return;
535
+ focusedSwatchIndex.value = null;
536
+ }
537
+ function onSwatchKeydown(event, index) {
538
+ const offset = getNavigationOffset(event.key);
539
+ if (offset === void 0 || validSwatches.value.length === 0) return;
540
+ event.preventDefault();
541
+ const nextIndex = (index + offset + validSwatches.value.length) % validSwatches.value.length;
542
+ const nextSwatch = validSwatches.value[nextIndex];
543
+ (swatchesRef.value?.querySelectorAll(".rp-color-picker__swatch")[nextIndex])?.focus({ preventScroll: true });
544
+ if (nextSwatch) selectSwatch(nextSwatch);
545
+ }
546
+ return {
547
+ swatchesRef,
548
+ normalizedSwatchesPerRow,
549
+ validSwatches,
550
+ swatchesStyle,
551
+ swatchSize,
552
+ isSwatchSelected,
553
+ getSwatchTabindex,
554
+ selectSwatch,
555
+ onSwatchFocus,
556
+ onSwatchesFocusout,
557
+ onSwatchKeydown
558
+ };
559
+ }
560
+ function normalizeSwatchesPerRow(value) {
561
+ if (value === void 0 || !Number.isFinite(value) || value < 1) return void 0;
562
+ return Math.min(MAX_SWATCHES_PER_ROW, Math.floor(value));
563
+ }
564
+ function getNavigationOffset(key) {
565
+ switch (key) {
566
+ case "ArrowRight":
567
+ case "ArrowDown": return 1;
568
+ case "ArrowLeft":
569
+ case "ArrowUp": return -1;
570
+ default: return;
571
+ }
572
+ }
573
+ //#endregion
574
+ //#region src/components/color-picker/useColorPickerValue.ts
575
+ function useColorPickerValue(props, emitUpdate) {
576
+ const format = computed(() => props.format ?? "hex");
577
+ const emittedStringColor = ref(null);
578
+ const selectedColor = computed(() => {
579
+ const value = props.modelValue;
580
+ const cached = emittedStringColor.value;
581
+ if (cached && cached.value === value && cached.format === format.value) return cached.color;
582
+ return parseColorPickerValue(value) ?? {
583
+ hue: 0,
584
+ saturation: 100,
585
+ value: 100,
586
+ opacity: 100
587
+ };
588
+ });
589
+ const saturationValue = computed(() => ({
590
+ saturation: selectedColor.value.saturation,
591
+ value: selectedColor.value.value
592
+ }));
593
+ const opacityColor = computed(() => getHsvCssColor(selectedColor.value.hue, selectedColor.value.saturation, selectedColor.value.value));
594
+ const showAlphaControls = computed(() => isColorPickerAlphaFormat(format.value));
595
+ function updateSelection(value) {
596
+ emitColor({
597
+ saturation: value.saturation,
598
+ value: value.value,
599
+ ...value.opacity === void 0 ? {} : { opacity: value.opacity }
600
+ });
601
+ }
602
+ function updateHue(value) {
603
+ emitColor({ hue: value });
604
+ }
605
+ function updateOpacity(value) {
606
+ emitColor({ opacity: value });
607
+ }
608
+ function selectColor(value) {
609
+ if (props.readonly) return;
610
+ const parsedColor = parseColorPickerValue(value);
611
+ if (!parsedColor) return;
612
+ emitColor(normalizeColor(parsedColor));
613
+ }
614
+ function isColorSelected(value) {
615
+ const parsedColor = parseColorPickerValue(value);
616
+ if (!parsedColor) return false;
617
+ return getComparableColor(normalizeColor(parsedColor)) === getComparableColor(selectedColor.value);
618
+ }
619
+ function emitColor(nextColor) {
620
+ const color = normalizeColor({
621
+ ...selectedColor.value,
622
+ ...nextColor
623
+ });
624
+ const formattedValue = formatColorPickerValue(color, format.value);
625
+ emittedStringColor.value = {
626
+ value: formattedValue,
627
+ format: format.value,
628
+ color
629
+ };
630
+ emitUpdate(formattedValue);
631
+ }
632
+ return {
633
+ selectedColor,
634
+ saturationValue,
635
+ opacityColor,
636
+ showAlphaControls,
637
+ updateSelection,
638
+ updateHue,
639
+ updateOpacity,
640
+ selectColor,
641
+ isColorSelected
642
+ };
643
+ }
644
+ function normalizeColor(color) {
645
+ return {
646
+ hue: normalizeHue(color.hue),
647
+ saturation: roundPercent(clampPercent(color.saturation)),
648
+ value: roundPercent(clampPercent(color.value)),
649
+ opacity: roundPercent(clampOpacity(color.opacity))
650
+ };
651
+ }
652
+ function getComparableColor(color) {
653
+ return formatColorPickerValue(color, "rgba");
654
+ }
655
+ //#endregion
656
+ //#region src/components/color-picker/color-picker.vue?vue&type=script&setup=true&vapor=true&lang.ts
657
+ var t0 = template("<div data-v-38eeea2b class=rp-color-picker__header><span data-v-38eeea2b class=rp-color-picker__label>");
658
+ var t1 = template("<button data-v-38eeea2b class=rp-color-picker__swatch type=button role=radio>");
659
+ var t2 = template("<div data-v-38eeea2b class=rp-color-picker__swatches role=radiogroup>");
660
+ var t3 = template("<div data-v-38eeea2b>", 1);
661
+ delegateEvents("click", "keydown", "focusout");
662
+ //#endregion
663
+ //#region src/components/color-picker/color-picker.vue
664
+ var color_picker_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineVaporComponent({
665
+ name: "RpColorPicker",
666
+ inheritAttrs: false,
667
+ __name: "color-picker",
668
+ props: {
669
+ id: {},
670
+ modelValue: {},
671
+ format: { default: "hex" },
672
+ size: {},
673
+ readonly: {
674
+ type: Boolean,
675
+ default: false
676
+ },
677
+ withPicker: {
678
+ type: Boolean,
679
+ default: true
680
+ },
681
+ swatches: { default: () => [] },
682
+ swatchesPerRow: {},
683
+ ariaLabel: {},
684
+ describedby: {},
685
+ labelledby: {}
686
+ },
687
+ emits: ["update:modelValue"],
688
+ setup(__props, { emit: __emit, slots: $slots }) {
689
+ const props = __props;
690
+ const emit = __emit;
691
+ const rootClass = computed(() => bem("rp-color-picker", {
692
+ [`size-${props.size}`]: Boolean(props.size),
693
+ readonly: props.readonly
694
+ }));
695
+ const attrs = useAttrs();
696
+ const rootAttrs = computed(() => {
697
+ const { disabled: _disabled, invalid: _invalid, required: _required, ...filteredAttrs } = attrs;
698
+ return filteredAttrs;
699
+ });
700
+ const { selectedColor, saturationValue, opacityColor, showAlphaControls, updateSelection, updateHue, updateOpacity, selectColor, isColorSelected } = useColorPickerValue(props, (value) => emit("update:modelValue", value));
701
+ const { swatchesRef, normalizedSwatchesPerRow, validSwatches, swatchesStyle, swatchSize, isSwatchSelected, getSwatchTabindex, selectSwatch, onSwatchFocus, onSwatchesFocusout, onSwatchKeydown } = useColorPickerSwatches(props, {
702
+ isSelected: isColorSelected,
703
+ select: selectColor
704
+ });
705
+ const _setTemplateRef = createTemplateRefSetter();
706
+ const n22 = t3();
707
+ renderEffect(() => setDynamicProps(n22, [rootAttrs.value, {
708
+ class: rootClass.value,
709
+ "data-readonly": __props.readonly || void 0
710
+ }]));
711
+ setInsertionState(n22, null, 0);
712
+ createIf(() => $slots.default, () => {
713
+ const n4 = t0();
714
+ setInsertionState(child(n4), null, 0);
715
+ createSlot("default", null, null, 1);
716
+ return n4;
717
+ });
718
+ setInsertionState(n22, null, 1);
719
+ createIf(() => __props.withPicker, () => {
720
+ return [
721
+ createComponent(color_picker_saturation_default, {
722
+ id: () => __props.id,
723
+ "model-value": () => unref(saturationValue),
724
+ hue: () => unref(selectedColor).hue,
725
+ readonly: () => __props.readonly,
726
+ "aria-label": () => __props.ariaLabel,
727
+ describedby: () => __props.describedby,
728
+ labelledby: () => __props.labelledby,
729
+ "onUpdate:modelValue": () => unref(updateSelection)
730
+ }),
731
+ createComponent(color_picker_slider_default, {
732
+ variant: "hue",
733
+ value: () => unref(selectedColor).hue,
734
+ readonly: () => __props.readonly,
735
+ "onUpdate:value": () => unref(updateHue)
736
+ }),
737
+ createIf(() => unref(showAlphaControls), () => {
738
+ return createComponent(color_picker_slider_default, {
739
+ variant: "opacity",
740
+ color: () => unref(opacityColor),
741
+ value: () => unref(selectedColor).opacity,
742
+ readonly: () => __props.readonly,
743
+ "onUpdate:value": () => unref(updateOpacity)
744
+ });
745
+ })
746
+ ];
747
+ }, null, 2);
748
+ setInsertionState(n22, null, 2);
749
+ createIf(() => unref(validSwatches).length, () => {
750
+ const n21 = t2();
751
+ renderEffect(() => {
752
+ const _withPicker = __props.withPicker;
753
+ setStyle(n21, unref(swatchesStyle));
754
+ setAttr(n21, "data-fill", unref(normalizedSwatchesPerRow) ? true : void 0);
755
+ setAttr(n21, "data-with-picker", _withPicker || void 0);
756
+ setProp(n21, "id", _withPicker ? void 0 : __props.id);
757
+ setAttr(n21, "aria-label", _withPicker ? "Color swatches" : __props.ariaLabel || "Color swatches");
758
+ setAttr(n21, "aria-describedby", _withPicker ? void 0 : __props.describedby);
759
+ setAttr(n21, "aria-labelledby", _withPicker ? void 0 : __props.labelledby);
760
+ });
761
+ setInsertionState(n21, null, 0);
762
+ createFor(() => unref(validSwatches), (_for_item0, _for_key0) => {
763
+ const n20 = t1();
764
+ renderEffect(() => {
765
+ const _readonly = __props.readonly;
766
+ const _index = _for_key0.value;
767
+ const _swatch = _for_item0.value;
768
+ setProp(n20, "disabled", _readonly);
769
+ setProp(n20, "tabindex", _readonly ? -1 : unref(getSwatchTabindex)(_index));
770
+ setAttr(n20, "aria-checked", unref(isSwatchSelected)(_index));
771
+ setAttr(n20, "aria-label", `Select color ${_swatch}`);
772
+ setProp(n20, "title", _swatch);
773
+ });
774
+ setInsertionState(n20, null, 0);
775
+ createComponent(color_swatch_default, {
776
+ color: () => _for_item0.value,
777
+ size: () => unref(swatchSize),
778
+ "aria-hidden": "true"
779
+ }, extend(() => {
780
+ return createIf(() => unref(isSwatchSelected)(_for_key0.value), () => {
781
+ return createComponent(unref(check_default), { class: "rp-color-picker__swatch-check" });
782
+ }, null, 129);
783
+ }, { _: 8 }));
784
+ n20.$evtclick = createInvoker(() => unref(selectSwatch)(_for_item0.value));
785
+ on(n20, "focus", () => unref(onSwatchFocus)(_for_key0.value));
786
+ n20.$evtkeydown = createInvoker(($event) => unref(onSwatchKeydown)($event, _for_key0.value));
787
+ return n20;
788
+ }, (swatch, index) => `${swatch}-${index}`, 9);
789
+ n21.$evtfocusout = createInvoker((e) => unref(onSwatchesFocusout)(e));
790
+ _setTemplateRef(n21, swatchesRef, null, "swatchesRef");
791
+ return n21;
792
+ });
793
+ return n22;
794
+ }
795
+ }), [["__scopeId", "data-v-38eeea2b"]]);
796
+ //#endregion
797
+ export { formatColorPickerValue as n, parseColorPickerValue as r, color_picker_default as t };