@nuskin/foundation-ui-components 1.25.2 → 1.26.1-pipeline-fix.1
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 -1
- package/src/common/accordion/specs/NsCollapse.spec.tsx +5 -4
- package/src/common/autocomplete/NsAutocomplete.styled.tsx +8 -3
- package/src/common/autocomplete/NsAutocomplete.tsx +6 -21
- package/src/common/autocomplete/types.d.ts +1 -0
- package/src/common/button/NsButton.spec.tsx +9 -0
- package/src/common/button/__snapshots__/NsButton.spec.tsx.snap +120 -0
- package/src/common/toast/ToastProvider.tsx +11 -0
- package/src/common/toast/useToast.tsx +2 -1
- package/src/common/typography/NsTypography.spec.tsx +8 -16
- package/src/common/typography/Typography.styled.tsx +1 -1
- package/src/common/typography/__snapshots__/NsTypography.spec.tsx.snap +22 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuskin/foundation-ui-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.26.1-pipeline-fix.1",
|
|
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": {
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"test": "next build && jest --coverage",
|
|
36
36
|
"test:pattern": "jest --coverage --testNamePattern accordion/*",
|
|
37
37
|
"test:watch": "jest --watch",
|
|
38
|
+
"test:update-snapshot": "jest -u",
|
|
38
39
|
"test:failed": "npx jest --onlyFailures",
|
|
39
40
|
"test:coverage": "jest --coverage",
|
|
40
41
|
"types:check": "tsc --pretty --noEmit"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { AccordionItem, AccordionVariant, NsCollapse } from '@/common/index';
|
|
2
2
|
import { render, screen } from '@/test-utils/index';
|
|
3
|
-
import
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
4
5
|
import { createAccordionItem3_1 } from '../stories/data';
|
|
5
6
|
|
|
6
7
|
describe('NsCollapse', () => {
|
|
@@ -53,8 +54,8 @@ describe('NsCollapse', () => {
|
|
|
53
54
|
level={0}
|
|
54
55
|
/>
|
|
55
56
|
);
|
|
56
|
-
expect(getByText(content[0].title)).toBeInTheDocument();
|
|
57
|
-
expect(getByText(content[1].title)).toBeInTheDocument();
|
|
57
|
+
expect(getByText(content[0].title as string)).toBeInTheDocument();
|
|
58
|
+
expect(getByText(content[1].title as string)).toBeInTheDocument();
|
|
58
59
|
});
|
|
59
60
|
|
|
60
61
|
it('4. does not render children when isOpen is false', () => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { styled, ColorUtils } from '@nuskin/foundation-theme';
|
|
2
2
|
import { NsInputField } from '../input';
|
|
3
|
+
import { Popper } from '@mui/material';
|
|
3
4
|
const { getGenomeColor } = ColorUtils;
|
|
4
5
|
|
|
5
6
|
export const StyledTextField = styled(NsInputField)`
|
|
@@ -11,6 +12,10 @@ export const StyledTextField = styled(NsInputField)`
|
|
|
11
12
|
color: ${({ theme }) => getGenomeColor(theme, 'N100', 'light')};
|
|
12
13
|
}
|
|
13
14
|
`;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
|
|
16
|
+
export const StyledPopper = styled(Popper)`
|
|
17
|
+
width: 100% !important;
|
|
18
|
+
#custom_autocomplete_dropdown-listbox{
|
|
19
|
+
overflow-x:hidden;
|
|
20
|
+
}
|
|
21
|
+
`
|
|
@@ -1,29 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
useEffect,
|
|
4
|
-
useRef,
|
|
5
|
-
useState,
|
|
6
|
-
} from 'react';
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
Autocomplete,
|
|
10
|
-
AutocompleteRenderInputParams,
|
|
11
|
-
} from '@mui/material';
|
|
1
|
+
import { Autocomplete, AutocompleteRenderInputParams } from '@mui/material';
|
|
2
|
+
import React, { PropsWithChildren, useEffect, useRef, useState } from 'react';
|
|
12
3
|
|
|
13
4
|
import { LineLoader } from './helper/LineLoader';
|
|
14
5
|
import { RecentClearAll } from './helper/RecentClearAll';
|
|
15
|
-
import {
|
|
16
|
-
renderGroupBy,
|
|
17
|
-
renderGroupName,
|
|
18
|
-
renderOptionLabel,
|
|
19
|
-
} from './helper/renderGroupName';
|
|
6
|
+
import { renderGroupBy, renderGroupName, renderOptionLabel } from './helper/renderGroupName';
|
|
20
7
|
import { SeeMoreButton } from './helper/SeeMoreButton';
|
|
21
8
|
import { StyledTextField } from './NsAutocomplete.styled';
|
|
22
|
-
import {
|
|
23
|
-
ComponentBoxProps,
|
|
24
|
-
NsAutocompleteProps,
|
|
25
|
-
OptionsProps,
|
|
26
|
-
} from './types.d';
|
|
9
|
+
import { ComponentBoxProps, NsAutocompleteProps, OptionsProps } from './types.d';
|
|
27
10
|
|
|
28
11
|
const noop = () => {};
|
|
29
12
|
const NsAutocomplete = ({
|
|
@@ -44,6 +27,7 @@ const NsAutocomplete = ({
|
|
|
44
27
|
inputValue,
|
|
45
28
|
value,
|
|
46
29
|
isFilterEnabled = true,
|
|
30
|
+
fullWidth,
|
|
47
31
|
}: PropsWithChildren<NsAutocompleteProps>) => {
|
|
48
32
|
const [scrollTopPosition, setScrollTopPosition] = useState(0);
|
|
49
33
|
const listboxRef = useRef<HTMLUListElement | null>(null);
|
|
@@ -120,6 +104,7 @@ const NsAutocomplete = ({
|
|
|
120
104
|
getOptionLabel={renderOptionLabel}
|
|
121
105
|
renderOption={renderOption as any}
|
|
122
106
|
renderInput={renderInput}
|
|
107
|
+
// PopperComponent={fullWidth ? StyledPopper : Popper} // TODO:https://code.tls.nuskin.io/ns-am/content-foundation/nuskin-app/-/jobs/1355817
|
|
123
108
|
ListboxComponent={renderListBoxComponent as any}
|
|
124
109
|
renderGroup={renderGroupName}
|
|
125
110
|
onChange={onChange}
|
|
@@ -7,6 +7,15 @@ import { NsButton } from '../';
|
|
|
7
7
|
const { palette } = nuskinTheme;
|
|
8
8
|
|
|
9
9
|
describe('<Button />', () => {
|
|
10
|
+
it('0. should match snapshot', () => {
|
|
11
|
+
const text = 'Click Me';
|
|
12
|
+
const { container } = render(
|
|
13
|
+
<NsButton color="primary" variant="contained">
|
|
14
|
+
{text}
|
|
15
|
+
</NsButton>
|
|
16
|
+
);
|
|
17
|
+
expect(container).toMatchSnapshot();
|
|
18
|
+
});
|
|
10
19
|
it('1. should render default primary button styles ', () => {
|
|
11
20
|
const text = 'Click Me';
|
|
12
21
|
render(
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`<Button /> 0. should match snapshot 1`] = `
|
|
4
|
+
.emotion-0 {
|
|
5
|
+
display: -webkit-inline-box;
|
|
6
|
+
display: -webkit-inline-flex;
|
|
7
|
+
display: -ms-inline-flexbox;
|
|
8
|
+
display: inline-flex;
|
|
9
|
+
-webkit-align-items: center;
|
|
10
|
+
-webkit-box-align: center;
|
|
11
|
+
-ms-flex-align: center;
|
|
12
|
+
align-items: center;
|
|
13
|
+
-webkit-box-pack: center;
|
|
14
|
+
-ms-flex-pack: center;
|
|
15
|
+
-webkit-justify-content: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
position: relative;
|
|
18
|
+
box-sizing: border-box;
|
|
19
|
+
-webkit-tap-highlight-color: transparent;
|
|
20
|
+
background-color: transparent;
|
|
21
|
+
outline: 0;
|
|
22
|
+
border: 0;
|
|
23
|
+
margin: 0;
|
|
24
|
+
border-radius: 0;
|
|
25
|
+
padding: 0;
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
-webkit-user-select: none;
|
|
28
|
+
-moz-user-select: none;
|
|
29
|
+
-ms-user-select: none;
|
|
30
|
+
user-select: none;
|
|
31
|
+
vertical-align: middle;
|
|
32
|
+
-moz-appearance: none;
|
|
33
|
+
-webkit-appearance: none;
|
|
34
|
+
-webkit-text-decoration: none;
|
|
35
|
+
text-decoration: none;
|
|
36
|
+
color: inherit;
|
|
37
|
+
font-family: 'Inter',sans-serif;
|
|
38
|
+
min-width: 64px;
|
|
39
|
+
padding: 6px 16px;
|
|
40
|
+
border-radius: 4px;
|
|
41
|
+
-webkit-transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
|
42
|
+
transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
|
43
|
+
color: #FFFFFF;
|
|
44
|
+
background-color: #252525;
|
|
45
|
+
box-shadow: 0px 3px 1px -2px rgba(0,0,0,0.2),0px 2px 2px 0px rgba(0,0,0,0.14),0px 1px 5px 0px rgba(0,0,0,0.12);
|
|
46
|
+
gap: 10px;
|
|
47
|
+
border-radius: 0;
|
|
48
|
+
background-color: #252525;
|
|
49
|
+
color: #FFFFFF!important;
|
|
50
|
+
text-transform: none;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.emotion-0::-moz-focus-inner {
|
|
54
|
+
border-style: none;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.emotion-0.Mui-disabled {
|
|
58
|
+
pointer-events: none;
|
|
59
|
+
cursor: default;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@media print {
|
|
63
|
+
.emotion-0 {
|
|
64
|
+
-webkit-print-color-adjust: exact;
|
|
65
|
+
color-adjust: exact;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.emotion-0:hover {
|
|
70
|
+
-webkit-text-decoration: none;
|
|
71
|
+
text-decoration: none;
|
|
72
|
+
box-shadow: 0px 2px 4px -1px rgba(0,0,0,0.2),0px 4px 5px 0px rgba(0,0,0,0.14),0px 1px 10px 0px rgba(0,0,0,0.12);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@media (hover: none) {
|
|
76
|
+
.emotion-0:hover {
|
|
77
|
+
background-color: #252525;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.emotion-0:active {
|
|
82
|
+
box-shadow: 0px 5px 5px -3px rgba(0,0,0,0.2),0px 8px 10px 1px rgba(0,0,0,0.14),0px 3px 14px 2px rgba(0,0,0,0.12);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.emotion-0.Mui-focusVisible {
|
|
86
|
+
box-shadow: 0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.emotion-0.Mui-disabled {
|
|
90
|
+
color: rgba(0, 0, 0, 0.26);
|
|
91
|
+
box-shadow: none;
|
|
92
|
+
background-color: rgba(0, 0, 0, 0.12);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.emotion-0:focus {
|
|
96
|
+
background-color: #252525;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.emotion-0:hover {
|
|
100
|
+
background-color: #8C8C8C;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.emotion-0:active {
|
|
104
|
+
background-color: #F5F5F5;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
<div>
|
|
108
|
+
<main
|
|
109
|
+
class="theme-wrapper light"
|
|
110
|
+
>
|
|
111
|
+
<button
|
|
112
|
+
class="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium emotion-0"
|
|
113
|
+
tabindex="0"
|
|
114
|
+
type="button"
|
|
115
|
+
>
|
|
116
|
+
Click Me
|
|
117
|
+
</button>
|
|
118
|
+
</main>
|
|
119
|
+
</div>
|
|
120
|
+
`;
|
|
@@ -10,9 +10,20 @@ const ToastNotification = styled(MaterialDesignContent)`
|
|
|
10
10
|
height: 46px;
|
|
11
11
|
box-shadow: none;
|
|
12
12
|
padding: 0 20px;
|
|
13
|
+
|
|
14
|
+
.toast-message-wrapper {
|
|
15
|
+
width: 440px;
|
|
16
|
+
text-overflow: ellipsis;
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
white-space: nowrap;
|
|
19
|
+
}
|
|
13
20
|
|
|
14
21
|
@media (max-width: ${ScreenSize.md}px) {
|
|
15
22
|
width: 343px;
|
|
23
|
+
|
|
24
|
+
.toast-message-wrapper {
|
|
25
|
+
width: 190px;
|
|
26
|
+
}
|
|
16
27
|
}
|
|
17
28
|
|
|
18
29
|
#notistack-snackbar svg {
|
|
@@ -41,8 +41,9 @@ const useToast = () => {
|
|
|
41
41
|
return actionButtons?.length ? actionButtons : null;
|
|
42
42
|
};
|
|
43
43
|
const showToast = (variant: VariantType = 'default', message?: string, options?: ToastOptions) => {
|
|
44
|
+
|
|
44
45
|
try {
|
|
45
|
-
return enqueueSnackbar(message
|
|
46
|
+
return enqueueSnackbar(<div className='toast-message-wrapper'>{message}</div>, {
|
|
46
47
|
variant,
|
|
47
48
|
...options,
|
|
48
49
|
anchorOrigin: { horizontal: 'center', vertical: 'bottom' },
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { render } from '@testing-library/react';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
|
|
4
4
|
import NsTypography from './NsTypography';
|
|
5
5
|
|
|
6
6
|
describe('GlobalFontInter', () => {
|
|
7
|
+
it('0. should match snapshot', () => {
|
|
8
|
+
const text = 'Hello Typo!';
|
|
9
|
+
const { container } = render(<NsTypography variant={'h1'}>{text}</NsTypography>);
|
|
10
|
+
expect(container).toMatchSnapshot();
|
|
11
|
+
});
|
|
7
12
|
it('1. renders without crashing', () => {
|
|
8
13
|
const text = 'Hello Typo!';
|
|
9
14
|
const { getByText } = render(<NsTypography variant={'h1'}>{text}</NsTypography>);
|
|
@@ -13,14 +18,7 @@ describe('GlobalFontInter', () => {
|
|
|
13
18
|
it('2. renders without crashing with p-l variant', () => {
|
|
14
19
|
const text = 'Hello Typo!';
|
|
15
20
|
const { getByText } = render(
|
|
16
|
-
<NsTypography
|
|
17
|
-
variant="h4"
|
|
18
|
-
weight="bold"
|
|
19
|
-
className="mt-2"
|
|
20
|
-
decoration="underline"
|
|
21
|
-
|
|
22
|
-
color="primary"
|
|
23
|
-
>
|
|
21
|
+
<NsTypography variant="h4" weight="bold" className="mt-2" decoration="underline" color="primary">
|
|
24
22
|
{text}
|
|
25
23
|
</NsTypography>
|
|
26
24
|
);
|
|
@@ -30,13 +28,7 @@ describe('GlobalFontInter', () => {
|
|
|
30
28
|
it('3. should not render with default color primary when color is passed', () => {
|
|
31
29
|
const text = 'Hello Typo!';
|
|
32
30
|
const { getByText } = render(
|
|
33
|
-
<NsTypography
|
|
34
|
-
variant="h4"
|
|
35
|
-
weight="bold"
|
|
36
|
-
className="mt-2"
|
|
37
|
-
decoration="underline"
|
|
38
|
-
color="accentColorA"
|
|
39
|
-
>
|
|
31
|
+
<NsTypography variant="h4" weight="bold" className="mt-2" decoration="underline" color="accentColorA">
|
|
40
32
|
{text}
|
|
41
33
|
</NsTypography>
|
|
42
34
|
);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`GlobalFontInter 0. should match snapshot 1`] = `
|
|
4
|
+
.emotion-0 {
|
|
5
|
+
font-family: Inter;
|
|
6
|
+
font-size: 42px;
|
|
7
|
+
line-height: 48px;
|
|
8
|
+
margin: 0;
|
|
9
|
+
font-weight: 400;
|
|
10
|
+
letter-spacing: 0;
|
|
11
|
+
text-decoration-line: none;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
<div>
|
|
15
|
+
<div
|
|
16
|
+
class=" emotion-0"
|
|
17
|
+
color="primary"
|
|
18
|
+
>
|
|
19
|
+
Hello Typo!
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
`;
|