numori-ui 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/CHANGELOG.md +120 -0
  2. package/README.md +27 -20
  3. package/dist/components/AppShell.js +234 -0
  4. package/dist/components/AppShell.js.map +1 -0
  5. package/dist/components/Avatar.js +71 -19
  6. package/dist/components/Avatar.js.map +1 -1
  7. package/dist/components/Checkbox.js +11 -2
  8. package/dist/components/Checkbox.js.map +1 -1
  9. package/dist/components/CopyField.js +195 -0
  10. package/dist/components/CopyField.js.map +1 -0
  11. package/dist/components/DescriptionList.js +116 -0
  12. package/dist/components/DescriptionList.js.map +1 -0
  13. package/dist/components/Dropdown.js +3 -1
  14. package/dist/components/Dropdown.js.map +1 -1
  15. package/dist/components/EmptyState.js +123 -0
  16. package/dist/components/EmptyState.js.map +1 -0
  17. package/dist/components/FormField.js +43 -13
  18. package/dist/components/FormField.js.map +1 -1
  19. package/dist/components/Input.js +15 -1
  20. package/dist/components/Input.js.map +1 -1
  21. package/dist/components/Modal.js +61 -4
  22. package/dist/components/Modal.js.map +1 -1
  23. package/dist/components/PageHeader.js +106 -0
  24. package/dist/components/PageHeader.js.map +1 -0
  25. package/dist/components/Pagination.js +236 -0
  26. package/dist/components/Pagination.js.map +1 -0
  27. package/dist/components/Prompt.js +11 -6
  28. package/dist/components/Prompt.js.map +1 -1
  29. package/dist/components/Segmented.js +10 -2
  30. package/dist/components/Segmented.js.map +1 -1
  31. package/dist/components/Select.js +11 -2
  32. package/dist/components/Select.js.map +1 -1
  33. package/dist/components/Sidebar.js +69 -0
  34. package/dist/components/Sidebar.js.map +1 -0
  35. package/dist/components/SidebarGroup.js +50 -0
  36. package/dist/components/SidebarGroup.js.map +1 -0
  37. package/dist/components/SidebarItem.js +167 -0
  38. package/dist/components/SidebarItem.js.map +1 -0
  39. package/dist/components/Skeleton.js +122 -0
  40. package/dist/components/Skeleton.js.map +1 -0
  41. package/dist/components/SplitPane.js +264 -0
  42. package/dist/components/SplitPane.js.map +1 -0
  43. package/dist/components/StatCard.js +185 -0
  44. package/dist/components/StatCard.js.map +1 -0
  45. package/dist/components/Table.js +182 -50
  46. package/dist/components/Table.js.map +1 -1
  47. package/dist/components/Tabs.js +216 -0
  48. package/dist/components/Tabs.js.map +1 -0
  49. package/dist/components/Toggle.js +11 -2
  50. package/dist/components/Toggle.js.map +1 -1
  51. package/dist/components/Tree.js +417 -0
  52. package/dist/components/Tree.js.map +1 -0
  53. package/dist/components/VirtualList.js +292 -0
  54. package/dist/components/VirtualList.js.map +1 -0
  55. package/dist/components/index.js +105 -81
  56. package/dist/components/index.js.map +1 -1
  57. package/dist/icons/mdi.js +12 -0
  58. package/dist/icons/mdi.js.map +1 -1
  59. package/dist/index.d.ts +16 -1
  60. package/dist/index.js +54 -39
  61. package/dist/index.js.map +1 -1
  62. package/dist/internal/focusTrap.js +163 -0
  63. package/dist/internal/focusTrap.js.map +1 -0
  64. package/dist/internal/formField.js +26 -0
  65. package/dist/internal/formField.js.map +1 -0
  66. package/dist/manifest.js +16 -1
  67. package/dist/manifest.js.map +1 -1
  68. package/package.json +1 -1
  69. package/src/components/AppShell.vue +231 -0
  70. package/src/components/Avatar.vue +69 -18
  71. package/src/components/Checkbox.vue +5 -0
  72. package/src/components/CopyField.vue +178 -0
  73. package/src/components/DescriptionList.vue +114 -0
  74. package/src/components/Dropdown.vue +4 -1
  75. package/src/components/EmptyState.vue +107 -0
  76. package/src/components/FormField.vue +37 -4
  77. package/src/components/Input.vue +9 -0
  78. package/src/components/Modal.vue +51 -3
  79. package/src/components/PageHeader.vue +102 -0
  80. package/src/components/Pagination.vue +199 -0
  81. package/src/components/Prompt.vue +14 -3
  82. package/src/components/Segmented.vue +5 -0
  83. package/src/components/Select.vue +6 -1
  84. package/src/components/Sidebar.vue +61 -0
  85. package/src/components/SidebarGroup.vue +43 -0
  86. package/src/components/SidebarItem.vue +159 -0
  87. package/src/components/Skeleton.vue +91 -0
  88. package/src/components/SplitPane.vue +264 -0
  89. package/src/components/StatCard.vue +165 -0
  90. package/src/components/Table.vue +148 -18
  91. package/src/components/Tabs.vue +217 -0
  92. package/src/components/Toggle.vue +5 -0
  93. package/src/components/Tree.vue +428 -0
  94. package/src/components/VirtualList.vue +250 -0
  95. package/src/components/index.js +45 -6
  96. package/src/icons/mdi.js +12 -0
  97. package/src/internal/focusTrap.js +185 -0
  98. package/src/internal/formField.js +23 -0
  99. package/src/manifest.js +15 -0
@@ -1,17 +1,11 @@
1
- import { computed, createCommentVNode, createElementBlock, createTextVNode, normalizeClass, openBlock, renderSlot, toDisplayString } from "vue";
1
+ import { FORM_FIELD_KEY } from "../internal/formField.js";
2
+ import { computed, createCommentVNode, createElementBlock, createTextVNode, normalizeClass, openBlock, provide, renderSlot, toDisplayString, useId } from "vue";
2
3
  //#region src/components/FormField.vue
