@nuskin/foundation-ui-components 1.19.1 → 1.19.3
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuskin/foundation-ui-components",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.3",
|
|
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.14.16",
|
|
47
47
|
"@mui/utils": "^5.14.16",
|
|
48
48
|
"@next/font": "13.5.6",
|
|
49
|
-
"@nuskin/foundation-theme": "
|
|
49
|
+
"@nuskin/foundation-theme": "1.4.1",
|
|
50
50
|
"@types/react": "^18.2.34",
|
|
51
51
|
"@types/react-dom": "^18.2.14",
|
|
52
52
|
"cliui": "^8.0.1",
|
|
@@ -1,12 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import React, {
|
|
2
|
+
PropsWithChildren,
|
|
3
|
+
useEffect,
|
|
4
|
+
useRef,
|
|
5
|
+
useState,
|
|
6
|
+
} from 'react';
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
Autocomplete,
|
|
10
|
+
AutocompleteRenderInputParams,
|
|
11
|
+
} from '@mui/material';
|
|
3
12
|
|
|
4
13
|
import { LineLoader } from './helper/LineLoader';
|
|
5
14
|
import { RecentClearAll } from './helper/RecentClearAll';
|
|
6
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
renderGroupBy,
|
|
17
|
+
renderGroupName,
|
|
18
|
+
renderOptionLabel,
|
|
19
|
+
} from './helper/renderGroupName';
|
|
7
20
|
import { SeeMoreButton } from './helper/SeeMoreButton';
|
|
8
21
|
import { StyledTextField } from './NsAutocomplete.styled';
|
|
9
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
ComponentBoxProps,
|
|
24
|
+
NsAutocompleteProps,
|
|
25
|
+
OptionsProps,
|
|
26
|
+
} from './types.d';
|
|
10
27
|
|
|
11
28
|
const noop = () => {};
|
|
12
29
|
const NsAutocomplete = ({
|
|
@@ -38,7 +55,7 @@ const NsAutocomplete = ({
|
|
|
38
55
|
|
|
39
56
|
const renderInput = (params: AutocompleteRenderInputParams) => (
|
|
40
57
|
<StyledTextField
|
|
41
|
-
{...params}
|
|
58
|
+
{...(params as any)}
|
|
42
59
|
placeholder={placeholder}
|
|
43
60
|
InputProps={{
|
|
44
61
|
...params.InputProps,
|
|
@@ -53,7 +70,7 @@ const NsAutocomplete = ({
|
|
|
53
70
|
OptionsUI ? (
|
|
54
71
|
<OptionsUI {...props} option={option} key={props.id} />
|
|
55
72
|
) : (
|
|
56
|
-
<li {...props} key={props.id}>
|
|
73
|
+
<li {...(props as any)} key={props.id}>
|
|
57
74
|
{option.value}
|
|
58
75
|
</li>
|
|
59
76
|
);
|
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
|
|
2
3
|
import Dialog from '@mui/material/Dialog';
|
|
3
|
-
|
|
4
|
-
import { useTheme } from '@mui/material/styles';
|
|
4
|
+
|
|
5
5
|
import { ModalVariantMap } from './model/NsModalVariantMap';
|
|
6
6
|
import { NsModalProps } from './types';
|
|
7
7
|
|
|
8
8
|
const NsModal = (props: NsModalProps) => {
|
|
9
|
-
const {
|
|
9
|
+
const {
|
|
10
|
+
open,
|
|
11
|
+
handleClose,
|
|
12
|
+
header,
|
|
13
|
+
body,
|
|
14
|
+
additionalProps,
|
|
15
|
+
footer,
|
|
16
|
+
statusInfo,
|
|
17
|
+
variant = 'default',
|
|
18
|
+
fullScreen,
|
|
19
|
+
} = props;
|
|
10
20
|
|
|
11
21
|
const { className, scrollType = 'paper', ariaLabel } = additionalProps || {};
|
|
12
22
|
|
|
13
23
|
const { ariaLabelledby = 'alert-dialog-title', ariaDescribedby = 'alert-dialog-description' } = ariaLabel || {};
|
|
14
24
|
|
|
15
|
-
const theme = useTheme();
|
|
16
|
-
|
|
17
|
-
const fullScreen: boolean = useMediaQuery(theme.breakpoints.down('md'));
|
|
18
|
-
|
|
19
25
|
const Component = ModalVariantMap[variant];
|
|
20
26
|
|
|
21
27
|
return (
|
|
@@ -2,21 +2,15 @@ import React from 'react';
|
|
|
2
2
|
import { render } from '@testing-library/react';
|
|
3
3
|
|
|
4
4
|
import NsTypography from './NsTypography';
|
|
5
|
-
import GlobalFontInter from './GlobalFontInter';
|
|
6
5
|
|
|
7
6
|
describe('GlobalFontInter', () => {
|
|
8
|
-
it('1.
|
|
9
|
-
render(<GlobalFontInter />);
|
|
10
|
-
const fontStyle = window.getComputedStyle(document.body).fontFamily;
|
|
11
|
-
expect(fontStyle).toContain('Inter');
|
|
12
|
-
});
|
|
13
|
-
it('2. renders without crashing', () => {
|
|
7
|
+
it('1. renders without crashing', () => {
|
|
14
8
|
const text = 'Hello Typo!';
|
|
15
9
|
const { getByText } = render(<NsTypography variant={'h1'}>{text}</NsTypography>);
|
|
16
10
|
expect(getByText(text)).toBeInTheDocument();
|
|
17
11
|
});
|
|
18
12
|
|
|
19
|
-
it('
|
|
13
|
+
it('2. renders without crashing with p-l variant', () => {
|
|
20
14
|
const text = 'Hello Typo!';
|
|
21
15
|
const { getByText } = render(
|
|
22
16
|
<NsTypography
|
|
@@ -33,7 +27,7 @@ describe('GlobalFontInter', () => {
|
|
|
33
27
|
expect(getByText(text)).toBeInTheDocument();
|
|
34
28
|
});
|
|
35
29
|
|
|
36
|
-
it('
|
|
30
|
+
it('3. should not render with default color primary when color is passed', () => {
|
|
37
31
|
const text = 'Hello Typo!';
|
|
38
32
|
const { getByText } = render(
|
|
39
33
|
<NsTypography
|