@kernel4632/kima 0.9.7 → 0.9.8
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/dist/components/display/list.ce.vue_vue_type_style_index_0_scoped_88e398dc_lang.css +1 -0
- package/dist/components/interaction/multi-select.ce.vue_vue_type_style_index_0_scoped_0b8ec686_lang.css +1 -0
- package/dist/components/utility/tag-group.ce.vue_vue_type_style_index_0_scoped_de9894bd_lang.css +1 -0
- package/dist/kima-elements-core.js +71 -50
- package/dist/kima-elements.js +12325 -12271
- package/dist/style.css +4 -4
- package/dist/styles/_tokens.css +1 -1
- package/dist/styles/list.css +1 -1
- package/dist/styles/multi-select.css +1 -1
- package/dist/styles/tag-group.css +1 -1
- package/dist/vue/components/display/list.ce.js +12 -18
- package/dist/vue/components/interaction/multi-select.ce.js +96 -94
- package/dist/vue/components/utility/tag-group.ce.js +46 -53
- package/dist/vue/utils/content-motion.js +80 -48
- package/dist/vue/utils/motion.js +137 -106
- package/package.json +1 -1
- package/dist/components/display/list.ce.vue_vue_type_style_index_0_scoped_df3ec98f_lang.css +0 -1
- package/dist/components/interaction/multi-select.ce.vue_vue_type_style_index_0_scoped_cf70a212_lang.css +0 -1
- package/dist/components/utility/tag-group.ce.vue_vue_type_style_index_0_scoped_b575c982_lang.css +0 -1
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
import e from "../../_virtual/_plugin-vue_export-helper.js";
|
|
2
2
|
import t from "../core/button.ce.js";
|
|
3
3
|
import n from "../core/icon.ce.js";
|
|
4
|
-
import {
|
|
5
|
-
import { dismissInteraction as
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
4
|
+
import { presenceTransition as r } from "../../utils/motion.js";
|
|
5
|
+
import { dismissInteraction as i, useChoiceCursor as ee, useInteractionModel as a, useInteractionReset as te, useInteractionRoot as ne, usePlacement as re } from "../../utils/interaction.js";
|
|
6
|
+
import ie from "../core/icon-button.ce.js";
|
|
7
|
+
import { useCollectionMotion as ae } from "../../utils/content-motion.js";
|
|
8
8
|
import oe from "./chip.ce.js";
|
|
9
9
|
/* empty css */
|
|
10
|
-
import { Fragment as
|
|
11
|
-
import { PopoverContent as
|
|
12
|
-
import { Cancel01Icon as
|
|
10
|
+
import { Fragment as o, Transition as s, TransitionGroup as c, computed as l, createBlock as u, createCommentVNode as d, createElementBlock as f, createElementVNode as p, createTextVNode as m, createVNode as h, mergeProps as g, nextTick as _, openBlock as v, ref as y, renderList as b, toDisplayString as x, unref as S, useId as se, vModelText as ce, watch as le, withCtx as C, withDirectives as ue, withKeys as de, withModifiers as w } from "vue";
|
|
11
|
+
import { PopoverContent as fe, PopoverRoot as pe, PopoverTrigger as me } from "reka-ui";
|
|
12
|
+
import { Cancel01Icon as he, Tick01Icon as ge } from "@hugeicons/core-free-icons";
|
|
13
13
|
// src/components/interaction/multi-select.ce.vue
|
|
14
|
-
var ve = { class: "kima-multi-select__control" }, T = ["aria-activedescendant"],
|
|
14
|
+
var _e = ["data-kima-flip-key"], ve = { class: "kima-multi-select__control" }, T = ["aria-activedescendant"], ye = [
|
|
15
15
|
"aria-label",
|
|
16
16
|
"tabindex",
|
|
17
17
|
"aria-activedescendant"
|
|
18
|
-
],
|
|
18
|
+
], E = [
|
|
19
19
|
"id",
|
|
20
20
|
"aria-selected",
|
|
21
21
|
"aria-disabled",
|
|
22
22
|
"data-active",
|
|
23
23
|
"onPointermove",
|
|
24
24
|
"onClick"
|
|
25
|
-
],
|
|
25
|
+
], D = { key: 0 }, O = {
|
|
26
26
|
key: 1,
|
|
27
27
|
role: "status"
|
|
28
|
-
},
|
|
28
|
+
}, k = {
|
|
29
29
|
key: 0,
|
|
30
30
|
class: "kima-multi-select__clear"
|
|
31
|
-
},
|
|
31
|
+
}, A = [
|
|
32
32
|
"name",
|
|
33
33
|
"required",
|
|
34
34
|
"disabled"
|
|
35
|
-
],
|
|
35
|
+
], j = [
|
|
36
36
|
"value",
|
|
37
37
|
"data-index",
|
|
38
38
|
"disabled",
|
|
39
39
|
"selected"
|
|
40
|
-
],
|
|
40
|
+
], M = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
41
41
|
__name: "multi-select.ce",
|
|
42
42
|
props: {
|
|
43
43
|
modelValue: {
|
|
@@ -78,64 +78,66 @@ var ve = { class: "kima-multi-select__control" }, T = ["aria-activedescendant"],
|
|
|
78
78
|
"update:open",
|
|
79
79
|
"change"
|
|
80
80
|
],
|
|
81
|
-
setup(e, { emit:
|
|
82
|
-
let
|
|
83
|
-
y(null), o(I, () => G.value);
|
|
84
|
-
function q(e) {
|
|
85
|
-
P.disabled || (R(e), F("change", [...e]));
|
|
86
|
-
}
|
|
81
|
+
setup(e, { emit: M }) {
|
|
82
|
+
let N = e, P = M, { root: F, attrs: be, forwardedAttrs: xe } = ne(), [I, L] = a(N, "modelValue", P), [R, Se] = a(N, "open", P), Ce = re(N), z = y(""), B = y(null), V = y(null), H = `kima-multi-select-${se()}`, U = l(() => Array.isArray(I.value) ? I.value : []), W = l(() => N.items.filter((e) => U.value.includes(e.value))), G = l(() => N.items.filter((e) => `${e.label} ${e.description || ""}`.toLocaleLowerCase().includes(z.value.trim().toLocaleLowerCase()))), K = y(null), q = y(null), we = ae(K, () => W.value, q);
|
|
87
83
|
function J(e) {
|
|
88
|
-
|
|
84
|
+
N.disabled || (L(e), P("change", [...e]));
|
|
85
|
+
}
|
|
86
|
+
function Y(e) {
|
|
87
|
+
N.disabled || e.disabled || J(U.value.includes(e.value) ? U.value.filter((t) => !Object.is(t, e.value)) : [...U.value, e.value]);
|
|
89
88
|
}
|
|
90
|
-
function
|
|
91
|
-
e.disabled ||
|
|
89
|
+
function Te(e) {
|
|
90
|
+
e.disabled || J(U.value.filter((t) => !Object.is(t, e.value)));
|
|
92
91
|
}
|
|
93
|
-
function
|
|
94
|
-
|
|
92
|
+
function Ee() {
|
|
93
|
+
J(N.items.filter((e) => e.disabled && U.value.includes(e.value)).map((e) => e.value));
|
|
95
94
|
}
|
|
96
|
-
function
|
|
97
|
-
e &&
|
|
95
|
+
function X(e) {
|
|
96
|
+
e && N.disabled || (e && !R.value && (z.value = ""), Se(e));
|
|
98
97
|
}
|
|
99
|
-
let { active:
|
|
98
|
+
let { active: Z, activeId: Q, highlight: De, keydown: Oe } = ee(G, Y, `${H}-option`);
|
|
100
99
|
function $(e) {
|
|
101
100
|
if (!e.isComposing) {
|
|
102
|
-
if (e.key === " " && !
|
|
101
|
+
if (e.key === " " && !N.searchable) {
|
|
103
102
|
e.preventDefault();
|
|
104
|
-
let t =
|
|
105
|
-
t &&
|
|
106
|
-
} else
|
|
103
|
+
let t = G.value[Z.value];
|
|
104
|
+
t && Y(t);
|
|
105
|
+
} else Oe(e);
|
|
107
106
|
}
|
|
108
107
|
}
|
|
109
|
-
function
|
|
108
|
+
function ke(e) {
|
|
110
109
|
e.preventDefault(), _(() => {
|
|
111
|
-
|
|
110
|
+
R.value && !N.disabled && (N.searchable ? B.value : V.value)?.focus();
|
|
112
111
|
});
|
|
113
112
|
}
|
|
114
|
-
function
|
|
115
|
-
|
|
113
|
+
function Ae(e) {
|
|
114
|
+
J([...e.target.selectedOptions].map((e) => N.items[Number(e.dataset.index)].value));
|
|
116
115
|
}
|
|
117
|
-
return
|
|
118
|
-
e &&
|
|
119
|
-
}), (
|
|
116
|
+
return te(F, I, L, () => X(!1)), le(() => N.disabled, (e) => {
|
|
117
|
+
e && X(!1);
|
|
118
|
+
}), (ee, a) => (v(), f("div", g({
|
|
120
119
|
ref_key: "root",
|
|
121
|
-
ref:
|
|
122
|
-
}, S(
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
120
|
+
ref: F
|
|
121
|
+
}, S(xe), { class: "kima-multi-select" }), [
|
|
122
|
+
p("div", {
|
|
123
|
+
ref_key: "chipArea",
|
|
124
|
+
ref: K,
|
|
125
|
+
class: "kima-multi-select__chip-area"
|
|
126
|
+
}, [h(c, g({
|
|
127
|
+
ref_key: "chips",
|
|
128
|
+
ref: q,
|
|
129
|
+
tag: "div"
|
|
130
|
+
}, S(we), { class: ["kima-multi-select__chips", { "kima-multi-select__chips--populated": W.value.length }] }), {
|
|
131
|
+
default: C(() => [(v(!0), f(o, null, b(W.value, (t) => (v(), f("span", {
|
|
131
132
|
key: t.value,
|
|
133
|
+
"data-kima-flip-key": t.value,
|
|
132
134
|
class: "kima-multi-select__chip"
|
|
133
135
|
}, [h(oe, {
|
|
134
136
|
removable: "",
|
|
135
137
|
label: t.label,
|
|
136
138
|
disabled: e.disabled || t.disabled,
|
|
137
139
|
value: t.value,
|
|
138
|
-
onRemove: (e) =>
|
|
140
|
+
onRemove: (e) => Te(t)
|
|
139
141
|
}, {
|
|
140
142
|
default: C(() => [m(x(t.label), 1)]),
|
|
141
143
|
_: 2
|
|
@@ -144,23 +146,23 @@ var ve = { class: "kima-multi-select__control" }, T = ["aria-activedescendant"],
|
|
|
144
146
|
"disabled",
|
|
145
147
|
"value",
|
|
146
148
|
"onRemove"
|
|
147
|
-
])]))), 128))]),
|
|
149
|
+
])], 8, _e))), 128))]),
|
|
148
150
|
_: 1
|
|
149
|
-
}, 16),
|
|
150
|
-
p("div", ve, [h(S(
|
|
151
|
-
open: S(
|
|
151
|
+
}, 16, ["class"])], 512),
|
|
152
|
+
p("div", ve, [h(S(pe), {
|
|
153
|
+
open: S(R) && !e.disabled,
|
|
152
154
|
modal: !1,
|
|
153
|
-
"onUpdate:open":
|
|
155
|
+
"onUpdate:open": X
|
|
154
156
|
}, {
|
|
155
|
-
default: C(() => [h(S(
|
|
157
|
+
default: C(() => [h(S(me), { "as-child": "" }, {
|
|
156
158
|
default: C(() => [h(t, {
|
|
157
159
|
variant: "tonal",
|
|
158
160
|
disabled: e.disabled,
|
|
159
|
-
"aria-label": S(
|
|
161
|
+
"aria-label": S(be)["aria-label"] || e.label,
|
|
160
162
|
"aria-required": e.required || void 0,
|
|
161
|
-
onKeydown: a[0] ||=
|
|
163
|
+
onKeydown: a[0] ||= de(w((e) => X(!0), ["prevent"]), ["down"])
|
|
162
164
|
}, {
|
|
163
|
-
default: C(() => [m(x(
|
|
165
|
+
default: C(() => [m(x(W.value.length ? `已选择 ${W.value.length} 项` : e.placeholder), 1)]),
|
|
164
166
|
_: 1
|
|
165
167
|
}, 8, [
|
|
166
168
|
"disabled",
|
|
@@ -168,77 +170,77 @@ var ve = { class: "kima-multi-select__control" }, T = ["aria-activedescendant"],
|
|
|
168
170
|
"aria-required"
|
|
169
171
|
])]),
|
|
170
172
|
_: 1
|
|
171
|
-
}), h(
|
|
172
|
-
default: C(() => [S(
|
|
173
|
+
}), h(s, g({ name: "kima-popup" }, S(r)), {
|
|
174
|
+
default: C(() => [S(R) && !e.disabled ? (v(), u(S(fe), g({
|
|
173
175
|
key: 0,
|
|
174
176
|
"force-mount": ""
|
|
175
|
-
}, S(
|
|
177
|
+
}, S(Ce), {
|
|
176
178
|
class: "kima-multi-select__popup",
|
|
177
179
|
"aria-label": e.label,
|
|
178
|
-
onOpenAutoFocus:
|
|
179
|
-
onEscapeKeyDown: a[5] ||= (e) => S(
|
|
180
|
+
onOpenAutoFocus: ke,
|
|
181
|
+
onEscapeKeyDown: a[5] ||= (e) => S(i)(e, () => X(!1))
|
|
180
182
|
}), {
|
|
181
183
|
default: C(() => [
|
|
182
|
-
e.searchable ?
|
|
184
|
+
e.searchable ? ue((v(), f("input", {
|
|
183
185
|
key: 0,
|
|
184
186
|
ref_key: "search",
|
|
185
|
-
ref:
|
|
186
|
-
"onUpdate:modelValue": a[1] ||= (e) =>
|
|
187
|
+
ref: B,
|
|
188
|
+
"onUpdate:modelValue": a[1] ||= (e) => z.value = e,
|
|
187
189
|
class: "kima-multi-select__search",
|
|
188
190
|
type: "search",
|
|
189
191
|
role: "combobox",
|
|
190
192
|
"aria-expanded": "true",
|
|
191
193
|
"aria-autocomplete": "list",
|
|
192
194
|
"aria-label": "搜索选项",
|
|
193
|
-
"aria-controls":
|
|
194
|
-
"aria-activedescendant": S(
|
|
195
|
+
"aria-controls": H,
|
|
196
|
+
"aria-activedescendant": S(Q),
|
|
195
197
|
onKeydown: $,
|
|
196
198
|
onInput: a[2] ||= w(() => {}, ["stop"]),
|
|
197
199
|
onChange: a[3] ||= w(() => {}, ["stop"])
|
|
198
|
-
}, null, 40, T)), [[
|
|
200
|
+
}, null, 40, T)), [[ce, z.value]]) : d("", !0),
|
|
199
201
|
p("div", {
|
|
200
|
-
id:
|
|
202
|
+
id: H,
|
|
201
203
|
ref_key: "panel",
|
|
202
|
-
ref:
|
|
204
|
+
ref: V,
|
|
203
205
|
class: "kima-multi-select__list",
|
|
204
206
|
role: "listbox",
|
|
205
207
|
"aria-multiselectable": "true",
|
|
206
208
|
"aria-label": e.label,
|
|
207
209
|
tabindex: e.searchable ? -1 : 0,
|
|
208
|
-
"aria-activedescendant": e.searchable ? void 0 : S(
|
|
210
|
+
"aria-activedescendant": e.searchable ? void 0 : S(Q),
|
|
209
211
|
onKeydown: $
|
|
210
|
-
}, [(v(!0), f(
|
|
211
|
-
id: `${
|
|
212
|
+
}, [(v(!0), f(o, null, b(G.value, (e, t) => (v(), f("div", {
|
|
213
|
+
id: `${H}-option-${t}`,
|
|
212
214
|
key: e.value,
|
|
213
215
|
class: "kima-multi-select__item",
|
|
214
216
|
role: "option",
|
|
215
|
-
"aria-selected":
|
|
217
|
+
"aria-selected": U.value.includes(e.value),
|
|
216
218
|
"aria-disabled": e.disabled || void 0,
|
|
217
|
-
"data-active": S(
|
|
219
|
+
"data-active": S(Z) === t,
|
|
218
220
|
onPointerdown: a[4] ||= w(() => {}, ["prevent"]),
|
|
219
|
-
onPointermove: (n) => !e.disabled && S(
|
|
220
|
-
onClick: (t) =>
|
|
221
|
-
}, [p("span", null, [m(x(e.label), 1), e.description ? (v(), f("small",
|
|
221
|
+
onPointermove: (n) => !e.disabled && S(De)(t),
|
|
222
|
+
onClick: (t) => Y(e)
|
|
223
|
+
}, [p("span", null, [m(x(e.label), 1), e.description ? (v(), f("small", D, x(e.description), 1)) : d("", !0)]), U.value.includes(e.value) ? (v(), u(n, {
|
|
222
224
|
key: 0,
|
|
223
|
-
icon: S(
|
|
225
|
+
icon: S(ge),
|
|
224
226
|
size: 20,
|
|
225
227
|
"aria-hidden": "true"
|
|
226
|
-
}, null, 8, ["icon"])) : d("", !0)], 40,
|
|
227
|
-
|
|
228
|
+
}, null, 8, ["icon"])) : d("", !0)], 40, E))), 128))], 40, ye),
|
|
229
|
+
G.value.length ? d("", !0) : (v(), f("p", O, "没有匹配选项"))
|
|
228
230
|
]),
|
|
229
231
|
_: 1
|
|
230
232
|
}, 16, ["aria-label"])) : d("", !0)]),
|
|
231
233
|
_: 1
|
|
232
234
|
}, 16)]),
|
|
233
235
|
_: 1
|
|
234
|
-
}, 8, ["open"]), h(
|
|
235
|
-
default: C(() => [e.clearable &&
|
|
236
|
+
}, 8, ["open"]), h(s, g({ name: "kima-content" }, S(r)), {
|
|
237
|
+
default: C(() => [e.clearable && W.value.length ? (v(), f("span", k, [h(ie, {
|
|
236
238
|
label: "清除选择",
|
|
237
239
|
disabled: e.disabled,
|
|
238
|
-
onClick:
|
|
240
|
+
onClick: Ee
|
|
239
241
|
}, {
|
|
240
242
|
default: C(() => [h(n, {
|
|
241
|
-
icon: S(
|
|
243
|
+
icon: S(he),
|
|
242
244
|
size: 20
|
|
243
245
|
}, null, 8, ["icon"])]),
|
|
244
246
|
_: 1
|
|
@@ -254,16 +256,16 @@ var ve = { class: "kima-multi-select__control" }, T = ["aria-activedescendant"],
|
|
|
254
256
|
tabindex: "-1",
|
|
255
257
|
"aria-hidden": "true",
|
|
256
258
|
onInput: a[6] ||= w(() => {}, ["stop"]),
|
|
257
|
-
onChange: w(
|
|
258
|
-
onInvalid: a[7] ||= w((e) => S(
|
|
259
|
-
}, [(v(!0), f(
|
|
259
|
+
onChange: w(Ae, ["stop"]),
|
|
260
|
+
onInvalid: a[7] ||= w((e) => S(F)?.querySelector("button")?.focus(), ["prevent"])
|
|
261
|
+
}, [(v(!0), f(o, null, b(e.items, (e, t) => (v(), f("option", {
|
|
260
262
|
key: e.value,
|
|
261
263
|
value: String(e.value),
|
|
262
264
|
"data-index": t,
|
|
263
265
|
disabled: e.disabled,
|
|
264
|
-
selected:
|
|
265
|
-
}, x(e.label), 9,
|
|
266
|
+
selected: U.value.includes(e.value)
|
|
267
|
+
}, x(e.label), 9, j))), 128))], 40, A)
|
|
266
268
|
], 16));
|
|
267
269
|
}
|
|
268
|
-
}), [["__scopeId", "data-v-
|
|
269
|
-
export {
|
|
270
|
+
}), [["__scopeId", "data-v-0b8ec686"]]);
|
|
271
|
+
export { M as default };
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import e from "../../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import c from "../interaction/chip.ce.js";
|
|
2
|
+
import { useInteractionModel as t, useInteractionReset as n, useInteractionRoot as r } from "../../utils/interaction.js";
|
|
3
|
+
import { useCollectionMotion as i } from "../../utils/content-motion.js";
|
|
4
|
+
import a from "../interaction/chip.ce.js";
|
|
6
5
|
/* empty css */
|
|
7
|
-
import { Fragment as
|
|
6
|
+
import { Fragment as o, TransitionGroup as s, computed as c, createBlock as l, createElementBlock as u, createVNode as d, mergeProps as f, nextTick as p, onMounted as m, openBlock as h, ref as g, renderList as _, unref as v, watch as y, withCtx as b } from "vue";
|
|
8
7
|
// src/components/utility/tag-group.ce.vue
|
|
9
|
-
var
|
|
8
|
+
var x = ["aria-label"], S = [
|
|
10
9
|
"name",
|
|
11
10
|
"value",
|
|
12
11
|
"disabled"
|
|
13
|
-
],
|
|
12
|
+
], C = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
14
13
|
__name: "tag-group.ce",
|
|
15
14
|
props: {
|
|
16
15
|
items: {
|
|
@@ -36,68 +35,62 @@ var w = ["aria-label"], T = [
|
|
|
36
35
|
"change",
|
|
37
36
|
"remove"
|
|
38
37
|
],
|
|
39
|
-
setup(e, { emit:
|
|
40
|
-
let
|
|
38
|
+
setup(e, { emit: C }) {
|
|
39
|
+
let w = e, T = C, { root: E, forwardedAttrs: D } = r(), [O, k] = t(w, "items", T), [A, j] = t(w, "modelValue", T), M = g(0), N = c(() => O.value.map((e) => typeof e == "object" ? e : {
|
|
41
40
|
value: e,
|
|
42
41
|
label: String(e)
|
|
43
|
-
}));
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
function B(e) {
|
|
47
|
-
D.disabled || e.disabled || (P(z(e) ? N.value.filter((t) => t !== e.value) : [...N.value, e.value]), O("change", N.value));
|
|
42
|
+
})), P = g(null), F = i(E, () => N.value, P), I = (e) => A.value.includes(e.value);
|
|
43
|
+
function L(e) {
|
|
44
|
+
w.disabled || e.disabled || (j(I(e) ? A.value.filter((t) => t !== e.value) : [...A.value, e.value]), T("change", A.value));
|
|
48
45
|
}
|
|
49
|
-
function
|
|
50
|
-
return [...
|
|
46
|
+
function R() {
|
|
47
|
+
return [...E.value?.querySelectorAll("button:not(:disabled)") || []].filter((e) => !e.closest("[inert]"));
|
|
51
48
|
}
|
|
52
|
-
async function
|
|
53
|
-
await
|
|
54
|
-
let t =
|
|
55
|
-
|
|
56
|
-
e.tabIndex = t ===
|
|
57
|
-
}), e && t[
|
|
49
|
+
async function z(e = !1) {
|
|
50
|
+
await p();
|
|
51
|
+
let t = R();
|
|
52
|
+
M.value = Math.max(0, Math.min(M.value, t.length - 1)), t.forEach((e, t) => {
|
|
53
|
+
e.tabIndex = t === M.value ? 0 : -1;
|
|
54
|
+
}), e && t[M.value]?.focus();
|
|
58
55
|
}
|
|
59
|
-
function
|
|
60
|
-
|
|
56
|
+
function B(e) {
|
|
57
|
+
w.disabled || e.disabled || (k(O.value.filter((t) => (typeof t == "object" ? t.value : t) !== e.value)), j(A.value.filter((t) => t !== e.value)), T("remove", e), z(!0));
|
|
61
58
|
}
|
|
62
|
-
function
|
|
63
|
-
let t =
|
|
59
|
+
function V(e) {
|
|
60
|
+
let t = R(), n = t.indexOf(e.target);
|
|
64
61
|
if (!(n < 0) && ([
|
|
65
62
|
"ArrowRight",
|
|
66
63
|
"ArrowLeft",
|
|
67
64
|
"Home",
|
|
68
65
|
"End"
|
|
69
|
-
].includes(e.key) && (e.preventDefault(),
|
|
66
|
+
].includes(e.key) && (e.preventDefault(), M.value = e.key === "Home" ? 0 : e.key === "End" ? t.length - 1 : (n + (e.key === "ArrowLeft" ? -1 : 1) + t.length) % t.length, z(!0)), ["Delete", "Backspace"].includes(e.key) && w.removable)) {
|
|
70
67
|
let t = e.target.closest("[data-tag-index]")?.dataset.tagIndex;
|
|
71
|
-
t != null && (e.preventDefault(),
|
|
68
|
+
t != null && (e.preventDefault(), B(N.value[Number(t)]));
|
|
72
69
|
}
|
|
73
70
|
}
|
|
74
|
-
return
|
|
75
|
-
|
|
76
|
-
() =>
|
|
77
|
-
() =>
|
|
78
|
-
() =>
|
|
79
|
-
], () =>
|
|
71
|
+
return y([
|
|
72
|
+
N,
|
|
73
|
+
() => w.disabled,
|
|
74
|
+
() => w.selectable,
|
|
75
|
+
() => w.removable
|
|
76
|
+
], () => z(), {
|
|
80
77
|
immediate: !0,
|
|
81
78
|
flush: "post"
|
|
82
|
-
}),
|
|
79
|
+
}), m(() => z()), n(E, A, j), n(E, O, k), (t, n) => (h(), u("div", f({
|
|
83
80
|
ref_key: "root",
|
|
84
|
-
ref:
|
|
85
|
-
},
|
|
81
|
+
ref: E
|
|
82
|
+
}, v(D), {
|
|
86
83
|
class: "kima-tag-group",
|
|
87
84
|
role: "group",
|
|
88
85
|
"aria-label": e.label,
|
|
89
|
-
onKeydown:
|
|
90
|
-
}), [
|
|
86
|
+
onKeydown: V
|
|
87
|
+
}), [d(s, f({
|
|
91
88
|
ref_key: "flipRoot",
|
|
92
|
-
ref:
|
|
93
|
-
name: "kima-list",
|
|
89
|
+
ref: P,
|
|
94
90
|
tag: "div",
|
|
95
91
|
class: "kima-tag-group__items"
|
|
96
|
-
}, {
|
|
97
|
-
|
|
98
|
-
onBeforeLeave: x(t)
|
|
99
|
-
}), {
|
|
100
|
-
default: C(() => [(v(!0), p(l, null, b(I.value, (t, n) => (v(), f(c, {
|
|
92
|
+
}, v(F)), {
|
|
93
|
+
default: b(() => [(h(!0), u(o, null, _(N.value, (t, n) => (h(), l(a, {
|
|
101
94
|
key: t.value,
|
|
102
95
|
"data-kima-flip-key": t.value,
|
|
103
96
|
"data-tag-index": n,
|
|
@@ -106,9 +99,9 @@ var w = ["aria-label"], T = [
|
|
|
106
99
|
selectable: e.selectable,
|
|
107
100
|
removable: e.removable,
|
|
108
101
|
disabled: e.disabled || t.disabled,
|
|
109
|
-
"model-value":
|
|
110
|
-
onChange: (e) =>
|
|
111
|
-
onRemove: (e) =>
|
|
102
|
+
"model-value": I(t),
|
|
103
|
+
onChange: (e) => L(t),
|
|
104
|
+
onRemove: (e) => B(t)
|
|
112
105
|
}, null, 8, [
|
|
113
106
|
"data-kima-flip-key",
|
|
114
107
|
"data-tag-index",
|
|
@@ -122,13 +115,13 @@ var w = ["aria-label"], T = [
|
|
|
122
115
|
"onRemove"
|
|
123
116
|
]))), 128))]),
|
|
124
117
|
_: 1
|
|
125
|
-
}, 16), (
|
|
118
|
+
}, 16), (h(!0), u(o, null, _(v(A), (t) => (h(), u("input", {
|
|
126
119
|
key: t,
|
|
127
120
|
type: "hidden",
|
|
128
121
|
name: e.name,
|
|
129
122
|
value: t,
|
|
130
123
|
disabled: e.disabled
|
|
131
|
-
}, null, 8,
|
|
124
|
+
}, null, 8, S))), 128))], 16, x));
|
|
132
125
|
}
|
|
133
|
-
}), [["__scopeId", "data-v-
|
|
134
|
-
export {
|
|
126
|
+
}), [["__scopeId", "data-v-de9894bd"]]);
|
|
127
|
+
export { C as default };
|
|
@@ -1,72 +1,104 @@
|
|
|
1
|
-
import { prefersReducedMotion as e } from "./motion.js";
|
|
2
|
-
import { nextTick as
|
|
1
|
+
import { prefersReducedMotion as e, useLayoutFlip as t } from "./motion.js";
|
|
2
|
+
import { nextTick as n, onBeforeUnmount as r, watch as i } from "vue";
|
|
3
3
|
// src/utils/content-motion.js
|
|
4
|
-
function
|
|
4
|
+
function a(e, n, r = e) {
|
|
5
|
+
s(e, n, { collection: !0 });
|
|
6
|
+
let i = t(r, n);
|
|
7
|
+
return {
|
|
8
|
+
name: "kima-collection",
|
|
9
|
+
moveClass: "kima-collection-no-move",
|
|
10
|
+
onBeforeLeave: i.beforeLeave,
|
|
11
|
+
onBeforeEnter: i.beforeEnter,
|
|
12
|
+
onLeaveCancelled: i.leaveCancelled
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function o(e) {
|
|
5
16
|
let t = e?.value;
|
|
6
17
|
return t?.nodeType === 1 ? t : t?.$el?.nodeType === 1 ? t.$el : null;
|
|
7
18
|
}
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
19
|
+
function s(t, a, { opacity: s = !0, collection: c = !1 } = {}) {
|
|
20
|
+
c && (s = !1);
|
|
21
|
+
let l = c ? "visible" : "clip", u, d = !1, f = 0, p = 0, m = 1, h = !1, g;
|
|
22
|
+
function _(e) {
|
|
23
|
+
g && (e.style.height = g.height, e.style.overflow = g.overflow, e.style.boxSizing = g.boxSizing, s && (e.style.opacity = g.opacity), g = void 0, h = !1);
|
|
12
24
|
}
|
|
13
|
-
|
|
14
|
-
let e =
|
|
25
|
+
i(a, () => {
|
|
26
|
+
let e = o(t);
|
|
15
27
|
if (!e) {
|
|
16
|
-
|
|
28
|
+
p = 0;
|
|
17
29
|
return;
|
|
18
30
|
}
|
|
19
|
-
let
|
|
20
|
-
|
|
31
|
+
let n = e.ownerDocument.defaultView, r = e.getBoundingClientRect();
|
|
32
|
+
p = r.height > 0 ? r.height : 0, m = s ? Number(n.getComputedStyle(e).opacity) : 1, u && (g ??= {
|
|
21
33
|
height: e.style.height,
|
|
22
34
|
overflow: e.style.overflow,
|
|
23
35
|
boxSizing: e.style.boxSizing,
|
|
24
36
|
opacity: e.style.opacity
|
|
25
|
-
},
|
|
26
|
-
}, {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
}, u.cancel(), u = void 0, e.style.height = `${p}px`, e.style.boxSizing = "border-box", e.style.overflow = l, s && (e.style.opacity = `${m}`), h = !0);
|
|
38
|
+
}, {
|
|
39
|
+
flush: "pre",
|
|
40
|
+
deep: !0
|
|
41
|
+
}), i(a, async () => {
|
|
42
|
+
let r = ++f;
|
|
43
|
+
if (await n(), d || r !== f) return;
|
|
44
|
+
let i = o(t), a = i?.ownerDocument.defaultView;
|
|
45
|
+
if (!i || e(i) || !i.animate) {
|
|
46
|
+
i && g && _(i);
|
|
32
47
|
return;
|
|
33
48
|
}
|
|
34
|
-
let
|
|
35
|
-
if (!Number.isFinite(
|
|
36
|
-
|
|
49
|
+
let v = a.getComputedStyle(i), y = v.getPropertyValue(c ? "--kima-duration-slow" : "--kima-duration-effects").trim(), b = y ? parseFloat(y) * (y.endsWith("ms") ? 1 : 1e3) : 180;
|
|
50
|
+
if (!Number.isFinite(b) || b <= 0) {
|
|
51
|
+
_(i);
|
|
37
52
|
return;
|
|
38
53
|
}
|
|
39
|
-
|
|
40
|
-
let
|
|
41
|
-
if (!
|
|
42
|
-
|
|
54
|
+
h && (i.style.height = g.height, i.style.boxSizing = g.boxSizing);
|
|
55
|
+
let x = i.getBoundingClientRect().height, S = (c || p > 0) && Math.abs(x - p) > 1;
|
|
56
|
+
if (!S && !s) {
|
|
57
|
+
_(i);
|
|
43
58
|
return;
|
|
44
59
|
}
|
|
45
|
-
|
|
46
|
-
height:
|
|
47
|
-
overflow:
|
|
48
|
-
boxSizing:
|
|
49
|
-
opacity:
|
|
50
|
-
},
|
|
51
|
-
let
|
|
52
|
-
s && (
|
|
53
|
-
let
|
|
54
|
-
|
|
55
|
-
|
|
60
|
+
g ??= {
|
|
61
|
+
height: i.style.height,
|
|
62
|
+
overflow: i.style.overflow,
|
|
63
|
+
boxSizing: i.style.boxSizing,
|
|
64
|
+
opacity: i.style.opacity
|
|
65
|
+
}, S && (i.style.height = `${p}px`, i.style.boxSizing = "border-box", i.style.overflow = l);
|
|
66
|
+
let C = s ? m : 1;
|
|
67
|
+
s && (i.style.opacity = `${C}`);
|
|
68
|
+
let w = v.getPropertyValue("--kima-curve-emphasized").trim() || "ease-out", T = S && c ? [
|
|
69
|
+
{
|
|
70
|
+
height: `${p}px`,
|
|
71
|
+
offset: 0,
|
|
72
|
+
easing: w
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
height: `${x > p ? x : p}px`,
|
|
76
|
+
offset: .5,
|
|
77
|
+
easing: w
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
height: `${x}px`,
|
|
81
|
+
offset: 1
|
|
82
|
+
}
|
|
83
|
+
] : S ? [{
|
|
84
|
+
height: `${p}px`,
|
|
85
|
+
opacity: C
|
|
56
86
|
}, {
|
|
57
|
-
height: `${
|
|
87
|
+
height: `${x}px`,
|
|
58
88
|
opacity: 1
|
|
59
|
-
}] : [{ opacity:
|
|
60
|
-
duration:
|
|
61
|
-
|
|
89
|
+
}] : [{ opacity: C }, { opacity: 1 }], E = c ? v.getPropertyValue("--kima-duration-fast").trim() : "", D = E ? parseFloat(E) * (E.endsWith("ms") ? 1 : 1e3) : 0, O = i.animate(T, {
|
|
90
|
+
duration: b,
|
|
91
|
+
delay: Number.isFinite(D) ? Math.max(0, D) : 0,
|
|
92
|
+
easing: c ? "linear" : w,
|
|
93
|
+
fill: "both"
|
|
62
94
|
});
|
|
63
|
-
|
|
64
|
-
|
|
95
|
+
u = O, O.finished.then(() => {
|
|
96
|
+
u === O && (u = void 0, _(i), O.cancel());
|
|
65
97
|
}).catch(() => {});
|
|
66
|
-
}, { deep: !0 }),
|
|
67
|
-
|
|
68
|
-
let e =
|
|
69
|
-
|
|
98
|
+
}, { deep: !0 }), r(() => {
|
|
99
|
+
d = !0, f++;
|
|
100
|
+
let e = o(t);
|
|
101
|
+
u?.cancel(), u = void 0, e && _(e);
|
|
70
102
|
});
|
|
71
103
|
}
|
|
72
|
-
export { a as useContentMotion };
|
|
104
|
+
export { a as useCollectionMotion, s as useContentMotion };
|