numori-ui 0.2.0 → 0.4.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 (87) hide show
  1. package/CHANGELOG.md +122 -0
  2. package/README.md +26 -21
  3. package/dist/components/Banner.js +176 -0
  4. package/dist/components/Banner.js.map +1 -0
  5. package/dist/components/Button.js +10 -19
  6. package/dist/components/Button.js.map +1 -1
  7. package/dist/components/Card.js +15 -9
  8. package/dist/components/Card.js.map +1 -1
  9. package/dist/components/Checkbox.js +2 -7
  10. package/dist/components/Checkbox.js.map +1 -1
  11. package/dist/components/CodeBlock.js +101 -0
  12. package/dist/components/CodeBlock.js.map +1 -0
  13. package/dist/components/Dropdown.js +10 -3
  14. package/dist/components/Dropdown.js.map +1 -1
  15. package/dist/components/DropdownSubmenu.js +5 -3
  16. package/dist/components/DropdownSubmenu.js.map +1 -1
  17. package/dist/components/FileInput.js +12 -4
  18. package/dist/components/FileInput.js.map +1 -1
  19. package/dist/components/IconTile.js +5 -9
  20. package/dist/components/IconTile.js.map +1 -1
  21. package/dist/components/Input.js +6 -6
  22. package/dist/components/Input.js.map +1 -1
  23. package/dist/components/ListMenuItem.js +38 -31
  24. package/dist/components/ListMenuItem.js.map +1 -1
  25. package/dist/components/Numpad.js +4 -4
  26. package/dist/components/Numpad.js.map +1 -1
  27. package/dist/components/Popup.js +9 -3
  28. package/dist/components/Popup.js.map +1 -1
  29. package/dist/components/Radio.js +2 -7
  30. package/dist/components/Radio.js.map +1 -1
  31. package/dist/components/Segmented.js +100 -26
  32. package/dist/components/Segmented.js.map +1 -1
  33. package/dist/components/Select.js +6 -4
  34. package/dist/components/Select.js.map +1 -1
  35. package/dist/components/Spinner.js +87 -0
  36. package/dist/components/Spinner.js.map +1 -0
  37. package/dist/components/Table.js +174 -0
  38. package/dist/components/Table.js.map +1 -0
  39. package/dist/components/ThemeToggle.js +85 -0
  40. package/dist/components/ThemeToggle.js.map +1 -0
  41. package/dist/components/Toast.js +107 -0
  42. package/dist/components/Toast.js.map +1 -0
  43. package/dist/components/index.js +67 -57
  44. package/dist/components/index.js.map +1 -1
  45. package/dist/composables/useMergedClasses.js +52 -0
  46. package/dist/composables/useMergedClasses.js.map +1 -0
  47. package/dist/icons/mdi.js +10 -0
  48. package/dist/icons/mdi.js.map +1 -1
  49. package/dist/index.d.ts +6 -1
  50. package/dist/index.js +35 -30
  51. package/dist/index.js.map +1 -1
  52. package/dist/internal/controlSizes.js +21 -0
  53. package/dist/internal/controlSizes.js.map +1 -0
  54. package/dist/internal/menu.js +20 -0
  55. package/dist/internal/menu.js.map +1 -0
  56. package/dist/manifest.js +6 -1
  57. package/dist/manifest.js.map +1 -1
  58. package/package.json +2 -1
  59. package/src/components/Banner.vue +160 -0
  60. package/src/components/Button.vue +12 -19
  61. package/src/components/Card.vue +11 -12
  62. package/src/components/Checkbox.vue +2 -10
  63. package/src/components/CodeBlock.vue +99 -0
  64. package/src/components/Dropdown.vue +14 -2
  65. package/src/components/DropdownSubmenu.vue +4 -2
  66. package/src/components/FileInput.vue +19 -4
  67. package/src/components/IconTile.vue +4 -9
  68. package/src/components/Input.vue +6 -6
  69. package/src/components/ListMenuItem.vue +21 -5
  70. package/src/components/Numpad.vue +7 -4
  71. package/src/components/Popup.vue +6 -2
  72. package/src/components/Radio.vue +2 -10
  73. package/src/components/Segmented.vue +108 -38
  74. package/src/components/Select.vue +11 -2
  75. package/src/components/Spinner.vue +70 -0
  76. package/src/components/Table.vue +193 -0
  77. package/src/components/ThemeToggle.vue +81 -0
  78. package/src/components/Toast.vue +106 -0
  79. package/src/components/index.js +18 -3
  80. package/src/composables/useMergedClasses.js +49 -0
  81. package/src/icons/mdi.js +10 -0
  82. package/src/internal/controlSizes.js +17 -0
  83. package/src/internal/menu.js +16 -0
  84. package/src/manifest.js +6 -1
  85. package/dist/components/ButtonsGroup.js +0 -153
  86. package/dist/components/ButtonsGroup.js.map +0 -1
  87. package/src/components/ButtonsGroup.vue +0 -140
