mood-ui 0.14.0 → 0.15.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 (199) hide show
  1. package/README.md +1 -1
  2. package/dist/components/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.mjs +6 -6
  3. package/dist/components/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  4. package/dist/components/data-display/calendar/Calendar.vue_vue_type_script_setup_true_lang.mjs +4 -4
  5. package/dist/components/data-display/calendar/Calendar.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  6. package/dist/components/data-display/calendar/DayView.vue_vue_type_script_setup_true_lang.mjs +7 -7
  7. package/dist/components/data-display/calendar/DayView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  8. package/dist/components/data-display/calendar/MonthView.vue_vue_type_script_setup_true_lang.mjs +2 -2
  9. package/dist/components/data-display/calendar/MonthView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  10. package/dist/components/data-display/calendar/Scheduler.vue_vue_type_script_setup_true_lang.mjs +7 -7
  11. package/dist/components/data-display/calendar/Scheduler.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  12. package/dist/components/data-display/calendar/WeekView.vue_vue_type_script_setup_true_lang.mjs +7 -7
  13. package/dist/components/data-display/calendar/WeekView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  14. package/dist/components/data-display/date-picker/DateRangePicker.vue_vue_type_script_setup_true_lang.mjs +3 -3
  15. package/dist/components/data-display/date-picker/DateRangePicker.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  16. package/dist/components/data-display/date-picker/DateTimePicker.vue_vue_type_script_setup_true_lang.mjs +2 -2
  17. package/dist/components/data-display/date-picker/DateTimePicker.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  18. package/dist/components/data-display/table/Table.cjs +1 -1
  19. package/dist/components/data-display/table/Table.cjs.map +1 -1
  20. package/dist/components/data-display/table/Table.mjs +1 -1
  21. package/dist/components/data-display/table/Table.mjs.map +1 -1
  22. package/dist/components/data-display/table/Table.vue_vue_type_script_setup_true_lang.cjs +37 -1
  23. package/dist/components/data-display/table/Table.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  24. package/dist/components/data-display/table/Table.vue_vue_type_script_setup_true_lang.mjs +38 -2
  25. package/dist/components/data-display/table/Table.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  26. package/dist/components/data-display/table/TablePagination.cjs.map +1 -1
  27. package/dist/components/data-display/table/TablePagination.mjs.map +1 -1
  28. package/dist/components/data-display/table/TablePagination.vue_vue_type_script_setup_true_lang.cjs +24 -16
  29. package/dist/components/data-display/table/TablePagination.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  30. package/dist/components/data-display/table/TablePagination.vue_vue_type_script_setup_true_lang.mjs +24 -16
  31. package/dist/components/data-display/table/TablePagination.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  32. package/dist/components/feedback/Banner.vue_vue_type_script_setup_true_lang.mjs +4 -4
  33. package/dist/components/feedback/Banner.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  34. package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.mjs +5 -5
  35. package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  36. package/dist/components/feedback/EmptyState.cjs.map +1 -1
  37. package/dist/components/feedback/EmptyState.mjs.map +1 -1
  38. package/dist/components/feedback/EmptyState.vue_vue_type_script_setup_true_lang.cjs +1 -1
  39. package/dist/components/feedback/EmptyState.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  40. package/dist/components/feedback/EmptyState.vue_vue_type_script_setup_true_lang.mjs +1 -1
  41. package/dist/components/feedback/EmptyState.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  42. package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.mjs +5 -5
  43. package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  44. package/dist/components/feedback/tour/Tour.vue_vue_type_script_setup_true_lang.cjs +369 -0
  45. package/dist/components/feedback/tour/Tour.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
  46. package/dist/components/feedback/tour/Tour.vue_vue_type_script_setup_true_lang.mjs +368 -0
  47. package/dist/components/feedback/tour/Tour.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
  48. package/dist/components/feedback/tour/Tour2.cjs +6 -0
  49. package/dist/components/feedback/tour/Tour2.cjs.map +1 -0
  50. package/dist/components/feedback/tour/Tour2.mjs +7 -0
  51. package/dist/components/feedback/tour/Tour2.mjs.map +1 -0
  52. package/dist/components/feedback/tour/TourCard.cjs +6 -0
  53. package/dist/components/feedback/tour/TourCard.cjs.map +1 -0
  54. package/dist/components/feedback/tour/TourCard.mjs +7 -0
  55. package/dist/components/feedback/tour/TourCard.mjs.map +1 -0
  56. package/dist/components/feedback/tour/TourCard.vue_vue_type_script_setup_true_lang.cjs +102 -0
  57. package/dist/components/feedback/tour/TourCard.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
  58. package/dist/components/feedback/tour/TourCard.vue_vue_type_script_setup_true_lang.mjs +101 -0
  59. package/dist/components/feedback/tour/TourCard.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
  60. package/dist/components/feedback/tour/tourAnchor.cjs +75 -0
  61. package/dist/components/feedback/tour/tourAnchor.cjs.map +1 -0
  62. package/dist/components/feedback/tour/tourAnchor.mjs +72 -0
  63. package/dist/components/feedback/tour/tourAnchor.mjs.map +1 -0
  64. package/dist/components/feedback/tour/tourPlace.cjs +108 -0
  65. package/dist/components/feedback/tour/tourPlace.cjs.map +1 -0
  66. package/dist/components/feedback/tour/tourPlace.mjs +107 -0
  67. package/dist/components/feedback/tour/tourPlace.mjs.map +1 -0
  68. package/dist/components/feedback/tour/tourShape.cjs +121 -0
  69. package/dist/components/feedback/tour/tourShape.cjs.map +1 -0
  70. package/dist/components/feedback/tour/tourShape.mjs +118 -0
  71. package/dist/components/feedback/tour/tourShape.mjs.map +1 -0
  72. package/dist/components/feedback/tour/useTourSpotlight.cjs +60 -0
  73. package/dist/components/feedback/tour/useTourSpotlight.cjs.map +1 -0
  74. package/dist/components/feedback/tour/useTourSpotlight.mjs +59 -0
  75. package/dist/components/feedback/tour/useTourSpotlight.mjs.map +1 -0
  76. package/dist/components/feedback/tour/useTourSteps.cjs +108 -0
  77. package/dist/components/feedback/tour/useTourSteps.cjs.map +1 -0
  78. package/dist/components/feedback/tour/useTourSteps.mjs +107 -0
  79. package/dist/components/feedback/tour/useTourSteps.mjs.map +1 -0
  80. package/dist/components/forms/Button.cjs +1 -1
  81. package/dist/components/forms/Button.cjs.map +1 -1
  82. package/dist/components/forms/Button.mjs +1 -1
  83. package/dist/components/forms/Button.mjs.map +1 -1
  84. package/dist/components/forms/Button.vue_vue_type_script_setup_true_lang.cjs +1 -1
  85. package/dist/components/forms/Button.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  86. package/dist/components/forms/Button.vue_vue_type_script_setup_true_lang.mjs +1 -1
  87. package/dist/components/forms/Button.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  88. package/dist/components/forms/FileInput.cjs +1 -1
  89. package/dist/components/forms/FileInput.cjs.map +1 -1
  90. package/dist/components/forms/FileInput.mjs +1 -1
  91. package/dist/components/forms/FileInput.mjs.map +1 -1
  92. package/dist/components/forms/FileInput.vue_vue_type_script_setup_true_lang.cjs +34 -17
  93. package/dist/components/forms/FileInput.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  94. package/dist/components/forms/FileInput.vue_vue_type_script_setup_true_lang.mjs +34 -17
  95. package/dist/components/forms/FileInput.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  96. package/dist/components/forms/MultiSelect.cjs +1 -1
  97. package/dist/components/forms/MultiSelect.cjs.map +1 -1
  98. package/dist/components/forms/MultiSelect.mjs +1 -1
  99. package/dist/components/forms/MultiSelect.mjs.map +1 -1
  100. package/dist/components/forms/MultiSelect.vue_vue_type_script_setup_true_lang.cjs +2 -1
  101. package/dist/components/forms/MultiSelect.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  102. package/dist/components/forms/MultiSelect.vue_vue_type_script_setup_true_lang.mjs +2 -1
  103. package/dist/components/forms/MultiSelect.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  104. package/dist/components/forms/TagInput.cjs.map +1 -1
  105. package/dist/components/forms/TagInput.mjs.map +1 -1
  106. package/dist/components/forms/TagInput.vue_vue_type_script_setup_true_lang.cjs +1 -0
  107. package/dist/components/forms/TagInput.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  108. package/dist/components/forms/TagInput.vue_vue_type_script_setup_true_lang.mjs +1 -0
  109. package/dist/components/forms/TagInput.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  110. package/dist/components/forms/Textarea.cjs.map +1 -1
  111. package/dist/components/forms/Textarea.mjs.map +1 -1
  112. package/dist/components/forms/Textarea.vue_vue_type_script_setup_true_lang.cjs +1 -1
  113. package/dist/components/forms/Textarea.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  114. package/dist/components/forms/Textarea.vue_vue_type_script_setup_true_lang.mjs +1 -1
  115. package/dist/components/forms/Textarea.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  116. package/dist/components/forms/morph-select/MorphSelectTrigger.cjs.map +1 -1
  117. package/dist/components/forms/morph-select/MorphSelectTrigger.mjs.map +1 -1
  118. package/dist/components/forms/morph-select/MorphSelectTrigger.vue_vue_type_script_setup_true_lang.cjs +2 -2
  119. package/dist/components/forms/morph-select/MorphSelectTrigger.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  120. package/dist/components/forms/morph-select/MorphSelectTrigger.vue_vue_type_script_setup_true_lang.mjs +2 -2
  121. package/dist/components/forms/morph-select/MorphSelectTrigger.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  122. package/dist/components/layout/Canvas.cjs +1 -1
  123. package/dist/components/layout/Canvas.cjs.map +1 -1
  124. package/dist/components/layout/Canvas.mjs +1 -1
  125. package/dist/components/layout/Canvas.mjs.map +1 -1
  126. package/dist/components/layout/Canvas.vue_vue_type_script_setup_true_lang.cjs +1 -1
  127. package/dist/components/layout/Canvas.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  128. package/dist/components/layout/Canvas.vue_vue_type_script_setup_true_lang.mjs +1 -1
  129. package/dist/components/layout/Canvas.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  130. package/dist/components/layout/PopoverPanel.cjs +1 -1
  131. package/dist/components/layout/PopoverPanel.cjs.map +1 -1
  132. package/dist/components/layout/PopoverPanel.mjs +1 -1
  133. package/dist/components/layout/PopoverPanel.mjs.map +1 -1
  134. package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.cjs +1 -1
  135. package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  136. package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.mjs +1 -1
  137. package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  138. package/dist/components/layout/popover/PopoverTrigger.cjs.map +1 -1
  139. package/dist/components/layout/popover/PopoverTrigger.mjs.map +1 -1
  140. package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.cjs +1 -1
  141. package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  142. package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.mjs +1 -1
  143. package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  144. package/dist/components/navigation/DropdownMenu.cjs +1 -1
  145. package/dist/components/navigation/DropdownMenu.cjs.map +1 -1
  146. package/dist/components/navigation/DropdownMenu.mjs +1 -1
  147. package/dist/components/navigation/DropdownMenu.mjs.map +1 -1
  148. package/dist/components/navigation/DropdownMenu.vue_vue_type_script_setup_true_lang.cjs +1 -1
  149. package/dist/components/navigation/DropdownMenu.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  150. package/dist/components/navigation/DropdownMenu.vue_vue_type_script_setup_true_lang.mjs +1 -1
  151. package/dist/components/navigation/DropdownMenu.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  152. package/dist/components/navigation/Switcher.cjs.map +1 -1
  153. package/dist/components/navigation/Switcher.mjs.map +1 -1
  154. package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.cjs +77 -45
  155. package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  156. package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.mjs +77 -45
  157. package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  158. package/dist/components/navigation/menu/MenuTrigger.cjs.map +1 -1
  159. package/dist/components/navigation/menu/MenuTrigger.mjs.map +1 -1
  160. package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.cjs +1 -1
  161. package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  162. package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.mjs +1 -1
  163. package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  164. package/dist/composables/useField.cjs +28 -8
  165. package/dist/composables/useField.cjs.map +1 -1
  166. package/dist/composables/useField.mjs +28 -8
  167. package/dist/composables/useField.mjs.map +1 -1
  168. package/dist/config/ModoLocale.cjs +10 -1
  169. package/dist/config/ModoLocale.cjs.map +1 -1
  170. package/dist/config/ModoLocale.mjs +10 -1
  171. package/dist/config/ModoLocale.mjs.map +1 -1
  172. package/dist/config/locales/es.cjs +10 -1
  173. package/dist/config/locales/es.cjs.map +1 -1
  174. package/dist/config/locales/es.mjs +10 -1
  175. package/dist/config/locales/es.mjs.map +1 -1
  176. package/dist/index.cjs +4 -0
  177. package/dist/index.mjs +3 -1
  178. package/dist/mood-ui.css +293 -117
  179. package/dist/types/components/data-display/surface-card/SurfaceCardBody.vue.d.ts +1 -1
  180. package/dist/types/components/data-display/surface-card/SurfaceCardFooter.vue.d.ts +1 -1
  181. package/dist/types/components/data-display/surface-card/SurfaceCardHeader.vue.d.ts +1 -1
  182. package/dist/types/components/feedback/dialog/DialogContent.vue.d.ts +1 -1
  183. package/dist/types/components/feedback/tour/Tour.vue.d.ts +31 -0
  184. package/dist/types/components/feedback/tour/TourCard.vue.d.ts +25 -0
  185. package/dist/types/components/feedback/tour/index.d.ts +2 -0
  186. package/dist/types/components/feedback/tour/tourAnchor.d.ts +12 -0
  187. package/dist/types/components/feedback/tour/tourPlace.d.ts +60 -0
  188. package/dist/types/components/feedback/tour/tourShape.d.ts +36 -0
  189. package/dist/types/components/feedback/tour/useTourSpotlight.d.ts +14 -0
  190. package/dist/types/components/feedback/tour/useTourSteps.d.ts +31 -0
  191. package/dist/types/components/layout/Canvas.vue.d.ts +1 -1
  192. package/dist/types/components/layout/popover/PopoverContent.vue.d.ts +1 -1
  193. package/dist/types/components/navigation/menu/MenuContent.vue.d.ts +1 -1
  194. package/dist/types/composables/useField.d.ts +23 -0
  195. package/dist/types/config/ModoLocale.d.ts +14 -0
  196. package/dist/types/index.d.ts +2 -0
  197. package/dist/types/interfaces/feedback/Tour.interface.d.ts +73 -0
  198. package/dist/types/interfaces/navigation/Switcher.interface.d.ts +5 -0
  199. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"TagInput.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../../src/components/forms/TagInput.vue"],"sourcesContent":["<template>\n <div :class=\"['flex flex-col gap-1.5', fullWidth ? 'w-full' : 'inline-flex']\">\n <label\n v-if=\"label\"\n :for=\"fieldId\"\n class=\"text-caption font-medium text-foreground\"\n >\n {{ label }}\n </label>\n\n <div\n :class=\"[\n 'flex flex-wrap items-center gap-1.5 transition-shadow',\n wrapperVariantClasses,\n radiusClasses,\n paddingClasses,\n fullWidth ? 'w-full' : '',\n isDisabled ? 'opacity-60 cursor-not-allowed pointer-events-none' : 'cursor-text',\n readonly ? 'pointer-events-none' : '',\n ]\"\n @click=\"focusInput\"\n >\n <span\n v-for=\"(tag, idx) in modelValue\"\n :key=\"`${tag}-${idx}`\"\n :class=\"[\n 'inline-flex items-center gap-1 font-medium whitespace-nowrap',\n chipSizeClasses,\n chipRadiusClasses,\n chipColorClasses,\n ]\"\n >\n {{ tag }}\n <button\n v-if=\"!readonly && !disabled\"\n type=\"button\"\n :aria-label=\"`Eliminar ${tag}`\"\n class=\"inline-flex items-center justify-center w-3.5 h-3.5 rounded-full hover:bg-foreground/10 transition-colors\"\n @click.stop=\"removeTag(idx)\"\n >\n <svg viewBox=\"0 0 20 20\" fill=\"currentColor\" class=\"w-3 h-3\">\n <path d=\"M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z\" />\n </svg>\n </button>\n </span>\n\n <input\n :id=\"fieldId\"\n ref=\"inputEl\"\n v-model=\"draft\"\n type=\"text\"\n :placeholder=\"modelValue?.length ? '' : placeholder\"\n :aria-label=\"label ? undefined : (ariaLabel ?? 'Tags')\"\n :aria-invalid=\"hasError || undefined\"\n :aria-describedby=\"describedBy\"\n :disabled=\"isDisabled || readonly || (max !== undefined && (modelValue?.length ?? 0) >= max)\"\n :class=\"[\n 'modo-field-native flex-1 min-w-[6rem] bg-transparent p-0 text-foreground placeholder:text-muted-foreground',\n inputSizeClasses,\n ]\"\n @keydown=\"onKeydown\"\n @blur=\"commitDraft\"\n @paste=\"onPaste\"\n />\n </div>\n\n <div v-if=\"errorText || helperText\" class=\"flex items-start\">\n <p\n v-if=\"errorText\"\n :id=\"errorId\"\n class=\"text-caption text-destructive\"\n >\n {{ errorText }}\n </p>\n <p\n v-else-if=\"helperText\"\n :id=\"helperId\"\n class=\"text-caption text-muted-foreground\"\n >\n {{ helperText }}\n </p>\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, ref } from 'vue';\nimport type { TagInput } from '../../interfaces/forms/TagInput.interface';\nimport { useResolvedColor, useSizeTokens } from '../../composables/useModoConfig';\nimport { useFieldState, useFieldClasses } from '../../composables/useField';\n\nconst props = withDefaults(defineProps<TagInput>(), {\n modelValue: () => [],\n placeholder: 'Añade un tag y pulsa Enter…',\n unique: true,\n delimiters: () => [','],\n color: 'default',\n variant: 'subtle',\n fieldVariant: 'outline',\n fullWidth: false,\n});\n\nconst emit = defineEmits<{\n 'update:modelValue': [v: string[]];\n 'add': [tag: string];\n 'remove': [tag: string, index: number];\n 'change': [v: string[]];\n}>();\n\n/* ── Field system (same as Input / Select / Combobox) ── */\nconst { fieldId, radius, stateColor, hasError, isDisabled, errorId, helperId, describedBy } =\n useFieldState(props, { componentName: 'TagInput', idPrefix: 'modo-tag-input' });\n\nconst { wrapperVariantClasses, radiusClasses } = useFieldClasses({\n variant: () => props.fieldVariant ?? 'outline',\n stateColor,\n hasError,\n radius,\n halo: () => props.halo,\n});\n\n/* ── Chip color (separate from field state color) ── */\nconst sz = useSizeTokens(() => props.size);\nconst resolvedColor = useResolvedColor(() => props.color);\n\n/* ── Input state ── */\nconst draft = ref('');\nconst inputEl = ref<HTMLInputElement | null>(null);\n\nfunction focusInput() {\n inputEl.value?.focus();\n}\n\nfunction addTag(raw: string) {\n const tag = raw.trim();\n if (!tag) return;\n if (props.max !== undefined && (props.modelValue?.length ?? 0) >= props.max) return;\n if (props.unique && props.modelValue?.some((t) => t.toLowerCase() === tag.toLowerCase())) return;\n if (props.validator && !props.validator(tag)) return;\n const next = [...(props.modelValue ?? []), tag];\n emit('update:modelValue', next);\n emit('add', tag);\n emit('change', next);\n}\n\nfunction removeTag(idx: number) {\n const tag = props.modelValue?.[idx];\n if (tag === undefined) return;\n const next = [...(props.modelValue ?? [])];\n next.splice(idx, 1);\n emit('update:modelValue', next);\n emit('remove', tag, idx);\n emit('change', next);\n}\n\nfunction commitDraft() {\n if (draft.value.trim()) {\n addTag(draft.value);\n draft.value = '';\n }\n}\n\nfunction onKeydown(e: KeyboardEvent) {\n if (e.key === 'Enter') {\n e.preventDefault();\n commitDraft();\n } else if ((e.key === 'Backspace') && draft.value === '' && (props.modelValue?.length ?? 0) > 0) {\n removeTag(props.modelValue!.length - 1);\n } else if (props.delimiters?.includes(e.key)) {\n e.preventDefault();\n commitDraft();\n }\n}\n\nfunction onPaste(e: ClipboardEvent) {\n const text = e.clipboardData?.getData('text');\n if (!text) return;\n const parts = text.split(/[,\\n\\t]/).map((p) => p.trim()).filter(Boolean);\n if (parts.length > 1) {\n e.preventDefault();\n for (const p of parts) addTag(p);\n draft.value = '';\n }\n}\n\n/* ── Size classes ── */\nconst paddingClasses = computed(() => {\n const minH = sz.value.control.replace('h-', 'min-h-');\n const pad = sz.value.control === 'h-12' ? 'p-2.5' : sz.value.control === 'h-8' ? 'p-1.5' : 'p-2';\n return `${pad} ${minH}`;\n});\n\nconst inputSizeClasses = computed(() => {\n switch (sz.value.control) {\n case 'h-8': return 'text-xs h-5';\n case 'h-12': return 'text-base h-7';\n default: return 'text-sm h-6';\n }\n});\n\nconst chipSizeClasses = computed(() => {\n const h = sz.value.label;\n const t = sz.value.text;\n switch (sz.value.control) {\n case 'h-8': return `${h} px-2 ${t}`;\n case 'h-12': return `${h} px-3 ${t}`;\n default: return `${h} px-2.5 ${t}`;\n }\n});\n\nconst chipRadiusClasses = computed(() => {\n switch (radius.value) {\n case 'none': return 'rounded-none';\n case 'small': return 'rounded';\n case 'large': return 'rounded-lg';\n case 'full': return 'rounded-full';\n case 'medium':\n default: return 'rounded-md';\n }\n});\n\nconst chipColorClasses = computed(() => {\n const c = resolvedColor.value;\n const map: Record<string, Record<string, string>> = {\n default: {\n subtle: 'bg-muted text-foreground',\n outline: 'border border-border text-foreground',\n solid: 'bg-foreground text-background',\n },\n primary: {\n subtle: 'bg-primary/12 text-primary',\n outline: 'border border-primary/40 text-primary',\n solid: 'bg-primary text-primary-foreground',\n },\n danger: {\n subtle: 'bg-destructive/10 text-destructive',\n outline: 'border border-destructive/40 text-destructive',\n solid: 'bg-destructive text-destructive-foreground',\n },\n success: {\n subtle: 'bg-success/10 text-success',\n outline: 'border border-success/40 text-success',\n solid: 'bg-success text-success-foreground',\n },\n warning: {\n subtle: 'bg-warning/10 text-warning',\n outline: 'border border-warning/40 text-warning',\n solid: 'bg-warning text-warning-foreground',\n },\n };\n return map[c]?.[props.variant] ?? map.default.subtle;\n});\n</script>\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2FA,MAAM,QAAQ;EAWd,MAAM,OAAO;EAQb,MAAM,EAAE,SAAS,QAAQ,YAAY,UAAU,YAAY,SAAS,UAAU,gBAC1E,iBAAA,cAAc,OAAO;GAAE,eAAe;GAAY,UAAU;GAAkB,CAAC;EAEnF,MAAM,EAAE,uBAAuB,kBAAkB,iBAAA,gBAAgB;GAC7D,eAAe,MAAM,gBAAgB;GACrC;GACA;GACA;GACA,YAAY,MAAM;GACrB,CAAC;EAGF,MAAM,KAAK,sBAAA,oBAAoB,MAAM,KAAK;EAC1C,MAAM,gBAAgB,sBAAA,uBAAuB,MAAM,MAAM;EAGzD,MAAM,SAAA,GAAA,IAAA,KAAY,GAAG;EACrB,MAAM,WAAA,GAAA,IAAA,KAAuC,KAAK;EAElD,SAAS,aAAa;GAClB,QAAQ,OAAO,OAAO;;EAG1B,SAAS,OAAO,KAAa;GACzB,MAAM,MAAM,IAAI,MAAM;GACtB,IAAI,CAAC,KAAK;GACV,IAAI,MAAM,QAAQ,KAAA,MAAc,MAAM,YAAY,UAAU,MAAM,MAAM,KAAK;GAC7E,IAAI,MAAM,UAAU,MAAM,YAAY,MAAM,MAAM,EAAE,aAAa,KAAK,IAAI,aAAa,CAAC,EAAE;GAC1F,IAAI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AW;KAC7B,WAAA,GAAA,IAAA,OAAU,WAAU,IAAI,QAAA,YAAa,QAAA,QAAQ,KAAA,MAAc,QAAA,YAAY,UAAM,MAAU,QAAA;KACvF,QAAA,GAAA,IAAA,gBAAK,CAAA,8GAA0J,iBAAA,MAAA,CAAA;KAItJ;KACT,QAAM;KACC;gDAbC,MAAA,MAAK,CAAA,CAAA,CAAA,EAAA,EAAA;IAiBX,QAAA,aAAa,QAAA,eAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAelB,OAfN,YAeM,CAbQ,QAAA,cAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAKN,KAAA;;KAJC,KAAA,GAAA,IAAA,OAAI,QAAO;KACZ,OAAM;gCAEH,QAAA,UAAS,EAAA,GAAA,WAAA,IAGD,QAAA,eAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAKX,KAAA;;KAJC,KAAA,GAAA,IAAA,OAAI,SAAQ;KACb,OAAM;gCAEH,QAAA,WAAU,EAAA,GAAA,WAAA,KAAA,GAAA,IAAA,oBAAA,IAAA,KAAA,CAAA,CAAA,KAAA,GAAA,IAAA,oBAAA,IAAA,KAAA"}
