@lumx/react 3.18.2-alpha.4 → 3.19.1-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/index.d.ts +201 -117
- package/index.js +470 -480
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/alert-dialog/AlertDialog.tsx +1 -1
- package/src/components/autocomplete/Autocomplete.tsx +1 -1
- package/src/components/autocomplete/AutocompleteMultiple.tsx +1 -1
- package/src/components/avatar/Avatar.tsx +1 -1
- package/src/components/badge/Badge.tsx +1 -1
- package/src/components/badge/BadgeWrapper.tsx +1 -1
- package/src/components/button/Button.test.tsx +5 -5
- package/src/components/button/Button.tsx +1 -1
- package/src/components/button/ButtonGroup.tsx +1 -1
- package/src/components/button/ButtonRoot.tsx +7 -37
- package/src/components/button/IconButton.tsx +1 -1
- package/src/components/checkbox/Checkbox.tsx +1 -1
- package/src/components/chip/Chip.tsx +2 -2
- package/src/components/chip/ChipGroup.tsx +2 -2
- package/src/components/comment-block/CommentBlock.tsx +1 -1
- package/src/components/date-picker/DatePickerControlled.tsx +1 -1
- package/src/components/date-picker/constants.ts +1 -1
- package/src/components/dialog/Dialog.tsx +1 -1
- package/src/components/divider/Divider.tsx +1 -1
- package/src/components/drag-handle/DragHandle.tsx +1 -1
- package/src/components/dropdown/Dropdown.tsx +1 -1
- package/src/components/expansion-panel/ExpansionPanel.tsx +1 -1
- package/src/components/flag/Flag.tsx +1 -1
- package/src/components/flex-box/FlexBox.tsx +2 -3
- package/src/components/generic-block/GenericBlock.tsx +1 -1
- package/src/components/grid/Grid.tsx +1 -1
- package/src/components/grid/GridItem.tsx +1 -1
- package/src/components/grid-column/GridColumn.tsx +1 -1
- package/src/components/heading/Heading.tsx +1 -1
- package/src/components/heading/constants.ts +1 -1
- package/src/components/icon/Icon.tsx +1 -1
- package/src/components/image-block/ImageBlock.tsx +1 -1
- package/src/components/image-lightbox/constants.ts +1 -1
- package/src/components/inline-list/InlineList.tsx +1 -1
- package/src/components/input-helper/InputHelper.tsx +1 -1
- package/src/components/input-label/InputLabel.test.tsx +1 -1
- package/src/components/input-label/InputLabel.tsx +1 -1
- package/src/components/lightbox/Lightbox.tsx +1 -1
- package/src/components/link/Link.test.tsx +8 -6
- package/src/components/link/Link.tsx +10 -21
- package/src/components/link-preview/LinkPreview.stories.tsx +1 -1
- package/src/components/link-preview/LinkPreview.test.tsx +1 -1
- package/src/components/link-preview/LinkPreview.tsx +1 -1
- package/src/components/list/List.tsx +1 -1
- package/src/components/list/ListDivider.tsx +1 -1
- package/src/components/list/ListItem.test.tsx +1 -3
- package/src/components/list/ListItem.tsx +20 -33
- package/src/components/list/ListSubheader.tsx +1 -1
- package/src/components/message/Message.tsx +1 -1
- package/src/components/mosaic/Mosaic.tsx +1 -1
- package/src/components/navigation/Navigation.test.tsx +1 -1
- package/src/components/navigation/Navigation.tsx +1 -1
- package/src/components/navigation/NavigationItem.tsx +8 -12
- package/src/components/navigation/NavigationSection.test.tsx +2 -1
- package/src/components/navigation/NavigationSection.tsx +5 -4
- package/src/components/navigation/context.tsx +2 -1
- package/src/components/notification/Notification.tsx +1 -1
- package/src/components/popover/Popover.tsx +1 -1
- package/src/components/popover-dialog/PopoverDialog.tsx +1 -1
- package/src/components/post-block/PostBlock.tsx +1 -1
- package/src/components/progress/Progress.tsx +1 -1
- package/src/components/progress/ProgressCircular.tsx +1 -1
- package/src/components/progress/ProgressLinear.tsx +1 -1
- package/src/components/progress-tracker/ProgressTracker.tsx +1 -1
- package/src/components/progress-tracker/ProgressTrackerStep.tsx +1 -1
- package/src/components/progress-tracker/ProgressTrackerStepPanel.tsx +1 -1
- package/src/components/radio-button/RadioButton.tsx +1 -1
- package/src/components/radio-button/RadioGroup.tsx +1 -1
- package/src/components/select/Select.test.tsx +1 -1
- package/src/components/select/Select.tsx +2 -2
- package/src/components/select/SelectMultiple.test.tsx +1 -1
- package/src/components/select/SelectMultiple.tsx +2 -2
- package/src/components/select/WithSelectContext.tsx +2 -2
- package/src/components/side-navigation/SideNavigation.tsx +1 -1
- package/src/components/side-navigation/SideNavigationItem.tsx +23 -28
- package/src/components/skeleton/SkeletonCircle.tsx +1 -1
- package/src/components/skeleton/SkeletonRectangle.tsx +1 -1
- package/src/components/skeleton/SkeletonTypography.tsx +1 -1
- package/src/components/slider/Slider.tsx +1 -1
- package/src/components/slideshow/Slides.tsx +1 -1
- package/src/components/slideshow/SlideshowControls.tsx +1 -1
- package/src/components/slideshow/SlideshowItem.tsx +1 -1
- package/src/components/slideshow/SlideshowItemGroup.tsx +1 -1
- package/src/components/switch/Switch.tsx +1 -1
- package/src/components/table/Table.tsx +1 -1
- package/src/components/table/TableBody.tsx +1 -1
- package/src/components/table/TableCell.tsx +1 -1
- package/src/components/table/TableHeader.tsx +1 -1
- package/src/components/table/TableRow.tsx +1 -1
- package/src/components/tabs/Tab.tsx +1 -1
- package/src/components/tabs/TabList.tsx +1 -1
- package/src/components/tabs/TabPanel.tsx +1 -1
- package/src/components/text/Text.stories.tsx +23 -1
- package/src/components/text/Text.tsx +2 -2
- package/src/components/text-field/TextField.test.tsx +1 -1
- package/src/components/text-field/TextField.tsx +1 -1
- package/src/components/thumbnail/Thumbnail.tsx +7 -12
- package/src/components/thumbnail/useFocusPointStyle.tsx +1 -1
- package/src/components/toolbar/Toolbar.tsx +1 -1
- package/src/components/tooltip/Tooltip.tsx +1 -1
- package/src/components/uploader/Uploader.tsx +1 -1
- package/src/components/user-block/UserBlock.tsx +1 -1
- package/src/hooks/useCallbackOnEscape.ts +1 -1
- package/src/hooks/useOverflowTooltipLabel.tsx +21 -18
- package/src/index.ts +3 -1
- package/src/utils/partitionMulti.ts +2 -1
- package/src/utils/react/RawClickable.test.tsx +153 -0
- package/src/utils/react/RawClickable.tsx +65 -0
- package/src/utils/type/HasRequiredLinkHref.ts +1 -0
- package/src/utils/type/index.ts +3 -13
- package/src/components/index.ts +0 -160
- package/src/utils/browser/event.ts +0 -1
- package/src/utils/className/fontColorClass.test.ts +0 -15
- package/src/utils/className/fontColorClass.ts +0 -12
- package/src/utils/className/getBasicClass.test.ts +0 -20
- package/src/utils/className/getRootClassName.test.ts +0 -11
- package/src/utils/className/getRootClassName.ts +0 -24
- package/src/utils/className/getTypographyClassName.test.ts +0 -7
- package/src/utils/className/getTypographyClassName.ts +0 -9
- package/src/utils/className/handleBasicClasses.test.ts +0 -28
- package/src/utils/className/index.ts +0 -5
- package/src/utils/className/resolveColorWithVariants.test.ts +0 -33
- package/src/utils/className/resolveColorWithVariants.ts +0 -11
- package/src/utils/react/renderButtonOrLink.tsx +0 -16
- package/src/utils/react/renderLink.tsx +0 -17
- package/src/utils/type/Callback.ts +0 -4
- package/src/utils/type/Falsy.ts +0 -5
- package/src/utils/type/GenericProps.ts +0 -11
- package/src/utils/type/HasAriaLabelOrLabelledBy.ts +0 -19
- package/src/utils/type/HasClassName.ts +0 -6
- package/src/utils/type/HasCloseMode.ts +0 -7
- package/src/utils/type/HasTheme.ts +0 -8
- package/src/utils/type/HeadingElement.ts +0 -2
- package/src/utils/type/Point.ts +0 -4
- package/src/utils/type/Predicate.ts +0 -2
- package/src/utils/type/RectSize.ts +0 -4
- package/src/utils/type/TextElement.ts +0 -4
- package/src/utils/type/ValueOf.ts +0 -2
- package/src/utils/type/color/index.ts +0 -43
|
@@ -5,7 +5,7 @@ import { LANDSCAPE_IMAGES } from '@lumx/react/stories/controls/image';
|
|
|
5
5
|
import { withNestedProps } from '@lumx/react/stories/decorators/withNestedProps';
|
|
6
6
|
import { withWrapper } from '@lumx/react/stories/decorators/withWrapper';
|
|
7
7
|
|
|
8
|
-
import { Size } from '
|
|
8
|
+
import { Size } from '@lumx/core/js/constants';
|
|
9
9
|
import { LinkPreview, LinkPreviewProps } from './LinkPreview';
|
|
10
10
|
|
|
11
11
|
export default {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import { commonTestsSuiteRTL, SetupRenderOptions } from '@lumx/react/testing/utils';
|
|
4
|
+
import { Size, Theme } from '@lumx/core/js/constants';
|
|
4
5
|
import { Thumbnail } from '@lumx/react';
|
|
5
6
|
import { render, screen, within } from '@testing-library/react';
|
|
6
7
|
import { getByClassName, queryByClassName, queryAllByClassName } from '@lumx/react/testing/utils/queries';
|
|
7
8
|
|
|
8
|
-
import { Size, Theme } from '..';
|
|
9
9
|
import { LinkPreview, LinkPreviewProps } from './LinkPreview';
|
|
10
10
|
|
|
11
11
|
const CLASSNAME = LinkPreview.className as string;
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from '@lumx/react';
|
|
16
16
|
|
|
17
17
|
import { GenericProps, HeadingElement, HasTheme } from '@lumx/react/utils/type';
|
|
18
|
-
import { getRootClassName, handleBasicClasses } from '@lumx/
|
|
18
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
19
19
|
import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
20
20
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
21
21
|
|
|
@@ -5,7 +5,7 @@ import classNames from 'classnames';
|
|
|
5
5
|
import { Size } from '@lumx/react';
|
|
6
6
|
import { useKeyboardListNavigation } from '@lumx/react/hooks/useKeyboardListNavigation';
|
|
7
7
|
import { GenericProps } from '@lumx/react/utils/type';
|
|
8
|
-
import { getRootClassName, handleBasicClasses } from '@lumx/
|
|
8
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
9
9
|
import { mergeRefs } from '@lumx/react/utils/react/mergeRefs';
|
|
10
10
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
11
11
|
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
|
|
5
5
|
import { GenericProps } from '@lumx/react/utils/type';
|
|
6
|
-
import { getRootClassName } from '@lumx/
|
|
6
|
+
import { getRootClassName } from '@lumx/core/js/utils/className';
|
|
7
7
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -43,7 +43,7 @@ describe(`<${ListItem.displayName}>`, () => {
|
|
|
43
43
|
it('should render disabled list item button', async () => {
|
|
44
44
|
const onItemSelected = jest.fn();
|
|
45
45
|
const { link } = setup({ children: 'Label', isDisabled: true, onItemSelected });
|
|
46
|
-
expect(link).
|
|
46
|
+
expect(link).toBeDisabled();
|
|
47
47
|
// The `renderLink` util removes the onClick handler but `user-event` will also not fire events on disabled elements.
|
|
48
48
|
if (link) await userEvent.click(link);
|
|
49
49
|
expect(onItemSelected).not.toHaveBeenCalled();
|
|
@@ -57,7 +57,6 @@ describe(`<${ListItem.displayName}>`, () => {
|
|
|
57
57
|
linkProps: { href: 'https://example.com' },
|
|
58
58
|
onItemSelected,
|
|
59
59
|
});
|
|
60
|
-
expect(link).not.toHaveAttribute('href');
|
|
61
60
|
expect(link).toHaveAttribute('aria-disabled', 'true');
|
|
62
61
|
if (link) await userEvent.click(link);
|
|
63
62
|
expect(onItemSelected).not.toHaveBeenCalled();
|
|
@@ -79,7 +78,6 @@ describe(`<${ListItem.displayName}>`, () => {
|
|
|
79
78
|
linkProps: { href: 'https://example.com' },
|
|
80
79
|
onItemSelected,
|
|
81
80
|
});
|
|
82
|
-
expect(link).not.toHaveAttribute('href');
|
|
83
81
|
expect(link).toHaveAttribute('aria-disabled', 'true');
|
|
84
82
|
if (link) await userEvent.click(link);
|
|
85
83
|
expect(onItemSelected).not.toHaveBeenCalled();
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import React, { ReactNode, Ref, SyntheticEvent
|
|
1
|
+
import React, { ReactNode, Ref, SyntheticEvent } from 'react';
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import isEmpty from 'lodash/isEmpty';
|
|
5
5
|
|
|
6
6
|
import { ListProps, Size } from '@lumx/react';
|
|
7
7
|
import { GenericProps } from '@lumx/react/utils/type';
|
|
8
|
-
import {
|
|
9
|
-
import { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';
|
|
10
|
-
import { renderLink } from '@lumx/react/utils/react/renderLink';
|
|
8
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
11
9
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
12
10
|
import { useDisableStateProps } from '@lumx/react/utils/disabled/useDisableStateProps';
|
|
13
11
|
import { HasAriaDisabled } from '@lumx/react/utils/type/HasAriaDisabled';
|
|
12
|
+
import { RawClickable } from '@lumx/react/utils/react/RawClickable';
|
|
14
13
|
|
|
15
14
|
export type ListItemSize = Extract<Size, 'tiny' | 'regular' | 'big' | 'huge'>;
|
|
16
15
|
|
|
@@ -94,13 +93,6 @@ export const ListItem = forwardRef<ListItemProps, HTMLLIElement>((props, ref) =>
|
|
|
94
93
|
...forwardedProps
|
|
95
94
|
} = otherProps;
|
|
96
95
|
|
|
97
|
-
const role = linkAs || linkProps.href ? 'link' : 'button';
|
|
98
|
-
const onKeyDown = useMemo(() => {
|
|
99
|
-
if (onItemSelected && role === 'link') return onEnterPressed(onItemSelected as any);
|
|
100
|
-
if (onItemSelected && role === 'button') return onButtonPressed(onItemSelected as any);
|
|
101
|
-
return undefined;
|
|
102
|
-
}, [role, onItemSelected]);
|
|
103
|
-
|
|
104
96
|
const content = (
|
|
105
97
|
<>
|
|
106
98
|
{before && <div className={`${CLASSNAME}__before`}>{before}</div>}
|
|
@@ -123,28 +115,23 @@ export const ListItem = forwardRef<ListItemProps, HTMLLIElement>((props, ref) =>
|
|
|
123
115
|
>
|
|
124
116
|
{isClickable({ linkProps, onItemSelected }) ? (
|
|
125
117
|
/* Clickable list item */
|
|
126
|
-
|
|
127
|
-
{
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
onKeyDown: isAnyDisabled ? undefined : onKeyDown,
|
|
144
|
-
ref: linkRef,
|
|
145
|
-
},
|
|
146
|
-
content,
|
|
147
|
-
)
|
|
118
|
+
<RawClickable
|
|
119
|
+
as={linkAs || linkProps.href ? 'a' : 'button'}
|
|
120
|
+
{...linkProps}
|
|
121
|
+
{...disabledStateProps}
|
|
122
|
+
className={classNames(
|
|
123
|
+
handleBasicClasses({
|
|
124
|
+
prefix: `${CLASSNAME}__link`,
|
|
125
|
+
isHighlighted,
|
|
126
|
+
isSelected,
|
|
127
|
+
isDisabled: isAnyDisabled,
|
|
128
|
+
}),
|
|
129
|
+
)}
|
|
130
|
+
onClick={onItemSelected}
|
|
131
|
+
ref={linkRef}
|
|
132
|
+
>
|
|
133
|
+
{content}
|
|
134
|
+
</RawClickable>
|
|
148
135
|
) : (
|
|
149
136
|
/* Non clickable list item */
|
|
150
137
|
<div className={`${CLASSNAME}__wrapper`}>{content}</div>
|
|
@@ -3,7 +3,7 @@ import React, { ReactNode } from 'react';
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
|
|
5
5
|
import { GenericProps } from '@lumx/react/utils/type';
|
|
6
|
-
import { getRootClassName } from '@lumx/
|
|
6
|
+
import { getRootClassName } from '@lumx/core/js/utils/className';
|
|
7
7
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -5,7 +5,7 @@ import classNames from 'classnames';
|
|
|
5
5
|
import { mdiAlert, mdiAlertCircle, mdiCheckCircle, mdiClose, mdiInformation } from '@lumx/icons';
|
|
6
6
|
import { ColorPalette, Emphasis, Icon, IconButton, Kind, Size } from '@lumx/react';
|
|
7
7
|
import { GenericProps } from '@lumx/react/utils/type';
|
|
8
|
-
import { getRootClassName, handleBasicClasses } from '@lumx/
|
|
8
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
9
9
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -6,7 +6,7 @@ import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
|
6
6
|
|
|
7
7
|
import { Alignment, AspectRatio, Theme, Thumbnail, ThumbnailProps } from '@lumx/react';
|
|
8
8
|
import { GenericProps, HasTheme } from '@lumx/react/utils/type';
|
|
9
|
-
import { getRootClassName, handleBasicClasses } from '@lumx/
|
|
9
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
10
10
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -3,8 +3,8 @@ import React from 'react';
|
|
|
3
3
|
import { commonTestsSuiteRTL, SetupRenderOptions } from '@lumx/react/testing/utils';
|
|
4
4
|
import { render } from '@testing-library/react';
|
|
5
5
|
import { getAllByClassName, getByClassName } from '@lumx/react/testing/utils/queries';
|
|
6
|
+
import { Orientation } from '@lumx/core/js/constants';
|
|
6
7
|
import { Navigation, NavigationProps } from '.';
|
|
7
|
-
import { Orientation } from '..';
|
|
8
8
|
|
|
9
9
|
const CLASSNAME = Navigation.className as string;
|
|
10
10
|
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
|
|
5
5
|
import { HasAriaLabelOrLabelledBy, HasClassName, HasTheme } from '@lumx/react/utils/type';
|
|
6
|
-
import { getRootClassName, handleBasicClasses } from '@lumx/
|
|
6
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
7
7
|
import { Orientation, Theme } from '@lumx/react';
|
|
8
8
|
import { ThemeProvider, useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
9
9
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React, { ElementType, ReactNode } from 'react';
|
|
2
2
|
import { Icon, Placement, Size, Tooltip, Text } from '@lumx/react';
|
|
3
|
-
import { getRootClassName, handleBasicClasses } from '@lumx/
|
|
4
|
-
import { ComponentRef, HasClassName, HasPolymorphicAs, HasTheme } from '@lumx/react/utils/type';
|
|
3
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
4
|
+
import { ComponentRef, HasClassName, HasPolymorphicAs, HasRequiredLinkHref, HasTheme } from '@lumx/react/utils/type';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
import { forwardRefPolymorphic } from '@lumx/react/utils/react/forwardRefPolymorphic';
|
|
7
7
|
import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
8
8
|
import { useOverflowTooltipLabel } from '@lumx/react/hooks/useOverflowTooltipLabel';
|
|
9
|
+
import { RawClickable } from '@lumx/react/utils/react/RawClickable';
|
|
9
10
|
|
|
10
11
|
type BaseNavigationItemProps = {
|
|
11
12
|
/** Icon (SVG path). */
|
|
@@ -16,9 +17,6 @@ type BaseNavigationItemProps = {
|
|
|
16
17
|
isCurrentPage?: boolean;
|
|
17
18
|
};
|
|
18
19
|
|
|
19
|
-
/** Make `href` required when `as` is `a` */
|
|
20
|
-
type RequiredLinkHref<E> = E extends 'a' ? { href: string } : Record<string, unknown>;
|
|
21
|
-
|
|
22
20
|
/**
|
|
23
21
|
* Navigation item props
|
|
24
22
|
*/
|
|
@@ -26,7 +24,7 @@ export type NavigationItemProps<E extends ElementType = 'a'> = HasPolymorphicAs<
|
|
|
26
24
|
HasTheme &
|
|
27
25
|
HasClassName &
|
|
28
26
|
BaseNavigationItemProps &
|
|
29
|
-
|
|
27
|
+
HasRequiredLinkHref<E>;
|
|
30
28
|
|
|
31
29
|
/**
|
|
32
30
|
* Component display name.
|
|
@@ -42,9 +40,7 @@ export const NavigationItem = Object.assign(
|
|
|
42
40
|
forwardRefPolymorphic(<E extends ElementType = 'a'>(props: NavigationItemProps<E>, ref: ComponentRef<E>) => {
|
|
43
41
|
const { className, icon, label, isCurrentPage, as: Element = 'a', ...forwardedProps } = props;
|
|
44
42
|
const theme = useTheme();
|
|
45
|
-
const { tooltipLabel, labelRef } = useOverflowTooltipLabel();
|
|
46
|
-
|
|
47
|
-
const buttonProps = Element === 'button' ? { type: 'button' } : {};
|
|
43
|
+
const { tooltipLabel, labelRef } = useOverflowTooltipLabel(label);
|
|
48
44
|
|
|
49
45
|
return (
|
|
50
46
|
<li
|
|
@@ -57,14 +53,14 @@ export const NavigationItem = Object.assign(
|
|
|
57
53
|
)}
|
|
58
54
|
>
|
|
59
55
|
<Tooltip label={tooltipLabel} placement={Placement.TOP}>
|
|
60
|
-
<
|
|
56
|
+
<RawClickable
|
|
57
|
+
as={Element}
|
|
61
58
|
className={handleBasicClasses({
|
|
62
59
|
prefix: `${CLASSNAME}__link`,
|
|
63
60
|
isSelected: isCurrentPage,
|
|
64
61
|
})}
|
|
65
62
|
ref={ref as React.Ref<any>}
|
|
66
63
|
aria-current={isCurrentPage ? 'page' : undefined}
|
|
67
|
-
{...buttonProps}
|
|
68
64
|
{...forwardedProps}
|
|
69
65
|
>
|
|
70
66
|
{icon ? (
|
|
@@ -74,7 +70,7 @@ export const NavigationItem = Object.assign(
|
|
|
74
70
|
<Text as="span" truncate className={`${CLASSNAME}__label`} ref={labelRef}>
|
|
75
71
|
{label}
|
|
76
72
|
</Text>
|
|
77
|
-
</
|
|
73
|
+
</RawClickable>
|
|
78
74
|
</Tooltip>
|
|
79
75
|
</li>
|
|
80
76
|
);
|
|
@@ -4,10 +4,11 @@ import { commonTestsSuiteRTL, RenderWrapper } from '@lumx/react/testing/utils';
|
|
|
4
4
|
import { render, screen } from '@testing-library/react';
|
|
5
5
|
import { getByClassName, queryByClassName } from '@lumx/react/testing/utils/queries';
|
|
6
6
|
import userEvent from '@testing-library/user-event';
|
|
7
|
+
import { Orientation } from '@lumx/core/js/constants';
|
|
8
|
+
|
|
7
9
|
import { NavigationItem } from './NavigationItem';
|
|
8
10
|
import { NavigationSection, NavigationSectionProps } from './NavigationSection';
|
|
9
11
|
import { NavigationContext } from './context';
|
|
10
|
-
import { Orientation } from '..';
|
|
11
12
|
|
|
12
13
|
const CLASSNAME = NavigationSection.className as string;
|
|
13
14
|
|
|
@@ -3,12 +3,13 @@ import React, { useRef, useState, useContext } from 'react';
|
|
|
3
3
|
import { mdiChevronDown, mdiChevronUp } from '@lumx/icons';
|
|
4
4
|
import { Icon, Size, Text, Orientation, Popover, Placement, Theme } from '@lumx/react';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
|
-
import { getRootClassName, handleBasicClasses } from '@lumx/
|
|
6
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
7
7
|
import { HasClassName } from '@lumx/react/utils/type';
|
|
8
8
|
import { ThemeProvider, useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
9
9
|
import { useId } from '@lumx/react/hooks/useId';
|
|
10
10
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
11
11
|
|
|
12
|
+
import { RawClickable } from '@lumx/react/utils/react/RawClickable';
|
|
12
13
|
import { CLASSNAME as ITEM_CLASSNAME } from './NavigationItem';
|
|
13
14
|
import { NavigationContext } from './context';
|
|
14
15
|
|
|
@@ -52,7 +53,8 @@ export const NavigationSection = forwardRef<NavigationSectionProps, HTMLLIElemen
|
|
|
52
53
|
)}
|
|
53
54
|
ref={ref}
|
|
54
55
|
>
|
|
55
|
-
<button
|
|
56
|
+
<RawClickable<'button'>
|
|
57
|
+
as="button"
|
|
56
58
|
{...forwardedProps}
|
|
57
59
|
aria-controls={sectionId}
|
|
58
60
|
aria-expanded={isOpen}
|
|
@@ -62,7 +64,6 @@ export const NavigationSection = forwardRef<NavigationSectionProps, HTMLLIElemen
|
|
|
62
64
|
setIsOpen(!isOpen);
|
|
63
65
|
event.stopPropagation();
|
|
64
66
|
}}
|
|
65
|
-
type="button"
|
|
66
67
|
>
|
|
67
68
|
{icon ? <Icon className={`${ITEM_CLASSNAME}__icon`} icon={icon} size={Size.xs} /> : null}
|
|
68
69
|
|
|
@@ -73,7 +74,7 @@ export const NavigationSection = forwardRef<NavigationSectionProps, HTMLLIElemen
|
|
|
73
74
|
className={classNames(`${ITEM_CLASSNAME}__icon`, `${CLASSNAME}__chevron`)}
|
|
74
75
|
icon={isOpen ? mdiChevronUp : mdiChevronDown}
|
|
75
76
|
/>
|
|
76
|
-
</
|
|
77
|
+
</RawClickable>
|
|
77
78
|
{isOpen &&
|
|
78
79
|
(isDropdown ? (
|
|
79
80
|
<Popover
|
|
@@ -7,7 +7,7 @@ import { Button, Emphasis, Icon, Kind, Size, Theme } from '@lumx/react';
|
|
|
7
7
|
import { DOCUMENT, NOTIFICATION_TRANSITION_DURATION } from '@lumx/react/constants';
|
|
8
8
|
import { NOTIFICATION_CONFIGURATION } from '@lumx/react/components/notification/constants';
|
|
9
9
|
import { GenericProps, HasTheme } from '@lumx/react/utils/type';
|
|
10
|
-
import { getRootClassName, handleBasicClasses } from '@lumx/
|
|
10
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
11
11
|
import { useTransitionVisibility } from '@lumx/react/hooks/useTransitionVisibility';
|
|
12
12
|
import { mergeRefs } from '@lumx/react/utils/react/mergeRefs';
|
|
13
13
|
import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
@@ -7,7 +7,7 @@ import { useFocus } from '@lumx/react/hooks/useFocus';
|
|
|
7
7
|
import { ClickAwayProvider } from '@lumx/react/utils/ClickAwayProvider';
|
|
8
8
|
import { DOCUMENT } from '@lumx/react/constants';
|
|
9
9
|
import { Comp, GenericProps, HasTheme } from '@lumx/react/utils/type';
|
|
10
|
-
import { getRootClassName, handleBasicClasses } from '@lumx/
|
|
10
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
11
11
|
import { useMergeRefs } from '@lumx/react/utils/react/mergeRefs';
|
|
12
12
|
import { useFocusTrap } from '@lumx/react/hooks/useFocusTrap';
|
|
13
13
|
import { skipRender } from '@lumx/react/utils/react/skipRender';
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
|
|
5
5
|
import { HasAriaLabelOrLabelledBy } from '@lumx/react/utils/type';
|
|
6
|
-
import { getRootClassName } from '@lumx/
|
|
6
|
+
import { getRootClassName } from '@lumx/core/js/utils/className';
|
|
7
7
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
8
8
|
|
|
9
9
|
import { HeadingLevelProvider } from '@lumx/react/components/heading';
|
|
@@ -5,7 +5,7 @@ import isObject from 'lodash/isObject';
|
|
|
5
5
|
|
|
6
6
|
import { Orientation, Theme, Thumbnail, ThumbnailProps, ThumbnailVariant } from '@lumx/react';
|
|
7
7
|
import { GenericProps, HasTheme } from '@lumx/react/utils/type';
|
|
8
|
-
import { getRootClassName, handleBasicClasses } from '@lumx/
|
|
8
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
9
9
|
import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
10
10
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
11
11
|
|
|
@@ -4,7 +4,7 @@ import classNames from 'classnames';
|
|
|
4
4
|
|
|
5
5
|
import { Theme } from '@lumx/react';
|
|
6
6
|
import { GenericProps, HasTheme, ValueOf } from '@lumx/react/utils/type';
|
|
7
|
-
import { getRootClassName, handleBasicClasses } from '@lumx/
|
|
7
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
8
8
|
import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
9
9
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ import classNames from 'classnames';
|
|
|
4
4
|
|
|
5
5
|
import { Theme, Size } from '@lumx/react';
|
|
6
6
|
import { GenericProps, HasTheme } from '@lumx/react/utils/type';
|
|
7
|
-
import { getRootClassName, handleBasicClasses } from '@lumx/
|
|
7
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
8
8
|
import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
9
9
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ import classNames from 'classnames';
|
|
|
4
4
|
|
|
5
5
|
import { Theme } from '@lumx/react';
|
|
6
6
|
import { GenericProps, HasTheme } from '@lumx/react/utils/type';
|
|
7
|
-
import { getRootClassName, handleBasicClasses } from '@lumx/
|
|
7
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
8
8
|
import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
9
9
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
10
10
|
|
|
@@ -3,7 +3,7 @@ import React, { ReactNode } from 'react';
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
|
|
5
5
|
import { GenericProps } from '@lumx/react/utils/type';
|
|
6
|
-
import { getRootClassName } from '@lumx/
|
|
6
|
+
import { getRootClassName } from '@lumx/core/js/utils/className';
|
|
7
7
|
import { mergeRefs } from '@lumx/react/utils/react/mergeRefs';
|
|
8
8
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
9
9
|
|
|
@@ -5,7 +5,7 @@ import classNames from 'classnames';
|
|
|
5
5
|
import { mdiAlertCircle, mdiCheckCircle, mdiRadioboxBlank, mdiRadioboxMarked } from '@lumx/icons';
|
|
6
6
|
import { Icon, InputHelper, InputLabel, Kind, Size } from '@lumx/react';
|
|
7
7
|
import { GenericProps } from '@lumx/react/utils/type';
|
|
8
|
-
import { getRootClassName, handleBasicClasses } from '@lumx/
|
|
8
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
9
9
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
10
10
|
|
|
11
11
|
import { useDisableStateProps } from '@lumx/react/utils/disabled/useDisableStateProps';
|
|
@@ -5,7 +5,7 @@ import classNames from 'classnames';
|
|
|
5
5
|
import { useTabProviderContext } from '@lumx/react/components/tabs/state';
|
|
6
6
|
import { CSS_PREFIX } from '@lumx/react/constants';
|
|
7
7
|
import { GenericProps } from '@lumx/react/utils/type';
|
|
8
|
-
import { handleBasicClasses } from '@lumx/
|
|
8
|
+
import { handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
9
9
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -4,7 +4,7 @@ import classNames from 'classnames';
|
|
|
4
4
|
|
|
5
5
|
import { InputHelper, InputLabel, Theme } from '@lumx/react';
|
|
6
6
|
import { GenericProps, HasTheme } from '@lumx/react/utils/type';
|
|
7
|
-
import { getRootClassName, handleBasicClasses } from '@lumx/
|
|
7
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
8
8
|
import { useId } from '@lumx/react/hooks/useId';
|
|
9
9
|
import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
10
10
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
@@ -3,7 +3,7 @@ import React, { ReactNode } from 'react';
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
|
|
5
5
|
import { GenericProps } from '@lumx/react/utils/type';
|
|
6
|
-
import { getRootClassName } from '@lumx/
|
|
6
|
+
import { getRootClassName } from '@lumx/core/js/utils/className';
|
|
7
7
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { Theme } from '@lumx/
|
|
3
|
+
import { Theme } from '@lumx/core/js/constants';
|
|
4
4
|
import { Chip } from '@lumx/react/components/chip/Chip';
|
|
5
5
|
import { Dropdown } from '@lumx/react/components/dropdown/Dropdown';
|
|
6
6
|
import { getByClassName, queryAllByClassName, queryByClassName } from '@lumx/react/testing/utils/queries';
|
|
@@ -4,12 +4,12 @@ import classNames from 'classnames';
|
|
|
4
4
|
import lodashIsEmpty from 'lodash/isEmpty';
|
|
5
5
|
|
|
6
6
|
import { mdiAlertCircle, mdiCheckCircle, mdiCloseCircle, mdiMenuDown } from '@lumx/icons';
|
|
7
|
-
import { Emphasis, Size, Theme } from '@lumx/
|
|
7
|
+
import { Emphasis, Size, Theme } from '@lumx/core/js/constants';
|
|
8
8
|
import { IconButton } from '@lumx/react/components/button/IconButton';
|
|
9
9
|
import { Chip } from '@lumx/react/components/chip/Chip';
|
|
10
10
|
import { Icon } from '@lumx/react/components/icon/Icon';
|
|
11
11
|
import { InputLabel } from '@lumx/react/components/input-label/InputLabel';
|
|
12
|
-
import { getRootClassName, handleBasicClasses } from '@lumx/
|
|
12
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
13
13
|
import { mergeRefs } from '@lumx/react/utils/react/mergeRefs';
|
|
14
14
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
15
15
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { Theme } from '@lumx/
|
|
3
|
+
import { Theme } from '@lumx/core/js/constants';
|
|
4
4
|
import { Chip } from '@lumx/react/components/chip/Chip';
|
|
5
5
|
import { Dropdown } from '@lumx/react/components/dropdown/Dropdown';
|
|
6
6
|
import { commonTestsSuiteRTL, SetupRenderOptions } from '@lumx/react/testing/utils';
|
|
@@ -3,11 +3,11 @@ import React, { ReactNode, RefObject, SyntheticEvent } from 'react';
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
|
|
5
5
|
import { mdiAlertCircle, mdiCheckCircle, mdiClose, mdiCloseCircle, mdiMenuDown } from '@lumx/icons';
|
|
6
|
-
import { Size, Theme } from '@lumx/
|
|
6
|
+
import { Size, Theme } from '@lumx/core/js/constants';
|
|
7
7
|
import { Chip } from '@lumx/react/components/chip/Chip';
|
|
8
8
|
import { Icon } from '@lumx/react/components/icon/Icon';
|
|
9
9
|
import { InputLabel } from '@lumx/react/components/input-label/InputLabel';
|
|
10
|
-
import { getRootClassName, handleBasicClasses } from '@lumx/
|
|
10
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
11
11
|
import { mergeRefs } from '@lumx/react/utils/react/mergeRefs';
|
|
12
12
|
import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
13
13
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
@@ -2,12 +2,12 @@ import classNames from 'classnames';
|
|
|
2
2
|
import React, { Ref, useCallback, useRef } from 'react';
|
|
3
3
|
|
|
4
4
|
import { Placement } from '@lumx/react';
|
|
5
|
-
import { Kind, Theme } from '@lumx/
|
|
5
|
+
import { Kind, Theme } from '@lumx/core/js/constants';
|
|
6
6
|
import { Dropdown } from '@lumx/react/components/dropdown/Dropdown';
|
|
7
7
|
import { InputHelper } from '@lumx/react/components/input-helper/InputHelper';
|
|
8
8
|
import { useFocusTrap } from '@lumx/react/hooks/useFocusTrap';
|
|
9
9
|
import { useListenFocus } from '@lumx/react/hooks/useListenFocus';
|
|
10
|
-
import { getRootClassName, handleBasicClasses } from '@lumx/
|
|
10
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
11
11
|
import { mergeRefs } from '@lumx/react/utils/react/mergeRefs';
|
|
12
12
|
|
|
13
13
|
import { useId } from '@lumx/react/hooks/useId';
|
|
@@ -4,7 +4,7 @@ import classNames from 'classnames';
|
|
|
4
4
|
|
|
5
5
|
import { SideNavigationItem, Theme } from '@lumx/react';
|
|
6
6
|
import { GenericProps, HasTheme, isComponent } from '@lumx/react/utils/type';
|
|
7
|
-
import { getRootClassName } from '@lumx/
|
|
7
|
+
import { getRootClassName } from '@lumx/core/js/utils/className';
|
|
8
8
|
import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
9
9
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
10
10
|
|