@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,15 +2,16 @@ 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 ee } from "../../utils/model.js";
|
|
6
|
+
import { useRemoteOptions as te } from "../../utils/remote-options.js";
|
|
7
|
+
import { register as ne, unregister as re } from "../../utils/popup-manager.js";
|
|
8
|
+
import { cancelPopupLeave as ie, playPopupLeave as ae } from "../../utils/popup-motion.js";
|
|
8
9
|
/* empty css */
|
|
9
|
-
import { Fragment as
|
|
10
|
-
import { ArrowDown01Icon as
|
|
11
|
-
import { PopoverAnchor as
|
|
10
|
+
import { Fragment as oe, Transition as se, computed as i, createBlock as ce, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as le, createVNode as c, getCurrentInstance as ue, mergeProps as de, nextTick as l, normalizeClass as fe, onBeforeUnmount as pe, onMounted as me, openBlock as u, ref as d, renderList as he, shallowRef as ge, toDisplayString as f, unref as p, useAttrs as _e, useHost as ve, useId as ye, watch as m, withCtx as h, withModifiers as g } from "vue";
|
|
11
|
+
import { ArrowDown01Icon as be, Cancel01Icon as xe, Search01Icon as Se } from "@hugeicons/core-free-icons";
|
|
12
|
+
import { PopoverAnchor as Ce, PopoverContent as we, PopoverPortal as Te, PopoverRoot as Ee } from "reka-ui";
|
|
12
13
|
// src/components/core/combobox.ce.vue
|
|
13
|
-
var
|
|
14
|
+
var De = ["aria-disabled"], Oe = [
|
|
14
15
|
"value",
|
|
15
16
|
"placeholder",
|
|
16
17
|
"readonly",
|
|
@@ -19,32 +20,32 @@ var Ee = ["aria-disabled"], De = [
|
|
|
19
20
|
"aria-label",
|
|
20
21
|
"aria-required",
|
|
21
22
|
"aria-activedescendant"
|
|
22
|
-
],
|
|
23
|
+
], ke = ["disabled"], Ae = ["disabled"], je = [
|
|
23
24
|
"name",
|
|
24
25
|
"value",
|
|
25
26
|
"required",
|
|
26
27
|
"disabled"
|
|
27
|
-
],
|
|
28
|
+
], Me = ["aria-busy"], Ne = {
|
|
28
29
|
key: 0,
|
|
29
30
|
class: "kima-combobox__status",
|
|
30
31
|
role: "status"
|
|
31
|
-
},
|
|
32
|
+
}, Pe = {
|
|
32
33
|
key: 1,
|
|
33
34
|
class: "kima-combobox__status kima-combobox__status--error",
|
|
34
35
|
role: "alert"
|
|
35
|
-
},
|
|
36
|
+
}, Fe = [
|
|
36
37
|
"id",
|
|
37
38
|
"aria-selected",
|
|
38
39
|
"aria-disabled",
|
|
39
40
|
"onClick"
|
|
40
|
-
],
|
|
41
|
+
], Ie = { class: "kima-combobox__option-copy" }, Le = { class: "kima-combobox__option-label" }, Re = {
|
|
41
42
|
key: 0,
|
|
42
43
|
class: "kima-combobox__option-description"
|
|
43
|
-
},
|
|
44
|
+
}, ze = {
|
|
44
45
|
key: 2,
|
|
45
46
|
class: "kima-combobox__empty",
|
|
46
47
|
role: "status"
|
|
47
|
-
},
|
|
48
|
+
}, Be = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
48
49
|
__name: "combobox.ce",
|
|
49
50
|
props: {
|
|
50
51
|
modelValue: {
|
|
@@ -103,17 +104,17 @@ var Ee = ["aria-disabled"], De = [
|
|
|
103
104
|
"options-load",
|
|
104
105
|
"options-error"
|
|
105
106
|
],
|
|
106
|
-
setup(t, { emit:
|
|
107
|
-
let
|
|
107
|
+
setup(t, { emit: Be }) {
|
|
108
|
+
let Ve = typeof document < "u", _ = t, v = Be, y = _e(), He = ue()?.ce ? ve() : null, Ue = i(() => He ? {
|
|
108
109
|
...y,
|
|
109
110
|
id: void 0
|
|
110
|
-
} : y), b = d(null),
|
|
111
|
-
r(
|
|
112
|
-
let x = d(null), S = d(null), { radiusAttrs:
|
|
111
|
+
} : y), b = d(null), We = d(null);
|
|
112
|
+
r(We);
|
|
113
|
+
let x = d(null), S = d(null), { radiusAttrs: Ge, radiusStyle: Ke } = e(S, () => _.radius), C = d(null), w = d([]), T = d(""), E = d(-1), D = ge(_.modelValue), O = ge(_.modelValue), [qe, Je] = ee(_, "open", v), k = i(() => qe.value && !_.disabled), A = `kima-combobox-${ye()}`, Ye = `${A}-input`, j = `${A}-listbox`, M = `${A}-popup`, N, P, F, I = !0, Xe = i(() => _.loader), Ze = i(() => T.value), { items: Qe, loading: L, error: R, retry: $e } = te(Xe, Ze, i(() => _.debounce), i(() => _.retry), v), z = i(() => typeof _.loader == "function" ? Qe.value : _.items), et = i(() => z.value.find((e) => Object.is(e?.value, D.value)) || null), B = i(() => {
|
|
113
114
|
let e = _.searchable ? T.value.trim().toLocaleLowerCase() : "";
|
|
114
115
|
return typeof _.loader == "function" || !e ? z.value : z.value.filter((t) => `${t?.label || ""} ${t?.description || ""}`.toLocaleLowerCase().includes(e));
|
|
115
|
-
}),
|
|
116
|
-
function
|
|
116
|
+
}), tt = i(() => D.value === null || D.value === void 0 ? "" : String(D.value)), nt = i(() => k.value && E.value >= 0 ? `${j}-option-${E.value}` : void 0), rt = i(() => _.clearable && (D.value !== null && D.value !== void 0 && D.value !== "" || T.value.length > 0));
|
|
117
|
+
function it(e, t) {
|
|
117
118
|
e ? w.value[t] = e : delete w.value[t];
|
|
118
119
|
}
|
|
119
120
|
function V() {
|
|
@@ -122,67 +123,67 @@ var Ee = ["aria-disabled"], De = [
|
|
|
122
123
|
function H() {
|
|
123
124
|
return V()[0] ?? -1;
|
|
124
125
|
}
|
|
125
|
-
function
|
|
126
|
+
function at() {
|
|
126
127
|
let e = V();
|
|
127
128
|
return e[e.length - 1] ?? -1;
|
|
128
129
|
}
|
|
129
|
-
function
|
|
130
|
+
function ot() {
|
|
130
131
|
let e = B.value.findIndex((e) => Object.is(e?.value, D.value) && !e.disabled);
|
|
131
132
|
return e >= 0 ? e : H();
|
|
132
133
|
}
|
|
133
|
-
function
|
|
134
|
+
function U(e, t = !1) {
|
|
134
135
|
e < 0 || !B.value[e] || B.value[e].disabled || (E.value = e, l(() => {
|
|
135
136
|
t && w.value[e]?.focus(), w.value[e]?.scrollIntoView({ block: "nearest" });
|
|
136
137
|
}));
|
|
137
138
|
}
|
|
138
|
-
function
|
|
139
|
+
function st(e) {
|
|
139
140
|
let t = V();
|
|
140
141
|
if (!t.length) return;
|
|
141
142
|
let n = t.indexOf(E.value);
|
|
142
|
-
|
|
143
|
+
U(t[n < 0 ? e > 0 ? 0 : t.length - 1 : (n + e + t.length) % t.length]);
|
|
143
144
|
}
|
|
144
|
-
function
|
|
145
|
+
function ct(e) {
|
|
145
146
|
Object.is(e, O.value) || (O.value = e, v("change", e));
|
|
146
147
|
}
|
|
147
|
-
function
|
|
148
|
-
Object.is(e, D.value) || (D.value = e, v("update:modelValue", e)), t &&
|
|
148
|
+
function W(e, t = !1) {
|
|
149
|
+
Object.is(e, D.value) || (D.value = e, v("update:modelValue", e)), t && ct(e);
|
|
149
150
|
}
|
|
150
|
-
function
|
|
151
|
-
return
|
|
151
|
+
function G() {
|
|
152
|
+
return et.value ? et.value.label : "";
|
|
152
153
|
}
|
|
153
|
-
function
|
|
154
|
-
_.disabled || k.value || (
|
|
154
|
+
function K() {
|
|
155
|
+
_.disabled || k.value || (Je(!0), E.value = ot());
|
|
155
156
|
}
|
|
156
|
-
function
|
|
157
|
-
k.value && (I = e,
|
|
157
|
+
function q(e = !0) {
|
|
158
|
+
k.value && (I = e, Je(!1));
|
|
158
159
|
}
|
|
159
|
-
function
|
|
160
|
+
function lt(e) {
|
|
160
161
|
return e.includes(b.value) ? !0 : e.some((e) => e?.dataset?.kimaPopupOwner === M);
|
|
161
162
|
}
|
|
162
|
-
function
|
|
163
|
-
Y && (e ?
|
|
163
|
+
function J(e) {
|
|
164
|
+
Y && (e ? ne(M, {
|
|
164
165
|
close: () => {
|
|
165
|
-
Q(),
|
|
166
|
+
Q(), q(!1);
|
|
166
167
|
},
|
|
167
|
-
isInside:
|
|
168
|
-
}) :
|
|
168
|
+
isInside: lt
|
|
169
|
+
}) : re(M));
|
|
169
170
|
}
|
|
170
171
|
let Y = !1;
|
|
171
|
-
m(k,
|
|
172
|
-
Y = !0,
|
|
172
|
+
m(k, J), me(() => {
|
|
173
|
+
Y = !0, J(k.value);
|
|
173
174
|
});
|
|
174
175
|
let X = d(!1), Z = 0;
|
|
175
176
|
m(k, (e) => {
|
|
176
177
|
if (e) {
|
|
177
178
|
Z += 1, X.value = !1;
|
|
178
179
|
let e = $();
|
|
179
|
-
e && (
|
|
180
|
+
e && (ie(e), e.inert = !1, e.removeAttribute("aria-hidden"));
|
|
180
181
|
} else $() && (X.value = !0, l(() => {
|
|
181
182
|
let e = $();
|
|
182
183
|
if (!e || k.value) return;
|
|
183
184
|
e.inert = !0, e.setAttribute("aria-hidden", "true");
|
|
184
185
|
let t = ++Z;
|
|
185
|
-
|
|
186
|
+
ae(e, () => {
|
|
186
187
|
t === Z && (X.value = !1);
|
|
187
188
|
});
|
|
188
189
|
}));
|
|
@@ -190,24 +191,24 @@ var Ee = ["aria-disabled"], De = [
|
|
|
190
191
|
function Q() {
|
|
191
192
|
if (_.freeSolo) {
|
|
192
193
|
let e = T.value === "" ? null : T.value;
|
|
193
|
-
|
|
194
|
-
} else T.value =
|
|
194
|
+
W(e), ct(e);
|
|
195
|
+
} else T.value = G();
|
|
195
196
|
}
|
|
196
|
-
function
|
|
197
|
-
_.disabled || e?.disabled || (T.value = e.label,
|
|
197
|
+
function ut(e) {
|
|
198
|
+
_.disabled || e?.disabled || (T.value = e.label, W(e.value, !0), q(!0));
|
|
198
199
|
}
|
|
199
|
-
function
|
|
200
|
+
function dt() {
|
|
200
201
|
let e = B.value[E.value];
|
|
201
|
-
e ?
|
|
202
|
+
e ? ut(e) : _.freeSolo && (Q(), q(!0));
|
|
202
203
|
}
|
|
203
|
-
function
|
|
204
|
-
T.value = "",
|
|
204
|
+
function ft() {
|
|
205
|
+
T.value = "", W(null, !0), q(!0), l(() => x.value?.focus());
|
|
205
206
|
}
|
|
206
|
-
function
|
|
207
|
-
_.disabled || (T.value = e.target.value, v("input", T.value), k.value ||
|
|
207
|
+
function pt(e) {
|
|
208
|
+
_.disabled || (T.value = e.target.value, v("input", T.value), k.value || K(), _.freeSolo && W(T.value === "" ? null : T.value));
|
|
208
209
|
}
|
|
209
|
-
function
|
|
210
|
-
_.disabled || e.isComposing || (e.key === "Tab" ? (Q(),
|
|
210
|
+
function mt(e) {
|
|
211
|
+
_.disabled || e.isComposing || (e.key === "Tab" ? (Q(), q(!1)) : [
|
|
211
212
|
"ArrowDown",
|
|
212
213
|
"ArrowUp",
|
|
213
214
|
"Home",
|
|
@@ -215,9 +216,9 @@ var Ee = ["aria-disabled"], De = [
|
|
|
215
216
|
"Enter",
|
|
216
217
|
" ",
|
|
217
218
|
"Escape"
|
|
218
|
-
].includes(e.key) && (e.preventDefault(), e.stopPropagation(), e.key === "Escape" ? (T.value =
|
|
219
|
+
].includes(e.key) && (e.preventDefault(), e.stopPropagation(), e.key === "Escape" ? (T.value = G(), q(!0)) : k.value ? e.key === "ArrowDown" ? st(1) : e.key === "ArrowUp" ? st(-1) : e.key === "Home" ? U(H()) : e.key === "End" ? U(at()) : dt() : (K(), e.key === "ArrowUp" || e.key === "End" ? l(() => U(at())) : e.key === "Home" && l(() => U(H())))));
|
|
219
220
|
}
|
|
220
|
-
function
|
|
221
|
+
function ht(e) {
|
|
221
222
|
return e.some((e) => {
|
|
222
223
|
if (!e || typeof e.getAttribute != "function") return !1;
|
|
223
224
|
if (e.getAttribute("aria-haspopup") !== null) return !0;
|
|
@@ -228,63 +229,61 @@ var Ee = ["aria-disabled"], De = [
|
|
|
228
229
|
function $() {
|
|
229
230
|
return N?.querySelector(`[data-kima-popup-owner="${M}"]`) || S.value || null;
|
|
230
231
|
}
|
|
231
|
-
function
|
|
232
|
+
function gt(e) {
|
|
232
233
|
let t = e.composedPath();
|
|
233
|
-
!k.value || t.includes(b.value) || t.includes($()) ||
|
|
234
|
+
!k.value || t.includes(b.value) || t.includes($()) || ht(t) || (Q(), q(!1));
|
|
234
235
|
}
|
|
235
|
-
function
|
|
236
|
+
function _t(e) {
|
|
236
237
|
e.preventDefault(), l(() => x.value?.focus());
|
|
237
238
|
}
|
|
238
|
-
function
|
|
239
|
+
function vt(e) {
|
|
239
240
|
queueMicrotask(() => {
|
|
240
241
|
if (e.defaultPrevented) return;
|
|
241
242
|
let t = !Object.is(D.value, F);
|
|
242
|
-
D.value = F, O.value = F, T.value = z.value.find((e) => Object.is(e?.value, F))?.label || (_.freeSolo && F != null ? String(F) : ""),
|
|
243
|
+
D.value = F, O.value = F, T.value = z.value.find((e) => Object.is(e?.value, F))?.label || (_.freeSolo && F != null ? String(F) : ""), q(!1), C.value && (C.value.value = F == null ? "" : String(F)), t && v("update:modelValue", F);
|
|
243
244
|
});
|
|
244
245
|
}
|
|
245
246
|
return m(() => _.modelValue, (e) => {
|
|
246
247
|
D.value = e, O.value = e, T.value = z.value.find((t) => Object.is(t?.value, e))?.label || (_.freeSolo && e != null ? String(e) : "");
|
|
247
248
|
}), m(() => _.items, () => {
|
|
248
|
-
k.value || (T.value =
|
|
249
|
-
}, { deep: !0 }), m(() => _.
|
|
250
|
-
|
|
251
|
-
}), m(() => _.disabled, (e) => {
|
|
252
|
-
e && J(!1);
|
|
249
|
+
k.value || (T.value = G());
|
|
250
|
+
}, { deep: !0 }), m(() => _.disabled, (e) => {
|
|
251
|
+
e && q(!1);
|
|
253
252
|
}), m(B, () => {
|
|
254
|
-
E.value =
|
|
253
|
+
E.value = ot();
|
|
255
254
|
}), m(k, (e, t) => {
|
|
256
255
|
(e || t && I) && l(() => x.value?.focus()), I = !0;
|
|
257
|
-
}, { immediate: !0 }),
|
|
258
|
-
F = D.value, T.value =
|
|
259
|
-
}),
|
|
260
|
-
Y = !1,
|
|
261
|
-
}), (e, r) => (u(), o("div",
|
|
256
|
+
}, { immediate: !0 }), me(() => {
|
|
257
|
+
F = D.value, T.value = G() || (_.freeSolo && F != null ? String(F) : ""), P = C.value?.form, P?.addEventListener("reset", vt), N = b.value.ownerDocument, N.addEventListener("focusin", gt);
|
|
258
|
+
}), pe(() => {
|
|
259
|
+
Y = !1, re(M), P?.removeEventListener("reset", vt), N?.removeEventListener("focusin", gt);
|
|
260
|
+
}), (e, r) => (u(), o("div", de({
|
|
262
261
|
ref_key: "root",
|
|
263
262
|
ref: b
|
|
264
|
-
},
|
|
263
|
+
}, Ue.value, { class: ["kima-combobox", {
|
|
265
264
|
"kima-combobox--open": k.value,
|
|
266
265
|
"kima-combobox--disabled": t.disabled
|
|
267
|
-
}] }), [c(p(
|
|
266
|
+
}] }), [c(p(Ee), {
|
|
268
267
|
open: k.value,
|
|
269
268
|
modal: !1
|
|
270
269
|
}, {
|
|
271
270
|
default: h(() => [
|
|
272
|
-
c(p(
|
|
271
|
+
c(p(Ce), { "as-child": "" }, {
|
|
273
272
|
default: h(() => [s("div", {
|
|
274
273
|
ref_key: "control",
|
|
275
|
-
ref:
|
|
274
|
+
ref: We,
|
|
276
275
|
class: "kima-combobox__control",
|
|
277
276
|
"aria-disabled": t.disabled || void 0
|
|
278
277
|
}, [
|
|
279
|
-
t.searchable ? (u(),
|
|
278
|
+
t.searchable ? (u(), ce(n, {
|
|
280
279
|
key: 0,
|
|
281
280
|
class: "kima-combobox__search-icon",
|
|
282
|
-
icon: p(
|
|
281
|
+
icon: p(Se),
|
|
283
282
|
size: 18,
|
|
284
283
|
"aria-hidden": "true"
|
|
285
284
|
}, null, 8, ["icon"])) : a("", !0),
|
|
286
285
|
s("input", {
|
|
287
|
-
id:
|
|
286
|
+
id: Ye,
|
|
288
287
|
ref_key: "input",
|
|
289
288
|
ref: x,
|
|
290
289
|
class: "kima-combobox__input",
|
|
@@ -300,27 +299,27 @@ var Ee = ["aria-disabled"], De = [
|
|
|
300
299
|
"aria-autocomplete": "list",
|
|
301
300
|
"aria-label": p(y)["aria-label"] || p(y).ariaLabel || t.label || void 0,
|
|
302
301
|
"aria-required": t.required || void 0,
|
|
303
|
-
"aria-activedescendant":
|
|
304
|
-
onFocus:
|
|
305
|
-
onClick:
|
|
306
|
-
onInput: g(
|
|
302
|
+
"aria-activedescendant": nt.value,
|
|
303
|
+
onFocus: K,
|
|
304
|
+
onClick: K,
|
|
305
|
+
onInput: g(pt, ["stop"]),
|
|
307
306
|
onChange: g(Q, ["stop"]),
|
|
308
|
-
onKeydown:
|
|
309
|
-
}, null, 40,
|
|
310
|
-
c(
|
|
311
|
-
default: h(() => [
|
|
307
|
+
onKeydown: mt
|
|
308
|
+
}, null, 40, Oe),
|
|
309
|
+
c(se, { name: "kima-fade" }, {
|
|
310
|
+
default: h(() => [rt.value ? (u(), o("button", {
|
|
312
311
|
key: 0,
|
|
313
312
|
class: "kima-combobox__clear",
|
|
314
313
|
type: "button",
|
|
315
314
|
"aria-label": "清除输入",
|
|
316
315
|
title: "清除输入",
|
|
317
316
|
disabled: t.disabled,
|
|
318
|
-
onClick:
|
|
317
|
+
onClick: ft
|
|
319
318
|
}, [c(n, {
|
|
320
|
-
icon: p(
|
|
319
|
+
icon: p(xe),
|
|
321
320
|
size: 18,
|
|
322
321
|
"aria-hidden": "true"
|
|
323
|
-
}, null, 8, ["icon"])], 8,
|
|
322
|
+
}, null, 8, ["icon"])], 8, ke)) : a("", !0)]),
|
|
324
323
|
_: 1
|
|
325
324
|
}),
|
|
326
325
|
s("button", {
|
|
@@ -329,14 +328,14 @@ var Ee = ["aria-disabled"], De = [
|
|
|
329
328
|
disabled: t.disabled,
|
|
330
329
|
"aria-label": "显示选项",
|
|
331
330
|
onMousedown: r[0] ||= g(() => {}, ["prevent"]),
|
|
332
|
-
onClick: r[1] ||= (e) => k.value ?
|
|
331
|
+
onClick: r[1] ||= (e) => k.value ? q(!0) : K()
|
|
333
332
|
}, [c(n, {
|
|
334
333
|
class: "kima-combobox__arrow",
|
|
335
|
-
icon: p(
|
|
334
|
+
icon: p(be),
|
|
336
335
|
size: 20,
|
|
337
336
|
"aria-hidden": "true"
|
|
338
|
-
}, null, 8, ["icon"])], 40,
|
|
339
|
-
], 8,
|
|
337
|
+
}, null, 8, ["icon"])], 40, Ae)
|
|
338
|
+
], 8, De)]),
|
|
340
339
|
_: 1
|
|
341
340
|
}),
|
|
342
341
|
s("input", {
|
|
@@ -345,17 +344,17 @@ var Ee = ["aria-disabled"], De = [
|
|
|
345
344
|
class: "kima-combobox__native",
|
|
346
345
|
type: "text",
|
|
347
346
|
name: t.name,
|
|
348
|
-
value:
|
|
347
|
+
value: tt.value,
|
|
349
348
|
required: t.required,
|
|
350
349
|
disabled: t.disabled,
|
|
351
350
|
tabindex: "-1",
|
|
352
351
|
"aria-hidden": "true",
|
|
353
352
|
onInput: r[2] ||= g(() => {}, ["stop"]),
|
|
354
353
|
onChange: r[3] ||= g(() => {}, ["stop"]),
|
|
355
|
-
onInvalid:
|
|
356
|
-
}, null, 40,
|
|
357
|
-
c(p(
|
|
358
|
-
default: h(() => [k.value || X.value ? (u(),
|
|
354
|
+
onInvalid: _t
|
|
355
|
+
}, null, 40, je),
|
|
356
|
+
c(p(Te), { disabled: !Ve }, {
|
|
357
|
+
default: h(() => [k.value || X.value ? (u(), ce(p(we), {
|
|
359
358
|
key: 0,
|
|
360
359
|
"as-child": "",
|
|
361
360
|
align: "start",
|
|
@@ -366,30 +365,30 @@ var Ee = ["aria-disabled"], De = [
|
|
|
366
365
|
"hide-when-detached": "",
|
|
367
366
|
"force-mount": ""
|
|
368
367
|
}, {
|
|
369
|
-
default: h(() => [s("div",
|
|
368
|
+
default: h(() => [s("div", de({
|
|
370
369
|
ref_key: "popup",
|
|
371
370
|
ref: S
|
|
372
|
-
}, p(
|
|
373
|
-
style: p(
|
|
371
|
+
}, p(Ge), {
|
|
372
|
+
style: p(Ke),
|
|
374
373
|
class: "kima-combobox__popup",
|
|
375
374
|
"data-kima-popup-owner": M
|
|
376
375
|
}), [s("div", {
|
|
377
376
|
id: j,
|
|
378
377
|
class: "kima-combobox__options",
|
|
379
378
|
role: "listbox",
|
|
380
|
-
"aria-labelledby":
|
|
379
|
+
"aria-labelledby": Ye,
|
|
381
380
|
"aria-busy": p(L) || void 0
|
|
382
381
|
}, [
|
|
383
|
-
p(L) ? (u(), o("div",
|
|
382
|
+
p(L) ? (u(), o("div", Ne, "加载中…")) : p(R) ? (u(), o("div", Pe, [le(f(p(R)) + " ", 1), s("button", {
|
|
384
383
|
type: "button",
|
|
385
|
-
onClick: r[4] ||= (...e) => p(
|
|
384
|
+
onClick: r[4] ||= (...e) => p($e) && p($e)(...e)
|
|
386
385
|
}, "重试")])) : a("", !0),
|
|
387
|
-
(u(!0), o(
|
|
386
|
+
(u(!0), o(oe, null, he(B.value, (e, t) => (u(), o("div", {
|
|
388
387
|
id: `${j}-option-${t}`,
|
|
389
388
|
key: t,
|
|
390
389
|
ref_for: !0,
|
|
391
|
-
ref: (e) =>
|
|
392
|
-
class:
|
|
390
|
+
ref: (e) => it(e, t),
|
|
391
|
+
class: fe(["kima-combobox__option", {
|
|
393
392
|
"kima-combobox__option--active": t === E.value,
|
|
394
393
|
"kima-combobox__option--selected": Object.is(e.value, D.value)
|
|
395
394
|
}]),
|
|
@@ -398,10 +397,10 @@ var Ee = ["aria-disabled"], De = [
|
|
|
398
397
|
"aria-disabled": e.disabled || void 0,
|
|
399
398
|
tabindex: "-1",
|
|
400
399
|
onPointerdown: r[5] ||= g(() => {}, ["prevent"]),
|
|
401
|
-
onClick: (t) =>
|
|
402
|
-
}, [s("span",
|
|
403
|
-
!p(L) && !p(R) && B.value.length === 0 ? (u(), o("div",
|
|
404
|
-
], 8,
|
|
400
|
+
onClick: (t) => ut(e)
|
|
401
|
+
}, [s("span", Ie, [s("span", Le, f(e.label), 1), e.description ? (u(), o("span", Re, f(e.description), 1)) : a("", !0)])], 42, Fe))), 128)),
|
|
402
|
+
!p(L) && !p(R) && B.value.length === 0 ? (u(), o("div", ze, "没有匹配选项")) : a("", !0)
|
|
403
|
+
], 8, Me)], 16)]),
|
|
405
404
|
_: 1
|
|
406
405
|
})) : a("", !0)]),
|
|
407
406
|
_: 1
|
|
@@ -410,5 +409,5 @@ var Ee = ["aria-disabled"], De = [
|
|
|
410
409
|
_: 1
|
|
411
410
|
}, 8, ["open"])], 16));
|
|
412
411
|
}
|
|
413
|
-
}), [["__scopeId", "data-v-
|
|
414
|
-
export {
|
|
412
|
+
}), [["__scopeId", "data-v-82d70c66"]]);
|
|
413
|
+
export { Be as default };
|
|
@@ -3,23 +3,24 @@ import { useNormalizedRadius as t } from "../../utils/radius.js";
|
|
|
3
3
|
import n from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
4
|
import r from "./icon.ce.js";
|
|
5
5
|
import i from "./button.ce.js";
|
|
6
|
+
import { useModelState as a } from "../../utils/model.js";
|
|
6
7
|
/* empty css */
|
|
7
|
-
import { computed as
|
|
8
|
-
import { Cancel01Icon as
|
|
8
|
+
import { computed as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createVNode as u, mergeProps as d, onBeforeUnmount as f, onMounted as p, openBlock as m, ref as h, renderSlot as g, toDisplayString as _, unref as v, useAttrs as y, useId as b, watch as x, withCtx as S, withModifiers as C } from "vue";
|
|
9
|
+
import { Cancel01Icon as w } from "@hugeicons/core-free-icons";
|
|
9
10
|
// src/components/core/dialog.ce.vue
|
|
10
|
-
var
|
|
11
|
+
var T = ["aria-labelledby", "aria-describedby"], E = { class: "kima-dialog__positioner" }, D = {
|
|
11
12
|
key: 0,
|
|
12
13
|
class: "kima-dialog__header"
|
|
13
|
-
},
|
|
14
|
+
}, O = { class: "kima-dialog__heading" }, k = {
|
|
14
15
|
key: 1,
|
|
15
16
|
class: "kima-dialog__header-slot"
|
|
16
|
-
},
|
|
17
|
+
}, A = {
|
|
17
18
|
key: 2,
|
|
18
19
|
class: "kima-dialog__body"
|
|
19
|
-
},
|
|
20
|
+
}, j = {
|
|
20
21
|
key: 3,
|
|
21
22
|
class: "kima-dialog__footer"
|
|
22
|
-
},
|
|
23
|
+
}, M = /*#__PURE__*/ n(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
23
24
|
__name: "dialog.ce",
|
|
24
25
|
props: {
|
|
25
26
|
open: {
|
|
@@ -48,82 +49,80 @@ var w = ["aria-labelledby", "aria-describedby"], T = { class: "kima-dialog__posi
|
|
|
48
49
|
}
|
|
49
50
|
},
|
|
50
51
|
emits: ["update:open", "close"],
|
|
51
|
-
setup(n, { emit:
|
|
52
|
-
let
|
|
53
|
-
...
|
|
52
|
+
setup(n, { emit: M }) {
|
|
53
|
+
let N = n, P = M, F = y(), I = h(null), L = h(null), { hasNativeSlot: R, isCustomElement: z } = e(I), B = o(() => z ? {
|
|
54
|
+
...F,
|
|
54
55
|
id: void 0
|
|
55
|
-
} :
|
|
56
|
+
} : F), { radiusAttrs: V, radiusStyle: H } = t(L, () => N.radius), [U, W] = a(N, "open", P), G = o(() => [
|
|
56
57
|
"small",
|
|
57
58
|
"medium",
|
|
58
59
|
"large"
|
|
59
|
-
].includes(
|
|
60
|
-
function
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
function J() {
|
|
64
|
-
F.value && (H.value && !F.value.open ? F.value.showModal() : !H.value && F.value.open && F.value.close());
|
|
65
|
-
}
|
|
66
|
-
function Y(e) {
|
|
67
|
-
e.preventDefault(), M.closeOnEscape && q("escape");
|
|
60
|
+
].includes(N.size) ? N.size : "medium"), K = b(), q = `kima-dialog-title-${K}`, J = `kima-dialog-description-${K}`;
|
|
61
|
+
function Y(e = "close") {
|
|
62
|
+
U.value && W(!1) && P("close", e);
|
|
68
63
|
}
|
|
69
64
|
function X() {
|
|
70
|
-
|
|
65
|
+
I.value && (U.value && !I.value.open ? I.value.showModal() : !U.value && I.value.open && I.value.close());
|
|
71
66
|
}
|
|
72
67
|
function Z(e) {
|
|
73
|
-
|
|
74
|
-
|
|
68
|
+
e.preventDefault(), N.closeOnEscape && Y("escape");
|
|
69
|
+
}
|
|
70
|
+
function Q() {
|
|
71
|
+
I.value && !I.value.open && Y("native");
|
|
72
|
+
}
|
|
73
|
+
function $(e) {
|
|
74
|
+
if (e.key !== "Tab" || !I.value) return;
|
|
75
|
+
let t = [...I.value.querySelectorAll("button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex='-1'])")];
|
|
75
76
|
if (!t.length) return;
|
|
76
77
|
let n = t[0], r = t[t.length - 1];
|
|
77
78
|
e.shiftKey && document.activeElement === n ? (e.preventDefault(), r.focus()) : !e.shiftKey && document.activeElement === r && (e.preventDefault(), n.focus());
|
|
78
79
|
}
|
|
79
|
-
return
|
|
80
|
-
|
|
81
|
-
}),
|
|
82
|
-
F.value?.open && F.value.close();
|
|
83
|
-
}), (e, t) => (p(), s("dialog", u({
|
|
80
|
+
return x(U, X, { flush: "post" }), p(X), f(() => {
|
|
81
|
+
I.value?.open && I.value.close();
|
|
82
|
+
}), (e, t) => (m(), c("dialog", d({
|
|
84
83
|
ref_key: "dialog",
|
|
85
|
-
ref:
|
|
86
|
-
},
|
|
84
|
+
ref: I
|
|
85
|
+
}, B.value, {
|
|
87
86
|
title: void 0,
|
|
88
87
|
class: "kima-dialog",
|
|
89
|
-
"aria-labelledby":
|
|
90
|
-
"aria-describedby": [
|
|
91
|
-
onCancel:
|
|
92
|
-
onClose:
|
|
93
|
-
onKeydown:
|
|
94
|
-
onClick: t[1] ||=
|
|
95
|
-
}), [
|
|
88
|
+
"aria-labelledby": v(F).title ? q : v(F)["aria-labelledby"],
|
|
89
|
+
"aria-describedby": [v(F)["aria-describedby"], n.description ? J : void 0].filter(Boolean).join(" ") || void 0,
|
|
90
|
+
onCancel: C(Z, ["stop"]),
|
|
91
|
+
onClose: C(Q, ["stop"]),
|
|
92
|
+
onKeydown: $,
|
|
93
|
+
onClick: t[1] ||= C((e) => n.closeOnBackdrop && Y("backdrop"), ["self"])
|
|
94
|
+
}), [l("div", E, [l("section", d({
|
|
96
95
|
ref_key: "panel",
|
|
97
|
-
ref:
|
|
98
|
-
},
|
|
99
|
-
style:
|
|
100
|
-
class: ["kima-dialog__panel", `kima-dialog__panel--${
|
|
96
|
+
ref: L
|
|
97
|
+
}, v(V), {
|
|
98
|
+
style: v(H),
|
|
99
|
+
class: ["kima-dialog__panel", `kima-dialog__panel--${G.value}`]
|
|
101
100
|
}), [
|
|
102
|
-
|
|
101
|
+
v(F).title || e.$slots.header || v(R)("header") ? (m(), c("header", D, [l("div", O, [v(F).title ? (m(), c("h2", {
|
|
103
102
|
key: 0,
|
|
104
|
-
id:
|
|
103
|
+
id: q,
|
|
105
104
|
class: "kima-dialog__title"
|
|
106
|
-
},
|
|
105
|
+
}, _(v(F).title), 1)) : s("", !0), e.$slots.header || v(R)("header") ? (m(), c("div", k, [g(e.$slots, "header", {}, void 0, !0)])) : s("", !0)]), u(i, {
|
|
107
106
|
variant: "text",
|
|
108
107
|
class: "kima-dialog__close",
|
|
109
108
|
"aria-label": "关闭对话框",
|
|
110
|
-
onClick: t[0] ||= (e) =>
|
|
109
|
+
onClick: t[0] ||= (e) => Y("button")
|
|
111
110
|
}, {
|
|
112
|
-
default:
|
|
113
|
-
icon:
|
|
111
|
+
default: S(() => [u(r, {
|
|
112
|
+
icon: v(w),
|
|
114
113
|
size: 20,
|
|
115
114
|
color: "currentColor"
|
|
116
115
|
}, null, 8, ["icon"])]),
|
|
117
116
|
_: 1
|
|
118
|
-
})])) :
|
|
119
|
-
n.description ? (
|
|
117
|
+
})])) : s("", !0),
|
|
118
|
+
n.description ? (m(), c("p", {
|
|
120
119
|
key: 1,
|
|
121
|
-
id:
|
|
120
|
+
id: J,
|
|
122
121
|
class: "kima-dialog__description"
|
|
123
|
-
},
|
|
124
|
-
e.$slots.default ||
|
|
125
|
-
e.$slots.footer ||
|
|
126
|
-
], 16)])], 16,
|
|
122
|
+
}, _(n.description), 1)) : s("", !0),
|
|
123
|
+
e.$slots.default || v(R)("default") ? (m(), c("div", A, [g(e.$slots, "default", {}, void 0, !0)])) : s("", !0),
|
|
124
|
+
e.$slots.footer || v(R)("footer") ? (m(), c("footer", j, [g(e.$slots, "footer", {}, void 0, !0)])) : s("", !0)
|
|
125
|
+
], 16)])], 16, T));
|
|
127
126
|
}
|
|
128
|
-
}), [["__scopeId", "data-v-
|
|
129
|
-
export {
|
|
127
|
+
}), [["__scopeId", "data-v-638cbfdc"]]);
|
|
128
|
+
export { M as default };
|