@robuust-digital/vue-components 2.7.1 → 3.0.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 (40) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/_shared/ButtonBase-DyeIkb-l.js +76 -0
  3. package/dist/_shared/ChevronDownIcon-Y_yqpwON.js +39 -0
  4. package/dist/_shared/FormInput-k0vAk3VU.js +69 -0
  5. package/dist/_shared/Modal-D0x_VHiB.js +188 -0
  6. package/dist/_shared/Tooltip-B5w_Ojie.js +85 -0
  7. package/dist/_shared/XMarkIcon-CBoWSM1l.js +17 -0
  8. package/dist/_shared/combobox-yh0YQ8_d.js +265 -0
  9. package/dist/_shared/core-C0o6izrz.js +854 -0
  10. package/dist/_shared/dialogs-SvdPsILD.js +179 -0
  11. package/dist/_shared/dropdown-BPUpLokN.js +134 -0
  12. package/dist/_shared/icon-spinner-D3Dhustt.js +23 -0
  13. package/dist/_shared/lightswitch-CpyX1iA_.js +38 -0
  14. package/dist/_shared/rich-text-editor-DkHKNS2n.js +226 -0
  15. package/dist/_shared/toast-DNxJDQWN.js +84 -0
  16. package/dist/combobox/index.js +2 -5
  17. package/dist/core/file-upload.css +28 -1
  18. package/dist/core/index.js +5 -20
  19. package/dist/dialogs/index.js +3 -6
  20. package/dist/dropdown/index.js +2 -5
  21. package/dist/index/index.js +14 -36
  22. package/dist/lightswitch/index.js +2 -5
  23. package/dist/rich-text-editor/index.js +2 -5
  24. package/dist/toast/index.js +2 -5
  25. package/dist/tooltip/index.js +5 -5
  26. package/package.json +31 -31
  27. package/dist/_shared/ButtonBase.vue_vue_type_script_setup_true_lang-ZYVNEyNx.js +0 -60
  28. package/dist/_shared/ChevronDownIcon-BYWciGnh.js +0 -41
  29. package/dist/_shared/Combobox.vue_vue_type_script_setup_true_lang-BwTRzqr6.js +0 -256
  30. package/dist/_shared/Drawer.vue_vue_type_script_setup_true_lang-DeAu2U_2.js +0 -197
  31. package/dist/_shared/Dropdown.vue_vue_type_script_setup_true_lang-Cv3HwIyF.js +0 -150
  32. package/dist/_shared/FormInput.vue_vue_type_script_setup_true_lang-Bg7YPGyY.js +0 -74
  33. package/dist/_shared/Lightswitch.vue_vue_type_script_setup_true_lang-hiuDVfo5.js +0 -43
  34. package/dist/_shared/Modal.vue_vue_type_script_setup_true_lang-CdMsCCBi.js +0 -203
  35. package/dist/_shared/RichTextEditor.vue_vue_type_script_setup_true_lang-t8nRuJ6k.js +0 -247
  36. package/dist/_shared/Tabs.vue_vue_type_script_setup_true_lang-C4NAAuLp.js +0 -931
  37. package/dist/_shared/Toast.vue_vue_type_script_setup_true_lang-DS6keeu7.js +0 -78
  38. package/dist/_shared/Tooltip.vue_vue_type_script_setup_true_lang-B3MHy48T.js +0 -95
  39. package/dist/_shared/XMarkIcon-CPr_Rd8y.js +0 -19
  40. package/dist/_shared/icon-spinner-BYCMrTdL.js +0 -26
@@ -80,8 +80,25 @@
80
80
  }
81
81
  }
82
82
 
83
+ .rvc-file-upload-control {
84
+ display: inline-block;
85
+ position: relative;
86
+ }
87
+
88
+ .rvc-file-upload-variant-area .rvc-file-upload-control {
89
+ display: block;
90
+ width: 100%;
91
+ }
92
+
83
93
  .rvc-file-upload-input {
84
- display: none;
94
+ display: block;
95
+ position: absolute;
96
+ z-index: 0;
97
+ inset: 0;
98
+ width: 100%;
99
+ height: 100%;
100
+ opacity: 0;
101
+ pointer-events: none;
85
102
  }
86
103
 
87
104
  .rvc-file-upload-area {
@@ -111,6 +128,16 @@
111
128
  }