1
+ {"version":3,"file":"TagInput.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../../src/components/forms/TagInput.vue"],"sourcesContent":["<template>\n <div :class=\"['flex flex-col gap-1.5', fullWidth ? 'w-full' : 'inline-flex']\">\n <label\n v-if=\"label\"\n :for=\"fieldId\"\n class=\"text-caption font-medium text-foreground\"\n >\n {{ label }}\n </label>\n\n <div\n :class=\"[\n 'flex flex-wrap items-center gap-1.5 transition-shadow',\n wrapperVariantClasses,\n radiusClasses,\n paddingClasses,\n fullWidth ? 'w-full' : '',\n isDisabled ? 'opacity-60 cursor-not-allowed pointer-events-none' : 'cursor-text',\n readonly ? 'pointer-events-none' : '',\n ]\"\n @click=\"focusInput\"\n >\n <span\n v-for=\"(tag, idx) in modelValue\"\n :key=\"`${tag}-${idx}`\"\n :class=\"[\n 'inline-flex items-center gap-1 font-medium whitespace-nowrap',\n chipSizeClasses,\n chipRadiusClasses,\n chipColorClasses,\n ]\"\n >\n {{ tag }}\n <button\n v-if=\"!readonly && !disabled\"\n type=\"button\"\n :aria-label=\"`Eliminar ${tag}`\"\n class=\"inline-flex items-center justify-center w-3.5 h-3.5 rounded-full hover:bg-foreground/10 transition-colors\"\n @click.stop=\"removeTag(idx)\"\n >\n <svg viewBox=\"0 0 20 20\" fill=\"currentColor\" class=\"w-3 h-3\">\n <path d=\"M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z\" />\n </svg>\n </button>\n </span>\n\n <input\n :id=\"fieldId\"\n ref=\"inputEl\"\n v-model=\"draft\"\n type=\"text\"\n :placeholder=\"modelValue?.length ? '' : placeholder\"\n :aria-label=\"label ? undefined : (ariaLabel ?? 'Tags')\"\n :aria-invalid=\"hasError || undefined\"\n :aria-describedby=\"describedBy\"\n :disabled=\"isDisabled || readonly || (max !== undefined && (modelValue?.length ?? 0) >= max)\"\n :class=\"[\n 'modo-field-native flex-1 min-w-[6rem] bg-transparent p-0 text-foreground placeholder:text-muted-foreground',\n inputSizeClasses,\n ]\"\n @keydown=\"onKeydown\"\n @blur=\"commitDraft\"\n @paste=\"onPaste\"\n />\n </div>\n\n <div v-if=\"errorText || helperText\" class=\"flex items-start\">\n <p\n v-if=\"errorText\"\n :id=\"errorId\"\n class=\"text-caption text-destructive\"\n >\n {{ errorText }}\n </p>\n <p\n v-else-if=\"helperText\"\n :id=\"helperId\"\n class=\"text-caption text-muted-foreground\"\n >\n {{ helperText }}\n </p>\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, ref } from 'vue';\nimport type { TagInput } from '../../interfaces/forms/TagInput.interface';\nimport { useResolvedColor, useSizeTokens } from '../../composables/useModoConfig';\nimport { useFieldState, useFieldClasses } from '../../composables/useField';\n\nconst props = withDefaults(defineProps<TagInput>(), {\n modelValue: () => [],\n placeholder: 'Añade un tag y pulsa Enter…',\n unique: true,\n delimiters: () => [','],\n color: 'default',\n variant: 'subtle',\n fieldVariant: 'outline',\n fullWidth: false,\n});\n\nconst emit = defineEmits<{\n 'update:modelValue': [v: string[]];\n 'add': [tag: string];\n 'remove': [tag: string, index: number];\n 'change': [v: string[]];\n}>();\n\n/* ── Field system (same as Input / Select / Combobox) ── */\nconst { fieldId, radius, stateColor, hasError, isDisabled, errorId, helperId, describedBy } =\n useFieldState(props, { componentName: 'TagInput', idPrefix: 'modo-tag-input' });\n\nconst { wrapperVariantClasses, radiusClasses } = useFieldClasses({\n variant: () => props.fieldVariant ?? 'outline',\n stateColor,\n hasError,\n radius,\n radiusKind: 'grow',\n halo: () => props.halo,\n});\n\n/* ── Chip color (separate from field state color) ── */\nconst sz = useSizeTokens(() => props.size);\nconst resolvedColor = useResolvedColor(() => props.color);\n\n/* ── Input state ── */\nconst draft = ref('');\nconst inputEl = ref<HTMLInputElement | null>(null);\n\nfunction focusInput() {\n inputEl.value?.focus();\n}\n\nfunction addTag(raw: string) {\n const tag = raw.trim();\n if (!tag) return;\n if (props.max !== undefined && (props.modelValue?.length ?? 0) >= props.max) return;\n if (props.unique && props.modelValue?.some((t) => t.toLowerCase() === tag.toLowerCase())) return;\n if (props.validator && !props.validator(tag)) return;\n const next = [...(props.modelValue ?? []), tag];\n emit('update:modelValue', next);\n emit('add', tag);\n emit('change', next);\n}\n\nfunction removeTag(idx: number) {\n const tag = props.modelValue?.[idx];\n if (tag === undefined) return;\n const next = [...(props.modelValue ?? [])];\n next.splice(idx, 1);\n emit('update:modelValue', next);\n emit('remove', tag, idx);\n emit('change', next);\n}\n\nfunction commitDraft() {\n if (draft.value.trim()) {\n addTag(draft.value);\n draft.value = '';\n }\n}\n\nfunction onKeydown(e: KeyboardEvent) {\n if (e.key === 'Enter') {\n e.preventDefault();\n commitDraft();\n } else if ((e.key === 'Backspace') && draft.value === '' && (props.modelValue?.length ?? 0) > 0) {\n removeTag(props.modelValue!.length - 1);\n } else if (props.delimiters?.includes(e.key)) {\n e.preventDefault();\n commitDraft();\n }\n}\n\nfunction onPaste(e: ClipboardEvent) {\n const text = e.clipboardData?.getData('text');\n if (!text) return;\n const parts = text.split(/[,\\n\\t]/).map((p) => p.trim()).filter(Boolean);\n if (parts.length > 1) {\n e.preventDefault();\n for (const p of parts) addTag(p);\n draft.value = '';\n }\n}\n\n/* ── Size classes ── */\nconst paddingClasses = computed(() => {\n const minH = sz.value.control.replace('h-', 'min-h-');\n const pad = sz.value.control === 'h-12' ? 'p-2.5' : sz.value.control === 'h-8' ? 'p-1.5' : 'p-2';\n return `${pad} ${minH}`;\n});\n\nconst inputSizeClasses = computed(() => {\n switch (sz.value.control) {\n case 'h-8': return 'text-xs h-5';\n case 'h-12': return 'text-base h-7';\n default: return 'text-sm h-6';\n }\n});\n\nconst chipSizeClasses = computed(() => {\n const h = sz.value.label;\n const t = sz.value.text;\n switch (sz.value.control) {\n case 'h-8': return `${h} px-2 ${t}`;\n case 'h-12': return `${h} px-3 ${t}`;\n default: return `${h} px-2.5 ${t}`;\n }\n});\n\nconst chipRadiusClasses = computed(() => {\n switch (radius.value) {\n case 'none': return 'rounded-none';\n case 'small': return 'rounded';\n case 'large': return 'rounded-lg';\n case 'full': return 'rounded-full';\n case 'medium':\n default: return 'rounded-md';\n }\n});\n\nconst chipColorClasses = computed(() => {\n const c = resolvedColor.value;\n const map: Record<string, Record<string, string>> = {\n default: {\n subtle: 'bg-muted text-foreground',\n outline: 'border border-border text-foreground',\n solid: 'bg-foreground text-background',\n },\n primary: {\n subtle: 'bg-primary/12 text-primary',\n outline: 'border border-primary/40 text-primary',\n solid: 'bg-primary text-primary-foreground',\n },\n danger: {\n subtle: 'bg-destructive/10 text-destructive',\n outline: 'border border-destructive/40 text-destructive',\n solid: 'bg-destructive text-destructive-foreground',\n },\n success: {\n subtle: 'bg-success/10 text-success',\n outline: 'border border-success/40 text-success',\n solid: 'bg-success text-success-foreground',\n },\n warning: {\n subtle: 'bg-warning/10 text-warning',\n outline: 'border border-warning/40 text-warning',\n solid: 'bg-warning text-warning-foreground',\n },\n };\n return map[c]?.[props.variant] ?? map.default.subtle;\n});\n</script>\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2FA,MAAM,QAAQ;EAWd,MAAM,OAAO;EAQb,MAAM,EAAE,SAAS,QAAQ,YAAY,UAAU,YAAY,SAAS,UAAU,gBAC1E,iBAAA,cAAc,OAAO;GAAE,eAAe;GAAY,UAAU;GAAkB,CAAC;EAEnF,MAAM,EAAE,uBAAuB,kBAAkB,iBAAA,gBAAgB;GAC7D,eAAe,MAAM,gBAAgB;GACrC;GACA;GACA;GACA,YAAY;GACZ,YAAY,MAAM;GACrB,CAAC;EAGF,MAAM,KAAK,sBAAA,oBAAoB,MAAM,KAAK;EAC1C,MAAM,gBAAgB,sBAAA,uBAAuB,MAAM,MAAM;EAGzD,MAAM,SAAA,GAAA,IAAA,KAAY,GAAG;EACrB,MAAM,WAAA,GAAA,IAAA,KAAuC,KAAK;EAElD,SAAS,aAAa;GAClB,QAAQ,OAAO,OAAO;;EAG1B,SAAS,OAAO,KAAa;GACzB,MAAM,MAAM,IAAI,MAAM;GACtB,IAAI,CAAC,KAAK;GACV,IAAI,MAAM,QAAQ,KAAA,MAAc,MAAM,YAAY,UAAU,MAAM,MAAM,KAAK;GAC7E,IAAI,MAAM,UAAU,MAAM,YAAY,MAAM,MAAM,EAAE,aAAa,KAAK,IAAI,aAAa,CAAC,EAAE;GAC1F,IAAI,MAAM,aAAa,CAAC,MAAM,UAAU,IAAI,EAAE;GAC9C,MAAM,OAAO,CAAC,GAAI,MAAM,cAAc,EAAE,EAAG,IAAI;GAC/C,KAAK,qBAAqB,KAAK;GAC/B,KA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AK,CAAA,8GAA0J,iBAAA,MAAA,CAAA;KAItJ;KACT,QAAM;KACC;gDAbC,MAAA,MAAK,CAAA,CAAA,CAAA,EAAA,EAAA;IAiBX,QAAA,aAAa,QAAA,eAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAelB,OAfN,YAeM,CAbQ,QAAA,cAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAKN,KAAA;;KAJC,KAAA,GAAA,IAAA,OAAI,QAAO;KACZ,OAAM;gCAEH,QAAA,UAAS,EAAA,GAAA,WAAA,IAGD,QAAA,eAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAKX,KAAA;;KAJC,KAAA,GAAA,IAAA,OAAI,SAAQ;KACb,OAAM;gCAEH,QAAA,WAAU,EAAA,GAAA,WAAA,KAAA,GAAA,IAAA,oBAAA,IAAA,KAAA,CAAA,CAAA,KAAA,GAAA,IAAA,oBAAA,IAAA,KAAA"}
@@ -67,6 +67,7 @@ var TagInput_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defin
67
67
  stateColor,
68
68
  hasError,
69
69
  radius,
70
+ radiusKind: "grow",
70
71
  halo: () => props.halo
71
72
  });
72
73
  const sz = useSizeTokens(() => props.size);
