@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.
- package/CHANGELOG.md +26 -0
- package/dist/SButtonGroup-BOZQSxWY.js +90 -0
- package/dist/SButtonGroup-Cnuo4SzC.cjs +1 -0
- package/dist/SChip-BL47yJ-i.cjs +1 -0
- package/dist/SChip-XCYvlpaS.js +102 -0
- package/dist/{SColorPicker-Cucd749L.cjs → SColorPicker-BFw8CCDr.cjs} +1 -1
- package/dist/{SColorPicker-PI3xoFtS.js → SColorPicker-CTl7cSAO.js} +2 -2
- package/dist/SDropdown-LNVnMol3.cjs +1 -0
- package/dist/SDropdown-LOTCtlCX.js +356 -0
- package/dist/SInput-CRAegYKS.cjs +1 -0
- package/dist/SInput-Csy2uch7.js +224 -0
- package/dist/{SSelect-8RPurgr-.js → SSelect-fLtErA7p.js} +2 -2
- package/dist/{SSelect-BVs3lWQ9.cjs → SSelect-mFCdoFuO.cjs} +1 -1
- package/dist/STextarea-BDyy7Ku5.js +269 -0
- package/dist/STextarea-C4qDIp2k.cjs +1 -0
- package/dist/components/SButtonGroup/SButtonGroup.vue.d.ts.map +1 -1
- package/dist/components/SButtonGroup/utils/context.d.ts.map +1 -1
- package/dist/components/SChip/SChip.types.d.ts +4 -0
- package/dist/components/SChip/SChip.types.d.ts.map +1 -1
- package/dist/components/SChip/SChip.vue.d.ts +6 -2
- package/dist/components/SChip/SChip.vue.d.ts.map +1 -1
- package/dist/components/SDropdown/SDropdown.types.d.ts +12 -0
- package/dist/components/SDropdown/SDropdown.types.d.ts.map +1 -1
- package/dist/components/SDropdown/SDropdown.vue.d.ts +23 -2
- package/dist/components/SDropdown/SDropdown.vue.d.ts.map +1 -1
- package/dist/components/SDropdown/index.d.ts +1 -1
- package/dist/components/SDropdown/index.d.ts.map +1 -1
- package/dist/components/SDropdown/parts/SDropdownSheet.types.d.ts +13 -0
- package/dist/components/SDropdown/parts/SDropdownSheet.types.d.ts.map +1 -0
- package/dist/components/SDropdown/parts/SDropdownSheet.vue.d.ts +23 -0
- package/dist/components/SDropdown/parts/SDropdownSheet.vue.d.ts.map +1 -0
- package/dist/components/SDropdown/utils/useDropdownSheetMode.d.ts +7 -0
- package/dist/components/SDropdown/utils/useDropdownSheetMode.d.ts.map +1 -0
- package/dist/components/SDropdown/utils/useSheetDrag.d.ts +18 -0
- package/dist/components/SDropdown/utils/useSheetDrag.d.ts.map +1 -0
- package/dist/components/SInlineGroup/SInlineGroup.types.d.ts +11 -0
- package/dist/components/SInlineGroup/SInlineGroup.types.d.ts.map +1 -0
- package/dist/components/SInlineGroup/SInlineGroup.vue.d.ts +14 -0
- package/dist/components/SInlineGroup/SInlineGroup.vue.d.ts.map +1 -0
- package/dist/components/SInlineGroup/index.d.ts +4 -0
- package/dist/components/SInlineGroup/index.d.ts.map +1 -0
- package/dist/components/SInput/SInput.types.d.ts +5 -1
- package/dist/components/SInput/SInput.types.d.ts.map +1 -1
- package/dist/components/SInput/SInput.vue.d.ts.map +1 -1
- package/dist/components/STextarea/STextarea.vue.d.ts.map +1 -1
- package/dist/composables/useFieldAttrs.d.ts +22 -0
- package/dist/composables/useFieldAttrs.d.ts.map +1 -0
- package/dist/composables/useFieldFilled.d.ts +19 -0
- package/dist/composables/useFieldFilled.d.ts.map +1 -0
- package/dist/entries/button-group.cjs +1 -1
- package/dist/entries/button-group.js +1 -1
- package/dist/entries/chip.cjs +1 -1
- package/dist/entries/chip.js +1 -1
- package/dist/entries/color-picker.cjs +1 -1
- package/dist/entries/color-picker.js +1 -1
- package/dist/entries/dropdown.cjs +1 -1
- package/dist/entries/dropdown.d.ts +2 -2
- package/dist/entries/dropdown.d.ts.map +1 -1
- package/dist/entries/dropdown.js +2 -2
- package/dist/entries/input.cjs +1 -1
- package/dist/entries/input.js +1 -1
- package/dist/entries/select.cjs +1 -1
- package/dist/entries/select.js +1 -1
- package/dist/entries/textarea.cjs +1 -1
- package/dist/entries/textarea.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +137 -137
- package/dist/uikit-components.css +1 -1
- package/dist/useFieldMessages-2TaArixP.cjs +1 -0
- package/dist/useFieldMessages-C-GXaf_q.js +43 -0
- package/package.json +2 -2
- package/dist/SButtonGroup-BPy2YaEP.cjs +0 -1
- package/dist/SButtonGroup-CmSlYnSv.js +0 -72
- package/dist/SChip-DRz5BA4Z.cjs +0 -1
- package/dist/SChip-DvPazz7Y.js +0 -67
- package/dist/SDropdown-CTQ5Qlez.js +0 -175
- package/dist/SDropdown-_QUOP-rw.cjs +0 -1
- package/dist/SInput-C-_R5pug.js +0 -204
- package/dist/SInput-Cw8pt9Sr.cjs +0 -1
- package/dist/STextarea-CFOemAYa.js +0 -264
- package/dist/STextarea-Dg-Dy3ZT.cjs +0 -1
- package/dist/useFieldMessages-Cb06My1W.js +0 -30
- package/dist/useFieldMessages-CzjU0ajM.cjs +0 -1
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
import { n as e, t } from "./SInlineMessage-Dirk5RwO.js";
|
|
2
|
-
import { t as n } from "./SLabel-FHHPlcKq.js";
|
|
3
|
-
import { n as r, t as i } from "./useFieldMessages-Cb06My1W.js";
|
|
4
|
-
import { Fragment as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createTextVNode as d, defineComponent as f, mergeModels as p, mergeProps as m, nextTick as h, normalizeClass as g, onScopeDispose as _, openBlock as v, ref as y, renderList as b, toDisplayString as x, unref as S, useAttrs as C, useId as w, useModel as T, useTemplateRef as E, vModelText as D, watch as O, withCtx as k, withDirectives as ee } from "vue";
|
|
5
|
-
import { useEventListener as A } from "@vueuse/core";
|
|
6
|
-
//#region src/composables/useResizeAutoScroll.ts
|
|
7
|
-
var j = 20, M = 96, N = 12, P = [
|
|
8
|
-
"auto",
|
|
9
|
-
"scroll",
|
|
10
|
-
"overlay"
|
|
11
|
-
], F = (e) => P.some((t) => t === e), I = (e) => {
|
|
12
|
-
if (e instanceof HTMLElement) {
|
|
13
|
-
let { top: t, bottom: n } = e.getBoundingClientRect();
|
|
14
|
-
return {
|
|
15
|
-
top: t,
|
|
16
|
-
bottom: n
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
return {
|
|
20
|
-
top: 0,
|
|
21
|
-
bottom: window.innerHeight
|
|
22
|
-
};
|
|
23
|
-
}, L = (e) => {
|
|
24
|
-
if (e <= 0) return N;
|
|
25
|
-
if (e >= M) return 0;
|
|
26
|
-
let t = 1 - e / M;
|
|
27
|
-
return N * t * t;
|
|
28
|
-
}, R = (e, t, n) => {
|
|
29
|
-
let r = e - t;
|
|
30
|
-
if (r < 0) return -12;
|
|
31
|
-
if (r < M) return -L(r);
|
|
32
|
-
let i = n - e;
|
|
33
|
-
return i < 0 ? N : i < M ? L(i) : 0;
|
|
34
|
-
}, z = ({ elementRef: e, isEnabled: t }) => {
|
|
35
|
-
let n = y(!1), r = y(!1), i = y({
|
|
36
|
-
x: 0,
|
|
37
|
-
y: 0
|
|
38
|
-
}), a = y({
|
|
39
|
-
x: 0,
|
|
40
|
-
y: 0
|
|
41
|
-
}), o = y(0), s = null, c = null, l = {
|
|
42
|
-
top: 0,
|
|
43
|
-
bottom: 0
|
|
44
|
-
}, u = () => {
|
|
45
|
-
let t = e.value;
|
|
46
|
-
if (!t) return window;
|
|
47
|
-
let n = t.parentElement;
|
|
48
|
-
for (; n;) {
|
|
49
|
-
let e = getComputedStyle(n);
|
|
50
|
-
if ((F(e.overflowY) || F(e.overflow)) && n.scrollHeight > n.clientHeight) return n;
|
|
51
|
-
n = n.parentElement;
|
|
52
|
-
}
|
|
53
|
-
return window;
|
|
54
|
-
}, d = () => {
|
|
55
|
-
c = u(), l = I(c);
|
|
56
|
-
}, f = () => {
|
|
57
|
-
n.value = !1, r.value = !1, c = null, l = {
|
|
58
|
-
top: 0,
|
|
59
|
-
bottom: 0
|
|
60
|
-
}, s !== null && (cancelAnimationFrame(s), s = null);
|
|
61
|
-
}, p = () => {
|
|
62
|
-
if (!t() || !r.value || !e.value) {
|
|
63
|
-
s = null;
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
d();
|
|
67
|
-
let n = R(a.value.y, l.top, l.bottom);
|
|
68
|
-
n !== 0 && c && c.scrollBy({
|
|
69
|
-
top: n,
|
|
70
|
-
behavior: "auto"
|
|
71
|
-
}), s = requestAnimationFrame(p);
|
|
72
|
-
}, m = () => {
|
|
73
|
-
!t() || r.value || s !== null || (d(), r.value = !0, s = requestAnimationFrame(p));
|
|
74
|
-
}, h = (n) => {
|
|
75
|
-
let r = e.value;
|
|
76
|
-
if (!t() || !r) return !1;
|
|
77
|
-
let { right: i, bottom: a } = r.getBoundingClientRect(), o = i - n.clientX, s = a - n.clientY;
|
|
78
|
-
return o >= 0 && o <= j && s >= 0 && s <= j;
|
|
79
|
-
}, g = (t) => {
|
|
80
|
-
let s = e.value;
|
|
81
|
-
if (t.button !== 0 || !h(t) || !s) {
|
|
82
|
-
f();
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
i.value = {
|
|
86
|
-
x: t.clientX,
|
|
87
|
-
y: t.clientY
|
|
88
|
-
}, a.value = {
|
|
89
|
-
x: t.clientX,
|
|
90
|
-
y: t.clientY
|
|
91
|
-
}, o.value = s.offsetHeight, n.value = !0, r.value = !1;
|
|
92
|
-
}, v = (s) => {
|
|
93
|
-
let c = e.value;
|
|
94
|
-
if (!t() || !n.value || !c) return;
|
|
95
|
-
a.value = {
|
|
96
|
-
x: s.clientX,
|
|
97
|
-
y: s.clientY
|
|
98
|
-
}, r.value && d();
|
|
99
|
-
let l = s.clientX !== i.value.x || s.clientY !== i.value.y, u = Math.abs(c.offsetHeight - o.value) >= 1;
|
|
100
|
-
(l || u) && m();
|
|
101
|
-
};
|
|
102
|
-
return A(e, "pointerdown", g), A(e, "mousedown", g), A(document, "pointermove", v, { passive: !0 }), A(document, "mousemove", v, { passive: !0 }), A(document, "pointerup", f), A(document, "mouseup", f), A(document, "pointercancel", f), A(window, "resize", () => {
|
|
103
|
-
!t() || !r.value || d();
|
|
104
|
-
}, { passive: !0 }), A(window, "blur", f), _(f), { isResizeActive: r };
|
|
105
|
-
}, B = ["inert", "aria-disabled"], V = [
|
|
106
|
-
"id",
|
|
107
|
-
"name",
|
|
108
|
-
"placeholder",
|
|
109
|
-
"disabled",
|
|
110
|
-
"readonly",
|
|
111
|
-
"rows",
|
|
112
|
-
"maxlength",
|
|
113
|
-
"autocomplete"
|
|
114
|
-
], H = {
|
|
115
|
-
key: 1,
|
|
116
|
-
class: "s-ui-textarea__footer"
|
|
117
|
-
}, U = {
|
|
118
|
-
key: 0,
|
|
119
|
-
class: "s-ui-textarea__messages"
|
|
120
|
-
}, W = {
|
|
121
|
-
key: 1,
|
|
122
|
-
class: "s-ui-textarea__counter s-ui-typography-label-12-medium"
|
|
123
|
-
}, G = /* @__PURE__ */ f({
|
|
124
|
-
inheritAttrs: !1,
|
|
125
|
-
__name: "STextarea",
|
|
126
|
-
props: /*@__PURE__*/ p({
|
|
127
|
-
label: {},
|
|
128
|
-
labelProps: {},
|
|
129
|
-
placeholder: {},
|
|
130
|
-
helpMessages: {},
|
|
131
|
-
errorMessages: {},
|
|
132
|
-
bordered: {
|
|
133
|
-
type: Boolean,
|
|
134
|
-
default: !0
|
|
135
|
-
},
|
|
136
|
-
disabled: {
|
|
137
|
-
type: Boolean,
|
|
138
|
-
default: !1
|
|
139
|
-
},
|
|
140
|
-
readonly: {
|
|
141
|
-
type: Boolean,
|
|
142
|
-
default: !1
|
|
143
|
-
},
|
|
144
|
-
maxlength: {},
|
|
145
|
-
counter: { type: Boolean },
|
|
146
|
-
resizable: {
|
|
147
|
-
type: Boolean,
|
|
148
|
-
default: !0
|
|
149
|
-
},
|
|
150
|
-
rows: {},
|
|
151
|
-
autoGrow: {
|
|
152
|
-
type: Boolean,
|
|
153
|
-
default: !1
|
|
154
|
-
},
|
|
155
|
-
resizeAutoScroll: {
|
|
156
|
-
type: Boolean,
|
|
157
|
-
default: !1
|
|
158
|
-
},
|
|
159
|
-
minRows: { default: 1 },
|
|
160
|
-
maxRows: { default: 7 },
|
|
161
|
-
name: {},
|
|
162
|
-
id: {},
|
|
163
|
-
autocomplete: {}
|
|
164
|
-
}, {
|
|
165
|
-
modelValue: { default: "" },
|
|
166
|
-
modelModifiers: {}
|
|
167
|
-
}),
|
|
168
|
-
emits: /*@__PURE__*/ p(["focus", "blur"], ["update:modelValue"]),
|
|
169
|
-
setup(f, { expose: p, emit: _ }) {
|
|
170
|
-
let y = T(f, "modelValue"), A = _, j = C(), M = w(), N = E("textareaElementRef"), { isFocused: P, handleFocus: F, handleFocusOut: I } = r({
|
|
171
|
-
isDisabled: () => f.disabled,
|
|
172
|
-
blurField: () => N.value?.blur(),
|
|
173
|
-
emitFocus: (e) => A("focus", e),
|
|
174
|
-
emitBlur: (e) => A("blur", e)
|
|
175
|
-
});
|
|
176
|
-
z({
|
|
177
|
-
elementRef: N,
|
|
178
|
-
isEnabled: () => f.resizeAutoScroll && f.resizable && !f.autoGrow && !f.disabled && !f.readonly
|
|
179
|
-
});
|
|
180
|
-
let L = (e) => {
|
|
181
|
-
let t = getComputedStyle(e), n = Number.parseFloat(t.lineHeight) || 0, r = Number.parseFloat(t.paddingTop) + Number.parseFloat(t.paddingBottom), i = Number.parseFloat(t.borderTopWidth) + Number.parseFloat(t.borderBottomWidth), a = e.scrollHeight + i, o = n * f.minRows + r + i, s = n * f.maxRows + r + i;
|
|
182
|
-
return {
|
|
183
|
-
height: Math.min(Math.max(a, o), s),
|
|
184
|
-
isOverflowing: a > s
|
|
185
|
-
};
|
|
186
|
-
}, R = () => {
|
|
187
|
-
let e = N.value;
|
|
188
|
-
if (!e) return;
|
|
189
|
-
if (!f.autoGrow) {
|
|
190
|
-
e.style.height = "", e.style.overflowY = "";
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
e.style.height = "auto";
|
|
194
|
-
let { height: t, isOverflowing: n } = L(e);
|
|
195
|
-
e.style.height = `${t}px`, e.style.overflowY = n ? "auto" : "hidden";
|
|
196
|
-
};
|
|
197
|
-
O([
|
|
198
|
-
N,
|
|
199
|
-
y,
|
|
200
|
-
() => f.autoGrow,
|
|
201
|
-
() => f.minRows,
|
|
202
|
-
() => f.maxRows
|
|
203
|
-
], () => h(R), { immediate: !0 });
|
|
204
|
-
let { normalizedHelpMessages: G, normalizedErrorMessages: K, hasErrorMessages: q, hasHelpMessages: J } = i(() => f.helpMessages, () => f.errorMessages), Y = o(() => f.id ? f.id : M), X = o(() => !!f.label), Z = o(() => J.value || q.value), Q = o(() => !(!f.maxlength || f.counter === !1)), te = o(() => Z.value || Q.value), ne = o(() => f.maxlength ? `${y.value.length}/${f.maxlength}` : ""), re = o(() => y.value.length > 0), ie = o(() => ({
|
|
205
|
-
"s-ui-textarea--disabled": f.disabled,
|
|
206
|
-
"s-ui-textarea--readonly": f.readonly
|
|
207
|
-
})), ae = o(() => ({
|
|
208
|
-
"s-ui-textarea__field--bordered": f.bordered,
|
|
209
|
-
"s-ui-textarea__field--borderless": !f.bordered,
|
|
210
|
-
"s-ui-textarea__field--disabled": f.disabled,
|
|
211
|
-
"s-ui-textarea__field--readonly": f.readonly,
|
|
212
|
-
"s-ui-textarea__field--error": q.value,
|
|
213
|
-
"s-ui-textarea__field--filled": re.value,
|
|
214
|
-
"s-ui-textarea__field--focused": P.value,
|
|
215
|
-
"s-ui-textarea__field--resizable": f.resizable && !f.autoGrow && !f.disabled && !f.readonly
|
|
216
|
-
})), $ = () => {
|
|
217
|
-
N.value?.focus();
|
|
218
|
-
}, oe = () => {
|
|
219
|
-
N.value?.blur();
|
|
220
|
-
}, se = (e) => {
|
|
221
|
-
f.disabled || f.readonly || e.target instanceof HTMLElement && e.target !== N.value && $();
|
|
222
|
-
};
|
|
223
|
-
return p({
|
|
224
|
-
blur: oe,
|
|
225
|
-
focus: $,
|
|
226
|
-
textareaElementRef: N
|
|
227
|
-
}), (r, i) => (v(), l("div", { class: g(["s-ui-textarea", ie.value]) }, [
|
|
228
|
-
X.value ? (v(), s(S(n), m({ key: 0 }, f.labelProps, { "html-for": Y.value }), {
|
|
229
|
-
default: k(() => [d(x(f.label), 1)]),
|
|
230
|
-
_: 1
|
|
231
|
-
}, 16, ["html-for"])) : c("", !0),
|
|
232
|
-
u("div", {
|
|
233
|
-
class: g(["s-ui-textarea__field", ae.value]),
|
|
234
|
-
inert: f.disabled ? !0 : void 0,
|
|
235
|
-
"aria-disabled": f.disabled ? !0 : void 0,
|
|
236
|
-
onClick: i[2] ||= (e) => se(e),
|
|
237
|
-
onFocusout: i[3] ||= (...e) => S(I) && S(I)(...e)
|
|
238
|
-
}, [ee(u("textarea", m({
|
|
239
|
-
id: Y.value,
|
|
240
|
-
ref_key: "textareaElementRef",
|
|
241
|
-
ref: N,
|
|
242
|
-
"onUpdate:modelValue": i[0] ||= (e) => y.value = e,
|
|
243
|
-
class: "s-ui-textarea__control s-ui-typography-body-16-regular",
|
|
244
|
-
name: f.name,
|
|
245
|
-
placeholder: f.placeholder,
|
|
246
|
-
disabled: f.disabled,
|
|
247
|
-
readonly: f.readonly,
|
|
248
|
-
rows: f.rows,
|
|
249
|
-
maxlength: f.maxlength,
|
|
250
|
-
autocomplete: f.autocomplete
|
|
251
|
-
}, S(j), { onFocus: i[1] ||= (...e) => S(F) && S(F)(...e) }), null, 16, V), [[D, y.value]])], 42, B),
|
|
252
|
-
te.value ? (v(), l("div", H, [Z.value ? (v(), l("div", U, [(v(!0), l(a, null, b(S(G), (e, n) => (v(), s(S(t), {
|
|
253
|
-
key: `help-${n}`,
|
|
254
|
-
message: e
|
|
255
|
-
}, null, 8, ["message"]))), 128)), (v(!0), l(a, null, b(S(K), (n, r) => (v(), s(S(t), {
|
|
256
|
-
key: `error-${r}`,
|
|
257
|
-
message: n,
|
|
258
|
-
"validation-status": S(e).ERROR
|
|
259
|
-
}, null, 8, ["message", "validation-status"]))), 128))])) : c("", !0), Q.value ? (v(), l("p", W, x(ne.value), 1)) : c("", !0)])) : c("", !0)
|
|
260
|
-
], 2));
|
|
261
|
-
}
|
|
262
|
-
});
|
|
263
|
-
//#endregion
|
|
264
|
-
export { G as t };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./SInlineMessage-gjkMiE-W.cjs"),t=require("./SLabel-DLKfepRW.cjs"),n=require("./useFieldMessages-CzjU0ajM.cjs");let r=require("vue"),i=require("@vueuse/core");var a=20,o=96,s=12,c=[`auto`,`scroll`,`overlay`],l=e=>c.some(t=>t===e),u=e=>{if(e instanceof HTMLElement){let{top:t,bottom:n}=e.getBoundingClientRect();return{top:t,bottom:n}}return{top:0,bottom:window.innerHeight}},d=e=>{if(e<=0)return s;if(e>=o)return 0;let t=1-e/o;return s*t*t},f=(e,t,n)=>{let r=e-t;if(r<0)return-12;if(r<o)return-d(r);let i=n-e;return i<0?s:i<o?d(i):0},p=({elementRef:e,isEnabled:t})=>{let n=(0,r.ref)(!1),o=(0,r.ref)(!1),s=(0,r.ref)({x:0,y:0}),c=(0,r.ref)({x:0,y:0}),d=(0,r.ref)(0),p=null,m=null,h={top:0,bottom:0},g=()=>{let t=e.value;if(!t)return window;let n=t.parentElement;for(;n;){let e=getComputedStyle(n);if((l(e.overflowY)||l(e.overflow))&&n.scrollHeight>n.clientHeight)return n;n=n.parentElement}return window},_=()=>{m=g(),h=u(m)},v=()=>{n.value=!1,o.value=!1,m=null,h={top:0,bottom:0},p!==null&&(cancelAnimationFrame(p),p=null)},y=()=>{if(!t()||!o.value||!e.value){p=null;return}_();let n=f(c.value.y,h.top,h.bottom);n!==0&&m&&m.scrollBy({top:n,behavior:`auto`}),p=requestAnimationFrame(y)},b=()=>{!t()||o.value||p!==null||(_(),o.value=!0,p=requestAnimationFrame(y))},x=n=>{let r=e.value;if(!t()||!r)return!1;let{right:i,bottom:o}=r.getBoundingClientRect(),s=i-n.clientX,c=o-n.clientY;return s>=0&&s<=a&&c>=0&&c<=a},S=t=>{let r=e.value;if(t.button!==0||!x(t)||!r){v();return}s.value={x:t.clientX,y:t.clientY},c.value={x:t.clientX,y:t.clientY},d.value=r.offsetHeight,n.value=!0,o.value=!1},C=r=>{let i=e.value;if(!t()||!n.value||!i)return;c.value={x:r.clientX,y:r.clientY},o.value&&_();let a=r.clientX!==s.value.x||r.clientY!==s.value.y,l=Math.abs(i.offsetHeight-d.value)>=1;(a||l)&&b()};return(0,i.useEventListener)(e,`pointerdown`,S),(0,i.useEventListener)(e,`mousedown`,S),(0,i.useEventListener)(document,`pointermove`,C,{passive:!0}),(0,i.useEventListener)(document,`mousemove`,C,{passive:!0}),(0,i.useEventListener)(document,`pointerup`,v),(0,i.useEventListener)(document,`mouseup`,v),(0,i.useEventListener)(document,`pointercancel`,v),(0,i.useEventListener)(window,`resize`,()=>{!t()||!o.value||_()},{passive:!0}),(0,i.useEventListener)(window,`blur`,v),(0,r.onScopeDispose)(v),{isResizeActive:o}},m=[`inert`,`aria-disabled`],h=[`id`,`name`,`placeholder`,`disabled`,`readonly`,`rows`,`maxlength`,`autocomplete`],g={key:1,class:`s-ui-textarea__footer`},_={key:0,class:`s-ui-textarea__messages`},v={key:1,class:`s-ui-textarea__counter s-ui-typography-label-12-medium`},y=(0,r.defineComponent)({inheritAttrs:!1,__name:`STextarea`,props:(0,r.mergeModels)({label:{},labelProps:{},placeholder:{},helpMessages:{},errorMessages:{},bordered:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},maxlength:{},counter:{type:Boolean},resizable:{type:Boolean,default:!0},rows:{},autoGrow:{type:Boolean,default:!1},resizeAutoScroll:{type:Boolean,default:!1},minRows:{default:1},maxRows:{default:7},name:{},id:{},autocomplete:{}},{modelValue:{default:``},modelModifiers:{}}),emits:(0,r.mergeModels)([`focus`,`blur`],[`update:modelValue`]),setup(i,{expose:a,emit:o}){let s=(0,r.useModel)(i,`modelValue`),c=o,l=(0,r.useAttrs)(),u=(0,r.useId)(),d=(0,r.useTemplateRef)(`textareaElementRef`),{isFocused:f,handleFocus:y,handleFocusOut:b}=n.n({isDisabled:()=>i.disabled,blurField:()=>d.value?.blur(),emitFocus:e=>c(`focus`,e),emitBlur:e=>c(`blur`,e)});p({elementRef:d,isEnabled:()=>i.resizeAutoScroll&&i.resizable&&!i.autoGrow&&!i.disabled&&!i.readonly});let x=e=>{let t=getComputedStyle(e),n=Number.parseFloat(t.lineHeight)||0,r=Number.parseFloat(t.paddingTop)+Number.parseFloat(t.paddingBottom),a=Number.parseFloat(t.borderTopWidth)+Number.parseFloat(t.borderBottomWidth),o=e.scrollHeight+a,s=n*i.minRows+r+a,c=n*i.maxRows+r+a;return{height:Math.min(Math.max(o,s),c),isOverflowing:o>c}},S=()=>{let e=d.value;if(!e)return;if(!i.autoGrow){e.style.height=``,e.style.overflowY=``;return}e.style.height=`auto`;let{height:t,isOverflowing:n}=x(e);e.style.height=`${t}px`,e.style.overflowY=n?`auto`:`hidden`};(0,r.watch)([d,s,()=>i.autoGrow,()=>i.minRows,()=>i.maxRows],()=>(0,r.nextTick)(S),{immediate:!0});let{normalizedHelpMessages:C,normalizedErrorMessages:w,hasErrorMessages:T,hasHelpMessages:E}=n.t(()=>i.helpMessages,()=>i.errorMessages),D=(0,r.computed)(()=>i.id?i.id:u),O=(0,r.computed)(()=>!!i.label),k=(0,r.computed)(()=>E.value||T.value),A=(0,r.computed)(()=>!(!i.maxlength||i.counter===!1)),j=(0,r.computed)(()=>k.value||A.value),M=(0,r.computed)(()=>i.maxlength?`${s.value.length}/${i.maxlength}`:``),N=(0,r.computed)(()=>s.value.length>0),P=(0,r.computed)(()=>({"s-ui-textarea--disabled":i.disabled,"s-ui-textarea--readonly":i.readonly})),F=(0,r.computed)(()=>({"s-ui-textarea__field--bordered":i.bordered,"s-ui-textarea__field--borderless":!i.bordered,"s-ui-textarea__field--disabled":i.disabled,"s-ui-textarea__field--readonly":i.readonly,"s-ui-textarea__field--error":T.value,"s-ui-textarea__field--filled":N.value,"s-ui-textarea__field--focused":f.value,"s-ui-textarea__field--resizable":i.resizable&&!i.autoGrow&&!i.disabled&&!i.readonly})),I=()=>{d.value?.focus()},L=()=>{d.value?.blur()},R=e=>{i.disabled||i.readonly||e.target instanceof HTMLElement&&e.target!==d.value&&I()};return a({blur:L,focus:I,textareaElementRef:d}),(n,a)=>((0,r.openBlock)(),(0,r.createElementBlock)(`div`,{class:(0,r.normalizeClass)([`s-ui-textarea`,P.value])},[O.value?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(t.t),(0,r.mergeProps)({key:0},i.labelProps,{"html-for":D.value}),{default:(0,r.withCtx)(()=>[(0,r.createTextVNode)((0,r.toDisplayString)(i.label),1)]),_:1},16,[`html-for`])):(0,r.createCommentVNode)(``,!0),(0,r.createElementVNode)(`div`,{class:(0,r.normalizeClass)([`s-ui-textarea__field`,F.value]),inert:i.disabled?!0:void 0,"aria-disabled":i.disabled?!0:void 0,onClick:a[2]||=e=>R(e),onFocusout:a[3]||=(...e)=>(0,r.unref)(b)&&(0,r.unref)(b)(...e)},[(0,r.withDirectives)((0,r.createElementVNode)(`textarea`,(0,r.mergeProps)({id:D.value,ref_key:`textareaElementRef`,ref:d,"onUpdate:modelValue":a[0]||=e=>s.value=e,class:`s-ui-textarea__control s-ui-typography-body-16-regular`,name:i.name,placeholder:i.placeholder,disabled:i.disabled,readonly:i.readonly,rows:i.rows,maxlength:i.maxlength,autocomplete:i.autocomplete},(0,r.unref)(l),{onFocus:a[1]||=(...e)=>(0,r.unref)(y)&&(0,r.unref)(y)(...e)}),null,16,h),[[r.vModelText,s.value]])],42,m),j.value?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,g,[k.value?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,_,[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)((0,r.unref)(C),(t,n)=>((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(e.t),{key:`help-${n}`,message:t},null,8,[`message`]))),128)),((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)((0,r.unref)(w),(t,n)=>((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(e.t),{key:`error-${n}`,message:t,"validation-status":(0,r.unref)(e.n).ERROR},null,8,[`message`,`validation-status`]))),128))])):(0,r.createCommentVNode)(``,!0),A.value?((0,r.openBlock)(),(0,r.createElementBlock)(`p`,v,(0,r.toDisplayString)(M.value),1)):(0,r.createCommentVNode)(``,!0)])):(0,r.createCommentVNode)(``,!0)],2))}});Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return y}});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { computed as e, ref as t, toValue as n } from "vue";
|
|
2
|
-
//#region src/composables/useFieldFocus.ts
|
|
3
|
-
var r = (e) => {
|
|
4
|
-
let n = t(!1);
|
|
5
|
-
return {
|
|
6
|
-
isFocused: n,
|
|
7
|
-
handleFocus: (t) => {
|
|
8
|
-
if (e.isDisabled()) {
|
|
9
|
-
e.blurField();
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
n.value || (n.value = !0, e.emitFocus(t));
|
|
13
|
-
},
|
|
14
|
-
handleFocusOut: (t) => {
|
|
15
|
-
if (!(t.currentTarget instanceof HTMLElement)) return;
|
|
16
|
-
let r = t.relatedTarget;
|
|
17
|
-
r instanceof Node && t.currentTarget.contains(r) || n.value && (n.value = !1, e.emitBlur(t));
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
}, i = (e) => e ? typeof e == "string" ? [e] : e.filter((e) => e.length > 0) : [], a = (t, r) => {
|
|
21
|
-
let a = e(() => i(n(t))), o = e(() => i(n(r)));
|
|
22
|
-
return {
|
|
23
|
-
normalizedHelpMessages: a,
|
|
24
|
-
normalizedErrorMessages: o,
|
|
25
|
-
hasHelpMessages: e(() => a.value.length > 0),
|
|
26
|
-
hasErrorMessages: e(() => o.value.length > 0)
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
//#endregion
|
|
30
|
-
export { r as n, a as t };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
let e=require("vue");var t=t=>{let n=(0,e.ref)(!1);return{isFocused:n,handleFocus:e=>{if(t.isDisabled()){t.blurField();return}n.value||(n.value=!0,t.emitFocus(e))},handleFocusOut:e=>{if(!(e.currentTarget instanceof HTMLElement))return;let r=e.relatedTarget;r instanceof Node&&e.currentTarget.contains(r)||n.value&&(n.value=!1,t.emitBlur(e))}}},n=e=>e?typeof e==`string`?[e]:e.filter(e=>e.length>0):[],r=(t,r)=>{let i=(0,e.computed)(()=>n((0,e.toValue)(t))),a=(0,e.computed)(()=>n((0,e.toValue)(r)));return{normalizedHelpMessages:i,normalizedErrorMessages:a,hasHelpMessages:(0,e.computed)(()=>i.value.length>0),hasErrorMessages:(0,e.computed)(()=>a.value.length>0)}};Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return r}});
|