@envive-ai/react-toolkit 0.2.11 → 0.2.12
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/{Accordion-FyCFBOen.cjs → Accordion-B0TzPN3m.cjs} +2 -5
- package/dist/{Accordion-B8aUlf0q.js → Accordion-D8Vm8J1y.js} +4 -4
- package/dist/{AnimatedChevron-wpcAHp6d.cjs → AnimatedChevron-9xf90bpP.cjs} +0 -2
- package/dist/{AnimatedChevron-Dee6Pe81.js → AnimatedChevron-DghLnmlM.js} +1 -1
- package/dist/{ButtonBase-B6vDKbGQ.cjs → ButtonBase-BMEAmPnS.cjs} +1 -3
- package/dist/{ButtonBase-Bpc7nOpz.js → ButtonBase-CT397aT3.js} +3 -3
- package/dist/{DynamicFiltersScrollbar-D8OqC4DA.js → DynamicFiltersScrollbar-CibstqNd.js} +5 -7
- package/dist/{DynamicFiltersScrollbar-DIwHWq6v.cjs → DynamicFiltersScrollbar-DqIydLJu.cjs} +3 -6
- package/dist/{ImageWithFallback-DvaVpR6v.cjs → ImageWithFallback-CuPe6XF6.cjs} +1 -2
- package/dist/{ImageWithFallback-BW57cQw-.js → ImageWithFallback-_QZT0EKI.js} +2 -2
- package/dist/{ModalSheet-BvM2PJbH.cjs → ModalSheet-Be7-bkXK.cjs} +11 -16
- package/dist/{ModalSheet-DFva7krP.js → ModalSheet-DVrY7Mw0.js} +12 -13
- package/dist/{ProductCard-C2KvH4MN.cjs → ProductCard-BeY85PBf.cjs} +31 -28
- package/dist/{ProductCard-BiWAcPO4.js → ProductCard-BoyYu6mI.js} +19 -24
- package/dist/{ProductGrid-DkOyRAEg.cjs → ProductGrid-CxKK7w_X.cjs} +2 -3
- package/dist/{ProductGrid-B1RtE58G.js → ProductGrid-DmtSXfyE.js} +3 -3
- package/dist/{RadioButton-CQ6qOvBl.js → RadioButton-Bm0qK3bX.js} +3 -3
- package/dist/{RadioButton-DP-qs5cy.cjs → RadioButton-Dcdj8pNp.cjs} +1 -3
- package/dist/{RadioButtonGroup-CJPWfAaA.cjs → RadioButtonGroup-BnnMx8sE.cjs} +2 -3
- package/dist/{RadioButtonGroup-Ce8cKqYw.js → RadioButtonGroup-hme7gSiQ.js} +3 -3
- package/dist/RecommendedProducts-C2eNVrLo.cjs +56 -0
- package/dist/RecommendedProducts-LalI8aVC.js +49 -0
- package/dist/{SearchAutocomplete-bbMvWWjI.cjs → SearchAutocomplete-A3HXkHwK.cjs} +3 -6
- package/dist/{SearchAutocomplete-CjjL2_lm.js → SearchAutocomplete-Rza3A-gs.js} +5 -6
- package/dist/{SearchFilter-wHwOym_n.js → SearchFilter-CYY5sNXV.js} +40 -44
- package/dist/{SearchFilter-BLi6E9Wx.cjs → SearchFilter-DxrQOLx0.cjs} +38 -44
- package/dist/{SearchInput-BA6bepV_.cjs → SearchInput-3ppsm2Ke.cjs} +4 -7
- package/dist/{SearchInput-C3nNkmBm.js → SearchInput-DE9Iz7A8.js} +4 -5
- package/dist/{SearchInputForm/index.cjs → SearchInputForm-CZz62rOX.cjs} +10 -10
- package/dist/{SearchInputForm/index.js → SearchInputForm-DrI4WHDt.js} +4 -7
- package/dist/SearchResultsFilterButton-BedTofz5.cjs +29 -0
- package/dist/SearchResultsFilterButton-CV11UTGi.js +22 -0
- package/dist/{SearchResultsFilterSidebar/index.js → SearchResultsFilterSidebar-Bvpk7Uoo.js} +5 -14
- package/dist/{SearchResultsFilterSidebar/index.cjs → SearchResultsFilterSidebar-Dgz98oyD.cjs} +11 -18
- package/dist/{SearchResultsStates-C-8fh8B9.cjs → SearchResultsStates-D37wFr9h.cjs} +42 -16
- package/dist/{SearchResultsStates-D62WbDTD.js → SearchResultsStates-DrGtw0pM.js} +44 -16
- package/dist/{SparkleAnimation-BFAj73CF.cjs → SparkleAnimation-B5A_NCuy.cjs} +16 -10
- package/dist/{SparkleAnimation-BYDUEqWX.js → SparkleAnimation-BSI_34HX.js} +11 -8
- package/dist/{Spinner-D2HbRsuw.js → Spinner-CDDFWySo.js} +2 -2
- package/dist/{Spinner-Ccy6VFEp.cjs → Spinner-FQpy5bGu.cjs} +1 -2
- package/dist/{TextInput-CYTko3-n.cjs → TextInput-Do5-j1V_.cjs} +3 -5
- package/dist/{TextInput-CmxnphaT.js → TextInput-PtrUXoZo.js} +5 -6
- package/dist/{ToggleButton-V9Qsaks7.js → ToggleButton-BTz_zIdc.js} +3 -3
- package/dist/{ToggleButton-CvxNLMe_.cjs → ToggleButton-CmxTz-ou.cjs} +1 -2
- package/dist/{Typography-C3QmJzFK.js → Typography-xehJH05l.js} +1 -1
- package/dist/colorsConfig-BjdoRtRK.js +26 -0
- package/dist/colorsConfig-D-MZuBvt.cjs +38 -0
- package/dist/{Accordion/index.d.ts → components/Accordion/index-BPofgdcd.d.cts} +2 -2
- package/dist/components/Accordion/index.cjs +4 -0
- package/dist/components/Accordion/index.js +4 -0
- package/dist/{AnimatedChevron/index.d.cts → components/AnimatedChevron/index-Bvff3AGS.d.ts} +2 -2
- package/dist/{AnimatedChevron/index.d.ts → components/AnimatedChevron/index-BwQ6tJL8.d.cts} +2 -2
- package/dist/components/AnimatedChevron/index.cjs +3 -0
- package/dist/components/AnimatedChevron/index.js +3 -0
- package/dist/{AppliedFiltersScrollbar/index.d.ts → components/AppliedFiltersScrollbar/index-BKNoroAl.d.ts} +3 -3
- package/dist/{AppliedFiltersScrollbar/index.d.cts → components/AppliedFiltersScrollbar/index-DADY550R.d.cts} +3 -3
- package/dist/{AppliedFiltersScrollbar → components/AppliedFiltersScrollbar}/index.cjs +4 -6
- package/dist/{AppliedFiltersScrollbar → components/AppliedFiltersScrollbar}/index.js +3 -4
- package/dist/{ButtonBase/index.d.ts → components/ButtonBase/index-BCw2WQ-2.d.ts} +3 -3
- package/dist/{ButtonBase/index.d.cts → components/ButtonBase/index-pBSmWoqg.d.cts} +3 -3
- package/dist/components/ButtonBase/index.cjs +6 -0
- package/dist/components/ButtonBase/index.js +5 -0
- package/dist/{DynamicFiltersScrollbar/index.d.cts → components/DynamicFiltersScrollbar/index-BvAT64cX.d.ts} +2 -2
- package/dist/{DynamicFiltersScrollbar/index.d.ts → components/DynamicFiltersScrollbar/index-X--ALCSa.d.cts} +2 -2
- package/dist/{DynamicFiltersScrollbar → components/DynamicFiltersScrollbar}/index.cjs +4 -6
- package/dist/{DynamicFiltersScrollbar → components/DynamicFiltersScrollbar}/index.js +3 -4
- package/dist/{FilterScrollbar/index.d.cts → components/FilterScrollbar/index-DgxXE1ff.d.cts} +4 -4
- package/dist/{FilterScrollbar/index.d.ts → components/FilterScrollbar/index-xlg1Q06Q.d.ts} +4 -4
- package/dist/components/FilterScrollbar/index.cjs +5 -0
- package/dist/components/FilterScrollbar/index.js +4 -0
- package/dist/{ImageWithFallback/index.d.cts → components/ImageWithFallback/index-C8Fqb7AQ.d.cts} +2 -2
- package/dist/{ImageWithFallback/index.d.ts → components/ImageWithFallback/index-yxDWrUCQ.d.ts} +2 -2
- package/dist/components/ImageWithFallback/index.cjs +3 -0
- package/dist/components/ImageWithFallback/index.js +3 -0
- package/dist/{ModalSheet/index.d.cts → components/ModalSheet/index-Cp_h5dbe.d.ts} +2 -2
- package/dist/{ModalSheet/index.d.ts → components/ModalSheet/index-Dnt-aUte.d.cts} +2 -2
- package/dist/components/ModalSheet/index.cjs +4 -0
- package/dist/components/ModalSheet/index.js +4 -0
- package/dist/components/ProductCard/index-BF8pv46P.d.ts +2 -0
- package/dist/components/ProductCard/index-C6TLdXjC.d.cts +2 -0
- package/dist/{ProductCard → components/ProductCard}/index.cjs +7 -4
- package/dist/components/ProductCard/index.js +7 -0
- package/dist/{ProductGrid/index.d.ts → components/ProductGrid/index-B1eVXjB4.d.cts} +4 -3
- package/dist/{ProductGrid/index.d.cts → components/ProductGrid/index-CyDy1V6o.d.ts} +4 -3
- package/dist/components/ProductGrid/index.cjs +9 -0
- package/dist/components/ProductGrid/index.js +8 -0
- package/dist/{RadioButton/index.d.ts → components/RadioButton/index-BHl3dM6k.d.cts} +3 -3
- package/dist/{RadioButton/index.d.cts → components/RadioButton/index-BZrcz8-J.d.ts} +3 -3
- package/dist/components/RadioButton/index.cjs +4 -0
- package/dist/components/RadioButton/index.js +4 -0
- package/dist/{RadioButtonGroup/index.d.ts → components/RadioButtonGroup/index-DdyMuFCX.d.ts} +3 -3
- package/dist/{RadioButtonGroup/index.d.cts → components/RadioButtonGroup/index-DtdjcXo-.d.cts} +3 -3
- package/dist/components/RadioButtonGroup/index.cjs +6 -0
- package/dist/components/RadioButtonGroup/index.js +5 -0
- package/dist/components/RecommendedProducts/index-BFM83Qu3.d.cts +15 -0
- package/dist/components/RecommendedProducts/index-DlbCfGof.d.ts +15 -0
- package/dist/components/RecommendedProducts/index.cjs +12 -0
- package/dist/components/RecommendedProducts/index.js +12 -0
- package/dist/{SearchAutocomplete/index.d.cts → components/SearchAutocomplete/index-Br_POGOz.d.ts} +2 -2
- package/dist/{SearchAutocomplete/index.d.ts → components/SearchAutocomplete/index-Ce9gkkbU.d.cts} +2 -2
- package/dist/components/SearchAutocomplete/index.cjs +4 -0
- package/dist/components/SearchAutocomplete/index.js +4 -0
- package/dist/components/SearchFilter/index-DAR4UKSA.d.cts +91 -0
- package/dist/components/SearchFilter/index-VygXUBM9.d.ts +91 -0
- package/dist/components/SearchFilter/index.cjs +17 -0
- package/dist/components/SearchFilter/index.js +12 -0
- package/dist/{SearchInput/index.d.cts → components/SearchInput/index-UY0W77Y0.d.ts} +4 -3
- package/dist/{SearchInput/index.d.ts → components/SearchInput/index-rFDdhvqg.d.cts} +4 -3
- package/dist/components/SearchInput/index.cjs +7 -0
- package/dist/components/SearchInput/index.js +6 -0
- package/dist/{SearchInputForm/index.d.ts → components/SearchInputForm/index-_sR_KugL.d.ts} +3 -3
- package/dist/{SearchInputForm/index.d.cts → components/SearchInputForm/index-dlLBivQA.d.cts} +3 -3
- package/dist/components/SearchInputForm/index.cjs +8 -0
- package/dist/components/SearchInputForm/index.js +8 -0
- package/dist/{SearchResultsContent/index.d.cts → components/SearchResultsContent/index-B_6-7-t-.d.ts} +19 -7
- package/dist/{SearchResultsContent/index.d.ts → components/SearchResultsContent/index-CayvNVCK.d.cts} +19 -7
- package/dist/components/SearchResultsContent/index.cjs +60 -0
- package/dist/components/SearchResultsContent/index.js +58 -0
- package/dist/components/SearchResultsFilterButton/index-D_u8PzTc.d.cts +13 -0
- package/dist/components/SearchResultsFilterButton/index-DuTGqa7-.d.ts +13 -0
- package/dist/components/SearchResultsFilterButton/index.cjs +9 -0
- package/dist/components/SearchResultsFilterButton/index.js +9 -0
- package/dist/components/SearchResultsFilterModal/index-BNZEJiXR.d.cts +27 -0
- package/dist/components/SearchResultsFilterModal/index-CXBAA2-F.d.ts +27 -0
- package/dist/components/SearchResultsFilterModal/index.cjs +47 -0
- package/dist/components/SearchResultsFilterModal/index.js +46 -0
- package/dist/components/SearchResultsFilterSidebar/index-BDcl27l4.d.ts +2 -0
- package/dist/components/SearchResultsFilterSidebar/index-DgPB1knO.d.cts +2 -0
- package/dist/components/SearchResultsFilterSidebar/index.cjs +16 -0
- package/dist/components/SearchResultsFilterSidebar/index.js +15 -0
- package/dist/{SearchResultsStates/index.d.cts → components/SearchResultsStates/index-CjYl1v-v.d.cts} +16 -5
- package/dist/{SearchResultsStates/index.d.ts → components/SearchResultsStates/index-DJaUfKjE.d.ts} +20 -9
- package/dist/components/SearchResultsStates/index.cjs +16 -0
- package/dist/components/SearchResultsStates/index.js +14 -0
- package/dist/components/SearchResultsToolbar/index-CVstdvRQ.d.cts +49 -0
- package/dist/components/SearchResultsToolbar/index-tAB6lEUm.d.ts +49 -0
- package/dist/components/SearchResultsToolbar/index.cjs +66 -0
- package/dist/components/SearchResultsToolbar/index.js +63 -0
- package/dist/components/SparkleAnimation/index-BQOC3G_6.d.cts +23 -0
- package/dist/components/SparkleAnimation/index-DjRK3Dys.d.ts +23 -0
- package/dist/components/SparkleAnimation/index.cjs +4 -0
- package/dist/components/SparkleAnimation/index.js +3 -0
- package/dist/{Spinner/index.d.cts → components/Spinner/index-C0pGovHC.d.cts} +2 -2
- package/dist/{Spinner/index.d.ts → components/Spinner/index-CIr1izou.d.ts} +2 -2
- package/dist/components/Spinner/index.cjs +3 -0
- package/dist/components/Spinner/index.js +3 -0
- package/dist/{SuggestionButton/index.d.ts → components/SuggestionButton/index-B4J70IPS.d.cts} +3 -3
- package/dist/{SuggestionButton/index.d.cts → components/SuggestionButton/index-D6_y1hTj.d.ts} +3 -3
- package/dist/{SuggestionButton → components/SuggestionButton}/index.cjs +6 -8
- package/dist/{SuggestionButton → components/SuggestionButton}/index.js +5 -6
- package/dist/{TextInput/index.d.cts → components/TextInput/index-CRJMRe-b.d.cts} +2 -2
- package/dist/{TextInput/index.d.ts → components/TextInput/index-CkQtHiR9.d.ts} +2 -2
- package/dist/components/TextInput/index.cjs +4 -0
- package/dist/components/TextInput/index.js +4 -0
- package/dist/{ToggleButton/index.d.ts → components/ToggleButton/index-B2rBwaVX.d.cts} +2 -2
- package/dist/{ToggleButton/index.d.cts → components/ToggleButton/index-Dc-cs_tK.d.ts} +2 -2
- package/dist/components/ToggleButton/index.cjs +4 -0
- package/dist/components/ToggleButton/index.js +4 -0
- package/dist/components/Typography/index-DE1Nhjra.d.ts +3 -0
- package/dist/components/Typography/index-DzSBreyM.d.cts +3 -0
- package/dist/{Typography → components/Typography}/index.cjs +1 -1
- package/dist/components/Typography/index.js +3 -0
- package/dist/formatPrice-CyfkjZ3R.cjs +19 -0
- package/dist/formatPrice-DexQu2aZ.js +13 -0
- package/dist/{SearchResultsFilterSidebar/index.d.ts → index-8cIrhPDk.d.ts} +9 -5
- package/dist/{SearchResultsFilterSidebar/index.d.cts → index-BKYA7uMB.d.cts} +9 -5
- package/dist/{index-DoTNu3mL.d.cts → index-Bw6lDfEp.d.cts} +2 -2
- package/dist/index-CqfgJHj8.d.cts +325 -0
- package/dist/{index-C5iOTsRG.d.ts → index-Cr8VXccr.d.ts} +2 -2
- package/dist/index-Cz6qxTZG.d.ts +325 -0
- package/dist/{searchFilterSidebarVariants-BQ7OC862.cjs → searchFilterSidebarVariants-C61Byr1S.cjs} +7 -10
- package/dist/{searchFilterSidebarVariants-C_rWIcxf.js → searchFilterSidebarVariants-DcwlBfvY.js} +2 -3
- package/dist/types--eyQnaEA.d.cts +4 -0
- package/dist/types-CQpdBL3M.d.ts +4 -0
- package/dist/{typographyVariantClasses-BFRoEloZ.d.cts → typographyVariantClasses-CoRhazCU.d.cts} +1 -1
- package/dist/{typographyVariantClasses-D7h3ACAj.d.ts → typographyVariantClasses-CrT5OfVw.d.ts} +1 -1
- package/dist/util/index-C2ueYGXh.d.ts +21 -0
- package/dist/util/index-DUzbpjPa.d.cts +21 -0
- package/dist/util/index.cjs +80 -0
- package/dist/util/index.js +76 -0
- package/package.json +79 -53
- package/src/atoms/search/types.ts +1 -0
- package/src/components/AppliedFiltersScrollbar/AppliedFiltersScrollbar.tsx +1 -1
- package/src/components/ButtonBase/types.ts +1 -1
- package/src/components/FilterScrollbar/AppliedFiltersScrollbar.tsx +1 -1
- package/src/components/ProductCard/ProductCard.tsx +12 -12
- package/src/components/ProductCard/ProductCardSkeleton.tsx +1 -13
- package/src/components/ProductCard/index.ts +1 -0
- package/src/components/ProductCard/productCardVariants.ts +1 -1
- package/src/components/ProductCard/types.ts +49 -0
- package/src/components/ProductGrid/ProductGrid.tsx +2 -6
- package/src/components/ProductGrid/productGridVariants.ts +1 -1
- package/src/components/RadioButton/RadioButton.tsx +1 -1
- package/src/components/RadioButtonGroup/RadioButtonGroup.tsx +1 -1
- package/src/components/RecommendedProducts/RecommendedProducts.tsx +97 -0
- package/src/components/RecommendedProducts/index.ts +3 -0
- package/src/components/SearchFilter/SearchFilter.tsx +2 -1
- package/src/components/SearchFilter/SearchFilterFooter.tsx +1 -1
- package/src/components/SearchFilter/SearchFilterHeader.tsx +1 -1
- package/src/components/SearchFilter/SearchFilterItem.tsx +1 -1
- package/src/components/SearchFilter/types.ts +45 -0
- package/src/components/SearchFilter/useHasFilterStateChanged.tsx +1 -1
- package/src/components/SearchFilter/utils.ts +1 -1
- package/src/components/SearchInput/SearchInput.tsx +1 -1
- package/src/components/SearchInput/searchInputVariants.ts +2 -2
- package/src/components/SearchInputForm/SearchInputForm.tsx +7 -4
- package/src/components/SearchResultsContent/SearchResultsContent.tsx +72 -39
- package/src/components/SearchResultsFilterButton/SearchResultsFilterButton.tsx +30 -0
- package/src/components/SearchResultsFilterButton/index.ts +3 -0
- package/src/components/SearchResultsFilterModal/SearchResultsFilterModal.tsx +61 -0
- package/src/components/SearchResultsFilterModal/index.ts +3 -0
- package/src/components/SearchResultsFilterSidebar/SearchResultsFilter.tsx +2 -1
- package/src/components/SearchResultsFilterSidebar/index.ts +1 -0
- package/src/components/SearchResultsFilterSidebar/searchFilterSidebarVariants.ts +2 -2
- package/src/components/SearchResultsFilterSidebar/types.ts +2 -0
- package/src/components/SearchResultsStates/NoSearchResultsFound.tsx +43 -11
- package/src/components/SearchResultsStates/SearchResultsGrid.tsx +8 -7
- package/src/components/SearchResultsStates/SearchResultsLoadingGrid.tsx +1 -2
- package/src/components/SearchResultsToolbar/SearchResultsToolbar.tsx +111 -0
- package/src/components/SearchResultsToolbar/index.ts +3 -0
- package/src/components/SparkleAnimation/SparkleAnimation.tsx +1 -7
- package/src/components/SparkleAnimation/index.ts +1 -0
- package/src/components/SparkleAnimation/types.ts +6 -0
- package/src/components/SuggestionButton/SuggestionButton.tsx +1 -1
- package/src/config/chatElementDisplayLocation.ts +23 -0
- package/src/models/colorsConfig.ts +28 -0
- package/src/stories/AppliedFiltersScrollbar.stories.tsx +42 -0
- package/src/stories/ButtonBase.stories.tsx +54 -0
- package/src/stories/DynamicFiltersScrollbar.stories.tsx +42 -0
- package/src/stories/NoSearchResultsFound.stories.tsx +30 -0
- package/src/stories/ProductCard.stories.tsx +78 -0
- package/src/stories/ProductCardSkeleton.stories.tsx +48 -0
- package/src/stories/ProductGrid.stories.tsx +82 -0
- package/src/stories/SearchInputForm.stories.tsx +39 -0
- package/src/stories/SearchResultsFilter.stories.tsx +56 -0
- package/src/stories/SearchResultsGrid.stories.tsx +98 -0
- package/src/stories/SearchResultsLoadingGrid.stories.tsx +30 -0
- package/src/stories/SparkleAnimation.stories.tsx +47 -0
- package/src/stories/Typography.stories.tsx +140 -0
- package/src/util/camelCase.ts +87 -0
- package/src/util/camelCasedPropertiesDeep.ts +81 -0
- package/src/util/colorVar.ts +1 -1
- package/src/util/index.ts +4 -0
- package/src/util/internal.ts +97 -0
- package/src/util/primitive.ts +8 -0
- package/src/util/splitWords.ts +76 -0
- package/src/util/trim.ts +28 -0
- package/src/util/unknownArray.ts +25 -0
- package/src/util/useScrollDirection.ts +60 -0
- package/src/util/useStickyVisibility.ts +37 -0
- package/dist/Accordion/index.cjs +0 -4
- package/dist/Accordion/index.js +0 -4
- package/dist/AnimatedChevron/index.cjs +0 -3
- package/dist/AnimatedChevron/index.js +0 -3
- package/dist/ButtonBase/index.cjs +0 -6
- package/dist/ButtonBase/index.js +0 -5
- package/dist/FilterScrollbar/index.cjs +0 -5
- package/dist/FilterScrollbar/index.js +0 -4
- package/dist/ImageWithFallback/index.cjs +0 -3
- package/dist/ImageWithFallback/index.js +0 -3
- package/dist/ModalSheet/index.cjs +0 -4
- package/dist/ModalSheet/index.js +0 -4
- package/dist/ProductCard/index.d.cts +0 -82
- package/dist/ProductCard/index.d.ts +0 -82
- package/dist/ProductCard/index.js +0 -6
- package/dist/ProductGrid/index.cjs +0 -8
- package/dist/ProductGrid/index.js +0 -7
- package/dist/RadioButton/index.cjs +0 -4
- package/dist/RadioButton/index.js +0 -4
- package/dist/RadioButtonGroup/index.cjs +0 -6
- package/dist/RadioButtonGroup/index.js +0 -5
- package/dist/SearchAutocomplete/index.cjs +0 -4
- package/dist/SearchAutocomplete/index.js +0 -4
- package/dist/SearchFilter/index.cjs +0 -17
- package/dist/SearchFilter/index.d.cts +0 -54
- package/dist/SearchFilter/index.d.ts +0 -54
- package/dist/SearchFilter/index.js +0 -12
- package/dist/SearchInput/index.cjs +0 -7
- package/dist/SearchInput/index.js +0 -6
- package/dist/SearchResultsContent/index.cjs +0 -44
- package/dist/SearchResultsContent/index.js +0 -41
- package/dist/SearchResultsStates/index.cjs +0 -14
- package/dist/SearchResultsStates/index.js +0 -12
- package/dist/SparkleAnimation/index.cjs +0 -3
- package/dist/SparkleAnimation/index.d.cts +0 -15
- package/dist/SparkleAnimation/index.d.ts +0 -15
- package/dist/SparkleAnimation/index.js +0 -3
- package/dist/Spinner/index.cjs +0 -3
- package/dist/Spinner/index.js +0 -3
- package/dist/TextInput/index.cjs +0 -4
- package/dist/TextInput/index.js +0 -4
- package/dist/ToggleButton/index.cjs +0 -4
- package/dist/ToggleButton/index.js +0 -4
- package/dist/Typography/index.d.cts +0 -3
- package/dist/Typography/index.d.ts +0 -3
- package/dist/Typography/index.js +0 -3
- package/dist/colorVar-B5CLhSof.cjs +0 -11
- package/dist/colorVar-BJve0Z4_.js +0 -5
- /package/dist/{ButtonBase-DbWQ25n-.cjs → ButtonBase-BIXx56hq.cjs} +0 -0
- /package/dist/{ButtonBase-C_uKnl48.js → ButtonBase-C9fn-c5h.js} +0 -0
- /package/dist/{Accordion/index.d.cts → components/Accordion/index-DBEaF9x5.d.ts} +0 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Typography } from '@envive-ai/react-toolkit/Typography';
|
|
3
|
+
|
|
4
|
+
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Common/Typography',
|
|
7
|
+
component: Typography,
|
|
8
|
+
parameters: {
|
|
9
|
+
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/react/configure/story-layout
|
|
10
|
+
layout: 'centered',
|
|
11
|
+
},
|
|
12
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
|
|
13
|
+
tags: ['autodocs'],
|
|
14
|
+
args: {
|
|
15
|
+
className: undefined,
|
|
16
|
+
style: undefined,
|
|
17
|
+
noOfLines: undefined,
|
|
18
|
+
testId: undefined,
|
|
19
|
+
},
|
|
20
|
+
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
|
|
21
|
+
argTypes: {
|
|
22
|
+
variant: {
|
|
23
|
+
control: {
|
|
24
|
+
type: 'select',
|
|
25
|
+
options: [
|
|
26
|
+
't1',
|
|
27
|
+
't2',
|
|
28
|
+
't3',
|
|
29
|
+
'h1',
|
|
30
|
+
'h2',
|
|
31
|
+
'h3',
|
|
32
|
+
'h4',
|
|
33
|
+
'body1',
|
|
34
|
+
'body2',
|
|
35
|
+
'body3',
|
|
36
|
+
'body4',
|
|
37
|
+
'body5',
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
elementType: {
|
|
42
|
+
control: {
|
|
43
|
+
type: 'select',
|
|
44
|
+
options: ['span', 'p', 'sub', 'h1', 'h2', 'h3', 'h4'],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
className: { control: 'text' },
|
|
48
|
+
style: { control: 'object' },
|
|
49
|
+
noOfLines: { control: 'number' },
|
|
50
|
+
testId: { control: 'text' },
|
|
51
|
+
},
|
|
52
|
+
} satisfies Meta<typeof Typography>;
|
|
53
|
+
|
|
54
|
+
export default meta;
|
|
55
|
+
type Story = StoryObj<typeof meta>;
|
|
56
|
+
|
|
57
|
+
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
|
|
58
|
+
export const Body1: Story = {
|
|
59
|
+
args: {
|
|
60
|
+
variant: 'body1',
|
|
61
|
+
children: 'This is a body1 text',
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const Body2: Story = {
|
|
66
|
+
args: {
|
|
67
|
+
variant: 'body2',
|
|
68
|
+
children: 'This is a body2 text',
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const Body3: Story = {
|
|
73
|
+
args: {
|
|
74
|
+
variant: 'body3',
|
|
75
|
+
children: 'This is a body3 text',
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const Body4: Story = {
|
|
80
|
+
args: {
|
|
81
|
+
variant: 'body4',
|
|
82
|
+
children: 'This is a body4 text',
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const Body5: Story = {
|
|
87
|
+
args: {
|
|
88
|
+
variant: 'body5',
|
|
89
|
+
children: 'This is a body5 text',
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export const T1: Story = {
|
|
94
|
+
args: {
|
|
95
|
+
variant: 't1',
|
|
96
|
+
children: 'This is a t1 text',
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export const T2: Story = {
|
|
101
|
+
args: {
|
|
102
|
+
variant: 't2',
|
|
103
|
+
children: 'This is a t2 text',
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export const T3: Story = {
|
|
108
|
+
args: {
|
|
109
|
+
variant: 't3',
|
|
110
|
+
children: 'This is a t3 text',
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export const H1: Story = {
|
|
115
|
+
args: {
|
|
116
|
+
variant: 'h1',
|
|
117
|
+
children: 'This is a h1 text',
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export const H2: Story = {
|
|
122
|
+
args: {
|
|
123
|
+
variant: 'h2',
|
|
124
|
+
children: 'This is a h2 text',
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export const H3: Story = {
|
|
129
|
+
args: {
|
|
130
|
+
variant: 'h3',
|
|
131
|
+
children: 'This is a h3 text',
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export const H4: Story = {
|
|
136
|
+
args: {
|
|
137
|
+
variant: 'h4',
|
|
138
|
+
children: 'This is a h4 text',
|
|
139
|
+
},
|
|
140
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// these types come from https://github.com/sindresorhus/type-fest/blob/main/source/camel-case.d.ts
|
|
2
|
+
|
|
3
|
+
import type { SplitWords } from './splitWords';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* CamelCase options.
|
|
7
|
+
*
|
|
8
|
+
* @see {@link CamelCase}
|
|
9
|
+
*/
|
|
10
|
+
export type CamelCaseOptions = {
|
|
11
|
+
/**
|
|
12
|
+
* Whether to preserved consecutive uppercase letter.
|
|
13
|
+
*
|
|
14
|
+
* @default true
|
|
15
|
+
*/
|
|
16
|
+
preserveConsecutiveUppercase?: boolean;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Convert an array of words to camel-case.
|
|
21
|
+
*/
|
|
22
|
+
type CamelCaseFromArray<
|
|
23
|
+
Words extends string[],
|
|
24
|
+
Options extends CamelCaseOptions,
|
|
25
|
+
OutputString extends string = '',
|
|
26
|
+
> = Words extends [infer FirstWord extends string, ...infer RemainingWords extends string[]]
|
|
27
|
+
? Options['preserveConsecutiveUppercase'] extends true
|
|
28
|
+
? `${Capitalize<FirstWord>}${CamelCaseFromArray<RemainingWords, Options>}`
|
|
29
|
+
: `${Capitalize<Lowercase<FirstWord>>}${CamelCaseFromArray<RemainingWords, Options>}`
|
|
30
|
+
: OutputString;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Convert a string literal to camel-case.
|
|
34
|
+
*
|
|
35
|
+
* This can be useful when, for example, converting some kebab-cased command-line flags or a snake-cased database result.
|
|
36
|
+
*
|
|
37
|
+
* By default, consecutive uppercase letter are preserved. See {@link CamelCaseOptions.preserveConsecutiveUppercase preserveConsecutiveUppercase} option to change this behaviour.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```
|
|
41
|
+
* import type {CamelCase} from 'type-fest';
|
|
42
|
+
*
|
|
43
|
+
* // Simple
|
|
44
|
+
*
|
|
45
|
+
* const someVariable: CamelCase<'foo-bar'> = 'fooBar';
|
|
46
|
+
*
|
|
47
|
+
* // Advanced
|
|
48
|
+
*
|
|
49
|
+
* type CamelCasedProperties<T> = {
|
|
50
|
+
* [K in keyof T as CamelCase<K>]: T[K]
|
|
51
|
+
* };
|
|
52
|
+
*
|
|
53
|
+
* interface RawOptions {
|
|
54
|
+
* 'dry-run': boolean;
|
|
55
|
+
* 'full_family_name': string;
|
|
56
|
+
* foo: number;
|
|
57
|
+
* BAR: string;
|
|
58
|
+
* QUZ_QUX: number;
|
|
59
|
+
* 'OTHER-FIELD': boolean;
|
|
60
|
+
* }
|
|
61
|
+
*
|
|
62
|
+
* const dbResult: CamelCasedProperties<RawOptions> = {
|
|
63
|
+
* dryRun: true,
|
|
64
|
+
* fullFamilyName: 'bar.js',
|
|
65
|
+
* foo: 123,
|
|
66
|
+
* bar: 'foo',
|
|
67
|
+
* quzQux: 6,
|
|
68
|
+
* otherField: false
|
|
69
|
+
* };
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @category Change case
|
|
73
|
+
* @category Template literal
|
|
74
|
+
*/
|
|
75
|
+
export type CamelCase<
|
|
76
|
+
Type,
|
|
77
|
+
Options extends CamelCaseOptions = { preserveConsecutiveUppercase: true },
|
|
78
|
+
> = Type extends string
|
|
79
|
+
? string extends Type
|
|
80
|
+
? Type
|
|
81
|
+
: Uncapitalize<
|
|
82
|
+
CamelCaseFromArray<
|
|
83
|
+
SplitWords<Type extends Uppercase<Type> ? Lowercase<Type> : Type>,
|
|
84
|
+
Options
|
|
85
|
+
>
|
|
86
|
+
>
|
|
87
|
+
: Type;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { CamelCase, CamelCaseOptions } from './camelCase';
|
|
2
|
+
import type { UnknownArray } from './unknownArray';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Convert object properties to camel case recursively.
|
|
6
|
+
*
|
|
7
|
+
* This can be useful when, for example, converting some API types from a different style.
|
|
8
|
+
*
|
|
9
|
+
* @see CamelCasedProperties
|
|
10
|
+
* @see CamelCase
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```
|
|
14
|
+
* import type {CamelCasedPropertiesDeep} from 'type-fest';
|
|
15
|
+
*
|
|
16
|
+
* interface User {
|
|
17
|
+
* UserId: number;
|
|
18
|
+
* UserName: string;
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
* interface UserWithFriends {
|
|
22
|
+
* UserInfo: User;
|
|
23
|
+
* UserFriends: User[];
|
|
24
|
+
* }
|
|
25
|
+
*
|
|
26
|
+
* const result: CamelCasedPropertiesDeep<UserWithFriends> = {
|
|
27
|
+
* userInfo: {
|
|
28
|
+
* userId: 1,
|
|
29
|
+
* userName: 'Tom',
|
|
30
|
+
* },
|
|
31
|
+
* userFriends: [
|
|
32
|
+
* {
|
|
33
|
+
* userId: 2,
|
|
34
|
+
* userName: 'Jerry',
|
|
35
|
+
* },
|
|
36
|
+
* {
|
|
37
|
+
* userId: 3,
|
|
38
|
+
* userName: 'Spike',
|
|
39
|
+
* },
|
|
40
|
+
* ],
|
|
41
|
+
* };
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @category Change case
|
|
45
|
+
* @category Template literal
|
|
46
|
+
* @category Object
|
|
47
|
+
*/
|
|
48
|
+
export type CamelCasedPropertiesDeep<
|
|
49
|
+
Value,
|
|
50
|
+
Options extends CamelCaseOptions = { preserveConsecutiveUppercase: true },
|
|
51
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
52
|
+
> = Value extends Function
|
|
53
|
+
? Value
|
|
54
|
+
: Value extends UnknownArray
|
|
55
|
+
? CamelCasedPropertiesArrayDeep<Value>
|
|
56
|
+
: Value extends Set<infer U>
|
|
57
|
+
? Set<CamelCasedPropertiesDeep<U, Options>>
|
|
58
|
+
: {
|
|
59
|
+
[K in keyof Value as CamelCase<K, Options>]: CamelCasedPropertiesDeep<Value[K], Options>;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// This is a copy of DelimiterCasedPropertiesArrayDeep (see: delimiter-cased-properties-deep.d.ts).
|
|
63
|
+
// These types should be kept in sync.
|
|
64
|
+
type CamelCasedPropertiesArrayDeep<Value extends UnknownArray> = Value extends []
|
|
65
|
+
? []
|
|
66
|
+
: // Tailing spread array
|
|
67
|
+
Value extends [infer U, ...infer V]
|
|
68
|
+
? [CamelCasedPropertiesDeep<U>, ...CamelCasedPropertiesDeep<V>]
|
|
69
|
+
: Value extends readonly [infer U, ...infer V]
|
|
70
|
+
? readonly [CamelCasedPropertiesDeep<U>, ...CamelCasedPropertiesDeep<V>]
|
|
71
|
+
: // Leading spread array
|
|
72
|
+
Value extends readonly [...infer U, infer V]
|
|
73
|
+
? [...CamelCasedPropertiesDeep<U>, CamelCasedPropertiesDeep<V>]
|
|
74
|
+
: Value extends readonly [...infer U, infer V]
|
|
75
|
+
? readonly [...CamelCasedPropertiesDeep<U>, CamelCasedPropertiesDeep<V>]
|
|
76
|
+
: // Array
|
|
77
|
+
Value extends Array<infer U>
|
|
78
|
+
? Array<CamelCasedPropertiesDeep<U>>
|
|
79
|
+
: Value extends ReadonlyArray<infer U>
|
|
80
|
+
? ReadonlyArray<CamelCasedPropertiesDeep<U>>
|
|
81
|
+
: never;
|
package/src/util/colorVar.ts
CHANGED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
// these types come from https://github.com/sindresorhus/type-fest/blob/main/source/internal.d.ts
|
|
3
|
+
|
|
4
|
+
import type { Primitive } from './primitive';
|
|
5
|
+
import type { Trim } from './trim';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Matches any primitive, `void`, `Date`, or `RegExp` value.
|
|
9
|
+
*/
|
|
10
|
+
export type BuiltIns = Primitive | void | Date | RegExp;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Matches non-recursive types.
|
|
14
|
+
*/
|
|
15
|
+
export type NonRecursiveType =
|
|
16
|
+
| BuiltIns
|
|
17
|
+
| ((...arguments_: any[]) => unknown)
|
|
18
|
+
| (new (...arguments_: any[]) => unknown);
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Returns a boolean for whether the string is numeric.
|
|
22
|
+
*
|
|
23
|
+
* This type is a workaround for [Microsoft/TypeScript#46109](https://github.com/microsoft/TypeScript/issues/46109#issuecomment-930307987).
|
|
24
|
+
*/
|
|
25
|
+
export type IsNumeric<T extends string> = T extends `${number}`
|
|
26
|
+
? Trim<T> extends T
|
|
27
|
+
? true
|
|
28
|
+
: false
|
|
29
|
+
: false;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Returns a boolean for whether the string is lowercased.
|
|
33
|
+
*/
|
|
34
|
+
export type IsLowerCase<T extends string> = T extends Lowercase<T> ? true : false;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Returns a boolean for whether the string is upper-cased.
|
|
38
|
+
*/
|
|
39
|
+
export type IsUpperCase<T extends string> = T extends Uppercase<T> ? true : false;
|
|
40
|
+
|
|
41
|
+
export type WordSeparators = '-' | '_' | Whitespace;
|
|
42
|
+
|
|
43
|
+
export type Whitespace =
|
|
44
|
+
| '\u{9}' // '\t'
|
|
45
|
+
| '\u{A}' // '\n'
|
|
46
|
+
| '\u{B}' // '\v'
|
|
47
|
+
| '\u{C}' // '\f'
|
|
48
|
+
| '\u{D}' // '\r'
|
|
49
|
+
| '\u{20}' // ' '
|
|
50
|
+
| '\u{85}'
|
|
51
|
+
| '\u{A0}'
|
|
52
|
+
| '\u{1680}'
|
|
53
|
+
| '\u{2000}'
|
|
54
|
+
| '\u{2001}'
|
|
55
|
+
| '\u{2002}'
|
|
56
|
+
| '\u{2003}'
|
|
57
|
+
| '\u{2004}'
|
|
58
|
+
| '\u{2005}'
|
|
59
|
+
| '\u{2006}'
|
|
60
|
+
| '\u{2007}'
|
|
61
|
+
| '\u{2008}'
|
|
62
|
+
| '\u{2009}'
|
|
63
|
+
| '\u{200A}'
|
|
64
|
+
| '\u{2028}'
|
|
65
|
+
| '\u{2029}'
|
|
66
|
+
| '\u{202F}'
|
|
67
|
+
| '\u{205F}'
|
|
68
|
+
| '\u{3000}'
|
|
69
|
+
| '\u{FEFF}';
|
|
70
|
+
|
|
71
|
+
export type UpperCaseCharacters =
|
|
72
|
+
| 'A'
|
|
73
|
+
| 'B'
|
|
74
|
+
| 'C'
|
|
75
|
+
| 'D'
|
|
76
|
+
| 'E'
|
|
77
|
+
| 'F'
|
|
78
|
+
| 'G'
|
|
79
|
+
| 'H'
|
|
80
|
+
| 'I'
|
|
81
|
+
| 'J'
|
|
82
|
+
| 'K'
|
|
83
|
+
| 'L'
|
|
84
|
+
| 'M'
|
|
85
|
+
| 'N'
|
|
86
|
+
| 'O'
|
|
87
|
+
| 'P'
|
|
88
|
+
| 'Q'
|
|
89
|
+
| 'R'
|
|
90
|
+
| 'S'
|
|
91
|
+
| 'T'
|
|
92
|
+
| 'U'
|
|
93
|
+
| 'V'
|
|
94
|
+
| 'W'
|
|
95
|
+
| 'X'
|
|
96
|
+
| 'Y'
|
|
97
|
+
| 'Z';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// this type comes from https://github.com/sindresorhus/type-fest/blob/main/source/primitive.d.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
|
5
|
+
*
|
|
6
|
+
* @category Type
|
|
7
|
+
*/
|
|
8
|
+
export type Primitive = null | undefined | string | number | boolean | symbol | bigint;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// these types come from https://github.com/sindresorhus/type-fest/blob/main/source/split-words.d.ts
|
|
2
|
+
|
|
3
|
+
import type { IsLowerCase, IsNumeric, IsUpperCase, WordSeparators } from './internal';
|
|
4
|
+
|
|
5
|
+
type SkipEmptyWord<Word extends string> = Word extends '' ? [] : [Word];
|
|
6
|
+
|
|
7
|
+
type RemoveLastCharacter<
|
|
8
|
+
Sentence extends string,
|
|
9
|
+
Character extends string,
|
|
10
|
+
> = Sentence extends `${infer LeftSide}${Character}` ? SkipEmptyWord<LeftSide> : never;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Split a string (almost) like Lodash's `_.words()` function.
|
|
14
|
+
*
|
|
15
|
+
* - Split on each word that begins with a capital letter.
|
|
16
|
+
* - Split on each {@link WordSeparators}.
|
|
17
|
+
* - Split on numeric sequence.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```
|
|
21
|
+
* type Words0 = SplitWords<'helloWorld'>; // ['hello', 'World']
|
|
22
|
+
* type Words1 = SplitWords<'helloWORLD'>; // ['hello', 'WORLD']
|
|
23
|
+
* type Words2 = SplitWords<'hello-world'>; // ['hello', 'world']
|
|
24
|
+
* type Words3 = SplitWords<'--hello the_world'>; // ['hello', 'the', 'world']
|
|
25
|
+
* type Words4 = SplitWords<'lifeIs42'>; // ['life', 'Is', '42']
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @internal
|
|
29
|
+
* @category Change case
|
|
30
|
+
* @category Template literal
|
|
31
|
+
*/
|
|
32
|
+
export type SplitWords<
|
|
33
|
+
Sentence extends string,
|
|
34
|
+
LastCharacter extends string = '',
|
|
35
|
+
CurrentWord extends string = '',
|
|
36
|
+
> = Sentence extends `${infer FirstCharacter}${infer RemainingCharacters}`
|
|
37
|
+
? FirstCharacter extends WordSeparators
|
|
38
|
+
? // Skip word separator
|
|
39
|
+
[...SkipEmptyWord<CurrentWord>, ...SplitWords<RemainingCharacters>]
|
|
40
|
+
: LastCharacter extends ''
|
|
41
|
+
? // Fist char of word
|
|
42
|
+
SplitWords<RemainingCharacters, FirstCharacter, FirstCharacter>
|
|
43
|
+
: // Case change: non-numeric to numeric, push word
|
|
44
|
+
[false, true] extends [IsNumeric<LastCharacter>, IsNumeric<FirstCharacter>]
|
|
45
|
+
? [
|
|
46
|
+
...SkipEmptyWord<CurrentWord>,
|
|
47
|
+
...SplitWords<RemainingCharacters, FirstCharacter, FirstCharacter>,
|
|
48
|
+
]
|
|
49
|
+
: // Case change: numeric to non-numeric, push word
|
|
50
|
+
[true, false] extends [IsNumeric<LastCharacter>, IsNumeric<FirstCharacter>]
|
|
51
|
+
? [
|
|
52
|
+
...SkipEmptyWord<CurrentWord>,
|
|
53
|
+
...SplitWords<RemainingCharacters, FirstCharacter, FirstCharacter>,
|
|
54
|
+
]
|
|
55
|
+
: // No case change: concat word
|
|
56
|
+
[true, true] extends [IsNumeric<LastCharacter>, IsNumeric<FirstCharacter>]
|
|
57
|
+
? SplitWords<RemainingCharacters, FirstCharacter, `${CurrentWord}${FirstCharacter}`>
|
|
58
|
+
: // Case change: lower to upper, push word
|
|
59
|
+
[true, true] extends [IsLowerCase<LastCharacter>, IsUpperCase<FirstCharacter>]
|
|
60
|
+
? [
|
|
61
|
+
...SkipEmptyWord<CurrentWord>,
|
|
62
|
+
...SplitWords<RemainingCharacters, FirstCharacter, FirstCharacter>,
|
|
63
|
+
]
|
|
64
|
+
: // Case change: upper to lower, brings back the last character, push word
|
|
65
|
+
[true, true] extends [IsUpperCase<LastCharacter>, IsLowerCase<FirstCharacter>]
|
|
66
|
+
? [
|
|
67
|
+
...RemoveLastCharacter<CurrentWord, LastCharacter>,
|
|
68
|
+
...SplitWords<
|
|
69
|
+
RemainingCharacters,
|
|
70
|
+
FirstCharacter,
|
|
71
|
+
`${LastCharacter}${FirstCharacter}`
|
|
72
|
+
>,
|
|
73
|
+
]
|
|
74
|
+
: // No case change: concat word
|
|
75
|
+
SplitWords<RemainingCharacters, FirstCharacter, `${CurrentWord}${FirstCharacter}`>
|
|
76
|
+
: [...SkipEmptyWord<CurrentWord>];
|
package/src/util/trim.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// these types come from https://github.com/sindresorhus/type-fest/blob/main/source/trim.d.ts
|
|
2
|
+
|
|
3
|
+
import type { Whitespace } from './internal';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Remove spaces from the left side.
|
|
7
|
+
*/
|
|
8
|
+
type TrimLeft<V extends string> = V extends `${Whitespace}${infer R}` ? TrimLeft<R> : V;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Remove spaces from the right side.
|
|
12
|
+
*/
|
|
13
|
+
type TrimRight<V extends string> = V extends `${infer R}${Whitespace}` ? TrimRight<R> : V;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Remove leading and trailing spaces from a string.
|
|
17
|
+
* @example
|
|
18
|
+
* ```
|
|
19
|
+
* import type {Trim} from 'type-fest';
|
|
20
|
+
*
|
|
21
|
+
* Trim<' foo '>
|
|
22
|
+
* //=> 'foo'
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @category String
|
|
26
|
+
* @category Template literal
|
|
27
|
+
*/
|
|
28
|
+
export type Trim<V extends string> = TrimLeft<TrimRight<V>>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents an array with `unknown` value.
|
|
3
|
+
*
|
|
4
|
+
* Use case: You want a type that all arrays can be assigned to, but you don't care about the value.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```
|
|
8
|
+
* import type {UnknownArray} from 'type-fest';
|
|
9
|
+
*
|
|
10
|
+
* type IsArray<T> = T extends UnknownArray ? true : false;
|
|
11
|
+
*
|
|
12
|
+
* type A = IsArray<['foo']>;
|
|
13
|
+
* //=> true
|
|
14
|
+
*
|
|
15
|
+
* type B = IsArray<readonly number[]>;
|
|
16
|
+
* //=> true
|
|
17
|
+
*
|
|
18
|
+
* type C = IsArray<string>;
|
|
19
|
+
* //=> false
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @category Type
|
|
23
|
+
* @category Array
|
|
24
|
+
*/
|
|
25
|
+
export type UnknownArray = readonly unknown[];
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { useState, useEffect, useRef } from 'react';
|
|
2
|
+
|
|
3
|
+
export type ScrollDirection = 'up' | 'down';
|
|
4
|
+
|
|
5
|
+
export const useScrollDirection = (scrollContainerRef?: React.RefObject<HTMLElement>) => {
|
|
6
|
+
const [scrollDirection, setScrollDirection] = useState<ScrollDirection | null>(null);
|
|
7
|
+
const touchStartY = useRef(0);
|
|
8
|
+
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const container = scrollContainerRef?.current || window;
|
|
11
|
+
const touchTarget = scrollContainerRef?.current || document;
|
|
12
|
+
|
|
13
|
+
const handleWheel = (e: Event) => {
|
|
14
|
+
const event = e as WheelEvent;
|
|
15
|
+
if (event.deltaY > 0) {
|
|
16
|
+
setScrollDirection('down');
|
|
17
|
+
} else {
|
|
18
|
+
setScrollDirection('up');
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const handleTouchStart = (e: Event) => {
|
|
23
|
+
const event = e as TouchEvent;
|
|
24
|
+
touchStartY.current = event.touches[0].clientY;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const handleTouchMove = (e: Event) => {
|
|
28
|
+
const event = e as TouchEvent;
|
|
29
|
+
const currentTouchY = event.touches[0].clientY;
|
|
30
|
+
const deltaY = touchStartY.current - currentTouchY;
|
|
31
|
+
|
|
32
|
+
const TOUCH_THRESHOLD = 10; // pixels
|
|
33
|
+
|
|
34
|
+
if (Math.abs(deltaY) < TOUCH_THRESHOLD) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (deltaY > 0) {
|
|
39
|
+
setScrollDirection('down');
|
|
40
|
+
} else {
|
|
41
|
+
setScrollDirection('up');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Reset the starting point to prevent continuous firing
|
|
45
|
+
touchStartY.current = currentTouchY;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
container.addEventListener('wheel', handleWheel, { passive: true });
|
|
49
|
+
touchTarget.addEventListener('touchstart', handleTouchStart, { passive: true });
|
|
50
|
+
touchTarget.addEventListener('touchmove', handleTouchMove, { passive: true });
|
|
51
|
+
|
|
52
|
+
return () => {
|
|
53
|
+
container.removeEventListener('wheel', handleWheel);
|
|
54
|
+
touchTarget.removeEventListener('touchstart', handleTouchStart);
|
|
55
|
+
touchTarget.removeEventListener('touchmove', handleTouchMove);
|
|
56
|
+
};
|
|
57
|
+
}, [scrollContainerRef]);
|
|
58
|
+
|
|
59
|
+
return scrollDirection;
|
|
60
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useState, useEffect, useRef } from 'react';
|
|
2
|
+
import { useScrollDirection } from './useScrollDirection';
|
|
3
|
+
|
|
4
|
+
export const useStickyVisibility = () => {
|
|
5
|
+
const [isVisible, setIsVisible] = useState(true);
|
|
6
|
+
const toolbarRef = useRef<HTMLDivElement>(null);
|
|
7
|
+
const [toolbarHeight, setToolbarHeight] = useState(0);
|
|
8
|
+
const [scrollY, setScrollY] = useState(0);
|
|
9
|
+
|
|
10
|
+
const scrollDirection = useScrollDirection();
|
|
11
|
+
|
|
12
|
+
// listen for scroll events
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const handleScroll = () => {
|
|
15
|
+
setScrollY(window.scrollY);
|
|
16
|
+
};
|
|
17
|
+
window.addEventListener('scroll', handleScroll, { passive: true });
|
|
18
|
+
return () => window.removeEventListener('scroll', handleScroll);
|
|
19
|
+
}, []);
|
|
20
|
+
|
|
21
|
+
// measure the toolbars height
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (toolbarRef.current) {
|
|
24
|
+
setToolbarHeight(toolbarRef.current.offsetHeight);
|
|
25
|
+
}
|
|
26
|
+
}, []);
|
|
27
|
+
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (scrollDirection === 'down' && scrollY > toolbarHeight && toolbarHeight > 0) {
|
|
30
|
+
setIsVisible(false);
|
|
31
|
+
} else {
|
|
32
|
+
setIsVisible(true);
|
|
33
|
+
}
|
|
34
|
+
}, [scrollDirection, toolbarHeight, scrollY]);
|
|
35
|
+
|
|
36
|
+
return { toolbarRef, isVisible, toolbarHeight };
|
|
37
|
+
};
|
package/dist/Accordion/index.cjs
DELETED
package/dist/Accordion/index.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
require('../Typography-Ds4gfOJz.cjs');
|
|
2
|
-
const require_ButtonBase = require('../ButtonBase-B6vDKbGQ.cjs');
|
|
3
|
-
require('../ButtonBase-DbWQ25n-.cjs');
|
|
4
|
-
|
|
5
|
-
exports.ButtonBase = require_ButtonBase.ButtonBase;
|
|
6
|
-
exports.ButtonBaseOverrides = require_ButtonBase.ButtonBaseOverrides;
|