@lumx/react 3.15.1-alpha.1 → 3.15.1
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 +5 -1
- package/index.js +5525 -5530
- package/index.js.map +1 -1
- package/package.json +4 -3
- package/src/components/alert-dialog/AlertDialog.tsx +12 -2
- package/src/components/autocomplete/Autocomplete.tsx +5 -5
- package/src/components/autocomplete/AutocompleteMultiple.tsx +5 -5
- package/src/components/avatar/Avatar.tsx +1 -1
- package/src/components/badge/Badge.tsx +1 -1
- package/src/components/badge/BadgeWrapper.tsx +0 -2
- package/src/components/button/Button.tsx +10 -1
- package/src/components/button/IconButton.tsx +2 -2
- package/src/components/chip/Chip.tsx +1 -1
- package/src/components/comment-block/CommentBlock.tsx +1 -1
- package/src/components/dialog/Dialog.tsx +2 -2
- package/src/components/dropdown/Dropdown.tsx +8 -8
- package/src/components/generic-block/GenericBlock.tsx +2 -2
- package/src/components/grid/Grid.tsx +10 -1
- package/src/components/image-block/ImageBlock.tsx +2 -2
- package/src/components/input-helper/InputHelper.tsx +1 -1
- package/src/components/link-preview/LinkPreview.tsx +2 -2
- package/src/components/list/List.tsx +9 -1
- package/src/components/list/ListItem.tsx +1 -1
- package/src/components/navigation/Navigation.tsx +7 -1
- package/src/components/notification/Notification.tsx +2 -2
- package/src/components/popover/Popover.tsx +5 -5
- package/src/components/post-block/PostBlock.tsx +1 -1
- package/src/components/progress/Progress.tsx +1 -1
- package/src/components/progress-tracker/ProgressTrackerProvider.tsx +1 -0
- package/src/components/select/Select.tsx +2 -0
- package/src/components/select/SelectMultiple.tsx +2 -0
- package/src/components/select/WithSelectContext.tsx +2 -7
- package/src/components/side-navigation/SideNavigationItem.tsx +2 -2
- package/src/components/skeleton/SkeletonRectangle.tsx +10 -1
- package/src/components/slider/Slider.tsx +2 -2
- package/src/components/slideshow/Slideshow.tsx +4 -6
- package/src/components/slideshow/SlideshowControls.tsx +1 -1
- package/src/components/switch/Switch.tsx +1 -1
- package/src/components/table/TableCell.tsx +10 -1
- package/src/components/tabs/TabList.tsx +2 -2
- package/src/components/tabs/TabProvider.tsx +1 -1
- package/src/components/text-field/TextField.tsx +1 -1
- package/src/components/thumbnail/Thumbnail.tsx +2 -2
- package/src/components/tooltip/Tooltip.tsx +4 -4
- package/src/components/uploader/Uploader.tsx +3 -3
- package/src/components/user-block/UserBlock.tsx +2 -2
- package/src/hooks/useSlideshowControls.ts +2 -2
- package/src/testing/utils/queries.ts +1 -1
package/package.json
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
"url": "https://github.com/lumapps/design-system/issues"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@lumx/core": "^3.15.1
|
|
10
|
-
"@lumx/icons": "^3.15.1
|
|
9
|
+
"@lumx/core": "^3.15.1",
|
|
10
|
+
"@lumx/icons": "^3.15.1",
|
|
11
11
|
"@popperjs/core": "^2.5.4",
|
|
12
12
|
"body-scroll-lock": "^3.1.5",
|
|
13
13
|
"classnames": "^2.3.2",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"@storybook/blocks": "^7.6.3",
|
|
36
36
|
"@storybook/react": "^7.6.3",
|
|
37
37
|
"@storybook/react-vite": "^7.6.3",
|
|
38
|
+
"@testing-library/dom": "^9.3.4",
|
|
38
39
|
"@testing-library/jest-dom": "^5.16.4",
|
|
39
40
|
"@testing-library/react": "^12.1.2",
|
|
40
41
|
"@testing-library/user-event": "^14.4.3",
|
|
@@ -110,5 +111,5 @@
|
|
|
110
111
|
"build:storybook": "storybook build"
|
|
111
112
|
},
|
|
112
113
|
"sideEffects": false,
|
|
113
|
-
"version": "3.15.1
|
|
114
|
+
"version": "3.15.1"
|
|
114
115
|
}
|
|
@@ -81,8 +81,18 @@ const DEFAULT_PROPS: Partial<DialogProps> = {
|
|
|
81
81
|
* Children of this component should only be strings, paragraphs or links.
|
|
82
82
|
*/
|
|
83
83
|
export const AlertDialog = forwardRef<AlertDialogProps, HTMLDivElement>((props, ref) => {
|
|
84
|
-
const {
|
|
85
|
-
|
|
84
|
+
const {
|
|
85
|
+
id,
|
|
86
|
+
title,
|
|
87
|
+
className,
|
|
88
|
+
cancelProps,
|
|
89
|
+
confirmProps,
|
|
90
|
+
kind = DEFAULT_PROPS.kind,
|
|
91
|
+
size = DEFAULT_PROPS.size,
|
|
92
|
+
dialogProps,
|
|
93
|
+
children,
|
|
94
|
+
...forwardedProps
|
|
95
|
+
} = props;
|
|
86
96
|
|
|
87
97
|
const cancelButtonRef = React.useRef(null);
|
|
88
98
|
const confirmationButtonRef = React.useRef(null);
|
|
@@ -204,13 +204,13 @@ const DEFAULT_PROPS: Partial<AutocompleteProps> = {
|
|
|
204
204
|
export const Autocomplete = forwardRef<AutocompleteProps, HTMLDivElement>((props, ref) => {
|
|
205
205
|
const defaultTheme = useTheme();
|
|
206
206
|
const {
|
|
207
|
-
anchorToInput,
|
|
207
|
+
anchorToInput = DEFAULT_PROPS.anchorToInput,
|
|
208
208
|
children,
|
|
209
209
|
chips,
|
|
210
210
|
className,
|
|
211
|
-
closeOnClick,
|
|
212
|
-
closeOnClickAway,
|
|
213
|
-
closeOnEscape,
|
|
211
|
+
closeOnClick = DEFAULT_PROPS.closeOnClick,
|
|
212
|
+
closeOnClickAway = DEFAULT_PROPS.closeOnClickAway,
|
|
213
|
+
closeOnEscape = DEFAULT_PROPS.closeOnEscape,
|
|
214
214
|
disabled,
|
|
215
215
|
error,
|
|
216
216
|
fitToAnchorWidth,
|
|
@@ -233,7 +233,7 @@ export const Autocomplete = forwardRef<AutocompleteProps, HTMLDivElement>((props
|
|
|
233
233
|
onInfiniteScroll,
|
|
234
234
|
placeholder,
|
|
235
235
|
placement,
|
|
236
|
-
shouldFocusOnClose,
|
|
236
|
+
shouldFocusOnClose = DEFAULT_PROPS.shouldFocusOnClose,
|
|
237
237
|
theme = defaultTheme,
|
|
238
238
|
value,
|
|
239
239
|
textFieldProps = {},
|
|
@@ -76,8 +76,8 @@ export const AutocompleteMultiple = forwardRef<AutocompleteMultipleProps, HTMLDi
|
|
|
76
76
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
77
77
|
chipsAlignment,
|
|
78
78
|
className,
|
|
79
|
-
closeOnClickAway,
|
|
80
|
-
closeOnEscape,
|
|
79
|
+
closeOnClickAway = DEFAULT_PROPS.closeOnClickAway,
|
|
80
|
+
closeOnEscape = DEFAULT_PROPS.closeOnEscape,
|
|
81
81
|
fitToAnchorWidth,
|
|
82
82
|
hasError,
|
|
83
83
|
helper,
|
|
@@ -100,12 +100,12 @@ export const AutocompleteMultiple = forwardRef<AutocompleteMultipleProps, HTMLDi
|
|
|
100
100
|
onKeyDown,
|
|
101
101
|
placeholder,
|
|
102
102
|
placement,
|
|
103
|
-
selectedChipRender,
|
|
103
|
+
selectedChipRender = DEFAULT_PROPS.selectedChipRender,
|
|
104
104
|
shouldFocusOnClose,
|
|
105
105
|
theme = defaultTheme,
|
|
106
106
|
type,
|
|
107
107
|
value,
|
|
108
|
-
values,
|
|
108
|
+
values = DEFAULT_PROPS.values,
|
|
109
109
|
...forwardedProps
|
|
110
110
|
} = props;
|
|
111
111
|
|
|
@@ -126,7 +126,7 @@ export const AutocompleteMultiple = forwardRef<AutocompleteMultipleProps, HTMLDi
|
|
|
126
126
|
helper={helper}
|
|
127
127
|
icon={icon}
|
|
128
128
|
inputRef={inputRef}
|
|
129
|
-
chips={values && values.map((chip: any, index: number) => selectedChipRender(chip, index, onClear))}
|
|
129
|
+
chips={values && values.map((chip: any, index: number) => selectedChipRender?.(chip, index, onClear))}
|
|
130
130
|
isDisabled={isDisabled}
|
|
131
131
|
isRequired={isRequired}
|
|
132
132
|
clearButtonProps={clearButtonProps}
|
|
@@ -42,7 +42,7 @@ const DEFAULT_PROPS: Partial<BadgeProps> = {
|
|
|
42
42
|
* @return React element.
|
|
43
43
|
*/
|
|
44
44
|
export const Badge = forwardRef<BadgeProps, HTMLDivElement>((props, ref) => {
|
|
45
|
-
const { children, className, color, ...forwardedProps } = props;
|
|
45
|
+
const { children, className, color = DEFAULT_PROPS.color, ...forwardedProps } = props;
|
|
46
46
|
return (
|
|
47
47
|
<div
|
|
48
48
|
ref={ref}
|
|
@@ -3,7 +3,6 @@ import React, { ReactElement, ReactNode } from 'react';
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
|
|
5
5
|
import { getRootClassName } from '@lumx/react/utils/className';
|
|
6
|
-
import { DEFAULT_PROPS } from '@lumx/react/components/select/WithSelectContext';
|
|
7
6
|
import { GenericProps } from '@lumx/react/utils/type';
|
|
8
7
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
9
8
|
|
|
@@ -36,4 +35,3 @@ export const BadgeWrapper = forwardRef<BadgeWrapperProps, HTMLDivElement>((props
|
|
|
36
35
|
});
|
|
37
36
|
BadgeWrapper.displayName = 'BadgeWrapper';
|
|
38
37
|
BadgeWrapper.className = CLASSNAME;
|
|
39
|
-
BadgeWrapper.defaultProps = DEFAULT_PROPS;
|
|
@@ -58,7 +58,16 @@ const DEFAULT_PROPS: Partial<ButtonProps> = {
|
|
|
58
58
|
*/
|
|
59
59
|
export const Button = forwardRef<ButtonProps, HTMLButtonElement | HTMLAnchorElement>((props, ref) => {
|
|
60
60
|
const defaultTheme = useTheme() || Theme.light;
|
|
61
|
-
const {
|
|
61
|
+
const {
|
|
62
|
+
children,
|
|
63
|
+
className,
|
|
64
|
+
emphasis = DEFAULT_PROPS.emphasis,
|
|
65
|
+
leftIcon,
|
|
66
|
+
rightIcon,
|
|
67
|
+
size = DEFAULT_PROPS.size,
|
|
68
|
+
theme = defaultTheme,
|
|
69
|
+
...forwardedProps
|
|
70
|
+
} = props;
|
|
62
71
|
|
|
63
72
|
const buttonClassName = classNames(
|
|
64
73
|
className,
|
|
@@ -59,11 +59,11 @@ const DEFAULT_PROPS: Partial<IconButtonProps> = {
|
|
|
59
59
|
export const IconButton = forwardRef<IconButtonProps, HTMLButtonElement>((props, ref) => {
|
|
60
60
|
const defaultTheme = useTheme() || Theme.light;
|
|
61
61
|
const {
|
|
62
|
-
emphasis,
|
|
62
|
+
emphasis = DEFAULT_PROPS.emphasis,
|
|
63
63
|
image,
|
|
64
64
|
icon,
|
|
65
65
|
label,
|
|
66
|
-
size,
|
|
66
|
+
size = DEFAULT_PROPS.size,
|
|
67
67
|
theme = defaultTheme,
|
|
68
68
|
tooltipProps,
|
|
69
69
|
hideTooltip,
|
|
@@ -107,7 +107,7 @@ export const CommentBlock = forwardRef<CommentBlockProps, HTMLDivElement>((props
|
|
|
107
107
|
onMouseLeave,
|
|
108
108
|
text,
|
|
109
109
|
theme = defaultTheme,
|
|
110
|
-
variant,
|
|
110
|
+
variant = DEFAULT_PROPS.variant,
|
|
111
111
|
...forwardedProps
|
|
112
112
|
} = props;
|
|
113
113
|
const hasChildren = Children.count(children) > 0;
|
|
@@ -115,11 +115,11 @@ export const Dialog = forwardRef<DialogProps, HTMLDivElement>((props, ref) => {
|
|
|
115
115
|
parentElement,
|
|
116
116
|
contentRef,
|
|
117
117
|
preventAutoClose,
|
|
118
|
-
size,
|
|
118
|
+
size = DEFAULT_PROPS.size,
|
|
119
119
|
zIndex,
|
|
120
120
|
dialogProps,
|
|
121
121
|
onVisibilityChange,
|
|
122
|
-
disableBodyScroll,
|
|
122
|
+
disableBodyScroll = DEFAULT_PROPS.disableBodyScroll,
|
|
123
123
|
preventCloseOnClick,
|
|
124
124
|
preventCloseOnEscape,
|
|
125
125
|
...forwardedProps
|
|
@@ -119,18 +119,18 @@ export const Dropdown = forwardRef<DropdownProps, HTMLDivElement>((props, ref) =
|
|
|
119
119
|
anchorRef,
|
|
120
120
|
children,
|
|
121
121
|
className,
|
|
122
|
-
closeOnClick,
|
|
123
|
-
closeOnClickAway,
|
|
124
|
-
closeOnEscape,
|
|
125
|
-
fitToAnchorWidth,
|
|
126
|
-
fitWithinViewportHeight,
|
|
122
|
+
closeOnClick = DEFAULT_PROPS.closeOnClick,
|
|
123
|
+
closeOnClickAway = DEFAULT_PROPS.closeOnClickAway,
|
|
124
|
+
closeOnEscape = DEFAULT_PROPS.closeOnEscape,
|
|
125
|
+
fitToAnchorWidth = DEFAULT_PROPS.fitToAnchorWidth,
|
|
126
|
+
fitWithinViewportHeight = DEFAULT_PROPS.fitWithinViewportHeight,
|
|
127
127
|
isOpen,
|
|
128
128
|
offset,
|
|
129
|
-
focusAnchorOnClose,
|
|
129
|
+
focusAnchorOnClose = DEFAULT_PROPS.focusAnchorOnClose,
|
|
130
130
|
onClose,
|
|
131
131
|
onInfiniteScroll,
|
|
132
|
-
placement,
|
|
133
|
-
shouldFocusOnOpen,
|
|
132
|
+
placement = DEFAULT_PROPS.placement,
|
|
133
|
+
shouldFocusOnOpen = DEFAULT_PROPS.shouldFocusOnOpen,
|
|
134
134
|
zIndex,
|
|
135
135
|
...forwardedProps
|
|
136
136
|
} = props;
|
|
@@ -129,8 +129,8 @@ const BaseGenericBlock: BaseGenericBlock = forwardRef((props, ref) => {
|
|
|
129
129
|
children,
|
|
130
130
|
actions,
|
|
131
131
|
actionsProps,
|
|
132
|
-
gap,
|
|
133
|
-
orientation,
|
|
132
|
+
gap = DEFAULT_PROPS.gap,
|
|
133
|
+
orientation = DEFAULT_PROPS.orientation,
|
|
134
134
|
contentProps,
|
|
135
135
|
...forwardedProps
|
|
136
136
|
} = props;
|
|
@@ -53,7 +53,16 @@ const DEFAULT_PROPS: Partial<GridProps> = {
|
|
|
53
53
|
* @return React element.
|
|
54
54
|
*/
|
|
55
55
|
export const Grid = forwardRef<GridProps, HTMLDivElement>((props, ref) => {
|
|
56
|
-
const {
|
|
56
|
+
const {
|
|
57
|
+
children,
|
|
58
|
+
className,
|
|
59
|
+
gutter,
|
|
60
|
+
hAlign,
|
|
61
|
+
orientation = DEFAULT_PROPS.orientation,
|
|
62
|
+
vAlign,
|
|
63
|
+
wrap = DEFAULT_PROPS.wrap,
|
|
64
|
+
...forwardedProps
|
|
65
|
+
} = props;
|
|
57
66
|
|
|
58
67
|
return (
|
|
59
68
|
<div
|
|
@@ -77,9 +77,9 @@ export const ImageBlock = forwardRef<ImageBlockProps, HTMLDivElement>((props, re
|
|
|
77
77
|
const defaultTheme = useTheme() || Theme.light;
|
|
78
78
|
const {
|
|
79
79
|
actions,
|
|
80
|
-
align,
|
|
80
|
+
align = DEFAULT_PROPS.align,
|
|
81
81
|
alt,
|
|
82
|
-
captionPosition,
|
|
82
|
+
captionPosition = DEFAULT_PROPS.captionPosition,
|
|
83
83
|
captionStyle,
|
|
84
84
|
className,
|
|
85
85
|
description,
|
|
@@ -46,7 +46,7 @@ const DEFAULT_PROPS: Partial<InputHelperProps> = {
|
|
|
46
46
|
*/
|
|
47
47
|
export const InputHelper = forwardRef<InputHelperProps, HTMLParagraphElement>((props, ref) => {
|
|
48
48
|
const defaultTheme = useTheme() || Theme.light;
|
|
49
|
-
const { children, className, kind, theme = defaultTheme, ...forwardedProps } = props;
|
|
49
|
+
const { children, className, kind = DEFAULT_PROPS.kind, theme = defaultTheme, ...forwardedProps } = props;
|
|
50
50
|
const { color } = INPUT_HELPER_CONFIGURATION[kind as any] || {};
|
|
51
51
|
|
|
52
52
|
return (
|
|
@@ -74,11 +74,11 @@ export const LinkPreview = forwardRef<LinkPreviewProps, HTMLDivElement>((props,
|
|
|
74
74
|
link,
|
|
75
75
|
linkAs,
|
|
76
76
|
linkProps,
|
|
77
|
-
size,
|
|
77
|
+
size = DEFAULT_PROPS.size,
|
|
78
78
|
theme = defaultTheme,
|
|
79
79
|
thumbnailProps,
|
|
80
80
|
title,
|
|
81
|
-
titleHeading,
|
|
81
|
+
titleHeading = DEFAULT_PROPS.titleHeading,
|
|
82
82
|
...forwardedProps
|
|
83
83
|
} = props;
|
|
84
84
|
// Use title heading as title wrapper (see DEFAULT_PROPS for the default value).
|
|
@@ -62,7 +62,15 @@ const DEFAULT_PROPS: Partial<ListProps> = {
|
|
|
62
62
|
* @return React element.
|
|
63
63
|
*/
|
|
64
64
|
const InternalList = forwardRef<ListProps, HTMLUListElement>((props, ref) => {
|
|
65
|
-
const {
|
|
65
|
+
const {
|
|
66
|
+
children,
|
|
67
|
+
className,
|
|
68
|
+
isClickable,
|
|
69
|
+
itemPadding,
|
|
70
|
+
onListItemSelected,
|
|
71
|
+
tabIndex = DEFAULT_PROPS.tabIndex,
|
|
72
|
+
...forwardedProps
|
|
73
|
+
} = props;
|
|
66
74
|
const listElementRef = useRef<HTMLUListElement>(null);
|
|
67
75
|
|
|
68
76
|
const { items, hasClickableItem } = useInteractiveList({
|
|
@@ -44,7 +44,13 @@ type SubComponents = {
|
|
|
44
44
|
|
|
45
45
|
export const Navigation = forwardRef<NavigationProps, HTMLElement, SubComponents>((props, ref) => {
|
|
46
46
|
const defaultTheme = useTheme() || Theme.light;
|
|
47
|
-
const {
|
|
47
|
+
const {
|
|
48
|
+
children,
|
|
49
|
+
className,
|
|
50
|
+
theme = defaultTheme,
|
|
51
|
+
orientation = DEFAULT_PROPS.orientation,
|
|
52
|
+
...forwardedProps
|
|
53
|
+
} = props;
|
|
48
54
|
return (
|
|
49
55
|
<ThemeProvider value={theme}>
|
|
50
56
|
<nav
|
|
@@ -73,8 +73,8 @@ export const Notification = forwardRef<NotificationProps, HTMLDivElement>((props
|
|
|
73
73
|
onClick,
|
|
74
74
|
theme = defaultTheme,
|
|
75
75
|
type,
|
|
76
|
-
zIndex,
|
|
77
|
-
usePortal,
|
|
76
|
+
zIndex = DEFAULT_PROPS.zIndex,
|
|
77
|
+
usePortal = DEFAULT_PROPS.usePortal,
|
|
78
78
|
style,
|
|
79
79
|
...forwardedProps
|
|
80
80
|
} = props;
|
|
@@ -107,24 +107,24 @@ const _InnerPopover = forwardRef<PopoverProps, HTMLDivElement>((props, ref) => {
|
|
|
107
107
|
className,
|
|
108
108
|
closeOnClickAway,
|
|
109
109
|
closeOnEscape,
|
|
110
|
-
elevation,
|
|
110
|
+
elevation = DEFAULT_PROPS.elevation,
|
|
111
111
|
focusElement,
|
|
112
112
|
hasArrow,
|
|
113
113
|
isOpen,
|
|
114
114
|
onClose,
|
|
115
115
|
parentElement,
|
|
116
|
-
usePortal,
|
|
117
|
-
focusAnchorOnClose,
|
|
116
|
+
usePortal = DEFAULT_PROPS.usePortal,
|
|
117
|
+
focusAnchorOnClose = DEFAULT_PROPS.focusAnchorOnClose,
|
|
118
118
|
withFocusTrap,
|
|
119
119
|
boundaryRef,
|
|
120
120
|
fitToAnchorWidth,
|
|
121
121
|
fitWithinViewportHeight,
|
|
122
122
|
focusTrapZoneElement,
|
|
123
123
|
offset,
|
|
124
|
-
placement,
|
|
124
|
+
placement = DEFAULT_PROPS.placement,
|
|
125
125
|
style,
|
|
126
126
|
theme,
|
|
127
|
-
zIndex,
|
|
127
|
+
zIndex = DEFAULT_PROPS.zIndex,
|
|
128
128
|
...forwardedProps
|
|
129
129
|
} = props;
|
|
130
130
|
const popoverRef = useRef<HTMLDivElement>(null);
|
|
@@ -52,7 +52,7 @@ const DEFAULT_PROPS: Partial<ProgressProps> = {
|
|
|
52
52
|
*/
|
|
53
53
|
export const Progress = forwardRef<ProgressProps, HTMLDivElement>((props, ref) => {
|
|
54
54
|
const defaultTheme = useTheme() || Theme.light;
|
|
55
|
-
const { className, theme = defaultTheme, variant, ...forwardedProps } = props;
|
|
55
|
+
const { className, theme = defaultTheme, variant = DEFAULT_PROPS.variant, ...forwardedProps } = props;
|
|
56
56
|
|
|
57
57
|
return (
|
|
58
58
|
<div
|
|
@@ -34,6 +34,7 @@ const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
|
34
34
|
/** The default value of props. */
|
|
35
35
|
const DEFAULT_PROPS: Partial<SelectProps> = {
|
|
36
36
|
selectedValueRender: (choice) => choice,
|
|
37
|
+
variant: SelectVariant.input,
|
|
37
38
|
};
|
|
38
39
|
|
|
39
40
|
const stopPropagation = (evt: Event) => evt.stopPropagation();
|
|
@@ -176,6 +177,7 @@ export const Select = forwardRef<SelectProps, HTMLDivElement>((props, ref) => {
|
|
|
176
177
|
return WithSelectContext(
|
|
177
178
|
SelectField,
|
|
178
179
|
{
|
|
180
|
+
...DEFAULT_PROPS,
|
|
179
181
|
...props,
|
|
180
182
|
className: classNames(
|
|
181
183
|
props.className,
|
|
@@ -54,6 +54,7 @@ const DEFAULT_PROPS: Partial<SelectMultipleProps> = {
|
|
|
54
54
|
);
|
|
55
55
|
},
|
|
56
56
|
selectedValueRender: (choice) => choice,
|
|
57
|
+
variant: SelectVariant.input,
|
|
57
58
|
};
|
|
58
59
|
|
|
59
60
|
export const SelectMultipleField: React.FC<SelectMultipleProps> = (props) => {
|
|
@@ -185,6 +186,7 @@ export const SelectMultiple = forwardRef<SelectMultipleProps, HTMLDivElement>((p
|
|
|
185
186
|
return WithSelectContext(
|
|
186
187
|
SelectMultipleField,
|
|
187
188
|
{
|
|
189
|
+
...DEFAULT_PROPS,
|
|
188
190
|
...props,
|
|
189
191
|
className: classNames(
|
|
190
192
|
props.className,
|
|
@@ -12,7 +12,7 @@ import { mergeRefs } from '@lumx/react/utils/react/mergeRefs';
|
|
|
12
12
|
|
|
13
13
|
import { useId } from '@lumx/react/hooks/useId';
|
|
14
14
|
import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
15
|
-
import { CoreSelectProps
|
|
15
|
+
import { CoreSelectProps } from './constants';
|
|
16
16
|
|
|
17
17
|
/** The display name of the component. */
|
|
18
18
|
const COMPONENT_NAME = 'Select';
|
|
@@ -20,11 +20,6 @@ const COMPONENT_NAME = 'Select';
|
|
|
20
20
|
/** The default class name and classes prefix for this component. */
|
|
21
21
|
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
22
22
|
|
|
23
|
-
/** The default value of props. */
|
|
24
|
-
export const DEFAULT_PROPS: Partial<CoreSelectProps> = {
|
|
25
|
-
variant: SelectVariant.input,
|
|
26
|
-
};
|
|
27
|
-
|
|
28
23
|
export const WithSelectContext = (
|
|
29
24
|
SelectElement: React.FC<any>,
|
|
30
25
|
props: CoreSelectProps,
|
|
@@ -55,7 +50,7 @@ export const WithSelectContext = (
|
|
|
55
50
|
placeholder,
|
|
56
51
|
theme = defaultTheme,
|
|
57
52
|
value,
|
|
58
|
-
variant
|
|
53
|
+
variant,
|
|
59
54
|
...forwardedProps
|
|
60
55
|
} = props;
|
|
61
56
|
const generatedSelectId = useId();
|
|
@@ -70,7 +70,7 @@ export const SideNavigationItem = forwardRef<SideNavigationItemProps, HTMLLIElem
|
|
|
70
70
|
const {
|
|
71
71
|
children,
|
|
72
72
|
className,
|
|
73
|
-
emphasis,
|
|
73
|
+
emphasis = DEFAULT_PROPS.emphasis,
|
|
74
74
|
icon,
|
|
75
75
|
isOpen,
|
|
76
76
|
isSelected,
|
|
@@ -80,7 +80,7 @@ export const SideNavigationItem = forwardRef<SideNavigationItemProps, HTMLLIElem
|
|
|
80
80
|
onActionClick,
|
|
81
81
|
onClick,
|
|
82
82
|
toggleButtonProps,
|
|
83
|
-
closeMode =
|
|
83
|
+
closeMode = DEFAULT_PROPS.closeMode,
|
|
84
84
|
...forwardedProps
|
|
85
85
|
} = props;
|
|
86
86
|
|
|
@@ -53,7 +53,16 @@ const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
|
53
53
|
*/
|
|
54
54
|
export const SkeletonRectangle = forwardRef<SkeletonRectangleProps, HTMLDivElement>((props, ref) => {
|
|
55
55
|
const defaultTheme = useTheme() || Theme.light;
|
|
56
|
-
const {
|
|
56
|
+
const {
|
|
57
|
+
aspectRatio,
|
|
58
|
+
className,
|
|
59
|
+
height,
|
|
60
|
+
theme = defaultTheme,
|
|
61
|
+
variant = DEFAULT_PROPS.variant,
|
|
62
|
+
width,
|
|
63
|
+
color,
|
|
64
|
+
...forwardedProps
|
|
65
|
+
} = props;
|
|
57
66
|
|
|
58
67
|
return (
|
|
59
68
|
<div
|
|
@@ -105,8 +105,8 @@ export const Slider = forwardRef<SliderProps, HTMLDivElement>((props, ref) => {
|
|
|
105
105
|
name,
|
|
106
106
|
onChange,
|
|
107
107
|
onMouseDown,
|
|
108
|
-
precision,
|
|
109
|
-
steps,
|
|
108
|
+
precision = DEFAULT_PROPS.precision,
|
|
109
|
+
steps = DEFAULT_PROPS.steps,
|
|
110
110
|
theme = defaultTheme,
|
|
111
111
|
value,
|
|
112
112
|
...forwardedProps
|
|
@@ -44,9 +44,7 @@ export interface SlideshowProps
|
|
|
44
44
|
/**
|
|
45
45
|
* Component default props.
|
|
46
46
|
*/
|
|
47
|
-
const DEFAULT_PROPS: Partial<SlideshowProps> =
|
|
48
|
-
...DEFAULT_OPTIONS,
|
|
49
|
-
};
|
|
47
|
+
const DEFAULT_PROPS: Partial<SlideshowProps> = DEFAULT_OPTIONS;
|
|
50
48
|
|
|
51
49
|
/**
|
|
52
50
|
* Slideshow component.
|
|
@@ -59,12 +57,12 @@ export const Slideshow = forwardRef<SlideshowProps, HTMLDivElement>((props, ref)
|
|
|
59
57
|
const defaultTheme = useTheme() || Theme.light;
|
|
60
58
|
const {
|
|
61
59
|
activeIndex,
|
|
62
|
-
autoPlay,
|
|
60
|
+
autoPlay = DEFAULT_PROPS.autoPlay,
|
|
63
61
|
children,
|
|
64
62
|
className,
|
|
65
63
|
fillHeight,
|
|
66
|
-
groupBy,
|
|
67
|
-
interval,
|
|
64
|
+
groupBy = DEFAULT_OPTIONS.groupBy,
|
|
65
|
+
interval = DEFAULT_PROPS.interval,
|
|
68
66
|
onChange,
|
|
69
67
|
slideshowControlsProps,
|
|
70
68
|
theme = defaultTheme,
|
|
@@ -84,7 +84,7 @@ const DEFAULT_PROPS: Partial<SlideshowControlsProps> = {
|
|
|
84
84
|
const InternalSlideshowControls = forwardRef<SlideshowControlsProps, HTMLDivElement>((props, ref) => {
|
|
85
85
|
const defaultTheme = useTheme() || Theme.light;
|
|
86
86
|
const {
|
|
87
|
-
activeIndex,
|
|
87
|
+
activeIndex = DEFAULT_PROPS.activeIndex,
|
|
88
88
|
className,
|
|
89
89
|
nextButtonProps,
|
|
90
90
|
onNextClick,
|
|
@@ -63,7 +63,16 @@ const DEFAULT_PROPS: Partial<TableCellProps> = {
|
|
|
63
63
|
* @return React element.
|
|
64
64
|
*/
|
|
65
65
|
export const TableCell = forwardRef<TableCellProps, HTMLTableCellElement>((props, ref) => {
|
|
66
|
-
const {
|
|
66
|
+
const {
|
|
67
|
+
children,
|
|
68
|
+
className,
|
|
69
|
+
icon,
|
|
70
|
+
isSortable,
|
|
71
|
+
onHeaderClick,
|
|
72
|
+
sortOrder,
|
|
73
|
+
variant = DEFAULT_PROPS.variant,
|
|
74
|
+
...forwardedProps
|
|
75
|
+
} = props;
|
|
67
76
|
|
|
68
77
|
// Use button if clickable
|
|
69
78
|
const Wrapper = onHeaderClick ? 'button' : 'div';
|
|
@@ -64,8 +64,8 @@ export const TabList = forwardRef<TabListProps, HTMLDivElement>((props, ref) =>
|
|
|
64
64
|
'aria-label': ariaLabel,
|
|
65
65
|
children,
|
|
66
66
|
className,
|
|
67
|
-
layout,
|
|
68
|
-
position,
|
|
67
|
+
layout = DEFAULT_PROPS.layout,
|
|
68
|
+
position = DEFAULT_PROPS.position,
|
|
69
69
|
theme = defaultTheme,
|
|
70
70
|
...forwardedProps
|
|
71
71
|
} = props;
|
|
@@ -37,7 +37,7 @@ export const TabProvider: React.FC<TabProviderProps> = (props) => {
|
|
|
37
37
|
// On prop state change => dispatch update.
|
|
38
38
|
useEffect(
|
|
39
39
|
() => {
|
|
40
|
-
dispatch({ type: 'update', payload: propState });
|
|
40
|
+
dispatch({ type: 'update', payload: { ...DEFAULT_PROPS, ...propState } });
|
|
41
41
|
},
|
|
42
42
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
43
43
|
[dispatch, ...Object.values(propState)],
|