cozy-ui 119.0.2 → 119.0.3

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [119.0.3](https://github.com/cozy/cozy-ui/compare/v119.0.2...v119.0.3) (2025-03-11)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Now rely on method instead of local storage to get theme name ([74118ec](https://github.com/cozy/cozy-ui/commit/74118ec))
7
+
1
8
  ## [119.0.2](https://github.com/cozy/cozy-ui/compare/v119.0.1...v119.0.2) (2025-03-11)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "119.0.2",
3
+ "version": "119.0.3",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -3,11 +3,12 @@ import cx from 'classnames'
3
3
  import React from 'react'
4
4
 
5
5
  import { useDialogEffects } from './DialogEffects'
6
+ import { isTwakeTheme } from '../helpers/isTwakeTheme'
6
7
  import { useCozyTheme } from '../providers/CozyTheme'
7
8
 
8
9
  const Dialog = ({ className, ...props }) => {
9
10
  const { type, variant } = useCozyTheme()
10
- const uiThemeName = localStorage.getItem('ui-theme-name') || 'Cozy'
11
+ const uiThemeName = isTwakeTheme() ? 'Twake' : 'Cozy'
11
12
 
12
13
  useDialogEffects(props.open, props.fullScreen)
13
14
 
@@ -11,6 +11,7 @@ import { makeDarkNormalTwakeOverrides } from './overrides/twake/makeDarkNormalOv
11
11
  import { makeLightInvertedTwakeOverrides } from './overrides/twake/makeLightInvertedOverrides'
12
12
  import { makeLightNormalTwakeOverrides } from './overrides/twake/makeLightNormalOverrides'
13
13
  import isTesting from '../helpers/isTesting'
14
+ import { isTwakeTheme } from '../helpers/isTwakeTheme'
14
15
  import { createTheme } from '../styles'
15
16
  import { createNodeWithThemeCssVars } from '../utils/color'
16
17
 
@@ -60,7 +61,7 @@ const themesCommonConfig = {
60
61
  }
61
62
 
62
63
  export const makeTheme = (type, variant) => {
63
- const uiThemeName = localStorage.getItem('ui-theme-name') || 'Cozy'
64
+ const uiThemeName = isTwakeTheme() ? 'Twake' : 'Cozy'
64
65
  // to hold the values of css variables, recoverable by getCssVariableValue()
65
66
  createNodeWithThemeCssVars(type, variant)
66
67
 
@@ -4,6 +4,7 @@ import React from 'react'
4
4
 
5
5
  import { CozyThemeContext } from './index'
6
6
  import MuiCozyTheme from '../../MuiCozyTheme'
7
+ import { isTwakeTheme } from '../../helpers/isTwakeTheme'
7
8
  import useMediaQuery from '../../hooks/useMediaQuery'
8
9
 
9
10
  const DumbCozyTheme = ({
@@ -15,7 +16,7 @@ const DumbCozyTheme = ({
15
16
  }) => {
16
17
  const uiThemeType = localStorage.getItem('ui-theme-type') // use only for cozy-ui documentation and argos screenshots
17
18
  const uiThemeVariant = localStorage.getItem('ui-theme-variant') // use only for cozy-ui documentation and argos screenshots
18
- const uiThemeName = localStorage.getItem('ui-theme-name') || 'Cozy'
19
+ const uiThemeName = isTwakeTheme() ? 'Twake' : 'Cozy'
19
20
 
20
21
  const deviceThemeType = useMediaQuery('(prefers-color-scheme: dark)')
21
22
  ? 'dark'
@@ -1,5 +1,7 @@
1
+ import { isTwakeTheme } from '../helpers/isTwakeTheme'
2
+
1
3
  const getThemeNodeClassName = (type, variant) => {
2
- const uiTypeName = localStorage.getItem('ui-theme-name') || 'Cozy'
4
+ const uiTypeName = isTwakeTheme() ? 'Twake' : 'Cozy'
3
5
 
4
6
  return `${uiTypeName}Theme--${type}-${variant}`
5
7
  }
@@ -5,6 +5,7 @@ import { default as MUIDialog } from '@material-ui/core/Dialog';
5
5
  import cx from 'classnames';
6
6
  import React from 'react';
7
7
  import { useDialogEffects } from "cozy-ui/transpiled/react/Dialog/DialogEffects";
8
+ import { isTwakeTheme } from "cozy-ui/transpiled/react/helpers/isTwakeTheme";
8
9
  import { useCozyTheme } from "cozy-ui/transpiled/react/providers/CozyTheme";
9
10
 
10
11
  var Dialog = function Dialog(_ref) {
@@ -15,7 +16,7 @@ var Dialog = function Dialog(_ref) {
15
16
  type = _useCozyTheme.type,
16
17
  variant = _useCozyTheme.variant;
17
18
 
18
- var uiThemeName = localStorage.getItem('ui-theme-name') || 'Cozy';
19
+ var uiThemeName = isTwakeTheme() ? 'Twake' : 'Cozy';
19
20
  useDialogEffects(props.open, props.fullScreen);
20
21
  return /*#__PURE__*/React.createElement(MUIDialog, _extends({
21
22
  className: cx("".concat(uiThemeName, "Theme--").concat(type, "-").concat(variant), className)
@@ -17,6 +17,7 @@ import { makeDarkNormalTwakeOverrides } from "cozy-ui/transpiled/react/MuiCozyTh
17
17
  import { makeLightInvertedTwakeOverrides } from "cozy-ui/transpiled/react/MuiCozyTheme/overrides/twake/makeLightInvertedOverrides";
18
18
  import { makeLightNormalTwakeOverrides } from "cozy-ui/transpiled/react/MuiCozyTheme/overrides/twake/makeLightNormalOverrides";
19
19
  import isTesting from "cozy-ui/transpiled/react/helpers/isTesting";
20
+ import { isTwakeTheme } from "cozy-ui/transpiled/react/helpers/isTwakeTheme";
20
21
  import { createTheme } from "cozy-ui/transpiled/react/styles";
21
22
  import { createNodeWithThemeCssVars } from "cozy-ui/transpiled/react/utils/color";
22
23
 
@@ -72,7 +73,7 @@ var themesCommonConfig = _objectSpread({
72
73
  });
73
74
 
74
75
  export var makeTheme = function makeTheme(type, variant) {
75
- var uiThemeName = localStorage.getItem('ui-theme-name') || 'Cozy'; // to hold the values of css variables, recoverable by getCssVariableValue()
76
+ var uiThemeName = isTwakeTheme() ? 'Twake' : 'Cozy'; // to hold the values of css variables, recoverable by getCssVariableValue()
76
77
 
77
78
  createNodeWithThemeCssVars(type, variant);
78
79
  var palette = makePalette(type, variant);
@@ -4,6 +4,7 @@ import PropTypes from 'prop-types';
4
4
  import React from 'react';
5
5
  import { CozyThemeContext } from "cozy-ui/transpiled/react/providers/CozyTheme/index";
6
6
  import MuiCozyTheme from "cozy-ui/transpiled/react/MuiCozyTheme";
7
+ import { isTwakeTheme } from "cozy-ui/transpiled/react/helpers/isTwakeTheme";
7
8
  import useMediaQuery from "cozy-ui/transpiled/react/hooks/useMediaQuery";
8
9
 
9
10
  var DumbCozyTheme = function DumbCozyTheme(_ref) {
@@ -18,7 +19,7 @@ var DumbCozyTheme = function DumbCozyTheme(_ref) {
18
19
 
19
20
  var uiThemeVariant = localStorage.getItem('ui-theme-variant'); // use only for cozy-ui documentation and argos screenshots
20
21
 
21
- var uiThemeName = localStorage.getItem('ui-theme-name') || 'Cozy';
22
+ var uiThemeName = isTwakeTheme() ? 'Twake' : 'Cozy';
22
23
  var deviceThemeType = useMediaQuery('(prefers-color-scheme: dark)') ? 'dark' : 'light';
23
24
  var filteredSettingsThemeType = ['light', 'dark'].includes(settingsThemeType) ? settingsThemeType : undefined;
24
25
  var selfThemeType = uiThemeType || filteredSettingsThemeType || deviceThemeType;
@@ -1,5 +1,7 @@
1
+ import { isTwakeTheme } from "cozy-ui/transpiled/react/helpers/isTwakeTheme";
2
+
1
3
  var getThemeNodeClassName = function getThemeNodeClassName(type, variant) {
2
- var uiTypeName = localStorage.getItem('ui-theme-name') || 'Cozy';
4
+ var uiTypeName = isTwakeTheme() ? 'Twake' : 'Cozy';
3
5
  return "".concat(uiTypeName, "Theme--").concat(type, "-").concat(variant);
4
6
  };
5
7