@kernel4632/kima 0.29.0 → 0.31.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/README.md +61 -43
- package/dist/components/containment/morph.ce.vue_vue_type_style_index_0_scoped_10a98d89_lang.css +1 -0
- package/dist/components/core/button.ce.vue_vue_type_style_index_0_scoped_49fea117_lang.css +1 -0
- package/dist/components/core/combobox.ce.vue_vue_type_style_index_0_scoped_82d70c66_lang.css +1 -0
- package/dist/components/core/dialog.ce.vue_vue_type_style_index_0_scoped_638cbfdc_lang.css +1 -0
- package/dist/components/core/{fab-menu.ce.vue_vue_type_style_index_0_scoped_7c25d968_lang.css → fab-menu.ce.vue_vue_type_style_index_0_scoped_eff6cc0c_lang.css} +1 -1
- package/dist/components/core/menu.ce.vue_vue_type_style_index_0_scoped_6cc90694_lang.css +1 -0
- package/dist/components/core/{morph-field.ce.vue_vue_type_style_index_0_scoped_ac757a01_lang.css → morph-field.ce.vue_vue_type_style_index_0_scoped_d8ed6708_lang.css} +1 -1
- package/dist/components/core/{select.ce.vue_vue_type_style_index_0_scoped_bf4d9de4_lang.css → select.ce.vue_vue_type_style_index_0_scoped_8fda1ce2_lang.css} +1 -1
- package/dist/components/core/split-button.ce.vue_vue_type_style_index_0_scoped_b4a612b7_lang.css +1 -0
- package/dist/components/data/table.ce.vue_vue_type_style_index_0_scoped_8300e08d_lang.css +1 -0
- package/dist/components/input/{textarea.ce.vue_vue_type_style_index_0_scoped_f6be6515_lang.css → textarea.ce.vue_vue_type_style_index_0_scoped_db526211_lang.css} +1 -1
- package/dist/kima-elements-core.js +2455 -2389
- package/dist/kima-elements.js +7710 -7270
- package/dist/kima.js +21 -20
- package/dist/style.css +13 -11
- package/dist/styles/_tokens.css +1 -1
- package/dist/styles/button.css +1 -1
- package/dist/styles/collapsible.css +1 -1
- package/dist/styles/combobox.css +1 -1
- package/dist/styles/core.css +10 -10
- package/dist/styles/dialog.css +2 -2
- package/dist/styles/fab-menu.css +1 -1
- package/dist/styles/menu.css +1 -1
- package/dist/styles/morph-field.css +1 -1
- package/dist/styles/morph.css +2 -0
- package/dist/styles/popover.css +1 -1
- package/dist/styles/select.css +1 -1
- package/dist/styles/split-button.css +1 -1
- package/dist/styles/table.css +1 -1
- package/dist/styles/textarea.css +1 -1
- package/dist/vue/components/containment/morph.ce.js +81 -0
- package/dist/vue/components/core/button.ce.js +63 -27
- package/dist/vue/components/core/combobox.ce.js +116 -117
- package/dist/vue/components/core/dialog.ce.js +55 -56
- package/dist/vue/components/core/fab-menu.ce.js +51 -59
- package/dist/vue/components/core/menu.ce.js +88 -84
- package/dist/vue/components/core/morph-field.ce.js +34 -35
- package/dist/vue/components/core/select.ce.js +167 -168
- package/dist/vue/components/core/split-button.ce.js +54 -62
- package/dist/vue/components/data/table.ce.js +3 -2
- package/dist/vue/components/input/textarea.ce.js +2 -5
- package/dist/vue/internal/menu-items.js +107 -63
- package/dist/vue/utils/interaction.js +19 -22
- package/dist/vue/utils/model.js +29 -0
- package/dist/vue/utils/morph.js +306 -0
- package/dist/vue/utils/navigation.js +14 -17
- package/dist/vue/utils/shell.js +12 -20
- package/package.json +2 -1
- package/dist/components/core/button.ce.vue_vue_type_style_index_0_scoped_1c004601_lang.css +0 -1
- package/dist/components/core/combobox.ce.vue_vue_type_style_index_0_scoped_ba7220f2_lang.css +0 -1
- package/dist/components/core/dialog.ce.vue_vue_type_style_index_0_scoped_09f96946_lang.css +0 -1
- package/dist/components/core/menu.ce.vue_vue_type_style_index_0_scoped_16ed5f4d_lang.css +0 -1
- package/dist/components/core/split-button.ce.vue_vue_type_style_index_0_scoped_a8ef75a5_lang.css +0 -1
- package/dist/components/data/table.ce.vue_vue_type_style_index_0_scoped_de17ceaa_lang.css +0 -1
|
@@ -2,21 +2,22 @@ import { useNormalizedRadius as e } from "../../utils/radius.js";
|
|
|
2
2
|
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
3
3
|
import n from "./icon.ce.js";
|
|
4
4
|
import { useRipple as r } from "../../utils/ripple.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { useModelState as i } from "../../utils/model.js";
|
|
6
|
+
import { register as a, unregister as o } from "../../utils/popup-manager.js";
|
|
7
|
+
import { cancelPopupLeave as s, playPopupLeave as c } from "../../utils/popup-motion.js";
|
|
8
|
+
import { dismissInteraction as l } from "../../utils/interaction.js";
|
|
8
9
|
/* empty css */
|
|
9
|
-
import { Fragment as
|
|
10
|
-
import { ArrowDown01Icon as
|
|
11
|
-
import { PopoverContent as
|
|
10
|
+
import { Fragment as ee, computed as te, createBlock as ne, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createVNode as p, mergeProps as m, nextTick as h, normalizeClass as g, onBeforeUnmount as _, onMounted as v, openBlock as y, ref as b, renderList as x, toDisplayString as S, unref as C, useAttrs as re, useId as ie, watch as w, withCtx as T } from "vue";
|
|
11
|
+
import { ArrowDown01Icon as E } from "@hugeicons/core-free-icons";
|
|
12
|
+
import { PopoverContent as D, PopoverRoot as O } from "reka-ui";
|
|
12
13
|
// src/components/core/split-button.ce.vue
|
|
13
|
-
var
|
|
14
|
+
var k = ["disabled"], A = [
|
|
14
15
|
"disabled",
|
|
15
16
|
"aria-expanded",
|
|
16
17
|
"aria-label"
|
|
17
|
-
],
|
|
18
|
+
], j = ["aria-label"], M = ["disabled", "onClick"], N = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
18
19
|
__name: "split-button.ce",
|
|
19
|
-
props:
|
|
20
|
+
props: {
|
|
20
21
|
label: {
|
|
21
22
|
type: String,
|
|
22
23
|
default: ""
|
|
@@ -33,94 +34,85 @@ var j = ["disabled"], M = [
|
|
|
33
34
|
radius: {
|
|
34
35
|
type: [String, Number],
|
|
35
36
|
default: null
|
|
36
|
-
}
|
|
37
|
-
}, {
|
|
38
|
-
open: {
|
|
39
|
-
type: Boolean,
|
|
40
|
-
default: !1
|
|
41
37
|
},
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
emits:
|
|
38
|
+
open: Boolean
|
|
39
|
+
},
|
|
40
|
+
emits: [
|
|
45
41
|
"update:open",
|
|
46
42
|
"select",
|
|
47
43
|
"click"
|
|
48
|
-
],
|
|
49
|
-
setup(t, { emit:
|
|
50
|
-
let
|
|
44
|
+
],
|
|
45
|
+
setup(t, { emit: N }) {
|
|
46
|
+
let P = t, F = N, [I, L] = i(P, "open", F), R = re(), z = b(null), B = b(null), V = b(null), H = b(null), { radiusAttrs: U, radiusStyle: W } = e(V, () => P.radius);
|
|
51
47
|
r(z), r(B);
|
|
52
|
-
let G =
|
|
48
|
+
let G = te(() => [
|
|
53
49
|
"filled",
|
|
54
50
|
"tonal",
|
|
55
51
|
"outlined",
|
|
56
52
|
"elevated"
|
|
57
|
-
].includes(
|
|
53
|
+
].includes(P.variant) ? P.variant : "filled");
|
|
58
54
|
function K() {
|
|
59
|
-
!
|
|
55
|
+
!P.disabled && P.items.length && L(!I.value);
|
|
60
56
|
}
|
|
61
57
|
function q(e) {
|
|
62
|
-
e.disabled || (L
|
|
58
|
+
e.disabled || (L(!1), F("select", e.value));
|
|
63
59
|
}
|
|
64
|
-
let J = `kima-split-button-${
|
|
60
|
+
let J = `kima-split-button-${ie()}`, Y = !1, ae = (e) => e.includes(V.value) || e.includes(H.value);
|
|
65
61
|
function X(e) {
|
|
66
|
-
Y && (e ?
|
|
67
|
-
close: () =>
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
isInside: ie
|
|
71
|
-
}) : a(J));
|
|
62
|
+
Y && (e ? a(J, {
|
|
63
|
+
close: () => L(!1),
|
|
64
|
+
isInside: ae
|
|
65
|
+
}) : o(J));
|
|
72
66
|
}
|
|
73
|
-
|
|
74
|
-
let Z =
|
|
75
|
-
|
|
76
|
-
e ? (Q += 1, Z.value = !1,
|
|
77
|
-
if (!H.value ||
|
|
67
|
+
w(I, X);
|
|
68
|
+
let Z = b(!1), Q = 0;
|
|
69
|
+
w(I, (e) => {
|
|
70
|
+
e ? (Q += 1, Z.value = !1, s(H.value)) : H.value && (Z.value = !0, h(() => {
|
|
71
|
+
if (!H.value || I.value) return;
|
|
78
72
|
let e = ++Q;
|
|
79
|
-
|
|
73
|
+
c(H.value, () => {
|
|
80
74
|
e === Q && (Z.value = !1);
|
|
81
75
|
});
|
|
82
76
|
}));
|
|
83
77
|
});
|
|
84
78
|
function $(e) {
|
|
85
|
-
|
|
86
|
-
L.value = !1;
|
|
87
|
-
});
|
|
79
|
+
I.value && e.key === "Escape" && l(e, () => L(!1));
|
|
88
80
|
}
|
|
89
|
-
return
|
|
90
|
-
Y = !0, X(
|
|
91
|
-
}),
|
|
92
|
-
Y = !1,
|
|
93
|
-
}), (e, r) => (
|
|
81
|
+
return v(() => {
|
|
82
|
+
Y = !0, X(I.value), window.addEventListener("keydown", $, !0);
|
|
83
|
+
}), _(() => {
|
|
84
|
+
Y = !1, o(J), window.removeEventListener("keydown", $, !0);
|
|
85
|
+
}), (e, r) => (y(), d("div", m({
|
|
94
86
|
ref_key: "root",
|
|
95
87
|
ref: V
|
|
96
|
-
},
|
|
97
|
-
style:
|
|
88
|
+
}, C(U), {
|
|
89
|
+
style: C(W),
|
|
98
90
|
class: ["kima-split-button", `kima-split-button--${G.value}`]
|
|
99
91
|
}), [
|
|
100
|
-
f("button",
|
|
92
|
+
f("button", m({
|
|
101
93
|
ref_key: "mainButton",
|
|
102
94
|
ref: z,
|
|
103
95
|
class: "kima-split-button__main",
|
|
104
96
|
disabled: t.disabled
|
|
105
|
-
},
|
|
97
|
+
}, C(R), { onClick: r[0] ||= (e) => F("click", e) }), [f("span", null, S(t.label), 1)], 16, k),
|
|
106
98
|
f("button", {
|
|
107
99
|
ref_key: "trailButton",
|
|
108
100
|
ref: B,
|
|
109
|
-
class:
|
|
101
|
+
class: g(["kima-split-button__trail", { "kima-split-button__trail--open": C(I) }]),
|
|
110
102
|
disabled: t.disabled,
|
|
111
|
-
"aria-expanded":
|
|
103
|
+
"aria-expanded": C(I),
|
|
112
104
|
"aria-haspopup": "menu",
|
|
113
105
|
"aria-label": `${t.label} 更多选项`,
|
|
114
106
|
onClick: K
|
|
115
107
|
}, [p(n, {
|
|
116
|
-
icon:
|
|
108
|
+
icon: C(E),
|
|
117
109
|
size: 20
|
|
118
|
-
}, null, 8, ["icon"])], 10,
|
|
119
|
-
p(
|
|
120
|
-
open:
|
|
110
|
+
}, null, 8, ["icon"])], 10, A),
|
|
111
|
+
p(C(O), {
|
|
112
|
+
open: C(I) && !t.disabled,
|
|
121
113
|
modal: !1
|
|
122
114
|
}, {
|
|
123
|
-
default:
|
|
115
|
+
default: T(() => [C(I) || Z.value ? (y(), ne(C(D), {
|
|
124
116
|
key: 0,
|
|
125
117
|
"as-child": "",
|
|
126
118
|
reference: V.value,
|
|
@@ -133,24 +125,24 @@ var j = ["disabled"], M = [
|
|
|
133
125
|
"hide-when-detached": "",
|
|
134
126
|
"force-mount": ""
|
|
135
127
|
}, {
|
|
136
|
-
default:
|
|
128
|
+
default: T(() => [f("div", {
|
|
137
129
|
ref_key: "menu",
|
|
138
130
|
ref: H,
|
|
139
131
|
class: "kima-split-button__menu",
|
|
140
132
|
role: "menu",
|
|
141
133
|
"aria-label": `${t.label} 菜单`
|
|
142
|
-
}, [(
|
|
134
|
+
}, [(y(!0), d(ee, null, x(t.items, (e) => (y(), d("button", {
|
|
143
135
|
key: e.value,
|
|
144
136
|
class: "kima-split-button__menu-item",
|
|
145
137
|
role: "menuitem",
|
|
146
138
|
disabled: e.disabled,
|
|
147
139
|
onClick: (t) => q(e)
|
|
148
|
-
},
|
|
140
|
+
}, S(e.label), 9, M))), 128))], 8, j)]),
|
|
149
141
|
_: 1
|
|
150
|
-
}, 8, ["reference"])) :
|
|
142
|
+
}, 8, ["reference"])) : u("", !0)]),
|
|
151
143
|
_: 1
|
|
152
144
|
}, 8, ["open"])
|
|
153
145
|
], 16));
|
|
154
146
|
}
|
|
155
|
-
}), [["__scopeId", "data-v-
|
|
156
|
-
export {
|
|
147
|
+
}), [["__scopeId", "data-v-b4a612b7"]]);
|
|
148
|
+
export { N as default };
|
|
@@ -146,7 +146,8 @@ var pe = ["aria-label"], me = ["aria-busy"], he = { key: 0 }, ge = {
|
|
|
146
146
|
"filter-change",
|
|
147
147
|
"update:expandedRows",
|
|
148
148
|
"expand",
|
|
149
|
-
"cell-edit"
|
|
149
|
+
"cell-edit",
|
|
150
|
+
"column-resize"
|
|
150
151
|
],
|
|
151
152
|
setup(t, { emit: w }) {
|
|
152
153
|
let T = t, E = w, D = ne(), Ge = ee().ce ? re() : null, Ke = o(() => Ge ? {
|
|
@@ -507,5 +508,5 @@ var pe = ["aria-label"], me = ["aria-busy"], he = { key: 0 }, ge = {
|
|
|
507
508
|
])])) : s("", !0)
|
|
508
509
|
], 16, me)], 16, pe)], 2));
|
|
509
510
|
}
|
|
510
|
-
}), [["__scopeId", "data-v-
|
|
511
|
+
}), [["__scopeId", "data-v-8300e08d"]]);
|
|
511
512
|
export { w as default };
|
|
@@ -134,10 +134,7 @@ var ie = ["aria-disabled"], ae = ["aria-disabled"], A = [
|
|
|
134
134
|
return o($, () => [F.error || F.hint, !!F.error]), N({ focus: () => B.value?.focus() }), (e, n) => (S(), d("div", {
|
|
135
135
|
class: v([
|
|
136
136
|
"kima-textarea",
|
|
137
|
-
{
|
|
138
|
-
"kima-textarea--error": !!t.error,
|
|
139
|
-
"kima-textarea--clearable": e.clearable
|
|
140
|
-
},
|
|
137
|
+
{ "kima-textarea--error": !!t.error },
|
|
141
138
|
T(G).class
|
|
142
139
|
]),
|
|
143
140
|
style: y(T(G).style),
|
|
@@ -192,5 +189,5 @@ var ie = ["aria-disabled"], ae = ["aria-disabled"], A = [
|
|
|
192
189
|
_: 1
|
|
193
190
|
}, 16), t.showCount ? (S(), d("p", M, [p(w(T(q).length), 1), t.maxlength == null ? u("", !0) : (S(), d(s, { key: 0 }, [p(" / " + w(t.maxlength), 1)], 64))])) : u("", !0)])], 14, ie));
|
|
194
191
|
}
|
|
195
|
-
}), [["__scopeId", "data-v-
|
|
192
|
+
}), [["__scopeId", "data-v-db526211"]]);
|
|
196
193
|
export { N as default };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import e from "../components/core/icon.ce.js";
|
|
2
2
|
import { presenceTransition as t } from "../utils/motion.js";
|
|
3
|
-
import { Fragment as n, Transition as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c,
|
|
4
|
-
import { ArrowRight01Icon as
|
|
5
|
-
import * as
|
|
3
|
+
import { Fragment as n, Transition as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createSlots as l, createVNode as u, mergeProps as d, normalizeClass as f, openBlock as p, reactive as m, renderList as h, renderSlot as g, resolveComponent as _, resolveDynamicComponent as v, toDisplayString as y, unref as b, withCtx as x } from "vue";
|
|
4
|
+
import { ArrowRight01Icon as S } from "@hugeicons/core-free-icons";
|
|
5
|
+
import * as C from "reka-ui";
|
|
6
6
|
// src/internal/menu-items.vue
|
|
7
|
-
var
|
|
7
|
+
var w = { class: "kima-shell-menu__content" }, T = { class: "kima-shell-menu__content" }, E = { class: "kima-shell-menu__content" }, D = { class: "kima-shell-menu__copy" }, O = { key: 0 }, k = { key: 0 }, A = {
|
|
8
8
|
__name: "menu-items",
|
|
9
9
|
props: {
|
|
10
10
|
items: Array,
|
|
@@ -18,17 +18,17 @@ var x = { class: "kima-shell-menu__copy" }, S = { key: 0 }, C = { key: 0 }, w =
|
|
|
18
18
|
disabled: Boolean
|
|
19
19
|
},
|
|
20
20
|
emits: ["select", "check"],
|
|
21
|
-
setup(
|
|
22
|
-
let
|
|
23
|
-
function
|
|
21
|
+
setup(A, { emit: j }) {
|
|
22
|
+
let M = A, N = j, P = m({});
|
|
23
|
+
function F(e, t) {
|
|
24
24
|
if (e.target.closest("[data-kima-submenu]") !== e.currentTarget) return;
|
|
25
25
|
let n = getComputedStyle(e.currentTarget).direction === "rtl";
|
|
26
26
|
if (e.key !== "Escape" && e.key !== (n ? "ArrowRight" : "ArrowLeft")) return;
|
|
27
27
|
e.preventDefault(), e.stopImmediatePropagation(), e.stopPropagation();
|
|
28
28
|
let r = e.currentTarget.ownerDocument.getElementById(e.currentTarget.getAttribute("aria-labelledby"));
|
|
29
|
-
|
|
29
|
+
P[t] = !1, r?.focus();
|
|
30
30
|
}
|
|
31
|
-
let
|
|
31
|
+
let I = i(() => Object.fromEntries([
|
|
32
32
|
"Sub",
|
|
33
33
|
"SubTrigger",
|
|
34
34
|
"SubContent",
|
|
@@ -37,54 +37,68 @@ var x = { class: "kima-shell-menu__copy" }, S = { key: 0 }, C = { key: 0 }, w =
|
|
|
37
37
|
"RadioGroup",
|
|
38
38
|
"RadioItem",
|
|
39
39
|
"Separator"
|
|
40
|
-
].map((e) => [e,
|
|
41
|
-
function
|
|
42
|
-
return e.type === "checkbox" ?
|
|
40
|
+
].map((e) => [e, C[`${M.family}${e}`]])));
|
|
41
|
+
function L(e) {
|
|
42
|
+
return e.type === "checkbox" ? M.checked?.[e.value] ?? e.checked ?? !1 : e.type === "radio" ? Object.is(M.checked?.[e.group || "default"], e.value) : M.selection && Object.is(M.modelValue, e.value);
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
|
|
44
|
+
function R(e, t) {
|
|
45
|
+
M.disabled || e.disabled || e.type === "checkbox" || e.type === "radio" ? t.preventDefault() : N("select", e);
|
|
46
46
|
}
|
|
47
|
-
return (i,
|
|
48
|
-
let
|
|
49
|
-
return
|
|
47
|
+
return (i, m) => {
|
|
48
|
+
let C = _("menu-items", !0);
|
|
49
|
+
return p(!0), s(n, null, h(A.items, (h, _) => (p(), s(n, { key: h.value ?? _ }, [h.type === "separator" ? (p(), a(v(I.value.Separator), {
|
|
50
50
|
key: 0,
|
|
51
51
|
class: "kima-shell-menu__separator"
|
|
52
|
-
})) :
|
|
52
|
+
})) : h.children?.length ? (p(), a(v(I.value.Sub), {
|
|
53
53
|
key: 1,
|
|
54
|
-
open:
|
|
55
|
-
"onUpdate:open": (e) =>
|
|
54
|
+
open: P[_],
|
|
55
|
+
"onUpdate:open": (e) => P[_] = e
|
|
56
56
|
}, {
|
|
57
|
-
default:
|
|
57
|
+
default: x(() => [(p(), a(v(I.value.SubTrigger), {
|
|
58
58
|
class: "kima-shell-menu__item",
|
|
59
|
-
disabled:
|
|
60
|
-
"text-value":
|
|
59
|
+
disabled: A.disabled || h.disabled,
|
|
60
|
+
"text-value": h.label
|
|
61
61
|
}, {
|
|
62
|
-
default:
|
|
63
|
-
|
|
62
|
+
default: x(() => [c("span", w, [g(i.$slots, "item", {
|
|
63
|
+
item: h,
|
|
64
|
+
index: _,
|
|
65
|
+
selected: L(h)
|
|
66
|
+
}, () => [h.icon ? (p(), a(e, {
|
|
67
|
+
key: 0,
|
|
68
|
+
class: "kima-shell-menu__icon",
|
|
69
|
+
icon: h.icon,
|
|
70
|
+
size: 16,
|
|
71
|
+
"aria-hidden": "true"
|
|
72
|
+
}, null, 8, ["icon"])) : o("", !0), c("span", null, y(h.label), 1)])]), u(e, {
|
|
73
|
+
icon: b(S),
|
|
64
74
|
size: 18,
|
|
65
75
|
"aria-hidden": "true"
|
|
66
76
|
}, null, 8, ["icon"])]),
|
|
67
77
|
_: 2
|
|
68
|
-
}, 1032, ["disabled", "text-value"])),
|
|
69
|
-
default:
|
|
78
|
+
}, 1032, ["disabled", "text-value"])), u(r, d({ name: "kima-popup" }, { ref_for: !0 }, b(t)), {
|
|
79
|
+
default: x(() => [(p(), a(v(I.value.SubContent), {
|
|
70
80
|
class: "kima-shell-menu__popup",
|
|
71
81
|
"data-kima-submenu": "",
|
|
72
82
|
"side-offset": 4,
|
|
73
83
|
"collision-padding": 12,
|
|
74
84
|
"position-strategy": "fixed",
|
|
75
85
|
loop: "",
|
|
76
|
-
onKeydownCapture: (e) =>
|
|
86
|
+
onKeydownCapture: (e) => F(e, _)
|
|
77
87
|
}, {
|
|
78
|
-
default:
|
|
79
|
-
items:
|
|
80
|
-
family:
|
|
81
|
-
checked:
|
|
82
|
-
"model-value":
|
|
83
|
-
selection:
|
|
84
|
-
disabled:
|
|
85
|
-
onSelect:
|
|
86
|
-
onCheck: (e, t) =>
|
|
87
|
-
},
|
|
88
|
+
default: x(() => [u(C, {
|
|
89
|
+
items: h.children,
|
|
90
|
+
family: A.family,
|
|
91
|
+
checked: A.checked,
|
|
92
|
+
"model-value": A.modelValue,
|
|
93
|
+
selection: A.selection,
|
|
94
|
+
disabled: A.disabled || h.disabled,
|
|
95
|
+
onSelect: m[0] ||= (e) => N("select", e),
|
|
96
|
+
onCheck: (e, t) => N("check", e, t)
|
|
97
|
+
}, l({ _: 2 }, [i.$slots.item ? {
|
|
98
|
+
name: "item",
|
|
99
|
+
fn: x((e) => [g(i.$slots, "item", d({ ref_for: !0 }, e))]),
|
|
100
|
+
key: "0"
|
|
101
|
+
} : void 0]), 1032, [
|
|
88
102
|
"items",
|
|
89
103
|
"family",
|
|
90
104
|
"checked",
|
|
@@ -98,16 +112,26 @@ var x = { class: "kima-shell-menu__copy" }, S = { key: 0 }, C = { key: 0 }, w =
|
|
|
98
112
|
_: 2
|
|
99
113
|
}, 1040)]),
|
|
100
114
|
_: 2
|
|
101
|
-
}, 1064, ["open", "onUpdate:open"])) :
|
|
115
|
+
}, 1064, ["open", "onUpdate:open"])) : h.type === "checkbox" ? (p(), a(v(I.value.CheckboxItem), {
|
|
102
116
|
key: 2,
|
|
103
117
|
class: "kima-shell-menu__item",
|
|
104
|
-
disabled:
|
|
105
|
-
"model-value":
|
|
106
|
-
"text-value":
|
|
107
|
-
onSelect: (e) =>
|
|
108
|
-
"onUpdate:modelValue": (e) =>
|
|
118
|
+
disabled: A.disabled || h.disabled,
|
|
119
|
+
"model-value": L(h),
|
|
120
|
+
"text-value": h.label,
|
|
121
|
+
onSelect: (e) => R(h, e),
|
|
122
|
+
"onUpdate:modelValue": (e) => N("check", h, e)
|
|
109
123
|
}, {
|
|
110
|
-
default:
|
|
124
|
+
default: x(() => [c("span", T, [g(i.$slots, "item", {
|
|
125
|
+
item: h,
|
|
126
|
+
index: _,
|
|
127
|
+
selected: L(h)
|
|
128
|
+
}, () => [h.icon ? (p(), a(e, {
|
|
129
|
+
key: 0,
|
|
130
|
+
class: "kima-shell-menu__icon",
|
|
131
|
+
icon: h.icon,
|
|
132
|
+
size: 16,
|
|
133
|
+
"aria-hidden": "true"
|
|
134
|
+
}, null, 8, ["icon"])) : o("", !0), c("span", null, y(h.label), 1)])])]),
|
|
111
135
|
_: 2
|
|
112
136
|
}, 1064, [
|
|
113
137
|
"disabled",
|
|
@@ -115,20 +139,30 @@ var x = { class: "kima-shell-menu__copy" }, S = { key: 0 }, C = { key: 0 }, w =
|
|
|
115
139
|
"text-value",
|
|
116
140
|
"onSelect",
|
|
117
141
|
"onUpdate:modelValue"
|
|
118
|
-
])) :
|
|
142
|
+
])) : h.type === "radio" ? (p(), a(v(I.value.RadioGroup), {
|
|
119
143
|
key: 3,
|
|
120
|
-
"model-value":
|
|
121
|
-
"aria-label":
|
|
122
|
-
"onUpdate:modelValue": (e) =>
|
|
144
|
+
"model-value": A.checked?.[h.group || "default"],
|
|
145
|
+
"aria-label": h.group || "default",
|
|
146
|
+
"onUpdate:modelValue": (e) => N("check", h, e)
|
|
123
147
|
}, {
|
|
124
|
-
default:
|
|
148
|
+
default: x(() => [(p(), a(v(I.value.RadioItem), {
|
|
125
149
|
class: "kima-shell-menu__item",
|
|
126
|
-
value:
|
|
127
|
-
disabled:
|
|
128
|
-
"text-value":
|
|
129
|
-
onSelect: (e) =>
|
|
150
|
+
value: h.value,
|
|
151
|
+
disabled: A.disabled || h.disabled,
|
|
152
|
+
"text-value": h.label,
|
|
153
|
+
onSelect: (e) => R(h, e)
|
|
130
154
|
}, {
|
|
131
|
-
default:
|
|
155
|
+
default: x(() => [c("span", E, [g(i.$slots, "item", {
|
|
156
|
+
item: h,
|
|
157
|
+
index: _,
|
|
158
|
+
selected: L(h)
|
|
159
|
+
}, () => [h.icon ? (p(), a(e, {
|
|
160
|
+
key: 0,
|
|
161
|
+
class: "kima-shell-menu__icon",
|
|
162
|
+
icon: h.icon,
|
|
163
|
+
size: 16,
|
|
164
|
+
"aria-hidden": "true"
|
|
165
|
+
}, null, 8, ["icon"])) : o("", !0), c("span", null, y(h.label), 1)])])]),
|
|
132
166
|
_: 2
|
|
133
167
|
}, 1064, [
|
|
134
168
|
"value",
|
|
@@ -141,16 +175,26 @@ var x = { class: "kima-shell-menu__copy" }, S = { key: 0 }, C = { key: 0 }, w =
|
|
|
141
175
|
"model-value",
|
|
142
176
|
"aria-label",
|
|
143
177
|
"onUpdate:modelValue"
|
|
144
|
-
])) : (
|
|
178
|
+
])) : (p(), a(v(I.value.Item), {
|
|
145
179
|
key: 4,
|
|
146
180
|
class: "kima-shell-menu__item",
|
|
147
|
-
role:
|
|
148
|
-
"aria-checked":
|
|
149
|
-
disabled:
|
|
150
|
-
"text-value":
|
|
151
|
-
onSelect: (e) =>
|
|
181
|
+
role: A.selection ? "menuitemradio" : "menuitem",
|
|
182
|
+
"aria-checked": A.selection ? L(h) : void 0,
|
|
183
|
+
disabled: A.disabled || h.disabled,
|
|
184
|
+
"text-value": h.label,
|
|
185
|
+
onSelect: (e) => R(h, e)
|
|
152
186
|
}, {
|
|
153
|
-
default:
|
|
187
|
+
default: x(() => [c("span", { class: f(["kima-shell-menu__content", { "kima-shell-menu__content--described": h.description }]) }, [g(i.$slots, "item", {
|
|
188
|
+
item: h,
|
|
189
|
+
index: _,
|
|
190
|
+
selected: L(h)
|
|
191
|
+
}, () => [h.icon ? (p(), a(e, {
|
|
192
|
+
key: 0,
|
|
193
|
+
class: "kima-shell-menu__icon",
|
|
194
|
+
icon: h.icon,
|
|
195
|
+
size: 16,
|
|
196
|
+
"aria-hidden": "true"
|
|
197
|
+
}, null, 8, ["icon"])) : o("", !0), c("span", D, [c("span", null, y(h.label), 1), h.description ? (p(), s("small", O, y(h.description), 1)) : o("", !0)])])], 2), h.shortcut ? (p(), s("small", k, y(h.shortcut), 1)) : o("", !0)]),
|
|
154
198
|
_: 2
|
|
155
199
|
}, 1064, [
|
|
156
200
|
"role",
|
|
@@ -162,4 +206,4 @@ var x = { class: "kima-shell-menu__copy" }, S = { key: 0 }, C = { key: 0 }, w =
|
|
|
162
206
|
};
|
|
163
207
|
}
|
|
164
208
|
};
|
|
165
|
-
export {
|
|
209
|
+
export { A as default };
|
|
@@ -1,30 +1,27 @@
|
|
|
1
1
|
import { useNativeSlots as e } from "./native-slots.js";
|
|
2
|
-
import {
|
|
2
|
+
import { useModelState as t } from "./model.js";
|
|
3
|
+
import { computed as n, ref as r, useAttrs as i } from "vue";
|
|
3
4
|
// src/utils/interaction.js
|
|
4
|
-
function
|
|
5
|
-
let
|
|
5
|
+
function a() {
|
|
6
|
+
let t = r(null), a = i(), { hasNativeSlot: o, isCustomElement: s } = e(t);
|
|
6
7
|
return {
|
|
7
|
-
root:
|
|
8
|
-
attrs:
|
|
9
|
-
forwardedAttrs:
|
|
10
|
-
...
|
|
8
|
+
root: t,
|
|
9
|
+
attrs: a,
|
|
10
|
+
forwardedAttrs: n(() => s ? {
|
|
11
|
+
...a,
|
|
11
12
|
id: void 0
|
|
12
|
-
} :
|
|
13
|
+
} : a),
|
|
13
14
|
hasNativeSlot: o
|
|
14
15
|
};
|
|
15
16
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
function u(e) {
|
|
22
|
-
Object.is(l.value, e) || (l.value = c(e), a && (a[t] = c(e)), r(`update:${t}`, c(e)));
|
|
23
|
-
}
|
|
24
|
-
return [l, u];
|
|
17
|
+
function o(e, n, r) {
|
|
18
|
+
return t(e, n, r, {
|
|
19
|
+
clone: (e) => Array.isArray(e) ? [...e] : e,
|
|
20
|
+
deep: !0
|
|
21
|
+
});
|
|
25
22
|
}
|
|
26
|
-
function
|
|
27
|
-
return
|
|
23
|
+
function s(e) {
|
|
24
|
+
return n(() => {
|
|
28
25
|
let [t, n] = String(e.placement || "bottom-start").split("-");
|
|
29
26
|
return {
|
|
30
27
|
side: [
|
|
@@ -41,14 +38,14 @@ function u(e) {
|
|
|
41
38
|
};
|
|
42
39
|
});
|
|
43
40
|
}
|
|
44
|
-
function
|
|
41
|
+
function c(e, t) {
|
|
45
42
|
e.preventDefault(), e.stopPropagation(), t();
|
|
46
43
|
}
|
|
47
|
-
function
|
|
44
|
+
function l(e) {
|
|
48
45
|
let t = [];
|
|
49
46
|
function n(e) {
|
|
50
47
|
for (let r of e) t.push(r), Array.isArray(r.children) && n(r.children);
|
|
51
48
|
}
|
|
52
49
|
return n(e), t;
|
|
53
50
|
}
|
|
54
|
-
export {
|
|
51
|
+
export { c as dismissInteraction, l as flattenChoices, o as useInteractionModel, a as useInteractionRoot, s as usePlacement };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { computed as e, getCurrentInstance as t, ref as n, shallowRef as r, useHost as i, watch as a } from "vue";
|
|
2
|
+
// src/utils/model.js
|
|
3
|
+
var o = (e) => e.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
|
|
4
|
+
function s(s, c, l, { clone: u = (e) => e, deep: d = !1, claim: f = (e, t) => t } = {}) {
|
|
5
|
+
let p = t(), m = p?.ce ? i() : null, h = o(c), g = r(u(s[c]));
|
|
6
|
+
function _() {
|
|
7
|
+
if (m) return !1;
|
|
8
|
+
let e = p?.vnode?.props;
|
|
9
|
+
if (!e) return !1;
|
|
10
|
+
let t = Object.hasOwn(e, c) ? c : Object.hasOwn(e, h) ? h : null;
|
|
11
|
+
return t !== null && e[t] !== void 0;
|
|
12
|
+
}
|
|
13
|
+
let v = n(f(s[c], _()));
|
|
14
|
+
function y() {
|
|
15
|
+
return !v.value && _() && (v.value = !0), f(s[c], v.value);
|
|
16
|
+
}
|
|
17
|
+
let b = e(() => f(s[c], v.value) ? s[c] : g.value);
|
|
18
|
+
a(() => s[c], (e) => {
|
|
19
|
+
!v.value && _() && (v.value = !0), g.value = u(e);
|
|
20
|
+
}, { deep: d });
|
|
21
|
+
function x(e) {
|
|
22
|
+
if (y()) return !Object.is(s[c], e) && (l(`update:${c}`, u(e)), !0);
|
|
23
|
+
if (Object.is(g.value, e)) return !1;
|
|
24
|
+
let t = u(e);
|
|
25
|
+
return g.value = t, m && (m[c] = t), l(`update:${c}`, u(e)), !0;
|
|
26
|
+
}
|
|
27
|
+
return [b, x];
|
|
28
|
+
}
|
|
29
|
+
export { s as useModelState };
|