@shtabapp/ui-kit 1.50.0 → 1.51.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 +20 -0
- package/dist/{SAvatarGroup-CaqcKGIq.cjs → SAvatarGroup-CTC_esUv.cjs} +1 -1
- package/dist/{SAvatarGroup-MuTqzfYS.js → SAvatarGroup-F5w88NGf.js} +1 -1
- package/dist/{SCard-CrU67ok0.js → SCard-BkmIQd2s.js} +4 -4
- package/dist/SCard-BzIQoACi.cjs +1 -0
- package/dist/SCheckbox-BXV4bPOv.js +76 -0
- package/dist/SCheckbox-D_YLWg6a.cjs +1 -0
- package/dist/SChip-DRz5BA4Z.cjs +1 -0
- package/dist/{SChip-TxpPE0VS.js → SChip-DvPazz7Y.js} +0 -1
- package/dist/{SColorPicker-CeKB3QS1.cjs → SColorPicker-CuuiFxI0.cjs} +1 -1
- package/dist/{SColorPicker-BqsD-5xA.js → SColorPicker-Dl5H4iwH.js} +1 -1
- package/dist/SInput-DJL9QOIG.cjs +1 -0
- package/dist/{SInput-CkanJfLx.js → SInput-ug89CYt3.js} +45 -45
- package/dist/{SList-DAzztC-7.js → SList-BESqVnlh.js} +1 -1
- package/dist/{SList-S18K8mlH.cjs → SList-qQ7B5u8o.cjs} +1 -1
- package/dist/SListItem-DBGDVeoJ.cjs +1 -0
- package/dist/{SListItem-BRXZEePg.js → SListItem-DJ8uSadf.js} +46 -45
- package/dist/SOverflowGroup-CyksOav7.js +79 -0
- package/dist/{SOverflowGroup-DyVUzkNu.cjs → SOverflowGroup-rmU10_7L.cjs} +1 -1
- package/dist/SRadio-BZKPhGwO.js +58 -0
- package/dist/SRadio-CcmuHaKk.cjs +1 -0
- package/dist/SSelect-CMR4dxSn.cjs +1 -0
- package/dist/SSelect-pXiw_NyB.js +680 -0
- package/dist/{STagGroup-BMIwBk-O.cjs → STagGroup-CF2TFkb3.cjs} +1 -1
- package/dist/{STagGroup-wSpc3guU.js → STagGroup-GzZhto7-.js} +1 -1
- package/dist/SToggle-B5EdI-rG.cjs +1 -0
- package/dist/SToggle-BgCgar2U.js +59 -0
- package/dist/components/SCard/SCard.vue.d.ts.map +1 -1
- package/dist/components/SCheckbox/SCheckbox.vue.d.ts.map +1 -1
- package/dist/components/SChip/SChip.vue.d.ts.map +1 -1
- package/dist/components/SList/utils/resolveListItemFields.d.ts +1 -1
- package/dist/components/SList/utils/resolveListItemFields.d.ts.map +1 -1
- package/dist/components/SListItem/SListItem.types.d.ts +2 -1
- package/dist/components/SListItem/SListItem.types.d.ts.map +1 -1
- package/dist/components/SListItem/SListItem.vue.d.ts.map +1 -1
- package/dist/components/SOverflowGroup/SOverflowGroup.vue.d.ts.map +1 -1
- package/dist/components/SRadio/SRadio.vue.d.ts.map +1 -1
- package/dist/components/SSelect/SSelect.types.d.ts +5 -0
- package/dist/components/SSelect/SSelect.types.d.ts.map +1 -1
- package/dist/components/SSelect/SSelect.vue.d.ts.map +1 -1
- package/dist/components/SToggle/SToggle.types.d.ts +6 -0
- package/dist/components/SToggle/SToggle.types.d.ts.map +1 -1
- package/dist/components/SToggle/SToggle.vue.d.ts +11 -1
- package/dist/components/SToggle/SToggle.vue.d.ts.map +1 -1
- package/dist/components/SToggle/index.d.ts +1 -1
- package/dist/components/SToggle/index.d.ts.map +1 -1
- package/dist/entries/avatar-group.cjs +1 -1
- package/dist/entries/avatar-group.js +1 -1
- package/dist/entries/card.cjs +1 -1
- package/dist/entries/card.js +1 -1
- package/dist/entries/checkbox.cjs +1 -1
- package/dist/entries/checkbox.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/input.cjs +1 -1
- package/dist/entries/input.js +1 -1
- package/dist/entries/list-item.cjs +1 -1
- package/dist/entries/list-item.js +1 -1
- package/dist/entries/list.cjs +1 -1
- package/dist/entries/list.js +1 -1
- package/dist/entries/radio.cjs +1 -1
- package/dist/entries/radio.js +1 -1
- package/dist/entries/select.cjs +1 -1
- package/dist/entries/select.js +1 -1
- package/dist/entries/tag-group.cjs +1 -1
- package/dist/entries/tag-group.js +1 -1
- package/dist/entries/toggle.cjs +1 -1
- package/dist/entries/toggle.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +12 -12
- package/dist/uikit-components.css +1 -1
- package/package.json +2 -2
- package/dist/SCard-BR2R5VQd.cjs +0 -1
- package/dist/SCheckbox-BMKYFfrB.js +0 -76
- package/dist/SCheckbox-CYy7tfoS.cjs +0 -1
- package/dist/SChip-DoFL5c6-.cjs +0 -1
- package/dist/SInput-C07kFnj_.cjs +0 -1
- package/dist/SListItem-CdveotJe.cjs +0 -1
- package/dist/SOverflowGroup-CVSon6Eg.js +0 -80
- package/dist/SRadio-Ca-1D4q6.cjs +0 -1
- package/dist/SRadio-Db_YLcne.js +0 -57
- package/dist/SSelect-Bntb-dgY.js +0 -661
- package/dist/SSelect-DcTEwHx6.cjs +0 -1
- package/dist/SToggle-DxSm1RNz.cjs +0 -1
- package/dist/SToggle-T7FKzMSo.js +0 -44
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { n as e, r as t, t as ee } from "./SButton.types-CpdHQtyx.js";
|
|
2
2
|
import { t as n } from "./SButton-DnU_XZ1C.js";
|
|
3
3
|
import { n as r } from "./useSelectLink-DClG5hGA.js";
|
|
4
|
-
import { Fragment as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, defineComponent as d, guardReactiveProps as f, inject as p, normalizeClass as m, normalizeProps as h, normalizeStyle as te, openBlock as g, renderSlot as _, toDisplayString as v, unref as y, useSlots as
|
|
4
|
+
import { Fragment as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, defineComponent as d, guardReactiveProps as f, inject as p, normalizeClass as m, normalizeProps as h, normalizeStyle as te, openBlock as g, renderSlot as _, toDisplayString as v, unref as y, useSlots as ne, useTemplateRef as b, withModifiers as x } from "vue";
|
|
5
5
|
import { ESSkeletonType as S, SIcon as C, SSkeleton as re, useUiKitI18n as ie } from "@shtabapp/ui-kit-primitives";
|
|
6
6
|
//#region src/components/SList/utils/context.ts
|
|
7
7
|
var w = Symbol("sListInjectionKey"), T = /* @__PURE__ */ function(e) {
|
|
8
|
-
return e.NEUTRAL = "neutral", e.MAIN = "main", e.ERROR = "error", e;
|
|
8
|
+
return e.NEUTRAL = "neutral", e.MAIN = "main", e.ERROR = "error", e.BILLING = "billing", e;
|
|
9
9
|
}({}), E = [
|
|
10
10
|
"id",
|
|
11
11
|
"tabindex",
|
|
@@ -87,63 +87,63 @@ var w = Symbol("sListInjectionKey"), T = /* @__PURE__ */ function(e) {
|
|
|
87
87
|
"toggleExpand",
|
|
88
88
|
"keydown"
|
|
89
89
|
],
|
|
90
|
-
setup(d, { expose:
|
|
91
|
-
let
|
|
90
|
+
setup(d, { expose: V, emit: H }) {
|
|
91
|
+
let U = H, W = a(() => ({
|
|
92
92
|
disabled: d.disabled,
|
|
93
93
|
readonly: d.readonly
|
|
94
|
-
})),
|
|
95
|
-
group: () =>
|
|
94
|
+
})), G = ne(), K = b("listItemElementRef"), q = p(w, null), { t: J } = ie(), Y = r({
|
|
95
|
+
group: () => q,
|
|
96
96
|
value: () => d.rowKey,
|
|
97
|
-
el: () =>
|
|
97
|
+
el: () => K.value,
|
|
98
98
|
disabled: () => d.disabled || d.loading,
|
|
99
99
|
interactive: () => !d.readonly && !d.loading
|
|
100
|
-
}),
|
|
101
|
-
if (!(!
|
|
102
|
-
}),
|
|
103
|
-
if (
|
|
104
|
-
if (!(d.disabled || d.readonly || d.loading)) return
|
|
105
|
-
}),
|
|
100
|
+
}), ae = a(() => d.variant === T.BILLING && !d.disabled), oe = a(() => !!(G.trailing || G.right || G["action-end"])), X = a(() => q && d.rowKey ? q.isExpanded(d.rowKey) : d.expanded), se = a(() => X.value ? J("listItem.collapse") : J("listItem.expand")), Z = a(() => Y.isInGroup.value ? Y.isActive.value : d.selected), ce = a(() => q && d.rowKey ? q.activeKey() === d.rowKey : d.active), le = a(() => d.revealRight ? !0 : q ? q.revealRight() : !1), ue = a(() => d.expandOnClick ? !0 : q ? q.expandOnClick() : !1), de = a(() => {
|
|
101
|
+
if (!(!q || !d.rowKey)) return q.getItemOptionId(d.rowKey);
|
|
102
|
+
}), fe = a(() => {
|
|
103
|
+
if (q?.usesActiveDescendantNavigation()) return -1;
|
|
104
|
+
if (!(d.disabled || d.readonly || d.loading)) return Y.tabIndex.value === void 0 ? 0 : Y.tabIndex.value;
|
|
105
|
+
}), pe = a(() => ({ "--s-ui-list-item-depth": String(d.depth) })), me = a(() => [`s-ui-list-item--variant-${d.variant}`, {
|
|
106
106
|
"s-ui-list-item--tiny": d.tiny,
|
|
107
107
|
"s-ui-list-item--selected": Z.value,
|
|
108
|
-
"s-ui-list-item--active":
|
|
108
|
+
"s-ui-list-item--active": ce.value,
|
|
109
109
|
"s-ui-list-item--disabled": d.disabled,
|
|
110
110
|
"s-ui-list-item--readonly": d.readonly,
|
|
111
111
|
"s-ui-list-item--loading": d.loading,
|
|
112
112
|
"s-ui-list-item--expandable": d.expandable,
|
|
113
|
-
"s-ui-list-item--reveal-right":
|
|
114
|
-
}]),
|
|
115
|
-
if (
|
|
116
|
-
|
|
113
|
+
"s-ui-list-item--reveal-right": le.value
|
|
114
|
+
}]), Q = () => {
|
|
115
|
+
if (q && d.rowKey) {
|
|
116
|
+
q.toggleExpanded(d.rowKey);
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
119
|
-
|
|
120
|
-
},
|
|
121
|
-
d.disabled || d.readonly || d.loading ||
|
|
122
|
-
},
|
|
123
|
-
d.disabled || d.readonly || d.loading ||
|
|
124
|
-
},
|
|
125
|
-
d.disabled || d.readonly || d.loading || (!
|
|
119
|
+
U("toggleExpand");
|
|
120
|
+
}, he = () => {
|
|
121
|
+
d.disabled || d.readonly || d.loading || Q();
|
|
122
|
+
}, ge = (e) => e.target instanceof Element && !!e.target.closest(B), $ = (e) => {
|
|
123
|
+
d.disabled || d.readonly || d.loading || ge(e) || (d.expandable && ue.value && (q && d.rowKey ? q.toggleExpanded(d.rowKey) : U("toggleExpand")), q && d.rowKey && q.setActiveKey(d.rowKey), Y.isInGroup.value && Y.handleClick(), U("click", e));
|
|
124
|
+
}, _e = (e) => !d.expandable || q?.handlesTreeKeyboardNavigation() || e.key !== "ArrowLeft" && e.key !== "ArrowRight" || e.key === "ArrowRight" === X.value ? !1 : (e.preventDefault(), Q(), !0), ve = (e) => {
|
|
125
|
+
d.disabled || d.readonly || d.loading || (!_e(e) && Y.isInGroup.value && Y.handleKeydown(e), U("keydown", e));
|
|
126
126
|
};
|
|
127
|
-
return
|
|
127
|
+
return V({ listItemElementRef: K }), (r, a) => (g(), c("div", {
|
|
128
128
|
ref_key: "listItemElementRef",
|
|
129
|
-
ref:
|
|
130
|
-
id:
|
|
131
|
-
class: m(["s-ui-list-item",
|
|
132
|
-
style: te(
|
|
133
|
-
tabindex:
|
|
129
|
+
ref: K,
|
|
130
|
+
id: de.value,
|
|
131
|
+
class: m(["s-ui-list-item", me.value]),
|
|
132
|
+
style: te(pe.value),
|
|
133
|
+
tabindex: fe.value,
|
|
134
134
|
role: "option",
|
|
135
135
|
"aria-selected": Z.value ? !0 : void 0,
|
|
136
136
|
"aria-disabled": d.disabled || d.loading ? !0 : void 0,
|
|
137
137
|
"aria-readonly": d.readonly ? !0 : void 0,
|
|
138
138
|
"aria-busy": d.loading ? !0 : void 0,
|
|
139
139
|
"aria-expanded": d.expandable && !d.loading ? X.value : void 0,
|
|
140
|
-
onClick:
|
|
141
|
-
onKeydown:
|
|
140
|
+
onClick: $,
|
|
141
|
+
onKeydown: ve
|
|
142
142
|
}, [d.loading ? (g(), o(y(re), {
|
|
143
143
|
key: 0,
|
|
144
144
|
type: y(S).S_LIST_ITEM
|
|
145
145
|
}, null, 8, ["type"])) : (g(), c(i, { key: 1 }, [
|
|
146
|
-
d.expandable || d.depth || y(
|
|
146
|
+
d.expandable || d.depth || y(G).level ? (g(), c("div", D, [_(r.$slots, "level", {}, () => [d.expandable ? (g(), o(y(n), {
|
|
147
147
|
key: 0,
|
|
148
148
|
class: m(["s-ui-list-item__expand", { "s-ui-list-item__expand--expanded": X.value }]),
|
|
149
149
|
appearance: y(ee).BARE,
|
|
@@ -152,8 +152,8 @@ var w = Symbol("sListInjectionKey"), T = /* @__PURE__ */ function(e) {
|
|
|
152
152
|
icon: "chevronMiniRight",
|
|
153
153
|
disabled: d.disabled || d.readonly,
|
|
154
154
|
tabindex: -1,
|
|
155
|
-
"aria-label":
|
|
156
|
-
onClick: x(
|
|
155
|
+
"aria-label": se.value,
|
|
156
|
+
onClick: x(he, ["stop"])
|
|
157
157
|
}, null, 8, [
|
|
158
158
|
"class",
|
|
159
159
|
"appearance",
|
|
@@ -163,18 +163,19 @@ var w = Symbol("sListInjectionKey"), T = /* @__PURE__ */ function(e) {
|
|
|
163
163
|
"aria-label"
|
|
164
164
|
])) : s("", !0)])])) : s("", !0),
|
|
165
165
|
l("div", O, [
|
|
166
|
-
d.iconLeft || y(
|
|
166
|
+
d.iconLeft || y(G)["icon-left"] ? (g(), c("div", k, [_(r.$slots, "icon-left", {}, () => [d.iconLeft ? (g(), o(y(C), {
|
|
167
167
|
key: 0,
|
|
168
168
|
name: d.iconLeft,
|
|
169
|
-
size: z
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
y(
|
|
169
|
+
size: z,
|
|
170
|
+
billing: ae.value
|
|
171
|
+
}, null, 8, ["name", "billing"])) : s("", !0)])])) : s("", !0),
|
|
172
|
+
l("div", A, [d.title || y(G).title ? (g(), c("span", j, [_(r.$slots, "title", {}, () => [u(v(d.title), 1)])])) : s("", !0), d.subtitle || y(G).subtitle ? (g(), c("span", M, [_(r.$slots, "subtitle", {}, () => [u(v(d.subtitle), 1)])])) : s("", !0)]),
|
|
173
|
+
y(G)["title-action"] ? (g(), c("div", N, [_(r.$slots, "title-action", h(f(W.value)))])) : s("", !0)
|
|
173
174
|
]),
|
|
174
|
-
|
|
175
|
-
y(
|
|
176
|
-
_(r.$slots, "right", h(f(
|
|
177
|
-
y(
|
|
175
|
+
oe.value ? (g(), c("div", P, [l("div", F, [l("div", I, [
|
|
176
|
+
y(G).trailing ? (g(), c("div", L, [_(r.$slots, "trailing", h(f(W.value)))])) : s("", !0),
|
|
177
|
+
_(r.$slots, "right", h(f(W.value))),
|
|
178
|
+
y(G)["action-end"] ? (g(), c("div", R, [_(r.$slots, "action-end", h(f(W.value)))])) : s("", !0)
|
|
178
179
|
])])])) : s("", !0)
|
|
179
180
|
], 64))], 46, E));
|
|
180
181
|
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Comment as e, Fragment as t, Text as n, computed as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createVNode as s, defineComponent as c, h as l, isVNode as u, normalizeClass as d, openBlock as f, renderSlot as p, toValue as m, unref as h, useSlots as g } from "vue";
|
|
2
|
+
//#region src/composables/useOverflowGroup.ts
|
|
3
|
+
var _ = (e, t) => !t || !Number.isFinite(t) || t >= e ? e : Math.max(t, 0), v = ({ items: e, maxVisible: t }) => {
|
|
4
|
+
let n = r(() => {
|
|
5
|
+
let n = m(e), r = _(n.length, m(t));
|
|
6
|
+
return n.slice(0, r);
|
|
7
|
+
}), i = r(() => {
|
|
8
|
+
let t = m(e);
|
|
9
|
+
return Math.max(t.length - n.value.length, 0);
|
|
10
|
+
});
|
|
11
|
+
return {
|
|
12
|
+
visibleItems: n,
|
|
13
|
+
hiddenCount: i,
|
|
14
|
+
hasOverflow: r(() => i.value > 0),
|
|
15
|
+
overflowLabel: r(() => `+${i.value}`)
|
|
16
|
+
};
|
|
17
|
+
}, y = new Set([
|
|
18
|
+
32,
|
|
19
|
+
9,
|
|
20
|
+
10,
|
|
21
|
+
13
|
|
22
|
+
]), b = (e) => {
|
|
23
|
+
for (let t = 0; t < e.length; t += 1) if (!y.has(e.charCodeAt(t))) return !1;
|
|
24
|
+
return !0;
|
|
25
|
+
}, x = (e) => {
|
|
26
|
+
if (!e) return [];
|
|
27
|
+
if (!Array.isArray(e)) return u(e) ? [e] : [];
|
|
28
|
+
let t = [];
|
|
29
|
+
for (let r of e) typeof r == "string" ? b(r) || t.push(l(n, r)) : u(r) && t.push(r);
|
|
30
|
+
return t;
|
|
31
|
+
}, S = (e) => {
|
|
32
|
+
if (e.type !== n) return !1;
|
|
33
|
+
let t = e.children;
|
|
34
|
+
return typeof t == "string" && b(t);
|
|
35
|
+
}, C = (n) => {
|
|
36
|
+
let r = [], i = (n) => {
|
|
37
|
+
for (let a of n) a && a.type !== e && (a.type === t ? i(x(a.children)) : S(a) || r.push(a));
|
|
38
|
+
};
|
|
39
|
+
return i(n), r;
|
|
40
|
+
}, w = (e, n, r) => {
|
|
41
|
+
let i = [];
|
|
42
|
+
for (let t = 0; t < e.length; t += 1) {
|
|
43
|
+
let a = e[t];
|
|
44
|
+
u(a) && i.push(n(a, {
|
|
45
|
+
...r,
|
|
46
|
+
visibleCount: e.length,
|
|
47
|
+
visibleIndex: t
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
return l(t, null, i);
|
|
51
|
+
}, T = /* @__PURE__ */ c({
|
|
52
|
+
__name: "SOverflowGroup",
|
|
53
|
+
props: {
|
|
54
|
+
clusterClass: {},
|
|
55
|
+
mapVnode: { type: Function },
|
|
56
|
+
maxVisible: {}
|
|
57
|
+
},
|
|
58
|
+
setup(e) {
|
|
59
|
+
let t = g(), { visibleItems: n, hiddenCount: l, hasOverflow: u, overflowLabel: m } = v({
|
|
60
|
+
items: r(() => t.default ? C(t.default()) : []),
|
|
61
|
+
maxVisible: () => e.maxVisible
|
|
62
|
+
}), _ = c({
|
|
63
|
+
name: "SOverflowGroupVnodeList",
|
|
64
|
+
setup() {
|
|
65
|
+
return () => w(n.value, (t, n) => e.mapVnode ? e.mapVnode(t, n) : t, {
|
|
66
|
+
hiddenCount: l.value,
|
|
67
|
+
overflowLabel: m.value
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
return (t, n) => (f(), a("div", null, [o("div", { class: d(e.clusterClass) }, [s(h(_))], 2), h(u) ? p(t.$slots, "overflow", {
|
|
72
|
+
key: 0,
|
|
73
|
+
hiddenCount: h(l),
|
|
74
|
+
overflowLabel: h(m)
|
|
75
|
+
}) : i("", !0)]));
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
//#endregion
|
|
79
|
+
export { T as t };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
let e=require("vue");var t=(e,t)=>!t||!Number.isFinite(t)||t>=e?e:Math.max(t,0),n=({items:n,maxVisible:r})=>{let i=(0,e.computed)(()=>{let i=(0,e.toValue)(n),a=t(i.length,(0,e.toValue)(r));return i.slice(0,a)}),a=(0,e.computed)(()=>{let t=(0,e.toValue)(n);return Math.max(t.length-i.value.length,0)});return{visibleItems:i,hiddenCount:a,hasOverflow:(0,e.computed)(()=>a.value>0),overflowLabel:(0,e.computed)(()=>`+${a.value}`)}},r=new Set([32,9,10,13]),i=e=>{for(let t=0;t<e.length;t+=1)if(!r.has(e.charCodeAt(t)))return!1;return!0},a=t=>{if(!t)return[];if(!Array.isArray(t))return(0,e.isVNode)(t)?[t]:[];let n=[];for(let r of t)typeof r==`string`?i(r)||n.push((0,e.h)(e.Text,r)):(0,e.isVNode)(r)&&n.push(r);return n},o=t=>{if(t.type!==e.Text)return!1;let n=t.children;return typeof n==`string`&&i(n)},s=t=>{let n=[],r=t=>{for(let i of t)i&&i.type!==e.Comment&&(i.type===e.Fragment?r(a(i.children)):o(i)||n.push(i))};return r(t),n},c=(t,n,r)=>{let i=[];for(let a=0;a<t.length;a+=1){let o=t[a];(0,e.isVNode)(o)&&i.push(n(o,{...r,visibleCount:t.length,visibleIndex:a}))}return(0,e.h)(e.Fragment,null,i)},l=(0,e.defineComponent)({
|
|
1
|
+
let e=require("vue");var t=(e,t)=>!t||!Number.isFinite(t)||t>=e?e:Math.max(t,0),n=({items:n,maxVisible:r})=>{let i=(0,e.computed)(()=>{let i=(0,e.toValue)(n),a=t(i.length,(0,e.toValue)(r));return i.slice(0,a)}),a=(0,e.computed)(()=>{let t=(0,e.toValue)(n);return Math.max(t.length-i.value.length,0)});return{visibleItems:i,hiddenCount:a,hasOverflow:(0,e.computed)(()=>a.value>0),overflowLabel:(0,e.computed)(()=>`+${a.value}`)}},r=new Set([32,9,10,13]),i=e=>{for(let t=0;t<e.length;t+=1)if(!r.has(e.charCodeAt(t)))return!1;return!0},a=t=>{if(!t)return[];if(!Array.isArray(t))return(0,e.isVNode)(t)?[t]:[];let n=[];for(let r of t)typeof r==`string`?i(r)||n.push((0,e.h)(e.Text,r)):(0,e.isVNode)(r)&&n.push(r);return n},o=t=>{if(t.type!==e.Text)return!1;let n=t.children;return typeof n==`string`&&i(n)},s=t=>{let n=[],r=t=>{for(let i of t)i&&i.type!==e.Comment&&(i.type===e.Fragment?r(a(i.children)):o(i)||n.push(i))};return r(t),n},c=(t,n,r)=>{let i=[];for(let a=0;a<t.length;a+=1){let o=t[a];(0,e.isVNode)(o)&&i.push(n(o,{...r,visibleCount:t.length,visibleIndex:a}))}return(0,e.h)(e.Fragment,null,i)},l=(0,e.defineComponent)({__name:`SOverflowGroup`,props:{clusterClass:{},mapVnode:{type:Function},maxVisible:{}},setup(t){let r=(0,e.useSlots)(),{visibleItems:i,hiddenCount:a,hasOverflow:o,overflowLabel:l}=n({items:(0,e.computed)(()=>r.default?s(r.default()):[]),maxVisible:()=>t.maxVisible}),u=(0,e.defineComponent)({name:`SOverflowGroupVnodeList`,setup(){return()=>c(i.value,(e,n)=>t.mapVnode?t.mapVnode(e,n):e,{hiddenCount:a.value,overflowLabel:l.value})}});return(n,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,null,[(0,e.createElementVNode)(`div`,{class:(0,e.normalizeClass)(t.clusterClass)},[(0,e.createVNode)((0,e.unref)(u))],2),(0,e.unref)(o)?(0,e.renderSlot)(n.$slots,`overflow`,{key:0,hiddenCount:(0,e.unref)(a),overflowLabel:(0,e.unref)(l)}):(0,e.createCommentVNode)(``,!0)]))}});Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return l}});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { computed as e, createCommentVNode as t, createElementBlock as n, createElementVNode as r, defineComponent as i, mergeModels as a, normalizeClass as o, openBlock as s, renderSlot as c, unref as l, useModel as u, useSlots as d, vModelRadio as f, withDirectives as p } from "vue";
|
|
2
|
+
//#region src/components/SRadio/SRadio.types.ts
|
|
3
|
+
var m = /* @__PURE__ */ function(e) {
|
|
4
|
+
return e.LEFT = "left", e.RIGHT = "right", e;
|
|
5
|
+
}({}), h = [
|
|
6
|
+
"disabled",
|
|
7
|
+
"name",
|
|
8
|
+
"value"
|
|
9
|
+
], g = {
|
|
10
|
+
key: 0,
|
|
11
|
+
class: "s-ui-radio__content"
|
|
12
|
+
}, _ = {
|
|
13
|
+
key: 0,
|
|
14
|
+
class: "s-ui-radio__label s-ui-typography-label-14-medium"
|
|
15
|
+
}, v = {
|
|
16
|
+
key: 1,
|
|
17
|
+
class: "s-ui-radio__description s-ui-typography-body-12-regular"
|
|
18
|
+
}, y = /* @__PURE__ */ i({
|
|
19
|
+
__name: "SRadio",
|
|
20
|
+
props: /*@__PURE__*/ a({
|
|
21
|
+
disabled: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: !1
|
|
24
|
+
},
|
|
25
|
+
labelPlacement: { default: () => m.LEFT },
|
|
26
|
+
name: {},
|
|
27
|
+
value: {}
|
|
28
|
+
}, {
|
|
29
|
+
modelValue: {},
|
|
30
|
+
modelModifiers: {}
|
|
31
|
+
}),
|
|
32
|
+
emits: /*@__PURE__*/ a(["change"], ["update:modelValue"]),
|
|
33
|
+
setup(i, { emit: a }) {
|
|
34
|
+
let y = u(i, "modelValue"), b = a, x = d(), S = e(() => !!(x.default || x.description)), C = e(() => y.value === i.value), w = e(() => [{
|
|
35
|
+
"s-ui-radio--checked": C.value,
|
|
36
|
+
"s-ui-radio--disabled": i.disabled,
|
|
37
|
+
"s-ui-radio--label-right": i.labelPlacement === m.RIGHT,
|
|
38
|
+
"s-ui-radio--control-only": !S.value
|
|
39
|
+
}]), T = (e) => {
|
|
40
|
+
e.target instanceof HTMLInputElement && e.target.checked && b("change", i.value);
|
|
41
|
+
};
|
|
42
|
+
return (e, a) => (s(), n("label", { class: o(["s-ui-radio", w.value]) }, [
|
|
43
|
+
p(r("input", {
|
|
44
|
+
"onUpdate:modelValue": a[0] ||= (e) => y.value = e,
|
|
45
|
+
type: "radio",
|
|
46
|
+
class: "s-ui-radio__input",
|
|
47
|
+
disabled: i.disabled,
|
|
48
|
+
name: i.name,
|
|
49
|
+
value: i.value,
|
|
50
|
+
onChange: T
|
|
51
|
+
}, null, 40, h), [[f, y.value]]),
|
|
52
|
+
a[1] ||= r("span", { class: "s-ui-radio__control" }, [r("span", { class: "s-ui-radio__thumb" })], -1),
|
|
53
|
+
S.value ? (s(), n("span", g, [l(x).default ? (s(), n("span", _, [c(e.$slots, "default")])) : t("", !0), l(x).description ? (s(), n("span", v, [c(e.$slots, "description")])) : t("", !0)])) : t("", !0)
|
|
54
|
+
], 2));
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
//#endregion
|
|
58
|
+
export { m as n, y as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=require("vue");var t=function(e){return e.LEFT=`left`,e.RIGHT=`right`,e}({}),n=[`disabled`,`name`,`value`],r={key:0,class:`s-ui-radio__content`},i={key:0,class:`s-ui-radio__label s-ui-typography-label-14-medium`},a={key:1,class:`s-ui-radio__description s-ui-typography-body-12-regular`},o=(0,e.defineComponent)({__name:`SRadio`,props:(0,e.mergeModels)({disabled:{type:Boolean,default:!1},labelPlacement:{default:()=>t.LEFT},name:{},value:{}},{modelValue:{},modelModifiers:{}}),emits:(0,e.mergeModels)([`change`],[`update:modelValue`]),setup(o,{emit:s}){let c=(0,e.useModel)(o,`modelValue`),l=s,u=(0,e.useSlots)(),d=(0,e.computed)(()=>!!(u.default||u.description)),f=(0,e.computed)(()=>c.value===o.value),p=(0,e.computed)(()=>[{"s-ui-radio--checked":f.value,"s-ui-radio--disabled":o.disabled,"s-ui-radio--label-right":o.labelPlacement===t.RIGHT,"s-ui-radio--control-only":!d.value}]),m=e=>{e.target instanceof HTMLInputElement&&e.target.checked&&l(`change`,o.value)};return(t,s)=>((0,e.openBlock)(),(0,e.createElementBlock)(`label`,{class:(0,e.normalizeClass)([`s-ui-radio`,p.value])},[(0,e.withDirectives)((0,e.createElementVNode)(`input`,{"onUpdate:modelValue":s[0]||=e=>c.value=e,type:`radio`,class:`s-ui-radio__input`,disabled:o.disabled,name:o.name,value:o.value,onChange:m},null,40,n),[[e.vModelRadio,c.value]]),s[1]||=(0,e.createElementVNode)(`span`,{class:`s-ui-radio__control`},[(0,e.createElementVNode)(`span`,{class:`s-ui-radio__thumb`})],-1),d.value?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,r,[(0,e.unref)(u).default?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,i,[(0,e.renderSlot)(t.$slots,`default`)])):(0,e.createCommentVNode)(``,!0),(0,e.unref)(u).description?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,a,[(0,e.renderSlot)(t.$slots,`description`)])):(0,e.createCommentVNode)(``,!0)])):(0,e.createCommentVNode)(``,!0)],2))}});Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return o}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./SButton.types-UKroD-ev.cjs"),t=require("./SButton-C-z_q5CG.cjs"),n=require("./useSelectionGroup-TaektE-I.cjs"),r=require("./SDropdown-_QUOP-rw.cjs"),i=require("./SInput-DJL9QOIG.cjs"),a=require("./SList-qQ7B5u8o.cjs"),o=require("./SListItem-DBGDVeoJ.cjs");let s=require("vue"),c=require("@shtabapp/ui-kit-primitives");var l={key:0,class:`s-ui-dropdown-menu__header`},u={key:1,class:`s-ui-dropdown-menu__footer`},d=(0,s.defineComponent)({__name:`SDropdownMenu`,props:{width:{},maxHeight:{},accent:{type:Boolean,default:!1}},setup(e){let t=(0,s.useSlots)(),n=e=>typeof e==`number`?`${e}px`:e,r=(0,s.computed)(()=>({"s-ui-dropdown-menu--accent":e.accent,"s-ui-dropdown-menu--bounded":!!e.maxHeight})),i=(0,s.computed)(()=>({"s-ui-dropdown-menu__body--scrollable":!!e.maxHeight})),a=(0,s.computed)(()=>({"--s-ui-dropdown-menu-width":n(e.width),"--s-ui-dropdown-menu-max-height":n(e.maxHeight)}));return(e,n)=>((0,s.openBlock)(),(0,s.createElementBlock)(`div`,{class:(0,s.normalizeClass)([`s-ui-dropdown-menu`,r.value]),style:(0,s.normalizeStyle)(a.value)},[(0,s.unref)(t).header?((0,s.openBlock)(),(0,s.createElementBlock)(`div`,l,[(0,s.renderSlot)(e.$slots,`header`)])):(0,s.createCommentVNode)(``,!0),(0,s.createElementVNode)(`div`,{class:(0,s.normalizeClass)([`s-ui-dropdown-menu__body`,i.value])},[(0,s.renderSlot)(e.$slots,`default`)],2),(0,s.unref)(t).footer?((0,s.openBlock)(),(0,s.createElementBlock)(`div`,u,[(0,s.renderSlot)(e.$slots,`footer`)])):(0,s.createCommentVNode)(``,!0)],6))}}),f=({listItemScope:e,itemTitle:t,itemSubtitle:n,itemDisabled:r,itemIconLeft:i,listActiveKey:o,isOptionSelected:s})=>{let c=e.item;return{rowKey:e.key,title:a.i(c,t),subtitle:a.i(c,n),disabled:a.n(c,r),iconLeft:a.r(c,i),selected:s,active:o===e.key,revealRight:e.revealRight,tiny:!0}},p=e=>typeof e==`string`||typeof e==`number`,m=(e,t)=>{let n=e[t];if(p(n))return n},h=e=>typeof e==`string`?e:String(e),g=e=>e==null?!1:typeof e==`string`?e.length>0:!0,_=(e,t,n)=>t.find(t=>h(m(t,n)??``)===e),v=e=>typeof e==`object`&&!!e,y=(e,t,n)=>{let r=_(e,t,n);if(r)return m(r,n)},b=function(e){return e.INPUT=`input`,e.CONTENT=`content`,e}({}),x=(e,t,n)=>{if(!e)return!0;let r=e.toLocaleLowerCase(),i=a.i(t,n.itemTitle)?.toLocaleLowerCase()??``,o=h(m(t,n.itemValue)??``).toLocaleLowerCase();return i.includes(r)||o.includes(r)},S=(e,t,n,r)=>{let i=r??((e,t)=>x(e,t,n));return t?e.filter(e=>i(t,e)):[...e]},C=e=>typeof e==`string`&&g(e),w=e=>typeof e==`number`&&g(e),T=(e,t,n)=>{if(t){if(!v(e))return;let t=m(e,n);return C(t)||w(t)?t:void 0}let r=typeof e==`string`||typeof e==`number`?e:void 0;if(C(r)||w(r))return r},E=(e,t,n)=>e?(Array.isArray(e)?e:[e]).flatMap(e=>{let r=T(e,t,n);return g(r)?[r]:[]}):[],D=(e,t)=>{if(C(t)){e.value=t;return}if(w(t)){e.value=t;return}e.value=void 0},O=(e,t,n)=>t.flatMap(t=>{let r=h(t),i=e.find(e=>h(m(e,n)??``)===r);return i?[i]:[]}),k=({modelValue:e,options:t,itemFields:r,multiple:i,returnObject:o,searchable:c,filterOption:l,isDropdownOpen:u,searchQuery:d})=>{let f=(0,s.computed)(()=>(0,s.toValue)(i)),p=(0,s.computed)(()=>(0,s.toValue)(o)),v=(0,s.computed)(()=>(0,s.toValue)(c)===b.INPUT),x=(0,s.computed)(()=>(0,s.toValue)(c)===b.CONTENT),C=(0,s.computed)(()=>!!(0,s.toValue)(c)),w=(0,s.computed)(()=>{let t=(0,s.toValue)(r);return E(e.value,p.value,t.itemValue)}),T=(0,s.computed)(()=>{let e=(0,s.toValue)(t),n=(0,s.toValue)(r);return S(e,C.value?d.value:``,n,(0,s.toValue)(l))}),k=(0,s.computed)(()=>f.value?n.n.MULTIPLE:n.n.SINGLE),A=(t,n,r)=>{if(p.value){e.value=O(n,t,r);return}e.value=t},ee=(t,n,r)=>{if(!t){e.value=void 0;return}if(p.value){e.value=_(t,n,r)??void 0;return}D(e,y(t,n,r))},te=(0,s.computed)({get:()=>{if(f.value)return w.value.map(e=>h(e));let e=w.value[0];if(g(e))return h(e)},set:e=>{let n=(0,s.toValue)(t),i=(0,s.toValue)(r);if(f.value){A((Array.isArray(e)?e:[]).map(e=>y(e,n,i.itemValue)).filter(e=>g(e)),n,i.itemValue);return}ee(typeof e==`string`?e:void 0,n,i.itemValue)}}),ne=(0,s.computed)(()=>w.value.length>0),j=(e,t,n)=>{let r=h(t);return e.find(e=>h(m(e,n)??``)===r)},M=(0,s.computed)(()=>{let e=w.value[0];if(!g(e))return``;let n=(0,s.toValue)(r),i=j((0,s.toValue)(t),e,n.itemValue);return i?a.i(i,n.itemTitle)??``:h(e)}),N=(0,s.computed)(()=>{let e=(0,s.toValue)(t),n=(0,s.toValue)(r);return w.value.map(t=>{let r=j(e,t,n.itemValue);return r?a.i(r,n.itemTitle)??``:h(t)})}),re=(0,s.computed)(()=>N.value.join(`, `)),ie=(0,s.computed)(()=>f.value?w.value.length===0:!M.value),ae=(0,s.computed)(()=>v.value&&(u.value||f.value)),P=()=>{d.value=``};return(0,s.watch)(u,e=>{e||P()}),(0,s.watch)(()=>(0,s.toValue)(c),()=>{P()}),{searchQuery:d,selectedValues:w,filteredOptions:T,listSelectionMode:k,listSelectedModel:te,hasSelectedValues:ne,singleDisplayLabel:M,multipleDisplayLabels:N,multipleDisplayText:re,showPlaceholder:ie,showInputSearchField:ae,isSearchableMode:C,isSearchableInputMode:v,isSearchableContentMode:x,isMultipleMode:f,isReturnObjectMode:p,clearSelection:()=>{e.value=void 0,P()},removeSelectedValue:e=>{let n=h(e);A(w.value.filter(e=>h(e)!==n),(0,s.toValue)(t),(0,s.toValue)(r).itemValue)},resetSearchQuery:P,formatSelectListKey:h,resolveValueFromListKey:e=>y(e,(0,s.toValue)(t),(0,s.toValue)(r).itemValue)}},A={key:0,class:`s-ui-select__options-divider`,role:`separator`},ee={key:1,class:`s-ui-select__empty s-ui-typography-body-14-regular`},te=[`id`,`aria-expanded`,`aria-controls`,`aria-disabled`,`aria-readonly`,`aria-autocomplete`,`tabindex`],ne={key:0,class:`s-ui-select__value`},j={key:1,class:`s-ui-select__placeholder`},M={key:1,class:`s-ui-select__placeholder`},N={key:2,class:`s-ui-select__value`},re={key:3,class:`s-ui-select__value-suffix`},ie=[`name`,`placeholder`,`disabled`,`readonly`],ae=20,P=20,oe=`__s-ui-select-options-divider__`,F=(0,s.defineComponent)({__name:`SSelect`,props:(0,s.mergeModels)({options:{},itemValue:{default:`value`},itemTitle:{default:`label`},itemSubtitle:{default:`subtitle`},itemId:{},itemDisabled:{default:`disabled`},itemIconLeft:{default:`iconLeft`},multiple:{type:Boolean,default:!1},returnObject:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},closableOptions:{type:Boolean,default:!1},searchable:{type:[String,Boolean],default:!1},closeOnSelect:{type:Boolean,default:!0},listHeight:{default:320},searchPlaceholder:{default:`Search`},filterOption:{type:Function},fitViewport:{type:Boolean,default:!0},label:{},labelProps:{},placeholder:{},helpMessages:{},errorMessages:{},bordered:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},iconLeft:{},customize:{default:()=>i.n.NONE},name:{},id:{}},{modelValue:{},modelModifiers:{},searchQuery:{default:``},searchQueryModifiers:{}}),emits:(0,s.mergeModels)([`clear`,`focus`,`blur`,`open`,`close`],[`update:modelValue`,`update:searchQuery`]),setup(n,{expose:l,emit:u}){let p=(0,s.useModel)(n,`modelValue`),h=(0,s.useModel)(n,`searchQuery`),_=u,{t:v}=(0,c.useUiKitI18n)(),y=(0,s.useSlots)(),b=(0,s.useId)(),x=(0,s.useId)(),S=(0,s.useTemplateRef)(`triggerInputRef`),C=(0,s.ref)(``),w=(0,s.useTemplateRef)(`searchInputElementRef`),T=(0,s.useTemplateRef)(`panelSearchInputElementRef`),E=(0,s.useTemplateRef)(`listElementRef`),D=(0,s.ref)(),O=(0,s.ref)(!1),F=(0,s.ref)(!1),I=(0,s.computed)(()=>n.itemId??n.itemValue),se=(0,s.computed)(()=>({itemValue:n.itemValue,itemTitle:n.itemTitle,itemSubtitle:n.itemSubtitle,itemId:I.value})),{selectedValues:L,filteredOptions:R,listSelectionMode:ce,listSelectedModel:z,hasSelectedValues:le,singleDisplayLabel:ue,multipleDisplayLabels:de,multipleDisplayText:B,showPlaceholder:V,showInputSearchField:H,isSearchableMode:fe,isSearchableInputMode:U,isSearchableContentMode:W,isMultipleMode:G,clearSelection:pe,removeSelectedValue:K,resolveValueFromListKey:me,formatSelectListKey:q}=k({modelValue:p,options:()=>n.options,itemFields:()=>se.value,multiple:()=>n.multiple,returnObject:()=>n.returnObject,searchable:()=>n.searchable,filterOption:()=>n.filterOption,isDropdownOpen:O,searchQuery:h}),he=(0,s.computed)(()=>!!y[`value-suffix`]),ge=(0,s.computed)(()=>({disabled:n.disabled,displayLabel:ue.value})),J=(0,s.computed)(()=>R.value.length>P),_e=(0,s.computed)(()=>W.value||J.value?n.listHeight:`auto`),ve=(0,s.computed)(()=>{if(!(W.value||J.value))return n.listHeight}),ye=(0,s.computed)(()=>L.value.map(e=>q(e))),Y=e=>ye.value.includes(e),be=(0,s.computed)(()=>({[I.value]:oe,[n.itemDisabled]:!0})),xe=e=>q(m(e,I.value)??``),Se=(0,s.computed)(()=>{if(!G.value)return R.value;let e=[],t=[];for(let n of R.value)Y(xe(n))?e.push(n):t.push(n);return e.length===0||t.length===0?R.value:[...e,be.value,...t]}),Ce=()=>({tiny:!0}),we=e=>f({listItemScope:e,itemTitle:n.itemTitle,itemSubtitle:n.itemSubtitle,itemDisabled:n.itemDisabled,itemIconLeft:n.itemIconLeft,listActiveKey:D.value,isOptionSelected:Y(e.key)}),Te=e=>{let t=me(e);if(g(t)){if(G.value){K(t);return}p.value=void 0}},Ee=(0,s.computed)(()=>n.id??b),De=(0,s.computed)(()=>x),Oe=(0,s.computed)(()=>S.value?.fieldElementRef??null),ke=(0,s.computed)(()=>({labels:de.value,values:L.value,displayText:B.value,disabled:n.disabled||n.readonly,removeValue:K})),Ae=(0,s.computed)(()=>{if(!n.disabled&&(n.readonly&&!U.value||!U.value))return 0}),je=(0,s.computed)(()=>({"s-ui-select--disabled":n.disabled,"s-ui-select--readonly":n.readonly,"s-ui-select--multiple":G.value,"s-ui-select--open":O.value})),Me=()=>{if(W.value){T.value?.focus();return}w.value?.focus()},Ne=async()=>{await(0,s.nextTick)(),T.value?.focus()},Pe=async()=>{await(0,s.nextTick)(),await E.value?.focusNavigation()},X=async()=>{if(!(n.disabled||n.readonly)&&!O.value){if(O.value=!0,_(`open`),W.value){await Ne();return}if(U.value){await(0,s.nextTick)(),w.value?.focus();return}await Pe()}},Fe=async()=>{n.disabled||n.readonly||O.value||await X()};(0,s.watch)(h,async e=>{U.value&&(n.disabled||n.readonly||e&&(O.value||await X()))});let Z=()=>{O.value&&(O.value=!1,D.value=void 0,_(`close`))},Q=()=>{!n.closeOnSelect||G.value||Z()};(0,s.watch)(p,(e,t)=>{!n.closeOnSelect||G.value||!O.value||!e||e===t||Z()});let Ie=e=>{O.value&&e.target instanceof Element&&e.target.closest(`.s-ui-list-item`)&&Q()},Le=async e=>{e.key!==`Enter`&&e.key!==` `&&e.key!==`Spacebar`||O.value&&(await(0,s.nextTick)(),Q())},$=async()=>{if(O.value){Z();return}await X()},Re=async e=>{if(!(n.disabled||n.readonly)&&e.target instanceof HTMLElement){if(e.target.closest(`.s-ui-select__search-input`)){O.value||await X();return}await $()}},ze=async e=>e.key!==`ArrowDown`&&e.key!==`ArrowUp`?!1:(e.preventDefault(),e.stopPropagation(),O.value||await X(),await Pe(),await E.value?.handleKeyboardNavigation(e),!0),Be=e=>{let t=me(e);if(t){if(G.value){L.value.some(t=>q(t)===e)?K(t):z.value=[...L.value.map(e=>q(e)),e];return}z.value=e,Q()}},Ve=async e=>{if(!(n.disabled||n.readonly)&&!await ze(e)){if(e.key===`Escape`){e.preventDefault(),Z();return}if(e.key===`Enter`||e.key===` `){if(e.preventDefault(),O.value&&D.value){Be(D.value);return}await $()}}},He=async e=>{if(e.key===`Escape`){e.preventDefault(),Z();return}await ze(e)},Ue=He,We=e=>{n.disabled||(F.value||_(`focus`,e),F.value=!0)},Ge=e=>{if(!(e.currentTarget instanceof HTMLElement))return;let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||(F.value=!1,_(`blur`,e))},Ke=()=>{pe(),_(`clear`)};return l({open:X,close:Z,toggle:$,focusSearchInput:Me}),(l,u)=>((0,s.openBlock)(),(0,s.createElementBlock)(`div`,{class:(0,s.normalizeClass)([`s-ui-select`,je.value])},[(0,s.createVNode)((0,s.unref)(r.t),{modelValue:O.value,"onUpdate:modelValue":u[4]||=e=>O.value=e,reference:Oe.value,disabled:n.disabled,"match-reference-width":!0,"fit-viewport":n.fitViewport,"content-id":De.value,"dismiss-on-click-outside":!0,"dismiss-on-escape":!0},{content:(0,s.withCtx)(()=>[(0,s.createVNode)((0,s.unref)(d),{class:`s-ui-select__menu`,width:`100%`},(0,s.createSlots)({default:(0,s.withCtx)(()=>[(0,s.createElementVNode)(`div`,{class:`s-ui-select__menu-body`,onClick:Ie,onKeydown:Le},[(0,s.unref)(R).length>0?((0,s.openBlock)(),(0,s.createBlock)((0,s.unref)(a.t),{key:0,ref_key:`listElementRef`,ref:E,modelValue:D.value,"onUpdate:modelValue":u[2]||=e=>D.value=e,selected:(0,s.unref)(z),"onUpdate:selected":u[3]||=e=>(0,s.isRef)(z)?z.value=e:null,items:Se.value,"item-key":I.value,"title-key":n.itemTitle,"subtitle-key":n.itemSubtitle,"icon-left-key":n.itemIconLeft,"disabled-key":n.itemDisabled,"selection-mode":(0,s.unref)(ce),mandatory:!n.multiple,height:_e.value,"max-height":ve.value,virtual:J.value,"item-props":Ce},(0,s.createSlots)({_:2},[(0,s.unref)(y).option||(0,s.unref)(y)[`option-icon`]||n.closableOptions||(0,s.unref)(G)?{name:`item`,fn:(0,s.withCtx)(r=>[r.key===oe?((0,s.openBlock)(),(0,s.createElementBlock)(`div`,A)):(0,s.unref)(y).option?(0,s.renderSlot)(l.$slots,`option`,(0,s.normalizeProps)((0,s.mergeProps)({key:1},r))):n.closableOptions?((0,s.openBlock)(),(0,s.createBlock)((0,s.unref)(o.t),(0,s.normalizeProps)((0,s.mergeProps)({key:2},we(r))),(0,s.createSlots)({_:2},[(0,s.unref)(y)[`option-icon`]?{name:`icon-left`,fn:(0,s.withCtx)(()=>[(0,s.renderSlot)(l.$slots,`option-icon`,(0,s.normalizeProps)((0,s.guardReactiveProps)(r)))]),key:`0`}:void 0,Y(r.key)?{name:`right`,fn:(0,s.withCtx)(n=>[(0,s.createVNode)((0,s.unref)(t.t),{appearance:(0,s.unref)(e.t).BARE,variant:(0,s.unref)(e.r).NEUTRAL,size:(0,s.unref)(e.n).SMALL,icon:`closeMini`,"aria-label":(0,s.unref)(v)(`select.removeOption`),disabled:n.disabled||n.readonly,tabindex:-1,onClick:(0,s.withModifiers)(e=>Te(r.key),[`stop`])},null,8,[`appearance`,`variant`,`size`,`aria-label`,`disabled`,`onClick`])]),key:`1`}:void 0]),1040)):((0,s.openBlock)(),(0,s.createBlock)((0,s.unref)(o.t),(0,s.normalizeProps)((0,s.mergeProps)({key:3},we(r))),(0,s.createSlots)({_:2},[(0,s.unref)(y)[`option-icon`]?{name:`icon-left`,fn:(0,s.withCtx)(()=>[(0,s.renderSlot)(l.$slots,`option-icon`,(0,s.normalizeProps)((0,s.guardReactiveProps)(r)))]),key:`0`}:void 0]),1040))]),key:`0`}:void 0]),1032,[`modelValue`,`selected`,`items`,`item-key`,`title-key`,`subtitle-key`,`icon-left-key`,`disabled-key`,`selection-mode`,`mandatory`,`height`,`max-height`,`virtual`])):((0,s.openBlock)(),(0,s.createElementBlock)(`div`,ee,[(0,s.renderSlot)(l.$slots,`empty`,{},()=>[(0,s.createTextVNode)((0,s.toDisplayString)((0,s.unref)(v)(`select.noOptions`)),1)])]))],32)]),_:2},[(0,s.unref)(W)?{name:`header`,fn:(0,s.withCtx)(()=>[(0,s.createVNode)((0,s.unref)(i.t),{ref_key:`panelSearchInputElementRef`,ref:T,modelValue:h.value,"onUpdate:modelValue":u[0]||=e=>h.value=e,placeholder:n.searchPlaceholder,disabled:n.disabled,clearable:!1,"icon-left":`search`,onClick:u[1]||=(0,s.withModifiers)(()=>{},[`stop`]),onKeydown:(0,s.unref)(Ue)},null,8,[`modelValue`,`placeholder`,`disabled`,`onKeydown`])]),key:`0`}:void 0,(0,s.unref)(y)[`panel-footer`]?{name:`footer`,fn:(0,s.withCtx)(()=>[(0,s.renderSlot)(l.$slots,`panel-footer`)]),key:`1`}:void 0]),1024)]),_:3},8,[`modelValue`,`reference`,`disabled`,`fit-viewport`,`content-id`]),(0,s.createVNode)((0,s.unref)(i.t),{ref_key:`triggerInputRef`,ref:S,modelValue:C.value,"onUpdate:modelValue":u[7]||=e=>C.value=e,label:n.label,"label-props":n.labelProps,placeholder:n.placeholder,"help-messages":n.helpMessages,"error-messages":n.errorMessages,bordered:n.bordered,disabled:n.disabled,readonly:n.readonly,clearable:n.clearable,"has-value":(0,s.unref)(le),focused:F.value||O.value,"icon-left":n.iconLeft,customize:n.customize,name:n.name,id:Ee.value,onClear:Ke,onFocus:We,onBlur:Ge},(0,s.createSlots)({control:(0,s.withCtx)(()=>[(0,s.createElementVNode)(`div`,{id:Ee.value,class:(0,s.normalizeClass)([`s-ui-select__control s-ui-typography-body-14-regular`,{"s-ui-select__control--multiple":(0,s.unref)(G),"s-ui-select__control--empty":(0,s.unref)(G)&&!(0,s.unref)(le)&&!(0,s.unref)(H),"s-ui-select__control--with-value-suffix":he.value&&!(0,s.unref)(G)&&!(0,s.unref)(H)&&!(0,s.unref)(V)}]),role:`combobox`,"aria-expanded":O.value,"aria-controls":De.value,"aria-haspopup":`listbox`,"aria-disabled":n.disabled?!0:void 0,"aria-readonly":n.readonly?!0:void 0,"aria-autocomplete":(0,s.unref)(fe)?`list`:void 0,tabindex:Ae.value,onClick:Re,onKeydown:Ve},[(0,s.unref)(G)?(0,s.renderSlot)(l.$slots,`selection`,(0,s.normalizeProps)((0,s.mergeProps)({key:0},ke.value)),()=>[(0,s.unref)(B)?((0,s.openBlock)(),(0,s.createElementBlock)(`span`,ne,(0,s.toDisplayString)((0,s.unref)(B)),1)):(0,s.unref)(V)&&!(0,s.unref)(H)?((0,s.openBlock)(),(0,s.createElementBlock)(`span`,j,(0,s.toDisplayString)(n.placeholder),1)):(0,s.createCommentVNode)(``,!0)]):(0,s.unref)(V)&&!(0,s.unref)(H)?((0,s.openBlock)(),(0,s.createElementBlock)(`span`,M,(0,s.toDisplayString)(n.placeholder),1)):(0,s.unref)(H)?(0,s.createCommentVNode)(``,!0):((0,s.openBlock)(),(0,s.createElementBlock)(`span`,N,(0,s.toDisplayString)((0,s.unref)(ue)),1)),he.value&&!(0,s.unref)(G)&&!(0,s.unref)(H)&&!(0,s.unref)(V)?((0,s.openBlock)(),(0,s.createElementBlock)(`div`,re,[(0,s.renderSlot)(l.$slots,`value-suffix`,(0,s.normalizeProps)((0,s.guardReactiveProps)(ge.value)))])):(0,s.createCommentVNode)(``,!0),(0,s.unref)(H)?(0,s.withDirectives)(((0,s.openBlock)(),(0,s.createElementBlock)(`input`,{key:4,ref_key:`searchInputElementRef`,ref:w,"onUpdate:modelValue":u[5]||=e=>h.value=e,class:`s-ui-select__search-input`,type:`text`,name:n.name,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,autocomplete:`off`,onClick:u[6]||=(0,s.withModifiers)(()=>{},[`stop`]),onFocus:Fe,onKeydown:He},null,40,ie)),[[s.vModelText,h.value]]):(0,s.createCommentVNode)(``,!0)],42,te)]),action:(0,s.withCtx)(()=>[(0,s.createVNode)((0,s.unref)(c.SIcon),{name:`chevronMiniDown`,size:ae,class:`s-ui-select__chevron`})]),_:2},[(0,s.unref)(y).label?{name:`label`,fn:(0,s.withCtx)(()=>[(0,s.renderSlot)(l.$slots,`label`)]),key:`0`}:void 0,(0,s.unref)(y).prefix?{name:`prefix`,fn:(0,s.withCtx)(e=>[(0,s.renderSlot)(l.$slots,`prefix`,(0,s.normalizeProps)((0,s.guardReactiveProps)(e)))]),key:`1`}:void 0,(0,s.unref)(y).prepend?{name:`prepend`,fn:(0,s.withCtx)(e=>[(0,s.renderSlot)(l.$slots,`prepend`,(0,s.normalizeProps)((0,s.guardReactiveProps)(e)))]),key:`2`}:void 0,(0,s.unref)(y).message?{name:`message`,fn:(0,s.withCtx)(()=>[(0,s.renderSlot)(l.$slots,`message`)]),key:`3`}:void 0]),1032,[`modelValue`,`label`,`label-props`,`placeholder`,`help-messages`,`error-messages`,`bordered`,`disabled`,`readonly`,`clearable`,`has-value`,`focused`,`icon-left`,`customize`,`name`,`id`])],2))}});Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return F}});
|