@bridge-ui/vue 0.18.0 → 0.20.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 (103) hide show
  1. package/ai/skills/bridge-ui-components/SKILL.md +35 -34
  2. package/ai/skills/bridge-ui-setup/SKILL.md +1 -1
  3. package/dist/Components/Autocomplete/composables/useAutocomplete.js +257 -265
  4. package/dist/Components/Calendar/composables/useCalendar.d.ts +1 -1
  5. package/dist/Components/Calendar/composables/useCalendar.js +192 -187
  6. package/dist/Components/CalendarMonth/composables/useCalendarMonth.d.ts +1 -1
  7. package/dist/Components/CalendarRange/composables/useCalendarRange.d.ts +1 -1
  8. package/dist/Components/CalendarRange/composables/useCalendarRange.js +243 -238
  9. package/dist/Components/ChartBar/ChartBar.vue_vue_type_script_setup_true_lang.js +5 -0
  10. package/dist/Components/ChartBar/chartBar.types.d.ts +11 -1
  11. package/dist/Components/ChartBar/composables/useChartBar.js +4 -4
  12. package/dist/Components/ChartBar/index.d.ts +1 -1
  13. package/dist/Components/ChartBarSeries/ChartBarSeries.vue_vue_type_script_setup_true_lang.js +4 -1
  14. package/dist/Components/ChartBarSeries/chartBarSeries.types.d.ts +24 -2
  15. package/dist/Components/ChartBarSeries/composables/useChartBarSeries.js +3 -0
  16. package/dist/Components/ChartBarSeries/index.d.ts +1 -0
  17. package/dist/Components/ChartFunnel/composables/useChartFunnel.js +10 -10
  18. package/dist/Components/ChartLine/ChartLine.vue_vue_type_script_setup_true_lang.js +1 -0
  19. package/dist/Components/ChartLine/chartLine.types.d.ts +7 -0
  20. package/dist/Components/ChartLine/composables/useChartLine.js +1 -1
  21. package/dist/Components/ChartLineSeries/ChartLineSeries.vue_vue_type_script_setup_true_lang.js +3 -0
  22. package/dist/Components/ChartLineSeries/chartLineSeries.types.d.ts +23 -2
  23. package/dist/Components/ChartLineSeries/composables/useChartLineSeries.js +3 -0
  24. package/dist/Components/ChartLineSeries/index.d.ts +1 -0
  25. package/dist/Components/ChartPie/ChartPie.vue_vue_type_script_setup_true_lang.js +3 -0
  26. package/dist/Components/ChartPie/chartPie.types.d.ts +20 -1
  27. package/dist/Components/ChartPie/composables/useChartPie.d.ts +1 -1
  28. package/dist/Components/ChartPie/composables/useChartPie.js +39 -29
  29. package/dist/Components/ChartScatter/composables/useChartScatter.js +63 -58
  30. package/dist/Components/ChartScatterSeries/ChartScatterSeries.vue_vue_type_script_setup_true_lang.js +1 -0
  31. package/dist/Components/ChartScatterSeries/chartScatterSeries.types.d.ts +8 -1
  32. package/dist/Components/ChartScatterSeries/composables/useChartScatterSeries.js +2 -1
  33. package/dist/Components/ChartScatterSeries/index.d.ts +1 -0
  34. package/dist/Components/ChartTooltip/ChartTooltip.vue_vue_type_script_setup_true_lang.js +11 -7
  35. package/dist/Components/ChartTooltip/chartTooltip.types.d.ts +4 -0
  36. package/dist/Components/ChartTooltip/composables/useChartTooltip.d.ts +1 -0
  37. package/dist/Components/ChartTooltip/composables/useChartTooltip.js +4 -0
  38. package/dist/Components/DataTable/DataTableColumnsMenu.vue.d.ts +1 -2
  39. package/dist/Components/DataTable/composables/useDataTable.d.ts +8 -66
  40. package/dist/Components/DataTable/composables/useDataTable.js +267 -349
  41. package/dist/Components/DataTable/composables/useDataTableColumnsMenu.d.ts +1 -2
  42. package/dist/Components/Heading/Heading.js +5 -0
  43. package/dist/Components/Heading/Heading.vue.d.ts +11 -0
  44. package/dist/Components/Heading/Heading.vue_vue_type_script_setup_true_lang.js +29 -0
  45. package/dist/Components/Heading/composables/useHeading.d.ts +10 -0
  46. package/dist/Components/Heading/composables/useHeading.js +56 -0
  47. package/dist/Components/Heading/heading.types.d.ts +56 -0
  48. package/dist/Components/Heading/index.d.ts +3 -0
  49. package/dist/Components/Heading/index.js +3 -0
  50. package/dist/Components/ListItem/composables/useListItem.js +29 -30
  51. package/dist/Components/Listbox/composables/useListboxNavigation.d.ts +0 -5
  52. package/dist/Components/Listbox/composables/useListboxNavigation.js +23 -50
  53. package/dist/Components/Listbox/index.d.ts +1 -1
  54. package/dist/Components/Listbox/index.js +5 -5
  55. package/dist/Components/ResizablePanel/composables/useResizablePanel.d.ts +1 -1
  56. package/dist/Components/RichTextEditor/composables/useRichTextEditor.js +31 -31
  57. package/dist/Components/Select/composables/useSelect.js +201 -211
  58. package/dist/Components/Slider/composables/useSlider.js +93 -122
  59. package/dist/Components/Text/Text.js +5 -0
  60. package/dist/Components/Text/Text.vue.d.ts +11 -0
  61. package/dist/Components/Text/Text.vue_vue_type_script_setup_true_lang.js +33 -0
  62. package/dist/Components/Text/composables/useText.d.ts +9 -0
  63. package/dist/Components/Text/composables/useText.js +56 -0
  64. package/dist/Components/Text/index.d.ts +3 -0
  65. package/dist/Components/Text/index.js +3 -0
  66. package/dist/Components/Text/text.types.d.ts +76 -0
  67. package/dist/Utils/Charts/chart.types.d.ts +17 -0
  68. package/dist/Utils/Charts/chartInjectionKey.d.ts +2 -2
  69. package/dist/Utils/Charts/index.d.ts +1 -1
  70. package/dist/Utils/Charts/useChartCartesian.d.ts +4 -2
  71. package/dist/Utils/Charts/useChartCartesian.js +90 -76
  72. package/dist/augments.d.ts +10 -0
  73. package/dist/index.d.ts +5 -1
  74. package/dist/index.js +175 -171
  75. package/docs/README.md +2 -0
  76. package/docs/components/BridgeUIProvider.md +1 -1
  77. package/docs/components/Card.md +15 -0
  78. package/docs/components/Chart.md +17 -10
  79. package/docs/components/ChartBar.md +70 -17
  80. package/docs/components/ChartLine.md +57 -16
  81. package/docs/components/ChartPie.md +33 -10
  82. package/docs/components/ChartScatter.md +25 -7
  83. package/docs/components/Heading.md +85 -0
  84. package/docs/components/Text.md +118 -0
  85. package/package.json +2 -2
  86. package/dist/Components/RichTextEditor/tiptapEditor.d.ts +0 -111
  87. package/dist/Components/RichTextEditor/tiptapEditor.js +0 -121
  88. package/dist/Utils/Charts/echarts/bar.d.ts +0 -6
  89. package/dist/Utils/Charts/echarts/bar.js +0 -22
  90. package/dist/Utils/Charts/echarts/cartesian.d.ts +0 -15
  91. package/dist/Utils/Charts/echarts/cartesian.js +0 -255
  92. package/dist/Utils/Charts/echarts/funnel.d.ts +0 -15
  93. package/dist/Utils/Charts/echarts/funnel.js +0 -79
  94. package/dist/Utils/Charts/echarts/line.d.ts +0 -5
  95. package/dist/Utils/Charts/echarts/line.js +0 -19
  96. package/dist/Utils/Charts/echarts/part.d.ts +0 -19
  97. package/dist/Utils/Charts/echarts/part.js +0 -45
  98. package/dist/Utils/Charts/echarts/pie.d.ts +0 -14
  99. package/dist/Utils/Charts/echarts/pie.js +0 -75
  100. package/dist/Utils/Charts/echarts/plot.d.ts +0 -44
  101. package/dist/Utils/Charts/echarts/plot.js +0 -52
  102. package/dist/Utils/Charts/echarts/scatter.d.ts +0 -14
  103. package/dist/Utils/Charts/echarts/scatter.js +0 -152
