widenarrow-ui 2.4.3 → 2.4.6

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
@@ -680,6 +680,12 @@ interface OptionItem {
680
680
  * reported as a string instead, so a numeric `value` comes back as e.g. `'2'`.
681
681
  */
682
682
  value: string | number;
683
+ /**
684
+ * Context shown after `text` on the same line, in a lighter colour, e.g. where a topic sits in a taxonomy.
685
+ * Matched by the Combobox's default filter. Not shown in pills or in the field, which show `text` only.
686
+ * With `nativeHtmlComponent`, shown in parentheses after `text`.
687
+ */
688
+ secondaryText?: string;
683
689
  /** Renders the option but prevents it from being picked. @default false */
684
690
  disabled?: boolean;
685
691
  /**
@@ -687,6 +693,30 @@ interface OptionItem {
687
693
  * `nativeHtmlComponent`.
688
694
  */
689
695
  description?: string;
696
+ /**
697
+ * Icon before the text. In a Combobox with `multiple`, also shown on the option's pill. Not shown
698
+ * in the field of a single value, nor with `nativeHtmlComponent`.
699
+ */
700
+ leftIcon?: IconTypes;
701
+ /**
702
+ * Component before the text, e.g. an avatar or a logo. Shown in the list in place of `leftIcon`,
703
+ * while pills keep showing `leftIcon`. It doesn't make the option higher, so keep it to the size of an
704
+ * icon (24px). Not shown with `nativeHtmlComponent`.
705
+ */
706
+ leftComponent?: ReactNode;
707
+ /**
708
+ * Component after the text, e.g. status icons or an avatar. It doesn't make the option higher, so keep
709
+ * it to the size of an icon (24px). Must not contain buttons or links, as a click anywhere on the option
710
+ * picks it. Not shown with `nativeHtmlComponent`.
711
+ */
712
+ rightComponent?: ReactNode;
713
+ /**
714
+ * Heading of the group the option belongs to, e.g. `'Favorites'`. Options next to each other with
715
+ * the same `group` are listed under one heading, so keep each group's options together and put
716
+ * options without a group first. Rendered as an `<optgroup>` with `nativeHtmlComponent`. Values must
717
+ * be unique across groups.
718
+ */
719
+ group?: string;
690
720
  }
