numori-ui 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/CHANGELOG.md +120 -0
  2. package/README.md +27 -20
  3. package/dist/components/AppShell.js +234 -0
  4. package/dist/components/AppShell.js.map +1 -0
  5. package/dist/components/Avatar.js +71 -19
  6. package/dist/components/Avatar.js.map +1 -1
  7. package/dist/components/Checkbox.js +11 -2
  8. package/dist/components/Checkbox.js.map +1 -1
  9. package/dist/components/CopyField.js +195 -0
  10. package/dist/components/CopyField.js.map +1 -0
  11. package/dist/components/DescriptionList.js +116 -0
  12. package/dist/components/DescriptionList.js.map +1 -0
  13. package/dist/components/Dropdown.js +3 -1
  14. package/dist/components/Dropdown.js.map +1 -1
  15. package/dist/components/EmptyState.js +123 -0
  16. package/dist/components/EmptyState.js.map +1 -0
  17. package/dist/components/FormField.js +43 -13
  18. package/dist/components/FormField.js.map +1 -1
  19. package/dist/components/Input.js +15 -1
  20. package/dist/components/Input.js.map +1 -1
  21. package/dist/components/Modal.js +61 -4
  22. package/dist/components/Modal.js.map +1 -1
  23. package/dist/components/PageHeader.js +106 -0
  24. package/dist/components/PageHeader.js.map +1 -0
  25. package/dist/components/Pagination.js +236 -0
  26. package/dist/components/Pagination.js.map +1 -0
  27. package/dist/components/Prompt.js +11 -6
  28. package/dist/components/Prompt.js.map +1 -1
  29. package/dist/components/Segmented.js +10 -2
  30. package/dist/components/Segmented.js.map +1 -1
  31. package/dist/components/Select.js +11 -2
  32. package/dist/components/Select.js.map +1 -1
  33. package/dist/components/Sidebar.js +69 -0
  34. package/dist/components/Sidebar.js.map +1 -0
  35. package/dist/components/SidebarGroup.js +50 -0
  36. package/dist/components/SidebarGroup.js.map +1 -0
  37. package/dist/components/SidebarItem.js +167 -0
  38. package/dist/components/SidebarItem.js.map +1 -0
  39. package/dist/components/Skeleton.js +122 -0
  40. package/dist/components/Skeleton.js.map +1 -0
  41. package/dist/components/SplitPane.js +264 -0
  42. package/dist/components/SplitPane.js.map +1 -0
  43. package/dist/components/StatCard.js +185 -0
  44. package/dist/components/StatCard.js.map +1 -0
  45. package/dist/components/Table.js +182 -50
  46. package/dist/components/Table.js.map +1 -1
  47. package/dist/components/Tabs.js +216 -0
  48. package/dist/components/Tabs.js.map +1 -0
  49. package/dist/components/Toggle.js +11 -2
  50. package/dist/components/Toggle.js.map +1 -1
  51. package/dist/components/Tree.js +417 -0
  52. package/dist/components/Tree.js.map +1 -0
  53. package/dist/components/VirtualList.js +292 -0
  54. package/dist/components/VirtualList.js.map +1 -0
  55. package/dist/components/index.js +105 -81
  56. package/dist/components/index.js.map +1 -1
  57. package/dist/icons/mdi.js +12 -0
  58. package/dist/icons/mdi.js.map +1 -1
  59. package/dist/index.d.ts +16 -1
  60. package/dist/index.js +54 -39
  61. package/dist/index.js.map +1 -1
  62. package/dist/internal/focusTrap.js +163 -0
  63. package/dist/internal/focusTrap.js.map +1 -0
  64. package/dist/internal/formField.js +26 -0
  65. package/dist/internal/formField.js.map +1 -0
  66. package/dist/manifest.js +16 -1
  67. package/dist/manifest.js.map +1 -1
  68. package/package.json +1 -1
  69. package/src/components/AppShell.vue +231 -0
  70. package/src/components/Avatar.vue +69 -18
  71. package/src/components/Checkbox.vue +5 -0
  72. package/src/components/CopyField.vue +178 -0
  73. package/src/components/DescriptionList.vue +114 -0
  74. package/src/components/Dropdown.vue +4 -1
  75. package/src/components/EmptyState.vue +107 -0
  76. package/src/components/FormField.vue +37 -4
  77. package/src/components/Input.vue +9 -0
  78. package/src/components/Modal.vue +51 -3
  79. package/src/components/PageHeader.vue +102 -0
  80. package/src/components/Pagination.vue +199 -0
  81. package/src/components/Prompt.vue +14 -3
  82. package/src/components/Segmented.vue +5 -0
  83. package/src/components/Select.vue +6 -1
  84. package/src/components/Sidebar.vue +61 -0
  85. package/src/components/SidebarGroup.vue +43 -0
  86. package/src/components/SidebarItem.vue +159 -0
  87. package/src/components/Skeleton.vue +91 -0
  88. package/src/components/SplitPane.vue +264 -0
  89. package/src/components/StatCard.vue +165 -0
  90. package/src/components/Table.vue +148 -18
  91. package/src/components/Tabs.vue +217 -0
  92. package/src/components/Toggle.vue +5 -0
  93. package/src/components/Tree.vue +428 -0
  94. package/src/components/VirtualList.vue +250 -0
  95. package/src/components/index.js +45 -6
  96. package/src/icons/mdi.js +12 -0
  97. package/src/internal/focusTrap.js +185 -0
  98. package/src/internal/formField.js +23 -0
  99. package/src/manifest.js +15 -0
