@shopgate/engage 7.32.0-beta.1 → 7.32.0-beta.11

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 (623) hide show
  1. package/README.md +0 -1
  2. package/account/components/Profile/Profile.provider.d.ts +1 -1
  3. package/account/components/Profile/ProfileAddressBook.d.ts.map +1 -1
  4. package/account/components/Profile/ProfileAddressBook.js +13 -22
  5. package/account/components/Profile/ProfileAddressCard.d.ts.map +1 -1
  6. package/account/components/Profile/ProfileAddressCard.js +9 -18
  7. package/account/components/Profile/ProfileForm.d.ts.map +1 -1
  8. package/account/components/Profile/ProfileForm.js +15 -42
  9. package/account/components/ProfileContact/ProfileContact.js +13 -21
  10. package/admin-preview/components/FrontendSettingsPreviewBridge/FrontendSettingsPreviewBridge.d.ts +2 -1
  11. package/admin-preview/components/FrontendSettingsPreviewBridge/FrontendSettingsPreviewBridge.d.ts.map +1 -1
  12. package/admin-preview/components/FrontendSettingsPreviewBridge/FrontendSettingsPreviewBridge.js +61 -5
  13. package/admin-preview/components/FrontendSettingsPreviewBridge/helpers.d.ts +7 -1
  14. package/admin-preview/components/FrontendSettingsPreviewBridge/helpers.d.ts.map +1 -1
  15. package/admin-preview/components/FrontendSettingsPreviewBridge/helpers.js +14 -2
  16. package/admin-preview/components/FrontendSettingsPreviewBridge/types.d.ts +15 -2
  17. package/admin-preview/components/FrontendSettingsPreviewBridge/types.d.ts.map +1 -1
  18. package/admin-preview/constants/index.d.ts +0 -12
  19. package/admin-preview/constants/index.d.ts.map +1 -1
  20. package/admin-preview/constants/index.js +0 -16
  21. package/admin-preview/helpers/_internal/detection.d.ts +53 -0
  22. package/admin-preview/helpers/_internal/detection.d.ts.map +1 -0
  23. package/admin-preview/helpers/_internal/detection.js +93 -0
  24. package/admin-preview/helpers/index.d.ts +7 -0
  25. package/admin-preview/helpers/index.d.ts.map +1 -1
  26. package/admin-preview/helpers/index.js +12 -4
  27. package/admin-preview/initialization/_internal/initialFrontendSettings.d.ts +32 -0
  28. package/admin-preview/initialization/_internal/initialFrontendSettings.d.ts.map +1 -0
  29. package/admin-preview/initialization/_internal/initialFrontendSettings.js +43 -0
  30. package/admin-preview/initialization/awaitInitialFrontendSettings.d.ts +22 -0
  31. package/admin-preview/initialization/awaitInitialFrontendSettings.d.ts.map +1 -0
  32. package/admin-preview/initialization/awaitInitialFrontendSettings.js +84 -0
  33. package/back-in-stock/components/BackInStockButton/index.js +5 -5
  34. package/back-in-stock/components/Subscriptions/components/Subscription/index.js +2 -5
  35. package/cart/components/CartItem/CartItemProductLayout.js +2 -1
  36. package/cart/components/CartItem/CartItemProductLayoutWide.js +2 -2
  37. package/cart/components/CartItem/CartItemProductLayoutWideRemoveItem.js +7 -14
  38. package/cart/components/CartItem/CartItemProductProvider.connector.js +0 -2
  39. package/cart/components/CartItem/CartItemProductProvider.js +3 -30
  40. package/cart/components/CartItem/CartItemProductProvider.types.js +0 -1
  41. package/cart/components/CartItem/CartItemQuantityPicker.js +1 -0
  42. package/cart/components/CartItems/CartItemCardReservationLabelChangeStore.js +6 -24
  43. package/cart/components/CartItems/CartItems.js +8 -10
  44. package/cart/components/CartItems/CartItemsSubstitution.js +3 -2
  45. package/cart/components/CartSummaryWide/CartSummaryWide.js +2 -2
  46. package/cart/components/CartSummaryWide/CartSummaryWideCheckoutButton.js +9 -23
  47. package/cart/components/PaymentBar/PaymentBarCheckoutButton.js +8 -30
  48. package/cart/components/PaymentBar/PaymentBarContent.js +1 -1
  49. package/cart/components/PaymentBar/testUtils/mockFactories.js +4 -11
  50. package/category/components/CategoryImage/index.js +24 -17
  51. package/checkout/components/AddressBook/AddressList.js +14 -23
  52. package/checkout/components/Checkout/CheckoutActions.js +4 -3
  53. package/checkout/components/Checkout/CheckoutAddress.js +8 -0
  54. package/checkout/components/Checkout/CheckoutSection.js +6 -2
  55. package/checkout/components/CheckoutConfirmation/CheckoutConfirmation.js +6 -7
  56. package/checkout/components/ResponsiveBackButton/ResponsiveBackButton.js +7 -17
  57. package/components/Badge/Badge.d.ts +30 -0
  58. package/components/Badge/Badge.d.ts.map +1 -0
  59. package/components/Badge/Badge.js +48 -0
  60. package/components/Badge/index.d.ts +3 -0
  61. package/components/Badge/index.d.ts.map +1 -0
  62. package/components/Badge/index.js +1 -0
  63. package/components/Card/Card.d.ts +27 -0
  64. package/components/Card/Card.d.ts.map +1 -0
  65. package/components/Card/Card.js +57 -0
  66. package/components/Card/index.d.ts +4 -0
  67. package/components/Card/index.d.ts.map +1 -0
  68. package/components/Card/index.js +2 -0
  69. package/components/Card/useCardAppearance.d.ts +11 -0
  70. package/components/Card/useCardAppearance.d.ts.map +1 -0
  71. package/components/Card/useCardAppearance.js +22 -0
  72. package/components/ChipLayout/index.js +2 -4
  73. package/components/Logo/index.d.ts.map +1 -1
  74. package/components/Logo/index.js +3 -6
  75. package/components/NavigationHandler/connector.js +1 -1
  76. package/components/NavigationHandler/index.d.ts +2 -2
  77. package/components/Paper/Paper.d.ts +48 -0
  78. package/components/Paper/Paper.d.ts.map +1 -0
  79. package/components/Paper/Paper.js +64 -0
  80. package/components/Paper/index.d.ts +3 -0
  81. package/components/Paper/index.d.ts.map +1 -0
  82. package/components/Paper/index.js +1 -0
  83. package/components/PickerUtilize/index.d.ts +2 -1
  84. package/components/PickerUtilize/index.d.ts.map +1 -1
  85. package/components/RadioCard/RadioCard.d.ts.map +1 -1
  86. package/components/RadioCard/RadioCard.js +2 -1
  87. package/components/SheetList/components/Item/index.js +8 -8
  88. package/components/Tabs/components/Tab.d.ts.map +1 -1
  89. package/components/Tabs/components/Tab.js +14 -16
  90. package/components/Typography/Typography.d.ts +1 -1
  91. package/components/View/components/Above/index.d.ts.map +1 -1
  92. package/components/View/components/Above/index.js +3 -1
  93. package/components/View/components/Below/index.d.ts.map +1 -1
  94. package/components/View/components/Below/index.js +3 -1
  95. package/components/View/components/Content/index.d.ts +2 -1
  96. package/components/View/components/Content/index.d.ts.map +1 -1
  97. package/components/View/components/Content/index.js +4 -1
  98. package/components/constants.d.ts +6 -0
  99. package/components/constants.d.ts.map +1 -0
  100. package/components/index.d.ts +5 -1
  101. package/components/index.d.ts.map +1 -1
  102. package/components/index.js +4 -2
  103. package/components/v2/Button/Button.d.ts +24 -13
  104. package/components/v2/Button/Button.d.ts.map +1 -1
  105. package/components/v2/Button/Button.js +139 -41
  106. package/components/v2/ButtonBase/ButtonBase.d.ts +50 -10
  107. package/components/v2/ButtonBase/ButtonBase.d.ts.map +1 -1
  108. package/components/v2/ButtonBase/ButtonBase.js +192 -17
  109. package/components/v2/ButtonBase/Ripple.d.ts +2 -1
  110. package/components/v2/ButtonBase/Ripple.d.ts.map +1 -1
  111. package/components/v2/ButtonBase/hooks.d.ts +0 -1
  112. package/components/v2/ButtonBase/hooks.d.ts.map +1 -1
  113. package/components/v2/ButtonBase/hooks.js +36 -12
  114. package/components/v2/ButtonGroup/ButtonGroup.d.ts +11 -5
  115. package/components/v2/ButtonGroup/ButtonGroup.d.ts.map +1 -1
  116. package/components/v2/ButtonGroup/ButtonGroup.js +49 -26
  117. package/components/v2/CircularProgress/CircularProgress.d.ts.map +1 -1
  118. package/components/v2/CircularProgress/CircularProgress.js +10 -5
  119. package/core/helpers/getFullImageSource.d.ts +5 -1
  120. package/core/helpers/getFullImageSource.d.ts.map +1 -1
  121. package/core/helpers/getFullImageSource.js +30 -14
  122. package/core/helpers/i18n.d.ts +4 -0
  123. package/core/helpers/i18n.d.ts.map +1 -1
  124. package/core/helpers/i18n.js +3 -0
  125. package/core/hooks/events/appEvents.d.ts +31 -46
  126. package/core/hooks/events/appEvents.d.ts.map +1 -0
  127. package/core/hooks/events/appEvents.js +26 -29
  128. package/core/hooks/events/index.d.ts +4 -4
  129. package/core/hooks/events/index.d.ts.map +1 -1
  130. package/core/hooks/events/useLongPress.d.ts +55 -58
  131. package/core/hooks/events/useLongPress.d.ts.map +1 -0
  132. package/core/hooks/events/useLongPress.js +23 -16
  133. package/core/hooks/events/usePressHandler.d.ts +32 -21
  134. package/core/hooks/events/usePressHandler.d.ts.map +1 -1
  135. package/core/hooks/events/usePressHandler.js +12 -10
  136. package/core/hooks/events/useScrollDirectionChange.d.ts +72 -61
  137. package/core/hooks/events/useScrollDirectionChange.d.ts.map +1 -0
  138. package/core/hooks/events/useScrollDirectionChange.js +36 -43
  139. package/core/hooks/html/useLoadImage.d.ts +3 -3
  140. package/core/hooks/html/useLoadImage.d.ts.map +1 -1
  141. package/core/hooks/html/useLoadImage.js +2 -2
  142. package/core/hooks/useLocalStorage.d.ts +8 -0
  143. package/core/hooks/useLocalStorage.d.ts.map +1 -1
  144. package/core/hooks/useLocalStorage.js +22 -15
  145. package/core/hooks/useNavigation.d.ts +10 -2
  146. package/core/hooks/useNavigation.d.ts.map +1 -1
  147. package/core/hooks/useNavigation.js +1 -2
  148. package/core/initialization/fetchSettings.d.ts +12 -0
  149. package/core/initialization/fetchSettings.d.ts.map +1 -0
  150. package/core/initialization/fetchSettings.js +134 -0
  151. package/core/initialization/index.d.ts +33 -2
  152. package/core/initialization/index.d.ts.map +1 -1
  153. package/core/initialization/index.js +44 -103
  154. package/core/router/conductor.d.ts +9 -0
  155. package/core/router/helpers.d.ts +28 -15
  156. package/core/router/helpers.d.ts.map +1 -1
  157. package/core/router/helpers.js +8 -8
  158. package/development/action-creators/index.d.ts +3 -0
  159. package/development/action-creators/index.d.ts.map +1 -0
  160. package/development/action-creators/settings.d.ts +45 -0
  161. package/development/action-creators/settings.d.ts.map +1 -0
  162. package/development/action-creators/settings.js +21 -10
  163. package/development/action-creators/storage.d.ts +17 -0
  164. package/development/action-creators/storage.d.ts.map +1 -0
  165. package/development/action-creators/storage.js +7 -4
  166. package/development/components/ClientInformation/ClientInformation.d.ts +6 -0
  167. package/development/components/ClientInformation/ClientInformation.d.ts.map +1 -0
  168. package/development/components/ClientInformation/ClientInformation.js +7 -4
  169. package/development/components/ClientInformation/actions.d.ts +6 -0
  170. package/development/components/ClientInformation/actions.d.ts.map +1 -0
  171. package/development/components/ClientInformation/actions.js +1 -1
  172. package/development/components/ClientInformation/index.d.ts +2 -0
  173. package/development/components/ClientInformation/index.d.ts.map +1 -0
  174. package/development/components/DevelopmentSettings/DevelopmentSettings.d.ts +16 -0
  175. package/development/components/DevelopmentSettings/DevelopmentSettings.d.ts.map +1 -0
  176. package/development/components/DevelopmentSettings/DevelopmentSettings.js +43 -30
  177. package/development/components/DevelopmentSettings/index.d.ts +2 -0
  178. package/development/components/DevelopmentSettings/index.d.ts.map +1 -0
  179. package/development/components/DevelopmentTools/DevelopmentTools.d.ts +10 -0
  180. package/development/components/DevelopmentTools/DevelopmentTools.d.ts.map +1 -0
  181. package/development/components/DevelopmentTools/DevelopmentTools.js +8 -8
  182. package/development/components/DevelopmentTools/Shortcuts.d.ts +6 -0
  183. package/development/components/DevelopmentTools/Shortcuts.d.ts.map +1 -0
  184. package/development/components/DevelopmentTools/Shortcuts.js +0 -1
  185. package/development/components/DevelopmentTools/hooks.d.ts +8 -0
  186. package/development/components/DevelopmentTools/hooks.d.ts.map +1 -0
  187. package/development/components/DevelopmentTools/hooks.js +2 -3
  188. package/development/components/DevelopmentTools/index.d.ts +2 -0
  189. package/development/components/DevelopmentTools/index.d.ts.map +1 -0
  190. package/development/components/SimulatedInsets/SimulatedInsetBottom.d.ts +7 -0
  191. package/development/components/SimulatedInsets/SimulatedInsetBottom.d.ts.map +1 -0
  192. package/development/components/SimulatedInsets/SimulatedInsetBottom.js +4 -9
  193. package/development/components/SimulatedInsets/SimulatedInsetTop.d.ts +7 -0
  194. package/development/components/SimulatedInsets/SimulatedInsetTop.d.ts.map +1 -0
  195. package/development/components/SimulatedInsets/SimulatedInsetTop.js +4 -9
  196. package/development/components/SimulatedInsets/SimulatedInsets.d.ts +13 -0
  197. package/development/components/SimulatedInsets/SimulatedInsets.d.ts.map +1 -0
  198. package/development/components/SimulatedInsets/SimulatedInsets.js +2 -7
  199. package/development/components/SimulatedInsets/index.d.ts +2 -0
  200. package/development/components/SimulatedInsets/index.d.ts.map +1 -0
  201. package/development/components/SimulatedInsets/types.d.ts +15 -0
  202. package/development/components/SimulatedInsets/types.d.ts.map +1 -0
  203. package/development/components/SimulatedInsets/types.js +1 -0
  204. package/development/components/index.d.ts +3 -0
  205. package/development/components/index.d.ts.map +1 -0
  206. package/development/constants/actionTypes.d.ts +6 -0
  207. package/development/constants/actionTypes.d.ts.map +1 -0
  208. package/development/constants/actionTypes.js +2 -1
  209. package/development/constants/index.d.ts +2 -0
  210. package/development/constants/index.d.ts.map +1 -0
  211. package/development/reducers/index.d.ts +24 -0
  212. package/development/reducers/index.d.ts.map +1 -0
  213. package/development/reducers/settings.d.ts +17 -0
  214. package/development/reducers/settings.d.ts.map +1 -0
  215. package/development/reducers/settings.js +48 -35
  216. package/development/reducers/storage.d.ts +17 -0
  217. package/development/reducers/storage.d.ts.map +1 -0
  218. package/development/reducers/storage.js +24 -24
  219. package/development/selectors/index.d.ts +3 -0
  220. package/development/selectors/index.d.ts.map +1 -0
  221. package/development/selectors/settings.d.ts +52 -0
  222. package/development/selectors/settings.d.ts.map +1 -0
  223. package/development/selectors/settings.js +21 -11
  224. package/development/selectors/storage.d.ts +10 -0
  225. package/development/selectors/storage.d.ts.map +1 -0
  226. package/development/selectors/storage.js +6 -18
  227. package/development/streams/index.d.ts +2 -0
  228. package/development/streams/index.d.ts.map +1 -0
  229. package/development/streams/insets.d.ts +8 -0
  230. package/development/streams/insets.d.ts.map +1 -0
  231. package/development/streams/insets.js +1 -3
  232. package/development/subscriptions/index.d.ts +15 -0
  233. package/development/subscriptions/index.d.ts.map +1 -0
  234. package/development/subscriptions/index.js +6 -2
  235. package/development/types/development.d.ts +68 -0
  236. package/development/types/development.d.ts.map +1 -0
  237. package/development/types/development.js +1 -0
  238. package/development/types/index.d.ts +2 -0
  239. package/development/types/index.d.ts.map +1 -0
  240. package/development/types/index.js +1 -0
  241. package/favorites/components/FavoriteButtonWide/FavoriteButtonWide.js +7 -17
  242. package/favorites/components/Item/Item.d.ts +1 -1
  243. package/favorites/components/Item/Item.d.ts.map +1 -1
  244. package/favorites/components/Item/Item.js +7 -7
  245. package/favorites/components/List/List.d.ts +1 -1
  246. package/favorites/components/List/List.d.ts.map +1 -1
  247. package/favorites/components/List/List.js +0 -1
  248. package/favorites/components/List/ListContent.js +4 -5
  249. package/favorites/components/Lists/Lists.js +17 -6
  250. package/filter/components/FilterPageContent/components/ApplyButton/index.js +8 -10
  251. package/filter/components/FilterPageContent/components/ResetButton/index.js +8 -6
  252. package/filter/components/PriceSlider/index.js +6 -1
  253. package/locations/components/ChangeLocationButton/ChangeLocationButton.js +10 -14
  254. package/locations/components/FulfillmentSheet/FulfillmentSheetContent.js +4 -8
  255. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotDialog.js +4 -8
  256. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcher.js +1 -1
  257. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcherBar.js +9 -18
  258. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcherDefault.js +10 -10
  259. package/locations/components/GlobalLocationSwitcher/GlobalLocationSwitcherBar.js +9 -19
  260. package/locations/components/GlobalLocationSwitcher/GlobalLocationSwitcherDefault.js +9 -10
  261. package/locations/components/ReserveForm/ReserveForm.js +6 -7
  262. package/locations/components/StoreDetails/components/GetDirectionsButton.js +2 -4
  263. package/locations/components/StoreDetails/components/StoreDetails.js +5 -10
  264. package/locations/components/StoreDetails/components/StoresNearbyListItem.js +13 -21
  265. package/locations/components/StoreFinder/StoreFinderSelectLocationButton.js +5 -11
  266. package/locations/components/StoreFinder/StoreFinderStoreInfoButton.js +5 -11
  267. package/locations/components/StoreList/StoreListProduct.js +2 -3
  268. package/locations/components/StoreList/StoreListSearch.js +1 -0
  269. package/locations/components/StoreList/StoreSelectLocationButton.js +5 -11
  270. package/login/components/ForgotPassword/ForgotPassword.js +11 -23
  271. package/mocks/date.js +31 -0
  272. package/mocks/index.js +3 -0
  273. package/mocks/pipelineRequest.js +1 -0
  274. package/mocks/subscriptions.js +1 -0
  275. package/orders/components/OrderDetails/OrderDetailsAuthenticate.js +5 -7
  276. package/orders/components/OrderHistory/OrderHistoryList.d.ts.map +1 -1
  277. package/orders/components/OrderHistory/OrderHistoryList.js +8 -9
  278. package/orders/components/OrderHistory/OrderHistoryTable.d.ts.map +1 -1
  279. package/orders/components/OrderHistory/OrderHistoryTable.js +4 -0
  280. package/package.json +12 -12
  281. package/page/components/NotFound.d.ts +7 -0
  282. package/page/components/NotFound.d.ts.map +1 -0
  283. package/page/components/NotFound.js +8 -8
  284. package/page/components/ResponsiveWidgetImage/ResponsiveWidgetImage.d.ts +52 -0
  285. package/page/components/ResponsiveWidgetImage/ResponsiveWidgetImage.d.ts.map +1 -0
  286. package/page/components/ResponsiveWidgetImage/ResponsiveWidgetImage.js +4 -4
  287. package/page/components/ResponsiveWidgetImage/index.d.ts +2 -0
  288. package/page/components/ResponsiveWidgetImage/index.d.ts.map +1 -0
  289. package/page/components/WidgetRichText/WidgetRichText.d.ts +25 -0
  290. package/page/components/WidgetRichText/WidgetRichText.d.ts.map +1 -0
  291. package/page/components/WidgetRichText/index.d.ts +2 -0
  292. package/page/components/WidgetRichText/index.d.ts.map +1 -0
  293. package/page/components/WidgetVideo/WidgetVideo.d.ts +43 -0
  294. package/page/components/WidgetVideo/WidgetVideo.d.ts.map +1 -0
  295. package/page/components/WidgetVideo/WidgetVideo.js +33 -39
  296. package/page/components/WidgetVideo/index.d.ts +2 -0
  297. package/page/components/WidgetVideo/index.d.ts.map +1 -0
  298. package/page/components/Widgets/Overlay.d.ts +17 -0
  299. package/page/components/Widgets/Overlay.d.ts.map +1 -0
  300. package/page/components/Widgets/Overlay.js +24 -38
  301. package/page/components/Widgets/Tooltip.d.ts +20 -0
  302. package/page/components/Widgets/Tooltip.d.ts.map +1 -0
  303. package/page/components/Widgets/Tooltip.js +6 -10
  304. package/page/components/Widgets/Widget.d.ts +32 -0
  305. package/page/components/Widgets/Widget.d.ts.map +1 -0
  306. package/page/components/Widgets/Widget.js +7 -18
  307. package/page/components/Widgets/WidgetContext.d.ts +32 -38
  308. package/page/components/Widgets/WidgetContext.d.ts.map +1 -0
  309. package/page/components/Widgets/WidgetContext.js +2 -8
  310. package/page/components/Widgets/WidgetProvider.d.ts +25 -0
  311. package/page/components/Widgets/WidgetProvider.d.ts.map +1 -0
  312. package/page/components/Widgets/WidgetProvider.js +5 -12
  313. package/page/components/Widgets/Widgets.d.ts +16 -0
  314. package/page/components/Widgets/Widgets.d.ts.map +1 -0
  315. package/page/components/Widgets/Widgets.js +5 -12
  316. package/page/components/Widgets/WidgetsPreviewContext.d.ts +21 -0
  317. package/page/components/Widgets/WidgetsPreviewContext.d.ts.map +1 -0
  318. package/page/components/Widgets/WidgetsPreviewContext.js +5 -7
  319. package/page/components/Widgets/WidgetsPreviewProvider.d.ts +18 -0
  320. package/page/components/Widgets/WidgetsPreviewProvider.d.ts.map +1 -0
  321. package/page/components/Widgets/WidgetsPreviewProvider.js +5 -6
  322. package/page/components/Widgets/constants.d.ts +5 -0
  323. package/page/components/Widgets/constants.d.ts.map +1 -0
  324. package/page/components/Widgets/constants.js +3 -1
  325. package/page/components/Widgets/events.d.ts +38 -0
  326. package/page/components/Widgets/events.d.ts.map +1 -0
  327. package/page/components/Widgets/events.js +8 -12
  328. package/page/components/Widgets/helpers.d.ts +50 -0
  329. package/page/components/Widgets/helpers.d.ts.map +1 -0
  330. package/page/components/Widgets/helpers.js +8 -13
  331. package/page/components/Widgets/hooks.d.ts +13 -0
  332. package/page/components/Widgets/hooks.d.ts.map +1 -0
  333. package/page/components/Widgets/hooks.js +13 -11
  334. package/page/components/Widgets/index.d.ts +3 -0
  335. package/page/components/Widgets/index.d.ts.map +1 -0
  336. package/page/components/Widgets/types.d.ts +111 -113
  337. package/page/components/Widgets/types.d.ts.map +1 -0
  338. package/page/components/Widgets/types.js +1 -0
  339. package/page/components/index.d.ts +5 -0
  340. package/page/components/index.d.ts.map +1 -0
  341. package/page/constants/actionTypes.d.ts +4 -0
  342. package/page/constants/actionTypes.d.ts.map +1 -0
  343. package/page/constants/index.d.ts +25 -0
  344. package/page/constants/index.d.ts.map +1 -0
  345. package/page/constants/index.js +5 -3
  346. package/page/helpers/index.d.ts +70 -62
  347. package/page/helpers/index.d.ts.map +1 -0
  348. package/page/helpers/index.js +31 -29
  349. package/page/hooks/index.d.ts +54 -53
  350. package/page/hooks/index.d.ts.map +1 -0
  351. package/page/hooks/index.js +20 -15
  352. package/page/selectors/index.d.ts +32 -0
  353. package/page/selectors/index.d.ts.map +1 -0
  354. package/page/widgets/Button/Button.js +2 -3
  355. package/page/widgets/NestedCategoryFilter/NestedCategoryFilter.js +8 -8
  356. package/page/widgets/ProductList/ProductList.js +18 -14
  357. package/page/widgets/ProductSlider/ProductSlider.js +1 -15
  358. package/page/widgets/Video/Video.d.ts +6 -0
  359. package/page/widgets/Video/Video.d.ts.map +1 -0
  360. package/page/widgets/Video/Video.js +0 -2
  361. package/page/widgets/Video/hooks.d.ts +53 -0
  362. package/page/widgets/Video/hooks.d.ts.map +1 -0
  363. package/page/widgets/Video/hooks.js +4 -12
  364. package/page/widgets/Video/index.d.ts +2 -0
  365. package/page/widgets/Video/index.d.ts.map +1 -0
  366. package/product/components/Description/index.js +0 -2
  367. package/product/components/FilterBar/components/Content/components/FilterButton/index.js +2 -6
  368. package/product/components/FilterBar/components/Content/components/Sort/index.js +1 -5
  369. package/product/components/Media/FeaturedMedia.js +7 -1
  370. package/product/components/Media/MediaImage.js +24 -23
  371. package/product/components/Media/MediaPlaceholder.js +4 -7
  372. package/product/components/MediaSlider/components/MediaImage/index.js +6 -2
  373. package/product/components/MediaSlider/constants.js +1 -12
  374. package/product/components/OrderQuantityHint/index.js +16 -1
  375. package/product/components/ProductCard/index.js +36 -23
  376. package/product/components/ProductGrid/components/Item/components/ItemDetails/index.js +12 -4
  377. package/product/components/ProductGrid/components/Item/components/ItemImage/index.js +3 -6
  378. package/product/components/ProductGrid/components/Item/components/ItemName/index.js +6 -1
  379. package/product/components/ProductGrid/components/Item/index.js +10 -2
  380. package/product/components/ProductGrid/components/Layout/index.js +19 -4
  381. package/product/components/ProductGrid/constants.d.ts +2 -0
  382. package/product/components/ProductGrid/constants.d.ts.map +1 -0
  383. package/product/components/ProductGrid/constants.js +1 -0
  384. package/product/components/ProductGrid/hooks.d.ts +11 -0
  385. package/product/components/ProductGrid/hooks.d.ts.map +1 -0
  386. package/product/components/ProductGrid/hooks.js +48 -0
  387. package/product/components/ProductGrid/index.js +3 -6
  388. package/product/components/ProductGridPrice/index.js +0 -1
  389. package/product/components/ProductImage/ProductImage.d.ts +42 -0
  390. package/product/components/ProductImage/ProductImage.d.ts.map +1 -0
  391. package/product/components/ProductImage/ProductImage.js +158 -0
  392. package/product/components/ProductImage/ProductImagePlaceholder.d.ts +23 -0
  393. package/product/components/ProductImage/ProductImagePlaceholder.d.ts.map +1 -0
  394. package/product/components/ProductImage/ProductImagePlaceholder.js +12 -17
  395. package/product/components/ProductImage/constants.d.ts +7 -0
  396. package/product/components/ProductImage/constants.d.ts.map +1 -0
  397. package/product/components/ProductImage/constants.js +6 -0
  398. package/product/components/ProductImage/hooks.d.ts +8 -0
  399. package/product/components/ProductImage/hooks.d.ts.map +1 -0
  400. package/product/components/ProductImage/hooks.js +32 -0
  401. package/product/components/ProductImage/index.d.ts +3 -0
  402. package/product/components/ProductImage/index.d.ts.map +1 -0
  403. package/product/components/ProductImage/index.js +1 -201
  404. package/product/components/ProductList/components/Item/index.js +5 -3
  405. package/product/components/ProductList/components/Layout/index.js +8 -20
  406. package/product/components/ProductName/ProductName.d.ts +1 -1
  407. package/product/components/ProductName/ProductName.d.ts.map +1 -1
  408. package/product/components/ProductName/ProductNameContent.d.ts +2 -1
  409. package/product/components/ProductName/ProductNameContent.d.ts.map +1 -1
  410. package/product/components/ProductRatingStars/ProductRatingStars.d.ts +1 -1
  411. package/product/components/ProductRatingStars/ProductRatingStars.js +2 -4
  412. package/product/components/ProductSlider/constants.d.ts +3 -0
  413. package/product/components/ProductSlider/constants.d.ts.map +1 -0
  414. package/product/components/ProductSlider/constants.js +2 -0
  415. package/product/components/ProductSlider/hooks.d.ts +7 -0
  416. package/product/components/ProductSlider/hooks.d.ts.map +1 -0
  417. package/product/components/ProductSlider/hooks.js +40 -0
  418. package/product/components/ProductSlider/index.js +8 -8
  419. package/product/components/Rating/index.js +2 -4
  420. package/product/components/RelationsSlider/RelationsSheet.js +1 -5
  421. package/product/components/RelationsSlider/RelationsSliderContent.js +3 -2
  422. package/product/components/RelationsSlider/constants.d.ts +3 -0
  423. package/product/components/RelationsSlider/constants.d.ts.map +1 -0
  424. package/product/components/RelationsSlider/constants.js +2 -1
  425. package/product/components/RelationsSlider/hooks.d.ts +6 -0
  426. package/product/components/RelationsSlider/hooks.d.ts.map +1 -0
  427. package/product/components/RelationsSlider/hooks.js +34 -0
  428. package/product/components/UnitQuantityPicker/UnitQuantityPicker.d.ts.map +1 -1
  429. package/product/components/UnitQuantityPicker/UnitQuantityPicker.js +16 -34
  430. package/product/helpers/index.js +29 -11
  431. package/product/hooks/index.js +3 -1
  432. package/product/hooks/useLoadProductImage.js +4 -2
  433. package/product/hooks/useShowEmptyRatingStars.d.ts +7 -0
  434. package/product/hooks/useShowEmptyRatingStars.d.ts.map +1 -0
  435. package/product/hooks/useShowEmptyRatingStars.js +21 -0
  436. package/product/index.js +0 -1
  437. package/product/selectors/mocks/productProperties.mock.js +49 -0
  438. package/push-opt-in/components/PushOptInModal/index.js +4 -4
  439. package/registration/components/Registration/RegistrationFormActions.js +4 -4
  440. package/reviews/components/Reviews/components/AllReviewsLink/index.js +6 -6
  441. package/reviews/components/Reviews/components/Header/components/WriteReviewLink/index.js +4 -3
  442. package/settings/action-creators/appSettings.d.ts +3 -3
  443. package/settings/action-creators/appSettings.d.ts.map +1 -1
  444. package/settings/constants/appSettings.d.ts +3 -0
  445. package/settings/constants/appSettings.d.ts.map +1 -1
  446. package/settings/constants/appSettings.js +6 -1
  447. package/settings/constants/imageSettings.d.ts +52 -0
  448. package/settings/constants/imageSettings.d.ts.map +1 -0
  449. package/settings/constants/imageSettings.js +69 -0
  450. package/settings/helpers/index.d.ts +3 -0
  451. package/settings/helpers/index.d.ts.map +1 -0
  452. package/settings/helpers/index.js +1 -0
  453. package/settings/helpers/resolveImageSettings.d.ts +70 -0
  454. package/settings/helpers/resolveImageSettings.d.ts.map +1 -0
  455. package/settings/helpers/resolveImageSettings.js +171 -0
  456. package/settings/helpers/toImageQuality.d.ts +7 -0
  457. package/settings/helpers/toImageQuality.d.ts.map +1 -0
  458. package/settings/helpers/toImageQuality.js +44 -0
  459. package/settings/helpers/toThumborColor.d.ts +15 -0
  460. package/settings/helpers/toThumborColor.d.ts.map +1 -0
  461. package/settings/helpers/toThumborColor.js +51 -0
  462. package/settings/hooks/index.d.ts +2 -0
  463. package/settings/hooks/index.d.ts.map +1 -0
  464. package/settings/hooks/index.js +1 -0
  465. package/settings/hooks/useImageSettings.d.ts +28 -0
  466. package/settings/hooks/useImageSettings.d.ts.map +1 -0
  467. package/settings/hooks/useImageSettings.js +39 -0
  468. package/settings/reducers/appSettings.d.ts.map +1 -1
  469. package/settings/reducers/appSettings.js +100 -8
  470. package/settings/reducers/index.d.ts +3 -3
  471. package/settings/selectors/appSettings.d.ts +114 -1
  472. package/settings/selectors/appSettings.d.ts.map +1 -1
  473. package/settings/selectors/appSettings.js +75 -1
  474. package/settings/types/appSettings.d.ts +244 -0
  475. package/settings/types/appSettings.d.ts.map +1 -1
  476. package/settings/types/appSettings.js +124 -1
  477. package/styles/helpers/index.d.ts +2 -0
  478. package/styles/helpers/index.js +2 -0
  479. package/styles/helpers/loadFontCss.d.ts +22 -0
  480. package/styles/helpers/loadFontCss.d.ts.map +1 -0
  481. package/styles/helpers/loadFontCss.js +138 -0
  482. package/styles/helpers/loadThemeCss.d.ts +14 -0
  483. package/styles/helpers/loadThemeCss.d.ts.map +1 -0
  484. package/styles/helpers/loadThemeCss.js +123 -0
  485. package/styles/index.d.ts +1 -1
  486. package/styles/index.d.ts.map +1 -1
  487. package/styles/index.js +1 -1
  488. package/styles/reset/root.js +23 -4
  489. package/styles/reset/typographyCustomProps.d.ts +12 -0
  490. package/styles/reset/typographyCustomProps.d.ts.map +1 -0
  491. package/styles/reset/typographyCustomProps.js +11 -0
  492. package/styles/theme/createDefaultThemeOptions/index.d.ts.map +1 -1
  493. package/styles/theme/createDefaultThemeOptions/index.js +112 -4
  494. package/styles/theme/createTheme/createComponents.d.ts +2 -2
  495. package/styles/theme/createTheme/createComponents.d.ts.map +1 -1
  496. package/styles/theme/createTheme/createComponents.js +0 -1
  497. package/styles/theme/createTheme/createComponents.types.d.ts +117 -0
  498. package/styles/theme/createTheme/createComponents.types.d.ts.map +1 -1
  499. package/styles/theme/createTheme/createComponents.types.js +119 -2
  500. package/styles/theme/createTheme/createCssVarsForColorSchemeThemes.d.ts.map +1 -1
  501. package/styles/theme/createTheme/createCssVarsForColorSchemeThemes.js +13 -3
  502. package/styles/theme/createTheme/createPalette.types.d.ts +5 -0
  503. package/styles/theme/createTheme/createPalette.types.d.ts.map +1 -1
  504. package/styles/theme/createTheme/createPalette.types.js +7 -2
  505. package/styles/theme/createTheme/createShape.d.ts +3 -0
  506. package/styles/theme/createTheme/createShape.d.ts.map +1 -1
  507. package/styles/theme/createTheme/createSpacing.js +4 -1
  508. package/styles/theme/createTheme/createThemeFromColorScheme.d.ts +4 -2
  509. package/styles/theme/createTheme/createThemeFromColorScheme.d.ts.map +1 -1
  510. package/styles/theme/createTheme/createThemeFromColorScheme.js +6 -3
  511. package/styles/theme/createTheme/createTypography.d.ts +2 -1
  512. package/styles/theme/createTheme/createTypography.js +59 -18
  513. package/styles/theme/createTheme/helpers/cssVarsParser.d.ts.map +1 -1
  514. package/styles/theme/createTheme/helpers/cssVarsParser.js +10 -3
  515. package/styles/theme/createTheme/index.d.ts +2 -1
  516. package/styles/theme/createTheme/index.d.ts.map +1 -1
  517. package/styles/theme/createTheme/index.js +5 -2
  518. package/styles/theme/createTheme/layout.d.ts +23 -0
  519. package/styles/theme/createTheme/layout.d.ts.map +1 -0
  520. package/styles/theme/createTheme/layout.js +20 -0
  521. package/styles/theme/createTheme/shadows.d.ts +11 -1
  522. package/styles/theme/createTheme/shadows.d.ts.map +1 -1
  523. package/styles/theme/createTheme/shadows.js +41 -7
  524. package/styles/theme/createTheme/transitions.d.ts +4 -0
  525. package/styles/theme/createTheme/transitions.js +3 -1
  526. package/styles/theme/createTheme/types.d.ts +41 -9
  527. package/styles/theme/createTheme/types.d.ts.map +1 -1
  528. package/styles/theme/createTheme/types.js +16 -4
  529. package/styles/theme/hocs/index.d.ts +2 -0
  530. package/styles/theme/hocs/index.d.ts.map +1 -0
  531. package/styles/theme/hocs/index.js +1 -0
  532. package/styles/theme/hocs/withTheme.d.ts +21 -0
  533. package/styles/theme/hocs/withTheme.d.ts.map +1 -0
  534. package/styles/theme/hocs/withTheme.js +33 -0
  535. package/styles/theme/hooks/useColorScheme.d.ts +4 -3
  536. package/styles/theme/hooks/useColorScheme.d.ts.map +1 -1
  537. package/styles/theme/hooks/useColorScheme.js +4 -3
  538. package/styles/theme/hooks/useMediaQuery.d.ts +7 -0
  539. package/styles/theme/hooks/useMediaQuery.d.ts.map +1 -1
  540. package/styles/theme/hooks/useMediaQuery.js +5 -5
  541. package/styles/theme/hooks/useTheme.js +1 -1
  542. package/styles/theme/index.d.ts +5 -1
  543. package/styles/theme/index.d.ts.map +1 -1
  544. package/styles/theme/index.js +2 -1
  545. package/styles/theme/providers/ActiveBreakpointProvider.d.ts +1 -1
  546. package/styles/theme/providers/ColorSchemeContext.d.ts +40 -0
  547. package/styles/theme/providers/ColorSchemeContext.d.ts.map +1 -0
  548. package/styles/theme/providers/ColorSchemeContext.js +14 -0
  549. package/styles/theme/providers/ThemeContext.d.ts +3 -0
  550. package/styles/theme/providers/ThemeContext.d.ts.map +1 -0
  551. package/styles/theme/providers/ThemeContext.js +2 -0
  552. package/styles/theme/providers/ThemeProvider.d.ts +4 -14
  553. package/styles/theme/providers/ThemeProvider.d.ts.map +1 -1
  554. package/styles/theme/providers/ThemeProvider.js +95 -26
  555. package/styles/theme/utils/color.d.ts +12 -12
  556. package/styles/theme/utils/color.d.ts.map +1 -1
  557. package/tracking/components/CookieConsentModal/index.js +3 -4
  558. package/tracking/components/PrivacySettings/index.js +3 -3
  559. package/cart/components/PaymentBar/PaymentBarReserveButton.connector.js +0 -6
  560. package/cart/components/PaymentBar/PaymentBarReserveButton.js +0 -71
  561. package/components/ChipLayout/spec.js +0 -41
  562. package/components/Logo/spec.js +0 -12
  563. package/components/NavigationHandler/spec.js +0 -84
  564. package/components/Picker/spec.js +0 -94
  565. package/components/PickerUtilize/spec.js +0 -35
  566. package/components/RangeSlider/spec.js +0 -190
  567. package/components/SheetList/components/Item/spec.js +0 -101
  568. package/components/SheetList/spec.js +0 -43
  569. package/components/TimeBoundary/spec.js +0 -83
  570. package/filter/components/FilterItem/spec.js +0 -14
  571. package/filter/components/FilterPageContent/components/ApplyButton/spec.js +0 -46
  572. package/filter/components/FilterPageContent/components/ResetButton/spec.js +0 -29
  573. package/filter/components/FilterPageContent/components/Selector/components/Selected/spec.js +0 -26
  574. package/filter/components/FilterPageContent/components/Selector/components/Toggle/spec.js +0 -34
  575. package/filter/components/FilterPageContent/components/Selector/components/ValueButton/spec.js +0 -32
  576. package/filter/components/FilterPageContent/components/Selector/spec.js +0 -33
  577. package/filter/components/PriceSlider/components/Label/spec.js +0 -26
  578. package/filter/components/PriceSlider/spec.js +0 -30
  579. package/locations/components/StoreFinder/StoreFinderGetDirectionsButton.connector.js +0 -16
  580. package/locations/components/StoreFinder/StoreFinderGetDirectionsButton.js +0 -52
  581. package/product/collections/index.js +0 -1
  582. package/product/components/EffectivityDates/constants.d.ts +0 -3
  583. package/product/components/EffectivityDates/constants.d.ts.map +0 -1
  584. package/product/components/EffectivityDates/helpers.d.ts +0 -6
  585. package/product/components/EffectivityDates/helpers.d.ts.map +0 -1
  586. package/product/components/FilterBar/components/Content/spec.js +0 -136
  587. package/product/components/Header/Shipping/spec.js +0 -36
  588. package/product/components/Header/Tiers/components/Tier/spec.js +0 -48
  589. package/product/components/Header/Tiers/spec.js +0 -64
  590. package/product/components/Media/helpers.d.ts +0 -2
  591. package/product/components/Media/helpers.d.ts.map +0 -1
  592. package/product/components/Options/components/Content/spec.js +0 -73
  593. package/product/components/Options/components/TextOption/components/OptionInfo/spec.js +0 -72
  594. package/product/components/ProductDiscountBadge/spec.js +0 -58
  595. package/product/components/ProductGrid/components/Item/components/ItemDetails/spec.js +0 -73
  596. package/product/components/ProductGrid/components/Item/components/ItemFavoritesButton/spec.js +0 -33
  597. package/product/components/ProductGrid/components/Item/components/ItemImage/spec.js +0 -16
  598. package/product/components/ProductGrid/components/Item/components/ItemName/spec.js +0 -21
  599. package/product/components/ProductGrid/components/Item/components/ItemPrice/spec.js +0 -37
  600. package/product/components/ProductGrid/spec.js +0 -52
  601. package/product/components/ProductImage/connector.js +0 -12
  602. package/product/components/ProductImage/spec.js +0 -87
  603. package/product/components/ProductSlider/spec.js +0 -37
  604. package/product/components/Rating/spec.js +0 -58
  605. package/product/helpers/index.d.ts +0 -13
  606. package/product/helpers/index.d.ts.map +0 -1
  607. package/product/helpers/redirects.d.ts +0 -2
  608. package/product/helpers/redirects.d.ts.map +0 -1
  609. package/product/selectors/helpers/filterProperties.d.ts +0 -8
  610. package/product/selectors/helpers/filterProperties.d.ts.map +0 -1
  611. package/product/selectors/helpers/index.d.ts +0 -3
  612. package/product/selectors/helpers/index.d.ts.map +0 -1
  613. package/product/selectors/helpers/wrapMemoizedSelector.d.ts +0 -2
  614. package/product/selectors/helpers/wrapMemoizedSelector.d.ts.map +0 -1
  615. package/product/selectors/product.d.ts +0 -112
  616. package/product/selectors/product.d.ts.map +0 -1
  617. package/reviews/components/Reviews/components/Header/components/WriteReviewLink/spec.js +0 -52
  618. package/reviews/components/Reviews/components/Header/spec.js +0 -78
  619. package/reviews/components/Reviews/components/List/spec.js +0 -108
  620. package/reviews/components/Reviews/components/RatingCount/spec.js +0 -38
  621. package/reviews/components/Reviews/spec.js +0 -101
  622. package/tsconfig.build.json +0 -26
  623. package/tsconfig.json +0 -19
