cozy-ui 113.2.0 → 113.3.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 CHANGED
@@ -1,3 +1,10 @@
1
+ # [113.3.0](https://github.com/cozy/cozy-ui/compare/v113.2.0...v113.3.0) (2024-11-18)
2
+
3
+
4
+ ### Features
5
+
6
+ * **SquareAppIcon:** Hide shortcut badges for a more app like feel ([49d8438](https://github.com/cozy/cozy-ui/commit/49d8438))
7
+
1
8
  # [113.2.0](https://github.com/cozy/cozy-ui/compare/v113.1.0...v113.2.0) (2024-11-14)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "113.2.0",
3
+ "version": "113.3.0",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -14,12 +14,14 @@ const { variant } = useCozyTheme()
14
14
  const app = { name: "Test App", slug: "testapp", type: "app" }
15
15
  const [isLoading, setLoading] = React.useState(false)
16
16
  const [isError, setIsError] = React.useState(false)
17
+ const [isShortcutBadgeHide, setShortcutBadgeHide] = React.useState(false)
17
18
 
18
19
  ;
19
20
 
20
21
  <>
21
22
  <Button className="u-mb-1 u-mr-1" label="Toggle Loading" onClick={() => setLoading(!isLoading)} />
22
- <Button className="u-mb-1" label="Toggle Loading Error" onClick={() => setIsError(!isError)} />
23
+ <Button className="u-mb-1 u-mr-1" label="Toggle Loading Error" onClick={() => setIsError(!isError)} />
24
+ <Button className="u-mb-1" label="Hide shortcut badge" onClick={() => setShortcutBadgeHide(!isShortcutBadgeHide)} />
23
25
 
24
26
  <Grid container spacing={1} style={{ background: variant === 'inverted' ? `center / cover no-repeat url(${cloudWallpaper})` : 'white' }}
25
27
  >
@@ -39,7 +41,7 @@ const [isError, setIsError] = React.useState(false)
39
41
  <SquareAppIcon app="testapp" name="No Account long name very very very very long" variant="ghost" />
40
42
  </Grid>
41
43
  <Grid item>
42
- <SquareAppIcon name="Shortcut" variant="shortcut" />
44
+ <SquareAppIcon name="Shortcut" variant="shortcut" hideShortcutBadge={isShortcutBadgeHide} />
43
45
  </Grid>
44
46
  <Grid item>
45
47
  <SquareAppIcon IconContent={<Icon icon={CozyIcon} size="48" />} name="Loading" variant={isLoading ? 'loading' : 'default'} />
@@ -58,7 +60,7 @@ const [isError, setIsError] = React.useState(false)
58
60
  width={32}
59
61
  height={32}
60
62
  alt={"Shortcut"}
61
- />}/>
63
+ />} hideShortcutBadge={isShortcutBadgeHide} />
62
64
  </Grid>
63
65
  <Grid item>
64
66
  <SquareAppIcon name="Custom Icon" IconContent={<Icon icon={CozyIcon} size="48" />} />
@@ -103,40 +105,78 @@ const { variant } = useCozyTheme()
103
105
  const app = { name: "Test App", slug: "testapp", type: "app" }
104
106
  const [isLoading, setLoading] = React.useState(false)
105
107
  const [isError, setIsError] = React.useState(false)
108
+ const [isShortcutBadgeHide, setShortcutBadgeHide] = React.useState(false)
106
109
 
107
110
  ;
108
111
 
109
112
  <>
110
113
  <Button className="u-mb-1 u-mr-1" label="Toggle Loading" onClick={() => setLoading(!isLoading)} />
111
- <Button className="u-mb-1" label="Toggle Loading Error" onClick={() => setIsError(!isError)} />
114
+ <Button className="u-mb-1 u-mr-1" label="Toggle Loading Error" onClick={() => setIsError(!isError)} />
115
+ <Button className="u-mb-1" label="Hide shortcut badge" onClick={() => setShortcutBadgeHide(!isShortcutBadgeHide)} />
112
116
 
113
117
  <Grid container spacing={4}>
114
118
  <Grid item xs={4}>
115
- <SquareAppIcon display="detailed" name="Weather Wiz" description="Get real-time weather updates and forecasts" />
119
+ <SquareAppIcon
120
+ display="detailed"
121
+ name="Weather Wiz"
122
+ description="Get real-time weather updates and forecasts" />
116
123
  </Grid>
117
124
  <Grid item xs={4}>
118
- <SquareAppIcon display="detailed" name="Meal Planner" description="Plan your meals with nutrition tracking" variant="maintenance" />
125
+ <SquareAppIcon
126
+ display="detailed"
127
+ name="Meal Planner"
128
+ description="Plan your meals with nutrition tracking"
129
+ variant="maintenance" />
119
130
  </Grid>
120
131
  <Grid item xs={4}>
121
- <SquareAppIcon display="detailed" name="Travel Tracker" description="Explore and document your travel adventures" variant="error" />
132
+ <SquareAppIcon
133
+ display="detailed"
134
+ name="Travel Tracker"
135
+ description="Explore and document your travel adventures"
136
+ variant="error" />
122
137
  </Grid>
123
138
  <Grid item xs={4}>
124
- <SquareAppIcon display="detailed" name="Fitness Friend" variant="add" />
139
+ <SquareAppIcon
140
+ display="detailed"
141
+ name="Fitness Friend"
142
+ variant="add" />
125
143
  </Grid>
126
144
  <Grid item xs={4}>
