mood-ui 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/dist/components/data-display/calendar/AgendaView.cjs.map +1 -1
  2. package/dist/components/data-display/calendar/AgendaView.mjs.map +1 -1
  3. package/dist/components/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.cjs +4 -1
  4. package/dist/components/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  5. package/dist/components/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.mjs +4 -1
  6. package/dist/components/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  7. package/dist/components/data-display/calendar/DayView.cjs.map +1 -1
  8. package/dist/components/data-display/calendar/DayView.mjs.map +1 -1
  9. package/dist/components/data-display/calendar/DayView.vue_vue_type_script_setup_true_lang.cjs +7 -4
  10. package/dist/components/data-display/calendar/DayView.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  11. package/dist/components/data-display/calendar/DayView.vue_vue_type_script_setup_true_lang.mjs +7 -4
  12. package/dist/components/data-display/calendar/DayView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  13. package/dist/components/data-display/calendar/MonthView.cjs +1 -1
  14. package/dist/components/data-display/calendar/MonthView.cjs.map +1 -1
  15. package/dist/components/data-display/calendar/MonthView.mjs +1 -1
  16. package/dist/components/data-display/calendar/MonthView.mjs.map +1 -1
  17. package/dist/components/data-display/calendar/MonthView.vue_vue_type_script_setup_true_lang.cjs +8 -12
  18. package/dist/components/data-display/calendar/MonthView.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  19. package/dist/components/data-display/calendar/MonthView.vue_vue_type_script_setup_true_lang.mjs +8 -12
  20. package/dist/components/data-display/calendar/MonthView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  21. package/dist/components/data-display/calendar/Scheduler.cjs.map +1 -1
  22. package/dist/components/data-display/calendar/Scheduler.mjs.map +1 -1
  23. package/dist/components/data-display/calendar/Scheduler.vue_vue_type_script_setup_true_lang.cjs +7 -4
  24. package/dist/components/data-display/calendar/Scheduler.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  25. package/dist/components/data-display/calendar/Scheduler.vue_vue_type_script_setup_true_lang.mjs +7 -4
  26. package/dist/components/data-display/calendar/Scheduler.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  27. package/dist/components/data-display/calendar/WeekView.cjs.map +1 -1
  28. package/dist/components/data-display/calendar/WeekView.mjs.map +1 -1
  29. package/dist/components/data-display/calendar/WeekView.vue_vue_type_script_setup_true_lang.cjs +7 -4
  30. package/dist/components/data-display/calendar/WeekView.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  31. package/dist/components/data-display/calendar/WeekView.vue_vue_type_script_setup_true_lang.mjs +7 -4
  32. package/dist/components/data-display/calendar/WeekView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  33. package/dist/components/data-display/date-picker/DateTimePicker.cjs.map +1 -1
  34. package/dist/components/data-display/date-picker/DateTimePicker.mjs.map +1 -1
  35. package/dist/components/data-display/date-picker/DateTimePicker.vue_vue_type_script_setup_true_lang.cjs +1 -1
  36. package/dist/components/data-display/date-picker/DateTimePicker.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  37. package/dist/components/data-display/date-picker/DateTimePicker.vue_vue_type_script_setup_true_lang.mjs +1 -1
  38. package/dist/components/data-display/date-picker/DateTimePicker.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  39. package/dist/components/feedback/Drawer.cjs.map +1 -1
  40. package/dist/components/feedback/Drawer.mjs.map +1 -1
  41. package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.cjs +4 -9
  42. package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  43. package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.mjs +4 -9
  44. package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  45. package/dist/components/feedback/Modal.cjs.map +1 -1
  46. package/dist/components/feedback/Modal.mjs.map +1 -1
  47. package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.cjs +4 -9
  48. package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  49. package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.mjs +4 -9
  50. package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  51. package/dist/components/feedback/Tooltip.cjs.map +1 -1
  52. package/dist/components/feedback/Tooltip.mjs.map +1 -1
  53. package/dist/components/feedback/Tooltip.vue_vue_type_script_setup_true_lang.cjs +44 -17
  54. package/dist/components/feedback/Tooltip.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  55. package/dist/components/feedback/Tooltip.vue_vue_type_script_setup_true_lang.mjs +44 -17
  56. package/dist/components/feedback/Tooltip.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  57. package/dist/components/forms/Combobox.cjs.map +1 -1
  58. package/dist/components/forms/Combobox.mjs.map +1 -1
  59. package/dist/components/forms/Combobox.vue_vue_type_script_setup_true_lang.cjs +2 -2
  60. package/dist/components/forms/Combobox.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  61. package/dist/components/forms/Combobox.vue_vue_type_script_setup_true_lang.mjs +2 -2
  62. package/dist/components/forms/Combobox.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  63. package/dist/components/forms/PhoneInput.cjs.map +1 -1
  64. package/dist/components/forms/PhoneInput.mjs.map +1 -1
  65. package/dist/components/forms/PhoneInput.vue_vue_type_script_setup_true_lang.cjs +6 -1
  66. package/dist/components/forms/PhoneInput.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  67. package/dist/components/forms/PhoneInput.vue_vue_type_script_setup_true_lang.mjs +6 -1
  68. package/dist/components/forms/PhoneInput.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  69. package/dist/components/forms/SearchInput.cjs.map +1 -1
  70. package/dist/components/forms/SearchInput.mjs.map +1 -1
  71. package/dist/components/forms/SearchInput.vue_vue_type_script_setup_true_lang.cjs +8 -6
  72. package/dist/components/forms/SearchInput.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  73. package/dist/components/forms/SearchInput.vue_vue_type_script_setup_true_lang.mjs +8 -6
  74. package/dist/components/forms/SearchInput.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  75. package/dist/components/layout/PopoverPanel.cjs +1 -1
  76. package/dist/components/layout/PopoverPanel.cjs.map +1 -1
  77. package/dist/components/layout/PopoverPanel.mjs +1 -1
  78. package/dist/components/layout/PopoverPanel.mjs.map +1 -1
  79. package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.cjs +2 -2
  80. package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  81. package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.mjs +2 -2
  82. package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  83. package/dist/components/navigation/Switcher.cjs.map +1 -1
  84. package/dist/components/navigation/Switcher.mjs.map +1 -1
  85. package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.cjs +38 -40
  86. package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  87. package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.mjs +38 -40
  88. package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  89. package/dist/composables/eventColors.cjs +51 -27
  90. package/dist/composables/eventColors.cjs.map +1 -1
  91. package/dist/composables/eventColors.mjs +51 -27
  92. package/dist/composables/eventColors.mjs.map +1 -1
  93. package/dist/composables/useBodyScrollLock.cjs +44 -0
  94. package/dist/composables/useBodyScrollLock.cjs.map +1 -0
  95. package/dist/composables/useBodyScrollLock.mjs +43 -0
  96. package/dist/composables/useBodyScrollLock.mjs.map +1 -0
  97. package/dist/composables/useCalendarTheme.cjs +29 -8
  98. package/dist/composables/useCalendarTheme.cjs.map +1 -1
  99. package/dist/composables/useCalendarTheme.mjs +29 -8
  100. package/dist/composables/useCalendarTheme.mjs.map +1 -1
  101. package/dist/composables/usePopover.cjs +44 -12
  102. package/dist/composables/usePopover.cjs.map +1 -1
  103. package/dist/composables/usePopover.mjs +44 -12
  104. package/dist/composables/usePopover.mjs.map +1 -1
  105. package/dist/mood-ui.css +9 -9
  106. package/dist/types/composables/eventColors.d.ts +2 -2
  107. package/dist/types/composables/useBodyScrollLock.d.ts +19 -0
  108. package/dist/types/composables/useCalendarTheme.d.ts +2 -0
  109. package/dist/types/interfaces/data-display/calendar/AgendaView.interface.d.ts +5 -0
  110. package/dist/types/interfaces/data-display/calendar/DayView.interface.d.ts +5 -0
  111. package/dist/types/interfaces/data-display/calendar/MonthView.interface.d.ts +5 -0
  112. package/dist/types/interfaces/data-display/calendar/Scheduler.interface.d.ts +5 -0
  113. package/dist/types/interfaces/data-display/calendar/WeekView.interface.d.ts +5 -0
  114. package/dist/types/utils/cssLength.d.ts +5 -0
  115. package/dist/types/utils/tooltipArrow.d.ts +34 -0
  116. package/dist/utils/cssLength.cjs +13 -0
  117. package/dist/utils/cssLength.cjs.map +1 -0
  118. package/dist/utils/cssLength.mjs +13 -0
  119. package/dist/utils/cssLength.mjs.map +1 -0
  120. package/dist/utils/tooltipArrow.cjs +37 -0
  121. package/dist/utils/tooltipArrow.cjs.map +1 -0
  122. package/dist/utils/tooltipArrow.mjs +36 -0
  123. package/dist/utils/tooltipArrow.mjs.map +1 -0
  124. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"PhoneInput.cjs","names":[],"sources":["../../../src/components/forms/PhoneInput.vue"],"sourcesContent":["<template>\n <div :class=\"['flex flex-col gap-1.5', fullWidth ? 'w-full' : 'inline-flex']\">\n <!-- Label -->\n <label\n v-if=\"label\"\n :for=\"fieldId\"\n class=\"text-caption font-medium text-foreground\"\n >\n {{ label }}\n <span v-if=\"required\" aria-hidden=\"true\" class=\"text-destructive ml-0.5\"\n >*</span\n >\n </label>\n\n <!-- Unified field wrapper -->\n <div\n ref=\"wrapperEl\"\n :class=\"[\n 'modo-field-wrapper flex items-center overflow-hidden',\n wrapperVariantClasses,\n wrapperHeightClass,\n radiusClasses,\n fullWidth ? 'w-full' : '',\n isDisabled ? 'opacity-60 cursor-not-allowed' : '',\n ]\"\n >\n <!-- Country selector trigger -->\n <button\n ref=\"triggerRef\"\n type=\"button\"\n :disabled=\"isDisabled || readonly\"\n :aria-label=\"loc.phoneInput.selectCountry\"\n :aria-expanded=\"isOpen\"\n :aria-haspopup=\"'listbox'\"\n :class=\"[\n 'flex items-center self-stretch shrink-0 select-none',\n 'transition-colors duration-fast ease-standard',\n triggerPaddingClass,\n isDisabled || readonly ? 'cursor-not-allowed' : 'cursor-pointer',\n ]\"\n @click=\"onTriggerClick\"\n @keydown=\"onTriggerKeydown\"\n >\n <span\n aria-hidden=\"true\"\n :class=\"['leading-none shrink-0', flagSizeClass]\"\n >\n {{ selectedCountry ? countryFlag(selectedCountry.iso) : \"🌐\" }}\n </span>\n <span\n :class=\"[\n 'tabular-nums text-muted-foreground font-medium shrink-0',\n triggerTextClass,\n ]\"\n >\n +{{ selectedCountry?.dial ?? \"?\" }}\n </span>\n <ChevronDownIcon\n aria-hidden=\"true\"\n :class=\"[\n 'shrink-0 transition-transform duration-base ease-standard',\n affordanceIconClass,\n chevronSizeClass,\n isOpen ? 'rotate-180' : '',\n ]\"\n />\n </button>\n\n <!-- Vertical divider -->\n <div aria-hidden=\"true\" class=\"w-px self-stretch bg-border shrink-0\" />\n\n <!-- Phone number input -->\n <input\n :id=\"fieldId\"\n ref=\"inputRef\"\n type=\"tel\"\n inputmode=\"tel\"\n :value=\"localNumber\"\n :placeholder=\"placeholder ?? ''\"\n :disabled=\"isDisabled\"\n :readonly=\"readonly\"\n :required=\"required\"\n :name=\"name ? `${name}-local` : undefined\"\n :autocomplete=\"autocomplete ?? 'tel-national'\"\n :autofocus=\"autofocus\"\n :aria-label=\"!label ? (ariaLabel ?? undefined) : undefined\"\n :aria-invalid=\"hasError || undefined\"\n :aria-describedby=\"describedBy\"\n :aria-required=\"required || undefined\"\n :class=\"[\n 'modo-field-native flex-1 min-w-0 bg-transparent',\n 'text-foreground placeholder:text-muted-foreground',\n 'disabled:cursor-not-allowed',\n inputTextClass,\n inputPaddingClass,\n ]\"\n @input=\"onInput\"\n @change=\"onChange\"\n @focus=\"$emit('focus', $event)\"\n @blur=\"$emit('blur', $event)\"\n />\n\n <!-- Loading spinner -->\n <Loader\n v-if=\"loading\"\n :size=\"resolvedSize === 'large' ? 'medium' : 'small'\"\n :class=\"['shrink-0', affordanceIconClass]\"\n />\n </div>\n\n <!-- Hidden input carrying the full formatted value for form submission -->\n <input v-if=\"name\" type=\"hidden\" :name=\"name\" :value=\"currentFormValue\" />\n\n <!-- Error / helper text -->\n <div v-if=\"errorText || helperText\" class=\"flex items-start gap-2\">\n <Typography\n v-if=\"errorText\"\n :id=\"errorId\"\n variant=\"caption\"\n size=\"medium\"\n color=\"danger\"\n as=\"p\"\n >\n {{ errorText }}\n </Typography>\n <Typography\n v-else-if=\"helperText\"\n :id=\"helperId\"\n variant=\"caption\"\n size=\"medium\"\n color=\"muted\"\n as=\"p\"\n >\n {{ helperText }}\n </Typography>\n </div>\n\n <!-- Country dropdown -->\n <PopoverPanel\n :open=\"isOpen\"\n :style=\"mergedPanelStyle\"\n :radius=\"radius\"\n role=\"listbox\"\n :labelledBy=\"fieldId\"\n @update:panelRef=\"panelRef = $event\"\n >\n <div style=\"max-height: 296px\" class=\"flex flex-col\">\n <!-- Search input -->\n <div class=\"px-3 border-b border-border shrink-0\">\n <div class=\"flex items-center gap-2 h-7\">\n <MagnifyingGlassIcon\n class=\"w-4 h-4 shrink-0 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n <input\n ref=\"searchEl\"\n v-model=\"searchQuery\"\n type=\"text\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n :placeholder=\"loc.phoneInput.searchCountry\"\n class=\"modo-field-native flex-1 min-w-0 bg-transparent p-0 text-caption text-foreground placeholder:text-muted-foreground\"\n @keydown=\"onSearchKeydown\"\n />\n <Button\n v-if=\"searchQuery\"\n variant=\"text\"\n size=\"xs\"\n radius=\"full\"\n :icon=\"XMarkIcon\"\n :ariaLabel=\"loc.common.clear\"\n tabindex=\"-1\"\n :class=\"['shrink-0', affordanceActionClass]\"\n @click=\"searchQuery = ''\"\n />\n </div>\n </div>\n\n <!-- Countries list -->\n <ul\n ref=\"listEl\"\n role=\"listbox\"\n class=\"modo-stagger flex-1 overflow-y-auto w-full\"\n style=\"min-height: 2.5rem\"\n tabindex=\"-1\"\n >\n <li\n v-if=\"filteredCountries.length === 0\"\n class=\"px-3 py-4 text-caption text-muted-foreground text-center\"\n >\n {{ loc.phoneInput.noResults }}\n </li>\n <li\n v-for=\"(c, i) in filteredCountries\"\n :key=\"c.iso\"\n :id=\"optionId(c.iso)\"\n role=\"option\"\n :aria-selected=\"c.iso === activeIso\"\n :class=\"[\n 'flex items-center gap-2.5 px-3 py-2 text-body cursor-pointer select-none',\n 'transition-colors duration-fast ease-standard',\n ['text-foreground', optionHover],\n i === activeIndex ? optionSurface : '',\n c.iso === activeIso ? 'font-medium' : '',\n ]\"\n @pointerenter=\"activeIndex = i\"\n @click=\"selectCountry(c)\"\n >\n <span aria-hidden=\"true\" class=\"text-base leading-none shrink-0\">\n {{ countryFlag(c.iso) }}\n </span>\n <span class=\"flex-1 min-w-0 truncate text-foreground\">{{\n c.name\n }}</span>\n <span\n class=\"shrink-0 tabular-nums text-muted-foreground text-[11px]\"\n >\n +{{ c.dial }}\n </span>\n <CheckIcon\n v-if=\"c.iso === activeIso\"\n :class=\"['w-4 h-4 shrink-0', checkColorClass]\"\n aria-hidden=\"true\"\n />\n </li>\n </ul>\n </div>\n </PopoverPanel>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, nextTick, ref, useId, watch } from \"vue\";\nimport type { PhoneInput } from \"../../interfaces/forms/PhoneInput.interface\";\nimport {\n PHONE_COUNTRIES,\n countryFlag,\n findCountryByIso,\n type PhoneCountry,\n} from \"../../data/phoneCountries\";\nimport {\n useFieldState,\n useFieldClasses,\n FIELD_AFFORDANCE_ICON_BY_COLOR,\n FIELD_AFFORDANCE_ACTION_BY_COLOR,\n} from \"../../composables/useField\";\nimport { usePopover } from \"../../composables/usePopover\";\nimport {\n useResolvedSize,\n useSizeTokens,\n useModoLocale,\n} from \"../../composables/useModoConfig\";\nimport PopoverPanel from \"../layout/PopoverPanel.vue\";\nimport Typography from \"../data-display/Typography.vue\";\nimport Loader from \"../feedback/Loader.vue\";\nimport Button from \"./Button.vue\";\nimport {\n ChevronDownIcon,\n MagnifyingGlassIcon,\n XMarkIcon,\n CheckIcon,\n} from \"@heroicons/vue/24/outline\";\n\nconst loc = useModoLocale();\n\nconst emit = defineEmits<{\n \"update:modelValue\": [value: string];\n \"update:country\": [iso: string];\n change: [value: string];\n focus: [event: FocusEvent];\n blur: [event: FocusEvent];\n}>();\n\nconst props = withDefaults(defineProps<PhoneInput>(), {\n defaultCountry: \"US\",\n format: \"national\",\n variant: \"outline\",\n color: \"default\",\n disabled: false,\n readonly: false,\n required: false,\n loading: false,\n fullWidth: false,\n autofocus: false,\n});\n\nconst resolvedSize = useResolvedSize(() => props.size);\nconst sz = useSizeTokens(() => props.size);\n\n// ── Refs ──────────────────────────────────────────────────────────────────────\nconst inputRef = ref<HTMLInputElement | null>(null);\nconst searchEl = ref<HTMLInputElement | null>(null);\nconst listEl = ref<HTMLElement | null>(null);\nconst wrapperEl = ref<HTMLElement | null>(null);\nconst dropdownWidth = ref(\"\");\n\n// ── Internal state ────────────────────────────────────────────────────────────\nconst localNumber = ref(\"\");\nconst internalCountry = ref((props.defaultCountry ?? \"US\").toUpperCase());\n\n// ── Field state ───────────────────────────────────────────────────────────────\nconst {\n fieldId,\n radius,\n stateColor,\n hasError,\n isDisabled,\n errorId,\n helperId,\n describedBy,\n} = useFieldState(props, {\n componentName: \"PhoneInput\",\n idPrefix: \"modo-phone\",\n});\n\nconst { wrapperVariantClasses, radiusClasses } = useFieldClasses({\n variant: () => props.variant,\n stateColor,\n hasError,\n radius,\n forceFocus: () => isOpen.value,\n halo: () => props.halo,\n});\n\n// ── Country resolution ────────────────────────────────────────────────────────\nconst activeIso = computed(() =>\n (props.country !== undefined\n ? props.country\n : internalCountry.value\n ).toUpperCase(),\n);\nconst selectedCountry = computed(() => findCountryByIso(activeIso.value));\n\n// ── Format helpers ────────────────────────────────────────────────────────────\nfunction buildValue(local: string, dialCode: string): string {\n const fmt = props.format ?? \"national\";\n if (fmt === \"e164\") return `+${dialCode}${local.replace(/\\D/g, \"\")}`;\n if (fmt === \"international\") return `+${dialCode}${local}`;\n return local;\n}\n\nfunction extractNational(v: string | undefined, dialCode: string): string {\n if (!v) return \"\";\n const prefix = `+${dialCode}`;\n if (v.startsWith(prefix)) return v.slice(prefix.length);\n return v;\n}\n\nconst currentFormValue = computed(() =>\n selectedCountry.value\n ? buildValue(localNumber.value, selectedCountry.value.dial)\n : localNumber.value,\n);\n\n// Sync external modelValue → localNumber\nwatch(\n () => props.modelValue,\n (v) => {\n const dial = selectedCountry.value?.dial ?? \"\";\n const national = extractNational(v, dial);\n if (national !== localNumber.value) localNumber.value = national;\n },\n { immediate: true },\n);\n\n// ── Popover ───────────────────────────────────────────────────────────────────\nconst {\n triggerRef,\n panelRef,\n isOpen,\n panelStyle,\n open: openPopover,\n close: closePopover,\n toggle: togglePopover,\n} = usePopover({\n placement: \"bottom-start\",\n onOpen: () => {\n dropdownWidth.value = wrapperEl.value\n ? `${wrapperEl.value.getBoundingClientRect().width}px`\n : \"260px\";\n searchQuery.value = \"\";\n activeIndex.value = Math.max(\n 0,\n filteredCountries.value.findIndex((c) => c.iso === activeIso.value),\n );\n nextTick(() => {\n searchEl.value?.focus();\n scrollActiveIntoView();\n });\n },\n onClose: () => {\n searchQuery.value = \"\";\n activeIndex.value = -1;\n },\n});\n\nconst mergedPanelStyle = computed(() => ({\n ...panelStyle.value,\n ...(dropdownWidth.value ? { width: dropdownWidth.value } : {}),\n}));\n\n// ── Search + filtered list ────────────────────────────────────────────────────\nconst searchQuery = ref(\"\");\nconst activeIndex = ref(-1);\nconst autoListboxId = useId();\n\nconst optionId = (iso: string) =>\n `modo-phone-listbox-${autoListboxId}-opt-${iso}`;\n\nconst filteredCountries = computed<PhoneCountry[]>(() => {\n const q = searchQuery.value.trim().toLowerCase();\n if (!q) return PHONE_COUNTRIES as unknown as PhoneCountry[];\n return (PHONE_COUNTRIES as unknown as PhoneCountry[]).filter(\n (c) =>\n c.name.toLowerCase().includes(q) ||\n c.iso.toLowerCase().includes(q) ||\n c.dial.startsWith(q.replace(/^\\+/, \"\")),\n );\n});\n\nwatch(filteredCountries, (list) => {\n const idx = list.findIndex((c) => c.iso === activeIso.value);\n activeIndex.value = idx >= 0 ? idx : 0;\n});\n\n// ── Option styles ─────────────────────────────────────────────────────────────\nconst OPTION_SURFACE: Record<string, string> = {\n default: \"bg-muted\",\n primary: \"bg-primary/10\",\n danger: \"bg-destructive/10\",\n success: \"bg-success/10\",\n warning: \"bg-warning/10\",\n};\nconst OPTION_HOVER: Record<string, string> = {\n default: \"hover:bg-muted\",\n primary: \"hover:bg-primary/10\",\n danger: \"hover:bg-destructive/10\",\n success: \"hover:bg-success/10\",\n warning: \"hover:bg-warning/10\",\n};\nconst optionSurface = computed(\n () => OPTION_SURFACE[stateColor.value] ?? \"bg-muted\",\n);\nconst optionHover = computed(\n () => OPTION_HOVER[stateColor.value] ?? \"hover:bg-muted\",\n);\nconst CHECK_COLOR_BY_STATE: 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 checkColorClass = computed(\n () => CHECK_COLOR_BY_STATE[stateColor.value] ?? \"text-foreground\",\n);\nconst affordanceIconClass = computed(\n () =>\n FIELD_AFFORDANCE_ICON_BY_COLOR[stateColor.value] ?? \"text-muted-foreground\",\n);\nconst affordanceActionClass = computed(\n () =>\n FIELD_AFFORDANCE_ACTION_BY_COLOR[stateColor.value] ??\n \"text-muted-foreground hover:text-foreground\",\n);\n\n// ── Size classes ──────────────────────────────────────────────────────────────\nconst wrapperHeightClass = computed(() => {\n // sz.value.padX is e.g. \"px-2.5\" — convert to pr-* for the wrapper right edge\n const pr = sz.value.padX.replace(\"px-\", \"pr-\");\n return `${sz.value.control} ${pr}`;\n});\n\nconst triggerPaddingClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"pl-2.5 pr-1.5 gap-1\";\n case \"large\":\n return \"pl-4 pr-2 gap-1.5\";\n default:\n return \"pl-3 pr-2 gap-1\";\n }\n});\n\nconst flagSizeClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"text-sm\";\n case \"large\":\n return \"text-xl\";\n default:\n return \"text-base\";\n }\n});\n\nconst triggerTextClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"text-[11px]\";\n case \"large\":\n return \"text-body\";\n default:\n return \"text-caption\";\n }\n});\n\nconst chevronSizeClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"w-3 h-3\";\n case \"large\":\n return \"w-4 h-4\";\n default:\n return \"w-3.5 h-3.5\";\n }\n});\n\nconst inputTextClass = computed(() => sz.value.text);\n\nconst inputPaddingClass = computed(() => {\n // pr-3 leaves a comfortable gap on the right edge as well; the\n // legacy showroom relied on the field-native default padding which\n // we override here. Without pl-3 numbers visually butt up against\n // the country trigger divider.\n return \"pl-3 pr-3\";\n});\n\n// ── Event handlers ────────────────────────────────────────────────────────────\nfunction onInput(e: Event) {\n const val = (e.target as HTMLInputElement).value;\n localNumber.value = val;\n emit(\"update:modelValue\", buildValue(val, selectedCountry.value?.dial ?? \"\"));\n}\n\nfunction onChange(e: Event) {\n const val = (e.target as HTMLInputElement).value;\n emit(\"change\", buildValue(val, selectedCountry.value?.dial ?? \"\"));\n}\n\nfunction selectCountry(c: PhoneCountry) {\n if (props.country === undefined) internalCountry.value = c.iso;\n emit(\"update:country\", c.iso);\n emit(\"update:modelValue\", buildValue(localNumber.value, c.dial));\n closePopover();\n nextTick(() => inputRef.value?.focus());\n}\n\nfunction onTriggerClick() {\n if (isDisabled.value || props.readonly) return;\n togglePopover();\n}\n\nfunction onTriggerKeydown(e: KeyboardEvent) {\n if (isDisabled.value || props.readonly) return;\n if (e.key === \"ArrowDown\" || e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n if (!isOpen.value) openPopover();\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n closePopover();\n }\n}\n\nfunction onSearchKeydown(e: KeyboardEvent) {\n const list = filteredCountries.value;\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n activeIndex.value = Math.min(activeIndex.value + 1, list.length - 1);\n scrollActiveIntoView();\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n activeIndex.value = Math.max(activeIndex.value - 1, 0);\n scrollActiveIntoView();\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n const c = list[activeIndex.value];\n if (c) selectCountry(c);\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n closePopover();\n triggerRef.value?.focus?.();\n } else if (e.key === \"Tab\") {\n closePopover();\n }\n}\n\nfunction scrollActiveIntoView() {\n nextTick(() => {\n const c = filteredCountries.value[activeIndex.value];\n if (!c || !listEl.value) return;\n const el = document.getElementById(optionId(c.iso));\n el?.scrollIntoView({ block: \"nearest\" });\n });\n}\n\n// ── Expose ────────────────────────────────────────────────────────────────────\ndefineExpose({\n focus: () => inputRef.value?.focus(),\n blur: () => inputRef.value?.blur(),\n inputRef,\n});\n</script>\n"],"mappings":""}
