mood-ui 0.13.0 → 0.13.1

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 (58) hide show
  1. package/dist/components/feedback/liquid-toast/LiquidToast.cjs.map +1 -1
  2. package/dist/components/feedback/liquid-toast/LiquidToast.mjs.map +1 -1
  3. package/dist/components/feedback/liquid-toast/LiquidToast.vue_vue_type_script_setup_true_lang.cjs +7 -6
  4. package/dist/components/feedback/liquid-toast/LiquidToast.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  5. package/dist/components/feedback/liquid-toast/LiquidToast.vue_vue_type_script_setup_true_lang.mjs +7 -6
  6. package/dist/components/feedback/liquid-toast/LiquidToast.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  7. package/dist/components/feedback/liquid-toast/LiquidToastShape.cjs.map +1 -1
  8. package/dist/components/feedback/liquid-toast/LiquidToastShape.mjs.map +1 -1
  9. package/dist/components/feedback/liquid-toast/LiquidToastShape.vue_vue_type_script_setup_true_lang.cjs +1 -0
  10. package/dist/components/feedback/liquid-toast/LiquidToastShape.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  11. package/dist/components/feedback/liquid-toast/LiquidToastShape.vue_vue_type_script_setup_true_lang.mjs +1 -0
  12. package/dist/components/feedback/liquid-toast/LiquidToastShape.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  13. package/dist/components/feedback/liquid-toast/LiquidToaster.cjs.map +1 -1
  14. package/dist/components/feedback/liquid-toast/LiquidToaster.mjs.map +1 -1
  15. package/dist/components/feedback/liquid-toast/LiquidToaster.vue_vue_type_script_setup_true_lang.cjs +2 -2
  16. package/dist/components/feedback/liquid-toast/LiquidToaster.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  17. package/dist/components/feedback/liquid-toast/LiquidToaster.vue_vue_type_script_setup_true_lang.mjs +2 -2
  18. package/dist/components/feedback/liquid-toast/LiquidToaster.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  19. package/dist/components/feedback/liquid-toast/liquidToast2.cjs +3 -3
  20. package/dist/components/feedback/liquid-toast/liquidToast2.cjs.map +1 -1
  21. package/dist/components/feedback/liquid-toast/liquidToast2.mjs +3 -3
  22. package/dist/components/feedback/liquid-toast/liquidToast2.mjs.map +1 -1
  23. package/dist/components/feedback/morph-tooltip/MorphTooltip.cjs.map +1 -1
  24. package/dist/components/feedback/morph-tooltip/MorphTooltip.mjs.map +1 -1
  25. package/dist/components/feedback/morph-tooltip/MorphTooltip.vue_vue_type_script_setup_true_lang.cjs +9 -4
  26. package/dist/components/feedback/morph-tooltip/MorphTooltip.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  27. package/dist/components/feedback/morph-tooltip/MorphTooltip.vue_vue_type_script_setup_true_lang.mjs +9 -4
  28. package/dist/components/feedback/morph-tooltip/MorphTooltip.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  29. package/dist/components/feedback/morph-tooltip/MorphTooltipContent.cjs.map +1 -1
  30. package/dist/components/feedback/morph-tooltip/MorphTooltipContent.mjs.map +1 -1
  31. package/dist/components/feedback/morph-tooltip/MorphTooltipContent.vue_vue_type_script_setup_true_lang.cjs +8 -4
  32. package/dist/components/feedback/morph-tooltip/MorphTooltipContent.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  33. package/dist/components/feedback/morph-tooltip/MorphTooltipContent.vue_vue_type_script_setup_true_lang.mjs +8 -4
  34. package/dist/components/feedback/morph-tooltip/MorphTooltipContent.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  35. package/dist/components/forms/glass-switch/GlassSwitch.cjs.map +1 -1
  36. package/dist/components/forms/glass-switch/GlassSwitch.mjs.map +1 -1
  37. package/dist/components/forms/glass-switch/GlassSwitch.vue_vue_type_script_setup_true_lang.cjs +21 -25
  38. package/dist/components/forms/glass-switch/GlassSwitch.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  39. package/dist/components/forms/glass-switch/GlassSwitch.vue_vue_type_script_setup_true_lang.mjs +21 -25
  40. package/dist/components/forms/glass-switch/GlassSwitch.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  41. package/dist/components/forms/morph-select/MorphSelectContent.cjs.map +1 -1
  42. package/dist/components/forms/morph-select/MorphSelectContent.mjs.map +1 -1
  43. package/dist/components/forms/morph-select/MorphSelectContent.vue_vue_type_script_setup_true_lang.cjs +3 -1
  44. package/dist/components/forms/morph-select/MorphSelectContent.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  45. package/dist/components/forms/morph-select/MorphSelectContent.vue_vue_type_script_setup_true_lang.mjs +3 -1
  46. package/dist/components/forms/morph-select/MorphSelectContent.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  47. package/dist/components/forms/morph-select/MorphSelectTrigger.cjs.map +1 -1
  48. package/dist/components/forms/morph-select/MorphSelectTrigger.mjs.map +1 -1
  49. package/dist/components/forms/morph-select/MorphSelectTrigger.vue_vue_type_script_setup_true_lang.cjs +11 -6
  50. package/dist/components/forms/morph-select/MorphSelectTrigger.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  51. package/dist/components/forms/morph-select/MorphSelectTrigger.vue_vue_type_script_setup_true_lang.mjs +11 -6
  52. package/dist/components/forms/morph-select/MorphSelectTrigger.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  53. package/dist/mood-ui.css +315 -89
  54. package/dist/types/components/feedback/liquid-toast/liquidToast.d.ts +1 -1
  55. package/dist/types/interfaces/feedback/LiquidToast.interface.d.ts +9 -9
  56. package/dist/types/interfaces/feedback/MorphTooltip.interface.d.ts +4 -4
  57. package/dist/types/interfaces/forms/GlassSwitch.interface.d.ts +1 -1
  58. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"GlassSwitch.vue_vue_type_script_setup_true_lang.mjs","names":[],"sources":["../../../../src/components/forms/glass-switch/GlassSwitch.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, onMounted, ref, useAttrs } from 'vue'\nimport type { GlassSwitchProps } from '../../../interfaces/forms/GlassSwitch.interface'\nimport { useFieldState } from '../../../composables/useField'\nimport { useResolvedRadius, useResolvedSize } from '../../../composables/useModoConfig'\nimport Typography from '../../data-display/Typography.vue'\nimport './glass-switch.css'\n\ndefineOptions({ name: 'GlassSwitch', inheritAttrs: false })\nconst props = withDefaults(defineProps<GlassSwitchProps>(), {\n modelValue: undefined,\n defaultChecked: false,\n color: 'default',\n labelPosition: 'right',\n disabled: false,\n readonly: false,\n required: false,\n loading: false,\n fullWidth: false,\n value: 'on',\n})\nconst emit = defineEmits<{ 'update:modelValue': [value: boolean]; change: [value: boolean] }>()\nconst attrs = useAttrs()\n// class/style lay out the field; every other attribute lands on the real input.\nconst inputAttrs = computed(() => { const { class: _c, style: _s, ...rest } = attrs; return rest })\n\nconst { fieldId, stateColor, hasError, isDisabled, errorId, helperId, describedBy } = useFieldState(props, {\n componentName: 'GlassSwitch',\n idPrefix: 'modo-glass-switch',\n})\n\nconst size = useResolvedSize(() => props.size)\n// Track radius (default pill), same steps as the native Switch track. The thumb stays round.\nconst resolvedRadius = useResolvedRadius(() => props.radius ?? 'full')\nconst trackRadiusClass = computed(() => {\n switch (resolvedRadius.value) {\n case 'none': return 'rounded-none'\n case 'small': return 'rounded-sm'\n case 'medium': return 'rounded-md'\n case 'large': return 'rounded-lg'\n case 'full':\n default: return 'rounded-full'\n }\n})\nconst labelSizeClass = computed(() => {\n switch (size.value) {\n case 'xsmall':\n case 'small': return 'text-caption'\n case 'large': return 'text-body-lg'\n case 'medium':\n default: return 'text-body'\n }\n})\n\nconst CHECKED_BG_BY_COLOR: Record<string, string> = {\n default: 'bg-foreground',\n primary: 'bg-primary',\n danger: 'bg-destructive',\n success: 'bg-success',\n warning: 'bg-warning',\n}\nconst fillClass = computed(() => CHECKED_BG_BY_COLOR[stateColor.value] ?? 'bg-foreground')\nconst trackStateClass = computed(() => (hasError.value ? 'bg-destructive/20' : 'bg-input group-hover:bg-muted'))\n\nconst internal = ref(props.defaultChecked)\nconst checked = computed(() => props.modelValue ?? internal.value)\nconst descriptionId = computed(() => `${fieldId.value}-description`)\nconst ariaDescribedBy = computed(() => {\n const ids = [props.description ? descriptionId.value : '', describedBy.value, attrs['aria-describedby'] as string | undefined]\n return ids.filter(Boolean).join(' ') || undefined\n})\nconst isLocked = computed(() => isDisabled.value || props.readonly)\n\nconst input = ref<HTMLInputElement | null>(null)\nconst track = ref<HTMLElement | null>(null)\nlet stopDrag: (() => void) | undefined\nlet suppressUntil = 0\nlet resetForm: HTMLFormElement | null = null\n\nfunction change(event: Event) {\n const target = event.target as HTMLInputElement\n if (props.readonly) { target.checked = checked.value; return }\n internal.value = target.checked\n emit('update:modelValue', target.checked)\n emit('change', target.checked)\n // Controlled consumers remain the source of truth.\n if (props.modelValue !== undefined) target.checked = checked.value\n}\nfunction reset() { internal.value = props.defaultChecked; emit('update:modelValue', props.defaultChecked) }\nonMounted(() => { resetForm = input.value?.form ?? null; resetForm?.addEventListener('reset', reset) })\nfunction click(event: MouseEvent) {\n if (Date.now() < suppressUntil) { event.preventDefault(); event.stopPropagation(); suppressUntil = 0 }\n}\nfunction start(event: PointerEvent) {\n const el = input.value, rail = track.value\n if (!el || !rail || isLocked.value || event.button > 0) return\n stopDrag?.()\n suppressUntil = 0\n const thumb = rail.querySelector<HTMLElement>('.modo-glass-switch__thumb')!\n const fill = rail.querySelector<HTMLElement>('.modo-glass-switch__fill')!\n const travel = Math.max(1, rail.clientWidth - thumb.offsetWidth - thumb.offsetLeft * 2)\n const from = checked.value ? 1 : 0\n const startX = event.clientX\n let progress = from, moved = false\n const move = (e: PointerEvent) => {\n if (e.pointerId !== event.pointerId) return\n const dx = e.clientX - startX\n if (Math.abs(dx) > 4) moved = true\n if (!moved) return\n progress = Math.min(1, Math.max(0, from + dx / travel))\n rail.setAttribute('data-modo-dragging', '')\n thumb.style.transform = `translateX(${progress * travel}px)`\n fill.style.opacity = String(progress)\n }\n const clean = () => {\n document.removeEventListener('pointermove', move)\n document.removeEventListener('pointerup', end)\n document.removeEventListener('pointercancel', end)\n rail.removeAttribute('data-modo-dragging')\n thumb.style.transform = ''; fill.style.opacity = ''\n stopDrag = undefined\n }\n const end = (e: PointerEvent) => {\n if (e.pointerId !== event.pointerId) return\n clean()\n if (!moved) return\n if (e.type !== 'pointercancel' && !isLocked.value && (progress > .5) !== checked.value) el.click()\n suppressUntil = Date.now() + 350\n }\n document.addEventListener('pointermove', move, { passive: true })\n document.addEventListener('pointerup', end)\n document.addEventListener('pointercancel', end)\n stopDrag = clean\n}\nonBeforeUnmount(() => { stopDrag?.(); resetForm?.removeEventListener('reset', reset) })\ndefineExpose({ focus: () => input.value?.focus() })\n</script>\n\n<template>\n <div :class=\"['flex flex-col gap-1', fullWidth ? 'w-full' : 'inline-flex', attrs.class]\" :style=\"attrs.style as any\">\n <label\n :for=\"fieldId\"\n :data-modo-size=\"size\"\n :class=\"[\n 'modo-glass-switch group inline-flex items-start gap-2.5 select-none',\n labelPosition === 'left' ? 'flex-row-reverse justify-end' : '',\n isDisabled ? 'opacity-60 cursor-not-allowed' : readonly ? 'cursor-default' : 'cursor-pointer',\n ]\"\n @click.capture=\"click\"\n >\n <input\n v-bind=\"inputAttrs\"\n :id=\"fieldId\"\n ref=\"input\"\n class=\"modo-glass-switch__input peer sr-only\"\n type=\"checkbox\"\n role=\"switch\"\n :checked=\"checked\"\n :disabled=\"isDisabled\"\n :readonly=\"readonly\"\n :required=\"required\"\n :name=\"name\"\n :value=\"value\"\n :aria-label=\"!label ? ariaLabel : undefined\"\n :aria-invalid=\"hasError || undefined\"\n :aria-readonly=\"readonly || undefined\"\n :aria-describedby=\"ariaDescribedBy\"\n @change=\"change\"\n />\n <span\n ref=\"track\"\n aria-hidden=\"true\"\n :class=\"[\n 'modo-glass-switch__track mt-0.5 ring-4 ring-border/25',\n 'peer-focus-visible:ring-2 peer-focus-visible:ring-ring/60',\n trackRadiusClass,\n trackStateClass,\n ]\"\n @pointerdown=\"start\"\n >\n <span :class=\"['modo-glass-switch__fill', fillClass]\" /><span class=\"modo-glass-switch__thumb\" />\n </span>\n <span v-if=\"label || description\" class=\"flex flex-col gap-0.5\">\n <span v-if=\"label\" :class=\"['font-medium text-foreground', labelSizeClass]\">\n {{ label }}\n <span v-if=\"required\" aria-hidden=\"true\" class=\"text-destructive ml-0.5\">*</span>\n </span>\n <span v-if=\"description\" :id=\"descriptionId\" class=\"text-caption text-muted-foreground\">{{ description }}</span>\n </span>\n </label>\n\n <Typography v-if=\"hasError && errorText\" :id=\"errorId\" variant=\"caption\" size=\"medium\" color=\"danger\" as=\"p\" role=\"alert\">\n {{ errorText }}\n </Typography>\n <Typography v-else-if=\"helperText\" :id=\"helperId\" variant=\"caption\" size=\"medium\" color=\"muted\" as=\"p\">\n {{ helperText }}\n </Typography>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASA,MAAM,QAAQ;EAYd,MAAM,OAAO;EACb,MAAM,QAAQ,UAAS;EAEvB,MAAM,aAAa,eAAe;GAAE,MAAM,EAAE,OAAO,IAAI,OAAO,IAAI,GAAG,SAAS;GAAO,OAAO;IAAM;EAElG,MAAM,EAAE,SAAS,YAAY,UAAU,YAAY,SAAS,UAAU,gBAAgB,cAAc,OAAO;GACzG,eAAe;GACf,UAAU;GACX,CAAA;EAED,MAAM,OAAO,sBAAsB,MAAM,KAAI;EAE7C,MAAM,iBAAiB,wBAAwB,MAAM,UAAU,OAAM;EACrE,MAAM,mBAAmB,eAAe;GACtC,QAAQ,eAAe,OAAvB;IACE,KAAK,QAAQ,OAAO;IACpB,KAAK,SAAS,OAAO;IACrB,KAAK,UAAU,OAAO;IACtB,KAAK,SAAS,OAAO;IAErB,SAAS,OAAO;;IAEnB;EACD,MAAM,iBAAiB,eAAe;GACpC,QAAQ,KAAK,OAAb;IACE,KAAK;IACL,KAAK,SAAS,OAAO;IACrB,KAAK,SAAS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,MAAA,GAAA,EAAA,EAAA,GAAA;IAEpF,QAAA,SAAS,QAAA,eAAA,WAAA,EAArB,mBAMO,QANP,YAMO,CALO,QAAA,SAAA,WAAA,EAAZ,mBAGO,QAAA;;KAHa,OAAK,eAAA,CAAA,+BAAkC,eAAA,MAAc,CAAA;wCACpE,QAAA,MAAK,GAAG,KACX,EAAA,EAAY,QAAA,YAAA,WAAA,EAAZ,mBAAiF,QAAjF,YAAyE,IAAC,IAAA,mBAAA,IAAA,KAAA,CAAA,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA,EAEhE,QAAA,eAAA,WAAA,EAAZ,mBAAgH,QAAA;;KAAtF,IAAI,cAAA;KAAe,OAAM;uBAAwC,QAAA,YAAW,EAAA,GAAA,WAAA,IAAA,mBAAA,IAAA,KAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA;uBAIxF,MAAA,SAAQ,IAAI,QAAA,aAAA,WAAA,EAA9B,YAEa,oBAAA;;IAF6B,IAAI,MAAA,QAAO;IAAE,SAAQ;IAAU,MAAK;IAAS,OAAM;IAAS,IAAG;IAAI,MAAK;;2BACjG,CAAA,gBAAA,gBAAZ,QAAA,UAAS,EAAA,EAAA,CAAA,CAAA;;oBAES,QAAA,cAAA,WAAA,EAAvB,YAEa,oBAAA;;IAFuB,IAAI,MAAA,SAAQ;IAAE,SAAQ;IAAU,MAAK;IAAS,OAAM;IAAQ,IAAG;;2BACjF,CAAA,gBAAA,gBAAb,QAAA,WAAU,EAAA,EAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"GlassSwitch.vue_vue_type_script_setup_true_lang.mjs","names":[],"sources":["../../../../src/components/forms/glass-switch/GlassSwitch.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, onMounted, ref, useAttrs } from 'vue'\nimport type { GlassSwitchProps } from '../../../interfaces/forms/GlassSwitch.interface'\nimport { useFieldState } from '../../../composables/useField'\nimport { useResolvedRadius, useResolvedSize } from '../../../composables/useModoConfig'\nimport Typography from '../../data-display/Typography.vue'\nimport './glass-switch.css'\n\ndefineOptions({ name: 'GlassSwitch', inheritAttrs: false })\nconst props = withDefaults(defineProps<GlassSwitchProps>(), {\n modelValue: undefined,\n defaultChecked: false,\n color: 'default',\n labelPosition: 'right',\n disabled: false,\n readonly: false,\n required: false,\n loading: false,\n fullWidth: false,\n value: 'on',\n})\nconst emit = defineEmits<{ 'update:modelValue': [value: boolean]; change: [value: boolean] }>()\nconst attrs = useAttrs()\n// class/style lay out the field; every other attribute lands on the real input.\nconst inputAttrs = computed(() => { const { class: _c, style: _s, ...rest } = attrs; return rest })\n\nconst { fieldId, stateColor, hasError, isDisabled, errorId, helperId, describedBy } = useFieldState(props, {\n componentName: 'GlassSwitch',\n idPrefix: 'modo-glass-switch',\n})\n\nconst size = useResolvedSize(() => props.size)\n// Track radius (default pill), same steps as the native Switch track. The thumb stays round.\nconst resolvedRadius = useResolvedRadius(() => props.radius ?? 'full')\nconst trackRadiusClass = computed(() => {\n switch (resolvedRadius.value) {\n case 'none': return 'rounded-none'\n case 'small': return 'rounded-sm'\n case 'medium': return 'rounded-md'\n case 'large': return 'rounded-lg'\n case 'full':\n default: return 'rounded-full'\n }\n})\nconst CHECKED_BG_BY_COLOR: Record<string, string> = {\n default: 'bg-primary',\n primary: 'bg-primary',\n danger: 'bg-destructive',\n success: 'bg-success',\n warning: 'bg-warning',\n}\nconst fillClass = computed(() => CHECKED_BG_BY_COLOR[stateColor.value] ?? 'bg-primary')\n\n\nconst internal = ref(props.defaultChecked)\nconst checked = computed(() => props.modelValue ?? internal.value)\nconst descriptionId = computed(() => `${fieldId.value}-description`)\nconst ariaDescribedBy = computed(() => {\n const ids = [props.description ? descriptionId.value : '', describedBy.value, attrs['aria-describedby'] as string | undefined]\n return ids.filter(Boolean).join(' ') || undefined\n})\nconst isLocked = computed(() => isDisabled.value || props.readonly)\n\nconst input = ref<HTMLInputElement | null>(null)\nconst track = ref<HTMLElement | null>(null)\nlet stopDrag: (() => void) | undefined\nlet suppressUntil = 0\nlet resetForm: HTMLFormElement | null = null\n\nfunction change(event: Event) {\n const target = event.target as HTMLInputElement\n if (props.readonly) { target.checked = checked.value; return }\n internal.value = target.checked\n emit('update:modelValue', target.checked)\n emit('change', target.checked)\n // Controlled consumers remain the source of truth.\n if (props.modelValue !== undefined) target.checked = checked.value\n}\nfunction reset() { internal.value = props.defaultChecked; emit('update:modelValue', props.defaultChecked) }\nonMounted(() => { resetForm = input.value?.form ?? null; resetForm?.addEventListener('reset', reset) })\nfunction click(event: MouseEvent) {\n if (Date.now() < suppressUntil) { event.preventDefault(); event.stopPropagation(); suppressUntil = 0 }\n}\nfunction start(event: PointerEvent) {\n const el = input.value, rail = track.value\n if (!el || !rail || isLocked.value || event.button > 0) return\n stopDrag?.()\n suppressUntil = 0\n const thumb = rail.querySelector<HTMLElement>('.modo-glass-switch__thumb')!\n const fill = rail.querySelector<HTMLElement>('.modo-glass-switch__fill')!\n const travel = Math.max(1, rail.clientWidth - thumb.offsetWidth - thumb.offsetLeft * 2)\n const from = checked.value ? 1 : 0\n const startX = event.clientX\n let progress = from, moved = false\n const move = (e: PointerEvent) => {\n if (e.pointerId !== event.pointerId) return\n const dx = e.clientX - startX\n if (Math.abs(dx) > 4) moved = true\n if (!moved) return\n progress = Math.min(1, Math.max(0, from + dx / travel))\n rail.setAttribute('data-modo-dragging', '')\n thumb.style.transform = `translateX(${progress * travel}px)`\n fill.style.opacity = String(progress)\n }\n const clean = () => {\n document.removeEventListener('pointermove', move)\n document.removeEventListener('pointerup', end)\n document.removeEventListener('pointercancel', end)\n rail.removeAttribute('data-modo-dragging')\n thumb.style.transform = ''; fill.style.opacity = ''\n stopDrag = undefined\n }\n const end = (e: PointerEvent) => {\n if (e.pointerId !== event.pointerId) return\n clean()\n if (!moved) return\n if (e.type !== 'pointercancel' && !isLocked.value && (progress > .5) !== checked.value) el.click()\n suppressUntil = Date.now() + 350\n }\n document.addEventListener('pointermove', move, { passive: true })\n document.addEventListener('pointerup', end)\n document.addEventListener('pointercancel', end)\n stopDrag = clean\n}\nonBeforeUnmount(() => { stopDrag?.(); resetForm?.removeEventListener('reset', reset) })\ndefineExpose({ focus: () => input.value?.focus() })\n</script>\n\n<template>\n <div :class=\"['flex flex-col gap-1', fullWidth ? 'w-full' : 'inline-flex', attrs.class]\" :style=\"attrs.style as any\">\n <label\n :for=\"fieldId\"\n :data-modo-size=\"size\"\n :data-modo-label-first=\"labelPosition === 'left' ? '' : undefined\"\n :class=\"[\n 'modo-glass-switch group inline-flex items-start select-none',\n labelPosition === 'left' ? 'flex-row-reverse justify-between' : '',\n isDisabled ? 'opacity-60 cursor-not-allowed' : readonly ? 'cursor-default' : 'cursor-pointer',\n ]\"\n @click.capture=\"click\"\n >\n <input\n v-bind=\"inputAttrs\"\n :id=\"fieldId\"\n ref=\"input\"\n class=\"modo-glass-switch__input peer sr-only\"\n type=\"checkbox\"\n role=\"switch\"\n :checked=\"checked\"\n :disabled=\"isDisabled\"\n :readonly=\"readonly\"\n :required=\"required\"\n :name=\"name\"\n :value=\"value\"\n :aria-label=\"!label ? ariaLabel : undefined\"\n :aria-invalid=\"hasError || undefined\"\n :aria-readonly=\"readonly || undefined\"\n :aria-describedby=\"ariaDescribedBy\"\n @change=\"change\"\n />\n <span\n ref=\"track\"\n aria-hidden=\"true\"\n :class=\"[\n 'modo-glass-switch__track',\n 'peer-focus-visible:ring-2 peer-focus-visible:ring-ring/60',\n trackRadiusClass,\n\n ]\"\n @pointerdown=\"start\"\n >\n <span :class=\"['modo-glass-switch__fill', fillClass]\" /><span class=\"modo-glass-switch__thumb\" />\n </span>\n <span v-if=\"label || description\" class=\"modo-glass-switch__text\">\n <span v-if=\"label\" class=\"modo-glass-switch__label\">\n {{ label }}\n <span v-if=\"required\" aria-hidden=\"true\" class=\"text-destructive ml-0.5\">*</span>\n </span>\n <span v-if=\"description\" :id=\"descriptionId\" class=\"modo-glass-switch__description\">{{ description }}</span>\n </span>\n </label>\n\n <Typography v-if=\"hasError && errorText\" :id=\"errorId\" variant=\"caption\" size=\"medium\" color=\"danger\" as=\"p\" role=\"alert\">\n {{ errorText }}\n </Typography>\n <Typography v-else-if=\"helperText\" :id=\"helperId\" variant=\"caption\" size=\"medium\" color=\"muted\" as=\"p\">\n {{ helperText }}\n </Typography>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASA,MAAM,QAAQ;EAYd,MAAM,OAAO;EACb,MAAM,QAAQ,UAAS;EAEvB,MAAM,aAAa,eAAe;GAAE,MAAM,EAAE,OAAO,IAAI,OAAO,IAAI,GAAG,SAAS;GAAO,OAAO;IAAM;EAElG,MAAM,EAAE,SAAS,YAAY,UAAU,YAAY,SAAS,UAAU,gBAAgB,cAAc,OAAO;GACzG,eAAe;GACf,UAAU;GACX,CAAA;EAED,MAAM,OAAO,sBAAsB,MAAM,KAAI;EAE7C,MAAM,iBAAiB,wBAAwB,MAAM,UAAU,OAAM;EACrE,MAAM,mBAAmB,eAAe;GACtC,QAAQ,eAAe,OAAvB;IACE,KAAK,QAAQ,OAAO;IACpB,KAAK,SAAS,OAAO;IACrB,KAAK,UAAU,OAAO;IACtB,KAAK,SAAS,OAAO;IAErB,SAAS,OAAO;;IAEnB;EACD,MAAM,sBAA8C;GAClD,SAAS;GACT,SAAS;GACT,QAAQ;GACR,SAAS;GACT,SAAS;GACX;EACA,MAAM,YAAY,eAAe,oBAAoB,WAAW,UAAU,aAAY;EAGtF,MAAM,WAAW,IAAI,MAAM,eAAc;EACzC,MAAM,UAAU,eAAe,MAAM,cAAc,SAAS,MAAK;EACjE,MAAM,gBAAgB,eAAe,GAAG,QAAQ,MAAM,cAAa;EACnE,MAAM,kBAAkB,eAAe;GAErC,OAAO;IADM,MAAM,cAAc,cAAc,QAAQ;IAAI,YAAY;IAAO,MAAM;IAC7E,CAAI,OAAO,QAAQ,CAAC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AAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA;uBAIpF,MAAA,SAAQ,IAAI,QAAA,aAAA,WAAA,EAA9B,YAEa,oBAAA;;IAF6B,IAAI,MAAA,QAAO;IAAE,SAAQ;IAAU,MAAK;IAAS,OAAM;IAAS,IAAG;IAAI,MAAK;;2BACjG,CAAA,gBAAA,gBAAZ,QAAA,UAAS,EAAA,EAAA,CAAA,CAAA;;oBAES,QAAA,cAAA,WAAA,EAAvB,YAEa,oBAAA;;IAFuB,IAAI,MAAA,SAAQ;IAAE,SAAQ;IAAU,MAAK;IAAS,OAAM;IAAQ,IAAG;;2BACjF,CAAA,gBAAA,gBAAb,QAAA,WAAU,EAAA,EAAA,CAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"MorphSelectContent.cjs","names":[],"sources":["../../../../src/components/forms/morph-select/MorphSelectContent.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, nextTick, onBeforeUnmount, ref, watch } from 'vue'\nimport type { MorphSelectContentProps } from '../../../interfaces/forms/MorphSelect.interface'\nimport { useTeleportedModoTheme } from '../../../composables/useTeleportedModoTheme'\nimport { useModoLocale } from '../../../composables/useModoConfig'\nimport { MENU_PRESET, runMorph } from '../../../utils/morph/morphEngine'\nimport { attachCloseScrub, isTopMorphLayer, resolvePlacement } from '../../../utils/morph/morphHelpers'\nimport { CheckIcon } from '@heroicons/vue/24/outline'\nimport RenderContent from '../../../utils/RenderContent'\nimport { useMorphSelect } from './MorphSelectContext'\nimport { useMorphSelectKeyboard } from './useMorphSelectKeyboard'\nconst props = withDefaults(defineProps<MorphSelectContentProps>(), { side: 'auto', align: 'auto' })\nconst { fieldId, options, value, phase, trigger, button, select, setOpen, restoreFocus, stateColor, radius, size } = useMorphSelect()\nconst loc = useModoLocale()\nconst searchLabel = computed(() => props.searchPlaceholder ?? loc.value.morphSelect.searchPlaceholder)\nconst emptyLabel = computed(() => props.emptyMessage ?? loc.value.morphSelect.empty)\n// Same option surfaces and check colors as the native Select, per state color.\nconst OPTION_HOVER: Record<string, string> = {\n default: 'hover:bg-muted focus-visible:bg-muted',\n primary: 'hover:bg-primary/10 focus-visible:bg-primary/10',\n danger: 'hover:bg-destructive/10 focus-visible:bg-destructive/10',\n success: 'hover:bg-success/10 focus-visible:bg-success/10',\n warning: 'hover:bg-warning/10 focus-visible:bg-warning/10',\n}\nconst CHECK_COLOR: Record<string, string> = {\n default: 'text-foreground',\n primary: 'text-primary',\n danger: 'text-destructive',\n success: 'text-success',\n warning: 'text-warning',\n}\nconst optionClass = computed(() => OPTION_HOVER[stateColor.value] ?? OPTION_HOVER.default)\nconst checkClass = computed(() => CHECK_COLOR[stateColor.value] ?? CHECK_COLOR.default)\nconst panel = ref<HTMLElement | null>(null), ghost = ref<HTMLElement | null>(null)\nconst filter = ref('')\nconst shown = computed(() => options.value.filter(option => (option.textValue ?? String(option.label)).toLocaleLowerCase().includes(filter.value.toLocaleLowerCase())))\nconst { scopedTheme, providerStyle } = useTeleportedModoTheme({ radius, size })\nconst key = useMorphSelectKeyboard(panel, () => setOpen(false))\nfunction position() {\n const p = panel.value, t = trigger.value\n if (!p || !t) return\n const rect = t.getBoundingClientRect()\n p.style.width = `${rect.width}px`\n if (button.value) { const cs = getComputedStyle(button.value); p.style.setProperty('--modo-morph-select-ghost-px', cs.paddingLeft); p.style.setProperty('--modo-morph-select-ghost-fs', cs.fontSize) }\n const pos = resolvePlacement(rect, { width: p.offsetWidth, height: p.offsetHeight }, { width: innerWidth, height: innerHeight }, props.side, props.align)\n p.style.left = `${pos.left}px`; p.style.top = `${pos.top}px`\n p.style.transformOrigin = `${pos.align === 'end' ? '100%' : pos.align === 'center' ? '50%' : '0%'} ${pos.side === 'top' ? '100%' : '0%'}`\n}\nwatch(phase, async (current, previous, cleanup) => {\n let cancelled = false\n cleanup(() => { cancelled = true; panel.value?.getAnimations?.().forEach(animation => animation.cancel()) })\n if (current === 'closed') {\n filter.value = ''\n if (previous !== 'closed' && restoreFocus.value) button.value?.focus()\n return\n }\n await nextTick(); if (cancelled) return\n position()\n const p = panel.value\n if (!p) return\n if (current === 'opening' || current === 'closing') {\n runMorph({ panel: p, trigger: trigger.value, ghost: ghost.value, preset: MENU_PRESET, direction: current === 'opening' ? 'open' : 'close', onFinish: () => { if (!cancelled) phase.value = current === 'opening' ? 'open' : 'closed' } })\n } else if (current === 'open') {\n (props.searchable ? p.querySelector<HTMLElement>('input') : p.querySelector<HTMLElement>('[role=\"option\"][aria-selected=\"true\"]:not([disabled])') ?? p.querySelector<HTMLElement>('[role=\"option\"]:not([disabled])') ?? p)?.focus()\n }\n}, { immediate: true })\nwatch([() => phase.value === 'open', panel], ([active, el], _, cleanup) => {\n if (!active || !el || !trigger.value) return\n const stop = attachCloseScrub(el, trigger.value, MENU_PRESET, () => setOpen(false))\n cleanup(stop)\n}, { flush: 'post' })\nwatch(() => phase.value === 'opening' || phase.value === 'open', (active, _, cleanup) => {\n if (!active) return\n function outside(event: PointerEvent) { const p = panel.value, target = event.target as Node; if (p && isTopMorphLayer(p) && !p.contains(target) && !trigger.value?.contains(target)) setOpen(false, false) }\n function scroll(event: Event) { if (!panel.value?.contains(event.target as Node)) setOpen(false, false) }\n function resize() { setOpen(false) }\n document.addEventListener('pointerdown', outside); document.addEventListener('scroll', scroll, true); window.addEventListener('resize', resize)\n cleanup(() => { document.removeEventListener('pointerdown', outside); document.removeEventListener('scroll', scroll, true); window.removeEventListener('resize', resize) })\n})\nwatch([filter, () => props.side, () => props.align, () => options.value.length], () => nextTick(position))\nonBeforeUnmount(() => panel.value?.getAnimations?.().forEach(animation => animation.cancel()))\n</script>\n<template>\n <Teleport to=\"body\">\n <div v-if=\"phase !== 'closed'\" ref=\"panel\" tabindex=\"-1\" class=\"modo-morph-select-panel text-foreground\" data-modo-morph-select-panel=\"\" data-modo-morph-layer=\"\"\n :data-modo-phase=\"phase\" :data-modo-theme=\"scopedTheme\" :data-modo-color=\"stateColor\" :inert=\"phase === 'closing'\" :style=\"[providerStyle, { position: 'fixed' }]\" @keydown=\"key\">\n <div v-if=\"searchable\" class=\"modo-morph-select__search\">\n <input v-model=\"filter\" type=\"text\" autocomplete=\"off\" spellcheck=\"false\" :placeholder=\"searchLabel\" :aria-label=\"searchLabel\" :aria-controls=\"`${fieldId}-listbox`\"\n class=\"modo-morph-select__search-input w-full border border-input bg-transparent text-foreground placeholder:text-muted-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring/60\" />\n </div>\n <div :id=\"`${fieldId}-listbox`\" role=\"listbox\" :aria-labelledby=\"fieldId\" class=\"modo-morph-select__list\">\n <button v-for=\"option in shown\" :key=\"option.value\" type=\"button\" role=\"option\" tabindex=\"-1\"\n :class=\"['modo-morph-select__option outline-none', option.value === value ? 'font-medium' : '', option.disabled ? 'text-muted-foreground/60' : optionClass]\"\n :aria-selected=\"option.value === value\" :disabled=\"option.disabled\" :data-text-value=\"option.textValue ?? String(option.label)\" @click=\"select(option.value)\">\n <span class=\"modo-morph-select__option-text\"><slot name=\"option\" :option=\"option\" :selected=\"option.value === value\"><span class=\"truncate\"><RenderContent :content=\"option.label\" /></span><span v-if=\"option.description\" class=\"text-caption text-muted-foreground font-normal\"><RenderContent :content=\"option.description\" /></span></slot></span>\n <CheckIcon v-if=\"option.value === value\" :class=\"['modo-morph-select__check shrink-0', checkClass]\" aria-hidden=\"true\" />\n </button>\n </div>\n <p v-if=\"!shown.length\" role=\"status\" class=\"modo-morph-select__empty text-caption text-muted-foreground text-center\">{{ emptyLabel }}</p>\n <div v-if=\"phase === 'closing'\" class=\"modo-morph-select-ghost\" aria-hidden=\"true\"><span ref=\"ghost\" class=\"modo-morph-select-ghost__inner\"><RenderContent :content=\"options.find(option => option.value === value)?.label\" /></span></div>\n </div>\n </Teleport>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"MorphSelectContent.cjs","names":[],"sources":["../../../../src/components/forms/morph-select/MorphSelectContent.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, nextTick, onBeforeUnmount, ref, watch } from 'vue'\nimport type { MorphSelectContentProps } from '../../../interfaces/forms/MorphSelect.interface'\nimport { useTeleportedModoTheme } from '../../../composables/useTeleportedModoTheme'\nimport { useModoLocale } from '../../../composables/useModoConfig'\nimport { MENU_PRESET, runMorph } from '../../../utils/morph/morphEngine'\nimport { attachCloseScrub, isTopMorphLayer, resolvePlacement } from '../../../utils/morph/morphHelpers'\nimport { CheckIcon } from '@heroicons/vue/24/outline'\nimport RenderContent from '../../../utils/RenderContent'\nimport { useMorphSelect } from './MorphSelectContext'\nimport { useMorphSelectKeyboard } from './useMorphSelectKeyboard'\nconst props = withDefaults(defineProps<MorphSelectContentProps>(), { side: 'auto', align: 'auto' })\nconst { fieldId, options, value, phase, trigger, button, select, setOpen, restoreFocus, stateColor, radius, size } = useMorphSelect()\nconst loc = useModoLocale()\nconst searchLabel = computed(() => props.searchPlaceholder ?? loc.value.morphSelect.searchPlaceholder)\nconst emptyLabel = computed(() => props.emptyMessage ?? loc.value.morphSelect.empty)\n// Same option surfaces and check colors as the native Select, per state color.\nconst OPTION_HOVER: Record<string, string> = {\n default: 'hover:bg-muted focus-visible:bg-muted',\n primary: 'hover:bg-primary/10 focus-visible:bg-primary/10',\n danger: 'hover:bg-destructive/10 focus-visible:bg-destructive/10',\n success: 'hover:bg-success/10 focus-visible:bg-success/10',\n warning: 'hover:bg-warning/10 focus-visible:bg-warning/10',\n}\nconst CHECK_COLOR: Record<string, string> = {\n default: 'text-foreground',\n primary: 'text-primary',\n danger: 'text-destructive',\n success: 'text-success',\n warning: 'text-warning',\n}\nconst optionClass = computed(() => OPTION_HOVER[stateColor.value] ?? OPTION_HOVER.default)\nconst checkClass = computed(() => CHECK_COLOR[stateColor.value] ?? CHECK_COLOR.default)\nconst panel = ref<HTMLElement | null>(null), ghost = ref<HTMLElement | null>(null)\nconst filter = ref('')\nconst shown = computed(() => options.value.filter(option => (option.textValue ?? String(option.label)).toLocaleLowerCase().includes(filter.value.toLocaleLowerCase())))\nconst { scopedTheme, providerStyle } = useTeleportedModoTheme({ radius, size })\nconst key = useMorphSelectKeyboard(panel, () => setOpen(false))\nfunction position() {\n const p = panel.value, t = trigger.value\n if (!p || !t) return\n const rect = t.getBoundingClientRect()\n p.style.width = `${rect.width}px`\n if (button.value) { const cs = getComputedStyle(button.value); p.style.setProperty('--modo-morph-select-ghost-px', cs.paddingLeft); p.style.setProperty('--modo-morph-select-ghost-fs', cs.fontSize) }\n const pos = resolvePlacement(rect, { width: p.offsetWidth, height: p.offsetHeight }, { width: innerWidth, height: innerHeight }, props.side, props.align)\n p.style.left = `${pos.left}px`; p.style.top = `${pos.top}px`\n p.style.transformOrigin = `${pos.align === 'end' ? '100%' : pos.align === 'center' ? '50%' : '0%'} ${pos.side === 'top' ? '100%' : '0%'}`\n}\nwatch(phase, async (current, previous, cleanup) => {\n let cancelled = false\n cleanup(() => { cancelled = true; panel.value?.getAnimations?.().forEach(animation => animation.cancel()) })\n if (current === 'closed') {\n filter.value = ''\n if (previous !== 'closed' && restoreFocus.value) button.value?.focus()\n return\n }\n await nextTick(); if (cancelled) return\n position()\n const p = panel.value\n if (!p) return\n if (current === 'opening' || current === 'closing') {\n runMorph({ panel: p, trigger: trigger.value, ghost: ghost.value, preset: MENU_PRESET, direction: current === 'opening' ? 'open' : 'close', onFinish: () => { if (!cancelled) phase.value = current === 'opening' ? 'open' : 'closed' } })\n } else if (current === 'open') {\n (props.searchable ? p.querySelector<HTMLElement>('input') : p.querySelector<HTMLElement>('[role=\"option\"][aria-selected=\"true\"]:not([disabled])') ?? p.querySelector<HTMLElement>('[role=\"option\"]:not([disabled])') ?? p)?.focus()\n }\n}, { immediate: true })\nwatch([() => phase.value === 'open', panel], ([active, el], _, cleanup) => {\n if (!active || !el || !trigger.value) return\n const stop = attachCloseScrub(el, trigger.value, MENU_PRESET, () => setOpen(false))\n cleanup(stop)\n}, { flush: 'post' })\nwatch(() => phase.value === 'opening' || phase.value === 'open', (active, _, cleanup) => {\n if (!active) return\n function outside(event: PointerEvent) { const p = panel.value, target = event.target as Node; if (p && isTopMorphLayer(p) && !p.contains(target) && !trigger.value?.contains(target)) setOpen(false, false) }\n function scroll(event: Event) { if (!panel.value?.contains(event.target as Node)) setOpen(false, false) }\n function resize() { setOpen(false) }\n document.addEventListener('pointerdown', outside); document.addEventListener('scroll', scroll, true); window.addEventListener('resize', resize)\n cleanup(() => { document.removeEventListener('pointerdown', outside); document.removeEventListener('scroll', scroll, true); window.removeEventListener('resize', resize) })\n})\nwatch([filter, () => props.side, () => props.align, () => options.value.length], () => nextTick(position))\nonBeforeUnmount(() => panel.value?.getAnimations?.().forEach(animation => animation.cancel()))\n</script>\n<template>\n <Teleport to=\"body\">\n <div v-if=\"phase !== 'closed'\" ref=\"panel\" tabindex=\"-1\" class=\"modo-morph-select-panel text-foreground\" data-modo-morph-select-panel=\"\" data-modo-morph-layer=\"\"\n :data-modo-phase=\"phase\" :data-modo-theme=\"scopedTheme\" :data-modo-radius=\"radius\" :data-modo-color=\"stateColor\" :inert=\"phase === 'closing'\" :style=\"[providerStyle, { position: 'fixed' }]\" @keydown=\"key\">\n <div v-if=\"searchable\" class=\"modo-morph-select__search\">\n <input v-model=\"filter\" type=\"text\" autocomplete=\"off\" spellcheck=\"false\" :placeholder=\"searchLabel\" :aria-label=\"searchLabel\" :aria-controls=\"`${fieldId}-listbox`\"\n class=\"modo-morph-select__search-input w-full border border-input bg-transparent text-foreground placeholder:text-muted-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring/60\" />\n </div>\n <div :id=\"`${fieldId}-listbox`\" role=\"listbox\" :aria-labelledby=\"fieldId\" class=\"modo-morph-select__list\">\n <button v-for=\"option in shown\" :key=\"option.value\" type=\"button\" role=\"option\" tabindex=\"-1\"\n :class=\"['modo-morph-select__option outline-none', option.value === value ? 'font-medium' : '', option.disabled ? 'text-muted-foreground/60' : optionClass]\"\n :aria-selected=\"option.value === value\" :disabled=\"option.disabled\" :data-text-value=\"option.textValue ?? String(option.label)\" @click=\"select(option.value)\">\n <span class=\"modo-morph-select__option-text\"><slot name=\"option\" :option=\"option\" :selected=\"option.value === value\"><span class=\"truncate\"><RenderContent :content=\"option.label\" /></span><span v-if=\"option.description\" class=\"modo-morph-select__option-desc\"><RenderContent :content=\"option.description\" /></span></slot></span>\n <CheckIcon v-if=\"option.value === value\" :class=\"['modo-morph-select__check shrink-0', checkClass]\" aria-hidden=\"true\" />\n </button>\n </div>\n <p v-if=\"!shown.length\" role=\"status\" class=\"modo-morph-select__empty text-caption text-muted-foreground text-center\">{{ emptyLabel }}</p>\n <div v-if=\"phase === 'closing'\" class=\"modo-morph-select-ghost\" aria-hidden=\"true\"><span ref=\"ghost\" class=\"modo-morph-select-ghost__inner\"><RenderContent :content=\"options.find(option => option.value === value)?.label\" /></span></div>\n </div>\n </Teleport>\n</template>\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"MorphSelectContent.mjs","names":[],"sources":["../../../../src/components/forms/morph-select/MorphSelectContent.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, nextTick, onBeforeUnmount, ref, watch } from 'vue'\nimport type { MorphSelectContentProps } from '../../../interfaces/forms/MorphSelect.interface'\nimport { useTeleportedModoTheme } from '../../../composables/useTeleportedModoTheme'\nimport { useModoLocale } from '../../../composables/useModoConfig'\nimport { MENU_PRESET, runMorph } from '../../../utils/morph/morphEngine'\nimport { attachCloseScrub, isTopMorphLayer, resolvePlacement } from '../../../utils/morph/morphHelpers'\nimport { CheckIcon } from '@heroicons/vue/24/outline'\nimport RenderContent from '../../../utils/RenderContent'\nimport { useMorphSelect } from './MorphSelectContext'\nimport { useMorphSelectKeyboard } from './useMorphSelectKeyboard'\nconst props = withDefaults(defineProps<MorphSelectContentProps>(), { side: 'auto', align: 'auto' })\nconst { fieldId, options, value, phase, trigger, button, select, setOpen, restoreFocus, stateColor, radius, size } = useMorphSelect()\nconst loc = useModoLocale()\nconst searchLabel = computed(() => props.searchPlaceholder ?? loc.value.morphSelect.searchPlaceholder)\nconst emptyLabel = computed(() => props.emptyMessage ?? loc.value.morphSelect.empty)\n// Same option surfaces and check colors as the native Select, per state color.\nconst OPTION_HOVER: Record<string, string> = {\n default: 'hover:bg-muted focus-visible:bg-muted',\n primary: 'hover:bg-primary/10 focus-visible:bg-primary/10',\n danger: 'hover:bg-destructive/10 focus-visible:bg-destructive/10',\n success: 'hover:bg-success/10 focus-visible:bg-success/10',\n warning: 'hover:bg-warning/10 focus-visible:bg-warning/10',\n}\nconst CHECK_COLOR: Record<string, string> = {\n default: 'text-foreground',\n primary: 'text-primary',\n danger: 'text-destructive',\n success: 'text-success',\n warning: 'text-warning',\n}\nconst optionClass = computed(() => OPTION_HOVER[stateColor.value] ?? OPTION_HOVER.default)\nconst checkClass = computed(() => CHECK_COLOR[stateColor.value] ?? CHECK_COLOR.default)\nconst panel = ref<HTMLElement | null>(null), ghost = ref<HTMLElement | null>(null)\nconst filter = ref('')\nconst shown = computed(() => options.value.filter(option => (option.textValue ?? String(option.label)).toLocaleLowerCase().includes(filter.value.toLocaleLowerCase())))\nconst { scopedTheme, providerStyle } = useTeleportedModoTheme({ radius, size })\nconst key = useMorphSelectKeyboard(panel, () => setOpen(false))\nfunction position() {\n const p = panel.value, t = trigger.value\n if (!p || !t) return\n const rect = t.getBoundingClientRect()\n p.style.width = `${rect.width}px`\n if (button.value) { const cs = getComputedStyle(button.value); p.style.setProperty('--modo-morph-select-ghost-px', cs.paddingLeft); p.style.setProperty('--modo-morph-select-ghost-fs', cs.fontSize) }\n const pos = resolvePlacement(rect, { width: p.offsetWidth, height: p.offsetHeight }, { width: innerWidth, height: innerHeight }, props.side, props.align)\n p.style.left = `${pos.left}px`; p.style.top = `${pos.top}px`\n p.style.transformOrigin = `${pos.align === 'end' ? '100%' : pos.align === 'center' ? '50%' : '0%'} ${pos.side === 'top' ? '100%' : '0%'}`\n}\nwatch(phase, async (current, previous, cleanup) => {\n let cancelled = false\n cleanup(() => { cancelled = true; panel.value?.getAnimations?.().forEach(animation => animation.cancel()) })\n if (current === 'closed') {\n filter.value = ''\n if (previous !== 'closed' && restoreFocus.value) button.value?.focus()\n return\n }\n await nextTick(); if (cancelled) return\n position()\n const p = panel.value\n if (!p) return\n if (current === 'opening' || current === 'closing') {\n runMorph({ panel: p, trigger: trigger.value, ghost: ghost.value, preset: MENU_PRESET, direction: current === 'opening' ? 'open' : 'close', onFinish: () => { if (!cancelled) phase.value = current === 'opening' ? 'open' : 'closed' } })\n } else if (current === 'open') {\n (props.searchable ? p.querySelector<HTMLElement>('input') : p.querySelector<HTMLElement>('[role=\"option\"][aria-selected=\"true\"]:not([disabled])') ?? p.querySelector<HTMLElement>('[role=\"option\"]:not([disabled])') ?? p)?.focus()\n }\n}, { immediate: true })\nwatch([() => phase.value === 'open', panel], ([active, el], _, cleanup) => {\n if (!active || !el || !trigger.value) return\n const stop = attachCloseScrub(el, trigger.value, MENU_PRESET, () => setOpen(false))\n cleanup(stop)\n}, { flush: 'post' })\nwatch(() => phase.value === 'opening' || phase.value === 'open', (active, _, cleanup) => {\n if (!active) return\n function outside(event: PointerEvent) { const p = panel.value, target = event.target as Node; if (p && isTopMorphLayer(p) && !p.contains(target) && !trigger.value?.contains(target)) setOpen(false, false) }\n function scroll(event: Event) { if (!panel.value?.contains(event.target as Node)) setOpen(false, false) }\n function resize() { setOpen(false) }\n document.addEventListener('pointerdown', outside); document.addEventListener('scroll', scroll, true); window.addEventListener('resize', resize)\n cleanup(() => { document.removeEventListener('pointerdown', outside); document.removeEventListener('scroll', scroll, true); window.removeEventListener('resize', resize) })\n})\nwatch([filter, () => props.side, () => props.align, () => options.value.length], () => nextTick(position))\nonBeforeUnmount(() => panel.value?.getAnimations?.().forEach(animation => animation.cancel()))\n</script>\n<template>\n <Teleport to=\"body\">\n <div v-if=\"phase !== 'closed'\" ref=\"panel\" tabindex=\"-1\" class=\"modo-morph-select-panel text-foreground\" data-modo-morph-select-panel=\"\" data-modo-morph-layer=\"\"\n :data-modo-phase=\"phase\" :data-modo-theme=\"scopedTheme\" :data-modo-color=\"stateColor\" :inert=\"phase === 'closing'\" :style=\"[providerStyle, { position: 'fixed' }]\" @keydown=\"key\">\n <div v-if=\"searchable\" class=\"modo-morph-select__search\">\n <input v-model=\"filter\" type=\"text\" autocomplete=\"off\" spellcheck=\"false\" :placeholder=\"searchLabel\" :aria-label=\"searchLabel\" :aria-controls=\"`${fieldId}-listbox`\"\n class=\"modo-morph-select__search-input w-full border border-input bg-transparent text-foreground placeholder:text-muted-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring/60\" />\n </div>\n <div :id=\"`${fieldId}-listbox`\" role=\"listbox\" :aria-labelledby=\"fieldId\" class=\"modo-morph-select__list\">\n <button v-for=\"option in shown\" :key=\"option.value\" type=\"button\" role=\"option\" tabindex=\"-1\"\n :class=\"['modo-morph-select__option outline-none', option.value === value ? 'font-medium' : '', option.disabled ? 'text-muted-foreground/60' : optionClass]\"\n :aria-selected=\"option.value === value\" :disabled=\"option.disabled\" :data-text-value=\"option.textValue ?? String(option.label)\" @click=\"select(option.value)\">\n <span class=\"modo-morph-select__option-text\"><slot name=\"option\" :option=\"option\" :selected=\"option.value === value\"><span class=\"truncate\"><RenderContent :content=\"option.label\" /></span><span v-if=\"option.description\" class=\"text-caption text-muted-foreground font-normal\"><RenderContent :content=\"option.description\" /></span></slot></span>\n <CheckIcon v-if=\"option.value === value\" :class=\"['modo-morph-select__check shrink-0', checkClass]\" aria-hidden=\"true\" />\n </button>\n </div>\n <p v-if=\"!shown.length\" role=\"status\" class=\"modo-morph-select__empty text-caption text-muted-foreground text-center\">{{ emptyLabel }}</p>\n <div v-if=\"phase === 'closing'\" class=\"modo-morph-select-ghost\" aria-hidden=\"true\"><span ref=\"ghost\" class=\"modo-morph-select-ghost__inner\"><RenderContent :content=\"options.find(option => option.value === value)?.label\" /></span></div>\n </div>\n </Teleport>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"MorphSelectContent.mjs","names":[],"sources":["../../../../src/components/forms/morph-select/MorphSelectContent.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, nextTick, onBeforeUnmount, ref, watch } from 'vue'\nimport type { MorphSelectContentProps } from '../../../interfaces/forms/MorphSelect.interface'\nimport { useTeleportedModoTheme } from '../../../composables/useTeleportedModoTheme'\nimport { useModoLocale } from '../../../composables/useModoConfig'\nimport { MENU_PRESET, runMorph } from '../../../utils/morph/morphEngine'\nimport { attachCloseScrub, isTopMorphLayer, resolvePlacement } from '../../../utils/morph/morphHelpers'\nimport { CheckIcon } from '@heroicons/vue/24/outline'\nimport RenderContent from '../../../utils/RenderContent'\nimport { useMorphSelect } from './MorphSelectContext'\nimport { useMorphSelectKeyboard } from './useMorphSelectKeyboard'\nconst props = withDefaults(defineProps<MorphSelectContentProps>(), { side: 'auto', align: 'auto' })\nconst { fieldId, options, value, phase, trigger, button, select, setOpen, restoreFocus, stateColor, radius, size } = useMorphSelect()\nconst loc = useModoLocale()\nconst searchLabel = computed(() => props.searchPlaceholder ?? loc.value.morphSelect.searchPlaceholder)\nconst emptyLabel = computed(() => props.emptyMessage ?? loc.value.morphSelect.empty)\n// Same option surfaces and check colors as the native Select, per state color.\nconst OPTION_HOVER: Record<string, string> = {\n default: 'hover:bg-muted focus-visible:bg-muted',\n primary: 'hover:bg-primary/10 focus-visible:bg-primary/10',\n danger: 'hover:bg-destructive/10 focus-visible:bg-destructive/10',\n success: 'hover:bg-success/10 focus-visible:bg-success/10',\n warning: 'hover:bg-warning/10 focus-visible:bg-warning/10',\n}\nconst CHECK_COLOR: Record<string, string> = {\n default: 'text-foreground',\n primary: 'text-primary',\n danger: 'text-destructive',\n success: 'text-success',\n warning: 'text-warning',\n}\nconst optionClass = computed(() => OPTION_HOVER[stateColor.value] ?? OPTION_HOVER.default)\nconst checkClass = computed(() => CHECK_COLOR[stateColor.value] ?? CHECK_COLOR.default)\nconst panel = ref<HTMLElement | null>(null), ghost = ref<HTMLElement | null>(null)\nconst filter = ref('')\nconst shown = computed(() => options.value.filter(option => (option.textValue ?? String(option.label)).toLocaleLowerCase().includes(filter.value.toLocaleLowerCase())))\nconst { scopedTheme, providerStyle } = useTeleportedModoTheme({ radius, size })\nconst key = useMorphSelectKeyboard(panel, () => setOpen(false))\nfunction position() {\n const p = panel.value, t = trigger.value\n if (!p || !t) return\n const rect = t.getBoundingClientRect()\n p.style.width = `${rect.width}px`\n if (button.value) { const cs = getComputedStyle(button.value); p.style.setProperty('--modo-morph-select-ghost-px', cs.paddingLeft); p.style.setProperty('--modo-morph-select-ghost-fs', cs.fontSize) }\n const pos = resolvePlacement(rect, { width: p.offsetWidth, height: p.offsetHeight }, { width: innerWidth, height: innerHeight }, props.side, props.align)\n p.style.left = `${pos.left}px`; p.style.top = `${pos.top}px`\n p.style.transformOrigin = `${pos.align === 'end' ? '100%' : pos.align === 'center' ? '50%' : '0%'} ${pos.side === 'top' ? '100%' : '0%'}`\n}\nwatch(phase, async (current, previous, cleanup) => {\n let cancelled = false\n cleanup(() => { cancelled = true; panel.value?.getAnimations?.().forEach(animation => animation.cancel()) })\n if (current === 'closed') {\n filter.value = ''\n if (previous !== 'closed' && restoreFocus.value) button.value?.focus()\n return\n }\n await nextTick(); if (cancelled) return\n position()\n const p = panel.value\n if (!p) return\n if (current === 'opening' || current === 'closing') {\n runMorph({ panel: p, trigger: trigger.value, ghost: ghost.value, preset: MENU_PRESET, direction: current === 'opening' ? 'open' : 'close', onFinish: () => { if (!cancelled) phase.value = current === 'opening' ? 'open' : 'closed' } })\n } else if (current === 'open') {\n (props.searchable ? p.querySelector<HTMLElement>('input') : p.querySelector<HTMLElement>('[role=\"option\"][aria-selected=\"true\"]:not([disabled])') ?? p.querySelector<HTMLElement>('[role=\"option\"]:not([disabled])') ?? p)?.focus()\n }\n}, { immediate: true })\nwatch([() => phase.value === 'open', panel], ([active, el], _, cleanup) => {\n if (!active || !el || !trigger.value) return\n const stop = attachCloseScrub(el, trigger.value, MENU_PRESET, () => setOpen(false))\n cleanup(stop)\n}, { flush: 'post' })\nwatch(() => phase.value === 'opening' || phase.value === 'open', (active, _, cleanup) => {\n if (!active) return\n function outside(event: PointerEvent) { const p = panel.value, target = event.target as Node; if (p && isTopMorphLayer(p) && !p.contains(target) && !trigger.value?.contains(target)) setOpen(false, false) }\n function scroll(event: Event) { if (!panel.value?.contains(event.target as Node)) setOpen(false, false) }\n function resize() { setOpen(false) }\n document.addEventListener('pointerdown', outside); document.addEventListener('scroll', scroll, true); window.addEventListener('resize', resize)\n cleanup(() => { document.removeEventListener('pointerdown', outside); document.removeEventListener('scroll', scroll, true); window.removeEventListener('resize', resize) })\n})\nwatch([filter, () => props.side, () => props.align, () => options.value.length], () => nextTick(position))\nonBeforeUnmount(() => panel.value?.getAnimations?.().forEach(animation => animation.cancel()))\n</script>\n<template>\n <Teleport to=\"body\">\n <div v-if=\"phase !== 'closed'\" ref=\"panel\" tabindex=\"-1\" class=\"modo-morph-select-panel text-foreground\" data-modo-morph-select-panel=\"\" data-modo-morph-layer=\"\"\n :data-modo-phase=\"phase\" :data-modo-theme=\"scopedTheme\" :data-modo-radius=\"radius\" :data-modo-color=\"stateColor\" :inert=\"phase === 'closing'\" :style=\"[providerStyle, { position: 'fixed' }]\" @keydown=\"key\">\n <div v-if=\"searchable\" class=\"modo-morph-select__search\">\n <input v-model=\"filter\" type=\"text\" autocomplete=\"off\" spellcheck=\"false\" :placeholder=\"searchLabel\" :aria-label=\"searchLabel\" :aria-controls=\"`${fieldId}-listbox`\"\n class=\"modo-morph-select__search-input w-full border border-input bg-transparent text-foreground placeholder:text-muted-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring/60\" />\n </div>\n <div :id=\"`${fieldId}-listbox`\" role=\"listbox\" :aria-labelledby=\"fieldId\" class=\"modo-morph-select__list\">\n <button v-for=\"option in shown\" :key=\"option.value\" type=\"button\" role=\"option\" tabindex=\"-1\"\n :class=\"['modo-morph-select__option outline-none', option.value === value ? 'font-medium' : '', option.disabled ? 'text-muted-foreground/60' : optionClass]\"\n :aria-selected=\"option.value === value\" :disabled=\"option.disabled\" :data-text-value=\"option.textValue ?? String(option.label)\" @click=\"select(option.value)\">\n <span class=\"modo-morph-select__option-text\"><slot name=\"option\" :option=\"option\" :selected=\"option.value === value\"><span class=\"truncate\"><RenderContent :content=\"option.label\" /></span><span v-if=\"option.description\" class=\"modo-morph-select__option-desc\"><RenderContent :content=\"option.description\" /></span></slot></span>\n <CheckIcon v-if=\"option.value === value\" :class=\"['modo-morph-select__check shrink-0', checkClass]\" aria-hidden=\"true\" />\n </button>\n </div>\n <p v-if=\"!shown.length\" role=\"status\" class=\"modo-morph-select__empty text-caption text-muted-foreground text-center\">{{ emptyLabel }}</p>\n <div v-if=\"phase === 'closing'\" class=\"modo-morph-select-ghost\" aria-hidden=\"true\"><span ref=\"ghost\" class=\"modo-morph-select-ghost__inner\"><RenderContent :content=\"options.find(option => option.value === value)?.label\" /></span></div>\n </div>\n </Teleport>\n</template>\n"],"mappings":""}
