@shopgate/engage 7.32.0-beta.2 → 7.32.0-beta.4

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 (85) hide show
  1. package/admin-preview/components/FrontendSettingsPreviewBridge/FrontendSettingsPreviewBridge.d.ts +2 -1
  2. package/admin-preview/components/FrontendSettingsPreviewBridge/FrontendSettingsPreviewBridge.d.ts.map +1 -1
  3. package/admin-preview/components/FrontendSettingsPreviewBridge/FrontendSettingsPreviewBridge.js +23 -1
  4. package/admin-preview/components/FrontendSettingsPreviewBridge/helpers.d.ts +7 -1
  5. package/admin-preview/components/FrontendSettingsPreviewBridge/helpers.d.ts.map +1 -1
  6. package/admin-preview/components/FrontendSettingsPreviewBridge/helpers.js +14 -2
  7. package/admin-preview/components/FrontendSettingsPreviewBridge/types.d.ts +6 -0
  8. package/admin-preview/components/FrontendSettingsPreviewBridge/types.d.ts.map +1 -1
  9. package/admin-preview/constants/index.d.ts +1 -22
  10. package/admin-preview/constants/index.d.ts.map +1 -1
  11. package/admin-preview/constants/index.js +1 -26
  12. package/admin-preview/{detection.d.ts → helpers/_internal/detection.d.ts} +12 -8
  13. package/admin-preview/helpers/_internal/detection.d.ts.map +1 -0
  14. package/admin-preview/helpers/_internal/detection.js +93 -0
  15. package/admin-preview/helpers/index.d.ts +7 -0
  16. package/admin-preview/helpers/index.d.ts.map +1 -1
  17. package/admin-preview/helpers/index.js +10 -2
  18. package/components/Badge/Badge.d.ts +30 -0
  19. package/components/Badge/Badge.d.ts.map +1 -0
  20. package/components/Badge/Badge.js +48 -0
  21. package/components/Badge/index.d.ts +3 -0
  22. package/components/Badge/index.d.ts.map +1 -0
  23. package/components/Badge/index.js +1 -0
  24. package/components/Badge/spec.d.ts +2 -0
  25. package/components/Badge/spec.d.ts.map +1 -0
  26. package/components/Badge/spec.js +75 -0
  27. package/components/View/components/Content/index.d.ts.map +1 -1
  28. package/components/View/components/Content/index.js +4 -1
  29. package/components/index.d.ts +1 -0
  30. package/components/index.d.ts.map +1 -1
  31. package/components/index.js +2 -1
  32. package/core/hooks/useLocalStorage.d.ts +8 -0
  33. package/core/hooks/useLocalStorage.d.ts.map +1 -1
  34. package/core/hooks/useLocalStorage.js +22 -15
  35. package/core/initialization/fetchSettings.d.ts +12 -0
  36. package/core/initialization/fetchSettings.d.ts.map +1 -0
  37. package/core/initialization/fetchSettings.js +134 -0
  38. package/core/initialization/index.d.ts +33 -2
  39. package/core/initialization/index.d.ts.map +1 -1
  40. package/core/initialization/index.js +25 -103
  41. package/package.json +9 -9
  42. package/page/components/ResponsiveWidgetImage/ResponsiveWidgetImage.js +2 -2
  43. package/page/constants/index.js +5 -3
  44. package/product/components/Description/index.js +0 -2
  45. package/product/components/ProductCard/index.js +1 -0
  46. package/product/components/ProductGrid/components/Item/components/ItemDetails/index.js +1 -1
  47. package/product/components/ProductGrid/components/Item/components/ItemImage/index.js +10 -0
  48. package/product/components/ProductGrid/components/Item/components/ItemName/index.js +1 -0
  49. package/product/components/ProductGrid/components/Item/index.js +0 -1
  50. package/product/components/ProductGrid/components/Layout/index.js +17 -3
  51. package/product/components/ProductList/components/Layout/index.js +8 -20
  52. package/styles/helpers/index.d.ts +1 -0
  53. package/styles/helpers/index.js +1 -0
  54. package/styles/helpers/loadThemeCss.d.ts +14 -0
  55. package/styles/helpers/loadThemeCss.d.ts.map +1 -0
  56. package/styles/helpers/loadThemeCss.js +112 -0
  57. package/styles/index.d.ts +1 -1
  58. package/styles/index.d.ts.map +1 -1
  59. package/styles/reset/root.js +1 -1
  60. package/styles/theme/createDefaultThemeOptions/index.d.ts.map +1 -1
  61. package/styles/theme/createDefaultThemeOptions/index.js +12 -1
  62. package/styles/theme/createTheme/createComponents.types.d.ts +22 -0
  63. package/styles/theme/createTheme/createComponents.types.d.ts.map +1 -1
  64. package/styles/theme/createTheme/createComponents.types.js +23 -1
  65. package/styles/theme/createTheme/createCssVarsForColorSchemeThemes.d.ts.map +1 -1
  66. package/styles/theme/createTheme/createCssVarsForColorSchemeThemes.js +4 -1
  67. package/styles/theme/createTheme/index.d.ts +1 -0
  68. package/styles/theme/createTheme/index.d.ts.map +1 -1
  69. package/styles/theme/createTheme/index.js +2 -0
  70. package/styles/theme/createTheme/types.d.ts +2 -2
  71. package/styles/theme/createTheme/types.d.ts.map +1 -1
  72. package/styles/theme/createTheme/types.js +2 -3
  73. package/styles/theme/hooks/useColorScheme.d.ts +4 -3
  74. package/styles/theme/hooks/useColorScheme.d.ts.map +1 -1
  75. package/styles/theme/hooks/useColorScheme.js +4 -3
  76. package/styles/theme/index.d.ts +1 -1
  77. package/styles/theme/index.d.ts.map +1 -1
  78. package/styles/theme/providers/ColorSchemeContext.d.ts +19 -0
  79. package/styles/theme/providers/ColorSchemeContext.d.ts.map +1 -0
  80. package/styles/theme/providers/ColorSchemeContext.js +6 -0
  81. package/styles/theme/providers/ThemeProvider.d.ts +2 -12
  82. package/styles/theme/providers/ThemeProvider.d.ts.map +1 -1
  83. package/styles/theme/providers/ThemeProvider.js +34 -10
  84. package/admin-preview/detection.d.ts.map +0 -1
  85. package/admin-preview/detection.js +0 -166
