@lumx/react 3.10.1-alpha.4 → 3.10.1-alpha.5
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.js +18 -55
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/autocomplete/Autocomplete.tsx +2 -11
- package/src/components/autocomplete/AutocompleteMultiple.tsx +2 -7
- package/src/components/badge/BadgeWrapper.tsx +2 -2
- package/src/components/chip/ChipGroup.tsx +2 -5
- package/src/components/dropdown/Dropdown.tsx +2 -2
- package/src/components/grid-column/GridColumn.tsx +2 -7
- package/src/components/heading/Heading.tsx +2 -7
- package/src/components/list/ListDivider.tsx +2 -8
- package/src/components/list/ListSubheader.tsx +2 -2
- package/src/components/popover-dialog/PopoverDialog.tsx +2 -2
- package/src/components/progress-tracker/ProgressTracker.tsx +2 -6
- package/src/components/radio-button/RadioGroup.tsx +2 -11
- package/src/components/side-navigation/SideNavigation.tsx +2 -6
- package/src/components/slideshow/SlideshowItem.tsx +2 -11
- package/src/components/slideshow/SlideshowItemGroup.tsx +2 -8
- package/src/components/table/TableBody.tsx +2 -6
- package/src/components/table/TableCell.tsx +1 -4
- package/src/components/table/TableHeader.tsx +2 -6
- package/src/utils/className/getBasicClass.test.ts +20 -0
- package/src/utils/className/getFontColorClassName.test.ts +11 -0
- package/src/utils/className/getRootClassName.test.ts +11 -0
- package/src/utils/className/getTypographyClassName.test.ts +7 -0
- package/src/utils/className/handleBasicClasses.test.ts +28 -0
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.10.1-alpha.
|
|
10
|
-
"@lumx/icons": "^3.10.1-alpha.
|
|
9
|
+
"@lumx/core": "^3.10.1-alpha.5",
|
|
10
|
+
"@lumx/icons": "^3.10.1-alpha.5",
|
|
11
11
|
"@popperjs/core": "^2.5.4",
|
|
12
12
|
"body-scroll-lock": "^3.1.5",
|
|
13
13
|
"classnames": "^2.3.2",
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"build:storybook": "storybook build"
|
|
111
111
|
},
|
|
112
112
|
"sideEffects": false,
|
|
113
|
-
"version": "3.10.1-alpha.
|
|
113
|
+
"version": "3.10.1-alpha.5"
|
|
114
114
|
}
|
|
@@ -5,7 +5,7 @@ import classNames from 'classnames';
|
|
|
5
5
|
import { Dropdown, DropdownProps, IconButtonProps, Offset, Placement, TextField, TextFieldProps } from '@lumx/react';
|
|
6
6
|
|
|
7
7
|
import { GenericProps, HasTheme } from '@lumx/react/utils/type';
|
|
8
|
-
import { getRootClassName
|
|
8
|
+
import { getRootClassName } from '@lumx/react/utils/className';
|
|
9
9
|
import { useFocus } from '@lumx/react/hooks/useFocus';
|
|
10
10
|
import { mergeRefs } from '@lumx/react/utils/mergeRefs';
|
|
11
11
|
import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
@@ -245,16 +245,7 @@ export const Autocomplete = forwardRef<AutocompleteProps, HTMLDivElement>((props
|
|
|
245
245
|
useFocus(inputAnchorRef.current, !isOpen && shouldFocusOnClose);
|
|
246
246
|
|
|
247
247
|
return (
|
|
248
|
-
<div
|
|
249
|
-
ref={ref}
|
|
250
|
-
{...forwardedProps}
|
|
251
|
-
className={classNames(
|
|
252
|
-
className,
|
|
253
|
-
handleBasicClasses({
|
|
254
|
-
prefix: CLASSNAME,
|
|
255
|
-
}),
|
|
256
|
-
)}
|
|
257
|
-
>
|
|
248
|
+
<div ref={ref} {...forwardedProps} className={classNames(className, CLASSNAME)}>
|
|
258
249
|
<TextField
|
|
259
250
|
{...textFieldProps}
|
|
260
251
|
chips={chips}
|
|
@@ -5,7 +5,7 @@ import classNames from 'classnames';
|
|
|
5
5
|
import { mdiClose } from '@lumx/icons';
|
|
6
6
|
|
|
7
7
|
import { Autocomplete, AutocompleteProps, Chip, HorizontalAlignment, Icon, Size } from '@lumx/react';
|
|
8
|
-
import { getRootClassName
|
|
8
|
+
import { getRootClassName } from '@lumx/react/utils/className';
|
|
9
9
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
10
10
|
import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
|
|
11
11
|
|
|
@@ -114,12 +114,7 @@ export const AutocompleteMultiple = forwardRef<AutocompleteMultipleProps, HTMLDi
|
|
|
114
114
|
ref={ref}
|
|
115
115
|
{...forwardedProps}
|
|
116
116
|
anchorToInput={anchorToInput}
|
|
117
|
-
className={classNames(
|
|
118
|
-
className,
|
|
119
|
-
handleBasicClasses({
|
|
120
|
-
prefix: CLASSNAME,
|
|
121
|
-
}),
|
|
122
|
-
)}
|
|
117
|
+
className={classNames(className, CLASSNAME)}
|
|
123
118
|
name={name}
|
|
124
119
|
value={value}
|
|
125
120
|
onChange={onChange}
|
|
@@ -2,7 +2,7 @@ import React, { ReactElement, ReactNode } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
|
|
5
|
-
import { getRootClassName
|
|
5
|
+
import { getRootClassName } from '@lumx/react/utils/className';
|
|
6
6
|
import { DEFAULT_PROPS } from '@lumx/react/components/select/WithSelectContext';
|
|
7
7
|
import { GenericProps } from '@lumx/react/utils/type';
|
|
8
8
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
@@ -28,7 +28,7 @@ export const BadgeWrapper = forwardRef<BadgeWrapperProps, HTMLDivElement>((props
|
|
|
28
28
|
const { badge, children, className, ...forwardedProps } = props;
|
|
29
29
|
|
|
30
30
|
return (
|
|
31
|
-
<div ref={ref} {...forwardedProps} className={classNames(className,
|
|
31
|
+
<div ref={ref} {...forwardedProps} className={classNames(className, CLASSNAME)}>
|
|
32
32
|
{children}
|
|
33
33
|
{badge && <div className={`${CLASSNAME}__badge`}>{badge}</div>}
|
|
34
34
|
</div>
|
|
@@ -4,7 +4,7 @@ import classNames from 'classnames';
|
|
|
4
4
|
|
|
5
5
|
import { HorizontalAlignment } from '@lumx/react/components';
|
|
6
6
|
import { GenericProps } from '@lumx/react/utils/type';
|
|
7
|
-
import { getRootClassName
|
|
7
|
+
import { getRootClassName } from '@lumx/react/utils/className';
|
|
8
8
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
9
9
|
|
|
10
10
|
import { useChipGroupNavigation } from '@lumx/react/hooks/useChipGroupNavigation';
|
|
@@ -46,12 +46,9 @@ const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
|
46
46
|
*/
|
|
47
47
|
const InternalChipGroup = forwardRef<ChipGroupProps, HTMLDivElement>((props, ref) => {
|
|
48
48
|
const { align, children, className, ...forwardedProps } = props;
|
|
49
|
-
const chipGroupClassName = handleBasicClasses({
|
|
50
|
-
prefix: CLASSNAME,
|
|
51
|
-
});
|
|
52
49
|
|
|
53
50
|
return (
|
|
54
|
-
<div ref={ref} {...forwardedProps} className={classNames(className,
|
|
51
|
+
<div ref={ref} {...forwardedProps} className={classNames(className, CLASSNAME)}>
|
|
55
52
|
{children}
|
|
56
53
|
</div>
|
|
57
54
|
);
|
|
@@ -6,7 +6,7 @@ import { List, ListProps } from '@lumx/react/components/list/List';
|
|
|
6
6
|
import { Popover, PopoverProps } from '@lumx/react/components/popover/Popover';
|
|
7
7
|
import { useInfiniteScroll } from '@lumx/react/hooks/useInfiniteScroll';
|
|
8
8
|
import { GenericProps, isComponent } from '@lumx/react/utils/type';
|
|
9
|
-
import { getRootClassName
|
|
9
|
+
import { getRootClassName } from '@lumx/react/utils/className';
|
|
10
10
|
import { Offset, Placement } from '@lumx/react/components/popover/constants';
|
|
11
11
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
12
12
|
|
|
@@ -162,7 +162,7 @@ export const Dropdown = forwardRef<DropdownProps, HTMLDivElement>((props, ref) =
|
|
|
162
162
|
{...forwardedProps}
|
|
163
163
|
focusAnchorOnClose={focusAnchorOnClose}
|
|
164
164
|
anchorRef={anchorRef}
|
|
165
|
-
className={classNames(className,
|
|
165
|
+
className={classNames(className, CLASSNAME)}
|
|
166
166
|
elevation={0 as any}
|
|
167
167
|
closeOnClickAway={closeOnClickAway}
|
|
168
168
|
closeOnEscape={closeOnEscape}
|
|
@@ -4,7 +4,7 @@ import classNames from 'classnames';
|
|
|
4
4
|
|
|
5
5
|
import { Size } from '@lumx/react';
|
|
6
6
|
import { GenericProps } from '@lumx/react/utils/type';
|
|
7
|
-
import { getRootClassName
|
|
7
|
+
import { getRootClassName } from '@lumx/react/utils/className';
|
|
8
8
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
9
9
|
|
|
10
10
|
export type GridColumnGapSize = Extract<Size, 'tiny' | 'regular' | 'big' | 'huge'>;
|
|
@@ -65,12 +65,7 @@ export const GridColumn = forwardRef<GridColumnProps>((props, ref): ReactElement
|
|
|
65
65
|
<Component
|
|
66
66
|
{...forwardedProps}
|
|
67
67
|
ref={ref as React.Ref<any>}
|
|
68
|
-
className={classNames(
|
|
69
|
-
className,
|
|
70
|
-
handleBasicClasses({
|
|
71
|
-
prefix: CLASSNAME,
|
|
72
|
-
}),
|
|
73
|
-
)}
|
|
68
|
+
className={classNames(className, CLASSNAME)}
|
|
74
69
|
style={{
|
|
75
70
|
...style,
|
|
76
71
|
['--lumx-grid-column-item-min-width' as any]: Number.isInteger(itemMinWidth) && `${itemMinWidth}px`,
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
|
|
5
5
|
import { HeadingElement } from '@lumx/react/utils/type';
|
|
6
|
-
import { getRootClassName
|
|
6
|
+
import { getRootClassName } from '@lumx/react/utils/className';
|
|
7
7
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
8
8
|
|
|
9
9
|
import { Text, TextProps } from '../text';
|
|
@@ -48,12 +48,7 @@ export const Heading = forwardRef<HeadingProps>((props, ref) => {
|
|
|
48
48
|
return (
|
|
49
49
|
<Text
|
|
50
50
|
ref={ref}
|
|
51
|
-
className={classNames(
|
|
52
|
-
className,
|
|
53
|
-
handleBasicClasses({
|
|
54
|
-
prefix: CLASSNAME,
|
|
55
|
-
}),
|
|
56
|
-
)}
|
|
51
|
+
className={classNames(className, CLASSNAME)}
|
|
57
52
|
as={computedHeadingElement}
|
|
58
53
|
typography={DEFAULT_TYPOGRAPHY_BY_LEVEL[computedHeadingElement]}
|
|
59
54
|
{...forwardedProps}
|
|
@@ -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
|
|
6
|
+
import { getRootClassName } from '@lumx/react/utils/className';
|
|
7
7
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -31,13 +31,7 @@ const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
|
31
31
|
export const ListDivider = forwardRef<ListDividerProps, HTMLLIElement>((props, ref) => {
|
|
32
32
|
const { className, ...forwardedProps } = props;
|
|
33
33
|
|
|
34
|
-
return (
|
|
35
|
-
<li
|
|
36
|
-
ref={ref}
|
|
37
|
-
{...forwardedProps}
|
|
38
|
-
className={classNames(className, handleBasicClasses({ prefix: CLASSNAME }))}
|
|
39
|
-
/>
|
|
40
|
-
);
|
|
34
|
+
return <li ref={ref} {...forwardedProps} className={classNames(className, CLASSNAME)} />;
|
|
41
35
|
});
|
|
42
36
|
ListDivider.displayName = COMPONENT_NAME;
|
|
43
37
|
ListDivider.className = CLASSNAME;
|
|
@@ -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
|
|
6
|
+
import { getRootClassName } from '@lumx/react/utils/className';
|
|
7
7
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -35,7 +35,7 @@ export const ListSubheader = forwardRef<ListSubheaderProps, HTMLLIElement>((prop
|
|
|
35
35
|
const { children, className, ...forwardedProps } = props;
|
|
36
36
|
|
|
37
37
|
return (
|
|
38
|
-
<li ref={ref} {...forwardedProps} className={classNames(className,
|
|
38
|
+
<li ref={ref} {...forwardedProps} className={classNames(className, CLASSNAME)}>
|
|
39
39
|
{children}
|
|
40
40
|
</li>
|
|
41
41
|
);
|
|
@@ -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
|
|
6
|
+
import { getRootClassName } from '@lumx/react/utils/className';
|
|
7
7
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
8
8
|
|
|
9
9
|
import { Popover, PopoverProps } from '../popover/Popover';
|
|
@@ -51,7 +51,7 @@ export const PopoverDialog = forwardRef<PopoverDialogProps, HTMLDivElement>((pro
|
|
|
51
51
|
<Popover
|
|
52
52
|
{...forwardedProps}
|
|
53
53
|
ref={ref}
|
|
54
|
-
className={classNames(className,
|
|
54
|
+
className={classNames(className, CLASSNAME)}
|
|
55
55
|
role="dialog"
|
|
56
56
|
aria-modal="true"
|
|
57
57
|
/**
|
|
@@ -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
|
|
6
|
+
import { getRootClassName } from '@lumx/react/utils/className';
|
|
7
7
|
import { mergeRefs } from '@lumx/react/utils/mergeRefs';
|
|
8
8
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
9
9
|
|
|
@@ -61,11 +61,7 @@ export const ProgressTracker = forwardRef<ProgressTrackerProps, HTMLDivElement>(
|
|
|
61
61
|
numberOfSteps > 0 ? ((100 / (numberOfSteps - 1)) * (state?.activeTabIndex || 0)) / 100 : 0;
|
|
62
62
|
|
|
63
63
|
return (
|
|
64
|
-
<div
|
|
65
|
-
ref={mergeRefs(ref, stepListRef)}
|
|
66
|
-
{...forwardedProps}
|
|
67
|
-
className={classNames(className, handleBasicClasses({ prefix: CLASSNAME }))}
|
|
68
|
-
>
|
|
64
|
+
<div ref={mergeRefs(ref, stepListRef)} {...forwardedProps} className={classNames(className, CLASSNAME)}>
|
|
69
65
|
<div className={`${CLASSNAME}__steps`} role="tablist" aria-label={ariaLabel}>
|
|
70
66
|
{children}
|
|
71
67
|
</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
|
|
6
|
+
import { getRootClassName } from '@lumx/react/utils/className';
|
|
7
7
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -35,16 +35,7 @@ export const RadioGroup = forwardRef<RadioGroupProps, HTMLDivElement>((props, re
|
|
|
35
35
|
const { children, className, ...forwardedProps } = props;
|
|
36
36
|
|
|
37
37
|
return (
|
|
38
|
-
<div
|
|
39
|
-
ref={ref}
|
|
40
|
-
{...forwardedProps}
|
|
41
|
-
className={classNames(
|
|
42
|
-
className,
|
|
43
|
-
handleBasicClasses({
|
|
44
|
-
prefix: CLASSNAME,
|
|
45
|
-
}),
|
|
46
|
-
)}
|
|
47
|
-
>
|
|
38
|
+
<div ref={ref} {...forwardedProps} className={classNames(className, CLASSNAME)}>
|
|
48
39
|
{children}
|
|
49
40
|
</div>
|
|
50
41
|
);
|
|
@@ -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
|
|
7
|
+
import { getRootClassName } 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,11 +42,7 @@ export const SideNavigation = forwardRef<SideNavigationProps, HTMLUListElement>(
|
|
|
42
42
|
<ul
|
|
43
43
|
ref={ref}
|
|
44
44
|
{...forwardedProps}
|
|
45
|
-
className={classNames(
|
|
46
|
-
className,
|
|
47
|
-
theme === Theme.dark && 'lumx-color-font-light-N',
|
|
48
|
-
handleBasicClasses({ prefix: CLASSNAME }),
|
|
49
|
-
)}
|
|
45
|
+
className={classNames(className, theme === Theme.dark && 'lumx-color-font-light-N', CLASSNAME)}
|
|
50
46
|
>
|
|
51
47
|
{content}
|
|
52
48
|
</ul>
|
|
@@ -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
|
|
6
|
+
import { getRootClassName } from '@lumx/react/utils/className';
|
|
7
7
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -34,16 +34,7 @@ const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
|
34
34
|
export const SlideshowItem = forwardRef<SlideshowItemProps, HTMLDivElement>((props, ref) => {
|
|
35
35
|
const { className, children, ...forwardedProps } = props;
|
|
36
36
|
return (
|
|
37
|
-
<div
|
|
38
|
-
ref={ref}
|
|
39
|
-
className={classNames(
|
|
40
|
-
className,
|
|
41
|
-
handleBasicClasses({
|
|
42
|
-
prefix: CLASSNAME,
|
|
43
|
-
}),
|
|
44
|
-
)}
|
|
45
|
-
{...forwardedProps}
|
|
46
|
-
>
|
|
37
|
+
<div ref={ref} className={classNames(className, CLASSNAME)} {...forwardedProps}>
|
|
47
38
|
{children}
|
|
48
39
|
</div>
|
|
49
40
|
);
|
|
@@ -3,9 +3,8 @@ import React from 'react';
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { mergeRefs } from '@lumx/react/utils/mergeRefs';
|
|
5
5
|
import { GenericProps } from '@lumx/react/utils/type';
|
|
6
|
-
import { getRootClassName
|
|
6
|
+
import { getRootClassName } from '@lumx/react/utils/className';
|
|
7
7
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
8
|
-
|
|
9
8
|
import { useSlideFocusManagement } from './useSlideFocusManagement';
|
|
10
9
|
|
|
11
10
|
/**
|
|
@@ -46,12 +45,7 @@ export const SlideshowItemGroup = forwardRef<SlideshowItemGroupProps, HTMLDivEle
|
|
|
46
45
|
<div
|
|
47
46
|
ref={mergeRefs(groupRef, ref)}
|
|
48
47
|
role={role}
|
|
49
|
-
className={classNames(
|
|
50
|
-
className,
|
|
51
|
-
handleBasicClasses({
|
|
52
|
-
prefix: CLASSNAME,
|
|
53
|
-
}),
|
|
54
|
-
)}
|
|
48
|
+
className={classNames(className, CLASSNAME)}
|
|
55
49
|
aria-roledescription="slide"
|
|
56
50
|
aria-label={label}
|
|
57
51
|
{...forwardedProps}
|
|
@@ -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
|
|
6
|
+
import { getRootClassName } from '@lumx/react/utils/className';
|
|
7
7
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -32,11 +32,7 @@ export const TableBody = forwardRef<TableBodyProps, HTMLTableSectionElement>((pr
|
|
|
32
32
|
const { children, className, ...forwardedProps } = props;
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
|
-
<tbody
|
|
36
|
-
ref={ref}
|
|
37
|
-
{...forwardedProps}
|
|
38
|
-
className={classNames(className, handleBasicClasses({ prefix: CLASSNAME }))}
|
|
39
|
-
>
|
|
35
|
+
<tbody ref={ref} {...forwardedProps} className={classNames(className, CLASSNAME)}>
|
|
40
36
|
{children}
|
|
41
37
|
</tbody>
|
|
42
38
|
);
|
|
@@ -109,10 +109,7 @@ export const TableCell = forwardRef<TableCellProps, HTMLTableCellElement>((props
|
|
|
109
109
|
)}
|
|
110
110
|
|
|
111
111
|
{variant === TableCellVariant.body && (
|
|
112
|
-
<td
|
|
113
|
-
{...forwardedProps}
|
|
114
|
-
className={classNames(className, handleBasicClasses({ prefix: CLASSNAME }), `${CLASSNAME}--body`)}
|
|
115
|
-
>
|
|
112
|
+
<td {...forwardedProps} className={classNames(className, CLASSNAME, `${CLASSNAME}--body`)}>
|
|
116
113
|
<div className={`${CLASSNAME}-content`}>{children}</div>
|
|
117
114
|
</td>
|
|
118
115
|
)}
|
|
@@ -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
|
|
6
|
+
import { getRootClassName } from '@lumx/react/utils/className';
|
|
7
7
|
import { forwardRef } from '@lumx/react/utils/react/forwardRef';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -37,11 +37,7 @@ export const TableHeader = forwardRef<TableHeaderProps, HTMLTableSectionElement>
|
|
|
37
37
|
const { children, className, ...forwardedProps } = props;
|
|
38
38
|
|
|
39
39
|
return (
|
|
40
|
-
<thead
|
|
41
|
-
ref={ref}
|
|
42
|
-
{...forwardedProps}
|
|
43
|
-
className={classNames(className, handleBasicClasses({ prefix: CLASSNAME }))}
|
|
44
|
-
>
|
|
40
|
+
<thead ref={ref} {...forwardedProps} className={classNames(className, CLASSNAME)}>
|
|
45
41
|
{children}
|
|
46
42
|
</thead>
|
|
47
43
|
);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { getBasicClass } from '@lumx/core/js/utils';
|
|
2
|
+
|
|
3
|
+
describe(getBasicClass, () => {
|
|
4
|
+
it('should return correct basic CSS class for different types and values', () => {
|
|
5
|
+
// Test cases with different inputs
|
|
6
|
+
expect(getBasicClass({ prefix: 'test', type: 'color', value: 'primary' })).toBe('test--color-primary');
|
|
7
|
+
expect(getBasicClass({ prefix: 'test', type: 'variant', value: 'button' })).toBe('test--variant-button');
|
|
8
|
+
expect(getBasicClass({ prefix: 'test', type: 'isDark', value: true })).toBe('test--is-dark');
|
|
9
|
+
expect(getBasicClass({ prefix: 'test', type: 'dark', value: true })).toBe('test--is-dark');
|
|
10
|
+
expect(getBasicClass({ prefix: 'test', type: 'hasDark', value: true })).toBe('test--has-dark');
|
|
11
|
+
expect(getBasicClass({ prefix: 'test', type: 'isActive', value: false })).toBe('');
|
|
12
|
+
|
|
13
|
+
// Additional tests for boolean types
|
|
14
|
+
expect(getBasicClass({ prefix: 'test', type: 'hasBorder', value: true })).toBe('test--has-border');
|
|
15
|
+
expect(getBasicClass({ prefix: 'test', type: 'isVisible', value: false })).toBe('');
|
|
16
|
+
|
|
17
|
+
// Tests for undefined
|
|
18
|
+
expect(getBasicClass({ prefix: 'test', type: 'variant', value: undefined })).toBe('test--variant-undefined');
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { getFontColorClassName } from '@lumx/react/utils/className/getFontColorClassName';
|
|
2
|
+
|
|
3
|
+
describe(getFontColorClassName, () => {
|
|
4
|
+
it('should get lumx class for font color', () => {
|
|
5
|
+
expect(getFontColorClassName('dark')).toBe('lumx-color-font-dark-N');
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
it('should get lumx class for font color with variant', () => {
|
|
9
|
+
expect(getFontColorClassName('red', 'L2')).toBe('lumx-color-font-red-L2');
|
|
10
|
+
});
|
|
11
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { getRootClassName } from '@lumx/react/utils/className/getRootClassName';
|
|
2
|
+
|
|
3
|
+
describe(getRootClassName, () => {
|
|
4
|
+
it('should transform the component name into a lumx class', () => {
|
|
5
|
+
expect(getRootClassName('Table')).toBe('lumx-table');
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
it('should transform the sub component name into a lumx class', () => {
|
|
9
|
+
expect(getRootClassName('TableBody', true)).toBe('lumx-table__body');
|
|
10
|
+
});
|
|
11
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { getTypographyClassName } from '@lumx/react/utils/className/getTypographyClassName';
|
|
2
|
+
|
|
3
|
+
describe(getTypographyClassName, () => {
|
|
4
|
+
it('should generate lumx typography class', () => {
|
|
5
|
+
expect(getTypographyClassName('title')).toBe('lumx-typography-title');
|
|
6
|
+
});
|
|
7
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { handleBasicClasses } from '@lumx/core/js/utils';
|
|
2
|
+
|
|
3
|
+
describe(handleBasicClasses, () => {
|
|
4
|
+
it('should return correct combined CSS classes based on props', () => {
|
|
5
|
+
const className = handleBasicClasses({
|
|
6
|
+
prefix: 'test',
|
|
7
|
+
// Undefined
|
|
8
|
+
undefined,
|
|
9
|
+
// Null
|
|
10
|
+
null: null,
|
|
11
|
+
// Empty string
|
|
12
|
+
emptyString: '',
|
|
13
|
+
// Empty array
|
|
14
|
+
emptyArray: [],
|
|
15
|
+
// Empty object
|
|
16
|
+
emptyObject: {},
|
|
17
|
+
// String
|
|
18
|
+
color: 'red',
|
|
19
|
+
// False property
|
|
20
|
+
isDisabled: false,
|
|
21
|
+
// Boolean without a prefix (is or has)
|
|
22
|
+
visible: true,
|
|
23
|
+
// Has prefix
|
|
24
|
+
hasButton: true,
|
|
25
|
+
});
|
|
26
|
+
expect(className).toBe('test test--color-red test--is-visible test--has-button');
|
|
27
|
+
});
|
|
28
|
+
});
|