@@ -1 +1 @@
1
- {"version":3,"file":"TagInput.vue_vue_type_script_setup_true_lang.mjs","names":[],"sources":["../../../src/components/forms/TagInput.vue"],"sourcesContent":["<template>\n <div :class=\"['flex flex-col gap-1.5', fullWidth ? 'w-full' : 'inline-flex']\">\n <label\n v-if=\"label\"\n :for=\"fieldId\"\n class=\"text-caption font-medium text-foreground\"\n >\n {{ label }}\n </label>\n\n <div\n :class=\"[\n 'flex flex-wrap items-center gap-1.5 transition-shadow',\n wrapperVariantClasses,\n radiusClasses,\n paddingClasses,\n fullWidth ? 'w-full' : '',\n isDisabled ? 'opacity-60 cursor-not-allowed pointer-events-none' : 'cursor-text',\n readonly ? 'pointer-events-none' : '',\n ]\"\n @click=\"focusInput\"\n >\n <span\n v-for=\"(tag, idx) in modelValue\"\n :key=\"`${tag}-${idx}`\"\n :class=\"[\n 'inline-flex items-center gap-1 font-medium whitespace-nowrap',\n chipSizeClasses,\n chipRadiusClasses,\n chipColorClasses,\n ]\"\n >\n {{ tag }}\n <button\n v-if=\"!readonly && !disabled\"\n type=\"button\"\n :aria-label=\"`Eliminar ${tag}`\"\n class=\"inline-flex items-center justify-center w-3.5 h-3.5 rounded-full hover:bg-foreground/10 transition-colors\"\n @click.stop=\"removeTag(idx)\"\n >\n <svg viewBox=\"0 0 20 20\" fill=\"currentColor\" class=\"w-3 h-3\">\n <path d=\"M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z\" />\n </svg>\n </button>\n </span>\n\n <input\n :id=\"fieldId\"\n ref=\"inputEl\"\n v-model=\"draft\"\n type=\"text\"\n :placeholder=\"modelValue?.length ? '' : placeholder\"\n :aria-label=\"label ? undefined : (ariaLabel ?? 'Tags')\"\n :aria-invalid=\"hasError || undefined\"\n :aria-describedby=\"describedBy\"\n :disabled=\"isDisabled || readonly || (max !== undefined && (modelValue?.length ?? 0) >= max)\"\n :class=\"[\n 'modo-field-native flex-1 min-w-[6rem] bg-transparent p-0 text-foreground placeholder:text-muted-foreground',\n inputSizeClasses,\n ]\"\n @keydown=\"onKeydown\"\n @blur=\"commitDraft\"\n @paste=\"onPaste\"\n />\n </div>\n\n <div v-if=\"errorText || helperText\" class=\"flex items-start\">\n <p\n v-if=\"errorText\"\n :id=\"errorId\"\n class=\"text-caption text-destructive\"\n >\n {{ errorText }}\n </p>\n <p\n v-else-if=\"helperText\"\n :id=\"helperId\"\n class=\"text-caption text-muted-foreground\"\n >\n {{ helperText }}\n </p>\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, ref } from 'vue';\nimport type { TagInput } from '../../interfaces/forms/TagInput.interface';\nimport { useResolvedColor, useSizeTokens } from '../../composables/useModoConfig';\nimport { useFieldState, useFieldClasses } from '../../composables/useField';\n\nconst props = withDefaults(defineProps<TagInput>(), {\n modelValue: () => [],\n placeholder: 'Añade un tag y pulsa Enter…',\n unique: true,\n delimiters: () => [','],\n color: 'default',\n variant: 'subtle',\n fieldVariant: 'outline',\n fullWidth: false,\n});\n\nconst emit = defineEmits<{\n 'update:modelValue': [v: string[]];\n 'add': [tag: string];\n 'remove': [tag: string, index: number];\n 'change': [v: string[]];\n}>();\n\n/* ── Field system (same as Input / Select / Combobox) ── */\nconst { fieldId, radius, stateColor, hasError, isDisabled, errorId, helperId, describedBy } =\n useFieldState(props, { componentName: 'TagInput', idPrefix: 'modo-tag-input' });\n\nconst { wrapperVariantClasses, radiusClasses } = useFieldClasses({\n variant: () => props.fieldVariant ?? 'outline',\n stateColor,\n hasError,\n radius,\n halo: () => props.halo,\n});\n\n/* ── Chip color (separate from field state color) ── */\nconst sz = useSizeTokens(() => props.size);\nconst resolvedColor = useResolvedColor(() => props.color);\n\n/* ── Input state ── */\nconst draft = ref('');\nconst inputEl = ref<HTMLInputElement | null>(null);\n\nfunction focusInput() {\n inputEl.value?.focus();\n}\n\nfunction addTag(raw: string) {\n const tag = raw.trim();\n if (!tag) return;\n if (props.max !== undefined && (props.modelValue?.length ?? 0) >= props.max) return;\n if (props.unique && props.modelValue?.some((t) => t.toLowerCase() === tag.toLowerCase())) return;\n if (props.validator && !props.validator(tag)) return;\n const next = [...(props.modelValue ?? []), tag];\n emit('update:modelValue', next);\n emit('add', tag);\n emit('change', next);\n}\n\nfunction removeTag(idx: number) {\n const tag = props.modelValue?.[idx];\n if (tag === undefined) return;\n const next = [...(props.modelValue ?? [])];\n next.splice(idx, 1);\n emit('update:modelValue', next);\n emit('remove', tag, idx);\n emit('change', next);\n}\n\nfunction commitDraft() {\n if (draft.value.trim()) {\n addTag(draft.value);\n draft.value = '';\n }\n}\n\nfunction onKeydown(e: KeyboardEvent) {\n if (e.key === 'Enter') {\n e.preventDefault();\n commitDraft();\n } else if ((e.key === 'Backspace') && draft.value === '' && (props.modelValue?.length ?? 0) > 0) {\n removeTag(props.modelValue!.length - 1);\n } else if (props.delimiters?.includes(e.key)) {\n e.preventDefault();\n commitDraft();\n }\n}\n\nfunction onPaste(e: ClipboardEvent) {\n const text = e.clipboardData?.getData('text');\n if (!text) return;\n const parts = text.split(/[,\\n\\t]/).map((p) => p.trim()).filter(Boolean);\n if (parts.length > 1) {\n e.preventDefault();\n for (const p of parts) addTag(p);\n draft.value = '';\n }\n}\n\n/* ── Size classes ── */\nconst paddingClasses = computed(() => {\n const minH = sz.value.control.replace('h-', 'min-h-');\n const pad = sz.value.control === 'h-12' ? 'p-2.5' : sz.value.control === 'h-8' ? 'p-1.5' : 'p-2';\n return `${pad} ${minH}`;\n});\n\nconst inputSizeClasses = computed(() => {\n switch (sz.value.control) {\n case 'h-8': return 'text-xs h-5';\n case 'h-12': return 'text-base h-7';\n default: return 'text-sm h-6';\n }\n});\n\nconst chipSizeClasses = computed(() => {\n const h = sz.value.label;\n const t = sz.value.text;\n switch (sz.value.control) {\n case 'h-8': return `${h} px-2 ${t}`;\n case 'h-12': return `${h} px-3 ${t}`;\n default: return `${h} px-2.5 ${t}`;\n }\n});\n\nconst chipRadiusClasses = computed(() => {\n switch (radius.value) {\n case 'none': return 'rounded-none';\n case 'small': return 'rounded';\n case 'large': return 'rounded-lg';\n case 'full': return 'rounded-full';\n case 'medium':\n default: return 'rounded-md';\n }\n});\n\nconst chipColorClasses = computed(() => {\n const c = resolvedColor.value;\n const map: Record<string, Record<string, string>> = {\n default: {\n subtle: 'bg-muted text-foreground',\n outline: 'border border-border text-foreground',\n solid: 'bg-foreground text-background',\n },\n primary: {\n subtle: 'bg-primary/12 text-primary',\n outline: 'border border-primary/40 text-primary',\n solid: 'bg-primary text-primary-foreground',\n },\n danger: {\n subtle: 'bg-destructive/10 text-destructive',\n outline: 'border border-destructive/40 text-destructive',\n solid: 'bg-destructive text-destructive-foreground',\n },\n success: {\n subtle: 'bg-success/10 text-success',\n outline: 'border border-success/40 text-success',\n solid: 'bg-success text-success-foreground',\n },\n warning: {\n subtle: 'bg-warning/10 text-warning',\n outline: 'border border-warning/40 text-warning',\n solid: 'bg-warning text-warning-foreground',\n },\n };\n return map[c]?.[props.variant] ?? map.default.subtle;\n});\n</script>\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2FA,MAAM,QAAQ;EAWd,MAAM,OAAO;EAQb,MAAM,EAAE,SAAS,QAAQ,YAAY,UAAU,YAAY,SAAS,UAAU,gBAC1E,cAAc,OAAO;GAAE,eAAe;GAAY,UAAU;GAAkB,CAAC;EAEnF,MAAM,EAAE,uBAAuB,kBAAkB,gBAAgB;GAC7D,eAAe,MAAM,gBAAgB;GACrC;GACA;GACA;GACA,YAAY,MAAM;GACrB,CAAC;EAGF,MAAM,KAAK,oBAAoB,MAAM,KAAK;EAC1C,MAAM,gBAAgB,uBAAuB,MAAM,MAAM;EAGzD,MAAM,QAAQ,IAAI,GAAG;EACrB,MAAM,UAAU,IAA6B,KAAK;EAElD,SAAS,aAAa;GAClB,QAAQ,OAAO,OAAO;;EAG1B,SAAS,OAAO,KAAa;GACzB,MAAM,MAAM,IAAI,MAAM;GACtB,IAAI,CAAC,KAAK;GACV,IAAI,MAAM,QAAQ,KAAA,MAAc,MAAM,YAAY,UAAU,MAAM,MAAM,KAAK;GAC7E,IAAI,MAAM,UAAU,MAAM,YAAY,MAAM,MAAM,EAAE,aAAa,KAAK,IAAI,aAAa,CAAC,EAAE;GAC1F,IAAI,MAAM,aAAa,CAAC,MAAM,UAAU,IAAI,EAAE;GAC9C,MAAM,OAAO,CAAC,GAAI,MAAM,cAAc,EAAE,EAAG,IAAI;GAC/C,KAAK,qBAAqB,KAAK;GAC/B,KAAK,OAAO,IAAI;GAChB,KAAK,UAAU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AM;uBAEH,QAAA,UAAS,EAAA,GAAA,WAAA,IAGD,QAAA,cAAA,WAAA,EADf,mBAMI,KAAA;;KAJC,IAAI,MAAA,SAAQ;KACb,OAAM;uBAEH,QAAA,WAAU,EAAA,GAAA,WAAA,IAAA,mBAAA,IAAA,KAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA"}
1
+ {"version":3,"file":"TagInput.vue_vue_type_script_setup_true_lang.mjs","names":[],"sources":["../../../src/components/forms/TagInput.vue"],"sourcesContent":["<template>\n <div :class=\"['flex flex-col gap-1.5', fullWidth ? 'w-full' : 'inline-flex']\">\n <label\n v-if=\"label\"\n :for=\"fieldId\"\n class=\"text-caption font-medium text-foreground\"\n >\n {{ label }}\n </label>\n\n <div\n :class=\"[\n 'flex flex-wrap items-center gap-1.5 transition-shadow',\n wrapperVariantClasses,\n radiusClasses,\n paddingClasses,\n fullWidth ? 'w-full' : '',\n isDisabled ? 'opacity-60 cursor-not-allowed pointer-events-none' : 'cursor-text',\n readonly ? 'pointer-events-none' : '',\n ]\"\n @click=\"focusInput\"\n >\n <span\n v-for=\"(tag, idx) in modelValue\"\n :key=\"`${tag}-${idx}`\"\n :class=\"[\n 'inline-flex items-center gap-1 font-medium whitespace-nowrap',\n chipSizeClasses,\n chipRadiusClasses,\n chipColorClasses,\n ]\"\n >\n {{ tag }}\n <button\n v-if=\"!readonly && !disabled\"\n type=\"button\"\n :aria-label=\"`Eliminar ${tag}`\"\n class=\"inline-flex items-center justify-center w-3.5 h-3.5 rounded-full hover:bg-foreground/10 transition-colors\"\n @click.stop=\"removeTag(idx)\"\n >\n <svg viewBox=\"0 0 20 20\" fill=\"currentColor\" class=\"w-3 h-3\">\n <path d=\"M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z\" />\n </svg>\n </button>\n </span>\n\n <input\n :id=\"fieldId\"\n ref=\"inputEl\"\n v-model=\"draft\"\n type=\"text\"\n :placeholder=\"modelValue?.length ? '' : placeholder\"\n :aria-label=\"label ? undefined : (ariaLabel ?? 'Tags')\"\n :aria-invalid=\"hasError || undefined\"\n :aria-describedby=\"describedBy\"\n :disabled=\"isDisabled || readonly || (max !== undefined && (modelValue?.length ?? 0) >= max)\"\n :class=\"[\n 'modo-field-native flex-1 min-w-[6rem] bg-transparent p-0 text-foreground placeholder:text-muted-foreground',\n inputSizeClasses,\n ]\"\n @keydown=\"onKeydown\"\n @blur=\"commitDraft\"\n @paste=\"onPaste\"\n />\n </div>\n\n <div v-if=\"errorText || helperText\" class=\"flex items-start\">\n <p\n v-if=\"errorText\"\n :id=\"errorId\"\n class=\"text-caption text-destructive\"\n >\n {{ errorText }}\n </p>\n <p\n v-else-if=\"helperText\"\n :id=\"helperId\"\n class=\"text-caption text-muted-foreground\"\n >\n {{ helperText }}\n </p>\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, ref } from 'vue';\nimport type { TagInput } from '../../interfaces/forms/TagInput.interface';\nimport { useResolvedColor, useSizeTokens } from '../../composables/useModoConfig';\nimport { useFieldState, useFieldClasses } from '../../composables/useField';\n\nconst props = withDefaults(defineProps<TagInput>(), {\n modelValue: () => [],\n placeholder: 'Añade un tag y pulsa Enter…',\n unique: true,\n delimiters: () => [','],\n color: 'default',\n variant: 'subtle',\n fieldVariant: 'outline',\n fullWidth: false,\n});\n\nconst emit = defineEmits<{\n 'update:modelValue': [v: string[]];\n 'add': [tag: string];\n 'remove': [tag: string, index: number];\n 'change': [v: string[]];\n}>();\n\n/* ── Field system (same as Input / Select / Combobox) ── */\nconst { fieldId, radius, stateColor, hasError, isDisabled, errorId, helperId, describedBy } =\n useFieldState(props, { componentName: 'TagInput', idPrefix: 'modo-tag-input' });\n\nconst { wrapperVariantClasses, radiusClasses } = useFieldClasses({\n variant: () => props.fieldVariant ?? 'outline',\n stateColor,\n hasError,\n radius,\n radiusKind: 'grow',\n halo: () => props.halo,\n});\n\n/* ── Chip color (separate from field state color) ── */\nconst sz = useSizeTokens(() => props.size);\nconst resolvedColor = useResolvedColor(() => props.color);\n\n/* ── Input state ── */\nconst draft = ref('');\nconst inputEl = ref<HTMLInputElement | null>(null);\n\nfunction focusInput() {\n inputEl.value?.focus();\n}\n\nfunction addTag(raw: string) {\n const tag = raw.trim();\n if (!tag) return;\n if (props.max !== undefined && (props.modelValue?.length ?? 0) >= props.max) return;\n if (props.unique && props.modelValue?.some((t) => t.toLowerCase() === tag.toLowerCase())) return;\n if (props.validator && !props.validator(tag)) return;\n const next = [...(props.modelValue ?? []), tag];\n emit('update:modelValue', next);\n emit('add', tag);\n emit('change', next);\n}\n\nfunction removeTag(idx: number) {\n const tag = props.modelValue?.[idx];\n if (tag === undefined) return;\n const next = [...(props.modelValue ?? [])];\n next.splice(idx, 1);\n emit('update:modelValue', next);\n emit('remove', tag, idx);\n emit('change', next);\n}\n\nfunction commitDraft() {\n if (draft.value.trim()) {\n addTag(draft.value);\n draft.value = '';\n }\n}\n\nfunction onKeydown(e: KeyboardEvent) {\n if (e.key === 'Enter') {\n e.preventDefault();\n commitDraft();\n } else if ((e.key === 'Backspace') && draft.value === '' && (props.modelValue?.length ?? 0) > 0) {\n removeTag(props.modelValue!.length - 1);\n } else if (props.delimiters?.includes(e.key)) {\n e.preventDefault();\n commitDraft();\n }\n}\n\nfunction onPaste(e: ClipboardEvent) {\n const text = e.clipboardData?.getData('text');\n if (!text) return;\n const parts = text.split(/[,\\n\\t]/).map((p) => p.trim()).filter(Boolean);\n if (parts.length > 1) {\n e.preventDefault();\n for (const p of parts) addTag(p);\n draft.value = '';\n }\n}\n\n/* ── Size classes ── */\nconst paddingClasses = computed(() => {\n const minH = sz.value.control.replace('h-', 'min-h-');\n const pad = sz.value.control === 'h-12' ? 'p-2.5' : sz.value.control === 'h-8' ? 'p-1.5' : 'p-2';\n return `${pad} ${minH}`;\n});\n\nconst inputSizeClasses = computed(() => {\n switch (sz.value.control) {\n case 'h-8': return 'text-xs h-5';\n case 'h-12': return 'text-base h-7';\n default: return 'text-sm h-6';\n }\n});\n\nconst chipSizeClasses = computed(() => {\n const h = sz.value.label;\n const t = sz.value.text;\n switch (sz.value.control) {\n case 'h-8': return `${h} px-2 ${t}`;\n case 'h-12': return `${h} px-3 ${t}`;\n default: return `${h} px-2.5 ${t}`;\n }\n});\n\nconst chipRadiusClasses = computed(() => {\n switch (radius.value) {\n case 'none': return 'rounded-none';\n case 'small': return 'rounded';\n case 'large': return 'rounded-lg';\n case 'full': return 'rounded-full';\n case 'medium':\n default: return 'rounded-md';\n }\n});\n\nconst chipColorClasses = computed(() => {\n const c = resolvedColor.value;\n const map: Record<string, Record<string, string>> = {\n default: {\n subtle: 'bg-muted text-foreground',\n outline: 'border border-border text-foreground',\n solid: 'bg-foreground text-background',\n },\n primary: {\n subtle: 'bg-primary/12 text-primary',\n outline: 'border border-primary/40 text-primary',\n solid: 'bg-primary text-primary-foreground',\n },\n danger: {\n subtle: 'bg-destructive/10 text-destructive',\n outline: 'border border-destructive/40 text-destructive',\n solid: 'bg-destructive text-destructive-foreground',\n },\n success: {\n subtle: 'bg-success/10 text-success',\n outline: 'border border-success/40 text-success',\n solid: 'bg-success text-success-foreground',\n },\n warning: {\n subtle: 'bg-warning/10 text-warning',\n outline: 'border border-warning/40 text-warning',\n solid: 'bg-warning text-warning-foreground',\n },\n };\n return map[c]?.[props.variant] ?? map.default.subtle;\n});\n</script>\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2FA,MAAM,QAAQ;EAWd,MAAM,OAAO;EAQb,MAAM,EAAE,SAAS,QAAQ,YAAY,UAAU,YAAY,SAAS,UAAU,gBAC1E,cAAc,OAAO;GAAE,eAAe;GAAY,UAAU;GAAkB,CAAC;EAEnF,MAAM,EAAE,uBAAuB,kBAAkB,gBAAgB;GAC7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EAAA,GAAA,CAAA,EAAA,EAAA,GAAA,WAAA,IAAA,mBAAA,IAAA,KAAA,CAAA,EAAA,EAAA;8BAKlM,mBAiBE,SAAA;KAhBG,IAAI,MAAA,QAAO;cACR;KAAJ,KAAI;wEACU,QAAA;KACd,MAAK;KACJ,aAAa,QAAA,YAAY,SAAM,KAAQ,QAAA;KACvC,cAAY,QAAA,QAAQ,KAAA,IAAa,QAAA,aAAS;KAC1C,gBAAc,MAAA,SAAQ,IAAI,KAAA;KAC1B,oBAAkB,MAAA,YAAW;KAC7B,UAAU,MAAA,WAAU,IAAI,QAAA,YAAa,QAAA,QAAQ,KAAA,MAAc,QAAA,YAAY,UAAM,MAAU,QAAA;KACvF,OAAK,eAAA,CAAA,8GAA0J,iBAAA,MAAA,CAAA;KAItJ;KACT,QAAM;KACC;4CAbC,MAAA,MAAK,CAAA,CAAA,CAAA,EAAA,EAAA;IAiBX,QAAA,aAAa,QAAA,cAAA,WAAA,EAAxB,mBAeM,OAfN,YAeM,CAbQ,QAAA,aAAA,WAAA,EADV,mBAMI,KAAA;;KAJC,IAAI,MAAA,QAAO;KACZ,OAAM;uBAEH,QAAA,UAAS,EAAA,GAAA,WAAA,IAGD,QAAA,cAAA,WAAA,EADf,mBAMI,KAAA;;KAJC,IAAI,MAAA,SAAQ;KACb,OAAM;uBAEH,QAAA,WAAU,EAAA,GAAA,WAAA,IAAA,mBAAA,IAAA,KAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.cjs","names":[],"sources":["../../../src/components/forms/Textarea.vue"],"sourcesContent":["<template> \n <div :class=\"['flex flex-col gap-1.5', fullWidth ? 'w-full' : 'inline-flex']\"> \n <label \n v-if=\"label\" \n :for=\"fieldId\" \n class=\"text-caption font-medium text-foreground\" \n > \n {{ label }} \n <span v-if=\"required\" aria-hidden=\"true\" class=\"text-destructive ml-0.5\">*</span> \n </label> \n \n <div\n :class=\"[\n 'modo-field-wrapper flex items-start gap-2',\n wrapperVariantClasses,\n wrapperPaddingClasses,\n wrapperMinHeightClass,\n radiusClasses,\n fullWidth ? 'w-full' : '',\n isDisabled ? 'opacity-60 cursor-not-allowed' : '',\n ]\"\n > \n <textarea \n :id=\"fieldId\" \n ref=\"textareaRef\" \n :value=\"modelValue ?? ''\" \n :placeholder=\"placeholder\" \n :disabled=\"isDisabled\" \n :readonly=\"readonly\" \n :required=\"required\" \n :name=\"name\" \n :autofocus=\"autofocus\" \n :maxlength=\"maxLength\" \n :rows=\"rows\" \n :aria-label=\"!label ? ariaLabel : undefined\" \n :aria-invalid=\"hasError || undefined\" \n :aria-describedby=\"describedBy\" \n :aria-required=\"required || undefined\" \n :class=\"[ \n 'modo-field-native flex-1 min-w-0 bg-transparent p-0', \n 'text-foreground placeholder:text-muted-foreground', \n 'disabled:cursor-not-allowed', \n textareaTextClasses, \n resizeClass, \n autoresize ? 'overflow-hidden' : '', \n ]\" \n @input=\"onInput\" \n @change=\"onChange\" \n @focus=\"$emit('focus', $event)\" \n @blur=\"$emit('blur', $event)\" \n /> \n \n <div class=\"flex flex-col items-center gap-1 shrink-0 pt-0.5\"> \n <Button \n v-if=\"clearable && hasValue && !isDisabled && !readonly\" \n variant=\"text\" \n size=\"xs\" \n radius=\"full\" \n :icon=\"XMarkIcon\" \n :ariaLabel=\"loc.textarea.clear\" \n tabindex=\"-1\" \n class=\"text-muted-foreground hover:text-foreground\" \n @click=\"onClear\" \n /> \n \n <Loader \n v-if=\"loading\" \n :size=\"size === 'large' ? 'medium' : 'small'\" \n class=\"text-muted-foreground\" \n /> \n </div> \n </div> \n \n <div \n v-if=\"errorText || helperText || showCounterEffective\" \n class=\"flex items-start justify-between gap-2\" \n > \n <Typography \n v-if=\"errorText\" \n :id=\"errorId\" \n variant=\"caption\" \n size=\"medium\" \n color=\"danger\" \n as=\"p\" \n > \n {{ errorText }} \n </Typography> \n <Typography \n v-else-if=\"helperText\" \n :id=\"helperId\" \n variant=\"caption\" \n size=\"medium\" \n color=\"muted\" \n as=\"p\" \n > \n {{ helperText }} \n </Typography> \n <span v-else class=\"flex-1\" /> \n \n <span \n v-if=\"showCounterEffective\" \n :id=\"counterId\" \n :class=\"[ \n 'text-caption shrink-0 tabular-nums', \n counterOverflow ? 'text-destructive' : 'text-muted-foreground', \n ]\" \n > \n {{ currentLength }}/{{ maxLength }} \n </span> \n </div> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, nextTick, onMounted, ref, watch } from 'vue'; \nimport type { Textarea } from '../../interfaces/forms/Textarea.interface'; \nimport { useFieldState, useFieldClasses } from '../../composables/useField'; \nimport Loader from '../feedback/Loader.vue'; \nimport Button from './Button.vue'; \nimport { XMarkIcon } from '@heroicons/vue/24/outline'; \nimport Typography from '../data-display/Typography.vue'; \nimport { useModoLocale, useResolvedSize, useSizeTokens } from '../../composables/useModoConfig';\n \nconst loc = useModoLocale(); \n \nconst emit = defineEmits<{ \n 'update:modelValue': [value: string]; \n change: [value: string]; \n focus: [event: FocusEvent]; \n blur: [event: FocusEvent]; \n clear: []; \n}>(); \n \nconst props = withDefaults(defineProps<Textarea>(), { \n variant: 'outline', \n color: 'default', \n disabled: false, \n readonly: false, \n required: false, \n loading: false, \n clearable: false, \n fullWidth: false, \n showCounter: false, \n autofocus: false, \n rows: 3, \n autoresize: false, \n maxRows: 8, \n resize: 'vertical', \n}); \n \nconst resolvedSize = useResolvedSize(() => props.size);\nconst sz = useSizeTokens(() => props.size);\n\nconst textareaRef = ref<HTMLTextAreaElement | null>(null); \n \nconst { \n fieldId, \n radius, \n stateColor, \n hasError, \n hasValue, \n isDisabled, \n currentLength, \n showCounterEffective, \n counterOverflow, \n errorId, \n helperId, \n counterId, \n describedBy, \n} = useFieldState(props, { componentName: 'Textarea', idPrefix: 'modo-textarea' }); \n \nconst { wrapperVariantClasses, radiusClasses } = useFieldClasses({ \n variant: () => props.variant, \n stateColor, \n hasError, \n radius, \n fullRadiusClass: 'rounded-2xl', \n halo: () => props.halo, \n}); \n \n/** Horizontal padding from tokens; vertical padding stays size-stepped. */\nconst wrapperPaddingClasses = computed(() => {\n const pyByControl: Record<string, string> = {\n 'h-8': 'py-1', 'h-9': 'py-1.5', 'h-10': 'py-2', 'h-12': 'py-3',\n };\n const py = pyByControl[sz.value.control] ?? 'py-2';\n return `${sz.value.padX} ${py}`;\n});\n\n/** Min-height mirrors the control scale (h-8/h-9/h-10/h-12 → min-h-8/9/10/12). */\nconst wrapperMinHeightClass = computed(() => sz.value.control.replace('h-', 'min-h-'));\n\nconst textareaTextClasses = computed(() => `${sz.value.text} leading-relaxed`); \n \nconst resizeClass = computed(() => { \n if (props.autoresize) return 'resize-none'; \n switch (props.resize) { \n case 'none': return 'resize-none'; \n case 'horizontal': return 'resize-x'; \n case 'both': return 'resize'; \n case 'vertical': \n default: return 'resize-y'; \n } \n}); \n \nfunction adjustHeight() { \n if (!props.autoresize) return; \n const el = textareaRef.value; \n if (!el) return; \n \n el.style.height = 'auto'; \n \n const styles = window.getComputedStyle(el); \n const lineHeight = parseFloat(styles.lineHeight) || 20; \n const paddingTop = parseFloat(styles.paddingTop) || 0; \n const paddingBottom = parseFloat(styles.paddingBottom) || 0; \n const borderTop = parseFloat(styles.borderTopWidth) || 0; \n const borderBottom = parseFloat(styles.borderBottomWidth) || 0; \n \n const maxHeight = \n lineHeight * props.maxRows + paddingTop + paddingBottom + borderTop + borderBottom; \n const next = Math.min(el.scrollHeight, maxHeight); \n \n el.style.height = `${next}px`; \n el.style.overflowY = el.scrollHeight > maxHeight ? 'auto' : 'hidden'; \n} \n \nfunction onInput(e: Event) { \n const target = e.target as HTMLTextAreaElement; \n emit('update:modelValue', target.value); \n if (props.autoresize) nextTick(adjustHeight); \n} \n \nfunction onChange(e: Event) { \n const target = e.target as HTMLTextAreaElement; \n emit('change', target.value); \n} \n \nfunction onClear() { \n emit('update:modelValue', ''); \n emit('clear'); \n textareaRef.value?.focus(); \n if (props.autoresize) nextTick(adjustHeight); \n} \n \nwatch(() => props.modelValue, () => { \n if (props.autoresize) nextTick(adjustHeight); \n}); \nwatch(() => props.autoresize, (v) => { \n if (v) nextTick(adjustHeight); \n else if (textareaRef.value) { \n textareaRef.value.style.height = ''; \n textareaRef.value.style.overflowY = ''; \n } \n}); \nwatch(() => props.maxRows, () => { \n if (props.autoresize) nextTick(adjustHeight); \n}); \n \nonMounted(() => { \n if (props.autoresize) adjustHeight(); \n}); \n \ndefineExpose({ \n focus: () => textareaRef.value?.focus(), \n blur: () => textareaRef.value?.blur(), \n select: () => textareaRef.value?.select(), \n textareaRef, \n}); \n</script>\n"],"mappings":""}
1
+ {"version":3,"file":"Textarea.cjs","names":[],"sources":["../../../src/components/forms/Textarea.vue"],"sourcesContent":["<template> \n <div :class=\"['flex flex-col gap-1.5', fullWidth ? 'w-full' : 'inline-flex']\"> \n <label \n v-if=\"label\" \n :for=\"fieldId\" \n class=\"text-caption font-medium text-foreground\" \n > \n {{ label }} \n <span v-if=\"required\" aria-hidden=\"true\" class=\"text-destructive ml-0.5\">*</span> \n </label> \n \n <div\n :class=\"[\n 'modo-field-wrapper flex items-start gap-2',\n wrapperVariantClasses,\n wrapperPaddingClasses,\n wrapperMinHeightClass,\n radiusClasses,\n fullWidth ? 'w-full' : '',\n isDisabled ? 'opacity-60 cursor-not-allowed' : '',\n ]\"\n > \n <textarea \n :id=\"fieldId\" \n ref=\"textareaRef\" \n :value=\"modelValue ?? ''\" \n :placeholder=\"placeholder\" \n :disabled=\"isDisabled\" \n :readonly=\"readonly\" \n :required=\"required\" \n :name=\"name\" \n :autofocus=\"autofocus\" \n :maxlength=\"maxLength\" \n :rows=\"rows\" \n :aria-label=\"!label ? ariaLabel : undefined\" \n :aria-invalid=\"hasError || undefined\" \n :aria-describedby=\"describedBy\" \n :aria-required=\"required || undefined\" \n :class=\"[ \n 'modo-field-native flex-1 min-w-0 bg-transparent p-0', \n 'text-foreground placeholder:text-muted-foreground', \n 'disabled:cursor-not-allowed', \n textareaTextClasses, \n resizeClass, \n autoresize ? 'overflow-hidden' : '', \n ]\" \n @input=\"onInput\" \n @change=\"onChange\" \n @focus=\"$emit('focus', $event)\" \n @blur=\"$emit('blur', $event)\" \n /> \n \n <div class=\"flex flex-col items-center gap-1 shrink-0 pt-0.5\"> \n <Button \n v-if=\"clearable && hasValue && !isDisabled && !readonly\" \n variant=\"text\" \n size=\"xs\" \n radius=\"full\" \n :icon=\"XMarkIcon\" \n :ariaLabel=\"loc.textarea.clear\" \n tabindex=\"-1\" \n class=\"text-muted-foreground hover:text-foreground\" \n @click=\"onClear\" \n /> \n \n <Loader \n v-if=\"loading\" \n :size=\"size === 'large' ? 'medium' : 'small'\" \n class=\"text-muted-foreground\" \n /> \n </div> \n </div> \n \n <div \n v-if=\"errorText || helperText || showCounterEffective\" \n class=\"flex items-start justify-between gap-2\" \n > \n <Typography \n v-if=\"errorText\" \n :id=\"errorId\" \n variant=\"caption\" \n size=\"medium\" \n color=\"danger\" \n as=\"p\" \n > \n {{ errorText }} \n </Typography> \n <Typography \n v-else-if=\"helperText\" \n :id=\"helperId\" \n variant=\"caption\" \n size=\"medium\" \n color=\"muted\" \n as=\"p\" \n > \n {{ helperText }} \n </Typography> \n <span v-else class=\"flex-1\" /> \n \n <span \n v-if=\"showCounterEffective\" \n :id=\"counterId\" \n :class=\"[ \n 'text-caption shrink-0 tabular-nums', \n counterOverflow ? 'text-destructive' : 'text-muted-foreground', \n ]\" \n > \n {{ currentLength }}/{{ maxLength }} \n </span> \n </div> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, nextTick, onMounted, ref, watch } from 'vue'; \nimport type { Textarea } from '../../interfaces/forms/Textarea.interface'; \nimport { useFieldState, useFieldClasses } from '../../composables/useField'; \nimport Loader from '../feedback/Loader.vue'; \nimport Button from './Button.vue'; \nimport { XMarkIcon } from '@heroicons/vue/24/outline'; \nimport Typography from '../data-display/Typography.vue'; \nimport { useModoLocale, useResolvedSize, useSizeTokens } from '../../composables/useModoConfig';\n \nconst loc = useModoLocale(); \n \nconst emit = defineEmits<{ \n 'update:modelValue': [value: string]; \n change: [value: string]; \n focus: [event: FocusEvent]; \n blur: [event: FocusEvent]; \n clear: []; \n}>(); \n \nconst props = withDefaults(defineProps<Textarea>(), { \n variant: 'outline', \n color: 'default', \n disabled: false, \n readonly: false, \n required: false, \n loading: false, \n clearable: false, \n fullWidth: false, \n showCounter: false, \n autofocus: false, \n rows: 3, \n autoresize: false, \n maxRows: 8, \n resize: 'vertical', \n}); \n \nconst resolvedSize = useResolvedSize(() => props.size);\nconst sz = useSizeTokens(() => props.size);\n\nconst textareaRef = ref<HTMLTextAreaElement | null>(null); \n \nconst { \n fieldId, \n radius, \n stateColor, \n hasError, \n hasValue, \n isDisabled, \n currentLength, \n showCounterEffective, \n counterOverflow, \n errorId, \n helperId, \n counterId, \n describedBy, \n} = useFieldState(props, { componentName: 'Textarea', idPrefix: 'modo-textarea' }); \n \nconst { wrapperVariantClasses, radiusClasses } = useFieldClasses({ \n variant: () => props.variant, \n stateColor, \n hasError, \n radius, \n radiusKind: 'surface', \n halo: () => props.halo, \n}); \n \n/** Horizontal padding from tokens; vertical padding stays size-stepped. */\nconst wrapperPaddingClasses = computed(() => {\n const pyByControl: Record<string, string> = {\n 'h-8': 'py-1', 'h-9': 'py-1.5', 'h-10': 'py-2', 'h-12': 'py-3',\n };\n const py = pyByControl[sz.value.control] ?? 'py-2';\n return `${sz.value.padX} ${py}`;\n});\n\n/** Min-height mirrors the control scale (h-8/h-9/h-10/h-12 → min-h-8/9/10/12). */\nconst wrapperMinHeightClass = computed(() => sz.value.control.replace('h-', 'min-h-'));\n\nconst textareaTextClasses = computed(() => `${sz.value.text} leading-relaxed`); \n \nconst resizeClass = computed(() => { \n if (props.autoresize) return 'resize-none'; \n switch (props.resize) { \n case 'none': return 'resize-none'; \n case 'horizontal': return 'resize-x'; \n case 'both': return 'resize'; \n case 'vertical': \n default: return 'resize-y'; \n } \n}); \n \nfunction adjustHeight() { \n if (!props.autoresize) return; \n const el = textareaRef.value; \n if (!el) return; \n \n el.style.height = 'auto'; \n \n const styles = window.getComputedStyle(el); \n const lineHeight = parseFloat(styles.lineHeight) || 20; \n const paddingTop = parseFloat(styles.paddingTop) || 0; \n const paddingBottom = parseFloat(styles.paddingBottom) || 0; \n const borderTop = parseFloat(styles.borderTopWidth) || 0; \n const borderBottom = parseFloat(styles.borderBottomWidth) || 0; \n \n const maxHeight = \n lineHeight * props.maxRows + paddingTop + paddingBottom + borderTop + borderBottom; \n const next = Math.min(el.scrollHeight, maxHeight); \n \n el.style.height = `${next}px`; \n el.style.overflowY = el.scrollHeight > maxHeight ? 'auto' : 'hidden'; \n} \n \nfunction onInput(e: Event) { \n const target = e.target as HTMLTextAreaElement; \n emit('update:modelValue', target.value); \n if (props.autoresize) nextTick(adjustHeight); \n} \n \nfunction onChange(e: Event) { \n const target = e.target as HTMLTextAreaElement; \n emit('change', target.value); \n} \n \nfunction onClear() { \n emit('update:modelValue', ''); \n emit('clear'); \n textareaRef.value?.focus(); \n if (props.autoresize) nextTick(adjustHeight); \n} \n \nwatch(() => props.modelValue, () => { \n if (props.autoresize) nextTick(adjustHeight); \n}); \nwatch(() => props.autoresize, (v) => { \n if (v) nextTick(adjustHeight); \n else if (textareaRef.value) { \n textareaRef.value.style.height = ''; \n textareaRef.value.style.overflowY = ''; \n } \n}); \nwatch(() => props.maxRows, () => { \n if (props.autoresize) nextTick(adjustHeight); \n}); \n \nonMounted(() => { \n if (props.autoresize) adjustHeight(); \n}); \n \ndefineExpose({ \n focus: () => textareaRef.value?.focus(), \n blur: () => textareaRef.value?.blur(), \n select: () => textareaRef.value?.select(), \n textareaRef, \n}); \n</script>\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.mjs","names":[],"sources":["../../../src/components/forms/Textarea.vue"],"sourcesContent":["<template> \n <div :class=\"['flex flex-col gap-1.5', fullWidth ? 'w-full' : 'inline-flex']\"> \n <label \n v-if=\"label\" \n :for=\"fieldId\" \n class=\"text-caption font-medium text-foreground\" \n > \n {{ label }} \n <span v-if=\"required\" aria-hidden=\"true\" class=\"text-destructive ml-0.5\">*</span> \n </label> \n \n <div\n :class=\"[\n 'modo-field-wrapper flex items-start gap-2',\n wrapperVariantClasses,\n wrapperPaddingClasses,\n wrapperMinHeightClass,\n radiusClasses,\n fullWidth ? 'w-full' : '',\n isDisabled ? 'opacity-60 cursor-not-allowed' : '',\n ]\"\n > \n <textarea \n :id=\"fieldId\" \n ref=\"textareaRef\" \n :value=\"modelValue ?? ''\" \n :placeholder=\"placeholder\" \n :disabled=\"isDisabled\" \n :readonly=\"readonly\" \n :required=\"required\" \n :name=\"name\" \n :autofocus=\"autofocus\" \n :maxlength=\"maxLength\" \n :rows=\"rows\" \n :aria-label=\"!label ? ariaLabel : undefined\" \n :aria-invalid=\"hasError || undefined\" \n :aria-describedby=\"describedBy\" \n :aria-required=\"required || undefined\" \n :class=\"[ \n 'modo-field-native flex-1 min-w-0 bg-transparent p-0', \n 'text-foreground placeholder:text-muted-foreground', \n 'disabled:cursor-not-allowed', \n textareaTextClasses, \n resizeClass, \n autoresize ? 'overflow-hidden' : '', \n ]\" \n @input=\"onInput\" \n @change=\"onChange\" \n @focus=\"$emit('focus', $event)\" \n @blur=\"$emit('blur', $event)\" \n /> \n \n <div class=\"flex flex-col items-center gap-1 shrink-0 pt-0.5\"> \n <Button \n v-if=\"clearable && hasValue && !isDisabled && !readonly\" \n variant=\"text\" \n size=\"xs\" \n radius=\"full\" \n :icon=\"XMarkIcon\" \n :ariaLabel=\"loc.textarea.clear\" \n tabindex=\"-1\" \n class=\"text-muted-foreground hover:text-foreground\" \n @click=\"onClear\" \n /> \n \n <Loader \n v-if=\"loading\" \n :size=\"size === 'large' ? 'medium' : 'small'\" \n class=\"text-muted-foreground\" \n /> \n </div> \n </div> \n \n <div \n v-if=\"errorText || helperText || showCounterEffective\" \n class=\"flex items-start justify-between gap-2\" \n > \n <Typography \n v-if=\"errorText\" \n :id=\"errorId\" \n variant=\"caption\" \n size=\"medium\" \n color=\"danger\" \n as=\"p\" \n > \n {{ errorText }} \n </Typography> \n <Typography \n v-else-if=\"helperText\" \n :id=\"helperId\" \n variant=\"caption\" \n size=\"medium\" \n color=\"muted\" \n as=\"p\" \n > \n {{ helperText }} \n </Typography> \n <span v-else class=\"flex-1\" /> \n \n <span \n v-if=\"showCounterEffective\" \n :id=\"counterId\" \n :class=\"[ \n 'text-caption shrink-0 tabular-nums', \n counterOverflow ? 'text-destructive' : 'text-muted-foreground', \n ]\" \n > \n {{ currentLength }}/{{ maxLength }} \n </span> \n </div> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, nextTick, onMounted, ref, watch } from 'vue'; \nimport type { Textarea } from '../../interfaces/forms/Textarea.interface'; \nimport { useFieldState, useFieldClasses } from '../../composables/useField'; \nimport Loader from '../feedback/Loader.vue'; \nimport Button from './Button.vue'; \nimport { XMarkIcon } from '@heroicons/vue/24/outline'; \nimport Typography from '../data-display/Typography.vue'; \nimport { useModoLocale, useResolvedSize, useSizeTokens } from '../../composables/useModoConfig';\n \nconst loc = useModoLocale(); \n \nconst emit = defineEmits<{ \n 'update:modelValue': [value: string]; \n change: [value: string]; \n focus: [event: FocusEvent]; \n blur: [event: FocusEvent]; \n clear: []; \n}>(); \n \nconst props = withDefaults(defineProps<Textarea>(), { \n variant: 'outline', \n color: 'default', \n disabled: false, \n readonly: false, \n required: false, \n loading: false, \n clearable: false, \n fullWidth: false, \n showCounter: false, \n autofocus: false, \n rows: 3, \n autoresize: false, \n maxRows: 8, \n resize: 'vertical', \n}); \n \nconst resolvedSize = useResolvedSize(() => props.size);\nconst sz = useSizeTokens(() => props.size);\n\nconst textareaRef = ref<HTMLTextAreaElement | null>(null); \n \nconst { \n fieldId, \n radius, \n stateColor, \n hasError, \n hasValue, \n isDisabled, \n currentLength, \n showCounterEffective, \n counterOverflow, \n errorId, \n helperId, \n counterId, \n describedBy, \n} = useFieldState(props, { componentName: 'Textarea', idPrefix: 'modo-textarea' }); \n \nconst { wrapperVariantClasses, radiusClasses } = useFieldClasses({ \n variant: () => props.variant, \n stateColor, \n hasError, \n radius, \n fullRadiusClass: 'rounded-2xl', \n halo: () => props.halo, \n}); \n \n/** Horizontal padding from tokens; vertical padding stays size-stepped. */\nconst wrapperPaddingClasses = computed(() => {\n const pyByControl: Record<string, string> = {\n 'h-8': 'py-1', 'h-9': 'py-1.5', 'h-10': 'py-2', 'h-12': 'py-3',\n };\n const py = pyByControl[sz.value.control] ?? 'py-2';\n return `${sz.value.padX} ${py}`;\n});\n\n/** Min-height mirrors the control scale (h-8/h-9/h-10/h-12 → min-h-8/9/10/12). */\nconst wrapperMinHeightClass = computed(() => sz.value.control.replace('h-', 'min-h-'));\n\nconst textareaTextClasses = computed(() => `${sz.value.text} leading-relaxed`); \n \nconst resizeClass = computed(() => { \n if (props.autoresize) return 'resize-none'; \n switch (props.resize) { \n case 'none': return 'resize-none'; \n case 'horizontal': return 'resize-x'; \n case 'both': return 'resize'; \n case 'vertical': \n default: return 'resize-y'; \n } \n}); \n \nfunction adjustHeight() { \n if (!props.autoresize) return; \n const el = textareaRef.value; \n if (!el) return; \n \n el.style.height = 'auto'; \n \n const styles = window.getComputedStyle(el); \n const lineHeight = parseFloat(styles.lineHeight) || 20; \n const paddingTop = parseFloat(styles.paddingTop) || 0; \n const paddingBottom = parseFloat(styles.paddingBottom) || 0; \n const borderTop = parseFloat(styles.borderTopWidth) || 0; \n const borderBottom = parseFloat(styles.borderBottomWidth) || 0; \n \n const maxHeight = \n lineHeight * props.maxRows + paddingTop + paddingBottom + borderTop + borderBottom; \n const next = Math.min(el.scrollHeight, maxHeight); \n \n el.style.height = `${next}px`; \n el.style.overflowY = el.scrollHeight > maxHeight ? 'auto' : 'hidden'; \n} \n \nfunction onInput(e: Event) { \n const target = e.target as HTMLTextAreaElement; \n emit('update:modelValue', target.value); \n if (props.autoresize) nextTick(adjustHeight); \n} \n \nfunction onChange(e: Event) { \n const target = e.target as HTMLTextAreaElement; \n emit('change', target.value); \n} \n \nfunction onClear() { \n emit('update:modelValue', ''); \n emit('clear'); \n textareaRef.value?.focus(); \n if (props.autoresize) nextTick(adjustHeight); \n} \n \nwatch(() => props.modelValue, () => { \n if (props.autoresize) nextTick(adjustHeight); \n}); \nwatch(() => props.autoresize, (v) => { \n if (v) nextTick(adjustHeight); \n else if (textareaRef.value) { \n textareaRef.value.style.height = ''; \n textareaRef.value.style.overflowY = ''; \n } \n}); \nwatch(() => props.maxRows, () => { \n if (props.autoresize) nextTick(adjustHeight); \n}); \n \nonMounted(() => { \n if (props.autoresize) adjustHeight(); \n}); \n \ndefineExpose({ \n focus: () => textareaRef.value?.focus(), \n blur: () => textareaRef.value?.blur(), \n select: () => textareaRef.value?.select(), \n textareaRef, \n}); \n</script>\n"],"mappings":""}
1
+ {"version":3,"file":"Textarea.mjs","names":[],"sources":["../../../src/components/forms/Textarea.vue"],"sourcesContent":["<template> \n <div :class=\"['flex flex-col gap-1.5', fullWidth ? 'w-full' : 'inline-flex']\"> \n <label \n v-if=\"label\" \n :for=\"fieldId\" \n class=\"text-caption font-medium text-foreground\" \n > \n {{ label }} \n <span v-if=\"required\" aria-hidden=\"true\" class=\"text-destructive ml-0.5\">*</span> \n </label> \n \n <div\n :class=\"[\n 'modo-field-wrapper flex items-start gap-2',\n wrapperVariantClasses,\n wrapperPaddingClasses,\n wrapperMinHeightClass,\n radiusClasses,\n fullWidth ? 'w-full' : '',\n isDisabled ? 'opacity-60 cursor-not-allowed' : '',\n ]\"\n > \n <textarea \n :id=\"fieldId\" \n ref=\"textareaRef\" \n :value=\"modelValue ?? ''\" \n :placeholder=\"placeholder\" \n :disabled=\"isDisabled\" \n :readonly=\"readonly\" \n :required=\"required\" \n :name=\"name\" \n :autofocus=\"autofocus\" \n :maxlength=\"maxLength\" \n :rows=\"rows\" \n :aria-label=\"!label ? ariaLabel : undefined\" \n :aria-invalid=\"hasError || undefined\" \n :aria-describedby=\"describedBy\" \n :aria-required=\"required || undefined\" \n :class=\"[ \n 'modo-field-native flex-1 min-w-0 bg-transparent p-0', \n 'text-foreground placeholder:text-muted-foreground', \n 'disabled:cursor-not-allowed', \n textareaTextClasses, \n resizeClass, \n autoresize ? 'overflow-hidden' : '', \n ]\" \n @input=\"onInput\" \n @change=\"onChange\" \n @focus=\"$emit('focus', $event)\" \n @blur=\"$emit('blur', $event)\" \n /> \n \n <div class=\"flex flex-col items-center gap-1 shrink-0 pt-0.5\"> \n <Button \n v-if=\"clearable && hasValue && !isDisabled && !readonly\" \n variant=\"text\" \n size=\"xs\" \n radius=\"full\" \n :icon=\"XMarkIcon\" \n :ariaLabel=\"loc.textarea.clear\" \n tabindex=\"-1\" \n class=\"text-muted-foreground hover:text-foreground\" \n @click=\"onClear\" \n /> \n \n <Loader \n v-if=\"loading\" \n :size=\"size === 'large' ? 'medium' : 'small'\" \n class=\"text-muted-foreground\" \n /> \n </div> \n </div> \n \n <div \n v-if=\"errorText || helperText || showCounterEffective\" \n class=\"flex items-start justify-between gap-2\" \n > \n <Typography \n v-if=\"errorText\" \n :id=\"errorId\" \n variant=\"caption\" \n size=\"medium\" \n color=\"danger\" \n as=\"p\" \n > \n {{ errorText }} \n </Typography> \n <Typography \n v-else-if=\"helperText\" \n :id=\"helperId\" \n variant=\"caption\" \n size=\"medium\" \n color=\"muted\" \n as=\"p\" \n > \n {{ helperText }} \n </Typography> \n <span v-else class=\"flex-1\" /> \n \n <span \n v-if=\"showCounterEffective\" \n :id=\"counterId\" \n :class=\"[ \n 'text-caption shrink-0 tabular-nums', \n counterOverflow ? 'text-destructive' : 'text-muted-foreground', \n ]\" \n > \n {{ currentLength }}/{{ maxLength }} \n </span> \n </div> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, nextTick, onMounted, ref, watch } from 'vue'; \nimport type { Textarea } from '../../interfaces/forms/Textarea.interface'; \nimport { useFieldState, useFieldClasses } from '../../composables/useField'; \nimport Loader from '../feedback/Loader.vue'; \nimport Button from './Button.vue'; \nimport { XMarkIcon } from '@heroicons/vue/24/outline'; \nimport Typography from '../data-display/Typography.vue'; \nimport { useModoLocale, useResolvedSize, useSizeTokens } from '../../composables/useModoConfig';\n \nconst loc = useModoLocale(); \n \nconst emit = defineEmits<{ \n 'update:modelValue': [value: string]; \n change: [value: string]; \n focus: [event: FocusEvent]; \n blur: [event: FocusEvent]; \n clear: []; \n}>(); \n \nconst props = withDefaults(defineProps<Textarea>(), { \n variant: 'outline', \n color: 'default', \n disabled: false, \n readonly: false, \n required: false, \n loading: false, \n clearable: false, \n fullWidth: false, \n showCounter: false, \n autofocus: false, \n rows: 3, \n autoresize: false, \n maxRows: 8, \n resize: 'vertical', \n}); \n \nconst resolvedSize = useResolvedSize(() => props.size);\nconst sz = useSizeTokens(() => props.size);\n\nconst textareaRef = ref<HTMLTextAreaElement | null>(null); \n \nconst { \n fieldId, \n radius, \n stateColor, \n hasError, \n hasValue, \n isDisabled, \n currentLength, \n showCounterEffective, \n counterOverflow, \n errorId, \n helperId, \n counterId, \n describedBy, \n} = useFieldState(props, { componentName: 'Textarea', idPrefix: 'modo-textarea' }); \n \nconst { wrapperVariantClasses, radiusClasses } = useFieldClasses({ \n variant: () => props.variant, \n stateColor, \n hasError, \n radius, \n radiusKind: 'surface', \n halo: () => props.halo, \n}); \n \n/** Horizontal padding from tokens; vertical padding stays size-stepped. */\nconst wrapperPaddingClasses = computed(() => {\n const pyByControl: Record<string, string> = {\n 'h-8': 'py-1', 'h-9': 'py-1.5', 'h-10': 'py-2', 'h-12': 'py-3',\n };\n const py = pyByControl[sz.value.control] ?? 'py-2';\n return `${sz.value.padX} ${py}`;\n});\n\n/** Min-height mirrors the control scale (h-8/h-9/h-10/h-12 → min-h-8/9/10/12). */\nconst wrapperMinHeightClass = computed(() => sz.value.control.replace('h-', 'min-h-'));\n\nconst textareaTextClasses = computed(() => `${sz.value.text} leading-relaxed`); \n \nconst resizeClass = computed(() => { \n if (props.autoresize) return 'resize-none'; \n switch (props.resize) { \n case 'none': return 'resize-none'; \n case 'horizontal': return 'resize-x'; \n case 'both': return 'resize'; \n case 'vertical': \n default: return 'resize-y'; \n } \n}); \n \nfunction adjustHeight() { \n if (!props.autoresize) return; \n const el = textareaRef.value; \n if (!el) return; \n \n el.style.height = 'auto'; \n \n const styles = window.getComputedStyle(el); \n const lineHeight = parseFloat(styles.lineHeight) || 20; \n const paddingTop = parseFloat(styles.paddingTop) || 0; \n const paddingBottom = parseFloat(styles.paddingBottom) || 0; \n const borderTop = parseFloat(styles.borderTopWidth) || 0; \n const borderBottom = parseFloat(styles.borderBottomWidth) || 0; \n \n const maxHeight = \n lineHeight * props.maxRows + paddingTop + paddingBottom + borderTop + borderBottom; \n const next = Math.min(el.scrollHeight, maxHeight); \n \n el.style.height = `${next}px`; \n el.style.overflowY = el.scrollHeight > maxHeight ? 'auto' : 'hidden'; \n} \n \nfunction onInput(e: Event) { \n const target = e.target as HTMLTextAreaElement; \n emit('update:modelValue', target.value); \n if (props.autoresize) nextTick(adjustHeight); \n} \n \nfunction onChange(e: Event) { \n const target = e.target as HTMLTextAreaElement; \n emit('change', target.value); \n} \n \nfunction onClear() { \n emit('update:modelValue', ''); \n emit('clear'); \n textareaRef.value?.focus(); \n if (props.autoresize) nextTick(adjustHeight); \n} \n \nwatch(() => props.modelValue, () => { \n if (props.autoresize) nextTick(adjustHeight); \n}); \nwatch(() => props.autoresize, (v) => { \n if (v) nextTick(adjustHeight); \n else if (textareaRef.value) { \n textareaRef.value.style.height = ''; \n textareaRef.value.style.overflowY = ''; \n } \n}); \nwatch(() => props.maxRows, () => { \n if (props.autoresize) nextTick(adjustHeight); \n}); \n \nonMounted(() => { \n if (props.autoresize) adjustHeight(); \n}); \n \ndefineExpose({ \n focus: () => textareaRef.value?.focus(), \n blur: () => textareaRef.value?.blur(), \n select: () => textareaRef.value?.select(), \n textareaRef, \n}); \n</script>\n"],"mappings":""}
@@ -121,7 +121,7 @@ var Textarea_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, v
121
121
  stateColor,
122
122
  hasError,
123
123
  radius,
124
- fullRadiusClass: "rounded-2xl",
124
+ radiusKind: "surface",
125
125
  halo: () => props.halo
126
126
  });
127
127
  /** Horizontal padding from tokens; vertical padding stays size-stepped. */
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.vue_vue_type_script_setup_true_lang.cjs","names":["$emit"],"sources":["../../../src/components/forms/Textarea.vue"],"sourcesContent":["<template> \n <div :class=\"['flex flex-col gap-1.5', fullWidth ? 'w-full' : 'inline-flex']\"> \n <label \n v-if=\"label\" \n :for=\"fieldId\" \n class=\"text-caption font-medium text-foreground\" \n > \n {{ label }} \n <span v-if=\"required\" aria-hidden=\"true\" class=\"text-destructive ml-0.5\">*</span> \n </label> \n \n <div\n :class=\"[\n 'modo-field-wrapper flex items-start gap-2',\n wrapperVariantClasses,\n wrapperPaddingClasses,\n wrapperMinHeightClass,\n radiusClasses,\n fullWidth ? 'w-full' : '',\n isDisabled ? 'opacity-60 cursor-not-allowed' : '',\n ]\"\n > \n <textarea \n :id=\"fieldId\" \n ref=\"textareaRef\" \n :value=\"modelValue ?? ''\" \n :placeholder=\"placeholder\" \n :disabled=\"isDisabled\" \n :readonly=\"readonly\" \n :required=\"required\" \n :name=\"name\" \n :autofocus=\"autofocus\" \n :maxlength=\"maxLength\" \n :rows=\"rows\" \n :aria-label=\"!label ? ariaLabel : undefined\" \n :aria-invalid=\"hasError || undefined\" \n :aria-describedby=\"describedBy\" \n :aria-required=\"required || undefined\" \n :class=\"[ \n 'modo-field-native flex-1 min-w-0 bg-transparent p-0', \n 'text-foreground placeholder:text-muted-foreground', \n 'disabled:cursor-not-allowed', \n textareaTextClasses, \n resizeClass, \n autoresize ? 'overflow-hidden' : '', \n ]\" \n @input=\"onInput\" \n @change=\"onChange\" \n @focus=\"$emit('focus', $event)\" \n @blur=\"$emit('blur', $event)\" \n /> \n \n <div class=\"flex flex-col items-center gap-1 shrink-0 pt-0.5\"> \n <Button \n v-if=\"clearable && hasValue && !isDisabled && !readonly\" \n variant=\"text\" \n size=\"xs\" \n radius=\"full\" \n :icon=\"XMarkIcon\" \n :ariaLabel=\"loc.textarea.clear\" \n tabindex=\"-1\" \n class=\"text-muted-foreground hover:text-foreground\" \n @click=\"onClear\" \n /> \n \n <Loader \n v-if=\"loading\" \n :size=\"size === 'large' ? 'medium' : 'small'\" \n class=\"text-muted-foreground\" \n /> \n </div> \n </div> \n \n <div \n v-if=\"errorText || helperText || showCounterEffective\" \n class=\"flex items-start justify-between gap-2\" \n > \n <Typography \n v-if=\"errorText\" \n :id=\"errorId\" \n variant=\"caption\" \n size=\"medium\" \n color=\"danger\" \n as=\"p\" \n > \n {{ errorText }} \n </Typography> \n <Typography \n v-else-if=\"helperText\" \n :id=\"helperId\" \n variant=\"caption\" \n size=\"medium\" \n color=\"muted\" \n as=\"p\" \n > \n {{ helperText }} \n </Typography> \n <span v-else class=\"flex-1\" /> \n \n <span \n v-if=\"showCounterEffective\" \n :id=\"counterId\" \n :class=\"[ \n 'text-caption shrink-0 tabular-nums', \n counterOverflow ? 'text-destructive' : 'text-muted-foreground', \n ]\" \n > \n {{ currentLength }}/{{ maxLength }} \n </span> \n </div> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, nextTick, onMounted, ref, watch } from 'vue'; \nimport type { Textarea } from '../../interfaces/forms/Textarea.interface'; \nimport { useFieldState, useFieldClasses } from '../../composables/useField'; \nimport Loader from '../feedback/Loader.vue'; \nimport Button from './Button.vue'; \nimport { XMarkIcon } from '@heroicons/vue/24/outline'; \nimport Typography from '../data-display/Typography.vue'; \nimport { useModoLocale, useResolvedSize, useSizeTokens } from '../../composables/useModoConfig';\n \nconst loc = useModoLocale(); \n \nconst emit = defineEmits<{ \n 'update:modelValue': [value: string]; \n change: [value: string]; \n focus: [event: FocusEvent]; \n blur: [event: FocusEvent]; \n clear: []; \n}>(); \n \nconst props = withDefaults(defineProps<Textarea>(), { \n variant: 'outline', \n color: 'default', \n disabled: false, \n readonly: false, \n required: false, \n loading: false, \n clearable: false, \n fullWidth: false, \n showCounter: false, \n autofocus: false, \n rows: 3, \n autoresize: false, \n maxRows: 8, \n resize: 'vertical', \n}); \n \nconst resolvedSize = useResolvedSize(() => props.size);\nconst sz = useSizeTokens(() => props.size);\n\nconst textareaRef = ref<HTMLTextAreaElement | null>(null); \n \nconst { \n fieldId, \n radius, \n stateColor, \n hasError, \n hasValue, \n isDisabled, \n currentLength, \n showCounterEffective, \n counterOverflow, \n errorId, \n helperId, \n counterId, \n describedBy, \n} = useFieldState(props, { componentName: 'Textarea', idPrefix: 'modo-textarea' }); \n \nconst { wrapperVariantClasses, radiusClasses } = useFieldClasses({ \n variant: () => props.variant, \n stateColor, \n hasError, \n radius, \n fullRadiusClass: 'rounded-2xl', \n halo: () => props.halo, \n}); \n \n/** Horizontal padding from tokens; vertical padding stays size-stepped. */\nconst wrapperPaddingClasses = computed(() => {\n const pyByControl: Record<string, string> = {\n 'h-8': 'py-1', 'h-9': 'py-1.5', 'h-10': 'py-2', 'h-12': 'py-3',\n };\n const py = pyByControl[sz.value.control] ?? 'py-2';\n return `${sz.value.padX} ${py}`;\n});\n\n/** Min-height mirrors the control scale (h-8/h-9/h-10/h-12 → min-h-8/9/10/12). */\nconst wrapperMinHeightClass = computed(() => sz.value.control.replace('h-', 'min-h-'));\n\nconst textareaTextClasses = computed(() => `${sz.value.text} leading-relaxed`); \n \nconst resizeClass = computed(() => { \n if (props.autoresize) return 'resize-none'; \n switch (props.resize) { \n case 'none': return 'resize-none'; \n case 'horizontal': return 'resize-x'; \n case 'both': return 'resize'; \n case 'vertical': \n default: return 'resize-y'; \n } \n}); \n \nfunction adjustHeight() { \n if (!props.autoresize) return; \n const el = textareaRef.value; \n if (!el) return; \n \n el.style.height = 'auto'; \n \n const styles = window.getComputedStyle(el); \n const lineHeight = parseFloat(styles.lineHeight) || 20; \n const paddingTop = parseFloat(styles.paddingTop) || 0; \n const paddingBottom = parseFloat(styles.paddingBottom) || 0; \n const borderTop = parseFloat(styles.borderTopWidth) || 0; \n const borderBottom = parseFloat(styles.borderBottomWidth) || 0; \n \n const maxHeight = \n lineHeight * props.maxRows + paddingTop + paddingBottom + borderTop + borderBottom; \n const next = Math.min(el.scrollHeight, maxHeight); \n \n el.style.height = `${next}px`; \n el.style.overflowY = el.scrollHeight > maxHeight ? 'auto' : 'hidden'; \n} \n \nfunction onInput(e: Event) { \n const target = e.target as HTMLTextAreaElement; \n emit('update:modelValue', target.value); \n if (props.autoresize) nextTick(adjustHeight); \n} \n \nfunction onChange(e: Event) { \n const target = e.target as HTMLTextAreaElement; \n emit('change', target.value); \n} \n \nfunction onClear() { \n emit('update:modelValue', ''); \n emit('clear'); \n textareaRef.value?.focus(); \n if (props.autoresize) nextTick(adjustHeight); \n} \n \nwatch(() => props.modelValue, () => { \n if (props.autoresize) nextTick(adjustHeight); \n}); \nwatch(() => props.autoresize, (v) => { \n if (v) nextTick(adjustHeight); \n else if (textareaRef.value) { \n textareaRef.value.style.height = ''; \n textareaRef.value.style.overflowY = ''; \n } \n}); \nwatch(() => props.maxRows, () => { \n if (props.autoresize) nextTick(adjustHeight); \n}); \n \nonMounted(() => { \n if (props.autoresize) adjustHeight(); \n}); \n \ndefineExpose({ \n focus: () => textareaRef.value?.focus(), \n blur: () => textareaRef.value?.blur(), \n select: () => textareaRef.value?.select(), \n textareaRef, \n}); \n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2HA,MAAM,MAAM,sBAAA,eAAe;EAE3B,MAAM,OAAO;EAQb,MAAM,QAAQ;EAiBO,sBAAA,sBAAsB,MAAM,KAAK;EACtD,MAAM,KAAK,sBAAA,oBAAoB,MAAM,KAAK;EAE1C,MAAM,eAAA,GAAA,IAAA,KAA8C,KAAK;EAEzD,MAAM,EACF,SACA,QACA,YACA,UACA,UACA,YACA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A,iBAAI,QAAA,UAAS,EAAA,IAAA,WAAA,KAAA,GAAA,IAAA,oBAAA,IAAA,KAAA,CAAA,CAAA,KAAA,GAAA,IAAA,oBAAA,IAAA,KAAA"}
1
+ {"version":3,"file":"Textarea.vue_vue_type_script_setup_true_lang.cjs","names":["$emit"],"sources":["../../../src/components/forms/Textarea.vue"],"sourcesContent":["<template> \n <div :class=\"['flex flex-col gap-1.5', fullWidth ? 'w-full' : 'inline-flex']\"> \n <label \n v-if=\"label\" \n :for=\"fieldId\" \n class=\"text-caption font-medium text-foreground\" \n > \n {{ label }} \n <span v-if=\"required\" aria-hidden=\"true\" class=\"text-destructive ml-0.5\">*</span> \n </label> \n \n <div\n :class=\"[\n 'modo-field-wrapper flex items-start gap-2',\n wrapperVariantClasses,\n wrapperPaddingClasses,\n wrapperMinHeightClass,\n radiusClasses,\n fullWidth ? 'w-full' : '',\n isDisabled ? 'opacity-60 cursor-not-allowed' : '',\n ]\"\n > \n <textarea \n :id=\"fieldId\" \n ref=\"textareaRef\" \n :value=\"modelValue ?? ''\" \n :placeholder=\"placeholder\" \n :disabled=\"isDisabled\" \n :readonly=\"readonly\" \n :required=\"required\" \n :name=\"name\" \n :autofocus=\"autofocus\" \n :maxlength=\"maxLength\" \n :rows=\"rows\" \n :aria-label=\"!label ? ariaLabel : undefined\" \n :aria-invalid=\"hasError || undefined\" \n :aria-describedby=\"describedBy\" \n :aria-required=\"required || undefined\" \n :class=\"[ \n 'modo-field-native flex-1 min-w-0 bg-transparent p-0', \n 'text-foreground placeholder:text-muted-foreground', \n 'disabled:cursor-not-allowed', \n textareaTextClasses, \n resizeClass, \n autoresize ? 'overflow-hidden' : '', \n ]\" \n @input=\"onInput\" \n @change=\"onChange\" \n @focus=\"$emit('focus', $event)\" \n @blur=\"$emit('blur', $event)\" \n /> \n \n <div class=\"flex flex-col items-center gap-1 shrink-0 pt-0.5\"> \n <Button \n v-if=\"clearable && hasValue && !isDisabled && !readonly\" \n variant=\"text\" \n size=\"xs\" \n radius=\"full\" \n :icon=\"XMarkIcon\" \n :ariaLabel=\"loc.textarea.clear\" \n tabindex=\"-1\" \n class=\"text-muted-foreground hover:text-foreground\" \n @click=\"onClear\" \n /> \n \n <Loader \n v-if=\"loading\" \n :size=\"size === 'large' ? 'medium' : 'small'\" \n class=\"text-muted-foreground\" \n /> \n </div> \n </div> \n \n <div \n v-if=\"errorText || helperText || showCounterEffective\" \n class=\"flex items-start justify-between gap-2\" \n > \n <Typography \n v-if=\"errorText\" \n :id=\"errorId\" \n variant=\"caption\" \n size=\"medium\" \n color=\"danger\" \n as=\"p\" \n > \n {{ errorText }} \n </Typography> \n <Typography \n v-else-if=\"helperText\" \n :id=\"helperId\" \n variant=\"caption\" \n size=\"medium\" \n color=\"muted\" \n as=\"p\" \n > \n {{ helperText }} \n </Typography> \n <span v-else class=\"flex-1\" /> \n \n <span \n v-if=\"showCounterEffective\" \n :id=\"counterId\" \n :class=\"[ \n 'text-caption shrink-0 tabular-nums', \n counterOverflow ? 'text-destructive' : 'text-muted-foreground', \n ]\" \n > \n {{ currentLength }}/{{ maxLength }} \n </span> \n </div> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, nextTick, onMounted, ref, watch } from 'vue'; \nimport type { Textarea } from '../../interfaces/forms/Textarea.interface'; \nimport { useFieldState, useFieldClasses } from '../../composables/useField'; \nimport Loader from '../feedback/Loader.vue'; \nimport Button from './Button.vue'; \nimport { XMarkIcon } from '@heroicons/vue/24/outline'; \nimport Typography from '../data-display/Typography.vue'; \nimport { useModoLocale, useResolvedSize, useSizeTokens } from '../../composables/useModoConfig';\n \nconst loc = useModoLocale(); \n \nconst emit = defineEmits<{ \n 'update:modelValue': [value: string]; \n change: [value: string]; \n focus: [event: FocusEvent]; \n blur: [event: FocusEvent]; \n clear: []; \n}>(); \n \nconst props = withDefaults(defineProps<Textarea>(), { \n variant: 'outline', \n color: 'default', \n disabled: false, \n readonly: false, \n required: false, \n loading: false, \n clearable: false, \n fullWidth: false, \n showCounter: false, \n autofocus: false, \n rows: 3, \n autoresize: false, \n maxRows: 8, \n resize: 'vertical', \n}); \n \nconst resolvedSize = useResolvedSize(() => props.size);\nconst sz = useSizeTokens(() => props.size);\n\nconst textareaRef = ref<HTMLTextAreaElement | null>(null); \n \nconst { \n fieldId, \n radius, \n stateColor, \n hasError, \n hasValue, \n isDisabled, \n currentLength, \n showCounterEffective, \n counterOverflow, \n errorId, \n helperId, \n counterId, \n describedBy, \n} = useFieldState(props, { componentName: 'Textarea', idPrefix: 'modo-textarea' }); \n \nconst { wrapperVariantClasses, radiusClasses } = useFieldClasses({ \n variant: () => props.variant, \n stateColor, \n hasError, \n radius, \n radiusKind: 'surface', \n halo: () => props.halo, \n}); \n \n/** Horizontal padding from tokens; vertical padding stays size-stepped. */\nconst wrapperPaddingClasses = computed(() => {\n const pyByControl: Record<string, string> = {\n 'h-8': 'py-1', 'h-9': 'py-1.5', 'h-10': 'py-2', 'h-12': 'py-3',\n };\n const py = pyByControl[sz.value.control] ?? 'py-2';\n return `${sz.value.padX} ${py}`;\n});\n\n/** Min-height mirrors the control scale (h-8/h-9/h-10/h-12 → min-h-8/9/10/12). */\nconst wrapperMinHeightClass = computed(() => sz.value.control.replace('h-', 'min-h-'));\n\nconst textareaTextClasses = computed(() => `${sz.value.text} leading-relaxed`); \n \nconst resizeClass = computed(() => { \n if (props.autoresize) return 'resize-none'; \n switch (props.resize) { \n case 'none': return 'resize-none'; \n case 'horizontal': return 'resize-x'; \n case 'both': return 'resize'; \n case 'vertical': \n default: return 'resize-y'; \n } \n}); \n \nfunction adjustHeight() { \n if (!props.autoresize) return; \n const el = textareaRef.value; \n if (!el) return; \n \n el.style.height = 'auto'; \n \n const styles = window.getComputedStyle(el); \n const lineHeight = parseFloat(styles.lineHeight) || 20; \n const paddingTop = parseFloat(styles.paddingTop) || 0; \n const paddingBottom = parseFloat(styles.paddingBottom) || 0; \n const borderTop = parseFloat(styles.borderTopWidth) || 0; \n const borderBottom = parseFloat(styles.borderBottomWidth) || 0; \n \n const maxHeight = \n lineHeight * props.maxRows + paddingTop + paddingBottom + borderTop + borderBottom; \n const next = Math.min(el.scrollHeight, maxHeight); \n \n el.style.height = `${next}px`; \n el.style.overflowY = el.scrollHeight > maxHeight ? 'auto' : 'hidden'; \n} \n \nfunction onInput(e: Event) { \n const target = e.target as HTMLTextAreaElement; \n emit('update:modelValue', target.value); \n if (props.autoresize) nextTick(adjustHeight); \n} \n \nfunction onChange(e: Event) { \n const target = e.target as HTMLTextAreaElement; \n emit('change', target.value); \n} \n \nfunction onClear() { \n emit('update:modelValue', ''); \n emit('clear'); \n textareaRef.value?.focus(); \n if (props.autoresize) nextTick(adjustHeight); \n} \n \nwatch(() => props.modelValue, () => { \n if (props.autoresize) nextTick(adjustHeight); \n}); \nwatch(() => props.autoresize, (v) => { \n if (v) nextTick(adjustHeight); \n else if (textareaRef.value) { \n textareaRef.value.style.height = ''; \n textareaRef.value.style.overflowY = ''; \n } \n}); \nwatch(() => props.maxRows, () => { \n if (props.autoresize) nextTick(adjustHeight); \n}); \n \nonMounted(() => { \n if (props.autoresize) adjustHeight(); \n}); \n \ndefineExpose({ \n focus: () => textareaRef.value?.focus(), \n blur: () => textareaRef.value?.blur(), \n select: () => textareaRef.value?.select(), \n textareaRef, \n}); \n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2HA,MAAM,MAAM,sBAAA,eAAe;EAE3B,MAAM,OAAO;EAQb,MAAM,QAAQ;EAiBO,sBAAA,sBAAsB,MAAM,KAAK;EACtD,MAAM,KAAK,sBAAA,oBAAoB,MAAM,KAAK;EAE1C,MAAM,eAAA,GAAA,IAAA,KAA8C,KAAK;EAEzD,MAAM,EACF,SACA,QACA,YACA,UACA,UACA,YACA,eACA,sBACA,iBACA,SACA,UACA,WACA,gBACA,iBAA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GAAA,IAAA,oBAAA,IAAA,KAAA,CAAA,CAAA,KAAA,GAAA,IAAA,oBAAA,IAAA,KAAA"}
@@ -120,7 +120,7 @@ var Textarea_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defin
120
120
  stateColor,
121
121
  hasError,
122
122
  radius,
123
- fullRadiusClass: "rounded-2xl",
123
+ radiusKind: "surface",
124
124
  halo: () => props.halo
125
125
  });
