@kernel4632/kima 0.30.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.
Files changed (37) hide show
  1. package/README.md +21 -6
  2. package/dist/components/containment/morph.ce.vue_vue_type_style_index_0_scoped_10a98d89_lang.css +1 -0
  3. package/dist/components/core/combobox.ce.vue_vue_type_style_index_0_scoped_82d70c66_lang.css +1 -0
  4. package/dist/components/core/dialog.ce.vue_vue_type_style_index_0_scoped_638cbfdc_lang.css +1 -0
  5. 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
  6. package/dist/components/core/{morph-field.ce.vue_vue_type_style_index_0_scoped_47863e8f_lang.css → morph-field.ce.vue_vue_type_style_index_0_scoped_d8ed6708_lang.css} +1 -1
  7. 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
  8. package/dist/components/core/split-button.ce.vue_vue_type_style_index_0_scoped_b4a612b7_lang.css +1 -0
  9. package/dist/kima-elements-core.js +2325 -2342
  10. package/dist/kima-elements.js +7591 -7234
  11. package/dist/kima.js +21 -20
  12. package/dist/style.css +9 -7
  13. package/dist/styles/_tokens.css +1 -1
  14. package/dist/styles/combobox.css +1 -1
  15. package/dist/styles/core.css +6 -6
  16. package/dist/styles/dialog.css +1 -1
  17. package/dist/styles/fab-menu.css +1 -1
  18. package/dist/styles/morph-field.css +1 -1
  19. package/dist/styles/morph.css +2 -0
  20. package/dist/styles/select.css +1 -1
  21. package/dist/styles/split-button.css +1 -1
  22. package/dist/vue/components/containment/morph.ce.js +81 -0
  23. package/dist/vue/components/core/combobox.ce.js +116 -117
  24. package/dist/vue/components/core/dialog.ce.js +55 -56
  25. package/dist/vue/components/core/fab-menu.ce.js +51 -59
  26. package/dist/vue/components/core/morph-field.ce.js +33 -35
  27. package/dist/vue/components/core/select.ce.js +167 -168
  28. package/dist/vue/components/core/split-button.ce.js +54 -62
  29. package/dist/vue/utils/interaction.js +19 -22
  30. package/dist/vue/utils/model.js +29 -0
  31. package/dist/vue/utils/morph.js +306 -0
  32. package/dist/vue/utils/navigation.js +14 -17
  33. package/dist/vue/utils/shell.js +12 -20
  34. package/package.json +1 -1
  35. package/dist/components/core/combobox.ce.vue_vue_type_style_index_0_scoped_ba7220f2_lang.css +0 -1
  36. package/dist/components/core/dialog.ce.vue_vue_type_style_index_0_scoped_09f96946_lang.css +0 -1
  37. package/dist/components/core/split-button.ce.vue_vue_type_style_index_0_scoped_a8ef75a5_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 { useRemoteOptions as ee } from "../../utils/remote-options.js";