691
721
  interface SelectInputProps {
692
722
  /** Options to choose from, in display order. */
@@ -728,14 +758,13 @@ interface SelectInputProps {
728
758
  * @default false
729
759
  */
730
760
  nativeHtmlComponent?: boolean;
731
- /** Size from the smallest breakpoint up. @default SizeTypes.MEDIUM */
761
+ /** Size of the field, and of the list unless `listSize` is set. @default SizeTypes.MEDIUM */
732
762
  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;
763
+ /**
764
+ * Size of the options in the list, when it should differ from the field's. Without it the list follows
765
+ * `size`, with medium options for a large field.
766
+ */
767
+ listSize?: SizeTypes.SMALL | SizeTypes.MEDIUM;
739
768
  /** Adds bottom spacing, for stacking fields in a form. @default false */
740
769
  marginBottom?: boolean;
741
770
  /** Focus the select on mount. @default false */
@@ -750,38 +779,29 @@ interface SelectInputProps {
750
779
  className?: string;
751
780
  /** Class name of the button that opens the list, or of the `<select>` with `nativeHtmlComponent`. */
752
781
  inputClassName?: string;
753
- /** @deprecated Not used by the component. */
754
- text?: string;
755
782
  }
756
783
 
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
784
  type ComboboxValue = string | number;
785
+ /** Accessible names of the Combobox's buttons, e.g. to translate them. */
786
+ interface ComboboxAriaLabels {
787
+ /** The button that clears the value. @default 'Clear' */
788
+ clearButton?: string;
789
+ /** The button that opens and closes the list. @default 'Show options' */
790
+ toggleButton?: string;
791
+ /** The remove button on each pill, with `multiple`. Also its tooltip. @default 'Remove' */
792
+ removePillButton?: string;
793
+ }
766
794
  interface ComboboxBaseProps {
767
- /** Options to choose from, in display order. Filtered by the typed text, unless `filterOptions` is false. */
795
+ /**
796
+ * Options to choose from, in display order. Filtered by the typed text, unless `filterOptions` is
797
+ * false. An option's `leftIcon` is also shown on its pill with `multiple`.
798
+ */
768
799
  options: Array<OptionItem>;
769
800
  /**
770
801
  * The options of the selected values, for their labels while they are not among `options`, e.g. a
771
802
  * saved value before its page of options is fetched, or a value picked from an earlier search.
772
803
  */
773
804
  selectedOptions?: Array<OptionItem>;
774
- /**
775
- * Text in the input, to control it. Without it the Combobox keeps the text itself. When controlled,
776
- * update it from `onInputChange`.
777
- */
778
- inputValue?: string;
779
- /**
780
- * Called when the text in the input changes, with the reason. To fetch options for what the user
781
- * types, use `onSearchChange` instead: the text of a `'reset'` is the selected option's label, which
782
- * isn't a search.
783
- */
784
- onInputChange?: (inputValue: string, reason: ComboboxInputChangeReason) => void;
785
805
  /**
786
806
  * Called with the text to search for: what the user types, and `''` when the search ends, which is when
787
807
  * an option is picked, the value is cleared or the field is left. Use it to fetch options per search,
@@ -790,8 +810,8 @@ interface ComboboxBaseProps {
790
810
  */
791
811
  onSearchChange?: (searchText: string) => void;
792
812
  /**
793
- * Filters the options by the typed text. By default an option is shown when its `text` contains the
794
- * typed text, ignoring case. Pass `false` when the options are already filtered, e.g. fetched for the
813
+ * Filters the options by the typed text. By default an option is shown when its `text` or
814
+ * `secondaryText` contains the typed text, ignoring case. Pass `false` when the options are already filtered, e.g. fetched for the
795
815
  * typed text from a server, with `onSearchChange`.
796
816
  */
797
817
  filterOptions?: ((options: OptionItem[], inputValue: string) => OptionItem[]) | false;
@@ -835,23 +855,20 @@ interface ComboboxBaseProps {
835
855
  * all text in the input. Without it, a value can only be replaced by another. @default true
836
856
  */
837
857
  withClearButton?: boolean;
838
- /** Accessible name of the clear button. @default 'Clear' */
839
- clearButtonAriaLabel?: string;
840
- /** Accessible name of the button that opens and closes the list. @default 'Show options' */
841
- toggleButtonAriaLabel?: string;
858
+ /** Accessible names of the clear, toggle and pill remove buttons, e.g. to translate them. */
859
+ ariaLabels?: ComboboxAriaLabels;
842
860
  /**
843
861
  * Colours the input like a Button of that type, e.g. to use the Combobox as a picker in a toolbar.
844
862
  * The list is not affected. Without it, the input looks like the other form fields.
845
863
  */
846
864
  type?: HierarchyTypes.PRIMARY | HierarchyTypes.SECONDARY;
847
- /** Size from the smallest breakpoint up. @default SizeTypes.MEDIUM */
865
+ /** Size of the field, and of the list unless `listSize` is set. @default SizeTypes.MEDIUM */
848
866
  size?: SizeTypes.SMALL | SizeTypes.MEDIUM | SizeTypes.LARGE;
849
- /** Size from the `$md` breakpoint up, overriding `size`. */
850
- sizeMd?: SizeTypes.SMALL | SizeTypes.MEDIUM | SizeTypes.LARGE;
851
- /** Size from the `$lg` breakpoint up, overriding `size` and `sizeMd`. */
852
- sizeLg?: SizeTypes.SMALL | SizeTypes.MEDIUM | SizeTypes.LARGE;
853
- /** Size from the `$xl` breakpoint up, overriding the smaller sizes. */
854
- sizeXl?: SizeTypes.SMALL | SizeTypes.MEDIUM | SizeTypes.LARGE;
867
+ /**
868
+ * Size of the options in the list, when it should differ from the field's. Without it the list follows
869
+ * `size`, with medium options for a large field.
870
+ */
871
+ listSize?: SizeTypes.SMALL | SizeTypes.MEDIUM;
855
872
  /** Adds bottom spacing, for stacking fields in a form. @default false */
856
873
  marginBottom?: boolean;
857
874
  /** Focus the input on mount. @default false */
@@ -866,6 +883,8 @@ interface ComboboxBaseProps {
866
883
  className?: string;
867
884
  /** Class name of the `<input>`. */
868
885
  inputClassName?: string;
886
+ /** Class name of the field around the input and the pills, e.g. to attach another element to it. */
887
+ fieldClassName?: string;
869
888
  }
870
889
  interface ComboboxSingleProps extends ComboboxBaseProps {
871
890
  /**
@@ -899,8 +918,6 @@ interface ComboboxMultipleProps extends ComboboxBaseProps {
899
918
  onChange: (value: Array<ComboboxValue>) => void;
900
919
  /** Only with `multiple`: pills shown in the field. The rest are behind a "+ N" button that lists them, as in BadgeList. @default 5 */
901
920
  maxVisiblePills?: number;
902
- /** Only with `multiple`: accessible name and tooltip of a pill's remove button. @default 'Remove' */
903
- removePillAriaLabel?: string;
904
921
  }
905
922
  type ComboboxProps = ComboboxSingleProps | ComboboxMultipleProps;
906
923
 
@@ -1111,8 +1128,8 @@ interface DropDownItemProps {
1111
1128
  */
1112
1129
  active?: boolean;
1113
1130
  /**
1114
- * Where the check mark of an `active` item goes. On the right it matches the option lists of SelectInput
1115
- * and Combobox, and the left is free for `leftIcon`.
1131
+ * Where the check mark of an `active` item goes. Keep it on the left in menus that pick one option, as
1132
+ * SelectInput does, and put it on the right in menus that pick several, as a Combobox with `multiple` does.
1116
1133
  * @default 'left'
1117
1134
  */
1118
1135
  activeIconPosition?: 'left' | 'right';
@@ -1138,10 +1155,6 @@ interface DropDownItemProps {
1138
1155
  iconClassName?: string;
1139
1156
  /** @default true */
1140
1157
  closeDropDownOnClick?: boolean;
1141
- descriptionColor?: Partial<ColorTypes>;
1142
- descriptionTextAlign?: TypographyTextAlign;
1143
- descriptionFontSize?: TypographyFontSize;
1144
- descriptionFontWeight?: TypographyFontWeight;
1145
1158
  descriptionClassName?: string;
1146
1159
  descriptionContainerClassName?: string;
1147
1160
  }
@@ -2097,7 +2110,7 @@ declare const TabGroup: {
2097
2110
  };
2098
2111
 
2099
2112
  declare const SelectInput: {
2100
- ({ 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;
2113
+ ({ label, withLabel, inputRef, nativeHtmlComponent, size, listSize, ariaLabel, id, onChange, defaultOption, value, error, autoFocus, helperText, options, disabled, loading, name, className, inputClassName, marginBottom }: SelectInputProps): JSX.Element;
2101
2114
  displayName: string;
2102
2115
  };
2103
2116
 
@@ -2192,4 +2205,4 @@ declare const NoDataMessage: {
2192
2205
  displayName: string;
2193
2206
  };
2194
2207
 
2195
- 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 };
2208
+ 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 };