@@ -17,7 +17,6 @@ const useStyles = makeStyles()((theme, {
17
17
  position: 'relative',
18
18
  display: 'flex',
19
19
  flexDirection: 'column',
20
- background: theme.palette.background.surface,
21
20
  height: '100%'
22
21
  },
23
22
  itemDetails: {
@@ -11,9 +11,23 @@ const useStyles = makeStyles()((theme, {
11
11
  ':not(:empty)': {
12
12
  marginTop: 16
13
13
  },
14
- display: 'grid',
15
- gridGap: '0 16px',
16
- gridTemplateColumns: `repeat(${columns}, 1fr)`
14
+ ...(columns <= 2 ? {
15
+ rowGap: 16,
16
+ '& > *': {
17
+ padding: '0px 8px',
18
+ width: `${100 / columns}%`,
19
+ [`&:nth-of-type(${columns}n)`]: {
20
+ paddingRight: 0
21
+ },
22
+ [`&:nth-of-type(${columns}n+1)`]: {
23
+ paddingLeft: 0
24
+ }
25
+ }
26
+ } : {
27
+ display: 'grid',
28
+ gridGap: 16,
29
+ gridTemplateColumns: `repeat(${columns}, 1fr)`
30
+ })
17
31
  }
18
32
  }));
19
33
 
@@ -1,34 +1,22 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import List from '@shopgate/pwa-common/components/List';
4
- import { makeStyles } from '@shopgate/engage/styles';
5
- import { jsx as _jsx } from "react/jsx-runtime";
6
- const useStyles = makeStyles()(theme => ({
7
- list: {
8
- background: theme.palette.background.surface
9
- }
10
- }));
11
4
 
12
5
  /**
13
6
  * The Product List Layout component.
14
7
  * @param {Object} props The component props.
15
8
  * @return {JSX}
16
9
  */
10
+ import { jsx as _jsx } from "react/jsx-runtime";
17
11
  const Layout = ({
18
12
  children
19
- }) => {
20
- const {
21
- classes,
22
- cx
23
- } = useStyles();
24
- return /*#__PURE__*/_jsx(List, {
25
- className: cx(classes.list, 'engage__product__product-list'),
26
- itemScope: true,
27
- itemType: "http://schema.org/ItemList",
28
- "data-test-id": "productList",
29
- children: children
30
- });
31
- };
13
+ }) => /*#__PURE__*/_jsx(List, {
14
+ className: "engage__product__product-list",
15
+ itemScope: true,
16
+ itemType: "http://schema.org/ItemList",
17
+ "data-test-id": "productList",
18
+ children: children
19
+ });
32
20
  Layout.defaultProps = {
33
21
  children: null
34
22
  };