3
- var _hoisted_1 = {
4
+ var _hoisted_1 = ["for"];
5
+ var _hoisted_2 = {
4
6
  key: 0,
5
7
  class: "font-normal text-gray-400 dark:text-gray-600"
6
8
  };
7
- var _hoisted_2 = {
8
- key: 1,
9
- class: "text-xs text-gray-500 dark:text-gray-500 mt-1"
10
- };
11
- var _hoisted_3 = {
12
- key: 2,
13
- class: "text-xs text-red-600 dark:text-red-400 mt-1"
14
- };
15
9
  var _sfc_main = {
16
10
  __name: "FormField",
17
11
  props: {
@@ -59,6 +53,16 @@ var _sfc_main = {
59
53
  inline: {
60
54
  type: Boolean,
61
55
  default: false
56
+ },
57
+ /**
58
+ * Id of the control the label points at. Generated when omitted; set it
59
+ * when the control is not a Numori UI form component.
60
+ * @type {string}
61
+ * @default ''
62
+ */
63
+ for: {
64
+ type: String,
65
+ default: ""
62
66
  }
63
67
  },
64
68
  setup(__props) {
@@ -89,19 +93,45 @@ var _sfc_main = {
89
93
  * <UiToggle v-model="ligatures" />
90
94
  * </UiFormField>
91
95
  *
96
+ * The label is associated with the control: UiInput, UiSelect, UiToggle,
97
+ * UiCheckbox and UiSegmented pick up the field's id, so the label, hint and
98
+ * error are announced by screen readers and clicking the label focuses the
99
+ * control. For any other control, give it the id passed as `for`.
100
+ *
92
101
  * @slot default — Form control (e.g. UiInput, UiSelect, UiToggle)
93
102
  */
94
103
  const props = __props;
104
+ const uid = useId();
105
+ const controlId = computed(() => props.for || `${uid}-control`);
106
+ const labelId = `${uid}-label`;
107
+ const hintId = `${uid}-hint`;
108
+ const errorId = `${uid}-error`;
109
+ provide(FORM_FIELD_KEY, {
110
+ controlId,
111
+ labelId,
112
+ describedBy: computed(() => [props.hint ? hintId : null, props.error ? errorId : null].filter(Boolean).join(" ") || void 0),
113
+ invalid: computed(() => !!props.error)
114
+ });
95
115
  const labelClasses = computed(() => props.inline ? "block text-sm font-medium text-gray-700 dark:text-gray-400" : "block text-sm font-medium text-gray-700 dark:text-gray-400 mb-1");
96
116
  return (_ctx, _cache) => {
97
117
  return openBlock(), createElementBlock("div", null, [
98
118
  __props.label ? (openBlock(), createElementBlock("label", {
99
119
  key: 0,
120
+ id: labelId,
121
+ for: controlId.value,
100
122
  class: normalizeClass(labelClasses.value)
101
- }, [createTextVNode(toDisplayString(__props.label) + " ", 1), __props.optional ? (openBlock(), createElementBlock("span", _hoisted_1, "(optional)")) : createCommentVNode("", true)], 2)) : createCommentVNode("", true),
123
+ }, [createTextVNode(toDisplayString(__props.label) + " ", 1), __props.optional ? (openBlock(), createElementBlock("span", _hoisted_2, "(optional)")) : createCommentVNode("", true)], 10, _hoisted_1)) : createCommentVNode("", true),
102
124
  renderSlot(_ctx.$slots, "default"),
103
- __props.hint ? (openBlock(), createElementBlock("p", _hoisted_2, toDisplayString(__props.hint), 1)) : createCommentVNode("", true),
104
- __props.error ? (openBlock(), createElementBlock("p", _hoisted_3, toDisplayString(__props.error), 1)) : createCommentVNode("", true)
125
+ __props.hint ? (openBlock(), createElementBlock("p", {
126
+ key: 1,
127
+ id: hintId,
128
+ class: "text-xs text-gray-500 dark:text-gray-500 mt-1"
129
+ }, toDisplayString(__props.hint), 1)) : createCommentVNode("", true),
130
+ __props.error ? (openBlock(), createElementBlock("p", {
131
+ key: 2,
132
+ id: errorId,
133
+ class: "text-xs text-red-600 dark:text-red-400 mt-1"
134
+ }, toDisplayString(__props.error), 1)) : createCommentVNode("", true)
105
135
  ]);
106
136
  };
107
137
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FormField.js","names":[],"sources":["../../src/components/FormField.vue"],"sourcesContent":["<template>\n <div>\n <label v-if=\"label\" :class=\"labelClasses\">\n {{ label }}\n <span v-if=\"optional\" class=\"font-normal text-gray-400 dark:text-gray-600\">(optional)</span>\n </label>\n <slot />\n <p v-if=\"hint\" class=\"text-xs text-gray-500 dark:text-gray-500 mt-1\">{{ hint }}</p>\n <p v-if=\"error\" class=\"text-xs text-red-600 dark:text-red-400 mt-1\">{{ error }}</p>\n </div>\n</template>\n\n<script setup>\n/**\n * UiFormField — Label + input wrapper with optional hint and error text.\n *\n * Wraps any form control (UiInput, UiSelect, etc.) with a consistent label,\n * optional \"(optional)\" suffix, hint text below the input, and error message.\n * Reduces the repeated label + div + hint pattern across all form-heavy modals.\n *\n * @example Basic field\n * <UiFormField label=\"Email\">\n * <UiInput v-model=\"email\" type=\"email\" />\n * </UiFormField>\n *\n * @example Field with hint and optional marker\n * <UiFormField label=\"Password hint\" optional hint=\"A clue to help remember\">\n * <UiInput v-model=\"hint\" />\n * </UiFormField>\n *\n * @example Field with error\n * <UiFormField label=\"Password\" :error=\"pwError\">\n * <UiInput v-model=\"pw\" type=\"password\" />\n * </UiFormField>\n *\n * @example Inline label style (no bottom margin)\n * <UiFormField label=\"Font Ligatures\" inline>\n * <UiToggle v-model=\"ligatures\" />\n * </UiFormField>\n *\n * @slot default — Form control (e.g. UiInput, UiSelect, UiToggle)\n */\nimport { computed } from 'vue'\nconst props = defineProps({\n /**\n * Label text displayed above the input.\n * @type {string}\n * @default ''\n */\n label: { type: String, default: '' },\n\n /**\n * Show \"(optional)\" suffix after the label.\n * @type {boolean}\n * @default false\n */\n optional: { type: Boolean, default: false },\n\n /**\n * Hint text displayed below the input in gray.\n * @type {string}\n * @default ''\n */\n hint: { type: String, default: '' },\n\n /**\n * Error message displayed below the input in red.\n * @type {string}\n * @default ''\n */\n error: { type: String, default: '' },\n\n /**\n * Inline label style — no bottom margin, suitable for toggle rows.\n * @type {boolean}\n * @default false\n */\n inline: { type: Boolean, default: false },\n})\n\nconst labelClasses = computed(() =>\n props.inline\n ? 'block text-sm font-medium text-gray-700 dark:text-gray-400'\n : 'block text-sm font-medium text-gray-700 dark:text-gray-400 mb-1',\n)\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2CA,MAAM,QAAQ;EAqCd,MAAM,eAAe,eACnB,MAAM,SACF,+DACA,iEACN;;GAnFE,OAAA,UAAA,GAAA,mBAQM,OAAA,MAAA;IAPS,QAAA,SAAb,UAAA,GAAA,mBAGQ,SAAA;;KAHa,OAAK,eAAE,aAAA,KAAY;IACnC,GAAA,CAAA,gBAAA,gBAAA,QAAA,KAAK,IAAG,KACX,CAAA,GAAY,QAAA,YAAZ,UAAA,GAAA,mBAA4F,QAA5F,YAA2E,YAAU,KAAA,mBAAA,IAAA,IAAA,CAAA,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA;IAEvF,WAAQ,KAAA,QAAA,SAAA;IACC,QAAA,QAAT,UAAA,GAAA,mBAAmF,KAAnF,YAAmF,gBAAX,QAAA,IAAI,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA;IACnE,QAAA,SAAT,UAAA,GAAA,mBAAmF,KAAnF,YAAmF,gBAAZ,QAAA,KAAK,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA"}
1
+ {"version":3,"file":"FormField.js","names":[],"sources":["../../src/components/FormField.vue"],"sourcesContent":["<template>\n <div>\n <label v-if=\"label\" :id=\"labelId\" :for=\"controlId\" :class=\"labelClasses\">\n {{ label }}\n <span v-if=\"optional\" class=\"font-normal text-gray-400 dark:text-gray-600\">(optional)</span>\n </label>\n <slot />\n <p v-if=\"hint\" :id=\"hintId\" class=\"text-xs text-gray-500 dark:text-gray-500 mt-1\">{{ hint }}</p>\n <p v-if=\"error\" :id=\"errorId\" class=\"text-xs text-red-600 dark:text-red-400 mt-1\">\n {{ error }}\n </p>\n </div>\n</template>\n\n<script setup>\n/**\n * UiFormField — Label + input wrapper with optional hint and error text.\n *\n * Wraps any form control (UiInput, UiSelect, etc.) with a consistent label,\n * optional \"(optional)\" suffix, hint text below the input, and error message.\n * Reduces the repeated label + div + hint pattern across all form-heavy modals.\n *\n * @example Basic field\n * <UiFormField label=\"Email\">\n * <UiInput v-model=\"email\" type=\"email\" />\n * </UiFormField>\n *\n * @example Field with hint and optional marker\n * <UiFormField label=\"Password hint\" optional hint=\"A clue to help remember\">\n * <UiInput v-model=\"hint\" />\n * </UiFormField>\n *\n * @example Field with error\n * <UiFormField label=\"Password\" :error=\"pwError\">\n * <UiInput v-model=\"pw\" type=\"password\" />\n * </UiFormField>\n *\n * @example Inline label style (no bottom margin)\n * <UiFormField label=\"Font Ligatures\" inline>\n * <UiToggle v-model=\"ligatures\" />\n * </UiFormField>\n *\n * The label is associated with the control: UiInput, UiSelect, UiToggle,\n * UiCheckbox and UiSegmented pick up the field's id, so the label, hint and\n * error are announced by screen readers and clicking the label focuses the\n * control. For any other control, give it the id passed as `for`.\n *\n * @slot default — Form control (e.g. UiInput, UiSelect, UiToggle)\n */\nimport { computed, provide, useId } from 'vue'\nimport { FORM_FIELD_KEY } from '../internal/formField.js'\nconst props = defineProps({\n /**\n * Label text displayed above the input.\n * @type {string}\n * @default ''\n */\n label: { type: String, default: '' },\n\n /**\n * Show \"(optional)\" suffix after the label.\n * @type {boolean}\n * @default false\n */\n optional: { type: Boolean, default: false },\n\n /**\n * Hint text displayed below the input in gray.\n * @type {string}\n * @default ''\n */\n hint: { type: String, default: '' },\n\n /**\n * Error message displayed below the input in red.\n * @type {string}\n * @default ''\n */\n error: { type: String, default: '' },\n\n /**\n * Inline label style — no bottom margin, suitable for toggle rows.\n * @type {boolean}\n * @default false\n */\n inline: { type: Boolean, default: false },\n\n /**\n * Id of the control the label points at. Generated when omitted; set it\n * when the control is not a Numori UI form component.\n * @type {string}\n * @default ''\n */\n for: { type: String, default: '' },\n})\n\nconst uid = useId()\nconst controlId = computed(() => props.for || `${uid}-control`)\nconst labelId = `${uid}-label`\nconst hintId = `${uid}-hint`\nconst errorId = `${uid}-error`\n\nprovide(FORM_FIELD_KEY, {\n controlId,\n labelId,\n describedBy: computed(\n () =>\n [props.hint ? hintId : null, props.error ? errorId : null].filter(Boolean).join(' ') ||\n undefined,\n ),\n invalid: computed(() => !!props.error),\n})\n\nconst labelClasses = computed(() =>\n props.inline\n ? 'block text-sm font-medium text-gray-700 dark:text-gray-400'\n : 'block text-sm font-medium text-gray-700 dark:text-gray-400 mb-1',\n)\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmDA,MAAM,QAAQ;EA6Cd,MAAM,MAAM,MAAM;EAClB,MAAM,YAAY,eAAe,MAAM,OAAO,GAAG,IAAI,SAAS;EAC9D,MAAM,UAAU,GAAG,IAAI;EACvB,MAAM,SAAS,GAAG,IAAI;EACtB,MAAM,UAAU,GAAG,IAAI;EAEvB,QAAQ,gBAAgB;GACtB;GACA;GACA,aAAa,eAET,CAAC,MAAM,OAAO,SAAS,MAAM,MAAM,QAAQ,UAAU,IAAI,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,KACnF,KAAA,CACJ;GACA,SAAS,eAAe,CAAC,CAAC,MAAM,KAAK;EACvC,CAAC;EAED,MAAM,eAAe,eACnB,MAAM,SACF,+DACA,iEACN;;GApHE,OAAA,UAAA,GAAA,mBAUM,OAAA,MAAA;IATS,QAAA,SAAb,UAAA,GAAA,mBAGQ,SAAA;;KAHa,IAAI;KAAU,KAAK,UAAA;KAAY,OAAK,eAAE,aAAA,KAAY;IAClE,GAAA,CAAA,gBAAA,gBAAA,QAAA,KAAK,IAAG,KACX,CAAA,GAAY,QAAA,YAAZ,UAAA,GAAA,mBAA4F,QAA5F,YAA2E,YAAU,KAAA,mBAAA,IAAA,IAAA,CAAA,GAAA,IAAA,UAAA,KAAA,mBAAA,IAAA,IAAA;IAEvF,WAAQ,KAAA,QAAA,SAAA;IACC,QAAA,QAAT,UAAA,GAAA,mBAAgG,KAAA;;KAAhF,IAAI;KAAQ,OAAM;IAAmD,GAAA,gBAAA,QAAA,IAAI,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA;IAChF,QAAA,SAAT,UAAA,GAAA,mBAEI,KAAA;;KAFa,IAAI;KAAS,OAAM;IAC/B,GAAA,gBAAA,QAAA,KAAK,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA"}
@@ -1,9 +1,13 @@
1
1
  import _sfc_main$1 from "../icons/Icon.js";
2
- import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, normalizeClass, normalizeStyle, openBlock, ref, renderSlot, toDisplayString, useSlots, watch, withModifiers } from "vue";
2
+ import { useFormField } from "../internal/formField.js";
3
+ import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, normalizeClass, normalizeStyle, openBlock, ref, renderSlot, toDisplayString, unref, useSlots, watch, withModifiers } from "vue";
3
4
  //#region src/components/Input.vue
