@nuskin/foundation-ui-components 1.4.2-export-updates.2 → 1.6.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/package.json +2 -2
- package/src/common/autocomplete/NsAutocomplete.stories.tsx +2 -2
- package/src/common/breadcrumb/NsBreadcrumb.spec.tsx +2 -2
- package/src/common/breadcrumb/NsBreadcrumb.stories.tsx +4 -4
- package/src/common/breadcrumb/NsBreadcrumb.styled.tsx +7 -0
- package/src/common/breadcrumb/NsBreadcrumb.tsx +18 -9
- package/src/common/breadcrumb/types.d.ts +2 -1
- package/src/common/icon/NsIconVariants.ts +4 -0
- package/src/common/icon/icons/ChevronRight.tsx +26 -0
- package/src/common/icon/icons/RoundedClose.tsx +28 -0
- package/src/common/index.ts +31 -32
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuskin/foundation-ui-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "It is a foundation library written in react, that provides common components to all UI pages",
|
|
5
5
|
"main": "src/common/index.ts",
|
|
6
6
|
"repository": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@mui/material": "5.4.2",
|
|
47
47
|
"@mui/utils": "^5.14.1",
|
|
48
48
|
"@next/font": "13.2.4",
|
|
49
|
-
"@nuskin/foundation-theme": "^1.0.
|
|
49
|
+
"@nuskin/foundation-theme": "^1.0.1",
|
|
50
50
|
"framer-motion": "^10.8.5",
|
|
51
51
|
"next": "13.2.4",
|
|
52
52
|
"react": "18.2.0",
|
|
@@ -47,7 +47,7 @@ export default {
|
|
|
47
47
|
},
|
|
48
48
|
},
|
|
49
49
|
iconStart: <NsIcon name="search" />,
|
|
50
|
-
iconEnd: <NsIcon name="
|
|
50
|
+
iconEnd: <NsIcon name="roundedClose" size="small" colorOverride="#F5F5F5" />,
|
|
51
51
|
placeholder: 'search',
|
|
52
52
|
},
|
|
53
53
|
} as MetaStory;
|
|
@@ -93,7 +93,7 @@ const RenderAutocomplete = (args: NsAutocompleteProps) => {
|
|
|
93
93
|
OptionsUI={OptionUiComponent}
|
|
94
94
|
iconEnd={
|
|
95
95
|
<IconButton onClick={onInputClear}>
|
|
96
|
-
<NsIcon name="
|
|
96
|
+
<NsIcon name="roundedClose" size="xLarge" colorOverride="#F5F5F5" />
|
|
97
97
|
</IconButton>
|
|
98
98
|
}
|
|
99
99
|
value={selectedOption}
|
|
@@ -14,7 +14,7 @@ describe('Breadcrumb', () => {
|
|
|
14
14
|
});
|
|
15
15
|
|
|
16
16
|
it('2. renders breadcrumb items with navigation icons', () => {
|
|
17
|
-
render(<NsBreadcrumb items={breadcrumbItems}
|
|
17
|
+
render(<NsBreadcrumb items={breadcrumbItems} />);
|
|
18
18
|
expect(getByText('Home')).toBeInTheDocument();
|
|
19
19
|
expect(getByText('Products')).toBeInTheDocument();
|
|
20
20
|
expect(getByText('Shirts')).toBeInTheDocument();
|
|
@@ -22,7 +22,7 @@ describe('Breadcrumb', () => {
|
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
it('3. renders breadcrumb items with navigation icons', () => {
|
|
25
|
-
render(<NsBreadcrumb items={dummyItems}
|
|
25
|
+
render(<NsBreadcrumb items={dummyItems} />);
|
|
26
26
|
expect(getByText('Home')).toBeInTheDocument();
|
|
27
27
|
});
|
|
28
28
|
});
|
|
@@ -17,7 +17,7 @@ export default {
|
|
|
17
17
|
component: NsBreadcrumb,
|
|
18
18
|
decorators: [withCenterDecorator],
|
|
19
19
|
argTypes: {
|
|
20
|
-
|
|
20
|
+
underline: { control: 'boolean' },
|
|
21
21
|
},
|
|
22
22
|
args: {
|
|
23
23
|
items: [
|
|
@@ -26,14 +26,14 @@ export default {
|
|
|
26
26
|
{ label: 'Call to action', href: '/products/shirts' },
|
|
27
27
|
{ label: 'Product', href: '' },
|
|
28
28
|
],
|
|
29
|
-
|
|
29
|
+
underline: true,
|
|
30
|
+
separator: 'chevronRight',
|
|
30
31
|
},
|
|
31
32
|
} as MetaStory;
|
|
32
33
|
|
|
33
34
|
export const Breadcrumb: Story = {};
|
|
34
35
|
export const WithIcons: Story = {
|
|
35
36
|
args: {
|
|
36
|
-
items: breadcrumbItems
|
|
37
|
-
iconVisibility: true,
|
|
37
|
+
items: breadcrumbItems
|
|
38
38
|
},
|
|
39
39
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { styled } from '@nuskin/foundation-theme';
|
|
2
|
+
import { NsLink } from '../link';
|
|
2
3
|
|
|
3
4
|
export const BreadcrumbContainer = styled.nav`
|
|
4
5
|
margin-bottom: 10px;
|
|
@@ -27,3 +28,9 @@ export const BreadcrumbItem = styled.li`
|
|
|
27
28
|
transform: rotate(20deg);
|
|
28
29
|
}
|
|
29
30
|
`;
|
|
31
|
+
|
|
32
|
+
export const BreadcrumbStyledLink = styled(NsLink)<{ underlineVisibility?: boolean }>`
|
|
33
|
+
text-decoration: ${({ underlineVisibility }) => (underlineVisibility ? 'underline' : 'none')};
|
|
34
|
+
text-underline-offset: 4px;
|
|
35
|
+
font-weight: 700;
|
|
36
|
+
`;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
import { PropsWithChildren } from 'react';
|
|
8
8
|
|
|
9
|
-
import { BreadcrumbContainer, BreadcrumbItem, BreadcrumbList } from './NsBreadcrumb.styled';
|
|
10
|
-
import { NsTypography,
|
|
9
|
+
import { BreadcrumbContainer, BreadcrumbItem, BreadcrumbList, BreadcrumbStyledLink } from './NsBreadcrumb.styled';
|
|
10
|
+
import { NsTypography, NsIcon } from '../';
|
|
11
11
|
import { NsBreadcrumbProps, ItemProps } from './types.d';
|
|
12
12
|
import { useTheme } from '@mui/material/styles';
|
|
13
13
|
import { ColorUtils } from '@nuskin/foundation-theme';
|
|
@@ -15,7 +15,7 @@ import { ColorUtils } from '@nuskin/foundation-theme';
|
|
|
15
15
|
const { color } = ColorUtils;
|
|
16
16
|
|
|
17
17
|
const NsBreadcrumb = (props: PropsWithChildren<NsBreadcrumbProps>) => {
|
|
18
|
-
const { items,
|
|
18
|
+
const { items, underline = true, separator = 'chevronRight' } = props;
|
|
19
19
|
|
|
20
20
|
const theme = useTheme();
|
|
21
21
|
const neutral80 = color('neutral', '80')({ theme });
|
|
@@ -25,17 +25,21 @@ const NsBreadcrumb = (props: PropsWithChildren<NsBreadcrumbProps>) => {
|
|
|
25
25
|
if (item?.href) {
|
|
26
26
|
return (
|
|
27
27
|
<NsTypography variant="h6" colorOverride={neutral60}>
|
|
28
|
-
<
|
|
29
|
-
{
|
|
30
|
-
|
|
28
|
+
<BreadcrumbStyledLink
|
|
29
|
+
underlineVisibility={underline}
|
|
30
|
+
href={item.href}
|
|
31
|
+
underlineOnHover={!underline}
|
|
32
|
+
>
|
|
33
|
+
{item.icon ? (
|
|
34
|
+
<NsIcon name={item.icon} size="medium" testId="nav-icon" colorOverride={neutral60} />
|
|
31
35
|
) : null}
|
|
32
36
|
{item.label}
|
|
33
|
-
</
|
|
37
|
+
</BreadcrumbStyledLink>
|
|
34
38
|
</NsTypography>
|
|
35
39
|
);
|
|
36
40
|
} else {
|
|
37
41
|
return (
|
|
38
|
-
<NsTypography variant="h6" colorOverride={neutral80}>
|
|
42
|
+
<NsTypography variant="h6" weight="bold" colorOverride={neutral80}>
|
|
39
43
|
{item.label}
|
|
40
44
|
</NsTypography>
|
|
41
45
|
);
|
|
@@ -49,7 +53,12 @@ const NsBreadcrumb = (props: PropsWithChildren<NsBreadcrumbProps>) => {
|
|
|
49
53
|
<BreadcrumbItem key={item.label}>
|
|
50
54
|
{getLabel(item)}
|
|
51
55
|
{index !== items.length - 1 ? (
|
|
52
|
-
<NsIcon
|
|
56
|
+
<NsIcon
|
|
57
|
+
className={separator === 'slash' && 'slashIcon'}
|
|
58
|
+
name={separator}
|
|
59
|
+
size="medium"
|
|
60
|
+
colorOverride={neutral80}
|
|
61
|
+
/>
|
|
53
62
|
) : null}
|
|
54
63
|
</BreadcrumbItem>
|
|
55
64
|
))}
|
|
@@ -21,6 +21,8 @@ import UserIcon from './icons/UserIcon';
|
|
|
21
21
|
import HamburgerIcon from './icons/HamburgerIcon';
|
|
22
22
|
import UserOutline from './icons/UserOutline';
|
|
23
23
|
import Check from './icons/Check';
|
|
24
|
+
import RoundedClose from './icons/RoundedClose';
|
|
25
|
+
import ChevronRight from './icons/ChevronRight';
|
|
24
26
|
|
|
25
27
|
const IconVariants = {
|
|
26
28
|
arrowDown: ArrowDown,
|
|
@@ -46,6 +48,8 @@ const IconVariants = {
|
|
|
46
48
|
userIcon: UserIcon,
|
|
47
49
|
userOutline: UserOutline,
|
|
48
50
|
warning: WarningIcon,
|
|
51
|
+
roundedClose: RoundedClose,
|
|
52
|
+
chevronRight: ChevronRight,
|
|
49
53
|
};
|
|
50
54
|
|
|
51
55
|
export default IconVariants;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SvgIcon, SvgIconProps } from '@mui/material';
|
|
2
|
+
|
|
3
|
+
export const ChevronRight = (props: SvgIconProps) => {
|
|
4
|
+
return (
|
|
5
|
+
<SvgIcon
|
|
6
|
+
{...props}
|
|
7
|
+
data-testid="chevronRight"
|
|
8
|
+
viewBox="0 0 18 18"
|
|
9
|
+
fill="none"
|
|
10
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
+
>
|
|
12
|
+
<g id="arrow-right">
|
|
13
|
+
<path
|
|
14
|
+
id="icon"
|
|
15
|
+
fillRule="evenodd"
|
|
16
|
+
clipRule="evenodd"
|
|
17
|
+
// eslint-disable-next-line max-len
|
|
18
|
+
d="M12.1553 8.46967C12.4482 8.76256 12.4482 9.23744 12.1553 9.53033L6.90533 14.7803C6.61244 15.0732 6.13756 15.0732 5.84467 14.7803C5.55178 14.4874 5.55178 14.0126 5.84467 13.7197L10.5643 9L5.84467 4.28033C5.55178 3.98744 5.55178 3.51256 5.84467 3.21967C6.13756 2.92678 6.61244 2.92678 6.90533 3.21967L12.1553 8.46967Z"
|
|
19
|
+
fill={props.color}
|
|
20
|
+
/>
|
|
21
|
+
</g>
|
|
22
|
+
</SvgIcon>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default ChevronRight;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
2
|
+
|
|
3
|
+
import { SvgIconProps, SvgIcon } from '@mui/material';
|
|
4
|
+
|
|
5
|
+
const RoundedClose = (props: SvgIconProps) => {
|
|
6
|
+
return (
|
|
7
|
+
<SvgIcon
|
|
8
|
+
viewBox="0 0 20 20"
|
|
9
|
+
fill="none"
|
|
10
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
+
{...props}
|
|
12
|
+
data-testid="roundedClose"
|
|
13
|
+
>
|
|
14
|
+
<path
|
|
15
|
+
d="M4.4443 18.3147C6.08879 19.4135 8.02219 20 10 20C12.6505 19.9946 15.1909 18.9393 17.0651 17.0651C18.9393 15.1909 19.9946 12.6505 20 10C20 8.02219 19.4135 6.08879 18.3147 4.4443C17.2159 2.79981 15.6541 1.51809 13.8268 0.761209C11.9996 0.00433284 9.98891 -0.1937 8.0491 0.192152C6.10929 0.578004 4.32746 1.53041 2.92893 2.92894C1.53041 4.32746 0.578004 6.10929 0.192152 8.0491C-0.1937 9.98891 0.00433242 11.9996 0.761209 13.8268C1.51809 15.6541 2.79981 17.2159 4.4443 18.3147Z"
|
|
16
|
+
fill={props.color}
|
|
17
|
+
/>
|
|
18
|
+
<path
|
|
19
|
+
fillRule="evenodd"
|
|
20
|
+
clipRule="evenodd"
|
|
21
|
+
d="M6.18907 6.11091C6.5796 5.72039 7.21276 5.72039 7.60329 6.11091L10.0782 8.58579L12.553 6.11091C12.9436 5.72039 13.5767 5.72039 13.9672 6.11091C14.3578 6.50144 14.3578 7.1346 13.9672 7.52513L11.4924 10L13.9672 12.4749C14.3578 12.8654 14.3578 13.4986 13.9672 13.8891C13.5767 14.2796 12.9436 14.2796 12.553 13.8891L10.0782 11.4142L7.60329 13.8891C7.21276 14.2796 6.5796 14.2796 6.18908 13.8891C5.79855 13.4986 5.79855 12.8654 6.18907 12.4749L8.66395 10L6.18907 7.52513C5.79855 7.1346 5.79855 6.50144 6.18907 6.11091Z"
|
|
22
|
+
fill="#252525"
|
|
23
|
+
/>
|
|
24
|
+
</SvgIcon>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default RoundedClose;
|
package/src/common/index.ts
CHANGED
|
@@ -1,37 +1,36 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './accordion';
|
|
2
|
+
export * from './alert';
|
|
3
|
+
export * from './auth-dropdown';
|
|
4
|
+
export * from './autocomplete';
|
|
5
|
+
export * from './banner';
|
|
2
6
|
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export { NsButton } from './button';
|
|
11
|
-
export { NsBgCard } from './card';
|
|
12
|
-
export { NsCarousal } from './carousal';
|
|
13
|
-
export { NsCartIcon } from './cart-icon';
|
|
14
|
-
export { NsCheckbox } from './checkbox';
|
|
7
|
+
export * from './brand-components';
|
|
8
|
+
export * from './breadcrumb';
|
|
9
|
+
export * from './button';
|
|
10
|
+
export * from './card';
|
|
11
|
+
export * from './carousal';
|
|
12
|
+
export * from './cart-icon';
|
|
13
|
+
export * from './checkbox';
|
|
15
14
|
export * from './common.types.d';
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
15
|
+
export * from './column-control';
|
|
16
|
+
export * from './dropdown';
|
|
17
|
+
export * from './email-simple';
|
|
18
|
+
export * from './flag';
|
|
20
19
|
export * from './hooks';
|
|
21
|
-
export
|
|
22
|
-
export
|
|
23
|
-
export
|
|
24
|
-
export
|
|
25
|
-
export
|
|
26
|
-
export
|
|
27
|
-
export
|
|
28
|
-
export
|
|
29
|
-
export
|
|
30
|
-
export
|
|
31
|
-
export
|
|
32
|
-
export
|
|
33
|
-
export
|
|
34
|
-
export
|
|
20
|
+
export * from './icon';
|
|
21
|
+
export * from './image';
|
|
22
|
+
export * from './input';
|
|
23
|
+
export * from './label';
|
|
24
|
+
export * from './link';
|
|
25
|
+
export * from './modal';
|
|
26
|
+
export * from './nav-product-card';
|
|
27
|
+
export * from './nav-tab';
|
|
28
|
+
export * from './progress';
|
|
29
|
+
export * from './radiogroup';
|
|
30
|
+
export * from './select';
|
|
31
|
+
export * from './spinner';
|
|
32
|
+
export * from './table';
|
|
33
|
+
export * from './text-strip';
|
|
35
34
|
export * from './typography';
|
|
36
35
|
export * from './utility';
|
|
37
|
-
export
|
|
36
|
+
export * from './videos';
|