@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.
- package/README.md +31 -0
- package/dist/components/core/code-block.ce.vue_vue_type_style_index_0_scoped_7e6342e8_lang.css +1 -0
- package/dist/components/core/drawer.ce.vue_vue_type_style_index_0_scoped_a36af28b_lang.css +1 -0
- package/dist/components/core/menu.ce.vue_vue_type_style_index_0_scoped_597751c9_lang.css +1 -0
- package/dist/components/core/select.ce.vue_vue_type_style_index_0_scoped_f1632b10_lang.css +1 -0
- package/dist/components/display/list.ce.vue_vue_type_style_index_0_scoped_1c170b37_lang.css +1 -0
- package/dist/components/input/radio-group.ce.vue_vue_type_style_index_0_scoped_fe3edf34_lang.css +1 -0
- package/dist/components/utility/listbox.ce.vue_vue_type_style_index_0_scoped_8eab8b73_lang.css +1 -0
- package/dist/kima-elements-core.js +5560 -5488
- package/dist/kima-elements.js +14002 -13831
- package/dist/kima.js +95 -95
- package/dist/style.css +7 -7
- package/dist/styles/app-shell.css +1 -1
- package/dist/styles/code-block.css +4 -2
- package/dist/styles/core.css +4 -4
- package/dist/styles/drawer.css +1 -1
- package/dist/styles/list.css +1 -1
- package/dist/styles/listbox.css +2 -1
- package/dist/styles/menu.css +1 -1
- package/dist/styles/radio-group.css +2 -1
- package/dist/styles/select.css +1 -1
- package/dist/styles/sidebar.css +1 -1
- package/dist/vue/components/core/code-block.ce.js +72 -49
- package/dist/vue/components/core/drawer.ce.js +6 -7
- package/dist/vue/components/core/menu.ce.js +61 -32
- package/dist/vue/components/core/select.ce.js +142 -123
- package/dist/vue/components/display/list.ce.js +16 -3
- package/dist/vue/components/input/radio-group.ce.js +56 -36
- package/dist/vue/components/utility/listbox.ce.js +48 -27
- package/package.json +1 -1
- package/dist/components/core/code-block.ce.vue_vue_type_style_index_0_scoped_6ddc49c8_lang.css +0 -1
- package/dist/components/core/drawer.ce.vue_vue_type_style_index_0_scoped_f4c35e3a_lang.css +0 -1
- package/dist/components/core/menu.ce.vue_vue_type_style_index_0_scoped_754442d3_lang.css +0 -1
- package/dist/components/core/select.ce.vue_vue_type_style_index_0_scoped_5f151e50_lang.css +0 -1
- package/dist/components/display/list.ce.vue_vue_type_style_index_0_scoped_db362eec_lang.css +0 -1
- package/dist/components/input/radio-group.ce.vue_vue_type_style_index_0_scoped_30add112_lang.css +0 -1
- 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
|
|
8
|
-
import { ArrowDown01Icon as
|
|
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
|
|
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
|
-
],
|
|
16
|
+
], xe = ["disabled"], Se = [
|
|
17
17
|
"name",
|
|
18
18
|
"required",
|
|
19
19
|
"disabled"
|
|
20
|
-
],
|
|
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
|
-
},
|
|
23
|
+
}, Te = ["aria-activedescendant"], Ee = ["aria-busy"], De = {
|
|
27
24
|
key: 0,
|
|
28
25
|
class: "kima-select__status",
|
|
29
26
|
role: "status"
|
|
30
|
-
},
|
|
27
|
+
}, Oe = {
|
|
31
28
|
key: 1,
|
|
32
29
|
class: "kima-select__status kima-select__status--error",
|
|
33
30
|
role: "alert"
|
|
34
|
-
},
|
|
31
|
+
}, ke = [
|
|
35
32
|
"id",
|
|
36
33
|
"aria-selected",
|
|
37
34
|
"aria-disabled",
|
|
38
35
|
"onClick"
|
|
39
|
-
],
|
|
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
|
-
},
|
|
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 =
|
|
100
|
-
e(
|
|
101
|
-
let k = g(null), A = g(null),
|
|
102
|
-
let e =
|
|
103
|
-
return typeof w.loader == "function" || !e ?
|
|
104
|
-
}),
|
|
105
|
-
get: () =>
|
|
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
|
-
|
|
105
|
+
X(e > 0 ? W.value[e - 1].value : null);
|
|
109
106
|
}
|
|
110
|
-
}),
|
|
111
|
-
function
|
|
112
|
-
|
|
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
|
|
115
|
-
let t =
|
|
111
|
+
function qe(e) {
|
|
112
|
+
let t = q.value.length;
|
|
116
113
|
if (!t) return;
|
|
117
|
-
let n =
|
|
118
|
-
|
|
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
|
|
121
|
-
w.disabled ||
|
|
117
|
+
function Je() {
|
|
118
|
+
w.disabled || P.value || (P.value = !0, T("update:open", !0));
|
|
122
119
|
}
|
|
123
|
-
function
|
|
124
|
-
|
|
120
|
+
function Y(e = !0) {
|
|
121
|
+
P.value && (z = e, P.value = !1, T("update:open", !1));
|
|
125
122
|
}
|
|
126
|
-
function
|
|
127
|
-
|
|
123
|
+
function Ye() {
|
|
124
|
+
P.value ? Y() : Je();
|
|
128
125
|
}
|
|
129
|
-
function
|
|
130
|
-
w.disabled || Object.is(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
|
|
133
|
-
w.disabled || e.disabled || (
|
|
129
|
+
function Xe(e) {
|
|
130
|
+
w.disabled || e.disabled || (X(e.value), Y());
|
|
134
131
|
}
|
|
135
|
-
function
|
|
136
|
-
|
|
132
|
+
function Ze() {
|
|
133
|
+
X(null), Y(), p(() => D.value?.focus());
|
|
137
134
|
}
|
|
138
|
-
function
|
|
139
|
-
clearTimeout(
|
|
140
|
-
e.defaultPrevented || (
|
|
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
|
|
140
|
+
function Z(e) {
|
|
144
141
|
if (!(w.disabled || e.isComposing)) {
|
|
145
|
-
if (e.key === "Tab")
|
|
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")
|
|
156
|
-
else if (!
|
|
157
|
-
else if (e.key === "ArrowDown")
|
|
158
|
-
else if (e.key === "ArrowUp")
|
|
159
|
-
else if (e.key === "Home")
|
|
160
|
-
else if (e.key === "End")
|
|
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 =
|
|
163
|
-
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
|
-
|
|
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
|
-
|
|
182
|
+
N.value = e;
|
|
173
183
|
}), b(() => w.open, (e) => {
|
|
174
|
-
|
|
184
|
+
P.value = e && !w.disabled;
|
|
175
185
|
}), b(() => w.disabled, (e) => {
|
|
176
|
-
e &&
|
|
177
|
-
}), b(
|
|
186
|
+
e && Y(!1);
|
|
187
|
+
}), b(P, async (e, t) => {
|
|
178
188
|
if (e) {
|
|
179
|
-
|
|
180
|
-
let e =
|
|
181
|
-
|
|
182
|
-
} else t &&
|
|
183
|
-
|
|
184
|
-
}),
|
|
185
|
-
}, { immediate: !0 }), b(
|
|
186
|
-
let e =
|
|
187
|
-
|
|
188
|
-
}),
|
|
189
|
-
|
|
190
|
-
}),
|
|
191
|
-
clearTimeout(
|
|
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(
|
|
207
|
+
id: y(Pe) ? void 0 : y(C).id
|
|
198
208
|
}, { class: ["kima-select", {
|
|
199
|
-
"kima-select--open":
|
|
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:
|
|
214
|
+
ref: Ie,
|
|
205
215
|
class: "kima-select__control",
|
|
206
216
|
"aria-disabled": t.disabled || void 0
|
|
207
217
|
}, [u("button", {
|
|
208
|
-
id:
|
|
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":
|
|
216
|
-
"aria-controls":
|
|
225
|
+
"aria-expanded": P.value,
|
|
226
|
+
"aria-controls": V,
|
|
217
227
|
"aria-haspopup": "listbox",
|
|
218
|
-
"aria-label":
|
|
228
|
+
"aria-label": Be.value,
|
|
219
229
|
"aria-required": t.required || void 0,
|
|
220
|
-
"aria-activedescendant": t.searchable ? void 0 :
|
|
221
|
-
onClick:
|
|
222
|
-
onKeydown:
|
|
223
|
-
}, [u("span", { class: m(["kima-select__trigger-label", { "kima-select__trigger-label--placeholder": !
|
|
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(
|
|
235
|
+
icon: y(he),
|
|
226
236
|
size: 20,
|
|
227
237
|
"aria-hidden": "true"
|
|
228
|
-
}, null, 8, ["icon"])], 40,
|
|
229
|
-
default:
|
|
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(
|
|
246
|
+
onClick: x(Ze, ["stop"])
|
|
237
247
|
}, [d(n, {
|
|
238
|
-
icon: y(
|
|
248
|
+
icon: y(ge),
|
|
239
249
|
size: 18,
|
|
240
250
|
"aria-hidden": "true"
|
|
241
|
-
}, null, 8, ["icon"])], 8,
|
|
251
|
+
}, null, 8, ["icon"])], 8, xe)) : c("", !0)]),
|
|
242
252
|
_: 1
|
|
243
|
-
}, 16)], 8,
|
|
244
|
-
|
|
253
|
+
}, 16)], 8, ye),
|
|
254
|
+
me(u("select", {
|
|
245
255
|
ref_key: "nativeSelect",
|
|
246
256
|
ref: A,
|
|
247
|
-
"onUpdate:modelValue": i[0] ||= (e) =>
|
|
248
|
-
id:
|
|
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, _(
|
|
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,
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
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(
|
|
286
|
+
icon: y(_e),
|
|
268
287
|
size: 18,
|
|
269
288
|
"aria-hidden": "true"
|
|
270
|
-
}, null, 8, ["icon"]),
|
|
289
|
+
}, null, 8, ["icon"]), me(u("input", {
|
|
271
290
|
ref_key: "searchInput",
|
|
272
291
|
ref: k,
|
|
273
|
-
"onUpdate:modelValue": i[4] ||= (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":
|
|
281
|
-
"aria-activedescendant":
|
|
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:
|
|
285
|
-
}, null, 40,
|
|
303
|
+
onKeydown: Z
|
|
304
|
+
}, null, 40, Te), [[fe, j.value]])])) : c("", !0),
|
|
286
305
|
u("div", {
|
|
287
|
-
id:
|
|
306
|
+
id: V,
|
|
288
307
|
class: "kima-select__options",
|
|
289
308
|
role: "listbox",
|
|
290
|
-
"aria-labelledby":
|
|
291
|
-
"aria-busy": y(
|
|
292
|
-
}, [y(
|
|
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(
|
|
295
|
-
}, "重试")])) : c("", !0), (h(!0), l(a, null, _(
|
|
296
|
-
id: `${
|
|
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
|
-
|
|
319
|
+
Le.value[t] = e;
|
|
301
320
|
},
|
|
302
321
|
class: m(["kima-select__option", {
|
|
303
|
-
"kima-select__option--active": t ===
|
|
304
|
-
"kima-select__option--selected": Object.is(e.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,
|
|
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) =>
|
|
311
|
-
}, [u("span",
|
|
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(
|
|
333
|
+
icon: y(ve),
|
|
315
334
|
size: 18,
|
|
316
335
|
"aria-hidden": "true"
|
|
317
|
-
}, null, 8, ["icon"])) : c("", !0)], 42,
|
|
318
|
-
!y(
|
|
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-
|
|
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, [
|
|
74
|
+
}, 16, [
|
|
75
|
+
"class",
|
|
76
|
+
"style",
|
|
77
|
+
"aria-label"
|
|
78
|
+
]));
|
|
66
79
|
}
|
|
67
|
-
}), [["__scopeId", "data-v-
|
|
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
|
|
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
|
|
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
|
|
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
|
-
],
|
|
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:
|
|
43
|
-
let
|
|
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:
|
|
47
|
-
e(
|
|
48
|
-
let
|
|
49
|
-
let e =
|
|
50
|
-
return e < 0 ?
|
|
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
|
|
53
|
-
if (
|
|
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 = [...
|
|
64
|
+
let t = [...O.value.querySelectorAll("input[type=\"radio\"]:not(:disabled)")];
|
|
63
65
|
if (!t.length) return;
|
|
64
|
-
let n = getComputedStyle(
|
|
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,
|
|
69
|
+
return (e, r) => (p(), l("fieldset", d({
|
|
68
70
|
ref_key: "root",
|
|
69
|
-
ref:
|
|
70
|
-
},
|
|
71
|
-
class: ["kima-radio-group",
|
|
72
|
-
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":
|
|
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:
|
|
80
|
-
}), [(
|
|
81
|
-
key:
|
|
82
|
-
class:
|
|
83
|
-
}, [
|
|
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:
|
|
87
|
-
checked:
|
|
88
|
-
disabled: t.disabled ||
|
|
88
|
+
value: i.value,
|
|
89
|
+
checked: v(M) === i.value,
|
|
90
|
+
disabled: t.disabled || i.disabled,
|
|
89
91
|
required: t.required,
|
|
90
|
-
tabindex:
|
|
91
|
-
onInput:
|
|
92
|
-
onChange:
|
|
93
|
-
}, null, 40,
|
|
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-
|
|
96
|
-
export {
|
|
115
|
+
}), [["__scopeId", "data-v-fe3edf34"]]);
|
|
116
|
+
export { T as default };
|