@@ -4,6 +4,7 @@ export { setPageContentWidth } from "./setPageContentWidth";
4
4
  export { setViewportHeight } from "./setViewportHeight";
5
5
  export { toggleBodyScroll } from "./toggleBodyScroll";
6
6
  export { loadCustomStyles } from "./loadCustomStyles";
7
+ export { loadThemeCss } from "./loadThemeCss";
7
8
  export * from "./color";
8
9
  export { responsiveMediaQuery } from "../../components/ResponsiveContainer/mediaQuery";
9
10
  export { responsiveCondition } from "../../components/ResponsiveContainer/condition";
@@ -6,6 +6,7 @@ export { setViewportHeight } from "./setViewportHeight";
6
6
  export { toggleBodyScroll } from "./toggleBodyScroll";
7
7
  export { initCSSCustomProps, initCSSCustomPropsFallback } from "./initCSSCustomProperties";
8
8
  export { loadCustomStyles } from "./loadCustomStyles";
9
+ export { loadThemeCss } from "./loadThemeCss";
9
10
  export * from "./color";
10
11
  export { responsiveMediaQuery } from "../../components/ResponsiveContainer/mediaQuery";
11
12
  export { responsiveCondition } from "../../components/ResponsiveContainer/condition";
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Loads the theme css file. It overrides the css custom properties that are generated during
3
+ * theme initialization, so it has to win the cascade against them - see `insertLinkTag` for how
4
+ * that order is established.
5
+ *
6
+ * A link applies at its position in the dom rather than at the time it finished loading, so the
7
+ * timeout below only decides how long app start waits - never which styles win.
8
+ *
9
+ * Resolves when the file loaded, when it failed, or when REQUEST_TIMEOUT elapsed - it never
10
+ * rejects, since the file is not guaranteed to exist and must not be able to block app start.
11
+ * @returns A promise that resolves once the file settled.
12
+ */
13
+ export declare const loadThemeCss: () => Promise<void>;
14
+ //# sourceMappingURL=loadThemeCss.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,112 @@
1
+ import { withScope, captureMessage, Severity as SentrySeverity } from '@sentry/browser';
2
+ import { appConfig } from '@shopgate/engage';
3
+ const REQUEST_TIMEOUT = 3000;
4
+ const LINK_TAG_ID = 'theme-css';
5
+ const INSERTION_POINT_SELECTOR = 'meta[name="theme-css-insertion-point"]';
6
+
7
+ /**
8
+ * Inserts the link at the theme css insertion point, which the html template declares between the
9
+ * emotion insertion point and the preview one. That position is what makes the cascade order
10
+ * structural rather than incidental: every tss style is pinned above it, and the admin preview
11
+ * pins its style tag to the anchor below it.
12
+ *
13
+ * Falls back to appending when the meta is absent - a head without the anchor still yields the
14
+ * desired order for anything that was already inserted, it just no longer guarantees it.
15
+ * @param linkTag The link tag to insert.
16
+ */
17
+ const insertLinkTag = linkTag => {
18
+ const insertionPoint = document.querySelector(INSERTION_POINT_SELECTOR);
19
+ if (!insertionPoint) {
20
+ document.head.appendChild(linkTag);
21
+ return;
22
+ }
23
+ insertionPoint.parentNode?.insertBefore(linkTag, insertionPoint.nextSibling);
24
+ };
25
+
26
+ /**
27
+ * Loads the theme css file. It overrides the css custom properties that are generated during
28
+ * theme initialization, so it has to win the cascade against them - see `insertLinkTag` for how
29
+ * that order is established.
30
+ *
31
+ * A link applies at its position in the dom rather than at the time it finished loading, so the
32
+ * timeout below only decides how long app start waits - never which styles win.
33
+ *
34
+ * Resolves when the file loaded, when it failed, or when REQUEST_TIMEOUT elapsed - it never
35
+ * rejects, since the file is not guaranteed to exist and must not be able to block app start.
36
+ * @returns A promise that resolves once the file settled.
37
+ */
38
+ export const loadThemeCss = () => new Promise(resolve => {
39
+ const {
40
+ themeCssUrl: href
41
+ } = appConfig;
42
+ if (!href) {
43
+ resolve();
44
+ return;
45
+ }
46
+ let settled = false;
47
+ let timeout;
48
+
49
+ /**
50
+ * Resolves the promise once, whichever of load / error / timeout comes first.
51
+ */
52
+ const settle = () => {
53
+ if (settled) {
54
+ return;
55
+ }
56
+ settled = true;
57
+ clearTimeout(timeout);
58
+ resolve();
59
+ };
60
+
61
+ /**
62
+ * Starts the fallback that keeps app start from waiting on a stalled request. The link is
63
+ * deliberately left in place when the timeout hits: it still applies once it eventually loads,
64
+ * it just no longer holds up app start.
65
+ */
66
+ const startTimeoutFallback = () => {
67
+ timeout = setTimeout(() => {
68
+ withScope(scope => {
69
+ scope.setLevel(SentrySeverity.Warning);
70
+ scope.setExtra('themeCssUrl', href);
71
+ scope.setExtra('timeout', REQUEST_TIMEOUT);
72
+ captureMessage('Fetching theme css took too long');
73
+ });
74
+ settle();
75
+ }, REQUEST_TIMEOUT);
76
+ };
77
+ const existingTag = document.querySelector(`#${LINK_TAG_ID}`);
78
+ if (existingTag) {
79
+ // Already loaded
80
+ if (existingTag.sheet) {
81
+ resolve();
82
+ return;
83
+ }
84
+
85
+ // Still loading - a stalled request must not leave the promise pending, so arm the timeout
86
+ // here too rather than relying on the load / error events alone.
87
+ existingTag.addEventListener('load', settle, {
88
+ once: true
89
+ });
90
+ existingTag.addEventListener('error', settle, {
91
+ once: true
92
+ });
93
+ startTimeoutFallback();
94
+ return;
95
+ }
96
+ const linkTag = document.createElement('link');
97
+ linkTag.rel = 'stylesheet';
98
+ linkTag.type = 'text/css';
99
+ linkTag.href = href;
100
+ linkTag.id = LINK_TAG_ID;
101
+ linkTag.onload = settle;
102
+ linkTag.onerror = () => {
103
+ withScope(scope => {
104
+ scope.setLevel(SentrySeverity.Error);
105
+ scope.setExtra('themeCssUrl', href);
106
+ captureMessage('Fetching theme css failed');
107
+ });
108
+ settle();
109
+ };
110
+ insertLinkTag(linkTag);
111
+ startTimeoutFallback();
112
+ });
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 PaletteColorsWithMain, type WithThemeProps, } from './theme';
2
+ export { ThemeProvider, createTheme, useActiveBreakpoint, useMediaQuery, useResponsiveValue, useTheme, useColorScheme, withTheme, type Theme, 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,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,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"}
@@ -38,7 +38,7 @@ injectGlobal({
38
38
  WebkitOverflowScrolling: 'touch',
39
39
  WebkitUserSelect: hasWebBridge() ? 'inherit' : 'none',
40
40
  userSelect: hasWebBridge() ? 'inherit' : 'none',
41
- color: 'var(--color-text-high-emphasis)'
41
+ color: 'var(--sg-palette-text-primary, var(--color-text-high-emphasis))'
42
42
  },
43
43
  '[data-pattern]': {
44
44
  height: '100% !important'
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createDefaultThemeOptions/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAInD;;;GAGG;AACH,eAAO,MAAM,yBAAyB,QAAO,YA6G3C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createDefaultThemeOptions/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAInD;;;GAGG;AACH,eAAO,MAAM,yBAAyB,QAAO,YAuH3C,CAAC"}
@@ -1,7 +1,8 @@
1
1
  import { getCSSCustomProp } from '@shopgate/engage/styles';
2
2
  import { themeConfig } from '@shopgate/engage';
3
3
  const {
4
- colors
4
+ colors,
5
+ settings
5
6
  } = themeConfig;
6
7
 
7
8
  /**
@@ -66,6 +67,11 @@ export const createDefaultThemeOptions = () => ({
66
67
  background: getCSSCustomProp('--color-button-cta') || getCSSCustomProp('--color-primary')
67
68
  }
68
69
  },
70
+ badge: {
71
+ vars: {
72
+ background: getCSSCustomProp('--color-secondary')
73
+ }
74
+ },
69
75
  snackbar: {
70
76
  vars: {
71
77
  background: '#323232'
@@ -88,6 +94,11 @@ export const createDefaultThemeOptions = () => ({
88
94
  badgeLeft: 'var(--tab-bar-item-badge-left, calc(50% + 20px))'
89
95
  }
90
96
  },
97
+ appBar: {
98
+ vars: {
99
+ background: settings?.['@shopgate/engage/components/AppBar']?.background || '#FFF'
100
+ }
101
+ },
91
102
  ratingStars: {
92
103
  vars: {
93
104
  filled: `var(--rating-stars-filled, ${getCSSCustomProp('--color-primary')})`,
@@ -131,6 +131,17 @@ export declare const componentsSchema: {
131
131
  readonly color: "";
132
132
  };
133
133
  };
134
+ readonly appBar: {
135
+ readonly vars: {
136
+ readonly background: "";
137
+ readonly color: "";
138
+ };
139
+ };
140
+ readonly badge: {
141
+ readonly vars: {
142
+ readonly background: "";
143
+ };
144
+ };
134
145
  readonly discountBadge: {
135
146
  readonly vars: {
136
147
  readonly background: "";
@@ -231,6 +242,17 @@ export declare const componentsDefaults: {
231
242
  color: (t: Theme) => string;
232
243
  };
233
244
  };
245
+ appBar: {
246
+ vars: {
247
+ background: string;
248
+ color: (t: Theme) => string;
249
+ };
250
+ };
251
+ badge: {
252
+ vars: {
253
+ background: (t: Theme) => string;
254
+ };
255
+ };
234
256
  discountBadge: {
235
257
  vars: {
236
258
  background: string;
@@ -1 +1 @@
1
- {"version":3,"file":"createComponents.types.d.ts","sourceRoot":"","sources":["../../../../styles/theme/create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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,GAC1E,mBAAmB,CAAC,MAAM,CAAC,C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G/D,MAAM,MAAM,UAAU,GAAG,oBAAoB,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEvE,MAAM,MAAM,aAAa,GAAG,uBAAuB,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
@@ -119,6 +119,17 @@ export const componentsSchema = {
119
119
  color: ''
120
120
  }
121
121
  },
122
+ appBar: {
123
+ vars: {
124
+ background: '',
125
+ color: ''
126
+ }
127
+ },
128
+ badge: {
129
+ vars: {
130
+ background: ''
131
+ }
132
+ },
122
133
  discountBadge: {
123
134
  vars: {
124
135
  background: ''
@@ -217,7 +228,18 @@ export const componentsDefaults = {
217
228
  ctaButton: {
218
229
  vars: {
219
230
  background: t => t.palette.primary.main,
220
- color: t => t.palette.primary.contrastText
231
+ color: t => t.contrastColor('var(--sg-components-ctaButton-background)')
232
+ }
233
+ },
234
+ appBar: {
235
+ vars: {
236
+ background: '#FFFFFF',
237
+ color: t => t.contrastColor('var(--sg-components-appBar-background)')
238
+ }
239
+ },
240
+ badge: {
241
+ vars: {
242
+ background: t => t.palette.secondary.main
221
243
  }
222
244
  },
223
245
  discountBadge: {
@@ -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,CA0G9C"}
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"}
@@ -40,7 +40,10 @@ export default function createCssVarsForColorSchemeThemes(colorSchemes, options)
40
40
  }), rest, cssVarPrefix);
41
41
 
42
42
  // Resolve component token values to actual CSS variable references
43
- const resolvedComponents = flattenComponentVars(resolveComponentsValues(componentsInput, vars));
43
+ const resolvedComponents = flattenComponentVars(resolveComponentsValues(componentsInput, {
44
+ ...rest,
45
+ ...vars
46
+ }));
44
47
  const {
45
48
  css: componentsCss,
46
49
  vars: componentsVars,
@@ -1,5 +1,6 @@
1
1
  import { type ThemeOptions, type ThemeInternal } from './types';
2
2
  export type { Theme, BaseTheme, ThemeInternal, ThemeOptions, Breakpoint, ColorSchemeName, ColorSchemeSelectorType, PaletteColorsWithMain, } from './types';
3
+ export { COLOR_SCHEME_NAMES } 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":"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,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,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,UAAS,YAAiB,KAAG,aAkExD,CAAC"}
@@ -9,6 +9,8 @@ import createThemeFromColorScheme from "./createThemeFromColorScheme";
9
9
  import createCssVarsForColorSchemeThemes from "./createCssVarsForColorSchemeThemes";
10
10
  import applyStyles from "./applyStyles";
11
11
  import { createGetColorSchemeSelector, createSetActiveColorScheme } from "./helpers";
12
+ export { COLOR_SCHEME_NAMES } from "./types";
13
+
12
14
  /**
13
15
  * Creates a theme object for the ThemeProvider.
14
16
  * @param options The theme options.
@@ -13,8 +13,8 @@ import type { Shape, ShapeOptions } from './createShape';
13
13
  import type { Shadows } from './shadows';
14
14
  export type { Breakpoint } from './createBreakpoints';
15
15
  export type { PaletteColorsWithMain } from './createPalette';
16
- declare const colorSchemes: readonly ["light", "dark"];
17
- 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
18
  declare const selectorTypes: readonly ["data", "class"];
19
19
  export type ColorSchemeSelectorType = (typeof selectorTypes)[number];
20
20
  type DeepPartial<T> = T extends object ? {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,UAAU,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,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,KAA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E,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG;QAAE,UAAU,EAAE,aAAa,CAAA;KAAC,CAAC;IACnE;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC,eAAe,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACvE;;;;;;;;;;;;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,4 @@
1
- const colorSchemes = ['light', 'dark'];
1
+ export const COLOR_SCHEME_NAMES = ['light', 'dark'];
2
2
  const selectorTypes = ['data', 'class'];
3
3
 
4
4
  /**
@@ -17,5 +17,4 @@ const selectorTypes = ['data', 'class'];
17
17
  /**
18
18
  * A record of themes for each color scheme. Each key is a color scheme name (e.g., 'light', 'dark'),
19
19
  * and the value is a fully-resolved color-scheme theme ({@link ColorSchemeTheme}).
20
- */
21
- export {};
20
+ */
@@ -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 list of `modes` the active theme actually provides.
4
5
  */
5
- declare const useColorScheme: () => import("../providers/ThemeProvider").ColorSchemeContextValue;
6
+ declare const useColorScheme: () => import("../providers/ColorSchemeContext").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,yEAAuC,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 list of `modes` the active theme actually provides.
7
8
  */
8
9
  const useColorScheme = () => useContext(ColorSchemeContext);
9
10
  export default useColorScheme;
@@ -1,6 +1,6 @@
1
1
  export { default as ThemeProvider } from './providers/ThemeProvider';
2
2
  export { createTheme } from './createTheme';
3
- export type { Theme, Breakpoint, PaletteColorsWithMain } from './createTheme';
3
+ export type { Theme, Breakpoint, PaletteColorsWithMain, ColorSchemeName, } from './createTheme';
4
4
  export { useActiveBreakpoint, useMediaQuery, useResponsiveValue, useTheme, useColorScheme, } from './hooks';
5
5
  export { withTheme, type WithThemeProps } from './hocs';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../styles/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,QAAQ,EACR,cAAc,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../styles/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EACV,KAAK,EAAE,UAAU,EAAE,qBAAqB,EAAE,eAAe,GAC1D,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,QAAQ,EACR,cAAc,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { type Dispatch, type SetStateAction } from 'react';
2
+ import { type ColorSchemeName } from '../createTheme';
3
+ export interface ColorSchemeContextValue {
4
+ /**
5
+ * The current color scheme (e.g., 'light' or 'dark')
6
+ */
7
+ mode: ColorSchemeName | null;
8
+ /**
9
+ * Function to update the color scheme
10
+ */
11
+ setMode: Dispatch<SetStateAction<ColorSchemeName | null>>;
12
+ /**
13
+ * The modes the active theme actually provides. Only these can be set - passing anything else
14
+ * to setMode has no effect.
15
+ */
16
+ modes: ColorSchemeName[];
17
+ }
18
+ export declare const ColorSchemeContext: import("react").Context<ColorSchemeContextValue>;
19
+ //# sourceMappingURL=ColorSchemeContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ColorSchemeContext.d.ts","sourceRoot":"","sources":["../../../../styles/theme/providers/ColorSchemeContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,IAAI,EAAE,eAAe,GAAG,IAAI,CAAC;IAC7B;;OAEG;IACH,OAAO,EAAE,QAAQ,CAAC,cAAc,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC,CAAC;IAC1D;;;OAGG;IACH,KAAK,EAAE,eAAe,EAAE,CAAC;CAC1B;AAED,eAAO,MAAM,kBAAkB,kDAI7B,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { createContext } from 'react';
2
+ export const ColorSchemeContext = /*#__PURE__*/createContext({
3
+ mode: 'light',
4
+ setMode: () => undefined,
5
+ modes: ['light']
6
+ });
@@ -1,16 +1,6 @@
1
- import { type Theme, type ThemeInternal, type ColorSchemeName } from '../createTheme';
2
- export interface ColorSchemeContextValue {
3
- /**
4
- * The current color scheme (e.g., 'light' or 'dark')
5
- */
6
- mode: ColorSchemeName | null;
7
- /**
8
- * Function to update the color scheme
9
- */
10
- setMode: React.Dispatch<React.SetStateAction<ColorSchemeName | null>>;
11
- }
1
+ import { type Theme, type ThemeInternal } from '../createTheme';
2
+ export { ColorSchemeContext, type ColorSchemeContextValue } from './ColorSchemeContext';
12
3
  export declare const ThemeContext: import("react").Context<Theme>;
13
- export declare const ColorSchemeContext: import("react").Context<ColorSchemeContextValue>;
14
4
  type ThemeProviderProps = {
15
5
  /**
16
6
  * The theme object to provide to the context.
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../../styles/theme/providers/ThemeProvider.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,aAAa,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtF,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,IAAI,EAAE,eAAe,GAAG,IAAI,CAAC;IAC7B;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC,CAAC;CACvE;AAED,eAAO,MAAM,YAAY,gCAAqC,CAAC;AAE/D,eAAO,MAAM,kBAAkB,kDAG7B,CAAC;AAwCH,KAAK,kBAAkB,GAAG;IACxB;;OAEG;IACH,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAA;mFAtCE,kBAAkB;AAwCrB,wBAAmC"}
1
+ {"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../../styles/theme/providers/ThemeProvider.tsx"],"names":[],"mappings":"AAUA,OAAO,EACL,KAAK,KAAK,EAAE,KAAK,aAAa,EAC/B,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAE,KAAK,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAExF,eAAO,MAAM,YAAY,gCAAqC,CAAC;AAwE/D,KAAK,kBAAkB,GAAG;IACxB;;OAEG;IACH,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAA;mFAtEE,kBAAkB;AAwErB,wBAAmC"}