@nuskin/foundation-ui-components 1.0.0-cft-35.13 → 1.0.0-develop.2
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/package.json +1 -1
- package/src/common/alert/NsAlert.spec.tsx +17 -16
- package/src/common/alert/NsAlert.stories.tsx +2 -2
- package/src/common/alert/NsAlert.styled.ts +20 -20
- package/src/common/alert/NsAlert.tsx +21 -40
- package/src/common/alert/index.ts +2 -2
- package/src/common/auth-dropdown/NsAuthDropdown.spec.tsx +1 -1
- package/src/common/auth-dropdown/NsAuthDropdown.tsx +1 -1
- package/src/common/auth-dropdown/index.ts +1 -1
- package/src/common/autocomplete/NsAutocomplete.spec.tsx +5 -5
- package/src/common/autocomplete/NsAutocomplete.stories.tsx +1 -1
- package/src/common/autocomplete/NsAutocomplete.tsx +1 -1
- package/src/common/autocomplete/index.ts +2 -1
- package/src/common/banner/NsBanner.spec.tsx +1 -1
- package/src/common/banner/NsBanner.styled.tsx +1 -1
- package/src/common/banner/NsBanner.tsx +1 -1
- package/src/common/banner/index.ts +1 -1
- package/src/common/brand-components/NsBrandComponent.tsx +1 -1
- package/src/common/brand-components/index.ts +1 -1
- package/src/common/breadcrumb/NsBreadcrumb.spec.tsx +1 -1
- package/src/common/breadcrumb/NsBreadcrumb.tsx +1 -1
- package/src/common/breadcrumb/index.ts +1 -1
- package/src/common/button/NsButton.spec.tsx +1 -1
- package/src/common/button/NsButton.styled.tsx +10 -13
- package/src/common/button/NsButton.tsx +1 -1
- package/src/common/button/index.ts +1 -1
- package/src/common/card/NsFfgCard.tsx +1 -1
- package/src/common/carousal/NsScrollingCarousal.tsx +37 -0
- package/src/common/carousal/index.ts +3 -0
- package/src/common/carousal/stories/NSCarousal.stories.tsx +1 -1
- package/src/common/carousal/stories/NsScrollingCarousal.stories.tsx +52 -0
- package/src/common/carousal/tests/NsCarousal.spec.tsx +2 -2
- package/src/common/carousal/tests/NsScrollingCarousal.spec.tsx +61 -0
- package/src/common/carousal/types.d.ts +21 -0
- package/src/common/cart-icon/NsCartIcon.spec.tsx +1 -1
- package/src/common/cart-icon/NsCartIcon.tsx +1 -1
- package/src/common/cart-icon/index.ts +1 -1
- package/src/common/checkbox/NsCheckbox.spec.tsx +2 -2
- package/src/common/checkbox/NsCheckbox.tsx +1 -1
- package/src/common/checkbox/index.ts +1 -1
- package/src/common/checkbox/types.d.ts +1 -7
- package/src/common/column-control/NsColumnControl.tsx +1 -1
- package/src/common/column-control/NsFlexColumns.tsx +27 -0
- package/src/common/column-control/NsGridColumns.tsx +27 -0
- package/src/common/column-control/index.ts +3 -1
- package/src/common/column-control/{NsColumnControl.spec.tsx → specs/NsColumnControl.spec.tsx} +3 -3
- package/src/common/column-control/specs/NsFlexColumns.spec.tsx +24 -0
- package/src/common/column-control/specs/NsGridColumns.spec.tsx +24 -0
- package/src/common/column-control/{NDivs.story.tsx → stories/NDivs.story.tsx} +1 -1
- package/src/common/column-control/{NsColumnControl.stories.tsx → stories/NsColumnControl.stories.tsx} +4 -14
- package/src/common/column-control/stories/NsFlexColumns.stories.tsx +59 -0
- package/src/common/column-control/stories/NsGridColumns.stories.tsx +59 -0
- package/src/common/column-control/stories/common.tsx +14 -0
- package/src/common/column-control/styled/StyledFlex.tsx +41 -0
- package/src/common/column-control/styled/StyledGrid.tsx +33 -0
- package/src/common/column-control/styled/common.ts +27 -0
- package/src/common/column-control/utils.ts +1 -1
- package/src/common/dropdown/NsDropdown.spec.tsx +1 -1
- package/src/common/dropdown/NsDropdown.tsx +1 -1
- package/src/common/dropdown/NsDropdownOption.tsx +1 -1
- package/src/common/dropdown/index.ts +1 -1
- package/src/common/flag/NsFlag.spec.tsx +1 -1
- package/src/common/flag/NsFlag.styled.tsx +3 -5
- package/src/common/flag/NsFlag.tsx +1 -1
- package/src/common/flag/index.ts +1 -1
- package/src/common/flag/types.d.ts +0 -2
- package/src/common/icon/NsIcon.spec.tsx +1 -1
- package/src/common/icon/NsIcon.styled.tsx +1 -1
- package/src/common/icon/NsIcon.tsx +1 -1
- package/src/common/icon/NsIconVariants.ts +8 -4
- package/src/common/icon/icons/AlertErrorIcon.tsx +15 -6
- package/src/common/icon/icons/HamburgerIcon.tsx +29 -0
- package/src/common/icon/icons/UserIcon.tsx +30 -0
- package/src/common/icon/icons/WarningIcon.tsx +14 -5
- package/src/common/icon/index.ts +1 -1
- package/src/common/image/NsImage.spec.tsx +1 -1
- package/src/common/image/NsImage.tsx +1 -1
- package/src/common/image/NsNextImage.spec.tsx +1 -1
- package/src/common/image/NsNextImage.tsx +1 -1
- package/src/common/image/index.ts +1 -1
- package/src/common/index.ts +7 -10
- package/src/common/input/InputWrapper.tsx +1 -1
- package/src/common/input/NsInputField.tsx +1 -1
- package/src/common/input/getAdornmentProps.tsx +1 -1
- package/src/common/input/index.ts +1 -1
- package/src/common/label/NsLabel.tsx +1 -1
- package/src/common/label/index.ts +1 -1
- package/src/common/link/NsLink.spec.tsx +1 -1
- package/src/common/link/NsLink.tsx +1 -1
- package/src/common/link/index.ts +1 -1
- package/src/common/nav-product-card/NsNavProductCard.spec.tsx +1 -1
- package/src/common/nav-product-card/NsNavProductCard.tsx +1 -1
- package/src/common/nav-product-card/index.ts +1 -1
- package/src/common/nav-tab/NsNavTab.spec.tsx +2 -2
- package/src/common/nav-tab/NsNavTab.tsx +1 -1
- package/src/common/nav-tab/index.ts +1 -1
- package/src/common/search-bar/NsSeachBar.spec.tsx +1 -1
- package/src/common/table/NsTable.spec.tsx +146 -0
- package/src/common/table/NsTable.stories.tsx +123 -0
- package/src/common/table/NsTable.styled.ts +33 -0
- package/src/common/table/NsTable.tsx +161 -0
- package/src/common/table/NsTableHeader.tsx +48 -0
- package/src/common/table/NsTablePagination.tsx +20 -0
- package/src/common/table/helper.ts +33 -0
- package/src/common/table/index.ts +2 -0
- package/src/common/table/types.d.ts +44 -0
- package/src/common/text-strip/NsTextStrip.spec.tsx +30 -0
- package/src/common/text-strip/NsTextStrip.stories.tsx +32 -0
- package/src/common/text-strip/NsTextStrip.tsx +41 -0
- package/src/common/text-strip/index.ts +2 -0
- package/src/common/text-strip/types.d.ts +14 -0
- package/src/common/typography/NsTypography.tsx +1 -1
- package/src/common/typography/Typography.styled.tsx +1 -1
- package/src/common/typography/index.ts +1 -1
- package/src/common/videos/NsVideo.tsx +1 -1
- package/src/common/videos/index.ts +1 -1
- /package/src/common/autocomplete/{types.ts → types.d.ts} +0 -0
- /package/src/common/{common.types.ts → common.types.d.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ListItem, ListItemContainer } from './NsDropdown.styled';
|
|
3
|
-
import { DropdownOptionProps } from './types';
|
|
3
|
+
import { DropdownOptionProps } from './types.d';
|
|
4
4
|
|
|
5
5
|
export const NsDropdownOption: React.FC<DropdownOptionProps> = ({
|
|
6
6
|
value,
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import nuskinTheme from '@nuskin/foundation-theme/src/themes/genome-foundation';
|
|
10
10
|
|
|
11
|
-
import { render } from '
|
|
11
|
+
import { render } from '@/test-utils/index';
|
|
12
12
|
import NsFlag from './NsFlag';
|
|
13
13
|
|
|
14
14
|
const { palette } = nuskinTheme;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { Theme } from '@mui/material';
|
|
8
8
|
import { styled, ColorUtils, FoundationTheme } from '@nuskin/foundation-theme';
|
|
9
9
|
|
|
10
|
-
import { NsFlagSize } from './types';
|
|
10
|
+
import { NsFlagSize } from './types.d';
|
|
11
11
|
|
|
12
12
|
type NsFlagThemeParams = {
|
|
13
13
|
$size: NsFlagSize;
|
|
@@ -33,11 +33,9 @@ const makeFlagSize = ({ $size }: { $size: NsFlagSize }) => {
|
|
|
33
33
|
return sizeValue / FLAG_SCALE_VALUE;
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
const {
|
|
37
|
-
getPaletteColor,
|
|
38
|
-
} = ColorUtils;
|
|
36
|
+
const { getPaletteColor } = ColorUtils;
|
|
39
37
|
|
|
40
|
-
const makeFlagBorder = ({ $size, $bgColor = 'accentColorA', theme}: NsFlagThemeParams) => {
|
|
38
|
+
const makeFlagBorder = ({ $size, $bgColor = 'accentColorA', theme }: NsFlagThemeParams) => {
|
|
41
39
|
if (theme) {
|
|
42
40
|
return `${makeFlagSize({ $size })}px solid ${getPaletteColor(theme, $bgColor)}`;
|
|
43
41
|
}
|
|
@@ -8,7 +8,7 @@ import React, { PropsWithChildren } from 'react';
|
|
|
8
8
|
|
|
9
9
|
import { StyledFlag } from './NsFlag.styled';
|
|
10
10
|
|
|
11
|
-
import { NsFlagProps } from './types';
|
|
11
|
+
import { NsFlagProps } from './types.d';
|
|
12
12
|
|
|
13
13
|
const NsFlag = (props: PropsWithChildren<NsFlagProps>) => {
|
|
14
14
|
const { className = '', size = 'small', color = 'accentColorA', message, testId = 'ns-flag-component' } = props;
|
package/src/common/flag/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as NsFlag } from './NsFlag';
|
|
2
|
-
export type { NsFlagProps, NsFlagSize } from './types';
|
|
2
|
+
export type { NsFlagProps, NsFlagSize } from './types.d';
|
|
@@ -17,27 +17,31 @@ import Home from './icons/home';
|
|
|
17
17
|
import AlertErrorIcon from './icons/AlertErrorIcon';
|
|
18
18
|
import WarningIcon from './icons/WarningIcon';
|
|
19
19
|
import CloseIcon from './icons/CloseIcon';
|
|
20
|
+
import UserIcon from './icons/UserIcon';
|
|
21
|
+
import HamburgerIcon from './icons/HamburgerIcon';
|
|
20
22
|
|
|
21
23
|
const IconVariants = {
|
|
22
24
|
arrowDown: ArrowDown,
|
|
23
25
|
arrowUp: ArrowUp,
|
|
24
26
|
arrowLeft: ArrowLeft,
|
|
25
27
|
arrowRight: ArrowRight,
|
|
28
|
+
alertError: AlertErrorIcon,
|
|
26
29
|
cart: Cart,
|
|
27
30
|
cartBadge: CartBadge,
|
|
31
|
+
close: CloseIcon,
|
|
28
32
|
checkShield: CheckShield,
|
|
29
33
|
checkVerified: CheckVerified,
|
|
30
34
|
error: ErrorIcon,
|
|
35
|
+
hamburgerIcon: HamburgerIcon,
|
|
36
|
+
home: Home,
|
|
31
37
|
infoFilled: InfoFilled,
|
|
32
38
|
infoOutlined: InfoOutlined,
|
|
33
39
|
search: SearchIcon,
|
|
34
40
|
success: SuccessIcon,
|
|
35
|
-
trash: TrashIcon,
|
|
36
41
|
slash: SlashIcon,
|
|
37
|
-
|
|
38
|
-
|
|
42
|
+
trash: TrashIcon,
|
|
43
|
+
userIcon: UserIcon,
|
|
39
44
|
warning: WarningIcon,
|
|
40
|
-
close: CloseIcon
|
|
41
45
|
};
|
|
42
46
|
|
|
43
47
|
export default IconVariants;
|
|
@@ -16,17 +16,26 @@ const AlertErrorIcon = (props: SvgIconProps) => {
|
|
|
16
16
|
xmlns="http://www.w3.org/2000/svg"
|
|
17
17
|
{...props}
|
|
18
18
|
>
|
|
19
|
-
<g id="
|
|
19
|
+
<g id="icon/alert/WarningFill-red" transform="translate(1.000000, 1.000000)">
|
|
20
20
|
<g id="Error2" transform="translate(0.000000, 1.200000)">
|
|
21
|
-
<path
|
|
21
|
+
<path
|
|
22
|
+
d="M17.9465423,14.8670135 L9.44311247,0.246687943 C9.35049358,0.100809118 9.18936767,0.012383152 9.01617259,0.012383152 C8.84297751,0.012383152 8.68185161,
|
|
22
23
|
0.100809118 8.58923271,0.246687943 L0.0706452929,14.8670135 C-0.0142965839,15.0216954 -0.0118890438,15.2093943 0.0769925071,15.3618609 C0.165874058,
|
|
23
24
|
15.5143276 0.328282319,15.6093523 0.505163987,15.6123832 L17.5120236,15.6123832 C17.6889052,15.6093523 17.8513135,15.5143276 17.940195,15.3618609 C18.0290766,
|
|
24
|
-
15.2093943 18.0314841,15.0216954 17.9465423,14.8670135 Z"
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
15.2093943 18.0314841,15.0216954 17.9465423,14.8670135 Z"
|
|
26
|
+
id="Shape"
|
|
27
|
+
fill={props.fill || '#B2140A'}
|
|
28
|
+
fillRule="nonzero"
|
|
29
|
+
></path>
|
|
30
|
+
<path
|
|
31
|
+
d="M8.19,12.84 C8.16437588,12.6281014 8.2368299,12.4160897 8.38677958,12.2641927 C8.53672927,12.1122956 8.74778837,12.0371121 8.96,12.06 C9.16715704,
|
|
27
32
|
12.0467652 9.37034806,12.1211477 9.52,12.265 C9.65709398,12.4241339 9.72701115,12.6303 9.715,12.84 C9.72048715,13.0522748 9.64341383,13.2584012 9.5,
|
|
28
33
|
13.415 C9.35312473,13.5641498 9.1489517,13.6425377 8.94,13.63 C8.72997224,13.6424095 8.52401376,13.5683367 8.37,13.425 C8.23531653,13.2613056 8.17063593,
|
|
29
|
-
13.0510936 8.19,12.84 Z M9.415,11.195 L8.5,11.195 L8.25,5.96 L9.675,5.96 L9.415,11.195 Z"
|
|
34
|
+
13.0510936 8.19,12.84 Z M9.415,11.195 L8.5,11.195 L8.25,5.96 L9.675,5.96 L9.415,11.195 Z"
|
|
35
|
+
id="Shape"
|
|
36
|
+
fill={props.fill || '#FFFFFF'}
|
|
37
|
+
fillRule="nonzero"
|
|
38
|
+
></path>
|
|
30
39
|
</g>
|
|
31
40
|
</g>
|
|
32
41
|
</SvgIcon>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
2
|
+
import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param props {fill: color to be filled for icon, color: color of the tick icon}
|
|
6
|
+
*/
|
|
7
|
+
const HamburgerIcon = (props: SvgIconProps) => {
|
|
8
|
+
return (
|
|
9
|
+
<SvgIcon viewBox="0 0 24 24" {...props} data-testid="hamburgerIcon" xmlns="http://www.w3.org/2000/svg">
|
|
10
|
+
<path
|
|
11
|
+
fillRule="evenodd"
|
|
12
|
+
clipRule="evenodd"
|
|
13
|
+
d="M0 1C0 0.447715 0.447715 0 1 0H19C19.5523 0 20 0.447715 20 1C20 1.55228 19.5523 2 19 2H1C0.447715 2 0 1.55228 0 1Z"
|
|
14
|
+
/>
|
|
15
|
+
<path
|
|
16
|
+
fillRule="evenodd"
|
|
17
|
+
clipRule="evenodd"
|
|
18
|
+
d="M0 9C0 8.44772 0.447715 8 1 8H19C19.5523 8 20 8.44772 20 9C20 9.55228 19.5523 10 19 10H1C0.447715 10 0 9.55228 0 9Z"
|
|
19
|
+
/>
|
|
20
|
+
<path
|
|
21
|
+
fillRule="evenodd"
|
|
22
|
+
clipRule="evenodd"
|
|
23
|
+
d="M0 17C0 16.4477 0.447715 16 1 16H19C19.5523 16 20 16.4477 20 17C20 17.5523 19.5523 18 19 18H1C0.447715 18 0 17.5523 0 17Z"
|
|
24
|
+
/>
|
|
25
|
+
</SvgIcon>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default HamburgerIcon;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
2
|
+
import { useTheme } from '@mui/material/styles';
|
|
3
|
+
import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon';
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param props {fill: color to be filled for icon, color: color of the tick icon}
|
|
7
|
+
*/
|
|
8
|
+
const UserIcon = (props: SvgIconProps) => {
|
|
9
|
+
const { palette } = useTheme();
|
|
10
|
+
const strokeColor = palette.primary.main;
|
|
11
|
+
return (
|
|
12
|
+
<SvgIcon viewBox="0 0 24 24" {...props} data-testid="userIcon" xmlns="http://www.w3.org/2000/svg">
|
|
13
|
+
<path
|
|
14
|
+
fillRule="evenodd"
|
|
15
|
+
clipRule="evenodd"
|
|
16
|
+
d="M12 23C18.0751 23 23 18.0751 23 12C23 5.92487 18.0751 1 12 1C5.92487 1 1 5.92487 1 12C1 18.0751 5.92487 23 12 23Z"
|
|
17
|
+
stroke={strokeColor}
|
|
18
|
+
strokeWidth="2"
|
|
19
|
+
/>
|
|
20
|
+
<path
|
|
21
|
+
d="M19 20C18.9425 19.3229 19 17.5669 17.3793 17.2226C14.7126 16.6144 13.931 16.4078 14.1034 14.2272C15.8046 13.0796 15.7816 11.0252 15.7471 8.74139C15.7471 6.67508 14.0695 5 12 5C9.93052 5 8.25287 6.67508 8.25287 8.74139C8.25287 11.0367 8.25287 13.137 9.89655 14.2272C10.0575 16.4078 9.28736 16.6144 6.62069 17.2226C5 17.5669 5.05747 19.3229 5 20"
|
|
22
|
+
stroke={strokeColor}
|
|
23
|
+
strokeWidth="2"
|
|
24
|
+
strokeLinecap="round"
|
|
25
|
+
/>
|
|
26
|
+
</SvgIcon>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default UserIcon;
|
|
@@ -18,15 +18,24 @@ const WarningIcon = (props: SvgIconProps) => {
|
|
|
18
18
|
>
|
|
19
19
|
<g id="💎-icon/alert/WarningFill-yellow" transform="translate(1.000000, 1.000000)">
|
|
20
20
|
<g id="Warning2" transform="translate(0.000000, 1.200000)">
|
|
21
|
-
<path
|
|
21
|
+
<path
|
|
22
|
+
d="M17.9465423,14.8670135 L9.44311247,0.246687943 C9.35049358,0.100809118 9.18936767,0.012383152 9.01617259,0.012383152 C8.84297751,0.012383152 8.68185161,
|
|
22
23
|
0.100809118 8.58923271,0.246687943 L0.0706452929,14.8670135 C-0.0142965839,15.0216954 -0.0118890438,15.2093943 0.0769925071,15.3618609 C0.165874058,
|
|
23
24
|
15.5143276 0.328282319,15.6093523 0.505163987,15.6123832 L17.5120236,15.6123832 C17.6889052,15.6093523 17.8513135,15.5143276 17.940195,15.3618609 C18.0290766,
|
|
24
|
-
15.2093943 18.0314841,15.0216954 17.9465423,14.8670135 Z"
|
|
25
|
-
|
|
25
|
+
15.2093943 18.0314841,15.0216954 17.9465423,14.8670135 Z"
|
|
26
|
+
id="Shape"
|
|
27
|
+
fill="#FEBD00"
|
|
28
|
+
fillRule="nonzero"
|
|
29
|
+
></path>
|
|
30
|
+
<path
|
|
31
|
+
d="M8.19,12.84 C8.16437588,12.6281014 8.2368299,12.4160897 8.38677958,12.2641927 C8.53672927,12.1122956 8.74778837,12.0371121 8.96,12.06 C9.16715704,
|
|
26
32
|
12.0467652 9.37034806,12.1211477 9.52,12.265 C9.65709398,12.4241339 9.72701115,12.6303 9.715,12.84 C9.72048715,13.0522748 9.64341383,13.2584012 9.5,
|
|
27
33
|
13.415 C9.35312473,13.5641498 9.1489517,13.6425377 8.94,13.63 C8.72997224,13.6424095 8.52401376,13.5683367 8.37,13.425 C8.23531653,13.2613056 8.17063593,
|
|
28
|
-
13.0510936 8.19,12.84 Z M9.415,11.195 L8.5,11.195 L8.25,5.96 L9.675,5.96 L9.415,11.195 Z"
|
|
29
|
-
|
|
34
|
+
13.0510936 8.19,12.84 Z M9.415,11.195 L8.5,11.195 L8.25,5.96 L9.675,5.96 L9.415,11.195 Z"
|
|
35
|
+
id="Shape"
|
|
36
|
+
fill="#FFFFFF"
|
|
37
|
+
fillRule="nonzero"
|
|
38
|
+
></path>
|
|
30
39
|
</g>
|
|
31
40
|
</g>
|
|
32
41
|
</SvgIcon>
|
package/src/common/icon/index.ts
CHANGED
package/src/common/index.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
export * from './alert';
|
|
1
2
|
export * from './auth-dropdown';
|
|
3
|
+
export * from './autocomplete';
|
|
2
4
|
export * from './banner';
|
|
3
5
|
export * from './breadcrumb';
|
|
4
6
|
export * from './brand-components';
|
|
@@ -8,21 +10,16 @@ export * from './carousal';
|
|
|
8
10
|
export * from './cart-icon';
|
|
9
11
|
export * from './column-control';
|
|
10
12
|
export * from './checkbox';
|
|
13
|
+
export * from './common.types.d';
|
|
11
14
|
export * from './dropdown';
|
|
12
15
|
export * from './flag';
|
|
13
16
|
export * from './icon';
|
|
14
|
-
export * from './input';
|
|
15
17
|
export * from './image';
|
|
16
|
-
export * from './
|
|
18
|
+
export * from './input';
|
|
17
19
|
export * from './label';
|
|
18
|
-
export * from './
|
|
19
|
-
|
|
20
|
-
/* Dropdown Components */
|
|
21
|
-
export * from './dropdown';
|
|
22
|
-
export * from './auth-dropdown';
|
|
23
|
-
export * from './alert';
|
|
20
|
+
export * from './link';
|
|
24
21
|
export * from './nav-tab';
|
|
25
22
|
export * from './nav-product-card';
|
|
23
|
+
export * from './text-strip';
|
|
24
|
+
export * from './table';
|
|
26
25
|
export * from './typography';
|
|
27
|
-
|
|
28
|
-
export * from './common.types';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TextField, FormHelperText } from '@mui/material';
|
|
2
2
|
import InputWrapper from './InputWrapper';
|
|
3
|
-
import { NsInputFieldProps } from './types';
|
|
3
|
+
import { NsInputFieldProps } from './types.d';
|
|
4
4
|
import { NsLabel } from '../label';
|
|
5
5
|
import InputFieldWrapper from './InputFieldWrapper';
|
|
6
6
|
import { getAdornmentProps } from './getAdornmentProps';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as NsInputField } from './NsInputField';
|
|
2
|
-
export type { NsInputFieldProps } from './types';
|
|
2
|
+
export type { NsInputFieldProps } from './types.d';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as NsLabel } from './NsLabel';
|
|
2
|
-
export type { NsLabelProps } from './types';
|
|
2
|
+
export type { NsLabelProps } from './types.d';
|
package/src/common/link/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as NsLink } from './NsLink';
|
|
2
|
-
export type { NsLinkProps } from './types';
|
|
2
|
+
export type { NsLinkProps } from './types.d';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import React, { PropsWithChildren } from 'react';
|
|
3
3
|
import { NsImage, NsTypography } from '../';
|
|
4
4
|
import { ProductCardContainer } from './NsNavProductCard.styled';
|
|
5
|
-
import { NsNavProductCardProps } from './types';
|
|
5
|
+
import { NsNavProductCardProps } from './types.d';
|
|
6
6
|
|
|
7
7
|
/* TODO: can we update NsImage with NsNextImage, once storybook 7 is in place */
|
|
8
8
|
export const NsNavProductCard = ({
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { NsNavProductCard as NsNavProductCard } from './NsNavProductCard';
|
|
2
|
-
export type { NsNavProductCardProps } from './types';
|
|
2
|
+
export type { NsNavProductCardProps } from './types.d';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { fireEvent } from '@testing-library/react';
|
|
2
2
|
import nuskinTheme from '@nuskin/foundation-theme/src/themes/genome-foundation';
|
|
3
3
|
import { NsNavTabComponent } from './NsNavTab';
|
|
4
|
-
import { NavTabs } from './types';
|
|
5
|
-
import { render } from '
|
|
4
|
+
import { NavTabs } from './types.d';
|
|
5
|
+
import { render } from '@/test-utils/index';
|
|
6
6
|
|
|
7
7
|
const { palette } = nuskinTheme;
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@ import React, { PropsWithChildren, useState } from 'react';
|
|
|
2
2
|
import { LayoutGroup } from 'framer-motion';
|
|
3
3
|
import { NsTypography } from '../typography';
|
|
4
4
|
import { NavDrawerContainer, NavTabContainer, NavTabLine, NavTabUnderLine, NavDrawer } from './NsNavTab.styled';
|
|
5
|
-
import { NSNavTabComponentProps } from './types';
|
|
5
|
+
import { NSNavTabComponentProps } from './types.d';
|
|
6
6
|
|
|
7
7
|
export const NsNavTabComponent = (props: PropsWithChildren<NSNavTabComponentProps>) => {
|
|
8
8
|
const { tabs, className, tabTitleClassName, showDrawer = true } = props;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { NsNavTabComponent as NsNavTab } from './NsNavTab';
|
|
2
|
-
export type { NSNavTabComponentProps, NavTabs } from './types';
|
|
2
|
+
export type { NSNavTabComponentProps, NavTabs } from './types.d';
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, fireEvent, screen } from '@/test-utils/index';
|
|
3
|
+
import NsTable from './NsTable';
|
|
4
|
+
|
|
5
|
+
describe('NsTable', () => {
|
|
6
|
+
const headers = [
|
|
7
|
+
{ id: 'name', label: 'Name', numeric: false },
|
|
8
|
+
{ id: 'age', label: 'Age', numeric: true },
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
const items = [
|
|
12
|
+
{ name: 'John', age: 26 },
|
|
13
|
+
{ name: 'Jane', age: 32 },
|
|
14
|
+
{ name: 'Maria', age: 28 },
|
|
15
|
+
{ name: 'Kevin', age: 31 },
|
|
16
|
+
{ name: 'Suzan', age: 25 },
|
|
17
|
+
{ name: 'Dan', age: 30 },
|
|
18
|
+
{ name: 'Micheal', age: 39 },
|
|
19
|
+
{ name: 'Sandy', age: 39 },
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
const rows = 5;
|
|
23
|
+
const isShowSelector = true;
|
|
24
|
+
const rowsPerPageOptions = [5, 10, 15];
|
|
25
|
+
const itemKey = 'name';
|
|
26
|
+
|
|
27
|
+
it('renders table with correct data', () => {
|
|
28
|
+
render(
|
|
29
|
+
<NsTable
|
|
30
|
+
headers={headers}
|
|
31
|
+
items={items}
|
|
32
|
+
rows={rows}
|
|
33
|
+
isShowSelector={isShowSelector}
|
|
34
|
+
rowsPerPageOptions={rowsPerPageOptions}
|
|
35
|
+
itemKey={itemKey}
|
|
36
|
+
isPagination
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
expect(screen.getByText('Name')).toBeInTheDocument();
|
|
41
|
+
expect(screen.getByText('Age')).toBeInTheDocument();
|
|
42
|
+
expect(screen.getByText('Kevin')).toBeInTheDocument();
|
|
43
|
+
expect(screen.getByText('Maria')).toBeInTheDocument();
|
|
44
|
+
expect(screen.getByText('28')).toBeInTheDocument();
|
|
45
|
+
expect(screen.getByText('31')).toBeInTheDocument();
|
|
46
|
+
expect(screen.getByRole('button', { name: 'Rows per page: 5' })).toBeInTheDocument();
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('selects and deselects rows on click', () => {
|
|
50
|
+
render(
|
|
51
|
+
<NsTable
|
|
52
|
+
headers={headers}
|
|
53
|
+
items={items}
|
|
54
|
+
rows={rows}
|
|
55
|
+
isShowSelector={isShowSelector}
|
|
56
|
+
rowsPerPageOptions={rowsPerPageOptions}
|
|
57
|
+
itemKey={itemKey}
|
|
58
|
+
isPagination
|
|
59
|
+
/>
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
expect(screen.getByText('Kevin')).toBeInTheDocument();
|
|
63
|
+
const button = screen.getByText('Kevin');
|
|
64
|
+
fireEvent.click(button);
|
|
65
|
+
|
|
66
|
+
expect(screen.getByTestId('table-row-3')).toHaveAttribute('aria-checked', 'true');
|
|
67
|
+
fireEvent.click(button);
|
|
68
|
+
expect(screen.getByTestId('table-row-3')).toHaveAttribute('aria-checked', 'false');
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('hide selectors', () => {
|
|
72
|
+
render(
|
|
73
|
+
<NsTable
|
|
74
|
+
headers={headers}
|
|
75
|
+
items={items}
|
|
76
|
+
rows={rows}
|
|
77
|
+
isShowSelector={!isShowSelector}
|
|
78
|
+
rowsPerPageOptions={rowsPerPageOptions}
|
|
79
|
+
itemKey={itemKey}
|
|
80
|
+
isPagination
|
|
81
|
+
/>
|
|
82
|
+
);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('selects all rows', () => {
|
|
86
|
+
render(
|
|
87
|
+
<NsTable
|
|
88
|
+
headers={headers}
|
|
89
|
+
items={items}
|
|
90
|
+
rows={rows}
|
|
91
|
+
isShowSelector={isShowSelector}
|
|
92
|
+
rowsPerPageOptions={rowsPerPageOptions}
|
|
93
|
+
itemKey={itemKey}
|
|
94
|
+
isPagination
|
|
95
|
+
/>
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
expect(screen.getByTestId('header-checkbox')).toBeInTheDocument();
|
|
99
|
+
|
|
100
|
+
const button = screen.getByTestId('header-checkbox');
|
|
101
|
+
|
|
102
|
+
fireEvent.click(button);
|
|
103
|
+
expect(screen.getByTestId('table-checkbox-0')).toHaveClass('PrivateSwitchBase-input');
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it('selects all rows when click all values', async () => {
|
|
107
|
+
render(
|
|
108
|
+
<NsTable
|
|
109
|
+
headers={headers}
|
|
110
|
+
items={items}
|
|
111
|
+
rows={rows}
|
|
112
|
+
isShowSelector={isShowSelector}
|
|
113
|
+
rowsPerPageOptions={rowsPerPageOptions}
|
|
114
|
+
itemKey={itemKey}
|
|
115
|
+
isPagination
|
|
116
|
+
/>
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
expect(screen.getByTestId('KeyboardArrowRightIcon')).toBeInTheDocument();
|
|
120
|
+
|
|
121
|
+
const button = screen.getByTestId('KeyboardArrowRightIcon');
|
|
122
|
+
fireEvent.click(button);
|
|
123
|
+
expect(screen.getByText('Sandy')).toBeInTheDocument();
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it('sort rows via age', () => {
|
|
127
|
+
render(
|
|
128
|
+
<NsTable
|
|
129
|
+
headers={headers}
|
|
130
|
+
items={items}
|
|
131
|
+
rows={rows}
|
|
132
|
+
isShowSelector={isShowSelector}
|
|
133
|
+
rowsPerPageOptions={rowsPerPageOptions}
|
|
134
|
+
itemKey={itemKey}
|
|
135
|
+
isPagination
|
|
136
|
+
/>
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
expect(screen.getByText('Age')).toBeInTheDocument();
|
|
140
|
+
const button = screen.getByText('Age');
|
|
141
|
+
fireEvent.click(button);
|
|
142
|
+
|
|
143
|
+
expect(screen.getByText('John')).toBeInTheDocument();
|
|
144
|
+
fireEvent.click(button);
|
|
145
|
+
});
|
|
146
|
+
});
|