@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,22 +0,0 @@
|
|
|
1
|
-
import { render, screen } from '@testing-library/react';
|
|
2
|
-
import { RenderBrand } from '../RenderBrand';
|
|
3
|
-
|
|
4
|
-
const mockEntry = {
|
|
5
|
-
title: 'Epoch',
|
|
6
|
-
backgroundImage: 'https://media.nuskin.com/m/549aa3e5184434d8/webimage-brand-epoch-optweb.png',
|
|
7
|
-
brandImage: 'https://media.nuskin.com/m/63a454ff90d038b4/webimage-brand-epoch.png',
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const mockIndex = 0;
|
|
11
|
-
|
|
12
|
-
describe('RenderBrand function', () => {
|
|
13
|
-
it('should render a BrandProductCard component with given props', () => {
|
|
14
|
-
render(RenderBrand(mockEntry, mockIndex));
|
|
15
|
-
|
|
16
|
-
const card = screen.getByRole('brand-card');
|
|
17
|
-
const title = screen.getByText(mockEntry.title);
|
|
18
|
-
|
|
19
|
-
expect(card).toBeInTheDocument();
|
|
20
|
-
expect(title).toBeInTheDocument();
|
|
21
|
-
});
|
|
22
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
|
|
3
|
-
import { NsCarousal } from '@/common/';
|
|
4
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
|
-
|
|
6
|
-
import { brandEntries } from '../../card/stories/data';
|
|
7
|
-
import { RenderBrand } from '../RenderBrand';
|
|
8
|
-
import settings from '../slickSetting';
|
|
9
|
-
|
|
10
|
-
type ComponentType = typeof NsCarousal;
|
|
11
|
-
type Story = StoryObj<ComponentType>;
|
|
12
|
-
type MetaStory = Meta<ComponentType>;
|
|
13
|
-
|
|
14
|
-
export default {
|
|
15
|
-
title: 'Components/Containers/NsCarousal/Brand',
|
|
16
|
-
component: NsCarousal,
|
|
17
|
-
argTypes: {},
|
|
18
|
-
decorators: [
|
|
19
|
-
(Story): ReactElement => (
|
|
20
|
-
<div style={{ width: 800 }}>
|
|
21
|
-
<Story />
|
|
22
|
-
</div>
|
|
23
|
-
),
|
|
24
|
-
],
|
|
25
|
-
} as MetaStory;
|
|
26
|
-
|
|
27
|
-
export const Default: Story = {
|
|
28
|
-
args: {
|
|
29
|
-
entries: brandEntries,
|
|
30
|
-
renderEntry: RenderBrand,
|
|
31
|
-
allEntryLink: '',
|
|
32
|
-
settings: settings,
|
|
33
|
-
},
|
|
34
|
-
};
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
|
|
3
|
-
import { NsScrollingCarousal, NsTextStrip } from '@/common/';
|
|
4
|
-
import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
|
|
5
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
6
|
-
|
|
7
|
-
type ComponentType = typeof NsScrollingCarousal;
|
|
8
|
-
type Story = StoryObj<ComponentType>;
|
|
9
|
-
type MetaStory = Meta<ComponentType>;
|
|
10
|
-
|
|
11
|
-
const renderSlide = (slide: any, i: number): ReactElement => <NsTextStrip key={i} {...slide} />;
|
|
12
|
-
|
|
13
|
-
const slides = [
|
|
14
|
-
{
|
|
15
|
-
description: 'Download the app to access everything Nike',
|
|
16
|
-
link: { href: 'https://www.nike.com/in/help/a/shipping-delivery-gs', title: 'Hello Nike App' },
|
|
17
|
-
alignment: 'center',
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
description: '',
|
|
21
|
-
link: {
|
|
22
|
-
href: 'https://www.nike.com/in/help/a/shipping-delivery-gs',
|
|
23
|
-
title: 'Shop All Our New Markdowns, New Styles on Sale: Up to 40% Off (empty description)',
|
|
24
|
-
},
|
|
25
|
-
alignment: 'center',
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
// description: 'Applies to orders of ₹ 14 000.00 or more. ',
|
|
29
|
-
link: { href: 'https://www.nike.com/in/help/a/shipping-delivery-gs', title: 'Free Delivery' },
|
|
30
|
-
alignment: 'center',
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
description:
|
|
34
|
-
'Download the app to access everything Nike Download the app to access everything Nike Download the app to access everything Nike Download the app to access everything Nike',
|
|
35
|
-
link: {
|
|
36
|
-
href: 'https://www.nike.com/in/help/a/shipping-delivery-gs',
|
|
37
|
-
title: ' Hello Nike AppHello Nike App Hello Nike App Hello Nike App',
|
|
38
|
-
},
|
|
39
|
-
alignment: 'center',
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
description: '',
|
|
43
|
-
link: {
|
|
44
|
-
href: 'https://www.nike.com/in/help/a/shipping-delivery-gs',
|
|
45
|
-
title: 'Shop All Our New Markdowns, New Styles on Sale: Up to 40% Off (empty description)',
|
|
46
|
-
},
|
|
47
|
-
alignment: 'center',
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
link: { href: 'https://www.nike.com/in/help/a/shipping-delivery-gs', title: 'Free Delivery' },
|
|
51
|
-
alignment: 'center',
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
description: 'Empty href Empty href Empty href Empty href Empty href Empty href Empty href Empty href',
|
|
55
|
-
link: { href: '', title: '' },
|
|
56
|
-
alignment: 'center',
|
|
57
|
-
},
|
|
58
|
-
];
|
|
59
|
-
export default {
|
|
60
|
-
title: 'Components/Containers/NsCarousal/NsScrollingCarousal',
|
|
61
|
-
component: NsScrollingCarousal,
|
|
62
|
-
decorators: [withCenterDecorator],
|
|
63
|
-
argTypes: {},
|
|
64
|
-
args: {
|
|
65
|
-
slides,
|
|
66
|
-
renderSlide,
|
|
67
|
-
stillSeconds: 6,
|
|
68
|
-
scrollSeconds: 4,
|
|
69
|
-
additionalProps: {
|
|
70
|
-
testid: 'scrolling-carousal',
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
render: (args): ReactElement => (
|
|
74
|
-
<div style={{ width: '90vw' }}>
|
|
75
|
-
<NsScrollingCarousal {...args} />
|
|
76
|
-
</div>
|
|
77
|
-
),
|
|
78
|
-
} as MetaStory;
|
|
79
|
-
|
|
80
|
-
export const ScrollingText: Story = {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { AdditionalProps } from '../common.types';
|
|
3
|
-
|
|
4
|
-
export type NsCarousalProps<T = any> = {
|
|
5
|
-
entries: T[];
|
|
6
|
-
// eslint-disable-next-line no-unused-vars
|
|
7
|
-
renderEntry(entry: T, index: number): ReactNode;
|
|
8
|
-
allEntryLink: string;
|
|
9
|
-
settings: any;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export type NsScrollingCarousalProps<T = any> = {
|
|
13
|
-
slides: T;
|
|
14
|
-
// eslint-disable-next-line no-unused-vars
|
|
15
|
-
renderSlide(slide: T, index: number): ReactNode;
|
|
16
|
-
/* time it takes while scrolling */
|
|
17
|
-
scrollSeconds: number;
|
|
18
|
-
/* time for which slide stays still before scrolling */
|
|
19
|
-
stillSeconds: number;
|
|
20
|
-
settings: any;
|
|
21
|
-
/* value in number, specifying how much the dots should be from bottom of slides container */
|
|
22
|
-
dotsBottomPixel?: number;
|
|
23
|
-
} & AdditionalProps;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { render, screen } from '@/test-utils/index';
|
|
2
|
-
|
|
3
|
-
import { NsCartIcon } from './';
|
|
4
|
-
|
|
5
|
-
const { getByTestId } = screen;
|
|
6
|
-
describe('NsCartIcon', () => {
|
|
7
|
-
it('1. renders Cart icon when item count is 0', () => {
|
|
8
|
-
render(<NsCartIcon />);
|
|
9
|
-
const cartIcon = getByTestId('cart-badge-icon');
|
|
10
|
-
expect(cartIcon).toBeInTheDocument();
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('2. renders item count badge when item count is greater than 0', () => {
|
|
14
|
-
const itemCount = 5;
|
|
15
|
-
const { getByText } = render(<NsCartIcon itemCount={5} color="primary" size="large" />);
|
|
16
|
-
const badgeContentElement = getByText(itemCount.toString());
|
|
17
|
-
expect(badgeContentElement).toHaveTextContent('5'); // Adjust the value as per your badge content
|
|
18
|
-
});
|
|
19
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { StoryObj, Meta } from '@storybook/react';
|
|
2
|
-
import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
|
|
3
|
-
import { NsCartIcon } from './';
|
|
4
|
-
|
|
5
|
-
type ComponentType = typeof NsCartIcon;
|
|
6
|
-
type Story = StoryObj<ComponentType>;
|
|
7
|
-
type MetaStory = Meta<ComponentType>;
|
|
8
|
-
|
|
9
|
-
export default {
|
|
10
|
-
title: 'Components/Data Display/NsCartIcon',
|
|
11
|
-
component: NsCartIcon,
|
|
12
|
-
decorators: [withCenterDecorator],
|
|
13
|
-
argTypes: {
|
|
14
|
-
itemCount: { control: 'number', defaultValue: 1 },
|
|
15
|
-
size: { control: 'select', options: ['small', 'medium', 'large', 'xLarge'] },
|
|
16
|
-
color: {
|
|
17
|
-
control: 'select',
|
|
18
|
-
options: ['primary', 'secondary', 'success', 'error', 'warning', 'info'],
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
args: {
|
|
22
|
-
itemCount: 0,
|
|
23
|
-
color: 'primary',
|
|
24
|
-
size: 'large',
|
|
25
|
-
},
|
|
26
|
-
} as MetaStory;
|
|
27
|
-
|
|
28
|
-
export const CartIcon: Story = {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Badge, Theme } from '@mui/material';
|
|
2
|
-
import { ColorUtils, FoundationTheme, styled } from '@nuskin/foundation-theme';
|
|
3
|
-
|
|
4
|
-
type ItemCountParams = {
|
|
5
|
-
theme?: Theme;
|
|
6
|
-
bgcolor: FoundationTheme.PaletteColors;
|
|
7
|
-
};
|
|
8
|
-
const { paletteColor } = ColorUtils;
|
|
9
|
-
export const StyledBadge = styled(Badge)<ItemCountParams>`
|
|
10
|
-
& .MuiBadge-badge {
|
|
11
|
-
cursor: pointer;
|
|
12
|
-
background-color: ${({ bgcolor, theme }) => paletteColor(bgcolor)({ theme })};
|
|
13
|
-
color: ${({ bgcolor, theme }) => paletteColor(bgcolor, 'contrastText')({ theme })};
|
|
14
|
-
}
|
|
15
|
-
`;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
|
|
3
|
-
import { IconButton } from '@mui/material';
|
|
4
|
-
|
|
5
|
-
import { NsIcon } from '../icon';
|
|
6
|
-
import { StyledBadge } from './NsCartIcon.styled';
|
|
7
|
-
import { NsCartIconProps } from './types.d';
|
|
8
|
-
|
|
9
|
-
const NsCartIcon = ({
|
|
10
|
-
itemCount = 0,
|
|
11
|
-
size = 'large',
|
|
12
|
-
color = 'primary',
|
|
13
|
-
maxItemCount = 999,
|
|
14
|
-
}: NsCartIconProps): ReactElement => {
|
|
15
|
-
return (
|
|
16
|
-
<IconButton aria-label="cart">
|
|
17
|
-
<StyledBadge badgeContent={itemCount} max={maxItemCount} bgcolor={color} showZero>
|
|
18
|
-
<NsIcon testId="cart-badge-icon" name="cart" size={size} color={color} />
|
|
19
|
-
</StyledBadge>
|
|
20
|
-
</IconButton>
|
|
21
|
-
);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export default NsCartIcon;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author [vijayaprathap Kumar] (vpkumar@nuskin.com)
|
|
3
|
-
* checkbox.tsx
|
|
4
|
-
* @description
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React from 'react';
|
|
8
|
-
|
|
9
|
-
import { render, fireEvent, noop } from '@/test-utils/index';
|
|
10
|
-
import NsCheckbox from './NsCheckbox';
|
|
11
|
-
|
|
12
|
-
// Test suite for CustomCheckbox
|
|
13
|
-
describe('CustomCheckbox', () => {
|
|
14
|
-
it('1. should render checkbox with label', () => {
|
|
15
|
-
const { getByLabelText } = render(
|
|
16
|
-
<NsCheckbox name="test-checkbox" label="Test Checkbox" onChange={noop} checked />
|
|
17
|
-
);
|
|
18
|
-
expect(getByLabelText('Test Checkbox')).toBeInTheDocument();
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
// Test case to check if the component renders an unchecked checkbox
|
|
22
|
-
test('2. should render unchecked checkbox', () => {
|
|
23
|
-
// Render the CustomCheckbox component with checked=false and an empty handleChange function
|
|
24
|
-
const { getByLabelText } = render(
|
|
25
|
-
<NsCheckbox name="test-checkbox" label="Test Checkbox" checked={false} onChange={noop} />
|
|
26
|
-
);
|
|
27
|
-
const checkbox = getByLabelText('Test Checkbox');
|
|
28
|
-
// Assert that the checkbox is not checked
|
|
29
|
-
expect(checkbox).not.toBeChecked();
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
// Test case to check if the component renders a checked checkbox
|
|
33
|
-
test('3. it should render checked checkbox', () => {
|
|
34
|
-
// Render the CustomCheckbox component with checked=true and an empty handleChange function
|
|
35
|
-
const { getByLabelText } = render(
|
|
36
|
-
<NsCheckbox name="test-checkbox" label="Test Checkbox" checked onChange={noop} />
|
|
37
|
-
);
|
|
38
|
-
const checkbox = getByLabelText('Test Checkbox');
|
|
39
|
-
// Assert that the checkbox is not checked
|
|
40
|
-
expect(checkbox).toBeChecked();
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
// Test case to check if the handleChange function is called when the checkbox is clicked
|
|
44
|
-
test('calls handleChange when checkbox is clicked', () => {
|
|
45
|
-
// Create a mock handleChange function using Jest's mock function
|
|
46
|
-
const handleChange = jest.fn();
|
|
47
|
-
// Render the CustomCheckbox component with checked=false and the mock handleChange function
|
|
48
|
-
const { getByLabelText } = render(
|
|
49
|
-
<NsCheckbox name="test-checkbox" label="Test Checkbox" checked={false} onChange={handleChange} />
|
|
50
|
-
);
|
|
51
|
-
const checkbox = getByLabelText('Test Checkbox');
|
|
52
|
-
// Simulate a click event on the checkbox
|
|
53
|
-
fireEvent.click(checkbox);
|
|
54
|
-
// Assert that the handleChange function has been called
|
|
55
|
-
expect(handleChange).toHaveBeenCalled();
|
|
56
|
-
});
|
|
57
|
-
});
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import React, { ReactElement, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
|
|
4
|
-
import { expect } from '@storybook/jest';
|
|
5
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
6
|
-
import { within } from '@storybook/testing-library';
|
|
7
|
-
|
|
8
|
-
import { NsCheckbox } from './';
|
|
9
|
-
|
|
10
|
-
type ComponentType = typeof NsCheckbox;
|
|
11
|
-
type Story = StoryObj<ComponentType>;
|
|
12
|
-
type MetaStory = Meta<ComponentType>;
|
|
13
|
-
|
|
14
|
-
const labelText = 'Checkbox Label';
|
|
15
|
-
// In this case, we're only passing the label prop.
|
|
16
|
-
export default {
|
|
17
|
-
title: 'Components/Inputs/NsCheckbox',
|
|
18
|
-
component: NsCheckbox,
|
|
19
|
-
decorators: [withCenterDecorator],
|
|
20
|
-
argTypes: {
|
|
21
|
-
disabled: { control: 'boolean' },
|
|
22
|
-
flag: {
|
|
23
|
-
message: { control: 'text' },
|
|
24
|
-
color: { control: 'select' },
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
args: {
|
|
28
|
-
label: labelText,
|
|
29
|
-
disabled: false,
|
|
30
|
-
ariaLabel: 'primary checkbox',
|
|
31
|
-
size: 'medium',
|
|
32
|
-
flag: {
|
|
33
|
-
message: 'New',
|
|
34
|
-
color: 'accentColorA',
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
} as MetaStory;
|
|
38
|
-
|
|
39
|
-
const RenderCheckbox = (args: any): ReactElement => {
|
|
40
|
-
const [isChecked, setIsChecked] = useState(false);
|
|
41
|
-
const handleChange = (event: { target: { checked: boolean } }) => {
|
|
42
|
-
const isChecked = event.target.checked;
|
|
43
|
-
setIsChecked(isChecked);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
return <NsCheckbox {...args} checked={isChecked} onChange={handleChange} name="test-checkbox" />;
|
|
47
|
-
};
|
|
48
|
-
export const Checkbox: Story = {
|
|
49
|
-
render: RenderCheckbox,
|
|
50
|
-
play: ({ canvasElement }) => {
|
|
51
|
-
const canvas = within(canvasElement);
|
|
52
|
-
const el = canvas.getByText(labelText);
|
|
53
|
-
expect(el).toBeInTheDocument();
|
|
54
|
-
},
|
|
55
|
-
};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author [vijayaprathap Kumar] (vpkumar@nuskin.com)
|
|
3
|
-
* @description Styled Components for Checkbox
|
|
4
|
-
*/
|
|
5
|
-
import DoneIcon from '@mui/icons-material/Done';
|
|
6
|
-
|
|
7
|
-
import { styled, ColorUtils } from '@nuskin/foundation-theme';
|
|
8
|
-
import { NsFlag } from '../flag';
|
|
9
|
-
const { paletteColor, buttonColor, getGenomeColor } = ColorUtils;
|
|
10
|
-
/**
|
|
11
|
-
* Wrapper BpIcon for checkbox.tsx
|
|
12
|
-
* @params ( theme: { palette }) / Provide the color's to contaier from @nuskin/foundation-theme
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
export const BpIcon = styled(DoneIcon)(({ theme }) => ({
|
|
16
|
-
border: '1px solid #8C8C8C',
|
|
17
|
-
path: {
|
|
18
|
-
display: 'none',
|
|
19
|
-
},
|
|
20
|
-
'input:hover ~ &': {
|
|
21
|
-
border: '1px solid #94D6E9',
|
|
22
|
-
},
|
|
23
|
-
'input:focus ~ &': {
|
|
24
|
-
outline: '3px solid #94D6E9',
|
|
25
|
-
},
|
|
26
|
-
'input:disabled ~ &': {
|
|
27
|
-
background: buttonColor('primary', 'hovered')({ theme }),
|
|
28
|
-
},
|
|
29
|
-
}));
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Wrapper BpCheckedIcon for checkbox.tsx
|
|
33
|
-
* @params ( theme: { palette }) / Provide the color's to container from @nuskin/foundation-theme
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
export const BpCheckedIcon = styled(BpIcon)(({ theme }) => ({
|
|
37
|
-
path: {
|
|
38
|
-
display: 'block',
|
|
39
|
-
},
|
|
40
|
-
background: getGenomeColor(theme, 'N100'),
|
|
41
|
-
// background: paletteColor('primary', 'main')({ theme }),
|
|
42
|
-
color: paletteColor('primary', 'contrastText')({ theme }),
|
|
43
|
-
}));
|
|
44
|
-
|
|
45
|
-
const getLabelColor = (isDisabled: boolean, color: string) => (!isDisabled ? '' : `color: ${color}`);
|
|
46
|
-
|
|
47
|
-
export const StyledLabel = styled('span')<{ isDisabled: boolean }>`
|
|
48
|
-
${({ isDisabled, theme }) => {
|
|
49
|
-
const color = buttonColor('primary', 'hovered')({ theme });
|
|
50
|
-
return getLabelColor(isDisabled, color);
|
|
51
|
-
}}
|
|
52
|
-
`;
|
|
53
|
-
export const StyledFlagLabel = styled(NsFlag)`
|
|
54
|
-
margin-right: 16px;
|
|
55
|
-
`;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author [Vijayaprathap Kumar] (vpkumar@nuskin.com)
|
|
3
|
-
* checkbox.tsx
|
|
4
|
-
* @description
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React, { PropsWithChildren, ReactElement, useCallback } from 'react';
|
|
8
|
-
|
|
9
|
-
import MUICheckbox from '@mui/material/Checkbox';
|
|
10
|
-
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
11
|
-
|
|
12
|
-
import { NsTypography } from '../';
|
|
13
|
-
import { BpCheckedIcon, BpIcon, StyledFlagLabel, StyledLabel } from './NsCheckbox.styled';
|
|
14
|
-
import { NsCheckboxProps } from './types.d';
|
|
15
|
-
|
|
16
|
-
const NsCheckbox = (props: PropsWithChildren<NsCheckboxProps>): ReactElement => {
|
|
17
|
-
const {
|
|
18
|
-
name,
|
|
19
|
-
label,
|
|
20
|
-
onChange,
|
|
21
|
-
checked,
|
|
22
|
-
ariaLabel = 'nuskin checkbox',
|
|
23
|
-
flag,
|
|
24
|
-
disabled = false,
|
|
25
|
-
size = 'small',
|
|
26
|
-
testid = 'nuskin-checkbox',
|
|
27
|
-
className = '',
|
|
28
|
-
} = props;
|
|
29
|
-
|
|
30
|
-
const renderCheckbox = useCallback(
|
|
31
|
-
() => (
|
|
32
|
-
<MUICheckbox
|
|
33
|
-
name={name}
|
|
34
|
-
color="default"
|
|
35
|
-
checked={checked}
|
|
36
|
-
onChange={onChange}
|
|
37
|
-
disabled={disabled}
|
|
38
|
-
disableRipple
|
|
39
|
-
checkedIcon={<BpCheckedIcon />}
|
|
40
|
-
icon={<BpIcon />}
|
|
41
|
-
inputProps={
|
|
42
|
-
{
|
|
43
|
-
'aria-label': ariaLabel,
|
|
44
|
-
'data-testid': testid,
|
|
45
|
-
} as React.InputHTMLAttributes<HTMLInputElement>
|
|
46
|
-
}
|
|
47
|
-
size={size}
|
|
48
|
-
/>
|
|
49
|
-
),
|
|
50
|
-
[ariaLabel, checked, disabled, name, onChange, size, testid]
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
const renderCheckboxLabel = useCallback(
|
|
54
|
-
() => (
|
|
55
|
-
<NsTypography variant="body-l">
|
|
56
|
-
<StyledFlagLabel {...flag} size={size} testId={`${name}-flag-label`} />
|
|
57
|
-
<StyledLabel className="checkbox-label-text" isDisabled={disabled}>
|
|
58
|
-
{label}
|
|
59
|
-
</StyledLabel>
|
|
60
|
-
</NsTypography>
|
|
61
|
-
),
|
|
62
|
-
[disabled, flag, label, name, size]
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
return <FormControlLabel className={className} control={renderCheckbox()} label={renderCheckboxLabel()} />;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export default NsCheckbox;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { CheckboxProps as MUICheckboxProps } from '@material-ui/core/Checkbox';
|
|
2
|
-
|
|
3
|
-
import { NsFlagProps } from '../flag';
|
|
4
|
-
|
|
5
|
-
// Define the props for the custom checkbox component
|
|
6
|
-
export type NsCheckboxProps = Pick<MUICheckboxProps, 'label' | 'onChange'> & {
|
|
7
|
-
name: string;
|
|
8
|
-
className?: string;
|
|
9
|
-
checked: boolean;
|
|
10
|
-
/* Aria label for the checkbox area. */
|
|
11
|
-
ariaLabel?: string;
|
|
12
|
-
/* True if you want disable the checkbox and label . */
|
|
13
|
-
disabled?: boolean;
|
|
14
|
-
/* Size of the checkbox component. Either small / medium. */
|
|
15
|
-
size?: 'small' | 'medium';
|
|
16
|
-
/* Flag component props */
|
|
17
|
-
flag?: NsFlagProps;
|
|
18
|
-
/* Test Id for testing purpose */
|
|
19
|
-
testid?: string;
|
|
20
|
-
};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { ReactElement, useMemo } from 'react';
|
|
2
|
-
|
|
3
|
-
import { Box } from '@mui/material';
|
|
4
|
-
import { styled } from '@nuskin/foundation-theme';
|
|
5
|
-
|
|
6
|
-
import { shouldNotForwardPropsWithKeys } from '../util';
|
|
7
|
-
import { NsColumnControlProps, sizeObjectType } from './types.d';
|
|
8
|
-
import { getColumnSizes } from './utils';
|
|
9
|
-
|
|
10
|
-
type StyledDivProps = {
|
|
11
|
-
sizes: sizeObjectType;
|
|
12
|
-
gap?: number;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const options = {
|
|
16
|
-
shouldForwardProp: shouldNotForwardPropsWithKeys<StyledDivProps>(['sizes']),
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const descMaxWidthBreakpoints = [960, 600];
|
|
20
|
-
|
|
21
|
-
/* media queries */
|
|
22
|
-
const mediaQuery = descMaxWidthBreakpoints.map((bp) => `@media (max-width: ${bp}px)`);
|
|
23
|
-
|
|
24
|
-
const StyledDiv = styled(
|
|
25
|
-
Box as any,
|
|
26
|
-
options
|
|
27
|
-
)<StyledDivProps>(({ sizes, gap }: StyledDivProps) => {
|
|
28
|
-
const gridTemplateColumns = sizes['fractions']?.map((e) => `${e}fr`).join(' ');
|
|
29
|
-
const tabletTemplateColumns = sizes['tabletFractions']?.map((e) => `${e}fr`).join(' ');
|
|
30
|
-
const mobileTemplateColumns = sizes['mobileFractions']?.map((e) => `${e}fr`).join(' ');
|
|
31
|
-
return {
|
|
32
|
-
display: 'grid',
|
|
33
|
-
maxWidth: Array.isArray(sizes?.fractions) && sizes.fractions?.length <= 2 ? '1200px' : '2400px',
|
|
34
|
-
margin: '32px auto',
|
|
35
|
-
gap: gap ?? '2rem',
|
|
36
|
-
overflow: 'scroll',
|
|
37
|
-
gridTemplateColumns,
|
|
38
|
-
[mediaQuery[0]]: {
|
|
39
|
-
gridTemplateColumns: tabletTemplateColumns,
|
|
40
|
-
},
|
|
41
|
-
[mediaQuery[1]]: {
|
|
42
|
-
gridTemplateColumns: mobileTemplateColumns,
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
const NsColumnControl = ({ columnClass, children, gap, additionalProps }: NsColumnControlProps): ReactElement => {
|
|
48
|
-
const sizes = useMemo(() => {
|
|
49
|
-
return getColumnSizes(columnClass);
|
|
50
|
-
}, [columnClass]);
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<StyledDiv
|
|
54
|
-
sizes={sizes}
|
|
55
|
-
gap={gap}
|
|
56
|
-
data-testid={additionalProps?.testid ?? 'ns-column-control'}
|
|
57
|
-
className={columnClass}
|
|
58
|
-
>
|
|
59
|
-
{children}
|
|
60
|
-
</StyledDiv>
|
|
61
|
-
);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export default NsColumnControl;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { ReactElement, useMemo } from 'react';
|
|
2
|
-
|
|
3
|
-
import { StyledFlex } from './styled/StyledFlex';
|
|
4
|
-
import { NsFlexColumnsProps } from './types';
|
|
5
|
-
import { getColumnSizes } from './utils';
|
|
6
|
-
|
|
7
|
-
const NsFlexColumns = ({
|
|
8
|
-
columnClass,
|
|
9
|
-
children,
|
|
10
|
-
gap,
|
|
11
|
-
additionalProps,
|
|
12
|
-
isFullWidth,
|
|
13
|
-
}: NsFlexColumnsProps): ReactElement => {
|
|
14
|
-
const sizes = useMemo(() => {
|
|
15
|
-
return getColumnSizes(columnClass ?? 'ns-col-lg-1-1');
|
|
16
|
-
}, [columnClass]);
|
|
17
|
-
return (
|
|
18
|
-
<StyledFlex
|
|
19
|
-
isFullWidth={isFullWidth || false}
|
|
20
|
-
gap={gap}
|
|
21
|
-
sizes={sizes}
|
|
22
|
-
className="ns-flex-columns"
|
|
23
|
-
data-testid={additionalProps?.testid ?? 'ns-flex-columns'}
|
|
24
|
-
>
|
|
25
|
-
{children}
|
|
26
|
-
</StyledFlex>
|
|
27
|
-
);
|
|
28
|
-
};
|
|
29
|
-
export default NsFlexColumns;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { ReactElement, useMemo } from 'react';
|
|
2
|
-
|
|
3
|
-
import { StyledGrid } from './styled/StyledGrid';
|
|
4
|
-
import { NsGridColumnsProps } from './types';
|
|
5
|
-
import { getColumnSizes } from './utils';
|
|
6
|
-
|
|
7
|
-
const NsGridColumns = ({
|
|
8
|
-
columnClass,
|
|
9
|
-
children,
|
|
10
|
-
gap,
|
|
11
|
-
isFullWidth,
|
|
12
|
-
additionalProps,
|
|
13
|
-
}: NsGridColumnsProps): ReactElement => {
|
|
14
|
-
const sizes = useMemo(() => {
|
|
15
|
-
return getColumnSizes(columnClass ?? 'ns-col-lg-1-1');
|
|
16
|
-
}, [columnClass]);
|
|
17
|
-
return (
|
|
18
|
-
<StyledGrid
|
|
19
|
-
isFullWidth={isFullWidth || false}
|
|
20
|
-
gap={gap}
|
|
21
|
-
sizes={sizes}
|
|
22
|
-
className="ns-grid-columns"
|
|
23
|
-
data-testid={additionalProps?.testid ?? 'ns-grid-columns'}
|
|
24
|
-
>
|
|
25
|
-
{children}
|
|
26
|
-
</StyledGrid>
|
|
27
|
-
);
|
|
28
|
-
};
|
|
29
|
-
export default NsGridColumns;
|