cozy-ui 119.0.3 → 119.2.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,17 @@
1
+ # [119.2.0](https://github.com/cozy/cozy-ui/compare/v119.1.0...v119.2.0) (2025-03-12)
2
+
3
+
4
+ ### Features
5
+
6
+ * **Switch:** Adjust style component ([4e89011](https://github.com/cozy/cozy-ui/commit/4e89011))
7
+
8
+ # [119.1.0](https://github.com/cozy/cozy-ui/compare/v119.0.3...v119.1.0) (2025-03-12)
9
+
10
+
11
+ ### Features
12
+
13
+ * Adjust cloud, company and from-user icons ([32dd9a2](https://github.com/cozy/cozy-ui/commit/32dd9a2))
14
+
1
15
  ## [119.0.3](https://github.com/cozy/cozy-ui/compare/v119.0.2...v119.0.3) (2025-03-11)
2
16
 
3
17
 
@@ -0,0 +1 @@
1
+ <svg width="16" height="11" viewBox="0 0 16 11" xmlns="http://www.w3.org/2000/svg"><path d="M8 1.333a3.669 3.669 0 0 1 3.593 2.954l.2 1 1.02.073c1.04.067 1.854.94 1.854 1.973 0 1.1-.9 2-2 2H4a2.666 2.666 0 0 1-2.667-2.666A2.649 2.649 0 0 1 3.707 4.02l.713-.073.333-.634A3.646 3.646 0 0 1 8 1.333ZM8 0a4.997 4.997 0 0 0-4.433 2.693A3.996 3.996 0 0 0 0 6.667c0 2.206 1.793 4 4 4h8.667A3.335 3.335 0 0 0 16 7.333a3.317 3.317 0 0 0-3.1-3.306A4.993 4.993 0 0 0 8 0Z"/></svg>
@@ -1 +1 @@
1
- <svg width="20" height="18" viewBox="0 0 20 18" xmlns="http://www.w3.org/2000/svg"><path d="M10 4V0H0v18h20V4H10ZM4 16H2v-2h2v2Zm0-4H2v-2h2v2Zm0-4H2V6h2v2Zm0-4H2V2h2v2Zm4 12H6v-2h2v2Zm0-4H6v-2h2v2Zm0-4H6V6h2v2Zm0-4H6V2h2v2Zm10 12h-8v-2h2v-2h-2v-2h2V8h-2V6h8v10Zm-2-8h-2v2h2V8Zm0 4h-2v2h2v-2Z"/></svg>
1
+ <svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M12.444 7.111V0H3.556v3.556H0V16h7.111v-3.556H8.89V16H16V7.111h-3.556Zm-8.888 7.111H1.778v-1.778h1.778v1.778Zm0-3.555H1.778V8.889h1.778v1.778Zm0-3.556H1.778V5.333h1.778v1.778Zm3.555 3.556H5.333V8.889h1.778v1.778Zm0-3.556H5.333V5.333h1.778v1.778Zm0-3.555H5.333V1.778h1.778v1.778Zm3.556 7.11H8.889V8.89h1.778v1.778Zm0-3.555H8.889V5.333h1.778v1.778Zm0-3.555H8.889V1.778h1.778v1.778Zm3.555 10.666h-1.778v-1.778h1.778v1.778Zm0-3.555h-1.778V8.889h1.778v1.778Z"/></svg>
@@ -1 +1 @@
1
- <svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M8 0C3.584 0 0 3.584 0 8s3.584 8 8 8 8-3.584 8-8-3.584-8-8-8Zm5.088 11.864C11.944 10.472 9.168 10 8 10c-1.168 0-3.944.472-5.088 1.864A6.36 6.36 0 0 1 1.6 8c0-3.528 2.872-6.4 6.4-6.4 3.528 0 6.4 2.872 6.4 6.4a6.36 6.36 0 0 1-1.312 3.864ZM5.2 6c0-1.552 1.248-2.8 2.8-2.8 1.552 0 2.8 1.248 2.8 2.8 0 1.552-1.248 2.8-2.8 2.8A2.793 2.793 0 0 1 5.2 6Z"/></svg>
1
+ <svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M8 0C3.584 0 0 3.584 0 8s3.584 8 8 8 8-3.584 8-8-3.584-8-8-8ZM4.28 13.2A6.353 6.353 0 0 1 8 12c1.392 0 2.672.448 3.72 1.2A6.353 6.353 0 0 1 8 14.4a6.353 6.353 0 0 1-3.72-1.2Zm8.632-1.104a7.957 7.957 0 0 0-9.824 0A6.365 6.365 0 0 1 1.6 8c0-3.536 2.864-6.4 6.4-6.4 3.536 0 6.4 2.864 6.4 6.4 0 1.56-.56 2.984-1.488 4.096Z"/><path d="M8 3.2A2.803 2.803 0 0 0 5.2 6c0 1.544 1.256 2.8 2.8 2.8 1.544 0 2.8-1.256 2.8-2.8 0-1.544-1.256-2.8-2.8-2.8Zm0 4c-.664 0-1.2-.536-1.2-1.2 0-.664.536-1.2 1.2-1.2.664 0 1.2.536 1.2 1.2 0 .664-.536 1.2-1.2 1.2Z"/></svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "119.0.3",
3
+ "version": "119.2.0",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -1,7 +1,11 @@
1
1
  // Automatically created, please run `scripts/generate-svg-icon.sh assets/icons/ui/cloud.svg` to regenerate;
2
2
  import React from 'react'
3
3
 
4
+ import SvgCloudTwake from './Cloud_twake'
5
+ import { isTwakeTheme } from '../helpers/isTwakeTheme'
6
+
4
7
  function SvgCloud(props) {
8
+ if (isTwakeTheme()) return SvgCloudTwake(props)
5
9
  return (
6
10
  <svg viewBox="0 0 16 16" {...props}>
7
11
  <defs>
@@ -0,0 +1,12 @@
1
+ // Automatically created, please run `scripts/generate-svgr-icon.sh assets/icons/twake/cloud_twake.svg` to regenerate;
2
+ import React from 'react'
3
+
4
+ function SvgCloudTwake(props) {
5
+ return (
6
+ <svg viewBox="0 0 16 11" {...props}>
7
+ <path d="M8 1.333a3.669 3.669 0 013.593 2.954l.2 1 1.02.073c1.04.067 1.854.94 1.854 1.973 0 1.1-.9 2-2 2H4a2.666 2.666 0 01-2.667-2.666A2.649 2.649 0 013.707 4.02l.713-.073.333-.634A3.646 3.646 0 018 1.333zM8 0a4.997 4.997 0 00-4.433 2.693A3.996 3.996 0 000 6.667c0 2.206 1.793 4 4 4h8.667A3.335 3.335 0 0016 7.333a3.317 3.317 0 00-3.1-3.306A4.993 4.993 0 008 0z" />
8
+ </svg>
9
+ )
10
+ }
11
+
12
+ export default SvgCloudTwake
@@ -3,8 +3,8 @@ import React from 'react'
3
3
 
4
4
  function SvgCompanyTwake(props) {
5
5
  return (
6
- <svg viewBox="0 0 20 18" {...props}>
7
- <path d="M10 4V0H0v18h20V4H10zM4 16H2v-2h2v2zm0-4H2v-2h2v2zm0-4H2V6h2v2zm0-4H2V2h2v2zm4 12H6v-2h2v2zm0-4H6v-2h2v2zm0-4H6V6h2v2zm0-4H6V2h2v2zm10 12h-8v-2h2v-2h-2v-2h2V8h-2V6h8v10zm-2-8h-2v2h2V8zm0 4h-2v2h2v-2z" />
6
+ <svg viewBox="0 0 16 16" {...props}>
7
+ <path d="M12.444 7.111V0H3.556v3.556H0V16h7.111v-3.556H8.89V16H16V7.111h-3.556zm-8.888 7.111H1.778v-1.778h1.778v1.778zm0-3.555H1.778V8.889h1.778v1.778zm0-3.556H1.778V5.333h1.778v1.778zm3.555 3.556H5.333V8.889h1.778v1.778zm0-3.556H5.333V5.333h1.778v1.778zm0-3.555H5.333V1.778h1.778v1.778zm3.556 7.11H8.889V8.89h1.778v1.778zm0-3.555H8.889V5.333h1.778v1.778zm0-3.555H8.889V1.778h1.778v1.778zm3.555 10.666h-1.778v-1.778h1.778v1.778zm0-3.555h-1.778V8.889h1.778v1.778z" />
8
8
  </svg>
9
9
  )
10
10
  }
@@ -4,11 +4,8 @@ import React from 'react'
4
4
  function SvgFromUserTwake(props) {
5
5
  return (
6
6
  <svg viewBox="0 0 16 16" {...props}>
7
- <path
8
- fillRule="evenodd"
9
- clipRule="evenodd"
10
- d="M8 0C3.584 0 0 3.584 0 8s3.584 8 8 8 8-3.584 8-8-3.584-8-8-8zm5.088 11.864C11.944 10.472 9.168 10 8 10c-1.168 0-3.944.472-5.088 1.864A6.36 6.36 0 011.6 8c0-3.528 2.872-6.4 6.4-6.4 3.528 0 6.4 2.872 6.4 6.4a6.36 6.36 0 01-1.312 3.864zM5.2 6c0-1.552 1.248-2.8 2.8-2.8 1.552 0 2.8 1.248 2.8 2.8 0 1.552-1.248 2.8-2.8 2.8A2.793 2.793 0 015.2 6z"
11
- />
7
+ <path d="M8 0C3.584 0 0 3.584 0 8s3.584 8 8 8 8-3.584 8-8-3.584-8-8-8zM4.28 13.2A6.353 6.353 0 018 12c1.392 0 2.672.448 3.72 1.2A6.353 6.353 0 018 14.4a6.353 6.353 0 01-3.72-1.2zm8.632-1.104a7.957 7.957 0 00-9.824 0A6.365 6.365 0 011.6 8c0-3.536 2.864-6.4 6.4-6.4 3.536 0 6.4 2.864 6.4 6.4 0 1.56-.56 2.984-1.488 4.096z" />
8
+ <path d="M8 3.2A2.803 2.803 0 005.2 6c0 1.544 1.256 2.8 2.8 2.8 1.544 0 2.8-1.256 2.8-2.8 0-1.544-1.256-2.8-2.8-2.8zm0 4c-.664 0-1.2-.536-1.2-1.2 0-.664.536-1.2 1.2-1.2.664 0 1.2.536 1.2 1.2 0 .664-.536 1.2-1.2 1.2z" />
12
9
  </svg>
13
10
  )
14
11
  }
@@ -10,6 +10,60 @@ export const makeLightNormalTwakeOverrides = theme => {
10
10
  padding: 8
11
11
  }
12
12
  },
13
+ MuiSwitch: {
14
+ root: {
15
+ width: 50,
16
+ height: 40,
17
+ padding: '6px 1px'
18
+ },
19
+ switchBase: {
20
+ padding: 5,
21
+ top: 5,
22
+ color: theme.palette.text.icon,
23
+ '& .cozySwitchThumb': {
24
+ display: 'flex',
25
+ alignItems: 'center',
26
+ justifyContent: 'center',
27
+ width: 20,
28
+ height: 20,
29
+ borderRadius: '50%',
30
+ boxShadow: theme.shadows[1],
31
+ backgroundColor: theme.palette.common.white
32
+ }
33
+ },
34
+ track: {
35
+ width: 44,
36
+ height: '100%',
37
+ borderRadius: 100
38
+ },
39
+ thumb: {
40
+ width: 20,
41
+ height: 20
42
+ },
43
+ colorPrimary: {
44
+ '&$disabled + $track': {
45
+ opacity: 1,
46
+ backgroundColor: theme.palette.action.disabledBackground
47
+ }
48
+ },
49
+ colorSecondary: {
50
+ '&$checked': {
51
+ color: theme.palette.success.main
52
+ },
53
+ '&$disabled + $track': {
54
+ opacity: 1,
55
+ backgroundColor: theme.palette.action.disabledBackground
56
+ }
57
+ },
58
+ disabled: {
59
+ '&$checked + $track': {
60
+ backgroundColor: theme.palette.action.disabledBackground
61
+ },
62
+ '& .cozySwitchThumb': {
63
+ backgroundColor: theme.palette.background.default
64
+ }
65
+ }
66
+ },
13
67
  MuiButton: {
14
68
  root: {
15
69
  borderRadius: 100,
@@ -1,14 +1,13 @@
1
1
  Used to present a binary choice to the user.
2
2
 
3
- Uses [Material UI's Switch](https://material-ui.com/components/switches/).
4
-
5
3
  ```jsx
6
4
  import { useState, useCallback } from 'react'
7
- import { Media, Img } from 'cozy-ui/transpiled/react/deprecated/Media'
8
5
  import Switch from 'cozy-ui/transpiled/react/Switch'
9
6
  import Typography from "cozy-ui/transpiled/react/Typography"
10
7
  import Stack from "cozy-ui/transpiled/react/Stack"
11
- import Box from '@material-ui/core/Box'
8
+ import Box from 'cozy-ui/transpiled/react/Box'
9
+ import CheckIcon from 'cozy-ui/transpiled/react/Icons/Check'
10
+ import FormControlLabel from 'cozy-ui/transpiled/react/FormControlLabel'
12
11
 
13
12
  initialState = {
14
13
  switch0: true,
@@ -22,26 +21,54 @@ const StateSwitch = ({ id, color }) => {
22
21
  return <Switch
23
22
  color={color}
24
23
  checked={checked}
24
+ {...(isTwakeTheme() && { icon: CheckIcon })}
25
25
  onChange={handleClick}
26
26
  />
27
27
  }
28
28
 
29
- const Switches = () => {
30
- return <Stack spacing='xs'>
31
- {['primary', 'secondary', 'default'].map((color, i) => {
32
- return (
33
- <Box display='flex' alignItems='center' key={i}>
34
- <Typography variant='body1' display="inline">
35
- { color }
36
- </Typography>
37
- <StateSwitch id={i} color={color} />
38
- </Box>
39
- )
40
- })}
41
- </Stack>
42
- }
43
-
44
29
  ;
45
30
 
46
- <Switches />
31
+ <Stack spacing='xs'>
32
+ {['primary', 'secondary', 'default'].map((color, i) => {
33
+ return (
34
+ <Box display='flex' alignItems='center' key={i}>
35
+ <Typography variant='body1' display="inline">{ color }</Typography>
36
+ <StateSwitch id={i} color={color} />
37
+ </Box>
38
+ )
39
+ })}
40
+ <FormControlLabel control={<Switch color="primary" />} label="With label" />
41
+ <FormControlLabel control={<Switch color="primary" checked />} label="With label" />
42
+ <br />
43
+ <FormControlLabel control={<Switch color="primary" disabled />} label="Primary, disabled with label" />
44
+ <FormControlLabel control={<Switch color="primary" checked disabled />} label="Primary, checked - disabled with label" />
45
+ <br />
46
+ <FormControlLabel
47
+ label="Primary, disabled with label"
48
+ control={
49
+ <Switch
50
+ color="primary"
51
+ {...(isTwakeTheme() && { icon: CheckIcon })}
52
+ disabled
53
+ />
54
+ }
55
+ />
56
+ <FormControlLabel
57
+ label="Primary, checked - disabled with label"
58
+ control={
59
+ <Switch
60
+ color="primary"
61
+ {...(isTwakeTheme() && { icon: CheckIcon })}
62
+ checked
63
+ disabled
64
+ />
65
+ }
66
+ />
67
+ <br />
68
+ <FormControlLabel control={<Switch color="secondary" disabled />} label="Secondary, checked with label" />
69
+ <FormControlLabel control={<Switch color="secondary" checked disabled />} label="Secondary, checked - disabled with label" />
70
+ <br />
71
+ <FormControlLabel control={<Switch disabled />} label="Default, checked with label" />
72
+ <FormControlLabel control={<Switch checked disabled />} label="Default, checked - disabled with label" />
73
+ </Stack>
47
74
  ```
@@ -1,3 +1,22 @@
1
- import Switch from '@material-ui/core/Switch'
1
+ import MuiSwitch from '@material-ui/core/Switch'
2
+ import React from 'react'
3
+
4
+ import Icon from '../Icon'
5
+ import { isTwakeTheme } from '../helpers/isTwakeTheme'
6
+
7
+ const Switch = ({ icon, ...props }) => {
8
+ const _icon = (
9
+ <span className="cozySwitchThumb">
10
+ {!!icon && <Icon icon={icon} size={14} />}
11
+ </span>
12
+ )
13
+
14
+ return (
15
+ <MuiSwitch
16
+ {...props}
17
+ {...(isTwakeTheme() && { icon: _icon, checkedIcon: _icon })}
18
+ />
19
+ )
20
+ }
2
21
 
3
22
  export default Switch