@shopgate/engage 7.32.0-beta.7 → 7.32.0-beta.9
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/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 +8 -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.map +1 -1
- package/admin-preview/components/FrontendSettingsPreviewBridge/FrontendSettingsPreviewBridge.js +41 -7
- package/admin-preview/components/FrontendSettingsPreviewBridge/types.d.ts +7 -0
- package/admin-preview/components/FrontendSettingsPreviewBridge/types.d.ts.map +1 -1
- 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/cart/components/CartItem/CartItemProductLayout.js +1 -0
- package/cart/components/CartItem/CartItemProductLayoutWideRemoveItem.js +7 -14
- package/cart/components/CartItem/CartItemQuantityPicker.js +1 -0
- package/cart/components/CartItems/CartItemCardReservationLabelChangeStore.js +6 -24
- 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/testUtils/mockFactories.js +4 -11
- package/category/components/CategoryImage/index.js +13 -2
- 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/spec.js +6 -29
- package/components/Card/Card.js +1 -1
- package/components/ChipLayout/index.js +2 -4
- package/components/NavigationHandler/connector.js +1 -1
- package/components/NavigationHandler/index.d.ts +2 -2
- package/components/NavigationHandler/spec.js +10 -1
- package/components/Paper/Paper.d.ts +1 -2
- package/components/Paper/Paper.d.ts.map +1 -1
- package/components/Paper/spec.js +5 -22
- 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/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/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/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/index.d.ts.map +1 -1
- package/core/initialization/index.js +24 -5
- 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/favorites/components/FavoriteButtonWide/FavoriteButtonWide.js +7 -17
- 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 +4 -5
- package/filter/components/FilterPageContent/components/ApplyButton/index.js +8 -10
- package/filter/components/FilterPageContent/components/ResetButton/index.js +8 -6
- package/locations/components/ChangeLocationButton/ChangeLocationButton.js +10 -14
- package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotDialog.js +4 -8
- package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcher.js +1 -1
- package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcherBar.js +8 -13
- package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcherDefault.js +10 -10
- package/locations/components/GlobalLocationSwitcher/GlobalLocationSwitcherBar.js +8 -14
- 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/StoreListSearch.js +1 -0
- package/locations/components/StoreList/StoreSelectLocationButton.js +5 -11
- package/login/components/ForgotPassword/ForgotPassword.js +11 -23
- package/orders/components/OrderDetails/OrderDetailsAuthenticate.js +5 -7
- package/package.json +7 -7
- package/page/components/NotFound.d.ts.map +1 -1
- package/page/components/NotFound.js +7 -6
- package/page/components/ResponsiveWidgetImage/ResponsiveWidgetImage.d.ts +1 -1
- package/page/components/ResponsiveWidgetImage/ResponsiveWidgetImage.js +2 -2
- package/page/components/WidgetVideo/WidgetVideo.d.ts +1 -1
- package/page/components/WidgetVideo/WidgetVideo.d.ts.map +1 -1
- package/page/helpers/index.d.ts +5 -2
- package/page/helpers/index.d.ts.map +1 -1
- package/page/helpers/index.js +8 -5
- 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/Video/hooks.d.ts +2 -2
- package/product/components/ProductCard/index.js +7 -1
- package/product/components/ProductGrid/components/Item/components/ItemDetails/index.js +6 -1
- package/product/components/ProductGrid/components/Item/components/ItemImage/index.js +1 -11
- package/product/components/ProductGrid/components/Item/index.js +3 -2
- package/product/components/ProductGrid/components/Layout/index.js +2 -1
- package/product/components/ProductGridPrice/index.js +0 -1
- package/product/components/ProductImage/ProductImage.d.ts.map +1 -1
- package/product/components/ProductImage/ProductImage.js +7 -2
- package/product/components/ProductImage/ProductImagePlaceholder.js +3 -3
- package/product/components/ProductSlider/index.js +1 -1
- package/product/components/UnitQuantityPicker/UnitQuantityPicker.d.ts.map +1 -1
- package/product/components/UnitQuantityPicker/UnitQuantityPicker.js +15 -33
- 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/reviews/components/Reviews/components/Header/components/WriteReviewLink/spec.js +28 -22
- package/reviews/components/Reviews/spec.js +5 -6
- package/settings/reducers/appSettings.d.ts.map +1 -1
- package/settings/reducers/appSettings.js +18 -2
- package/settings/selectors/appSettings.d.ts +37 -2
- package/settings/selectors/appSettings.d.ts.map +1 -1
- package/settings/selectors/appSettings.js +30 -1
- package/settings/types/appSettings.d.ts +42 -2
- package/settings/types/appSettings.d.ts.map +1 -1
- package/settings/types/appSettings.js +124 -1
- package/styles/helpers/index.d.ts +1 -0
- package/styles/helpers/index.js +1 -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.map +1 -1
- package/styles/helpers/loadThemeCss.js +11 -0
- package/styles/index.d.ts +1 -1
- package/styles/index.d.ts.map +1 -1
- package/styles/theme/createDefaultThemeOptions/index.d.ts.map +1 -1
- package/styles/theme/createDefaultThemeOptions/index.js +94 -3
- package/styles/theme/createTheme/createComponents.types.d.ts +25 -0
- package/styles/theme/createTheme/createComponents.types.d.ts.map +1 -1
- package/styles/theme/createTheme/createComponents.types.js +28 -3
- package/styles/theme/createTheme/createShape.d.ts +2 -3
- package/styles/theme/createTheme/createShape.d.ts.map +1 -1
- package/styles/theme/createTheme/createShape.js +1 -2
- package/styles/theme/createTheme/createThemeFromColorScheme.d.ts +3 -1
- package/styles/theme/createTheme/createThemeFromColorScheme.d.ts.map +1 -1
- package/styles/theme/createTheme/createThemeFromColorScheme.js +4 -2
- package/styles/theme/createTheme/createTypography.d.ts +2 -1
- package/styles/theme/createTheme/createTypography.js +58 -18
- package/styles/theme/createTheme/index.d.ts +2 -2
- package/styles/theme/createTheme/index.d.ts.map +1 -1
- package/styles/theme/createTheme/index.js +2 -2
- package/styles/theme/createTheme/types.d.ts +9 -2
- package/styles/theme/createTheme/types.d.ts.map +1 -1
- package/styles/theme/createTheme/types.js +6 -0
- package/styles/theme/hooks/useColorScheme.d.ts +2 -2
- package/styles/theme/hooks/useColorScheme.d.ts.map +1 -1
- package/styles/theme/hooks/useColorScheme.js +1 -1
- 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 +3 -1
- package/styles/theme/index.d.ts.map +1 -1
- package/styles/theme/providers/ColorSchemeContext.d.ts +30 -9
- package/styles/theme/providers/ColorSchemeContext.d.ts.map +1 -1
- package/styles/theme/providers/ColorSchemeContext.js +8 -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 +2 -2
- package/styles/theme/providers/ThemeProvider.d.ts.map +1 -1
- package/styles/theme/providers/ThemeProvider.js +58 -16
- 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/locations/components/StoreFinder/StoreFinderGetDirectionsButton.connector.js +0 -16
- package/locations/components/StoreFinder/StoreFinderGetDirectionsButton.js +0 -52
|
@@ -1 +1,124 @@
|
|
|
1
|
-
|
|
1
|
+
// Re-exported so consumers of these settings do not have to reach into the styles layer, which
|
|
2
|
+
// owns the type because it owns the elevation scale the sizes map to. `TypographyVariant` and the
|
|
3
|
+
// color scheme types are reused for the same reason - the theme owns the variant and scheme lists.
|
|
4
|
+
|
|
5
|
+
export const COLOR_SCHEME_SELECTABLE = 'selectable';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* What the app settings can configure: a color scheme that is binding, or `selectable` to let
|
|
9
|
+
* visitors pick one themselves. Distinct from the theme's `ColorSchemeMode`, which is what a
|
|
10
|
+
* visitor can pick - `selectable` is a permission rather than an appearance, and maps to the
|
|
11
|
+
* theme's `system` mode.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Recursively optional variant of `T`. The settings sources send only what a merchant configured,
|
|
16
|
+
* and the admin preview additionally prunes the fields its visibility conditions hide.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The merchant-facing screen sizes for the product list types. Each maps to a theme
|
|
21
|
+
* breakpoint inside the consuming hook (small → xs, medium → sm, large → md).
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* A value keyed by screen size. Partial: any unset size cascades down to the next smaller
|
|
26
|
+
* defined value (see useResponsiveValue).
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Number of product columns to render, keyed by screen size.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Settings for the ProductGrid list type.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Name-clamping shared by the card and tile product surfaces.
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Drop shadow of the card surface.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Number of slides to render side by side, keyed by screen size. Fractional values are allowed.
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Settings for the ProductSlider list type.
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Settings for the product rating stars.
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Settings for product presentation across the app.
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The visual style of the card surface.
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Settings for the themed card surface (checkout sections, address cards, sliders).
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* An aspect ratio expressed as width and height parts. Only the proportion matters -
|
|
71
|
+
* { width: 4, height: 5 } and { width: 8, height: 10 } are equivalent.
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* A single image resolution requested from the image service.
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* The product image contexts. pdp drives the product detail page, gallery the fullscreen gallery,
|
|
80
|
+
* and list every grid, slider, list and row tile.
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Settings for a single product image context. The pixel dimensions are not configurable - they
|
|
85
|
+
* are derived from the built-in base widths for the context (see PRODUCT_IMAGE_BASE_WIDTHS) so
|
|
86
|
+
* that image weight stays under the theme's control.
|
|
87
|
+
*/
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Settings for the product image contexts.
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Settings for images that are served through the image service.
|
|
95
|
+
*
|
|
96
|
+
* quality, fillColor and fillTransparent sit here rather than under product because they are not
|
|
97
|
+
* product specific - getFullImageSource applies them to every image that goes through the image
|
|
98
|
+
* service, including category images, carrier logos and page builder widget images.
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Settings for the app's overall appearance.
|
|
103
|
+
*/
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* A font stylesheet to load. The file carries the `@font-face` rules and points its target at the
|
|
107
|
+
* new family itself, e.g. `:root { --sg-typography-h1-fontFamily: 'Recoleta'; }`.
|
|
108
|
+
*/
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Typography settings. The top level file applies to everything, a variant entry only to that
|
|
112
|
+
* variant. Variant files are loaded after the global one, so they win at equal specificity.
|
|
113
|
+
*/
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* What a settings source actually sends. Every field is optional, so the reducer fills the gaps
|
|
117
|
+
* from its defaults instead of leaving consumers with undefined.
|
|
118
|
+
*/
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* The stored app settings slice. Extends the raw {@link AppSettings} values
|
|
122
|
+
* with metadata that is derived by the reducer rather than supplied by a
|
|
123
|
+
* source (admin sync / jsonp).
|
|
124
|
+
*/
|
|
@@ -5,6 +5,7 @@ export { setViewportHeight } from "./setViewportHeight";
|
|
|
5
5
|
export { toggleBodyScroll } from "./toggleBodyScroll";
|
|
6
6
|
export { loadCustomStyles } from "./loadCustomStyles";
|
|
7
7
|
export { loadThemeCss } from "./loadThemeCss";
|
|
8
|
+
export { loadFontCss } from "./loadFontCss";
|
|
8
9
|
export * from "./color";
|
|
9
10
|
export { responsiveMediaQuery } from "../../components/ResponsiveContainer/mediaQuery";
|
|
10
11
|
export { responsiveCondition } from "../../components/ResponsiveContainer/condition";
|
package/styles/helpers/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export { toggleBodyScroll } from "./toggleBodyScroll";
|
|
|
7
7
|
export { initCSSCustomProps, initCSSCustomPropsFallback } from "./initCSSCustomProperties";
|
|
8
8
|
export { loadCustomStyles } from "./loadCustomStyles";
|
|
9
9
|
export { loadThemeCss } from "./loadThemeCss";
|
|
10
|
+
export { loadFontCss } from "./loadFontCss";
|
|
10
11
|
export * from "./color";
|
|
11
12
|
export { responsiveMediaQuery } from "../../components/ResponsiveContainer/mediaQuery";
|
|
12
13
|
export { responsiveCondition } from "../../components/ResponsiveContainer/condition";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Syncs the font css links in the document with the passed urls. Tags for urls that are no longer
|
|
3
|
+
* configured are removed, and the remaining ones end up in the dom in the order they were passed -
|
|
4
|
+
* so the global file, passed first, stays above the per variant ones however they were ordered
|
|
5
|
+
* before.
|
|
6
|
+
*
|
|
7
|
+
* Idempotent by design: the admin preview re-sends the app settings while a merchant edits them, so
|
|
8
|
+
* this runs again on every settings update. A tag that is already in place is left untouched, and a
|
|
9
|
+
* tag for a url that is still configured is moved rather than recreated, which would re-request the
|
|
10
|
+
* file.
|
|
11
|
+
*
|
|
12
|
+
* A url is only ever loaded once. Configuring the same file globally and for a variant is normal,
|
|
13
|
+
* and a second link tag for it would apply the same `@font-face` rules twice.
|
|
14
|
+
*
|
|
15
|
+
* Resolves once every newly added file settled, and never rejects - a font file is not guaranteed
|
|
16
|
+
* to exist and must not be able to block app start.
|
|
17
|
+
* @param urls The font css urls to load, in cascade order. Duplicates are dropped, keeping the
|
|
18
|
+
* first occurrence so the cascade order is preserved.
|
|
19
|
+
* @returns A promise that resolves once the new files settled.
|
|
20
|
+
*/
|
|
21
|
+
export declare const loadFontCss: (urls?: string[]) => Promise<void>;
|
|
22
|
+
//# sourceMappingURL=loadFontCss.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadFontCss.d.ts","sourceRoot":"","sources":["../../../styles/helpers/loadFontCss.ts"],"names":[],"mappings":"AAmGA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,WAAW,GAAU,OAAM,MAAM,EAAO,KAAG,OAAO,CAAC,IAAI,CAqCnE,CAAC"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { withScope, captureMessage, Severity as SentrySeverity } from '@sentry/browser';
|
|
2
|
+
const REQUEST_TIMEOUT = 3000;
|
|
3
|
+
const LINK_TAG_CLASS = 'font-css';
|
|
4
|
+
const URL_ATTRIBUTE = 'data-font-css-url';
|
|
5
|
+
const INSERTION_POINT_SELECTOR = 'meta[name="font-css-insertion-point"]';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Reads the font css links that are currently in the document, in document order.
|
|
9
|
+
* @returns The link tags.
|
|
10
|
+
*/
|
|
11
|
+
const getExistingTags = () => Array.from(document.querySelectorAll(`link.${LINK_TAG_CLASS}`));
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Inserts a tag after the passed sibling, or appends it when there is none.
|
|
15
|
+
* @param tag The tag to insert.
|
|
16
|
+
* @param sibling The node to insert after.
|
|
17
|
+
*/
|
|
18
|
+
const insertAfter = (tag, sibling) => {
|
|
19
|
+
if (!sibling) {
|
|
20
|
+
document.head.appendChild(tag);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
sibling.parentNode?.insertBefore(tag, sibling.nextSibling);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Loads a single font css file and inserts its link after the passed sibling. The font css
|
|
28
|
+
* insertion point sits between the emotion one and the theme css one, so these files override the
|
|
29
|
+
* custom properties that theme initialization generates while the theme css file still overrides
|
|
30
|
+
* them in turn. Falls back to appending when the meta is absent.
|
|
31
|
+
*
|
|
32
|
+
* A link applies at its position in the dom rather than at the time it finished loading, so the
|
|
33
|
+
* timeout below only decides how long app start waits - never which styles win. The tag is left in
|
|
34
|
+
* place when it hits, so the file still applies once it eventually loads.
|
|
35
|
+
* @param href The url to load.
|
|
36
|
+
* @param sibling The node to insert after.
|
|
37
|
+
* @returns The inserted link tag and a promise that settles on load, error or timeout.
|
|
38
|
+
*/
|
|
39
|
+
const loadOne = (href, sibling) => {
|
|
40
|
+
const linkTag = document.createElement('link');
|
|
41
|
+
linkTag.rel = 'stylesheet';
|
|
42
|
+
linkTag.type = 'text/css';
|
|
43
|
+
linkTag.href = href;
|
|
44
|
+
linkTag.className = LINK_TAG_CLASS;
|
|
45
|
+
linkTag.setAttribute(URL_ATTRIBUTE, href);
|
|
46
|
+
const settled = new Promise(resolve => {
|
|
47
|
+
let done = false;
|
|
48
|
+
let timeout;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Resolves the promise once, whichever of load / error / timeout comes first.
|
|
52
|
+
*/
|
|
53
|
+
const settle = () => {
|
|
54
|
+
if (done) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
done = true;
|
|
58
|
+
clearTimeout(timeout);
|
|
59
|
+
resolve();
|
|
60
|
+
};
|
|
61
|
+
linkTag.onload = settle;
|
|
62
|
+
linkTag.onerror = () => {
|
|
63
|
+
withScope(scope => {
|
|
64
|
+
scope.setLevel(SentrySeverity.Error);
|
|
65
|
+
scope.setExtra('fontCssUrl', href);
|
|
66
|
+
captureMessage('Fetching font css failed');
|
|
67
|
+
});
|
|
68
|
+
settle();
|
|
69
|
+
};
|
|
70
|
+
timeout = setTimeout(() => {
|
|
71
|
+
withScope(scope => {
|
|
72
|
+
scope.setLevel(SentrySeverity.Warning);
|
|
73
|
+
scope.setExtra('fontCssUrl', href);
|
|
74
|
+
scope.setExtra('timeout', REQUEST_TIMEOUT);
|
|
75
|
+
captureMessage('Fetching font css took too long');
|
|
76
|
+
});
|
|
77
|
+
settle();
|
|
78
|
+
}, REQUEST_TIMEOUT);
|
|
79
|
+
});
|
|
80
|
+
insertAfter(linkTag, sibling);
|
|
81
|
+
return {
|
|
82
|
+
linkTag,
|
|
83
|
+
settled
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Syncs the font css links in the document with the passed urls. Tags for urls that are no longer
|
|
89
|
+
* configured are removed, and the remaining ones end up in the dom in the order they were passed -
|
|
90
|
+
* so the global file, passed first, stays above the per variant ones however they were ordered
|
|
91
|
+
* before.
|
|
92
|
+
*
|
|
93
|
+
* Idempotent by design: the admin preview re-sends the app settings while a merchant edits them, so
|
|
94
|
+
* this runs again on every settings update. A tag that is already in place is left untouched, and a
|
|
95
|
+
* tag for a url that is still configured is moved rather than recreated, which would re-request the
|
|
96
|
+
* file.
|
|
97
|
+
*
|
|
98
|
+
* A url is only ever loaded once. Configuring the same file globally and for a variant is normal,
|
|
99
|
+
* and a second link tag for it would apply the same `@font-face` rules twice.
|
|
100
|
+
*
|
|
101
|
+
* Resolves once every newly added file settled, and never rejects - a font file is not guaranteed
|
|
102
|
+
* to exist and must not be able to block app start.
|
|
103
|
+
* @param urls The font css urls to load, in cascade order. Duplicates are dropped, keeping the
|
|
104
|
+
* first occurrence so the cascade order is preserved.
|
|
105
|
+
* @returns A promise that resolves once the new files settled.
|
|
106
|
+
*/
|
|
107
|
+
export const loadFontCss = async (urls = []) => {
|
|
108
|
+
const wanted = Array.from(new Set(urls));
|
|
109
|
+
const wantedUrls = new Set(wanted);
|
|
110
|
+
const kept = new Map();
|
|
111
|
+
getExistingTags().forEach(tag => {
|
|
112
|
+
const url = tag.getAttribute(URL_ATTRIBUTE) || '';
|
|
113
|
+
if (wantedUrls.has(url) && !kept.has(url)) {
|
|
114
|
+
kept.set(url, tag);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
tag.remove();
|
|
118
|
+
});
|
|
119
|
+
let sibling = document.querySelector(INSERTION_POINT_SELECTOR);
|
|
120
|
+
const pending = [];
|
|
121
|
+
wanted.forEach(url => {
|
|
122
|
+
const existing = kept.get(url);
|
|
123
|
+
if (existing) {
|
|
124
|
+
if (existing.previousElementSibling !== sibling) {
|
|
125
|
+
insertAfter(existing, sibling);
|
|
126
|
+
}
|
|
127
|
+
sibling = existing;
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const {
|
|
131
|
+
linkTag,
|
|
132
|
+
settled
|
|
133
|
+
} = loadOne(url, sibling);
|
|
134
|
+
sibling = linkTag;
|
|
135
|
+
pending.push(settled);
|
|
136
|
+
});
|
|
137
|
+
await Promise.all(pending);
|
|
138
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadThemeCss.d.ts","sourceRoot":"","sources":["../../../styles/helpers/loadThemeCss.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loadThemeCss.d.ts","sourceRoot":"","sources":["../../../styles/helpers/loadThemeCss.ts"],"names":[],"mappings":"AAuCA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,QAAO,OAAO,CAAC,IAAI,CAqF1C,CAAC"}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { withScope, captureMessage, Severity as SentrySeverity } from '@sentry/browser';
|
|
2
2
|
import { appConfig } from '@shopgate/engage';
|
|
3
|
+
import { isFrontendSettingsAdminPreviewActive } from '@shopgate/engage/admin-preview/helpers';
|
|
3
4
|
const REQUEST_TIMEOUT = 3000;
|
|
4
5
|
const LINK_TAG_ID = 'theme-css';
|
|
5
6
|
const INSERTION_POINT_SELECTOR = 'meta[name="theme-css-insertion-point"]';
|
|
6
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Temporary switch. Set to false to load the theme css file in the frontend settings preview
|
|
10
|
+
* again, or remove it together with the guard in loadThemeCss and the import above.
|
|
11
|
+
*/
|
|
12
|
+
const SKIP_IN_FRONTEND_SETTINGS_PREVIEW = true;
|
|
13
|
+
|
|
7
14
|
/**
|
|
8
15
|
* Inserts the link at the theme css insertion point, which the html template declares between the
|
|
9
16
|
* emotion insertion point and the preview one. That position is what makes the cascade order
|
|
@@ -36,6 +43,10 @@ const insertLinkTag = linkTag => {
|
|
|
36
43
|
* @returns A promise that resolves once the file settled.
|
|
37
44
|
*/
|
|
38
45
|
export const loadThemeCss = () => new Promise(resolve => {
|
|
46
|
+
if (SKIP_IN_FRONTEND_SETTINGS_PREVIEW && isFrontendSettingsAdminPreviewActive()) {
|
|
47
|
+
resolve();
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
39
50
|
const {
|
|
40
51
|
themeCssUrl: href
|
|
41
52
|
} = appConfig;
|
package/styles/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from './helpers';
|
|
2
|
-
export { ThemeProvider, createTheme, useActiveBreakpoint, useMediaQuery, useResponsiveValue, useTheme, useColorScheme, withTheme, type Theme, type ShadowSize, type ColorSchemeName, type PaletteColorsWithMain, type WithThemeProps, } from './theme';
|
|
2
|
+
export { ThemeProvider, createTheme, useActiveBreakpoint, useMediaQuery, useResponsiveValue, useTheme, useColorScheme, withTheme, type Theme, type ShadowSize, type ColorSchemeName, type ColorSchemeMode, type ColorSchemeContextValue, type PaletteColorsWithMain, type WithThemeProps, } from './theme';
|
|
3
3
|
export { makeStyles, withStyles, useStyles, css, cx, tss, GlobalStyles, injectGlobal, keyframes, } from './tss';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/styles/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../styles/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,OAAO,EACL,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,QAAQ,EACR,cAAc,EACd,SAAS,EACT,KAAK,KAAK,EACV,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,cAAc,GACpB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,UAAU,EACV,UAAU,EACV,SAAS,EACT,GAAG,EACH,EAAE,EACF,GAAG,EACH,YAAY,EACZ,YAAY,EACZ,SAAS,GACV,MAAM,OAAO,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../styles/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,OAAO,EACL,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,QAAQ,EACR,cAAc,EACd,SAAS,EACT,KAAK,KAAK,EACV,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,cAAc,GACpB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,UAAU,EACV,UAAU,EACV,SAAS,EACT,GAAG,EACH,EAAE,EACF,GAAG,EACH,YAAY,EACZ,YAAY,EACZ,SAAS,GACV,MAAM,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createDefaultThemeOptions/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAInD;;;GAGG;AACH,eAAO,MAAM,yBAAyB,QAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createDefaultThemeOptions/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAInD;;;GAGG;AACH,eAAO,MAAM,yBAAyB,QAAO,YAkN3C,CAAC"}
|
|
@@ -118,12 +118,103 @@ export const createDefaultThemeOptions = () => ({
|
|
|
118
118
|
},
|
|
119
119
|
dark: {
|
|
120
120
|
palette: {
|
|
121
|
+
// No primary or secondary here on purpose. Both inherit from the light scheme, so a
|
|
122
|
+
// merchant's brand colors carry over instead of being replaced by a hard coded pair.
|
|
123
|
+
error: {
|
|
124
|
+
main: '#FF6B6B'
|
|
125
|
+
},
|
|
126
|
+
warning: {
|
|
127
|
+
main: '#FFA726'
|
|
128
|
+
},
|
|
129
|
+
success: {
|
|
130
|
+
main: '#5DD954'
|
|
131
|
+
},
|
|
121
132
|
background: {
|
|
122
|
-
default: '#
|
|
133
|
+
default: '#000000',
|
|
134
|
+
surface: '#1C1C1E',
|
|
135
|
+
emphasized: '#2C2C2E'
|
|
123
136
|
},
|
|
124
137
|
text: {
|
|
125
|
-
primary: '#
|
|
126
|
-
secondary: '#
|
|
138
|
+
primary: '#F2F2F7',
|
|
139
|
+
secondary: '#AEAEB2'
|
|
140
|
+
},
|
|
141
|
+
grey: {
|
|
142
|
+
light: '#2C2C2E',
|
|
143
|
+
medium: '#48484A',
|
|
144
|
+
dark: '#8E8E93'
|
|
145
|
+
},
|
|
146
|
+
action: {
|
|
147
|
+
disabled: '#8E8E93',
|
|
148
|
+
disabledBackground: '#48484A'
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
components: {
|
|
152
|
+
border: {
|
|
153
|
+
vars: {
|
|
154
|
+
light: '#38383A',
|
|
155
|
+
medium: '#48484A',
|
|
156
|
+
dark: '#8E8E93'
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
input: {
|
|
160
|
+
vars: {
|
|
161
|
+
background: '#2C2C2E',
|
|
162
|
+
border: '#48484A'
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
separatorLine: {
|
|
166
|
+
vars: {
|
|
167
|
+
borderColor: '#38383A'
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
snackbar: {
|
|
171
|
+
vars: {
|
|
172
|
+
background: '#2C2C2E'
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
tabBar: {
|
|
176
|
+
vars: {
|
|
177
|
+
background: '#1C1C1E',
|
|
178
|
+
border: '#374151',
|
|
179
|
+
inactive: '#9CA3AF',
|
|
180
|
+
floatingBoxShadow: '0 0 12px rgba(0, 0, 0, 0.6)'
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
appBar: {
|
|
184
|
+
vars: {
|
|
185
|
+
background: '#1C1C1E'
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
discountBadge: {
|
|
189
|
+
vars: {
|
|
190
|
+
background: '#FF0000'
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
ratingStars: {
|
|
194
|
+
vars: {
|
|
195
|
+
empty: '#48484A'
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
cards: {
|
|
199
|
+
vars: {
|
|
200
|
+
backgroundColor: '#1C1C1E',
|
|
201
|
+
borderColor: '#38383A'
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
tiles: {
|
|
205
|
+
vars: {
|
|
206
|
+
backgroundColor: '#1C1C1E',
|
|
207
|
+
borderColor: '#38383A'
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
swiper: {
|
|
211
|
+
vars: {
|
|
212
|
+
paginationBulletColor: '#AEAEB2',
|
|
213
|
+
paginationBulletActiveColor: '#F2F2F7',
|
|
214
|
+
paginationFractionBackground: '#2C2C2E',
|
|
215
|
+
paginationProgressbarBackground: '#48484A',
|
|
216
|
+
paginationProgressbarActiveColor: '#FFFFFF'
|
|
217
|
+
}
|
|
127
218
|
}
|
|
128
219
|
}
|
|
129
220
|
}
|
|
@@ -205,6 +205,7 @@ export declare const componentsSchema: {
|
|
|
205
205
|
};
|
|
206
206
|
readonly cards: {
|
|
207
207
|
readonly vars: {
|
|
208
|
+
readonly borderRadius: "";
|
|
208
209
|
readonly backgroundColor: "";
|
|
209
210
|
readonly borderWidth: "";
|
|
210
211
|
readonly borderColor: "";
|
|
@@ -221,13 +222,22 @@ export declare const componentsSchema: {
|
|
|
221
222
|
};
|
|
222
223
|
readonly tiles: {
|
|
223
224
|
readonly vars: {
|
|
225
|
+
readonly borderRadius: "";
|
|
224
226
|
readonly backgroundColor: "";
|
|
227
|
+
readonly borderWidth: "";
|
|
228
|
+
readonly borderColor: "";
|
|
229
|
+
readonly border: "";
|
|
225
230
|
readonly padding: "";
|
|
226
231
|
readonly textPadding: "";
|
|
227
232
|
readonly textPaddingTop: "";
|
|
228
233
|
readonly imagePadding: "";
|
|
229
234
|
};
|
|
230
235
|
};
|
|
236
|
+
readonly productImage: {
|
|
237
|
+
readonly vars: {
|
|
238
|
+
readonly borderRadius: "";
|
|
239
|
+
};
|
|
240
|
+
};
|
|
231
241
|
};
|
|
232
242
|
/**
|
|
233
243
|
* Default component tokens.
|
|
@@ -238,6 +248,11 @@ export declare const componentsSchema: {
|
|
|
238
248
|
* - functions get proper `Theme` typing
|
|
239
249
|
*/
|
|
240
250
|
export declare const componentsDefaults: {
|
|
251
|
+
button: {
|
|
252
|
+
vars: {
|
|
253
|
+
borderRadius: string;
|
|
254
|
+
};
|
|
255
|
+
};
|
|
241
256
|
border: {
|
|
242
257
|
vars: {
|
|
243
258
|
light: string;
|
|
@@ -340,6 +355,7 @@ export declare const componentsDefaults: {
|
|
|
340
355
|
};
|
|
341
356
|
cards: {
|
|
342
357
|
vars: {
|
|
358
|
+
borderRadius: string;
|
|
343
359
|
backgroundColor: (t: Theme) => string;
|
|
344
360
|
borderWidth: number;
|
|
345
361
|
borderColor: string;
|
|
@@ -356,13 +372,22 @@ export declare const componentsDefaults: {
|
|
|
356
372
|
};
|
|
357
373
|
tiles: {
|
|
358
374
|
vars: {
|
|
375
|
+
borderRadius: string;
|
|
359
376
|
backgroundColor: string;
|
|
377
|
+
borderWidth: number;
|
|
378
|
+
borderColor: string;
|
|
379
|
+
border: string;
|
|
360
380
|
padding: number;
|
|
361
381
|
textPadding: number;
|
|
362
382
|
textPaddingTop: string;
|
|
363
383
|
imagePadding: number;
|
|
364
384
|
};
|
|
365
385
|
};
|
|
386
|
+
productImage: {
|
|
387
|
+
vars: {
|
|
388
|
+
borderRadius: string;
|
|
389
|
+
};
|
|
390
|
+
};
|
|
366
391
|
};
|
|
367
392
|
/** Internal defaults type (must cover full schema). */
|
|
368
393
|
export type ComponentsDefaults = ComponentsOverrideFromSchema<typeof componentsSchema, Theme>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createComponents.types.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/createComponents.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,KAAK,KAAK,GAAG,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;AAE3C;;;GAGG;AACH,KAAK,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;AAEzD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,mBAAmB,CAAC,MAAM,IAClC,MAAM,GACN,MAAM,GACN,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,CAAC,CAAC;AAEzC;;;;;;;;;;GAUG;AACH,MAAM,MAAM,oBAAoB,CAAC,OAAO,IACtC,OAAO,SAAS,IAAI,GAAG,MAAM,GAC3B,OAAO,SAAS,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,SAAS,oBAAoB,CAAC,CAAC,CAAC,EAAE,GACzE,OAAO,SAAS,MAAM,GAAG;KAAG,CAAC,IAAI,MAAM,OAAO,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;CAAE,GACnF,MAAM,CAAC;AAEX;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,4BAA4B,CAAC,OAAO,EAAE,MAAM,IACtD,OAAO,SAAS,IAAI,GAAG,mBAAmB,CAAC,MAAM,CAAC,GAChD,OAAO,SAAS,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,SAAS,4BAA4B,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,GACzF,OAAO,SAAS,MAAM,GACtB;KAAG,CAAC,IAAI,MAAM,OAAO,GAAG,4BAA4B,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC;CAAE,GAC1E,mBAAmB,CAAC,MAAM,CAAC,CAAC;AAEhC;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,4BAA4B,CAAC,OAAO,EAAE,MAAM,IACtD,OAAO,SAAS,IAAI,GAAG,mBAAmB,CAAC,MAAM,CAAC,GAChD,OAAO,SAAS,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,SAAS,4BAA4B,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,GACzF,OAAO,SAAS,MAAM,GACtB;KAAG,CAAC,IAAI,MAAM,OAAO,CAAC,CAAC,EAAE,4BAA4B,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC;CAAE,GAC3E,mBAAmB,CAAC,MAAM,CAAC,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,uBAAuB,CAAC,OAAO,IAAI;KAC5C,CAAC,IAAI,MAAM,OAAO,GACnB,OAAO,CAAC,CAAC,CAAC,SAAS;QAAE,IAAI,EAAE,MAAM,KAAK,CAAA;KAAE,GACtC,oBAAoB,CAAC,KAAK,CAAC,GAC3B,KAAK;CACR,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"createComponents.types.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/createComponents.types.ts"],"names":[],"mappings":"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"}
|
|
@@ -193,6 +193,7 @@ export const componentsSchema = {
|
|
|
193
193
|
},
|
|
194
194
|
cards: {
|
|
195
195
|
vars: {
|
|
196
|
+
borderRadius: '',
|
|
196
197
|
backgroundColor: '',
|
|
197
198
|
borderWidth: '',
|
|
198
199
|
borderColor: '',
|
|
@@ -209,12 +210,21 @@ export const componentsSchema = {
|
|
|
209
210
|
},
|
|
210
211
|
tiles: {
|
|
211
212
|
vars: {
|
|
213
|
+
borderRadius: '',
|
|
212
214
|
backgroundColor: '',
|
|
215
|
+
borderWidth: '',
|
|
216
|
+
borderColor: '',
|
|
217
|
+
border: '',
|
|
213
218
|
padding: '',
|
|
214
219
|
textPadding: '',
|
|
215
220
|
textPaddingTop: '',
|
|
216
221
|
imagePadding: ''
|
|
217
222
|
}
|
|
223
|
+
},
|
|
224
|
+
productImage: {
|
|
225
|
+
vars: {
|
|
226
|
+
borderRadius: ''
|
|
227
|
+
}
|
|
218
228
|
}
|
|
219
229
|
};
|
|
220
230
|
|
|
@@ -227,6 +237,11 @@ export const componentsSchema = {
|
|
|
227
237
|
* - functions get proper `Theme` typing
|
|
228
238
|
*/
|
|
229
239
|
export const componentsDefaults = {
|
|
240
|
+
button: {
|
|
241
|
+
vars: {
|
|
242
|
+
borderRadius: 'var(--sg-shape-borderRadius, 4px)'
|
|
243
|
+
}
|
|
244
|
+
},
|
|
230
245
|
border: {
|
|
231
246
|
vars: {
|
|
232
247
|
light: '#F2F2F2',
|
|
@@ -269,7 +284,7 @@ export const componentsDefaults = {
|
|
|
269
284
|
},
|
|
270
285
|
discountBadge: {
|
|
271
286
|
vars: {
|
|
272
|
-
background: '#
|
|
287
|
+
background: '#FF0000'
|
|
273
288
|
}
|
|
274
289
|
},
|
|
275
290
|
icon: {
|
|
@@ -329,6 +344,7 @@ export const componentsDefaults = {
|
|
|
329
344
|
},
|
|
330
345
|
cards: {
|
|
331
346
|
vars: {
|
|
347
|
+
borderRadius: 'var(--sg-shape-borderRadius)',
|
|
332
348
|
backgroundColor: t => t.palette.background.surface,
|
|
333
349
|
borderWidth: 0,
|
|
334
350
|
borderColor: 'transparent',
|
|
@@ -345,12 +361,21 @@ export const componentsDefaults = {
|
|
|
345
361
|
},
|
|
346
362
|
tiles: {
|
|
347
363
|
vars: {
|
|
364
|
+
borderRadius: 'var(--sg-shape-borderRadius)',
|
|
348
365
|
backgroundColor: 'transparent',
|
|
366
|
+
borderWidth: 0,
|
|
367
|
+
borderColor: 'transparent',
|
|
368
|
+
border: 'var(--sg-components-tiles-borderWidth) solid var(--sg-components-tiles-borderColor)',
|
|
349
369
|
padding: 0,
|
|
350
|
-
textPadding:
|
|
351
|
-
textPaddingTop: 'max(var(--sg-components-tiles-textPadding),
|
|
370
|
+
textPadding: 0,
|
|
371
|
+
textPaddingTop: 'max(var(--sg-components-tiles-textPadding), 12px)',
|
|
352
372
|
imagePadding: 0
|
|
353
373
|
}
|
|
374
|
+
},
|
|
375
|
+
productImage: {
|
|
376
|
+
vars: {
|
|
377
|
+
borderRadius: 'var(--sg-shape-borderRadius)'
|
|
378
|
+
}
|
|
354
379
|
}
|
|
355
380
|
};
|
|
356
381
|
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
export interface Shape {
|
|
2
|
-
borderRadius: number | string;
|
|
3
2
|
/**
|
|
4
|
-
*
|
|
3
|
+
* The app wide corner style. Every rounded surface derives from it.
|
|
5
4
|
*/
|
|
6
|
-
|
|
5
|
+
borderRadius: number | string;
|
|
7
6
|
}
|
|
8
7
|
export type ShapeOptions = Partial<Shape>;
|
|
9
8
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createShape.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/createShape.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IACpB
|
|
1
|
+
{"version":3,"file":"createShape.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/createShape.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IACpB;;OAEG;IACH,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC;CAC/B;AAED,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AAM1C;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,OAAO,GAAE,YAAiB,GAAG,KAAK,CAKrE"}
|
|
@@ -30,8 +30,10 @@ export declare const contrastColor: (color: string) => string;
|
|
|
30
30
|
/**
|
|
31
31
|
* Creates a theme object for a given color scheme (light or dark).
|
|
32
32
|
* @param colorScheme The color scheme options.
|
|
33
|
+
* @param cssVarPrefix The theme's css variable prefix. Typography references some of the properties
|
|
34
|
+
* that are generated from it later, so it has to compose the same names.
|
|
33
35
|
* @returns A theme object for the given color scheme.
|
|
34
36
|
*/
|
|
35
|
-
declare const createThemeFromColorScheme: (colorScheme: ColorSchemeOptions) => ColorSchemeTheme;
|
|
37
|
+
declare const createThemeFromColorScheme: (colorScheme: ColorSchemeOptions, cssVarPrefix?: string) => ColorSchemeTheme;
|
|
36
38
|
export default createThemeFromColorScheme;
|
|
37
39
|
//# sourceMappingURL=createThemeFromColorScheme.d.ts.map
|