4
5
  var _hoisted_1 = { class: "w-full" };
5
6
  var _hoisted_2 = { class: "relative flex" };
6
7
  var _hoisted_3 = [
8
+ "id",
9
+ "aria-describedby",
10
+ "aria-invalid",
7
11
  "value",
8
12
  "placeholder",
9
13
  "required",
@@ -17,6 +21,9 @@ var _hoisted_4 = {
17
21
  class: "absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-gray-400 dark:text-gray-500"
18
22
  };
19
23
  var _hoisted_5 = [
24
+ "id",
25
+ "aria-describedby",
26
+ "aria-invalid",
20
27
  "type",
21
28
  "value",
22
29
  "placeholder",
@@ -325,6 +332,7 @@ var _sfc_main = {
325
332
  */
326
333
  const props = __props;
327
334
  const emit = __emit;
335
+ const field = useFormField();
328
336
  const inputRef = ref(null);
329
337
  const passwordVisible = ref(false);
330
338
  const touched = ref(false);
@@ -489,8 +497,11 @@ var _sfc_main = {
489
497
  })])], 2)) : createCommentVNode("", true),
490
498
  isTextarea.value ? (openBlock(), createElementBlock("textarea", {
491
499
  key: 2,
500
+ id: unref(field)?.controlId.value,
492
501
  ref_key: "inputRef",
493
502
  ref: inputRef,
503
+ "aria-describedby": unref(field)?.describedBy.value,
504
+ "aria-invalid": unref(field)?.invalid.value ? "true" : void 0,
494
505
  value: __props.modelValue,
495
506
  placeholder: __props.placeholder,
496
507
  required: __props.required,
@@ -510,8 +521,11 @@ var _sfc_main = {
510
521
  }, null, 8, ["name"])) : createCommentVNode("", true)])])) : createCommentVNode("", true),
