@wow-two-beta/fe 0.0.37 โ†’ 0.0.39

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 (73) hide show
  1. package/dist/auth/AuthSession.d.ts +25 -1
  2. package/dist/auth/AuthSession.js.map +1 -1
  3. package/dist/auth/BffSession.d.ts +55 -0
  4. package/dist/auth/BffSession.js +73 -0
  5. package/dist/auth/BffSession.js.map +1 -0
  6. package/dist/auth/BffSessionSync.d.ts +57 -0
  7. package/dist/auth/BffSessionSync.js +160 -0
  8. package/dist/auth/BffSessionSync.js.map +1 -0
  9. package/dist/auth/BffStrategy.d.ts +53 -0
  10. package/dist/auth/BffStrategy.js +95 -0
  11. package/dist/auth/BffStrategy.js.map +1 -0
  12. package/dist/auth/RedirectStrategy.js +3 -6
  13. package/dist/auth/RedirectStrategy.js.map +1 -1
  14. package/dist/auth/ReturnUrlExtensions.d.ts +7 -0
  15. package/dist/auth/ReturnUrlExtensions.js +15 -0
  16. package/dist/auth/ReturnUrlExtensions.js.map +1 -0
  17. package/dist/auth/UseBffAuth.d.ts +31 -0
  18. package/dist/auth/UseBffAuth.js +39 -0
  19. package/dist/auth/UseBffAuth.js.map +1 -0
  20. package/dist/auth/index.d.ts +5 -1
  21. package/dist/auth/index.js +11 -1
  22. package/dist/auth/index.js.map +1 -1
  23. package/dist/auth/providers/AuthProvider.vue.js +74 -5
  24. package/dist/auth/providers/AuthProvider.vue.js.map +1 -1
  25. package/dist/foundation/http/Antiforgery.d.ts +5 -0
  26. package/dist/foundation/http/Antiforgery.js.map +1 -1
  27. package/dist/foundation/http/CreateApiClient.js +1 -1
  28. package/dist/foundation/http/CreateApiClient.js.map +1 -1
  29. package/dist/foundation/phone/PhoneCountries.d.ts +13 -0
  30. package/dist/foundation/phone/PhoneCountries.js +62 -0
  31. package/dist/foundation/phone/PhoneCountries.js.map +1 -0
  32. package/dist/foundation/phone/PhoneFormats.d.ts +12 -0
  33. package/dist/foundation/phone/PhoneFormats.js +32 -0
  34. package/dist/foundation/phone/PhoneFormats.js.map +1 -0
  35. package/dist/foundation/phone/PhoneNumberExtensions.d.ts +94 -0
  36. package/dist/foundation/phone/PhoneNumberExtensions.js +137 -0
  37. package/dist/foundation/phone/PhoneNumberExtensions.js.map +1 -0
  38. package/dist/foundation/phone/index.d.ts +3 -0
  39. package/dist/foundation/phone/index.js +9 -0
  40. package/dist/foundation/phone/index.js.map +1 -0
  41. package/dist/foundation/validators/Formats.d.ts +15 -0
  42. package/dist/foundation/validators/Formats.js +32 -1
  43. package/dist/foundation/validators/Formats.js.map +1 -1
  44. package/dist/foundation/validators/Messages.d.ts +1 -1
  45. package/dist/foundation/validators/Messages.js +10 -0
  46. package/dist/foundation/validators/Messages.js.map +1 -1
  47. package/dist/foundation/validators/index.d.ts +1 -1
  48. package/dist/foundation/validators/index.js +2 -1
  49. package/dist/index.js +4 -2
  50. package/dist/index.js.map +1 -1
  51. package/dist/presentation/actions/refreshButton/RefreshButton.vue.js.map +1 -1
  52. package/dist/presentation/forms/field/Field.vue.js +10 -3
  53. package/dist/presentation/forms/field/Field.vue.js.map +1 -1
  54. package/dist/presentation/forms/index.js +2 -1
  55. package/dist/presentation/forms/index.js.map +1 -1
  56. package/dist/presentation/forms/labeledField/LabeledField.vue.js +2 -2
  57. package/dist/presentation/forms/labeledField/LabeledField.vue.js.map +1 -1
  58. package/dist/presentation/forms/phoneInput/PhoneInput.vue.d.ts +1 -9
  59. package/dist/presentation/forms/phoneInput/PhoneInput.vue.js +85 -86
  60. package/dist/presentation/forms/phoneInput/PhoneInput.vue.js.map +1 -1
  61. package/dist/presentation/forms/phoneInput/PhoneInput2.vue.js +0 -2
  62. package/dist/presentation/forms/phoneInput/PhoneInput2.vue.js.map +1 -1
  63. package/dist/presentation/forms/phoneInput/index.d.ts +2 -1
  64. package/dist/presentation/layout/navbar/Navbar.vue.js.map +1 -1
  65. package/dist/presentation/overlays/alertModal/AlertModalContent.vue.js +1 -0
  66. package/dist/presentation/overlays/alertModal/AlertModalContent.vue.js.map +1 -1
  67. package/dist/presentation/overlays/index.js +2 -1
  68. package/dist/presentation/overlays/modal/ModalContent.vue.d.ts +17 -0
  69. package/dist/presentation/overlays/modal/ModalContent.vue.js +23 -2
  70. package/dist/presentation/overlays/modal/ModalContent.vue.js.map +1 -1
  71. package/dist/presentation/overlays/modal/ModalContent2.vue.js +2 -1
  72. package/dist/presentation/overlays/modal/index.d.ts +1 -1
  73. package/package.json +6 -1
