@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
@@ -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";
@@ -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":"AAgCA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,QAAO,OAAO,CAAC,IAAI,CAgF1C,CAAC"}
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 ColorSchemeName, type PaletteColorsWithMain, type WithThemeProps, } from './theme';
2
+ export { ThemeProvider, createTheme, useActiveBreakpoint, useMediaQuery, useResponsiveValue, useTheme, useColorScheme, withTheme, type Theme, type ShadowSize, type ColorSchemeName, 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
@@ -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,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,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"}
@@ -203,6 +203,41 @@ export declare const componentsSchema: {
203
203
  readonly height: "";
204
204
  };
205
205
  };
206
+ readonly cards: {
207
+ readonly vars: {
208
+ readonly borderRadius: "";
209
+ readonly backgroundColor: "";
210
+ readonly borderWidth: "";
211
+ readonly borderColor: "";
212
+ readonly border: "";
213
+ readonly shadowColor: "";
214
+ };
215
+ };
216
+ readonly productCard: {
217
+ readonly vars: {
218
+ readonly padding: "";
219
+ readonly textPadding: "";
220
+ readonly imagePadding: "";
221
+ };
222
+ };
223
+ readonly tiles: {
224
+ readonly vars: {
225
+ readonly borderRadius: "";
226
+ readonly backgroundColor: "";
227
+ readonly borderWidth: "";
228
+ readonly borderColor: "";
229
+ readonly border: "";
230
+ readonly padding: "";
231
+ readonly textPadding: "";
232
+ readonly textPaddingTop: "";
233
+ readonly imagePadding: "";
234
+ };
235
+ };
236
+ readonly productImage: {
237
+ readonly vars: {
238
+ readonly borderRadius: "";
239
+ };
240
+ };
206
241
  };
207
242
  /**
208
243
  * Default component tokens.
@@ -213,6 +248,11 @@ export declare const componentsSchema: {
213
248
  * - functions get proper `Theme` typing
214
249
  */