126
126
  /** Horizontal padding from tokens; vertical padding stays size-stepped. */
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.vue_vue_type_script_setup_true_lang.mjs","names":["$emit"],"sources":["../../../src/components/forms/Textarea.vue"],"sourcesContent":["<template> \n <div :class=\"['flex flex-col gap-1.5', fullWidth ? 'w-full' : 'inline-flex']\"> \n <label \n v-if=\"label\" \n :for=\"fieldId\" \n class=\"text-caption font-medium text-foreground\" \n > \n {{ label }} \n <span v-if=\"required\" aria-hidden=\"true\" class=\"text-destructive ml-0.5\">*</span> \n </label> \n \n <div\n :class=\"[\n 'modo-field-wrapper flex items-start gap-2',\n wrapperVariantClasses,\n wrapperPaddingClasses,\n wrapperMinHeightClass,\n radiusClasses,\n fullWidth ? 'w-full' : '',\n isDisabled ? 'opacity-60 cursor-not-allowed' : '',\n ]\"\n > \n <textarea \n :id=\"fieldId\" \n ref=\"textareaRef\" \n :value=\"modelValue ?? ''\" \n :placeholder=\"placeholder\" \n :disabled=\"isDisabled\" \n :readonly=\"readonly\" \n :required=\"required\" \n :name=\"name\" \n :autofocus=\"autofocus\" \n :maxlength=\"maxLength\" \n :rows=\"rows\" \n :aria-label=\"!label ? ariaLabel : undefined\" \n :aria-invalid=\"hasError || undefined\" \n :aria-describedby=\"describedBy\" \n :aria-required=\"required || undefined\" \n :class=\"[ \n 'modo-field-native flex-1 min-w-0 bg-transparent p-0', \n 'text-foreground placeholder:text-muted-foreground', \n 'disabled:cursor-not-allowed', \n textareaTextClasses, \n resizeClass, \n autoresize ? 'overflow-hidden' : '', \n ]\" \n @input=\"onInput\" \n @change=\"onChange\" \n @focus=\"$emit('focus', $event)\" \n @blur=\"$emit('blur', $event)\" \n /> \n \n <div class=\"flex flex-col items-center gap-1 shrink-0 pt-0.5\"> \n <Button \n v-if=\"clearable && hasValue && !isDisabled && !readonly\" \n variant=\"text\" \n size=\"xs\" \n radius=\"full\" \n :icon=\"XMarkIcon\" \n :ariaLabel=\"loc.textarea.clear\" \n tabindex=\"-1\" \n class=\"text-muted-foreground hover:text-foreground\" \n @click=\"onClear\" \n /> \n \n <Loader \n v-if=\"loading\" \n :size=\"size === 'large' ? 'medium' : 'small'\" \n class=\"text-muted-foreground\" \n /> \n </div> \n </div> \n \n <div \n v-if=\"errorText || helperText || showCounterEffective\" \n class=\"flex items-start justify-between gap-2\" \n > \n <Typography \n v-if=\"errorText\" \n :id=\"errorId\" \n variant=\"caption\" \n size=\"medium\" \n color=\"danger\" \n as=\"p\" \n > \n {{ errorText }} \n </Typography> \n <Typography \n v-else-if=\"helperText\" \n :id=\"helperId\" \n variant=\"caption\" \n size=\"medium\" \n color=\"muted\" \n as=\"p\" \n > \n {{ helperText }} \n </Typography> \n <span v-else class=\"flex-1\" /> \n \n <span \n v-if=\"showCounterEffective\" \n :id=\"counterId\" \n :class=\"[ \n 'text-caption shrink-0 tabular-nums', \n counterOverflow ? 'text-destructive' : 'text-muted-foreground', \n ]\" \n > \n {{ currentLength }}/{{ maxLength }} \n </span> \n </div> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, nextTick, onMounted, ref, watch } from 'vue'; \nimport type { Textarea } from '../../interfaces/forms/Textarea.interface'; \nimport { useFieldState, useFieldClasses } from '../../composables/useField'; \nimport Loader from '../feedback/Loader.vue'; \nimport Button from './Button.vue'; \nimport { XMarkIcon } from '@heroicons/vue/24/outline'; \nimport Typography from '../data-display/Typography.vue'; \nimport { useModoLocale, useResolvedSize, useSizeTokens } from '../../composables/useModoConfig';\n \nconst loc = useModoLocale(); \n \nconst emit = defineEmits<{ \n 'update:modelValue': [value: string]; \n change: [value: string]; \n focus: [event: FocusEvent]; \n blur: [event: FocusEvent]; \n clear: []; \n}>(); \n \nconst props = withDefaults(defineProps<Textarea>(), { \n variant: 'outline', \n color: 'default', \n disabled: false, \n readonly: false, \n required: false, \n loading: false, \n clearable: false, \n fullWidth: false, \n showCounter: false, \n autofocus: false, \n rows: 3, \n autoresize: false, \n maxRows: 8, \n resize: 'vertical', \n}); \n \nconst resolvedSize = useResolvedSize(() => props.size);\nconst sz = useSizeTokens(() => props.size);\n\nconst textareaRef = ref<HTMLTextAreaElement | null>(null); \n \nconst { \n fieldId, \n radius, \n stateColor, \n hasError, \n hasValue, \n isDisabled, \n currentLength, \n showCounterEffective, \n counterOverflow, \n errorId, \n helperId, \n counterId, \n describedBy, \n} = useFieldState(props, { componentName: 'Textarea', idPrefix: 'modo-textarea' }); \n \nconst { wrapperVariantClasses, radiusClasses } = useFieldClasses({ \n variant: () => props.variant, \n stateColor, \n hasError, \n radius, \n fullRadiusClass: 'rounded-2xl', \n halo: () => props.halo, \n}); \n \n/** Horizontal padding from tokens; vertical padding stays size-stepped. */\nconst wrapperPaddingClasses = computed(() => {\n const pyByControl: Record<string, string> = {\n 'h-8': 'py-1', 'h-9': 'py-1.5', 'h-10': 'py-2', 'h-12': 'py-3',\n };\n const py = pyByControl[sz.value.control] ?? 'py-2';\n return `${sz.value.padX} ${py}`;\n});\n\n/** Min-height mirrors the control scale (h-8/h-9/h-10/h-12 → min-h-8/9/10/12). */\nconst wrapperMinHeightClass = computed(() => sz.value.control.replace('h-', 'min-h-'));\n\nconst textareaTextClasses = computed(() => `${sz.value.text} leading-relaxed`); \n \nconst resizeClass = computed(() => { \n if (props.autoresize) return 'resize-none'; \n switch (props.resize) { \n case 'none': return 'resize-none'; \n case 'horizontal': return 'resize-x'; \n case 'both': return 'resize'; \n case 'vertical': \n default: return 'resize-y'; \n } \n}); \n \nfunction adjustHeight() { \n if (!props.autoresize) return; \n const el = textareaRef.value; \n if (!el) return; \n \n el.style.height = 'auto'; \n \n const styles = window.getComputedStyle(el); \n const lineHeight = parseFloat(styles.lineHeight) || 20; \n const paddingTop = parseFloat(styles.paddingTop) || 0; \n const paddingBottom = parseFloat(styles.paddingBottom) || 0; \n const borderTop = parseFloat(styles.borderTopWidth) || 0; \n const borderBottom = parseFloat(styles.borderBottomWidth) || 0; \n \n const maxHeight = \n lineHeight * props.maxRows + paddingTop + paddingBottom + borderTop + borderBottom; \n const next = Math.min(el.scrollHeight, maxHeight); \n \n el.style.height = `${next}px`; \n el.style.overflowY = el.scrollHeight > maxHeight ? 'auto' : 'hidden'; \n} \n \nfunction onInput(e: Event) { \n const target = e.target as HTMLTextAreaElement; \n emit('update:modelValue', target.value); \n if (props.autoresize) nextTick(adjustHeight); \n} \n \nfunction onChange(e: Event) { \n const target = e.target as HTMLTextAreaElement; \n emit('change', target.value); \n} \n \nfunction onClear() { \n emit('update:modelValue', ''); \n emit('clear'); \n textareaRef.value?.focus(); \n if (props.autoresize) nextTick(adjustHeight); \n} \n \nwatch(() => props.modelValue, () => { \n if (props.autoresize) nextTick(adjustHeight); \n}); \nwatch(() => props.autoresize, (v) => { \n if (v) nextTick(adjustHeight); \n else if (textareaRef.value) { \n textareaRef.value.style.height = ''; \n textareaRef.value.style.overflowY = ''; \n } \n}); \nwatch(() => props.maxRows, () => { \n if (props.autoresize) nextTick(adjustHeight); \n}); \n \nonMounted(() => { \n if (props.autoresize) adjustHeight(); \n}); \n \ndefineExpose({ \n focus: () => textareaRef.value?.focus(), \n blur: () => textareaRef.value?.blur(), \n select: () => textareaRef.value?.select(), \n textareaRef, \n}); \n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2HA,MAAM,MAAM,eAAe;EAE3B,MAAM,OAAO;EAQb,MAAM,QAAQ;EAiBO,sBAAsB,MAAM,KAAK;EAC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qBAAoB,IAAA,WAAA,EADzD,mBAoCM,OApCN,YAoCM,CA/BQ,QAAA,aAAA,WAAA,EADV,YASa,oBAAA;;KAPR,IAAI,MAAA,QAAO;KACZ,SAAQ;KACR,MAAK;KACL,OAAM;KACN,IAAG;;4BAEY,CAAA,gBAAA,gBAAZ,QAAA,UAAS,EAAA,EAAA,CAAA,CAAA;;qBAGD,QAAA,cAAA,WAAA,EADf,YASa,oBAAA;;KAPR,IAAI,MAAA,SAAQ;KACb,SAAQ;KACR,MAAK;KACL,OAAM;KACN,IAAG;;4BAEa,CAAA,gBAAA,gBAAb,QAAA,WAAU,EAAA,EAAA,CAAA,CAAA;;mCAEjB,mBAA8B,QAA9B,WAA8B,GAGpB,MAAA,qBAAoB,IAAA,WAAA,EAD9B,mBASO,QAAA;;KAPF,IAAI,MAAA,UAAS;KACb,OAAK,eAAA,CAAA,sCAAoF,MAAA,gBAAe,GAAA,qBAAA,wBAAA,CAAA;uBAKtG,MAAA,cAAa,CAAA,GAAG,MAAC,gBAAG,QAAA,UAAS,EAAA,IAAA,WAAA,IAAA,mBAAA,IAAA,KAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA"}
1
+ {"version":3,"file":"Textarea.vue_vue_type_script_setup_true_lang.mjs","names":["$emit"],"sources":["../../../src/components/forms/Textarea.vue"],"sourcesContent":["<template> \n <div :class=\"['flex flex-col gap-1.5', fullWidth ? 'w-full' : 'inline-flex']\"> \n <label \n v-if=\"label\" \n :for=\"fieldId\" \n class=\"text-caption font-medium text-foreground\" \n > \n {{ label }} \n <span v-if=\"required\" aria-hidden=\"true\" class=\"text-destructive ml-0.5\">*</span> \n </label> \n \n <div\n :class=\"[\n 'modo-field-wrapper flex items-start gap-2',\n wrapperVariantClasses,\n wrapperPaddingClasses,\n wrapperMinHeightClass,\n radiusClasses,\n fullWidth ? 'w-full' : '',\n isDisabled ? 'opacity-60 cursor-not-allowed' : '',\n ]\"\n > \n <textarea \n :id=\"fieldId\" \n ref=\"textareaRef\" \n :value=\"modelValue ?? ''\" \n :placeholder=\"placeholder\" \n :disabled=\"isDisabled\" \n :readonly=\"readonly\" \n :required=\"required\" \n :name=\"name\" \n :autofocus=\"autofocus\" \n :maxlength=\"maxLength\" \n :rows=\"rows\" \n :aria-label=\"!label ? ariaLabel : undefined\" \n :aria-invalid=\"hasError || undefined\" \n :aria-describedby=\"describedBy\" \n :aria-required=\"required || undefined\" \n :class=\"[ \n 'modo-field-native flex-1 min-w-0 bg-transparent p-0', \n 'text-foreground placeholder:text-muted-foreground', \n 'disabled:cursor-not-allowed', \n textareaTextClasses, \n resizeClass, \n autoresize ? 'overflow-hidden' : '', \n ]\" \n @input=\"onInput\" \n @change=\"onChange\" \n @focus=\"$emit('focus', $event)\" \n @blur=\"$emit('blur', $event)\" \n /> \n \n <div class=\"flex flex-col items-center gap-1 shrink-0 pt-0.5\"> \n <Button \n v-if=\"clearable && hasValue && !isDisabled && !readonly\" \n variant=\"text\" \n size=\"xs\" \n radius=\"full\" \n :icon=\"XMarkIcon\" \n :ariaLabel=\"loc.textarea.clear\" \n tabindex=\"-1\" \n class=\"text-muted-foreground hover:text-foreground\" \n @click=\"onClear\" \n /> \n \n <Loader \n v-if=\"loading\" \n :size=\"size === 'large' ? 'medium' : 'small'\" \n class=\"text-muted-foreground\" \n /> \n </div> \n </div> \n \n <div \n v-if=\"errorText || helperText || showCounterEffective\" \n class=\"flex items-start justify-between gap-2\" \n > \n <Typography \n v-if=\"errorText\" \n :id=\"errorId\" \n variant=\"caption\" \n size=\"medium\" \n color=\"danger\" \n as=\"p\" \n > \n {{ errorText }} \n </Typography> \n <Typography \n v-else-if=\"helperText\" \n :id=\"helperId\" \n variant=\"caption\" \n size=\"medium\" \n color=\"muted\" \n as=\"p\" \n > \n {{ helperText }} \n </Typography> \n <span v-else class=\"flex-1\" /> \n \n <span \n v-if=\"showCounterEffective\" \n :id=\"counterId\" \n :class=\"[ \n 'text-caption shrink-0 tabular-nums', \n counterOverflow ? 'text-destructive' : 'text-muted-foreground', \n ]\" \n > \n {{ currentLength }}/{{ maxLength }} \n </span> \n </div> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, nextTick, onMounted, ref, watch } from 'vue'; \nimport type { Textarea } from '../../interfaces/forms/Textarea.interface'; \nimport { useFieldState, useFieldClasses } from '../../composables/useField'; \nimport Loader from '../feedback/Loader.vue'; \nimport Button from './Button.vue'; \nimport { XMarkIcon } from '@heroicons/vue/24/outline'; \nimport Typography from '../data-display/Typography.vue'; \nimport { useModoLocale, useResolvedSize, useSizeTokens } from '../../composables/useModoConfig';\n \nconst loc = useModoLocale(); \n \nconst emit = defineEmits<{ \n 'update:modelValue': [value: string]; \n change: [value: string]; \n focus: [event: FocusEvent]; \n blur: [event: FocusEvent]; \n clear: []; \n}>(); \n \nconst props = withDefaults(defineProps<Textarea>(), { \n variant: 'outline', \n color: 'default', \n disabled: false, \n readonly: false, \n required: false, \n loading: false, \n clearable: false, \n fullWidth: false, \n showCounter: false, \n autofocus: false, \n rows: 3, \n autoresize: false, \n maxRows: 8, \n resize: 'vertical', \n}); \n \nconst resolvedSize = useResolvedSize(() => props.size);\nconst sz = useSizeTokens(() => props.size);\n\nconst textareaRef = ref<HTMLTextAreaElement | null>(null); \n \nconst { \n fieldId, \n radius, \n stateColor, \n hasError, \n hasValue, \n isDisabled, \n currentLength, \n showCounterEffective, \n counterOverflow, \n errorId, \n helperId, \n counterId, \n describedBy, \n} = useFieldState(props, { componentName: 'Textarea', idPrefix: 'modo-textarea' }); \n \nconst { wrapperVariantClasses, radiusClasses } = useFieldClasses({ \n variant: () => props.variant, \n stateColor, \n hasError, \n radius, \n radiusKind: 'surface', \n halo: () => props.halo, \n}); \n \n/** Horizontal padding from tokens; vertical padding stays size-stepped. */\nconst wrapperPaddingClasses = computed(() => {\n const pyByControl: Record<string, string> = {\n 'h-8': 'py-1', 'h-9': 'py-1.5', 'h-10': 'py-2', 'h-12': 'py-3',\n };\n const py = pyByControl[sz.value.control] ?? 'py-2';\n return `${sz.value.padX} ${py}`;\n});\n\n/** Min-height mirrors the control scale (h-8/h-9/h-10/h-12 → min-h-8/9/10/12). */\nconst wrapperMinHeightClass = computed(() => sz.value.control.replace('h-', 'min-h-'));\n\nconst textareaTextClasses = computed(() => `${sz.value.text} leading-relaxed`); \n \nconst resizeClass = computed(() => { \n if (props.autoresize) return 'resize-none'; \n switch (props.resize) { \n case 'none': return 'resize-none'; \n case 'horizontal': return 'resize-x'; \n case 'both': return 'resize'; \n case 'vertical': \n default: return 'resize-y'; \n } \n}); \n \nfunction adjustHeight() { \n if (!props.autoresize) return; \n const el = textareaRef.value; \n if (!el) return; \n \n el.style.height = 'auto'; \n \n const styles = window.getComputedStyle(el); \n const lineHeight = parseFloat(styles.lineHeight) || 20; \n const paddingTop = parseFloat(styles.paddingTop) || 0; \n const paddingBottom = parseFloat(styles.paddingBottom) || 0; \n const borderTop = parseFloat(styles.borderTopWidth) || 0; \n const borderBottom = parseFloat(styles.borderBottomWidth) || 0; \n \n const maxHeight = \n lineHeight * props.maxRows + paddingTop + paddingBottom + borderTop + borderBottom; \n const next = Math.min(el.scrollHeight, maxHeight); \n \n el.style.height = `${next}px`; \n el.style.overflowY = el.scrollHeight > maxHeight ? 'auto' : 'hidden'; \n} \n \nfunction onInput(e: Event) { \n const target = e.target as HTMLTextAreaElement; \n emit('update:modelValue', target.value); \n if (props.autoresize) nextTick(adjustHeight); \n} \n \nfunction onChange(e: Event) { \n const target = e.target as HTMLTextAreaElement; \n emit('change', target.value); \n} \n \nfunction onClear() { \n emit('update:modelValue', ''); \n emit('clear'); \n textareaRef.value?.focus(); \n if (props.autoresize) nextTick(adjustHeight); \n} \n \nwatch(() => props.modelValue, () => { \n if (props.autoresize) nextTick(adjustHeight); \n}); \nwatch(() => props.autoresize, (v) => { \n if (v) nextTick(adjustHeight); \n else if (textareaRef.value) { \n textareaRef.value.style.height = ''; \n textareaRef.value.style.overflowY = ''; \n } \n}); \nwatch(() => props.maxRows, () => { \n if (props.autoresize) nextTick(adjustHeight); \n}); \n \nonMounted(() => { \n if (props.autoresize) adjustHeight(); \n}); \n \ndefineExpose({ \n focus: () => textareaRef.value?.focus(), \n blur: () => textareaRef.value?.blur(), \n select: () => textareaRef.value?.select(), \n textareaRef, \n}); \n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2HA,MAAM,MAAM,eAAe;EAE3B,MAAM,OAAO;EAQb,MAAM,QAAQ;EAiBO,sBAAsB,MAAM,KAAK;EACtD,MAAM,KAAK,oBAAoB,MAAM,KAAK;EAE1C,MAAM,cAAc,IAAgC,KAAK;EAEzD,MAAM,EACF,SACA,QACA,YACA,UACA,UACA,YACA,eACA,sBACA,iBACA,SACA,UACA,WACA,gBACA,cAAc,OAAO;GAAE,eAAe;GAAY,UAAU;GAAiB,CAAC;EAElF,MAAM,EAAE,uBAAuB,kBAAkB,gBAAgB;GAC7D,eAAe,MAAM;GACrB;GACA;GACA;GACA,YAAY;GACZ,YAAY,MAAM;GACrB,CAAC;;EAGF,MAAM,wBAAwB,eAAe;GAIzC,MAAM,KAAK;IAFP,OAAO;IAAQ,OAAO;IAAU,QAAQ;IAAQ,QAAQ;IAEjD,CAAY,GAAG,MAAM,YAAY;GAC5C,OAAO,GAAG,GAAG,MAAM,KAAK,GAAG;IAC7B;;EAGF,MAAM,wBAAwB,eAAe,GAAG,MAAM,QAAQ,QAAQ,MAAM,SAAS,CAAC;EAEtF,MAAM,sBAAsB,eAAe,GAAG,GAAG,MAAM,KAAK,kBAAkB;EAE9E,MAAM,cAAc,eAAe;GAC/B,IAAI,MAAM,YAAY,OAAO;GAC7B,QAAQ,MAAM,QAAd;IACI,KAAK,QAAQ,OAAO;IACpB,KAAK,cAAc,OAAO;IAC1B,KAAK,QAAQ,OAAO;IAEpB,SAAS,OAAO;;IAEtB;EA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],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, ref, watch, onBeforeUnmount } from 'vue'\nimport { ChevronDownIcon } from '@heroicons/vue/24/outline'\nimport type { MorphSelectTriggerProps } from '../../../interfaces/forms/MorphSelect.interface'\nimport { FIELD_AFFORDANCE_ICON_BY_COLOR, useFieldClasses } from '../../../composables/useField'\nimport { useModoLocale, useSizeTokens } from '../../../composables/useModoConfig'\nimport RenderContent from '../../../utils/RenderContent'\nimport Typography from '../../data-display/Typography.vue'\nimport { useMorphSelect } from './MorphSelectContext'\ndefineOptions({ inheritAttrs: false })\nconst props = withDefaults(defineProps<MorphSelectTriggerProps>(), { variant: 'outline' })\nconst {\n fieldId, multiple, selectedOptions, disabled, readonly, required, label, ariaLabel, helperText, errorText, hasError, stateColor,\n radius, size, halo, fullWidth, errorId, helperId, describedBy, phase, open, trigger, button, setOpen,\n} = useMorphSelect()\nconst loc = useModoLocale()\nconst sz = useSizeTokens(() => size.value)\nconst { wrapperVariantClasses, radiusClasses } = useFieldClasses({ variant: () => props.variant, stateColor, hasError, radius, halo })\nconst affordanceIconClass = computed(() => FIELD_AFFORDANCE_ICON_BY_COLOR[stateColor.value] ?? 'text-muted-foreground')\n\nconst landed = ref(false)\nlet landedTimer: ReturnType<typeof setTimeout> | undefined\nwatch(phase, (next, previous) => {\n if (previous === 'closing' && next === 'closed') {\n landed.value = true; clearTimeout(landedTimer)\n landedTimer = setTimeout(() => { landed.value = false }, 500)\n }\n})\nonBeforeUnmount(() => clearTimeout(landedTimer))\nconst selected = computed(() => selectedOptions.value[0])\n// Multiple: the selected labels joined, in option order.\nconst summary = computed(() => selectedOptions.value.map(option => option.textValue ?? String(option.label)).join(', '))\nconst hasValue = computed(() => selectedOptions.value.length > 0)\nfunction key(event: KeyboardEvent) { if (event.key === 'ArrowDown' || event.key === 'ArrowUp') { event.preventDefault(); setOpen(true) } }\n</script>\n<template>\n <div :class=\"['modo-morph-select flex flex-col', fullWidth ? 'w-full' : 'inline-flex']\" data-modo-morph-select=\"\" :data-modo-size=\"size\" :data-modo-radius=\"radius\" :data-modo-variant=\"variant\">\n <label v-if=\"label\" :for=\"fieldId\" class=\"modo-morph-select__label\">\n {{ label }}\n <span v-if=\"required\" aria-hidden=\"true\" class=\"text-destructive ml-0.5\">*</span>\n </label>\n <div ref=\"trigger\"\n :class=\"['modo-morph-select__field modo-field-wrapper', wrapperVariantClasses, radiusClasses, sz.control, disabled ? 'opacity-60 cursor-not-allowed' : '']\"\n :data-modo-morph-origin=\"phase === 'closed' ? (landed ? 'landed' : undefined) : phase === 'closing' ? 'closing' : 'hidden'\">\n <button :id=\"fieldId\" ref=\"button\" v-bind=\"$attrs\" type=\"button\" role=\"combobox\" aria-haspopup=\"listbox\"\n :class=\"['modo-morph-select__button flex h-full w-full items-center gap-2 text-left outline-none', sz.padX, sz.text, disabled ? 'cursor-not-allowed' : readonly ? 'cursor-default' : 'cursor-pointer']\"\n :aria-expanded=\"open\" :aria-controls=\"phase !== 'closed' ? `${fieldId}-listbox` : undefined\"\n :aria-label=\"!label ? ariaLabel : undefined\" :aria-describedby=\"describedBy\" :aria-invalid=\"hasError || undefined\"\n :aria-required=\"required || undefined\" :aria-readonly=\"readonly || undefined\" :disabled=\"disabled\" @keydown=\"key\" @click=\"setOpen(!open)\">\n <span v-if=\"$slots.icon || icon\" :class=\"['modo-morph-select__icon inline-flex shrink-0 items-center', affordanceIconClass]\" aria-hidden=\"true\">\n <slot name=\"icon\"><component :is=\"icon\" :class=\"sz.icon\" /></slot>\n </span>\n <span :class=\"['modo-morph-select__value min-w-0 flex-1 truncate', hasValue ? 'text-foreground' : 'text-muted-foreground']\" :data-modo-placeholder=\"hasValue ? undefined : ''\">\n <slot :option=\"selected\" :options=\"selectedOptions\">\n <template v-if=\"multiple && hasValue\">{{ summary }}</template>\n <RenderContent v-else :content=\"selected?.label ?? placeholder ?? loc.morphSelect.placeholder\" />\n </slot>\n </span>\n <ChevronDownIcon class=\"modo-morph-select__chevron\" aria-hidden=\"true\" :class=\"['shrink-0 transition-transform duration-base ease-standard', affordanceIconClass, sz.icon, open ? 'rotate-180' : '']\" />\n </button>\n </div>\n <Typography v-if=\"hasError && errorText\" :id=\"errorId\" variant=\"caption\" size=\"medium\" color=\"danger\" as=\"p\">{{ errorText }}</Typography>\n <Typography v-else-if=\"helperText\" :id=\"helperId\" variant=\"caption\" size=\"medium\" color=\"muted\" as=\"p\">{{ helperText }}</Typography>\n </div>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"MorphSelectTrigger.cjs","names":[],"sources":["../../../../src/components/forms/morph-select/MorphSelectTrigger.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, ref, watch, onBeforeUnmount } from 'vue'\nimport { ChevronDownIcon } from '@heroicons/vue/24/outline'\nimport type { MorphSelectTriggerProps } from '../../../interfaces/forms/MorphSelect.interface'\nimport { FIELD_AFFORDANCE_ICON_BY_COLOR, useFieldClasses } from '../../../composables/useField'\nimport { useModoLocale, useSizeTokens } from '../../../composables/useModoConfig'\nimport RenderContent from '../../../utils/RenderContent'\nimport Typography from '../../data-display/Typography.vue'\nimport { useMorphSelect } from './MorphSelectContext'\ndefineOptions({ inheritAttrs: false })\nconst props = withDefaults(defineProps<MorphSelectTriggerProps>(), { variant: 'outline' })\nconst {\n fieldId, multiple, selectedOptions, disabled, readonly, required, label, ariaLabel, helperText, errorText, hasError, stateColor,\n radius, size, halo, fullWidth, errorId, helperId, describedBy, phase, open, trigger, button, setOpen,\n} = useMorphSelect()\nconst loc = useModoLocale()\nconst sz = useSizeTokens(() => size.value)\nconst { wrapperVariantClasses, radiusClasses } = useFieldClasses({ variant: () => props.variant, stateColor, hasError, radius, halo })\nconst affordanceIconClass = computed(() => FIELD_AFFORDANCE_ICON_BY_COLOR[stateColor.value] ?? 'text-muted-foreground')\n\nconst landed = ref(false)\nlet landedTimer: ReturnType<typeof setTimeout> | undefined\nwatch(phase, (next, previous) => {\n if (previous === 'closing' && next === 'closed') {\n landed.value = true; clearTimeout(landedTimer)\n landedTimer = setTimeout(() => { landed.value = false }, 500)\n }\n})\nonBeforeUnmount(() => clearTimeout(landedTimer))\nconst selected = computed(() => selectedOptions.value[0])\n// Multiple: the selected labels joined, in option order.\nconst summary = computed(() => selectedOptions.value.map(option => option.textValue ?? String(option.label)).join(', '))\nconst hasValue = computed(() => selectedOptions.value.length > 0)\nfunction key(event: KeyboardEvent) { if (event.key === 'ArrowDown' || event.key === 'ArrowUp') { event.preventDefault(); setOpen(true) } }\n</script>\n<template>\n <div :class=\"['modo-morph-select flex flex-col gap-1.5', fullWidth ? 'w-full' : 'inline-flex']\" data-modo-morph-select=\"\" :data-modo-size=\"size\" :data-modo-radius=\"radius\" :data-modo-variant=\"variant\">\n <label v-if=\"label\" :for=\"fieldId\" class=\"modo-morph-select__label text-caption font-medium text-foreground\">\n {{ label }}\n <span v-if=\"required\" aria-hidden=\"true\" class=\"text-destructive ml-0.5\">*</span>\n </label>\n <div ref=\"trigger\"\n :class=\"['modo-morph-select__field modo-field-wrapper', wrapperVariantClasses, radiusClasses, sz.control, disabled ? 'opacity-60 cursor-not-allowed' : '']\"\n :data-modo-morph-origin=\"phase === 'closed' ? (landed ? 'landed' : undefined) : phase === 'closing' ? 'closing' : 'hidden'\">\n <button :id=\"fieldId\" ref=\"button\" v-bind=\"$attrs\" type=\"button\" role=\"combobox\" aria-haspopup=\"listbox\"\n :class=\"['modo-morph-select__button flex h-full w-full items-center gap-2 text-left outline-none', sz.padX, sz.text, disabled ? 'cursor-not-allowed' : readonly ? 'cursor-default' : 'cursor-pointer']\"\n :aria-expanded=\"open\" :aria-controls=\"phase !== 'closed' ? `${fieldId}-listbox` : undefined\"\n :aria-label=\"!label ? ariaLabel : undefined\" :aria-describedby=\"describedBy\" :aria-invalid=\"hasError || undefined\"\n :aria-required=\"required || undefined\" :aria-readonly=\"readonly || undefined\" :disabled=\"disabled\" @keydown=\"key\" @click=\"setOpen(!open)\">\n <span v-if=\"$slots.icon || icon\" :class=\"['modo-morph-select__icon inline-flex shrink-0 items-center', affordanceIconClass]\" aria-hidden=\"true\">\n <slot name=\"icon\"><component :is=\"icon\" :class=\"sz.icon\" /></slot>\n </span>\n <span :class=\"['modo-morph-select__value min-w-0 flex-1 truncate', hasValue ? 'text-foreground' : 'text-muted-foreground']\" :data-modo-placeholder=\"hasValue ? undefined : ''\">\n <slot :option=\"selected\" :options=\"selectedOptions\">\n <template v-if=\"multiple && hasValue\">{{ summary }}</template>\n <RenderContent v-else :content=\"selected?.label ?? placeholder ?? loc.morphSelect.placeholder\" />\n </slot>\n </span>\n <ChevronDownIcon class=\"modo-morph-select__chevron\" aria-hidden=\"true\" :class=\"['shrink-0 transition-transform duration-base ease-standard', affordanceIconClass, sz.icon, open ? 'rotate-180' : '']\" />\n </button>\n </div>\n <Typography v-if=\"hasError && errorText\" :id=\"errorId\" variant=\"caption\" size=\"medium\" color=\"danger\" as=\"p\">{{ errorText }}</Typography>\n <Typography v-else-if=\"helperText\" :id=\"helperId\" variant=\"caption\" size=\"medium\" color=\"muted\" as=\"p\">{{ helperText }}</Typography>\n </div>\n</template>\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"MorphSelectTrigger.mjs","names":[],"sources":["../../../../src/components/forms/morph-select/MorphSelectTrigger.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, ref, watch, onBeforeUnmount } from 'vue'\nimport { ChevronDownIcon } from '@heroicons/vue/24/outline'\nimport type { MorphSelectTriggerProps } from '../../../interfaces/forms/MorphSelect.interface'\nimport { FIELD_AFFORDANCE_ICON_BY_COLOR, useFieldClasses } from '../../../composables/useField'\nimport { useModoLocale, useSizeTokens } from '../../../composables/useModoConfig'\nimport RenderContent from '../../../utils/RenderContent'\nimport Typography from '../../data-display/Typography.vue'\nimport { useMorphSelect } from './MorphSelectContext'\ndefineOptions({ inheritAttrs: false })\nconst props = withDefaults(defineProps<MorphSelectTriggerProps>(), { variant: 'outline' })\nconst {\n fieldId, multiple, selectedOptions, disabled, readonly, required, label, ariaLabel, helperText, errorText, hasError, stateColor,\n radius, size, halo, fullWidth, errorId, helperId, describedBy, phase, open, trigger, button, setOpen,\n} = useMorphSelect()\nconst loc = useModoLocale()\nconst sz = useSizeTokens(() => size.value)\nconst { wrapperVariantClasses, radiusClasses } = useFieldClasses({ variant: () => props.variant, stateColor, hasError, radius, halo })\nconst affordanceIconClass = computed(() => FIELD_AFFORDANCE_ICON_BY_COLOR[stateColor.value] ?? 'text-muted-foreground')\n\nconst landed = ref(false)\nlet landedTimer: ReturnType<typeof setTimeout> | undefined\nwatch(phase, (next, previous) => {\n if (previous === 'closing' && next === 'closed') {\n landed.value = true; clearTimeout(landedTimer)\n landedTimer = setTimeout(() => { landed.value = false }, 500)\n }\n})\nonBeforeUnmount(() => clearTimeout(landedTimer))\nconst selected = computed(() => selectedOptions.value[0])\n// Multiple: the selected labels joined, in option order.\nconst summary = computed(() => selectedOptions.value.map(option => option.textValue ?? String(option.label)).join(', '))\nconst hasValue = computed(() => selectedOptions.value.length > 0)\nfunction key(event: KeyboardEvent) { if (event.key === 'ArrowDown' || event.key === 'ArrowUp') { event.preventDefault(); setOpen(true) } }\n</script>\n<template>\n <div :class=\"['modo-morph-select flex flex-col', fullWidth ? 'w-full' : 'inline-flex']\" data-modo-morph-select=\"\" :data-modo-size=\"size\" :data-modo-radius=\"radius\" :data-modo-variant=\"variant\">\n <label v-if=\"label\" :for=\"fieldId\" class=\"modo-morph-select__label\">\n {{ label }}\n <span v-if=\"required\" aria-hidden=\"true\" class=\"text-destructive ml-0.5\">*</span>\n </label>\n <div ref=\"trigger\"\n :class=\"['modo-morph-select__field modo-field-wrapper', wrapperVariantClasses, radiusClasses, sz.control, disabled ? 'opacity-60 cursor-not-allowed' : '']\"\n :data-modo-morph-origin=\"phase === 'closed' ? (landed ? 'landed' : undefined) : phase === 'closing' ? 'closing' : 'hidden'\">\n <button :id=\"fieldId\" ref=\"button\" v-bind=\"$attrs\" type=\"button\" role=\"combobox\" aria-haspopup=\"listbox\"\n :class=\"['modo-morph-select__button flex h-full w-full items-center gap-2 text-left outline-none', sz.padX, sz.text, disabled ? 'cursor-not-allowed' : readonly ? 'cursor-default' : 'cursor-pointer']\"\n :aria-expanded=\"open\" :aria-controls=\"phase !== 'closed' ? `${fieldId}-listbox` : undefined\"\n :aria-label=\"!label ? ariaLabel : undefined\" :aria-describedby=\"describedBy\" :aria-invalid=\"hasError || undefined\"\n :aria-required=\"required || undefined\" :aria-readonly=\"readonly || undefined\" :disabled=\"disabled\" @keydown=\"key\" @click=\"setOpen(!open)\">\n <span v-if=\"$slots.icon || icon\" :class=\"['modo-morph-select__icon inline-flex shrink-0 items-center', affordanceIconClass]\" aria-hidden=\"true\">\n <slot name=\"icon\"><component :is=\"icon\" :class=\"sz.icon\" /></slot>\n </span>\n <span :class=\"['modo-morph-select__value min-w-0 flex-1 truncate', hasValue ? 'text-foreground' : 'text-muted-foreground']\" :data-modo-placeholder=\"hasValue ? undefined : ''\">\n <slot :option=\"selected\" :options=\"selectedOptions\">\n <template v-if=\"multiple && hasValue\">{{ summary }}</template>\n <RenderContent v-else :content=\"selected?.label ?? placeholder ?? loc.morphSelect.placeholder\" />\n </slot>\n </span>\n <ChevronDownIcon class=\"modo-morph-select__chevron\" aria-hidden=\"true\" :class=\"['shrink-0 transition-transform duration-base ease-standard', affordanceIconClass, sz.icon, open ? 'rotate-180' : '']\" />\n </button>\n </div>\n <Typography v-if=\"hasError && errorText\" :id=\"errorId\" variant=\"caption\" size=\"medium\" color=\"danger\" as=\"p\">{{ errorText }}</Typography>\n <Typography v-else-if=\"helperText\" :id=\"helperId\" variant=\"caption\" size=\"medium\" color=\"muted\" as=\"p\">{{ helperText }}</Typography>\n </div>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"MorphSelectTrigger.mjs","names":[],"sources":["../../../../src/components/forms/morph-select/MorphSelectTrigger.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, ref, watch, onBeforeUnmount } from 'vue'\nimport { ChevronDownIcon } from '@heroicons/vue/24/outline'\nimport type { MorphSelectTriggerProps } from '../../../interfaces/forms/MorphSelect.interface'\nimport { FIELD_AFFORDANCE_ICON_BY_COLOR, useFieldClasses } from '../../../composables/useField'\nimport { useModoLocale, useSizeTokens } from '../../../composables/useModoConfig'\nimport RenderContent from '../../../utils/RenderContent'\nimport Typography from '../../data-display/Typography.vue'\nimport { useMorphSelect } from './MorphSelectContext'\ndefineOptions({ inheritAttrs: false })\nconst props = withDefaults(defineProps<MorphSelectTriggerProps>(), { variant: 'outline' })\nconst {\n fieldId, multiple, selectedOptions, disabled, readonly, required, label, ariaLabel, helperText, errorText, hasError, stateColor,\n radius, size, halo, fullWidth, errorId, helperId, describedBy, phase, open, trigger, button, setOpen,\n} = useMorphSelect()\nconst loc = useModoLocale()\nconst sz = useSizeTokens(() => size.value)\nconst { wrapperVariantClasses, radiusClasses } = useFieldClasses({ variant: () => props.variant, stateColor, hasError, radius, halo })\nconst affordanceIconClass = computed(() => FIELD_AFFORDANCE_ICON_BY_COLOR[stateColor.value] ?? 'text-muted-foreground')\n\nconst landed = ref(false)\nlet landedTimer: ReturnType<typeof setTimeout> | undefined\nwatch(phase, (next, previous) => {\n if (previous === 'closing' && next === 'closed') {\n landed.value = true; clearTimeout(landedTimer)\n landedTimer = setTimeout(() => { landed.value = false }, 500)\n }\n})\nonBeforeUnmount(() => clearTimeout(landedTimer))\nconst selected = computed(() => selectedOptions.value[0])\n// Multiple: the selected labels joined, in option order.\nconst summary = computed(() => selectedOptions.value.map(option => option.textValue ?? String(option.label)).join(', '))\nconst hasValue = computed(() => selectedOptions.value.length > 0)\nfunction key(event: KeyboardEvent) { if (event.key === 'ArrowDown' || event.key === 'ArrowUp') { event.preventDefault(); setOpen(true) } }\n</script>\n<template>\n <div :class=\"['modo-morph-select flex flex-col gap-1.5', fullWidth ? 'w-full' : 'inline-flex']\" data-modo-morph-select=\"\" :data-modo-size=\"size\" :data-modo-radius=\"radius\" :data-modo-variant=\"variant\">\n <label v-if=\"label\" :for=\"fieldId\" class=\"modo-morph-select__label text-caption font-medium text-foreground\">\n {{ label }}\n <span v-if=\"required\" aria-hidden=\"true\" class=\"text-destructive ml-0.5\">*</span>\n </label>\n <div ref=\"trigger\"\n :class=\"['modo-morph-select__field modo-field-wrapper', wrapperVariantClasses, radiusClasses, sz.control, disabled ? 'opacity-60 cursor-not-allowed' : '']\"\n :data-modo-morph-origin=\"phase === 'closed' ? (landed ? 'landed' : undefined) : phase === 'closing' ? 'closing' : 'hidden'\">\n <button :id=\"fieldId\" ref=\"button\" v-bind=\"$attrs\" type=\"button\" role=\"combobox\" aria-haspopup=\"listbox\"\n :class=\"['modo-morph-select__button flex h-full w-full items-center gap-2 text-left outline-none', sz.padX, sz.text, disabled ? 'cursor-not-allowed' : readonly ? 'cursor-default' : 'cursor-pointer']\"\n :aria-expanded=\"open\" :aria-controls=\"phase !== 'closed' ? `${fieldId}-listbox` : undefined\"\n :aria-label=\"!label ? ariaLabel : undefined\" :aria-describedby=\"describedBy\" :aria-invalid=\"hasError || undefined\"\n :aria-required=\"required || undefined\" :aria-readonly=\"readonly || undefined\" :disabled=\"disabled\" @keydown=\"key\" @click=\"setOpen(!open)\">\n <span v-if=\"$slots.icon || icon\" :class=\"['modo-morph-select__icon inline-flex shrink-0 items-center', affordanceIconClass]\" aria-hidden=\"true\">\n <slot name=\"icon\"><component :is=\"icon\" :class=\"sz.icon\" /></slot>\n </span>\n <span :class=\"['modo-morph-select__value min-w-0 flex-1 truncate', hasValue ? 'text-foreground' : 'text-muted-foreground']\" :data-modo-placeholder=\"hasValue ? undefined : ''\">\n <slot :option=\"selected\" :options=\"selectedOptions\">\n <template v-if=\"multiple && hasValue\">{{ summary }}</template>\n <RenderContent v-else :content=\"selected?.label ?? placeholder ?? loc.morphSelect.placeholder\" />\n </slot>\n </span>\n <ChevronDownIcon class=\"modo-morph-select__chevron\" aria-hidden=\"true\" :class=\"['shrink-0 transition-transform duration-base ease-standard', affordanceIconClass, sz.icon, open ? 'rotate-180' : '']\" />\n </button>\n </div>\n <Typography v-if=\"hasError && errorText\" :id=\"errorId\" variant=\"caption\" size=\"medium\" color=\"danger\" as=\"p\">{{ errorText }}</Typography>\n <Typography v-else-if=\"helperText\" :id=\"helperId\" variant=\"caption\" size=\"medium\" color=\"muted\" as=\"p\">{{ helperText }}</Typography>\n </div>\n</template>\n"],"mappings":""}
@@ -75,7 +75,7 @@ var MorphSelectTrigger_vue_vue_type_script_setup_true_lang_default = /* @__PURE_
75
75
  }
76
76
  return (_ctx, _cache) => {
77
77
  return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
78
- class: (0, vue.normalizeClass)(["modo-morph-select flex flex-col", (0, vue.unref)(fullWidth) ? "w-full" : "inline-flex"]),
78
+ class: (0, vue.normalizeClass)(["modo-morph-select flex flex-col gap-1.5", (0, vue.unref)(fullWidth) ? "w-full" : "inline-flex"]),
79
79
  "data-modo-morph-select": "",
80
80
  "data-modo-size": (0, vue.unref)(size),
81
81
  "data-modo-radius": (0, vue.unref)(radius),
@@ -84,7 +84,7 @@ var MorphSelectTrigger_vue_vue_type_script_setup_true_lang_default = /* @__PURE_
84
84
  (0, vue.unref)(label) ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("label", {
85
85
  key: 0,
86
86
  for: (0, vue.unref)(fieldId),
87
- class: "modo-morph-select__label"
87
+ class: "modo-morph-select__label text-caption font-medium text-foreground"
88
88
  }, [(0, vue.createTextVNode)((0, vue.toDisplayString)((0, vue.unref)(label)) + " ", 1), (0, vue.unref)(required) ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_3, "*")) : (0, vue.createCommentVNode)("", true)], 8, _hoisted_2)) : (0, vue.createCommentVNode)("", true),
89
89
  (0, vue.createElementVNode)("div", {
90
90
  ref_key: "trigger",
@@ -1 +1 @@
1
- {"version":3,"file":"MorphSelectTrigger.vue_vue_type_script_setup_true_lang.cjs","names":["$attrs","$slots"],"sources":["../../../../src/components/forms/morph-select/MorphSelectTrigger.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, ref, watch, onBeforeUnmount } from 'vue'\nimport { ChevronDownIcon } from '@heroicons/vue/24/outline'\nimport type { MorphSelectTriggerProps } from '../../../interfaces/forms/MorphSelect.interface'\nimport { FIELD_AFFORDANCE_ICON_BY_COLOR, useFieldClasses } from '../../../composables/useField'\nimport { useModoLocale, useSizeTokens } from '../../../composables/useModoConfig'\nimport RenderContent from '../../../utils/RenderContent'\nimport Typography from '../../data-display/Typography.vue'\nimport { useMorphSelect } from './MorphSelectContext'\ndefineOptions({ inheritAttrs: false })\nconst props = withDefaults(defineProps<MorphSelectTriggerProps>(), { variant: 'outline' })\nconst {\n fieldId, multiple, selectedOptions, disabled, readonly, required, label, ariaLabel, helperText, errorText, hasError, stateColor,\n radius, size, halo, fullWidth, errorId, helperId, describedBy, phase, open, trigger, button, setOpen,\n} = useMorphSelect()\nconst loc = useModoLocale()\nconst sz = useSizeTokens(() => size.value)\nconst { wrapperVariantClasses, radiusClasses } = useFieldClasses({ variant: () => props.variant, stateColor, hasError, radius, halo })\nconst affordanceIconClass = computed(() => FIELD_AFFORDANCE_ICON_BY_COLOR[stateColor.value] ?? 'text-muted-foreground')\n\nconst landed = ref(false)\nlet landedTimer: ReturnType<typeof setTimeout> | undefined\nwatch(phase, (next, previous) => {\n if (previous === 'closing' && next === 'closed') {\n landed.value = true; clearTimeout(landedTimer)\n landedTimer = setTimeout(() => { landed.value = false }, 500)\n }\n})\nonBeforeUnmount(() => clearTimeout(landedTimer))\nconst selected = computed(() => selectedOptions.value[0])\n// Multiple: the selected labels joined, in option order.\nconst summary = computed(() => selectedOptions.value.map(option => option.textValue ?? String(option.label)).join(', '))\nconst hasValue = computed(() => selectedOptions.value.length > 0)\nfunction key(event: KeyboardEvent) { if (event.key === 'ArrowDown' || event.key === 'ArrowUp') { event.preventDefault(); setOpen(true) } }\n</script>\n<template>\n <div :class=\"['modo-morph-select flex flex-col', fullWidth ? 'w-full' : 'inline-flex']\" data-modo-morph-select=\"\" :data-modo-size=\"size\" :data-modo-radius=\"radius\" :data-modo-variant=\"variant\">\n <label v-if=\"label\" :for=\"fieldId\" class=\"modo-morph-select__label\">\n {{ label }}\n <span v-if=\"required\" aria-hidden=\"true\" class=\"text-destructive ml-0.5\">*</span>\n </label>\n <div ref=\"trigger\"\n :class=\"['modo-morph-select__field modo-field-wrapper', wrapperVariantClasses, radiusClasses, sz.control, disabled ? 'opacity-60 cursor-not-allowed' : '']\"\n :data-modo-morph-origin=\"phase === 'closed' ? (landed ? 'landed' : undefined) : phase === 'closing' ? 'closing' : 'hidden'\">\n <button :id=\"fieldId\" ref=\"button\" v-bind=\"$attrs\" type=\"button\" role=\"combobox\" aria-haspopup=\"listbox\"\n :class=\"['modo-morph-select__button flex h-full w-full items-center gap-2 text-left outline-none', sz.padX, sz.text, disabled ? 'cursor-not-allowed' : readonly ? 'cursor-default' : 'cursor-pointer']\"\n :aria-expanded=\"open\" :aria-controls=\"phase !== 'closed' ? `${fieldId}-listbox` : undefined\"\n :aria-label=\"!label ? ariaLabel : undefined\" :aria-describedby=\"describedBy\" :aria-invalid=\"hasError || undefined\"\n :aria-required=\"required || undefined\" :aria-readonly=\"readonly || undefined\" :disabled=\"disabled\" @keydown=\"key\" @click=\"setOpen(!open)\">\n <span v-if=\"$slots.icon || icon\" :class=\"['modo-morph-select__icon inline-flex shrink-0 items-center', affordanceIconClass]\" aria-hidden=\"true\">\n <slot name=\"icon\"><component :is=\"icon\" :class=\"sz.icon\" /></slot>\n </span>\n <span :class=\"['modo-morph-select__value min-w-0 flex-1 truncate', hasValue ? 'text-foreground' : 'text-muted-foreground']\" :data-modo-placeholder=\"hasValue ? undefined : ''\">\n <slot :option=\"selected\" :options=\"selectedOptions\">\n <template v-if=\"multiple && hasValue\">{{ summary }}</template>\n <RenderContent v-else :content=\"selected?.label ?? placeholder ?? loc.morphSelect.placeholder\" />\n </slot>\n </span>\n <ChevronDownIcon class=\"modo-morph-select__chevron\" aria-hidden=\"true\" :class=\"['shrink-0 transition-transform duration-base ease-standard', affordanceIconClass, sz.icon, open ? 'rotate-180' : '']\" />\n </button>\n </div>\n <Typography v-if=\"hasError && errorText\" :id=\"errorId\" variant=\"caption\" size=\"medium\" color=\"danger\" as=\"p\">{{ errorText }}</Typography>\n <Typography v-else-if=\"helperText\" :id=\"helperId\" variant=\"caption\" size=\"medium\" color=\"muted\" as=\"p\">{{ helperText }}</Typography>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUA,MAAM,QAAQ;EACd,MAAM,EACJ,SAAS,UAAU,iBAAiB,UAAU,UAAU,UAAU,OAAO,WAAW,YAAY,WAAW,UAAU,YACrH,QAAQ,MAAM,MAAM,WAAW,SAAS,UAAU,aAAa,OAAO,MAAM,SAAS,QAAQ,YAC3F,2BAAA,gBAAe;EACnB,MAAM,MAAM,sBAAA,eAAc;EAC1B,MAAM,KAAK,sBAAA,oBAAoB,KAAK,MAAK;EACzC,MAAM,EAAE,uBAAuB,kBAAkB,iBAAA,gBAAgB;GAAE,eAAe,MAAM;GAAS;GAAY;GAAU;GAAQ;GAAM,CAAA;EACrI,MAAM,uBAAA,GAAA,IAAA,gBAAqC,iBAAA,+BAA+B,WAAW,UAAU,wBAAuB;EAEtH,MAAM,UAAA,GAAA,IAAA,KAAa,MAAK;EACxB,IAAI;EACJ,CAAA,GAAA,IAAA,OAAM,QAAQ,MAAM,aAAa;GAC/B,IAAI,aAAa,aAAa,SAAS,UAAU;IAC/C,OAAO,QAAQ;IAAM,aAAa,YAAW;IAC7C,cAAc,iBAAiB;KAAE,OAAO,QAAQ;OAAS,IAAG;;IAE/D;EACD,CAAA,GAAA,IAAA,uBAAsB,aAAa,YAAY,CAAA;EAC/C,MAAM,YAAA,GAAA,IAAA,gBAA0B,gBAAgB,MAAM,GAAE;EAExD,MAAM,WAAA,GAAA,IAAA,gBAAyB,gBAAgB,MAAM,KAAI,WAAU,OAA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AAA,GAAA,IAAA,kBAAA,GAAA,IAAA,kBAAA,GAAA,IAAA,OAAb,WAAU,CAAA,EAAA,EAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"MorphSelectTrigger.vue_vue_type_script_setup_true_lang.cjs","names":["$attrs","$slots"],"sources":["../../../../src/components/forms/morph-select/MorphSelectTrigger.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, ref, watch, onBeforeUnmount } from 'vue'\nimport { ChevronDownIcon } from '@heroicons/vue/24/outline'\nimport type { MorphSelectTriggerProps } from '../../../interfaces/forms/MorphSelect.interface'\nimport { FIELD_AFFORDANCE_ICON_BY_COLOR, useFieldClasses } from '../../../composables/useField'\nimport { useModoLocale, useSizeTokens } from '../../../composables/useModoConfig'\nimport RenderContent from '../../../utils/RenderContent'\nimport Typography from '../../data-display/Typography.vue'\nimport { useMorphSelect } from './MorphSelectContext'\ndefineOptions({ inheritAttrs: false })\nconst props = withDefaults(defineProps<MorphSelectTriggerProps>(), { variant: 'outline' })\nconst {\n fieldId, multiple, selectedOptions, disabled, readonly, required, label, ariaLabel, helperText, errorText, hasError, stateColor,\n radius, size, halo, fullWidth, errorId, helperId, describedBy, phase, open, trigger, button, setOpen,\n} = useMorphSelect()\nconst loc = useModoLocale()\nconst sz = useSizeTokens(() => size.value)\nconst { wrapperVariantClasses, radiusClasses } = useFieldClasses({ variant: () => props.variant, stateColor, hasError, radius, halo })\nconst affordanceIconClass = computed(() => FIELD_AFFORDANCE_ICON_BY_COLOR[stateColor.value] ?? 'text-muted-foreground')\n\nconst landed = ref(false)\nlet landedTimer: ReturnType<typeof setTimeout> | undefined\nwatch(phase, (next, previous) => {\n if (previous === 'closing' && next === 'closed') {\n landed.value = true; clearTimeout(landedTimer)\n landedTimer = setTimeout(() => { landed.value = false }, 500)\n }\n})\nonBeforeUnmount(() => clearTimeout(landedTimer))\nconst selected = computed(() => selectedOptions.value[0])\n// Multiple: the selected labels joined, in option order.\nconst summary = computed(() => selectedOptions.value.map(option => option.textValue ?? String(option.label)).join(', '))\nconst hasValue = computed(() => selectedOptions.value.length > 0)\nfunction key(event: KeyboardEvent) { if (event.key === 'ArrowDown' || event.key === 'ArrowUp') { event.preventDefault(); setOpen(true) } }\n</script>\n<template>\n <div :class=\"['modo-morph-select flex flex-col gap-1.5', fullWidth ? 'w-full' : 'inline-flex']\" data-modo-morph-select=\"\" :data-modo-size=\"size\" :data-modo-radius=\"radius\" :data-modo-variant=\"variant\">\n <label v-if=\"label\" :for=\"fieldId\" class=\"modo-morph-select__label text-caption font-medium text-foreground\">\n {{ label }}\n <span v-if=\"required\" aria-hidden=\"true\" class=\"text-destructive ml-0.5\">*</span>\n </label>\n <div ref=\"trigger\"\n :class=\"['modo-morph-select__field modo-field-wrapper', wrapperVariantClasses, radiusClasses, sz.control, disabled ? 'opacity-60 cursor-not-allowed' : '']\"\n :data-modo-morph-origin=\"phase === 'closed' ? (landed ? 'landed' : undefined) : phase === 'closing' ? 'closing' : 'hidden'\">\n <button :id=\"fieldId\" ref=\"button\" v-bind=\"$attrs\" type=\"button\" role=\"combobox\" aria-haspopup=\"listbox\"\n :class=\"['modo-morph-select__button flex h-full w-full items-center gap-2 text-left outline-none', sz.padX, sz.text, disabled ? 'cursor-not-allowed' : readonly ? 'cursor-default' : 'cursor-pointer']\"\n :aria-expanded=\"open\" :aria-controls=\"phase !== 'closed' ? `${fieldId}-listbox` : undefined\"\n :aria-label=\"!label ? ariaLabel : undefined\" :aria-describedby=\"describedBy\" :aria-invalid=\"hasError || undefined\"\n :aria-required=\"required || undefined\" :aria-readonly=\"readonly || undefined\" :disabled=\"disabled\" @keydown=\"key\" @click=\"setOpen(!open)\">\n <span v-if=\"$slots.icon || icon\" :class=\"['modo-morph-select__icon inline-flex shrink-0 items-center', affordanceIconClass]\" aria-hidden=\"true\">\n <slot name=\"icon\"><component :is=\"icon\" :class=\"sz.icon\" /></slot>\n </span>\n <span :class=\"['modo-morph-select__value min-w-0 flex-1 truncate', hasValue ? 'text-foreground' : 'text-muted-foreground']\" :data-modo-placeholder=\"hasValue ? undefined : ''\">\n <slot :option=\"selected\" :options=\"selectedOptions\">\n <template v-if=\"multiple && hasValue\">{{ summary }}</template>\n <RenderContent v-else :content=\"selected?.label ?? placeholder ?? loc.morphSelect.placeholder\" />\n </slot>\n </span>\n <ChevronDownIcon class=\"modo-morph-select__chevron\" aria-hidden=\"true\" :class=\"['shrink-0 transition-transform duration-base ease-standard', affordanceIconClass, sz.icon, open ? 'rotate-180' : '']\" />\n </button>\n </div>\n <Typography v-if=\"hasError && errorText\" :id=\"errorId\" variant=\"caption\" size=\"medium\" color=\"danger\" as=\"p\">{{ errorText }}</Typography>\n <Typography v-else-if=\"helperText\" :id=\"helperId\" variant=\"caption\" size=\"medium\" color=\"muted\" as=\"p\">{{ helperText }}</Typography>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUA,MAAM,QAAQ;EACd,MAAM,EACJ,SAAS,UAAU,iBAAiB,UAAU,UAAU,UAAU,OAAO,WAAW,YAAY,WAAW,UAAU,YACrH,QAAQ,MAAM,MAAM,WAAW,SAAS,UAAU,aAAa,OAAO,MAAM,SAAS,QAAQ,YAC3F,2BAAA,gBAAe;EACnB,MAAM,MAAM,sBAAA,eAAc;EAC1B,MAAM,KAAK,sBAAA,oBAAoB,KAAK,MAAK;EACzC,MAAM,EAAE,uBAAuB,kBAAkB,iBAAA,gBAAgB;GAAE,eAAe,MAAM;GAAS;GAAY;GAAU;GAAQ;GAAM,CAAA;EACrI,MAAM,uBAAA,GAAA,IAAA,gBAAqC,iBAAA,+BAA+B,WAAW,UAAU,wBAAuB;EAEtH,MAAM,UAAA,GAAA,IAAA,KAAa,MAAK;EACxB,IAAI;EACJ,CAAA,GAAA,IAAA,OAAM,QAAQ,MAAM,aAAa;GAC/B,IAAI,aAAa,aAAa,SAAS,UAAU;IAC/C,OAAO,QAAQ;IAAM,aAAa,YAAW;IAC7C,cAAc,i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AA,OAAZ,UAAS,CAAA,EAAA,EAAA,CAAA,CAAA;;oCAClG,WAAU,KAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,aAAmG,mBAAA,SAAA;;KAAhG,KAAA,GAAA,IAAA,OAAI,SAAQ;KAAE,SAAQ;KAAU,MAAK;KAAS,OAAM;KAAQ,IAAG;;qCAAoB,EAAA,GAAA,IAAA,kBAAA,GAAA,IAAA,kBAAA,GAAA,IAAA,OAAb,WAAU,CAAA,EAAA,EAAA,CAAA,CAAA"}
@@ -74,7 +74,7 @@ var MorphSelectTrigger_vue_vue_type_script_setup_true_lang_default = /* @__PURE_
74
74
  }
75
75
  return (_ctx, _cache) => {
76
76
  return openBlock(), createElementBlock("div", {
77
- class: normalizeClass(["modo-morph-select flex flex-col", unref(fullWidth) ? "w-full" : "inline-flex"]),
77
+ class: normalizeClass(["modo-morph-select flex flex-col gap-1.5", unref(fullWidth) ? "w-full" : "inline-flex"]),
78
78
  "data-modo-morph-select": "",
79
79
  "data-modo-size": unref(size),
80
80
  "data-modo-radius": unref(radius),
@@ -83,7 +83,7 @@ var MorphSelectTrigger_vue_vue_type_script_setup_true_lang_default = /* @__PURE_
83
83
  unref(label) ? (openBlock(), createElementBlock("label", {
84
84
  key: 0,
85
85
  for: unref(fieldId),
86
- class: "modo-morph-select__label"
86
+ class: "modo-morph-select__label text-caption font-medium text-foreground"
87
87
  }, [createTextVNode(toDisplayString(unref(label)) + " ", 1), unref(required) ? (openBlock(), createElementBlock("span", _hoisted_3, "*")) : createCommentVNode("", true)], 8, _hoisted_2)) : createCommentVNode("", true),
88
88
  createElementVNode("div", {
89
89
  ref_key: "trigger",