@@ -51,5 +51,6 @@ export interface TypographyOptions
51
51
 
52
52
  export default function createTypography(
53
53
  palette: Palette,
54
- typography: TypographyOptions | ((palette: Palette) => TypographyOptions)
54
+ typography: TypographyOptions | ((palette: Palette) => TypographyOptions),
55
+ cssVarPrefix?: string
55
56
  ): Typography;
@@ -1,19 +1,41 @@
1
1
  import _merge from "lodash/merge";
2
- 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.
@@ -32,10 +54,28 @@ export default function createTypography(palette, typography) {
32
54
  } = typeof typography === 'function' ? typography(palette) : typography;
33
55
  if (isDev) {
34
56
  if (typeof fontSize !== 'number') {
57
+ // eslint-disable-next-line no-console
35
58
  console.error('Shopgate Theme: `fontSize` is required to be a number.');
36
59
  }
37
60
  }
38
61
  const coef = fontSize / 14;
62
+ const fontWeights = {
63
+ fontWeightLight,
64
+ fontWeightRegular,
65
+ fontWeightMedium,
66
+ fontWeightBold
67
+ };
68
+
69
+ /**
70
+ * Builds a reference to one of the shared font weight custom properties. The property itself is
71
+ * emitted by cssVarsParser from `typography.fontWeight*`, so overriding it on `:root` (admin css,
72
+ * live preview, an extension) cascades into every variant that uses that token. The resolved
73
+ * weight stays as the fallback, so the variant still renders when the property is absent.
74
+ * @param {string} token One of `fontWeightLight`, `fontWeightRegular`, `fontWeightMedium`,
75
+ * `fontWeightBold`.
76
+ * @returns {string} The css var reference.
77
+ */
78
+ const fontWeightVar = token => `var(${typographyVarPrefix(cssVarPrefix)}-${token}, ${fontWeights[token]})`;
39
79
 
