@gspa/ui 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/README.md +18 -0
  2. package/dist/_plugin-vue_export-helper-BHFhmbuH.cjs +1 -0
  3. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  4. package/dist/components/Accordion.cjs +1 -0
  5. package/dist/components/Accordion.js +192 -0
  6. package/dist/components/AccordionItem.cjs +1 -0
  7. package/dist/components/AccordionItem.js +109 -0
  8. package/dist/components/AddReminderModal.cjs +1 -0
  9. package/dist/components/AddReminderModal.js +107 -0
  10. package/dist/components/Alert.cjs +1 -0
  11. package/dist/components/Alert.js +222 -0
  12. package/dist/components/Avatar.cjs +1 -0
  13. package/dist/components/Avatar.js +86 -0
  14. package/dist/components/Badge.cjs +1 -0
  15. package/dist/components/Badge.js +109 -0
  16. package/dist/components/Breadcrumb.cjs +1 -0
  17. package/dist/components/Breadcrumb.js +72 -0
  18. package/dist/components/Button.cjs +1 -0
  19. package/dist/components/Button.js +190 -0
  20. package/dist/components/ButtonGroup.cjs +1 -0
  21. package/dist/components/ButtonGroup.js +46 -0
  22. package/dist/components/Calendar.cjs +1 -0
  23. package/dist/components/Calendar.js +341 -0
  24. package/dist/components/Card.cjs +1 -0
  25. package/dist/components/Card.js +316 -0
  26. package/dist/components/CardBody.cjs +1 -0
  27. package/dist/components/CardBody.js +34 -0
  28. package/dist/components/CardContent.cjs +1 -0
  29. package/dist/components/CardContent.js +17 -0
  30. package/dist/components/CardFooter.cjs +1 -0
  31. package/dist/components/CardFooter.js +34 -0
  32. package/dist/components/CardHeader.cjs +1 -0
  33. package/dist/components/CardHeader.js +91 -0
  34. package/dist/components/CardTitle.cjs +1 -0
  35. package/dist/components/CardTitle.js +17 -0
  36. package/dist/components/Checkbox.cjs +1 -0
  37. package/dist/components/Checkbox.js +185 -0
  38. package/dist/components/CircularProgress.cjs +1 -0
  39. package/dist/components/CircularProgress.js +141 -0
  40. package/dist/components/DataTable.cjs +1 -0
  41. package/dist/components/DataTable.js +863 -0
  42. package/dist/components/DataTableCell.cjs +1 -0
  43. package/dist/components/DataTableCell.js +95 -0
  44. package/dist/components/DataTableFilters.cjs +1 -0
  45. package/dist/components/DataTableFilters.js +519 -0
  46. package/dist/components/DataTableHeader.cjs +1 -0
  47. package/dist/components/DataTableHeader.js +116 -0
  48. package/dist/components/DataTablePagination.cjs +1 -0
  49. package/dist/components/DataTablePagination.js +290 -0
  50. package/dist/components/DataTableRow.cjs +1 -0
  51. package/dist/components/DataTableRow.js +199 -0
  52. package/dist/components/DataTableToolBar.cjs +1 -0
  53. package/dist/components/DataTableToolBar.js +477 -0
  54. package/dist/components/DatePicker.cjs +1 -0
  55. package/dist/components/DatePicker.js +401 -0
  56. package/dist/components/Divider.cjs +1 -0
  57. package/dist/components/Divider.js +103 -0
  58. package/dist/components/Dropdown.cjs +1 -0
  59. package/dist/components/Dropdown.js +104 -0
  60. package/dist/components/DropdownItem.cjs +1 -0
  61. package/dist/components/DropdownItem.js +60 -0
  62. package/dist/components/EventsCalendar.cjs +1 -0
  63. package/dist/components/EventsCalendar.js +863 -0
  64. package/dist/components/FileUpload.cjs +1 -0
  65. package/dist/components/FileUpload.js +195 -0
  66. package/dist/components/FilterDrawer.cjs +1 -0
  67. package/dist/components/FilterDrawer.js +412 -0
  68. package/dist/components/Footer.cjs +1 -0
  69. package/dist/components/Footer.js +157 -0
  70. package/dist/components/FormField.cjs +1 -0
  71. package/dist/components/FormField.js +190 -0
  72. package/dist/components/Graph.cjs +1 -0
  73. package/dist/components/Graph.js +164 -0
  74. package/dist/components/GraphFilters.cjs +1 -0
  75. package/dist/components/GraphFilters.js +305 -0
  76. package/dist/components/Header.cjs +1 -0
  77. package/dist/components/Header.js +674 -0
  78. package/dist/components/Icon.cjs +1 -0
  79. package/dist/components/Icon.js +51 -0
  80. package/dist/components/Image.cjs +1 -0
  81. package/dist/components/Image.js +112 -0
  82. package/dist/components/Input.cjs +1 -0
  83. package/dist/components/Input.js +166 -0
  84. package/dist/components/InputGroup.cjs +1 -0
  85. package/dist/components/InputGroup.js +45 -0
  86. package/dist/components/Label.cjs +1 -0
  87. package/dist/components/Label.js +46 -0
  88. package/dist/components/Link.cjs +1 -0
  89. package/dist/components/Link.js +119 -0
  90. package/dist/components/ListItem.cjs +1 -0
  91. package/dist/components/ListItem.js +89 -0
  92. package/dist/components/Loader.cjs +1 -0
  93. package/dist/components/Loader.js +154 -0
  94. package/dist/components/Logo.cjs +1 -0
  95. package/dist/components/Logo.js +67 -0
  96. package/dist/components/MenuItem.cjs +1 -0
  97. package/dist/components/MenuItem.js +66 -0
  98. package/dist/components/Modal.cjs +1 -0
  99. package/dist/components/Modal.js +110 -0
  100. package/dist/components/ModalBody.cjs +1 -0
  101. package/dist/components/ModalBody.js +33 -0
  102. package/dist/components/ModalFooter.cjs +1 -0
  103. package/dist/components/ModalFooter.js +33 -0
  104. package/dist/components/ModalHeader.cjs +1 -0
  105. package/dist/components/ModalHeader.js +24 -0
  106. package/dist/components/MultiSelect.cjs +1 -0
  107. package/dist/components/MultiSelect.js +211 -0
  108. package/dist/components/Notification.cjs +1 -0
  109. package/dist/components/Notification.js +121 -0
  110. package/dist/components/Option.cjs +1 -0
  111. package/dist/components/Option.js +44 -0
  112. package/dist/components/Progress.cjs +1 -0
  113. package/dist/components/Progress.js +77 -0
  114. package/dist/components/ProgressBar.cjs +1 -0
  115. package/dist/components/ProgressBar.js +101 -0
  116. package/dist/components/Radio.cjs +1 -0
  117. package/dist/components/Radio.js +81 -0
  118. package/dist/components/RailNav.cjs +1 -0
  119. package/dist/components/RailNav.js +124 -0
  120. package/dist/components/ReminderConfig.cjs +1 -0
  121. package/dist/components/ReminderConfig.js +375 -0
  122. package/dist/components/ReusableForm.cjs +1 -0
  123. package/dist/components/ReusableForm.js +657 -0
  124. package/dist/components/ReusableFormModal.cjs +1 -0
  125. package/dist/components/ReusableFormModal.js +112 -0
  126. package/dist/components/RightDrawer.cjs +1 -0
  127. package/dist/components/RightDrawer.js +143 -0
  128. package/dist/components/Search.cjs +1 -0
  129. package/dist/components/Search.js +252 -0
  130. package/dist/components/Select.cjs +1 -0
  131. package/dist/components/Select.js +243 -0
  132. package/dist/components/Sidebar.cjs +1 -0
  133. package/dist/components/Sidebar.js +372 -0
  134. package/dist/components/Slider.cjs +1 -0
  135. package/dist/components/Slider.js +42 -0
  136. package/dist/components/Spinner.cjs +1 -0
  137. package/dist/components/Spinner.js +87 -0
  138. package/dist/components/Stepper.cjs +1 -0
  139. package/dist/components/Stepper.js +12 -0
  140. package/dist/components/StepperItem.cjs +1 -0
  141. package/dist/components/StepperItem.js +33 -0
  142. package/dist/components/Switch.cjs +1 -0
  143. package/dist/components/Switch.js +112 -0
  144. package/dist/components/Tab.cjs +1 -0
  145. package/dist/components/Tab.js +134 -0
  146. package/dist/components/TabPanel.cjs +1 -0
  147. package/dist/components/TabPanel.js +49 -0
  148. package/dist/components/Text.cjs +1 -0
  149. package/dist/components/Text.js +84 -0
  150. package/dist/components/Textarea.cjs +1 -0
  151. package/dist/components/Textarea.js +102 -0
  152. package/dist/components/ThemeConfigurator.cjs +1 -0
  153. package/dist/components/ThemeConfigurator.js +50 -0
  154. package/dist/components/Timeline.cjs +1 -0
  155. package/dist/components/Timeline.js +24 -0
  156. package/dist/components/TimelineItem.cjs +1 -0
  157. package/dist/components/TimelineItem.js +63 -0
  158. package/dist/components/Toast.cjs +1 -0
  159. package/dist/components/Toast.js +231 -0
  160. package/dist/components/Tooltip.cjs +1 -0
  161. package/dist/components/Tooltip.js +124 -0
  162. package/dist/components/Typography.cjs +1 -0
  163. package/dist/components/Typography.js +267 -0
  164. package/dist/components/charts/BarChart.cjs +1 -0
  165. package/dist/components/charts/BarChart.js +323 -0
  166. package/dist/components/charts/LineChart.cjs +1 -0
  167. package/dist/components/charts/LineChart.js +322 -0
  168. package/dist/components/charts/PieChart.cjs +1 -0
  169. package/dist/components/charts/PieChart.js +311 -0
  170. package/dist/components/charts/StackedBarChart.cjs +1 -0
  171. package/dist/components/charts/StackedBarChart.js +348 -0
  172. package/dist/components/widgets/DashboardWidget.cjs +1 -0
  173. package/dist/components/widgets/DashboardWidget.js +309 -0
  174. package/dist/directives/tooltip.cjs +47 -0
  175. package/dist/directives/tooltip.js +115 -0
  176. package/dist/index.cjs +1 -0
  177. package/dist/index.esm.js +311 -19548
  178. package/dist/layouts/AuthLayout.cjs +1 -0
  179. package/dist/layouts/AuthLayout.js +190 -0
  180. package/dist/layouts/DashboardLayout.cjs +1 -0
  181. package/dist/layouts/DashboardLayout.js +244 -0
  182. package/dist/layouts/DefaultLayout.cjs +1 -0
  183. package/dist/layouts/DefaultLayout.js +94 -0
  184. package/dist/layouts/ErrorLayout.cjs +1 -0
  185. package/dist/layouts/ErrorLayout.js +452 -0
  186. package/dist/lib/auth.cjs +1 -0
  187. package/dist/lib/auth.js +4 -0
  188. package/dist/lib/theme.cjs +1 -0
  189. package/dist/lib/theme.js +135 -0
  190. package/dist/lib/toast.cjs +1 -0
  191. package/dist/lib/toast.js +81 -0
  192. package/dist/tsconfig.tsbuildinfo +1 -1
  193. package/dist/utils/cn.cjs +1 -0
  194. package/dist/utils/cn.js +7 -0
  195. package/package.json +37 -7
  196. package/dist/index.js +0 -605
