periplo-ui 4.24.0 → 4.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -7,7 +7,14 @@ type PhoneInputBaseProps = {
|
|
|
7
7
|
name?: string;
|
|
8
8
|
className?: string;
|
|
9
9
|
disabled?: boolean;
|
|
10
|
-
error
|
|
10
|
+
/** Invalid state. A string also shows as the error message under the number field. */
|
|
11
|
+
error?: boolean | string;
|
|
12
|
+
/** Help text under the number field. */
|
|
13
|
+
helperText?: string;
|
|
14
|
+
/** Label above the country selector. */
|
|
15
|
+
prefixLabel?: string;
|
|
16
|
+
/** Label above the number field. */
|
|
17
|
+
numberLabel?: string;
|
|
11
18
|
/**
|
|
12
19
|
* Control height. sm 32px, md 40px, lg 48px. Heights are the `--control-height-*` tokens, so an app can change them (for example on touch).
|
|
13
20
|
* @default lg
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Flag } from "../../data-display/Flag/Flag.js";
|
|
2
|
+
import { Label } from "../../data-display/Label/Label.js";
|
|
2
3
|
import { PopoverContent, PopoverRoot, PopoverTrigger } from "../../data-display/Popover/Popover.js";
|
|
3
4
|
import { OptionCheck } from "../../shared/OptionCheck.js";
|
|
4
5
|
import { VirtualizedComboboxList } from "../Combobox/VirtualizedComboboxList.js";
|
|
5
6
|
import { Command, CommandInput } from "../Command/Command.js";
|
|
7
|
+
import { FieldDescription, FieldError } from "../Field/Field.js";
|
|
6
8
|
import { InputGroup, InputGroupErrorIcon } from "../shared/InputGroup.js";
|
|
7
9
|
import { isFieldInvalid } from "../shared/fieldInvalid.js";
|
|
8
10
|
import { usePhoneField } from "./hooks/usePhoneField.js";
|
|
@@ -23,8 +25,16 @@ var defaultAccessors = {
|
|
|
23
25
|
getCountryName: (country) => country.name
|
|
24
26
|
};
|
|
25
27
|
function PhoneInput(props) {
|
|
26
|
-
const { id, name, className, disabled = false, error = false, size = "lg", inputRef: externalInputRef, countries, country, onChange, number, defaultCountry, priorityCountries, locale = "en", numberInputProps, placeholder, countryAriaLabel = "Select country", searchPlaceholder = "Search...", emptyMessage = "No results found.", getCountryValue, getCountryIsoCode, getCountryDialCode, getCountryFlag, getCountryName, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid } = props;
|
|
27
|
-
const
|
|
28
|
+
const { id, name, className, disabled = false, error = false, helperText, prefixLabel, numberLabel, size = "lg", inputRef: externalInputRef, countries, country, onChange, number, defaultCountry, priorityCountries, locale = "en", numberInputProps, placeholder, countryAriaLabel = "Select country", searchPlaceholder = "Search...", emptyMessage = "No results found.", getCountryValue, getCountryIsoCode, getCountryDialCode, getCountryFlag, getCountryName, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid } = props;
|
|
29
|
+
const errorMessage = typeof error === "string" && error !== "" ? error : void 0;
|
|
30
|
+
const invalid = isFieldInvalid(Boolean(error) || Boolean(errorMessage), ariaInvalid);
|
|
31
|
+
const generatedId = React$1.useId();
|
|
32
|
+
const numberId = id ?? generatedId;
|
|
33
|
+
const messageId = `${numberId}-message`;
|
|
34
|
+
const countryId = `${numberId}-country`;
|
|
35
|
+
const prefixLabelId = `${numberId}-prefix-label`;
|
|
36
|
+
const message = errorMessage ?? helperText;
|
|
37
|
+
const describedBy = [ariaDescribedBy, message ? messageId : void 0].filter(Boolean).join(" ") || void 0;
|
|
28
38
|
const defaults = defaultAccessors;
|
|
29
39
|
const options = countries ?? buildCountries(locale);
|
|
30
40
|
const resolveValue = getCountryValue ?? defaults.getCountryValue;
|
|
@@ -58,6 +68,7 @@ function PhoneInput(props) {
|
|
|
58
68
|
});
|
|
59
69
|
};
|
|
60
70
|
const prefixDisabled = disabled || options.length <= 1;
|
|
71
|
+
const longestDialCode = options.map((option) => resolveDialCode(option)).toSorted((first, second) => second.length - first.length)[0] ?? "";
|
|
61
72
|
const matches = createSearchMatcher(search);
|
|
62
73
|
const filteredOptions = search.trim() ? options.filter((option) => matches([
|
|
63
74
|
resolveName(option),
|
|
@@ -89,35 +100,57 @@ function PhoneInput(props) {
|
|
|
89
100
|
className: "ml-auto"
|
|
90
101
|
})
|
|
91
102
|
] });
|
|
92
|
-
return /* @__PURE__ */
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
103
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
104
|
+
"data-testid": "phone-input-shell",
|
|
105
|
+
className: cn("grid w-full grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-1", className),
|
|
106
|
+
children: [
|
|
107
|
+
(prefixLabel !== void 0 || numberLabel !== void 0) && /* @__PURE__ */ jsxs(Fragment, { children: [prefixLabel ? /* @__PURE__ */ jsx(Label, {
|
|
108
|
+
id: prefixLabelId,
|
|
109
|
+
htmlFor: countryId,
|
|
110
|
+
children: prefixLabel
|
|
111
|
+
}) : /* @__PURE__ */ jsx("span", {}), numberLabel ? /* @__PURE__ */ jsx(Label, {
|
|
112
|
+
htmlFor: numberId,
|
|
113
|
+
children: numberLabel
|
|
114
|
+
}) : /* @__PURE__ */ jsx("span", {})] }),
|
|
115
|
+
/* @__PURE__ */ jsx(InputGroup, {
|
|
116
|
+
size,
|
|
117
|
+
disabled,
|
|
118
|
+
className: "shrink-0 items-stretch gap-0 overflow-hidden px-0",
|
|
119
|
+
children: /* @__PURE__ */ jsxs(PopoverRoot, {
|
|
102
120
|
open,
|
|
103
121
|
onOpenChange: handleOpenChange,
|
|
104
122
|
children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
105
123
|
asChild: true,
|
|
106
124
|
children: /* @__PURE__ */ jsxs("button", {
|
|
107
125
|
type: "button",
|
|
108
|
-
id:
|
|
126
|
+
id: countryId,
|
|
109
127
|
disabled: prefixDisabled,
|
|
110
128
|
"aria-label": selectedOption ? resolveName(selectedOption) : countryAriaLabel,
|
|
129
|
+
"aria-labelledby": prefixLabel ? `${prefixLabelId} ${countryId}` : void 0,
|
|
111
130
|
"data-slot": "input-group-addon",
|
|
112
131
|
"data-wide": options.length > 1 ? "" : void 0,
|
|
113
|
-
className: "\n flex shrink-0 items-center gap-1.5 rounded-
|
|
114
|
-
children: [
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
132
|
+
className: "\n flex w-full shrink-0 items-center gap-1.5 rounded-[inherit] px-(--control-inset) text-primary\n motion-hover [--focus-ring-offset:-2px]\n not-disabled:hover:bg-surface-neutral-subtle-hovered\n disabled:cursor-not-allowed\n in-data-disabled:text-tertiary\n ",
|
|
133
|
+
children: [
|
|
134
|
+
/* @__PURE__ */ jsx("span", {
|
|
135
|
+
className: "flex w-5.5 shrink-0 items-center justify-center",
|
|
136
|
+
children: selectedOption ? renderFlag(selectedOption) : /* @__PURE__ */ jsx(GlobeIcon, {
|
|
137
|
+
className: "icon-md text-tertiary",
|
|
138
|
+
"aria-hidden": true
|
|
139
|
+
})
|
|
140
|
+
}),
|
|
141
|
+
/* @__PURE__ */ jsxs("span", {
|
|
142
|
+
className: "grid",
|
|
143
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
144
|
+
"aria-hidden": true,
|
|
145
|
+
className: "invisible col-start-1 row-start-1",
|
|
146
|
+
children: longestDialCode
|
|
147
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
148
|
+
className: "col-start-1 row-start-1",
|
|
149
|
+
children: selectedOption ? resolveDialCode(selectedOption) : null
|
|
150
|
+
})]
|
|
151
|
+
}),
|
|
152
|
+
!prefixDisabled && /* @__PURE__ */ jsx(CaretDownIcon, { className: "ml-auto icon-sm shrink-0 text-tertiary" })
|
|
153
|
+
]
|
|
121
154
|
})
|
|
122
155
|
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
123
156
|
align: "start",
|
|
@@ -145,14 +178,20 @@ function PhoneInput(props) {
|
|
|
145
178
|
})]
|
|
146
179
|
})
|
|
147
180
|
})]
|
|
148
|
-
})
|
|
149
|
-
|
|
181
|
+
})
|
|
182
|
+
}),
|
|
183
|
+
/* @__PURE__ */ jsxs(InputGroup, {
|
|
184
|
+
size,
|
|
185
|
+
disabled,
|
|
186
|
+
invalid,
|
|
187
|
+
className: "items-stretch gap-0 overflow-hidden px-0",
|
|
188
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
150
189
|
ref: (el) => {
|
|
151
190
|
inputElRef.current = el;
|
|
152
191
|
if (typeof externalInputRef === "function") externalInputRef(el);
|
|
153
192
|
else if (externalInputRef) externalInputRef.current = el;
|
|
154
193
|
},
|
|
155
|
-
id,
|
|
194
|
+
id: numberId,
|
|
156
195
|
name,
|
|
157
196
|
type: "tel",
|
|
158
197
|
inputMode: "tel",
|
|
@@ -163,13 +202,22 @@ function PhoneInput(props) {
|
|
|
163
202
|
onKeyDown: onInputKeyDown,
|
|
164
203
|
placeholder: placeholder ?? exampleNational(selectedIso),
|
|
165
204
|
"aria-invalid": invalid || void 0,
|
|
166
|
-
"aria-describedby":
|
|
205
|
+
"aria-describedby": describedBy,
|
|
167
206
|
className: "\n min-w-0 flex-1 bg-transparent px-(--control-inset) text-ellipsis text-primary\n placeholder:text-tertiary\n disabled:cursor-not-allowed disabled:text-tertiary\n ",
|
|
168
207
|
...numberInputProps
|
|
169
|
-
}),
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
208
|
+
}), invalid && /* @__PURE__ */ jsx(InputGroupErrorIcon, { className: "flex items-center pr-(--control-inset)" })]
|
|
209
|
+
}),
|
|
210
|
+
message && /* @__PURE__ */ jsx("div", {
|
|
211
|
+
className: "col-start-2",
|
|
212
|
+
children: errorMessage ? /* @__PURE__ */ jsx(FieldError, {
|
|
213
|
+
id: messageId,
|
|
214
|
+
children: errorMessage
|
|
215
|
+
}) : /* @__PURE__ */ jsx(FieldDescription, {
|
|
216
|
+
id: messageId,
|
|
217
|
+
children: helperText
|
|
218
|
+
})
|
|
219
|
+
})
|
|
220
|
+
]
|
|
173
221
|
});
|
|
174
222
|
}
|
|
175
223
|
PhoneInput.displayName = "PhoneInput";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhoneInput.js","names":["React","_Fragment"],"sources":["../../../../src/components/inputs/PhoneInput/PhoneInput.tsx"],"sourcesContent":["import { CaretDownIcon } from '@phosphor-icons/react/dist/ssr/CaretDown'\nimport { GlobeIcon } from '@phosphor-icons/react/dist/ssr/Globe'\nimport * as React from 'react'\n\nimport { Flag } from '../../data-display/Flag'\nimport { PopoverContent, PopoverRoot, PopoverTrigger } from '../../data-display/Popover'\nimport { OptionCheck } from '../../shared'\nimport { type ControlSize } from '../Button'\nimport { VirtualizedComboboxList } from '../Combobox'\nimport { Command, CommandInput } from '../Command'\nimport { InputGroup, InputGroupErrorIcon, isFieldInvalid } from '../shared'\n\nimport { usePhoneField } from './hooks'\nimport { exampleNational } from './phone'\nimport type { PhoneCountry, PhoneInputCountryAccessors, PhoneValue } from './types'\n\nimport { buildCountries, splitByPriority } from '@/lib/countries'\nimport { useListScroll } from '@/lib/useListScroll'\nimport { cn, createSearchMatcher } from '@/lib/utils'\n\ntype PhoneInputBaseProps = {\n /** Lands on the number input, so `<label htmlFor>` targets it. */\n id?: string\n name?: string\n className?: string\n disabled?: boolean\n error?: boolean\n /**\n * Control height. sm 32px, md 40px, lg 48px. Heights are the `--control-height-*` tokens, so an app can change them (for example on touch).\n * @default lg\n */\n size?: ControlSize\n inputRef?: React.Ref<HTMLInputElement>\n /** Controlled when set, otherwise seeded by `defaultCountry`. */\n country?: string\n /** National digits, no country code or separators. */\n number?: string\n onChange?: (value: PhoneValue) => void\n /** ISO code, used when `country` is uncontrolled. */\n defaultCountry?: string\n /** ISO codes pinned above the list, in order. */\n priorityCountries?: Array<string>\n numberInputProps?: Omit<\n React.InputHTMLAttributes<HTMLInputElement>,\n 'id' | 'name' | 'disabled' | 'value' | 'onChange' | 'onKeyDown' | 'className'\n >\n /** Defaults to the country's example number. */\n placeholder?: string\n countryAriaLabel?: string\n searchPlaceholder?: string\n emptyMessage?: string\n 'aria-describedby'?: string\n 'aria-invalid'?: React.AriaAttributes['aria-invalid']\n}\n\ntype ResolvedPhoneInputProps<T extends object> = PhoneInputBaseProps &\n Partial<PhoneInputCountryAccessors<T>> & {\n /** Defaults to the generated list. */\n countries?: Array<T>\n /** Names the generated list. Ignored when `countries` is passed. */\n locale?: string\n onChange?: (value: PhoneValue<T>) => void\n }\n\nexport type PhoneInputDefaultProps = ResolvedPhoneInputProps<PhoneCountry>\n\nexport type PhoneInputCustomProps<T extends object> = PhoneInputBaseProps &\n PhoneInputCountryAccessors<T> & {\n countries: Array<T>\n onChange?: (value: PhoneValue<T>) => void\n }\n\nexport type PhoneInputProps<T extends object = PhoneCountry> = PhoneInputDefaultProps | PhoneInputCustomProps<T>\n\nconst defaultAccessors: PhoneInputCountryAccessors<PhoneCountry> = {\n getCountryValue: (country) => country.isoCode,\n getCountryIsoCode: (country) => country.isoCode,\n getCountryDialCode: (country) => country.dialCode,\n getCountryFlag: (country) => country.flag,\n getCountryName: (country) => country.name,\n}\n\nexport function PhoneInput(props: Readonly<PhoneInputDefaultProps>): React.ReactElement\nexport function PhoneInput<T extends object>(props: Readonly<PhoneInputCustomProps<T>>): React.ReactElement\nexport function PhoneInput<T extends object>(props: Readonly<ResolvedPhoneInputProps<T>>): React.ReactElement {\n const {\n id,\n name,\n className,\n disabled = false,\n error = false,\n size = 'lg',\n inputRef: externalInputRef,\n countries,\n country,\n onChange,\n number,\n defaultCountry,\n priorityCountries,\n locale = 'en',\n numberInputProps,\n placeholder,\n countryAriaLabel = 'Select country',\n searchPlaceholder = 'Search...',\n emptyMessage = 'No results found.',\n getCountryValue,\n getCountryIsoCode,\n getCountryDialCode,\n getCountryFlag,\n getCountryName,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n } = props\n const invalid = isFieldInvalid(error, ariaInvalid)\n\n const defaults = defaultAccessors as unknown as PhoneInputCountryAccessors<T>\n const options = countries ?? (buildCountries(locale) as unknown as Array<T>)\n const resolveValue = getCountryValue ?? defaults.getCountryValue\n const resolveIsoCode = getCountryIsoCode ?? defaults.getCountryIsoCode\n const resolveDialCode = getCountryDialCode ?? defaults.getCountryDialCode\n const resolveFlag = getCountryFlag ?? defaults.getCountryFlag\n const resolveName = getCountryName ?? defaults.getCountryName\n\n const {\n isoOf,\n selectedValue,\n selectedOption,\n selectedIso,\n displayValue,\n inputElRef,\n selectCountry,\n onInputChange,\n onInputKeyDown,\n } = usePhoneField({\n options,\n getCountryValue: resolveValue,\n getCountryDialCode: resolveDialCode,\n getCountryIsoCode: resolveIsoCode,\n country,\n number,\n onChange,\n defaultCountry,\n priorityCountries,\n })\n\n const [open, setOpen] = React.useState(false)\n const [search, setSearch] = React.useState('')\n const listRef = useListScroll({ open, searchTerm: search, selectedValue: undefined })\n\n const renderFlag = (option: T) => {\n const iso = isoOf(option)\n return iso ? <Flag iso={iso} /> : <span className=\"text-lg leading-none\">{resolveFlag(option)}</span>\n }\n\n const prefixDisabled = disabled || options.length <= 1\n\n const matches = createSearchMatcher(search)\n const filteredOptions = search.trim()\n ? options.filter((option) => matches([resolveName(option), resolveDialCode(option), isoOf(option) ?? '']))\n : options\n const { priority: priorityOptions, rest: restOptions } = splitByPriority(filteredOptions, priorityCountries, isoOf)\n\n const handleOpenChange = (next: boolean) => {\n setOpen(next)\n if (next) setSearch('')\n }\n\n const handleSelect = (value: string) => {\n const option = filteredOptions.find((candidate) => resolveValue(candidate) === value)\n if (option) selectCountry(option)\n handleOpenChange(false)\n }\n\n const renderOption = (option: T, isSelected: boolean) => (\n <>\n {renderFlag(option)}\n <span className=\"shrink-0 text-tertiary\">{resolveDialCode(option)}</span>\n <span className=\"truncate\">{resolveName(option)}</span>\n {isSelected && <OptionCheck data-testid=\"selected-check\" className=\"ml-auto\" />}\n </>\n )\n\n return (\n <div className={cn('flex w-full flex-col gap-1', className)}>\n <InputGroup\n data-testid=\"phone-input-shell\"\n size={size}\n disabled={disabled}\n invalid={invalid}\n className=\"items-stretch gap-0 overflow-hidden px-0\"\n >\n <PopoverRoot open={open} onOpenChange={handleOpenChange}>\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n id={id ? `${id}-country` : undefined}\n disabled={prefixDisabled}\n aria-label={selectedOption ? resolveName(selectedOption) : countryAriaLabel}\n data-slot=\"input-group-addon\"\n data-wide={options.length > 1 ? '' : undefined}\n className=\"\n flex shrink-0 items-center gap-1.5 rounded-l-[inherit] border-r border-subtle px-(--control-inset)\n text-primary motion-hover [--focus-ring-offset:-2px]\n not-disabled:hover:bg-surface-neutral-subtle-hovered\n disabled:cursor-not-allowed\n in-data-disabled:text-tertiary\n data-wide:w-28\n \"\n >\n {selectedOption ? (\n <>\n {renderFlag(selectedOption)}\n <span className=\"tabular-nums\">{resolveDialCode(selectedOption)}</span>\n </>\n ) : (\n <GlobeIcon className=\"icon-control text-tertiary\" aria-hidden />\n )}\n {!prefixDisabled && <CaretDownIcon className=\"ml-auto icon-sm shrink-0 text-tertiary\" />}\n </button>\n </PopoverTrigger>\n <PopoverContent align=\"start\" data-size={size} className=\"w-72 overflow-hidden p-0 control surface-list\">\n <Command shouldFilter={false} defaultValue={selectedValue}>\n <CommandInput placeholder={searchPlaceholder} value={search} onValueChange={setSearch} />\n <VirtualizedComboboxList\n listRef={listRef}\n localOptions={restOptions}\n specialOptions={priorityOptions}\n loading={false}\n loadingPlaceholder=\"\"\n emptyMessage={emptyMessage}\n value={selectedValue}\n getOptionValue={resolveValue}\n getOptionLabel={resolveName}\n handleSelect={handleSelect}\n renderOption={renderOption}\n />\n </Command>\n </PopoverContent>\n </PopoverRoot>\n\n <input\n /* eslint-disable react-hooks/immutability -- merging the internal ref with the caller-supplied `inputRef` is the standard ref-forwarding idiom */\n ref={(el) => {\n inputElRef.current = el\n if (typeof externalInputRef === 'function') externalInputRef(el)\n else if (externalInputRef) externalInputRef.current = el\n }}\n /* eslint-enable react-hooks/immutability */\n id={id}\n name={name}\n type=\"tel\"\n inputMode=\"tel\"\n autoComplete=\"tel-national\"\n disabled={disabled}\n value={displayValue}\n onChange={onInputChange}\n onKeyDown={onInputKeyDown}\n placeholder={placeholder ?? exampleNational(selectedIso)}\n aria-invalid={invalid || undefined}\n aria-describedby={ariaDescribedBy}\n className=\"\n min-w-0 flex-1 bg-transparent px-(--control-inset) text-ellipsis text-primary\n placeholder:text-tertiary\n disabled:cursor-not-allowed disabled:text-tertiary\n \"\n {...numberInputProps}\n />\n\n {invalid && <InputGroupErrorIcon className=\"flex items-center pr-(--control-inset)\" />}\n </InputGroup>\n </div>\n )\n}\n\nPhoneInput.displayName = 'PhoneInput'\n"],"mappings":";;;;;;;;;;;;;;;;;AA0EA,IAAM,mBAA6D;CACjE,kBAAkB,YAAY,QAAQ;CACtC,oBAAoB,YAAY,QAAQ;CACxC,qBAAqB,YAAY,QAAQ;CACzC,iBAAiB,YAAY,QAAQ;CACrC,iBAAiB,YAAY,QAAQ;AACvC;AAIA,SAAgB,WAA6B,OAAiE;CAC5G,MAAM,EACJ,IACA,MACA,WACA,WAAW,OACX,QAAQ,OACR,OAAO,MACP,UAAU,kBACV,WACA,SACA,UACA,QACA,gBACA,mBACA,SAAS,MACT,kBACA,aACA,mBAAmB,kBACnB,oBAAoB,aACpB,eAAe,qBACf,iBACA,mBACA,oBACA,gBACA,gBACA,oBAAoB,iBACpB,gBAAgB,gBACd;CACJ,MAAM,UAAU,eAAe,OAAO,WAAW;CAEjD,MAAM,WAAW;CACjB,MAAM,UAAU,aAAc,eAAe,MAAM;CACnD,MAAM,eAAe,mBAAmB,SAAS;CACjD,MAAM,iBAAiB,qBAAqB,SAAS;CACrD,MAAM,kBAAkB,sBAAsB,SAAS;CACvD,MAAM,cAAc,kBAAkB,SAAS;CAC/C,MAAM,cAAc,kBAAkB,SAAS;CAE/C,MAAM,EACJ,OACA,eACA,gBACA,aACA,cACA,YACA,eACA,eACA,mBACE,cAAc;EAChB;EACA,iBAAiB;EACjB,oBAAoB;EACpB,m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AU;KACV,cAAa;KACH;KACV,OAAO;KACP,UAAU;KACV,WAAW;KACX,aAAa,eAAe,gBAAgB,WAAW;KACvD,gBAAc,WAAW,KAAA;KACzB,oBAAkB;KAClB,WAAU;KAKV,GAAI;IACL,CAAA;IAEA,WAAW,oBAAC,qBAAD,EAAqB,WAAU,yCAA0C,CAAA;GAC3E;;CACT,CAAA;AAET;AAEA,WAAW,cAAc"}
|
|
1
|
+
{"version":3,"file":"PhoneInput.js","names":["React","_Fragment"],"sources":["../../../../src/components/inputs/PhoneInput/PhoneInput.tsx"],"sourcesContent":["import { CaretDownIcon } from '@phosphor-icons/react/dist/ssr/CaretDown'\nimport { GlobeIcon } from '@phosphor-icons/react/dist/ssr/Globe'\nimport * as React from 'react'\n\nimport { Flag } from '../../data-display/Flag'\nimport { Label } from '../../data-display/Label'\nimport { PopoverContent, PopoverRoot, PopoverTrigger } from '../../data-display/Popover'\nimport { OptionCheck } from '../../shared'\nimport { type ControlSize } from '../Button'\nimport { VirtualizedComboboxList } from '../Combobox'\nimport { Command, CommandInput } from '../Command'\nimport { FieldDescription, FieldError } from '../Field'\nimport { InputGroup, InputGroupErrorIcon, isFieldInvalid } from '../shared'\n\nimport { usePhoneField } from './hooks'\nimport { exampleNational } from './phone'\nimport type { PhoneCountry, PhoneInputCountryAccessors, PhoneValue } from './types'\n\nimport { buildCountries, splitByPriority } from '@/lib/countries'\nimport { useListScroll } from '@/lib/useListScroll'\nimport { cn, createSearchMatcher } from '@/lib/utils'\n\ntype PhoneInputBaseProps = {\n /** Lands on the number input, so `<label htmlFor>` targets it. */\n id?: string\n name?: string\n className?: string\n disabled?: boolean\n /** Invalid state. A string also shows as the error message under the number field. */\n error?: boolean | string\n /** Help text under the number field. */\n helperText?: string\n /** Label above the country selector. */\n prefixLabel?: string\n /** Label above the number field. */\n numberLabel?: string\n /**\n * Control height. sm 32px, md 40px, lg 48px. Heights are the `--control-height-*` tokens, so an app can change them (for example on touch).\n * @default lg\n */\n size?: ControlSize\n inputRef?: React.Ref<HTMLInputElement>\n /** Controlled when set, otherwise seeded by `defaultCountry`. */\n country?: string\n /** National digits, no country code or separators. */\n number?: string\n onChange?: (value: PhoneValue) => void\n /** ISO code, used when `country` is uncontrolled. */\n defaultCountry?: string\n /** ISO codes pinned above the list, in order. */\n priorityCountries?: Array<string>\n numberInputProps?: Omit<\n React.InputHTMLAttributes<HTMLInputElement>,\n 'id' | 'name' | 'disabled' | 'value' | 'onChange' | 'onKeyDown' | 'className'\n >\n /** Defaults to the country's example number. */\n placeholder?: string\n countryAriaLabel?: string\n searchPlaceholder?: string\n emptyMessage?: string\n 'aria-describedby'?: string\n 'aria-invalid'?: React.AriaAttributes['aria-invalid']\n}\n\ntype ResolvedPhoneInputProps<T extends object> = PhoneInputBaseProps &\n Partial<PhoneInputCountryAccessors<T>> & {\n /** Defaults to the generated list. */\n countries?: Array<T>\n /** Names the generated list. Ignored when `countries` is passed. */\n locale?: string\n onChange?: (value: PhoneValue<T>) => void\n }\n\nexport type PhoneInputDefaultProps = ResolvedPhoneInputProps<PhoneCountry>\n\nexport type PhoneInputCustomProps<T extends object> = PhoneInputBaseProps &\n PhoneInputCountryAccessors<T> & {\n countries: Array<T>\n onChange?: (value: PhoneValue<T>) => void\n }\n\nexport type PhoneInputProps<T extends object = PhoneCountry> = PhoneInputDefaultProps | PhoneInputCustomProps<T>\n\nconst defaultAccessors: PhoneInputCountryAccessors<PhoneCountry> = {\n getCountryValue: (country) => country.isoCode,\n getCountryIsoCode: (country) => country.isoCode,\n getCountryDialCode: (country) => country.dialCode,\n getCountryFlag: (country) => country.flag,\n getCountryName: (country) => country.name,\n}\n\nexport function PhoneInput(props: Readonly<PhoneInputDefaultProps>): React.ReactElement\nexport function PhoneInput<T extends object>(props: Readonly<PhoneInputCustomProps<T>>): React.ReactElement\nexport function PhoneInput<T extends object>(props: Readonly<ResolvedPhoneInputProps<T>>): React.ReactElement {\n const {\n id,\n name,\n className,\n disabled = false,\n error = false,\n helperText,\n prefixLabel,\n numberLabel,\n size = 'lg',\n inputRef: externalInputRef,\n countries,\n country,\n onChange,\n number,\n defaultCountry,\n priorityCountries,\n locale = 'en',\n numberInputProps,\n placeholder,\n countryAriaLabel = 'Select country',\n searchPlaceholder = 'Search...',\n emptyMessage = 'No results found.',\n getCountryValue,\n getCountryIsoCode,\n getCountryDialCode,\n getCountryFlag,\n getCountryName,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n } = props\n const errorMessage = typeof error === 'string' && error !== '' ? error : undefined\n const invalid = isFieldInvalid(Boolean(error) || Boolean(errorMessage), ariaInvalid)\n const generatedId = React.useId()\n const numberId = id ?? generatedId\n const messageId = `${numberId}-message`\n const countryId = `${numberId}-country`\n const prefixLabelId = `${numberId}-prefix-label`\n const message = errorMessage ?? helperText\n const describedBy = [ariaDescribedBy, message ? messageId : undefined].filter(Boolean).join(' ') || undefined\n\n const defaults = defaultAccessors as unknown as PhoneInputCountryAccessors<T>\n const options = countries ?? (buildCountries(locale) as unknown as Array<T>)\n const resolveValue = getCountryValue ?? defaults.getCountryValue\n const resolveIsoCode = getCountryIsoCode ?? defaults.getCountryIsoCode\n const resolveDialCode = getCountryDialCode ?? defaults.getCountryDialCode\n const resolveFlag = getCountryFlag ?? defaults.getCountryFlag\n const resolveName = getCountryName ?? defaults.getCountryName\n\n const {\n isoOf,\n selectedValue,\n selectedOption,\n selectedIso,\n displayValue,\n inputElRef,\n selectCountry,\n onInputChange,\n onInputKeyDown,\n } = usePhoneField({\n options,\n getCountryValue: resolveValue,\n getCountryDialCode: resolveDialCode,\n getCountryIsoCode: resolveIsoCode,\n country,\n number,\n onChange,\n defaultCountry,\n priorityCountries,\n })\n\n const [open, setOpen] = React.useState(false)\n const [search, setSearch] = React.useState('')\n const listRef = useListScroll({ open, searchTerm: search, selectedValue: undefined })\n\n const renderFlag = (option: T) => {\n const iso = isoOf(option)\n return iso ? <Flag iso={iso} /> : <span className=\"text-lg leading-none\">{resolveFlag(option)}</span>\n }\n\n const prefixDisabled = disabled || options.length <= 1\n const longestDialCode =\n options.map((option) => resolveDialCode(option)).toSorted((first, second) => second.length - first.length)[0] ?? ''\n\n const matches = createSearchMatcher(search)\n const filteredOptions = search.trim()\n ? options.filter((option) => matches([resolveName(option), resolveDialCode(option), isoOf(option) ?? '']))\n : options\n const { priority: priorityOptions, rest: restOptions } = splitByPriority(filteredOptions, priorityCountries, isoOf)\n\n const handleOpenChange = (next: boolean) => {\n setOpen(next)\n if (next) setSearch('')\n }\n\n const handleSelect = (value: string) => {\n const option = filteredOptions.find((candidate) => resolveValue(candidate) === value)\n if (option) selectCountry(option)\n handleOpenChange(false)\n }\n\n const renderOption = (option: T, isSelected: boolean) => (\n <>\n {renderFlag(option)}\n <span className=\"shrink-0 text-tertiary\">{resolveDialCode(option)}</span>\n <span className=\"truncate\">{resolveName(option)}</span>\n {isSelected && <OptionCheck data-testid=\"selected-check\" className=\"ml-auto\" />}\n </>\n )\n\n return (\n <div\n data-testid=\"phone-input-shell\"\n className={cn('grid w-full grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-1', className)}\n >\n {(prefixLabel !== undefined || numberLabel !== undefined) && (\n <>\n {prefixLabel ? (\n <Label id={prefixLabelId} htmlFor={countryId}>\n {prefixLabel}\n </Label>\n ) : (\n <span />\n )}\n {numberLabel ? <Label htmlFor={numberId}>{numberLabel}</Label> : <span />}\n </>\n )}\n\n <InputGroup size={size} disabled={disabled} className=\"shrink-0 items-stretch gap-0 overflow-hidden px-0\">\n <PopoverRoot open={open} onOpenChange={handleOpenChange}>\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n id={countryId}\n disabled={prefixDisabled}\n aria-label={selectedOption ? resolveName(selectedOption) : countryAriaLabel}\n aria-labelledby={prefixLabel ? `${prefixLabelId} ${countryId}` : undefined}\n data-slot=\"input-group-addon\"\n data-wide={options.length > 1 ? '' : undefined}\n className=\"\n flex w-full shrink-0 items-center gap-1.5 rounded-[inherit] px-(--control-inset) text-primary\n motion-hover [--focus-ring-offset:-2px]\n not-disabled:hover:bg-surface-neutral-subtle-hovered\n disabled:cursor-not-allowed\n in-data-disabled:text-tertiary\n \"\n >\n <span className=\"flex w-5.5 shrink-0 items-center justify-center\">\n {selectedOption ? (\n renderFlag(selectedOption)\n ) : (\n <GlobeIcon className=\"icon-md text-tertiary\" aria-hidden />\n )}\n </span>\n <span className=\"grid\">\n <span aria-hidden className=\"invisible col-start-1 row-start-1\">\n {longestDialCode}\n </span>\n <span className=\"col-start-1 row-start-1\">\n {selectedOption ? resolveDialCode(selectedOption) : null}\n </span>\n </span>\n {!prefixDisabled && <CaretDownIcon className=\"ml-auto icon-sm shrink-0 text-tertiary\" />}\n </button>\n </PopoverTrigger>\n <PopoverContent align=\"start\" data-size={size} className=\"w-72 overflow-hidden p-0 control surface-list\">\n <Command shouldFilter={false} defaultValue={selectedValue}>\n <CommandInput placeholder={searchPlaceholder} value={search} onValueChange={setSearch} />\n <VirtualizedComboboxList\n listRef={listRef}\n localOptions={restOptions}\n specialOptions={priorityOptions}\n loading={false}\n loadingPlaceholder=\"\"\n emptyMessage={emptyMessage}\n value={selectedValue}\n getOptionValue={resolveValue}\n getOptionLabel={resolveName}\n handleSelect={handleSelect}\n renderOption={renderOption}\n />\n </Command>\n </PopoverContent>\n </PopoverRoot>\n </InputGroup>\n\n <InputGroup\n size={size}\n disabled={disabled}\n invalid={invalid}\n className=\"items-stretch gap-0 overflow-hidden px-0\"\n >\n <input\n /* eslint-disable react-hooks/immutability -- merging the internal ref with the caller-supplied `inputRef` is the standard ref-forwarding idiom */\n ref={(el) => {\n inputElRef.current = el\n if (typeof externalInputRef === 'function') externalInputRef(el)\n else if (externalInputRef) externalInputRef.current = el\n }}\n /* eslint-enable react-hooks/immutability */\n id={numberId}\n name={name}\n type=\"tel\"\n inputMode=\"tel\"\n autoComplete=\"tel-national\"\n disabled={disabled}\n value={displayValue}\n onChange={onInputChange}\n onKeyDown={onInputKeyDown}\n placeholder={placeholder ?? exampleNational(selectedIso)}\n aria-invalid={invalid || undefined}\n aria-describedby={describedBy}\n className=\"\n min-w-0 flex-1 bg-transparent px-(--control-inset) text-ellipsis text-primary\n placeholder:text-tertiary\n disabled:cursor-not-allowed disabled:text-tertiary\n \"\n {...numberInputProps}\n />\n\n {invalid && <InputGroupErrorIcon className=\"flex items-center pr-(--control-inset)\" />}\n </InputGroup>\n\n {message && (\n <div className=\"col-start-2\">\n {errorMessage ? (\n <FieldError id={messageId}>{errorMessage}</FieldError>\n ) : (\n <FieldDescription id={messageId}>{helperText}</FieldDescription>\n )}\n </div>\n )}\n </div>\n )\n}\n\nPhoneInput.displayName = 'PhoneInput'\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmFA,IAAM,mBAA6D;CACjE,kBAAkB,YAAY,QAAQ;CACtC,oBAAoB,YAAY,QAAQ;CACxC,qBAAqB,YAAY,QAAQ;CACzC,iBAAiB,YAAY,QAAQ;CACrC,iBAAiB,YAAY,QAAQ;AACvC;AAIA,SAAgB,WAA6B,OAAiE;CAC5G,MAAM,EACJ,IACA,MACA,WACA,WAAW,OACX,QAAQ,OACR,YACA,aACA,aACA,OAAO,MACP,UAAU,kBACV,WACA,SACA,UACA,QACA,gBACA,mBACA,SAAS,MACT,kBACA,aACA,mBAAmB,kBACnB,oBAAoB,aACpB,eAAe,qBACf,iBACA,mBACA,oBACA,gBACA,gBACA,oBAAoB,iBACpB,gBAAgB,gBACd;CACJ,MAAM,eAAe,OAAO,UAAU,YAAY,UAAU,KAAK,QAAQ,KAAA;CACzE,MAAM,UAAU,eAAe,QAAQ,KAAK,KAAK,QAAQ,YAAY,GAAG,WAAW;CACnF,MAAM,cAAcA,QAAM,MAAM;CAChC,MAAM,WAAW,MAAM;CACvB,MAAM,YAAY,GAAG,SAAS;CAC9B,MAAM,YAAY,GAAG,SAAS;CAC9B,MAAM,gBAAgB,GAAG,SAAS;CAClC,MAAM,UAAU,gBAAgB;CAChC,MAAM,cAAc,CAAC,iBAAiB,UAAU,YAAY,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