@shtabapp/ui-kit 1.57.0 → 1.59.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 (85) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/SButtonGroup-BOZQSxWY.js +90 -0
  3. package/dist/SButtonGroup-Cnuo4SzC.cjs +1 -0
  4. package/dist/SChip-BL47yJ-i.cjs +1 -0
  5. package/dist/SChip-XCYvlpaS.js +102 -0
  6. package/dist/{SColorPicker-Cucd749L.cjs → SColorPicker-BFw8CCDr.cjs} +1 -1
  7. package/dist/{SColorPicker-PI3xoFtS.js → SColorPicker-CTl7cSAO.js} +2 -2
  8. package/dist/SDropdown-LNVnMol3.cjs +1 -0
  9. package/dist/SDropdown-LOTCtlCX.js +356 -0
  10. package/dist/SInput-CRAegYKS.cjs +1 -0
  11. package/dist/SInput-Csy2uch7.js +224 -0
  12. package/dist/{SSelect-8RPurgr-.js → SSelect-fLtErA7p.js} +2 -2
  13. package/dist/{SSelect-BVs3lWQ9.cjs → SSelect-mFCdoFuO.cjs} +1 -1
  14. package/dist/STextarea-BDyy7Ku5.js +269 -0
  15. package/dist/STextarea-C4qDIp2k.cjs +1 -0
  16. package/dist/components/SButtonGroup/SButtonGroup.vue.d.ts.map +1 -1
  17. package/dist/components/SButtonGroup/utils/context.d.ts.map +1 -1
  18. package/dist/components/SChip/SChip.types.d.ts +4 -0
  19. package/dist/components/SChip/SChip.types.d.ts.map +1 -1
  20. package/dist/components/SChip/SChip.vue.d.ts +6 -2
  21. package/dist/components/SChip/SChip.vue.d.ts.map +1 -1
  22. package/dist/components/SDropdown/SDropdown.types.d.ts +12 -0
  23. package/dist/components/SDropdown/SDropdown.types.d.ts.map +1 -1
  24. package/dist/components/SDropdown/SDropdown.vue.d.ts +23 -2
  25. package/dist/components/SDropdown/SDropdown.vue.d.ts.map +1 -1
  26. package/dist/components/SDropdown/index.d.ts +1 -1
  27. package/dist/components/SDropdown/index.d.ts.map +1 -1
  28. package/dist/components/SDropdown/parts/SDropdownSheet.types.d.ts +13 -0
  29. package/dist/components/SDropdown/parts/SDropdownSheet.types.d.ts.map +1 -0
  30. package/dist/components/SDropdown/parts/SDropdownSheet.vue.d.ts +23 -0
  31. package/dist/components/SDropdown/parts/SDropdownSheet.vue.d.ts.map +1 -0
  32. package/dist/components/SDropdown/utils/useDropdownSheetMode.d.ts +7 -0
  33. package/dist/components/SDropdown/utils/useDropdownSheetMode.d.ts.map +1 -0
  34. package/dist/components/SDropdown/utils/useSheetDrag.d.ts +18 -0
  35. package/dist/components/SDropdown/utils/useSheetDrag.d.ts.map +1 -0
  36. package/dist/components/SInlineGroup/SInlineGroup.types.d.ts +11 -0
  37. package/dist/components/SInlineGroup/SInlineGroup.types.d.ts.map +1 -0
  38. package/dist/components/SInlineGroup/SInlineGroup.vue.d.ts +14 -0
  39. package/dist/components/SInlineGroup/SInlineGroup.vue.d.ts.map +1 -0
  40. package/dist/components/SInlineGroup/index.d.ts +4 -0
  41. package/dist/components/SInlineGroup/index.d.ts.map +1 -0
  42. package/dist/components/SInput/SInput.types.d.ts +5 -1
  43. package/dist/components/SInput/SInput.types.d.ts.map +1 -1
  44. package/dist/components/SInput/SInput.vue.d.ts.map +1 -1
  45. package/dist/components/STextarea/STextarea.vue.d.ts.map +1 -1
  46. package/dist/composables/useFieldAttrs.d.ts +22 -0
  47. package/dist/composables/useFieldAttrs.d.ts.map +1 -0
  48. package/dist/composables/useFieldFilled.d.ts +19 -0
  49. package/dist/composables/useFieldFilled.d.ts.map +1 -0
  50. package/dist/entries/button-group.cjs +1 -1
  51. package/dist/entries/button-group.js +1 -1
  52. package/dist/entries/chip.cjs +1 -1
  53. package/dist/entries/chip.js +1 -1
  54. package/dist/entries/color-picker.cjs +1 -1
  55. package/dist/entries/color-picker.js +1 -1
  56. package/dist/entries/dropdown.cjs +1 -1
  57. package/dist/entries/dropdown.d.ts +2 -2
  58. package/dist/entries/dropdown.d.ts.map +1 -1
  59. package/dist/entries/dropdown.js +2 -2
  60. package/dist/entries/input.cjs +1 -1
  61. package/dist/entries/input.js +1 -1
  62. package/dist/entries/select.cjs +1 -1
  63. package/dist/entries/select.js +1 -1
  64. package/dist/entries/textarea.cjs +1 -1
  65. package/dist/entries/textarea.js +1 -1
  66. package/dist/index.cjs +1 -1
  67. package/dist/index.d.ts +4 -2
  68. package/dist/index.d.ts.map +1 -1
  69. package/dist/index.js +137 -137
  70. package/dist/uikit-components.css +1 -1
  71. package/dist/useFieldMessages-2TaArixP.cjs +1 -0
  72. package/dist/useFieldMessages-C-GXaf_q.js +43 -0
  73. package/package.json +2 -2
  74. package/dist/SButtonGroup-BPy2YaEP.cjs +0 -1
  75. package/dist/SButtonGroup-CmSlYnSv.js +0 -72
  76. package/dist/SChip-DRz5BA4Z.cjs +0 -1
  77. package/dist/SChip-DvPazz7Y.js +0 -67
  78. package/dist/SDropdown-CTQ5Qlez.js +0 -175
  79. package/dist/SDropdown-_QUOP-rw.cjs +0 -1
  80. package/dist/SInput-C-_R5pug.js +0 -204
  81. package/dist/SInput-Cw8pt9Sr.cjs +0 -1
  82. package/dist/STextarea-CFOemAYa.js +0 -264
  83. package/dist/STextarea-Dg-Dy3ZT.cjs +0 -1
  84. package/dist/useFieldMessages-Cb06My1W.js +0 -30
  85. package/dist/useFieldMessages-CzjU0ajM.cjs +0 -1
