cozy-ui 121.7.0 → 121.8.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cozy-ui.min.css +1 -1
  3. package/dist/cozy-ui.utils.min.css +1 -1
  4. package/package.json +1 -1
  5. package/react/Badge/Readme.md +2 -2
  6. package/react/InfosBadge/index.jsx +12 -9
  7. package/react/MuiCozyTheme/makeTheme.jsx +2 -0
  8. package/react/MuiCozyTheme/overrides/makeLightNormalOverrides.js +1 -0
  9. package/react/SquareAppIcon/Readme.md +9 -7
  10. package/react/SquareAppIcon/__snapshots__/SquareAppIcon.spec.js.snap +9 -9
  11. package/react/SquareAppIcon/index.jsx +42 -18
  12. package/react/SquareAppIcon/styles.styl +7 -1
  13. package/react/SquareAppIcon/styles_twake.styl +136 -0
  14. package/react/Typography/Readme.md +1 -0
  15. package/react/providers/CozyTheme/DumbCozyTheme.jsx +1 -0
  16. package/react/providers/CozyTheme/index.jsx +7 -2
  17. package/stylus/settings/themes/light-normal.styl +0 -2
  18. package/theme/palette_twake.json +1 -1
  19. package/transpiled/react/InfosBadge/index.js +19 -21
  20. package/transpiled/react/MuiCozyTheme/makeTheme.js +2 -0
  21. package/transpiled/react/MuiCozyTheme/overrides/makeDarkInvertedOverrides.d.ts +1 -0
  22. package/transpiled/react/MuiCozyTheme/overrides/makeDarkNormalOverrides.d.ts +1 -0
  23. package/transpiled/react/MuiCozyTheme/overrides/makeLightInvertedOverrides.d.ts +1 -0
  24. package/transpiled/react/MuiCozyTheme/overrides/makeLightNormalOverrides.d.ts +1 -0
  25. package/transpiled/react/MuiCozyTheme/overrides/makeLightNormalOverrides.js +1 -0
  26. package/transpiled/react/MuiCozyTheme/overrides/twake/makeDarkInvertedOverrides.d.ts +1 -0
  27. package/transpiled/react/MuiCozyTheme/overrides/twake/makeDarkNormalOverrides.d.ts +1 -0
  28. package/transpiled/react/MuiCozyTheme/overrides/twake/makeLightInvertedOverrides.d.ts +1 -0
  29. package/transpiled/react/MuiCozyTheme/overrides/twake/makeLightNormalOverrides.d.ts +1 -0
  30. package/transpiled/react/SquareAppIcon/index.js +44 -18
  31. package/transpiled/react/providers/CozyTheme/DumbCozyTheme.js +1 -0
  32. package/transpiled/react/providers/CozyTheme/index.d.ts +1 -0
  33. package/transpiled/react/providers/CozyTheme/index.js +3 -2
  34. package/transpiled/react/stylesheet.css +1 -1
