@dloizides/ui-forms 1.36.0 → 1.37.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,9 @@
3
3
  ## [Unreleased]
4
4
 
5
5
  ### Added
6
+ - `SearchSelect.renderTrigger({ open, selected, onPress, ref })`: draw your own trigger (a chip, a button) in place of the field box; the package keeps the pressable, its label, hint, expanded state, testID, the 44 px hit box and the focus return on close. A dropdown from a narrow trigger opens at least 240 px wide inside the viewport (`fitDropdownWidth`) (D-INPUTS-19 in FINREG-INPUTS-1 "Searchable dropdowns, shared country field, formatted IBAN/BIC inputs").
7
+ - `IbanInput` / `BicInput` take `onBlur` (called after the leave verdict, so forms validate on blur); `BicInput` takes `placeholder`.
8
+ - `CountryField.noneLabel`: an optional "no country" choice (stores `''`), flags and code column kept; `countryFieldOptions` exported.
6
9
  - `ChipOption.labelWrap` (`ChipLabelWrap.None | Wrap | Truncate`, a `const enum`, default `None` = unchanged): `wrap` and `truncate` cap a chip at its container width so a long label never runs past its card at 360 px; the internal `chipLabelLayout` helper is no longer exported (D-LD-7 in LIST-DEFAULTS-1 "Operator-set default watchlists", TEXT-FIT-1).
7
10
  - `SearchSelect`: type to filter by name and detail, Recent then All, arrow keys + Enter + Esc, phone sheet / computer unfold, reduced motion = no slide (FINREG-INPUTS-1 "Searchable dropdowns, shared country field, formatted IBAN/BIC inputs").
8
11
  - `CountryField` + `COUNTRIES` (ISO 3166-1 alpha-2, 249): drawn SVG flag (`CountryFlag`, needs peer `react-native-svg >=13.0.0`), name, grey code; stores the code only.
package/dist/index.d.mts CHANGED
@@ -1296,6 +1296,13 @@ interface SearchSelectLabels {
1296
1296
  close: string;
1297
1297
  closeHint: string;
1298
1298
  }
1299
+ /** What a custom trigger draws from; the package keeps the pressable, its a11y and the focus return. */
1300
+ interface SearchSelectTrigger {
1301
+ open: boolean;
1302
+ selected: ControlOption | null;
1303
+ onPress: () => void;
1304
+ ref: RefObject<View | null>;
1305
+ }
1299
1306
 