1
+ {"version":3,"file":"PhoneInput.cjs","names":[],"sources":["../../../src/components/forms/PhoneInput.vue"],"sourcesContent":["<template>\n <div :class=\"['flex flex-col gap-1.5', fullWidth ? 'w-full' : 'inline-flex']\">\n <!-- Label -->\n <label\n v-if=\"label\"\n :for=\"fieldId\"\n class=\"text-caption font-medium text-foreground\"\n >\n {{ label }}\n <span v-if=\"required\" aria-hidden=\"true\" class=\"text-destructive ml-0.5\"\n >*</span\n >\n </label>\n\n <!-- Unified field wrapper -->\n <div\n ref=\"wrapperEl\"\n :class=\"[\n 'modo-field-wrapper flex items-center overflow-hidden',\n wrapperVariantClasses,\n wrapperHeightClass,\n radiusClasses,\n fullWidth ? 'w-full' : '',\n isDisabled ? 'opacity-60 cursor-not-allowed' : '',\n ]\"\n >\n <!-- Country selector trigger -->\n <button\n ref=\"triggerRef\"\n type=\"button\"\n :disabled=\"isDisabled || readonly\"\n :aria-label=\"loc.phoneInput.selectCountry\"\n :aria-expanded=\"isOpen\"\n :aria-haspopup=\"'listbox'\"\n :class=\"[\n 'flex items-center self-stretch shrink-0 select-none',\n 'transition-colors duration-fast ease-standard',\n triggerPaddingClass,\n isDisabled || readonly ? 'cursor-not-allowed' : 'cursor-pointer',\n ]\"\n @click=\"onTriggerClick\"\n @keydown=\"onTriggerKeydown\"\n >\n <span\n aria-hidden=\"true\"\n :class=\"['leading-none shrink-0', flagSizeClass]\"\n >\n {{ selectedCountry ? countryFlag(selectedCountry.iso) : \"🌐\" }}\n </span>\n <span\n :class=\"[\n 'tabular-nums text-muted-foreground font-medium shrink-0',\n triggerTextClass,\n ]\"\n >\n +{{ selectedCountry?.dial ?? \"?\" }}\n </span>\n <ChevronDownIcon\n aria-hidden=\"true\"\n :class=\"[\n 'shrink-0 transition-transform duration-base ease-standard',\n affordanceIconClass,\n chevronSizeClass,\n isOpen ? 'rotate-180' : '',\n ]\"\n />\n </button>\n\n <!-- Vertical divider -->\n <div aria-hidden=\"true\" class=\"w-px self-stretch bg-border shrink-0\" />\n\n <!-- Phone number input -->\n <input\n :id=\"fieldId\"\n ref=\"inputRef\"\n type=\"tel\"\n inputmode=\"tel\"\n :value=\"localNumber\"\n :placeholder=\"placeholder ?? ''\"\n :disabled=\"isDisabled\"\n :readonly=\"readonly\"\n :required=\"required\"\n :name=\"name ? `${name}-local` : undefined\"\n :autocomplete=\"autocomplete ?? 'tel-national'\"\n :autofocus=\"autofocus\"\n :aria-label=\"!label ? (ariaLabel ?? undefined) : undefined\"\n :aria-invalid=\"hasError || undefined\"\n :aria-describedby=\"describedBy\"\n :aria-required=\"required || undefined\"\n :class=\"[\n 'modo-field-native flex-1 min-w-0 bg-transparent',\n 'text-foreground placeholder:text-muted-foreground',\n 'disabled:cursor-not-allowed',\n inputTextClass,\n inputPaddingClass,\n ]\"\n @input=\"onInput\"\n @change=\"onChange\"\n @focus=\"$emit('focus', $event)\"\n @blur=\"$emit('blur', $event)\"\n />\n\n <!-- Loading spinner -->\n <Loader\n v-if=\"loading\"\n :size=\"resolvedSize === 'large' ? 'medium' : 'small'\"\n :class=\"['shrink-0', affordanceIconClass]\"\n />\n </div>\n\n <!-- Hidden input carrying the full formatted value for form submission -->\n <input v-if=\"name\" type=\"hidden\" :name=\"name\" :value=\"currentFormValue\" />\n\n <!-- Error / helper text -->\n <div v-if=\"errorText || helperText\" class=\"flex items-start gap-2\">\n <Typography\n v-if=\"errorText\"\n :id=\"errorId\"\n variant=\"caption\"\n size=\"medium\"\n color=\"danger\"\n as=\"p\"\n >\n {{ errorText }}\n </Typography>\n <Typography\n v-else-if=\"helperText\"\n :id=\"helperId\"\n variant=\"caption\"\n size=\"medium\"\n color=\"muted\"\n as=\"p\"\n >\n {{ helperText }}\n </Typography>\n </div>\n\n <!-- Country dropdown -->\n <PopoverPanel\n :open=\"isOpen\"\n :style=\"mergedPanelStyle\"\n :radius=\"radius\"\n role=\"listbox\"\n :labelledBy=\"fieldId\"\n @update:panelRef=\"panelRef = $event\"\n >\n <div style=\"max-height: 296px\" class=\"flex flex-col\">\n <!-- Search input -->\n <div class=\"px-3 border-b border-border shrink-0\">\n <div class=\"flex items-center gap-2 h-7\">\n <MagnifyingGlassIcon\n class=\"w-4 h-4 shrink-0 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n <input\n ref=\"searchEl\"\n v-model=\"searchQuery\"\n type=\"text\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n :placeholder=\"loc.phoneInput.searchCountry\"\n class=\"modo-field-native flex-1 min-w-0 bg-transparent p-0 text-caption text-foreground placeholder:text-muted-foreground\"\n @keydown=\"onSearchKeydown\"\n />\n <Button\n v-if=\"searchQuery\"\n variant=\"text\"\n size=\"xs\"\n radius=\"full\"\n :icon=\"XMarkIcon\"\n :ariaLabel=\"loc.common.clear\"\n tabindex=\"-1\"\n :class=\"['shrink-0', affordanceActionClass]\"\n @click=\"searchQuery = ''\"\n />\n </div>\n </div>\n\n <!-- Countries list -->\n <ul\n ref=\"listEl\"\n role=\"listbox\"\n class=\"modo-stagger flex-1 overflow-y-auto w-full\"\n style=\"min-height: 2.5rem\"\n tabindex=\"-1\"\n >\n <li\n v-if=\"filteredCountries.length === 0\"\n class=\"px-3 py-4 text-caption text-muted-foreground text-center\"\n >\n {{ loc.phoneInput.noResults }}\n </li>\n <li\n v-for=\"(c, i) in filteredCountries\"\n :key=\"c.iso\"\n :id=\"optionId(c.iso)\"\n role=\"option\"\n :aria-selected=\"c.iso === activeIso\"\n :class=\"[\n 'flex items-center gap-2.5 px-3 py-2 text-body cursor-pointer select-none',\n 'transition-colors duration-fast ease-standard',\n ['text-foreground', optionHover],\n i === activeIndex ? optionSurface : '',\n c.iso === activeIso ? 'font-medium' : '',\n ]\"\n @pointerenter=\"activeIndex = i\"\n @click=\"selectCountry(c)\"\n >\n <span aria-hidden=\"true\" class=\"text-base leading-none shrink-0\">\n {{ countryFlag(c.iso) }}\n </span>\n <span class=\"flex-1 min-w-0 truncate text-foreground\">{{\n c.name\n }}</span>\n <span\n class=\"shrink-0 tabular-nums text-muted-foreground text-[11px]\"\n >\n +{{ c.dial }}\n </span>\n <CheckIcon\n v-if=\"c.iso === activeIso\"\n :class=\"['w-4 h-4 shrink-0', checkColorClass]\"\n aria-hidden=\"true\"\n />\n </li>\n </ul>\n </div>\n </PopoverPanel>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, nextTick, ref, useId, watch } from \"vue\";\nimport type { PhoneInput } from \"../../interfaces/forms/PhoneInput.interface\";\nimport {\n PHONE_COUNTRIES,\n countryFlag,\n findCountryByIso,\n type PhoneCountry,\n} from \"../../data/phoneCountries\";\nimport {\n useFieldState,\n useFieldClasses,\n FIELD_AFFORDANCE_ICON_BY_COLOR,\n FIELD_AFFORDANCE_ACTION_BY_COLOR,\n} from \"../../composables/useField\";\nimport { usePopover } from \"../../composables/usePopover\";\nimport {\n useResolvedSize,\n useSizeTokens,\n useModoLocale,\n} from \"../../composables/useModoConfig\";\nimport PopoverPanel from \"../layout/PopoverPanel.vue\";\nimport Typography from \"../data-display/Typography.vue\";\nimport Loader from \"../feedback/Loader.vue\";\nimport Button from \"./Button.vue\";\nimport {\n ChevronDownIcon,\n MagnifyingGlassIcon,\n XMarkIcon,\n CheckIcon,\n} from \"@heroicons/vue/24/outline\";\n\nconst loc = useModoLocale();\n\nconst emit = defineEmits<{\n \"update:modelValue\": [value: string];\n \"update:country\": [iso: string];\n change: [value: string];\n focus: [event: FocusEvent];\n blur: [event: FocusEvent];\n}>();\n\nconst props = withDefaults(defineProps<PhoneInput>(), {\n defaultCountry: \"US\",\n format: \"national\",\n variant: \"outline\",\n color: \"default\",\n disabled: false,\n readonly: false,\n required: false,\n loading: false,\n fullWidth: false,\n autofocus: false,\n});\n\nconst resolvedSize = useResolvedSize(() => props.size);\nconst sz = useSizeTokens(() => props.size);\n\n// ── Refs ──────────────────────────────────────────────────────────────────────\nconst inputRef = ref<HTMLInputElement | null>(null);\nconst searchEl = ref<HTMLInputElement | null>(null);\nconst listEl = ref<HTMLElement | null>(null);\nconst wrapperEl = ref<HTMLElement | null>(null);\nconst dropdownWidth = ref(\"\");\n\n// ── Internal state ────────────────────────────────────────────────────────────\nconst localNumber = ref(\"\");\nconst internalCountry = ref((props.defaultCountry ?? \"US\").toUpperCase());\n\n// ── Field state ───────────────────────────────────────────────────────────────\nconst {\n fieldId,\n radius,\n stateColor,\n hasError,\n isDisabled,\n errorId,\n helperId,\n describedBy,\n} = useFieldState(props, {\n componentName: \"PhoneInput\",\n idPrefix: \"modo-phone\",\n});\n\nconst { wrapperVariantClasses, radiusClasses } = useFieldClasses({\n variant: () => props.variant,\n stateColor,\n hasError,\n radius,\n forceFocus: () => isOpen.value,\n halo: () => props.halo,\n});\n\n// ── Country resolution ────────────────────────────────────────────────────────\nconst activeIso = computed(() =>\n (props.country !== undefined\n ? props.country\n : internalCountry.value\n ).toUpperCase(),\n);\nconst selectedCountry = computed(() => findCountryByIso(activeIso.value));\n\n// ── Format helpers ────────────────────────────────────────────────────────────\nfunction buildValue(local: string, dialCode: string): string {\n const fmt = props.format ?? \"national\";\n if (fmt === \"e164\") return `+${dialCode}${local.replace(/\\D/g, \"\")}`;\n if (fmt === \"international\") return `+${dialCode}${local}`;\n return local;\n}\n\nfunction extractNational(v: string | undefined, dialCode: string): string {\n if (!v) return \"\";\n const prefix = `+${dialCode}`;\n if (v.startsWith(prefix)) return v.slice(prefix.length);\n return v;\n}\n\nconst currentFormValue = computed(() =>\n selectedCountry.value\n ? buildValue(localNumber.value, selectedCountry.value.dial)\n : localNumber.value,\n);\n\n// Sync external modelValue → localNumber\nwatch(\n () => props.modelValue,\n (v) => {\n const dial = selectedCountry.value?.dial ?? \"\";\n const national = extractNational(v, dial);\n if (national !== localNumber.value) localNumber.value = national;\n },\n { immediate: true },\n);\n\n// ── Popover ───────────────────────────────────────────────────────────────────\nconst {\n triggerRef,\n panelRef,\n isOpen,\n panelStyle,\n open: openPopover,\n close: closePopover,\n toggle: togglePopover,\n} = usePopover({\n placement: \"bottom-start\",\n onOpen: () => {\n dropdownWidth.value = wrapperEl.value\n ? `${wrapperEl.value.getBoundingClientRect().width}px`\n : \"260px\";\n searchQuery.value = \"\";\n activeIndex.value = Math.max(\n 0,\n filteredCountries.value.findIndex((c) => c.iso === activeIso.value),\n );\n nextTick(() => {\n searchEl.value?.focus();\n scrollActiveIntoView();\n });\n },\n onClose: () => {\n searchQuery.value = \"\";\n activeIndex.value = -1;\n },\n});\n\nconst mergedPanelStyle = computed(() => ({\n ...panelStyle.value,\n ...(dropdownWidth.value ? { width: dropdownWidth.value } : {}),\n}));\n\n// ── Search + filtered list ────────────────────────────────────────────────────\nconst searchQuery = ref(\"\");\nconst activeIndex = ref(-1);\nconst autoListboxId = useId();\n\nconst optionId = (iso: string) =>\n `modo-phone-listbox-${autoListboxId}-opt-${iso}`;\n\nconst filteredCountries = computed<PhoneCountry[]>(() => {\n const q = searchQuery.value.trim().toLowerCase();\n if (!q) return PHONE_COUNTRIES as unknown as PhoneCountry[];\n return (PHONE_COUNTRIES as unknown as PhoneCountry[]).filter(\n (c) =>\n c.name.toLowerCase().includes(q) ||\n c.iso.toLowerCase().includes(q) ||\n c.dial.startsWith(q.replace(/^\\+/, \"\")),\n );\n});\n\nwatch(filteredCountries, (list) => {\n const idx = list.findIndex((c) => c.iso === activeIso.value);\n activeIndex.value = idx >= 0 ? idx : 0;\n});\n\n// ── Option styles ─────────────────────────────────────────────────────────────\nconst OPTION_SURFACE: Record<string, string> = {\n default: \"bg-muted\",\n primary: \"bg-primary/10\",\n danger: \"bg-destructive/10\",\n success: \"bg-success/10\",\n warning: \"bg-warning/10\",\n};\nconst OPTION_HOVER: Record<string, string> = {\n default: \"hover:bg-muted\",\n primary: \"hover:bg-primary/10\",\n danger: \"hover:bg-destructive/10\",\n success: \"hover:bg-success/10\",\n warning: \"hover:bg-warning/10\",\n};\nconst optionSurface = computed(\n () => OPTION_SURFACE[stateColor.value] ?? \"bg-muted\",\n);\nconst optionHover = computed(\n () => OPTION_HOVER[stateColor.value] ?? \"hover:bg-muted\",\n);\nconst CHECK_COLOR_BY_STATE: 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 checkColorClass = computed(\n () => CHECK_COLOR_BY_STATE[stateColor.value] ?? \"text-foreground\",\n);\nconst affordanceIconClass = computed(\n () =>\n FIELD_AFFORDANCE_ICON_BY_COLOR[stateColor.value] ?? \"text-muted-foreground\",\n);\nconst affordanceActionClass = computed(\n () =>\n FIELD_AFFORDANCE_ACTION_BY_COLOR[stateColor.value] ??\n \"text-muted-foreground hover:text-foreground\",\n);\n\n// ── Size classes ──────────────────────────────────────────────────────────────\nconst wrapperHeightClass = computed(() => {\n // sz.value.padX is e.g. \"px-2.5\" — convert to pr-* for the wrapper right edge\n const pr = sz.value.padX.replace(\"px-\", \"pr-\");\n return `${sz.value.control} ${pr}`;\n});\n\nconst triggerPaddingClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"pl-2.5 pr-1.5 gap-1\";\n case \"large\":\n return \"pl-4 pr-2 gap-1.5\";\n default:\n return \"pl-3 pr-2 gap-1\";\n }\n});\n\nconst flagSizeClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"text-sm\";\n case \"large\":\n return \"text-xl\";\n default:\n return \"text-base\";\n }\n});\n\nconst triggerTextClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"text-[11px]\";\n case \"large\":\n return \"text-body\";\n default:\n return \"text-caption\";\n }\n});\n\nconst chevronSizeClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"w-3 h-3\";\n case \"large\":\n return \"w-4 h-4\";\n default:\n return \"w-3.5 h-3.5\";\n }\n});\n\nconst inputTextClass = computed(() => sz.value.text);\n\nconst inputPaddingClass = computed(() => {\n // pr-3 leaves a comfortable gap on the right edge as well; the\n // legacy showroom relied on the field-native default padding which\n // we override here. Without pl-3 numbers visually butt up against\n // the country trigger divider.\n return \"pl-3 pr-3\";\n});\n\n// ── Event handlers ────────────────────────────────────────────────────────────\nfunction onInput(e: Event) {\n const val = (e.target as HTMLInputElement).value;\n localNumber.value = val;\n emit(\"update:modelValue\", buildValue(val, selectedCountry.value?.dial ?? \"\"));\n}\n\nfunction onChange(e: Event) {\n const val = (e.target as HTMLInputElement).value;\n emit(\"change\", buildValue(val, selectedCountry.value?.dial ?? \"\"));\n}\n\nfunction selectCountry(c: PhoneCountry) {\n if (props.country === undefined) internalCountry.value = c.iso;\n emit(\"update:country\", c.iso);\n emit(\"update:modelValue\", buildValue(localNumber.value, c.dial));\n closePopover();\n nextTick(() => inputRef.value?.focus());\n}\n\nfunction onTriggerClick() {\n if (isDisabled.value || props.readonly) return;\n togglePopover();\n}\n\nfunction onTriggerKeydown(e: KeyboardEvent) {\n if (isDisabled.value || props.readonly) return;\n if (e.key === \"ArrowDown\" || e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n if (!isOpen.value) openPopover();\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n closePopover();\n }\n}\n\nfunction onSearchKeydown(e: KeyboardEvent) {\n const list = filteredCountries.value;\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n activeIndex.value = Math.min(activeIndex.value + 1, list.length - 1);\n scrollActiveIntoView();\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n activeIndex.value = Math.max(activeIndex.value - 1, 0);\n scrollActiveIntoView();\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n const c = list[activeIndex.value];\n if (c) selectCountry(c);\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n closePopover();\n triggerRef.value?.focus?.();\n } else if (e.key === \"Tab\") {\n // The search field lives inside a panel teleported to <body>, i.e. at the\n // very end of the document. Letting the browser resolve Tab from there\n // walks *past* the whole field — the number input sits earlier in the DOM\n // and is never reached — so focus landed on whatever followed the panel\n // while the panel was unmounting. Drive the destination explicitly:\n // forwards continues into the number input, backwards returns to the flag\n // trigger, which is the order the field reads in.\n e.preventDefault();\n closePopover();\n if (e.shiftKey) triggerRef.value?.focus?.();\n else inputRef.value?.focus();\n }\n}\n\nfunction scrollActiveIntoView() {\n nextTick(() => {\n const c = filteredCountries.value[activeIndex.value];\n if (!c || !listEl.value) return;\n const el = document.getElementById(optionId(c.iso));\n el?.scrollIntoView({ block: \"nearest\" });\n });\n}\n\n// ── Expose ────────────────────────────────────────────────────────────────────\ndefineExpose({\n focus: () => inputRef.value?.focus(),\n blur: () => inputRef.value?.blur(),\n inputRef,\n});\n</script>\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"PhoneInput.mjs","names":[],"sources":["../../../src/components/forms/PhoneInput.vue"],"sourcesContent":["<template>\n <div :class=\"['flex flex-col gap-1.5', fullWidth ? 'w-full' : 'inline-flex']\">\n <!-- Label -->\n <label\n v-if=\"label\"\n :for=\"fieldId\"\n class=\"text-caption font-medium text-foreground\"\n >\n {{ label }}\n <span v-if=\"required\" aria-hidden=\"true\" class=\"text-destructive ml-0.5\"\n >*</span\n >\n </label>\n\n <!-- Unified field wrapper -->\n <div\n ref=\"wrapperEl\"\n :class=\"[\n 'modo-field-wrapper flex items-center overflow-hidden',\n wrapperVariantClasses,\n wrapperHeightClass,\n radiusClasses,\n fullWidth ? 'w-full' : '',\n isDisabled ? 'opacity-60 cursor-not-allowed' : '',\n ]\"\n >\n <!-- Country selector trigger -->\n <button\n ref=\"triggerRef\"\n type=\"button\"\n :disabled=\"isDisabled || readonly\"\n :aria-label=\"loc.phoneInput.selectCountry\"\n :aria-expanded=\"isOpen\"\n :aria-haspopup=\"'listbox'\"\n :class=\"[\n 'flex items-center self-stretch shrink-0 select-none',\n 'transition-colors duration-fast ease-standard',\n triggerPaddingClass,\n isDisabled || readonly ? 'cursor-not-allowed' : 'cursor-pointer',\n ]\"\n @click=\"onTriggerClick\"\n @keydown=\"onTriggerKeydown\"\n >\n <span\n aria-hidden=\"true\"\n :class=\"['leading-none shrink-0', flagSizeClass]\"\n >\n {{ selectedCountry ? countryFlag(selectedCountry.iso) : \"🌐\" }}\n </span>\n <span\n :class=\"[\n 'tabular-nums text-muted-foreground font-medium shrink-0',\n triggerTextClass,\n ]\"\n >\n +{{ selectedCountry?.dial ?? \"?\" }}\n </span>\n <ChevronDownIcon\n aria-hidden=\"true\"\n :class=\"[\n 'shrink-0 transition-transform duration-base ease-standard',\n affordanceIconClass,\n chevronSizeClass,\n isOpen ? 'rotate-180' : '',\n ]\"\n />\n </button>\n\n <!-- Vertical divider -->\n <div aria-hidden=\"true\" class=\"w-px self-stretch bg-border shrink-0\" />\n\n <!-- Phone number input -->\n <input\n :id=\"fieldId\"\n ref=\"inputRef\"\n type=\"tel\"\n inputmode=\"tel\"\n :value=\"localNumber\"\n :placeholder=\"placeholder ?? ''\"\n :disabled=\"isDisabled\"\n :readonly=\"readonly\"\n :required=\"required\"\n :name=\"name ? `${name}-local` : undefined\"\n :autocomplete=\"autocomplete ?? 'tel-national'\"\n :autofocus=\"autofocus\"\n :aria-label=\"!label ? (ariaLabel ?? undefined) : undefined\"\n :aria-invalid=\"hasError || undefined\"\n :aria-describedby=\"describedBy\"\n :aria-required=\"required || undefined\"\n :class=\"[\n 'modo-field-native flex-1 min-w-0 bg-transparent',\n 'text-foreground placeholder:text-muted-foreground',\n 'disabled:cursor-not-allowed',\n inputTextClass,\n inputPaddingClass,\n ]\"\n @input=\"onInput\"\n @change=\"onChange\"\n @focus=\"$emit('focus', $event)\"\n @blur=\"$emit('blur', $event)\"\n />\n\n <!-- Loading spinner -->\n <Loader\n v-if=\"loading\"\n :size=\"resolvedSize === 'large' ? 'medium' : 'small'\"\n :class=\"['shrink-0', affordanceIconClass]\"\n />\n </div>\n\n <!-- Hidden input carrying the full formatted value for form submission -->\n <input v-if=\"name\" type=\"hidden\" :name=\"name\" :value=\"currentFormValue\" />\n\n <!-- Error / helper text -->\n <div v-if=\"errorText || helperText\" class=\"flex items-start gap-2\">\n <Typography\n v-if=\"errorText\"\n :id=\"errorId\"\n variant=\"caption\"\n size=\"medium\"\n color=\"danger\"\n as=\"p\"\n >\n {{ errorText }}\n </Typography>\n <Typography\n v-else-if=\"helperText\"\n :id=\"helperId\"\n variant=\"caption\"\n size=\"medium\"\n color=\"muted\"\n as=\"p\"\n >\n {{ helperText }}\n </Typography>\n </div>\n\n <!-- Country dropdown -->\n <PopoverPanel\n :open=\"isOpen\"\n :style=\"mergedPanelStyle\"\n :radius=\"radius\"\n role=\"listbox\"\n :labelledBy=\"fieldId\"\n @update:panelRef=\"panelRef = $event\"\n >\n <div style=\"max-height: 296px\" class=\"flex flex-col\">\n <!-- Search input -->\n <div class=\"px-3 border-b border-border shrink-0\">\n <div class=\"flex items-center gap-2 h-7\">\n <MagnifyingGlassIcon\n class=\"w-4 h-4 shrink-0 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n <input\n ref=\"searchEl\"\n v-model=\"searchQuery\"\n type=\"text\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n :placeholder=\"loc.phoneInput.searchCountry\"\n class=\"modo-field-native flex-1 min-w-0 bg-transparent p-0 text-caption text-foreground placeholder:text-muted-foreground\"\n @keydown=\"onSearchKeydown\"\n />\n <Button\n v-if=\"searchQuery\"\n variant=\"text\"\n size=\"xs\"\n radius=\"full\"\n :icon=\"XMarkIcon\"\n :ariaLabel=\"loc.common.clear\"\n tabindex=\"-1\"\n :class=\"['shrink-0', affordanceActionClass]\"\n @click=\"searchQuery = ''\"\n />\n </div>\n </div>\n\n <!-- Countries list -->\n <ul\n ref=\"listEl\"\n role=\"listbox\"\n class=\"modo-stagger flex-1 overflow-y-auto w-full\"\n style=\"min-height: 2.5rem\"\n tabindex=\"-1\"\n >\n <li\n v-if=\"filteredCountries.length === 0\"\n class=\"px-3 py-4 text-caption text-muted-foreground text-center\"\n >\n {{ loc.phoneInput.noResults }}\n </li>\n <li\n v-for=\"(c, i) in filteredCountries\"\n :key=\"c.iso\"\n :id=\"optionId(c.iso)\"\n role=\"option\"\n :aria-selected=\"c.iso === activeIso\"\n :class=\"[\n 'flex items-center gap-2.5 px-3 py-2 text-body cursor-pointer select-none',\n 'transition-colors duration-fast ease-standard',\n ['text-foreground', optionHover],\n i === activeIndex ? optionSurface : '',\n c.iso === activeIso ? 'font-medium' : '',\n ]\"\n @pointerenter=\"activeIndex = i\"\n @click=\"selectCountry(c)\"\n >\n <span aria-hidden=\"true\" class=\"text-base leading-none shrink-0\">\n {{ countryFlag(c.iso) }}\n </span>\n <span class=\"flex-1 min-w-0 truncate text-foreground\">{{\n c.name\n }}</span>\n <span\n class=\"shrink-0 tabular-nums text-muted-foreground text-[11px]\"\n >\n +{{ c.dial }}\n </span>\n <CheckIcon\n v-if=\"c.iso === activeIso\"\n :class=\"['w-4 h-4 shrink-0', checkColorClass]\"\n aria-hidden=\"true\"\n />\n </li>\n </ul>\n </div>\n </PopoverPanel>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, nextTick, ref, useId, watch } from \"vue\";\nimport type { PhoneInput } from \"../../interfaces/forms/PhoneInput.interface\";\nimport {\n PHONE_COUNTRIES,\n countryFlag,\n findCountryByIso,\n type PhoneCountry,\n} from \"../../data/phoneCountries\";\nimport {\n useFieldState,\n useFieldClasses,\n FIELD_AFFORDANCE_ICON_BY_COLOR,\n FIELD_AFFORDANCE_ACTION_BY_COLOR,\n} from \"../../composables/useField\";\nimport { usePopover } from \"../../composables/usePopover\";\nimport {\n useResolvedSize,\n useSizeTokens,\n useModoLocale,\n} from \"../../composables/useModoConfig\";\nimport PopoverPanel from \"../layout/PopoverPanel.vue\";\nimport Typography from \"../data-display/Typography.vue\";\nimport Loader from \"../feedback/Loader.vue\";\nimport Button from \"./Button.vue\";\nimport {\n ChevronDownIcon,\n MagnifyingGlassIcon,\n XMarkIcon,\n CheckIcon,\n} from \"@heroicons/vue/24/outline\";\n\nconst loc = useModoLocale();\n\nconst emit = defineEmits<{\n \"update:modelValue\": [value: string];\n \"update:country\": [iso: string];\n change: [value: string];\n focus: [event: FocusEvent];\n blur: [event: FocusEvent];\n}>();\n\nconst props = withDefaults(defineProps<PhoneInput>(), {\n defaultCountry: \"US\",\n format: \"national\",\n variant: \"outline\",\n color: \"default\",\n disabled: false,\n readonly: false,\n required: false,\n loading: false,\n fullWidth: false,\n autofocus: false,\n});\n\nconst resolvedSize = useResolvedSize(() => props.size);\nconst sz = useSizeTokens(() => props.size);\n\n// ── Refs ──────────────────────────────────────────────────────────────────────\nconst inputRef = ref<HTMLInputElement | null>(null);\nconst searchEl = ref<HTMLInputElement | null>(null);\nconst listEl = ref<HTMLElement | null>(null);\nconst wrapperEl = ref<HTMLElement | null>(null);\nconst dropdownWidth = ref(\"\");\n\n// ── Internal state ────────────────────────────────────────────────────────────\nconst localNumber = ref(\"\");\nconst internalCountry = ref((props.defaultCountry ?? \"US\").toUpperCase());\n\n// ── Field state ───────────────────────────────────────────────────────────────\nconst {\n fieldId,\n radius,\n stateColor,\n hasError,\n isDisabled,\n errorId,\n helperId,\n describedBy,\n} = useFieldState(props, {\n componentName: \"PhoneInput\",\n idPrefix: \"modo-phone\",\n});\n\nconst { wrapperVariantClasses, radiusClasses } = useFieldClasses({\n variant: () => props.variant,\n stateColor,\n hasError,\n radius,\n forceFocus: () => isOpen.value,\n halo: () => props.halo,\n});\n\n// ── Country resolution ────────────────────────────────────────────────────────\nconst activeIso = computed(() =>\n (props.country !== undefined\n ? props.country\n : internalCountry.value\n ).toUpperCase(),\n);\nconst selectedCountry = computed(() => findCountryByIso(activeIso.value));\n\n// ── Format helpers ────────────────────────────────────────────────────────────\nfunction buildValue(local: string, dialCode: string): string {\n const fmt = props.format ?? \"national\";\n if (fmt === \"e164\") return `+${dialCode}${local.replace(/\\D/g, \"\")}`;\n if (fmt === \"international\") return `+${dialCode}${local}`;\n return local;\n}\n\nfunction extractNational(v: string | undefined, dialCode: string): string {\n if (!v) return \"\";\n const prefix = `+${dialCode}`;\n if (v.startsWith(prefix)) return v.slice(prefix.length);\n return v;\n}\n\nconst currentFormValue = computed(() =>\n selectedCountry.value\n ? buildValue(localNumber.value, selectedCountry.value.dial)\n : localNumber.value,\n);\n\n// Sync external modelValue → localNumber\nwatch(\n () => props.modelValue,\n (v) => {\n const dial = selectedCountry.value?.dial ?? \"\";\n const national = extractNational(v, dial);\n if (national !== localNumber.value) localNumber.value = national;\n },\n { immediate: true },\n);\n\n// ── Popover ───────────────────────────────────────────────────────────────────\nconst {\n triggerRef,\n panelRef,\n isOpen,\n panelStyle,\n open: openPopover,\n close: closePopover,\n toggle: togglePopover,\n} = usePopover({\n placement: \"bottom-start\",\n onOpen: () => {\n dropdownWidth.value = wrapperEl.value\n ? `${wrapperEl.value.getBoundingClientRect().width}px`\n : \"260px\";\n searchQuery.value = \"\";\n activeIndex.value = Math.max(\n 0,\n filteredCountries.value.findIndex((c) => c.iso === activeIso.value),\n );\n nextTick(() => {\n searchEl.value?.focus();\n scrollActiveIntoView();\n });\n },\n onClose: () => {\n searchQuery.value = \"\";\n activeIndex.value = -1;\n },\n});\n\nconst mergedPanelStyle = computed(() => ({\n ...panelStyle.value,\n ...(dropdownWidth.value ? { width: dropdownWidth.value } : {}),\n}));\n\n// ── Search + filtered list ────────────────────────────────────────────────────\nconst searchQuery = ref(\"\");\nconst activeIndex = ref(-1);\nconst autoListboxId = useId();\n\nconst optionId = (iso: string) =>\n `modo-phone-listbox-${autoListboxId}-opt-${iso}`;\n\nconst filteredCountries = computed<PhoneCountry[]>(() => {\n const q = searchQuery.value.trim().toLowerCase();\n if (!q) return PHONE_COUNTRIES as unknown as PhoneCountry[];\n return (PHONE_COUNTRIES as unknown as PhoneCountry[]).filter(\n (c) =>\n c.name.toLowerCase().includes(q) ||\n c.iso.toLowerCase().includes(q) ||\n c.dial.startsWith(q.replace(/^\\+/, \"\")),\n );\n});\n\nwatch(filteredCountries, (list) => {\n const idx = list.findIndex((c) => c.iso === activeIso.value);\n activeIndex.value = idx >= 0 ? idx : 0;\n});\n\n// ── Option styles ─────────────────────────────────────────────────────────────\nconst OPTION_SURFACE: Record<string, string> = {\n default: \"bg-muted\",\n primary: \"bg-primary/10\",\n danger: \"bg-destructive/10\",\n success: \"bg-success/10\",\n warning: \"bg-warning/10\",\n};\nconst OPTION_HOVER: Record<string, string> = {\n default: \"hover:bg-muted\",\n primary: \"hover:bg-primary/10\",\n danger: \"hover:bg-destructive/10\",\n success: \"hover:bg-success/10\",\n warning: \"hover:bg-warning/10\",\n};\nconst optionSurface = computed(\n () => OPTION_SURFACE[stateColor.value] ?? \"bg-muted\",\n);\nconst optionHover = computed(\n () => OPTION_HOVER[stateColor.value] ?? \"hover:bg-muted\",\n);\nconst CHECK_COLOR_BY_STATE: 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 checkColorClass = computed(\n () => CHECK_COLOR_BY_STATE[stateColor.value] ?? \"text-foreground\",\n);\nconst affordanceIconClass = computed(\n () =>\n FIELD_AFFORDANCE_ICON_BY_COLOR[stateColor.value] ?? \"text-muted-foreground\",\n);\nconst affordanceActionClass = computed(\n () =>\n FIELD_AFFORDANCE_ACTION_BY_COLOR[stateColor.value] ??\n \"text-muted-foreground hover:text-foreground\",\n);\n\n// ── Size classes ──────────────────────────────────────────────────────────────\nconst wrapperHeightClass = computed(() => {\n // sz.value.padX is e.g. \"px-2.5\" — convert to pr-* for the wrapper right edge\n const pr = sz.value.padX.replace(\"px-\", \"pr-\");\n return `${sz.value.control} ${pr}`;\n});\n\nconst triggerPaddingClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"pl-2.5 pr-1.5 gap-1\";\n case \"large\":\n return \"pl-4 pr-2 gap-1.5\";\n default:\n return \"pl-3 pr-2 gap-1\";\n }\n});\n\nconst flagSizeClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"text-sm\";\n case \"large\":\n return \"text-xl\";\n default:\n return \"text-base\";\n }\n});\n\nconst triggerTextClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"text-[11px]\";\n case \"large\":\n return \"text-body\";\n default:\n return \"text-caption\";\n }\n});\n\nconst chevronSizeClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"w-3 h-3\";\n case \"large\":\n return \"w-4 h-4\";\n default:\n return \"w-3.5 h-3.5\";\n }\n});\n\nconst inputTextClass = computed(() => sz.value.text);\n\nconst inputPaddingClass = computed(() => {\n // pr-3 leaves a comfortable gap on the right edge as well; the\n // legacy showroom relied on the field-native default padding which\n // we override here. Without pl-3 numbers visually butt up against\n // the country trigger divider.\n return \"pl-3 pr-3\";\n});\n\n// ── Event handlers ────────────────────────────────────────────────────────────\nfunction onInput(e: Event) {\n const val = (e.target as HTMLInputElement).value;\n localNumber.value = val;\n emit(\"update:modelValue\", buildValue(val, selectedCountry.value?.dial ?? \"\"));\n}\n\nfunction onChange(e: Event) {\n const val = (e.target as HTMLInputElement).value;\n emit(\"change\", buildValue(val, selectedCountry.value?.dial ?? \"\"));\n}\n\nfunction selectCountry(c: PhoneCountry) {\n if (props.country === undefined) internalCountry.value = c.iso;\n emit(\"update:country\", c.iso);\n emit(\"update:modelValue\", buildValue(localNumber.value, c.dial));\n closePopover();\n nextTick(() => inputRef.value?.focus());\n}\n\nfunction onTriggerClick() {\n if (isDisabled.value || props.readonly) return;\n togglePopover();\n}\n\nfunction onTriggerKeydown(e: KeyboardEvent) {\n if (isDisabled.value || props.readonly) return;\n if (e.key === \"ArrowDown\" || e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n if (!isOpen.value) openPopover();\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n closePopover();\n }\n}\n\nfunction onSearchKeydown(e: KeyboardEvent) {\n const list = filteredCountries.value;\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n activeIndex.value = Math.min(activeIndex.value + 1, list.length - 1);\n scrollActiveIntoView();\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n activeIndex.value = Math.max(activeIndex.value - 1, 0);\n scrollActiveIntoView();\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n const c = list[activeIndex.value];\n if (c) selectCountry(c);\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n closePopover();\n triggerRef.value?.focus?.();\n } else if (e.key === \"Tab\") {\n closePopover();\n }\n}\n\nfunction scrollActiveIntoView() {\n nextTick(() => {\n const c = filteredCountries.value[activeIndex.value];\n if (!c || !listEl.value) return;\n const el = document.getElementById(optionId(c.iso));\n el?.scrollIntoView({ block: \"nearest\" });\n });\n}\n\n// ── Expose ────────────────────────────────────────────────────────────────────\ndefineExpose({\n focus: () => inputRef.value?.focus(),\n blur: () => inputRef.value?.blur(),\n inputRef,\n});\n</script>\n"],"mappings":""}
1
+ {"version":3,"file":"PhoneInput.mjs","names":[],"sources":["../../../src/components/forms/PhoneInput.vue"],"sourcesContent":["<template>\n <div :class=\"['flex flex-col gap-1.5', fullWidth ? 'w-full' : 'inline-flex']\">\n <!-- Label -->\n <label\n v-if=\"label\"\n :for=\"fieldId\"\n class=\"text-caption font-medium text-foreground\"\n >\n {{ label }}\n <span v-if=\"required\" aria-hidden=\"true\" class=\"text-destructive ml-0.5\"\n >*</span\n >\n </label>\n\n <!-- Unified field wrapper -->\n <div\n ref=\"wrapperEl\"\n :class=\"[\n 'modo-field-wrapper flex items-center overflow-hidden',\n wrapperVariantClasses,\n wrapperHeightClass,\n radiusClasses,\n fullWidth ? 'w-full' : '',\n isDisabled ? 'opacity-60 cursor-not-allowed' : '',\n ]\"\n >\n <!-- Country selector trigger -->\n <button\n ref=\"triggerRef\"\n type=\"button\"\n :disabled=\"isDisabled || readonly\"\n :aria-label=\"loc.phoneInput.selectCountry\"\n :aria-expanded=\"isOpen\"\n :aria-haspopup=\"'listbox'\"\n :class=\"[\n 'flex items-center self-stretch shrink-0 select-none',\n 'transition-colors duration-fast ease-standard',\n triggerPaddingClass,\n isDisabled || readonly ? 'cursor-not-allowed' : 'cursor-pointer',\n ]\"\n @click=\"onTriggerClick\"\n @keydown=\"onTriggerKeydown\"\n >\n <span\n aria-hidden=\"true\"\n :class=\"['leading-none shrink-0', flagSizeClass]\"\n >\n {{ selectedCountry ? countryFlag(selectedCountry.iso) : \"🌐\" }}\n </span>\n <span\n :class=\"[\n 'tabular-nums text-muted-foreground font-medium shrink-0',\n triggerTextClass,\n ]\"\n >\n +{{ selectedCountry?.dial ?? \"?\" }}\n </span>\n <ChevronDownIcon\n aria-hidden=\"true\"\n :class=\"[\n 'shrink-0 transition-transform duration-base ease-standard',\n affordanceIconClass,\n chevronSizeClass,\n isOpen ? 'rotate-180' : '',\n ]\"\n />\n </button>\n\n <!-- Vertical divider -->\n <div aria-hidden=\"true\" class=\"w-px self-stretch bg-border shrink-0\" />\n\n <!-- Phone number input -->\n <input\n :id=\"fieldId\"\n ref=\"inputRef\"\n type=\"tel\"\n inputmode=\"tel\"\n :value=\"localNumber\"\n :placeholder=\"placeholder ?? ''\"\n :disabled=\"isDisabled\"\n :readonly=\"readonly\"\n :required=\"required\"\n :name=\"name ? `${name}-local` : undefined\"\n :autocomplete=\"autocomplete ?? 'tel-national'\"\n :autofocus=\"autofocus\"\n :aria-label=\"!label ? (ariaLabel ?? undefined) : undefined\"\n :aria-invalid=\"hasError || undefined\"\n :aria-describedby=\"describedBy\"\n :aria-required=\"required || undefined\"\n :class=\"[\n 'modo-field-native flex-1 min-w-0 bg-transparent',\n 'text-foreground placeholder:text-muted-foreground',\n 'disabled:cursor-not-allowed',\n inputTextClass,\n inputPaddingClass,\n ]\"\n @input=\"onInput\"\n @change=\"onChange\"\n @focus=\"$emit('focus', $event)\"\n @blur=\"$emit('blur', $event)\"\n />\n\n <!-- Loading spinner -->\n <Loader\n v-if=\"loading\"\n :size=\"resolvedSize === 'large' ? 'medium' : 'small'\"\n :class=\"['shrink-0', affordanceIconClass]\"\n />\n </div>\n\n <!-- Hidden input carrying the full formatted value for form submission -->\n <input v-if=\"name\" type=\"hidden\" :name=\"name\" :value=\"currentFormValue\" />\n\n <!-- Error / helper text -->\n <div v-if=\"errorText || helperText\" class=\"flex items-start gap-2\">\n <Typography\n v-if=\"errorText\"\n :id=\"errorId\"\n variant=\"caption\"\n size=\"medium\"\n color=\"danger\"\n as=\"p\"\n >\n {{ errorText }}\n </Typography>\n <Typography\n v-else-if=\"helperText\"\n :id=\"helperId\"\n variant=\"caption\"\n size=\"medium\"\n color=\"muted\"\n as=\"p\"\n >\n {{ helperText }}\n </Typography>\n </div>\n\n <!-- Country dropdown -->\n <PopoverPanel\n :open=\"isOpen\"\n :style=\"mergedPanelStyle\"\n :radius=\"radius\"\n role=\"listbox\"\n :labelledBy=\"fieldId\"\n @update:panelRef=\"panelRef = $event\"\n >\n <div style=\"max-height: 296px\" class=\"flex flex-col\">\n <!-- Search input -->\n <div class=\"px-3 border-b border-border shrink-0\">\n <div class=\"flex items-center gap-2 h-7\">\n <MagnifyingGlassIcon\n class=\"w-4 h-4 shrink-0 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n <input\n ref=\"searchEl\"\n v-model=\"searchQuery\"\n type=\"text\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n :placeholder=\"loc.phoneInput.searchCountry\"\n class=\"modo-field-native flex-1 min-w-0 bg-transparent p-0 text-caption text-foreground placeholder:text-muted-foreground\"\n @keydown=\"onSearchKeydown\"\n />\n <Button\n v-if=\"searchQuery\"\n variant=\"text\"\n size=\"xs\"\n radius=\"full\"\n :icon=\"XMarkIcon\"\n :ariaLabel=\"loc.common.clear\"\n tabindex=\"-1\"\n :class=\"['shrink-0', affordanceActionClass]\"\n @click=\"searchQuery = ''\"\n />\n </div>\n </div>\n\n <!-- Countries list -->\n <ul\n ref=\"listEl\"\n role=\"listbox\"\n class=\"modo-stagger flex-1 overflow-y-auto w-full\"\n style=\"min-height: 2.5rem\"\n tabindex=\"-1\"\n >\n <li\n v-if=\"filteredCountries.length === 0\"\n class=\"px-3 py-4 text-caption text-muted-foreground text-center\"\n >\n {{ loc.phoneInput.noResults }}\n </li>\n <li\n v-for=\"(c, i) in filteredCountries\"\n :key=\"c.iso\"\n :id=\"optionId(c.iso)\"\n role=\"option\"\n :aria-selected=\"c.iso === activeIso\"\n :class=\"[\n 'flex items-center gap-2.5 px-3 py-2 text-body cursor-pointer select-none',\n 'transition-colors duration-fast ease-standard',\n ['text-foreground', optionHover],\n i === activeIndex ? optionSurface : '',\n c.iso === activeIso ? 'font-medium' : '',\n ]\"\n @pointerenter=\"activeIndex = i\"\n @click=\"selectCountry(c)\"\n >\n <span aria-hidden=\"true\" class=\"text-base leading-none shrink-0\">\n {{ countryFlag(c.iso) }}\n </span>\n <span class=\"flex-1 min-w-0 truncate text-foreground\">{{\n c.name\n }}</span>\n <span\n class=\"shrink-0 tabular-nums text-muted-foreground text-[11px]\"\n >\n +{{ c.dial }}\n </span>\n <CheckIcon\n v-if=\"c.iso === activeIso\"\n :class=\"['w-4 h-4 shrink-0', checkColorClass]\"\n aria-hidden=\"true\"\n />\n </li>\n </ul>\n </div>\n </PopoverPanel>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, nextTick, ref, useId, watch } from \"vue\";\nimport type { PhoneInput } from \"../../interfaces/forms/PhoneInput.interface\";\nimport {\n PHONE_COUNTRIES,\n countryFlag,\n findCountryByIso,\n type PhoneCountry,\n} from \"../../data/phoneCountries\";\nimport {\n useFieldState,\n useFieldClasses,\n FIELD_AFFORDANCE_ICON_BY_COLOR,\n FIELD_AFFORDANCE_ACTION_BY_COLOR,\n} from \"../../composables/useField\";\nimport { usePopover } from \"../../composables/usePopover\";\nimport {\n useResolvedSize,\n useSizeTokens,\n useModoLocale,\n} from \"../../composables/useModoConfig\";\nimport PopoverPanel from \"../layout/PopoverPanel.vue\";\nimport Typography from \"../data-display/Typography.vue\";\nimport Loader from \"../feedback/Loader.vue\";\nimport Button from \"./Button.vue\";\nimport {\n ChevronDownIcon,\n MagnifyingGlassIcon,\n XMarkIcon,\n CheckIcon,\n} from \"@heroicons/vue/24/outline\";\n\nconst loc = useModoLocale();\n\nconst emit = defineEmits<{\n \"update:modelValue\": [value: string];\n \"update:country\": [iso: string];\n change: [value: string];\n focus: [event: FocusEvent];\n blur: [event: FocusEvent];\n}>();\n\nconst props = withDefaults(defineProps<PhoneInput>(), {\n defaultCountry: \"US\",\n format: \"national\",\n variant: \"outline\",\n color: \"default\",\n disabled: false,\n readonly: false,\n required: false,\n loading: false,\n fullWidth: false,\n autofocus: false,\n});\n\nconst resolvedSize = useResolvedSize(() => props.size);\nconst sz = useSizeTokens(() => props.size);\n\n// ── Refs ──────────────────────────────────────────────────────────────────────\nconst inputRef = ref<HTMLInputElement | null>(null);\nconst searchEl = ref<HTMLInputElement | null>(null);\nconst listEl = ref<HTMLElement | null>(null);\nconst wrapperEl = ref<HTMLElement | null>(null);\nconst dropdownWidth = ref(\"\");\n\n// ── Internal state ────────────────────────────────────────────────────────────\nconst localNumber = ref(\"\");\nconst internalCountry = ref((props.defaultCountry ?? \"US\").toUpperCase());\n\n// ── Field state ───────────────────────────────────────────────────────────────\nconst {\n fieldId,\n radius,\n stateColor,\n hasError,\n isDisabled,\n errorId,\n helperId,\n describedBy,\n} = useFieldState(props, {\n componentName: \"PhoneInput\",\n idPrefix: \"modo-phone\",\n});\n\nconst { wrapperVariantClasses, radiusClasses } = useFieldClasses({\n variant: () => props.variant,\n stateColor,\n hasError,\n radius,\n forceFocus: () => isOpen.value,\n halo: () => props.halo,\n});\n\n// ── Country resolution ────────────────────────────────────────────────────────\nconst activeIso = computed(() =>\n (props.country !== undefined\n ? props.country\n : internalCountry.value\n ).toUpperCase(),\n);\nconst selectedCountry = computed(() => findCountryByIso(activeIso.value));\n\n// ── Format helpers ────────────────────────────────────────────────────────────\nfunction buildValue(local: string, dialCode: string): string {\n const fmt = props.format ?? \"national\";\n if (fmt === \"e164\") return `+${dialCode}${local.replace(/\\D/g, \"\")}`;\n if (fmt === \"international\") return `+${dialCode}${local}`;\n return local;\n}\n\nfunction extractNational(v: string | undefined, dialCode: string): string {\n if (!v) return \"\";\n const prefix = `+${dialCode}`;\n if (v.startsWith(prefix)) return v.slice(prefix.length);\n return v;\n}\n\nconst currentFormValue = computed(() =>\n selectedCountry.value\n ? buildValue(localNumber.value, selectedCountry.value.dial)\n : localNumber.value,\n);\n\n// Sync external modelValue → localNumber\nwatch(\n () => props.modelValue,\n (v) => {\n const dial = selectedCountry.value?.dial ?? \"\";\n const national = extractNational(v, dial);\n if (national !== localNumber.value) localNumber.value = national;\n },\n { immediate: true },\n);\n\n// ── Popover ───────────────────────────────────────────────────────────────────\nconst {\n triggerRef,\n panelRef,\n isOpen,\n panelStyle,\n open: openPopover,\n close: closePopover,\n toggle: togglePopover,\n} = usePopover({\n placement: \"bottom-start\",\n onOpen: () => {\n dropdownWidth.value = wrapperEl.value\n ? `${wrapperEl.value.getBoundingClientRect().width}px`\n : \"260px\";\n searchQuery.value = \"\";\n activeIndex.value = Math.max(\n 0,\n filteredCountries.value.findIndex((c) => c.iso === activeIso.value),\n );\n nextTick(() => {\n searchEl.value?.focus();\n scrollActiveIntoView();\n });\n },\n onClose: () => {\n searchQuery.value = \"\";\n activeIndex.value = -1;\n },\n});\n\nconst mergedPanelStyle = computed(() => ({\n ...panelStyle.value,\n ...(dropdownWidth.value ? { width: dropdownWidth.value } : {}),\n}));\n\n// ── Search + filtered list ────────────────────────────────────────────────────\nconst searchQuery = ref(\"\");\nconst activeIndex = ref(-1);\nconst autoListboxId = useId();\n\nconst optionId = (iso: string) =>\n `modo-phone-listbox-${autoListboxId}-opt-${iso}`;\n\nconst filteredCountries = computed<PhoneCountry[]>(() => {\n const q = searchQuery.value.trim().toLowerCase();\n if (!q) return PHONE_COUNTRIES as unknown as PhoneCountry[];\n return (PHONE_COUNTRIES as unknown as PhoneCountry[]).filter(\n (c) =>\n c.name.toLowerCase().includes(q) ||\n c.iso.toLowerCase().includes(q) ||\n c.dial.startsWith(q.replace(/^\\+/, \"\")),\n );\n});\n\nwatch(filteredCountries, (list) => {\n const idx = list.findIndex((c) => c.iso === activeIso.value);\n activeIndex.value = idx >= 0 ? idx : 0;\n});\n\n// ── Option styles ─────────────────────────────────────────────────────────────\nconst OPTION_SURFACE: Record<string, string> = {\n default: \"bg-muted\",\n primary: \"bg-primary/10\",\n danger: \"bg-destructive/10\",\n success: \"bg-success/10\",\n warning: \"bg-warning/10\",\n};\nconst OPTION_HOVER: Record<string, string> = {\n default: \"hover:bg-muted\",\n primary: \"hover:bg-primary/10\",\n danger: \"hover:bg-destructive/10\",\n success: \"hover:bg-success/10\",\n warning: \"hover:bg-warning/10\",\n};\nconst optionSurface = computed(\n () => OPTION_SURFACE[stateColor.value] ?? \"bg-muted\",\n);\nconst optionHover = computed(\n () => OPTION_HOVER[stateColor.value] ?? \"hover:bg-muted\",\n);\nconst CHECK_COLOR_BY_STATE: 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 checkColorClass = computed(\n () => CHECK_COLOR_BY_STATE[stateColor.value] ?? \"text-foreground\",\n);\nconst affordanceIconClass = computed(\n () =>\n FIELD_AFFORDANCE_ICON_BY_COLOR[stateColor.value] ?? \"text-muted-foreground\",\n);\nconst affordanceActionClass = computed(\n () =>\n FIELD_AFFORDANCE_ACTION_BY_COLOR[stateColor.value] ??\n \"text-muted-foreground hover:text-foreground\",\n);\n\n// ── Size classes ──────────────────────────────────────────────────────────────\nconst wrapperHeightClass = computed(() => {\n // sz.value.padX is e.g. \"px-2.5\" — convert to pr-* for the wrapper right edge\n const pr = sz.value.padX.replace(\"px-\", \"pr-\");\n return `${sz.value.control} ${pr}`;\n});\n\nconst triggerPaddingClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"pl-2.5 pr-1.5 gap-1\";\n case \"large\":\n return \"pl-4 pr-2 gap-1.5\";\n default:\n return \"pl-3 pr-2 gap-1\";\n }\n});\n\nconst flagSizeClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"text-sm\";\n case \"large\":\n return \"text-xl\";\n default:\n return \"text-base\";\n }\n});\n\nconst triggerTextClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"text-[11px]\";\n case \"large\":\n return \"text-body\";\n default:\n return \"text-caption\";\n }\n});\n\nconst chevronSizeClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"w-3 h-3\";\n case \"large\":\n return \"w-4 h-4\";\n default:\n return \"w-3.5 h-3.5\";\n }\n});\n\nconst inputTextClass = computed(() => sz.value.text);\n\nconst inputPaddingClass = computed(() => {\n // pr-3 leaves a comfortable gap on the right edge as well; the\n // legacy showroom relied on the field-native default padding which\n // we override here. Without pl-3 numbers visually butt up against\n // the country trigger divider.\n return \"pl-3 pr-3\";\n});\n\n// ── Event handlers ────────────────────────────────────────────────────────────\nfunction onInput(e: Event) {\n const val = (e.target as HTMLInputElement).value;\n localNumber.value = val;\n emit(\"update:modelValue\", buildValue(val, selectedCountry.value?.dial ?? \"\"));\n}\n\nfunction onChange(e: Event) {\n const val = (e.target as HTMLInputElement).value;\n emit(\"change\", buildValue(val, selectedCountry.value?.dial ?? \"\"));\n}\n\nfunction selectCountry(c: PhoneCountry) {\n if (props.country === undefined) internalCountry.value = c.iso;\n emit(\"update:country\", c.iso);\n emit(\"update:modelValue\", buildValue(localNumber.value, c.dial));\n closePopover();\n nextTick(() => inputRef.value?.focus());\n}\n\nfunction onTriggerClick() {\n if (isDisabled.value || props.readonly) return;\n togglePopover();\n}\n\nfunction onTriggerKeydown(e: KeyboardEvent) {\n if (isDisabled.value || props.readonly) return;\n if (e.key === \"ArrowDown\" || e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n if (!isOpen.value) openPopover();\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n closePopover();\n }\n}\n\nfunction onSearchKeydown(e: KeyboardEvent) {\n const list = filteredCountries.value;\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n activeIndex.value = Math.min(activeIndex.value + 1, list.length - 1);\n scrollActiveIntoView();\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n activeIndex.value = Math.max(activeIndex.value - 1, 0);\n scrollActiveIntoView();\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n const c = list[activeIndex.value];\n if (c) selectCountry(c);\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n closePopover();\n triggerRef.value?.focus?.();\n } else if (e.key === \"Tab\") {\n // The search field lives inside a panel teleported to <body>, i.e. at the\n // very end of the document. Letting the browser resolve Tab from there\n // walks *past* the whole field — the number input sits earlier in the DOM\n // and is never reached — so focus landed on whatever followed the panel\n // while the panel was unmounting. Drive the destination explicitly:\n // forwards continues into the number input, backwards returns to the flag\n // trigger, which is the order the field reads in.\n e.preventDefault();\n closePopover();\n if (e.shiftKey) triggerRef.value?.focus?.();\n else inputRef.value?.focus();\n }\n}\n\nfunction scrollActiveIntoView() {\n nextTick(() => {\n const c = filteredCountries.value[activeIndex.value];\n if (!c || !listEl.value) return;\n const el = document.getElementById(optionId(c.iso));\n el?.scrollIntoView({ block: \"nearest\" });\n });\n}\n\n// ── Expose ────────────────────────────────────────────────────────────────────\ndefineExpose({\n focus: () => inputRef.value?.focus(),\n blur: () => inputRef.value?.blur(),\n inputRef,\n});\n</script>\n"],"mappings":""}
@@ -305,7 +305,12 @@ var PhoneInput_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
305
305
  e.preventDefault();
