@wow-two-beta/fe 0.0.38 → 0.0.40

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 (71) hide show
  1. package/dist/formsEngine/AppForm.d.ts +12 -3
  2. package/dist/formsEngine/FormOperations.d.ts +18 -0
  3. package/dist/formsEngine/FormOperations.js +9 -0
  4. package/dist/formsEngine/FormOperations.js.map +1 -1
  5. package/dist/formsEngine/adapters/house/HouseFormCore.js +15 -6
  6. package/dist/formsEngine/adapters/house/HouseFormCore.js.map +1 -1
  7. package/dist/formsEngine/adapters/tanstack/TanstackFormOverlay.d.ts +4 -0
  8. package/dist/formsEngine/adapters/tanstack/TanstackFormOverlay.js +10 -1
  9. package/dist/formsEngine/adapters/tanstack/TanstackFormOverlay.js.map +1 -1
  10. package/dist/formsEngine/adapters/tanstack/UseAppForm.js +9 -6
  11. package/dist/formsEngine/adapters/tanstack/UseAppForm.js.map +1 -1
  12. package/dist/foundation/animation/animatedLayout/AnimatedLayout.d.ts +3 -3
  13. package/dist/foundation/dom/FocusTarget.d.ts +13 -0
  14. package/dist/foundation/dom/FocusTarget.js +12 -0
  15. package/dist/foundation/dom/FocusTarget.js.map +1 -0
  16. package/dist/foundation/dom/index.d.ts +1 -0
  17. package/dist/foundation/dom/index.js +3 -0
  18. package/dist/foundation/dom/index.js.map +1 -1
  19. package/dist/foundation/phone/PhoneCountries.d.ts +13 -0
  20. package/dist/foundation/phone/PhoneCountries.js +62 -0
  21. package/dist/foundation/phone/PhoneCountries.js.map +1 -0
  22. package/dist/foundation/phone/PhoneFormats.d.ts +12 -0
  23. package/dist/foundation/phone/PhoneFormats.js +32 -0
  24. package/dist/foundation/phone/PhoneFormats.js.map +1 -0
  25. package/dist/foundation/phone/PhoneNumberExtensions.d.ts +94 -0
  26. package/dist/foundation/phone/PhoneNumberExtensions.js +137 -0
  27. package/dist/foundation/phone/PhoneNumberExtensions.js.map +1 -0
  28. package/dist/foundation/phone/index.d.ts +3 -0
  29. package/dist/foundation/phone/index.js +9 -0
  30. package/dist/foundation/phone/index.js.map +1 -0
  31. package/dist/foundation/primitives/index.d.ts +1 -0
  32. package/dist/foundation/primitives/index.js +3 -0
  33. package/dist/foundation/primitives/index.js.map +1 -1
  34. package/dist/foundation/primitives/swapTransition/SwapTransition.d.ts +76 -0
  35. package/dist/foundation/primitives/swapTransition/SwapTransition.js +240 -0
  36. package/dist/foundation/primitives/swapTransition/SwapTransition.js.map +1 -0
  37. package/dist/foundation/primitives/swapTransition/index.d.ts +1 -0
  38. package/dist/foundation/validators/Formats.d.ts +15 -0
  39. package/dist/foundation/validators/Formats.js +32 -1
  40. package/dist/foundation/validators/Formats.js.map +1 -1
  41. package/dist/foundation/validators/Messages.d.ts +1 -1
  42. package/dist/foundation/validators/Messages.js +10 -0
  43. package/dist/foundation/validators/Messages.js.map +1 -1
  44. package/dist/foundation/validators/index.d.ts +1 -1
  45. package/dist/foundation/validators/index.js +2 -1
  46. package/dist/index.css +11 -0
  47. package/dist/index.js +2 -1
  48. package/dist/index.js.map +1 -1
  49. package/dist/presentation/actions/refreshButton/RefreshButton.vue.js.map +1 -1
  50. package/dist/presentation/display/animatedNumberText/AnimatedNumberText.vue.d.ts +1 -1
  51. package/dist/presentation/display/carousel/Carousel.vue.d.ts +1 -1
  52. package/dist/presentation/display/countUpText/CountUpText.vue.d.ts +1 -1
  53. package/dist/presentation/display/scrollRevealGroup/ScrollRevealGroup.vue.d.ts +2 -2
  54. package/dist/presentation/forms/field/Field.vue.js +10 -3
  55. package/dist/presentation/forms/field/Field.vue.js.map +1 -1
  56. package/dist/presentation/forms/imageCropEditor/ImageCropEditor.vue.d.ts +1 -1
  57. package/dist/presentation/forms/imageEditor/ImageEditor.vue.d.ts +1 -1
  58. package/dist/presentation/forms/index.js +2 -1
  59. package/dist/presentation/forms/index.js.map +1 -1
  60. package/dist/presentation/forms/labeledField/LabeledField.vue.js +2 -2
  61. package/dist/presentation/forms/labeledField/LabeledField.vue.js.map +1 -1
  62. package/dist/presentation/forms/phoneInput/PhoneInput.vue.d.ts +5 -9
  63. package/dist/presentation/forms/phoneInput/PhoneInput.vue.js +104 -92
  64. package/dist/presentation/forms/phoneInput/PhoneInput.vue.js.map +1 -1
  65. package/dist/presentation/forms/phoneInput/PhoneInput2.vue.js +0 -2
  66. package/dist/presentation/forms/phoneInput/PhoneInput2.vue.js.map +1 -1
  67. package/dist/presentation/forms/phoneInput/index.d.ts +2 -1
  68. package/dist/presentation/layout/navbar/Navbar.vue.js.map +1 -1
  69. package/dist/router/adapters/vueRouter/routeAnnouncer/RouteAnnouncer.vue.js +17 -5
  70. package/dist/router/adapters/vueRouter/routeAnnouncer/RouteAnnouncer.vue.js.map +1 -1
  71. package/package.json +6 -1
