@nuskin/foundation-ui-components 1.0.0-develop.5 → 1.0.0-develop.7
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 +17 -12
- package/src/common/accordion/NsAccordion.tsx +29 -39
- package/src/common/accordion/NsAccordionHeader.tsx +32 -17
- package/src/common/accordion/NsAccordionItem.tsx +16 -4
- package/src/common/accordion/NsCollapse.tsx +73 -35
- package/src/common/accordion/NsToggleSection.tsx +14 -3
- package/src/common/accordion/ToggleSection.styled.tsx +8 -7
- package/src/common/accordion/colorMap.ts +117 -0
- package/src/common/accordion/enums.ts +15 -0
- package/src/common/accordion/index.ts +1 -0
- package/src/common/accordion/specs/NsAccordion.spec.tsx +100 -31
- package/src/common/accordion/specs/NsAccordionHeader.spec.tsx +77 -10
- package/src/common/accordion/specs/NsAccordionItem.spec.tsx +23 -10
- package/src/common/accordion/specs/NsCollapse.spec.tsx +106 -17
- package/src/common/accordion/specs/NsToggleSection.spec.tsx +46 -14
- package/src/common/accordion/stories/NsAccordion.stories.tsx +27 -14
- package/src/common/accordion/stories/NsAccordionHeader.stories.tsx +4 -1
- package/src/common/accordion/stories/NsAccordionItem.stories.tsx +3 -3
- package/src/common/accordion/stories/NsCollapse.stories.tsx +3 -3
- package/src/common/accordion/stories/NsToggleSection.stories.tsx +2 -3
- package/src/common/accordion/stories/data.tsx +157 -19
- package/src/common/accordion/types.d.ts +56 -49
- package/src/common/alert/Header.tsx +29 -0
- package/src/common/alert/NsAlert.spec.tsx +46 -13
- package/src/common/alert/NsAlert.stories.tsx +3 -3
- package/src/common/alert/{NsAlert.styled.ts → NsAlert.styled.tsx} +22 -22
- package/src/common/alert/NsAlert.tsx +22 -87
- package/src/common/alert/types.d.ts +7 -7
- package/src/common/auth-dropdown/NsAuthDropdown.spec.tsx +23 -5
- package/src/common/auth-dropdown/NsAuthDropdown.stories.tsx +1 -1
- package/src/common/auth-dropdown/NsAuthDropdown.styled.ts +11 -7
- package/src/common/auth-dropdown/NsAuthDropdown.tsx +4 -4
- package/src/common/autocomplete/NsAutocomplete.spec.tsx +39 -6
- package/src/common/autocomplete/NsAutocomplete.stories.tsx +45 -7
- package/src/common/autocomplete/NsAutocomplete.tsx +31 -18
- package/src/common/autocomplete/mock/MockUI.tsx +1 -0
- package/src/common/autocomplete/types.d.ts +8 -6
- package/src/common/banner/NsBanner.spec.tsx +12 -3
- package/src/common/banner/NsBanner.stories.tsx +1 -1
- package/src/common/brand-components/NsBrand.stories.tsx +1 -1
- package/src/common/brand-components/NsBrandComponent.tsx +2 -2
- package/src/common/breadcrumb/NsBreadcrumb.spec.tsx +8 -3
- package/src/common/breadcrumb/NsBreadcrumb.stories.tsx +1 -1
- package/src/common/breadcrumb/NsBreadcrumb.tsx +2 -2
- package/src/common/breadcrumb/data.ts +8 -5
- package/src/common/button/NsButton.spec.tsx +65 -49
- package/src/common/button/NsButton.stories.tsx +59 -2
- package/src/common/button/NsButton.styled.tsx +49 -66
- package/src/common/button/NsButton.tsx +1 -2
- package/src/common/button/helper.ts +82 -0
- package/src/common/button/types.d.ts +2 -0
- package/src/common/card/stories/NsBgCard.stories.tsx +1 -1
- package/src/common/card/stories/NsBrandProductCard.stories.tsx +1 -1
- package/src/common/card/stories/NsFfgCard.stories.tsx +5 -2
- package/src/common/card/styled/NsFfgStyled.tsx +1 -1
- package/src/common/carousal/stories/NSCarousal.stories.tsx +1 -1
- package/src/common/carousal/stories/NsScrollingCarousal.stories.tsx +1 -1
- package/src/common/cart-icon/NsCartIcon.stories.tsx +1 -1
- package/src/common/checkbox/NsCheckbox.stories.tsx +1 -1
- package/src/common/checkbox/NsCheckbox.styled.tsx +15 -16
- package/src/common/checkbox/NsCheckbox.tsx +1 -1
- package/src/common/column-control/stories/DivArray.stories.tsx +1 -1
- package/src/common/column-control/stories/NsColumnControl.stories.tsx +1 -1
- package/src/common/column-control/stories/NsFlexColumns.stories.tsx +1 -1
- package/src/common/column-control/stories/NsGridColumns.stories.tsx +1 -1
- package/src/common/column-control/styled/common.ts +1 -1
- package/src/common/column-control/utils.ts +4 -4
- package/src/common/common.types.d.ts +11 -1
- package/src/common/dropdown/NsDropdown.styled.tsx +23 -18
- package/src/common/dropdown/stories/NsDropdown.stories.tsx +1 -1
- package/src/common/dropdown/stories/NsDropdownCountry.stories.tsx +1 -1
- package/src/common/flag/NsFlag.stories.tsx +1 -1
- package/src/common/hooks/index.ts +2 -0
- package/src/common/hooks/specs/useWindowSize.spec.tsx +19 -0
- package/src/common/hooks/useAccordionMap.tsx +39 -0
- package/src/common/hooks/useWindowSize.tsx +30 -0
- package/src/common/icon/NsIcon.stories.tsx +1 -1
- package/src/common/icon/NsIconVariants.ts +1 -0
- package/src/common/image/NsImage.spec.tsx +56 -6
- package/src/common/image/NsImage.stories.tsx +1 -1
- package/src/common/image/NsImage.tsx +23 -11
- package/src/common/image/NsNextImage.stories.tsx +1 -1
- package/src/common/index.ts +2 -0
- package/src/common/input/InputWrapper.tsx +12 -7
- package/src/common/input/NsInputField.tsx +1 -1
- package/src/common/label/NsLabel.stories.tsx +1 -1
- package/src/common/link/NsLink.stories.tsx +1 -1
- package/src/common/nav-product-card/NsNavProductCard.stories.tsx +1 -1
- package/src/common/nav-tab/NsNavTab.stories.tsx +1 -1
- package/src/common/radiogroup/NsRadioGroup.spec.tsx +24 -25
- package/src/common/radiogroup/NsRadioGroup.stories.tsx +14 -32
- package/src/common/radiogroup/NsRadioGroup.styled.tsx +17 -15
- package/src/common/radiogroup/NsRadioGroup.tsx +6 -5
- package/src/common/search-bar/NsSearchBar.tsx +1 -3
- package/src/common/select/NsSelect.spec.tsx +10 -17
- package/src/common/select/NsSelect.styled.tsx +53 -34
- package/src/common/select/stories/NsSelect.stories.tsx +11 -11
- package/src/common/select/types.d.ts +3 -3
- package/src/common/spinner/NsSpinner.spec.tsx +21 -0
- package/src/common/spinner/NsSpinner.stories.tsx +26 -0
- package/src/common/spinner/NsSpinner.styled.tsx +344 -0
- package/src/common/spinner/NsSpinner.tsx +14 -0
- package/src/common/spinner/icons/Spinner.tsx +161 -0
- package/src/common/spinner/index.ts +2 -0
- package/src/common/spinner/types.ts +5 -0
- package/src/common/table/NsTable.stories.tsx +1 -1
- package/src/common/table/NsTable.tsx +32 -49
- package/src/common/table/NsTableHeader.tsx +30 -51
- package/src/common/text-strip/NsTextStrip.stories.tsx +1 -1
- package/src/common/typography/NsTypography.stories.tsx +1 -1
- package/src/common/util.ts +1 -0
- package/src/common/videos/NsVideo.stories.tsx +1 -1
- package/src/common/videos/types.d.ts +1 -1
- /package/src/common/brand-components/{NsBrandContanier.styled.tsx → NsBrandContainer.styled.tsx} +0 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
2
|
+
import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon';
|
|
3
|
+
|
|
4
|
+
const SpinnerIcon = (props: SvgIconProps) => {
|
|
5
|
+
return (
|
|
6
|
+
<SvgIcon
|
|
7
|
+
id="ns-spinner-1"
|
|
8
|
+
viewBox="0 0 304 304"
|
|
9
|
+
shapeRendering="geometricPrecision"
|
|
10
|
+
textRendering="geometricPrecision"
|
|
11
|
+
{...props}
|
|
12
|
+
>
|
|
13
|
+
<g id="ns-spinner-2">
|
|
14
|
+
<g id="ns-spinner-3" transform="matrix(1 0 0 1 -34 -34)">
|
|
15
|
+
<circle
|
|
16
|
+
id="ns-spinner-4"
|
|
17
|
+
r="146.500000"
|
|
18
|
+
transform="matrix(0.26045430858251 0.75641493450408 -0.75641493450408 0.26045430858251 185.99999999964032 186.00000000212532)"
|
|
19
|
+
fill="none"
|
|
20
|
+
fillRule="evenodd"
|
|
21
|
+
stroke="rgb(247,247,247)"
|
|
22
|
+
strokeWidth="10"
|
|
23
|
+
strokeLinecap="round"
|
|
24
|
+
/>
|
|
25
|
+
</g>
|
|
26
|
+
</g>
|
|
27
|
+
<g
|
|
28
|
+
id="ns-spinner-5"
|
|
29
|
+
transform="matrix(0.56568542494924 0.56568542494924 -0.56568542494924 0.56568542494924 37.61439805970794 61.68043135401598)"
|
|
30
|
+
>
|
|
31
|
+
<g id="ns-spinner-6" transform="matrix(1 0 0 1 -53 -239)">
|
|
32
|
+
<g id="ns-spinner-7_tr" transform="translate(232.873721,220.430229) rotate(71.000016)">
|
|
33
|
+
<path
|
|
34
|
+
id="ns-spinner-7"
|
|
35
|
+
d="M207.214206,353.714206C243.362404,353.714206,276.452762,340.622041,302.002226,318.920768C333.639565,292.048559,353.714206,251.975724,353.714206,207.214206C353.714206,126.304490,288.123922,60.714206,207.214206,60.714206C126.304490,60.714206,60.714206,126.304490,60.714206,207.214206C60.714206,237.178438,69.710103,265.041566,85.148469,288.250162C111.396930,327.709644,156.268722,353.714206,207.214206,353.714206Z"
|
|
36
|
+
transform="scale(1,1) translate(-207.214206,-207.214206)"
|
|
37
|
+
opacity="0"
|
|
38
|
+
fill="none"
|
|
39
|
+
fill-rule="evenodd"
|
|
40
|
+
stroke="rgb(249,0,156)"
|
|
41
|
+
strokeWidth="30"
|
|
42
|
+
strokeLinecap="round"
|
|
43
|
+
strokeDasharray="200 1000"
|
|
44
|
+
/>
|
|
45
|
+
</g>
|
|
46
|
+
<g id="ns-spinner-8_tr" transform="translate(232.873721,220.430229) rotate(71.000016)">
|
|
47
|
+
<path
|
|
48
|
+
id="ns-spinner-8"
|
|
49
|
+
d="M207.214206,353.714206C243.362404,353.714206,276.452762,340.622041,302.002226,318.920768C333.639565,292.048559,353.714206,251.975724,353.714206,207.214206C353.714206,126.304490,288.123922,60.714206,207.214206,60.714206C126.304490,60.714206,60.714206,126.304490,60.714206,207.214206C60.714206,237.178438,69.710103,265.041566,85.148469,288.250162C111.396930,327.709644,156.268722,353.714206,207.214206,353.714206Z"
|
|
50
|
+
transform="scale(1,1) translate(-207.214206,-207.214206)"
|
|
51
|
+
opacity="0"
|
|
52
|
+
fill="none"
|
|
53
|
+
fill-rule="evenodd"
|
|
54
|
+
stroke="rgb(78,0,160)"
|
|
55
|
+
strokeWidth="30"
|
|
56
|
+
strokeLinecap="round"
|
|
57
|
+
strokeDasharray="200 1000"
|
|
58
|
+
/>
|
|
59
|
+
</g>
|
|
60
|
+
<g id="ns-spinner-9_tr" transform="translate(232.873721,220.430229) rotate(71.000016)">
|
|
61
|
+
<path
|
|
62
|
+
id="ns-spinner-9"
|
|
63
|
+
d="M207.214206,353.714206C243.362404,353.714206,276.452762,340.622041,302.002226,318.920768C333.639565,292.048559,353.714206,251.975724,353.714206,207.214206C353.714206,126.304490,288.123922,60.714206,207.214206,60.714206C126.304490,60.714206,60.714206,126.304490,60.714206,207.214206C60.714206,237.178438,69.710103,265.041566,85.148469,288.250162C111.396930,327.709644,156.268722,353.714206,207.214206,353.714206Z"
|
|
64
|
+
transform="scale(1,1) translate(-207.214206,-207.214206)"
|
|
65
|
+
opacity="0"
|
|
66
|
+
fill="none"
|
|
67
|
+
fill-rule="evenodd"
|
|
68
|
+
stroke="rgb(255,215,0)"
|
|
69
|
+
strokeWidth="30"
|
|
70
|
+
strokeLinecap="round"
|
|
71
|
+
strokeDasharray="200 1000"
|
|
72
|
+
/>
|
|
73
|
+
</g>
|
|
74
|
+
<g id="ns-spinner-10_tr" transform="translate(232.873721,220.430229) rotate(71.000016)">
|
|
75
|
+
<path
|
|
76
|
+
id="ns-spinner-10"
|
|
77
|
+
d="M207.214206,353.714206C243.362404,353.714206,276.452762,340.622041,302.002226,318.920768C333.639565,292.048559,353.714206,251.975724,353.714206,207.214206C353.714206,126.304490,288.123922,60.714206,207.214206,60.714206C126.304490,60.714206,60.714206,126.304490,60.714206,207.214206C60.714206,237.178438,69.710103,265.041566,85.148469,288.250162C111.396930,327.709644,156.268722,353.714206,207.214206,353.714206Z"
|
|
78
|
+
transform="scale(1,1) translate(-207.214206,-207.214206)"
|
|
79
|
+
opacity="0"
|
|
80
|
+
fill="none"
|
|
81
|
+
fill-rule="evenodd"
|
|
82
|
+
stroke="rgb(190,217,0)"
|
|
83
|
+
strokeWidth="30"
|
|
84
|
+
strokeLinecap="round"
|
|
85
|
+
strokeDasharray="200 1000"
|
|
86
|
+
/>
|
|
87
|
+
</g>
|
|
88
|
+
<g id="ns-spinner-11_tr" transform="translate(232.873721,220.430229) rotate(71.000016)">
|
|
89
|
+
<path
|
|
90
|
+
id="ns-spinner-11"
|
|
91
|
+
d="M207.214206,353.714206C243.362404,353.714206,276.452762,340.622041,302.002226,318.920768C333.639565,292.048559,353.714206,251.975724,353.714206,207.214206C353.714206,126.304490,288.123922,60.714206,207.214206,60.714206C126.304490,60.714206,60.714206,126.304490,60.714206,207.214206C60.714206,237.178438,69.710103,265.041566,85.148469,288.250162C111.396930,327.709644,156.268722,353.714206,207.214206,353.714206Z"
|
|
92
|
+
transform="scale(1,1) translate(-207.214206,-207.214206)"
|
|
93
|
+
opacity="0"
|
|
94
|
+
fill="none"
|
|
95
|
+
fill-rule="evenodd"
|
|
96
|
+
stroke="rgb(190,217,0)"
|
|
97
|
+
strokeWidth="30"
|
|
98
|
+
strokeLinecap="round"
|
|
99
|
+
strokeDasharray="200 1000"
|
|
100
|
+
/>
|
|
101
|
+
</g>
|
|
102
|
+
<g id="ns-spinner-12_tr" transform="translate(232.873721,220.430229) rotate(71.000016)">
|
|
103
|
+
<path
|
|
104
|
+
id="ns-spinner-12"
|
|
105
|
+
d="M207.214206,353.714206C243.362404,353.714206,276.452762,340.622041,302.002226,318.920768C333.639565,292.048559,353.714206,251.975724,353.714206,207.214206C353.714206,126.304490,288.123922,60.714206,207.214206,60.714206C126.304490,60.714206,60.714206,126.304490,60.714206,207.214206C60.714206,237.178438,69.710103,265.041566,85.148469,288.250162C111.396930,327.709644,156.268722,353.714206,207.214206,353.714206Z"
|
|
106
|
+
transform="scale(1,1) translate(-207.214206,-207.214206)"
|
|
107
|
+
opacity="0"
|
|
108
|
+
fill="none"
|
|
109
|
+
fill-rule="evenodd"
|
|
110
|
+
stroke="rgb(249,0,156)"
|
|
111
|
+
strokeWidth="30"
|
|
112
|
+
strokeLinecap="round"
|
|
113
|
+
strokeDasharray="200 1000"
|
|
114
|
+
/>
|
|
115
|
+
</g>
|
|
116
|
+
<g id="ns-spinner-13_tr" transform="translate(232.873721,220.430229) rotate(71.000016)">
|
|
117
|
+
<path
|
|
118
|
+
id="ns-spinner-13"
|
|
119
|
+
d="M207.214206,353.714206C243.362404,353.714206,276.452762,340.622041,302.002226,318.920768C333.639565,292.048559,353.714206,251.975724,353.714206,207.214206C353.714206,126.304490,288.123922,60.714206,207.214206,60.714206C126.304490,60.714206,60.714206,126.304490,60.714206,207.214206C60.714206,237.178438,69.710103,265.041566,85.148469,288.250162C111.396930,327.709644,156.268722,353.714206,207.214206,353.714206Z"
|
|
120
|
+
transform="scale(1,1) translate(-207.214206,-207.214206)"
|
|
121
|
+
fill="none"
|
|
122
|
+
fill-rule="evenodd"
|
|
123
|
+
stroke="rgb(255,215,0)"
|
|
124
|
+
strokeWidth="30"
|
|
125
|
+
strokeLinecap="round"
|
|
126
|
+
strokeDasharray="200 1000"
|
|
127
|
+
/>
|
|
128
|
+
</g>
|
|
129
|
+
<g id="ns-spinner-14_tr" transform="translate(232.873721,220.430229) rotate(71.000016)">
|
|
130
|
+
<path
|
|
131
|
+
id="ns-spinner-14"
|
|
132
|
+
d="M207.214206,353.714206C243.362404,353.714206,276.452762,340.622041,302.002226,318.920768C333.639565,292.048559,353.714206,251.975724,353.714206,207.214206C353.714206,126.304490,288.123922,60.714206,207.214206,60.714206C126.304490,60.714206,60.714206,126.304490,60.714206,207.214206C60.714206,237.178438,69.710103,265.041566,85.148469,288.250162C111.396930,327.709644,156.268722,353.714206,207.214206,353.714206Z"
|
|
133
|
+
transform="scale(1,1) translate(-207.214206,-207.214206)"
|
|
134
|
+
fill="none"
|
|
135
|
+
fill-rule="evenodd"
|
|
136
|
+
stroke="rgb(255,78,0)"
|
|
137
|
+
strokeWidth="30"
|
|
138
|
+
strokeLinecap="round"
|
|
139
|
+
strokeDasharray="200 1000"
|
|
140
|
+
/>
|
|
141
|
+
</g>
|
|
142
|
+
<g id="ns-spinner-15_tr" transform="translate(232.873721,220.430229) rotate(71.000016)">
|
|
143
|
+
<path
|
|
144
|
+
id="ns-spinner-15"
|
|
145
|
+
d="M207.214206,353.714206C243.362404,353.714206,276.452762,340.622041,302.002226,318.920768C333.639565,292.048559,353.714206,251.975724,353.714206,207.214206C353.714206,126.304490,288.123922,60.714206,207.214206,60.714206C126.304490,60.714206,60.714206,126.304490,60.714206,207.214206C60.714206,237.178438,69.710103,265.041566,85.148469,288.250162C111.396930,327.709644,156.268722,353.714206,207.214206,353.714206Z"
|
|
146
|
+
transform="scale(1,1) translate(-207.214206,-207.214206)"
|
|
147
|
+
fill="none"
|
|
148
|
+
fill-rule="evenodd"
|
|
149
|
+
stroke="rgb(0,183,231)"
|
|
150
|
+
strokeWidth="30"
|
|
151
|
+
strokeLinecap="round"
|
|
152
|
+
strokeDasharray="200 1000"
|
|
153
|
+
/>
|
|
154
|
+
</g>
|
|
155
|
+
</g>
|
|
156
|
+
</g>
|
|
157
|
+
</SvgIcon>
|
|
158
|
+
);
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export default SpinnerIcon;
|
|
@@ -1,25 +1,17 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
TableBody,
|
|
4
|
-
TableCell,
|
|
5
|
-
TableRow
|
|
6
|
-
} from '@mui/material';
|
|
2
|
+
import { TableBody, TableCell, TableRow } from '@mui/material';
|
|
7
3
|
import {
|
|
8
4
|
StyledTable,
|
|
9
5
|
StyledTableContainer,
|
|
10
6
|
StyledEmptyRow,
|
|
11
7
|
StyledProgressCell,
|
|
12
|
-
StyledLinearProgress
|
|
13
|
-
} from './NsTable.styled'
|
|
14
|
-
import type {
|
|
15
|
-
|
|
16
|
-
Item,
|
|
17
|
-
OrderType,
|
|
18
|
-
} from './types'
|
|
19
|
-
import {stableSort, getComparator} from './helper'
|
|
8
|
+
StyledLinearProgress,
|
|
9
|
+
} from './NsTable.styled';
|
|
10
|
+
import type { NsTableProps, Item, OrderType } from './types';
|
|
11
|
+
import { stableSort, getComparator } from './helper';
|
|
20
12
|
import NsTableHeader from './NsTableHeader';
|
|
21
|
-
import NsTablePagination from './NsTablePagination'
|
|
22
|
-
import ExpandableRow from './NsExpandableRow'
|
|
13
|
+
import NsTablePagination from './NsTablePagination';
|
|
14
|
+
import ExpandableRow from './NsExpandableRow';
|
|
23
15
|
import Grid from '@mui/material/Grid';
|
|
24
16
|
|
|
25
17
|
export default function NsTable({
|
|
@@ -37,13 +29,11 @@ export default function NsTable({
|
|
|
37
29
|
}: NsTableProps) {
|
|
38
30
|
const [order, setOrder] = useState<OrderType>('asc');
|
|
39
31
|
const [orderBy, setOrderBy] = useState<keyof Item>(itemKey);
|
|
40
|
-
const [
|
|
32
|
+
const [expandMap, setExpandMap] = useState<{ [key: number]: boolean }>({});
|
|
41
33
|
const [page, setPage] = useState(0);
|
|
42
34
|
const [rowsPerPage, setRowsPerPage] = useState(rows);
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
useEffect(() => {
|
|
46
|
-
if (items.length) setItemKeyList(Object.keys(items[0]));
|
|
35
|
+
const itemKeyList = React.useMemo(() => {
|
|
36
|
+
return items.length ? Object.keys(items[0]) : [];
|
|
47
37
|
}, [items]);
|
|
48
38
|
|
|
49
39
|
useEffect(() => {
|
|
@@ -58,27 +48,18 @@ export default function NsTable({
|
|
|
58
48
|
};
|
|
59
49
|
|
|
60
50
|
const handleClick = (index: number) => {
|
|
61
|
-
if(isExpandableAll) {
|
|
62
|
-
|
|
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]);
|
|
51
|
+
if (isExpandableAll) {
|
|
52
|
+
setExpandMap((prevState) => ({ ...prevState, [index]: !prevState[index] }));
|
|
70
53
|
} else {
|
|
71
|
-
|
|
72
|
-
else setExpandList([index])
|
|
54
|
+
setExpandMap({ [index]: !expandMap[index] });
|
|
73
55
|
}
|
|
74
56
|
};
|
|
75
57
|
|
|
76
58
|
const handleChangePage = (newPage: number) => {
|
|
77
|
-
setPage(newPage-1);
|
|
59
|
+
setPage(newPage - 1);
|
|
78
60
|
};
|
|
79
|
-
|
|
80
|
-
const emptyRows =
|
|
81
|
-
page > 0 ? Math.max(0, (1 + page) * rowsPerPage - items.length) : 0;
|
|
61
|
+
|
|
62
|
+
const emptyRows = getEmptyRows();
|
|
82
63
|
|
|
83
64
|
const visibleRows = React.useMemo(
|
|
84
65
|
() =>
|
|
@@ -101,25 +82,23 @@ export default function NsTable({
|
|
|
101
82
|
rowCount={items.length}
|
|
102
83
|
/>
|
|
103
84
|
<TableBody>
|
|
104
|
-
{
|
|
105
|
-
|
|
106
|
-
<
|
|
107
|
-
<
|
|
108
|
-
<Grid
|
|
109
|
-
<
|
|
110
|
-
<StyledLinearProgress />
|
|
111
|
-
</Grid>
|
|
85
|
+
{loading ? (
|
|
86
|
+
<TableRow>
|
|
87
|
+
<StyledProgressCell colSpan={itemKeyList.length}>
|
|
88
|
+
<Grid container>
|
|
89
|
+
<Grid item xs={12}>
|
|
90
|
+
<StyledLinearProgress />
|
|
112
91
|
</Grid>
|
|
113
|
-
</
|
|
114
|
-
</
|
|
115
|
-
|
|
116
|
-
}
|
|
92
|
+
</Grid>
|
|
93
|
+
</StyledProgressCell>
|
|
94
|
+
</TableRow>
|
|
95
|
+
) : null}
|
|
117
96
|
{visibleRows.map((row, index) => {
|
|
118
97
|
return (
|
|
119
98
|
<ExpandableRow
|
|
120
99
|
key={index}
|
|
121
100
|
expandableContent={expandableContent}
|
|
122
|
-
isExpand={
|
|
101
|
+
isExpand={expandMap[index]}
|
|
123
102
|
handleClick={handleClick}
|
|
124
103
|
row={row}
|
|
125
104
|
index={index}
|
|
@@ -142,9 +121,13 @@ export default function NsTable({
|
|
|
142
121
|
rowsPerPageOptions={rowsPerPageOptions}
|
|
143
122
|
count={items.length}
|
|
144
123
|
rowsPerPage={rowsPerPage}
|
|
145
|
-
page={page+1}
|
|
124
|
+
page={page + 1}
|
|
146
125
|
onPageChange={handleChangePage}
|
|
147
126
|
/>
|
|
148
127
|
</div>
|
|
149
128
|
);
|
|
129
|
+
|
|
130
|
+
function getEmptyRows() {
|
|
131
|
+
return page > 0 ? Math.max(0, (1 + page) * rowsPerPage - items.length) : 0;
|
|
132
|
+
}
|
|
150
133
|
}
|
|
@@ -1,61 +1,40 @@
|
|
|
1
|
-
import type { NsTableHeaderProps,
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
TableRow,
|
|
6
|
-
Box,
|
|
7
|
-
TableCell
|
|
8
|
-
} from '@mui/material';
|
|
9
|
-
import {
|
|
10
|
-
StyledTableSortLabel,
|
|
11
|
-
StyledTableLabel
|
|
12
|
-
} from './NsTable.styled'
|
|
1
|
+
import type { NsTableHeaderProps, Item } from './types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { TableHead, TableRow, Box, TableCell } from '@mui/material';
|
|
4
|
+
import { StyledTableSortLabel, StyledTableLabel } from './NsTable.styled';
|
|
13
5
|
import { visuallyHidden } from '@mui/utils';
|
|
14
6
|
|
|
15
7
|
export default function NsTableHeader(props: NsTableHeaderProps) {
|
|
16
|
-
const {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} = props;
|
|
22
|
-
const createSortHandler =
|
|
23
|
-
(property: keyof Item) => (event: React.MouseEvent<unknown>) => { onRequestSort(event, property);};
|
|
24
|
-
|
|
8
|
+
const { order, orderBy, headCells, onRequestSort } = props;
|
|
9
|
+
const createSortHandler = (property: keyof Item) => (event: React.MouseEvent<unknown>) => {
|
|
10
|
+
onRequestSort(event, property);
|
|
11
|
+
};
|
|
12
|
+
|
|
25
13
|
return (
|
|
26
14
|
<TableHead>
|
|
27
15
|
<TableRow>
|
|
28
|
-
{
|
|
29
|
-
|
|
30
|
-
headCell.
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
16
|
+
{headCells.map((headCell) =>
|
|
17
|
+
headCell.sortable ? (
|
|
18
|
+
<TableCell key={headCell.id} sortDirection={orderBy === headCell.id ? order : false}>
|
|
19
|
+
<StyledTableSortLabel
|
|
20
|
+
active={orderBy === headCell.id}
|
|
21
|
+
direction={orderBy === headCell.id ? order : 'asc'}
|
|
22
|
+
onClick={createSortHandler(headCell.id)}
|
|
34
23
|
>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
<TableCell
|
|
50
|
-
key={headCell.id}
|
|
51
|
-
sortDirection={false}
|
|
52
|
-
>
|
|
53
|
-
<StyledTableLabel>
|
|
54
|
-
{headCell.label}
|
|
55
|
-
</StyledTableLabel>
|
|
56
|
-
</TableCell>
|
|
57
|
-
)
|
|
58
|
-
))}
|
|
24
|
+
{headCell.label}
|
|
25
|
+
{orderBy === headCell.id ? (
|
|
26
|
+
<Box component="span" sx={visuallyHidden}>
|
|
27
|
+
{order === 'desc' ? 'sorted descending' : 'sorted ascending'}
|
|
28
|
+
</Box>
|
|
29
|
+
) : null}
|
|
30
|
+
</StyledTableSortLabel>
|
|
31
|
+
</TableCell>
|
|
32
|
+
) : (
|
|
33
|
+
<TableCell key={headCell.id} sortDirection={false}>
|
|
34
|
+
<StyledTableLabel>{headCell.label}</StyledTableLabel>
|
|
35
|
+
</TableCell>
|
|
36
|
+
)
|
|
37
|
+
)}
|
|
59
38
|
</TableRow>
|
|
60
39
|
</TableHead>
|
|
61
40
|
);
|
|
@@ -12,7 +12,7 @@ type Story = StoryObj<ComponentType>;
|
|
|
12
12
|
type MetaStory = Meta<ComponentType>;
|
|
13
13
|
|
|
14
14
|
export default {
|
|
15
|
-
title: 'Components/NsTextStrip',
|
|
15
|
+
title: 'Components/Data Display/NsTextStrip',
|
|
16
16
|
component: NsTextStrip,
|
|
17
17
|
decorators: [withCenterDecorator],
|
|
18
18
|
argTypes: {
|
|
@@ -7,7 +7,7 @@ type Story = StoryObj<ComponentType>;
|
|
|
7
7
|
type MetaStory = Meta<ComponentType>;
|
|
8
8
|
|
|
9
9
|
export default {
|
|
10
|
-
title: 'Components/NsTypography',
|
|
10
|
+
title: 'Components/Data Display/NsTypography',
|
|
11
11
|
component: NsTypography,
|
|
12
12
|
decorators: [withCenterDecorator],
|
|
13
13
|
argTypes: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const skipDarkModeEnabled = (key: string) => key !== 'darkModeEnabled';
|
/package/src/common/brand-components/{NsBrandContanier.styled.tsx → NsBrandContainer.styled.tsx}
RENAMED
|
File without changes
|