@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,72 +0,0 @@
|
|
|
1
|
-
import React, { ReactElement, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
import { NsInputField } from '../input';
|
|
4
|
-
import { fieldStateType } from '../input/types';
|
|
5
|
-
import { emailPattern } from '../validations/regex';
|
|
6
|
-
import { NsEmailSimpleProps } from './types';
|
|
7
|
-
|
|
8
|
-
const NsEmailSimple = (props: NsEmailSimpleProps): ReactElement => {
|
|
9
|
-
const {
|
|
10
|
-
disabled,
|
|
11
|
-
label,
|
|
12
|
-
required,
|
|
13
|
-
maxLength,
|
|
14
|
-
invalidEmailMessage,
|
|
15
|
-
dupedEmailMessage,
|
|
16
|
-
requiredErrorMessage,
|
|
17
|
-
checkEmail,
|
|
18
|
-
additionalProps,
|
|
19
|
-
} = props;
|
|
20
|
-
const [fieldState, setFieldState] = useState<fieldStateType>();
|
|
21
|
-
const [errorMsg, setErrorMessage] = useState('');
|
|
22
|
-
|
|
23
|
-
const handleBlur = async (e: React.FocusEvent<HTMLInputElement>) => {
|
|
24
|
-
const emailInput = e.target.value.toLowerCase().trim();
|
|
25
|
-
let fieldStateValue: fieldStateType;
|
|
26
|
-
let errorMessageValue = '';
|
|
27
|
-
if (required && !emailInput) {
|
|
28
|
-
fieldStateValue = 'error';
|
|
29
|
-
errorMessageValue = requiredErrorMessage;
|
|
30
|
-
} else if (!emailPattern.test(emailInput)) {
|
|
31
|
-
fieldStateValue = 'error';
|
|
32
|
-
errorMessageValue = invalidEmailMessage;
|
|
33
|
-
} else if (typeof checkEmail === 'function') {
|
|
34
|
-
try {
|
|
35
|
-
const [isValid, isAvailable] = await checkEmail();
|
|
36
|
-
if (!isValid) {
|
|
37
|
-
fieldStateValue = 'error';
|
|
38
|
-
errorMessageValue = invalidEmailMessage;
|
|
39
|
-
} else if (!isAvailable) {
|
|
40
|
-
fieldStateValue = 'error';
|
|
41
|
-
errorMessageValue = dupedEmailMessage;
|
|
42
|
-
} else {
|
|
43
|
-
fieldStateValue = undefined;
|
|
44
|
-
errorMessageValue = '';
|
|
45
|
-
}
|
|
46
|
-
} catch (error) {
|
|
47
|
-
console.error('API error', error);
|
|
48
|
-
}
|
|
49
|
-
} else {
|
|
50
|
-
//TODO What happens when user does not pass valid checkEmail function
|
|
51
|
-
}
|
|
52
|
-
setFieldState(fieldStateValue);
|
|
53
|
-
setErrorMessage(errorMessageValue);
|
|
54
|
-
};
|
|
55
|
-
return (
|
|
56
|
-
<NsInputField
|
|
57
|
-
required={required}
|
|
58
|
-
disabled={disabled}
|
|
59
|
-
label={label}
|
|
60
|
-
onBlur={handleBlur}
|
|
61
|
-
inputProps={{ maxLength }}
|
|
62
|
-
additionalProps={{ testid: additionalProps?.testid ?? 'email-field-test' }}
|
|
63
|
-
helperText={errorMsg}
|
|
64
|
-
fieldState={fieldState}
|
|
65
|
-
InputProps={{
|
|
66
|
-
endAdornment: null,
|
|
67
|
-
}}
|
|
68
|
-
/>
|
|
69
|
-
);
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export default NsEmailSimple;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { TextFieldProps } from '@mui/material';
|
|
2
|
-
import { AdditionalProps } from '../common.types';
|
|
3
|
-
|
|
4
|
-
export type NsEmailSimpleProps = Pick<TextFieldProps> &
|
|
5
|
-
AdditionalProps & {
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
label?: string;
|
|
8
|
-
required?: boolean;
|
|
9
|
-
maxLength?: number;
|
|
10
|
-
invalidEmailText?: string;
|
|
11
|
-
dupedEmailText?: string;
|
|
12
|
-
requiredErrorMessage?: string;
|
|
13
|
-
checkEmail?: Function;
|
|
14
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { render } from '@/test-utils/index';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
import { NsFlag } from '../';
|
|
5
|
-
|
|
6
|
-
describe('FlagComponent', () => {
|
|
7
|
-
it('1. renders a div element with background color and text', () => {
|
|
8
|
-
const text = 'NU SKIN';
|
|
9
|
-
const { getByText } = render(<NsFlag message="NU SKIN" color="accentColorA" />);
|
|
10
|
-
const divElement = getByText(text);
|
|
11
|
-
|
|
12
|
-
expect(divElement).toBeInTheDocument();
|
|
13
|
-
expect(divElement).toHaveTextContent(text);
|
|
14
|
-
});
|
|
15
|
-
it('2. should render a flag with default size, color, and testId when only message prop is provided', () => {
|
|
16
|
-
const props = {
|
|
17
|
-
message: 'Test Message',
|
|
18
|
-
};
|
|
19
|
-
const { getByTestId } = render(<NsFlag {...props} />);
|
|
20
|
-
const flag = getByTestId('ns-flag-component');
|
|
21
|
-
expect(flag).toBeInTheDocument();
|
|
22
|
-
expect(flag).toHaveStyle('height: 20px');
|
|
23
|
-
expect(flag).toHaveStyle('color: #ffffff');
|
|
24
|
-
expect(flag).toHaveStyle('background: #f56767');
|
|
25
|
-
expect(flag).toHaveTextContent(props.message);
|
|
26
|
-
});
|
|
27
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { StoryObj, Meta } from '@storybook/react';
|
|
2
|
-
import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
|
|
3
|
-
import { NsFlag } from './';
|
|
4
|
-
|
|
5
|
-
type ComponentType = typeof NsFlag;
|
|
6
|
-
type Story = StoryObj<ComponentType>;
|
|
7
|
-
type MetaStory = Meta<ComponentType>;
|
|
8
|
-
|
|
9
|
-
export default {
|
|
10
|
-
title: 'Components/Data Display/NsFlag',
|
|
11
|
-
component: NsFlag,
|
|
12
|
-
decorators: [withCenterDecorator],
|
|
13
|
-
argTypes: {
|
|
14
|
-
color: { name: 'Color Variants' },
|
|
15
|
-
},
|
|
16
|
-
args: {
|
|
17
|
-
message: 'Nuskin',
|
|
18
|
-
color: 'accentColorA',
|
|
19
|
-
},
|
|
20
|
-
} as MetaStory;
|
|
21
|
-
|
|
22
|
-
export const Flags: Story = {};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author [vijayaprathap Kumar] (vpkumar@nuskin.com)
|
|
3
|
-
* Flag.styled.tsx
|
|
4
|
-
@description Styled Components for Flag
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { Theme } from '@mui/material';
|
|
8
|
-
import { styled, ColorUtils, FoundationTheme } from '@nuskin/foundation-theme';
|
|
9
|
-
|
|
10
|
-
import { NsFlagSize } from './types.d';
|
|
11
|
-
|
|
12
|
-
const { paletteColor } = ColorUtils;
|
|
13
|
-
|
|
14
|
-
type NsFlagThemeParams = {
|
|
15
|
-
$size: NsFlagSize;
|
|
16
|
-
$bgColor?: FoundationTheme.PaletteColors;
|
|
17
|
-
theme?: Theme;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
// Scale value used to divide size from props for create tag tail as per Flag width and height;
|
|
21
|
-
const FLAG_SCALE_VALUE = 2;
|
|
22
|
-
|
|
23
|
-
const FlagHeightMap = {
|
|
24
|
-
small: 20,
|
|
25
|
-
medium: 24,
|
|
26
|
-
large: 28,
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const getFlagHeight = ({ $size }: { $size: NsFlagSize }) => {
|
|
30
|
-
return FlagHeightMap[$size];
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const makeFlagSize = ({ $size }: { $size: NsFlagSize }) => {
|
|
34
|
-
const sizeValue = getFlagHeight({ $size });
|
|
35
|
-
return sizeValue / FLAG_SCALE_VALUE;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const makeFlagBorder = ({ $size, $bgColor = 'accentColorA', theme }: NsFlagThemeParams) => {
|
|
39
|
-
return `${makeFlagSize({ $size })}px solid ${paletteColor($bgColor)({ theme })}`;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export const StyledFlag = styled('span')<NsFlagThemeParams>`
|
|
43
|
-
min-width: 29px;
|
|
44
|
-
height: ${getFlagHeight}px;
|
|
45
|
-
color: ${({ $bgColor = 'accentColorA', theme }) => paletteColor($bgColor, 'contrastText')({ theme })};
|
|
46
|
-
background: ${({ $bgColor = 'accentColorA', theme }) => paletteColor($bgColor)({ theme })};
|
|
47
|
-
position: relative;
|
|
48
|
-
padding: 0 15px;
|
|
49
|
-
display: inline-grid;
|
|
50
|
-
align-content: space-around;
|
|
51
|
-
:before {
|
|
52
|
-
position: absolute;
|
|
53
|
-
top: 0;
|
|
54
|
-
right: -${makeFlagSize}px;
|
|
55
|
-
content: '';
|
|
56
|
-
width: 0;
|
|
57
|
-
height: 0;
|
|
58
|
-
display: block;
|
|
59
|
-
border-right: ${makeFlagSize}px solid transparent;
|
|
60
|
-
border-top: ${makeFlagBorder};
|
|
61
|
-
}
|
|
62
|
-
:after {
|
|
63
|
-
position: absolute;
|
|
64
|
-
top: 0;
|
|
65
|
-
right: -${makeFlagSize}px;
|
|
66
|
-
content: '';
|
|
67
|
-
width: 0;
|
|
68
|
-
height: ${makeFlagSize}px;
|
|
69
|
-
display: block;
|
|
70
|
-
border-right: ${makeFlagSize}px solid transparent;
|
|
71
|
-
border-bottom: ${makeFlagBorder};
|
|
72
|
-
}
|
|
73
|
-
`;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author [Vijayaprathap Kumar] (vpkumar@nuskin.com)
|
|
3
|
-
* flag.tsx
|
|
4
|
-
* @description NsFlag component with a themed background
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React, { PropsWithChildren, ReactElement } from 'react';
|
|
8
|
-
|
|
9
|
-
import { StyledFlag } from './NsFlag.styled';
|
|
10
|
-
import { NsFlagProps } from './types.d';
|
|
11
|
-
|
|
12
|
-
const NsFlag = (props: PropsWithChildren<NsFlagProps>): ReactElement | null => {
|
|
13
|
-
const { className = '', size = 'small', color = 'accentColorA', message, testId = 'ns-flag-component' } = props;
|
|
14
|
-
if (!message) {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
return (
|
|
18
|
-
<StyledFlag $size={size} $bgColor={color} data-testid={testId} className={className}>
|
|
19
|
-
{message}
|
|
20
|
-
</StyledFlag>
|
|
21
|
-
);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export default NsFlag;
|
package/src/common/flag/index.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description Extend the FlagProps interface to include message, color and size prop.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { FoundationTheme } from '@nuskin/foundation-theme';
|
|
6
|
-
|
|
7
|
-
export type NsFlagSize = 'small' | 'medium' | 'large';
|
|
8
|
-
|
|
9
|
-
export type NsFlagProps = {
|
|
10
|
-
className?: string;
|
|
11
|
-
size?: NsFlagSize;
|
|
12
|
-
message?: string;
|
|
13
|
-
testId?: string;
|
|
14
|
-
/** Displays background color for flag container */
|
|
15
|
-
color?: FoundationTheme.PaletteColors;
|
|
16
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { renderHook, act } from '@testing-library/react-hooks';
|
|
2
|
-
import useWindowSize from '../useWindowSize';
|
|
3
|
-
|
|
4
|
-
describe('useWindowSize', () => {
|
|
5
|
-
it('should return the window size', () => {
|
|
6
|
-
const { result } = renderHook(useWindowSize);
|
|
7
|
-
expect(result.current).toEqual({ width: window.innerWidth, height: window.innerHeight });
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
it('should update the window size when the window is resized', () => {
|
|
11
|
-
const { result } = renderHook(() => useWindowSize());
|
|
12
|
-
act(() => {
|
|
13
|
-
window.innerWidth = 500;
|
|
14
|
-
window.innerHeight = 500;
|
|
15
|
-
window.dispatchEvent(new Event('resize'));
|
|
16
|
-
});
|
|
17
|
-
expect(result.current).toEqual({ width: 500, height: 500 });
|
|
18
|
-
});
|
|
19
|
-
});
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { useCallback, useEffect, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
type ItemMap = Record<string, boolean>;
|
|
4
|
-
type UseAccordionProp = {
|
|
5
|
-
allowMultipleExpanded?: boolean;
|
|
6
|
-
defaultOpenIds?: string[];
|
|
7
|
-
};
|
|
8
|
-
const reducer = (map: ItemMap, id: string) => {
|
|
9
|
-
map[id] = true;
|
|
10
|
-
return map;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const useAccordionMap = ({ allowMultipleExpanded, defaultOpenIds }: UseAccordionProp) => {
|
|
14
|
-
const mapSetter = useCallback(() => {
|
|
15
|
-
let ids = defaultOpenIds;
|
|
16
|
-
if (!allowMultipleExpanded) {
|
|
17
|
-
ids = ids?.slice(0, 1) ?? [];
|
|
18
|
-
}
|
|
19
|
-
return ids?.reduce(reducer, {}) ?? {};
|
|
20
|
-
}, [defaultOpenIds, allowMultipleExpanded]);
|
|
21
|
-
|
|
22
|
-
const [itemStateMap, setItemMap] = useState<ItemMap>(mapSetter);
|
|
23
|
-
|
|
24
|
-
const toggleOpen = (index: string | number) => {
|
|
25
|
-
const key = index + '';
|
|
26
|
-
if (allowMultipleExpanded) {
|
|
27
|
-
setItemMap((prevState) => ({ ...prevState, [key]: !prevState[key] }));
|
|
28
|
-
} else {
|
|
29
|
-
setItemMap({ [key]: !itemStateMap[index] });
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
setItemMap(mapSetter);
|
|
35
|
-
}, [mapSetter]);
|
|
36
|
-
return { itemStateMap, toggleOpen };
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export default useAccordionMap;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
|
|
3
|
-
export type Handler = () => void;
|
|
4
|
-
|
|
5
|
-
export function useOnClickOutside(
|
|
6
|
-
element: HTMLDivElement | null,
|
|
7
|
-
handler: Handler = () => {},
|
|
8
|
-
mouseEvent: 'click' | 'mousedown' | 'mouseup' = 'click'
|
|
9
|
-
): void {
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
const eventListener = (event: MouseEvent) => {
|
|
12
|
-
// Do nothing if clicking ref's element or descendent elements
|
|
13
|
-
if (!element || element.contains(event.target as Node)) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
handler?.();
|
|
17
|
-
};
|
|
18
|
-
if (document) {
|
|
19
|
-
document.addEventListener(mouseEvent, eventListener);
|
|
20
|
-
return () => {
|
|
21
|
-
document.removeEventListener(mouseEvent, eventListener);
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
}, [mouseEvent, handler, element]);
|
|
25
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect } from 'react';
|
|
2
|
-
|
|
3
|
-
const useWindowSize = () => {
|
|
4
|
-
const [windowSize, setWindowSize] = useState({
|
|
5
|
-
width: window.innerWidth,
|
|
6
|
-
height: window.innerHeight,
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
function handleResize() {
|
|
11
|
-
setWindowSize({
|
|
12
|
-
width: window?.innerWidth || 300,
|
|
13
|
-
height: window?.innerHeight || 300,
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
if (typeof window !== 'undefined') {
|
|
17
|
-
window.addEventListener('resize', handleResize);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return () => {
|
|
21
|
-
if (typeof window !== 'undefined') {
|
|
22
|
-
window.removeEventListener('resize', handleResize);
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
}, []);
|
|
26
|
-
|
|
27
|
-
return windowSize;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export default useWindowSize;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { render, screen } from '@/test-utils/index';
|
|
4
|
-
import { fireEvent } from '@storybook/testing-library';
|
|
5
|
-
|
|
6
|
-
import { NsIcon, NsIconNameType, NsIconVariants } from './';
|
|
7
|
-
|
|
8
|
-
describe('NsIcon Component', () => {
|
|
9
|
-
it('1. renders cartBadge icon with custom size and color', () => {
|
|
10
|
-
const { getByTestId } = render(<NsIcon name="cart" size={'medium'} color="secondary" />);
|
|
11
|
-
const icon = getByTestId('icon');
|
|
12
|
-
const svgIcon = icon.querySelector('svg');
|
|
13
|
-
// expect(svgIcon).toHaveClass('MuiSvgIcon-colorSecondary');
|
|
14
|
-
expect(svgIcon).toHaveClass('MuiSvgIcon-fontSizeMedium');
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it('2. renders with testId', () => {
|
|
18
|
-
Object.keys(NsIconVariants).forEach((iconName) => {
|
|
19
|
-
render(<NsIcon name={iconName as NsIconNameType} />);
|
|
20
|
-
const icon = screen.getByTestId(iconName);
|
|
21
|
-
expect(icon).toBeInTheDocument();
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
it('3. renders with custom testId', () => {
|
|
25
|
-
const { getByTestId } = render(<NsIcon name="cart" testId="custom-icon" />);
|
|
26
|
-
const icon = getByTestId('custom-icon');
|
|
27
|
-
expect(icon).toBeInTheDocument();
|
|
28
|
-
expect(icon.innerHTML).toContain('svg');
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('4. throws an error if invalid icon name is provided', () => {
|
|
32
|
-
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
|
33
|
-
const { queryByTestId } = render(<NsIcon name="invalidIcon" />);
|
|
34
|
-
expect(queryByTestId('icon')).not.toBeInTheDocument();
|
|
35
|
-
expect(consoleErrorSpy).not.toHaveBeenCalled();
|
|
36
|
-
consoleErrorSpy.mockRestore();
|
|
37
|
-
});
|
|
38
|
-
it('5. renders default color of alertErrorIcon', () => {
|
|
39
|
-
const { getByTestId } = render(<NsIcon name="alertError" size={'medium'} />);
|
|
40
|
-
const icon = getByTestId('alertError');
|
|
41
|
-
expect(icon).toBeInTheDocument();
|
|
42
|
-
});
|
|
43
|
-
it('6. calls onClick event handler', () => {
|
|
44
|
-
const onClick = jest.fn();
|
|
45
|
-
const { getByTestId } = render(<NsIcon name="alertError" size="medium" onClick={onClick} />);
|
|
46
|
-
const icon = getByTestId('alertError');
|
|
47
|
-
expect(icon).toBeInTheDocument();
|
|
48
|
-
fireEvent.click(icon);
|
|
49
|
-
expect(onClick).toHaveBeenCalled();
|
|
50
|
-
});
|
|
51
|
-
});
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { PaletteColors } from '@nuskin/foundation-theme';
|
|
2
|
-
|
|
3
|
-
import type { StoryObj, Meta } from '@storybook/react';
|
|
4
|
-
import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
|
|
5
|
-
import { NsIcon, NsIconVariants } from './';
|
|
6
|
-
|
|
7
|
-
type ComponentType = typeof NsIcon;
|
|
8
|
-
type Story = StoryObj<ComponentType>;
|
|
9
|
-
type MetaStory = Meta<ComponentType>;
|
|
10
|
-
|
|
11
|
-
export default {
|
|
12
|
-
title: 'Icons/NsIcon',
|
|
13
|
-
component: NsIcon,
|
|
14
|
-
decorators: [withCenterDecorator],
|
|
15
|
-
argTypes: {
|
|
16
|
-
size: { control: 'select', options: ['small', 'medium', 'large', 'xLarge'] },
|
|
17
|
-
name: {
|
|
18
|
-
control: 'select',
|
|
19
|
-
options: Object.keys(NsIconVariants),
|
|
20
|
-
},
|
|
21
|
-
color: {
|
|
22
|
-
control: 'select',
|
|
23
|
-
options: PaletteColors,
|
|
24
|
-
},
|
|
25
|
-
colorOverride: {
|
|
26
|
-
control: 'color',
|
|
27
|
-
},
|
|
28
|
-
cursor: {
|
|
29
|
-
control: 'select',
|
|
30
|
-
options: [
|
|
31
|
-
'auto',
|
|
32
|
-
'default',
|
|
33
|
-
'none',
|
|
34
|
-
'context-menu',
|
|
35
|
-
'help',
|
|
36
|
-
'pointer',
|
|
37
|
-
'progress',
|
|
38
|
-
'wait',
|
|
39
|
-
'cell',
|
|
40
|
-
'crosshair',
|
|
41
|
-
'text',
|
|
42
|
-
'vertical-text',
|
|
43
|
-
'alias',
|
|
44
|
-
'copy',
|
|
45
|
-
'move',
|
|
46
|
-
'no-drop',
|
|
47
|
-
'not-allowed',
|
|
48
|
-
'grab',
|
|
49
|
-
'grabbing',
|
|
50
|
-
'e-resize',
|
|
51
|
-
'n-resize',
|
|
52
|
-
'ne-resize',
|
|
53
|
-
'nw-resize',
|
|
54
|
-
's-resize',
|
|
55
|
-
'se-resize',
|
|
56
|
-
'sw-resize',
|
|
57
|
-
'w-resize',
|
|
58
|
-
'ew-resize',
|
|
59
|
-
'ns-resize',
|
|
60
|
-
'nesw-resize',
|
|
61
|
-
'nwse-resize',
|
|
62
|
-
'col-resize',
|
|
63
|
-
'row-resize',
|
|
64
|
-
'all-scroll',
|
|
65
|
-
'zoom-in',
|
|
66
|
-
'zoom-out',
|
|
67
|
-
],
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
args: {
|
|
71
|
-
size: 'large',
|
|
72
|
-
name: 'checkShield',
|
|
73
|
-
color: 'success',
|
|
74
|
-
},
|
|
75
|
-
} as MetaStory;
|
|
76
|
-
|
|
77
|
-
export const Icon: Story = {};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { styled } from '@nuskin/foundation-theme';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
NsIconProps,
|
|
5
|
-
NsIconSizeType,
|
|
6
|
-
} from './types.d';
|
|
7
|
-
|
|
8
|
-
export const iconSize: Record<NsIconSizeType, string> = {
|
|
9
|
-
small: '16px',
|
|
10
|
-
medium: '20px',
|
|
11
|
-
large: '24px',
|
|
12
|
-
xLarge: '30px',
|
|
13
|
-
};
|
|
14
|
-
type IconWrapperType = { size: NsIconSizeType; cursor: NsIconProps['cursor'] };
|
|
15
|
-
|
|
16
|
-
export const IconWrapper = styled('span')<IconWrapperType>(({ size, cursor }) => {
|
|
17
|
-
return {
|
|
18
|
-
display: 'flex',
|
|
19
|
-
placeContent: 'center',
|
|
20
|
-
placeItems: 'center',
|
|
21
|
-
cursor,
|
|
22
|
-
svg: {
|
|
23
|
-
width: iconSize[size],
|
|
24
|
-
height: iconSize[size],
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
});
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
|
|
3
|
-
import { useTheme } from '@mui/material';
|
|
4
|
-
import { ColorUtils } from '@nuskin/foundation-theme';
|
|
5
|
-
|
|
6
|
-
import { IconWrapper } from './NsIcon.styled';
|
|
7
|
-
import IconVariants from './NsIconVariants';
|
|
8
|
-
import { NsIconNameType, NsIconProps } from './types.d';
|
|
9
|
-
|
|
10
|
-
const { paletteColor } = ColorUtils;
|
|
11
|
-
|
|
12
|
-
const NsIcon = ({
|
|
13
|
-
name,
|
|
14
|
-
size,
|
|
15
|
-
color = 'primary',
|
|
16
|
-
testId = 'icon',
|
|
17
|
-
className,
|
|
18
|
-
colorOverride,
|
|
19
|
-
onClick = () => {},
|
|
20
|
-
cursor = 'pointer',
|
|
21
|
-
...rest
|
|
22
|
-
}: NsIconProps): ReactElement | null => {
|
|
23
|
-
const Icon = IconVariants[name as NsIconNameType];
|
|
24
|
-
const theme = useTheme();
|
|
25
|
-
const iconColor = paletteColor(color)({ theme });
|
|
26
|
-
if (!Icon) {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<IconWrapper
|
|
32
|
-
{...rest}
|
|
33
|
-
data-testid={testId}
|
|
34
|
-
size={size || 'large'}
|
|
35
|
-
className={className}
|
|
36
|
-
onClick={onClick}
|
|
37
|
-
cursor={cursor}
|
|
38
|
-
>
|
|
39
|
-
<Icon color={colorOverride ? colorOverride : (iconColor as any)} />
|
|
40
|
-
</IconWrapper>
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export default NsIcon;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import ArrowDown from './icons/ArrowDown';
|
|
2
|
-
import ArrowUp from './icons/ArrowUp';
|
|
3
|
-
import ArrowLeft from './icons/ArrowLeft';
|
|
4
|
-
import ArrowRight from './icons/ArrowRight';
|
|
5
|
-
import Cart from './icons/Cart';
|
|
6
|
-
import CartBadge from './icons/CartBadge';
|
|
7
|
-
import InfoFilled from './icons/InfoFilled';
|
|
8
|
-
import InfoOutlined from './icons/InfoOutlined';
|
|
9
|
-
import CheckShield from './icons/CheckShield';
|
|
10
|
-
import CheckVerified from './icons/CheckVerified';
|
|
11
|
-
import SuccessIcon from './icons/SuccessIcon';
|
|
12
|
-
import ErrorIcon from './icons/ErrorIcon';
|
|
13
|
-
import TrashIcon from './icons/TrashIcon';
|
|
14
|
-
import SearchIcon from './icons/SearchIcon';
|
|
15
|
-
import SlashIcon from './icons/SlashIcon';
|
|
16
|
-
import Home from './icons/home';
|
|
17
|
-
import AlertErrorIcon from './icons/AlertErrorIcon';
|
|
18
|
-
import WarningIcon from './icons/WarningIcon';
|
|
19
|
-
import CloseIcon from './icons/CloseIcon';
|
|
20
|
-
import UserIcon from './icons/UserIcon';
|
|
21
|
-
import HamburgerIcon from './icons/HamburgerIcon';
|
|
22
|
-
import UserOutline from './icons/UserOutline';
|
|
23
|
-
import Check from './icons/Check';
|
|
24
|
-
import RoundedClose from './icons/RoundedClose';
|
|
25
|
-
import ChevronRight from './icons/ChevronRight';
|
|
26
|
-
|
|
27
|
-
const IconVariants = {
|
|
28
|
-
arrowDown: ArrowDown,
|
|
29
|
-
arrowUp: ArrowUp,
|
|
30
|
-
arrowLeft: ArrowLeft,
|
|
31
|
-
arrowRight: ArrowRight,
|
|
32
|
-
alertError: AlertErrorIcon,
|
|
33
|
-
cart: Cart,
|
|
34
|
-
cartBadge: CartBadge,
|
|
35
|
-
close: CloseIcon,
|
|
36
|
-
check: Check,
|
|
37
|
-
checkShield: CheckShield,
|
|
38
|
-
checkVerified: CheckVerified,
|
|
39
|
-
error: ErrorIcon,
|
|
40
|
-
hamburgerIcon: HamburgerIcon,
|
|
41
|
-
home: Home,
|
|
42
|
-
infoFilled: InfoFilled,
|
|
43
|
-
infoOutlined: InfoOutlined,
|
|
44
|
-
search: SearchIcon,
|
|
45
|
-
success: SuccessIcon,
|
|
46
|
-
slash: SlashIcon,
|
|
47
|
-
trash: TrashIcon,
|
|
48
|
-
userIcon: UserIcon,
|
|
49
|
-
userOutline: UserOutline,
|
|
50
|
-
warning: WarningIcon,
|
|
51
|
-
roundedClose: RoundedClose,
|
|
52
|
-
chevronRight: ChevronRight,
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export default IconVariants;
|
|
56
|
-
export const isValidIconName = (name: string) => Object.keys(IconVariants).includes(name);
|