widenarrow-ui 2.4.2 → 2.4.5

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/lib/index.d.ts CHANGED
@@ -687,6 +687,30 @@ interface OptionItem {
687
687
  * `nativeHtmlComponent`.
688
688
  */
689
689
  description?: string;
690
+ /**
691
+ * Icon before the text. In a Combobox with `multiple`, also shown on the option's pill. Not shown
692
+ * in the field of a single value, nor with `nativeHtmlComponent`.
693
+ */
694
+ leftIcon?: IconTypes;
695
+ /**
696
+ * Component before the text, e.g. an avatar or a logo. Shown in the list in place of `leftIcon`,
697
+ * while pills keep showing `leftIcon`. It doesn't make the option higher, so keep it to the size of an
698
+ * icon (24px). Not shown with `nativeHtmlComponent`.
699
+ */
700
+ leftComponent?: ReactNode;
701
+ /**
702
+ * Component after the text, e.g. status icons or an avatar. It doesn't make the option higher, so keep
703
+ * it to the size of an icon (24px). Must not contain buttons or links, as a click anywhere on the option
704
+ * picks it. Not shown with `nativeHtmlComponent`.
705
+ */
706
+ rightComponent?: ReactNode;
707
+ /**
708
+ * Heading of the group the option belongs to, e.g. `'Favorites'`. Options next to each other with
709
+ * the same `group` are listed under one heading, so keep each group's options together and put
710
+ * options without a group first. Rendered as an `<optgroup>` with `nativeHtmlComponent`. Values must
711
+ * be unique across groups.
712
+ */
713
+ group?: string;
690
714
  }
