@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,19 +2,20 @@ 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 {
|
|
5
|
+
import { useModelState as i } from "../../utils/model.js";
|
|
6
|
+
import { register as a, unregister as o } from "../../utils/popup-manager.js";
|
|
7
|
+
import { dismissInteraction as s } from "../../utils/interaction.js";
|
|
7
8
|
/* empty css */
|
|
8
|
-
import { Fragment as
|
|
9
|
-
import { Add01Icon as
|
|
9
|
+
import { Fragment as c, TransitionGroup as l, computed as u, createElementBlock as d, createElementVNode as f, createVNode as p, mergeProps as m, normalizeClass as h, normalizeStyle as g, onBeforeUnmount as _, onMounted as v, openBlock as y, ref as b, renderList as x, toDisplayString as S, unref as C, useId as w, watch as T, withCtx as E } from "vue";
|
|
10
|
+
import { Add01Icon as D, Cancel01Icon as O } from "@hugeicons/core-free-icons";
|
|
10
11
|
// src/components/core/fab-menu.ce.vue
|
|
11
|
-
var
|
|
12
|
+
var k = ["disabled", "onClick"], A = [
|
|
12
13
|
"aria-expanded",
|
|
13
14
|
"aria-label",
|
|
14
15
|
"disabled"
|
|
15
|
-
],
|
|
16
|
+
], j = /*#__PURE__*/ t({
|
|
16
17
|
__name: "fab-menu.ce",
|
|
17
|
-
props:
|
|
18
|
+
props: {
|
|
18
19
|
variant: {
|
|
19
20
|
type: String,
|
|
20
21
|
default: "primary"
|
|
@@ -31,82 +32,73 @@ var A = ["disabled", "onClick"], j = [
|
|
|
31
32
|
radius: {
|
|
32
33
|
type: [String, Number],
|
|
33
34
|
default: null
|
|
34
|
-
}
|
|
35
|
-
}, {
|
|
36
|
-
open: {
|
|
37
|
-
type: Boolean,
|
|
38
|
-
default: !1
|
|
39
35
|
},
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
emits:
|
|
43
|
-
setup(t, { emit:
|
|
44
|
-
let M = t, N =
|
|
45
|
-
r(
|
|
46
|
-
let
|
|
36
|
+
open: Boolean
|
|
37
|
+
},
|
|
38
|
+
emits: ["update:open", "select"],
|
|
39
|
+
setup(t, { emit: j }) {
|
|
40
|
+
let M = t, N = j, [P, F] = i(M, "open", N), I = b(null), L = b(null), { radiusAttrs: R, radiusStyle: z } = e(L, () => M.radius);
|
|
41
|
+
r(I);
|
|
42
|
+
let B = u(() => [
|
|
47
43
|
"primary",
|
|
48
44
|
"secondary",
|
|
49
45
|
"tertiary"
|
|
50
46
|
].includes(M.variant) ? M.variant : "primary");
|
|
51
|
-
function
|
|
52
|
-
M.disabled || (
|
|
53
|
-
}
|
|
54
|
-
function V(e) {
|
|
55
|
-
e.disabled || (P.value = !1, N("select", e.value));
|
|
47
|
+
function V() {
|
|
48
|
+
M.disabled || F(!P.value);
|
|
56
49
|
}
|
|
57
50
|
function H(e) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
51
|
+
e.disabled || (F(!1), N("select", e.value));
|
|
52
|
+
}
|
|
53
|
+
function U(e) {
|
|
54
|
+
P.value && e.key === "Escape" && s(e, () => F(!1));
|
|
61
55
|
}
|
|
62
|
-
let
|
|
63
|
-
function
|
|
64
|
-
|
|
65
|
-
close: () =>
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
isInside: G
|
|
69
|
-
}) : a(U));
|
|
56
|
+
let W = `kima-fab-menu-${w()}`, G = !1, K = (e) => e.includes(I.value);
|
|
57
|
+
function q(e) {
|
|
58
|
+
G && (e ? a(W, {
|
|
59
|
+
close: () => F(!1),
|
|
60
|
+
isInside: K
|
|
61
|
+
}) : o(W));
|
|
70
62
|
}
|
|
71
|
-
return
|
|
72
|
-
|
|
63
|
+
return T(P, q), v(() => {
|
|
64
|
+
G = !0, q(P.value), window.addEventListener("keydown", U, !0);
|
|
73
65
|
}), _(() => {
|
|
74
|
-
|
|
75
|
-
}),
|
|
76
|
-
e && (
|
|
77
|
-
}), (e, r) => (y(),
|
|
66
|
+
G = !1, o(W), window.removeEventListener("keydown", U, !0);
|
|
67
|
+
}), T(() => M.disabled, (e) => {
|
|
68
|
+
e && F(!1);
|
|
69
|
+
}), (e, r) => (y(), d("div", {
|
|
78
70
|
ref_key: "root",
|
|
79
|
-
ref:
|
|
80
|
-
class: h(["kima-fab-menu", [`kima-fab-menu--${
|
|
81
|
-
}, [
|
|
71
|
+
ref: I,
|
|
72
|
+
class: h(["kima-fab-menu", [`kima-fab-menu--${B.value}`, { "kima-fab-menu--open": C(P) }]])
|
|
73
|
+
}, [p(l, {
|
|
82
74
|
name: "kima-fab-menu-item",
|
|
83
75
|
tag: "div",
|
|
84
76
|
class: "kima-fab-menu__items"
|
|
85
77
|
}, {
|
|
86
|
-
default:
|
|
78
|
+
default: E(() => [(y(!0), d(c, null, x(C(P) ? t.items : [], (e, t) => (y(), d("button", {
|
|
87
79
|
key: e.value,
|
|
88
80
|
class: h(["kima-fab-menu__item", { "kima-fab-menu__item--disabled": e.disabled }]),
|
|
89
81
|
style: g({ "--kima-fab-menu-item-delay": `${t * 40}ms` }),
|
|
90
82
|
role: "menuitem",
|
|
91
83
|
disabled: e.disabled,
|
|
92
|
-
onClick: (t) =>
|
|
93
|
-
}, [
|
|
84
|
+
onClick: (t) => H(e)
|
|
85
|
+
}, [f("span", null, S(e.label), 1)], 14, k))), 128))]),
|
|
94
86
|
_: 1
|
|
95
|
-
}),
|
|
87
|
+
}), f("button", m({
|
|
96
88
|
ref_key: "trigger",
|
|
97
|
-
ref:
|
|
98
|
-
}, C(
|
|
99
|
-
style: C(
|
|
89
|
+
ref: L
|
|
90
|
+
}, C(R), {
|
|
91
|
+
style: C(z),
|
|
100
92
|
class: "kima-fab-menu__trigger",
|
|
101
|
-
"aria-expanded": P
|
|
93
|
+
"aria-expanded": C(P),
|
|
102
94
|
"aria-haspopup": "menu",
|
|
103
|
-
"aria-label": P
|
|
95
|
+
"aria-label": C(P) ? `关闭${t.label}菜单` : `打开${t.label}菜单`,
|
|
104
96
|
disabled: t.disabled,
|
|
105
|
-
onClick:
|
|
106
|
-
}), [
|
|
107
|
-
icon: P
|
|
97
|
+
onClick: V
|
|
98
|
+
}), [p(n, {
|
|
99
|
+
icon: C(P) ? C(O) : C(D),
|
|
108
100
|
size: 24
|
|
109
|
-
}, null, 8, ["icon"])], 16,
|
|
101
|
+
}, null, 8, ["icon"])], 16, A)], 2));
|
|
110
102
|
}
|
|
111
|
-
}, [["__scopeId", "data-v-
|
|
112
|
-
export {
|
|
103
|
+
}, [["__scopeId", "data-v-eff6cc0c"]]);
|
|
104
|
+
export { j as default };
|
|
@@ -2,27 +2,27 @@ 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 { register as
|
|
6
|
-
import { cancelPopupLeave as
|
|
7
|
-
import { dismissInteraction as
|
|
8
|
-
import
|
|
9
|
-
import { useMenuChecks as
|
|
5
|
+
import { register as ee, unregister as i } from "../../utils/popup-manager.js";
|
|
6
|
+
import { cancelPopupLeave as te, playPopupLeave as ne } from "../../utils/popup-motion.js";
|
|
7
|
+
import { dismissInteraction as re, flattenChoices as ie, useInteractionRoot as ae, usePlacement as a } from "../../utils/interaction.js";
|
|
8
|
+
import o from "../../internal/menu-items.js";
|
|
9
|
+
import { useMenuChecks as s, useShellModel as c } from "../../utils/shell.js";
|
|
10
10
|
/* empty css */
|
|
11
|
-
import { computed as
|
|
12
|
-
import { ArrowDown01Icon as
|
|
13
|
-
import { DropdownMenuContent as
|
|
11
|
+
import { computed as l, createBlock as u, createCommentVNode as d, createElementBlock as f, createElementVNode as p, createSlots as oe, createVNode as m, guardReactiveProps as h, mergeProps as g, nextTick as _, normalizeProps as v, onBeforeUnmount as se, onMounted as ce, openBlock as y, ref as b, renderSlot as x, toDisplayString as le, unref as S, useId as ue, vModelText as de, watch as C, withCtx as w, withDirectives as fe, withModifiers as T } from "vue";
|
|
12
|
+
import { ArrowDown01Icon as pe, MoreHorizontalIcon as me, Search01Icon as he } from "@hugeicons/core-free-icons";
|
|
13
|
+
import { DropdownMenuContent as ge, DropdownMenuRoot as E, DropdownMenuTrigger as D } from "reka-ui";
|
|
14
14
|
// src/components/core/menu.ce.vue
|
|
15
|
-
var
|
|
15
|
+
var O = [
|
|
16
16
|
"disabled",
|
|
17
17
|
"aria-label",
|
|
18
18
|
"title"
|
|
19
|
-
],
|
|
19
|
+
], k = { key: 1 }, A = ["aria-label"], j = {
|
|
20
20
|
key: 0,
|
|
21
21
|
class: "kima-menu__search-wrap"
|
|
22
|
-
},
|
|
22
|
+
}, M = {
|
|
23
23
|
key: 1,
|
|
24
24
|
role: "status"
|
|
25
|
-
},
|
|
25
|
+
}, N = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
26
26
|
__name: "menu.ce",
|
|
27
27
|
props: {
|
|
28
28
|
open: Boolean,
|
|
@@ -80,13 +80,13 @@ var D = [
|
|
|
80
80
|
"update:checked",
|
|
81
81
|
"check"
|
|
82
82
|
],
|
|
83
|
-
setup(t, { emit:
|
|
84
|
-
let
|
|
83
|
+
setup(t, { emit: N }) {
|
|
84
|
+
let P = t, F = N, { root: I, forwardedAttrs: L } = ae(), [R, _e] = c(P, "open", F), [z, ve] = c(P, "modelValue", F), { checked: ye, check: be } = s(P, F), B = b(null), V = b(null), H = b(""), U = b(null), { radiusAttrs: xe, radiusStyle: Se } = e(U, () => P.radius);
|
|
85
85
|
r(B);
|
|
86
|
-
let W = `kima-menu-${
|
|
87
|
-
...
|
|
86
|
+
let W = `kima-menu-${ue()}`, Ce = a(P), we = l(() => ({
|
|
87
|
+
...Ce.value,
|
|
88
88
|
sideOffset: 4
|
|
89
|
-
})), G =
|
|
89
|
+
})), G = l(() => ie(P.items).find((e) => Object.is(e.value, z.value)) || null), K = l(() => P.iconOnly || P.variant === "icon"), Te = l(() => P.icon || me), Ee = l(() => ["small", "default"].includes(P.size) ? P.size : "default");
|
|
90
90
|
function q(e, t) {
|
|
91
91
|
return e.flatMap((e) => {
|
|
92
92
|
let n = e.children ? q(e.children, t) : [];
|
|
@@ -96,14 +96,14 @@ var D = [
|
|
|
96
96
|
}] : [];
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
|
-
let J =
|
|
99
|
+
let J = l(() => q(P.items, H.value.trim().toLocaleLowerCase()));
|
|
100
100
|
function Y(e) {
|
|
101
|
-
e &&
|
|
101
|
+
e && P.disabled || (e && (H.value = ""), _e(e));
|
|
102
102
|
}
|
|
103
|
-
function
|
|
104
|
-
|
|
103
|
+
function De(e) {
|
|
104
|
+
P.disabled || e.disabled || (Object.is(z.value, e.value) || (ve(e.value), F("change", e.value)), F("select", e.value, e), Y(!1));
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function Oe(e) {
|
|
107
107
|
if (e.key === "Escape") e.preventDefault(), Y(!1), B.value?.focus();
|
|
108
108
|
else if (e.key === "Tab") Y(!1);
|
|
109
109
|
else if ([
|
|
@@ -112,56 +112,56 @@ var D = [
|
|
|
112
112
|
"Enter"
|
|
113
113
|
].includes(e.key)) {
|
|
114
114
|
e.preventDefault();
|
|
115
|
-
let t =
|
|
115
|
+
let t = I.value.querySelectorAll("[role^=\"menuitem\"]:not([data-disabled])"), n = e.key === "ArrowUp" ? t[t.length - 1] : t[0];
|
|
116
116
|
e.key === "Enter" ? n?.click() : n?.focus();
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
|
|
119
|
+
C(() => P.disabled, (e) => {
|
|
120
120
|
e && Y(!1);
|
|
121
|
-
}),
|
|
122
|
-
e &&
|
|
121
|
+
}), C(R, (e) => {
|
|
122
|
+
e && P.searchable && _(() => V.value?.focus());
|
|
123
123
|
});
|
|
124
124
|
let X = !1;
|
|
125
|
-
function
|
|
126
|
-
return e.includes(
|
|
125
|
+
function ke(e) {
|
|
126
|
+
return e.includes(I.value);
|
|
127
127
|
}
|
|
128
128
|
function Z(e) {
|
|
129
|
-
X && (e ?
|
|
129
|
+
X && (e ? ee(W, {
|
|
130
130
|
close: () => Y(!1),
|
|
131
|
-
isInside:
|
|
132
|
-
}) :
|
|
131
|
+
isInside: ke
|
|
132
|
+
}) : i(W));
|
|
133
133
|
}
|
|
134
|
-
|
|
135
|
-
X = !0, Z(
|
|
136
|
-
}),
|
|
137
|
-
X = !1,
|
|
134
|
+
C(R, Z), ce(() => {
|
|
135
|
+
X = !0, Z(R.value);
|
|
136
|
+
}), se(() => {
|
|
137
|
+
X = !1, i(W);
|
|
138
138
|
});
|
|
139
|
-
let Q =
|
|
140
|
-
return
|
|
139
|
+
let Q = b(!1), $ = 0;
|
|
140
|
+
return C(R, (e) => {
|
|
141
141
|
if (e) {
|
|
142
|
-
$ += 1, Q.value = !1,
|
|
142
|
+
$ += 1, Q.value = !1, te(I.value?.querySelector(".kima-menu__popup"));
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
|
-
if (!
|
|
145
|
+
if (!I.value?.querySelector(".kima-menu__popup")) return;
|
|
146
146
|
Q.value = !0;
|
|
147
|
-
let t =
|
|
148
|
-
|
|
147
|
+
let t = I.value?.querySelector(".kima-menu__popup"), n = ++$;
|
|
148
|
+
ne(t, () => {
|
|
149
149
|
n === $ && (Q.value = !1);
|
|
150
150
|
});
|
|
151
|
-
}), (e, r) => (
|
|
151
|
+
}), (e, r) => (y(), f("div", g({
|
|
152
152
|
ref_key: "root",
|
|
153
|
-
ref:
|
|
154
|
-
},
|
|
155
|
-
"kima-menu--open":
|
|
153
|
+
ref: I
|
|
154
|
+
}, S(L), { class: ["kima-menu", {
|
|
155
|
+
"kima-menu--open": S(R),
|
|
156
156
|
"kima-menu--icon": K.value,
|
|
157
|
-
[`kima-menu--${
|
|
158
|
-
}] }), [
|
|
159
|
-
open:
|
|
157
|
+
[`kima-menu--${Ee.value}`]: !0
|
|
158
|
+
}] }), [m(S(E), {
|
|
159
|
+
open: S(R) && !t.disabled,
|
|
160
160
|
modal: !1,
|
|
161
161
|
"onUpdate:open": Y
|
|
162
162
|
}, {
|
|
163
|
-
default:
|
|
164
|
-
default:
|
|
163
|
+
default: w(() => [m(S(D), { "as-child": "" }, {
|
|
164
|
+
default: w(() => [p("button", {
|
|
165
165
|
ref_key: "trigger",
|
|
166
166
|
ref: B,
|
|
167
167
|
type: "button",
|
|
@@ -169,44 +169,44 @@ var D = [
|
|
|
169
169
|
disabled: t.disabled,
|
|
170
170
|
"aria-label": K.value ? t.label : void 0,
|
|
171
171
|
title: K.value ? t.label : void 0
|
|
172
|
-
}, [
|
|
173
|
-
open:
|
|
172
|
+
}, [x(e.$slots, "trigger", {
|
|
173
|
+
open: S(R),
|
|
174
174
|
selectedItem: G.value,
|
|
175
|
-
value:
|
|
176
|
-
}, () => [K.value ? (
|
|
175
|
+
value: S(z)
|
|
176
|
+
}, () => [K.value ? (y(), u(n, {
|
|
177
177
|
key: 0,
|
|
178
|
-
icon:
|
|
178
|
+
icon: Te.value,
|
|
179
179
|
size: 20,
|
|
180
180
|
"aria-hidden": "true"
|
|
181
|
-
}, null, 8, ["icon"])) : (
|
|
181
|
+
}, null, 8, ["icon"])) : (y(), f("span", k, le(G.value?.label || t.label), 1))], !0), K.value ? d("", !0) : (y(), u(n, {
|
|
182
182
|
key: 0,
|
|
183
|
-
icon:
|
|
183
|
+
icon: S(pe),
|
|
184
184
|
size: 20,
|
|
185
185
|
"aria-hidden": "true"
|
|
186
|
-
}, null, 8, ["icon"]))], 8,
|
|
186
|
+
}, null, 8, ["icon"]))], 8, O)]),
|
|
187
187
|
_: 3
|
|
188
|
-
}),
|
|
188
|
+
}), S(R) && !t.disabled || Q.value ? (y(), u(S(ge), g({
|
|
189
189
|
key: 0,
|
|
190
190
|
id: W,
|
|
191
191
|
"force-mount": ""
|
|
192
|
-
},
|
|
193
|
-
default:
|
|
192
|
+
}, we.value, { "as-child": "" }), {
|
|
193
|
+
default: w(() => [p("div", g({
|
|
194
194
|
ref_key: "popup",
|
|
195
195
|
ref: U
|
|
196
|
-
},
|
|
197
|
-
style:
|
|
196
|
+
}, S(xe), {
|
|
197
|
+
style: S(Se),
|
|
198
198
|
class: "kima-menu__popup",
|
|
199
199
|
"aria-label": t.label,
|
|
200
|
-
onEscapeKeyDown: r[3] ||= (e) =>
|
|
200
|
+
onEscapeKeyDown: r[3] ||= (e) => S(re)(e, () => Y(!1)),
|
|
201
201
|
onOpenAutoFocus: r[4] ||= (e) => {
|
|
202
|
-
t.searchable && (e.preventDefault(),
|
|
202
|
+
t.searchable && (e.preventDefault(), _(() => V.value?.focus()));
|
|
203
203
|
}
|
|
204
204
|
}), [
|
|
205
|
-
t.searchable ? (
|
|
206
|
-
icon:
|
|
205
|
+
t.searchable ? (y(), f("div", j, [m(n, {
|
|
206
|
+
icon: S(he),
|
|
207
207
|
size: 18,
|
|
208
208
|
"aria-hidden": "true"
|
|
209
|
-
}, null, 8, ["icon"]),
|
|
209
|
+
}, null, 8, ["icon"]), fe(p("input", {
|
|
210
210
|
ref_key: "searchInput",
|
|
211
211
|
ref: V,
|
|
212
212
|
"onUpdate:modelValue": r[0] ||= (e) => H.value = e,
|
|
@@ -214,31 +214,35 @@ var D = [
|
|
|
214
214
|
class: "kima-menu__search",
|
|
215
215
|
role: "searchbox",
|
|
216
216
|
"aria-label": "搜索菜单项",
|
|
217
|
-
onInput: r[1] ||=
|
|
218
|
-
onChange: r[2] ||=
|
|
219
|
-
onKeydown:
|
|
220
|
-
}, null, 544), [[
|
|
221
|
-
|
|
217
|
+
onInput: r[1] ||= T(() => {}, ["stop"]),
|
|
218
|
+
onChange: r[2] ||= T(() => {}, ["stop"]),
|
|
219
|
+
onKeydown: T(Oe, ["stop"])
|
|
220
|
+
}, null, 544), [[de, H.value]])])) : d("", !0),
|
|
221
|
+
m(o, {
|
|
222
222
|
items: J.value,
|
|
223
|
-
checked:
|
|
224
|
-
"model-value":
|
|
223
|
+
checked: S(ye),
|
|
224
|
+
"model-value": S(z),
|
|
225
225
|
selection: "",
|
|
226
226
|
disabled: t.disabled,
|
|
227
|
-
onSelect:
|
|
228
|
-
onCheck:
|
|
229
|
-
},
|
|
227
|
+
onSelect: De,
|
|
228
|
+
onCheck: S(be)
|
|
229
|
+
}, oe({ _: 2 }, [e.$slots.item ? {
|
|
230
|
+
name: "item",
|
|
231
|
+
fn: w((t) => [x(e.$slots, "item", v(h(t)), void 0, !0)]),
|
|
232
|
+
key: "0"
|
|
233
|
+
} : void 0]), 1032, [
|
|
230
234
|
"items",
|
|
231
235
|
"checked",
|
|
232
236
|
"model-value",
|
|
233
237
|
"disabled",
|
|
234
238
|
"onCheck"
|
|
235
239
|
]),
|
|
236
|
-
J.value.length ?
|
|
237
|
-
], 16,
|
|
238
|
-
_:
|
|
239
|
-
}, 16)) :
|
|
240
|
+
J.value.length ? d("", !0) : (y(), f("div", M, "没有匹配项目"))
|
|
241
|
+
], 16, A)]),
|
|
242
|
+
_: 3
|
|
243
|
+
}, 16)) : d("", !0)]),
|
|
240
244
|
_: 3
|
|
241
245
|
}, 8, ["open"])], 16));
|
|
242
246
|
}
|
|
243
|
-
}), [["__scopeId", "data-v-
|
|
244
|
-
export {
|
|
247
|
+
}), [["__scopeId", "data-v-6cc90694"]]);
|
|
248
|
+
export { N as default };
|
|
@@ -53,40 +53,39 @@ var y = ["disabled", "aria-expanded"], b = {
|
|
|
53
53
|
emits: [
|
|
54
54
|
"update:modelValue",
|
|
55
55
|
"update:open",
|
|
56
|
+
"change",
|
|
56
57
|
"submit",
|
|
57
58
|
"focus",
|
|
58
59
|
"blur"
|
|
59
60
|
],
|
|
60
61
|
setup(t, { emit: v }) {
|
|
61
|
-
let w = t, T = v, { root: E, forwardedAttrs: D, hasNativeSlot: O } = i(), { radiusAttrs: k, radiusStyle: A } = e(E, () => w.radius), [j, M] = r(w, "open", T
|
|
62
|
+
let w = t, T = v, { root: E, forwardedAttrs: D, hasNativeSlot: O } = i(), { radiusAttrs: k, radiusStyle: A } = e(E, () => w.radius), [j, M] = r(w, "open", T, { claim: (e, t) => t && e != null }), N = a(() => typeof w.width == "number" || /^\d+(\.\d+)?$/.test(String(w.width).trim()) ? `${Math.max(0, Number(w.width))}px` : w.width), P = p(null), F = p(w.modelValue), I = !1;
|
|
62
63
|
g(() => w.modelValue, (e) => {
|
|
63
|
-
e !==
|
|
64
|
+
e !== F.value && (F.value = e);
|
|
64
65
|
});
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
let L = M;
|
|
67
|
+
function R() {
|
|
68
|
+
w.disabled || j.value || (L(!0), d(() => P.value?.focus()));
|
|
67
69
|
}
|
|
68
|
-
function
|
|
69
|
-
|
|
70
|
+
function z() {
|
|
71
|
+
j.value && (L(!1), P.value?.blur());
|
|
70
72
|
}
|
|
71
|
-
function
|
|
72
|
-
|
|
73
|
+
function B() {
|
|
74
|
+
j.value ? z() : R();
|
|
73
75
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
g(F, (e) => {
|
|
78
|
-
e || L.value?.blur();
|
|
76
|
+
g(j, (e) => {
|
|
77
|
+
e || P.value?.blur();
|
|
79
78
|
});
|
|
80
|
-
function
|
|
81
|
-
|
|
79
|
+
function V(e) {
|
|
80
|
+
I || e.isComposing || e.target.value === F.value || (F.value = e.target.value, T("update:modelValue", F.value));
|
|
82
81
|
}
|
|
83
|
-
function
|
|
84
|
-
e.key === "Escape" ? (e.preventDefault(),
|
|
82
|
+
function H(e) {
|
|
83
|
+
e.key === "Escape" ? (e.preventDefault(), z()) : e.key === "Enter" ? T("submit", F.value) : e.stopPropagation();
|
|
85
84
|
}
|
|
86
|
-
function
|
|
85
|
+
function U(e) {
|
|
87
86
|
T("focus", e);
|
|
88
87
|
}
|
|
89
|
-
function
|
|
88
|
+
function W(e) {
|
|
90
89
|
T("blur", e);
|
|
91
90
|
}
|
|
92
91
|
return (e, r) => (f(), o("button", u({
|
|
@@ -97,11 +96,11 @@ var y = ["disabled", "aria-expanded"], b = {
|
|
|
97
96
|
...h(k)
|
|
98
97
|
}, {
|
|
99
98
|
type: "button",
|
|
100
|
-
class: ["kima-morph-field", { "kima-morph-field--active":
|
|
101
|
-
style: [{ "--kima-morph-field-open":
|
|
99
|
+
class: ["kima-morph-field", { "kima-morph-field--active": h(j) }],
|
|
100
|
+
style: [{ "--kima-morph-field-open": N.value }, h(A)],
|
|
102
101
|
disabled: t.disabled,
|
|
103
|
-
"aria-expanded":
|
|
104
|
-
onClick:
|
|
102
|
+
"aria-expanded": h(j) ? "true" : "false",
|
|
103
|
+
onClick: B
|
|
105
104
|
}), [
|
|
106
105
|
s("span", b, [c(n, {
|
|
107
106
|
icon: t.icon,
|
|
@@ -109,31 +108,31 @@ var y = ["disabled", "aria-expanded"], b = {
|
|
|
109
108
|
}, null, 8, ["icon"])]),
|
|
110
109
|
s("span", x, [s("input", {
|
|
111
110
|
ref_key: "input",
|
|
112
|
-
ref:
|
|
111
|
+
ref: P,
|
|
113
112
|
type: "text",
|
|
114
|
-
value:
|
|
113
|
+
value: F.value,
|
|
115
114
|
placeholder: t.placeholder,
|
|
116
|
-
tabindex:
|
|
115
|
+
tabindex: h(j) ? 0 : -1,
|
|
117
116
|
"aria-label": t.label || t.placeholder || void 0,
|
|
118
117
|
onClick: r[0] ||= _(() => {}, ["stop"]),
|
|
119
|
-
onInput: _(
|
|
120
|
-
onCompositionstart: r[1] ||= (e) => l(
|
|
118
|
+
onInput: _(V, ["stop"]),
|
|
119
|
+
onCompositionstart: r[1] ||= (e) => l(I) ? I.value = !0 : I = !0,
|
|
121
120
|
onCompositionend: r[2] ||= (e) => {
|
|
122
|
-
l(
|
|
121
|
+
l(I) ? I.value = !1 : I = !1, V(e);
|
|
123
122
|
},
|
|
124
|
-
onKeydown:
|
|
125
|
-
onFocus:
|
|
126
|
-
onBlur:
|
|
123
|
+
onKeydown: H,
|
|
124
|
+
onFocus: U,
|
|
125
|
+
onBlur: W
|
|
127
126
|
}, null, 40, S)]),
|
|
128
|
-
e.$slots.action || h(O)("action") ? (f(), o("span", C, [m(e.$slots, "action", { close:
|
|
127
|
+
e.$slots.action || h(O)("action") ? (f(), o("span", C, [m(e.$slots, "action", { close: z }, void 0, !0)])) : (f(), o("span", {
|
|
129
128
|
key: 1,
|
|
130
129
|
class: "kima-morph-field__action kima-morph-field__cancel",
|
|
131
130
|
role: "button",
|
|
132
131
|
tabindex: "-1",
|
|
133
132
|
"aria-hidden": "true",
|
|
134
|
-
onClick: _(
|
|
133
|
+
onClick: _(z, ["stop"])
|
|
135
134
|
}, "取消"))
|
|
136
135
|
], 16, y));
|
|
137
136
|
}
|
|
138
|
-
}), [["__scopeId", "data-v-
|
|
137
|
+
}), [["__scopeId", "data-v-d8ed6708"]]);
|
|
139
138
|
export { w as default };
|