@dloizides/ui-forms 1.36.0 → 1.38.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,10 @@ 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;
1319
+ onBlur?: () => void;
1311
1320
  }
1312
- /** A select you can type into to filter; the value is always a picked option, never typed text. */
1321
+ /** A select you can type into to filter; `renderTrigger` swaps the field box for your own visual; `onBlur` fires when focus leaves the closed field. */
1313
1322
  declare function SearchSelect(props: SearchSelectProps): React.ReactElement;
1314
1323
 
1315
1324
  /** How the option list opens: a sheet from below (phone) or a list unfolding under the field. */
@@ -1391,6 +1400,8 @@ interface DropdownFrame {
1391
1400
  declare function placeDropdown(anchor: AnchorRect, panelHeight: number, viewportHeight: number): DropdownPlacement;
1392
1401
  /** The window frame for the list next to `anchor`, on the side `placeDropdown` picks. */
1393
1402
  declare function dropdownFrame(anchor: AnchorRect, panelHeight: number, viewportHeight: number): DropdownFrame;
1403
+ /** Widens a narrow anchor's list to a readable width and keeps it inside the viewport. */
1404
+ declare function fitDropdownWidth(frame: DropdownFrame, viewportWidth: number): DropdownFrame;
1394
1405
 
1395
1406
  /** Focuses `ref` on the next tick, after the closing list surface has left the page. */
1396
1407
  declare function useDeferredFocus(ref: RefObject<{
@@ -1441,15 +1452,19 @@ interface CountryFieldProps {
1441
1452
  labels: SearchSelectLabels;
1442
1453
  testID: string;
1443
1454
  countries?: readonly Country[];
1455
+ noneLabel?: string;
1456
+ onBlur?: () => void;
1444
1457
  }
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;
1458
+ /** A searchable country field: flag, name and grey code; stores the ISO 3166-1 alpha-2 code, or '' for `noneLabel`; `onBlur` fires when focus leaves the closed field. */
1459
+ declare function CountryField({ value, onChange, accessibilityLabel, accessibilityHint, labels, testID, countries, noneLabel, onBlur }: CountryFieldProps): React.ReactElement;
1447
1460
 
1448
1461
  /** ISO 3166-1 alpha-2 countries (249) with English short names. */
1449
1462
  declare const COUNTRIES: readonly Country[];
1450
1463
 
1451
1464
  /** Countries as select options: name as the label, the 2-letter code as value and detail. */
1452
1465
  declare function countryOptions(list?: readonly Country[]): ControlOption[];
1466
+ /** The country options, led by a "no country" choice (value '') when `noneLabel` is given. */
1467
+ declare function countryFieldOptions(countries?: readonly Country[], noneLabel?: string): readonly ControlOption[];
1453
1468
  /** The flag emoji for a 2-letter code, or '' for anything else. */
1454
1469
  declare function countryFlag(code: string): string;
1455
1470
  /** The stored value for an input: a known 2-letter code in upper case, else ''. */
@@ -1497,11 +1512,12 @@ interface IbanInputProps {
1497
1512
  accessibilityLabel: string;
1498
1513
  accessibilityHint: string;
1499
1514
  testID: string;
1515
+ onBlur?: () => void;
1500
1516
  rejectionLabels?: IbanRejectionLabels;
1501
1517
  placeholder?: string;
1502
1518
  }
1503
1519
  /** 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;
1520
+ declare function IbanInput({ value, onChange, onVerdict, accessibilityLabel, accessibilityHint, testID, rejectionLabels, placeholder, onBlur: onLeft }: IbanInputProps): React.ReactElement;
1505
1521
 
1506
1522
  /** The outcome of validating one BIC; `electronic` (upper case, trimmed) is set only when valid. */
1507
1523
  interface BicVerdict {
@@ -1518,10 +1534,12 @@ interface BicInputProps {
1518
1534
  accessibilityLabel: string;
1519
1535
  accessibilityHint: string;
1520
1536
  testID: string;
1537
+ onBlur?: () => void;
1521
1538
  rejectionLabels?: BicRejectionLabels;
1539
+ placeholder?: string;
1522
1540
  }
1523
1541
  /** 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;
1542
+ declare function BicInput({ value, onChange, onVerdict, accessibilityLabel, accessibilityHint, testID, rejectionLabels, placeholder, onBlur: onLeft }: BicInputProps): React.ReactElement;
1525
1543
 
1526
1544
  /** The longest IBAN ISO 13616 permits. */
1527
1545
  declare const IBAN_MAX_LENGTH = 34;
@@ -1566,4 +1584,4 @@ declare function useBlurVerdict<T>(validate: () => T): BlurVerdict<T>;
1566
1584
  /** The pre-localized message for a refusal, or null when there is no verdict, it passed, or no labels were given. */
1567
1585
  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
1586
 
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 };
1587
+ 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,10 @@ 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;
1319
+ onBlur?: () => void;
1311
1320
  }
1312
- /** A select you can type into to filter; the value is always a picked option, never typed text. */
1321
+ /** A select you can type into to filter; `renderTrigger` swaps the field box for your own visual; `onBlur` fires when focus leaves the closed field. */
1313
1322
  declare function SearchSelect(props: SearchSelectProps): React.ReactElement;
1314
1323
 
1315
1324
  /** How the option list opens: a sheet from below (phone) or a list unfolding under the field. */
@@ -1391,6 +1400,8 @@ interface DropdownFrame {
1391
1400
  declare function placeDropdown(anchor: AnchorRect, panelHeight: number, viewportHeight: number): DropdownPlacement;
1392
1401
  /** The window frame for the list next to `anchor`, on the side `placeDropdown` picks. */
1393
1402
  declare function dropdownFrame(anchor: AnchorRect, panelHeight: number, viewportHeight: number): DropdownFrame;
1403
+ /** Widens a narrow anchor's list to a readable width and keeps it inside the viewport. */
1404
+ declare function fitDropdownWidth(frame: DropdownFrame, viewportWidth: number): DropdownFrame;
1394
1405
 
1395
1406
  /** Focuses `ref` on the next tick, after the closing list surface has left the page. */
1396
1407
  declare function useDeferredFocus(ref: RefObject<{
@@ -1441,15 +1452,19 @@ interface CountryFieldProps {
1441
1452
  labels: SearchSelectLabels;
1442
1453
  testID: string;
1443
1454
  countries?: readonly Country[];
1455
+ noneLabel?: string;
1456
+ onBlur?: () => void;
1444
1457
  }
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;
1458
+ /** A searchable country field: flag, name and grey code; stores the ISO 3166-1 alpha-2 code, or '' for `noneLabel`; `onBlur` fires when focus leaves the closed field. */
1459
+ declare function CountryField({ value, onChange, accessibilityLabel, accessibilityHint, labels, testID, countries, noneLabel, onBlur }: CountryFieldProps): React.ReactElement;
1447
1460
 
1448
1461
  /** ISO 3166-1 alpha-2 countries (249) with English short names. */
1449
1462
  declare const COUNTRIES: readonly Country[];
1450
1463
 
1451
1464
  /** Countries as select options: name as the label, the 2-letter code as value and detail. */
1452
1465
  declare function countryOptions(list?: readonly Country[]): ControlOption[];
1466
+ /** The country options, led by a "no country" choice (value '') when `noneLabel` is given. */
1467
+ declare function countryFieldOptions(countries?: readonly Country[], noneLabel?: string): readonly ControlOption[];
1453
1468
  /** The flag emoji for a 2-letter code, or '' for anything else. */
1454
1469
  declare function countryFlag(code: string): string;
1455
1470
  /** The stored value for an input: a known 2-letter code in upper case, else ''. */
@@ -1497,11 +1512,12 @@ interface IbanInputProps {
1497
1512
  accessibilityLabel: string;
1498
1513
  accessibilityHint: string;
1499
1514
  testID: string;
1515
+ onBlur?: () => void;
1500
1516
  rejectionLabels?: IbanRejectionLabels;
1501
1517
  placeholder?: string;
1502
1518
  }
1503
1519
  /** 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;
1520
+ declare function IbanInput({ value, onChange, onVerdict, accessibilityLabel, accessibilityHint, testID, rejectionLabels, placeholder, onBlur: onLeft }: IbanInputProps): React.ReactElement;
1505
1521
 
1506
1522
  /** The outcome of validating one BIC; `electronic` (upper case, trimmed) is set only when valid. */
1507
1523
  interface BicVerdict {
@@ -1518,10 +1534,12 @@ interface BicInputProps {
1518
1534
  accessibilityLabel: string;
1519
1535
  accessibilityHint: string;
1520
1536
  testID: string;
1537
+ onBlur?: () => void;
1521
1538
  rejectionLabels?: BicRejectionLabels;
1539
+ placeholder?: string;
1522
1540
  }
1523
1541
  /** 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;
1542
+ declare function BicInput({ value, onChange, onVerdict, accessibilityLabel, accessibilityHint, testID, rejectionLabels, placeholder, onBlur: onLeft }: BicInputProps): React.ReactElement;
1525
1543
 
1526
1544
  /** The longest IBAN ISO 13616 permits. */
1527
1545
  declare const IBAN_MAX_LENGTH = 34;
@@ -1566,4 +1584,4 @@ declare function useBlurVerdict<T>(validate: () => T): BlurVerdict<T>;
1566
1584
  /** The pre-localized message for a refusal, or null when there is no verdict, it passed, or no labels were given. */
1567
1585
  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
1586
 
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 };
1587
+ 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, onBlur } = props;
2868
2876
  const { theme } = uiFeedback.useUi();
2869
2877
  const { colors } = theme;
2870
2878
  const triggerRef = React2.useRef(null);
@@ -2875,8 +2883,14 @@ 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;
2887
+ const openRef = React2.useRef(state.open);
2888
+ openRef.current = state.open;
2889
+ const onTriggerBlur = React2.useCallback(() => {
2890
+ if (!openRef.current) onBlur?.();
2891
+ }, [onBlur]);
2878
2892
  return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { ref: anchorRef, style: styles23.anchor, children: [
2879
- /* @__PURE__ */ jsxRuntime.jsxs(
2893
+ /* @__PURE__ */ jsxRuntime.jsx(
2880
2894
  reactNative.Pressable,
2881
2895
  {
2882
2896
  ref: triggerRef,
@@ -2884,22 +2898,26 @@ function SearchSelect(props) {
2884
2898
  accessibilityLabel,
2885
2899
  accessibilityRole: "button",
2886
2900
  accessibilityState: { expanded: state.open },
2887
- style: [controlStyles.selectTrigger, { borderColor: colors.border, backgroundColor: colors.surfaceElevated }],
2901
+ style: renderTrigger === void 0 ? [controlStyles.selectTrigger, { borderColor: colors.border, backgroundColor: colors.surfaceElevated }] : styles23.customTrigger,
2888
2902
  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
- ]
2903
+ onBlur: onTriggerBlur,
2904
+ onPress,
2905
+ children: renderTrigger !== void 0 ? renderTrigger({ open: state.open, selected, onPress, ref: triggerRef }) : /* @__PURE__ */ jsxRuntime.jsx(FieldBoxContent, { colors, placeholder: labels.placeholder, renderDetail, renderLeading, selected })
2898
2906
  }
2899
2907
  ),
2900
2908
  state.open ? /* @__PURE__ */ jsxRuntime.jsx(SearchSelectPanel, { anchorRef, labels, motion, renderDetail, renderLeading, selectedValue: value, state, testID }) : null
2901
2909
  ] });
2902
2910
  }
2911
+ function FieldBoxContent({ selected, placeholder, colors, renderLeading, renderDetail }) {
2912
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2913
+ /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles23.value, children: [
2914
+ selected !== null && renderLeading !== void 0 ? renderLeading(selected) : null,
2915
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [controlStyles.selectTriggerText, { color: selected === null ? colors.textSecondary : colors.text }], children: selected?.label ?? placeholder }),
2916
+ selected !== null ? /* @__PURE__ */ jsxRuntime.jsx(SelectedDetail, { colors, option: selected, renderDetail }) : null
2917
+ ] }),
2918
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { "aria-hidden": true, style: [controlStyles.chevron, { color: colors.textSecondary }], children: CHEVRON })
2919
+ ] });
2920
+ }
2903
2921
  function SelectedDetail({ option, colors, renderDetail }) {
2904
2922
  if (renderDetail !== void 0) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderDetail(option) });
