@shtabapp/ui-kit 1.33.0 → 1.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/{SAvatar-C2gekygl.cjs → SAvatar-D5SreJLe.cjs} +1 -1
  3. package/dist/{SAvatar-DAfDAqrP.js → SAvatar-q1HSZPqy.js} +1 -1
  4. package/dist/{SAvatarGroup-HvIlI5y0.js → SAvatarGroup-By-5Ub6i.js} +1 -1
  5. package/dist/{SAvatarGroup-76j-sHCe.cjs → SAvatarGroup-CdVjv8sb.cjs} +1 -1
  6. package/dist/SColorPalette-CqfVzhda.cjs +1 -0
  7. package/dist/SColorPalette-D2WCADDX.js +146 -0
  8. package/dist/SColorPicker-BcRHiLjI.cjs +1 -0
  9. package/dist/SColorPicker-BnfGvKy4.js +642 -0
  10. package/dist/{SDropdown-Cv729__Y.js → SDropdown-CTQ5Qlez.js} +50 -49
  11. package/dist/SDropdown-_QUOP-rw.cjs +1 -0
  12. package/dist/SInput-C07kFnj_.cjs +1 -0
  13. package/dist/{SInput-iNlzBX5m.js → SInput-CkanJfLx.js} +45 -44
  14. package/dist/{SList-C_S9ej45.js → SList-B40rJ-PZ.js} +1 -1
  15. package/dist/{SList-CU2Sy9Md.cjs → SList-Txr46zQ5.cjs} +1 -1
  16. package/dist/SListItem-BKP5Wk1F.cjs +1 -0
  17. package/dist/{SListItem-BD7wvCNe.js → SListItem-DKrpL2SS.js} +56 -56
  18. package/dist/SSelect-BPYtkzaw.cjs +1 -0
  19. package/dist/{SSelect-CZe3djdm.js → SSelect-XSZjYLBA.js} +225 -223
  20. package/dist/STab-BbzowB-Y.cjs +1 -0
  21. package/dist/STab-DY1TGadw.js +218 -0
  22. package/dist/{STabs-Ce7tHq8T.js → STabs-CTM8Nji_.js} +1 -1
  23. package/dist/{STabs-C6QQnCZd.cjs → STabs-DeHqnjNJ.cjs} +1 -1
  24. package/dist/STag-CluIVRKi.js +126 -0
  25. package/dist/STag-D1mmp1kd.cjs +1 -0
  26. package/dist/{STagGroup-BMGq6jB5.cjs → STagGroup-BMIwBk-O.cjs} +1 -1
  27. package/dist/{STagGroup-DWsu0ket.js → STagGroup-wSpc3guU.js} +1 -1
  28. package/dist/colorValue-CSh0chxp.js +5 -0
  29. package/dist/colorValue-Dda7fKd3.cjs +1 -0
  30. package/dist/components/SAvatar/utils/getAvatarInitialsTextColor.d.ts +1 -1
  31. package/dist/components/SAvatar/utils/getAvatarInitialsTextColor.d.ts.map +1 -1
  32. package/dist/components/SColorPalette/SColorPalette.types.d.ts +19 -0
  33. package/dist/components/SColorPalette/SColorPalette.types.d.ts.map +1 -0
  34. package/dist/components/SColorPalette/SColorPalette.vue.d.ts +26 -0
  35. package/dist/components/SColorPalette/SColorPalette.vue.d.ts.map +1 -0
  36. package/dist/components/SColorPalette/index.d.ts +4 -0
  37. package/dist/components/SColorPalette/index.d.ts.map +1 -0
  38. package/dist/components/SColorPicker/SColorPicker.types.d.ts +12 -0
  39. package/dist/components/SColorPicker/SColorPicker.types.d.ts.map +1 -0
  40. package/dist/components/SColorPicker/SColorPicker.vue.d.ts +25 -0
  41. package/dist/components/SColorPicker/SColorPicker.vue.d.ts.map +1 -0
  42. package/dist/components/SColorPicker/constants/SColorPicker.constants.d.ts +2 -0
  43. package/dist/components/SColorPicker/constants/SColorPicker.constants.d.ts.map +1 -0
  44. package/dist/components/SColorPicker/index.d.ts +8 -0
  45. package/dist/components/SColorPicker/index.d.ts.map +1 -0
  46. package/dist/components/SColorPicker/parts/SColorArea.types.d.ts +9 -0
  47. package/dist/components/SColorPicker/parts/SColorArea.types.d.ts.map +1 -0
  48. package/dist/components/SColorPicker/parts/SColorArea.vue.d.ts +15 -0
  49. package/dist/components/SColorPicker/parts/SColorArea.vue.d.ts.map +1 -0
  50. package/dist/components/SColorPicker/parts/SColorValues.types.d.ts +12 -0
  51. package/dist/components/SColorPicker/parts/SColorValues.types.d.ts.map +1 -0
  52. package/dist/components/SColorPicker/parts/SColorValues.vue.d.ts +22 -0
  53. package/dist/components/SColorPicker/parts/SColorValues.vue.d.ts.map +1 -0
  54. package/dist/components/SColorPicker/utils/resolveColorSwatchFillElement.d.ts +3 -0
  55. package/dist/components/SColorPicker/utils/resolveColorSwatchFillElement.d.ts.map +1 -0
  56. package/dist/components/SColorPicker/utils/useColorArea.d.ts +29 -0
  57. package/dist/components/SColorPicker/utils/useColorArea.d.ts.map +1 -0
  58. package/dist/components/SDropdown/SDropdown.vue.d.ts.map +1 -1
  59. package/dist/components/SInput/SInput.vue.d.ts.map +1 -1
  60. package/dist/components/SListItem/SListItem.vue.d.ts.map +1 -1
  61. package/dist/components/SSelect/SSelect.types.d.ts +13 -1
  62. package/dist/components/SSelect/SSelect.types.d.ts.map +1 -1
  63. package/dist/components/SSelect/SSelect.vue.d.ts.map +1 -1
  64. package/dist/components/SSelect/index.d.ts +1 -1
  65. package/dist/components/SSelect/index.d.ts.map +1 -1
  66. package/dist/components/STab/STab.vue.d.ts.map +1 -1
  67. package/dist/components/STag/STag.vue.d.ts.map +1 -1
  68. package/dist/components/STag/utils/resolveTagColor.d.ts.map +1 -1
  69. package/dist/composables/connectedPosition/parseAnchor.d.ts.map +1 -1
  70. package/dist/composables/connectedPosition/types.d.ts +5 -1
  71. package/dist/composables/connectedPosition/types.d.ts.map +1 -1
  72. package/dist/contrastSurfaceTextColor-BDlLSSXC.js +33 -0
  73. package/dist/contrastSurfaceTextColor-BRjRzXyZ.cjs +1 -0
  74. package/dist/entries/avatar-group.cjs +1 -1
  75. package/dist/entries/avatar-group.js +1 -1
  76. package/dist/entries/avatar.cjs +1 -1
  77. package/dist/entries/avatar.js +1 -1
  78. package/dist/entries/color-palette.cjs +1 -0
  79. package/dist/entries/color-palette.d.ts +5 -0
  80. package/dist/entries/color-palette.d.ts.map +1 -0
  81. package/dist/entries/color-palette.js +3 -0
  82. package/dist/entries/color-picker.cjs +1 -0
  83. package/dist/entries/color-picker.d.ts +5 -0
  84. package/dist/entries/color-picker.d.ts.map +1 -0
  85. package/dist/entries/color-picker.js +4 -0
  86. package/dist/entries/composables.cjs +1 -1
  87. package/dist/entries/composables.js +1 -1
  88. package/dist/entries/dropdown.cjs +1 -1
  89. package/dist/entries/dropdown.js +2 -2
  90. package/dist/entries/input.cjs +1 -1
  91. package/dist/entries/input.js +1 -1
  92. package/dist/entries/list-item.cjs +1 -1
  93. package/dist/entries/list-item.js +1 -1
  94. package/dist/entries/list.cjs +1 -1
  95. package/dist/entries/list.js +1 -1
  96. package/dist/entries/select.cjs +1 -1
  97. package/dist/entries/select.d.ts +1 -1
  98. package/dist/entries/select.d.ts.map +1 -1
  99. package/dist/entries/select.js +1 -1
  100. package/dist/entries/tab.cjs +1 -1
  101. package/dist/entries/tab.js +1 -1
  102. package/dist/entries/tabs.cjs +1 -1
  103. package/dist/entries/tabs.js +2 -2
  104. package/dist/entries/tag-group.cjs +1 -1
  105. package/dist/entries/tag-group.js +2 -2
  106. package/dist/entries/tag.cjs +1 -1
  107. package/dist/entries/tag.js +1 -1
  108. package/dist/index.cjs +1 -1
  109. package/dist/index.d.ts +9 -1
  110. package/dist/index.d.ts.map +1 -1
  111. package/dist/index.js +38 -34
  112. package/dist/uikit-components.css +1 -1
  113. package/dist/useFloatingOverlay-B1UCUYQQ.cjs +1 -0
  114. package/dist/{useFloatingOverlay-D-GlpoPP.js → useFloatingOverlay-QcumEYEq.js} +23 -3
  115. package/dist/utils/color/colorFormatChannels.d.ts +11 -0
  116. package/dist/utils/color/colorFormatChannels.d.ts.map +1 -0
  117. package/dist/utils/color/colorValue.d.ts +9 -0
  118. package/dist/utils/color/colorValue.d.ts.map +1 -0
  119. package/dist/utils/color/contrastSurfaceTextColor.d.ts +1 -1
  120. package/dist/utils/color/contrastSurfaceTextColor.d.ts.map +1 -1
  121. package/dist/utils/color/defaultPaletteColors.d.ts +3 -0
  122. package/dist/utils/color/defaultPaletteColors.d.ts.map +1 -0
  123. package/dist/utils/color/formatColorForDisplay.d.ts +9 -0
  124. package/dist/utils/color/formatColorForDisplay.d.ts.map +1 -0
  125. package/dist/utils/color/index.d.ts +9 -1
  126. package/dist/utils/color/index.d.ts.map +1 -1
  127. package/dist/utils/color/parseColorFromInput.d.ts +4 -0
  128. package/dist/utils/color/parseColorFromInput.d.ts.map +1 -0
  129. package/dist/utils/color/recommendedColorPalette.d.ts +3 -0
  130. package/dist/utils/color/recommendedColorPalette.d.ts.map +1 -0
  131. package/dist/utils/color/types.d.ts +35 -0
  132. package/dist/utils/color/types.d.ts.map +1 -0
  133. package/package.json +15 -2
  134. package/dist/SDropdown-B6b7IDjp.cjs +0 -1
  135. package/dist/SInput-DYS84eMS.cjs +0 -1
  136. package/dist/SListItem-BDkldLVt.cjs +0 -1
  137. package/dist/SSelect-DAPSmCWf.cjs +0 -1
  138. package/dist/STab-C8RXx0lW.cjs +0 -1
  139. package/dist/STab-DXGKWtFI.js +0 -218
  140. package/dist/STag-BwzuI3cF.cjs +0 -1
  141. package/dist/STag-L6B4DxOx.js +0 -122
  142. package/dist/contrastSurfaceTextColor-Dl641cZ_.js +0 -33
  143. package/dist/contrastSurfaceTextColor-Ybh-FZof.cjs +0 -1
  144. package/dist/useFloatingOverlay-Cwg2MWyD.cjs +0 -1