112
129
  }
113
130
 
131
+ .rvc-file-upload-trigger {
132
+ position: relative;
133
+ z-index: 1;
134
+ }
135
+
136
+ .rvc-file-upload-input:focus-visible + .rvc-file-upload-trigger {
137
+ outline: var(--rvc-base-focus-outline-color) var(--rvc-base-focus-outline-style) var(--rvc-base-focus-outline-width);
138
+ outline-offset: var(--rvc-base-focus-outline-offset);
139
+ }
140
+
114
141
  .rvc-file-upload:not(.rvc-file-upload-disabled) .rvc-file-upload-area:hover {
115
142
  border-color: var(--rvc-file-upload-area-border-color-hover);
116
143
  background-color: var(--rvc-file-upload-area-bg-color-hover);
@@ -1,20 +1,5 @@
1
- import { _ as e, a as s, b as t, c as r, d as m, e as p, f as i, g as x, h as c, i as d, j as f } from "../_shared/Tabs.vue_vue_type_script_setup_true_lang-C4NAAuLp.js";
2
- import { _ as n } from "../_shared/ChevronDownIcon-BYWciGnh.js";
3
- import { _ as F } from "../_shared/ButtonBase.vue_vue_type_script_setup_true_lang-ZYVNEyNx.js";
4
- import { _ as g } from "../_shared/FormInput.vue_vue_type_script_setup_true_lang-Bg7YPGyY.js";
5
- export {
6
- e as Accordion,
7
- s as Alert,
8
- n as Badge,
9
- F as ButtonBase,
10
- t as Checkbox,
11
- r as DataTable,
12
- m as EmptyState,
13
- p as FileUpload,
14
- g as FormInput,
15
- i as FormSelect,
16
- x as FormTextarea,
17
- c as Pagination,
18
- d as Radio,
19
- f as Tabs
20
- };
1
+ import { a as e, c as t, d as n, i as r, l as i, n as a, o, r as s, s as c, t as l, u } from "../_shared/core-C0o6izrz.js";
2
+ import { n as d } from "../_shared/ChevronDownIcon-Y_yqpwON.js";
3
+ import { t as f } from "../_shared/ButtonBase-DyeIkb-l.js";
4
+ import { t as p } from "../_shared/FormInput-k0vAk3VU.js";
5
+ export { n as Accordion, u as Alert, d as Badge, f as ButtonBase, i as Checkbox, o as DataTable, e as EmptyState, r as FileUpload, p as FormInput, t as FormSelect, s as FormTextarea, c as Pagination, a as Radio, l as Tabs };
@@ -1,6 +1,3 @@
1
- import { _ as a } from "../_shared/Drawer.vue_vue_type_script_setup_true_lang-DeAu2U_2.js";
2
- import { _ as f } from "../_shared/Modal.vue_vue_type_script_setup_true_lang-CdMsCCBi.js";
3
- export {
4
- a as Drawer,
5
- f as Modal
6
- };
1
+ import { t as e } from "../_shared/Modal-D0x_VHiB.js";
2
+ import { t } from "../_shared/dialogs-SvdPsILD.js";
3
+ export { t as Drawer, e as Modal };
@@ -1,5 +1,2 @@
1
- import { _ as o } from "../_shared/Dropdown.vue_vue_type_script_setup_true_lang-Cv3HwIyF.js";
2
- export {
3
- o as Dropdown,
4
- o as default
5
- };
1
+ import { n as e, t } from "../_shared/dropdown-BPUpLokN.js";
2
+ export { e as Dropdown, t as default };
@@ -1,36 +1,14 @@
1
- import { _ as r, a as t, b as e, c as s, d as m, e as p, f as x, g as f, h as _, i, j as d } from "../_shared/Tabs.vue_vue_type_script_setup_true_lang-C4NAAuLp.js";
2
- import { _ as l } from "../_shared/ChevronDownIcon-BYWciGnh.js";
3
- import { _ as n } from "../_shared/ButtonBase.vue_vue_type_script_setup_true_lang-ZYVNEyNx.js";
4
- import { _ as h } from "../_shared/FormInput.vue_vue_type_script_setup_true_lang-Bg7YPGyY.js";
5
- import { _ as F } from "../_shared/Combobox.vue_vue_type_script_setup_true_lang-BwTRzqr6.js";
6
- import { _ as B } from "../_shared/Drawer.vue_vue_type_script_setup_true_lang-DeAu2U_2.js";
7
- import { _ as u } from "../_shared/Modal.vue_vue_type_script_setup_true_lang-CdMsCCBi.js";
8
- import { _ as C } from "../_shared/Dropdown.vue_vue_type_script_setup_true_lang-Cv3HwIyF.js";
9
- import { _ as R } from "../_shared/Lightswitch.vue_vue_type_script_setup_true_lang-hiuDVfo5.js";
10
- import { _ as j } from "../_shared/RichTextEditor.vue_vue_type_script_setup_true_lang-t8nRuJ6k.js";
11
- import { _ as y } from "../_shared/Toast.vue_vue_type_script_setup_true_lang-DS6keeu7.js";
12
- import { _ as L } from "../_shared/Tooltip.vue_vue_type_script_setup_true_lang-B3MHy48T.js";
13
- export {
14
- r as Accordion,
15
- t as Alert,
16
- l as Badge,
17
- n as ButtonBase,
18
- e as Checkbox,
19
- F as Combobox,
20
- s as DataTable,
21
- B as Drawer,
22
- C as Dropdown,
23
- m as EmptyState,
24
- p as FileUpload,
25
- h as FormInput,
26
- x as FormSelect,
27
- f as FormTextarea,
28
- R as Lightswitch,
29
- u as Modal,
30
- _ as Pagination,
31
- i as Radio,
32
- j as RichTextEditor,
33
- d as Tabs,
34
- y as Toast,
35
- L as Tooltip
36
- };
1
+ import { a as e, c as t, d as n, i as r, l as i, n as a, o, r as s, s as c, t as l, u } from "../_shared/core-C0o6izrz.js";
2
+ import { n as d } from "../_shared/ChevronDownIcon-Y_yqpwON.js";
3
+ import { t as f } from "../_shared/ButtonBase-DyeIkb-l.js";
4
+ import { t as p } from "../_shared/FormInput-k0vAk3VU.js";
5
+ import { n as m } from "../_shared/rich-text-editor-DkHKNS2n.js";
6
+ import { n as h } from "../_shared/combobox-yh0YQ8_d.js";
7
+ import { n as g } from "../_shared/dropdown-BPUpLokN.js";
8
+ import { t as _ } from "../_shared/Modal-D0x_VHiB.js";
9
+ import { t as v } from "../_shared/dialogs-SvdPsILD.js";
10
+ import { n as y } from "../_shared/lightswitch-CpyX1iA_.js";
11
+ import { t as b } from "../_shared/Tooltip-B5w_Ojie.js";
12
+ import { n as x } from "../_shared/toast-DNxJDQWN.js";
13
+ import "../tooltip/index.js";
14
+ export { n as Accordion, u as Alert, d as Badge, f as ButtonBase, i as Checkbox, h as Combobox, o as DataTable, v as Drawer, g as Dropdown, e as EmptyState, r as FileUpload, p as FormInput, t as FormSelect, s as FormTextarea, y as Lightswitch, _ as Modal, c as Pagination, a as Radio, m as RichTextEditor, l as Tabs, x as Toast, b as Tooltip };
@@ -1,5 +1,2 @@
1
- import { _ as s } from "../_shared/Lightswitch.vue_vue_type_script_setup_true_lang-hiuDVfo5.js";
2
- export {
3
- s as Lightswitch,
4
- s as default
5
- };
1
+ import { n as e, t } from "../_shared/lightswitch-CpyX1iA_.js";
2
+ export { e as Lightswitch, t as default };
@@ -1,5 +1,2 @@
1
- import { _ as t } from "../_shared/RichTextEditor.vue_vue_type_script_setup_true_lang-t8nRuJ6k.js";
2
- export {
3
- t as RichTextEditor,
4
- t as default
5
- };
1
+ import { n as e, t } from "../_shared/rich-text-editor-DkHKNS2n.js";
2
+ export { e as RichTextEditor, t as default };
@@ -1,5 +1,2 @@
1
- import { _ as s } from "../_shared/Toast.vue_vue_type_script_setup_true_lang-DS6keeu7.js";
2
- export {
3
- s as Toast,
4
- s as default
5
- };
1
+ import { n as e, t } from "../_shared/toast-DNxJDQWN.js";
2
+ export { e as Toast, t as default };
@@ -1,5 +1,5 @@
1
- import { _ as o } from "../_shared/Tooltip.vue_vue_type_script_setup_true_lang-B3MHy48T.js";
2
- export {
3
- o as Tooltip,
4
- o as default
5
- };
1
+ import { t as e } from "../_shared/Tooltip-B5w_Ojie.js";
2
+ //#region src/tooltip.ts
3
+ var t = e;
4
+ //#endregion
5
+ export { e as Tooltip, t as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robuust-digital/vue-components",
3
- "version": "2.7.1",
3
+ "version": "3.0.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -87,21 +87,21 @@
87
87
  "type-check": "npx vue-tsc --noEmit --project tsconfig.json --project tests/tsconfig.json"
88
88
  },
89
89
  "dependencies": {
90
- "@floating-ui/vue": "^1.1.9",
90
+ "@floating-ui/vue": "^2.0.0",
91
91
  "@headlessui/vue": "^1.7.23",
92
92
  "@heroicons/vue": "^2.2.0",
93
- "@tiptap/starter-kit": "^3.10.4",
94
- "@tiptap/vue-3": "^3.10.4",
95
- "@vueuse/core": "^14.0.0",
96
- "vue": "^3.5.27"
93
+ "@tiptap/starter-kit": "^3.27.0",
94
+ "@tiptap/vue-3": "^3.27.0",
95
+ "@vueuse/core": "^14.3.0",
96
+ "vue": "^3.5.38"
97
97
  },
98
98
  "peerDependencies": {
99
- "@floating-ui/vue": "^1.0.0",
99
+ "@floating-ui/vue": "^2.0.0",
100
100
  "@headlessui/vue": "^1.7.0",
101
101
  "@tiptap/starter-kit": "^3.0.0",
102
102
  "@tiptap/vue-3": "^3.0.0",
103
103
  "@vueuse/core": "^14.0.0",
104
- "vue": "*"
104
+ "vue": ">=3.3.0"
105
105
  },
106
106
  "peerDependenciesMeta": {
107
107
  "@floating-ui/vue": {
@@ -121,33 +121,33 @@
121
121
  }
122
122
  },
123
123
  "devDependencies": {
124
- "@modelcontextprotocol/sdk": "^1.27.1",
124
+ "@modelcontextprotocol/sdk": "^1.29.0",
125
125
  "@robuust-digital/eslint-config": "^0.5.0",
126
- "@tailwindcss/postcss": "^4.1.17",
127
- "@tailwindcss/vite": "^4.1.17",
128
- "@types/node": "^25.0.2",
129
- "@vitejs/plugin-vue": "^6.0.1",
130
- "@vitest/coverage-v8": "^3.2.4",
131
- "@vue/test-utils": "^2.4.6",
132
- "eslint": "^10.0.1",
133
- "globals": "^17.5.0",
134
- "jsdom": "^29.0.2",
135
- "postcss": "^8.5.6",
136
- "postcss-html": "^1.8.0",
126
+ "@tailwindcss/postcss": "^4.3.1",
127
+ "@tailwindcss/vite": "^4.3.1",
128
+ "@types/node": "^25.9.3",
129
+ "@vitejs/plugin-vue": "^6.0.7",
130
+ "@vitest/coverage-v8": "^4.1.9",
131
+ "@vue/test-utils": "^2.4.11",
132
+ "eslint": "^10.5.0",
133
+ "globals": "^17.6.0",
134
+ "jsdom": "^29.1.1",
135
+ "postcss": "^8.5.15",
136
+ "postcss-html": "^1.8.1",
137
137
  "postcss-scss": "^4.0.9",
138
- "stylelint": "^17.0.0",
139
- "stylelint-config-property-sort-order-smacss": "^11.1.0",
138
+ "stylelint": "^17.13.0",
139
+ "stylelint-config-property-sort-order-smacss": "^11.2.0",
140
140
  "stylelint-config-standard": "^40.0.0",
141
- "tailwindcss": "^4.1.17",
141
+ "tailwindcss": "^4.3.1",
142
142
  "typescript": "6.0.3",
143
- "vite": "^7.2.2",
144
- "vite-plugin-dts": "^5.0.1",
145
- "vite-plugin-static-copy": "3.4.0",
146
- "vite-plugin-vue-devtools": "^8.0.3",
147
- "vite-svg-loader": "^5.1.0",
148
- "vitepress": "2.0.0-alpha.16",
149
- "vitest": "^3.2.4",
150
- "zod": "^4.3.6"
143
+ "vite": "^8.0.16",
144
+ "vite-plugin-dts": "^5.0.2",
145
+ "vite-plugin-static-copy": "4.1.1",
146
+ "vite-plugin-vue-devtools": "^8.1.3",
147
+ "vite-svg-loader": "^5.1.1",
148
+ "vitepress": "2.0.0-alpha.17",
149
+ "vitest": "^4.1.9",
150
+ "zod": "^4.4.3"
151
151
  },
152
152
  "packageManager": "yarn@4.12.0"
153
153
  }
