@nuskin/foundation-ui-components 1.0.0-develop.3 → 1.0.0-develop.5
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 +9 -4
- package/src/common/accordion/NsAccordion.tsx +77 -0
- package/src/common/accordion/NsAccordionHeader.tsx +56 -0
- package/src/common/accordion/NsAccordionItem.tsx +39 -0
- package/src/common/accordion/NsCollapse.tsx +56 -0
- package/src/common/accordion/NsToggleSection.tsx +30 -0
- package/src/common/accordion/ToggleSection.styled.tsx +28 -0
- package/src/common/accordion/index.ts +6 -0
- package/src/common/accordion/specs/NsAccordion.spec.tsx +93 -0
- package/src/common/accordion/specs/NsAccordionHeader.spec.tsx +63 -0
- package/src/common/accordion/specs/NsAccordionItem.spec.tsx +62 -0
- package/src/common/accordion/specs/NsCollapse.spec.tsx +37 -0
- package/src/common/accordion/specs/NsToggleSection.spec.tsx +38 -0
- package/src/common/accordion/stories/NsAccordion.stories.tsx +47 -0
- package/src/common/accordion/stories/NsAccordionHeader.stories.tsx +40 -0
- package/src/common/accordion/stories/NsAccordionItem.stories.tsx +40 -0
- package/src/common/accordion/stories/NsCollapse.stories.tsx +35 -0
- package/src/common/accordion/stories/NsToggleSection.stories.tsx +23 -0
- package/src/common/accordion/stories/data.tsx +22 -0
- package/src/common/accordion/types.d.ts +73 -0
- package/src/common/alert/NsAlert.spec.tsx +0 -1
- package/src/common/alert/NsAlert.styled.ts +10 -10
- package/src/common/alert/NsAlert.tsx +4 -3
- package/src/common/alert/types.d.ts +22 -22
- package/src/common/auth-dropdown/NsAuthDropdown.styled.ts +12 -11
- package/src/common/auth-dropdown/NsAuthDropdown.tsx +2 -1
- package/src/common/auth-dropdown/types.d.ts +3 -1
- package/src/common/autocomplete/NsAutocomplete.spec.tsx +20 -8
- package/src/common/autocomplete/NsAutocomplete.stories.tsx +3 -0
- package/src/common/autocomplete/NsAutocomplete.styled.tsx +12 -0
- package/src/common/autocomplete/NsAutocomplete.tsx +36 -18
- package/src/common/autocomplete/types.d.ts +7 -1
- package/src/common/brand-components/NsBrandComponent.tsx +3 -0
- package/src/common/breadcrumb/NsBreadcrumb.tsx +4 -2
- package/src/common/button/NsButton.spec.tsx +11 -12
- package/src/common/button/NsButton.stories.tsx +1 -1
- package/src/common/button/NsButton.styled.tsx +25 -23
- package/src/common/button/NsButton.tsx +9 -2
- package/src/common/button/types.d.ts +1 -0
- package/src/common/checkbox/NsCheckbox.styled.tsx +2 -2
- package/src/common/common.types.d.ts +2 -0
- package/src/common/dropdown/types.d.ts +3 -1
- package/src/common/email-simple/NsEmailSimple.spec.tsx +145 -0
- package/src/common/email-simple/NsEmailSimple.stories.tsx +61 -0
- package/src/common/email-simple/NsEmailSimple.tsx +71 -0
- package/src/common/email-simple/index.ts +2 -0
- package/src/common/email-simple/types.d.ts +14 -0
- package/src/common/flag/NsFlag.spec.tsx +4 -24
- package/src/common/flag/NsFlag.styled.tsx +5 -5
- package/src/common/flag/NsFlag.tsx +0 -2
- package/src/common/icon/types.d.ts +1 -0
- package/src/common/image/types.d.ts +1 -0
- package/src/common/index.ts +3 -0
- package/src/common/input/InputFieldWrapper.tsx +4 -4
- package/src/common/input/NsInputField.stories.tsx +11 -9
- package/src/common/input/NsInputField.tsx +12 -5
- package/src/common/input/getAdornmentProps.tsx +4 -0
- package/src/common/input/types.d.ts +3 -1
- package/src/common/label/NsLabel.stories.tsx +3 -0
- package/src/common/label/NsLabel.tsx +18 -17
- package/src/common/label/types.d.ts +2 -1
- package/src/common/nav-tab/NsNavTab.spec.tsx +0 -5
- package/src/common/nav-tab/NsNavTab.styled.tsx +7 -4
- package/src/common/radiogroup/NsRadioGroup.spec.tsx +64 -0
- package/src/common/radiogroup/NsRadioGroup.stories.tsx +102 -0
- package/src/common/radiogroup/NsRadioGroup.styled.tsx +50 -0
- package/src/common/radiogroup/NsRadioGroup.tsx +61 -0
- package/src/common/radiogroup/index.ts +2 -0
- package/src/common/radiogroup/types.d.ts +20 -0
- package/src/common/select/NsSelect.spec.tsx +200 -0
- package/src/common/select/NsSelect.styled.tsx +85 -0
- package/src/common/select/NsSelect.tsx +117 -0
- package/src/common/select/NsSelectOption.tsx +30 -0
- package/src/common/select/index.ts +3 -0
- package/src/common/select/stories/NsSelect.stories.tsx +134 -0
- package/src/common/select/types.d.ts +34 -0
- package/src/common/table/NsExpandableRow.tsx +68 -0
- package/src/common/table/NsTable.spec.tsx +69 -41
- package/src/common/table/NsTable.stories.tsx +45 -7
- package/src/common/table/NsTable.styled.ts +106 -12
- package/src/common/table/NsTable.tsx +78 -89
- package/src/common/table/NsTableHeader.tsx +52 -38
- package/src/common/table/NsTablePagination.tsx +21 -13
- package/src/common/table/types.d.ts +21 -8
- package/src/common/text-strip/NsTextStrip.tsx +10 -7
- package/src/common/typography/Typography.styled.tsx +3 -3
- package/src/common/validations/regex.ts +3 -0
- /package/src/common/card/{tests → specs}/BrandLogo.spec.tsx +0 -0
- /package/src/common/card/{tests → specs}/NsBgCard.spec.tsx +0 -0
- /package/src/common/card/{tests → specs}/NsBrandProductCard.spec.tsx +0 -0
- /package/src/common/card/{tests → specs}/NsFfgCard.spec.tsx +0 -0
- /package/src/common/carousal/{tests → specs}/Chevron.spec.tsx +0 -0
- /package/src/common/carousal/{tests → specs}/NsCarousal.spec.tsx +0 -0
- /package/src/common/carousal/{tests → specs}/NsScrollingCarousal.spec.tsx +0 -0
- /package/src/common/carousal/{tests → specs}/RenderBrand.spec.tsx +0 -0
|
@@ -1,24 +1,43 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import {
|
|
3
|
+
TableBody,
|
|
4
|
+
TableCell,
|
|
5
|
+
TableRow
|
|
6
|
+
} from '@mui/material';
|
|
7
|
+
import {
|
|
8
|
+
StyledTable,
|
|
9
|
+
StyledTableContainer,
|
|
10
|
+
StyledEmptyRow,
|
|
11
|
+
StyledProgressCell,
|
|
12
|
+
StyledLinearProgress
|
|
13
|
+
} from './NsTable.styled'
|
|
14
|
+
import type {
|
|
15
|
+
NsTableProps,
|
|
16
|
+
Item,
|
|
17
|
+
OrderType,
|
|
18
|
+
} from './types'
|
|
19
|
+
import {stableSort, getComparator} from './helper'
|
|
6
20
|
import NsTableHeader from './NsTableHeader';
|
|
7
|
-
import
|
|
8
|
-
import
|
|
21
|
+
import NsTablePagination from './NsTablePagination'
|
|
22
|
+
import ExpandableRow from './NsExpandableRow'
|
|
23
|
+
import Grid from '@mui/material/Grid';
|
|
9
24
|
|
|
10
25
|
export default function NsTable({
|
|
11
26
|
headers = [],
|
|
12
27
|
items = [],
|
|
13
28
|
rows,
|
|
14
|
-
isShowSelector = true,
|
|
15
|
-
isPagination = false,
|
|
16
29
|
rowsPerPageOptions,
|
|
17
30
|
itemKey,
|
|
31
|
+
expandableContent,
|
|
32
|
+
actionClick,
|
|
33
|
+
showActions = true,
|
|
34
|
+
showExpandedContent = true,
|
|
35
|
+
loading = false,
|
|
36
|
+
isExpandableAll = false,
|
|
18
37
|
}: NsTableProps) {
|
|
19
38
|
const [order, setOrder] = useState<OrderType>('asc');
|
|
20
39
|
const [orderBy, setOrderBy] = useState<keyof Item>(itemKey);
|
|
21
|
-
const [
|
|
40
|
+
const [expandList, setExpandList] = useState<number[]>([]);
|
|
22
41
|
const [page, setPage] = useState(0);
|
|
23
42
|
const [rowsPerPage, setRowsPerPage] = useState(rows);
|
|
24
43
|
const [itemKeyList, setItemKeyList] = useState<string[]>([]);
|
|
@@ -38,44 +57,28 @@ export default function NsTable({
|
|
|
38
57
|
setOrderBy(property);
|
|
39
58
|
};
|
|
40
59
|
|
|
41
|
-
const
|
|
42
|
-
if
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
60
|
+
const handleClick = (index: number) => {
|
|
61
|
+
if(isExpandableAll) {
|
|
62
|
+
let newList = expandList;
|
|
63
|
+
if(newList.includes(index)) {
|
|
64
|
+
let num = newList.indexOf(index);
|
|
65
|
+
if (num > -1) newList.splice(num, 1);
|
|
66
|
+
} else {
|
|
67
|
+
newList.push(index);
|
|
68
|
+
}
|
|
69
|
+
setExpandList([...newList]);
|
|
70
|
+
} else {
|
|
71
|
+
if(expandList.includes(index)) setExpandList([])
|
|
72
|
+
else setExpandList([index])
|
|
46
73
|
}
|
|
47
|
-
setSelected([]);
|
|
48
74
|
};
|
|
49
75
|
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
let newSelected: readonly (string | number)[] = [];
|
|
53
|
-
|
|
54
|
-
if (selectedIndex === -1) {
|
|
55
|
-
newSelected = newSelected.concat(selected, name);
|
|
56
|
-
} else if (selectedIndex === 0) {
|
|
57
|
-
newSelected = newSelected.concat(selected.slice(1));
|
|
58
|
-
} else if (selectedIndex === selected.length - 1) {
|
|
59
|
-
newSelected = newSelected.concat(selected.slice(0, -1));
|
|
60
|
-
} else if (selectedIndex > 0) {
|
|
61
|
-
newSelected = newSelected.concat(selected.slice(0, selectedIndex), selected.slice(selectedIndex + 1));
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
setSelected(newSelected);
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const handleChangePage = (event: unknown, newPage: number) => {
|
|
68
|
-
setPage(newPage);
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const handleChangeRowsPerPage = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
72
|
-
setRowsPerPage(parseInt(event.target.value, 10));
|
|
73
|
-
setPage(0);
|
|
76
|
+
const handleChangePage = (newPage: number) => {
|
|
77
|
+
setPage(newPage-1);
|
|
74
78
|
};
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
const emptyRows = page > 0 ? Math.max(0, (1 + page) * rowsPerPage - items.length) : 0;
|
|
79
|
+
|
|
80
|
+
const emptyRows =
|
|
81
|
+
page > 0 ? Math.max(0, (1 + page) * rowsPerPage - items.length) : 0;
|
|
79
82
|
|
|
80
83
|
const visibleRows = React.useMemo(
|
|
81
84
|
() =>
|
|
@@ -92,50 +95,39 @@ export default function NsTable({
|
|
|
92
95
|
<StyledTable>
|
|
93
96
|
<NsTableHeader
|
|
94
97
|
headCells={headers}
|
|
95
|
-
numSelected={selected.length}
|
|
96
98
|
order={order}
|
|
97
99
|
orderBy={orderBy as string}
|
|
98
|
-
onSelectAllClick={handleSelectAllClick}
|
|
99
100
|
onRequestSort={handleRequestSort}
|
|
100
101
|
rowCount={items.length}
|
|
101
|
-
isShowSelector={isShowSelector}
|
|
102
102
|
/>
|
|
103
103
|
<TableBody>
|
|
104
|
+
{
|
|
105
|
+
loading ? (
|
|
106
|
+
<TableRow>
|
|
107
|
+
<StyledProgressCell colSpan={itemKeyList.length}>
|
|
108
|
+
<Grid container>
|
|
109
|
+
<Grid item xs={12}>
|
|
110
|
+
<StyledLinearProgress />
|
|
111
|
+
</Grid>
|
|
112
|
+
</Grid>
|
|
113
|
+
</StyledProgressCell>
|
|
114
|
+
</TableRow>
|
|
115
|
+
) : null
|
|
116
|
+
}
|
|
104
117
|
{visibleRows.map((row, index) => {
|
|
105
|
-
const isItemSelected = isSelected(row[itemKey]);
|
|
106
|
-
const labelId = `table-checkbox-${index}`;
|
|
107
|
-
const tableRowTestId = `table-row-${index}`;
|
|
108
118
|
return (
|
|
109
|
-
<
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
<TableCell padding="checkbox">
|
|
122
|
-
<NsCheckBox
|
|
123
|
-
checked={isItemSelected}
|
|
124
|
-
testid={labelId}
|
|
125
|
-
name={labelId}
|
|
126
|
-
label=""
|
|
127
|
-
className="ml-0 !important"
|
|
128
|
-
/>
|
|
129
|
-
</TableCell>
|
|
130
|
-
) : null}
|
|
131
|
-
{itemKeyList.map((id, index) => {
|
|
132
|
-
return (
|
|
133
|
-
<TableCell align="left" key={index}>
|
|
134
|
-
{row[id]}
|
|
135
|
-
</TableCell>
|
|
136
|
-
);
|
|
137
|
-
})}
|
|
138
|
-
</TableRow>
|
|
119
|
+
<ExpandableRow
|
|
120
|
+
key={index}
|
|
121
|
+
expandableContent={expandableContent}
|
|
122
|
+
isExpand={expandList.includes(index)}
|
|
123
|
+
handleClick={handleClick}
|
|
124
|
+
row={row}
|
|
125
|
+
index={index}
|
|
126
|
+
itemKeyList={itemKeyList}
|
|
127
|
+
actionClick={actionClick}
|
|
128
|
+
showActions={showActions}
|
|
129
|
+
showExpandedContent={showExpandedContent}
|
|
130
|
+
/>
|
|
139
131
|
);
|
|
140
132
|
})}
|
|
141
133
|
{emptyRows > 0 ? (
|
|
@@ -146,16 +138,13 @@ export default function NsTable({
|
|
|
146
138
|
</TableBody>
|
|
147
139
|
</StyledTable>
|
|
148
140
|
</StyledTableContainer>
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
onRowsPerPageChange={handleChangeRowsPerPage}
|
|
157
|
-
/>
|
|
158
|
-
) : null}
|
|
141
|
+
<NsTablePagination
|
|
142
|
+
rowsPerPageOptions={rowsPerPageOptions}
|
|
143
|
+
count={items.length}
|
|
144
|
+
rowsPerPage={rowsPerPage}
|
|
145
|
+
page={page+1}
|
|
146
|
+
onPageChange={handleChangePage}
|
|
147
|
+
/>
|
|
159
148
|
</div>
|
|
160
149
|
);
|
|
161
150
|
}
|
|
@@ -1,47 +1,61 @@
|
|
|
1
|
-
import type { NsTableHeaderProps,
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import type { NsTableHeaderProps, Item} from './types'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import {
|
|
4
|
+
TableHead,
|
|
5
|
+
TableRow,
|
|
6
|
+
Box,
|
|
7
|
+
TableCell
|
|
8
|
+
} from '@mui/material';
|
|
9
|
+
import {
|
|
10
|
+
StyledTableSortLabel,
|
|
11
|
+
StyledTableLabel
|
|
12
|
+
} from './NsTable.styled'
|
|
5
13
|
import { visuallyHidden } from '@mui/utils';
|
|
6
|
-
import NsCheckBox from '../checkbox/NsCheckbox';
|
|
7
14
|
|
|
8
15
|
export default function NsTableHeader(props: NsTableHeaderProps) {
|
|
9
|
-
const {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
const {
|
|
17
|
+
order,
|
|
18
|
+
orderBy,
|
|
19
|
+
headCells,
|
|
20
|
+
onRequestSort,
|
|
21
|
+
} = props;
|
|
22
|
+
const createSortHandler =
|
|
23
|
+
(property: keyof Item) => (event: React.MouseEvent<unknown>) => { onRequestSort(event, property);};
|
|
24
|
+
|
|
14
25
|
return (
|
|
15
26
|
<TableHead>
|
|
16
27
|
<TableRow>
|
|
17
|
-
{
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
<
|
|
39
|
-
{
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
28
|
+
{
|
|
29
|
+
headCells.map((headCell) => (
|
|
30
|
+
headCell.sortable ? (
|
|
31
|
+
<TableCell
|
|
32
|
+
key={headCell.id}
|
|
33
|
+
sortDirection={orderBy == headCell.id ? order : false}
|
|
34
|
+
>
|
|
35
|
+
<StyledTableSortLabel
|
|
36
|
+
active={orderBy == headCell.id}
|
|
37
|
+
direction={orderBy == headCell.id ? order : 'asc'}
|
|
38
|
+
onClick={createSortHandler(headCell.id)}
|
|
39
|
+
>
|
|
40
|
+
{headCell.label}
|
|
41
|
+
{orderBy === headCell.id ? (
|
|
42
|
+
<Box component="span" sx={visuallyHidden}>
|
|
43
|
+
{order === 'desc' ? 'sorted descending' : 'sorted ascending'}
|
|
44
|
+
</Box>
|
|
45
|
+
) : null}
|
|
46
|
+
</StyledTableSortLabel>
|
|
47
|
+
</TableCell>)
|
|
48
|
+
: (
|
|
49
|
+
<TableCell
|
|
50
|
+
key={headCell.id}
|
|
51
|
+
sortDirection={false}
|
|
52
|
+
>
|
|
53
|
+
<StyledTableLabel>
|
|
54
|
+
{headCell.label}
|
|
55
|
+
</StyledTableLabel>
|
|
56
|
+
</TableCell>
|
|
57
|
+
)
|
|
58
|
+
))}
|
|
45
59
|
</TableRow>
|
|
46
60
|
</TableHead>
|
|
47
61
|
);
|
|
@@ -1,20 +1,28 @@
|
|
|
1
|
-
import type { NsTablePaginationProps } from './types
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import {
|
|
4
|
-
import { TablePagination } from '@mui/material';
|
|
1
|
+
import type { NsTablePaginationProps } from './types'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { StyledPagination } from './NsTable.styled'
|
|
5
4
|
|
|
6
5
|
export default function NsTablePagination(props: NsTablePaginationProps) {
|
|
7
|
-
const {
|
|
6
|
+
const {
|
|
7
|
+
count,
|
|
8
|
+
rowsPerPage,
|
|
9
|
+
page,
|
|
10
|
+
onPageChange,
|
|
11
|
+
} = props;
|
|
12
|
+
|
|
13
|
+
const totalPage = Math.ceil(count / rowsPerPage);
|
|
14
|
+
const handleChange = (event: React.ChangeEvent<unknown>, value: number) => {
|
|
15
|
+
onPageChange(value);
|
|
16
|
+
};
|
|
8
17
|
|
|
9
18
|
return (
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
onRowsPerPageChange={onRowsPerPageChange}
|
|
19
|
+
<StyledPagination
|
|
20
|
+
count={totalPage}
|
|
21
|
+
page={page}
|
|
22
|
+
variant="outlined"
|
|
23
|
+
onChange={handleChange}
|
|
24
|
+
shape="rounded"
|
|
25
|
+
color="primary"
|
|
18
26
|
/>
|
|
19
27
|
);
|
|
20
28
|
}
|
|
@@ -5,8 +5,9 @@ export interface Header {
|
|
|
5
5
|
label: string;
|
|
6
6
|
id: string | number;
|
|
7
7
|
numeric: boolean;
|
|
8
|
+
sortable?: boolean;
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
+
|
|
10
11
|
export interface Item {
|
|
11
12
|
[key: string]: string | number;
|
|
12
13
|
}
|
|
@@ -16,22 +17,23 @@ export interface NsTableProps {
|
|
|
16
17
|
items: Item[];
|
|
17
18
|
rows: number;
|
|
18
19
|
itemKey: string;
|
|
19
|
-
isShowSelector: boolean;
|
|
20
20
|
rowsPerPageOptions: number[];
|
|
21
|
-
|
|
21
|
+
isExpandableAll?: boolean;
|
|
22
|
+
showActions?: boolean;
|
|
23
|
+
showExpandedContent?: boolean;
|
|
24
|
+
loading?: boolean;
|
|
25
|
+
expandableContent: (selectedItem: Item, index: number) => React.ReactNode;
|
|
26
|
+
actionClick: (item: Item) => React.ReactNode;
|
|
22
27
|
}
|
|
23
28
|
|
|
24
29
|
export type OrderType = 'asc' | 'desc';
|
|
25
30
|
|
|
26
31
|
export interface NsTableHeaderProps {
|
|
27
|
-
numSelected: number;
|
|
28
32
|
onRequestSort: (event: React.MouseEvent<unknown>, property: keyof Item) => void;
|
|
29
|
-
onSelectAllClick: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
30
33
|
order: OrderType;
|
|
31
34
|
orderBy: string;
|
|
32
35
|
rowCount: number;
|
|
33
36
|
headCells: readonly Header[];
|
|
34
|
-
isShowSelector: boolean;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
export interface NsTablePaginationProps {
|
|
@@ -39,6 +41,17 @@ export interface NsTablePaginationProps {
|
|
|
39
41
|
count: number;
|
|
40
42
|
rowsPerPage: number;
|
|
41
43
|
page: number,
|
|
42
|
-
onPageChange: (
|
|
43
|
-
|
|
44
|
+
onPageChange: (number) => void;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface NsTableRowProps {
|
|
48
|
+
expandableContent: (selectedItem: Item, index: number) => React.ReactNode;
|
|
49
|
+
isExpand: boolean;
|
|
50
|
+
handleClick: (index: number) => void;
|
|
51
|
+
row: Item;
|
|
52
|
+
index: number;
|
|
53
|
+
itemKeyList: string[];
|
|
54
|
+
showActions: boolean;
|
|
55
|
+
showExpandedContent: boolean;
|
|
56
|
+
actionClick: (item: Item) => React.ReactNode;
|
|
44
57
|
}
|
|
@@ -8,14 +8,16 @@ import React from 'react';
|
|
|
8
8
|
import { NsTextStripProps } from './types.d';
|
|
9
9
|
import { NsTypography } from '../typography';
|
|
10
10
|
import { NsLink } from '../link';
|
|
11
|
-
import { styled, ColorUtils
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
return palette.primary.main === getAppColor(theme, 'primary', 'black');
|
|
16
|
-
};
|
|
11
|
+
import { styled, ColorUtils } from '@nuskin/foundation-theme';
|
|
12
|
+
|
|
13
|
+
const { isDarkMode, paletteColor, color } = ColorUtils;
|
|
14
|
+
|
|
17
15
|
const StyledHeader = styled.header`
|
|
18
|
-
background: ${(
|
|
16
|
+
background: ${(props) => (
|
|
17
|
+
!isDarkMode(props)
|
|
18
|
+
? color('primary', 'gray')
|
|
19
|
+
: paletteColor('primary', 'contrastText')
|
|
20
|
+
)};
|
|
19
21
|
display: flex;
|
|
20
22
|
flex-direction: column;
|
|
21
23
|
min-height: 60px;
|
|
@@ -25,6 +27,7 @@ const StyledHeader = styled.header`
|
|
|
25
27
|
font-weight: 600;
|
|
26
28
|
}
|
|
27
29
|
`;
|
|
30
|
+
|
|
28
31
|
const NsTextStrip = (props: NsTextStripProps) => {
|
|
29
32
|
const { alignment = 'center', text, description, link, className = '' } = props;
|
|
30
33
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { styled, ColorUtils } from '@nuskin/foundation-theme';
|
|
2
2
|
import { NsTypographyProps } from './types.d';
|
|
3
3
|
|
|
4
|
-
const {
|
|
4
|
+
const { paletteColor } = ColorUtils;
|
|
5
5
|
|
|
6
6
|
const variantStyles = {
|
|
7
7
|
h1: 'font-size: 36px; line-height: 44px;',
|
|
@@ -29,8 +29,8 @@ const fontWeightMap = {
|
|
|
29
29
|
|
|
30
30
|
export const StyledTypography = styled.div<NsTypographyProps>`
|
|
31
31
|
font-family: Inter;
|
|
32
|
-
color: ${({ color,
|
|
33
|
-
colorOverride?.startsWith('#') ? colorOverride :
|
|
32
|
+
color: ${({ color, colorOverride }) =>
|
|
33
|
+
colorOverride?.startsWith('#') ? colorOverride : paletteColor(color)};
|
|
34
34
|
font-weight: ${({ weight = 'normal' }) => fontWeightMap[weight]};
|
|
35
35
|
font-style: ${({ fontStyle }) => fontStyle};
|
|
36
36
|
${({ variant = 'h1' }) => variantStyles[variant]};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|