@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.
@@ -1,85 +1,85 @@
1
- import { defineComponent as pe, ref as A, computed as I, watch as O, nextTick as U, unref as s, openBlock as o, createBlock as c, mergeProps as X, toHandlers as H, withCtx as b, createElementVNode as C, createElementBlock as a, normalizeClass as R, Fragment as v, renderList as E, createTextVNode as z, toDisplayString as m, createVNode as K, withDirectives as ve, vModelSelect as ce, renderSlot as me, createCommentVNode as ye } from "vue";
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 be } from "../../composables/useColors.js";
4
- import { useCommon as G } from "../../composables/useCommon.js";
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 J } from "../../composables/useInteractive.js";
7
- import { useTheme as ke } from "../../composables/useTheme.js";
8
- import { checkIcon as ge, selectIcon as we } from "../../common/icons.js";
9
- import Ae from "../label/Label.vue.js";
10
- import W from "../tag/Tag.vue.js";
11
- import Ie from "../icon/Icon.vue.js";
12
- import Re from "../menu/MenuItem.vue.js";
13
- import Ve from "../spinner/Spinner.vue.js";
14
- import _e from "../popover/Popover.vue.js";
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 $e from "../popover/PopoverContainer.vue.js";
17
- import Ce from "../inputFooter/InputFooter.vue.js";
18
- const Ee = { class: "relative" }, ze = {
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
- }, Se = {
21
+ }, Oe = {
22
22
  key: 0,
23
23
  class: "text-secondary-400 dark:text-secondary-500"
24
- }, Ne = { key: 1 }, Oe = {
24
+ }, De = { key: 1 }, Le = {
25
25
  key: 0,
26
26
  class: "flex gap-1 flex-wrap"
27
- }, De = {
27
+ }, Be = {
28
28
  key: 0,
29
29
  class: "text-secondary-400 dark:text-secondary-500"
30
- }, Le = { key: 1 }, Be = {
30
+ }, Ee = { key: 1 }, Te = {
31
31
  key: 1,
32
32
  class: "px-2 text-center text-secondary-400"
33
- }, Te = ["id", "name", "disabled", "multiple", "readonly"], Fe = ["value", "disabled"], Pe = {
34
- ...be.props("primary"),
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
- }, qe = {
43
+ }, Ue = {
44
44
  name: "XSelect",
45
45
  validators: {
46
- ...G.validators()
46
+ ...J.validators()
47
47
  }
48
48
  }, nl = /* @__PURE__ */ pe({
49
- ...qe,
50
- props: Pe,
49
+ ...Ue,
50
+ props: qe,
51
51
  emits: D.emits(),
52
- setup(Q, { expose: Y, emit: Z }) {
53
- const r = Q, V = Z, k = A(null), S = A(null), _ = A(null), f = A(null), u = A(), t = I({
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
- V("update:modelValue", e);
58
+ I("update:modelValue", e);
59
59
  }
60
- }), d = I(() => !r.options || r.options.length === 0 ? [] : r.options.map((e) => {
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 ? ge : void 0,
68
- onClick: () => T(e.value)
67
+ iconRight: i ? we : void 0,
68
+ onClick: () => E(e.value)
69
69
  };
70
- })), L = I(() => {
70
+ })), L = w(() => {
71
71
  var e;
72
72
  return (e = r.options) == null ? void 0 : e.filter((i) => !i.disabled);
73
- }), y = I(() => {
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 && (ee(), setTimeout(() => {
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 ee() {
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
- _.value && ((i = _.value[e]) == null || i.$el.scrollIntoView({ block: "nearest", inline: "nearest" }));
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" && _.value && B(e);
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 T(e) {
117
+ function E(e) {
118
118
  var l;
119
- const i = (l = r.options) == null ? void 0 : l.find((n) => n.value === e);
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 n = t.value.indexOf(e);
124
- n !== -1 ? t.value.splice(n, 1) : (t.value.push(e), V("update:modelValue", t.value));
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 || U(() => {
130
- var n, p, w;
131
- (n = k.value) == null || n.dispatchEvent(new Event("input")), (p = k.value) == null || p.dispatchEvent(new Event("change")), (w = S.value) == null || w.$el.focus();
129
+ r.native || X(() => {
130
+ var o;
131
+ j(), (o = S.value) == null || o.$el.focus();
132
132
  });
133
133
  }
134
134
  }
135
- function F(e) {
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 P(e, i) {
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), V("update:modelValue", t.value));
141
+ l !== -1 && (t.value.splice(l, 1), I("update:modelValue", t.value));
142
142
  }
143
- function $(e) {
143
+ function V(e) {
144
144
  var l;
145
- const i = (l = r.options) == null ? void 0 : l.find((n) => n.value === e);
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: q, blur: le } = J(k), {
149
- errorInternal: j,
150
- hideFooterInternal: ie,
151
- inputListeners: x,
152
- reset: te,
153
- validate: ne,
154
- setError: oe,
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: q, emit: V, withListeners: !0 }), se = I(() => {
158
- const { focus: e, blur: i } = s(x);
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 g = null;
164
+ let v = null;
165
165
  O([re, y], ([e, i]) => {
166
- e || i ? g || (g = he(document, "keydown", ue)) : g && (g(), g = null);
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, n, p, w;
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
- (n = f.value) == null || n.show();
189
+ (o = f.value) == null || o.show();
188
190
  return;
189
191
  }
190
- typeof u.value < "u" && (T(d.value[u.value].value), r.multiple || (p = f.value) == null || p.hide());
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(), (w = f.value) == null || w.hide(), r.native || U(() => {
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: h, className: fe } = ke("Select", {}, r, { errorInternal: j });
198
- return Y({ focus: q, blur: le, reset: te, validate: ne, setError: oe }), (e, i) => (o(), c(Ae, X({
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(h).wrapper
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
- }, H(se.value)), {
213
- default: b(() => [
214
- C("div", Ee, [
215
- e.native && !e.multiple ? (o(), a("div", {
214
+ }, K(se.value)), {
215
+ default: h(() => [
216
+ _("div", Se, [
217
+ e.native && !e.multiple ? (n(), a("div", {
216
218
  key: 0,
217
- class: R(s(h).box),
219
+ class: A(s(b).box),
218
220
  onClick: i[0] || (i[0] = (l) => {
219
- var n;
220
- return (n = k.value) == null ? void 0 : n.click();
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 ? (o(), a("div", ze, [
224
- (o(!0), a(v, null, E(t.value, (l) => (o(), c(W, {
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: (n) => {
230
- P(n, l);
231
+ onRemove: (o) => {
232
+ F(o, l);
231
233
  }
232
234
  }, {
233
- default: b(() => [
234
- z(m($(l)), 1)
235
+ default: h(() => [
236
+ C(m(V(l)), 1)
235
237
  ]),
236
238
  _: 2
237
239
  }, 1032, ["onRemove"]))), 128))
238
- ])) : !e.multiple && !F(t.value) ? (o(), a(v, { key: 1 }, [
239
- z(m($(t.value)), 1)
240
- ], 64)) : (o(), a(v, { key: 2 }, [
241
- e.placeholder ? (o(), a("div", Se, m(e.placeholder), 1)) : (o(), a("div", Ne, " "))
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)) : (o(), c(_e, {
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: b(() => [
250
- K($e, {
251
- class: R(s(h).content)
251
+ content: h(() => [
252
+ W(Ce, {
253
+ class: A(s(b).content)
252
254
  }, {
253
- default: b(() => [
254
- d.value.length > 0 ? (o(!0), a(v, { key: 0 }, E(d.value, (l, n) => (o(), c(Re, {
255
- key: n,
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: n === u.value,
264
+ selected: o === u.value,
263
265
  color: e.color,
264
266
  filled: "",
265
267
  onClick: i[1] || (i[1] = () => {
266
- var p;
267
- return !e.multiple && ((p = f.value) == null ? void 0 : p.hide());
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)) : (o(), a("div", Be, " No options "))
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: b(() => [
275
- C("div", {
276
- class: R([s(h).box])
276
+ default: h(() => [
277
+ _("div", {
278
+ class: A([s(b).box])
277
279
  }, [
278
- e.multiple && Array.isArray(t.value) && t.value.length > 0 ? (o(), a("div", Oe, [
279
- (o(!0), a(v, null, E(t.value, (l) => (o(), c(W, {
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: (n) => {
285
- P(n, l);
286
+ onRemove: (o) => {
287
+ F(o, l);
286
288
  }
287
289
  }, {
288
- default: b(() => [
289
- z(m($(l)), 1)
290
+ default: h(() => [
291
+ C(m(V(l)), 1)
290
292
  ]),
291
293
  _: 2
292
294
  }, 1032, ["onRemove"]))), 128))
293
- ])) : !e.multiple && !F(t.value) ? (o(), a(v, { key: 1 }, [
294
- z(m($(t.value)), 1)
295
- ], 64)) : (o(), a(v, { key: 2 }, [
296
- e.placeholder ? (o(), a("div", De, m(e.placeholder), 1)) : (o(), a("div", Le, " "))
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
- ve(C("select", X({
304
+ ce(_("select", H({
303
305
  id: e.id,
304
306
  ref_key: "elRef",
305
- ref: k,
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
- }, H(s(x), !0)), [
314
- (o(!0), a(v, null, E(e.options, (l, n) => (o(), a("option", {
315
- key: n,
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, Fe))), 128))
319
- ], 16, Te), [
320
- [ce, t.value]
320
+ }, m(l.label), 9, Pe))), 128))
321
+ ], 16, Fe), [
322
+ [me, t.value]
321
323
  ]),
322
- C("div", {
323
- class: R(s(h).iconWrapper)
324
+ _("div", {
325
+ class: A(s(b).iconWrapper)
324
326
  }, [
325
- e.loading ? (o(), c(Ve, {
327
+ e.loading ? (n(), c(_e, {
326
328
  key: 0,
327
329
  size: e.size
328
- }, null, 8, ["size"])) : me(e.$slots, "icon", { key: 1 }, () => [
329
- K(Ie, {
330
- icon: s(we),
331
- class: R([s(h).icon])
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(ie) ? ye("", !0) : (o(), c(Ce, {
338
+ s(te) ? be("", !0) : (n(), c(ze, {
337
339
  key: 0,
338
- error: s(j),
340
+ error: s(q),
339
341
  helper: e.helper
340
342
  }, null, 8, ["error", "helper"]))
341
343
  ]),