@shopgate/engage 7.32.0-beta.6 → 7.32.0-beta.8

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.
Files changed (205) hide show
  1. package/account/components/Profile/ProfileAddressBook.d.ts.map +1 -1
  2. package/account/components/Profile/ProfileAddressBook.js +13 -22
  3. package/account/components/Profile/ProfileAddressCard.d.ts.map +1 -1
  4. package/account/components/Profile/ProfileAddressCard.js +9 -18
  5. package/account/components/Profile/ProfileForm.d.ts.map +1 -1
  6. package/account/components/Profile/ProfileForm.js +15 -42
  7. package/account/components/ProfileContact/ProfileContact.js +13 -21
  8. package/admin-preview/components/FrontendSettingsPreviewBridge/FrontendSettingsPreviewBridge.d.ts.map +1 -1
  9. package/admin-preview/components/FrontendSettingsPreviewBridge/FrontendSettingsPreviewBridge.js +40 -6
  10. package/admin-preview/components/FrontendSettingsPreviewBridge/types.d.ts +9 -2
  11. package/admin-preview/components/FrontendSettingsPreviewBridge/types.d.ts.map +1 -1
  12. package/admin-preview/initialization/_internal/initialFrontendSettings.d.ts +32 -0
  13. package/admin-preview/initialization/_internal/initialFrontendSettings.d.ts.map +1 -0
  14. package/admin-preview/initialization/_internal/initialFrontendSettings.js +43 -0
  15. package/admin-preview/initialization/awaitInitialFrontendSettings.d.ts +22 -0
  16. package/admin-preview/initialization/awaitInitialFrontendSettings.d.ts.map +1 -0
  17. package/admin-preview/initialization/awaitInitialFrontendSettings.js +84 -0
  18. package/back-in-stock/components/BackInStockButton/index.js +5 -5
  19. package/cart/components/CartItem/CartItemProductLayout.js +1 -0
  20. package/cart/components/CartItem/CartItemProductLayoutWideRemoveItem.js +7 -14
  21. package/cart/components/CartItems/CartItemCardReservationLabelChangeStore.js +6 -24
  22. package/cart/components/CartItems/CartItems.js +8 -10
  23. package/cart/components/CartItems/CartItemsSubstitution.js +3 -2
  24. package/cart/components/CartSummaryWide/CartSummaryWide.js +2 -2
  25. package/cart/components/CartSummaryWide/CartSummaryWideCheckoutButton.js +9 -23
  26. package/cart/components/PaymentBar/PaymentBarCheckoutButton.js +8 -30
  27. package/cart/components/PaymentBar/testUtils/mockFactories.js +4 -11
  28. package/category/components/CategoryImage/index.js +13 -2
  29. package/checkout/components/AddressBook/AddressList.js +14 -23
  30. package/checkout/components/Checkout/CheckoutActions.js +4 -3
  31. package/checkout/components/Checkout/CheckoutAddress.js +8 -0
  32. package/checkout/components/Checkout/CheckoutSection.js +6 -2
  33. package/checkout/components/CheckoutConfirmation/CheckoutConfirmation.js +6 -7
  34. package/checkout/components/ResponsiveBackButton/ResponsiveBackButton.js +7 -17
  35. package/components/Card/Card.d.ts +27 -0
  36. package/components/Card/Card.d.ts.map +1 -0
  37. package/components/Card/Card.js +57 -0
  38. package/components/Card/index.d.ts +4 -0
  39. package/components/Card/index.d.ts.map +1 -0
  40. package/components/Card/index.js +2 -0
  41. package/components/Card/spec.d.ts +2 -0
  42. package/components/Card/spec.d.ts.map +1 -0
  43. package/components/Card/spec.js +128 -0
  44. package/components/Card/useCardAppearance.d.ts +11 -0
  45. package/components/Card/useCardAppearance.d.ts.map +1 -0
  46. package/components/Card/useCardAppearance.js +22 -0
  47. package/components/ChipLayout/index.js +2 -4
  48. package/components/NavigationHandler/connector.js +1 -1
  49. package/components/NavigationHandler/spec.js +10 -1
  50. package/components/Paper/Paper.d.ts +48 -0
  51. package/components/Paper/Paper.d.ts.map +1 -0
  52. package/components/Paper/Paper.js +64 -0
  53. package/components/Paper/index.d.ts +3 -0
  54. package/components/Paper/index.d.ts.map +1 -0
  55. package/components/Paper/index.js +1 -0
  56. package/components/Paper/spec.d.ts +2 -0
  57. package/components/Paper/spec.d.ts.map +1 -0
  58. package/components/Paper/spec.js +131 -0
  59. package/components/RadioCard/RadioCard.d.ts.map +1 -1
  60. package/components/RadioCard/RadioCard.js +2 -1
  61. package/components/Tabs/components/Tab.d.ts.map +1 -1
  62. package/components/Tabs/components/Tab.js +14 -16
  63. package/components/Typography/Typography.d.ts +1 -1
  64. package/components/index.d.ts +4 -1
  65. package/components/index.d.ts.map +1 -1
  66. package/components/index.js +3 -2
  67. package/components/v2/Button/Button.d.ts +24 -13
  68. package/components/v2/Button/Button.d.ts.map +1 -1
  69. package/components/v2/Button/Button.js +89 -37
  70. package/components/v2/ButtonBase/ButtonBase.d.ts +50 -10
  71. package/components/v2/ButtonBase/ButtonBase.d.ts.map +1 -1
  72. package/components/v2/ButtonBase/ButtonBase.js +153 -16
  73. package/components/v2/ButtonBase/hooks.d.ts +0 -1
  74. package/components/v2/ButtonBase/hooks.d.ts.map +1 -1
  75. package/components/v2/ButtonBase/hooks.js +36 -12
  76. package/components/v2/ButtonGroup/ButtonGroup.d.ts +11 -5
  77. package/components/v2/ButtonGroup/ButtonGroup.d.ts.map +1 -1
  78. package/components/v2/ButtonGroup/ButtonGroup.js +30 -18
  79. package/components/v2/CircularProgress/CircularProgress.d.ts.map +1 -1
  80. package/components/v2/CircularProgress/CircularProgress.js +10 -5
  81. package/core/hooks/useNavigation.d.ts +10 -2
  82. package/core/hooks/useNavigation.d.ts.map +1 -1
  83. package/core/hooks/useNavigation.js +1 -2
  84. package/core/initialization/index.d.ts.map +1 -1
  85. package/core/initialization/index.js +24 -5
  86. package/core/router/conductor.d.ts +9 -0
  87. package/core/router/helpers.d.ts +28 -15
  88. package/core/router/helpers.d.ts.map +1 -1
  89. package/core/router/helpers.js +8 -8
  90. package/development/components/DevelopmentSettings/DevelopmentSettings.js +3 -3
  91. package/favorites/components/FavoriteButtonWide/FavoriteButtonWide.js +7 -17
  92. package/favorites/components/Item/Item.d.ts +1 -1
  93. package/favorites/components/List/List.d.ts.map +1 -1
  94. package/favorites/components/List/List.js +0 -1
  95. package/favorites/components/List/ListContent.js +4 -5
  96. package/favorites/components/Lists/Lists.js +4 -5
  97. package/filter/components/FilterPageContent/components/ApplyButton/index.js +8 -10
  98. package/filter/components/FilterPageContent/components/ResetButton/index.js +8 -6
  99. package/locations/components/ChangeLocationButton/ChangeLocationButton.js +10 -14
  100. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotDialog.js +4 -8
  101. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcher.js +1 -1
  102. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcherBar.js +8 -13
  103. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcherDefault.js +10 -10
  104. package/locations/components/GlobalLocationSwitcher/GlobalLocationSwitcherBar.js +8 -14
  105. package/locations/components/GlobalLocationSwitcher/GlobalLocationSwitcherDefault.js +9 -10
  106. package/locations/components/ReserveForm/ReserveForm.js +6 -7
  107. package/locations/components/StoreDetails/components/GetDirectionsButton.js +2 -4
  108. package/locations/components/StoreDetails/components/StoreDetails.js +5 -10
  109. package/locations/components/StoreDetails/components/StoresNearbyListItem.js +13 -21
  110. package/locations/components/StoreFinder/StoreFinderSelectLocationButton.js +5 -11
  111. package/locations/components/StoreFinder/StoreFinderStoreInfoButton.js +5 -11
  112. package/locations/components/StoreList/StoreSelectLocationButton.js +5 -11
  113. package/login/components/ForgotPassword/ForgotPassword.js +11 -23
  114. package/orders/components/OrderDetails/OrderDetailsAuthenticate.js +5 -7
  115. package/orders/components/OrderHistory/OrderHistoryList.d.ts.map +1 -1
  116. package/orders/components/OrderHistory/OrderHistoryList.js +8 -9
  117. package/orders/components/OrderHistory/OrderHistoryTable.d.ts.map +1 -1
  118. package/orders/components/OrderHistory/OrderHistoryTable.js +4 -0
  119. package/package.json +7 -7
  120. package/page/components/NotFound.d.ts.map +1 -1
  121. package/page/components/NotFound.js +7 -6
  122. package/page/components/ResponsiveWidgetImage/ResponsiveWidgetImage.d.ts +1 -1
  123. package/page/components/ResponsiveWidgetImage/ResponsiveWidgetImage.js +2 -2
  124. package/page/components/WidgetVideo/WidgetVideo.d.ts +1 -1
  125. package/page/components/WidgetVideo/WidgetVideo.d.ts.map +1 -1
  126. package/page/helpers/index.d.ts +5 -2
  127. package/page/helpers/index.d.ts.map +1 -1
  128. package/page/helpers/index.js +8 -5
  129. package/page/widgets/Button/Button.js +2 -3
  130. package/page/widgets/NestedCategoryFilter/NestedCategoryFilter.js +8 -8
  131. package/page/widgets/ProductList/ProductList.js +18 -14
  132. package/page/widgets/Video/hooks.d.ts +2 -2
  133. package/product/components/ProductCard/index.js +27 -14
  134. package/product/components/ProductGrid/components/Item/components/ItemDetails/index.js +6 -3
  135. package/product/components/ProductGrid/components/Item/components/ItemImage/index.js +1 -11
  136. package/product/components/ProductGrid/components/Item/components/ItemName/index.js +5 -1
  137. package/product/components/ProductGrid/components/Item/components/ItemName/spec.js +19 -1
  138. package/product/components/ProductGrid/components/Item/index.js +10 -1
  139. package/product/components/ProductImage/ProductImage.d.ts.map +1 -1
  140. package/product/components/ProductImage/ProductImage.js +7 -2
  141. package/product/components/ProductImage/ProductImagePlaceholder.js +3 -3
  142. package/product/components/ProductSlider/index.js +4 -2
  143. package/product/components/RelationsSlider/RelationsSliderContent.js +3 -2
  144. package/product/components/RelationsSlider/constants.d.ts +3 -0
  145. package/product/components/RelationsSlider/constants.d.ts.map +1 -0
  146. package/product/components/RelationsSlider/constants.js +2 -1
  147. package/product/components/RelationsSlider/hooks.d.ts +6 -0
  148. package/product/components/RelationsSlider/hooks.d.ts.map +1 -0
  149. package/product/components/RelationsSlider/hooks.js +34 -0
  150. package/product/components/UnitQuantityPicker/UnitQuantityPicker.d.ts.map +1 -1
  151. package/product/components/UnitQuantityPicker/UnitQuantityPicker.js +14 -33
  152. package/push-opt-in/components/PushOptInModal/index.js +4 -4
  153. package/registration/components/Registration/RegistrationFormActions.js +4 -4
  154. package/reviews/components/Reviews/components/AllReviewsLink/index.js +6 -6
  155. package/reviews/components/Reviews/components/Header/components/WriteReviewLink/index.js +4 -3
  156. package/reviews/components/Reviews/components/Header/components/WriteReviewLink/spec.js +28 -22
  157. package/reviews/components/Reviews/spec.js +5 -6
  158. package/settings/action-creators/appSettings.d.ts +3 -3
  159. package/settings/action-creators/appSettings.d.ts.map +1 -1
  160. package/settings/reducers/appSettings.d.ts.map +1 -1
  161. package/settings/reducers/appSettings.js +40 -18
  162. package/settings/reducers/index.d.ts +1 -1
  163. package/settings/selectors/appSettings.d.ts +48 -0
  164. package/settings/selectors/appSettings.d.ts.map +1 -1
  165. package/settings/selectors/appSettings.js +31 -1
  166. package/settings/types/appSettings.d.ts +69 -0
  167. package/settings/types/appSettings.d.ts.map +1 -1
  168. package/styles/helpers/index.d.ts +1 -0
  169. package/styles/helpers/index.js +1 -0
  170. package/styles/helpers/loadFontCss.d.ts +22 -0
  171. package/styles/helpers/loadFontCss.d.ts.map +1 -0
  172. package/styles/helpers/loadFontCss.js +138 -0
  173. package/styles/helpers/loadThemeCss.d.ts.map +1 -1
  174. package/styles/helpers/loadThemeCss.js +11 -0
  175. package/styles/index.d.ts +1 -1
  176. package/styles/index.d.ts.map +1 -1
  177. package/styles/theme/createTheme/createComponents.types.d.ts +75 -0
  178. package/styles/theme/createTheme/createComponents.types.d.ts.map +1 -1
  179. package/styles/theme/createTheme/createComponents.types.js +75 -0
  180. package/styles/theme/createTheme/createCssVarsForColorSchemeThemes.d.ts.map +1 -1
  181. package/styles/theme/createTheme/createCssVarsForColorSchemeThemes.js +5 -1
  182. package/styles/theme/createTheme/createPalette.types.d.ts +4 -0
  183. package/styles/theme/createTheme/createPalette.types.d.ts.map +1 -1
  184. package/styles/theme/createTheme/createPalette.types.js +5 -1
  185. package/styles/theme/createTheme/createShape.d.ts +3 -0
  186. package/styles/theme/createTheme/createShape.d.ts.map +1 -1
  187. package/styles/theme/createTheme/createThemeFromColorScheme.d.ts +3 -1
  188. package/styles/theme/createTheme/createThemeFromColorScheme.d.ts.map +1 -1
  189. package/styles/theme/createTheme/createThemeFromColorScheme.js +6 -3
  190. package/styles/theme/createTheme/createTypography.d.ts +2 -1
  191. package/styles/theme/createTheme/createTypography.js +58 -18
  192. package/styles/theme/createTheme/index.js +1 -1
  193. package/styles/theme/createTheme/shadows.d.ts +11 -1
  194. package/styles/theme/createTheme/shadows.d.ts.map +1 -1
  195. package/styles/theme/createTheme/shadows.js +41 -7
  196. package/styles/theme/createTheme/types.d.ts +5 -1
  197. package/styles/theme/createTheme/types.d.ts.map +1 -1
  198. package/styles/theme/index.d.ts +2 -0
  199. package/styles/theme/index.d.ts.map +1 -1
  200. package/tracking/components/CookieConsentModal/index.js +3 -4
  201. package/tracking/components/PrivacySettings/index.js +3 -3
  202. package/cart/components/PaymentBar/PaymentBarReserveButton.connector.js +0 -6
  203. package/cart/components/PaymentBar/PaymentBarReserveButton.js +0 -71
  204. package/locations/components/StoreFinder/StoreFinderGetDirectionsButton.connector.js +0 -16
  205. package/locations/components/StoreFinder/StoreFinderGetDirectionsButton.js +0 -52