@@ -909,6 +909,7 @@ export function makeDarkNormalTwakeOverrides(theme: any): {
909
909
  badge: {
910
910
  boxSizing: string;
911
911
  padding: number;
912
+ borderRadius: string;
912
913
  '&.badgeBorder': {
913
914
  border: string;
914
915
  };
@@ -909,6 +909,7 @@ export function makeLightInvertedTwakeOverrides(theme: any): {
909
909
  badge: {
910
910
  boxSizing: string;
911
911
  padding: number;
912
+ borderRadius: string;
912
913
  '&.badgeBorder': {
913
914
  border: string;
914
915
  };
@@ -909,6 +909,7 @@ export function makeLightNormalTwakeOverrides(theme: any): {
909
909
  badge: {
910
910
  boxSizing: string;
911
911
  padding: number;
912
+ borderRadius: string;
912
913
  '&.badgeBorder': {
913
914
  border: string;
914
915
  };
@@ -7,7 +7,7 @@ import get from 'lodash/get';
7
7
  import PropTypes from 'prop-types';
8
8
  import React, { useEffect, useState } from 'react';
9
9
  import ListItemText from 'cozy-ui/transpiled/react/ListItemText';
10
- var styles = {
10
+ var stylesCozy = {
11
11
  "SquareAppIcon-wrapper": "styles__SquareAppIcon-wrapper___2SEuM",
12
12
  "SquareAppIcon-icon-container": "styles__SquareAppIcon-icon-container___39MRl",
13
13
  "SquareAppIcon-wrapper-ghost": "styles__SquareAppIcon-wrapper-ghost___1ZALZ",
@@ -20,6 +20,19 @@ var styles = {
20
20
  "isSuccess": "styles__isSuccess___I6nFq",
21
21
  "end-animation": "styles__end-animation___1O0b3"
22
22
  };
23
+ var stylesTwake = {
24
+ "SquareAppIcon-wrapper": "styles_twake__SquareAppIcon-wrapper___4P3Cx",
25
+ "SquareAppIcon-icon-container": "styles_twake__SquareAppIcon-icon-container___grFij",
26
+ "SquareAppIcon-wrapper-ghost": "styles_twake__SquareAppIcon-wrapper-ghost___3xelE",
27
+ "SquareAppIcon-icon-container-normal": "styles_twake__SquareAppIcon-icon-container-normal___1O1bk",
28
+ "SquareAppIcon-wrapper-maintenance": "styles_twake__SquareAppIcon-wrapper-maintenance___hoMUk",
29
+ "SquareAppIcon-wrapper-loading": "styles_twake__SquareAppIcon-wrapper-loading___AoTRM",
30
+ "SquareAppIcon-spinner": "styles_twake__SquareAppIcon-spinner___UOK0n",
31
+ "onEnd": "styles_twake__onEnd___GkZzo",
32
+ "isFailed": "styles_twake__isFailed___CO_WC",
33
+ "isSuccess": "styles_twake__isSuccess___sH4pb",
34
+ "end-animation": "styles_twake__end-animation___26Lyd"
35
+ };
23
36
  import AppIcon from "cozy-ui/transpiled/react/AppIcon";
24
37
  import Badge from "cozy-ui/transpiled/react/Badge";
25
38
  import Icon from "cozy-ui/transpiled/react/Icon";
@@ -31,17 +44,26 @@ import iconWarning from "cozy-ui/transpiled/react/Icons/WarningCircle";
31
44
  import InfosBadge from "cozy-ui/transpiled/react/InfosBadge";
32
45
  import Spinner from "cozy-ui/transpiled/react/Spinner";
33
46
  import Typography from "cozy-ui/transpiled/react/Typography";
47
+ import { isTwakeTheme } from "cozy-ui/transpiled/react/helpers/isTwakeTheme";
34
48
  import { nameToColor } from "cozy-ui/transpiled/react/legacy/Avatar/helpers";
49
+ import { useBreakpoints } from "cozy-ui/transpiled/react/providers/Breakpoints";
35
50
  import CozyTheme, { useCozyTheme } from "cozy-ui/transpiled/react/providers/CozyTheme";
36
51
  import { alpha, makeStyles } from "cozy-ui/transpiled/react/styles";
52
+ var styles = isTwakeTheme() ? stylesTwake : stylesCozy;
53
+
54
+ var makeTwakeColor = function makeTwakeColor(theme) {
55
+ return theme.variant === 'inverted' || theme.type === 'dark' ? 'var(--white)' : 'var(--black)';
56
+ };
57
+
37
58
  var useStyles = makeStyles(function (theme) {
38
59
  return {
39
60
  name: _defineProperty({
40
- color: 'var(--primaryTextColor)',
61
+ color: isTwakeTheme() ? makeTwakeColor(theme) : 'var(--primaryTextColor)',
62
+ textShadow: isTwakeTheme() ? theme.variant === 'inverted' || theme.type === 'dark' ? '0px 0px 10px rgba(0, 0, 0, 0.10), 0px 0px 2px rgba(0, 0, 0, 0.20), 0.5px 0.5px 1px rgba(0, 0, 0, 0.50)' : undefined : undefined,
41
63
  width: '5.5rem',
42
64
  textAlign: 'center',
43
- fontSize: '0.875rem',
44
- lineHeight: '1.188rem',
65
+ fontSize: isTwakeTheme() ? undefined : '0.875rem',
66
+ lineHeight: isTwakeTheme() ? undefined : '1.188rem',
45
67
  margin: '0.5rem 0.25rem 0 0.25rem',
46
68
  lineClamp: '2',
47
69
  boxOrient: 'vertical',
@@ -49,8 +71,8 @@ var useStyles = makeStyles(function (theme) {
49
71
  height: '2.375rem'
50
72
  }, theme.breakpoints.down('sm'), {
51
73
  width: '3.75rem',
52
- fontSize: '0.6875rem',
53
- lineHeight: '1rem',
74
+ fontSize: isTwakeTheme() ? undefined : '0.6875rem',
75
+ lineHeight: isTwakeTheme() ? undefined : '1rem',
54
76
  margin: '0.25rem 0.25rem 0 0.25rem',
55
77
  height: '2rem'
56
78
  }),
@@ -66,7 +88,7 @@ var useStyles = makeStyles(function (theme) {
66
88
  margin: 'auto'
67
89
  },
68
90
  shadow: {
69
- boxShadow: theme.shadows[1]
91
+ boxShadow: isTwakeTheme() ? undefined : theme.shadows[1]
70
92
  },
71
93
  errorIcon: {
72
94
  fill: 'var(--errorColor)',
@@ -79,9 +101,9 @@ var useStyles = makeStyles(function (theme) {
79
101
  display: 'flex',
80
102
  flexDirection: 'column',
81
103
  alignItems: 'center',
82
- width: '6rem'
104
+ minWidth: '6rem'
83
105
  }, theme.breakpoints.down('sm'), {
84
- width: '4.25rem'
106
+ minWidth: '4.25rem'
85
107
  }),
86
108
  detailedTileWrapper: {
87
109
  flexDirection: 'row',
@@ -122,6 +144,9 @@ export var SquareAppIcon = function SquareAppIcon(_ref2) {
122
144
  var _useCozyTheme = useCozyTheme(),
123
145
  themeVariant = _useCozyTheme.variant;
124
146
 
147
+ var _useBreakpoints = useBreakpoints(),
148
+ isMobile = _useBreakpoints.isMobile;
149
+
125
150
  var classes = useStyles();
126
151
  var appName = name || get(appIconProps, 'app.name') || get(appIconProps, 'app') || '';
127
152
  var letter = appName[0] || '';
@@ -142,7 +167,8 @@ export var SquareAppIcon = function SquareAppIcon(_ref2) {
142
167
  if (curr === 'loading' && (variant === 'default' || variant === undefined)) setAnimationState('success');
143
168
  prevVariant.current = variant;
144
169
  }, [variant]);
145
- var squareTheme = ['add', 'ghost'].includes(variant) ? themeVariant : 'normal';
170
+ var exceptionVariant = [isTwakeTheme() ? 'ghost' : 'add', 'ghost'];
171
+ var squareTheme = exceptionVariant.includes(variant) ? themeVariant : 'normal';
146
172
  return /*#__PURE__*/React.createElement("div", {
147
173
  "data-testid": "square-app-icon",
148
174
  className: cx(classes.tileWrapper, _defineProperty({}, classes.detailedTileWrapper, display === 'detailed'))
@@ -160,9 +186,9 @@ export var SquareAppIcon = function SquareAppIcon(_ref2) {
160
186
  variant: variant,
161
187
  animationState: animationState
162
188
  }), /*#__PURE__*/React.createElement(Badge, {
163
- className: cx(styles['SquareAppIcon-wrapper'], styles["SquareAppIcon-wrapper-".concat(variant)], (_cx3 = {}, _defineProperty(_cx3, classes.squareAppIconGhost, ['ghost', 'add'].includes(variant)), _defineProperty(_cx3, classes.shadow, !['add', 'ghost'].includes(variant)), _cx3)),
189
+ className: cx(styles['SquareAppIcon-wrapper'], styles["SquareAppIcon-wrapper-".concat(variant)], (_cx3 = {}, _defineProperty(_cx3, classes.squareAppIconGhost, exceptionVariant.includes(variant)), _defineProperty(_cx3, classes.shadow, !exceptionVariant.includes(variant)), _cx3)),
164
190
  badgeContent: variant === 'error' ? /*#__PURE__*/React.createElement(Icon, {
165
- size: "16",
191
+ size: 16,
166
192
  className: cx(classes.errorIcon),
167
193
  icon: iconWarning
168
194
  }) : '',
@@ -170,9 +196,7 @@ export var SquareAppIcon = function SquareAppIcon(_ref2) {
170
196
  withBorder: false,
171
197
  size: "large",
172
198
  overlap: "rectangular",
173
- style: variant === 'shortcut' && !IconContent ? {
174
- backgroundColor: nameToColor(name)
175
- } : null
199
+ style: variant === 'shortcut' && !IconContent ? _defineProperty({}, isTwakeTheme() ? 'background' : 'backgroundColor', nameToColor(name)) : null
176
200
  }, variant === 'shortcut' && !IconContent ? /*#__PURE__*/React.createElement(Typography, {
177
201
  className: classes.letter,
178
202
  variant: "h2",
@@ -183,17 +207,19 @@ export var SquareAppIcon = function SquareAppIcon(_ref2) {
183
207
  className: cx(styles['onEnd'], _defineProperty({}, styles['isSuccess'], animationState === 'success'), _defineProperty({}, styles['isFailed'], animationState === 'failed')),
184
208
  onAnimationEnd: handleAnimationEnd
185
209
  }, animationState && /*#__PURE__*/React.createElement(Icon, {
186
- size: "32",
210
+ size: 32,
187
211
  icon: animationState === 'success' ? IconCheckAnimated : SvgIconCrossAnimated
188
212
  })), variant === 'add' ? /*#__PURE__*/React.createElement(Icon, {
189
213
  icon: iconPlus,
190
214
  color: "var(--primaryColor)"
191
- }) : IconContent ? IconContent : /*#__PURE__*/React.createElement(AppIcon, appIconProps))))), display === 'detailed' ? /*#__PURE__*/React.createElement(ListItemText, {
215
+ }) : IconContent ? IconContent : isTwakeTheme() ? /*#__PURE__*/React.createElement("div", {
216
+ className: "u-w-1-half-s u-h-1-half-s u-w-2 u-h-2"
217
+ }, /*#__PURE__*/React.createElement(AppIcon, appIconProps)) : /*#__PURE__*/React.createElement(AppIcon, appIconProps))))), display === 'detailed' ? /*#__PURE__*/React.createElement(ListItemText, {
192
218
  primary: appName,
193
219
  secondary: description
194
220
  }) : /*#__PURE__*/React.createElement(Typography, {
195
221
  className: cx(classes.name, _defineProperty({}, classes.nameInverted, themeVariant === 'inverted'), 'u-spacellipsis'),
196
- variant: "h6",
222
+ variant: isTwakeTheme() ? isMobile ? 'overline' : 'h6' : 'h6',
197
223
  align: "center"
198
224
  }, appName));
199
225
  };
@@ -28,6 +28,7 @@ var DumbCozyTheme = function DumbCozyTheme(_ref) {
28
28
  value: {
29
29
  type: selfThemeType,
30
30
  variant: selfThemeVariant,
31
+ name: uiThemeName,
31
32
  isLight: selfThemeType === 'light'
32
33
  }
33
34
  }, /*#__PURE__*/React.createElement(MuiCozyTheme, {
@@ -3,6 +3,7 @@ export function useCozyTheme(): {
3
3
  type: 'light' | 'dark';
4
4
  variant: 'normal' | 'inverted';
5
5
  isLight: boolean;
6
+ name: 'Twake' | 'Cozy';
6
7
  };
7
8
  export default CozyTheme;
8
9
  import React from "react";
@@ -8,7 +8,7 @@ import DumbCozyTheme from "cozy-ui/transpiled/react/providers/CozyTheme/DumbCozy
8
8
  import { isRsg } from "cozy-ui/transpiled/react/hooks/useSetFlagshipUi/helpers";
9
9
  export var CozyThemeContext = /*#__PURE__*/createContext();
10
10
  /**
11
- * @returns {{ type: 'light'|'dark', variant: 'normal'|'inverted', isLight: boolean }}
11
+ * @returns {{ type: 'light'|'dark', variant: 'normal'|'inverted', isLight: boolean, name: 'Twake'|'Cozy' }}
12
12
  */
13
13
 
14
14
  export var useCozyTheme = function useCozyTheme() {
@@ -19,7 +19,8 @@ export var useCozyTheme = function useCozyTheme() {
19
19
  return {
20
20
  type: 'light',
21
21
  variant: 'normal',
22
- isLight: true
22
+ isLight: true,
23
+ name: 'Cozy'
23
24
  };
24
25
  }
25
26