306
306
  closePopover();
307
307
  triggerRef.value?.focus?.();
308
- } else if (e.key === "Tab") closePopover();
308
+ } else if (e.key === "Tab") {
309
+ e.preventDefault();
310
+ closePopover();
311
+ if (e.shiftKey) triggerRef.value?.focus?.();
312
+ else inputRef.value?.focus();
313
+ }
309
314
  }
310
315
  function scrollActiveIntoView() {
311
316
  (0, vue.nextTick)(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"PhoneInput.vue_vue_type_script_setup_true_lang.cjs","names":["$emit"],"sources":["../../../src/components/forms/PhoneInput.vue"],"sourcesContent":["<template>\n <div :class=\"['flex flex-col gap-1.5', fullWidth ? 'w-full' : 'inline-flex']\">\n <!-- Label -->\n <label\n v-if=\"label\"\n :for=\"fieldId\"\n class=\"text-caption font-medium text-foreground\"\n >\n {{ label }}\n <span v-if=\"required\" aria-hidden=\"true\" class=\"text-destructive ml-0.5\"\n >*</span\n >\n </label>\n\n <!-- Unified field wrapper -->\n <div\n ref=\"wrapperEl\"\n :class=\"[\n 'modo-field-wrapper flex items-center overflow-hidden',\n wrapperVariantClasses,\n wrapperHeightClass,\n radiusClasses,\n fullWidth ? 'w-full' : '',\n isDisabled ? 'opacity-60 cursor-not-allowed' : '',\n ]\"\n >\n <!-- Country selector trigger -->\n <button\n ref=\"triggerRef\"\n type=\"button\"\n :disabled=\"isDisabled || readonly\"\n :aria-label=\"loc.phoneInput.selectCountry\"\n :aria-expanded=\"isOpen\"\n :aria-haspopup=\"'listbox'\"\n :class=\"[\n 'flex items-center self-stretch shrink-0 select-none',\n 'transition-colors duration-fast ease-standard',\n triggerPaddingClass,\n isDisabled || readonly ? 'cursor-not-allowed' : 'cursor-pointer',\n ]\"\n @click=\"onTriggerClick\"\n @keydown=\"onTriggerKeydown\"\n >\n <span\n aria-hidden=\"true\"\n :class=\"['leading-none shrink-0', flagSizeClass]\"\n >\n {{ selectedCountry ? countryFlag(selectedCountry.iso) : \"🌐\" }}\n </span>\n <span\n :class=\"[\n 'tabular-nums text-muted-foreground font-medium shrink-0',\n triggerTextClass,\n ]\"\n >\n +{{ selectedCountry?.dial ?? \"?\" }}\n </span>\n <ChevronDownIcon\n aria-hidden=\"true\"\n :class=\"[\n 'shrink-0 transition-transform duration-base ease-standard',\n affordanceIconClass,\n chevronSizeClass,\n isOpen ? 'rotate-180' : '',\n ]\"\n />\n </button>\n\n <!-- Vertical divider -->\n <div aria-hidden=\"true\" class=\"w-px self-stretch bg-border shrink-0\" />\n\n <!-- Phone number input -->\n <input\n :id=\"fieldId\"\n ref=\"inputRef\"\n type=\"tel\"\n inputmode=\"tel\"\n :value=\"localNumber\"\n :placeholder=\"placeholder ?? ''\"\n :disabled=\"isDisabled\"\n :readonly=\"readonly\"\n :required=\"required\"\n :name=\"name ? `${name}-local` : undefined\"\n :autocomplete=\"autocomplete ?? 'tel-national'\"\n :autofocus=\"autofocus\"\n :aria-label=\"!label ? (ariaLabel ?? undefined) : undefined\"\n :aria-invalid=\"hasError || undefined\"\n :aria-describedby=\"describedBy\"\n :aria-required=\"required || undefined\"\n :class=\"[\n 'modo-field-native flex-1 min-w-0 bg-transparent',\n 'text-foreground placeholder:text-muted-foreground',\n 'disabled:cursor-not-allowed',\n inputTextClass,\n inputPaddingClass,\n ]\"\n @input=\"onInput\"\n @change=\"onChange\"\n @focus=\"$emit('focus', $event)\"\n @blur=\"$emit('blur', $event)\"\n />\n\n <!-- Loading spinner -->\n <Loader\n v-if=\"loading\"\n :size=\"resolvedSize === 'large' ? 'medium' : 'small'\"\n :class=\"['shrink-0', affordanceIconClass]\"\n />\n </div>\n\n <!-- Hidden input carrying the full formatted value for form submission -->\n <input v-if=\"name\" type=\"hidden\" :name=\"name\" :value=\"currentFormValue\" />\n\n <!-- Error / helper text -->\n <div v-if=\"errorText || helperText\" class=\"flex items-start gap-2\">\n <Typography\n v-if=\"errorText\"\n :id=\"errorId\"\n variant=\"caption\"\n size=\"medium\"\n color=\"danger\"\n as=\"p\"\n >\n {{ errorText }}\n </Typography>\n <Typography\n v-else-if=\"helperText\"\n :id=\"helperId\"\n variant=\"caption\"\n size=\"medium\"\n color=\"muted\"\n as=\"p\"\n >\n {{ helperText }}\n </Typography>\n </div>\n\n <!-- Country dropdown -->\n <PopoverPanel\n :open=\"isOpen\"\n :style=\"mergedPanelStyle\"\n :radius=\"radius\"\n role=\"listbox\"\n :labelledBy=\"fieldId\"\n @update:panelRef=\"panelRef = $event\"\n >\n <div style=\"max-height: 296px\" class=\"flex flex-col\">\n <!-- Search input -->\n <div class=\"px-3 border-b border-border shrink-0\">\n <div class=\"flex items-center gap-2 h-7\">\n <MagnifyingGlassIcon\n class=\"w-4 h-4 shrink-0 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n <input\n ref=\"searchEl\"\n v-model=\"searchQuery\"\n type=\"text\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n :placeholder=\"loc.phoneInput.searchCountry\"\n class=\"modo-field-native flex-1 min-w-0 bg-transparent p-0 text-caption text-foreground placeholder:text-muted-foreground\"\n @keydown=\"onSearchKeydown\"\n />\n <Button\n v-if=\"searchQuery\"\n variant=\"text\"\n size=\"xs\"\n radius=\"full\"\n :icon=\"XMarkIcon\"\n :ariaLabel=\"loc.common.clear\"\n tabindex=\"-1\"\n :class=\"['shrink-0', affordanceActionClass]\"\n @click=\"searchQuery = ''\"\n />\n </div>\n </div>\n\n <!-- Countries list -->\n <ul\n ref=\"listEl\"\n role=\"listbox\"\n class=\"modo-stagger flex-1 overflow-y-auto w-full\"\n style=\"min-height: 2.5rem\"\n tabindex=\"-1\"\n >\n <li\n v-if=\"filteredCountries.length === 0\"\n class=\"px-3 py-4 text-caption text-muted-foreground text-center\"\n >\n {{ loc.phoneInput.noResults }}\n </li>\n <li\n v-for=\"(c, i) in filteredCountries\"\n :key=\"c.iso\"\n :id=\"optionId(c.iso)\"\n role=\"option\"\n :aria-selected=\"c.iso === activeIso\"\n :class=\"[\n 'flex items-center gap-2.5 px-3 py-2 text-body cursor-pointer select-none',\n 'transition-colors duration-fast ease-standard',\n ['text-foreground', optionHover],\n i === activeIndex ? optionSurface : '',\n c.iso === activeIso ? 'font-medium' : '',\n ]\"\n @pointerenter=\"activeIndex = i\"\n @click=\"selectCountry(c)\"\n >\n <span aria-hidden=\"true\" class=\"text-base leading-none shrink-0\">\n {{ countryFlag(c.iso) }}\n </span>\n <span class=\"flex-1 min-w-0 truncate text-foreground\">{{\n c.name\n }}</span>\n <span\n class=\"shrink-0 tabular-nums text-muted-foreground text-[11px]\"\n >\n +{{ c.dial }}\n </span>\n <CheckIcon\n v-if=\"c.iso === activeIso\"\n :class=\"['w-4 h-4 shrink-0', checkColorClass]\"\n aria-hidden=\"true\"\n />\n </li>\n </ul>\n </div>\n </PopoverPanel>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, nextTick, ref, useId, watch } from \"vue\";\nimport type { PhoneInput } from \"../../interfaces/forms/PhoneInput.interface\";\nimport {\n PHONE_COUNTRIES,\n countryFlag,\n findCountryByIso,\n type PhoneCountry,\n} from \"../../data/phoneCountries\";\nimport {\n useFieldState,\n useFieldClasses,\n FIELD_AFFORDANCE_ICON_BY_COLOR,\n FIELD_AFFORDANCE_ACTION_BY_COLOR,\n} from \"../../composables/useField\";\nimport { usePopover } from \"../../composables/usePopover\";\nimport {\n useResolvedSize,\n useSizeTokens,\n useModoLocale,\n} from \"../../composables/useModoConfig\";\nimport PopoverPanel from \"../layout/PopoverPanel.vue\";\nimport Typography from \"../data-display/Typography.vue\";\nimport Loader from \"../feedback/Loader.vue\";\nimport Button from \"./Button.vue\";\nimport {\n ChevronDownIcon,\n MagnifyingGlassIcon,\n XMarkIcon,\n CheckIcon,\n} from \"@heroicons/vue/24/outline\";\n\nconst loc = useModoLocale();\n\nconst emit = defineEmits<{\n \"update:modelValue\": [value: string];\n \"update:country\": [iso: string];\n change: [value: string];\n focus: [event: FocusEvent];\n blur: [event: FocusEvent];\n}>();\n\nconst props = withDefaults(defineProps<PhoneInput>(), {\n defaultCountry: \"US\",\n format: \"national\",\n variant: \"outline\",\n color: \"default\",\n disabled: false,\n readonly: false,\n required: false,\n loading: false,\n fullWidth: false,\n autofocus: false,\n});\n\nconst resolvedSize = useResolvedSize(() => props.size);\nconst sz = useSizeTokens(() => props.size);\n\n// ── Refs ──────────────────────────────────────────────────────────────────────\nconst inputRef = ref<HTMLInputElement | null>(null);\nconst searchEl = ref<HTMLInputElement | null>(null);\nconst listEl = ref<HTMLElement | null>(null);\nconst wrapperEl = ref<HTMLElement | null>(null);\nconst dropdownWidth = ref(\"\");\n\n// ── Internal state ────────────────────────────────────────────────────────────\nconst localNumber = ref(\"\");\nconst internalCountry = ref((props.defaultCountry ?? \"US\").toUpperCase());\n\n// ── Field state ───────────────────────────────────────────────────────────────\nconst {\n fieldId,\n radius,\n stateColor,\n hasError,\n isDisabled,\n errorId,\n helperId,\n describedBy,\n} = useFieldState(props, {\n componentName: \"PhoneInput\",\n idPrefix: \"modo-phone\",\n});\n\nconst { wrapperVariantClasses, radiusClasses } = useFieldClasses({\n variant: () => props.variant,\n stateColor,\n hasError,\n radius,\n forceFocus: () => isOpen.value,\n halo: () => props.halo,\n});\n\n// ── Country resolution ────────────────────────────────────────────────────────\nconst activeIso = computed(() =>\n (props.country !== undefined\n ? props.country\n : internalCountry.value\n ).toUpperCase(),\n);\nconst selectedCountry = computed(() => findCountryByIso(activeIso.value));\n\n// ── Format helpers ────────────────────────────────────────────────────────────\nfunction buildValue(local: string, dialCode: string): string {\n const fmt = props.format ?? \"national\";\n if (fmt === \"e164\") return `+${dialCode}${local.replace(/\\D/g, \"\")}`;\n if (fmt === \"international\") return `+${dialCode}${local}`;\n return local;\n}\n\nfunction extractNational(v: string | undefined, dialCode: string): string {\n if (!v) return \"\";\n const prefix = `+${dialCode}`;\n if (v.startsWith(prefix)) return v.slice(prefix.length);\n return v;\n}\n\nconst currentFormValue = computed(() =>\n selectedCountry.value\n ? buildValue(localNumber.value, selectedCountry.value.dial)\n : localNumber.value,\n);\n\n// Sync external modelValue → localNumber\nwatch(\n () => props.modelValue,\n (v) => {\n const dial = selectedCountry.value?.dial ?? \"\";\n const national = extractNational(v, dial);\n if (national !== localNumber.value) localNumber.value = national;\n },\n { immediate: true },\n);\n\n// ── Popover ───────────────────────────────────────────────────────────────────\nconst {\n triggerRef,\n panelRef,\n isOpen,\n panelStyle,\n open: openPopover,\n close: closePopover,\n toggle: togglePopover,\n} = usePopover({\n placement: \"bottom-start\",\n onOpen: () => {\n dropdownWidth.value = wrapperEl.value\n ? `${wrapperEl.value.getBoundingClientRect().width}px`\n : \"260px\";\n searchQuery.value = \"\";\n activeIndex.value = Math.max(\n 0,\n filteredCountries.value.findIndex((c) => c.iso === activeIso.value),\n );\n nextTick(() => {\n searchEl.value?.focus();\n scrollActiveIntoView();\n });\n },\n onClose: () => {\n searchQuery.value = \"\";\n activeIndex.value = -1;\n },\n});\n\nconst mergedPanelStyle = computed(() => ({\n ...panelStyle.value,\n ...(dropdownWidth.value ? { width: dropdownWidth.value } : {}),\n}));\n\n// ── Search + filtered list ────────────────────────────────────────────────────\nconst searchQuery = ref(\"\");\nconst activeIndex = ref(-1);\nconst autoListboxId = useId();\n\nconst optionId = (iso: string) =>\n `modo-phone-listbox-${autoListboxId}-opt-${iso}`;\n\nconst filteredCountries = computed<PhoneCountry[]>(() => {\n const q = searchQuery.value.trim().toLowerCase();\n if (!q) return PHONE_COUNTRIES as unknown as PhoneCountry[];\n return (PHONE_COUNTRIES as unknown as PhoneCountry[]).filter(\n (c) =>\n c.name.toLowerCase().includes(q) ||\n c.iso.toLowerCase().includes(q) ||\n c.dial.startsWith(q.replace(/^\\+/, \"\")),\n );\n});\n\nwatch(filteredCountries, (list) => {\n const idx = list.findIndex((c) => c.iso === activeIso.value);\n activeIndex.value = idx >= 0 ? idx : 0;\n});\n\n// ── Option styles ─────────────────────────────────────────────────────────────\nconst OPTION_SURFACE: Record<string, string> = {\n default: \"bg-muted\",\n primary: \"bg-primary/10\",\n danger: \"bg-destructive/10\",\n success: \"bg-success/10\",\n warning: \"bg-warning/10\",\n};\nconst OPTION_HOVER: Record<string, string> = {\n default: \"hover:bg-muted\",\n primary: \"hover:bg-primary/10\",\n danger: \"hover:bg-destructive/10\",\n success: \"hover:bg-success/10\",\n warning: \"hover:bg-warning/10\",\n};\nconst optionSurface = computed(\n () => OPTION_SURFACE[stateColor.value] ?? \"bg-muted\",\n);\nconst optionHover = computed(\n () => OPTION_HOVER[stateColor.value] ?? \"hover:bg-muted\",\n);\nconst CHECK_COLOR_BY_STATE: 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 checkColorClass = computed(\n () => CHECK_COLOR_BY_STATE[stateColor.value] ?? \"text-foreground\",\n);\nconst affordanceIconClass = computed(\n () =>\n FIELD_AFFORDANCE_ICON_BY_COLOR[stateColor.value] ?? \"text-muted-foreground\",\n);\nconst affordanceActionClass = computed(\n () =>\n FIELD_AFFORDANCE_ACTION_BY_COLOR[stateColor.value] ??\n \"text-muted-foreground hover:text-foreground\",\n);\n\n// ── Size classes ──────────────────────────────────────────────────────────────\nconst wrapperHeightClass = computed(() => {\n // sz.value.padX is e.g. \"px-2.5\" — convert to pr-* for the wrapper right edge\n const pr = sz.value.padX.replace(\"px-\", \"pr-\");\n return `${sz.value.control} ${pr}`;\n});\n\nconst triggerPaddingClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"pl-2.5 pr-1.5 gap-1\";\n case \"large\":\n return \"pl-4 pr-2 gap-1.5\";\n default:\n return \"pl-3 pr-2 gap-1\";\n }\n});\n\nconst flagSizeClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"text-sm\";\n case \"large\":\n return \"text-xl\";\n default:\n return \"text-base\";\n }\n});\n\nconst triggerTextClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"text-[11px]\";\n case \"large\":\n return \"text-body\";\n default:\n return \"text-caption\";\n }\n});\n\nconst chevronSizeClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"w-3 h-3\";\n case \"large\":\n return \"w-4 h-4\";\n default:\n return \"w-3.5 h-3.5\";\n }\n});\n\nconst inputTextClass = computed(() => sz.value.text);\n\nconst inputPaddingClass = computed(() => {\n // pr-3 leaves a comfortable gap on the right edge as well; the\n // legacy showroom relied on the field-native default padding which\n // we override here. Without pl-3 numbers visually butt up against\n // the country trigger divider.\n return \"pl-3 pr-3\";\n});\n\n// ── Event handlers ────────────────────────────────────────────────────────────\nfunction onInput(e: Event) {\n const val = (e.target as HTMLInputElement).value;\n localNumber.value = val;\n emit(\"update:modelValue\", buildValue(val, selectedCountry.value?.dial ?? \"\"));\n}\n\nfunction onChange(e: Event) {\n const val = (e.target as HTMLInputElement).value;\n emit(\"change\", buildValue(val, selectedCountry.value?.dial ?? \"\"));\n}\n\nfunction selectCountry(c: PhoneCountry) {\n if (props.country === undefined) internalCountry.value = c.iso;\n emit(\"update:country\", c.iso);\n emit(\"update:modelValue\", buildValue(localNumber.value, c.dial));\n closePopover();\n nextTick(() => inputRef.value?.focus());\n}\n\nfunction onTriggerClick() {\n if (isDisabled.value || props.readonly) return;\n togglePopover();\n}\n\nfunction onTriggerKeydown(e: KeyboardEvent) {\n if (isDisabled.value || props.readonly) return;\n if (e.key === \"ArrowDown\" || e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n if (!isOpen.value) openPopover();\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n closePopover();\n }\n}\n\nfunction onSearchKeydown(e: KeyboardEvent) {\n const list = filteredCountries.value;\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n activeIndex.value = Math.min(activeIndex.value + 1, list.length - 1);\n scrollActiveIntoView();\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n activeIndex.value = Math.max(activeIndex.value - 1, 0);\n scrollActiveIntoView();\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n const c = list[activeIndex.value];\n if (c) selectCountry(c);\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n closePopover();\n triggerRef.value?.focus?.();\n } else if (e.key === \"Tab\") {\n closePopover();\n }\n}\n\nfunction scrollActiveIntoView() {\n nextTick(() => {\n const c = filteredCountries.value[activeIndex.value];\n if (!c || !listEl.value) return;\n const el = document.getElementById(optionId(c.iso));\n el?.scrollIntoView({ block: \"nearest\" });\n });\n}\n\n// ── Expose ────────────────────────────────────────────────────────────────────\ndefineExpose({\n focus: () => inputRef.value?.focus(),\n blur: () => inputRef.value?.blur(),\n inputRef,\n});\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAu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K;MACL,OAAM;MACN,OAAA,EAAA,cAAA,UAA0B;MAC1B,UAAS;SAGD,kBAAA,MAAkB,WAAM,MAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAI3B,MALL,cAAA,GAAA,IAAA,kBAAA,GAAA,IAAA,OAIK,IAAG,CAAC,WAAW,UAAS,EAAA,EAAA,KAAA,GAAA,IAAA,oBAAA,IAAA,KAAA,IAAA,GAAA,IAAA,WAAA,KAAA,GAAA,GAAA,IAAA,oBAkCxB,IAAA,UAAA,OAAA,GAAA,IAAA,YA/Bc,kBAAA,QAAT,GAAG,MAAC;+DA+BT,MAAA;OA9BF,KAAK,EAAE;OACP,IAAI,SAAS,EAAE,IAAG;OACnB,MAAK;OACJ,iBAAe,EAAE,QAAQ,UAAA;OACzB,QAAA,GAAA,IAAA,gBAAK;;;4BAA+L,YAAA,MAAW;QAAiB,MAAM,YAAA,QAAc,cAAA,QAAa;QAAqB,EAAE,QAAQ,UAAA,QAAS,gBAAA;;OAOzS,iBAAY,WAAE,YAAA,QAAc;OAC5B,UAAK,WAAE,cAAc,EAAC;;mCAIhB,QAFP,cAAA,GAAA,IAAA,kBAAA,GAAA,IAAA,OACK,uBAAA,YAAW,CAAC,EAAE,IAAG,CAAA,EAAA,EAAA;mCAIb,QAFT,cAAA,GAAA,IAAA,iBACE,EAAE,KAAI,EAAA,EAAA;mCAMD,QAJP,aAEC,QAAA,GAAA,IAAA,iBACK,EAAE,KAAI,EAAA,EAAA;OAGJ,EAAE,QAAQ,UAAA,UAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,cAAA,GAAA,IAAA,OAGhB,0BAAA,UAAA,EAAA;;QAFC,QAAA,GAAA,IAAA,gBAAK,CAAA,oBAAuB,gBAAA,MAAe,CAAA;QAC5C,eAAY"}
1
+ {"version":3,"file":"PhoneInput.vue_vue_type_script_setup_true_lang.cjs","names":["$emit"],"sources":["../../../src/components/forms/PhoneInput.vue"],"sourcesContent":["<template>\n <div :class=\"['flex flex-col gap-1.5', fullWidth ? 'w-full' : 'inline-flex']\">\n <!-- Label -->\n <label\n v-if=\"label\"\n :for=\"fieldId\"\n class=\"text-caption font-medium text-foreground\"\n >\n {{ label }}\n <span v-if=\"required\" aria-hidden=\"true\" class=\"text-destructive ml-0.5\"\n >*</span\n >\n </label>\n\n <!-- Unified field wrapper -->\n <div\n ref=\"wrapperEl\"\n :class=\"[\n 'modo-field-wrapper flex items-center overflow-hidden',\n wrapperVariantClasses,\n wrapperHeightClass,\n radiusClasses,\n fullWidth ? 'w-full' : '',\n isDisabled ? 'opacity-60 cursor-not-allowed' : '',\n ]\"\n >\n <!-- Country selector trigger -->\n <button\n ref=\"triggerRef\"\n type=\"button\"\n :disabled=\"isDisabled || readonly\"\n :aria-label=\"loc.phoneInput.selectCountry\"\n :aria-expanded=\"isOpen\"\n :aria-haspopup=\"'listbox'\"\n :class=\"[\n 'flex items-center self-stretch shrink-0 select-none',\n 'transition-colors duration-fast ease-standard',\n triggerPaddingClass,\n isDisabled || readonly ? 'cursor-not-allowed' : 'cursor-pointer',\n ]\"\n @click=\"onTriggerClick\"\n @keydown=\"onTriggerKeydown\"\n >\n <span\n aria-hidden=\"true\"\n :class=\"['leading-none shrink-0', flagSizeClass]\"\n >\n {{ selectedCountry ? countryFlag(selectedCountry.iso) : \"🌐\" }}\n </span>\n <span\n :class=\"[\n 'tabular-nums text-muted-foreground font-medium shrink-0',\n triggerTextClass,\n ]\"\n >\n +{{ selectedCountry?.dial ?? \"?\" }}\n </span>\n <ChevronDownIcon\n aria-hidden=\"true\"\n :class=\"[\n 'shrink-0 transition-transform duration-base ease-standard',\n affordanceIconClass,\n chevronSizeClass,\n isOpen ? 'rotate-180' : '',\n ]\"\n />\n </button>\n\n <!-- Vertical divider -->\n <div aria-hidden=\"true\" class=\"w-px self-stretch bg-border shrink-0\" />\n\n <!-- Phone number input -->\n <input\n :id=\"fieldId\"\n ref=\"inputRef\"\n type=\"tel\"\n inputmode=\"tel\"\n :value=\"localNumber\"\n :placeholder=\"placeholder ?? ''\"\n :disabled=\"isDisabled\"\n :readonly=\"readonly\"\n :required=\"required\"\n :name=\"name ? `${name}-local` : undefined\"\n :autocomplete=\"autocomplete ?? 'tel-national'\"\n :autofocus=\"autofocus\"\n :aria-label=\"!label ? (ariaLabel ?? undefined) : undefined\"\n :aria-invalid=\"hasError || undefined\"\n :aria-describedby=\"describedBy\"\n :aria-required=\"required || undefined\"\n :class=\"[\n 'modo-field-native flex-1 min-w-0 bg-transparent',\n 'text-foreground placeholder:text-muted-foreground',\n 'disabled:cursor-not-allowed',\n inputTextClass,\n inputPaddingClass,\n ]\"\n @input=\"onInput\"\n @change=\"onChange\"\n @focus=\"$emit('focus', $event)\"\n @blur=\"$emit('blur', $event)\"\n />\n\n <!-- Loading spinner -->\n <Loader\n v-if=\"loading\"\n :size=\"resolvedSize === 'large' ? 'medium' : 'small'\"\n :class=\"['shrink-0', affordanceIconClass]\"\n />\n </div>\n\n <!-- Hidden input carrying the full formatted value for form submission -->\n <input v-if=\"name\" type=\"hidden\" :name=\"name\" :value=\"currentFormValue\" />\n\n <!-- Error / helper text -->\n <div v-if=\"errorText || helperText\" class=\"flex items-start gap-2\">\n <Typography\n v-if=\"errorText\"\n :id=\"errorId\"\n variant=\"caption\"\n size=\"medium\"\n color=\"danger\"\n as=\"p\"\n >\n {{ errorText }}\n </Typography>\n <Typography\n v-else-if=\"helperText\"\n :id=\"helperId\"\n variant=\"caption\"\n size=\"medium\"\n color=\"muted\"\n as=\"p\"\n >\n {{ helperText }}\n </Typography>\n </div>\n\n <!-- Country dropdown -->\n <PopoverPanel\n :open=\"isOpen\"\n :style=\"mergedPanelStyle\"\n :radius=\"radius\"\n role=\"listbox\"\n :labelledBy=\"fieldId\"\n @update:panelRef=\"panelRef = $event\"\n >\n <div style=\"max-height: 296px\" class=\"flex flex-col\">\n <!-- Search input -->\n <div class=\"px-3 border-b border-border shrink-0\">\n <div class=\"flex items-center gap-2 h-7\">\n <MagnifyingGlassIcon\n class=\"w-4 h-4 shrink-0 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n <input\n ref=\"searchEl\"\n v-model=\"searchQuery\"\n type=\"text\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n :placeholder=\"loc.phoneInput.searchCountry\"\n class=\"modo-field-native flex-1 min-w-0 bg-transparent p-0 text-caption text-foreground placeholder:text-muted-foreground\"\n @keydown=\"onSearchKeydown\"\n />\n <Button\n v-if=\"searchQuery\"\n variant=\"text\"\n size=\"xs\"\n radius=\"full\"\n :icon=\"XMarkIcon\"\n :ariaLabel=\"loc.common.clear\"\n tabindex=\"-1\"\n :class=\"['shrink-0', affordanceActionClass]\"\n @click=\"searchQuery = ''\"\n />\n </div>\n </div>\n\n <!-- Countries list -->\n <ul\n ref=\"listEl\"\n role=\"listbox\"\n class=\"modo-stagger flex-1 overflow-y-auto w-full\"\n style=\"min-height: 2.5rem\"\n tabindex=\"-1\"\n >\n <li\n v-if=\"filteredCountries.length === 0\"\n class=\"px-3 py-4 text-caption text-muted-foreground text-center\"\n >\n {{ loc.phoneInput.noResults }}\n </li>\n <li\n v-for=\"(c, i) in filteredCountries\"\n :key=\"c.iso\"\n :id=\"optionId(c.iso)\"\n role=\"option\"\n :aria-selected=\"c.iso === activeIso\"\n :class=\"[\n 'flex items-center gap-2.5 px-3 py-2 text-body cursor-pointer select-none',\n 'transition-colors duration-fast ease-standard',\n ['text-foreground', optionHover],\n i === activeIndex ? optionSurface : '',\n c.iso === activeIso ? 'font-medium' : '',\n ]\"\n @pointerenter=\"activeIndex = i\"\n @click=\"selectCountry(c)\"\n >\n <span aria-hidden=\"true\" class=\"text-base leading-none shrink-0\">\n {{ countryFlag(c.iso) }}\n </span>\n <span class=\"flex-1 min-w-0 truncate text-foreground\">{{\n c.name\n }}</span>\n <span\n class=\"shrink-0 tabular-nums text-muted-foreground text-[11px]\"\n >\n +{{ c.dial }}\n </span>\n <CheckIcon\n v-if=\"c.iso === activeIso\"\n :class=\"['w-4 h-4 shrink-0', checkColorClass]\"\n aria-hidden=\"true\"\n />\n </li>\n </ul>\n </div>\n </PopoverPanel>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, nextTick, ref, useId, watch } from \"vue\";\nimport type { PhoneInput } from \"../../interfaces/forms/PhoneInput.interface\";\nimport {\n PHONE_COUNTRIES,\n countryFlag,\n findCountryByIso,\n type PhoneCountry,\n} from \"../../data/phoneCountries\";\nimport {\n useFieldState,\n useFieldClasses,\n FIELD_AFFORDANCE_ICON_BY_COLOR,\n FIELD_AFFORDANCE_ACTION_BY_COLOR,\n} from \"../../composables/useField\";\nimport { usePopover } from \"../../composables/usePopover\";\nimport {\n useResolvedSize,\n useSizeTokens,\n useModoLocale,\n} from \"../../composables/useModoConfig\";\nimport PopoverPanel from \"../layout/PopoverPanel.vue\";\nimport Typography from \"../data-display/Typography.vue\";\nimport Loader from \"../feedback/Loader.vue\";\nimport Button from \"./Button.vue\";\nimport {\n ChevronDownIcon,\n MagnifyingGlassIcon,\n XMarkIcon,\n CheckIcon,\n} from \"@heroicons/vue/24/outline\";\n\nconst loc = useModoLocale();\n\nconst emit = defineEmits<{\n \"update:modelValue\": [value: string];\n \"update:country\": [iso: string];\n change: [value: string];\n focus: [event: FocusEvent];\n blur: [event: FocusEvent];\n}>();\n\nconst props = withDefaults(defineProps<PhoneInput>(), {\n defaultCountry: \"US\",\n format: \"national\",\n variant: \"outline\",\n color: \"default\",\n disabled: false,\n readonly: false,\n required: false,\n loading: false,\n fullWidth: false,\n autofocus: false,\n});\n\nconst resolvedSize = useResolvedSize(() => props.size);\nconst sz = useSizeTokens(() => props.size);\n\n// ── Refs ──────────────────────────────────────────────────────────────────────\nconst inputRef = ref<HTMLInputElement | null>(null);\nconst searchEl = ref<HTMLInputElement | null>(null);\nconst listEl = ref<HTMLElement | null>(null);\nconst wrapperEl = ref<HTMLElement | null>(null);\nconst dropdownWidth = ref(\"\");\n\n// ── Internal state ────────────────────────────────────────────────────────────\nconst localNumber = ref(\"\");\nconst internalCountry = ref((props.defaultCountry ?? \"US\").toUpperCase());\n\n// ── Field state ───────────────────────────────────────────────────────────────\nconst {\n fieldId,\n radius,\n stateColor,\n hasError,\n isDisabled,\n errorId,\n helperId,\n describedBy,\n} = useFieldState(props, {\n componentName: \"PhoneInput\",\n idPrefix: \"modo-phone\",\n});\n\nconst { wrapperVariantClasses, radiusClasses } = useFieldClasses({\n variant: () => props.variant,\n stateColor,\n hasError,\n radius,\n forceFocus: () => isOpen.value,\n halo: () => props.halo,\n});\n\n// ── Country resolution ────────────────────────────────────────────────────────\nconst activeIso = computed(() =>\n (props.country !== undefined\n ? props.country\n : internalCountry.value\n ).toUpperCase(),\n);\nconst selectedCountry = computed(() => findCountryByIso(activeIso.value));\n\n// ── Format helpers ────────────────────────────────────────────────────────────\nfunction buildValue(local: string, dialCode: string): string {\n const fmt = props.format ?? \"national\";\n if (fmt === \"e164\") return `+${dialCode}${local.replace(/\\D/g, \"\")}`;\n if (fmt === \"international\") return `+${dialCode}${local}`;\n return local;\n}\n\nfunction extractNational(v: string | undefined, dialCode: string): string {\n if (!v) return \"\";\n const prefix = `+${dialCode}`;\n if (v.startsWith(prefix)) return v.slice(prefix.length);\n return v;\n}\n\nconst currentFormValue = computed(() =>\n selectedCountry.value\n ? buildValue(localNumber.value, selectedCountry.value.dial)\n : localNumber.value,\n);\n\n// Sync external modelValue → localNumber\nwatch(\n () => props.modelValue,\n (v) => {\n const dial = selectedCountry.value?.dial ?? \"\";\n const national = extractNational(v, dial);\n if (national !== localNumber.value) localNumber.value = national;\n },\n { immediate: true },\n);\n\n// ── Popover ───────────────────────────────────────────────────────────────────\nconst {\n triggerRef,\n panelRef,\n isOpen,\n panelStyle,\n open: openPopover,\n close: closePopover,\n toggle: togglePopover,\n} = usePopover({\n placement: \"bottom-start\",\n onOpen: () => {\n dropdownWidth.value = wrapperEl.value\n ? `${wrapperEl.value.getBoundingClientRect().width}px`\n : \"260px\";\n searchQuery.value = \"\";\n activeIndex.value = Math.max(\n 0,\n filteredCountries.value.findIndex((c) => c.iso === activeIso.value),\n );\n nextTick(() => {\n searchEl.value?.focus();\n scrollActiveIntoView();\n });\n },\n onClose: () => {\n searchQuery.value = \"\";\n activeIndex.value = -1;\n },\n});\n\nconst mergedPanelStyle = computed(() => ({\n ...panelStyle.value,\n ...(dropdownWidth.value ? { width: dropdownWidth.value } : {}),\n}));\n\n// ── Search + filtered list ────────────────────────────────────────────────────\nconst searchQuery = ref(\"\");\nconst activeIndex = ref(-1);\nconst autoListboxId = useId();\n\nconst optionId = (iso: string) =>\n `modo-phone-listbox-${autoListboxId}-opt-${iso}`;\n\nconst filteredCountries = computed<PhoneCountry[]>(() => {\n const q = searchQuery.value.trim().toLowerCase();\n if (!q) return PHONE_COUNTRIES as unknown as PhoneCountry[];\n return (PHONE_COUNTRIES as unknown as PhoneCountry[]).filter(\n (c) =>\n c.name.toLowerCase().includes(q) ||\n c.iso.toLowerCase().includes(q) ||\n c.dial.startsWith(q.replace(/^\\+/, \"\")),\n );\n});\n\nwatch(filteredCountries, (list) => {\n const idx = list.findIndex((c) => c.iso === activeIso.value);\n activeIndex.value = idx >= 0 ? idx : 0;\n});\n\n// ── Option styles ─────────────────────────────────────────────────────────────\nconst OPTION_SURFACE: Record<string, string> = {\n default: \"bg-muted\",\n primary: \"bg-primary/10\",\n danger: \"bg-destructive/10\",\n success: \"bg-success/10\",\n warning: \"bg-warning/10\",\n};\nconst OPTION_HOVER: Record<string, string> = {\n default: \"hover:bg-muted\",\n primary: \"hover:bg-primary/10\",\n danger: \"hover:bg-destructive/10\",\n success: \"hover:bg-success/10\",\n warning: \"hover:bg-warning/10\",\n};\nconst optionSurface = computed(\n () => OPTION_SURFACE[stateColor.value] ?? \"bg-muted\",\n);\nconst optionHover = computed(\n () => OPTION_HOVER[stateColor.value] ?? \"hover:bg-muted\",\n);\nconst CHECK_COLOR_BY_STATE: 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 checkColorClass = computed(\n () => CHECK_COLOR_BY_STATE[stateColor.value] ?? \"text-foreground\",\n);\nconst affordanceIconClass = computed(\n () =>\n FIELD_AFFORDANCE_ICON_BY_COLOR[stateColor.value] ?? \"text-muted-foreground\",\n);\nconst affordanceActionClass = computed(\n () =>\n FIELD_AFFORDANCE_ACTION_BY_COLOR[stateColor.value] ??\n \"text-muted-foreground hover:text-foreground\",\n);\n\n// ── Size classes ──────────────────────────────────────────────────────────────\nconst wrapperHeightClass = computed(() => {\n // sz.value.padX is e.g. \"px-2.5\" — convert to pr-* for the wrapper right edge\n const pr = sz.value.padX.replace(\"px-\", \"pr-\");\n return `${sz.value.control} ${pr}`;\n});\n\nconst triggerPaddingClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"pl-2.5 pr-1.5 gap-1\";\n case \"large\":\n return \"pl-4 pr-2 gap-1.5\";\n default:\n return \"pl-3 pr-2 gap-1\";\n }\n});\n\nconst flagSizeClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"text-sm\";\n case \"large\":\n return \"text-xl\";\n default:\n return \"text-base\";\n }\n});\n\nconst triggerTextClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"text-[11px]\";\n case \"large\":\n return \"text-body\";\n default:\n return \"text-caption\";\n }\n});\n\nconst chevronSizeClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"w-3 h-3\";\n case \"large\":\n return \"w-4 h-4\";\n default:\n return \"w-3.5 h-3.5\";\n }\n});\n\nconst inputTextClass = computed(() => sz.value.text);\n\nconst inputPaddingClass = computed(() => {\n // pr-3 leaves a comfortable gap on the right edge as well; the\n // legacy showroom relied on the field-native default padding which\n // we override here. Without pl-3 numbers visually butt up against\n // the country trigger divider.\n return \"pl-3 pr-3\";\n});\n\n// ── Event handlers ────────────────────────────────────────────────────────────\nfunction onInput(e: Event) {\n const val = (e.target as HTMLInputElement).value;\n localNumber.value = val;\n emit(\"update:modelValue\", buildValue(val, selectedCountry.value?.dial ?? \"\"));\n}\n\nfunction onChange(e: Event) {\n const val = (e.target as HTMLInputElement).value;\n emit(\"change\", buildValue(val, selectedCountry.value?.dial ?? \"\"));\n}\n\nfunction selectCountry(c: PhoneCountry) {\n if (props.country === undefined) internalCountry.value = c.iso;\n emit(\"update:country\", c.iso);\n emit(\"update:modelValue\", buildValue(localNumber.value, c.dial));\n closePopover();\n nextTick(() => inputRef.value?.focus());\n}\n\nfunction onTriggerClick() {\n if (isDisabled.value || props.readonly) return;\n togglePopover();\n}\n\nfunction onTriggerKeydown(e: KeyboardEvent) {\n if (isDisabled.value || props.readonly) return;\n if (e.key === \"ArrowDown\" || e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n if (!isOpen.value) openPopover();\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n closePopover();\n }\n}\n\nfunction onSearchKeydown(e: KeyboardEvent) {\n const list = filteredCountries.value;\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n activeIndex.value = Math.min(activeIndex.value + 1, list.length - 1);\n scrollActiveIntoView();\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n activeIndex.value = Math.max(activeIndex.value - 1, 0);\n scrollActiveIntoView();\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n const c = list[activeIndex.value];\n if (c) selectCountry(c);\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n closePopover();\n triggerRef.value?.focus?.();\n } else if (e.key === \"Tab\") {\n // The search field lives inside a panel teleported to <body>, i.e. at the\n // very end of the document. Letting the browser resolve Tab from there\n // walks *past* the whole field — the number input sits earlier in the DOM\n // and is never reached — so focus landed on whatever followed the panel\n // while the panel was unmounting. Drive the destination explicitly:\n // forwards continues into the number input, backwards returns to the flag\n // trigger, which is the order the field reads in.\n e.preventDefault();\n closePopover();\n if (e.shiftKey) triggerRef.value?.focus?.();\n else inputRef.value?.focus();\n }\n}\n\nfunction scrollActiveIntoView() {\n nextTick(() => {\n const c = filteredCountries.value[activeIndex.value];\n if (!c || !listEl.value) return;\n const el = document.getElementById(optionId(c.iso));\n el?.scrollIntoView({ block: \"nearest\" });\n });\n}\n\n// ── Expose ────────────────────────────────────────────────────────────────────\ndefineExpose({\n focus: () => inputRef.value?.focus(),\n blur: () => inputRef.value?.blur(),\n inputRef,\n});\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuQA,MAAM,MAAM,sBAAA,eAAe;EAE3B,MAAM,OAAO;EAQb,MAAM,QAAQ;EAad,MAAM,eAAe,sBAAA,sBAAsB,MAAM,KAAK;EACtD,MAAM,KAAK,sBAAA,oBAAoB,MAAM,KAAK;EAG1C,MAAM,YAAA,GAAA,IAAA,KAAwC,KAAK;EACnD,MAAM,YAAA,GAAA,IAAA,KAAwC,KAAK;EACnD,MAAM,UAAA,GAAA,IAAA,KAAiC,KAAK;EAC5C,MAAM,aAAA,GAAA,IAAA,KAAoC,KAAK;EAC/C,MAAM,iBAAA,GAAA,IAAA,KAAoB,GAAG;EAG7B,MAAM,eAAA,GAAA,IAAA,KAAkB,GAAG;EAC3B,MAAM,mBAAA,GAAA,IAAA,MAAuB,MAAM,kBAAkB,MAAM,aAAa,CAAC;EAGzE,MAAM,EACJ,SACA,QACA,YACA,UACA,YACA,SACA,UACA,gBACE,iBAAA,cAAc,OAAO;GACvB,eAAe;GACf,UAAU;GACX,CAAC;EAEF,MAAM,EAAE,uBAAuB,kBAAkB,iBAAA,gBAAgB;GAC/D,eAAe,MAAM;GACrB;GACA;GACA;GACA,kBAAkB,OAAO;GACzB,YAAY,MAAM;GACnB,CAAC;EAGF,MAAM,aAAA,GAAA,IAAA,iBACH,MAAM,YAAY,KAAA,IACf,MAAM,UACN,gBAAgB,OAClB,aAAa,CAChB;EACD,MAA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CAAC,EAAE,IAAG,CAAA,EAAA,EAAA;mCAIb,QAFT,cAAA,GAAA,IAAA,iBACE,EAAE,KAAI,EAAA,EAAA;mCAMD,QAJP,aAEC,QAAA,GAAA,IAAA,iBACK,EAAE,KAAI,EAAA,EAAA;OAGJ,EAAE,QAAQ,UAAA,UAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,cAAA,GAAA,IAAA,OAGhB,0BAAA,UAAA,EAAA;;QAFC,QAAA,GAAA,IAAA,gBAAK,CAAA,oBAAuB,gBAAA,MAAe,CAAA;QAC5C,eAAY"}
@@ -304,7 +304,12 @@ var PhoneInput_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
304
304
  e.preventDefault();
305
305
  closePopover();
306
306
  triggerRef.value?.focus?.();
307
- } else if (e.key === "Tab") closePopover();
307
+ } else if (e.key === "Tab") {
308
+ e.preventDefault();
309
+ closePopover();
310
+ if (e.shiftKey) triggerRef.value?.focus?.();
311
+ else inputRef.value?.focus();
312
+ }
308
313
  }