@@ -1,9 +1,11 @@
1
1
  import { defineComponent, useAttrs, computed, ref, useTemplateRef, openBlock, createElementBlock, mergeProps, unref, normalizeClass, toDisplayString, Fragment, renderList, createElementVNode, createCommentVNode } from "vue";
2
2
  import { useLocale } from "../../../foundation/i18n/providers/LocaleContext.js";
3
- import { useNativeFormReset } from "../UseNativeFormReset.js";
4
- import { cn } from "../../../foundation/styles/Cn.js";
3
+ import { PhoneFormats } from "../../../foundation/phone/PhoneFormats.js";
4
+ import { PhoneNumberExtensions } from "../../../foundation/phone/PhoneNumberExtensions.js";
5
5
  import { useControlled } from "../../../foundation/state/hooks/UseControlled.js";
6
+ import { cn } from "../../../foundation/styles/Cn.js";
6
7
  import { inputBaseVariants, InputSize } from "../InputStyles.js";
8
+ import { useNativeFormReset } from "../UseNativeFormReset.js";
7
9
  import { useFormControl } from "../../../foundation/primitives/formControlContext/FormControlContext.js";
8
10
  const _hoisted_1 = ["data-readonly"];
9
11
  const _hoisted_2 = ["aria-label", "value", "disabled"];
@@ -11,79 +13,6 @@ const _hoisted_3 = ["value"];
11
13
  const _hoisted_4 = ["id", "value", "placeholder", "disabled", "readonly", "aria-invalid", "aria-describedby", "aria-required"];
12
14
  const _hoisted_5 = ["disabled", "form", "name", "value"];
13
15
  const _hoisted_6 = ["form"];
