@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.
Files changed (95) hide show
  1. package/package.json +9 -4
  2. package/src/common/accordion/NsAccordion.tsx +77 -0
  3. package/src/common/accordion/NsAccordionHeader.tsx +56 -0
  4. package/src/common/accordion/NsAccordionItem.tsx +39 -0
  5. package/src/common/accordion/NsCollapse.tsx +56 -0
  6. package/src/common/accordion/NsToggleSection.tsx +30 -0
  7. package/src/common/accordion/ToggleSection.styled.tsx +28 -0
  8. package/src/common/accordion/index.ts +6 -0
  9. package/src/common/accordion/specs/NsAccordion.spec.tsx +93 -0
  10. package/src/common/accordion/specs/NsAccordionHeader.spec.tsx +63 -0
  11. package/src/common/accordion/specs/NsAccordionItem.spec.tsx +62 -0
  12. package/src/common/accordion/specs/NsCollapse.spec.tsx +37 -0
  13. package/src/common/accordion/specs/NsToggleSection.spec.tsx +38 -0
  14. package/src/common/accordion/stories/NsAccordion.stories.tsx +47 -0
  15. package/src/common/accordion/stories/NsAccordionHeader.stories.tsx +40 -0
  16. package/src/common/accordion/stories/NsAccordionItem.stories.tsx +40 -0
  17. package/src/common/accordion/stories/NsCollapse.stories.tsx +35 -0
  18. package/src/common/accordion/stories/NsToggleSection.stories.tsx +23 -0
  19. package/src/common/accordion/stories/data.tsx +22 -0
  20. package/src/common/accordion/types.d.ts +73 -0
  21. package/src/common/alert/NsAlert.spec.tsx +0 -1
  22. package/src/common/alert/NsAlert.styled.ts +10 -10
  23. package/src/common/alert/NsAlert.tsx +4 -3
  24. package/src/common/alert/types.d.ts +22 -22
  25. package/src/common/auth-dropdown/NsAuthDropdown.styled.ts +12 -11
  26. package/src/common/auth-dropdown/NsAuthDropdown.tsx +2 -1
  27. package/src/common/auth-dropdown/types.d.ts +3 -1
  28. package/src/common/autocomplete/NsAutocomplete.spec.tsx +20 -8
  29. package/src/common/autocomplete/NsAutocomplete.stories.tsx +3 -0
  30. package/src/common/autocomplete/NsAutocomplete.styled.tsx +12 -0
  31. package/src/common/autocomplete/NsAutocomplete.tsx +36 -18
  32. package/src/common/autocomplete/types.d.ts +7 -1
  33. package/src/common/brand-components/NsBrandComponent.tsx +3 -0
  34. package/src/common/breadcrumb/NsBreadcrumb.tsx +4 -2
  35. package/src/common/button/NsButton.spec.tsx +11 -12
  36. package/src/common/button/NsButton.stories.tsx +1 -1
  37. package/src/common/button/NsButton.styled.tsx +25 -23
  38. package/src/common/button/NsButton.tsx +9 -2
  39. package/src/common/button/types.d.ts +1 -0
  40. package/src/common/checkbox/NsCheckbox.styled.tsx +2 -2
  41. package/src/common/common.types.d.ts +2 -0
  42. package/src/common/dropdown/types.d.ts +3 -1
  43. package/src/common/email-simple/NsEmailSimple.spec.tsx +145 -0
  44. package/src/common/email-simple/NsEmailSimple.stories.tsx +61 -0
  45. package/src/common/email-simple/NsEmailSimple.tsx +71 -0
  46. package/src/common/email-simple/index.ts +2 -0
  47. package/src/common/email-simple/types.d.ts +14 -0
  48. package/src/common/flag/NsFlag.spec.tsx +4 -24
  49. package/src/common/flag/NsFlag.styled.tsx +5 -5
  50. package/src/common/flag/NsFlag.tsx +0 -2
  51. package/src/common/icon/types.d.ts +1 -0
  52. package/src/common/image/types.d.ts +1 -0
  53. package/src/common/index.ts +3 -0
  54. package/src/common/input/InputFieldWrapper.tsx +4 -4
  55. package/src/common/input/NsInputField.stories.tsx +11 -9
  56. package/src/common/input/NsInputField.tsx +12 -5
  57. package/src/common/input/getAdornmentProps.tsx +4 -0
  58. package/src/common/input/types.d.ts +3 -1
  59. package/src/common/label/NsLabel.stories.tsx +3 -0
  60. package/src/common/label/NsLabel.tsx +18 -17
  61. package/src/common/label/types.d.ts +2 -1
  62. package/src/common/nav-tab/NsNavTab.spec.tsx +0 -5
  63. package/src/common/nav-tab/NsNavTab.styled.tsx +7 -4
  64. package/src/common/radiogroup/NsRadioGroup.spec.tsx +64 -0
  65. package/src/common/radiogroup/NsRadioGroup.stories.tsx +102 -0
  66. package/src/common/radiogroup/NsRadioGroup.styled.tsx +50 -0
  67. package/src/common/radiogroup/NsRadioGroup.tsx +61 -0
  68. package/src/common/radiogroup/index.ts +2 -0
  69. package/src/common/radiogroup/types.d.ts +20 -0
  70. package/src/common/select/NsSelect.spec.tsx +200 -0
  71. package/src/common/select/NsSelect.styled.tsx +85 -0
  72. package/src/common/select/NsSelect.tsx +117 -0
  73. package/src/common/select/NsSelectOption.tsx +30 -0
  74. package/src/common/select/index.ts +3 -0
  75. package/src/common/select/stories/NsSelect.stories.tsx +134 -0
  76. package/src/common/select/types.d.ts +34 -0
  77. package/src/common/table/NsExpandableRow.tsx +68 -0
  78. package/src/common/table/NsTable.spec.tsx +69 -41
  79. package/src/common/table/NsTable.stories.tsx +45 -7
  80. package/src/common/table/NsTable.styled.ts +106 -12
  81. package/src/common/table/NsTable.tsx +78 -89
  82. package/src/common/table/NsTableHeader.tsx +52 -38
  83. package/src/common/table/NsTablePagination.tsx +21 -13
  84. package/src/common/table/types.d.ts +21 -8
  85. package/src/common/text-strip/NsTextStrip.tsx +10 -7
  86. package/src/common/typography/Typography.styled.tsx +3 -3
  87. package/src/common/validations/regex.ts +3 -0
  88. /package/src/common/card/{tests → specs}/BrandLogo.spec.tsx +0 -0
  89. /package/src/common/card/{tests → specs}/NsBgCard.spec.tsx +0 -0
  90. /package/src/common/card/{tests → specs}/NsBrandProductCard.spec.tsx +0 -0
  91. /package/src/common/card/{tests → specs}/NsFfgCard.spec.tsx +0 -0
  92. /package/src/common/carousal/{tests → specs}/Chevron.spec.tsx +0 -0
  93. /package/src/common/carousal/{tests → specs}/NsCarousal.spec.tsx +0 -0
  94. /package/src/common/carousal/{tests → specs}/NsScrollingCarousal.spec.tsx +0 -0
  95. /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 { TableBody, TableRow, TableCell } from '@mui/material';
