@shtabapp/ui-kit 1.54.0 → 1.56.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 +17 -0
- package/dist/{SCard-BZ2TUqpd.cjs → SCard-DKZYyR5b.cjs} +1 -1
- package/dist/{SCard-BPYqNqDs.js → SCard-DgGxjBUV.js} +1 -1
- package/dist/{SCheckbox-CU6nzXrI.js → SCheckbox-BMkOc5cn.js} +7 -8
- package/dist/SCheckbox-DnnC5mOH.cjs +1 -0
- package/dist/{SColorPicker-DUTOeRA_.cjs → SColorPicker-Cucd749L.cjs} +1 -1
- package/dist/{SColorPicker-BhJiFjkD.js → SColorPicker-PI3xoFtS.js} +1 -1
- package/dist/{SInlineInput-6LglCWSn.cjs → SInlineInput-D3vCX4QA.cjs} +1 -1
- package/dist/{SInlineInput-DHq5BNPn.js → SInlineInput-DO_glYxP.js} +1 -1
- package/dist/{SInput-ug89CYt3.js → SInput-C-_R5pug.js} +1 -1
- package/dist/{SInput-DJL9QOIG.cjs → SInput-Cw8pt9Sr.cjs} +1 -1
- package/dist/SLabel-DLKfepRW.cjs +1 -0
- package/dist/SLabel-FHHPlcKq.js +59 -0
- package/dist/SList-D9SztBPD.cjs +1 -0
- package/dist/SList-DhjYsx7q.js +548 -0
- package/dist/SListItem-3IpjaE9h.cjs +1 -0
- package/dist/{SListItem-DJ8uSadf.js → SListItem-BYMbFs2A.js} +19 -19
- package/dist/{SRadio-C1CfSeb_.js → SRadio-D6_Pd6XX.js} +7 -8
- package/dist/SRadio-DRo_GU5A.cjs +1 -0
- package/dist/{SSelect-Cwlr2ruO.js → SSelect-8RPurgr-.js} +134 -148
- package/dist/SSelect-BVs3lWQ9.cjs +1 -0
- package/dist/STextarea-Cz7Frk82.cjs +1 -0
- package/dist/STextarea-SwVygHwh.js +148 -0
- package/dist/{SToggle-CSz9gHYO.js → SToggle-BtKNq9ZX.js} +6 -7
- package/dist/SToggle-FrWtwY4F.cjs +1 -0
- package/dist/components/SCheckbox/SCheckbox.vue.d.ts.map +1 -1
- package/dist/components/SLabel/SLabel.vue.d.ts +3 -3
- package/dist/components/SLabel/SLabel.vue.d.ts.map +1 -1
- package/dist/components/SList/SList.types.d.ts +2 -0
- package/dist/components/SList/SList.types.d.ts.map +1 -1
- package/dist/components/SList/SList.vue.d.ts.map +1 -1
- package/dist/components/SListItem/SListItem.vue.d.ts.map +1 -1
- package/dist/components/SRadio/SRadio.vue.d.ts.map +1 -1
- package/dist/components/SSelect/SSelect.vue.d.ts.map +1 -1
- package/dist/components/STextarea/STextarea.types.d.ts +6 -0
- package/dist/components/STextarea/STextarea.types.d.ts.map +1 -1
- package/dist/components/STextarea/STextarea.vue.d.ts.map +1 -1
- package/dist/components/SToggle/SToggle.vue.d.ts.map +1 -1
- package/dist/composables/useFlatTreeList.d.ts +8 -1
- package/dist/composables/useFlatTreeList.d.ts.map +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/color-picker.cjs +1 -1
- package/dist/entries/color-picker.js +1 -1
- package/dist/entries/inline-input.cjs +1 -1
- package/dist/entries/inline-input.js +1 -1
- package/dist/entries/input.cjs +1 -1
- package/dist/entries/input.js +1 -1
- package/dist/entries/label.cjs +1 -1
- package/dist/entries/label.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/textarea.cjs +1 -1
- package/dist/entries/textarea.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 +3 -3
- package/dist/SCheckbox-BAPXAjnl.cjs +0 -1
- package/dist/SLabel-CTiOAAOu.cjs +0 -1
- package/dist/SLabel-yzcX4qp5.js +0 -55
- package/dist/SList-BESqVnlh.js +0 -514
- package/dist/SList-qQ7B5u8o.cjs +0 -1
- package/dist/SListItem-DBGDVeoJ.cjs +0 -1
- package/dist/SRadio-xfAIUC2I.cjs +0 -1
- package/dist/SSelect-BEvgscGV.cjs +0 -1
- package/dist/STextarea-ASdLqfpC.js +0 -118
- package/dist/STextarea-BJWrc9t1.cjs +0 -1
- package/dist/SToggle-CXl6RWi1.cjs +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shtabapp/ui-kit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.56.0",
|
|
4
4
|
"description": "Vue 3 component library by Shtab — 30+ typed components, design tokens, light/dark themes",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"shtab",
|
|
@@ -264,8 +264,8 @@
|
|
|
264
264
|
"dependencies": {
|
|
265
265
|
"chart.js": "^4.5.0",
|
|
266
266
|
"vue-i18n": "^9.14.5",
|
|
267
|
-
"@shtabapp/ui-kit-
|
|
268
|
-
"@shtabapp/ui-kit-
|
|
267
|
+
"@shtabapp/ui-kit-primitives": "^1.24.0",
|
|
268
|
+
"@shtabapp/ui-kit-tokens": "^1.19.0"
|
|
269
269
|
},
|
|
270
270
|
"devDependencies": {
|
|
271
271
|
"@storybook/vue3-vite": "^10.4.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
let e=require("vue"),t=require("@shtabapp/ui-kit-primitives");var n=function(e){return e.EXTRA_SMALL=`extra-small`,e.SMALL=`small`,e}({}),r=function(e){return e.MAIN=`main`,e.SUCCESS=`success`,e}({}),i=function(e){return e.LEFT=`left`,e.RIGHT=`right`,e}({}),a=[`disabled`,`name`,`value`],o={class:`s-ui-checkbox__control`},s={key:0,class:`s-ui-checkbox__content`},c={key:0,class:`s-ui-checkbox__label s-ui-typography-label-14-medium`},l={key:1,class:`s-ui-checkbox__description s-ui-typography-body-12-regular`},u=16,d=(0,e.defineComponent)({__name:`SCheckbox`,props:(0,e.mergeModels)({color:{default:()=>r.MAIN},disabled:{type:Boolean,default:!1},indeterminate:{type:Boolean,default:!1},labelPlacement:{default:()=>i.RIGHT},name:{},size:{default:()=>n.EXTRA_SMALL},value:{}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:(0,e.mergeModels)([`change`],[`update:modelValue`]),setup(n,{emit:r}){let d=(0,e.useModel)(n,`modelValue`),f=r,p=(0,e.useSlots)(),m=(0,e.useTemplateRef)(`checkboxInputRef`),h=(0,e.computed)(()=>d.value),g=()=>{let e=m.value;e&&(e.indeterminate=n.indeterminate)};(0,e.watch)([m,()=>n.indeterminate,h],g,{immediate:!0,flush:`post`});let _=(0,e.computed)(()=>!!(p.default||p.description)),v=(0,e.computed)(()=>h.value&&!n.indeterminate),y=(0,e.computed)(()=>[`s-ui-checkbox--size-${n.size}`,`s-ui-checkbox--color-${n.color}`,{"s-ui-checkbox--checked":h.value,"s-ui-checkbox--indeterminate":n.indeterminate,"s-ui-checkbox--disabled":n.disabled,"s-ui-checkbox--label-left":n.labelPlacement===i.LEFT,"s-ui-checkbox--control-only":!_.value}]),b=e=>{if(!(e.target instanceof HTMLInputElement))return;let t=e.target.checked;g(),f(`change`,t)};return(r,i)=>((0,e.openBlock)(),(0,e.createElementBlock)(`label`,{class:(0,e.normalizeClass)([`s-ui-checkbox`,y.value])},[(0,e.withDirectives)((0,e.createElementVNode)(`input`,{ref_key:`checkboxInputRef`,ref:m,"onUpdate:modelValue":i[0]||=e=>d.value=e,type:`checkbox`,class:`s-ui-checkbox__input`,disabled:n.disabled,name:n.name,value:n.value,onChange:b},null,40,a),[[e.vModelCheckbox,d.value]]),(0,e.createElementVNode)(`span`,o,[v.value?((0,e.openBlock)(),(0,e.createBlock)((0,e.unref)(t.SIcon),{key:0,class:`s-ui-checkbox__icon`,name:`checkMini`,size:u})):n.indeterminate?((0,e.openBlock)(),(0,e.createBlock)((0,e.unref)(t.SIcon),{key:1,class:`s-ui-checkbox__icon`,name:`minusMini`,size:u})):(0,e.createCommentVNode)(``,!0)]),_.value?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,s,[(0,e.unref)(p).default?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,c,[(0,e.renderSlot)(r.$slots,`default`)])):(0,e.createCommentVNode)(``,!0),(0,e.unref)(p).description?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,l,[(0,e.renderSlot)(r.$slots,`description`)])):(0,e.createCommentVNode)(``,!0)])):(0,e.createCommentVNode)(``,!0)],2))}});Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return d}});
|
package/dist/SLabel-CTiOAAOu.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
let e=require("vue"),t=require("@shtabapp/ui-kit-primitives");var n=function(e){return e.EXTRA_SMALL=`extra-small`,e.SMALL=`small`,e.MEDIUM=`medium`,e}({}),r=function(e){return e.NEUTRAL=`neutral`,e.MAIN=`main`,e.ERROR=`error`,e.SUCCESS=`success`,e}({}),i={key:0,class:`s-ui-label__icon s-ui-label__icon_left`},a={class:`s-ui-label__text`},o={key:1,class:`s-ui-label__icon s-ui-label__icon_right`},s=16,c=(0,e.defineComponent)({__name:`SLabel`,props:{text:{},size:{default:()=>n.MEDIUM},variant:{default:()=>r.NEUTRAL},required:{type:Boolean,default:!1},iconLeft:{},iconRight:{},htmlFor:{}},setup(r){let c=(0,e.computed)(()=>r.htmlFor?`label`:`span`),l=(0,e.computed)(()=>[`s-ui-label--size-${r.size}`,`s-ui-label--variant-${r.variant}`]),u=(0,e.computed)(()=>r.size===n.EXTRA_SMALL?`s-ui-typography-label-10-medium`:r.size===n.SMALL?`s-ui-typography-label-12-medium`:`s-ui-typography-label-14-medium`),d=(0,e.computed)(()=>{if(r.size===n.SMALL||r.size===n.EXTRA_SMALL)return`s-ui-typography-label-14-medium`});return(n,f)=>((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(c.value),{class:(0,e.normalizeClass)([`s-ui-label`,l.value]),for:r.htmlFor},{default:(0,e.withCtx)(()=>[r.iconLeft?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,i,[(0,e.createVNode)((0,e.unref)(t.SIcon),{name:r.iconLeft,size:s},null,8,[`name`])])):(0,e.createCommentVNode)(``,!0),(0,e.createElementVNode)(`span`,{class:(0,e.normalizeClass)([`s-ui-label__body`,u.value])},[(0,e.createElementVNode)(`span`,a,[(0,e.renderSlot)(n.$slots,`default`,{},()=>[(0,e.createTextVNode)((0,e.toDisplayString)(r.text),1)])]),r.required?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{key:0,class:(0,e.normalizeClass)([`s-ui-label__required`,d.value])},` * `,2)):(0,e.createCommentVNode)(``,!0)],2),r.iconRight?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,o,[(0,e.createVNode)((0,e.unref)(t.SIcon),{name:r.iconRight,size:s},null,8,[`name`])])):(0,e.createCommentVNode)(``,!0)]),_:3},8,[`class`,`for`]))}});Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return c}});
|
package/dist/SLabel-yzcX4qp5.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { computed as e, createBlock as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, createTextVNode as a, createVNode as o, defineComponent as s, normalizeClass as c, openBlock as l, renderSlot as u, resolveDynamicComponent as d, toDisplayString as f, unref as p, withCtx as m } from "vue";
|
|
2
|
-
import { SIcon as h } from "@shtabapp/ui-kit-primitives";
|
|
3
|
-
//#region src/components/SLabel/SLabel.types.ts
|
|
4
|
-
var g = /* @__PURE__ */ function(e) {
|
|
5
|
-
return e.EXTRA_SMALL = "extra-small", e.SMALL = "small", e.MEDIUM = "medium", e;
|
|
6
|
-
}({}), _ = /* @__PURE__ */ function(e) {
|
|
7
|
-
return e.NEUTRAL = "neutral", e.MAIN = "main", e.ERROR = "error", e.SUCCESS = "success", e;
|
|
8
|
-
}({}), v = {
|
|
9
|
-
key: 0,
|
|
10
|
-
class: "s-ui-label__icon s-ui-label__icon_left"
|
|
11
|
-
}, y = { class: "s-ui-label__text" }, b = {
|
|
12
|
-
key: 1,
|
|
13
|
-
class: "s-ui-label__icon s-ui-label__icon_right"
|
|
14
|
-
}, x = 16, S = /* @__PURE__ */ s({
|
|
15
|
-
__name: "SLabel",
|
|
16
|
-
props: {
|
|
17
|
-
text: {},
|
|
18
|
-
size: { default: () => g.MEDIUM },
|
|
19
|
-
variant: { default: () => _.NEUTRAL },
|
|
20
|
-
required: {
|
|
21
|
-
type: Boolean,
|
|
22
|
-
default: !1
|
|
23
|
-
},
|
|
24
|
-
iconLeft: {},
|
|
25
|
-
iconRight: {},
|
|
26
|
-
htmlFor: {}
|
|
27
|
-
},
|
|
28
|
-
setup(s) {
|
|
29
|
-
let _ = e(() => s.htmlFor ? "label" : "span"), S = e(() => [`s-ui-label--size-${s.size}`, `s-ui-label--variant-${s.variant}`]), C = e(() => s.size === g.EXTRA_SMALL ? "s-ui-typography-label-10-medium" : s.size === g.SMALL ? "s-ui-typography-label-12-medium" : "s-ui-typography-label-14-medium"), w = e(() => {
|
|
30
|
-
if (s.size === g.SMALL || s.size === g.EXTRA_SMALL) return "s-ui-typography-label-14-medium";
|
|
31
|
-
});
|
|
32
|
-
return (e, g) => (l(), t(d(_.value), {
|
|
33
|
-
class: c(["s-ui-label", S.value]),
|
|
34
|
-
for: s.htmlFor
|
|
35
|
-
}, {
|
|
36
|
-
default: m(() => [
|
|
37
|
-
s.iconLeft ? (l(), r("span", v, [o(p(h), {
|
|
38
|
-
name: s.iconLeft,
|
|
39
|
-
size: x
|
|
40
|
-
}, null, 8, ["name"])])) : n("", !0),
|
|
41
|
-
i("span", { class: c(["s-ui-label__body", C.value]) }, [i("span", y, [u(e.$slots, "default", {}, () => [a(f(s.text), 1)])]), s.required ? (l(), r("span", {
|
|
42
|
-
key: 0,
|
|
43
|
-
class: c(["s-ui-label__required", w.value])
|
|
44
|
-
}, " * ", 2)) : n("", !0)], 2),
|
|
45
|
-
s.iconRight ? (l(), r("span", b, [o(p(h), {
|
|
46
|
-
name: s.iconRight,
|
|
47
|
-
size: x
|
|
48
|
-
}, null, 8, ["name"])])) : n("", !0)
|
|
49
|
-
]),
|
|
50
|
-
_: 3
|
|
51
|
-
}, 8, ["class", "for"]));
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
//#endregion
|
|
55
|
-
export { g as n, _ as r, S as t };
|
package/dist/SList-BESqVnlh.js
DELETED
|
@@ -1,514 +0,0 @@
|
|
|
1
|
-
import { n as e, o as t, r as n, t as r } from "./useSelectionGroup-cKj38lEN.js";
|
|
2
|
-
import { r as i, t as a } from "./SListItem-DJ8uSadf.js";
|
|
3
|
-
import { Fragment as o, computed as s, createBlock as c, createElementBlock as l, createElementVNode as u, createSlots as d, createVNode as f, defineComponent as p, mergeModels as m, mergeProps as h, nextTick as ee, normalizeClass as g, normalizeStyle as _, openBlock as v, provide as te, renderList as ne, renderSlot as y, toValue as b, unref as x, useId as re, useModel as S, useSlots as ie, useTemplateRef as ae, withCtx as C } from "vue";
|
|
4
|
-
import { ESIconName as w, SSpinner as oe, useUiKitI18n as se } from "@shtabapp/ui-kit-primitives";
|
|
5
|
-
import { useInfiniteScroll as T } from "@vueuse/core";
|
|
6
|
-
import { useVirtualizer as ce } from "@tanstack/vue-virtual";
|
|
7
|
-
//#region src/composables/useFlatTreeList.ts
|
|
8
|
-
var E = (e, t) => {
|
|
9
|
-
if (typeof t == "function") return t(e);
|
|
10
|
-
let n = e[t];
|
|
11
|
-
return typeof n == "string" ? n : typeof n == "number" ? String(n) : "";
|
|
12
|
-
}, D = (e, t) => {
|
|
13
|
-
let n = e[t];
|
|
14
|
-
return Array.isArray(n) ? n.filter((e) => typeof e == "object" && !!e) : [];
|
|
15
|
-
}, O = (e, t) => {
|
|
16
|
-
if (!t) return !1;
|
|
17
|
-
let n = e[t];
|
|
18
|
-
return typeof n == "boolean" ? n : !1;
|
|
19
|
-
}, le = "__s-ui-load-more:", k = (e) => `${le}${e}`, A = (e, t, n, r) => {
|
|
20
|
-
D(e, n).forEach((e) => {
|
|
21
|
-
let i = E(e, t);
|
|
22
|
-
i && r.add(i), A(e, t, n, r);
|
|
23
|
-
});
|
|
24
|
-
}, j = (e, t, n, r) => {
|
|
25
|
-
for (let i of e) {
|
|
26
|
-
if (E(i, n) === t) return i;
|
|
27
|
-
let e = j(D(i, r), t, n, r);
|
|
28
|
-
if (e) return e;
|
|
29
|
-
}
|
|
30
|
-
}, M = (e, t, n, r, i, a, o, s) => {
|
|
31
|
-
e.forEach((e) => {
|
|
32
|
-
let c = E(e, t);
|
|
33
|
-
if (!c) return;
|
|
34
|
-
let l = D(e, n), u = l.length > 0, d = r.includes(c);
|
|
35
|
-
o.push({
|
|
36
|
-
key: c,
|
|
37
|
-
item: e,
|
|
38
|
-
depth: i,
|
|
39
|
-
flatIndex: o.length,
|
|
40
|
-
hasChildren: u,
|
|
41
|
-
expanded: d,
|
|
42
|
-
parentKey: a
|
|
43
|
-
}), u && d && M(l, t, n, r, i + 1, c, o, s), u && d && O(e, s) && o.push({
|
|
44
|
-
key: k(c),
|
|
45
|
-
item: e,
|
|
46
|
-
depth: i + 1,
|
|
47
|
-
flatIndex: o.length,
|
|
48
|
-
hasChildren: !1,
|
|
49
|
-
expanded: !1,
|
|
50
|
-
parentKey: c,
|
|
51
|
-
loadMoreForKey: c
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
}, N = ({ items: e, childrenKey: t, itemKey: n, expanded: r, hasMoreChildrenKey: i }) => ({
|
|
55
|
-
flatRows: s(() => {
|
|
56
|
-
let a = [], o = b(e), s = b(t), c = b(n), l = b(i);
|
|
57
|
-
return M(o, c, s, r.value, 0, void 0, a, l), a;
|
|
58
|
-
}),
|
|
59
|
-
toggleExpanded: (i) => {
|
|
60
|
-
let a = b(e), o = b(t), s = b(n), c = new Set(r.value);
|
|
61
|
-
if (c.has(i)) {
|
|
62
|
-
c.delete(i);
|
|
63
|
-
let e = j(a, i, s, o);
|
|
64
|
-
if (e) {
|
|
65
|
-
let t = /* @__PURE__ */ new Set();
|
|
66
|
-
A(e, s, o, t), t.forEach((e) => {
|
|
67
|
-
c.delete(e);
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
} else c.add(i);
|
|
71
|
-
r.value = [...c];
|
|
72
|
-
},
|
|
73
|
-
isExpanded: (e) => r.value.includes(e)
|
|
74
|
-
}), ue = (e, t) => T(e, () => {
|
|
75
|
-
t.onEndReached();
|
|
76
|
-
}, {
|
|
77
|
-
distance: b(t.distance),
|
|
78
|
-
canLoadMore: () => t.canLoadMore === void 0 ? !0 : b(t.canLoadMore),
|
|
79
|
-
direction: "bottom"
|
|
80
|
-
}), P = /* @__PURE__ */ function(e) {
|
|
81
|
-
return e.NONE = "none", e.TWO_X_SMALL = "2x-small", e.X_SMALL = "x-small", e.SMALL = "small", e.MEDIUM = "medium", e.X_MEDIUM = "x-medium", e.LARGE = "large", e.X_LARGE = "x-large", e.TWO_X_LARGE = "2x-large", e;
|
|
82
|
-
}({}), F = P.TWO_X_SMALL, de = {
|
|
83
|
-
[P.NONE]: "var(--s-ui-space-gap-none)",
|
|
84
|
-
[P.TWO_X_SMALL]: "var(--s-ui-space-gap-2x-small)",
|
|
85
|
-
[P.X_SMALL]: "var(--s-ui-space-gap-x-small)",
|
|
86
|
-
[P.SMALL]: "var(--s-ui-space-gap-small)",
|
|
87
|
-
[P.MEDIUM]: "var(--s-ui-space-gap-medium)",
|
|
88
|
-
[P.X_MEDIUM]: "var(--s-ui-space-gap-x-medium)",
|
|
89
|
-
[P.LARGE]: "var(--s-ui-space-gap-large)",
|
|
90
|
-
[P.X_LARGE]: "var(--s-ui-space-gap-x-large)",
|
|
91
|
-
[P.TWO_X_LARGE]: "var(--s-ui-space-gap-2x-large)"
|
|
92
|
-
}, fe = {
|
|
93
|
-
[P.NONE]: 0,
|
|
94
|
-
[P.TWO_X_SMALL]: 2,
|
|
95
|
-
[P.X_SMALL]: 4,
|
|
96
|
-
[P.SMALL]: 8,
|
|
97
|
-
[P.MEDIUM]: 12,
|
|
98
|
-
[P.X_MEDIUM]: 16,
|
|
99
|
-
[P.LARGE]: 20,
|
|
100
|
-
[P.X_LARGE]: 24,
|
|
101
|
-
[P.TWO_X_LARGE]: 32
|
|
102
|
-
}, pe = (e, t) => `s-ui-list-option-${e}-${t}`, I = (e, t) => {
|
|
103
|
-
let n = e[t];
|
|
104
|
-
if (typeof n == "string") return n;
|
|
105
|
-
}, L = (e, t) => {
|
|
106
|
-
let n = e[t];
|
|
107
|
-
return typeof n == "boolean" ? n : !1;
|
|
108
|
-
}, R = (e) => e in w, z = (e, t) => {
|
|
109
|
-
let n = e[t];
|
|
110
|
-
if (typeof n == "string" && n.length > 0 && R(n)) return n;
|
|
111
|
-
}, B = (e, t) => typeof t == "string" && t ? t : Array.isArray(t) && t[0] ? t[0] : e, me = (e) => e.some((e) => e.hasChildren || e.parentKey), V = (e, t, n) => {
|
|
112
|
-
if (!e.hasChildren) return null;
|
|
113
|
-
if (!e.expanded) return {
|
|
114
|
-
type: "expand",
|
|
115
|
-
rowKey: t
|
|
116
|
-
};
|
|
117
|
-
let r = n.find((e) => e.parentKey === t);
|
|
118
|
-
return r ? {
|
|
119
|
-
type: "select",
|
|
120
|
-
rowKey: r.key
|
|
121
|
-
} : null;
|
|
122
|
-
}, H = (e, t) => e.hasChildren && e.expanded ? {
|
|
123
|
-
type: "collapse",
|
|
124
|
-
rowKey: t
|
|
125
|
-
} : e.parentKey ? {
|
|
126
|
-
type: "select",
|
|
127
|
-
rowKey: e.parentKey
|
|
128
|
-
} : null, he = (e, t, n) => {
|
|
129
|
-
let r = n.find((e) => e.key === t);
|
|
130
|
-
return r ? e === "ArrowRight" ? V(r, t, n) : H(r, t) : null;
|
|
131
|
-
}, U = (e, t, n, r) => {
|
|
132
|
-
for (let i = t; i >= 0 && i < e.length; i += n) {
|
|
133
|
-
let t = e[i];
|
|
134
|
-
if (t && t.depth <= r) return t.key;
|
|
135
|
-
}
|
|
136
|
-
return null;
|
|
137
|
-
}, ge = (e, t, n) => {
|
|
138
|
-
let r = n.findIndex((e) => e.key === t);
|
|
139
|
-
if (r === -1) return null;
|
|
140
|
-
let i = n[r];
|
|
141
|
-
if (!i) return null;
|
|
142
|
-
let a = e === "ArrowDown" ? 1 : -1;
|
|
143
|
-
return U(n, r + a, a, i.depth);
|
|
144
|
-
}, _e = ["role", "aria-multiselectable"], ve = [
|
|
145
|
-
"aria-multiselectable",
|
|
146
|
-
"aria-activedescendant",
|
|
147
|
-
"tabindex"
|
|
148
|
-
], ye = ["data-index"], be = {
|
|
149
|
-
key: 2,
|
|
150
|
-
class: "s-ui-list__static"
|
|
151
|
-
}, W = /* @__PURE__ */ p({
|
|
152
|
-
__name: "SList",
|
|
153
|
-
props: /*@__PURE__*/ m({
|
|
154
|
-
items: {},
|
|
155
|
-
itemKey: {
|
|
156
|
-
type: [String, Function],
|
|
157
|
-
default: "id"
|
|
158
|
-
},
|
|
159
|
-
childrenKey: { default: "children" },
|
|
160
|
-
titleKey: { default: "title" },
|
|
161
|
-
subtitleKey: { default: "subtitle" },
|
|
162
|
-
iconLeftKey: { default: "iconLeft" },
|
|
163
|
-
disabledKey: { default: "disabled" },
|
|
164
|
-
itemProps: { type: Function },
|
|
165
|
-
selectionMode: { default: () => e.NONE },
|
|
166
|
-
mandatory: {
|
|
167
|
-
type: Boolean,
|
|
168
|
-
default: !1
|
|
169
|
-
},
|
|
170
|
-
virtual: { type: Boolean },
|
|
171
|
-
gap: { default: () => F },
|
|
172
|
-
estimateItemSize: { default: 36 },
|
|
173
|
-
overscan: { default: 5 },
|
|
174
|
-
endReachedDistance: { default: 0 },
|
|
175
|
-
canLoadMore: { type: Function },
|
|
176
|
-
height: { default: 320 },
|
|
177
|
-
maxHeight: {},
|
|
178
|
-
revealRight: {
|
|
179
|
-
type: Boolean,
|
|
180
|
-
default: !1
|
|
181
|
-
},
|
|
182
|
-
expandOnClick: {
|
|
183
|
-
type: Boolean,
|
|
184
|
-
default: !1
|
|
185
|
-
},
|
|
186
|
-
hasMoreChildrenKey: {},
|
|
187
|
-
loadingMoreChildrenKeys: { default: () => [] }
|
|
188
|
-
}, {
|
|
189
|
-
modelValue: {},
|
|
190
|
-
modelModifiers: {},
|
|
191
|
-
selected: {},
|
|
192
|
-
selectedModifiers: {},
|
|
193
|
-
expanded: { default: () => [] },
|
|
194
|
-
expandedModifiers: {}
|
|
195
|
-
}),
|
|
196
|
-
emits: /*@__PURE__*/ m(["endReached", "loadMoreChildren"], [
|
|
197
|
-
"update:modelValue",
|
|
198
|
-
"update:selected",
|
|
199
|
-
"update:expanded"
|
|
200
|
-
]),
|
|
201
|
-
setup(p, { expose: m, emit: b }) {
|
|
202
|
-
let w = S(p, "modelValue"), T = S(p, "selected"), E = S(p, "expanded"), D = b, O = ie(), le = re(), k = ae("scrollElementRef"), A = ae("listRootElementRef"), j = s(() => fe[p.gap]), M = s(() => p.items !== void 0), P = s(() => M.value ? p.virtual === void 0 ? !0 : p.virtual : !1), { flatRows: F, toggleExpanded: R } = N({
|
|
203
|
-
items: () => p.items ?? [],
|
|
204
|
-
childrenKey: () => p.childrenKey,
|
|
205
|
-
itemKey: () => p.itemKey,
|
|
206
|
-
expanded: E,
|
|
207
|
-
hasMoreChildrenKey: () => p.hasMoreChildrenKey
|
|
208
|
-
}), { t: V } = se(), H = s(() => new Set(p.loadingMoreChildrenKeys)), U = s(() => V("list.loadMore")), W = (e) => e.loadMoreForKey ? H.value.has(e.loadMoreForKey) : !1, xe = (e, t) => {
|
|
209
|
-
H.value.has(e) || D("loadMoreChildren", {
|
|
210
|
-
key: e,
|
|
211
|
-
item: t
|
|
212
|
-
});
|
|
213
|
-
}, G = (e) => {
|
|
214
|
-
e.loadMoreForKey && xe(e.loadMoreForKey, e.item);
|
|
215
|
-
}, Se = (e) => ({
|
|
216
|
-
parentKey: e.loadMoreForKey ?? "",
|
|
217
|
-
parentItem: e.item,
|
|
218
|
-
depth: e.depth,
|
|
219
|
-
loading: W(e),
|
|
220
|
-
loadMore: () => {
|
|
221
|
-
G(e);
|
|
222
|
-
}
|
|
223
|
-
}), K = ce(s(() => ({
|
|
224
|
-
count: F.value.length,
|
|
225
|
-
getScrollElement: () => k.value,
|
|
226
|
-
estimateSize: () => p.estimateItemSize,
|
|
227
|
-
gap: j.value,
|
|
228
|
-
overscan: p.overscan
|
|
229
|
-
}))), Ce = s(() => {
|
|
230
|
-
if (M.value) return F.value.map((e) => e.key);
|
|
231
|
-
}), we = s(() => {
|
|
232
|
-
let e = /* @__PURE__ */ new Set();
|
|
233
|
-
for (let t of F.value) !t.loadMoreForKey && L(t.item, p.disabledKey) && e.add(t.key);
|
|
234
|
-
return e;
|
|
235
|
-
}), Te = async (e) => {
|
|
236
|
-
if (!P.value) return;
|
|
237
|
-
let t = F.value.findIndex((t) => t.key === e);
|
|
238
|
-
t !== -1 && (K.value.scrollToIndex(t, { align: "auto" }), await new Promise((e) => {
|
|
239
|
-
requestAnimationFrame(() => {
|
|
240
|
-
e();
|
|
241
|
-
});
|
|
242
|
-
}), await ee());
|
|
243
|
-
}, q = (e) => pe(le, e), J = t({
|
|
244
|
-
modelValue: () => T.value,
|
|
245
|
-
onUpdateModelValue: (e) => {
|
|
246
|
-
T.value = e;
|
|
247
|
-
},
|
|
248
|
-
mode: () => p.selectionMode,
|
|
249
|
-
mandatory: () => p.mandatory,
|
|
250
|
-
orientation: () => n.VERTICAL,
|
|
251
|
-
enableTabNavigation: !0,
|
|
252
|
-
focusMode: () => P.value ? r.ACTIVE_DESCENDANT : r.DOM,
|
|
253
|
-
orderedValues: Ce,
|
|
254
|
-
isValueDisabled: (e) => we.value.has(e),
|
|
255
|
-
onBeforeFocusItem: async (e) => {
|
|
256
|
-
await Te(e);
|
|
257
|
-
},
|
|
258
|
-
onFocusGroup: () => {
|
|
259
|
-
k.value?.focus();
|
|
260
|
-
}
|
|
261
|
-
}), Ee = s(() => M.value && me(F.value)), Y = () => {
|
|
262
|
-
if (P.value) {
|
|
263
|
-
k.value?.focus();
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
266
|
-
A.value?.focus();
|
|
267
|
-
}, De = () => {
|
|
268
|
-
J.focusedValue.value = void 0, w.value = void 0;
|
|
269
|
-
let e = document.activeElement;
|
|
270
|
-
e instanceof HTMLElement && e !== k.value && e.blur(), Y();
|
|
271
|
-
}, X = async (e) => {
|
|
272
|
-
P.value && await Te(e);
|
|
273
|
-
}, Oe = async (e) => {
|
|
274
|
-
if (De(), e.type === "expand" || e.type === "collapse") {
|
|
275
|
-
R(e.rowKey), J.select(e.rowKey, !1), await X(e.rowKey);
|
|
276
|
-
return;
|
|
277
|
-
}
|
|
278
|
-
J.select(e.rowKey, !1), await X(e.rowKey);
|
|
279
|
-
}, ke = async (e, t) => {
|
|
280
|
-
if (!Ee.value || e.key !== "ArrowUp" && e.key !== "ArrowDown") return !1;
|
|
281
|
-
let n = B(t, T.value), r = ge(e.key, n, F.value);
|
|
282
|
-
return r ? (e.preventDefault(), De(), J.select(r, !1), await X(r), !0) : !1;
|
|
283
|
-
}, Ae = async (e, t) => {
|
|
284
|
-
if (!Ee.value || e.key !== "ArrowLeft" && e.key !== "ArrowRight") return !1;
|
|
285
|
-
let n = B(t, T.value), r = he(e.key, n, F.value);
|
|
286
|
-
return r ? (e.preventDefault(), await Oe(r), !0) : !1;
|
|
287
|
-
}, Z = () => {
|
|
288
|
-
if (w.value) return w.value;
|
|
289
|
-
let e = B("", T.value);
|
|
290
|
-
if (e) return e;
|
|
291
|
-
let t = Ce.value;
|
|
292
|
-
if (t) {
|
|
293
|
-
for (let e of t) if (!we.value.has(e)) return e;
|
|
294
|
-
}
|
|
295
|
-
}, je = () => Z(), Me = async (e) => {
|
|
296
|
-
let t = je();
|
|
297
|
-
t && await Q(e, t);
|
|
298
|
-
}, Ne = [
|
|
299
|
-
"Enter",
|
|
300
|
-
" ",
|
|
301
|
-
"Spacebar"
|
|
302
|
-
], Pe = (e, t) => {
|
|
303
|
-
if (!Ne.includes(e.key)) return !1;
|
|
304
|
-
let n = F.value.find((e) => e.key === t);
|
|
305
|
-
return n?.loadMoreForKey ? (e.preventDefault(), xe(n.loadMoreForKey, n.item), !0) : !1;
|
|
306
|
-
}, Q = async (e, t) => {
|
|
307
|
-
Pe(e, t) || await ke(e, t) || await Ae(e, t) || (await J.handleItemKeydown(e, t), w.value = J.focusedValue.value, !J.focusedValue.value && !P.value && Y());
|
|
308
|
-
}, Fe = async (e) => {
|
|
309
|
-
let t = Z();
|
|
310
|
-
t && await Q(e, t);
|
|
311
|
-
}, Ie = async (e) => {
|
|
312
|
-
if (P.value || e.target !== A.value) return;
|
|
313
|
-
let t = Z();
|
|
314
|
-
t && await Q(e, t);
|
|
315
|
-
}, Le = async () => {
|
|
316
|
-
let e = Z();
|
|
317
|
-
if (!e) {
|
|
318
|
-
Y();
|
|
319
|
-
return;
|
|
320
|
-
}
|
|
321
|
-
await J.focusItem(e, !1);
|
|
322
|
-
};
|
|
323
|
-
te(i, {
|
|
324
|
-
mode: () => p.selectionMode,
|
|
325
|
-
isSelected: J.isSelected,
|
|
326
|
-
selectItem: J.toggle,
|
|
327
|
-
registerItem: J.registerItem,
|
|
328
|
-
getItemTabIndex: J.getItemTabIndex,
|
|
329
|
-
getGroupTabIndex: J.getGroupTabIndex,
|
|
330
|
-
handleItemKeydown: Q,
|
|
331
|
-
activeKey: () => w.value,
|
|
332
|
-
setActiveKey: (e) => {
|
|
333
|
-
w.value = e;
|
|
334
|
-
},
|
|
335
|
-
isExpanded: (e) => E.value.includes(e),
|
|
336
|
-
toggleExpanded: (e) => {
|
|
337
|
-
if (M.value) {
|
|
338
|
-
R(e);
|
|
339
|
-
return;
|
|
340
|
-
}
|
|
341
|
-
let t = new Set(E.value);
|
|
342
|
-
t.has(e) ? t.delete(e) : t.add(e), E.value = [...t];
|
|
343
|
-
},
|
|
344
|
-
revealRight: () => p.revealRight,
|
|
345
|
-
expandOnClick: () => p.expandOnClick,
|
|
346
|
-
getItemOptionId: (e) => {
|
|
347
|
-
if (P.value) return q(e);
|
|
348
|
-
},
|
|
349
|
-
usesActiveDescendantNavigation: () => P.value,
|
|
350
|
-
handlesTreeKeyboardNavigation: () => M.value
|
|
351
|
-
});
|
|
352
|
-
let Re = s(() => K.value.getVirtualItems()), ze = s(() => Re.value.flatMap((e) => {
|
|
353
|
-
let t = F.value[e.index];
|
|
354
|
-
return t ? [{
|
|
355
|
-
virtualRow: e,
|
|
356
|
-
flatRow: t
|
|
357
|
-
}] : [];
|
|
358
|
-
})), Be = s(() => K.value.getTotalSize()), Ve = s(() => ({
|
|
359
|
-
height: `${Be.value}px`,
|
|
360
|
-
position: "relative",
|
|
361
|
-
width: "100%"
|
|
362
|
-
})), He = s(() => {
|
|
363
|
-
let e = {};
|
|
364
|
-
return typeof p.height == "number" ? e.height = `${p.height}px` : p.height && (e.height = p.height), p.maxHeight && (typeof p.maxHeight == "number" ? e.maxHeight = `${p.maxHeight}px` : e.maxHeight = p.maxHeight), e;
|
|
365
|
-
}), Ue = s(() => ({
|
|
366
|
-
"s-ui-list--virtual": P.value,
|
|
367
|
-
"s-ui-list--static": !P.value
|
|
368
|
-
})), We = s(() => ({ "--s-ui-list-gap": de[p.gap] })), Ge = s(() => ({ "s-ui-list__scroll--flat": M.value && !P.value })), Ke = s(() => {
|
|
369
|
-
if (p.selectionMode === e.MULTIPLE) return !0;
|
|
370
|
-
}), qe = s(() => {
|
|
371
|
-
if (!P.value) return "listbox";
|
|
372
|
-
}), Je = s(() => {
|
|
373
|
-
if (!P.value) return Ke.value;
|
|
374
|
-
}), Ye = s(() => {
|
|
375
|
-
if (P.value) return J.getGroupTabIndex();
|
|
376
|
-
}), Xe = s(() => w.value ? w.value : B("", T.value)), Ze = s(() => {
|
|
377
|
-
if (!P.value) return;
|
|
378
|
-
let e = Xe.value;
|
|
379
|
-
if (e) return q(e);
|
|
380
|
-
});
|
|
381
|
-
ue(() => k.value, {
|
|
382
|
-
distance: () => p.endReachedDistance,
|
|
383
|
-
canLoadMore: () => p.canLoadMore ? p.canLoadMore() : !0,
|
|
384
|
-
onEndReached: () => {
|
|
385
|
-
D("endReached", { direction: "bottom" });
|
|
386
|
-
}
|
|
387
|
-
});
|
|
388
|
-
let Qe = (e) => ({
|
|
389
|
-
position: "absolute",
|
|
390
|
-
top: 0,
|
|
391
|
-
left: 0,
|
|
392
|
-
width: "100%",
|
|
393
|
-
transform: `translateY(${e.start}px)`
|
|
394
|
-
}), $e = (e) => {
|
|
395
|
-
e instanceof HTMLElement && K.value.measureElement(e);
|
|
396
|
-
}, et = (e) => {
|
|
397
|
-
let t = e.item, n = {
|
|
398
|
-
rowKey: e.key,
|
|
399
|
-
depth: e.depth,
|
|
400
|
-
expandable: e.hasChildren,
|
|
401
|
-
expanded: e.expanded,
|
|
402
|
-
selected: J.isSelected(e.key),
|
|
403
|
-
active: w.value === e.key,
|
|
404
|
-
disabled: L(t, p.disabledKey),
|
|
405
|
-
title: I(t, p.titleKey),
|
|
406
|
-
subtitle: I(t, p.subtitleKey),
|
|
407
|
-
iconLeft: z(t, p.iconLeftKey),
|
|
408
|
-
revealRight: p.revealRight
|
|
409
|
-
};
|
|
410
|
-
return p.itemProps ? {
|
|
411
|
-
...n,
|
|
412
|
-
...p.itemProps(t, e)
|
|
413
|
-
} : n;
|
|
414
|
-
}, $ = (e) => ({
|
|
415
|
-
...e,
|
|
416
|
-
revealRight: p.revealRight,
|
|
417
|
-
toggleExpanded: () => {
|
|
418
|
-
R(e.key);
|
|
419
|
-
}
|
|
420
|
-
});
|
|
421
|
-
return m({
|
|
422
|
-
focusNavigation: Le,
|
|
423
|
-
handleKeyboardNavigation: Fe
|
|
424
|
-
}), (e, t) => (v(), l("div", {
|
|
425
|
-
ref_key: "listRootElementRef",
|
|
426
|
-
ref: A,
|
|
427
|
-
class: g(["s-ui-list", Ue.value]),
|
|
428
|
-
style: _(We.value),
|
|
429
|
-
role: qe.value,
|
|
430
|
-
"aria-multiselectable": Je.value,
|
|
431
|
-
tabindex: "-1",
|
|
432
|
-
onKeydown: Ie
|
|
433
|
-
}, [M.value && P.value ? (v(), l("div", {
|
|
434
|
-
key: 0,
|
|
435
|
-
ref_key: "scrollElementRef",
|
|
436
|
-
ref: k,
|
|
437
|
-
class: g(["s-ui-list__scroll", Ge.value]),
|
|
438
|
-
style: _(He.value),
|
|
439
|
-
role: "listbox",
|
|
440
|
-
"aria-multiselectable": Ke.value,
|
|
441
|
-
"aria-activedescendant": Ze.value,
|
|
442
|
-
tabindex: Ye.value,
|
|
443
|
-
onKeydown: Me
|
|
444
|
-
}, [u("div", {
|
|
445
|
-
class: "s-ui-list__virtual-panel",
|
|
446
|
-
style: _(Ve.value)
|
|
447
|
-
}, [(v(!0), l(o, null, ne(ze.value, (t) => (v(), l("div", {
|
|
448
|
-
key: t.virtualRow.index,
|
|
449
|
-
class: "s-ui-list__virtual-row",
|
|
450
|
-
"data-index": t.virtualRow.index,
|
|
451
|
-
ref_for: !0,
|
|
452
|
-
ref: $e,
|
|
453
|
-
style: _(Qe(t.virtualRow))
|
|
454
|
-
}, [t.flatRow.loadMoreForKey ? (v(), l(o, { key: 0 }, [x(O).loadMore ? y(e.$slots, "loadMore", h({
|
|
455
|
-
key: 0,
|
|
456
|
-
ref_for: !0
|
|
457
|
-
}, Se(t.flatRow))) : (v(), c(x(a), {
|
|
458
|
-
key: 1,
|
|
459
|
-
"row-key": t.flatRow.key,
|
|
460
|
-
depth: t.flatRow.depth,
|
|
461
|
-
tiny: "",
|
|
462
|
-
title: U.value,
|
|
463
|
-
onClick: (e) => G(t.flatRow)
|
|
464
|
-
}, d({ _: 2 }, [W(t.flatRow) ? {
|
|
465
|
-
name: "icon-left",
|
|
466
|
-
fn: C(() => [f(x(oe), { size: 16 })]),
|
|
467
|
-
key: "0"
|
|
468
|
-
} : void 0]), 1032, [
|
|
469
|
-
"row-key",
|
|
470
|
-
"depth",
|
|
471
|
-
"title",
|
|
472
|
-
"onClick"
|
|
473
|
-
]))], 64)) : (v(), l(o, { key: 1 }, [x(O).item ? y(e.$slots, "item", h({
|
|
474
|
-
key: 0,
|
|
475
|
-
ref_for: !0
|
|
476
|
-
}, $(t.flatRow))) : (v(), c(x(a), h({
|
|
477
|
-
key: 1,
|
|
478
|
-
ref_for: !0
|
|
479
|
-
}, et(t.flatRow)), null, 16))], 64))], 12, ye))), 128))], 4)], 46, ve)) : M.value ? (v(), l("div", {
|
|
480
|
-
key: 1,
|
|
481
|
-
ref_key: "scrollElementRef",
|
|
482
|
-
ref: k,
|
|
483
|
-
class: g(["s-ui-list__scroll", Ge.value]),
|
|
484
|
-
style: _(He.value)
|
|
485
|
-
}, [(v(!0), l(o, null, ne(x(F), (t) => (v(), l(o, { key: t.key }, [t.loadMoreForKey ? (v(), l(o, { key: 0 }, [x(O).loadMore ? y(e.$slots, "loadMore", h({
|
|
486
|
-
key: 0,
|
|
487
|
-
ref_for: !0
|
|
488
|
-
}, Se(t))) : (v(), c(x(a), {
|
|
489
|
-
key: 1,
|
|
490
|
-
"row-key": t.key,
|
|
491
|
-
depth: t.depth,
|
|
492
|
-
tiny: "",
|
|
493
|
-
title: U.value,
|
|
494
|
-
onClick: (e) => G(t)
|
|
495
|
-
}, d({ _: 2 }, [W(t) ? {
|
|
496
|
-
name: "icon-left",
|
|
497
|
-
fn: C(() => [f(x(oe), { size: 16 })]),
|
|
498
|
-
key: "0"
|
|
499
|
-
} : void 0]), 1032, [
|
|
500
|
-
"row-key",
|
|
501
|
-
"depth",
|
|
502
|
-
"title",
|
|
503
|
-
"onClick"
|
|
504
|
-
]))], 64)) : (v(), l(o, { key: 1 }, [x(O).item ? y(e.$slots, "item", h({
|
|
505
|
-
key: 0,
|
|
506
|
-
ref_for: !0
|
|
507
|
-
}, $(t))) : (v(), c(x(a), h({
|
|
508
|
-
key: 1,
|
|
509
|
-
ref_for: !0
|
|
510
|
-
}, et(t)), null, 16))], 64))], 64))), 128))], 6)) : (v(), l("div", be, [y(e.$slots, "default")]))], 46, _e));
|
|
511
|
-
}
|
|
512
|
-
});
|
|
513
|
-
//#endregion
|
|
514
|
-
export { P as a, I as i, L as n, ue as o, z as r, N as s, W as t };
|
package/dist/SList-qQ7B5u8o.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./useSelectionGroup-TaektE-I.cjs"),t=require("./SListItem-DBGDVeoJ.cjs");let n=require("vue"),r=require("@shtabapp/ui-kit-primitives"),i=require("@vueuse/core"),a=require("@tanstack/vue-virtual");var o=(e,t)=>{if(typeof t==`function`)return t(e);let n=e[t];return typeof n==`string`?n:typeof n==`number`?String(n):``},s=(e,t)=>{let n=e[t];return Array.isArray(n)?n.filter(e=>typeof e==`object`&&!!e):[]},c=(e,t)=>{if(!t)return!1;let n=e[t];return typeof n==`boolean`?n:!1},l=`__s-ui-load-more:`,u=e=>`${l}${e}`,d=(e,t,n,r)=>{s(e,n).forEach(e=>{let i=o(e,t);i&&r.add(i),d(e,t,n,r)})},f=(e,t,n,r)=>{for(let i of e){if(o(i,n)===t)return i;let e=f(s(i,r),t,n,r);if(e)return e}},p=(e,t,n,r,i,a,l,d)=>{e.forEach(e=>{let f=o(e,t);if(!f)return;let m=s(e,n),h=m.length>0,g=r.includes(f);l.push({key:f,item:e,depth:i,flatIndex:l.length,hasChildren:h,expanded:g,parentKey:a}),h&&g&&p(m,t,n,r,i+1,f,l,d),h&&g&&c(e,d)&&l.push({key:u(f),item:e,depth:i+1,flatIndex:l.length,hasChildren:!1,expanded:!1,parentKey:f,loadMoreForKey:f})})},m=({items:e,childrenKey:t,itemKey:r,expanded:i,hasMoreChildrenKey:a})=>({flatRows:(0,n.computed)(()=>{let o=[],s=(0,n.toValue)(e),c=(0,n.toValue)(t),l=(0,n.toValue)(r),u=(0,n.toValue)(a);return p(s,l,c,i.value,0,void 0,o,u),o}),toggleExpanded:a=>{let o=(0,n.toValue)(e),s=(0,n.toValue)(t),c=(0,n.toValue)(r),l=new Set(i.value);if(l.has(a)){l.delete(a);let e=f(o,a,c,s);if(e){let t=new Set;d(e,c,s,t),t.forEach(e=>{l.delete(e)})}}else l.add(a);i.value=[...l]},isExpanded:e=>i.value.includes(e)}),h=(e,t)=>(0,i.useInfiniteScroll)(e,()=>{t.onEndReached()},{distance:(0,n.toValue)(t.distance),canLoadMore:()=>t.canLoadMore===void 0?!0:(0,n.toValue)(t.canLoadMore),direction:`bottom`}),g=function(e){return e.NONE=`none`,e.TWO_X_SMALL=`2x-small`,e.X_SMALL=`x-small`,e.SMALL=`small`,e.MEDIUM=`medium`,e.X_MEDIUM=`x-medium`,e.LARGE=`large`,e.X_LARGE=`x-large`,e.TWO_X_LARGE=`2x-large`,e}({}),_=g.TWO_X_SMALL,ee={[g.NONE]:`var(--s-ui-space-gap-none)`,[g.TWO_X_SMALL]:`var(--s-ui-space-gap-2x-small)`,[g.X_SMALL]:`var(--s-ui-space-gap-x-small)`,[g.SMALL]:`var(--s-ui-space-gap-small)`,[g.MEDIUM]:`var(--s-ui-space-gap-medium)`,[g.X_MEDIUM]:`var(--s-ui-space-gap-x-medium)`,[g.LARGE]:`var(--s-ui-space-gap-large)`,[g.X_LARGE]:`var(--s-ui-space-gap-x-large)`,[g.TWO_X_LARGE]:`var(--s-ui-space-gap-2x-large)`},te={[g.NONE]:0,[g.TWO_X_SMALL]:2,[g.X_SMALL]:4,[g.SMALL]:8,[g.MEDIUM]:12,[g.X_MEDIUM]:16,[g.LARGE]:20,[g.X_LARGE]:24,[g.TWO_X_LARGE]:32},ne=(e,t)=>`s-ui-list-option-${e}-${t}`,v=(e,t)=>{let n=e[t];if(typeof n==`string`)return n},y=(e,t)=>{let n=e[t];return typeof n==`boolean`?n:!1},b=e=>e in r.ESIconName,x=(e,t)=>{let n=e[t];if(typeof n==`string`&&n.length>0&&b(n))return n},S=(e,t)=>typeof t==`string`&&t?t:Array.isArray(t)&&t[0]?t[0]:e,re=e=>e.some(e=>e.hasChildren||e.parentKey),C=(e,t,n)=>{if(!e.hasChildren)return null;if(!e.expanded)return{type:`expand`,rowKey:t};let r=n.find(e=>e.parentKey===t);return r?{type:`select`,rowKey:r.key}:null},w=(e,t)=>e.hasChildren&&e.expanded?{type:`collapse`,rowKey:t}:e.parentKey?{type:`select`,rowKey:e.parentKey}:null,T=(e,t,n)=>{let r=n.find(e=>e.key===t);return r?e===`ArrowRight`?C(r,t,n):w(r,t):null},E=(e,t,n,r)=>{for(let i=t;i>=0&&i<e.length;i+=n){let t=e[i];if(t&&t.depth<=r)return t.key}return null},ie=(e,t,n)=>{let r=n.findIndex(e=>e.key===t);if(r===-1)return null;let i=n[r];if(!i)return null;let a=e===`ArrowDown`?1:-1;return E(n,r+a,a,i.depth)},ae=[`role`,`aria-multiselectable`],oe=[`aria-multiselectable`,`aria-activedescendant`,`tabindex`],se=[`data-index`],ce={key:2,class:`s-ui-list__static`},D=(0,n.defineComponent)({__name:`SList`,props:(0,n.mergeModels)({items:{},itemKey:{type:[String,Function],default:`id`},childrenKey:{default:`children`},titleKey:{default:`title`},subtitleKey:{default:`subtitle`},iconLeftKey:{default:`iconLeft`},disabledKey:{default:`disabled`},itemProps:{type:Function},selectionMode:{default:()=>e.n.NONE},mandatory:{type:Boolean,default:!1},virtual:{type:Boolean},gap:{default:()=>_},estimateItemSize:{default:36},overscan:{default:5},endReachedDistance:{default:0},canLoadMore:{type:Function},height:{default:320},maxHeight:{},revealRight:{type:Boolean,default:!1},expandOnClick:{type:Boolean,default:!1},hasMoreChildrenKey:{},loadingMoreChildrenKeys:{default:()=>[]}},{modelValue:{},modelModifiers:{},selected:{},selectedModifiers:{},expanded:{default:()=>[]},expandedModifiers:{}}),emits:(0,n.mergeModels)([`endReached`,`loadMoreChildren`],[`update:modelValue`,`update:selected`,`update:expanded`]),setup(i,{expose:o,emit:s}){let c=(0,n.useModel)(i,`modelValue`),l=(0,n.useModel)(i,`selected`),u=(0,n.useModel)(i,`expanded`),d=s,f=(0,n.useSlots)(),p=(0,n.useId)(),g=(0,n.useTemplateRef)(`scrollElementRef`),_=(0,n.useTemplateRef)(`listRootElementRef`),b=(0,n.computed)(()=>te[i.gap]),C=(0,n.computed)(()=>i.items!==void 0),w=(0,n.computed)(()=>C.value?i.virtual===void 0?!0:i.virtual:!1),{flatRows:E,toggleExpanded:D}=m({items:()=>i.items??[],childrenKey:()=>i.childrenKey,itemKey:()=>i.itemKey,expanded:u,hasMoreChildrenKey:()=>i.hasMoreChildrenKey}),{t:O}=(0,r.useUiKitI18n)(),k=(0,n.computed)(()=>new Set(i.loadingMoreChildrenKeys)),A=(0,n.computed)(()=>O(`list.loadMore`)),j=e=>e.loadMoreForKey?k.value.has(e.loadMoreForKey):!1,M=(e,t)=>{k.value.has(e)||d(`loadMoreChildren`,{key:e,item:t})},N=e=>{e.loadMoreForKey&&M(e.loadMoreForKey,e.item)},P=e=>({parentKey:e.loadMoreForKey??``,parentItem:e.item,depth:e.depth,loading:j(e),loadMore:()=>{N(e)}}),F=(0,a.useVirtualizer)((0,n.computed)(()=>({count:E.value.length,getScrollElement:()=>g.value,estimateSize:()=>i.estimateItemSize,gap:b.value,overscan:i.overscan}))),I=(0,n.computed)(()=>{if(C.value)return E.value.map(e=>e.key)}),L=(0,n.computed)(()=>{let e=new Set;for(let t of E.value)!t.loadMoreForKey&&y(t.item,i.disabledKey)&&e.add(t.key);return e}),R=async e=>{if(!w.value)return;let t=E.value.findIndex(t=>t.key===e);t!==-1&&(F.value.scrollToIndex(t,{align:`auto`}),await new Promise(e=>{requestAnimationFrame(()=>{e()})}),await(0,n.nextTick)())},z=e=>ne(p,e),B=e.o({modelValue:()=>l.value,onUpdateModelValue:e=>{l.value=e},mode:()=>i.selectionMode,mandatory:()=>i.mandatory,orientation:()=>e.r.VERTICAL,enableTabNavigation:!0,focusMode:()=>w.value?e.t.ACTIVE_DESCENDANT:e.t.DOM,orderedValues:I,isValueDisabled:e=>L.value.has(e),onBeforeFocusItem:async e=>{await R(e)},onFocusGroup:()=>{g.value?.focus()}}),V=(0,n.computed)(()=>C.value&&re(E.value)),H=()=>{if(w.value){g.value?.focus();return}_.value?.focus()},U=()=>{B.focusedValue.value=void 0,c.value=void 0;let e=document.activeElement;e instanceof HTMLElement&&e!==g.value&&e.blur(),H()},W=async e=>{w.value&&await R(e)},G=async e=>{if(U(),e.type===`expand`||e.type===`collapse`){D(e.rowKey),B.select(e.rowKey,!1),await W(e.rowKey);return}B.select(e.rowKey,!1),await W(e.rowKey)},K=async(e,t)=>{if(!V.value||e.key!==`ArrowUp`&&e.key!==`ArrowDown`)return!1;let n=S(t,l.value),r=ie(e.key,n,E.value);return r?(e.preventDefault(),U(),B.select(r,!1),await W(r),!0):!1},le=async(e,t)=>{if(!V.value||e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return!1;let n=S(t,l.value),r=T(e.key,n,E.value);return r?(e.preventDefault(),await G(r),!0):!1},q=()=>{if(c.value)return c.value;let e=S(``,l.value);if(e)return e;let t=I.value;if(t){for(let e of t)if(!L.value.has(e))return e}},ue=()=>q(),de=async e=>{let t=ue();t&&await J(e,t)},fe=[`Enter`,` `,`Spacebar`],pe=(e,t)=>{if(!fe.includes(e.key))return!1;let n=E.value.find(e=>e.key===t);return n?.loadMoreForKey?(e.preventDefault(),M(n.loadMoreForKey,n.item),!0):!1},J=async(e,t)=>{pe(e,t)||await K(e,t)||await le(e,t)||(await B.handleItemKeydown(e,t),c.value=B.focusedValue.value,!B.focusedValue.value&&!w.value&&H())},me=async e=>{let t=q();t&&await J(e,t)},he=async e=>{if(w.value||e.target!==_.value)return;let t=q();t&&await J(e,t)},ge=async()=>{let e=q();if(!e){H();return}await B.focusItem(e,!1)};(0,n.provide)(t.r,{mode:()=>i.selectionMode,isSelected:B.isSelected,selectItem:B.toggle,registerItem:B.registerItem,getItemTabIndex:B.getItemTabIndex,getGroupTabIndex:B.getGroupTabIndex,handleItemKeydown:J,activeKey:()=>c.value,setActiveKey:e=>{c.value=e},isExpanded:e=>u.value.includes(e),toggleExpanded:e=>{if(C.value){D(e);return}let t=new Set(u.value);t.has(e)?t.delete(e):t.add(e),u.value=[...t]},revealRight:()=>i.revealRight,expandOnClick:()=>i.expandOnClick,getItemOptionId:e=>{if(w.value)return z(e)},usesActiveDescendantNavigation:()=>w.value,handlesTreeKeyboardNavigation:()=>C.value});let _e=(0,n.computed)(()=>F.value.getVirtualItems()),ve=(0,n.computed)(()=>_e.value.flatMap(e=>{let t=E.value[e.index];return t?[{virtualRow:e,flatRow:t}]:[]})),ye=(0,n.computed)(()=>F.value.getTotalSize()),be=(0,n.computed)(()=>({height:`${ye.value}px`,position:`relative`,width:`100%`})),Y=(0,n.computed)(()=>{let e={};return typeof i.height==`number`?e.height=`${i.height}px`:i.height&&(e.height=i.height),i.maxHeight&&(typeof i.maxHeight==`number`?e.maxHeight=`${i.maxHeight}px`:e.maxHeight=i.maxHeight),e}),xe=(0,n.computed)(()=>({"s-ui-list--virtual":w.value,"s-ui-list--static":!w.value})),Se=(0,n.computed)(()=>({"--s-ui-list-gap":ee[i.gap]})),X=(0,n.computed)(()=>({"s-ui-list__scroll--flat":C.value&&!w.value})),Z=(0,n.computed)(()=>{if(i.selectionMode===e.n.MULTIPLE)return!0}),Ce=(0,n.computed)(()=>{if(!w.value)return`listbox`}),we=(0,n.computed)(()=>{if(!w.value)return Z.value}),Te=(0,n.computed)(()=>{if(w.value)return B.getGroupTabIndex()}),Ee=(0,n.computed)(()=>c.value?c.value:S(``,l.value)),De=(0,n.computed)(()=>{if(!w.value)return;let e=Ee.value;if(e)return z(e)});h(()=>g.value,{distance:()=>i.endReachedDistance,canLoadMore:()=>i.canLoadMore?i.canLoadMore():!0,onEndReached:()=>{d(`endReached`,{direction:`bottom`})}});let Oe=e=>({position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${e.start}px)`}),ke=e=>{e instanceof HTMLElement&&F.value.measureElement(e)},Q=e=>{let t=e.item,n={rowKey:e.key,depth:e.depth,expandable:e.hasChildren,expanded:e.expanded,selected:B.isSelected(e.key),active:c.value===e.key,disabled:y(t,i.disabledKey),title:v(t,i.titleKey),subtitle:v(t,i.subtitleKey),iconLeft:x(t,i.iconLeftKey),revealRight:i.revealRight};return i.itemProps?{...n,...i.itemProps(t,e)}:n},$=e=>({...e,revealRight:i.revealRight,toggleExpanded:()=>{D(e.key)}});return o({focusNavigation:ge,handleKeyboardNavigation:me}),(e,i)=>((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{ref_key:`listRootElementRef`,ref:_,class:(0,n.normalizeClass)([`s-ui-list`,xe.value]),style:(0,n.normalizeStyle)(Se.value),role:Ce.value,"aria-multiselectable":we.value,tabindex:`-1`,onKeydown:he},[C.value&&w.value?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{key:0,ref_key:`scrollElementRef`,ref:g,class:(0,n.normalizeClass)([`s-ui-list__scroll`,X.value]),style:(0,n.normalizeStyle)(Y.value),role:`listbox`,"aria-multiselectable":Z.value,"aria-activedescendant":De.value,tabindex:Te.value,onKeydown:de},[(0,n.createElementVNode)(`div`,{class:`s-ui-list__virtual-panel`,style:(0,n.normalizeStyle)(be.value)},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(ve.value,i=>((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{key:i.virtualRow.index,class:`s-ui-list__virtual-row`,"data-index":i.virtualRow.index,ref_for:!0,ref:ke,style:(0,n.normalizeStyle)(Oe(i.virtualRow))},[i.flatRow.loadMoreForKey?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:0},[(0,n.unref)(f).loadMore?(0,n.renderSlot)(e.$slots,`loadMore`,(0,n.mergeProps)({key:0,ref_for:!0},P(i.flatRow))):((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(t.t),{key:1,"row-key":i.flatRow.key,depth:i.flatRow.depth,tiny:``,title:A.value,onClick:e=>N(i.flatRow)},(0,n.createSlots)({_:2},[j(i.flatRow)?{name:`icon-left`,fn:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(r.SSpinner),{size:16})]),key:`0`}:void 0]),1032,[`row-key`,`depth`,`title`,`onClick`]))],64)):((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:1},[(0,n.unref)(f).item?(0,n.renderSlot)(e.$slots,`item`,(0,n.mergeProps)({key:0,ref_for:!0},$(i.flatRow))):((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(t.t),(0,n.mergeProps)({key:1,ref_for:!0},Q(i.flatRow)),null,16))],64))],12,se))),128))],4)],46,oe)):C.value?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{key:1,ref_key:`scrollElementRef`,ref:g,class:(0,n.normalizeClass)([`s-ui-list__scroll`,X.value]),style:(0,n.normalizeStyle)(Y.value)},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(E),i=>((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:i.key},[i.loadMoreForKey?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:0},[(0,n.unref)(f).loadMore?(0,n.renderSlot)(e.$slots,`loadMore`,(0,n.mergeProps)({key:0,ref_for:!0},P(i))):((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(t.t),{key:1,"row-key":i.key,depth:i.depth,tiny:``,title:A.value,onClick:e=>N(i)},(0,n.createSlots)({_:2},[j(i)?{name:`icon-left`,fn:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(r.SSpinner),{size:16})]),key:`0`}:void 0]),1032,[`row-key`,`depth`,`title`,`onClick`]))],64)):((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:1},[(0,n.unref)(f).item?(0,n.renderSlot)(e.$slots,`item`,(0,n.mergeProps)({key:0,ref_for:!0},$(i))):((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(t.t),(0,n.mergeProps)({key:1,ref_for:!0},Q(i)),null,16))],64))],64))),128))],6)):((0,n.openBlock)(),(0,n.createElementBlock)(`div`,ce,[(0,n.renderSlot)(e.$slots,`default`)]))],46,ae))}});Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return D}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./SButton.types-UKroD-ev.cjs"),t=require("./SButton-C-z_q5CG.cjs"),n=require("./useSelectLink-DDdMmsJB.cjs");let r=require("vue"),i=require("@shtabapp/ui-kit-primitives");var a=Symbol(`sListInjectionKey`),o=function(e){return e.NEUTRAL=`neutral`,e.MAIN=`main`,e.ERROR=`error`,e.BILLING=`billing`,e}({}),s=[`id`,`tabindex`,`aria-selected`,`aria-disabled`,`aria-readonly`,`aria-busy`,`aria-expanded`],c={key:0,class:`s-ui-list-item__level`},l={class:`s-ui-list-item__body`},u={key:0,class:`s-ui-list-item__icon-left`},d={class:`s-ui-list-item__text`},f={key:0,class:`s-ui-list-item__title s-ui-typography-label-14-medium`},p={key:1,class:`s-ui-list-item__subtitle s-ui-typography-body-12-regular`},m={key:1,class:`s-ui-list-item__title-action`},h={key:1,class:`s-ui-list-item__actions`},g={class:`s-ui-list-item__actions-reveal`},_={class:`s-ui-list-item__actions-inner`},v={key:0,class:`s-ui-list-item__trailing`},y={key:1,class:`s-ui-list-item__action-end`},b=16,x=`.s-ui-list-item__expand, .s-ui-list-item__title-action, .s-ui-list-item__actions`,S=(0,r.defineComponent)({__name:`SListItem`,props:{depth:{default:0},expandable:{type:Boolean,default:!1},expanded:{type:Boolean,default:!1},variant:{default:()=>o.NEUTRAL},tiny:{type:Boolean,default:!1},selected:{type:Boolean,default:!1},active:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},title:{},subtitle:{},iconLeft:{},rowKey:{},revealRight:{type:Boolean},expandOnClick:{type:Boolean}},emits:[`click`,`toggleExpand`,`keydown`],setup(S,{expose:C,emit:w}){let T=w,E=(0,r.computed)(()=>({disabled:S.disabled,readonly:S.readonly})),D=(0,r.useSlots)(),O=(0,r.useTemplateRef)(`listItemElementRef`),k=(0,r.inject)(a,null),{t:A}=(0,i.useUiKitI18n)(),j=n.n({group:()=>k,value:()=>S.rowKey,el:()=>O.value,disabled:()=>S.disabled||S.loading,interactive:()=>!S.readonly&&!S.loading}),M=(0,r.computed)(()=>S.variant===o.BILLING&&!S.disabled),N=(0,r.computed)(()=>!!(D.trailing||D.right||D[`action-end`])),P=(0,r.computed)(()=>k&&S.rowKey?k.isExpanded(S.rowKey):S.expanded),F=(0,r.computed)(()=>P.value?A(`listItem.collapse`):A(`listItem.expand`)),I=(0,r.computed)(()=>j.isInGroup.value?j.isActive.value:S.selected),L=(0,r.computed)(()=>k&&S.rowKey?k.activeKey()===S.rowKey:S.active),R=(0,r.computed)(()=>S.revealRight?!0:k?k.revealRight():!1),z=(0,r.computed)(()=>S.expandOnClick?!0:k?k.expandOnClick():!1),B=(0,r.computed)(()=>{if(!(!k||!S.rowKey))return k.getItemOptionId(S.rowKey)}),V=(0,r.computed)(()=>{if(k?.usesActiveDescendantNavigation())return-1;if(!(S.disabled||S.readonly||S.loading))return j.tabIndex.value===void 0?0:j.tabIndex.value}),H=(0,r.computed)(()=>({"--s-ui-list-item-depth":String(S.depth)})),U=(0,r.computed)(()=>[`s-ui-list-item--variant-${S.variant}`,{"s-ui-list-item--tiny":S.tiny,"s-ui-list-item--selected":I.value,"s-ui-list-item--active":L.value,"s-ui-list-item--disabled":S.disabled,"s-ui-list-item--readonly":S.readonly,"s-ui-list-item--loading":S.loading,"s-ui-list-item--expandable":S.expandable,"s-ui-list-item--reveal-right":R.value}]),W=()=>{if(k&&S.rowKey){k.toggleExpanded(S.rowKey);return}T(`toggleExpand`)},G=()=>{S.disabled||S.readonly||S.loading||W()},K=e=>e.target instanceof Element&&!!e.target.closest(x),q=e=>{S.disabled||S.readonly||S.loading||K(e)||(S.expandable&&z.value&&(k&&S.rowKey?k.toggleExpanded(S.rowKey):T(`toggleExpand`)),k&&S.rowKey&&k.setActiveKey(S.rowKey),j.isInGroup.value&&j.handleClick(),T(`click`,e))},J=e=>!S.expandable||k?.handlesTreeKeyboardNavigation()||e.key!==`ArrowLeft`&&e.key!==`ArrowRight`||e.key===`ArrowRight`===P.value?!1:(e.preventDefault(),W(),!0),Y=e=>{S.disabled||S.readonly||S.loading||(!J(e)&&j.isInGroup.value&&j.handleKeydown(e),T(`keydown`,e))};return C({listItemElementRef:O}),(n,a)=>((0,r.openBlock)(),(0,r.createElementBlock)(`div`,{ref_key:`listItemElementRef`,ref:O,id:B.value,class:(0,r.normalizeClass)([`s-ui-list-item`,U.value]),style:(0,r.normalizeStyle)(H.value),tabindex:V.value,role:`option`,"aria-selected":I.value?!0:void 0,"aria-disabled":S.disabled||S.loading?!0:void 0,"aria-readonly":S.readonly?!0:void 0,"aria-busy":S.loading?!0:void 0,"aria-expanded":S.expandable&&!S.loading?P.value:void 0,onClick:q,onKeydown:Y},[S.loading?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(i.SSkeleton),{key:0,type:(0,r.unref)(i.ESSkeletonType).S_LIST_ITEM},null,8,[`type`])):((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,{key:1},[S.expandable||S.depth||(0,r.unref)(D).level?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,c,[(0,r.renderSlot)(n.$slots,`level`,{},()=>[S.expandable?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(t.t),{key:0,class:(0,r.normalizeClass)([`s-ui-list-item__expand`,{"s-ui-list-item__expand--expanded":P.value}]),appearance:(0,r.unref)(e.t).BARE,variant:(0,r.unref)(e.r).NEUTRAL,size:(0,r.unref)(e.n).SMALL,icon:`chevronMiniRight`,disabled:S.disabled||S.readonly,tabindex:-1,"aria-label":F.value,onClick:(0,r.withModifiers)(G,[`stop`])},null,8,[`class`,`appearance`,`variant`,`size`,`disabled`,`aria-label`])):(0,r.createCommentVNode)(``,!0)])])):(0,r.createCommentVNode)(``,!0),(0,r.createElementVNode)(`div`,l,[S.iconLeft||(0,r.unref)(D)[`icon-left`]?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,u,[(0,r.renderSlot)(n.$slots,`icon-left`,{},()=>[S.iconLeft?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(i.SIcon),{key:0,name:S.iconLeft,size:b,billing:M.value},null,8,[`name`,`billing`])):(0,r.createCommentVNode)(``,!0)])])):(0,r.createCommentVNode)(``,!0),(0,r.createElementVNode)(`div`,d,[S.title||(0,r.unref)(D).title?((0,r.openBlock)(),(0,r.createElementBlock)(`span`,f,[(0,r.renderSlot)(n.$slots,`title`,{},()=>[(0,r.createTextVNode)((0,r.toDisplayString)(S.title),1)])])):(0,r.createCommentVNode)(``,!0),S.subtitle||(0,r.unref)(D).subtitle?((0,r.openBlock)(),(0,r.createElementBlock)(`span`,p,[(0,r.renderSlot)(n.$slots,`subtitle`,{},()=>[(0,r.createTextVNode)((0,r.toDisplayString)(S.subtitle),1)])])):(0,r.createCommentVNode)(``,!0)]),(0,r.unref)(D)[`title-action`]?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,m,[(0,r.renderSlot)(n.$slots,`title-action`,(0,r.normalizeProps)((0,r.guardReactiveProps)(E.value)))])):(0,r.createCommentVNode)(``,!0)]),N.value?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,h,[(0,r.createElementVNode)(`div`,g,[(0,r.createElementVNode)(`div`,_,[(0,r.unref)(D).trailing?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,v,[(0,r.renderSlot)(n.$slots,`trailing`,(0,r.normalizeProps)((0,r.guardReactiveProps)(E.value)))])):(0,r.createCommentVNode)(``,!0),(0,r.renderSlot)(n.$slots,`right`,(0,r.normalizeProps)((0,r.guardReactiveProps)(E.value))),(0,r.unref)(D)[`action-end`]?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,y,[(0,r.renderSlot)(n.$slots,`action-end`,(0,r.normalizeProps)((0,r.guardReactiveProps)(E.value)))])):(0,r.createCommentVNode)(``,!0)])])])):(0,r.createCommentVNode)(``,!0)],64))],46,s))}});Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return S}});
|
package/dist/SRadio-xfAIUC2I.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
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.RIGHT},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-left":o.labelPlacement===t.LEFT,"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}});
|