2905
2923
  if (option.detail === void 0) return null;
@@ -2907,6 +2925,7 @@ function SelectedDetail({ option, colors, renderDetail }) {
2907
2925
  }
2908
2926
  var styles23 = reactNative.StyleSheet.create({
2909
2927
  anchor: { position: "relative" },
2928
+ customTrigger: { minHeight: MIN_TOUCH, minWidth: MIN_TOUCH, alignSelf: "flex-start", justifyContent: "center" },
2910
2929
  value: { flex: 1, flexDirection: "row", alignItems: "center", gap: VALUE_GAP }
2911
2930
  });
2912
2931
  function isContainer(node) {
@@ -3659,6 +3678,12 @@ var KNOWN_CODES = new Set(COUNTRIES.map((country) => country.code));
3659
3678
  function countryOptions(list = COUNTRIES) {
3660
3679
  return list.map((country) => ({ label: country.name, value: country.code, detail: country.code }));
3661
3680
  }
3681
+ var DEFAULT_OPTIONS = countryOptions();
3682
+ var NO_COUNTRY = "";
3683
+ function countryFieldOptions(countries, noneLabel) {
3684
+ const list = countries === void 0 ? DEFAULT_OPTIONS : countryOptions(countries);
3685
+ return noneLabel === void 0 ? list : [{ label: noneLabel, value: NO_COUNTRY }, ...list];
3686
+ }
3662
3687
  function countryFlag(code) {
3663
3688
  const upper = code.toUpperCase();
3664
3689
  if (!TWO_LETTERS.test(upper)) return "";
@@ -3669,12 +3694,12 @@ function toCountryValue(input) {
3669
3694
  return KNOWN_CODES.has(upper) ? upper : "";
3670
3695
  }
3671
3696
  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 }) {
3697
+ var NO_COUNTRY2 = "";
3698
+ var renderFlag = (option) => option.value === NO_COUNTRY2 ? null : /* @__PURE__ */ jsxRuntime.jsx(CountryFlag, { code: option.value });
3699
+ function CountryField({ value, onChange, accessibilityLabel, accessibilityHint, labels, testID, countries, noneLabel, onBlur }) {
3675
3700
  const { theme } = uiFeedback.useUi();
3676
3701
  const { textSecondary } = theme.colors;
3677
- const options = React2.useMemo(() => countries === void 0 ? DEFAULT_OPTIONS : countryOptions(countries), [countries]);
3702
+ const options = React2.useMemo(() => countryFieldOptions(countries, noneLabel), [countries, noneLabel]);
3678
3703
  const renderCode = React2.useCallback((option) => /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles24.code, { color: textSecondary }], children: option.detail }), [textSecondary]);
