@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
package/package.json
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuskin/foundation-ui-components",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "It is a foundation library written in react, that provides common components to all UI pages",
|
|
5
|
-
"
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"module": "dist/index.esm.js",
|
|
6
8
|
"repository": {
|
|
7
9
|
"type": "git",
|
|
8
10
|
"url": "git@code.tls.nuskin.io:ns-am/content-foundation/foundation-ui-components.git"
|
|
@@ -26,13 +28,14 @@
|
|
|
26
28
|
"build-prod": "yarn build-storybook --mode=production",
|
|
27
29
|
"build-test": "yarn build-storybook",
|
|
28
30
|
"build": "next build",
|
|
31
|
+
"build:package": "tsup",
|
|
29
32
|
"dev": "next dev",
|
|
30
33
|
"export": "next export",
|
|
31
34
|
"lint": "next lint",
|
|
32
35
|
"storybook": "storybook dev -p 6007",
|
|
33
36
|
"sb": "yarn storybook",
|
|
34
37
|
"start": "next start",
|
|
35
|
-
"test": "
|
|
38
|
+
"test": "jest --coverage",
|
|
36
39
|
"test:pattern": "jest --coverage --testNamePattern accordion/*",
|
|
37
40
|
"test:watch": "jest --watch",
|
|
38
41
|
"test:update-snapshot": "jest -u",
|
|
@@ -46,20 +49,17 @@
|
|
|
46
49
|
"@mui/icons-material": "^5.14.16",
|
|
47
50
|
"@mui/material": "5.14.16",
|
|
48
51
|
"@mui/utils": "5.14.16",
|
|
49
|
-
"@nuskin/foundation-theme": "1.6.0",
|
|
50
52
|
"@types/react": "^18.2.0",
|
|
51
53
|
"@types/react-dom": "^18.2.0",
|
|
52
54
|
"cliui": "^8.0.1",
|
|
53
55
|
"framer-motion": "^10.16.4",
|
|
54
|
-
"next": "13.5.6",
|
|
55
56
|
"notistack": "^3.0.1",
|
|
56
|
-
"react": "^18.2.0",
|
|
57
|
-
"react-dom": "^18.2.0",
|
|
58
57
|
"react-material-ui-carousel": "^3.4.2",
|
|
59
58
|
"react-slick": "^0.29.0",
|
|
60
59
|
"react-window": "^1.8.10",
|
|
61
60
|
"slick-carousel": "^1.8.1",
|
|
62
|
-
"
|
|
61
|
+
"react": "^18.0.0",
|
|
62
|
+
"react-dom": "^18.0.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@babel/core": "^7.23.2",
|
|
@@ -67,7 +67,9 @@
|
|
|
67
67
|
"@babel/preset-react": "^7.22.15",
|
|
68
68
|
"@babel/preset-typescript": "^7.23.2",
|
|
69
69
|
"@emotion/jest": "^11.11.0",
|
|
70
|
+
"next": "14.2.26",
|
|
70
71
|
"@nuskin/eslint-config": "^1.0.0-setup.1",
|
|
72
|
+
"@nuskin/foundation-theme": "1.7.0",
|
|
71
73
|
"@storybook/addon-actions": "^7.5.1",
|
|
72
74
|
"@storybook/addon-essentials": "^7.5.1",
|
|
73
75
|
"@storybook/addon-interactions": "^7.5.1",
|
|
@@ -100,10 +102,31 @@
|
|
|
100
102
|
"eslint-plugin-storybook": "^0.6.15",
|
|
101
103
|
"jest": "^29.7.0",
|
|
102
104
|
"jest-environment-jsdom": "^29.7.0",
|
|
103
|
-
"storybook": "^7.5.1"
|
|
105
|
+
"storybook": "^7.5.1",
|
|
106
|
+
"tsup": "8.3.6",
|
|
107
|
+
"typescript": "^5.4.2"
|
|
108
|
+
},
|
|
109
|
+
"peerDependencies": {
|
|
110
|
+
"@nuskin/foundation-theme": "1.7.0",
|
|
111
|
+
"react": "^18.2.0",
|
|
112
|
+
"react-dom": "^18.2.0",
|
|
113
|
+
"typescript": "^5.4.2"
|
|
104
114
|
},
|
|
105
115
|
"files": [
|
|
106
|
-
"
|
|
116
|
+
"dist",
|
|
117
|
+
"README.md",
|
|
118
|
+
"package.json"
|
|
107
119
|
],
|
|
120
|
+
"resolutions": {
|
|
121
|
+
"@emotion/react": "11.11.4",
|
|
122
|
+
"micromatch": "4.0.8",
|
|
123
|
+
"next": "14.2.26",
|
|
124
|
+
"axios": "1.8.2",
|
|
125
|
+
"image-size": "1.2.1",
|
|
126
|
+
"@babel/runtime": "7.26.10",
|
|
127
|
+
"@babel/helpers": "7.26.10",
|
|
128
|
+
"esbuild": "0.25.0",
|
|
129
|
+
"nanoid": "3.3.8"
|
|
130
|
+
},
|
|
108
131
|
"readme": "./README.md"
|
|
109
132
|
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import React, { ReactElement, useMemo } from 'react';
|
|
2
|
-
|
|
3
|
-
import { AccordionItem, NsAccordionItem, NsAccordionProps, NsTypography, useAccordionMap } from '../';
|
|
4
|
-
import { StyledAccordionWrapper } from './ToggleSection.styled';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* NsAccordion can be used to show a list of items with title and body
|
|
8
|
-
* it accepts a `boolean` prop `allowMultipleExpanded` which when true,
|
|
9
|
-
* multiple sections of accordion can remain open at a time
|
|
10
|
-
*
|
|
11
|
-
* we can define certain section to remain open by default using `isDefaultOpen` in the
|
|
12
|
-
* items
|
|
13
|
-
* if there are multiple items available for default open, but `allowMultipleExpanded`
|
|
14
|
-
* is false then only first item of default open is made open
|
|
15
|
-
*/
|
|
16
|
-
const createKey = (item: AccordionItem, index: number) => item?.id + index;
|
|
17
|
-
const NsAccordion = ({
|
|
18
|
-
allowMultipleExpanded,
|
|
19
|
-
invert,
|
|
20
|
-
level,
|
|
21
|
-
variant,
|
|
22
|
-
items,
|
|
23
|
-
headerTypographyVariant,
|
|
24
|
-
closedIconName,
|
|
25
|
-
openedIconName,
|
|
26
|
-
additionalProps,
|
|
27
|
-
isChild = false,
|
|
28
|
-
showEndIconWhenEmpty = false,
|
|
29
|
-
}: NsAccordionProps): ReactElement => {
|
|
30
|
-
const defaultOpenIds = useMemo(() => {
|
|
31
|
-
return items
|
|
32
|
-
?.map?.((content, index) => (content?.isDefaultOpen ? createKey(content, index) : null))
|
|
33
|
-
.filter((e) => e !== null) as string[];
|
|
34
|
-
}, [items]);
|
|
35
|
-
|
|
36
|
-
const { toggleOpen, itemStateMap } = useAccordionMap({ allowMultipleExpanded, defaultOpenIds });
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<StyledAccordionWrapper
|
|
40
|
-
variant={variant}
|
|
41
|
-
className="ns-accordion"
|
|
42
|
-
data-testid={additionalProps?.testid ?? 'ns-accordion-testid'}
|
|
43
|
-
>
|
|
44
|
-
{items?.map?.((item, index) => {
|
|
45
|
-
const key = createKey(item, index);
|
|
46
|
-
const isOpen = itemStateMap[key] ?? false;
|
|
47
|
-
return (
|
|
48
|
-
<NsAccordionItem
|
|
49
|
-
allowMultipleExpanded={item.allowMultipleExpanded}
|
|
50
|
-
type={item.type}
|
|
51
|
-
closedIconName={closedIconName}
|
|
52
|
-
content={item.content}
|
|
53
|
-
headerTypographyVariant={headerTypographyVariant}
|
|
54
|
-
invert={invert}
|
|
55
|
-
isOpen={isOpen}
|
|
56
|
-
isChild={isChild}
|
|
57
|
-
key={key}
|
|
58
|
-
level={level}
|
|
59
|
-
openedIconName={openedIconName}
|
|
60
|
-
startIcon={item.icon}
|
|
61
|
-
toggleOpen={() => toggleOpen(createKey(item, index))}
|
|
62
|
-
title={
|
|
63
|
-
<NsTypography
|
|
64
|
-
weight="bold"
|
|
65
|
-
variant="h6"
|
|
66
|
-
className="nsa-item-title"
|
|
67
|
-
additionalProps={{ ...item.$?.item_title }}
|
|
68
|
-
>
|
|
69
|
-
{item.title}
|
|
70
|
-
</NsTypography>
|
|
71
|
-
}
|
|
72
|
-
cslp={{ content: item.$?.rte ?? { 'data-cslp': '' } }}
|
|
73
|
-
variant={variant}
|
|
74
|
-
showEndIconWhenEmpty={showEndIconWhenEmpty}
|
|
75
|
-
/>
|
|
76
|
-
);
|
|
77
|
-
})}
|
|
78
|
-
</StyledAccordionWrapper>
|
|
79
|
-
);
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export default NsAccordion;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
|
|
3
|
-
import { styled } from '@nuskin/foundation-theme';
|
|
4
|
-
|
|
5
|
-
import { AccordionVariant, AccordionVariantType, NsAccordionHeaderProps, NsIcon, NsIconProps, NsTypography } from '../';
|
|
6
|
-
import { isValidIconName } from '../icon/NsIconVariants';
|
|
7
|
-
import { getAccordionColor } from './colorMap';
|
|
8
|
-
|
|
9
|
-
type StyledType = { variant: AccordionVariantType; invert: boolean };
|
|
10
|
-
|
|
11
|
-
const StyledHeader = styled('header')<StyledType>(({ theme, variant, invert }) => {
|
|
12
|
-
const { headBg, headText } = getAccordionColor({ theme, variant, invert, keys: ['headBg', 'headText'] });
|
|
13
|
-
let borderBottom = 'none';
|
|
14
|
-
if (variant === AccordionVariant.Compact) {
|
|
15
|
-
borderBottom = '1px solid rgb(0,0,0,0.125)';
|
|
16
|
-
}
|
|
17
|
-
return {
|
|
18
|
-
backgroundColor: headBg,
|
|
19
|
-
color: headText,
|
|
20
|
-
cursor: 'pointer',
|
|
21
|
-
display: 'grid',
|
|
22
|
-
gap: '4px',
|
|
23
|
-
gridTemplateColumns: 'auto 1fr 24px',
|
|
24
|
-
padding: '9px 16px',
|
|
25
|
-
borderBottom,
|
|
26
|
-
'.nsa-item-title': {
|
|
27
|
-
color: headText,
|
|
28
|
-
},
|
|
29
|
-
} as any;
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* NsAccordionHeader is primarily used by NsToggleSection and NsAccordionItem
|
|
34
|
-
* as a header, so it accepts `title` , `isOpen` and `onClick`
|
|
35
|
-
*/
|
|
36
|
-
const NsAccordionHeader = ({
|
|
37
|
-
title,
|
|
38
|
-
onClick,
|
|
39
|
-
isOpen,
|
|
40
|
-
additionalProps,
|
|
41
|
-
openedIconName,
|
|
42
|
-
closedIconName,
|
|
43
|
-
variant,
|
|
44
|
-
headerTypographyVariant,
|
|
45
|
-
startIcon,
|
|
46
|
-
invert,
|
|
47
|
-
cslp,
|
|
48
|
-
showEndIconWhenEmpty,
|
|
49
|
-
content,
|
|
50
|
-
}: NsAccordionHeaderProps): ReactElement => {
|
|
51
|
-
return (
|
|
52
|
-
<StyledHeader
|
|
53
|
-
invert={invert}
|
|
54
|
-
role="button"
|
|
55
|
-
aria-expanded={isOpen ? 'true' : 'false'}
|
|
56
|
-
className={`section-header ${isOpen ? 'expanded' : ''} ${additionalProps?.className ?? ''}`}
|
|
57
|
-
onClick={onClick}
|
|
58
|
-
variant={variant}
|
|
59
|
-
>
|
|
60
|
-
<HeaderIcon {...startIcon} invert={invert} />
|
|
61
|
-
{typeof title === 'string' ? (
|
|
62
|
-
<NsTypography variant={headerTypographyVariant ?? 'h4'} weight="bold" {...(cslp?.header ?? {})}>
|
|
63
|
-
{title}
|
|
64
|
-
</NsTypography>
|
|
65
|
-
) : (
|
|
66
|
-
title
|
|
67
|
-
)}
|
|
68
|
-
{content || showEndIconWhenEmpty ? (
|
|
69
|
-
<span className="header-icon">
|
|
70
|
-
<NsIcon
|
|
71
|
-
{...(invert ? { color: 'secondary' } : {})}
|
|
72
|
-
name={isOpen ? openedIconName ?? 'arrowUp' : closedIconName ?? 'arrowDown'}
|
|
73
|
-
/>
|
|
74
|
-
</span>
|
|
75
|
-
) : null}
|
|
76
|
-
</StyledHeader>
|
|
77
|
-
);
|
|
78
|
-
};
|
|
79
|
-
export default NsAccordionHeader;
|
|
80
|
-
|
|
81
|
-
const HeaderIcon = (props: Partial<NsIconProps> & { invert: boolean }): ReactElement => {
|
|
82
|
-
const hasIcon = props?.name ? isValidIconName(props?.name) : false;
|
|
83
|
-
if (!hasIcon) return <span />;
|
|
84
|
-
return <NsIcon {...(props as NsIconProps)} {...(props.invert ? { color: 'secondary' } : {})} />;
|
|
85
|
-
};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import React, { ReactElement } from 'react';
|
|
2
|
-
|
|
3
|
-
import { NsAccordionItemProps, NsCollapse } from '../';
|
|
4
|
-
import NsAccordionHeader from './NsAccordionHeader';
|
|
5
|
-
import { StyledToggleSection } from './ToggleSection.styled';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* this component is used by accordion to pass title
|
|
9
|
-
* and content
|
|
10
|
-
* cslp:{header:CslpTag, content:CslpTag}
|
|
11
|
-
*/
|
|
12
|
-
const NsAccordionItem = ({
|
|
13
|
-
isOpen,
|
|
14
|
-
isChild,
|
|
15
|
-
toggleOpen,
|
|
16
|
-
title,
|
|
17
|
-
content,
|
|
18
|
-
variant,
|
|
19
|
-
headerTypographyVariant,
|
|
20
|
-
closedIconName,
|
|
21
|
-
openedIconName,
|
|
22
|
-
startIcon,
|
|
23
|
-
level,
|
|
24
|
-
additionalProps,
|
|
25
|
-
invert,
|
|
26
|
-
type,
|
|
27
|
-
cslp,
|
|
28
|
-
allowMultipleExpanded,
|
|
29
|
-
showEndIconWhenEmpty,
|
|
30
|
-
}: NsAccordionItemProps): ReactElement => {
|
|
31
|
-
return (
|
|
32
|
-
<StyledToggleSection variant={variant}>
|
|
33
|
-
<NsAccordionHeader
|
|
34
|
-
invert={invert}
|
|
35
|
-
additionalProps={{ ...additionalProps, className: 'accordion-section ' + additionalProps?.className }}
|
|
36
|
-
closedIconName={closedIconName}
|
|
37
|
-
headerTypographyVariant={headerTypographyVariant}
|
|
38
|
-
isOpen={isOpen}
|
|
39
|
-
openedIconName={openedIconName}
|
|
40
|
-
onClick={toggleOpen}
|
|
41
|
-
title={title}
|
|
42
|
-
variant={variant}
|
|
43
|
-
startIcon={startIcon}
|
|
44
|
-
cslp={cslp}
|
|
45
|
-
showEndIconWhenEmpty={showEndIconWhenEmpty}
|
|
46
|
-
content={content}
|
|
47
|
-
/>
|
|
48
|
-
{content || showEndIconWhenEmpty ? (
|
|
49
|
-
<NsCollapse
|
|
50
|
-
type={type}
|
|
51
|
-
isChild={isChild}
|
|
52
|
-
isOpen={isOpen}
|
|
53
|
-
variant={variant}
|
|
54
|
-
level={level}
|
|
55
|
-
invert={invert}
|
|
56
|
-
content={content}
|
|
57
|
-
cslp={cslp}
|
|
58
|
-
allowMultipleExpanded={allowMultipleExpanded}
|
|
59
|
-
/>
|
|
60
|
-
) : null}
|
|
61
|
-
</StyledToggleSection>
|
|
62
|
-
);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export default NsAccordionItem;
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isValidElement,
|
|
3
|
-
ReactElement,
|
|
4
|
-
useMemo,
|
|
5
|
-
} from 'react';
|
|
6
|
-
|
|
7
|
-
import { styled } from '@nuskin/foundation-theme';
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
AccordionContentTypeObject,
|
|
11
|
-
AccordionItem,
|
|
12
|
-
AccordionVariant,
|
|
13
|
-
AccordionVariantType,
|
|
14
|
-
NsAccordion,
|
|
15
|
-
NsCollapseProps,
|
|
16
|
-
NsTypography,
|
|
17
|
-
} from '../';
|
|
18
|
-
import { getAccordionColor } from './colorMap';
|
|
19
|
-
|
|
20
|
-
const getLevelOffset = (level: number) => {
|
|
21
|
-
return level > 1 ? (level - 1) * 16 : 0;
|
|
22
|
-
};
|
|
23
|
-
type CollapsePropsType = { variant: AccordionVariantType; level: number; invert: boolean; isChild: boolean };
|
|
24
|
-
|
|
25
|
-
export const StyledCollapse = styled('section')<CollapsePropsType>(({ theme, variant, level, invert, isChild }) => {
|
|
26
|
-
const { contentBg, contentText } = getAccordionColor({
|
|
27
|
-
theme,
|
|
28
|
-
invert,
|
|
29
|
-
variant,
|
|
30
|
-
keys: ['contentBg', 'contentText'],
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
let borderBottom = 'none';
|
|
34
|
-
if (variant === AccordionVariant.Compact) {
|
|
35
|
-
borderBottom = isChild ? 'none' : '1px solid rgb(0,0,0,0.125)';
|
|
36
|
-
}
|
|
37
|
-
return {
|
|
38
|
-
backgroundColor: contentBg,
|
|
39
|
-
color: contentText,
|
|
40
|
-
opacity: 0,
|
|
41
|
-
padding: '0 16px',
|
|
42
|
-
height: 0,
|
|
43
|
-
overflow: 'hidden',
|
|
44
|
-
transition: '0.3s',
|
|
45
|
-
'&.expanded': {
|
|
46
|
-
padding: `9px 0 9px ${getLevelOffset(level)}px`,
|
|
47
|
-
height: 'auto',
|
|
48
|
-
opacity: 1,
|
|
49
|
-
borderBottom,
|
|
50
|
-
},
|
|
51
|
-
'.nsa-content-padded': {
|
|
52
|
-
padding: '0 16px 16px',
|
|
53
|
-
color: contentText,
|
|
54
|
-
backgroundColor: contentBg,
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* NsCollapse component adds css animation while showing children items if prop `isOpen` is true,
|
|
61
|
-
* and while removing children if prop `isOpen` is false
|
|
62
|
-
*/
|
|
63
|
-
const NsCollapse = ({
|
|
64
|
-
isOpen,
|
|
65
|
-
content,
|
|
66
|
-
additionalProps,
|
|
67
|
-
variant,
|
|
68
|
-
level,
|
|
69
|
-
invert,
|
|
70
|
-
isChild,
|
|
71
|
-
type,
|
|
72
|
-
cslp,
|
|
73
|
-
allowMultipleExpanded,
|
|
74
|
-
}: NsCollapseProps): ReactElement => {
|
|
75
|
-
const body = useMemo(() => {
|
|
76
|
-
if (isValidElement(content)) {
|
|
77
|
-
return content as ReactElement;
|
|
78
|
-
}
|
|
79
|
-
if (type === AccordionContentTypeObject.html) {
|
|
80
|
-
return (
|
|
81
|
-
<NsTypography variant="body-m">
|
|
82
|
-
<div
|
|
83
|
-
className="nsa-content-padded"
|
|
84
|
-
dangerouslySetInnerHTML={{ __html: content as string }}
|
|
85
|
-
{...(cslp?.content ?? {})}
|
|
86
|
-
/>
|
|
87
|
-
</NsTypography>
|
|
88
|
-
);
|
|
89
|
-
} else if (type === AccordionContentTypeObject.text) {
|
|
90
|
-
return (
|
|
91
|
-
<NsTypography variant="body-m" className="p-4" {...(cslp?.content ?? {})}>
|
|
92
|
-
{content as string}
|
|
93
|
-
</NsTypography>
|
|
94
|
-
);
|
|
95
|
-
} else if (type === AccordionContentTypeObject.accordion) {
|
|
96
|
-
return (
|
|
97
|
-
<NsAccordion
|
|
98
|
-
isChild={true}
|
|
99
|
-
invert={invert}
|
|
100
|
-
level={level}
|
|
101
|
-
variant={AccordionVariant.Gray}
|
|
102
|
-
items={content as AccordionItem[]}
|
|
103
|
-
allowMultipleExpanded={allowMultipleExpanded ?? false}
|
|
104
|
-
/>
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
return null;
|
|
108
|
-
}, [allowMultipleExpanded, content, cslp?.content, invert, level, type]);
|
|
109
|
-
return (
|
|
110
|
-
<StyledCollapse
|
|
111
|
-
isChild={isChild}
|
|
112
|
-
level={level}
|
|
113
|
-
className={`ns-collapse ${isOpen ? 'expanded' : ''} ${additionalProps?.className ?? ''}`}
|
|
114
|
-
variant={variant}
|
|
115
|
-
invert={invert}
|
|
116
|
-
>
|
|
117
|
-
{body}
|
|
118
|
-
</StyledCollapse>
|
|
119
|
-
);
|
|
120
|
-
};
|
|
121
|
-
export default NsCollapse;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
ReactElement,
|
|
3
|
-
useState,
|
|
4
|
-
} from 'react';
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
NsAccordionItem,
|
|
8
|
-
NsToggleSectionProps,
|
|
9
|
-
} from '../';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* NsToggleSection takes prop `title` and prop `children` and toggles
|
|
13
|
-
* children with animation when clicked on title
|
|
14
|
-
*
|
|
15
|
-
* it also has a `defaultOpen` prop, which when true, children is visible
|
|
16
|
-
* by default, otherwise children is hidden by default and toggles between visible
|
|
17
|
-
* and hidden on clicking title
|
|
18
|
-
*/
|
|
19
|
-
const NsToggleSection = ({
|
|
20
|
-
title,
|
|
21
|
-
content,
|
|
22
|
-
additionalProps,
|
|
23
|
-
defaultOpen,
|
|
24
|
-
variant,
|
|
25
|
-
invert,
|
|
26
|
-
isChild,
|
|
27
|
-
type,
|
|
28
|
-
}: NsToggleSectionProps): ReactElement => {
|
|
29
|
-
const [isExpanded, setIsExpanded] = useState(defaultOpen ?? false);
|
|
30
|
-
|
|
31
|
-
const toggleAccordion = () => {
|
|
32
|
-
setIsExpanded(!isExpanded);
|
|
33
|
-
};
|
|
34
|
-
return (
|
|
35
|
-
<NsAccordionItem
|
|
36
|
-
type={type}
|
|
37
|
-
level={2}
|
|
38
|
-
variant={variant}
|
|
39
|
-
additionalProps={additionalProps}
|
|
40
|
-
isOpen={isExpanded}
|
|
41
|
-
title={title}
|
|
42
|
-
content={content}
|
|
43
|
-
toggleOpen={toggleAccordion}
|
|
44
|
-
invert={invert}
|
|
45
|
-
isChild={isChild}
|
|
46
|
-
/>
|
|
47
|
-
);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export default NsToggleSection;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { styled } from '@nuskin/foundation-theme';
|
|
2
|
-
import { AccordionVariant, AccordionVariantType } from '../';
|
|
3
|
-
|
|
4
|
-
const border = '1px solid rgb(0,0,0,0.125)';
|
|
5
|
-
|
|
6
|
-
type StyledType = { variant: AccordionVariantType };
|
|
7
|
-
|
|
8
|
-
export const StyledToggleSection = styled('section')<StyledType>(({ variant }) => {
|
|
9
|
-
if (variant === AccordionVariant.Compact) {
|
|
10
|
-
return { borderRight: border };
|
|
11
|
-
}
|
|
12
|
-
return {
|
|
13
|
-
margin: '5px 0',
|
|
14
|
-
};
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
export const StyledAccordionWrapper = styled('div')<StyledType>(({ variant }) => {
|
|
18
|
-
if (variant === AccordionVariant.Compact) {
|
|
19
|
-
return {
|
|
20
|
-
display: 'flex',
|
|
21
|
-
flexDirection: 'column',
|
|
22
|
-
gap: '0',
|
|
23
|
-
borderTop: border,
|
|
24
|
-
borderLeft: border,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
display: 'flex',
|
|
29
|
-
flexDirection: 'column',
|
|
30
|
-
gap: '10px',
|
|
31
|
-
};
|
|
32
|
-
});
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AllColorKeyType,
|
|
3
|
-
ColorUtils,
|
|
4
|
-
} from '@nuskin/foundation-theme';
|
|
5
|
-
|
|
6
|
-
import { Themed } from '../common.types';
|
|
7
|
-
import {
|
|
8
|
-
AccordionVariant,
|
|
9
|
-
AccordionVariantType,
|
|
10
|
-
} from './enums';
|
|
11
|
-
|
|
12
|
-
const { getGenomeColor } = ColorUtils;
|
|
13
|
-
const compKeys = ['contentBg', 'contentText', 'headBg', 'headText'];
|
|
14
|
-
type CompKeys = (typeof compKeys)[number];
|
|
15
|
-
type VariantColors = Record<CompKeys, AllColorKeyType>;
|
|
16
|
-
|
|
17
|
-
export const colorMap: Record<AccordionVariantType, VariantColors> = {
|
|
18
|
-
basic: {
|
|
19
|
-
contentBg: 'N20',
|
|
20
|
-
contentText: 'N90',
|
|
21
|
-
headBg: 'N10',
|
|
22
|
-
headText: 'N90',
|
|
23
|
-
},
|
|
24
|
-
compact: {
|
|
25
|
-
contentBg: 'N10',
|
|
26
|
-
contentText: 'N90',
|
|
27
|
-
headBg: 'N10',
|
|
28
|
-
headText: 'N90',
|
|
29
|
-
},
|
|
30
|
-
gray: {
|
|
31
|
-
contentBg: 'N40',
|
|
32
|
-
contentText: 'N80',
|
|
33
|
-
headBg: 'N30',
|
|
34
|
-
headText: 'N70',
|
|
35
|
-
},
|
|
36
|
-
stripe: {
|
|
37
|
-
contentBg: 'N30',
|
|
38
|
-
contentText: 'N70',
|
|
39
|
-
headBg: 'N10',
|
|
40
|
-
headText: 'N80',
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
type GetAccordionColor = {
|
|
45
|
-
variant: AccordionVariantType;
|
|
46
|
-
invert: boolean;
|
|
47
|
-
keys: CompKeys[];
|
|
48
|
-
} & Themed;
|
|
49
|
-
export const getAccordionColor = ({ theme, variant, invert, keys }: GetAccordionColor): Record<CompKeys, string> => {
|
|
50
|
-
const result: Record<string, string> = {};
|
|
51
|
-
if (!Object.values(AccordionVariant).includes(variant)) {
|
|
52
|
-
throw new Error(`Invalid variant ${variant}`);
|
|
53
|
-
}
|
|
54
|
-
for (const colorKey of keys) {
|
|
55
|
-
const appColorKey = colorMap[variant][colorKey];
|
|
56
|
-
const colorValue = getGenomeColor(theme, appColorKey, invert ? 'dark' : 'light');
|
|
57
|
-
result[colorKey] = colorValue;
|
|
58
|
-
}
|
|
59
|
-
return result;
|
|
60
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export const AccordionVariant = {
|
|
2
|
-
Basic: 'basic',
|
|
3
|
-
Compact: 'compact',
|
|
4
|
-
Gray: 'gray',
|
|
5
|
-
Stripe: 'stripe',
|
|
6
|
-
} as const;
|
|
7
|
-
const variantValues = Object.values(AccordionVariant);
|
|
8
|
-
export type AccordionVariantType = (typeof variantValues)[number];
|
|
9
|
-
|
|
10
|
-
export const AccordionContentTypeObject = {
|
|
11
|
-
text: 'text',
|
|
12
|
-
html: 'html',
|
|
13
|
-
accordion: 'accordion',
|
|
14
|
-
jsx: 'jsx',
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const contentValues = Object.values(AccordionContentTypeObject);
|
|
18
|
-
export type AccordionContentType = (typeof contentValues)[number];
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { default as NsCollapse } from './NsCollapse';
|
|
2
|
-
export { default as NsAccordionHeader } from './NsAccordionHeader';
|
|
3
|
-
export { default as NsToggleSection } from './NsToggleSection';
|
|
4
|
-
export { default as NsAccordionItem } from './NsAccordionItem';
|
|
5
|
-
export { default as NsAccordion } from './NsAccordion';
|
|
6
|
-
export * from './types.d';
|
|
7
|
-
export * from './enums';
|