6
- import { register as te, unregister as ne } from "../../utils/popup-manager.js";
7
- import { cancelPopupLeave as re, playPopupLeave as ie } from "../../utils/popup-motion.js";
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 ae, Transition as oe, computed as i, createBlock as se, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as ce, createVNode as c, getCurrentInstance as le, mergeProps as ue, nextTick as l, normalizeClass as de, onBeforeUnmount as fe, onMounted as pe, openBlock as u, ref as d, renderList as me, shallowRef as he, toDisplayString as f, unref as p, useAttrs as ge, useHost as _e, useId as ve, watch as m, withCtx as h, withModifiers as g } from "vue";
10
- import { ArrowDown01Icon as ye, Cancel01Icon as be, Search01Icon as xe } from "@hugeicons/core-free-icons";
11
- import { PopoverAnchor as Se, PopoverContent as Ce, PopoverPortal as we, PopoverRoot as Te } from "reka-ui";
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 Ee = ["aria-disabled"], De = [
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
- ], Oe = ["disabled"], ke = ["disabled"], Ae = [
23
+ ], ke = ["disabled"], Ae = ["disabled"], je = [
23
24
  "name",
24
25
  "value",
25
26
  "required",
26
27
  "disabled"
27
- ], je = ["aria-busy"], Me = {
28
+ ], Me = ["aria-busy"], Ne = {
28
29
  key: 0,
29
30
  class: "kima-combobox__status",
30
31
  role: "status"
31
- }, Ne = {
32
+ }, Pe = {
32
33
  key: 1,
33
34
  class: "kima-combobox__status kima-combobox__status--error",
34
35
  role: "alert"
35
- }, Pe = [
36
+ }, Fe = [
36
37
  "id",
37
38
  "aria-selected",
38
39
  "aria-disabled",
39
40
  "onClick"
40
- ], Fe = { class: "kima-combobox__option-copy" }, Ie = { class: "kima-combobox__option-label" }, Le = {
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
- }, Re = {
44
+ }, ze = {
44
45
  key: 2,
45
46
  class: "kima-combobox__empty",
46
47
  role: "status"
47
- }, ze = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
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: ze }) {
107
- let Be = typeof document < "u", _ = t, v = ze, y = ge(), Ve = le()?.ce ? _e() : null, He = i(() => Ve ? {
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), Ue = d(null);
111
- r(Ue);
112
- let x = d(null), S = d(null), { radiusAttrs: We, radiusStyle: Ge } = e(S, () => _.radius), C = d(null), w = d([]), T = d(""), E = d(-1), D = he(_.modelValue), O = he(_.modelValue), k = d(_.open && !_.disabled), A = `kima-combobox-${ve()}`, Ke = `${A}-input`, j = `${A}-listbox`, M = `${A}-popup`, N, P, F, I = !0, qe = i(() => _.loader), Je = i(() => T.value), { items: Ye, loading: L, error: R, retry: Xe } = ee(qe, Je, i(() => _.debounce), i(() => _.retry), v), z = i(() => typeof _.loader == "function" ? Ye.value : _.items), Ze = i(() => z.value.find((e) => Object.is(e?.value, D.value)) || null), B = i(() => {
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
- }), Qe = i(() => D.value === null || D.value === void 0 ? "" : String(D.value)), $e = i(() => k.value && E.value >= 0 ? `${j}-option-${E.value}` : void 0), et = i(() => _.clearable && (D.value !== null && D.value !== void 0 && D.value !== "" || T.value.length > 0));
116
- function tt(e, t) {
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 nt() {
126
+ function at() {
126
127
  let e = V();
127
128
  return e[e.length - 1] ?? -1;
128
129
  }
129
- function U() {
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 W(e, t = !1) {
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 rt(e) {
139
+ function st(e) {
139
140
  let t = V();
140
141
  if (!t.length) return;
141
142
  let n = t.indexOf(E.value);
142
- W(t[n < 0 ? e > 0 ? 0 : t.length - 1 : (n + e + t.length) % t.length]);
143
+ U(t[n < 0 ? e > 0 ? 0 : t.length - 1 : (n + e + t.length) % t.length]);
143
144
  }
144
- function it(e) {
145
+ function ct(e) {
145
146
  Object.is(e, O.value) || (O.value = e, v("change", e));
146
147
  }
147
- function G(e, t = !1) {
148
- Object.is(e, D.value) || (D.value = e, v("update:modelValue", e)), t && it(e);
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 K() {
151
- return Ze.value ? Ze.value.label : "";
151
+ function G() {
152
+ return et.value ? et.value.label : "";
152
153
  }
153
- function q() {
154
- _.disabled || k.value || (k.value = !0, E.value = U(), v("update:open", !0));
154
+ function K() {
155
+ _.disabled || k.value || (Je(!0), E.value = ot());
155
156
  }
156
- function J(e = !0) {
157
- k.value && (I = e, k.value = !1, v("update:open", !1));
157
+ function q(e = !0) {
158
+ k.value && (I = e, Je(!1));
158
159
  }
159
- function at(e) {
160
+ function lt(e) {
160
161
  return e.includes(b.value) ? !0 : e.some((e) => e?.dataset?.kimaPopupOwner === M);
161
162
  }
162
- function ot(e) {
163
- Y && (e ? te(M, {
163
+ function J(e) {
164
+ Y && (e ? ne(M, {
164
165
  close: () => {
165
- Q(), J(!1);
166
+ Q(), q(!1);
166
167
  },
167
- isInside: at
168
- }) : ne(M));
168
+ isInside: lt
169
+ }) : re(M));
169
170
  }
170
171
  let Y = !1;
171
- m(k, ot), pe(() => {
172
- Y = !0, ot(k.value);
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 && (re(e), e.inert = !1, e.removeAttribute("aria-hidden"));
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
- ie(e, () => {
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
- G(e), it(e);
194
- } else T.value = K();
194
+ W(e), ct(e);
195
+ } else T.value = G();
195
196
  }
196
- function st(e) {
197
- _.disabled || e?.disabled || (T.value = e.label, G(e.value, !0), J(!0));
197
+ function ut(e) {
198
+ _.disabled || e?.disabled || (T.value = e.label, W(e.value, !0), q(!0));
198
199
  }
199
- function ct() {
200
+ function dt() {
200
201
  let e = B.value[E.value];
201
- e ? st(e) : _.freeSolo && (Q(), J(!0));
202
+ e ? ut(e) : _.freeSolo && (Q(), q(!0));
202
203
  }
203
- function lt() {
204
- T.value = "", G(null, !0), J(!0), l(() => x.value?.focus());
204
+ function ft() {
205
+ T.value = "", W(null, !0), q(!0), l(() => x.value?.focus());
205
206
  }
206
- function ut(e) {
207
- _.disabled || (T.value = e.target.value, v("input", T.value), k.value || q(), _.freeSolo && G(T.value === "" ? null : T.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 dt(e) {
210
- _.disabled || e.isComposing || (e.key === "Tab" ? (Q(), J(!1)) : [
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 = K(), J(!0)) : k.value ? e.key === "ArrowDown" ? rt(1) : e.key === "ArrowUp" ? rt(-1) : e.key === "Home" ? W(H()) : e.key === "End" ? W(nt()) : ct() : (q(), e.key === "ArrowUp" || e.key === "End" ? l(() => W(nt())) : e.key === "Home" && l(() => W(H())))));
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 ft(e) {
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 pt(e) {
232
+ function gt(e) {
232
233
  let t = e.composedPath();
233
- !k.value || t.includes(b.value) || t.includes($()) || ft(t) || (Q(), J(!1));
234
+ !k.value || t.includes(b.value) || t.includes($()) || ht(t) || (Q(), q(!1));
234
235
  }
235
- function mt(e) {
236
+ function _t(e) {
236
237
  e.preventDefault(), l(() => x.value?.focus());
237
238
  }
238
- function ht(e) {
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) : ""), J(!1), C.value && (C.value.value = F == null ? "" : String(F)), t && v("update:modelValue", 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 = K());
249
- }, { deep: !0 }), m(() => _.open, (e) => {
250
- k.value = e && !_.disabled, k.value && (E.value = U());
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 = U();
253
+ E.value = ot();
255
254
  }), m(k, (e, t) => {
256
255
  (e || t && I) && l(() => x.value?.focus()), I = !0;
257
- }, { immediate: !0 }), pe(() => {
258
- F = D.value, T.value = K() || (_.freeSolo && F != null ? String(F) : ""), P = C.value?.form, P?.addEventListener("reset", ht), N = b.value.ownerDocument, N.addEventListener("focusin", pt);
259
- }), fe(() => {
260
- Y = !1, ne(M), P?.removeEventListener("reset", ht), N?.removeEventListener("focusin", pt);
261
- }), (e, r) => (u(), o("div", ue({
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
- }, He.value, { class: ["kima-combobox", {
263
+ }, Ue.value, { class: ["kima-combobox", {
265
264
  "kima-combobox--open": k.value,
266
265
  "kima-combobox--disabled": t.disabled
267
- }] }), [c(p(Te), {
266
+ }] }), [c(p(Ee), {
268
267
  open: k.value,
269
268
  modal: !1
270
269
  }, {
271
270
  default: h(() => [
272
- c(p(Se), { "as-child": "" }, {
271
+ c(p(Ce), { "as-child": "" }, {
273
272
  default: h(() => [s("div", {
274
273
  ref_key: "control",
275
- ref: Ue,
274
+ ref: We,
276
275
  class: "kima-combobox__control",
277
276
  "aria-disabled": t.disabled || void 0
278
277
  }, [
279
- t.searchable ? (u(), se(n, {
278
+ t.searchable ? (u(), ce(n, {
280
279
  key: 0,
281
280
  class: "kima-combobox__search-icon",
282
- icon: p(xe),
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: Ke,
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": $e.value,
304
- onFocus: q,
305
- onClick: q,
306
- onInput: g(ut, ["stop"]),
302
+ "aria-activedescendant": nt.value,
303
+ onFocus: K,
304
+ onClick: K,
305
+ onInput: g(pt, ["stop"]),
307
306
  onChange: g(Q, ["stop"]),
308
- onKeydown: dt
309
- }, null, 40, De),
310
- c(oe, { name: "kima-fade" }, {
311
- default: h(() => [et.value ? (u(), o("button", {
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: lt
317
+ onClick: ft
319
318
  }, [c(n, {
320
- icon: p(be),
319
+ icon: p(xe),
321
320
  size: 18,
322
321
  "aria-hidden": "true"
323
- }, null, 8, ["icon"])], 8, Oe)) : a("", !0)]),
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 ? J(!0) : q()
331
+ onClick: r[1] ||= (e) => k.value ? q(!0) : K()
333
332
  }, [c(n, {
334
333
  class: "kima-combobox__arrow",
335
- icon: p(ye),
334
+ icon: p(be),
336
335
  size: 20,
337
336
  "aria-hidden": "true"
338
- }, null, 8, ["icon"])], 40, ke)
339
- ], 8, Ee)]),
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: Qe.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: mt
356
- }, null, 40, Ae),
357
- c(p(we), { disabled: !Be }, {
358
- default: h(() => [k.value || X.value ? (u(), se(p(Ce), {
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", ue({
368
+ default: h(() => [s("div", de({
370
369
  ref_key: "popup",
371
370
  ref: S
372
- }, p(We), {
373
- style: p(Ge),
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": Ke,
379
+ "aria-labelledby": Ye,
381
380
  "aria-busy": p(L) || void 0
382
381
  }, [
383
- p(L) ? (u(), o("div", Me, "加载中…")) : p(R) ? (u(), o("div", Ne, [ce(f(p(R)) + " ", 1), s("button", {
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(Xe) && p(Xe)(...e)
384
+ onClick: r[4] ||= (...e) => p($e) && p($e)(...e)
386
385
  }, "重试")])) : a("", !0),
387
- (u(!0), o(ae, null, me(B.value, (e, t) => (u(), o("div", {
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) => tt(e, t),
392
- class: de(["kima-combobox__option", {
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) => st(e)
402
- }, [s("span", Fe, [s("span", Ie, f(e.label), 1), e.description ? (u(), o("span", Le, f(e.description), 1)) : a("", !0)])], 42, Pe))), 128)),
403
- !p(L) && !p(R) && B.value.length === 0 ? (u(), o("div", Re, "没有匹配选项")) : a("", !0)
404
- ], 8, je)], 16)]),
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-ba7220f2"]]);
414
- export { ze as default };
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 a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createVNode as l, mergeProps as u, onBeforeUnmount as d, onMounted as f, openBlock as p, ref as m, renderSlot as h, toDisplayString as g, unref as _, useAttrs as v, useId as y, watch as b, withCtx as x, withModifiers as S } from "vue";
8
- import { Cancel01Icon as C } from "@hugeicons/core-free-icons";
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 w = ["aria-labelledby", "aria-describedby"], T = { class: "kima-dialog__positioner" }, E = {
11
+ var T = ["aria-labelledby", "aria-describedby"], E = { class: "kima-dialog__positioner" }, D = {
11
12
  key: 0,
12
13
  class: "kima-dialog__header"
13
- }, D = { class: "kima-dialog__heading" }, O = {
14
+ }, O = { class: "kima-dialog__heading" }, k = {
14
15
  key: 1,
15
16
  class: "kima-dialog__header-slot"
16
- }, k = {
17
+ }, A = {
17
18
  key: 2,
18
19
  class: "kima-dialog__body"
19
- }, A = {
20
+ }, j = {
20
21
  key: 3,
21
22
  class: "kima-dialog__footer"
22
- }, j = /*#__PURE__*/ n(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
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: j }) {
52
- let M = n, N = j, P = v(), F = m(null), I = m(null), { hasNativeSlot: L, isCustomElement: R } = e(F), z = a(() => R ? {
53
- ...P,
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
- } : P), { radiusAttrs: B, radiusStyle: V } = t(I, () => M.radius), H = m(M.open), U = a(() => [
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(M.size) ? M.size : "medium"), W = y(), G = `kima-dialog-title-${W}`, K = `kima-dialog-description-${W}`;
60
- function q(e = "close") {
61
- H.value && (H.value = !1, F.value?.open && F.value.close(), N("update:open", !1), N("close", e));
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
- F.value && !F.value.open && q("native");
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
- if (e.key !== "Tab" || !F.value) return;
74
- let t = [...F.value.querySelectorAll("button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex='-1'])")];
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 b(() => M.open, (e) => {
80
- H.value = e;
81
- }), b(H, J, { flush: "post" }), f(J), d(() => {
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: F
86
- }, z.value, {
84
+ ref: I
85
+ }, B.value, {
87
86
  title: void 0,
88
87
  class: "kima-dialog",
89
- "aria-labelledby": _(P).title ? G : _(P)["aria-labelledby"],
90
- "aria-describedby": [_(P)["aria-describedby"], n.description ? K : void 0].filter(Boolean).join(" ") || void 0,
91
- onCancel: S(Y, ["stop"]),
92
- onClose: S(X, ["stop"]),
93
- onKeydown: Z,
94
- onClick: t[1] ||= S((e) => n.closeOnBackdrop && q("backdrop"), ["self"])
95
- }), [c("div", T, [c("section", u({
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: I
98
- }, _(B), {
99
- style: _(V),
100
- class: ["kima-dialog__panel", `kima-dialog__panel--${U.value}`]
96
+ ref: L
97
+ }, v(V), {
98
+ style: v(H),
99
+ class: ["kima-dialog__panel", `kima-dialog__panel--${G.value}`]
101
100
  }), [
102
- _(P).title || e.$slots.header || _(L)("header") ? (p(), s("header", E, [c("div", D, [_(P).title ? (p(), s("h2", {
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: G,
103
+ id: q,
105
104
  class: "kima-dialog__title"
106
- }, g(_(P).title), 1)) : o("", !0), e.$slots.header || _(L)("header") ? (p(), s("div", O, [h(e.$slots, "header", {}, void 0, !0)])) : o("", !0)]), l(i, {
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) => q("button")
109
+ onClick: t[0] ||= (e) => Y("button")
111
110
  }, {
112
- default: x(() => [l(r, {
113
- icon: _(C),
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
- })])) : o("", !0),
119
- n.description ? (p(), s("p", {
117
+ })])) : s("", !0),
118
+ n.description ? (m(), c("p", {
120
119
  key: 1,
121
- id: K,
120
+ id: J,
122
121
  class: "kima-dialog__description"
123
- }, g(n.description), 1)) : o("", !0),
124
- e.$slots.default || _(L)("default") ? (p(), s("div", k, [h(e.$slots, "default", {}, void 0, !0)])) : o("", !0),
125
- e.$slots.footer || _(L)("footer") ? (p(), s("footer", A, [h(e.$slots, "footer", {}, void 0, !0)])) : o("", !0)
126
- ], 16)])], 16, w));
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-09f96946"]]);
129
- export { j as default };
127
+ }), [["__scopeId", "data-v-638cbfdc"]]);
128
+ export { M as default };