1300
1307
  interface SearchSelectProps {
1301
1308
  options: readonly ControlOption[];
@@ -1308,8 +1315,9 @@ interface SearchSelectProps {
1308
1315
  recentKey?: string;
1309
1316
  renderLeading?: (option: ControlOption) => React.ReactNode;
1310
1317
  renderDetail?: (option: ControlOption) => React.ReactNode;
1318
+ renderTrigger?: (trigger: SearchSelectTrigger) => React.ReactNode;
1311
1319
  }
1312
- /** A select you can type into to filter; the value is always a picked option, never typed text. */
1320
+ /** A select you can type into to filter; `renderTrigger` swaps the field box for your own visual. */
1313
1321
  declare function SearchSelect(props: SearchSelectProps): React.ReactElement;
1314
1322
 
1315
1323
  /** How the option list opens: a sheet from below (phone) or a list unfolding under the field. */
@@ -1391,6 +1399,8 @@ interface DropdownFrame {
1391
1399
  declare function placeDropdown(anchor: AnchorRect, panelHeight: number, viewportHeight: number): DropdownPlacement;
1392
1400
  /** The window frame for the list next to `anchor`, on the side `placeDropdown` picks. */
1393
1401
  declare function dropdownFrame(anchor: AnchorRect, panelHeight: number, viewportHeight: number): DropdownFrame;
1402
+ /** Widens a narrow anchor's list to a readable width and keeps it inside the viewport. */
1403
+ declare function fitDropdownWidth(frame: DropdownFrame, viewportWidth: number): DropdownFrame;
1394
1404
 
1395
1405
  /** Focuses `ref` on the next tick, after the closing list surface has left the page. */
1396
1406
  declare function useDeferredFocus(ref: RefObject<{
@@ -1441,15 +1451,18 @@ interface CountryFieldProps {
1441
1451
  labels: SearchSelectLabels;
1442
1452
  testID: string;
1443
1453
  countries?: readonly Country[];
1454
+ noneLabel?: string;
1444
1455
  }
1445
- /** A searchable country field: flag, name and grey code; stores the ISO 3166-1 alpha-2 code only. */
1446
- declare function CountryField({ value, onChange, accessibilityLabel, accessibilityHint, labels, testID, countries }: CountryFieldProps): React.ReactElement;
1456
+ /** A searchable country field: flag, name and grey code; stores the ISO 3166-1 alpha-2 code, or '' for `noneLabel`. */
1457
+ declare function CountryField({ value, onChange, accessibilityLabel, accessibilityHint, labels, testID, countries, noneLabel }: CountryFieldProps): React.ReactElement;
1447
1458
 
1448
1459
  /** ISO 3166-1 alpha-2 countries (249) with English short names. */
1449
1460
  declare const COUNTRIES: readonly Country[];
1450
1461
 
1451
1462
  /** Countries as select options: name as the label, the 2-letter code as value and detail. */
1452
1463
  declare function countryOptions(list?: readonly Country[]): ControlOption[];
1464
+ /** The country options, led by a "no country" choice (value '') when `noneLabel` is given. */
1465
+ declare function countryFieldOptions(countries?: readonly Country[], noneLabel?: string): readonly ControlOption[];
1453
1466
  /** The flag emoji for a 2-letter code, or '' for anything else. */
1454
1467
  declare function countryFlag(code: string): string;
1455
1468
  /** The stored value for an input: a known 2-letter code in upper case, else ''. */
@@ -1497,11 +1510,12 @@ interface IbanInputProps {
1497
1510
  accessibilityLabel: string;
1498
1511
  accessibilityHint: string;
1499
1512
  testID: string;
1513
+ onBlur?: () => void;
1500
1514
  rejectionLabels?: IbanRejectionLabels;
1501
1515
  placeholder?: string;
1502
1516
  }
1503
1517
  /** An IBAN box that groups in fours as you type, stores no spaces and validates on leave. */
1504
- declare function IbanInput({ value, onChange, onVerdict, accessibilityLabel, accessibilityHint, testID, rejectionLabels, placeholder }: IbanInputProps): React.ReactElement;
1518
+ declare function IbanInput({ value, onChange, onVerdict, accessibilityLabel, accessibilityHint, testID, rejectionLabels, placeholder, onBlur: onLeft }: IbanInputProps): React.ReactElement;
1505
1519
 
1506
1520
  /** The outcome of validating one BIC; `electronic` (upper case, trimmed) is set only when valid. */
1507
1521
  interface BicVerdict {
@@ -1518,10 +1532,12 @@ interface BicInputProps {
1518
1532
  accessibilityLabel: string;
1519
1533
  accessibilityHint: string;
1520
1534
  testID: string;
1535
+ onBlur?: () => void;
1521
1536
  rejectionLabels?: BicRejectionLabels;
1537
+ placeholder?: string;
1522
1538
  }
1523
1539
  /** A BIC box that upper-cases as you type, ghosts the optional branch and validates on leave. */
1524
- declare function BicInput({ value, onChange, onVerdict, accessibilityLabel, accessibilityHint, testID, rejectionLabels }: BicInputProps): React.ReactElement;
1540
+ declare function BicInput({ value, onChange, onVerdict, accessibilityLabel, accessibilityHint, testID, rejectionLabels, placeholder, onBlur: onLeft }: BicInputProps): React.ReactElement;
1525
1541
 
1526
1542
  /** The longest IBAN ISO 13616 permits. */
1527
1543
  declare const IBAN_MAX_LENGTH = 34;
@@ -1566,4 +1582,4 @@ declare function useBlurVerdict<T>(validate: () => T): BlurVerdict<T>;
1566
1582
  /** The pre-localized message for a refusal, or null when there is no verdict, it passed, or no labels were given. */
1567
1583
  declare function rejectionMessage<R extends string, N extends R>(rejection: R | null, none: N, labels: Readonly<Record<Exclude<R, N>, string>> | undefined): string | null;
1568
1584
 
1569
- export { AddOnRequest, type AddOnRequestProps, AlignToControl, type AlignToControlProps, type AnchorRect, AnchoredMenu, type AnchoredMenuColors, type AnchoredMenuListbox, type AnchoredMenuPlacement, type AnchoredMenuProps, type BicDraft, BicInput, type BicInputProps, BicRejection, type BicRejectionLabels, type BicVerdict, type BlurVerdict, COUNTRIES, ChipLabelWrap, type ChipOption, ChipSelector, type ChipSelectorProps, type ChipSingleSelectRole, type ChipVariant, type ControlOption, type Country, CountryField, type CountryFieldProps, CountryFlag, type CountryFlagProps, DEFAULT_MAX_RECENTS, DEFAULT_OPTIONAL_LABEL, DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS, DEFAULT_TYPEAHEAD_MIN_CHARS, DateField, type DateFieldProps, DateInput, type DateInputProps, DateRangeControl, type DateRangeControlProps, type DateRangeValue, DateTimeField, type DateTimeFieldProps, type DropdownFrame, DropdownPlacement, FLAG_HEIGHT, FLAG_WIDTH, Field, type FieldChildContext, type FieldChildren, type FieldLabelVariant, type FieldMarker, type FieldProps, type FieldSpacing, FixBar, type FixBarProps, type FlagShape, FlagShapeKind, type Focusable, type FocusableRefs, FormActions, type FormActionsProps, FormCell, type FormCellProps, FormCheckbox, type FormCheckboxProps, FormField, type FormFieldProps, FormGrid, type FormGridProps, FormSection, type FormSectionProps, FormStack, type FormStackProps, FormStatusLine, type FormStatusLineProps, FormSwitch, type FormSwitchProps, type GroupSelection, IBAN_MAX_LENGTH, IBAN_REGISTERED_COUNTRY_COUNT, INLINE_FIELD_ROW_MIN_WIDTH, type IbanDraft, IbanInput, type IbanInputProps, IbanRejection, type IbanRejectionLabels, type IbanVerdict, InlineFieldRow, type InlineFieldRowLayout, type InlineFieldRowProps, PHONE_MAX_WIDTH, RESPONSIVE_FORM_DEFAULT_BREAKPOINT, type RecentValues, ResponsiveFormLayout, type ResponsiveFormLayoutProps, SearchSelect, type SearchSelectLabels, type SearchSelectProps, type SearchSelectSections, type SearchSelectState, SelectControl, type SelectControlProps, SelectField, type SelectFieldProps, type SelectMenuAnchor, type SelectMotion, SelectSurface, type StepNeighbours, StepperNav, type StepperNavLabels, type StepperNavProps, type StepperStep, StepperTabs, type StepperTabsProps, type ThemedInput, ThemedTextInput, type ThemedTextInputProps, TypeaheadControl, type TypeaheadControlProps, type TypeaheadSearch, type TypeaheadSearchProps, UploadWithLinkField, type UploadWithLinkFieldProps, type UploadWithLinkLabels, type UseThemedInputOptions, buildSearchSelectSections, controlStyles, countryFlag, countryOptions, draftBic, draftIban, dropdownFrame, findOption, flagShapes, groupAriaChecked, groupInFours, highlightAfterQuery, ibanCounter, ibanLengthFor, inlineFieldRowLayout, isAddOnOpen, isFallbackFlag, isFixBarVisible, isOutside, isUnmatched, isWideFormLayout, moveHighlight, nextHighlight, placeDropdown, rejectionMessage, resolveGroupSelection, resolveSelectMotion, resolveStepNeighbours, suggestOptions, toCountryValue, toggleGroupSelection, useBlurVerdict, useDeferredFocus, useFocusFirstInvalid, useKeepInView, useOutsidePress, useRecentValues, useReducedMotion, useSearchSelectState, useThemedInput, validateBic, validateIban };
1585
+ export { AddOnRequest, type AddOnRequestProps, AlignToControl, type AlignToControlProps, type AnchorRect, AnchoredMenu, type AnchoredMenuColors, type AnchoredMenuListbox, type AnchoredMenuPlacement, type AnchoredMenuProps, type BicDraft, BicInput, type BicInputProps, BicRejection, type BicRejectionLabels, type BicVerdict, type BlurVerdict, COUNTRIES, ChipLabelWrap, type ChipOption, ChipSelector, type ChipSelectorProps, type ChipSingleSelectRole, type ChipVariant, type ControlOption, type Country, CountryField, type CountryFieldProps, CountryFlag, type CountryFlagProps, DEFAULT_MAX_RECENTS, DEFAULT_OPTIONAL_LABEL, DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS, DEFAULT_TYPEAHEAD_MIN_CHARS, DateField, type DateFieldProps, DateInput, type DateInputProps, DateRangeControl, type DateRangeControlProps, type DateRangeValue, DateTimeField, type DateTimeFieldProps, type DropdownFrame, DropdownPlacement, FLAG_HEIGHT, FLAG_WIDTH, Field, type FieldChildContext, type FieldChildren, type FieldLabelVariant, type FieldMarker, type FieldProps, type FieldSpacing, FixBar, type FixBarProps, type FlagShape, FlagShapeKind, type Focusable, type FocusableRefs, FormActions, type FormActionsProps, FormCell, type FormCellProps, FormCheckbox, type FormCheckboxProps, FormField, type FormFieldProps, FormGrid, type FormGridProps, FormSection, type FormSectionProps, FormStack, type FormStackProps, FormStatusLine, type FormStatusLineProps, FormSwitch, type FormSwitchProps, type GroupSelection, IBAN_MAX_LENGTH, IBAN_REGISTERED_COUNTRY_COUNT, INLINE_FIELD_ROW_MIN_WIDTH, type IbanDraft, IbanInput, type IbanInputProps, IbanRejection, type IbanRejectionLabels, type IbanVerdict, InlineFieldRow, type InlineFieldRowLayout, type InlineFieldRowProps, PHONE_MAX_WIDTH, RESPONSIVE_FORM_DEFAULT_BREAKPOINT, type RecentValues, ResponsiveFormLayout, type ResponsiveFormLayoutProps, SearchSelect, type SearchSelectLabels, type SearchSelectProps, type SearchSelectSections, type SearchSelectState, type SearchSelectTrigger, SelectControl, type SelectControlProps, SelectField, type SelectFieldProps, type SelectMenuAnchor, type SelectMotion, SelectSurface, type StepNeighbours, StepperNav, type StepperNavLabels, type StepperNavProps, type StepperStep, StepperTabs, type StepperTabsProps, type ThemedInput, ThemedTextInput, type ThemedTextInputProps, TypeaheadControl, type TypeaheadControlProps, type TypeaheadSearch, type TypeaheadSearchProps, UploadWithLinkField, type UploadWithLinkFieldProps, type UploadWithLinkLabels, type UseThemedInputOptions, buildSearchSelectSections, controlStyles, countryFieldOptions, countryFlag, countryOptions, draftBic, draftIban, dropdownFrame, findOption, fitDropdownWidth, flagShapes, groupAriaChecked, groupInFours, highlightAfterQuery, ibanCounter, ibanLengthFor, inlineFieldRowLayout, isAddOnOpen, isFallbackFlag, isFixBarVisible, isOutside, isUnmatched, isWideFormLayout, moveHighlight, nextHighlight, placeDropdown, rejectionMessage, resolveGroupSelection, resolveSelectMotion, resolveStepNeighbours, suggestOptions, toCountryValue, toggleGroupSelection, useBlurVerdict, useDeferredFocus, useFocusFirstInvalid, useKeepInView, useOutsidePress, useRecentValues, useReducedMotion, useSearchSelectState, useThemedInput, validateBic, validateIban };
package/dist/index.d.ts CHANGED
@@ -1296,6 +1296,13 @@ interface SearchSelectLabels {
1296
1296
  close: string;
1297
1297
  closeHint: string;
1298
1298
  }
1299
+ /** What a custom trigger draws from; the package keeps the pressable, its a11y and the focus return. */
1300
+ interface SearchSelectTrigger {
1301
+ open: boolean;
1302
+ selected: ControlOption | null;
1303
+ onPress: () => void;
1304
+ ref: RefObject<View | null>;
1305
+ }
1299
1306
 
1300
1307
  interface SearchSelectProps {
1301
1308
  options: readonly ControlOption[];
@@ -1308,8 +1315,9 @@ interface SearchSelectProps {
1308
1315
  recentKey?: string;
1309
1316
  renderLeading?: (option: ControlOption) => React.ReactNode;
1310
1317
  renderDetail?: (option: ControlOption) => React.ReactNode;
1318
+ renderTrigger?: (trigger: SearchSelectTrigger) => React.ReactNode;
1311
1319
  }
1312
- /** A select you can type into to filter; the value is always a picked option, never typed text. */
1320
+ /** A select you can type into to filter; `renderTrigger` swaps the field box for your own visual. */
1313
1321
  declare function SearchSelect(props: SearchSelectProps): React.ReactElement;
1314
1322
 
1315
1323
  /** How the option list opens: a sheet from below (phone) or a list unfolding under the field. */
@@ -1391,6 +1399,8 @@ interface DropdownFrame {
1391
1399
  declare function placeDropdown(anchor: AnchorRect, panelHeight: number, viewportHeight: number): DropdownPlacement;
1392
1400
  /** The window frame for the list next to `anchor`, on the side `placeDropdown` picks. */
1393
1401
  declare function dropdownFrame(anchor: AnchorRect, panelHeight: number, viewportHeight: number): DropdownFrame;
1402
+ /** Widens a narrow anchor's list to a readable width and keeps it inside the viewport. */
1403
+ declare function fitDropdownWidth(frame: DropdownFrame, viewportWidth: number): DropdownFrame;
1394
1404
 
1395
1405
  /** Focuses `ref` on the next tick, after the closing list surface has left the page. */
1396
1406
  declare function useDeferredFocus(ref: RefObject<{
@@ -1441,15 +1451,18 @@ interface CountryFieldProps {
1441
1451
  labels: SearchSelectLabels;
1442
1452
  testID: string;
1443
1453
  countries?: readonly Country[];
1454
+ noneLabel?: string;
1444
1455
  }
1445
- /** A searchable country field: flag, name and grey code; stores the ISO 3166-1 alpha-2 code only. */
1446
- declare function CountryField({ value, onChange, accessibilityLabel, accessibilityHint, labels, testID, countries }: CountryFieldProps): React.ReactElement;
1456
+ /** A searchable country field: flag, name and grey code; stores the ISO 3166-1 alpha-2 code, or '' for `noneLabel`. */
1457
+ declare function CountryField({ value, onChange, accessibilityLabel, accessibilityHint, labels, testID, countries, noneLabel }: CountryFieldProps): React.ReactElement;
1447
1458
 
1448
1459
  /** ISO 3166-1 alpha-2 countries (249) with English short names. */
1449
1460
  declare const COUNTRIES: readonly Country[];
1450
1461
 
1451
1462
  /** Countries as select options: name as the label, the 2-letter code as value and detail. */
1452
1463
  declare function countryOptions(list?: readonly Country[]): ControlOption[];
1464
+ /** The country options, led by a "no country" choice (value '') when `noneLabel` is given. */
1465
+ declare function countryFieldOptions(countries?: readonly Country[], noneLabel?: string): readonly ControlOption[];
1453
1466
  /** The flag emoji for a 2-letter code, or '' for anything else. */
1454
1467
  declare function countryFlag(code: string): string;
1455
1468
  /** The stored value for an input: a known 2-letter code in upper case, else ''. */
@@ -1497,11 +1510,12 @@ interface IbanInputProps {
1497
1510
  accessibilityLabel: string;
1498
1511
  accessibilityHint: string;
1499
1512
  testID: string;
1513
+ onBlur?: () => void;
1500
1514
  rejectionLabels?: IbanRejectionLabels;
1501
1515
  placeholder?: string;
1502
1516
  }
1503
1517
  /** An IBAN box that groups in fours as you type, stores no spaces and validates on leave. */
1504
- declare function IbanInput({ value, onChange, onVerdict, accessibilityLabel, accessibilityHint, testID, rejectionLabels, placeholder }: IbanInputProps): React.ReactElement;
1518
+ declare function IbanInput({ value, onChange, onVerdict, accessibilityLabel, accessibilityHint, testID, rejectionLabels, placeholder, onBlur: onLeft }: IbanInputProps): React.ReactElement;
1505
1519
 
1506
1520
  /** The outcome of validating one BIC; `electronic` (upper case, trimmed) is set only when valid. */
1507
1521
  interface BicVerdict {
@@ -1518,10 +1532,12 @@ interface BicInputProps {
1518
1532
  accessibilityLabel: string;
1519
1533
  accessibilityHint: string;
1520
1534
  testID: string;
1535
+ onBlur?: () => void;
1521
1536
  rejectionLabels?: BicRejectionLabels;
1537
+ placeholder?: string;
1522
1538
  }
1523
1539
  /** A BIC box that upper-cases as you type, ghosts the optional branch and validates on leave. */
1524
- declare function BicInput({ value, onChange, onVerdict, accessibilityLabel, accessibilityHint, testID, rejectionLabels }: BicInputProps): React.ReactElement;
1540
+ declare function BicInput({ value, onChange, onVerdict, accessibilityLabel, accessibilityHint, testID, rejectionLabels, placeholder, onBlur: onLeft }: BicInputProps): React.ReactElement;
1525
1541
 
1526
1542
  /** The longest IBAN ISO 13616 permits. */
1527
1543
  declare const IBAN_MAX_LENGTH = 34;
@@ -1566,4 +1582,4 @@ declare function useBlurVerdict<T>(validate: () => T): BlurVerdict<T>;
1566
1582
  /** The pre-localized message for a refusal, or null when there is no verdict, it passed, or no labels were given. */
1567
1583
  declare function rejectionMessage<R extends string, N extends R>(rejection: R | null, none: N, labels: Readonly<Record<Exclude<R, N>, string>> | undefined): string | null;
1568
1584
 
1569
- export { AddOnRequest, type AddOnRequestProps, AlignToControl, type AlignToControlProps, type AnchorRect, AnchoredMenu, type AnchoredMenuColors, type AnchoredMenuListbox, type AnchoredMenuPlacement, type AnchoredMenuProps, type BicDraft, BicInput, type BicInputProps, BicRejection, type BicRejectionLabels, type BicVerdict, type BlurVerdict, COUNTRIES, ChipLabelWrap, type ChipOption, ChipSelector, type ChipSelectorProps, type ChipSingleSelectRole, type ChipVariant, type ControlOption, type Country, CountryField, type CountryFieldProps, CountryFlag, type CountryFlagProps, DEFAULT_MAX_RECENTS, DEFAULT_OPTIONAL_LABEL, DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS, DEFAULT_TYPEAHEAD_MIN_CHARS, DateField, type DateFieldProps, DateInput, type DateInputProps, DateRangeControl, type DateRangeControlProps, type DateRangeValue, DateTimeField, type DateTimeFieldProps, type DropdownFrame, DropdownPlacement, FLAG_HEIGHT, FLAG_WIDTH, Field, type FieldChildContext, type FieldChildren, type FieldLabelVariant, type FieldMarker, type FieldProps, type FieldSpacing, FixBar, type FixBarProps, type FlagShape, FlagShapeKind, type Focusable, type FocusableRefs, FormActions, type FormActionsProps, FormCell, type FormCellProps, FormCheckbox, type FormCheckboxProps, FormField, type FormFieldProps, FormGrid, type FormGridProps, FormSection, type FormSectionProps, FormStack, type FormStackProps, FormStatusLine, type FormStatusLineProps, FormSwitch, type FormSwitchProps, type GroupSelection, IBAN_MAX_LENGTH, IBAN_REGISTERED_COUNTRY_COUNT, INLINE_FIELD_ROW_MIN_WIDTH, type IbanDraft, IbanInput, type IbanInputProps, IbanRejection, type IbanRejectionLabels, type IbanVerdict, InlineFieldRow, type InlineFieldRowLayout, type InlineFieldRowProps, PHONE_MAX_WIDTH, RESPONSIVE_FORM_DEFAULT_BREAKPOINT, type RecentValues, ResponsiveFormLayout, type ResponsiveFormLayoutProps, SearchSelect, type SearchSelectLabels, type SearchSelectProps, type SearchSelectSections, type SearchSelectState, SelectControl, type SelectControlProps, SelectField, type SelectFieldProps, type SelectMenuAnchor, type SelectMotion, SelectSurface, type StepNeighbours, StepperNav, type StepperNavLabels, type StepperNavProps, type StepperStep, StepperTabs, type StepperTabsProps, type ThemedInput, ThemedTextInput, type ThemedTextInputProps, TypeaheadControl, type TypeaheadControlProps, type TypeaheadSearch, type TypeaheadSearchProps, UploadWithLinkField, type UploadWithLinkFieldProps, type UploadWithLinkLabels, type UseThemedInputOptions, buildSearchSelectSections, controlStyles, countryFlag, countryOptions, draftBic, draftIban, dropdownFrame, findOption, flagShapes, groupAriaChecked, groupInFours, highlightAfterQuery, ibanCounter, ibanLengthFor, inlineFieldRowLayout, isAddOnOpen, isFallbackFlag, isFixBarVisible, isOutside, isUnmatched, isWideFormLayout, moveHighlight, nextHighlight, placeDropdown, rejectionMessage, resolveGroupSelection, resolveSelectMotion, resolveStepNeighbours, suggestOptions, toCountryValue, toggleGroupSelection, useBlurVerdict, useDeferredFocus, useFocusFirstInvalid, useKeepInView, useOutsidePress, useRecentValues, useReducedMotion, useSearchSelectState, useThemedInput, validateBic, validateIban };
1585
+ export { AddOnRequest, type AddOnRequestProps, AlignToControl, type AlignToControlProps, type AnchorRect, AnchoredMenu, type AnchoredMenuColors, type AnchoredMenuListbox, type AnchoredMenuPlacement, type AnchoredMenuProps, type BicDraft, BicInput, type BicInputProps, BicRejection, type BicRejectionLabels, type BicVerdict, type BlurVerdict, COUNTRIES, ChipLabelWrap, type ChipOption, ChipSelector, type ChipSelectorProps, type ChipSingleSelectRole, type ChipVariant, type ControlOption, type Country, CountryField, type CountryFieldProps, CountryFlag, type CountryFlagProps, DEFAULT_MAX_RECENTS, DEFAULT_OPTIONAL_LABEL, DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS, DEFAULT_TYPEAHEAD_MIN_CHARS, DateField, type DateFieldProps, DateInput, type DateInputProps, DateRangeControl, type DateRangeControlProps, type DateRangeValue, DateTimeField, type DateTimeFieldProps, type DropdownFrame, DropdownPlacement, FLAG_HEIGHT, FLAG_WIDTH, Field, type FieldChildContext, type FieldChildren, type FieldLabelVariant, type FieldMarker, type FieldProps, type FieldSpacing, FixBar, type FixBarProps, type FlagShape, FlagShapeKind, type Focusable, type FocusableRefs, FormActions, type FormActionsProps, FormCell, type FormCellProps, FormCheckbox, type FormCheckboxProps, FormField, type FormFieldProps, FormGrid, type FormGridProps, FormSection, type FormSectionProps, FormStack, type FormStackProps, FormStatusLine, type FormStatusLineProps, FormSwitch, type FormSwitchProps, type GroupSelection, IBAN_MAX_LENGTH, IBAN_REGISTERED_COUNTRY_COUNT, INLINE_FIELD_ROW_MIN_WIDTH, type IbanDraft, IbanInput, type IbanInputProps, IbanRejection, type IbanRejectionLabels, type IbanVerdict, InlineFieldRow, type InlineFieldRowLayout, type InlineFieldRowProps, PHONE_MAX_WIDTH, RESPONSIVE_FORM_DEFAULT_BREAKPOINT, type RecentValues, ResponsiveFormLayout, type ResponsiveFormLayoutProps, SearchSelect, type SearchSelectLabels, type SearchSelectProps, type SearchSelectSections, type SearchSelectState, type SearchSelectTrigger, SelectControl, type SelectControlProps, SelectField, type SelectFieldProps, type SelectMenuAnchor, type SelectMotion, SelectSurface, type StepNeighbours, StepperNav, type StepperNavLabels, type StepperNavProps, type StepperStep, StepperTabs, type StepperTabsProps, type ThemedInput, ThemedTextInput, type ThemedTextInputProps, TypeaheadControl, type TypeaheadControlProps, type TypeaheadSearch, type TypeaheadSearchProps, UploadWithLinkField, type UploadWithLinkFieldProps, type UploadWithLinkLabels, type UseThemedInputOptions, buildSearchSelectSections, controlStyles, countryFieldOptions, countryFlag, countryOptions, draftBic, draftIban, dropdownFrame, findOption, fitDropdownWidth, flagShapes, groupAriaChecked, groupInFours, highlightAfterQuery, ibanCounter, ibanLengthFor, inlineFieldRowLayout, isAddOnOpen, isFallbackFlag, isFixBarVisible, isOutside, isUnmatched, isWideFormLayout, moveHighlight, nextHighlight, placeDropdown, rejectionMessage, resolveGroupSelection, resolveSelectMotion, resolveStepNeighbours, suggestOptions, toCountryValue, toggleGroupSelection, useBlurVerdict, useDeferredFocus, useFocusFirstInvalid, useKeepInView, useOutsidePress, useRecentValues, useReducedMotion, useSearchSelectState, useThemedInput, validateBic, validateIban };
package/dist/index.js CHANGED
@@ -2617,6 +2617,8 @@ var DropdownPlacement = /* @__PURE__ */ ((DropdownPlacement2) => {
2617
2617
  })(DropdownPlacement || {});
2618
2618
 
2619
2619
  // src/SearchSelect/utils/dropdownFrame.ts
2620
+ var MIN_PANEL_WIDTH = 240;
2621
+ var EDGE = 8;
2620
2622
  function placeDropdown(anchor, panelHeight, viewportHeight) {
2621
2623
  const roomBelow = viewportHeight - (anchor.y + anchor.height);
2622
2624
  if (roomBelow >= panelHeight) return "below" /* Below */;
@@ -2628,12 +2630,17 @@ function dropdownFrame(anchor, panelHeight, viewportHeight) {
2628
2630
  if (placement === "above" /* Above */) return { ...base, bottom: viewportHeight - anchor.y };
2629
2631
  return { ...base, top: anchor.y + anchor.height };
2630
2632
  }
2633
+ function fitDropdownWidth(frame, viewportWidth) {
2634
+ const width = Math.max(frame.width, Math.min(MIN_PANEL_WIDTH, viewportWidth - EDGE - EDGE));
2635
+ const left = Math.max(EDGE, Math.min(frame.left, viewportWidth - width - EDGE));
2636
+ return { ...frame, width, left: frame.width >= width ? frame.left : left };
2637
+ }
2631
2638
  function DropdownSurface({ progress, translateY, anchorRef, onDismiss, closeLabel, closeHint, testID, children }) {
2632
- const { height: viewportHeight } = reactNative.useWindowDimensions();
2639
+ const { height: viewportHeight, width: viewportWidth } = reactNative.useWindowDimensions();
2633
2640
  const anchor = useAnchorRect2(anchorRef);
2634
2641
  const [panelHeight, setPanelHeight] = React2.useState(0);
2635
2642
  const onLayout = React2.useCallback((event) => setPanelHeight(event.nativeEvent.layout.height), []);
2636
- const frame = anchor === null ? null : dropdownFrame(anchor, panelHeight, viewportHeight);
2643
+ const frame = anchor === null ? null : fitDropdownWidth(dropdownFrame(anchor, panelHeight, viewportHeight), viewportWidth);
2637
2644
  const place = frame === null ? null : { left: frame.left, width: frame.width, top: frame.top, bottom: frame.bottom };
2638
2645
  return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.Modal, { transparent: true, visible: true, animationType: "none", onRequestClose: onDismiss, children: [
2639
2646
  /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { accessibilityHint: closeHint, accessibilityLabel: closeLabel, accessibilityRole: "button", style: reactNative.StyleSheet.absoluteFill, testID: `${testID}-backdrop`, onPress: onDismiss }),
@@ -2862,9 +2869,10 @@ function resolveSelectMotion(width, reducedMotion) {
2862
2869
  }
2863
2870
  var CHEVRON = "\u25BE";
2864
2871
  var VALUE_GAP = 8;
2872
+ var MIN_TOUCH = 44;
2865
2873
  var NOTHING_ON_CLOSE = () => void 0;
2866
2874
  function SearchSelect(props) {
2867
- const { options, value, onChange, accessibilityLabel, accessibilityHint, labels, testID, recentKey, renderLeading, renderDetail } = props;
2875
+ const { options, value, onChange, accessibilityLabel, accessibilityHint, labels, testID, recentKey, renderLeading, renderDetail, renderTrigger } = props;
2868
2876
  const { theme } = uiFeedback.useUi();
2869
2877
  const { colors } = theme;
2870
2878
  const triggerRef = React2.useRef(null);
@@ -2875,8 +2883,9 @@ function SearchSelect(props) {
2875
2883
  const state = useSearchSelectState(options, recents, onChange, NOTHING_ON_CLOSE);
2876
2884
  useRefocusOnClose(state.open, triggerRef);
2877
2885
  const selected = findOption(options, value);
2886
+ const onPress = state.open ? state.close : state.openList;
2878
2887
  return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { ref: anchorRef, style: styles23.anchor, children: [
2879
- /* @__PURE__ */ jsxRuntime.jsxs(
2888
+ /* @__PURE__ */ jsxRuntime.jsx(
2880
2889
  reactNative.Pressable,
2881
2890
  {
2882
2891
  ref: triggerRef,
@@ -2884,22 +2893,25 @@ function SearchSelect(props) {
2884
2893
  accessibilityLabel,
2885
2894
  accessibilityRole: "button",
2886
2895
  accessibilityState: { expanded: state.open },
2887
- style: [controlStyles.selectTrigger, { borderColor: colors.border, backgroundColor: colors.surfaceElevated }],
2896
+ style: renderTrigger === void 0 ? [controlStyles.selectTrigger, { borderColor: colors.border, backgroundColor: colors.surfaceElevated }] : styles23.customTrigger,
2888
2897
  testID,
2889
- onPress: state.open ? state.close : state.openList,
2890
- children: [
2891
- /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles23.value, children: [
2892
- selected !== null && renderLeading !== void 0 ? renderLeading(selected) : null,
2893
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [controlStyles.selectTriggerText, { color: selected === null ? colors.textSecondary : colors.text }], children: selected?.label ?? labels.placeholder }),
2894
- selected !== null ? /* @__PURE__ */ jsxRuntime.jsx(SelectedDetail, { colors, option: selected, renderDetail }) : null
2895
- ] }),
2896
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { "aria-hidden": true, style: [controlStyles.chevron, { color: colors.textSecondary }], children: CHEVRON })
2897
- ]
2898
+ onPress,
2899
+ children: renderTrigger !== void 0 ? renderTrigger({ open: state.open, selected, onPress, ref: triggerRef }) : /* @__PURE__ */ jsxRuntime.jsx(FieldBoxContent, { colors, placeholder: labels.placeholder, renderDetail, renderLeading, selected })
2898
2900
  }
2899
2901
  ),
2900
2902
  state.open ? /* @__PURE__ */ jsxRuntime.jsx(SearchSelectPanel, { anchorRef, labels, motion, renderDetail, renderLeading, selectedValue: value, state, testID }) : null
2901
2903
  ] });
2902
2904
  }
2905
+ function FieldBoxContent({ selected, placeholder, colors, renderLeading, renderDetail }) {
2906
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2907
+ /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles23.value, children: [
2908
+ selected !== null && renderLeading !== void 0 ? renderLeading(selected) : null,
2909
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [controlStyles.selectTriggerText, { color: selected === null ? colors.textSecondary : colors.text }], children: selected?.label ?? placeholder }),
2910
+ selected !== null ? /* @__PURE__ */ jsxRuntime.jsx(SelectedDetail, { colors, option: selected, renderDetail }) : null
2911
+ ] }),
2912
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { "aria-hidden": true, style: [controlStyles.chevron, { color: colors.textSecondary }], children: CHEVRON })
2913
+ ] });
2914
+ }
2903
2915
  function SelectedDetail({ option, colors, renderDetail }) {
2904
2916
  if (renderDetail !== void 0) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderDetail(option) });
2905
2917
  if (option.detail === void 0) return null;
@@ -2907,6 +2919,7 @@ function SelectedDetail({ option, colors, renderDetail }) {
2907
2919
  }
2908
2920
  var styles23 = reactNative.StyleSheet.create({
2909
2921
  anchor: { position: "relative" },
2922
+ customTrigger: { minHeight: MIN_TOUCH, minWidth: MIN_TOUCH, alignSelf: "flex-start", justifyContent: "center" },
2910
2923
  value: { flex: 1, flexDirection: "row", alignItems: "center", gap: VALUE_GAP }
2911
2924
  });
2912
2925
  function isContainer(node) {
@@ -3659,6 +3672,12 @@ var KNOWN_CODES = new Set(COUNTRIES.map((country) => country.code));
3659
3672
  function countryOptions(list = COUNTRIES) {
3660
3673
  return list.map((country) => ({ label: country.name, value: country.code, detail: country.code }));
3661
3674
  }
3675
+ var DEFAULT_OPTIONS = countryOptions();
3676
+ var NO_COUNTRY = "";
3677
+ function countryFieldOptions(countries, noneLabel) {
3678
+ const list = countries === void 0 ? DEFAULT_OPTIONS : countryOptions(countries);
3679
+ return noneLabel === void 0 ? list : [{ label: noneLabel, value: NO_COUNTRY }, ...list];
3680
+ }
3662
3681
  function countryFlag(code) {
3663
3682
  const upper = code.toUpperCase();
3664
3683
  if (!TWO_LETTERS.test(upper)) return "";
@@ -3669,12 +3688,12 @@ function toCountryValue(input) {
3669
3688
  return KNOWN_CODES.has(upper) ? upper : "";
3670
3689
  }
3671
3690
  var CODE_FONT = 12;
3672
- var DEFAULT_OPTIONS = countryOptions();
3673
- var renderFlag = (option) => /* @__PURE__ */ jsxRuntime.jsx(CountryFlag, { code: option.value });
3674
- function CountryField({ value, onChange, accessibilityLabel, accessibilityHint, labels, testID, countries }) {
3691
+ var NO_COUNTRY2 = "";
3692
+ var renderFlag = (option) => option.value === NO_COUNTRY2 ? null : /* @__PURE__ */ jsxRuntime.jsx(CountryFlag, { code: option.value });
3693
+ function CountryField({ value, onChange, accessibilityLabel, accessibilityHint, labels, testID, countries, noneLabel }) {
3675
3694
  const { theme } = uiFeedback.useUi();
3676
3695
  const { textSecondary } = theme.colors;
3677
- const options = React2.useMemo(() => countries === void 0 ? DEFAULT_OPTIONS : countryOptions(countries), [countries]);
3696
+ const options = React2.useMemo(() => countryFieldOptions(countries, noneLabel), [countries, noneLabel]);
3678
3697
  const renderCode = React2.useCallback((option) => /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles24.code, { color: textSecondary }], children: option.detail }), [textSecondary]);
3679
3698
  return /* @__PURE__ */ jsxRuntime.jsx(
3680
3699
  SearchSelect,
@@ -3957,7 +3976,7 @@ function rejectionMessage(rejection, none, labels) {
3957
3976
  if (labels === void 0 || rejection === null || rejection === none) return null;
3958
3977
  return labels[rejection];
3959
3978
  }
3960
- function IbanInput({ value, onChange, onVerdict, accessibilityLabel, accessibilityHint, testID, rejectionLabels, placeholder }) {
3979
+ function IbanInput({ value, onChange, onVerdict, accessibilityLabel, accessibilityHint, testID, rejectionLabels, placeholder, onBlur: onLeft }) {
3961
3980
  const { theme } = uiFeedback.useUi();
3962
3981
  const { colors } = theme;
3963
3982
  const draft = React2.useMemo(() => draftIban(value), [value]);
@@ -3975,7 +3994,8 @@ function IbanInput({ value, onChange, onVerdict, accessibilityLabel, accessibili
3975
3994
  const onBlur = React2.useCallback(() => {
3976
3995
  const verdict2 = onLeave();
3977
3996
  onVerdict?.(value === "" ? null : verdict2);
3978
- }, [onLeave, onVerdict, value]);
3997
+ onLeft?.();
3998
+ }, [onLeave, onVerdict, value, onLeft]);
3979
3999
  return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { children: [
3980
4000
  /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [controlStyles.selectTrigger, { borderColor: colors.border, backgroundColor: colors.surfaceElevated }], children: [
3981
4001
  /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: ghostStyles.field, children: [
@@ -4043,7 +4063,7 @@ function validateBic(raw) {
4043
4063
  if (RESERVED_LOCATION.includes(bic.charAt(LOCATION_INDEX))) return refused2("MalformedLocation" /* MalformedLocation */);
4044
4064
  return { rejection: "None" /* None */, electronic: bic };
4045
4065
  }
4046
- function BicInput({ value, onChange, onVerdict, accessibilityLabel, accessibilityHint, testID, rejectionLabels }) {
4066
+ function BicInput({ value, onChange, onVerdict, accessibilityLabel, accessibilityHint, testID, rejectionLabels, placeholder, onBlur: onLeft }) {
4047
4067
  const { theme } = uiFeedback.useUi();
4048
4068
  const { colors } = theme;
4049
4069
  const draft = React2.useMemo(() => draftBic(value), [value]);
@@ -4058,7 +4078,8 @@ function BicInput({ value, onChange, onVerdict, accessibilityLabel, accessibilit
4058
4078
  const onBlur = React2.useCallback(() => {
4059
4079
  const verdict2 = onLeave();
4060
4080
  onVerdict?.(value === "" ? null : verdict2);
4061
- }, [onLeave, onVerdict, value]);
4081
+ onLeft?.();
4082
+ }, [onLeave, onVerdict, value, onLeft]);
4062
4083
  return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { children: [
4063
4084
  /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [controlStyles.selectTrigger, { borderColor: colors.border, backgroundColor: colors.surfaceElevated }], children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: ghostStyles.field, children: [
4064
4085
  /* @__PURE__ */ jsxRuntime.jsxs(reactNative.Text, { "aria-hidden": true, style: [ghostStyles.mono, ghostStyles.layer], children: [
@@ -4074,6 +4095,8 @@ function BicInput({ value, onChange, onVerdict, accessibilityLabel, accessibilit
4074
4095
  autoCapitalize: "characters",
4075
4096
  autoComplete: "off",
4076
4097
  autoCorrect: false,
4098
+ placeholder: draft.value === "" ? placeholder : void 0,
4099
+ placeholderTextColor: colors.textSecondary,
4077
4100
  spellCheck: false,
4078
4101
  style: [ghostStyles.mono, ghostStyles.input, { color: colors.text }],
4079
4102
  testID,
@@ -4140,12 +4163,14 @@ exports.TypeaheadControl = TypeaheadControl;
4140
4163
  exports.UploadWithLinkField = UploadWithLinkField;
4141
4164
  exports.buildSearchSelectSections = buildSearchSelectSections;
4142
4165
  exports.controlStyles = controlStyles;
4166
+ exports.countryFieldOptions = countryFieldOptions;
4143
4167
  exports.countryFlag = countryFlag;
4144
4168
  exports.countryOptions = countryOptions;
4145
4169
  exports.draftBic = draftBic;
4146
4170
  exports.draftIban = draftIban;
4147
4171
  exports.dropdownFrame = dropdownFrame;
4148
4172
  exports.findOption = findOption;
4173
+ exports.fitDropdownWidth = fitDropdownWidth;
4149
4174
  exports.flagShapes = flagShapes;
4150
4175
  exports.groupAriaChecked = groupAriaChecked;
4151
4176
  exports.groupInFours = groupInFours;