cozy-ui 130.10.0 → 130.11.1
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 +20 -0
- package/package.json +1 -1
- package/react/Checkbox/Readme.md +44 -39
- package/react/Checkbox/index.jsx +12 -2
- package/react/CozyDialogs/SpecificDialogs/locales/en.json +1 -1
- package/react/CozyDialogs/SpecificDialogs/locales/fr.json +1 -1
- package/react/CozyDialogs/SpecificDialogs/locales/ru.json +1 -1
- package/react/CozyDialogs/SpecificDialogs/locales/vi.json +1 -1
- package/react/MuiCozyTheme/overrides/makeLightNormalOverrides.js +4 -2
- package/react/Radios/Readme.md +63 -71
- package/react/Switch/Readme.md +93 -46
- package/transpiled/react/Checkbox/index.d.ts +6 -2
- package/transpiled/react/Checkbox/index.js +6 -2
- package/transpiled/react/CozyDialogs/SpecificDialogs/withSpecificDialogsLocales.js +4 -4
- package/transpiled/react/MuiCozyTheme/overrides/makeDarkInvertedOverrides.d.ts +2 -0
- package/transpiled/react/MuiCozyTheme/overrides/makeDarkNormalOverrides.d.ts +2 -0
- package/transpiled/react/MuiCozyTheme/overrides/makeLightInvertedOverrides.d.ts +2 -0
- package/transpiled/react/MuiCozyTheme/overrides/makeLightNormalOverrides.d.ts +2 -0
- package/transpiled/react/MuiCozyTheme/overrides/makeLightNormalOverrides.js +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
## [130.11.1](https://github.com/cozy/cozy-ui/compare/v130.11.0...v130.11.1) (2025-10-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **ShortcutDialog:** Change "edit button" wording ([247ef1a](https://github.com/cozy/cozy-ui/commit/247ef1a))
|
|
7
|
+
|
|
8
|
+
# [130.11.0](https://github.com/cozy/cozy-ui/compare/v130.10.0...v130.11.0) (2025-10-21)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **Checkbox:** Now `label` type also accept `node` in addition to `string` ([caf3de5](https://github.com/cozy/cozy-ui/commit/caf3de5))
|
|
14
|
+
* **Switch:** Adjust spacing to better deal with `start` label's position ([528834b](https://github.com/cozy/cozy-ui/commit/528834b))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **Checkbox:** Add `labelPlacement` prop ([24c884d](https://github.com/cozy/cozy-ui/commit/24c884d))
|
|
20
|
+
|
|
1
21
|
# [130.10.0](https://github.com/cozy/cozy-ui/compare/v130.9.0...v130.10.0) (2025-10-16)
|
|
2
22
|
|
|
3
23
|
|
package/package.json
CHANGED
package/react/Checkbox/Readme.md
CHANGED
|
@@ -3,49 +3,54 @@
|
|
|
3
3
|
```jsx
|
|
4
4
|
import Checkbox from 'cozy-ui/transpiled/react/Checkbox'
|
|
5
5
|
import Grid from 'cozy-ui/transpiled/react/Grid'
|
|
6
|
+
import Variants from 'cozy-ui/docs/components/Variants'
|
|
7
|
+
|
|
8
|
+
const initialVariants = [{ before: false }]
|
|
6
9
|
|
|
7
10
|
;
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<Grid
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
12
|
+
<Variants initialVariants={initialVariants} screenshotAllVariants>
|
|
13
|
+
{variant => (
|
|
14
|
+
<Grid container>
|
|
15
|
+
<Grid item xs={6} sm={3}>
|
|
16
|
+
<div><Checkbox label="Checkbox" labelPlacement={variant.before ? "start" : "end"} /></div>
|
|
17
|
+
<div><Checkbox label="Small Checked" size="small" labelPlacement={variant.before ? "start" : "end"} /></div>
|
|
18
|
+
<div><Checkbox label="Checked checkbox" checked labelPlacement={variant.before ? "start" : "end"} /></div>
|
|
19
|
+
<div><Checkbox label="Mixed checkbox" mixed labelPlacement={variant.before ? "start" : "end"} /></div>
|
|
20
|
+
<div><Checkbox label="Mixed checked checkbox" checked mixed labelPlacement={variant.before ? "start" : "end"} /></div>
|
|
21
|
+
<div><Checkbox label="No effect" disableEffect labelPlacement={variant.before ? "start" : "end"} /></div>
|
|
22
|
+
<div><Checkbox label="Small no effect" size="small" disableEffect labelPlacement={variant.before ? "start" : "end"} /></div>
|
|
23
|
+
</Grid>
|
|
24
|
+
<Grid item xs={6} sm={3}>
|
|
25
|
+
<div><Checkbox label="Disabled checkbox" disabled labelPlacement={variant.before ? "start" : "end"} /></div>
|
|
26
|
+
<div><Checkbox label="Small disabled checkbox" size="small" disabled labelPlacement={variant.before ? "start" : "end"} /></div>
|
|
27
|
+
<div><Checkbox label="Disabled checked checkbox" checked disabled labelPlacement={variant.before ? "start" : "end"} /></div>
|
|
28
|
+
<div><Checkbox label="Disabled mixed checkbox" mixed disabled labelPlacement={variant.before ? "start" : "end"} /></div>
|
|
29
|
+
<div><Checkbox label="Disabled mixed checked checkbox" checked mixed disabled labelPlacement={variant.before ? "start" : "end"} /></div>
|
|
30
|
+
<div><Checkbox label="Disabled no effect" disableEffect disabled labelPlacement={variant.before ? "start" : "end"} /></div>
|
|
31
|
+
<div><Checkbox label="Small disabled no effect" size="small" disableEffect disabled labelPlacement={variant.before ? "start" : "end"} /></div>
|
|
32
|
+
</Grid>
|
|
33
|
+
<Grid item xs={6} sm={3}>
|
|
34
|
+
<div><Checkbox label="Error checkbox" error labelPlacement={variant.before ? "start" : "end"} /></div>
|
|
35
|
+
<div><Checkbox label="Small error checkbox" size="small" error labelPlacement={variant.before ? "start" : "end"} /></div>
|
|
36
|
+
<div><Checkbox label="Error checked checkbox" error checked labelPlacement={variant.before ? "start" : "end"} /></div>
|
|
37
|
+
<div><Checkbox label="Error mixed checkbox" error mixed labelPlacement={variant.before ? "start" : "end"} /></div>
|
|
38
|
+
<div><Checkbox label="Error mixed checked checkbox" error checked mixed labelPlacement={variant.before ? "start" : "end"} /></div>
|
|
39
|
+
<div><Checkbox label="Error no effect" error disableEffect labelPlacement={variant.before ? "start" : "end"} /></div>
|
|
40
|
+
<div><Checkbox label="Small error no effect" size="small" error disableEffect labelPlacement={variant.before ? "start" : "end"} /></div>
|
|
41
|
+
</Grid>
|
|
42
|
+
<Grid item xs={6} sm={3}>
|
|
43
|
+
<div><Checkbox label="Error disabled checkbox" error disabled labelPlacement={variant.before ? "start" : "end"} /></div>
|
|
44
|
+
<div><Checkbox label="Small error disabled checkbox" size="small" error disabled labelPlacement={variant.before ? "start" : "end"} /></div>
|
|
45
|
+
<div><Checkbox label="Error disabled checked checkbox" error checked disabled labelPlacement={variant.before ? "start" : "end"} /></div>
|
|
46
|
+
<div><Checkbox label="Error disabled mixed checkbox" error mixed disabled labelPlacement={variant.before ? "start" : "end"} /></div>
|
|
47
|
+
<div><Checkbox label="Error disabled mixed checked checkbox" error checked mixed disabled labelPlacement={variant.before ? "start" : "end"} /></div>
|
|
48
|
+
<div><Checkbox label="Error disabled no effect" error disableEffect disabled labelPlacement={variant.before ? "start" : "end"} /></div>
|
|
49
|
+
<div><Checkbox label="Small error disabled no effect" size="small" error disableEffect disabled labelPlacement={variant.before ? "start" : "end"} /></div>
|
|
50
|
+
</Grid>
|
|
46
51
|
</Grid>
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
)}
|
|
53
|
+
</Variants>
|
|
49
54
|
```
|
|
50
55
|
|
|
51
56
|
### Checkbox with complex children
|
package/react/Checkbox/index.jsx
CHANGED
|
@@ -52,7 +52,14 @@ const DefaultCheckbox = ({
|
|
|
52
52
|
)
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
const Checkbox = ({
|
|
55
|
+
const Checkbox = ({
|
|
56
|
+
className,
|
|
57
|
+
label,
|
|
58
|
+
labelPlacement,
|
|
59
|
+
onChange,
|
|
60
|
+
children,
|
|
61
|
+
...props
|
|
62
|
+
}) => {
|
|
56
63
|
if (children) {
|
|
57
64
|
logDepecratedCheckbox(
|
|
58
65
|
'<Checkbox> used with children is deprecated, please use <Checkbox label={something} /> instead of <Checkbox>something</Checkbox>'
|
|
@@ -69,6 +76,7 @@ const Checkbox = ({ className, label, onChange, children, ...props }) => {
|
|
|
69
76
|
className
|
|
70
77
|
)}
|
|
71
78
|
label={label || children}
|
|
79
|
+
labelPlacement={labelPlacement}
|
|
72
80
|
control={<DefaultCheckbox {...props} label={label} />}
|
|
73
81
|
onChange={onChange}
|
|
74
82
|
/>
|
|
@@ -93,7 +101,8 @@ Checkbox.propTypes = {
|
|
|
93
101
|
mixed: PropTypes.bool,
|
|
94
102
|
disableEffect: PropTypes.bool,
|
|
95
103
|
size: PropTypes.oneOf(['small', 'medium']),
|
|
96
|
-
|
|
104
|
+
labelPlacement: PropTypes.oneOf(['top', 'end', 'bottom', 'start']),
|
|
105
|
+
label: PropTypes.oneOfType([PropTypes.string, PropTypes.node])
|
|
97
106
|
}
|
|
98
107
|
|
|
99
108
|
Checkbox.defaultProps = {
|
|
@@ -103,6 +112,7 @@ Checkbox.defaultProps = {
|
|
|
103
112
|
mixed: false,
|
|
104
113
|
disableEffect: false,
|
|
105
114
|
size: 'medium',
|
|
115
|
+
labelPlacement: 'end',
|
|
106
116
|
label: ''
|
|
107
117
|
}
|
|
108
118
|
|
|
@@ -898,9 +898,10 @@ export const makeLightNormalOverrides = theme => ({
|
|
|
898
898
|
},
|
|
899
899
|
MuiSwitch: {
|
|
900
900
|
root: {
|
|
901
|
-
width:
|
|
901
|
+
width: 56,
|
|
902
902
|
height: 40,
|
|
903
|
-
padding: '6px 1px'
|
|
903
|
+
padding: '6px 1px',
|
|
904
|
+
justifyContent: 'center'
|
|
904
905
|
},
|
|
905
906
|
checked: {
|
|
906
907
|
'& + $track$track': {
|
|
@@ -910,6 +911,7 @@ export const makeLightNormalOverrides = theme => ({
|
|
|
910
911
|
switchBase: {
|
|
911
912
|
padding: 5,
|
|
912
913
|
top: 5,
|
|
914
|
+
left: 5,
|
|
913
915
|
color: theme.palette.text.icon,
|
|
914
916
|
'& .cozySwitchThumb': {
|
|
915
917
|
display: 'flex',
|
package/react/Radios/Readme.md
CHANGED
|
@@ -5,79 +5,80 @@ import Radio from 'cozy-ui/transpiled/react/Radios'
|
|
|
5
5
|
import RadioGroup from 'cozy-ui/transpiled/react/RadioGroup'
|
|
6
6
|
import FormControlLabel from 'cozy-ui/transpiled/react/FormControlLabel'
|
|
7
7
|
import Variants from 'cozy-ui/docs/components/Variants'
|
|
8
|
-
const Box = ({ children }) => {
|
|
9
|
-
return <div style={{ height: '3rem', width: '3rem', border: '2px dashed #CCC', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
|
|
10
|
-
{ children }
|
|
11
|
-
</div>
|
|
12
|
-
}
|
|
13
8
|
|
|
14
9
|
initialState = { radioValue: 'item1' }
|
|
15
10
|
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
]
|
|
11
|
+
const initialVariantsForScreenshots = [{ checked: false, disabled: false, secondary: false }]
|
|
12
|
+
const initialVariants = [{ before: false }]
|
|
19
13
|
|
|
20
14
|
const handleChange = event => {
|
|
21
15
|
setState({ radioValue: event.target.value })
|
|
22
16
|
}
|
|
23
17
|
|
|
24
|
-
const bboxStyle = { border: '1px solid red' }
|
|
25
|
-
|
|
26
18
|
;
|
|
27
19
|
|
|
28
20
|
<>
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
<
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
21
|
+
<Variants initialVariants={initialVariants} screenshotAllVariants>
|
|
22
|
+
{variant => (
|
|
23
|
+
<RadioGroup
|
|
24
|
+
aria-label="radio"
|
|
25
|
+
name="radioName"
|
|
26
|
+
value={state.radioValue.toString()}
|
|
27
|
+
onChange={handleChange}
|
|
28
|
+
>
|
|
29
|
+
<FormControlLabel
|
|
30
|
+
value="item1"
|
|
31
|
+
label="This is a radio button"
|
|
32
|
+
labelPlacement={variant.before ? "start" : "end"}
|
|
33
|
+
control={
|
|
34
|
+
<Radio />
|
|
35
|
+
}
|
|
36
|
+
/>
|
|
37
|
+
<FormControlLabel
|
|
38
|
+
value="item2"
|
|
39
|
+
label="This is an intent radio button"
|
|
40
|
+
labelPlacement={variant.before ? "start" : "end"}
|
|
41
|
+
control={
|
|
42
|
+
<Radio color="secondary" />
|
|
43
|
+
}
|
|
44
|
+
/>
|
|
45
|
+
<FormControlLabel
|
|
46
|
+
value="item3"
|
|
47
|
+
label="This is a disabled radio button"
|
|
48
|
+
labelPlacement={variant.before ? "start" : "end"}
|
|
49
|
+
control={
|
|
50
|
+
<Radio disabled />
|
|
51
|
+
}
|
|
52
|
+
/>
|
|
53
|
+
<FormControlLabel
|
|
54
|
+
value="item4"
|
|
55
|
+
label="This is a checked disabled radio button"
|
|
56
|
+
labelPlacement={variant.before ? "start" : "end"}
|
|
57
|
+
control={
|
|
58
|
+
<Radio checked disabled />
|
|
59
|
+
}
|
|
60
|
+
/>
|
|
61
|
+
<FormControlLabel
|
|
62
|
+
value="item5"
|
|
63
|
+
label="This is a edge start radio button"
|
|
64
|
+
labelPlacement={variant.before ? "start" : "end"}
|
|
65
|
+
control={
|
|
66
|
+
<Radio edge="start" />
|
|
67
|
+
}
|
|
68
|
+
/>
|
|
69
|
+
<FormControlLabel
|
|
70
|
+
value="item6"
|
|
71
|
+
label="This is a edge end radio button"
|
|
72
|
+
labelPlacement={variant.before ? "start" : "end"}
|
|
73
|
+
control={
|
|
74
|
+
<Radio edge="end" />
|
|
75
|
+
}
|
|
76
|
+
/>
|
|
77
|
+
</RadioGroup>
|
|
78
|
+
)}
|
|
79
|
+
</Variants>
|
|
79
80
|
{isTesting() && (
|
|
80
|
-
<Variants initialVariants={
|
|
81
|
+
<Variants initialVariants={initialVariantsForScreenshots} screenshotAllVariants>
|
|
81
82
|
{variant => (
|
|
82
83
|
<Radio
|
|
83
84
|
color={variant.secondary ? 'secondary' : 'primary'}
|
|
@@ -99,22 +100,13 @@ import Radio from 'cozy-ui/transpiled/react/Radios'
|
|
|
99
100
|
import RadioGroup from 'cozy-ui/transpiled/react/RadioGroup'
|
|
100
101
|
import FormControlLabel from 'cozy-ui/transpiled/react/FormControlLabel'
|
|
101
102
|
import Variants from 'cozy-ui/docs/components/Variants'
|
|
103
|
+
|
|
102
104
|
const Box = ({ children }) => {
|
|
103
105
|
return <div style={{ height: '3rem', width: '3rem', border: '2px dashed #CCC', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
|
|
104
106
|
{ children }
|
|
105
107
|
</div>
|
|
106
108
|
}
|
|
107
109
|
|
|
108
|
-
initialState = { radioValue: 'item1' }
|
|
109
|
-
|
|
110
|
-
const initialVariants = [
|
|
111
|
-
{ checked: false, disabled: false, secondary: false }
|
|
112
|
-
]
|
|
113
|
-
|
|
114
|
-
const handleChange = event => {
|
|
115
|
-
setState({ radioValue: event.target.value })
|
|
116
|
-
}
|
|
117
|
-
|
|
118
110
|
const bboxStyle = { border: '1px solid red' }
|
|
119
111
|
|
|
120
112
|
;
|
package/react/Switch/Readme.md
CHANGED
|
@@ -6,14 +6,14 @@ import Switch from 'cozy-ui/transpiled/react/Switch'
|
|
|
6
6
|
import Typography from "cozy-ui/transpiled/react/Typography"
|
|
7
7
|
import Stack from "cozy-ui/transpiled/react/Stack"
|
|
8
8
|
import Box from 'cozy-ui/transpiled/react/Box'
|
|
9
|
+
import Divider from 'cozy-ui/transpiled/react/Divider'
|
|
9
10
|
import CheckIcon from 'cozy-ui/transpiled/react/Icons/Check'
|
|
10
11
|
import FormControlLabel from 'cozy-ui/transpiled/react/FormControlLabel'
|
|
12
|
+
import FormGroup from 'cozy-ui/transpiled/react/FormGroup'
|
|
13
|
+
import Variants from 'cozy-ui/docs/components/Variants'
|
|
11
14
|
|
|
12
|
-
initialState = {
|
|
13
|
-
|
|
14
|
-
switch1: true,
|
|
15
|
-
switch2: false
|
|
16
|
-
}
|
|
15
|
+
initialState = { switch0: true, switch1: true, switch2: false }
|
|
16
|
+
const initialVariants = [{ before: false }]
|
|
17
17
|
|
|
18
18
|
const StateSwitch = ({ id, color }) => {
|
|
19
19
|
const [checked, setChecked] = useState(initialState[`switch${id}`])
|
|
@@ -28,47 +28,94 @@ const StateSwitch = ({ id, color }) => {
|
|
|
28
28
|
|
|
29
29
|
;
|
|
30
30
|
|
|
31
|
-
<
|
|
32
|
-
{
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
31
|
+
<Variants initialVariants={initialVariants} screenshotAllVariants>
|
|
32
|
+
{variant => (
|
|
33
|
+
<Stack spacing='xs'>
|
|
34
|
+
{['primary', 'secondary', 'default'].map((color, i) => {
|
|
35
|
+
return (
|
|
36
|
+
<Box display='flex' alignItems='center' key={i}>
|
|
37
|
+
<Typography display="inline">{`${color}:`}</Typography>
|
|
38
|
+
<StateSwitch id={i} color={color} />
|
|
39
|
+
</Box>
|
|
40
|
+
)
|
|
41
|
+
})}
|
|
42
|
+
<Divider className="u-mv-1" />
|
|
43
|
+
<Typography variant="h4">With labels</Typography>
|
|
44
|
+
<FormGroup row>
|
|
45
|
+
<FormControlLabel
|
|
46
|
+
control={<Switch color="primary" />}
|
|
47
|
+
label="With label"
|
|
48
|
+
labelPlacement={variant.before ? "start" : "end"}
|
|
49
|
+
/>
|
|
50
|
+
<FormControlLabel
|
|
51
|
+
control={<Switch color="primary" checked />}
|
|
52
|
+
label="With label - checked"
|
|
53
|
+
labelPlacement={variant.before ? "start" : "end"}
|
|
54
|
+
/>
|
|
55
|
+
</FormGroup>
|
|
56
|
+
<Typography className="u-mv-1" variant="h5">With disable</Typography>
|
|
57
|
+
<FormGroup row>
|
|
58
|
+
<FormControlLabel
|
|
59
|
+
control={<Switch color="primary" disabled />}
|
|
60
|
+
label="Primary"
|
|
61
|
+
labelPlacement={variant.before ? "start" : "end"}
|
|
53
62
|
/>
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
control={
|
|
59
|
-
<Switch
|
|
60
|
-
color="primary"
|
|
61
|
-
icon={CheckIcon}
|
|
62
|
-
checked
|
|
63
|
-
disabled
|
|
63
|
+
<FormControlLabel
|
|
64
|
+
control={<Switch color="primary" checked disabled />}
|
|
65
|
+
label="Primary - checked"
|
|
66
|
+
labelPlacement={variant.before ? "start" : "end"}
|
|
64
67
|
/>
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
68
|
+
</FormGroup>
|
|
69
|
+
<FormGroup row>
|
|
70
|
+
<FormControlLabel
|
|
71
|
+
label="Primary"
|
|
72
|
+
labelPlacement={variant.before ? "start" : "end"}
|
|
73
|
+
control={
|
|
74
|
+
<Switch
|
|
75
|
+
color="primary"
|
|
76
|
+
icon={CheckIcon}
|
|
77
|
+
disabled
|
|
78
|
+
/>
|
|
79
|
+
}
|
|
80
|
+
/>
|
|
81
|
+
<FormControlLabel
|
|
82
|
+
label="Primary - checked"
|
|
83
|
+
labelPlacement={variant.before ? "start" : "end"}
|
|
84
|
+
control={
|
|
85
|
+
<Switch
|
|
86
|
+
color="primary"
|
|
87
|
+
icon={CheckIcon}
|
|
88
|
+
checked
|
|
89
|
+
disabled
|
|
90
|
+
/>
|
|
91
|
+
}
|
|
92
|
+
/>
|
|
93
|
+
</FormGroup>
|
|
94
|
+
<FormGroup row>
|
|
95
|
+
<FormControlLabel
|
|
96
|
+
control={<Switch color="secondary" disabled />}
|
|
97
|
+
label="Secondary"
|
|
98
|
+
labelPlacement={variant.before ? "start" : "end"}
|
|
99
|
+
/>
|
|
100
|
+
<FormControlLabel
|
|
101
|
+
control={<Switch color="secondary" checked disabled />}
|
|
102
|
+
label="Secondary - checked"
|
|
103
|
+
labelPlacement={variant.before ? "start" : "end"}
|
|
104
|
+
/>
|
|
105
|
+
</FormGroup>
|
|
106
|
+
<FormGroup row>
|
|
107
|
+
<FormControlLabel
|
|
108
|
+
control={<Switch disabled />}
|
|
109
|
+
label="Default"
|
|
110
|
+
labelPlacement={variant.before ? "start" : "end"}
|
|
111
|
+
/>
|
|
112
|
+
<FormControlLabel
|
|
113
|
+
control={<Switch checked disabled />}
|
|
114
|
+
label="Default - checked"
|
|
115
|
+
labelPlacement={variant.before ? "start" : "end"}
|
|
116
|
+
/>
|
|
117
|
+
</FormGroup>
|
|
118
|
+
</Stack>
|
|
119
|
+
)}
|
|
120
|
+
</Variants>
|
|
74
121
|
```
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export default Checkbox;
|
|
2
|
-
declare function Checkbox({ className, label, onChange, children, ...props }: {
|
|
2
|
+
declare function Checkbox({ className, label, labelPlacement, onChange, children, ...props }: {
|
|
3
3
|
[x: string]: any;
|
|
4
4
|
className: any;
|
|
5
5
|
label: any;
|
|
6
|
+
labelPlacement: any;
|
|
6
7
|
onChange: any;
|
|
7
8
|
children: any;
|
|
8
9
|
}): JSX.Element;
|
|
@@ -15,7 +16,8 @@ declare namespace Checkbox {
|
|
|
15
16
|
const mixed: PropTypes.Requireable<boolean>;
|
|
16
17
|
const disableEffect: PropTypes.Requireable<boolean>;
|
|
17
18
|
const size: PropTypes.Requireable<string>;
|
|
18
|
-
const
|
|
19
|
+
const labelPlacement: PropTypes.Requireable<string>;
|
|
20
|
+
const label: PropTypes.Requireable<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
|
|
19
21
|
}
|
|
20
22
|
namespace defaultProps {
|
|
21
23
|
const className_1: string;
|
|
@@ -30,6 +32,8 @@ declare namespace Checkbox {
|
|
|
30
32
|
export { disableEffect_1 as disableEffect };
|
|
31
33
|
const size_1: string;
|
|
32
34
|
export { size_1 as size };
|
|
35
|
+
const labelPlacement_1: string;
|
|
36
|
+
export { labelPlacement_1 as labelPlacement };
|
|
33
37
|
const label_1: string;
|
|
34
38
|
export { label_1 as label };
|
|
35
39
|
}
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
4
|
var _excluded = ["className", "label", "error", "mixed", "disabled", "size", "disableEffect"],
|
|
5
|
-
_excluded2 = ["className", "label", "onChange", "children"];
|
|
5
|
+
_excluded2 = ["className", "label", "labelPlacement", "onChange", "children"];
|
|
6
6
|
import MUICheckbox from '@material-ui/core/Checkbox';
|
|
7
7
|
import FormControlLabel from '@material-ui/core/FormControlLabel';
|
|
8
8
|
import cx from 'classnames';
|
|
@@ -53,6 +53,7 @@ var DefaultCheckbox = function DefaultCheckbox(_ref) {
|
|
|
53
53
|
var Checkbox = function Checkbox(_ref2) {
|
|
54
54
|
var className = _ref2.className,
|
|
55
55
|
label = _ref2.label,
|
|
56
|
+
labelPlacement = _ref2.labelPlacement,
|
|
56
57
|
onChange = _ref2.onChange,
|
|
57
58
|
children = _ref2.children,
|
|
58
59
|
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
@@ -67,6 +68,7 @@ var Checkbox = function Checkbox(_ref2) {
|
|
|
67
68
|
'FormControlLabel-error': props.error
|
|
68
69
|
}, className),
|
|
69
70
|
label: label || children,
|
|
71
|
+
labelPlacement: labelPlacement,
|
|
70
72
|
control: /*#__PURE__*/React.createElement(DefaultCheckbox, _extends({}, props, {
|
|
71
73
|
label: label
|
|
72
74
|
})),
|
|
@@ -89,7 +91,8 @@ Checkbox.propTypes = {
|
|
|
89
91
|
mixed: PropTypes.bool,
|
|
90
92
|
disableEffect: PropTypes.bool,
|
|
91
93
|
size: PropTypes.oneOf(['small', 'medium']),
|
|
92
|
-
|
|
94
|
+
labelPlacement: PropTypes.oneOf(['top', 'end', 'bottom', 'start']),
|
|
95
|
+
label: PropTypes.oneOfType([PropTypes.string, PropTypes.node])
|
|
93
96
|
};
|
|
94
97
|
Checkbox.defaultProps = {
|
|
95
98
|
className: '',
|
|
@@ -98,6 +101,7 @@ Checkbox.defaultProps = {
|
|
|
98
101
|
mixed: false,
|
|
99
102
|
disableEffect: false,
|
|
100
103
|
size: 'medium',
|
|
104
|
+
labelPlacement: 'end',
|
|
101
105
|
label: ''
|
|
102
106
|
};
|
|
103
107
|
export default Checkbox;
|
|
@@ -31,7 +31,7 @@ var en = {
|
|
|
31
31
|
url: "URL",
|
|
32
32
|
cancel: "Cancel",
|
|
33
33
|
create: "Create",
|
|
34
|
-
edit: "
|
|
34
|
+
edit: "Save",
|
|
35
35
|
created: "The shortcut has been created",
|
|
36
36
|
edited: "The shortcut has been modified",
|
|
37
37
|
errored: "An error occurred",
|
|
@@ -72,7 +72,7 @@ var fr = {
|
|
|
72
72
|
url: "URL",
|
|
73
73
|
cancel: "Annuler",
|
|
74
74
|
create: "Cr\xE9er",
|
|
75
|
-
edit: "
|
|
75
|
+
edit: "Sauvegarder",
|
|
76
76
|
created: "Le raccourci a \xE9t\xE9 cr\xE9\xE9",
|
|
77
77
|
edited: "Le raccourci a \xE9t\xE9 modifi\xE9",
|
|
78
78
|
errored: "Une erreur s'est produite",
|
|
@@ -113,7 +113,7 @@ var ru = {
|
|
|
113
113
|
url: "URL",
|
|
114
114
|
cancel: "\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C",
|
|
115
115
|
create: "\u0421\u043E\u0437\u0434\u0430\u0442\u044C",
|
|
116
|
-
edit: "\
|
|
116
|
+
edit: "\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C",
|
|
117
117
|
created: "\u042F\u0440\u043B\u044B\u043A \u0431\u044B\u043B \u0441\u043E\u0437\u0434\u0430\u043D",
|
|
118
118
|
edited: "\u042F\u0440\u043B\u044B\u043A \u0431\u044B\u043B \u0438\u0437\u043C\u0435\u043D\u0435\u043D",
|
|
119
119
|
errored: "\u041F\u0440\u043E\u0438\u0437\u043E\u0448\u043B\u0430 \u043E\u0448\u0438\u0431\u043A\u0430",
|
|
@@ -154,7 +154,7 @@ var vi = {
|
|
|
154
154
|
url: "URL",
|
|
155
155
|
cancel: "H\u1EE7y",
|
|
156
156
|
create: "T\u1EA1o",
|
|
157
|
-
edit: "
|
|
157
|
+
edit: "L\u01B0u",
|
|
158
158
|
created: "L\u1ED1i t\u1EAFt \u0111\xE3 \u0111\u01B0\u1EE3c t\u1EA1o",
|
|
159
159
|
edited: "L\u1ED1i t\u1EAFt \u0111\xE3 \u0111\u01B0\u1EE3c ch\u1EC9nh s\u1EEDa",
|
|
160
160
|
errored: "\u0110\xE3 x\u1EA3y ra l\u1ED7i",
|
|
@@ -922,6 +922,7 @@ export function makeDarkInvertedOverrides(theme: any): {
|
|
|
922
922
|
width: number;
|
|
923
923
|
height: number;
|
|
924
924
|
padding: string;
|
|
925
|
+
justifyContent: string;
|
|
925
926
|
};
|
|
926
927
|
checked: {
|
|
927
928
|
'& + $track$track': {
|
|
@@ -931,6 +932,7 @@ export function makeDarkInvertedOverrides(theme: any): {
|
|
|
931
932
|
switchBase: {
|
|
932
933
|
padding: number;
|
|
933
934
|
top: number;
|
|
935
|
+
left: number;
|
|
934
936
|
color: any;
|
|
935
937
|
'& .cozySwitchThumb': {
|
|
936
938
|
display: string;
|
|
@@ -922,6 +922,7 @@ export function makeDarkNormalOverrides(theme: any): {
|
|
|
922
922
|
width: number;
|
|
923
923
|
height: number;
|
|
924
924
|
padding: string;
|
|
925
|
+
justifyContent: string;
|
|
925
926
|
};
|
|
926
927
|
checked: {
|
|
927
928
|
'& + $track$track': {
|
|
@@ -931,6 +932,7 @@ export function makeDarkNormalOverrides(theme: any): {
|
|
|
931
932
|
switchBase: {
|
|
932
933
|
padding: number;
|
|
933
934
|
top: number;
|
|
935
|
+
left: number;
|
|
934
936
|
color: any;
|
|
935
937
|
'& .cozySwitchThumb': {
|
|
936
938
|
display: string;
|
|
@@ -922,6 +922,7 @@ export function makeLightInvertedOverrides(theme: any): {
|
|
|
922
922
|
width: number;
|
|
923
923
|
height: number;
|
|
924
924
|
padding: string;
|
|
925
|
+
justifyContent: string;
|
|
925
926
|
};
|
|
926
927
|
checked: {
|
|
927
928
|
'& + $track$track': {
|
|
@@ -931,6 +932,7 @@ export function makeLightInvertedOverrides(theme: any): {
|
|
|
931
932
|
switchBase: {
|
|
932
933
|
padding: number;
|
|
933
934
|
top: number;
|
|
935
|
+
left: number;
|
|
934
936
|
color: any;
|
|
935
937
|
'& .cozySwitchThumb': {
|
|
936
938
|
display: string;
|
|
@@ -922,6 +922,7 @@ export function makeLightNormalOverrides(theme: any): {
|
|
|
922
922
|
width: number;
|
|
923
923
|
height: number;
|
|
924
924
|
padding: string;
|
|
925
|
+
justifyContent: string;
|
|
925
926
|
};
|
|
926
927
|
checked: {
|
|
927
928
|
'& + $track$track': {
|
|
@@ -931,6 +932,7 @@ export function makeLightNormalOverrides(theme: any): {
|
|
|
931
932
|
switchBase: {
|
|
932
933
|
padding: number;
|
|
933
934
|
top: number;
|
|
935
|
+
left: number;
|
|
934
936
|
color: any;
|
|
935
937
|
'& .cozySwitchThumb': {
|
|
936
938
|
display: string;
|
|
@@ -844,9 +844,10 @@ export var makeLightNormalOverrides = function makeLightNormalOverrides(theme) {
|
|
|
844
844
|
},
|
|
845
845
|
MuiSwitch: {
|
|
846
846
|
root: {
|
|
847
|
-
width:
|
|
847
|
+
width: 56,
|
|
848
848
|
height: 40,
|
|
849
|
-
padding: '6px 1px'
|
|
849
|
+
padding: '6px 1px',
|
|
850
|
+
justifyContent: 'center'
|
|
850
851
|
},
|
|
851
852
|
checked: {
|
|
852
853
|
'& + $track$track': {
|
|
@@ -856,6 +857,7 @@ export var makeLightNormalOverrides = function makeLightNormalOverrides(theme) {
|
|
|
856
857
|
switchBase: {
|
|
857
858
|
padding: 5,
|
|
858
859
|
top: 5,
|
|
860
|
+
left: 5,
|
|
859
861
|
color: theme.palette.text.icon,
|
|
860
862
|
'& .cozySwitchThumb': {
|
|
861
863
|
display: 'flex',
|