@lumx/react 4.16.0-alpha.3 → 4.16.0-next.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/index.d.ts +18 -17
- package/index.js +43 -39
- package/index.js.map +1 -1
- package/package.json +3 -3
package/index.d.ts
CHANGED
|
@@ -4009,14 +4009,14 @@ declare const SelectMultipleField: React.FC<SelectMultipleProps>;
|
|
|
4009
4009
|
declare const SelectMultiple: Comp<SelectMultipleProps, HTMLDivElement>;
|
|
4010
4010
|
|
|
4011
4011
|
/**
|
|
4012
|
-
* Status of the
|
|
4012
|
+
* Status of the select dropdown list.
|
|
4013
4013
|
*
|
|
4014
4014
|
* - `'idle'` — Default state, no loading indicators.
|
|
4015
4015
|
* - `'loading'` — Full loading: shows skeleton placeholders, hides real options.
|
|
4016
4016
|
* - `'loadingMore'` — Paginated loading: appends a skeleton after existing options.
|
|
4017
4017
|
* - `'error'` — Error state: shows an error message in the dropdown.
|
|
4018
4018
|
*/
|
|
4019
|
-
type
|
|
4019
|
+
type SelectListStatus = 'idle' | 'loading' | 'loadingMore' | 'error';
|
|
4020
4020
|
/**
|
|
4021
4021
|
* Context passed to the `renderOption` callback alongside the option object.
|
|
4022
4022
|
* Contains core-computed values that the consumer should forward to `<Combobox.Option>`.
|
|
@@ -4061,13 +4061,13 @@ interface BaseSelectProps<O> {
|
|
|
4061
4061
|
* section id are grouped together. The id is also used as the default displayed
|
|
4062
4062
|
* label unless `renderSectionTitle` is provided.
|
|
4063
4063
|
*/
|
|
4064
|
-
getSectionId?: Selector<O, string>;
|
|
4064
|
+
getSectionId?: Selector<O, string | undefined>;
|
|
4065
4065
|
/**
|
|
4066
4066
|
* Custom section title render function. Receives the section id and the options
|
|
4067
4067
|
* in that section. Returns custom JSX to display as the section header.
|
|
4068
4068
|
* When not provided, the section id is used as a plain text label.
|
|
4069
4069
|
*/
|
|
4070
|
-
renderSectionTitle?: (sectionId: string, options: O[]) => JSXElement;
|
|
4070
|
+
renderSectionTitle?: (sectionId: string | undefined, options: O[]) => JSXElement;
|
|
4071
4071
|
}
|
|
4072
4072
|
/**
|
|
4073
4073
|
* Shared translation labels for SelectTextField wrappers (React and Vue).
|
|
@@ -4138,7 +4138,7 @@ interface BaseSelectTextFieldWrapperProps<O> extends Pick<BaseSelectProps<O>, 'o
|
|
|
4138
4138
|
* Status of the dropdown list.
|
|
4139
4139
|
* @default 'idle'
|
|
4140
4140
|
*/
|
|
4141
|
-
listStatus?:
|
|
4141
|
+
listStatus?: SelectListStatus;
|
|
4142
4142
|
/**
|
|
4143
4143
|
* Controls how the combobox filters options as the user types.
|
|
4144
4144
|
*
|
|
@@ -4246,7 +4246,7 @@ interface SelectButtonProps$1<O> extends BaseSelectProps<O> {
|
|
|
4246
4246
|
* - `'error'` — Error state: shows an error message in the dropdown.
|
|
4247
4247
|
* @default 'idle'
|
|
4248
4248
|
*/
|
|
4249
|
-
listStatus?:
|
|
4249
|
+
listStatus?: SelectListStatus;
|
|
4250
4250
|
/** Optional translations for screen-reader announcements (loading/empty/error/option count). */
|
|
4251
4251
|
translations?: SelectButtonTranslations;
|
|
4252
4252
|
/** Callback fired when the dropdown open state changes. */
|
|
@@ -4281,7 +4281,7 @@ type SelectButtonSelectProps<O> = Omit<ReactToJSX<SelectButtonProps$1<O>>, 'rend
|
|
|
4281
4281
|
* Forwarded trigger props for a given element `E`, minus the keys that the
|
|
4282
4282
|
* component manages internally.
|
|
4283
4283
|
*/
|
|
4284
|
-
type TriggerProps<E extends ElementType$1> = Omit<NamedProps<React__default.
|
|
4284
|
+
type TriggerProps<E extends ElementType$1> = Omit<NamedProps<React__default.ComponentProps<E>>, OmittedKeys>;
|
|
4285
4285
|
/**
|
|
4286
4286
|
* Common base — Select-specific props plus the ARIA / label / popover layer.
|
|
4287
4287
|
* `as`, `ref`, `selectionType`, `value`, `onChange` are intentionally hoisted
|
|
@@ -4299,7 +4299,7 @@ type CommonSelectButtonProps<O> = SelectButtonSelectProps<O> & GenericProps$1 &
|
|
|
4299
4299
|
* Status of the dropdown list (loading, error, etc.).
|
|
4300
4300
|
* @default 'idle'
|
|
4301
4301
|
*/
|
|
4302
|
-
listStatus?:
|
|
4302
|
+
listStatus?: SelectListStatus;
|
|
4303
4303
|
/** Screen-reader translations (loading/empty/error/option count). */
|
|
4304
4304
|
translations?: SelectButtonTranslations;
|
|
4305
4305
|
};
|
|
@@ -4313,8 +4313,8 @@ type CommonSelectButtonProps<O> = SelectButtonSelectProps<O> & GenericProps$1 &
|
|
|
4313
4313
|
* fully replaced and only props valid for that component apply.
|
|
4314
4314
|
*
|
|
4315
4315
|
* Discriminated on `selectionType`:
|
|
4316
|
-
* - default / `'single'` → `value?: O`, `onChange?: (newValue
|
|
4317
|
-
* - `'multiple'` → `value?: O[]`, `onChange?: (newValue
|
|
4316
|
+
* - default / `'single'` → `value?: O`, `onChange?: (newValue: O) => void`.
|
|
4317
|
+
* - `'multiple'` → `value?: O[]`, `onChange?: (newValue: O[]) => void`.
|
|
4318
4318
|
*
|
|
4319
4319
|
* `as` and `selectionType` are top-level on this type (rather than buried in
|
|
4320
4320
|
* an intersection or union member) so that TS can infer `E` from `as` and
|
|
@@ -4338,15 +4338,16 @@ type SelectButtonProps<O, E extends ElementType$1 = typeof DefaultButton, S exte
|
|
|
4338
4338
|
/** Selected option(s). Shape depends on `selectionType`. */
|
|
4339
4339
|
value?: S extends 'multiple' ? O[] : O;
|
|
4340
4340
|
/** Called when the selection changes. Shape depends on `selectionType`. */
|
|
4341
|
-
onChange?: S extends 'multiple' ? (newValue
|
|
4341
|
+
onChange?: S extends 'multiple' ? (newValue: O[]) => void : (newValue: O) => void;
|
|
4342
4342
|
};
|
|
4343
4343
|
/**
|
|
4344
4344
|
* Single-selection props (`selectionType` defaults to `'single'`).
|
|
4345
|
-
* Backwards-compatible alias — existing consumers do not need to set `selectionType`.
|
|
4346
4345
|
*/
|
|
4347
|
-
type SingleSelectButtonProps<O, E extends ElementType$1 = typeof DefaultButton> = SelectButtonProps<O, E, 'single'
|
|
4348
|
-
/**
|
|
4349
|
-
|
|
4346
|
+
type SingleSelectButtonProps<O, E extends ElementType$1 = typeof DefaultButton> = NamedProps<SelectButtonProps<O, E, 'single'>>;
|
|
4347
|
+
/**
|
|
4348
|
+
* Multi-selection props (`selectionType: 'multiple'` is required to opt in).
|
|
4349
|
+
*/
|
|
4350
|
+
type MultipleSelectButtonProps<O, E extends ElementType$1 = typeof DefaultButton> = NamedProps<SelectButtonProps<O, E, 'multiple'>>;
|
|
4350
4351
|
|
|
4351
4352
|
/**
|
|
4352
4353
|
* SelectButton compound component.
|
|
@@ -4371,7 +4372,7 @@ interface BaseSelectTextFieldProps<O = any> extends BaseSelectTextFieldWrapperPr
|
|
|
4371
4372
|
* in that section. Returns custom JSX to display as the section header.
|
|
4372
4373
|
* When not provided, the section id is used as a plain text label.
|
|
4373
4374
|
*/
|
|
4374
|
-
renderSectionTitle?: (sectionId: string, options: O[]) => React__default.ReactNode;
|
|
4375
|
+
renderSectionTitle?: (sectionId: string | undefined, options: O[]) => React__default.ReactNode;
|
|
4375
4376
|
/**
|
|
4376
4377
|
* Callback fired when the search input text changes.
|
|
4377
4378
|
* Independent of `filter`: both can be used together (e.g. client-side
|
|
@@ -5607,4 +5608,4 @@ declare const ThemeProvider: React__default.FC<{
|
|
|
5607
5608
|
declare function useTheme(): ThemeContextValue;
|
|
5608
5609
|
|
|
5609
5610
|
export { AlertDialog, Autocomplete, AutocompleteMultiple, Avatar, Badge, BadgeWrapper, Button, ButtonEmphasis, ButtonGroup, CLASSNAME$1 as CLASSNAME, COMPONENT_NAME$1 as COMPONENT_NAME, Checkbox, Chip, ChipGroup, Combobox, CommentBlock, CommentBlockVariant, DEFAULT_PROPS, DatePicker, DatePickerControlled, DatePickerField, Dialog, Divider, DragHandle, Dropdown, ExpansionPanel, Flag, FlexBox, GenericBlock, GenericBlockGapSize, Grid, GridColumn, GridItem, Heading, HeadingLevelProvider, Icon, IconButton, ImageBlock, ImageBlockCaptionPosition, ImageLightbox, InlineList, InputHelper, InputLabel, Lightbox, Link, LinkPreview, List, ListDivider, ListItem, ListSection, ListSubheader, Message, Mosaic, Navigation, Notification, Placement, Popover, PopoverDialog, PostBlock, Progress, ProgressCircular, ProgressLinear, ProgressTracker, ProgressTrackerProvider, ProgressTrackerStep, ProgressTrackerStepPanel, ProgressVariant, RadioButton, RadioGroup, RawInputText, RawInputTextarea, Select, SelectButton, SelectMultiple, SelectMultipleField, SelectTextField, SelectVariant, SelectionChipGroup, SideNavigation, SideNavigationItem, SkeletonCircle, SkeletonRectangle, SkeletonRectangleVariant, SkeletonTypography, Slider, Slides, Slideshow, SlideshowControls, SlideshowItem, Switch, CLASSNAME as TIME_PICKER_FIELD_CLASSNAME, COMPONENT_NAME as TIME_PICKER_FIELD_COMPONENT_NAME, Tab, TabList, TabListLayout, TabPanel, TabProvider, Table, TableBody, TableCell, TableCellVariant, TableCellVariant as TableCellVariantType, TableHeader, TableRow, Text, TextField, ThOrder, ThOrder as ThOrderType, ThemeProvider, Thumbnail, ThumbnailAspectRatio, ThumbnailObjectFit, ThumbnailVariant, TimePickerField, Toolbar, Tooltip, Uploader, UploaderVariant, UserBlock, clamp, useFocusPointStyle, useHeadingLevel, useTheme };
|
|
5610
|
-
export type { AlertDialogProps, AutocompleteMultipleProps, AutocompleteProps, AvatarProps, AvatarSize, BadgeProps, BadgeWrapperProps, BaseButtonProps, ButtonGroupProps, ButtonProps, ButtonSize, CheckboxProps, ChipGroupProps, ChipProps, ComboboxButtonProps, ComboboxInputProps, ComboboxListProps, ComboboxOptionActionProps, ComboboxOptionMoreInfoProps, ComboboxOptionProps, ComboboxOptionSkeletonProps, ComboboxPopoverComponentProps, ComboboxPopoverProps, ComboboxProviderProps, ComboboxSectionProps, ComboboxStateProps, CommentBlockProps, DatePickerControlledProps, DatePickerFieldProps, DatePickerProps, DialogProps, DialogSizes, DividerProps, DragHandleProps, DropdownProps, Elevation, ExpansionPanelProps, FlagProps, FlexBoxProps, FlexHorizontalAlignment, FlexVerticalAlignment, FocusPoint, GapSize, GenericBlockProps, GenericBlockSectionProps, GridColumnGapSize, GridColumnProps, GridItemProps, GridProps, HeadingLevelProviderProps, HeadingProps, IconButtonProps, IconProps, IconSizes, ImageBlockProps, ImageBlockSize, ImageLightboxProps, InlineListProps, InputHelperProps, InputLabelProps, LightboxProps, LinkPreviewProps, LinkProps, ListDividerProps, ListItemProps, ListItemSize, ListProps, ListSectionProps, ListSubheaderProps, MarginAutoAlignment, MessageProps, MosaicProps, MultipleSelectButtonProps, MultipleSelectTextFieldProps, NavigationProps, NotificationProps, Offset, PopoverDialogProps, PopoverProps, PostBlockProps, ProgressCircularProps, ProgressCircularSize, ProgressLinearProps, ProgressProps, ProgressTrackerProps, ProgressTrackerProviderProps, ProgressTrackerStepPanelProps, ProgressTrackerStepProps, RadioButtonProps, RadioGroupProps, RawInputTextProps, RawInputTextareaProps, SelectButtonProps, SelectButtonTranslations, SelectMultipleProps, SelectProps, SelectTextFieldProps, SelectTextFieldStatus, SelectTextFieldTranslations, SelectionChipGroupProps, SideNavigationItemProps, SideNavigationProps, SingleSelectButtonProps, SingleSelectTextFieldProps, SkeletonCircleProps, SkeletonRectangleProps, SkeletonTypographyProps, SliderProps, SlidesProps, SlideshowControlsProps, SlideshowItemProps, SlideshowProps, SwitchProps, TabListProps, TabPanelProps, TabProps, TabProviderProps, TableBodyProps, TableCellProps, TableHeaderProps, TableProps, TableRowProps, TextFieldProps, TextProps, ThumbnailProps, ThumbnailSize, TimePickerFieldProps, ToolbarProps, TooltipPlacement, TooltipProps, UploaderProps, UploaderSize, UserBlockProps, UserBlockSize };
|
|
5611
|
+
export type { AlertDialogProps, AutocompleteMultipleProps, AutocompleteProps, AvatarProps, AvatarSize, BadgeProps, BadgeWrapperProps, BaseButtonProps, ButtonGroupProps, ButtonProps, ButtonSize, CheckboxProps, ChipGroupProps, ChipProps, ComboboxButtonProps, ComboboxInputProps, ComboboxListProps, ComboboxOptionActionProps, ComboboxOptionMoreInfoProps, ComboboxOptionProps, ComboboxOptionSkeletonProps, ComboboxPopoverComponentProps, ComboboxPopoverProps, ComboboxProviderProps, ComboboxSectionProps, ComboboxStateProps, CommentBlockProps, DatePickerControlledProps, DatePickerFieldProps, DatePickerProps, DialogProps, DialogSizes, DividerProps, DragHandleProps, DropdownProps, Elevation, ExpansionPanelProps, FlagProps, FlexBoxProps, FlexHorizontalAlignment, FlexVerticalAlignment, FocusPoint, GapSize, GenericBlockProps, GenericBlockSectionProps, GridColumnGapSize, GridColumnProps, GridItemProps, GridProps, HeadingLevelProviderProps, HeadingProps, IconButtonProps, IconProps, IconSizes, ImageBlockProps, ImageBlockSize, ImageLightboxProps, InlineListProps, InputHelperProps, InputLabelProps, LightboxProps, LinkPreviewProps, LinkProps, ListDividerProps, ListItemProps, ListItemSize, ListProps, ListSectionProps, ListSubheaderProps, MarginAutoAlignment, MessageProps, MosaicProps, MultipleSelectButtonProps, MultipleSelectTextFieldProps, NavigationProps, NotificationProps, Offset, PopoverDialogProps, PopoverProps, PostBlockProps, ProgressCircularProps, ProgressCircularSize, ProgressLinearProps, ProgressProps, ProgressTrackerProps, ProgressTrackerProviderProps, ProgressTrackerStepPanelProps, ProgressTrackerStepProps, RadioButtonProps, RadioGroupProps, RawInputTextProps, RawInputTextareaProps, SelectButtonProps, SelectListStatus as SelectButtonStatus, SelectButtonTranslations, SelectListStatus, SelectMultipleProps, SelectProps, SelectTextFieldProps, SelectListStatus as SelectTextFieldStatus, SelectTextFieldTranslations, SelectionChipGroupProps, SideNavigationItemProps, SideNavigationProps, SingleSelectButtonProps, SingleSelectTextFieldProps, SkeletonCircleProps, SkeletonRectangleProps, SkeletonTypographyProps, SliderProps, SlidesProps, SlideshowControlsProps, SlideshowItemProps, SlideshowProps, SwitchProps, TabListProps, TabPanelProps, TabProps, TabProviderProps, TableBodyProps, TableCellProps, TableHeaderProps, TableProps, TableRowProps, TextFieldProps, TextProps, ThumbnailProps, ThumbnailSize, TimePickerFieldProps, ToolbarProps, TooltipPlacement, TooltipProps, UploaderProps, UploaderSize, UserBlockProps, UserBlockSize };
|
package/index.js
CHANGED
|
@@ -1687,7 +1687,7 @@ const IconButton$1 = props => {
|
|
|
1687
1687
|
size = DEFAULT_PROPS$1a.size,
|
|
1688
1688
|
...forwardedProps
|
|
1689
1689
|
} = props;
|
|
1690
|
-
const
|
|
1690
|
+
const defaultChildren = image ? /*#__PURE__*/jsx("img", {
|
|
1691
1691
|
// no need to set alt as an aria-label is already set on the button
|
|
1692
1692
|
alt: "",
|
|
1693
1693
|
src: image
|
|
@@ -1700,12 +1700,7 @@ const IconButton$1 = props => {
|
|
|
1700
1700
|
...forwardedProps,
|
|
1701
1701
|
'aria-label': label,
|
|
1702
1702
|
variant: 'icon',
|
|
1703
|
-
children:
|
|
1704
|
-
children: [iconNode, /*#__PURE__*/jsx("span", {
|
|
1705
|
-
className: visuallyHidden(),
|
|
1706
|
-
children: label
|
|
1707
|
-
})]
|
|
1708
|
-
})
|
|
1703
|
+
children: defaultChildren
|
|
1709
1704
|
});
|
|
1710
1705
|
};
|
|
1711
1706
|
IconButton$1.displayName = COMPONENT_NAME$1r;
|
|
@@ -7116,6 +7111,12 @@ function setupComboboxButton(button, callbacks) {
|
|
|
7116
7111
|
return true;
|
|
7117
7112
|
}
|
|
7118
7113
|
return false;
|
|
7114
|
+
case 'Escape':
|
|
7115
|
+
// Close if open; never clear selection (button-mode has no text input).
|
|
7116
|
+
if (combobox.isOpen) {
|
|
7117
|
+
combobox.setIsOpen(false);
|
|
7118
|
+
}
|
|
7119
|
+
return true;
|
|
7119
7120
|
default:
|
|
7120
7121
|
// Printable characters → typeahead.
|
|
7121
7122
|
if (isPrintableKey(event)) {
|
|
@@ -7286,9 +7287,10 @@ const ComboboxButton = Object.assign(forwardRefPolymorphic((props, ref) => {
|
|
|
7286
7287
|
|
|
7287
7288
|
// If `as` is provided, use it directly; otherwise use the LumX Button (full theme/disabled behavior).
|
|
7288
7289
|
const ButtonComp = as ?? Button;
|
|
7289
|
-
|
|
7290
|
-
//
|
|
7291
|
-
const
|
|
7290
|
+
|
|
7291
|
+
// Track the button DOM element via state (instead of useRef) so it re-triggers the useEffect
|
|
7292
|
+
const [buttonElement, setButtonElement] = useState(null);
|
|
7293
|
+
const mergedRef = useMergeRefs(ref, setButtonElement, anchorRef);
|
|
7292
7294
|
|
|
7293
7295
|
// Keep onSelect in a ref to avoid re-creating the handle on every render
|
|
7294
7296
|
const onSelectRef = useRef(onSelect);
|
|
@@ -7296,9 +7298,8 @@ const ComboboxButton = Object.assign(forwardRefPolymorphic((props, ref) => {
|
|
|
7296
7298
|
|
|
7297
7299
|
// Create the combobox handle with button-mode controller on mount
|
|
7298
7300
|
useEffect(() => {
|
|
7299
|
-
|
|
7300
|
-
|
|
7301
|
-
const handle = setupComboboxButton(button, {
|
|
7301
|
+
if (!buttonElement) return undefined;
|
|
7302
|
+
const handle = setupComboboxButton(buttonElement, {
|
|
7302
7303
|
onSelect(option) {
|
|
7303
7304
|
onSelectRef.current?.(option);
|
|
7304
7305
|
}
|
|
@@ -7308,7 +7309,7 @@ const ComboboxButton = Object.assign(forwardRefPolymorphic((props, ref) => {
|
|
|
7308
7309
|
handle.destroy();
|
|
7309
7310
|
setHandle(null);
|
|
7310
7311
|
};
|
|
7311
|
-
}, [setHandle]);
|
|
7312
|
+
}, [buttonElement, setHandle]);
|
|
7312
7313
|
return ComboboxButton$1({
|
|
7313
7314
|
...buttonProps,
|
|
7314
7315
|
label,
|
|
@@ -16825,6 +16826,24 @@ function toggleSelection(options, getOptionId, currentValue, selectedOptionId, i
|
|
|
16825
16826
|
return updated;
|
|
16826
16827
|
}
|
|
16827
16828
|
|
|
16829
|
+
/**
|
|
16830
|
+
* Get the display name for a single option value.
|
|
16831
|
+
*
|
|
16832
|
+
* Resolves the option's display name by trying `getOptionName` first,
|
|
16833
|
+
* then falling back to `getOptionId`, returning `''` for nullish values.
|
|
16834
|
+
*/
|
|
16835
|
+
function getOptionDisplayName(value, getOptionName, getOptionId) {
|
|
16836
|
+
if (value === undefined || value === null) return '';
|
|
16837
|
+
if (getOptionName) {
|
|
16838
|
+
const name = getWithSelector(getOptionName, value);
|
|
16839
|
+
if (name != null) return String(name);
|
|
16840
|
+
}
|
|
16841
|
+
if (getOptionId) {
|
|
16842
|
+
return String(getWithSelector(getOptionId, value));
|
|
16843
|
+
}
|
|
16844
|
+
return '';
|
|
16845
|
+
}
|
|
16846
|
+
|
|
16828
16847
|
/**
|
|
16829
16848
|
* Render options as ComboboxOption elements.
|
|
16830
16849
|
* Framework-specific components are passed as a second argument.
|
|
@@ -16949,7 +16968,7 @@ const SelectButton$2 = (props, {
|
|
|
16949
16968
|
* each option to its name and join with `, `. Falsy entries (undefined, empty names)
|
|
16950
16969
|
* are filtered out so partial state still renders cleanly.
|
|
16951
16970
|
*/
|
|
16952
|
-
const displayValue = value != null ? castArray(value).map(v => v
|
|
16971
|
+
const displayValue = value != null ? castArray(value).map(v => getOptionDisplayName(v, getOptionName, getOptionId)).filter(Boolean).join(', ') : '';
|
|
16953
16972
|
return /*#__PURE__*/jsxs(Combobox.Provider, {
|
|
16954
16973
|
onOpen: onOpen,
|
|
16955
16974
|
children: [/*#__PURE__*/jsx(Combobox.Button, {
|
|
@@ -17078,8 +17097,8 @@ const DefaultButton = forwardRef((props, ref) => /*#__PURE__*/jsx(Button, {
|
|
|
17078
17097
|
* fully replaced and only props valid for that component apply.
|
|
17079
17098
|
*
|
|
17080
17099
|
* Discriminated on `selectionType`:
|
|
17081
|
-
* - default / `'single'` → `value?: O`, `onChange?: (newValue
|
|
17082
|
-
* - `'multiple'` → `value?: O[]`, `onChange?: (newValue
|
|
17100
|
+
* - default / `'single'` → `value?: O`, `onChange?: (newValue: O) => void`.
|
|
17101
|
+
* - `'multiple'` → `value?: O[]`, `onChange?: (newValue: O[]) => void`.
|
|
17083
17102
|
*
|
|
17084
17103
|
* `as` and `selectionType` are top-level on this type (rather than buried in
|
|
17085
17104
|
* an intersection or union member) so that TS can infer `E` from `as` and
|
|
@@ -17092,10 +17111,11 @@ const DefaultButton = forwardRef((props, ref) => /*#__PURE__*/jsx(Button, {
|
|
|
17092
17111
|
|
|
17093
17112
|
/**
|
|
17094
17113
|
* Single-selection props (`selectionType` defaults to `'single'`).
|
|
17095
|
-
* Backwards-compatible alias — existing consumers do not need to set `selectionType`.
|
|
17096
17114
|
*/
|
|
17097
17115
|
|
|
17098
|
-
/**
|
|
17116
|
+
/**
|
|
17117
|
+
* Multi-selection props (`selectionType: 'multiple'` is required to opt in).
|
|
17118
|
+
*/
|
|
17099
17119
|
|
|
17100
17120
|
/**
|
|
17101
17121
|
* `React.forwardRef` re-typed to preserve our polymorphic generics
|
|
@@ -17139,6 +17159,9 @@ const SelectButton$1 = React__default.forwardRef((props, ref) => {
|
|
|
17139
17159
|
const next = toggleSelection(options, getOptionId, value, selectedOption?.value, isMultiple);
|
|
17140
17160
|
onChange?.(next);
|
|
17141
17161
|
}, [getOptionId, isMultiple, onChange, options, value]);
|
|
17162
|
+
|
|
17163
|
+
// If as is defined and not the Button, render as, else render DefaultButton (with mdiMenuDown right icon)
|
|
17164
|
+
const buttonAs = as && as !== Button ? as : DefaultButton;
|
|
17142
17165
|
return SelectButton$2({
|
|
17143
17166
|
options,
|
|
17144
17167
|
getOptionId,
|
|
@@ -17151,10 +17174,9 @@ const SelectButton$1 = React__default.forwardRef((props, ref) => {
|
|
|
17151
17174
|
isMultiselectable: isMultiple,
|
|
17152
17175
|
label,
|
|
17153
17176
|
labelDisplayMode,
|
|
17154
|
-
// With no `as`, the default trigger adds the chevron.
|
|
17155
17177
|
buttonProps: {
|
|
17156
17178
|
...buttonProps,
|
|
17157
|
-
as:
|
|
17179
|
+
as: buttonAs,
|
|
17158
17180
|
ref
|
|
17159
17181
|
},
|
|
17160
17182
|
popoverProps,
|
|
@@ -17185,24 +17207,6 @@ const SelectButton = Object.assign(SelectButton$1, {
|
|
|
17185
17207
|
Option: ComboboxOption
|
|
17186
17208
|
});
|
|
17187
17209
|
|
|
17188
|
-
/**
|
|
17189
|
-
* Get the display name for a single option value.
|
|
17190
|
-
*
|
|
17191
|
-
* Resolves the option's display name by trying `getOptionName` first,
|
|
17192
|
-
* then falling back to `getOptionId`, returning `''` for nullish values.
|
|
17193
|
-
*/
|
|
17194
|
-
function getOptionDisplayName(value, getOptionName, getOptionId) {
|
|
17195
|
-
if (value === undefined || value === null) return '';
|
|
17196
|
-
if (getOptionName) {
|
|
17197
|
-
const name = getWithSelector(getOptionName, value);
|
|
17198
|
-
if (name != null) return String(name);
|
|
17199
|
-
}
|
|
17200
|
-
if (getOptionId) {
|
|
17201
|
-
return String(getWithSelector(getOptionId, value));
|
|
17202
|
-
}
|
|
17203
|
-
return '';
|
|
17204
|
-
}
|
|
17205
|
-
|
|
17206
17210
|
/**
|
|
17207
17211
|
* Component display name.
|
|
17208
17212
|
*/
|