cozy-ui 121.7.0 → 121.9.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.
- package/CHANGELOG.md +26 -0
- package/dist/cozy-ui.min.css +2 -2
- package/dist/cozy-ui.utils.min.css +1 -1
- package/package.json +1 -1
- package/react/Badge/Readme.md +2 -2
- package/react/InfosBadge/index.jsx +12 -9
- package/react/MuiCozyTheme/makeTheme.jsx +2 -0
- package/react/MuiCozyTheme/overrides/makeLightNormalOverrides.js +1 -0
- package/react/SquareAppIcon/Readme.md +9 -7
- package/react/SquareAppIcon/__snapshots__/SquareAppIcon.spec.js.snap +9 -9
- package/react/SquareAppIcon/index.jsx +42 -18
- package/react/SquareAppIcon/styles.styl +7 -1
- package/react/SquareAppIcon/styles_twake.styl +136 -0
- package/react/Typography/Readme.md +1 -0
- package/react/providers/CozyTheme/DumbCozyTheme.jsx +1 -0
- package/react/providers/CozyTheme/index.jsx +7 -2
- package/stylus/settings/shadows.styl +3 -0
- package/stylus/settings/themes/light-normal.styl +0 -2
- package/stylus/utilities/bgcolor.styl +3 -0
- package/stylus/utilities/elevation.styl +3 -0
- package/theme/palette_twake.json +1 -1
- package/transpiled/react/InfosBadge/index.js +19 -21
- package/transpiled/react/MuiCozyTheme/makeTheme.js +2 -0
- package/transpiled/react/MuiCozyTheme/overrides/makeDarkInvertedOverrides.d.ts +1 -0
- package/transpiled/react/MuiCozyTheme/overrides/makeDarkNormalOverrides.d.ts +1 -0
- package/transpiled/react/MuiCozyTheme/overrides/makeLightInvertedOverrides.d.ts +1 -0
- package/transpiled/react/MuiCozyTheme/overrides/makeLightNormalOverrides.d.ts +1 -0
- package/transpiled/react/MuiCozyTheme/overrides/makeLightNormalOverrides.js +1 -0
- package/transpiled/react/MuiCozyTheme/overrides/twake/makeDarkInvertedOverrides.d.ts +1 -0
- package/transpiled/react/MuiCozyTheme/overrides/twake/makeDarkNormalOverrides.d.ts +1 -0
- package/transpiled/react/MuiCozyTheme/overrides/twake/makeLightInvertedOverrides.d.ts +1 -0
- package/transpiled/react/MuiCozyTheme/overrides/twake/makeLightNormalOverrides.d.ts +1 -0
- package/transpiled/react/SquareAppIcon/index.js +44 -18
- package/transpiled/react/providers/CozyTheme/DumbCozyTheme.js +1 -0
- package/transpiled/react/providers/CozyTheme/index.d.ts +1 -0
- package/transpiled/react/providers/CozyTheme/index.js +3 -2
- package/transpiled/react/stylesheet.css +1 -1
|
@@ -824,6 +824,7 @@ export var makeLightNormalOverrides = function makeLightNormalOverrides(theme) {
|
|
|
824
824
|
badge: {
|
|
825
825
|
boxSizing: 'content-box',
|
|
826
826
|
padding: 0,
|
|
827
|
+
borderRadius: '100%',
|
|
827
828
|
'&.badgeBorder': {
|
|
828
829
|
border: "2px solid ".concat(theme.palette.background.paper)
|
|
829
830
|
},
|
|
@@ -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
|
|
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
|
-
|
|
104
|
+
minWidth: '6rem'
|
|
83
105
|
}, theme.breakpoints.down('sm'), {
|
|
84
|
-
|
|
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
|
|
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,
|
|
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:
|
|
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:
|
|
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 :
|
|
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:
|
|
222
|
+
variant: isTwakeTheme() ? isMobile ? 'overline' : 'h6' : 'h6',
|
|
197
223
|
align: "center"
|
|
198
224
|
}, appName));
|
|
199
225
|
};
|
|
@@ -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
|
|