309
314
  function scrollActiveIntoView() {
310
315
  nextTick(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"PhoneInput.vue_vue_type_script_setup_true_lang.mjs","names":["$emit"],"sources":["../../../src/components/forms/PhoneInput.vue"],"sourcesContent":["<template>\n <div :class=\"['flex flex-col gap-1.5', fullWidth ? 'w-full' : 'inline-flex']\">\n <!-- Label -->\n <label\n v-if=\"label\"\n :for=\"fieldId\"\n class=\"text-caption font-medium text-foreground\"\n >\n {{ label }}\n <span v-if=\"required\" aria-hidden=\"true\" class=\"text-destructive ml-0.5\"\n >*</span\n >\n </label>\n\n <!-- Unified field wrapper -->\n <div\n ref=\"wrapperEl\"\n :class=\"[\n 'modo-field-wrapper flex items-center overflow-hidden',\n wrapperVariantClasses,\n wrapperHeightClass,\n radiusClasses,\n fullWidth ? 'w-full' : '',\n isDisabled ? 'opacity-60 cursor-not-allowed' : '',\n ]\"\n >\n <!-- Country selector trigger -->\n <button\n ref=\"triggerRef\"\n type=\"button\"\n :disabled=\"isDisabled || readonly\"\n :aria-label=\"loc.phoneInput.selectCountry\"\n :aria-expanded=\"isOpen\"\n :aria-haspopup=\"'listbox'\"\n :class=\"[\n 'flex items-center self-stretch shrink-0 select-none',\n 'transition-colors duration-fast ease-standard',\n triggerPaddingClass,\n isDisabled || readonly ? 'cursor-not-allowed' : 'cursor-pointer',\n ]\"\n @click=\"onTriggerClick\"\n @keydown=\"onTriggerKeydown\"\n >\n <span\n aria-hidden=\"true\"\n :class=\"['leading-none shrink-0', flagSizeClass]\"\n >\n {{ selectedCountry ? countryFlag(selectedCountry.iso) : \"🌐\" }}\n </span>\n <span\n :class=\"[\n 'tabular-nums text-muted-foreground font-medium shrink-0',\n triggerTextClass,\n ]\"\n >\n +{{ selectedCountry?.dial ?? \"?\" }}\n </span>\n <ChevronDownIcon\n aria-hidden=\"true\"\n :class=\"[\n 'shrink-0 transition-transform duration-base ease-standard',\n affordanceIconClass,\n chevronSizeClass,\n isOpen ? 'rotate-180' : '',\n ]\"\n />\n </button>\n\n <!-- Vertical divider -->\n <div aria-hidden=\"true\" class=\"w-px self-stretch bg-border shrink-0\" />\n\n <!-- Phone number input -->\n <input\n :id=\"fieldId\"\n ref=\"inputRef\"\n type=\"tel\"\n inputmode=\"tel\"\n :value=\"localNumber\"\n :placeholder=\"placeholder ?? ''\"\n :disabled=\"isDisabled\"\n :readonly=\"readonly\"\n :required=\"required\"\n :name=\"name ? `${name}-local` : undefined\"\n :autocomplete=\"autocomplete ?? 'tel-national'\"\n :autofocus=\"autofocus\"\n :aria-label=\"!label ? (ariaLabel ?? undefined) : undefined\"\n :aria-invalid=\"hasError || undefined\"\n :aria-describedby=\"describedBy\"\n :aria-required=\"required || undefined\"\n :class=\"[\n 'modo-field-native flex-1 min-w-0 bg-transparent',\n 'text-foreground placeholder:text-muted-foreground',\n 'disabled:cursor-not-allowed',\n inputTextClass,\n inputPaddingClass,\n ]\"\n @input=\"onInput\"\n @change=\"onChange\"\n @focus=\"$emit('focus', $event)\"\n @blur=\"$emit('blur', $event)\"\n />\n\n <!-- Loading spinner -->\n <Loader\n v-if=\"loading\"\n :size=\"resolvedSize === 'large' ? 'medium' : 'small'\"\n :class=\"['shrink-0', affordanceIconClass]\"\n />\n </div>\n\n <!-- Hidden input carrying the full formatted value for form submission -->\n <input v-if=\"name\" type=\"hidden\" :name=\"name\" :value=\"currentFormValue\" />\n\n <!-- Error / helper text -->\n <div v-if=\"errorText || helperText\" class=\"flex items-start gap-2\">\n <Typography\n v-if=\"errorText\"\n :id=\"errorId\"\n variant=\"caption\"\n size=\"medium\"\n color=\"danger\"\n as=\"p\"\n >\n {{ errorText }}\n </Typography>\n <Typography\n v-else-if=\"helperText\"\n :id=\"helperId\"\n variant=\"caption\"\n size=\"medium\"\n color=\"muted\"\n as=\"p\"\n >\n {{ helperText }}\n </Typography>\n </div>\n\n <!-- Country dropdown -->\n <PopoverPanel\n :open=\"isOpen\"\n :style=\"mergedPanelStyle\"\n :radius=\"radius\"\n role=\"listbox\"\n :labelledBy=\"fieldId\"\n @update:panelRef=\"panelRef = $event\"\n >\n <div style=\"max-height: 296px\" class=\"flex flex-col\">\n <!-- Search input -->\n <div class=\"px-3 border-b border-border shrink-0\">\n <div class=\"flex items-center gap-2 h-7\">\n <MagnifyingGlassIcon\n class=\"w-4 h-4 shrink-0 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n <input\n ref=\"searchEl\"\n v-model=\"searchQuery\"\n type=\"text\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n :placeholder=\"loc.phoneInput.searchCountry\"\n class=\"modo-field-native flex-1 min-w-0 bg-transparent p-0 text-caption text-foreground placeholder:text-muted-foreground\"\n @keydown=\"onSearchKeydown\"\n />\n <Button\n v-if=\"searchQuery\"\n variant=\"text\"\n size=\"xs\"\n radius=\"full\"\n :icon=\"XMarkIcon\"\n :ariaLabel=\"loc.common.clear\"\n tabindex=\"-1\"\n :class=\"['shrink-0', affordanceActionClass]\"\n @click=\"searchQuery = ''\"\n />\n </div>\n </div>\n\n <!-- Countries list -->\n <ul\n ref=\"listEl\"\n role=\"listbox\"\n class=\"modo-stagger flex-1 overflow-y-auto w-full\"\n style=\"min-height: 2.5rem\"\n tabindex=\"-1\"\n >\n <li\n v-if=\"filteredCountries.length === 0\"\n class=\"px-3 py-4 text-caption text-muted-foreground text-center\"\n >\n {{ loc.phoneInput.noResults }}\n </li>\n <li\n v-for=\"(c, i) in filteredCountries\"\n :key=\"c.iso\"\n :id=\"optionId(c.iso)\"\n role=\"option\"\n :aria-selected=\"c.iso === activeIso\"\n :class=\"[\n 'flex items-center gap-2.5 px-3 py-2 text-body cursor-pointer select-none',\n 'transition-colors duration-fast ease-standard',\n ['text-foreground', optionHover],\n i === activeIndex ? optionSurface : '',\n c.iso === activeIso ? 'font-medium' : '',\n ]\"\n @pointerenter=\"activeIndex = i\"\n @click=\"selectCountry(c)\"\n >\n <span aria-hidden=\"true\" class=\"text-base leading-none shrink-0\">\n {{ countryFlag(c.iso) }}\n </span>\n <span class=\"flex-1 min-w-0 truncate text-foreground\">{{\n c.name\n }}</span>\n <span\n class=\"shrink-0 tabular-nums text-muted-foreground text-[11px]\"\n >\n +{{ c.dial }}\n </span>\n <CheckIcon\n v-if=\"c.iso === activeIso\"\n :class=\"['w-4 h-4 shrink-0', checkColorClass]\"\n aria-hidden=\"true\"\n />\n </li>\n </ul>\n </div>\n </PopoverPanel>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, nextTick, ref, useId, watch } from \"vue\";\nimport type { PhoneInput } from \"../../interfaces/forms/PhoneInput.interface\";\nimport {\n PHONE_COUNTRIES,\n countryFlag,\n findCountryByIso,\n type PhoneCountry,\n} from \"../../data/phoneCountries\";\nimport {\n useFieldState,\n useFieldClasses,\n FIELD_AFFORDANCE_ICON_BY_COLOR,\n FIELD_AFFORDANCE_ACTION_BY_COLOR,\n} from \"../../composables/useField\";\nimport { usePopover } from \"../../composables/usePopover\";\nimport {\n useResolvedSize,\n useSizeTokens,\n useModoLocale,\n} from \"../../composables/useModoConfig\";\nimport PopoverPanel from \"../layout/PopoverPanel.vue\";\nimport Typography from \"../data-display/Typography.vue\";\nimport Loader from \"../feedback/Loader.vue\";\nimport Button from \"./Button.vue\";\nimport {\n ChevronDownIcon,\n MagnifyingGlassIcon,\n XMarkIcon,\n CheckIcon,\n} from \"@heroicons/vue/24/outline\";\n\nconst loc = useModoLocale();\n\nconst emit = defineEmits<{\n \"update:modelValue\": [value: string];\n \"update:country\": [iso: string];\n change: [value: string];\n focus: [event: FocusEvent];\n blur: [event: FocusEvent];\n}>();\n\nconst props = withDefaults(defineProps<PhoneInput>(), {\n defaultCountry: \"US\",\n format: \"national\",\n variant: \"outline\",\n color: \"default\",\n disabled: false,\n readonly: false,\n required: false,\n loading: false,\n fullWidth: false,\n autofocus: false,\n});\n\nconst resolvedSize = useResolvedSize(() => props.size);\nconst sz = useSizeTokens(() => props.size);\n\n// ── Refs ──────────────────────────────────────────────────────────────────────\nconst inputRef = ref<HTMLInputElement | null>(null);\nconst searchEl = ref<HTMLInputElement | null>(null);\nconst listEl = ref<HTMLElement | null>(null);\nconst wrapperEl = ref<HTMLElement | null>(null);\nconst dropdownWidth = ref(\"\");\n\n// ── Internal state ────────────────────────────────────────────────────────────\nconst localNumber = ref(\"\");\nconst internalCountry = ref((props.defaultCountry ?? \"US\").toUpperCase());\n\n// ── Field state ───────────────────────────────────────────────────────────────\nconst {\n fieldId,\n radius,\n stateColor,\n hasError,\n isDisabled,\n errorId,\n helperId,\n describedBy,\n} = useFieldState(props, {\n componentName: \"PhoneInput\",\n idPrefix: \"modo-phone\",\n});\n\nconst { wrapperVariantClasses, radiusClasses } = useFieldClasses({\n variant: () => props.variant,\n stateColor,\n hasError,\n radius,\n forceFocus: () => isOpen.value,\n halo: () => props.halo,\n});\n\n// ── Country resolution ────────────────────────────────────────────────────────\nconst activeIso = computed(() =>\n (props.country !== undefined\n ? props.country\n : internalCountry.value\n ).toUpperCase(),\n);\nconst selectedCountry = computed(() => findCountryByIso(activeIso.value));\n\n// ── Format helpers ────────────────────────────────────────────────────────────\nfunction buildValue(local: string, dialCode: string): string {\n const fmt = props.format ?? \"national\";\n if (fmt === \"e164\") return `+${dialCode}${local.replace(/\\D/g, \"\")}`;\n if (fmt === \"international\") return `+${dialCode}${local}`;\n return local;\n}\n\nfunction extractNational(v: string | undefined, dialCode: string): string {\n if (!v) return \"\";\n const prefix = `+${dialCode}`;\n if (v.startsWith(prefix)) return v.slice(prefix.length);\n return v;\n}\n\nconst currentFormValue = computed(() =>\n selectedCountry.value\n ? buildValue(localNumber.value, selectedCountry.value.dial)\n : localNumber.value,\n);\n\n// Sync external modelValue → localNumber\nwatch(\n () => props.modelValue,\n (v) => {\n const dial = selectedCountry.value?.dial ?? \"\";\n const national = extractNational(v, dial);\n if (national !== localNumber.value) localNumber.value = national;\n },\n { immediate: true },\n);\n\n// ── Popover ───────────────────────────────────────────────────────────────────\nconst {\n triggerRef,\n panelRef,\n isOpen,\n panelStyle,\n open: openPopover,\n close: closePopover,\n toggle: togglePopover,\n} = usePopover({\n placement: \"bottom-start\",\n onOpen: () => {\n dropdownWidth.value = wrapperEl.value\n ? `${wrapperEl.value.getBoundingClientRect().width}px`\n : \"260px\";\n searchQuery.value = \"\";\n activeIndex.value = Math.max(\n 0,\n filteredCountries.value.findIndex((c) => c.iso === activeIso.value),\n );\n nextTick(() => {\n searchEl.value?.focus();\n scrollActiveIntoView();\n });\n },\n onClose: () => {\n searchQuery.value = \"\";\n activeIndex.value = -1;\n },\n});\n\nconst mergedPanelStyle = computed(() => ({\n ...panelStyle.value,\n ...(dropdownWidth.value ? { width: dropdownWidth.value } : {}),\n}));\n\n// ── Search + filtered list ────────────────────────────────────────────────────\nconst searchQuery = ref(\"\");\nconst activeIndex = ref(-1);\nconst autoListboxId = useId();\n\nconst optionId = (iso: string) =>\n `modo-phone-listbox-${autoListboxId}-opt-${iso}`;\n\nconst filteredCountries = computed<PhoneCountry[]>(() => {\n const q = searchQuery.value.trim().toLowerCase();\n if (!q) return PHONE_COUNTRIES as unknown as PhoneCountry[];\n return (PHONE_COUNTRIES as unknown as PhoneCountry[]).filter(\n (c) =>\n c.name.toLowerCase().includes(q) ||\n c.iso.toLowerCase().includes(q) ||\n c.dial.startsWith(q.replace(/^\\+/, \"\")),\n );\n});\n\nwatch(filteredCountries, (list) => {\n const idx = list.findIndex((c) => c.iso === activeIso.value);\n activeIndex.value = idx >= 0 ? idx : 0;\n});\n\n// ── Option styles ─────────────────────────────────────────────────────────────\nconst OPTION_SURFACE: Record<string, string> = {\n default: \"bg-muted\",\n primary: \"bg-primary/10\",\n danger: \"bg-destructive/10\",\n success: \"bg-success/10\",\n warning: \"bg-warning/10\",\n};\nconst OPTION_HOVER: Record<string, string> = {\n default: \"hover:bg-muted\",\n primary: \"hover:bg-primary/10\",\n danger: \"hover:bg-destructive/10\",\n success: \"hover:bg-success/10\",\n warning: \"hover:bg-warning/10\",\n};\nconst optionSurface = computed(\n () => OPTION_SURFACE[stateColor.value] ?? \"bg-muted\",\n);\nconst optionHover = computed(\n () => OPTION_HOVER[stateColor.value] ?? \"hover:bg-muted\",\n);\nconst CHECK_COLOR_BY_STATE: 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 checkColorClass = computed(\n () => CHECK_COLOR_BY_STATE[stateColor.value] ?? \"text-foreground\",\n);\nconst affordanceIconClass = computed(\n () =>\n FIELD_AFFORDANCE_ICON_BY_COLOR[stateColor.value] ?? \"text-muted-foreground\",\n);\nconst affordanceActionClass = computed(\n () =>\n FIELD_AFFORDANCE_ACTION_BY_COLOR[stateColor.value] ??\n \"text-muted-foreground hover:text-foreground\",\n);\n\n// ── Size classes ──────────────────────────────────────────────────────────────\nconst wrapperHeightClass = computed(() => {\n // sz.value.padX is e.g. \"px-2.5\" — convert to pr-* for the wrapper right edge\n const pr = sz.value.padX.replace(\"px-\", \"pr-\");\n return `${sz.value.control} ${pr}`;\n});\n\nconst triggerPaddingClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"pl-2.5 pr-1.5 gap-1\";\n case \"large\":\n return \"pl-4 pr-2 gap-1.5\";\n default:\n return \"pl-3 pr-2 gap-1\";\n }\n});\n\nconst flagSizeClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"text-sm\";\n case \"large\":\n return \"text-xl\";\n default:\n return \"text-base\";\n }\n});\n\nconst triggerTextClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"text-[11px]\";\n case \"large\":\n return \"text-body\";\n default:\n return \"text-caption\";\n }\n});\n\nconst chevronSizeClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"w-3 h-3\";\n case \"large\":\n return \"w-4 h-4\";\n default:\n return \"w-3.5 h-3.5\";\n }\n});\n\nconst inputTextClass = computed(() => sz.value.text);\n\nconst inputPaddingClass = computed(() => {\n // pr-3 leaves a comfortable gap on the right edge as well; the\n // legacy showroom relied on the field-native default padding which\n // we override here. Without pl-3 numbers visually butt up against\n // the country trigger divider.\n return \"pl-3 pr-3\";\n});\n\n// ── Event handlers ────────────────────────────────────────────────────────────\nfunction onInput(e: Event) {\n const val = (e.target as HTMLInputElement).value;\n localNumber.value = val;\n emit(\"update:modelValue\", buildValue(val, selectedCountry.value?.dial ?? \"\"));\n}\n\nfunction onChange(e: Event) {\n const val = (e.target as HTMLInputElement).value;\n emit(\"change\", buildValue(val, selectedCountry.value?.dial ?? \"\"));\n}\n\nfunction selectCountry(c: PhoneCountry) {\n if (props.country === undefined) internalCountry.value = c.iso;\n emit(\"update:country\", c.iso);\n emit(\"update:modelValue\", buildValue(localNumber.value, c.dial));\n closePopover();\n nextTick(() => inputRef.value?.focus());\n}\n\nfunction onTriggerClick() {\n if (isDisabled.value || props.readonly) return;\n togglePopover();\n}\n\nfunction onTriggerKeydown(e: KeyboardEvent) {\n if (isDisabled.value || props.readonly) return;\n if (e.key === \"ArrowDown\" || e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n if (!isOpen.value) openPopover();\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n closePopover();\n }\n}\n\nfunction onSearchKeydown(e: KeyboardEvent) {\n const list = filteredCountries.value;\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n activeIndex.value = Math.min(activeIndex.value + 1, list.length - 1);\n scrollActiveIntoView();\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n activeIndex.value = Math.max(activeIndex.value - 1, 0);\n scrollActiveIntoView();\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n const c = list[activeIndex.value];\n if (c) selectCountry(c);\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n closePopover();\n triggerRef.value?.focus?.();\n } else if (e.key === \"Tab\") {\n closePopover();\n }\n}\n\nfunction scrollActiveIntoView() {\n nextTick(() => {\n const c = filteredCountries.value[activeIndex.value];\n if (!c || !listEl.value) return;\n const el = document.getElementById(optionId(c.iso));\n el?.scrollIntoView({ block: \"nearest\" });\n });\n}\n\n// ── Expose ────────────────────────────────────────────────────────────────────\ndefineExpose({\n focus: () => inputRef.value?.focus(),\n blur: () => inputRef.value?.blur(),\n inputRef,\n});\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuQA,MAAM,MAAM,eAAe;EAE3B,MAAM,OAAO;EAQb,MAAM,QAAQ;EAad,MAAM,eAAe,sBAAsB,MAAM,KAAK;EACtD,MAAM,KAAK,oBAAoB,MAAM,KAAK;EAG1C,MAAM,WAAW,IAA6B,KAAK;EACnD,MAAM,WAAW,IAA6B,KAAK;EACnD,MAAM,SAAS,IAAwB,KAAK;EAC5C,MAAM,YAAY,IAAwB,KAAK;EAC/C,MAAM,gBAAgB,IAAI,GAAG;E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AAA,IAAA,KAAA,GAAA,UAAA,KAAA,EAE7B,mBAgCK,UAAA,MAAA,WA/Bc,kBAAA,QAAT,GAAG,MAAC;0BADd,mBAgCK,MAAA;OA9BF,KAAK,EAAE;OACP,IAAI,SAAS,EAAE,IAAG;OACnB,MAAK;OACJ,iBAAe,EAAE,QAAQ,UAAA;OACzB,OAAK,eAAA;;;4BAA+L,YAAA,MAAW;QAAiB,MAAM,YAAA,QAAc,cAAA,QAAa;QAAqB,EAAE,QAAQ,UAAA,QAAS,gBAAA;;OAOzS,iBAAY,WAAE,YAAA,QAAc;OAC5B,UAAK,WAAE,cAAc,EAAC;;OAEvB,mBAEO,QAFP,aAEO,gBADF,MAAA,YAAW,CAAC,EAAE,IAAG,CAAA,EAAA,EAAA;OAEtB,mBAES,QAFT,aAES,gBADP,EAAE,KAAI,EAAA,EAAA;OAER,mBAIO,QAJP,aAEC,OACE,gBAAG,EAAE,KAAI,EAAA,EAAA;OAGJ,EAAE,QAAQ,UAAA,SAAA,WAAA,EADlB,YAIE,MAAA,UAAA,EAAA;;QAFC,OAAK,eAAA,CAAA,oBAAuB,gBAAA,MAAe,CAAA;QAC5C,eAAY"}
1
+ {"version":3,"file":"PhoneInput.vue_vue_type_script_setup_true_lang.mjs","names":["$emit"],"sources":["../../../src/components/forms/PhoneInput.vue"],"sourcesContent":["<template>\n <div :class=\"['flex flex-col gap-1.5', fullWidth ? 'w-full' : 'inline-flex']\">\n <!-- Label -->\n <label\n v-if=\"label\"\n :for=\"fieldId\"\n class=\"text-caption font-medium text-foreground\"\n >\n {{ label }}\n <span v-if=\"required\" aria-hidden=\"true\" class=\"text-destructive ml-0.5\"\n >*</span\n >\n </label>\n\n <!-- Unified field wrapper -->\n <div\n ref=\"wrapperEl\"\n :class=\"[\n 'modo-field-wrapper flex items-center overflow-hidden',\n wrapperVariantClasses,\n wrapperHeightClass,\n radiusClasses,\n fullWidth ? 'w-full' : '',\n isDisabled ? 'opacity-60 cursor-not-allowed' : '',\n ]\"\n >\n <!-- Country selector trigger -->\n <button\n ref=\"triggerRef\"\n type=\"button\"\n :disabled=\"isDisabled || readonly\"\n :aria-label=\"loc.phoneInput.selectCountry\"\n :aria-expanded=\"isOpen\"\n :aria-haspopup=\"'listbox'\"\n :class=\"[\n 'flex items-center self-stretch shrink-0 select-none',\n 'transition-colors duration-fast ease-standard',\n triggerPaddingClass,\n isDisabled || readonly ? 'cursor-not-allowed' : 'cursor-pointer',\n ]\"\n @click=\"onTriggerClick\"\n @keydown=\"onTriggerKeydown\"\n >\n <span\n aria-hidden=\"true\"\n :class=\"['leading-none shrink-0', flagSizeClass]\"\n >\n {{ selectedCountry ? countryFlag(selectedCountry.iso) : \"🌐\" }}\n </span>\n <span\n :class=\"[\n 'tabular-nums text-muted-foreground font-medium shrink-0',\n triggerTextClass,\n ]\"\n >\n +{{ selectedCountry?.dial ?? \"?\" }}\n </span>\n <ChevronDownIcon\n aria-hidden=\"true\"\n :class=\"[\n 'shrink-0 transition-transform duration-base ease-standard',\n affordanceIconClass,\n chevronSizeClass,\n isOpen ? 'rotate-180' : '',\n ]\"\n />\n </button>\n\n <!-- Vertical divider -->\n <div aria-hidden=\"true\" class=\"w-px self-stretch bg-border shrink-0\" />\n\n <!-- Phone number input -->\n <input\n :id=\"fieldId\"\n ref=\"inputRef\"\n type=\"tel\"\n inputmode=\"tel\"\n :value=\"localNumber\"\n :placeholder=\"placeholder ?? ''\"\n :disabled=\"isDisabled\"\n :readonly=\"readonly\"\n :required=\"required\"\n :name=\"name ? `${name}-local` : undefined\"\n :autocomplete=\"autocomplete ?? 'tel-national'\"\n :autofocus=\"autofocus\"\n :aria-label=\"!label ? (ariaLabel ?? undefined) : undefined\"\n :aria-invalid=\"hasError || undefined\"\n :aria-describedby=\"describedBy\"\n :aria-required=\"required || undefined\"\n :class=\"[\n 'modo-field-native flex-1 min-w-0 bg-transparent',\n 'text-foreground placeholder:text-muted-foreground',\n 'disabled:cursor-not-allowed',\n inputTextClass,\n inputPaddingClass,\n ]\"\n @input=\"onInput\"\n @change=\"onChange\"\n @focus=\"$emit('focus', $event)\"\n @blur=\"$emit('blur', $event)\"\n />\n\n <!-- Loading spinner -->\n <Loader\n v-if=\"loading\"\n :size=\"resolvedSize === 'large' ? 'medium' : 'small'\"\n :class=\"['shrink-0', affordanceIconClass]\"\n />\n </div>\n\n <!-- Hidden input carrying the full formatted value for form submission -->\n <input v-if=\"name\" type=\"hidden\" :name=\"name\" :value=\"currentFormValue\" />\n\n <!-- Error / helper text -->\n <div v-if=\"errorText || helperText\" class=\"flex items-start gap-2\">\n <Typography\n v-if=\"errorText\"\n :id=\"errorId\"\n variant=\"caption\"\n size=\"medium\"\n color=\"danger\"\n as=\"p\"\n >\n {{ errorText }}\n </Typography>\n <Typography\n v-else-if=\"helperText\"\n :id=\"helperId\"\n variant=\"caption\"\n size=\"medium\"\n color=\"muted\"\n as=\"p\"\n >\n {{ helperText }}\n </Typography>\n </div>\n\n <!-- Country dropdown -->\n <PopoverPanel\n :open=\"isOpen\"\n :style=\"mergedPanelStyle\"\n :radius=\"radius\"\n role=\"listbox\"\n :labelledBy=\"fieldId\"\n @update:panelRef=\"panelRef = $event\"\n >\n <div style=\"max-height: 296px\" class=\"flex flex-col\">\n <!-- Search input -->\n <div class=\"px-3 border-b border-border shrink-0\">\n <div class=\"flex items-center gap-2 h-7\">\n <MagnifyingGlassIcon\n class=\"w-4 h-4 shrink-0 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n <input\n ref=\"searchEl\"\n v-model=\"searchQuery\"\n type=\"text\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n :placeholder=\"loc.phoneInput.searchCountry\"\n class=\"modo-field-native flex-1 min-w-0 bg-transparent p-0 text-caption text-foreground placeholder:text-muted-foreground\"\n @keydown=\"onSearchKeydown\"\n />\n <Button\n v-if=\"searchQuery\"\n variant=\"text\"\n size=\"xs\"\n radius=\"full\"\n :icon=\"XMarkIcon\"\n :ariaLabel=\"loc.common.clear\"\n tabindex=\"-1\"\n :class=\"['shrink-0', affordanceActionClass]\"\n @click=\"searchQuery = ''\"\n />\n </div>\n </div>\n\n <!-- Countries list -->\n <ul\n ref=\"listEl\"\n role=\"listbox\"\n class=\"modo-stagger flex-1 overflow-y-auto w-full\"\n style=\"min-height: 2.5rem\"\n tabindex=\"-1\"\n >\n <li\n v-if=\"filteredCountries.length === 0\"\n class=\"px-3 py-4 text-caption text-muted-foreground text-center\"\n >\n {{ loc.phoneInput.noResults }}\n </li>\n <li\n v-for=\"(c, i) in filteredCountries\"\n :key=\"c.iso\"\n :id=\"optionId(c.iso)\"\n role=\"option\"\n :aria-selected=\"c.iso === activeIso\"\n :class=\"[\n 'flex items-center gap-2.5 px-3 py-2 text-body cursor-pointer select-none',\n 'transition-colors duration-fast ease-standard',\n ['text-foreground', optionHover],\n i === activeIndex ? optionSurface : '',\n c.iso === activeIso ? 'font-medium' : '',\n ]\"\n @pointerenter=\"activeIndex = i\"\n @click=\"selectCountry(c)\"\n >\n <span aria-hidden=\"true\" class=\"text-base leading-none shrink-0\">\n {{ countryFlag(c.iso) }}\n </span>\n <span class=\"flex-1 min-w-0 truncate text-foreground\">{{\n c.name\n }}</span>\n <span\n class=\"shrink-0 tabular-nums text-muted-foreground text-[11px]\"\n >\n +{{ c.dial }}\n </span>\n <CheckIcon\n v-if=\"c.iso === activeIso\"\n :class=\"['w-4 h-4 shrink-0', checkColorClass]\"\n aria-hidden=\"true\"\n />\n </li>\n </ul>\n </div>\n </PopoverPanel>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, nextTick, ref, useId, watch } from \"vue\";\nimport type { PhoneInput } from \"../../interfaces/forms/PhoneInput.interface\";\nimport {\n PHONE_COUNTRIES,\n countryFlag,\n findCountryByIso,\n type PhoneCountry,\n} from \"../../data/phoneCountries\";\nimport {\n useFieldState,\n useFieldClasses,\n FIELD_AFFORDANCE_ICON_BY_COLOR,\n FIELD_AFFORDANCE_ACTION_BY_COLOR,\n} from \"../../composables/useField\";\nimport { usePopover } from \"../../composables/usePopover\";\nimport {\n useResolvedSize,\n useSizeTokens,\n useModoLocale,\n} from \"../../composables/useModoConfig\";\nimport PopoverPanel from \"../layout/PopoverPanel.vue\";\nimport Typography from \"../data-display/Typography.vue\";\nimport Loader from \"../feedback/Loader.vue\";\nimport Button from \"./Button.vue\";\nimport {\n ChevronDownIcon,\n MagnifyingGlassIcon,\n XMarkIcon,\n CheckIcon,\n} from \"@heroicons/vue/24/outline\";\n\nconst loc = useModoLocale();\n\nconst emit = defineEmits<{\n \"update:modelValue\": [value: string];\n \"update:country\": [iso: string];\n change: [value: string];\n focus: [event: FocusEvent];\n blur: [event: FocusEvent];\n}>();\n\nconst props = withDefaults(defineProps<PhoneInput>(), {\n defaultCountry: \"US\",\n format: \"national\",\n variant: \"outline\",\n color: \"default\",\n disabled: false,\n readonly: false,\n required: false,\n loading: false,\n fullWidth: false,\n autofocus: false,\n});\n\nconst resolvedSize = useResolvedSize(() => props.size);\nconst sz = useSizeTokens(() => props.size);\n\n// ── Refs ──────────────────────────────────────────────────────────────────────\nconst inputRef = ref<HTMLInputElement | null>(null);\nconst searchEl = ref<HTMLInputElement | null>(null);\nconst listEl = ref<HTMLElement | null>(null);\nconst wrapperEl = ref<HTMLElement | null>(null);\nconst dropdownWidth = ref(\"\");\n\n// ── Internal state ────────────────────────────────────────────────────────────\nconst localNumber = ref(\"\");\nconst internalCountry = ref((props.defaultCountry ?? \"US\").toUpperCase());\n\n// ── Field state ───────────────────────────────────────────────────────────────\nconst {\n fieldId,\n radius,\n stateColor,\n hasError,\n isDisabled,\n errorId,\n helperId,\n describedBy,\n} = useFieldState(props, {\n componentName: \"PhoneInput\",\n idPrefix: \"modo-phone\",\n});\n\nconst { wrapperVariantClasses, radiusClasses } = useFieldClasses({\n variant: () => props.variant,\n stateColor,\n hasError,\n radius,\n forceFocus: () => isOpen.value,\n halo: () => props.halo,\n});\n\n// ── Country resolution ────────────────────────────────────────────────────────\nconst activeIso = computed(() =>\n (props.country !== undefined\n ? props.country\n : internalCountry.value\n ).toUpperCase(),\n);\nconst selectedCountry = computed(() => findCountryByIso(activeIso.value));\n\n// ── Format helpers ────────────────────────────────────────────────────────────\nfunction buildValue(local: string, dialCode: string): string {\n const fmt = props.format ?? \"national\";\n if (fmt === \"e164\") return `+${dialCode}${local.replace(/\\D/g, \"\")}`;\n if (fmt === \"international\") return `+${dialCode}${local}`;\n return local;\n}\n\nfunction extractNational(v: string | undefined, dialCode: string): string {\n if (!v) return \"\";\n const prefix = `+${dialCode}`;\n if (v.startsWith(prefix)) return v.slice(prefix.length);\n return v;\n}\n\nconst currentFormValue = computed(() =>\n selectedCountry.value\n ? buildValue(localNumber.value, selectedCountry.value.dial)\n : localNumber.value,\n);\n\n// Sync external modelValue → localNumber\nwatch(\n () => props.modelValue,\n (v) => {\n const dial = selectedCountry.value?.dial ?? \"\";\n const national = extractNational(v, dial);\n if (national !== localNumber.value) localNumber.value = national;\n },\n { immediate: true },\n);\n\n// ── Popover ───────────────────────────────────────────────────────────────────\nconst {\n triggerRef,\n panelRef,\n isOpen,\n panelStyle,\n open: openPopover,\n close: closePopover,\n toggle: togglePopover,\n} = usePopover({\n placement: \"bottom-start\",\n onOpen: () => {\n dropdownWidth.value = wrapperEl.value\n ? `${wrapperEl.value.getBoundingClientRect().width}px`\n : \"260px\";\n searchQuery.value = \"\";\n activeIndex.value = Math.max(\n 0,\n filteredCountries.value.findIndex((c) => c.iso === activeIso.value),\n );\n nextTick(() => {\n searchEl.value?.focus();\n scrollActiveIntoView();\n });\n },\n onClose: () => {\n searchQuery.value = \"\";\n activeIndex.value = -1;\n },\n});\n\nconst mergedPanelStyle = computed(() => ({\n ...panelStyle.value,\n ...(dropdownWidth.value ? { width: dropdownWidth.value } : {}),\n}));\n\n// ── Search + filtered list ────────────────────────────────────────────────────\nconst searchQuery = ref(\"\");\nconst activeIndex = ref(-1);\nconst autoListboxId = useId();\n\nconst optionId = (iso: string) =>\n `modo-phone-listbox-${autoListboxId}-opt-${iso}`;\n\nconst filteredCountries = computed<PhoneCountry[]>(() => {\n const q = searchQuery.value.trim().toLowerCase();\n if (!q) return PHONE_COUNTRIES as unknown as PhoneCountry[];\n return (PHONE_COUNTRIES as unknown as PhoneCountry[]).filter(\n (c) =>\n c.name.toLowerCase().includes(q) ||\n c.iso.toLowerCase().includes(q) ||\n c.dial.startsWith(q.replace(/^\\+/, \"\")),\n );\n});\n\nwatch(filteredCountries, (list) => {\n const idx = list.findIndex((c) => c.iso === activeIso.value);\n activeIndex.value = idx >= 0 ? idx : 0;\n});\n\n// ── Option styles ─────────────────────────────────────────────────────────────\nconst OPTION_SURFACE: Record<string, string> = {\n default: \"bg-muted\",\n primary: \"bg-primary/10\",\n danger: \"bg-destructive/10\",\n success: \"bg-success/10\",\n warning: \"bg-warning/10\",\n};\nconst OPTION_HOVER: Record<string, string> = {\n default: \"hover:bg-muted\",\n primary: \"hover:bg-primary/10\",\n danger: \"hover:bg-destructive/10\",\n success: \"hover:bg-success/10\",\n warning: \"hover:bg-warning/10\",\n};\nconst optionSurface = computed(\n () => OPTION_SURFACE[stateColor.value] ?? \"bg-muted\",\n);\nconst optionHover = computed(\n () => OPTION_HOVER[stateColor.value] ?? \"hover:bg-muted\",\n);\nconst CHECK_COLOR_BY_STATE: 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 checkColorClass = computed(\n () => CHECK_COLOR_BY_STATE[stateColor.value] ?? \"text-foreground\",\n);\nconst affordanceIconClass = computed(\n () =>\n FIELD_AFFORDANCE_ICON_BY_COLOR[stateColor.value] ?? \"text-muted-foreground\",\n);\nconst affordanceActionClass = computed(\n () =>\n FIELD_AFFORDANCE_ACTION_BY_COLOR[stateColor.value] ??\n \"text-muted-foreground hover:text-foreground\",\n);\n\n// ── Size classes ──────────────────────────────────────────────────────────────\nconst wrapperHeightClass = computed(() => {\n // sz.value.padX is e.g. \"px-2.5\" — convert to pr-* for the wrapper right edge\n const pr = sz.value.padX.replace(\"px-\", \"pr-\");\n return `${sz.value.control} ${pr}`;\n});\n\nconst triggerPaddingClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"pl-2.5 pr-1.5 gap-1\";\n case \"large\":\n return \"pl-4 pr-2 gap-1.5\";\n default:\n return \"pl-3 pr-2 gap-1\";\n }\n});\n\nconst flagSizeClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"text-sm\";\n case \"large\":\n return \"text-xl\";\n default:\n return \"text-base\";\n }\n});\n\nconst triggerTextClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"text-[11px]\";\n case \"large\":\n return \"text-body\";\n default:\n return \"text-caption\";\n }\n});\n\nconst chevronSizeClass = computed(() => {\n switch (resolvedSize.value) {\n case \"small\":\n return \"w-3 h-3\";\n case \"large\":\n return \"w-4 h-4\";\n default:\n return \"w-3.5 h-3.5\";\n }\n});\n\nconst inputTextClass = computed(() => sz.value.text);\n\nconst inputPaddingClass = computed(() => {\n // pr-3 leaves a comfortable gap on the right edge as well; the\n // legacy showroom relied on the field-native default padding which\n // we override here. Without pl-3 numbers visually butt up against\n // the country trigger divider.\n return \"pl-3 pr-3\";\n});\n\n// ── Event handlers ────────────────────────────────────────────────────────────\nfunction onInput(e: Event) {\n const val = (e.target as HTMLInputElement).value;\n localNumber.value = val;\n emit(\"update:modelValue\", buildValue(val, selectedCountry.value?.dial ?? \"\"));\n}\n\nfunction onChange(e: Event) {\n const val = (e.target as HTMLInputElement).value;\n emit(\"change\", buildValue(val, selectedCountry.value?.dial ?? \"\"));\n}\n\nfunction selectCountry(c: PhoneCountry) {\n if (props.country === undefined) internalCountry.value = c.iso;\n emit(\"update:country\", c.iso);\n emit(\"update:modelValue\", buildValue(localNumber.value, c.dial));\n closePopover();\n nextTick(() => inputRef.value?.focus());\n}\n\nfunction onTriggerClick() {\n if (isDisabled.value || props.readonly) return;\n togglePopover();\n}\n\nfunction onTriggerKeydown(e: KeyboardEvent) {\n if (isDisabled.value || props.readonly) return;\n if (e.key === \"ArrowDown\" || e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n if (!isOpen.value) openPopover();\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n closePopover();\n }\n}\n\nfunction onSearchKeydown(e: KeyboardEvent) {\n const list = filteredCountries.value;\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n activeIndex.value = Math.min(activeIndex.value + 1, list.length - 1);\n scrollActiveIntoView();\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n activeIndex.value = Math.max(activeIndex.value - 1, 0);\n scrollActiveIntoView();\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n const c = list[activeIndex.value];\n if (c) selectCountry(c);\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n closePopover();\n triggerRef.value?.focus?.();\n } else if (e.key === \"Tab\") {\n // The search field lives inside a panel teleported to <body>, i.e. at the\n // very end of the document. Letting the browser resolve Tab from there\n // walks *past* the whole field — the number input sits earlier in the DOM\n // and is never reached — so focus landed on whatever followed the panel\n // while the panel was unmounting. Drive the destination explicitly:\n // forwards continues into the number input, backwards returns to the flag\n // trigger, which is the order the field reads in.\n e.preventDefault();\n closePopover();\n if (e.shiftKey) triggerRef.value?.focus?.();\n else inputRef.value?.focus();\n }\n}\n\nfunction scrollActiveIntoView() {\n nextTick(() => {\n const c = filteredCountries.value[activeIndex.value];\n if (!c || !listEl.value) return;\n const el = document.getElementById(optionId(c.iso));\n el?.scrollIntoView({ block: \"nearest\" });\n });\n}\n\n// ── Expose ────────────────────────────────────────────────────────────────────\ndefineExpose({\n focus: () => inputRef.value?.focus(),\n blur: () => inputRef.value?.blur(),\n inputRef,\n});\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuQ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