@lumx/react 4.12.1-next.2 → 4.13.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.
Files changed (4) hide show
  1. package/index.d.ts +183 -3
  2. package/index.js +787 -476
  3. package/index.js.map +1 -1
  4. package/package.json +4 -4
package/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { HorizontalAlignment as HorizontalAlignment$1, Orientation as Orientation$1, Alignment as Alignment$1, Size as Size$1, AspectRatio as AspectRatio$1, Kind as Kind$1, Emphasis as Emphasis$1, Theme as Theme$1 } from '@lumx/core/js/constants';
2
2
  export * from '@lumx/core/js/constants';
3
3
  import * as _lumx_core_js_types from '@lumx/core/js/types';
4
- import { ValueOf as ValueOf$1, GenericProps as GenericProps$1, HasTheme as HasTheme$1, PropsToOverride, HasAriaDisabled as HasAriaDisabled$1, HasRequiredLinkHref as HasRequiredLinkHref$1, HasClassName as HasClassName$1, HasCloseMode as HasCloseMode$1, JSXElement as JSXElement$1, CommonRef as CommonRef$1, Falsy, HeadingElement as HeadingElement$1, HasAriaLabelOrLabelledBy as HasAriaLabelOrLabelledBy$1 } from '@lumx/core/js/types';
4
+ import { ValueOf as ValueOf$1, GenericProps as GenericProps$1, HasTheme as HasTheme$1, PropsToOverride, HasAriaDisabled as HasAriaDisabled$1, HasRequiredLinkHref as HasRequiredLinkHref$1, HasClassName as HasClassName$1, HasCloseMode as HasCloseMode$1, JSXElement as JSXElement$1, CommonRef as CommonRef$1, Falsy, HeadingElement as HeadingElement$1, HasAriaLabelOrLabelledBy as HasAriaLabelOrLabelledBy$1, NamedProps } from '@lumx/core/js/types';
5
5
  export * from '@lumx/core/js/types';
6
6
  import * as React$1 from 'react';
7
7
  import React__default, { Ref, ReactElement, ReactNode, SyntheticEvent, MouseEventHandler, KeyboardEventHandler, RefObject, SetStateAction, Key, CSSProperties, ElementType as ElementType$1, HTMLInputTypeAttribute, ComponentProps, ImgHTMLAttributes } from 'react';
@@ -2098,6 +2098,8 @@ interface ComboboxButtonProps$1 extends HasClassName, ComboboxCallbacks {
2098
2098
  isOpen?: boolean;
2099
2099
  /** ref to the root button element. */
2100
2100
  ref?: CommonRef;
2101
+ /** Custom render button */
2102
+ renderButton?: (buttonProps: Record<string, any>) => JSXElement;
2101
2103
  }
2102
2104
 
2103
2105
  /**
@@ -4092,6 +4094,30 @@ interface SelectTextFieldTranslations {
4092
4094
  /** Secondary error message (e.g. "Please try again"). */
4093
4095
  errorTryReloadMessage?: string;
4094
4096
  }
