@indielayer/ui 1.9.2 → 1.10.0

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 (98) hide show
  1. package/docs/components/menu/DocsMenu.vue +1 -0
  2. package/docs/pages/component/form/usage.vue +2 -0
  3. package/docs/pages/component/menu/usage.vue +2 -0
  4. package/docs/pages/component/select/index.vue +7 -0
  5. package/docs/pages/component/select/multiple.vue +42 -0
  6. package/docs/pages/component/select/usage.vue +8 -12
  7. package/docs/pages/component/table/virtual.vue +19 -6
  8. package/docs/pages/component/toggle/index.vue +1 -1
  9. package/docs/pages/component/tooltip/index.vue +1 -1
  10. package/docs/pages/component/upload/index.vue +29 -0
  11. package/docs/pages/component/upload/usage.vue +115 -0
  12. package/docs/search/components.json +1 -1
  13. package/lib/common/icons.d.ts +2 -0
  14. package/lib/common/icons.js +17 -15
  15. package/lib/components/checkbox/Checkbox.vue2.js +9 -9
  16. package/lib/components/datepicker/Datepicker.vue.d.ts +4 -4
  17. package/lib/components/datepicker/Datepicker.vue.js +1 -1
  18. package/lib/components/drawer/Drawer.vue.js +1 -17
  19. package/lib/components/form/Form.vue.d.ts +4 -4
  20. package/lib/components/form/Form.vue.js +34 -34
  21. package/lib/components/formGroup/FormGroup.vue.d.ts +1 -1
  22. package/lib/components/formGroup/FormGroup.vue.js +39 -37
  23. package/lib/components/index.d.ts +1 -0
  24. package/lib/components/index.js +68 -66
  25. package/lib/components/label/theme/Label.base.theme.js +7 -7
  26. package/lib/components/menu/Menu.vue.d.ts +2 -0
  27. package/lib/components/menu/MenuItem.vue.d.ts +15 -3
  28. package/lib/components/menu/MenuItem.vue.js +1 -1
  29. package/lib/components/menu/MenuItem.vue2.js +43 -37
  30. package/lib/components/modal/Modal.vue.d.ts +4 -4
  31. package/lib/components/modal/Modal.vue.js +38 -34
  32. package/lib/components/notifications/Notifications.vue.d.ts +15 -0
  33. package/lib/components/notifications/Notifications.vue.js +149 -127
  34. package/lib/components/progress/Progress.vue.d.ts +4 -4
  35. package/lib/components/progress/Progress.vue.js +7 -7
  36. package/lib/components/scroll/Scroll.vue2.js +1 -1
  37. package/lib/components/select/Select.vue.d.ts +43 -1
  38. package/lib/components/select/Select.vue.js +358 -258
  39. package/lib/components/select/theme/Select.base.theme.js +1 -0
  40. package/lib/components/tab/Tab.vue.js +1 -1
  41. package/lib/components/tab/TabGroup.vue.js +2 -2
  42. package/lib/components/table/Table.vue.d.ts +4 -4
  43. package/lib/components/table/Table.vue.js +37 -37
  44. package/lib/components/table/TableCell.vue.d.ts +1 -1
  45. package/lib/components/tag/Tag.vue.js +23 -21
  46. package/lib/components/textarea/Textarea.vue.js +1 -1
  47. package/lib/components/upload/Upload.vue.d.ts +195 -0
  48. package/lib/components/upload/Upload.vue.js +264 -0
  49. package/lib/components/upload/Upload.vue2.js +4 -0
  50. package/lib/components/upload/__tests__/Upload.spec.d.ts +1 -0
  51. package/lib/components/upload/index.d.ts +2 -0
  52. package/lib/components/upload/theme/Upload.base.theme.d.ts +3 -0
  53. package/lib/components/upload/theme/Upload.base.theme.js +8 -0
  54. package/lib/components/upload/theme/Upload.carbon.theme.d.ts +3 -0
  55. package/lib/components/upload/theme/Upload.carbon.theme.js +5 -0
  56. package/lib/composables/useVirtualList.js +56 -53
  57. package/lib/index.js +43 -41
  58. package/lib/index.umd.js +4 -4
  59. package/lib/node_modules/.pnpm/@vueuse_core@11.1.0_vue@3.5.10_typescript@5.2.2_/node_modules/@vueuse/core/index.js +501 -0
  60. package/lib/node_modules/.pnpm/@vueuse_shared@11.1.0_vue@3.5.10_typescript@5.2.2_/node_modules/@vueuse/shared/index.js +96 -0
  61. package/lib/theme.d.ts +2 -1
  62. package/lib/themes/base/components.d.ts +1 -0
  63. package/lib/themes/base/components.js +23 -21
  64. package/lib/themes/carbon/components.d.ts +1 -0
  65. package/lib/themes/carbon/components.js +23 -21
  66. package/lib/version.d.ts +1 -1
  67. package/lib/version.js +1 -1
  68. package/package.json +3 -3
  69. package/src/common/icons.ts +2 -0
  70. package/src/components/checkbox/Checkbox.vue +5 -5
  71. package/src/components/drawer/Drawer.vue +0 -16
  72. package/src/components/form/Form.vue +10 -4
  73. package/src/components/formGroup/FormGroup.vue +2 -0
  74. package/src/components/index.ts +1 -0
  75. package/src/components/label/theme/Label.base.theme.ts +7 -5
  76. package/src/components/menu/Menu.vue +2 -0
  77. package/src/components/menu/MenuItem.vue +8 -6
  78. package/src/components/modal/Modal.vue +6 -1
  79. package/src/components/notifications/Notifications.vue +34 -4
  80. package/src/components/progress/Progress.vue +2 -2
  81. package/src/components/select/Select.vue +165 -67
  82. package/src/components/select/theme/Select.base.theme.ts +2 -0
  83. package/src/components/table/Table.vue +2 -3
  84. package/src/components/tag/Tag.vue +11 -9
  85. package/src/components/upload/Upload.vue +365 -0
  86. package/src/components/upload/__tests__/Upload.spec.ts +11 -0
  87. package/src/components/upload/index.ts +2 -0
  88. package/src/components/upload/theme/Upload.base.theme.ts +9 -0
  89. package/src/components/upload/theme/Upload.carbon.theme.ts +7 -0
  90. package/src/composables/useInputtable.ts +1 -1
  91. package/src/composables/useVirtualList.ts +8 -5
  92. package/src/theme.ts +2 -0
  93. package/src/themes/base/components.ts +1 -0
  94. package/src/themes/carbon/components.ts +1 -0
  95. package/src/version.ts +1 -1
  96. package/volar.d.ts +1 -0
  97. package/lib/node_modules/.pnpm/@vueuse_core@10.2.0_vue@3.5.10_typescript@5.2.2_/node_modules/@vueuse/core/index.js +0 -412
  98. package/lib/node_modules/.pnpm/@vueuse_shared@10.2.0_vue@3.5.10_typescript@5.2.2_/node_modules/@vueuse/shared/index.js +0 -90
