@alfakit/vue 0.1.8 → 0.1.10

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 (168) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/app/components.d.ts.map +1 -1
  3. package/dist/app/components.js +1 -0
  4. package/dist/app/components.js.map +1 -1
  5. package/dist/components/actions/ActionModal.js.map +1 -1
  6. package/dist/components/actions/ActionModal.vue.d.ts.map +1 -1
  7. package/dist/components/actions/ActionModal.vue_vue_type_script_setup_true_lang.js +1 -1
  8. package/dist/components/actions/ActionModal.vue_vue_type_script_setup_true_lang.js.map +1 -1
  9. package/dist/components/dev-tools/DevToolsInspector.js.map +1 -1
  10. package/dist/components/dev-tools/DevToolsInspector.vue.d.ts.map +1 -1
  11. package/dist/components/dev-tools/DevToolsInspector.vue_vue_type_script_setup_true_lang.js +1 -1
  12. package/dist/components/dev-tools/DevToolsInspector.vue_vue_type_script_setup_true_lang.js.map +1 -1
  13. package/dist/components/fields/CheckboxListField.js.map +1 -1
  14. package/dist/components/fields/CheckboxListField.vue.d.ts.map +1 -1
  15. package/dist/components/fields/CheckboxListField.vue_vue_type_script_setup_true_lang.js +2 -2
  16. package/dist/components/fields/CheckboxListField.vue_vue_type_script_setup_true_lang.js.map +1 -1
  17. package/dist/components/fields/DatePickerField.js.map +1 -1
  18. package/dist/components/fields/DatePickerField.vue.d.ts.map +1 -1
  19. package/dist/components/fields/DatePickerField.vue_vue_type_script_setup_true_lang.js +34 -32
  20. package/dist/components/fields/DatePickerField.vue_vue_type_script_setup_true_lang.js.map +1 -1
  21. package/dist/components/fields/RichEditorSuggestions.js.map +1 -1
  22. package/dist/components/fields/RichEditorSuggestions.vue.d.ts +1 -1
  23. package/dist/components/fields/RichEditorSuggestions.vue.d.ts.map +1 -1
  24. package/dist/components/fields/RichEditorSuggestions.vue_vue_type_script_setup_true_lang.js +29 -23
  25. package/dist/components/fields/RichEditorSuggestions.vue_vue_type_script_setup_true_lang.js.map +1 -1
  26. package/dist/components/fields/RichEditorToolbarGroup.js.map +1 -1
  27. package/dist/components/fields/RichEditorToolbarGroup.vue.d.ts.map +1 -1
  28. package/dist/components/fields/RichEditorToolbarGroup.vue_vue_type_script_setup_true_lang.js +9 -4
  29. package/dist/components/fields/RichEditorToolbarGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
  30. package/dist/components/file-manager/FileManagerView.js.map +1 -1
  31. package/dist/components/file-manager/FileManagerView.vue.d.ts.map +1 -1
  32. package/dist/components/file-manager/FileManagerView.vue_vue_type_script_setup_true_lang.js +5 -1
  33. package/dist/components/file-manager/FileManagerView.vue_vue_type_script_setup_true_lang.js.map +1 -1
  34. package/dist/components/form/FormBlock.js.map +1 -1
  35. package/dist/components/form/FormBlock.vue.d.ts.map +1 -1
  36. package/dist/components/form/FormBlock.vue_vue_type_script_setup_true_lang.js +79 -78
  37. package/dist/components/form/FormBlock.vue_vue_type_script_setup_true_lang.js.map +1 -1
  38. package/dist/components/layout/CalloutComponent.js.map +1 -1
  39. package/dist/components/layout/CalloutComponent.vue.d.ts.map +1 -1
  40. package/dist/components/layout/CalloutComponent.vue_vue_type_script_setup_true_lang.js +43 -39
  41. package/dist/components/layout/CalloutComponent.vue_vue_type_script_setup_true_lang.js.map +1 -1
  42. package/dist/components/layout/EmptyStateComponent.js.map +1 -1
  43. package/dist/components/layout/EmptyStateComponent.vue.d.ts.map +1 -1
  44. package/dist/components/layout/EmptyStateComponent.vue_vue_type_script_setup_true_lang.js +29 -26
  45. package/dist/components/layout/EmptyStateComponent.vue_vue_type_script_setup_true_lang.js.map +1 -1
  46. package/dist/components/layout/MixedContent.js.map +1 -1
  47. package/dist/components/layout/MixedContent.vue.d.ts +5 -3
  48. package/dist/components/layout/MixedContent.vue.d.ts.map +1 -1
  49. package/dist/components/layout/MixedContent.vue_vue_type_script_setup_true_lang.js +5 -4
  50. package/dist/components/layout/MixedContent.vue_vue_type_script_setup_true_lang.js.map +1 -1
  51. package/dist/components/layout/SectionComponent.js.map +1 -1
  52. package/dist/components/layout/SectionComponent.vue.d.ts.map +1 -1
  53. package/dist/components/layout/SectionComponent.vue_vue_type_script_setup_true_lang.js +12 -8
  54. package/dist/components/layout/SectionComponent.vue_vue_type_script_setup_true_lang.js.map +1 -1
  55. package/dist/components/notifications/NotificationsMenu.js.map +1 -1
  56. package/dist/components/notifications/NotificationsMenu.vue.d.ts.map +1 -1
  57. package/dist/components/notifications/NotificationsMenu.vue_vue_type_script_setup_true_lang.js +133 -104
  58. package/dist/components/notifications/NotificationsMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  59. package/dist/components/panel/BottomNav.js.map +1 -1
  60. package/dist/components/panel/BottomNav.vue_vue_type_script_setup_true_lang.js +2 -2
  61. package/dist/components/panel/BottomNav.vue_vue_type_script_setup_true_lang.js.map +1 -1
  62. package/dist/components/panel/KeyboardShortcuts.js.map +1 -1
  63. package/dist/components/panel/KeyboardShortcuts.vue_vue_type_script_setup_true_lang.js +1 -1
  64. package/dist/components/panel/KeyboardShortcuts.vue_vue_type_script_setup_true_lang.js.map +1 -1
  65. package/dist/components/panel/NavGroup.js.map +1 -1
  66. package/dist/components/panel/NavGroup.vue_vue_type_script_setup_true_lang.js +3 -3
  67. package/dist/components/panel/NavGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
  68. package/dist/components/panel/NavItem.js.map +1 -1
  69. package/dist/components/panel/NavItem.vue.d.ts.map +1 -1
  70. package/dist/components/panel/NavItem.vue_vue_type_script_setup_true_lang.js +1 -1
  71. package/dist/components/panel/NavItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
  72. package/dist/components/panel/NavSubItem.js.map +1 -1
  73. package/dist/components/panel/NavSubItem.vue.d.ts.map +1 -1
  74. package/dist/components/panel/NavSubItem.vue_vue_type_script_setup_true_lang.js +1 -1
  75. package/dist/components/panel/NavSubItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
  76. package/dist/components/panel/ShortcutsOverlay.js.map +1 -1
  77. package/dist/components/panel/ShortcutsOverlay.vue.d.ts.map +1 -1
  78. package/dist/components/panel/ShortcutsOverlay.vue_vue_type_script_setup_true_lang.js +20 -19
  79. package/dist/components/panel/ShortcutsOverlay.vue_vue_type_script_setup_true_lang.js.map +1 -1
  80. package/dist/components/table/ColumnManager.js.map +1 -1
  81. package/dist/components/table/ColumnManager.vue.d.ts.map +1 -1
  82. package/dist/components/table/ColumnManager.vue_vue_type_script_setup_true_lang.js +6 -6
  83. package/dist/components/table/ColumnManager.vue_vue_type_script_setup_true_lang.js.map +1 -1
  84. package/dist/components/table/Spreadsheet.js.map +1 -1
  85. package/dist/components/table/Spreadsheet.vue.d.ts.map +1 -1
  86. package/dist/components/table/Spreadsheet.vue_vue_type_script_setup_true_lang.js +37 -33
  87. package/dist/components/table/Spreadsheet.vue_vue_type_script_setup_true_lang.js.map +1 -1
  88. package/dist/components/translation-manager/TranslationManagerView.js.map +1 -1
  89. package/dist/components/translation-manager/TranslationManagerView.vue.d.ts.map +1 -1
  90. package/dist/components/translation-manager/TranslationManagerView.vue_vue_type_script_setup_true_lang.js +1 -1
  91. package/dist/components/translation-manager/TranslationManagerView.vue_vue_type_script_setup_true_lang.js.map +1 -1
  92. package/dist/components/ui/SidebarMenuButton.js.map +1 -1
  93. package/dist/components/ui/SidebarMenuButton.vue.d.ts.map +1 -1
  94. package/dist/components/ui/SidebarMenuButton.vue_vue_type_script_setup_true_lang.js +12 -12
  95. package/dist/components/ui/SidebarMenuButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
  96. package/dist/components/ui/TooltipTrigger.js.map +1 -1
  97. package/dist/components/ui/TooltipTrigger.vue.d.ts +2 -2
  98. package/dist/components/ui/TooltipTrigger.vue.d.ts.map +1 -1
  99. package/dist/components/ui/TooltipTrigger.vue_vue_type_script_setup_true_lang.js +10 -7
  100. package/dist/components/ui/TooltipTrigger.vue_vue_type_script_setup_true_lang.js.map +1 -1
  101. package/dist/components/widgets/StatCard.js.map +1 -1
  102. package/dist/components/widgets/StatCard.vue.d.ts.map +1 -1
  103. package/dist/components/widgets/StatCard.vue_vue_type_script_setup_true_lang.js +30 -30
  104. package/dist/components/widgets/StatCard.vue_vue_type_script_setup_true_lang.js.map +1 -1
  105. package/dist/eject-manifest.json +2 -2
  106. package/dist/layouts/TopNavLayout.js.map +1 -1
  107. package/dist/layouts/TopNavLayout.vue_vue_type_script_setup_true_lang.js +2 -2
  108. package/dist/layouts/TopNavLayout.vue_vue_type_script_setup_true_lang.js.map +1 -1
  109. package/dist/layouts/TopNavMenu.js.map +1 -1
  110. package/dist/layouts/TopNavMenu.vue_vue_type_script_setup_true_lang.js +1 -1
  111. package/dist/layouts/TopNavMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  112. package/dist/pages/AlfakitPage.js.map +1 -1
  113. package/dist/pages/AlfakitPage.vue.d.ts.map +1 -1
  114. package/dist/pages/AlfakitPage.vue_vue_type_script_setup_true_lang.js +16 -19
  115. package/dist/pages/AlfakitPage.vue_vue_type_script_setup_true_lang.js.map +1 -1
  116. package/dist/standalone/AlfakitComponent.js.map +1 -1
  117. package/dist/standalone/AlfakitComponent.vue.d.ts.map +1 -1
  118. package/dist/standalone/AlfakitComponent.vue_vue_type_script_setup_true_lang.js +29 -24
  119. package/dist/standalone/AlfakitComponent.vue_vue_type_script_setup_true_lang.js.map +1 -1
  120. package/dist/standalone/runtime.d.ts.map +1 -1
  121. package/dist/standalone/runtime.js +25 -25
  122. package/dist/standalone/runtime.js.map +1 -1
  123. package/dist/standalone.css +12 -7
  124. package/dist/starter-kit/AlfakitStarterKitRoot.js.map +1 -1
  125. package/dist/starter-kit/AlfakitStarterKitRoot.vue.d.ts.map +1 -1
  126. package/dist/starter-kit/AlfakitStarterKitRoot.vue_vue_type_script_setup_true_lang.js +25 -21
  127. package/dist/starter-kit/AlfakitStarterKitRoot.vue_vue_type_script_setup_true_lang.js.map +1 -1
  128. package/dist/starter-kit/navigation.d.ts +6 -1
  129. package/dist/starter-kit/navigation.d.ts.map +1 -1
  130. package/dist/starter-kit/navigation.js +11 -10
  131. package/dist/starter-kit/navigation.js.map +1 -1
  132. package/dist/styles.css +2 -1
  133. package/dist/themes.css +4 -0
  134. package/package.json +2 -2
  135. package/src/app/components.ts +3 -0
  136. package/src/components/actions/ActionModal.vue +2 -0
  137. package/src/components/dev-tools/DevToolsInspector.vue +1 -1
  138. package/src/components/fields/CheckboxListField.vue +2 -2
  139. package/src/components/fields/DatePickerField.vue +1 -0
  140. package/src/components/fields/RichEditorSuggestions.vue +13 -6
  141. package/src/components/fields/RichEditorToolbarGroup.vue +16 -1
  142. package/src/components/file-manager/FileManagerView.vue +3 -1
  143. package/src/components/form/FormBlock.vue +15 -2
  144. package/src/components/layout/CalloutComponent.vue +15 -2
  145. package/src/components/layout/EmptyStateComponent.vue +10 -1
  146. package/src/components/layout/MixedContent.vue +12 -4
  147. package/src/components/layout/SectionComponent.vue +20 -4
  148. package/src/components/notifications/NotificationsMenu.vue +45 -1
  149. package/src/components/panel/BottomNav.vue +2 -2
  150. package/src/components/panel/KeyboardShortcuts.vue +1 -1
  151. package/src/components/panel/NavGroup.vue +3 -3
  152. package/src/components/panel/NavItem.vue +5 -1
  153. package/src/components/panel/NavSubItem.vue +5 -1
  154. package/src/components/panel/ShortcutsOverlay.vue +27 -22
  155. package/src/components/table/ColumnManager.vue +6 -4
  156. package/src/components/table/Spreadsheet.vue +9 -4
  157. package/src/components/translation-manager/TranslationManagerView.vue +1 -1
  158. package/src/components/ui/SidebarMenuButton.vue +6 -0
  159. package/src/components/ui/TooltipTrigger.vue +4 -1
  160. package/src/components/widgets/StatCard.vue +6 -3
  161. package/src/layouts/TopNavLayout.vue +2 -2
  162. package/src/layouts/TopNavMenu.vue +1 -1
  163. package/src/pages/AlfakitPage.vue +13 -3
  164. package/src/standalone/AlfakitComponent.vue +16 -5
  165. package/src/standalone/runtime.ts +3 -0
  166. package/src/starter-kit/AlfakitStarterKitRoot.vue +7 -0
  167. package/src/starter-kit/navigation.ts +12 -1
  168. package/src/styles.css +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"DevToolsInspector.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","Sheet","_withCtx","_createVNode","SheetTrigger","Button","_unref","SheetContent","_createElementVNode","SheetHeader","SheetTitle","_createTextVNode","_toDisplayString","SheetDescription","ScrollArea","_createElementBlock","_Fragment","_createCommentVNode","_renderList","Input","DevToolsJsonNode","Button_default","Input_default","Sheet_default","SheetContent_default","SheetDescription_default","SheetHeader_default","SheetTitle_default","SheetTrigger_default","ScrollArea_default","DevToolsJsonNode_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","_hoisted_18","_hoisted_19","_hoisted_20","_hoisted_21","_hoisted_22","_hoisted_23","_hoisted_24","_hoisted_25","_hoisted_26","_hoisted_27","_hoisted_28","_hoisted_29","_hoisted_30","_hoisted_31","_hoisted_32","_hoisted_33","_hoisted_34","_hoisted_35","_hoisted_36","_hoisted_37","DevToolsInspector_vue_vue_type_script_setup_true_lang_default","t","useT","formatter","useFormatter","direction","useDirection","props","useAlfakitProps","tools","computed","data","inspectableProps","payload","byteLength","query","ref","copied","serverTime","search","searchJson","roots","jsonEntries","parameters","stop","timer","onMounted","latestServerTiming","router","onBeforeUnmount","copy","prettyJson","time","value","openBlock","createBlock","withCtx","createVNode","unref","BracesIcon","createElementVNode","createTextVNode","toDisplayString","formatBytes","createElementBlock","Fragment","createCommentVNode","renderList","key","jsonScalar","item","ExternalLinkIcon","CheckIcon","CopyIcon","_cache","$event","entry"],"sources":["../../../src/components/dev-tools/DevToolsInspector.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport {\n byteLength,\n formatBytes,\n inspectableProps,\n jsonEntries,\n jsonScalar,\n latestServerTiming,\n prettyJson,\n searchJson,\n} from '@alfakit/core'\nimport { router } from '@inertiajs/vue3'\nimport { BracesIcon, CheckIcon, CopyIcon, ExternalLinkIcon } from '@lucide/vue'\nimport { computed, onBeforeUnmount, onMounted, ref } from 'vue'\nimport { useAlfakitProps, useDirection, useFormatter, useT } from '../../context'\nimport Button from '../ui/Button.vue'\nimport Input from '../ui/Input.vue'\nimport ScrollArea from '../ui/ScrollArea.vue'\nimport Sheet from '../ui/Sheet.vue'\nimport SheetContent from '../ui/SheetContent.vue'\nimport SheetDescription from '../ui/SheetDescription.vue'\nimport SheetHeader from '../ui/SheetHeader.vue'\nimport SheetTitle from '../ui/SheetTitle.vue'\nimport SheetTrigger from '../ui/SheetTrigger.vue'\nimport DevToolsJsonNode from './DevToolsJsonNode.vue'\n\n/**\n * The schema inspector: a floating developer button that opens a drawer with the page's\n * props as a searchable JSON tree (with a copy button), what the context token identifies,\n * the server time reported in `Server-Timing`, the payload size and editor links for the\n * PHP classes behind the page. Rendered only for pages that carry `alfakitDevTools`.\n */\nconst t = useT()\nconst formatter = useFormatter()\nconst direction = useDirection()\nconst props = useAlfakitProps()\nconst tools = computed(() => props.value.alfakitDevTools)\nconst data = computed(() => inspectableProps(props.value as unknown as Record<string, unknown>))\nconst payload = computed(() => byteLength(props.value))\nconst query = ref('')\nconst copied = ref(false)\nconst serverTime = ref<number | null>(null)\nconst search = computed(() => searchJson(data.value, query.value))\nconst roots = computed(() => jsonEntries(data.value))\nconst parameters = computed(() => Object.entries(tools.value?.context.parameters ?? {}))\n\nlet stop: (() => void) | undefined\nlet timer: ReturnType<typeof setTimeout> | undefined\n\nonMounted(() => {\n serverTime.value = latestServerTiming()\n // Re-read after every visit: the latest response carries the newest header.\n stop = router.on('finish', () => {\n serverTime.value = latestServerTiming()\n })\n})\n\nonBeforeUnmount(() => {\n stop?.()\n clearTimeout(timer)\n})\n\nconst copy = () => {\n void navigator.clipboard?.writeText(prettyJson(data.value)).then(() => {\n copied.value = true\n clearTimeout(timer)\n timer = setTimeout(() => (copied.value = false), 2000)\n })\n}\n\nconst time = (value: number | null) =>\n value === null ? t('dev_tools.never', {}, 'Never') : formatter.value.dateTime(value * 1000)\n</script>\n\n<template>\n <Sheet v-if=\"tools\">\n <SheetTrigger as-child>\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"icon\"\n :aria-label=\"t('dev_tools.open', {}, 'Open schema inspector')\"\n data-slot=\"dev-tools-toggle\"\n class=\"fixed end-4 bottom-4 z-40 rounded-full shadow-md\"\n >\n <BracesIcon />\n </Button>\n </SheetTrigger>\n <SheetContent\n :side=\"direction === 'rtl' ? 'left' : 'right'\"\n class=\"flex w-full flex-col gap-0 p-0 sm:max-w-xl\"\n >\n <div data-slot=\"dev-tools\" class=\"flex min-h-0 flex-1 flex-col\">\n <SheetHeader class=\"border-b\">\n <SheetTitle class=\"flex items-center gap-2\">\n <BracesIcon class=\"size-4\" />\n {{ t('dev_tools.title', {}, 'Schema inspector') }}\n </SheetTitle>\n <SheetDescription class=\"truncate font-mono text-xs\" :title=\"tools.context.page\">\n {{ tools.context.page }}\n </SheetDescription>\n </SheetHeader>\n <ScrollArea class=\"min-h-0 flex-1\">\n <div class=\"space-y-5 p-4 text-sm\">\n <dl class=\"grid grid-cols-2 gap-3\">\n <div class=\"rounded-md border p-3\">\n <dt class=\"text-muted-foreground text-xs\">\n {{ t('dev_tools.server_time', {}, 'Server time') }}\n </dt>\n <dd class=\"font-mono text-sm font-semibold tabular-nums\">\n {{\n serverTime === null\n ? t('dev_tools.not_measured', {}, 'Not measured')\n : t(\n 'dev_tools.milliseconds',\n { value: formatter.number(serverTime) },\n ':value ms',\n )\n }}\n </dd>\n </div>\n <div class=\"rounded-md border p-3\">\n <dt class=\"text-muted-foreground text-xs\">\n {{ t('dev_tools.payload', {}, 'Payload size') }}\n </dt>\n <dd class=\"font-mono text-sm font-semibold tabular-nums\">\n {{ formatBytes(payload) }}\n </dd>\n </div>\n </dl>\n\n <section data-slot=\"dev-tools-context\">\n <h3 class=\"mb-2 text-sm font-medium\">\n {{ t('dev_tools.context', {}, 'Context token') }}\n </h3>\n <dl class=\"grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 text-xs\">\n <dt class=\"text-muted-foreground\">{{ t('dev_tools.panel', {}, 'Panel') }}</dt>\n <dd class=\"min-w-0 truncate font-mono\">{{ tools.context.panel }}</dd>\n <dt class=\"text-muted-foreground\">{{ t('dev_tools.page', {}, 'Page') }}</dt>\n <dd class=\"min-w-0 truncate font-mono\" :title=\"tools.context.page\">\n {{ tools.context.page }}\n </dd>\n <template v-if=\"tools.context.component\">\n <dt class=\"text-muted-foreground\">\n {{ t('dev_tools.component', {}, 'Component') }}\n </dt>\n <dd class=\"min-w-0 truncate font-mono\">{{ tools.context.component }}</dd>\n </template>\n <template v-if=\"tools.tenant !== null\">\n <dt class=\"text-muted-foreground\">{{ t('dev_tools.tenant', {}, 'Tenant') }}</dt>\n <dd class=\"min-w-0 truncate font-mono\">{{ tools.tenant }}</dd>\n </template>\n <template v-for=\"[key, value] in parameters\" :key=\"key\">\n <dt class=\"text-muted-foreground\">{{ key }}</dt>\n <dd class=\"min-w-0 truncate font-mono\">{{ jsonScalar(value) }}</dd>\n </template>\n <dt class=\"text-muted-foreground\">\n {{ t('dev_tools.bound_to_user', {}, 'Bound to the user') }}\n </dt>\n <dd>\n {{\n tools.context.boundToUser\n ? t('dev_tools.yes', {}, 'Yes')\n : t('dev_tools.no', {}, 'No')\n }}\n </dd>\n <dt class=\"text-muted-foreground\">{{ t('dev_tools.issued_at', {}, 'Issued') }}</dt>\n <dd>{{ time(tools.context.issuedAt) }}</dd>\n <dt class=\"text-muted-foreground\">\n {{ t('dev_tools.expires_at', {}, 'Expires') }}\n </dt>\n <dd>{{ time(tools.context.expiresAt) }}</dd>\n </dl>\n </section>\n\n <section data-slot=\"dev-tools-classes\">\n <h3 class=\"mb-2 text-sm font-medium\">{{ t('dev_tools.classes', {}, 'Classes') }}</h3>\n <ul class=\"divide-y rounded-md border text-xs\">\n <li\n v-for=\"item in tools.classes\"\n :key=\"item.role\"\n class=\"flex items-center gap-2 px-3 py-1.5\"\n >\n <span class=\"text-muted-foreground w-16 shrink-0\">\n {{ t(`dev_tools.roles.${item.role}`, {}, item.role) }}\n </span>\n <span\n class=\"min-w-0 flex-1 truncate font-mono\"\n :title=\"item.file ? `${item.file}:${item.line ?? 1}` : item.class\"\n >\n {{ item.class }}\n </span>\n <a\n v-if=\"item.url\"\n :href=\"item.url\"\n class=\"text-primary inline-flex shrink-0 items-center gap-1 hover:underline\"\n :aria-label=\"\n t(\n 'dev_tools.open_in_editor',\n { class: item.class, editor: tools.editor ?? '' },\n 'Open :class in :editor',\n )\n \"\n >\n <ExternalLinkIcon class=\"size-3.5\" />\n </a>\n </li>\n </ul>\n <p v-if=\"tools.editor === null\" class=\"text-muted-foreground mt-2 text-xs\">\n {{\n t(\n 'dev_tools.no_editor',\n {},\n 'Set APP_EDITOR (config app.editor) to open these classes in your editor.',\n )\n }}\n </p>\n </section>\n\n <section data-slot=\"dev-tools-schema\">\n <div class=\"mb-2 flex items-center gap-2\">\n <h3 class=\"me-auto text-sm font-medium\">\n {{ t('dev_tools.schema', {}, 'Schema') }}\n </h3>\n <Button type=\"button\" variant=\"ghost\" size=\"sm\" @click=\"copy\">\n <CheckIcon v-if=\"copied\" />\n <CopyIcon v-else />\n {{\n copied\n ? t('dev_tools.copied', {}, 'Copied')\n : t('dev_tools.copy', {}, 'Copy JSON')\n }}\n </Button>\n </div>\n <Input\n v-model=\"query\"\n type=\"search\"\n :placeholder=\"t('dev_tools.search', {}, 'Search keys and values')\"\n :aria-label=\"t('dev_tools.search', {}, 'Search keys and values')\"\n class=\"mb-2 h-8\"\n />\n <p\n v-if=\"query.trim() !== '' && search.matches.size === 0\"\n class=\"text-muted-foreground text-sm\"\n >\n {{\n t('dev_tools.no_matches', { query: query.trim() }, 'Nothing matches “:query”.')\n }}\n </p>\n <ul\n v-else\n dir=\"ltr\"\n role=\"tree\"\n :aria-label=\"t('dev_tools.schema', {}, 'Schema')\"\n class=\"bg-muted/40 overflow-x-auto rounded-md p-2 text-start font-mono text-xs leading-relaxed\"\n >\n <DevToolsJsonNode\n v-for=\"entry in roots\"\n :key=\"entry.path\"\n :entry=\"entry\"\n :depth=\"0\"\n :search=\"search\"\n :query=\"query\"\n />\n </ul>\n </section>\n </div>\n </ScrollArea>\n </div>\n </SheetContent>\n </Sheet>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCA,IAAMsE,IAAIC,GAAK,GACTC,IAAYC,GAAa,GACzBC,KAAYC,EAAa,GACzBC,IAAQC,EAAgB,GACxBC,IAAQC,QAAeH,EAAM,MAAM,eAAe,GAClDI,IAAOD,QAAeE,EAAiBL,EAAM,KAA2C,CAAC,GACzFM,KAAUH,QAAeI,EAAWP,EAAM,KAAK,CAAC,GAChDQ,IAAQC,EAAI,EAAE,GACdC,IAASD,EAAI,EAAK,GAClBE,IAAaF,EAAmB,IAAI,GACpCG,IAAST,QAAeU,GAAWT,EAAK,OAAOI,EAAM,KAAK,CAAC,GAC3DM,KAAQX,QAAeY,GAAYX,EAAK,KAAK,CAAC,GAC9CY,KAAab,QAAe,OAAO,QAAQD,EAAM,OAAO,QAAQ,cAAc,CAAC,CAAC,CAAC,GAEnFe,GACAC;EAUJ,AARAC,QAAgB;GAGd,AAFA,EAAW,QAAQC,EAAmB,GAEtC,IAAOC,GAAO,GAAG,gBAAgB;IAC/B,EAAW,QAAQD,EAAmB;GACxC,CAAC;EACH,CAAC,GAEDE,SAAsB;GAEpB,AADAL,IAAO,GACP,aAAaC,CAAK;EACpB,CAAC;EAED,IAAMK,WAAa;GACjB,UAAe,WAAW,UAAUC,GAAWpB,EAAK,KAAK,CAAC,CAAC,CAAC,WAAW;IAGrE,AAFA,EAAO,QAAQ,IACf,aAAac,CAAK,GAClB,IAAQ,iBAAkB,EAAO,QAAQ,IAAQ,GAAI;GACvD,CAAC;EACH,GAEMO,KAAQ,MACZC,MAAU,OAAOhC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AA,CAAA,GAAA,wBAAA;QACd,OAAM;;;;;;OAGAc,EAAA,MAAM,KAAI,MAAA,MAAaI,EAAA,MAAO,QAAQ,SAAI,KADlDxF,EAAA,GAAAgB,EAOI,KAPJmD,IAOItD,EAFAN,EAAA+D,CAAA,CAAC,CAAA,wBAAA,EAAA,OAAkCc,EAAA,MAAM,KAAI,EAAA,GAAA,2BAAA,CAAA,GAAA,CAAA,MAGjDpF,EAAA,GAAAgB,EAeK,MAAA;;QAbH,KAAI;QACJ,MAAK;QACJ,cAAYT,EAAA+D,CAAA,CAAC,CAAA,oBAAA,CAAA,GAAA,QAAA;QACd,OAAM;OAENtE,GAAAA,EAAAA,EAAA,EAAA,GAAAgB,EAOEC,GAAA,MAAAE,EANgBuE,GAAA,QAAT,OADT1F,EAAA,GAAAC,EAOEoB,GAAA;QALC,KAAKwG,EAAM;QACJ;QACP,OAAO;QACP,QAAQrC,EAAA;QACR,OAAOJ,EAAA"}
