@nuskin/foundation-ui-components 1.4.2-export-updates.2 → 1.5.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/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 +2 -0
- package/src/common/icon/icons/ChevronRight.tsx +26 -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.5.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",
|
|
@@ -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,7 @@ 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 ChevronRight from './icons/ChevronRight';
|
|
24
25
|
|
|
25
26
|
const IconVariants = {
|
|
26
27
|
arrowDown: ArrowDown,
|
|
@@ -46,6 +47,7 @@ const IconVariants = {
|
|
|
46
47
|
userIcon: UserIcon,
|
|
47
48
|
userOutline: UserOutline,
|
|
48
49
|
warning: WarningIcon,
|
|
50
|
+
chevronRight: ChevronRight,
|
|
49
51
|
};
|
|
50
52
|
|
|
51
53
|
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;
|
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';
|