3679
3704
  return /* @__PURE__ */ jsxRuntime.jsx(
3680
3705
  SearchSelect,
@@ -3688,6 +3713,7 @@ function CountryField({ value, onChange, accessibilityLabel, accessibilityHint,
3688
3713
  renderLeading: renderFlag,
3689
3714
  testID,
3690
3715
  value: toCountryValue(value),
3716
+ onBlur,
3691
3717
  onChange
3692
3718
  }
3693
3719
  );
@@ -3957,7 +3983,7 @@ function rejectionMessage(rejection, none, labels) {
3957
3983
  if (labels === void 0 || rejection === null || rejection === none) return null;
3958
3984
  return labels[rejection];
3959
3985
  }
3960
- function IbanInput({ value, onChange, onVerdict, accessibilityLabel, accessibilityHint, testID, rejectionLabels, placeholder }) {
3986
+ function IbanInput({ value, onChange, onVerdict, accessibilityLabel, accessibilityHint, testID, rejectionLabels, placeholder, onBlur: onLeft }) {
3961
3987
  const { theme } = uiFeedback.useUi();
3962
3988
  const { colors } = theme;
3963
3989
  const draft = React2.useMemo(() => draftIban(value), [value]);
@@ -3975,7 +4001,8 @@ function IbanInput({ value, onChange, onVerdict, accessibilityLabel, accessibili
3975
4001
  const onBlur = React2.useCallback(() => {
3976
4002
  const verdict2 = onLeave();
3977
4003
  onVerdict?.(value === "" ? null : verdict2);
3978
- }, [onLeave, onVerdict, value]);
4004
+ onLeft?.();
4005
+ }, [onLeave, onVerdict, value, onLeft]);
3979
4006
  return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { children: [
3980
4007
  /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [controlStyles.selectTrigger, { borderColor: colors.border, backgroundColor: colors.surfaceElevated }], children: [
3981
4008
  /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: ghostStyles.field, children: [
@@ -4043,7 +4070,7 @@ function validateBic(raw) {
4043
4070
  if (RESERVED_LOCATION.includes(bic.charAt(LOCATION_INDEX))) return refused2("MalformedLocation" /* MalformedLocation */);
4044
4071
  return { rejection: "None" /* None */, electronic: bic };
4045
4072
  }
4046
- function BicInput({ value, onChange, onVerdict, accessibilityLabel, accessibilityHint, testID, rejectionLabels }) {
4073
+ function BicInput({ value, onChange, onVerdict, accessibilityLabel, accessibilityHint, testID, rejectionLabels, placeholder, onBlur: onLeft }) {
4047
4074
  const { theme } = uiFeedback.useUi();
4048
4075
  const { colors } = theme;
4049
4076
  const draft = React2.useMemo(() => draftBic(value), [value]);
@@ -4058,7 +4085,8 @@ function BicInput({ value, onChange, onVerdict, accessibilityLabel, accessibilit
4058
4085
  const onBlur = React2.useCallback(() => {
4059
4086
  const verdict2 = onLeave();
4060
4087
  onVerdict?.(value === "" ? null : verdict2);
4061
- }, [onLeave, onVerdict, value]);
4088
+ onLeft?.();
4089
+ }, [onLeave, onVerdict, value, onLeft]);
4062
4090
  return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { children: [
4063
4091
  /* @__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
4092
  /* @__PURE__ */ jsxRuntime.jsxs(reactNative.Text, { "aria-hidden": true, style: [ghostStyles.mono, ghostStyles.layer], children: [
@@ -4074,6 +4102,8 @@ function BicInput({ value, onChange, onVerdict, accessibilityLabel, accessibilit
4074
4102
  autoCapitalize: "characters",
4075
4103
  autoComplete: "off",
4076
4104
  autoCorrect: false,
4105
+ placeholder: draft.value === "" ? placeholder : void 0,
4106
+ placeholderTextColor: colors.textSecondary,
4077
4107
  spellCheck: false,
4078
4108
  style: [ghostStyles.mono, ghostStyles.input, { color: colors.text }],
4079
4109
  testID,
@@ -4140,12 +4170,14 @@ exports.TypeaheadControl = TypeaheadControl;
4140
4170
  exports.UploadWithLinkField = UploadWithLinkField;
4141
4171
  exports.buildSearchSelectSections = buildSearchSelectSections;
4142
4172
  exports.controlStyles = controlStyles;
4173
+ exports.countryFieldOptions = countryFieldOptions;
4143
4174
  exports.countryFlag = countryFlag;
4144
4175
  exports.countryOptions = countryOptions;
4145
4176
  exports.draftBic = draftBic;
4146
4177
  exports.draftIban = draftIban;
4147
4178
  exports.dropdownFrame = dropdownFrame;
4148
4179
  exports.findOption = findOption;
4180
+ exports.fitDropdownWidth = fitDropdownWidth;
4149
4181
  exports.flagShapes = flagShapes;
4150
4182
  exports.groupAriaChecked = groupAriaChecked;
4151
4183
  exports.groupInFours = groupInFours;