@@ -1 +1 @@
1
- {"version":3,"file":"PhoneInput.vue.js","sources":["../../../../src/presentation/forms/phoneInput/PhoneInput.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { NativeInputAttributes } from '../NativeControlAttributes';\n/** Represents one selectable dialling country. */\nexport interface PhoneCountry {\n iso: string;\n name: string;\n dial: string; // includes leading +\n flag: string; // emoji\n}\n\nexport const PhoneCountries: ReadonlyArray<PhoneCountry> = [\n { iso: 'US', name: 'United States', dial: '+1', flag: '๐Ÿ‡บ๐Ÿ‡ธ' },\n { iso: 'CA', name: 'Canada', dial: '+1', flag: '๐Ÿ‡จ๐Ÿ‡ฆ' },\n { iso: 'GB', name: 'United Kingdom', dial: '+44', flag: '๐Ÿ‡ฌ๐Ÿ‡ง' },\n { iso: 'AU', name: 'Australia', dial: '+61', flag: '๐Ÿ‡ฆ๐Ÿ‡บ' },\n { iso: 'DE', name: 'Germany', dial: '+49', flag: '๐Ÿ‡ฉ๐Ÿ‡ช' },\n { iso: 'FR', name: 'France', dial: '+33', flag: '๐Ÿ‡ซ๐Ÿ‡ท' },\n { iso: 'ES', name: 'Spain', dial: '+34', flag: '๐Ÿ‡ช๐Ÿ‡ธ' },\n { iso: 'IT', name: 'Italy', dial: '+39', flag: '๐Ÿ‡ฎ๐Ÿ‡น' },\n { iso: 'NL', name: 'Netherlands', dial: '+31', flag: '๐Ÿ‡ณ๐Ÿ‡ฑ' },\n { iso: 'BE', name: 'Belgium', dial: '+32', flag: '๐Ÿ‡ง๐Ÿ‡ช' },\n { iso: 'CH', name: 'Switzerland', dial: '+41', flag: '๐Ÿ‡จ๐Ÿ‡ญ' },\n { iso: 'AT', name: 'Austria', dial: '+43', flag: '๐Ÿ‡ฆ๐Ÿ‡น' },\n { iso: 'SE', name: 'Sweden', dial: '+46', flag: '๐Ÿ‡ธ๐Ÿ‡ช' },\n { iso: 'NO', name: 'Norway', dial: '+47', flag: '๐Ÿ‡ณ๐Ÿ‡ด' },\n { iso: 'DK', name: 'Denmark', dial: '+45', flag: '๐Ÿ‡ฉ๐Ÿ‡ฐ' },\n { iso: 'FI', name: 'Finland', dial: '+358', flag: '๐Ÿ‡ซ๐Ÿ‡ฎ' },\n { iso: 'IE', name: 'Ireland', dial: '+353', flag: '๐Ÿ‡ฎ๐Ÿ‡ช' },\n { iso: 'PT', name: 'Portugal', dial: '+351', flag: '๐Ÿ‡ต๐Ÿ‡น' },\n { iso: 'PL', name: 'Poland', dial: '+48', flag: '๐Ÿ‡ต๐Ÿ‡ฑ' },\n { iso: 'CZ', name: 'Czechia', dial: '+420', flag: '๐Ÿ‡จ๐Ÿ‡ฟ' },\n { iso: 'GR', name: 'Greece', dial: '+30', flag: '๐Ÿ‡ฌ๐Ÿ‡ท' },\n { iso: 'TR', name: 'Tรผrkiye', dial: '+90', flag: '๐Ÿ‡น๐Ÿ‡ท' },\n { iso: 'RU', name: 'Russia', dial: '+7', flag: '๐Ÿ‡ท๐Ÿ‡บ' },\n { iso: 'UA', name: 'Ukraine', dial: '+380', flag: '๐Ÿ‡บ๐Ÿ‡ฆ' },\n { iso: 'UZ', name: 'Uzbekistan', dial: '+998', flag: '๐Ÿ‡บ๐Ÿ‡ฟ' },\n { iso: 'KZ', name: 'Kazakhstan', dial: '+7', flag: '๐Ÿ‡ฐ๐Ÿ‡ฟ' },\n { iso: 'KG', name: 'Kyrgyzstan', dial: '+996', flag: '๐Ÿ‡ฐ๐Ÿ‡ฌ' },\n { iso: 'TJ', name: 'Tajikistan', dial: '+992', flag: '๐Ÿ‡น๐Ÿ‡ฏ' },\n { iso: 'TM', name: 'Turkmenistan', dial: '+993', flag: '๐Ÿ‡น๐Ÿ‡ฒ' },\n { iso: 'IL', name: 'Israel', dial: '+972', flag: '๐Ÿ‡ฎ๐Ÿ‡ฑ' },\n { iso: 'AE', name: 'UAE', dial: '+971', flag: '๐Ÿ‡ฆ๐Ÿ‡ช' },\n { iso: 'SA', name: 'Saudi Arabia', dial: '+966', flag: '๐Ÿ‡ธ๐Ÿ‡ฆ' },\n { iso: 'EG', name: 'Egypt', dial: '+20', flag: '๐Ÿ‡ช๐Ÿ‡ฌ' },\n { iso: 'ZA', name: 'South Africa', dial: '+27', flag: '๐Ÿ‡ฟ๐Ÿ‡ฆ' },\n { iso: 'NG', name: 'Nigeria', dial: '+234', flag: '๐Ÿ‡ณ๐Ÿ‡ฌ' },\n { iso: 'KE', name: 'Kenya', dial: '+254', flag: '๐Ÿ‡ฐ๐Ÿ‡ช' },\n { iso: 'IN', name: 'India', dial: '+91', flag: '๐Ÿ‡ฎ๐Ÿ‡ณ' },\n { iso: 'PK', name: 'Pakistan', dial: '+92', flag: '๐Ÿ‡ต๐Ÿ‡ฐ' },\n { iso: 'BD', name: 'Bangladesh', dial: '+880', flag: '๐Ÿ‡ง๐Ÿ‡ฉ' },\n { iso: 'SG', name: 'Singapore', dial: '+65', flag: '๐Ÿ‡ธ๐Ÿ‡ฌ' },\n { iso: 'MY', name: 'Malaysia', dial: '+60', flag: '๐Ÿ‡ฒ๐Ÿ‡พ' },\n { iso: 'TH', name: 'Thailand', dial: '+66', flag: '๐Ÿ‡น๐Ÿ‡ญ' },\n { iso: 'VN', name: 'Vietnam', dial: '+84', flag: '๐Ÿ‡ป๐Ÿ‡ณ' },\n { iso: 'PH', name: 'Philippines', dial: '+63', flag: '๐Ÿ‡ต๐Ÿ‡ญ' },\n { iso: 'ID', name: 'Indonesia', dial: '+62', flag: '๐Ÿ‡ฎ๐Ÿ‡ฉ' },\n { iso: 'JP', name: 'Japan', dial: '+81', flag: '๐Ÿ‡ฏ๐Ÿ‡ต' },\n { iso: 'KR', name: 'South Korea', dial: '+82', flag: '๐Ÿ‡ฐ๐Ÿ‡ท' },\n { iso: 'CN', name: 'China', dial: '+86', flag: '๐Ÿ‡จ๐Ÿ‡ณ' },\n { iso: 'HK', name: 'Hong Kong', dial: '+852', flag: '๐Ÿ‡ญ๐Ÿ‡ฐ' },\n { iso: 'TW', name: 'Taiwan', dial: '+886', flag: '๐Ÿ‡น๐Ÿ‡ผ' },\n { iso: 'NZ', name: 'New Zealand', dial: '+64', flag: '๐Ÿ‡ณ๐Ÿ‡ฟ' },\n { iso: 'BR', name: 'Brazil', dial: '+55', flag: '๐Ÿ‡ง๐Ÿ‡ท' },\n { iso: 'AR', name: 'Argentina', dial: '+54', flag: '๐Ÿ‡ฆ๐Ÿ‡ท' },\n { iso: 'CL', name: 'Chile', dial: '+56', flag: '๐Ÿ‡จ๐Ÿ‡ฑ' },\n { iso: 'CO', name: 'Colombia', dial: '+57', flag: '๐Ÿ‡จ๐Ÿ‡ด' },\n { iso: 'MX', name: 'Mexico', dial: '+52', flag: '๐Ÿ‡ฒ๐Ÿ‡ฝ' },\n];\n\nexport interface PhoneInputProps extends /* @vue-ignore */ NativeInputAttributes {\n /** The E.164 value, controlled. The `v-model` binding target. */\n readonly modelValue?: string;\n\n /** The initial E.164 value when uncontrolled. */\n readonly defaultValue?: string;\n\n /** The ISO code selected before the value carries a recognisable dial prefix. Default `US`. */\n readonly defaultCountry?: string;\n\n /** The ISO codes the reader may pick, in display order; unknown codes are ignored. Default every known country. */\n readonly countries?: ReadonlyArray<string>;\n\n /** The disabled state. Falls back to the surrounding form control's `isDisabled`. */\n readonly isDisabled?: boolean;\n\n /** The read-only state. Falls back to the surrounding form control's `isReadOnly`. */\n readonly isReadOnly?: boolean;\n\n /** The invalid surface override. Falls back to the surrounding form control's `isInvalid`. */\n readonly isInvalid?: boolean;\n\n /** The national-number placeholder. */\n readonly placeholder?: string;\n\n /** The hidden input name; the hidden input emits the full E.164 value. */\n readonly name?: string;\n}\n\n/* A list with no known code reads as absent: a select with no options could not hold a value. */\nfunction resolveCountries(isos: ReadonlyArray<string> | undefined): ReadonlyArray<PhoneCountry> {\n if (!isos) return PhoneCountries;\n const known = [...new Set(isos)]\n .map((iso) => PhoneCountries.find((c) => c.iso === iso))\n .filter((c): c is PhoneCountry => c !== undefined);\n return known.length > 0 ? known : PhoneCountries;\n}\n\nfunction splitE164(\n value: string,\n countries: ReadonlyArray<PhoneCountry>,\n defaultIso: string,\n): { iso: string; national: string } {\n if (!value) return { iso: defaultIso, national: '' };\n // Match the longest dial code prefix; the stable sort leaves a shared code (+7) to the earlier country.\n const sorted = [...countries].sort((a, b) => b.dial.length - a.dial.length);\n for (const c of sorted) {\n if (value.startsWith(c.dial)) {\n return { iso: c.iso, national: value.slice(c.dial.length).replace(/\\D/g, '') };\n }\n }\n return { iso: defaultIso, national: value.replace(/\\D/g, '') };\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { useLocale } from '../../../foundation/i18n';\nimport { useTemplateRef } from 'vue';\nimport { useNativeFormReset } from '../UseNativeFormReset';\nimport { computed, ref, useAttrs } from 'vue';\nimport type { ClassValue } from 'clsx';\nimport { cn } from '../../../foundation/styles';\nimport { useControlled } from '../../../foundation/state';\nimport { useFormControl } from '../../../foundation/primitives';\nimport { inputBaseVariants, InputSize } from '../InputStyles';\n\n/**\n * Renders a country dial-code select beside a national-number field, emitting one E.164 string.\n *\n * First-generation country list; full `libphonenumber` validation and formatting stays deferred.\n */\n/* `inheritAttrs: false` so `class` folds into the root's own `cn()` call โ€” plain fallthrough\n appends outside it and loses tailwind-merge conflict resolution. */\ndefineOptions({ name: 'PhoneInput', inheritAttrs: false });\n\nconst props = withDefaults(defineProps<PhoneInputProps>(), {\n defaultCountry: 'US',\n placeholder: '(555) 555-5555',\n /* Explicit `undefined` defaults: `useControlled` keys on `=== undefined`, and Vue casts an\n absent `boolean` prop to `false` โ€” which would shadow the form control context. */\n modelValue: undefined,\n isDisabled: undefined,\n isReadOnly: undefined,\n isInvalid: undefined,\n});\n\nconst emit = defineEmits<{\n /** Fires when the reader edits the number or switches country โ€” the `v-model` half. */\n 'update:modelValue': [e164: string];\n}>();\n\nconst attrs = useAttrs();\n\nconst controlled = useControlled<string>({\n controlled: () => props.modelValue,\n default: () => props.defaultValue ?? '',\n onChange: (next) => {\n emit('update:modelValue', next);\n },\n});\n\nconst e164 = controlled.value;\n\n/* FormControlContext adoption โ€” explicit props stay as overrides. The national-number\n input is the composite's primary control (carries the context id + describedby);\n a user `id` attr stays on the root div. */\nconst ctx = useFormControl();\nconst disabled = computed(() => props.isDisabled ?? ctx?.isDisabled);\nconst readOnly = computed(() => props.isReadOnly ?? ctx?.isReadOnly);\nconst invalid = computed(() => props.isInvalid ?? ctx?.isInvalid);\n\nconst allowed = computed(() => resolveCountries(props.countries));\n/* The fallback must be selectable: a `defaultCountry` outside the list gives way to the first allowed country. */\nconst fallbackIso = computed(\n () => allowed.value.find((c) => c.iso === props.defaultCountry)?.iso ?? allowed.value[0]!.iso,\n);\n\n/* Selected ISO is state โ€” shared dial codes (+1 US/CA) make it unrecoverable from the value\n alone. Re-derive only when the value's dial prefix becomes incompatible with the selection. */\nconst selectedIso = ref(fallbackIso.value);\n\n/* A value whose dial prefix is outside the list matches no allowed country: its digits stay, under the fallback. */\nconst split = computed(() => {\n const selected = allowed.value.find((c) => c.iso === selectedIso.value);\n if (selected && (!e164.value || e164.value.startsWith(selected.dial))) {\n return {\n iso: selected.iso,\n national: e164.value.slice(selected.dial.length).replace(/\\D/g, ''),\n };\n }\n return splitE164(e164.value, allowed.value, fallbackIso.value);\n});\n\nconst iso = computed(() => split.value.iso);\nconst national = computed(() => split.value.national);\nconst country = computed(() => allowed.value.find((c) => c.iso === iso.value) ?? allowed.value[0]!);\n\n/* A dial code alone is not a phone number: with no national digits the value is empty, so a blank field submits\n nothing and fails `required` โ€” the selected country survives in `selectedIso`. */\nfunction e164For(dial: string, digits: string): string {\n return digits ? `${dial}${digits}` : '';\n}\n\nfunction setCountry(event: Event): void {\n const nextIso = (event.target as HTMLSelectElement).value;\n const next = allowed.value.find((c) => c.iso === nextIso) ?? country.value;\n selectedIso.value = next.iso;\n const nextValue = e164For(next.dial, national.value);\n if (nextValue !== e164.value) controlled.setValue(nextValue);\n}\n\nfunction setNational(event: Event): void {\n const digits = (event.target as HTMLInputElement).value.replace(/\\D/g, '');\n /* Deriving the country before the write keeps a shared dial code (+1 US / CA) on the reader's pick. */\n selectedIso.value = country.value.iso;\n controlled.setValue(e164For(country.value.dial, digits));\n}\n\nconst OwnedAttributes: ReadonlySet<string> = new Set(['class']);\nconst passthroughAttrs = computed(() =>\n Object.fromEntries(Object.entries(attrs).filter(([key]) => !OwnedAttributes.has(key))),\n);\n\nconst rootClass = computed(() =>\n cn(\n 'inline-flex items-stretch overflow-hidden rounded-md border bg-background',\n invalid.value ? 'border-destructive' : 'border-input',\n disabled.value && 'opacity-60',\n readOnly.value && 'bg-muted text-muted-foreground',\n attrs.class as ClassValue,\n ),\n);\n\n/* The country select is a native `<select>`, which has no `readonly`: a read-only phone input disables it, so it\n takes the frame's muted surface and the default cursor rather than the pointer. */\nconst selectClass = computed(() =>\n cn(\n 'h-10 cursor-pointer border-r border-input bg-card pl-2 pr-1 text-sm outline-hidden focus-visible:ring-2 focus-visible:ring-ring',\n readOnly.value && 'cursor-default bg-muted text-muted-foreground',\n ),\n);\n\n/* One allowed country leaves nothing to pick: its flag and dial code sit in the select's place as plain text. */\nconst prefixClass = computed(() =>\n cn(\n 'flex h-10 items-center border-r border-input bg-card px-2 text-sm',\n readOnly.value && 'bg-muted text-muted-foreground',\n ),\n);\n\nconst inputClass = cn(\n inputBaseVariants({ size: InputSize.Md }),\n 'rounded-none border-0 focus-visible:ring-0 readonly:focus-visible:ring-0',\n);\n\nconst formResetAnchor = useTemplateRef<HTMLInputElement>('formResetAnchor');\nconst formResetRevision = useNativeFormReset(formResetAnchor, () => {\n controlled.reset();\n});\n\nconst locale = useLocale();\n</script>\n\n<template>\n <div :key=\"formResetRevision\" :data-readonly=\"readOnly || undefined\" :class=\"rootClass\" v-bind=\"passthroughAttrs\">\n <span v-if=\"allowed.length === 1\" :class=\"prefixClass\">{{ country.flag }} {{ country.dial }}</span>\n <select\n v-else\n :aria-label=\"locale.t('PhoneInput.country', undefined, 'Country')\"\n :value=\"iso\"\n :disabled=\"disabled || readOnly\"\n :class=\"selectClass\"\n :style=\"{ minWidth: '90px' }\"\n @change=\"setCountry\"\n >\n <option v-for=\"c in allowed\" :key=\"c.iso\" :value=\"c.iso\">{{ c.flag }} {{ c.dial }}</option>\n </select>\n <input\n type=\"tel\"\n inputmode=\"tel\"\n autocomplete=\"tel-national\"\n :id=\"ctx?.id\"\n :value=\"national\"\n :placeholder=\"placeholder\"\n :disabled=\"disabled\"\n :readonly=\"readOnly\"\n :aria-invalid=\"invalid || undefined\"\n :aria-describedby=\"ctx?.describedBy\"\n :aria-required=\"ctx?.isRequired || undefined\"\n :class=\"inputClass\"\n @input=\"setNational\"\n />\n <input\n v-if=\"name\"\n type=\"hidden\"\n :disabled=\"disabled\"\n :form=\"typeof $attrs.form === 'string' ? $attrs.form : undefined\"\n :name=\"name\"\n :value=\"e164\"\n />\n <input\n ref=\"formResetAnchor\"\n type=\"hidden\"\n :form=\"typeof $attrs.form === 'string' ? $attrs.form : undefined\"\n aria-hidden=\"true\"\n />\n </div>\n</template>\n"],"names":["_openBlock","_createElementBlock","_mergeProps","_unref","_toDisplayString","_Fragment","_renderList","_createElementVNode","$attrs"],"mappings":";;;;;;;;;;;;;AAUO,MAAM,iBAA8C;AAAA,EACzD,EAAE,KAAK,MAAM,MAAM,iBAAiB,MAAM,MAAM,MAAM,OAAA;AAAA,EACtD,EAAE,KAAK,MAAM,MAAM,UAAU,MAAM,MAAM,MAAM,OAAA;AAAA,EAC/C,EAAE,KAAK,MAAM,MAAM,kBAAkB,MAAM,OAAO,MAAM,OAAA;AAAA,EACx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\"ts\">\nimport type { NativeInputAttributes } from '../NativeControlAttributes';\n\nexport interface PhoneInputProps extends /* @vue-ignore */ NativeInputAttributes {\n /** The E.164 value, controlled. The `v-model` binding target. */\n readonly modelValue?: string;\n\n /** The initial E.164 value when uncontrolled. */\n readonly defaultValue?: string;\n\n /** The ISO code selected before the value carries a recognisable dial prefix. Default `US`. */\n readonly defaultCountry?: string;\n\n /** The ISO codes the reader may pick, in display order; unknown codes are ignored. Default every known country. */\n readonly countries?: ReadonlyArray<string>;\n\n /** The disabled state. Falls back to the surrounding form control's `isDisabled`. */\n readonly isDisabled?: boolean;\n\n /** The read-only state. Falls back to the surrounding form control's `isReadOnly`. */\n readonly isReadOnly?: boolean;\n\n /** The invalid surface override. Falls back to the surrounding form control's `isInvalid`. */\n readonly isInvalid?: boolean;\n\n /** The national-number placeholder. Default the country's mask with zeros (`00-000-00-00`), none without a mask. */\n readonly placeholder?: string;\n\n /** The hidden input name; the hidden input emits the full E.164 value. */\n readonly name?: string;\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, ref, useAttrs, useTemplateRef } from 'vue';\nimport type { ClassValue } from 'clsx';\nimport { useLocale } from '../../../foundation/i18n';\nimport { PhoneFormats, PhoneNumberExtensions } from '../../../foundation/phone';\nimport { useFormControl } from '../../../foundation/primitives';\nimport { useControlled } from '../../../foundation/state';\nimport { cn } from '../../../foundation/styles';\nimport { inputBaseVariants, InputSize } from '../InputStyles';\nimport { useNativeFormReset } from '../UseNativeFormReset';\n\n/**\n * Renders a country dial-code select beside a national-number field, emitting one E.164 string.\n *\n * The field takes digits only and shows them through the country's mask (`foundation/phone` `PhoneFormats`); the\n * value never carries a mask character. Pair it with the `phone()` validator for the per-country digit count.\n */\n/* `inheritAttrs: false` so `class` folds into the root's own `cn()` call โ€” plain fallthrough\n appends outside it and loses tailwind-merge conflict resolution. */\ndefineOptions({ name: 'PhoneInput', inheritAttrs: false });\n\nconst props = withDefaults(defineProps<PhoneInputProps>(), {\n defaultCountry: 'US',\n placeholder: undefined,\n /* Explicit `undefined` defaults: `useControlled` keys on `=== undefined`, and Vue casts an\n absent `boolean` prop to `false` โ€” which would shadow the form control context. */\n modelValue: undefined,\n isDisabled: undefined,\n isReadOnly: undefined,\n isInvalid: undefined,\n});\n\nconst emit = defineEmits<{\n /** Fires when the reader edits the number or switches country โ€” the `v-model` half. */\n 'update:modelValue': [e164: string];\n}>();\n\nconst attrs = useAttrs();\n\nconst controlled = useControlled<string>({\n controlled: () => props.modelValue,\n default: () => props.defaultValue ?? '',\n onChange: (next) => {\n emit('update:modelValue', next);\n },\n});\n\nconst e164 = controlled.value;\n\n/* FormControlContext adoption โ€” explicit props stay as overrides. The national-number\n input is the composite's primary control (carries the context id + describedby);\n a user `id` attr stays on the root div. */\nconst ctx = useFormControl();\nconst disabled = computed(() => props.isDisabled ?? ctx?.isDisabled);\nconst readOnly = computed(() => props.isReadOnly ?? ctx?.isReadOnly);\nconst invalid = computed(() => props.isInvalid ?? ctx?.isInvalid);\n\nconst allowed = computed(() => PhoneNumberExtensions.resolveCountries(props.countries));\n/* The fallback must be selectable: a `defaultCountry` outside the list gives way to the first allowed country. */\nconst fallbackIso = computed(\n () => allowed.value.find((c) => c.iso === props.defaultCountry)?.iso ?? allowed.value[0]!.iso,\n);\n\n/* Selected ISO is state โ€” shared dial codes (+1 US/CA) make it unrecoverable from the value\n alone. Re-derive only when the value's dial prefix becomes incompatible with the selection. */\nconst selectedIso = ref(fallbackIso.value);\n\n/* A value whose dial prefix is outside the list matches no allowed country: its digits stay, under the fallback. */\nconst split = computed(() => {\n const selected = allowed.value.find((c) => c.iso === selectedIso.value);\n if (selected && (!e164.value || e164.value.startsWith(selected.dial))) {\n return {\n iso: selected.iso,\n national: PhoneNumberExtensions.digitsOf(e164.value.slice(selected.dial.length)),\n };\n }\n return PhoneNumberExtensions.split(e164.value, allowed.value, fallbackIso.value);\n});\n\nconst iso = computed(() => split.value.iso);\nconst national = computed(() => split.value.national);\nconst country = computed(() => allowed.value.find((c) => c.iso === iso.value) ?? allowed.value[0]!);\nconst format = computed(() => PhoneNumberExtensions.formatOf(country.value));\n/* A value under a dial code the field does not show (outside `countries`) displays its bare digits: the country's\n mask would read them as a national number they are not. */\nconst isForeign = computed(() => e164.value !== '' && !e164.value.startsWith(country.value.dial));\nconst displayed = computed(() =>\n isForeign.value ? national.value : PhoneNumberExtensions.formatNational(national.value, format.value),\n);\nconst placeholderText = computed(() => {\n if (props.placeholder !== undefined) return props.placeholder;\n const mask = PhoneFormats[country.value.iso]?.mask;\n return mask ? mask.replace(/X/g, '0') : undefined;\n});\n\n/* A dial code alone is not a phone number: with no national digits the value is empty, so a blank field submits\n nothing and fails `required` โ€” the selected country survives in `selectedIso`. */\nfunction e164For(dial: string, digits: string): string {\n return digits ? `${dial}${digits}` : '';\n}\n\nfunction setCountry(event: Event): void {\n const nextIso = (event.target as HTMLSelectElement).value;\n const next = allowed.value.find((c) => c.iso === nextIso) ?? country.value;\n selectedIso.value = next.iso;\n const nextValue = e164For(next.dial, national.value);\n if (nextValue !== e164.value) controlled.setValue(nextValue);\n}\n\nfunction setDigits(digits: string): void {\n /* Deriving the country before the write keeps a shared dial code (+1 US / CA) on the reader's pick. */\n selectedIso.value = country.value.iso;\n const nextValue = e164For(country.value.dial, digits);\n if (nextValue !== e164.value) controlled.setValue(nextValue);\n}\n\n/* An international number replaces the whole field: an allowed dial prefix picks its country, any other keeps every\n digit as a foreign value, where the `phone()` rule reports it. Returns the text the field shows for it โ€” computed\n here, since a controlled value reaches `displayed` only after the parent re-renders. */\nfunction setInternational(text: string): string {\n const parsed = PhoneNumberExtensions.parseInternational(text, allowed.value, country.value.iso);\n if (parsed.country) {\n const max = PhoneNumberExtensions.lengthOf(parsed.country).max;\n const digits = parsed.e164.slice(parsed.country.dial.length, parsed.country.dial.length + max);\n selectedIso.value = parsed.country.iso;\n const nextValue = e164For(parsed.country.dial, digits);\n if (nextValue !== e164.value) controlled.setValue(nextValue);\n return PhoneNumberExtensions.formatNational(digits, PhoneNumberExtensions.formatOf(parsed.country));\n }\n\n const nextValue = parsed.e164.length > 1 ? parsed.e164 : '';\n if (nextValue !== e164.value) controlled.setValue(nextValue);\n return nextValue.slice(1);\n}\n\n/* Replacement text (autofill, drop, an untyped `input`) may carry a full `+โ€ฆ` number; typed text never does. */\nconst ReplacementInputTypes: ReadonlySet<string | undefined> = new Set([\n undefined,\n 'insertReplacementText',\n 'insertFromDrop',\n 'insertFromPaste',\n]);\n\n/* The text is rewritten in place on every input: a rejected character changes no state, so Vue would leave it on\n screen. The caret goes back after the digit it followed. */\nfunction setNational(event: Event): void {\n const field = event.target as HTMLInputElement;\n const inputEvent = event as InputEvent;\n if (inputEvent.isComposing) return;\n\n if (ReplacementInputTypes.has(inputEvent.inputType) && field.value.trimStart().startsWith('+')) {\n field.value = setInternational(field.value);\n placeCaret(field, field.value.length);\n return;\n }\n\n const edit = PhoneNumberExtensions.editNational({\n text: field.value,\n caret: field.selectionStart ?? field.value.length,\n previousDigits: national.value,\n inputType: inputEvent.inputType,\n format: format.value,\n });\n field.value = edit.text;\n placeCaret(field, edit.caret);\n setDigits(edit.digits);\n}\n\n/* A pasted `+โ€ฆ` number is international; digits that spell the selected country's dial code and a full national\n number (`998996632582`) lose the dial code; any other paste inserts at the caret as digits. */\nfunction pasteNational(event: ClipboardEvent): void {\n const text = event.clipboardData?.getData('text') ?? '';\n const field = event.target as HTMLInputElement;\n if (text.trimStart().startsWith('+')) {\n event.preventDefault();\n field.value = setInternational(text);\n placeCaret(field, field.value.length);\n return;\n }\n\n const digits = PhoneNumberExtensions.digitsOf(text);\n const stripped = PhoneNumberExtensions.withoutDialCode(digits, country.value);\n if (stripped === digits) return;\n event.preventDefault();\n setDigits(stripped);\n field.value = PhoneNumberExtensions.formatNational(stripped, format.value);\n placeCaret(field, field.value.length);\n}\n\nfunction placeCaret(field: HTMLInputElement, caret: number): void {\n if (field.ownerDocument.activeElement === field) field.setSelectionRange(caret, caret);\n}\n\nconst OwnedAttributes: ReadonlySet<string> = new Set(['class']);\nconst passthroughAttrs = computed(() =>\n Object.fromEntries(Object.entries(attrs).filter(([key]) => !OwnedAttributes.has(key))),\n);\n\nconst rootClass = computed(() =>\n cn(\n 'inline-flex items-stretch overflow-hidden rounded-md border bg-background',\n invalid.value ? 'border-destructive' : 'border-input',\n disabled.value && 'opacity-60',\n readOnly.value && 'bg-muted text-muted-foreground',\n attrs.class as ClassValue,\n ),\n);\n\n/* The country select is a native `<select>`, which has no `readonly`: a read-only phone input disables it, so it\n takes the frame's muted surface and the default cursor rather than the pointer. */\nconst selectClass = computed(() =>\n cn(\n 'h-10 cursor-pointer border-r border-input bg-card pl-2 pr-1 text-sm outline-hidden focus-visible:ring-2 focus-visible:ring-ring',\n readOnly.value && 'cursor-default bg-muted text-muted-foreground',\n ),\n);\n\n/* One allowed country leaves nothing to pick: its flag and dial code sit in the select's place as plain text. */\nconst prefixClass = computed(() =>\n cn(\n 'flex h-10 items-center border-r border-input bg-card px-2 text-sm',\n readOnly.value && 'bg-muted text-muted-foreground',\n ),\n);\n\nconst inputClass = cn(\n inputBaseVariants({ size: InputSize.Md }),\n 'rounded-none border-0 focus-visible:ring-0 readonly:focus-visible:ring-0',\n);\n\nconst formResetAnchor = useTemplateRef<HTMLInputElement>('formResetAnchor');\nconst formResetRevision = useNativeFormReset(formResetAnchor, () => {\n controlled.reset();\n});\n\nconst locale = useLocale();\n</script>\n\n<template>\n <div :key=\"formResetRevision\" :data-readonly=\"readOnly || undefined\" :class=\"rootClass\" v-bind=\"passthroughAttrs\">\n <span v-if=\"allowed.length === 1\" :class=\"prefixClass\">{{ country.flag }} {{ country.dial }}</span>\n <select\n v-else\n :aria-label=\"locale.t('PhoneInput.country', undefined, 'Country')\"\n :value=\"iso\"\n :disabled=\"disabled || readOnly\"\n :class=\"selectClass\"\n :style=\"{ minWidth: '90px' }\"\n @change=\"setCountry\"\n >\n <option v-for=\"c in allowed\" :key=\"c.iso\" :value=\"c.iso\">{{ c.flag }} {{ c.dial }}</option>\n </select>\n <input\n type=\"tel\"\n inputmode=\"tel\"\n autocomplete=\"tel-national\"\n :id=\"ctx?.id\"\n :value=\"displayed\"\n :placeholder=\"placeholderText\"\n :disabled=\"disabled\"\n :readonly=\"readOnly\"\n :aria-invalid=\"invalid || undefined\"\n :aria-describedby=\"ctx?.describedBy\"\n :aria-required=\"ctx?.isRequired || undefined\"\n :class=\"inputClass\"\n @input=\"setNational\"\n @paste=\"pasteNational\"\n />\n <input\n v-if=\"name\"\n type=\"hidden\"\n :disabled=\"disabled\"\n :form=\"typeof $attrs.form === 'string' ? $attrs.form : undefined\"\n :name=\"name\"\n :value=\"e164\"\n />\n <input\n ref=\"formResetAnchor\"\n type=\"hidden\"\n :form=\"typeof $attrs.form === 'string' ? $attrs.form : undefined\"\n aria-hidden=\"true\"\n />\n </div>\n</template>\n"],"names":["nextValue","_openBlock","_createElementBlock","_mergeProps","_unref","_toDisplayString","_Fragment","_renderList","_createElementVNode","$attrs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,UAAM,QAAQ;AAWd,UAAM,OAAO;AAKb,UAAM,QAAQ,SAAA;AAEd,UAAM,aAAa,cAAsB;AAAA,MACvC,YAAY,MAAM,MAAM;AAAA,MACxB,SAAS,MAAM,MAAM,gBAAgB;AAAA,MACrC,UAAU,CAAC,SAAS;AAClB,aAAK,qBAAqB,IAAI;AAAA,MAChC;AAAA,IAAA,CACD;AAED,UAAM,OAAO,WAAW;AAKxB,UAAM,MAAM,eAAA;AACZ,UAAM,WAAW,SAAS,MAAM,MAAM,cAAc,KAAK,UAAU;AACnE,UAAM,WAAW,SAAS,MAAM,MAAM,cAAc,KAAK,UAAU;AACnE,UAAM,UAAU,SAAS,MAAM,MAAM,aAAa,KAAK,SAAS;AAEhE,UAAM,UAAU,SAAS,MAAM,sBAAsB,iBAAiB,MAAM,SAAS,CAAC;AAEtF,UAAM,cAAc;AAAA,MAClB,MAAM,QAAQ,MAAM,KAAK,CAAC,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5
3
  _sfc_main as default
6
4
  };