691
715
  interface SelectInputProps {
692
716
  /** Options to choose from, in display order. */
@@ -730,12 +754,6 @@ interface SelectInputProps {
730
754
  nativeHtmlComponent?: boolean;
731
755
  /** Size from the smallest breakpoint up. @default SizeTypes.MEDIUM */
732
756
  size?: SizeTypes.SMALL | SizeTypes.MEDIUM | SizeTypes.LARGE;
733
- /** Size from the `$md` breakpoint up, overriding `size`. */
734
- sizeMd?: SizeTypes.SMALL | SizeTypes.MEDIUM | SizeTypes.LARGE;
735
- /** Size from the `$lg` breakpoint up, overriding `size` and `sizeMd`. */
736
- sizeLg?: SizeTypes.SMALL | SizeTypes.MEDIUM | SizeTypes.LARGE;
737
- /** Size from the `$xl` breakpoint up, overriding the smaller sizes. */
738
- sizeXl?: SizeTypes.SMALL | SizeTypes.MEDIUM | SizeTypes.LARGE;
739
757
  /** Adds bottom spacing, for stacking fields in a form. @default false */
740
758
  marginBottom?: boolean;
741
759
  /** Focus the select on mount. @default false */
@@ -750,21 +768,23 @@ interface SelectInputProps {
750
768
  className?: string;
751
769
  /** Class name of the button that opens the list, or of the `<select>` with `nativeHtmlComponent`. */
752
770
  inputClassName?: string;
753
- /** @deprecated Not used by the component. */
754
- text?: string;
755
771
  }
756
772
 
757
- /** Why the text in the Combobox's input changed. */
758
- type ComboboxInputChangeReason =
759
- /** The user typed. */
760
- 'input'
761
- /** The text was set back to the selected option's label, e.g. after picking an option or leaving the field. */
762
- | 'reset'
763
- /** The clear button was used. */
764
- | 'clear';
765
773
  type ComboboxValue = string | number;
774
+ /** Accessible names of the Combobox's buttons, e.g. to translate them. */
775
+ interface ComboboxAriaLabels {
776
+ /** The button that clears the value. @default 'Clear' */
777
+ clearButton?: string;
778
+ /** The button that opens and closes the list. @default 'Show options' */
779
+ toggleButton?: string;
780
+ /** The remove button on each pill, with `multiple`. Also its tooltip. @default 'Remove' */
781
+ removePillButton?: string;
782
+ }
766
783
  interface ComboboxBaseProps {
767
- /** Options to choose from, in display order. Filtered by the typed text, unless `filterOptions` is false. */
784
+ /**
785
+ * Options to choose from, in display order. Filtered by the typed text, unless `filterOptions` is
786
+ * false. An option's `leftIcon` is also shown on its pill with `multiple`.
787
+ */
768
788
  options: Array<OptionItem>;
769
789
  /**
770
790
  * The options of the selected values, for their labels while they are not among `options`, e.g. a
@@ -772,19 +792,16 @@ interface ComboboxBaseProps {
772
792
  */
773
793
  selectedOptions?: Array<OptionItem>;
774
794
  /**
775
- * Text in the input, to control it, e.g. to fetch options for it. Without it the Combobox keeps the
776
- * text itself. When controlled, update it from `onInputChange`.
777
- */
778
- inputValue?: string;
779
- /**
780
- * Called when the text in the input changes. Fetch new options for reason `'input'` only: `'reset'`
781
- * and `'clear'` set the text to the selected option's label or empty it.
795
+ * Called with the text to search for: what the user types, and `''` when the search ends, which is when
796
+ * an option is picked, the value is cleared or the field is left. Use it to fetch options per search,
797
+ * together with `filterOptions={false}`. Going back to `''` brings back the initial options, so the list
798
+ * doesn't stay filtered by an old search the next time it opens.
782
799
  */
783
- onInputChange?: (inputValue: string, reason: ComboboxInputChangeReason) => void;
800
+ onSearchChange?: (searchText: string) => void;
784
801
  /**
785
802
  * Filters the options by the typed text. By default an option is shown when its `text` contains the
786
803
  * typed text, ignoring case. Pass `false` when the options are already filtered, e.g. fetched for the
787
- * typed text from a server.
804
+ * typed text from a server, with `onSearchChange`.
788
805
  */
789
806
  filterOptions?: ((options: OptionItem[], inputValue: string) => OptionItem[]) | false;
790
807
  /** Visible label, associated with the input. Also its accessible name unless `ariaLabel` is set. */
@@ -827,23 +844,15 @@ interface ComboboxBaseProps {
827
844
  * all text in the input. Without it, a value can only be replaced by another. @default true
828
845
  */
829
846
  withClearButton?: boolean;
830
- /** Accessible name of the clear button. @default 'Clear' */
831
- clearButtonAriaLabel?: string;
832
- /** Accessible name of the button that opens and closes the list. @default 'Show options' */
833
- toggleButtonAriaLabel?: string;
847
+ /** Accessible names of the clear, toggle and pill remove buttons, e.g. to translate them. */
848
+ ariaLabels?: ComboboxAriaLabels;
834
849
  /**
835
850
  * Colours the input like a Button of that type, e.g. to use the Combobox as a picker in a toolbar.
836
851
  * The list is not affected. Without it, the input looks like the other form fields.
837
852
  */
838
853
  type?: HierarchyTypes.PRIMARY | HierarchyTypes.SECONDARY;
839
- /** Size from the smallest breakpoint up. @default SizeTypes.MEDIUM */
854
+ /** @default SizeTypes.MEDIUM */
840
855
  size?: SizeTypes.SMALL | SizeTypes.MEDIUM | SizeTypes.LARGE;
841
- /** Size from the `$md` breakpoint up, overriding `size`. */
842
- sizeMd?: SizeTypes.SMALL | SizeTypes.MEDIUM | SizeTypes.LARGE;
843
- /** Size from the `$lg` breakpoint up, overriding `size` and `sizeMd`. */
844
- sizeLg?: SizeTypes.SMALL | SizeTypes.MEDIUM | SizeTypes.LARGE;
845
- /** Size from the `$xl` breakpoint up, overriding the smaller sizes. */
846
- sizeXl?: SizeTypes.SMALL | SizeTypes.MEDIUM | SizeTypes.LARGE;
847
856
  /** Adds bottom spacing, for stacking fields in a form. @default false */
848
857
  marginBottom?: boolean;
849
858
  /** Focus the input on mount. @default false */
@@ -891,8 +900,6 @@ interface ComboboxMultipleProps extends ComboboxBaseProps {
891
900
  onChange: (value: Array<ComboboxValue>) => void;
892
901
  /** Only with `multiple`: pills shown in the field. The rest are behind a "+ N" button that lists them, as in BadgeList. @default 5 */
893
902
  maxVisiblePills?: number;
894
- /** Only with `multiple`: accessible name and tooltip of a pill's remove button. @default 'Remove' */
895
- removePillAriaLabel?: string;
896
903
  }
897
904
  type ComboboxProps = ComboboxSingleProps | ComboboxMultipleProps;
898
905
 
@@ -1103,8 +1110,8 @@ interface DropDownItemProps {
1103
1110
  */
1104
1111
  active?: boolean;
1105
1112
  /**
1106
- * Where the check mark of an `active` item goes. On the right it matches the option lists of SelectInput
1107
- * and Combobox, and the left is free for `leftIcon`.
1113
+ * Where the check mark of an `active` item goes. Keep it on the left in menus that pick one option, as
1114
+ * SelectInput does, and put it on the right in menus that pick several, as a Combobox with `multiple` does.
1108
1115
  * @default 'left'
1109
1116
  */
1110
1117
  activeIconPosition?: 'left' | 'right';
@@ -1130,10 +1137,6 @@ interface DropDownItemProps {
1130
1137
  iconClassName?: string;
1131
1138
  /** @default true */
1132
1139
  closeDropDownOnClick?: boolean;
1133
- descriptionColor?: Partial<ColorTypes>;
1134
- descriptionTextAlign?: TypographyTextAlign;
1135
- descriptionFontSize?: TypographyFontSize;
1136
- descriptionFontWeight?: TypographyFontWeight;
1137
1140
  descriptionClassName?: string;
1138
1141
  descriptionContainerClassName?: string;
1139
1142
  }
@@ -2089,7 +2092,7 @@ declare const TabGroup: {
2089
2092
  };
2090
2093
 
2091
2094
  declare const SelectInput: {
2092
- ({ label, withLabel, inputRef, nativeHtmlComponent, size, sizeMd, sizeLg, sizeXl, ariaLabel, id, onChange, defaultOption, value, error, autoFocus, helperText, options, disabled, loading, name, className, inputClassName, marginBottom }: SelectInputProps): JSX.Element;
2095
+ ({ label, withLabel, inputRef, nativeHtmlComponent, size, ariaLabel, id, onChange, defaultOption, value, error, autoFocus, helperText, options, disabled, loading, name, className, inputClassName, marginBottom }: SelectInputProps): JSX.Element;
2093
2096
  displayName: string;
2094
2097
  };
2095
2098
 
@@ -2184,4 +2187,4 @@ declare const NoDataMessage: {
2184
2187
  displayName: string;
2185
2188
  };
2186
2189
 
2187
- export { AnimatedCount, AnimatedCountProps, AppColors, AspectRatioTypes, Badge, BadgeItem, BadgeList, BadgeListProps, BadgeProps, BadgeTypes, BorderInterface, Box, Button, Card, Checkbox, ColorStyleInterface, ColorTypes, Combobox, ComboboxInputChangeReason, ComboboxMultipleProps, ComboboxProps, ComboboxSingleProps, ComboboxValue, DropDown, DropDownItem, DropDownProps, DropDownRef, FacetButton, FlexStylingInterface, FontFamilyTypes, FormSkeleton, Grid, Heading, HierarchyInterface, HierarchyTypes, Icon, IconButton, IconStyleInterface, IconTypes, Image, InlineButton, Input, Label, Link, LinkTypes, ListButton, ListButtonProps, ListItem, ListSkeleton, MarginInterface, MultiActionButton, NoDataMessage, NumberBadge, NumberBadgeProps, PaddingInterface, Pagination, Paragraph, RadioButton, SelectInput, OptionItem as SelectInputOptionItem, SelectInputProps, Separator, SizeStyleInterface, SizeTypes, SkeletonItem, SolidSpinner, SortableTable, SortableTableCellInterface, SortableTableProps, Span, SwitchButton, Tab, TabGroup, TabGroupProps, TabIndicatorProps, TabProps, TabValue, TableTypes, TextAreaInput, ToolTip, borderClassNames, flexClassNames, marginClassNames, paddingClassNames };
2190
+ export { AnimatedCount, AnimatedCountProps, AppColors, AspectRatioTypes, Badge, BadgeItem, BadgeList, BadgeListProps, BadgeProps, BadgeTypes, BorderInterface, Box, Button, Card, Checkbox, ColorStyleInterface, ColorTypes, Combobox, ComboboxAriaLabels, ComboboxMultipleProps, ComboboxProps, ComboboxSingleProps, ComboboxValue, DropDown, DropDownItem, DropDownProps, DropDownRef, FacetButton, FlexStylingInterface, FontFamilyTypes, FormSkeleton, Grid, Heading, HierarchyInterface, HierarchyTypes, Icon, IconButton, IconStyleInterface, IconTypes, Image, InlineButton, Input, Label, Link, LinkTypes, ListButton, ListButtonProps, ListItem, ListSkeleton, MarginInterface, MultiActionButton, NoDataMessage, NumberBadge, NumberBadgeProps, PaddingInterface, Pagination, Paragraph, RadioButton, SelectInput, OptionItem as SelectInputOptionItem, SelectInputProps, Separator, SizeStyleInterface, SizeTypes, SkeletonItem, SolidSpinner, SortableTable, SortableTableCellInterface, SortableTableProps, Span, SwitchButton, Tab, TabGroup, TabGroupProps, TabIndicatorProps, TabProps, TabValue, TableTypes, TextAreaInput, ToolTip, borderClassNames, flexClassNames, marginClassNames, paddingClassNames };