@@ -1,60 +0,0 @@
1
- import { defineComponent as b, watchEffect as r, openBlock as l, createBlock as a, resolveDynamicComponent as c, mergeProps as d, withCtx as f, createElementBlock as y, renderSlot as t, createTextVNode as u, toDisplayString as s, createCommentVNode as i, unref as m } from "vue";
2
- import { S as v } from "./icon-spinner-BYCMrTdL.js";
3
- const g = {
4
- key: 0,
5
- class: "rvc-button-label"
6
- }, k = /* @__PURE__ */ b({
7
- __name: "ButtonBase",
8
- props: {
9
- as: { default: "button" },
10
- bindAs: { default: void 0 },
11
- label: { default: "" },
12
- icon: { type: [Function, Object, null], default: null },
13
- iconOnly: { type: Boolean, default: !1 },
14
- iconLeft: { type: Boolean, default: !1 },
15
- size: { default: "base" },
16
- spinning: { type: Boolean, default: !1 },
17
- color: { default: "primary" }
18
- },
19
- setup(n) {
20
- const o = n;
21
- return r(() => {
22
- o.iconOnly && !o.icon && console.warn("[ButtonBase] Using iconOnly prop without providing an icon may result in an empty button.");
23
- }), (e, B) => (l(), a(c(n.as), d(n.bindAs ? { as: n.bindAs } : {}, {
24
- class: ["rvc-button", `rvc-button-${n.color}`, `rvc-button-${n.size}`, { "rvc-button-reverse": n.iconLeft }, { "rvc-button-icon-only": n.iconOnly }],
25
- "aria-label": n.iconOnly ? n.label : null,
26
- "aria-busy": n.spinning
27
- }), {
28
- default: f(() => [
29
- n.iconOnly && n.label ? (l(), y("span", g, [
30
- t(e.$slots, "default", { label: n.label }, () => [
31
- u(s(n.label), 1)
32
- ])
33
- ])) : n.label ? t(e.$slots, "default", {
34
- key: 1,
35
- label: n.label
36
- }, () => [
37
- u(s(n.label), 1)
38
- ]) : i("", !0),
39
- t(e.$slots, "icon", { icon: n.icon }, () => [
40
- n.icon && !n.spinning ? (l(), a(c(n.icon), {
41
- key: 0,
42
- class: "rvc-button-icon",
43
- "aria-hidden": !n.iconOnly
44
- }, null, 8, ["aria-hidden"])) : i("", !0)
45
- ]),
46
- t(e.$slots, "spinner", { spinning: n.spinning }, () => [
47
- n.spinning ? (l(), a(m(v), {
48
- key: 0,
49
- class: "rvc-button-icon rvc-button-icon-loading",
50
- "aria-hidden": "true"
51
- })) : i("", !0)
52
- ])
53
- ]),
54
- _: 3
55
- }, 16, ["class", "aria-label", "aria-busy"]));
56
- }
57
- });
58
- export {
59
- k as _
60
- };
@@ -1,41 +0,0 @@
1
- import { defineComponent as t, openBlock as l, createBlock as r, resolveDynamicComponent as o, normalizeClass as n, withCtx as c, renderSlot as d, createTextVNode as s, toDisplayString as i, createElementBlock as u, createElementVNode as f } from "vue";
2
- const b = /* @__PURE__ */ t({
3
- __name: "Badge",
4
- props: {
5
- as: { default: "span" },
6
- label: { default: "" },
7
- size: { default: "base" },
8
- color: { default: "default" }
9
- },
10
- setup(e) {
11
- return (a, m) => (l(), r(o(e.as), {
12
- class: n(["rvc-badge", `rvc-badge-${e.color}`, `rvc-badge-${e.size}`])
13
- }, {
14
- default: c(() => [
15
- d(a.$slots, "default", { label: e.label }, () => [
16
- s(i(e.label), 1)
17
- ])
18
- ]),
19
- _: 3
20
- }, 8, ["class"]));
21
- }
22
- });
23
- function g(e, a) {
24
- return l(), u("svg", {
25
- xmlns: "http://www.w3.org/2000/svg",
26
- viewBox: "0 0 20 20",
27
- fill: "currentColor",
28
- "aria-hidden": "true",
29
- "data-slot": "icon"
30
- }, [
31
- f("path", {
32
- "fill-rule": "evenodd",
33
- d: "M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z",
34
- "clip-rule": "evenodd"
35
- })
36
- ]);
37
- }
38
- export {
39
- b as _,
40
- g as r
41
- };
@@ -1,256 +0,0 @@
1
- import { openBlock as n, createElementBlock as c, createElementVNode as i, defineComponent as j, ref as h, computed as D, createBlock as x, unref as r, mergeProps as F, withCtx as g, renderSlot as m, resolveDynamicComponent as O, createCommentVNode as p, createVNode as b, withModifiers as P, Fragment as q, renderList as z, createTextVNode as U, toDisplayString as w, normalizeClass as G } from "vue";
2
- import { useDebounceFn as H } from "@vueuse/core";
3
- import { Combobox as J, ComboboxInput as Q, ComboboxButton as W, ComboboxOptions as X, ComboboxOption as Y } from "@headlessui/vue";
4
- import { r as _, _ as ee } from "./ChevronDownIcon-BYWciGnh.js";
5
- import { S as te } from "./icon-spinner-BYCMrTdL.js";
6
- function le(e, V) {
7
- return n(), c("svg", {
8
- xmlns: "http://www.w3.org/2000/svg",
9
- viewBox: "0 0 16 16",
10
- fill: "currentColor",
11
- "aria-hidden": "true",
12
- "data-slot": "icon"
13
- }, [
14
- i("path", {
15
- "fill-rule": "evenodd",
16
- d: "M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14Zm2.78-4.22a.75.75 0 0 1-1.06 0L8 9.06l-1.72 1.72a.75.75 0 1 1-1.06-1.06L6.94 8 5.22 6.28a.75.75 0 0 1 1.06-1.06L8 6.94l1.72-1.72a.75.75 0 1 1 1.06 1.06L9.06 8l1.72 1.72a.75.75 0 0 1 0 1.06Z",
17
- "clip-rule": "evenodd"
18
- })
19
- ]);
20
- }
21
- function oe(e, V) {
22
- return n(), c("svg", {
23
- xmlns: "http://www.w3.org/2000/svg",
24
- viewBox: "0 0 20 20",
25
- fill: "currentColor",
26
- "aria-hidden": "true",
27
- "data-slot": "icon"
28
- }, [
29
- i("path", { d: "M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z" })
30
- ]);
31
- }
32
- const ae = { class: "rvc-combobox-container" }, ne = { class: "rvc-combobox-wrapper" }, ie = { class: "rvc-combobox-field" }, ue = {
33
- key: 0,
34
- class: "rvc-combobox-chips"
35
- }, se = ["onClick"], re = {
36
- key: 0,
37
- class: "rvc-combobox-content"
38
- }, ce = {
39
- key: 1,
40
- class: "rvc-combobox-content"
41
- }, de = { class: "rvc-combobox-option-text" }, he = /* @__PURE__ */ j({
42
- inheritAttrs: !1,
43
- __name: "Combobox",
44
- props: {
45
- id: {},
46
- rootClass: { default: "" },
47
- modelValue: { default: null },
48
- endpoint: { default: void 0 },
49
- requestParams: { default: () => ({}) },
50
- manualInput: { type: Boolean, default: !1 },
51
- responseData: { type: Function, default: (e) => e },
52
- displayValue: { type: Function, default: (e) => e?.name || null },
53
- optionText: { type: Function, default: (e) => e?.name || null },
54
- disabled: { type: Boolean, default: !1 },
55
- minLength: { default: 2 },
56
- itemKey: { default: "id" },
57
- clearable: { type: Boolean, default: !1 },
58
- rootAttrs: { default: () => ({}) },
59
- multiple: { type: Boolean, default: !1 },
60
- onSearch: { type: Function, default: () => Promise.resolve({ data: [] }) },
61
- searchOnly: { type: Boolean, default: !1 },
62
- icon: { type: [Function, Object, null], default: null },
63
- prefixIcon: { type: [Function, Object, null], default: null },
64
- size: { default: "base" },
65
- debounce: { default: 150 },
66
- minLoadingTime: { default: 0 },
67
- onCancel: { type: Function, default: void 0 }
68
- },
69
- emits: ["update:modelValue", "update:requestParams", "combobox:noResults", "combobox:error"],
70
- setup(e, { emit: V }) {
71
- const a = e, d = V, u = h([]), v = h(!1), f = h(null), L = h(!0), k = h(null), s = D({
72
- get: () => a.multiple ? a.modelValue || [] : a.modelValue,
73
- set: (t) => d("update:modelValue", t)
74
- }), T = D({
75
- get: () => a.requestParams,
76
- set: (t) => d("update:requestParams", t)
77
- }), N = (t) => a.displayValue(t) || "", M = (t) => new Promise((o) => {
78
- setTimeout(o, t);
79
- }), A = (t, o) => {
80
- u.value = [], d("combobox:error", t), d("combobox:noResults", o);
81
- }, B = async (t) => {
82
- if (!a.onSearch) return;
83
- if (a.searchOnly && !t) {
84
- u.value = [];
85
- return;
86
- }
87
- if (t && t.length < a.minLength) {
88
- u.value = [];
89
- return;
90
- }
91
- k.value && a.onCancel && a.onCancel(k.value), v.value = !0;
92
- const o = Date.now();
93
- try {
94
- const { data: l, error: y, cancel: Z } = await a.onSearch(t, T.value, a.endpoint);
95
- k.value = Z || null;
96
- const $ = a.responseData(l), K = Date.now() - o;
97
- !$.length && y && A(y, t), K < a.minLoadingTime && await M(a.minLoadingTime - K), $?.length ? u.value = $ : (u.value = [], d("combobox:noResults", t));
98
- } catch (l) {
99
- l?.cancelled || A(l, t);
100
- } finally {
101
- v.value = !1;
102
- }
103
- }, R = H(B, a.debounce), I = (t) => {
104
- L.value ? (L.value = !1, B(t)) : R(t);
105
- }, E = (t) => {
106
- t.target.value?.length === 0 && (u.value = [], d("update:modelValue", null)), a.manualInput && d("update:modelValue", T.value.query);
107
- }, C = (t) => a.multiple ? s.value.some((o) => o[a.itemKey] === t) : s.value?.[a.itemKey] === t, S = (t) => {
108
- s.value = s.value.filter((o) => o[a.itemKey] !== t[a.itemKey]);
109
- };
110
- return (t, o) => (n(), x(r(J), F({
111
- modelValue: s.value,
112
- "onUpdate:modelValue": o[4] || (o[4] = (l) => s.value = l),
113
- as: "div"
114
- }, e.rootAttrs, {
115
- multiple: e.multiple,
116
- class: [
117
- "rvc-combobox",
118
- `rvc-combobox-${e.size}`,
119
- e.rootClass
120
- ]
121
- }), {
122
- default: g(() => [
123
- i("div", ae, [
124
- i("div", ne, [
125
- i("div", ie, [
126
- e.prefixIcon ? m(t.$slots, "prefixIcon", {
127
- key: 0,
128
- icon: e.prefixIcon
129
- }, () => [
130
- (n(), x(O(e.prefixIcon), { "aria-hidden": "true" }))
131
- ]) : p("", !0),
132
- b(r(Q), F(t.$attrs, {
133
- id: e.id,
134
- "display-value": N,
135
- disabled: e.disabled,
136
- autocomplete: "off",
137
- onChange: o[0] || (o[0] = (l) => I(l.target.value)),
138
- onSearch: E,
139
- onInput: o[1] || (o[1] = (l) => f.value = l.target.value)
140
- }), null, 16, ["id", "disabled"]),
141
- b(r(W), {
142
- disabled: e.disabled,
143
- class: "rvc-combobox-button",
144
- onClick: o[2] || (o[2] = (l) => I(f.value || null))
145
- }, {
146
- default: g(() => [
147
- v.value ? m(t.$slots, "spinner", {
148
- key: 0,
149
- spinning: v.value
150
- }, () => [
151
- b(r(te), { class: "rvc-combobox-spinner" })
152
- ]) : (!e.searchOnly || u.value?.length) && !v.value ? m(t.$slots, "icon", {
153
- key: 1,
154
- icon: e.icon
155
- }, () => [
156
- (n(), x(O(e.icon ?? r(_)), { "aria-hidden": "true" }))
157
- ]) : p("", !0)
158
- ]),
159
- _: 3
160
- }, 8, ["disabled"])
161
- ]),
162
- e.clearable && (Array.isArray(e.modelValue) ? e.modelValue?.length : e.modelValue?.id) ? (n(), c("button", {
163
- key: 0,
164
- type: "button",
165
- "aria-label": "Clear selection",
166
- class: "rvc-combobox-clear",
167
- onClick: o[3] || (o[3] = P((l) => d("update:modelValue", e.multiple ? [] : null), ["prevent"]))
168
- }, [
169
- m(t.$slots, "clear", {}, () => [
170
- b(r(oe))
171
- ])
172
- ])) : p("", !0)
173
- ]),
174
- e.multiple && Array.isArray(s.value) && s.value?.length ? (n(), c("ul", ue, [
175
- (n(!0), c(q, null, z(s.value, (l) => (n(), c("li", {
176
- key: `${e.id}-selected-option-${l[e.itemKey]}`
177
- }, [
178
- m(t.$slots, "chip", {
179
- optionText: e.optionText(l),
180
- option: l,
181
- removeOption: S
182
- }, () => [
183
- b(ee, {
184
- color: "gray",
185
- class: "rvc-combobox-chip",
186
- size: e.size
187
- }, {
188
- default: g(() => [
189
- U(w(e.optionText(l)) + " ", 1),
190
- i("button", {
191
- type: "button",
192
- "aria-label": "Remove option",
193
- onClick: P((y) => S(l), ["prevent"])
194
- }, [
195
- b(r(le))
196
- ], 8, se)
197
- ]),
198
- _: 2
199
- }, 1032, ["size"])
200
- ])
201
- ]))), 128))
202
- ])) : p("", !0),
203
- (!e.searchOnly || f.value?.length) && (!v.value || u.value.length) ? (n(), x(r(X), {
204
- key: 1,
205
- class: "rvc-combobox-options"
206
- }, {
207
- default: g(() => [
208
- f.value && f.value.length < e.minLength ? (n(), c("div", re, [
209
- i("div", null, [
210
- i("em", null, "Minimal " + w(e.minLength) + " characters.", 1)
211
- ])
212
- ])) : !v.value && !u.value.length ? (n(), c("div", ce, [...o[5] || (o[5] = [
213
- i("div", null, " No results found. ", -1)
214
- ])])) : (n(!0), c(q, { key: 2 }, z(u.value, (l) => (n(), x(r(Y), {
215
- key: `option-${l[e.itemKey]}`,
216
- value: l,
217
- as: "template"
218
- }, {
219
- default: g(({ active: y }) => [
220
- i("li", {
221
- class: G([
222
- "rvc-combobox-option",
223
- { "rvc-combobox-option-hover": y },
224
- { "rvc-combobox-option-active": C(l[e.itemKey]) }
225
- ])
226
- }, [
227
- m(t.$slots, "option", {
228
- option: l,
229
- isActive: C
230
- }, () => [
231
- m(t.$slots, "optionPrefix", {
232
- option: l[e.itemKey],
233
- isActive: C
234
- }),
235
- i("span", de, w(e.optionText(l)), 1),
236
- m(t.$slots, "optionSuffix", {
237
- option: l[e.itemKey],
238
- isActive: C
239
- })
240
- ])
241
- ], 2)
242
- ]),
243
- _: 2
244
- }, 1032, ["value"]))), 128))
245
- ]),
246
- _: 3
247
- })) : p("", !0)
248
- ])
249
- ]),
250
- _: 3
251
- }, 16, ["modelValue", "multiple", "class"]));
252
- }
253
- });
254
- export {
255
- he as _
256
- };