@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,122 +0,0 @@
|
|
|
1
|
-
import { VariantType, closeSnackbar } from 'notistack';
|
|
2
|
-
import { render, screen } from '@/test-utils/index';
|
|
3
|
-
import React, { PropsWithChildren, useEffect } from 'react';
|
|
4
|
-
|
|
5
|
-
import { NsToastProvider, ToastOptions, useToast } from '../';
|
|
6
|
-
|
|
7
|
-
const ToastWrapper = ({ children }: PropsWithChildren<{}>) => {
|
|
8
|
-
return <NsToastProvider>{children}</NsToastProvider>;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const ToastComponent = (props: { variant: VariantType; message?: string; options?: ToastOptions }) => {
|
|
12
|
-
const { showToast } = useToast();
|
|
13
|
-
const { variant, message, options } = props;
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
showToast(variant, message, options);
|
|
16
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
17
|
-
}, []);
|
|
18
|
-
return <div></div>;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
describe('Toast', () => {
|
|
22
|
-
afterEach(() => {
|
|
23
|
-
closeSnackbar();
|
|
24
|
-
});
|
|
25
|
-
it('1. should render a toast and displays the message', () => {
|
|
26
|
-
render(
|
|
27
|
-
<ToastWrapper>
|
|
28
|
-
<ToastComponent variant="success" message="Hello" />
|
|
29
|
-
</ToastWrapper>
|
|
30
|
-
);
|
|
31
|
-
expect(screen.queryByText('Hello')).toBeInTheDocument();
|
|
32
|
-
}, 100000);
|
|
33
|
-
it('2. should render a success toast', () => {
|
|
34
|
-
const { container } = render(
|
|
35
|
-
<ToastWrapper>
|
|
36
|
-
<ToastComponent variant="success" message="Hello" />
|
|
37
|
-
</ToastWrapper>
|
|
38
|
-
);
|
|
39
|
-
expect(container.querySelector('.notistack-MuiContent-success')).toBeInTheDocument();
|
|
40
|
-
}, 100000);
|
|
41
|
-
it('3. should render a error toast', () => {
|
|
42
|
-
const { container } = render(
|
|
43
|
-
<ToastWrapper>
|
|
44
|
-
<ToastComponent variant="error" message="Hello" />
|
|
45
|
-
</ToastWrapper>
|
|
46
|
-
);
|
|
47
|
-
expect(container.querySelector('.notistack-MuiContent-error')).toBeInTheDocument();
|
|
48
|
-
}, 100000);
|
|
49
|
-
it('4. should render a info toast', () => {
|
|
50
|
-
const { container } = render(
|
|
51
|
-
<ToastWrapper>
|
|
52
|
-
<ToastComponent variant="info" message="Hello" />
|
|
53
|
-
</ToastWrapper>
|
|
54
|
-
);
|
|
55
|
-
expect(container.querySelector('.notistack-MuiContent-info')).toBeInTheDocument();
|
|
56
|
-
}, 100000);
|
|
57
|
-
it('5. it should render a warning toast', () => {
|
|
58
|
-
const { container } = render(
|
|
59
|
-
<ToastWrapper>
|
|
60
|
-
<ToastComponent variant="warning" message="Hello" />
|
|
61
|
-
</ToastWrapper>
|
|
62
|
-
);
|
|
63
|
-
expect(container.querySelector('.notistack-MuiContent-warning')).toBeInTheDocument();
|
|
64
|
-
}, 100000);
|
|
65
|
-
it('6. should render a warning toast and disappear after 3 seconds', async () => {
|
|
66
|
-
const { container } = render(
|
|
67
|
-
<ToastWrapper>
|
|
68
|
-
<ToastComponent variant="warning" message="Hello" options={{ autoHideDuration: 3000 }} />
|
|
69
|
-
</ToastWrapper>
|
|
70
|
-
);
|
|
71
|
-
expect(container.querySelector('.notistack-MuiContent-warning')).toBeInTheDocument();
|
|
72
|
-
await new Promise((r) => setTimeout(r, 4000));
|
|
73
|
-
expect(container.querySelector('.notistack-MuiContent-warning')).not.toBeInTheDocument();
|
|
74
|
-
}, 100000);
|
|
75
|
-
it('7. should render a action buttons', async () => {
|
|
76
|
-
const { getByTestId } = render(
|
|
77
|
-
<ToastWrapper>
|
|
78
|
-
<ToastComponent
|
|
79
|
-
variant="warning"
|
|
80
|
-
message="Hello"
|
|
81
|
-
options={{
|
|
82
|
-
actions: [
|
|
83
|
-
{
|
|
84
|
-
label: 'Undo',
|
|
85
|
-
onClick: () => alert('Undo clicked'),
|
|
86
|
-
},
|
|
87
|
-
],
|
|
88
|
-
}}
|
|
89
|
-
/>
|
|
90
|
-
</ToastWrapper>
|
|
91
|
-
);
|
|
92
|
-
expect(getByTestId('action-button')).toBeInTheDocument();
|
|
93
|
-
}, 100000);
|
|
94
|
-
it('8. should render close button', async () => {
|
|
95
|
-
const { getByTestId } = render(
|
|
96
|
-
<ToastWrapper>
|
|
97
|
-
<ToastComponent variant="warning" message="Hello" options={{ showCloseIcon: true }} />
|
|
98
|
-
</ToastWrapper>
|
|
99
|
-
);
|
|
100
|
-
expect(getByTestId('icon')).toBeInTheDocument();
|
|
101
|
-
}, 100000);
|
|
102
|
-
it('9. should render a action buttons and close button', async () => {
|
|
103
|
-
const { getAllByRole } = render(
|
|
104
|
-
<ToastWrapper>
|
|
105
|
-
<ToastComponent
|
|
106
|
-
variant="warning"
|
|
107
|
-
message="Hello"
|
|
108
|
-
options={{
|
|
109
|
-
actions: [
|
|
110
|
-
{
|
|
111
|
-
label: 'Undo',
|
|
112
|
-
onClick: () => alert('Undo clicked'),
|
|
113
|
-
},
|
|
114
|
-
],
|
|
115
|
-
showCloseIcon: true,
|
|
116
|
-
}}
|
|
117
|
-
/>
|
|
118
|
-
</ToastWrapper>
|
|
119
|
-
);
|
|
120
|
-
expect(getAllByRole('button')?.length).toBe(2);
|
|
121
|
-
}, 100000);
|
|
122
|
-
});
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import React, { ReactElement } from 'react';
|
|
2
|
-
|
|
3
|
-
import { VariantType } from 'notistack';
|
|
4
|
-
|
|
5
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
6
|
-
|
|
7
|
-
import { NsToastProvider, ToastOptions, useToast } from '../';
|
|
8
|
-
|
|
9
|
-
type ComponentType = typeof NsToastProvider;
|
|
10
|
-
type Story = StoryObj<ComponentType>;
|
|
11
|
-
type MetaStory = Meta<ComponentType>;
|
|
12
|
-
|
|
13
|
-
type ToastProps = {
|
|
14
|
-
variant?: VariantType;
|
|
15
|
-
message?: string;
|
|
16
|
-
options?: ToastOptions;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const ToastDecorator = (Story: React.FC): ReactElement => {
|
|
20
|
-
return (
|
|
21
|
-
<NsToastProvider>
|
|
22
|
-
<Story />
|
|
23
|
-
</NsToastProvider>
|
|
24
|
-
);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const ToastComponent = (props: ToastProps): ReactElement => {
|
|
28
|
-
const {
|
|
29
|
-
variant,
|
|
30
|
-
message = 'Toast Demo',
|
|
31
|
-
options = {
|
|
32
|
-
autoHideDuration: 2000,
|
|
33
|
-
},
|
|
34
|
-
} = props;
|
|
35
|
-
const { showToast } = useToast();
|
|
36
|
-
|
|
37
|
-
const toastHandler = () => {
|
|
38
|
-
showToast(variant, message, options);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<div>
|
|
43
|
-
<button onClick={toastHandler}>Show Toast</button>
|
|
44
|
-
</div>
|
|
45
|
-
);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export default {
|
|
49
|
-
title: 'Components/Feedback/NsToast',
|
|
50
|
-
component: ToastComponent,
|
|
51
|
-
decorators: [ToastDecorator],
|
|
52
|
-
argTypes: {
|
|
53
|
-
variant: { control: 'select', options: ['success', 'error', 'warning', 'info'] },
|
|
54
|
-
message: { control: 'text' },
|
|
55
|
-
options: {
|
|
56
|
-
autoHideDuration: { control: 'number' },
|
|
57
|
-
persist: { control: 'boolean' },
|
|
58
|
-
className: { control: 'text' },
|
|
59
|
-
showCloseIcon: { control: 'boolean' },
|
|
60
|
-
actions: {
|
|
61
|
-
description: 'The buttons should be passed to the Toast element',
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
args: {
|
|
66
|
-
variant: 'error',
|
|
67
|
-
message: 'Toast component',
|
|
68
|
-
options: {
|
|
69
|
-
autoHideDuration: 2000,
|
|
70
|
-
persist: false,
|
|
71
|
-
showCloseIcon: false,
|
|
72
|
-
actions: [
|
|
73
|
-
{
|
|
74
|
-
label: 'Undo',
|
|
75
|
-
onClick: () => alert('Undo clicked'),
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
} as MetaStory;
|
|
81
|
-
|
|
82
|
-
export const NsToast: Story = {};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { JSX } from 'react';
|
|
2
|
-
import { closeSnackbar, enqueueSnackbar, VariantType } from 'notistack';
|
|
3
|
-
import Fade from './Fade';
|
|
4
|
-
import NsIcon from '../icon/NsIcon';
|
|
5
|
-
import NsButton from '../button/NsButton';
|
|
6
|
-
|
|
7
|
-
type ToastActionLink = {
|
|
8
|
-
label: string;
|
|
9
|
-
onClick?: () => void;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export type ToastOptions = {
|
|
13
|
-
className?: string;
|
|
14
|
-
autoHideDuration?: number | null;
|
|
15
|
-
persist?: boolean;
|
|
16
|
-
showCloseIcon?: boolean;
|
|
17
|
-
actions?: ToastActionLink[];
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const useToast = () => {
|
|
22
|
-
const closeToast = (toastId?: string) => {
|
|
23
|
-
closeSnackbar(toastId);
|
|
24
|
-
};
|
|
25
|
-
const generateActionButtons = (showCloseIcon: boolean = false, variant: VariantType = 'success', actions?: ToastActionLink[]) => {
|
|
26
|
-
let actionButtons: JSX.Element[] = [];
|
|
27
|
-
if (actions?.length) {
|
|
28
|
-
actionButtons = actions.map((action) => (
|
|
29
|
-
<NsButton data-testid="action-button" variant="text" color={variant as any} key={action?.label} onClick={() => action.onClick?.()}>
|
|
30
|
-
{action.label}
|
|
31
|
-
</NsButton>
|
|
32
|
-
));
|
|
33
|
-
}
|
|
34
|
-
if (showCloseIcon) {
|
|
35
|
-
actionButtons.push (
|
|
36
|
-
<NsButton variant="text" onClick={() => closeToast()}>
|
|
37
|
-
<NsIcon name="close" size="small" cursor="pointer" />
|
|
38
|
-
</NsButton>
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
return actionButtons?.length ? actionButtons : null;
|
|
42
|
-
};
|
|
43
|
-
const showToast = (variant: VariantType = 'default', message?: string, options?: ToastOptions) => {
|
|
44
|
-
|
|
45
|
-
try {
|
|
46
|
-
return enqueueSnackbar(<div className='toast-message-wrapper'>{message}</div>, {
|
|
47
|
-
variant,
|
|
48
|
-
...options,
|
|
49
|
-
anchorOrigin: { horizontal: 'center', vertical: 'bottom' },
|
|
50
|
-
preventDuplicate: true,
|
|
51
|
-
TransitionComponent: Fade,
|
|
52
|
-
action: generateActionButtons(options?.showCloseIcon, variant, options?.actions),
|
|
53
|
-
});
|
|
54
|
-
} catch (err) {
|
|
55
|
-
console.error('CFT::UI:COMPONENTS showToast should be used inside NsToastProvider');
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
return {
|
|
60
|
-
showToast,
|
|
61
|
-
closeToast
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export default useToast;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
css,
|
|
5
|
-
GlobalStyles,
|
|
6
|
-
} from '@nuskin/foundation-theme';
|
|
7
|
-
|
|
8
|
-
const GlobalFontInter = (): ReactElement => (
|
|
9
|
-
<GlobalStyles
|
|
10
|
-
styles={css`
|
|
11
|
-
@import url('https://fonts.googleapis.com/css2?family=Inter');
|
|
12
|
-
`}
|
|
13
|
-
/>
|
|
14
|
-
);
|
|
15
|
-
export default GlobalFontInter;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { HtmlTagVariant } from './types';
|
|
2
|
-
|
|
3
|
-
const HtmlTagVariantMapping: Record<string, HtmlTagVariant> = {
|
|
4
|
-
h1: 'h1',
|
|
5
|
-
h2: 'h2',
|
|
6
|
-
h3: 'h3',
|
|
7
|
-
h4: 'h4',
|
|
8
|
-
h5: 'h5',
|
|
9
|
-
h6: 'h6',
|
|
10
|
-
CTA: 'span',
|
|
11
|
-
'title-l': 'h3',
|
|
12
|
-
'title-m': 'h5',
|
|
13
|
-
'title-s': 'h6',
|
|
14
|
-
'label-l': 'label',
|
|
15
|
-
'label-m': 'label',
|
|
16
|
-
'label-s': 'label',
|
|
17
|
-
'body-xl': 'p',
|
|
18
|
-
'body-l': 'p',
|
|
19
|
-
'body-m': 'p',
|
|
20
|
-
'body-s': 'p',
|
|
21
|
-
'body-xs': 'p',
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export default HtmlTagVariantMapping;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
import NsTypography from './NsTypography';
|
|
5
|
-
|
|
6
|
-
describe('GlobalFontInter', () => {
|
|
7
|
-
it('0. should match snapshot', () => {
|
|
8
|
-
const text = 'Hello Typo!';
|
|
9
|
-
const { container } = render(<NsTypography variant={'h1'}>{text}</NsTypography>);
|
|
10
|
-
expect(container).toMatchSnapshot();
|
|
11
|
-
});
|
|
12
|
-
it('1. renders without crashing', () => {
|
|
13
|
-
const text = 'Hello Typo!';
|
|
14
|
-
const { getByText } = render(<NsTypography variant={'h1'}>{text}</NsTypography>);
|
|
15
|
-
expect(getByText(text)).toBeInTheDocument();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('2. renders without crashing with p-l variant', () => {
|
|
19
|
-
const text = 'Hello Typo!';
|
|
20
|
-
const { getByText } = render(
|
|
21
|
-
<NsTypography variant="h4" weight="bold" className="mt-2" decoration="underline" color="primary">
|
|
22
|
-
{text}
|
|
23
|
-
</NsTypography>
|
|
24
|
-
);
|
|
25
|
-
expect(getByText(text)).toBeInTheDocument();
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('3. should not render with default color primary when color is passed', () => {
|
|
29
|
-
const text = 'Hello Typo!';
|
|
30
|
-
const { getByText } = render(
|
|
31
|
-
<NsTypography variant="h4" weight="bold" className="mt-2" decoration="underline" color="accentColorA">
|
|
32
|
-
{text}
|
|
33
|
-
</NsTypography>
|
|
34
|
-
);
|
|
35
|
-
expect(getByText(text)).not.toHaveAttribute('color', 'primary');
|
|
36
|
-
});
|
|
37
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { StoryObj, Meta } from '@storybook/react';
|
|
2
|
-
import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
|
|
3
|
-
import { NsTypography } from './';
|
|
4
|
-
|
|
5
|
-
type ComponentType = typeof NsTypography;
|
|
6
|
-
type Story = StoryObj<ComponentType>;
|
|
7
|
-
type MetaStory = Meta<ComponentType>;
|
|
8
|
-
|
|
9
|
-
export default {
|
|
10
|
-
title: 'Components/Data Display/NsTypography',
|
|
11
|
-
component: NsTypography,
|
|
12
|
-
decorators: [withCenterDecorator],
|
|
13
|
-
argTypes: {
|
|
14
|
-
children: {
|
|
15
|
-
control: 'text',
|
|
16
|
-
name: 'Children/Text',
|
|
17
|
-
defaultValue: 'NsTypography',
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
args: {
|
|
21
|
-
children: 'NsTypography',
|
|
22
|
-
color: 'primary',
|
|
23
|
-
renderHTMLNode:true
|
|
24
|
-
},
|
|
25
|
-
} as MetaStory;
|
|
26
|
-
|
|
27
|
-
export const Typography: Story = {};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
PropsWithChildren,
|
|
3
|
-
ReactElement,
|
|
4
|
-
} from 'react';
|
|
5
|
-
|
|
6
|
-
import HtmlTagVariantMapping from './HtmlTagVariantMap';
|
|
7
|
-
import {
|
|
8
|
-
HtmlTagVariant,
|
|
9
|
-
NsTypographyProps,
|
|
10
|
-
} from './types.d';
|
|
11
|
-
import { StyledTypography } from './Typography.styled';
|
|
12
|
-
|
|
13
|
-
const NsTypography = ({
|
|
14
|
-
children,
|
|
15
|
-
weight = 'normal',
|
|
16
|
-
className = '',
|
|
17
|
-
variant = 'body-l',
|
|
18
|
-
decoration = 'none',
|
|
19
|
-
color = 'primary',
|
|
20
|
-
additionalProps = {},
|
|
21
|
-
colorOverride = '',
|
|
22
|
-
noSpacing = false,
|
|
23
|
-
renderHTMLNode,
|
|
24
|
-
}: PropsWithChildren<NsTypographyProps>): ReactElement => {
|
|
25
|
-
const htmlTagVariant: HtmlTagVariant | undefined = renderHTMLNode ? HtmlTagVariantMapping[variant] : undefined;
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<StyledTypography
|
|
29
|
-
noSpacing={noSpacing}
|
|
30
|
-
as={htmlTagVariant}
|
|
31
|
-
className={className}
|
|
32
|
-
weight={weight}
|
|
33
|
-
variant={variant}
|
|
34
|
-
decoration={decoration}
|
|
35
|
-
colorOverride={colorOverride}
|
|
36
|
-
color={color}
|
|
37
|
-
{...additionalProps}
|
|
38
|
-
>
|
|
39
|
-
{children}
|
|
40
|
-
</StyledTypography>
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export default NsTypography;
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import { ColorUtils, FoundationTheme, styled } from '@nuskin/foundation-theme';
|
|
2
|
-
|
|
3
|
-
import { NsTypographyProps } from './types.d';
|
|
4
|
-
|
|
5
|
-
const { paletteColor } = ColorUtils;
|
|
6
|
-
|
|
7
|
-
type TypographyConfig = {
|
|
8
|
-
fontFamily: string;
|
|
9
|
-
fontSize?: number;
|
|
10
|
-
lineHeight?: number;
|
|
11
|
-
letterSpacingPercentage?: number;
|
|
12
|
-
paragraphSpacing?: number;
|
|
13
|
-
fontWeight?: number;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const defaultFont = 'Inter';
|
|
17
|
-
const defaultTypographyStyles = {
|
|
18
|
-
h1: {
|
|
19
|
-
fontFamily: defaultFont,
|
|
20
|
-
fontSize: 42,
|
|
21
|
-
lineHeight: 48,
|
|
22
|
-
letterSpacingPercentage: 0,
|
|
23
|
-
paragraphSpacing: 0,
|
|
24
|
-
},
|
|
25
|
-
h2: {
|
|
26
|
-
fontFamily: defaultFont,
|
|
27
|
-
fontSize: 36,
|
|
28
|
-
lineHeight: 42,
|
|
29
|
-
letterSpacingPercentage: 0,
|
|
30
|
-
paragraphSpacing: 0,
|
|
31
|
-
},
|
|
32
|
-
h3: {
|
|
33
|
-
fontFamily: defaultFont,
|
|
34
|
-
fontSize: 32,
|
|
35
|
-
lineHeight: 38,
|
|
36
|
-
letterSpacingPercentage: 0,
|
|
37
|
-
paragraphSpacing: 0,
|
|
38
|
-
},
|
|
39
|
-
h4: {
|
|
40
|
-
fontFamily: defaultFont,
|
|
41
|
-
fontSize: 26,
|
|
42
|
-
lineHeight: 34,
|
|
43
|
-
letterSpacingPercentage: 0,
|
|
44
|
-
paragraphSpacing: 0,
|
|
45
|
-
},
|
|
46
|
-
h5: {
|
|
47
|
-
fontFamily: defaultFont,
|
|
48
|
-
fontSize: 22,
|
|
49
|
-
lineHeight: 28,
|
|
50
|
-
letterSpacingPercentage: 0,
|
|
51
|
-
fontWeight: 700,
|
|
52
|
-
paragraphSpacing: 0,
|
|
53
|
-
},
|
|
54
|
-
h6: {
|
|
55
|
-
fontFamily: defaultFont,
|
|
56
|
-
fontSize: 18,
|
|
57
|
-
lineHeight: 24,
|
|
58
|
-
letterSpacingPercentage: 0,
|
|
59
|
-
fontWeight: 600,
|
|
60
|
-
paragraphSpacing: 0,
|
|
61
|
-
},
|
|
62
|
-
'title-l': {
|
|
63
|
-
fontFamily: defaultFont,
|
|
64
|
-
fontSize: 22,
|
|
65
|
-
lineHeight: 28,
|
|
66
|
-
letterSpacingPercentage: 2,
|
|
67
|
-
fontWeight: 700,
|
|
68
|
-
paragraphSpacing: 0,
|
|
69
|
-
},
|
|
70
|
-
'title-m': {
|
|
71
|
-
fontFamily: defaultFont,
|
|
72
|
-
fontSize: 16,
|
|
73
|
-
lineHeight: 20,
|
|
74
|
-
letterSpacingPercentage: 4,
|
|
75
|
-
fontWeight: 700,
|
|
76
|
-
paragraphSpacing: 0,
|
|
77
|
-
},
|
|
78
|
-
'title-s': {
|
|
79
|
-
fontFamily: defaultFont,
|
|
80
|
-
fontSize: 16,
|
|
81
|
-
lineHeight: 16,
|
|
82
|
-
letterSpacingPercentage: 4,
|
|
83
|
-
fontWeight: 700,
|
|
84
|
-
paragraphSpacing: 0,
|
|
85
|
-
},
|
|
86
|
-
'label-l': {
|
|
87
|
-
fontFamily: defaultFont,
|
|
88
|
-
fontSize: 20,
|
|
89
|
-
lineHeight: 26,
|
|
90
|
-
letterSpacingPercentage: 0,
|
|
91
|
-
fontWeight: 600,
|
|
92
|
-
paragraphSpacing: 8,
|
|
93
|
-
},
|
|
94
|
-
'label-m': {
|
|
95
|
-
fontFamily: defaultFont,
|
|
96
|
-
fontSize: 16,
|
|
97
|
-
lineHeight: 22,
|
|
98
|
-
letterSpacingPercentage: 0,
|
|
99
|
-
fontWeight: 600,
|
|
100
|
-
paragraphSpacing: 8,
|
|
101
|
-
},
|
|
102
|
-
'label-s': {
|
|
103
|
-
fontFamily: defaultFont,
|
|
104
|
-
fontSize: 14,
|
|
105
|
-
lineHeight: 20,
|
|
106
|
-
letterSpacingPercentage: 0,
|
|
107
|
-
fontWeight: 700,
|
|
108
|
-
paragraphSpacing: 6,
|
|
109
|
-
},
|
|
110
|
-
'body-xl': {
|
|
111
|
-
fontFamily: defaultFont,
|
|
112
|
-
fontSize: 18,
|
|
113
|
-
lineHeight: 22,
|
|
114
|
-
letterSpacingPercentage: 0,
|
|
115
|
-
paragraphSpacing: 22,
|
|
116
|
-
},
|
|
117
|
-
'body-l': {
|
|
118
|
-
fontFamily: defaultFont,
|
|
119
|
-
fontSize: 16,
|
|
120
|
-
lineHeight: 22,
|
|
121
|
-
letterSpacingPercentage: 0,
|
|
122
|
-
paragraphSpacing: 20,
|
|
123
|
-
},
|
|
124
|
-
'body-m': {
|
|
125
|
-
fontFamily: defaultFont,
|
|
126
|
-
fontSize: 14,
|
|
127
|
-
lineHeight: 20,
|
|
128
|
-
letterSpacingPercentage: 0,
|
|
129
|
-
paragraphSpacing: 18,
|
|
130
|
-
},
|
|
131
|
-
'body-s': {
|
|
132
|
-
fontFamily: defaultFont,
|
|
133
|
-
fontSize: 12,
|
|
134
|
-
lineHeight: 16,
|
|
135
|
-
letterSpacingPercentage: 1,
|
|
136
|
-
paragraphSpacing: 16,
|
|
137
|
-
},
|
|
138
|
-
'body-xs': {
|
|
139
|
-
fontFamily: defaultFont,
|
|
140
|
-
fontSize: 10,
|
|
141
|
-
lineHeight: 14,
|
|
142
|
-
letterSpacingPercentage: 2,
|
|
143
|
-
paragraphSpacing: 14,
|
|
144
|
-
},
|
|
145
|
-
CTA: {
|
|
146
|
-
fontFamily: defaultFont,
|
|
147
|
-
fontSize: 14,
|
|
148
|
-
lineHeight: 20,
|
|
149
|
-
letterSpacingPercentage: 0.14,
|
|
150
|
-
fontWeight: 600,
|
|
151
|
-
paragraphSpacing: 0,
|
|
152
|
-
},
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
const fontWeightMap = {
|
|
156
|
-
light: 300,
|
|
157
|
-
normal: 400,
|
|
158
|
-
bold: 600,
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
const getVariantStyle = (
|
|
162
|
-
themeTypographyVariants: Record<FoundationTheme.TypographyVariants, TypographyConfig>,
|
|
163
|
-
variant: FoundationTheme.TypographyVariants
|
|
164
|
-
) => {
|
|
165
|
-
const variantStyles = themeTypographyVariants?.[variant as FoundationTheme.TypographyVariants];
|
|
166
|
-
if (variantStyles) {
|
|
167
|
-
return variantStyles;
|
|
168
|
-
}
|
|
169
|
-
return defaultTypographyStyles[variant as FoundationTheme.TypographyVariants];
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
export const StyledTypography = styled('div')<NsTypographyProps>(
|
|
173
|
-
({ theme, weight, variant, noSpacing, decoration, color, colorOverride }) => {
|
|
174
|
-
const fontStyles: TypographyConfig = getVariantStyle(theme?.fonts?.typographyVariants, variant) || {};
|
|
175
|
-
if (noSpacing) {
|
|
176
|
-
fontStyles.paragraphSpacing = 0;
|
|
177
|
-
}
|
|
178
|
-
if (weight) {
|
|
179
|
-
fontStyles.fontWeight = fontWeightMap[weight] || fontWeightMap.normal;
|
|
180
|
-
}
|
|
181
|
-
const updatedFontStyle = {
|
|
182
|
-
fontFamily: fontStyles?.fontFamily || defaultFont,
|
|
183
|
-
fontSize: `${fontStyles?.fontSize || 16}px`,
|
|
184
|
-
lineHeight: `${fontStyles?.lineHeight || 16}px`,
|
|
185
|
-
margin: fontStyles?.paragraphSpacing || 0,
|
|
186
|
-
fontWeight: fontStyles?.fontWeight || 400,
|
|
187
|
-
letterSpacing: fontStyles?.letterSpacingPercentage || 0,
|
|
188
|
-
};
|
|
189
|
-
return {
|
|
190
|
-
...updatedFontStyle,
|
|
191
|
-
textDecorationLine: decoration,
|
|
192
|
-
color: colorOverride?.startsWith('#') ? colorOverride : paletteColor(color)({ theme }),
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
);
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`GlobalFontInter 0. should match snapshot 1`] = `
|
|
4
|
-
.emotion-0 {
|
|
5
|
-
font-family: Inter;
|
|
6
|
-
font-size: 42px;
|
|
7
|
-
line-height: 48px;
|
|
8
|
-
margin: 0;
|
|
9
|
-
font-weight: 400;
|
|
10
|
-
letter-spacing: 0;
|
|
11
|
-
text-decoration-line: none;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
<div>
|
|
15
|
-
<div
|
|
16
|
-
class=" emotion-0"
|
|
17
|
-
color="primary"
|
|
18
|
-
>
|
|
19
|
-
Hello Typo!
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
`;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { FoundationTheme } from '@nuskin/foundation-theme';
|
|
2
|
-
import { AdditionalProps } from '../common.types';
|
|
3
|
-
|
|
4
|
-
export type Variants =
|
|
5
|
-
| 'h1'
|
|
6
|
-
| 'h2'
|
|
7
|
-
| 'h3'
|
|
8
|
-
| 'h4'
|
|
9
|
-
| 'h5'
|
|
10
|
-
| 'h6'
|
|
11
|
-
| 'title-l'
|
|
12
|
-
| 'title-m'
|
|
13
|
-
| 'title-s'
|
|
14
|
-
| 'label-l'
|
|
15
|
-
| 'label-m'
|
|
16
|
-
| 'label-s'
|
|
17
|
-
| 'body-xl'
|
|
18
|
-
| 'body-l'
|
|
19
|
-
| 'body-m'
|
|
20
|
-
| 'body-s'
|
|
21
|
-
| 'body-xs'
|
|
22
|
-
| 'CTA';
|
|
23
|
-
|
|
24
|
-
export type HtmlTagVariant = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span' | 'p' | 'label';
|
|
25
|
-
|
|
26
|
-
export type NsTypographyProps = {
|
|
27
|
-
variant: Variants;
|
|
28
|
-
decoration?: 'underline' | 'none';
|
|
29
|
-
weight?: 'bold' | 'normal' | 'light';
|
|
30
|
-
color?: FoundationTheme.PaletteColors;
|
|
31
|
-
component?: 'div' | 'span' | 'p';
|
|
32
|
-
as?: HtmlTagVariant;
|
|
33
|
-
className?: string;
|
|
34
|
-
colorOverride?: string;
|
|
35
|
-
renderHTMLNode?: boolean;
|
|
36
|
-
noSpacing?:boolean;
|
|
37
|
-
} & AdditionalProps;
|
package/src/common/util.ts
DELETED