3
- import { StyledTable, StyledTableContainer, StyledEmptyRow } from './NsTable.styled';
4
- import type { NsTableProps, Item, OrderType } from './types.d';
5
- import { stableSort, getComparator } from './helper';
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 NsCheckBox from '../checkbox/NsCheckbox';
8
- import NsTablePagination from './NsTablePagination';
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 [selected, setSelected] = useState<readonly (string | number)[]>([]);
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 handleSelectAllClick = (event: React.ChangeEvent<HTMLInputElement>) => {
42
- if (event.target.checked) {
43
- const newSelected = items.map((n) => n[itemKey as string]);
44
- setSelected(newSelected);
45
- return;
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 handleClick = (event: React.MouseEvent<unknown>, name: string | number) => {
51
- const selectedIndex = selected.indexOf(name);
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 isSelected = (name: string | number) => selected.indexOf(name) !== -1;
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
- <TableRow
110
- hover
111
- onClick={(event) => handleClick(event, row[itemKey])}
112
- role="checkbox"
113
- aria-checked={isItemSelected}
114
- tabIndex={-1}
115
- key={row[itemKey]}
116
- selected={isItemSelected}
117
- sx={{ cursor: 'pointer' }}
118
- data-testid={tableRowTestId}
119
- >
120
- {isShowSelector ? (
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
- {isPagination ? (
150
- <NsTablePagination
151
- rowsPerPageOptions={rowsPerPageOptions}
152
- count={items.length}
153
- rowsPerPage={rowsPerPage}
154
- page={page}
155
- onPageChange={handleChangePage}
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, Item } from './types.d';
2
- import React from 'react';
3
- import { TableHead, TableRow, Box, TableCell } from '@mui/material';
4
- import { StyledTableSortLabel } from './NsTable.styled';
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 { order, orderBy, numSelected, rowCount, headCells, isShowSelector, onRequestSort, onSelectAllClick } = props;
10
- const createSortHandler = (property: keyof Item) => (event: React.MouseEvent<unknown>) => {
11
- onRequestSort(event, property);
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
- {isShowSelector ? (
18
- <TableCell padding="checkbox">
19
- <NsCheckBox
20
- checked={rowCount > 0 && numSelected > 0}
21
- onChange={onSelectAllClick}
22
- testid="header-checkbox"
23
- name="header-checkbox"
24
- label=""
25
- className="ml-0 !important"
26
- />
27
- </TableCell>
28
- ) : null}
29
- {headCells.map((headCell) => (
30
- <TableCell key={headCell.id} sortDirection={orderBy == headCell.id ? order : false}>
31
- <StyledTableSortLabel
32
- active={orderBy == headCell.id}
33
- direction={orderBy == headCell.id ? order : 'asc'}
34
- onClick={createSortHandler(headCell.id)}
35
- >
36
- {headCell.label}
37
- {orderBy === headCell.id ? (
38
- <Box component="span" sx={visuallyHidden}>
39
- {order === 'desc' ? 'sorted descending' : 'sorted ascending'}
40
- </Box>
41
- ) : null}
42
- </StyledTableSortLabel>
43
- </TableCell>
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.d';
2
- import React from 'react';
3
- import { StyledPageComponent } from './NsTable.styled';
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 { rowsPerPageOptions, count, rowsPerPage, page, onPageChange, onRowsPerPageChange } = props;
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
- <TablePagination
11
- rowsPerPageOptions={rowsPerPageOptions}
12
- component={StyledPageComponent}
13
- count={count}
14
- rowsPerPage={rowsPerPage}
15
- page={page}
16
- onPageChange={onPageChange}
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
- isPagination?: boolean;
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: (unknown, number) => void;
43
- onRowsPerPageChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
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, FoundationTheme } from '@nuskin/foundation-theme';
12
- const { getPaletteColor, getAppColor } = ColorUtils;
13
- const getIsLight = (theme: FoundationTheme.Theme) => {
14
- const { palette = { primary: { main: '', contrastText: '' } } } = theme;
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: ${({ theme }) => (getIsLight(theme) ? '#f5f5f5' : getPaletteColor(theme, 'primary', 'contrastText'))};
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 { getPaletteColor } = ColorUtils;
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, theme, colorOverride }) =>
33
- colorOverride?.startsWith('#') ? colorOverride : getPaletteColor(theme, color)};
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]};
@@ -0,0 +1,3 @@
1
+ export const emailPattern =
2
+ // eslint-disable-next-line max-len
3
+ /^[\s]*[A-Za-z0-9!#$%&*+/=?^_`{|}~-]+(?:\.[A-Za-z0-9!#$%&*+/=?^_`{|}~-]+)*@(?:[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?\.)+[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?[\s]*$/;