@dloizides/ui-forms 1.38.0 → 1.39.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/dist/index.d.mts CHANGED
@@ -300,6 +300,51 @@ interface InlineFieldRowLayout {
300
300
  /** Field and action share one row only at `inlineMinWidth` and wider; below it they stack. */
301
301
  declare function inlineFieldRowLayout(windowWidth: number, fieldMaxWidth: number, inlineMinWidth?: number): InlineFieldRowLayout;
302
302
 
303
+ interface LineItemColumn {
304
+ key: string;
305
+ label: string;
306
+ flex?: number;
307
+ }
308
+ interface LineItemCell<T> {
309
+ item: T;
310
+ index: number;
311
+ columnKey: string;
312
+ wide: boolean;
313
+ }
314
+ interface LineItemsLabels {
315
+ add: string;
316
+ addHint: string;
317
+ remove: (lineNumber: number) => string;
318
+ removeHint: string;
319
+ }
320
+ interface LineItemsProps<T> {
321
+ items: readonly T[];
322
+ getKey: (item: T, index: number) => string;
323
+ columns: readonly LineItemColumn[];
324
+ renderCell: (cell: LineItemCell<T>) => React.ReactNode;
325
+ lineLabel: (lineNumber: number) => string;
326
+ labels: LineItemsLabels;
327
+ testID: string;
328
+ renderLineHeader?: (item: T, index: number) => React.ReactNode;
329
+ onAdd?: () => void;
330
+ onRemove?: (index: number) => void;
331
+ minItems?: number;
332
+ wideMinWidth?: number;
333
+ }
334
+
335
+ /** Repeating lines as labelled cards: stacked cells on phones, one row under column headers shown once when wide. */
336
+ declare function LineItems<T>({ items, getKey, columns, renderCell, lineLabel, labels, testID, renderLineHeader, onAdd, onRemove, minItems, wideMinWidth, }: LineItemsProps<T>): React.ReactElement;
337
+
338
+ declare const LINE_ITEMS_WIDE_MIN_WIDTH = 1280;
339
+ /** True when the window is wide enough for column headers shown once above the lines. */
340
+ declare function isLineItemsWide(width: number, wideMinWidth?: number): boolean;
341
+ /** True when a line may be removed without going below `minItems`. */
342
+ declare function canRemoveLine(count: number, minItems?: number): boolean;
343
+ /** The 1-based number a reader sees for the line at `index`. */
344
+ declare function lineNumberOf(index: number): number;
345
+ /** The share of the row a column takes on the wide layout. */
346
+ declare function lineItemColumnFlex(column: LineItemColumn): number;
347
+
303
348
  interface FormStackProps {
304
349
  children: React.ReactNode;
305
350
  gap?: number;
@@ -1584,4 +1629,4 @@ declare function useBlurVerdict<T>(validate: () => T): BlurVerdict<T>;
1584
1629
  /** The pre-localized message for a refusal, or null when there is no verdict, it passed, or no labels were given. */
1585
1630
  declare function rejectionMessage<R extends string, N extends R>(rejection: R | null, none: N, labels: Readonly<Record<Exclude<R, N>, string>> | undefined): string | null;
1586
1631
 
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 };
1632
+ 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, LINE_ITEMS_WIDE_MIN_WIDTH, type LineItemCell, type LineItemColumn, LineItems, type LineItemsLabels, type LineItemsProps, 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, canRemoveLine, controlStyles, countryFieldOptions, countryFlag, countryOptions, draftBic, draftIban, dropdownFrame, findOption, fitDropdownWidth, flagShapes, groupAriaChecked, groupInFours, highlightAfterQuery, ibanCounter, ibanLengthFor, inlineFieldRowLayout, isAddOnOpen, isFallbackFlag, isFixBarVisible, isLineItemsWide, isOutside, isUnmatched, isWideFormLayout, lineItemColumnFlex, lineNumberOf, 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
@@ -300,6 +300,51 @@ interface InlineFieldRowLayout {
300
300
  /** Field and action share one row only at `inlineMinWidth` and wider; below it they stack. */
301
301
  declare function inlineFieldRowLayout(windowWidth: number, fieldMaxWidth: number, inlineMinWidth?: number): InlineFieldRowLayout;
302
302
 
303
+ interface LineItemColumn {
304
+ key: string;
305
+ label: string;
306
+ flex?: number;
307
+ }
308
+ interface LineItemCell<T> {
309
+ item: T;
310
+ index: number;
311
+ columnKey: string;
312
+ wide: boolean;
313
+ }
314
+ interface LineItemsLabels {
315
+ add: string;
316
+ addHint: string;
317
+ remove: (lineNumber: number) => string;
318
+ removeHint: string;
319
+ }
320
+ interface LineItemsProps<T> {
321
+ items: readonly T[];
322
+ getKey: (item: T, index: number) => string;
323
+ columns: readonly LineItemColumn[];
324
+ renderCell: (cell: LineItemCell<T>) => React.ReactNode;
325
+ lineLabel: (lineNumber: number) => string;
326
+ labels: LineItemsLabels;
327
+ testID: string;
328
+ renderLineHeader?: (item: T, index: number) => React.ReactNode;
329
+ onAdd?: () => void;
330
+ onRemove?: (index: number) => void;
331
+ minItems?: number;
332
+ wideMinWidth?: number;
333
+ }
334
+
335
+ /** Repeating lines as labelled cards: stacked cells on phones, one row under column headers shown once when wide. */
336
+ declare function LineItems<T>({ items, getKey, columns, renderCell, lineLabel, labels, testID, renderLineHeader, onAdd, onRemove, minItems, wideMinWidth, }: LineItemsProps<T>): React.ReactElement;
337
+
338
+ declare const LINE_ITEMS_WIDE_MIN_WIDTH = 1280;
339
+ /** True when the window is wide enough for column headers shown once above the lines. */
340
+ declare function isLineItemsWide(width: number, wideMinWidth?: number): boolean;
341
+ /** True when a line may be removed without going below `minItems`. */
342
+ declare function canRemoveLine(count: number, minItems?: number): boolean;
343
+ /** The 1-based number a reader sees for the line at `index`. */
344
+ declare function lineNumberOf(index: number): number;
345
+ /** The share of the row a column takes on the wide layout. */
346
+ declare function lineItemColumnFlex(column: LineItemColumn): number;
347
+
303
348
  interface FormStackProps {
304
349
  children: React.ReactNode;
305
350
  gap?: number;
@@ -1584,4 +1629,4 @@ declare function useBlurVerdict<T>(validate: () => T): BlurVerdict<T>;
1584
1629
  /** The pre-localized message for a refusal, or null when there is no verdict, it passed, or no labels were given. */
1585
1630
  declare function rejectionMessage<R extends string, N extends R>(rejection: R | null, none: N, labels: Readonly<Record<Exclude<R, N>, string>> | undefined): string | null;
1586
1631
 
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 };
1632
+ 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, LINE_ITEMS_WIDE_MIN_WIDTH, type LineItemCell, type LineItemColumn, LineItems, type LineItemsLabels, type LineItemsProps, 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, canRemoveLine, controlStyles, countryFieldOptions, countryFlag, countryOptions, draftBic, draftIban, dropdownFrame, findOption, fitDropdownWidth, flagShapes, groupAriaChecked, groupInFours, highlightAfterQuery, ibanCounter, ibanLengthFor, inlineFieldRowLayout, isAddOnOpen, isFallbackFlag, isFixBarVisible, isLineItemsWide, isOutside, isUnmatched, isWideFormLayout, lineItemColumnFlex, lineNumberOf, moveHighlight, nextHighlight, placeDropdown, rejectionMessage, resolveGroupSelection, resolveSelectMotion, resolveStepNeighbours, suggestOptions, toCountryValue, toggleGroupSelection, useBlurVerdict, useDeferredFocus, useFocusFirstInvalid, useKeepInView, useOutsidePress, useRecentValues, useReducedMotion, useSearchSelectState, useThemedInput, validateBic, validateIban };