@@ -12,6 +12,7 @@ let _heroicons_vue_24_outline = require("@heroicons/vue/24/outline");
12
12
  var _hoisted_1 = [
13
13
  "data-modo-phase",
14
14
  "data-modo-theme",
15
+ "data-modo-radius",
15
16
  "data-modo-color",
16
17
  "inert"
17
18
  ];
@@ -35,7 +36,7 @@ var _hoisted_6 = { class: "modo-morph-select__option-text" };
35
36
  var _hoisted_7 = { class: "truncate" };
36
37
  var _hoisted_8 = {
37
38
  key: 0,
38
- class: "text-caption text-muted-foreground font-normal"
39
+ class: "modo-morph-select__option-desc"
39
40
  };
40
41
  var _hoisted_9 = {
41
42
  key: 1,
@@ -178,6 +179,7 @@ var MorphSelectContent_vue_vue_type_script_setup_true_lang_default = /* @__PURE_
178
179
  "data-modo-morph-layer": "",
179
180
  "data-modo-phase": (0, vue.unref)(phase),
180
181
  "data-modo-theme": (0, vue.unref)(scopedTheme),
182
+ "data-modo-radius": (0, vue.unref)(radius),
181
183
  "data-modo-color": (0, vue.unref)(stateColor),
182
184
  inert: (0, vue.unref)(phase) === "closing",
183
185
  style: (0, vue.normalizeStyle)([(0, vue.unref)(providerStyle), { position: "fixed" }]),
@@ -1 +1 @@
1
- {"version":3,"file":"MorphSelectContent.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../../../src/components/forms/morph-select/MorphSelectContent.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, nextTick, onBeforeUnmount, ref, watch } from 'vue'\nimport type { MorphSelectContentProps } from '../../../interfaces/forms/MorphSelect.interface'\nimport { useTeleportedModoTheme } from '../../../composables/useTeleportedModoTheme'\nimport { useModoLocale } from '../../../composables/useModoConfig'\nimport { MENU_PRESET, runMorph } from '../../../utils/morph/morphEngine'\nimport { attachCloseScrub, isTopMorphLayer, resolvePlacement } from '../../../utils/morph/morphHelpers'\nimport { CheckIcon } from '@heroicons/vue/24/outline'\nimport RenderContent from '../../../utils/RenderContent'\nimport { useMorphSelect } from './MorphSelectContext'\nimport { useMorphSelectKeyboard } from './useMorphSelectKeyboard'\nconst props = withDefaults(defineProps<MorphSelectContentProps>(), { side: 'auto', align: 'auto' })\nconst { fieldId, options, value, phase, trigger, button, select, setOpen, restoreFocus, stateColor, radius, size } = useMorphSelect()\nconst loc = useModoLocale()\nconst searchLabel = computed(() => props.searchPlaceholder ?? loc.value.morphSelect.searchPlaceholder)\nconst emptyLabel = computed(() => props.emptyMessage ?? loc.value.morphSelect.empty)\n// Same option surfaces and check colors as the native Select, per state color.\nconst OPTION_HOVER: Record<string, string> = {\n default: 'hover:bg-muted focus-visible:bg-muted',\n primary: 'hover:bg-primary/10 focus-visible:bg-primary/10',\n danger: 'hover:bg-destructive/10 focus-visible:bg-destructive/10',\n success: 'hover:bg-success/10 focus-visible:bg-success/10',\n warning: 'hover:bg-warning/10 focus-visible:bg-warning/10',\n}\nconst CHECK_COLOR: Record<string, string> = {\n default: 'text-foreground',\n primary: 'text-primary',\n danger: 'text-destructive',\n success: 'text-success',\n warning: 'text-warning',\n}\nconst optionClass = computed(() => OPTION_HOVER[stateColor.value] ?? OPTION_HOVER.default)\nconst checkClass = computed(() => CHECK_COLOR[stateColor.value] ?? CHECK_COLOR.default)\nconst panel = ref<HTMLElement | null>(null), ghost = ref<HTMLElement | null>(null)\nconst filter = ref('')\nconst shown = computed(() => options.value.filter(option => (option.textValue ?? String(option.label)).toLocaleLowerCase().includes(filter.value.toLocaleLowerCase())))\nconst { scopedTheme, providerStyle } = useTeleportedModoTheme({ radius, size })\nconst key = useMorphSelectKeyboard(panel, () => setOpen(false))\nfunction position() {\n const p = panel.value, t = trigger.value\n if (!p || !t) return\n const rect = t.getBoundingClientRect()\n p.style.width = `${rect.width}px`\n if (button.value) { const cs = getComputedStyle(button.value); p.style.setProperty('--modo-morph-select-ghost-px', cs.paddingLeft); p.style.setProperty('--modo-morph-select-ghost-fs', cs.fontSize) }\n const pos = resolvePlacement(rect, { width: p.offsetWidth, height: p.offsetHeight }, { width: innerWidth, height: innerHeight }, props.side, props.align)\n p.style.left = `${pos.left}px`; p.style.top = `${pos.top}px`\n p.style.transformOrigin = `${pos.align === 'end' ? '100%' : pos.align === 'center' ? '50%' : '0%'} ${pos.side === 'top' ? '100%' : '0%'}`\n}\nwatch(phase, async (current, previous, cleanup) => {\n let cancelled = false\n cleanup(() => { cancelled = true; panel.value?.getAnimations?.().forEach(animation => animation.cancel()) })\n if (current === 'closed') {\n filter.value = ''\n if (previous !== 'closed' && restoreFocus.value) button.value?.focus()\n return\n }\n await nextTick(); if (cancelled) return\n position()\n const p = panel.value\n if (!p) return\n if (current === 'opening' || current === 'closing') {\n runMorph({ panel: p, trigger: trigger.value, ghost: ghost.value, preset: MENU_PRESET, direction: current === 'opening' ? 'open' : 'close', onFinish: () => { if (!cancelled) phase.value = current === 'opening' ? 'open' : 'closed' } })\n } else if (current === 'open') {\n (props.searchable ? p.querySelector<HTMLElement>('input') : p.querySelector<HTMLElement>('[role=\"option\"][aria-selected=\"true\"]:not([disabled])') ?? p.querySelector<HTMLElement>('[role=\"option\"]:not([disabled])') ?? p)?.focus()\n }\n}, { immediate: true })\nwatch([() => phase.value === 'open', panel], ([active, el], _, cleanup) => {\n if (!active || !el || !trigger.value) return\n const stop = attachCloseScrub(el, trigger.value, MENU_PRESET, () => setOpen(false))\n cleanup(stop)\n}, { flush: 'post' })\nwatch(() => phase.value === 'opening' || phase.value === 'open', (active, _, cleanup) => {\n if (!active) return\n function outside(event: PointerEvent) { const p = panel.value, target = event.target as Node; if (p && isTopMorphLayer(p) && !p.contains(target) && !trigger.value?.contains(target)) setOpen(false, false) }\n function scroll(event: Event) { if (!panel.value?.contains(event.target as Node)) setOpen(false, false) }\n function resize() { setOpen(false) }\n document.addEventListener('pointerdown', outside); document.addEventListener('scroll', scroll, true); window.addEventListener('resize', resize)\n cleanup(() => { document.removeEventListener('pointerdown', outside); document.removeEventListener('scroll', scroll, true); window.removeEventListener('resize', resize) })\n})\nwatch([filter, () => props.side, () => props.align, () => options.value.length], () => nextTick(position))\nonBeforeUnmount(() => panel.value?.getAnimations?.().forEach(animation => animation.cancel()))\n</script>\n<template>\n <Teleport to=\"body\">\n <div v-if=\"phase !== 'closed'\" ref=\"panel\" tabindex=\"-1\" class=\"modo-morph-select-panel text-foreground\" data-modo-morph-select-panel=\"\" data-modo-morph-layer=\"\"\n :data-modo-phase=\"phase\" :data-modo-theme=\"scopedTheme\" :data-modo-color=\"stateColor\" :inert=\"phase === 'closing'\" :style=\"[providerStyle, { position: 'fixed' }]\" @keydown=\"key\">\n <div v-if=\"searchable\" class=\"modo-morph-select__search\">\n <input v-model=\"filter\" type=\"text\" autocomplete=\"off\" spellcheck=\"false\" :placeholder=\"searchLabel\" :aria-label=\"searchLabel\" :aria-controls=\"`${fieldId}-listbox`\"\n class=\"modo-morph-select__search-input w-full border border-input bg-transparent text-foreground placeholder:text-muted-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring/60\" />\n </div>\n <div :id=\"`${fieldId}-listbox`\" role=\"listbox\" :aria-labelledby=\"fieldId\" class=\"modo-morph-select__list\">\n <button v-for=\"option in shown\" :key=\"option.value\" type=\"button\" role=\"option\" tabindex=\"-1\"\n :class=\"['modo-morph-select__option outline-none', option.value === value ? 'font-medium' : '', option.disabled ? 'text-muted-foreground/60' : optionClass]\"\n :aria-selected=\"option.value === value\" :disabled=\"option.disabled\" :data-text-value=\"option.textValue ?? String(option.label)\" @click=\"select(option.value)\">\n <span class=\"modo-morph-select__option-text\"><slot name=\"option\" :option=\"option\" :selected=\"option.value === value\"><span class=\"truncate\"><RenderContent :content=\"option.label\" /></span><span v-if=\"option.description\" class=\"text-caption text-muted-foreground font-normal\"><RenderContent :content=\"option.description\" /></span></slot></span>\n <CheckIcon v-if=\"option.value === value\" :class=\"['modo-morph-select__check shrink-0', checkClass]\" aria-hidden=\"true\" />\n </button>\n </div>\n <p v-if=\"!shown.length\" role=\"status\" class=\"modo-morph-select__empty text-caption text-muted-foreground text-center\">{{ emptyLabel }}</p>\n <div v-if=\"phase === 'closing'\" class=\"modo-morph-select-ghost\" aria-hidden=\"true\"><span ref=\"ghost\" class=\"modo-morph-select-ghost__inner\"><RenderContent :content=\"options.find(option => option.value === value)?.label\" /></span></div>\n </div>\n </Teleport>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWA,MAAM,QAAQ;EACd,MAAM,EAAE,SAAS,SAAS,OAAO,OAAO,SAAS,QAAQ,QAAQ,SAAS,cAAc,YAAY,QAAQ,SAAS,2BAAA,gBAAe;EACpI,MAAM,MAAM,sBAAA,eAAc;EAC1B,MAAM,eAAA,GAAA,IAAA,gBAA6B,MAAM,qBAAqB,IAAI,MAAM,YAAY,kBAAiB;EACrG,MAAM,cAAA,GAAA,IAAA,gBAA4B,MAAM,gBAAgB,IAAI,MAAM,YAAY,MAAK;EAEnF,MAAM,eAAuC;GAC3C,SAAS;GACT,SAAS;GACT,QAAQ;GACR,SAAS;GACT,SAAS;GACX;EACA,MAAM,cAAsC;GAC1C,SAAS;GACT,SAAS;GACT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":[],"sources":["../../../../src/components/forms/morph-select/MorphSelectContent.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, nextTick, onBeforeUnmount, ref, watch } from 'vue'\nimport type { MorphSelectContentProps } from '../../../interfaces/forms/MorphSelect.interface'\nimport { useTeleportedModoTheme } from '../../../composables/useTeleportedModoTheme'\nimport { useModoLocale } from '../../../composables/useModoConfig'\nimport { MENU_PRESET, runMorph } from '../../../utils/morph/morphEngine'\nimport { attachCloseScrub, isTopMorphLayer, resolvePlacement } from '../../../utils/morph/morphHelpers'\nimport { CheckIcon } from '@heroicons/vue/24/outline'\nimport RenderContent from '../../../utils/RenderContent'\nimport { useMorphSelect } from './MorphSelectContext'\nimport { useMorphSelectKeyboard } from './useMorphSelectKeyboard'\nconst props = withDefaults(defineProps<MorphSelectContentProps>(), { side: 'auto', align: 'auto' })\nconst { fieldId, options, value, phase, trigger, button, select, setOpen, restoreFocus, stateColor, radius, size } = useMorphSelect()\nconst loc = useModoLocale()\nconst searchLabel = computed(() => props.searchPlaceholder ?? loc.value.morphSelect.searchPlaceholder)\nconst emptyLabel = computed(() => props.emptyMessage ?? loc.value.morphSelect.empty)\n// Same option surfaces and check colors as the native Select, per state color.\nconst OPTION_HOVER: Record<string, string> = {\n default: 'hover:bg-muted focus-visible:bg-muted',\n primary: 'hover:bg-primary/10 focus-visible:bg-primary/10',\n danger: 'hover:bg-destructive/10 focus-visible:bg-destructive/10',\n success: 'hover:bg-success/10 focus-visible:bg-success/10',\n warning: 'hover:bg-warning/10 focus-visible:bg-warning/10',\n}\nconst CHECK_COLOR: Record<string, string> = {\n default: 'text-foreground',\n primary: 'text-primary',\n danger: 'text-destructive',\n success: 'text-success',\n warning: 'text-warning',\n}\nconst optionClass = computed(() => OPTION_HOVER[stateColor.value] ?? OPTION_HOVER.default)\nconst checkClass = computed(() => CHECK_COLOR[stateColor.value] ?? CHECK_COLOR.default)\nconst panel = ref<HTMLElement | null>(null), ghost = ref<HTMLElement | null>(null)\nconst filter = ref('')\nconst shown = computed(() => options.value.filter(option => (option.textValue ?? String(option.label)).toLocaleLowerCase().includes(filter.value.toLocaleLowerCase())))\nconst { scopedTheme, providerStyle } = useTeleportedModoTheme({ radius, size })\nconst key = useMorphSelectKeyboard(panel, () => setOpen(false))\nfunction position() {\n const p = panel.value, t = trigger.value\n if (!p || !t) return\n const rect = t.getBoundingClientRect()\n p.style.width = `${rect.width}px`\n if (button.value) { const cs = getComputedStyle(button.value); p.style.setProperty('--modo-morph-select-ghost-px', cs.paddingLeft); p.style.setProperty('--modo-morph-select-ghost-fs', cs.fontSize) }\n const pos = resolvePlacement(rect, { width: p.offsetWidth, height: p.offsetHeight }, { width: innerWidth, height: innerHeight }, props.side, props.align)\n p.style.left = `${pos.left}px`; p.style.top = `${pos.top}px`\n p.style.transformOrigin = `${pos.align === 'end' ? '100%' : pos.align === 'center' ? '50%' : '0%'} ${pos.side === 'top' ? '100%' : '0%'}`\n}\nwatch(phase, async (current, previous, cleanup) => {\n let cancelled = false\n cleanup(() => { cancelled = true; panel.value?.getAnimations?.().forEach(animation => animation.cancel()) })\n if (current === 'closed') {\n filter.value = ''\n if (previous !== 'closed' && restoreFocus.value) button.value?.focus()\n return\n }\n await nextTick(); if (cancelled) return\n position()\n const p = panel.value\n if (!p) return\n if (current === 'opening' || current === 'closing') {\n runMorph({ panel: p, trigger: trigger.value, ghost: ghost.value, preset: MENU_PRESET, direction: current === 'opening' ? 'open' : 'close', onFinish: () => { if (!cancelled) phase.value = current === 'opening' ? 'open' : 'closed' } })\n } else if (current === 'open') {\n (props.searchable ? p.querySelector<HTMLElement>('input') : p.querySelector<HTMLElement>('[role=\"option\"][aria-selected=\"true\"]:not([disabled])') ?? p.querySelector<HTMLElement>('[role=\"option\"]:not([disabled])') ?? p)?.focus()\n }\n}, { immediate: true })\nwatch([() => phase.value === 'open', panel], ([active, el], _, cleanup) => {\n if (!active || !el || !trigger.value) return\n const stop = attachCloseScrub(el, trigger.value, MENU_PRESET, () => setOpen(false))\n cleanup(stop)\n}, { flush: 'post' })\nwatch(() => phase.value === 'opening' || phase.value === 'open', (active, _, cleanup) => {\n if (!active) return\n function outside(event: PointerEvent) { const p = panel.value, target = event.target as Node; if (p && isTopMorphLayer(p) && !p.contains(target) && !trigger.value?.contains(target)) setOpen(false, false) }\n function scroll(event: Event) { if (!panel.value?.contains(event.target as Node)) setOpen(false, false) }\n function resize() { setOpen(false) }\n document.addEventListener('pointerdown', outside); document.addEventListener('scroll', scroll, true); window.addEventListener('resize', resize)\n cleanup(() => { document.removeEventListener('pointerdown', outside); document.removeEventListener('scroll', scroll, true); window.removeEventListener('resize', resize) })\n})\nwatch([filter, () => props.side, () => props.align, () => options.value.length], () => nextTick(position))\nonBeforeUnmount(() => panel.value?.getAnimations?.().forEach(animation => animation.cancel()))\n</script>\n<template>\n <Teleport to=\"body\">\n <div v-if=\"phase !== 'closed'\" ref=\"panel\" tabindex=\"-1\" class=\"modo-morph-select-panel text-foreground\" data-modo-morph-select-panel=\"\" data-modo-morph-layer=\"\"\n :data-modo-phase=\"phase\" :data-modo-theme=\"scopedTheme\" :data-modo-radius=\"radius\" :data-modo-color=\"stateColor\" :inert=\"phase === 'closing'\" :style=\"[providerStyle, { position: 'fixed' }]\" @keydown=\"key\">\n <div v-if=\"searchable\" class=\"modo-morph-select__search\">\n <input v-model=\"filter\" type=\"text\" autocomplete=\"off\" spellcheck=\"false\" :placeholder=\"searchLabel\" :aria-label=\"searchLabel\" :aria-controls=\"`${fieldId}-listbox`\"\n class=\"modo-morph-select__search-input w-full border border-input bg-transparent text-foreground placeholder:text-muted-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring/60\" />\n </div>\n <div :id=\"`${fieldId}-listbox`\" role=\"listbox\" :aria-labelledby=\"fieldId\" class=\"modo-morph-select__list\">\n <button v-for=\"option in shown\" :key=\"option.value\" type=\"button\" role=\"option\" tabindex=\"-1\"\n :class=\"['modo-morph-select__option outline-none', option.value === value ? 'font-medium' : '', option.disabled ? 'text-muted-foreground/60' : optionClass]\"\n :aria-selected=\"option.value === value\" :disabled=\"option.disabled\" :data-text-value=\"option.textValue ?? String(option.label)\" @click=\"select(option.value)\">\n <span class=\"modo-morph-select__option-text\"><slot name=\"option\" :option=\"option\" :selected=\"option.value === value\"><span class=\"truncate\"><RenderContent :content=\"option.label\" /></span><span v-if=\"option.description\" class=\"modo-morph-select__option-desc\"><RenderContent :content=\"option.description\" /></span></slot></span>\n <CheckIcon v-if=\"option.value === value\" :class=\"['modo-morph-select__check shrink-0', checkClass]\" aria-hidden=\"true\" />\n </button>\n </div>\n <p v-if=\"!shown.length\" role=\"status\" class=\"modo-morph-select__empty text-caption text-muted-foreground text-center\">{{ emptyLabel }}</p>\n <div v-if=\"phase === 'closing'\" class=\"modo-morph-select-ghost\" aria-hidden=\"true\"><span ref=\"ghost\" class=\"modo-morph-select-ghost__inner\"><RenderContent :content=\"options.find(option => option.value === value)?.label\" /></span></div>\n </div>\n </Teleport>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWA,MAAM,QAAQ;EACd,MAAM,EAAE,SAAS,SAAS,OAAO,OAAO,SAAS,QAAQ,QAAQ,SAAS,cAAc,YAAY,QAAQ,SAAS,2BAAA,gBAAe;EACpI,MAAM,MAAM,sBAAA,eAAc;EAC1B,MAAM,eAAA,GAAA,IAAA,gBAA6B,MAAM,qBAAqB,IAAI,MAAM,YAAY,kBAAiB;EACrG,MAAM,cAAA,GAAA,IAAA,gBAA4B,MAAM,gBAAgB,IAAI,MAAM,YAAY,MAAK;EAEnF,MAAM,eAAuC;GAC3C,SAAS;GACT,SAAS;GACT,QAAQ;GACR,SAAS;GACT,SAAS;GACX;EACA,MAAM,cAAsC;GAC1C,SAAS;GACT,SAAS;GACT,QAAQ;GACR,SAAS;GACT,SAAS;GACX;EACA,MAAM,eAAA,GAAA,IAAA,gBAA6B,aAAa,WAAW,UAAU,aAAa,QAAO;EACz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
15
  "data-modo-color",
15
16
  "inert"
16
17
  ];
@@ -34,7 +35,7 @@ var _hoisted_6 = { class: "modo-morph-select__option-text" };
34
35
  var _hoisted_7 = { class: "truncate" };
35
36
  var _hoisted_8 = {
36
37
  key: 0,
37
- class: "text-caption text-muted-foreground font-normal"
38
+ class: "modo-morph-select__option-desc"
38
39
  };
39
40
  var _hoisted_9 = {
40
41
  key: 1,
@@ -177,6 +178,7 @@ var MorphSelectContent_vue_vue_type_script_setup_true_lang_default = /* @__PURE_
177
178
  "data-modo-morph-layer": "",
178
179
  "data-modo-phase": unref(phase),
179
180
  "data-modo-theme": unref(scopedTheme),
181
+ "data-modo-radius": unref(radius),
180
182
  "data-modo-color": unref(stateColor),
181
183
  inert: unref(phase) === "closing",
182
184
  style: normalizeStyle([unref(providerStyle), { position: "fixed" }]),
@@ -1 +1 @@
1
- {"version":3,"file":"MorphSelectContent.vue_vue_type_script_setup_true_lang.mjs","names":[],"sources":["../../../../src/components/forms/morph-select/MorphSelectContent.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, nextTick, onBeforeUnmount, ref, watch } from 'vue'\nimport type { MorphSelectContentProps } from '../../../interfaces/forms/MorphSelect.interface'\nimport { useTeleportedModoTheme } from '../../../composables/useTeleportedModoTheme'\nimport { useModoLocale } from '../../../composables/useModoConfig'\nimport { MENU_PRESET, runMorph } from '../../../utils/morph/morphEngine'\nimport { attachCloseScrub, isTopMorphLayer, resolvePlacement } from '../../../utils/morph/morphHelpers'\nimport { CheckIcon } from '@heroicons/vue/24/outline'\nimport RenderContent from '../../../utils/RenderContent'\nimport { useMorphSelect } from './MorphSelectContext'\nimport { useMorphSelectKeyboard } from './useMorphSelectKeyboard'\nconst props = withDefaults(defineProps<MorphSelectContentProps>(), { side: 'auto', align: 'auto' })\nconst { fieldId, options, value, phase, trigger, button, select, setOpen, restoreFocus, stateColor, radius, size } = useMorphSelect()\nconst loc = useModoLocale()\nconst searchLabel = computed(() => props.searchPlaceholder ?? loc.value.morphSelect.searchPlaceholder)\nconst emptyLabel = computed(() => props.emptyMessage ?? loc.value.morphSelect.empty)\n// Same option surfaces and check colors as the native Select, per state color.\nconst OPTION_HOVER: Record<string, string> = {\n default: 'hover:bg-muted focus-visible:bg-muted',\n primary: 'hover:bg-primary/10 focus-visible:bg-primary/10',\n danger: 'hover:bg-destructive/10 focus-visible:bg-destructive/10',\n success: 'hover:bg-success/10 focus-visible:bg-success/10',\n warning: 'hover:bg-warning/10 focus-visible:bg-warning/10',\n}\nconst CHECK_COLOR: Record<string, string> = {\n default: 'text-foreground',\n primary: 'text-primary',\n danger: 'text-destructive',\n success: 'text-success',\n warning: 'text-warning',\n}\nconst optionClass = computed(() => OPTION_HOVER[stateColor.value] ?? OPTION_HOVER.default)\nconst checkClass = computed(() => CHECK_COLOR[stateColor.value] ?? CHECK_COLOR.default)\nconst panel = ref<HTMLElement | null>(null), ghost = ref<HTMLElement | null>(null)\nconst filter = ref('')\nconst shown = computed(() => options.value.filter(option => (option.textValue ?? String(option.label)).toLocaleLowerCase().includes(filter.value.toLocaleLowerCase())))\nconst { scopedTheme, providerStyle } = useTeleportedModoTheme({ radius, size })\nconst key = useMorphSelectKeyboard(panel, () => setOpen(false))\nfunction position() {\n const p = panel.value, t = trigger.value\n if (!p || !t) return\n const rect = t.getBoundingClientRect()\n p.style.width = `${rect.width}px`\n if (button.value) { const cs = getComputedStyle(button.value); p.style.setProperty('--modo-morph-select-ghost-px', cs.paddingLeft); p.style.setProperty('--modo-morph-select-ghost-fs', cs.fontSize) }\n const pos = resolvePlacement(rect, { width: p.offsetWidth, height: p.offsetHeight }, { width: innerWidth, height: innerHeight }, props.side, props.align)\n p.style.left = `${pos.left}px`; p.style.top = `${pos.top}px`\n p.style.transformOrigin = `${pos.align === 'end' ? '100%' : pos.align === 'center' ? '50%' : '0%'} ${pos.side === 'top' ? '100%' : '0%'}`\n}\nwatch(phase, async (current, previous, cleanup) => {\n let cancelled = false\n cleanup(() => { cancelled = true; panel.value?.getAnimations?.().forEach(animation => animation.cancel()) })\n if (current === 'closed') {\n filter.value = ''\n if (previous !== 'closed' && restoreFocus.value) button.value?.focus()\n return\n }\n await nextTick(); if (cancelled) return\n position()\n const p = panel.value\n if (!p) return\n if (current === 'opening' || current === 'closing') {\n runMorph({ panel: p, trigger: trigger.value, ghost: ghost.value, preset: MENU_PRESET, direction: current === 'opening' ? 'open' : 'close', onFinish: () => { if (!cancelled) phase.value = current === 'opening' ? 'open' : 'closed' } })\n } else if (current === 'open') {\n (props.searchable ? p.querySelector<HTMLElement>('input') : p.querySelector<HTMLElement>('[role=\"option\"][aria-selected=\"true\"]:not([disabled])') ?? p.querySelector<HTMLElement>('[role=\"option\"]:not([disabled])') ?? p)?.focus()\n }\n}, { immediate: true })\nwatch([() => phase.value === 'open', panel], ([active, el], _, cleanup) => {\n if (!active || !el || !trigger.value) return\n const stop = attachCloseScrub(el, trigger.value, MENU_PRESET, () => setOpen(false))\n cleanup(stop)\n}, { flush: 'post' })\nwatch(() => phase.value === 'opening' || phase.value === 'open', (active, _, cleanup) => {\n if (!active) return\n function outside(event: PointerEvent) { const p = panel.value, target = event.target as Node; if (p && isTopMorphLayer(p) && !p.contains(target) && !trigger.value?.contains(target)) setOpen(false, false) }\n function scroll(event: Event) { if (!panel.value?.contains(event.target as Node)) setOpen(false, false) }\n function resize() { setOpen(false) }\n document.addEventListener('pointerdown', outside); document.addEventListener('scroll', scroll, true); window.addEventListener('resize', resize)\n cleanup(() => { document.removeEventListener('pointerdown', outside); document.removeEventListener('scroll', scroll, true); window.removeEventListener('resize', resize) })\n})\nwatch([filter, () => props.side, () => props.align, () => options.value.length], () => nextTick(position))\nonBeforeUnmount(() => panel.value?.getAnimations?.().forEach(animation => animation.cancel()))\n</script>\n<template>\n <Teleport to=\"body\">\n <div v-if=\"phase !== 'closed'\" ref=\"panel\" tabindex=\"-1\" class=\"modo-morph-select-panel text-foreground\" data-modo-morph-select-panel=\"\" data-modo-morph-layer=\"\"\n :data-modo-phase=\"phase\" :data-modo-theme=\"scopedTheme\" :data-modo-color=\"stateColor\" :inert=\"phase === 'closing'\" :style=\"[providerStyle, { position: 'fixed' }]\" @keydown=\"key\">\n <div v-if=\"searchable\" class=\"modo-morph-select__search\">\n <input v-model=\"filter\" type=\"text\" autocomplete=\"off\" spellcheck=\"false\" :placeholder=\"searchLabel\" :aria-label=\"searchLabel\" :aria-controls=\"`${fieldId}-listbox`\"\n class=\"modo-morph-select__search-input w-full border border-input bg-transparent text-foreground placeholder:text-muted-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring/60\" />\n </div>\n <div :id=\"`${fieldId}-listbox`\" role=\"listbox\" :aria-labelledby=\"fieldId\" class=\"modo-morph-select__list\">\n <button v-for=\"option in shown\" :key=\"option.value\" type=\"button\" role=\"option\" tabindex=\"-1\"\n :class=\"['modo-morph-select__option outline-none', option.value === value ? 'font-medium' : '', option.disabled ? 'text-muted-foreground/60' : optionClass]\"\n :aria-selected=\"option.value === value\" :disabled=\"option.disabled\" :data-text-value=\"option.textValue ?? String(option.label)\" @click=\"select(option.value)\">\n <span class=\"modo-morph-select__option-text\"><slot name=\"option\" :option=\"option\" :selected=\"option.value === value\"><span class=\"truncate\"><RenderContent :content=\"option.label\" /></span><span v-if=\"option.description\" class=\"text-caption text-muted-foreground font-normal\"><RenderContent :content=\"option.description\" /></span></slot></span>\n <CheckIcon v-if=\"option.value === value\" :class=\"['modo-morph-select__check shrink-0', checkClass]\" aria-hidden=\"true\" />\n </button>\n </div>\n <p v-if=\"!shown.length\" role=\"status\" class=\"modo-morph-select__empty text-caption text-muted-foreground text-center\">{{ emptyLabel }}</p>\n <div v-if=\"phase === 'closing'\" class=\"modo-morph-select-ghost\" aria-hidden=\"true\"><span ref=\"ghost\" class=\"modo-morph-select-ghost__inner\"><RenderContent :content=\"options.find(option => option.value === value)?.label\" /></span></div>\n </div>\n </Teleport>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AnB,mBAA6I,QAA7I,YAA6I,CAAtD,YAA+C,MAAA,cAAA,EAAA,EAA/B,SAAS,OAAO,aAAA,EAAA,MAAA,GAAA,CAAA,UAAA,CAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA,CAAA,CAAA,CAAA,CAAA,EAClS,OAAO,UAAU,MAAA,MAAK,IAAA,WAAA,EAAvC,YAAyH,MAAA,UAAA,EAAA;;MAA/E,OAAK,eAAA,CAAA,qCAAwC,WAAA,MAAU,CAAA;MAAG,eAAY;;;KAG1G,MAAA,MAAM,UAAA,WAAA,EAAhB,mBAA0I,KAA1I,YAA0I,gBAAjB,WAAA,MAAU,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA;IACxH,MAAA,MAAK,KAAA,aAAA,WAAA,EAAhB,mBAA2O,OAA3O,aAA2O,CAAxJ,mBAAkJ,QAAA;cAAxI;KAAJ,KAAI;KAAQ,OAAM;QAAiC,YAAkF,MAAA,cAAA,EAAA,EAAlE,SAAS,MAAA,QAAO,CAAC,MAAK,WAAU,OAAO,UAAU,MAAA,MAAK,CAAA,EAAG,OAAA,EAAA,MAAA,GAAA,CAAA,UAAA,CAAA,CAAA,EAAA,IAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA"}
1
+ {"version":3,"file":"MorphSelectContent.vue_vue_type_script_setup_true_lang.mjs","names":[],"sources":["../../../../src/components/forms/morph-select/MorphSelectContent.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, nextTick, onBeforeUnmount, ref, watch } from 'vue'\nimport type { MorphSelectContentProps } from '../../../interfaces/forms/MorphSelect.interface'\nimport { useTeleportedModoTheme } from '../../../composables/useTeleportedModoTheme'\nimport { useModoLocale } from '../../../composables/useModoConfig'\nimport { MENU_PRESET, runMorph } from '../../../utils/morph/morphEngine'\nimport { attachCloseScrub, isTopMorphLayer, resolvePlacement } from '../../../utils/morph/morphHelpers'\nimport { CheckIcon } from '@heroicons/vue/24/outline'\nimport RenderContent from '../../../utils/RenderContent'\nimport { useMorphSelect } from './MorphSelectContext'\nimport { useMorphSelectKeyboard } from './useMorphSelectKeyboard'\nconst props = withDefaults(defineProps<MorphSelectContentProps>(), { side: 'auto', align: 'auto' })\nconst { fieldId, options, value, phase, trigger, button, select, setOpen, restoreFocus, stateColor, radius, size } = useMorphSelect()\nconst loc = useModoLocale()\nconst searchLabel = computed(() => props.searchPlaceholder ?? loc.value.morphSelect.searchPlaceholder)\nconst emptyLabel = computed(() => props.emptyMessage ?? loc.value.morphSelect.empty)\n// Same option surfaces and check colors as the native Select, per state color.\nconst OPTION_HOVER: Record<string, string> = {\n default: 'hover:bg-muted focus-visible:bg-muted',\n primary: 'hover:bg-primary/10 focus-visible:bg-primary/10',\n danger: 'hover:bg-destructive/10 focus-visible:bg-destructive/10',\n success: 'hover:bg-success/10 focus-visible:bg-success/10',\n warning: 'hover:bg-warning/10 focus-visible:bg-warning/10',\n}\nconst CHECK_COLOR: Record<string, string> = {\n default: 'text-foreground',\n primary: 'text-primary',\n danger: 'text-destructive',\n success: 'text-success',\n warning: 'text-warning',\n}\nconst optionClass = computed(() => OPTION_HOVER[stateColor.value] ?? OPTION_HOVER.default)\nconst checkClass = computed(() => CHECK_COLOR[stateColor.value] ?? CHECK_COLOR.default)\nconst panel = ref<HTMLElement | null>(null), ghost = ref<HTMLElement | null>(null)\nconst filter = ref('')\nconst shown = computed(() => options.value.filter(option => (option.textValue ?? String(option.label)).toLocaleLowerCase().includes(filter.value.toLocaleLowerCase())))\nconst { scopedTheme, providerStyle } = useTeleportedModoTheme({ radius, size })\nconst key = useMorphSelectKeyboard(panel, () => setOpen(false))\nfunction position() {\n const p = panel.value, t = trigger.value\n if (!p || !t) return\n const rect = t.getBoundingClientRect()\n p.style.width = `${rect.width}px`\n if (button.value) { const cs = getComputedStyle(button.value); p.style.setProperty('--modo-morph-select-ghost-px', cs.paddingLeft); p.style.setProperty('--modo-morph-select-ghost-fs', cs.fontSize) }\n const pos = resolvePlacement(rect, { width: p.offsetWidth, height: p.offsetHeight }, { width: innerWidth, height: innerHeight }, props.side, props.align)\n p.style.left = `${pos.left}px`; p.style.top = `${pos.top}px`\n p.style.transformOrigin = `${pos.align === 'end' ? '100%' : pos.align === 'center' ? '50%' : '0%'} ${pos.side === 'top' ? '100%' : '0%'}`\n}\nwatch(phase, async (current, previous, cleanup) => {\n let cancelled = false\n cleanup(() => { cancelled = true; panel.value?.getAnimations?.().forEach(animation => animation.cancel()) })\n if (current === 'closed') {\n filter.value = ''\n if (previous !== 'closed' && restoreFocus.value) button.value?.focus()\n return\n }\n await nextTick(); if (cancelled) return\n position()\n const p = panel.value\n if (!p) return\n if (current === 'opening' || current === 'closing') {\n runMorph({ panel: p, trigger: trigger.value, ghost: ghost.value, preset: MENU_PRESET, direction: current === 'opening' ? 'open' : 'close', onFinish: () => { if (!cancelled) phase.value = current === 'opening' ? 'open' : 'closed' } })\n } else if (current === 'open') {\n (props.searchable ? p.querySelector<HTMLElement>('input') : p.querySelector<HTMLElement>('[role=\"option\"][aria-selected=\"true\"]:not([disabled])') ?? p.querySelector<HTMLElement>('[role=\"option\"]:not([disabled])') ?? p)?.focus()\n }\n}, { immediate: true })\nwatch([() => phase.value === 'open', panel], ([active, el], _, cleanup) => {\n if (!active || !el || !trigger.value) return\n const stop = attachCloseScrub(el, trigger.value, MENU_PRESET, () => setOpen(false))\n cleanup(stop)\n}, { flush: 'post' })\nwatch(() => phase.value === 'opening' || phase.value === 'open', (active, _, cleanup) => {\n if (!active) return\n function outside(event: PointerEvent) { const p = panel.value, target = event.target as Node; if (p && isTopMorphLayer(p) && !p.contains(target) && !trigger.value?.contains(target)) setOpen(false, false) }\n function scroll(event: Event) { if (!panel.value?.contains(event.target as Node)) setOpen(false, false) }\n function resize() { setOpen(false) }\n document.addEventListener('pointerdown', outside); document.addEventListener('scroll', scroll, true); window.addEventListener('resize', resize)\n cleanup(() => { document.removeEventListener('pointerdown', outside); document.removeEventListener('scroll', scroll, true); window.removeEventListener('resize', resize) })\n})\nwatch([filter, () => props.side, () => props.align, () => options.value.length], () => nextTick(position))\nonBeforeUnmount(() => panel.value?.getAnimations?.().forEach(animation => animation.cancel()))\n</script>\n<template>\n <Teleport to=\"body\">\n <div v-if=\"phase !== 'closed'\" ref=\"panel\" tabindex=\"-1\" class=\"modo-morph-select-panel text-foreground\" data-modo-morph-select-panel=\"\" data-modo-morph-layer=\"\"\n :data-modo-phase=\"phase\" :data-modo-theme=\"scopedTheme\" :data-modo-radius=\"radius\" :data-modo-color=\"stateColor\" :inert=\"phase === 'closing'\" :style=\"[providerStyle, { position: 'fixed' }]\" @keydown=\"key\">\n <div v-if=\"searchable\" class=\"modo-morph-select__search\">\n <input v-model=\"filter\" type=\"text\" autocomplete=\"off\" spellcheck=\"false\" :placeholder=\"searchLabel\" :aria-label=\"searchLabel\" :aria-controls=\"`${fieldId}-listbox`\"\n class=\"modo-morph-select__search-input w-full border border-input bg-transparent text-foreground placeholder:text-muted-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring/60\" />\n </div>\n <div :id=\"`${fieldId}-listbox`\" role=\"listbox\" :aria-labelledby=\"fieldId\" class=\"modo-morph-select__list\">\n <button v-for=\"option in shown\" :key=\"option.value\" type=\"button\" role=\"option\" tabindex=\"-1\"\n :class=\"['modo-morph-select__option outline-none', option.value === value ? 'font-medium' : '', option.disabled ? 'text-muted-foreground/60' : optionClass]\"\n :aria-selected=\"option.value === value\" :disabled=\"option.disabled\" :data-text-value=\"option.textValue ?? String(option.label)\" @click=\"select(option.value)\">\n <span class=\"modo-morph-select__option-text\"><slot name=\"option\" :option=\"option\" :selected=\"option.value === value\"><span class=\"truncate\"><RenderContent :content=\"option.label\" /></span><span v-if=\"option.description\" class=\"modo-morph-select__option-desc\"><RenderContent :content=\"option.description\" /></span></slot></span>\n <CheckIcon v-if=\"option.value === value\" :class=\"['modo-morph-select__check shrink-0', checkClass]\" aria-hidden=\"true\" />\n </button>\n </div>\n <p v-if=\"!shown.length\" role=\"status\" class=\"modo-morph-select__empty text-caption text-muted-foreground text-center\">{{ emptyLabel }}</p>\n <div v-if=\"phase === 'closing'\" class=\"modo-morph-select-ghost\" aria-hidden=\"true\"><span ref=\"ghost\" class=\"modo-morph-select-ghost__inner\"><RenderContent :content=\"options.find(option => option.value === value)?.label\" /></span></div>\n </div>\n </Teleport>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWA,MAAM,QAAQ;EACd,MAAM,EAAE,SAAS,SAAS,OAAO,OAAO,SAAS,QAAQ,QAAQ,SAAS,cAAc,YAAY,QAAQ,SAAS,gBAAe;EACpI,MAAM,MAAM,eAAc;EAC1B,MAAM,cAAc,eAAe,MAAM,qBAAqB,IAAI,MAAM,YAAY,kBAAiB;EACrG,MAAM,aAAa,eAAe,MAAM,gBAAgB,IAAI,MAAM,YAAY,MAAK;EAEnF,MAAM,eAAuC;GAC3C,SAAS;GACT,SAAS;GACT,QAAQ;GACR,SAAS;GACT,SAAS;GACX;EACA,MAAM,cAAsC;GAC1C,SAAS;GACT,SAAS;GACT,QAAQ;GACR,SAAS;GACT,SAAS;GACX;EACA,MAAM,cAAc,eAAe,aAAa,WAAW,UAAU,aAAa,QAAO;EACzF,MAAM,aAAa,eAAe,YAAY,WAAW,UAAU,YAAY,QAAO;EACtF,MAAM,QAAQ,IAAwB,KAAK,EAAE,QAAQ,IAAwB,KAAI;EACjF,MAAM,SAAS,IAAI,GAAE;EACrB,MAAM,QAAQ,eAAe,QAAQ,MAAM,QAAO,YAAW,OAAO,aAAa,OAAO,OAAO,MAAM,EAAE,mBAAmB,CAAC,SAAS,OAAO,MAAM,mBAAmB,CAAC,CAAC,CAAA;EACtK,MAAM,EAAE,aAAa,kBAAkB,uBAAuB;GAAE;GAAQ;GAAM,CAAA;EAC9E,MAAM,MAAM,uBAAuB,aAAa,QAAQ,MAAM,CAAA;EAC9D,SAAS,WAAW;GAClB,MAAM,IAAI,MAAM,OAAO,IA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AC,OAAO,MAAK;SAC3J,mBAAuU,QAAvU,YAAuU,CAA1R,WAAmR,KAAA,QAAA,UAAA;MAAtP;MAAS,UAAU,OAAO,UAAU,MAAA,MAAK;cAA6M,CAA3M,mBAAuE,QAAvE,YAAuE,CAAhD,YAAyC,MAAA,cAAA,EAAA,EAAzB,SAAS,OAAO,OAAA,EAAA,MAAA,GAAA,CAAA,UAAA,CAAA,CAAA,CAAA,EAA4B,OAAO,eAAA,WAAA,EAAnB,mBAA6H,QAA7H,YAA6H,CAAtD,YAA+C,MAAA,cAAA,EAAA,EAA/B,SAAS,OAAO,aAAA,EAAA,MAAA,GAAA,CAAA,UAAA,CAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA,CAAA,CAAA,CAAA,CAAA,EAClR,OAAO,UAAU,MAAA,MAAK,IAAA,WAAA,EAAvC,YAAyH,MAAA,UAAA,EAAA;;MAA/E,OAAK,eAAA,CAAA,qCAAwC,WAAA,MAAU,CAAA;MAAG,eAAY;;;KAG1G,MAAA,MAAM,UAAA,WAAA,EAAhB,mBAA0I,KAA1I,YAA0I,gBAAjB,WAAA,MAAU,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA;IACxH,MAAA,MAAK,KAAA,aAAA,WAAA,EAAhB,mBAA2O,OAA3O,aAA2O,CAAxJ,mBAAkJ,QAAA;cAAxI;KAAJ,KAAI;KAAQ,OAAM;QAAiC,YAAkF,MAAA,cAAA,EAAA,EAAlE,SAAS,MAAA,QAAO,CAAC,MAAK,WAAU,OAAO,UAAU,MAAA,MAAK,CAAA,EAAG,OAAA,EAAA,MAAA,GAAA,CAAA,UAAA,CAAA,CAAA,EAAA,IAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA"}
@@ -1 +1 @@
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, value, options, 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(() => options.value.find(option => option.value === value.value))\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-variant=\"variant\">\n <label v-if=\"label\" :for=\"fieldId\" class=\"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 :class=\"['modo-morph-select__value min-w-0 flex-1 truncate', selected ? 'text-foreground' : 'text-muted-foreground']\" :data-modo-placeholder=\"selected ? undefined : ''\">\n <slot :option=\"selected\"><RenderContent :content=\"selected?.label ?? placeholder ?? loc.morphSelect.placeholder\" /></slot>\n </span>\n <ChevronDownIcon 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, value, options, 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(() => options.value.find(option => option.value === value.value))\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 :class=\"['modo-morph-select__value min-w-0 flex-1 truncate', selected ? 'text-foreground' : 'text-muted-foreground']\" :data-modo-placeholder=\"selected ? undefined : ''\">\n <slot :option=\"selected\"><RenderContent :content=\"selected?.label ?? placeholder ?? loc.morphSelect.placeholder\" /></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, value, options, 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(() => options.value.find(option => option.value === value.value))\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-variant=\"variant\">\n <label v-if=\"label\" :for=\"fieldId\" class=\"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 :class=\"['modo-morph-select__value min-w-0 flex-1 truncate', selected ? 'text-foreground' : 'text-muted-foreground']\" :data-modo-placeholder=\"selected ? undefined : ''\">\n <slot :option=\"selected\"><RenderContent :content=\"selected?.label ?? placeholder ?? loc.morphSelect.placeholder\" /></slot>\n </span>\n <ChevronDownIcon 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, value, options, 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(() => options.value.find(option => option.value === value.value))\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 :class=\"['modo-morph-select__value min-w-0 flex-1 truncate', selected ? 'text-foreground' : 'text-muted-foreground']\" :data-modo-placeholder=\"selected ? undefined : ''\">\n <slot :option=\"selected\"><RenderContent :content=\"selected?.label ?? placeholder ?? loc.morphSelect.placeholder\" /></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":""}
@@ -7,7 +7,11 @@ const require_MorphSelectContext = require("./MorphSelectContext.cjs");
7
7
  let vue = require("vue");
8
8
  let _heroicons_vue_24_outline = require("@heroicons/vue/24/outline");
9
9
  //#region src/components/forms/morph-select/MorphSelectTrigger.vue?vue&type=script&setup=true&lang.ts
10
- var _hoisted_1 = ["data-modo-size", "data-modo-variant"];
10
+ var _hoisted_1 = [
11
+ "data-modo-size",
12
+ "data-modo-radius",
13
+ "data-modo-variant"
14
+ ];
11
15
  var _hoisted_2 = ["for"];
12
16
  var _hoisted_3 = {
13
17
  key: 0,
@@ -68,15 +72,16 @@ var MorphSelectTrigger_vue_vue_type_script_setup_true_lang_default = /* @__PURE_
68
72
  }
69
73
  return (_ctx, _cache) => {
70
74
  return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
71
- class: (0, vue.normalizeClass)(["modo-morph-select flex flex-col gap-1.5", (0, vue.unref)(fullWidth) ? "w-full" : "inline-flex"]),
75
+ class: (0, vue.normalizeClass)(["modo-morph-select flex flex-col", (0, vue.unref)(fullWidth) ? "w-full" : "inline-flex"]),
72
76
  "data-modo-morph-select": "",
73
77
  "data-modo-size": (0, vue.unref)(size),
78
+ "data-modo-radius": (0, vue.unref)(radius),
74
79
  "data-modo-variant": __props.variant
75
80
  }, [
76
81
  (0, vue.unref)(label) ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("label", {
77
82
  key: 0,
78
83
  for: (0, vue.unref)(fieldId),
79
- class: "text-caption font-medium text-foreground"
84
+ class: "modo-morph-select__label"
80
85
  }, [(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),
81
86
  (0, vue.createElementVNode)("div", {
82
87
  ref_key: "trigger",
@@ -117,13 +122,13 @@ var MorphSelectTrigger_vue_vue_type_script_setup_true_lang_default = /* @__PURE_
117
122
  class: (0, vue.normalizeClass)(["modo-morph-select__value min-w-0 flex-1 truncate", selected.value ? "text-foreground" : "text-muted-foreground"]),
118
123
  "data-modo-placeholder": selected.value ? void 0 : ""
119
124
  }, [(0, vue.renderSlot)(_ctx.$slots, "default", { option: selected.value }, () => [(0, vue.createVNode)((0, vue.unref)(require_RenderContent.default), { content: selected.value?.label ?? __props.placeholder ?? (0, vue.unref)(loc).morphSelect.placeholder }, null, 8, ["content"])])], 10, _hoisted_6), (0, vue.createVNode)((0, vue.unref)(_heroicons_vue_24_outline.ChevronDownIcon), {
120
- "aria-hidden": "true",
121
- class: (0, vue.normalizeClass)([
125
+ class: (0, vue.normalizeClass)(["modo-morph-select__chevron", [
122
126
  "shrink-0 transition-transform duration-base ease-standard",
123
127
  affordanceIconClass.value,
124
128
  (0, vue.unref)(sz).icon,
125
129
  (0, vue.unref)(open) ? "rotate-180" : ""
126
- ])
130
+ ]]),
131
+ "aria-hidden": "true"
127
132
  }, null, 8, ["class"])], 16, _hoisted_5)], 10, _hoisted_4),
128
133
  (0, vue.unref)(hasError) && (0, vue.unref)(errorText) ? ((0, vue.openBlock)(), (0, vue.createBlock)(require_Typography.default, {
129
134
  key: 1,
@@ -1 +1 @@
1
- {"version":3,"file":"MorphSelectTrigger.vue_vue_type_script_setup_true_lang.cjs","names":["$attrs"],"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, value, options, 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(() => options.value.find(option => option.value === value.value))\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-variant=\"variant\">\n <label v-if=\"label\" :for=\"fieldId\" class=\"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 :class=\"['modo-morph-select__value min-w-0 flex-1 truncate', selected ? 'text-foreground' : 'text-muted-foreground']\" :data-modo-placeholder=\"selected ? undefined : ''\">\n <slot :option=\"selected\"><RenderContent :content=\"selected?.label ?? placeholder ?? loc.morphSelect.placeholder\" /></slot>\n </span>\n <ChevronDownIcon 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,OAAO,SAAS,UAAU,UAAU,UAAU,OAAO,WAAW,YAAY,WAAW,UAAU,YAC1G,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;GAA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A,OAAQ,QAAmG,EAAA,GAAA,IAAA,cAAA,GAAA,IAAA,OAAP,sBAAA,QAAA,EAAA,EAA1E,SAAS,SAAA,OAAU,SAAS,QAAA,gBAAA,GAAA,IAAA,OAAe,IAAG,CAAC,YAAY,aAAA,EAAA,MAAA,GAAA,CAAA,UAAA,CAAA,CAAA,CAAA,CAAA,EAAA,IAAA,WAAA,GAAA,GAAA,IAAA,cAAA,GAAA,IAAA,OAE+D,0BAAA,gBAAA,EAAA;KAApJ,eAAY;KAAQ,QAAA,GAAA,IAAA,gBAAK;MAAA;MAAgE,oBAAA;qBAAqB,GAAE,CAAC;qBAAM,KAAI,GAAA,eAAA;MAAA,CAAA;;mBAG9H,SAAQ,KAAA,GAAA,IAAA,OAAI,UAAS,KAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,aAAkG,mBAAA,SAAA;;KAA/F,KAAA,GAAA,IAAA,OAAI,QAAO;KAAE,SAAQ;KAAU,MAAK;KAAS,OAAM;KAAS,IAAG;;qCAAmB,EAAA,GAAA,IAAA,kBAAA,GAAA,IAAA,kBAAA,GAAA,IAAA,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"}
1
+ {"version":3,"file":"MorphSelectTrigger.vue_vue_type_script_setup_true_lang.cjs","names":["$attrs"],"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, value, options, 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(() => options.value.find(option => option.value === value.value))\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 :class=\"['modo-morph-select__value min-w-0 flex-1 truncate', selected ? 'text-foreground' : 'text-muted-foreground']\" :data-modo-placeholder=\"selected ? undefined : ''\">\n <slot :option=\"selected\"><RenderContent :content=\"selected?.label ?? placeholder ?? loc.morphSelect.placeholder\" /></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,OAAO,SAAS,UAAU,UAAU,UAAU,OAAO,WAAW,YAAY,WAAW,UAA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A,kBAAA,GAAA,IAAA,kBAAA,GAAA,IAAA,OAAb,WAAU,CAAA,EAAA,EAAA,CAAA,CAAA"}
@@ -6,7 +6,11 @@ import { useMorphSelect } from "./MorphSelectContext.mjs";
6
6
  import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeProps, normalizeClass, onBeforeUnmount, openBlock, ref, renderSlot, toDisplayString, unref, watch, withCtx } from "vue";
7
7
  import { ChevronDownIcon } from "@heroicons/vue/24/outline";
8
8
  //#region src/components/forms/morph-select/MorphSelectTrigger.vue?vue&type=script&setup=true&lang.ts
9
- var _hoisted_1 = ["data-modo-size", "data-modo-variant"];
9
+ var _hoisted_1 = [
10
+ "data-modo-size",
11
+ "data-modo-radius",
12
+ "data-modo-variant"
13
+ ];
10
14
  var _hoisted_2 = ["for"];
11
15
  var _hoisted_3 = {
12
16
  key: 0,
@@ -67,15 +71,16 @@ var MorphSelectTrigger_vue_vue_type_script_setup_true_lang_default = /* @__PURE_
67
71
  }
68
72
  return (_ctx, _cache) => {
69
73
  return openBlock(), createElementBlock("div", {
70
- class: normalizeClass(["modo-morph-select flex flex-col gap-1.5", unref(fullWidth) ? "w-full" : "inline-flex"]),
74
+ class: normalizeClass(["modo-morph-select flex flex-col", unref(fullWidth) ? "w-full" : "inline-flex"]),
71
75
  "data-modo-morph-select": "",
72
76
  "data-modo-size": unref(size),
77
+ "data-modo-radius": unref(radius),
73
78
  "data-modo-variant": __props.variant
74
79
  }, [
75
80
  unref(label) ? (openBlock(), createElementBlock("label", {
76
81
  key: 0,
77
82
  for: unref(fieldId),
78
- class: "text-caption font-medium text-foreground"
83
+ class: "modo-morph-select__label"
79
84
  }, [createTextVNode(toDisplayString(unref(label)) + " ", 1), unref(required) ? (openBlock(), createElementBlock("span", _hoisted_3, "*")) : createCommentVNode("", true)], 8, _hoisted_2)) : createCommentVNode("", true),
80
85
  createElementVNode("div", {
81
86
  ref_key: "trigger",
@@ -116,13 +121,13 @@ var MorphSelectTrigger_vue_vue_type_script_setup_true_lang_default = /* @__PURE_
116
121
  class: normalizeClass(["modo-morph-select__value min-w-0 flex-1 truncate", selected.value ? "text-foreground" : "text-muted-foreground"]),
117
122
  "data-modo-placeholder": selected.value ? void 0 : ""
118
123
  }, [renderSlot(_ctx.$slots, "default", { option: selected.value }, () => [createVNode(unref(RenderContent), { content: selected.value?.label ?? __props.placeholder ?? unref(loc).morphSelect.placeholder }, null, 8, ["content"])])], 10, _hoisted_6), createVNode(unref(ChevronDownIcon), {
119
- "aria-hidden": "true",
120
- class: normalizeClass([
124
+ class: normalizeClass(["modo-morph-select__chevron", [
121
125
  "shrink-0 transition-transform duration-base ease-standard",
122
126
  affordanceIconClass.value,
123
127
  unref(sz).icon,
124
128
  unref(open) ? "rotate-180" : ""
125
- ])
129
+ ]]),
130
+ "aria-hidden": "true"
126
131
  }, null, 8, ["class"])], 16, _hoisted_5)], 10, _hoisted_4),
127
132
  unref(hasError) && unref(errorText) ? (openBlock(), createBlock(Typography_default, {
128
133
  key: 1,