cozy-ui 119.0.1 → 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,17 @@
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
+
8
+ ## [119.0.2](https://github.com/cozy/cozy-ui/compare/v119.0.1...v119.0.2) (2025-03-11)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **Cube:** Missed `ref` props ([d7c4010](https://github.com/cozy/cozy-ui/commit/d7c4010))
14
+
1
15
  ## [119.0.1](https://github.com/cozy/cozy-ui/compare/v119.0.0...v119.0.1) (2025-03-11)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "119.0.1",
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
 
@@ -4,10 +4,10 @@ import React from 'react'
4
4
  import SvgCubeTwake from './Cube_twake'
5
5
  import { isTwakeTheme } from '../helpers/isTwakeTheme'
6
6
 
7
- function SvgCube(props) {
8
- if (isTwakeTheme()) return SvgCubeTwake(props)
7
+ function SvgCube({ iconRef, ...props }) {
8
+ if (isTwakeTheme()) return SvgCubeTwake({ iconRef, ...props })
9
9
  return (
10
- <svg viewBox="0 0 16 16" {...props}>
10
+ <svg viewBox="0 0 16 16" {...props} ref={iconRef}>
11
11
  <path d="M1 11.009V5.5c0-.55.39-.773.872-.498l5.256 3.003c.476.272.872.944.872 1.495v5.508c0 .549-.39.772-.872.497l-5.256-3.003C1.396 12.231 1 11.56 1 11.01zm15 0c0 .55-.396 1.222-.872 1.494l-5.256 3.003c-.481.275-.872.052-.872-.497V9.5c0-.55.396-1.223.872-1.495l5.256-3.003c.481-.275.872-.052.872.498v5.508zM9.35 6.982c-.47.288-1.237.284-1.7 0l-4.8-2.954c-.47-.29-.463-.732.027-.995L7.623.477c.485-.261 1.264-.264 1.754 0l4.746 2.556c.485.26.49.71.027.995l-4.8 2.954z" />
12
12
  </svg>
13
13
  )
@@ -1,9 +1,9 @@
1
1
  // Automatically created, please run `scripts/generate-svgr-icon.sh assets/icons/twake/cube_twake.svg` to regenerate;
2
2
  import React from 'react'
3
3
 
4
- function SvgCubeTwake(props) {
4
+ function SvgCubeTwake({ iconRef, ...props }) {
5
5
  return (
6
- <svg viewBox="0 0 15 16" {...props}>
6
+ <svg viewBox="0 0 15 16" {...props} ref={iconRef}>
7
7
  <path d="M14.4 4L7.2 0 0 4v8l7.2 4 7.2-4V4zM7.2 1.832l4.728 2.624L9.52 5.792a3.213 3.213 0 00-4.64 0L2.472 4.456 7.2 1.832zm-.8 11.896l-4.8-2.664V5.808L4.104 7.2A3.193 3.193 0 006.4 11.096v2.632zM5.6 8c0-.88.72-1.6 1.6-1.6.88 0 1.6.72 1.6 1.6 0 .88-.72 1.6-1.6 1.6-.88 0-1.6-.72-1.6-1.6zM8 13.728v-2.624a3.193 3.193 0 002.4-3.096c0-.28-.032-.552-.104-.808L12.8 5.808v5.256L8 13.728z" />
8
8
  </svg>
9
9
  )
@@ -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)
@@ -1,14 +1,29 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
+ var _excluded = ["iconRef"];
5
+
6
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7
+
8
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
9
+
2
10
  // Automatically created, please run `scripts/generate-svgr-icon.sh assets/icons/ui/cube.svg` to regenerate
3
11
  import React from 'react';
4
12
  import SvgCubeTwake from "cozy-ui/transpiled/react/Icons/Cube_twake";
5
13
  import { isTwakeTheme } from "cozy-ui/transpiled/react/helpers/isTwakeTheme";
6
14
 
7
- function SvgCube(props) {
8
- if (isTwakeTheme()) return SvgCubeTwake(props);
15
+ function SvgCube(_ref) {
16
+ var iconRef = _ref.iconRef,
17
+ props = _objectWithoutProperties(_ref, _excluded);
18
+
19
+ if (isTwakeTheme()) return SvgCubeTwake(_objectSpread({
20
+ iconRef: iconRef
21
+ }, props));
9
22
  return /*#__PURE__*/React.createElement("svg", _extends({
10
23
  viewBox: "0 0 16 16"
11
- }, props), /*#__PURE__*/React.createElement("path", {
24
+ }, props, {
25
+ ref: iconRef
26
+ }), /*#__PURE__*/React.createElement("path", {
12
27
  d: "M1 11.009V5.5c0-.55.39-.773.872-.498l5.256 3.003c.476.272.872.944.872 1.495v5.508c0 .549-.39.772-.872.497l-5.256-3.003C1.396 12.231 1 11.56 1 11.01zm15 0c0 .55-.396 1.222-.872 1.494l-5.256 3.003c-.481.275-.872.052-.872-.497V9.5c0-.55.396-1.223.872-1.495l5.256-3.003c.481-.275.872-.052.872.498v5.508zM9.35 6.982c-.47.288-1.237.284-1.7 0l-4.8-2.954c-.47-.29-.463-.732.027-.995L7.623.477c.485-.261 1.264-.264 1.754 0l4.746 2.556c.485.26.49.71.027.995l-4.8 2.954z"
13
28
  }));
14
29
  }
@@ -1,11 +1,18 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["iconRef"];
2
4
  // Automatically created, please run `scripts/generate-svgr-icon.sh assets/icons/twake/cube_twake.svg` to regenerate;
3
5
  import React from 'react';
4
6
 
5
- function SvgCubeTwake(props) {
7
+ function SvgCubeTwake(_ref) {
8
+ var iconRef = _ref.iconRef,
9
+ props = _objectWithoutProperties(_ref, _excluded);
10
+
6
11
  return /*#__PURE__*/React.createElement("svg", _extends({
7
12
  viewBox: "0 0 15 16"
8
- }, props), /*#__PURE__*/React.createElement("path", {
13
+ }, props, {
14
+ ref: iconRef
15
+ }), /*#__PURE__*/React.createElement("path", {
9
16
  d: "M14.4 4L7.2 0 0 4v8l7.2 4 7.2-4V4zM7.2 1.832l4.728 2.624L9.52 5.792a3.213 3.213 0 00-4.64 0L2.472 4.456 7.2 1.832zm-.8 11.896l-4.8-2.664V5.808L4.104 7.2A3.193 3.193 0 006.4 11.096v2.632zM5.6 8c0-.88.72-1.6 1.6-1.6.88 0 1.6.72 1.6 1.6 0 .88-.72 1.6-1.6 1.6-.88 0-1.6-.72-1.6-1.6zM8 13.728v-2.624a3.193 3.193 0 002.4-3.096c0-.28-.032-.552-.104-.808L12.8 5.808v5.256L8 13.728z"
10
17
  }));
11
18
  }
@@ -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