@lumx/react 3.0.6-alpha.2 → 3.0.7-alpha.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/_internal/types.d.ts +18 -1
- package/index.d.ts +24 -8
- package/index.js +551 -482
- package/index.js.map +1 -1
- package/package.json +4 -4
- package/src/components/badge/Badge.tsx +2 -2
- package/src/components/button/Button.stories.tsx +27 -1
- package/src/components/button/Button.tsx +3 -3
- package/src/components/button/ButtonRoot.tsx +2 -2
- package/src/components/checkbox/Checkbox.test.tsx +2 -0
- package/src/components/checkbox/Checkbox.tsx +1 -0
- package/src/components/chip/Chip.tsx +2 -2
- package/src/components/icon/Icon.tsx +2 -2
- package/src/components/link/Link.tsx +2 -2
- package/src/components/popover/Popover.tsx +12 -2
- 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,
|
|
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, ColorPalette as b, Callback as c, VerticalAlignment as d, ColorVariant as e, TextElement as f, HeadingElement as g, AspectRatio as h, FocusPoint as i, ThumbnailSize as j, ThumbnailVariant as k, HasAriaLabelOrLabelledBy as l, GlobalSize as m, TypographyInterface as n, Color 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
|
|
3
|
-
export { A as Alignment,
|
|
2
|
+
import { K as Kind, C as Comp, G as GenericProps, H as HasTheme, a as HorizontalAlignment, S as Size, b as ColorPalette, E as Emphasis, V as ValueOf, c as Callback, A as Alignment, d as VerticalAlignment, O as Orientation, e as ColorVariant, T as Typography, f as TextElement, g as HeadingElement, h as AspectRatio, F as Falsy, i as FocusPoint, j as ThumbnailSize, k as ThumbnailVariant, l as HasAriaLabelOrLabelledBy, m as GlobalSize, n as TypographyInterface } from './_internal/types.js';
|
|
3
|
+
export { A as Alignment, h as AspectRatio, c as Callback, o as Color, b as ColorPalette, e as ColorVariant, E as Emphasis, i as FocusPoint, G as GenericProps, m as GlobalSize, g as HeadingElement, a as HorizontalAlignment, K as Kind, O as Orientation, S as Size, f as TextElement, p as Theme, s as ThumbnailAspectRatio, j as ThumbnailSize, k as ThumbnailVariant, T as Typography, r as TypographyCustom, n as TypographyInterface, q as TypographyTitleCustom, d as VerticalAlignment } from './_internal/types.js';
|
|
4
4
|
|
|
5
5
|
interface AlertDialogProps extends Omit<DialogProps, 'header' | 'footer'> {
|
|
6
6
|
/** Message variant. */
|
|
@@ -261,7 +261,7 @@ interface BadgeProps extends GenericProps {
|
|
|
261
261
|
/** Badge content. */
|
|
262
262
|
children?: ReactNode;
|
|
263
263
|
/** Color variant. */
|
|
264
|
-
color?:
|
|
264
|
+
color?: ColorPalette;
|
|
265
265
|
}
|
|
266
266
|
/**
|
|
267
267
|
* Badge component.
|
|
@@ -279,7 +279,7 @@ declare type HTMLButtonProps = DetailedHTMLProps<ButtonHTMLAttributes<HTMLButton
|
|
|
279
279
|
declare type ButtonSize = Extract<Size, 's' | 'm'>;
|
|
280
280
|
interface BaseButtonProps extends GenericProps, Pick<AriaAttributes, 'aria-expanded' | 'aria-haspopup' | 'aria-pressed' | 'aria-label'>, HasTheme {
|
|
281
281
|
/** Color variant. */
|
|
282
|
-
color?:
|
|
282
|
+
color?: ColorPalette;
|
|
283
283
|
/** Emphasis variant. */
|
|
284
284
|
emphasis?: Emphasis;
|
|
285
285
|
/** Whether or not the button has a background color in low emphasis. */
|
|
@@ -426,7 +426,7 @@ interface ChipProps extends GenericProps, HasTheme {
|
|
|
426
426
|
/** A component to be rendered before the content. */
|
|
427
427
|
before?: ReactNode;
|
|
428
428
|
/** Color variant. */
|
|
429
|
-
color?:
|
|
429
|
+
color?: ColorPalette;
|
|
430
430
|
/** Whether the component is clickable or not. */
|
|
431
431
|
isClickable?: boolean;
|
|
432
432
|
/** Whether the component is disabled or not. */
|
|
@@ -771,6 +771,8 @@ interface PopoverProps extends GenericProps {
|
|
|
771
771
|
zIndex?: number;
|
|
772
772
|
/** On close callback (on click away or Escape pressed). */
|
|
773
773
|
onClose?(): void;
|
|
774
|
+
/** Whether the popover should trap the focus within itself. Default to false. */
|
|
775
|
+
withFocusTrap?: boolean;
|
|
774
776
|
}
|
|
775
777
|
/**
|
|
776
778
|
* Popover component.
|
|
@@ -1176,7 +1178,7 @@ declare type IconSizes = Extract<Size, 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | '
|
|
|
1176
1178
|
*/
|
|
1177
1179
|
interface IconProps extends GenericProps, HasTheme {
|
|
1178
1180
|
/** Color variant. */
|
|
1179
|
-
color?:
|
|
1181
|
+
color?: ColorPalette;
|
|
1180
1182
|
/** Lightened or darkened variant of the selected icon color. */
|
|
1181
1183
|
colorVariant?: ColorVariant;
|
|
1182
1184
|
/** Whether the icon has a shape. */
|
|
@@ -1401,7 +1403,7 @@ declare type HTMLAnchorProps = React.DetailedHTMLProps<React.AnchorHTMLAttribute
|
|
|
1401
1403
|
*/
|
|
1402
1404
|
interface LinkProps extends GenericProps {
|
|
1403
1405
|
/** Color variant. */
|
|
1404
|
-
color?:
|
|
1406
|
+
color?: ColorPalette;
|
|
1405
1407
|
/** Lightened or darkened variant of the selected icon color. */
|
|
1406
1408
|
colorVariant?: ColorVariant;
|
|
1407
1409
|
/** Link href. */
|
|
@@ -1640,6 +1642,20 @@ interface NotificationProps extends GenericProps, HasTheme {
|
|
|
1640
1642
|
*/
|
|
1641
1643
|
declare const Notification: Comp<NotificationProps, HTMLDivElement>;
|
|
1642
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
|
+
|
|
1643
1659
|
/**
|
|
1644
1660
|
* Defines the props of the component.
|
|
1645
1661
|
*/
|
|
@@ -2710,4 +2726,4 @@ interface UserBlockProps extends GenericProps, HasTheme {
|
|
|
2710
2726
|
*/
|
|
2711
2727
|
declare const UserBlock: Comp<UserBlockProps, HTMLDivElement>;
|
|
2712
2728
|
|
|
2713
|
-
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 };
|