@@ -1,17 +1,17 @@
1
1
  import { useResolveMessage as e } from "../../../Adapters/I18n/useI18nAdapter.js";
2
2
  import { hasNamedSlot as t } from "../../../Utils/slotOrProp.js";
3
3
  import { useBreakpoint as n } from "../../../Utils/useBreakpoint.js";
4
- import { mergePartBind as r, resolveFieldAdornmentIconSize as i, useBridgeUIComponent as ee, useBridgeUIMergedRegistryClasses as a, useFieldShowFooter as te } from "../../../Utils/index.js";
5
- import { formFieldBridgeKeys as ne, useFormField as re } from "../../FormField/composables/useFormField.js";
6
- import { collectComposedListboxOptions as ie } from "../../Listbox/collectComposedListboxOptions.js";
7
- import { useListboxNavigation as ae } from "../../Listbox/composables/useListboxNavigation.js";
8
- import { Comment as oe, Text as se, computed as o, nextTick as s, onBeforeUnmount as ce, onMounted as le, ref as c, useAttrs as ue, useId as de, useSlots as fe, watch as l } from "vue";
9
- import { get as pe, isNil as me, isObjectLike as u, isSymbol as he, omit as ge } from "es-toolkit/compat";
10
- import { commitFreeSoloValue as d, createSelectAsyncSearch as _e, filterListboxEntries as ve, flattenListboxOptions as f, mergeListboxOptionsByValue as ye, normalizeListboxEntries as be, normalizeSelectOptions as xe, resolveFieldOverlay as Se, resolveSelectAsyncDebounce as Ce, resolveSelectAsyncOptions as we, selectValuesEqual as p } from "@bridge-ui/core/Domain";
11
- import { listboxColorProps as Te } from "@bridge-ui/core/Tokens";
12
- import { adjustAutosizeTextareaHeight as Ee, cn as m, getColorToken as De, mergeBridgeUILayeredClasses as Oe, splitComponentProps as ke } from "@bridge-ui/core/Utils";
4
+ import { mergePartBind as r, resolveFieldAdornmentIconSize as ee, useBridgeUIComponent as te, useBridgeUIMergedRegistryClasses as i, useFieldShowFooter as ne } from "../../../Utils/index.js";
5
+ import { formFieldBridgeKeys as re, useFormField as ie } from "../../FormField/composables/useFormField.js";
6
+ import { collectComposedListboxOptions as ae } from "../../Listbox/collectComposedListboxOptions.js";
7
+ import { useListboxNavigation as oe } from "../../Listbox/composables/useListboxNavigation.js";
8
+ import { Comment as se, Text as ce, computed as a, nextTick as o, onBeforeUnmount as le, onMounted as ue, ref as s, useAttrs as de, useId as fe, useSlots as pe, watch as c } from "vue";
9
+ import { get as me, isNil as he, isObjectLike as l, isSymbol as ge, omit as _e } from "es-toolkit/compat";
10
+ import { commitFreeSoloValue as u, createSelectAsyncSearch as ve, filterListboxEntries as ye, flattenListboxOptions as d, handleSelectTriggerKeyDown as be, mergeListboxOptionsByValue as xe, normalizeListboxEntries as Se, normalizeSelectOptions as Ce, resolveFieldOverlay as we, resolveSelectAsyncDebounce as Te, resolveSelectAsyncOptions as Ee, selectValuesEqual as f } from "@bridge-ui/core/Domain";
11
+ import { listboxColorProps as De } from "@bridge-ui/core/Tokens";
12
+ import { adjustAutosizeTextareaHeight as Oe, cn as p, getColorToken as ke, mergeBridgeUILayeredClasses as Ae, splitComponentProps as je } from "@bridge-ui/core/Utils";
13
13
  //#region src/Components/Autocomplete/composables/useAutocomplete.ts
