@kernel4632/kima 0.7.1 → 0.8.3

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 +31 -0
  2. package/dist/components/core/code-block.ce.vue_vue_type_style_index_0_scoped_7e6342e8_lang.css +1 -0
  3. package/dist/components/core/drawer.ce.vue_vue_type_style_index_0_scoped_a36af28b_lang.css +1 -0
  4. package/dist/components/core/menu.ce.vue_vue_type_style_index_0_scoped_597751c9_lang.css +1 -0
  5. package/dist/components/core/select.ce.vue_vue_type_style_index_0_scoped_f1632b10_lang.css +1 -0
  6. package/dist/components/display/list.ce.vue_vue_type_style_index_0_scoped_1c170b37_lang.css +1 -0
  7. package/dist/components/input/radio-group.ce.vue_vue_type_style_index_0_scoped_fe3edf34_lang.css +1 -0
  8. package/dist/components/utility/listbox.ce.vue_vue_type_style_index_0_scoped_8eab8b73_lang.css +1 -0
  9. package/dist/kima-elements-core.js +5560 -5488
  10. package/dist/kima-elements.js +14002 -13831
  11. package/dist/kima.js +95 -95
  12. package/dist/style.css +7 -7
  13. package/dist/styles/app-shell.css +1 -1
  14. package/dist/styles/code-block.css +4 -2
  15. package/dist/styles/core.css +4 -4
  16. package/dist/styles/drawer.css +1 -1
  17. package/dist/styles/list.css +1 -1
  18. package/dist/styles/listbox.css +2 -1
  19. package/dist/styles/menu.css +1 -1
  20. package/dist/styles/radio-group.css +2 -1
  21. package/dist/styles/select.css +1 -1
  22. package/dist/styles/sidebar.css +1 -1
  23. package/dist/vue/components/core/code-block.ce.js +72 -49
  24. package/dist/vue/components/core/drawer.ce.js +6 -7
  25. package/dist/vue/components/core/menu.ce.js +61 -32
  26. package/dist/vue/components/core/select.ce.js +142 -123
  27. package/dist/vue/components/display/list.ce.js +16 -3
  28. package/dist/vue/components/input/radio-group.ce.js +56 -36
  29. package/dist/vue/components/utility/listbox.ce.js +48 -27
  30. package/package.json +1 -1
  31. package/dist/components/core/code-block.ce.vue_vue_type_style_index_0_scoped_6ddc49c8_lang.css +0 -1
  32. package/dist/components/core/drawer.ce.vue_vue_type_style_index_0_scoped_f4c35e3a_lang.css +0 -1
  33. package/dist/components/core/menu.ce.vue_vue_type_style_index_0_scoped_754442d3_lang.css +0 -1
  34. package/dist/components/core/select.ce.vue_vue_type_style_index_0_scoped_5f151e50_lang.css +0 -1
  35. package/dist/components/display/list.ce.vue_vue_type_style_index_0_scoped_db362eec_lang.css +0 -1
  36. package/dist/components/input/radio-group.ce.vue_vue_type_style_index_0_scoped_30add112_lang.css +0 -1
  37. package/dist/components/utility/listbox.ce.vue_vue_type_style_index_0_scoped_0523583b_lang.css +0 -1
@@ -4,42 +4,39 @@ import n from "./icon.ce.js";
4
4
  import { presenceTransition as r } from "../../utils/motion.js";
5
5
  import { useRemoteOptions as i } from "../../utils/remote-options.js";
6
6
  /* empty css */
7
- import { Fragment as a, Transition as o, computed as s, createBlock as ee, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createTextVNode as te, createVNode as d, getCurrentInstance as ne, mergeProps as f, nextTick as p, normalizeClass as m, onBeforeUnmount as re, onMounted as ie, openBlock as h, ref as g, renderList as _, shallowRef as ae, toDisplayString as v, unref as y, useAttrs as oe, useHost as se, useId as ce, vModelSelect as le, vModelText as ue, watch as b, withCtx as de, withDirectives as fe, withModifiers as x } from "vue";
8
- import { ArrowDown01Icon as pe, Cancel01Icon as me, Search01Icon as he, Tick01Icon as ge } from "@hugeicons/core-free-icons";
7
+ import { Fragment as a, Teleport as ee, Transition as o, computed as s, createBlock as te, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createTextVNode as ne, createVNode as d, getCurrentInstance as re, mergeProps as f, nextTick as p, normalizeClass as m, normalizeStyle as ie, onBeforeUnmount as ae, onMounted as oe, openBlock as h, ref as g, renderList as _, shallowRef as se, toDisplayString as v, unref as y, useAttrs as ce, useHost as le, useId as ue, vModelSelect as de, vModelText as fe, watch as b, withCtx as pe, withDirectives as me, withModifiers as x } from "vue";
8
+ import { ArrowDown01Icon as he, Cancel01Icon as ge, Search01Icon as _e, Tick01Icon as ve } from "@hugeicons/core-free-icons";
9
9
  // src/components/core/select.ce.vue