4097
+ /**
4098
+ * Shared translation labels for SelectButton wrappers (React and Vue).
4099
+ */
4100
+ interface SelectButtonTranslations {
4101
+ /** Screen reader loading announcement (e.g. "Loading…"). */
4102
+ loadingMessage?: string;
4103
+ /**
4104
+ * Message to display when the list has no visible options.
4105
+ * Can be a plain string or a function receiving the current input value (for dynamic messages).
4106
+ * When omitted, the empty state is not shown.
4107
+ */
4108
+ emptyMessage?: string | ((inputValue: string) => string);
4109
+ /**
4110
+ * Message callback to display the number of available options.
4111
+ * Called with the current visible option count and should return a human-readable string.
4112
+ * Displayed when the dropdown is open, not empty, not loading, and not in error.
4113
+ * When omitted, no option count message is shown.
4114
+ */
4115
+ nbOptionMessage?: (optionsLength: number) => string;
4116
+ /** Error title displayed in the dropdown (e.g. "Failed to load"). */
4117
+ errorMessage?: string;
4118
+ /** Secondary error message (e.g. "Please try again"). */
4119
+ errorTryReloadMessage?: string;
4120
+ }
4095
4121
  /**
4096
4122
  * Wrapper-level props shared between React and Vue SelectTextField implementations.
4097
4123
  * These are framework-specific concerns (not part of the core template) that both
@@ -4171,6 +4197,160 @@ interface BaseSelectTextFieldWrapperProps<O> extends Pick<BaseSelectProps<O>, 'o
4171
4197
  translations: SelectTextFieldTranslations;
4172
4198
  }
4173
4199
 
4200
+ /**
4201
+ * Defines the props for the core SelectButton template.
4202
+ */
4203
+ interface SelectButtonProps$1<O> extends BaseSelectProps<O> {
4204
+ /**
4205
+ * Selected value (single mode) or selected values (multi mode).
4206
+ * The wrapper layer chooses the shape; the core just renders names.
4207
+ */
4208
+ value?: O | O[];
4209
+ /**
4210
+ * When `true`, sets `aria-multiselectable="true"` on the listbox so
4211
+ * the dropdown stays open after each selection (combobox setup detects this attribute).
4212
+ */
4213
+ isMultiselectable?: boolean;
4214
+ /** Button label (used for ARIA and when no selection). */
4215
+ label: string;
4216
+ /** Controls how the label/value is displayed in the button. */
4217
+ labelDisplayMode?: ComboboxButtonLabelDisplayMode;
4218
+ /**
4219
+ * Props forwarded to Combobox.Button (button appearance, emphasis, size, etc.).
4220
+ * Pass `renderButton` here to provide a custom button renderer — see
4221
+ * `ComboboxButtonProps.renderButton`. Framework wrappers are responsible for
4222
+ * defaulting any visual affordance (e.g. the dropdown chevron `rightIcon`).
4223
+ */
4224
+ buttonProps?: Record<string, any>;
4225
+ /** Props forwarded to Combobox.Popover. */
4226
+ popoverProps?: Record<string, any>;
4227
+ /** Props forwarded to Combobox.List (e.g. ref). */
4228
+ listProps?: Record<string, any>;
4229
+ /** Callback on option selected (receives option id string). */
4230
+ handleSelect?: (selectedOption: {
4231
+ value: string;
4232
+ }) => void;
4233
+ /**
4234
+ * Status of the dropdown list.
4235
+ * - `'idle'` — Default state, no loading indicators.
4236
+ * - `'loading'` — Full loading: shows skeleton placeholders, hides real options.
4237
+ * - `'loadingMore'` — Paginated loading: appends a skeleton after existing options.
4238
+ * - `'error'` — Error state: shows an error message in the dropdown.
4239
+ * @default 'idle'
4240
+ */
4241
+ listStatus?: SelectTextFieldStatus;
4242
+ /** Optional translations for screen-reader announcements (loading/empty/error/option count). */
4243
+ translations?: SelectButtonTranslations;
4244
+ /** Callback fired when the dropdown open state changes. */
4245
+ onOpen?: (isOpen: boolean) => void;
4246
+ /**
4247
+ * Callback fired to load more items (infinite scroll).
4248
+ * When provided together with an injected `InfiniteScroll` component, an invisible
4249
+ * sentinel element is rendered after the options to trigger loading via IntersectionObserver.
4250
+ */
4251
+ onLoadMore?: () => void;
4252
+ /** IntersectionObserver options forwarded to the InfiniteScroll sentinel. */
4253
+ infiniteScrollOptions?: IntersectionObserverInit;
4254
+ }
4255
+
4256
+ /** Default trigger: LumX `Button` with the dropdown chevron pre-applied. */
4257
+ declare const DefaultButton: Comp<ButtonProps, HTMLButtonElement>;
4258
+ /** Keys managed internally — never forwarded to the trigger element. */
4259
+ type OmittedKeys = 'value' | 'children' | 'role' | 'aria-controls' | 'aria-haspopup' | 'aria-expanded' | 'aria-activedescendant' | 'ref';
4260
+ /** Select-specific props common to both single and multi modes. */
4261
+ type SelectButtonSelectProps<O> = Omit<ReactToJSX<SelectButtonProps$1<O>>, 'renderOption' | 'buttonProps' | 'value' | 'isMultiselectable'> & {
4262
+ /** Called to load more options (infinite scroll). */
4263
+ onLoadMore?: () => void;
4264
+ /** Called when the dropdown opens or closes. */
4265
+ onOpen?: (isOpen: boolean) => void;
4266
+ /**
4267
+ * Custom option renderer. It should return a `<SelectButton.Option>`.
4268
+ * Props `value`, `isSelected`, `description` and `key` are merged in automatically.
4269
+ */
4270
+ renderOption?: (option: O, index: number) => React__default.ReactNode;
4271
+ };
4272
+ /**
4273
+ * Forwarded trigger props for a given element `E`, minus the keys that the
4274
+ * component manages internally.
4275
+ */
4276
+ type TriggerProps<E extends ElementType$1> = Omit<NamedProps<React__default.ComponentPropsWithoutRef<E>>, OmittedKeys>;
4277
+ /**
4278
+ * Common base — Select-specific props plus the ARIA / label / popover layer.
4279
+ * `as`, `ref`, `selectionType`, `value`, `onChange` are intentionally hoisted
4280
+ * to the top-level `SelectButtonProps` shape (below) so that TS can infer
4281
+ * `O`, `E`, and `S` directly from those JSX attributes.
4282
+ */
4283
+ type CommonSelectButtonProps<O> = SelectButtonSelectProps<O> & GenericProps$1 & {
4284
+ /** Button label, used for ARIA and as fallback when no option is selected. */
4285
+ label: string;
4286
+ /** Props forwarded to the popover. */
4287
+ popoverProps?: ComboboxPopoverProps;
4288
+ /** How the selected option is shown in the trigger. */
4289
+ labelDisplayMode?: ComboboxButtonLabelDisplayMode;
4290
+ /**
4291
+ * Status of the dropdown list (loading, error, etc.).
4292
+ * @default 'idle'
4293
+ */
4294
+ listStatus?: SelectTextFieldStatus;
4295
+ /** Screen-reader translations (loading/empty/error/option count). */
4296
+ translations?: SelectButtonTranslations;
4297
+ };
4298
+ /**
4299
+ * Props for `SelectButton`.
4300
+ *
4301
+ * Polymorphic — pass `as` to render the trigger as a different component
4302
+ * (e.g. `as={IconButton}`, `as={Chip}`, `as={Link}`). With no `as`, the trigger
4303
+ * is the LumX `Button` with the dropdown chevron, so LumX `ButtonProps`
4304
+ * (`emphasis`, `size`, `leftIcon`…) are accepted. With `as`, the trigger is
4305
+ * fully replaced and only props valid for that component apply.
4306
+ *
4307
+ * Discriminated on `selectionType`:
4308
+ * - default / `'single'` → `value?: O`, `onChange?: (newValue?: O) => void`.
4309
+ * - `'multiple'` → `value?: O[]`, `onChange?: (newValue?: O[]) => void`.
4310
+ *
4311
+ * `as` and `selectionType` are top-level on this type (rather than buried in
4312
+ * an intersection or union member) so that TS can infer `E` from `as` and
4313
+ * `S` from `selectionType` without explicit generic annotations at the call site.
4314
+ *
4315
+ * @typeParam O - Option object type, inferred from `options` / `getOptionId`.
4316
+ * @typeParam E - Trigger element type, inferred from `as`. Defaults to the LumX `Button`.
4317
+ * @typeParam S - Selection mode, inferred from `selectionType`. Defaults to `'single'`.
4318
+ */
4319
+ type SelectButtonProps<O, E extends ElementType$1 = typeof DefaultButton, S extends 'single' | 'multiple' = 'single'> = CommonSelectButtonProps<O> & TriggerProps<E> & {
4320
+ /** Customize the rendered trigger component. Inference site for `E`. */
4321
+ as?: E;
4322
+ /** Ref for the trigger element. Type follows `as`. */
4323
+ ref?: ComponentRef<E>;
4324
+ /**
4325
+ * Selection mode discriminator. Inference site for `S`.
4326
+ * Optional — defaults to `'single'`. Set to `'multiple'` to opt into
4327
+ * multi-select; this also switches `value` / `onChange` to array form.
4328
+ */
4329
+ selectionType?: S;
4330
+ /** Selected option(s). Shape depends on `selectionType`. */
4331
+ value?: S extends 'multiple' ? O[] : O;
4332
+ /** Called when the selection changes. Shape depends on `selectionType`. */
4333
+ onChange?: S extends 'multiple' ? (newValue?: O[]) => void : (newValue?: O) => void;
4334
+ };
4335
+ /**
4336
+ * Single-selection props (`selectionType` defaults to `'single'`).
4337
+ * Backwards-compatible alias — existing consumers do not need to set `selectionType`.
4338
+ */
4339
+ type SingleSelectButtonProps<O, E extends ElementType$1 = typeof DefaultButton> = SelectButtonProps<O, E, 'single'>;
4340
+ /** Multi-selection props (`selectionType: 'multiple'` is required to opt in). */
4341
+ type MultipleSelectButtonProps<O, E extends ElementType$1 = typeof DefaultButton> = SelectButtonProps<O, E, 'multiple'>;
4342
+
4343
+ /**
4344
+ * SelectButton compound component.
4345
+ */
4346
+ declare const SelectButton: {
4347
+ <O, E extends React$1.ElementType = Comp<ButtonProps, HTMLButtonElement>, S extends "single" | "multiple" = "single">(props: SelectButtonProps<O, E, S>): react_jsx_runtime.JSX.Element;
4348
+ displayName: string;
4349
+ } & {
4350
+ /** Selectable option within the dropdown list. */
4351
+ Option: Comp<ComboboxOptionProps, HTMLLIElement>;
4352
+ };
4353
+
4174
4354
  interface BaseSelectTextFieldProps<O = any> extends BaseSelectTextFieldWrapperProps<O>, HasClassName$1 {
4175
4355
  /**
4176
4356
  * Custom option render function. Must return a `<Combobox.Option>` element with custom
@@ -5314,5 +5494,5 @@ declare const ThemeProvider: React__default.FC<{
5314
5494
  /** Get the theme in the current context. */
5315
5495
  declare function useTheme(): ThemeContextValue;
5316
5496
 
5317
- export { AlertDialog, Autocomplete, AutocompleteMultiple, Avatar, Badge, BadgeWrapper, Button, ButtonEmphasis, ButtonGroup, CLASSNAME, 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, SelectMultiple, SelectMultipleField, SelectTextField, SelectVariant, SelectionChipGroup, SideNavigation, SideNavigationItem, SkeletonCircle, SkeletonRectangle, SkeletonRectangleVariant, SkeletonTypography, Slider, Slides, Slideshow, SlideshowControls, SlideshowItem, Switch, 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, Toolbar, Tooltip, Uploader, UploaderVariant, UserBlock, clamp, useFocusPointStyle, useHeadingLevel, useTheme };
5318
- 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, MultipleSelectTextFieldProps, NavigationProps, NotificationProps, Offset, PopoverDialogProps, PopoverProps, PostBlockProps, ProgressCircularProps, ProgressCircularSize, ProgressLinearProps, ProgressProps, ProgressTrackerProps, ProgressTrackerProviderProps, ProgressTrackerStepPanelProps, ProgressTrackerStepProps, RadioButtonProps, RadioGroupProps, RawInputTextProps, RawInputTextareaProps, SelectMultipleProps, SelectProps, SelectTextFieldProps, SelectTextFieldStatus, SelectTextFieldTranslations, SelectionChipGroupProps, SideNavigationItemProps, SideNavigationProps, SingleSelectTextFieldProps, SkeletonCircleProps, SkeletonRectangleProps, SkeletonTypographyProps, SliderProps, SlidesProps, SlideshowControlsProps, SlideshowItemProps, SlideshowProps, SwitchProps, TabListProps, TabPanelProps, TabProps, TabProviderProps, TableBodyProps, TableCellProps, TableHeaderProps, TableProps, TableRowProps, TextFieldProps, TextProps, ThumbnailProps, ThumbnailSize, ToolbarProps, TooltipPlacement, TooltipProps, UploaderProps, UploaderSize, UserBlockProps, UserBlockSize };
5497
+ export { AlertDialog, Autocomplete, AutocompleteMultiple, Avatar, Badge, BadgeWrapper, Button, ButtonEmphasis, ButtonGroup, CLASSNAME, 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, 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, Toolbar, Tooltip, Uploader, UploaderVariant, UserBlock, clamp, useFocusPointStyle, useHeadingLevel, useTheme };
5498
+ 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, ToolbarProps, TooltipPlacement, TooltipProps, UploaderProps, UploaderSize, UserBlockProps, UserBlockSize };