@nuskin/foundation-ui-components 1.33.0-1253-feature.3 → 2.0.0
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/dist/index.d.mts +1221 -0
- package/dist/index.d.ts +1221 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +33 -10
- package/src/common/accordion/NsAccordion.tsx +0 -82
- package/src/common/accordion/NsAccordionHeader.tsx +0 -85
- package/src/common/accordion/NsAccordionItem.tsx +0 -65
- package/src/common/accordion/NsCollapse.tsx +0 -121
- package/src/common/accordion/NsToggleSection.tsx +0 -50
- package/src/common/accordion/ToggleSection.styled.tsx +0 -32
- package/src/common/accordion/colorMap.ts +0 -60
- package/src/common/accordion/enums.ts +0 -18
- package/src/common/accordion/index.ts +0 -7
- package/src/common/accordion/specs/NsAccordion.spec.tsx +0 -183
- package/src/common/accordion/specs/NsAccordionHeader.spec.tsx +0 -172
- package/src/common/accordion/specs/NsAccordionItem.spec.tsx +0 -79
- package/src/common/accordion/specs/NsCollapse.spec.tsx +0 -130
- package/src/common/accordion/specs/NsToggleSection.spec.tsx +0 -74
- package/src/common/accordion/stories/NsAccordion.stories.tsx +0 -65
- package/src/common/accordion/stories/NsAccordionHeader.stories.tsx +0 -44
- package/src/common/accordion/stories/NsAccordionItem.stories.tsx +0 -48
- package/src/common/accordion/stories/NsCollapse.stories.tsx +0 -53
- package/src/common/accordion/stories/NsToggleSection.stories.tsx +0 -27
- package/src/common/accordion/stories/data.tsx +0 -145
- package/src/common/accordion/types.d.ts +0 -90
- package/src/common/alert/Header.tsx +0 -29
- package/src/common/alert/NsAlert.spec.tsx +0 -167
- package/src/common/alert/NsAlert.stories.tsx +0 -45
- package/src/common/alert/NsAlert.styled.tsx +0 -114
- package/src/common/alert/NsAlert.tsx +0 -93
- package/src/common/alert/index.ts +0 -2
- package/src/common/alert/types.d.ts +0 -45
- package/src/common/auth-dropdown/NsAuthDropdown.spec.tsx +0 -54
- package/src/common/auth-dropdown/NsAuthDropdown.stories.tsx +0 -25
- package/src/common/auth-dropdown/NsAuthDropdown.styled.ts +0 -120
- package/src/common/auth-dropdown/NsAuthDropdown.tsx +0 -72
- package/src/common/auth-dropdown/index.ts +0 -2
- package/src/common/auth-dropdown/types.d.ts +0 -11
- package/src/common/autocomplete/NsAutocomplete.spec.tsx +0 -91
- package/src/common/autocomplete/NsAutocomplete.styled.tsx +0 -24
- package/src/common/autocomplete/NsAutocomplete.tsx +0 -225
- package/src/common/autocomplete/helper/LineLoader.tsx +0 -38
- package/src/common/autocomplete/helper/RecentClearAll.tsx +0 -43
- package/src/common/autocomplete/helper/SeeMoreButton.tsx +0 -68
- package/src/common/autocomplete/helper/index.ts +0 -4
- package/src/common/autocomplete/helper/renderGroupName.tsx +0 -26
- package/src/common/autocomplete/index.ts +0 -2
- package/src/common/autocomplete/mock/Mock.styled.tsx +0 -23
- package/src/common/autocomplete/mock/MockData.ts +0 -89
- package/src/common/autocomplete/mock/MockUI.tsx +0 -26
- package/src/common/autocomplete/stories/NoCloseAutoComplete.tsx +0 -49
- package/src/common/autocomplete/stories/NsAutocomplete.stories.tsx +0 -78
- package/src/common/autocomplete/stories/RenderAutoComplete.tsx +0 -60
- package/src/common/autocomplete/types.d.ts +0 -67
- package/src/common/banner/NsBanner.spec.tsx +0 -28
- package/src/common/banner/NsBanner.stories.tsx +0 -47
- package/src/common/banner/NsBanner.styled.tsx +0 -24
- package/src/common/banner/NsBanner.tsx +0 -32
- package/src/common/banner/index.ts +0 -2
- package/src/common/banner/types.d.ts +0 -14
- package/src/common/brand-components/NsBrand.stories.tsx +0 -26
- package/src/common/brand-components/NsBrandComponent.spec.tsx +0 -47
- package/src/common/brand-components/NsBrandComponent.tsx +0 -33
- package/src/common/brand-components/NsBrandContainer.styled.tsx +0 -10
- package/src/common/brand-components/icons/Logo.spec.tsx +0 -84
- package/src/common/brand-components/icons/NSLogoHorizontal.tsx +0 -70
- package/src/common/brand-components/icons/NSLogoMark.tsx +0 -39
- package/src/common/brand-components/icons/NSLogoPoweredBy.tsx +0 -103
- package/src/common/brand-components/icons/NSLogoStacked.tsx +0 -57
- package/src/common/brand-components/icons/NSWordMark.tsx +0 -60
- package/src/common/brand-components/index.ts +0 -2
- package/src/common/brand-components/types.d.ts +0 -11
- package/src/common/breadcrumb/NsBreadcrumb.spec.tsx +0 -28
- package/src/common/breadcrumb/NsBreadcrumb.stories.tsx +0 -39
- package/src/common/breadcrumb/NsBreadcrumb.styled.tsx +0 -36
- package/src/common/breadcrumb/NsBreadcrumb.tsx +0 -85
- package/src/common/breadcrumb/data.ts +0 -10
- package/src/common/breadcrumb/index.ts +0 -2
- package/src/common/breadcrumb/types.d.ts +0 -14
- package/src/common/button/NsButton.spec.tsx +0 -94
- package/src/common/button/NsButton.stories.tsx +0 -118
- package/src/common/button/NsButton.styled.tsx +0 -57
- package/src/common/button/NsButton.tsx +0 -48
- package/src/common/button/__snapshots__/NsButton.spec.tsx.snap +0 -120
- package/src/common/button/helper.ts +0 -84
- package/src/common/button/index.ts +0 -2
- package/src/common/button/types.d.ts +0 -26
- package/src/common/card/CardButton.tsx +0 -58
- package/src/common/card/NsAwardCard.tsx +0 -71
- package/src/common/card/NsBgCard.tsx +0 -26
- package/src/common/card/NsBrandCard.tsx +0 -88
- package/src/common/card/NsBrandLogo.tsx +0 -16
- package/src/common/card/NsBrandWrapper.tsx +0 -25
- package/src/common/card/NsCheckoutCard.tsx +0 -107
- package/src/common/card/NsHeroCardLevel1.tsx +0 -105
- package/src/common/card/NsHeroCardLevel2.tsx +0 -95
- package/src/common/card/NsIconText.tsx +0 -165
- package/src/common/card/NsLargeCard.tsx +0 -108
- package/src/common/card/NsMediumCard.tsx +0 -110
- package/src/common/card/NsPost.tsx +0 -78
- package/src/common/card/NsSmallFullCard.tsx +0 -93
- package/src/common/card/NsXLargeCard.tsx +0 -89
- package/src/common/card/cardSizes.ts +0 -12
- package/src/common/card/fixtures/ImageData1.ts +0 -38
- package/src/common/card/fixtures/ImageData2.ts +0 -38
- package/src/common/card/index.ts +0 -15
- package/src/common/card/specs/BrandLogo.spec.tsx +0 -13
- package/src/common/card/specs/NsAwardCard.spec.tsx +0 -29
- package/src/common/card/specs/NsBgCard.spec.tsx +0 -23
- package/src/common/card/specs/NsBrandCard.spec.tsx +0 -84
- package/src/common/card/specs/NsCheckoutCard.spec.tsx +0 -39
- package/src/common/card/specs/NsHeroCardLevel1.spec.tsx +0 -39
- package/src/common/card/specs/NsHeroCardLevel2.spec.tsx +0 -49
- package/src/common/card/specs/NsIconText.spec.tsx +0 -25
- package/src/common/card/specs/NsLargeCard.spec.tsx +0 -47
- package/src/common/card/specs/NsMediumCard.spec.tsx +0 -51
- package/src/common/card/specs/NsPost.spec.tsx +0 -28
- package/src/common/card/specs/NsSmallFullCard.spec.tsx +0 -47
- package/src/common/card/specs/NsXLargeCard.spec.tsx +0 -47
- package/src/common/card/stories/NsAwardCard.stories.tsx +0 -21
- package/src/common/card/stories/NsBrandCard.stories.tsx +0 -32
- package/src/common/card/stories/NsCheckoutCard.stories.tsx +0 -23
- package/src/common/card/stories/NsHeroCardLevel1.stories.tsx +0 -30
- package/src/common/card/stories/NsHeroCardLevel2.stories.tsx +0 -29
- package/src/common/card/stories/NsIconText.stories.tsx +0 -18
- package/src/common/card/stories/NsLargeCard.stories.tsx +0 -32
- package/src/common/card/stories/NsMediumCard.stories.tsx +0 -34
- package/src/common/card/stories/NsPost.stories.tsx +0 -20
- package/src/common/card/stories/NsSmallFullCard.stories.tsx +0 -31
- package/src/common/card/stories/NsXLargeCard.stories.tsx +0 -32
- package/src/common/card/stories/data.ts +0 -43
- package/src/common/card/types.d.ts +0 -25
- package/src/common/carousal/CarousalControl.tsx +0 -47
- package/src/common/carousal/IconWrapper.tsx +0 -33
- package/src/common/carousal/NsCarousal.tsx +0 -65
- package/src/common/carousal/NsScrollingCarousal.tsx +0 -60
- package/src/common/carousal/RenderBrand.tsx +0 -20
- package/src/common/carousal/index.ts +0 -5
- package/src/common/carousal/slickSetting.ts +0 -61
- package/src/common/carousal/specs/Chevron.spec.tsx +0 -10
- package/src/common/carousal/specs/NsCarousal.spec.tsx +0 -112
- package/src/common/carousal/specs/NsScrollingCarousal.spec.tsx +0 -63
- package/src/common/carousal/specs/RenderBrand.spec.tsx +0 -22
- package/src/common/carousal/stories/NsCarousal1.stories.tsx +0 -34
- package/src/common/carousal/stories/NsScrollingCarousal.stories.tsx +0 -80
- package/src/common/carousal/types.d.ts +0 -23
- package/src/common/cart-icon/NsCartIcon.spec.tsx +0 -19
- package/src/common/cart-icon/NsCartIcon.stories.tsx +0 -28
- package/src/common/cart-icon/NsCartIcon.styled.tsx +0 -15
- package/src/common/cart-icon/NsCartIcon.tsx +0 -24
- package/src/common/cart-icon/index.ts +0 -2
- package/src/common/cart-icon/types.d.ts +0 -8
- package/src/common/checkbox/NsCheckbox.spec.tsx +0 -57
- package/src/common/checkbox/NsCheckbox.stories.tsx +0 -55
- package/src/common/checkbox/NsCheckbox.styled.tsx +0 -55
- package/src/common/checkbox/NsCheckbox.tsx +0 -68
- package/src/common/checkbox/index.ts +0 -2
- package/src/common/checkbox/types.d.ts +0 -20
- package/src/common/column-control/NsColumnControl.tsx +0 -64
- package/src/common/column-control/NsFlexColumns.tsx +0 -29
- package/src/common/column-control/NsGridColumns.tsx +0 -29
- package/src/common/column-control/index.ts +0 -4
- package/src/common/column-control/specs/NsColumnControl.spec.tsx +0 -24
- package/src/common/column-control/specs/NsFlexColumns.spec.tsx +0 -24
- package/src/common/column-control/specs/NsGridColumns.spec.tsx +0 -24
- package/src/common/column-control/stories/DivArray.stories.tsx +0 -18
- package/src/common/column-control/stories/DivArray.tsx +0 -63
- package/src/common/column-control/stories/NsColumnControl.stories.tsx +0 -65
- package/src/common/column-control/stories/NsFlexColumns.stories.tsx +0 -66
- package/src/common/column-control/stories/NsGridColumns.stories.tsx +0 -75
- package/src/common/column-control/stories/common.tsx +0 -14
- package/src/common/column-control/styled/StyledFlex.tsx +0 -46
- package/src/common/column-control/styled/StyledGrid.tsx +0 -41
- package/src/common/column-control/styled/common.ts +0 -27
- package/src/common/column-control/types.d.ts +0 -46
- package/src/common/column-control/utils.ts +0 -66
- package/src/common/common.types.d.ts +0 -21
- package/src/common/dropdown/NsDropdown.spec.tsx +0 -126
- package/src/common/dropdown/NsDropdown.styled.tsx +0 -66
- package/src/common/dropdown/NsDropdown.tsx +0 -94
- package/src/common/dropdown/NsDropdownOption.tsx +0 -13
- package/src/common/dropdown/index.ts +0 -3
- package/src/common/dropdown/stories/NsDropdown.stories.tsx +0 -67
- package/src/common/dropdown/stories/NsDropdownCountry.stories.tsx +0 -64
- package/src/common/dropdown/types.d.ts +0 -23
- package/src/common/email-simple/NsEmailSimple.spec.tsx +0 -115
- package/src/common/email-simple/NsEmailSimple.stories.tsx +0 -61
- package/src/common/email-simple/NsEmailSimple.tsx +0 -72
- package/src/common/email-simple/index.ts +0 -2
- package/src/common/email-simple/types.d.ts +0 -14
- package/src/common/flag/NsFlag.spec.tsx +0 -27
- package/src/common/flag/NsFlag.stories.tsx +0 -22
- package/src/common/flag/NsFlag.styled.tsx +0 -73
- package/src/common/flag/NsFlag.tsx +0 -24
- package/src/common/flag/index.ts +0 -2
- package/src/common/flag/types.d.ts +0 -16
- package/src/common/hooks/index.ts +0 -2
- package/src/common/hooks/specs/useWindowSize.spec.tsx +0 -19
- package/src/common/hooks/useAccordionMap.tsx +0 -39
- package/src/common/hooks/useOnClickOutside.tsx +0 -25
- package/src/common/hooks/useWindowSize.tsx +0 -30
- package/src/common/icon/NsIcon.spec.tsx +0 -51
- package/src/common/icon/NsIcon.stories.tsx +0 -77
- package/src/common/icon/NsIcon.styled.tsx +0 -27
- package/src/common/icon/NsIcon.tsx +0 -44
- package/src/common/icon/NsIconVariants.ts +0 -56
- package/src/common/icon/icons/AlertErrorIcon.tsx +0 -48
- package/src/common/icon/icons/ArrowDown.tsx +0 -23
- package/src/common/icon/icons/ArrowLeft.tsx +0 -38
- package/src/common/icon/icons/ArrowRight.tsx +0 -39
- package/src/common/icon/icons/ArrowUp.tsx +0 -20
- package/src/common/icon/icons/Cart.tsx +0 -23
- package/src/common/icon/icons/CartBadge.tsx +0 -47
- package/src/common/icon/icons/Check.tsx +0 -30
- package/src/common/icon/icons/CheckShield.tsx +0 -24
- package/src/common/icon/icons/CheckVerified.tsx +0 -27
- package/src/common/icon/icons/ChevronRight.tsx +0 -31
- package/src/common/icon/icons/CloseIcon.tsx +0 -27
- package/src/common/icon/icons/ErrorIcon.tsx +0 -30
- package/src/common/icon/icons/HamburgerIcon.tsx +0 -35
- package/src/common/icon/icons/InfoFilled.tsx +0 -21
- package/src/common/icon/icons/InfoOutlined.tsx +0 -42
- package/src/common/icon/icons/RoundedClose.tsx +0 -31
- package/src/common/icon/icons/SearchIcon.tsx +0 -32
- package/src/common/icon/icons/SlashIcon.tsx +0 -22
- package/src/common/icon/icons/SuccessIcon.tsx +0 -40
- package/src/common/icon/icons/TrashIcon.tsx +0 -32
- package/src/common/icon/icons/UserIcon.tsx +0 -37
- package/src/common/icon/icons/UserOutline.tsx +0 -29
- package/src/common/icon/icons/WarningIcon.tsx +0 -48
- package/src/common/icon/icons/error.svg +0 -3
- package/src/common/icon/icons/home.tsx +0 -19
- package/src/common/icon/icons/search.svg +0 -3
- package/src/common/icon/icons/success.svg +0 -10
- package/src/common/icon/icons/trash.svg +0 -3
- package/src/common/icon/index.ts +0 -3
- package/src/common/icon/types.d.ts +0 -53
- package/src/common/image/BynderMedia.spec.tsx +0 -42
- package/src/common/image/BynderMedia.tsx +0 -49
- package/src/common/image/NsImage.spec.tsx +0 -60
- package/src/common/image/NsImage.stories.tsx +0 -46
- package/src/common/image/NsImage.tsx +0 -33
- package/src/common/image/NsNextImage.spec.tsx +0 -10
- package/src/common/image/NsNextImage.stories.tsx +0 -51
- package/src/common/image/NsNextImage.tsx +0 -11
- package/src/common/image/bynder-util.spec.ts +0 -187
- package/src/common/image/bynder-util.ts +0 -98
- package/src/common/image/index.ts +0 -3
- package/src/common/image/types.ts +0 -78
- package/src/common/index.ts +0 -37
- package/src/common/input/InputFieldWrapper.tsx +0 -24
- package/src/common/input/InputWrapper.tsx +0 -82
- package/src/common/input/NsInputField.spec.tsx +0 -25
- package/src/common/input/NsInputField.stories.tsx +0 -61
- package/src/common/input/NsInputField.tsx +0 -125
- package/src/common/input/getAdornmentProps.tsx +0 -50
- package/src/common/input/index.ts +0 -2
- package/src/common/input/types.d.ts +0 -45
- package/src/common/label/NsLabel.spec.tsx +0 -11
- package/src/common/label/NsLabel.stories.tsx +0 -35
- package/src/common/label/NsLabel.tsx +0 -43
- package/src/common/label/index.ts +0 -2
- package/src/common/label/types.d.ts +0 -10
- package/src/common/link/NsLink.spec.tsx +0 -106
- package/src/common/link/NsLink.stories.tsx +0 -55
- package/src/common/link/NsLink.styled.tsx +0 -100
- package/src/common/link/NsLink.tsx +0 -122
- package/src/common/link/index.ts +0 -2
- package/src/common/link/types.d.ts +0 -22
- package/src/common/modal/NsModal.spec.tsx +0 -46
- package/src/common/modal/NsModal.styled.tsx +0 -28
- package/src/common/modal/NsModal.tsx +0 -43
- package/src/common/modal/helper-component/NsModalContentBox.tsx +0 -37
- package/src/common/modal/helper-component/NsModalDefault.tsx +0 -34
- package/src/common/modal/helper-component/NsModalStatus.tsx +0 -17
- package/src/common/modal/helper-component/NsModalStatusIcon.tsx +0 -16
- package/src/common/modal/helper-component/NsModalTitle.tsx +0 -29
- package/src/common/modal/index.ts +0 -2
- package/src/common/modal/model/NsModalVariantMap.tsx +0 -24
- package/src/common/modal/stories/NsModal.stories.tsx +0 -87
- package/src/common/modal/stories/mock.tsx +0 -46
- package/src/common/modal/types.ts +0 -57
- package/src/common/nav-product-card/NsNavProductCard.spec.tsx +0 -22
- package/src/common/nav-product-card/NsNavProductCard.stories.tsx +0 -25
- package/src/common/nav-product-card/NsNavProductCard.styled.tsx +0 -24
- package/src/common/nav-product-card/NsNavProductCard.tsx +0 -27
- package/src/common/nav-product-card/index.ts +0 -2
- package/src/common/nav-product-card/types.d.ts +0 -9
- package/src/common/nav-tab/NavDrawer.tsx +0 -41
- package/src/common/nav-tab/NavTitles.tsx +0 -64
- package/src/common/nav-tab/NsNavTab.spec.tsx +0 -64
- package/src/common/nav-tab/NsNavTab.stories.tsx +0 -36
- package/src/common/nav-tab/NsNavTab.styled.tsx +0 -74
- package/src/common/nav-tab/NsNavTab.tsx +0 -43
- package/src/common/nav-tab/index.ts +0 -2
- package/src/common/nav-tab/types.d.ts +0 -21
- package/src/common/progress/NsProgress.spec.tsx +0 -47
- package/src/common/progress/NsProgress.stories.tsx +0 -45
- package/src/common/progress/NsProgress.styled.tsx +0 -56
- package/src/common/progress/NsProgress.tsx +0 -29
- package/src/common/progress/index.ts +0 -2
- package/src/common/progress/types.d.ts +0 -21
- package/src/common/radiogroup/NsRadioGroup.spec.tsx +0 -63
- package/src/common/radiogroup/NsRadioGroup.stories.tsx +0 -84
- package/src/common/radiogroup/NsRadioGroup.styled.tsx +0 -51
- package/src/common/radiogroup/NsRadioGroup.tsx +0 -65
- package/src/common/radiogroup/index.ts +0 -2
- package/src/common/radiogroup/types.d.ts +0 -19
- package/src/common/search-bar/NsSeachBar.spec.tsx +0 -9
- package/src/common/search-bar/NsSearchBar.tsx +0 -46
- package/src/common/select/DefaultRenderOption.tsx +0 -8
- package/src/common/select/NsSelect.styled.tsx +0 -102
- package/src/common/select/NsSelect.tsx +0 -166
- package/src/common/select/NsSelectOption.tsx +0 -26
- package/src/common/select/constant.ts +0 -30
- package/src/common/select/index.ts +0 -3
- package/src/common/select/specs/NsSelect.spec.tsx +0 -183
- package/src/common/select/specs/NsSelectOption.spec.tsx +0 -32
- package/src/common/select/stories/NsSelect.stories.tsx +0 -89
- package/src/common/select/stories/countries.ts +0 -53
- package/src/common/select/types.d.ts +0 -49
- package/src/common/spinner/NsSpinner.spec.tsx +0 -21
- package/src/common/spinner/NsSpinner.stories.tsx +0 -29
- package/src/common/spinner/NsSpinner.styled.tsx +0 -344
- package/src/common/spinner/NsSpinner.tsx +0 -15
- package/src/common/spinner/icons/Spinner.tsx +0 -163
- package/src/common/spinner/index.ts +0 -2
- package/src/common/spinner/types.ts +0 -5
- package/src/common/table/NsExpandableRow.tsx +0 -62
- package/src/common/table/NsTable.spec.tsx +0 -174
- package/src/common/table/NsTable.stories.tsx +0 -156
- package/src/common/table/NsTable.styled.ts +0 -127
- package/src/common/table/NsTable.tsx +0 -150
- package/src/common/table/NsTableHeader.tsx +0 -54
- package/src/common/table/NsTablePagination.tsx +0 -24
- package/src/common/table/helper.ts +0 -33
- package/src/common/table/index.ts +0 -2
- package/src/common/table/types.d.ts +0 -57
- package/src/common/text-strip/NsTextStrip.spec.tsx +0 -27
- package/src/common/text-strip/NsTextStrip.stories.tsx +0 -61
- package/src/common/text-strip/NsTextStrip.tsx +0 -61
- package/src/common/text-strip/index.ts +0 -2
- package/src/common/text-strip/types.d.ts +0 -16
- package/src/common/toast/Fade.tsx +0 -98
- package/src/common/toast/ToastProvider.tsx +0 -88
- package/src/common/toast/index.ts +0 -3
- package/src/common/toast/shared.ts +0 -124
- package/src/common/toast/specs/Toast.spec.tsx +0 -122
- package/src/common/toast/stories/Toast.stories.tsx +0 -82
- package/src/common/toast/useToast.tsx +0 -65
- package/src/common/typography/GlobalFontInter.tsx +0 -15
- package/src/common/typography/HtmlTagVariantMap.tsx +0 -24
- package/src/common/typography/NsTypography.spec.tsx +0 -37
- package/src/common/typography/NsTypography.stories.tsx +0 -27
- package/src/common/typography/NsTypography.tsx +0 -44
- package/src/common/typography/Typography.styled.tsx +0 -195
- package/src/common/typography/__snapshots__/NsTypography.spec.tsx.snap +0 -22
- package/src/common/typography/index.ts +0 -3
- package/src/common/typography/types.d.ts +0 -37
- package/src/common/util.ts +0 -3
- package/src/common/utility/Show.tsx +0 -13
- package/src/common/utility/index.ts +0 -1
- package/src/common/validations/regex.ts +0 -2
- package/src/common/videos/NsVideo.spec.tsx +0 -26
- package/src/common/videos/NsVideo.stories.tsx +0 -32
- package/src/common/videos/NsVideo.tsx +0 -28
- package/src/common/videos/index.ts +0 -2
- package/src/common/videos/types.d.ts +0 -9
|
@@ -1,174 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import React, { ReactElement } from 'react';
|
|
2
|
-
|
|
3
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
4
|
-
|
|
5
|
-
import { withCenterDecorator } from '../../stories/decorators/withCenterDecorator';
|
|
6
|
-
import { NsIcon } from '../icon';
|
|
7
|
-
import NsTable from './NsTable';
|
|
8
|
-
import { Item } from './types';
|
|
9
|
-
|
|
10
|
-
type ComponentType = typeof NsTable;
|
|
11
|
-
type Story = StoryObj<ComponentType>;
|
|
12
|
-
type MetaStory = Meta<ComponentType>;
|
|
13
|
-
const headers = [
|
|
14
|
-
{
|
|
15
|
-
label: 'Dessert (100g serving)',
|
|
16
|
-
id: 'name',
|
|
17
|
-
numeric: false,
|
|
18
|
-
sortable: false,
|
|
19
|
-
},
|
|
20
|
-
{ label: 'Calories', id: 'calories', numeric: true, sortable: true },
|
|
21
|
-
{ label: 'Fat (g)', id: 'fat', numeric: true, sortable: true },
|
|
22
|
-
{ label: 'Carbs (g)', id: 'carbs', numeric: true, sortable: true },
|
|
23
|
-
{ label: 'Protein (g)', id: 'protein', numeric: true, sortable: true },
|
|
24
|
-
{ label: 'Iron (%)', id: 'iron', numeric: false, sortable: true },
|
|
25
|
-
];
|
|
26
|
-
|
|
27
|
-
const items = [
|
|
28
|
-
{
|
|
29
|
-
name: 'Frozen Yogurt',
|
|
30
|
-
calories: 159,
|
|
31
|
-
fat: 6.0,
|
|
32
|
-
carbs: 24,
|
|
33
|
-
protein: 4.0,
|
|
34
|
-
iron: '1%',
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
name: 'Ice cream sandwich',
|
|
38
|
-
calories: 237,
|
|
39
|
-
fat: 9.0,
|
|
40
|
-
carbs: 37,
|
|
41
|
-
protein: 4.3,
|
|
42
|
-
iron: '1%',
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
name: 'Eclair',
|
|
46
|
-
calories: 262,
|
|
47
|
-
fat: 16.0,
|
|
48
|
-
carbs: 23,
|
|
49
|
-
protein: 6.0,
|
|
50
|
-
iron: '7%',
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
name: 'Cupcake',
|
|
54
|
-
calories: 305,
|
|
55
|
-
fat: 3.7,
|
|
56
|
-
carbs: 67,
|
|
57
|
-
protein: 4.3,
|
|
58
|
-
iron: '8%',
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
name: 'Gingerbread',
|
|
62
|
-
calories: 356,
|
|
63
|
-
fat: 16.0,
|
|
64
|
-
carbs: 49,
|
|
65
|
-
protein: 3.9,
|
|
66
|
-
iron: '16%',
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
name: 'Jelly bean',
|
|
70
|
-
calories: 375,
|
|
71
|
-
fat: 0.0,
|
|
72
|
-
carbs: 94,
|
|
73
|
-
protein: 0.0,
|
|
74
|
-
iron: '0%',
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
name: 'Lollipop',
|
|
78
|
-
calories: 392,
|
|
79
|
-
fat: 0.2,
|
|
80
|
-
carbs: 98,
|
|
81
|
-
protein: 0,
|
|
82
|
-
iron: '2%',
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
name: 'Honeycomb',
|
|
86
|
-
calories: 408,
|
|
87
|
-
fat: 3.2,
|
|
88
|
-
carbs: 87,
|
|
89
|
-
protein: 6.5,
|
|
90
|
-
iron: '45%',
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
name: 'Donut',
|
|
94
|
-
calories: 452,
|
|
95
|
-
fat: 25.0,
|
|
96
|
-
carbs: 51,
|
|
97
|
-
protein: 4.9,
|
|
98
|
-
iron: '22%',
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
name: 'KitKat',
|
|
102
|
-
calories: 518,
|
|
103
|
-
fat: 26.0,
|
|
104
|
-
carbs: 65,
|
|
105
|
-
protein: 7,
|
|
106
|
-
iron: '6%',
|
|
107
|
-
},
|
|
108
|
-
];
|
|
109
|
-
|
|
110
|
-
export default {
|
|
111
|
-
title: 'Components/Data Display/NsTable',
|
|
112
|
-
component: NsTable,
|
|
113
|
-
decorators: [withCenterDecorator],
|
|
114
|
-
argTypes: {
|
|
115
|
-
rows: {
|
|
116
|
-
control: 'select',
|
|
117
|
-
options: [5, 10, 25],
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
args: {
|
|
121
|
-
headers: headers,
|
|
122
|
-
items: items,
|
|
123
|
-
rows: 5,
|
|
124
|
-
itemKey: 'name',
|
|
125
|
-
rowsPerPageOptions: [5, 10, 25],
|
|
126
|
-
isExpandableAll: true,
|
|
127
|
-
showActions: true,
|
|
128
|
-
showExpandedContent: true,
|
|
129
|
-
loading: false,
|
|
130
|
-
expandableContent: (selectedItem: Item, index: number): ReactElement => {
|
|
131
|
-
return (
|
|
132
|
-
<div key={index}>
|
|
133
|
-
<p>
|
|
134
|
-
Data: {selectedItem.name} , {selectedItem.calories}
|
|
135
|
-
</p>
|
|
136
|
-
<p>Index: {index}</p>
|
|
137
|
-
<p>Expandable: True</p>
|
|
138
|
-
</div>
|
|
139
|
-
);
|
|
140
|
-
},
|
|
141
|
-
actionClick: (row: Item): ReactElement => {
|
|
142
|
-
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
143
|
-
event.stopPropagation();
|
|
144
|
-
console.log(row);
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
return (
|
|
148
|
-
<button onClick={handleClick}>
|
|
149
|
-
<NsIcon name="cart" size="medium" />
|
|
150
|
-
</button>
|
|
151
|
-
);
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
} as MetaStory;
|
|
155
|
-
|
|
156
|
-
export const NasTable: Story = {};
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
// TODO: const ariel = #f8e9f8;
|
|
2
|
-
|
|
3
|
-
import { styled, ColorUtils } from '@nuskin/foundation-theme';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
Table,
|
|
7
|
-
TableContainer,
|
|
8
|
-
TableSortLabel,
|
|
9
|
-
TableRow,
|
|
10
|
-
TableCell
|
|
11
|
-
} from '@mui/material';
|
|
12
|
-
import Pagination from '@mui/material/Pagination';
|
|
13
|
-
import LinearProgress from '@mui/material/LinearProgress';
|
|
14
|
-
|
|
15
|
-
const { color } = ColorUtils;
|
|
16
|
-
|
|
17
|
-
export const StyledTableContainer= styled(TableContainer)`
|
|
18
|
-
background-color: ${color('primary', 'white')};
|
|
19
|
-
`;
|
|
20
|
-
|
|
21
|
-
export const StyledTable = styled(Table)`
|
|
22
|
-
size: medium;
|
|
23
|
-
`;
|
|
24
|
-
|
|
25
|
-
export const StyledTableSortLabel = styled(TableSortLabel)`
|
|
26
|
-
font-size: 12px;
|
|
27
|
-
text-transform: uppercase;
|
|
28
|
-
font-weight: 600;
|
|
29
|
-
line-height: 16px;
|
|
30
|
-
letter-spacing: 0.05em;
|
|
31
|
-
color: rgba(0, 0, 0, 0.54);
|
|
32
|
-
&:hover {
|
|
33
|
-
color: ${color('primary', 'black')};
|
|
34
|
-
}
|
|
35
|
-
`;
|
|
36
|
-
|
|
37
|
-
export const StyledTableLabel = styled.span`
|
|
38
|
-
font-size: 12px;
|
|
39
|
-
text-transform: uppercase;
|
|
40
|
-
font-weight: 700;
|
|
41
|
-
line-height: 16px;
|
|
42
|
-
letter-spacing: 0.05em;
|
|
43
|
-
color: rgba(0, 0, 0, 0.54);
|
|
44
|
-
&:hover {
|
|
45
|
-
cursor: default;
|
|
46
|
-
}
|
|
47
|
-
`;
|
|
48
|
-
|
|
49
|
-
export const StyledPageComponent = styled.div`
|
|
50
|
-
background-color: ${color('primary', 'white')};
|
|
51
|
-
`;
|
|
52
|
-
|
|
53
|
-
export const StyledEmptyRow = styled(TableRow)<{emptyRows: number}>`
|
|
54
|
-
height: ${({ emptyRows }) => 48 * emptyRows}px;
|
|
55
|
-
`;
|
|
56
|
-
|
|
57
|
-
// [Todo-Arun] - Move f8e9f8 to custom color palette
|
|
58
|
-
export const StyledTableRow = styled(TableRow)`
|
|
59
|
-
&:hover {
|
|
60
|
-
background-color: #f8e9f8 !important;
|
|
61
|
-
}
|
|
62
|
-
`;
|
|
63
|
-
|
|
64
|
-
export const StyledTableLastCell = styled(TableCell)`
|
|
65
|
-
display: flex;
|
|
66
|
-
height: 49px;
|
|
67
|
-
align-items: center;
|
|
68
|
-
padding: 0 24px;
|
|
69
|
-
margin-bottom: -0.5px;
|
|
70
|
-
|
|
71
|
-
.action {
|
|
72
|
-
margin-left: auto;
|
|
73
|
-
}
|
|
74
|
-
`;
|
|
75
|
-
|
|
76
|
-
export const StyledOriginalTableCell = styled(TableCell)`
|
|
77
|
-
height: 48px;
|
|
78
|
-
padding: 0 24px;
|
|
79
|
-
`;
|
|
80
|
-
|
|
81
|
-
export const StyledPagination = styled(Pagination)`
|
|
82
|
-
.MuiPagination-ul {
|
|
83
|
-
display: flex;
|
|
84
|
-
justify-content: flex-end;
|
|
85
|
-
background-color: ${color('primary', 'white')};
|
|
86
|
-
}
|
|
87
|
-
& .MuiPaginationItem-previousNext {
|
|
88
|
-
margin: 0.3rem 10px;
|
|
89
|
-
width: 2rem;
|
|
90
|
-
height: 2rem;
|
|
91
|
-
border-radius: 4px;
|
|
92
|
-
}
|
|
93
|
-
& .MuiPaginationItem-page {
|
|
94
|
-
border-radius: 0px;
|
|
95
|
-
width: auto;
|
|
96
|
-
min-width: 34px;
|
|
97
|
-
padding: 0 5px;
|
|
98
|
-
font-size: 16px;
|
|
99
|
-
line-height: 17px;
|
|
100
|
-
border-color: ${color('primary', 'black')};
|
|
101
|
-
}
|
|
102
|
-
& .MuiPaginationItem-root.Mui-selected {
|
|
103
|
-
background-color: ${color('primary', 'black')};
|
|
104
|
-
color: ${color('primary', 'white')};
|
|
105
|
-
}
|
|
106
|
-
`;
|
|
107
|
-
|
|
108
|
-
export const StyledExpandCell= styled(TableCell)`
|
|
109
|
-
padding-bottom: 0;
|
|
110
|
-
padding-top: 0;
|
|
111
|
-
&.remove {
|
|
112
|
-
border: 0;
|
|
113
|
-
}
|
|
114
|
-
`;
|
|
115
|
-
|
|
116
|
-
export const StyledProgressCell = styled(TableCell)`
|
|
117
|
-
padding: 0;
|
|
118
|
-
border: 0;
|
|
119
|
-
`;
|
|
120
|
-
|
|
121
|
-
export const StyledLinearProgress = styled(LinearProgress)`
|
|
122
|
-
&& {
|
|
123
|
-
width: 100%;
|
|
124
|
-
height: 7px;
|
|
125
|
-
border-radius: 4px;
|
|
126
|
-
}
|
|
127
|
-
`;
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
ReactElement,
|
|
3
|
-
useEffect,
|
|
4
|
-
useState,
|
|
5
|
-
} from 'react';
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
TableBody,
|
|
9
|
-
TableCell,
|
|
10
|
-
TableRow,
|
|
11
|
-
} from '@mui/material';
|
|
12
|
-
import Grid from '@mui/material/Grid';
|
|
13
|
-
|
|
14
|
-
import {
|
|
15
|
-
getComparator,
|
|
16
|
-
stableSort,
|
|
17
|
-
} from './helper';
|
|
18
|
-
import ExpandableRow from './NsExpandableRow';
|
|
19
|
-
import {
|
|
20
|
-
StyledEmptyRow,
|
|
21
|
-
StyledLinearProgress,
|
|
22
|
-
StyledProgressCell,
|
|
23
|
-
StyledTable,
|
|
24
|
-
StyledTableContainer,
|
|
25
|
-
} from './NsTable.styled';
|
|
26
|
-
import NsTableHeader from './NsTableHeader';
|
|
27
|
-
import NsTablePagination from './NsTablePagination';
|
|
28
|
-
import type {
|
|
29
|
-
Item,
|
|
30
|
-
NsTableProps,
|
|
31
|
-
OrderType,
|
|
32
|
-
} from './types';
|
|
33
|
-
|
|
34
|
-
export default function NsTable({
|
|
35
|
-
headers = [],
|
|
36
|
-
items = [],
|
|
37
|
-
rows,
|
|
38
|
-
rowsPerPageOptions,
|
|
39
|
-
itemKey,
|
|
40
|
-
expandableContent,
|
|
41
|
-
actionClick,
|
|
42
|
-
showActions = true,
|
|
43
|
-
showExpandedContent = true,
|
|
44
|
-
loading = false,
|
|
45
|
-
isExpandableAll = false,
|
|
46
|
-
}: NsTableProps): ReactElement {
|
|
47
|
-
const [order, setOrder] = useState<OrderType>('asc');
|
|
48
|
-
const [orderBy, setOrderBy] = useState<keyof Item>(itemKey);
|
|
49
|
-
const [expandMap, setExpandMap] = useState<{ [key: number]: boolean }>({});
|
|
50
|
-
const [page, setPage] = useState(0);
|
|
51
|
-
const [rowsPerPage, setRowsPerPage] = useState(rows);
|
|
52
|
-
const itemKeyList = React.useMemo(() => {
|
|
53
|
-
return items.length ? Object.keys(items[0]) : [];
|
|
54
|
-
}, [items]);
|
|
55
|
-
|
|
56
|
-
useEffect(() => {
|
|
57
|
-
setRowsPerPage(rows);
|
|
58
|
-
setPage(0);
|
|
59
|
-
}, [rows]);
|
|
60
|
-
|
|
61
|
-
const handleRequestSort = (event: React.MouseEvent<unknown>, property: keyof Item) => {
|
|
62
|
-
const isAsc = orderBy === property && order === 'asc';
|
|
63
|
-
setOrder(isAsc ? 'desc' : 'asc');
|
|
64
|
-
setOrderBy(property);
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const handleClick = (index: number) => {
|
|
68
|
-
if (isExpandableAll) {
|
|
69
|
-
setExpandMap((prevState) => ({ ...prevState, [index]: !prevState[index] }));
|
|
70
|
-
} else {
|
|
71
|
-
setExpandMap({ [index]: !expandMap[index] });
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
const handleChangePage = (newPage: number) => {
|
|
76
|
-
setPage(newPage - 1);
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const emptyRows = getEmptyRows();
|
|
80
|
-
|
|
81
|
-
const visibleRows = React.useMemo(
|
|
82
|
-
() =>
|
|
83
|
-
stableSort(items, getComparator(order, orderBy)).slice(
|
|
84
|
-
page * rowsPerPage,
|
|
85
|
-
page * rowsPerPage + rowsPerPage
|
|
86
|
-
),
|
|
87
|
-
[order, orderBy, page, rowsPerPage, items]
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
return (
|
|
91
|
-
<div>
|
|
92
|
-
<StyledTableContainer>
|
|
93
|
-
<StyledTable>
|
|
94
|
-
<NsTableHeader
|
|
95
|
-
headCells={headers}
|
|
96
|
-
order={order}
|
|
97
|
-
orderBy={orderBy as string}
|
|
98
|
-
onRequestSort={handleRequestSort}
|
|
99
|
-
rowCount={items.length}
|
|
100
|
-
/>
|
|
101
|
-
<TableBody>
|
|
102
|
-
{loading ? (
|
|
103
|
-
<TableRow>
|
|
104
|
-
<StyledProgressCell colSpan={itemKeyList.length}>
|
|
105
|
-
<Grid container>
|
|
106
|
-
<Grid item xs={12}>
|
|
107
|
-
<StyledLinearProgress />
|
|
108
|
-
</Grid>
|
|
109
|
-
</Grid>
|
|
110
|
-
</StyledProgressCell>
|
|
111
|
-
</TableRow>
|
|
112
|
-
) : null}
|
|
113
|
-
{visibleRows.map((row, index) => {
|
|
114
|
-
return (
|
|
115
|
-
<ExpandableRow
|
|
116
|
-
key={index}
|
|
117
|
-
expandableContent={expandableContent}
|
|
118
|
-
isExpand={expandMap[index]}
|
|
119
|
-
handleClick={handleClick}
|
|
120
|
-
row={row}
|
|
121
|
-
index={index}
|
|
122
|
-
itemKeyList={itemKeyList}
|
|
123
|
-
actionClick={actionClick}
|
|
124
|
-
showActions={showActions}
|
|
125
|
-
showExpandedContent={showExpandedContent}
|
|
126
|
-
/>
|
|
127
|
-
);
|
|
128
|
-
})}
|
|
129
|
-
{emptyRows > 0 ? (
|
|
130
|
-
<StyledEmptyRow emptyRows={emptyRows}>
|
|
131
|
-
<TableCell colSpan={itemKeyList.length} />
|
|
132
|
-
</StyledEmptyRow>
|
|
133
|
-
) : null}
|
|
134
|
-
</TableBody>
|
|
135
|
-
</StyledTable>
|
|
136
|
-
</StyledTableContainer>
|
|
137
|
-
<NsTablePagination
|
|
138
|
-
rowsPerPageOptions={rowsPerPageOptions}
|
|
139
|
-
count={items.length}
|
|
140
|
-
rowsPerPage={rowsPerPage}
|
|
141
|
-
page={page + 1}
|
|
142
|
-
onPageChange={handleChangePage}
|
|
143
|
-
/>
|
|
144
|
-
</div>
|
|
145
|
-
);
|
|
146
|
-
|
|
147
|
-
function getEmptyRows() {
|
|
148
|
-
return page > 0 ? Math.max(0, (1 + page) * rowsPerPage - items.length) : 0;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import React, { ReactElement } from 'react';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
Box,
|
|
5
|
-
TableCell,
|
|
6
|
-
TableHead,
|
|
7
|
-
TableRow,
|
|
8
|
-
} from '@mui/material';
|
|
9
|
-
import { visuallyHidden } from '@mui/utils';
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
StyledTableLabel,
|
|
13
|
-
StyledTableSortLabel,
|
|
14
|
-
} from './NsTable.styled';
|
|
15
|
-
import type {
|
|
16
|
-
Item,
|
|
17
|
-
NsTableHeaderProps,
|
|
18
|
-
} from './types';
|
|
19
|
-
|
|
20
|
-
export default function NsTableHeader(props: NsTableHeaderProps): ReactElement {
|
|
21
|
-
const { order, orderBy, headCells, onRequestSort } = props;
|
|
22
|
-
const createSortHandler = (property: keyof Item) => (event: React.MouseEvent<unknown>) => {
|
|
23
|
-
onRequestSort(event, property);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<TableHead>
|
|
28
|
-
<TableRow>
|
|
29
|
-
{headCells.map((headCell) =>
|
|
30
|
-
headCell.sortable ? (
|
|
31
|
-
<TableCell key={headCell.id} sortDirection={orderBy === headCell.id ? order : false}>
|
|
32
|
-
<StyledTableSortLabel
|
|
33
|
-
active={orderBy === headCell.id}
|
|
34
|
-
direction={orderBy === headCell.id ? order : 'asc'}
|
|
35
|
-
onClick={createSortHandler(headCell.id)}
|
|
36
|
-
>
|
|
37
|
-
{headCell.label}
|
|
38
|
-
{orderBy === headCell.id ? (
|
|
39
|
-
<Box component="span" sx={visuallyHidden}>
|
|
40
|
-
{order === 'desc' ? 'sorted descending' : 'sorted ascending'}
|
|
41
|
-
</Box>
|
|
42
|
-
) : null}
|
|
43
|
-
</StyledTableSortLabel>
|
|
44
|
-
</TableCell>
|
|
45
|
-
) : (
|
|
46
|
-
<TableCell key={headCell.id} sortDirection={false}>
|
|
47
|
-
<StyledTableLabel>{headCell.label}</StyledTableLabel>
|
|
48
|
-
</TableCell>
|
|
49
|
-
)
|
|
50
|
-
)}
|
|
51
|
-
</TableRow>
|
|
52
|
-
</TableHead>
|
|
53
|
-
);
|
|
54
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React, { ReactElement } from 'react';
|
|
2
|
-
|
|
3
|
-
import { StyledPagination } from './NsTable.styled';
|
|
4
|
-
import type { NsTablePaginationProps } from './types';
|
|
5
|
-
|
|
6
|
-
export default function NsTablePagination(props: NsTablePaginationProps): ReactElement {
|
|
7
|
-
const { count, rowsPerPage, page, onPageChange } = props;
|
|
8
|
-
|
|
9
|
-
const totalPage = Math.ceil(count / rowsPerPage);
|
|
10
|
-
const handleChange = (event: React.ChangeEvent<unknown>, value: number) => {
|
|
11
|
-
onPageChange(value);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<StyledPagination
|
|
16
|
-
count={totalPage}
|
|
17
|
-
page={page}
|
|
18
|
-
variant="outlined"
|
|
19
|
-
onChange={handleChange}
|
|
20
|
-
shape="rounded"
|
|
21
|
-
color="primary"
|
|
22
|
-
/>
|
|
23
|
-
);
|
|
24
|
-
}
|