@@ -0,0 +1,112 @@
1
+ import { useSlots as V, computed as i, createBlock as z, openBlock as B, normalizeClass as x, withCtx as s, createVNode as N, createSlots as F, renderList as T, unref as y, renderSlot as r, normalizeProps as m, guardReactiveProps as c } from "vue";
2
+ import A from "./Modal.js";
3
+ import L from "./ReusableForm.js";
4
+ const H = {
5
+ __name: "ReusableFormModal",
6
+ props: {
7
+ modelValue: { type: Boolean, default: !1 },
8
+ modalType: {
9
+ type: String,
10
+ required: !0,
11
+ validator: (e) => ["create", "edit"].includes(e)
12
+ },
13
+ entityName: { type: String, default: "Item" },
14
+ fields: { type: Array, required: !0 },
15
+ sections: { type: Array, default: () => [] },
16
+ initialData: { type: Object, default: null },
17
+ loading: { type: Boolean, default: !1 },
18
+ customValidation: { type: Function, default: null },
19
+ crossValidate: { type: Function, default: null },
20
+ showSubmit: { type: Boolean, default: !0 },
21
+ submitLabel: { type: String, default: "" },
22
+ showReset: { type: Boolean, default: !1 },
23
+ showCancel: { type: Boolean, default: !0 },
24
+ modalSize: {
25
+ type: String,
26
+ default: "4xl",
27
+ validator: (e) => ["sm", "md", "lg", "xl", "2xl", "3xl", "4xl", "5xl", "6xl", "7xl", "8xl", "full"].includes(e)
28
+ },
29
+ modalHeight: { type: String, default: "auto" },
30
+ modalResizable: { type: Boolean, default: !1 }
31
+ },
32
+ emits: ["update:modelValue", "submit", "close", "form-change"],
33
+ setup(e, { emit: b }) {
34
+ const t = e, n = b, d = V(), u = i({
35
+ get: () => t.modelValue,
36
+ set: (a) => n("update:modelValue", a)
37
+ }), h = i(() => t.submitLabel ? t.submitLabel : t.modalType === "create" ? `Create ${t.entityName}` : `Update ${t.entityName}`), g = i(() => t.modalType === "create" ? `Add New ${t.entityName}` : `Edit ${t.entityName}`), p = i(() => t.modalType === "create" ? `Fill in the details to create a new ${t.entityName.toLowerCase()}.` : `Update the ${t.entityName.toLowerCase()} information below.`), w = i(() => {
38
+ if (Array.isArray(t.sections) && t.sections.length > 0) {
39
+ const a = t.sections.flatMap((o) => Array.isArray(o?.fields) ? o.fields : []);
40
+ if (a.length > 0) return a;
41
+ }
42
+ return t.fields || [];
43
+ }), S = i(() => w.value.map((a) => a?.name).filter((a) => typeof a == "string" && !!a && !!d[`field-${a}`])), f = () => {
44
+ u.value = !1, n("close");
45
+ }, v = () => {
46
+ f();
47
+ }, $ = (a) => {
48
+ n("submit", {
49
+ ...a,
50
+ modalType: t.modalType,
51
+ originalData: t.initialData
52
+ });
53
+ };
54
+ return (a, o) => (B(), z(A, {
55
+ modelValue: u.value,
56
+ "onUpdate:modelValue": o[1] || (o[1] = (l) => u.value = l),
57
+ "show-close": !0,
58
+ "close-on-backdrop": !0,
59
+ size: e.modalSize,
60
+ class: x(e.modalHeight === "auto" ? "" : e.modalHeight),
61
+ resizable: e.modalResizable,
62
+ onClose: f
63
+ }, {
64
+ default: s(() => [
65
+ N(L, {
66
+ title: g.value,
67
+ description: p.value,
68
+ "entity-name": e.entityName,
69
+ fields: e.fields,
70
+ sections: e.sections,
71
+ "initial-data": e.initialData,
72
+ loading: e.loading,
73
+ "custom-validation": e.customValidation,
74
+ "cross-validate": e.crossValidate,
75
+ "submit-label": h.value,
76
+ "show-reset": e.showReset,
77
+ "show-cancel": e.showCancel,
78
+ "show-submit": e.showSubmit,
79
+ "form-type": e.modalType,
80
+ onSubmit: $,
81
+ onCancel: v,
82
+ onFormChange: o[0] || (o[0] = (l) => n("form-change", l))
83
+ }, F({ _: 2 }, [
84
+ y(d)["section-header"] ? {
85
+ name: "section-header",
86
+ fn: s((l) => [
87
+ r(a.$slots, "section-header", m(c(l)))
88
+ ]),
89
+ key: "0"
90
+ } : void 0,
91
+ T(S.value, (l) => ({
92
+ name: `field-${l}`,
93
+ fn: s((C) => [
94
+ r(a.$slots, `field-${l}`, m(c(C)))
95
+ ])
96
+ })),
97
+ y(d).actions ? {
98
+ name: "actions",
99
+ fn: s((l) => [
100
+ r(a.$slots, "actions", m(c(l)))
101
+ ]),
102
+ key: "1"
103
+ } : void 0
104
+ ]), 1032, ["title", "description", "entity-name", "fields", "sections", "initial-data", "loading", "custom-validation", "cross-validate", "submit-label", "show-reset", "show-cancel", "show-submit", "form-type"])
105
+ ]),
106
+ _: 3
107
+ }, 8, ["modelValue", "size", "class", "resizable"]));
108
+ }
109
+ };
110
+ export {
111
+ H as default
112
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),u={key:0,class:"fixed inset-0 z-[1200]"},m=["aria-label"],f={class:"flex items-center justify-between px-4 py-3 border-b ui-border shrink-0"},w={class:"text-sm font-semibold ui-text"},y={class:"flex-1 overflow-y-auto"},v={key:0,class:"border-t ui-border px-4 py-3 shrink-0"},k={__name:"RightDrawer",props:{modelValue:{type:Boolean,default:!1},title:{type:String,default:"Details"},size:{type:String,default:"md",validator:o=>["sm","md","lg","xl","full"].includes(o)},closeOnOverlay:{type:Boolean,default:!0},closeOnEsc:{type:Boolean,default:!0},showOverlay:{type:Boolean,default:!0},showCloseButton:{type:Boolean,default:!0}},emits:["update:modelValue","close"],setup(o,{emit:i}){const l=o,s=i,d=e.computed(()=>{const t={sm:"w-full max-w-sm",md:"w-full max-w-md",lg:"w-full max-w-lg",xl:"w-full max-w-xl",full:"w-full max-w-full"};return t[l.size]||t.md}),a=()=>{s("update:modelValue",!1),s("close")},c=()=>{l.closeOnOverlay&&a()},n=t=>{t.key==="Escape"&&l.modelValue&&l.closeOnEsc&&a()};return e.watch(()=>l.modelValue,t=>{typeof document>"u"||(document.body.style.overflow=t?"hidden":"")}),e.watch(()=>l.modelValue,t=>{typeof window>"u"||(t?window.addEventListener("keydown",n):window.removeEventListener("keydown",n))},{immediate:!0}),e.onUnmounted(()=>{typeof document<"u"&&(document.body.style.overflow=""),typeof window<"u"&&window.removeEventListener("keydown",n)}),(t,r)=>(e.openBlock(),e.createBlock(e.Transition,{"enter-active-class":"transition-opacity duration-200 ease-out","leave-active-class":"transition-opacity duration-200 ease-in","enter-from-class":"opacity-0","leave-to-class":"opacity-0"},{default:e.withCtx(()=>[o.modelValue?(e.openBlock(),e.createElementBlock("div",u,[o.showOverlay?(e.openBlock(),e.createElementBlock("div",{key:0,class:"absolute inset-0 bg-black/30 backdrop-blur-[1px]",onClick:c})):e.createCommentVNode("",!0),e.createVNode(e.Transition,{"enter-active-class":"transition-transform duration-250 ease-out","leave-active-class":"transition-transform duration-200 ease-in","enter-from-class":"translate-x-full","leave-to-class":"translate-x-full"},{default:e.withCtx(()=>[o.modelValue?(e.openBlock(),e.createElementBlock("aside",{key:0,class:e.normalizeClass(["absolute right-0 top-0 h-full ui-surface border-l ui-border shadow-2xl flex flex-col",d.value]),role:"dialog","aria-modal":"true","aria-label":o.title},[e.createElementVNode("div",f,[e.createElementVNode("h3",w,e.toDisplayString(o.title),1),o.showCloseButton?(e.openBlock(),e.createElementBlock("button",{key:0,class:"w-8 h-8 rounded-md ui-text-muted hover:bg-(--ui-surface-muted) hover:text-(--ui-text) transition-colors flex items-center justify-center",onClick:a},[...r[0]||(r[0]=[e.createElementVNode("span",{class:"sr-only"},"Close drawer",-1),e.createElementVNode("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor","stroke-width":"2",viewBox:"0 0 24 24"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})],-1)])])):e.createCommentVNode("",!0)]),e.createElementVNode("div",y,[e.renderSlot(t.$slots,"default")]),t.$slots.footer?(e.openBlock(),e.createElementBlock("div",v,[e.renderSlot(t.$slots,"footer")])):e.createCommentVNode("",!0)],10,m)):e.createCommentVNode("",!0)]),_:3})])):e.createCommentVNode("",!0)]),_:3}))}};exports.default=k;
@@ -0,0 +1,143 @@
1
+ import { computed as x, watch as c, onUnmounted as h, createBlock as k, openBlock as l, Transition as f, withCtx as m, createElementBlock as a, createCommentVNode as n, createVNode as b, normalizeClass as g, createElementVNode as s, toDisplayString as B, renderSlot as w } from "vue";
2
+ const C = {
3
+ key: 0,
4
+ class: "fixed inset-0 z-[1200]"
5
+ }, V = ["aria-label"], E = { class: "flex items-center justify-between px-4 py-3 border-b ui-border shrink-0" }, O = { class: "text-sm font-semibold ui-text" }, z = { class: "flex-1 overflow-y-auto" }, L = {
6
+ key: 0,
7
+ class: "border-t ui-border px-4 py-3 shrink-0"
8
+ }, j = {
9
+ __name: "RightDrawer",
10
+ props: {
11
+ modelValue: {
12
+ type: Boolean,
13
+ default: !1
14
+ },
15
+ title: {
16
+ type: String,
17
+ default: "Details"
18
+ },
19
+ size: {
20
+ type: String,
21
+ default: "md",
22
+ validator: (t) => ["sm", "md", "lg", "xl", "full"].includes(t)
23
+ },
24
+ closeOnOverlay: {
25
+ type: Boolean,
26
+ default: !0
27
+ },
28
+ closeOnEsc: {
29
+ type: Boolean,
30
+ default: !0
31
+ },
32
+ showOverlay: {
33
+ type: Boolean,
34
+ default: !0
35
+ },
36
+ showCloseButton: {
37
+ type: Boolean,
38
+ default: !0
39
+ }
40
+ },
41
+ emits: ["update:modelValue", "close"],
42
+ setup(t, { emit: y }) {
43
+ const o = t, d = y, v = x(() => {
44
+ const e = {
45
+ sm: "w-full max-w-sm",
46
+ md: "w-full max-w-md",
47
+ lg: "w-full max-w-lg",
48
+ xl: "w-full max-w-xl",
49
+ full: "w-full max-w-full"
50
+ };
51
+ return e[o.size] || e.md;
52
+ }), i = () => {
53
+ d("update:modelValue", !1), d("close");
54
+ }, p = () => {
55
+ o.closeOnOverlay && i();
56
+ }, r = (e) => {
57
+ e.key === "Escape" && o.modelValue && o.closeOnEsc && i();
58
+ };
59
+ return c(
60
+ () => o.modelValue,
61
+ (e) => {
62
+ typeof document > "u" || (document.body.style.overflow = e ? "hidden" : "");
63
+ }
64
+ ), c(
65
+ () => o.modelValue,
66
+ (e) => {
67
+ typeof window > "u" || (e ? window.addEventListener("keydown", r) : window.removeEventListener("keydown", r));
68
+ },
69
+ { immediate: !0 }
70
+ ), h(() => {
71
+ typeof document < "u" && (document.body.style.overflow = ""), typeof window < "u" && window.removeEventListener("keydown", r);
72
+ }), (e, u) => (l(), k(f, {
73
+ "enter-active-class": "transition-opacity duration-200 ease-out",
74
+ "leave-active-class": "transition-opacity duration-200 ease-in",
75
+ "enter-from-class": "opacity-0",
76
+ "leave-to-class": "opacity-0"
77
+ }, {
78
+ default: m(() => [
79
+ t.modelValue ? (l(), a("div", C, [
80
+ t.showOverlay ? (l(), a("div", {
81
+ key: 0,
82
+ class: "absolute inset-0 bg-black/30 backdrop-blur-[1px]",
83
+ onClick: p
84
+ })) : n("", !0),
85
+ b(f, {
86
+ "enter-active-class": "transition-transform duration-250 ease-out",
87
+ "leave-active-class": "transition-transform duration-200 ease-in",
88
+ "enter-from-class": "translate-x-full",
89
+ "leave-to-class": "translate-x-full"
90
+ }, {
91
+ default: m(() => [
92
+ t.modelValue ? (l(), a("aside", {
93
+ key: 0,
94
+ class: g([
95
+ "absolute right-0 top-0 h-full ui-surface border-l ui-border shadow-2xl flex flex-col",
96
+ v.value
97
+ ]),
98
+ role: "dialog",
99
+ "aria-modal": "true",
100
+ "aria-label": t.title
101
+ }, [
102
+ s("div", E, [
103
+ s("h3", O, B(t.title), 1),
104
+ t.showCloseButton ? (l(), a("button", {
105
+ key: 0,
106
+ class: "w-8 h-8 rounded-md ui-text-muted hover:bg-(--ui-surface-muted) hover:text-(--ui-text) transition-colors flex items-center justify-center",
107
+ onClick: i
108
+ }, [...u[0] || (u[0] = [
109
+ s("span", { class: "sr-only" }, "Close drawer", -1),
110
+ s("svg", {
111
+ class: "w-4 h-4",
112
+ fill: "none",
113
+ stroke: "currentColor",
114
+ "stroke-width": "2",
115
+ viewBox: "0 0 24 24"
116
+ }, [
117
+ s("path", {
118
+ "stroke-linecap": "round",
119
+ "stroke-linejoin": "round",
120
+ d: "M6 18L18 6M6 6l12 12"
121
+ })
122
+ ], -1)
123
+ ])])) : n("", !0)
124
+ ]),
125
+ s("div", z, [
126
+ w(e.$slots, "default")
127
+ ]),
128
+ e.$slots.footer ? (l(), a("div", L, [
129
+ w(e.$slots, "footer")
130
+ ])) : n("", !0)
131
+ ], 10, V)) : n("", !0)
132
+ ]),
133
+ _: 3
134
+ })
135
+ ])) : n("", !0)
136
+ ]),
137
+ _: 3
138
+ }));
139
+ }
140
+ };
141
+ export {
142
+ j as default
143
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),k=require("class-variance-authority"),i=require("../utils/cn.cjs"),T={class:"relative"},_={class:"absolute left-3 top-1/2 transform -translate-y-1/2 pointer-events-none"},A=["value","placeholder","disabled"],I={key:0,class:"absolute right-3 top-1/2 transform -translate-y-1/2"},$=["aria-label"],j={key:1,class:"animate-spin"},q={key:0,class:"max-h-64 overflow-y-auto"},F=["onClick","onMouseenter"],K={class:"flex-1 text-left"},O={class:"font-medium ui-text"},U={key:0,class:"text-sm ui-text truncate"},H={key:1,class:"text-xs ui-text ml-3"},P={key:1,class:"px-4 py-3 text-sm ui-text text-center"},X={key:2,class:"border-t ui-border-strong p-2"},Z={__name:"Search",props:{modelValue:{type:String,default:""},results:{type:Array,default:()=>[]},placeholder:{type:String,default:"Search..."},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},clearable:{type:Boolean,default:!0},clearLabel:{type:String,default:"Clear search"},size:{type:String,default:"md",validator:l=>["sm","md","lg"].includes(l)},debounce:{type:Number,default:300},minLength:{type:Number,default:1},showNoResults:{type:Boolean,default:!0},noResultsText:{type:String,default:"No results found"},highlightMatches:{type:Boolean,default:!0}},emits:["update:modelValue","search","select","clear","focus","blur"],setup(l,{emit:y}){const g={render(){return e.h("svg",{fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},[e.h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"})])}},b={render(){return e.h("svg",{fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},[e.h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18 18 6M6 6l12 12"})])}},x={render(){return e.h("svg",{fill:"none",viewBox:"0 0 24 24",class:"animate-spin"},[e.h("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),e.h("path",{class:"opacity-75",fill:"currentColor",d:"m4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})])}},a=l,r=y,d=e.ref(null),h=e.ref(null),s=e.ref(!1),o=e.ref(-1),u=e.ref(null),B=t=>{const c=t.target.value;r("update:modelValue",c),u.value&&clearTimeout(u.value),u.value=setTimeout(()=>{c.length>=a.minLength?(r("search",c),s.value=!0):s.value=!1},a.debounce)},w=t=>{r("focus",t),a.modelValue.length>=a.minLength&&(s.value=!0)},V=t=>{r("blur",t),setTimeout(()=>{s.value=!1,o.value=-1},150)},C=()=>{r("update:modelValue",""),r("clear"),s.value=!1,h.value?.focus()},f=t=>{r("select",t),s.value=!1,o.value=-1},N=t=>{if(!(!s.value||a.results.length===0))switch(t.key){case"ArrowDown":t.preventDefault(),o.value=Math.min(o.value+1,a.results.length-1);break;case"ArrowUp":t.preventDefault(),o.value=Math.max(o.value-1,-1);break;case"Enter":t.preventDefault(),o.value>=0&&f(a.results[o.value]);break;case"Escape":t.preventDefault(),s.value=!1,o.value=-1;break}},v=t=>{if(!a.highlightMatches||!a.modelValue||!t)return t;const c=new RegExp(`(${a.modelValue})`,"gi");return t.replace(c,"$1")},E=k.cva("block w-full rounded-lg border ui-surface transition-colors duration-200 placeholder:text-(--ui-text) disabled:bg-(--ui-surface) disabled:text-(--ui-text) disabled:cursor-not-allowed focus:outline-none focus:ring-2 focus:ring-(--ui-primary) focus:border-(--ui-primary)",{variants:{size:{sm:"px-9 py-1.5 text-sm",md:"px-10 py-2 text-sm",lg:"px-12 py-3 text-base"}},defaultVariants:{size:"md"}}),z=k.cva("ui-text",{variants:{size:{sm:"w-4 h-4",md:"w-4 h-4",lg:"w-5 h-5"}},defaultVariants:{size:"md"}}),S=e.computed(()=>i.cn(E({size:a.size}))),M=e.computed(()=>i.cn(z({size:a.size}))),R=e.computed(()=>i.cn("absolute z-50 w-full mt-1 ui-surface rounded-lg shadow-lg border ui-border-strong max-h-96 overflow-hidden")),D=t=>i.cn("flex items-center w-full px-4 py-3 text-left transition-colors duration-150 hover:bg-(--ui-surface) focus:bg-(--ui-surface) focus:outline-none",{"ui-surface-muted":o.value===t}),p=t=>{d.value&&!d.value.contains(t.target)&&(s.value=!1,o.value=-1)};return e.onMounted(()=>document.addEventListener("click",p)),e.onUnmounted(()=>{document.removeEventListener("click",p),u.value&&clearTimeout(u.value)}),e.watch(()=>a.results,()=>o.value=-1),(t,c)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"searchRef",ref:d,class:"relative"},[e.createElementVNode("div",T,[e.createElementVNode("div",_,[e.createVNode(g,{class:e.normalizeClass(M.value)},null,8,["class"])]),e.createElementVNode("input",{ref_key:"inputRef",ref:h,value:l.modelValue,placeholder:l.placeholder,disabled:l.disabled,class:e.normalizeClass(S.value),onInput:B,onFocus:w,onBlur:V,onKeydown:N},null,42,A),l.modelValue||l.loading?(e.openBlock(),e.createElementBlock("div",I,[!l.loading&&l.clearable?(e.openBlock(),e.createElementBlock("button",{key:0,class:"ui-text hover:text-(--ui-text) transition-colors p-1 rounded-full hover:bg-(--ui-surface)","aria-label":l.clearLabel,onClick:C},[e.createVNode(b,{class:"w-4 h-4"})],8,$)):l.loading?(e.openBlock(),e.createElementBlock("div",j,[e.createVNode(x,{class:"w-4 h-4 ui-text"})])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]),e.createVNode(e.Transition,{"enter-active-class":"transition-all duration-200","enter-from-class":"opacity-0 scale-95 translate-y-1","enter-to-class":"opacity-100 scale-100 translate-y-0","leave-active-class":"transition-all duration-150","leave-from-class":"opacity-100 scale-100 translate-y-0","leave-to-class":"opacity-0 scale-95 translate-y-1"},{default:e.withCtx(()=>[s.value&&(l.results.length>0||l.showNoResults)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(R.value)},[l.results.length>0?(e.openBlock(),e.createElementBlock("div",q,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.results,(n,m)=>(e.openBlock(),e.createElementBlock("button",{key:n.id||m,class:e.normalizeClass(D(m)),onClick:L=>f(n),onMouseenter:L=>o.value=m},[n.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.icon),{key:0,class:"w-4 h-4 mr-3 shrink-0"})):e.createCommentVNode("",!0),e.createElementVNode("div",K,[e.createElementVNode("div",O,e.toDisplayString(v(n.title)),1),n.description?(e.openBlock(),e.createElementBlock("div",U,e.toDisplayString(v(n.description)),1)):e.createCommentVNode("",!0)]),n.category?(e.openBlock(),e.createElementBlock("div",H,e.toDisplayString(n.category),1)):e.createCommentVNode("",!0)],42,F))),128))])):l.showNoResults?(e.openBlock(),e.createElementBlock("div",P,e.toDisplayString(l.noResultsText),1)):e.createCommentVNode("",!0),t.$slots.footer?(e.openBlock(),e.createElementBlock("div",X,[e.renderSlot(t.$slots,"footer")])):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0)]),_:3})],512))}};exports.default=Z;
@@ -0,0 +1,252 @@
1
+ import { ref as h, computed as x, onMounted as H, onUnmounted as O, watch as X, createElementBlock as o, openBlock as s, createElementVNode as v, createVNode as m, createCommentVNode as u, normalizeClass as y, Transition as Z, withCtx as q, Fragment as G, renderList as J, createBlock as P, resolveDynamicComponent as Q, toDisplayString as g, renderSlot as W, h as c } from "vue";
2
+ import { cva as B } from "class-variance-authority";
3
+ import { cn as p } from "../utils/cn.js";
4
+ const Y = { class: "relative" }, ee = { class: "absolute left-3 top-1/2 transform -translate-y-1/2 pointer-events-none" }, te = ["value", "placeholder", "disabled"], le = {
5
+ key: 0,
6
+ class: "absolute right-3 top-1/2 transform -translate-y-1/2"
7
+ }, ae = ["aria-label"], se = {
8
+ key: 1,
9
+ class: "animate-spin"
10
+ }, oe = {
11
+ key: 0,
12
+ class: "max-h-64 overflow-y-auto"
13
+ }, ne = ["onClick", "onMouseenter"], re = { class: "flex-1 text-left" }, ue = { class: "font-medium ui-text" }, ie = {
14
+ key: 0,
15
+ class: "text-sm ui-text truncate"
16
+ }, ce = {
17
+ key: 1,
18
+ class: "text-xs ui-text ml-3"
19
+ }, de = {
20
+ key: 1,
21
+ class: "px-4 py-3 text-sm ui-text text-center"
22
+ }, fe = {
23
+ key: 2,
24
+ class: "border-t ui-border-strong p-2"
25
+ }, ye = {
26
+ __name: "Search",
27
+ props: {
28
+ modelValue: { type: String, default: "" },
29
+ results: { type: Array, default: () => [] },
30
+ placeholder: { type: String, default: "Search..." },
31
+ disabled: { type: Boolean, default: !1 },
32
+ loading: { type: Boolean, default: !1 },
33
+ clearable: { type: Boolean, default: !0 },
34
+ clearLabel: { type: String, default: "Clear search" },
35
+ size: {
36
+ type: String,
37
+ default: "md",
38
+ validator: (t) => ["sm", "md", "lg"].includes(t)
39
+ },
40
+ debounce: { type: Number, default: 300 },
41
+ minLength: { type: Number, default: 1 },
42
+ showNoResults: { type: Boolean, default: !0 },
43
+ noResultsText: { type: String, default: "No results found" },
44
+ highlightMatches: { type: Boolean, default: !0 }
45
+ },
46
+ emits: [
47
+ "update:modelValue",
48
+ "search",
49
+ "select",
50
+ "clear",
51
+ "focus",
52
+ "blur"
53
+ ],
54
+ setup(t, { emit: R }) {
55
+ const M = {
56
+ render() {
57
+ return c("svg", {
58
+ fill: "none",
59
+ viewBox: "0 0 24 24",
60
+ "stroke-width": "1.5",
61
+ stroke: "currentColor"
62
+ }, [
63
+ c("path", {
64
+ "stroke-linecap": "round",
65
+ "stroke-linejoin": "round",
66
+ d: "m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"
67
+ })
68
+ ]);
69
+ }
70
+ }, S = {
71
+ render() {
72
+ return c("svg", {
73
+ fill: "none",
74
+ viewBox: "0 0 24 24",
75
+ "stroke-width": "1.5",
76
+ stroke: "currentColor"
77
+ }, [
78
+ c("path", {
79
+ "stroke-linecap": "round",
80
+ "stroke-linejoin": "round",
81
+ d: "M6 18 18 6M6 6l12 12"
82
+ })
83
+ ]);
84
+ }
85
+ }, L = {
86
+ render() {
87
+ return c("svg", {
88
+ fill: "none",
89
+ viewBox: "0 0 24 24",
90
+ class: "animate-spin"
91
+ }, [
92
+ c("circle", {
93
+ class: "opacity-25",
94
+ cx: "12",
95
+ cy: "12",
96
+ r: "10",
97
+ stroke: "currentColor",
98
+ "stroke-width": "4"
99
+ }),
100
+ c("path", {
101
+ class: "opacity-75",
102
+ fill: "currentColor",
103
+ d: "m4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
104
+ })
105
+ ]);
106
+ }
107
+ }, l = t, i = R, b = h(null), w = h(null), n = h(!1), a = h(-1), f = h(null), N = (e) => {
108
+ const d = e.target.value;
109
+ i("update:modelValue", d), f.value && clearTimeout(f.value), f.value = setTimeout(() => {
110
+ d.length >= l.minLength ? (i("search", d), n.value = !0) : n.value = !1;
111
+ }, l.debounce);
112
+ }, T = (e) => {
113
+ i("focus", e), l.modelValue.length >= l.minLength && (n.value = !0);
114
+ }, D = (e) => {
115
+ i("blur", e), setTimeout(() => {
116
+ n.value = !1, a.value = -1;
117
+ }, 150);
118
+ }, E = () => {
119
+ i("update:modelValue", ""), i("clear"), n.value = !1, w.value?.focus();
120
+ }, C = (e) => {
121
+ i("select", e), n.value = !1, a.value = -1;
122
+ }, I = (e) => {
123
+ if (!(!n.value || l.results.length === 0))
124
+ switch (e.key) {
125
+ case "ArrowDown":
126
+ e.preventDefault(), a.value = Math.min(a.value + 1, l.results.length - 1);
127
+ break;
128
+ case "ArrowUp":
129
+ e.preventDefault(), a.value = Math.max(a.value - 1, -1);
130
+ break;
131
+ case "Enter":
132
+ e.preventDefault(), a.value >= 0 && C(l.results[a.value]);
133
+ break;
134
+ case "Escape":
135
+ e.preventDefault(), n.value = !1, a.value = -1;
136
+ break;
137
+ }
138
+ }, V = (e) => {
139
+ if (!l.highlightMatches || !l.modelValue || !e) return e;
140
+ const d = new RegExp(`(${l.modelValue})`, "gi");
141
+ return e.replace(d, "$1");
142
+ }, $ = B(
143
+ "block w-full rounded-lg border ui-surface transition-colors duration-200 placeholder:text-(--ui-text) disabled:bg-(--ui-surface) disabled:text-(--ui-text) disabled:cursor-not-allowed focus:outline-none focus:ring-2 focus:ring-(--ui-primary) focus:border-(--ui-primary)",
144
+ {
145
+ variants: {
146
+ size: {
147
+ sm: "px-9 py-1.5 text-sm",
148
+ md: "px-10 py-2 text-sm",
149
+ lg: "px-12 py-3 text-base"
150
+ }
151
+ },
152
+ defaultVariants: { size: "md" }
153
+ }
154
+ ), A = B("ui-text", {
155
+ variants: {
156
+ size: {
157
+ sm: "w-4 h-4",
158
+ md: "w-4 h-4",
159
+ lg: "w-5 h-5"
160
+ }
161
+ },
162
+ defaultVariants: { size: "md" }
163
+ }), _ = x(() => p($({ size: l.size }))), F = x(() => p(A({ size: l.size }))), j = x(
164
+ () => p("absolute z-50 w-full mt-1 ui-surface rounded-lg shadow-lg border ui-border-strong max-h-96 overflow-hidden")
165
+ ), K = (e) => p(
166
+ "flex items-center w-full px-4 py-3 text-left transition-colors duration-150 hover:bg-(--ui-surface) focus:bg-(--ui-surface) focus:outline-none",
167
+ { "ui-surface-muted": a.value === e }
168
+ ), z = (e) => {
169
+ b.value && !b.value.contains(e.target) && (n.value = !1, a.value = -1);
170
+ };
171
+ return H(() => document.addEventListener("click", z)), O(() => {
172
+ document.removeEventListener("click", z), f.value && clearTimeout(f.value);
173
+ }), X(() => l.results, () => a.value = -1), (e, d) => (s(), o("div", {
174
+ ref_key: "searchRef",
175
+ ref: b,
176
+ class: "relative"
177
+ }, [
178
+ v("div", Y, [
179
+ v("div", ee, [
180
+ m(M, {
181
+ class: y(F.value)
182
+ }, null, 8, ["class"])
183
+ ]),
184
+ v("input", {
185
+ ref_key: "inputRef",
186
+ ref: w,
187
+ value: t.modelValue,
188
+ placeholder: t.placeholder,
189
+ disabled: t.disabled,
190
+ class: y(_.value),
191
+ onInput: N,
192
+ onFocus: T,
193
+ onBlur: D,
194
+ onKeydown: I
195
+ }, null, 42, te),
196
+ t.modelValue || t.loading ? (s(), o("div", le, [
197
+ !t.loading && t.clearable ? (s(), o("button", {
198
+ key: 0,
199
+ class: "ui-text hover:text-(--ui-text) transition-colors p-1 rounded-full hover:bg-(--ui-surface)",
200
+ "aria-label": t.clearLabel,
201
+ onClick: E
202
+ }, [
203
+ m(S, { class: "w-4 h-4" })
204
+ ], 8, ae)) : t.loading ? (s(), o("div", se, [
205
+ m(L, { class: "w-4 h-4 ui-text" })
206
+ ])) : u("", !0)
207
+ ])) : u("", !0)
208
+ ]),
209
+ m(Z, {
210
+ "enter-active-class": "transition-all duration-200",
211
+ "enter-from-class": "opacity-0 scale-95 translate-y-1",
212
+ "enter-to-class": "opacity-100 scale-100 translate-y-0",
213
+ "leave-active-class": "transition-all duration-150",
214
+ "leave-from-class": "opacity-100 scale-100 translate-y-0",
215
+ "leave-to-class": "opacity-0 scale-95 translate-y-1"
216
+ }, {
217
+ default: q(() => [
218
+ n.value && (t.results.length > 0 || t.showNoResults) ? (s(), o("div", {
219
+ key: 0,
220
+ class: y(j.value)
221
+ }, [
222
+ t.results.length > 0 ? (s(), o("div", oe, [
223
+ (s(!0), o(G, null, J(t.results, (r, k) => (s(), o("button", {
224
+ key: r.id || k,
225
+ class: y(K(k)),
226
+ onClick: (U) => C(r),
227
+ onMouseenter: (U) => a.value = k
228
+ }, [
229
+ r.icon ? (s(), P(Q(r.icon), {
230
+ key: 0,
231
+ class: "w-4 h-4 mr-3 shrink-0"
232
+ })) : u("", !0),
233
+ v("div", re, [
234
+ v("div", ue, g(V(r.title)), 1),
235
+ r.description ? (s(), o("div", ie, g(V(r.description)), 1)) : u("", !0)
236
+ ]),
237
+ r.category ? (s(), o("div", ce, g(r.category), 1)) : u("", !0)
238
+ ], 42, ne))), 128))
239
+ ])) : t.showNoResults ? (s(), o("div", de, g(t.noResultsText), 1)) : u("", !0),
240
+ e.$slots.footer ? (s(), o("div", fe, [
241
+ W(e.$slots, "footer")
242
+ ])) : u("", !0)
243
+ ], 2)) : u("", !0)
244
+ ]),
245
+ _: 3
246
+ })
247
+ ], 512));
248
+ }
249
+ };
250
+ export {
251
+ ye as default
252
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),W=require("class-variance-authority"),C=require("../utils/cn.cjs"),$=["id","name","value","disabled","required"],q={key:1,class:"relative"},z=["id","disabled"],A={key:0,class:"ui-text-muted"},T={key:1,class:"ui-text"},K={class:"px-3 py-2 border-b ui-border"},_=["onKeydown"],G=["onClick"],U={class:"block font-normal truncate"},X={key:0,class:"absolute inset-y-0 right-0 flex items-center pr-4 ui-primary"},j={key:1,class:"px-4 py-3 text-sm ui-text text-center"},F={key:2,class:"px-4 py-3"},u=12,m=4,D=320,Q=180,Z=10050,J={__name:"Select",props:{modelValue:{type:[String,Number,Boolean],default:""},options:{type:Array,default:()=>[]},placeholder:{type:String,default:null},hasError:{type:Boolean,default:!1},id:{type:String,default:null},name:{type:String,default:null},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},allowCreate:{type:Boolean,default:!1},class:String},emits:["update:modelValue"],setup(a,{emit:M}){const l=a,w=M,i=e.ref(!1),r=e.ref(""),h=e.ref(null),c=e.ref(null),v=e.ref(null),s=e.ref([...l.options]),g=e.ref({}),k=e.computed(()=>l.options.find(t=>t.value===l.modelValue)),N=W.cva("border ui-border-strong rounded-md focus:outline-none focus:ring-2 focus:ring-(--ui-primary) text-sm min-w-[60px] focus:border-transparent ",{variants:{disabled:{true:"ui-surface-muted cursor-not-allowed opacity-50",false:"ui-surface hover:border-(--ui-border-strong)"}}}),O=e.computed(()=>C.cn(N({disabled:l.disabled}),"px-3 py-2",l.class)),S=e.computed(()=>C.cn("w-full px-3 py-2 text-left border rounded-md focus:outline-none focus:ring-2 focus:ring-(--ui-primary) ui-surface ",l.hasError?"border-(--ui-danger)":"ui-border",l.disabled?"ui-surface-muted cursor-not-allowed opacity-50":"hover:border-(--ui-border-strong)",l.class)),d=()=>{if(!c.value||!i.value)return;const t=c.value.getBoundingClientRect(),o=window.innerWidth,n=window.innerHeight,p=Math.max(0,n-t.bottom-m-u),E=Math.max(0,t.top-m-u),V=E>p,H=Math.max(Math.min(D,V?E:p),Math.min(Q,D)),R=Math.max(0,o-u*2),b=Math.min(t.width,R);let f=t.left;f+b>o-u&&(f=o-u-b),f<u&&(f=u),g.value={position:"fixed",left:`${f}px`,width:`${b}px`,maxHeight:`${H}px`,zIndex:Z,...V?{bottom:`${n-t.top+m}px`}:{top:`${t.bottom+m}px`}}},I=()=>{l.disabled||(i.value=!i.value,i.value&&(d(),e.nextTick(()=>{h.value?.focus()})))},L=t=>{w("update:modelValue",t),i.value=!1,r.value="",s.value=[...l.options]},x=t=>{if(t&&(t.stopPropagation(),t.preventDefault()),l.allowCreate&&r.value.trim()){const o=r.value.trim();w("update:modelValue",o),i.value=!1,r.value="",s.value=[...l.options]}},P=()=>{if(!r.value.trim())s.value=[...l.options];else{const t=r.value.toLowerCase();s.value=l.options.filter(o=>o.label.toLowerCase().includes(t))}},y=t=>{t.key==="Escape"?(i.value=!1,r.value="",s.value=[...l.options]):t.key==="Enter"&&l.allowCreate&&r.value.trim()&&s.value.length===0&&(t.preventDefault(),x(t))},B=t=>{if(!c.value)return;const o=t.target,n=v.value&&v.value.contains(o),p=c.value.contains(o);!n&&!p&&(i.value=!1,r.value="",s.value=[...l.options])};return e.onMounted(()=>{document.addEventListener("click",B),window.addEventListener("scroll",d,!0),window.addEventListener("resize",d)}),e.onUnmounted(()=>{document.removeEventListener("click",B),window.removeEventListener("scroll",d,!0),window.removeEventListener("resize",d)}),e.watch(()=>l.options,t=>{s.value=[...t]},{immediate:!0}),e.watch(i,t=>{t&&d()}),(t,o)=>!a.options||a.options.length===0?(e.openBlock(),e.createElementBlock("select",e.mergeProps({key:0,id:a.id,name:a.name,value:a.modelValue,disabled:a.disabled,required:a.required,class:O.value},t.$attrs,{onChange:o[0]||(o[0]=n=>t.$emit("update:modelValue",n.target.value))}),[e.renderSlot(t.$slots,"default")],16,$)):(e.openBlock(),e.createElementBlock("div",q,[e.createElementVNode("button",{id:a.id,ref_key:"buttonRef",ref:c,type:"button",disabled:a.disabled,class:e.normalizeClass(S.value),onClick:I,onKeydown:y},[k.value?(e.openBlock(),e.createElementBlock("div",T,e.toDisplayString(k.value.label),1)):(e.openBlock(),e.createElementBlock("div",A,e.toDisplayString(a.placeholder||"Select an option"),1)),o[4]||(o[4]=e.createElementVNode("svg",{class:"absolute right-2 top-2.5 h-5 w-5 ui-text",fill:"currentColor",viewBox:"0 0 20 20"},[e.createElementVNode("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1))],42,z),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[i.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:v,style:e.normalizeStyle(g.value),"data-select-dropdown":"",class:"ui-surface border ui-border-strong shadow-lg rounded-md py-1 text-base overflow-hidden focus:outline-none flex flex-col overscroll-contain"},[e.createElementVNode("div",K,[e.withDirectives(e.createElementVNode("input",{ref_key:"searchInput",ref:h,"onUpdate:modelValue":o[1]||(o[1]=n=>r.value=n),type:"text",placeholder:"Search options...",class:"w-full px-2 py-1 text-sm border ui-border-strong rounded focus:outline-none focus:ring-1 focus:ring-(--ui-primary) ui-surface placeholder:text-(--ui-text-muted)",onInput:P,onKeydown:[y,e.withKeys(e.withModifiers(y,["prevent"]),["enter"])]},null,40,_),[[e.vModelText,r.value]])]),s.value.length>0?(e.openBlock(),e.createElementBlock("div",{key:0,class:"overflow-y-auto flex-1 overscroll-contain",onWheel:o[2]||(o[2]=e.withModifiers(()=>{},["stop"]))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,n=>(e.openBlock(),e.createElementBlock("button",{key:n.value,type:"button",class:e.normalizeClass(["cursor-pointer select-none relative py-2 pl-3 pr-9 w-full text-left hover:bg-(--ui-primary-soft) focus:bg-(--ui-primary-soft) focus:outline-none transition-colors duration-150",{"ui-primary-soft ui-primary":a.modelValue===n.value}]),onClick:e.withModifiers(p=>L(n.value),["stop"])},[e.createElementVNode("span",U,e.toDisplayString(n.label),1),a.modelValue===n.value?(e.openBlock(),e.createElementBlock("span",X,[...o[5]||(o[5]=[e.createElementVNode("svg",{class:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20"},[e.createElementVNode("path",{"fill-rule":"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z","clip-rule":"evenodd"})],-1)])])):e.createCommentVNode("",!0)],10,G))),128))],32)):l.allowCreate?(e.openBlock(),e.createElementBlock("div",F,[e.createElementVNode("button",{type:"button",class:"w-full text-left px-2 py-1 text-sm ui-primary hover:bg-(--ui-primary-soft) rounded cursor-pointer transition-colors",onClick:e.withModifiers(x,["stop"]),onMousedown:o[3]||(o[3]=e.withModifiers(()=>{},["prevent"]))},' Create "'+e.toDisplayString(r.value)+'" ',33)])):(e.openBlock(),e.createElementBlock("div",j," No options found "))],4)):e.createCommentVNode("",!0)]))]))}};exports.default=J;