@@ -1,41 +1,41 @@
1
- import { defineComponent as Le, ref as m, computed as k, watch as S, nextTick as ee, unref as s, onUnmounted as Ae, resolveComponent as Ve, openBlock as a, createBlock as g, mergeProps as E, toHandlers as le, withCtx as $, createElementVNode as w, createElementBlock as n, normalizeClass as L, Fragment as y, createTextVNode as F, toDisplayString as A, createVNode as q, renderSlot as H, createCommentVNode as T, normalizeProps as Ie, guardReactiveProps as Oe, renderList as U, withDirectives as Re, vModelSelect as $e } from "vue";
2
- import { useEventListener as Ce } from "../../node_modules/.pnpm/@vueuse_core@10.2.0_vue@3.5.10_typescript@5.2.2_/node_modules/@vueuse/core/index.js";
3
- import { useColors as Ne } from "../../composables/useColors.js";
4
- import { useCommon as te } from "../../composables/useCommon.js";
5
- import { useInputtable as j } from "../../composables/useInputtable.js";
6
- import { useInteractive as ie } from "../../composables/useInteractive.js";
7
- import { useTheme as Be } from "../../composables/useTheme.js";
8
- import { useVirtualList as Se } from "../../composables/useVirtualList.js";
9
- import { checkIcon as Te, selectIcon as _e } from "../../common/icons.js";
10
- import ze from "../label/Label.vue.js";
11
- import Pe from "../tag/Tag.vue.js";
12
- import De from "../icon/Icon.vue.js";
13
- import Ee from "../menu/MenuItem.vue.js";
14
- import Fe from "../spinner/Spinner.vue.js";
15
- import qe from "../popover/Popover.vue.js";
1
+ import { defineComponent as ze, ref as p, computed as I, watch as S, nextTick as j, unref as s, onUnmounted as Be, openBlock as o, createBlock as R, mergeProps as X, toHandlers as se, withCtx as c, createElementVNode as O, createElementBlock as n, normalizeClass as w, Fragment as h, createTextVNode as T, toDisplayString as y, createVNode as P, renderSlot as C, createCommentVNode as z, normalizeProps as Ne, guardReactiveProps as Se, renderList as W, withModifiers as Pe, withDirectives as xe, vModelSelect as De } from "vue";
2
+ import { useEventListener as Fe, useResizeObserver as Ee } from "../../node_modules/.pnpm/@vueuse_core@11.1.0_vue@3.5.10_typescript@5.2.2_/node_modules/@vueuse/core/index.js";
3
+ import { useColors as He } from "../../composables/useColors.js";
4
+ import { useCommon as fe } from "../../composables/useCommon.js";
5
+ import { useInputtable as K } from "../../composables/useInputtable.js";
6
+ import { useInteractive as ve } from "../../composables/useInteractive.js";
7
+ import { useTheme as qe } from "../../composables/useTheme.js";
8
+ import { useVirtualList as We } from "../../composables/useVirtualList.js";
9
+ import { checkIcon as Me, selectIcon as Ue } from "../../common/icons.js";
10
+ import _e from "../label/Label.vue.js";
11
+ import ne from "../tag/Tag.vue.js";
12
+ import je from "../icon/Icon.vue.js";
13
+ import Xe from "../menu/MenuItem.vue.js";
14
+ import Ke from "../spinner/Spinner.vue.js";
15
+ import ue from "../popover/Popover.vue.js";
16
16
  import "../popover/Popover.vue3.js";
