@lumx/react 3.0.6-alpha.1 → 3.0.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/_internal/types.d.ts +18 -1
- package/index.d.ts +33 -6
- package/index.js +550 -482
- package/index.js.map +1 -1
- package/package.json +4 -4
- package/src/components/autocomplete/Autocomplete.tsx +4 -1
- package/src/components/button/Button.stories.tsx +27 -1
- package/src/components/button/Button.tsx +3 -3
- package/src/components/dropdown/Dropdown.tsx +4 -1
- package/src/components/popover/Popover.tsx +18 -3
- package/src/components/popover-dialog/PopoverDialog.stories.tsx +75 -0
- package/src/components/popover-dialog/PopoverDialog.test.tsx +65 -0
- package/src/components/popover-dialog/PopoverDialog.tsx +65 -0
- package/src/components/popover-dialog/index.tsx +1 -0
- package/src/index.ts +1 -0
- package/src/stories/generated/PopoverDialog/Demos.stories.tsx +6 -0
- package/src/utils/type.ts +20 -0
package/_internal/types.d.ts
CHANGED
|
@@ -48,6 +48,23 @@ declare type Callback = () => void;
|
|
|
48
48
|
* (excluding `NaN` as it can't be distinguished from `number`)
|
|
49
49
|
*/
|
|
50
50
|
declare type Falsy = false | undefined | null | 0 | '';
|
|
51
|
+
/**
|
|
52
|
+
* Require either `aria-label` or `arial-labelledby` prop.
|
|
53
|
+
* If none are set, the order will prioritize `aria-labelledby` over `aria-label` as it
|
|
54
|
+
* needs a visible element.
|
|
55
|
+
*/
|
|
56
|
+
declare type HasAriaLabelOrLabelledBy<T = string | undefined> = T extends string ? {
|
|
57
|
+
/**
|
|
58
|
+
* The id of the element to use as title of the dialog. Can be within or out of the dialog.
|
|
59
|
+
* Although it is not recommended, aria-label can be used instead if no visible element is available.
|
|
60
|
+
*/
|
|
61
|
+
'aria-labelledby': T;
|
|
62
|
+
/** The label of the dialog. */
|
|
63
|
+
'aria-label'?: undefined;
|
|
64
|
+
} : {
|
|
65
|
+
'aria-label': string;
|
|
66
|
+
'aria-labelledby'?: undefined;
|
|
67
|
+
};
|
|
51
68
|
|
|
52
69
|
/**
|
|
53
70
|
* Alignments.
|
|
@@ -268,4 +285,4 @@ declare const ThumbnailVariant: {
|
|
|
268
285
|
};
|
|
269
286
|
declare type ThumbnailVariant = ValueOf<typeof ThumbnailVariant>;
|
|
270
287
|
|
|
271
|
-
export { Alignment as A, Comp as C, Emphasis as E, Falsy as F, GenericProps as G, HasTheme as H, Kind as K, Orientation as O, Size as S, Typography as T, ValueOf as V, HorizontalAlignment as a, Color as b, Callback as c, ColorPalette as d, VerticalAlignment as e, ColorVariant as f, TextElement as g, HeadingElement as h, AspectRatio as i, FocusPoint as j, ThumbnailSize as k, ThumbnailVariant as l,
|
|
288
|
+
export { Alignment as A, Comp as C, Emphasis as E, Falsy as F, GenericProps as G, HasTheme as H, Kind as K, Orientation as O, Size as S, Typography as T, ValueOf as V, HorizontalAlignment as a, Color as b, Callback as c, ColorPalette as d, VerticalAlignment as e, ColorVariant as f, TextElement as g, HeadingElement as h, AspectRatio as i, FocusPoint as j, ThumbnailSize as k, ThumbnailVariant as l, HasAriaLabelOrLabelledBy as m, GlobalSize as n, TypographyInterface as o, Theme as p, TypographyTitleCustom as q, TypographyCustom as r, ThumbnailAspectRatio as s };
|
package/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode, SyntheticEvent, ReactElement, MouseEventHandler, KeyboardEventHandler, AriaAttributes, DetailedHTMLProps, ButtonHTMLAttributes, InputHTMLAttributes, Ref, RefObject, ImgHTMLAttributes, CSSProperties, SetStateAction, Key } from 'react';
|
|
2
|
-
import { K as Kind, C as Comp, G as GenericProps, H as HasTheme, a as HorizontalAlignment, S as Size, b as Color, E as Emphasis, V as ValueOf, c as Callback, d as ColorPalette, A as Alignment, e as VerticalAlignment, O as Orientation, f as ColorVariant, T as Typography, g as TextElement, h as HeadingElement, i as AspectRatio, F as Falsy, j as FocusPoint, k as ThumbnailSize, l as ThumbnailVariant, m as
|
|
3
|
-
export { A as Alignment, i as AspectRatio, c as Callback, b as Color, d as ColorPalette, f as ColorVariant, E as Emphasis, j as FocusPoint, G as GenericProps,
|
|
2
|
+
import { K as Kind, C as Comp, G as GenericProps, H as HasTheme, a as HorizontalAlignment, S as Size, b as Color, E as Emphasis, V as ValueOf, c as Callback, d as ColorPalette, A as Alignment, e as VerticalAlignment, O as Orientation, f as ColorVariant, T as Typography, g as TextElement, h as HeadingElement, i as AspectRatio, F as Falsy, j as FocusPoint, k as ThumbnailSize, l as ThumbnailVariant, m as HasAriaLabelOrLabelledBy, n as GlobalSize, o as TypographyInterface } from './_internal/types.js';
|
|
3
|
+
export { A as Alignment, i as AspectRatio, c as Callback, b as Color, d as ColorPalette, f as ColorVariant, E as Emphasis, j as FocusPoint, G as GenericProps, n as GlobalSize, h as HeadingElement, a as HorizontalAlignment, K as Kind, O as Orientation, S as Size, g as TextElement, p as Theme, s as ThumbnailAspectRatio, k as ThumbnailSize, l as ThumbnailVariant, T as Typography, r as TypographyCustom, o as TypographyInterface, q as TypographyTitleCustom, e as VerticalAlignment } from './_internal/types.js';
|
|
4
4
|
|
|
5
5
|
interface AlertDialogProps extends Omit<DialogProps, 'header' | 'footer'> {
|
|
6
6
|
/** Message variant. */
|
|
@@ -63,7 +63,10 @@ interface AutocompleteProps extends GenericProps, HasTheme {
|
|
|
63
63
|
*/
|
|
64
64
|
placement?: Placement;
|
|
65
65
|
/**
|
|
66
|
-
*
|
|
66
|
+
* Manage dropdown width:
|
|
67
|
+
* - `maxWidth`: dropdown not bigger than anchor
|
|
68
|
+
* - `minWidth` or `true`: dropdown not smaller than anchor
|
|
69
|
+
* - `width`: dropdown equal to the anchor.
|
|
67
70
|
* @see {@link DropdownProps#fitToAnchorWidth}
|
|
68
71
|
*/
|
|
69
72
|
fitToAnchorWidth?: DropdownProps['fitToAnchorWidth'];
|
|
@@ -739,7 +742,12 @@ interface PopoverProps extends GenericProps {
|
|
|
739
742
|
closeOnEscape?: boolean;
|
|
740
743
|
/** Shadow elevation. */
|
|
741
744
|
elevation?: Elevation;
|
|
742
|
-
/**
|
|
745
|
+
/**
|
|
746
|
+
* Manage popover width:
|
|
747
|
+
* - `maxWidth`: popover not bigger than anchor
|
|
748
|
+
* - `minWidth` or `true`: popover not smaller than anchor
|
|
749
|
+
* - `width`: popover equal to the anchor.
|
|
750
|
+
*/
|
|
743
751
|
fitToAnchorWidth?: AnchorWidthOption | boolean;
|
|
744
752
|
/** Shrink popover if even after flipping there is not enough space. */
|
|
745
753
|
fitWithinViewportHeight?: boolean;
|
|
@@ -763,6 +771,8 @@ interface PopoverProps extends GenericProps {
|
|
|
763
771
|
zIndex?: number;
|
|
764
772
|
/** On close callback (on click away or Escape pressed). */
|
|
765
773
|
onClose?(): void;
|
|
774
|
+
/** Whether the popover should trap the focus within itself. Default to false. */
|
|
775
|
+
withFocusTrap?: boolean;
|
|
766
776
|
}
|
|
767
777
|
/**
|
|
768
778
|
* Popover component.
|
|
@@ -799,7 +809,10 @@ interface DropdownProps extends GenericProps {
|
|
|
799
809
|
*/
|
|
800
810
|
closeOnEscape?: boolean;
|
|
801
811
|
/**
|
|
802
|
-
*
|
|
812
|
+
* Manage dropdown width:
|
|
813
|
+
* - `maxWidth`: dropdown not bigger than anchor
|
|
814
|
+
* - `minWidth` or `true`: dropdown not smaller than anchor
|
|
815
|
+
* - `width`: dropdown equal to the anchor.
|
|
803
816
|
* @see {@link PopoverProps#fitToAnchorWidth}
|
|
804
817
|
*/
|
|
805
818
|
fitToAnchorWidth?: PopoverProps['fitToAnchorWidth'];
|
|
@@ -1629,6 +1642,20 @@ interface NotificationProps extends GenericProps, HasTheme {
|
|
|
1629
1642
|
*/
|
|
1630
1643
|
declare const Notification: Comp<NotificationProps, HTMLDivElement>;
|
|
1631
1644
|
|
|
1645
|
+
/**
|
|
1646
|
+
* PopoverDialog props.
|
|
1647
|
+
* The PopoverDialog has the same props as the Popover but requires an accessible label.
|
|
1648
|
+
*/
|
|
1649
|
+
declare type PopoverDialogProps = PopoverProps & HasAriaLabelOrLabelledBy;
|
|
1650
|
+
/**
|
|
1651
|
+
* PopoverDialog component.
|
|
1652
|
+
* Defines a popover that acts like a dialog
|
|
1653
|
+
* * Has a dialog aria role
|
|
1654
|
+
* * Sets a focus trap within the popover
|
|
1655
|
+
* * Closes on click away and escape.
|
|
1656
|
+
*/
|
|
1657
|
+
declare const PopoverDialog: Comp<PopoverDialogProps, HTMLDivElement>;
|
|
1658
|
+
|
|
1632
1659
|
/**
|
|
1633
1660
|
* Defines the props of the component.
|
|
1634
1661
|
*/
|
|
@@ -2699,4 +2726,4 @@ interface UserBlockProps extends GenericProps, HasTheme {
|
|
|
2699
2726
|
*/
|
|
2700
2727
|
declare const UserBlock: Comp<UserBlockProps, HTMLDivElement>;
|
|
2701
2728
|
|
|
2702
|
-
export { AlertDialog, AlertDialogProps, Autocomplete, AutocompleteMultiple, AutocompleteMultipleProps, AutocompleteProps, Avatar, AvatarProps, AvatarSize, Badge, BadgeProps, BaseButtonProps, Button, ButtonEmphasis, ButtonGroup, ButtonGroupProps, ButtonProps, ButtonSize, Checkbox, CheckboxProps, Chip, ChipGroup, ChipGroupProps, ChipProps, CommentBlock, CommentBlockProps, CommentBlockVariant, DatePicker, DatePickerControlled, DatePickerControlledProps, DatePickerField, DatePickerFieldProps, DatePickerProps, Dialog, DialogProps, DialogSizes, Divider, DividerProps, DragHandle, DragHandleProps, Dropdown, DropdownProps, Elevation, ExpansionPanel, ExpansionPanelProps, Flag, FlagProps, FlexBox, FlexBoxProps, FlexHorizontalAlignment, FlexVerticalAlignment, GapSize, GenericBlock, GenericBlockGapSize, GenericBlockProps, Grid, GridItem, GridItemProps, GridProps, Heading, HeadingLevelProvider, HeadingLevelProviderProps, HeadingProps, Icon, IconButton, IconButtonProps, IconProps, IconSizes, ImageBlock, ImageBlockCaptionPosition, ImageBlockProps, ImageBlockSize, InlineList, InlineListProps, InputHelper, InputHelperProps, InputLabel, InputLabelProps, Lightbox, LightboxProps, Link, LinkPreview, LinkPreviewProps, LinkProps, List, ListDivider, ListDividerProps, ListItem, ListItemProps, ListItemSize, ListProps, ListSubheader, ListSubheaderProps, MarginAutoAlignment, Message, MessageProps, Mosaic, MosaicProps, Notification, NotificationProps, Offset, Placement, Popover, PopoverProps, PostBlock, PostBlockProps, Progress, ProgressProps, ProgressTracker, ProgressTrackerProps, ProgressTrackerProvider, ProgressTrackerProviderProps, ProgressTrackerStep, ProgressTrackerStepPanel, ProgressTrackerStepPanelProps, ProgressTrackerStepProps, ProgressVariant, RadioButton, RadioButtonProps, RadioGroup, RadioGroupProps, Select, SelectMultiple, SelectMultipleField, SelectMultipleProps, SelectProps, SelectVariant, SideNavigation, SideNavigationItem, SideNavigationItemProps, SideNavigationProps, SkeletonCircle, SkeletonCircleProps, SkeletonRectangle, SkeletonRectangleProps, SkeletonRectangleVariant, SkeletonTypography, SkeletonTypographyProps, Slider, SliderProps, Slides, SlidesProps, Slideshow, SlideshowControls, SlideshowControlsProps, SlideshowItem, SlideshowItemProps, SlideshowProps, Switch, SwitchProps, Tab, TabList, TabListLayout, TabListProps, TabPanel, TabPanelProps, TabProps, TabProvider, TabProviderProps, Table, TableBody, TableBodyProps, TableCell, TableCellProps, TableCellVariant, TableHeader, TableHeaderProps, TableProps, TableRow, TableRowProps, Text, TextField, TextFieldProps, TextProps, ThOrder, Thumbnail, ThumbnailProps, Toolbar, ToolbarProps, Tooltip, TooltipPlacement, TooltipProps, Uploader, UploaderProps, UploaderSize, UploaderVariant, UserBlock, UserBlockProps, UserBlockSize, clamp, isClickable, useFocusPointStyle, useHeadingLevel };
|
|
2729
|
+
export { AlertDialog, AlertDialogProps, Autocomplete, AutocompleteMultiple, AutocompleteMultipleProps, AutocompleteProps, Avatar, AvatarProps, AvatarSize, Badge, BadgeProps, BaseButtonProps, Button, ButtonEmphasis, ButtonGroup, ButtonGroupProps, ButtonProps, ButtonSize, Checkbox, CheckboxProps, Chip, ChipGroup, ChipGroupProps, ChipProps, CommentBlock, CommentBlockProps, CommentBlockVariant, DatePicker, DatePickerControlled, DatePickerControlledProps, DatePickerField, DatePickerFieldProps, DatePickerProps, Dialog, DialogProps, DialogSizes, Divider, DividerProps, DragHandle, DragHandleProps, Dropdown, DropdownProps, Elevation, ExpansionPanel, ExpansionPanelProps, Flag, FlagProps, FlexBox, FlexBoxProps, FlexHorizontalAlignment, FlexVerticalAlignment, GapSize, GenericBlock, GenericBlockGapSize, GenericBlockProps, Grid, GridItem, GridItemProps, GridProps, Heading, HeadingLevelProvider, HeadingLevelProviderProps, HeadingProps, Icon, IconButton, IconButtonProps, IconProps, IconSizes, ImageBlock, ImageBlockCaptionPosition, ImageBlockProps, ImageBlockSize, InlineList, InlineListProps, InputHelper, InputHelperProps, InputLabel, InputLabelProps, Lightbox, LightboxProps, Link, LinkPreview, LinkPreviewProps, LinkProps, List, ListDivider, ListDividerProps, ListItem, ListItemProps, ListItemSize, ListProps, ListSubheader, ListSubheaderProps, MarginAutoAlignment, Message, MessageProps, Mosaic, MosaicProps, Notification, NotificationProps, Offset, Placement, Popover, PopoverDialog, PopoverDialogProps, PopoverProps, PostBlock, PostBlockProps, Progress, ProgressProps, ProgressTracker, ProgressTrackerProps, ProgressTrackerProvider, ProgressTrackerProviderProps, ProgressTrackerStep, ProgressTrackerStepPanel, ProgressTrackerStepPanelProps, ProgressTrackerStepProps, ProgressVariant, RadioButton, RadioButtonProps, RadioGroup, RadioGroupProps, Select, SelectMultiple, SelectMultipleField, SelectMultipleProps, SelectProps, SelectVariant, SideNavigation, SideNavigationItem, SideNavigationItemProps, SideNavigationProps, SkeletonCircle, SkeletonCircleProps, SkeletonRectangle, SkeletonRectangleProps, SkeletonRectangleVariant, SkeletonTypography, SkeletonTypographyProps, Slider, SliderProps, Slides, SlidesProps, Slideshow, SlideshowControls, SlideshowControlsProps, SlideshowItem, SlideshowItemProps, SlideshowProps, Switch, SwitchProps, Tab, TabList, TabListLayout, TabListProps, TabPanel, TabPanelProps, TabProps, TabProvider, TabProviderProps, Table, TableBody, TableBodyProps, TableCell, TableCellProps, TableCellVariant, TableHeader, TableHeaderProps, TableProps, TableRow, TableRowProps, Text, TextField, TextFieldProps, TextProps, ThOrder, Thumbnail, ThumbnailProps, Toolbar, ToolbarProps, Tooltip, TooltipPlacement, TooltipProps, Uploader, UploaderProps, UploaderSize, UploaderVariant, UserBlock, UserBlockProps, UserBlockSize, clamp, isClickable, useFocusPointStyle, useHeadingLevel };
|