10
- var _e = ["aria-disabled"], ve = [
10
+ var ye = ["aria-disabled"], be = [
11
11
  "disabled",
12
12
  "aria-expanded",
13
13
  "aria-label",
14
14
  "aria-required",
15
15
  "aria-activedescendant"
16
- ], ye = ["disabled"], be = [
16
+ ], xe = ["disabled"], Se = [
17
17
  "name",
18
18
  "required",
19
19
  "disabled"
20
- ], xe = ["value", "disabled"], Se = {
21
- key: 0,
22
- class: "kima-select__popup"
23
- }, Ce = {
20
+ ], Ce = ["value", "disabled"], we = {
24
21
  key: 0,
25
22
  class: "kima-select__search-wrap"
26
- }, we = ["aria-activedescendant"], Te = ["aria-busy"], Ee = {
23
+ }, Te = ["aria-activedescendant"], Ee = ["aria-busy"], De = {
27
24
  key: 0,
28
25
  class: "kima-select__status",
29
26
  role: "status"
30
- }, De = {
27
+ }, Oe = {
31
28
  key: 1,
32
29
  class: "kima-select__status kima-select__status--error",
33
30
  role: "alert"
34
- }, Oe = [
31
+ }, ke = [
35
32
  "id",
36
33
  "aria-selected",
37
34
  "aria-disabled",
38
35
  "onClick"
39
- ], ke = { class: "kima-select__option-copy" }, Ae = { class: "kima-select__option-label" }, je = {
36
+ ], Ae = { class: "kima-select__option-copy" }, je = { class: "kima-select__option-label" }, Me = {
40
37
  key: 0,
41
38
  class: "kima-select__option-description"
42
- }, Me = {
39
+ }, Ne = {
43
40
  key: 1,
44
41
  class: "kima-select__empty",
45
42
  role: "status"
@@ -96,53 +93,53 @@ var _e = ["aria-disabled"], ve = [
96
93
  "options-error"
97
94
  ],
98
95
  setup(t, { emit: S }) {
99
- let C = oe(), Ne = ne().ce ? se() : null, w = t, T = S, E = g(null), D = g(null), O = g(null);
100
- e(O);
101
- let k = g(null), A = g(null), j = g([]), M = g(""), N = g(-1), P = ae(w.modelValue), F = g(w.open && !w.disabled), I, L, R, z, B = !0, V = ce(), Pe = `kima-select-${V}-trigger`, H = `kima-select-${V}-listbox`, Fe = `kima-select-${V}-native`, Ie = s(() => C["aria-label"] || C.ariaLabel || w.label || void 0), Le = s(() => w.loader), Re = s(() => M.value), { items: ze, loading: U, error: W, retry: Be } = i(Le, Re, s(() => w.debounce), s(() => w.retry), T), G = s(() => typeof w.loader == "function" ? ze.value : w.items), K = s(() => {
102
- let e = M.value.trim().toLocaleLowerCase();
103
- return typeof w.loader == "function" || !e ? G.value : G.value.filter((t) => `${t.label} ${t.description || ""}`.toLocaleLowerCase().includes(e));
104
- }), q = s(() => G.value.find((e) => Object.is(e.value, P.value))), Ve = s({
105
- get: () => q.value ? P.value : "",
96
+ let C = ce(), Pe = re().ce ? le() : null, w = t, T = S, E = g(null), D = g(null), O = g(null), Fe = g({}), Ie = g(null);
97
+ e(Ie);
98
+ let k = g(null), A = g(null), Le = g([]), j = g(""), M = g(-1), N = se(w.modelValue), P = g(w.open && !w.disabled), F, I, L, R, z = !0, B = ue(), Re = `kima-select-${B}-trigger`, V = `kima-select-${B}-listbox`, ze = `kima-select-${B}-native`, Be = s(() => C["aria-label"] || C.ariaLabel || w.label || void 0), Ve = s(() => w.loader), He = s(() => j.value), { items: Ue, loading: H, error: U, retry: We } = i(Ve, He, s(() => w.debounce), s(() => w.retry), T), W = s(() => typeof w.loader == "function" ? Ue.value : w.items), G = s(() => {
99
+ let e = j.value.trim().toLocaleLowerCase();
100
+ return typeof w.loader == "function" || !e ? W.value : W.value.filter((t) => `${t.label} ${t.description || ""}`.toLocaleLowerCase().includes(e));
101
+ }), K = s(() => W.value.find((e) => Object.is(e.value, N.value))), Ge = s({
102
+ get: () => K.value ? N.value : "",
106
103
  set: () => {
107
104
  let e = A.value.selectedIndex;
108
- Z(e > 0 ? G.value[e - 1].value : null);
105
+ X(e > 0 ? W.value[e - 1].value : null);
109
106
  }
110
- }), J = s(() => K.value.flatMap((e, t) => e.disabled ? [] : [t])), He = s(() => F.value && N.value >= 0 ? `${H}-option-${N.value}` : void 0);
111
- function Y(e) {
112
- N.value = e, p(() => j.value[e]?.scrollIntoView({ block: "nearest" }));
107
+ }), q = s(() => G.value.flatMap((e, t) => e.disabled ? [] : [t])), Ke = s(() => P.value && M.value >= 0 ? `${V}-option-${M.value}` : void 0);
108
+ function J(e) {
109
+ M.value = e, p(() => Le.value[e]?.scrollIntoView({ block: "nearest" }));
113
110
  }
114
- function Ue(e) {
115
- let t = J.value.length;
111
+ function qe(e) {
112
+ let t = q.value.length;
116
113
  if (!t) return;
117
- let n = J.value.indexOf(N.value), r = n < 0 ? e > 0 ? 0 : t - 1 : (n + e + t) % t;
118
- Y(J.value[r]);
114
+ let n = q.value.indexOf(M.value), r = n < 0 ? e > 0 ? 0 : t - 1 : (n + e + t) % t;
115
+ J(q.value[r]);
119
116
  }
120
- function We() {
121
- w.disabled || F.value || (F.value = !0, T("update:open", !0));
117
+ function Je() {
118
+ w.disabled || P.value || (P.value = !0, T("update:open", !0));
122
119
  }
123
- function X(e = !0) {
124
- F.value && (B = e, F.value = !1, T("update:open", !1));
120
+ function Y(e = !0) {
121
+ P.value && (z = e, P.value = !1, T("update:open", !1));
125
122
  }
126
- function Ge() {
127
- F.value ? X() : We();
123
+ function Ye() {
124
+ P.value ? Y() : Je();
128
125
  }
129
- function Z(e) {
130
- w.disabled || Object.is(e, P.value) || (P.value = e, T("update:modelValue", e), T("change", e));
126
+ function X(e) {
127
+ w.disabled || Object.is(e, N.value) || (N.value = e, T("update:modelValue", e), T("change", e));
131
128
  }
132
- function Ke(e) {
133
- w.disabled || e.disabled || (Z(e.value), X());
129
+ function Xe(e) {
130
+ w.disabled || e.disabled || (X(e.value), Y());
134
131
  }
135
- function qe() {
136
- Z(null), X(), p(() => D.value?.focus());
132
+ function Ze() {
133
+ X(null), Y(), p(() => D.value?.focus());
137
134
  }
138
- function Je(e) {
139
- clearTimeout(z), z = setTimeout(() => {
140
- e.defaultPrevented || (P.value = R, A.value.selectedIndex = G.value.findIndex((e) => Object.is(e.value, R)) + 1, X(!1), T("update:modelValue", R));
135
+ function Qe(e) {
136
+ clearTimeout(R), R = setTimeout(() => {
137
+ e.defaultPrevented || (N.value = L, A.value.selectedIndex = W.value.findIndex((e) => Object.is(e.value, L)) + 1, Y(!1), T("update:modelValue", L));
141
138
  }, 0);
142
139
  }
143
- function Q(e) {
140
+ function Z(e) {
144
141
  if (!(w.disabled || e.isComposing)) {
145
- if (e.key === "Tab") X(!1);
142
+ if (e.key === "Tab") Y(!1);
146
143
  else if ((e.key !== " " || e.target !== k.value) && [
147
144
  "ArrowDown",
148
145
  "ArrowUp",
@@ -152,100 +149,113 @@ var _e = ["aria-disabled"], ve = [
152
149
  " ",
153
150
  "Escape"
154
151
  ].includes(e.key)) {
155
- if (e.preventDefault(), e.stopPropagation(), e.key === "Escape") X();
156
- else if (!F.value) We(), e.key === "ArrowUp" || e.key === "End" ? p(() => Y(J.value.at(-1) ?? -1)) : e.key === "Home" && p(() => Y(J.value[0] ?? -1));
157
- else if (e.key === "ArrowDown") Ue(1);
158
- else if (e.key === "ArrowUp") Ue(-1);
159
- else if (e.key === "Home") Y(J.value[0] ?? -1);
160
- else if (e.key === "End") Y(J.value.at(-1) ?? -1);
152
+ if (e.preventDefault(), e.stopPropagation(), e.key === "Escape") Y();
153
+ else if (!P.value) Je(), e.key === "ArrowUp" || e.key === "End" ? p(() => J(q.value.at(-1) ?? -1)) : e.key === "Home" && p(() => J(q.value[0] ?? -1));
154
+ else if (e.key === "ArrowDown") qe(1);
155
+ else if (e.key === "ArrowUp") qe(-1);
156
+ else if (e.key === "Home") J(q.value[0] ?? -1);
157
+ else if (e.key === "End") J(q.value.at(-1) ?? -1);
161
158
  else {
162
- let e = K.value[N.value];
163
- e && Ke(e);
159
+ let e = G.value[M.value];
160
+ e && Xe(e);
164
161
  }
165
162
  }
166
163
  }
167
164
  }
165
+ function Q() {
166
+ let e = D.value;
167
+ if (!e || !P.value || typeof window > "u") return;
168
+ let t = e.getBoundingClientRect(), n = Math.max(0, window.innerHeight - t.bottom - 8), r = Math.max(0, t.top - 8), i = n < 240 && r > n, a = Math.min(360, Math.max(0, i ? r : n)), ee = i ? t.top - a - 8 : t.bottom + 8, o = Math.max(8, Math.min(ee, window.innerHeight - a - 8));
169
+ Fe.value = {
170
+ position: "fixed",
171
+ top: `${o}px`,
172
+ left: `${Math.max(8, Math.min(t.left, window.innerWidth - t.width - 8))}px`,
173
+ width: `${t.width}px`,
174
+ maxHeight: `${a}px`
175
+ };
176
+ }
168
177
  function $(e) {
169
- F.value && !e.composedPath().includes(E.value) && X(!1);
178
+ let t = e.composedPath();
179
+ P.value && !t.includes(E.value) && !t.includes(O.value) && Y(!1);
170
180
  }
171
181
  return b(() => w.modelValue, (e) => {
172
- P.value = e;
182
+ N.value = e;
173
183
  }), b(() => w.open, (e) => {
174
- F.value = e && !w.disabled;
184
+ P.value = e && !w.disabled;
175
185
  }), b(() => w.disabled, (e) => {
176
- e && X(!1);
177
- }), b(F, async (e, t) => {
186
+ e && Y(!1);
187
+ }), b(P, async (e, t) => {
178
188
  if (e) {
179
- M.value = "";
180
- let e = K.value.findIndex((e) => Object.is(e.value, P.value) && !e.disabled);
181
- Y(e >= 0 ? e : J.value[0] ?? -1), await p(), F.value && (w.searchable ? k.value : D.value)?.focus();
182
- } else t && B && p(() => {
183
- F.value || D.value?.focus();
184
- }), B = !0;
185
- }, { immediate: !0 }), b(K, () => {
186
- let e = K.value.findIndex((e) => Object.is(e.value, P.value) && !e.disabled);
187
- Y(!M.value && e >= 0 ? e : J.value[0] ?? -1);
188
- }), ie(() => {
189
- R = w.modelValue, L = A.value.form, L?.addEventListener("reset", Je), I = E.value.ownerDocument, I.addEventListener("pointerdown", $), I.addEventListener("focusin", $);
190
- }), re(() => {
191
- clearTimeout(z), L?.removeEventListener("reset", Je), I.removeEventListener("pointerdown", $), I.removeEventListener("focusin", $);
189
+ j.value = "";
190
+ let e = G.value.findIndex((e) => Object.is(e.value, N.value) && !e.disabled);
191
+ J(e >= 0 ? e : q.value[0] ?? -1), await p(), P.value && (Q(), (w.searchable ? k.value : D.value)?.focus());
192
+ } else t && z && p(() => {
193
+ P.value || D.value?.focus();
194
+ }), z = !0;
195
+ }, { immediate: !0 }), b(G, () => {
196
+ let e = G.value.findIndex((e) => Object.is(e.value, N.value) && !e.disabled);
197
+ J(!j.value && e >= 0 ? e : q.value[0] ?? -1);
198
+ }), oe(() => {
199
+ L = w.modelValue, I = A.value.form, I?.addEventListener("reset", Qe), F = E.value.ownerDocument, F.addEventListener("pointerdown", $), F.addEventListener("focusin", $), F.addEventListener("scroll", Q, !0), window.addEventListener("resize", Q);
200
+ }), ae(() => {
201
+ clearTimeout(R), I?.removeEventListener("reset", Qe), F.removeEventListener("pointerdown", $), F.removeEventListener("focusin", $), F.removeEventListener("scroll", Q, !0), window.removeEventListener("resize", Q);
192
202
  }), (e, i) => (h(), l("div", f({
193
203
  ref_key: "root",
194
204
  ref: E
195
205
  }, {
196
206
  ...y(C),
197
- id: y(Ne) ? void 0 : y(C).id
207
+ id: y(Pe) ? void 0 : y(C).id
198
208
  }, { class: ["kima-select", {
199
- "kima-select--open": F.value,
209
+ "kima-select--open": P.value,
200
210
  "kima-select--disabled": t.disabled
201
211
  }] }), [
202
212
  u("div", {
203
213
  ref_key: "control",
204
- ref: O,
214
+ ref: Ie,
205
215
  class: "kima-select__control",
206
216
  "aria-disabled": t.disabled || void 0
207
217
  }, [u("button", {
208
- id: Pe,
218
+ id: Re,
209
219
  ref_key: "trigger",
210
220
  ref: D,
211
221
  class: "kima-select__trigger",
212
222
  type: "button",
213
223
  role: "combobox",
214
224
  disabled: t.disabled,
215
- "aria-expanded": F.value,
216
- "aria-controls": H,
225
+ "aria-expanded": P.value,
226
+ "aria-controls": V,
217
227
  "aria-haspopup": "listbox",
218
- "aria-label": Ie.value,
228
+ "aria-label": Be.value,
219
229
  "aria-required": t.required || void 0,
220
- "aria-activedescendant": t.searchable ? void 0 : He.value,
221
- onClick: Ge,
222
- onKeydown: Q
223
- }, [u("span", { class: m(["kima-select__trigger-label", { "kima-select__trigger-label--placeholder": !q.value }]) }, v(q.value ? q.value.label : t.placeholder), 3), d(n, {
230
+ "aria-activedescendant": t.searchable ? void 0 : Ke.value,
231
+ onClick: Ye,
232
+ onKeydown: Z
233
+ }, [u("span", { class: m(["kima-select__trigger-label", { "kima-select__trigger-label--placeholder": !K.value }]) }, v(K.value ? K.value.label : t.placeholder), 3), d(n, {
224
234
  class: "kima-select__arrow",
225
- icon: y(pe),
235
+ icon: y(he),
226
236
  size: 20,
227
237
  "aria-hidden": "true"
228
- }, null, 8, ["icon"])], 40, ve), d(o, f({ name: "kima-fade" }, y(r)), {
229
- default: de(() => [t.clearable && q.value ? (h(), l("button", {
238
+ }, null, 8, ["icon"])], 40, be), d(o, f({ name: "kima-fade" }, y(r)), {
239
+ default: pe(() => [t.clearable && K.value ? (h(), l("button", {
230
240
  key: 0,
231
241
  class: "kima-select__clear",
232
242
  type: "button",
233
243
  "aria-label": "清除选择",
234
244
  title: "清除选择",
235
245
  disabled: t.disabled,
236
- onClick: x(qe, ["stop"])
246
+ onClick: x(Ze, ["stop"])
237
247
  }, [d(n, {
238
- icon: y(me),
248
+ icon: y(ge),
239
249
  size: 18,
240
250
  "aria-hidden": "true"
241
- }, null, 8, ["icon"])], 8, ye)) : c("", !0)]),
251
+ }, null, 8, ["icon"])], 8, xe)) : c("", !0)]),
242
252
  _: 1
243
- }, 16)], 8, _e),
244
- fe(u("select", {
253
+ }, 16)], 8, ye),
254
+ me(u("select", {
245
255
  ref_key: "nativeSelect",
246
256
  ref: A,
247
- "onUpdate:modelValue": i[0] ||= (e) => Ve.value = e,
248
- id: Fe,
257
+ "onUpdate:modelValue": i[0] ||= (e) => Ge.value = e,
258
+ id: ze,
249
259
  class: "kima-select__native",
250
260
  name: t.name,
251
261
  required: t.required,
@@ -255,71 +265,80 @@ var _e = ["aria-disabled"], ve = [
255
265
  onInput: i[1] ||= x(() => {}, ["stop"]),
256
266
  onChange: i[2] ||= x(() => {}, ["stop"]),
257
267
  onInvalid: i[3] ||= x((e) => D.value?.focus(), ["prevent"])
258
- }, [i[9] ||= u("option", { value: "" }, null, -1), (h(!0), l(a, null, _(G.value, (e, t) => (h(), l("option", {
268
+ }, [i[9] ||= u("option", { value: "" }, null, -1), (h(!0), l(a, null, _(W.value, (e, t) => (h(), l("option", {
259
269
  key: t,
260
270
  value: e.value,
261
271
  disabled: e.disabled
262
- }, v(e.label), 9, xe))), 128))], 40, be), [[le, Ve.value]]),
263
- d(o, f({ name: "kima-popup" }, y(r)), {
264
- default: de(() => [F.value ? (h(), l("div", Se, [
265
- t.searchable ? (h(), l("div", Ce, [d(n, {
272
+ }, v(e.label), 9, Ce))), 128))], 40, Se), [[de, Ge.value]]),
273
+ (h(), te(ee, {
274
+ to: "body",
275
+ disabled: e.document === void 0
276
+ }, [d(o, f({ name: "kima-popup" }, y(r)), {
277
+ default: pe(() => [P.value ? (h(), l("div", {
278
+ key: 0,
279
+ ref_key: "popup",
280
+ ref: O,
281
+ class: "kima-select__popup",
282
+ style: ie(Fe.value)
283
+ }, [
284
+ t.searchable ? (h(), l("div", we, [d(n, {
266
285
  class: "kima-select__search-icon",
267
- icon: y(he),
286
+ icon: y(_e),
268
287
  size: 18,
269
288
  "aria-hidden": "true"
270
- }, null, 8, ["icon"]), fe(u("input", {
289
+ }, null, 8, ["icon"]), me(u("input", {
271
290
  ref_key: "searchInput",
272
291
  ref: k,
273
- "onUpdate:modelValue": i[4] ||= (e) => M.value = e,
292
+ "onUpdate:modelValue": i[4] ||= (e) => j.value = e,
274
293
  class: "kima-select__search",
275
294
  type: "search",
276
295
  role: "combobox",
277
296
  "aria-label": "搜索选项",
278
297
  "aria-expanded": "true",
279
298
  "aria-autocomplete": "list",
280
- "aria-controls": H,
281
- "aria-activedescendant": He.value,
299
+ "aria-controls": V,
300
+ "aria-activedescendant": Ke.value,
282
301
  onInput: i[5] ||= x(() => {}, ["stop"]),
283
302
  onChange: i[6] ||= x(() => {}, ["stop"]),
284
- onKeydown: Q
285
- }, null, 40, we), [[ue, M.value]])])) : c("", !0),
303
+ onKeydown: Z
304
+ }, null, 40, Te), [[fe, j.value]])])) : c("", !0),
286
305
  u("div", {
287
- id: H,
306
+ id: V,
288
307
  class: "kima-select__options",
289
308
  role: "listbox",
290
- "aria-labelledby": Pe,
291
- "aria-busy": y(U) || void 0
292
- }, [y(U) ? (h(), l("div", Ee, "加载中…")) : y(W) ? (h(), l("div", De, [te(v(y(W)) + " ", 1), u("button", {
309
+ "aria-labelledby": Re,
310
+ "aria-busy": y(H) || void 0
311
+ }, [y(H) ? (h(), l("div", De, "加载中…")) : y(U) ? (h(), l("div", Oe, [ne(v(y(U)) + " ", 1), u("button", {
293
312
  type: "button",
294
- onClick: i[7] ||= (...e) => y(Be) && y(Be)(...e)
295
- }, "重试")])) : c("", !0), (h(!0), l(a, null, _(K.value, (e, t) => (h(), l("div", {
296
- id: `${H}-option-${t}`,
313
+ onClick: i[7] ||= (...e) => y(We) && y(We)(...e)
314
+ }, "重试")])) : c("", !0), (h(!0), l(a, null, _(G.value, (e, t) => (h(), l("div", {
315
+ id: `${V}-option-${t}`,
297
316
  key: t,
298
317
  ref_for: !0,
299
318
  ref: (e) => {
300
- j.value[t] = e;
319
+ Le.value[t] = e;
301
320
  },
302
321
  class: m(["kima-select__option", {
303
- "kima-select__option--active": t === N.value,
304
- "kima-select__option--selected": Object.is(e.value, P.value)
322
+ "kima-select__option--active": t === M.value,
323
+ "kima-select__option--selected": Object.is(e.value, N.value)
305
324
  }]),
306
325
  role: "option",
307
- "aria-selected": Object.is(e.value, P.value),
326
+ "aria-selected": Object.is(e.value, N.value),
308
327
  "aria-disabled": e.disabled || void 0,
309
328
  onPointerdown: i[8] ||= x(() => {}, ["prevent"]),
310
- onClick: (t) => Ke(e)
311
- }, [u("span", ke, [u("span", Ae, v(e.label), 1), e.description ? (h(), l("span", je, v(e.description), 1)) : c("", !0)]), Object.is(e.value, P.value) ? (h(), ee(n, {
329
+ onClick: (t) => Xe(e)
330
+ }, [u("span", Ae, [u("span", je, v(e.label), 1), e.description ? (h(), l("span", Me, v(e.description), 1)) : c("", !0)]), Object.is(e.value, N.value) ? (h(), te(n, {
312
331
  key: 0,
313
332
  class: "kima-select__check",
314
- icon: y(ge),
333
+ icon: y(ve),
315
334
  size: 18,
316
335
  "aria-hidden": "true"
317
- }, null, 8, ["icon"])) : c("", !0)], 42, Oe))), 128))], 8, Te),
318
- !y(U) && !y(W) && K.value.length === 0 ? (h(), l("div", Me, "没有匹配选项")) : c("", !0)
319
- ])) : c("", !0)]),
336
+ }, null, 8, ["icon"])) : c("", !0)], 42, ke))), 128))], 8, Ee),
337
+ !y(H) && !y(U) && G.value.length === 0 ? (h(), l("div", Ne, "没有匹配选项")) : c("", !0)
338
+ ], 4)) : c("", !0)]),
320
339
  _: 1
321
- }, 16)
340
+ }, 16)], 8, ["disabled"]))
322
341
  ], 16));
323
342
  }
324
- }), [["__scopeId", "data-v-5f151e50"]]);
343
+ }), [["__scopeId", "data-v-f1632b10"]]);
325
344
  export { S as default };
@@ -18,6 +18,14 @@ var x = { class: "kima-list__body" }, S = { key: 0 }, C = {
18
18
  default: () => []
19
19
  },
20
20
  ordered: Boolean,
21
+ variant: {
22
+ type: String,
23
+ default: "default"
24
+ },
25
+ gap: {
26
+ type: [String, Number],
27
+ default: ""
28
+ },
21
29
  label: {
22
30
  type: String,
23
31
  default: "列表"
@@ -45,7 +53,8 @@ var x = { class: "kima-list__body" }, S = { key: 0 }, C = {
45
53
  ...v(E),
46
54
  id: v(O) ? void 0 : v(E).id
47
55
  }, {
48
- class: "kima-list",
56
+ class: ["kima-list", { "kima-list--plain": t.variant === "plain" }],
57
+ style: { "--kima-list-gap": typeof t.gap == "number" ? `${t.gap}px` : t.gap || void 0 },
49
58
  "aria-label": t.label
50
59
  }), {
51
60
  default: b(() => [m(e.$slots, "default", {}, () => [l(i, u({ name: "kima-list" }, v(n)), {
@@ -62,7 +71,11 @@ var x = { class: "kima-list__body" }, S = { key: 0 }, C = {
62
71
  _: 3
63
72
  }, 16)], !0)]),
64
73
  _: 3
65
- }, 16, ["aria-label"]));
74
+ }, 16, [
75
+ "class",
76
+ "style",
77
+ "aria-label"
78
+ ]));
66
79
  }