7
5
  //# sourceMappingURL=PhoneInput2.vue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PhoneInput2.vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
1
+ {"version":3,"file":"PhoneInput2.vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1 +1,2 @@
1
- export { default as PhoneInput, PhoneCountries, type PhoneCountry, type PhoneInputProps } from './PhoneInput.vue';
1
+ export { default as PhoneInput, type PhoneInputProps } from './PhoneInput.vue';
2
+ export { PhoneCountries, type PhoneCountry } from '../../../foundation/phone';
@@ -1 +1 @@
1
- {"version":3,"file":"Navbar.vue.js","sources":["../../../../src/presentation/layout/navbar/Navbar.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { HTMLAttributes } from 'vue';\nimport type { SurfaceTone } from '../../../foundation/styles';\nimport type { ContainerLayoutProps } from '../containerLayout';\nimport type { NavbarElement, NavbarHeight, NavbarOrientation, NavbarVariant } from './Navbar.variants';\n\nexport interface NavbarProps {\n /**\n * The element: `header` (a banner landmark) or `div` (none). Default: `div` inside an `AppShellHeader`, which is\n * already the banner, and `header` elsewhere.\n */\n readonly as?: NavbarElement;\n /** Native attributes forwarded to the inner `ContainerLayout`; its `class` is merged last. */\n readonly containerAttrs?: HTMLAttributes;\n /** Convenience class for the inner `ContainerLayout`, merged after `containerAttrs.class`. */\n readonly containerClass?: HTMLAttributes['class'];\n /** The max-width of the inner centered `ContainerLayout`. Passthrough to `ContainerLayout.size`. Default `lg`. */\n readonly containerSize?: ContainerLayoutProps['size'];\n /** The band height. Default `md`. */\n readonly height?: NavbarHeight;\n /** The sticky pinning of the bar to the top of the scroll container. Default `false` (non-sticky). */\n readonly isSticky?: boolean;\n /** @deprecated Use `isSticky`; this alias is removed next release. */\n readonly sticky?: boolean;\n /**\n * The tinted background tone for the band โ€” applies the shadow-less `subtle`\n * surface treatment. Omit for a transparent bar (relies on `hasBorder` / page bg).\n */\n readonly tone?: SurfaceTone;\n /** The bottom border under the bar. Default `true`. */\n readonly hasBorder?: boolean;\n /** @deprecated Use `hasBorder`; this alias is removed next release. */\n readonly bordered?: boolean;\n /** Which way the bar runs: a full-width top bar or a full-height side rail. Default `horizontal`. */\n readonly orientation?: NavbarOrientation;\n /** The surface: `solid`, `glass` or `transparent`. A `tone` overrides it. Default `solid`. */\n readonly variant?: NavbarVariant;\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, inject, provide, useAttrs, useSlots, useTemplateRef } from 'vue';\nimport { cn, surfaceVariants } from '../../../foundation/styles';\nimport ContainerLayout from '../containerLayout/ContainerLayout.vue';\nimport {\n NavbarElement as Element,\n NavbarOrientation as Orientation,\n NavbarSurfaceClass,\n navbarVariants,\n} from './Navbar.variants';\nimport { bannerHostKey, navbarContextKey } from './NavbarContext';\n\n/**\n * Renders a lightweight header band (`<header>`) with `start` / `center` / `end` slots\n * laid out in a row inside a centered `ContainerLayout`. The everyday \"navbar +\n * centered content\" need that `AppShell` (a 5-slot dashboard grid w/ sidebar)\n * overshoots. Non-sticky by default; pass `isSticky` to pin it.\n *\n * Inside an `AppShellHeader` it renders a plain row filling the bar: the host is the banner and owns the band's\n * height, border and surface, so the bar adds none of its own unless the props ask for them.\n */\ndefineOptions({ name: 'Navbar', inheritAttrs: false });\n\n/** React's `start` / `center` / `end` / `children` ReactNode props are content regions โ€” slots in Vue. */\ndefineSlots<{\n /** The leading slot โ€” laid out at the start of the row (brand / logo / nav links). */\n start?(): unknown;\n /** The centre slot โ€” laid out in the middle of the row (search / primary nav). */\n center?(): unknown;\n /** The trailing slot โ€” laid out at the end of the row (actions / avatar / CTA). */\n end?(): unknown;\n /**\n * The raw row content โ€” replaces the `start` / `center` / `end` slot layout when\n * provided. Use for fully custom bars.\n */\n default?(): unknown;\n}>();\n\nconst props = withDefaults(defineProps<NavbarProps>(), {\n as: undefined,\n isSticky: undefined,\n sticky: undefined,\n hasBorder: undefined,\n bordered: undefined,\n orientation: Orientation.Horizontal,\n variant: undefined,\n});\n\nconst isVertical = computed(() => props.orientation === Orientation.Vertical);\n\n/** True inside a host that already is the banner โ€” `AppShellHeader`. */\nconst isHosted = inject(bannerHostKey, false);\n\nconst tag = computed<Element>(() => props.as ?? (isHosted ? Element.Div : Element.Header));\n\nprovide(navbarContextKey, { orientation: computed(() => props.orientation) });\n\nconst attrs = useAttrs();\nconst slots = useSlots();\nconst el = useTemplateRef<HTMLElement>('el');\n\nconst classes = computed(() =>\n cn(\n navbarVariants({\n orientation: props.orientation,\n sticky: props.isSticky ?? props.sticky ?? false,\n height: props.height,\n }),\n /* A hosted bar fills the host's row at the host's height. */\n isHosted && 'min-w-0 flex-1 self-stretch',\n isHosted && props.height === undefined && 'h-auto',\n (props.hasBorder ?? props.bordered ?? !isHosted) &&\n (isVertical.value ? 'border-e border-border' : 'border-b border-border'),\n props.tone\n ? surfaceVariants({ variant: 'subtle', tone: props.tone, radius: 'none' })\n : NavbarSurfaceClass[props.variant ?? (isHosted ? 'transparent' : 'solid')],\n attrs.class as string | undefined,\n ),\n);\n\n/** Push `end` to the trailing edge when there's no centre slot to absorb the slack. */\nconst endClasses = computed(() => cn('flex min-w-0 items-center gap-3', !slots.center && 'ml-auto'));\n\n/** Inner-container classes with consumer spacing taking precedence. */\nconst containerClasses = computed(() =>\n cn('flex h-full items-center gap-3', props.containerAttrs?.class as string | undefined, props.containerClass),\n);\n\n/** Rail classes: a column from the brand at the top to the account at the foot, consumer spacing last. */\nconst railClasses = computed(() =>\n cn(\n 'flex h-full min-h-0 flex-col items-stretch gap-3 p-3',\n props.containerAttrs?.class as string | undefined,\n props.containerClass,\n ),\n);\n\n/** Inner-container attributes except `class`, which is merged through `cn`. */\nconst containerRest = computed(() => {\n const { class: _class, ...others } = props.containerAttrs ?? {};\n return others;\n});\n\n/** Everything but `class`, which is re-applied through `cn` above. */\nconst rest = computed(() => {\n const { class: _class, ...others } = attrs;\n return others;\n});\n\ndefineExpose({ el });\n</script>\n\n<template>\n <component :is=\"tag\" v-if=\"isVertical\" ref=\"el\" v-bind=\"rest\" :class=\"classes\">\n <div v-bind=\"containerRest\" :class=\"railClasses\">\n <slot v-if=\"$slots.default\" />\n <template v-else>\n <div v-if=\"$slots.start\" class=\"flex min-w-0 shrink-0 items-center gap-3\">\n <slot name=\"start\" />\n </div>\n <div v-if=\"$slots.center\" class=\"flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto\">\n <slot name=\"center\" />\n </div>\n <div v-if=\"$slots.end\" class=\"mt-auto flex min-w-0 shrink-0 items-center gap-3\">\n <slot name=\"end\" />\n </div>\n </template>\n </div>\n </component>\n <component :is=\"tag\" v-else ref=\"el\" v-bind=\"rest\" :class=\"classes\">\n <ContainerLayout v-bind=\"containerRest\" :size=\"props.containerSize\" :class=\"containerClasses\">\n <slot v-if=\"$slots.default\" />\n <template v-else>\n <div v-if=\"$slots.start\" class=\"flex min-w-0 items-center gap-3\">\n <slot name=\"start\" />\n </div>\n <div v-if=\"$slots.center\" class=\"flex min-w-0 flex-1 items-center justify-center gap-3\">\n <slot name=\"center\" />\n </div>\n <div v-if=\"$slots.end\" :class=\"endClasses\">\n <slot name=\"end\" />\n </div>\n </template>\n </ContainerLayout>\n </component>\n</template>\n"],"names":["Orientation","Element","_createBlock","_resolveDynamicComponent","_mergeProps","_createElementVNode","$slots","_renderSlot","_createElementBlock","_Fragment","_openBlock","_createVNode","ContainerLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EA,UAAM,QAAQ;AAUd,UAAM,aAAa,SAAS,MAAM,MAAM,gBAAgBA,kBAAY,QAAQ;AAG5E,UAAM,WAAW,OAAO,eAAe,KAAK;AAE5C,UAAM,MAAM,SAAkB,MAAM,MAAM,OAAO,WAAWC,cAAQ,MAAMA,cAAQ,OAAO;AAEzF,YAAQ,kBAAkB,EAAE,aAAa,SAAS,MAAM,MAAM,WAAW,GAAG;AAE5E,UAAM,QAAQ,SAAA;AACd,UAAM,Q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AAU;AAAA,gBAAA;kBACvCD,WAAmB,KAAA,QAAA,KAAA;AAAA,gBAAA;;;;;;;;;;;"}
1
+ {"version":3,"file":"Navbar.vue.js","sources":["../../../../src/presentation/layout/navbar/Navbar.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { HTMLAttributes } from 'vue';\nimport type { SurfaceTone } from '../../../foundation/styles';\nimport type { ContainerLayoutProps } from '../containerLayout';\nimport type { NavbarElement, NavbarHeight, NavbarOrientation, NavbarVariant } from './Navbar.variants';\n\nexport interface NavbarProps {\n /**\n * The element: `header` (a banner landmark) or `div` (none). Default: `div` inside an `AppShellHeader`, which is\n * already the banner, and `header` elsewhere.\n */\n readonly as?: NavbarElement;\n /** Native attributes forwarded to the inner `ContainerLayout`; its `class` is merged last. */\n readonly containerAttrs?: HTMLAttributes;\n /** Convenience class for the inner `ContainerLayout`, merged after `containerAttrs.class`. */\n readonly containerClass?: HTMLAttributes['class'];\n /** The max-width of the inner centered `ContainerLayout`. Passthrough to `ContainerLayout.size`. Default `lg`. */\n readonly containerSize?: ContainerLayoutProps['size'];\n /** The band height. Default `md`. */\n readonly height?: NavbarHeight;\n /** The sticky pinning of the bar to the top of the scroll container. Default `false` (non-sticky). */\n readonly isSticky?: boolean;\n /** @deprecated Use `isSticky`; this alias is removed next release. */\n readonly sticky?: boolean;\n /**\n * The tinted background tone for the band โ€” applies the shadow-less `subtle`\n * surface treatment. Omit for a transparent bar (relies on `hasBorder` / page bg).\n */\n readonly tone?: SurfaceTone;\n /** The bottom border under the bar. Default `true`. */\n readonly hasBorder?: boolean;\n /** @deprecated Use `hasBorder`; this alias is removed next release. */\n readonly bordered?: boolean;\n /** Which way the bar runs: a full-width top bar or a full-height side rail. Default `horizontal`. */\n readonly orientation?: NavbarOrientation;\n /** The surface: `solid`, `glass` or `transparent`. A `tone` overrides it. Default `solid`. */\n readonly variant?: NavbarVariant;\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, inject, provide, useAttrs, useSlots, useTemplateRef } from 'vue';\nimport { cn, surfaceVariants } from '../../../foundation/styles';\nimport ContainerLayout from '../containerLayout/ContainerLayout.vue';\nimport {\n NavbarElement as Element,\n NavbarOrientation as Orientation,\n NavbarSurfaceClass,\n navbarVariants,\n} from './Navbar.variants';\nimport { bannerHostKey, navbarContextKey } from './NavbarContext';\n\n/**\n * Renders a lightweight header band (`<header>`) with `start` / `center` / `end` slots\n * laid out in a row inside a centered `ContainerLayout`. The everyday \"navbar +\n * centered content\" need that `AppShell` (a 5-slot dashboard grid w/ sidebar)\n * overshoots. Non-sticky by default; pass `isSticky` to pin it.\n *\n * Inside an `AppShellHeader` it renders a plain row filling the bar: the host is the banner and owns the band's\n * height, border and surface, so the bar adds none of its own unless the props ask for them.\n */\ndefineOptions({ name: 'Navbar', inheritAttrs: false });\n\n/** React's `start` / `center` / `end` / `children` ReactNode props are content regions โ€” slots in Vue. */\ndefineSlots<{\n /** The leading slot โ€” laid out at the start of the row (brand / logo / nav links). */\n start?(): unknown;\n /** The centre slot โ€” laid out in the middle of the row (search / primary nav). */\n center?(): unknown;\n /** The trailing slot โ€” laid out at the end of the row (actions / avatar / CTA). */\n end?(): unknown;\n /**\n * The raw row content โ€” replaces the `start` / `center` / `end` slot layout when\n * provided. Use for fully custom bars.\n */\n default?(): unknown;\n}>();\n\nconst props = withDefaults(defineProps<NavbarProps>(), {\n as: undefined,\n isSticky: undefined,\n sticky: undefined,\n hasBorder: undefined,\n bordered: undefined,\n orientation: Orientation.Horizontal,\n variant: undefined,\n});\n\nconst isVertical = computed(() => props.orientation === Orientation.Vertical);\n\n/** True inside a host that already is the banner โ€” `AppShellHeader`. */\nconst isHosted = inject(bannerHostKey, false);\n\nconst tag = computed<Element>(() => props.as ?? (isHosted ? Element.Div : Element.Header));\n\nprovide(navbarContextKey, { orientation: computed(() => props.orientation) });\n\nconst attrs = useAttrs();\nconst slots = useSlots();\nconst el = useTemplateRef<HTMLElement>('el');\n\nconst classes = computed(() =>\n cn(\n navbarVariants({\n orientation: props.orientation,\n sticky: props.isSticky ?? props.sticky ?? false,\n height: props.height,\n }),\n /* A hosted bar fills the host's row at the host's height. */\n isHosted && 'min-w-0 flex-1 self-stretch',\n isHosted && props.height === undefined && 'h-auto',\n (props.hasBorder ?? props.bordered ?? !isHosted) &&\n (isVertical.value ? 'border-e border-border' : 'border-b border-border'),\n props.tone\n ? surfaceVariants({ variant: 'subtle', tone: props.tone, radius: 'none' })\n : NavbarSurfaceClass[props.variant ?? (isHosted ? 'transparent' : 'solid')],\n attrs.class as string | undefined,\n ),\n);\n\n/** Push `end` to the trailing edge when there's no centre slot to absorb the slack. */\nconst endClasses = computed(() => cn('flex min-w-0 items-center gap-3', !slots.center && 'ml-auto'));\n\n/** Inner-container classes with consumer spacing taking precedence. */\nconst containerClasses = computed(() =>\n cn('flex h-full items-center gap-3', props.containerAttrs?.class as string | undefined, props.containerClass),\n);\n\n/** Rail classes: a column from the brand at the top to the account at the foot, consumer spacing last. */\nconst railClasses = computed(() =>\n cn(\n 'flex h-full min-h-0 flex-col items-stretch gap-3 p-3',\n props.containerAttrs?.class as string | undefined,\n props.containerClass,\n ),\n);\n\n/** Inner-container attributes except `class`, which is merged through `cn`. */\nconst containerRest = computed(() => {\n const { class: _class, ...others } = props.containerAttrs ?? {};\n return others;\n});\n\n/** Everything but `class`, which is re-applied through `cn` above. */\nconst rest = computed(() => {\n const { class: _class, ...others } = attrs;\n return others;\n});\n\ndefineExpose({ el });\n</script>\n\n<template>\n <component :is=\"tag\" v-if=\"isVertical\" ref=\"el\" v-bind=\"rest\" :class=\"classes\">\n <div v-bind=\"containerRest\" :class=\"railClasses\">\n <slot v-if=\"$slots.default\" />\n <template v-else>\n <div v-if=\"$slots.start\" class=\"flex min-w-0 shrink-0 items-center gap-3\">\n <slot name=\"start\" />\n </div>\n <div v-if=\"$slots.center\" class=\"flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto\">\n <slot name=\"center\" />\n </div>\n <div v-if=\"$slots.end\" class=\"mt-auto flex min-w-0 shrink-0 items-center gap-3\">\n <slot name=\"end\" />\n </div>\n </template>\n </div>\n </component>\n <component :is=\"tag\" v-else ref=\"el\" v-bind=\"rest\" :class=\"classes\">\n <ContainerLayout v-bind=\"containerRest\" :size=\"props.containerSize\" :class=\"containerClasses\">\n <slot v-if=\"$slots.default\" />\n <template v-else>\n <div v-if=\"$slots.start\" class=\"flex min-w-0 items-center gap-3\">\n <slot name=\"start\" />\n </div>\n <div v-if=\"$slots.center\" class=\"flex min-w-0 flex-1 items-center justify-center gap-3\">\n <slot name=\"center\" />\n </div>\n <div v-if=\"$slots.end\" :class=\"endClasses\">\n <slot name=\"end\" />\n </div>\n </template>\n </ContainerLayout>\n </component>\n</template>\n"],"names":["Orientation","Element","_createBlock","_resolveDynamicComponent","_mergeProps","_createElementVNode","$slots","_renderSlot","_createElementBlock","_Fragment","_openBlock","_createVNode","ContainerLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EA,UAAM,QAAQ;AAUd,UAAM,aAAa,SAAS,MAAM,MAAM,gBAAgBA,kBAAY,QAAQ;AAG5E,UAAM,WAAW,OAAO,eAAe,KAAK;AAE5C,UAAM,MAAM,SAAkB,MAAM,MAAM,OAAO,WAAWC,cAAQ,MAAMA,cAAQ,OAAO;AAEzF,YAAQ,kBAAkB,EAAE,aAAa,SAAS,MAAM,MAAM,WAAW,GAAG;AAE5E,UAAM,QAAQ,SAAA;AACd,UAAM,QAAQ,SAAA;AACd,UAAM,KAAK,eAA4B,IAAI;AAE3C,UAAM,UAAU;AAAA,MAAS,MACvB;AAAA,QACE,eAAe;AAAA,UACb,aAAa,MAAM;AAAA,UACnB,QAAQ,MAAM,YAAY,MAAM,UAAU;AAAA,UAC1C,QAAQ,MAAM;AAAA,QAAA,CACf;AAAA;AAAA,QAED,YAAY;AAAA,QACZ,YAAY,MAAM,WAAW,UAAa;AAAA,SACzC,MAAM,aAAa,MAAM,YAAY,CAAC,cACpC,WA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AAA;cAEZD,KAAAA,OAAO,UAAlBI,aAAAF,mBAEM,OAFN,YAEM;AAAA,gBADJD,WAAsB,KAAA,QAAA,QAAA;AAAA,cAAA;cAEbD,KAAAA,OAAO,OAAlBI,aAAAF,mBAEM,OAFN,YAEM;AAAA,gBADJD,WAAmB,KAAA,QAAA,KAAA;AAAA,cAAA;;;;;yCAK3BL,YAeYC,wBAfI,IAAA,KAAG,GAAnBC,WAeY;AAAA;iBAfoB;AAAA,QAAJ,KAAI;AAAA,MAAA,GAAa,KAAA,OAAI,EAAG,OAAO,QAAA,MAAA,CAAO,GAAA;AAAA,yBAChE,MAakB;AAAA,UAblBO,YAakBC,aAblBR,WAakB,cAAA,OAboB;AAAA,YAAG,MAAM,MAAM;AAAA,YAAgB,OAAO,iBAAA;AAAA,UAAA;6BAC1E,MAA8B;AAAA,cAAlBE,KAAAA,OAAO,UAAnBC,WAA8B,KAAA,QAAA,WAAA,IAAA,QAAA,QAAA,CAAA,kBAC9BC,mBAUWC,UAAA,EAAA,KAAA,KAAA;AAAA,gBATEH,KAAAA,OAAO,SAAlBI,aAAAF,mBAEM,OAFN,YAEM;AAAA,kBADJD,WAAqB,KAAA,QAAA,OAAA;AAAA,gBAAA;gBAEZD,KAAAA,OAAO,UAAlBI,aAAAF,mBAEM,OAFN,YAEM;AAAA,kBADJD,WAAsB,KAAA,QAAA,QAAA;AAAA,gBAAA;gBAEbD,KAAAA,OAAO,oBAAlBE,mBAEM,OAAA;AAAA;kBAFkB,sBAAO,WAAA,KAAU;AAAA,gBAAA;kBACvCD,WAAmB,KAAA,QAAA,KAAA;AAAA,gBAAA;;;;;;;;;;;"}
@@ -9,6 +9,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
9
9
  hideBackdrop: { type: Boolean, default: void 0 },
10
10
  isBlurred: { type: Boolean, default: void 0 },
11
11
  size: {},
12
+ height: {},
12
13
  variant: {},
13
14
  tone: {},
14
15
  radius: {},
@@ -1 +1 @@
1
- {"version":3,"file":"AlertModalContent.vue.js","sources":["../../../../src/presentation/overlays/alertModal/AlertModalContent.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ModalContentProps } from '../modal';\n\n/** The prop surface of `AlertModalContent` โ€” `ModalContent`'s, with `phoneLayout` defaulting to `sheet`. */\nexport type AlertModalContentProps = ModalContentProps;\n</script>\n\n<script setup lang=\"ts\">\nimport { resolveElement } from '../../../foundation/dom';\nimport { computed, useAttrs, useTemplateRef, type ComponentPublicInstance } from 'vue';\nimport ModalContent, { ModalPhoneLayout } from '../modal/ModalContent.vue';\n\n/**\n * Renders the alert dialog's panel โ€” `ModalContent`, opening as a bottom sheet on phones; the alert semantics live\n * on the root.\n */\ndefineOptions({ name: 'AlertModalContent', inheritAttrs: false });\n\n/** The panel content โ€” chrome subcomponents and the dialog body. React's `children`. */\ndefineSlots<{ default(): unknown }>();\n\n/* Absent booleans stay `undefined`: a cast `false` would forward `showBackdrop: false` and drop the scrim. */\nconst props = withDefaults(defineProps<AlertModalContentProps>(), {\n showBackdrop: undefined,\n hideBackdrop: undefined,\n isBlurred: undefined,\n phoneLayout: ModalPhoneLayout.Sheet,\n showHandle: undefined,\n});\n\nconst attrs = useAttrs();\nconst inner = useTemplateRef<ComponentPublicInstance & { el?: unknown }>('inner');\n\n/** Declared props first, attrs (including `class`) after, so a caller's attribute wins โ€” React's spread order. */\nconst forwarded = computed(() => ({ ...props, ...attrs }));\n\nconst el = computed(() => resolveElement(inner.value));\n\ndefineExpose({ el });\n</script>\n\n<template>\n <ModalContent ref=\"inner\" v-bind=\"forwarded\"><slot /></ModalContent>\n</template>\n"],"names":["_openBlock","_createBlock","ModalContent","_mergeProps","_renderSlot"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsBA,UAAM,QAAQ;AAQd,UAAM,QAAQ,SAAA;AACd,UAAM,QAAQ,eAA2D,OAAO;AAGhF,UAAM,YAAY,SAAS,OAAO,EAAE,GAAG,OAAO,GAAG,QAAQ;AAEzD,UAAM,KAAK,SAAS,MAAM,eAAe,MAAM,KAAK,CAAC;AAErD,aAAa,EAAE,IAAI;;AAIjB,aAAAA,UAAA,GAAAC,YAAoEC,aAApEC,WAAoE;AAAA,iBAAlD;AAAA,QAAJ,KAAI;AAAA,MAAA,GAAgB,UAAA,KAAS,GAAA;AAAA,yBAAE,MAAQ;AAAA,UAARC,WAAQ,KAAA,QAAA,SAAA;AAAA,QAAA;;;;;;"}
1
+ {"version":3,"file":"AlertModalContent.vue.js","sources":["../../../../src/presentation/overlays/alertModal/AlertModalContent.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ModalContentProps } from '../modal';\n\n/** The prop surface of `AlertModalContent` โ€” `ModalContent`'s, with `phoneLayout` defaulting to `sheet`. */\nexport type AlertModalContentProps = ModalContentProps;\n</script>\n\n<script setup lang=\"ts\">\nimport { resolveElement } from '../../../foundation/dom';\nimport { computed, useAttrs, useTemplateRef, type ComponentPublicInstance } from 'vue';\nimport ModalContent, { ModalPhoneLayout } from '../modal/ModalContent.vue';\n\n/**\n * Renders the alert dialog's panel โ€” `ModalContent`, opening as a bottom sheet on phones; the alert semantics live\n * on the root.\n */\ndefineOptions({ name: 'AlertModalContent', inheritAttrs: false });\n\n/** The panel content โ€” chrome subcomponents and the dialog body. React's `children`. */\ndefineSlots<{ default(): unknown }>();\n\n/* Absent booleans stay `undefined`: a cast `false` would forward `showBackdrop: false` and drop the scrim. */\nconst props = withDefaults(defineProps<AlertModalContentProps>(), {\n showBackdrop: undefined,\n hideBackdrop: undefined,\n isBlurred: undefined,\n phoneLayout: ModalPhoneLayout.Sheet,\n showHandle: undefined,\n});\n\nconst attrs = useAttrs();\nconst inner = useTemplateRef<ComponentPublicInstance & { el?: unknown }>('inner');\n\n/** Declared props first, attrs (including `class`) after, so a caller's attribute wins โ€” React's spread order. */\nconst forwarded = computed(() => ({ ...props, ...attrs }));\n\nconst el = computed(() => resolveElement(inner.value));\n\ndefineExpose({ el });\n</script>\n\n<template>\n <ModalContent ref=\"inner\" v-bind=\"forwarded\"><slot /></ModalContent>\n</template>\n"],"names":["_openBlock","_createBlock","ModalContent","_mergeProps","_renderSlot"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsBA,UAAM,QAAQ;AAQd,UAAM,QAAQ,SAAA;AACd,UAAM,QAAQ,eAA2D,OAAO;AAGhF,UAAM,YAAY,SAAS,OAAO,EAAE,GAAG,OAAO,GAAG,QAAQ;AAEzD,UAAM,KAAK,SAAS,MAAM,eAAe,MAAM,KAAK,CAAC;AAErD,aAAa,EAAE,IAAI;;AAIjB,aAAAA,UAAA,GAAAC,YAAoEC,aAApEC,WAAoE;AAAA,iBAAlD;AAAA,QAAJ,KAAI;AAAA,MAAA,GAAgB,UAAA,KAAS,GAAA;AAAA,yBAAE,MAAQ;AAAA,UAARC,WAAQ,KAAA,QAAA,SAAA;AAAA,QAAA;;;;;;"}
@@ -22,7 +22,7 @@ import { default as default32 } from "./confirmPopover/ConfirmPopover.vue.js";
22
22
  import { default as default33, default as default34, ModalRole } from "./modal/Modal.vue.js";
23
23
  import { default as default35, default as default36, default as default37 } from "./OverlayBody.vue.js";
24
24
  import { default as default38, default as default39, default as default40 } from "./OverlayCloseButton.vue.js";
25
- import { default as default41, default as default42, ModalPhoneLayout, ModalSize } from "./modal/ModalContent.vue.js";
25
+ import { default as default41, default as default42, ModalHeight, ModalPhoneLayout, ModalSize } from "./modal/ModalContent.vue.js";
26
26
  import { default as default43, default as default44, default as default45 } from "./OverlayFooter.vue.js";
27
27
  import { default as default46, default as default47, default as default48 } from "./OverlayHeader.vue.js";
28
28
  import { default as default49, default as default50 } from "./modal/ModalTrigger.vue.js";
@@ -98,6 +98,7 @@ export {
98
98
  default19 as ModalDescription,
99
99
  default45 as ModalFooter,
100
100
  default48 as ModalHeader,
101
+ ModalHeight,
101
102
  ModalPhoneLayout,
102
103
  ModalRole,
103
104
  ModalSize,
@@ -13,6 +13,17 @@ export declare const ModalSize: {
13
13
  readonly Full: "full";
14
14
  };
15
15
  export type ModalSize = (typeof ModalSize)[keyof typeof ModalSize];
16
+ /** Defines how tall a `ModalContent` panel is; either way it never outgrows the window. */
17
+ export declare const ModalHeight: {
18
+ /** Refers to a panel that fits its content โ€” a confirm, an alert, a short prompt settled when it opens. */
19
+ readonly Auto: "auto";
20
+ /**
21
+ * Refers to a panel held at the height paired with its `size` step, whatever its content: a streamed progress, a
22
+ * list that loads, a multi-step flow. The body scrolls; the frame never moves.
23
+ */
24
+ readonly Fixed: "fixed";
25
+ };
26
+ export type ModalHeight = (typeof ModalHeight)[keyof typeof ModalHeight];
16
27
  /** Defines how a `ModalContent` panel lays out below the `sm` breakpoint; from `sm` up it is the centred card. */
17
28
  export declare const ModalPhoneLayout: {
18
29
  /** Refers to a panel that fills the screen โ€” header on top, a scrolling body, the footer pinned to the bottom. */
@@ -41,6 +52,11 @@ export interface ModalContentProps {
41
52
  readonly isBlurred?: boolean;
42
53
  /** The panel's max-width step; a `max-w-*` class still overrides it. Default `md`. */
43
54
  readonly size?: ModalSize;
55
+ /**
56
+ * Whether the panel fits its content or holds the height paired with `size`: `sm` 24rem ยท `md` 32rem ยท `lg` 40rem ยท
57
+ * `xl` 48rem ยท `full` the window. Either way it caps at the window and its body scrolls. Default `auto`.
58
+ */
59
+ readonly height?: ModalHeight;
44
60
  /** The visual recipe. Default `elevated`. */
45
61
  readonly variant?: SurfaceVariant;
46
62
  /** The color tone the recipe is tinted with. */
@@ -63,6 +79,7 @@ declare const _default: __VLS_WithSlots<import('vue').DefineComponent<ModalConte
63
79
  el: Readonly<import('vue').ShallowRef<HTMLDivElement | null>>;
64
80
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ModalContentProps> & Readonly<{}>, {
65
81
  readonly size: ModalSize;
82
+ readonly height: ModalHeight;
66
83
  readonly phoneLayout: ModalPhoneLayout;
67
84
  readonly showBackdrop: boolean;
68
85
  readonly hideBackdrop: boolean;
@@ -10,7 +10,7 @@ import { Presence } from "../../../foundation/primitives/presence/Presence.js";
10
10
  import _sfc_main$4 from "../../../foundation/primitives/focusScope/FocusScope.vue.js";
11
11
  import _sfc_main$5 from "../../../foundation/primitives/dismissableLayer/DismissableLayer.vue.js";
12
12
  const _hoisted_1 = ["data-phone-layout"];
13
- const _hoisted_2 = ["role", "aria-labelledby", "aria-describedby", "data-phone-layout"];
13
+ const _hoisted_2 = ["role", "aria-labelledby", "aria-describedby", "data-phone-layout", "data-height"];
14
14
  const _hoisted_3 = {
15
15
  key: 1,
16
16
  "aria-hidden": "true",
@@ -33,6 +33,15 @@ const ModalSize = {
33
33
  /** Refers to a panel that spans the window, inside its gutter. */
34
34
  Full: "full"
35
35
  };
36
+ const ModalHeight = {
37
+ /** Refers to a panel that fits its content โ€” a confirm, an alert, a short prompt settled when it opens. */
38
+ Auto: "auto",
39
+ /**
40
+ * Refers to a panel held at the height paired with its `size` step, whatever its content: a streamed progress, a
41
+ * list that loads, a multi-step flow. The body scrolls; the frame never moves.
42
+ */
43
+ Fixed: "fixed"
44
+ };
36
45
  const ModalPhoneLayout = {
37
46
  /** Refers to a panel that fills the screen โ€” header on top, a scrolling body, the footer pinned to the bottom. */
38
47
  Fullscreen: "fullscreen",
@@ -48,6 +57,13 @@ const ModalSizeClass = {
48
57
  xl: "max-w-4xl",
49
58
  full: "max-w-none"
50
59
  };
60
+ const ModalFixedHeightClass = {
61
+ sm: "h-[min(24rem,calc(100dvh-2rem))]",
62
+ md: "h-[min(32rem,calc(100dvh-2rem))]",
63
+ lg: "h-[min(40rem,calc(100dvh-2rem))]",
64
+ xl: "h-[min(48rem,calc(100dvh-2rem))]",
65
+ full: "h-[calc(100dvh-2rem)]"
66
+ };
51
67
  const LayerPhoneClass = {
52
68
  fullscreen: "max-sm:place-items-stretch max-sm:p-0",
53
69
  sheet: "max-sm:items-end max-sm:justify-items-stretch max-sm:p-0",
@@ -94,6 +110,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
94
110
  hideBackdrop: { type: Boolean, default: void 0 },
95
111
  isBlurred: { type: Boolean },
96
112
  size: { default: "md" },
113
+ height: { default: ModalHeight.Auto },
97
114
  variant: {},
98
115
  tone: {},
99
116
  radius: {},
@@ -140,6 +157,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
140
157
  /* The panel never outgrows the window: it caps at the viewport and its body scrolls under a fixed header and
141
158
  footer. A panel without a body part scrolls whole. */
142
159
  "flex max-h-[calc(100dvh-2rem)] flex-col overflow-y-auto overscroll-contain",
160
+ /* A fixed panel keeps its height while its content streams in or changes step; the body takes the free height. */
161
+ props.height === ModalHeight.Fixed && ModalFixedHeightClass[props.size],
143
162
  PanelMotionClass[props.phoneLayout],
144
163
  surfaceVariants({
145
164
  variant: props.variant ?? "elevated",
@@ -240,7 +259,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
240
259
  "aria-modal": "true",
241
260
  "aria-labelledby": unref(context).titleId,
242
261
  "aria-describedby": unref(context).descriptionId,
243
- "data-phone-layout": props.phoneLayout
262
+ "data-phone-layout": props.phoneLayout,
263
+ "data-height": props.height
244
264
  }, rest.value, {
245
265
  class: classes.value,
246
266
  style: dragStyle.value
@@ -281,6 +301,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
281
301
  }
282
302
  });
283
303
  export {
304
+ ModalHeight,
284
305
  ModalPhoneLayout,
285
306
  ModalSize,
286
307
  _sfc_main as default
@@ -1 +1 @@
1
- {"version":3,"file":"ModalContent.vue.js","sources":["../../../../src/presentation/overlays/modal/ModalContent.vue"],"sourcesContent":["<script lang=\"ts\">\nimport {\n cn,\n type SurfaceElevation,\n type SurfacePadding,\n type SurfaceRadius,\n type SurfaceTone,\n type SurfaceVariant,\n} from '../../../foundation/styles';\n\n/** Defines the max-width step of a `ModalContent` panel. */\nexport const ModalSize = {\n /** Refers to a narrow panel (24rem) โ€” confirmations and short prompts. */\n Sm: 'sm',\n /** Refers to the default panel (32rem). */\n Md: 'md',\n /** Refers to a wide panel (42rem) โ€” forms with paired fields. */\n Lg: 'lg',\n /** Refers to an extra-wide panel (56rem) โ€” tables and multi-column forms. */\n Xl: 'xl',\n /** Refers to a panel that spans the window, inside its gutter. */\n Full: 'full',\n} as const;\n\nexport type ModalSize = (typeof ModalSize)[keyof typeof ModalSize];\n\n/** Defines how a `ModalContent` panel lays out below the `sm` breakpoint; from `sm` up it is the centred card. */\nexport const ModalPhoneLayout = {\n /** Refers to a panel that fills the screen โ€” header on top, a scrolling body, the footer pinned to the bottom. */\n Fullscreen: 'fullscreen',\n /** Refers to a sheet docked to the bottom edge, rounded on top, that slides up. */\n Sheet: 'sheet',\n /** Refers to the centred card, as on wider screens. */\n Card: 'card',\n} as const;\n\nexport type ModalPhoneLayout = (typeof ModalPhoneLayout)[keyof typeof ModalPhoneLayout];\n\nconst ModalSizeClass: Record<ModalSize, string> = {\n sm: 'max-w-sm',\n md: 'max-w-lg',\n lg: 'max-w-2xl',\n xl: 'max-w-4xl',\n full: 'max-w-none',\n};\n\n/* The layer, frame and panel classes per phone layout. Each is prefixed `max-sm:`, so wider screens keep the card. */\nconst LayerPhoneClass: Record<ModalPhoneLayout, string> = {\n fullscreen: 'max-sm:place-items-stretch max-sm:p-0',\n sheet: 'max-sm:items-end max-sm:justify-items-stretch max-sm:p-0',\n card: '',\n};\n\nconst FramePhoneClass: Record<ModalPhoneLayout, string> = {\n fullscreen: 'max-sm:justify-items-stretch',\n sheet: 'max-sm:justify-items-stretch',\n card: '',\n};\n\n/* A wrapping `<form>` joins the fullscreen column, so its `ModalBody` takes the free height and the footer pins. */\nconst PanelPhoneClass: Record<ModalPhoneLayout, string> = {\n fullscreen: cn(\n 'max-sm:h-dvh max-sm:max-h-dvh max-sm:w-full max-sm:max-w-none max-sm:rounded-none',\n 'max-sm:[--ui-overlay-inset-top:env(safe-area-inset-top)]',\n 'max-sm:[&>form]:flex max-sm:[&>form]:min-h-0 max-sm:[&>form]:flex-1 max-sm:[&>form]:flex-col',\n ),\n sheet: 'max-sm:w-full max-sm:max-w-none max-sm:rounded-t-2xl max-sm:rounded-b-none',\n card: '',\n};\n\n/* Phones rise from the bottom edge; the card keeps its pop wherever it shows. */\nconst PanelMotionClass: Record<ModalPhoneLayout, string> = {\n fullscreen: cn(\n 'sm:motion-safe:group-data-[state=open]:animate-(--animate-pop-in)',\n 'sm:motion-safe:group-data-[state=closed]:animate-(--animate-pop-out)',\n 'max-sm:motion-safe:group-data-[state=open]:animate-(--animate-sheet-in)',\n 'max-sm:motion-safe:group-data-[state=closed]:animate-(--animate-sheet-out)',\n ),\n sheet: cn(\n 'sm:motion-safe:group-data-[state=open]:animate-(--animate-pop-in)',\n 'sm:motion-safe:group-data-[state=closed]:animate-(--animate-pop-out)',\n 'max-sm:motion-safe:group-data-[state=open]:animate-(--animate-sheet-in)',\n 'max-sm:motion-safe:group-data-[state=closed]:animate-(--animate-sheet-out)',\n ),\n card: cn(\n 'motion-safe:group-data-[state=open]:animate-(--animate-pop-in)',\n 'motion-safe:group-data-[state=closed]:animate-(--animate-pop-out)',\n ),\n};\n\n/** The drag past which a released sheet handle dismisses: this many pixels, or a third of the sheet if shorter. */\nconst HandleDismissDistance = 96;\n\n/**\n * Represents the prop surface of `ModalContent`.\n *\n * React declared the surface axes by `extends SurfaceLayoutVariants`; they are\n * spelled out here because the SFC compiler's type resolver cannot follow a\n * `VariantProps<typeof โ€ฆ>` base and fails the build on it. The aliases below\n * are the canonical ones from `foundation/styles`, already locked against the\n * `surfaceVariants` config there, so the two cannot drift.\n */\nexport interface ModalContentProps {\n /** Shows the default backdrop behind the panel. Default `true`. */\n readonly showBackdrop?: boolean;\n /** @deprecated Use `showBackdrop` (inverted); this alias is removed next release. */\n readonly hideBackdrop?: boolean;\n\n /** The backdrop-blur toggle. */\n readonly isBlurred?: boolean;\n\n /** The panel's max-width step; a `max-w-*` class still overrides it. Default `md`. */\n readonly size?: ModalSize;\n\n /** The visual recipe. Default `elevated`. */\n readonly variant?: SurfaceVariant;\n\n /** The color tone the recipe is tinted with. */\n readonly tone?: SurfaceTone;\n\n /** The corner rounding. Default `lg`. */\n readonly radius?: SurfaceRadius;\n\n /** The inner spacing step. Default `xl`. */\n readonly padding?: SurfacePadding;\n\n /** The shadow depth. */\n readonly elevation?: SurfaceElevation;\n\n /** The layout below the `sm` breakpoint; wider screens always get the centred card. Default `fullscreen`. */\n readonly phoneLayout?: ModalPhoneLayout;\n\n /**\n * Shows a grab handle on a phone `sheet`. Dragging it down dismisses the dialog where outside clicks may, and\n * springs back where they may not. Default `false`.\n */\n readonly showHandle?: boolean;\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, provide, shallowRef, useAttrs, useTemplateRef, watch } from 'vue';\nimport { surfaceVariants } from '../../../foundation/styles';\nimport { DismissableLayer, FocusScope, Portal, Presence, ScrollLockProvider } from '../../../foundation/primitives';\nimport BackdropOverlay from '../backdropOverlay/BackdropOverlay.vue';\nimport { overlayChromeContextKey } from '../OverlayChrome';\nimport { useModalContext } from './Modal.vue';\n\n/** Renders the portalled dialog surface โ€” scrim, focus trap, scroll lock, and the a11y panel. */\ndefineOptions({ name: 'ModalContent', inheritAttrs: false });\n\n/** The panel content โ€” chrome subcomponents and the dialog body. React's `children`. */\ndefineSlots<{ default(): unknown }>();\n\nconst props = withDefaults(defineProps<ModalContentProps>(), {\n size: 'md',\n showBackdrop: undefined,\n hideBackdrop: undefined,\n phoneLayout: ModalPhoneLayout.Fullscreen,\n showHandle: false,\n});\n\n/** `showBackdrop` first, then the inverted deprecated `hideBackdrop`. */\nconst hasBackdrop = computed(() => props.showBackdrop ?? !(props.hideBackdrop ?? false));\n\nconst attrs = useAttrs();\nconst context = useModalContext();\nconst el = useTemplateRef<HTMLDivElement>('el');\n\n/* Refs lifted to setup consts so the template auto-unwraps them (a plain injected object does not). */\nconst isOpen = context.open;\nconst role = context.role;\nconst dismissOnEscape = context.dismissOnEscape;\n\nfunction close(): void {\n context.setOpen(false);\n}\n\nprovide(overlayChromeContextKey, {\n titleId: context.titleId,\n descriptionId: context.descriptionId,\n close,\n});\n\n/* Safe-area spacers keep content clear of the notch and the home indicator; they collapse from `sm` up. */\nconst hasBottomInset = computed(() => props.phoneLayout !== ModalPhoneLayout.Card);\nconst hasTopInset = computed(() => props.phoneLayout === ModalPhoneLayout.Fullscreen);\nconst hasHandle = computed(() => props.showHandle && props.phoneLayout === ModalPhoneLayout.Sheet);\n\nconst layerClasses = computed(() =>\n cn(\n 'ui-modal-layer group fixed inset-0 z-modal grid place-items-center overflow-y-auto p-4',\n 'motion-safe:data-[state=open]:animate-(--animate-fade-in)',\n 'motion-safe:data-[state=closed]:animate-(--animate-fade-out)',\n LayerPhoneClass[props.phoneLayout],\n ),\n);\n\nconst frameClasses = computed(() =>\n cn('ui-modal-frame grid w-full justify-items-center', FramePhoneClass[props.phoneLayout]),\n);\n\nconst classes = computed(() =>\n cn(\n 'ui-modal-content relative w-full',\n ModalSizeClass[props.size],\n /* The panel never outgrows the window: it caps at the viewport and its body scrolls under a fixed header and\n footer. A panel without a body part scrolls whole. */\n 'flex max-h-[calc(100dvh-2rem)] flex-col overflow-y-auto overscroll-contain',\n PanelMotionClass[props.phoneLayout],\n surfaceVariants({\n variant: props.variant ?? 'elevated',\n tone: props.tone,\n radius: props.radius ?? 'lg',\n padding: props.padding ?? 'xl',\n elevation: props.elevation,\n }),\n attrs.class as string | undefined,\n /* Last, so a caller's width, height or radius serves the card and the phone layout still fills the screen. */\n PanelPhoneClass[props.phoneLayout],\n ),\n);\n\n/** Everything but `class`, which is re-applied through `cn` above. */\nconst rest = computed(() => {\n const { class: _class, ...others } = attrs;\n return others;\n});\n\n/* The sheet handle drag. The offset rides on the panel's transform; a release past the distance closes the dialog,\n and the exit keyframe leaves from that offset. Anything shorter springs back. */\nconst dragOffset = shallowRef(0);\nconst isDragging = shallowRef(false);\nlet dragPointer: { readonly id: number; readonly startY: number } | null = null;\n\nwatch(isOpen, (open) => {\n if (open) dragOffset.value = 0;\n});\n\nconst dragStyle = computed(() =>\n hasHandle.value\n ? {\n transform: dragOffset.value > 0 ? `translateY(${dragOffset.value}px)` : undefined,\n transition: isDragging.value ? 'none' : 'transform var(--duration-base) var(--ease-out)',\n }\n : undefined,\n);\n\nfunction handlePointerDown(event: PointerEvent): void {\n if (event.button !== 0) return;\n dragPointer = { id: event.pointerId, startY: event.clientY };\n isDragging.value = true;\n try {\n (event.currentTarget as HTMLElement).setPointerCapture(event.pointerId);\n } catch {\n /* A synthetic or already-released pointer has nothing to capture; the drag still tracks moves on the handle. */\n }\n}\n\nfunction handlePointerMove(event: PointerEvent): void {\n if (dragPointer?.id !== event.pointerId) return;\n dragOffset.value = Math.max(0, event.clientY - dragPointer.startY);\n}\n\nfunction handlePointerEnd(event: PointerEvent): void {\n if (dragPointer?.id !== event.pointerId) return;\n dragPointer = null;\n isDragging.value = false;\n const height = el.value?.offsetHeight ?? 0;\n const distance = Math.min(HandleDismissDistance, height / 3);\n if (event.type === 'pointerup' && dragOffset.value > distance && context.dismissOnOutsideClick.value) {\n context.setOpen(false);\n return;\n }\n dragOffset.value = 0;\n}\n\n/** Outside-click dismissal โ€” `.self` is React's `e.target !== e.currentTarget` guard. */\nfunction handleOutsideClick(): void {\n if (context.dismissOnOutsideClick.value) context.setOpen(false);\n}\n\nfunction handleEscape(): void {\n context.setOpen(false);\n}\n\ndefineExpose({ el });\n</script>\n\n<template>\n <Portal>\n <!-- Lock follows open state, not mount โ€” Content can mount closed. -->\n <ScrollLockProvider :is-enabled=\"isOpen\">\n <!-- The scrim runs on `BackdropOverlay`'s own `Presence` (its `isOpen` prop) so the\n fade-out plays before it unmounts. React wrapped it in a second, outer\n `Presence`, whose injected `data-state` the inner one then overwrote โ€”\n passing the state straight in is the same intent without the masking. -->\n <BackdropOverlay v-if=\"hasBackdrop\" is-inline :is-open=\"isOpen\" :is-blurred=\"props.isBlurred\" />\n <!-- Outside-click dismissal lives on the centering wrapper (it covers the\n backdrop): a click on the padding (`.self`) = outside. The wrapper is the\n Presence-animated node โ€” `Presence` injects `data-state` + `ref` onto it and\n watches *its own* animations (no subtree walk), so the wrapper carries a\n (transparent) fade and the visible pop lands on the panel via\n `group-data-[state=*]`. Both share the same token timing, so the wrapper fade\n gates unmount correctly. -->\n <Presence :is-present=\"isOpen\">\n <div :class=\"layerClasses\" :data-phone-layout=\"props.phoneLayout\" @click.self=\"handleOutsideClick\">\n <!-- The layer is the grid item, so it spans the window's width: a shrink-wrapped layer would hold the\n panel's `w-full` to its content width. It centers the panel in turn. -->\n <FocusScope as-child is-trapped can-loop is-modal>\n <DismissableLayer\n :class=\"frameClasses\"\n :is-escape-disabled=\"!dismissOnEscape\"\n is-outside-click-disabled\n :on-escape=\"handleEscape\"\n >\n <div\n ref=\"el\"\n :role=\"role\"\n aria-modal=\"true\"\n :aria-labelledby=\"context.titleId\"\n :aria-describedby=\"context.descriptionId\"\n :data-phone-layout=\"props.phoneLayout\"\n v-bind=\"rest\"\n :class=\"classes\"\n :style=\"dragStyle\"\n >\n <div\n v-if=\"hasHandle\"\n data-modal-handle\n aria-hidden=\"true\"\n class=\"absolute inset-x-0 top-0 z-raised flex h-6 cursor-grab touch-none justify-center pt-2 sm:hidden\"\n @pointerdown=\"handlePointerDown\"\n @pointermove=\"handlePointerMove\"\n @pointerup=\"handlePointerEnd\"\n @pointercancel=\"handlePointerEnd\"\n >\n <span class=\"h-1 w-10 rounded-full bg-border-strong forced-colors:bg-[CanvasText]\" />\n </div>\n <span\n v-if=\"hasTopInset\"\n aria-hidden=\"true\"\n class=\"block h-[env(safe-area-inset-top)] shrink-0 sm:hidden\"\n />\n <slot />\n <span\n v-if=\"hasBottomInset\"\n aria-hidden=\"true\"\n class=\"block h-[env(safe-area-inset-bottom)] shrink-0 sm:hidden\"\n />\n </div>\n </DismissableLayer>\n </FocusScope>\n </div>\n </Presence>\n </ScrollLockProvider>\n </Portal>\n</template>\n"],"names":["_createBlock","_unref","Portal","_createVNode","ScrollLockProvider","BackdropOverlay","_createElementVNode","FocusScope","DismissableLayer","_mergeProps","_createElementBlock","_openBlock","_renderSlot"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A,SADRK,UAAA,GAAAD,mBAIE,QAJF,UAIE;8BACFE,WAAQ,KAAA,QAAA,SAAA;AAAA,8BAEA,eAAA,SADRD,UAAA,GAAAD,mBAIE,QAJF,UAIE;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"ModalContent.vue.js","sources":["../../../../src/presentation/overlays/modal/ModalContent.vue"],"sourcesContent":["<script lang=\"ts\">\nimport {\n cn,\n type SurfaceElevation,\n type SurfacePadding,\n type SurfaceRadius,\n type SurfaceTone,\n type SurfaceVariant,\n} from '../../../foundation/styles';\n\n/** Defines the max-width step of a `ModalContent` panel. */\nexport const ModalSize = {\n /** Refers to a narrow panel (24rem) โ€” confirmations and short prompts. */\n Sm: 'sm',\n /** Refers to the default panel (32rem). */\n Md: 'md',\n /** Refers to a wide panel (42rem) โ€” forms with paired fields. */\n Lg: 'lg',\n /** Refers to an extra-wide panel (56rem) โ€” tables and multi-column forms. */\n Xl: 'xl',\n /** Refers to a panel that spans the window, inside its gutter. */\n Full: 'full',\n} as const;\n\nexport type ModalSize = (typeof ModalSize)[keyof typeof ModalSize];\n\n/** Defines how tall a `ModalContent` panel is; either way it never outgrows the window. */\nexport const ModalHeight = {\n /** Refers to a panel that fits its content โ€” a confirm, an alert, a short prompt settled when it opens. */\n Auto: 'auto',\n /**\n * Refers to a panel held at the height paired with its `size` step, whatever its content: a streamed progress, a\n * list that loads, a multi-step flow. The body scrolls; the frame never moves.\n */\n Fixed: 'fixed',\n} as const;\n\nexport type ModalHeight = (typeof ModalHeight)[keyof typeof ModalHeight];\n\n/** Defines how a `ModalContent` panel lays out below the `sm` breakpoint; from `sm` up it is the centred card. */\nexport const ModalPhoneLayout = {\n /** Refers to a panel that fills the screen โ€” header on top, a scrolling body, the footer pinned to the bottom. */\n Fullscreen: 'fullscreen',\n /** Refers to a sheet docked to the bottom edge, rounded on top, that slides up. */\n Sheet: 'sheet',\n /** Refers to the centred card, as on wider screens. */\n Card: 'card',\n} as const;\n\nexport type ModalPhoneLayout = (typeof ModalPhoneLayout)[keyof typeof ModalPhoneLayout];\n\nconst ModalSizeClass: Record<ModalSize, string> = {\n sm: 'max-w-sm',\n md: 'max-w-lg',\n lg: 'max-w-2xl',\n xl: 'max-w-4xl',\n full: 'max-w-none',\n};\n\n/* The fixed height paired with each width step, capped at the window like the panel itself. */\nconst ModalFixedHeightClass: Record<ModalSize, string> = {\n sm: 'h-[min(24rem,calc(100dvh-2rem))]',\n md: 'h-[min(32rem,calc(100dvh-2rem))]',\n lg: 'h-[min(40rem,calc(100dvh-2rem))]',\n xl: 'h-[min(48rem,calc(100dvh-2rem))]',\n full: 'h-[calc(100dvh-2rem)]',\n};\n\n/* The layer, frame and panel classes per phone layout. Each is prefixed `max-sm:`, so wider screens keep the card. */\nconst LayerPhoneClass: Record<ModalPhoneLayout, string> = {\n fullscreen: 'max-sm:place-items-stretch max-sm:p-0',\n sheet: 'max-sm:items-end max-sm:justify-items-stretch max-sm:p-0',\n card: '',\n};\n\nconst FramePhoneClass: Record<ModalPhoneLayout, string> = {\n fullscreen: 'max-sm:justify-items-stretch',\n sheet: 'max-sm:justify-items-stretch',\n card: '',\n};\n\n/* A wrapping `<form>` joins the fullscreen column, so its `ModalBody` takes the free height and the footer pins. */\nconst PanelPhoneClass: Record<ModalPhoneLayout, string> = {\n fullscreen: cn(\n 'max-sm:h-dvh max-sm:max-h-dvh max-sm:w-full max-sm:max-w-none max-sm:rounded-none',\n 'max-sm:[--ui-overlay-inset-top:env(safe-area-inset-top)]',\n 'max-sm:[&>form]:flex max-sm:[&>form]:min-h-0 max-sm:[&>form]:flex-1 max-sm:[&>form]:flex-col',\n ),\n sheet: 'max-sm:w-full max-sm:max-w-none max-sm:rounded-t-2xl max-sm:rounded-b-none',\n card: '',\n};\n\n/* Phones rise from the bottom edge; the card keeps its pop wherever it shows. */\nconst PanelMotionClass: Record<ModalPhoneLayout, string> = {\n fullscreen: cn(\n 'sm:motion-safe:group-data-[state=open]:animate-(--animate-pop-in)',\n 'sm:motion-safe:group-data-[state=closed]:animate-(--animate-pop-out)',\n 'max-sm:motion-safe:group-data-[state=open]:animate-(--animate-sheet-in)',\n 'max-sm:motion-safe:group-data-[state=closed]:animate-(--animate-sheet-out)',\n ),\n sheet: cn(\n 'sm:motion-safe:group-data-[state=open]:animate-(--animate-pop-in)',\n 'sm:motion-safe:group-data-[state=closed]:animate-(--animate-pop-out)',\n 'max-sm:motion-safe:group-data-[state=open]:animate-(--animate-sheet-in)',\n 'max-sm:motion-safe:group-data-[state=closed]:animate-(--animate-sheet-out)',\n ),\n card: cn(\n 'motion-safe:group-data-[state=open]:animate-(--animate-pop-in)',\n 'motion-safe:group-data-[state=closed]:animate-(--animate-pop-out)',\n ),\n};\n\n/** The drag past which a released sheet handle dismisses: this many pixels, or a third of the sheet if shorter. */\nconst HandleDismissDistance = 96;\n\n/**\n * Represents the prop surface of `ModalContent`.\n *\n * React declared the surface axes by `extends SurfaceLayoutVariants`; they are\n * spelled out here because the SFC compiler's type resolver cannot follow a\n * `VariantProps<typeof โ€ฆ>` base and fails the build on it. The aliases below\n * are the canonical ones from `foundation/styles`, already locked against the\n * `surfaceVariants` config there, so the two cannot drift.\n */\nexport interface ModalContentProps {\n /** Shows the default backdrop behind the panel. Default `true`. */\n readonly showBackdrop?: boolean;\n /** @deprecated Use `showBackdrop` (inverted); this alias is removed next release. */\n readonly hideBackdrop?: boolean;\n\n /** The backdrop-blur toggle. */\n readonly isBlurred?: boolean;\n\n /** The panel's max-width step; a `max-w-*` class still overrides it. Default `md`. */\n readonly size?: ModalSize;\n\n /**\n * Whether the panel fits its content or holds the height paired with `size`: `sm` 24rem ยท `md` 32rem ยท `lg` 40rem ยท\n * `xl` 48rem ยท `full` the window. Either way it caps at the window and its body scrolls. Default `auto`.\n */\n readonly height?: ModalHeight;\n\n /** The visual recipe. Default `elevated`. */\n readonly variant?: SurfaceVariant;\n\n /** The color tone the recipe is tinted with. */\n readonly tone?: SurfaceTone;\n\n /** The corner rounding. Default `lg`. */\n readonly radius?: SurfaceRadius;\n\n /** The inner spacing step. Default `xl`. */\n readonly padding?: SurfacePadding;\n\n /** The shadow depth. */\n readonly elevation?: SurfaceElevation;\n\n /** The layout below the `sm` breakpoint; wider screens always get the centred card. Default `fullscreen`. */\n readonly phoneLayout?: ModalPhoneLayout;\n\n /**\n * Shows a grab handle on a phone `sheet`. Dragging it down dismisses the dialog where outside clicks may, and\n * springs back where they may not. Default `false`.\n */\n readonly showHandle?: boolean;\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, provide, shallowRef, useAttrs, useTemplateRef, watch } from 'vue';\nimport { surfaceVariants } from '../../../foundation/styles';\nimport { DismissableLayer, FocusScope, Portal, Presence, ScrollLockProvider } from '../../../foundation/primitives';\nimport BackdropOverlay from '../backdropOverlay/BackdropOverlay.vue';\nimport { overlayChromeContextKey } from '../OverlayChrome';\nimport { useModalContext } from './Modal.vue';\n\n/** Renders the portalled dialog surface โ€” scrim, focus trap, scroll lock, and the a11y panel. */\ndefineOptions({ name: 'ModalContent', inheritAttrs: false });\n\n/** The panel content โ€” chrome subcomponents and the dialog body. React's `children`. */\ndefineSlots<{ default(): unknown }>();\n\nconst props = withDefaults(defineProps<ModalContentProps>(), {\n size: 'md',\n height: ModalHeight.Auto,\n showBackdrop: undefined,\n hideBackdrop: undefined,\n phoneLayout: ModalPhoneLayout.Fullscreen,\n showHandle: false,\n});\n\n/** `showBackdrop` first, then the inverted deprecated `hideBackdrop`. */\nconst hasBackdrop = computed(() => props.showBackdrop ?? !(props.hideBackdrop ?? false));\n\nconst attrs = useAttrs();\nconst context = useModalContext();\nconst el = useTemplateRef<HTMLDivElement>('el');\n\n/* Refs lifted to setup consts so the template auto-unwraps them (a plain injected object does not). */\nconst isOpen = context.open;\nconst role = context.role;\nconst dismissOnEscape = context.dismissOnEscape;\n\nfunction close(): void {\n context.setOpen(false);\n}\n\nprovide(overlayChromeContextKey, {\n titleId: context.titleId,\n descriptionId: context.descriptionId,\n close,\n});\n\n/* Safe-area spacers keep content clear of the notch and the home indicator; they collapse from `sm` up. */\nconst hasBottomInset = computed(() => props.phoneLayout !== ModalPhoneLayout.Card);\nconst hasTopInset = computed(() => props.phoneLayout === ModalPhoneLayout.Fullscreen);\nconst hasHandle = computed(() => props.showHandle && props.phoneLayout === ModalPhoneLayout.Sheet);\n\nconst layerClasses = computed(() =>\n cn(\n 'ui-modal-layer group fixed inset-0 z-modal grid place-items-center overflow-y-auto p-4',\n 'motion-safe:data-[state=open]:animate-(--animate-fade-in)',\n 'motion-safe:data-[state=closed]:animate-(--animate-fade-out)',\n LayerPhoneClass[props.phoneLayout],\n ),\n);\n\nconst frameClasses = computed(() =>\n cn('ui-modal-frame grid w-full justify-items-center', FramePhoneClass[props.phoneLayout]),\n);\n\nconst classes = computed(() =>\n cn(\n 'ui-modal-content relative w-full',\n ModalSizeClass[props.size],\n /* The panel never outgrows the window: it caps at the viewport and its body scrolls under a fixed header and\n footer. A panel without a body part scrolls whole. */\n 'flex max-h-[calc(100dvh-2rem)] flex-col overflow-y-auto overscroll-contain',\n /* A fixed panel keeps its height while its content streams in or changes step; the body takes the free height. */\n props.height === ModalHeight.Fixed && ModalFixedHeightClass[props.size],\n PanelMotionClass[props.phoneLayout],\n surfaceVariants({\n variant: props.variant ?? 'elevated',\n tone: props.tone,\n radius: props.radius ?? 'lg',\n padding: props.padding ?? 'xl',\n elevation: props.elevation,\n }),\n attrs.class as string | undefined,\n /* Last, so a caller's width, height or radius serves the card and the phone layout still fills the screen. */\n PanelPhoneClass[props.phoneLayout],\n ),\n);\n\n/** Everything but `class`, which is re-applied through `cn` above. */\nconst rest = computed(() => {\n const { class: _class, ...others } = attrs;\n return others;\n});\n\n/* The sheet handle drag. The offset rides on the panel's transform; a release past the distance closes the dialog,\n and the exit keyframe leaves from that offset. Anything shorter springs back. */\nconst dragOffset = shallowRef(0);\nconst isDragging = shallowRef(false);\nlet dragPointer: { readonly id: number; readonly startY: number } | null = null;\n\nwatch(isOpen, (open) => {\n if (open) dragOffset.value = 0;\n});\n\nconst dragStyle = computed(() =>\n hasHandle.value\n ? {\n transform: dragOffset.value > 0 ? `translateY(${dragOffset.value}px)` : undefined,\n transition: isDragging.value ? 'none' : 'transform var(--duration-base) var(--ease-out)',\n }\n : undefined,\n);\n\nfunction handlePointerDown(event: PointerEvent): void {\n if (event.button !== 0) return;\n dragPointer = { id: event.pointerId, startY: event.clientY };\n isDragging.value = true;\n try {\n (event.currentTarget as HTMLElement).setPointerCapture(event.pointerId);\n } catch {\n /* A synthetic or already-released pointer has nothing to capture; the drag still tracks moves on the handle. */\n }\n}\n\nfunction handlePointerMove(event: PointerEvent): void {\n if (dragPointer?.id !== event.pointerId) return;\n dragOffset.value = Math.max(0, event.clientY - dragPointer.startY);\n}\n\nfunction handlePointerEnd(event: PointerEvent): void {\n if (dragPointer?.id !== event.pointerId) return;\n dragPointer = null;\n isDragging.value = false;\n const height = el.value?.offsetHeight ?? 0;\n const distance = Math.min(HandleDismissDistance, height / 3);\n if (event.type === 'pointerup' && dragOffset.value > distance && context.dismissOnOutsideClick.value) {\n context.setOpen(false);\n return;\n }\n dragOffset.value = 0;\n}\n\n/** Outside-click dismissal โ€” `.self` is React's `e.target !== e.currentTarget` guard. */\nfunction handleOutsideClick(): void {\n if (context.dismissOnOutsideClick.value) context.setOpen(false);\n}\n\nfunction handleEscape(): void {\n context.setOpen(false);\n}\n\ndefineExpose({ el });\n</script>\n\n<template>\n <Portal>\n <!-- Lock follows open state, not mount โ€” Content can mount closed. -->\n <ScrollLockProvider :is-enabled=\"isOpen\">\n <!-- The scrim runs on `BackdropOverlay`'s own `Presence` (its `isOpen` prop) so the\n fade-out plays before it unmounts. React wrapped it in a second, outer\n `Presence`, whose injected `data-state` the inner one then overwrote โ€”\n passing the state straight in is the same intent without the masking. -->\n <BackdropOverlay v-if=\"hasBackdrop\" is-inline :is-open=\"isOpen\" :is-blurred=\"props.isBlurred\" />\n <!-- Outside-click dismissal lives on the centering wrapper (it covers the\n backdrop): a click on the padding (`.self`) = outside. The wrapper is the\n Presence-animated node โ€” `Presence` injects `data-state` + `ref` onto it and\n watches *its own* animations (no subtree walk), so the wrapper carries a\n (transparent) fade and the visible pop lands on the panel via\n `group-data-[state=*]`. Both share the same token timing, so the wrapper fade\n gates unmount correctly. -->\n <Presence :is-present=\"isOpen\">\n <div :class=\"layerClasses\" :data-phone-layout=\"props.phoneLayout\" @click.self=\"handleOutsideClick\">\n <!-- The layer is the grid item, so it spans the window's width: a shrink-wrapped layer would hold the\n panel's `w-full` to its content width. It centers the panel in turn. -->\n <FocusScope as-child is-trapped can-loop is-modal>\n <DismissableLayer\n :class=\"frameClasses\"\n :is-escape-disabled=\"!dismissOnEscape\"\n is-outside-click-disabled\n :on-escape=\"handleEscape\"\n >\n <div\n ref=\"el\"\n :role=\"role\"\n aria-modal=\"true\"\n :aria-labelledby=\"context.titleId\"\n :aria-describedby=\"context.descriptionId\"\n :data-phone-layout=\"props.phoneLayout\"\n :data-height=\"props.height\"\n v-bind=\"rest\"\n :class=\"classes\"\n :style=\"dragStyle\"\n >\n <div\n v-if=\"hasHandle\"\n data-modal-handle\n aria-hidden=\"true\"\n class=\"absolute inset-x-0 top-0 z-raised flex h-6 cursor-grab touch-none justify-center pt-2 sm:hidden\"\n @pointerdown=\"handlePointerDown\"\n @pointermove=\"handlePointerMove\"\n @pointerup=\"handlePointerEnd\"\n @pointercancel=\"handlePointerEnd\"\n >\n <span class=\"h-1 w-10 rounded-full bg-border-strong forced-colors:bg-[CanvasText]\" />\n </div>\n <span\n v-if=\"hasTopInset\"\n aria-hidden=\"true\"\n class=\"block h-[env(safe-area-inset-top)] shrink-0 sm:hidden\"\n />\n <slot />\n <span\n v-if=\"hasBottomInset\"\n aria-hidden=\"true\"\n class=\"block h-[env(safe-area-inset-bottom)] shrink-0 sm:hidden\"\n />\n </div>\n </DismissableLayer>\n </FocusScope>\n </div>\n </Presence>\n </ScrollLockProvider>\n </Portal>\n</template>\n"],"names":["_createBlock","_unref","Portal","_createVNode","ScrollLockProvider","BackdropOverlay","_createElementVNode","FocusScope","DismissableLayer","_mergeProps","_createElementBlock","_openBlock","_renderSlot"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAWO,MAAM,YAAY;AAAA;AAAA,EAEvB,IAAI;AAAA;AAAA,EAEJ,IAAI;AAAA;AAAA,EAEJ,IAAI;AAAA;AAAA,EAEJ,IAAI;AAAA;AAAA,EAEJ,MAAM;AACR;AAKO,MAAM,cAAc;AAAA;AAAA,EAEzB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,EAKN,OAAO;AACT;AAKO,MAAM,mBAAmB;AAAA;AAAA,EAE9B,YAAY;AAAA;AAAA,EAEZ,OAAO;AAAA;AAAA,EAEP,MAAM;AACR;AAIA,MAAM,iBAA4C;AAAA,EAChD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,MAAM;AACR;AAGA,MAAM,wBAAmD;AAAA,EACvD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,MAAM;AACR;AAGA,MAAM,kBAAoD;AAAA,EACxD,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,MAAM;AACR;AAEA,MAAM,kBAAoD;AAAA,EACxD,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,MAAM;AACR;AAGA,MAAM,kBAAoD;AAAA,EACxD,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAAA,EAEF,OAAO;AAAA,EACP,MAAM;AACR;AAGA,MAAM,mBAAqD;AAAA,EACzD,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAAA,EAEF,OAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAAA,EAEF,MAAM;AAAA,IACJ;AAAA,IACA;AAAA,EAAA;AAEJ;AAGA,MAAM,wBAAwB;;;;;;;;;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AAAA,8BACzB,eAAa,MAAM;AAAA,4BAAA,GACZ,KAAA,OAAI;AAAA,8BACX,OAAO,QAAA;AAAA,8BACP,OAAO,UAAA;AAAA,4BAAA;8BAGA,UAAA,sBADRS,mBAWM,OAAA;AAAA;gCATJ,qBAAA;AAAA,gCACA,eAAY;AAAA,gCACZ,OAAM;AAAA,gCACL,eAAa;AAAA,gCACb,eAAa;AAAA,gCACb,aAAW;AAAA,gCACX,iBAAe;AAAA,8BAAA;gCAEhBJ,mBAAqF,QAAA,EAA/E,OAAM,uEAAA,GAAsE,MAAA,EAAA;AAAA,8BAAA;8BAG5E,YAAA,SADRK,UAAA,GAAAD,mBAIE,QAJF,UAIE;8BACFE,WAAQ,KAAA,QAAA,SAAA;AAAA,8BAEA,eAAA,SADRD,UAAA,GAAAD,mBAIE,QAJF,UAIE;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,6 +1,7 @@
1
1
  import _sfc_main from "./ModalContent.vue.js";
2
- import { ModalPhoneLayout, ModalSize } from "./ModalContent.vue.js";
2
+ import { ModalHeight, ModalPhoneLayout, ModalSize } from "./ModalContent.vue.js";
3
3
  export {
4
+ ModalHeight,
4
5
  ModalPhoneLayout,
5
6
  ModalSize,
6
7
  _sfc_main as default
@@ -1,6 +1,6 @@
1
1
  export { default as Modal, ModalRole, type ModalProps } from './Modal.vue';
2
2
  export { default as ModalTrigger, type ModalTriggerProps } from './ModalTrigger.vue';
3
- export { default as ModalContent, ModalPhoneLayout, ModalSize, type ModalContentProps } from './ModalContent.vue';
3
+ export { default as ModalContent, ModalHeight, ModalPhoneLayout, ModalSize, type ModalContentProps, } from './ModalContent.vue';
4
4
  export { default as ModalHeader } from '../OverlayHeader.vue';
5
5
  export { default as ModalTitle } from '../OverlayTitle.vue';
6
6
  export { default as ModalDescription } from '../OverlayDescription.vue';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wow-two-beta/fe",
3
- "version": "0.0.37",
3
+ "version": "0.0.39",
4
4
  "description": "Beta-forever Vue 3 fe sdk for the wow-two ecosystem โ€” components, application adapters and browser capabilities.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -258,6 +258,11 @@
258
258
  "import": "./dist/foundation/datetime/index.js",
259
259
  "default": "./dist/foundation/datetime/index.js"
260
260
  },
261
+ "./foundation/phone": {
262
+ "types": "./dist/foundation/phone/index.d.ts",
263
+ "import": "./dist/foundation/phone/index.js",
264
+ "default": "./dist/foundation/phone/index.js"
265
+ },
261
266
  "./foundation/validators": {
262
267
  "types": "./dist/foundation/validators/index.d.ts",
263
268
  "import": "./dist/foundation/validators/index.js",