@@ -1 +1 @@
1
- {"version":3,"file":"Select.js","names":[],"sources":["../../src/components/Select.vue"],"sourcesContent":["<template>\n <div ref=\"containerRef\" class=\"relative\" :class=\"!block ? 'inline-block' : ''\">\n <!-- Hidden sizer: measures the widest option label so the trigger never shrinks below it -->\n <div\n ref=\"sizerRef\"\n aria-hidden=\"true\"\n class=\"invisible absolute h-0 overflow-hidden pointer-events-none whitespace-nowrap\"\n :class=\"sizerTextClass\"\n >\n <span v-for=\"opt in normalizedOptions\" :key=\"opt.value\" class=\"block\">\n <span class=\"inline-flex items-center gap-2\">\n <span v-if=\"opt.icon\" class=\"w-4\" />\n {{ opt.label }}\n <!-- account for chevron + padding -->\n <span class=\"w-4\" />\n </span>\n </span>\n </div>\n\n <!-- Trigger button: shows selected value, placeholder, or loading spinner -->\n <button\n ref=\"triggerRef\"\n type=\"button\"\n :disabled=\"disabled || loading\"\n :aria-label=\"ariaLabel\"\n :class=\"[triggerClasses, disabled || loading ? 'opacity-50 cursor-not-allowed' : '']\"\n :style=\"autoMinWidth\"\n @click=\"toggleOpen\"\n >\n <span\n v-if=\"loading\"\n class=\"flex items-center gap-2 truncate text-gray-400 dark:text-gray-500\"\n >\n <UiIcon :name=\"spinner\" class=\"w-4 h-4 animate-spin shrink-0\" />\n <span>{{ loadingText }}</span>\n </span>\n <template v-else>\n <span\n class=\"flex items-center gap-2 truncate\"\n :class=\"selectedLabel ? '' : 'text-gray-400 dark:text-gray-500'\"\n >\n <UiIcon v-if=\"selectedIcon\" :name=\"selectedIcon\" class=\"w-4 h-4 shrink-0\" />\n {{ selectedLabel || placeholder || 'Select...' }}\n </span>\n </template>\n <UiIcon\n name=\"mdi:chevron-down\"\n class=\"w-4 h-4 shrink-0 text-gray-400 transition-transform\"\n :class=\"{ 'rotate-180': isOpen }\"\n />\n </button>\n\n <!-- Dropdown panel: teleported to <body> and fixed-positioned so it is never\n clipped by an ancestor with overflow (e.g. a scrollable modal body). -->\n <Teleport to=\"body\">\n <Transition\n enter-active-class=\"transition duration-100 ease-out\"\n enter-from-class=\"opacity-0 scale-95\"\n enter-to-class=\"opacity-100 scale-100\"\n leave-active-class=\"transition duration-75 ease-in\"\n leave-from-class=\"opacity-100 scale-100\"\n leave-to-class=\"opacity-0 scale-95\"\n >\n <div\n v-show=\"isOpen\"\n ref=\"panelRef\"\n class=\"fixed z-[60] overflow-hidden\"\n :class=\"MENU_PANEL_CLASS\"\n :style=\"panelStyle\"\n >\n <!-- Search input for filtering options -->\n <div v-if=\"searchable\" class=\"p-1.5\">\n <input\n ref=\"searchRef\"\n v-model=\"searchQuery\"\n type=\"text\"\n placeholder=\"Search...\"\n class=\"w-full px-2.5 py-1.5 text-sm border border-gray-200 dark:border-gray-700 rounded-md bg-gray-50 dark:bg-gray-900 text-gray-900 dark:text-gray-300 outline-none focus:ring-1 focus:ring-primary-500 placeholder-gray-400\"\n @keydown.escape=\"close\"\n @keydown.enter.prevent=\"selectFirst\"\n />\n </div>\n <!-- Options list: ungrouped flat list or grouped sections -->\n <ul class=\"max-h-64 overflow-y-auto py-1\">\n <li\n v-if=\"filteredOptions.length === 0 && filteredGroups.length === 0\"\n class=\"px-3 py-2 text-sm text-gray-400 dark:text-gray-500\"\n >\n No results\n </li>\n\n <!-- Ungrouped options -->\n <template v-if=\"filteredGroups.length === 0\">\n <li\n v-for=\"opt in filteredOptions\"\n :key=\"opt.value\"\n class=\"flex items-center gap-2 px-3 cursor-pointer transition-colors\"\n :class=\"[optionClass(opt.value), opt.subtitle ? 'py-1.5' : 'py-1.5']\"\n @click=\"select(opt.value)\"\n >\n <UiIcon v-if=\"opt.icon\" :name=\"opt.icon\" class=\"w-4 h-4 shrink-0\" />\n <div class=\"min-w-0\">\n <span class=\"block truncate text-sm\">{{ opt.label }}</span>\n <span\n v-if=\"opt.subtitle\"\n class=\"block truncate text-[11px] text-gray-400 dark:text-gray-500 leading-tight\"\n >{{ opt.subtitle }}</span\n >\n </div>\n </li>\n </template>\n\n <!-- Grouped options -->\n <template v-else>\n <template v-for=\"group in filteredGroups\" :key=\"group.label\">\n <li\n class=\"px-3 pt-2 pb-1 text-[11px] font-semibold uppercase tracking-wider text-gray-400 dark:text-gray-500 select-none\"\n >\n {{ group.label }}\n </li>\n <li\n v-for=\"opt in group.options\"\n :key=\"opt.value\"\n class=\"flex items-center gap-2 px-3 cursor-pointer transition-colors\"\n :class=\"[optionClass(opt.value), opt.subtitle ? 'py-1.5' : 'py-1.5']\"\n @click=\"select(opt.value)\"\n >\n <UiIcon v-if=\"opt.icon\" :name=\"opt.icon\" class=\"w-4 h-4 shrink-0\" />\n <div class=\"min-w-0\">\n <span class=\"block truncate text-sm\">{{ opt.label }}</span>\n <span\n v-if=\"opt.subtitle\"\n class=\"block truncate text-[11px] text-gray-400 dark:text-gray-500 leading-tight\"\n >{{ opt.subtitle }}</span\n >\n </div>\n </li>\n </template>\n </template>\n </ul>\n </div>\n </Transition>\n </Teleport>\n </div>\n</template>\n\n<script setup>\n/**\n * UiSelect — Custom dropdown select component with search, grouping, icons, and loading state.\n *\n * Renders a styled trigger button that opens a dropdown panel with filterable options.\n * Supports flat option lists and grouped options (via `group` key on option objects).\n * Includes keyboard navigation (Escape to close, Enter to select first match),\n * automatic drop-up when near the bottom of the viewport, and a loading spinner state.\n *\n * @example Basic select\n * <UiSelect v-model=\"color\" :options=\"['Red', 'Green', 'Blue']\" placeholder=\"Pick a color\" />\n *\n * @example Searchable select with object options\n * <UiSelect v-model=\"lang\" :options=\"[{ value: 'en', label: 'English' }, { value: 'es', label: 'Spanish' }]\" searchable />\n *\n * @example Grouped options with icons\n * <UiSelect v-model=\"tool\" :options=\"[\n * { value: 'pen', label: 'Pen', icon: 'mdi:pen', group: 'Drawing' },\n * { value: 'eraser', label: 'Eraser', icon: 'mdi:eraser', group: 'Drawing' },\n * { value: 'text', label: 'Text', icon: 'mdi:format-text', group: 'Insert' },\n * ]\" searchable />\n *\n * @example Loading state\n * <UiSelect v-model=\"val\" :options=\"[]\" :loading=\"true\" loading-text=\"Fetching...\" />\n *\n * @emits {string | number | boolean} update:modelValue — Emitted when an option is selected\n */\nimport { ref, computed, watch, nextTick, onMounted, onBeforeUnmount } from 'vue'\nimport UiIcon from '../icons/Icon.vue'\nimport { MENU_PANEL_CLASS } from '../internal/menu.js'\nconst props = defineProps({\n /**\n * Currently selected value (v-model).\n * @type {string | number | boolean | null}\n * @default ''\n */\n modelValue: { type: [String, Number, Boolean, null], default: '' },\n\n /**\n * Array of selectable options. Each item can be:\n * - A primitive (string/number) used as both value and label\n * - An object: `{ value, label, icon?, group? }`\n * @type {Array}\n * @default []\n */\n options: { type: Array, default: () => [] },\n\n /**\n * Placeholder text shown when no option is selected.\n * @type {string}\n * @default ''\n */\n placeholder: { type: String, default: '' },\n\n /**\n * Enable a search input inside the dropdown for filtering options.\n * @type {boolean}\n * @default false\n */\n searchable: { type: Boolean, default: false },\n\n /**\n * Disabled state — dims the trigger and prevents opening.\n * @type {boolean}\n * @default false\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Trigger button size controlling padding and font.\n * @type {string}\n * @default 'md'\n * @values 'xs' | 'sm' | 'md'\n */\n size: { type: String, default: 'md' },\n\n /**\n * Full-width mode — trigger stretches to fill its container.\n * @type {boolean}\n * @default true\n */\n block: { type: Boolean, default: true },\n\n /**\n * Accessible label for the trigger button.\n * @type {string}\n * @default undefined\n */\n ariaLabel: { type: String, default: undefined },\n\n /**\n * Loading state — shows a spinner and disables interaction.\n * @type {boolean}\n * @default false\n */\n loading: { type: Boolean, default: false },\n\n /**\n * Text displayed next to the spinner during loading.\n * @type {string}\n * @default 'Loading...'\n */\n loadingText: { type: String, default: 'Loading...' },\n\n /**\n * MDI icon name for the loading spinner.\n * @type {string}\n * @default 'mdi:loading'\n */\n spinner: { type: String, default: 'mdi:loading' },\n})\n\nconst emit = defineEmits(['update:modelValue'])\n\nconst containerRef = ref(null)\nconst triggerRef = ref(null)\nconst searchRef = ref(null)\nconst sizerRef = ref(null)\nconst panelRef = ref(null)\nconst isOpen = ref(false)\nconst searchQuery = ref('')\nconst measuredWidth = ref(0)\nconst panelStyle = ref({})\n\n// Position the teleported panel under (or above) the trigger using fixed\n// coordinates so it overlays everything and is never clipped by a scrollable\n// ancestor. Re-run on scroll/resize while open so it stays anchored.\nconst reposition = () => {\n const el = triggerRef.value\n if (!el) return\n const rect = el.getBoundingClientRect()\n const spaceBelow = window.innerHeight - rect.bottom\n const openUp = spaceBelow < 260 && rect.top > spaceBelow\n // Inline transform-origin (not a Tailwind class) so the panel reliably scales\n // in from the edge nearest the trigger — top when dropping down, bottom when\n // dropping up — instead of drifting in from its centre.\n const style = {\n left: `${rect.left}px`,\n minWidth: `${rect.width}px`,\n transformOrigin: openUp ? 'bottom center' : 'top center',\n }\n if (props.block) style.width = `${rect.width}px`\n if (openUp) style.bottom = `${window.innerHeight - rect.top + 4}px`\n else style.top = `${rect.bottom + 4}px`\n panelStyle.value = style\n}\n\nconst startTracking = () => {\n window.addEventListener('scroll', reposition, true)\n window.addEventListener('resize', reposition)\n}\nconst stopTracking = () => {\n window.removeEventListener('scroll', reposition, true)\n window.removeEventListener('resize', reposition)\n}\n\n// Text class for the hidden sizer — must match the trigger's font size\nconst sizerTextClass = computed(() => {\n const map = { xs: 'text-xs', sm: 'text-sm', md: 'text-sm' }\n return map[props.size] || 'text-sm'\n})\n\n// Measure the widest option on mount and when options change\nconst measureSizer = () => {\n if (!sizerRef.value) {\n measuredWidth.value = 0\n return\n }\n measuredWidth.value = sizerRef.value.scrollWidth\n}\n\nonMounted(measureSizer)\nwatch(\n () => props.options,\n () => nextTick(measureSizer),\n { deep: true },\n)\n\n// Auto min-width style: ensures trigger never shrinks below the widest option\nconst autoMinWidth = computed(() => {\n if (!measuredWidth.value) return undefined\n // Add padding for the trigger's horizontal padding + border\n const padMap = { xs: 28, sm: 24, md: 30 }\n const pad = padMap[props.size] || 30\n return { minWidth: `${measuredWidth.value + pad}px` }\n})\n\n// ── Normalize options ────────────────────────────────────\n// Convert primitive options (string/number) into { value, label, subtitle, icon, group } objects\nconst normalizedOptions = computed(() =>\n props.options.map((opt) =>\n typeof opt === 'object' && opt !== null\n ? {\n value: opt.value,\n label: opt.label ?? String(opt.value),\n subtitle: opt.subtitle || '',\n icon: opt.icon || '',\n group: opt.group || '',\n }\n : { value: opt, label: String(opt), subtitle: '', icon: '', group: '' },\n ),\n)\n\n// ── Filtering ────────────────────────────────────────────\n// Apply search query filter against option labels (case-insensitive)\nconst filteredNormalized = computed(() => {\n if (!searchQuery.value) return normalizedOptions.value\n const q = searchQuery.value.toLowerCase()\n return normalizedOptions.value.filter(\n (opt) => opt.label.toLowerCase().includes(q) || opt.subtitle.toLowerCase().includes(q),\n )\n})\n\n// ── Grouping ─────────────────────────────────────────────\n// Detect if any option has a group key to enable grouped rendering\nconst hasGroups = computed(() => normalizedOptions.value.some((o) => o.group))\n\n// Build grouped structure: Map<groupLabel, { label, options[] }>\nconst filteredGroups = computed(() => {\n if (!hasGroups.value) return []\n const map = new Map()\n for (const opt of filteredNormalized.value) {\n const key = opt.group || ''\n if (!map.has(key)) map.set(key, { label: key, options: [] })\n map.get(key).options.push(opt)\n }\n return [...map.values()].filter((g) => g.options.length > 0)\n})\n\nconst filteredOptions = computed(() => {\n if (hasGroups.value) return []\n return filteredNormalized.value\n})\n\n// ── Selected display ─────────────────────────────────────\nconst selectedOpt = computed(() =>\n normalizedOptions.value.find((o) => o.value === props.modelValue),\n)\nconst selectedLabel = computed(() => selectedOpt.value?.label || '')\nconst selectedIcon = computed(() => selectedOpt.value?.icon || '')\n\n// ── Styling ──────────────────────────────────────────────\nconst triggerClasses = computed(() => {\n const base =\n 'flex items-center justify-between gap-2 text-left border bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-400 outline-none transition-colors focus:ring-2 focus:ring-primary-500 focus:border-primary-500'\n const width = props.block ? 'w-full' : ''\n const sizeMap = {\n xs: 'px-2.5 py-1.5 text-xs rounded-md border-gray-200 dark:border-gray-700',\n sm: 'px-2 py-1 text-sm rounded-lg border-gray-300 dark:border-gray-600',\n md: 'px-3 py-2 text-sm rounded-lg border-gray-300 dark:border-gray-700',\n }\n return `${base} ${width} ${sizeMap[props.size] || sizeMap.md}`\n})\n\nconst optionClass = (value) =>\n props.modelValue === value\n ? 'bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-300'\n : 'text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700'\n\n// ── Interactions ─────────────────────────────────────────\n// Toggle dropdown open/close, auto-detect drop direction, and focus search input\nconst toggleOpen = () => {\n if (props.disabled || props.loading) return\n isOpen.value = !isOpen.value\n if (isOpen.value) {\n searchQuery.value = ''\n reposition()\n startTracking()\n nextTick(() => {\n reposition()\n if (props.searchable) searchRef.value?.focus()\n })\n } else {\n stopTracking()\n }\n}\n\nconst select = (value) => {\n emit('update:modelValue', value)\n close()\n}\n\nconst selectFirst = () => {\n const pool = hasGroups.value\n ? filteredGroups.value.flatMap((g) => g.options)\n : filteredOptions.value\n if (pool.length) select(pool[0].value)\n}\n\nconst close = () => {\n isOpen.value = false\n searchQuery.value = ''\n stopTracking()\n}\n\n// Programmatic toggle for parent row clicks.\n// Uses a skip flag to prevent the race with the document click handler:\n// when the row is clicked, the capture-phase listener fires first (closing the dropdown),\n// then the row handler calls toggle(). The flag lets us detect this and skip the re-open.\nlet skipNextOpen = false\nconst toggle = () => {\n if (props.disabled || props.loading) return\n if (skipNextOpen) {\n skipNextOpen = false\n return\n }\n toggleOpen()\n}\n\nconst closeFromOutside = () => {\n if (isOpen.value) skipNextOpen = true\n close()\n setTimeout(() => {\n skipNextOpen = false\n }, 0)\n}\n\nconst onDocumentClick = (e) => {\n // The panel is teleported to <body>, so clicks inside it are NOT inside the\n // container — check both before treating a click as \"outside\".\n if (containerRef.value?.contains(e.target)) return\n if (panelRef.value?.contains(e.target)) return\n closeFromOutside()\n}\n\nonMounted(() => document.addEventListener('click', onDocumentClick, true))\nonBeforeUnmount(() => {\n document.removeEventListener('click', onDocumentClick, true)\n stopTracking()\n})\n\ndefineExpose({ toggle, close, isOpen })\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgLA,MAAM,QAAQ;EAkFd,MAAM,OAAO;EAEb,MAAM,eAAe,IAAI,IAAI;EAC7B,MAAM,aAAa,IAAI,IAAI;EAC3B,MAAM,YAAY,IAAI,IAAI;EAC1B,MAAM,WAAW,IAAI,IAAI;EACzB,MAAM,WAAW,IAAI,IAAI;EACzB,MAAM,SAAS,IAAI,KAAK;EACxB,MAAM,cAAc,IAAI,EAAE;EAC1B,MAAM,gBAAgB,IAAI,CAAC;EAC3B,MAAM,aAAa,IAAI,CAAC,CAAC;EAKzB,MAAM,mBAAmB;GACvB,MAAM,KAAK,WAAW;GACtB,IAAI,CAAC,IAAI;GACT,MAAM,OAAO,GAAG,sBAAsB;GACtC,MAAM,aAAa,OAAO,cAAc,KAAK;GAC7C,MAAM,SAAS,aAAa,OAAO,KAAK,MAAM;GAI9C,MAAM,QAAQ;IACZ,MAAM,GAAG,KAAK,KAAK;IACnB,UAAU,GAAG,KAAK,MAAM;IACxB,iBAAiB,SAAS,kBAAkB;GAC9C;GACA,IAAI,MAAM,OAAO,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A,MAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,GAAA,mBAOM,OAPN,aAOM,CANJ,mBAA2D,QAA3D,aAA2D,gBAAnB,IAAI,KAAK,GAAA,CAAA,GAEzC,IAAI,YADZ,UAAA,GAAA,mBAIC,QAJD,aAIC,gBADK,IAAI,QAAQ,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,CAAA,CAAA,GAAA,IAAA,WAAA;;KArEpB,CAAA,GAAA,GAAA,EAAA,CAAA,CAAA,GAAA,CAAA,GAAA,CAAA,CAAA,OAAA,OAAA,KAAM,CAAA,CAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"Select.js","names":[],"sources":["../../src/components/Select.vue"],"sourcesContent":["<template>\n <div ref=\"containerRef\" class=\"relative\" :class=\"!block ? 'inline-block' : ''\">\n <!-- Hidden sizer: measures the widest option label so the trigger never shrinks below it -->\n <div\n ref=\"sizerRef\"\n aria-hidden=\"true\"\n class=\"invisible absolute h-0 overflow-hidden pointer-events-none whitespace-nowrap\"\n :class=\"sizerTextClass\"\n >\n <span v-for=\"opt in normalizedOptions\" :key=\"opt.value\" class=\"block\">\n <span class=\"inline-flex items-center gap-2\">\n <span v-if=\"opt.icon\" class=\"w-4\" />\n {{ opt.label }}\n <!-- account for chevron + padding -->\n <span class=\"w-4\" />\n </span>\n </span>\n </div>\n\n <!-- Trigger button: shows selected value, placeholder, or loading spinner -->\n <button\n :id=\"field?.controlId.value\"\n ref=\"triggerRef\"\n type=\"button\"\n :aria-describedby=\"field?.describedBy.value\"\n :disabled=\"disabled || loading\"\n :aria-label=\"ariaLabel\"\n :class=\"[triggerClasses, disabled || loading ? 'opacity-50 cursor-not-allowed' : '']\"\n :style=\"autoMinWidth\"\n @click=\"toggleOpen\"\n >\n <span\n v-if=\"loading\"\n class=\"flex items-center gap-2 truncate text-gray-400 dark:text-gray-500\"\n >\n <UiIcon :name=\"spinner\" class=\"w-4 h-4 animate-spin shrink-0\" />\n <span>{{ loadingText }}</span>\n </span>\n <template v-else>\n <span\n class=\"flex items-center gap-2 truncate\"\n :class=\"selectedLabel ? '' : 'text-gray-400 dark:text-gray-500'\"\n >\n <UiIcon v-if=\"selectedIcon\" :name=\"selectedIcon\" class=\"w-4 h-4 shrink-0\" />\n {{ selectedLabel || placeholder || 'Select...' }}\n </span>\n </template>\n <UiIcon\n name=\"mdi:chevron-down\"\n class=\"w-4 h-4 shrink-0 text-gray-400 transition-transform\"\n :class=\"{ 'rotate-180': isOpen }\"\n />\n </button>\n\n <!-- Dropdown panel: teleported to <body> and fixed-positioned so it is never\n clipped by an ancestor with overflow (e.g. a scrollable modal body). -->\n <Teleport to=\"body\">\n <Transition\n enter-active-class=\"transition duration-100 ease-out\"\n enter-from-class=\"opacity-0 scale-95\"\n enter-to-class=\"opacity-100 scale-100\"\n leave-active-class=\"transition duration-75 ease-in\"\n leave-from-class=\"opacity-100 scale-100\"\n leave-to-class=\"opacity-0 scale-95\"\n >\n <div\n v-show=\"isOpen\"\n ref=\"panelRef\"\n class=\"fixed z-[60] overflow-hidden\"\n :class=\"MENU_PANEL_CLASS\"\n :style=\"panelStyle\"\n >\n <!-- Search input for filtering options -->\n <div v-if=\"searchable\" class=\"p-1.5\">\n <input\n ref=\"searchRef\"\n v-model=\"searchQuery\"\n type=\"text\"\n placeholder=\"Search...\"\n class=\"w-full px-2.5 py-1.5 text-sm border border-gray-200 dark:border-gray-700 rounded-md bg-gray-50 dark:bg-gray-900 text-gray-900 dark:text-gray-300 outline-none focus:ring-1 focus:ring-primary-500 placeholder-gray-400\"\n @keydown.escape.prevent=\"close\"\n @keydown.enter.prevent=\"selectFirst\"\n />\n </div>\n <!-- Options list: ungrouped flat list or grouped sections -->\n <ul class=\"max-h-64 overflow-y-auto py-1\">\n <li\n v-if=\"filteredOptions.length === 0 && filteredGroups.length === 0\"\n class=\"px-3 py-2 text-sm text-gray-400 dark:text-gray-500\"\n >\n No results\n </li>\n\n <!-- Ungrouped options -->\n <template v-if=\"filteredGroups.length === 0\">\n <li\n v-for=\"opt in filteredOptions\"\n :key=\"opt.value\"\n class=\"flex items-center gap-2 px-3 cursor-pointer transition-colors\"\n :class=\"[optionClass(opt.value), opt.subtitle ? 'py-1.5' : 'py-1.5']\"\n @click=\"select(opt.value)\"\n >\n <UiIcon v-if=\"opt.icon\" :name=\"opt.icon\" class=\"w-4 h-4 shrink-0\" />\n <div class=\"min-w-0\">\n <span class=\"block truncate text-sm\">{{ opt.label }}</span>\n <span\n v-if=\"opt.subtitle\"\n class=\"block truncate text-[11px] text-gray-400 dark:text-gray-500 leading-tight\"\n >{{ opt.subtitle }}</span\n >\n </div>\n </li>\n </template>\n\n <!-- Grouped options -->\n <template v-else>\n <template v-for=\"group in filteredGroups\" :key=\"group.label\">\n <li\n class=\"px-3 pt-2 pb-1 text-[11px] font-semibold uppercase tracking-wider text-gray-400 dark:text-gray-500 select-none\"\n >\n {{ group.label }}\n </li>\n <li\n v-for=\"opt in group.options\"\n :key=\"opt.value\"\n class=\"flex items-center gap-2 px-3 cursor-pointer transition-colors\"\n :class=\"[optionClass(opt.value), opt.subtitle ? 'py-1.5' : 'py-1.5']\"\n @click=\"select(opt.value)\"\n >\n <UiIcon v-if=\"opt.icon\" :name=\"opt.icon\" class=\"w-4 h-4 shrink-0\" />\n <div class=\"min-w-0\">\n <span class=\"block truncate text-sm\">{{ opt.label }}</span>\n <span\n v-if=\"opt.subtitle\"\n class=\"block truncate text-[11px] text-gray-400 dark:text-gray-500 leading-tight\"\n >{{ opt.subtitle }}</span\n >\n </div>\n </li>\n </template>\n </template>\n </ul>\n </div>\n </Transition>\n </Teleport>\n </div>\n</template>\n\n<script setup>\n/**\n * UiSelect — Custom dropdown select component with search, grouping, icons, and loading state.\n *\n * Renders a styled trigger button that opens a dropdown panel with filterable options.\n * Supports flat option lists and grouped options (via `group` key on option objects).\n * Includes keyboard navigation (Escape to close, Enter to select first match),\n * automatic drop-up when near the bottom of the viewport, and a loading spinner state.\n *\n * @example Basic select\n * <UiSelect v-model=\"color\" :options=\"['Red', 'Green', 'Blue']\" placeholder=\"Pick a color\" />\n *\n * @example Searchable select with object options\n * <UiSelect v-model=\"lang\" :options=\"[{ value: 'en', label: 'English' }, { value: 'es', label: 'Spanish' }]\" searchable />\n *\n * @example Grouped options with icons\n * <UiSelect v-model=\"tool\" :options=\"[\n * { value: 'pen', label: 'Pen', icon: 'mdi:pen', group: 'Drawing' },\n * { value: 'eraser', label: 'Eraser', icon: 'mdi:eraser', group: 'Drawing' },\n * { value: 'text', label: 'Text', icon: 'mdi:format-text', group: 'Insert' },\n * ]\" searchable />\n *\n * @example Loading state\n * <UiSelect v-model=\"val\" :options=\"[]\" :loading=\"true\" loading-text=\"Fetching...\" />\n *\n * @emits {string | number | boolean} update:modelValue — Emitted when an option is selected\n */\nimport { ref, computed, watch, nextTick, onMounted, onBeforeUnmount } from 'vue'\nimport UiIcon from '../icons/Icon.vue'\nimport { MENU_PANEL_CLASS } from '../internal/menu.js'\nimport { useFormField } from '../internal/formField.js'\nconst props = defineProps({\n /**\n * Currently selected value (v-model).\n * @type {string | number | boolean | null}\n * @default ''\n */\n modelValue: { type: [String, Number, Boolean, null], default: '' },\n\n /**\n * Array of selectable options. Each item can be:\n * - A primitive (string/number) used as both value and label\n * - An object: `{ value, label, icon?, group? }`\n * @type {Array}\n * @default []\n */\n options: { type: Array, default: () => [] },\n\n /**\n * Placeholder text shown when no option is selected.\n * @type {string}\n * @default ''\n */\n placeholder: { type: String, default: '' },\n\n /**\n * Enable a search input inside the dropdown for filtering options.\n * @type {boolean}\n * @default false\n */\n searchable: { type: Boolean, default: false },\n\n /**\n * Disabled state — dims the trigger and prevents opening.\n * @type {boolean}\n * @default false\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Trigger button size controlling padding and font.\n * @type {string}\n * @default 'md'\n * @values 'xs' | 'sm' | 'md'\n */\n size: { type: String, default: 'md' },\n\n /**\n * Full-width mode — trigger stretches to fill its container.\n * @type {boolean}\n * @default true\n */\n block: { type: Boolean, default: true },\n\n /**\n * Accessible label for the trigger button.\n * @type {string}\n * @default undefined\n */\n ariaLabel: { type: String, default: undefined },\n\n /**\n * Loading state — shows a spinner and disables interaction.\n * @type {boolean}\n * @default false\n */\n loading: { type: Boolean, default: false },\n\n /**\n * Text displayed next to the spinner during loading.\n * @type {string}\n * @default 'Loading...'\n */\n loadingText: { type: String, default: 'Loading...' },\n\n /**\n * MDI icon name for the loading spinner.\n * @type {string}\n * @default 'mdi:loading'\n */\n spinner: { type: String, default: 'mdi:loading' },\n})\n\nconst emit = defineEmits(['update:modelValue'])\n\nconst field = useFormField()\n\nconst containerRef = ref(null)\nconst triggerRef = ref(null)\nconst searchRef = ref(null)\nconst sizerRef = ref(null)\nconst panelRef = ref(null)\nconst isOpen = ref(false)\nconst searchQuery = ref('')\nconst measuredWidth = ref(0)\nconst panelStyle = ref({})\n\n// Position the teleported panel under (or above) the trigger using fixed\n// coordinates so it overlays everything and is never clipped by a scrollable\n// ancestor. Re-run on scroll/resize while open so it stays anchored.\nconst reposition = () => {\n const el = triggerRef.value\n if (!el) return\n const rect = el.getBoundingClientRect()\n const spaceBelow = window.innerHeight - rect.bottom\n const openUp = spaceBelow < 260 && rect.top > spaceBelow\n // Inline transform-origin (not a Tailwind class) so the panel reliably scales\n // in from the edge nearest the trigger — top when dropping down, bottom when\n // dropping up — instead of drifting in from its centre.\n const style = {\n left: `${rect.left}px`,\n minWidth: `${rect.width}px`,\n transformOrigin: openUp ? 'bottom center' : 'top center',\n }\n if (props.block) style.width = `${rect.width}px`\n if (openUp) style.bottom = `${window.innerHeight - rect.top + 4}px`\n else style.top = `${rect.bottom + 4}px`\n panelStyle.value = style\n}\n\nconst startTracking = () => {\n window.addEventListener('scroll', reposition, true)\n window.addEventListener('resize', reposition)\n}\nconst stopTracking = () => {\n window.removeEventListener('scroll', reposition, true)\n window.removeEventListener('resize', reposition)\n}\n\n// Text class for the hidden sizer — must match the trigger's font size\nconst sizerTextClass = computed(() => {\n const map = { xs: 'text-xs', sm: 'text-sm', md: 'text-sm' }\n return map[props.size] || 'text-sm'\n})\n\n// Measure the widest option on mount and when options change\nconst measureSizer = () => {\n if (!sizerRef.value) {\n measuredWidth.value = 0\n return\n }\n measuredWidth.value = sizerRef.value.scrollWidth\n}\n\nonMounted(measureSizer)\nwatch(\n () => props.options,\n () => nextTick(measureSizer),\n { deep: true },\n)\n\n// Auto min-width style: ensures trigger never shrinks below the widest option\nconst autoMinWidth = computed(() => {\n if (!measuredWidth.value) return undefined\n // Add padding for the trigger's horizontal padding + border\n const padMap = { xs: 28, sm: 24, md: 30 }\n const pad = padMap[props.size] || 30\n return { minWidth: `${measuredWidth.value + pad}px` }\n})\n\n// ── Normalize options ────────────────────────────────────\n// Convert primitive options (string/number) into { value, label, subtitle, icon, group } objects\nconst normalizedOptions = computed(() =>\n props.options.map((opt) =>\n typeof opt === 'object' && opt !== null\n ? {\n value: opt.value,\n label: opt.label ?? String(opt.value),\n subtitle: opt.subtitle || '',\n icon: opt.icon || '',\n group: opt.group || '',\n }\n : { value: opt, label: String(opt), subtitle: '', icon: '', group: '' },\n ),\n)\n\n// ── Filtering ────────────────────────────────────────────\n// Apply search query filter against option labels (case-insensitive)\nconst filteredNormalized = computed(() => {\n if (!searchQuery.value) return normalizedOptions.value\n const q = searchQuery.value.toLowerCase()\n return normalizedOptions.value.filter(\n (opt) => opt.label.toLowerCase().includes(q) || opt.subtitle.toLowerCase().includes(q),\n )\n})\n\n// ── Grouping ─────────────────────────────────────────────\n// Detect if any option has a group key to enable grouped rendering\nconst hasGroups = computed(() => normalizedOptions.value.some((o) => o.group))\n\n// Build grouped structure: Map<groupLabel, { label, options[] }>\nconst filteredGroups = computed(() => {\n if (!hasGroups.value) return []\n const map = new Map()\n for (const opt of filteredNormalized.value) {\n const key = opt.group || ''\n if (!map.has(key)) map.set(key, { label: key, options: [] })\n map.get(key).options.push(opt)\n }\n return [...map.values()].filter((g) => g.options.length > 0)\n})\n\nconst filteredOptions = computed(() => {\n if (hasGroups.value) return []\n return filteredNormalized.value\n})\n\n// ── Selected display ─────────────────────────────────────\nconst selectedOpt = computed(() =>\n normalizedOptions.value.find((o) => o.value === props.modelValue),\n)\nconst selectedLabel = computed(() => selectedOpt.value?.label || '')\nconst selectedIcon = computed(() => selectedOpt.value?.icon || '')\n\n// ── Styling ──────────────────────────────────────────────\nconst triggerClasses = computed(() => {\n const base =\n 'flex items-center justify-between gap-2 text-left border bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-400 outline-none transition-colors focus:ring-2 focus:ring-primary-500 focus:border-primary-500'\n const width = props.block ? 'w-full' : ''\n const sizeMap = {\n xs: 'px-2.5 py-1.5 text-xs rounded-md border-gray-200 dark:border-gray-700',\n sm: 'px-2 py-1 text-sm rounded-lg border-gray-300 dark:border-gray-600',\n md: 'px-3 py-2 text-sm rounded-lg border-gray-300 dark:border-gray-700',\n }\n return `${base} ${width} ${sizeMap[props.size] || sizeMap.md}`\n})\n\nconst optionClass = (value) =>\n props.modelValue === value\n ? 'bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-300'\n : 'text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700'\n\n// ── Interactions ─────────────────────────────────────────\n// Toggle dropdown open/close, auto-detect drop direction, and focus search input\nconst toggleOpen = () => {\n if (props.disabled || props.loading) return\n isOpen.value = !isOpen.value\n if (isOpen.value) {\n searchQuery.value = ''\n reposition()\n startTracking()\n nextTick(() => {\n reposition()\n if (props.searchable) searchRef.value?.focus()\n })\n } else {\n stopTracking()\n }\n}\n\nconst select = (value) => {\n emit('update:modelValue', value)\n close()\n}\n\nconst selectFirst = () => {\n const pool = hasGroups.value\n ? filteredGroups.value.flatMap((g) => g.options)\n : filteredOptions.value\n if (pool.length) select(pool[0].value)\n}\n\nconst close = () => {\n isOpen.value = false\n searchQuery.value = ''\n stopTracking()\n}\n\n// Programmatic toggle for parent row clicks.\n// Uses a skip flag to prevent the race with the document click handler:\n// when the row is clicked, the capture-phase listener fires first (closing the dropdown),\n// then the row handler calls toggle(). The flag lets us detect this and skip the re-open.\nlet skipNextOpen = false\nconst toggle = () => {\n if (props.disabled || props.loading) return\n if (skipNextOpen) {\n skipNextOpen = false\n return\n }\n toggleOpen()\n}\n\nconst closeFromOutside = () => {\n if (isOpen.value) skipNextOpen = true\n close()\n setTimeout(() => {\n skipNextOpen = false\n }, 0)\n}\n\nconst onDocumentClick = (e) => {\n // The panel is teleported to <body>, so clicks inside it are NOT inside the\n // container — check both before treating a click as \"outside\".\n if (containerRef.value?.contains(e.target)) return\n if (panelRef.value?.contains(e.target)) return\n closeFromOutside()\n}\n\nonMounted(() => document.addEventListener('click', onDocumentClick, true))\nonBeforeUnmount(() => {\n document.removeEventListener('click', onDocumentClick, true)\n stopTracking()\n})\n\ndefineExpose({ toggle, close, isOpen })\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmLA,MAAM,QAAQ;EAkFd,MAAM,OAAO;EAEb,MAAM,QAAQ,aAAa;EAE3B,MAAM,eAAe,IAAI,IAAI;EAC7B,MAAM,aAAa,IAAI,IAAI;EAC3B,MAAM,YAAY,IAAI,IAAI;EAC1B,MAAM,WAAW,IAAI,IAAI;EACzB,MAAM,WAAW,IAAI,IAAI;EACzB,MAAM,SAAS,IAAI,KAAK;EACxB,MAAM,cAAc,IAAI,EAAE;EAC1B,MAAM,gBAAgB,IAAI,CAAC;EAC3B,MAAM,aAAa,IAAI,CAAC,CAAC;EAKzB,MAAM,mBAAmB;GACvB,MAAM,KAAK,WAAW;GACtB,IAAI,CAAC,IAAI;GACT,MAAM,OAAO,GAAG,sBAAsB;GACtC,MAAM,aAAa,OAAO,cAAc,K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AAA,UAAA,GAAA,mBAgBK,MAAA;QAdF,KAAK,IAAI;QACV,OAAK,eAAA,CAAC,iEAA+D,CAC5D,YAAY,IAAI,KAAK,GAAG,IAAI,WAAQ,WAAA,QAAA,CAAA,CAAA;QAC5C,UAAK,WAAE,OAAO,IAAI,KAAK;OAEV,GAAA,CAAA,IAAI,QAAlB,UAAA,GAAA,YAAoE,aAAA;;QAA3C,MAAM,IAAI;QAAM,OAAM;OAC/C,GAAA,MAAA,GAAA,CAAA,MAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,GAAA,mBAOM,OAPN,aAOM,CANJ,mBAA2D,QAA3D,aAA2D,gBAAnB,IAAI,KAAK,GAAA,CAAA,GAEzC,IAAI,YADZ,UAAA,GAAA,mBAIC,QAJD,aAIC,gBADK,IAAI,QAAQ,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,CAAA,CAAA,GAAA,IAAA,WAAA;;KArEpB,CAAA,GAAA,GAAA,EAAA,CAAA,CAAA,GAAA,CAAA,GAAA,CAAA,CAAA,OAAA,OAAA,KAAM,CAAA,CAAA,CAAA,CAAA"}
@@ -0,0 +1,69 @@
1
+ import { useMergedClasses } from "../composables/useMergedClasses.js";
2
+ import { createCommentVNode, createElementBlock, createElementVNode, mergeProps, openBlock, renderSlot, unref } from "vue";
3
+ //#region src/components/Sidebar.vue
4
+ var _hoisted_1 = ["aria-label"];
5
+ var _hoisted_2 = {
6
+ key: 0,
7
+ class: "flex h-14 shrink-0 items-center gap-2 border-b border-gray-200 px-4 dark:border-gray-800"
8
+ };
9
+ var _hoisted_3 = { class: "min-h-0 flex-1 space-y-0.5 overflow-y-auto px-3 py-4" };
10
+ var _hoisted_4 = {
11
+ key: 1,
12
+ class: "shrink-0 border-t border-gray-200 p-3 dark:border-gray-800"
13
+ };
14
+ var _sfc_main = /*@__PURE__*/ Object.assign({ inheritAttrs: false }, {
15
+ __name: "Sidebar",
16
+ props: {
17
+ /**
18
+ * Accessible name of the navigation landmark.
19
+ * @type {string}
20
+ * @default 'Main'
21
+ */
22
+ label: {
23
+ type: String,
24
+ default: "Main"
25
+ } },
26
+ setup(__props) {
27
+ /**
28
+ * UiSidebar — vertical navigation for an application, with a brand header,
29
+ * a scrolling list of items and a pinned footer.
30
+ *
31
+ * Fills the height of its container, so it is usually placed in
32
+ * `UiAppShell`'s `#sidebar` slot, which handles the pinned / off-canvas
33
+ * behaviour. Fill it with `UiSidebarItem`s, grouped under headings with
34
+ * `UiSidebarGroup` when the list grows.
35
+ *
36
+ * Renders a `<nav>` landmark; give each one on a page a distinct `label`.
37
+ *
38
+ * @example
39
+ * <UiSidebar label="Main">
40
+ * <template #header><strong>Numori CRDT</strong></template>
41
+ * <UiSidebarItem icon="mdi:view-grid" href="/" active>Dashboard</UiSidebarItem>
42
+ * <UiSidebarGroup label="Manage">
43
+ * <UiSidebarItem icon="mdi:sync" href="/apps">Apps</UiSidebarItem>
44
+ * <UiSidebarItem icon="mdi:account-group" href="/users">Users</UiSidebarItem>
45
+ * </UiSidebarGroup>
46
+ * <template #footer>Signed in as ada</template>
47
+ * </UiSidebar>
48
+ *
49
+ * @slot default — Navigation items and groups.
50
+ * @slot header — Brand area at the top, the same height as the shell's top bar.
51
+ * @slot footer — Pinned content at the bottom (account, version, etc.).
52
+ */
53
+ const { mergedClasses, restAttrs } = useMergedClasses("flex h-full min-h-0 w-full flex-col");
54
+ return (_ctx, _cache) => {
55
+ return openBlock(), createElementBlock("nav", mergeProps({
56
+ "aria-label": __props.label,
57
+ class: unref(mergedClasses)
58
+ }, unref(restAttrs)), [
59
+ _ctx.$slots.header ? (openBlock(), createElementBlock("div", _hoisted_2, [renderSlot(_ctx.$slots, "header")])) : createCommentVNode("", true),
60
+ createElementVNode("div", _hoisted_3, [renderSlot(_ctx.$slots, "default")]),
61
+ _ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_4, [renderSlot(_ctx.$slots, "footer")])) : createCommentVNode("", true)
62
+ ], 16, _hoisted_1);
63
+ };
64
+ }
65
+ });
66
+ //#endregion
67
+ export { _sfc_main as default };
68
+
69
+ //# sourceMappingURL=Sidebar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sidebar.js","names":["$slots"],"sources":["../../src/components/Sidebar.vue"],"sourcesContent":["<template>\n <nav :aria-label=\"label\" :class=\"mergedClasses\" v-bind=\"restAttrs\">\n <div\n v-if=\"$slots.header\"\n class=\"flex h-14 shrink-0 items-center gap-2 border-b border-gray-200 px-4 dark:border-gray-800\"\n >\n <slot name=\"header\" />\n </div>\n\n <div class=\"min-h-0 flex-1 space-y-0.5 overflow-y-auto px-3 py-4\">\n <slot />\n </div>\n\n <div v-if=\"$slots.footer\" class=\"shrink-0 border-t border-gray-200 p-3 dark:border-gray-800\">\n <slot name=\"footer\" />\n </div>\n </nav>\n</template>\n\n<script setup>\n/**\n * UiSidebar — vertical navigation for an application, with a brand header,\n * a scrolling list of items and a pinned footer.\n *\n * Fills the height of its container, so it is usually placed in\n * `UiAppShell`'s `#sidebar` slot, which handles the pinned / off-canvas\n * behaviour. Fill it with `UiSidebarItem`s, grouped under headings with\n * `UiSidebarGroup` when the list grows.\n *\n * Renders a `<nav>` landmark; give each one on a page a distinct `label`.\n *\n * @example\n * <UiSidebar label=\"Main\">\n * <template #header><strong>Numori CRDT</strong></template>\n * <UiSidebarItem icon=\"mdi:view-grid\" href=\"/\" active>Dashboard</UiSidebarItem>\n * <UiSidebarGroup label=\"Manage\">\n * <UiSidebarItem icon=\"mdi:sync\" href=\"/apps\">Apps</UiSidebarItem>\n * <UiSidebarItem icon=\"mdi:account-group\" href=\"/users\">Users</UiSidebarItem>\n * </UiSidebarGroup>\n * <template #footer>Signed in as ada</template>\n * </UiSidebar>\n *\n * @slot default — Navigation items and groups.\n * @slot header — Brand area at the top, the same height as the shell's top bar.\n * @slot footer — Pinned content at the bottom (account, version, etc.).\n */\nimport { useMergedClasses } from '../composables/useMergedClasses.js'\n\ndefineProps({\n /**\n * Accessible name of the navigation landmark.\n * @type {string}\n * @default 'Main'\n */\n label: { type: String, default: 'Main' },\n})\n\ndefineOptions({ inheritAttrs: false })\n\nconst { mergedClasses, restAttrs } = useMergedClasses('flex h-full min-h-0 w-full flex-col')\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2DA,MAAM,EAAE,eAAe,cAAc,iBAAiB,qCAAqC;;GA1DzF,OAAA,UAAA,GAAA,mBAeM,OAfN,WAeM;IAfA,cAAY,QAAA;IAAQ,OAAO,MAAA,aAAA;GAAuB,GAAA,MAAA,SAAA,CAAS,GAAA;IAEvDA,KAAAA,OAAO,UADf,UAAA,GAAA,mBAKM,OALN,YAKM,CADJ,WAAsB,KAAA,QAAA,QAAA,CAAA,CAAA,KAAA,mBAAA,IAAA,IAAA;IAGxB,mBAEM,OAFN,YAEM,CADJ,WAAQ,KAAA,QAAA,SAAA,CAAA,CAAA;IAGCA,KAAAA,OAAO,UAAlB,UAAA,GAAA,mBAEM,OAFN,YAEM,CADJ,WAAsB,KAAA,QAAA,QAAA,CAAA,CAAA,KAAA,mBAAA,IAAA,IAAA"}
@@ -0,0 +1,50 @@
1
+ import { createCommentVNode, createElementBlock, createElementVNode, openBlock, renderSlot, toDisplayString, unref, useId } from "vue";
2
+ //#region src/components/SidebarGroup.vue
3
+ var _hoisted_1 = ["aria-labelledby"];
4
+ var _hoisted_2 = ["id"];
5
+ var _hoisted_3 = { class: "space-y-0.5" };
6
+ var _sfc_main = {
7
+ __name: "SidebarGroup",
8
+ props: {
9
+ /**
10
+ * Heading shown above the items.
11
+ * @type {string}
12
+ * @default ''
13
+ */
14
+ label: {
15
+ type: String,
16
+ default: ""
17
+ } },
18
+ setup(__props) {
19
+ /**
20
+ * UiSidebarGroup — a labelled section of a `UiSidebar`.
21
+ *
22
+ * Groups related `UiSidebarItem`s under a small uppercase heading, which is
23
+ * also the group's accessible name.
24
+ *
25
+ * @example
26
+ * <UiSidebarGroup label="Manage">
27
+ * <UiSidebarItem icon="mdi:sync" href="/apps">Apps</UiSidebarItem>
28
+ * <UiSidebarItem icon="mdi:account-group" href="/users">Users</UiSidebarItem>
29
+ * </UiSidebarGroup>
30
+ *
31
+ * @slot default — The group's items.
32
+ */
33
+ const headingId = useId();
34
+ return (_ctx, _cache) => {
35
+ return openBlock(), createElementBlock("div", {
36
+ role: "group",
37
+ "aria-labelledby": __props.label ? unref(headingId) : void 0,
38
+ class: "pt-5 first:pt-0"
39
+ }, [__props.label ? (openBlock(), createElementBlock("p", {
40
+ key: 0,
41
+ id: unref(headingId),
42
+ class: "px-3 pb-1.5 text-xs font-semibold tracking-wide text-gray-400 uppercase dark:text-gray-500"
43
+ }, toDisplayString(__props.label), 9, _hoisted_2)) : createCommentVNode("", true), createElementVNode("div", _hoisted_3, [renderSlot(_ctx.$slots, "default")])], 8, _hoisted_1);
44
+ };
45
+ }
46
+ };
47
+ //#endregion
48
+ export { _sfc_main as default };
49
+
50
+ //# sourceMappingURL=SidebarGroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SidebarGroup.js","names":[],"sources":["../../src/components/SidebarGroup.vue"],"sourcesContent":["<template>\n <div role=\"group\" :aria-labelledby=\"label ? headingId : undefined\" class=\"pt-5 first:pt-0\">\n <p\n v-if=\"label\"\n :id=\"headingId\"\n class=\"px-3 pb-1.5 text-xs font-semibold tracking-wide text-gray-400 uppercase dark:text-gray-500\"\n >\n {{ label }}\n </p>\n <div class=\"space-y-0.5\">\n <slot />\n </div>\n </div>\n</template>\n\n<script setup>\n/**\n * UiSidebarGroup — a labelled section of a `UiSidebar`.\n *\n * Groups related `UiSidebarItem`s under a small uppercase heading, which is\n * also the group's accessible name.\n *\n * @example\n * <UiSidebarGroup label=\"Manage\">\n * <UiSidebarItem icon=\"mdi:sync\" href=\"/apps\">Apps</UiSidebarItem>\n * <UiSidebarItem icon=\"mdi:account-group\" href=\"/users\">Users</UiSidebarItem>\n * </UiSidebarGroup>\n *\n * @slot default — The group's items.\n */\nimport { useId } from 'vue'\n\ndefineProps({\n /**\n * Heading shown above the items.\n * @type {string}\n * @default ''\n */\n label: { type: String, default: '' },\n})\n\nconst headingId = useId()\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyCA,MAAM,YAAY,MAAM;;GAxCtB,OAAA,UAAA,GAAA,mBAWM,OAAA;IAXD,MAAK;IAAS,mBAAiB,QAAA,QAAQ,MAAA,SAAA,IAAY,KAAA;IAAW,OAAM;GAE/D,GAAA,CAAA,QAAA,SADR,UAAA,GAAA,mBAMI,KAAA;;IAJD,IAAI,MAAA,SAAA;IACL,OAAM;GAEH,GAAA,gBAAA,QAAA,KAAK,GAAA,GAAA,UAAA,KAAA,mBAAA,IAAA,IAAA,GAEV,mBAEM,OAFN,YAEM,CADJ,WAAQ,KAAA,QAAA,SAAA,CAAA,CAAA,CAAA,GAAA,GAAA,UAAA"}
@@ -0,0 +1,167 @@
1
+ import _sfc_main$1 from "../icons/Icon.js";
2
+ import { useMergedClasses } from "../composables/useMergedClasses.js";
3
+ import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, inject, mergeProps, normalizeClass, openBlock, renderSlot, resolveDynamicComponent, toDisplayString, unref, withCtx } from "vue";
4
+ //#region src/components/SidebarItem.vue
5
+ var _hoisted_1 = { class: "min-w-0 flex-1 truncate" };
6
+ var _sfc_main = /*@__PURE__*/ Object.assign({ inheritAttrs: false }, {
7
+ __name: "SidebarItem",
8
+ props: {
9
+ /**
10
+ * Element or component to render. Defaults to `RouterLink` when `to` is
11
+ * set, `a` when `href` is set, and `button` otherwise.
12
+ * @type {string}
13
+ * @default ''
14
+ */
15
+ tag: {
16
+ type: String,
17
+ default: ""
18
+ },
19
+ /**
20
+ * Router location, passed to the link component.
21
+ * @type {string | object}
22
+ * @default undefined
23
+ */
24
+ to: {
25
+ type: [String, Object],
26
+ default: void 0
27
+ },
28
+ /**
29
+ * Plain link target.
30
+ * @type {string}
31
+ * @default ''
32
+ */
33
+ href: {
34
+ type: String,
35
+ default: ""
36
+ },
37
+ /**
38
+ * MDI icon shown before the label.
39
+ * @type {string}
40
+ * @default ''
41
+ */
42
+ icon: {
43
+ type: String,
44
+ default: ""
45
+ },
46
+ /**
47
+ * Mark as the current page.
48
+ * @type {boolean}
49
+ * @default false
50
+ */
51
+ active: {
52
+ type: Boolean,
53
+ default: false
54
+ },
55
+ /**
56
+ * Count or short label shown at the end of the row. Empty hides it.
57
+ * @type {string | number}
58
+ * @default ''
59
+ */
60
+ badge: {
61
+ type: [String, Number],
62
+ default: ""
63
+ },
64
+ /**
65
+ * Dim the item and ignore clicks.
66
+ * @type {boolean}
67
+ * @default false
68
+ */
69
+ disabled: {
70
+ type: Boolean,
71
+ default: false
72
+ }
73
+ },
74
+ emits: ["click"],
75
+ setup(__props, { emit: __emit }) {
76
+ /**
77
+ * UiSidebarItem — one navigation entry in a `UiSidebar`.
78
+ *
79
+ * Router-agnostic. Pass `to` to render through a globally registered
80
+ * `RouterLink` (or set `tag="NuxtLink"`), `href` for a plain anchor, or neither
81
+ * for a `<button>` that only emits `click`. The current page is marked with
82
+ * `active`, which also sets `aria-current="page"` — the item does not inspect
83
+ * the route itself, so any router (or none) works.
84
+ *
85
+ * Choosing an item inside a `UiAppShell` closes the shell's mobile drawer.
86
+ *
87
+ * @example With vue-router
88
+ * <UiSidebarItem icon="mdi:sync" to="/apps" :active="route.path.startsWith('/apps')">
89
+ * Apps
90
+ * </UiSidebarItem>
91
+ *
92
+ * @example With a count badge
93
+ * <UiSidebarItem icon="mdi:account-group" href="/users" :badge="3">Users</UiSidebarItem>
94
+ *
95
+ * @emits {MouseEvent} click — The item was chosen (not emitted while disabled).
96
+ *
97
+ * @slot default — Label.
98
+ * @slot suffix — Trailing content, replacing the badge.
99
+ */
100
+ const props = __props;
101
+ const emit = __emit;
102
+ const shell = inject("numori-ui:app-shell", null);
103
+ const resolvedTag = computed(() => {
104
+ if (props.tag) return props.tag;
105
+ if (props.to !== void 0) return "RouterLink";
106
+ if (props.href) return "a";
107
+ return "button";
108
+ });
109
+ const linkAttrs = computed(() => {
110
+ if (resolvedTag.value === "button") return {
111
+ type: "button",
112
+ disabled: props.disabled
113
+ };
114
+ if (resolvedTag.value === "a") return { href: props.disabled ? void 0 : props.href };
115
+ return { to: props.to };
116
+ });
117
+ const hasBadge = computed(() => props.badge !== "" && props.badge !== null);
118
+ function onClick(event) {
119
+ if (props.disabled) {
120
+ event.preventDefault();
121
+ return;
122
+ }
123
+ emit("click", event);
124
+ shell?.close();
125
+ }
126
+ const internalClasses = computed(() => [
127
+ "group flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-sm font-medium transition-colors",
128
+ "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-500 dark:focus-visible:outline-primary-400",
129
+ props.active ? "bg-primary-50 text-primary-700 dark:bg-primary-400/10 dark:text-primary-200" : "text-gray-700 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-100",
130
+ props.disabled ? "pointer-events-none opacity-40" : "cursor-pointer"
131
+ ].join(" "));
132
+ const { mergedClasses, restAttrs } = useMergedClasses(() => internalClasses.value);
133
+ return (_ctx, _cache) => {
134
+ return openBlock(), createBlock(resolveDynamicComponent(resolvedTag.value), mergeProps({
135
+ ...linkAttrs.value,
136
+ ...unref(restAttrs)
137
+ }, {
138
+ class: unref(mergedClasses),
139
+ "aria-current": __props.active ? "page" : void 0,
140
+ "aria-disabled": __props.disabled ? "true" : void 0,
141
+ onClick
142
+ }), {
143
+ default: withCtx(() => [
144
+ __props.icon ? (openBlock(), createBlock(_sfc_main$1, {
145
+ key: 0,
146
+ name: __props.icon,
147
+ class: normalizeClass(["size-[18px] shrink-0", __props.active ? "text-primary-600 dark:text-primary-400" : "text-gray-400 group-hover:text-gray-600 dark:text-gray-500 dark:group-hover:text-gray-300"])
148
+ }, null, 8, ["name", "class"])) : createCommentVNode("", true),
149
+ createElementVNode("span", _hoisted_1, [renderSlot(_ctx.$slots, "default")]),
150
+ renderSlot(_ctx.$slots, "suffix", {}, () => [hasBadge.value ? (openBlock(), createElementBlock("span", {
151
+ key: 0,
152
+ class: normalizeClass(["ml-auto inline-flex min-w-5 items-center justify-center rounded-full px-1.5 text-xs font-semibold tabular-nums", __props.active ? "bg-primary-100 text-primary-700 dark:bg-primary-400/20 dark:text-primary-200" : "bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-300"])
153
+ }, toDisplayString(__props.badge), 3)) : createCommentVNode("", true)])
154
+ ]),
155
+ _: 3
156
+ }, 16, [
157
+ "class",
158
+ "aria-current",
159
+ "aria-disabled"
160
+ ]);
161
+ };
162
+ }
163
+ });
164
+ //#endregion
165
+ export { _sfc_main as default };
166
+
167
+ //# sourceMappingURL=SidebarItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SidebarItem.js","names":[],"sources":["../../src/components/SidebarItem.vue"],"sourcesContent":["<template>\n <component\n :is=\"resolvedTag\"\n v-bind=\"{ ...linkAttrs, ...restAttrs }\"\n :class=\"mergedClasses\"\n :aria-current=\"active ? 'page' : undefined\"\n :aria-disabled=\"disabled ? 'true' : undefined\"\n @click=\"onClick\"\n >\n <UiIcon\n v-if=\"icon\"\n :name=\"icon\"\n class=\"size-[18px] shrink-0\"\n :class=\"\n active\n ? 'text-primary-600 dark:text-primary-400'\n : 'text-gray-400 group-hover:text-gray-600 dark:text-gray-500 dark:group-hover:text-gray-300'\n \"\n />\n <span class=\"min-w-0 flex-1 truncate\"><slot /></span>\n <slot name=\"suffix\">\n <span\n v-if=\"hasBadge\"\n class=\"ml-auto inline-flex min-w-5 items-center justify-center rounded-full px-1.5 text-xs font-semibold tabular-nums\"\n :class=\"\n active\n ? 'bg-primary-100 text-primary-700 dark:bg-primary-400/20 dark:text-primary-200'\n : 'bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-300'\n \"\n >{{ badge }}</span\n >\n </slot>\n </component>\n</template>\n\n<script setup>\n/**\n * UiSidebarItem — one navigation entry in a `UiSidebar`.\n *\n * Router-agnostic. Pass `to` to render through a globally registered\n * `RouterLink` (or set `tag=\"NuxtLink\"`), `href` for a plain anchor, or neither\n * for a `<button>` that only emits `click`. The current page is marked with\n * `active`, which also sets `aria-current=\"page\"` — the item does not inspect\n * the route itself, so any router (or none) works.\n *\n * Choosing an item inside a `UiAppShell` closes the shell's mobile drawer.\n *\n * @example With vue-router\n * <UiSidebarItem icon=\"mdi:sync\" to=\"/apps\" :active=\"route.path.startsWith('/apps')\">\n * Apps\n * </UiSidebarItem>\n *\n * @example With a count badge\n * <UiSidebarItem icon=\"mdi:account-group\" href=\"/users\" :badge=\"3\">Users</UiSidebarItem>\n *\n * @emits {MouseEvent} click — The item was chosen (not emitted while disabled).\n *\n * @slot default — Label.\n * @slot suffix — Trailing content, replacing the badge.\n */\nimport { computed, inject } from 'vue'\nimport UiIcon from '../icons/Icon.vue'\nimport { useMergedClasses } from '../composables/useMergedClasses.js'\n\nconst props = defineProps({\n /**\n * Element or component to render. Defaults to `RouterLink` when `to` is\n * set, `a` when `href` is set, and `button` otherwise.\n * @type {string}\n * @default ''\n */\n tag: { type: String, default: '' },\n\n /**\n * Router location, passed to the link component.\n * @type {string | object}\n * @default undefined\n */\n to: { type: [String, Object], default: undefined },\n\n /**\n * Plain link target.\n * @type {string}\n * @default ''\n */\n href: { type: String, default: '' },\n\n /**\n * MDI icon shown before the label.\n * @type {string}\n * @default ''\n */\n icon: { type: String, default: '' },\n\n /**\n * Mark as the current page.\n * @type {boolean}\n * @default false\n */\n active: { type: Boolean, default: false },\n\n /**\n * Count or short label shown at the end of the row. Empty hides it.\n * @type {string | number}\n * @default ''\n */\n badge: { type: [String, Number], default: '' },\n\n /**\n * Dim the item and ignore clicks.\n * @type {boolean}\n * @default false\n */\n disabled: { type: Boolean, default: false },\n})\n\nconst emit = defineEmits(['click'])\n\ndefineOptions({ inheritAttrs: false })\n\nconst shell = inject('numori-ui:app-shell', null)\n\nconst resolvedTag = computed(() => {\n if (props.tag) return props.tag\n if (props.to !== undefined) return 'RouterLink'\n if (props.href) return 'a'\n return 'button'\n})\n\nconst linkAttrs = computed(() => {\n if (resolvedTag.value === 'button') return { type: 'button', disabled: props.disabled }\n if (resolvedTag.value === 'a') return { href: props.disabled ? undefined : props.href }\n return { to: props.to }\n})\n\nconst hasBadge = computed(() => props.badge !== '' && props.badge !== null)\n\nfunction onClick(event) {\n if (props.disabled) {\n event.preventDefault()\n return\n }\n emit('click', event)\n shell?.close()\n}\n\nconst internalClasses = computed(() =>\n [\n 'group flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-sm font-medium transition-colors',\n 'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-500 dark:focus-visible:outline-primary-400',\n props.active\n ? 'bg-primary-50 text-primary-700 dark:bg-primary-400/10 dark:text-primary-200'\n : 'text-gray-700 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-100',\n props.disabled ? 'pointer-events-none opacity-40' : 'cursor-pointer',\n ].join(' '),\n)\n\nconst { mergedClasses, restAttrs } = useMergedClasses(() => internalClasses.value)\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgEA,MAAM,QAAQ;EAoDd,MAAM,OAAO;EAIb,MAAM,QAAQ,OAAO,uBAAuB,IAAI;EAEhD,MAAM,cAAc,eAAe;GACjC,IAAI,MAAM,KAAK,OAAO,MAAM;GAC5B,IAAI,MAAM,OAAO,KAAA,GAAW,OAAO;GACnC,IAAI,MAAM,MAAM,OAAO;GACvB,OAAO;EACT,CAAC;EAED,MAAM,YAAY,eAAe;GAC/B,IAAI,YAAY,UAAU,UAAU,OAAO;IAAE,MAAM;IAAU,UAAU,MAAM;GAAS;GACtF,IAAI,YAAY,UAAU,KAAK,OAAO,EAAE,MAAM,MAAM,WAAW,KAAA,IAAY,MAAM,KAAK;GACtF,OAAO,EAAE,IAAI,MAAM,GAAG;EACxB,CAAC;EAED,MAAM,WAAW,eAAe,MAAM,UAAU,MAAM,MAAM,UAAU,IAAI;EAE1E,SAAS,QAAQ,OAAO;GACtB,IAAI,MAAM,UAAU;IAClB,MAAM,eAAe;IACrB;GACF;GACA,KAAK,SAAS,KAAK;GACnB,OAAO,MAAM;EACf;EAEA,MAAM,kBAAkB,eACtB;GACE;GACA;GACA,MAAM,SACF,gFACA;GACJ,MAAM,WAAW,mCAAmC;EACtD,CAAC,CAAC,KAAK,GAAG,CACZ;EAEA,MAAM,EAAE,eAAe,cAAc,uBAAuB,gBAAgB,KAAK;;GA5J/E,OAAA,UAAA,GAAA,YA+BY,wBA9BL,YAAA,KAAW,GADlB,WA+BY;IAAA,GA7BG,UAAA;IAAS,GAAK,MAAA,SAAA;GAAS,GAAA;IACnC,OAAO,MAAA,aAAA;IACP,gBAAc,QAAA,SAAM,SAAY,KAAA;IAChC,iBAAe,QAAA,WAAQ,SAAY,KAAA;IAC5B;;IAER,SAAA,cASE;KARM,QAAA,QADR,UAAA,GAAA,YASE,aAAA;;MAPC,MAAM,QAAA;MACP,OAAK,eAAA,CAAC,wBACW,QAAA,SAAA,2CAAA,2FAAA,CAAA;;KAMnB,mBAAqD,QAArD,YAAqD,CAAf,WAAQ,KAAA,QAAA,SAAA,CAAA,CAAA;KAC9C,WAWO,KAAA,QAAA,UAAA,CAAA,SAAA,CATG,SAAA,SADR,UAAA,GAAA,mBASC,QAAA;;MAPC,OAAK,eAAA,CAAC,kHACa,QAAA,SAAA,iFAAA,+DAAA,CAAA;KAKf,GAAA,gBAAA,QAAA,KAAK,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,CAAA"}
@@ -0,0 +1,122 @@
1
+ import { Fragment, computed, createCommentVNode, createElementBlock, mergeProps, normalizeClass, openBlock, renderList, toDisplayString } from "vue";
2
+ //#region src/components/Skeleton.vue
3
+ var _hoisted_1 = {
4
+ key: 0,
5
+ class: "sr-only"
6
+ };
7
+ var _hoisted_2 = {
8
+ key: 0,
9
+ class: "sr-only"
10
+ };
11
+ var _sfc_main = {
12
+ __name: "Skeleton",
13
+ props: {
14
+ /**
15
+ * Shape of the placeholder.
16
+ * @type {string}
17
+ * @default 'text'
18
+ * @values 'text' | 'rect' | 'circle'
19
+ */
20
+ variant: {
21
+ type: String,
22
+ default: "text"
23
+ },
24
+ /**
25
+ * Number of lines for `variant="text"`.
26
+ * @type {number}
27
+ * @default 1
28
+ */
29
+ lines: {
30
+ type: Number,
31
+ default: 1
32
+ },
33
+ /**
34
+ * Spacing between text lines.
35
+ * @type {string}
36
+ * @default 'md'
37
+ * @values 'sm' | 'md' | 'lg'
38
+ */
39
+ gap: {
40
+ type: String,
41
+ default: "md"
42
+ },
43
+ /**
44
+ * Pulse while waiting. Always off under `prefers-reduced-motion`.
45
+ * @type {boolean}
46
+ * @default true
47
+ */
48
+ animated: {
49
+ type: Boolean,
50
+ default: true
51
+ },
52
+ /**
53
+ * Announce the placeholder as a loading status with this text. Empty keeps
54
+ * it hidden from assistive technology.
55
+ * @type {string}
56
+ * @default ''
57
+ */
58
+ label: {
59
+ type: String,
60
+ default: ""
61
+ }
62
+ },
63
+ setup(__props) {
64
+ /**
65
+ * UiSkeleton — a placeholder shaped like the content that is about to load.
66
+ *
67
+ * Three shapes: `text` (one or more lines, the last one shorter), `rect` and
68
+ * `circle`. Size the shape with ordinary classes — `class="h-24 w-full"`, or
69
+ * `class="size-9"` for an avatar-sized circle.
70
+ *
71
+ * The shimmer is a gentle pulse and stops for anyone who prefers reduced
72
+ * motion. Skeletons are decorative (`aria-hidden`) by default; give one a
73
+ * `label` and it becomes a polite status message instead, so a screen reader
74
+ * hears "Loading messages" once rather than nothing at all. Label one
75
+ * skeleton per region, not every line.
76
+ *
77
+ * @example A message row while it loads
78
+ * <div class="flex items-center gap-3">
79
+ * <UiSkeleton variant="circle" class="size-9" />
80
+ * <UiSkeleton :lines="2" class="flex-1" />
81
+ * </div>
82
+ *
83
+ * @example Announced to screen readers
84
+ * <UiSkeleton variant="rect" class="h-40" label="Loading message" />
85
+ */
86
+ const props = __props;
87
+ const baseClass = computed(() => ["block bg-gray-200 dark:bg-gray-800", props.animated ? "animate-pulse motion-reduce:animate-none" : ""].join(" "));
88
+ const shapeClass = computed(() => props.variant === "circle" ? "rounded-full" : "rounded-lg");
89
+ const gapClass = computed(() => ({
90
+ sm: "gap-1.5",
91
+ md: "gap-2",
92
+ lg: "gap-3"
93
+ })[props.gap] ?? "gap-2");
94
+ const a11yAttrs = computed(() => props.label ? {
95
+ role: "status",
96
+ "aria-live": "polite"
97
+ } : { "aria-hidden": "true" });
98
+ return (_ctx, _cache) => {
99
+ return __props.variant === "text" ? (openBlock(), createElementBlock("div", mergeProps({
100
+ key: 0,
101
+ class: ["flex flex-col", gapClass.value]
102
+ }, a11yAttrs.value), [__props.label ? (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(__props.label), 1)) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(__props.lines, (line) => {
103
+ return openBlock(), createElementBlock("div", {
104
+ key: line,
105
+ class: normalizeClass([
106
+ baseClass.value,
107
+ "h-3 rounded-md",
108
+ line === __props.lines && __props.lines > 1 ? "w-3/5" : "w-full"
109
+ ]),
110
+ "aria-hidden": "true"
111
+ }, null, 2);
112
+ }), 128))], 16)) : (openBlock(), createElementBlock("div", mergeProps({
113
+ key: 1,
114
+ class: [baseClass.value, shapeClass.value]
115
+ }, a11yAttrs.value), [__props.label ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(__props.label), 1)) : createCommentVNode("", true)], 16));
116
+ };
117
+ }
118
+ };
119
+ //#endregion
120
+ export { _sfc_main as default };
121
+
122
+ //# sourceMappingURL=Skeleton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Skeleton.js","names":[],"sources":["../../src/components/Skeleton.vue"],"sourcesContent":["<template>\n <div v-if=\"variant === 'text'\" :class=\"['flex flex-col', gapClass]\" v-bind=\"a11yAttrs\">\n <span v-if=\"label\" class=\"sr-only\">{{ label }}</span>\n <div\n v-for=\"line in lines\"\n :key=\"line\"\n :class=\"[baseClass, 'h-3 rounded-md', line === lines && lines > 1 ? 'w-3/5' : 'w-full']\"\n aria-hidden=\"true\"\n />\n </div>\n <div v-else :class=\"[baseClass, shapeClass]\" v-bind=\"a11yAttrs\">\n <span v-if=\"label\" class=\"sr-only\">{{ label }}</span>\n </div>\n</template>\n\n<script setup>\n/**\n * UiSkeleton — a placeholder shaped like the content that is about to load.\n *\n * Three shapes: `text` (one or more lines, the last one shorter), `rect` and\n * `circle`. Size the shape with ordinary classes — `class=\"h-24 w-full\"`, or\n * `class=\"size-9\"` for an avatar-sized circle.\n *\n * The shimmer is a gentle pulse and stops for anyone who prefers reduced\n * motion. Skeletons are decorative (`aria-hidden`) by default; give one a\n * `label` and it becomes a polite status message instead, so a screen reader\n * hears \"Loading messages\" once rather than nothing at all. Label one\n * skeleton per region, not every line.\n *\n * @example A message row while it loads\n * <div class=\"flex items-center gap-3\">\n * <UiSkeleton variant=\"circle\" class=\"size-9\" />\n * <UiSkeleton :lines=\"2\" class=\"flex-1\" />\n * </div>\n *\n * @example Announced to screen readers\n * <UiSkeleton variant=\"rect\" class=\"h-40\" label=\"Loading message\" />\n */\nimport { computed } from 'vue'\n\nconst props = defineProps({\n /**\n * Shape of the placeholder.\n * @type {string}\n * @default 'text'\n * @values 'text' | 'rect' | 'circle'\n */\n variant: { type: String, default: 'text' },\n /**\n * Number of lines for `variant=\"text\"`.\n * @type {number}\n * @default 1\n */\n lines: { type: Number, default: 1 },\n /**\n * Spacing between text lines.\n * @type {string}\n * @default 'md'\n * @values 'sm' | 'md' | 'lg'\n */\n gap: { type: String, default: 'md' },\n /**\n * Pulse while waiting. Always off under `prefers-reduced-motion`.\n * @type {boolean}\n * @default true\n */\n animated: { type: Boolean, default: true },\n /**\n * Announce the placeholder as a loading status with this text. Empty keeps\n * it hidden from assistive technology.\n * @type {string}\n * @default ''\n */\n label: { type: String, default: '' },\n})\n\nconst baseClass = computed(() =>\n [\n 'block bg-gray-200 dark:bg-gray-800',\n props.animated ? 'animate-pulse motion-reduce:animate-none' : '',\n ].join(' '),\n)\n\nconst shapeClass = computed(() => (props.variant === 'circle' ? 'rounded-full' : 'rounded-lg'))\n\nconst gapClass = computed(() => ({ sm: 'gap-1.5', md: 'gap-2', lg: 'gap-3' })[props.gap] ?? 'gap-2')\n\nconst a11yAttrs = computed(() =>\n props.label ? { role: 'status', 'aria-live': 'polite' } : { 'aria-hidden': 'true' },\n)\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwCA,MAAM,QAAQ;EAoCd,MAAM,YAAY,eAChB,CACE,sCACA,MAAM,WAAW,6CAA6C,EAChE,CAAC,CAAC,KAAK,GAAG,CACZ;EAEA,MAAM,aAAa,eAAgB,MAAM,YAAY,WAAW,iBAAiB,YAAa;EAE9F,MAAM,WAAW,gBAAgB;GAAE,IAAI;GAAW,IAAI;GAAS,IAAI;EAAQ,EAAA,CAAG,MAAM,QAAQ,OAAO;EAEnG,MAAM,YAAY,eAChB,MAAM,QAAQ;GAAE,MAAM;GAAU,aAAa;EAAS,IAAI,EAAE,eAAe,OAAO,CACpF;;GAxFa,OAAA,QAAA,YAAO,UAAlB,UAAA,GAAA,mBAQM,OARN,WAQM;;IAR0B,OAAK,CAAA,iBAAoB,SAAA,KAAQ;GAAW,GAAA,UAAA,KAAS,GAAA,CACvE,QAAA,SAAZ,UAAA,GAAA,mBAAqD,QAArD,YAAqD,gBAAf,QAAA,KAAK,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,IAC3C,UAAA,IAAA,GAAA,mBAKE,UAAA,MAAA,WAJe,QAAA,QAAR,SAAI;IADb,OAAA,UAAA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