@@ -1 +1 @@
1
- {"version":3,"file":"Input.js","names":["$slots"],"sources":["../../src/components/Input.vue"],"sourcesContent":["<template>\n <div class=\"w-full\">\n <div class=\"relative flex\">\n <!-- Number stepper: minus button on left (both-sides layout) -->\n <button\n v-if=\"isNumber && stepperLayout === 'both-sides'\"\n type=\"button\"\n tabindex=\"-1\"\n class=\"flex items-center justify-center w-9 rounded-l-lg border border-r-0 border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none\"\n :class=\"{ 'opacity-50 pointer-events-none': disabled }\"\n aria-label=\"Decrease value\"\n @click=\"stepDown\"\n >\n <UiIcon name=\"mdi:minus\" class=\"w-4 h-4\" />\n </button>\n\n <!-- Number stepper: stacked up/down buttons on left -->\n <div\n v-if=\"isNumber && stepperLayout === 'stacked-left'\"\n class=\"flex flex-col w-6 border border-r-0 border-gray-300 dark:border-gray-600 rounded-l-lg overflow-hidden\"\n :class=\"{ 'opacity-50 pointer-events-none': disabled }\"\n >\n <button\n type=\"button\"\n tabindex=\"-1\"\n class=\"grid place-items-center w-4 flex-1 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none border-b border-gray-300 dark:border-gray-600\"\n aria-label=\"Increase value\"\n @click=\"stepUp\"\n >\n <UiIcon name=\"mdi:chevron-up\" class=\"block w-3 h-3\" />\n </button>\n <button\n type=\"button\"\n tabindex=\"-1\"\n class=\"grid place-items-center w-4 flex-1 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none\"\n aria-label=\"Decrease value\"\n @click=\"stepDown\"\n >\n <UiIcon name=\"mdi:chevron-down\" class=\"block w-3 h-3\" />\n </button>\n </div>\n\n <!-- Textarea mode: multi-line text input with custom scrollbar styling -->\n <textarea\n v-if=\"isTextarea\"\n ref=\"inputRef\"\n :value=\"modelValue\"\n :placeholder=\"placeholder\"\n :required=\"required\"\n :disabled=\"disabled\"\n :readonly=\"readonly\"\n :rows=\"rows\"\n :maxlength=\"maxlength\"\n class=\"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-400 focus:ring-2 focus:ring-primary-500 focus:border-primary-500 outline-none text-sm transition-colors [scrollbar-width:thin] [scrollbar-color:var(--color-gray-300)_transparent] dark:[scrollbar-color:var(--color-gray-600)_transparent] [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-thumb]:bg-gray-600 hover:[&::-webkit-scrollbar-thumb]:bg-gray-400 dark:hover:[&::-webkit-scrollbar-thumb]:bg-gray-500\"\n :class=\"resizeClass\"\n :style=\"textareaStyle\"\n @input=\"onInput\"\n @blur=\"onBlur\"\n />\n\n <!-- The actual input element (text, number, password, email, phone) -->\n <!-- Left icon/image slot -->\n <span\n v-if=\"!isTextarea && ($slots.left || iconLeft)\"\n class=\"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-gray-400 dark:text-gray-500\"\n >\n <slot name=\"left\">\n <UiIcon v-if=\"iconLeft\" :name=\"iconLeft\" class=\"w-4 h-4\" />\n </slot>\n </span>\n\n <input\n v-if=\"!isTextarea\"\n ref=\"inputRef\"\n :type=\"computedType\"\n :value=\"modelValue\"\n :placeholder=\"placeholder\"\n :required=\"required\"\n :disabled=\"disabled\"\n :readonly=\"readonly\"\n :autocomplete=\"autocomplete\"\n :minlength=\"minlength\"\n :maxlength=\"maxlength\"\n :inputmode=\"computedInputMode\"\n :min=\"min\"\n :max=\"max\"\n :step=\"step\"\n :pattern=\"pattern\"\n class=\"w-full py-2 border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-400 focus:ring-2 focus:ring-primary-500 focus:border-primary-500 outline-none text-sm transition-colors\"\n :class=\"inputClasses\"\n @input=\"onInput\"\n @blur=\"onBlur\"\n @keydown=\"onKeydown\"\n />\n\n <!-- Right icon/image slot (hidden when clear button or password toggle is shown) -->\n <span\n v-if=\"\n !isTextarea &&\n ($slots.right || iconRight) &&\n !(clearable && modelValue) &&\n !(isPassword && showToggle)\n \"\n class=\"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none text-gray-400 dark:text-gray-500\"\n >\n <slot name=\"right\">\n <UiIcon v-if=\"iconRight\" :name=\"iconRight\" class=\"w-4 h-4\" />\n </slot>\n </span>\n\n <!-- Clear button -->\n <button\n v-if=\"clearable && modelValue\"\n type=\"button\"\n tabindex=\"-1\"\n class=\"absolute inset-y-0 right-0 flex items-center pr-3 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors\"\n aria-label=\"Clear\"\n @mousedown.prevent\n @click=\"emit('update:modelValue', '')\"\n >\n <UiIcon name=\"mdi:close-circle\" class=\"w-4 h-4\" />\n </button>\n\n <!-- Password visibility toggle button -->\n <button\n v-if=\"isPassword && showToggle\"\n type=\"button\"\n tabindex=\"-1\"\n class=\"absolute inset-y-0 right-0 flex items-center pr-3 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors\"\n :aria-label=\"passwordVisible ? 'Hide password' : 'Show password'\"\n @mousedown.prevent\n @click=\"passwordVisible = !passwordVisible\"\n >\n <UiIcon\n :name=\"passwordVisible ? 'mdi:eye-off-outline' : 'mdi:eye-outline'\"\n class=\"w-4 h-4\"\n />\n </button>\n\n <!-- Number stepper: stacked up/down buttons on right -->\n <div\n v-if=\"isNumber && stepperLayout === 'stacked-right'\"\n class=\"flex flex-col w-6 border border-l-0 border-gray-300 dark:border-gray-600 rounded-r-lg overflow-hidden\"\n :class=\"{ 'opacity-50 pointer-events-none': disabled }\"\n >\n <button\n type=\"button\"\n tabindex=\"-1\"\n class=\"grid place-items-center w-4 flex-1 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none border-b border-gray-300 dark:border-gray-600\"\n aria-label=\"Increase value\"\n @click=\"stepUp\"\n >\n <UiIcon name=\"mdi:chevron-up\" class=\"block w-3 h-3\" />\n </button>\n <button\n type=\"button\"\n tabindex=\"-1\"\n class=\"grid place-items-center w-4 flex-1 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none\"\n aria-label=\"Decrease value\"\n @click=\"stepDown\"\n >\n <UiIcon name=\"mdi:chevron-down\" class=\"block w-3 h-3\" />\n </button>\n </div>\n\n <!-- Number stepper: plus button on right (both-sides layout) -->\n <button\n v-if=\"isNumber && stepperLayout === 'both-sides'\"\n type=\"button\"\n tabindex=\"-1\"\n class=\"flex items-center justify-center w-9 rounded-r-lg border border-l-0 border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none\"\n :class=\"{ 'opacity-50 pointer-events-none': disabled }\"\n aria-label=\"Increase value\"\n @click=\"stepUp\"\n >\n <UiIcon name=\"mdi:plus\" class=\"w-4 h-4\" />\n </button>\n </div>\n\n <!-- Validation error message (shown after first blur) -->\n <p v-if=\"showError && validationError\" class=\"text-xs text-red-600 dark:text-red-400 mt-1\">\n {{ validationError }}\n </p>\n </div>\n</template>\n\n<script setup>\n/**\n * UiInput — Multi-purpose input component supporting text, number, password, email,\n * phone, and textarea modes in a single unified interface.\n *\n * Features:\n * - Number mode with configurable stepper layouts (both-sides, stacked-left, stacked-right, none)\n * - Password mode with show/hide toggle\n * - Textarea mode with configurable resize, min/max dimensions\n * - Built-in validation for email, phone, and number patterns\n * - Custom regex validation with configurable error messages\n * - Exposes `focus()` method and `el` ref for parent control\n *\n * @example Basic text input\n * <UiInput v-model=\"name\" placeholder=\"Enter your name\" />\n *\n * @example Number input with min/max\n * <UiInput v-model=\"quantity\" type=\"number\" :min=\"0\" :max=\"100\" :step=\"1\" />\n *\n * @example Password with toggle\n * <UiInput v-model=\"password\" type=\"password\" />\n *\n * @example Textarea\n * <UiInput v-model=\"bio\" type=\"textarea\" :rows=\"5\" resize=\"vertical\" />\n *\n * @example Email with validation\n * <UiInput v-model=\"email\" type=\"email\" :validate=\"true\" />\n *\n * @emits {string | number} update:modelValue — Emitted when the input value changes (v-model)\n * @emits {{ valid: boolean, error: string | null }} validation — Emitted when the validation state changes\n */\nimport { ref, computed, watch, useSlots } from 'vue'\nimport UiIcon from '../icons/Icon.vue'\nconst props = defineProps({\n /**\n * Bound value (v-model).\n * @type {string | number}\n * @default ''\n */\n modelValue: { type: [String, Number], default: '' },\n\n /**\n * Input type determining the mode and behavior.\n * @type {string}\n * @default 'text'\n * @values 'text' | 'number' | 'password' | 'email' | 'phone' | 'textarea'\n */\n type: { type: String, default: 'text' },\n\n /**\n * Placeholder text shown when the input is empty.\n * @type {string}\n * @default ''\n */\n placeholder: { type: String, default: '' },\n\n /**\n * Whether the field is required for form validation.\n * @type {boolean}\n * @default false\n */\n required: { type: Boolean, default: false },\n\n /**\n * Disabled state — dims the input and prevents interaction.\n * @type {boolean}\n * @default false\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Read-only state — allows focus/selection but prevents editing.\n * @type {boolean}\n * @default false\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * HTML autocomplete attribute hint for the browser.\n * @type {string}\n * @default undefined\n */\n autocomplete: { type: String, default: undefined },\n\n /**\n * Minimum character length for text validation.\n * @type {number}\n * @default undefined\n */\n minlength: { type: Number, default: undefined },\n\n /**\n * Maximum character length for text validation.\n * @type {number}\n * @default undefined\n */\n maxlength: { type: Number, default: undefined },\n\n // ── Textarea-specific props ──\n\n /**\n * Number of visible text rows (textarea mode only).\n * @type {number}\n * @default 3\n */\n rows: { type: Number, default: 3 },\n\n /**\n * Resize behavior for textarea mode.\n * @type {string}\n * @default 'none'\n * @values 'none' | 'vertical' | 'horizontal' | 'both'\n */\n resize: { type: String, default: 'none' },\n\n /**\n * Minimum height CSS value for textarea (e.g. '80px', '5rem').\n * @type {string}\n * @default undefined\n */\n minHeight: { type: String, default: undefined },\n\n /**\n * Maximum height CSS value for textarea (e.g. '300px', '20rem').\n * @type {string}\n * @default undefined\n */\n maxHeight: { type: String, default: undefined },\n\n /**\n * Minimum width CSS value for textarea (e.g. '200px').\n * @type {string}\n * @default undefined\n */\n minWidth: { type: String, default: undefined },\n\n /**\n * Maximum width CSS value for textarea (e.g. '600px').\n * @type {string}\n * @default undefined\n */\n maxWidth: { type: String, default: undefined },\n\n /**\n * HTML pattern attribute for native form validation.\n * @type {string}\n * @default undefined\n */\n pattern: { type: String, default: undefined },\n\n // ── Password-specific props ──\n\n /**\n * Show the password visibility toggle button (password mode only).\n * @type {boolean}\n * @default true\n */\n showToggle: { type: Boolean, default: true },\n\n // ── Number-specific props ──\n\n /**\n * Minimum allowed numeric value.\n * @type {number}\n * @default undefined\n */\n min: { type: Number, default: undefined },\n\n /**\n * Maximum allowed numeric value.\n * @type {number}\n * @default undefined\n */\n max: { type: Number, default: undefined },\n\n /**\n * Step increment for number stepper buttons.\n * @type {number}\n * @default 1\n */\n step: { type: Number, default: 1 },\n\n /**\n * Layout of the +/- stepper buttons for number inputs.\n * @type {string}\n * @default 'both-sides'\n * @values 'stacked-left' | 'stacked-right' | 'both-sides' | 'none'\n */\n stepperLayout: { type: String, default: 'both-sides' },\n\n // ── Validation props ──\n\n /**\n * Show a clear button when the input has a value.\n * @type {boolean}\n * @default false\n */\n clearable: { type: Boolean, default: false },\n\n /**\n * Icon name to display on the left side of the input.\n * @type {string}\n * @default undefined\n */\n iconLeft: { type: String, default: undefined },\n\n /**\n * Icon name to display on the right side of the input.\n * @type {string}\n * @default undefined\n */\n iconRight: { type: String, default: undefined },\n\n /**\n * Enable built-in validation feedback shown below the input on blur.\n * @type {boolean}\n * @default true\n */\n validate: { type: Boolean, default: true },\n\n /**\n * Custom regex pattern string — overrides built-in type-based patterns.\n * @type {string}\n * @default undefined\n */\n validationPattern: { type: String, default: undefined },\n\n /**\n * Custom error message shown when validation fails.\n * @type {string}\n * @default undefined\n */\n validationMessage: { type: String, default: undefined },\n})\n\nconst emit = defineEmits(['update:modelValue', 'validation'])\n\nconst inputRef = ref(null)\nconst passwordVisible = ref(false)\nconst touched = ref(false)\n\n// --- Computed helpers ---\n\n// Detect input mode from the type prop\nconst isPassword = computed(() => props.type === 'password')\nconst isNumber = computed(() => props.type === 'number')\nconst isTextarea = computed(() => props.type === 'textarea')\n\n// Map resize prop to Tailwind resize utility class\nconst resizeClass = computed(() => {\n const map = { none: 'resize-none', vertical: 'resize-y', horizontal: 'resize-x', both: 'resize' }\n return map[props.resize] || 'resize-none'\n})\n\nconst textareaStyle = computed(() => {\n const s = {}\n if (props.minHeight) s.minHeight = props.minHeight\n if (props.maxHeight) s.maxHeight = props.maxHeight\n if (props.minWidth) s.minWidth = props.minWidth\n if (props.maxWidth) s.maxWidth = props.maxWidth\n return s\n})\n\n// For number type, render as text input so we can filter keystrokes ourselves\nconst computedType = computed(() => {\n if (isPassword.value) return passwordVisible.value ? 'text' : 'password'\n if (isNumber.value) return 'text' // we handle number filtering ourselves\n if (props.type === 'phone') return 'tel'\n return props.type\n})\n\n// Set appropriate mobile keyboard via inputmode attribute\nconst computedInputMode = computed(() => {\n if (isNumber.value) return 'decimal'\n if (props.type === 'phone') return 'tel'\n if (props.type === 'email') return 'email'\n return undefined\n})\n\nconst hasStepper = computed(() => isNumber.value && props.stepperLayout !== 'none')\n\nconst slots = useSlots()\n\nconst hasLeftIcon = computed(() => !!props.iconLeft || !!slots.left)\nconst hasRightIcon = computed(() => !!props.iconRight || !!slots.right)\n\nconst inputClasses = computed(() => {\n const classes = []\n\n // Horizontal padding — tighter when steppers are present\n if (hasStepper.value) {\n classes.push('px-1.5')\n } else {\n // Adjust padding for icons/slots\n classes.push(hasLeftIcon.value ? 'pl-9' : 'pl-3')\n classes.push(hasRightIcon.value ? 'pr-9' : 'pr-3')\n }\n\n // Rounding based on stepper layout\n if (hasStepper.value) {\n if (props.stepperLayout === 'both-sides') classes.push('rounded-none')\n else if (props.stepperLayout === 'stacked-left') classes.push('rounded-l-none', 'rounded-r-lg')\n else if (props.stepperLayout === 'stacked-right') classes.push('rounded-r-none', 'rounded-l-lg')\n } else {\n classes.push('rounded-lg')\n }\n\n // Extra right padding for password toggle\n if (isPassword.value && props.showToggle) classes.push('pr-10')\n\n // Extra right padding for clear button\n if (props.clearable) classes.push('pr-8')\n\n // Number text alignment\n if (isNumber.value && hasStepper.value) classes.push('text-center')\n\n return classes\n})\n\n// --- Validation ---\n\n// Built-in regex patterns for common input types\nconst PATTERNS = {\n email: /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/,\n phone: /^\\+?[\\d\\s\\-().]{7,}$/,\n number: /^-?\\d*\\.?\\d+$/,\n}\n\nconst MESSAGES = {\n email: 'Please enter a valid email address',\n phone: 'Please enter a valid phone number',\n number: 'Please enter a valid number',\n}\n\nconst validationError = computed(() => {\n const val = String(props.modelValue ?? '')\n if (!val) return null\n\n // Custom pattern takes priority\n if (props.validationPattern) {\n const re = new RegExp(props.validationPattern)\n if (!re.test(val)) return props.validationMessage || 'Invalid format'\n }\n\n // Built-in patterns\n const builtIn = PATTERNS[props.type]\n if (builtIn && !builtIn.test(val)) {\n return props.validationMessage || MESSAGES[props.type] || 'Invalid input'\n }\n\n return null\n})\n\nconst showError = computed(() => props.validate && touched.value)\n\nwatch(validationError, (err) => {\n emit('validation', { valid: !err, error: err })\n})\n\n// --- Event handlers ---\n\n// Regex for validating partial number input (allows intermediate states like \"-\" or \".\")\nconst NUMBER_ALLOWED = /^-?\\d*\\.?\\d*$/\n\nfunction onInput(e) {\n const val = e.target.value\n\n // For number type, reject non-numeric characters\n if (isNumber.value) {\n if (!NUMBER_ALLOWED.test(val)) {\n // Revert to previous valid value\n e.target.value = String(props.modelValue ?? '')\n return\n }\n }\n\n emit(\n 'update:modelValue',\n isNumber.value && val !== '' && val !== '-' && val !== '.' && val !== '-.' ? Number(val) : val,\n )\n}\n\nfunction onBlur() {\n touched.value = true\n}\n\nfunction onKeydown(e) {\n if (!isNumber.value) return\n\n // Allow: backspace, delete, tab, escape, enter, arrows, home, end, decimal point, minus\n const allowed = [\n 'Backspace',\n 'Delete',\n 'Tab',\n 'Escape',\n 'Enter',\n 'ArrowLeft',\n 'ArrowRight',\n 'Home',\n 'End',\n ]\n if (allowed.includes(e.key)) return\n if (e.key === '.' && !String(props.modelValue).includes('.')) return\n if (e.key === '-' && e.target.selectionStart === 0 && !String(props.modelValue).includes('-'))\n return\n if (e.ctrlKey || e.metaKey) return // allow copy/paste/select-all\n\n // Block non-digit keys\n if (!/^\\d$/.test(e.key)) {\n e.preventDefault()\n }\n}\n\nfunction stepUp() {\n const current = Number(props.modelValue) || 0\n let next = current + (props.step ?? 1)\n if (props.max !== undefined) next = Math.min(next, props.max)\n emit('update:modelValue', next)\n}\n\nfunction stepDown() {\n const current = Number(props.modelValue) || 0\n let next = current - (props.step ?? 1)\n if (props.min !== undefined) next = Math.max(next, props.min)\n emit('update:modelValue', next)\n}\n\n// Expose focus method\ndefineExpose({\n focus: () => inputRef.value?.focus(),\n el: inputRef,\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2NA,MAAM,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KACtB,OAAM;;IAMF,SAAA,SAAY,QAAA,kBAAa,mBADjC,UAAA,GAAA,mBAuBM,OAAA;;KArBJ,OAAK,eAAA,CAAC,yGAAuG,EAAA,kCACjE,QAAA,SAAQ,CAAA,CAAA;IAEpD,GAAA,CAAA,mBAQS,UAAA;KAPP,MAAK;KACL,UAAS;KACT,OAAM;KACN,cAAW;KACV,SAAO;IAER,GAAA,CAAA,YAAsD,aAAA;KAA9C,MAAK;KAAiB,OAAM;IAEtC,CAAA,CAAA,CAAA,GAAA,mBAQS,UAAA;KAPP,MAAK;KACL,UAAS;KACT,OAAM;KACN,cAAW;KACV,SAAO;IAER,GAAA,CAAA,YAAwD,aAAA;KAAhD,MAAK;KAAmB,OAAM;;IAMlC,SAAA,SAAY,QAAA,kBAAa,gBADjC,UAAA,GAAA,mBAUS,UAAA;;KARP,MAAK;KACL,UAAS;KACT,OAAK,eAAA,CAAC,gPAA8O,EAAA,kCACxM,QAAA,SAAQ,CAAA,CAAA;KACpD,cAAW;KACV,SAAO;IAER,GAAA,CAAA,YAA0C,aAAA;KAAlC,MAAK;KAAW,OAAM;;GAKzB,CAAA,GAAA,UAAA,SAAa,gBAAA,SAAtB,UAAA,GAAA,mBAEI,KAFJ,YAEI,gBADC,gBAAA,KAAe,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"Input.js","names":["$slots"],"sources":["../../src/components/Input.vue"],"sourcesContent":["<template>\n <div class=\"w-full\">\n <div class=\"relative flex\">\n <!-- Number stepper: minus button on left (both-sides layout) -->\n <button\n v-if=\"isNumber && stepperLayout === 'both-sides'\"\n type=\"button\"\n tabindex=\"-1\"\n class=\"flex items-center justify-center w-9 rounded-l-lg border border-r-0 border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none\"\n :class=\"{ 'opacity-50 pointer-events-none': disabled }\"\n aria-label=\"Decrease value\"\n @click=\"stepDown\"\n >\n <UiIcon name=\"mdi:minus\" class=\"w-4 h-4\" />\n </button>\n\n <!-- Number stepper: stacked up/down buttons on left -->\n <div\n v-if=\"isNumber && stepperLayout === 'stacked-left'\"\n class=\"flex flex-col w-7 border border-r-0 border-gray-300 dark:border-gray-600 rounded-l-lg overflow-hidden\"\n :class=\"{ 'opacity-50 pointer-events-none': disabled }\"\n >\n <button\n type=\"button\"\n tabindex=\"-1\"\n class=\"grid place-items-center w-full flex-1 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none border-b border-gray-300 dark:border-gray-600\"\n aria-label=\"Increase value\"\n @click=\"stepUp\"\n >\n <UiIcon name=\"mdi:chevron-up\" class=\"block w-3 h-3\" />\n </button>\n <button\n type=\"button\"\n tabindex=\"-1\"\n class=\"grid place-items-center w-full flex-1 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none\"\n aria-label=\"Decrease value\"\n @click=\"stepDown\"\n >\n <UiIcon name=\"mdi:chevron-down\" class=\"block w-3 h-3\" />\n </button>\n </div>\n\n <!-- Textarea mode: multi-line text input with custom scrollbar styling -->\n <textarea\n v-if=\"isTextarea\"\n ref=\"inputRef\"\n :value=\"modelValue\"\n :placeholder=\"placeholder\"\n :required=\"required\"\n :disabled=\"disabled\"\n :readonly=\"readonly\"\n :rows=\"rows\"\n :maxlength=\"maxlength\"\n class=\"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-400 focus:ring-2 focus:ring-primary-500 focus:border-primary-500 outline-none text-sm transition-colors [scrollbar-width:thin] [scrollbar-color:var(--color-gray-300)_transparent] dark:[scrollbar-color:var(--color-gray-600)_transparent] [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-thumb]:bg-gray-600 hover:[&::-webkit-scrollbar-thumb]:bg-gray-400 dark:hover:[&::-webkit-scrollbar-thumb]:bg-gray-500\"\n :class=\"resizeClass\"\n :style=\"textareaStyle\"\n @input=\"onInput\"\n @blur=\"onBlur\"\n />\n\n <!-- The actual input element (text, number, password, email, phone) -->\n <!-- Left icon/image slot -->\n <span\n v-if=\"!isTextarea && ($slots.left || iconLeft)\"\n class=\"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-gray-400 dark:text-gray-500\"\n >\n <slot name=\"left\">\n <UiIcon v-if=\"iconLeft\" :name=\"iconLeft\" class=\"w-4 h-4\" />\n </slot>\n </span>\n\n <input\n v-if=\"!isTextarea\"\n ref=\"inputRef\"\n :type=\"computedType\"\n :value=\"modelValue\"\n :placeholder=\"placeholder\"\n :required=\"required\"\n :disabled=\"disabled\"\n :readonly=\"readonly\"\n :autocomplete=\"autocomplete\"\n :minlength=\"minlength\"\n :maxlength=\"maxlength\"\n :inputmode=\"computedInputMode\"\n :min=\"min\"\n :max=\"max\"\n :step=\"step\"\n :pattern=\"pattern\"\n class=\"w-full py-2 border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-400 focus:ring-2 focus:ring-primary-500 focus:border-primary-500 outline-none text-sm transition-colors\"\n :class=\"inputClasses\"\n @input=\"onInput\"\n @blur=\"onBlur\"\n @keydown=\"onKeydown\"\n />\n\n <!-- Right icon/image slot (hidden when clear button or password toggle is shown) -->\n <span\n v-if=\"\n !isTextarea &&\n ($slots.right || iconRight) &&\n !(clearable && modelValue) &&\n !(isPassword && showToggle)\n \"\n class=\"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none text-gray-400 dark:text-gray-500\"\n >\n <slot name=\"right\">\n <UiIcon v-if=\"iconRight\" :name=\"iconRight\" class=\"w-4 h-4\" />\n </slot>\n </span>\n\n <!-- Clear button -->\n <button\n v-if=\"clearable && modelValue\"\n type=\"button\"\n tabindex=\"-1\"\n class=\"absolute inset-y-0 right-0 flex items-center pr-3 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors\"\n aria-label=\"Clear\"\n @mousedown.prevent\n @click=\"emit('update:modelValue', '')\"\n >\n <UiIcon name=\"mdi:close-circle\" class=\"w-4 h-4\" />\n </button>\n\n <!-- Password visibility toggle button -->\n <button\n v-if=\"isPassword && showToggle\"\n type=\"button\"\n tabindex=\"-1\"\n class=\"absolute inset-y-0 right-0 flex items-center pr-3 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors\"\n :aria-label=\"passwordVisible ? 'Hide password' : 'Show password'\"\n @mousedown.prevent\n @click=\"passwordVisible = !passwordVisible\"\n >\n <UiIcon\n :name=\"passwordVisible ? 'mdi:eye-off-outline' : 'mdi:eye-outline'\"\n class=\"w-4 h-4\"\n />\n </button>\n\n <!-- Number stepper: stacked up/down buttons on right -->\n <div\n v-if=\"isNumber && stepperLayout === 'stacked-right'\"\n class=\"flex flex-col w-7 border border-l-0 border-gray-300 dark:border-gray-600 rounded-r-lg overflow-hidden\"\n :class=\"{ 'opacity-50 pointer-events-none': disabled }\"\n >\n <button\n type=\"button\"\n tabindex=\"-1\"\n class=\"grid place-items-center w-full flex-1 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none border-b border-gray-300 dark:border-gray-600\"\n aria-label=\"Increase value\"\n @click=\"stepUp\"\n >\n <UiIcon name=\"mdi:chevron-up\" class=\"block w-3 h-3\" />\n </button>\n <button\n type=\"button\"\n tabindex=\"-1\"\n class=\"grid place-items-center w-full flex-1 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none\"\n aria-label=\"Decrease value\"\n @click=\"stepDown\"\n >\n <UiIcon name=\"mdi:chevron-down\" class=\"block w-3 h-3\" />\n </button>\n </div>\n\n <!-- Number stepper: plus button on right (both-sides layout) -->\n <button\n v-if=\"isNumber && stepperLayout === 'both-sides'\"\n type=\"button\"\n tabindex=\"-1\"\n class=\"flex items-center justify-center w-9 rounded-r-lg border border-l-0 border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors select-none\"\n :class=\"{ 'opacity-50 pointer-events-none': disabled }\"\n aria-label=\"Increase value\"\n @click=\"stepUp\"\n >\n <UiIcon name=\"mdi:plus\" class=\"w-4 h-4\" />\n </button>\n </div>\n\n <!-- Validation error message (shown after first blur) -->\n <p v-if=\"showError && validationError\" class=\"text-xs text-red-600 dark:text-red-400 mt-1\">\n {{ validationError }}\n </p>\n </div>\n</template>\n\n<script setup>\n/**\n * UiInput — Multi-purpose input component supporting text, number, password, email,\n * phone, and textarea modes in a single unified interface.\n *\n * Features:\n * - Number mode with configurable stepper layouts (both-sides, stacked-left, stacked-right, none)\n * - Password mode with show/hide toggle\n * - Textarea mode with configurable resize, min/max dimensions\n * - Built-in validation for email, phone, and number patterns\n * - Custom regex validation with configurable error messages\n * - Exposes `focus()` method and `el` ref for parent control\n *\n * @example Basic text input\n * <UiInput v-model=\"name\" placeholder=\"Enter your name\" />\n *\n * @example Number input with min/max\n * <UiInput v-model=\"quantity\" type=\"number\" :min=\"0\" :max=\"100\" :step=\"1\" />\n *\n * @example Password with toggle\n * <UiInput v-model=\"password\" type=\"password\" />\n *\n * @example Textarea\n * <UiInput v-model=\"bio\" type=\"textarea\" :rows=\"5\" resize=\"vertical\" />\n *\n * @example Email with validation\n * <UiInput v-model=\"email\" type=\"email\" :validate=\"true\" />\n *\n * @emits {string | number} update:modelValue — Emitted when the input value changes (v-model)\n * @emits {{ valid: boolean, error: string | null }} validation — Emitted when the validation state changes\n */\nimport { ref, computed, watch, useSlots } from 'vue'\nimport UiIcon from '../icons/Icon.vue'\nconst props = defineProps({\n /**\n * Bound value (v-model).\n * @type {string | number}\n * @default ''\n */\n modelValue: { type: [String, Number], default: '' },\n\n /**\n * Input type determining the mode and behavior.\n * @type {string}\n * @default 'text'\n * @values 'text' | 'number' | 'password' | 'email' | 'phone' | 'textarea'\n */\n type: { type: String, default: 'text' },\n\n /**\n * Placeholder text shown when the input is empty.\n * @type {string}\n * @default ''\n */\n placeholder: { type: String, default: '' },\n\n /**\n * Whether the field is required for form validation.\n * @type {boolean}\n * @default false\n */\n required: { type: Boolean, default: false },\n\n /**\n * Disabled state — dims the input and prevents interaction.\n * @type {boolean}\n * @default false\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Read-only state — allows focus/selection but prevents editing.\n * @type {boolean}\n * @default false\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * HTML autocomplete attribute hint for the browser.\n * @type {string}\n * @default undefined\n */\n autocomplete: { type: String, default: undefined },\n\n /**\n * Minimum character length for text validation.\n * @type {number}\n * @default undefined\n */\n minlength: { type: Number, default: undefined },\n\n /**\n * Maximum character length for text validation.\n * @type {number}\n * @default undefined\n */\n maxlength: { type: Number, default: undefined },\n\n // ── Textarea-specific props ──\n\n /**\n * Number of visible text rows (textarea mode only).\n * @type {number}\n * @default 3\n */\n rows: { type: Number, default: 3 },\n\n /**\n * Resize behavior for textarea mode.\n * @type {string}\n * @default 'none'\n * @values 'none' | 'vertical' | 'horizontal' | 'both'\n */\n resize: { type: String, default: 'none' },\n\n /**\n * Minimum height CSS value for textarea (e.g. '80px', '5rem').\n * @type {string}\n * @default undefined\n */\n minHeight: { type: String, default: undefined },\n\n /**\n * Maximum height CSS value for textarea (e.g. '300px', '20rem').\n * @type {string}\n * @default undefined\n */\n maxHeight: { type: String, default: undefined },\n\n /**\n * Minimum width CSS value for textarea (e.g. '200px').\n * @type {string}\n * @default undefined\n */\n minWidth: { type: String, default: undefined },\n\n /**\n * Maximum width CSS value for textarea (e.g. '600px').\n * @type {string}\n * @default undefined\n */\n maxWidth: { type: String, default: undefined },\n\n /**\n * HTML pattern attribute for native form validation.\n * @type {string}\n * @default undefined\n */\n pattern: { type: String, default: undefined },\n\n // ── Password-specific props ──\n\n /**\n * Show the password visibility toggle button (password mode only).\n * @type {boolean}\n * @default true\n */\n showToggle: { type: Boolean, default: true },\n\n // ── Number-specific props ──\n\n /**\n * Minimum allowed numeric value.\n * @type {number}\n * @default undefined\n */\n min: { type: Number, default: undefined },\n\n /**\n * Maximum allowed numeric value.\n * @type {number}\n * @default undefined\n */\n max: { type: Number, default: undefined },\n\n /**\n * Step increment for number stepper buttons.\n * @type {number}\n * @default 1\n */\n step: { type: Number, default: 1 },\n\n /**\n * Layout of the +/- stepper buttons for number inputs.\n * @type {string}\n * @default 'both-sides'\n * @values 'stacked-left' | 'stacked-right' | 'both-sides' | 'none'\n */\n stepperLayout: { type: String, default: 'both-sides' },\n\n // ── Validation props ──\n\n /**\n * Show a clear button when the input has a value.\n * @type {boolean}\n * @default false\n */\n clearable: { type: Boolean, default: false },\n\n /**\n * Icon name to display on the left side of the input.\n * @type {string}\n * @default undefined\n */\n iconLeft: { type: String, default: undefined },\n\n /**\n * Icon name to display on the right side of the input.\n * @type {string}\n * @default undefined\n */\n iconRight: { type: String, default: undefined },\n\n /**\n * Enable built-in validation feedback shown below the input on blur.\n * @type {boolean}\n * @default true\n */\n validate: { type: Boolean, default: true },\n\n /**\n * Custom regex pattern string — overrides built-in type-based patterns.\n * @type {string}\n * @default undefined\n */\n validationPattern: { type: String, default: undefined },\n\n /**\n * Custom error message shown when validation fails.\n * @type {string}\n * @default undefined\n */\n validationMessage: { type: String, default: undefined },\n})\n\nconst emit = defineEmits(['update:modelValue', 'validation'])\n\nconst inputRef = ref(null)\nconst passwordVisible = ref(false)\nconst touched = ref(false)\n\n// --- Computed helpers ---\n\n// Detect input mode from the type prop\nconst isPassword = computed(() => props.type === 'password')\nconst isNumber = computed(() => props.type === 'number')\nconst isTextarea = computed(() => props.type === 'textarea')\n\n// Map resize prop to Tailwind resize utility class\nconst resizeClass = computed(() => {\n const map = { none: 'resize-none', vertical: 'resize-y', horizontal: 'resize-x', both: 'resize' }\n return map[props.resize] || 'resize-none'\n})\n\nconst textareaStyle = computed(() => {\n const s = {}\n if (props.minHeight) s.minHeight = props.minHeight\n if (props.maxHeight) s.maxHeight = props.maxHeight\n if (props.minWidth) s.minWidth = props.minWidth\n if (props.maxWidth) s.maxWidth = props.maxWidth\n return s\n})\n\n// For number type, render as text input so we can filter keystrokes ourselves\nconst computedType = computed(() => {\n if (isPassword.value) return passwordVisible.value ? 'text' : 'password'\n if (isNumber.value) return 'text' // we handle number filtering ourselves\n if (props.type === 'phone') return 'tel'\n return props.type\n})\n\n// Set appropriate mobile keyboard via inputmode attribute\nconst computedInputMode = computed(() => {\n if (isNumber.value) return 'decimal'\n if (props.type === 'phone') return 'tel'\n if (props.type === 'email') return 'email'\n return undefined\n})\n\nconst hasStepper = computed(() => isNumber.value && props.stepperLayout !== 'none')\n\nconst slots = useSlots()\n\nconst hasLeftIcon = computed(() => !!props.iconLeft || !!slots.left)\nconst hasRightIcon = computed(() => !!props.iconRight || !!slots.right)\n\nconst inputClasses = computed(() => {\n const classes = []\n\n // Horizontal padding — tighter when steppers are present\n if (hasStepper.value) {\n classes.push('px-1.5')\n } else {\n // Adjust padding for icons/slots\n classes.push(hasLeftIcon.value ? 'pl-9' : 'pl-3')\n classes.push(hasRightIcon.value ? 'pr-9' : 'pr-3')\n }\n\n // Rounding based on stepper layout\n if (hasStepper.value) {\n if (props.stepperLayout === 'both-sides') classes.push('rounded-none')\n else if (props.stepperLayout === 'stacked-left') classes.push('rounded-l-none', 'rounded-r-lg')\n else if (props.stepperLayout === 'stacked-right') classes.push('rounded-r-none', 'rounded-l-lg')\n } else {\n classes.push('rounded-lg')\n }\n\n // Extra right padding for password toggle\n if (isPassword.value && props.showToggle) classes.push('pr-10')\n\n // Extra right padding for clear button\n if (props.clearable) classes.push('pr-8')\n\n // Number text alignment\n if (isNumber.value && hasStepper.value) classes.push('text-center')\n\n return classes\n})\n\n// --- Validation ---\n\n// Built-in regex patterns for common input types\nconst PATTERNS = {\n email: /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/,\n phone: /^\\+?[\\d\\s\\-().]{7,}$/,\n number: /^-?\\d*\\.?\\d+$/,\n}\n\nconst MESSAGES = {\n email: 'Please enter a valid email address',\n phone: 'Please enter a valid phone number',\n number: 'Please enter a valid number',\n}\n\nconst validationError = computed(() => {\n const val = String(props.modelValue ?? '')\n if (!val) return null\n\n // Custom pattern takes priority\n if (props.validationPattern) {\n const re = new RegExp(props.validationPattern)\n if (!re.test(val)) return props.validationMessage || 'Invalid format'\n }\n\n // Built-in patterns\n const builtIn = PATTERNS[props.type]\n if (builtIn && !builtIn.test(val)) {\n return props.validationMessage || MESSAGES[props.type] || 'Invalid input'\n }\n\n return null\n})\n\nconst showError = computed(() => props.validate && touched.value)\n\nwatch(validationError, (err) => {\n emit('validation', { valid: !err, error: err })\n})\n\n// --- Event handlers ---\n\n// Regex for validating partial number input (allows intermediate states like \"-\" or \".\")\nconst NUMBER_ALLOWED = /^-?\\d*\\.?\\d*$/\n\nfunction onInput(e) {\n const val = e.target.value\n\n // For number type, reject non-numeric characters\n if (isNumber.value) {\n if (!NUMBER_ALLOWED.test(val)) {\n // Revert to previous valid value\n e.target.value = String(props.modelValue ?? '')\n return\n }\n }\n\n emit(\n 'update:modelValue',\n isNumber.value && val !== '' && val !== '-' && val !== '.' && val !== '-.' ? Number(val) : val,\n )\n}\n\nfunction onBlur() {\n touched.value = true\n}\n\nfunction onKeydown(e) {\n if (!isNumber.value) return\n\n // Allow: backspace, delete, tab, escape, enter, arrows, home, end, decimal point, minus\n const allowed = [\n 'Backspace',\n 'Delete',\n 'Tab',\n 'Escape',\n 'Enter',\n 'ArrowLeft',\n 'ArrowRight',\n 'Home',\n 'End',\n ]\n if (allowed.includes(e.key)) return\n if (e.key === '.' && !String(props.modelValue).includes('.')) return\n if (e.key === '-' && e.target.selectionStart === 0 && !String(props.modelValue).includes('-'))\n return\n if (e.ctrlKey || e.metaKey) return // allow copy/paste/select-all\n\n // Block non-digit keys\n if (!/^\\d$/.test(e.key)) {\n e.preventDefault()\n }\n}\n\nfunction stepUp() {\n const current = Number(props.modelValue) || 0\n let next = current + (props.step ?? 1)\n if (props.max !== undefined) next = Math.min(next, props.max)\n emit('update:modelValue', next)\n}\n\nfunction stepDown() {\n const current = Number(props.modelValue) || 0\n let next = current - (props.step ?? 1)\n if (props.min !== undefined) next = Math.max(next, props.min)\n emit('update:modelValue', next)\n}\n\n// Expose focus method\ndefineExpose({\n focus: () => inputRef.value?.focus(),\n el: inputRef,\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2NA,MAAM,QAAQ;EA0Md,MAAM,OAAO;EAEb,MAAM,WAAW,IAAI,IAAI;EACzB,MAAM,kBAAkB,IAAI,KAAK;EACjC,MAAM,UAAU,IAAI,KAAK;EAKzB,MAAM,aAAa,eAAe,MAAM,SAAS,UAAU;EAC3D,MAAM,WAAW,eAAe,MAAM,SAAS,QAAQ;EACvD,MAAM,aAAa,eAAe,MAAM,SAAS,UAAU;EAG3D,MAAM,cAAc,eAAe;GAEjC,OAAO;IADO,MAAM;IAAe,UAAU;IAAY,YAAY;IAAY,MAAM;GAC9E,EAAE,MAAM,WAAW;EAC9B,CAAC;EAED,MAAM,gBAAgB,eAAe;GACnC,MAA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AAA,YAAwD,aAAA;KAAhD,MAAK;KAAmB,OAAM;;IAMlC,SAAA,SAAY,QAAA,kBAAa,gBADjC,UAAA,GAAA,mBAUS,UAAA;;KARP,MAAK;KACL,UAAS;KACT,OAAK,eAAA,CAAC,gPAA8O,EAAA,kCACxM,QAAA,SAAQ,CAAA,CAAA;KACpD,cAAW;KACV,SAAO;IAER,GAAA,CAAA,YAA0C,aAAA;KAAlC,MAAK;KAAW,OAAM;;GAKzB,CAAA,GAAA,UAAA,SAAa,gBAAA,SAAtB,UAAA,GAAA,mBAEI,KAFJ,YAEI,gBADC,gBAAA,KAAe,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,CAAA"}
@@ -1,9 +1,14 @@
1
1
  import _sfc_main$1 from "../icons/Icon.js";
2
- import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, normalizeClass, openBlock, renderSlot, resolveDynamicComponent, toDisplayString, withCtx, withModifiers } from "vue";
2
+ import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, normalizeClass, openBlock, renderSlot, toDisplayString, withModifiers } from "vue";
3
3
  //#region src/components/ListMenuItem.vue