1
+ {"version":3,"file":"DevToolsInspector.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","Sheet","_withCtx","_createVNode","SheetTrigger","Button","_unref","SheetContent","_createElementVNode","SheetHeader","SheetTitle","_createTextVNode","_toDisplayString","SheetDescription","ScrollArea","_createElementBlock","_Fragment","_createCommentVNode","_renderList","Input","DevToolsJsonNode","Button_default","Input_default","Sheet_default","SheetContent_default","SheetDescription_default","SheetHeader_default","SheetTitle_default","SheetTrigger_default","ScrollArea_default","DevToolsJsonNode_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","_hoisted_18","_hoisted_19","_hoisted_20","_hoisted_21","_hoisted_22","_hoisted_23","_hoisted_24","_hoisted_25","_hoisted_26","_hoisted_27","_hoisted_28","_hoisted_29","_hoisted_30","_hoisted_31","_hoisted_32","_hoisted_33","_hoisted_34","_hoisted_35","_hoisted_36","_hoisted_37","DevToolsInspector_vue_vue_type_script_setup_true_lang_default","t","useT","formatter","useFormatter","direction","useDirection","props","useAlfakitProps","tools","computed","data","inspectableProps","payload","byteLength","query","ref","copied","serverTime","search","searchJson","roots","jsonEntries","parameters","stop","timer","onMounted","latestServerTiming","router","onBeforeUnmount","copy","prettyJson","time","value","openBlock","createBlock","withCtx","createVNode","unref","BracesIcon","createElementVNode","createTextVNode","toDisplayString","formatBytes","createElementBlock","Fragment","createCommentVNode","renderList","key","jsonScalar","item","ExternalLinkIcon","CheckIcon","CopyIcon","_cache","$event","entry"],"sources":["../../../src/components/dev-tools/DevToolsInspector.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport {\n byteLength,\n formatBytes,\n inspectableProps,\n jsonEntries,\n jsonScalar,\n latestServerTiming,\n prettyJson,\n searchJson,\n} from '@alfakit/core'\nimport { router } from '@inertiajs/vue3'\nimport { BracesIcon, CheckIcon, CopyIcon, ExternalLinkIcon } from '@lucide/vue'\nimport { computed, onBeforeUnmount, onMounted, ref } from 'vue'\nimport { useAlfakitProps, useDirection, useFormatter, useT } from '../../context'\nimport Button from '../ui/Button.vue'\nimport Input from '../ui/Input.vue'\nimport ScrollArea from '../ui/ScrollArea.vue'\nimport Sheet from '../ui/Sheet.vue'\nimport SheetContent from '../ui/SheetContent.vue'\nimport SheetDescription from '../ui/SheetDescription.vue'\nimport SheetHeader from '../ui/SheetHeader.vue'\nimport SheetTitle from '../ui/SheetTitle.vue'\nimport SheetTrigger from '../ui/SheetTrigger.vue'\nimport DevToolsJsonNode from './DevToolsJsonNode.vue'\n\n/**\n * The schema inspector: a floating developer button that opens a drawer with the page's\n * props as a searchable JSON tree (with a copy button), what the context token identifies,\n * the server time reported in `Server-Timing`, the payload size and editor links for the\n * PHP classes behind the page. Rendered only for pages that carry `alfakitDevTools`.\n */\nconst t = useT()\nconst formatter = useFormatter()\nconst direction = useDirection()\nconst props = useAlfakitProps()\nconst tools = computed(() => props.value.alfakitDevTools)\nconst data = computed(() => inspectableProps(props.value as unknown as Record<string, unknown>))\nconst payload = computed(() => byteLength(props.value))\nconst query = ref('')\nconst copied = ref(false)\nconst serverTime = ref<number | null>(null)\nconst search = computed(() => searchJson(data.value, query.value))\nconst roots = computed(() => jsonEntries(data.value))\nconst parameters = computed(() => Object.entries(tools.value?.context.parameters ?? {}))\n\nlet stop: (() => void) | undefined\nlet timer: ReturnType<typeof setTimeout> | undefined\n\nonMounted(() => {\n serverTime.value = latestServerTiming()\n // Re-read after every visit: the latest response carries the newest header.\n stop = router.on('finish', () => {\n serverTime.value = latestServerTiming()\n })\n})\n\nonBeforeUnmount(() => {\n stop?.()\n clearTimeout(timer)\n})\n\nconst copy = () => {\n void navigator.clipboard?.writeText(prettyJson(data.value)).then(() => {\n copied.value = true\n clearTimeout(timer)\n timer = setTimeout(() => (copied.value = false), 2000)\n })\n}\n\nconst time = (value: number | null) =>\n value === null ? t('dev_tools.never', {}, 'Never') : formatter.value.dateTime(value * 1000)\n</script>\n\n<template>\n <Sheet v-if=\"tools\">\n <SheetTrigger as-child>\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"icon\"\n :aria-label=\"t('dev_tools.open', {}, 'Open schema inspector')\"\n data-slot=\"dev-tools-toggle\"\n class=\"fixed end-4 bottom-16 z-40 rounded-full shadow-md [[data-slot=starter-kit-root]_&]:end-auto [[data-slot=starter-kit-root]_&]:right-4\"\n >\n <BracesIcon />\n </Button>\n </SheetTrigger>\n <SheetContent\n :side=\"direction === 'rtl' ? 'left' : 'right'\"\n class=\"flex w-full flex-col gap-0 p-0 sm:max-w-xl\"\n >\n <div data-slot=\"dev-tools\" class=\"flex min-h-0 flex-1 flex-col\">\n <SheetHeader class=\"border-b\">\n <SheetTitle class=\"flex items-center gap-2\">\n <BracesIcon class=\"size-4\" />\n {{ t('dev_tools.title', {}, 'Schema inspector') }}\n </SheetTitle>\n <SheetDescription class=\"truncate font-mono text-xs\" :title=\"tools.context.page\">\n {{ tools.context.page }}\n </SheetDescription>\n </SheetHeader>\n <ScrollArea class=\"min-h-0 flex-1\">\n <div class=\"space-y-5 p-4 text-sm\">\n <dl class=\"grid grid-cols-2 gap-3\">\n <div class=\"rounded-md border p-3\">\n <dt class=\"text-muted-foreground text-xs\">\n {{ t('dev_tools.server_time', {}, 'Server time') }}\n </dt>\n <dd class=\"font-mono text-sm font-semibold tabular-nums\">\n {{\n serverTime === null\n ? t('dev_tools.not_measured', {}, 'Not measured')\n : t(\n 'dev_tools.milliseconds',\n { value: formatter.number(serverTime) },\n ':value ms',\n )\n }}\n </dd>\n </div>\n <div class=\"rounded-md border p-3\">\n <dt class=\"text-muted-foreground text-xs\">\n {{ t('dev_tools.payload', {}, 'Payload size') }}\n </dt>\n <dd class=\"font-mono text-sm font-semibold tabular-nums\">\n {{ formatBytes(payload) }}\n </dd>\n </div>\n </dl>\n\n <section data-slot=\"dev-tools-context\">\n <h3 class=\"mb-2 text-sm font-medium\">\n {{ t('dev_tools.context', {}, 'Context token') }}\n </h3>\n <dl class=\"grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 text-xs\">\n <dt class=\"text-muted-foreground\">{{ t('dev_tools.panel', {}, 'Panel') }}</dt>\n <dd class=\"min-w-0 truncate font-mono\">{{ tools.context.panel }}</dd>\n <dt class=\"text-muted-foreground\">{{ t('dev_tools.page', {}, 'Page') }}</dt>\n <dd class=\"min-w-0 truncate font-mono\" :title=\"tools.context.page\">\n {{ tools.context.page }}\n </dd>\n <template v-if=\"tools.context.component\">\n <dt class=\"text-muted-foreground\">\n {{ t('dev_tools.component', {}, 'Component') }}\n </dt>\n <dd class=\"min-w-0 truncate font-mono\">{{ tools.context.component }}</dd>\n </template>\n <template v-if=\"tools.tenant !== null\">\n <dt class=\"text-muted-foreground\">{{ t('dev_tools.tenant', {}, 'Tenant') }}</dt>\n <dd class=\"min-w-0 truncate font-mono\">{{ tools.tenant }}</dd>\n </template>\n <template v-for=\"[key, value] in parameters\" :key=\"key\">\n <dt class=\"text-muted-foreground\">{{ key }}</dt>\n <dd class=\"min-w-0 truncate font-mono\">{{ jsonScalar(value) }}</dd>\n </template>\n <dt class=\"text-muted-foreground\">\n {{ t('dev_tools.bound_to_user', {}, 'Bound to the user') }}\n </dt>\n <dd>\n {{\n tools.context.boundToUser\n ? t('dev_tools.yes', {}, 'Yes')\n : t('dev_tools.no', {}, 'No')\n }}\n </dd>\n <dt class=\"text-muted-foreground\">{{ t('dev_tools.issued_at', {}, 'Issued') }}</dt>\n <dd>{{ time(tools.context.issuedAt) }}</dd>\n <dt class=\"text-muted-foreground\">\n {{ t('dev_tools.expires_at', {}, 'Expires') }}\n </dt>\n <dd>{{ time(tools.context.expiresAt) }}</dd>\n </dl>\n </section>\n\n <section data-slot=\"dev-tools-classes\">\n <h3 class=\"mb-2 text-sm font-medium\">{{ t('dev_tools.classes', {}, 'Classes') }}</h3>\n <ul class=\"divide-y rounded-md border text-xs\">\n <li\n v-for=\"item in tools.classes\"\n :key=\"item.role\"\n class=\"flex items-center gap-2 px-3 py-1.5\"\n >\n <span class=\"text-muted-foreground w-16 shrink-0\">\n {{ t(`dev_tools.roles.${item.role}`, {}, item.role) }}\n </span>\n <span\n class=\"min-w-0 flex-1 truncate font-mono\"\n :title=\"item.file ? `${item.file}:${item.line ?? 1}` : item.class\"\n >\n {{ item.class }}\n </span>\n <a\n v-if=\"item.url\"\n :href=\"item.url\"\n class=\"text-primary inline-flex shrink-0 items-center gap-1 hover:underline\"\n :aria-label=\"\n t(\n 'dev_tools.open_in_editor',\n { class: item.class, editor: tools.editor ?? '' },\n 'Open :class in :editor',\n )\n \"\n >\n <ExternalLinkIcon class=\"size-3.5\" />\n </a>\n </li>\n </ul>\n <p v-if=\"tools.editor === null\" class=\"text-muted-foreground mt-2 text-xs\">\n {{\n t(\n 'dev_tools.no_editor',\n {},\n 'Set APP_EDITOR (config app.editor) to open these classes in your editor.',\n )\n }}\n </p>\n </section>\n\n <section data-slot=\"dev-tools-schema\">\n <div class=\"mb-2 flex items-center gap-2\">\n <h3 class=\"me-auto text-sm font-medium\">\n {{ t('dev_tools.schema', {}, 'Schema') }}\n </h3>\n <Button type=\"button\" variant=\"ghost\" size=\"sm\" @click=\"copy\">\n <CheckIcon v-if=\"copied\" />\n <CopyIcon v-else />\n {{\n copied\n ? t('dev_tools.copied', {}, 'Copied')\n : t('dev_tools.copy', {}, 'Copy JSON')\n }}\n </Button>\n </div>\n <Input\n v-model=\"query\"\n type=\"search\"\n :placeholder=\"t('dev_tools.search', {}, 'Search keys and values')\"\n :aria-label=\"t('dev_tools.search', {}, 'Search keys and values')\"\n class=\"mb-2 h-8\"\n />\n <p\n v-if=\"query.trim() !== '' && search.matches.size === 0\"\n class=\"text-muted-foreground text-sm\"\n >\n {{\n t('dev_tools.no_matches', { query: query.trim() }, 'Nothing matches “:query”.')\n }}\n </p>\n <ul\n v-else\n dir=\"ltr\"\n role=\"tree\"\n :aria-label=\"t('dev_tools.schema', {}, 'Schema')\"\n class=\"bg-muted/40 overflow-x-auto rounded-md p-2 text-start font-mono text-xs leading-relaxed\"\n >\n <DevToolsJsonNode\n v-for=\"entry in roots\"\n :key=\"entry.path\"\n :entry=\"entry\"\n :depth=\"0\"\n :search=\"search\"\n :query=\"query\"\n />\n </ul>\n </section>\n </div>\n </ScrollArea>\n </div>\n </SheetContent>\n </Sheet>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCA,IAAMsE,IAAIC,GAAK,GACTC,IAAYC,GAAa,GACzBC,KAAYC,EAAa,GACzBC,IAAQC,EAAgB,GACxBC,IAAQC,QAAeH,EAAM,MAAM,eAAe,GAClDI,IAAOD,QAAeE,EAAiBL,EAAM,KAA2C,CAAC,GACzFM,KAAUH,QAAeI,EAAWP,EAAM,KAAK,CAAC,GAChDQ,IAAQC,EAAI,EAAE,GACdC,IAASD,EAAI,EAAK,GAClBE,IAAaF,EAAmB,IAAI,GACpCG,IAAST,QAAeU,GAAWT,EA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","names":["_sfc_main","CheckboxListField_vue_vue_type_script_setup_true_lang_default","CheckboxListField_default"],"sources":["../../../src/components/fields/CheckboxListField.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { CheckboxListSchema } from '@alfakit/core'\nimport { fieldIds, gridColumnsClasses, htmlLabelToText, isOptionGroup } from '@alfakit/core'\nimport { computed, onBeforeUnmount, ref, watch } from 'vue'\nimport { useT } from '../../context'\nimport { textColorClasses } from '../../lib/colors'\nimport { Icon } from '../../lib/icons'\nimport { cn } from '../../lib/utils'\nimport { useField } from '../form/form-context'\nimport FieldWrapper from '../schema/FieldWrapper.vue'\nimport Button from '../ui/Button.vue'\nimport Checkbox from '../ui/Checkbox.vue'\nimport Input from '../ui/Input.vue'\nimport Label from '../ui/Label.vue'\n\nconst props = defineProps<{ component: CheckboxListSchema }>()\nconst t = useT()\nconst { value, setValue, error, id, disabled, readOnly, aria } = useField<Array<\n string | number\n> | null>(() => props.component)\nconst search = ref('')\n// `searchDebounce()`: the list is filtered by `query`, which trails the input.\nconst query = ref('')\nlet queryTimer: ReturnType<typeof setTimeout> | undefined\n\nwatch(search, (term) => {\n clearTimeout(queryTimer)\n\n if (!props.component.searchDebounce) {\n query.value = term\n\n return\n }\n\n queryTimer = setTimeout(() => (query.value = term), props.component.searchDebounce)\n})\nonBeforeUnmount(() => clearTimeout(queryTimer))\n\nconst selected = computed(() => (value.value ?? []).map(String))\nconst options = computed(() =>\n props.component.options.flatMap((option) => (isOptionGroup(option) ? option.options : [option])),\n)\nconst visible = computed(() =>\n options.value.filter((option) =>\n (props.component.allowHtml ? htmlLabelToText(option.label) : option.label)\n .toLowerCase()\n .includes(query.value.toLowerCase()),\n ),\n)\n\n/**\n * `gridDirection('column')`: options flow down each column (CSS columns). Classes are\n * spelled out so Tailwind generates them.\n */\nconst COLUMN_FLOW_CLASSES: Record<number, string> = {\n 2: 'md:columns-2',\n 3: 'md:columns-3',\n 4: 'md:columns-4',\n 5: 'md:columns-5',\n 6: 'md:columns-6',\n}\nconst columnFlow = computed(\n () => props.component.gridDirection === 'column' && (props.component.gridColumns ?? 1) > 1,\n)\n\nconst toggle = (key: string, checked: boolean) => {\n setValue(checked ? [...selected.value, key] : selected.value.filter((item) => item !== key))\n}\n</script>\n\n<template>\n <FieldWrapper :field=\"props.component\" :html-for=\"id\" :error=\"error\">\n <div class=\"flex flex-col gap-2\">\n <div\n v-if=\"props.component.searchable || (props.component.bulkToggleable && !readOnly)\"\n class=\"flex items-center gap-2\"\n >\n <Input\n v-if=\"props.component.searchable\"\n v-model=\"search\"\n :placeholder=\"props.component.searchPrompt ?? t('search', {}, 'Search')\"\n :aria-label=\"props.component.searchPrompt ?? t('search', {}, 'Search')\"\n class=\"h-8\"\n />\n <div v-if=\"props.component.bulkToggleable && !readOnly\" class=\"flex gap-1\">\n <Button\n v-if=\"!props.component.selectAllAction?.hidden\"\n type=\"button\"\n variant=\"link\"\n size=\"sm\"\n data-slot=\"select-all\"\n :disabled=\"disabled\"\n @click=\"\n setValue(options.filter((option) => !option.disabled).map((option) => option.value))\n \"\n >\n <Icon\n v-if=\"props.component.selectAllAction?.icon\"\n :name=\"props.component.selectAllAction.icon\"\n />\n {{ props.component.selectAllAction?.label ?? t('table.select_all', {}, 'Select all') }}\n </Button>\n <Button\n v-if=\"!props.component.deselectAllAction?.hidden\"\n type=\"button\"\n variant=\"link\"\n size=\"sm\"\n data-slot=\"deselect-all\"\n :disabled=\"disabled\"\n @click=\"setValue([])\"\n >\n <Icon\n v-if=\"props.component.deselectAllAction?.icon\"\n :name=\"props.component.deselectAllAction.icon\"\n />\n {{\n props.component.deselectAllAction?.label ??\n t('table.deselect_all', {}, 'Deselect all')\n }}\n </Button>\n </div>\n </div>\n <div\n :data-grid-direction=\"props.component.gridDirection\"\n :class=\"\n cn(\n props.component.inline\n ? 'flex flex-wrap gap-4'\n : columnFlow\n ? cn(\n 'gap-x-3 *:mb-3 *:break-inside-avoid',\n COLUMN_FLOW_CLASSES[props.component.gridColumns ?? 1],\n )\n : 'grid gap-3',\n !props.component.inline &&\n !columnFlow &&\n gridColumnsClasses(\n props.component.gridColumns\n ? { default: 1, md: props.component.gridColumns }\n : { default: 1 },\n ),\n )\n \"\n role=\"group\"\n :aria-labelledby=\"props.component.label ? fieldIds(id).label : undefined\"\n :aria-describedby=\"aria['aria-describedby']\"\n >\n <div v-for=\"option in visible\" :key=\"option.value\" class=\"flex items-start gap-2\">\n <Checkbox\n :id=\"`${id}-${option.value}`\"\n :model-value=\"selected.includes(option.value)\"\n :disabled=\"disabled || readOnly || option.disabled\"\n :aria-invalid=\"aria['aria-invalid']\"\n class=\"mt-0.5\"\n @update:model-value=\"toggle(option.value, $event === true)\"\n />\n <div class=\"grid gap-0.5\">\n <Label\n :for=\"`${id}-${option.value}`\"\n :class=\"cn('font-normal', option.color && textColorClasses[option.color])\"\n ><Icon v-if=\"option.icon\" :name=\"option.icon\" class=\"size-4\" /><span\n v-if=\"props.component.allowHtml\"\n v-html=\"option.label\"\n /><template v-else>{{ option.label }}</template></Label\n >\n <p v-if=\"option.description\" class=\"text-muted-foreground text-xs\">\n {{ option.description }}\n </p>\n </div>\n </div>\n </div>\n <p\n v-if=\"props.component.searchable && query !== '' && visible.length === 0\"\n data-slot=\"checkbox-list-empty\"\n role=\"status\"\n class=\"text-muted-foreground text-sm\"\n >\n {{ props.component.noSearchResultsMessage ?? t('no_results', {}, 'No results.') }}\n </p>\n </div>\n </FieldWrapper>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"CheckboxListField.js","names":["_sfc_main","CheckboxListField_vue_vue_type_script_setup_true_lang_default","CheckboxListField_default"],"sources":["../../../src/components/fields/CheckboxListField.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { CheckboxListSchema } from '@alfakit/core'\nimport { fieldIds, gridColumnsClasses, htmlLabelToText, isOptionGroup } from '@alfakit/core'\nimport { computed, onBeforeUnmount, ref, watch } from 'vue'\nimport { useT } from '../../context'\nimport { textColorClasses } from '../../lib/colors'\nimport { Icon } from '../../lib/icons'\nimport { cn } from '../../lib/utils'\nimport { useField } from '../form/form-context'\nimport FieldWrapper from '../schema/FieldWrapper.vue'\nimport Button from '../ui/Button.vue'\nimport Checkbox from '../ui/Checkbox.vue'\nimport Input from '../ui/Input.vue'\nimport Label from '../ui/Label.vue'\n\nconst props = defineProps<{ component: CheckboxListSchema }>()\nconst t = useT()\nconst { value, setValue, error, id, disabled, readOnly, aria } = useField<Array<\n string | number\n> | null>(() => props.component)\nconst search = ref('')\n// `searchDebounce()`: the list is filtered by `query`, which trails the input.\nconst query = ref('')\nlet queryTimer: ReturnType<typeof setTimeout> | undefined\n\nwatch(search, (term) => {\n clearTimeout(queryTimer)\n\n if (!props.component.searchDebounce) {\n query.value = term\n\n return\n }\n\n queryTimer = setTimeout(() => (query.value = term), props.component.searchDebounce)\n})\nonBeforeUnmount(() => clearTimeout(queryTimer))\n\nconst selected = computed(() => (value.value ?? []).map(String))\nconst options = computed(() =>\n props.component.options.flatMap((option) => (isOptionGroup(option) ? option.options : [option])),\n)\nconst visible = computed(() =>\n options.value.filter((option) =>\n (props.component.allowHtml ? htmlLabelToText(option.label) : option.label)\n .toLowerCase()\n .includes(query.value.toLowerCase()),\n ),\n)\n\n/**\n * `gridDirection('column')`: options flow down each column (CSS columns). Classes are\n * spelled out so Tailwind generates them.\n */\nconst COLUMN_FLOW_CLASSES: Record<number, string> = {\n 2: 'md:columns-2',\n 3: 'md:columns-3',\n 4: 'md:columns-4',\n 5: 'md:columns-5',\n 6: 'md:columns-6',\n}\nconst columnFlow = computed(\n () => props.component.gridDirection === 'column' && (props.component.gridColumns ?? 1) > 1,\n)\n\nconst toggle = (key: string, checked: boolean) => {\n setValue(checked ? [...selected.value, key] : selected.value.filter((item) => item !== key))\n}\n</script>\n\n<template>\n <FieldWrapper :field=\"props.component\" :html-for=\"id\" :error=\"error\">\n <div class=\"flex flex-col gap-2\">\n <div\n v-if=\"props.component.searchable || (props.component.bulkToggleable && !readOnly)\"\n class=\"flex min-w-0 flex-wrap items-center gap-2\"\n >\n <Input\n v-if=\"props.component.searchable\"\n v-model=\"search\"\n :placeholder=\"props.component.searchPrompt ?? t('search', {}, 'Search')\"\n :aria-label=\"props.component.searchPrompt ?? t('search', {}, 'Search')\"\n class=\"h-8\"\n />\n <div v-if=\"props.component.bulkToggleable && !readOnly\" class=\"flex flex-wrap gap-1\">\n <Button\n v-if=\"!props.component.selectAllAction?.hidden\"\n type=\"button\"\n variant=\"link\"\n size=\"sm\"\n data-slot=\"select-all\"\n :disabled=\"disabled\"\n @click=\"\n setValue(options.filter((option) => !option.disabled).map((option) => option.value))\n \"\n >\n <Icon\n v-if=\"props.component.selectAllAction?.icon\"\n :name=\"props.component.selectAllAction.icon\"\n />\n {{ props.component.selectAllAction?.label ?? t('table.select_all', {}, 'Select all') }}\n </Button>\n <Button\n v-if=\"!props.component.deselectAllAction?.hidden\"\n type=\"button\"\n variant=\"link\"\n size=\"sm\"\n data-slot=\"deselect-all\"\n :disabled=\"disabled\"\n @click=\"setValue([])\"\n >\n <Icon\n v-if=\"props.component.deselectAllAction?.icon\"\n :name=\"props.component.deselectAllAction.icon\"\n />\n {{\n props.component.deselectAllAction?.label ??\n t('table.deselect_all', {}, 'Deselect all')\n }}\n </Button>\n </div>\n </div>\n <div\n :data-grid-direction=\"props.component.gridDirection\"\n :class=\"\n cn(\n props.component.inline\n ? 'flex flex-wrap gap-4'\n : columnFlow\n ? cn(\n 'gap-x-3 *:mb-3 *:break-inside-avoid',\n COLUMN_FLOW_CLASSES[props.component.gridColumns ?? 1],\n )\n : 'grid gap-3',\n !props.component.inline &&\n !columnFlow &&\n gridColumnsClasses(\n props.component.gridColumns\n ? { default: 1, md: props.component.gridColumns }\n : { default: 1 },\n ),\n )\n \"\n role=\"group\"\n :aria-labelledby=\"props.component.label ? fieldIds(id).label : undefined\"\n :aria-describedby=\"aria['aria-describedby']\"\n >\n <div v-for=\"option in visible\" :key=\"option.value\" class=\"flex items-start gap-2\">\n <Checkbox\n :id=\"`${id}-${option.value}`\"\n :model-value=\"selected.includes(option.value)\"\n :disabled=\"disabled || readOnly || option.disabled\"\n :aria-invalid=\"aria['aria-invalid']\"\n class=\"mt-0.5\"\n @update:model-value=\"toggle(option.value, $event === true)\"\n />\n <div class=\"grid gap-0.5\">\n <Label\n :for=\"`${id}-${option.value}`\"\n :class=\"cn('font-normal', option.color && textColorClasses[option.color])\"\n ><Icon v-if=\"option.icon\" :name=\"option.icon\" class=\"size-4\" /><span\n v-if=\"props.component.allowHtml\"\n v-html=\"option.label\"\n /><template v-else>{{ option.label }}</template></Label\n >\n <p v-if=\"option.description\" class=\"text-muted-foreground text-xs\">\n {{ option.description }}\n </p>\n </div>\n </div>\n </div>\n <p\n v-if=\"props.component.searchable && query !== '' && visible.length === 0\"\n data-slot=\"checkbox-list-empty\"\n role=\"status\"\n class=\"text-muted-foreground text-sm\"\n >\n {{ props.component.noSearchResultsMessage ?? t('no_results', {}, 'No results.') }}\n </p>\n </div>\n </FieldWrapper>\n</template>\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxListField.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fields/CheckboxListField.vue"],"names":[],"mappings":"AAwLA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAcvD,KAAK,WAAW,GAAG;IAAE,SAAS,EAAE,kBAAkB,CAAA;CAAE,CAAC;;AAmXrD,wBAMG"}
1
+ {"version":3,"file":"CheckboxListField.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fields/CheckboxListField.vue"],"names":[],"mappings":"AAwLA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAcvD,KAAK,WAAW,GAAG;IAAE,SAAS,EAAE,kBAAkB,CAAA;CAAE,CAAC;;AAsXrD,wBAMG"}
@@ -13,10 +13,10 @@ import { Fragment as m, computed as h, createBlock as g, createCommentVNode as _
13
13
  //#region src/components/fields/CheckboxListField.vue?vue&type=script&setup=true&lang.ts
14
14
  var M = { class: "flex flex-col gap-2" }, N = {
15
15
  key: 0,
16
- class: "flex items-center gap-2"
16
+ class: "flex min-w-0 flex-wrap items-center gap-2"
17
17
  }, ee = {
18
18
  key: 1,
19
- class: "flex gap-1"
19
+ class: "flex flex-wrap gap-1"
20
20
  }, te = [
21
21
  "data-grid-direction",
22
22
  "aria-labelledby",
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxListField.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","FieldWrapper","_unref","_withCtx","_createElementVNode","_createElementBlock","Input","_createCommentVNode","Button","Icon","_createTextVNode","_toDisplayString","_normalizeClass","_Fragment","_renderList","_createVNode","Checkbox","Label","Icon_default","Button_default","Checkbox_default","Input_default","Label_default","FieldWrapper_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","CheckboxListField_vue_vue_type_script_setup_true_lang_default","props","__props","t","useT","useField","search","ref","query","queryTimer","watch","term","onBeforeUnmount","selected","computed","value","options","isOptionGroup","option","visible","htmlLabelToText","COLUMN_FLOW_CLASSES","columnFlow","toggle","checked","key","item","openBlock","createBlock","unref","id","error","withCtx","createElementVNode","readOnly","createElementBlock","_cache","$event","createCommentVNode","disabled","setValue","createTextVNode","toDisplayString","normalizeClass","cn","gridColumnsClasses","fieldIds","aria","Fragment","renderList","createVNode","textColorClasses"],"sources":["../../../src/components/fields/CheckboxListField.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { CheckboxListSchema } from '@alfakit/core'\nimport { fieldIds, gridColumnsClasses, htmlLabelToText, isOptionGroup } from '@alfakit/core'\nimport { computed, onBeforeUnmount, ref, watch } from 'vue'\nimport { useT } from '../../context'\nimport { textColorClasses } from '../../lib/colors'\nimport { Icon } from '../../lib/icons'\nimport { cn } from '../../lib/utils'\nimport { useField } from '../form/form-context'\nimport FieldWrapper from '../schema/FieldWrapper.vue'\nimport Button from '../ui/Button.vue'\nimport Checkbox from '../ui/Checkbox.vue'\nimport Input from '../ui/Input.vue'\nimport Label from '../ui/Label.vue'\n\nconst props = defineProps<{ component: CheckboxListSchema }>()\nconst t = useT()\nconst { value, setValue, error, id, disabled, readOnly, aria } = useField<Array<\n string | number\n> | null>(() => props.component)\nconst search = ref('')\n// `searchDebounce()`: the list is filtered by `query`, which trails the input.\nconst query = ref('')\nlet queryTimer: ReturnType<typeof setTimeout> | undefined\n\nwatch(search, (term) => {\n clearTimeout(queryTimer)\n\n if (!props.component.searchDebounce) {\n query.value = term\n\n return\n }\n\n queryTimer = setTimeout(() => (query.value = term), props.component.searchDebounce)\n})\nonBeforeUnmount(() => clearTimeout(queryTimer))\n\nconst selected = computed(() => (value.value ?? []).map(String))\nconst options = computed(() =>\n props.component.options.flatMap((option) => (isOptionGroup(option) ? option.options : [option])),\n)\nconst visible = computed(() =>\n options.value.filter((option) =>\n (props.component.allowHtml ? htmlLabelToText(option.label) : option.label)\n .toLowerCase()\n .includes(query.value.toLowerCase()),\n ),\n)\n\n/**\n * `gridDirection('column')`: options flow down each column (CSS columns). Classes are\n * spelled out so Tailwind generates them.\n */\nconst COLUMN_FLOW_CLASSES: Record<number, string> = {\n 2: 'md:columns-2',\n 3: 'md:columns-3',\n 4: 'md:columns-4',\n 5: 'md:columns-5',\n 6: 'md:columns-6',\n}\nconst columnFlow = computed(\n () => props.component.gridDirection === 'column' && (props.component.gridColumns ?? 1) > 1,\n)\n\nconst toggle = (key: string, checked: boolean) => {\n setValue(checked ? [...selected.value, key] : selected.value.filter((item) => item !== key))\n}\n</script>\n\n<template>\n <FieldWrapper :field=\"props.component\" :html-for=\"id\" :error=\"error\">\n <div class=\"flex flex-col gap-2\">\n <div\n v-if=\"props.component.searchable || (props.component.bulkToggleable && !readOnly)\"\n class=\"flex items-center gap-2\"\n >\n <Input\n v-if=\"props.component.searchable\"\n v-model=\"search\"\n :placeholder=\"props.component.searchPrompt ?? t('search', {}, 'Search')\"\n :aria-label=\"props.component.searchPrompt ?? t('search', {}, 'Search')\"\n class=\"h-8\"\n />\n <div v-if=\"props.component.bulkToggleable && !readOnly\" class=\"flex gap-1\">\n <Button\n v-if=\"!props.component.selectAllAction?.hidden\"\n type=\"button\"\n variant=\"link\"\n size=\"sm\"\n data-slot=\"select-all\"\n :disabled=\"disabled\"\n @click=\"\n setValue(options.filter((option) => !option.disabled).map((option) => option.value))\n \"\n >\n <Icon\n v-if=\"props.component.selectAllAction?.icon\"\n :name=\"props.component.selectAllAction.icon\"\n />\n {{ props.component.selectAllAction?.label ?? t('table.select_all', {}, 'Select all') }}\n </Button>\n <Button\n v-if=\"!props.component.deselectAllAction?.hidden\"\n type=\"button\"\n variant=\"link\"\n size=\"sm\"\n data-slot=\"deselect-all\"\n :disabled=\"disabled\"\n @click=\"setValue([])\"\n >\n <Icon\n v-if=\"props.component.deselectAllAction?.icon\"\n :name=\"props.component.deselectAllAction.icon\"\n />\n {{\n props.component.deselectAllAction?.label ??\n t('table.deselect_all', {}, 'Deselect all')\n }}\n </Button>\n </div>\n </div>\n <div\n :data-grid-direction=\"props.component.gridDirection\"\n :class=\"\n cn(\n props.component.inline\n ? 'flex flex-wrap gap-4'\n : columnFlow\n ? cn(\n 'gap-x-3 *:mb-3 *:break-inside-avoid',\n COLUMN_FLOW_CLASSES[props.component.gridColumns ?? 1],\n )\n : 'grid gap-3',\n !props.component.inline &&\n !columnFlow &&\n gridColumnsClasses(\n props.component.gridColumns\n ? { default: 1, md: props.component.gridColumns }\n : { default: 1 },\n ),\n )\n \"\n role=\"group\"\n :aria-labelledby=\"props.component.label ? fieldIds(id).label : undefined\"\n :aria-describedby=\"aria['aria-describedby']\"\n >\n <div v-for=\"option in visible\" :key=\"option.value\" class=\"flex items-start gap-2\">\n <Checkbox\n :id=\"`${id}-${option.value}`\"\n :model-value=\"selected.includes(option.value)\"\n :disabled=\"disabled || readOnly || option.disabled\"\n :aria-invalid=\"aria['aria-invalid']\"\n class=\"mt-0.5\"\n @update:model-value=\"toggle(option.value, $event === true)\"\n />\n <div class=\"grid gap-0.5\">\n <Label\n :for=\"`${id}-${option.value}`\"\n :class=\"cn('font-normal', option.color && textColorClasses[option.color])\"\n ><Icon v-if=\"option.icon\" :name=\"option.icon\" class=\"size-4\" /><span\n v-if=\"props.component.allowHtml\"\n v-html=\"option.label\"\n /><template v-else>{{ option.label }}</template></Label\n >\n <p v-if=\"option.description\" class=\"text-muted-foreground text-xs\">\n {{ option.description }}\n </p>\n </div>\n </div>\n </div>\n <p\n v-if=\"props.component.searchable && query !== '' && visible.length === 0\"\n data-slot=\"checkbox-list-empty\"\n role=\"status\"\n class=\"text-muted-foreground text-sm\"\n >\n {{ props.component.noSearchResultsMessage ?? t('no_results', {}, 'No results.') }}\n </p>\n </div>\n </FieldWrapper>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAeA,IAAMkC,IAAQC,GACRC,IAAIC,EAAK,GACT,EAAE,UAAO,aAAU,UAAO,OAAI,aAAU,aAAU,YAASC,QAEjDJ,EAAM,SAAS,GACzBK,IAASC,EAAI,EAAE,GAEfC,IAAQD,EAAI,EAAE,GAChBE;EAaJ,AAXAC,EAAMJ,IAAS,MAAS;GAGtB,IAFA,aAAaG,CAAU,GAEnB,CAACR,EAAM,UAAU,gBAAgB;IACnC,EAAM,QAAQU;IAEd;GACF;GAEA,IAAa,iBAAkB,EAAM,QAAQA,GAAOV,EAAM,UAAU,cAAc;EACpF,CAAC,GACDW,QAAsB,aAAaH,CAAU,CAAC;EAE9C,IAAMI,IAAWC,SAAgBC,EAAM,SAAS,CAAC,EAAA,CAAG,IAAI,MAAM,CAAC,GACzDC,IAAUF,QACdb,EAAM,UAAU,QAAQ,SAAS,MAAYgB,EAAcC,CAAM,IAAIA,EAAO,UAAU,CAACA,CAAM,CAAE,CACjG,GACMC,IAAUL,QACdE,EAAQ,MAAM,QAAQ,OACnBf,EAAM,UAAU,YAAYmB,EAAgBF,EAAO,KAAK,IAAIA,EAAO,MAAA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ACtE,SAAA/C,QAA8D,CAAlD+C,EAAO,QAAnBnD,EAAA,GAAAC,EAA8DE,EAAAO,CAAA,GAAA;;MAApC,MAAMyC,EAAO;MAAM,OAAM;KAC5C,GAAA,MAAA,GAAA,CAAA,MAAA,CAAA,KAAAoB,EAAA,IAAA,EAAA,GAAArC,EAAM,UAAU,aADuClC,EAAA,GAAAM,EAG7D,QAAA;;MADA,WAAQ6C,EAAO;KACfnD,GAAAA,MAAAA,GAAAA,CAAAA,MAAAA,EAAA,GAAAM,EAA8CQ,GAAA,EAAA,KAAA,EAAA,GAAA,CAA1BH,EAAAC,EAAAuC,EAAO,KAAK,GAAA,CAAA,CAAA,GAAA,EAAA,EAAA,CAAA;;IAE3B,GAAA,MAAA,CAAA,OAAA,OAAA,CAAA,GAAAA,EAAO,eAAhBnD,EAAA,GAAAM,EAEI,KAFJyB,GAEInB,EADCuC,EAAO,WAAW,GAAA,CAAA,KAAAoB,EAAA,IAAA,EAAA,CAAA,CAAA,CAAA,CAAA;IAMrBrC,EAAM,UAAU,cAAcO,EAAA,UAAK,MAAWW,EAAA,MAAQ,WAAM,KADpEpD,EAAA,GAAAM,EAOI,KAPJ0B,GAOIpB,EADCsB,EAAM,UAAU,0BAA0B/B,EAAAiC,CAAA,CAAC,CAAA,cAAA,CAAA,GAAA,aAAA,CAAA,GAAA,CAAA,KAAAmC,EAAA,IAAA,EAAA"}
1
+ {"version":3,"file":"CheckboxListField.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","FieldWrapper","_unref","_withCtx","_createElementVNode","_createElementBlock","Input","_createCommentVNode","Button","Icon","_createTextVNode","_toDisplayString","_normalizeClass","_Fragment","_renderList","_createVNode","Checkbox","Label","Icon_default","Button_default","Checkbox_default","Input_default","Label_default","FieldWrapper_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","CheckboxListField_vue_vue_type_script_setup_true_lang_default","props","__props","t","useT","useField","search","ref","query","queryTimer","watch","term","onBeforeUnmount","selected","computed","value","options","isOptionGroup","option","visible","htmlLabelToText","COLUMN_FLOW_CLASSES","columnFlow","toggle","checked","key","item","openBlock","createBlock","unref","id","error","withCtx","createElementVNode","readOnly","createElementBlock","_cache","$event","createCommentVNode","disabled","setValue","createTextVNode","toDisplayString","normalizeClass","cn","gridColumnsClasses","fieldIds","aria","Fragment","renderList","createVNode","textColorClasses"],"sources":["../../../src/components/fields/CheckboxListField.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { CheckboxListSchema } from '@alfakit/core'\nimport { fieldIds, gridColumnsClasses, htmlLabelToText, isOptionGroup } from '@alfakit/core'\nimport { computed, onBeforeUnmount, ref, watch } from 'vue'\nimport { useT } from '../../context'\nimport { textColorClasses } from '../../lib/colors'\nimport { Icon } from '../../lib/icons'\nimport { cn } from '../../lib/utils'\nimport { useField } from '../form/form-context'\nimport FieldWrapper from '../schema/FieldWrapper.vue'\nimport Button from '../ui/Button.vue'\nimport Checkbox from '../ui/Checkbox.vue'\nimport Input from '../ui/Input.vue'\nimport Label from '../ui/Label.vue'\n\nconst props = defineProps<{ component: CheckboxListSchema }>()\nconst t = useT()\nconst { value, setValue, error, id, disabled, readOnly, aria } = useField<Array<\n string | number\n> | null>(() => props.component)\nconst search = ref('')\n// `searchDebounce()`: the list is filtered by `query`, which trails the input.\nconst query = ref('')\nlet queryTimer: ReturnType<typeof setTimeout> | undefined\n\nwatch(search, (term) => {\n clearTimeout(queryTimer)\n\n if (!props.component.searchDebounce) {\n query.value = term\n\n return\n }\n\n queryTimer = setTimeout(() => (query.value = term), props.component.searchDebounce)\n})\nonBeforeUnmount(() => clearTimeout(queryTimer))\n\nconst selected = computed(() => (value.value ?? []).map(String))\nconst options = computed(() =>\n props.component.options.flatMap((option) => (isOptionGroup(option) ? option.options : [option])),\n)\nconst visible = computed(() =>\n options.value.filter((option) =>\n (props.component.allowHtml ? htmlLabelToText(option.label) : option.label)\n .toLowerCase()\n .includes(query.value.toLowerCase()),\n ),\n)\n\n/**\n * `gridDirection('column')`: options flow down each column (CSS columns). Classes are\n * spelled out so Tailwind generates them.\n */\nconst COLUMN_FLOW_CLASSES: Record<number, string> = {\n 2: 'md:columns-2',\n 3: 'md:columns-3',\n 4: 'md:columns-4',\n 5: 'md:columns-5',\n 6: 'md:columns-6',\n}\nconst columnFlow = computed(\n () => props.component.gridDirection === 'column' && (props.component.gridColumns ?? 1) > 1,\n)\n\nconst toggle = (key: string, checked: boolean) => {\n setValue(checked ? [...selected.value, key] : selected.value.filter((item) => item !== key))\n}\n</script>\n\n<template>\n <FieldWrapper :field=\"props.component\" :html-for=\"id\" :error=\"error\">\n <div class=\"flex flex-col gap-2\">\n <div\n v-if=\"props.component.searchable || (props.component.bulkToggleable && !readOnly)\"\n class=\"flex min-w-0 flex-wrap items-center gap-2\"\n >\n <Input\n v-if=\"props.component.searchable\"\n v-model=\"search\"\n :placeholder=\"props.component.searchPrompt ?? t('search', {}, 'Search')\"\n :aria-label=\"props.component.searchPrompt ?? t('search', {}, 'Search')\"\n class=\"h-8\"\n />\n <div v-if=\"props.component.bulkToggleable && !readOnly\" class=\"flex flex-wrap gap-1\">\n <Button\n v-if=\"!props.component.selectAllAction?.hidden\"\n type=\"button\"\n variant=\"link\"\n size=\"sm\"\n data-slot=\"select-all\"\n :disabled=\"disabled\"\n @click=\"\n setValue(options.filter((option) => !option.disabled).map((option) => option.value))\n \"\n >\n <Icon\n v-if=\"props.component.selectAllAction?.icon\"\n :name=\"props.component.selectAllAction.icon\"\n />\n {{ props.component.selectAllAction?.label ?? t('table.select_all', {}, 'Select all') }}\n </Button>\n <Button\n v-if=\"!props.component.deselectAllAction?.hidden\"\n type=\"button\"\n variant=\"link\"\n size=\"sm\"\n data-slot=\"deselect-all\"\n :disabled=\"disabled\"\n @click=\"setValue([])\"\n >\n <Icon\n v-if=\"props.component.deselectAllAction?.icon\"\n :name=\"props.component.deselectAllAction.icon\"\n />\n {{\n props.component.deselectAllAction?.label ??\n t('table.deselect_all', {}, 'Deselect all')\n }}\n </Button>\n </div>\n </div>\n <div\n :data-grid-direction=\"props.component.gridDirection\"\n :class=\"\n cn(\n props.component.inline\n ? 'flex flex-wrap gap-4'\n : columnFlow\n ? cn(\n 'gap-x-3 *:mb-3 *:break-inside-avoid',\n COLUMN_FLOW_CLASSES[props.component.gridColumns ?? 1],\n )\n : 'grid gap-3',\n !props.component.inline &&\n !columnFlow &&\n gridColumnsClasses(\n props.component.gridColumns\n ? { default: 1, md: props.component.gridColumns }\n : { default: 1 },\n ),\n )\n \"\n role=\"group\"\n :aria-labelledby=\"props.component.label ? fieldIds(id).label : undefined\"\n :aria-describedby=\"aria['aria-describedby']\"\n >\n <div v-for=\"option in visible\" :key=\"option.value\" class=\"flex items-start gap-2\">\n <Checkbox\n :id=\"`${id}-${option.value}`\"\n :model-value=\"selected.includes(option.value)\"\n :disabled=\"disabled || readOnly || option.disabled\"\n :aria-invalid=\"aria['aria-invalid']\"\n class=\"mt-0.5\"\n @update:model-value=\"toggle(option.value, $event === true)\"\n />\n <div class=\"grid gap-0.5\">\n <Label\n :for=\"`${id}-${option.value}`\"\n :class=\"cn('font-normal', option.color && textColorClasses[option.color])\"\n ><Icon v-if=\"option.icon\" :name=\"option.icon\" class=\"size-4\" /><span\n v-if=\"props.component.allowHtml\"\n v-html=\"option.label\"\n /><template v-else>{{ option.label }}</template></Label\n >\n <p v-if=\"option.description\" class=\"text-muted-foreground text-xs\">\n {{ option.description }}\n </p>\n </div>\n </div>\n </div>\n <p\n v-if=\"props.component.searchable && query !== '' && visible.length === 0\"\n data-slot=\"checkbox-list-empty\"\n role=\"status\"\n class=\"text-muted-foreground text-sm\"\n >\n {{ props.component.noSearchResultsMessage ?? t('no_results', {}, 'No results.') }}\n </p>\n </div>\n </FieldWrapper>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAeA,IAAMkC,IAAQC,GACRC,IAAIC,EAAK,GACT,EAAE,UAA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AA,EAAA,CAAA,CAAA,CAAA,CAAA;IAMrBrC,EAAM,UAAU,cAAcO,EAAA,UAAK,MAAWW,EAAA,MAAQ,WAAM,KADpEpD,EAAA,GAAAM,EAOI,KAPJ0B,GAOIpB,EADCsB,EAAM,UAAU,0BAA0B/B,EAAAiC,CAAA,CAAC,CAAA,cAAA,CAAA,GAAA,aAAA,CAAA,GAAA,CAAA,KAAAmC,EAAA,IAAA,EAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"DatePickerField.js","names":["_sfc_main","DatePickerField_vue_vue_type_script_setup_true_lang_default","DatePickerField_default"],"sources":["../../../src/components/fields/DatePickerField.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent, h } from 'vue'\nimport { lazyComponent } from '../../lib/lazy'\n\n// The month grid (reka-ui) loads the first time a picker opens (or is hovered or focused),\n// not with the form.\nconst loadCalendar = () => import('../ui/Calendar.vue').then((module) => module.default)\nconst Calendar = lazyComponent(\n 'AlfakitCalendar',\n loadCalendar,\n defineComponent({\n name: 'AlfakitCalendarLoading',\n inheritAttrs: false,\n render: () => h('div', { 'aria-busy': 'true', class: 'h-[18.5rem] w-[15.5rem]' }),\n }),\n)\n</script>\n\n<script setup lang=\"ts\">\nimport {\n formatPhpDate,\n LocaleFormatter,\n timeInputStep,\n wallClockNow,\n type DatePickerSchema,\n} from '@alfakit/core'\nimport { CalendarDate, type DateValue } from '@internationalized/date'\nimport { CalendarIcon } from '@lucide/vue'\nimport { format as formatDate, isValid, parse } from 'date-fns'\nimport { computed, ref } from 'vue'\nimport { useDirection, useFormatter, useLocalization, useT } from '../../context'\nimport { cn } from '../../lib/utils'\nimport { useField } from '../form/form-context'\nimport FieldWrapper from '../schema/FieldWrapper.vue'\nimport Button from '../ui/Button.vue'\nimport Input from '../ui/Input.vue'\nimport Popover from '../ui/Popover.vue'\nimport PopoverContent from '../ui/PopoverContent.vue'\nimport PopoverTrigger from '../ui/PopoverTrigger.vue'\nimport { phpToDateFnsFormat } from './date-format'\nimport SelectAffixes from './SelectAffixes.vue'\n\nconst props = defineProps<{ component: DatePickerSchema }>()\nconst { value, setValue, blur, error, id, disabled, readOnly, aria } = useField<string | null>(\n () => props.component,\n)\nconst open = ref(false)\n\nconst storageFormat = computed(() => phpToDateFnsFormat(props.component.format))\nconst t = useT()\nconst direction = useDirection()\nconst panelFormat = useFormatter()\nconst localization = useLocalization()\n// `locale()` overrides the panel's language for this picker only.\nconst locale = computed(() => props.component.locale ?? localization.value?.tag ?? 'en')\nconst format = computed(() =>\n props.component.locale\n ? new LocaleFormatter(\n props.component.locale,\n panelFormat.value.currencyCode,\n panelFormat.value.timeZone,\n )\n : panelFormat.value,\n)\nconst listId = computed(() => (props.component.datalist ? `${id}-list` : undefined))\n\n// Month and weekday names come from Intl, so they follow the user's language.\nconst display = (date: Date): string =>\n props.component.displayFormat\n ? formatPhpDate(date, props.component.displayFormat, locale.value)\n : format.value.date(date, {\n ...(props.component.hasDate ? { dateStyle: 'medium' as const } : {}),\n ...(props.component.hasTime ? { timeStyle: 'short' as const } : {}),\n timeZone: undefined,\n })\n\nconst nativeType = computed(() =>\n !props.component.hasDate ? 'time' : props.component.hasTime ? 'datetime-local' : 'date',\n)\nconst nativeFormat = computed(() =>\n nativeType.value === 'time'\n ? props.component.hasSeconds\n ? 'HH:mm:ss'\n : 'HH:mm'\n : nativeType.value === 'datetime-local'\n ? props.component.hasSeconds\n ? \"yyyy-MM-dd'T'HH:mm:ss\"\n : \"yyyy-MM-dd'T'HH:mm\"\n : 'yyyy-MM-dd',\n)\n\nconst parsed = computed(() =>\n value.value ? parse(value.value, storageFormat.value, new Date()) : null,\n)\nconst selectedDate = computed(() =>\n parsed.value && isValid(parsed.value) ? parsed.value : undefined,\n)\nconst nativeValue = computed(() =>\n selectedDate.value ? formatDate(selectedDate.value, nativeFormat.value) : (value.value ?? ''),\n)\n\nfunction toNative(raw: string): string | undefined {\n const date = parse(raw, storageFormat.value, new Date())\n\n return isValid(date) ? formatDate(date, nativeFormat.value) : undefined\n}\n\nfunction parseStored(raw: string): Date {\n return parse(raw, storageFormat.value, new Date())\n}\n\nconst onNativeInput = (raw: string) => {\n if (raw === '') {\n setValue(null)\n\n return\n }\n\n const date = parse(raw, nativeFormat.value, new Date())\n setValue(isValid(date) ? formatDate(date, storageFormat.value) : raw)\n}\n\n// Calendar (reka-ui) works with @internationalized/date values.\nconst toCalendarDate = (date: Date): CalendarDate =>\n new CalendarDate(date.getFullYear(), date.getMonth() + 1, date.getDate())\nconst calendarValue = computed(() =>\n selectedDate.value ? toCalendarDate(selectedDate.value) : undefined,\n)\nconst minValue = computed(() =>\n props.component.minDate ? toCalendarDate(parseStored(props.component.minDate)) : undefined,\n)\nconst maxValue = computed(() =>\n props.component.maxDate ? toCalendarDate(parseStored(props.component.maxDate)) : undefined,\n)\nconst disabledDates = computed(() =>\n (props.component.disabledDates ?? []).map((date) => toCalendarDate(parseStored(date)).toString()),\n)\nconst isDateDisabled = (date: DateValue) => disabledDates.value.includes(date.toString())\n// `defaultFocusedDate()`: the month the calendar opens on while the field is empty.\nconst focusedPlaceholder = computed(() => {\n if (!props.component.defaultFocusedDate) return undefined\n\n const date = parseStored(props.component.defaultFocusedDate)\n\n return isValid(date) ? toCalendarDate(date) : undefined\n})\nconst step = computed(() => timeInputStep(props.component))\n\nconst onSelect = (next: DateValue | undefined) => {\n if (!next) {\n setValue(null)\n\n return\n }\n\n const base = selectedDate.value\n const withTime = new Date(\n next.year,\n next.month - 1,\n next.day,\n base?.getHours() ?? 0,\n base?.getMinutes() ?? 0,\n base?.getSeconds() ?? 0,\n )\n setValue(formatDate(withTime, storageFormat.value))\n\n if (props.component.closeOnDateSelection && !props.component.hasTime) {\n open.value = false\n blur()\n }\n}\n\nconst timeValue = computed(() =>\n selectedDate.value\n ? formatDate(selectedDate.value, props.component.hasSeconds ? 'HH:mm:ss' : 'HH:mm')\n : '',\n)\n\nconst onTimeInput = (raw: string) => {\n const base = selectedDate.value ?? wallClockNow(props.component.timezone)\n const [hours = '0', minutes = '0', seconds = '0'] = raw.split(':')\n const next = new Date(\n base.getFullYear(),\n base.getMonth(),\n base.getDate(),\n Number(hours),\n Number(minutes),\n Number(seconds),\n )\n setValue(formatDate(next, storageFormat.value))\n}\n\n// Kept out of the template: a `|` union there is parsed as a (removed) Vue 2 filter.\nconst weekStartsOn = computed(\n () => (props.component.firstDayOfWeek ?? 1) as 0 | 1 | 2 | 3 | 4 | 5 | 6,\n)\n</script>\n\n<template>\n <FieldWrapper :field=\"props.component\" :html-for=\"id\" :error=\"error\">\n <SelectAffixes :component=\"props.component\" :error=\"error\">\n <Input\n v-if=\"props.component.native || !props.component.hasDate\"\n :id=\"id\"\n :type=\"nativeType\"\n :name=\"props.component.name\"\n :model-value=\"nativeValue\"\n :step=\"step\"\n :min=\"props.component.minDate ? toNative(props.component.minDate) : undefined\"\n :max=\"props.component.maxDate ? toNative(props.component.maxDate) : undefined\"\n :disabled=\"disabled\"\n :readonly=\"readOnly\"\n :required=\"props.component.required\"\n :lang=\"props.component.locale\"\n :list=\"listId\"\n :aria-invalid=\"aria['aria-invalid']\"\n :aria-describedby=\"aria['aria-describedby']\"\n :aria-required=\"aria['aria-required']\"\n v-bind=\"props.component.extraInputAttributes\"\n @update:model-value=\"onNativeInput\"\n @blur=\"blur\"\n />\n <Popover v-else :open=\"open\" @update:open=\"open = $event && !readOnly\">\n <PopoverTrigger as-child>\n <Button\n :id=\"id\"\n type=\"button\"\n data-input=\"\"\n variant=\"outline\"\n :disabled=\"disabled\"\n @pointerenter=\"loadCalendar\"\n @focus=\"loadCalendar\"\n :aria-invalid=\"aria['aria-invalid']\"\n :aria-describedby=\"aria['aria-describedby']\"\n :class=\"\n cn(\n 'w-full justify-start font-normal',\n !selectedDate && 'text-muted-foreground',\n error && 'border-destructive',\n )\n \"\n >\n <CalendarIcon class=\"size-4\" />\n {{\n selectedDate\n ? display(selectedDate)\n : (props.component.placeholder ?? t('form.pick_date', {}, 'Pick a date'))\n }}\n </Button>\n </PopoverTrigger>\n <PopoverContent class=\"w-auto p-0\" align=\"start\">\n <Calendar\n :model-value=\"calendarValue\"\n :locale=\"locale\"\n :dir=\"direction\"\n :today=\"toCalendarDate(wallClockNow(props.component.timezone))\"\n :week-starts-on=\"weekStartsOn\"\n :min-value=\"minValue\"\n :max-value=\"maxValue\"\n :default-placeholder=\"focusedPlaceholder\"\n :is-date-disabled=\"isDateDisabled\"\n initial-focus\n @update:model-value=\"onSelect($event as DateValue | undefined)\"\n />\n <div v-if=\"props.component.hasTime\" class=\"border-t p-3\">\n <Input\n type=\"time\"\n :step=\"step\"\n :model-value=\"timeValue\"\n @update:model-value=\"onTimeInput\"\n @blur=\"blur\"\n />\n </div>\n </PopoverContent>\n </Popover>\n <datalist\n v-if=\"(props.component.native || !props.component.hasDate) && props.component.datalist\"\n :id=\"listId\"\n >\n <option\n v-for=\"option in props.component.datalist\"\n :key=\"option\"\n :value=\"toNative(option) ?? option\"\n />\n </datalist>\n </SelectAffixes>\n </FieldWrapper>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"DatePickerField.js","names":["_sfc_main","DatePickerField_vue_vue_type_script_setup_true_lang_default","DatePickerField_default"],"sources":["../../../src/components/fields/DatePickerField.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent, h } from 'vue'\nimport { lazyComponent } from '../../lib/lazy'\n\n// The month grid (reka-ui) loads the first time a picker opens (or is hovered or focused),\n// not with the form.\nconst loadCalendar = () => import('../ui/Calendar.vue').then((module) => module.default)\nconst Calendar = lazyComponent(\n 'AlfakitCalendar',\n loadCalendar,\n defineComponent({\n name: 'AlfakitCalendarLoading',\n inheritAttrs: false,\n render: () => h('div', { 'aria-busy': 'true', class: 'h-[18.5rem] w-[15.5rem]' }),\n }),\n)\n</script>\n\n<script setup lang=\"ts\">\nimport {\n formatPhpDate,\n LocaleFormatter,\n timeInputStep,\n wallClockNow,\n type DatePickerSchema,\n} from '@alfakit/core'\nimport { CalendarDate, type DateValue } from '@internationalized/date'\nimport { CalendarIcon } from '@lucide/vue'\nimport { format as formatDate, isValid, parse } from 'date-fns'\nimport { computed, ref } from 'vue'\nimport { useDirection, useFormatter, useLocalization, useT } from '../../context'\nimport { cn } from '../../lib/utils'\nimport { useField } from '../form/form-context'\nimport FieldWrapper from '../schema/FieldWrapper.vue'\nimport Button from '../ui/Button.vue'\nimport Input from '../ui/Input.vue'\nimport Popover from '../ui/Popover.vue'\nimport PopoverContent from '../ui/PopoverContent.vue'\nimport PopoverTrigger from '../ui/PopoverTrigger.vue'\nimport { phpToDateFnsFormat } from './date-format'\nimport SelectAffixes from './SelectAffixes.vue'\n\nconst props = defineProps<{ component: DatePickerSchema }>()\nconst { value, setValue, blur, error, id, disabled, readOnly, aria } = useField<string | null>(\n () => props.component,\n)\nconst open = ref(false)\n\nconst storageFormat = computed(() => phpToDateFnsFormat(props.component.format))\nconst t = useT()\nconst direction = useDirection()\nconst panelFormat = useFormatter()\nconst localization = useLocalization()\n// `locale()` overrides the panel's language for this picker only.\nconst locale = computed(() => props.component.locale ?? localization.value?.tag ?? 'en')\nconst format = computed(() =>\n props.component.locale\n ? new LocaleFormatter(\n props.component.locale,\n panelFormat.value.currencyCode,\n panelFormat.value.timeZone,\n )\n : panelFormat.value,\n)\nconst listId = computed(() => (props.component.datalist ? `${id}-list` : undefined))\n\n// Month and weekday names come from Intl, so they follow the user's language.\nconst display = (date: Date): string =>\n props.component.displayFormat\n ? formatPhpDate(date, props.component.displayFormat, locale.value)\n : format.value.date(date, {\n ...(props.component.hasDate ? { dateStyle: 'medium' as const } : {}),\n ...(props.component.hasTime ? { timeStyle: 'short' as const } : {}),\n timeZone: undefined,\n })\n\nconst nativeType = computed(() =>\n !props.component.hasDate ? 'time' : props.component.hasTime ? 'datetime-local' : 'date',\n)\nconst nativeFormat = computed(() =>\n nativeType.value === 'time'\n ? props.component.hasSeconds\n ? 'HH:mm:ss'\n : 'HH:mm'\n : nativeType.value === 'datetime-local'\n ? props.component.hasSeconds\n ? \"yyyy-MM-dd'T'HH:mm:ss\"\n : \"yyyy-MM-dd'T'HH:mm\"\n : 'yyyy-MM-dd',\n)\n\nconst parsed = computed(() =>\n value.value ? parse(value.value, storageFormat.value, new Date()) : null,\n)\nconst selectedDate = computed(() =>\n parsed.value && isValid(parsed.value) ? parsed.value : undefined,\n)\nconst nativeValue = computed(() =>\n selectedDate.value ? formatDate(selectedDate.value, nativeFormat.value) : (value.value ?? ''),\n)\n\nfunction toNative(raw: string): string | undefined {\n const date = parse(raw, storageFormat.value, new Date())\n\n return isValid(date) ? formatDate(date, nativeFormat.value) : undefined\n}\n\nfunction parseStored(raw: string): Date {\n return parse(raw, storageFormat.value, new Date())\n}\n\nconst onNativeInput = (raw: string) => {\n if (raw === '') {\n setValue(null)\n\n return\n }\n\n const date = parse(raw, nativeFormat.value, new Date())\n setValue(isValid(date) ? formatDate(date, storageFormat.value) : raw)\n}\n\n// Calendar (reka-ui) works with @internationalized/date values.\nconst toCalendarDate = (date: Date): CalendarDate =>\n new CalendarDate(date.getFullYear(), date.getMonth() + 1, date.getDate())\nconst calendarValue = computed(() =>\n selectedDate.value ? toCalendarDate(selectedDate.value) : undefined,\n)\nconst minValue = computed(() =>\n props.component.minDate ? toCalendarDate(parseStored(props.component.minDate)) : undefined,\n)\nconst maxValue = computed(() =>\n props.component.maxDate ? toCalendarDate(parseStored(props.component.maxDate)) : undefined,\n)\nconst disabledDates = computed(() =>\n (props.component.disabledDates ?? []).map((date) => toCalendarDate(parseStored(date)).toString()),\n)\nconst isDateDisabled = (date: DateValue) => disabledDates.value.includes(date.toString())\n// `defaultFocusedDate()`: the month the calendar opens on while the field is empty.\nconst focusedPlaceholder = computed(() => {\n if (!props.component.defaultFocusedDate) return undefined\n\n const date = parseStored(props.component.defaultFocusedDate)\n\n return isValid(date) ? toCalendarDate(date) : undefined\n})\nconst step = computed(() => timeInputStep(props.component))\n\nconst onSelect = (next: DateValue | undefined) => {\n if (!next) {\n setValue(null)\n\n return\n }\n\n const base = selectedDate.value\n const withTime = new Date(\n next.year,\n next.month - 1,\n next.day,\n base?.getHours() ?? 0,\n base?.getMinutes() ?? 0,\n base?.getSeconds() ?? 0,\n )\n setValue(formatDate(withTime, storageFormat.value))\n\n if (props.component.closeOnDateSelection && !props.component.hasTime) {\n open.value = false\n blur()\n }\n}\n\nconst timeValue = computed(() =>\n selectedDate.value\n ? formatDate(selectedDate.value, props.component.hasSeconds ? 'HH:mm:ss' : 'HH:mm')\n : '',\n)\n\nconst onTimeInput = (raw: string) => {\n const base = selectedDate.value ?? wallClockNow(props.component.timezone)\n const [hours = '0', minutes = '0', seconds = '0'] = raw.split(':')\n const next = new Date(\n base.getFullYear(),\n base.getMonth(),\n base.getDate(),\n Number(hours),\n Number(minutes),\n Number(seconds),\n )\n setValue(formatDate(next, storageFormat.value))\n}\n\n// Kept out of the template: a `|` union there is parsed as a (removed) Vue 2 filter.\nconst weekStartsOn = computed(\n () => (props.component.firstDayOfWeek ?? 1) as 0 | 1 | 2 | 3 | 4 | 5 | 6,\n)\n</script>\n\n<template>\n <FieldWrapper :field=\"props.component\" :html-for=\"id\" :error=\"error\">\n <SelectAffixes :component=\"props.component\" :error=\"error\">\n <Input\n v-if=\"props.component.native || !props.component.hasDate\"\n :id=\"id\"\n :type=\"nativeType\"\n :name=\"props.component.name\"\n :model-value=\"nativeValue\"\n :step=\"step\"\n :min=\"props.component.minDate ? toNative(props.component.minDate) : undefined\"\n :max=\"props.component.maxDate ? toNative(props.component.maxDate) : undefined\"\n :disabled=\"disabled\"\n :readonly=\"readOnly\"\n :required=\"props.component.required\"\n :lang=\"props.component.locale\"\n :list=\"listId\"\n :aria-invalid=\"aria['aria-invalid']\"\n :aria-describedby=\"aria['aria-describedby']\"\n :aria-required=\"aria['aria-required']\"\n v-bind=\"props.component.extraInputAttributes\"\n @update:model-value=\"onNativeInput\"\n @blur=\"blur\"\n />\n <Popover v-else :open=\"open\" @update:open=\"open = $event && !readOnly\">\n <PopoverTrigger as-child>\n <Button\n :id=\"id\"\n type=\"button\"\n data-input=\"\"\n variant=\"outline\"\n :disabled=\"disabled\"\n @pointerenter=\"loadCalendar\"\n @focus=\"loadCalendar\"\n :aria-invalid=\"aria['aria-invalid']\"\n :aria-describedby=\"aria['aria-describedby']\"\n :class=\"\n cn(\n 'w-full justify-start font-normal',\n !selectedDate && 'text-muted-foreground',\n error && 'border-destructive',\n )\n \"\n >\n <CalendarIcon class=\"size-4\" />\n {{\n selectedDate\n ? display(selectedDate)\n : (props.component.placeholder ?? t('form.pick_date', {}, 'Pick a date'))\n }}\n </Button>\n </PopoverTrigger>\n <PopoverContent class=\"w-auto p-0\" align=\"start\">\n <Calendar\n :model-value=\"calendarValue\"\n :calendar-label=\"props.component.label || t('form.pick_date', {}, 'Pick a date')\"\n :locale=\"locale\"\n :dir=\"direction\"\n :today=\"toCalendarDate(wallClockNow(props.component.timezone))\"\n :week-starts-on=\"weekStartsOn\"\n :min-value=\"minValue\"\n :max-value=\"maxValue\"\n :default-placeholder=\"focusedPlaceholder\"\n :is-date-disabled=\"isDateDisabled\"\n initial-focus\n @update:model-value=\"onSelect($event as DateValue | undefined)\"\n />\n <div v-if=\"props.component.hasTime\" class=\"border-t p-3\">\n <Input\n type=\"time\"\n :step=\"step\"\n :model-value=\"timeValue\"\n @update:model-value=\"onTimeInput\"\n @blur=\"blur\"\n />\n </div>\n </PopoverContent>\n </Popover>\n <datalist\n v-if=\"(props.component.native || !props.component.hasDate) && props.component.datalist\"\n :id=\"listId\"\n >\n <option\n v-for=\"option in props.component.datalist\"\n :key=\"option\"\n :value=\"toNative(option) ?? option\"\n />\n </datalist>\n </SelectAffixes>\n </FieldWrapper>\n</template>\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"DatePickerField.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fields/DatePickerField.vue"],"names":[],"mappings":"AAkSA,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,eAAe,CAAA;;eAmCU,gBAAgB;;eAAhB,gBAAgB;;AADhD,wBAkfK"}
1
+ {"version":3,"file":"DatePickerField.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fields/DatePickerField.vue"],"names":[],"mappings":"AAmSA,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,eAAe,CAAA;;eAmCU,gBAAgB;;eAAhB,gBAAgB;;AADhD,wBAofK"}
@@ -19,80 +19,80 @@ import { format as O, isValid as k, parse as A } from "date-fns";
19
19
  var ue = {
20
20
  key: 0,
21
21
  class: "border-t p-3"
22
- }, de = ["id"], fe = ["value"], j = () => import("../ui/Calendar.js").then((e) => e.default), M = c("AlfakitCalendar", j, x({
22
+ }, de = ["id"], fe = ["value"], j = () => import("../ui/Calendar.js").then((e) => e.default), pe = c("AlfakitCalendar", j, x({
23
23
  name: "AlfakitCalendarLoading",
24
24
  inheritAttrs: !1,
25
25
  render: () => S("div", {
26
26
  "aria-busy": "true",
27
27
  class: "h-[18.5rem] w-[15.5rem]"
28
28
  })
29
- })), N = /*@__PURE__*/ x({
29
+ })), M = /*@__PURE__*/ x({
30
30
  __name: "DatePickerField",
31
31
  props: { component: {} },
32
32
  setup(c) {
33
- let x = c, { value: S, setValue: N, blur: P, error: F, id: I, disabled: L, readOnly: R, aria: z } = o(() => x.component), B = se(!1), V = g(() => u(x.component.format)), pe = r(), H = e(), U = t(), me = n(), W = g(() => x.component.locale ?? me.value?.tag ?? "en"), he = g(() => x.component.locale ? new f(x.component.locale, U.value.currencyCode, U.value.timeZone) : U.value), G = g(() => x.component.datalist ? `${I}-list` : void 0), ge = (e) => x.component.displayFormat ? re(e, x.component.displayFormat, W.value) : he.value.date(e, {
33
+ let x = c, { value: S, setValue: M, blur: N, error: P, id: F, disabled: I, readOnly: L, aria: R } = o(() => x.component), z = se(!1), B = g(() => u(x.component.format)), V = r(), H = e(), U = t(), me = n(), W = g(() => x.component.locale ?? me.value?.tag ?? "en"), he = g(() => x.component.locale ? new f(x.component.locale, U.value.currencyCode, U.value.timeZone) : U.value), G = g(() => x.component.datalist ? `${F}-list` : void 0), ge = (e) => x.component.displayFormat ? re(e, x.component.displayFormat, W.value) : he.value.date(e, {
34
34
  ...x.component.hasDate ? { dateStyle: "medium" } : {},
35
35
  ...x.component.hasTime ? { timeStyle: "short" } : {},
36
36
  timeZone: void 0
37
- }), K = g(() => x.component.hasDate ? x.component.hasTime ? "datetime-local" : "date" : "time"), q = g(() => K.value === "time" ? x.component.hasSeconds ? "HH:mm:ss" : "HH:mm" : K.value === "datetime-local" ? x.component.hasSeconds ? "yyyy-MM-dd'T'HH:mm:ss" : "yyyy-MM-dd'T'HH:mm" : "yyyy-MM-dd"), J = g(() => S.value ? A(S.value, V.value, /* @__PURE__ */ new Date()) : null), Y = g(() => J.value && k(J.value) ? J.value : void 0), _e = g(() => Y.value ? O(Y.value, q.value) : S.value ?? "");
37
+ }), K = g(() => x.component.hasDate ? x.component.hasTime ? "datetime-local" : "date" : "time"), q = g(() => K.value === "time" ? x.component.hasSeconds ? "HH:mm:ss" : "HH:mm" : K.value === "datetime-local" ? x.component.hasSeconds ? "yyyy-MM-dd'T'HH:mm:ss" : "yyyy-MM-dd'T'HH:mm" : "yyyy-MM-dd"), J = g(() => S.value ? A(S.value, B.value, /* @__PURE__ */ new Date()) : null), Y = g(() => J.value && k(J.value) ? J.value : void 0), _e = g(() => Y.value ? O(Y.value, q.value) : S.value ?? "");
38
38
  function X(e) {
39
- let t = A(e, V.value, /* @__PURE__ */ new Date());
39
+ let t = A(e, B.value, /* @__PURE__ */ new Date());
40
40
  return k(t) ? O(t, q.value) : void 0;
41
41
  }
42
42
  function Z(e) {
43
- return A(e, V.value, /* @__PURE__ */ new Date());
43
+ return A(e, B.value, /* @__PURE__ */ new Date());
44
44
  }
45
45
  let ve = (e) => {
46
46
  if (e === "") {
47
- N(null);
47
+ M(null);
48
48
  return;
49
49
  }
50
50
  let t = A(e, q.value, /* @__PURE__ */ new Date());
51
- N(k(t) ? O(t, V.value) : e);
51
+ M(k(t) ? O(t, B.value) : e);
52
52
  }, Q = (e) => new D(e.getFullYear(), e.getMonth() + 1, e.getDate()), ye = g(() => Y.value ? Q(Y.value) : void 0), be = g(() => x.component.minDate ? Q(Z(x.component.minDate)) : void 0), xe = g(() => x.component.maxDate ? Q(Z(x.component.maxDate)) : void 0), Se = g(() => (x.component.disabledDates ?? []).map((e) => Q(Z(e)).toString())), Ce = (e) => Se.value.includes(e.toString()), we = g(() => {
53
53
  if (!x.component.defaultFocusedDate) return;
54
54
  let e = Z(x.component.defaultFocusedDate);
55
55
  return k(e) ? Q(e) : void 0;
56
56
  }), $ = g(() => p(x.component)), Te = (e) => {
57
57
  if (!e) {
58
- N(null);
58
+ M(null);
59
59
  return;
60
60
  }
61
61
  let t = Y.value, n = new Date(e.year, e.month - 1, e.day, t?.getHours() ?? 0, t?.getMinutes() ?? 0, t?.getSeconds() ?? 0);
62
- N(O(n, V.value)), x.component.closeOnDateSelection && !x.component.hasTime && (B.value = !1, P());
62
+ M(O(n, B.value)), x.component.closeOnDateSelection && !x.component.hasTime && (z.value = !1, N());
63
63
  }, Ee = g(() => Y.value ? O(Y.value, x.component.hasSeconds ? "HH:mm:ss" : "HH:mm") : ""), De = (e) => {
64
64
  let t = Y.value ?? m(x.component.timezone), [n = "0", r = "0", i = "0"] = e.split(":"), a = new Date(t.getFullYear(), t.getMonth(), t.getDate(), Number(n), Number(r), Number(i));
65
- N(O(a, V.value));
65
+ M(O(a, B.value));
66
66
  }, Oe = g(() => x.component.firstDayOfWeek ?? 1);
67
67
  return (e, t) => (C(), _(l, {
68
68
  field: x.component,
69
- "html-for": w(I),
70
- error: w(F)
69
+ "html-for": w(F),
70
+ error: w(P)
71
71
  }, {
72
72
  default: T(() => [b(d, {
73
73
  component: x.component,
74
- error: w(F)
74
+ error: w(P)
75
75
  }, {
76
76
  default: T(() => [x.component.native || !x.component.hasDate ? (C(), _(s, ae({
77
77
  key: 0,
78
- id: w(I),
78
+ id: w(F),
79
79
  type: K.value,
80
80
  name: x.component.name,
81
81
  "model-value": _e.value,
82
82
  step: $.value,
83
83
  min: x.component.minDate ? X(x.component.minDate) : void 0,
84
84
  max: x.component.maxDate ? X(x.component.maxDate) : void 0,
85
- disabled: w(L),
86
- readonly: w(R),
85
+ disabled: w(I),
86
+ readonly: w(L),
87
87
  required: x.component.required,
88
88
  lang: x.component.locale,
89
89
  list: G.value,
90
- "aria-invalid": w(z)["aria-invalid"],
91
- "aria-describedby": w(z)["aria-describedby"],
92
- "aria-required": w(z)["aria-required"]
90
+ "aria-invalid": w(R)["aria-invalid"],
91
+ "aria-describedby": w(R)["aria-describedby"],
92
+ "aria-required": w(R)["aria-required"]
93
93
  }, x.component.extraInputAttributes, {
94
94
  "onUpdate:modelValue": ve,
95
- onBlur: w(P)
95
+ onBlur: w(N)
96
96
  }), null, 16, [
97
97
  "id",
98
98
  "type",
@@ -112,23 +112,23 @@ var ue = {
112
112
  "onBlur"
113
113
  ])) : (C(), _(ee, {
114
114
  key: 1,
115
- open: B.value,
116
- "onUpdate:open": t[1] ||= (e) => B.value = e && !w(R)
115
+ open: z.value,
116
+ "onUpdate:open": t[1] ||= (e) => z.value = e && !w(L)
117
117
  }, {
118
118
  default: T(() => [b(ne, { "as-child": "" }, {
119
119
  default: T(() => [b(a, {
120
- id: w(I),
120
+ id: w(F),
121
121
  type: "button",
122
122
  "data-input": "",
123
123
  variant: "outline",
124
- disabled: w(L),
124
+ disabled: w(I),
125
125
  onPointerenter: j,
126
126
  onFocus: j,
127
- "aria-invalid": w(z)["aria-invalid"],
128
- "aria-describedby": w(z)["aria-describedby"],
129
- class: oe(w(i)("w-full justify-start font-normal", !Y.value && "text-muted-foreground", w(F) && "border-destructive"))
127
+ "aria-invalid": w(R)["aria-invalid"],
128
+ "aria-describedby": w(R)["aria-describedby"],
129
+ class: oe(w(i)("w-full justify-start font-normal", !Y.value && "text-muted-foreground", w(P) && "border-destructive"))
130
130
  }, {
131
- default: T(() => [b(w(E), { class: "size-4" }), ie(" " + le(Y.value ? ge(Y.value) : x.component.placeholder ?? w(pe)("form.pick_date", {}, "Pick a date")), 1)]),
131
+ default: T(() => [b(w(E), { class: "size-4" }), ie(" " + le(Y.value ? ge(Y.value) : x.component.placeholder ?? w(V)("form.pick_date", {}, "Pick a date")), 1)]),
132
132
  _: 1
133
133
  }, 8, [
134
134
  "id",
@@ -142,8 +142,9 @@ var ue = {
142
142
  class: "w-auto p-0",
143
143
  align: "start"
144
144
  }, {
145
- default: T(() => [b(w(M), {
145
+ default: T(() => [b(w(pe), {
146
146
  "model-value": ye.value,
147
+ "calendar-label": x.component.label || w(V)("form.pick_date", {}, "Pick a date"),
147
148
  locale: W.value,
148
149
  dir: w(H),
149
150
  today: Q(w(m)(x.component.timezone)),
@@ -156,6 +157,7 @@ var ue = {
156
157
  "onUpdate:modelValue": t[0] ||= (e) => Te(e)
157
158
  }, null, 8, [
158
159
  "model-value",
160
+ "calendar-label",
159
161
  "locale",
160
162
  "dir",
161
163
  "today",
@@ -168,7 +170,7 @@ var ue = {
168
170
  step: $.value,
169
171
  "model-value": Ee.value,
170
172
  "onUpdate:modelValue": De,
171
- onBlur: w(P)
173
+ onBlur: w(N)
172
174
  }, null, 8, [
173
175
  "step",
174
176
  "model-value",
@@ -195,6 +197,6 @@ var ue = {
195
197
  }
196
198
  });
197
199
  //#endregion
198
- export { N as default };
200
+ export { M as default };
199
201
 
200
202
  //# sourceMappingURL=DatePickerField.vue_vue_type_script_setup_true_lang.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DatePickerField.vue_vue_type_script_setup_true_lang.js","names":["format","formatDate","_openBlock","_createBlock","FieldWrapper","_unref","_withCtx","_createVNode","SelectAffixes","Input","_mergeProps","Popover","PopoverTrigger","Button","_normalizeClass","_createTextVNode","_toDisplayString","PopoverContent","_createElementBlock","_createCommentVNode","_Fragment","_renderList","Button_default","Input_default","Popover_default","PopoverContent_default","PopoverTrigger_default","FieldWrapper_default","SelectAffixes_default","_hoisted_1","_hoisted_2","_hoisted_3","loadCalendar","module","Calendar","lazyComponent","defineComponent","h","DatePickerField_vue_vue_type_script_setup_true_lang_default","props","__props","useField","open","ref","storageFormat","computed","phpToDateFnsFormat","t","useT","direction","useDirection","panelFormat","useFormatter","localization","useLocalization","locale","format$1","LocaleFormatter","listId","id","display","formatPhpDate","date","nativeType","nativeFormat","parsed","value","parse","selectedDate","isValid","nativeValue","format","toNative","raw","parseStored","onNativeInput","toCalendarDate","CalendarDate","calendarValue","minValue","maxValue","disabledDates","isDateDisabled","focusedPlaceholder","step","timeInputStep","onSelect","next","base","withTime","setValue","blur","timeValue","onTimeInput","wallClockNow","hours","minutes","seconds","weekStartsOn","openBlock","createBlock","unref","error","withCtx","createVNode","mergeProps","disabled","readOnly","aria","_cache","$event","normalizeClass","cn","CalendarIcon","createTextVNode","toDisplayString","createElementBlock","createCommentVNode","Fragment","renderList","option"],"sources":["../../../src/components/fields/DatePickerField.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent, h } from 'vue'\nimport { lazyComponent } from '../../lib/lazy'\n\n// The month grid (reka-ui) loads the first time a picker opens (or is hovered or focused),\n// not with the form.\nconst loadCalendar = () => import('../ui/Calendar.vue').then((module) => module.default)\nconst Calendar = lazyComponent(\n 'AlfakitCalendar',\n loadCalendar,\n defineComponent({\n name: 'AlfakitCalendarLoading',\n inheritAttrs: false,\n render: () => h('div', { 'aria-busy': 'true', class: 'h-[18.5rem] w-[15.5rem]' }),\n }),\n)\n</script>\n\n<script setup lang=\"ts\">\nimport {\n formatPhpDate,\n LocaleFormatter,\n timeInputStep,\n wallClockNow,\n type DatePickerSchema,\n} from '@alfakit/core'\nimport { CalendarDate, type DateValue } from '@internationalized/date'\nimport { CalendarIcon } from '@lucide/vue'\nimport { format as formatDate, isValid, parse } from 'date-fns'\nimport { computed, ref } from 'vue'\nimport { useDirection, useFormatter, useLocalization, useT } from '../../context'\nimport { cn } from '../../lib/utils'\nimport { useField } from '../form/form-context'\nimport FieldWrapper from '../schema/FieldWrapper.vue'\nimport Button from '../ui/Button.vue'\nimport Input from '../ui/Input.vue'\nimport Popover from '../ui/Popover.vue'\nimport PopoverContent from '../ui/PopoverContent.vue'\nimport PopoverTrigger from '../ui/PopoverTrigger.vue'\nimport { phpToDateFnsFormat } from './date-format'\nimport SelectAffixes from './SelectAffixes.vue'\n\nconst props = defineProps<{ component: DatePickerSchema }>()\nconst { value, setValue, blur, error, id, disabled, readOnly, aria } = useField<string | null>(\n () => props.component,\n)\nconst open = ref(false)\n\nconst storageFormat = computed(() => phpToDateFnsFormat(props.component.format))\nconst t = useT()\nconst direction = useDirection()\nconst panelFormat = useFormatter()\nconst localization = useLocalization()\n// `locale()` overrides the panel's language for this picker only.\nconst locale = computed(() => props.component.locale ?? localization.value?.tag ?? 'en')\nconst format = computed(() =>\n props.component.locale\n ? new LocaleFormatter(\n props.component.locale,\n panelFormat.value.currencyCode,\n panelFormat.value.timeZone,\n )\n : panelFormat.value,\n)\nconst listId = computed(() => (props.component.datalist ? `${id}-list` : undefined))\n\n// Month and weekday names come from Intl, so they follow the user's language.\nconst display = (date: Date): string =>\n props.component.displayFormat\n ? formatPhpDate(date, props.component.displayFormat, locale.value)\n : format.value.date(date, {\n ...(props.component.hasDate ? { dateStyle: 'medium' as const } : {}),\n ...(props.component.hasTime ? { timeStyle: 'short' as const } : {}),\n timeZone: undefined,\n })\n\nconst nativeType = computed(() =>\n !props.component.hasDate ? 'time' : props.component.hasTime ? 'datetime-local' : 'date',\n)\nconst nativeFormat = computed(() =>\n nativeType.value === 'time'\n ? props.component.hasSeconds\n ? 'HH:mm:ss'\n : 'HH:mm'\n : nativeType.value === 'datetime-local'\n ? props.component.hasSeconds\n ? \"yyyy-MM-dd'T'HH:mm:ss\"\n : \"yyyy-MM-dd'T'HH:mm\"\n : 'yyyy-MM-dd',\n)\n\nconst parsed = computed(() =>\n value.value ? parse(value.value, storageFormat.value, new Date()) : null,\n)\nconst selectedDate = computed(() =>\n parsed.value && isValid(parsed.value) ? parsed.value : undefined,\n)\nconst nativeValue = computed(() =>\n selectedDate.value ? formatDate(selectedDate.value, nativeFormat.value) : (value.value ?? ''),\n)\n\nfunction toNative(raw: string): string | undefined {\n const date = parse(raw, storageFormat.value, new Date())\n\n return isValid(date) ? formatDate(date, nativeFormat.value) : undefined\n}\n\nfunction parseStored(raw: string): Date {\n return parse(raw, storageFormat.value, new Date())\n}\n\nconst onNativeInput = (raw: string) => {\n if (raw === '') {\n setValue(null)\n\n return\n }\n\n const date = parse(raw, nativeFormat.value, new Date())\n setValue(isValid(date) ? formatDate(date, storageFormat.value) : raw)\n}\n\n// Calendar (reka-ui) works with @internationalized/date values.\nconst toCalendarDate = (date: Date): CalendarDate =>\n new CalendarDate(date.getFullYear(), date.getMonth() + 1, date.getDate())\nconst calendarValue = computed(() =>\n selectedDate.value ? toCalendarDate(selectedDate.value) : undefined,\n)\nconst minValue = computed(() =>\n props.component.minDate ? toCalendarDate(parseStored(props.component.minDate)) : undefined,\n)\nconst maxValue = computed(() =>\n props.component.maxDate ? toCalendarDate(parseStored(props.component.maxDate)) : undefined,\n)\nconst disabledDates = computed(() =>\n (props.component.disabledDates ?? []).map((date) => toCalendarDate(parseStored(date)).toString()),\n)\nconst isDateDisabled = (date: DateValue) => disabledDates.value.includes(date.toString())\n// `defaultFocusedDate()`: the month the calendar opens on while the field is empty.\nconst focusedPlaceholder = computed(() => {\n if (!props.component.defaultFocusedDate) return undefined\n\n const date = parseStored(props.component.defaultFocusedDate)\n\n return isValid(date) ? toCalendarDate(date) : undefined\n})\nconst step = computed(() => timeInputStep(props.component))\n\nconst onSelect = (next: DateValue | undefined) => {\n if (!next) {\n setValue(null)\n\n return\n }\n\n const base = selectedDate.value\n const withTime = new Date(\n next.year,\n next.month - 1,\n next.day,\n base?.getHours() ?? 0,\n base?.getMinutes() ?? 0,\n base?.getSeconds() ?? 0,\n )\n setValue(formatDate(withTime, storageFormat.value))\n\n if (props.component.closeOnDateSelection && !props.component.hasTime) {\n open.value = false\n blur()\n }\n}\n\nconst timeValue = computed(() =>\n selectedDate.value\n ? formatDate(selectedDate.value, props.component.hasSeconds ? 'HH:mm:ss' : 'HH:mm')\n : '',\n)\n\nconst onTimeInput = (raw: string) => {\n const base = selectedDate.value ?? wallClockNow(props.component.timezone)\n const [hours = '0', minutes = '0', seconds = '0'] = raw.split(':')\n const next = new Date(\n base.getFullYear(),\n base.getMonth(),\n base.getDate(),\n Number(hours),\n Number(minutes),\n Number(seconds),\n )\n setValue(formatDate(next, storageFormat.value))\n}\n\n// Kept out of the template: a `|` union there is parsed as a (removed) Vue 2 filter.\nconst weekStartsOn = computed(\n () => (props.component.firstDayOfWeek ?? 1) as 0 | 1 | 2 | 3 | 4 | 5 | 6,\n)\n</script>\n\n<template>\n <FieldWrapper :field=\"props.component\" :html-for=\"id\" :error=\"error\">\n <SelectAffixes :component=\"props.component\" :error=\"error\">\n <Input\n v-if=\"props.component.native || !props.component.hasDate\"\n :id=\"id\"\n :type=\"nativeType\"\n :name=\"props.component.name\"\n :model-value=\"nativeValue\"\n :step=\"step\"\n :min=\"props.component.minDate ? toNative(props.component.minDate) : undefined\"\n :max=\"props.component.maxDate ? toNative(props.component.maxDate) : undefined\"\n :disabled=\"disabled\"\n :readonly=\"readOnly\"\n :required=\"props.component.required\"\n :lang=\"props.component.locale\"\n :list=\"listId\"\n :aria-invalid=\"aria['aria-invalid']\"\n :aria-describedby=\"aria['aria-describedby']\"\n :aria-required=\"aria['aria-required']\"\n v-bind=\"props.component.extraInputAttributes\"\n @update:model-value=\"onNativeInput\"\n @blur=\"blur\"\n />\n <Popover v-else :open=\"open\" @update:open=\"open = $event && !readOnly\">\n <PopoverTrigger as-child>\n <Button\n :id=\"id\"\n type=\"button\"\n data-input=\"\"\n variant=\"outline\"\n :disabled=\"disabled\"\n @pointerenter=\"loadCalendar\"\n @focus=\"loadCalendar\"\n :aria-invalid=\"aria['aria-invalid']\"\n :aria-describedby=\"aria['aria-describedby']\"\n :class=\"\n cn(\n 'w-full justify-start font-normal',\n !selectedDate && 'text-muted-foreground',\n error && 'border-destructive',\n )\n \"\n >\n <CalendarIcon class=\"size-4\" />\n {{\n selectedDate\n ? display(selectedDate)\n : (props.component.placeholder ?? t('form.pick_date', {}, 'Pick a date'))\n }}\n </Button>\n </PopoverTrigger>\n <PopoverContent class=\"w-auto p-0\" align=\"start\">\n <Calendar\n :model-value=\"calendarValue\"\n :locale=\"locale\"\n :dir=\"direction\"\n :today=\"toCalendarDate(wallClockNow(props.component.timezone))\"\n :week-starts-on=\"weekStartsOn\"\n :min-value=\"minValue\"\n :max-value=\"maxValue\"\n :default-placeholder=\"focusedPlaceholder\"\n :is-date-disabled=\"isDateDisabled\"\n initial-focus\n @update:model-value=\"onSelect($event as DateValue | undefined)\"\n />\n <div v-if=\"props.component.hasTime\" class=\"border-t p-3\">\n <Input\n type=\"time\"\n :step=\"step\"\n :model-value=\"timeValue\"\n @update:model-value=\"onTimeInput\"\n @blur=\"blur\"\n />\n </div>\n </PopoverContent>\n </Popover>\n <datalist\n v-if=\"(props.component.native || !props.component.hasDate) && props.component.datalist\"\n :id=\"listId\"\n >\n <option\n v-for=\"option in props.component.datalist\"\n :key=\"option\"\n :value=\"toNative(option) ?? option\"\n />\n </datalist>\n </SelectAffixes>\n </FieldWrapper>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;gCAMMgC,UAAqB,OAAO,oBAAqB,CAAC,MAAM,MAAWC,EAAO,OAAO,GACjFC,IAAWC,EACf,mBACAH,GACAI,EAAgB;CACd,MAAM;CACN,cAAc;CACd,cAAcC,EAAE,OAAO;EAAE,aAAa;EAAQ,OAAO;CAA0B,CAAC;AAClF,CAAC,CACH;;;;EA2BA,IAAME,IAAQC,GACR,EAAE,UAAO,aAAU,SAAM,UAAO,OAAI,aAAU,aAAU,YAASC,QAC/DF,EAAM,SACd,GACMG,IAAOC,GAAI,EAAK,GAEhBC,IAAgBC,QAAeC,EAAmBP,EAAM,UAAU,MAAM,CAAC,GACzEQ,KAAIC,EAAK,GACTC,IAAYC,EAAa,GACzB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D,EAAA,QAA+BR,GAAQQ,EAAA,KAAY,IAAqB7B,EAAM,UAAU,eAAelC,EAAA0C,EAAA,CAAC,CAAA,kBAAA,CAAA,GAAA,aAAA,CAAA,GAAA,CAAA,CAAA,CAAA;;;;;;;;;;KAM9GxC,CAAAA,GAAAA,EAuBiBU,IAAA;MAvBD,OAAM;MAAa,OAAM;;MACvC,SAAAX,QAYE,CAZFC,EAYEF,EAAA6B,CAAA,GAAA;OAXC,eAAa4C,GAAA;OACb,QAAQvB,EAAA;OACR,KAAKlD,EAAA4C,CAAA;OACL,OAAO2B,EAAevE,EAAAyF,CAAA,CAAY,CAACvD,EAAM,UAAU,QAAQ,CAAA;OAC3D,kBAAgB2D,GAAA;OAChB,aAAWnB,GAAA;OACX,aAAWC,GAAA;OACX,uBAAqBG,GAAA;OACrB,oBAAkBD;OACnB,iBAAA;OACC,uBAAkB,AAAA2B,EAAA,QAAA,MAAEvB,GAASwB,CAAM;;;;;;;;;;MAE3B,CAAA,GAAAvE,EAAM,UAAU,WAA3BrC,EAAA,GAAAgB,EAQM,OARNW,IAQM,CAPJtB,EAMEE,GAAA;OALA,MAAK;OACJ,MAAM2E,EAAA;OACN,eAAaQ,GAAA;OACb,uBAAoBC;OACpB,QAAMxF,EAAAsF,CAAA;;;;;;;;;IAMN,GAAA,GAAA,CAAA,MAAA,CAAA,KAAApD,EAAM,UAAU,UAAM,CAAKA,EAAM,UAAU,YAAYA,EAAM,UAAU,YADhFrC,EAAA,GAAAgB,EASW,YAAA;;KAPR,IAAIwC,EAAA;IAELxD,GAAAA,EAAAA,EAAA,EAAA,GAAAgB,EAIEE,GAAA,MAAAC,GAHiBkB,EAAM,UAAU,WAA1B,OADTrC,EAAA,GAAAgB,EAIE,UAAA;KAFC,KAAKsG;KACL,OAAOhD,EAASgD,CAAM,KAAKA"}
1
+ {"version":3,"file":"DatePickerField.vue_vue_type_script_setup_true_lang.js","names":["format","formatDate","_openBlock","_createBlock","FieldWrapper","_unref","_withCtx","_createVNode","SelectAffixes","Input","_mergeProps","Popover","PopoverTrigger","Button","_normalizeClass","_createTextVNode","_toDisplayString","PopoverContent","_createElementBlock","_createCommentVNode","_Fragment","_renderList","Button_default","Input_default","Popover_default","PopoverContent_default","PopoverTrigger_default","FieldWrapper_default","SelectAffixes_default","_hoisted_1","_hoisted_2","_hoisted_3","loadCalendar","module","Calendar","lazyComponent","defineComponent","h","DatePickerField_vue_vue_type_script_setup_true_lang_default","props","__props","useField","open","ref","storageFormat","computed","phpToDateFnsFormat","t","useT","direction","useDirection","panelFormat","useFormatter","localization","useLocalization","locale","format$1","LocaleFormatter","listId","id","display","formatPhpDate","date","nativeType","nativeFormat","parsed","value","parse","selectedDate","isValid","nativeValue","format","toNative","raw","parseStored","onNativeInput","toCalendarDate","CalendarDate","calendarValue","minValue","maxValue","disabledDates","isDateDisabled","focusedPlaceholder","step","timeInputStep","onSelect","next","base","withTime","setValue","blur","timeValue","onTimeInput","wallClockNow","hours","minutes","seconds","weekStartsOn","openBlock","createBlock","unref","error","withCtx","createVNode","mergeProps","disabled","readOnly","aria","_cache","$event","normalizeClass","cn","CalendarIcon","createTextVNode","toDisplayString","createElementBlock","createCommentVNode","Fragment","renderList","option"],"sources":["../../../src/components/fields/DatePickerField.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent, h } from 'vue'\nimport { lazyComponent } from '../../lib/lazy'\n\n// The month grid (reka-ui) loads the first time a picker opens (or is hovered or focused),\n// not with the form.\nconst loadCalendar = () => import('../ui/Calendar.vue').then((module) => module.default)\nconst Calendar = lazyComponent(\n 'AlfakitCalendar',\n loadCalendar,\n defineComponent({\n name: 'AlfakitCalendarLoading',\n inheritAttrs: false,\n render: () => h('div', { 'aria-busy': 'true', class: 'h-[18.5rem] w-[15.5rem]' }),\n }),\n)\n</script>\n\n<script setup lang=\"ts\">\nimport {\n formatPhpDate,\n LocaleFormatter,\n timeInputStep,\n wallClockNow,\n type DatePickerSchema,\n} from '@alfakit/core'\nimport { CalendarDate, type DateValue } from '@internationalized/date'\nimport { CalendarIcon } from '@lucide/vue'\nimport { format as formatDate, isValid, parse } from 'date-fns'\nimport { computed, ref } from 'vue'\nimport { useDirection, useFormatter, useLocalization, useT } from '../../context'\nimport { cn } from '../../lib/utils'\nimport { useField } from '../form/form-context'\nimport FieldWrapper from '../schema/FieldWrapper.vue'\nimport Button from '../ui/Button.vue'\nimport Input from '../ui/Input.vue'\nimport Popover from '../ui/Popover.vue'\nimport PopoverContent from '../ui/PopoverContent.vue'\nimport PopoverTrigger from '../ui/PopoverTrigger.vue'\nimport { phpToDateFnsFormat } from './date-format'\nimport SelectAffixes from './SelectAffixes.vue'\n\nconst props = defineProps<{ component: DatePickerSchema }>()\nconst { value, setValue, blur, error, id, disabled, readOnly, aria } = useField<string | null>(\n () => props.component,\n)\nconst open = ref(false)\n\nconst storageFormat = computed(() => phpToDateFnsFormat(props.component.format))\nconst t = useT()\nconst direction = useDirection()\nconst panelFormat = useFormatter()\nconst localization = useLocalization()\n// `locale()` overrides the panel's language for this picker only.\nconst locale = computed(() => props.component.locale ?? localization.value?.tag ?? 'en')\nconst format = computed(() =>\n props.component.locale\n ? new LocaleFormatter(\n props.component.locale,\n panelFormat.value.currencyCode,\n panelFormat.value.timeZone,\n )\n : panelFormat.value,\n)\nconst listId = computed(() => (props.component.datalist ? `${id}-list` : undefined))\n\n// Month and weekday names come from Intl, so they follow the user's language.\nconst display = (date: Date): string =>\n props.component.displayFormat\n ? formatPhpDate(date, props.component.displayFormat, locale.value)\n : format.value.date(date, {\n ...(props.component.hasDate ? { dateStyle: 'medium' as const } : {}),\n ...(props.component.hasTime ? { timeStyle: 'short' as const } : {}),\n timeZone: undefined,\n })\n\nconst nativeType = computed(() =>\n !props.component.hasDate ? 'time' : props.component.hasTime ? 'datetime-local' : 'date',\n)\nconst nativeFormat = computed(() =>\n nativeType.value === 'time'\n ? props.component.hasSeconds\n ? 'HH:mm:ss'\n : 'HH:mm'\n : nativeType.value === 'datetime-local'\n ? props.component.hasSeconds\n ? \"yyyy-MM-dd'T'HH:mm:ss\"\n : \"yyyy-MM-dd'T'HH:mm\"\n : 'yyyy-MM-dd',\n)\n\nconst parsed = computed(() =>\n value.value ? parse(value.value, storageFormat.value, new Date()) : null,\n)\nconst selectedDate = computed(() =>\n parsed.value && isValid(parsed.value) ? parsed.value : undefined,\n)\nconst nativeValue = computed(() =>\n selectedDate.value ? formatDate(selectedDate.value, nativeFormat.value) : (value.value ?? ''),\n)\n\nfunction toNative(raw: string): string | undefined {\n const date = parse(raw, storageFormat.value, new Date())\n\n return isValid(date) ? formatDate(date, nativeFormat.value) : undefined\n}\n\nfunction parseStored(raw: string): Date {\n return parse(raw, storageFormat.value, new Date())\n}\n\nconst onNativeInput = (raw: string) => {\n if (raw === '') {\n setValue(null)\n\n return\n }\n\n const date = parse(raw, nativeFormat.value, new Date())\n setValue(isValid(date) ? formatDate(date, storageFormat.value) : raw)\n}\n\n// Calendar (reka-ui) works with @internationalized/date values.\nconst toCalendarDate = (date: Date): CalendarDate =>\n new CalendarDate(date.getFullYear(), date.getMonth() + 1, date.getDate())\nconst calendarValue = computed(() =>\n selectedDate.value ? toCalendarDate(selectedDate.value) : undefined,\n)\nconst minValue = computed(() =>\n props.component.minDate ? toCalendarDate(parseStored(props.component.minDate)) : undefined,\n)\nconst maxValue = computed(() =>\n props.component.maxDate ? toCalendarDate(parseStored(props.component.maxDate)) : undefined,\n)\nconst disabledDates = computed(() =>\n (props.component.disabledDates ?? []).map((date) => toCalendarDate(parseStored(date)).toString()),\n)\nconst isDateDisabled = (date: DateValue) => disabledDates.value.includes(date.toString())\n// `defaultFocusedDate()`: the month the calendar opens on while the field is empty.\nconst focusedPlaceholder = computed(() => {\n if (!props.component.defaultFocusedDate) return undefined\n\n const date = parseStored(props.component.defaultFocusedDate)\n\n return isValid(date) ? toCalendarDate(date) : undefined\n})\nconst step = computed(() => timeInputStep(props.component))\n\nconst onSelect = (next: DateValue | undefined) => {\n if (!next) {\n setValue(null)\n\n return\n }\n\n const base = selectedDate.value\n const withTime = new Date(\n next.year,\n next.month - 1,\n next.day,\n base?.getHours() ?? 0,\n base?.getMinutes() ?? 0,\n base?.getSeconds() ?? 0,\n )\n setValue(formatDate(withTime, storageFormat.value))\n\n if (props.component.closeOnDateSelection && !props.component.hasTime) {\n open.value = false\n blur()\n }\n}\n\nconst timeValue = computed(() =>\n selectedDate.value\n ? formatDate(selectedDate.value, props.component.hasSeconds ? 'HH:mm:ss' : 'HH:mm')\n : '',\n)\n\nconst onTimeInput = (raw: string) => {\n const base = selectedDate.value ?? wallClockNow(props.component.timezone)\n const [hours = '0', minutes = '0', seconds = '0'] = raw.split(':')\n const next = new Date(\n base.getFullYear(),\n base.getMonth(),\n base.getDate(),\n Number(hours),\n Number(minutes),\n Number(seconds),\n )\n setValue(formatDate(next, storageFormat.value))\n}\n\n// Kept out of the template: a `|` union there is parsed as a (removed) Vue 2 filter.\nconst weekStartsOn = computed(\n () => (props.component.firstDayOfWeek ?? 1) as 0 | 1 | 2 | 3 | 4 | 5 | 6,\n)\n</script>\n\n<template>\n <FieldWrapper :field=\"props.component\" :html-for=\"id\" :error=\"error\">\n <SelectAffixes :component=\"props.component\" :error=\"error\">\n <Input\n v-if=\"props.component.native || !props.component.hasDate\"\n :id=\"id\"\n :type=\"nativeType\"\n :name=\"props.component.name\"\n :model-value=\"nativeValue\"\n :step=\"step\"\n :min=\"props.component.minDate ? toNative(props.component.minDate) : undefined\"\n :max=\"props.component.maxDate ? toNative(props.component.maxDate) : undefined\"\n :disabled=\"disabled\"\n :readonly=\"readOnly\"\n :required=\"props.component.required\"\n :lang=\"props.component.locale\"\n :list=\"listId\"\n :aria-invalid=\"aria['aria-invalid']\"\n :aria-describedby=\"aria['aria-describedby']\"\n :aria-required=\"aria['aria-required']\"\n v-bind=\"props.component.extraInputAttributes\"\n @update:model-value=\"onNativeInput\"\n @blur=\"blur\"\n />\n <Popover v-else :open=\"open\" @update:open=\"open = $event && !readOnly\">\n <PopoverTrigger as-child>\n <Button\n :id=\"id\"\n type=\"button\"\n data-input=\"\"\n variant=\"outline\"\n :disabled=\"disabled\"\n @pointerenter=\"loadCalendar\"\n @focus=\"loadCalendar\"\n :aria-invalid=\"aria['aria-invalid']\"\n :aria-describedby=\"aria['aria-describedby']\"\n :class=\"\n cn(\n 'w-full justify-start font-normal',\n !selectedDate && 'text-muted-foreground',\n error && 'border-destructive',\n )\n \"\n >\n <CalendarIcon class=\"size-4\" />\n {{\n selectedDate\n ? display(selectedDate)\n : (props.component.placeholder ?? t('form.pick_date', {}, 'Pick a date'))\n }}\n </Button>\n </PopoverTrigger>\n <PopoverContent class=\"w-auto p-0\" align=\"start\">\n <Calendar\n :model-value=\"calendarValue\"\n :calendar-label=\"props.component.label || t('form.pick_date', {}, 'Pick a date')\"\n :locale=\"locale\"\n :dir=\"direction\"\n :today=\"toCalendarDate(wallClockNow(props.component.timezone))\"\n :week-starts-on=\"weekStartsOn\"\n :min-value=\"minValue\"\n :max-value=\"maxValue\"\n :default-placeholder=\"focusedPlaceholder\"\n :is-date-disabled=\"isDateDisabled\"\n initial-focus\n @update:model-value=\"onSelect($event as DateValue | undefined)\"\n />\n <div v-if=\"props.component.hasTime\" class=\"border-t p-3\">\n <Input\n type=\"time\"\n :step=\"step\"\n :model-value=\"timeValue\"\n @update:model-value=\"onTimeInput\"\n @blur=\"blur\"\n />\n </div>\n </PopoverContent>\n </Popover>\n <datalist\n v-if=\"(props.component.native || !props.component.hasDate) && props.component.datalist\"\n :id=\"listId\"\n >\n <option\n v-for=\"option in props.component.datalist\"\n :key=\"option\"\n :value=\"toNative(option) ?? option\"\n />\n </datalist>\n </SelectAffixes>\n </FieldWrapper>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;gCAMMgC,UAAqB,OAAO,oBAAqB,CAAC,MAAM,MAAWC,EAAO,OAAO,GACjFC,KAAWC,EACf,mBACAH,GACAI,EAAgB;CACd,MAAM;CACN,cAAc;CACd,cAAcC,EAAE,OAAO;EA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AM,CAAKA,EAAM,UAAU,YAAYA,EAAM,UAAU,YADhFrC,EAAA,GAAAgB,EASW,YAAA;;KAPR,IAAIwC,EAAA;IAELxD,GAAAA,EAAAA,EAAA,EAAA,GAAAgB,EAIEE,GAAA,MAAAC,GAHiBkB,EAAM,UAAU,WAA1B,OADTrC,EAAA,GAAAgB,EAIE,UAAA;KAFC,KAAKsG;KACL,OAAOhD,EAASgD,CAAM,KAAKA"}
@@ -1 +1 @@
1
- {"version":3,"file":"RichEditorSuggestions.js","names":["_sfc_main","RichEditorSuggestions_vue_vue_type_script_setup_true_lang_default","RichEditorSuggestions_default"],"sources":["../../../src/components/fields/RichEditorSuggestions.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { EditorSuggestions } from '@alfakit/core'\nimport type { Editor } from '@tiptap/vue-3'\nimport { useT } from '../../context'\nimport { cn } from '../../lib/utils'\nimport { useStore } from '../../composables/use-store'\n\n/** The mention / merge tag listbox under the trigger. */\nconst props = defineProps<{\n suggestions: EditorSuggestions\n editor: Editor | undefined\n id: string\n}>()\nconst t = useT()\nconst state = useStore(props.suggestions.store)\n</script>\n\n<template>\n <div\n v-if=\"state.open && props.editor\"\n :id=\"props.id\"\n role=\"listbox\"\n :aria-label=\"t('editor.suggestions', {}, 'Suggestions')\"\n data-slot=\"rich-editor-suggestions\"\n class=\"bg-popover text-popover-foreground fixed z-50 min-w-48 overflow-hidden rounded-md border p-1 shadow-md\"\n :style=\"\n state.coords\n ? { left: `${state.coords.left}px`, top: `${state.coords.bottom + 4}px` }\n : undefined\n \"\n >\n <div\n v-if=\"state.loading && state.items.length === 0\"\n class=\"text-muted-foreground px-2 py-1.5 text-sm\"\n >\n {{ t('loading', {}, 'Loading…') }}\n </div>\n <div v-else-if=\"state.items.length === 0\" class=\"text-muted-foreground px-2 py-1.5 text-sm\">\n {{ t('no_results', {}, 'No results.') }}\n </div>\n <template v-else>\n <div\n v-for=\"(item, index) in state.items\"\n :id=\"`${props.id}-${index}`\"\n :key=\"item.id\"\n role=\"option\"\n :aria-selected=\"index === state.index\"\n :class=\"\n cn(\n 'cursor-pointer rounded-sm px-2 py-1.5 text-sm',\n index === state.index && 'bg-accent text-accent-foreground',\n )\n \"\n @mousedown.prevent\n @mouseenter=\"props.suggestions.highlight(index)\"\n @click=\"props.editor && props.suggestions.select(index, props.editor)\"\n >\n {{ state.kind === 'mention' ? `${state.trigger}${item.label}` : item.label }}\n </div>\n </template>\n </div>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"RichEditorSuggestions.js","names":["_sfc_main","RichEditorSuggestions_vue_vue_type_script_setup_true_lang_default","RichEditorSuggestions_default"],"sources":["../../../src/components/fields/RichEditorSuggestions.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { fixedContainingBlockOffset, type EditorSuggestions } from '@alfakit/core'\nimport type { Editor } from '@tiptap/vue-3'\nimport { computed } from 'vue'\nimport { useT } from '../../context'\nimport { cn } from '../../lib/utils'\nimport { useStore } from '../../composables/use-store'\n\n/** The mention / merge tag listbox under the trigger. */\nconst props = defineProps<{\n suggestions: EditorSuggestions\n editor: Editor | undefined\n id: string\n}>()\nconst t = useT()\nconst state = useStore(props.suggestions.store)\n// Inside a modal the dialog's transform is the containing block of this fixed list.\nconst position = computed(() => {\n const coords = state.value.coords\n\n if (!coords) return undefined\n\n const offset = fixedContainingBlockOffset(props.editor?.view.dom)\n\n return { left: `${coords.left - offset.x}px`, top: `${coords.bottom + 4 - offset.y}px` }\n})\n</script>\n\n<template>\n <div\n v-if=\"state.open && props.editor\"\n :id=\"props.id\"\n role=\"listbox\"\n :aria-label=\"t('editor.suggestions', {}, 'Suggestions')\"\n data-slot=\"rich-editor-suggestions\"\n class=\"bg-popover text-popover-foreground fixed z-50 min-w-48 overflow-hidden rounded-md border p-1 shadow-md\"\n :style=\"position\"\n >\n <div\n v-if=\"state.loading && state.items.length === 0\"\n class=\"text-muted-foreground px-2 py-1.5 text-sm\"\n >\n {{ t('loading', {}, 'Loading…') }}\n </div>\n <div v-else-if=\"state.items.length === 0\" class=\"text-muted-foreground px-2 py-1.5 text-sm\">\n {{ t('no_results', {}, 'No results.') }}\n </div>\n <template v-else>\n <div\n v-for=\"(item, index) in state.items\"\n :id=\"`${props.id}-${index}`\"\n :key=\"item.id\"\n role=\"option\"\n :aria-selected=\"index === state.index\"\n :class=\"\n cn(\n 'cursor-pointer rounded-sm px-2 py-1.5 text-sm',\n index === state.index && 'bg-accent text-accent-foreground',\n )\n \"\n @mousedown.prevent\n @mouseenter=\"props.suggestions.highlight(index)\"\n @click=\"props.editor && props.suggestions.select(index, props.editor)\"\n >\n {{ state.kind === 'mention' ? `${state.trigger}${item.label}` : item.label }}\n </div>\n </template>\n </div>\n</template>\n"],"mappings":""}