@nuskin/foundation-ui-components 1.0.0-develop.1 → 1.0.0-develop.11

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 (250) hide show
  1. package/package.json +21 -11
  2. package/src/common/accordion/NsAccordion.tsx +69 -0
  3. package/src/common/accordion/NsAccordionHeader.tsx +77 -0
  4. package/src/common/accordion/NsAccordionItem.tsx +59 -0
  5. package/src/common/accordion/NsCollapse.tsx +117 -0
  6. package/src/common/accordion/NsToggleSection.tsx +43 -0
  7. package/src/common/accordion/ToggleSection.styled.tsx +32 -0
  8. package/src/common/accordion/colorMap.ts +117 -0
  9. package/src/common/accordion/enums.ts +18 -0
  10. package/src/common/accordion/index.ts +7 -0
  11. package/src/common/accordion/specs/NsAccordion.spec.tsx +163 -0
  12. package/src/common/accordion/specs/NsAccordionHeader.spec.tsx +130 -0
  13. package/src/common/accordion/specs/NsAccordionItem.spec.tsx +79 -0
  14. package/src/common/accordion/specs/NsCollapse.spec.tsx +129 -0
  15. package/src/common/accordion/specs/NsToggleSection.spec.tsx +74 -0
  16. package/src/common/accordion/stories/NsAccordion.stories.tsx +65 -0
  17. package/src/common/accordion/stories/NsAccordionHeader.stories.tsx +44 -0
  18. package/src/common/accordion/stories/NsAccordionItem.stories.tsx +45 -0
  19. package/src/common/accordion/stories/NsCollapse.stories.tsx +50 -0
  20. package/src/common/accordion/stories/NsToggleSection.stories.tsx +26 -0
  21. package/src/common/accordion/stories/data.tsx +143 -0
  22. package/src/common/accordion/types.d.ts +81 -0
  23. package/src/common/alert/Header.tsx +29 -0
  24. package/src/common/alert/NsAlert.spec.tsx +62 -29
  25. package/src/common/alert/NsAlert.stories.tsx +18 -17
  26. package/src/common/alert/NsAlert.styled.tsx +124 -0
  27. package/src/common/alert/NsAlert.tsx +27 -110
  28. package/src/common/alert/index.ts +2 -2
  29. package/src/common/alert/types.d.ts +23 -23
  30. package/src/common/auth-dropdown/NsAuthDropdown.spec.tsx +24 -6
  31. package/src/common/auth-dropdown/NsAuthDropdown.stories.tsx +2 -2
  32. package/src/common/auth-dropdown/NsAuthDropdown.styled.ts +21 -16
  33. package/src/common/auth-dropdown/NsAuthDropdown.tsx +7 -6
  34. package/src/common/auth-dropdown/index.ts +1 -1
  35. package/src/common/auth-dropdown/types.d.ts +3 -1
  36. package/src/common/autocomplete/NsAutocomplete.spec.tsx +69 -24
  37. package/src/common/autocomplete/NsAutocomplete.stories.tsx +64 -7
  38. package/src/common/autocomplete/NsAutocomplete.styled.tsx +12 -0
  39. package/src/common/autocomplete/NsAutocomplete.tsx +100 -46
  40. package/src/common/autocomplete/index.ts +2 -1
  41. package/src/common/autocomplete/mock/MockData.ts +50 -7
  42. package/src/common/autocomplete/mock/MockUI.tsx +2 -1
  43. package/src/common/autocomplete/{types.ts → types.d.ts} +18 -8
  44. package/src/common/banner/NsBanner.spec.tsx +13 -4
  45. package/src/common/banner/NsBanner.stories.tsx +2 -2
  46. package/src/common/banner/NsBanner.styled.tsx +1 -1
  47. package/src/common/banner/NsBanner.tsx +1 -1
  48. package/src/common/banner/index.ts +1 -1
  49. package/src/common/brand-components/NsBrand.stories.tsx +2 -2
  50. package/src/common/brand-components/NsBrandComponent.tsx +6 -3
  51. package/src/common/brand-components/index.ts +1 -1
  52. package/src/common/breadcrumb/NsBreadcrumb.spec.tsx +8 -9
  53. package/src/common/breadcrumb/NsBreadcrumb.stories.tsx +3 -5
  54. package/src/common/breadcrumb/NsBreadcrumb.tsx +5 -3
  55. package/src/common/breadcrumb/data.ts +10 -0
  56. package/src/common/breadcrumb/index.ts +1 -1
  57. package/src/common/button/NsButton.spec.tsx +66 -51
  58. package/src/common/button/NsButton.stories.tsx +61 -4
  59. package/src/common/button/NsButton.styled.tsx +54 -72
  60. package/src/common/button/NsButton.tsx +9 -3
  61. package/src/common/button/helper.ts +82 -0
  62. package/src/common/button/index.ts +1 -1
  63. package/src/common/button/types.d.ts +3 -0
  64. package/src/common/card/NsFfgCard.tsx +14 -8
  65. package/src/common/card/specs/NsFfgCard.spec.tsx +33 -0
  66. package/src/common/card/stories/NsBgCard.stories.tsx +2 -4
  67. package/src/common/card/stories/NsBrandProductCard.stories.tsx +2 -2
  68. package/src/common/card/stories/NsFfgCard.stories.tsx +49 -16
  69. package/src/common/card/stories/{data.js → data.ts} +1 -25
  70. package/src/common/card/styled/NsFfgStyled.tsx +9 -7
  71. package/src/common/card/types.d.ts +7 -4
  72. package/src/common/carousal/NsScrollingCarousal.tsx +61 -0
  73. package/src/common/carousal/index.ts +3 -0
  74. package/src/common/carousal/{tests → specs}/NsCarousal.spec.tsx +2 -2
  75. package/src/common/carousal/specs/NsScrollingCarousal.spec.tsx +61 -0
  76. package/src/common/carousal/stories/NSCarousal.stories.tsx +2 -2
  77. package/src/common/carousal/stories/NsScrollingCarousal.stories.tsx +52 -0
  78. package/src/common/carousal/types.d.ts +23 -0
  79. package/src/common/cart-icon/NsCartIcon.spec.tsx +6 -17
  80. package/src/common/cart-icon/NsCartIcon.stories.tsx +3 -3
  81. package/src/common/cart-icon/NsCartIcon.styled.ts +7 -33
  82. package/src/common/cart-icon/NsCartIcon.tsx +6 -15
  83. package/src/common/cart-icon/index.ts +1 -1
  84. package/src/common/cart-icon/types.d.ts +1 -0
  85. package/src/common/checkbox/NsCheckbox.spec.tsx +2 -2
  86. package/src/common/checkbox/NsCheckbox.stories.tsx +2 -2
  87. package/src/common/checkbox/NsCheckbox.styled.tsx +15 -16
  88. package/src/common/checkbox/NsCheckbox.tsx +2 -2
  89. package/src/common/checkbox/index.ts +1 -1
  90. package/src/common/checkbox/types.d.ts +1 -7
  91. package/src/common/column-control/NsColumnControl.tsx +1 -1
  92. package/src/common/column-control/NsFlexColumns.tsx +22 -0
  93. package/src/common/column-control/NsGridColumns.tsx +22 -0
  94. package/src/common/column-control/index.ts +3 -1
  95. package/src/common/column-control/{NsColumnControl.spec.tsx → specs/NsColumnControl.spec.tsx} +3 -3
  96. package/src/common/column-control/specs/NsFlexColumns.spec.tsx +24 -0
  97. package/src/common/column-control/specs/NsGridColumns.spec.tsx +24 -0
  98. package/src/common/column-control/stories/DivArray.stories.tsx +18 -0
  99. package/src/common/column-control/stories/DivArray.tsx +63 -0
  100. package/src/common/column-control/{NsColumnControl.stories.tsx → stories/NsColumnControl.stories.tsx} +9 -16
  101. package/src/common/column-control/stories/NsFlexColumns.stories.tsx +63 -0
  102. package/src/common/column-control/stories/NsGridColumns.stories.tsx +63 -0
  103. package/src/common/column-control/stories/common.tsx +14 -0
  104. package/src/common/column-control/styled/StyledFlex.tsx +45 -0
  105. package/src/common/column-control/styled/StyledGrid.tsx +40 -0
  106. package/src/common/column-control/styled/common.ts +27 -0
  107. package/src/common/column-control/types.d.ts +15 -16
  108. package/src/common/column-control/utils.ts +5 -5
  109. package/src/common/common.types.d.ts +21 -0
  110. package/src/common/dropdown/NsDropdown.spec.tsx +1 -1
  111. package/src/common/dropdown/NsDropdown.styled.tsx +23 -18
  112. package/src/common/dropdown/NsDropdown.tsx +1 -1
  113. package/src/common/dropdown/NsDropdownOption.tsx +1 -1
  114. package/src/common/dropdown/index.ts +1 -1
  115. package/src/common/dropdown/stories/NsDropdown.stories.tsx +2 -2
  116. package/src/common/dropdown/stories/NsDropdownCountry.stories.tsx +2 -2
  117. package/src/common/dropdown/types.d.ts +3 -1
  118. package/src/common/email-simple/NsEmailSimple.spec.tsx +145 -0
  119. package/src/common/email-simple/NsEmailSimple.stories.tsx +61 -0
  120. package/src/common/email-simple/NsEmailSimple.tsx +71 -0
  121. package/src/common/email-simple/index.ts +2 -0
  122. package/src/common/email-simple/types.d.ts +14 -0
  123. package/src/common/flag/NsFlag.spec.tsx +5 -25
  124. package/src/common/flag/NsFlag.stories.tsx +2 -2
  125. package/src/common/flag/NsFlag.styled.tsx +7 -9
  126. package/src/common/flag/NsFlag.tsx +1 -3
  127. package/src/common/flag/index.ts +1 -1
  128. package/src/common/flag/types.d.ts +0 -2
  129. package/src/common/hooks/index.ts +2 -0
  130. package/src/common/hooks/specs/useWindowSize.spec.tsx +19 -0
  131. package/src/common/hooks/useAccordionMap.tsx +39 -0
  132. package/src/common/hooks/useWindowSize.tsx +30 -0
  133. package/src/common/icon/NsIcon.spec.tsx +1 -1
  134. package/src/common/icon/NsIcon.stories.tsx +2 -2
  135. package/src/common/icon/NsIcon.styled.tsx +1 -1
  136. package/src/common/icon/NsIcon.tsx +1 -1
  137. package/src/common/icon/NsIconVariants.ts +9 -4
  138. package/src/common/icon/icons/AlertErrorIcon.tsx +15 -6
  139. package/src/common/icon/icons/Cart.tsx +7 -32
  140. package/src/common/icon/icons/HamburgerIcon.tsx +29 -0
  141. package/src/common/icon/icons/UserIcon.tsx +30 -0
  142. package/src/common/icon/icons/WarningIcon.tsx +14 -5
  143. package/src/common/icon/index.ts +1 -1
  144. package/src/common/icon/types.d.ts +1 -0
  145. package/src/common/image/NsImage.spec.tsx +57 -7
  146. package/src/common/image/NsImage.stories.tsx +2 -2
  147. package/src/common/image/NsImage.tsx +24 -12
  148. package/src/common/image/NsNextImage.spec.tsx +1 -1
  149. package/src/common/image/NsNextImage.stories.tsx +2 -2
  150. package/src/common/image/NsNextImage.tsx +1 -1
  151. package/src/common/image/index.ts +1 -1
  152. package/src/common/image/types.d.ts +1 -0
  153. package/src/common/index.ts +14 -10
  154. package/src/common/input/InputFieldWrapper.tsx +4 -4
  155. package/src/common/input/InputWrapper.tsx +12 -7
  156. package/src/common/input/NsInputField.stories.tsx +13 -10
  157. package/src/common/input/NsInputField.tsx +13 -6
  158. package/src/common/input/getAdornmentProps.tsx +5 -1
  159. package/src/common/input/index.ts +1 -1
  160. package/src/common/input/types.d.ts +18 -1
  161. package/src/common/label/NsLabel.stories.tsx +6 -1
  162. package/src/common/label/NsLabel.tsx +21 -20
  163. package/src/common/label/index.ts +1 -1
  164. package/src/common/label/types.d.ts +2 -1
  165. package/src/common/link/NsLink.spec.tsx +1 -1
  166. package/src/common/link/NsLink.stories.tsx +2 -2
  167. package/src/common/link/NsLink.tsx +1 -1
  168. package/src/common/link/index.ts +1 -1
  169. package/src/common/modal/NsModal.spec.tsx +46 -0
  170. package/src/common/modal/NsModal.styled.tsx +28 -0
  171. package/src/common/modal/NsModal.tsx +37 -0
  172. package/src/common/modal/helper-component/NsModalContentBox.tsx +32 -0
  173. package/src/common/modal/helper-component/NsModalDefault.tsx +25 -0
  174. package/src/common/modal/helper-component/NsModalStatus.tsx +15 -0
  175. package/src/common/modal/helper-component/NsModalStatusIcon.tsx +14 -0
  176. package/src/common/modal/helper-component/NsModalTitle.tsx +26 -0
  177. package/src/common/modal/index.ts +2 -0
  178. package/src/common/modal/model/NsModalVariantMap.tsx +24 -0
  179. package/src/common/modal/stories/NsModal.stories.tsx +86 -0
  180. package/src/common/modal/stories/mock.tsx +46 -0
  181. package/src/common/modal/types.ts +56 -0
  182. package/src/common/nav-product-card/NsNavProductCard.spec.tsx +1 -1
  183. package/src/common/nav-product-card/NsNavProductCard.stories.tsx +2 -2
  184. package/src/common/nav-product-card/NsNavProductCard.tsx +1 -1
  185. package/src/common/nav-product-card/index.ts +1 -1
  186. package/src/common/nav-tab/NsNavTab.spec.tsx +2 -7
  187. package/src/common/nav-tab/NsNavTab.stories.tsx +2 -2
  188. package/src/common/nav-tab/NsNavTab.styled.tsx +7 -4
  189. package/src/common/nav-tab/NsNavTab.tsx +1 -1
  190. package/src/common/nav-tab/index.ts +1 -1
  191. package/src/common/nav-tab/types.d.ts +2 -2
  192. package/src/common/radiogroup/NsRadioGroup.spec.tsx +63 -0
  193. package/src/common/radiogroup/NsRadioGroup.stories.tsx +84 -0
  194. package/src/common/radiogroup/NsRadioGroup.styled.tsx +52 -0
  195. package/src/common/radiogroup/NsRadioGroup.tsx +62 -0
  196. package/src/common/radiogroup/index.ts +2 -0
  197. package/src/common/radiogroup/types.d.ts +20 -0
  198. package/src/common/search-bar/NsSeachBar.spec.tsx +1 -1
  199. package/src/common/search-bar/NsSearchBar.tsx +1 -3
  200. package/src/common/select/NsSelect.spec.tsx +193 -0
  201. package/src/common/select/NsSelect.styled.tsx +104 -0
  202. package/src/common/select/NsSelect.tsx +117 -0
  203. package/src/common/select/NsSelectOption.tsx +30 -0
  204. package/src/common/select/index.ts +3 -0
  205. package/src/common/select/stories/NsSelect.stories.tsx +134 -0
  206. package/src/common/select/types.d.ts +34 -0
  207. package/src/common/spinner/NsSpinner.spec.tsx +21 -0
  208. package/src/common/spinner/NsSpinner.stories.tsx +26 -0
  209. package/src/common/spinner/NsSpinner.styled.tsx +344 -0
  210. package/src/common/spinner/NsSpinner.tsx +14 -0
  211. package/src/common/spinner/icons/Spinner.tsx +161 -0
  212. package/src/common/spinner/index.ts +2 -0
  213. package/src/common/spinner/types.ts +5 -0
  214. package/src/common/table/NsExpandableRow.tsx +68 -0
  215. package/src/common/table/NsTable.spec.tsx +174 -0
  216. package/src/common/table/NsTable.stories.tsx +161 -0
  217. package/src/common/table/NsTable.styled.ts +127 -0
  218. package/src/common/table/NsTable.tsx +133 -0
  219. package/src/common/table/NsTableHeader.tsx +41 -0
  220. package/src/common/table/NsTablePagination.tsx +28 -0
  221. package/src/common/table/helper.ts +33 -0
  222. package/src/common/table/index.ts +2 -0
  223. package/src/common/table/types.d.ts +57 -0
  224. package/src/common/text-strip/NsTextStrip.spec.tsx +30 -0
  225. package/src/common/text-strip/NsTextStrip.stories.tsx +33 -0
  226. package/src/common/text-strip/NsTextStrip.tsx +47 -0
  227. package/src/common/text-strip/index.ts +2 -0
  228. package/src/common/text-strip/types.d.ts +17 -0
  229. package/src/common/typography/NsTypography.stories.tsx +2 -2
  230. package/src/common/typography/NsTypography.tsx +1 -1
  231. package/src/common/typography/Typography.styled.tsx +4 -4
  232. package/src/common/typography/index.ts +1 -1
  233. package/src/common/util.ts +1 -0
  234. package/src/common/utility/Show.tsx +13 -0
  235. package/src/common/utility/index.ts +1 -0
  236. package/src/common/validations/regex.ts +3 -0
  237. package/src/common/videos/NsVideo.stories.tsx +2 -2
  238. package/src/common/videos/NsVideo.tsx +1 -1
  239. package/src/common/videos/index.ts +1 -1
  240. package/src/common/videos/types.d.ts +1 -1
  241. package/src/common/alert/NsAlert.styled.ts +0 -124
  242. package/src/common/card/tests/NsFfgCard.spec.tsx +0 -23
  243. package/src/common/column-control/NDivs.story.tsx +0 -35
  244. package/src/common/common.types.ts +0 -10
  245. /package/src/common/brand-components/{NsBrandContanier.styled.tsx → NsBrandContainer.styled.tsx} +0 -0
  246. /package/src/common/card/{tests → specs}/BrandLogo.spec.tsx +0 -0
  247. /package/src/common/card/{tests → specs}/NsBgCard.spec.tsx +0 -0
  248. /package/src/common/card/{tests → specs}/NsBrandProductCard.spec.tsx +0 -0
  249. /package/src/common/carousal/{tests → specs}/Chevron.spec.tsx +0 -0
  250. /package/src/common/carousal/{tests → specs}/RenderBrand.spec.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;
