@lumx/react 4.20.0-next.4 → 4.20.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 +85 -66
  2. package/index.js +828 -380
  3. package/index.js.map +1 -1
  4. package/package.json +7 -6
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, ColorPalette as ColorPalette$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, NamedProps } 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, 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';
@@ -226,24 +226,6 @@ type ColorVariant = ValueOf$1<typeof ColorVariant>;
226
226
  /** ColorPalette with all possible color variant combination */
227
227
  type ColorWithVariants = ColorPalette | Exclude<`${ColorPalette}-${ColorVariant}`, `light-D${number}` | `dark-D${number}`>;
228
228
 
229
- /**
230
- * Require either `aria-label` or `arial-labelledby` prop.
231
- * If none are set, the order will prioritize `aria-labelledby` over `aria-label` as it
232
- * needs a visible element.
233
- */
234
- type HasAriaLabelOrLabelledBy<T = string | undefined> = T extends string ? {
235
- /**
236
- * The id of the element to use as title of the dialog. Can be within or out of the dialog.
237
- * Although it is not recommended, aria-label can be used instead if no visible element is available.
238
- */
239
- 'aria-labelledby': T;
240
- /** The label of the dialog. */
241
- 'aria-label'?: undefined;
242
- } : {
243
- 'aria-label': string;
244
- 'aria-labelledby'?: undefined;
245
- };
246
-
247
229
  interface HasClassName {
248
230
  /**
249
231
  * Class name forwarded to the root element of the component.
@@ -1231,6 +1213,10 @@ declare const ListDivider: Comp<ListDividerProps, HTMLLIElement>;
1231
1213
  * Defines the props of the component.
1232
1214
  */
1233
1215
  interface TextProps$1 extends HasClassName {
1216
+ /**
1217
+ * HTML id.
1218
+ */
1219
+ id?: string;
1234
1220
  /**
1235
1221
  * Color variant.
1236
1222
  */
@@ -2180,7 +2166,16 @@ declare namespace ComboboxProvider {
2180
2166
 
2181
2167
  /**
2182
2168
  * Hook to subscribe to a combobox event via the handle's subscriber system.
2183
- * Re-subscribes when the handle changes (e.g. trigger mount/unmount).
2169
+ *
2170
+ * Uses `useSyncExternalStore` (shim, for React 17 support) reading the handle's synchronous
2171
+ * `getSnapshot` — the correct pattern for an external (non-React) store. It reads the current
2172
+ * value during commit, so a consumer doesn't miss changes that happened between its render and its
2173
+ * subscription (e.g. options registered by child effects before this consumer subscribed, since
2174
+ * `optionsChange` is not replayed on subscribe), and it is tearing-safe under concurrent rendering.
2175
+ *
2176
+ * The handle dispatches synchronously, so the store update fires within the triggering render/event
2177
+ * (inside React's `act` in tests) rather than a deferred microtask. Re-subscribes when the handle
2178
+ * changes (e.g. trigger mount/unmount).
2184
2179
  */
2185
2180
  declare function useComboboxEvent<K extends keyof ComboboxEventMap>(event: K, initialValue: ComboboxEventMap[K]): ComboboxEventMap[K];
2186
2181
 
@@ -2448,14 +2443,64 @@ interface DialogProps extends GenericProps$1, HasCloseMode$1, BaseDialogProps {
2448
2443
  /** Children */
2449
2444
  children?: React__default.ReactNode;
2450
2445
  }
2446
+ declare const Dialog: Comp<DialogProps, HTMLDivElement>;
2447
+
2451
2448
  /**
2452
- * Dialog component.
2449
+ * Defines the props of the component.
2450
+ */
2451
+ interface HeadingProps$1 extends Partial<TextProps$1> {
2452
+ /**
2453
+ * Display a specific heading level instead of the one provided by parent context provider.
2454
+ */
2455
+ as?: HeadingElement;
2456
+ }
2457
+
2458
+ interface HeadingProps extends GenericProps$1, HeadingProps$1 {
2459
+ }
2460
+ /**
2461
+ * Renders a heading component.
2462
+ * Extends the `Text` Component with the heading level automatically computed based on
2463
+ * the current level provided by the context.
2464
+ */
2465
+ declare const Heading: Comp<HeadingProps, HTMLElement>;
2466
+
2467
+ interface HeadingLevelProviderProps {
2468
+ /** The heading level to start at. If left undefined, the parent context will be used, if any. */
2469
+ level?: number;
2470
+ /** The children to display */
2471
+ children: ReactNode;
2472
+ }
2473
+ /**
2474
+ * Provide a new heading level context.
2475
+ */
2476
+ declare const HeadingLevelProvider: React.FC<HeadingLevelProviderProps>;
2477
+
2478
+ declare const useHeadingLevel: () => {
2479
+ level: number;
2480
+ headingElement: _lumx_core_js_types.HeadingElement;
2481
+ };
2482
+
2483
+ type DialogHeadingProps = HeadingProps;
2484
+ /**
2485
+ * Names the enclosing dialog-like container (`Dialog`, `Lightbox`, `PopoverDialog`, ...).
2453
2486
  *
2454
- * @param props Component props.
2455
- * @param ref Component ref.
2456
- * @return React element.
2487
+ * Thin wrapper over `Heading` that generates its own id (or uses the consumer-supplied `id`),
2488
+ * and registers it with the nearest ids registry on mount so the container can link itself to
2489
+ * this heading via `aria-labelledby`. Deregisters on unmount.
2490
+ *
2491
+ * Defaults its typography to `Typography.title` (overridable via the `typography` prop).
2492
+ *
2493
+ * If two `DialogHeading`s are rendered within the same container, the last one registered wins.
2494
+ *
2495
+ * @example
2496
+ * <Dialog isOpen={isOpen}>
2497
+ * <header>
2498
+ * <Toolbar label={<DialogHeading>My dialog</DialogHeading>} />
2499
+ * </header>
2500
+ * ...
2501
+ * </Dialog>
2457
2502
  */
2458
- declare const Dialog: Comp<DialogProps, HTMLDivElement>;
2503
+ declare const DialogHeading: Comp<HeadingProps, HTMLElement>;
2459
2504
 
2460
2505
  /**
2461
2506
  * Defines the props of the component.
@@ -2845,41 +2890,6 @@ interface GenericBlock extends BaseGenericBlock {
2845
2890
  }
2846
2891
  declare const GenericBlock: GenericBlock;
2847
2892
 
2848
- /**
2849
- * Defines the props of the component.
2850
- */
2851
- interface HeadingProps$1 extends Partial<TextProps$1> {
2852
- /**
2853
- * Display a specific heading level instead of the one provided by parent context provider.
2854
- */
2855
- as?: HeadingElement;
2856
- }
2857
-
2858
- interface HeadingProps extends GenericProps$1, HeadingProps$1 {
2859
- }
2860
- /**
2861
- * Renders a heading component.
2862
- * Extends the `Text` Component with the heading level automatically computed based on
2863
- * the current level provided by the context.
2864
- */
2865
- declare const Heading: Comp<HeadingProps, HTMLElement>;
2866
-
2867
- interface HeadingLevelProviderProps {
2868
- /** The heading level to start at. If left undefined, the parent context will be used, if any. */
2869
- level?: number;
2870
- /** The children to display */
2871
- children: ReactNode;
2872
- }
2873
- /**
2874
- * Provide a new heading level context.
2875
- */
2876
- declare const HeadingLevelProvider: React.FC<HeadingLevelProviderProps>;
2877
-
2878
- declare const useHeadingLevel: () => {
2879
- level: number;
2880
- headingElement: _lumx_core_js_types.HeadingElement;
2881
- };
2882
-
2883
2893
  type GridGutterSize = Extract<Size$1, 'regular' | 'big' | 'huge'>;
2884
2894
  /**
2885
2895
  * Defines the props of the component.
@@ -3391,6 +3401,8 @@ interface BaseLightboxProps extends HasClassName, HasTheme, Pick<AriaAttributes,
3391
3401
  isOpen?: boolean;
3392
3402
  /** Whether to keep the dialog open on clickaway or escape press. */
3393
3403
  preventAutoClose?: boolean;
3404
+ /** Whether to keep the dialog open on clickaway (overridden by `preventAutoClose`). */
3405
+ preventCloseOnClick?: boolean;
3394
3406
  /** Z-axis position. */
3395
3407
  zIndex?: number;
3396
3408
  }
@@ -3410,6 +3422,7 @@ interface LightboxProps extends GenericProps$1, ReactToJSX<BaseLightboxProps> {
3410
3422
  /** Children */
3411
3423
  children?: React.ReactNode;
3412
3424
  }
3425
+
3413
3426
  /**
3414
3427
  * Lightbox component.
3415
3428
  *
@@ -3742,7 +3755,7 @@ type NavigationProps = React.ComponentProps<'nav'> & HasClassName$1 & HasTheme$1
3742
3755
  /** Content of the navigation. These components should be of type NavigationItem to be rendered */
3743
3756
  children?: React.ReactNode;
3744
3757
  orientation?: Orientation$1;
3745
- } & HasAriaLabelOrLabelledBy$1;
3758
+ } & HasAriaLabelOrLabelledBy;
3746
3759
  type SubComponents = {
3747
3760
  Section: typeof NavigationSection;
3748
3761
  Item: typeof NavigationItem;
@@ -3781,18 +3794,24 @@ declare const Notification: Comp<NotificationProps, HTMLDivElement>;
3781
3794
 
3782
3795
  /**
3783
3796
  * PopoverDialog props.
3784
- * The PopoverDialog has the same props as the Popover but requires an accessible label.
3797
+ * The PopoverDialog has the same props as the Popover, plus optional accessible-name props.
3798
+ * An accessible name can be provided via `label`, `aria-label`, `aria-labelledby`, or by
3799
+ * rendering a `DialogHeading` inside the dialog (which names it via the internal label
3800
+ * registry) - at least one of these should be used.
3785
3801
  */
3786
- type PopoverDialogProps$1 = PopoverProps$1 & HasAriaLabelOrLabelledBy & {
3802
+ type PopoverDialogProps$1 = PopoverProps$1 & Pick<AriaAttributes, 'aria-label' | 'aria-labelledby'> & {
3787
3803
  /** Accessible label for the dialog (alternative to aria-label prop). */
3788
3804
  label?: string;
3789
3805
  };
3790
3806
 
3791
3807
  /**
3792
3808
  * PopoverDialog props.
3793
- * The PopoverDialog has the same props as the Popover but requires an accessible label.
3809
+ * The PopoverDialog has the same props as the Popover, plus optional accessible-name props
3810
+ * (`label`/`aria-label`/`aria-labelledby`). An accessible name can also be provided by rendering
3811
+ * a `DialogHeading` inside the dialog - at least one of these should be used.
3794
3812
  */
3795
3813
  type PopoverDialogProps = PopoverProps & Omit<PopoverDialogProps$1, keyof PopoverProps$1>;
3814
+
3796
3815
  /**
3797
3816
  * PopoverDialog component.
3798
3817
  * Defines a popover that acts like a dialog:
@@ -5856,5 +5875,5 @@ declare const ThemeProvider: React__default.FC<{
5856
5875
  /** Get the theme in the current context. */
5857
5876
  declare function useTheme(): ThemeContextValue;
5858
5877
 
5859
- export { AlertDialog, Autocomplete, AutocompleteMultiple, Avatar, Badge, BadgeWrapper, Button, ButtonEmphasis, ButtonGroup, CLASSNAME$2 as CLASSNAME, COMPONENT_NAME$2 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, MenuButton, ListDivider as MenuDivider, MenuItem, 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 };
5860
- 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, MenuButtonProps, ListDividerProps as MenuDividerProps, MenuItemActionProps, MenuItemProps, MessageProps, MosaicProps, MultipleSelectButtonProps, MultipleSelectTextFieldProps, NavigationProps, NotificationProps, Offset, PopoverDialogProps, PopoverHeight, PopoverProps, PopoverWidth, 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 };
5878
+ export { AlertDialog, Autocomplete, AutocompleteMultiple, Avatar, Badge, BadgeWrapper, Button, ButtonEmphasis, ButtonGroup, CLASSNAME$2 as CLASSNAME, COMPONENT_NAME$2 as COMPONENT_NAME, Checkbox, Chip, ChipGroup, Combobox, CommentBlock, CommentBlockVariant, DEFAULT_PROPS, DatePicker, DatePickerControlled, DatePickerField, Dialog, DialogHeading, 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, MenuButton, ListDivider as MenuDivider, MenuItem, 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 };
5879
+ 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, DialogHeadingProps, 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, MenuButtonProps, ListDividerProps as MenuDividerProps, MenuItemActionProps, MenuItemProps, MessageProps, MosaicProps, MultipleSelectButtonProps, MultipleSelectTextFieldProps, NavigationProps, NotificationProps, Offset, PopoverDialogProps, PopoverHeight, PopoverProps, PopoverWidth, 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 };