@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,45 +0,0 @@
|
|
|
1
|
-
import React, { ReactElement } from 'react';
|
|
2
|
-
|
|
3
|
-
import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
|
|
4
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
|
-
|
|
6
|
-
import NsAlert from './NsAlert';
|
|
7
|
-
|
|
8
|
-
type ComponentType = typeof NsAlert;
|
|
9
|
-
type Story = StoryObj<ComponentType>;
|
|
10
|
-
type MetaStory = Meta<ComponentType>;
|
|
11
|
-
|
|
12
|
-
export default {
|
|
13
|
-
title: 'Components/Feedback/NsAlert',
|
|
14
|
-
component: NsAlert,
|
|
15
|
-
decorators: [withCenterDecorator],
|
|
16
|
-
argTypes: {
|
|
17
|
-
context: {
|
|
18
|
-
control: 'select',
|
|
19
|
-
options: ['error', 'info', 'notice', 'success', 'warning'],
|
|
20
|
-
},
|
|
21
|
-
type: {
|
|
22
|
-
control: 'select',
|
|
23
|
-
options: ['auto', 'banner', 'card'],
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
args: {
|
|
27
|
-
context: 'info',
|
|
28
|
-
title: 'Information',
|
|
29
|
-
threshold: 600,
|
|
30
|
-
type: 'banner',
|
|
31
|
-
visible: true,
|
|
32
|
-
onDismiss: () => {},
|
|
33
|
-
body: (
|
|
34
|
-
<span>{`Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt
|
|
35
|
-
ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
|
|
36
|
-
laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
|
|
37
|
-
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
|
|
38
|
-
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa
|
|
39
|
-
qui officia deserunt mollit anim id est laborum.`}</span>
|
|
40
|
-
) as ReactElement,
|
|
41
|
-
foot: (<span>Some message goes here.</span>) as ReactElement,
|
|
42
|
-
},
|
|
43
|
-
} as MetaStory;
|
|
44
|
-
|
|
45
|
-
export const Alert: Story = {};
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
/* eslint-disable max-len */
|
|
2
|
-
import { styled, ColorUtils, FoundationTheme } from '@nuskin/foundation-theme';
|
|
3
|
-
|
|
4
|
-
const { color } = ColorUtils;
|
|
5
|
-
|
|
6
|
-
import type { AlertContainerParams, AlertType, AlertParams, TypeMapCSS } from './types';
|
|
7
|
-
const gutterWidth = '10px';
|
|
8
|
-
const closeButtonWidth = '12px';
|
|
9
|
-
const iconWidth = '24px';
|
|
10
|
-
|
|
11
|
-
const TypeMap: TypeMapCSS = {
|
|
12
|
-
banner: {
|
|
13
|
-
minHeight: '114px',
|
|
14
|
-
padding: '15px 45px',
|
|
15
|
-
contentColumnStart: 'row-center',
|
|
16
|
-
contentColumnEnd: 'row-center',
|
|
17
|
-
barPosition: 'top',
|
|
18
|
-
footVisibility: 'block',
|
|
19
|
-
},
|
|
20
|
-
card: {
|
|
21
|
-
minHeight: '72px',
|
|
22
|
-
padding: '24px 24px',
|
|
23
|
-
contentColumnStart: 'row-left',
|
|
24
|
-
contentColumnEnd: 'row-right',
|
|
25
|
-
barPosition: 'left',
|
|
26
|
-
footDisplay: 'none',
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const contextType = {
|
|
31
|
-
error: 'red',
|
|
32
|
-
info: 'info',
|
|
33
|
-
notice: 'info',
|
|
34
|
-
success: 'success',
|
|
35
|
-
warning: 'warning',
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export const AlertContainer = styled.div<AlertContainerParams>`
|
|
39
|
-
display: ${({ visible }) => (visible ? 'block' : 'none')};
|
|
40
|
-
* {
|
|
41
|
-
box-sizing: border-box;
|
|
42
|
-
webkit-font-smoothing: antialiased;
|
|
43
|
-
}
|
|
44
|
-
text-align: left;
|
|
45
|
-
`;
|
|
46
|
-
|
|
47
|
-
export const Alert = styled.div<AlertParams>`
|
|
48
|
-
position: relative;
|
|
49
|
-
display: grid;
|
|
50
|
-
grid-template-columns: [row-left] ${iconWidth} [space] ${gutterWidth} [row-center] auto [space] ${gutterWidth} [row-right] ${closeButtonWidth};
|
|
51
|
-
grid-template-rows: [row1] auto;
|
|
52
|
-
grid-auto-row: auto;
|
|
53
|
-
grid-auto-flow: row;
|
|
54
|
-
background-color: ${color('primary', 'white')};
|
|
55
|
-
border: 1px solid ${color('primary', 'black')};
|
|
56
|
-
min-height: ${({ type }) => TypeMap?.[type]?.minHeight};
|
|
57
|
-
padding: ${({ type }) => TypeMap?.[type]?.padding};
|
|
58
|
-
color: ${(props) => color(contextType?.[props?.context] as FoundationTheme.AppColors, '40')(props)} };
|
|
59
|
-
`;
|
|
60
|
-
|
|
61
|
-
export const AlertCloseButton = styled.div`
|
|
62
|
-
grid-column-start: row-right;
|
|
63
|
-
grid-column-end: row-right;
|
|
64
|
-
grid-row-start: row1;
|
|
65
|
-
grid-row-end: row1;
|
|
66
|
-
align-self: center;
|
|
67
|
-
cursor: pointer;
|
|
68
|
-
`;
|
|
69
|
-
|
|
70
|
-
export const AlertIcon = styled.div`
|
|
71
|
-
grid-column-start: row-left;
|
|
72
|
-
grid-column-end: row-left;
|
|
73
|
-
grid-row-start: row1;
|
|
74
|
-
grid-row-end: row1;
|
|
75
|
-
width: ${iconWidth};
|
|
76
|
-
height: ${iconWidth};
|
|
77
|
-
`;
|
|
78
|
-
|
|
79
|
-
export const AlertHead = styled.div`
|
|
80
|
-
grid-column-start: row-center;
|
|
81
|
-
grid-column-end: row-center;
|
|
82
|
-
grid-row-start: row1;
|
|
83
|
-
grid-row-end: row1;
|
|
84
|
-
display: flex;
|
|
85
|
-
flex-direction: column;
|
|
86
|
-
justify-content: center;
|
|
87
|
-
.alert-head-title {
|
|
88
|
-
color: ${color('primary', 'black')};
|
|
89
|
-
}
|
|
90
|
-
`;
|
|
91
|
-
|
|
92
|
-
export const AlertContent = styled.div<{ type: AlertType }>`
|
|
93
|
-
margin-top: 8px;
|
|
94
|
-
color: ${color('primary', 'black')};
|
|
95
|
-
grid-column-start: ${({ type }) => TypeMap?.[type]?.contentColumnStart};
|
|
96
|
-
grid-column-end: ${({ type }) => TypeMap?.[type]?.contentColumnEnd};
|
|
97
|
-
`;
|
|
98
|
-
|
|
99
|
-
export const AlertFoot = styled.div<{ type: AlertType }>`
|
|
100
|
-
margin-top: 8px;
|
|
101
|
-
color: ${color('primary', 'black')};
|
|
102
|
-
display: ${({ type }) => TypeMap?.[type]?.['footDisplay']};
|
|
103
|
-
font-family: ${({ theme }) => theme?.fonts?.sectionFonts?.body};
|
|
104
|
-
font-weight: 300;
|
|
105
|
-
font-size: 14px;
|
|
106
|
-
line-height: 18px;
|
|
107
|
-
`;
|
|
108
|
-
|
|
109
|
-
export const AlertBody = styled.div`
|
|
110
|
-
font-family: ${({ theme }) => theme?.fonts?.sectionFonts?.body};
|
|
111
|
-
font-weight: 300;
|
|
112
|
-
font-size: 16px;
|
|
113
|
-
line-height: 21px;
|
|
114
|
-
`;
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
ReactElement,
|
|
3
|
-
useEffect,
|
|
4
|
-
useState,
|
|
5
|
-
} from 'react';
|
|
6
|
-
|
|
7
|
-
import useWindowSize from '../hooks/useWindowSize';
|
|
8
|
-
import { NsIcon } from '../icon';
|
|
9
|
-
import { NsTypography } from '../typography';
|
|
10
|
-
import Header, {
|
|
11
|
-
colorMap,
|
|
12
|
-
iconMap,
|
|
13
|
-
} from './Header';
|
|
14
|
-
import {
|
|
15
|
-
Alert,
|
|
16
|
-
AlertBody,
|
|
17
|
-
AlertCloseButton,
|
|
18
|
-
AlertContainer,
|
|
19
|
-
AlertContent,
|
|
20
|
-
AlertFoot,
|
|
21
|
-
AlertHead,
|
|
22
|
-
AlertIcon,
|
|
23
|
-
} from './NsAlert.styled';
|
|
24
|
-
import type {
|
|
25
|
-
AlertType,
|
|
26
|
-
ContextType,
|
|
27
|
-
NsAlertProps,
|
|
28
|
-
} from './types.d';
|
|
29
|
-
|
|
30
|
-
export default function NsAlert({
|
|
31
|
-
context = 'info',
|
|
32
|
-
title = 'Information',
|
|
33
|
-
threshold = 600,
|
|
34
|
-
type = 'banner',
|
|
35
|
-
visible = false,
|
|
36
|
-
head,
|
|
37
|
-
body,
|
|
38
|
-
foot,
|
|
39
|
-
onDismiss = undefined,
|
|
40
|
-
}: NsAlertProps): ReactElement {
|
|
41
|
-
const [alertType, setAlertType] = useState('banner');
|
|
42
|
-
const windowSize = useWindowSize();
|
|
43
|
-
|
|
44
|
-
const hasDismissListener = typeof onDismiss === 'function';
|
|
45
|
-
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
if (!context) {
|
|
48
|
-
console.error(`Invalid prop value for 'context': ${context}`);
|
|
49
|
-
}
|
|
50
|
-
if (!type) {
|
|
51
|
-
console.error(`Invalid prop value for 'type': ${type}`);
|
|
52
|
-
}
|
|
53
|
-
if (type === 'auto') {
|
|
54
|
-
setAlertType(windowSize.width < threshold ? 'card' : 'banner');
|
|
55
|
-
} else {
|
|
56
|
-
setAlertType(type);
|
|
57
|
-
}
|
|
58
|
-
}, [threshold, type, windowSize.width, context]);
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<AlertContainer visible={visible} data-testid="alert-container">
|
|
62
|
-
<Alert type={alertType as AlertType} context={context as ContextType}>
|
|
63
|
-
<AlertIcon>
|
|
64
|
-
<NsIcon
|
|
65
|
-
name={iconMap[context] || iconMap.default}
|
|
66
|
-
color={colorMap[context] || colorMap.default}
|
|
67
|
-
size="large"
|
|
68
|
-
/>
|
|
69
|
-
</AlertIcon>
|
|
70
|
-
<AlertHead>
|
|
71
|
-
<Header
|
|
72
|
-
head={
|
|
73
|
-
<NsTypography variant="body-xl" className="alert-head-title" weight="bold" noSpacing>
|
|
74
|
-
{title}
|
|
75
|
-
</NsTypography>
|
|
76
|
-
}
|
|
77
|
-
>
|
|
78
|
-
{head}
|
|
79
|
-
</Header>
|
|
80
|
-
</AlertHead>
|
|
81
|
-
{hasDismissListener && (
|
|
82
|
-
<AlertCloseButton data-testid="alert-close-button" onClick={onDismiss}>
|
|
83
|
-
<NsIcon name="close" size="small" cursor="pointer" />
|
|
84
|
-
</AlertCloseButton>
|
|
85
|
-
)}
|
|
86
|
-
<AlertContent type={alertType as AlertType}>
|
|
87
|
-
<AlertBody>{body}</AlertBody>
|
|
88
|
-
{foot ? <AlertFoot type={alertType as AlertType}>{foot}</AlertFoot> : null}
|
|
89
|
-
</AlertContent>
|
|
90
|
-
</Alert>
|
|
91
|
-
</AlertContainer>
|
|
92
|
-
);
|
|
93
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { ReactNode, CSSProperties } from 'react';
|
|
2
|
-
|
|
3
|
-
export interface NsAlertProps {
|
|
4
|
-
context?: string;
|
|
5
|
-
title?: string;
|
|
6
|
-
threshold?: number;
|
|
7
|
-
type?: string;
|
|
8
|
-
visible?: boolean;
|
|
9
|
-
head?: ReactNode;
|
|
10
|
-
body?: ReactNode;
|
|
11
|
-
onDismiss?: () => void;
|
|
12
|
-
foot?: ReactNode;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface HeaderProps {
|
|
16
|
-
children?: ReactNode; // Default slot content
|
|
17
|
-
head?: ReactNode; // Content for the "head" named slot (optional)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export type AlertContainerParams = {
|
|
21
|
-
visible: boolean;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export type ContextType = 'error' | 'info' | 'notice' | 'success' | 'warning';
|
|
25
|
-
export type AlertType = 'auto' | 'banner' | 'card';
|
|
26
|
-
|
|
27
|
-
export type AlertParams = {
|
|
28
|
-
context: ContextType;
|
|
29
|
-
type: AlertType;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export type CustomCSSProperties = CSSProperties & {
|
|
33
|
-
minHeight?: string;
|
|
34
|
-
contentColumnStart?: string;
|
|
35
|
-
contentColumnEnd?: string;
|
|
36
|
-
barPosition?: string;
|
|
37
|
-
footVisibility?: string;
|
|
38
|
-
footDisplay?: string;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export interface TypeMapCSS {
|
|
42
|
-
banner: CustomCSSProperties;
|
|
43
|
-
card: CustomCSSProperties;
|
|
44
|
-
auto?: CustomCSSProperties;
|
|
45
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, fireEvent, screen } from '@/test-utils/index';
|
|
3
|
-
import { NsAuthDropdown } from './';
|
|
4
|
-
|
|
5
|
-
describe('NsAuthDropdown', () => {
|
|
6
|
-
const props = {
|
|
7
|
-
signInRedirectLink: '/signIn',
|
|
8
|
-
signUpRedirectLink: '/signUp',
|
|
9
|
-
signInBtnText: 'Sign In',
|
|
10
|
-
signUpLinkText: 'Sign Up',
|
|
11
|
-
signUpLinkPrefixText: 'Do not have an account?',
|
|
12
|
-
titleText: 'Welcome',
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
it('1. should render component with title text', () => {
|
|
16
|
-
render(<NsAuthDropdown {...props} />);
|
|
17
|
-
expect(screen.getByText('Welcome')).toBeInTheDocument();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('2. should render the sign in button with text', () => {
|
|
21
|
-
render(<NsAuthDropdown {...props} />);
|
|
22
|
-
const authHead = screen.getByTestId('auth-head');
|
|
23
|
-
fireEvent.click(authHead);
|
|
24
|
-
expect(screen.getByTestId('sign-in-btn')).toBeInTheDocument();
|
|
25
|
-
expect(screen.getByTestId('sign-in-btn')).toHaveTextContent(props.signInBtnText);
|
|
26
|
-
expect(screen.getByTestId('signup-link')).toHaveTextContent(props.signUpLinkText);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('3. should have the correct href attribute in SignUpLink', () => {
|
|
30
|
-
render(<NsAuthDropdown {...props} />);
|
|
31
|
-
const authHead = screen.getByTestId('auth-head');
|
|
32
|
-
fireEvent.click(authHead);
|
|
33
|
-
const signUpLink = screen.getByTestId('signup-link');
|
|
34
|
-
expect(signUpLink).toHaveAttribute('href', '/signUp');
|
|
35
|
-
});
|
|
36
|
-
it('4. should close dropdown on mouse leave', () => {
|
|
37
|
-
const { container } = render(<NsAuthDropdown {...props} closeOnMouseLeave={true} />);
|
|
38
|
-
const authHead = screen.getByTestId('auth-head');
|
|
39
|
-
fireEvent.click(authHead);
|
|
40
|
-
expect(screen.getByTestId('sign-in-btn')).toHaveTextContent('Sign In');
|
|
41
|
-
const wrapper = container.querySelector('.auth-wrapper');
|
|
42
|
-
if (wrapper) fireEvent.mouseLeave(wrapper);
|
|
43
|
-
expect(container.querySelector('.auth-wrapper')).toBeNull();
|
|
44
|
-
});
|
|
45
|
-
it('5. should not close dropdown on mouse leave', () => {
|
|
46
|
-
const { container } = render(<NsAuthDropdown {...props} closeOnMouseLeave={false} />);
|
|
47
|
-
const authHead = screen.getByTestId('auth-head');
|
|
48
|
-
fireEvent.click(authHead);
|
|
49
|
-
expect(screen.getByTestId('sign-in-btn')).toHaveTextContent('Sign In');
|
|
50
|
-
const wrapper = container.querySelector('.auth-wrapper');
|
|
51
|
-
if (wrapper) fireEvent.mouseLeave(wrapper);
|
|
52
|
-
expect(container.querySelector('.auth-wrapper')).not.toBeNull();
|
|
53
|
-
});
|
|
54
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { NsAuthDropdown } from './';
|
|
3
|
-
import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
|
|
4
|
-
|
|
5
|
-
type ComponentType = typeof NsAuthDropdown;
|
|
6
|
-
type Story = StoryObj<ComponentType>;
|
|
7
|
-
type MetaStory = Meta<ComponentType>;
|
|
8
|
-
|
|
9
|
-
export default {
|
|
10
|
-
title: 'Components/Data Display/NsAuthDropdown',
|
|
11
|
-
component: NsAuthDropdown,
|
|
12
|
-
decorators: [withCenterDecorator],
|
|
13
|
-
argTypes: {},
|
|
14
|
-
args: {
|
|
15
|
-
signInRedirectLink: '/signIn',
|
|
16
|
-
signUpRedirectLink: '/signUp',
|
|
17
|
-
signInBtnText: 'Sign In',
|
|
18
|
-
signUpLinkText: 'Sign up today!',
|
|
19
|
-
signUpLinkPrefixText: 'New customer?',
|
|
20
|
-
titleText: 'SIGN UP / SIGN IN',
|
|
21
|
-
closeOnMouseLeave: true,
|
|
22
|
-
},
|
|
23
|
-
} as MetaStory;
|
|
24
|
-
|
|
25
|
-
export const AuthDropdown: Story = {};
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ColorUtils,
|
|
3
|
-
styled,
|
|
4
|
-
} from '@nuskin/foundation-theme';
|
|
5
|
-
|
|
6
|
-
import { DarkModeEnabledOption } from '../common.types';
|
|
7
|
-
|
|
8
|
-
const { getGenomeColor } = ColorUtils;
|
|
9
|
-
|
|
10
|
-
export const AuthDropdownContainer = styled.div`
|
|
11
|
-
position: relative;
|
|
12
|
-
display: inline-block;
|
|
13
|
-
`;
|
|
14
|
-
|
|
15
|
-
export const AuthDropdown = styled.div`
|
|
16
|
-
min-width: 280px;
|
|
17
|
-
background-color: white;
|
|
18
|
-
color: black;
|
|
19
|
-
text-align: center;
|
|
20
|
-
padding: 5px 0;
|
|
21
|
-
position: absolute;
|
|
22
|
-
z-index: 600;
|
|
23
|
-
top: calc(100% + 18px);
|
|
24
|
-
right: 5%;
|
|
25
|
-
box-shadow: 0 0 5px 0 ${({ theme }) => getGenomeColor(theme, 'N70')};
|
|
26
|
-
transition: all 0.15s ease-in-out;
|
|
27
|
-
padding: 25px;
|
|
28
|
-
`;
|
|
29
|
-
|
|
30
|
-
export const Triangle = styled.div`
|
|
31
|
-
position: absolute;
|
|
32
|
-
bottom: -18px;
|
|
33
|
-
left: 50%;
|
|
34
|
-
width: 24px;
|
|
35
|
-
height: 24px;
|
|
36
|
-
overflow: hidden;
|
|
37
|
-
transition: all 0.15s ease-in-out;
|
|
38
|
-
z-index: 700;
|
|
39
|
-
opacity: 1;
|
|
40
|
-
&::after {
|
|
41
|
-
content: '';
|
|
42
|
-
position: absolute;
|
|
43
|
-
width: 14px;
|
|
44
|
-
height: 14px;
|
|
45
|
-
background-color: ${({ theme }) => getGenomeColor(theme, 'N10')};
|
|
46
|
-
transform: rotate(45deg);
|
|
47
|
-
top: 17px;
|
|
48
|
-
left: 5px;
|
|
49
|
-
box-shadow: 0 0 5px 0 ${({ theme }) => getGenomeColor(theme, 'N70')};
|
|
50
|
-
}
|
|
51
|
-
`;
|
|
52
|
-
export const AuthHead = styled('div')<DarkModeEnabledOption>`
|
|
53
|
-
cursor: pointer;
|
|
54
|
-
padding: 5px 10px;
|
|
55
|
-
display: flex;
|
|
56
|
-
justify-content: space-between;
|
|
57
|
-
align-items: center;
|
|
58
|
-
color: ${({ theme }) => getGenomeColor(theme, 'N100')};
|
|
59
|
-
`;
|
|
60
|
-
|
|
61
|
-
export const Button = styled.div`
|
|
62
|
-
padding-right: 10px;
|
|
63
|
-
`;
|
|
64
|
-
|
|
65
|
-
export const Link = styled.a`
|
|
66
|
-
text-decoration: none;
|
|
67
|
-
`;
|
|
68
|
-
|
|
69
|
-
export const SignInButton = styled(Link)`
|
|
70
|
-
display: block;
|
|
71
|
-
padding: 13px;
|
|
72
|
-
width: 100%;
|
|
73
|
-
background-color: ${({ theme }) => getGenomeColor(theme, 'N100')};
|
|
74
|
-
color: ${({ theme }) => getGenomeColor(theme, 'N10')};
|
|
75
|
-
border: 0;
|
|
76
|
-
font-size: 16px;
|
|
77
|
-
&:hover {
|
|
78
|
-
background-color: ${({ theme }) => getGenomeColor(theme, 'N60')};
|
|
79
|
-
}
|
|
80
|
-
`;
|
|
81
|
-
|
|
82
|
-
export const SignUpLinkContainer = styled.div`
|
|
83
|
-
margin-top: 15px;
|
|
84
|
-
color: ${({ theme }) => getGenomeColor(theme, 'N100')};
|
|
85
|
-
font-size: 13px;
|
|
86
|
-
line-height: 16px;
|
|
87
|
-
text-align: left;
|
|
88
|
-
`;
|
|
89
|
-
|
|
90
|
-
export const SignUpLink = styled(Link)`
|
|
91
|
-
cursor: pointer;
|
|
92
|
-
font-weight: 300;
|
|
93
|
-
font-size: 13px;
|
|
94
|
-
line-height: 16px;
|
|
95
|
-
text-decoration: none;
|
|
96
|
-
color: ${({ theme }) => getGenomeColor(theme, 'N100')};
|
|
97
|
-
position: relative;
|
|
98
|
-
transition: all 0.15s ease-in-out;
|
|
99
|
-
&:hover {
|
|
100
|
-
color: ${({ theme }) => getGenomeColor(theme, 'N60')};
|
|
101
|
-
font-size: 14px;
|
|
102
|
-
}
|
|
103
|
-
&:hover::after {
|
|
104
|
-
opacity: 1;
|
|
105
|
-
visibility: visible;
|
|
106
|
-
}
|
|
107
|
-
&::after {
|
|
108
|
-
content: '';
|
|
109
|
-
position: absolute;
|
|
110
|
-
bottom: -2px;
|
|
111
|
-
left: 0;
|
|
112
|
-
right: 0;
|
|
113
|
-
width: 100%;
|
|
114
|
-
height: 1px;
|
|
115
|
-
background-color: ${({ theme }) => getGenomeColor(theme, 'N100')};
|
|
116
|
-
transition: all 0.15s ease-in-out;
|
|
117
|
-
opacity: 0;
|
|
118
|
-
visibility: hidden;
|
|
119
|
-
}
|
|
120
|
-
`;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { ReactElement, useCallback, useRef, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
import { useOnClickOutside } from '../hooks/useOnClickOutside';
|
|
4
|
-
import { NsIcon } from '../icon';
|
|
5
|
-
import {
|
|
6
|
-
AuthDropdown,
|
|
7
|
-
AuthDropdownContainer,
|
|
8
|
-
AuthHead,
|
|
9
|
-
Button,
|
|
10
|
-
SignInButton,
|
|
11
|
-
SignUpLink,
|
|
12
|
-
SignUpLinkContainer,
|
|
13
|
-
Triangle,
|
|
14
|
-
} from './NsAuthDropdown.styled';
|
|
15
|
-
import { NsAuthDropdownProps } from './types.d';
|
|
16
|
-
|
|
17
|
-
const NsAuthDropdown = ({
|
|
18
|
-
signInRedirectLink,
|
|
19
|
-
signUpRedirectLink,
|
|
20
|
-
signInBtnText,
|
|
21
|
-
signUpLinkText,
|
|
22
|
-
signUpLinkPrefixText,
|
|
23
|
-
titleText,
|
|
24
|
-
closeOnMouseLeave = false,
|
|
25
|
-
darkModeEnabled = true,
|
|
26
|
-
}: NsAuthDropdownProps): ReactElement => {
|
|
27
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
28
|
-
const dropdownRef = useRef<HTMLDivElement | null>(null);
|
|
29
|
-
|
|
30
|
-
const handleToggle = useCallback(() => {
|
|
31
|
-
setIsOpen(!isOpen);
|
|
32
|
-
}, [isOpen]);
|
|
33
|
-
|
|
34
|
-
const handleClose = useCallback(() => {
|
|
35
|
-
setIsOpen(false);
|
|
36
|
-
}, []);
|
|
37
|
-
|
|
38
|
-
useOnClickOutside(dropdownRef?.current, handleClose);
|
|
39
|
-
|
|
40
|
-
const handleOnMouseLeave = useCallback(() => {
|
|
41
|
-
if (closeOnMouseLeave) {
|
|
42
|
-
handleClose();
|
|
43
|
-
}
|
|
44
|
-
}, [closeOnMouseLeave, handleClose]);
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<AuthDropdownContainer ref={dropdownRef}>
|
|
48
|
-
<AuthHead data-testid="auth-head" onClick={handleToggle} darkModeEnabled={darkModeEnabled}>
|
|
49
|
-
<Button>{titleText}</Button>
|
|
50
|
-
<NsIcon testId="chevron-icon" name={isOpen ? 'arrowUp' : 'arrowDown'} color="primary" />
|
|
51
|
-
{isOpen ? (
|
|
52
|
-
<div onMouseLeave={handleOnMouseLeave} className="auth-wrapper">
|
|
53
|
-
<Triangle />
|
|
54
|
-
<AuthDropdown>
|
|
55
|
-
<SignInButton href={signInRedirectLink} data-testid="sign-in-btn">
|
|
56
|
-
{signInBtnText}
|
|
57
|
-
</SignInButton>
|
|
58
|
-
<SignUpLinkContainer>
|
|
59
|
-
{signUpLinkPrefixText}{' '}
|
|
60
|
-
<SignUpLink data-testid="signup-link" href={signUpRedirectLink}>
|
|
61
|
-
{signUpLinkText}
|
|
62
|
-
</SignUpLink>
|
|
63
|
-
</SignUpLinkContainer>
|
|
64
|
-
</AuthDropdown>
|
|
65
|
-
</div>
|
|
66
|
-
) : null}
|
|
67
|
-
</AuthHead>
|
|
68
|
-
</AuthDropdownContainer>
|
|
69
|
-
);
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export default NsAuthDropdown;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { AdditionalProps } from '../common.types';
|
|
2
|
-
|
|
3
|
-
export type NsAuthDropdownProps = {
|
|
4
|
-
signInRedirectLink: string;
|
|
5
|
-
signUpRedirectLink: string;
|
|
6
|
-
signInBtnText: string;
|
|
7
|
-
signUpLinkText: string;
|
|
8
|
-
signUpLinkPrefixText: string;
|
|
9
|
-
titleText: string;
|
|
10
|
-
closeOnMouseLeave?: boolean;
|
|
11
|
-
} & AdditionalProps;
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { render, screen, waitFor } from '@/test-utils/index';
|
|
4
|
-
import userEvent from '@testing-library/user-event';
|
|
5
|
-
|
|
6
|
-
import { AutocompleteMockList } from '../autocomplete/mock/MockData';
|
|
7
|
-
import { OptionUiComponent } from '../autocomplete/mock/MockUI';
|
|
8
|
-
import NsAutocomplete from '../autocomplete/NsAutocomplete';
|
|
9
|
-
|
|
10
|
-
const commonProps = {
|
|
11
|
-
value: '',
|
|
12
|
-
inputValue: '',
|
|
13
|
-
onInputChange: jest.fn(),
|
|
14
|
-
onChange: jest.fn(),
|
|
15
|
-
options: AutocompleteMockList,
|
|
16
|
-
placeholder: 'autocomplete-input',
|
|
17
|
-
OptionsUI: OptionUiComponent,
|
|
18
|
-
// renderOption: (props: any) => <li {...props}>{props.value}</li>,
|
|
19
|
-
};
|
|
20
|
-
describe('CustomAutocomplete', () => {
|
|
21
|
-
it('1. should render autocomplete component', () => {
|
|
22
|
-
render(<NsAutocomplete {...commonProps} />);
|
|
23
|
-
const autocompleteInput = screen.getByPlaceholderText('autocomplete-input');
|
|
24
|
-
expect(autocompleteInput).toBeInTheDocument();
|
|
25
|
-
});
|
|
26
|
-
it('2. check that onInputChange gets called', async () => {
|
|
27
|
-
const onInputChangeMock = jest.fn();
|
|
28
|
-
render(<NsAutocomplete {...commonProps} onInputChange={onInputChangeMock} />);
|
|
29
|
-
const autocompleteInput = screen.getByPlaceholderText('autocomplete-input');
|
|
30
|
-
expect(autocompleteInput).toBeInTheDocument();
|
|
31
|
-
await userEvent.type(autocompleteInput, 'GS Facial');
|
|
32
|
-
expect(onInputChangeMock).toHaveBeenCalled();
|
|
33
|
-
}, 100000);
|
|
34
|
-
|
|
35
|
-
it('3. displays options when typing in the input', async () => {
|
|
36
|
-
const onInputChangeMock = jest.fn();
|
|
37
|
-
render(<NsAutocomplete {...commonProps} onInputChange={onInputChangeMock} />);
|
|
38
|
-
const autocompleteInput = screen.getByPlaceholderText('autocomplete-input');
|
|
39
|
-
await userEvent.type(autocompleteInput, 'GS Facial');
|
|
40
|
-
await waitFor(
|
|
41
|
-
() => {
|
|
42
|
-
const option1 = screen.getByText('GS Facial Gels 2pk Subscription');
|
|
43
|
-
expect(option1).toBeInTheDocument();
|
|
44
|
-
},
|
|
45
|
-
{ timeout: 5000 }
|
|
46
|
-
);
|
|
47
|
-
}, 160000);
|
|
48
|
-
|
|
49
|
-
it('4. selects an option when clicking on it', async () => {
|
|
50
|
-
const onChangeMock = jest.fn();
|
|
51
|
-
render(<NsAutocomplete {...commonProps} onChange={onChangeMock} />);
|
|
52
|
-
const autocompleteInput = screen.getByPlaceholderText(commonProps.placeholder);
|
|
53
|
-
await userEvent.type(autocompleteInput, 'GS Facial');
|
|
54
|
-
await waitFor(async () => {
|
|
55
|
-
const optionLi = screen.getByText('GS Facial Spa');
|
|
56
|
-
await userEvent.click(optionLi);
|
|
57
|
-
});
|
|
58
|
-
expect(onChangeMock).toHaveBeenCalled();
|
|
59
|
-
}, 90000000);
|
|
60
|
-
|
|
61
|
-
it('5. should load more options when clicking load more button', async () => {
|
|
62
|
-
const seeMore = {
|
|
63
|
-
text: 'See More',
|
|
64
|
-
show: true,
|
|
65
|
-
onSeeMore: jest.fn(),
|
|
66
|
-
};
|
|
67
|
-
render(<NsAutocomplete seeMore={seeMore} {...commonProps} />);
|
|
68
|
-
const autocompleteInput = screen.getByPlaceholderText(commonProps.placeholder);
|
|
69
|
-
await userEvent.type(autocompleteInput, 'GS Facial');
|
|
70
|
-
await waitFor(async () => {
|
|
71
|
-
const loadMoreButton = screen.getByText(seeMore.text);
|
|
72
|
-
await userEvent.click(loadMoreButton);
|
|
73
|
-
});
|
|
74
|
-
expect(seeMore.onSeeMore).toHaveBeenCalled();
|
|
75
|
-
}, 9000000);
|
|
76
|
-
|
|
77
|
-
it('6. should clear options when clicking clear button', async () => {
|
|
78
|
-
const clear = {
|
|
79
|
-
text: 'Clear All',
|
|
80
|
-
show: true,
|
|
81
|
-
onClear: jest.fn(),
|
|
82
|
-
};
|
|
83
|
-
render(<NsAutocomplete clear={clear} {...commonProps} />);
|
|
84
|
-
const autocompleteInput = screen.getByPlaceholderText(commonProps.placeholder);
|
|
85
|
-
await userEvent.type(autocompleteInput, 'GS Facial');
|
|
86
|
-
await waitFor(async () => {
|
|
87
|
-
const clearButton = screen.getByText(clear.text);
|
|
88
|
-
await userEvent.click(clearButton);
|
|
89
|
-
});
|
|
90
|
-
}, 90000000);
|
|
91
|
-
});
|