14
- const PhoneCountries = [
15
- { iso: "US", name: "United States", dial: "+1", flag: "🇺🇸" },
16
- { iso: "CA", name: "Canada", dial: "+1", flag: "🇨🇦" },
17
- { iso: "GB", name: "United Kingdom", dial: "+44", flag: "🇬🇧" },
18
- { iso: "AU", name: "Australia", dial: "+61", flag: "🇦🇺" },
19
- { iso: "DE", name: "Germany", dial: "+49", flag: "🇩🇪" },
20
- { iso: "FR", name: "France", dial: "+33", flag: "🇫🇷" },
21
- { iso: "ES", name: "Spain", dial: "+34", flag: "🇪🇸" },
22
- { iso: "IT", name: "Italy", dial: "+39", flag: "🇮🇹" },
23
- { iso: "NL", name: "Netherlands", dial: "+31", flag: "🇳🇱" },
24
- { iso: "BE", name: "Belgium", dial: "+32", flag: "🇧🇪" },
25
- { iso: "CH", name: "Switzerland", dial: "+41", flag: "🇨🇭" },
26
- { iso: "AT", name: "Austria", dial: "+43", flag: "🇦🇹" },
27
- { iso: "SE", name: "Sweden", dial: "+46", flag: "🇸🇪" },
28
- { iso: "NO", name: "Norway", dial: "+47", flag: "🇳🇴" },
29
- { iso: "DK", name: "Denmark", dial: "+45", flag: "🇩🇰" },
30
- { iso: "FI", name: "Finland", dial: "+358", flag: "🇫🇮" },
31
- { iso: "IE", name: "Ireland", dial: "+353", flag: "🇮🇪" },
32
- { iso: "PT", name: "Portugal", dial: "+351", flag: "🇵🇹" },
33
- { iso: "PL", name: "Poland", dial: "+48", flag: "🇵🇱" },
34
- { iso: "CZ", name: "Czechia", dial: "+420", flag: "🇨🇿" },
35
- { iso: "GR", name: "Greece", dial: "+30", flag: "🇬🇷" },
36
- { iso: "TR", name: "Türkiye", dial: "+90", flag: "🇹🇷" },
37
- { iso: "RU", name: "Russia", dial: "+7", flag: "🇷🇺" },
38
- { iso: "UA", name: "Ukraine", dial: "+380", flag: "🇺🇦" },
39
- { iso: "UZ", name: "Uzbekistan", dial: "+998", flag: "🇺🇿" },
40
- { iso: "KZ", name: "Kazakhstan", dial: "+7", flag: "🇰🇿" },
41
- { iso: "KG", name: "Kyrgyzstan", dial: "+996", flag: "🇰🇬" },
42
- { iso: "TJ", name: "Tajikistan", dial: "+992", flag: "🇹🇯" },
43
- { iso: "TM", name: "Turkmenistan", dial: "+993", flag: "🇹🇲" },
44
- { iso: "IL", name: "Israel", dial: "+972", flag: "🇮🇱" },
45
- { iso: "AE", name: "UAE", dial: "+971", flag: "🇦🇪" },
46
- { iso: "SA", name: "Saudi Arabia", dial: "+966", flag: "🇸🇦" },
47
- { iso: "EG", name: "Egypt", dial: "+20", flag: "🇪🇬" },
48
- { iso: "ZA", name: "South Africa", dial: "+27", flag: "🇿🇦" },
49
- { iso: "NG", name: "Nigeria", dial: "+234", flag: "🇳🇬" },
50
- { iso: "KE", name: "Kenya", dial: "+254", flag: "🇰🇪" },
51
- { iso: "IN", name: "India", dial: "+91", flag: "🇮🇳" },
52
- { iso: "PK", name: "Pakistan", dial: "+92", flag: "🇵🇰" },
53
- { iso: "BD", name: "Bangladesh", dial: "+880", flag: "🇧🇩" },
54
- { iso: "SG", name: "Singapore", dial: "+65", flag: "🇸🇬" },
55
- { iso: "MY", name: "Malaysia", dial: "+60", flag: "🇲🇾" },
56
- { iso: "TH", name: "Thailand", dial: "+66", flag: "🇹🇭" },
57
- { iso: "VN", name: "Vietnam", dial: "+84", flag: "🇻🇳" },
58
- { iso: "PH", name: "Philippines", dial: "+63", flag: "🇵🇭" },
59
- { iso: "ID", name: "Indonesia", dial: "+62", flag: "🇮🇩" },
60
- { iso: "JP", name: "Japan", dial: "+81", flag: "🇯🇵" },
61
- { iso: "KR", name: "South Korea", dial: "+82", flag: "🇰🇷" },
62
- { iso: "CN", name: "China", dial: "+86", flag: "🇨🇳" },
63
- { iso: "HK", name: "Hong Kong", dial: "+852", flag: "🇭🇰" },
64
- { iso: "TW", name: "Taiwan", dial: "+886", flag: "🇹🇼" },
65
- { iso: "NZ", name: "New Zealand", dial: "+64", flag: "🇳🇿" },
66
- { iso: "BR", name: "Brazil", dial: "+55", flag: "🇧🇷" },
67
- { iso: "AR", name: "Argentina", dial: "+54", flag: "🇦🇷" },
68
- { iso: "CL", name: "Chile", dial: "+56", flag: "🇨🇱" },
69
- { iso: "CO", name: "Colombia", dial: "+57", flag: "🇨🇴" },
70
- { iso: "MX", name: "Mexico", dial: "+52", flag: "🇲🇽" }
71
- ];
72
- function resolveCountries(isos) {
73
- if (!isos) return PhoneCountries;
74
- const known = [...new Set(isos)].map((iso) => PhoneCountries.find((c) => c.iso === iso)).filter((c) => c !== void 0);
75
- return known.length > 0 ? known : PhoneCountries;
76
- }
77
- function splitE164(value, countries, defaultIso) {
78
- if (!value) return { iso: defaultIso, national: "" };
79
- const sorted = [...countries].sort((a, b) => b.dial.length - a.dial.length);
80
- for (const c of sorted) {
81
- if (value.startsWith(c.dial)) {
82
- return { iso: c.iso, national: value.slice(c.dial.length).replace(/\D/g, "") };
83
- }
84
- }
85
- return { iso: defaultIso, national: value.replace(/\D/g, "") };
86
- }
87
16
  const _sfc_main = /* @__PURE__ */ defineComponent({
88
17
  ...{ name: "PhoneInput", inheritAttrs: false },
89
18
  __name: "PhoneInput",
@@ -95,10 +24,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
95
24
  isDisabled: { type: Boolean, default: void 0 },
96
25
  isReadOnly: { type: Boolean, default: void 0 },
97
26
  isInvalid: { type: Boolean, default: void 0 },
98
- placeholder: { default: "(555) 555-5555" },
27
+ placeholder: { default: void 0 },
99
28
  name: {}
100
29
  },
101
- emits: ["update:modelValue"],
30
+ emits: ["update:modelValue", "focus", "blur"],
102
31
  setup(__props, { emit: __emit }) {
103
32
  const props = __props;
104
33
  const emit = __emit;
@@ -115,7 +44,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
115
44
  const disabled = computed(() => props.isDisabled ?? ctx?.isDisabled);
116
45
  const readOnly = computed(() => props.isReadOnly ?? ctx?.isReadOnly);
117
46
  const invalid = computed(() => props.isInvalid ?? ctx?.isInvalid);
118
- const allowed = computed(() => resolveCountries(props.countries));
47
+ const allowed = computed(() => PhoneNumberExtensions.resolveCountries(props.countries));
119
48
  const fallbackIso = computed(
120
49
  () => allowed.value.find((c) => c.iso === props.defaultCountry)?.iso ?? allowed.value[0].iso
121
50
  );
@@ -125,14 +54,24 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
125
54
  if (selected && (!e164.value || e164.value.startsWith(selected.dial))) {
126
55
  return {
127
56
  iso: selected.iso,
128
- national: e164.value.slice(selected.dial.length).replace(/\D/g, "")
57
+ national: PhoneNumberExtensions.digitsOf(e164.value.slice(selected.dial.length))
129
58
  };
130
59
  }
131
- return splitE164(e164.value, allowed.value, fallbackIso.value);
60
+ return PhoneNumberExtensions.split(e164.value, allowed.value, fallbackIso.value);
132
61
  });
133
62
  const iso = computed(() => split.value.iso);
134
63
  const national = computed(() => split.value.national);
135
64
  const country = computed(() => allowed.value.find((c) => c.iso === iso.value) ?? allowed.value[0]);
65
+ const format = computed(() => PhoneNumberExtensions.formatOf(country.value));
66
+ const isForeign = computed(() => e164.value !== "" && !e164.value.startsWith(country.value.dial));
67
+ const displayed = computed(
68
+ () => isForeign.value ? national.value : PhoneNumberExtensions.formatNational(national.value, format.value)
69
+ );
70
+ const placeholderText = computed(() => {
71
+ if (props.placeholder !== void 0) return props.placeholder;
72
+ const mask = PhoneFormats[country.value.iso]?.mask;
73
+ return mask ? mask.replace(/X/g, "0") : void 0;
74
+ });
136
75
  function e164For(dial, digits) {
137
76
  return digits ? `${dial}${digits}` : "";
138
77
  }