511
522
  !isTextarea.value ? (openBlock(), createElementBlock("input", {
512
523
  key: 4,
524
+ id: unref(field)?.controlId.value,
513
525
  ref_key: "inputRef",
514
526
  ref: inputRef,
527
+ "aria-describedby": unref(field)?.describedBy.value,
528
+ "aria-invalid": unref(field)?.invalid.value ? "true" : void 0,
515
529
  type: computedType.value,
516
530
  value: __props.modelValue,
517
531
  placeholder: __props.placeholder,
@@ -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-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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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 :id=\"field?.controlId.value\"\n ref=\"inputRef\"\n :aria-describedby=\"field?.describedBy.value\"\n :aria-invalid=\"field?.invalid.value ? 'true' : undefined\"\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 :id=\"field?.controlId.value\"\n ref=\"inputRef\"\n :aria-describedby=\"field?.describedBy.value\"\n :aria-invalid=\"field?.invalid.value ? 'true' : undefined\"\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'\nimport { useFormField } from '../internal/formField.js'\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 field = useFormField()\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkOA,MAAM,QAAQ;EA0Md,MAAM,OAAO;EAEb,MAAM,QAAQ,aAAa;EAE3B,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,MAAM,IAAI,CAAC;GACX,IAAI,MAAM,WAAW,EAAE,YAAY,MAAM;GACzC,IAAI,MAAM,WAAW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A;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,6 +1,8 @@
1
1
  import { useBackButton } from "../composables/useBackButton.js";
2
- import { Teleport, Transition, computed, createBlock, createCommentVNode, createElementBlock, createVNode, normalizeClass, onBeforeUnmount, openBlock, renderSlot, watch, withCtx, withModifiers } from "vue";
2
+ import { useFocusTrap } from "../internal/focusTrap.js";
3
+ import { Teleport, Transition, computed, createBlock, createCommentVNode, createElementBlock, createVNode, normalizeClass, onBeforeUnmount, openBlock, ref, renderSlot, watch, withCtx, withModifiers } from "vue";
3
4
  //#region src/components/Modal.vue
5
+ var _hoisted_1 = ["aria-label", "aria-labelledby"];
4
6
  var _sfc_main = {
5
7
  __name: "Modal",
6
8
  props: {
@@ -68,6 +70,35 @@ var _sfc_main = {
68
70
  padding: {
69
71
  type: String,
70
72
  default: "md:p-4"
73
+ },
74
+ /**
75
+ * Accessible name for the dialog. Prefer `labelledby` when the content has a
76
+ * visible heading.
77
+ * @type {string}
78
+ * @default ''
79
+ */
80
+ label: {
81
+ type: String,
82
+ default: ""
83
+ },
84
+ /**
85
+ * Id of the element that names the dialog, usually its heading.
86
+ * @type {string}
87
+ * @default ''
88
+ */
89
+ labelledby: {
90
+ type: String,
91
+ default: ""
92
+ },
93
+ /**
94
+ * Whether Escape closes the modal. Ignored (treated as false) when
95
+ * `persistent` is set.
96
+ * @type {boolean}
97
+ * @default true
98
+ */
99
+ closeOnEscape: {
100
+ type: Boolean,
101
+ default: true
71
102
  }
72
103
  },
73
104
  emits: ["close"],
@@ -79,6 +110,13 @@ var _sfc_main = {
79
110
  * (xs through 5xl and full-screen), persistent mode to prevent backdrop-click dismissal,
80
111
  * and customizable z-index and padding. The panel uses a scale+fade transition on enter/leave.
81
112
  *
113
+ * The panel is a real dialog: `role="dialog"` and `aria-modal="true"`, named by
114
+ * `label` or `labelledby`. While open, focus moves into the panel (unless
115
+ * something inside already has it), Tab and Shift+Tab wrap within it, Escape
116
+ * closes it (unless `persistent` or `close-on-escape` is false), and focus
117
+ * returns to whatever opened it. Stacked modals behave: only the top one
118
+ * responds to Tab and Escape.
119
+ *
82
120
  * @example Basic modal
83
121
  * <UiModal :show="isOpen" @close="isOpen = false">
84
122
  * <div class="p-6">Hello!</div>
@@ -100,12 +138,24 @@ var _sfc_main = {
100
138
  * <div class="p-6">Centered on all screens</div>
101
139
  * </UiModal>
102
140
  *
103
- * @emits {void} close — Emitted when the modal should close (backdrop click or programmatic)
141
+ * @example Named by its heading
142
+ * <UiModal :show="isOpen" labelledby="settings-title" @close="isOpen = false">
143
+ * <h2 id="settings-title">Settings</h2>
144
+ * </UiModal>
145
+ *
146
+ * @emits {void} close — Emitted when the modal should close (backdrop click, Escape,
147
+ * the Android back button, or programmatic)
104
148
  *
105
149
  * @slot default — Modal content
106
150
  */
107
151
  const props = __props;
108
152
  const emit = __emit;
153
+ const panelRef = ref(null);
154
+ useFocusTrap(() => panelRef.value, {
155
+ active: () => props.show,
156
+ escape: () => props.closeOnEscape && !props.persistent,
157
+ onEscape: () => emit("close")
158
+ });
109
159
  const { register: registerBack, unregister: unregisterBack } = useBackButton();
110
160
  let backHandlerId = null;
111
161
  watch(() => props.show, (visible) => {
@@ -185,14 +235,21 @@ var _sfc_main = {
185
235
  }, {
186
236
  default: withCtx(() => [__props.show ? (openBlock(), createElementBlock("div", {
187
237
  key: 0,
188
- class: normalizeClass(["modal-panel bg-white dark:bg-gray-925 overflow-hidden flex flex-col", [
238
+ ref_key: "panelRef",
239
+ ref: panelRef,
240
+ role: "dialog",
241
+ "aria-modal": "true",
242
+ "aria-label": __props.labelledby ? void 0 : __props.label || void 0,
243
+ "aria-labelledby": __props.labelledby || void 0,
244
+ tabindex: "-1",
245
+ class: normalizeClass(["modal-panel bg-white dark:bg-gray-925 overflow-hidden flex flex-col focus:outline-none", [
189
246
  __props.panelClass,
190
247
  maxWidthClass.value,
191
248
  roundedClass.value,
192
249
  mobileLayoutClass.value
193
250
  ]]),
194
251
  onClick: _cache[0] || (_cache[0] = withModifiers(() => {}, ["stop"]))
195
- }, [renderSlot(_ctx.$slots, "default")], 2)) : createCommentVNode("", true)]),
252
+ }, [renderSlot(_ctx.$slots, "default")], 10, _hoisted_1)) : createCommentVNode("", true)]),
196
253
  _: 3
197
254
  })], 2)) : createCommentVNode("", true)]),
198
255
  _: 3
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.js","names":["$emit"],"sources":["../../src/components/Modal.vue"],"sourcesContent":["<template>\n <!-- Teleported to body to avoid z-index stacking context issues -->\n <Teleport to=\"body\">\n <!-- Backdrop overlay with fade transition -->\n <Transition\n enter-active-class=\"transition ease-out duration-200\"\n enter-from-class=\"opacity-0\"\n enter-to-class=\"opacity-100\"\n leave-active-class=\"transition ease-in duration-150\"\n leave-from-class=\"opacity-100\"\n leave-to-class=\"opacity-0\"\n >\n <div\n v-if=\"show\"\n class=\"fixed inset-0 flex items-center justify-center\"\n :class=\"[zClass, paddingClass, backdropClass]\"\n @click.self=\"!persistent && $emit('close')\"\n >\n <Transition\n enter-active-class=\"transition ease-out duration-300\"\n enter-from-class=\"opacity-0 scale-95\"\n enter-to-class=\"opacity-100 scale-100\"\n leave-active-class=\"transition ease-in duration-200\"\n leave-from-class=\"opacity-100 scale-100\"\n leave-to-class=\"opacity-0 scale-95\"\n appear\n >\n <div\n v-if=\"show\"\n class=\"modal-panel bg-white dark:bg-gray-925 overflow-hidden flex flex-col\"\n :class=\"[panelClass, maxWidthClass, roundedClass, mobileLayoutClass]\"\n @click.stop\n >\n <slot />\n </div>\n </Transition>\n </div>\n </Transition>\n </Teleport>\n</template>\n\n<script setup>\n/**\n * UiModal — Teleported modal dialog with backdrop, configurable max-width, and enter/leave transitions.\n *\n * Renders a centered overlay panel teleported to `<body>`. Supports ten max-width presets\n * (xs through 5xl and full-screen), persistent mode to prevent backdrop-click dismissal,\n * and customizable z-index and padding. The panel uses a scale+fade transition on enter/leave.\n *\n * @example Basic modal\n * <UiModal :show=\"isOpen\" @close=\"isOpen = false\">\n * <div class=\"p-6\">Hello!</div>\n * </UiModal>\n *\n * @example Large persistent modal\n * <UiModal :show=\"showEditor\" max-width=\"3xl\" persistent>\n * <ModalHeader @close=\"showEditor = false\" />\n * <div class=\"p-6\">Editor content</div>\n * </UiModal>\n *\n * @example Full-screen modal\n * <UiModal :show=\"showFull\" max-width=\"full\">\n * <div class=\"h-full\">Full screen content</div>\n * </UiModal>\n *\n * @example Non-fullscreen on mobile\n * <UiModal :show=\"isOpen\" :fullscreen-mobile=\"false\" @close=\"isOpen = false\">\n * <div class=\"p-6\">Centered on all screens</div>\n * </UiModal>\n *\n * @emits {void} close — Emitted when the modal should close (backdrop click or programmatic)\n *\n * @slot default — Modal content\n */\nimport { computed, watch, onBeforeUnmount } from 'vue'\nimport { useBackButton } from '../composables/useBackButton.js'\nconst props = defineProps({\n /**\n * Controls modal visibility. Use with v-model or :show + @close.\n * @type {boolean}\n * @default false\n */\n show: { type: Boolean, default: false },\n\n /**\n * Maximum width preset for the modal panel.\n * @type {string}\n * @default 'sm'\n * @values 'xs' (20rem) | 'sm' (24rem) | 'md' (28rem) | 'lg' (32rem) | 'xl' (36rem) | '2xl' (42rem) | '3xl' (48rem) | '4xl' (56rem) | '5xl' (64rem) | 'full'\n */\n maxWidth: { type: String, default: 'sm' },\n\n /**\n * Whether the modal goes fullscreen on mobile viewports.\n * When true, the panel fills the screen on mobile and respects safe area insets.\n * @type {boolean}\n * @default true\n */\n fullscreenMobile: { type: Boolean, default: true },\n\n /**\n * Persistent mode — prevents closing when clicking the backdrop overlay.\n * @type {boolean}\n * @default false\n */\n persistent: { type: Boolean, default: false },\n\n /**\n * Additional CSS classes applied to the modal panel element.\n * @type {string}\n * @default ''\n */\n panelClass: { type: String, default: '' },\n\n /**\n * Z-index class for the backdrop and modal layers.\n * @type {string}\n * @default 'z-50'\n */\n z: { type: String, default: 'z-50' },\n\n /**\n * Padding class around the modal panel (applied to the backdrop container).\n * @type {string}\n * @default 'md:p-4'\n */\n padding: { type: String, default: 'md:p-4' },\n})\n\nconst emit = defineEmits(['close'])\n\n// ── Back-button interception (Capacitor) ──\nconst { register: registerBack, unregister: unregisterBack } = useBackButton()\nlet backHandlerId = null\n\nwatch(\n () => props.show,\n (visible) => {\n if (visible) {\n backHandlerId = registerBack(() => {\n if (props.persistent) return false\n emit('close')\n return true\n })\n } else if (backHandlerId !== null) {\n unregisterBack(backHandlerId)\n backHandlerId = null\n }\n },\n { immediate: true },\n)\n\nonBeforeUnmount(() => {\n if (backHandlerId !== null) {\n unregisterBack(backHandlerId)\n backHandlerId = null\n }\n})\n\nconst zClass = computed(() => props.z)\nconst paddingClass = computed(() => props.padding)\n\nconst backdropClass = computed(() => {\n if (props.fullscreenMobile) {\n return 'bg-transparent md:bg-black/50'\n }\n return 'bg-black/50 p-4'\n})\n\nconst mobileLayoutClass = computed(() => {\n if (props.maxWidth === 'full') return 'fixed inset-0'\n\n if (props.fullscreenMobile) {\n return 'fixed inset-0 modal-panel--safe-area md:static md:inset-auto'\n }\n // Non-fullscreen on mobile: centered dialog with max-height\n return 'relative max-h-[calc(100vh-2rem)] md:static'\n})\n\nconst maxWidthClass = computed(() => {\n if (props.maxWidth === 'full') return 'w-full h-full'\n\n const map = {\n xs: 'md:max-w-xs',\n sm: 'md:max-w-sm',\n md: 'md:max-w-md',\n lg: 'md:max-w-lg',\n xl: 'md:max-w-xl',\n '2xl': 'md:max-w-2xl',\n '3xl': 'md:max-w-3xl',\n '4xl': 'md:max-w-4xl',\n '5xl': 'md:max-w-5xl',\n }\n\n if (props.fullscreenMobile) {\n return `md:w-full ${map[props.maxWidth] || map.sm}`\n }\n return `w-full ${map[props.maxWidth] || map.sm}`\n})\n\nconst roundedClass = computed(() => {\n if (props.maxWidth === 'full') return 'rounded-none'\n\n if (props.fullscreenMobile) {\n return 'rounded-none md:rounded-lg'\n }\n return 'rounded-lg'\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4EA,MAAM,QAAQ;EAqDd,MAAM,OAAO;EAGb,MAAM,EAAE,UAAU,cAAc,YAAY,mBAAmB,cAAc;EAC7E,IAAI,gBAAgB;EAEpB,YACQ,MAAM,OACX,YAAY;GACX,IAAI,SACF,gBAAgB,mBAAmB;IACjC,IAAI,MAAM,YAAY,OAAO;IAC7B,KAAK,OAAO;IACZ,OAAO;GACT,CAAC;QACI,IAAI,kBAAkB,MAAM;IACjC,eAAe,aAAa;IAC5B,gBAAgB;GAClB;EACF,GACA,EAAE,WAAW,KAAK,CACpB;EAEA,sBAAsB;GACpB,IAAI,kBAAkB,MAAM;IAC1B,eAAe,aAAa;IAC5B,gBAAgB;GAClB;EACF,CAAC;EAED,MAAM,SAAS,eAAe,MAAM,CAAC;EACrC,MAAM,eAAe,eAAe,MAAM,OAAO;EAEjD,MAAM,gBAAgB,eAAe;GACnC,IAAI,MAAM,k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ClE,QAAA;OAAY,cAAA;OAAe,aAAA;OAAc,kBAAA;MAAiB,CAAA,CAAA;MAClE,SAAK,OAAA,OAAA,OAAA,KAAA,oBAAN,CAAA,GAAW,CAAA,MAAA,CAAA;KAEX,GAAA,CAAA,WAAQ,KAAA,QAAA,SAAA,CAAA,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"Modal.js","names":["$emit"],"sources":["../../src/components/Modal.vue"],"sourcesContent":["<template>\n <!-- Teleported to body to avoid z-index stacking context issues -->\n <Teleport to=\"body\">\n <!-- Backdrop overlay with fade transition -->\n <Transition\n enter-active-class=\"transition ease-out duration-200\"\n enter-from-class=\"opacity-0\"\n enter-to-class=\"opacity-100\"\n leave-active-class=\"transition ease-in duration-150\"\n leave-from-class=\"opacity-100\"\n leave-to-class=\"opacity-0\"\n >\n <div\n v-if=\"show\"\n class=\"fixed inset-0 flex items-center justify-center\"\n :class=\"[zClass, paddingClass, backdropClass]\"\n @click.self=\"!persistent && $emit('close')\"\n >\n <Transition\n enter-active-class=\"transition ease-out duration-300\"\n enter-from-class=\"opacity-0 scale-95\"\n enter-to-class=\"opacity-100 scale-100\"\n leave-active-class=\"transition ease-in duration-200\"\n leave-from-class=\"opacity-100 scale-100\"\n leave-to-class=\"opacity-0 scale-95\"\n appear\n >\n <div\n v-if=\"show\"\n ref=\"panelRef\"\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-label=\"labelledby ? undefined : label || undefined\"\n :aria-labelledby=\"labelledby || undefined\"\n tabindex=\"-1\"\n class=\"modal-panel bg-white dark:bg-gray-925 overflow-hidden flex flex-col focus:outline-none\"\n :class=\"[panelClass, maxWidthClass, roundedClass, mobileLayoutClass]\"\n @click.stop\n >\n <slot />\n </div>\n </Transition>\n </div>\n </Transition>\n </Teleport>\n</template>\n\n<script setup>\n/**\n * UiModal — Teleported modal dialog with backdrop, configurable max-width, and enter/leave transitions.\n *\n * Renders a centered overlay panel teleported to `<body>`. Supports ten max-width presets\n * (xs through 5xl and full-screen), persistent mode to prevent backdrop-click dismissal,\n * and customizable z-index and padding. The panel uses a scale+fade transition on enter/leave.\n *\n * The panel is a real dialog: `role=\"dialog\"` and `aria-modal=\"true\"`, named by\n * `label` or `labelledby`. While open, focus moves into the panel (unless\n * something inside already has it), Tab and Shift+Tab wrap within it, Escape\n * closes it (unless `persistent` or `close-on-escape` is false), and focus\n * returns to whatever opened it. Stacked modals behave: only the top one\n * responds to Tab and Escape.\n *\n * @example Basic modal\n * <UiModal :show=\"isOpen\" @close=\"isOpen = false\">\n * <div class=\"p-6\">Hello!</div>\n * </UiModal>\n *\n * @example Large persistent modal\n * <UiModal :show=\"showEditor\" max-width=\"3xl\" persistent>\n * <ModalHeader @close=\"showEditor = false\" />\n * <div class=\"p-6\">Editor content</div>\n * </UiModal>\n *\n * @example Full-screen modal\n * <UiModal :show=\"showFull\" max-width=\"full\">\n * <div class=\"h-full\">Full screen content</div>\n * </UiModal>\n *\n * @example Non-fullscreen on mobile\n * <UiModal :show=\"isOpen\" :fullscreen-mobile=\"false\" @close=\"isOpen = false\">\n * <div class=\"p-6\">Centered on all screens</div>\n * </UiModal>\n *\n * @example Named by its heading\n * <UiModal :show=\"isOpen\" labelledby=\"settings-title\" @close=\"isOpen = false\">\n * <h2 id=\"settings-title\">Settings</h2>\n * </UiModal>\n *\n * @emits {void} close — Emitted when the modal should close (backdrop click, Escape,\n * the Android back button, or programmatic)\n *\n * @slot default — Modal content\n */\nimport { computed, ref, watch, onBeforeUnmount } from 'vue'\nimport { useBackButton } from '../composables/useBackButton.js'\nimport { useFocusTrap } from '../internal/focusTrap.js'\nconst props = defineProps({\n /**\n * Controls modal visibility. Use with v-model or :show + @close.\n * @type {boolean}\n * @default false\n */\n show: { type: Boolean, default: false },\n\n /**\n * Maximum width preset for the modal panel.\n * @type {string}\n * @default 'sm'\n * @values 'xs' (20rem) | 'sm' (24rem) | 'md' (28rem) | 'lg' (32rem) | 'xl' (36rem) | '2xl' (42rem) | '3xl' (48rem) | '4xl' (56rem) | '5xl' (64rem) | 'full'\n */\n maxWidth: { type: String, default: 'sm' },\n\n /**\n * Whether the modal goes fullscreen on mobile viewports.\n * When true, the panel fills the screen on mobile and respects safe area insets.\n * @type {boolean}\n * @default true\n */\n fullscreenMobile: { type: Boolean, default: true },\n\n /**\n * Persistent mode — prevents closing when clicking the backdrop overlay.\n * @type {boolean}\n * @default false\n */\n persistent: { type: Boolean, default: false },\n\n /**\n * Additional CSS classes applied to the modal panel element.\n * @type {string}\n * @default ''\n */\n panelClass: { type: String, default: '' },\n\n /**\n * Z-index class for the backdrop and modal layers.\n * @type {string}\n * @default 'z-50'\n */\n z: { type: String, default: 'z-50' },\n\n /**\n * Padding class around the modal panel (applied to the backdrop container).\n * @type {string}\n * @default 'md:p-4'\n */\n padding: { type: String, default: 'md:p-4' },\n /**\n * Accessible name for the dialog. Prefer `labelledby` when the content has a\n * visible heading.\n * @type {string}\n * @default ''\n */\n label: { type: String, default: '' },\n /**\n * Id of the element that names the dialog, usually its heading.\n * @type {string}\n * @default ''\n */\n labelledby: { type: String, default: '' },\n /**\n * Whether Escape closes the modal. Ignored (treated as false) when\n * `persistent` is set.\n * @type {boolean}\n * @default true\n */\n closeOnEscape: { type: Boolean, default: true },\n})\n\nconst emit = defineEmits(['close'])\n\n// ── Focus: move in, keep in, put back ──\nconst panelRef = ref(null)\nuseFocusTrap(() => panelRef.value, {\n active: () => props.show,\n escape: () => props.closeOnEscape && !props.persistent,\n onEscape: () => emit('close'),\n})\n\n// ── Back-button interception (Capacitor) ──\nconst { register: registerBack, unregister: unregisterBack } = useBackButton()\nlet backHandlerId = null\n\nwatch(\n () => props.show,\n (visible) => {\n if (visible) {\n backHandlerId = registerBack(() => {\n if (props.persistent) return false\n emit('close')\n return true\n })\n } else if (backHandlerId !== null) {\n unregisterBack(backHandlerId)\n backHandlerId = null\n }\n },\n { immediate: true },\n)\n\nonBeforeUnmount(() => {\n if (backHandlerId !== null) {\n unregisterBack(backHandlerId)\n backHandlerId = null\n }\n})\n\nconst zClass = computed(() => props.z)\nconst paddingClass = computed(() => props.padding)\n\nconst backdropClass = computed(() => {\n if (props.fullscreenMobile) {\n return 'bg-transparent md:bg-black/50'\n }\n return 'bg-black/50 p-4'\n})\n\nconst mobileLayoutClass = computed(() => {\n if (props.maxWidth === 'full') return 'fixed inset-0'\n\n if (props.fullscreenMobile) {\n return 'fixed inset-0 modal-panel--safe-area md:static md:inset-auto'\n }\n // Non-fullscreen on mobile: centered dialog with max-height\n return 'relative max-h-[calc(100vh-2rem)] md:static'\n})\n\nconst maxWidthClass = computed(() => {\n if (props.maxWidth === 'full') return 'w-full h-full'\n\n const map = {\n xs: 'md:max-w-xs',\n sm: 'md:max-w-sm',\n md: 'md:max-w-md',\n lg: 'md:max-w-lg',\n xl: 'md:max-w-xl',\n '2xl': 'md:max-w-2xl',\n '3xl': 'md:max-w-3xl',\n '4xl': 'md:max-w-4xl',\n '5xl': 'md:max-w-5xl',\n }\n\n if (props.fullscreenMobile) {\n return `md:w-full ${map[props.maxWidth] || map.sm}`\n }\n return `w-full ${map[props.maxWidth] || map.sm}`\n})\n\nconst roundedClass = computed(() => {\n if (props.maxWidth === 'full') return 'rounded-none'\n\n if (props.fullscreenMobile) {\n return 'rounded-none md:rounded-lg'\n }\n return 'rounded-lg'\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgGA,MAAM,QAAQ;EAyEd,MAAM,OAAO;EAGb,MAAM,WAAW,IAAI,IAAI;EACzB,mBAAmB,SAAS,OAAO;GACjC,cAAc,MAAM;GACpB,cAAc,MAAM,iBAAiB,CAAC,MAAM;GAC5C,gBAAgB,KAAK,OAAO;EAC9B,CAAC;EAGD,MAA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IACjB,kBAAe;;IAEf,SAAA,cA8BM,CA7BE,QAAA,QADR,UAAA,GAAA,mBA8BM,OAAA;;KA5BJ,OAAK,eAAA,CAAC,kDAAgD;MAC7C,OAAA;MAAQ,aAAA;MAAc,cAAA;KAAa,CAAA,CAAA;KAC3C,SAAK,OAAA,OAAA,OAAA,KAAA,eAAA,WAAA,CAAQ,QAAA,cAAcA,KAAAA,MAAK,OAAA,GAAA,CAAA,MAAA,CAAA;IAEjC,GAAA,CAAA,YAuBa,YAAA;KAtBX,sBAAmB;KACnB,oBAAiB;KACjB,kBAAe;KACf,sBAAmB;KACnB,oBAAiB;KACjB,kBAAe;KACf,QAAA;;KAEA,SAAA,cAaM,CAZE,QAAA,QADR,UAAA,GAAA,mBAaM,OAAA;;MAXA,SAAA;MAAJ,KAAI;MACJ,MAAK;MACL,cAAW;MACV,cAAY,QAAA,aAAa,KAAA,IAAY,QAAA,SAAS,KAAA;MAC9C,mBAAiB,QAAA,cAAc,KAAA;MAChC,UAAS;MACT,OAAK,eAAA,CAAC,0FAAwF;OACrF,QAAA;OAAY,cAAA;OAAe,aAAA;OAAc,kBAAA;MAAiB,CAAA,CAAA;MAClE,SAAK,OAAA,OAAA,OAAA,KAAA,oBAAN,CAAA,GAAW,CAAA,MAAA,CAAA;KAEX,GAAA,CAAA,WAAQ,KAAA,QAAA,SAAA,CAAA,GAAA,IAAA,UAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,CAAA"}
@@ -0,0 +1,106 @@
1
+ import { useMergedClasses } from "../composables/useMergedClasses.js";
2
+ import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, mergeProps, openBlock, renderSlot, resolveDynamicComponent, toDisplayString, unref, withCtx } from "vue";
3
+ //#region src/components/PageHeader.vue
4
+ var _hoisted_1 = {
5
+ key: 0,
6
+ class: "mb-3"
7
+ };
8
+ var _hoisted_2 = { class: "flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between" };
9
+ var _hoisted_3 = { class: "min-w-0 flex-1" };
10
+ var _hoisted_4 = { class: "flex flex-wrap items-center gap-x-3 gap-y-2" };
11
+ var _hoisted_5 = {
12
+ key: 0,
13
+ class: "mt-1 max-w-3xl text-sm text-gray-600 dark:text-gray-400"
14
+ };
15
+ var _hoisted_6 = {
16
+ key: 0,
17
+ class: "flex shrink-0 flex-wrap items-center gap-2"
18
+ };
19
+ var _sfc_main = /*@__PURE__*/ Object.assign({ inheritAttrs: false }, {
20
+ __name: "PageHeader",
21
+ props: {
22
+ /**
23
+ * Page title.
24
+ * @type {string}
25
+ * @default ''
26
+ */
27
+ title: {
28
+ type: String,
29
+ default: ""
30
+ },
31
+ /**
32
+ * One line explaining the page.
33
+ * @type {string}
34
+ * @default ''
35
+ */
36
+ description: {
37
+ type: String,
38
+ default: ""
39
+ },
40
+ /**
41
+ * Heading level of the title.
42
+ * @type {number}
43
+ * @default 1
44
+ * @values 1 | 2 | 3
45
+ */
46
+ level: {
47
+ type: Number,
48
+ default: 1
49
+ },
50
+ /**
51
+ * Draw a rule below the header.
52
+ * @type {boolean}
53
+ * @default false
54
+ */
55
+ bordered: {
56
+ type: Boolean,
57
+ default: false
58
+ }
59
+ },
60
+ setup(__props) {
61
+ /**
62
+ * UiPageHeader — the title block at the top of an application page: optional
63
+ * breadcrumb, heading, badges, a line of description and the page's actions.
64
+ *
65
+ * Actions sit to the right on wide screens and wrap below the title on narrow
66
+ * ones. The heading is an `<h1>` by default; lower it with `level` when the
67
+ * header sits inside a section that already has one.
68
+ *
69
+ * @example
70
+ * <UiPageHeader title="Apps" description="Every application that syncs through this service.">
71
+ * <template #actions>
72
+ * <UiButton><UiIcon name="mdi:plus" class="size-4" />New app</UiButton>
73
+ * </template>
74
+ * </UiPageHeader>
75
+ *
76
+ * @example With breadcrumb and a status badge
77
+ * <UiPageHeader title="notes">
78
+ * <template #breadcrumb><UiBreadcrumb :items="crumbs" /></template>
79
+ * <template #meta><UiBadge color="green">Active</UiBadge></template>
80
+ * </UiPageHeader>
81
+ *
82
+ * @slot title — Rich title content (overrides `title`).
83
+ * @slot meta — Inline content after the title, such as badges.
84
+ * @slot description — Rich description (overrides `description`).
85
+ * @slot breadcrumb — Content above the title, usually a `UiBreadcrumb`.
86
+ * @slot actions — Buttons for the page's primary actions.
87
+ */
88
+ const props = __props;
89
+ const headingTag = computed(() => `h${[
90
+ 1,
91
+ 2,
92
+ 3
93
+ ].includes(props.level) ? props.level : 1}`);
94
+ const { mergedClasses, restAttrs } = useMergedClasses(() => props.bordered ? "mb-6 border-b border-gray-200 pb-5 dark:border-gray-800" : "mb-6");
95
+ return (_ctx, _cache) => {
96
+ return openBlock(), createElementBlock("div", mergeProps({ class: unref(mergedClasses) }, unref(restAttrs)), [_ctx.$slots.breadcrumb ? (openBlock(), createElementBlock("div", _hoisted_1, [renderSlot(_ctx.$slots, "breadcrumb")])) : createCommentVNode("", true), createElementVNode("div", _hoisted_2, [createElementVNode("div", _hoisted_3, [createElementVNode("div", _hoisted_4, [(openBlock(), createBlock(resolveDynamicComponent(headingTag.value), { class: "min-w-0 truncate text-2xl font-semibold tracking-tight text-gray-900 dark:text-gray-50" }, {
97
+ default: withCtx(() => [renderSlot(_ctx.$slots, "title", {}, () => [createTextVNode(toDisplayString(__props.title), 1)])]),
98
+ _: 3
99
+ })), renderSlot(_ctx.$slots, "meta")]), __props.description || _ctx.$slots.description ? (openBlock(), createElementBlock("p", _hoisted_5, [renderSlot(_ctx.$slots, "description", {}, () => [createTextVNode(toDisplayString(__props.description), 1)])])) : createCommentVNode("", true)]), _ctx.$slots.actions ? (openBlock(), createElementBlock("div", _hoisted_6, [renderSlot(_ctx.$slots, "actions")])) : createCommentVNode("", true)])], 16);
100
+ };
101
+ }
102
+ });
103
+ //#endregion
104
+ export { _sfc_main as default };
105
+
106
+ //# sourceMappingURL=PageHeader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PageHeader.js","names":["$slots"],"sources":["../../src/components/PageHeader.vue"],"sourcesContent":["<template>\n <div :class=\"mergedClasses\" v-bind=\"restAttrs\">\n <div v-if=\"$slots.breadcrumb\" class=\"mb-3\">\n <slot name=\"breadcrumb\" />\n </div>\n\n <div class=\"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between\">\n <div class=\"min-w-0 flex-1\">\n <div class=\"flex flex-wrap items-center gap-x-3 gap-y-2\">\n <component\n :is=\"headingTag\"\n class=\"min-w-0 truncate text-2xl font-semibold tracking-tight text-gray-900 dark:text-gray-50\"\n >\n <slot name=\"title\">{{ title }}</slot>\n </component>\n <slot name=\"meta\" />\n </div>\n <p\n v-if=\"description || $slots.description\"\n class=\"mt-1 max-w-3xl text-sm text-gray-600 dark:text-gray-400\"\n >\n <slot name=\"description\">{{ description }}</slot>\n </p>\n </div>\n\n <div v-if=\"$slots.actions\" class=\"flex shrink-0 flex-wrap items-center gap-2\">\n <slot name=\"actions\" />\n </div>\n </div>\n </div>\n</template>\n\n<script setup>\n/**\n * UiPageHeader — the title block at the top of an application page: optional\n * breadcrumb, heading, badges, a line of description and the page's actions.\n *\n * Actions sit to the right on wide screens and wrap below the title on narrow\n * ones. The heading is an `<h1>` by default; lower it with `level` when the\n * header sits inside a section that already has one.\n *\n * @example\n * <UiPageHeader title=\"Apps\" description=\"Every application that syncs through this service.\">\n * <template #actions>\n * <UiButton><UiIcon name=\"mdi:plus\" class=\"size-4\" />New app</UiButton>\n * </template>\n * </UiPageHeader>\n *\n * @example With breadcrumb and a status badge\n * <UiPageHeader title=\"notes\">\n * <template #breadcrumb><UiBreadcrumb :items=\"crumbs\" /></template>\n * <template #meta><UiBadge color=\"green\">Active</UiBadge></template>\n * </UiPageHeader>\n *\n * @slot title — Rich title content (overrides `title`).\n * @slot meta — Inline content after the title, such as badges.\n * @slot description — Rich description (overrides `description`).\n * @slot breadcrumb — Content above the title, usually a `UiBreadcrumb`.\n * @slot actions — Buttons for the page's primary actions.\n */\nimport { computed } from 'vue'\nimport { useMergedClasses } from '../composables/useMergedClasses.js'\n\nconst props = defineProps({\n /**\n * Page title.\n * @type {string}\n * @default ''\n */\n title: { type: String, default: '' },\n\n /**\n * One line explaining the page.\n * @type {string}\n * @default ''\n */\n description: { type: String, default: '' },\n\n /**\n * Heading level of the title.\n * @type {number}\n * @default 1\n * @values 1 | 2 | 3\n */\n level: { type: Number, default: 1 },\n\n /**\n * Draw a rule below the header.\n * @type {boolean}\n * @default false\n */\n bordered: { type: Boolean, default: false },\n})\n\ndefineOptions({ inheritAttrs: false })\n\nconst headingTag = computed(() => `h${[1, 2, 3].includes(props.level) ? props.level : 1}`)\n\nconst { mergedClasses, restAttrs } = useMergedClasses(() =>\n props.bordered ? 'mb-6 border-b border-gray-200 pb-5 dark:border-gray-800' : 'mb-6',\n)\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+DA,MAAM,QAAQ;EAiCd,MAAM,aAAa,eAAe,IAAI;GAAC;GAAG;GAAG;EAAC,CAAC,CAAC,SAAS,MAAM,KAAK,IAAI,MAAM,QAAQ,GAAG;EAEzF,MAAM,EAAE,eAAe,cAAc,uBACnC,MAAM,WAAW,4DAA4D,MAC/E;;GAnGE,OAAA,UAAA,GAAA,mBA4BM,OA5BN,WA4BM,EA5BA,OAAO,MAAA,aAAA,EAAa,GAAU,MAAA,SAAA,CAAS,GAAA,CAChCA,KAAAA,OAAO,cAAlB,UAAA,GAAA,mBAEM,OAFN,YAEM,CADJ,WAA0B,KAAA,QAAA,YAAA,CAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,GAG5B,mBAsBM,OAtBN,YAsBM,CArBJ,mBAgBM,OAhBN,YAgBM,CAfJ,mBAQM,OARN,YAQM,EAPJ,UAAA,GAAA,YAKY,wBAJL,WAAA,KAAU,GAAA,EACf,OAAM,yFAAwF,GAAA;IAE9F,SAAA,cAAqC,CAArC,WAAqC,KAAA,QAAA,SAAA,CAAA,SAAA,CAAf,gBAA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