@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,65 +0,0 @@
|
|
|
1
|
-
import type { StoryObj, Meta } from '@storybook/react';
|
|
2
|
-
import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
|
|
3
|
-
import { NsAccordion, AccordionVariant } from '../..';
|
|
4
|
-
import { getAccordionData } from './data';
|
|
5
|
-
import { within } from '@storybook/testing-library';
|
|
6
|
-
import { expect } from '@storybook/jest';
|
|
7
|
-
const meta = {
|
|
8
|
-
title: 'Components/Containers/Accordion',
|
|
9
|
-
component: NsAccordion,
|
|
10
|
-
decorators: [withCenterDecorator],
|
|
11
|
-
argTypes: {
|
|
12
|
-
allowMultipleExpanded: {
|
|
13
|
-
control: 'boolean',
|
|
14
|
-
description: `if true, then multiple sections can remain open at a same time, and if false,
|
|
15
|
-
opening a section will close other sections of the accordion`,
|
|
16
|
-
},
|
|
17
|
-
items: {
|
|
18
|
-
description: ` this should be an array of objects, each object should have 3 properties,
|
|
19
|
-
title, body and isDefaultOpen`,
|
|
20
|
-
},
|
|
21
|
-
variant: {
|
|
22
|
-
control: 'select',
|
|
23
|
-
options: [...Object.values(AccordionVariant)],
|
|
24
|
-
},
|
|
25
|
-
level: {
|
|
26
|
-
control: 'number',
|
|
27
|
-
description: `level = 1 means no padding on left from parent to child,
|
|
28
|
-
level = 2 means padding of 16px, level = 3 means padding of 32px and so on ..`,
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
args: {
|
|
32
|
-
variant: AccordionVariant.Basic,
|
|
33
|
-
invert: false,
|
|
34
|
-
level: 2,
|
|
35
|
-
},
|
|
36
|
-
} satisfies MetaStory;
|
|
37
|
-
|
|
38
|
-
export default meta;
|
|
39
|
-
|
|
40
|
-
type MetaStory = Meta<typeof NsAccordion>;
|
|
41
|
-
type Story = StoryObj<typeof meta>;
|
|
42
|
-
|
|
43
|
-
export const SingleOpen: Story = {
|
|
44
|
-
args: {
|
|
45
|
-
allowMultipleExpanded: false,
|
|
46
|
-
items: getAccordionData(),
|
|
47
|
-
invert: false,
|
|
48
|
-
},
|
|
49
|
-
play: ({ canvasElement }) => {
|
|
50
|
-
const canvas = within(canvasElement);
|
|
51
|
-
const el1 = canvas.getByText('Example - 1 JSX');
|
|
52
|
-
expect(el1).toBeInTheDocument();
|
|
53
|
-
expect(el1.closest('header')).toHaveAttribute('aria-expanded', 'true');
|
|
54
|
-
const el2 = canvas.getByText('Example - 2');
|
|
55
|
-
expect(el2).toBeInTheDocument();
|
|
56
|
-
expect(el2.closest('header')).toHaveAttribute('aria-expanded', 'false');
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const MultipleOpen: Story = {
|
|
61
|
-
args: {
|
|
62
|
-
allowMultipleExpanded: true,
|
|
63
|
-
items: getAccordionData(),
|
|
64
|
-
},
|
|
65
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { StoryObj, Meta } from '@storybook/react';
|
|
2
|
-
import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
|
|
3
|
-
import { AccordionVariant, NsAccordionHeader, NsIconVariants } from '../..';
|
|
4
|
-
|
|
5
|
-
type ComponentType = typeof NsAccordionHeader;
|
|
6
|
-
type Story = StoryObj<ComponentType>;
|
|
7
|
-
type MetaStory = Meta<ComponentType>;
|
|
8
|
-
|
|
9
|
-
export default {
|
|
10
|
-
title: 'Components/Containers/Accordion/NsAccordionHeader',
|
|
11
|
-
component: NsAccordionHeader,
|
|
12
|
-
decorators: [withCenterDecorator],
|
|
13
|
-
argTypes: {
|
|
14
|
-
title: { control: 'string' },
|
|
15
|
-
openedIconName: {
|
|
16
|
-
control: 'select',
|
|
17
|
-
options: Object.keys(NsIconVariants),
|
|
18
|
-
},
|
|
19
|
-
closedIconName: {
|
|
20
|
-
control: 'select',
|
|
21
|
-
options: Object.keys(NsIconVariants),
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
args: {
|
|
25
|
-
title: 'Nuskin',
|
|
26
|
-
variant: AccordionVariant.Compact,
|
|
27
|
-
onClick: () => {
|
|
28
|
-
console.log('accordion header clicked');
|
|
29
|
-
},
|
|
30
|
-
startIcon: {
|
|
31
|
-
name: 'home',
|
|
32
|
-
},
|
|
33
|
-
openedIconName: 'arrowUp',
|
|
34
|
-
closedIconName: 'arrowDown',
|
|
35
|
-
isOpen: false,
|
|
36
|
-
},
|
|
37
|
-
} as MetaStory;
|
|
38
|
-
|
|
39
|
-
export const ClosedHeader: Story = {};
|
|
40
|
-
export const OpenedHeader: Story = {
|
|
41
|
-
args: {
|
|
42
|
-
isOpen: true,
|
|
43
|
-
},
|
|
44
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
|
|
3
|
-
import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
|
|
4
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
|
-
|
|
6
|
-
import { AccordionVariant, NsAccordionItem } from '../../';
|
|
7
|
-
import NsAccordionStory from './NsAccordion.stories';
|
|
8
|
-
|
|
9
|
-
type ComponentType = typeof NsAccordionItem;
|
|
10
|
-
type Story = StoryObj<ComponentType>;
|
|
11
|
-
type MetaStory = Meta<ComponentType>;
|
|
12
|
-
|
|
13
|
-
export default {
|
|
14
|
-
title: 'Components/Containers/Accordion/NsAccordionItem',
|
|
15
|
-
component: NsAccordionItem,
|
|
16
|
-
decorators: [withCenterDecorator],
|
|
17
|
-
argTypes: {
|
|
18
|
-
isOpen: {
|
|
19
|
-
control: 'boolean',
|
|
20
|
-
description: 'if true renders NsAccordionItem in open state, and close state otherwise',
|
|
21
|
-
},
|
|
22
|
-
content: {},
|
|
23
|
-
title: {
|
|
24
|
-
control: 'string',
|
|
25
|
-
description: 'text used for header of section',
|
|
26
|
-
},
|
|
27
|
-
level: NsAccordionStory.argTypes.level,
|
|
28
|
-
variant: NsAccordionStory.argTypes.variant,
|
|
29
|
-
},
|
|
30
|
-
} as MetaStory;
|
|
31
|
-
|
|
32
|
-
export const OpenSection: Story = {
|
|
33
|
-
args: {
|
|
34
|
-
variant: AccordionVariant.Compact,
|
|
35
|
-
isOpen: true,
|
|
36
|
-
content: (<div className="p-2">Nuskin Description</div>) as ReactElement,
|
|
37
|
-
title: 'Nuskin',
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export const ClosedSection: Story = {
|
|
42
|
-
args: {
|
|
43
|
-
variant: AccordionVariant.Compact,
|
|
44
|
-
isOpen: false,
|
|
45
|
-
content: (<div className="p-2">Nuskin Description</div>) as ReactElement,
|
|
46
|
-
title: 'Nuskin',
|
|
47
|
-
},
|
|
48
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
|
|
3
|
-
import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
|
|
4
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
|
-
|
|
6
|
-
import { AccordionContentTypeObject, AccordionVariant, NsCollapse } from '../';
|
|
7
|
-
import NsAccordionStory from './NsAccordion.stories';
|
|
8
|
-
|
|
9
|
-
type ComponentType = typeof NsCollapse;
|
|
10
|
-
type Story = StoryObj<ComponentType>;
|
|
11
|
-
type MetaStory = Meta<ComponentType>;
|
|
12
|
-
|
|
13
|
-
export default {
|
|
14
|
-
title: 'Components/Containers/Accordion/NsCollapse',
|
|
15
|
-
component: NsCollapse,
|
|
16
|
-
decorators: [withCenterDecorator],
|
|
17
|
-
argTypes: {
|
|
18
|
-
isOpen: {
|
|
19
|
-
control: 'boolean',
|
|
20
|
-
description: 'if true renders NsCollapse in open state, and close state otherwise',
|
|
21
|
-
},
|
|
22
|
-
content: {
|
|
23
|
-
control: 'React Node',
|
|
24
|
-
description: 'Content for NsCollapse',
|
|
25
|
-
},
|
|
26
|
-
allowMultipleExpanded: {
|
|
27
|
-
control: 'boolean',
|
|
28
|
-
description: 'This prop is useful when content is an array of accordion items',
|
|
29
|
-
},
|
|
30
|
-
type: {
|
|
31
|
-
control: 'select',
|
|
32
|
-
values: Object.values(AccordionContentTypeObject),
|
|
33
|
-
description: 'This type should exactly match the content type to have accordion work correctly',
|
|
34
|
-
},
|
|
35
|
-
level: NsAccordionStory.argTypes.level,
|
|
36
|
-
variant: NsAccordionStory.argTypes.variant,
|
|
37
|
-
},
|
|
38
|
-
args: {
|
|
39
|
-
variant: AccordionVariant.Compact,
|
|
40
|
-
},
|
|
41
|
-
} as MetaStory;
|
|
42
|
-
export const Closed: Story = {
|
|
43
|
-
args: {
|
|
44
|
-
isOpen: false,
|
|
45
|
-
content: (<div className="p-2">Nuskin Description</div>) as ReactElement,
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
export const Open: Story = {
|
|
49
|
-
args: {
|
|
50
|
-
isOpen: true,
|
|
51
|
-
content: (<div className="p-2">Nuskin Description</div>) as ReactElement,
|
|
52
|
-
},
|
|
53
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { StoryObj, Meta } from '@storybook/react';
|
|
2
|
-
import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
|
|
3
|
-
import { AccordionVariant, NsToggleSection } from '../..';
|
|
4
|
-
import NsAccordionStory from './NsAccordion.stories';
|
|
5
|
-
import { ReactElement } from 'react';
|
|
6
|
-
|
|
7
|
-
type ComponentType = typeof NsToggleSection;
|
|
8
|
-
type Story = StoryObj<ComponentType>;
|
|
9
|
-
type MetaStory = Meta<ComponentType>;
|
|
10
|
-
|
|
11
|
-
export default {
|
|
12
|
-
title: 'Components/Containers/Accordion/NsToggleSection',
|
|
13
|
-
component: NsToggleSection,
|
|
14
|
-
decorators: [withCenterDecorator],
|
|
15
|
-
argTypes: {
|
|
16
|
-
level: NsAccordionStory.argTypes.level,
|
|
17
|
-
variant: NsAccordionStory.argTypes.variant,
|
|
18
|
-
title: { control: 'string' },
|
|
19
|
-
},
|
|
20
|
-
args: {
|
|
21
|
-
variant: AccordionVariant.Compact,
|
|
22
|
-
title: 'Nuskin',
|
|
23
|
-
content: (<div className="p-2">Nuskin Details</div>) as ReactElement,
|
|
24
|
-
},
|
|
25
|
-
} as MetaStory;
|
|
26
|
-
|
|
27
|
-
export const DefaultAccordion: Story = {};
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import { AccordionItem } from '../types';
|
|
2
|
-
import { ReactElement } from 'react';
|
|
3
|
-
|
|
4
|
-
import { AccordionContentTypeObject, NsIconProps } from '../..';
|
|
5
|
-
|
|
6
|
-
const getItem = () => {
|
|
7
|
-
return {
|
|
8
|
-
id: parseInt(Math.random() * 10000000 + '') + '',
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
const getIcon = (name = '', color = '') => {
|
|
12
|
-
return {
|
|
13
|
-
name: (name || 'home') as NsIconProps['name'],
|
|
14
|
-
color: (color || 'primary') as NsIconProps['color'],
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
export const getTextContent = (text = '') => {
|
|
18
|
-
return {
|
|
19
|
-
type: AccordionContentTypeObject.text as AccordionItem['type'],
|
|
20
|
-
content: text || dummyText,
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
const getJsxContent = (text = ''): ReactElement => {
|
|
24
|
-
return <div className="p-4">{text || 'Content type can be jsx, text, html or Accordion'}</div>;
|
|
25
|
-
};
|
|
26
|
-
export const dummyText = `1. Theme can be set to either ‘gray’ or ‘stripe’, adjusting only the appearance of
|
|
27
|
-
the topmost set of accordions.\n
|
|
28
|
-
2. Accordions can be nested repeatedly, internal accordions follow the ‘gray’ theme.\n
|
|
29
|
-
3. Color can be inverted by setting boolean ‘invert’ attribute. This inversion affects all levels of the accordion.\n
|
|
30
|
-
4. Per level offset of accordion can be changed by setting the level attribute.\n
|
|
31
|
-
Defaults to 1 which is zero offset - all level titles appear stacked directly over each other.`;
|
|
32
|
-
function createAccordionItem1(): AccordionItem {
|
|
33
|
-
return {
|
|
34
|
-
...getItem(),
|
|
35
|
-
icon: getIcon(),
|
|
36
|
-
title: 'Example - 1 JSX',
|
|
37
|
-
content: getJsxContent(),
|
|
38
|
-
type: AccordionContentTypeObject.jsx,
|
|
39
|
-
isDefaultOpen: true,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
function createAccordionItem2(): AccordionItem {
|
|
43
|
-
return {
|
|
44
|
-
...getItem(),
|
|
45
|
-
isDefaultOpen: true,
|
|
46
|
-
icon: getIcon(),
|
|
47
|
-
title: 'Example - 2',
|
|
48
|
-
type: AccordionContentTypeObject.accordion,
|
|
49
|
-
content: [
|
|
50
|
-
{ ...getItem(), title: 'Example - 2.1', ...getTextContent() },
|
|
51
|
-
{
|
|
52
|
-
...getItem(),
|
|
53
|
-
icon: getIcon('hamburgerIcon', 'success'),
|
|
54
|
-
title: 'Example - 2.2',
|
|
55
|
-
type: AccordionContentTypeObject.jsx,
|
|
56
|
-
content: <div className="p-2">Example 2.2 Content</div>,
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
function createAccordionItem3(): AccordionItem {
|
|
62
|
-
return {
|
|
63
|
-
...getItem(),
|
|
64
|
-
icon: getIcon('hamburgerIcon', 'success'),
|
|
65
|
-
title: 'Example - 3',
|
|
66
|
-
type: AccordionContentTypeObject.accordion,
|
|
67
|
-
content: [
|
|
68
|
-
createAccordionItem3_1(),
|
|
69
|
-
{
|
|
70
|
-
...getItem(),
|
|
71
|
-
|
|
72
|
-
title: 'Example - 3.2',
|
|
73
|
-
type: AccordionContentTypeObject.text,
|
|
74
|
-
content: dummyText,
|
|
75
|
-
},
|
|
76
|
-
],
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export function createAccordionItem3_1(): AccordionItem {
|
|
81
|
-
return {
|
|
82
|
-
...getItem(),
|
|
83
|
-
title: 'Example - 3.1',
|
|
84
|
-
allowMultipleExpanded: true,
|
|
85
|
-
type: AccordionContentTypeObject.accordion,
|
|
86
|
-
content: [
|
|
87
|
-
{
|
|
88
|
-
...getItem(),
|
|
89
|
-
title: 'Example - 3.1.1',
|
|
90
|
-
type: AccordionContentTypeObject.text,
|
|
91
|
-
content: dummyText,
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
...getItem(),
|
|
95
|
-
title: 'Example - 3.1.2',
|
|
96
|
-
type: AccordionContentTypeObject.text,
|
|
97
|
-
content: dummyText,
|
|
98
|
-
},
|
|
99
|
-
],
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function createAccordionItem4(): AccordionItem {
|
|
104
|
-
return {
|
|
105
|
-
...getItem(),
|
|
106
|
-
icon: getIcon(),
|
|
107
|
-
title: 'Example - 4',
|
|
108
|
-
type: AccordionContentTypeObject.accordion,
|
|
109
|
-
content: [
|
|
110
|
-
createAccordionItem4_1(),
|
|
111
|
-
{
|
|
112
|
-
...getItem(),
|
|
113
|
-
title: 'Example - 4.2',
|
|
114
|
-
type: AccordionContentTypeObject.html,
|
|
115
|
-
content: '<h2>Lorem ipsum dolor sit amet.</h2>',
|
|
116
|
-
},
|
|
117
|
-
],
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function createAccordionItem4_1(): AccordionItem {
|
|
122
|
-
return {
|
|
123
|
-
...getItem(),
|
|
124
|
-
title: 'Example - 4.1',
|
|
125
|
-
type: AccordionContentTypeObject.accordion,
|
|
126
|
-
content: [
|
|
127
|
-
{
|
|
128
|
-
...getItem(),
|
|
129
|
-
|
|
130
|
-
title: 'Example - 4.1.1',
|
|
131
|
-
type: AccordionContentTypeObject.text,
|
|
132
|
-
content: dummyText,
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
...getItem(),
|
|
136
|
-
type: AccordionContentTypeObject.jsx,
|
|
137
|
-
content: <div className="p-3">Example 4.1.2. content</div>,
|
|
138
|
-
title: 'Example - 4.1.2',
|
|
139
|
-
},
|
|
140
|
-
],
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
export function getAccordionData(): AccordionItem[] {
|
|
144
|
-
return [createAccordionItem1(), createAccordionItem2(), createAccordionItem3(), createAccordionItem4()];
|
|
145
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { ReactElement, ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
import { AdditionalProps, CslpTag } from '../common.types';
|
|
4
|
-
import { NsIconNameType, NsIconProps } from '../icon';
|
|
5
|
-
import { Variants } from '../typography';
|
|
6
|
-
import { AccordionContentType, AccordionVariantType } from './enums';
|
|
7
|
-
|
|
8
|
-
export type AccordionItem = {
|
|
9
|
-
allowMultipleExpanded?: boolean;
|
|
10
|
-
type: AccordionContentType;
|
|
11
|
-
id: string;
|
|
12
|
-
content: string | AccordionItem[] | ReactElement | null;
|
|
13
|
-
icon?: NsIconProps;
|
|
14
|
-
title: string | ReactElement;
|
|
15
|
-
isDefaultOpen?: boolean;
|
|
16
|
-
$?: {
|
|
17
|
-
rte: CslpTag;
|
|
18
|
-
item_title: CslpTag;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export type NsAccordionProps = AdditionalProps & {
|
|
23
|
-
invert: boolean;
|
|
24
|
-
level: number;
|
|
25
|
-
variant: AccordionVariantType;
|
|
26
|
-
items?: AccordionItem[];
|
|
27
|
-
isChild?: boolean;
|
|
28
|
-
headerTypographyVariant?: Variants;
|
|
29
|
-
/** NsIcon's icon name to be shown in opened state */
|
|
30
|
-
openedIconName?: NsIconNameType;
|
|
31
|
-
/** NsIcon's icon name to be shown in closed state */
|
|
32
|
-
closedIconName?: NsIconNameType;
|
|
33
|
-
allowMultipleExpanded: boolean;
|
|
34
|
-
showEndIconWhenEmpty?: boolean;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
type CommonAccordionType = {
|
|
38
|
-
invert: boolean;
|
|
39
|
-
level: number;
|
|
40
|
-
variant: AccordionVariantType;
|
|
41
|
-
content: AccordionItem['content'];
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export type NsAccordionHeaderProps = AdditionalProps & {
|
|
45
|
-
title: string | ReactNode;
|
|
46
|
-
// eslint-disable-next-line no-unused-vars
|
|
47
|
-
onClick: (...args: any[]) => void;
|
|
48
|
-
/** a flag for the header, based on which header can change properties */
|
|
49
|
-
isOpen: boolean;
|
|
50
|
-
/** NsIcon's icon name to be shown in opened state */
|
|
51
|
-
openedIconName?: NsIconNameType;
|
|
52
|
-
/** NsIcon's icon name to be shown in closed state */
|
|
53
|
-
closedIconName?: NsIconNameType;
|
|
54
|
-
headerTypographyVariant?: Variants;
|
|
55
|
-
startIcon?: NsIconProps;
|
|
56
|
-
showEndIconWhenEmpty?: boolean;
|
|
57
|
-
content: AccordionItem['content'];
|
|
58
|
-
} & Pick<CommonAccordionType, 'invert' | 'variant'>;
|
|
59
|
-
|
|
60
|
-
export type NsCollapseProps = AdditionalProps & {
|
|
61
|
-
isOpen: boolean;
|
|
62
|
-
isChild: boolean;
|
|
63
|
-
allowMultipleExpanded?: boolean;
|
|
64
|
-
type: AccordionContentType;
|
|
65
|
-
} & CommonAccordionType;
|
|
66
|
-
|
|
67
|
-
export type NsToggleSectionProps = AdditionalProps & {
|
|
68
|
-
title: string | ReactNode;
|
|
69
|
-
/** if true, NsToggle is rendered in open state, that collapsible section is visible */
|
|
70
|
-
defaultOpen?: boolean;
|
|
71
|
-
isChild: boolean;
|
|
72
|
-
type: AccordionContentType;
|
|
73
|
-
} & Pick<CommonAccordionType, 'invert' | 'variant' | 'content'>;
|
|
74
|
-
|
|
75
|
-
export type NsAccordionItemProps = AdditionalProps & {
|
|
76
|
-
isOpen: boolean;
|
|
77
|
-
// eslint-disable-next-line no-unused-vars
|
|
78
|
-
toggleOpen(index: number, isOpen: boolean): void;
|
|
79
|
-
title: string | ReactNode;
|
|
80
|
-
headerTypographyVariant?: Variants;
|
|
81
|
-
/** NsIcon's icon name to be shown in opened state */
|
|
82
|
-
openedIconName?: NsIconNameType;
|
|
83
|
-
/** NsIcon's icon name to be shown in closed state */
|
|
84
|
-
closedIconName?: NsIconNameType;
|
|
85
|
-
startIcon?: NsIconProps;
|
|
86
|
-
isChild: boolean;
|
|
87
|
-
type: AccordionContentType;
|
|
88
|
-
allowMultipleExpanded?: boolean;
|
|
89
|
-
showEndIconWhenEmpty?: boolean;
|
|
90
|
-
} & CommonAccordionType;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { FoundationTheme } from '@nuskin/foundation-theme';
|
|
3
|
-
|
|
4
|
-
import type { HeaderProps } from './types.d';
|
|
5
|
-
import { NsIconNameType } from '../icon/types';
|
|
6
|
-
|
|
7
|
-
export const colorMap: { [key: string]: FoundationTheme.PaletteColors } = {
|
|
8
|
-
error: 'error',
|
|
9
|
-
notice: 'info',
|
|
10
|
-
success: 'secondary',
|
|
11
|
-
warning: 'warning',
|
|
12
|
-
default: 'info',
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const iconMap: { [key: string]: NsIconNameType } = {
|
|
16
|
-
error: 'alertError',
|
|
17
|
-
success: 'success',
|
|
18
|
-
warning: 'warning',
|
|
19
|
-
default: 'infoFilled',
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const Header: React.FC<HeaderProps> = ({ children, head }) => (
|
|
23
|
-
<>
|
|
24
|
-
{children}
|
|
25
|
-
{head}
|
|
26
|
-
</>
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
export default Header;
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, fireEvent, screen, act } from '@/test-utils/index';
|
|
3
|
-
import NsAlert from './NsAlert';
|
|
4
|
-
|
|
5
|
-
const addEventListenerMock = jest.spyOn(window, 'addEventListener');
|
|
6
|
-
const removeEventListenerMock = jest.spyOn(window, 'removeEventListener');
|
|
7
|
-
|
|
8
|
-
describe('NsAlert', () => {
|
|
9
|
-
test('1. renders alert with provided props', () => {
|
|
10
|
-
render(
|
|
11
|
-
<NsAlert
|
|
12
|
-
context="error"
|
|
13
|
-
title="Error Alert"
|
|
14
|
-
threshold={800}
|
|
15
|
-
type="banner"
|
|
16
|
-
visible
|
|
17
|
-
head={<span>Alert Head</span>}
|
|
18
|
-
body={<p>Alert Body</p>}
|
|
19
|
-
foot={<span>Dismiss</span>}
|
|
20
|
-
onDismiss={() => {}}
|
|
21
|
-
/>
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
expect(screen.getByText('Error Alert')).toBeInTheDocument();
|
|
25
|
-
expect(screen.getByText('Alert Head')).toBeInTheDocument();
|
|
26
|
-
expect(screen.getByText('Alert Body')).toBeInTheDocument();
|
|
27
|
-
expect(screen.getByText('Dismiss')).toBeInTheDocument();
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
test('2. calls onDismiss function when dismissed', () => {
|
|
31
|
-
const onDismissMock = jest.fn();
|
|
32
|
-
render(
|
|
33
|
-
<NsAlert
|
|
34
|
-
context="info"
|
|
35
|
-
title="Info Alert"
|
|
36
|
-
threshold={600}
|
|
37
|
-
type="auto"
|
|
38
|
-
visible
|
|
39
|
-
head={<span>Alert Head</span>}
|
|
40
|
-
body={<p>Alert Body</p>}
|
|
41
|
-
onDismiss={onDismissMock}
|
|
42
|
-
/>
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
expect(screen.getByTestId('alert-close-button')).toBeInTheDocument();
|
|
46
|
-
const button = screen.getByTestId('alert-close-button');
|
|
47
|
-
fireEvent.click(button);
|
|
48
|
-
expect(onDismissMock).toHaveBeenCalled();
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
test('3. hides alert when not visible', () => {
|
|
52
|
-
render(
|
|
53
|
-
<NsAlert
|
|
54
|
-
context="success"
|
|
55
|
-
title="Success Alert"
|
|
56
|
-
threshold={700}
|
|
57
|
-
type="card"
|
|
58
|
-
visible={false}
|
|
59
|
-
head={<span>Alert Head</span>}
|
|
60
|
-
body={<p>Alert Body</p>}
|
|
61
|
-
/>
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
expect(screen.getByTestId('alert-container')).toHaveStyle('display: none');
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
test('4. adds and removes event listener on mount/unmount', () => {
|
|
68
|
-
act(() => {
|
|
69
|
-
render(
|
|
70
|
-
<NsAlert
|
|
71
|
-
context="notice"
|
|
72
|
-
title="Success Alert"
|
|
73
|
-
threshold={700}
|
|
74
|
-
type="card"
|
|
75
|
-
visible={false}
|
|
76
|
-
head={<span>Alert Head</span>}
|
|
77
|
-
body={<p>Alert Body</p>}
|
|
78
|
-
/>
|
|
79
|
-
);
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
expect(addEventListenerMock).toHaveBeenCalledWith('resize', expect.any(Function));
|
|
83
|
-
|
|
84
|
-
expect(removeEventListenerMock).toHaveBeenCalledWith('resize', expect.any(Function));
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
test('5. updates windowWidth on resize and auto type and greater threshold to select card', () => {
|
|
88
|
-
const originalInnerWidth = window.innerWidth;
|
|
89
|
-
window.innerWidth = 500; // Set a desired window width for testing
|
|
90
|
-
|
|
91
|
-
act(() => {
|
|
92
|
-
render(<NsAlert threshold={2000} type="auto" />);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
// Simulate a resize event by restoring the original innerWidth
|
|
96
|
-
window.innerWidth = originalInnerWidth;
|
|
97
|
-
|
|
98
|
-
act(() => {
|
|
99
|
-
window.dispatchEvent(new Event('resize'));
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
test('6. updates windowWidth on resize', () => {
|
|
103
|
-
const originalInnerWidth = window.innerWidth;
|
|
104
|
-
window.innerWidth = 500; // Set a desired window width for testing
|
|
105
|
-
|
|
106
|
-
act(() => {
|
|
107
|
-
render(<NsAlert />);
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
// Simulate a resize event by restoring the original innerWidth
|
|
111
|
-
window.innerWidth = originalInnerWidth;
|
|
112
|
-
|
|
113
|
-
act(() => {
|
|
114
|
-
window.dispatchEvent(new Event('resize'));
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
test('7. get props error in console for types', () => {
|
|
119
|
-
render(
|
|
120
|
-
<NsAlert
|
|
121
|
-
context="warning"
|
|
122
|
-
title="warning Alert"
|
|
123
|
-
threshold={800}
|
|
124
|
-
type="noCard"
|
|
125
|
-
visible
|
|
126
|
-
head={<span>Alert Head</span>}
|
|
127
|
-
body={<p>Alert Body</p>}
|
|
128
|
-
/>
|
|
129
|
-
);
|
|
130
|
-
|
|
131
|
-
expect(screen.getByTestId('alert-container')).toHaveStyle('display: block');
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
test('8. get props error in console for context', () => {
|
|
135
|
-
render(
|
|
136
|
-
<NsAlert
|
|
137
|
-
context="warningError"
|
|
138
|
-
title="warning Alert"
|
|
139
|
-
threshold={800}
|
|
140
|
-
type="card"
|
|
141
|
-
visible
|
|
142
|
-
head={<span>Alert Head</span>}
|
|
143
|
-
body={<p>Alert Body</p>}
|
|
144
|
-
/>
|
|
145
|
-
);
|
|
146
|
-
|
|
147
|
-
expect(screen.getByTestId('alert-container')).toHaveStyle('display: block');
|
|
148
|
-
});
|
|
149
|
-
test('9. console.error to be called twice', () => {
|
|
150
|
-
const original = console.error;
|
|
151
|
-
console.error = jest.fn();
|
|
152
|
-
render(
|
|
153
|
-
<NsAlert
|
|
154
|
-
context=""
|
|
155
|
-
title="warning Alert"
|
|
156
|
-
threshold={2000}
|
|
157
|
-
type=""
|
|
158
|
-
visible
|
|
159
|
-
head={<span>Alert Head</span>}
|
|
160
|
-
body={<p>Alert Body</p>}
|
|
161
|
-
/>
|
|
162
|
-
);
|
|
163
|
-
expect(console.error).toHaveBeenCalledTimes(2);
|
|
164
|
-
console.error = original;
|
|
165
|
-
expect(screen.getByTestId('alert-container')).toHaveStyle('display: block');
|
|
166
|
-
});
|
|
167
|
-
});
|