17
- import He from "../popover/PopoverContainer.vue.js";
18
- import Ue from "../inputFooter/InputFooter.vue.js";
19
- const je = { class: "relative" }, Me = {
17
+ import de from "../popover/PopoverContainer.vue.js";
18
+ import Ge from "../inputFooter/InputFooter.vue.js";
19
+ import Je from "../input/Input.vue.js";
20
+ import { useThrottleFn as Qe } from "../../node_modules/.pnpm/@vueuse_shared@11.1.0_vue@3.5.10_typescript@5.2.2_/node_modules/@vueuse/shared/index.js";
21
+ const Ye = { class: "relative" }, Ze = {
20
22
  key: 0,
21
23
  class: "text-secondary-400 dark:text-secondary-500"
22
- }, Xe = { key: 1 }, xe = {
23
- key: 0,
24
- class: "flex gap-1 flex-wrap"
25
- }, Ke = {
24
+ }, el = { key: 1 }, ll = {
26
25
  key: 0,
27
26
  class: "text-secondary-400 dark:text-secondary-500"
28
- }, We = { key: 1 }, Ge = {
27
+ }, tl = { key: 1 }, il = {
29
28
  key: 0,
30
29
  class: "p-2 text-center text-secondary-400"
31
- }, Je = ["id", "name", "disabled", "multiple", "readonly"], Qe = ["value", "disabled"], Ye = {
32
- ...Ne.props("primary"),
33
- ...te.props(),
34
- ...ie.props(),
35
- ...j.props(),
30
+ }, al = ["id", "name", "disabled", "multiple", "readonly"], rl = ["value", "disabled"], ol = {
31
+ ...He.props("primary"),
32
+ ...fe.props(),
33
+ ...ve.props(),
34
+ ...K.props(),
36
35
  placeholder: String,
37
36
  options: Array,
38
37
  multiple: Boolean,
38
+ truncate: Boolean,
39
39
  flat: Boolean,
40
40
  native: Boolean,
41
41
  filterable: Boolean,
@@ -54,345 +54,445 @@ const je = { class: "relative" }, Me = {
54
54
  type: Number,
55
55
  default: 5
56
56
  }
57
- }, Ze = {
57
+ }, sl = {
58
58
  name: "XSelect",
59
59
  validators: {
60
- ...te.validators()
60
+ ...fe.validators()
61
61
  }
62
- }, hl = /* @__PURE__ */ Le({
63
- ...Ze,
64
- props: Ye,
65
- emits: j.emits(),
66
- setup(oe, { expose: re, emit: ae }) {
67
- const i = oe, C = ae, _ = m(null), z = m(null), N = m(null), v = m(null), u = m(), b = m(""), P = m(null), V = k(() => i.disabled || i.loading || i.readonly), r = k({
62
+ }, Ol = /* @__PURE__ */ ze({
63
+ ...sl,
64
+ props: ol,
65
+ emits: K.emits(),
66
+ setup(pe, { expose: ce, emit: me }) {
67
+ const a = pe, x = me, M = p(null), U = p(null), D = p(null), g = p(null), u = p(), V = p(""), _ = p(null), A = I(() => a.disabled || a.loading || a.readonly), r = I({
68
68
  get() {
69
- return i.multiple ? i.modelValue ? Array.isArray(i.modelValue) ? i.modelValue : [i.modelValue] : [] : i.modelValue;
69
+ return a.multiple ? a.modelValue ? Array.isArray(a.modelValue) ? a.modelValue : [a.modelValue] : [] : a.modelValue;
70
70
  },
71
71
  set(e) {
72
- C("update:modelValue", e);
72
+ x("update:modelValue", e);
73
73
  }
74
- }), d = k(() => !i.options || i.options.length === 0 ? [] : i.options.filter((e) => b.value === "" || e.label.toLowerCase().includes(b.value.toLowerCase())).map((e) => {
75
- let l = !1;
76
- return i.multiple && Array.isArray(r.value) ? l = r.value.includes(e.value) : l = e.value === r.value, {
74
+ }), d = I(() => !a.options || a.options.length === 0 ? [] : a.options.filter((e) => V.value === "" || e.label.toLowerCase().includes(V.value.toLowerCase())).map((e) => {
75
+ let t = !1;
76
+ return a.multiple && Array.isArray(r.value) ? t = r.value.includes(e.value) : t = e.value === r.value, {
77
77
  value: e.value,
78
78
  label: e.label,
79
- active: l,
79
+ active: t,
80
+ prefix: e.prefix,
81
+ suffix: e.suffix,
80
82
  disabled: e.disabled,
81
- iconRight: l ? Te : void 0,
82
- onClick: () => K(e.value)
83
+ iconRight: t ? Me : void 0,
84
+ onClick: () => Y(e.value)
83
85
  };
84
- })), M = k(() => d.value.filter((e) => !e.disabled)), { list: X, scrollTo: se, containerProps: ne, wrapperProps: ue } = Se(
86
+ })), G = I(() => d.value.filter((e) => !e.disabled)), { list: J, scrollTo: ye, containerProps: be, wrapperProps: he } = We(
85
87
  d,
86
88
  {
87
- disabled: !i.virtualList,
88
- itemHeight: i.virtualListItemHeight,
89
- topOffset: i.virtualListOffsetTop || 0,
90
- bottomOffset: i.virtualListOffsetBottom || 0,
91
- overscan: i.virtualListOverscan
89
+ disabled: !a.virtualList,
90
+ itemHeight: a.virtualListItemHeight,
91
+ topOffset: a.virtualListOffsetTop || 0,
92
+ bottomOffset: a.virtualListOffsetBottom || 0,
93
+ overscan: a.virtualListOverscan
92
94
  }
93
- ), h = k(() => {
95
+ ), $ = I(() => {
94
96
  var e;
95
- return (e = v.value) == null ? void 0 : e.isOpen;
97
+ return (e = g.value) == null ? void 0 : e.isOpen;
96
98
  });
97
- S(b, (e) => {
98
- e && (u.value = void 0, B(-1));
99
- }), S(h, (e) => {
100
- e ? (de(), (i.multiple || typeof u.value > "u") && B(-1), setTimeout(() => {
99
+ S(V, (e) => {
100
+ e && (u.value = void 0, F(-1));
101
+ }), S($, (e) => {
102
+ e ? (ge(), (a.multiple || typeof u.value > "u") && F(-1), setTimeout(() => {
101
103
  requestAnimationFrame(() => {
102
- var l;
103
- x(u.value || 0), i.filterable && ((l = P.value) == null || l.focus());
104
+ var t;
105
+ Q(u.value || 0), a.filterable && ((t = _.value) == null || t.focus());
104
106
  });
105
- }, 50)) : i.filterable && (b.value = "");
107
+ }, 50)) : a.filterable && (V.value = "");
106
108
  });
107
- function de() {
108
- if (i.multiple) {
109
+ function ge() {
110
+ if (a.multiple) {
109
111
  if (Array.isArray(r.value) && r.value.length > 0) {
110
- const e = d.value.findIndex((l) => l.value === r.value[0]);
112
+ const e = d.value.findIndex((t) => t.value === r.value[0]);
111
113
  e !== -1 && (u.value = e);
112
114
  }
113
115
  } else {
114
- const e = d.value.findIndex((l) => l.value === r.value);
116
+ const e = d.value.findIndex((t) => t.value === r.value);
115
117
  e !== -1 && (u.value = e);
116
118
  }
117
119
  }
118
- function x(e) {
119
- var l;
120
- i.virtualList ? se(e) : N.value && ((l = N.value[e]) == null || l.$el.scrollIntoView({ block: "nearest", inline: "nearest" }));
120
+ function Q(e) {
121
+ var t;
122
+ a.virtualList ? ye(e) : D.value && ((t = D.value[e]) == null || t.$el.scrollIntoView({ block: "nearest", inline: "nearest" }));
121
123
  }
122
124
  S(u, (e) => {
123
- typeof e < "u" && N.value && x(e);
125
+ typeof e < "u" && D.value && Q(e);
124
126
  });
125
- function B(e, l = "down") {
126
- if (!M.value || M.value.length === 0) {
127
+ function F(e, t = "down") {
128
+ if (!G.value || G.value.length === 0) {
127
129
  u.value = void 0;
128
130
  return;
129
131
  }
130
- if (typeof e > "u" && (e = l === "down" ? -1 : 1), l === "down") {
131
- let o = e + 1;
132
- for (o > d.value.length - 1 && (o = 0); d.value[o].disabled; )
133
- ++o > d.value.length - 1 && (o = 0);
134
- u.value = o;
132
+ if (typeof e > "u" && (e = t === "down" ? -1 : 1), t === "down") {
133
+ let l = e + 1;
134
+ for (l > d.value.length - 1 && (l = 0); d.value[l].disabled; )
135
+ ++l > d.value.length - 1 && (l = 0);
136
+ u.value = l;
135
137
  } else {
136
- let o = e - 1;
137
- for (o < 0 && (o = d.value.length - 1); d.value[o].disabled; )
138
- --o < 0 && (o = d.value.length - 1);
139
- u.value = o;
138
+ let l = e - 1;
139
+ for (l < 0 && (l = d.value.length - 1); d.value[l].disabled; )
140
+ --l < 0 && (l = d.value.length - 1);
141
+ u.value = l;
140
142
  }
141
143
  }
142
- function K(e) {
143
- var o;
144
- const l = (o = i.options) == null ? void 0 : o.find((t) => t.value === e);
145
- if (!(!l || l.disabled)) {
146
- if (i.multiple) {
144
+ function Y(e) {
145
+ var l;
146
+ const t = (l = a.options) == null ? void 0 : l.find((i) => i.value === e);
147
+ if (!(!t || t.disabled)) {
148
+ if (a.multiple) {
147
149
  if (Array.isArray(r.value)) {
148
- const t = r.value.indexOf(e);
149
- t !== -1 ? r.value.splice(t, 1) : (r.value.push(e), C("update:modelValue", r.value));
150
+ const i = r.value.indexOf(e);
151
+ i !== -1 ? r.value.splice(i, 1) : (r.value.push(e), x("update:modelValue", r.value));
150
152
  } else
151
153
  r.value = [e];
152
- i.filterable && setTimeout(() => {
153
- var t;
154
- (t = P.value) == null || t.focus();
154
+ a.filterable && setTimeout(() => {
155
+ var i;
156
+ (i = _.value) == null || i.focus();
155
157
  });
156
158
  } else
157
159
  r.value = e;
158
- i.native || ee(() => {
159
- var t;
160
- Y(), (t = z.value) == null || t.$el.focus();
160
+ a.native || j(() => {
161
+ var i;
162
+ ae(), (i = U.value) == null || i.$el.focus();
161
163
  });
162
164
  }
163
165
  }
164
- function W(e) {
166
+ function Z(e) {
165
167
  return !!(typeof e > "u" || e === null || e === "" || Array.isArray(e) && e.length === 0 || !Array.isArray(e) && typeof e == "object" && Object.keys(e).length === 0);
166
168
  }
167
- function fe(e, l) {
168
- if (e.stopPropagation(), V.value)
169
+ function ee(e, t) {
170
+ if (e.stopPropagation(), A.value)
169
171
  return;
170
- const o = r.value.indexOf(l);
171
- o !== -1 && (r.value.splice(o, 1), C("update:modelValue", r.value));
172
+ const l = r.value.indexOf(t);
173
+ l !== -1 && (r.value.splice(l, 1), x("update:modelValue", r.value));
172
174
  }
173
- function D(e) {
174
- var o;
175
- const l = (o = i.options) == null ? void 0 : o.find((t) => t.value === e);
176
- return l ? l.label : "";
175
+ function E(e) {
176
+ var l;
177
+ const t = (l = a.options) == null ? void 0 : l.find((i) => i.value === e);
178
+ return t ? t.label : "";
177
179
  }
178
- const { focus: G, blur: ve } = ie(_), {
179
- errorInternal: J,
180
- hideFooterInternal: pe,
181
- inputListeners: Q,
182
- reset: ce,
183
- validate: Y,
184
- setError: me,
185
- isFocused: ye,
186
- isInsideForm: be
187
- } = j(i, { focus: G, emit: C, withListeners: !0 }), he = k(() => {
188
- const { focus: e, blur: l } = s(Q);
180
+ const { focus: le, blur: ke } = ve(M), {
181
+ errorInternal: te,
182
+ hideFooterInternal: we,
183
+ inputListeners: ie,
184
+ reset: Ae,
185
+ validate: ae,
186
+ setError: Le,
187
+ isFocused: Re,
188
+ isInsideForm: Ve
189
+ } = K(a, { focus: le, emit: x, withListeners: !0 }), $e = I(() => {
190
+ const { focus: e, blur: t } = s(ie);
189
191
  return {
190
192
  focus: e,
191
- blur: l
193
+ blur: t
192
194
  };
193
195
  });
194
- let c = null;
195
- S([ye, h], ([e, l]) => {
196
- e || l ? c || (c = Ce(document, "keydown", ke)) : c && (c(), c = null);
196
+ let L = null;
197
+ S([Re, $], ([e, t]) => {
198
+ e || t ? L || (L = Fe(document, "keydown", Ie)) : L && (L(), L = null);
197
199
  }, {
198
200
  immediate: !0
199
- }), Ae(() => {
200
- c && c();
201
+ }), Be(() => {
202
+ L && L();
201
203
  });
202
- function ke(e) {
203
- var l, o, t, f, I;
204
+ function Ie(e) {
205
+ var t, l, i, m, f;
204
206
  if (d.value.length !== 0)
205
207
  if (e.code === "ArrowDown") {
206
- if (e.preventDefault(), !h.value) {
207
- (l = v.value) == null || l.show();
208
+ if (e.preventDefault(), !$.value) {
209
+ (t = g.value) == null || t.show();
208
210
  return;
209
211
  }
210
- B(u.value, "down");
212
+ F(u.value, "down");
211
213
  } else if (e.code === "ArrowUp") {
212
- if (e.preventDefault(), !h.value) {
213
- (o = v.value) == null || o.show();
214
+ if (e.preventDefault(), !$.value) {
215
+ (l = g.value) == null || l.show();
214
216
  return;
215
217
  }
216
- B(u.value, "up");
218
+ F(u.value, "up");
217
219
  } else if (e.code === "Enter" || e.code === "Space") {
218
- if (e.code === "Space" && i.filterable)
220
+ if (e.code === "Space" && a.filterable)
219
221
  return;
220
- if (e.preventDefault(), e.stopPropagation(), !h.value) {
221
- (t = v.value) == null || t.show();
222
+ if (e.preventDefault(), e.stopPropagation(), !$.value) {
223
+ (i = g.value) == null || i.show();
222
224
  return;
223
225
  }
224
- typeof u.value < "u" && d.value[u.value] && (K(d.value[u.value].value), i.multiple || (f = v.value) == null || f.hide());
226
+ typeof u.value < "u" && d.value[u.value] && (Y(d.value[u.value].value), a.multiple || (m = g.value) == null || m.hide());
225
227
  } else
226
- e.code === "Tab" && h.value && (e.preventDefault(), (I = v.value) == null || I.hide(), i.native || ee(() => {
227
- var O;
228
- (O = z.value) == null || O.$el.focus();
228
+ e.code === "Tab" && $.value && (e.preventDefault(), (f = g.value) == null || f.hide(), a.native || j(() => {
229
+ var v;
230
+ (v = U.value) == null || v.$el.focus();
229
231
  }));
230
232
  }
231
- const { styles: ge, classes: p, className: we } = Be("Select", {}, i, { errorInternal: J });
232
- return re({ focus: G, blur: ve, reset: ce, validate: Y, setError: me }), (e, l) => {
233
- const o = Ve("x-input");
234
- return a(), g(ze, E({
235
- ref_key: "labelRef",
236
- ref: z,
237
- tabindex: "0",
238
- class: ["group", [
239
- s(we),
240
- s(p).wrapper
241
- ]],
242
- style: s(ge),
243
- disabled: V.value,
244
- required: e.required,
245
- "is-inside-form": s(be),
246
- label: e.label,
247
- tooltip: e.tooltip
248
- }, le(he.value)), {
249
- default: $(() => [
250
- w("div", je, [
251
- e.native && !e.multiple ? (a(), n("div", {
252
- key: 0,
253
- class: L(s(p).box),
254
- onClick: l[0] || (l[0] = (t) => {
255
- var f;
256
- return (f = _.value) == null ? void 0 : f.click();
257
- })
258
- }, [
259
- W(r.value) ? (a(), n(y, { key: 1 }, [
260
- e.placeholder ? (a(), n("div", Me, A(e.placeholder), 1)) : (a(), n("div", Xe, " "))
261
- ], 64)) : (a(), n(y, { key: 0 }, [
262
- F(A(D(r.value)), 1)
263
- ], 64))
264
- ], 2)) : (a(), g(qe, {
265
- key: 1,
233
+ const B = p(null), re = p(null), H = p(!1), q = p(0), oe = Qe(() => {
234
+ a.multiple && a.truncate && j(() => {
235
+ const e = Oe();
236
+ e < r.value.length ? (H.value = !0, q.value = r.value.length - e) : (H.value = !1, q.value = 0);
237
+ });
238
+ }, 100, !0);
239
+ Ee(B, () => {
240
+ oe();
241
+ });
242
+ function Oe() {
243
+ if (!B.value)
244
+ return 0;
245
+ const e = B.value.querySelectorAll(".x-tag"), t = Array.from(e);
246
+ let l = 0, i = 0;
247
+ const m = B.value.offsetWidth - 30;
248
+ for (let f = 0; f < t.length; f++) {
249
+ const v = t[f];
250
+ v.style.display = "flex", l += v.offsetWidth, l < m ? i++ : v.style.display = "none";
251
+ }
252
+ return i;
253
+ }
254
+ S(r, (e) => {
255
+ oe();
256
+ }, { immediate: !0, deep: !0 });
257
+ const { styles: Te, classes: b, className: Ce } = qe("Select", {}, a, { errorInternal: te });
258
+ return ce({ focus: le, blur: ke, reset: Ae, validate: ae, setError: Le }), (e, t) => (o(), R(_e, X({
259
+ ref_key: "labelRef",
260
+ ref: U,
261
+ tabindex: "0",
262
+ class: ["group", [
263
+ s(Ce),
264
+ s(b).wrapper
265
+ ]],
266
+ style: s(Te),
267
+ disabled: A.value,
268
+ required: e.required,
269
+ "is-inside-form": s(Ve),
270
+ label: e.label,
271
+ tooltip: e.tooltip
272
+ }, se($e.value)), {
273
+ default: c(() => [
274
+ O("div", Ye, [
275
+ e.native && !e.multiple ? (o(), n("div", {
276
+ key: 0,
277
+ class: w(s(b).box),
278
+ onClick: t[0] || (t[0] = (l) => {
279
+ var i;
280
+ return (i = M.value) == null ? void 0 : i.click();
281
+ })
282
+ }, [
283
+ Z(r.value) ? (o(), n(h, { key: 1 }, [
284
+ e.placeholder ? (o(), n("div", Ze, y(e.placeholder), 1)) : (o(), n("div", el, " "))
285
+ ], 64)) : (o(), n(h, { key: 0 }, [
286
+ T(y(E(r.value)), 1)
287
+ ], 64))
288
+ ], 2)) : (o(), n(h, { key: 1 }, [
289
+ P(ue, {
266
290
  ref_key: "popoverRef",
267
- ref: v,
268
- disabled: V.value
291
+ ref: g,
292
+ disabled: A.value
269
293
  }, {
270
- content: $(() => [
271
- q(He, {
272
- class: L(s(p).content)
294
+ content: c(() => [
295
+ P(de, {
296
+ class: w(s(b).content)
273
297
  }, {
274
- default: $(() => [
275
- H(e.$slots, "content-header", {}, () => [
276
- e.filterable ? (a(), n("div", {
298
+ default: c(() => [
299
+ C(e.$slots, "content-header", {}, () => [
300
+ e.filterable ? (o(), n("div", {
277
301
  key: 0,
278
- class: L(s(p).search)
302
+ class: w(s(b).search)
279
303
  }, [
280
- q(o, {
304
+ P(Je, {
281
305
  ref_key: "filterRef",
282
- ref: P,
283
- modelValue: b.value,
284
- "onUpdate:modelValue": l[1] || (l[1] = (t) => b.value = t),
306
+ ref: _,
307
+ modelValue: V.value,
308
+ "onUpdate:modelValue": t[2] || (t[2] = (l) => V.value = l),
285
309
  placeholder: e.filterPlaceholder,
286
310
  "skip-form-registry": "",
287
311
  size: "sm"
288
312
  }, null, 8, ["modelValue", "placeholder"])
289
- ], 2)) : T("", !0)
313
+ ], 2)) : z("", !0)
290
314
  ]),
291
- w("div", E(s(ne), {
292
- class: s(p).contentBody
315
+ O("div", X(s(be), {
316
+ class: s(b).contentBody
293
317
  }), [
294
- w("div", Ie(Oe(s(ue))), [
295
- (a(!0), n(y, null, U(s(X), (t) => (a(), g(Ee, {
296
- key: t.index,
318
+ O("div", Ne(Se(s(he))), [
319
+ (o(!0), n(h, null, W(s(J), (l) => (o(), R(Xe, {
320
+ key: l.index,
297
321
  ref_for: !0,
298
322
  ref_key: "itemsRef",
299
- ref: N,
300
- item: t.data,
323
+ ref: D,
324
+ item: l.data,
301
325
  size: e.size,
302
- disabled: t.data.disabled,
303
- selected: t.index === u.value,
326
+ disabled: l.data.disabled,
327
+ selected: l.index === u.value,
304
328
  color: e.color,
305
329
  filled: "",
306
- onClick: l[2] || (l[2] = () => {
307
- var f;
308
- return !e.multiple && ((f = v.value) == null ? void 0 : f.hide());
330
+ onClick: t[3] || (t[3] = () => {
331
+ var i;
332
+ return !e.multiple && ((i = g.value) == null ? void 0 : i.hide());
309
333
  })
310
- }, null, 8, ["item", "size", "disabled", "selected", "color"]))), 128))
334
+ }, {
335
+ prefix: c(() => [
336
+ C(e.$slots, "prefix", {
337
+ item: l.data
338
+ }, () => [
339
+ T(y(l.data.prefix), 1)
340
+ ])
341
+ ]),
342
+ suffix: c(() => [
343
+ C(e.$slots, "suffix", {
344
+ item: l.data
345
+ }, () => [
346
+ T(y(l.data.suffix), 1)
347
+ ])
348
+ ]),
349
+ default: c(() => [
350
+ C(e.$slots, "label", {
351
+ item: l.data
352
+ })
353
+ ]),
354
+ _: 2
355
+ }, 1032, ["item", "size", "disabled", "selected", "color"]))), 128))
311
356
  ], 16),
312
- s(X).length === 0 ? (a(), n("div", Ge, " No options ")) : T("", !0)
357
+ s(J).length === 0 ? (o(), n("div", il, " No options ")) : z("", !0)
313
358
  ], 16),
314
- H(e.$slots, "content-footer")
359
+ C(e.$slots, "content-footer")
315
360
  ]),
316
361
  _: 3
317
362
  }, 8, ["class"])
318
363
  ]),
319
- default: $(() => [
320
- w("div", {
321
- class: L([s(p).box])
364
+ default: c(() => [
365
+ O("div", {
366
+ class: w([s(b).box])
322
367
  }, [
323
- e.multiple && Array.isArray(r.value) && r.value.length > 0 ? (a(), n("div", xe, [
324
- (a(!0), n(y, null, U(r.value, (t) => {
325
- var f, I, O, Z;
326
- return a(), g(Pe, {
327
- key: t,
368
+ e.multiple && Array.isArray(r.value) && r.value.length > 0 ? (o(), n("div", {
369
+ key: 0,
370
+ ref_key: "tagsRef",
371
+ ref: B,
372
+ class: w(["flex gap-1 relative", {
373
+ "flex-wrap": !e.truncate,
374
+ "overflow-hidden": e.truncate
375
+ }])
376
+ }, [
377
+ (o(!0), n(h, null, W(r.value, (l) => {
378
+ var i, m, f, v;
379
+ return o(), R(ne, {
380
+ key: l,
328
381
  size: "xs",
329
382
  removable: "",
330
- outlined: !(V.value || (I = (f = e.options) == null ? void 0 : f.find((R) => R.value === t)) != null && I.disabled),
331
- disabled: V.value || ((Z = (O = e.options) == null ? void 0 : O.find((R) => R.value === t)) == null ? void 0 : Z.disabled),
332
- onRemove: (R) => {
333
- fe(R, t);
383
+ outlined: !(A.value || (m = (i = e.options) == null ? void 0 : i.find((k) => k.value === l)) != null && m.disabled),
384
+ disabled: A.value || ((v = (f = e.options) == null ? void 0 : f.find((k) => k.value === l)) == null ? void 0 : v.disabled),
385
+ onRemove: (k) => {
386
+ ee(k, l);
334
387
  }
335
388
  }, {
336
- default: $(() => [
337
- F(A(D(t)), 1)
389
+ default: c(() => [
390
+ T(y(E(l)), 1)
338
391
  ]),
339
392
  _: 2
340
393
  }, 1032, ["outlined", "disabled", "onRemove"]);
341
- }), 128))
342
- ])) : !e.multiple && !W(r.value) ? (a(), n(y, { key: 1 }, [
343
- F(A(D(r.value)), 1)
344
- ], 64)) : (a(), n(y, { key: 2 }, [
345
- e.placeholder ? (a(), n("div", Ke, A(e.placeholder), 1)) : (a(), n("div", We, " "))
394
+ }), 128)),
395
+ H.value ? (o(), n("div", {
396
+ key: 0,
397
+ class: w(s(b).truncateCounter),
398
+ onClick: t[1] || (t[1] = Pe((l) => {
399
+ var i;
400
+ return (i = re.value) == null ? void 0 : i.toggle();
401
+ }, ["stop"]))
402
+ }, "+" + y(q.value), 3)) : z("", !0)
403
+ ], 2)) : !e.multiple && !Z(r.value) ? (o(), n(h, { key: 1 }, [
404
+ T(y(E(r.value)), 1)
405
+ ], 64)) : (o(), n(h, { key: 2 }, [
406
+ e.placeholder ? (o(), n("div", ll, y(e.placeholder), 1)) : (o(), n("div", tl, " "))
346
407
  ], 64))
347
408
  ], 2)
348
409
  ]),
349
410
  _: 3
350
- }, 8, ["disabled"])),
351
- Re(w("select", E({
352
- id: e.id,
353
- ref_key: "elRef",
354
- ref: _,
355
- "onUpdate:modelValue": l[3] || (l[3] = (t) => r.value = t),
356
- tabindex: "-1",
357
- class: e.native && !e.multiple ? "absolute inset-0 w-full h-full cursor-pointer opacity-0" : "hidden",
358
- name: e.name,
359
- disabled: e.disabled || e.loading,
360
- multiple: e.multiple,
361
- readonly: e.readonly
362
- }, le(s(Q), !0)), [
363
- e.native ? (a(!0), n(y, { key: 0 }, U(e.options, (t, f) => (a(), n("option", {
364
- key: f,
365
- value: t.value,
366
- disabled: t.disabled
367
- }, A(t.label), 9, Qe))), 128)) : T("", !0)
368
- ], 16, Je), [
369
- [$e, r.value]
370
- ]),
371
- w("div", {
372
- class: L(s(p).iconWrapper)
373
- }, [
374
- e.loading ? (a(), g(Fe, {
375
- key: 0,
376
- size: e.size
377
- }, null, 8, ["size"])) : H(e.$slots, "icon", { key: 1 }, () => [
378
- q(De, {
379
- icon: s(_e),
380
- class: L([s(p).icon])
381
- }, null, 8, ["icon", "class"])
382
- ])
383
- ], 2)
411
+ }, 8, ["disabled"]),
412
+ e.multiple && e.truncate && H.value ? (o(), R(ue, {
413
+ key: 0,
414
+ ref_key: "multipleHiddenRef",
415
+ ref: re,
416
+ "popper-show-triggers": [],
417
+ "popper-hide-triggers": [],
418
+ class: "inline-block !absolute right-0",
419
+ placement: "auto-start"
420
+ }, {
421
+ content: c(() => [
422
+ P(de, { class: "p-2 flex gap-2 flex-wrap" }, {
423
+ default: c(() => {
424
+ var l;
425
+ return [
426
+ (o(!0), n(h, null, W((l = r.value) == null ? void 0 : l.slice(r.value.length - q.value), (i) => {
427
+ var m, f, v, k;
428
+ return o(), R(ne, {
429
+ key: i,
430
+ size: "xs",
431
+ removable: "",
432
+ outlined: !(A.value || (f = (m = e.options) == null ? void 0 : m.find((N) => N.value === i)) != null && f.disabled),
433
+ disabled: A.value || ((k = (v = e.options) == null ? void 0 : v.find((N) => N.value === i)) == null ? void 0 : k.disabled),
434
+ onRemove: (N) => {
435
+ ee(N, i);
436
+ }
437
+ }, {
438
+ default: c(() => [
439
+ T(y(E(i)), 1)
440
+ ]),
441
+ _: 2
442
+ }, 1032, ["outlined", "disabled", "onRemove"]);
443
+ }), 128))
444
+ ];
445
+ }),
446
+ _: 1
447
+ })
448
+ ]),
449
+ _: 1
450
+ }, 512)) : z("", !0)
451
+ ], 64)),
452
+ xe(O("select", X({
453
+ id: e.id,
454
+ ref_key: "elRef",
455
+ ref: M,
456
+ "onUpdate:modelValue": t[4] || (t[4] = (l) => r.value = l),
457
+ tabindex: "-1",
458
+ class: e.native && !e.multiple ? "absolute inset-0 w-full h-full cursor-pointer opacity-0" : "hidden",
459
+ name: e.name,
460
+ disabled: e.disabled || e.loading,
461
+ multiple: e.multiple,
462
+ readonly: e.readonly
463
+ }, se(s(ie), !0)), [
464
+ e.native ? (o(!0), n(h, { key: 0 }, W(e.options, (l, i) => (o(), n("option", {
465
+ key: i,
466
+ value: l.value,
467
+ disabled: l.disabled
468
+ }, y(l.label), 9, rl))), 128)) : z("", !0)
469
+ ], 16, al), [
470
+ [De, r.value]
384
471
  ]),
385
- s(pe) ? T("", !0) : (a(), g(Ue, {
386
- key: 0,
387
- error: s(J),
388
- helper: e.helper
389
- }, null, 8, ["error", "helper"]))
472
+ O("div", {
473
+ class: w(s(b).iconWrapper)
474
+ }, [
475
+ e.loading ? (o(), R(Ke, {
476
+ key: 0,
477
+ size: e.size
478
+ }, null, 8, ["size"])) : C(e.$slots, "icon", { key: 1 }, () => [
479
+ P(je, {
480
+ icon: s(Ue),
481
+ class: w([s(b).icon])
482
+ }, null, 8, ["icon", "class"])
483
+ ])
484
+ ], 2)
390
485
  ]),
391
- _: 3
392
- }, 16, ["style", "disabled", "required", "is-inside-form", "label", "class", "tooltip"]);
393
- };
486
+ s(we) ? z("", !0) : (o(), R(Ge, {
487
+ key: 0,
488
+ error: s(te),
489
+ helper: e.helper
490
+ }, null, 8, ["error", "helper"]))
491
+ ]),
492
+ _: 3
493
+ }, 16, ["style", "disabled", "required", "is-inside-form", "label", "class", "tooltip"]));
394
494
  }
395
495
  });
396
496
  export {
397
- hl as default
497
+ Ol as default
398
498
  };