@@ -0,0 +1,356 @@
1
+ import { i as e, t } from "./useFloatingOverlay-QcumEYEq.js";
2
+ import { Fragment as n, Teleport as r, Transition as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, defineComponent as u, mergeModels as d, mergeProps as f, nextTick as p, normalizeClass as m, normalizeStyle as h, onBeforeUnmount as g, onScopeDispose as _, openBlock as v, ref as y, renderSlot as b, shallowRef as x, toDisplayString as S, toValue as C, unref as w, useId as T, useModel as E, useSlots as D, useTemplateRef as O, watch as k, withCtx as A, withModifiers as j } from "vue";
3
+ import { useUiKitI18n as M } from "@shtabapp/ui-kit-primitives";
4
+ import { useElementHover as N, useEventListener as P, useMediaQuery as F, useScrollLock as I } from "@vueuse/core";
5
+ //#region src/components/SDropdown/SDropdown.types.ts
6
+ var L = 768, R = (e) => {
7
+ let t = y(e.value), n = y(e.value);
8
+ return k(e, (e) => {
9
+ if (e) {
10
+ t.value = !0, n.value = !0;
11
+ return;
12
+ }
13
+ t.value = !1;
14
+ }, { flush: "sync" }), {
15
+ isPanelShown: t,
16
+ isPanelActive: n,
17
+ handlePanelAfterLeave: () => {
18
+ e.value || (n.value = !1);
19
+ }
20
+ };
21
+ }, ee = (e, t) => {
22
+ let n = F(a(() => `(max-width: ${(C(t) || 768) - .02}px)`));
23
+ return a(() => C(e) && n.value);
24
+ }, te = (e) => {
25
+ if (!e) return null;
26
+ let t = e.getBoundingClientRect();
27
+ if (t.width > 0 || t.height > 0) return e;
28
+ let n = e.firstElementChild;
29
+ return n instanceof HTMLElement ? n : e;
30
+ }, z = {
31
+ OVERDRAG_LIMIT: 50,
32
+ CLOSE_DISTANCE_RATIO: .3,
33
+ CLOSE_DISTANCE_LIMIT: 140,
34
+ CLOSE_VELOCITY: .5,
35
+ SETTLE_TIMEOUT: 400,
36
+ INTERACTIVE_SELECTOR: "button, a[href], input, select, textarea, [role=\"button\"], [contenteditable=\"true\"]"
37
+ }, B = (e) => {
38
+ let t = x(0), n = x(!1), r = x(!1), i = null, o = 0, s = 0, c = 0, l = 0, u = 0, d, f = a(() => n.value || r.value), p = () => {
39
+ clearTimeout(d), d = void 0, r.value = !1;
40
+ }, m = () => {
41
+ r.value = !0, clearTimeout(d), d = setTimeout(p, z.SETTLE_TIMEOUT);
42
+ }, h = () => {
43
+ i = null, t.value = 0, n.value = !1, p();
44
+ }, g = () => C(e.popup)?.offsetHeight ?? 0, v = () => {
45
+ let e = l - o;
46
+ if (e <= 0) return !1;
47
+ let t = u - c;
48
+ return (t > 0 ? (l - s) / t : 0) >= z.CLOSE_VELOCITY ? !0 : e >= Math.min(g() * z.CLOSE_DISTANCE_RATIO, z.CLOSE_DISTANCE_LIMIT);
49
+ }, y = (e) => {
50
+ i === null && (e.pointerType === "mouse" && e.button !== 0 || e.target instanceof Element && e.target.closest(z.INTERACTIVE_SELECTOR) || (i = e.pointerId, o = e.clientY, l = e.clientY, s = e.clientY, u = e.timeStamp, c = e.timeStamp, p(), n.value = !0));
51
+ }, b = (e) => {
52
+ i === e.pointerId && (s = l, c = u, l = e.clientY, u = e.timeStamp, t.value = Math.max(e.clientY - o, -z.OVERDRAG_LIMIT));
53
+ }, S = (a) => {
54
+ if (i === a.pointerId) {
55
+ if (i = null, n.value = !1, v()) {
56
+ r.value = !0, t.value = g() + z.OVERDRAG_LIMIT, e.onClose();
57
+ return;
58
+ }
59
+ if (t.value === 0) {
60
+ p();
61
+ return;
62
+ }
63
+ m(), t.value = 0;
64
+ }
65
+ };
66
+ return P(() => C(e.handle), "pointerdown", y), P(window, "pointermove", b), P(window, "pointerup", S), P(window, "pointercancel", S), P(() => C(e.popup), "transitionend", (e) => {
67
+ e.propertyName !== "transform" || n.value || t.value !== 0 || p();
68
+ }), _(() => {
69
+ clearTimeout(d);
70
+ }), {
71
+ isActive: f,
72
+ popupStyles: a(() => {
73
+ if (f.value) return {
74
+ transform: `translate3d(0, ${t.value}px, 0)`,
75
+ transition: r.value ? "transform var(--s-ui-transition-duration-slow) var(--s-ui-transition-easing-standard)" : "none"
76
+ };
77
+ }),
78
+ reset: h
79
+ };
80
+ }, V = ["aria-label"], H = { class: "s-ui-dropdown-sheet__side" }, U = { class: "s-ui-dropdown-sheet__title" }, W = { class: "s-ui-dropdown-sheet__side s-ui-dropdown-sheet__side--end" }, G = ["id"], K = /* @__PURE__ */ u({
81
+ __name: "SDropdownSheet",
82
+ props: {
83
+ open: { type: Boolean },
84
+ title: { default: "" },
85
+ dismissOnOverlayClick: {
86
+ type: Boolean,
87
+ default: !0
88
+ },
89
+ dismissOnEscape: {
90
+ type: Boolean,
91
+ default: !0
92
+ },
93
+ contentId: {}
94
+ },
95
+ emits: ["close"],
96
+ setup(e, { emit: t }) {
97
+ let n = t, { t: r } = M(), a = O("popupRef"), u = O("headerRef"), d = () => n("close"), { isActive: f, popupStyles: m, reset: _ } = B({
98
+ handle: u,
99
+ popup: a,
100
+ onClose: d
101
+ }), y = I(() => typeof document > "u" ? null : document.body), x = () => {
102
+ e.dismissOnOverlayClick && d();
103
+ }, C = (e) => {
104
+ f.value && e.stopPropagation();
105
+ }, T = () => _(), E = null, D = () => {
106
+ let e = document.activeElement;
107
+ E = e instanceof HTMLElement ? e : null;
108
+ }, N = async () => {
109
+ await p();
110
+ let e = a.value;
111
+ !e || e.contains(document.activeElement) || e.focus({ preventScroll: !0 });
112
+ }, F = () => {
113
+ let e = E, t = !!a.value?.contains(document.activeElement);
114
+ E = null, !(!t || !e?.isConnected) && e.focus({ preventScroll: !0 });
115
+ };
116
+ return k(() => e.open, (e) => {
117
+ if (y.value = e, e) {
118
+ D(), N();
119
+ return;
120
+ }
121
+ F();
122
+ }, { immediate: !0 }), P(window, "keydown", (t) => {
123
+ !e.open || !e.dismissOnEscape || t.key !== "Escape" || d();
124
+ }), g(() => {
125
+ y.value = !1;
126
+ }), (t, n) => (v(), o(i, {
127
+ name: "s-ui-dropdown-sheet",
128
+ onAfterLeave: T
129
+ }, {
130
+ default: A(() => [e.open ? (v(), c("div", {
131
+ key: 0,
132
+ class: "s-ui-dropdown-sheet",
133
+ onClick: x
134
+ }, [l("div", {
135
+ ref_key: "popupRef",
136
+ ref: a,
137
+ class: "s-ui-dropdown-sheet__popup",
138
+ style: h(w(m)),
139
+ role: "dialog",
140
+ "aria-modal": "true",
141
+ "aria-label": e.title || w(r)("dropdown.sheet"),
142
+ tabindex: "-1",
143
+ onClickCapture: C,
144
+ onClick: n[0] ||= j(() => {}, ["stop"])
145
+ }, [l("header", {
146
+ ref_key: "headerRef",
147
+ ref: u,
148
+ class: "s-ui-dropdown-sheet__header"
149
+ }, [
150
+ n[1] ||= l("span", {
151
+ class: "s-ui-dropdown-sheet__handle",
152
+ "aria-hidden": "true"
153
+ }, null, -1),
154
+ l("div", H, [b(t.$slots, "header-left")]),
155
+ l("div", U, S(e.title), 1),
156
+ l("div", W, [b(t.$slots, "header-right")])
157
+ ], 512), l("div", {
158
+ id: e.contentId,
159
+ class: "s-ui-dropdown-sheet__content"
160
+ }, [b(t.$slots, "default")], 8, G)], 44, V)])) : s("", !0)]),
161
+ _: 3
162
+ }));
163
+ }
164
+ }), q = ["id"], ne = ["data-placement"], re = { class: "s-ui-dropdown__content" }, J = /* @__PURE__ */ u({
165
+ inheritAttrs: !1,
166
+ __name: "SDropdown",
167
+ props: /*@__PURE__*/ d({
168
+ placement: { default: () => e.BOTTOM_START },
169
+ offset: { default: 8 },
170
+ flip: {
171
+ type: Boolean,
172
+ default: !0
173
+ },
174
+ shift: {
175
+ type: Boolean,
176
+ default: !1
177
+ },
178
+ matchReferenceWidth: {
179
+ type: Boolean,
180
+ default: !1
181
+ },
182
+ fitViewport: {
183
+ type: Boolean,
184
+ default: !1
185
+ },
186
+ surfaceClass: {},
187
+ teleportTo: {
188
+ type: [String, Boolean],
189
+ default: "body"
190
+ },
191
+ dismissOnClickOutside: {
192
+ type: Boolean,
193
+ default: !0
194
+ },
195
+ dismissOnEscape: {
196
+ type: Boolean,
197
+ default: !0
198
+ },
199
+ disabled: {
200
+ type: Boolean,
201
+ default: !1
202
+ },
203
+ reference: { default: null },
204
+ contentId: {},
205
+ viewportPadding: { default: 8 },
206
+ arrow: {
207
+ type: Boolean,
208
+ default: !1
209
+ },
210
+ showOnHover: {
211
+ type: Boolean,
212
+ default: !1
213
+ },
214
+ hoverLeaveDelay: { default: 100 },
215
+ sheet: {
216
+ type: Boolean,
217
+ default: !0
218
+ },
219
+ sheetBreakpoint: { default: () => 768 },
220
+ sheetTitle: { default: "" }
221
+ }, {
222
+ modelValue: {
223
+ type: Boolean,
224
+ default: !1
225
+ },
226
+ modelModifiers: {}
227
+ }),
228
+ emits: ["update:modelValue"],
229
+ setup(u, { expose: d }) {
230
+ let p = E(u, "modelValue"), g = ee(() => u.sheet, () => u.sheetBreakpoint), { isPanelShown: _, isPanelActive: y, handlePanelAfterLeave: x } = R(p), S = (e) => {
231
+ p.value = e;
232
+ }, C = () => S(!1), j = D(), M = O("triggerWrapperRef"), P = O("panelRef"), F = T(), I = T(), L = a(() => u.contentId ?? F), z = a(() => j.trigger ? te(M.value) : u.reference), B = a(() => u.teleportTo !== !1), V = a(() => u.teleportTo === !1 ? "body" : u.teleportTo), H = e.BOTTOM_START, U = () => {
233
+ u.disabled || S(!0);
234
+ }, W = () => {
235
+ u.disabled || (p.value = !p.value);
236
+ }, G = a(() => ({
237
+ id: I,
238
+ "aria-expanded": p.value,
239
+ "aria-haspopup": "dialog",
240
+ "aria-controls": L.value
241
+ })), { panelStyles: J, panelMaxHeight: Y, resolvedPlacement: X, arrowStyles: ie, isArrowOverflow: ae, isPositionReady: oe, updatePosition: se } = t({
242
+ open: () => y.value && !g.value,
243
+ onOpenChange: S,
244
+ reference: () => z.value,
245
+ panel: () => P.value,
246
+ placement: () => u.placement,
247
+ offset: () => u.offset,
248
+ flip: () => u.flip,
249
+ shift: () => u.shift,
250
+ matchReferenceWidth: () => u.matchReferenceWidth,
251
+ fitViewport: () => u.fitViewport,
252
+ dismissOnClickOutside: () => u.dismissOnClickOutside,
253
+ dismissOnEscape: () => u.dismissOnEscape,
254
+ viewportPadding: () => u.viewportPadding,
255
+ arrow: () => u.arrow
256
+ }), Z = a(() => u.showOnHover && !g.value), ce = a(() => Z.value ? z.value : null), le = a(() => Z.value ? P.value : null), Q = N(ce, { delayLeave: u.hoverLeaveDelay }), $ = N(le, { delayLeave: u.hoverLeaveDelay });
257
+ k([
258
+ Q,
259
+ $,
260
+ Z,
261
+ () => u.disabled
262
+ ], () => {
263
+ if (Z.value) {
264
+ if (u.disabled) {
265
+ S(!1);
266
+ return;
267
+ }
268
+ S(Q.value || $.value);
269
+ }
270
+ });
271
+ let ue = a(() => !!Y.value), de = a(() => {
272
+ if (Y.value) return { maxHeight: `${Y.value}px` };
273
+ });
274
+ return k(() => u.disabled, (e) => {
275
+ e && p.value && (p.value = !1);
276
+ }), d({
277
+ updatePosition: se,
278
+ show: U,
279
+ close: C,
280
+ toggle: W
281
+ }), (e, t) => (v(), c(n, null, [w(j).trigger ? (v(), c("span", f({
282
+ key: 0,
283
+ ref_key: "triggerWrapperRef",
284
+ ref: M,
285
+ class: "s-ui-dropdown"
286
+ }, e.$attrs), [b(e.$slots, "trigger", {
287
+ open: p.value,
288
+ toggle: W,
289
+ close: C,
290
+ isSheet: w(g),
291
+ triggerProps: G.value
292
+ })], 16)) : s("", !0), (v(), o(r, {
293
+ to: V.value,
294
+ disabled: !B.value
295
+ }, [w(g) ? (v(), o(K, {
296
+ key: 0,
297
+ open: p.value,
298
+ title: u.sheetTitle,
299
+ "dismiss-on-overlay-click": u.dismissOnClickOutside,
300
+ "dismiss-on-escape": u.dismissOnEscape,
301
+ "content-id": L.value,
302
+ onClose: C
303
+ }, {
304
+ "header-left": A(() => [b(e.$slots, "sheet-header-left", { close: C })]),
305
+ "header-right": A(() => [b(e.$slots, "sheet-header-right", { close: C })]),
306
+ default: A(() => [b(e.$slots, "content", {
307
+ resolvedPlacement: w(H),
308
+ isSheet: !0,
309
+ close: C
310
+ })]),
311
+ _: 3
312
+ }, 8, [
313
+ "open",
314
+ "title",
315
+ "dismiss-on-overlay-click",
316
+ "dismiss-on-escape",
317
+ "content-id"
318
+ ])) : (v(), o(i, {
319
+ key: 1,
320
+ name: "s-ui-dropdown",
321
+ onAfterLeave: w(x)
322
+ }, {
323
+ default: A(() => [w(_) ? (v(), c("div", {
324
+ key: 0,
325
+ id: L.value,
326
+ ref_key: "panelRef",
327
+ ref: P,
328
+ class: m(["s-ui-dropdown__panel", {
329
+ "s-ui-dropdown__panel--match-reference-width": u.matchReferenceWidth,
330
+ "s-ui-dropdown__panel--ready": w(oe)
331
+ }]),
332
+ style: h(w(J)),
333
+ role: "dialog"
334
+ }, [l("div", {
335
+ class: m(["s-ui-dropdown__surface", [u.surfaceClass, {
336
+ "s-ui-dropdown__surface--fit-viewport": ue.value,
337
+ "s-ui-dropdown__surface--with-arrow": u.arrow
338
+ }]]),
339
+ style: h(de.value),
340
+ "data-placement": w(X)
341
+ }, [u.arrow ? (v(), c("div", {
342
+ key: 0,
343
+ class: m(["s-ui-dropdown__arrow", { "s-ui-dropdown__arrow--overflow": w(ae) }]),
344
+ style: h(w(ie)),
345
+ "aria-hidden": "true"
346
+ }, [...t[0] ||= [l("span", { class: "s-ui-dropdown__arrow-outer" }, null, -1), l("span", { class: "s-ui-dropdown__arrow-inner" }, null, -1)]], 6)) : s("", !0), l("div", re, [b(e.$slots, "content", {
347
+ resolvedPlacement: w(X),
348
+ isSheet: !1,
349
+ close: C
350
+ })])], 14, ne)], 14, q)) : s("", !0)]),
351
+ _: 3
352
+ }, 8, ["onAfterLeave"]))], 8, ["to", "disabled"]))], 64));
353
+ }
354
+ });
355
+ //#endregion
356
+ export { L as n, J as t };
@@ -0,0 +1 @@
1
+ const e=require("./SButton.types-UKroD-ev.cjs"),t=require("./SButton-C-z_q5CG.cjs"),n=require("./SInlineMessage-gjkMiE-W.cjs"),r=require("./SLabel-DLKfepRW.cjs"),i=require("./useFieldMessages-2TaArixP.cjs");let a=require("vue"),o=require("@shtabapp/ui-kit-primitives");var s=function(e){return e.NONE=`none`,e.HORIZONTAL=`horizontal`,e.VERTICAL=`vertical`,e}({}),c=e=>()=>e.hasControlSlot()?e.hasValue()===!0:e.value().length>0,l=[`inert`,`aria-disabled`],u={key:0,class:`s-ui-input__prepend`},d={class:`s-ui-input__row`},f={key:0,class:`s-ui-input__prefix`},p=[`id`,`type`,`name`,`placeholder`,`disabled`,`readonly`,`autocomplete`],m={key:0,class:`s-ui-input__inline`},h={key:1,class:`s-ui-input__clear`},g={key:2,class:`s-ui-input__action`},_=16,v=(0,a.defineComponent)({inheritAttrs:!1,__name:`SInput`,props:(0,a.mergeModels)({label:{},labelProps:{},placeholder:{},helpMessages:{},errorMessages:{},bordered:{type:Boolean,default:!0},reserveMessageSpace:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},hasValue:{type:Boolean},focused:{type:Boolean,default:!1},iconLeft:{},iconRight:{},customize:{default:()=>s.NONE},name:{},type:{default:`text`},id:{},autocomplete:{},autofocus:{type:Boolean,default:!1}},{modelValue:{default:``},modelModifiers:{}}),emits:(0,a.mergeModels)([`clear`,`focus`,`blur`],[`update:modelValue`]),setup(v,{expose:y,emit:b}){let x=(0,a.useModel)(v,`modelValue`),{t:S}=(0,o.useUiKitI18n)(),C=b,{rootAttrs:w,controlAttrs:T,errorQa:E}=i.r(),D=(0,a.useSlots)(),O=(0,a.useId)(),k=(0,a.useTemplateRef)(`fieldElementRef`),A=(0,a.useTemplateRef)(`inputElementRef`),{isFocused:j,handleFocus:M,handleFocusOut:N}=i.n({isDisabled:()=>v.disabled,blurField:()=>Q(),emitFocus:e=>C(`focus`,e),emitBlur:e=>C(`blur`,e)}),{normalizedHelpMessages:P,normalizedErrorMessages:F,hasErrorMessages:I,hasHelpMessages:L}=i.t(()=>v.helpMessages,()=>v.errorMessages),R=(0,a.computed)(()=>v.id?v.id:O),z=(0,a.computed)(()=>!!(v.label||D.label)),B=(0,a.computed)(()=>!!(v.iconLeft||D.prefix)),V=(0,a.computed)(()=>v.customize===s.VERTICAL&&!!D.prepend),H=(0,a.computed)(()=>v.customize===s.HORIZONTAL&&!!D.prepend),U=()=>!v.clearable||v.disabled||v.readonly?!1:q(),W=(0,a.computed)(()=>{if(!j.value)return-1}),G=(0,a.computed)(()=>!!(v.iconRight||D.action)),K=(0,a.computed)(()=>!!D.message||L.value||I.value),q=c({hasControlSlot:()=>!!D.control,hasValue:()=>v.hasValue,value:()=>x.value}),J=(0,a.computed)(()=>({"s-ui-input--disabled":v.disabled,"s-ui-input--readonly":v.readonly})),Y=(0,a.computed)(()=>[{"s-ui-input__field--bordered":v.bordered,"s-ui-input__field--borderless":!v.bordered,"s-ui-input__field--disabled":v.disabled,"s-ui-input__field--readonly":v.readonly,"s-ui-input__field--error":I.value,"s-ui-input__field--vertical":v.customize===s.VERTICAL,"s-ui-input__field--focused":j.value||v.focused}]),X=e=>{let t=k.value;t&&t.querySelector(`.s-ui-input__control, .s-ui-select__control, .s-ui-select__search-input, [tabindex]:not([tabindex="-1"])`)?.focus(e)},Z=e=>{if(D.control){X(e);return}A.value?.focus(e)},Q=()=>{if(D.control){let e=document.activeElement;e instanceof HTMLElement&&k.value?.contains(e)&&e.blur();return}A.value?.blur()},$=e=>{v.disabled||v.readonly||e.target instanceof HTMLElement&&(e.target.closest(`.s-ui-input__prepend, .s-ui-input__inline, .s-ui-input__clear, .s-ui-input__action`)||Z())},ee=()=>{x.value=``,C(`clear`),Z()};return(0,a.onMounted)(()=>{v.autofocus&&(0,a.nextTick)(()=>{Z()})}),y({blur:Q,focus:Z,fieldElementRef:k,inputElementRef:A}),(i,c)=>((0,a.openBlock)(),(0,a.createElementBlock)(`div`,(0,a.mergeProps)({class:[`s-ui-input`,J.value]},(0,a.unref)(w)),[z.value?((0,a.openBlock)(),(0,a.createBlock)((0,a.unref)(r.t),(0,a.mergeProps)({key:0},v.labelProps,{"html-for":R.value}),{default:(0,a.withCtx)(()=>[(0,a.renderSlot)(i.$slots,`label`,{},()=>[(0,a.createTextVNode)((0,a.toDisplayString)(v.label),1)])]),_:3},16,[`html-for`])):(0,a.createCommentVNode)(``,!0),(0,a.createElementVNode)(`div`,{ref_key:`fieldElementRef`,ref:k,class:(0,a.normalizeClass)([`s-ui-input__field`,[Y.value,{"s-ui-input__field--filled":(0,a.unref)(q)()}]]),inert:v.disabled?!0:void 0,"aria-disabled":v.disabled?!0:void 0,onClick:c[2]||=e=>$(e),onFocusout:c[3]||=(...e)=>(0,a.unref)(N)&&(0,a.unref)(N)(...e)},[V.value?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,u,[(0,a.renderSlot)(i.$slots,`prepend`,{disabled:v.disabled})])):(0,a.createCommentVNode)(``,!0),(0,a.createElementVNode)(`div`,d,[B.value?((0,a.openBlock)(),(0,a.createElementBlock)(`span`,f,[(0,a.renderSlot)(i.$slots,`prefix`,{disabled:v.disabled},()=>[v.iconLeft?((0,a.openBlock)(),(0,a.createBlock)((0,a.unref)(o.SIcon),{key:0,name:v.iconLeft,size:_},null,8,[`name`])):(0,a.createCommentVNode)(``,!0)])])):(0,a.createCommentVNode)(``,!0),(0,a.createElementVNode)(`div`,{class:(0,a.normalizeClass)([`s-ui-input__control-wrap`,{"s-ui-input__control-wrap--horizontal":v.customize===(0,a.unref)(s).HORIZONTAL}])},[(0,a.renderSlot)(i.$slots,`control`,{disabled:v.disabled},()=>[(0,a.withDirectives)((0,a.createElementVNode)(`input`,(0,a.mergeProps)({id:R.value,ref_key:`inputElementRef`,ref:A,"onUpdate:modelValue":c[0]||=e=>x.value=e,class:`s-ui-input__control s-ui-typography-body-14-regular`,type:v.type,name:v.name,placeholder:v.placeholder,disabled:v.disabled,readonly:v.readonly,autocomplete:v.autocomplete},(0,a.unref)(T),{onFocus:c[1]||=(...e)=>(0,a.unref)(M)&&(0,a.unref)(M)(...e)}),null,16,p),[[a.vModelDynamic,x.value]])]),H.value?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,m,[(0,a.renderSlot)(i.$slots,`prepend`,{disabled:v.disabled})])):(0,a.createCommentVNode)(``,!0)],2),U()?((0,a.openBlock)(),(0,a.createElementBlock)(`span`,h,[(0,a.createVNode)((0,a.unref)(t.t),{appearance:(0,a.unref)(e.t).BARE,variant:(0,a.unref)(e.r).NEUTRAL,size:(0,a.unref)(e.n).SMALL,icon:`closeMini`,"aria-label":(0,a.unref)(S)(`input.clear`),tabindex:W.value,onClick:(0,a.withModifiers)(ee,[`stop`])},null,8,[`appearance`,`variant`,`size`,`aria-label`,`tabindex`])])):(0,a.createCommentVNode)(``,!0),G.value?((0,a.openBlock)(),(0,a.createElementBlock)(`span`,g,[(0,a.renderSlot)(i.$slots,`action`,{disabled:v.disabled},()=>[v.iconRight?((0,a.openBlock)(),(0,a.createBlock)((0,a.unref)(t.t),{key:0,appearance:(0,a.unref)(e.t).BARE,variant:(0,a.unref)(e.r).NEUTRAL,size:(0,a.unref)(e.n).SMALL,disabled:v.disabled,icon:v.iconRight,tabindex:-1},null,8,[`appearance`,`variant`,`size`,`disabled`,`icon`])):(0,a.createCommentVNode)(``,!0)])])):(0,a.createCommentVNode)(``,!0)])],42,l),K.value||v.reserveMessageSpace?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,{key:1,class:(0,a.normalizeClass)([`s-ui-input__messages`,{"s-ui-input__messages--reserved":v.reserveMessageSpace}])},[(0,a.renderSlot)(i.$slots,`message`,{},()=>[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)((0,a.unref)(P),(e,t)=>((0,a.openBlock)(),(0,a.createBlock)((0,a.unref)(n.t),{key:`help-${t}`,message:e},null,8,[`message`]))),128)),((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)((0,a.unref)(F),(e,t)=>((0,a.openBlock)(),(0,a.createBlock)((0,a.unref)(n.t),{key:`error-${t}`,message:e,"data-qa":(0,a.unref)(E),"validation-status":(0,a.unref)(n.n).ERROR},null,8,[`message`,`data-qa`,`validation-status`]))),128))])],2)):(0,a.createCommentVNode)(``,!0)],16))}});Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return v}});
@@ -0,0 +1,224 @@
1
+ import { n as e, r as t, t as n } from "./SButton.types-CpdHQtyx.js";
2
+ import { t as r } from "./SButton-DnU_XZ1C.js";
3
+ import { n as i, t as a } from "./SInlineMessage-Dirk5RwO.js";
4
+ import { t as ee } from "./SLabel-FHHPlcKq.js";
5
+ import { n as o, r as s, t as te } from "./useFieldMessages-C-GXaf_q.js";
6
+ import { Fragment as c, computed as l, createBlock as u, createCommentVNode as d, createElementBlock as f, createElementVNode as p, createTextVNode as m, createVNode as h, defineComponent as g, mergeModels as _, mergeProps as v, nextTick as ne, normalizeClass as y, onMounted as b, openBlock as x, renderList as S, renderSlot as C, toDisplayString as re, unref as w, useId as ie, useModel as ae, useSlots as oe, useTemplateRef as T, vModelDynamic as se, withCtx as ce, withDirectives as le, withModifiers as ue } from "vue";
7
+ import { SIcon as de, useUiKitI18n as fe } from "@shtabapp/ui-kit-primitives";
8
+ //#region src/components/SInput/SInput.types.ts
9
+ var E = /* @__PURE__ */ function(e) {
10
+ return e.NONE = "none", e.HORIZONTAL = "horizontal", e.VERTICAL = "vertical", e;
11
+ }({}), D = (e) => () => e.hasControlSlot() ? e.hasValue() === !0 : e.value().length > 0, O = ["inert", "aria-disabled"], k = {
12
+ key: 0,
13
+ class: "s-ui-input__prepend"
14
+ }, A = { class: "s-ui-input__row" }, j = {
15
+ key: 0,
16
+ class: "s-ui-input__prefix"
17
+ }, M = [
18
+ "id",
19
+ "type",
20
+ "name",
21
+ "placeholder",
22
+ "disabled",
23
+ "readonly",
24
+ "autocomplete"
25
+ ], N = {
26
+ key: 0,
27
+ class: "s-ui-input__inline"
28
+ }, P = {
29
+ key: 1,
30
+ class: "s-ui-input__clear"
31
+ }, F = {
32
+ key: 2,
33
+ class: "s-ui-input__action"
34
+ }, I = 16, L = /* @__PURE__ */ g({
35
+ inheritAttrs: !1,
36
+ __name: "SInput",
37
+ props: /*@__PURE__*/ _({
38
+ label: {},
39
+ labelProps: {},
40
+ placeholder: {},
41
+ helpMessages: {},
42
+ errorMessages: {},
43
+ bordered: {
44
+ type: Boolean,
45
+ default: !0
46
+ },
47
+ reserveMessageSpace: {
48
+ type: Boolean,
49
+ default: !1
50
+ },
51
+ disabled: {
52
+ type: Boolean,
53
+ default: !1
54
+ },
55
+ readonly: {
56
+ type: Boolean,
57
+ default: !1
58
+ },
59
+ clearable: {
60
+ type: Boolean,
61
+ default: !1
62
+ },
63
+ hasValue: { type: Boolean },
64
+ focused: {
65
+ type: Boolean,
66
+ default: !1
67
+ },
68
+ iconLeft: {},
69
+ iconRight: {},
70
+ customize: { default: () => E.NONE },
71
+ name: {},
72
+ type: { default: "text" },
73
+ id: {},
74
+ autocomplete: {},
75
+ autofocus: {
76
+ type: Boolean,
77
+ default: !1
78
+ }
79
+ }, {
80
+ modelValue: { default: "" },
81
+ modelModifiers: {}
82
+ }),
83
+ emits: /*@__PURE__*/ _([
84
+ "clear",
85
+ "focus",
86
+ "blur"
87
+ ], ["update:modelValue"]),
88
+ setup(g, { expose: _, emit: L }) {
89
+ let R = ae(g, "modelValue"), { t: z } = fe(), B = L, { rootAttrs: V, controlAttrs: pe, errorQa: me } = s(), H = oe(), he = ie(), U = T("fieldElementRef"), W = T("inputElementRef"), { isFocused: G, handleFocus: K, handleFocusOut: q } = o({
90
+ isDisabled: () => g.disabled,
91
+ blurField: () => $(),
92
+ emitFocus: (e) => B("focus", e),
93
+ emitBlur: (e) => B("blur", e)
94
+ }), { normalizedHelpMessages: ge, normalizedErrorMessages: _e, hasErrorMessages: J, hasHelpMessages: ve } = te(() => g.helpMessages, () => g.errorMessages), Y = l(() => g.id ? g.id : he), ye = l(() => !!(g.label || H.label)), be = l(() => !!(g.iconLeft || H.prefix)), xe = l(() => g.customize === E.VERTICAL && !!H.prepend), Se = l(() => g.customize === E.HORIZONTAL && !!H.prepend), Ce = () => !g.clearable || g.disabled || g.readonly ? !1 : Z(), X = l(() => {
95
+ if (!G.value) return -1;
96
+ }), we = l(() => !!(g.iconRight || H.action)), Te = l(() => !!H.message || ve.value || J.value), Z = D({
97
+ hasControlSlot: () => !!H.control,
98
+ hasValue: () => g.hasValue,
99
+ value: () => R.value
100
+ }), Ee = l(() => ({
101
+ "s-ui-input--disabled": g.disabled,
102
+ "s-ui-input--readonly": g.readonly
103
+ })), De = l(() => [{
104
+ "s-ui-input__field--bordered": g.bordered,
105
+ "s-ui-input__field--borderless": !g.bordered,
106
+ "s-ui-input__field--disabled": g.disabled,
107
+ "s-ui-input__field--readonly": g.readonly,
108
+ "s-ui-input__field--error": J.value,
109
+ "s-ui-input__field--vertical": g.customize === E.VERTICAL,
110
+ "s-ui-input__field--focused": G.value || g.focused
111
+ }]), Oe = (e) => {
112
+ let t = U.value;
113
+ t && t.querySelector(".s-ui-input__control, .s-ui-select__control, .s-ui-select__search-input, [tabindex]:not([tabindex=\"-1\"])")?.focus(e);
114
+ }, Q = (e) => {
115
+ if (H.control) {
116
+ Oe(e);
117
+ return;
118
+ }
119
+ W.value?.focus(e);
120
+ }, $ = () => {
121
+ if (H.control) {
122
+ let e = document.activeElement;
123
+ e instanceof HTMLElement && U.value?.contains(e) && e.blur();
124
+ return;
125
+ }
126
+ W.value?.blur();
127
+ }, ke = (e) => {
128
+ g.disabled || g.readonly || e.target instanceof HTMLElement && (e.target.closest(".s-ui-input__prepend, .s-ui-input__inline, .s-ui-input__clear, .s-ui-input__action") || Q());
129
+ }, Ae = () => {
130
+ R.value = "", B("clear"), Q();
131
+ };
132
+ return b(() => {
133
+ g.autofocus && ne(() => {
134
+ Q();
135
+ });
136
+ }), _({
137
+ blur: $,
138
+ focus: Q,
139
+ fieldElementRef: U,
140
+ inputElementRef: W
141
+ }), (o, s) => (x(), f("div", v({ class: ["s-ui-input", Ee.value] }, w(V)), [
142
+ ye.value ? (x(), u(w(ee), v({ key: 0 }, g.labelProps, { "html-for": Y.value }), {
143
+ default: ce(() => [C(o.$slots, "label", {}, () => [m(re(g.label), 1)])]),
144
+ _: 3
145
+ }, 16, ["html-for"])) : d("", !0),
146
+ p("div", {
147
+ ref_key: "fieldElementRef",
148
+ ref: U,
149
+ class: y(["s-ui-input__field", [De.value, { "s-ui-input__field--filled": w(Z)() }]]),
150
+ inert: g.disabled ? !0 : void 0,
151
+ "aria-disabled": g.disabled ? !0 : void 0,
152
+ onClick: s[2] ||= (e) => ke(e),
153
+ onFocusout: s[3] ||= (...e) => w(q) && w(q)(...e)
154
+ }, [xe.value ? (x(), f("div", k, [C(o.$slots, "prepend", { disabled: g.disabled })])) : d("", !0), p("div", A, [
155
+ be.value ? (x(), f("span", j, [C(o.$slots, "prefix", { disabled: g.disabled }, () => [g.iconLeft ? (x(), u(w(de), {
156
+ key: 0,
157
+ name: g.iconLeft,
158
+ size: I
159
+ }, null, 8, ["name"])) : d("", !0)])])) : d("", !0),
160
+ p("div", { class: y(["s-ui-input__control-wrap", { "s-ui-input__control-wrap--horizontal": g.customize === w(E).HORIZONTAL }]) }, [C(o.$slots, "control", { disabled: g.disabled }, () => [le(p("input", v({
161
+ id: Y.value,
162
+ ref_key: "inputElementRef",
163
+ ref: W,
164
+ "onUpdate:modelValue": s[0] ||= (e) => R.value = e,
165
+ class: "s-ui-input__control s-ui-typography-body-14-regular",
166
+ type: g.type,
167
+ name: g.name,
168
+ placeholder: g.placeholder,
169
+ disabled: g.disabled,
170
+ readonly: g.readonly,
171
+ autocomplete: g.autocomplete
172
+ }, w(pe), { onFocus: s[1] ||= (...e) => w(K) && w(K)(...e) }), null, 16, M), [[se, R.value]])]), Se.value ? (x(), f("div", N, [C(o.$slots, "prepend", { disabled: g.disabled })])) : d("", !0)], 2),
173
+ Ce() ? (x(), f("span", P, [h(w(r), {
174
+ appearance: w(n).BARE,
175
+ variant: w(t).NEUTRAL,
176
+ size: w(e).SMALL,
177
+ icon: "closeMini",
178
+ "aria-label": w(z)("input.clear"),
179
+ tabindex: X.value,
180
+ onClick: ue(Ae, ["stop"])
181
+ }, null, 8, [
182
+ "appearance",
183
+ "variant",
184
+ "size",
185
+ "aria-label",
186
+ "tabindex"
187
+ ])])) : d("", !0),
188
+ we.value ? (x(), f("span", F, [C(o.$slots, "action", { disabled: g.disabled }, () => [g.iconRight ? (x(), u(w(r), {
189
+ key: 0,
190
+ appearance: w(n).BARE,
191
+ variant: w(t).NEUTRAL,
192
+ size: w(e).SMALL,
193
+ disabled: g.disabled,
194
+ icon: g.iconRight,
195
+ tabindex: -1
196
+ }, null, 8, [
197
+ "appearance",
198
+ "variant",
199
+ "size",
200
+ "disabled",
201
+ "icon"
202
+ ])) : d("", !0)])])) : d("", !0)
203
+ ])], 42, O),
204
+ Te.value || g.reserveMessageSpace ? (x(), f("div", {
205
+ key: 1,
206
+ class: y(["s-ui-input__messages", { "s-ui-input__messages--reserved": g.reserveMessageSpace }])
207
+ }, [C(o.$slots, "message", {}, () => [(x(!0), f(c, null, S(w(ge), (e, t) => (x(), u(w(a), {
208
+ key: `help-${t}`,
209
+ message: e
210
+ }, null, 8, ["message"]))), 128)), (x(!0), f(c, null, S(w(_e), (e, t) => (x(), u(w(a), {
211
+ key: `error-${t}`,
212
+ message: e,
213
+ "data-qa": w(me),
214
+ "validation-status": w(i).ERROR
215
+ }, null, 8, [
216
+ "message",
217
+ "data-qa",
218
+ "validation-status"
219
+ ]))), 128))])], 2)) : d("", !0)
220
+ ], 16));
221
+ }
222
+ });
223
+ //#endregion
224
+ export { E as n, L as t };
@@ -1,8 +1,8 @@
1
1
  import { n as e, r as t, t as n } from "./SButton.types-CpdHQtyx.js";