@@ -0,0 +1,2 @@
1
+ export { default as NsSpinner } from './NsSpinner';
2
+ export type { NsSpinnerProps } from './types';
@@ -0,0 +1,5 @@
1
+ import {AdditionalProps} from '../common.types';
2
+
3
+ export type NsSpinnerProps = {
4
+ size?: number;
5
+ } & Omit<AdditionalProps, 'darkModeEnabled'>;
@@ -0,0 +1,68 @@
1
+ import React from 'react';
2
+ import { TableRow } from '@mui/material';
3
+ import {
4
+ StyledTableRow,
5
+ StyledTableLastCell,
6
+ StyledExpandCell,
7
+ StyledOriginalTableCell
8
+ } from './NsTable.styled'
9
+ import type {
10
+ NsTableRowProps
11
+ } from './types'
12
+ import Box from '@mui/material/Box';
13
+ import Collapse from '@mui/material/Collapse';
14
+
15
+ export default function ExpandableRow({
16
+ expandableContent,
17
+ isExpand,
18
+ handleClick,
19
+ row,
20
+ itemKeyList,
21
+ index,
22
+ showActions,
23
+ showExpandedContent,
24
+ actionClick
25
+ }: NsTableRowProps) {
26
+ const tableRowTestId = `table-row-${index}`;
27
+
28
+ return (
29
+ <React.Fragment>
30
+ <StyledTableRow
31
+ hover
32
+ onClick={() => handleClick(index)}
33
+ tabIndex={-1}
34
+ key={index}
35
+ className='cursor-pointer'
36
+ data-testid={tableRowTestId}
37
+ >
38
+ {
39
+ itemKeyList.map((id, i) => {
40
+ return ((i === itemKeyList.length - 1) && showActions) ? (
41
+ <StyledTableLastCell align="justify" key={id}>
42
+ <span>{row[id]}</span>
43
+ <span className='action'>{actionClick(row)}</span>
44
+ </StyledTableLastCell>
45
+ ) : (
46
+ <StyledOriginalTableCell align="left" key={id}>{row[id]}</StyledOriginalTableCell>
47
+ )
48
+ })
49
+ }
50
+ </StyledTableRow>
51
+ {
52
+ showExpandedContent ? (
53
+ <TableRow>
54
+ <StyledExpandCell colSpan={itemKeyList.length} className={!isExpand ? 'remove' : ''}>
55
+ <Collapse in={isExpand} unmountOnExit>
56
+ <Box className='m-px'>
57
+ {
58
+ expandableContent(row, index)
59
+ }
60
+ </Box>
61
+ </Collapse>
62
+ </StyledExpandCell>
63
+ </TableRow>
64
+ ) : null
65
+ }
66
+ </React.Fragment>
67
+ )
68
+ }
@@ -0,0 +1,174 @@
1
+ import React from 'react';
2
+ import { render, fireEvent, screen } from '@/test-utils/index';
3
+ import NsTable from './NsTable';
4
+ import { Item } from './types';
5
+ import { NsIcon } from '../icon';
6
+
7
+ const expandableContent = (selectedItem: Item, index: number) => {
8
+ return (
9
+ <div key={index}>
10
+ <p>
11
+ Data: {selectedItem.name} , {selectedItem.calories}
12
+ </p>
13
+ <p>
14
+ Index: {index}
15
+ </p>
16
+ <p>
17
+ Expandable: True
18
+ </p>
19
+ </div>
20
+ )
21
+ }
22
+
23
+ const actionClick = (row: Item) => {
24
+ const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
25
+ event.stopPropagation();
26
+ console.log(row)
27
+ }
28
+
29
+ return (
30
+ <button onClick={handleClick}>
31
+ <NsIcon
32
+ name='cart'
33
+ size='medium'
34
+ />
35
+ </button>
36
+ )
37
+ }
38
+
39
+ describe('NsTable', () => {
40
+ const headers = [
41
+ { id: 'name', label: 'Name', numeric: false, sortable: true },
42
+ { id: 'age', label: 'Age', numeric: true, sortable: true },
43
+ ];
44
+
45
+ const items = [
46
+ { name: 'John', age: 26 },
47
+ { name: 'Jane', age: 32 },
48
+ { name: 'Maria', age: 28 },
49
+ { name: 'Kevin', age: 31 },
50
+ { name: 'Suzan', age: 25 },
51
+ { name: 'Dan', age: 30 },
52
+ { name: 'Micheal', age: 39 },
53
+ { name: 'Sandy', age: 39 },
54
+ ];
55
+
56
+ const rows = 5;
57
+ const rowsPerPageOptions = [5, 10, 15];
58
+ const itemKey = 'name';
59
+
60
+ it('renders table with correct data', () => {
61
+ render(
62
+ <NsTable
63
+ headers={headers}
64
+ items={items}
65
+ rows={rows}
66
+ rowsPerPageOptions={rowsPerPageOptions}
67
+ itemKey={itemKey}
68
+ isExpandableAll={true}
69
+ loading={true}
70
+ showActions={false}
71
+ showExpandedContent={false}
72
+ expandableContent={expandableContent}
73
+ actionClick={actionClick}
74
+ />
75
+ );
76
+
77
+ expect(screen.getByText('Name')).toBeInTheDocument();
78
+ expect(screen.getByText('Age')).toBeInTheDocument();
79
+ expect(screen.getByText('Kevin')).toBeInTheDocument();
80
+ expect(screen.getByText('Maria')).toBeInTheDocument();
81
+ expect(screen.getByText('28')).toBeInTheDocument();
82
+ expect(screen.getByText('31')).toBeInTheDocument();
83
+ });
84
+
85
+ it('expandable true click', () => {
86
+ render(
87
+ <NsTable
88
+ headers={headers}
89
+ items={items}
90
+ rows={rows}
91
+ rowsPerPageOptions={rowsPerPageOptions}
92
+ itemKey={itemKey}
93
+ isExpandableAll={true}
94
+ expandableContent={expandableContent}
95
+ actionClick={actionClick}
96
+ />
97
+ );
98
+
99
+
100
+ expect(screen.getByTestId('table-row-0')).toBeInTheDocument();
101
+
102
+ const button = screen.getByTestId('table-row-0');
103
+
104
+ fireEvent.click(button);
105
+ expect(screen.getByText('Expandable: True')).toBeInTheDocument();
106
+ fireEvent.click(button);
107
+ });
108
+
109
+ it('expandable false click', () => {
110
+ render(
111
+ <NsTable
112
+ headers={headers}
113
+ items={items}
114
+ rows={rows}
115
+ rowsPerPageOptions={rowsPerPageOptions}
116
+ itemKey={itemKey}
117
+ isExpandableAll={false}
118
+ expandableContent={expandableContent}
119
+ actionClick={actionClick}
120
+ />
121
+ );
122
+
123
+ expect(screen.getByTestId('table-row-0')).toBeInTheDocument();
124
+
125
+ const button = screen.getByTestId('table-row-0');
126
+
127
+ fireEvent.click(button);
128
+ expect(screen.getByText('Expandable: True')).toBeInTheDocument();
129
+ fireEvent.click(button);
130
+ });
131
+
132
+ it('pagination next button click event', async () => {
133
+ render(
134
+ <NsTable
135
+ headers={headers}
136
+ items={items}
137
+ rows={rows}
138
+ rowsPerPageOptions={rowsPerPageOptions}
139
+ itemKey={itemKey}
140
+ isExpandableAll={true}
141
+ expandableContent={expandableContent}
142
+ actionClick={actionClick}
143
+ />
144
+ );
145
+
146
+ expect(screen.getByTestId('NavigateNextIcon')).toBeInTheDocument();
147
+
148
+ const button = screen.getByTestId('NavigateNextIcon');
149
+ fireEvent.click(button);
150
+ expect(screen.getByText('Sandy')).toBeInTheDocument();
151
+ });
152
+
153
+ it('sort rows via age', () => {
154
+ render(
155
+ <NsTable
156
+ headers={headers}
157
+ items={items}
158
+ rows={rows}
159
+ rowsPerPageOptions={rowsPerPageOptions}
160
+ itemKey={itemKey}
161
+ isExpandableAll={true}
162
+ expandableContent={expandableContent}
163
+ actionClick={actionClick}
164
+ />
165
+ );
166
+
167
+ expect(screen.getByText('Age')).toBeInTheDocument();
168
+ const button = screen.getByText('Age');
169
+ fireEvent.click(button);
170
+
171
+ expect(screen.getByText('John')).toBeInTheDocument();
172
+ fireEvent.click(button);
173
+ });
174
+ });
@@ -0,0 +1,161 @@
1
+ import React from 'react'
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+ import NsTable from './NsTable';
4
+ import { withCenterDecorator } from '../../stories/decorators/withCenterDecorator';
5
+ import { Item } from './types';
6
+ import { NsIcon } from '../icon';
7
+
8
+ type ComponentType = typeof NsTable;
9
+ type Story = StoryObj<ComponentType>;
10
+ type MetaStory = Meta<ComponentType>;
11
+ const headers = [
12
+ {
13
+ label: 'Dessert (100g serving)',
14
+ id: 'name',
15
+ numeric: false,
16
+ sortable: false
17
+ },
18
+ { label: 'Calories', id: 'calories' , numeric: true, sortable: true},
19
+ { label: 'Fat (g)', id: 'fat', numeric: true, sortable: true },
20
+ { label: 'Carbs (g)', id: 'carbs', numeric: true, sortable: true },
21
+ { label: 'Protein (g)', id: 'protein', numeric: true, sortable: true },
22
+ { label: 'Iron (%)', id: 'iron', numeric: false, sortable: true },
23
+ ];
24
+
25
+ const items = [
26
+ {
27
+ name: 'Frozen Yogurt',
28
+ calories: 159,
29
+ fat: 6.0,
30
+ carbs: 24,
31
+ protein: 4.0,
32
+ iron: '1%',
33
+ },
34
+ {
35
+ name: 'Ice cream sandwich',
36
+ calories: 237,
37
+ fat: 9.0,
38
+ carbs: 37,
39
+ protein: 4.3,
40
+ iron: '1%',
41
+ },
42
+ {
43
+ name: 'Eclair',
44
+ calories: 262,
45
+ fat: 16.0,
46
+ carbs: 23,
47
+ protein: 6.0,
48
+ iron: '7%',
49
+ },
50
+ {
51
+ name: 'Cupcake',
52
+ calories: 305,
53
+ fat: 3.7,
54
+ carbs: 67,
55
+ protein: 4.3,
56
+ iron: '8%',
57
+ },
58
+ {
59
+ name: 'Gingerbread',
60
+ calories: 356,
61
+ fat: 16.0,
62
+ carbs: 49,
63
+ protein: 3.9,
64
+ iron: '16%',
65
+ },
66
+ {
67
+ name: 'Jelly bean',
68
+ calories: 375,
69
+ fat: 0.0,
70
+ carbs: 94,
71
+ protein: 0.0,
72
+ iron: '0%',
73
+ },
74
+ {
75
+ name: 'Lollipop',
76
+ calories: 392,
77
+ fat: 0.2,
78
+ carbs: 98,
79
+ protein: 0,
80
+ iron: '2%',
81
+ },
82
+ {
83
+ name: 'Honeycomb',
84
+ calories: 408,
85
+ fat: 3.2,
86
+ carbs: 87,
87
+ protein: 6.5,
88
+ iron: '45%',
89
+ },
90
+ {
91
+ name: 'Donut',
92
+ calories: 452,
93
+ fat: 25.0,
94
+ carbs: 51,
95
+ protein: 4.9,
96
+ iron: '22%',
97
+ },
98
+ {
99
+ name: 'KitKat',
100
+ calories: 518,
101
+ fat: 26.0,
102
+ carbs: 65,
103
+ protein: 7,
104
+ iron: '6%',
105
+ },
106
+ ];
107
+
108
+ export default {
109
+ title: 'Components/Data Display/NsTable',
110
+ component: NsTable,
111
+ decorators: [withCenterDecorator],
112
+ argTypes: {
113
+ rows: {
114
+ control: 'select',
115
+ options: [5, 10, 25],
116
+ },
117
+ },
118
+ args: {
119
+ headers: headers,
120
+ items: items,
121
+ rows: 5,
122
+ itemKey: 'name',
123
+ rowsPerPageOptions: [5, 10, 25],
124
+ isExpandableAll: true,
125
+ showActions: true,
126
+ showExpandedContent: true,
127
+ loading: false,
128
+ expandableContent: (selectedItem: Item, index: number) => {
129
+ return (
130
+ <div key={index}>
131
+ <p>
132
+ Data: {selectedItem.name} , {selectedItem.calories}
133
+ </p>
134
+ <p>
135
+ Index: {index}
136
+ </p>
137
+ <p>
138
+ Expandable: True
139
+ </p>
140
+ </div>
141
+ )
142
+ },
143
+ actionClick: (row: Item) => {
144
+ const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
145
+ event.stopPropagation();
146
+ console.log(row)
147
+ }
148
+
149
+ return (
150
+ <button onClick={handleClick}>
151
+ <NsIcon
152
+ name='cart'
153
+ size='medium'
154
+ />
155
+ </button>
156
+ )
157
+ }
158
+ }
159
+ } as MetaStory;
160
+
161
+ export const NasTable: Story = {};