@lumx/react 3.10.1-alpha.7 → 3.11.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/index.d.ts +86 -12
- package/index.js +318 -304
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/alert-dialog/AlertDialog.tsx +6 -3
- package/src/components/autocomplete/Autocomplete.stories.tsx +1 -2
- package/src/components/autocomplete/Autocomplete.tsx +3 -3
- package/src/components/autocomplete/AutocompleteMultiple.stories.tsx +2 -5
- package/src/components/autocomplete/AutocompleteMultiple.tsx +2 -2
- package/src/components/avatar/Avatar.tsx +3 -3
- package/src/components/badge/Badge.tsx +3 -3
- package/src/components/badge/BadgeWrapper.tsx +3 -2
- package/src/components/button/Button.tsx +9 -8
- package/src/components/button/ButtonGroup.tsx +9 -3
- package/src/components/button/ButtonRoot.tsx +6 -2
- package/src/components/button/IconButton.tsx +2 -2
- package/src/components/checkbox/Checkbox.tsx +4 -4
- package/src/components/chip/Chip.tsx +15 -9
- package/src/components/chip/ChipGroup.tsx +3 -2
- package/src/components/comment-block/CommentBlock.stories.tsx +4 -7
- package/src/components/comment-block/CommentBlock.tsx +3 -3
- package/src/components/date-picker/constants.ts +2 -2
- package/src/components/dialog/Dialog.tsx +9 -7
- package/src/components/divider/Divider.tsx +3 -3
- package/src/components/drag-handle/DragHandle.tsx +3 -3
- package/src/components/dropdown/Dropdown.tsx +4 -3
- package/src/components/expansion-panel/ExpansionPanel.tsx +26 -20
- package/src/components/flag/Flag.tsx +3 -3
- package/src/components/flex-box/FlexBox.tsx +4 -4
- package/src/components/generic-block/GenericBlock.tsx +10 -8
- package/src/components/generic-block/constants.ts +4 -9
- package/src/components/grid/Grid.tsx +5 -3
- package/src/components/grid/GridItem.tsx +5 -3
- package/src/components/grid-column/GridColumn.tsx +5 -3
- package/src/components/heading/Heading.tsx +7 -2
- package/src/components/icon/Icon.tsx +3 -3
- package/src/components/image-block/ImageBlock.tsx +3 -3
- package/src/components/image-lightbox/ImageLightbox.tsx +1 -1
- package/src/components/image-lightbox/constants.ts +2 -2
- package/src/components/image-lightbox/internal/ImageSlide.tsx +1 -1
- package/src/components/image-lightbox/internal/ImageSlideshow.tsx +9 -5
- package/src/components/image-lightbox/useImageLightbox.tsx +2 -1
- package/src/components/inline-list/InlineList.tsx +7 -3
- package/src/components/input-helper/InputHelper.tsx +3 -3
- package/src/components/input-label/InputLabel.tsx +3 -3
- package/src/components/lightbox/Lightbox.tsx +6 -4
- package/src/components/link/Link.tsx +11 -7
- package/src/components/link-preview/LinkPreview.tsx +3 -3
- package/src/components/list/List.tsx +4 -4
- package/src/components/list/ListDivider.tsx +3 -2
- package/src/components/list/ListItem.tsx +6 -5
- package/src/components/list/ListSubheader.tsx +3 -2
- package/src/components/list/useInteractiveList.tsx +7 -6
- package/src/components/message/Message.tsx +3 -3
- package/src/components/mosaic/Mosaic.test.tsx +3 -3
- package/src/components/mosaic/Mosaic.tsx +6 -5
- package/src/components/navigation/Navigation.stories.tsx +2 -2
- package/src/components/navigation/Navigation.tsx +3 -3
- package/src/components/navigation/NavigationItem.tsx +3 -9
- package/src/components/navigation/NavigationSection.tsx +3 -3
- package/src/components/notification/Notification.tsx +9 -5
- package/src/components/popover/Popover.stories.tsx +13 -15
- package/src/components/popover/Popover.test.tsx +6 -1
- package/src/components/popover/Popover.tsx +6 -6
- package/src/components/popover/usePopoverStyle.tsx +1 -3
- package/src/components/popover/useRestoreFocusOnClose.tsx +1 -1
- package/src/components/popover-dialog/PopoverDialog.tsx +3 -2
- package/src/components/post-block/PostBlock.tsx +11 -7
- package/src/components/progress/Progress.tsx +3 -3
- package/src/components/progress/ProgressCircular.tsx +3 -3
- package/src/components/progress/ProgressLinear.tsx +3 -3
- package/src/components/progress-tracker/ProgressTracker.stories.tsx +11 -11
- package/src/components/progress-tracker/ProgressTracker.tsx +4 -3
- package/src/components/progress-tracker/ProgressTrackerStep.tsx +3 -3
- package/src/components/progress-tracker/ProgressTrackerStepPanel.tsx +2 -0
- package/src/components/radio-button/RadioButton.tsx +3 -3
- package/src/components/radio-button/RadioGroup.stories.tsx +1 -4
- package/src/components/radio-button/RadioGroup.tsx +3 -2
- package/src/components/select/Select.stories.tsx +19 -38
- package/src/components/select/Select.tsx +5 -5
- package/src/components/select/SelectMultiple.stories.tsx +15 -30
- package/src/components/select/SelectMultiple.tsx +3 -4
- package/src/components/select/WithSelectContext.tsx +3 -4
- package/src/components/select/constants.ts +3 -1
- package/src/components/side-navigation/SideNavigation.stories.tsx +1 -1
- package/src/components/side-navigation/SideNavigation.tsx +4 -3
- package/src/components/side-navigation/SideNavigationItem.tsx +7 -7
- package/src/components/skeleton/SkeletonCircle.tsx +3 -3
- package/src/components/skeleton/SkeletonRectangle.tsx +3 -3
- package/src/components/skeleton/SkeletonTypography.stories.tsx +7 -12
- package/src/components/skeleton/SkeletonTypography.tsx +3 -3
- package/src/components/slider/Slider.tsx +4 -4
- package/src/components/slider/index.ts +1 -1
- package/src/components/slideshow/Slides.tsx +6 -4
- package/src/components/slideshow/Slideshow.stories.tsx +1 -3
- package/src/components/slideshow/Slideshow.tsx +3 -1
- package/src/components/slideshow/SlideshowControls.stories.tsx +1 -4
- package/src/components/slideshow/SlideshowControls.tsx +4 -4
- package/src/components/slideshow/SlideshowItem.tsx +5 -2
- package/src/components/slideshow/SlideshowItemGroup.tsx +5 -3
- package/src/components/switch/Switch.test.tsx +1 -1
- package/src/components/switch/Switch.tsx +7 -4
- package/src/components/table/Table.tsx +5 -3
- package/src/components/table/TableBody.tsx +7 -3
- package/src/components/table/TableCell.tsx +5 -3
- package/src/components/table/TableHeader.tsx +7 -3
- package/src/components/table/TableRow.tsx +5 -3
- package/src/components/tabs/TabList.tsx +1 -1
- package/src/components/tabs/TabPanel.tsx +2 -0
- package/src/components/tabs/Tabs.stories.tsx +12 -11
- package/src/components/text/Text.tsx +14 -5
- package/src/components/text-field/TextField.test.tsx +2 -2
- package/src/components/text-field/TextField.tsx +8 -7
- package/src/components/thumbnail/Thumbnail.tsx +4 -4
- package/src/components/toolbar/Toolbar.tsx +3 -3
- package/src/components/tooltip/Tooltip.tsx +4 -4
- package/src/components/tooltip/context.tsx +1 -1
- package/src/components/tooltip/useInjectTooltipRef.tsx +1 -1
- package/src/components/uploader/Uploader.tsx +3 -3
- package/src/components/user-block/UserBlock.tsx +12 -10
- package/src/hooks/useCallbackOnEscape.ts +1 -1
- package/src/hooks/useClickAway.tsx +2 -1
- package/src/hooks/useFocusTrap.ts +1 -1
- package/src/hooks/useInterval.tsx +4 -1
- package/src/hooks/useKeyboardListNavigation.tsx +4 -2
- package/src/hooks/useSizeOnWindowResize.ts +10 -14
- package/src/hooks/useStopPropagation.ts +2 -1
- package/src/stories/decorators/withCombinations.tsx +1 -1
- package/src/testing/utils/commonTestsSuiteRTL.tsx +2 -2
- package/src/utils/ClickAwayProvider/ClickAwayProvider.tsx +4 -0
- package/src/utils/className/getRootClassName.test.ts +11 -0
- package/src/utils/className/getRootClassName.ts +24 -0
- package/src/utils/className/index.ts +1 -0
- package/src/utils/date/getMonthCalendar.ts +4 -3
- package/src/utils/{makeListenerTowerContext.ts → function/makeListenerTowerContext.ts} +2 -2
- package/src/utils/{collection/partitionMulti.ts → partitionMulti.ts} +12 -13
- package/src/utils/{flattenChildren.ts → react/flattenChildren.ts} +3 -2
- package/src/utils/{renderButtonOrLink.tsx → react/renderButtonOrLink.tsx} +1 -1
- package/src/utils/{skipRender.tsx → react/skipRender.tsx} +1 -1
- package/src/utils/type/index.ts +18 -18
- package/src/utils/type/isComponent.ts +33 -0
- package/utils/index.d.ts +4 -0
- package/utils/index.js +96 -1
- package/utils/index.js.map +1 -1
- package/_internal/index.js +0 -99
- package/_internal/index.js.map +0 -1
- package/src/utils/className.test.js +0 -41
- package/src/utils/collection/castArray.test.ts +0 -15
- package/src/utils/collection/castArray.ts +0 -3
- package/src/utils/collection/chunk.test.ts +0 -15
- package/src/utils/collection/chunk.ts +0 -6
- package/src/utils/collection/isEmpty.test.js +0 -20
- package/src/utils/collection/isEmpty.ts +0 -4
- package/src/utils/collection/last.ts +0 -2
- package/src/utils/collection/partitionMulti.test.ts +0 -35
- package/src/utils/collection/pull.test.ts +0 -17
- package/src/utils/collection/pull.ts +0 -7
- package/src/utils/collection/range.test.js +0 -9
- package/src/utils/collection/range.ts +0 -2
- package/src/utils/function/memoize.test.ts +0 -36
- package/src/utils/function/memoize.ts +0 -13
- package/src/utils/type/ComponentClassName.ts +0 -7
- package/src/utils/type/KebabCase.ts +0 -6
- /package/src/utils/{clamp.ts → number/clamp.ts} +0 -0
- /package/src/utils/{OnBeforeUnmount.tsx → react/OnBeforeUnmount.tsx} +0 -0
- /package/src/utils/{mergeRefs.ts → react/mergeRefs.ts} +0 -0
- /package/src/utils/{renderLink.tsx → react/renderLink.tsx} +0 -0
|
@@ -3,7 +3,8 @@ import React, { Children, ReactNode } from 'react';
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
|
|
5
5
|
import { SideNavigationItem, Theme } from '@lumx/react';
|
|
6
|
-
import {
|
|
6
|
+
import { GenericProps, HasTheme, isComponent } from '@lumx/react/utils/type';
|
|
7
|
+
import { getRootClassName } from '@lumx/react/utils/className';
|
|
7
8
|
import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
8
9
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
9
10
|
|
|
@@ -23,7 +24,7 @@ const COMPONENT_NAME = 'SideNavigation';
|
|
|
23
24
|
/**
|
|
24
25
|
* Component default class name and class prefix.
|
|
25
26
|
*/
|
|
26
|
-
const CLASSNAME
|
|
27
|
+
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* SideNavigation component.
|
|
@@ -35,7 +36,7 @@ const CLASSNAME: ComponentClassName<typeof COMPONENT_NAME> = 'lumx-side-navigati
|
|
|
35
36
|
export const SideNavigation = forwardRef<SideNavigationProps, HTMLUListElement>((props, ref) => {
|
|
36
37
|
const defaultTheme = useTheme();
|
|
37
38
|
const { children, className, theme = defaultTheme, ...forwardedProps } = props;
|
|
38
|
-
const content = Children.toArray(children).filter(
|
|
39
|
+
const content = Children.toArray(children).filter(isComponent(SideNavigationItem));
|
|
39
40
|
|
|
40
41
|
return (
|
|
41
42
|
<ul
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import React, { Children, ReactNode } from 'react';
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
+
import isEmpty from 'lodash/isEmpty';
|
|
4
5
|
|
|
5
6
|
import { mdiChevronDown, mdiChevronUp } from '@lumx/icons';
|
|
6
7
|
import { Emphasis, Icon, Size, IconButton, IconButtonProps } from '@lumx/react';
|
|
7
|
-
import {
|
|
8
|
-
import { handleBasicClasses } from '@lumx/react/utils/className';
|
|
9
|
-
import { renderLink } from '@lumx/react/utils/renderLink';
|
|
10
|
-
import { renderButtonOrLink } from '@lumx/react/utils/renderButtonOrLink';
|
|
8
|
+
import { GenericProps, HasCloseMode, isComponent } from '@lumx/react/utils/type';
|
|
9
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';
|
|
10
|
+
import { renderLink } from '@lumx/react/utils/react/renderLink';
|
|
11
|
+
import { renderButtonOrLink } from '@lumx/react/utils/react/renderButtonOrLink';
|
|
11
12
|
import { useId } from '@lumx/react/hooks/useId';
|
|
12
13
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
13
|
-
import { isEmpty } from '@lumx/react/utils/collection/isEmpty';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Defines the props of the component.
|
|
@@ -49,7 +49,7 @@ const COMPONENT_NAME = 'SideNavigationItem';
|
|
|
49
49
|
/**
|
|
50
50
|
* Component default class name and class prefix.
|
|
51
51
|
*/
|
|
52
|
-
const CLASSNAME
|
|
52
|
+
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* Component default props.
|
|
@@ -84,7 +84,7 @@ export const SideNavigationItem = forwardRef<SideNavigationItemProps, HTMLLIElem
|
|
|
84
84
|
...forwardedProps
|
|
85
85
|
} = props;
|
|
86
86
|
|
|
87
|
-
const content = children && Children.toArray(children).filter(
|
|
87
|
+
const content = children && Children.toArray(children).filter(isComponent(SideNavigationItem));
|
|
88
88
|
const hasContent = !isEmpty(content);
|
|
89
89
|
const shouldSplitActions = Boolean(onActionClick);
|
|
90
90
|
const showChildren = hasContent && isOpen;
|
|
@@ -3,8 +3,8 @@ import React from 'react';
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
|
|
5
5
|
import { GlobalSize, Theme, ColorPalette } from '@lumx/react';
|
|
6
|
-
import
|
|
7
|
-
import { handleBasicClasses } from '@lumx/react/utils/className';
|
|
6
|
+
import { GenericProps, HasTheme } from '@lumx/react/utils/type';
|
|
7
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';
|
|
8
8
|
import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
9
9
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
10
10
|
|
|
@@ -28,7 +28,7 @@ const COMPONENT_NAME = 'SkeletonCircle';
|
|
|
28
28
|
/**
|
|
29
29
|
* Component default class name and class prefix.
|
|
30
30
|
*/
|
|
31
|
-
const CLASSNAME
|
|
31
|
+
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* SkeletonCircle component.
|
|
@@ -3,8 +3,8 @@ import React from 'react';
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
|
|
5
5
|
import { AspectRatio, GlobalSize, Theme, ColorPalette } from '@lumx/react';
|
|
6
|
-
import
|
|
7
|
-
import { handleBasicClasses } from '@lumx/react/utils/className';
|
|
6
|
+
import { GenericProps, HasTheme, ValueOf } from '@lumx/react/utils/type';
|
|
7
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';
|
|
8
8
|
import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
9
9
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
10
10
|
|
|
@@ -42,7 +42,7 @@ const COMPONENT_NAME = 'SkeletonRectangle';
|
|
|
42
42
|
/**
|
|
43
43
|
* Component default class name and class prefix.
|
|
44
44
|
*/
|
|
45
|
-
const CLASSNAME
|
|
45
|
+
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
48
|
* SkeletonRectangle component.
|
|
@@ -6,21 +6,16 @@ export default { title: 'LumX components/skeleton/Skeleton Typography' };
|
|
|
6
6
|
|
|
7
7
|
const colors = Object.values(ColorPalette);
|
|
8
8
|
|
|
9
|
-
export const TextTypography = (
|
|
9
|
+
export const TextTypography = () => (
|
|
10
10
|
<>
|
|
11
|
-
<SkeletonTypography
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/>
|
|
17
|
-
<SkeletonTypography theme={theme} typography={Typography.body1} />
|
|
18
|
-
<SkeletonTypography theme={theme} typography={Typography.body1} />
|
|
19
|
-
<SkeletonTypography theme={theme} typography={Typography.body1} />
|
|
20
|
-
<SkeletonTypography theme={theme} typography={Typography.body1} width="70%" />
|
|
11
|
+
<SkeletonTypography typography={Typography.title} width="30%" className="lumx-spacing-margin-bottom" />
|
|
12
|
+
<SkeletonTypography typography={Typography.body1} />
|
|
13
|
+
<SkeletonTypography typography={Typography.body1} />
|
|
14
|
+
<SkeletonTypography typography={Typography.body1} />
|
|
15
|
+
<SkeletonTypography typography={Typography.body1} width="70%" />
|
|
21
16
|
Colors:
|
|
22
17
|
{colors.map((color) => (
|
|
23
|
-
<SkeletonTypography key={color} color={color}
|
|
18
|
+
<SkeletonTypography key={color} color={color} typography={Typography.body1} />
|
|
24
19
|
))}
|
|
25
20
|
</>
|
|
26
21
|
);
|
|
@@ -3,8 +3,8 @@ import React, { CSSProperties } from 'react';
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
|
|
5
5
|
import { Theme, TypographyInterface, ColorPalette } from '@lumx/react';
|
|
6
|
-
import
|
|
7
|
-
import { handleBasicClasses } from '@lumx/react/utils/className';
|
|
6
|
+
import { GenericProps, HasTheme } from '@lumx/react/utils/type';
|
|
7
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';
|
|
8
8
|
import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
9
9
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
10
10
|
|
|
@@ -30,7 +30,7 @@ const COMPONENT_NAME = 'SkeletonTypography';
|
|
|
30
30
|
/**
|
|
31
31
|
* Component default class name and class prefix.
|
|
32
32
|
*/
|
|
33
|
-
const CLASSNAME
|
|
33
|
+
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* SkeletonTypography component.
|
|
@@ -5,9 +5,9 @@ import classNames from 'classnames';
|
|
|
5
5
|
|
|
6
6
|
import { InputHelper, InputLabel, Theme } from '@lumx/react';
|
|
7
7
|
import useEventCallback from '@lumx/react/hooks/useEventCallback';
|
|
8
|
-
import
|
|
9
|
-
import { handleBasicClasses } from '@lumx/react/utils/className';
|
|
10
|
-
import { clamp } from '@lumx/react/utils/clamp';
|
|
8
|
+
import { GenericProps, HasTheme } from '@lumx/react/utils/type';
|
|
9
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';
|
|
10
|
+
import { clamp } from '@lumx/react/utils/number/clamp';
|
|
11
11
|
import { useId } from '@lumx/react/hooks/useId';
|
|
12
12
|
import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
13
13
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
@@ -50,7 +50,7 @@ const COMPONENT_NAME = 'Slider';
|
|
|
50
50
|
/**
|
|
51
51
|
* Component default class name and class prefix.
|
|
52
52
|
*/
|
|
53
|
-
const CLASSNAME
|
|
53
|
+
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
56
|
* Component default props.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './Slider';
|
|
2
|
-
export { clamp } from '@lumx/react/utils/clamp';
|
|
2
|
+
export { clamp } from '@lumx/react/utils/number/clamp';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React, { Children, CSSProperties } from 'react';
|
|
2
2
|
|
|
3
|
+
import chunk from 'lodash/chunk';
|
|
3
4
|
import classNames from 'classnames';
|
|
4
5
|
|
|
5
6
|
import { FULL_WIDTH_PERCENT } from '@lumx/react/components/slideshow/constants';
|
|
6
|
-
import
|
|
7
|
-
import { handleBasicClasses } from '@lumx/react/utils/className';
|
|
7
|
+
import { GenericProps, HasTheme } from '@lumx/react/utils/type';
|
|
8
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';
|
|
8
9
|
import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
9
10
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
10
|
-
import { chunk } from '@lumx/react/utils/collection/chunk';
|
|
11
11
|
|
|
12
12
|
import { buildSlideShowGroupId, SlideshowItemGroup } from './SlideshowItemGroup';
|
|
13
13
|
|
|
@@ -37,6 +37,8 @@ export interface SlidesProps extends GenericProps, HasTheme {
|
|
|
37
37
|
* Receives the group position starting from 1 and the total number of groups.
|
|
38
38
|
* */
|
|
39
39
|
slideGroupLabel?: (groupPosition: number, groupTotal: number) => string;
|
|
40
|
+
/** Children */
|
|
41
|
+
children?: React.ReactNode;
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
/**
|
|
@@ -47,7 +49,7 @@ const COMPONENT_NAME = 'Slideshow';
|
|
|
47
49
|
/**
|
|
48
50
|
* Component default class name and class prefix.
|
|
49
51
|
*/
|
|
50
|
-
const CLASSNAME
|
|
52
|
+
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
51
53
|
|
|
52
54
|
/**
|
|
53
55
|
* Slides component.
|
|
@@ -15,7 +15,7 @@ export default {
|
|
|
15
15
|
},
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
export const Simple = ({
|
|
18
|
+
export const Simple = ({ images = Object.values(LANDSCAPE_IMAGES), ...props }: any) => {
|
|
19
19
|
return (
|
|
20
20
|
<Slideshow
|
|
21
21
|
aria-label="Simple carousel example"
|
|
@@ -23,7 +23,6 @@ export const Simple = ({ theme, images = Object.values(LANDSCAPE_IMAGES), ...pro
|
|
|
23
23
|
nextButtonProps: { label: 'Next' },
|
|
24
24
|
previousButtonProps: { label: 'Previous' },
|
|
25
25
|
}}
|
|
26
|
-
theme={theme}
|
|
27
26
|
{...props}
|
|
28
27
|
style={{ width: '50%' }}
|
|
29
28
|
slideGroupLabel={(currentGroup, totalGroup) => `${currentGroup} of ${totalGroup}`}
|
|
@@ -34,7 +33,6 @@ export const Simple = ({ theme, images = Object.values(LANDSCAPE_IMAGES), ...pro
|
|
|
34
33
|
thumbnailProps={{ aspectRatio: AspectRatio.horizontal, loading: 'eager' }}
|
|
35
34
|
image={image}
|
|
36
35
|
alt=""
|
|
37
|
-
theme={theme}
|
|
38
36
|
/>
|
|
39
37
|
</SlideshowItem>
|
|
40
38
|
))}
|
|
@@ -4,7 +4,7 @@ import { SlideshowControls, SlideshowControlsProps, Theme, Slides, SlidesProps }
|
|
|
4
4
|
import { DEFAULT_OPTIONS } from '@lumx/react/hooks/useSlideshowControls';
|
|
5
5
|
import { GenericProps } from '@lumx/react/utils/type';
|
|
6
6
|
import { useFocusWithin } from '@lumx/react/hooks/useFocusWithin';
|
|
7
|
-
import { mergeRefs } from '@lumx/react/utils/mergeRefs';
|
|
7
|
+
import { mergeRefs } from '@lumx/react/utils/react/mergeRefs';
|
|
8
8
|
import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
9
9
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
10
10
|
|
|
@@ -37,6 +37,8 @@ export interface SlideshowProps
|
|
|
37
37
|
>;
|
|
38
38
|
/** Callback when slide changes */
|
|
39
39
|
onChange?(index: number): void;
|
|
40
|
+
/** Children */
|
|
41
|
+
children?: React.ReactNode;
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
/**
|
|
@@ -26,7 +26,7 @@ export const Simple = () => {
|
|
|
26
26
|
);
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
export const ControllingSlideshow = ({ images = Object.values(LANDSCAPE_IMAGES)
|
|
29
|
+
export const ControllingSlideshow = ({ images = Object.values(LANDSCAPE_IMAGES) }: any) => {
|
|
30
30
|
const {
|
|
31
31
|
activeIndex: currentIndex,
|
|
32
32
|
slideshowId,
|
|
@@ -61,7 +61,6 @@ export const ControllingSlideshow = ({ images = Object.values(LANDSCAPE_IMAGES),
|
|
|
61
61
|
activeIndex={currentIndex}
|
|
62
62
|
id={slideshowId}
|
|
63
63
|
ref={setSlideshow}
|
|
64
|
-
theme={theme}
|
|
65
64
|
isAutoPlaying={isAutoPlaying}
|
|
66
65
|
slidesId={slideshowSlidesId}
|
|
67
66
|
toggleAutoPlay={toggleAutoPlay}
|
|
@@ -76,7 +75,6 @@ export const ControllingSlideshow = ({ images = Object.values(LANDSCAPE_IMAGES),
|
|
|
76
75
|
onPreviousClick={onPreviousClick}
|
|
77
76
|
slidesCount={slidesCount}
|
|
78
77
|
parentRef={slideshow}
|
|
79
|
-
theme={theme}
|
|
80
78
|
isAutoPlaying={isAutoPlaying}
|
|
81
79
|
nextButtonProps={{ label: 'Next', 'aria-controls': slideshowSlidesId }}
|
|
82
80
|
previousButtonProps={{ label: 'Previous', 'aria-controls': slideshowSlidesId }}
|
|
@@ -96,7 +94,6 @@ export const ControllingSlideshow = ({ images = Object.values(LANDSCAPE_IMAGES),
|
|
|
96
94
|
thumbnailProps={{ aspectRatio: AspectRatio.horizontal, loading: 'eager' }}
|
|
97
95
|
image={image}
|
|
98
96
|
alt=""
|
|
99
|
-
theme={theme}
|
|
100
97
|
/>
|
|
101
98
|
</SlideshowItem>
|
|
102
99
|
))}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React, { RefObject, useCallback, useMemo } from 'react';
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
+
import range from 'lodash/range';
|
|
4
5
|
|
|
5
6
|
import { mdiChevronLeft, mdiChevronRight, mdiPlayCircleOutline, mdiPauseCircleOutline } from '@lumx/icons';
|
|
6
7
|
import { Emphasis, IconButton, IconButtonProps, Theme } from '@lumx/react';
|
|
7
|
-
import
|
|
8
|
-
import { handleBasicClasses } from '@lumx/react/utils/className';
|
|
8
|
+
import { GenericProps, HasTheme } from '@lumx/react/utils/type';
|
|
9
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';
|
|
9
10
|
import { WINDOW } from '@lumx/react/constants';
|
|
10
11
|
import { useSlideshowControls, DEFAULT_OPTIONS } from '@lumx/react/hooks/useSlideshowControls';
|
|
11
12
|
import { useRovingTabIndex } from '@lumx/react/hooks/useRovingTabIndex';
|
|
@@ -15,7 +16,6 @@ import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
|
15
16
|
import { useSwipeNavigate } from './useSwipeNavigate';
|
|
16
17
|
import { PAGINATION_ITEM_SIZE, PAGINATION_ITEMS_MAX } from './constants';
|
|
17
18
|
import { usePaginationVisibleRange } from './usePaginationVisibleRange';
|
|
18
|
-
import { range } from '@lumx/react/utils/collection/range';
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Defines the props of the component.
|
|
@@ -65,7 +65,7 @@ const COMPONENT_NAME = 'SlideshowControls';
|
|
|
65
65
|
/**
|
|
66
66
|
* Component default class name and class prefix.
|
|
67
67
|
*/
|
|
68
|
-
const CLASSNAME
|
|
68
|
+
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
71
|
* Component default props.
|
|
@@ -2,7 +2,8 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import { GenericProps } from '@lumx/react/utils/type';
|
|
6
|
+
import { getRootClassName } from '@lumx/react/utils/className';
|
|
6
7
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -11,6 +12,8 @@ import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
|
11
12
|
export interface SlideshowItemProps extends GenericProps {
|
|
12
13
|
/** interval in which slides are automatically shown */
|
|
13
14
|
interval?: number;
|
|
15
|
+
/** Children */
|
|
16
|
+
children?: React.ReactNode;
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
/**
|
|
@@ -21,7 +24,7 @@ const COMPONENT_NAME = 'SlideshowItem';
|
|
|
21
24
|
/**
|
|
22
25
|
* Component default class name and class prefix.
|
|
23
26
|
*/
|
|
24
|
-
const CLASSNAME
|
|
27
|
+
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
25
28
|
|
|
26
29
|
/**
|
|
27
30
|
* SlideshowItem component.
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import { mergeRefs } from '@lumx/react/utils/mergeRefs';
|
|
5
|
-
import
|
|
4
|
+
import { mergeRefs } from '@lumx/react/utils/react/mergeRefs';
|
|
5
|
+
import { GenericProps } from '@lumx/react/utils/type';
|
|
6
|
+
import { getRootClassName } from '@lumx/react/utils/className';
|
|
6
7
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
7
8
|
import { useSlideFocusManagement } from './useSlideFocusManagement';
|
|
8
9
|
|
|
@@ -13,6 +14,7 @@ export interface SlideshowItemGroupProps extends GenericProps {
|
|
|
13
14
|
role?: 'tabpanel' | 'group';
|
|
14
15
|
label?: string;
|
|
15
16
|
isDisplayed?: boolean;
|
|
17
|
+
children?: React.ReactNode;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
/**
|
|
@@ -23,7 +25,7 @@ const COMPONENT_NAME = 'SlideshowItemGroup';
|
|
|
23
25
|
/**
|
|
24
26
|
* Component default class name and class prefix.
|
|
25
27
|
*/
|
|
26
|
-
export const CLASSNAME
|
|
28
|
+
export const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
27
29
|
|
|
28
30
|
export const buildSlideShowGroupId = (slidesId: string, index: number) => `${slidesId}-slide-${index}`;
|
|
29
31
|
|
|
@@ -69,7 +69,7 @@ describe(`<${Switch.displayName}>`, () => {
|
|
|
69
69
|
expect(helper).toHaveAttribute('id');
|
|
70
70
|
|
|
71
71
|
expect(label).toBeInTheDocument();
|
|
72
|
-
expect(label).toHaveTextContent(props.children);
|
|
72
|
+
expect(label).toHaveTextContent(props.children as string);
|
|
73
73
|
expect(label).toHaveAttribute('for', id);
|
|
74
74
|
|
|
75
75
|
expect(input).toHaveAttribute('id', id);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React, { Children, InputHTMLAttributes, SyntheticEvent } from 'react';
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
+
import isEmpty from 'lodash/isEmpty';
|
|
4
5
|
|
|
5
6
|
import { Alignment, InputHelper, InputLabel, Theme } from '@lumx/react';
|
|
6
|
-
import
|
|
7
|
-
import { handleBasicClasses } from '@lumx/react/utils/className';
|
|
7
|
+
import { GenericProps, HasTheme } from '@lumx/react/utils/type';
|
|
8
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';
|
|
8
9
|
import { useId } from '@lumx/react/hooks/useId';
|
|
9
10
|
import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
10
11
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
@@ -29,6 +30,8 @@ export interface SwitchProps extends GenericProps, HasTheme {
|
|
|
29
30
|
onChange?(isChecked: boolean, value?: string, name?: string, event?: SyntheticEvent): void;
|
|
30
31
|
/** optional props for input */
|
|
31
32
|
inputProps?: InputHTMLAttributes<HTMLInputElement>;
|
|
33
|
+
/** Children */
|
|
34
|
+
children?: React.ReactNode;
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
/**
|
|
@@ -39,7 +42,7 @@ const COMPONENT_NAME = 'Switch';
|
|
|
39
42
|
/**
|
|
40
43
|
* Component default class name and class prefix.
|
|
41
44
|
*/
|
|
42
|
-
const CLASSNAME
|
|
45
|
+
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
43
46
|
|
|
44
47
|
/**
|
|
45
48
|
* Component default props.
|
|
@@ -126,7 +129,7 @@ export const Switch = forwardRef<SwitchProps, HTMLDivElement>((props, ref) => {
|
|
|
126
129
|
<InputLabel htmlFor={inputId} theme={theme} className={`${CLASSNAME}__label`}>
|
|
127
130
|
{children}
|
|
128
131
|
</InputLabel>
|
|
129
|
-
{helper && (
|
|
132
|
+
{!isEmpty(helper) && (
|
|
130
133
|
<InputHelper id={`${inputId}-helper`} theme={theme} className={`${CLASSNAME}__helper`}>
|
|
131
134
|
{helper}
|
|
132
135
|
</InputHelper>
|
|
@@ -3,8 +3,8 @@ import React from 'react';
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
|
|
5
5
|
import { Theme } from '@lumx/react';
|
|
6
|
-
import
|
|
7
|
-
import { handleBasicClasses } from '@lumx/react/utils/className';
|
|
6
|
+
import { GenericProps, HasTheme } from '@lumx/react/utils/type';
|
|
7
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';
|
|
8
8
|
import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
9
9
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
10
10
|
|
|
@@ -16,6 +16,8 @@ export interface TableProps extends GenericProps, HasTheme {
|
|
|
16
16
|
hasBefore?: boolean;
|
|
17
17
|
/** Whether the table has dividers or not. */
|
|
18
18
|
hasDividers?: boolean;
|
|
19
|
+
/** Children */
|
|
20
|
+
children?: React.ReactNode;
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
/**
|
|
@@ -26,7 +28,7 @@ const COMPONENT_NAME = 'Table';
|
|
|
26
28
|
/**
|
|
27
29
|
* Component default class name and class prefix.
|
|
28
30
|
*/
|
|
29
|
-
const CLASSNAME
|
|
31
|
+
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
30
32
|
|
|
31
33
|
/**
|
|
32
34
|
* Component default props.
|
|
@@ -2,13 +2,17 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import { GenericProps } from '@lumx/react/utils/type';
|
|
6
|
+
import { getRootClassName } from '@lumx/react/utils/className';
|
|
6
7
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Defines the props of the component.
|
|
10
11
|
*/
|
|
11
|
-
export
|
|
12
|
+
export interface TableBodyProps extends GenericProps {
|
|
13
|
+
/** Children */
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
}
|
|
12
16
|
|
|
13
17
|
/**
|
|
14
18
|
* Component display name.
|
|
@@ -18,7 +22,7 @@ const COMPONENT_NAME = 'TableBody';
|
|
|
18
22
|
/**
|
|
19
23
|
* Component default class name and class prefix.
|
|
20
24
|
*/
|
|
21
|
-
const CLASSNAME
|
|
25
|
+
const CLASSNAME = getRootClassName(COMPONENT_NAME, true);
|
|
22
26
|
|
|
23
27
|
/**
|
|
24
28
|
* TableBody component.
|
|
@@ -4,8 +4,8 @@ import classNames from 'classnames';
|
|
|
4
4
|
|
|
5
5
|
import { mdiArrowDown, mdiArrowUp } from '@lumx/icons';
|
|
6
6
|
import { Icon, Size } from '@lumx/react';
|
|
7
|
-
import
|
|
8
|
-
import { handleBasicClasses } from '@lumx/react/utils/className';
|
|
7
|
+
import { GenericProps, ValueOf } from '@lumx/react/utils/type';
|
|
8
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';
|
|
9
9
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -34,6 +34,8 @@ export interface TableCellProps extends GenericProps {
|
|
|
34
34
|
variant?: TableCellVariant;
|
|
35
35
|
/** On header cell click callback. */
|
|
36
36
|
onHeaderClick?(): void;
|
|
37
|
+
/** Children */
|
|
38
|
+
children?: React.ReactNode;
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
/**
|
|
@@ -44,7 +46,7 @@ const COMPONENT_NAME = 'TableCell';
|
|
|
44
46
|
/**
|
|
45
47
|
* Component default class name and class prefix.
|
|
46
48
|
*/
|
|
47
|
-
const CLASSNAME
|
|
49
|
+
const CLASSNAME = getRootClassName(COMPONENT_NAME, true);
|
|
48
50
|
|
|
49
51
|
/**
|
|
50
52
|
* Component default props.
|
|
@@ -2,13 +2,17 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import { GenericProps } from '@lumx/react/utils/type';
|
|
6
|
+
import { getRootClassName } from '@lumx/react/utils/className';
|
|
6
7
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Defines the props of the component.
|
|
10
11
|
*/
|
|
11
|
-
export
|
|
12
|
+
export interface TableHeaderProps extends GenericProps {
|
|
13
|
+
/** Children */
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
}
|
|
12
16
|
|
|
13
17
|
/**
|
|
14
18
|
* Component display name.
|
|
@@ -18,7 +22,7 @@ const COMPONENT_NAME = 'TableHeader';
|
|
|
18
22
|
/**
|
|
19
23
|
* Component default class name and class prefix.
|
|
20
24
|
*/
|
|
21
|
-
const CLASSNAME
|
|
25
|
+
const CLASSNAME = getRootClassName(COMPONENT_NAME, true);
|
|
22
26
|
|
|
23
27
|
/**
|
|
24
28
|
* Component default props.
|
|
@@ -2,8 +2,8 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import { handleBasicClasses } from '@lumx/react/utils/className';
|
|
5
|
+
import { GenericProps } from '@lumx/react/utils/type';
|
|
6
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';
|
|
7
7
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -16,6 +16,8 @@ export interface TableRowProps extends GenericProps {
|
|
|
16
16
|
isDisabled?: boolean;
|
|
17
17
|
/** Whether the component is selected or not. */
|
|
18
18
|
isSelected?: boolean;
|
|
19
|
+
/** Children */
|
|
20
|
+
children?: React.ReactNode;
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
/**
|
|
@@ -26,7 +28,7 @@ const COMPONENT_NAME = 'TableRow';
|
|
|
26
28
|
/**
|
|
27
29
|
* Component default class name and class prefix.
|
|
28
30
|
*/
|
|
29
|
-
const CLASSNAME
|
|
31
|
+
const CLASSNAME = getRootClassName(COMPONENT_NAME, true);
|
|
30
32
|
|
|
31
33
|
/**
|
|
32
34
|
* Component default props.
|
|
@@ -6,7 +6,7 @@ import { Alignment, Theme } from '@lumx/react';
|
|
|
6
6
|
import { CSS_PREFIX } from '@lumx/react/constants';
|
|
7
7
|
import { GenericProps, HasTheme } from '@lumx/react/utils/type';
|
|
8
8
|
import { handleBasicClasses } from '@lumx/react/utils/className';
|
|
9
|
-
import { mergeRefs } from '@lumx/react/utils/mergeRefs';
|
|
9
|
+
import { mergeRefs } from '@lumx/react/utils/react/mergeRefs';
|
|
10
10
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
11
11
|
import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
12
12
|
|