4
- var _hoisted_1 = { class: "flex-1 min-w-0" };
5
- var _hoisted_2 = { class: "block truncate" };
6
- var _hoisted_3 = {
4
+ var _hoisted_1 = [
5
+ "role",
6
+ "tabindex",
7
+ "aria-disabled"
8
+ ];
9
+ var _hoisted_2 = { class: "flex-1 min-w-0" };
10
+ var _hoisted_3 = { class: "block truncate" };
11
+ var _hoisted_4 = {
7
12
  key: 0,
8
13
  class: "block text-xs text-gray-400 dark:text-gray-500 truncate mt-0.5"
9
14
  };
@@ -115,6 +120,13 @@ var _sfc_main = {
115
120
  else if (isSelect.value) props.selectRef?.toggle?.();
116
121
  else if (props.clickable) emit("click");
117
122
  };
123
+ const onKeydown = (e) => {
124
+ if (!isInteractive.value || props.disabled) return;
125
+ if (e.key === "Enter" || e.key === " ") {
126
+ e.preventDefault();
127
+ handleClick();
128
+ }
129
+ };
118
130
  const handleSuffixClick = (e) => {
119
131
  if (isToggle.value && !props.disabled) {
120
132
  e.stopPropagation();
@@ -152,34 +164,29 @@ var _sfc_main = {
152
164
  return "text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700/40 active:bg-gray-100 dark:active:bg-gray-700/60 cursor-pointer";
153
165
  });
154
166
  return (_ctx, _cache) => {
155
- return openBlock(), createBlock(resolveDynamicComponent(isInteractive.value ? "button" : "div"), {
156
- type: isInteractive.value ? "button" : void 0,
167
+ return openBlock(), createElementBlock("div", {
157
168
  class: normalizeClass(["w-full flex items-center gap-3 text-sm text-left transition-colors", [sizeClass.value, colorClass.value]]),
158
- disabled: isInteractive.value ? __props.disabled : void 0,
159
- onClick: handleClick
160
- }, {
161
- default: withCtx(() => [
162
- __props.icon ? (openBlock(), createBlock(_sfc_main$1, {
163
- key: 0,
164
- name: __props.icon,
165
- class: normalizeClass(["shrink-0", [iconSizeClass.value, __props.iconClass || defaultIconColorClass.value]])
166
- }, null, 8, ["name", "class"])) : createCommentVNode("", true),
167
- createElementVNode("span", _hoisted_1, [createElementVNode("span", _hoisted_2, [renderSlot(_ctx.$slots, "default")]), __props.hint ? (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(__props.hint), 1)) : createCommentVNode("", true)]),
168
- createElementVNode("div", {
169
- class: "shrink-0 flex items-center",
170
- onClick: withModifiers(handleSuffixClick, ["stop"])
171
- }, [renderSlot(_ctx.$slots, "suffix", {}, () => [__props.clickable && __props.chevron ? (openBlock(), createBlock(_sfc_main$1, {
172
- key: 0,
173
- name: "mdi:chevron-right",
174
- class: normalizeClass(["w-4 h-4", __props.danger ? "text-red-300 dark:text-red-800" : "text-gray-300 dark:text-gray-600"])
175
- }, null, 8, ["class"])) : createCommentVNode("", true)])])
176
- ]),
177
- _: 3
178
- }, 8, [
179
- "type",
180
- "class",
181
- "disabled"
182
- ]);
169
+ role: isInteractive.value ? "button" : void 0,
170
+ tabindex: isInteractive.value && !__props.disabled ? 0 : void 0,
171
+ "aria-disabled": isInteractive.value && __props.disabled ? "true" : void 0,
172
+ onClick: handleClick,
173
+ onKeydown
174
+ }, [
175
+ __props.icon ? (openBlock(), createBlock(_sfc_main$1, {
176
+ key: 0,
177
+ name: __props.icon,
178
+ class: normalizeClass(["shrink-0", [iconSizeClass.value, __props.iconClass || defaultIconColorClass.value]])
179
+ }, null, 8, ["name", "class"])) : createCommentVNode("", true),
180
+ createElementVNode("span", _hoisted_2, [createElementVNode("span", _hoisted_3, [renderSlot(_ctx.$slots, "default")]), __props.hint ? (openBlock(), createElementBlock("span", _hoisted_4, toDisplayString(__props.hint), 1)) : createCommentVNode("", true)]),
181
+ createElementVNode("div", {
182
+ class: "shrink-0 flex items-center",
183
+ onClick: withModifiers(handleSuffixClick, ["stop"])
184
+ }, [renderSlot(_ctx.$slots, "suffix", {}, () => [__props.clickable && __props.chevron ? (openBlock(), createBlock(_sfc_main$1, {
185
+ key: 0,
186
+ name: "mdi:chevron-right",
187
+ class: normalizeClass(["w-4 h-4", __props.danger ? "text-red-300 dark:text-red-800" : "text-gray-300 dark:text-gray-600"])
188
+ }, null, 8, ["class"])) : createCommentVNode("", true)])])
189
+ ], 42, _hoisted_1);
183
190
  };
184
191
  }