2
2
  import { t as r } from "./SButton-DnU_XZ1C.js";
3
3
  import { n as i } from "./useSelectionGroup-cKj38lEN.js";
4
- import { t as a } from "./SDropdown-CTQ5Qlez.js";
5
- import { n as o, t as s } from "./SInput-C-_R5pug.js";
4
+ import { t as a } from "./SDropdown-LOTCtlCX.js";
5
+ import { n as o, t as s } from "./SInput-Csy2uch7.js";
6
6
  import { i as c, n as l, r as u, t as d } from "./SList-DhjYsx7q.js";
7
7
  import { t as f } from "./SListItem-BYMbFs2A.js";
8
8
  import { computed as p, createBlock as m, createCommentVNode as h, createElementBlock as g, createElementVNode as _, createSlots as v, createTextVNode as ee, createVNode as y, defineComponent as b, guardReactiveProps as x, isRef as te, mergeModels as S, mergeProps as C, nextTick as w, normalizeClass as T, normalizeProps as E, normalizeStyle as D, openBlock as O, ref as ne, renderSlot as k, toDisplayString as A, toValue as j, unref as M, useId as re, useModel as ie, useSlots as ae, useTemplateRef as N, vModelText as oe, watch as P, withCtx as F, withDirectives as se, withModifiers as ce } from "vue";