40
80
  /**
41
81
  * Calculates a rem value for a passed pixel value.
@@ -46,34 +86,35 @@ export default function createTypography(palette, typography) {
46
86
 
47
87
  /**
48
88
  * Creates a typography variant object.
49
- * @param {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.
50
91
  * @param {number} size Font size in pixels.
51
92
  * @param {number} lineHeight Line height as a unitless number.
52
93
  * @param {Object} casing Casing styles to apply, e.g. textTransform.
53
94
  * @returns {Object} The typography variant object.
54
95
  */
55
- const buildVariant = (fontWeight, size, lineHeight, casing) => ({
96
+ const buildVariant = (fontWeightToken, size, lineHeight, casing) => ({
56
97
  fontFamily,
57
- fontWeight,
98
+ fontWeight: fontWeightVar(fontWeightToken),
58
99
  fontSize: pxToRem(size),
59
100
  lineHeight,
60
101
  ...casing,
61
102
  ...allVariants
62
103
  });
63
104
  const variants = {
64
- h1: buildVariant(fontWeightBold, 34, 1.15),
65
- h2: buildVariant(fontWeightBold, 22, 1.3),
66
- h3: buildVariant(fontWeightMedium, 20, 1.35),
67
- h4: buildVariant(fontWeightMedium, 18, 1.4),
68
- h5: buildVariant(fontWeightMedium, 16, 1.5),
69
- h6: buildVariant(fontWeightMedium, 14, 1.5),
70
- subtitle1: buildVariant(fontWeightRegular, 16, 1.75),
71
- subtitle2: buildVariant(fontWeightMedium, 14, 1.57),
72
- body1: buildVariant(fontWeightRegular, 16, 1.5),
73
- body2: buildVariant(fontWeightRegular, 14, 1.43),
74
- button: buildVariant(fontWeightMedium, 14, 1.75, caseAllCaps),
75
- caption: buildVariant(fontWeightRegular, 12, 1.66),
76
- overline: buildVariant(fontWeightRegular, 12, 2.66, caseAllCaps)
105
+ h1: buildVariant('fontWeightBold', 34, 1.15),
106
+ h2: buildVariant('fontWeightBold', 22, 1.3),
107
+ h3: buildVariant('fontWeightMedium', 20, 1.35),
108
+ h4: buildVariant('fontWeightMedium', 18, 1.4),
109
+ h5: buildVariant('fontWeightMedium', 16, 1.5),
110
+ h6: buildVariant('fontWeightMedium', 14, 1.5),
111
+ subtitle1: buildVariant('fontWeightRegular', 16, 1.75),
112
+ subtitle2: buildVariant('fontWeightMedium', 14, 1.57),
113
+ body1: buildVariant('fontWeightRegular', 16, 1.5),
114
+ body2: buildVariant('fontWeightRegular', 14, 1.43),
115
+ button: buildVariant(buttonFontWeight > fontWeightMedium ? 'fontWeightBold' : 'fontWeightMedium', 16, 1.75, caseButton),
116
+ caption: buildVariant('fontWeightRegular', 12, 1.66),
117
+ overline: buildVariant('fontWeightRegular', 12, 2.66, caseAllCaps)
77
118
  };
78
119
  return _merge({
79
120
  pxToRem,
@@ -1 +1 @@
1
- {"version":3,"file":"cssVarsParser.d.ts","sourceRoot":"","sources":["../../../../../styles/theme/createTheme/helpers/cssVarsParser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAsIH,KAAK,oBAAoB,GAAG;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uBAAuB,CAAC,EAAE,CAAC,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,OAAO,CAAC;CAC9F,CAAC;AAEF,MAAM,MAAM,wBAAwB,CAAC,CAAC,IAAI;IACxC;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IACrC;;;OAGG;IACH,IAAI,EAAE,CAAC,CAAC;IACR;;;OAGG;IACH,gBAAgB,EAAE,CAAC,CAAC;IACpB;;;OAGG;IACH,QAAQ,EAAE,CAAC,CAAC;CACb,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,CAAC,SAAS,MAAM,EACpD,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,oBAAoB,GAC7B,wBAAwB,CAAC,CAAC,CAAC,CA+D7B"}
1
+ {"version":3,"file":"cssVarsParser.d.ts","sourceRoot":"","sources":["../../../../../styles/theme/createTheme/helpers/cssVarsParser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA6IH,KAAK,oBAAoB,GAAG;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uBAAuB,CAAC,EAAE,CAAC,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,OAAO,CAAC;CAC9F,CAAC;AAEF,MAAM,MAAM,wBAAwB,CAAC,CAAC,IAAI;IACxC;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IACrC;;;OAGG;IACH,IAAI,EAAE,CAAC,CAAC;IACR;;;OAGG;IACH,gBAAgB,EAAE,CAAC,CAAC;IACpB;;;OAGG;IACH,QAAQ,EAAE,CAAC,CAAC;CACb,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,CAAC,SAAS,MAAM,EACpD,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,oBAAoB,GAC7B,wBAAwB,CAAC,CAAC,CAAC,CA+D7B"}
@@ -85,11 +85,18 @@ const walkObjectDeep = (obj, callback, shouldSkipPaths) => {
85
85
  */
86
86
  const getCssValue = (keys, value) => {
87
87
  if (typeof value === 'number') {
88
- if (['lineHeight', 'fontWeight', 'opacity', 'zIndex', 'fontSize', 'fontWeightLight', 'fontWeightRegular', 'fontWeightMedium', 'fontWeightBold'].some(prop => keys[keys.length - 1] === prop)) {
89
- // CSS property that are unitless
88
+ const lastKey = keys[keys.length - 1];
89
+ if (['lineHeight', 'fontWeight', 'opacity', 'zIndex', 'fontWeightLight', 'fontWeightRegular', 'fontWeightMedium', 'fontWeightBold'].some(prop => lastKey === prop)) {
90
+ // CSS properties that are unitless
91
+ return value;
92
+ }
93
+
94
+ // `typography.fontSize` is MUI's base font-size coefficient and stays unitless, but variant
95
+ // font sizes (e.g. `typography.body2.fontSize`) are lengths and need a `px` unit - otherwise a
96
+ // numeric override would produce an invalid `font-size: 12` custom property.
97
+ if (lastKey === 'fontSize' && keys[keys.length - 2] === 'typography') {
90
98
  return value;
91
99
  }
92
- const lastKey = keys[keys.length - 1];
93
100
  if (lastKey.toLowerCase().includes('opacity')) {
94
101
  // opacity values are unitless
95
102
  return value;
@@ -1,5 +1,6 @@
1
1
  import { type ThemeOptions, type ThemeInternal } from './types';
2
- export type { Theme, BaseTheme, ThemeInternal, ThemeOptions, Breakpoint, ColorSchemeName, ColorSchemeSelectorType, PaletteColorsWithMain, } from './types';
2
+ export type { Theme, BaseTheme, ThemeInternal, ThemeOptions, Breakpoint, ColorSchemeName, ColorSchemeMode, ColorSchemeSelectorType, PaletteColorsWithMain, } from './types';
3
+ export { COLOR_SCHEME_NAMES, COLOR_SCHEME_SYSTEM } from './types';
3
4
  /**
4
5
  * Creates a theme object for the ThemeProvider.
5
6
  * @param options The theme options.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/index.ts"],"names":[],"mappings":"AASA,OAAO,EACL,KAAK,YAAY,EAGjB,KAAK,aAAa,EACnB,MAAM,SAAS,CAAC;AAEjB,YAAY,EACV,KAAK,EACL,SAAS,EACT,aAAa,EACb,YAAY,EACZ,UAAU,EACV,eAAe,EACf,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,SAAS,CAAC;AAEjB;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,UAAS,YAAiB,KAAG,aAkExD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/index.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,KAAK,YAAY,EAGjB,KAAK,aAAa,EACnB,MAAM,SAAS,CAAC;AAEjB,YAAY,EACV,KAAK,EACL,SAAS,EACT,aAAa,EACb,YAAY,EACZ,UAAU,EACV,eAAe,EACf,eAAe,EACf,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAElE;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,UAAS,YAAiB,KAAG,aAkExD,CAAC"}
@@ -4,10 +4,13 @@ import createBreakpoints from "./createBreakpoints";
4
4
  import createSpacing from "./createSpacing";
5
5
  import transitions from "./transitions";
6
6
  import zIndex from "./zIndex";
7
+ import layout from "./layout";
7
8
  import createThemeFromColorScheme from "./createThemeFromColorScheme";
8
9
  import createCssVarsForColorSchemeThemes from "./createCssVarsForColorSchemeThemes";
9
10
  import applyStyles from "./applyStyles";
10
11
  import { createGetColorSchemeSelector, createSetActiveColorScheme } from "./helpers";
12
+ export { COLOR_SCHEME_NAMES, COLOR_SCHEME_SYSTEM } from "./types";
13
+
11
14
  /**
12
15
  * Creates a theme object for the ThemeProvider.
13
16
  * @param options The theme options.
@@ -35,7 +38,7 @@ export const createTheme = (options = {}) => {
35
38
  palette: {
36
39
  mode: type
37
40
  }
38
- }, defaultScheme, scheme));
41
+ }, defaultScheme, scheme), cssVarPrefix);
39
42
  return acc;
40
43
  }, {});
41
44
  const getColorSchemeSelector = createGetColorSchemeSelector(colorSchemeSelector);
@@ -58,7 +61,7 @@ export const createTheme = (options = {}) => {
58
61
  spacing,
59
62
  transitions,
60
63
  zIndex,
61
- // @ts-expect-error - Sure about the type here
64
+ layout,
62
65
  colorSchemes,
63
66
  getColorSchemeSelector,
64
67
  setActiveColorScheme,
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Runtime layout dimensions exposed as global CSS variables.
3
+ *
4
+ * These are NOT design tokens and are not generated by the theme's CSS-variable pipeline.
5
+ * The `--safe-area-inset-*` variables are set at runtime by `updatePageInsets` based on the
6
+ * device page insets.
7
+ *
8
+ * This node only maps theme properties to those existing variables (`var(--...)`), so consumers
9
+ * can read `theme.layout.*` instead of hardcoding the variable names.
10
+ */
11
+ export interface SafeArea {
12
+ top: string;
13
+ bottom: string;
14
+ left: string;
15
+ right: string;
16
+ }
17
+ export interface Layout {
18
+ /** Device safe-area insets (`--safe-area-inset-*`). */
19
+ safeArea: SafeArea;
20
+ }
21
+ declare const layout: Layout;
22
+ export default layout;
23
+ //# sourceMappingURL=layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/layout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,MAAM;IACrB,uDAAuD;IACvD,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,QAAA,MAAM,MAAM,EAAE,MAOb,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Runtime layout dimensions exposed as global CSS variables.
3
+ *
4
+ * These are NOT design tokens and are not generated by the theme's CSS-variable pipeline.
5
+ * The `--safe-area-inset-*` variables are set at runtime by `updatePageInsets` based on the
6
+ * device page insets.
7
+ *
8
+ * This node only maps theme properties to those existing variables (`var(--...)`), so consumers
9
+ * can read `theme.layout.*` instead of hardcoding the variable names.
10
+ */
11
+
12
+ const layout = {
13
+ safeArea: {
14
+ top: 'var(--safe-area-inset-top)',
15
+ bottom: 'var(--safe-area-inset-bottom)',
16
+ left: 'var(--safe-area-inset-left)',
17
+ right: 'var(--safe-area-inset-right)'
18
+ }
19
+ };
20
+ export default layout;
@@ -1,4 +1,14 @@
1
- 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;
@@ -39,6 +39,10 @@ export interface Duration {
39
39
  * Recommended when something is leaving screen
40
40
  */
41
41
  leavingScreen: number;
42
+ /**
43
+ * How long a toast stays visible before auto-dismissing
44
+ */
45
+ toast: number;
42
46
  }
43
47
 
44
48
  export const duration: Duration;
@@ -27,7 +27,9 @@ export const duration = {
27
27
  // recommended when something is entering screen
28
28
  enteringScreen: 225,
29
29
  // recommended when something is leaving screen
30
- leavingScreen: 195
30
+ leavingScreen: 195,
31
+ // how long a toast stays visible before auto-dismissing
32
+ toast: 5000
31
33
  };
32
34
 
33
35
  /**
@@ -1,19 +1,25 @@
1
1
  import type { PaletteOptions, Palette } from './createPalette';
2
2
  import type { Typography, TypographyOptions } from './createTypography';
3
- import type { ComponentsOptions, ComponentVars } from './createComponents';
3
+ import type { ComponentsOptions, ComponentVars, Components } from './createComponents';
4
4
  import type { Breakpoints } from './createBreakpoints';
5
5
  import type { Spacing } from './createSpacing';
6
6
  import type { Transitions } from './transitions';
7
7
  import type { ZIndex } from './zIndex';
8
+ import type { Layout } from './layout';
8
9
  import type { ApplyStyles } from './applyStyles';
9
10
  import type { GetColorSchemeSelector, ActiveColorSchemeSwitcher } from './helpers';
10
11
  import type { CreateCssVarsForColorSchemeThemesReturnValue } from './createCssVarsForColorSchemeThemes';
11
12
  import type { Shape, ShapeOptions } from './createShape';
12
- import type { Shadows } from './shadows';
13
+ import type { Shadows, ShadowSize } from './shadows';
13
14
  export type { Breakpoint } from './createBreakpoints';
14
15
  export type { PaletteColorsWithMain } from './createPalette';
15
- declare const colorSchemes: readonly ["light", "dark"];
16
- export type ColorSchemeName = (typeof colorSchemes)[number];
16
+ export declare const COLOR_SCHEME_NAMES: readonly ["light", "dark"];
17
+ export type ColorSchemeName = (typeof COLOR_SCHEME_NAMES)[number];
18
+ export declare const COLOR_SCHEME_SYSTEM = "system";
19
+ /**
20
+ * A selectable color scheme: one the theme provides, or `system` to follow the operating system.
21
+ */
22
+ export type ColorSchemeMode = ColorSchemeName | typeof COLOR_SCHEME_SYSTEM;
17
23
  declare const selectorTypes: readonly ["data", "class"];
18
24
  export type ColorSchemeSelectorType = (typeof selectorTypes)[number];
19
25
  type DeepPartial<T> = T extends object ? {
@@ -27,7 +33,8 @@ type DeepPartial<T> = T extends object ? {
27
33
  export type ColorSchemeOptions = Pick<ThemeOptions, 'palette' | 'typography' | 'components' | 'shape'>;
28
34
  export interface ThemeOptions {
29
35
  /**
30
- * The default color scheme to use when the user has not specified a preference.
36
+ * The color scheme to fall back to when the configured mode resolves to a scheme this theme does
37
+ * not style. The scheme the app starts in comes from the app settings.
31
38
  * @default 'light'
32
39
  */
33
40
  defaultColorScheme?: ColorSchemeName;
@@ -93,6 +100,10 @@ export interface BaseTheme {
93
100
  * Pre-defined shadow styles for different elevation levels, following Material Design guidelines.
94
101
  */
95
102
  shadows: Shadows;
103
+ /**
104
+ * The finished box-shadow size (`none` | `low` | `medium` | `strong`)
105
+ */
106
+ shadowSizes: Record<ShadowSize, string>;
96
107
  /**
97
108
  * Adds an alpha value to a color, returning a new color string with the applied alpha.
98
109
  * @param color The color to modify.
@@ -124,7 +135,8 @@ export interface BaseTheme {
124
135
  }
125
136
  export interface Theme extends BaseTheme {
126
137
  /**
127
- * The default color scheme to use when the user has not specified a preference.
138
+ * The color scheme to fall back to when the configured mode resolves to a scheme this theme does
139
+ * not style. The scheme the app starts in comes from the app settings.
128
140
  */
129
141
  defaultColorScheme?: ColorSchemeName;
130
142
  /**
@@ -143,6 +155,12 @@ export interface Theme extends BaseTheme {
143
155
  * Reference to z-index values for multiple components.
144
156
  */
145
157
  zIndex: ZIndex;
158
+ /**
159
+ * Mappings to runtime layout CSS variables (safe-area insets).
160
+ * The values are `var(--...)` references to variables updated at runtime elsewhere in the app;
161
+ * this node does not generate any new CSS variables.
162
+ */
163
+ layout: Layout;
146
164
  /**
147
165
  * An object that contains the CSS variable references for the theme properties.
148
166
  * It has the same structure as the theme, but the values are CSS variable references
@@ -171,12 +189,26 @@ export interface Theme extends BaseTheme {
171
189
  */
172
190
  applyStyles: ApplyStyles<ColorSchemeName>;
173
191
  }
192
+ /**
193
+ * A single fully-resolved color-scheme theme. Identical to {@link BaseTheme} except that its
194
+ * `components` keep the nested `vars` level (the raw per-scheme token defaults produced by
195
+ * `createComponents`), whereas the flattened `BaseTheme['components']` shape is only produced for
196
+ * the final merged theme.
197
+ */
198
+ export type ColorSchemeTheme = Omit<BaseTheme, 'components'> & {
199
+ components: Components;
200
+ };
174
201
  /**
175
202
  * A record of themes for each color scheme. Each key is a color scheme name (e.g., 'light', 'dark'),
176
- * and the value is a theme object that contains e.g. the palette and typography for that color scheme.
203
+ * and the value is a fully-resolved color-scheme theme ({@link ColorSchemeTheme}).
177
204
  */
178
- export type ColorSchemeThemes = Record<ColorSchemeName, BaseTheme>;
179
- export type ThemeInternal = Theme & Pick<CreateCssVarsForColorSchemeThemesReturnValue, 'generateStyleSheets'> & {
205
+ export type ColorSchemeThemes = Record<ColorSchemeName, ColorSchemeTheme>;
206
+ export type ThemeInternal = Omit<Theme, 'colorSchemes'> & {
207
+ /**
208
+ * Internal runtime map of fully resolved color-scheme themes.
209
+ */
210
+ colorSchemes: ColorSchemeThemes;
211
+ } & Pick<CreateCssVarsForColorSchemeThemesReturnValue, 'generateStyleSheets'> & {
180
212
  /**
181
213
  * Function that generates a CSS selector string for a given color scheme.
182
214
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,EAAc,iBAAiB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACvF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AACnF,OAAO,KAAK,EAAE,4CAA4C,EAAE,MAAM,qCAAqC,CAAC;AACxG,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,KAA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;;;;;;;OAYG;IACH,WAAW,EAAE,WAAW,CAAC,eAAe,CAAC,CAAC;CAC3C;AAED;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG;IAAE,UAAU,EAAE,UAAU,CAAA;CAAE,CAAC;AAE1F;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAA;AAEzE,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,EAAE,cAAc,CAAC,GAAG;IACxD;;OAEG;IACH,YAAY,EAAE,iBAAiB,CAAC;CACjC,GAAG,IAAI,CAAC,4CAA4C,EAAE,qBAAqB,CAAC,GAAG;IAC9E;;OAEG;IACH,sBAAsB,EAAE,sBAAsB,CAAC;IAC/C;;OAEG;IACH,oBAAoB,EAAE,yBAAyB,CAAC;CACjD,CAAC"}
@@ -1,4 +1,10 @@
1
- const colorSchemes = ['light', 'dark'];
1
+ export const COLOR_SCHEME_NAMES = ['light', 'dark'];
2
+ export const COLOR_SCHEME_SYSTEM = 'system';
3
+
4
+ /**
5
+ * A selectable color scheme: one the theme provides, or `system` to follow the operating system.
6
+ */
7
+
2
8
  const selectorTypes = ['data', 'class'];
3
9
 
4
10
  /**
@@ -8,7 +14,13 @@ const selectorTypes = ['data', 'class'];
8
14
  */
9
15
 
10
16
  /**
11
- * A record of themes for each color scheme. Each key is a color scheme name (e.g., 'light', 'dark'),
12
- * and the value is a theme object that contains e.g. the palette and typography for that color scheme.
17
+ * A single fully-resolved color-scheme theme. Identical to {@link BaseTheme} except that its
18
+ * `components` keep the nested `vars` level (the raw per-scheme token defaults produced by
19
+ * `createComponents`), whereas the flattened `BaseTheme['components']` shape is only produced for
20
+ * the final merged theme.
13
21
  */
14
- export {};
22
+
23
+ /**
24
+ * A record of themes for each color scheme. Each key is a color scheme name (e.g., 'light', 'dark'),
25
+ * and the value is a fully-resolved color-scheme theme ({@link ColorSchemeTheme}).
26
+ */
@@ -0,0 +1,2 @@
1
+ export { withTheme, type WithThemeProps } from './withTheme';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../styles/theme/hocs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1 @@
1
+ export { withTheme } from "./withTheme";
@@ -0,0 +1,21 @@
1
+ import type { ComponentType } from 'react';
2
+ import type { Theme } from '../createTheme';
3
+ /**
4
+ * Props injected by the `withTheme` HOC.
5
+ */
6
+ export interface WithThemeProps {
7
+ /** The active styling theme (same object returned by `useTheme()`). */
8
+ theme: Theme;
9
+ }
10
+ /**
11
+ * Injects the styling theme as a `theme` prop into the wrapped component.
12
+ *
13
+ * Intended for legacy class components that cannot use the `useTheme` hook.
14
+ * For function components, prefer the `useTheme` hook instead.
15
+ *
16
+ * @param WrappedComponent The component to inject the theme into.
17
+ * @returns The wrapped component with `theme` supplied automatically.
18
+ */
19
+ export declare function withTheme<P extends WithThemeProps>(WrappedComponent: ComponentType<P>): ComponentType<Omit<P, keyof WithThemeProps>>;
20
+ export default withTheme;
21
+ //# sourceMappingURL=withTheme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withTheme.d.ts","sourceRoot":"","sources":["../../../../styles/theme/hocs/withTheme.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAG5C;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,uEAAuE;IACvE,KAAK,EAAE,KAAK,CAAC;CACd;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,cAAc,EAChD,gBAAgB,EAAE,aAAa,CAAC,CAAC,CAAC,GACjC,aAAa,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,cAAc,CAAC,CAAC,CAe9C;AAED,eAAe,SAAS,CAAC"}
@@ -0,0 +1,33 @@
1
+ import useTheme from "../hooks/useTheme";
2
+
3
+ /**
4
+ * Props injected by the `withTheme` HOC.
5
+ */
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ /**
8
+ * Injects the styling theme as a `theme` prop into the wrapped component.
9
+ *
10
+ * Intended for legacy class components that cannot use the `useTheme` hook.
11
+ * For function components, prefer the `useTheme` hook instead.
12
+ *
13
+ * @param WrappedComponent The component to inject the theme into.
14
+ * @returns The wrapped component with `theme` supplied automatically.
15
+ */
16
+ export function withTheme(WrappedComponent) {
17
+ /**
18
+ * The actual HOC.
19
+ * @param props The component props.
20
+ * @returns The wrapped component with the theme injected.
21
+ */
22
+ const WithTheme = props => {
23
+ const theme = useTheme();
24
+ return /*#__PURE__*/_jsx(WrappedComponent, {
25
+ ...props,
26
+ theme: theme
27
+ });
28
+ };
29
+ const displayName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
30
+ WithTheme.displayName = `WithTheme(${displayName})`;
31
+ return WithTheme;
32
+ }
33
+ export default withTheme;
@@ -1,7 +1,8 @@
1
1
  /**
2
- * Returns the currently selected color scheme and a function to update it.
3
- * @returns An object containing the current color scheme and a function to update it.
2
+ * Provides access to the color scheme context.
3
+ * @returns The color scheme context value, containing the current `mode`, a `setMode` function to
4
+ * update it, and the `modes` that can be set.
4
5
  */
5
- declare const useColorScheme: () => import("../providers/ThemeProvider").ColorSchemeContextValue;
6
+ declare const useColorScheme: () => import("..").ColorSchemeContextValue;
6
7
  export default useColorScheme;
7
8
  //# sourceMappingURL=useColorScheme.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useColorScheme.d.ts","sourceRoot":"","sources":["../../../../styles/theme/hooks/useColorScheme.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,QAAA,MAAM,cAAc,oEAAuC,CAAC;AAE5D,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"useColorScheme.d.ts","sourceRoot":"","sources":["../../../../styles/theme/hooks/useColorScheme.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,QAAA,MAAM,cAAc,4CAAuC,CAAC;AAE5D,eAAe,cAAc,CAAC"}
@@ -1,9 +1,10 @@
1
1
  import { useContext } from 'react';
2
- import { ColorSchemeContext } from "../providers/ThemeProvider";
2
+ import { ColorSchemeContext } from "../providers/ColorSchemeContext";
3
3
 
4
4
  /**
5
- * Returns the currently selected color scheme and a function to update it.
6
- * @returns An object containing the current color scheme and a function to update it.
5
+ * Provides access to the color scheme context.
6
+ * @returns The color scheme context value, containing the current `mode`, a `setMode` function to
7
+ * update it, and the `modes` that can be set.
7
8
  */
8
9
  const useColorScheme = () => useContext(ColorSchemeContext);
9
10
  export default useColorScheme;