215
250
  export declare const componentsDefaults: {
251
+ button: {
252
+ vars: {
253
+ borderRadius: string;
254
+ };
255
+ };
216
256
  border: {
217
257
  vars: {
218
258
  light: string;
@@ -313,6 +353,41 @@ export declare const componentsDefaults: {
313
353
  height: number;
314
354
  };
315
355
  };
356
+ cards: {
357
+ vars: {
358
+ borderRadius: string;
359
+ backgroundColor: (t: Theme) => string;
360
+ borderWidth: number;
361
+ borderColor: string;
362
+ border: string;
363
+ shadowColor: (t: Theme) => string;
364
+ };
365
+ };
366
+ productCard: {
367
+ vars: {
368
+ padding: number;
369
+ textPadding: number;
370
+ imagePadding: number;
371
+ };
372
+ };
373
+ tiles: {
374
+ vars: {
375
+ borderRadius: string;
376
+ backgroundColor: string;
377
+ borderWidth: number;
378
+ borderColor: string;
379
+ border: string;
380
+ padding: number;
381
+ textPadding: number;
382
+ textPaddingTop: string;
383
+ imagePadding: number;
384
+ };
385
+ };
386
+ productImage: {
387
+ vars: {
388
+ borderRadius: string;
389
+ };
390
+ };
316
391
  };
317
392
  /** Internal defaults type (must cover full schema). */
318
393
  export type ComponentsDefaults = ComponentsOverrideFromSchema<typeof componentsSchema, Theme>;
@@ -1 +1 @@
1
- {"version":3,"file":"createComponents.types.d.ts","sourceRoot":"","sources":["../../../../styles/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AAM,aAAa,GAAG,uBAAuB,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
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,GAC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BAAgB,EAAE,KAAK,CAAC,CAAC;AAG/D,MAAM,MAAM,iBAAiB,GAC3B,4BAA4B,CAAC,OAAO,gBAAgB,EAAE,KAAK,CAAC,CAAC;AAG/D,MAAM,MAAM,UAAU,GAAG,oBAAoB,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEvE,MAAM,MAAM,aAAa,GAAG,uBAAuB,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
@@ -190,6 +190,41 @@ export const componentsSchema = {
190
190
  vars: {
191
191
  height: ''
192
192
  }
193
+ },
194
+ cards: {
195
+ vars: {
196
+ borderRadius: '',
197
+ backgroundColor: '',
198
+ borderWidth: '',
199
+ borderColor: '',
200
+ border: '',
201
+ shadowColor: ''
202
+ }
203
+ },
204
+ productCard: {
205
+ vars: {
206
+ padding: '',
207
+ textPadding: '',
208
+ imagePadding: ''
209
+ }
210
+ },
211
+ tiles: {
212
+ vars: {
213
+ borderRadius: '',
214
+ backgroundColor: '',
215
+ borderWidth: '',
216
+ borderColor: '',
217
+ border: '',
218
+ padding: '',
219
+ textPadding: '',
220
+ textPaddingTop: '',
221
+ imagePadding: ''
222
+ }
223
+ },
224
+ productImage: {
225
+ vars: {
226
+ borderRadius: ''
227
+ }
193
228
  }
194
229
  };
195
230
 
@@ -202,6 +237,11 @@ export const componentsSchema = {
202
237
  * - functions get proper `Theme` typing
203
238
  */
204
239
  export const componentsDefaults = {
240
+ button: {
241
+ vars: {
242
+ borderRadius: 'var(--sg-shape-borderRadius, 4px)'
243
+ }
244
+ },
205
245
  border: {
206
246
  vars: {
207
247
  light: '#F2F2F2',
@@ -301,6 +341,41 @@ export const componentsDefaults = {
301
341
  vars: {
302
342
  height: 48
303
343
  }
344
+ },
345
+ cards: {
346
+ vars: {
347
+ borderRadius: 'var(--sg-shape-borderRadius)',
348
+ backgroundColor: t => t.palette.background.surface,
349
+ borderWidth: 0,
350
+ borderColor: 'transparent',
351
+ border: 'var(--sg-components-cards-borderWidth) solid var(--sg-components-cards-borderColor)',
352
+ shadowColor: t => t.palette.shadow
353
+ }
354
+ },
355
+ productCard: {
356
+ vars: {
357
+ padding: 0,
358
+ textPadding: 16,
359
+ imagePadding: 0
360
+ }
361
+ },
362
+ tiles: {
363
+ vars: {
364
+ borderRadius: 'var(--sg-shape-borderRadius)',
365
+ backgroundColor: 'transparent',
366
+ borderWidth: 0,
367
+ borderColor: 'transparent',
368
+ border: 'var(--sg-components-tiles-borderWidth) solid var(--sg-components-tiles-borderColor)',
369
+ padding: 0,
370
+ textPadding: 8,
371
+ textPaddingTop: 'max(var(--sg-components-tiles-textPadding), 16px)',
372
+ imagePadding: 0
373
+ }
374
+ },
375
+ productImage: {
376
+ vars: {
377
+ borderRadius: 'var(--sg-shape-borderRadius)'
378
+ }
304
379
  }
305
380
  };
306
381
 
@@ -1 +1 @@
1
- {"version":3,"file":"createCssVarsForColorSchemeThemes.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/createCssVarsForColorSchemeThemes.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAExD,OAAO,KAAK,EACV,iBAAiB,EAAE,SAAS,EAAmB,YAAY,EAC5D,MAAM,SAAS,CAAC;AAEjB,KAAK,wCAAwC,GAAG;IAC9C,sBAAsB,EAAE,sBAAsB,CAAC;CAChD,GAAG,IAAI,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;AAEvC,MAAM,MAAM,4CAA4C,GAAG;IACzD;;;OAGG;IACH,YAAY,EAAE,SAAS,GAAG;QAAE,IAAI,EAAE,SAAS,CAAA;KAAE,CAAC;IAC9C;;;;OAIG;IACH,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;CAC7C,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,iCAAiC,CACvD,YAAY,EAAE,iBAAiB,EAC/B,OAAO,EAAE,wCAAwC,GAChD,4CAA4C,CA6G9C"}
1
+ {"version":3,"file":"createCssVarsForColorSchemeThemes.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/createCssVarsForColorSchemeThemes.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAExD,OAAO,KAAK,EACV,iBAAiB,EAAE,SAAS,EAAmB,YAAY,EAC5D,MAAM,SAAS,CAAC;AAEjB,KAAK,wCAAwC,GAAG;IAC9C,sBAAsB,EAAE,sBAAsB,CAAC;CAChD,GAAG,IAAI,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;AAEvC,MAAM,MAAM,4CAA4C,GAAG;IACzD;;;OAGG;IACH,YAAY,EAAE,SAAS,GAAG;QAAE,IAAI,EAAE,SAAS,CAAA;KAAE,CAAC;IAC9C;;;;OAIG;IACH,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;CAC7C,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,iCAAiC,CACvD,YAAY,EAAE,iBAAiB,EAC/B,OAAO,EAAE,wCAAwC,GAChD,4CAA4C,CAgH9C"}
@@ -1,3 +1,4 @@
1
+ import "core-js/modules/es.array.includes.js";
1
2
  import "core-js/modules/es.array.reduce.js";
2
3
  import merge from 'lodash/merge';
3
4
  import omit from 'lodash/omit';
@@ -35,7 +36,10 @@ export default function createCssVarsForColorSchemeThemes(colorSchemes, options)
35
36
  varsWithDefaults,
36
37
  varNames
37
38
  } = cssVarsColorAugmentation(cssVarsParser(rest, {
38
- prefix: cssVarPrefix
39
+ prefix: cssVarPrefix,
40
+ // Keep as literal strings, not `:root` vars, so their inline `var(--sg-palette-shadow)`
41
+ // resolves on the element using the shadow (recolorable) instead of freezing against `:root`.
42
+ shouldSkipGeneratingVar: keys => ['shadows', 'shadowSizes'].includes(keys[0])
39
43
  // @ts-expect-error - We are sure about the type here
40
44
  }), rest, cssVarPrefix);
41
45
 
@@ -151,6 +151,10 @@ export declare const paletteSchema: {
151
151
  readonly disabled: "#808080";
152
152
  readonly disabledBackground: "#CCCCCC";
153
153
  };
154
+ /**
155
+ * Color for the box-shadow.
156
+ */
157
+ readonly shadow: "#000000";
154
158
  };
155
159
  /**
156
160
  * Additional settings for the palette
@@ -1 +1 @@
1
- {"version":3,"file":"createPalette.types.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/createPalette.types.ts"],"names":[],"mappings":"AAAA,KAAK,gBAAgB,GACjB,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GACxD,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAEtC,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;AAE5D;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,KAAK,6BAA6B,GAAG,QAAQ,CAAC,qBAAqB,CAAC,CAAA;AAEpE,KAAK,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;AAEzD;;;;;;;;;;;;GAYG;AACH,KAAK,iBAAiB,CAAC,CAAC,IACtB,CAAC,SAAS,IAAI,GAAG,MAAM,GACrB,CAAC,SAAS,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,SAAS,iBAAiB,CAAC,CAAC,CAAC,EAAE,GAChE,CAAC,SAAS,MAAM,GAChB,CAAC,M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AAU,wBAAwB;IAChC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAGD,MAAM,MAAM,cAAc,GAAG,sBAAsB,CAAC,OAAO,aAAa,CAAC,GACrE,wBAAwB,CAAC;AAG7B,MAAM,MAAM,OAAO,GAAG,iBAAiB,CAAC,OAAO,aAAa,CAAC,CAAA"}
1
+ {"version":3,"file":"createPalette.types.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/createPalette.types.ts"],"names":[],"mappings":"AAAA,KAAK,gBAAgB,GACjB,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GACxD,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAEtC,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;AAE5D;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,KAAK,6BAA6B,GAAG,QAAQ,CAAC,qBAAqB,CAAC,CAAA;AAEpE,KAAK,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;AAEzD;;;;;;;;;;;;GAYG;AACH,KAAK,iBAAiB,CAAC,CAAC,IACtB,CAAC,SAAS,IAAI,GAAG,MAAM,GACrB,CAAC,SAAS,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,SAAS,iBAAiB,CAAC,CAAC,CAAC,EAAE,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;;;;;IAKH;;OAEG;;CAEK,CAAC;AAEX;;GAEG;AACH,UAAU,wBAAwB;IAChC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAGD,MAAM,MAAM,cAAc,GAAG,sBAAsB,CAAC,OAAO,aAAa,CAAC,GACrE,wBAAwB,CAAC;AAG7B,MAAM,MAAM,OAAO,GAAG,iBAAiB,CAAC,OAAO,aAAa,CAAC,CAAA"}
@@ -119,7 +119,11 @@ export const paletteSchema = {
119
119
  action: {
120
120
  disabled: '#808080',
121
121
  disabledBackground: '#CCCCCC'
122
- }
122
+ },
123
+ /**
124
+ * Color for the box-shadow.
125
+ */
126
+ shadow: '#000000'
123
127
  };
124
128
 
125
129
  /**
@@ -1,4 +1,7 @@
1
1
  export interface Shape {
2
+ /**
3
+ * The app wide corner style. Every rounded surface derives from it.
4
+ */
2
5
  borderRadius: number | string;
3
6
  }
4
7
  export type ShapeOptions = Partial<Shape>;
@@ -1 +1 @@
1
- {"version":3,"file":"createShape.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/createShape.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IACpB,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"}
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
@@ -1 +1 @@
1
- {"version":3,"file":"createThemeFromColorScheme.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/createThemeFromColorScheme.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAcpE;;;;;GAKG;AACH,eAAO,MAAM,KAAK,GAChB,OAAO,MAAM,EACb,aAAa,MAAM,GAAG,MAAM,KAC3B,MAAkH,CAAC;AAEtH;;;;;GAKG;AACH,eAAO,MAAM,OAAO,GAClB,OAAO,MAAM,EACb,cAAa,MAAM,GAAG,MAAY,KACjC,MAAuF,CAAC;AAE3F;;;;;GAKG;AACH,eAAO,MAAM,MAAM,GACjB,OAAO,MAAM,EACb,cAAa,MAAM,GAAG,MAAY,KACjC,MAAuF,CAAC;AAE3F;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GACxB,OAAO,MAAM,KACZ,MAA4D,CAAC;AAEhE;;;;GAIG;AACH,QAAA,MAAM,0BAA0B,GAAI,aAAa,kBAAkB,KAAG,gBA2BrE,CAAC;AAEF,eAAe,0BAA0B,CAAC"}
1
+ {"version":3,"file":"createThemeFromColorScheme.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/createThemeFromColorScheme.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAcpE;;;;;GAKG;AACH,eAAO,MAAM,KAAK,GAChB,OAAO,MAAM,EACb,aAAa,MAAM,GAAG,MAAM,KAC3B,MAAkH,CAAC;AAEtH;;;;;GAKG;AACH,eAAO,MAAM,OAAO,GAClB,OAAO,MAAM,EACb,cAAa,MAAM,GAAG,MAAY,KACjC,MAAuF,CAAC;AAE3F;;;;;GAKG;AACH,eAAO,MAAM,MAAM,GACjB,OAAO,MAAM,EACb,cAAa,MAAM,GAAG,MAAY,KACjC,MAAuF,CAAC;AAE3F;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GACxB,OAAO,MAAM,KACZ,MAA4D,CAAC;AAEhE;;;;;;GAMG;AACH,QAAA,MAAM,0BAA0B,GAC9B,aAAa,kBAAkB,EAC/B,eAAe,MAAM,KACpB,gBA4BF,CAAC;AAEF,eAAe,0BAA0B,CAAC"}
@@ -2,7 +2,7 @@ import createPalette from "./createPalette";
2
2
  import createTypography from "./createTypography";
3
3
  import createComponents from "./createComponents";
4
4
  import createShape from "./createShape";
5
- import shadows from "./shadows";
5
+ import shadows, { shadowSizes } from "./shadows";
6
6
  /**
7
7
  * Calculates the percentage value for a given coefficient, which can be a number or a string representing a CSS calculation.
8
8
  * @param coefficient The coefficient to convert, either a number or a string.
@@ -50,9 +50,11 @@ export const contrastColor = color => `oklch(from ${color} var(--__l) 0 h / var(
50
50
  /**
51
51
  * Creates a theme object for a given color scheme (light or dark).
52
52
  * @param colorScheme The color scheme options.
53
+ * @param cssVarPrefix The theme's css variable prefix. Typography references some of the properties
54
+ * that are generated from it later, so it has to compose the same names.
53
55
  * @returns A theme object for the given color scheme.
54
56
  */
55
- const createThemeFromColorScheme = colorScheme => {
57
+ const createThemeFromColorScheme = (colorScheme, cssVarPrefix) => {
56
58
  const {
57
59
  palette: paletteInput = {},
58
60
  typography: typographyInput = {},
@@ -60,7 +62,7 @@ const createThemeFromColorScheme = colorScheme => {
60
62
  shape: shapeInput = {}
61
63
  } = colorScheme;
62
64
  const palette = createPalette(paletteInput);
63
- const typography = createTypography(palette, typographyInput);
65
+ const typography = createTypography(palette, typographyInput, cssVarPrefix);
64
66
  const components = createComponents(componentsInput);
65
67
  const shape = createShape(shapeInput);
66
68
  const theme = {
@@ -69,6 +71,7 @@ const createThemeFromColorScheme = colorScheme => {
69
71
  components,
70
72
  shape,
71
73
  shadows,
74
+ shadowSizes,
72
75
  alpha,
73
76
  lighten,
74
77
  darken,
@@ -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;