@@ -143,10 +82,80 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
143
82
  const nextValue = e164For(next.dial, national.value);
144
83
  if (nextValue !== e164.value) controlled.setValue(nextValue);
145
84
  }
146
- function setNational(event) {
147
- const digits = event.target.value.replace(/\D/g, "");
85
+ function setDigits(digits) {
148
86
  selectedIso.value = country.value.iso;
149
- controlled.setValue(e164For(country.value.dial, digits));
87
+ const nextValue = e164For(country.value.dial, digits);
88
+ if (nextValue !== e164.value) controlled.setValue(nextValue);
89
+ }
90
+ function setInternational(text) {
91
+ const parsed = PhoneNumberExtensions.parseInternational(text, allowed.value, country.value.iso);
92
+ if (parsed.country) {
93
+ const max = PhoneNumberExtensions.lengthOf(parsed.country).max;
94
+ const digits = parsed.e164.slice(parsed.country.dial.length, parsed.country.dial.length + max);
95
+ selectedIso.value = parsed.country.iso;
96
+ const nextValue2 = e164For(parsed.country.dial, digits);
97
+ if (nextValue2 !== e164.value) controlled.setValue(nextValue2);
98
+ return PhoneNumberExtensions.formatNational(digits, PhoneNumberExtensions.formatOf(parsed.country));
99
+ }
100
+ const nextValue = parsed.e164.length > 1 ? parsed.e164 : "";
101
+ if (nextValue !== e164.value) controlled.setValue(nextValue);
102
+ return nextValue.slice(1);
103
+ }
104
+ const ReplacementInputTypes = /* @__PURE__ */ new Set([
105
+ void 0,
106
+ "insertReplacementText",
107
+ "insertFromDrop",
108
+ "insertFromPaste"
109
+ ]);
110
+ function setNational(event) {
111
+ const field = event.target;
112
+ const inputEvent = event;
113
+ if (inputEvent.isComposing) return;
114
+ if (ReplacementInputTypes.has(inputEvent.inputType) && field.value.trimStart().startsWith("+")) {
115
+ field.value = setInternational(field.value);
116
+ placeCaret(field, field.value.length);
117
+ return;
118
+ }
119
+ const edit = PhoneNumberExtensions.editNational({
120
+ text: field.value,
121
+ caret: field.selectionStart ?? field.value.length,
122
+ previousDigits: national.value,
123
+ inputType: inputEvent.inputType,
124
+ format: format.value
125
+ });
126
+ field.value = edit.text;
127
+ placeCaret(field, edit.caret);
128
+ setDigits(edit.digits);
129
+ }
130
+ function pasteNational(event) {
131
+ const text = event.clipboardData?.getData("text") ?? "";
132
+ const field = event.target;
133
+ if (text.trimStart().startsWith("+")) {
134
+ event.preventDefault();
135
+ field.value = setInternational(text);
136
+ placeCaret(field, field.value.length);
137
+ return;
138
+ }
139
+ const digits = PhoneNumberExtensions.digitsOf(text);
140
+ const stripped = PhoneNumberExtensions.withoutDialCode(digits, country.value);
141
+ if (stripped === digits) return;
142
+ event.preventDefault();
143
+ setDigits(stripped);
144
+ field.value = PhoneNumberExtensions.formatNational(stripped, format.value);
145
+ placeCaret(field, field.value.length);
146
+ }
147
+ function placeCaret(field, caret) {
148
+ if (field.ownerDocument.activeElement === field) field.setSelectionRange(caret, caret);
149
+ }
150
+ function isInside(event) {
151
+ const root = event.currentTarget;
152
+ return event.relatedTarget instanceof Node && root.contains(event.relatedTarget);
153
+ }
154
+ function onFocusin(event) {
155
+ if (!isInside(event)) emit("focus", event);
156
+ }
157
+ function onFocusout(event) {
158
+ if (!isInside(event)) emit("blur", event);
150
159
  }
151
160
  const OwnedAttributes = /* @__PURE__ */ new Set(["class"]);
152
161
  const passthroughAttrs = computed(
@@ -154,7 +163,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
154
163
  );
155
164
  const rootClass = computed(
156
165
  () => cn(
157
- "inline-flex items-stretch overflow-hidden rounded-md border bg-background",
166
+ "inline-flex h-10 items-stretch overflow-hidden rounded-md border bg-background",
158
167
  invalid.value ? "border-destructive" : "border-input",
159
168
  disabled.value && "opacity-60",
160
169
  readOnly.value && "bg-muted text-muted-foreground",
@@ -163,19 +172,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
163
172
  );
164
173
  const selectClass = computed(
165
174
  () => cn(
166
- "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",
175
+ "h-full cursor-pointer border-r border-input bg-card pl-2 pr-1 text-sm outline-hidden focus-visible:ring-2 focus-visible:ring-ring",
167
176
  readOnly.value && "cursor-default bg-muted text-muted-foreground"
168
177
  )
169
178
  );
170
179
  const prefixClass = computed(
171
180
  () => cn(
172
- "flex h-10 items-center border-r border-input bg-card px-2 text-sm",
181
+ "flex h-full items-center border-r border-input bg-card px-2 text-sm",
173
182
  readOnly.value && "bg-muted text-muted-foreground"
174
183
  )
175
184
  );
176
185
  const inputClass = cn(
177
186
  inputBaseVariants({ size: InputSize.Md }),
178
- "rounded-none border-0 focus-visible:ring-0 readonly:focus-visible:ring-0"
187
+ "h-full rounded-none border-0 focus-visible:ring-0 readonly:focus-visible:ring-0"
179
188
  );
180
189
  const formResetAnchor = useTemplateRef("formResetAnchor");
181
190
  const formResetRevision = useNativeFormReset(formResetAnchor, () => {
@@ -187,7 +196,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
187
196
  key: unref(formResetRevision),
188
197
  "data-readonly": readOnly.value || void 0,
189
198
  class: rootClass.value
190
- }, passthroughAttrs.value), [
199
+ }, passthroughAttrs.value, {
200
+ onFocusin,
201
+ onFocusout
202
+ }), [
191
203
  allowed.value.length === 1 ? (openBlock(), createElementBlock("span", {
192
204
  key: 0,
193
205
  class: normalizeClass(prefixClass.value)
@@ -212,15 +224,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
212
224
  inputmode: "tel",
213
225
  autocomplete: "tel-national",
214
226
  id: unref(ctx)?.id,
215
- value: national.value,
216
- placeholder: __props.placeholder,
227
+ value: displayed.value,
228
+ placeholder: placeholderText.value,
217
229
  disabled: disabled.value,
218
230
  readonly: readOnly.value,
219
231
  "aria-invalid": invalid.value || void 0,
220
232
  "aria-describedby": unref(ctx)?.describedBy,
221
233
  "aria-required": unref(ctx)?.isRequired || void 0,
222
234
  class: normalizeClass(unref(inputClass)),
223
- onInput: setNational
235
+ onInput: setNational,
236
+ onPaste: pasteNational
224
237
  }, null, 42, _hoisted_4),
225
238
  __props.name ? (openBlock(), createElementBlock("input", {
226
239
  key: 2,
@@ -242,7 +255,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
242
255
  }
243
256
  });
244
257
  export {
245
- PhoneCountries,
246
258
  _sfc_main as default
247
259
  };
248
260
  //# sourceMappingURL=PhoneInput.vue.js.map
@@ -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,EACxD,EAAE,KAAK,MAAM,MAAM,aAAa,MAAM,OAAO,MAAM,OAAA;AAAA,EACnD,EAAE,KAAK,MAAM,MAAM,WAAW,MAAM,OAAO,MAAM,OAAA;AAAA,EACjD,EAAE,KAAK,MAAM,MAAM,UAAU,MAAM,OAAO,MAAM,OAAA;AAAA,EAChD,EAAE,KAAK,MAAM,MAAM,SAAS,MAAM,OAAO,MAAM,OAAA;AAAA,EAC/C,EAAE,KAAK,MAAM,MAAM,SAAS,MAAM,OAAO,MAAM,OAAA;AAAA,EAC/C,EAAE,KAAK,MAAM,MAAM,eAAe,MAAM,OAAO,MAAM,OAAA;AAAA,EACrD,EAA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,SAAA;AAAA,UAbA,MAAK;AAAA,UACL,WAAU;AAAA,UACV,cAAa;AAAA,UACZ,IAAIJ,MAAA,GAAA,GAAK;AAAA,UACT,OAAO,SAAA;AAAA,UACP,aAAa,QAAA;AAAA,UACb,UAAU,SAAA;AAAA,UACV,UAAU,SAAA;AAAA,UACV,gBAAc,QAAA,SAAW;AAAA,UACzB,oBAAkBA,MAAA,GAAA,GAAK;AAAA,UACvB,iBAAeA,MAAA,GAAA,GAAK,cAAc;AAAA,UAClC,sBAAOA,MAAA,UAAA,CAAU;AAAA,UACjB,SAAO;AAAA,QAAA;QAGF,QAAA,qBADRF,mBAOE,SAAA;AAAA;UALA,MAAK;AAAA,UACJ,UAAU,SAAA;AAAA,UACV,MAAI,OAASO,YAAO,oBAAoBA,KAAAA,OAAO,OAAO;AAAA,UACtD,MAAM,QAAA;AAAA,UACN,OAAOL,MAAA,IAAA;AAAA,QAAA;QAEVI,mBAKE,SAAA;AAAA,mBAJI;AAAA,UAAJ,KAAI;AAAA,UACJ,MAAK;AAAA,UACJ,MAAI,OAASC,YAAO,oBAAoBA,KAAAA,OAAO,OAAO;AAAA,UACvD,eAAY;AAAA,QAAA;;;;;"}
1
+ {"version":3,"file":"PhoneInput.vue.js","sources":["../../../../src/presentation/forms/phoneInput/PhoneInput.vue"],"sourcesContent":["<script lang=\"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 /** Fires when focus enters the control from outside it — the country select or the number field. */\n focus: [event: FocusEvent];\n /** Fires when focus leaves the whole control; moving between the country select and the number field stays inside. */\n blur: [event: FocusEvent];\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\n/* The composite's focus is one focus: the root div never takes focus itself, so `focus` and `blur` follow the\n bubbling `focusin` / `focusout` of its parts and skip a move between them. A `null` related target (focus left\n for the body, or the window lost focus) counts as outside. */\nfunction isInside(event: FocusEvent): boolean {\n const root = event.currentTarget as HTMLElement;\n return event.relatedTarget instanceof Node && root.contains(event.relatedTarget);\n}\n\nfunction onFocusin(event: FocusEvent): void {\n if (!isInside(event)) emit('focus', event);\n}\n\nfunction onFocusout(event: FocusEvent): void {\n if (!isInside(event)) emit('blur', event);\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 h-10 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 frame is the medium input step (`h-10`, border included); its parts fill it rather than add their own height\n to the border. The country select is a native `<select>`, which has no `readonly`: a read-only phone input\n disables it, so it takes the frame's muted surface and the default cursor rather than the pointer. */\nconst selectClass = computed(() =>\n cn(\n 'h-full 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-full 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 'h-full 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\n :key=\"formResetRevision\"\n :data-readonly=\"readOnly || undefined\"\n :class=\"rootClass\"\n v-bind=\"passthroughAttrs\"\n @focusin=\"onFocusin\"\n @focusout=\"onFocusout\"\n >\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;AASb,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,sB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,UACJ,UAAU,SAAA;AAAA,UACV,MAAI,OAASO,YAAO,oBAAoBA,KAAAA,OAAO,OAAO;AAAA,UACtD,MAAM,QAAA;AAAA,UACN,OAAOL,MAAA,IAAA;AAAA,QAAA;QAEVI,mBAKE,SAAA;AAAA,mBAJI;AAAA,UAAJ,KAAI;AAAA,UACJ,MAAK;AAAA,UACJ,MAAI,OAASC,YAAO,oBAAoBA,KAAAA,OAAO,OAAO;AAAA,UACvD,eAAY;AAAA,QAAA;;;;;"}
@@ -1,7 +1,5 @@
1
1
  import _sfc_main from "./PhoneInput.vue.js";
2
- import { PhoneCountries } from "./PhoneInput.vue.js";
3
2
  export {
4
- PhoneCountries,
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","_createEl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AO,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;;;;;;;;;;;"}
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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AAA;gBAEbD,KAAAA,OAAO,oBAAlBE,mBAEM,OAAA;AAAA;kBAFkB,sBAAO,WAAA,KAAU;AAAA,gBAAA;kBACvCD,WAAmB,KAAA,QAAA,KAAA;AAAA,gBAAA;;;;;;;;;;;"}
@@ -1,6 +1,7 @@
1
1
  import { defineComponent, shallowRef, onScopeDispose, onMounted, watch, nextTick, openBlock, createElementBlock, toDisplayString } from "vue";
2
- import { useRoute } from "vue-router";
2
+ import { useRoute, useRouter, START_LOCATION } from "vue-router";
3
3
  import { deepestHandleValue, resolveHandleValue } from "../RouteHandles.js";
4
+ import { focusTarget } from "../../../../foundation/dom/FocusTarget.js";
4
5
  const _hoisted_1 = {
5
6
  "aria-live": "polite",
6
7
  "aria-atomic": "true",
@@ -8,9 +9,7 @@ const _hoisted_1 = {
8
9
  };
9
10
  function focusMainContent() {
10
11
  const target = document.getElementById("app-shell-main") ?? document.querySelector("main") ?? document.querySelector("h1");
11
- if (!target) return;
12
- target.tabIndex = -1;
13
- target.focus({ preventScroll: true });
12
+ if (target) focusTarget(target);
14
13
  }
15
14
  const _sfc_main = /* @__PURE__ */ defineComponent({
16
15
  ...{ name: "RouteAnnouncer" },
@@ -22,8 +21,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
22
21
  setup(__props) {
23
22
  const props = __props;
24
23
  const route = useRoute();
24
+ const router = useRouter();
25
25
  const message = shallowRef("");
26
26
  let lastPath = null;
27
+ let isInitialPending = false;
27
28
  let generation = 0;
28
29
  let disposed = false;
29
30
  onScopeDispose(() => {
@@ -32,13 +33,24 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
32
33
  });
33
34
  onMounted(() => {
34
35
  const announcesInitial = props.canAnnounceInitial ?? !(props.skipInitial ?? true);
36
+ if (router.currentRoute.value === START_LOCATION) {
37
+ isInitialPending = true;
38
+ const settleInitial = () => {
39
+ isInitialPending = false;
40
+ if (disposed) return;
41
+ if (announcesInitial) void announce(route.path);
42
+ else lastPath = route.path;
43
+ };
44
+ router.isReady().then(settleInitial, settleInitial);
45
+ return;
46
+ }
35
47
  lastPath = announcesInitial ? null : route.path;
36
48
  if (announcesInitial) void announce(route.path);
37
49
  });
38
50
  watch(
39
51
  () => route.path,
40
52
  (path) => {
41
- if (lastPath === path) return;
53
+ if (isInitialPending || lastPath === path) return;
42
54
  void announce(path);
43
55
  },
44
56
  { flush: "post" }
@@ -1 +1 @@
1
- {"version":3,"file":"RouteAnnouncer.vue.js","sources":["../../../../../src/router/adapters/vueRouter/routeAnnouncer/RouteAnnouncer.vue"],"sourcesContent":["<script lang=\"ts\">\n/** Defines the props for {@link RouteAnnouncer}. */\nexport interface RouteAnnouncerProps {\n /** Whether the very first mount resets focus and announces the route too. Default `false`. */\n readonly canAnnounceInitial?: boolean;\n /** @deprecated Use `canAnnounceInitial` (inverted); this alias is removed next release. */\n readonly skipInitial?: boolean;\n}\n\n/** Moves keyboard and screen-reader focus to main content — the shell `<main>`, else any `<main>`, else `<h1>`. */\nfunction focusMainContent(): void {\n const target =\n document.getElementById('app-shell-main') ??\n document.querySelector<HTMLElement>('main') ??\n document.querySelector<HTMLElement>('h1');\n if (!target) return;\n target.tabIndex = -1;\n target.focus({ preventScroll: true });\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { nextTick, onMounted, onScopeDispose, shallowRef, watch } from 'vue';\nimport { useRoute } from 'vue-router';\n\nimport { deepestHandleValue, resolveHandleValue } from '../RouteHandles';\n\n/**\n * Renders a polite, visually-hidden live region that announces the newly navigated page title and resets\n * focus to the main content; skips the first mount.\n *\n * Unlike the other root behaviors this stays a COMPONENT rather than becoming a router hook — it\n * owns a live region in the DOM, so it has to render.\n */\ndefineOptions({ name: 'RouteAnnouncer' });\n\nconst props = withDefaults(defineProps<RouteAnnouncerProps>(), {\n canAnnounceInitial: undefined,\n skipInitial: undefined,\n});\n\nconst route = useRoute();\nconst message = shallowRef('');\n\n// Keyed on `path` — not `fullPath` — so search/hash-only updates (a filter input syncing through\n// `router.replace`) never yank focus back to main mid-interaction. React needed a ref to absorb\n// StrictMode's double-invoked mount effect; a non-immediate watcher cannot double-fire.\nlet lastPath: string | null = null;\nlet generation = 0;\nlet disposed = false;\nonScopeDispose(() => {\n disposed = true;\n generation += 1;\n});\n\n// `onMounted` never runs on the server, which is what this needs: it reads and focuses the DOM.\nonMounted(() => {\n const announcesInitial = props.canAnnounceInitial ?? !(props.skipInitial ?? true);\n lastPath = announcesInitial ? null : route.path;\n if (announcesInitial) void announce(route.path);\n});\n\nwatch(\n () => route.path,\n (path) => {\n if (lastPath === path) return;\n void announce(path);\n },\n { flush: 'post' },\n);\n\nasync function announce(path: string): Promise<void> {\n const current = ++generation;\n lastPath = path;\n // Clear the live region so adjacent pages with the same title still announce once.\n message.value = '';\n await nextTick();\n if (disposed || current !== generation || route.path !== path) return;\n focusMainContent();\n message.value = deepestHandleValue(route, (handle) => resolveHandleValue(handle.title, route)) ?? document.title;\n}\n</script>\n\n<template>\n <div aria-live=\"polite\" aria-atomic=\"true\" class=\"sr-only\">{{ message }}</div>\n</template>\n"],"names":["_createElementBlock","_toDisplayString"],"mappings":";;;;;;;;AAUA,SAAS,mBAAyB;AAChC,QAAM,SACJ,SAAS,eAAe,gBAAgB,KACxC,SAAS,cAA2B,MAAM,KAC1C,SAAS,cAA2B,IAAI;AAC1C,MAAI,CAAC,OAAQ;AACb,SAAO,WAAW;AAClB,SAAO,MAAM,EAAE,eAAe,KAAA,CAAM;AACtC;;;;;;;;;AAkBA,UAAM,QAAQ;AAKd,UAAM,QAAQ,SAAA;AACd,UAAM,UAAU,WAAW,EAAE;AAK7B,QAAI,WAA0B;AAC9B,QAAI,aAAa;AACjB,QAAI,WAAW;AACf,mBAAe,MAAM;AACnB,iBAAW;AACX,oBAAc;AAAA,IAChB,CAAC;AAGD,cAAU,MAAM;AACd,YAAM,mBAAmB,MAAM,sBAAsB,EAAE,MAAM,eAAe;AAC5E,iBAAW,mBAAmB,OAAO,MAAM;AAC3C,UAAI,iBAAkB,MAAK,SAAS,MAAM,IAAI;AAAA,IAChD,CAAC;AAED;AAAA,MACE,MAAM,MAAM;AAAA,MACZ,CAAC,SAAS;AACR,YAAI,aAAa,KAAM;AACvB,aAAK,SAAS,IAAI;AAAA,MACpB;AAAA,MACA,EAAE,OAAO,OAAA;AAAA,IAAO;AAGlB,mBAAe,SAAS,MAA6B;AACnD,YAAM,UAAU,EAAE;AAClB,iBAAW;AAEX,cAAQ,QAAQ;AAChB,YAAM,SAAA;AACN,UAAI,YAAY,YAAY,cAAc,MAAM,SAAS,KAAM;AAC/D,uBAAA;AACA,cAAQ,QAAQ,mBAAmB,OAAO,CAAC,WAAW,mBAAmB,OAAO,OAAO,KAAK,CAAC,KAAK,SAAS;AAAA,IAC7G;;0BAIEA,mBAA8E,OAA9E,YAA8EC,gBAAhB,QAAA,KAAO,GAAA,CAAA;AAAA;;;"}
1
+ {"version":3,"file":"RouteAnnouncer.vue.js","sources":["../../../../../src/router/adapters/vueRouter/routeAnnouncer/RouteAnnouncer.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { focusTarget } from '../../../../foundation/dom';\n\n/** Defines the props for {@link RouteAnnouncer}. */\nexport interface RouteAnnouncerProps {\n /** Whether the very first mount resets focus and announces the route too. Default `false`. */\n readonly canAnnounceInitial?: boolean;\n /** @deprecated Use `canAnnounceInitial` (inverted); this alias is removed next release. */\n readonly skipInitial?: boolean;\n}\n\n/**\n * Moves keyboard and screen-reader focus to main content — the shell `<main>`, else any `<main>`, else `<h1>` — as a\n * programmatic focus target, which draws no focus ring.\n */\nfunction focusMainContent(): void {\n const target =\n document.getElementById('app-shell-main') ??\n document.querySelector<HTMLElement>('main') ??\n document.querySelector<HTMLElement>('h1');\n if (target) focusTarget(target);\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { nextTick, onMounted, onScopeDispose, shallowRef, watch } from 'vue';\nimport { START_LOCATION, useRoute, useRouter } from 'vue-router';\n\nimport { deepestHandleValue, resolveHandleValue } from '../RouteHandles';\n\n/**\n * Renders a polite, visually-hidden live region that announces the newly navigated page title and resets\n * focus to the main content; skips the initial page, including a first navigation still resolving at mount.\n *\n * Unlike the other root behaviors this stays a COMPONENT rather than becoming a router hook — it\n * owns a live region in the DOM, so it has to render.\n */\ndefineOptions({ name: 'RouteAnnouncer' });\n\nconst props = withDefaults(defineProps<RouteAnnouncerProps>(), {\n canAnnounceInitial: undefined,\n skipInitial: undefined,\n});\n\nconst route = useRoute();\nconst router = useRouter();\nconst message = shallowRef('');\n\n// Keyed on `path` — not `fullPath` — so search/hash-only updates (a filter input syncing through\n// `router.replace`) never yank focus back to main mid-interaction. React needed a ref to absorb\n// StrictMode's double-invoked mount effect; a non-immediate watcher cannot double-fire.\nlet lastPath: string | null = null;\nlet isInitialPending = false;\nlet generation = 0;\nlet disposed = false;\nonScopeDispose(() => {\n disposed = true;\n generation += 1;\n});\n\n// `onMounted` never runs on the server, which is what this needs: it reads and focuses the DOM.\nonMounted(() => {\n const announcesInitial = props.canAnnounceInitial ?? !(props.skipInitial ?? true);\n // An app that mounts before its first navigation resolves (no `await router.isReady()`) still sits on\n // `START_LOCATION` here. That first navigation is the initial page, not a path change: settle on it once the\n // router is ready, in whichever order its path watcher and `isReady` land.\n if (router.currentRoute.value === START_LOCATION) {\n isInitialPending = true;\n const settleInitial = (): void => {\n isInitialPending = false;\n if (disposed) return;\n if (announcesInitial) void announce(route.path);\n else lastPath = route.path;\n };\n router.isReady().then(settleInitial, settleInitial);\n return;\n }\n lastPath = announcesInitial ? null : route.path;\n if (announcesInitial) void announce(route.path);\n});\n\nwatch(\n () => route.path,\n (path) => {\n if (isInitialPending || lastPath === path) return;\n void announce(path);\n },\n { flush: 'post' },\n);\n\nasync function announce(path: string): Promise<void> {\n const current = ++generation;\n lastPath = path;\n // Clear the live region so adjacent pages with the same title still announce once.\n message.value = '';\n await nextTick();\n if (disposed || current !== generation || route.path !== path) return;\n focusMainContent();\n message.value = deepestHandleValue(route, (handle) => resolveHandleValue(handle.title, route)) ?? document.title;\n}\n</script>\n\n<template>\n <div aria-live=\"polite\" aria-atomic=\"true\" class=\"sr-only\">{{ message }}</div>\n</template>\n"],"names":["_createElementBlock","_toDisplayString"],"mappings":";;;;;;;;;AAeA,SAAS,mBAAyB;AAChC,QAAM,SACJ,SAAS,eAAe,gBAAgB,KACxC,SAAS,cAA2B,MAAM,KAC1C,SAAS,cAA2B,IAAI;AAC1C,MAAI,oBAAoB,MAAM;AAChC;;;;;;;;;AAkBA,UAAM,QAAQ;AAKd,UAAM,QAAQ,SAAA;AACd,UAAM,SAAS,UAAA;AACf,UAAM,UAAU,WAAW,EAAE;AAK7B,QAAI,WAA0B;AAC9B,QAAI,mBAAmB;AACvB,QAAI,aAAa;AACjB,QAAI,WAAW;AACf,mBAAe,MAAM;AACnB,iBAAW;AACX,oBAAc;AAAA,IAChB,CAAC;AAGD,cAAU,MAAM;AACd,YAAM,mBAAmB,MAAM,sBAAsB,EAAE,MAAM,eAAe;AAI5E,UAAI,OAAO,aAAa,UAAU,gBAAgB;AAChD,2BAAmB;AACnB,cAAM,gBAAgB,MAAY;AAChC,6BAAmB;AACnB,cAAI,SAAU;AACd,cAAI,iBAAkB,MAAK,SAAS,MAAM,IAAI;AAAA,0BAC9B,MAAM;AAAA,QACxB;AACA,eAAO,QAAA,EAAU,KAAK,eAAe,aAAa;AAClD;AAAA,MACF;AACA,iBAAW,mBAAmB,OAAO,MAAM;AAC3C,UAAI,iBAAkB,MAAK,SAAS,MAAM,IAAI;AAAA,IAChD,CAAC;AAED;AAAA,MACE,MAAM,MAAM;AAAA,MACZ,CAAC,SAAS;AACR,YAAI,oBAAoB,aAAa,KAAM;AAC3C,aAAK,SAAS,IAAI;AAAA,MACpB;AAAA,MACA,EAAE,OAAO,OAAA;AAAA,IAAO;AAGlB,mBAAe,SAAS,MAA6B;AACnD,YAAM,UAAU,EAAE;AAClB,iBAAW;AAEX,cAAQ,QAAQ;AAChB,YAAM,SAAA;AACN,UAAI,YAAY,YAAY,cAAc,MAAM,SAAS,KAAM;AAC/D,uBAAA;AACA,cAAQ,QAAQ,mBAAmB,OAAO,CAAC,WAAW,mBAAmB,OAAO,OAAO,KAAK,CAAC,KAAK,SAAS;AAAA,IAC7G;;0BAIEA,mBAA8E,OAA9E,YAA8EC,gBAAhB,QAAA,KAAO,GAAA,CAAA;AAAA;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wow-two-beta/fe",
3
- "version": "0.0.38",
3
+ "version": "0.0.40",
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",