14
- var Ae = [
14
+ var Me = [
15
15
  "classes",
16
16
  "loading",
17
17
  "options",
@@ -35,112 +35,112 @@ var Ae = [
35
35
  "minItemsForSearch",
36
36
  "optionDescription"
37
37
  ];
38
- function h(h, g, _, v, je) {
39
- let Me = ue(), y = fe(), b = de(), Ne = n(), x = e(), S = c(!1), C = c(""), w = c(!1), T = c(-1), E = c([]), D = c([]), O = c([]), k = c(null), A = null, j = o(() => ke({
38
+ function m(m, h, g, _, Ne) {
39
+ let Pe = de(), v = pe(), y = fe(), Fe = n(), b = e(), x = s(!1), S = s(""), C = s(!1), w = s(-1), T = s([]), E = s([]), D = s([]), O = s(null), k = null, A = a(() => je({
40
40
  props: {
41
- ...Me,
42
- ...h
41
+ ...Pe,
42
+ ...m
43
43
  },
44
- bridgeKeys: Ae
45
- })), M = o(() => j.value.componentProps), Pe = o(() => ({ classes: M.value.classes })), { components: Fe, entry: Ie } = ee({
44
+ bridgeKeys: Me
45
+ })), j = a(() => A.value.componentProps), Ie = a(() => ({ classes: j.value.classes })), { components: Le, entry: Re } = te({
46
46
  chrome: "FormField",
47
47
  componentName: "Autocomplete",
48
- props: () => Pe.value
49
- }), N = a({
50
- entry: Ie,
51
- props: () => Pe.value
52
- }), P = o(() => !!M.value.multiple), F = o(() => ({
53
- optionLabel: M.value.optionLabel ?? "label",
54
- optionValue: M.value.optionValue ?? "value",
55
- optionDescription: M.value.optionDescription ?? "description"
56
- })), I = o(() => je.value.length > 0 ? je.value.map((e) => ({
48
+ props: () => Ie.value
49
+ }), M = i({
50
+ entry: Re,
51
+ props: () => Ie.value
52
+ }), N = a(() => !!j.value.multiple), P = a(() => ({
53
+ optionLabel: j.value.optionLabel ?? "label",
54
+ optionValue: j.value.optionValue ?? "value",
55
+ optionDescription: j.value.optionDescription ?? "description"
56
+ })), F = a(() => Ne.value.length > 0 ? Ne.value.map((e) => ({
57
57
  option: e,
58
58
  type: "option"
59
- })) : be(M.value.options, F.value)), Le = o(() => f(I.value)), L = c([]);
60
- function Re(e) {
61
- if (!u(e)) return !1;
59
+ })) : Se(j.value.options, P.value)), ze = a(() => d(F.value)), I = s([]);
60
+ function Be(e) {
61
+ if (!l(e)) return !1;
62
62
  let t = e.type;
63
- if (!u(t)) return !1;
63
+ if (!l(t)) return !1;
64
64
  let n = t.name, r = t.__name;
65
65
  return n === "AutocompleteOption" || r === "AutocompleteOption";
66
66
  }
67
- function ze() {
68
- return t(y, "default") ? (y.default?.({}) ?? []).some((e) => {
69
- if (!u(e)) return !1;
67
+ function Ve() {
68
+ return t(v, "default") ? (v.default?.({}) ?? []).some((e) => {
69
+ if (!l(e)) return !1;
70
70
  let t = e.type;
71
- return t === oe || t === se || t === void 0 || he(t) ? !1 : !Re(e);
71
+ return t === se || t === ce || t === void 0 || ge(t) ? !1 : !Be(e);
72
72
  }) : !1;
73
73
  }
74
- let R = o(() => ze()), Be = o(() => R.value ? ie(y.default?.({}) ?? []) : []), z = o(() => {
75
- if (R.value) return [];
76
- if (D.value.length > 0) {
77
- let e = be(D.value, F.value);
78
- return M.value.flipOptions ? [...e].reverse() : e;
74
+ let L = a(() => Ve()), He = a(() => L.value ? ae(v.default?.({}) ?? []) : []), R = a(() => {
75
+ if (L.value) return [];
76
+ if (E.value.length > 0) {
77
+ let e = Se(E.value, P.value);
78
+ return j.value.flipOptions ? [...e].reverse() : e;
79
79
  }
80
- return M.value.flipOptions ? [...I.value].reverse().map((e) => e.type === "section" ? {
80
+ return j.value.flipOptions ? [...F.value].reverse().map((e) => e.type === "section" ? {
81
81
  ...e,
82
82
  options: [...e.options].reverse()
83
- } : e) : I.value;
84
- }), Ve = o(() => R.value ? ye(L.value, Be.value) : f(z.value)), B = o(() => {
85
- let e = g.value;
86
- return P.value ? Array.isArray(e) ? e : [] : !me(e) && e !== "" ? [e] : [];
87
- }), He = o(() => Se(M.value.overlay, Ne.mobile)), V = te({
83
+ } : e) : F.value;
84
+ }), Ue = a(() => L.value ? xe(I.value, He.value) : d(R.value)), z = a(() => {
85
+ let e = h.value;
86
+ return N.value ? Array.isArray(e) ? e : [] : !he(e) && e !== "" ? [e] : [];
87
+ }), We = a(() => we(j.value.overlay, Fe.mobile)), B = ne({
88
88
  chrome: "FormField",
89
- overlay: He,
89
+ overlay: We,
90
90
  componentName: "Autocomplete",
91
- showFooter: () => M.value.showFooter
92
- }), Ue = o(() => V.value ? E.value : B.value), H = o(() => {
91
+ showFooter: () => j.value.showFooter
92
+ }), Ge = a(() => B.value ? T.value : z.value), V = a(() => {
93
93
  let e = /* @__PURE__ */ new Map();
94
- for (let t of [...Ve.value, ...O.value]) e.set(t.value, t);
95
- return B.value.map((t) => e.get(t) ?? {
94
+ for (let t of [...Ue.value, ...D.value]) e.set(t.value, t);
95
+ return z.value.map((t) => e.get(t) ?? {
96
96
  value: t,
97
97
  label: String(t)
98
98
  });
99
- }), U = o(() => B.value.length > 0), We = o(() => M.value.clearable === !0), W = o(() => !!M.value.asyncData), G = o(() => {
100
- if (W.value || (M.value.searchable ?? !0)) return !0;
101
- let e = M.value.minItemsForSearch ?? 11;
102
- return Le.value.length >= e;
103
- }), K = o(() => S.value && G.value), Ge = o(() => !!M.value.loading || w.value), Ke = o(() => {
104
- if (R.value) return [];
105
- if (!K.value || !C.value.trim()) return z.value;
106
- let e = C.value.trim().toLowerCase();
107
- return ve(z.value, (t) => t.label.toLowerCase().includes(e));
108
- }), q = o(() => R.value ? L.value : f(Ke.value)), J = ae(() => q.value, T, b), qe = o(() => h.readonly || h.disabled ? !0 : !K.value), Je = o(() => K.value || P.value ? C.value : H.value[0]?.label ?? ""), Ye = (e) => {
109
- k.value = e instanceof HTMLElement ? e : null;
99
+ }), H = a(() => z.value.length > 0), Ke = a(() => j.value.clearable === !0), U = a(() => !!j.value.asyncData), W = a(() => {
100
+ if (U.value || (j.value.searchable ?? !0)) return !0;
101
+ let e = j.value.minItemsForSearch ?? 11;
102
+ return ze.value.length >= e;
103
+ }), G = a(() => x.value && W.value), qe = a(() => !!j.value.loading || C.value), Je = a(() => {
104
+ if (L.value) return [];
105
+ if (!G.value || !S.value.trim()) return R.value;
106
+ let e = S.value.trim().toLowerCase();
107
+ return ye(R.value, (t) => t.label.toLowerCase().includes(e));
108
+ }), K = a(() => L.value ? I.value : d(Je.value)), q = oe(() => K.value, w, y), Ye = a(() => m.readonly || m.disabled ? !0 : !G.value), Xe = a(() => G.value || N.value ? S.value : V.value[0]?.label ?? ""), Ze = (e) => {
109
+ O.value = e instanceof HTMLElement ? e : null;
110
110
  };
111
- function Xe(e) {
111
+ function Qe(e) {
112
112
  e.preventDefault();
113
113
  }
114
- function Ze(e) {
115
- if (h.disabled || h.readonly) return;
114
+ function $e(e) {
115
+ if (m.disabled || m.readonly) return;
116
116
  let t = e.target;
117
117
  if (!t.closest("[data-autocomplete-clear]") && !(t.closest(".wrapper-start-slot") || t.closest(".wrapper-end-slot"))) {
118
- if (!S.value) {
119
- Q();
118
+ if (!x.value) {
119
+ Z();
120
120
  return;
121
121
  }
122
- K.value || ($(), _.value?.focus({ preventScroll: !0 }));
122
+ G.value || (Q(), g.value?.focus({ preventScroll: !0 }));
123
123
  }
124
124
  }
125
- let Qe = o(() => {
126
- let e = ge(j.value.inheritedAttrs, ["class"]), n = ke({
127
- bridgeKeys: ne,
125
+ let et = a(() => {
126
+ let e = _e(A.value.inheritedAttrs, ["class"]), n = je({
127
+ bridgeKeys: re,
128
128
  props: e
129
- }).componentProps, i = n.endIcon ?? (t(y, "end") ? void 0 : "chevronUpDown"), { listbox: ee, ...a } = n.customProps ?? {};
129
+ }).componentProps, ee = n.endIcon ?? (t(v, "end") ? void 0 : "chevronUpDown"), { listbox: te, ...i } = n.customProps ?? {};
130
130
  return {
131
131
  ...n,
132
- endIcon: i,
133
- classes: N.value,
132
+ endIcon: ee,
133
+ classes: M.value,
134
134
  customProps: {
135
- ...a,
136
- container: r(a.container, {}, {
137
- ref: Ye,
138
- onClick: Ze,
139
- class: m({ "cursor-pointer": !h.disabled && !h.readonly && !K.value })
135
+ ...i,
136
+ container: r(i.container, {}, {
137
+ ref: Ze,
138
+ onClick: $e,
139
+ class: p({ "cursor-pointer": !m.disabled && !m.readonly && !G.value })
140
140
  })
141
141
  }
142
142
  };
143
- }), $e = o(() => h.customProps?.listbox), Y = re(() => Qe.value, {
143
+ }), tt = a(() => m.customProps?.listbox), J = ie(() => et.value, {
144
144
  size: "md",
145
145
  rounded: "md",
146
146
  color: "primary",
@@ -148,267 +148,259 @@ function h(h, g, _, v, je) {
148
148
  showErrorIcon: !0
149
149
  }, {
150
150
  componentName: "Autocomplete",
151
- likeInput: () => P.value,
152
- control: () => P.value ? "textarea" : "input"
153
- }), et = o(() => U.value && We.value && !h.readonly && !Y.isDisabled.value), X = (e) => {
154
- e && P.value && Ee(e);
151
+ likeInput: () => N.value,
152
+ control: () => N.value ? "textarea" : "input"
153
+ }), nt = a(() => H.value && Ke.value && !m.readonly && !J.isDisabled.value), Y = (e) => {
154
+ e && N.value && Oe(e);
155
155
  };
156
- function tt(e) {
157
- return Ue.value.some((t) => p(t, e));
156
+ function rt(e) {
157
+ return Ge.value.some((t) => f(t, e));
158
158
  }
159
- function Z(e) {
160
- if (P.value) {
159
+ function X(e) {
160
+ if (N.value) {
161
161
  let t = Array.isArray(e) ? e : [];
162
- g.value = t, v("change", t);
162
+ h.value = t, _("change", t);
163
163
  return;
164
164
  }
165
165
  let t = e ?? "";
166
- g.value = t, v("change", t);
166
+ h.value = t, _("change", t);
167
167
  }
168
- function Q() {
169
- h.disabled || h.readonly || S.value || (E.value = [...B.value], S.value = !0, C.value = "", J.highlightCurrentSelection((e) => B.value.some((t) => p(t, e))), v("open"), W.value && M.value.asyncData && A?.searchImmediate(""));
168
+ function Z() {
169
+ m.disabled || m.readonly || x.value || (T.value = [...z.value], x.value = !0, S.value = "", q.highlightCurrentSelection((e) => z.value.some((t) => f(t, e))), _("open"), U.value && j.value.asyncData && k?.searchImmediate(""));
170
170
  }
171
- function $(e) {
172
- A?.cancel();
173
- let t = S.value;
174
- if (t && e?.commitFreeSolo && M.value.freeSolo !== !1) {
175
- let e = d(C.value, B.value, P.value);
176
- e != null && (Z(e), P.value && s(() => {
177
- X(_.value), _.value?.focus({ preventScroll: !0 });
171
+ function Q(e) {
172
+ k?.cancel();
173
+ let t = x.value;
174
+ if (t && e?.commitFreeSolo && j.value.freeSolo !== !1) {
175
+ let e = u(S.value, z.value, N.value);
176
+ e != null && (X(e), N.value && o(() => {
177
+ Y(g.value), g.value?.focus({ preventScroll: !0 });
178
178
  }));
179
179
  }
180
- C.value = "", T.value = -1, t && (S.value = !1, v("close"));
180
+ S.value = "", w.value = -1, t && (x.value = !1, _("close"));
181
181
  }
182
- function nt(e) {
182
+ function it(e) {
183
183
  if (!e.disabled) {
184
- if (V.value) {
185
- if (P.value) {
186
- let t = [...E.value], n = t.findIndex((t) => p(t, e.value));
187
- n >= 0 ? (t.splice(n, 1), v("deselect", e)) : (t.push(e.value), v("select", e)), E.value = t, C.value = "", T.value = -1, s(() => {
188
- _.value?.focus({ preventScroll: !0 });
184
+ if (B.value) {
185
+ if (N.value) {
186
+ let t = [...T.value], n = t.findIndex((t) => f(t, e.value));
187
+ n >= 0 ? (t.splice(n, 1), _("deselect", e)) : (t.push(e.value), _("select", e)), T.value = t, S.value = "", w.value = -1, o(() => {
188
+ g.value?.focus({ preventScroll: !0 });
189
189
  });
190
190
  return;
191
191
  }
192
- E.value = [e.value], v("select", e), C.value = "", T.value = -1;
192
+ T.value = [e.value], _("select", e), S.value = "", w.value = -1;
193
193
  return;
194
194
  }
195
- if (P.value) {
196
- let t = [...B.value], n = t.findIndex((t) => p(t, e.value));
197
- n >= 0 ? (t.splice(n, 1), v("deselect", e)) : (t.push(e.value), v("select", e)), Z(t), C.value = "", T.value = -1, s(() => {
198
- X(_.value), _.value?.focus({ preventScroll: !0 });
195
+ if (N.value) {
196
+ let t = [...z.value], n = t.findIndex((t) => f(t, e.value));
197
+ n >= 0 ? (t.splice(n, 1), _("deselect", e)) : (t.push(e.value), _("select", e)), X(t), S.value = "", w.value = -1, o(() => {
198
+ Y(g.value), g.value?.focus({ preventScroll: !0 });
199
199
  });
200
200
  return;
201
201
  }
202
- Z(e.value), v("select", e), $();
202
+ X(e.value), _("select", e), Q();
203
203
  }
204
204
  }
205
- function rt() {
206
- P.value ? Z(E.value) : Z(E.value[0] ?? null), $(), v("apply");
205
+ function at() {
206
+ N.value ? X(T.value) : X(T.value[0] ?? null), Q(), _("apply");
207
207
  }
208
- function it() {
209
- E.value = [...B.value], $(), v("cancel");
208
+ function ot() {
209
+ T.value = [...z.value], Q(), _("cancel");
210
210
  }
211
- function at() {
212
- if (M.value.freeSolo === !1) return !1;
213
- let e = d(C.value, B.value, P.value);
214
- return e != null && (Z(e), C.value = "", T.value = -1, P.value ? (s(() => {
215
- X(_.value), _.value?.focus({ preventScroll: !0 });
216
- }), !0) : ($(), !0));
211
+ function st() {
212
+ if (j.value.freeSolo === !1) return !1;
213
+ let e = u(S.value, z.value, N.value);
214
+ return e != null && (X(e), S.value = "", w.value = -1, N.value ? (o(() => {
215
+ Y(g.value), g.value?.focus({ preventScroll: !0 });
216
+ }), !0) : (Q(), !0));
217
217
  }
218
- function ot(e) {
219
- e?.preventDefault(), e?.stopPropagation(), !(h.disabled || h.readonly) && (P.value ? Z([]) : Z(null), v("clear"), $());
218
+ function ct(e) {
219
+ e?.preventDefault(), e?.stopPropagation(), !(m.disabled || m.readonly) && (N.value ? X([]) : X(null), _("clear"), Q());
220
220
  }
221
- function st(e, t) {
222
- t.preventDefault(), t.stopPropagation(), P.value && (Z(B.value.filter((t) => !p(t, e.value))), v("deselect", e), s(() => X(_.value)));
221
+ function lt(e, t) {
222
+ t.preventDefault(), t.stopPropagation(), N.value && (X(z.value.filter((t) => !f(t, e.value))), _("deselect", e), o(() => Y(g.value)));
223
223
  }
224
- function ct() {
225
- let e = J.getHighlightedOption();
226
- return e ? (nt(e), !0) : !1;
224
+ function ut() {
225
+ let e = q.getHighlightedOption();
226
+ return e ? (it(e), !0) : !1;
227
227
  }
228
- function lt(e) {
228
+ function dt(e) {
229
229
  let t = e.target;
230
- C.value = t.value, v("search", C.value), S.value || Q(), J.resetHighlight(), W.value && A?.searchDebounced(C.value);
230
+ S.value = t.value, _("search", S.value), x.value || Z(), q.resetHighlight(), U.value && k?.searchDebounced(S.value);
231
231
  }
232
- function ut(e) {
233
- if (!(h.disabled || h.readonly)) switch (e.key) {
234
- case "ArrowDown":
235
- e.preventDefault(), S.value ? J.moveHighlight(1) : Q();
236
- break;
237
- case "ArrowUp":
238
- e.preventDefault(), S.value ? J.moveHighlight(-1) : Q();
239
- break;
240
- case "Enter":
241
- e.preventDefault(), S.value ? ct() || at() : Q();
242
- break;
243
- case "Escape":
244
- e.preventDefault(), $();
245
- break;
246
- case "Home":
247
- S.value && (e.preventDefault(), J.highlightFirst());
248
- break;
249
- case "End":
250
- S.value && (e.preventDefault(), J.highlightLast());
251
- break;
252
- case "Backspace":
253
- if (P.value && !C.value && H.value.length > 0) {
254
- e.preventDefault();
255
- let t = H.value.at(-1);
256
- t && st(t, e);
257
- }
258
- break;
259
- case "Tab": $({ commitFreeSolo: !0 });
260
- }
232
+ function ft(e) {
233
+ m.disabled || m.readonly || be(e, {
234
+ open: x.value,
235
+ multiple: N.value,
236
+ searchQuery: S.value,
237
+ selectedCount: V.value.length
238
+ }, {
239
+ open: Z,
240
+ dismiss: () => Q(),
241
+ moveHighlight: q.moveHighlight,
242
+ highlightLast: q.highlightLast,
243
+ highlightFirst: q.highlightFirst,
244
+ tabOut: () => Q({ commitFreeSolo: !0 }),
245
+ commitHighlighted: () => {
246
+ ut() || st();
247
+ },
248
+ removeLastSelected: () => {
249
+ let t = V.value.at(-1);
250
+ t && lt(t, e);
251
+ }
252
+ });
261
253
  }
262
- async function dt(e) {
263
- let t = M.value.asyncData;
254
+ async function pt(e) {
255
+ let t = j.value.asyncData;
264
256
  if (t) {
265
- w.value = !0;
257
+ C.value = !0;
266
258
  try {
267
- let { options: n, resolvedSelected: r } = await we(t, e, B.value, (e) => xe(e, F.value));
268
- r.length > 0 && (O.value = r), D.value = n;
259
+ let { options: n, resolvedSelected: r } = await Ee(t, e, z.value, (e) => Ce(e, P.value));
260
+ r.length > 0 && (D.value = r), E.value = n;
269
261
  } finally {
270
- w.value = !1;
262
+ C.value = !1;
271
263
  }
272
264
  }
273
265
  }
274
- async function ft() {
275
- let e = M.value.asyncData;
276
- e?.resolve && B.value.length !== 0 && (O.value = xe(await e.resolve(B.value), F.value));
266
+ async function mt() {
267
+ let e = j.value.asyncData;
268
+ e?.resolve && z.value.length !== 0 && (D.value = Ce(await e.resolve(z.value), P.value));
277
269
  }
278
- let pt = o(() => {
279
- let e = Oe(Te, pe(Fe.value, [
270
+ let $ = a(() => {
271
+ let e = Ae(De, me(Le.value, [
280
272
  "Autocomplete",
281
273
  "tokens",
282
274
  "listbox",
283
275
  "color"
284
276
  ]));
285
- return De({
277
+ return ke({
286
278
  tokens: e,
287
- color: Y.merged.value.color,
288
- invalid: Y.invalidated.value
279
+ color: J.merged.value.color,
280
+ invalid: J.invalidated.value
289
281
  });
290
- }), mt = o(() => pt.value?.value), ht = o(() => {
291
- let e = !h.disabled && !h.readonly && !K.value, t = !h.disabled && !h.readonly && K.value && G.value, n = U.value && !P.value && !K.value;
282
+ }), ht = a(() => $.value?.value), gt = a(() => {
283
+ let e = !m.disabled && !m.readonly && !G.value, t = !m.disabled && !m.readonly && G.value && W.value, n = H.value && !N.value && !G.value;
292
284
  return r({
293
285
  role: "combobox",
294
- value: Je.value,
295
- "aria-controls": b,
296
- "aria-expanded": S.value,
297
- readonly: qe.value,
298
- onKeydown: ut,
299
- placeholder: M.value.placeholder,
300
- "aria-autocomplete": G.value ? "list" : void 0,
301
- "aria-activedescendant": S.value ? J.activeDescendantId.value : void 0,
302
- ...P.value ? {
286
+ value: Xe.value,
287
+ "aria-controls": y,
288
+ "aria-expanded": x.value,
289
+ readonly: Ye.value,
290
+ onKeydown: ft,
291
+ placeholder: j.value.placeholder,
292
+ "aria-autocomplete": W.value ? "list" : void 0,
293
+ "aria-activedescendant": x.value ? q.activeDescendantId.value : void 0,
294
+ ...N.value ? {
303
295
  rows: 1,
304
296
  onInput: (e) => {
305
- lt(e), X(e.target);
297
+ dt(e), Y(e.target);
306
298
  }
307
- } : { onInput: lt }
308
- }, Y.inputBind.value, m({
299
+ } : { onInput: dt }
300
+ }, J.inputBind.value, p({
309
301
  "cursor-text": t,
310
302
  "cursor-pointer": e,
311
- "resize-none overflow-hidden": P.value,
312
- [m(mt.value, N.value.value) ?? ""]: n
303
+ "resize-none overflow-hidden": N.value,
304
+ [p(ht.value, M.value.value) ?? ""]: n
313
305
  }));
314
306
  });
315
- l(() => [
316
- S.value,
317
- P.value,
318
- _.value
307
+ c(() => [
308
+ x.value,
309
+ N.value,
310
+ g.value
319
311
  ], () => {
320
- X(_.value);
321
- }, { immediate: !0 }), l(() => g.value, () => {
322
- ft();
323
- }, { immediate: !0 }), l(() => M.value.asyncData, (e) => {
324
- if (A?.cancel(), D.value = [], ft(), !e) {
325
- A = null;
312
+ Y(g.value);
313
+ }, { immediate: !0 }), c(() => h.value, () => {
314
+ mt();
315
+ }, { immediate: !0 }), c(() => j.value.asyncData, (e) => {
316
+ if (k?.cancel(), E.value = [], mt(), !e) {
317
+ k = null;
326
318
  return;
327
319
  }
328
- A = _e((e) => void dt(e), Ce(e));
329
- }, { immediate: !0 }), ce(() => {
330
- A?.cancel();
331
- }), le(() => {
332
- X(_.value);
320
+ k = ve((e) => void pt(e), Te(e));
321
+ }, { immediate: !0 }), le(() => {
322
+ k?.cancel();
323
+ }), ue(() => {
324
+ Y(g.value);
333
325
  });
334
- let gt = o(() => i(Y.merged.value.size)), _t = o(() => r({}, {}, {
326
+ let _t = a(() => ee(J.merged.value.size)), vt = a(() => r({}, {}, {
335
327
  tabindex: 0,
336
328
  role: "button",
337
329
  "data-autocomplete-clear": !0,
338
- onMousedown: Xe,
339
- class: m({
330
+ onMousedown: Qe,
331
+ class: p({
340
332
  "inline-flex shrink-0 cursor-pointer items-center justify-center rounded-sm transition-colors duration-150": !0,
341
- [pt.value?.clear ?? ""]: !0,
342
- [N.value.clear ?? ""]: !0
333
+ [$.value?.clear ?? ""]: !0,
334
+ [M.value.clear ?? ""]: !0
343
335
  })
344
- })), vt = o(() => ({
345
- listboxId: b,
346
- isSelected: tt,
336
+ })), yt = a(() => ({
337
+ listboxId: y,
338
+ isSelected: rt,
347
339
  disableAutoFocus: !0,
348
- overlay: h.overlay,
349
- loading: Ge.value,
350
- multiple: P.value,
351
- maxHeight: h.maxHeight,
352
- showFooter: V.value,
353
- entries: Ke.value,
354
- options: q.value,
355
- size: Y.merged.value.size,
356
- error: Y.invalidated.value,
357
- color: Y.merged.value.color,
358
- labelledBy: Y.controlId.value,
359
- rounded: Y.merged.value.rounded,
360
- highlightedIndex: T.value,
361
- disableMaxHeight: h.disableMaxHeight === !0,
362
- hideEmptyMessage: M.value.hideEmptyMessage === !0,
363
- emptyMessage: M.value.emptyMessage ?? x("No options"),
364
- loadingMessage: M.value.loadingMessage ?? x("Loading..."),
365
- ...$e.value
340
+ overlay: m.overlay,
341
+ loading: qe.value,
342
+ multiple: N.value,
343
+ maxHeight: m.maxHeight,
344
+ showFooter: B.value,
345
+ entries: Je.value,
346
+ options: K.value,
347
+ size: J.merged.value.size,
348
+ error: J.invalidated.value,
349
+ color: J.merged.value.color,
350
+ labelledBy: J.controlId.value,
351
+ rounded: J.merged.value.rounded,
352
+ highlightedIndex: w.value,
353
+ disableMaxHeight: m.disableMaxHeight === !0,
354
+ hideEmptyMessage: j.value.hideEmptyMessage === !0,
355
+ emptyMessage: j.value.emptyMessage ?? b("No options"),
356
+ loadingMessage: j.value.loadingMessage ?? b("Loading..."),
357
+ ...tt.value
366
358
  }));
367
- function yt(e) {
359
+ function bt(e) {
368
360
  if (e.length === 0) return;
369
- let t = L.value;
361
+ let t = I.value;
370
362
  t.length === e.length && t.every((t, n) => {
371
363
  let r = e[n];
372
364
  return t.label === r?.label && t.description === r?.description && String(t.value) === String(r?.value) && !!t.disabled == !!r?.disabled;
373
- }) || (L.value = e);
365
+ }) || (I.value = e);
374
366
  }
375
367
  return {
376
- slots: y,
377
- hasValue: U,
378
- multiple: P,
379
- listboxId: b,
380
- formField: Y,
381
- isLoading: Ge,
382
- clearable: We,
383
- clearBind: _t,
384
- isSelected: tt,
385
- clearValue: ot,
386
- removeChip: st,
387
- triggerBind: ht,
388
- handleApply: rt,
389
- selectOption: nt,
390
- handleCancel: it,
391
- containerRef: k,
392
- listboxProps: vt,
393
- clearIconSize: gt,
394
- mergedClasses: N,
395
- showClearIcon: et,
396
- visibleOptions: q,
397
- isSearchActive: K,
398
- open: o({
399
- get: () => S.value,
368
+ slots: v,
369
+ hasValue: H,
370
+ multiple: N,
371
+ listboxId: y,
372
+ formField: J,
373
+ isLoading: qe,
374
+ clearable: Ke,
375
+ clearBind: vt,
376
+ isSelected: rt,
377
+ clearValue: ct,
378
+ removeChip: lt,
379
+ triggerBind: gt,
380
+ handleApply: at,
381
+ selectOption: it,
382
+ handleCancel: ot,
383
+ containerRef: O,
384
+ listboxProps: yt,
385
+ clearIconSize: _t,
386
+ mergedClasses: M,
387
+ showClearIcon: nt,
388
+ visibleOptions: K,
389
+ isSearchActive: G,
390
+ open: a({
391
+ get: () => x.value,
400
392
  set: (e) => {
401
- e ? Q() : $({ commitFreeSolo: !0 });
393
+ e ? Z() : Q({ commitFreeSolo: !0 });
402
394
  }
403
395
  }),
404
- selectedOptions: H,
405
- hasComposedList: R,
406
- highlightedIndex: T,
407
- handleRegisteredOptionsChange: yt,
408
- hideEmptyMessage: o(() => M.value.hideEmptyMessage === !0),
409
- emptyMessage: o(() => M.value.emptyMessage ?? x("No options")),
410
- loadingMessage: o(() => M.value.loadingMessage ?? x("Loading..."))
396
+ selectedOptions: V,
397
+ hasComposedList: L,
398
+ highlightedIndex: w,
399
+ handleRegisteredOptionsChange: bt,
400
+ hideEmptyMessage: a(() => j.value.hideEmptyMessage === !0),
401
+ emptyMessage: a(() => j.value.emptyMessage ?? b("No options")),
402
+ loadingMessage: a(() => j.value.loadingMessage ?? b("Loading..."))
411
403
  };
412
404
  }
413
405
  //#endregion
414
- export { h as useAutocomplete };
406
+ export { m as useAutocomplete };