@@ -0,0 +1,642 @@
1
+ import { n as e } from "./contrastSurfaceTextColor-BDlLSSXC.js";
2
+ import { n as t, o as n, r, t as i } from "./SColorPalette-D2WCADDX.js";
3
+ import { a, n as o } from "./colorValue-CSh0chxp.js";
4
+ import { n as s, r as c, t as l } from "./SButton.types-CpdHQtyx.js";
5
+ import { t as u } from "./SButton-DnU_XZ1C.js";
6
+ import { i as d } from "./useFloatingOverlay-QcumEYEq.js";
7
+ import { t as f } from "./SDropdown-CTQ5Qlez.js";
8
+ import { r as p, t as m } from "./SSelect-XSZjYLBA.js";
9
+ import { Fragment as h, computed as g, createBlock as _, createElementBlock as v, createElementVNode as y, createTextVNode as b, createVNode as x, defineComponent as S, mergeModels as C, mergeProps as w, nextTick as T, normalizeClass as E, normalizeStyle as D, onMounted as O, openBlock as k, ref as A, shallowRef as j, toDisplayString as M, toRef as N, unref as P, useModel as F, useTemplateRef as I, vModelText as L, watch as R, withCtx as z, withDirectives as B } from "vue";
10
+ import { ESColorSwatchSize as V, SColorSwatch as ee, useUiKitI18n as H } from "@shtabapp/ui-kit-primitives";
11
+ import { useEventListener as U } from "@vueuse/core";
12
+ //#region src/utils/color/colorFormatChannels.ts
13
+ var W = (e) => Math.max(0, Math.min(255, Math.round(e))), te = (e) => {
14
+ let t = e % 360;
15
+ return t < 0 ? t + 360 : t;
16
+ }, G = (e) => Math.max(0, Math.min(100, Math.round(e))), ne = (e) => {
17
+ let t = e.slice(1);
18
+ if (t.length === 3) {
19
+ let e = t[0], n = t[1], r = t[2];
20
+ return !e || !n || !r ? void 0 : `${e}${e}${n}${n}${r}${r}`;
21
+ }
22
+ if (t.length === 6 || t.length === 8) return t.slice(0, 6);
23
+ }, K = (e) => {
24
+ let t = ne(e);
25
+ if (!t) return;
26
+ let n = Number.parseInt(t.slice(0, 2), 16), r = Number.parseInt(t.slice(2, 4), 16), i = Number.parseInt(t.slice(4, 6), 16);
27
+ if (!(Number.isNaN(n) || Number.isNaN(r) || Number.isNaN(i))) return {
28
+ first: n,
29
+ second: r,
30
+ third: i
31
+ };
32
+ }, q = (e) => {
33
+ let t = W(e.first), n = W(e.second), r = W(e.third);
34
+ return `#${t.toString(16).padStart(2, "0").toUpperCase()}${n.toString(16).padStart(2, "0").toUpperCase()}${r.toString(16).padStart(2, "0").toUpperCase()}`;
35
+ }, J = (e) => {
36
+ let t = K(e);
37
+ if (!t) return;
38
+ let n = t.first / 255, r = t.second / 255, i = t.third / 255, a = Math.max(n, r, i), o = Math.min(n, r, i), s = a - o, c = 0, l = (a + o) / 2;
39
+ s !== 0 && (c = a === n ? ((r - i) / s + (r < i ? 6 : 0)) * 60 : a === r ? ((i - n) / s + 2) * 60 : ((n - r) / s + 4) * 60);
40
+ let u = 0;
41
+ return s !== 0 && (u = l > .5 ? s / (2 - a - o) : s / (a + o)), {
42
+ first: Math.round(c),
43
+ second: Math.round(u * 100),
44
+ third: Math.round(l * 100)
45
+ };
46
+ }, re = (e) => {
47
+ let t = te(e.first), n = G(e.second) / 100, r = G(e.third) / 100, i = (e) => {
48
+ let i = (t + e) / 30;
49
+ return W((r - n * Math.min(r, 1 - r) * Math.max(-1, Math.min(i % 2 - 1, 1))) * 255);
50
+ };
51
+ return q({
52
+ first: i(0),
53
+ second: i(8),
54
+ third: i(4)
55
+ });
56
+ }, ie = (t) => {
57
+ let n = t.toUpperCase(), r = n.startsWith("#") ? n.slice(1) : n;
58
+ if (!/^[0-9A-F]{3}$/.test(r) && !/^[0-9A-F]{6}$/.test(r)) return;
59
+ let i = `#${r}`;
60
+ if (e(i)) return q(K(i) ?? {
61
+ first: 0,
62
+ second: 0,
63
+ third: 0
64
+ });
65
+ }, ae = (e) => e.slice(1).toUpperCase(), oe = (e) => {
66
+ let t = e.first / 255, n = e.second / 255, r = e.third / 255, i = Math.max(t, n, r), a = i - Math.min(t, n, r), o = 0;
67
+ a !== 0 && (o = i === t ? (n - r) / a % 6 : i === n ? (r - t) / a + 2 : (t - n) / a + 4, o = Math.round(o * 60), o < 0 && (o += 360));
68
+ let s = i === 0 ? 0 : a / i;
69
+ return {
70
+ hue: o,
71
+ saturation: s,
72
+ value: i
73
+ };
74
+ }, se = (e) => {
75
+ let t = e.value * e.saturation, n = e.hue / 60, r = t * (1 - Math.abs(n % 2 - 1)), i = e.value - t, a = 0, o = 0, s = 0;
76
+ return n >= 0 && n < 1 ? (a = t, o = r) : n >= 1 && n < 2 ? (a = r, o = t) : n >= 2 && n < 3 ? (o = t, s = r) : n >= 3 && n < 4 ? (o = r, s = t) : n >= 4 && n < 5 ? (a = r, s = t) : (a = t, s = r), {
77
+ first: W((a + i) * 255),
78
+ second: W((o + i) * 255),
79
+ third: W((s + i) * 255)
80
+ };
81
+ }, Y = (e) => {
82
+ let t = K(e);
83
+ if (t) return oe(t);
84
+ }, X = (e) => q(se(e)), Z = [
85
+ n.HEX,
86
+ n.RGB,
87
+ n.HSL
88
+ ], ce = {
89
+ [n.HEX]: "Hex",
90
+ [n.RGB]: "RGB",
91
+ [n.HSL]: "HSL"
92
+ }, le = (e) => {
93
+ let t = getComputedStyle(e).backgroundColor.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)/);
94
+ if (!t) return;
95
+ let n = Number.parseInt(t[1] ?? "0", 10), r = Number.parseInt(t[2] ?? "0", 10), i = Number.parseInt(t[3] ?? "0", 10);
96
+ return `#${n.toString(16).padStart(2, "0").toUpperCase()}${r.toString(16).padStart(2, "0").toUpperCase()}${i.toString(16).padStart(2, "0").toUpperCase()}`;
97
+ }, ue = (t, n) => {
98
+ if (o(t) && e(t)) return t;
99
+ if (n) return le(n);
100
+ }, de = (e, t) => t === n.HEX ? ae(e) : t === n.RGB ? K(e) ?? {
101
+ first: 0,
102
+ second: 0,
103
+ third: 0
104
+ } : J(e) ?? {
105
+ first: 0,
106
+ second: 0,
107
+ third: 0
108
+ }, Q = (e) => {
109
+ let t = Number.parseInt(e, 10);
110
+ if (!Number.isNaN(t)) return t;
111
+ }, fe = (e, t) => {
112
+ if (e === n.HEX) return typeof t == "string" ? ie(t) : void 0;
113
+ if (typeof t == "string") return;
114
+ if (e === n.RGB) {
115
+ let e = q({
116
+ first: Q(String(t.first)) ?? 0,
117
+ second: Q(String(t.second)) ?? 0,
118
+ third: Q(String(t.third)) ?? 0
119
+ });
120
+ return K(e) ? e : void 0;
121
+ }
122
+ let r = re({
123
+ first: Q(String(t.first)) ?? 0,
124
+ second: Q(String(t.second)) ?? 0,
125
+ third: Q(String(t.third)) ?? 0
126
+ });
127
+ if (r && J(r)) return r;
128
+ }, pe = 17, me = "#000000", he = (e) => e ?? me, ge = ({ modelValue: e, getEditableHex: t, saturationAreaRef: n, hueSliderRef: r, disabled: i, readonly: a }) => {
129
+ let o = Y(he(t())) ?? {
130
+ hue: 0,
131
+ saturation: 0,
132
+ value: 0
133
+ }, s = A(o.hue), c = A(o.saturation), l = A(o.value), u = A(!1), d = A(!1), f = A(!1), p = j(null), m = j(null), h = g(() => X({
134
+ hue: s.value,
135
+ saturation: c.value,
136
+ value: l.value
137
+ })), _ = g(() => X({
138
+ hue: s.value,
139
+ saturation: 1,
140
+ value: 1
141
+ })), v = (e) => {
142
+ s.value = Math.max(0, Math.min(360, e));
143
+ }, y = (e, t) => {
144
+ c.value = Math.max(0, Math.min(1, e)), l.value = Math.max(0, Math.min(1, t));
145
+ }, b = (e) => {
146
+ let t = Y(he(e));
147
+ t && (u.value = !0, t.saturation > 0 && (s.value = t.hue), c.value = t.saturation, l.value = t.value, u.value = !1);
148
+ }, x = () => {
149
+ let e = t();
150
+ e && e.toUpperCase() !== h.value.toUpperCase() && b(e);
151
+ }, S = () => {
152
+ let n = h.value;
153
+ t()?.toUpperCase() !== n.toUpperCase() && (u.value = !0, e.value = n, u.value = !1);
154
+ };
155
+ R([
156
+ s,
157
+ c,
158
+ l
159
+ ], () => {
160
+ u.value || S();
161
+ }), R(e, () => {
162
+ u.value || x();
163
+ }), O(() => {
164
+ T(() => {
165
+ C(), w(), x();
166
+ });
167
+ });
168
+ let C = () => {
169
+ p.value = n.value?.getBoundingClientRect() ?? null;
170
+ }, w = () => {
171
+ m.value = r.value?.getBoundingClientRect() ?? null;
172
+ }, E = g(() => {
173
+ let e = p.value;
174
+ return e ? { transform: `translate3d(calc(${c.value * e.width}px - 50%), calc(${(1 - l.value) * e.height}px - 50%), 0)` } : {};
175
+ }), D = g(() => {
176
+ let e = m.value;
177
+ return e ? { transform: `translate3d(-50%, calc(${s.value / 360 * e.height}px - 50%), 0)` } : {};
178
+ }), k = () => !i.value && !a.value, M = (e) => {
179
+ let t = p.value;
180
+ if (!t) return;
181
+ let n = Math.max(0, Math.min(e.clientX - t.left, t.width)), r = Math.max(0, Math.min(e.clientY - t.top, t.height));
182
+ y(n / t.width, 1 - r / t.height);
183
+ }, N = (e) => {
184
+ let t = m.value;
185
+ t && v(Math.max(0, Math.min(e.clientY - t.top, t.height)) / t.height * 360);
186
+ }, P = (e) => {
187
+ k() && (C(), d.value = !0, M(e), e.currentTarget instanceof HTMLElement && e.currentTarget.setPointerCapture(e.pointerId));
188
+ }, F = (e) => {
189
+ k() && (w(), f.value = !0, N(e), e.currentTarget instanceof HTMLElement && e.currentTarget.setPointerCapture(e.pointerId));
190
+ }, I = () => {
191
+ d.value = !1;
192
+ }, L = () => {
193
+ f.value = !1;
194
+ };
195
+ return U(n, "pointermove", (e) => {
196
+ d.value && M(e);
197
+ }), U(n, "pointerup", I), U(n, "pointercancel", I), U(n, "lostpointercapture", I), U(r, "pointermove", (e) => {
198
+ f.value && N(e);
199
+ }), U(r, "pointerup", L), U(r, "pointercancel", L), U(r, "lostpointercapture", L), {
200
+ hexColor: h,
201
+ hueBackground: _,
202
+ saturationPointerStyle: E,
203
+ huePointerStyle: D,
204
+ handleSaturationPointerDown: P,
205
+ handleHuePointerDown: F,
206
+ syncFromModelValue: x
207
+ };
208
+ }, _e = (e) => {
209
+ if (!e) return null;
210
+ let t = e.$el;
211
+ if (!(t instanceof HTMLElement)) return null;
212
+ let n = t.querySelector(".s-ui-color-swatch__fill");
213
+ return n instanceof HTMLElement ? n : null;
214
+ }, ve = { class: "s-ui-color-area__canvas-row" }, ye = ["aria-label"], be = ["aria-label", "aria-disabled"], xe = /* @__PURE__ */ S({
215
+ __name: "SColorArea",
216
+ props: /*@__PURE__*/ C({
217
+ disabled: {
218
+ type: Boolean,
219
+ default: !1
220
+ },
221
+ readonly: {
222
+ type: Boolean,
223
+ default: !1
224
+ }
225
+ }, {
226
+ modelValue: { required: !0 },
227
+ modelModifiers: {}
228
+ }),
229
+ emits: ["update:modelValue"],
230
+ setup(e) {
231
+ let t = F(e, "modelValue"), { t: n } = H(), r = I("colorResolutionSwatchRef"), i = I("saturationAreaRef"), o = I("hueSliderRef"), s = () => ue(t.value, _e(r.value)), c = g(() => a(t.value)), { hexColor: l, hueBackground: u, saturationPointerStyle: d, huePointerStyle: f, handleSaturationPointerDown: p, handleHuePointerDown: m } = ge({
232
+ modelValue: t,
233
+ getEditableHex: s,
234
+ saturationAreaRef: i,
235
+ hueSliderRef: o,
236
+ disabled: N(() => e.disabled),
237
+ readonly: N(() => e.readonly)
238
+ });
239
+ return (t, a) => (k(), v("div", w({ class: ["s-ui-color-area", {
240
+ "s-ui-color-area--disabled": e.disabled,
241
+ "s-ui-color-area--readonly": e.readonly
242
+ }] }, t.$attrs), [x(P(ee), {
243
+ ref_key: "colorResolutionSwatchRef",
244
+ ref: r,
245
+ class: "s-ui-color-area__color-resolution",
246
+ color: c.value,
247
+ size: P(V).SIZE_24,
248
+ tabindex: "-1",
249
+ "aria-hidden": "true"
250
+ }, null, 8, ["color", "size"]), y("div", ve, [y("div", {
251
+ ref_key: "saturationAreaRef",
252
+ ref: i,
253
+ class: "s-ui-color-area__canvas",
254
+ role: "img",
255
+ "aria-label": P(n)("colorArea.saturationBrightness"),
256
+ style: D({ "--s-ui-color-area-hue": P(u) }),
257
+ onPointerdown: a[0] ||= (...e) => P(p) && P(p)(...e)
258
+ }, [y("div", {
259
+ class: "s-ui-color-area__canvas-pointer",
260
+ style: D({
261
+ ...P(d),
262
+ backgroundColor: P(l)
263
+ })
264
+ }, null, 4)], 44, ye), y("div", {
265
+ ref_key: "hueSliderRef",
266
+ ref: o,
267
+ class: "s-ui-color-area__hue",
268
+ role: "slider",
269
+ "aria-label": P(n)("colorArea.hue"),
270
+ "aria-valuemin": "0",
271
+ "aria-valuemax": "360",
272
+ "aria-disabled": e.disabled || e.readonly,
273
+ onPointerdown: a[1] ||= (...e) => P(m) && P(m)(...e)
274
+ }, [y("div", {
275
+ class: "s-ui-color-area__hue-pointer",
276
+ style: D({
277
+ ...P(f),
278
+ backgroundColor: P(u)
279
+ })
280
+ }, null, 4)], 40, be)])], 16));
281
+ }
282
+ }), Se = { class: "s-ui-color-values__left" }, Ce = { class: "s-ui-color-values__format" }, we = { class: "s-ui-color-values__value-group" }, Te = { class: "s-ui-color-values__inputs" }, Ee = {
283
+ key: 0,
284
+ class: "s-ui-color-values__input-wrap"
285
+ }, De = [
286
+ "disabled",
287
+ "readonly",
288
+ "aria-label"
289
+ ], Oe = { class: "s-ui-color-values__input-wrap" }, ke = [
290
+ "disabled",
291
+ "readonly",
292
+ "aria-label"
293
+ ], Ae = { class: "s-ui-color-values__input-wrap" }, je = [
294
+ "disabled",
295
+ "readonly",
296
+ "aria-label"
297
+ ], Me = { class: "s-ui-color-values__input-wrap" }, Ne = [
298
+ "disabled",
299
+ "readonly",
300
+ "aria-label"
301
+ ], $ = /* @__PURE__ */ S({
302
+ __name: "SColorValues",
303
+ props: /*@__PURE__*/ C({
304
+ disabled: {
305
+ type: Boolean,
306
+ default: !1
307
+ },
308
+ readonly: {
309
+ type: Boolean,
310
+ default: !1
311
+ },
312
+ formats: { default: () => Z }
313
+ }, {
314
+ modelValue: { required: !0 },
315
+ modelModifiers: {},
316
+ format: { default: n.HEX },
317
+ formatModifiers: {}
318
+ }),
319
+ emits: /*@__PURE__*/ C(["formatDropdownOpen", "formatDropdownClose"], ["update:modelValue", "update:format"]),
320
+ setup(e, { emit: t }) {
321
+ let { t: r } = H(), i = F(e, "modelValue"), o = F(e, "format"), d = t, f = I("previewSwatchRef"), p = A(""), _ = A("0"), b = A("0"), S = A("0"), C = g(() => (e.formats.length > 0 ? e.formats : Z).map((e) => ({
322
+ value: e,
323
+ label: ce[e]
324
+ }))), E = g(() => a(i.value)), D = g(() => ue(i.value, _e(f.value))), j = g(() => o.value === n.RGB ? r("colorValues.redChannel") : r("colorValues.hueChannel")), M = g(() => o.value === n.RGB ? r("colorValues.greenChannel") : r("colorValues.saturationChannel")), N = g(() => o.value === n.RGB ? r("colorValues.blueChannel") : r("colorValues.lightnessChannel")), z = () => {
325
+ let e = D.value;
326
+ if (!e) return;
327
+ let t = de(e, o.value);
328
+ if (o.value === n.HEX && typeof t == "string") {
329
+ p.value = t;
330
+ return;
331
+ }
332
+ typeof t == "object" && (_.value = String(t.first), b.value = String(t.second), S.value = String(t.third));
333
+ };
334
+ R([
335
+ i,
336
+ o,
337
+ D
338
+ ], () => {
339
+ z();
340
+ }), O(() => {
341
+ T(() => {
342
+ z();
343
+ });
344
+ });
345
+ let U = () => {
346
+ if (e.disabled || e.readonly) return;
347
+ if (o.value === n.HEX) {
348
+ let e = fe(n.HEX, p.value);
349
+ e && (i.value = e), z();
350
+ return;
351
+ }
352
+ let t = fe(o.value, {
353
+ first: Number.parseInt(_.value, 10),
354
+ second: Number.parseInt(b.value, 10),
355
+ third: Number.parseInt(S.value, 10)
356
+ });
357
+ t && (i.value = t), z();
358
+ }, W = (e) => {
359
+ e.key === "Enter" && (e.preventDefault(), U());
360
+ };
361
+ return (t, i) => (k(), v("div", w({ class: ["s-ui-color-values", {
362
+ "s-ui-color-values--disabled": e.disabled,
363
+ "s-ui-color-values--readonly": e.readonly
364
+ }] }, t.$attrs), [y("div", Se, [x(P(ee), {
365
+ ref_key: "previewSwatchRef",
366
+ ref: f,
367
+ class: "s-ui-color-values__preview",
368
+ color: E.value,
369
+ size: P(V).SIZE_32,
370
+ disabled: e.disabled,
371
+ tabindex: "-1",
372
+ "aria-hidden": "true"
373
+ }, null, 8, [
374
+ "color",
375
+ "size",
376
+ "disabled"
377
+ ]), y("div", Ce, [x(P(m), {
378
+ modelValue: o.value,
379
+ "onUpdate:modelValue": i[0] ||= (e) => o.value = e,
380
+ class: "s-ui-color-values__format-select",
381
+ options: C.value,
382
+ disabled: e.disabled,
383
+ readonly: e.readonly,
384
+ bordered: !0,
385
+ clearable: !1,
386
+ "close-on-select": !0,
387
+ "fit-viewport": !1,
388
+ "aria-label": P(r)("colorValues.format"),
389
+ onOpen: i[1] ||= (e) => d("formatDropdownOpen"),
390
+ onClose: i[2] ||= (e) => d("formatDropdownClose")
391
+ }, null, 8, [
392
+ "modelValue",
393
+ "options",
394
+ "disabled",
395
+ "readonly",
396
+ "aria-label"
397
+ ])])]), y("div", we, [
398
+ x(P(u), {
399
+ class: "s-ui-color-values__pipette",
400
+ appearance: P(l).BARE,
401
+ variant: P(c).NEUTRAL,
402
+ size: P(s).SMALL,
403
+ icon: "pipette",
404
+ "aria-label": P(r)("colorValues.pickColor"),
405
+ "aria-disabled": "true",
406
+ disabled: e.disabled,
407
+ tabindex: "-1"
408
+ }, null, 8, [
409
+ "appearance",
410
+ "variant",
411
+ "size",
412
+ "aria-label",
413
+ "disabled"
414
+ ]),
415
+ i[9] ||= y("span", {
416
+ class: "s-ui-color-values__separator",
417
+ "aria-hidden": "true"
418
+ }, null, -1),
419
+ y("div", Te, [o.value === P(n).HEX ? (k(), v("div", Ee, [B(y("input", {
420
+ "onUpdate:modelValue": i[3] ||= (e) => p.value = e,
421
+ class: "s-ui-color-values__input s-ui-typography-body-14-regular",
422
+ type: "text",
423
+ inputmode: "text",
424
+ spellcheck: "false",
425
+ disabled: e.disabled,
426
+ readonly: e.readonly,
427
+ "aria-label": P(r)("colorValues.hexValue"),
428
+ onBlur: U,
429
+ onKeydown: W
430
+ }, null, 40, De), [[L, p.value]])])) : (k(), v(h, { key: 1 }, [
431
+ y("div", Oe, [B(y("input", {
432
+ "onUpdate:modelValue": i[4] ||= (e) => _.value = e,
433
+ class: "s-ui-color-values__input s-ui-typography-body-14-regular",
434
+ type: "text",
435
+ inputmode: "numeric",
436
+ spellcheck: "false",
437
+ disabled: e.disabled,
438
+ readonly: e.readonly,
439
+ "aria-label": j.value,
440
+ onBlur: U,
441
+ onKeydown: W
442
+ }, null, 40, ke), [[L, _.value]])]),
443
+ i[7] ||= y("span", {
444
+ class: "s-ui-color-values__separator",
445
+ "aria-hidden": "true"
446
+ }, null, -1),
447
+ y("div", Ae, [B(y("input", {
448
+ "onUpdate:modelValue": i[5] ||= (e) => b.value = e,
449
+ class: "s-ui-color-values__input s-ui-typography-body-14-regular",
450
+ type: "text",
451
+ inputmode: "numeric",
452
+ spellcheck: "false",
453
+ disabled: e.disabled,
454
+ readonly: e.readonly,
455
+ "aria-label": M.value,
456
+ onBlur: U,
457
+ onKeydown: W
458
+ }, null, 40, je), [[L, b.value]])]),
459
+ i[8] ||= y("span", {
460
+ class: "s-ui-color-values__separator",
461
+ "aria-hidden": "true"
462
+ }, null, -1),
463
+ y("div", Me, [B(y("input", {
464
+ "onUpdate:modelValue": i[6] ||= (e) => S.value = e,
465
+ class: "s-ui-color-values__input s-ui-typography-body-14-regular",
466
+ type: "text",
467
+ inputmode: "numeric",
468
+ spellcheck: "false",
469
+ disabled: e.disabled,
470
+ readonly: e.readonly,
471
+ "aria-label": N.value,
472
+ onBlur: U,
473
+ onKeydown: W
474
+ }, null, 40, Ne), [[L, S.value]])])
475
+ ], 64))])
476
+ ])], 16));
477
+ }
478
+ }), Pe = { class: "s-ui-color-picker__section" }, Fe = { class: "s-ui-color-picker__label" }, Ie = { class: "s-ui-color-picker__section" }, Le = { class: "s-ui-color-picker__label" }, Re = { class: "s-ui-color-picker__custom-editor" }, ze = { class: "s-ui-color-picker__custom-actions" }, Be = /* @__PURE__ */ S({
479
+ __name: "SColorPicker",
480
+ props: /*@__PURE__*/ C({
481
+ disabled: {
482
+ type: Boolean,
483
+ default: !1
484
+ },
485
+ recommendedColors: {},
486
+ recentColors: { default: () => [] }
487
+ }, {
488
+ modelValue: {},
489
+ modelModifiers: {}
490
+ }),
491
+ emits: /*@__PURE__*/ C([
492
+ "select",
493
+ "customEditorOpen",
494
+ "customEditorClose",
495
+ "formatDropdownOpen",
496
+ "formatDropdownClose"
497
+ ], ["update:modelValue"]),
498
+ setup(e, { emit: a }) {
499
+ let o = F(e, "modelValue"), m = a, { t: h } = H(), v = A(!1), S = A("#526DE3"), C = A(n.HEX), T = g(() => e.recommendedColors && e.recommendedColors.length > 0 ? e.recommendedColors : r), D = g(() => e.recentColors.length <= 17 ? e.recentColors : e.recentColors.slice(0, 17)), O = () => {
500
+ if (o.value) {
501
+ S.value = o.value;
502
+ return;
503
+ }
504
+ S.value = "#526DE3";
505
+ }, j = (e) => {
506
+ m("select", e);
507
+ }, N = () => {
508
+ o.value = S.value, m("select", S.value), v.value = !1;
509
+ }, I = () => {
510
+ v.value = !1;
511
+ };
512
+ return R(v, (e, t) => {
513
+ if (e && !t) {
514
+ O(), m("customEditorOpen");
515
+ return;
516
+ }
517
+ !e && t && m("customEditorClose");
518
+ }), (n, r) => (k(), _(P(p), w({ width: 336 }, n.$attrs), {
519
+ default: z(() => [y("div", { class: E(["s-ui-color-picker", { "s-ui-color-picker--disabled": e.disabled }]) }, [y("section", Pe, [y("span", Fe, M(P(h)("colorPicker.recommendedColors")), 1), x(P(i), {
520
+ modelValue: o.value,
521
+ "onUpdate:modelValue": r[0] ||= (e) => o.value = e,
522
+ class: "s-ui-color-picker__palette",
523
+ layout: P(t).GRID,
524
+ colors: T.value,
525
+ size: P(V).SIZE_32,
526
+ disabled: e.disabled,
527
+ onSelect: j
528
+ }, null, 8, [
529
+ "modelValue",
530
+ "layout",
531
+ "colors",
532
+ "size",
533
+ "disabled"
534
+ ])]), y("section", Ie, [y("span", Le, M(P(h)("colorPicker.recentColors")), 1), x(P(i), {
535
+ modelValue: o.value,
536
+ "onUpdate:modelValue": r[7] ||= (e) => o.value = e,
537
+ class: "s-ui-color-picker__palette",
538
+ layout: P(t).ROW,
539
+ colors: D.value,
540
+ size: P(V).SIZE_32,
541
+ disabled: e.disabled,
542
+ onSelect: j
543
+ }, {
544
+ append: z(() => [x(P(f), {
545
+ modelValue: v.value,
546
+ "onUpdate:modelValue": r[6] ||= (e) => v.value = e,
547
+ placement: P(d).RIGHT_START,
548
+ offset: 8,
549
+ shift: !0,
550
+ flip: !0,
551
+ disabled: e.disabled,
552
+ "dismiss-on-click-outside": !0,
553
+ "dismiss-on-escape": !0
554
+ }, {
555
+ trigger: z(({ toggle: t, triggerProps: n }) => [x(P(u), w(n, {
556
+ class: "s-ui-color-picker__add-button",
557
+ appearance: P(l).OUTLINED,
558
+ variant: P(c).NEUTRAL,
559
+ size: P(s).SMALL,
560
+ icon: "plus",
561
+ "aria-label": P(h)("colorPicker.addCustomColor"),
562
+ disabled: e.disabled,
563
+ onClick: t
564
+ }), null, 16, [
565
+ "appearance",
566
+ "variant",
567
+ "size",
568
+ "aria-label",
569
+ "disabled",
570
+ "onClick"
571
+ ])]),
572
+ content: z(() => [x(P(p), { width: 320 }, {
573
+ footer: z(() => [y("div", ze, [x(P(u), {
574
+ class: "s-ui-color-picker__save-button",
575
+ appearance: P(l).MAJOR,
576
+ variant: P(c).MAIN,
577
+ size: P(s).SMALL,
578
+ disabled: e.disabled,
579
+ onClick: N
580
+ }, {
581
+ default: z(() => [b(M(P(h)("colorPicker.save")), 1)]),
582
+ _: 1
583
+ }, 8, [
584
+ "appearance",
585
+ "variant",
586
+ "size",
587
+ "disabled"
588
+ ]), x(P(u), {
589
+ class: "s-ui-color-picker__cancel-button",
590
+ appearance: P(l).MINOR,
591
+ variant: P(c).NEUTRAL,
592
+ size: P(s).SMALL,
593
+ disabled: e.disabled,
594
+ onClick: I
595
+ }, {
596
+ default: z(() => [b(M(P(h)("colorPicker.cancel")), 1)]),
597
+ _: 1
598
+ }, 8, [
599
+ "appearance",
600
+ "variant",
601
+ "size",
602
+ "disabled"
603
+ ])])]),
604
+ default: z(() => [y("div", Re, [x(xe, {
605
+ modelValue: S.value,
606
+ "onUpdate:modelValue": r[1] ||= (e) => S.value = e,
607
+ disabled: e.disabled
608
+ }, null, 8, ["modelValue", "disabled"]), x($, {
609
+ modelValue: S.value,
610
+ "onUpdate:modelValue": r[2] ||= (e) => S.value = e,
611
+ format: C.value,
612
+ "onUpdate:format": r[3] ||= (e) => C.value = e,
613
+ disabled: e.disabled,
614
+ onFormatDropdownOpen: r[4] ||= (e) => m("formatDropdownOpen"),
615
+ onFormatDropdownClose: r[5] ||= (e) => m("formatDropdownClose")
616
+ }, null, 8, [
617
+ "modelValue",
618
+ "format",
619
+ "disabled"
620
+ ])])]),
621
+ _: 1
622
+ })]),
623
+ _: 1
624
+ }, 8, [
625
+ "modelValue",
626
+ "placement",
627
+ "disabled"
628
+ ])]),
629
+ _: 1
630
+ }, 8, [
631
+ "modelValue",
632
+ "layout",
633
+ "colors",
634
+ "size",
635
+ "disabled"
636
+ ])])], 2)]),
637
+ _: 1
638
+ }, 16));
639
+ }
640
+ });
641
+ //#endregion
642
+ export { pe as i, $ as n, xe as r, Be as t };