67
- }), [["__scopeId", "data-v-db362eec"]]);
80
+ }), [["__scopeId", "data-v-1c170b37"]]);
68
81
  export { T as default };
@@ -1,16 +1,18 @@
1
1
  import { useRipple as e } from "../../utils/ripple.js";
2
2
  import t from "../../_virtual/_plugin-vue_export-helper.js";
3
- import { useInputAttrs as n, useInputState as r } from "../../utils/input-state.js";
3
+ import n from "../core/icon.ce.js";
4
+ import { useInputAttrs as r, useInputState as i } from "../../utils/input-state.js";
4
5
  /* empty css */
5
- import { Fragment as i, computed as a, createElementBlock as o, createElementVNode as s, mergeProps as c, normalizeClass as l, openBlock as u, ref as d, renderList as f, toDisplayString as p, unref as m, withModifiers as h } from "vue";
6
+ import { Fragment as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, mergeProps as d, normalizeClass as f, openBlock as p, ref as m, renderList as h, renderSlot as g, toDisplayString as _, unref as v, withModifiers as y } from "vue";
7
+ import { Tick01Icon as b } from "@hugeicons/core-free-icons";
6
8
  // src/components/input/radio-group.ce.vue
7
- var g = [
9
+ var x = [
8
10
  "aria-label",
9
11
  "aria-required",
10
12
  "aria-orientation",
11
13
  "disabled",
12
14
  "aria-disabled"
13
- ], _ = [
15
+ ], S = [
14
16
  "name",
15
17
  "value",
16
18
  "checked",
@@ -18,7 +20,7 @@ var g = [
18
20
  "required",
19
21
  "tabindex",
20
22
  "onChange"
21
- ], v = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
23
+ ], C = { class: "kima-radio-group__copy" }, w = { key: 0 }, T = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
22
24
  __name: "radio-group.ce",
23
25
  props: {
24
26
  modelValue: {
@@ -39,18 +41,18 @@ var g = [
39
41
  }
40
42
  },
41
43
  emits: ["update:modelValue", "change"],
42
- setup(t, { emit: v }) {
43
- let y = t, b = v, x = d(null), { attrs: S, controlAttrs: C } = n(), w = a(() => y.options.map((e) => typeof e == "object" ? e : {
44
+ setup(t, { emit: T }) {
45
+ let E = t, D = T, O = m(null), { attrs: k, controlAttrs: A } = r(), j = o(() => E.options.map((e) => typeof e == "object" ? e : {
44
46
  value: e,
45
47
  label: String(e)
46
- })), { local: T, update: E } = r(y, b, x);
47
- e(x);
48
- let D = a(() => {
49
- let e = w.value.findIndex((e) => e.value === T.value && !e.disabled);
50
- return e < 0 ? w.value.findIndex((e) => !e.disabled) : e;
48
+ })), { local: M, update: N } = i(E, D, O);
49
+ e(O);
50
+ let P = o(() => {
51
+ let e = j.value.findIndex((e) => e.value === M.value && !e.disabled);
52
+ return e < 0 ? j.value.findIndex((e) => !e.disabled) : e;
51
53
  });
52
- function O(e) {
53
- if (y.disabled || ![
54
+ function F(e) {
55
+ if (E.disabled || ![
54
56
  "ArrowRight",
55
57
  "ArrowLeft",
56
58
  "ArrowDown",
@@ -59,38 +61,56 @@ var g = [
59
61
  "End"
60
62
  ].includes(e.key)) return;
61
63
  e.preventDefault();
62
- let t = [...x.value.querySelectorAll("input[type=\"radio\"]:not(:disabled)")];
64
+ let t = [...O.value.querySelectorAll("input[type=\"radio\"]:not(:disabled)")];
63
65
  if (!t.length) return;
64
- let n = getComputedStyle(x.value).direction === "rtl", r = e.key === "ArrowUp" || e.key === (n ? "ArrowRight" : "ArrowLeft"), i = t.indexOf(e.target), a = e.key === "Home" ? 0 : e.key === "End" ? t.length - 1 : (i + (r ? -1 : 1) + t.length) % t.length;
66
+ let n = getComputedStyle(O.value).direction === "rtl", r = e.key === "ArrowUp" || e.key === (n ? "ArrowRight" : "ArrowLeft"), i = t.indexOf(e.target), a = e.key === "Home" ? 0 : e.key === "End" ? t.length - 1 : (i + (r ? -1 : 1) + t.length) % t.length;
65
67
  t[a].focus(), t[a].click();
66
68
  }
67
- return (e, n) => (u(), o("fieldset", c({
69
+ return (e, r) => (p(), l("fieldset", d({
68
70
  ref_key: "root",
69
- ref: x
70
- }, m(C), {
71
- class: ["kima-radio-group", m(S).class],
72
- style: m(S).style,
71
+ ref: O
72
+ }, v(A), {
73
+ class: ["kima-radio-group", v(k).class],
74
+ style: v(k).style,
73
75
  role: "radiogroup",
74
- "aria-label": m(C)["aria-label"] || t.label,
76
+ "aria-label": v(A)["aria-label"] || t.label,
75
77
  "aria-required": t.required || void 0,
76
78
  "aria-orientation": t.orientation,
77
79
  disabled: t.disabled,
78
80
  "aria-disabled": t.disabled || void 0,
79
- onKeydown: O
80
- }), [(u(!0), o(i, null, f(w.value, (e, r) => (u(), o("label", {
81
- key: e.value,
82
- class: l(["kima-radio-group__item", { "kima-radio-group__item--disabled": e.disabled }])
83
- }, [s("input", {
81
+ onKeydown: F
82
+ }), [(p(!0), l(a, null, h(j.value, (i, a) => (p(), l("label", {
83
+ key: i.value,
84
+ class: f(["kima-radio-group__item", { "kima-radio-group__item--disabled": i.disabled }])
85
+ }, [u("input", {
84
86
  type: "radio",
85
87
  name: t.name,
86
- value: e.value,
87
- checked: m(T) === e.value,
88
- disabled: t.disabled || e.disabled,
88
+ value: i.value,
89
+ checked: v(M) === i.value,
90
+ disabled: t.disabled || i.disabled,
89
91
  required: t.required,
90
- tabindex: r === D.value ? 0 : -1,
91
- onInput: n[0] ||= h(() => {}, ["stop"]),
92
- onChange: h((t) => m(E)(e.value), ["stop"])
93
- }, null, 40, _), s("span", null, p(e.label), 1)], 2))), 128))], 16, g));
92
+ tabindex: a === P.value ? 0 : -1,
93
+ onInput: r[0] ||= y(() => {}, ["stop"]),
94
+ onChange: y((e) => v(N)(i.value), ["stop"])
95
+ }, null, 40, S), g(e.$slots, "option", {
96
+ item: i,
97
+ selected: v(M) === i.value,
98
+ disabled: t.disabled || i.disabled
99
+ }, () => [
100
+ i.icon ? (p(), s(n, {
101
+ key: 0,
102
+ icon: i.icon,
103
+ size: 20,
104
+ "aria-hidden": "true"
105
+ }, null, 8, ["icon"])) : c("", !0),
106
+ u("span", C, [u("span", null, _(i.label), 1), i.description ? (p(), l("small", w, _(i.description), 1)) : c("", !0)]),
107
+ v(M) === i.value ? (p(), s(n, {
108
+ key: 1,
109
+ icon: v(b),
110
+ size: 18,
111
+ "aria-hidden": "true"
112
+ }, null, 8, ["icon"])) : c("", !0)
113
+ ], !0)], 2))), 128))], 16, x));
94
114
  }
95
- }), [["__scopeId", "data-v-30add112"]]);
96
- export { v as default };
115
+ }), [["__scopeId", "data-v-fe3edf34"]]);
116
+ export { T as default };