@indielayer/ui 1.7.2 → 1.7.4
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/docs/pages/component/modal/composed.vue +1 -0
- package/docs/pages/component/modal/usage.vue +9 -6
- package/lib/components/modal/Modal.vue.js +52 -49
- package/lib/components/modal/theme/Modal.base.theme.js +4 -4
- package/lib/components/modal/theme/Modal.carbon.theme.js +12 -12
- package/lib/components/select/Select.vue.js +129 -127
- package/lib/index.umd.js +3 -3
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/src/components/modal/Modal.vue +4 -1
- package/src/components/modal/theme/Modal.base.theme.ts +2 -1
- package/src/components/modal/theme/Modal.carbon.theme.ts +1 -0
- package/src/components/select/Select.vue +6 -3
- package/src/version.ts +1 -1
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
import { defineComponent as pe, ref as
|
|
1
|
+
import { defineComponent as pe, ref as g, computed as w, watch as O, nextTick as X, unref as s, onUnmounted as ve, openBlock as n, createBlock as c, mergeProps as H, toHandlers as K, withCtx as h, createElementVNode as _, createElementBlock as a, normalizeClass as A, Fragment as p, renderList as $, createTextVNode as C, toDisplayString as m, createVNode as W, withDirectives as ce, vModelSelect as me, renderSlot as ye, createCommentVNode as be } from "vue";
|
|
2
2
|
import { useEventListener as he } from "../../node_modules/.pnpm/@vueuse_core@10.2.0_vue@3.3.9/node_modules/@vueuse/core/index.js";
|
|
3
|
-
import { useColors as
|
|
4
|
-
import { useCommon as
|
|
3
|
+
import { useColors as ke } from "../../composables/useColors.js";
|
|
4
|
+
import { useCommon as J } from "../../composables/useCommon.js";
|
|
5
5
|
import { useInputtable as D } from "../../composables/useInputtable.js";
|
|
6
|
-
import { useInteractive as
|
|
7
|
-
import { useTheme as
|
|
8
|
-
import { checkIcon as
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
6
|
+
import { useInteractive as Q } from "../../composables/useInteractive.js";
|
|
7
|
+
import { useTheme as ge } from "../../composables/useTheme.js";
|
|
8
|
+
import { checkIcon as we, selectIcon as Ae } from "../../common/icons.js";
|
|
9
|
+
import Ie from "../label/Label.vue.js";
|
|
10
|
+
import G from "../tag/Tag.vue.js";
|
|
11
|
+
import Re from "../icon/Icon.vue.js";
|
|
12
|
+
import Ve from "../menu/MenuItem.vue.js";
|
|
13
|
+
import _e from "../spinner/Spinner.vue.js";
|
|
14
|
+
import $e from "../popover/Popover.vue.js";
|
|
15
15
|
import "../popover/Popover.vue3.js";
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
const
|
|
16
|
+
import Ce from "../popover/PopoverContainer.vue.js";
|
|
17
|
+
import ze from "../inputFooter/InputFooter.vue.js";
|
|
18
|
+
const Se = { class: "relative" }, Ne = {
|
|
19
19
|
key: 0,
|
|
20
20
|
class: "flex gap-1 flex-wrap"
|
|
21
|
-
},
|
|
21
|
+
}, Oe = {
|
|
22
22
|
key: 0,
|
|
23
23
|
class: "text-secondary-400 dark:text-secondary-500"
|
|
24
|
-
},
|
|
24
|
+
}, De = { key: 1 }, Le = {
|
|
25
25
|
key: 0,
|
|
26
26
|
class: "flex gap-1 flex-wrap"
|
|
27
|
-
},
|
|
27
|
+
}, Be = {
|
|
28
28
|
key: 0,
|
|
29
29
|
class: "text-secondary-400 dark:text-secondary-500"
|
|
30
|
-
},
|
|
30
|
+
}, Ee = { key: 1 }, Te = {
|
|
31
31
|
key: 1,
|
|
32
32
|
class: "px-2 text-center text-secondary-400"
|
|
33
|
-
},
|
|
34
|
-
...
|
|
35
|
-
...G.props(),
|
|
33
|
+
}, Fe = ["id", "name", "disabled", "multiple", "readonly"], Pe = ["value", "disabled"], qe = {
|
|
34
|
+
...ke.props("primary"),
|
|
36
35
|
...J.props(),
|
|
36
|
+
...Q.props(),
|
|
37
37
|
...D.props(),
|
|
38
38
|
placeholder: String,
|
|
39
39
|
options: Array,
|
|
40
40
|
multiple: Boolean,
|
|
41
41
|
flat: Boolean,
|
|
42
42
|
native: Boolean
|
|
43
|
-
},
|
|
43
|
+
}, Ue = {
|
|
44
44
|
name: "XSelect",
|
|
45
45
|
validators: {
|
|
46
|
-
...
|
|
46
|
+
...J.validators()
|
|
47
47
|
}
|
|
48
48
|
}, nl = /* @__PURE__ */ pe({
|
|
49
|
-
...
|
|
50
|
-
props:
|
|
49
|
+
...Ue,
|
|
50
|
+
props: qe,
|
|
51
51
|
emits: D.emits(),
|
|
52
|
-
setup(
|
|
53
|
-
const r =
|
|
52
|
+
setup(Y, { expose: Z, emit: ee }) {
|
|
53
|
+
const r = Y, I = ee, z = g(null), S = g(null), R = g(null), f = g(null), u = g(), t = w({
|
|
54
54
|
get() {
|
|
55
55
|
return r.multiple ? r.modelValue ? Array.isArray(r.modelValue) ? r.modelValue : [r.modelValue] : [] : r.modelValue;
|
|
56
56
|
},
|
|
57
57
|
set(e) {
|
|
58
|
-
|
|
58
|
+
I("update:modelValue", e);
|
|
59
59
|
}
|
|
60
|
-
}), d =
|
|
60
|
+
}), d = w(() => !r.options || r.options.length === 0 ? [] : r.options.map((e) => {
|
|
61
61
|
let i = !1;
|
|
62
62
|
return r.multiple && Array.isArray(t.value) ? i = t.value.includes(e.value) : i = e.value === t.value, {
|
|
63
63
|
value: e.value,
|
|
64
64
|
label: e.label,
|
|
65
65
|
active: i,
|
|
66
66
|
disabled: e.disabled,
|
|
67
|
-
iconRight: i ?
|
|
68
|
-
onClick: () =>
|
|
67
|
+
iconRight: i ? we : void 0,
|
|
68
|
+
onClick: () => E(e.value)
|
|
69
69
|
};
|
|
70
|
-
})), L =
|
|
70
|
+
})), L = w(() => {
|
|
71
71
|
var e;
|
|
72
72
|
return (e = r.options) == null ? void 0 : e.filter((i) => !i.disabled);
|
|
73
|
-
}), y =
|
|
73
|
+
}), y = w(() => {
|
|
74
74
|
var e;
|
|
75
75
|
return (e = f.value) == null ? void 0 : e.isOpen;
|
|
76
76
|
});
|
|
77
77
|
O(y, (e) => {
|
|
78
|
-
e && (
|
|
78
|
+
e && (le(), setTimeout(() => {
|
|
79
79
|
B(u.value || 0);
|
|
80
80
|
}, 50), (r.multiple || typeof u.value > "u") && N(-1));
|
|
81
81
|
});
|
|
82
|
-
function
|
|
82
|
+
function le() {
|
|
83
83
|
if (r.multiple) {
|
|
84
84
|
if (Array.isArray(t.value) && t.value.length > 0) {
|
|
85
85
|
const e = d.value.findIndex((i) => i.value === t.value[0]);
|
|
@@ -92,10 +92,10 @@ const Ee = { class: "relative" }, ze = {
|
|
|
92
92
|
}
|
|
93
93
|
function B(e) {
|
|
94
94
|
var i;
|
|
95
|
-
|
|
95
|
+
R.value && ((i = R.value[e]) == null || i.$el.scrollIntoView({ block: "nearest", inline: "nearest" }));
|
|
96
96
|
}
|
|
97
97
|
O(u, (e) => {
|
|
98
|
-
typeof e < "u" &&
|
|
98
|
+
typeof e < "u" && R.value && B(e);
|
|
99
99
|
});
|
|
100
100
|
function N(e, i = "down") {
|
|
101
101
|
if (!L.value || L.value.length === 0) {
|
|
@@ -114,61 +114,63 @@ const Ee = { class: "relative" }, ze = {
|
|
|
114
114
|
u.value = l;
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function E(e) {
|
|
118
118
|
var l;
|
|
119
|
-
const i = (l = r.options) == null ? void 0 : l.find((
|
|
119
|
+
const i = (l = r.options) == null ? void 0 : l.find((o) => o.value === e);
|
|
120
120
|
if (!(!i || i.disabled)) {
|
|
121
121
|
if (r.multiple)
|
|
122
122
|
if (Array.isArray(t.value)) {
|
|
123
|
-
const
|
|
124
|
-
|
|
123
|
+
const o = t.value.indexOf(e);
|
|
124
|
+
o !== -1 ? t.value.splice(o, 1) : (t.value.push(e), I("update:modelValue", t.value));
|
|
125
125
|
} else
|
|
126
126
|
t.value = [e];
|
|
127
127
|
else
|
|
128
128
|
t.value = e;
|
|
129
|
-
r.native ||
|
|
130
|
-
var
|
|
131
|
-
(
|
|
129
|
+
r.native || X(() => {
|
|
130
|
+
var o;
|
|
131
|
+
j(), (o = S.value) == null || o.$el.focus();
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function T(e) {
|
|
136
136
|
return !!(typeof e > "u" || e === null || e === "" || Array.isArray(e) && e.length === 0 || !Array.isArray(e) && typeof e == "object" && Object.keys(e).length === 0);
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function F(e, i) {
|
|
139
139
|
e.stopPropagation();
|
|
140
140
|
const l = t.value.indexOf(i);
|
|
141
|
-
l !== -1 && (t.value.splice(l, 1),
|
|
141
|
+
l !== -1 && (t.value.splice(l, 1), I("update:modelValue", t.value));
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function V(e) {
|
|
144
144
|
var l;
|
|
145
|
-
const i = (l = r.options) == null ? void 0 : l.find((
|
|
145
|
+
const i = (l = r.options) == null ? void 0 : l.find((o) => o.value === e);
|
|
146
146
|
return i ? i.label : "";
|
|
147
147
|
}
|
|
148
|
-
const { focus:
|
|
149
|
-
errorInternal:
|
|
150
|
-
hideFooterInternal:
|
|
151
|
-
inputListeners:
|
|
152
|
-
reset:
|
|
153
|
-
validate:
|
|
154
|
-
setError:
|
|
148
|
+
const { focus: P, blur: ie } = Q(z), {
|
|
149
|
+
errorInternal: q,
|
|
150
|
+
hideFooterInternal: te,
|
|
151
|
+
inputListeners: U,
|
|
152
|
+
reset: oe,
|
|
153
|
+
validate: j,
|
|
154
|
+
setError: ne,
|
|
155
155
|
isFocused: re,
|
|
156
156
|
isInsideForm: ae
|
|
157
|
-
} = D(r, { focus:
|
|
158
|
-
const { focus: e, blur: i } = s(
|
|
157
|
+
} = D(r, { focus: P, emit: I, withListeners: !0 }), se = w(() => {
|
|
158
|
+
const { focus: e, blur: i } = s(U);
|
|
159
159
|
return {
|
|
160
160
|
focus: e,
|
|
161
161
|
blur: i
|
|
162
162
|
};
|
|
163
163
|
});
|
|
164
|
-
let
|
|
164
|
+
let v = null;
|
|
165
165
|
O([re, y], ([e, i]) => {
|
|
166
|
-
e || i ?
|
|
166
|
+
e || i ? v || (v = he(document, "keydown", ue)) : v && (v(), v = null);
|
|
167
167
|
}, {
|
|
168
168
|
immediate: !0
|
|
169
|
+
}), ve(() => {
|
|
170
|
+
v && v();
|
|
169
171
|
});
|
|
170
172
|
function ue(e) {
|
|
171
|
-
var i, l,
|
|
173
|
+
var i, l, o, k, x;
|
|
172
174
|
if (d.value.length !== 0)
|
|
173
175
|
if (e.code === "ArrowDown") {
|
|
174
176
|
if (e.preventDefault(), !y.value) {
|
|
@@ -184,24 +186,24 @@ const Ee = { class: "relative" }, ze = {
|
|
|
184
186
|
N(u.value, "up");
|
|
185
187
|
} else if (e.code === "Enter" || e.code === "Space") {
|
|
186
188
|
if (e.preventDefault(), e.stopPropagation(), !y.value) {
|
|
187
|
-
(
|
|
189
|
+
(o = f.value) == null || o.show();
|
|
188
190
|
return;
|
|
189
191
|
}
|
|
190
|
-
typeof u.value < "u" && (
|
|
192
|
+
typeof u.value < "u" && (E(d.value[u.value].value), r.multiple || (k = f.value) == null || k.hide());
|
|
191
193
|
} else
|
|
192
|
-
e.code === "Tab" && y.value && (e.preventDefault(), (
|
|
194
|
+
e.code === "Tab" && y.value && (e.preventDefault(), (x = f.value) == null || x.hide(), r.native || X(() => {
|
|
193
195
|
var M;
|
|
194
196
|
(M = S.value) == null || M.$el.focus();
|
|
195
197
|
}));
|
|
196
198
|
}
|
|
197
|
-
const { styles: de, classes:
|
|
198
|
-
return
|
|
199
|
+
const { styles: de, classes: b, className: fe } = ge("Select", {}, r, { errorInternal: q });
|
|
200
|
+
return Z({ focus: P, blur: ie, reset: oe, validate: j, setError: ne }), (e, i) => (n(), c(Ie, H({
|
|
199
201
|
ref_key: "labelRef",
|
|
200
202
|
ref: S,
|
|
201
203
|
tabindex: "0",
|
|
202
204
|
class: ["group", [
|
|
203
205
|
s(fe),
|
|
204
|
-
s(
|
|
206
|
+
s(b).wrapper
|
|
205
207
|
]],
|
|
206
208
|
style: s(de),
|
|
207
209
|
disabled: e.disabled,
|
|
@@ -209,100 +211,100 @@ const Ee = { class: "relative" }, ze = {
|
|
|
209
211
|
"is-inside-form": s(ae),
|
|
210
212
|
label: e.label,
|
|
211
213
|
tooltip: e.tooltip
|
|
212
|
-
},
|
|
213
|
-
default:
|
|
214
|
-
|
|
215
|
-
e.native && !e.multiple ? (
|
|
214
|
+
}, K(se.value)), {
|
|
215
|
+
default: h(() => [
|
|
216
|
+
_("div", Se, [
|
|
217
|
+
e.native && !e.multiple ? (n(), a("div", {
|
|
216
218
|
key: 0,
|
|
217
|
-
class:
|
|
219
|
+
class: A(s(b).box),
|
|
218
220
|
onClick: i[0] || (i[0] = (l) => {
|
|
219
|
-
var
|
|
220
|
-
return (
|
|
221
|
+
var o;
|
|
222
|
+
return (o = z.value) == null ? void 0 : o.click();
|
|
221
223
|
})
|
|
222
224
|
}, [
|
|
223
|
-
e.multiple && Array.isArray(t.value) && t.value.length > 0 ? (
|
|
224
|
-
(
|
|
225
|
+
e.multiple && Array.isArray(t.value) && t.value.length > 0 ? (n(), a("div", Ne, [
|
|
226
|
+
(n(!0), a(p, null, $(t.value, (l) => (n(), c(G, {
|
|
225
227
|
key: l,
|
|
226
228
|
size: "xs",
|
|
227
229
|
outlined: "",
|
|
228
230
|
removable: "",
|
|
229
|
-
onRemove: (
|
|
230
|
-
|
|
231
|
+
onRemove: (o) => {
|
|
232
|
+
F(o, l);
|
|
231
233
|
}
|
|
232
234
|
}, {
|
|
233
|
-
default:
|
|
234
|
-
|
|
235
|
+
default: h(() => [
|
|
236
|
+
C(m(V(l)), 1)
|
|
235
237
|
]),
|
|
236
238
|
_: 2
|
|
237
239
|
}, 1032, ["onRemove"]))), 128))
|
|
238
|
-
])) : !e.multiple && !
|
|
239
|
-
|
|
240
|
-
], 64)) : (
|
|
241
|
-
e.placeholder ? (
|
|
240
|
+
])) : !e.multiple && !T(t.value) ? (n(), a(p, { key: 1 }, [
|
|
241
|
+
C(m(V(t.value)), 1)
|
|
242
|
+
], 64)) : (n(), a(p, { key: 2 }, [
|
|
243
|
+
e.placeholder ? (n(), a("div", Oe, m(e.placeholder), 1)) : (n(), a("div", De, " "))
|
|
242
244
|
], 64))
|
|
243
|
-
], 2)) : (
|
|
245
|
+
], 2)) : (n(), c($e, {
|
|
244
246
|
key: 1,
|
|
245
247
|
ref_key: "popoverRef",
|
|
246
248
|
ref: f,
|
|
247
249
|
disabled: e.disabled || e.loading || e.readonly
|
|
248
250
|
}, {
|
|
249
|
-
content:
|
|
250
|
-
|
|
251
|
-
class:
|
|
251
|
+
content: h(() => [
|
|
252
|
+
W(Ce, {
|
|
253
|
+
class: A(s(b).content)
|
|
252
254
|
}, {
|
|
253
|
-
default:
|
|
254
|
-
d.value.length > 0 ? (
|
|
255
|
-
key:
|
|
255
|
+
default: h(() => [
|
|
256
|
+
d.value.length > 0 ? (n(!0), a(p, { key: 0 }, $(d.value, (l, o) => (n(), c(Ve, {
|
|
257
|
+
key: o,
|
|
256
258
|
ref_for: !0,
|
|
257
259
|
ref_key: "itemsRef",
|
|
258
|
-
ref:
|
|
260
|
+
ref: R,
|
|
259
261
|
item: l,
|
|
260
262
|
size: e.size,
|
|
261
263
|
disabled: l.disabled,
|
|
262
|
-
selected:
|
|
264
|
+
selected: o === u.value,
|
|
263
265
|
color: e.color,
|
|
264
266
|
filled: "",
|
|
265
267
|
onClick: i[1] || (i[1] = () => {
|
|
266
|
-
var
|
|
267
|
-
return !e.multiple && ((
|
|
268
|
+
var k;
|
|
269
|
+
return !e.multiple && ((k = f.value) == null ? void 0 : k.hide());
|
|
268
270
|
})
|
|
269
|
-
}, null, 8, ["item", "size", "disabled", "selected", "color"]))), 128)) : (
|
|
271
|
+
}, null, 8, ["item", "size", "disabled", "selected", "color"]))), 128)) : (n(), a("div", Te, " No options "))
|
|
270
272
|
]),
|
|
271
273
|
_: 1
|
|
272
274
|
}, 8, ["class"])
|
|
273
275
|
]),
|
|
274
|
-
default:
|
|
275
|
-
|
|
276
|
-
class:
|
|
276
|
+
default: h(() => [
|
|
277
|
+
_("div", {
|
|
278
|
+
class: A([s(b).box])
|
|
277
279
|
}, [
|
|
278
|
-
e.multiple && Array.isArray(t.value) && t.value.length > 0 ? (
|
|
279
|
-
(
|
|
280
|
+
e.multiple && Array.isArray(t.value) && t.value.length > 0 ? (n(), a("div", Le, [
|
|
281
|
+
(n(!0), a(p, null, $(t.value, (l) => (n(), c(G, {
|
|
280
282
|
key: l,
|
|
281
283
|
size: "xs",
|
|
282
284
|
outlined: "",
|
|
283
285
|
removable: "",
|
|
284
|
-
onRemove: (
|
|
285
|
-
|
|
286
|
+
onRemove: (o) => {
|
|
287
|
+
F(o, l);
|
|
286
288
|
}
|
|
287
289
|
}, {
|
|
288
|
-
default:
|
|
289
|
-
|
|
290
|
+
default: h(() => [
|
|
291
|
+
C(m(V(l)), 1)
|
|
290
292
|
]),
|
|
291
293
|
_: 2
|
|
292
294
|
}, 1032, ["onRemove"]))), 128))
|
|
293
|
-
])) : !e.multiple && !
|
|
294
|
-
|
|
295
|
-
], 64)) : (
|
|
296
|
-
e.placeholder ? (
|
|
295
|
+
])) : !e.multiple && !T(t.value) ? (n(), a(p, { key: 1 }, [
|
|
296
|
+
C(m(V(t.value)), 1)
|
|
297
|
+
], 64)) : (n(), a(p, { key: 2 }, [
|
|
298
|
+
e.placeholder ? (n(), a("div", Be, m(e.placeholder), 1)) : (n(), a("div", Ee, " "))
|
|
297
299
|
], 64))
|
|
298
300
|
], 2)
|
|
299
301
|
]),
|
|
300
302
|
_: 1
|
|
301
303
|
}, 8, ["disabled"])),
|
|
302
|
-
|
|
304
|
+
ce(_("select", H({
|
|
303
305
|
id: e.id,
|
|
304
306
|
ref_key: "elRef",
|
|
305
|
-
ref:
|
|
307
|
+
ref: z,
|
|
306
308
|
"onUpdate:modelValue": i[2] || (i[2] = (l) => t.value = l),
|
|
307
309
|
tabindex: "-1",
|
|
308
310
|
class: e.native && !e.multiple ? "absolute inset-0 w-full h-full cursor-pointer opacity-0" : "hidden",
|
|
@@ -310,32 +312,32 @@ const Ee = { class: "relative" }, ze = {
|
|
|
310
312
|
disabled: e.disabled || e.loading,
|
|
311
313
|
multiple: e.multiple,
|
|
312
314
|
readonly: e.readonly
|
|
313
|
-
},
|
|
314
|
-
(
|
|
315
|
-
key:
|
|
315
|
+
}, K(s(U), !0)), [
|
|
316
|
+
(n(!0), a(p, null, $(e.options, (l, o) => (n(), a("option", {
|
|
317
|
+
key: o,
|
|
316
318
|
value: l.value,
|
|
317
319
|
disabled: l.disabled
|
|
318
|
-
}, m(l.label), 9,
|
|
319
|
-
], 16,
|
|
320
|
-
[
|
|
320
|
+
}, m(l.label), 9, Pe))), 128))
|
|
321
|
+
], 16, Fe), [
|
|
322
|
+
[me, t.value]
|
|
321
323
|
]),
|
|
322
|
-
|
|
323
|
-
class:
|
|
324
|
+
_("div", {
|
|
325
|
+
class: A(s(b).iconWrapper)
|
|
324
326
|
}, [
|
|
325
|
-
e.loading ? (
|
|
327
|
+
e.loading ? (n(), c(_e, {
|
|
326
328
|
key: 0,
|
|
327
329
|
size: e.size
|
|
328
|
-
}, null, 8, ["size"])) :
|
|
329
|
-
|
|
330
|
-
icon: s(
|
|
331
|
-
class:
|
|
330
|
+
}, null, 8, ["size"])) : ye(e.$slots, "icon", { key: 1 }, () => [
|
|
331
|
+
W(Re, {
|
|
332
|
+
icon: s(Ae),
|
|
333
|
+
class: A([s(b).icon])
|
|
332
334
|
}, null, 8, ["icon", "class"])
|
|
333
335
|
])
|
|
334
336
|
], 2)
|
|
335
337
|
]),
|
|
336
|
-
s(
|
|
338
|
+
s(te) ? be("", !0) : (n(), c(ze, {
|
|
337
339
|
key: 0,
|
|
338
|
-
error: s(
|
|
340
|
+
error: s(q),
|
|
339
341
|
helper: e.helper
|
|
340
342
|
}, null, 8, ["error", "helper"]))
|
|
341
343
|
]),
|