@@ -1,19 +1,41 @@
1
1
  import _merge from "lodash/merge";
2
- import { isDev } from '@shopgate/engage/core/helpers';
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.
@@ -37,6 +59,23 @@ export default function createTypography(palette, typography) {
37
59
  }
38
60
  }
39
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]})`;
40
79
 
41
80
  /**
42
81
  * Calculates a rem value for a passed pixel value.
@@ -47,34 +86,35 @@ export default function createTypography(palette, typography) {
47
86
 
48
87
  /**
49
88
  * Creates a typography variant object.
50
- * @param {number} fontWeight The font weight to use for the variant.
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.
51
91
  * @param {number} size Font size in pixels.
52
92
  * @param {number} lineHeight Line height as a unitless number.
53
93
  * @param {Object} casing Casing styles to apply, e.g. textTransform.
54
94
  * @returns {Object} The typography variant object.
55
95
  */
56
- const buildVariant = (fontWeight, size, lineHeight, casing) => ({
96
+ const buildVariant = (fontWeightToken, size, lineHeight, casing) => ({
57
97
  fontFamily,
58
- fontWeight,
98
+ fontWeight: fontWeightVar(fontWeightToken),
59
99
  fontSize: pxToRem(size),
60
100
  lineHeight,
61
101
  ...casing,
62
102
  ...allVariants
63
103
  });
64
104
  const variants = {
65
- h1: buildVariant(fontWeightBold, 34, 1.15),
66
- h2: buildVariant(fontWeightBold, 22, 1.3),
67
- h3: buildVariant(fontWeightMedium, 20, 1.35),
68
- h4: buildVariant(fontWeightMedium, 18, 1.4),
69
- h5: buildVariant(fontWeightMedium, 16, 1.5),
70
- h6: buildVariant(fontWeightMedium, 14, 1.5),
71
- subtitle1: buildVariant(fontWeightRegular, 16, 1.75),
72
- subtitle2: buildVariant(fontWeightMedium, 14, 1.57),
73
- body1: buildVariant(fontWeightRegular, 16, 1.5),
74
- body2: buildVariant(fontWeightRegular, 14, 1.43),
75
- button: buildVariant(fontWeightMedium, 14, 1.75, caseAllCaps),
76
- caption: buildVariant(fontWeightRegular, 12, 1.66),
77
- 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)
78
118
  };
79
119
  return _merge({
80
120
  pxToRem,
@@ -38,7 +38,7 @@ export const createTheme = (options = {}) => {
38
38
  palette: {
39
39
  mode: type
40
40
  }
41
- }, defaultScheme, scheme));
41
+ }, defaultScheme, scheme), cssVarPrefix);
42
42
  return acc;
43
43
  }, {});
44
44
  const getColorSchemeSelector = createGetColorSchemeSelector(colorSchemeSelector);
@@ -1,4 +1,14 @@
1
- declare const shadows: readonly ["none", string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string];
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":"AAaA,QAAA,MAAM,OAAO,mNA0BH,CAAC;AAEX,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAA;AAEpC,eAAe,OAAO,CAAC"}
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
- const shadowKeyUmbraOpacity = 0.2;
2
- const shadowKeyPenumbraOpacity = 0.14;
3
- const shadowAmbientShadowOpacity = 0.12;
4
- function createShadow(...px) {
5
- return [`${px[0]}px ${px[1]}px ${px[2]}px ${px[3]}px rgba(0,0,0,${shadowKeyUmbraOpacity})`, `${px[4]}px ${px[5]}px ${px[6]}px ${px[7]}px rgba(0,0,0,${shadowKeyPenumbraOpacity})`, `${px[8]}px ${px[9]}px ${px[10]}px ${px[11]}px rgba(0,0,0,${shadowAmbientShadowOpacity})`].join(',');
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 shadows = ['none', createShadow(0, 2, 1, -1, 0, 1, 1, 0, 0, 1, 3, 0), createShadow(0, 3, 1, -2, 0, 2, 2, 0, 0, 1, 5, 0), createShadow(0, 3, 3, -2, 0, 3, 4, 0, 0, 1, 8, 0), createShadow(0, 2, 4, -1, 0, 4, 5, 0, 0, 1, 10, 0), createShadow(0, 3, 5, -1, 0, 5, 8, 0, 0, 1, 14, 0), createShadow(0, 3, 5, -1, 0, 6, 10, 0, 0, 1, 18, 0), createShadow(0, 4, 5, -2, 0, 7, 10, 1, 0, 2, 16, 1), createShadow(0, 5, 5, -3, 0, 8, 10, 1, 0, 3, 14, 2), createShadow(0, 5, 6, -3, 0, 9, 12, 1, 0, 3, 16, 2), createShadow(0, 6, 6, -3, 0, 10, 14, 1, 0, 4, 18, 3), createShadow(0, 6, 7, -4, 0, 11, 15, 1, 0, 4, 20, 3), createShadow(0, 7, 8, -4, 0, 12, 17, 2, 0, 5, 22, 4), createShadow(0, 7, 8, -4, 0, 13, 19, 2, 0, 5, 24, 4), createShadow(0, 7, 9, -4, 0, 14, 21, 2, 0, 5, 26, 4), createShadow(0, 8, 9, -5, 0, 15, 22, 2, 0, 6, 28, 5), createShadow(0, 8, 10, -5, 0, 16, 24, 2, 0, 6, 30, 5), createShadow(0, 8, 11, -5, 0, 17, 26, 2, 0, 6, 32, 5), createShadow(0, 9, 11, -5, 0, 18, 28, 2, 0, 7, 34, 6), createShadow(0, 9, 12, -6, 0, 19, 29, 2, 0, 7, 36, 6), createShadow(0, 10, 13, -6, 0, 20, 31, 3, 0, 8, 38, 7), createShadow(0, 10, 13, -6, 0, 21, 33, 3, 0, 8, 40, 7), createShadow(0, 10, 14, -6, 0, 22, 35, 3, 0, 8, 42, 7), createShadow(0, 11, 14, -7, 0, 23, 36, 3, 0, 9, 44, 8), createShadow(0, 11, 15, -7, 0, 24, 38, 3, 0, 9, 46, 8)];
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;
@@ -10,7 +10,7 @@ import type { ApplyStyles } from './applyStyles';
10
10
  import type { GetColorSchemeSelector, ActiveColorSchemeSwitcher } from './helpers';
11
11
  import type { CreateCssVarsForColorSchemeThemesReturnValue } from './createCssVarsForColorSchemeThemes';
12
12
  import type { Shape, ShapeOptions } from './createShape';
13
- import type { Shadows } from './shadows';
13
+ import type { Shadows, ShadowSize } from './shadows';
14
14
  export type { Breakpoint } from './createBreakpoints';
15
15
  export type { PaletteColorsWithMain } from './createPalette';
16
16
  export declare const COLOR_SCHEME_NAMES: readonly ["light", "dark"];
@@ -94,6 +94,10 @@ export interface BaseTheme {
94
94
  * Pre-defined shadow styles for different elevation levels, following Material Design guidelines.
95
95
  */
96
96
  shadows: Shadows;
97
+ /**
98
+ * The finished box-shadow size (`none` | `low` | `medium` | `strong`)
99
+ */
100
+ shadowSizes: Record<ShadowSize, string>;
97
101
  /**
98
102
  * Adds an alpha value to a color, returning a new color string with the applied alpha.
99
103
  * @param color The color to modify.
@@ -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,EAAE,iBAAiB,EAAE,aA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,EAAE,sBAAsB,CAAC;IAC/C;;OAEG;IACH,oBAAoB,EAAE,yBAAyB,CAAC;CACjD,CAAC"}
@@ -1,5 +1,7 @@
1
1
  export { default as ThemeProvider } from './providers/ThemeProvider';
2
2
  export { createTheme } from './createTheme';
3
+ export { type ShadowSize } from './createTheme/shadows';
4
+ export type { Variant as TypographyVariant } from './createTheme/createTypography';
3
5
  export type { Theme, Breakpoint, PaletteColorsWithMain, ColorSchemeName, } from './createTheme';
4
6
  export { useActiveBreakpoint, useMediaQuery, useResponsiveValue, useTheme, useColorScheme, } from './hooks';
5
7
  export { withTheme, type WithThemeProps } from './hocs';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../styles/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EACV,KAAK,EAAE,UAAU,EAAE,qBAAqB,EAAE,eAAe,GAC1D,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,QAAQ,EACR,cAAc,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../styles/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,YAAY,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnF,YAAY,EACV,KAAK,EAAE,UAAU,EAAE,qBAAqB,EAAE,eAAe,GAC1D,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,QAAQ,EACR,cAAc,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAC"}
@@ -2,7 +2,8 @@ import React, { useMemo, useEffect } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import throttle from 'lodash/throttle';
4
4
  import { makeStyles } from '@shopgate/engage/styles';
5
- import { Grid, I18n, Button, Modal, Link, ConditionalWrapper, Typography } from '@shopgate/engage/components';
5
+ import { Grid, I18n, Modal, Link, ConditionalWrapper, Typography } from '@shopgate/engage/components';
6
+ import { Button } from '@shopgate/engage/components/v2';
6
7
  import { appConfig } from '@shopgate/engage';
7
8
  import connect from "./connector";
8
9
  import cookieImage from "./tracking-opt-in.svg";
@@ -164,21 +165,19 @@ const CookieConsentModal = ({
164
165
  className: classes.buttonWrapper,
165
166
  children: [/*#__PURE__*/_jsx(Button, {
166
167
  onClick: handleAcceptAllCookies,
167
- type: "primary",
168
+ color: "secondary",
168
169
  className: cx(classes.button, 'cookie-consent-modal__button-accept-all'),
169
170
  children: /*#__PURE__*/_jsx(I18n.Text, {
170
171
  string: modalButtonAcceptAll || 'cookieConsentModal.buttonAcceptAll'
171
172
  })
172
173
  }), showRequiredCookiesButton ? /*#__PURE__*/_jsx(Button, {
173
174
  onClick: handleAcceptRequiredCookies,
174
- type: "simple",
175
175
  className: cx(classes.button, 'cookie-consent-modal__button-accept-required'),
176
176
  children: /*#__PURE__*/_jsx(I18n.Text, {
177
177
  string: modalButtonOnlyRequired || 'cookieConsentModal.modalButtonOnlyRequired'
178
178
  })
179
179
  }) : null, /*#__PURE__*/_jsx(Button, {
180
180
  onClick: handleOpenPrivacySettings,
181
- type: "simple",
182
181
  className: cx(classes.button, 'cookie-consent-modal__button-open-settings'),
183
182
  children: /*#__PURE__*/_jsx(I18n.Text, {
184
183
  string: modalButtonConfigureSettings || 'cookieConsentModal.buttonConfigure'
@@ -1,5 +1,6 @@
1
1
  import React, { useCallback, useState } from 'react';
2
- import { Button, Grid, I18n, Link, Switch, ConditionalWrapper } from '@shopgate/engage/components';
2
+ import { Grid, I18n, Link, Switch, ConditionalWrapper } from '@shopgate/engage/components';
3
+ import { Button } from '@shopgate/engage/components/v2';
3
4
  import PropTypes from 'prop-types';
4
5
  import { makeStyles } from '@shopgate/engage/styles';
5
6
  import { appConfig } from '@shopgate/engage';
@@ -148,7 +149,7 @@ const PrivacySettings = ({
148
149
  className: classes.buttonWrapper,
149
150
  children: [/*#__PURE__*/_jsx(Button, {
150
151
  onClick: () => handleAcceptAllCookies(),
151
- type: "primary",
152
+ color: "secondary",
152
153
  className: cx(classes.button, 'privacy-settings__button-accept-all'),
153
154
  children: /*#__PURE__*/_jsx(I18n.Text, {
154
155
  string: "cookieConsentModal.buttonAcceptAll"
@@ -158,7 +159,6 @@ const PrivacySettings = ({
158
159
  comfortCookiesAccepted: areComfortCookiesSelected,
159
160
  statisticsCookiesAccepted: areStatisticsCookiesSelected
160
161
  }),
161
- type: "simple",
162
162
  className: cx(classes.button, 'privacy-settings__button-accept-selected'),
163
163
  children: /*#__PURE__*/_jsx(I18n.Text, {
164
164
  string: "cookieConsentModal.modalButtonConfirmSelected"
@@ -1,6 +0,0 @@
1
- import { connect } from 'react-redux';
2
- import { historyReset } from '@shopgate/pwa-common/actions/router';
3
- const mapDispatchToProps = {
4
- historyReset
5
- };
6
- export default connect(null, mapDispatchToProps);
@@ -1,71 +0,0 @@
1
- import "core-js/modules/es.regexp.flags.js";
2
- import React from 'react';
3
- import PropTypes from 'prop-types';
4
- import { I18n, SurroundPortals, RippleButton } from '@shopgate/engage/components';
5
- import { makeStyles } from '@shopgate/engage/styles';
6
- import { CART_CHECKOUT_BUTTON } from '@shopgate/pwa-common-commerce/cart/constants/Portals';
7
- import { FulfillmentSheet, STAGE_RESERVE_FORM } from "../../../locations";
8
- import { CartContext } from "../../cart.context";
9
- import connect from "./PaymentBarReserveButton.connector";
10
- import { jsx as _jsx } from "react/jsx-runtime";
11
- const useStyles = makeStyles()(theme => ({
12
- button: {
13
- width: '100%',
14
- background: theme.components.ctaButton.background,
15
- color: `${theme.contrastColor(theme.components.ctaButton.background)}!important`
16
- },
17
- disabledButton: {
18
- width: '100%',
19
- background: theme.palette.action.disabledBackground,
20
- color: `${theme.contrastColor(theme.palette.action.disabledBackground)}!important`
21
- }
22
- }));
23
-
24
- /**
25
- * The reserve button component.
26
- * @param {Object} props The component props.
27
- * @param {Function} props.historyReset The history reset function.
28
- * @return {JSX.Element} The rendered component.
29
- */
30
- const PaymentBarReserveButton = ({
31
- historyReset
32
- }) => {
33
- const {
34
- classes
35
- } = useStyles();
36
- const {
37
- flags: {
38
- orderable
39
- }
40
- } = React.useContext(CartContext);
41
-
42
- /**
43
- * Handles the click on the button.
44
- */
45
- const handleClick = React.useCallback(() => {
46
- FulfillmentSheet.open({
47
- stage: STAGE_RESERVE_FORM,
48
- callback: (_location, _product, orderSuccess) => {
49
- if (orderSuccess === true) {
50
- historyReset();
51
- }
52
- }
53
- });
54
- }, [historyReset]);
55
- return /*#__PURE__*/_jsx(SurroundPortals, {
56
- portalName: CART_CHECKOUT_BUTTON,
57
- portalProps: {
58
- isActive: orderable
59
- },
60
- children: /*#__PURE__*/_jsx(RippleButton, {
61
- onClick: handleClick,
62
- disabled: !orderable,
63
- type: "regular",
64
- className: orderable ? classes.button : classes.disabledButton,
65
- children: /*#__PURE__*/_jsx(I18n.Text, {
66
- string: "cart.reserve"
67
- })
68
- })
69
- });
70
- };
71
- export default connect(PaymentBarReserveButton);
@@ -1,16 +0,0 @@
1
- import { connect } from 'react-redux';
2
- import { historyPush } from '@shopgate/pwa-common/actions/router/historyPush';
3
-
4
- /**
5
- * @param {Function} dispatch The redux dispatch function.
6
- * @return {Object} The extended component props.
7
- */
8
- const mapDispatchToProps = dispatch => ({
9
- openMap: url => dispatch(historyPush({
10
- pathname: url,
11
- state: {
12
- target: '_blank'
13
- }
14
- }))
15
- });
16
- export default connect(null, mapDispatchToProps);
@@ -1,52 +0,0 @@
1
- import React, { useMemo, useCallback } from 'react';
2
- import PropTypes from 'prop-types';
3
- import { i18n, generateGoogleMapsDirectionsUrl } from '@shopgate/engage/core';
4
- import { makeStyles } from '@shopgate/engage/styles';
5
- import { RippleButton } from '@shopgate/engage/components';
6
- import connect from "./StoreFinderGetDirectionsButton.connector";
7
- import { jsx as _jsx } from "react/jsx-runtime";
8
- const useStyles = makeStyles()(theme => ({
9
- container: {},
10
- button: {
11
- width: '100%',
12
- background: `${theme.palette.primary.main} !important`,
13
- color: `${theme.palette.primary.contrastText} !important`,
14
- fontSize: `${theme.typography.body2.fontSize} !important`
15
- }
16
- }));
17
-
18
- /**
19
- * @param {Object} props The component props
20
- * @returns {JSX}
21
- */
22
- const StoreFinderGetDirectionsButton = ({
23
- address,
24
- openMap,
25
- className
26
- }) => {
27
- const {
28
- classes,
29
- cx
30
- } = useStyles();
31
- const url = useMemo(() => address && generateGoogleMapsDirectionsUrl(address), [address]);
32
- const handleClick = useCallback(() => {
33
- openMap(url);
34
- }, [openMap, url]);
35
- if (!address) {
36
- return null;
37
- }
38
- return /*#__PURE__*/_jsx("div", {
39
- className: cx(classes.container, className),
40
- children: /*#__PURE__*/_jsx(RippleButton, {
41
- onClick: handleClick,
42
- className: classes.button,
43
- children: i18n.text('locations.get_directions')
44
- })
45
- });
46
- };
47
- StoreFinderGetDirectionsButton.defaultProps = {
48
- address: null,
49
- openMap: () => {},
50
- className: null
51
- };
52
- export default connect(StoreFinderGetDirectionsButton);