@crystaldesign/diva-core 26.2.0-beta.9 → 26.2.0-rc.0

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.
@@ -1,4 +1,4 @@
1
- import { s as styleInject, u as useDivaCoreContext } from './index-19fabeb5.js';
1
+ import { s as styleInject, u as useDivaCoreContext } from './index-1cf2c784.js';
2
2
  import { useState, useEffect, useCallback } from 'react';
3
3
  import { observer } from 'mobx-react-lite';
4
4
  import Button from '@mui/material/Button';
@@ -45,7 +45,7 @@ import { actions } from '@storybook/addon-actions';
45
45
  import * as Styles from '@mui/styles';
46
46
 
47
47
  (function() {
48
- const env = {"STAGE":"production","VERSION":"26.2.0-beta.9"};
48
+ const env = {"STAGE":"production","VERSION":"26.2.0-rc.0"};
49
49
  try {
50
50
  if (process) {
51
51
  process.env = Object.assign({}, process.env);
@@ -2041,19 +2041,48 @@ function buildResizeObserver(ref, onResize) {
2041
2041
  return resizeObserver;
2042
2042
  }
2043
2043
 
2044
+ var THEME_VARIABLES = [['--diva-theme-palette-primary-main', function (t) {
2045
+ return t.palette.primary.main;
2046
+ }], ['--diva-theme-palette-primary-dark', function (t) {
2047
+ return t.palette.primary.dark;
2048
+ }], ['--diva-theme-palette-primary-light', function (t) {
2049
+ return t.palette.primary.light;
2050
+ }], ['--diva-theme-palette-primary-contrast-text', function (t) {
2051
+ return t.palette.primary.contrastText;
2052
+ }], ['--diva-theme-palette-secondary-main', function (t) {
2053
+ return t.palette.secondary.main;
2054
+ }], ['--diva-theme-palette-secondary-dark', function (t) {
2055
+ return t.palette.secondary.dark;
2056
+ }], ['--diva-theme-palette-secondary-light', function (t) {
2057
+ return t.palette.secondary.light;
2058
+ }], ['--diva-theme-palette-secondary-contrast-text', function (t) {
2059
+ return t.palette.secondary.contrastText;
2060
+ }], ['--diva-theme-palette-text-primary', function (t) {
2061
+ return t.palette.text.primary;
2062
+ }], ['--diva-theme-palette-text-secondary', function (t) {
2063
+ return t.palette.text.secondary;
2064
+ }], ['--diva-typography-font-family', function (t) {
2065
+ return t.typography.fontFamily;
2066
+ }], ['font-family', function (t) {
2067
+ return t.typography.fontFamily;
2068
+ }]];
2069
+ function applyToElement(element, theme) {
2070
+ THEME_VARIABLES.forEach(function (_ref) {
2071
+ var _ref2 = _slicedToArray(_ref, 2),
2072
+ name = _ref2[0],
2073
+ getValue = _ref2[1];
2074
+ element.style.setProperty(name, getValue(theme));
2075
+ });
2076
+ }
2077
+
2078
+ /**
2079
+ * Applies theme as CSS variables to the given element and to document.body.
2080
+ * Body is included so portaled content (e.g. MUI Drawer without container) inherits the variables.
2081
+ */
2044
2082
  function updateCssThemeVariables (ref, theme) {
2045
- ref.style.setProperty('--diva-theme-palette-primary-main', theme.palette.primary.main);
2046
- ref.style.setProperty('--diva-theme-palette-primary-dark', theme.palette.primary.dark);
2047
- ref.style.setProperty('--diva-theme-palette-primary-light', theme.palette.primary.light);
2048
- ref.style.setProperty('--diva-theme-palette-primary-contrast-text', theme.palette.primary.contrastText);
2049
- ref.style.setProperty('--diva-theme-palette-secondary-main', theme.palette.secondary.main);
2050
- ref.style.setProperty('--diva-theme-palette-secondary-dark', theme.palette.secondary.dark);
2051
- ref.style.setProperty('--diva-theme-palette-secondary-light', theme.palette.secondary.light);
2052
- ref.style.setProperty('--diva-theme-palette-secondary-contrast-text', theme.palette.secondary.contrastText);
2053
- ref.style.setProperty('--diva-theme-palette-text-primary', theme.palette.text.primary);
2054
- ref.style.setProperty('--diva-theme-palette-text-secondary', theme.palette.text.secondary);
2055
- ref.style.setProperty('--diva-typography-font-family', theme.typography.fontFamily);
2056
- ref.style.setProperty('font-family', theme.typography.fontFamily);
2083
+ if (typeof document !== 'undefined') {
2084
+ applyToElement(document.body, theme);
2085
+ }
2057
2086
  }
2058
2087
 
2059
2088
  var _excluded$4 = ["openFrom"],
@@ -9896,7 +9925,7 @@ var DrawerMenu$1 = observer(DrawerMenu);
9896
9925
  function ownKeys$4(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
9897
9926
  function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
9898
9927
  var LazyModals$1 = /*#__PURE__*/React.lazy(function () {
9899
- return import('./ModalsWrapper-84cd9689.js');
9928
+ return import('./ModalsWrapper-d6ba13cc.js');
9900
9929
  });
9901
9930
  function Fullscreen(_ref) {
9902
9931
  var inAbsoluteFullscreen = _ref.inAbsoluteFullscreen;
@@ -10356,10 +10385,10 @@ function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymb
10356
10385
  function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
10357
10386
  var LOG$2 = getLogger('Framework', 'Root');
10358
10387
  var LazyAuth = /*#__PURE__*/React.lazy(function () {
10359
- return import('./index-3811cb37.js');
10388
+ return import('./index-4e34167f.js');
10360
10389
  });
10361
10390
  var LazyModals = /*#__PURE__*/React.lazy(function () {
10362
- return import('./ModalsWrapper-84cd9689.js');
10391
+ return import('./ModalsWrapper-d6ba13cc.js');
10363
10392
  });
10364
10393
  function ContentComponent() {
10365
10394
  var context = useDivaCoreContext();
@@ -1,4 +1,4 @@
1
- import { s as styleInject, u as useDivaCoreContext, g as getLogger } from './index-19fabeb5.js';
1
+ import { s as styleInject, u as useDivaCoreContext, g as getLogger } from './index-1cf2c784.js';
2
2
  import { forwardRef, useState, useRef, useEffect, useMemo } from 'react';
3
3
  import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
4
4
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
@@ -1,4 +1,4 @@
1
- export { c as AnalyticsHandler, A as AuthorizationHandler, e as ClientArticleHandler, C as Content, f as DivaMockProvider, D as DrawerMenuComponent, H as HelpButton, O as ONE_DAY_UNIX, d as OrganizationHandler, P as ProductHandler, R as RequestStatus, S as SupportHandler, b as default, g as getLogger, i as i18n, h as storyBookCoreMock, a as useDivaCore } from './index-19fabeb5.js';
1
+ export { c as AnalyticsHandler, A as AuthorizationHandler, e as ClientArticleHandler, C as Content, f as DivaMockProvider, D as DrawerMenuComponent, H as HelpButton, O as ONE_DAY_UNIX, d as OrganizationHandler, P as ProductHandler, R as RequestStatus, S as SupportHandler, b as default, g as getLogger, i as i18n, h as storyBookCoreMock, a as useDivaCore } from './index-1cf2c784.js';
2
2
  export { DivaError, default as DivaUtils } from '@crystaldesign/diva-utils';
3
3
  export { Trans, useTranslation } from 'react-i18next';
4
4
  export * from '@crystaldesign/basket-model';
@@ -1,3 +1,7 @@
1
1
  import { Theme } from '../types';
2
+ /**
3
+ * Applies theme as CSS variables to the given element and to document.body.
4
+ * Body is included so portaled content (e.g. MUI Drawer without container) inherits the variables.
5
+ */
2
6
  export default function (ref: HTMLDivElement, theme: Theme): void;
3
7
  //# sourceMappingURL=updateCssThemeVariables.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"updateCssThemeVariables.d.ts","sourceRoot":"","sources":["../../../../../src/utils/updateCssThemeVariables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,MAAM,CAAC,OAAO,WAAW,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,QAazD"}
1
+ {"version":3,"file":"updateCssThemeVariables.d.ts","sourceRoot":"","sources":["../../../../../src/utils/updateCssThemeVariables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAuBjC;;;GAGG;AACH,MAAM,CAAC,OAAO,WAAW,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,QAIzD"}