@gspa/ui 0.1.3 → 0.2.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 (280) hide show
  1. package/README.md +35 -0
  2. package/dist/Button.vue_vue_type_script_setup_true_lang-B3TkBTvG.js +205 -0
  3. package/dist/Button.vue_vue_type_script_setup_true_lang-DZxttvYH.cjs +1 -0
  4. package/dist/DataTable.css +1 -0
  5. package/dist/DataTableToolBar.css +1 -0
  6. package/dist/FormField.vue_vue_type_script_setup_true_lang-DimMUyA-.js +205 -0
  7. package/dist/FormField.vue_vue_type_script_setup_true_lang-mEO-VA6R.cjs +1 -0
  8. package/dist/Header.css +1 -0
  9. package/dist/Input.vue_vue_type_script_setup_true_lang-C1OQn24h.cjs +1 -0
  10. package/dist/Input.vue_vue_type_script_setup_true_lang-CpBoY97r.js +137 -0
  11. package/dist/Loader.css +1 -0
  12. package/dist/ReminderConfig.css +1 -0
  13. package/dist/ReusableForm.css +1 -0
  14. package/dist/Sidebar.css +1 -0
  15. package/dist/Toast.css +1 -0
  16. package/dist/_plugin-vue_export-helper-BHFhmbuH.cjs +1 -0
  17. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  18. package/dist/components/Accordion.cjs +1 -0
  19. package/dist/components/Accordion.js +192 -0
  20. package/dist/components/AccordionItem.cjs +1 -0
  21. package/dist/components/AccordionItem.js +109 -0
  22. package/dist/components/AddReminderModal.cjs +1 -0
  23. package/dist/components/AddReminderModal.js +107 -0
  24. package/dist/components/Alert.cjs +1 -0
  25. package/dist/components/Alert.js +227 -0
  26. package/dist/components/Avatar.cjs +1 -0
  27. package/dist/components/Avatar.js +86 -0
  28. package/dist/components/Badge.cjs +1 -0
  29. package/dist/components/Badge.js +109 -0
  30. package/dist/components/Breadcrumb.cjs +1 -0
  31. package/dist/components/Breadcrumb.js +72 -0
  32. package/dist/components/Button.cjs +1 -0
  33. package/dist/components/Button.js +4 -0
  34. package/dist/components/ButtonGroup.cjs +1 -0
  35. package/dist/components/ButtonGroup.js +46 -0
  36. package/dist/components/Calendar.cjs +1 -0
  37. package/dist/components/Calendar.js +341 -0
  38. package/dist/components/Card.cjs +1 -0
  39. package/dist/components/Card.js +316 -0
  40. package/dist/components/CardBody.cjs +1 -0
  41. package/dist/components/CardBody.js +34 -0
  42. package/dist/components/CardContent.cjs +1 -0
  43. package/dist/components/CardContent.js +17 -0
  44. package/dist/components/CardFooter.cjs +1 -0
  45. package/dist/components/CardFooter.js +34 -0
  46. package/dist/components/CardHeader.cjs +1 -0
  47. package/dist/components/CardHeader.js +91 -0
  48. package/dist/components/CardTitle.cjs +1 -0
  49. package/dist/components/CardTitle.js +17 -0
  50. package/dist/components/Checkbox.cjs +1 -0
  51. package/dist/components/Checkbox.js +185 -0
  52. package/dist/components/CircularProgress.cjs +1 -0
  53. package/dist/components/CircularProgress.js +141 -0
  54. package/dist/components/DataTable.cjs +1 -0
  55. package/dist/components/DataTable.js +863 -0
  56. package/dist/components/DataTableCell.cjs +1 -0
  57. package/dist/components/DataTableCell.js +95 -0
  58. package/dist/components/DataTableFilters.cjs +1 -0
  59. package/dist/components/DataTableFilters.js +519 -0
  60. package/dist/components/DataTableHeader.cjs +1 -0
  61. package/dist/components/DataTableHeader.js +116 -0
  62. package/dist/components/DataTablePagination.cjs +1 -0
  63. package/dist/components/DataTablePagination.js +290 -0
  64. package/dist/components/DataTableRow.cjs +1 -0
  65. package/dist/components/DataTableRow.js +199 -0
  66. package/dist/components/DataTableToolBar.cjs +1 -0
  67. package/dist/components/DataTableToolBar.js +477 -0
  68. package/dist/components/DatePicker.cjs +1 -0
  69. package/dist/components/DatePicker.js +401 -0
  70. package/dist/components/Divider.cjs +1 -0
  71. package/dist/components/Divider.js +103 -0
  72. package/dist/components/Dropdown.cjs +1 -0
  73. package/dist/components/Dropdown.js +104 -0
  74. package/dist/components/DropdownItem.cjs +1 -0
  75. package/dist/components/DropdownItem.js +60 -0
  76. package/dist/components/EventsCalendar.cjs +1 -0
  77. package/dist/components/EventsCalendar.js +863 -0
  78. package/dist/components/FileUpload.cjs +1 -0
  79. package/dist/components/FileUpload.js +195 -0
  80. package/dist/components/FilterDrawer.cjs +1 -0
  81. package/dist/components/FilterDrawer.js +412 -0
  82. package/dist/components/Footer.cjs +1 -0
  83. package/dist/components/Footer.js +157 -0
  84. package/dist/components/FormField.cjs +1 -0
  85. package/dist/components/FormField.js +4 -0
  86. package/dist/components/Graph.cjs +1 -0
  87. package/dist/components/Graph.js +164 -0
  88. package/dist/components/GraphFilters.cjs +1 -0
  89. package/dist/components/GraphFilters.js +305 -0
  90. package/dist/components/Header.cjs +1 -0
  91. package/dist/components/Header.js +674 -0
  92. package/dist/components/Icon.cjs +1 -0
  93. package/dist/components/Icon.js +58 -0
  94. package/dist/components/Image.cjs +1 -0
  95. package/dist/components/Image.js +112 -0
  96. package/dist/components/Input.cjs +1 -0
  97. package/dist/components/Input.js +4 -0
  98. package/dist/components/InputGroup.cjs +1 -0
  99. package/dist/components/InputGroup.js +45 -0
  100. package/dist/components/Label.cjs +1 -0
  101. package/dist/components/Label.js +46 -0
  102. package/dist/components/Link.cjs +1 -0
  103. package/dist/components/Link.js +119 -0
  104. package/dist/components/ListItem.cjs +1 -0
  105. package/dist/components/ListItem.js +89 -0
  106. package/dist/components/Loader.cjs +1 -0
  107. package/dist/components/Loader.js +154 -0
  108. package/dist/components/Logo.cjs +1 -0
  109. package/dist/components/Logo.js +67 -0
  110. package/dist/components/MenuItem.cjs +1 -0
  111. package/dist/components/MenuItem.js +66 -0
  112. package/dist/components/Modal.cjs +1 -0
  113. package/dist/components/Modal.js +110 -0
  114. package/dist/components/ModalBody.cjs +1 -0
  115. package/dist/components/ModalBody.js +33 -0
  116. package/dist/components/ModalFooter.cjs +1 -0
  117. package/dist/components/ModalFooter.js +33 -0
  118. package/dist/components/ModalHeader.cjs +1 -0
  119. package/dist/components/ModalHeader.js +24 -0
  120. package/dist/components/MultiSelect.cjs +1 -0
  121. package/dist/components/MultiSelect.js +211 -0
  122. package/dist/components/Notification.cjs +1 -0
  123. package/dist/components/Notification.js +121 -0
  124. package/dist/components/Option.cjs +1 -0
  125. package/dist/components/Option.js +44 -0
  126. package/dist/components/Progress.cjs +1 -0
  127. package/dist/components/Progress.js +77 -0
  128. package/dist/components/ProgressBar.cjs +1 -0
  129. package/dist/components/ProgressBar.js +101 -0
  130. package/dist/components/Radio.cjs +1 -0
  131. package/dist/components/Radio.js +81 -0
  132. package/dist/components/RailNav.cjs +1 -0
  133. package/dist/components/RailNav.js +124 -0
  134. package/dist/components/ReminderConfig.cjs +1 -0
  135. package/dist/components/ReminderConfig.js +375 -0
  136. package/dist/components/ReusableForm.cjs +1 -0
  137. package/dist/components/ReusableForm.js +686 -0
  138. package/dist/components/ReusableFormModal.cjs +1 -0
  139. package/dist/components/ReusableFormModal.js +112 -0
  140. package/dist/components/RightDrawer.cjs +1 -0
  141. package/dist/components/RightDrawer.js +143 -0
  142. package/dist/components/Search.cjs +1 -0
  143. package/dist/components/Search.js +252 -0
  144. package/dist/components/Select.cjs +1 -0
  145. package/dist/components/Select.js +243 -0
  146. package/dist/components/Sidebar.cjs +1 -0
  147. package/dist/components/Sidebar.js +372 -0
  148. package/dist/components/Slider.cjs +1 -0
  149. package/dist/components/Slider.js +42 -0
  150. package/dist/components/Spinner.cjs +1 -0
  151. package/dist/components/Spinner.js +87 -0
  152. package/dist/components/Stepper.cjs +1 -0
  153. package/dist/components/Stepper.js +12 -0
  154. package/dist/components/StepperItem.cjs +1 -0
  155. package/dist/components/StepperItem.js +33 -0
  156. package/dist/components/Switch.cjs +1 -0
  157. package/dist/components/Switch.js +112 -0
  158. package/dist/components/Tab.cjs +1 -0
  159. package/dist/components/Tab.js +134 -0
  160. package/dist/components/TabPanel.cjs +1 -0
  161. package/dist/components/TabPanel.js +49 -0
  162. package/dist/components/Text.cjs +1 -0
  163. package/dist/components/Text.js +84 -0
  164. package/dist/components/Textarea.cjs +1 -0
  165. package/dist/components/Textarea.js +102 -0
  166. package/dist/components/ThemeConfigurator.cjs +1 -0
  167. package/dist/components/ThemeConfigurator.js +73 -0
  168. package/dist/components/Timeline.cjs +1 -0
  169. package/dist/components/Timeline.js +24 -0
  170. package/dist/components/TimelineItem.cjs +1 -0
  171. package/dist/components/TimelineItem.js +63 -0
  172. package/dist/components/Toast.cjs +1 -0
  173. package/dist/components/Toast.js +231 -0
  174. package/dist/components/Tooltip.cjs +1 -0
  175. package/dist/components/Tooltip.js +124 -0
  176. package/dist/components/Typography.cjs +1 -0
  177. package/dist/components/Typography.js +267 -0
  178. package/dist/components/charts/BarChart.cjs +1 -0
  179. package/dist/components/charts/BarChart.js +323 -0
  180. package/dist/components/charts/LineChart.cjs +1 -0
  181. package/dist/components/charts/LineChart.js +322 -0
  182. package/dist/components/charts/PieChart.cjs +1 -0
  183. package/dist/components/charts/PieChart.js +311 -0
  184. package/dist/components/charts/StackedBarChart.cjs +1 -0
  185. package/dist/components/charts/StackedBarChart.js +348 -0
  186. package/dist/components/widgets/DashboardWidget.cjs +1 -0
  187. package/dist/components/widgets/DashboardWidget.js +309 -0
  188. package/dist/directives/tooltip.cjs +47 -0
  189. package/dist/directives/tooltip.js +115 -0
  190. package/dist/gspa-ui.css +1 -1
  191. package/dist/index.cjs +1 -0
  192. package/dist/index.esm.js +315 -19546
  193. package/dist/layouts/AuthLayout.cjs +1 -0
  194. package/dist/layouts/AuthLayout.js +188 -0
  195. package/dist/layouts/DashboardLayout.cjs +1 -0
  196. package/dist/layouts/DashboardLayout.js +244 -0
  197. package/dist/layouts/DefaultLayout.cjs +1 -0
  198. package/dist/layouts/DefaultLayout.js +94 -0
  199. package/dist/layouts/ErrorLayout.cjs +1 -0
  200. package/dist/layouts/ErrorLayout.js +452 -0
  201. package/dist/lib/auth.cjs +1 -0
  202. package/dist/lib/auth.js +4 -0
  203. package/dist/lib/form-field.cjs +1 -0
  204. package/dist/lib/form-field.js +4 -0
  205. package/dist/lib/icon.cjs +1 -0
  206. package/dist/lib/icon.js +4 -0
  207. package/dist/lib/theme.cjs +1 -0
  208. package/dist/lib/theme.js +145 -0
  209. package/dist/lib/toast.cjs +1 -0
  210. package/dist/lib/toast.js +81 -0
  211. package/dist/src/components/Alert.vue.d.ts.map +1 -1
  212. package/dist/src/components/Button.vue.d.ts +127 -29
  213. package/dist/src/components/Button.vue.d.ts.map +1 -1
  214. package/dist/src/components/Checkbox.vue.d.ts +2 -2
  215. package/dist/src/components/DataTable.vue.d.ts +1 -1
  216. package/dist/src/components/FormField.vue.d.ts +106 -38
  217. package/dist/src/components/FormField.vue.d.ts.map +1 -1
  218. package/dist/src/components/Icon.vue.d.ts.map +1 -1
  219. package/dist/src/components/Input.vue.d.ts +137 -33
  220. package/dist/src/components/Input.vue.d.ts.map +1 -1
  221. package/dist/src/components/ReusableForm.vue.d.ts +1 -1
  222. package/dist/src/components/ReusableForm.vue.d.ts.map +1 -1
  223. package/dist/src/components/ReusableFormModal.vue.d.ts +1 -1
  224. package/dist/src/components/Textarea.vue.d.ts +2 -2
  225. package/dist/src/index.d.ts +9 -4
  226. package/dist/src/index.d.ts.map +1 -1
  227. package/dist/src/layouts/AuthLayout.vue.d.ts +2 -0
  228. package/dist/src/layouts/AuthLayout.vue.d.ts.map +1 -1
  229. package/dist/src/lib/form-field.d.ts +2 -0
  230. package/dist/src/lib/form-field.d.ts.map +1 -0
  231. package/dist/src/lib/icon.d.ts +2 -0
  232. package/dist/src/lib/icon.d.ts.map +1 -0
  233. package/dist/src/lib/theme.d.ts +4 -0
  234. package/dist/src/lib/theme.d.ts.map +1 -1
  235. package/dist/src/types.d.ts +44 -0
  236. package/dist/src/types.d.ts.map +1 -0
  237. package/dist/styles/auth-layout.css +1 -0
  238. package/dist/styles/button.css +1 -0
  239. package/dist/styles/form-field.css +1 -0
  240. package/dist/styles/input.css +1 -0
  241. package/dist/styles/tokens.css +1 -0
  242. package/dist/tsconfig.tsbuildinfo +1 -1
  243. package/dist/utils/cn.cjs +1 -0
  244. package/dist/utils/cn.js +7 -0
  245. package/package.json +45 -8
  246. package/dist/index.js +0 -605
  247. package/dist/src/__tests__/Alert.spec.d.ts +0 -2
  248. package/dist/src/__tests__/Alert.spec.d.ts.map +0 -1
  249. package/dist/src/__tests__/App.spec.d.ts +0 -2
  250. package/dist/src/__tests__/App.spec.d.ts.map +0 -1
  251. package/dist/src/__tests__/AuthLayout.spec.d.ts +0 -2
  252. package/dist/src/__tests__/AuthLayout.spec.d.ts.map +0 -1
  253. package/dist/src/__tests__/Badge.spec.d.ts +0 -2
  254. package/dist/src/__tests__/Badge.spec.d.ts.map +0 -1
  255. package/dist/src/__tests__/Button.spec.d.ts +0 -2
  256. package/dist/src/__tests__/Button.spec.d.ts.map +0 -1
  257. package/dist/src/__tests__/Card.spec.d.ts +0 -2
  258. package/dist/src/__tests__/Card.spec.d.ts.map +0 -1
  259. package/dist/src/__tests__/Checkbox.spec.d.ts +0 -2
  260. package/dist/src/__tests__/Checkbox.spec.d.ts.map +0 -1
  261. package/dist/src/__tests__/Dropdown.spec.d.ts +0 -2
  262. package/dist/src/__tests__/Dropdown.spec.d.ts.map +0 -1
  263. package/dist/src/__tests__/Input.spec.d.ts +0 -2
  264. package/dist/src/__tests__/Input.spec.d.ts.map +0 -1
  265. package/dist/src/__tests__/Modal.spec.d.ts +0 -2
  266. package/dist/src/__tests__/Modal.spec.d.ts.map +0 -1
  267. package/dist/src/__tests__/Radio.spec.d.ts +0 -2
  268. package/dist/src/__tests__/Radio.spec.d.ts.map +0 -1
  269. package/dist/src/__tests__/ReusableForm.spec.d.ts +0 -2
  270. package/dist/src/__tests__/ReusableForm.spec.d.ts.map +0 -1
  271. package/dist/src/__tests__/Tabs.spec.d.ts +0 -2
  272. package/dist/src/__tests__/Tabs.spec.d.ts.map +0 -1
  273. package/dist/src/__tests__/integration/CardIntegration.spec.d.ts +0 -2
  274. package/dist/src/__tests__/integration/CardIntegration.spec.d.ts.map +0 -1
  275. package/dist/src/__tests__/integration/FormIntegration.spec.d.ts +0 -2
  276. package/dist/src/__tests__/integration/FormIntegration.spec.d.ts.map +0 -1
  277. package/dist/src/__tests__/integration/ModalIntegration.spec.d.ts +0 -2
  278. package/dist/src/__tests__/integration/ModalIntegration.spec.d.ts.map +0 -1
  279. package/dist/src/__tests__/integration/NavigationIntegration.spec.d.ts +0 -2
  280. package/dist/src/__tests__/integration/NavigationIntegration.spec.d.ts.map +0 -1
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),w={class:"w-full flex flex-col"},E={class:"px-4 py-3 border-b ui-border-strong"},L={class:"text-sm font-semibold uppercase tracking-wide ui-text"},N={class:"flex-1 overflow-y-auto"},C={key:0,class:"px-3 py-2 space-y-2"},I={key:1,class:"px-4 py-3 text-sm ui-text"},V={key:2,class:"py-1","aria-label":"Rail navigation"},z=["title","aria-current","onClick"],O={class:"h-8 w-8 rounded-full overflow-hidden border ui-border-strong ui-surface-muted flex items-center justify-center text-xs font-semibold ui-text"},A=["src","alt"],K={key:1},j={class:"truncate text-sm"},D={__name:"RailNav",props:{items:{type:Array,default:()=>[]},activeKey:{type:[String,Number],default:null},title:{type:String,default:"Navigation"},setupLabel:{type:String,default:"Setup"},showSetup:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},heightOffset:{type:[String,Number],default:"4rem"},desktopOnly:{type:Boolean,default:!0},resolveLogo:{type:Function,default:null}},emits:["select","setup-click"],setup(r,{emit:k}){const c=new Map,u=new Map,s=r,f=k,i=e.ref({}),b=e.computed(()=>({height:`calc(100vh - ${(typeof s.heightOffset=="number"?`${s.heightOffset}px`:s.heightOffset)||"0px"})`})),d=(t,n)=>t?.code??t?.id??t?.company_id??t?.key??n,p=t=>t?.code??t?.body??t?.name??t?.label??t?.company_name??"Item",g=t=>t?.logo_id??t?.logoId??t?.company_logo_id??t?.companyLogoId??t?.logo?.id??t?.logo?.data?.id??null,v=t=>{const n=String(p(t)||"").trim();return n&&n.split(/\s+/).filter(Boolean).slice(0,2).map(l=>l.charAt(0).toUpperCase()).join("")||"C"},y=(t,n)=>String(d(t,n))===String(s.activeKey??""),S=t=>String(t?.color_code||t?.colorCode||"#94A3B8"),B=async(t,n)=>{if(typeof s.resolveLogo!="function")return;const o=g(t);if(!o)return;const l=String(o);if(c.has(l)){i.value[l]=c.get(l);return}u.has(l)||u.set(l,Promise.resolve(s.resolveLogo(o)).then(_=>{const h=_||null;return c.set(l,h),h}).catch(()=>(c.set(l,null),null)).finally(()=>{u.delete(l)}));const a=await u.get(l);i.value[l]=a;const x=String(d(t,n));a&&(i.value[x]=a)};e.watch(()=>s.items,async t=>{!Array.isArray(t)||typeof s.resolveLogo!="function"||await Promise.all(t.map((n,o)=>B(n,o)))},{immediate:!0,deep:!0});const m=(t,n)=>{const o=t?.logo_url??t?.logoUrl;if(typeof o=="string"&&o.trim())return o;const l=g(t);if(l){const a=i.value[String(l)]??c.get(String(l));if(a)return a}return i.value[String(d(t,n))]||null};return(t,n)=>(e.openBlock(),e.createElementBlock("aside",{class:e.normalizeClass(["sticky top-16 w-72 rounded-xl border ui-border-strong ui-surface shadow-sm overflow-hidden",r.desktopOnly?"hidden lg:flex":"flex"]),style:e.normalizeStyle(b.value)},[e.createElementVNode("div",w,[e.createElementVNode("div",E,[e.createElementVNode("h3",L,e.toDisplayString(r.title),1),r.showSetup?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"mt-3 w-full px-3 py-2 rounded-md border ui-border-strong ui-primary hover:bg-(--ui-primary-soft) text-sm font-medium",onClick:n[0]||(n[0]=o=>f("setup-click"))},e.toDisplayString(r.setupLabel),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",N,[r.loading?(e.openBlock(),e.createElementBlock("div",C,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(6,o=>e.createElementVNode("div",{key:o,class:"h-10 rounded-md ui-surface-muted animate-pulse"})),64))])):r.items.length?(e.openBlock(),e.createElementBlock("nav",V,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.items,(o,l)=>(e.openBlock(),e.createElementBlock("button",{key:String(d(o,l)),type:"button",title:o?.body||o?.name||p(o),class:e.normalizeClass(["w-full px-3 py-2 flex items-center gap-3 text-left transition-colors border-l-2 border-transparent hover:bg-(--ui-surface-muted) ui-text",y(o,l)?"ui-primary-soft border-(--ui-primary) font-semibold":""]),"aria-current":y(o,l)?"page":void 0,onClick:a=>f("select",o)},[e.createElementVNode("span",O,[m(o,l)?(e.openBlock(),e.createElementBlock("img",{key:0,src:m(o,l),alt:p(o),class:"h-full w-full object-cover"},null,8,A)):(e.openBlock(),e.createElementBlock("span",K,e.toDisplayString(v(o)),1))]),e.createElementVNode("span",{class:"inline-block h-2.5 w-2.5 rounded-full shrink-0",style:e.normalizeStyle({backgroundColor:S(o)})},null,4),e.createElementVNode("span",j,e.toDisplayString(p(o)),1)],10,z))),128))])):(e.openBlock(),e.createElementBlock("div",I,"No compliance bodies"))])])],6))}};exports.default=D;
@@ -0,0 +1,124 @@
1
+ import { ref as O, computed as K, watch as $, createElementBlock as l, openBlock as r, normalizeStyle as k, normalizeClass as _, createElementVNode as i, createCommentVNode as j, toDisplayString as y, Fragment as S, renderList as w } from "vue";
2
+ const F = { class: "w-full flex flex-col" }, E = { class: "px-4 py-3 border-b ui-border-strong" }, M = { class: "text-sm font-semibold uppercase tracking-wide ui-text" }, P = { class: "flex-1 overflow-y-auto" }, R = {
3
+ key: 0,
4
+ class: "px-3 py-2 space-y-2"
5
+ }, U = {
6
+ key: 1,
7
+ class: "px-4 py-3 text-sm ui-text"
8
+ }, V = {
9
+ key: 2,
10
+ class: "py-1",
11
+ "aria-label": "Rail navigation"
12
+ }, D = ["title", "aria-current", "onClick"], H = { class: "h-8 w-8 rounded-full overflow-hidden border ui-border-strong ui-surface-muted flex items-center justify-center text-xs font-semibold ui-text" }, q = ["src", "alt"], G = { key: 1 }, J = { class: "truncate text-sm" }, T = {
13
+ __name: "RailNav",
14
+ props: {
15
+ items: { type: Array, default: () => [] },
16
+ activeKey: { type: [String, Number], default: null },
17
+ title: { type: String, default: "Navigation" },
18
+ setupLabel: { type: String, default: "Setup" },
19
+ showSetup: { type: Boolean, default: !1 },
20
+ loading: { type: Boolean, default: !1 },
21
+ heightOffset: { type: [String, Number], default: "4rem" },
22
+ desktopOnly: { type: Boolean, default: !0 },
23
+ resolveLogo: { type: Function, default: null }
24
+ },
25
+ emits: ["select", "setup-click"],
26
+ setup(s, { emit: L }) {
27
+ const u = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), a = s, h = L, d = O({}), C = K(() => ({ height: `calc(100vh - ${(typeof a.heightOffset == "number" ? `${a.heightOffset}px` : a.heightOffset) || "0px"})` })), g = (e, n) => e?.code ?? e?.id ?? e?.company_id ?? e?.key ?? n, p = (e) => e?.code ?? e?.body ?? e?.name ?? e?.label ?? e?.company_name ?? "Item", m = (e) => e?.logo_id ?? e?.logoId ?? e?.company_logo_id ?? e?.companyLogoId ?? e?.logo?.id ?? e?.logo?.data?.id ?? null, I = (e) => {
28
+ const n = String(p(e) || "").trim();
29
+ return n && n.split(/\s+/).filter(Boolean).slice(0, 2).map((o) => o.charAt(0).toUpperCase()).join("") || "C";
30
+ }, b = (e, n) => String(g(e, n)) === String(a.activeKey ?? ""), B = (e) => String(e?.color_code || e?.colorCode || "#94A3B8"), N = async (e, n) => {
31
+ if (typeof a.resolveLogo != "function") return;
32
+ const t = m(e);
33
+ if (!t) return;
34
+ const o = String(t);
35
+ if (u.has(o)) {
36
+ d.value[o] = u.get(o);
37
+ return;
38
+ }
39
+ f.has(o) || f.set(
40
+ o,
41
+ Promise.resolve(a.resolveLogo(t)).then((A) => {
42
+ const x = A || null;
43
+ return u.set(o, x), x;
44
+ }).catch(() => (u.set(o, null), null)).finally(() => {
45
+ f.delete(o);
46
+ })
47
+ );
48
+ const c = await f.get(o);
49
+ d.value[o] = c;
50
+ const z = String(g(e, n));
51
+ c && (d.value[z] = c);
52
+ };
53
+ $(
54
+ () => a.items,
55
+ async (e) => {
56
+ !Array.isArray(e) || typeof a.resolveLogo != "function" || await Promise.all(e.map((n, t) => N(n, t)));
57
+ },
58
+ { immediate: !0, deep: !0 }
59
+ );
60
+ const v = (e, n) => {
61
+ const t = e?.logo_url ?? e?.logoUrl;
62
+ if (typeof t == "string" && t.trim()) return t;
63
+ const o = m(e);
64
+ if (o) {
65
+ const c = d.value[String(o)] ?? u.get(String(o));
66
+ if (c) return c;
67
+ }
68
+ return d.value[String(g(e, n))] || null;
69
+ };
70
+ return (e, n) => (r(), l("aside", {
71
+ class: _([
72
+ "sticky top-16 w-72 rounded-xl border ui-border-strong ui-surface shadow-sm overflow-hidden",
73
+ s.desktopOnly ? "hidden lg:flex" : "flex"
74
+ ]),
75
+ style: k(C.value)
76
+ }, [
77
+ i("div", F, [
78
+ i("div", E, [
79
+ i("h3", M, y(s.title), 1),
80
+ s.showSetup ? (r(), l("button", {
81
+ key: 0,
82
+ type: "button",
83
+ class: "mt-3 w-full px-3 py-2 rounded-md border ui-border-strong ui-primary hover:bg-(--ui-primary-soft) text-sm font-medium",
84
+ onClick: n[0] || (n[0] = (t) => h("setup-click"))
85
+ }, y(s.setupLabel), 1)) : j("", !0)
86
+ ]),
87
+ i("div", P, [
88
+ s.loading ? (r(), l("div", R, [
89
+ (r(), l(S, null, w(6, (t) => i("div", {
90
+ key: t,
91
+ class: "h-10 rounded-md ui-surface-muted animate-pulse"
92
+ })), 64))
93
+ ])) : s.items.length ? (r(), l("nav", V, [
94
+ (r(!0), l(S, null, w(s.items, (t, o) => (r(), l("button", {
95
+ key: String(g(t, o)),
96
+ type: "button",
97
+ title: t?.body || t?.name || p(t),
98
+ class: _(["w-full px-3 py-2 flex items-center gap-3 text-left transition-colors border-l-2 border-transparent hover:bg-(--ui-surface-muted) ui-text", b(t, o) ? "ui-primary-soft border-(--ui-primary) font-semibold" : ""]),
99
+ "aria-current": b(t, o) ? "page" : void 0,
100
+ onClick: (c) => h("select", t)
101
+ }, [
102
+ i("span", H, [
103
+ v(t, o) ? (r(), l("img", {
104
+ key: 0,
105
+ src: v(t, o),
106
+ alt: p(t),
107
+ class: "h-full w-full object-cover"
108
+ }, null, 8, q)) : (r(), l("span", G, y(I(t)), 1))
109
+ ]),
110
+ i("span", {
111
+ class: "inline-block h-2.5 w-2.5 rounded-full shrink-0",
112
+ style: k({ backgroundColor: B(t) })
113
+ }, null, 4),
114
+ i("span", J, y(p(t)), 1)
115
+ ], 10, D))), 128))
116
+ ])) : (r(), l("div", U, "No compliance bodies"))
117
+ ])
118
+ ])
119
+ ], 6));
120
+ }
121
+ };
122
+ export {
123
+ T as default
124
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),l=require("./Icon.cjs"),E=require("./Modal.cjs"),_=require("../_plugin-vue_export-helper-BHFhmbuH.cjs"),w={class:"reminder-config-wrapper"},B={class:"grid grid-cols-1 lg:grid-cols-2 gap-6"},C=["onClick"],R={class:"flex items-start justify-between gap-4"},D={class:"flex items-center gap-4"},T={class:"w-12 h-12 bg-linear-to-br from-(--ui-primary) to-(--ui-accent) rounded-xl flex items-center justify-center shadow-md"},S={class:"ui-text font-bold text-lg"},$={class:"text-xl font-bold ui-text"},j={class:"flex items-center gap-2 mt-1"},M={class:"inline-flex items-center gap-1.5 px-3 py-1 ui-primary-soft ui-primary text-xs font-semibold rounded-full"},z={class:"flex items-start gap-3"},A=["onClick"],I={key:0,class:"p-6 bg-linear-to-br from-(--ui-surface) to-[color:color-mix(in oklab, var(--ui-primary-soft), transparent 70%)]"},F={key:0,class:"text-center py-16"},L={class:"w-20 h-20 bg-linear-to-br from-(--ui-surface) to-(--ui-bg) rounded-2xl flex items-center justify-center mx-auto mb-4"},O={key:1,class:"space-y-4"},q={class:"flex items-start gap-4"},H={class:"flex-1 space-y-5"},P={class:"relative"},U=["value","onInput"],G={class:"flex items-center gap-3 p-4 ui-surface-muted rounded-lg border ui-border-strong"},J=["id","checked","onChange"],K=["for"],Q={class:"grid grid-cols-2 gap-3"},W=["onClick"],X=["onClick"],Y={class:"flex items-start gap-3"},Z={class:"w-10 h-10 bg-linear-to-br from-(--ui-primary-soft) to-(--ui-accent-soft) rounded-lg flex items-center justify-center group-hover:from-(--ui-primary-soft) group-hover:to-(--ui-accent-soft) transition-all"},ee={class:"text-left"},te={class:"text-sm font-semibold ui-text block"},se={key:0,class:"mt-3 p-4 ui-surface-muted rounded-lg border ui-border-strong"},oe={class:"flex flex-wrap gap-2"},re=["onClick"],ie={class:"bg-linear-to-r from-(--ui-success) to-(--ui-success) p-6 ui-text"},ne={class:"flex items-start justify-between gap-4"},le={class:"flex items-start gap-3"},ae={class:"w-12 h-12 bg-[color:color-mix(in oklab, var(--ui-bg), transparent 80%)] rounded-lg flex items-center justify-center"},de={class:"ui-surface px-5 py-4 max-h-88 overflow-y-auto"},ce={key:0,class:"text-center py-6"},ue={key:1,class:"space-y-2"},me={class:"relative shrink-0"},pe=["checked","onChange"],fe={class:"flex-1 min-w-0"},xe={class:"px-5 py-4 ui-surface-muted border-t ui-border flex gap-2"},ge={__name:"ReminderConfig",props:{models:{type:Array,default:()=>[]},availableRecipients:{type:Array,default:()=>[]},sendTypeOptions:{type:Array,default:()=>[{value:"email",label:"Email"},{value:"in-app",label:"In-App"}]}},emits:["update:models"],setup(m,{emit:f}){const n=m,d=f,p=e.ref(null),u=e.ref(!1),a=e.ref(null),x=i=>{const t=n.models.find(s=>s.id===i);t&&(t.expanded=!t.expanded,d("update:models",[...n.models]))},g=i=>{const t=n.models.find(s=>s.id===i);if(t){const s={id:Date.now(),days:0,recipients:[],sendTypes:[],isDaily:!1};t.reminders.push(s),d("update:models",[...n.models])}},v=(i,t)=>{const s=n.models.find(o=>o.id===i);s&&(s.reminders=s.reminders.filter(o=>o.id!==t),d("update:models",[...n.models]))},b=(i,t,s)=>{const o=n.models.find(r=>r.id===i);if(o){const r=o.reminders.find(c=>c.id===t);r&&(r.days=parseInt(s)||0,d("update:models",[...n.models]))}},h=(i,t,s)=>{const o=n.models.find(r=>r.id===i);if(o){const r=o.reminders.find(c=>c.id===t);if(r){r.sendTypes||(r.sendTypes=[]);const c=r.sendTypes.indexOf(s);c>-1?r.sendTypes.splice(c,1):r.sendTypes.push(s),d("update:models",[...n.models])}}},y=(i,t)=>{const s=n.models.find(o=>o.id===i);if(s){const o=s.reminders.find(r=>r.id===t);o&&(o.isDaily=!o.isDaily,d("update:models",[...n.models]))}},k=(i,t)=>{const o=n.models.find(r=>r.id===i).reminders.find(r=>r.id===t);p.value=i,a.value={...o,recipients:[...o.recipients||[]]},u.value=!0},N=i=>{const t=a.value.recipients.indexOf(i);t>-1?a.value.recipients.splice(t,1):a.value.recipients.push(i)},V=()=>{const i=n.models.find(t=>t.id===p.value);if(i){const t=i.reminders.find(s=>s.id===a.value.id);t&&(t.recipients=[...a.value.recipients],d("update:models",[...n.models]))}u.value=!1};return(i,t)=>(e.openBlock(),e.createElementBlock("div",w,[e.createElementVNode("div",B,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.models,s=>(e.openBlock(),e.createElementBlock("div",{key:s.id,class:"ui-surface rounded-2xl shadow-lg border ui-border-strong overflow-hidden hover:shadow-xl transition-all duration-300"},[e.createElementVNode("div",{class:"p-6 cursor-pointer hover:bg-linear-to-r hover:from-(--ui-primary-soft) hover:to-(--ui-accent-soft) transition-all duration-300 border-b ui-border-strong",onClick:o=>x(s.id)},[e.createElementVNode("div",R,[e.createElementVNode("div",D,[e.createElementVNode("div",T,[e.createElementVNode("span",S,e.toDisplayString(s.name[0]),1)]),e.createElementVNode("div",null,[e.createElementVNode("h2",$,e.toDisplayString(s.name),1),e.createElementVNode("div",j,[e.createElementVNode("span",M,[t[3]||(t[3]=e.createElementVNode("div",{class:"w-1.5 h-1.5 ui-primary-bg rounded-full"},null,-1)),e.createTextVNode(" "+e.toDisplayString(s.reminders.length)+" reminder"+e.toDisplayString(s.reminders.length!==1?"s":""),1)])])])]),e.createElementVNode("div",z,[e.createElementVNode("button",{class:"px-4 py-2.5 bg-linear-to-r from-(--ui-success) to-(--ui-success) ui-text-inverse rounded-lg font-semibold text-sm hover:from-(--ui-success) hover:to-(--ui-success-strong) transition-all duration-300 shadow-md hover:shadow-lg flex items-center gap-2",onClick:e.withModifiers(o=>g(s.id),["stop"])},[e.createVNode(l.default,{icon:"plus",class:e.normalizeClass(["w-4 h-4",{"ui-text":!s.expanded,"ui-text-inverse":s.expanded}])},null,8,["class"]),t[4]||(t[4]=e.createTextVNode(" Add Reminder ",-1))],8,A),e.createVNode(l.default,{icon:s.expanded?"chevron-up":"chevron-down",class:e.normalizeClass(["w-6 h-6 ui-text transition-transform duration-300",{"rotate-180":s.expanded}])},null,8,["icon","class"])])])],8,C),e.createVNode(e.Transition,{"enter-active-class":"transition-all duration-300 ease-out","enter-from-class":"opacity-0 max-h-0","enter-to-class":"opacity-100 max-h-screen","leave-active-class":"transition-all duration-200 ease-in","leave-from-class":"opacity-100 max-h-screen","leave-to-class":"opacity-0 max-h-0"},{default:e.withCtx(()=>[s.expanded?(e.openBlock(),e.createElementBlock("div",I,[s.reminders.length===0?(e.openBlock(),e.createElementBlock("div",F,[e.createElementVNode("div",L,[e.createVNode(l.default,{icon:"bell",class:"w-10 h-10 ui-text"})]),t[5]||(t[5]=e.createElementVNode("h3",{class:"text-lg font-semibold ui-text mb-2"}," No reminders configured ",-1)),t[6]||(t[6]=e.createElementVNode("p",{class:"ui-text text-sm mb-4"},' Click "Add Reminder" to create your first reminder ',-1))])):(e.openBlock(),e.createElementBlock("div",O,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.reminders,o=>(e.openBlock(),e.createElementBlock("div",{key:o.id,class:"ui-surface rounded-xl border ui-border-strong p-6 hover:shadow-md transition-all duration-300"},[e.createElementVNode("div",q,[e.createElementVNode("div",H,[e.createElementVNode("div",null,[t[8]||(t[8]=e.createElementVNode("label",{class:"block text-xs font-bold ui-text mb-2 uppercase tracking-wider"}," Days Before Event ",-1)),e.createElementVNode("div",P,[e.createElementVNode("input",{type:"number",min:"0",value:o.days,class:"w-full px-4 py-3 border-2 ui-border-strong rounded-lg focus:outline-none focus:border-(--ui-primary) focus:ring-4 focus:ring-(--ui-primary) transition-all duration-300 font-semibold ui-text text-lg",placeholder:"0",onInput:r=>b(s.id,o.id,r.target.value)},null,40,U),t[7]||(t[7]=e.createElementVNode("div",{class:"absolute right-4 top-1/2 -translate-y-1/2 ui-text text-sm font-medium"}," days ",-1))])]),e.createElementVNode("div",G,[e.createElementVNode("input",{id:`daily-${o.id}`,type:"checkbox",checked:o.isDaily,class:"w-4 h-4 ui-primary rounded border ui-border-strong focus:ring-2 focus:ring-(--ui-primary) transition-all cursor-pointer",onChange:r=>y(s.id,o.id)},null,40,J),e.createElementVNode("label",{for:`daily-${o.id}`,class:"flex-1 cursor-pointer"},[...t[9]||(t[9]=[e.createElementVNode("span",{class:"text-sm font-semibold ui-text block"}," Send Daily Reminder ",-1),e.createElementVNode("span",{class:"text-xs ui-text"}," Repeat this reminder every day ",-1)])],8,K)]),e.createElementVNode("div",null,[t[10]||(t[10]=e.createElementVNode("label",{class:"block text-xs font-bold ui-text mb-3 uppercase tracking-wider"}," Notification Methods ",-1)),e.createElementVNode("div",Q,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.sendTypeOptions,r=>(e.openBlock(),e.createElementBlock("button",{key:r.value,class:e.normalizeClass(["relative px-4 py-3.5 rounded-lg font-semibold text-sm transition-all duration-300 flex items-center justify-center gap-2 border-2",(o.sendTypes||[]).includes(r.value)?"bg-linear-to-r from-(--ui-primary) to-(--ui-accent) ui-text-inverse border-transparent shadow-md":"ui-surface ui-text ui-border-strong hover:border-(--ui-primary-soft) hover:bg-(--ui-primary-soft)"]),onClick:c=>h(s.id,o.id,r.value)},[e.createVNode(l.default,{icon:r.value==="email"?"envelope":"bell",class:"w-4 h-4"},null,8,["icon"]),e.createTextVNode(" "+e.toDisplayString(r.label)+" ",1),(o.sendTypes||[]).includes(r.value)?(e.openBlock(),e.createBlock(l.default,{key:0,icon:"check-circle",class:"w-4 h-4 absolute top-2 right-2"})):e.createCommentVNode("",!0)],10,W))),128))])]),e.createElementVNode("div",null,[t[12]||(t[12]=e.createElementVNode("label",{class:"block text-xs font-bold ui-text mb-3 uppercase tracking-wider"}," Recipients ",-1)),e.createElementVNode("button",{class:"w-full px-4 py-3.5 ui-surface border-2 ui-border-strong rounded-lg hover:border-(--ui-primary-soft) hover:bg-(--ui-primary-soft) transition-all duration-300 flex items-center justify-between group",onClick:r=>k(s.id,o.id)},[e.createElementVNode("div",Y,[e.createElementVNode("div",Z,[e.createVNode(l.default,{icon:"users",class:"w-5 h-5 ui-primary"})]),e.createElementVNode("div",ee,[e.createElementVNode("span",te,e.toDisplayString((o.recipients||[]).length===0?"Select recipients":`${(o.recipients||[]).length} recipient${(o.recipients||[]).length!==1?"s":""} selected`),1),t[11]||(t[11]=e.createElementVNode("span",{class:"text-xs ui-text"}," Click to manage ",-1))])]),e.createVNode(l.default,{icon:"chevron-right",class:"w-5 h-5 ui-text group-hover:text-(--ui-primary) group-hover:translate-x-1 transition-all"})],8,X),(o.recipients||[]).length>0?(e.openBlock(),e.createElementBlock("div",se,[e.createElementVNode("div",oe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.recipients,r=>(e.openBlock(),e.createElementBlock("span",{key:r,class:"inline-flex items-center gap-1.5 px-3 py-1.5 ui-surface border border-(--ui-primary-soft) ui-primary text-xs font-semibold rounded-lg shadow-sm"},[e.createVNode(l.default,{icon:"user",class:"w-3 h-3"}),e.createTextVNode(" "+e.toDisplayString(r),1)]))),128))])])):e.createCommentVNode("",!0)])]),e.createElementVNode("button",{class:"p-3 bg-linear-to-r from-(--ui-danger) to-(--ui-danger) ui-text rounded-lg hover:from-(--ui-danger) hover:to-(--ui-danger-strong) transition-all duration-300 shadow-md hover:shadow-lg self-start",title:"Delete reminder",onClick:r=>v(s.id,o.id)},[e.createVNode(l.default,{icon:"trash",class:"w-4 h-4"})],8,re)])]))),128))]))])):e.createCommentVNode("",!0)]),_:2},1024)]))),128))]),e.createVNode(E.default,{modelValue:u.value,"onUpdate:modelValue":t[2]||(t[2]=s=>u.value=s),size:"3xl","show-close":!1},{default:e.withCtx(()=>[e.createElementVNode("div",ie,[e.createElementVNode("div",ne,[e.createElementVNode("div",le,[e.createElementVNode("div",ae,[e.createVNode(l.default,{icon:"users",class:"w-4 h-4"})]),t[13]||(t[13]=e.createElementVNode("div",null,[e.createElementVNode("h3",{class:"text-lg font-semibold leading-tight"}," Select Recipients "),e.createElementVNode("p",{class:"text-(--ui-primary-soft) text-xs mt-1"}," Choose who should receive this reminder ")],-1))]),e.createElementVNode("button",{class:"p-1.5 hover:bg-[color:color-mix(in oklab, var(--ui-surface), transparent 80%)] rounded-md transition-colors","aria-label":"Close",onClick:t[0]||(t[0]=s=>u.value=!1)},[e.createVNode(l.default,{icon:"x",class:"w-4 h-4"})])])]),e.createElementVNode("div",de,[m.availableRecipients.length===0?(e.openBlock(),e.createElementBlock("div",ce,[e.createVNode(l.default,{icon:"users",class:"w-10 h-10 ui-text mx-auto mb-2"}),t[14]||(t[14]=e.createElementVNode("p",{class:"ui-text text-sm"}," No recipients available ",-1))])):(e.openBlock(),e.createElementBlock("div",ue,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.availableRecipients,s=>(e.openBlock(),e.createElementBlock("label",{key:s,class:e.normalizeClass(["flex items-center gap-3 px-3 py-2.5 rounded-md cursor-pointer transition-all border",a.value?.recipients.includes(s)?"bg-linear-to-r from-(--ui-primary-soft) to-(--ui-accent-soft) border-(--ui-primary-soft) shadow-sm":"ui-surface ui-border hover:border-(--ui-primary-soft) hover:bg-(--ui-surface-muted)"])},[e.createElementVNode("div",me,[e.createElementVNode("input",{type:"checkbox",checked:a.value?.recipients.includes(s),class:"w-4 h-4 ui-primary rounded border ui-border-strong focus:ring-2 focus:ring-(--ui-primary) transition-all cursor-pointer",onChange:o=>N(s)},null,40,pe)]),e.createElementVNode("div",fe,[e.createElementVNode("span",{class:e.normalizeClass(["text-sm font-medium block truncate",a.value?.recipients.includes(s)?"ui-primary":"ui-text"])},e.toDisplayString(s),3)]),a.value?.recipients.includes(s)?(e.openBlock(),e.createBlock(l.default,{key:0,icon:"check-circle",class:"w-4 h-4 ui-primary shrink-0"})):e.createCommentVNode("",!0)],2))),128))]))]),e.createElementVNode("div",xe,[e.createElementVNode("button",{class:"px-4 py-2 ui-surface border ui-border ui-text rounded-md text-sm font-medium hover:bg-(--ui-surface-muted) transition-colors",onClick:t[1]||(t[1]=s=>u.value=!1)}," Cancel "),e.createElementVNode("button",{class:"ml-auto px-4 py-2 ui-success-bg rounded-md text-sm font-semibold hover:bg-(--ui-success-strong) transition-colors flex items-center gap-2",onClick:V},[e.createVNode(l.default,{icon:"check",class:"w-4 h-4"}),t[15]||(t[15]=e.createTextVNode(" Save Recipients ",-1))])])]),_:1},8,["modelValue"])]))}},ve=_._export_sfc(ge,[["__scopeId","data-v-c46bf185"]]);exports.default=ve;
@@ -0,0 +1,375 @@
1
+ import { ref as k, createElementBlock as l, openBlock as n, createElementVNode as e, createVNode as d, Fragment as g, renderList as h, toDisplayString as p, createTextVNode as b, withModifiers as B, normalizeClass as y, Transition as E, withCtx as C, createCommentVNode as _, createBlock as R } from "vue";
2
+ import c from "./Icon.js";
3
+ import O from "./Modal.js";
4
+ import { _ as z } from "../_plugin-vue_export-helper-CHgC5LLL.js";
5
+ const F = { class: "reminder-config-wrapper" }, L = { class: "grid grid-cols-1 lg:grid-cols-2 gap-6" }, U = ["onClick"], q = { class: "flex items-start justify-between gap-4" }, G = { class: "flex items-center gap-4" }, H = { class: "w-12 h-12 bg-linear-to-br from-(--ui-primary) to-(--ui-accent) rounded-xl flex items-center justify-center shadow-md" }, J = { class: "ui-text font-bold text-lg" }, K = { class: "text-xl font-bold ui-text" }, P = { class: "flex items-center gap-2 mt-1" }, Q = { class: "inline-flex items-center gap-1.5 px-3 py-1 ui-primary-soft ui-primary text-xs font-semibold rounded-full" }, W = { class: "flex items-start gap-3" }, X = ["onClick"], Y = {
6
+ key: 0,
7
+ class: "p-6 bg-linear-to-br from-(--ui-surface) to-[color:color-mix(in oklab, var(--ui-primary-soft), transparent 70%)]"
8
+ }, Z = {
9
+ key: 0,
10
+ class: "text-center py-16"
11
+ }, ee = { class: "w-20 h-20 bg-linear-to-br from-(--ui-surface) to-(--ui-bg) rounded-2xl flex items-center justify-center mx-auto mb-4" }, se = {
12
+ key: 1,
13
+ class: "space-y-4"
14
+ }, te = { class: "flex items-start gap-4" }, ie = { class: "flex-1 space-y-5" }, oe = { class: "relative" }, re = ["value", "onInput"], ne = { class: "flex items-center gap-3 p-4 ui-surface-muted rounded-lg border ui-border-strong" }, le = ["id", "checked", "onChange"], ae = ["for"], de = { class: "grid grid-cols-2 gap-3" }, ce = ["onClick"], ue = ["onClick"], pe = { class: "flex items-start gap-3" }, me = { class: "w-10 h-10 bg-linear-to-br from-(--ui-primary-soft) to-(--ui-accent-soft) rounded-lg flex items-center justify-center group-hover:from-(--ui-primary-soft) group-hover:to-(--ui-accent-soft) transition-all" }, fe = { class: "text-left" }, xe = { class: "text-sm font-semibold ui-text block" }, ve = {
15
+ key: 0,
16
+ class: "mt-3 p-4 ui-surface-muted rounded-lg border ui-border-strong"
17
+ }, ge = { class: "flex flex-wrap gap-2" }, he = ["onClick"], be = { class: "bg-linear-to-r from-(--ui-success) to-(--ui-success) p-6 ui-text" }, ye = { class: "flex items-start justify-between gap-4" }, _e = { class: "flex items-start gap-3" }, ke = { class: "w-12 h-12 bg-[color:color-mix(in oklab, var(--ui-bg), transparent 80%)] rounded-lg flex items-center justify-center" }, we = { class: "ui-surface px-5 py-4 max-h-88 overflow-y-auto" }, Ce = {
18
+ key: 0,
19
+ class: "text-center py-6"
20
+ }, Re = {
21
+ key: 1,
22
+ class: "space-y-2"
23
+ }, $e = { class: "relative shrink-0" }, Te = ["checked", "onChange"], De = { class: "flex-1 min-w-0" }, je = { class: "px-5 py-4 ui-surface-muted border-t ui-border flex gap-2" }, Ne = {
24
+ __name: "ReminderConfig",
25
+ props: {
26
+ models: {
27
+ type: Array,
28
+ default: () => []
29
+ },
30
+ availableRecipients: {
31
+ type: Array,
32
+ default: () => []
33
+ },
34
+ sendTypeOptions: {
35
+ type: Array,
36
+ default: () => [
37
+ { value: "email", label: "Email" },
38
+ { value: "in-app", label: "In-App" }
39
+ ]
40
+ }
41
+ },
42
+ emits: ["update:models"],
43
+ setup(v, { emit: $ }) {
44
+ const a = v, m = $, w = k(null), x = k(!1), u = k(null), T = (r) => {
45
+ const s = a.models.find((t) => t.id === r);
46
+ s && (s.expanded = !s.expanded, m("update:models", [...a.models]));
47
+ }, D = (r) => {
48
+ const s = a.models.find((t) => t.id === r);
49
+ if (s) {
50
+ const t = {
51
+ id: Date.now(),
52
+ days: 0,
53
+ recipients: [],
54
+ sendTypes: [],
55
+ isDaily: !1
56
+ };
57
+ s.reminders.push(t), m("update:models", [...a.models]);
58
+ }
59
+ }, j = (r, s) => {
60
+ const t = a.models.find((i) => i.id === r);
61
+ t && (t.reminders = t.reminders.filter((i) => i.id !== s), m("update:models", [...a.models]));
62
+ }, N = (r, s, t) => {
63
+ const i = a.models.find((o) => o.id === r);
64
+ if (i) {
65
+ const o = i.reminders.find((f) => f.id === s);
66
+ o && (o.days = parseInt(t) || 0, m("update:models", [...a.models]));
67
+ }
68
+ }, A = (r, s, t) => {
69
+ const i = a.models.find((o) => o.id === r);
70
+ if (i) {
71
+ const o = i.reminders.find((f) => f.id === s);
72
+ if (o) {
73
+ o.sendTypes || (o.sendTypes = []);
74
+ const f = o.sendTypes.indexOf(t);
75
+ f > -1 ? o.sendTypes.splice(f, 1) : o.sendTypes.push(t), m("update:models", [...a.models]);
76
+ }
77
+ }
78
+ }, M = (r, s) => {
79
+ const t = a.models.find((i) => i.id === r);
80
+ if (t) {
81
+ const i = t.reminders.find((o) => o.id === s);
82
+ i && (i.isDaily = !i.isDaily, m("update:models", [...a.models]));
83
+ }
84
+ }, S = (r, s) => {
85
+ const i = a.models.find((o) => o.id === r).reminders.find((o) => o.id === s);
86
+ w.value = r, u.value = { ...i, recipients: [...i.recipients || []] }, x.value = !0;
87
+ }, V = (r) => {
88
+ const s = u.value.recipients.indexOf(r);
89
+ s > -1 ? u.value.recipients.splice(s, 1) : u.value.recipients.push(r);
90
+ }, I = () => {
91
+ const r = a.models.find((s) => s.id === w.value);
92
+ if (r) {
93
+ const s = r.reminders.find((t) => t.id === u.value.id);
94
+ s && (s.recipients = [...u.value.recipients], m("update:models", [...a.models]));
95
+ }
96
+ x.value = !1;
97
+ };
98
+ return (r, s) => (n(), l("div", F, [
99
+ e("div", L, [
100
+ (n(!0), l(g, null, h(v.models, (t) => (n(), l("div", {
101
+ key: t.id,
102
+ class: "ui-surface rounded-2xl shadow-lg border ui-border-strong overflow-hidden hover:shadow-xl transition-all duration-300"
103
+ }, [
104
+ e("div", {
105
+ class: "p-6 cursor-pointer hover:bg-linear-to-r hover:from-(--ui-primary-soft) hover:to-(--ui-accent-soft) transition-all duration-300 border-b ui-border-strong",
106
+ onClick: (i) => T(t.id)
107
+ }, [
108
+ e("div", q, [
109
+ e("div", G, [
110
+ e("div", H, [
111
+ e("span", J, p(t.name[0]), 1)
112
+ ]),
113
+ e("div", null, [
114
+ e("h2", K, p(t.name), 1),
115
+ e("div", P, [
116
+ e("span", Q, [
117
+ s[3] || (s[3] = e("div", { class: "w-1.5 h-1.5 ui-primary-bg rounded-full" }, null, -1)),
118
+ b(" " + p(t.reminders.length) + " reminder" + p(t.reminders.length !== 1 ? "s" : ""), 1)
119
+ ])
120
+ ])
121
+ ])
122
+ ]),
123
+ e("div", W, [
124
+ e("button", {
125
+ class: "px-4 py-2.5 bg-linear-to-r from-(--ui-success) to-(--ui-success) ui-text-inverse rounded-lg font-semibold text-sm hover:from-(--ui-success) hover:to-(--ui-success-strong) transition-all duration-300 shadow-md hover:shadow-lg flex items-center gap-2",
126
+ onClick: B((i) => D(t.id), ["stop"])
127
+ }, [
128
+ d(c, {
129
+ icon: "plus",
130
+ class: y(["w-4 h-4", { "ui-text": !t.expanded, "ui-text-inverse": t.expanded }])
131
+ }, null, 8, ["class"]),
132
+ s[4] || (s[4] = b(" Add Reminder ", -1))
133
+ ], 8, X),
134
+ d(c, {
135
+ icon: t.expanded ? "chevron-up" : "chevron-down",
136
+ class: y(["w-6 h-6 ui-text transition-transform duration-300", { "rotate-180": t.expanded }])
137
+ }, null, 8, ["icon", "class"])
138
+ ])
139
+ ])
140
+ ], 8, U),
141
+ d(E, {
142
+ "enter-active-class": "transition-all duration-300 ease-out",
143
+ "enter-from-class": "opacity-0 max-h-0",
144
+ "enter-to-class": "opacity-100 max-h-screen",
145
+ "leave-active-class": "transition-all duration-200 ease-in",
146
+ "leave-from-class": "opacity-100 max-h-screen",
147
+ "leave-to-class": "opacity-0 max-h-0"
148
+ }, {
149
+ default: C(() => [
150
+ t.expanded ? (n(), l("div", Y, [
151
+ t.reminders.length === 0 ? (n(), l("div", Z, [
152
+ e("div", ee, [
153
+ d(c, {
154
+ icon: "bell",
155
+ class: "w-10 h-10 ui-text"
156
+ })
157
+ ]),
158
+ s[5] || (s[5] = e("h3", { class: "text-lg font-semibold ui-text mb-2" }, " No reminders configured ", -1)),
159
+ s[6] || (s[6] = e("p", { class: "ui-text text-sm mb-4" }, ' Click "Add Reminder" to create your first reminder ', -1))
160
+ ])) : (n(), l("div", se, [
161
+ (n(!0), l(g, null, h(t.reminders, (i) => (n(), l("div", {
162
+ key: i.id,
163
+ class: "ui-surface rounded-xl border ui-border-strong p-6 hover:shadow-md transition-all duration-300"
164
+ }, [
165
+ e("div", te, [
166
+ e("div", ie, [
167
+ e("div", null, [
168
+ s[8] || (s[8] = e("label", { class: "block text-xs font-bold ui-text mb-2 uppercase tracking-wider" }, " Days Before Event ", -1)),
169
+ e("div", oe, [
170
+ e("input", {
171
+ type: "number",
172
+ min: "0",
173
+ value: i.days,
174
+ class: "w-full px-4 py-3 border-2 ui-border-strong rounded-lg focus:outline-none focus:border-(--ui-primary) focus:ring-4 focus:ring-(--ui-primary) transition-all duration-300 font-semibold ui-text text-lg",
175
+ placeholder: "0",
176
+ onInput: (o) => N(t.id, i.id, o.target.value)
177
+ }, null, 40, re),
178
+ s[7] || (s[7] = e("div", { class: "absolute right-4 top-1/2 -translate-y-1/2 ui-text text-sm font-medium" }, " days ", -1))
179
+ ])
180
+ ]),
181
+ e("div", ne, [
182
+ e("input", {
183
+ id: `daily-${i.id}`,
184
+ type: "checkbox",
185
+ checked: i.isDaily,
186
+ class: "w-4 h-4 ui-primary rounded border ui-border-strong focus:ring-2 focus:ring-(--ui-primary) transition-all cursor-pointer",
187
+ onChange: (o) => M(t.id, i.id)
188
+ }, null, 40, le),
189
+ e("label", {
190
+ for: `daily-${i.id}`,
191
+ class: "flex-1 cursor-pointer"
192
+ }, [...s[9] || (s[9] = [
193
+ e("span", { class: "text-sm font-semibold ui-text block" }, " Send Daily Reminder ", -1),
194
+ e("span", { class: "text-xs ui-text" }, " Repeat this reminder every day ", -1)
195
+ ])], 8, ae)
196
+ ]),
197
+ e("div", null, [
198
+ s[10] || (s[10] = e("label", { class: "block text-xs font-bold ui-text mb-3 uppercase tracking-wider" }, " Notification Methods ", -1)),
199
+ e("div", de, [
200
+ (n(!0), l(g, null, h(v.sendTypeOptions, (o) => (n(), l("button", {
201
+ key: o.value,
202
+ class: y([
203
+ "relative px-4 py-3.5 rounded-lg font-semibold text-sm transition-all duration-300 flex items-center justify-center gap-2 border-2",
204
+ (i.sendTypes || []).includes(o.value) ? "bg-linear-to-r from-(--ui-primary) to-(--ui-accent) ui-text-inverse border-transparent shadow-md" : "ui-surface ui-text ui-border-strong hover:border-(--ui-primary-soft) hover:bg-(--ui-primary-soft)"
205
+ ]),
206
+ onClick: (f) => A(t.id, i.id, o.value)
207
+ }, [
208
+ d(c, {
209
+ icon: o.value === "email" ? "envelope" : "bell",
210
+ class: "w-4 h-4"
211
+ }, null, 8, ["icon"]),
212
+ b(" " + p(o.label) + " ", 1),
213
+ (i.sendTypes || []).includes(o.value) ? (n(), R(c, {
214
+ key: 0,
215
+ icon: "check-circle",
216
+ class: "w-4 h-4 absolute top-2 right-2"
217
+ })) : _("", !0)
218
+ ], 10, ce))), 128))
219
+ ])
220
+ ]),
221
+ e("div", null, [
222
+ s[12] || (s[12] = e("label", { class: "block text-xs font-bold ui-text mb-3 uppercase tracking-wider" }, " Recipients ", -1)),
223
+ e("button", {
224
+ class: "w-full px-4 py-3.5 ui-surface border-2 ui-border-strong rounded-lg hover:border-(--ui-primary-soft) hover:bg-(--ui-primary-soft) transition-all duration-300 flex items-center justify-between group",
225
+ onClick: (o) => S(t.id, i.id)
226
+ }, [
227
+ e("div", pe, [
228
+ e("div", me, [
229
+ d(c, {
230
+ icon: "users",
231
+ class: "w-5 h-5 ui-primary"
232
+ })
233
+ ]),
234
+ e("div", fe, [
235
+ e("span", xe, p((i.recipients || []).length === 0 ? "Select recipients" : `${(i.recipients || []).length} recipient${(i.recipients || []).length !== 1 ? "s" : ""} selected`), 1),
236
+ s[11] || (s[11] = e("span", { class: "text-xs ui-text" }, " Click to manage ", -1))
237
+ ])
238
+ ]),
239
+ d(c, {
240
+ icon: "chevron-right",
241
+ class: "w-5 h-5 ui-text group-hover:text-(--ui-primary) group-hover:translate-x-1 transition-all"
242
+ })
243
+ ], 8, ue),
244
+ (i.recipients || []).length > 0 ? (n(), l("div", ve, [
245
+ e("div", ge, [
246
+ (n(!0), l(g, null, h(i.recipients, (o) => (n(), l("span", {
247
+ key: o,
248
+ class: "inline-flex items-center gap-1.5 px-3 py-1.5 ui-surface border border-(--ui-primary-soft) ui-primary text-xs font-semibold rounded-lg shadow-sm"
249
+ }, [
250
+ d(c, {
251
+ icon: "user",
252
+ class: "w-3 h-3"
253
+ }),
254
+ b(" " + p(o), 1)
255
+ ]))), 128))
256
+ ])
257
+ ])) : _("", !0)
258
+ ])
259
+ ]),
260
+ e("button", {
261
+ class: "p-3 bg-linear-to-r from-(--ui-danger) to-(--ui-danger) ui-text rounded-lg hover:from-(--ui-danger) hover:to-(--ui-danger-strong) transition-all duration-300 shadow-md hover:shadow-lg self-start",
262
+ title: "Delete reminder",
263
+ onClick: (o) => j(t.id, i.id)
264
+ }, [
265
+ d(c, {
266
+ icon: "trash",
267
+ class: "w-4 h-4"
268
+ })
269
+ ], 8, he)
270
+ ])
271
+ ]))), 128))
272
+ ]))
273
+ ])) : _("", !0)
274
+ ]),
275
+ _: 2
276
+ }, 1024)
277
+ ]))), 128))
278
+ ]),
279
+ d(O, {
280
+ modelValue: x.value,
281
+ "onUpdate:modelValue": s[2] || (s[2] = (t) => x.value = t),
282
+ size: "3xl",
283
+ "show-close": !1
284
+ }, {
285
+ default: C(() => [
286
+ e("div", be, [
287
+ e("div", ye, [
288
+ e("div", _e, [
289
+ e("div", ke, [
290
+ d(c, {
291
+ icon: "users",
292
+ class: "w-4 h-4"
293
+ })
294
+ ]),
295
+ s[13] || (s[13] = e("div", null, [
296
+ e("h3", { class: "text-lg font-semibold leading-tight" }, " Select Recipients "),
297
+ e("p", { class: "text-(--ui-primary-soft) text-xs mt-1" }, " Choose who should receive this reminder ")
298
+ ], -1))
299
+ ]),
300
+ e("button", {
301
+ class: "p-1.5 hover:bg-[color:color-mix(in oklab, var(--ui-surface), transparent 80%)] rounded-md transition-colors",
302
+ "aria-label": "Close",
303
+ onClick: s[0] || (s[0] = (t) => x.value = !1)
304
+ }, [
305
+ d(c, {
306
+ icon: "x",
307
+ class: "w-4 h-4"
308
+ })
309
+ ])
310
+ ])
311
+ ]),
312
+ e("div", we, [
313
+ v.availableRecipients.length === 0 ? (n(), l("div", Ce, [
314
+ d(c, {
315
+ icon: "users",
316
+ class: "w-10 h-10 ui-text mx-auto mb-2"
317
+ }),
318
+ s[14] || (s[14] = e("p", { class: "ui-text text-sm" }, " No recipients available ", -1))
319
+ ])) : (n(), l("div", Re, [
320
+ (n(!0), l(g, null, h(v.availableRecipients, (t) => (n(), l("label", {
321
+ key: t,
322
+ class: y([
323
+ "flex items-center gap-3 px-3 py-2.5 rounded-md cursor-pointer transition-all border",
324
+ u.value?.recipients.includes(t) ? "bg-linear-to-r from-(--ui-primary-soft) to-(--ui-accent-soft) border-(--ui-primary-soft) shadow-sm" : "ui-surface ui-border hover:border-(--ui-primary-soft) hover:bg-(--ui-surface-muted)"
325
+ ])
326
+ }, [
327
+ e("div", $e, [
328
+ e("input", {
329
+ type: "checkbox",
330
+ checked: u.value?.recipients.includes(t),
331
+ class: "w-4 h-4 ui-primary rounded border ui-border-strong focus:ring-2 focus:ring-(--ui-primary) transition-all cursor-pointer",
332
+ onChange: (i) => V(t)
333
+ }, null, 40, Te)
334
+ ]),
335
+ e("div", De, [
336
+ e("span", {
337
+ class: y([
338
+ "text-sm font-medium block truncate",
339
+ u.value?.recipients.includes(t) ? "ui-primary" : "ui-text"
340
+ ])
341
+ }, p(t), 3)
342
+ ]),
343
+ u.value?.recipients.includes(t) ? (n(), R(c, {
344
+ key: 0,
345
+ icon: "check-circle",
346
+ class: "w-4 h-4 ui-primary shrink-0"
347
+ })) : _("", !0)
348
+ ], 2))), 128))
349
+ ]))
350
+ ]),
351
+ e("div", je, [
352
+ e("button", {
353
+ class: "px-4 py-2 ui-surface border ui-border ui-text rounded-md text-sm font-medium hover:bg-(--ui-surface-muted) transition-colors",
354
+ onClick: s[1] || (s[1] = (t) => x.value = !1)
355
+ }, " Cancel "),
356
+ e("button", {
357
+ class: "ml-auto px-4 py-2 ui-success-bg rounded-md text-sm font-semibold hover:bg-(--ui-success-strong) transition-colors flex items-center gap-2",
358
+ onClick: I
359
+ }, [
360
+ d(c, {
361
+ icon: "check",
362
+ class: "w-4 h-4"
363
+ }),
364
+ s[15] || (s[15] = b(" Save Recipients ", -1))
365
+ ])
366
+ ])
367
+ ]),
368
+ _: 1
369
+ }, 8, ["modelValue"])
370
+ ]));
371
+ }
372
+ }, Ie = /* @__PURE__ */ z(Ne, [["__scopeId", "data-v-c46bf185"]]);
373
+ export {
374
+ Ie as default
375
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),ge=require("./Slider.cjs"),J=require("./DatePicker.cjs"),ke=require("../FormField.vue_vue_type_script_setup_true_lang-mEO-VA6R.cjs"),g=require("../Input.vue_vue_type_script_setup_true_lang-C1OQn24h.cjs"),Be=require("./Textarea.cjs"),G=require("./Select.cjs"),_e=require("./MultiSelect.cjs"),V=require("../Button.vue_vue_type_script_setup_true_lang-DZxttvYH.cjs"),z=require("./Label.cjs"),K=require("./FileUpload.cjs"),w=require("../lib/toast.cjs"),xe=require("../_plugin-vue_export-helper-BHFhmbuH.cjs"),Ce={class:"w-full p-2"},Ve={key:0,class:"mb-6"},we={class:"text-xl font-semibold ui-text"},Se={key:0,class:"mt-1 text-sm ui-text-muted"},Fe={key:0,class:"mb-4"},Ne={key:0,class:"text-base font-semibold ui-text"},Ee={key:1,class:"mt-1 text-sm ui-text-muted"},Te=["value"],Ae=["title","aria-label","disabled","onClick"],Ue={key:0,class:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":"true"},ze={key:0,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M3 3l18 18M10.6 10.7a2 2 0 002.7 2.7M9.9 4.2A10.7 10.7 0 0112 4c5 0 8.7 4.4 9.6 6.5.2.3.2.7 0 1a15 15 0 01-2.2 3.3M6.2 6.2A15.8 15.8 0 002.4 10.5c-.2.3-.2.7 0 1C3.3 13.6 7 18 12 18c1 0 2-.2 2.9-.5"},qe={key:2,class:"flex w-full items-center gap-2"},$e={class:"min-w-0 flex-1"},De={key:3,class:"flex w-full items-center gap-2"},Me={class:"min-w-0 flex-1"},je={key:5,class:"flex items-center"},Le={key:6,class:"flex items-center"},Pe=["id","aria-checked","disabled","onClick"],Re={key:7,class:"space-y-2"},Oe={key:11,class:"space-y-2"},Ye={class:"flex items-center gap-4"},Ie={class:"min-w-12 text-right text-sm font-medium ui-text"},He={key:0,class:"flex justify-end gap-3 pt-6"},Je={key:0,class:"hidden"},Ge={__name:"ReusableForm",props:{title:{type:String,default:""},description:{type:String,default:""},entityName:{type:String,default:"Item"},fields:{type:Array,required:!0,validator:y=>Array.isArray(y)&&y.every(B=>B?.name&&B?.label&&B?.type)},sections:{type:Array,default:()=>[]},initialData:{type:Object,default:null},loading:{type:Boolean,default:!1},customValidation:{type:Function,default:null},crossValidate:{type:Function,default:null},submitLabel:{type:String,default:"Submit"},showReset:{type:Boolean,default:!0},showCancel:{type:Boolean,default:!0},showSubmit:{type:Boolean,default:!0},formType:{type:String,default:"create",validator:y=>["create","edit"].includes(y)}},emits:["submit","reset","cancel","form-change"],setup(y,{emit:B}){const v=y,S=B,Q=a.useSlots(),i=a.computed(()=>v.loading),c=a.ref({}),m=a.ref({}),F=a.ref({}),q=a.ref({}),N=a.ref(!1),W=a.computed(()=>Array.isArray(v.sections)&&v.sections.length>0),X=a.computed(()=>!!Q.actions),$=a.computed(()=>W.value?v.sections.map((e,o)=>{const l=e?.id||`section-${o+1}`,n=Array.isArray(e?.fields)?e.fields:(v.fields||[]).filter(t=>t.sectionId===l);return{id:l,title:e?.title||"",description:e?.description||"",icon:e?.icon||"",wrapperClass:e?.wrapperClass||"",gridClass:e?.gridClass||"grid grid-cols-12 gap-4",card:e?.card!==!1,fields:n}}):[{id:"default",title:"",description:"",icon:"",wrapperClass:"",gridClass:"grid grid-cols-12 gap-4",card:!1,fields:v.fields||[]}]),_=a.computed(()=>$.value.flatMap(e=>e.fields||[])),Z=a.computed(()=>Object.keys(m.value).length===0),D=e=>{try{return JSON.stringify(e??{})}catch{return""}},E=(e,o)=>{if(!(!e||!o))return o.split(".").reduce((l,n)=>l?.[n],e)},x=(e,o,l)=>{const n=o.split("."),t=n.pop(),s=n.reduce((p,b)=>((!p[b]||typeof p[b]!="object")&&(p[b]={}),p[b]),e);s[t]=l},T=e=>e.type==="checkbox"||e.type==="switch"?!1:e.type==="number"||e.type==="slider"||e.type==="range"?e.min??0:e.type==="file"?null:e.type==="multifile"||e.type==="multiselect"?[]:e.type==="radio"&&e.options?.[0]?.value||"",M=()=>{const e={};return _.value.forEach(o=>{o.name.includes(".")?x(e,o.name,T(o)):e[o.name]=T(o)}),e},f=e=>{const o={};return _.value.forEach(l=>{const n=l.name.includes(".")?E(e,l.name):e?.[l.name],t=T(l),s=n===void 0?t:n;if(l.name.includes(".")){x(o,l.name,s);return}l.type==="file"?o[l.name]=null:l.type==="multifile"||l.type==="multiselect"?o[l.name]=Array.isArray(s)?s:[]:o[l.name]=s}),o};a.watch(()=>v.initialData,e=>{const o=e?f(e):M();D(o)!==D(c.value)&&(N.value=!0,c.value=o,queueMicrotask(()=>{N.value=!1}))},{immediate:!0}),a.watch(c,e=>{N.value||S("form-change",e)},{deep:!0});const u=e=>e.includes(".")?E(c.value,e):c.value[e],A=e=>{const o=m.value?.[e];return o||(e.includes(".")?E(m.value,e):void 0)},d=(e,o)=>{e.includes(".")?x(c.value,e,o):c.value[e]=o},h=e=>e?.type==="password",C=e=>!!F.value[e.name],ee=e=>h(e)?C(e)?"text":"password":e.type,te=e=>{e?.name&&(F.value={...F.value,[e.name]:!F.value[e.name]})},ae=()=>{if(m.value={},_.value.forEach(e=>{const o=u(e.name);if(e.required&&!e.disabled&&e.type!=="hidden"&&(e.type==="checkbox"||e.type==="switch"?o||(m.value[e.name]=e.errorMessage||`${e.label} is required`):e.type==="multiselect"||e.type==="multifile"?(!Array.isArray(o)||o.length===0)&&(m.value[e.name]=e.errorMessage||`${e.label} is required`):e.type==="number"||e.type==="slider"||e.type==="range"?o===""||o===null||o===void 0?m.value[e.name]=e.errorMessage||`${e.label} is required`:e.min!==void 0&&Number(o)<e.min?m.value[e.name]=`${e.label} must be at least ${e.min}`:e.max!==void 0&&Number(o)>e.max&&(m.value[e.name]=`${e.label} must be at most ${e.max}`):e.type==="email"?!o||!String(o).trim()?m.value[e.name]=e.errorMessage||`${e.label} is required`:/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(o))||(m.value[e.name]="Please enter a valid email address"):e.type==="url"?!o||!String(o).trim()?m.value[e.name]=e.errorMessage||`${e.label} is required`:/^https?:\/\/.+/.test(String(o))||(m.value[e.name]="Please enter a valid URL"):(o==null||typeof o=="string"&&!o.trim())&&(m.value[e.name]=e.errorMessage||`${e.label} is required`)),typeof e.validate=="function"){const l=e.validate(o,c.value);l&&(m.value[e.name]=l)}}),typeof v.customValidation=="function"){const e=v.customValidation(c.value);e&&typeof e=="object"&&(m.value={...m.value,...e})}if(typeof v.crossValidate=="function"){const e=v.crossValidate(c.value);e&&typeof e=="object"&&(m.value={...m.value,...e})}return Object.keys(m.value).length===0},k=(e,o,l=void 0)=>typeof e=="function"?e(c.value,o):e===void 0?l:e,j=e=>!!e?.actionButton&&e.actionButton.show!==!1,L=e=>{if(!e?.actionButton)return!0;const o=typeof e.actionButton.disabled=="function"?e.actionButton.disabled(c.value,e):e.actionButton.disabled;return!!(i.value||e.disabled||o)},P=e=>e?.actionButton?typeof e.actionButton.loading=="function"?e.actionButton.loading(c.value,e):!!e.actionButton.loading:!1,R=e=>{typeof e?.actionButton?.onClick=="function"&&e.actionButton.onClick(c.value,e)},O=e=>h(e)||!!k(e.trailingIcon,e,null),oe=e=>h(e)?C(e)?"eye-slash":"eye":k(e.trailingIcon,e,null),Y=e=>h(e)?C(e)?"Hide password":"Show password":k(e.trailingIconTitle,e,"Action"),ne=e=>h(e)?C(e)?"Hide password":"Show password":k(e.trailingIconAriaLabel,e,Y(e)),re=e=>k(e.trailingIconClass,e,"w-4 h-4"),U=e=>!!(i.value||e.disabled||k(e.trailingIconDisabled,e,!1)),le=e=>{if(!U(e)){if(h(e)){te(e);return}typeof e?.onTrailingIconClick=="function"&&e.onTrailingIconClick(c.value,e)}},I=async(e,o)=>{if(d(e.name,o),typeof e?.onChange=="function")try{await e.onChange(o,c.value)}catch{w.toast.error("An error occurred while processing the change")}},se=(e,o)=>{if(d(e.name,o),typeof e?.onChange=="function")try{e.onChange(o,c.value)}catch{w.toast.error("An error occurred while processing the change")}},ce=(e,o)=>{d(e.name,o),typeof e?.onChange=="function"&&e.onChange(o,c.value)},ie=(e,o)=>{d(e.name,o),typeof e?.onChange=="function"&&e.onChange(o,c.value)},ue=(e,o)=>{d(e.name,o),typeof e?.onChange=="function"&&e.onChange(o,c.value)},me=(e,o)=>{d(e.name,o),typeof e?.onChange=="function"&&e.onChange(o,c.value)},de=e=>{const o=new FormData;return Object.keys(e).forEach(l=>{const n=e[l];n!=null&&(n instanceof File?o.append(l,n):Array.isArray(n)?n.forEach((t,s)=>{t instanceof File?o.append(`${l}[]`,t):o.append(`${l}[${s}]`,t)}):typeof n=="object"&&!(n instanceof Date)?Object.keys(n).forEach(t=>{o.append(`${l}[${t}]`,n[t])}):o.append(l,n))}),o},pe=()=>{const e={};let o=!1;_.value.forEach(n=>{const t=u(n.name);if(n.type==="number"||n.type==="slider"||n.type==="range"){const p=t===""||t===null||t===void 0?t:Number(t);n.name.includes(".")?x(e,n.name,p):e[n.name]=p;return}if(n.type==="file"){t instanceof File?(o=!0,e[n.name]=t):v.formType==="edit"&&t&&(e[n.name]=t);return}if(n.type==="multifile"){Array.isArray(t)&&t.some(p=>p instanceof File)?(o=!0,e[n.name]=t):v.formType==="edit"&&Array.isArray(t)&&t.length>0&&(e[n.name]=t);return}const s=["text","textarea","date","email","url","tel","search","time","datetime-local","month","week"].includes(n.type)&&typeof t=="string"?t.trim():t;n.name.includes(".")?x(e,n.name,s):e[n.name]=s});let l=e;return o&&(l=de(e),v.formType==="edit"&&l.append("_method","PUT")),{formData:l,hasFiles:o}},H=async()=>{if(_.value.some(l=>l.type!=="multifile"&&(q.value[l.name]||[]).length>0))return w.toast.error("Please wait for all files to finish uploading"),!1;if(!ae())return w.toast.error("Please fix the validation errors before submitting"),!1;const o=pe();return S("submit",{formData:o.formData,formType:v.formType,originalData:v.initialData,hasFiles:o.hasFiles}),!0},be=async()=>{try{await H()}catch{w.toast.error("An error occurred during submission")}},ye=()=>{c.value=M(),m.value={},q.value={},S("reset")},ve=()=>S("cancel");return(e,o)=>{const l=a.resolveComponent("font-awesome-icon");return a.openBlock(),a.createElementBlock("div",Ce,[y.title?(a.openBlock(),a.createElementBlock("div",Ve,[a.createElementVNode("h2",we,a.toDisplayString(y.title),1),y.description?(a.openBlock(),a.createElementBlock("p",Se,a.toDisplayString(y.description),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),a.createElementVNode("form",{class:"space-y-6",onSubmit:a.withModifiers(be,["prevent"])},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList($.value,n=>(a.openBlock(),a.createElementBlock("div",{key:n.id,class:a.normalizeClass(n.wrapperClass||"")},[a.createElementVNode("div",{class:a.normalizeClass(n.card?"ui-surface border ui-border-strong rounded-xl p-4 sm:p-5":"")},[a.renderSlot(e.$slots,"section-header",{section:n},()=>[n.title||n.description?(a.openBlock(),a.createElementBlock("div",Fe,[n.title?(a.openBlock(),a.createElementBlock("h3",Ne,a.toDisplayString(n.title),1)):a.createCommentVNode("",!0),n.description?(a.openBlock(),a.createElementBlock("p",Ee,a.toDisplayString(n.description),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0)],!0),a.createElementVNode("div",{class:a.normalizeClass(n.gridClass)},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.fields,t=>(a.openBlock(),a.createElementBlock("div",{key:t.name,class:a.normalizeClass(t.wrapperClass||"col-span-12")},[t.type==="hidden"?(a.openBlock(),a.createElementBlock("input",{key:0,value:u(t.name),type:"hidden"},null,8,Te)):(a.openBlock(),a.createBlock(ke._sfc_main,{key:1,id:`form-${y.entityName}-${t.name}`,label:t.label,required:!!t.required,error:A(t.name),"error-message":A(t.name),"help-text":t.helpText,class:a.normalizeClass(t.labelClass||"")},{default:a.withCtx(({fieldId:s,hasError:p,ariaDescribedBy:b})=>[a.renderSlot(e.$slots,`field-${t.name}`,{field:t,formData:c.value,error:A(t.name),update:r=>d(t.name,r)},()=>[["text","number","password","color","email","tel","url","search"].includes(t.type)?(a.openBlock(),a.createElementBlock("div",{key:0,class:a.normalizeClass(["relative",O(t)?"has-trailing-icon":""])},[a.createVNode(g._sfc_main,{id:s,"model-value":u(t.name),type:ee(t),placeholder:t.placeholder,disabled:i.value||t.disabled,readonly:t.readonly||t.disabled,class:a.normalizeClass([p?"border-(--ui-danger)":"ui-border-strong",t.inputClass||""]),"aria-describedby":b,"onUpdate:modelValue":r=>d(t.name,r)},null,8,["id","model-value","type","placeholder","disabled","readonly","class","aria-describedby","onUpdate:modelValue"]),O(t)?(a.openBlock(),a.createElementBlock("button",{key:0,type:"button",class:a.normalizeClass(["absolute right-3 top-1/2 -translate-y-1/2 ui-text hover:text-(--ui-text) transition-colors",U(t)?"opacity-50 cursor-not-allowed":""]),title:Y(t),"aria-label":ne(t),disabled:U(t),onClick:r=>le(t)},[h(t)?(a.openBlock(),a.createElementBlock("svg",Ue,[C(t)?(a.openBlock(),a.createElementBlock("path",ze)):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[o[0]||(o[0]=a.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M2.4 10.5C3.3 8.4 7 4 12 4s8.7 4.4 9.6 6.5c.2.3.2.7 0 1C20.7 13.6 17 18 12 18s-8.7-4.4-9.6-6.5a1.1 1.1 0 010-1z"},null,-1)),o[1]||(o[1]=a.createElementVNode("circle",{cx:"12",cy:"11",r:"3","stroke-width":"2"},null,-1))],64))])):(a.openBlock(),a.createBlock(l,{key:1,icon:oe(t),class:a.normalizeClass(re(t))},null,8,["icon","class"]))],10,Ae)):a.createCommentVNode("",!0)],2)):t.type==="textarea"?(a.openBlock(),a.createBlock(Be.default,{key:1,id:s,"model-value":u(t.name),placeholder:t.placeholder,disabled:i.value||t.disabled,readonly:t.readonly||t.disabled,rows:t.rows||3,class:a.normalizeClass(["w-full rounded-md border px-3 py-2 focus:outline-none focus:ring-2 focus:ring-(--ui-primary)",p?"border-(--ui-danger)":"ui-border-strong",t.inputClass||""]),"aria-describedby":b,"onUpdate:modelValue":r=>d(t.name,r)},null,8,["id","model-value","placeholder","disabled","readonly","rows","class","aria-describedby","onUpdate:modelValue"])):t.type==="select"?(a.openBlock(),a.createElementBlock("div",qe,[a.createElementVNode("div",$e,[a.createVNode(G.default,{id:s,"model-value":u(t.name),options:t.options,placeholder:t.placeholder||"Select an option",disabled:i.value||t.disabled,"has-error":p,"aria-describedby":b,"onUpdate:modelValue":r=>I(t,r)},null,8,["id","model-value","options","placeholder","disabled","has-error","aria-describedby","onUpdate:modelValue"])]),j(t)?(a.openBlock(),a.createBlock(V._sfc_main,{key:0,type:"button",variant:t.actionButton.variant||"outline",size:t.actionButton.size||"icon",class:a.normalizeClass(t.actionButton.class||""),title:t.actionButton.title||t.actionButton.label||"Action",disabled:L(t),loading:P(t),onClick:r=>R(t)},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(t.actionButton.label||"+"),1)]),_:2},1032,["variant","size","class","title","disabled","loading","onClick"])):a.createCommentVNode("",!0)])):t.type==="multiselect"?(a.openBlock(),a.createElementBlock("div",De,[a.createElementVNode("div",Me,[a.createVNode(_e.default,{id:s,"model-value":u(t.name),options:t.options,disabled:i.value||t.disabled,placeholder:t.placeholder||"Select options","has-error":p,"aria-describedby":b,"onUpdate:modelValue":r=>d(t.name,r)},null,8,["id","model-value","options","disabled","placeholder","has-error","aria-describedby","onUpdate:modelValue"])]),j(t)?(a.openBlock(),a.createBlock(V._sfc_main,{key:0,type:"button",variant:t.actionButton.variant||"outline",size:t.actionButton.size||"icon",class:a.normalizeClass(t.actionButton.class||""),title:t.actionButton.title||t.actionButton.label||"Action",disabled:L(t),loading:P(t),onClick:r=>R(t)},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(t.actionButton.label||"+"),1)]),_:2},1032,["variant","size","class","title","disabled","loading","onClick"])):a.createCommentVNode("",!0)])):t.type==="combobox"?(a.openBlock(),a.createBlock(G.default,{key:4,id:s,"model-value":u(t.name),options:t.options,placeholder:t.placeholder||"Select or type to add new",disabled:i.value||t.disabled,"has-error":p,"aria-describedby":b,"allow-create":t.allowCreate,"onUpdate:modelValue":r=>I(t,r)},null,8,["id","model-value","options","placeholder","disabled","has-error","aria-describedby","allow-create","onUpdate:modelValue"])):t.type==="checkbox"?(a.openBlock(),a.createElementBlock("div",je,[a.createVNode(g._sfc_main,{id:s,"model-value":u(t.name),type:"checkbox",disabled:i.value||t.disabled,class:"h-4 w-4 rounded ui-border-strong","aria-describedby":b,"onUpdate:modelValue":r=>d(t.name,r)},null,8,["id","model-value","disabled","aria-describedby","onUpdate:modelValue"]),a.createVNode(z.default,{for:s,class:"ml-2 text-sm ui-text"},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(t.checkboxLabel||t.label),1)]),_:2},1032,["for"])])):t.type==="switch"?(a.openBlock(),a.createElementBlock("div",Le,[a.createElementVNode("button",{id:s,type:"button",role:"switch","aria-checked":u(t.name),disabled:i.value||t.disabled,class:a.normalizeClass(["relative inline-flex h-6 w-11 items-center rounded-full border-2 transition-colors focus:outline-none focus:ring-2 focus:ring-(--ui-primary) focus:ring-offset-2",u(t.name)?"ui-primary-bg border-(--ui-primary)":"ui-surface-soft border-(--ui-border-strong)",i.value||t.disabled?"cursor-not-allowed opacity-50":"cursor-pointer"]),onClick:r=>d(t.name,!u(t.name))},[a.createElementVNode("span",{class:a.normalizeClass(["inline-block h-4 w-4 transform rounded-full ui-surface border ui-border-strong transition-transform",u(t.name)?"translate-x-6":"translate-x-1"])},null,2)],10,Pe),a.createVNode(z.default,{for:s,class:"ml-3 text-sm ui-text"},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(t.checkboxLabel||t.label),1)]),_:2},1032,["for"])])):t.type==="radio"?(a.openBlock(),a.createElementBlock("div",Re,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(t.options,r=>(a.openBlock(),a.createElementBlock("div",{key:r.value,class:"flex items-center"},[a.createVNode(g._sfc_main,{id:`${s}-${r.value}`,"model-value":u(t.name),type:"radio",value:r.value,disabled:i.value||t.disabled,class:"h-4 w-4 ui-border-strong","aria-describedby":b,"onUpdate:modelValue":he=>d(t.name,he)},null,8,["id","model-value","value","disabled","aria-describedby","onUpdate:modelValue"]),a.createVNode(z.default,{for:`${s}-${r.value}`,class:"ml-2 text-sm ui-text"},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(r.label),1)]),_:2},1032,["for"])]))),128))])):t.type==="file"?(a.openBlock(),a.createBlock(K.default,{key:8,multiple:!1,accept:t.accept,"max-size":t.maxSize,variant:t.variant||"default",onFilesSelected:r=>ce(t,r),onFileRemoved:r=>ie(t,r)},null,8,["accept","max-size","variant","onFilesSelected","onFileRemoved"])):t.type==="multifile"?(a.openBlock(),a.createBlock(K.default,{key:9,multiple:t.multiple!==!1,accept:t.accept,"max-size":t.maxSize,"max-files":t.maxFiles,variant:t.variant||"default",onFilesSelected:r=>ue(t,r),onFileRemoved:r=>me(t,r)},null,8,["multiple","accept","max-size","max-files","variant","onFilesSelected","onFileRemoved"])):t.type==="slider"?(a.openBlock(),a.createBlock(ge.default,{key:10,"model-value":u(t.name),min:t.min,max:t.max,step:t.step,disabled:i.value||t.disabled,"onUpdate:modelValue":r=>se(t,r)},null,8,["model-value","min","max","step","disabled","onUpdate:modelValue"])):t.type==="range"?(a.openBlock(),a.createElementBlock("div",Oe,[a.createElementVNode("div",Ye,[a.createVNode(g._sfc_main,{id:s,"model-value":u(t.name),type:"range",min:t.min,max:t.max,step:t.step||1,disabled:i.value||t.disabled,class:"flex-1","aria-describedby":b,"onUpdate:modelValue":r=>d(t.name,r)},null,8,["id","model-value","min","max","step","disabled","aria-describedby","onUpdate:modelValue"]),a.createElementVNode("span",Ie,a.toDisplayString(u(t.name)),1)])])):t.type==="date"?(a.openBlock(),a.createBlock(J.default,{key:12,id:s,"model-value":u(t.name),disabled:i.value||t.disabled,required:t.required,min:t.min,max:t.max,placeholder:t.placeholder||"Select date",format:t.format||"DD/MM/YYYY","enable-time":t.enableTime===!0,"minute-interval":t.minuteInterval||1,clearable:t.clearable!==!1,"show-today":t.showToday!==!1,"calendar-position":t.calendarPosition||"left-0 bottom-full","aria-describedby":b,"onUpdate:modelValue":r=>d(t.name,r)},null,8,["id","model-value","disabled","required","min","max","placeholder","format","enable-time","minute-interval","clearable","show-today","calendar-position","aria-describedby","onUpdate:modelValue"])):t.type==="time"?(a.openBlock(),a.createBlock(g._sfc_main,{key:13,id:s,"model-value":u(t.name),type:"time",disabled:i.value||t.disabled,class:a.normalizeClass([p?"border-(--ui-danger)":"ui-border-strong",t.inputClass||""]),"aria-describedby":b,"onUpdate:modelValue":r=>d(t.name,r)},null,8,["id","model-value","disabled","class","aria-describedby","onUpdate:modelValue"])):t.type==="datetime-local"?(a.openBlock(),a.createBlock(J.default,{key:14,id:s,"model-value":u(t.name),disabled:i.value||t.disabled,required:t.required,min:t.min,max:t.max,placeholder:t.placeholder||"Select date and time",format:t.format||"DD/MM/YYYY","enable-time":!0,"minute-interval":t.minuteInterval||1,clearable:t.clearable!==!1,"show-today":t.showToday!==!1,"aria-describedby":b,"onUpdate:modelValue":r=>d(t.name,r)},null,8,["id","model-value","disabled","required","min","max","placeholder","format","minute-interval","clearable","show-today","aria-describedby","onUpdate:modelValue"])):t.type==="month"?(a.openBlock(),a.createBlock(g._sfc_main,{key:15,id:s,"model-value":u(t.name),type:"month",disabled:i.value||t.disabled,class:a.normalizeClass([p?"border-(--ui-danger)":"ui-border-strong",t.inputClass||""]),"aria-describedby":b,"onUpdate:modelValue":r=>d(t.name,r)},null,8,["id","model-value","disabled","class","aria-describedby","onUpdate:modelValue"])):t.type==="week"?(a.openBlock(),a.createBlock(g._sfc_main,{key:16,id:s,"model-value":u(t.name),type:"week",disabled:i.value||t.disabled,class:a.normalizeClass([p?"border-(--ui-danger)":"ui-border-strong",t.inputClass||""]),"aria-describedby":b,"onUpdate:modelValue":r=>d(t.name,r)},null,8,["id","model-value","disabled","class","aria-describedby","onUpdate:modelValue"])):a.createCommentVNode("",!0)],!0)]),_:2},1032,["id","label","required","error","error-message","help-text","class"]))],2))),128))],2)],2)],2))),128)),a.renderSlot(e.$slots,"actions",{formData:c.value,isValid:Z.value,submit:H},()=>[y.showSubmit?(a.openBlock(),a.createElementBlock("div",He,[y.showReset?(a.openBlock(),a.createBlock(V._sfc_main,{key:0,type:"button",variant:"outline",disabled:i.value,onClick:ye},{default:a.withCtx(()=>[...o[2]||(o[2]=[a.createTextVNode(" Reset ",-1)])]),_:1},8,["disabled"])):a.createCommentVNode("",!0),y.showCancel?(a.openBlock(),a.createBlock(V._sfc_main,{key:1,type:"button",variant:"outline",disabled:i.value,onClick:ve},{default:a.withCtx(()=>[...o[3]||(o[3]=[a.createTextVNode(" Cancel ",-1)])]),_:1},8,["disabled"])):a.createCommentVNode("",!0),a.createVNode(V._sfc_main,{type:"submit",disabled:i.value,loading:i.value,variant:"default"},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(y.submitLabel),1)]),_:1},8,["disabled","loading"])])):a.createCommentVNode("",!0)],!0),y.showSubmit&&X.value?(a.openBlock(),a.createElementBlock("div",Je)):a.createCommentVNode("",!0)],32)])}}},Ke=xe._export_sfc(Ge,[["__scopeId","data-v-7f79d2a2"]]);exports.default=Ke;