@shopgate/engage 7.32.0-beta.1 → 7.32.0-beta.10
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/README.md +0 -1
- package/account/components/Profile/Profile.provider.d.ts +1 -1
- package/account/components/Profile/ProfileAddressBook.d.ts.map +1 -1
- package/account/components/Profile/ProfileAddressBook.js +13 -22
- package/account/components/Profile/ProfileAddressCard.d.ts.map +1 -1
- package/account/components/Profile/ProfileAddressCard.js +9 -18
- package/account/components/Profile/ProfileForm.d.ts.map +1 -1
- package/account/components/Profile/ProfileForm.js +15 -42
- package/account/components/ProfileContact/ProfileContact.js +13 -21
- package/admin-preview/components/FrontendSettingsPreviewBridge/FrontendSettingsPreviewBridge.d.ts +2 -1
- package/admin-preview/components/FrontendSettingsPreviewBridge/FrontendSettingsPreviewBridge.d.ts.map +1 -1
- package/admin-preview/components/FrontendSettingsPreviewBridge/FrontendSettingsPreviewBridge.js +61 -5
- package/admin-preview/components/FrontendSettingsPreviewBridge/helpers.d.ts +7 -1
- package/admin-preview/components/FrontendSettingsPreviewBridge/helpers.d.ts.map +1 -1
- package/admin-preview/components/FrontendSettingsPreviewBridge/helpers.js +14 -2
- package/admin-preview/components/FrontendSettingsPreviewBridge/types.d.ts +15 -2
- package/admin-preview/components/FrontendSettingsPreviewBridge/types.d.ts.map +1 -1
- package/admin-preview/constants/index.d.ts +0 -12
- package/admin-preview/constants/index.d.ts.map +1 -1
- package/admin-preview/constants/index.js +0 -16
- package/admin-preview/helpers/_internal/detection.d.ts +53 -0
- package/admin-preview/helpers/_internal/detection.d.ts.map +1 -0
- package/admin-preview/helpers/_internal/detection.js +93 -0
- package/admin-preview/helpers/index.d.ts +7 -0
- package/admin-preview/helpers/index.d.ts.map +1 -1
- package/admin-preview/helpers/index.js +12 -4
- package/admin-preview/initialization/_internal/initialFrontendSettings.d.ts +32 -0
- package/admin-preview/initialization/_internal/initialFrontendSettings.d.ts.map +1 -0
- package/admin-preview/initialization/_internal/initialFrontendSettings.js +43 -0
- package/admin-preview/initialization/awaitInitialFrontendSettings.d.ts +22 -0
- package/admin-preview/initialization/awaitInitialFrontendSettings.d.ts.map +1 -0
- package/admin-preview/initialization/awaitInitialFrontendSettings.js +84 -0
- package/back-in-stock/components/BackInStockButton/index.js +5 -5
- package/back-in-stock/components/Subscriptions/components/Subscription/index.js +2 -5
- package/cart/components/CartItem/CartItemProductLayout.js +2 -1
- package/cart/components/CartItem/CartItemProductLayoutWide.js +2 -2
- package/cart/components/CartItem/CartItemProductLayoutWideRemoveItem.js +7 -14
- package/cart/components/CartItem/CartItemProductProvider.connector.js +0 -2
- package/cart/components/CartItem/CartItemProductProvider.js +3 -30
- package/cart/components/CartItem/CartItemProductProvider.types.js +0 -1
- package/cart/components/CartItem/CartItemQuantityPicker.js +1 -0
- package/cart/components/CartItems/CartItemCardReservationLabelChangeStore.js +6 -24
- package/cart/components/CartItems/CartItems.js +8 -10
- package/cart/components/CartItems/CartItemsSubstitution.js +3 -2
- package/cart/components/CartSummaryWide/CartSummaryWide.js +2 -2
- package/cart/components/CartSummaryWide/CartSummaryWideCheckoutButton.js +9 -23
- package/cart/components/PaymentBar/PaymentBarCheckoutButton.js +8 -30
- package/cart/components/PaymentBar/PaymentBarContent.js +1 -1
- package/cart/components/PaymentBar/testUtils/mockFactories.js +4 -11
- package/category/components/CategoryImage/index.js +24 -17
- package/checkout/components/AddressBook/AddressList.js +14 -23
- package/checkout/components/Checkout/CheckoutActions.js +4 -3
- package/checkout/components/Checkout/CheckoutAddress.js +8 -0
- package/checkout/components/Checkout/CheckoutSection.js +6 -2
- package/checkout/components/CheckoutConfirmation/CheckoutConfirmation.js +6 -7
- package/checkout/components/ResponsiveBackButton/ResponsiveBackButton.js +7 -17
- package/components/Badge/Badge.d.ts +30 -0
- package/components/Badge/Badge.d.ts.map +1 -0
- package/components/Badge/Badge.js +48 -0
- package/components/Badge/index.d.ts +3 -0
- package/components/Badge/index.d.ts.map +1 -0
- package/components/Badge/index.js +1 -0
- package/components/Card/Card.d.ts +27 -0
- package/components/Card/Card.d.ts.map +1 -0
- package/components/Card/Card.js +57 -0
- package/components/Card/index.d.ts +4 -0
- package/components/Card/index.d.ts.map +1 -0
- package/components/Card/index.js +2 -0
- package/components/Card/useCardAppearance.d.ts +11 -0
- package/components/Card/useCardAppearance.d.ts.map +1 -0
- package/components/Card/useCardAppearance.js +22 -0
- package/components/ChipLayout/index.js +2 -4
- package/components/Logo/index.d.ts.map +1 -1
- package/components/Logo/index.js +3 -6
- package/components/NavigationHandler/connector.js +1 -1
- package/components/NavigationHandler/index.d.ts +2 -2
- package/components/Paper/Paper.d.ts +48 -0
- package/components/Paper/Paper.d.ts.map +1 -0
- package/components/Paper/Paper.js +64 -0
- package/components/Paper/index.d.ts +3 -0
- package/components/Paper/index.d.ts.map +1 -0
- package/components/Paper/index.js +1 -0
- package/components/PickerUtilize/index.d.ts +2 -1
- package/components/PickerUtilize/index.d.ts.map +1 -1
- package/components/RadioCard/RadioCard.d.ts.map +1 -1
- package/components/RadioCard/RadioCard.js +2 -1
- package/components/SheetList/components/Item/index.js +8 -8
- package/components/Tabs/components/Tab.d.ts.map +1 -1
- package/components/Tabs/components/Tab.js +14 -16
- package/components/Typography/Typography.d.ts +1 -1
- package/components/View/components/Above/index.d.ts.map +1 -1
- package/components/View/components/Above/index.js +3 -1
- package/components/View/components/Below/index.d.ts.map +1 -1
- package/components/View/components/Below/index.js +3 -1
- package/components/View/components/Content/index.d.ts +2 -1
- package/components/View/components/Content/index.d.ts.map +1 -1
- package/components/View/components/Content/index.js +4 -1
- package/components/constants.d.ts +6 -0
- package/components/constants.d.ts.map +1 -0
- package/components/index.d.ts +5 -1
- package/components/index.d.ts.map +1 -1
- package/components/index.js +4 -2
- package/components/v2/Button/Button.d.ts +24 -13
- package/components/v2/Button/Button.d.ts.map +1 -1
- package/components/v2/Button/Button.js +139 -41
- package/components/v2/ButtonBase/ButtonBase.d.ts +50 -10
- package/components/v2/ButtonBase/ButtonBase.d.ts.map +1 -1
- package/components/v2/ButtonBase/ButtonBase.js +192 -17
- package/components/v2/ButtonBase/Ripple.d.ts +2 -1
- package/components/v2/ButtonBase/Ripple.d.ts.map +1 -1
- package/components/v2/ButtonBase/hooks.d.ts +0 -1
- package/components/v2/ButtonBase/hooks.d.ts.map +1 -1
- package/components/v2/ButtonBase/hooks.js +36 -12
- package/components/v2/ButtonGroup/ButtonGroup.d.ts +11 -5
- package/components/v2/ButtonGroup/ButtonGroup.d.ts.map +1 -1
- package/components/v2/ButtonGroup/ButtonGroup.js +49 -26
- package/components/v2/CircularProgress/CircularProgress.d.ts.map +1 -1
- package/components/v2/CircularProgress/CircularProgress.js +10 -5
- package/core/helpers/getFullImageSource.d.ts +5 -1
- package/core/helpers/getFullImageSource.d.ts.map +1 -1
- package/core/helpers/getFullImageSource.js +30 -14
- package/core/helpers/i18n.d.ts +4 -0
- package/core/helpers/i18n.d.ts.map +1 -1
- package/core/helpers/i18n.js +3 -0
- package/core/hooks/html/useLoadImage.d.ts +3 -3
- package/core/hooks/html/useLoadImage.d.ts.map +1 -1
- package/core/hooks/html/useLoadImage.js +2 -2
- package/core/hooks/useLocalStorage.d.ts +8 -0
- package/core/hooks/useLocalStorage.d.ts.map +1 -1
- package/core/hooks/useLocalStorage.js +22 -15
- package/core/hooks/useNavigation.d.ts +10 -2
- package/core/hooks/useNavigation.d.ts.map +1 -1
- package/core/hooks/useNavigation.js +1 -2
- package/core/initialization/fetchSettings.d.ts +12 -0
- package/core/initialization/fetchSettings.d.ts.map +1 -0
- package/core/initialization/fetchSettings.js +134 -0
- package/core/initialization/index.d.ts +33 -2
- package/core/initialization/index.d.ts.map +1 -1
- package/core/initialization/index.js +44 -103
- package/core/router/conductor.d.ts +9 -0
- package/core/router/helpers.d.ts +28 -15
- package/core/router/helpers.d.ts.map +1 -1
- package/core/router/helpers.js +8 -8
- package/development/components/DevelopmentSettings/DevelopmentSettings.js +3 -3
- package/development/components/SimulatedInsets/SimulatedInsetBottom.js +3 -3
- package/development/components/SimulatedInsets/SimulatedInsetTop.js +2 -2
- package/favorites/components/FavoriteButtonWide/FavoriteButtonWide.js +7 -17
- package/favorites/components/Item/Item.d.ts +1 -1
- package/favorites/components/Item/Item.d.ts.map +1 -1
- package/favorites/components/Item/Item.js +7 -7
- package/favorites/components/List/List.d.ts +1 -1
- package/favorites/components/List/List.d.ts.map +1 -1
- package/favorites/components/List/List.js +0 -1
- package/favorites/components/List/ListContent.js +4 -5
- package/favorites/components/Lists/Lists.js +17 -6
- package/filter/components/FilterPageContent/components/ApplyButton/index.js +8 -10
- package/filter/components/FilterPageContent/components/ResetButton/index.js +8 -6
- package/filter/components/PriceSlider/index.js +6 -1
- package/locations/components/ChangeLocationButton/ChangeLocationButton.js +10 -14
- package/locations/components/FulfillmentSheet/FulfillmentSheetContent.js +4 -8
- package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotDialog.js +4 -8
- package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcher.js +1 -1
- package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcherBar.js +9 -18
- package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcherDefault.js +10 -10
- package/locations/components/GlobalLocationSwitcher/GlobalLocationSwitcherBar.js +9 -19
- package/locations/components/GlobalLocationSwitcher/GlobalLocationSwitcherDefault.js +9 -10
- package/locations/components/ReserveForm/ReserveForm.js +6 -7
- package/locations/components/StoreDetails/components/GetDirectionsButton.js +2 -4
- package/locations/components/StoreDetails/components/StoreDetails.js +5 -10
- package/locations/components/StoreDetails/components/StoresNearbyListItem.js +13 -21
- package/locations/components/StoreFinder/StoreFinderSelectLocationButton.js +5 -11
- package/locations/components/StoreFinder/StoreFinderStoreInfoButton.js +5 -11
- package/locations/components/StoreList/StoreListProduct.js +2 -3
- package/locations/components/StoreList/StoreListSearch.js +1 -0
- package/locations/components/StoreList/StoreSelectLocationButton.js +5 -11
- package/login/components/ForgotPassword/ForgotPassword.js +11 -23
- package/mocks/date.js +31 -0
- package/mocks/index.js +3 -0
- package/mocks/pipelineRequest.js +1 -0
- package/mocks/subscriptions.js +1 -0
- package/orders/components/OrderDetails/OrderDetailsAuthenticate.js +5 -7
- package/orders/components/OrderHistory/OrderHistoryList.d.ts.map +1 -1
- package/orders/components/OrderHistory/OrderHistoryList.js +8 -9
- package/orders/components/OrderHistory/OrderHistoryTable.d.ts.map +1 -1
- package/orders/components/OrderHistory/OrderHistoryTable.js +4 -0
- package/package.json +12 -12
- package/page/components/NotFound.d.ts +7 -0
- package/page/components/NotFound.d.ts.map +1 -0
- package/page/components/NotFound.js +8 -8
- package/page/components/ResponsiveWidgetImage/ResponsiveWidgetImage.d.ts +52 -0
- package/page/components/ResponsiveWidgetImage/ResponsiveWidgetImage.d.ts.map +1 -0
- package/page/components/ResponsiveWidgetImage/ResponsiveWidgetImage.js +4 -4
- package/page/components/ResponsiveWidgetImage/index.d.ts +2 -0
- package/page/components/ResponsiveWidgetImage/index.d.ts.map +1 -0
- package/page/components/WidgetRichText/WidgetRichText.d.ts +25 -0
- package/page/components/WidgetRichText/WidgetRichText.d.ts.map +1 -0
- package/page/components/WidgetRichText/index.d.ts +2 -0
- package/page/components/WidgetRichText/index.d.ts.map +1 -0
- package/page/components/WidgetVideo/WidgetVideo.d.ts +43 -0
- package/page/components/WidgetVideo/WidgetVideo.d.ts.map +1 -0
- package/page/components/WidgetVideo/WidgetVideo.js +33 -39
- package/page/components/WidgetVideo/index.d.ts +2 -0
- package/page/components/WidgetVideo/index.d.ts.map +1 -0
- package/page/components/Widgets/Overlay.d.ts +17 -0
- package/page/components/Widgets/Overlay.d.ts.map +1 -0
- package/page/components/Widgets/Overlay.js +24 -38
- package/page/components/Widgets/Tooltip.d.ts +20 -0
- package/page/components/Widgets/Tooltip.d.ts.map +1 -0
- package/page/components/Widgets/Tooltip.js +6 -10
- package/page/components/Widgets/Widget.d.ts +32 -0
- package/page/components/Widgets/Widget.d.ts.map +1 -0
- package/page/components/Widgets/Widget.js +7 -18
- package/page/components/Widgets/WidgetContext.d.ts +32 -38
- package/page/components/Widgets/WidgetContext.d.ts.map +1 -0
- package/page/components/Widgets/WidgetContext.js +2 -8
- package/page/components/Widgets/WidgetProvider.d.ts +25 -0
- package/page/components/Widgets/WidgetProvider.d.ts.map +1 -0
- package/page/components/Widgets/WidgetProvider.js +5 -12
- package/page/components/Widgets/Widgets.d.ts +16 -0
- package/page/components/Widgets/Widgets.d.ts.map +1 -0
- package/page/components/Widgets/Widgets.js +5 -12
- package/page/components/Widgets/WidgetsPreviewContext.d.ts +21 -0
- package/page/components/Widgets/WidgetsPreviewContext.d.ts.map +1 -0
- package/page/components/Widgets/WidgetsPreviewContext.js +5 -7
- package/page/components/Widgets/WidgetsPreviewProvider.d.ts +18 -0
- package/page/components/Widgets/WidgetsPreviewProvider.d.ts.map +1 -0
- package/page/components/Widgets/WidgetsPreviewProvider.js +5 -6
- package/page/components/Widgets/constants.d.ts +5 -0
- package/page/components/Widgets/constants.d.ts.map +1 -0
- package/page/components/Widgets/constants.js +3 -1
- package/page/components/Widgets/events.d.ts +38 -0
- package/page/components/Widgets/events.d.ts.map +1 -0
- package/page/components/Widgets/events.js +8 -12
- package/page/components/Widgets/helpers.d.ts +50 -0
- package/page/components/Widgets/helpers.d.ts.map +1 -0
- package/page/components/Widgets/helpers.js +8 -13
- package/page/components/Widgets/hooks.d.ts +13 -0
- package/page/components/Widgets/hooks.d.ts.map +1 -0
- package/page/components/Widgets/hooks.js +13 -11
- package/page/components/Widgets/index.d.ts +3 -0
- package/page/components/Widgets/index.d.ts.map +1 -0
- package/page/components/Widgets/types.d.ts +111 -113
- package/page/components/Widgets/types.d.ts.map +1 -0
- package/page/components/Widgets/types.js +1 -0
- package/page/components/index.d.ts +5 -0
- package/page/components/index.d.ts.map +1 -0
- package/page/constants/actionTypes.d.ts +4 -0
- package/page/constants/actionTypes.d.ts.map +1 -0
- package/page/constants/index.d.ts +25 -0
- package/page/constants/index.d.ts.map +1 -0
- package/page/constants/index.js +5 -3
- package/page/helpers/index.d.ts +70 -62
- package/page/helpers/index.d.ts.map +1 -0
- package/page/helpers/index.js +31 -29
- package/page/hooks/index.d.ts +54 -53
- package/page/hooks/index.d.ts.map +1 -0
- package/page/hooks/index.js +20 -15
- package/page/selectors/index.d.ts +32 -0
- package/page/selectors/index.d.ts.map +1 -0
- package/page/widgets/Button/Button.js +2 -3
- package/page/widgets/NestedCategoryFilter/NestedCategoryFilter.js +8 -8
- package/page/widgets/ProductList/ProductList.js +18 -14
- package/page/widgets/ProductSlider/ProductSlider.js +1 -15
- package/page/widgets/Video/Video.d.ts +6 -0
- package/page/widgets/Video/Video.d.ts.map +1 -0
- package/page/widgets/Video/Video.js +0 -2
- package/page/widgets/Video/hooks.d.ts +53 -0
- package/page/widgets/Video/hooks.d.ts.map +1 -0
- package/page/widgets/Video/hooks.js +4 -12
- package/page/widgets/Video/index.d.ts +2 -0
- package/page/widgets/Video/index.d.ts.map +1 -0
- package/product/components/Description/index.js +0 -2
- package/product/components/FilterBar/components/Content/components/FilterButton/index.js +2 -6
- package/product/components/FilterBar/components/Content/components/Sort/index.js +1 -5
- package/product/components/Media/FeaturedMedia.js +7 -1
- package/product/components/Media/MediaImage.js +24 -23
- package/product/components/Media/MediaPlaceholder.js +4 -7
- package/product/components/MediaSlider/components/MediaImage/index.js +6 -2
- package/product/components/MediaSlider/constants.js +1 -12
- package/product/components/OrderQuantityHint/index.js +16 -1
- package/product/components/ProductCard/index.js +36 -23
- package/product/components/ProductGrid/components/Item/components/ItemDetails/index.js +12 -4
- package/product/components/ProductGrid/components/Item/components/ItemImage/index.js +3 -6
- package/product/components/ProductGrid/components/Item/components/ItemName/index.js +6 -1
- package/product/components/ProductGrid/components/Item/index.js +10 -2
- package/product/components/ProductGrid/components/Layout/index.js +19 -4
- package/product/components/ProductGrid/constants.d.ts +2 -0
- package/product/components/ProductGrid/constants.d.ts.map +1 -0
- package/product/components/ProductGrid/constants.js +1 -0
- package/product/components/ProductGrid/hooks.d.ts +11 -0
- package/product/components/ProductGrid/hooks.d.ts.map +1 -0
- package/product/components/ProductGrid/hooks.js +48 -0
- package/product/components/ProductGrid/index.js +3 -6
- package/product/components/ProductGridPrice/index.js +0 -1
- package/product/components/ProductImage/ProductImage.d.ts +42 -0
- package/product/components/ProductImage/ProductImage.d.ts.map +1 -0
- package/product/components/ProductImage/ProductImage.js +158 -0
- package/product/components/ProductImage/ProductImagePlaceholder.d.ts +23 -0
- package/product/components/ProductImage/ProductImagePlaceholder.d.ts.map +1 -0
- package/product/components/ProductImage/ProductImagePlaceholder.js +12 -17
- package/product/components/ProductImage/constants.d.ts +7 -0
- package/product/components/ProductImage/constants.d.ts.map +1 -0
- package/product/components/ProductImage/constants.js +6 -0
- package/product/components/ProductImage/hooks.d.ts +8 -0
- package/product/components/ProductImage/hooks.d.ts.map +1 -0
- package/product/components/ProductImage/hooks.js +32 -0
- package/product/components/ProductImage/index.d.ts +3 -0
- package/product/components/ProductImage/index.d.ts.map +1 -0
- package/product/components/ProductImage/index.js +1 -201
- package/product/components/ProductList/components/Item/index.js +5 -3
- package/product/components/ProductList/components/Layout/index.js +8 -20
- package/product/components/ProductName/ProductName.d.ts +1 -1
- package/product/components/ProductName/ProductName.d.ts.map +1 -1
- package/product/components/ProductName/ProductNameContent.d.ts +2 -1
- package/product/components/ProductName/ProductNameContent.d.ts.map +1 -1
- package/product/components/ProductRatingStars/ProductRatingStars.d.ts +1 -1
- package/product/components/ProductRatingStars/ProductRatingStars.js +2 -4
- package/product/components/ProductSlider/constants.d.ts +3 -0
- package/product/components/ProductSlider/constants.d.ts.map +1 -0
- package/product/components/ProductSlider/constants.js +2 -0
- package/product/components/ProductSlider/hooks.d.ts +7 -0
- package/product/components/ProductSlider/hooks.d.ts.map +1 -0
- package/product/components/ProductSlider/hooks.js +40 -0
- package/product/components/ProductSlider/index.js +8 -8
- package/product/components/Rating/index.js +2 -4
- package/product/components/RelationsSlider/RelationsSheet.js +1 -5
- package/product/components/RelationsSlider/RelationsSliderContent.js +3 -2
- package/product/components/RelationsSlider/constants.d.ts +3 -0
- package/product/components/RelationsSlider/constants.d.ts.map +1 -0
- package/product/components/RelationsSlider/constants.js +2 -1
- package/product/components/RelationsSlider/hooks.d.ts +6 -0
- package/product/components/RelationsSlider/hooks.d.ts.map +1 -0
- package/product/components/RelationsSlider/hooks.js +34 -0
- package/product/components/UnitQuantityPicker/UnitQuantityPicker.d.ts.map +1 -1
- package/product/components/UnitQuantityPicker/UnitQuantityPicker.js +16 -34
- package/product/helpers/index.js +29 -11
- package/product/hooks/index.js +3 -1
- package/product/hooks/useLoadProductImage.js +4 -2
- package/product/hooks/useShowEmptyRatingStars.d.ts +7 -0
- package/product/hooks/useShowEmptyRatingStars.d.ts.map +1 -0
- package/product/hooks/useShowEmptyRatingStars.js +21 -0
- package/product/index.js +0 -1
- package/product/selectors/mocks/productProperties.mock.js +49 -0
- package/push-opt-in/components/PushOptInModal/index.js +4 -4
- package/registration/components/Registration/RegistrationFormActions.js +4 -4
- package/reviews/components/Reviews/components/AllReviewsLink/index.js +6 -6
- package/reviews/components/Reviews/components/Header/components/WriteReviewLink/index.js +4 -3
- package/settings/action-creators/appSettings.d.ts +3 -3
- package/settings/action-creators/appSettings.d.ts.map +1 -1
- package/settings/constants/appSettings.d.ts +3 -0
- package/settings/constants/appSettings.d.ts.map +1 -1
- package/settings/constants/appSettings.js +6 -1
- package/settings/constants/imageSettings.d.ts +52 -0
- package/settings/constants/imageSettings.d.ts.map +1 -0
- package/settings/constants/imageSettings.js +69 -0
- package/settings/helpers/index.d.ts +3 -0
- package/settings/helpers/index.d.ts.map +1 -0
- package/settings/helpers/index.js +1 -0
- package/settings/helpers/resolveImageSettings.d.ts +70 -0
- package/settings/helpers/resolveImageSettings.d.ts.map +1 -0
- package/settings/helpers/resolveImageSettings.js +171 -0
- package/settings/helpers/toImageQuality.d.ts +7 -0
- package/settings/helpers/toImageQuality.d.ts.map +1 -0
- package/settings/helpers/toImageQuality.js +44 -0
- package/settings/helpers/toThumborColor.d.ts +15 -0
- package/settings/helpers/toThumborColor.d.ts.map +1 -0
- package/settings/helpers/toThumborColor.js +51 -0
- package/settings/hooks/index.d.ts +2 -0
- package/settings/hooks/index.d.ts.map +1 -0
- package/settings/hooks/index.js +1 -0
- package/settings/hooks/useImageSettings.d.ts +28 -0
- package/settings/hooks/useImageSettings.d.ts.map +1 -0
- package/settings/hooks/useImageSettings.js +39 -0
- package/settings/reducers/appSettings.d.ts.map +1 -1
- package/settings/reducers/appSettings.js +100 -8
- package/settings/reducers/index.d.ts +3 -3
- package/settings/selectors/appSettings.d.ts +114 -1
- package/settings/selectors/appSettings.d.ts.map +1 -1
- package/settings/selectors/appSettings.js +75 -1
- package/settings/types/appSettings.d.ts +244 -0
- package/settings/types/appSettings.d.ts.map +1 -1
- package/settings/types/appSettings.js +124 -1
- package/styles/helpers/index.d.ts +2 -0
- package/styles/helpers/index.js +2 -0
- package/styles/helpers/loadFontCss.d.ts +22 -0
- package/styles/helpers/loadFontCss.d.ts.map +1 -0
- package/styles/helpers/loadFontCss.js +138 -0
- package/styles/helpers/loadThemeCss.d.ts +14 -0
- package/styles/helpers/loadThemeCss.d.ts.map +1 -0
- package/styles/helpers/loadThemeCss.js +123 -0
- package/styles/index.d.ts +1 -1
- package/styles/index.d.ts.map +1 -1
- package/styles/index.js +1 -1
- package/styles/reset/root.js +23 -4
- package/styles/reset/typographyCustomProps.d.ts +12 -0
- package/styles/reset/typographyCustomProps.d.ts.map +1 -0
- package/styles/reset/typographyCustomProps.js +11 -0
- package/styles/theme/createDefaultThemeOptions/index.d.ts.map +1 -1
- package/styles/theme/createDefaultThemeOptions/index.js +107 -4
- package/styles/theme/createTheme/createComponents.d.ts +2 -2
- package/styles/theme/createTheme/createComponents.d.ts.map +1 -1
- package/styles/theme/createTheme/createComponents.js +0 -1
- package/styles/theme/createTheme/createComponents.types.d.ts +117 -0
- package/styles/theme/createTheme/createComponents.types.d.ts.map +1 -1
- package/styles/theme/createTheme/createComponents.types.js +119 -2
- package/styles/theme/createTheme/createCssVarsForColorSchemeThemes.d.ts.map +1 -1
- package/styles/theme/createTheme/createCssVarsForColorSchemeThemes.js +13 -3
- package/styles/theme/createTheme/createPalette.types.d.ts +5 -0
- package/styles/theme/createTheme/createPalette.types.d.ts.map +1 -1
- package/styles/theme/createTheme/createPalette.types.js +7 -2
- package/styles/theme/createTheme/createShape.d.ts +3 -0
- package/styles/theme/createTheme/createShape.d.ts.map +1 -1
- package/styles/theme/createTheme/createSpacing.js +4 -1
- package/styles/theme/createTheme/createThemeFromColorScheme.d.ts +4 -2
- package/styles/theme/createTheme/createThemeFromColorScheme.d.ts.map +1 -1
- package/styles/theme/createTheme/createThemeFromColorScheme.js +6 -3
- package/styles/theme/createTheme/createTypography.d.ts +2 -1
- package/styles/theme/createTheme/createTypography.js +59 -18
- package/styles/theme/createTheme/helpers/cssVarsParser.d.ts.map +1 -1
- package/styles/theme/createTheme/helpers/cssVarsParser.js +10 -3
- package/styles/theme/createTheme/index.d.ts +2 -1
- package/styles/theme/createTheme/index.d.ts.map +1 -1
- package/styles/theme/createTheme/index.js +5 -2
- package/styles/theme/createTheme/layout.d.ts +23 -0
- package/styles/theme/createTheme/layout.d.ts.map +1 -0
- package/styles/theme/createTheme/layout.js +20 -0
- package/styles/theme/createTheme/shadows.d.ts +11 -1
- package/styles/theme/createTheme/shadows.d.ts.map +1 -1
- package/styles/theme/createTheme/shadows.js +41 -7
- package/styles/theme/createTheme/transitions.d.ts +4 -0
- package/styles/theme/createTheme/transitions.js +3 -1
- package/styles/theme/createTheme/types.d.ts +41 -9
- package/styles/theme/createTheme/types.d.ts.map +1 -1
- package/styles/theme/createTheme/types.js +16 -4
- package/styles/theme/hocs/index.d.ts +2 -0
- package/styles/theme/hocs/index.d.ts.map +1 -0
- package/styles/theme/hocs/index.js +1 -0
- package/styles/theme/hocs/withTheme.d.ts +21 -0
- package/styles/theme/hocs/withTheme.d.ts.map +1 -0
- package/styles/theme/hocs/withTheme.js +33 -0
- package/styles/theme/hooks/useColorScheme.d.ts +4 -3
- package/styles/theme/hooks/useColorScheme.d.ts.map +1 -1
- package/styles/theme/hooks/useColorScheme.js +4 -3
- package/styles/theme/hooks/useMediaQuery.d.ts +7 -0
- package/styles/theme/hooks/useMediaQuery.d.ts.map +1 -1
- package/styles/theme/hooks/useMediaQuery.js +5 -5
- package/styles/theme/hooks/useTheme.js +1 -1
- package/styles/theme/index.d.ts +5 -1
- package/styles/theme/index.d.ts.map +1 -1
- package/styles/theme/index.js +2 -1
- package/styles/theme/providers/ActiveBreakpointProvider.d.ts +1 -1
- package/styles/theme/providers/ColorSchemeContext.d.ts +40 -0
- package/styles/theme/providers/ColorSchemeContext.d.ts.map +1 -0
- package/styles/theme/providers/ColorSchemeContext.js +14 -0
- package/styles/theme/providers/ThemeContext.d.ts +3 -0
- package/styles/theme/providers/ThemeContext.d.ts.map +1 -0
- package/styles/theme/providers/ThemeContext.js +2 -0
- package/styles/theme/providers/ThemeProvider.d.ts +4 -14
- package/styles/theme/providers/ThemeProvider.d.ts.map +1 -1
- package/styles/theme/providers/ThemeProvider.js +88 -26
- package/styles/theme/utils/color.d.ts +12 -12
- package/styles/theme/utils/color.d.ts.map +1 -1
- package/tracking/components/CookieConsentModal/index.js +3 -4
- package/tracking/components/PrivacySettings/index.js +3 -3
- package/cart/components/PaymentBar/PaymentBarReserveButton.connector.js +0 -6
- package/cart/components/PaymentBar/PaymentBarReserveButton.js +0 -71
- package/components/ChipLayout/spec.js +0 -41
- package/components/Logo/spec.js +0 -12
- package/components/NavigationHandler/spec.js +0 -84
- package/components/Picker/spec.js +0 -94
- package/components/PickerUtilize/spec.js +0 -35
- package/components/RangeSlider/spec.js +0 -190
- package/components/SheetList/components/Item/spec.js +0 -101
- package/components/SheetList/spec.js +0 -43
- package/components/TimeBoundary/spec.js +0 -83
- package/filter/components/FilterItem/spec.js +0 -14
- package/filter/components/FilterPageContent/components/ApplyButton/spec.js +0 -46
- package/filter/components/FilterPageContent/components/ResetButton/spec.js +0 -29
- package/filter/components/FilterPageContent/components/Selector/components/Selected/spec.js +0 -26
- package/filter/components/FilterPageContent/components/Selector/components/Toggle/spec.js +0 -34
- package/filter/components/FilterPageContent/components/Selector/components/ValueButton/spec.js +0 -32
- package/filter/components/FilterPageContent/components/Selector/spec.js +0 -33
- package/filter/components/PriceSlider/components/Label/spec.js +0 -26
- package/filter/components/PriceSlider/spec.js +0 -30
- package/locations/components/StoreFinder/StoreFinderGetDirectionsButton.connector.js +0 -16
- package/locations/components/StoreFinder/StoreFinderGetDirectionsButton.js +0 -52
- package/product/collections/index.js +0 -1
- package/product/components/EffectivityDates/constants.d.ts +0 -3
- package/product/components/EffectivityDates/constants.d.ts.map +0 -1
- package/product/components/EffectivityDates/helpers.d.ts +0 -6
- package/product/components/EffectivityDates/helpers.d.ts.map +0 -1
- package/product/components/FilterBar/components/Content/spec.js +0 -136
- package/product/components/Header/Shipping/spec.js +0 -36
- package/product/components/Header/Tiers/components/Tier/spec.js +0 -48
- package/product/components/Header/Tiers/spec.js +0 -64
- package/product/components/Media/helpers.d.ts +0 -2
- package/product/components/Media/helpers.d.ts.map +0 -1
- package/product/components/Options/components/Content/spec.js +0 -73
- package/product/components/Options/components/TextOption/components/OptionInfo/spec.js +0 -72
- package/product/components/ProductDiscountBadge/spec.js +0 -58
- package/product/components/ProductGrid/components/Item/components/ItemDetails/spec.js +0 -73
- package/product/components/ProductGrid/components/Item/components/ItemFavoritesButton/spec.js +0 -33
- package/product/components/ProductGrid/components/Item/components/ItemImage/spec.js +0 -16
- package/product/components/ProductGrid/components/Item/components/ItemName/spec.js +0 -21
- package/product/components/ProductGrid/components/Item/components/ItemPrice/spec.js +0 -37
- package/product/components/ProductGrid/spec.js +0 -52
- package/product/components/ProductImage/connector.js +0 -12
- package/product/components/ProductImage/spec.js +0 -87
- package/product/components/ProductSlider/spec.js +0 -37
- package/product/components/Rating/spec.js +0 -58
- package/product/helpers/index.d.ts +0 -13
- package/product/helpers/index.d.ts.map +0 -1
- package/product/helpers/redirects.d.ts +0 -2
- package/product/helpers/redirects.d.ts.map +0 -1
- package/product/selectors/helpers/filterProperties.d.ts +0 -8
- package/product/selectors/helpers/filterProperties.d.ts.map +0 -1
- package/product/selectors/helpers/index.d.ts +0 -3
- package/product/selectors/helpers/index.d.ts.map +0 -1
- package/product/selectors/helpers/wrapMemoizedSelector.d.ts +0 -2
- package/product/selectors/helpers/wrapMemoizedSelector.d.ts.map +0 -1
- package/product/selectors/product.d.ts +0 -112
- package/product/selectors/product.d.ts.map +0 -1
- package/reviews/components/Reviews/components/Header/components/WriteReviewLink/spec.js +0 -52
- package/reviews/components/Reviews/components/Header/spec.js +0 -78
- package/reviews/components/Reviews/components/List/spec.js +0 -108
- package/reviews/components/Reviews/components/RatingCount/spec.js +0 -38
- package/reviews/components/Reviews/spec.js +0 -101
- package/tsconfig.build.json +0 -26
- package/tsconfig.json +0 -19
|
@@ -51,5 +51,6 @@ export interface TypographyOptions
|
|
|
51
51
|
|
|
52
52
|
export default function createTypography(
|
|
53
53
|
palette: Palette,
|
|
54
|
-
typography: TypographyOptions | ((palette: Palette) => TypographyOptions)
|
|
54
|
+
typography: TypographyOptions | ((palette: Palette) => TypographyOptions),
|
|
55
|
+
cssVarPrefix?: string
|
|
55
56
|
): Typography;
|
|
@@ -1,19 +1,41 @@
|
|
|
1
1
|
import _merge from "lodash/merge";
|
|
2
|
-
|
|
2
|
+
// Imported from the defining modules rather than a barrel: this module runs at import time in
|
|
3
|
+
// every spec that touches the theme, and specs that replace a barrel with a partial mock would
|
|
4
|
+
// leave these undefined.
|
|
5
|
+
import { isDev } from '@shopgate/pwa-common/helpers/environment';
|
|
6
|
+
import { themeConfig } from '@shopgate/pwa-common/helpers/config';
|
|
7
|
+
const {
|
|
8
|
+
fontWeight: buttonFontWeight = 600,
|
|
9
|
+
textTransform: buttonTextTransform
|
|
10
|
+
} = themeConfig?.variables?.buttonBase ?? {};
|
|
3
11
|
const caseAllCaps = {
|
|
4
12
|
textTransform: 'uppercase'
|
|
5
13
|
};
|
|
14
|
+
const caseButton = {
|
|
15
|
+
textTransform: buttonTextTransform === 'uppercase' ? 'uppercase' : 'none'
|
|
16
|
+
};
|
|
6
17
|
const defaultFontFamily = '"Roboto", "Helvetica", "Arial", sans-serif';
|
|
7
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Builds the prefix of the custom properties that cssVarsParser derives from the `typography` keys.
|
|
21
|
+
* Mirrors how the parser composes a name, so a theme configured with a different `cssVarPrefix`
|
|
22
|
+
* references the properties it actually emits.
|
|
23
|
+
* @param {string} cssVarPrefix The theme's css variable prefix.
|
|
24
|
+
* @returns {string} The prefix, e.g. `--sg-typography`.
|
|
25
|
+
*/
|
|
26
|
+
const typographyVarPrefix = cssVarPrefix => `--${cssVarPrefix ? `${cssVarPrefix}-` : ''}typography`;
|
|
27
|
+
|
|
8
28
|
/**
|
|
9
29
|
* Creates the typography object for the theme.
|
|
10
30
|
* @param {Object} palette The theme palette.
|
|
11
31
|
* @param {Object|Function} typography The typography options or a function that returns them.
|
|
32
|
+
* @param {string} [cssVarPrefix] The theme's css variable prefix, matching the one cssVarsParser
|
|
33
|
+
* generates the properties with. Defaults to the `sg` default of createTheme.
|
|
12
34
|
* @returns {Object} The typography object.
|
|
13
35
|
* @see @link{https://material.io/design/typography/the-type-system.html}
|
|
14
36
|
* @see @link{https://material.io/design/typography/understanding-typography.html}
|
|
15
37
|
*/
|
|
16
|
-
export default function createTypography(palette, typography) {
|
|
38
|
+
export default function createTypography(palette, typography, cssVarPrefix = 'sg') {
|
|
17
39
|
const {
|
|
18
40
|
fontFamily = defaultFontFamily,
|
|
19
41
|
// The default font size of the Material Specification.
|
|
@@ -32,10 +54,28 @@ export default function createTypography(palette, typography) {
|
|
|
32
54
|
} = typeof typography === 'function' ? typography(palette) : typography;
|
|
33
55
|
if (isDev) {
|
|
34
56
|
if (typeof fontSize !== 'number') {
|
|
57
|
+
// eslint-disable-next-line no-console
|
|
35
58
|
console.error('Shopgate Theme: `fontSize` is required to be a number.');
|
|
36
59
|
}
|
|
37
60
|
}
|
|
38
61
|
const coef = fontSize / 14;
|
|
62
|
+
const fontWeights = {
|
|
63
|
+
fontWeightLight,
|
|
64
|
+
fontWeightRegular,
|
|
65
|
+
fontWeightMedium,
|
|
66
|
+
fontWeightBold
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Builds a reference to one of the shared font weight custom properties. The property itself is
|
|
71
|
+
* emitted by cssVarsParser from `typography.fontWeight*`, so overriding it on `:root` (admin css,
|
|
72
|
+
* live preview, an extension) cascades into every variant that uses that token. The resolved
|
|
73
|
+
* weight stays as the fallback, so the variant still renders when the property is absent.
|
|
74
|
+
* @param {string} token One of `fontWeightLight`, `fontWeightRegular`, `fontWeightMedium`,
|
|
75
|
+
* `fontWeightBold`.
|
|
76
|
+
* @returns {string} The css var reference.
|
|
77
|
+
*/
|
|
78
|
+
const fontWeightVar = token => `var(${typographyVarPrefix(cssVarPrefix)}-${token}, ${fontWeights[token]})`;
|
|
39
79
|
|
|
40
80
|
/**
|
|
41
81
|
* Calculates a rem value for a passed pixel value.
|
|
@@ -46,34 +86,35 @@ export default function createTypography(palette, typography) {
|
|
|
46
86
|
|
|
47
87
|
/**
|
|
48
88
|
* Creates a typography variant object.
|
|
49
|
-
* @param {
|
|
89
|
+
* @param {string} fontWeightToken The name of the shared font weight token to use, e.g.
|
|
90
|
+
* `fontWeightBold`. The variant references it as a custom property instead of inlining its value.
|
|
50
91
|
* @param {number} size Font size in pixels.
|
|
51
92
|
* @param {number} lineHeight Line height as a unitless number.
|
|
52
93
|
* @param {Object} casing Casing styles to apply, e.g. textTransform.
|
|
53
94
|
* @returns {Object} The typography variant object.
|
|
54
95
|
*/
|
|
55
|
-
const buildVariant = (
|
|
96
|
+
const buildVariant = (fontWeightToken, size, lineHeight, casing) => ({
|
|
56
97
|
fontFamily,
|
|
57
|
-
fontWeight,
|
|
98
|
+
fontWeight: fontWeightVar(fontWeightToken),
|
|
58
99
|
fontSize: pxToRem(size),
|
|
59
100
|
lineHeight,
|
|
60
101
|
...casing,
|
|
61
102
|
...allVariants
|
|
62
103
|
});
|
|
63
104
|
const variants = {
|
|
64
|
-
h1: buildVariant(fontWeightBold, 34, 1.15),
|
|
65
|
-
h2: buildVariant(fontWeightBold, 22, 1.3),
|
|
66
|
-
h3: buildVariant(fontWeightMedium, 20, 1.35),
|
|
67
|
-
h4: buildVariant(fontWeightMedium, 18, 1.4),
|
|
68
|
-
h5: buildVariant(fontWeightMedium, 16, 1.5),
|
|
69
|
-
h6: buildVariant(fontWeightMedium, 14, 1.5),
|
|
70
|
-
subtitle1: buildVariant(fontWeightRegular, 16, 1.75),
|
|
71
|
-
subtitle2: buildVariant(fontWeightMedium, 14, 1.57),
|
|
72
|
-
body1: buildVariant(fontWeightRegular, 16, 1.5),
|
|
73
|
-
body2: buildVariant(fontWeightRegular, 14, 1.43),
|
|
74
|
-
button: buildVariant(fontWeightMedium,
|
|
75
|
-
caption: buildVariant(fontWeightRegular, 12, 1.66),
|
|
76
|
-
overline: buildVariant(fontWeightRegular, 12, 2.66, caseAllCaps)
|
|
105
|
+
h1: buildVariant('fontWeightBold', 34, 1.15),
|
|
106
|
+
h2: buildVariant('fontWeightBold', 22, 1.3),
|
|
107
|
+
h3: buildVariant('fontWeightMedium', 20, 1.35),
|
|
108
|
+
h4: buildVariant('fontWeightMedium', 18, 1.4),
|
|
109
|
+
h5: buildVariant('fontWeightMedium', 16, 1.5),
|
|
110
|
+
h6: buildVariant('fontWeightMedium', 14, 1.5),
|
|
111
|
+
subtitle1: buildVariant('fontWeightRegular', 16, 1.75),
|
|
112
|
+
subtitle2: buildVariant('fontWeightMedium', 14, 1.57),
|
|
113
|
+
body1: buildVariant('fontWeightRegular', 16, 1.5),
|
|
114
|
+
body2: buildVariant('fontWeightRegular', 14, 1.43),
|
|
115
|
+
button: buildVariant(buttonFontWeight > fontWeightMedium ? 'fontWeightBold' : 'fontWeightMedium', 16, 1.75, caseButton),
|
|
116
|
+
caption: buildVariant('fontWeightRegular', 12, 1.66),
|
|
117
|
+
overline: buildVariant('fontWeightRegular', 12, 2.66, caseAllCaps)
|
|
77
118
|
};
|
|
78
119
|
return _merge({
|
|
79
120
|
pxToRem,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cssVarsParser.d.ts","sourceRoot":"","sources":["../../../../../styles/theme/createTheme/helpers/cssVarsParser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"cssVarsParser.d.ts","sourceRoot":"","sources":["../../../../../styles/theme/createTheme/helpers/cssVarsParser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA6IH,KAAK,oBAAoB,GAAG;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uBAAuB,CAAC,EAAE,CAAC,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,OAAO,CAAC;CAC9F,CAAC;AAEF,MAAM,MAAM,wBAAwB,CAAC,CAAC,IAAI;IACxC;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IACrC;;;OAGG;IACH,IAAI,EAAE,CAAC,CAAC;IACR;;;OAGG;IACH,gBAAgB,EAAE,CAAC,CAAC;IACpB;;;OAGG;IACH,QAAQ,EAAE,CAAC,CAAC;CACb,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,CAAC,SAAS,MAAM,EACpD,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,oBAAoB,GAC7B,wBAAwB,CAAC,CAAC,CAAC,CA+D7B"}
|
|
@@ -85,11 +85,18 @@ const walkObjectDeep = (obj, callback, shouldSkipPaths) => {
|
|
|
85
85
|
*/
|
|
86
86
|
const getCssValue = (keys, value) => {
|
|
87
87
|
if (typeof value === 'number') {
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
const lastKey = keys[keys.length - 1];
|
|
89
|
+
if (['lineHeight', 'fontWeight', 'opacity', 'zIndex', 'fontWeightLight', 'fontWeightRegular', 'fontWeightMedium', 'fontWeightBold'].some(prop => lastKey === prop)) {
|
|
90
|
+
// CSS properties that are unitless
|
|
91
|
+
return value;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// `typography.fontSize` is MUI's base font-size coefficient and stays unitless, but variant
|
|
95
|
+
// font sizes (e.g. `typography.body2.fontSize`) are lengths and need a `px` unit - otherwise a
|
|
96
|
+
// numeric override would produce an invalid `font-size: 12` custom property.
|
|
97
|
+
if (lastKey === 'fontSize' && keys[keys.length - 2] === 'typography') {
|
|
90
98
|
return value;
|
|
91
99
|
}
|
|
92
|
-
const lastKey = keys[keys.length - 1];
|
|
93
100
|
if (lastKey.toLowerCase().includes('opacity')) {
|
|
94
101
|
// opacity values are unitless
|
|
95
102
|
return value;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ThemeOptions, type ThemeInternal } from './types';
|
|
2
|
-
export type { Theme, BaseTheme, ThemeInternal, ThemeOptions, Breakpoint, ColorSchemeName, ColorSchemeSelectorType, PaletteColorsWithMain, } from './types';
|
|
2
|
+
export type { Theme, BaseTheme, ThemeInternal, ThemeOptions, Breakpoint, ColorSchemeName, ColorSchemeMode, ColorSchemeSelectorType, PaletteColorsWithMain, } from './types';
|
|
3
|
+
export { COLOR_SCHEME_NAMES, COLOR_SCHEME_SYSTEM } from './types';
|
|
3
4
|
/**
|
|
4
5
|
* Creates a theme object for the ThemeProvider.
|
|
5
6
|
* @param options The theme options.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/index.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,KAAK,YAAY,EAGjB,KAAK,aAAa,EACnB,MAAM,SAAS,CAAC;AAEjB,YAAY,EACV,KAAK,EACL,SAAS,EACT,aAAa,EACb,YAAY,EACZ,UAAU,EACV,eAAe,EACf,eAAe,EACf,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAElE;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,UAAS,YAAiB,KAAG,aAkExD,CAAC"}
|
|
@@ -4,10 +4,13 @@ import createBreakpoints from "./createBreakpoints";
|
|
|
4
4
|
import createSpacing from "./createSpacing";
|
|
5
5
|
import transitions from "./transitions";
|
|
6
6
|
import zIndex from "./zIndex";
|
|
7
|
+
import layout from "./layout";
|
|
7
8
|
import createThemeFromColorScheme from "./createThemeFromColorScheme";
|
|
8
9
|
import createCssVarsForColorSchemeThemes from "./createCssVarsForColorSchemeThemes";
|
|
9
10
|
import applyStyles from "./applyStyles";
|
|
10
11
|
import { createGetColorSchemeSelector, createSetActiveColorScheme } from "./helpers";
|
|
12
|
+
export { COLOR_SCHEME_NAMES, COLOR_SCHEME_SYSTEM } from "./types";
|
|
13
|
+
|
|
11
14
|
/**
|
|
12
15
|
* Creates a theme object for the ThemeProvider.
|
|
13
16
|
* @param options The theme options.
|
|
@@ -35,7 +38,7 @@ export const createTheme = (options = {}) => {
|
|
|
35
38
|
palette: {
|
|
36
39
|
mode: type
|
|
37
40
|
}
|
|
38
|
-
}, defaultScheme, scheme));
|
|
41
|
+
}, defaultScheme, scheme), cssVarPrefix);
|
|
39
42
|
return acc;
|
|
40
43
|
}, {});
|
|
41
44
|
const getColorSchemeSelector = createGetColorSchemeSelector(colorSchemeSelector);
|
|
@@ -58,7 +61,7 @@ export const createTheme = (options = {}) => {
|
|
|
58
61
|
spacing,
|
|
59
62
|
transitions,
|
|
60
63
|
zIndex,
|
|
61
|
-
|
|
64
|
+
layout,
|
|
62
65
|
colorSchemes,
|
|
63
66
|
getColorSchemeSelector,
|
|
64
67
|
setActiveColorScheme,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime layout dimensions exposed as global CSS variables.
|
|
3
|
+
*
|
|
4
|
+
* These are NOT design tokens and are not generated by the theme's CSS-variable pipeline.
|
|
5
|
+
* The `--safe-area-inset-*` variables are set at runtime by `updatePageInsets` based on the
|
|
6
|
+
* device page insets.
|
|
7
|
+
*
|
|
8
|
+
* This node only maps theme properties to those existing variables (`var(--...)`), so consumers
|
|
9
|
+
* can read `theme.layout.*` instead of hardcoding the variable names.
|
|
10
|
+
*/
|
|
11
|
+
export interface SafeArea {
|
|
12
|
+
top: string;
|
|
13
|
+
bottom: string;
|
|
14
|
+
left: string;
|
|
15
|
+
right: string;
|
|
16
|
+
}
|
|
17
|
+
export interface Layout {
|
|
18
|
+
/** Device safe-area insets (`--safe-area-inset-*`). */
|
|
19
|
+
safeArea: SafeArea;
|
|
20
|
+
}
|
|
21
|
+
declare const layout: Layout;
|
|
22
|
+
export default layout;
|
|
23
|
+
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/layout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,MAAM;IACrB,uDAAuD;IACvD,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,QAAA,MAAM,MAAM,EAAE,MAOb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime layout dimensions exposed as global CSS variables.
|
|
3
|
+
*
|
|
4
|
+
* These are NOT design tokens and are not generated by the theme's CSS-variable pipeline.
|
|
5
|
+
* The `--safe-area-inset-*` variables are set at runtime by `updatePageInsets` based on the
|
|
6
|
+
* device page insets.
|
|
7
|
+
*
|
|
8
|
+
* This node only maps theme properties to those existing variables (`var(--...)`), so consumers
|
|
9
|
+
* can read `theme.layout.*` instead of hardcoding the variable names.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const layout = {
|
|
13
|
+
safeArea: {
|
|
14
|
+
top: 'var(--safe-area-inset-top)',
|
|
15
|
+
bottom: 'var(--safe-area-inset-bottom)',
|
|
16
|
+
left: 'var(--safe-area-inset-left)',
|
|
17
|
+
right: 'var(--safe-area-inset-right)'
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
export default layout;
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The elevations the admin offers. Offset, blur and spread are not configurable — a shop picks
|
|
3
|
+
* one of these presets so the surfaces stay visually consistent, and only the color is free.
|
|
4
|
+
*/
|
|
5
|
+
export type ShadowSize = 'none' | 'low' | 'medium' | 'strong';
|
|
6
|
+
export declare const SHADOW_COLOR_VAR = "--sg-palette-shadow";
|
|
7
|
+
declare const shadows: readonly ["none", ...string[]];
|
|
2
8
|
export type Shadows = typeof shadows;
|
|
9
|
+
/**
|
|
10
|
+
* The finished shadow for each size the admin offers, for a single `theme.shadowSizes[size]` lookup.
|
|
11
|
+
*/
|
|
12
|
+
export declare const shadowSizes: Record<ShadowSize, string>;
|
|
3
13
|
export default shadows;
|
|
4
14
|
//# sourceMappingURL=shadows.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shadows.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/shadows.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shadows.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/shadows.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;AA+D9D,eAAO,MAAM,gBAAgB,wBAAwB,CAAC;AAEtD,QAAA,MAAM,OAAO,gCAMH,CAAC;AAEX,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAA;AAEpC;;GAEG;AACH,eAAO,MAAM,WAAW,EAEnB,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AAEhC,eAAe,OAAO,CAAC"}
|
|
@@ -1,10 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
// Share of the shadow color each of the three layers is drawn with, in percent.
|
|
2
|
+
const shadowKeyUmbraPercent = 20;
|
|
3
|
+
const shadowKeyPenumbraPercent = 14;
|
|
4
|
+
const shadowAmbientShadowPercent = 12;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The elevations the admin offers. Offset, blur and spread are not configurable — a shop picks
|
|
8
|
+
* one of these presets so the surfaces stay visually consistent, and only the color is free.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Elevation from the scale below used for each shadow size the admin offers. Keeping the mapping
|
|
13
|
+
* next to the scale means a size never introduces geometry of its own.
|
|
14
|
+
*/
|
|
15
|
+
const SHADOW_SIZE_ELEVATIONS = {
|
|
16
|
+
none: 0,
|
|
17
|
+
low: 2,
|
|
18
|
+
medium: 4,
|
|
19
|
+
strong: 8
|
|
20
|
+
};
|
|
7
21
|
|
|
22
|
+
// Offset-x, offset-y, blur and spread of the three layers that make up one elevation, starting at
|
|
23
|
+
// elevation 1 (elevation 0 draws no shadow at all).
|
|
8
24
|
// Values from https://github.com/material-components/material-components-web/blob/be8747f94574669cb5e7add1a7c54fa41a89cec7/packages/mdc-elevation/_variables.scss
|
|
9
|
-
const
|
|
25
|
+
const elevationGeometries = [[0, 2, 1, -1, 0, 1, 1, 0, 0, 1, 3, 0], [0, 3, 1, -2, 0, 2, 2, 0, 0, 1, 5, 0], [0, 3, 3, -2, 0, 3, 4, 0, 0, 1, 8, 0], [0, 2, 4, -1, 0, 4, 5, 0, 0, 1, 10, 0], [0, 3, 5, -1, 0, 5, 8, 0, 0, 1, 14, 0], [0, 3, 5, -1, 0, 6, 10, 0, 0, 1, 18, 0], [0, 4, 5, -2, 0, 7, 10, 1, 0, 2, 16, 1], [0, 5, 5, -3, 0, 8, 10, 1, 0, 3, 14, 2], [0, 5, 6, -3, 0, 9, 12, 1, 0, 3, 16, 2], [0, 6, 6, -3, 0, 10, 14, 1, 0, 4, 18, 3], [0, 6, 7, -4, 0, 11, 15, 1, 0, 4, 20, 3], [0, 7, 8, -4, 0, 12, 17, 2, 0, 5, 22, 4], [0, 7, 8, -4, 0, 13, 19, 2, 0, 5, 24, 4], [0, 7, 9, -4, 0, 14, 21, 2, 0, 5, 26, 4], [0, 8, 9, -5, 0, 15, 22, 2, 0, 6, 28, 5], [0, 8, 10, -5, 0, 16, 24, 2, 0, 6, 30, 5], [0, 8, 11, -5, 0, 17, 26, 2, 0, 6, 32, 5], [0, 9, 11, -5, 0, 18, 28, 2, 0, 7, 34, 6], [0, 9, 12, -6, 0, 19, 29, 2, 0, 7, 36, 6], [0, 10, 13, -6, 0, 20, 31, 3, 0, 8, 38, 7], [0, 10, 13, -6, 0, 21, 33, 3, 0, 8, 40, 7], [0, 10, 14, -6, 0, 22, 35, 3, 0, 8, 42, 7], [0, 11, 14, -7, 0, 23, 36, 3, 0, 9, 44, 8], [0, 11, 15, -7, 0, 24, 38, 3, 0, 9, 46, 8]];
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Builds one elevation from its geometry.
|
|
29
|
+
* @param px The twelve lengths of the elevation's three layers.
|
|
30
|
+
* @param renderColor Renders the color of a layer from the share of the shadow color it is drawn
|
|
31
|
+
* with, in percent.
|
|
32
|
+
* @returns A box-shadow value.
|
|
33
|
+
*/
|
|
34
|
+
function createShadow(px, renderColor) {
|
|
35
|
+
const layer = (offset, percent) => `${px[offset]}px ${px[offset + 1]}px ${px[offset + 2]}px ${px[offset + 3]}px ` + `${renderColor(percent)}`;
|
|
36
|
+
return [layer(0, shadowKeyUmbraPercent), layer(4, shadowKeyPenumbraPercent), layer(8, shadowAmbientShadowPercent)].join(',');
|
|
37
|
+
}
|
|
38
|
+
export const SHADOW_COLOR_VAR = '--sg-palette-shadow';
|
|
39
|
+
const shadows = ['none'].concat(elevationGeometries.map(geometry => createShadow(geometry, percent => `rgb(from var(${SHADOW_COLOR_VAR}) r g b / ${percent / 100})`)));
|
|
40
|
+
/**
|
|
41
|
+
* The finished shadow for each size the admin offers, for a single `theme.shadowSizes[size]` lookup.
|
|
42
|
+
*/
|
|
43
|
+
export const shadowSizes = Object.fromEntries(Object.entries(SHADOW_SIZE_ELEVATIONS).map(([size, elevation]) => [size, shadows[elevation]]));
|
|
10
44
|
export default shadows;
|
|
@@ -27,7 +27,9 @@ export const duration = {
|
|
|
27
27
|
// recommended when something is entering screen
|
|
28
28
|
enteringScreen: 225,
|
|
29
29
|
// recommended when something is leaving screen
|
|
30
|
-
leavingScreen: 195
|
|
30
|
+
leavingScreen: 195,
|
|
31
|
+
// how long a toast stays visible before auto-dismissing
|
|
32
|
+
toast: 5000
|
|
31
33
|
};
|
|
32
34
|
|
|
33
35
|
/**
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
import type { PaletteOptions, Palette } from './createPalette';
|
|
2
2
|
import type { Typography, TypographyOptions } from './createTypography';
|
|
3
|
-
import type { ComponentsOptions, ComponentVars } from './createComponents';
|
|
3
|
+
import type { ComponentsOptions, ComponentVars, Components } from './createComponents';
|
|
4
4
|
import type { Breakpoints } from './createBreakpoints';
|
|
5
5
|
import type { Spacing } from './createSpacing';
|
|
6
6
|
import type { Transitions } from './transitions';
|
|
7
7
|
import type { ZIndex } from './zIndex';
|
|
8
|
+
import type { Layout } from './layout';
|
|
8
9
|
import type { ApplyStyles } from './applyStyles';
|
|
9
10
|
import type { GetColorSchemeSelector, ActiveColorSchemeSwitcher } from './helpers';
|
|
10
11
|
import type { CreateCssVarsForColorSchemeThemesReturnValue } from './createCssVarsForColorSchemeThemes';
|
|
11
12
|
import type { Shape, ShapeOptions } from './createShape';
|
|
12
|
-
import type { Shadows } from './shadows';
|
|
13
|
+
import type { Shadows, ShadowSize } from './shadows';
|
|
13
14
|
export type { Breakpoint } from './createBreakpoints';
|
|
14
15
|
export type { PaletteColorsWithMain } from './createPalette';
|
|
15
|
-
declare const
|
|
16
|
-
export type ColorSchemeName = (typeof
|
|
16
|
+
export declare const COLOR_SCHEME_NAMES: readonly ["light", "dark"];
|
|
17
|
+
export type ColorSchemeName = (typeof COLOR_SCHEME_NAMES)[number];
|
|
18
|
+
export declare const COLOR_SCHEME_SYSTEM = "system";
|
|
19
|
+
/**
|
|
20
|
+
* A selectable color scheme: one the theme provides, or `system` to follow the operating system.
|
|
21
|
+
*/
|
|
22
|
+
export type ColorSchemeMode = ColorSchemeName | typeof COLOR_SCHEME_SYSTEM;
|
|
17
23
|
declare const selectorTypes: readonly ["data", "class"];
|
|
18
24
|
export type ColorSchemeSelectorType = (typeof selectorTypes)[number];
|
|
19
25
|
type DeepPartial<T> = T extends object ? {
|
|
@@ -27,7 +33,8 @@ type DeepPartial<T> = T extends object ? {
|
|
|
27
33
|
export type ColorSchemeOptions = Pick<ThemeOptions, 'palette' | 'typography' | 'components' | 'shape'>;
|
|
28
34
|
export interface ThemeOptions {
|
|
29
35
|
/**
|
|
30
|
-
* The
|
|
36
|
+
* The color scheme to fall back to when the configured mode resolves to a scheme this theme does
|
|
37
|
+
* not style. The scheme the app starts in comes from the app settings.
|
|
31
38
|
* @default 'light'
|
|
32
39
|
*/
|
|
33
40
|
defaultColorScheme?: ColorSchemeName;
|
|
@@ -93,6 +100,10 @@ export interface BaseTheme {
|
|
|
93
100
|
* Pre-defined shadow styles for different elevation levels, following Material Design guidelines.
|
|
94
101
|
*/
|
|
95
102
|
shadows: Shadows;
|
|
103
|
+
/**
|
|
104
|
+
* The finished box-shadow size (`none` | `low` | `medium` | `strong`)
|
|
105
|
+
*/
|
|
106
|
+
shadowSizes: Record<ShadowSize, string>;
|
|
96
107
|
/**
|
|
97
108
|
* Adds an alpha value to a color, returning a new color string with the applied alpha.
|
|
98
109
|
* @param color The color to modify.
|
|
@@ -124,7 +135,8 @@ export interface BaseTheme {
|
|
|
124
135
|
}
|
|
125
136
|
export interface Theme extends BaseTheme {
|
|
126
137
|
/**
|
|
127
|
-
* The
|
|
138
|
+
* The color scheme to fall back to when the configured mode resolves to a scheme this theme does
|
|
139
|
+
* not style. The scheme the app starts in comes from the app settings.
|
|
128
140
|
*/
|
|
129
141
|
defaultColorScheme?: ColorSchemeName;
|
|
130
142
|
/**
|
|
@@ -143,6 +155,12 @@ export interface Theme extends BaseTheme {
|
|
|
143
155
|
* Reference to z-index values for multiple components.
|
|
144
156
|
*/
|
|
145
157
|
zIndex: ZIndex;
|
|
158
|
+
/**
|
|
159
|
+
* Mappings to runtime layout CSS variables (safe-area insets).
|
|
160
|
+
* The values are `var(--...)` references to variables updated at runtime elsewhere in the app;
|
|
161
|
+
* this node does not generate any new CSS variables.
|
|
162
|
+
*/
|
|
163
|
+
layout: Layout;
|
|
146
164
|
/**
|
|
147
165
|
* An object that contains the CSS variable references for the theme properties.
|
|
148
166
|
* It has the same structure as the theme, but the values are CSS variable references
|
|
@@ -171,12 +189,26 @@ export interface Theme extends BaseTheme {
|
|
|
171
189
|
*/
|
|
172
190
|
applyStyles: ApplyStyles<ColorSchemeName>;
|
|
173
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* A single fully-resolved color-scheme theme. Identical to {@link BaseTheme} except that its
|
|
194
|
+
* `components` keep the nested `vars` level (the raw per-scheme token defaults produced by
|
|
195
|
+
* `createComponents`), whereas the flattened `BaseTheme['components']` shape is only produced for
|
|
196
|
+
* the final merged theme.
|
|
197
|
+
*/
|
|
198
|
+
export type ColorSchemeTheme = Omit<BaseTheme, 'components'> & {
|
|
199
|
+
components: Components;
|
|
200
|
+
};
|
|
174
201
|
/**
|
|
175
202
|
* A record of themes for each color scheme. Each key is a color scheme name (e.g., 'light', 'dark'),
|
|
176
|
-
* and the value is a
|
|
203
|
+
* and the value is a fully-resolved color-scheme theme ({@link ColorSchemeTheme}).
|
|
177
204
|
*/
|
|
178
|
-
export type ColorSchemeThemes = Record<ColorSchemeName,
|
|
179
|
-
export type ThemeInternal = Theme
|
|
205
|
+
export type ColorSchemeThemes = Record<ColorSchemeName, ColorSchemeTheme>;
|
|
206
|
+
export type ThemeInternal = Omit<Theme, 'colorSchemes'> & {
|
|
207
|
+
/**
|
|
208
|
+
* Internal runtime map of fully resolved color-scheme themes.
|
|
209
|
+
*/
|
|
210
|
+
colorSchemes: ColorSchemeThemes;
|
|
211
|
+
} & Pick<CreateCssVarsForColorSchemeThemesReturnValue, 'generateStyleSheets'> & {
|
|
180
212
|
/**
|
|
181
213
|
* Function that generates a CSS selector string for a given color scheme.
|
|
182
214
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
const
|
|
1
|
+
export const COLOR_SCHEME_NAMES = ['light', 'dark'];
|
|
2
|
+
export const COLOR_SCHEME_SYSTEM = 'system';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A selectable color scheme: one the theme provides, or `system` to follow the operating system.
|
|
6
|
+
*/
|
|
7
|
+
|
|
2
8
|
const selectorTypes = ['data', 'class'];
|
|
3
9
|
|
|
4
10
|
/**
|
|
@@ -8,7 +14,13 @@ const selectorTypes = ['data', 'class'];
|
|
|
8
14
|
*/
|
|
9
15
|
|
|
10
16
|
/**
|
|
11
|
-
* A
|
|
12
|
-
*
|
|
17
|
+
* A single fully-resolved color-scheme theme. Identical to {@link BaseTheme} except that its
|
|
18
|
+
* `components` keep the nested `vars` level (the raw per-scheme token defaults produced by
|
|
19
|
+
* `createComponents`), whereas the flattened `BaseTheme['components']` shape is only produced for
|
|
20
|
+
* the final merged theme.
|
|
13
21
|
*/
|
|
14
|
-
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* A record of themes for each color scheme. Each key is a color scheme name (e.g., 'light', 'dark'),
|
|
25
|
+
* and the value is a fully-resolved color-scheme theme ({@link ColorSchemeTheme}).
|
|
26
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../styles/theme/hocs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { withTheme } from "./withTheme";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import type { Theme } from '../createTheme';
|
|
3
|
+
/**
|
|
4
|
+
* Props injected by the `withTheme` HOC.
|
|
5
|
+
*/
|
|
6
|
+
export interface WithThemeProps {
|
|
7
|
+
/** The active styling theme (same object returned by `useTheme()`). */
|
|
8
|
+
theme: Theme;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Injects the styling theme as a `theme` prop into the wrapped component.
|
|
12
|
+
*
|
|
13
|
+
* Intended for legacy class components that cannot use the `useTheme` hook.
|
|
14
|
+
* For function components, prefer the `useTheme` hook instead.
|
|
15
|
+
*
|
|
16
|
+
* @param WrappedComponent The component to inject the theme into.
|
|
17
|
+
* @returns The wrapped component with `theme` supplied automatically.
|
|
18
|
+
*/
|
|
19
|
+
export declare function withTheme<P extends WithThemeProps>(WrappedComponent: ComponentType<P>): ComponentType<Omit<P, keyof WithThemeProps>>;
|
|
20
|
+
export default withTheme;
|
|
21
|
+
//# sourceMappingURL=withTheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withTheme.d.ts","sourceRoot":"","sources":["../../../../styles/theme/hocs/withTheme.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAG5C;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,uEAAuE;IACvE,KAAK,EAAE,KAAK,CAAC;CACd;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,cAAc,EAChD,gBAAgB,EAAE,aAAa,CAAC,CAAC,CAAC,GACjC,aAAa,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,cAAc,CAAC,CAAC,CAe9C;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import useTheme from "../hooks/useTheme";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Props injected by the `withTheme` HOC.
|
|
5
|
+
*/
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
/**
|
|
8
|
+
* Injects the styling theme as a `theme` prop into the wrapped component.
|
|
9
|
+
*
|
|
10
|
+
* Intended for legacy class components that cannot use the `useTheme` hook.
|
|
11
|
+
* For function components, prefer the `useTheme` hook instead.
|
|
12
|
+
*
|
|
13
|
+
* @param WrappedComponent The component to inject the theme into.
|
|
14
|
+
* @returns The wrapped component with `theme` supplied automatically.
|
|
15
|
+
*/
|
|
16
|
+
export function withTheme(WrappedComponent) {
|
|
17
|
+
/**
|
|
18
|
+
* The actual HOC.
|
|
19
|
+
* @param props The component props.
|
|
20
|
+
* @returns The wrapped component with the theme injected.
|
|
21
|
+
*/
|
|
22
|
+
const WithTheme = props => {
|
|
23
|
+
const theme = useTheme();
|
|
24
|
+
return /*#__PURE__*/_jsx(WrappedComponent, {
|
|
25
|
+
...props,
|
|
26
|
+
theme: theme
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
const displayName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
|
|
30
|
+
WithTheme.displayName = `WithTheme(${displayName})`;
|
|
31
|
+
return WithTheme;
|
|
32
|
+
}
|
|
33
|
+
export default withTheme;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @returns
|
|
2
|
+
* Provides access to the color scheme context.
|
|
3
|
+
* @returns The color scheme context value, containing the current `mode`, a `setMode` function to
|
|
4
|
+
* update it, and the `modes` that can be set.
|
|
4
5
|
*/
|
|
5
|
-
declare const useColorScheme: () => import("
|
|
6
|
+
declare const useColorScheme: () => import("..").ColorSchemeContextValue;
|
|
6
7
|
export default useColorScheme;
|
|
7
8
|
//# sourceMappingURL=useColorScheme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useColorScheme.d.ts","sourceRoot":"","sources":["../../../../styles/theme/hooks/useColorScheme.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"useColorScheme.d.ts","sourceRoot":"","sources":["../../../../styles/theme/hooks/useColorScheme.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,QAAA,MAAM,cAAc,4CAAuC,CAAC;AAE5D,eAAe,cAAc,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
|
-
import { ColorSchemeContext } from "../providers/
|
|
2
|
+
import { ColorSchemeContext } from "../providers/ColorSchemeContext";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
* @returns
|
|
5
|
+
* Provides access to the color scheme context.
|
|
6
|
+
* @returns The color scheme context value, containing the current `mode`, a `setMode` function to
|
|
7
|
+
* update it, and the `modes` that can be set.
|
|
7
8
|
*/
|
|
8
9
|
const useColorScheme = () => useContext(ColorSchemeContext);
|
|
9
10
|
export default useColorScheme;
|