asma-ui-core 3.80.3 → 3.81.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Readme.md CHANGED
@@ -193,6 +193,7 @@ Every component is exported from the package root. Browse them interactively wit
193
193
  | --- | --- |
194
194
  | **Buttons & actions** | `StyledButton`, `StyledLink`, `CopyButton`, `CopyWrapper` |
195
195
  | **Text inputs** | `StyledInputField`, `StyledTextarea`, `StyledSearchField`, `StyledLabel` |
196
+ | **Phone** | `StyledPhoneField` (country selector + national number), `StyledCountryFlag` |
196
197
  | **Selects** | `StyledSelect` + `StyledSelectItem` (single), `StyledSelectAutocomplete` (combobox), `StyledDynamicSelect` (chip multi-select), `Listbox` (headless) |
197
198
  | **Toggles** | `StyledCheckbox`, `StyledRadio` / `StyledRadioGroup`, `StyledSwitch`, `StyledSlider` |
198
199
  | **Form scaffolding** | `StyledFormControl`, `StyledFormControlLabel`, `StyledFormGroup`, `StyledFormLabel`, `StyledFormHelperText`, `StyledInputLabel` |
@@ -206,6 +207,37 @@ Every component is exported from the package root. Browse them interactively wit
206
207
  | **Primitives** | `Paper`, `Stack`, `Container`, `Avatar`, `Skeleton`, `Fade`, `Popper`, `ClickAwayListener` |
207
208
  | **Hooks & utils** | `usePopupState` (+ `bindTrigger` / `bindPopover` / `bindPopper`), `useSnackbar`, `cn`, `omit`, `prepareForSlot` |
208
209
 
210
+ ### Phone field
211
+
212
+ `StyledPhoneField` is a country selector paired with the national part of the number. It is
213
+ presentational on purpose and owns **no** phone data: the country list, the formatter and the
214
+ `tel:` href are injected by the consumer, which is normally `asma-core-helpers/phone`.
215
+
216
+ ```tsx
217
+ import { StyledPhoneField, StyledCountryFlag } from 'asma-ui-core'
218
+ import { listPhoneCountries, formatNationalAsYouType } from 'asma-core-helpers/phone'
219
+
220
+ <StyledPhoneField
221
+ label='Phone'
222
+ countries={listPhoneCountries(locale)}
223
+ country={country}
224
+ onCountryChange={setCountry}
225
+ value={nationalNumber}
226
+ onChange={setNationalNumber}
227
+ formatNationalNumber={formatNationalAsYouType}
228
+ renderFlag={renderCountryFlag}
229
+ selectCountryLabel='Select country code'
230
+ searchPlaceholder='Search country or code'
231
+ />
232
+ ```
233
+
234
+ The split is deliberate. Declaring the country structurally instead of importing the union keeps
235
+ roughly 20 KB gz of country metadata out of the shared bundle, so an app that never renders a phone
236
+ field does not pay for one. `onChange` reports digits only — the country travels separately.
237
+
238
+ The picker has two shapes: below 744 px it is a full-screen sheet with its own search box, above it
239
+ the trigger itself is the combobox. Both are keyboard-operable and share one listbox.
240
+
209
241
  ### Icons
210
242
 
211
243
  Around 180 icons ship on a dedicated subpath so you only pay for the ones you use — each is its own