185
192
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ListMenuItem.js","names":[],"sources":["../../src/components/ListMenuItem.vue"],"sourcesContent":["<template>\n <component\n :is=\"isInteractive ? 'button' : 'div'\"\n :type=\"isInteractive ? 'button' : undefined\"\n class=\"w-full flex items-center gap-3 text-sm text-left transition-colors\"\n :class=\"[sizeClass, colorClass]\"\n :disabled=\"isInteractive ? disabled : undefined\"\n @click=\"handleClick\"\n >\n <UiIcon\n v-if=\"icon\"\n :name=\"icon\"\n class=\"shrink-0\"\n :class=\"[iconSizeClass, iconClass || defaultIconColorClass]\"\n />\n <span class=\"flex-1 min-w-0\">\n <span class=\"block truncate\"><slot /></span>\n <span v-if=\"hint\" class=\"block text-xs text-gray-400 dark:text-gray-500 truncate mt-0.5\">{{\n hint\n }}</span>\n </span>\n <div class=\"shrink-0 flex items-center\" @click.stop=\"handleSuffixClick\">\n <slot name=\"suffix\">\n <UiIcon\n v-if=\"clickable && chevron\"\n name=\"mdi:chevron-right\"\n class=\"w-4 h-4\"\n :class=\"danger ? 'text-red-300 dark:text-red-800' : 'text-gray-300 dark:text-gray-600'\"\n />\n </slot>\n </div>\n </component>\n</template>\n\n<script setup>\n/**\n * UiListMenuItem — Single row item for use inside UiListMenu.\n *\n * A versatile row component that can serve as:\n * - A clickable action row (set `clickable`)\n * - A toggle row where tapping anywhere toggles (set `toggle`)\n * - A select row where tapping anywhere opens the select (set `selectRef`)\n * - A static row hosting suffix controls (default)\n *\n * @example Clickable action row\n * <UiListMenuItem icon=\"mdi:account\" clickable @click=\"goProfile\">Profile</UiListMenuItem>\n *\n * @example Toggle row (whole row is tappable)\n * <UiListMenuItem icon=\"mdi:wrap\" :toggle=\"wordWrap\" @update:toggle=\"wordWrap = $event\">\n * Word Wrap\n * <template #suffix><UiToggle :model-value=\"wordWrap\" readonly /></template>\n * </UiListMenuItem>\n *\n * @example Select row (whole row opens the select)\n * <UiListMenuItem icon=\"mdi:translate\" :select-ref=\"langRef\">\n * Language\n * <template #suffix><UiSelect ref=\"langRef\" ... /></template>\n * </UiListMenuItem>\n *\n * @emits {void} click — Emitted when a clickable item is clicked\n * @emits {boolean} update:toggle — Emitted with the new value when a toggle row is tapped\n *\n * @slot default — Label text\n * @slot suffix — Trailing content (toggle, select, badge, etc.)\n *\n * @see UiListMenu — Parent container for grouping list items\n */\nimport { computed } from 'vue'\nimport UiIcon from '../icons/Icon.vue'\nconst props = defineProps({\n /** MDI icon name displayed at the start of the row. */\n icon: { type: String, default: '' },\n\n /** Custom CSS class override for the icon element. */\n iconClass: { type: String, default: '' },\n\n /** Whether this item is a clickable action (renders as button with hover states + chevron). */\n clickable: { type: Boolean, default: false },\n\n /**\n * Toggle state. When set to a boolean, the row becomes a tappable toggle.\n * Clicking anywhere emits `update:toggle` with the inverted value.\n */\n toggle: { type: Boolean, default: undefined },\n\n /**\n * Reference to a UiSelect component instance. When provided, the row becomes\n * tappable and clicking anywhere opens the select dropdown.\n */\n selectRef: { type: Object, default: undefined },\n\n /** Show a chevron-right icon as the trailing suffix (only when clickable). */\n chevron: { type: Boolean, default: true },\n\n /** Danger/red styling for destructive actions. */\n danger: { type: Boolean, default: false },\n\n /** Disabled state — dims the item and prevents interaction. */\n disabled: { type: Boolean, default: false },\n\n /** Optional hint text displayed below the label. */\n hint: { type: String, default: '' },\n\n /**\n * Size preset for padding and icon dimensions.\n * @values 'md' | 'sm'\n */\n size: { type: String, default: 'md' },\n})\n\nconst emit = defineEmits(['click', 'update:toggle'])\n\nconst isToggle = computed(() => props.toggle !== undefined)\nconst isSelect = computed(() => props.selectRef !== undefined)\nconst isInteractive = computed(() => props.clickable || isToggle.value || isSelect.value)\n\nconst handleClick = () => {\n if (props.disabled) return\n if (isToggle.value) {\n emit('update:toggle', !props.toggle)\n } else if (isSelect.value) {\n props.selectRef?.toggle?.()\n } else if (props.clickable) {\n emit('click')\n }\n}\n\nconst handleSuffixClick = (e) => {\n // For toggle rows, clicking the suffix (the toggle itself) should also toggle\n if (isToggle.value && !props.disabled) {\n e.stopPropagation()\n emit('update:toggle', !props.toggle)\n return\n }\n // For select rows, let the select handle its own click (it calls toggleOpen)\n // but stop propagation so the row doesn't double-open\n if (isSelect.value) {\n e.stopPropagation()\n return\n }\n // For clickable rows, stop propagation so suffix controls work independently\n if (props.clickable) {\n e.stopPropagation()\n }\n}\n\nconst sizeClass = computed(() => {\n const map = { md: 'px-4 py-3', sm: 'px-3 py-2.5' }\n return map[props.size] ?? map.md\n})\n\nconst iconSizeClass = computed(() => {\n const map = { md: 'w-[18px] h-[18px]', sm: 'w-4 h-4' }\n return map[props.size] ?? map.md\n})\n\nconst defaultIconColorClass = computed(() => {\n if (props.danger) return 'text-red-500 dark:text-red-400'\n return 'text-gray-400 dark:text-gray-500'\n})\n\nconst colorClass = computed(() => {\n if (props.disabled) return 'opacity-40 cursor-not-allowed'\n if (!isInteractive.value) {\n return props.danger ? 'text-red-600 dark:text-red-400' : 'text-gray-700 dark:text-gray-300'\n }\n if (props.danger)\n return 'text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 active:bg-red-100 dark:active:bg-red-900/30 cursor-pointer'\n return 'text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700/40 active:bg-gray-100 dark:active:bg-gray-700/60 cursor-pointer'\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqEA,MAAM,QAAQ;EAyCd,MAAM,OAAO;EAEb,MAAM,WAAW,eAAe,MAAM,WAAW,KAAA,CAAS;EAC1D,MAAM,WAAW,eAAe,MAAM,cAAc,KAAA,CAAS;EAC7D,MAAM,gBAAgB,eAAe,MAAM,aAAa,SAAS,SAAS,SAAS,KAAK;EAExF,MAAM,oBAAoB;GACxB,IAAI,MAAM,UAAU;GACpB,IAAI,SAAS,OACX,KAAK,iBAAiB,CAAC,MAAM,MAAM;QAC9B,IAAI,SAAS,OAClB,MAAM,WAAW,SAAS;QACrB,IAAI,MAAM,WACf,KAAK,OAAO;EAEhB;EAEA,MAAM,qBAAqB,MAAM;GAE/B,IAAI,SAAS,SAAS,CAAC,MAAM,UAAU;IACrC,EAAE,gBAAgB;IAClB,KAAK,iBAAiB,CAAC,MAAM,MAAM;IACnC;GACF;GAGA,IAAI,SAAS,OAAO;IAClB,EAAE,gBAAgB;IAClB;GACF;GAEA,IAAI,MAAM,WACR,EAAE,gBAAgB;EAEtB;EAEA,MAAM,YAAY,eAAe;GAC/B,MAAM,MAAM;IAAE,IAAI;IAAa,IAAI;GAAc;GACjD,OAAO,IAAI,MAAM,SAAS,IAAI;EAChC,CAAC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CAAA"}
1
+ {"version":3,"file":"ListMenuItem.js","names":[],"sources":["../../src/components/ListMenuItem.vue"],"sourcesContent":["<template>\n <!-- A <div role=\"button\"> rather than a real <button> when interactive: the\n suffix slot commonly holds interactive controls (UiToggle, UiSelect —\n both <button>s), and nesting a <button> inside a <button> is invalid HTML\n the browser restructures, which breaks SSR hydration. A <div> can legally\n contain those controls. -->\n <div\n class=\"w-full flex items-center gap-3 text-sm text-left transition-colors\"\n :class=\"[sizeClass, colorClass]\"\n :role=\"isInteractive ? 'button' : undefined\"\n :tabindex=\"isInteractive && !disabled ? 0 : undefined\"\n :aria-disabled=\"isInteractive && disabled ? 'true' : undefined\"\n @click=\"handleClick\"\n @keydown=\"onKeydown\"\n >\n <UiIcon\n v-if=\"icon\"\n :name=\"icon\"\n class=\"shrink-0\"\n :class=\"[iconSizeClass, iconClass || defaultIconColorClass]\"\n />\n <span class=\"flex-1 min-w-0\">\n <span class=\"block truncate\"><slot /></span>\n <span v-if=\"hint\" class=\"block text-xs text-gray-400 dark:text-gray-500 truncate mt-0.5\">{{\n hint\n }}</span>\n </span>\n <div class=\"shrink-0 flex items-center\" @click.stop=\"handleSuffixClick\">\n <slot name=\"suffix\">\n <UiIcon\n v-if=\"clickable && chevron\"\n name=\"mdi:chevron-right\"\n class=\"w-4 h-4\"\n :class=\"danger ? 'text-red-300 dark:text-red-800' : 'text-gray-300 dark:text-gray-600'\"\n />\n </slot>\n </div>\n </div>\n</template>\n\n<script setup>\n/**\n * UiListMenuItem — Single row item for use inside UiListMenu.\n *\n * A versatile row component that can serve as:\n * - A clickable action row (set `clickable`)\n * - A toggle row where tapping anywhere toggles (set `toggle`)\n * - A select row where tapping anywhere opens the select (set `selectRef`)\n * - A static row hosting suffix controls (default)\n *\n * @example Clickable action row\n * <UiListMenuItem icon=\"mdi:account\" clickable @click=\"goProfile\">Profile</UiListMenuItem>\n *\n * @example Toggle row (whole row is tappable)\n * <UiListMenuItem icon=\"mdi:wrap\" :toggle=\"wordWrap\" @update:toggle=\"wordWrap = $event\">\n * Word Wrap\n * <template #suffix><UiToggle :model-value=\"wordWrap\" readonly /></template>\n * </UiListMenuItem>\n *\n * @example Select row (whole row opens the select)\n * <UiListMenuItem icon=\"mdi:translate\" :select-ref=\"langRef\">\n * Language\n * <template #suffix><UiSelect ref=\"langRef\" ... /></template>\n * </UiListMenuItem>\n *\n * @emits {void} click — Emitted when a clickable item is clicked\n * @emits {boolean} update:toggle — Emitted with the new value when a toggle row is tapped\n *\n * @slot default — Label text\n * @slot suffix — Trailing content (toggle, select, badge, etc.)\n *\n * @see UiListMenu — Parent container for grouping list items\n */\nimport { computed } from 'vue'\nimport UiIcon from '../icons/Icon.vue'\nconst props = defineProps({\n /** MDI icon name displayed at the start of the row. */\n icon: { type: String, default: '' },\n\n /** Custom CSS class override for the icon element. */\n iconClass: { type: String, default: '' },\n\n /** Whether this item is a clickable action (renders as button with hover states + chevron). */\n clickable: { type: Boolean, default: false },\n\n /**\n * Toggle state. When set to a boolean, the row becomes a tappable toggle.\n * Clicking anywhere emits `update:toggle` with the inverted value.\n */\n toggle: { type: Boolean, default: undefined },\n\n /**\n * Reference to a UiSelect component instance. When provided, the row becomes\n * tappable and clicking anywhere opens the select dropdown.\n */\n selectRef: { type: Object, default: undefined },\n\n /** Show a chevron-right icon as the trailing suffix (only when clickable). */\n chevron: { type: Boolean, default: true },\n\n /** Danger/red styling for destructive actions. */\n danger: { type: Boolean, default: false },\n\n /** Disabled state — dims the item and prevents interaction. */\n disabled: { type: Boolean, default: false },\n\n /** Optional hint text displayed below the label. */\n hint: { type: String, default: '' },\n\n /**\n * Size preset for padding and icon dimensions.\n * @values 'md' | 'sm'\n */\n size: { type: String, default: 'md' },\n})\n\nconst emit = defineEmits(['click', 'update:toggle'])\n\nconst isToggle = computed(() => props.toggle !== undefined)\nconst isSelect = computed(() => props.selectRef !== undefined)\nconst isInteractive = computed(() => props.clickable || isToggle.value || isSelect.value)\n\nconst handleClick = () => {\n if (props.disabled) return\n if (isToggle.value) {\n emit('update:toggle', !props.toggle)\n } else if (isSelect.value) {\n props.selectRef?.toggle?.()\n } else if (props.clickable) {\n emit('click')\n }\n}\n\n// Keep the row keyboard-operable now that it is a div[role=button] rather than\n// a native button.\nconst onKeydown = (e) => {\n if (!isInteractive.value || props.disabled) return\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n handleClick()\n }\n}\n\nconst handleSuffixClick = (e) => {\n // For toggle rows, clicking the suffix (the toggle itself) should also toggle\n if (isToggle.value && !props.disabled) {\n e.stopPropagation()\n emit('update:toggle', !props.toggle)\n return\n }\n // For select rows, let the select handle its own click (it calls toggleOpen)\n // but stop propagation so the row doesn't double-open\n if (isSelect.value) {\n e.stopPropagation()\n return\n }\n // For clickable rows, stop propagation so suffix controls work independently\n if (props.clickable) {\n e.stopPropagation()\n }\n}\n\nconst sizeClass = computed(() => {\n const map = { md: 'px-4 py-3', sm: 'px-3 py-2.5' }\n return map[props.size] ?? map.md\n})\n\nconst iconSizeClass = computed(() => {\n const map = { md: 'w-[18px] h-[18px]', sm: 'w-4 h-4' }\n return map[props.size] ?? map.md\n})\n\nconst defaultIconColorClass = computed(() => {\n if (props.danger) return 'text-red-500 dark:text-red-400'\n return 'text-gray-400 dark:text-gray-500'\n})\n\nconst colorClass = computed(() => {\n if (props.disabled) return 'opacity-40 cursor-not-allowed'\n if (!isInteractive.value) {\n return props.danger ? 'text-red-600 dark:text-red-400' : 'text-gray-700 dark:text-gray-300'\n }\n if (props.danger)\n return 'text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 active:bg-red-100 dark:active:bg-red-900/30 cursor-pointer'\n return 'text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700/40 active:bg-gray-100 dark:active:bg-gray-700/60 cursor-pointer'\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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OAAO,MAAM,SAAS,mCAAmC;GAE3D,IAAI,MAAM,QACR,OAAO;GACT,OAAO;EACT,CAAC;;GAnLC,OAAA,UAAA,GAAA,mBA+BM,OAAA;IA9BJ,OAAK,eAAA,CAAC,sEAAoE,CACjE,UAAA,OAAW,WAAA,KAAU,CAAA,CAAA;IAC7B,MAAM,cAAA,QAAa,WAAc,KAAA;IACjC,UAAU,cAAA,SAAa,CAAK,QAAA,WAAQ,IAAO,KAAA;IAC3C,iBAAe,cAAA,SAAiB,QAAA,WAAQ,SAAY,KAAA;IACpD,SAAO;IACE;;IAGF,QAAA,QADR,UAAA,GAAA,YAKE,aAAA;;KAHC,MAAM,QAAA;KACP,OAAK,eAAA,CAAC,YAAU,CACP,cAAA,OAAe,QAAA,aAAa,sBAAA,KAAqB,CAAA,CAAA;;IAE5D,mBAKO,QALP,YAKO,CAJL,mBAA4C,QAA5C,YAA4C,CAAf,WAAQ,KAAA,QAAA,SAAA,CAAA,CAAA,GACzB,QAAA,QAAZ,UAAA,GAAA,mBAES,QAFT,YAES,gBADP,QAAA,IAAI,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,CAAA;IAGR,mBASM,OAAA;KATD,OAAM;KAA8B,SAAK,cAAO,mBAAiB,CAAA,MAAA,CAAA;IACpE,GAAA,CAAA,WAOO,KAAA,QAAA,UAAA,CAAA,SAAA,CALG,QAAA,aAAa,QAAA,WADrB,UAAA,GAAA,YAKE,aAAA;;KAHA,MAAK;KACL,OAAK,eAAA,CAAC,WACE,QAAA,SAAM,mCAAA,kCAAA,CAAA"}
@@ -73,7 +73,7 @@ var _sfc_main = {
73
73
  return openBlock(), createElementBlock("div", {
74
74
  ref_key: "numpadRef",
75
75
  ref: numpadRef,
76
- class: "grid grid-cols-3 gap-3 max-w-[264px] mx-auto outline-none"
76
+ class: "grid grid-cols-3 gap-3 min-w-[264px] max-w-[264px] mx-auto outline-none"
77
77
  }, [
78
78
  (openBlock(), createElementBlock(Fragment, null, renderList([
79
79
  1,
@@ -90,7 +90,7 @@ var _sfc_main = {
90
90
  key: n,
91
91
  type: "button",
92
92
  tabindex: "-1",
93
- class: normalizeClass(["h-16 w-full text-xl font-medium rounded-2xl transition-all duration-150 text-gray-800 dark:text-gray-100 border shadow-sm active:scale-95", pressedKey.value === n ? "bg-primary-50 dark:bg-primary-900/30 border-primary-300 dark:border-primary-600 scale-95" : "bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-750 active:bg-gray-100 dark:active:bg-gray-700"]),
93
+ class: normalizeClass(["h-16 w-full text-xl font-medium rounded-2xl transition-all duration-150 text-gray-800 dark:text-gray-100 border shadow-sm active:scale-95", pressedKey.value === n ? "bg-primary-50 dark:bg-primary-900/30 border-primary-300 dark:border-primary-600 scale-95" : "bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-700 active:bg-gray-200 dark:active:bg-gray-600"]),
94
94
  disabled: __props.disabled,
95
95
  onClick: ($event) => onDigit(n)
96
96
  }, toDisplayString(n), 11, _hoisted_1);
@@ -99,14 +99,14 @@ var _sfc_main = {
99
99
  createElementVNode("button", {
100
100
  type: "button",
101
101
  tabindex: "-1",
102
- class: normalizeClass(["h-16 w-full text-xl font-medium rounded-2xl transition-all duration-150 text-gray-800 dark:text-gray-100 border shadow-sm active:scale-95", pressedKey.value === 0 ? "bg-primary-50 dark:bg-primary-900/30 border-primary-300 dark:border-primary-600 scale-95" : "bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-750 active:bg-gray-100 dark:active:bg-gray-700"]),
102
+ class: normalizeClass(["h-16 w-full text-xl font-medium rounded-2xl transition-all duration-150 text-gray-800 dark:text-gray-100 border shadow-sm active:scale-95", pressedKey.value === 0 ? "bg-primary-50 dark:bg-primary-900/30 border-primary-300 dark:border-primary-600 scale-95" : "bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-700 active:bg-gray-200 dark:active:bg-gray-600"]),
103
103
  disabled: __props.disabled,
104
104
  onClick: _cache[0] || (_cache[0] = ($event) => onDigit(0))
105
105
  }, " 0 ", 10, _hoisted_2),
106
106
  createElementVNode("button", {
107
107
  type: "button",
108
108
  tabindex: "-1",
109
- class: "h-16 w-full rounded-2xl transition-all duration-150 flex items-center justify-center text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 active:scale-95 disabled:opacity-30 disabled:pointer-events-none",
109
+ class: "h-16 w-full rounded-2xl transition-all duration-150 flex items-center justify-center text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 active:bg-gray-200 dark:active:bg-gray-600 active:scale-95 disabled:opacity-30 disabled:pointer-events-none",
110
110
  disabled: !__props.canDelete,
111
111
  onClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("delete"))
112
112
  }, [createVNode(_sfc_main$1, {
@@ -1 +1 @@
1
- {"version":3,"file":"Numpad.js","names":["$emit"],"sources":["../../src/components/Numpad.vue"],"sourcesContent":["<template>\n <div ref=\"numpadRef\" class=\"grid grid-cols-3 gap-3 max-w-[264px] mx-auto outline-none\">\n <button\n v-for=\"n in [1, 2, 3, 4, 5, 6, 7, 8, 9]\"\n :key=\"n\"\n type=\"button\"\n tabindex=\"-1\"\n class=\"h-16 w-full text-xl font-medium rounded-2xl transition-all duration-150 text-gray-800 dark:text-gray-100 border shadow-sm active:scale-95\"\n :class=\"\n pressedKey === n\n ? 'bg-primary-50 dark:bg-primary-900/30 border-primary-300 dark:border-primary-600 scale-95'\n : 'bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-750 active:bg-gray-100 dark:active:bg-gray-700'\n \"\n :disabled=\"disabled\"\n @click=\"onDigit(n)\"\n >\n {{ n }}\n </button>\n\n <!-- Bottom-left slot (e.g. biometrics button) -->\n <slot name=\"bottom-left\">\n <div />\n </slot>\n\n <button\n type=\"button\"\n tabindex=\"-1\"\n class=\"h-16 w-full text-xl font-medium rounded-2xl transition-all duration-150 text-gray-800 dark:text-gray-100 border shadow-sm active:scale-95\"\n :class=\"\n pressedKey === 0\n ? 'bg-primary-50 dark:bg-primary-900/30 border-primary-300 dark:border-primary-600 scale-95'\n : 'bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-750 active:bg-gray-100 dark:active:bg-gray-700'\n \"\n :disabled=\"disabled\"\n @click=\"onDigit(0)\"\n >\n 0\n </button>\n\n <button\n type=\"button\"\n tabindex=\"-1\"\n class=\"h-16 w-full rounded-2xl transition-all duration-150 flex items-center justify-center text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 active:scale-95 disabled:opacity-30 disabled:pointer-events-none\"\n :disabled=\"!canDelete\"\n @click=\"$emit('delete')\"\n >\n <UiIcon name=\"mdi:backspace-outline\" class=\"w-6 h-6\" />\n </button>\n </div>\n</template>\n\n<script setup>\n/**\n * UiNumpad — A numeric keypad primitive for PIN entry and similar use cases.\n *\n * Emits digit presses and delete actions. Supports physical keyboard input\n * with visual key highlighting. Exposes a bottom-left slot for custom actions\n * (e.g. biometrics button).\n *\n * @example Basic usage\n * <UiNumpad :can-delete=\"pin.length > 0\" @digit=\"onDigit\" @delete=\"onDelete\" />\n *\n * @example With biometrics slot\n * <UiNumpad :can-delete=\"pin.length > 0\" @digit=\"onDigit\" @delete=\"onDelete\">\n * <template #bottom-left>\n * <button @click=\"useBiometrics\">🔒</button>\n * </template>\n * </UiNumpad>\n */\nimport { ref } from 'vue'\nimport UiIcon from '../icons/Icon.vue'\nimport { useEventListener } from '../composables/useEventListener.js'\n\nconst props = defineProps({\n /** Whether the numpad is disabled */\n disabled: { type: Boolean, default: false },\n /** Whether the delete button is enabled */\n canDelete: { type: Boolean, default: false },\n /** Whether the numpad listens for keyboard input globally */\n captureKeyboard: { type: Boolean, default: false },\n})\n\nconst emit = defineEmits(['digit', 'delete'])\n\nconst numpadRef = ref(null)\nconst pressedKey = ref(null)\n\nconst onDigit = (digit) => {\n if (props.disabled) return\n emit('digit', digit)\n}\n\nconst handleKeydown = (e) => {\n if (props.disabled) return\n\n if (/^[0-9]$/.test(e.key)) {\n e.preventDefault()\n const digit = Number(e.key)\n pressedKey.value = digit\n setTimeout(() => {\n pressedKey.value = null\n }, 150)\n onDigit(digit)\n return\n }\n\n if (e.key === 'Backspace') {\n e.preventDefault()\n emit('delete')\n }\n}\n\n// Global keyboard capture, bound only while `captureKeyboard` is set.\n// The target is a getter so it re-evaluates when the prop changes, and is\n// nullish during SSR — useEventListener skips nullish targets and tears the\n// listener down with the component, so no manual cleanup is needed.\nuseEventListener(() => (props.captureKeyboard ? globalThis.window : null), 'keydown', handleKeydown)\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyEA,MAAM,QAAQ;EASd,MAAM,OAAO;EAEb,MAAM,YAAY,IAAI,IAAI;EAC1B,MAAM,aAAa,IAAI,IAAI;EAE3B,MAAM,WAAW,UAAU;GACzB,IAAI,MAAM,UAAU;GACpB,KAAK,SAAS,KAAK;EACrB;EAEA,MAAM,iBAAiB,MAAM;GAC3B,IAAI,MAAM,UAAU;GAEpB,IAAI,UAAU,KAAK,EAAE,GAAG,GAAG;IACzB,EAAE,eAAe;IACjB,MAAM,QAAQ,OAAO,EAAE,GAAG;IAC1B,WAAW,QAAQ;IACnB,iBAAiB;KACf,WAAW,QAAQ;IACrB,GAAG,GAAG;IACN,QAAQ,KAAK;IACb;GACF;GAEA,IAAI,EAAE,QAAQ,aAAa;IACzB,EAAE,eAAe;IACjB,KAAK,QAAQ;GACf;EACF;EAMA,uBAAwB,MAAM,kBAAkB,WAAW,SAAS,MAAO,WAAW,aAAa;;GAnHjG,OAAA,UAAA,GAAA,mBA+CM,OAAA;IA/CG,SAAA;IAAJ,KAAI;IAAY,OAAM;;KACzB,UAAA,GAAA,mBAeS,UAAA,MAAA,WAdK;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA,IAAL,MAAC;KADV,OAAA,mBAeS,UAAA;MAbN,KAAK;MACN,MAAK;MACL,UAAS;MACT,OAAK,eAAA,CAAC,6IACW,WAAA,UAAe,IAAA,6FAAA,mJAAA,CAAA;MAK/B,UAAU,QAAA;MACV,UAAK,WAAE,QAAQ,CAAC;KAEd,GAAA,gBAAA,CAAC,GAAA,IAAA,UAAA;;IAIN,WAEO,KAAA,QAAA,eAAA,CAAA,SAAA,CADL,OAAA,OAAA,OAAA,KAAA,mBAAO,OAAA,MAAA,MAAA,EAAA,EAAA,CAAA;IAGT,mBAaS,UAAA;KAZP,MAAK;KACL,UAAS;KACT,OAAK,eAAA,CAAC,6IACW,WAAA,UAAU,IAAA,6FAAA,mJAAA,CAAA;KAK1B,UAAU,QAAA;KACV,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,QAAO,CAAA;IAChB,GAAA,OAED,IAAA,UAAA;IAEA,mBAQS,UAAA;KAPP,MAAK;KACL,UAAS;KACT,OAAM;KACL,UAAQ,CAAG,QAAA;KACX,SAAK,OAAA,OAAA,OAAA,MAAA,WAAEA,KAAAA,MAAK,QAAA;IAEb,GAAA,CAAA,YAAuD,aAAA;KAA/C,MAAK;KAAwB,OAAM"}
1
+ {"version":3,"file":"Numpad.js","names":["$emit"],"sources":["../../src/components/Numpad.vue"],"sourcesContent":["<template>\n <div\n ref=\"numpadRef\"\n class=\"grid grid-cols-3 gap-3 min-w-[264px] max-w-[264px] mx-auto outline-none\"\n >\n <button\n v-for=\"n in [1, 2, 3, 4, 5, 6, 7, 8, 9]\"\n :key=\"n\"\n type=\"button\"\n tabindex=\"-1\"\n class=\"h-16 w-full text-xl font-medium rounded-2xl transition-all duration-150 text-gray-800 dark:text-gray-100 border shadow-sm active:scale-95\"\n :class=\"\n pressedKey === n\n ? 'bg-primary-50 dark:bg-primary-900/30 border-primary-300 dark:border-primary-600 scale-95'\n : 'bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-700 active:bg-gray-200 dark:active:bg-gray-600'\n \"\n :disabled=\"disabled\"\n @click=\"onDigit(n)\"\n >\n {{ n }}\n </button>\n\n <!-- Bottom-left slot (e.g. biometrics button) -->\n <slot name=\"bottom-left\">\n <div />\n </slot>\n\n <button\n type=\"button\"\n tabindex=\"-1\"\n class=\"h-16 w-full text-xl font-medium rounded-2xl transition-all duration-150 text-gray-800 dark:text-gray-100 border shadow-sm active:scale-95\"\n :class=\"\n pressedKey === 0\n ? 'bg-primary-50 dark:bg-primary-900/30 border-primary-300 dark:border-primary-600 scale-95'\n : 'bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-700 active:bg-gray-200 dark:active:bg-gray-600'\n \"\n :disabled=\"disabled\"\n @click=\"onDigit(0)\"\n >\n 0\n </button>\n\n <button\n type=\"button\"\n tabindex=\"-1\"\n class=\"h-16 w-full rounded-2xl transition-all duration-150 flex items-center justify-center text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 active:bg-gray-200 dark:active:bg-gray-600 active:scale-95 disabled:opacity-30 disabled:pointer-events-none\"\n :disabled=\"!canDelete\"\n @click=\"$emit('delete')\"\n >\n <UiIcon name=\"mdi:backspace-outline\" class=\"w-6 h-6\" />\n </button>\n </div>\n</template>\n\n<script setup>\n/**\n * UiNumpad — A numeric keypad primitive for PIN entry and similar use cases.\n *\n * Emits digit presses and delete actions. Supports physical keyboard input\n * with visual key highlighting. Exposes a bottom-left slot for custom actions\n * (e.g. biometrics button).\n *\n * @example Basic usage\n * <UiNumpad :can-delete=\"pin.length > 0\" @digit=\"onDigit\" @delete=\"onDelete\" />\n *\n * @example With biometrics slot\n * <UiNumpad :can-delete=\"pin.length > 0\" @digit=\"onDigit\" @delete=\"onDelete\">\n * <template #bottom-left>\n * <button @click=\"useBiometrics\">🔒</button>\n * </template>\n * </UiNumpad>\n */\nimport { ref } from 'vue'\nimport UiIcon from '../icons/Icon.vue'\nimport { useEventListener } from '../composables/useEventListener.js'\n\nconst props = defineProps({\n /** Whether the numpad is disabled */\n disabled: { type: Boolean, default: false },\n /** Whether the delete button is enabled */\n canDelete: { type: Boolean, default: false },\n /** Whether the numpad listens for keyboard input globally */\n captureKeyboard: { type: Boolean, default: false },\n})\n\nconst emit = defineEmits(['digit', 'delete'])\n\nconst numpadRef = ref(null)\nconst pressedKey = ref(null)\n\nconst onDigit = (digit) => {\n if (props.disabled) return\n emit('digit', digit)\n}\n\nconst handleKeydown = (e) => {\n if (props.disabled) return\n\n if (/^[0-9]$/.test(e.key)) {\n e.preventDefault()\n const digit = Number(e.key)\n pressedKey.value = digit\n setTimeout(() => {\n pressedKey.value = null\n }, 150)\n onDigit(digit)\n return\n }\n\n if (e.key === 'Backspace') {\n e.preventDefault()\n emit('delete')\n }\n}\n\n// Global keyboard capture, bound only while `captureKeyboard` is set.\n// The target is a getter so it re-evaluates when the prop changes, and is\n// nullish during SSR — useEventListener skips nullish targets and tears the\n// listener down with the component, so no manual cleanup is needed.\nuseEventListener(() => (props.captureKeyboard ? globalThis.window : null), 'keydown', handleKeydown)\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4EA,MAAM,QAAQ;EASd,MAAM,OAAO;EAEb,MAAM,YAAY,IAAI,IAAI;EAC1B,MAAM,aAAa,IAAI,IAAI;EAE3B,MAAM,WAAW,UAAU;GACzB,IAAI,MAAM,UAAU;GACpB,KAAK,SAAS,KAAK;EACrB;EAEA,MAAM,iBAAiB,MAAM;GAC3B,IAAI,MAAM,UAAU;GAEpB,IAAI,UAAU,KAAK,EAAE,GAAG,GAAG;IACzB,EAAE,eAAe;IACjB,MAAM,QAAQ,OAAO,EAAE,GAAG;IAC1B,WAAW,QAAQ;IACnB,iBAAiB;KACf,WAAW,QAAQ;IACrB,GAAG,GAAG;IACN,QAAQ,KAAK;IACb;GACF;GAEA,IAAI,EAAE,QAAQ,aAAa;IACzB,EAAE,eAAe;IACjB,KAAK,QAAQ;GACf;EACF;EAMA,uBAAwB,MAAM,kBAAkB,WAAW,SAAS,MAAO,WAAW,aAAa;;GAtHjG,OAAA,UAAA,GAAA,mBAkDM,OAAA;IAjDA,SAAA;IAAJ,KAAI;IACJ,OAAM;;KAEN,UAAA,GAAA,mBAeS,UAAA,MAAA,WAdK;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA,IAAL,MAAC;KADV,OAAA,mBAeS,UAAA;MAbN,KAAK;MACN,MAAK;MACL,UAAS;MACT,OAAK,eAAA,CAAC,6IACW,WAAA,UAAe,IAAA,6FAAA,oJAAA,CAAA;MAK/B,UAAU,QAAA;MACV,UAAK,WAAE,QAAQ,CAAC;KAEd,GAAA,gBAAA,CAAC,GAAA,IAAA,UAAA;;IAIN,WAEO,KAAA,QAAA,eAAA,CAAA,SAAA,CADL,OAAA,OAAA,OAAA,KAAA,mBAAO,OAAA,MAAA,MAAA,EAAA,EAAA,CAAA;IAGT,mBAaS,UAAA;KAZP,MAAK;KACL,UAAS;KACT,OAAK,eAAA,CAAC,6IACW,WAAA,UAAU,IAAA,6FAAA,oJAAA,CAAA;KAK1B,UAAU,QAAA;KACV,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,QAAO,CAAA;IAChB,GAAA,OAED,IAAA,UAAA;IAEA,mBAQS,UAAA;KAPP,MAAK;KACL,UAAS;KACT,OAAM;KACL,UAAQ,CAAG,QAAA;KACX,SAAK,OAAA,OAAA,OAAA,MAAA,WAAEA,KAAAA,MAAK,QAAA;IAEb,GAAA,CAAA,YAAuD,aAAA;KAA/C,MAAK;KAAwB,OAAM"}
@@ -1,4 +1,5 @@
1
- import { Transition, computed, createCommentVNode, createElementBlock, createVNode, nextTick, normalizeClass, normalizeStyle, openBlock, ref, renderSlot, watch, withCtx } from "vue";
1
+ import { MENU_PANEL_CLASS } from "../internal/menu.js";
2
+ import { Transition, computed, createCommentVNode, createElementBlock, createVNode, nextTick, normalizeClass, normalizeStyle, openBlock, ref, renderSlot, unref, watch, withCtx } from "vue";
2
3
  //#region src/components/Popup.vue
3
4
  var _sfc_main = {
4
5
  __name: "Popup",
@@ -99,7 +100,8 @@ var _sfc_main = {
99
100
  });
100
101
  const positionStyle = computed(() => ({
101
102
  left: clampedPos.value.left + "px",
102
- top: clampedPos.value.top + "px"
103
+ top: clampedPos.value.top + "px",
104
+ transformOrigin: "top left"
103
105
  }));
104
106
  const updatePosition = () => {
105
107
  const left = props.x;
@@ -156,7 +158,11 @@ var _sfc_main = {
156
158
  key: 0,
157
159
  ref_key: "panelRef",
158
160
  ref: panelRef,
159
- class: normalizeClass(["absolute bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1", [__props.width, __props.panelZ]]),
161
+ class: normalizeClass(["absolute py-1", [
162
+ unref(MENU_PANEL_CLASS),
163
+ __props.width,
164
+ __props.panelZ
165
+ ]]),
160
166
  style: normalizeStyle(positionStyle.value)
161
167
  }, [renderSlot(_ctx.$slots, "default")], 6)) : createCommentVNode("", true)]),
162
168
  _: 3
@@ -1 +1 @@
1
- {"version":3,"file":"Popup.js","names":["$emit"],"sources":["../../src/components/Popup.vue"],"sourcesContent":["<template>\n <div>\n <!-- Invisible full-screen backdrop to capture outside clicks -->\n <div v-if=\"show\" class=\"fixed inset-0\" :class=\"backdropZ\" @click=\"$emit('close')\" />\n <!-- Animated popup panel positioned at (x, y + offsetY) -->\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-if=\"show\"\n ref=\"panelRef\"\n class=\"absolute bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1\"\n :class=\"[width, panelZ]\"\n :style=\"positionStyle\"\n >\n <slot />\n </div>\n </Transition>\n </div>\n</template>\n\n<script setup>\n/**\n * UiPopup — Absolutely positioned popup panel with viewport-aware clamping.\n *\n * Renders a floating panel at the given (x, y) coordinates relative to its offset parent.\n * Automatically clamps position to keep the panel within the visible viewport with an 8px margin.\n * Includes an invisible full-screen backdrop that emits 'close' on click.\n *\n * @example Context menu popup\n * <UiPopup :show=\"showMenu\" :x=\"menuX\" :y=\"menuY\" @close=\"showMenu = false\">\n * <UiDropdownItem icon=\"mdi:pencil\" label=\"Edit\" @click=\"edit\" />\n * <UiDropdownItem icon=\"mdi:trash-can\" label=\"Delete\" color=\"red\" @click=\"del\" />\n * </UiPopup>\n *\n * @example Popup with offset and custom width\n * <UiPopup :show=\"open\" :x=\"posX\" :y=\"posY\" :offset-y=\"8\" width=\"w-64\" @close=\"open = false\">\n * <div class=\"p-3\">Custom content</div>\n * </UiPopup>\n *\n * @emits {void} close — Emitted when the backdrop is clicked to dismiss the popup\n *\n * @slot default — Popup content\n */\nimport { ref, computed, watch, nextTick } from 'vue'\nconst props = defineProps({\n /**\n * Controls popup visibility.\n * @type {boolean}\n * @default false\n */\n show: { type: Boolean, default: false },\n\n /**\n * Horizontal position in pixels relative to the offset parent.\n * @type {number}\n * @default 0\n */\n x: { type: Number, default: 0 },\n\n /**\n * Vertical position in pixels relative to the offset parent.\n * @type {number}\n * @default 0\n */\n y: { type: Number, default: 0 },\n\n /**\n * Additional vertical offset added to the y position (e.g. to clear a trigger element).\n * @type {number}\n * @default 0\n */\n offsetY: { type: Number, default: 0 },\n\n /**\n * Width class for the popup panel.\n * @type {string}\n * @default 'w-56'\n */\n width: { type: String, default: 'w-56' },\n\n /**\n * Z-index class for the popup panel.\n * @type {string}\n * @default 'z-50'\n */\n panelZ: { type: String, default: 'z-50' },\n\n /**\n * Z-index class for the invisible backdrop behind the panel.\n * @type {string}\n * @default 'z-40'\n */\n backdropZ: { type: String, default: 'z-40' },\n})\n\ndefineEmits(['close'])\n\nconst panelRef = ref(null)\nconst clampedPos = ref({ left: 0, top: 0 })\n\nconst positionStyle = computed(() => ({\n left: clampedPos.value.left + 'px',\n top: clampedPos.value.top + 'px',\n}))\n\n// Clamp the panel position so it stays within the viewport (8px margin)\nconst updatePosition = () => {\n const left = props.x\n const top = props.y + props.offsetY\n\n nextTick(() => {\n const el = panelRef.value\n if (!el) return\n\n const parent = el.offsetParent || document.body\n const parentRect = parent.getBoundingClientRect()\n const panelW = el.offsetWidth\n const panelH = el.offsetHeight\n const viewW = window.innerWidth\n const viewH = window.innerHeight\n\n // Convert to viewport coords, clamp, convert back\n let absLeft = parentRect.left + left\n let absTop = parentRect.top + top\n\n const margin = 8\n if (absLeft + panelW > viewW - margin) absLeft = viewW - panelW - margin\n if (absLeft < margin) absLeft = margin\n if (absTop + panelH > viewH - margin) absTop = viewH - panelH - margin\n if (absTop < margin) absTop = margin\n\n clampedPos.value = {\n left: absLeft - parentRect.left,\n top: absTop - parentRect.top,\n }\n })\n}\n\nwatch(\n () => [props.show, props.x, props.y, props.offsetY],\n () => {\n if (props.show) {\n // Set initial position immediately so the panel renders near the right spot\n clampedPos.value = { left: props.x, top: props.y + props.offsetY }\n updatePosition()\n }\n },\n { immediate: true },\n)\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkDA,MAAM,QAAQ;EAqDd,MAAM,WAAW,IAAI,IAAI;EACzB,MAAM,aAAa,IAAI;GAAE,MAAM;GAAG,KAAK;EAAE,CAAC;EAE1C,MAAM,gBAAgB,gBAAgB;GACpC,MAAM,WAAW,MAAM,OAAO;GAC9B,KAAK,WAAW,MAAM,MAAM;EAC9B,EAAE;EAGF,MAAM,uBAAuB;GAC3B,MAAM,OAAO,MAAM;GACnB,MAAM,MAAM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;KANA,SAAA;KAAJ,KAAI;KACJ,OAAK,eAAA,CAAC,4GAA0G,CACvG,QAAA,OAAO,QAAA,MAAM,CAAA,CAAA;KACrB,OAAK,eAAE,cAAA,KAAa;IAErB,GAAA,CAAA,WAAQ,KAAA,QAAA,SAAA,CAAA,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"Popup.js","names":["$emit"],"sources":["../../src/components/Popup.vue"],"sourcesContent":["<template>\n <div>\n <!-- Invisible full-screen backdrop to capture outside clicks -->\n <div v-if=\"show\" class=\"fixed inset-0\" :class=\"backdropZ\" @click=\"$emit('close')\" />\n <!-- Animated popup panel positioned at (x, y + offsetY) -->\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-if=\"show\"\n ref=\"panelRef\"\n class=\"absolute py-1\"\n :class=\"[MENU_PANEL_CLASS, width, panelZ]\"\n :style=\"positionStyle\"\n >\n <slot />\n </div>\n </Transition>\n </div>\n</template>\n\n<script setup>\n/**\n * UiPopup — Absolutely positioned popup panel with viewport-aware clamping.\n *\n * Renders a floating panel at the given (x, y) coordinates relative to its offset parent.\n * Automatically clamps position to keep the panel within the visible viewport with an 8px margin.\n * Includes an invisible full-screen backdrop that emits 'close' on click.\n *\n * @example Context menu popup\n * <UiPopup :show=\"showMenu\" :x=\"menuX\" :y=\"menuY\" @close=\"showMenu = false\">\n * <UiDropdownItem icon=\"mdi:pencil\" label=\"Edit\" @click=\"edit\" />\n * <UiDropdownItem icon=\"mdi:trash-can\" label=\"Delete\" color=\"red\" @click=\"del\" />\n * </UiPopup>\n *\n * @example Popup with offset and custom width\n * <UiPopup :show=\"open\" :x=\"posX\" :y=\"posY\" :offset-y=\"8\" width=\"w-64\" @close=\"open = false\">\n * <div class=\"p-3\">Custom content</div>\n * </UiPopup>\n *\n * @emits {void} close — Emitted when the backdrop is clicked to dismiss the popup\n *\n * @slot default — Popup content\n */\nimport { ref, computed, watch, nextTick } from 'vue'\nimport { MENU_PANEL_CLASS } from '../internal/menu.js'\nconst props = defineProps({\n /**\n * Controls popup visibility.\n * @type {boolean}\n * @default false\n */\n show: { type: Boolean, default: false },\n\n /**\n * Horizontal position in pixels relative to the offset parent.\n * @type {number}\n * @default 0\n */\n x: { type: Number, default: 0 },\n\n /**\n * Vertical position in pixels relative to the offset parent.\n * @type {number}\n * @default 0\n */\n y: { type: Number, default: 0 },\n\n /**\n * Additional vertical offset added to the y position (e.g. to clear a trigger element).\n * @type {number}\n * @default 0\n */\n offsetY: { type: Number, default: 0 },\n\n /**\n * Width class for the popup panel.\n * @type {string}\n * @default 'w-56'\n */\n width: { type: String, default: 'w-56' },\n\n /**\n * Z-index class for the popup panel.\n * @type {string}\n * @default 'z-50'\n */\n panelZ: { type: String, default: 'z-50' },\n\n /**\n * Z-index class for the invisible backdrop behind the panel.\n * @type {string}\n * @default 'z-40'\n */\n backdropZ: { type: String, default: 'z-40' },\n})\n\ndefineEmits(['close'])\n\nconst panelRef = ref(null)\nconst clampedPos = ref({ left: 0, top: 0 })\n\nconst positionStyle = computed(() => ({\n left: clampedPos.value.left + 'px',\n top: clampedPos.value.top + 'px',\n // Inline (not a Tailwind class) so the popup reliably scales in from its\n // top-left corner rather than drifting in from its centre.\n transformOrigin: 'top left',\n}))\n\n// Clamp the panel position so it stays within the viewport (8px margin)\nconst updatePosition = () => {\n const left = props.x\n const top = props.y + props.offsetY\n\n nextTick(() => {\n const el = panelRef.value\n if (!el) return\n\n const parent = el.offsetParent || document.body\n const parentRect = parent.getBoundingClientRect()\n const panelW = el.offsetWidth\n const panelH = el.offsetHeight\n const viewW = window.innerWidth\n const viewH = window.innerHeight\n\n // Convert to viewport coords, clamp, convert back\n let absLeft = parentRect.left + left\n let absTop = parentRect.top + top\n\n const margin = 8\n if (absLeft + panelW > viewW - margin) absLeft = viewW - panelW - margin\n if (absLeft < margin) absLeft = margin\n if (absTop + panelH > viewH - margin) absTop = viewH - panelH - margin\n if (absTop < margin) absTop = margin\n\n clampedPos.value = {\n left: absLeft - parentRect.left,\n top: absTop - parentRect.top,\n }\n })\n}\n\nwatch(\n () => [props.show, props.x, props.y, props.offsetY],\n () => {\n if (props.show) {\n // Set initial position immediately so the panel renders near the right spot\n clampedPos.value = { left: props.x, top: props.y + props.offsetY }\n updatePosition()\n }\n },\n { immediate: true },\n)\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmDA,MAAM,QAAQ;EAqDd,MAAM,WAAW,IAAI,IAAI;EACzB,MAAM,aAAa,IAAI;GAAE,MAAM;GAAG,KAAK;EAAE,CAAC;EAE1C,MAAM,gBAAgB,gBAAgB;GACpC,MAAM,WAAW,MAAM,OAAO;GAC9B,KAAK,WAAW,MAAM,MAAM;GAG5B,iBAAiB;EACnB,EAAE;EAGF,MAAM,uBAAuB;GAC3B,MAAM,OAAO,MAAM;GACnB,MAAM,MAAM,MAAM,IAAI,MAAM;GAE5B,eAAe;IACb,MAAM,KAAK,SAAS;IACpB,IAAI,CAAC,IAAI;IAGT,MAAM,cADS,GAAG,gBAAgB,SAAS,KAAA,CACjB,sBAAsB;IAChD,MAAM,SAAS,GAAG;IAClB,MAAM,SAAS,GAAG;IAClB,MAAM,QAAQ,OAAO;IACrB,MAAM,QAAQ,OAAO;IAGrB,IAAI,UAAU,WAAW,OAAO;IAChC,IAAI,SAAS,WAAW,MAAM;IAE9B,MAAM,SAAS;IACf,IAAI,UAAU,SAAS,QAAQ,QAAQ,UAAU,QAAQ,SAAS;IAClE,IAAI,UAAU,QAAQ,UAAU;IAChC,IAAI,SAAS,SAAS,QAAQ,QAAQ,SAAS,QAAQ,SAAS;IAChE,IAAI,SAAS,QAAQ,SAAS;IAE9B,WAAW,QAAQ;KACjB,MAAM,UAAU,WAAW;KAC3B,KAAK,SAAS,WAAW;IAC3B;GACF,CAAC;EACH;EAEA,YACQ;GAAC,MAAM;GAAM,MAAM;GAAG,MAAM;GAAG,MAAM;EAAO,SAC5C;GACJ,IAAI,MAAM,MAAM;IAEd,WAAW,QAAQ;KAAE,MAAM,MAAM;KAAG,KAAK,MAAM,IAAI,MAAM;IAAQ;IACjE,eAAe;GACjB;EACF,GACA,EAAE,WAAW,KAAK,CACpB;;GA7JE,OAAA,UAAA,GAAA,mBAsBM,OAAA,MAAA,CApBO,QAAA,QAAX,UAAA,GAAA,mBAAoF,OAAA;;IAAnE,OAAK,eAAA,CAAC,iBAAwB,QAAA,SAAS,CAAA;IAAG,SAAK,OAAA,OAAA,OAAA,MAAA,WAAEA,KAAAA,MAAK,OAAA;GAEvE,GAAA,MAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,GAAA,YAiBa,YAAA;IAhBX,sBAAmB;IACnB,oBAAiB;IACjB,kBAAe;IACf,sBAAmB;IACnB,oBAAiB;IACjB,kBAAe;;IAEf,SAAA,cAQM,CAPE,QAAA,QADR,UAAA,GAAA,mBAQM,OAAA;;KANA,SAAA;KAAJ,KAAI;KACJ,OAAK,eAAA,CAAC,iBAAe;MACZ,MAAA,gBAAA;MAAkB,QAAA;MAAO,QAAA;KAAM,CAAA,CAAA;KACvC,OAAK,eAAE,cAAA,KAAa;IAErB,GAAA,CAAA,WAAQ,KAAA,QAAA,SAAA,CAAA,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,CAAA"}
@@ -1,3 +1,4 @@
1
+ import { checkableSizeClass } from "../internal/controlSizes.js";
1
2
  import { computed, createElementBlock, normalizeClass, openBlock } from "vue";
2
3
  //#region src/components/Radio.vue
3
4
  var _hoisted_1 = [
@@ -52,13 +53,7 @@ var _sfc_main = {
52
53
  */
53
54
  const props = __props;
54
55
  const emit = __emit;
55
- const sizeClass = computed(() => {
56
- switch (props.size) {
57
- case "sm": return "w-3.5 h-3.5";
58
- case "lg": return "w-5 h-5";
59
- default: return "w-4 h-4";
60
- }
61
- });
56
+ const sizeClass = computed(() => checkableSizeClass(props.size));
62
57
  function onChange() {
63
58
  emit("update:modelValue", props.value);
64
59
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Radio.js","names":[],"sources":["../../src/components/Radio.vue"],"sourcesContent":["<template>\n <input\n type=\"radio\"\n :checked=\"modelValue === value\"\n :disabled=\"disabled\"\n :name=\"name\"\n :value=\"value\"\n class=\"rounded-full border-gray-300 dark:border-gray-600 text-primary-600 focus:ring-primary-500\"\n :class=\"sizeClass\"\n @change=\"onChange\"\n />\n</template>\n\n<script setup>\n/**\n * UiRadio — Simple styled radio input with configurable size.\n *\n * Wraps a native `<input type=\"radio\">` with consistent Tailwind styling,\n * primary color accent, and focus ring. Use with v-model for group selection.\n *\n * @example Radio group\n * <UiRadio v-model=\"selected\" value=\"a\" name=\"choice\" />\n * <UiRadio v-model=\"selected\" value=\"b\" name=\"choice\" />\n */\nimport { computed } from 'vue'\nconst props = defineProps({\n modelValue: { type: [String, Number, Boolean], default: null },\n value: { type: [String, Number, Boolean], required: true },\n name: { type: String, default: undefined },\n disabled: { type: Boolean, default: false },\n size: { type: String, default: 'md' },\n})\n\nconst emit = defineEmits(['update:modelValue'])\n\nconst sizeClass = computed(() => {\n switch (props.size) {\n case 'sm':\n return 'w-3.5 h-3.5'\n case 'lg':\n return 'w-5 h-5'\n default:\n return 'w-4 h-4'\n }\n})\n\nfunction onChange() {\n emit('update:modelValue', props.value)\n}\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyBA,MAAM,QAAQ;EAQd,MAAM,OAAO;EAEb,MAAM,YAAY,eAAe;GAC/B,QAAQ,MAAM,MAAd;IACE,KAAK,MACH,OAAO;IACT,KAAK,MACH,OAAO;IACT,SACE,OAAO;GACX;EACF,CAAC;EAED,SAAS,WAAW;GAClB,KAAK,qBAAqB,MAAM,KAAK;EACvC;;GA/CE,OAAA,UAAA,GAAA,mBASE,SAAA;IARA,MAAK;IACJ,SAAS,QAAA,eAAe,QAAA;IACxB,UAAU,QAAA;IACV,MAAM,QAAA;IACN,OAAO,QAAA;IACR,OAAK,eAAA,CAAC,6FACE,UAAA,KAAS,CAAA;IACR"}
1
+ {"version":3,"file":"Radio.js","names":[],"sources":["../../src/components/Radio.vue"],"sourcesContent":["<template>\n <input\n type=\"radio\"\n :checked=\"modelValue === value\"\n :disabled=\"disabled\"\n :name=\"name\"\n :value=\"value\"\n class=\"rounded-full border-gray-300 dark:border-gray-600 text-primary-600 focus:ring-primary-500\"\n :class=\"sizeClass\"\n @change=\"onChange\"\n />\n</template>\n\n<script setup>\n/**\n * UiRadio — Simple styled radio input with configurable size.\n *\n * Wraps a native `<input type=\"radio\">` with consistent Tailwind styling,\n * primary color accent, and focus ring. Use with v-model for group selection.\n *\n * @example Radio group\n * <UiRadio v-model=\"selected\" value=\"a\" name=\"choice\" />\n * <UiRadio v-model=\"selected\" value=\"b\" name=\"choice\" />\n */\nimport { computed } from 'vue'\nimport { checkableSizeClass } from '../internal/controlSizes.js'\nconst props = defineProps({\n modelValue: { type: [String, Number, Boolean], default: null },\n value: { type: [String, Number, Boolean], required: true },\n name: { type: String, default: undefined },\n disabled: { type: Boolean, default: false },\n size: { type: String, default: 'md' },\n})\n\nconst emit = defineEmits(['update:modelValue'])\n\nconst sizeClass = computed(() => checkableSizeClass(props.size))\n\nfunction onChange() {\n emit('update:modelValue', props.value)\n}\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BA,MAAM,QAAQ;EAQd,MAAM,OAAO;EAEb,MAAM,YAAY,eAAe,mBAAmB,MAAM,IAAI,CAAC;EAE/D,SAAS,WAAW;GAClB,KAAK,qBAAqB,MAAM,KAAK;EACvC;;GAvCE,OAAA,UAAA,GAAA,mBASE,SAAA;IARA,MAAK;IACJ,SAAS,QAAA,eAAe,QAAA;IACxB,UAAU,QAAA;IACV,MAAM,QAAA;IACN,OAAO,QAAA;IACR,OAAK,eAAA,CAAC,6FACE,UAAA,KAAS,CAAA;IACR"}