127
- <SquareAppIcon display="detailed" name="Mindful Moments" description="Guided meditations for daily mindfulness" variant="ghost" />
145
+ <SquareAppIcon
146
+ display="detailed"
147
+ name="Mindful Moments"
148
+ description="Guided meditations for daily mindfulness"
149
+ variant="ghost" />
128
150
  </Grid>
129
151
  <Grid item xs={4}>
130
- <SquareAppIcon display="detailed" name="Study Space" description="Organize your study schedule and resources" variant="shortcut" />
152
+ <SquareAppIcon
153
+ display="detailed"
154
+ name="Study Space"
155
+ description="Organize your study schedule and resources"
156
+ variant="shortcut"
157
+ hideShortcutBadge={isShortcutBadgeHide} />
131
158
  </Grid>
132
159
  <Grid item xs={4}>
133
- <SquareAppIcon display="detailed" name="Quick Notes" IconContent={<Icon icon={CozyIcon} size="48" />} variant={isLoading ? 'loading' : 'default'} />
160
+ <SquareAppIcon
161
+ display="detailed"
162
+ name="Quick Notes"
163
+ IconContent={<Icon icon={CozyIcon} size="48" />}
164
+ variant={isLoading ? 'loading' : 'default'} />
134
165
  </Grid>
135
166
  <Grid item xs={4}>
136
- <SquareAppIcon display="detailed" name="Daily Budget" description="Manage your daily expenses and budgets" IconContent={<Icon icon={CozyIcon} size="48" />} variant={isError ? 'error' : 'loading'} />
167
+ <SquareAppIcon
168
+ display="detailed"
169
+ name="Daily Budget"
170
+ description="Manage your daily expenses and budgets"
171
+ IconContent={<Icon icon={CozyIcon} size="48" />}
172
+ variant={isError ? 'error' : 'loading'} />
137
173
  </Grid>
138
174
  <Grid item xs={4}>
139
- <SquareAppIcon display="detailed" name="Event Planner" description="Plan and schedule your events effectively" IconContent={<Icon icon={CozyIcon} size="48" />} />
175
+ <SquareAppIcon
176
+ display="detailed"
177
+ name="Event Planner"
178
+ description="Plan and schedule your events effectively"
179
+ IconContent={<Icon icon={CozyIcon} size="48" />} />
140
180
  </Grid>
141
181
  </Grid>
142
182
  </>
@@ -100,6 +100,7 @@ export const SquareAppIcon = ({
100
100
  variant,
101
101
  IconContent,
102
102
  description,
103
+ hideShortcutBadge = false,
103
104
  ...appIconProps
104
105
  }) => {
105
106
  const { variant: themeVariant } = useCozyTheme()
@@ -139,11 +140,13 @@ export const SquareAppIcon = ({
139
140
  <CozyTheme variant={squareTheme}>
140
141
  <InfosBadge
141
142
  badgeContent={
142
- variant === 'shortcut' ? <Icon size="10" icon={iconOut} /> : null
143
+ variant === 'shortcut' && !hideShortcutBadge ? (
144
+ <Icon size="10" icon={iconOut} />
145
+ ) : null
143
146
  }
144
147
  className={cx({ ['u-mr-1']: display === 'detailed' })}
145
148
  overlap="rectangular"
146
- invisible={variant !== 'shortcut'}
149
+ invisible={variant !== 'shortcut' || hideShortcutBadge}
147
150
  >
148
151
  <SquareAppIconSpinner
149
152
  variant={variant}
@@ -1,7 +1,7 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- var _excluded = ["display", "name", "variant", "IconContent", "description"];
4
+ var _excluded = ["display", "name", "variant", "IconContent", "description", "hideShortcutBadge"];
5
5
  import cx from 'classnames';
6
6
  import get from 'lodash/get';
7
7
  import PropTypes from 'prop-types';
@@ -115,6 +115,8 @@ export var SquareAppIcon = function SquareAppIcon(_ref2) {
115
115
  variant = _ref2.variant,
116
116
  IconContent = _ref2.IconContent,
117
117
  description = _ref2.description,
118
+ _ref2$hideShortcutBad = _ref2.hideShortcutBadge,
119
+ hideShortcutBadge = _ref2$hideShortcutBad === void 0 ? false : _ref2$hideShortcutBad,
118
120
  appIconProps = _objectWithoutProperties(_ref2, _excluded);
119
121
 
120
122
  var _useCozyTheme = useCozyTheme(),
@@ -147,13 +149,13 @@ export var SquareAppIcon = function SquareAppIcon(_ref2) {
147
149
  }, /*#__PURE__*/React.createElement(CozyTheme, {
148
150
  variant: squareTheme
149
151
  }, /*#__PURE__*/React.createElement(InfosBadge, {
150
- badgeContent: variant === 'shortcut' ? /*#__PURE__*/React.createElement(Icon, {
152
+ badgeContent: variant === 'shortcut' && !hideShortcutBadge ? /*#__PURE__*/React.createElement(Icon, {
151
153
  size: "10",
152
154
  icon: iconOut
153
155
  }) : null,
154
156
  className: cx(_defineProperty({}, 'u-mr-1', display === 'detailed')),
155
157
  overlap: "rectangular",
156
- invisible: variant !== 'shortcut'
158
+ invisible: variant !== 'shortcut' || hideShortcutBadge
157
159
  }, /*#__PURE__*/React.createElement(SquareAppIconSpinner, {
158
160
  variant: variant,
159
161
  animationState: animationState