cozy-ui 121.9.0 → 122.0.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 +16 -0
- package/package.json +1 -1
- package/react/SearchBar/Readme.md +11 -3
- package/react/SearchBar/index.jsx +11 -3
- package/transpiled/react/SearchBar/index.js +36 -26
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
# [122.0.0](https://github.com/cozy/cozy-ui/compare/v121.9.0...v122.0.0) (2025-04-03)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* Accept a number as elevation in SearchBar ([280fc63](https://github.com/cozy/cozy-ui/commit/280fc63))
|
|
7
|
+
* Update font size of SearchBar ([60ea8e8](https://github.com/cozy/cozy-ui/commit/60ea8e8))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### BREAKING CHANGES
|
|
11
|
+
|
|
12
|
+
* SearchBar accepts now a number as elevation instead
|
|
13
|
+
of a bool. If you used `elevation={true}` you can use
|
|
14
|
+
`elevation={1}` and if you used `elevation={false}` you can use
|
|
15
|
+
`elevation={0}.` Default value is kept (it was true so it is 1).
|
|
16
|
+
|
|
1
17
|
# [121.9.0](https://github.com/cozy/cozy-ui/compare/v121.8.0...v121.9.0) (2025-04-01)
|
|
2
18
|
|
|
3
19
|
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@ import Radio from 'cozy-ui/transpiled/react/Radios'
|
|
|
10
10
|
import FormControl from 'cozy-ui/transpiled/react/FormControl'
|
|
11
11
|
import FormLabel from 'cozy-ui/transpiled/react/FormLabel'
|
|
12
12
|
|
|
13
|
-
const initialVariants = [{
|
|
13
|
+
const initialVariants = [{ button: false, customIcon: false, disabledClear: false }]
|
|
14
14
|
initialState = { size: 'small' }
|
|
15
15
|
|
|
16
16
|
;
|
|
@@ -52,7 +52,16 @@ initialState = { size: 'small' }
|
|
|
52
52
|
</FormControl>
|
|
53
53
|
<Typography className="u-mb-half">Normal</Typography>
|
|
54
54
|
<SearchBar className="u-mb-2"
|
|
55
|
-
elevation={
|
|
55
|
+
elevation={0}
|
|
56
|
+
size={state.size}
|
|
57
|
+
disabledClear={variant.disabledClear}
|
|
58
|
+
type={variant.button ? "button" : "search"}
|
|
59
|
+
icon={variant.customIcon ? CloudIcon : undefined}
|
|
60
|
+
label={variant.button ? <Typography color="primary">This is a label</Typography> : undefined}
|
|
61
|
+
/>
|
|
62
|
+
<Typography className="u-mb-half">With elevation</Typography>
|
|
63
|
+
<SearchBar className="u-mb-2"
|
|
64
|
+
elevation={10}
|
|
56
65
|
size={state.size}
|
|
57
66
|
disabledClear={variant.disabledClear}
|
|
58
67
|
type={variant.button ? "button" : "search"}
|
|
@@ -62,7 +71,6 @@ initialState = { size: 'small' }
|
|
|
62
71
|
<Typography className="u-mb-half">Disabled</Typography>
|
|
63
72
|
<SearchBar
|
|
64
73
|
disabled
|
|
65
|
-
elevation={variant.elevation}
|
|
66
74
|
size={state.size}
|
|
67
75
|
disabledClear={variant.disabledClear}
|
|
68
76
|
type={variant.button ? "button" : "search"}
|
|
@@ -25,6 +25,13 @@ const sizeToPixel = {
|
|
|
25
25
|
auto: 'auto'
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
const fontSizeToPixel = {
|
|
29
|
+
small: 14,
|
|
30
|
+
medium: 16,
|
|
31
|
+
large: 16,
|
|
32
|
+
auto: 16
|
|
33
|
+
}
|
|
34
|
+
|
|
28
35
|
const radiusBySize = {
|
|
29
36
|
small: 20,
|
|
30
37
|
medium: 24,
|
|
@@ -62,6 +69,7 @@ const useStyles = makeStyles(theme => ({
|
|
|
62
69
|
},
|
|
63
70
|
inputBase: {
|
|
64
71
|
flex: 1,
|
|
72
|
+
fontSize: ({ size }) => (isTwakeTheme() ? fontSizeToPixel[size] : 16),
|
|
65
73
|
paddingLeft: ({ icon }) => !icon && '1rem'
|
|
66
74
|
},
|
|
67
75
|
buttonBase: {
|
|
@@ -181,7 +189,7 @@ const SearchBar = forwardRef(
|
|
|
181
189
|
return (
|
|
182
190
|
<Paper
|
|
183
191
|
component="form"
|
|
184
|
-
elevation={elevation
|
|
192
|
+
elevation={elevation}
|
|
185
193
|
className={cx(className, classes.root, {
|
|
186
194
|
[classes.flat]: !elevation,
|
|
187
195
|
[classes.elevation]: elevation,
|
|
@@ -238,7 +246,7 @@ const SearchBar = forwardRef(
|
|
|
238
246
|
SearchBar.displayName = 'SearchBar'
|
|
239
247
|
|
|
240
248
|
SearchBar.defaultProps = {
|
|
241
|
-
elevation:
|
|
249
|
+
elevation: 1,
|
|
242
250
|
icon: MagnifierIcon,
|
|
243
251
|
size: 'small',
|
|
244
252
|
type: 'search',
|
|
@@ -266,7 +274,7 @@ SearchBar.propTypes = {
|
|
|
266
274
|
defaultValue: PropTypes.string,
|
|
267
275
|
disabledClear: PropTypes.bool,
|
|
268
276
|
disabledFocus: PropTypes.bool,
|
|
269
|
-
elevation: PropTypes.
|
|
277
|
+
elevation: PropTypes.number,
|
|
270
278
|
placeholder: PropTypes.string,
|
|
271
279
|
label: PropTypes.oneOfType([
|
|
272
280
|
PropTypes.string,
|
|
@@ -32,6 +32,12 @@ var sizeToPixel = {
|
|
|
32
32
|
large: 56,
|
|
33
33
|
auto: 'auto'
|
|
34
34
|
};
|
|
35
|
+
var fontSizeToPixel = {
|
|
36
|
+
small: 14,
|
|
37
|
+
medium: 16,
|
|
38
|
+
large: 16,
|
|
39
|
+
auto: 16
|
|
40
|
+
};
|
|
35
41
|
var radiusBySize = {
|
|
36
42
|
small: 20,
|
|
37
43
|
medium: 24,
|
|
@@ -71,8 +77,12 @@ var useStyles = makeStyles(function (theme) {
|
|
|
71
77
|
},
|
|
72
78
|
inputBase: {
|
|
73
79
|
flex: 1,
|
|
74
|
-
|
|
75
|
-
var
|
|
80
|
+
fontSize: function fontSize(_ref3) {
|
|
81
|
+
var size = _ref3.size;
|
|
82
|
+
return isTwakeTheme() ? fontSizeToPixel[size] : 16;
|
|
83
|
+
},
|
|
84
|
+
paddingLeft: function paddingLeft(_ref4) {
|
|
85
|
+
var icon = _ref4.icon;
|
|
76
86
|
return !icon && '1rem';
|
|
77
87
|
}
|
|
78
88
|
},
|
|
@@ -85,8 +95,8 @@ var useStyles = makeStyles(function (theme) {
|
|
|
85
95
|
typography: {
|
|
86
96
|
color: 'currentColor',
|
|
87
97
|
opacity: 0.42,
|
|
88
|
-
paddingLeft: function paddingLeft(
|
|
89
|
-
var icon =
|
|
98
|
+
paddingLeft: function paddingLeft(_ref5) {
|
|
99
|
+
var icon = _ref5.icon;
|
|
90
100
|
return !icon && '1rem';
|
|
91
101
|
}
|
|
92
102
|
},
|
|
@@ -128,27 +138,27 @@ var useStyles = makeStyles(function (theme) {
|
|
|
128
138
|
}
|
|
129
139
|
};
|
|
130
140
|
});
|
|
131
|
-
var SearchBar = /*#__PURE__*/forwardRef(function (
|
|
141
|
+
var SearchBar = /*#__PURE__*/forwardRef(function (_ref6, ref) {
|
|
132
142
|
var _cx, _componentsProps$inpu;
|
|
133
143
|
|
|
134
|
-
var placeholderProp =
|
|
135
|
-
icon =
|
|
136
|
-
size =
|
|
137
|
-
type =
|
|
138
|
-
labelProp =
|
|
139
|
-
componentsProps =
|
|
140
|
-
disabledClear =
|
|
141
|
-
disabledFocus =
|
|
142
|
-
className =
|
|
143
|
-
defaultValue =
|
|
144
|
-
value =
|
|
145
|
-
elevation =
|
|
146
|
-
disabled =
|
|
147
|
-
onChange =
|
|
148
|
-
onClear =
|
|
149
|
-
onFocus =
|
|
150
|
-
onBlur =
|
|
151
|
-
props = _objectWithoutProperties(
|
|
144
|
+
var placeholderProp = _ref6.placeholder,
|
|
145
|
+
icon = _ref6.icon,
|
|
146
|
+
size = _ref6.size,
|
|
147
|
+
type = _ref6.type,
|
|
148
|
+
labelProp = _ref6.label,
|
|
149
|
+
componentsProps = _ref6.componentsProps,
|
|
150
|
+
disabledClear = _ref6.disabledClear,
|
|
151
|
+
disabledFocus = _ref6.disabledFocus,
|
|
152
|
+
className = _ref6.className,
|
|
153
|
+
defaultValue = _ref6.defaultValue,
|
|
154
|
+
value = _ref6.value,
|
|
155
|
+
elevation = _ref6.elevation,
|
|
156
|
+
disabled = _ref6.disabled,
|
|
157
|
+
onChange = _ref6.onChange,
|
|
158
|
+
onClear = _ref6.onClear,
|
|
159
|
+
onFocus = _ref6.onFocus,
|
|
160
|
+
onBlur = _ref6.onBlur,
|
|
161
|
+
props = _objectWithoutProperties(_ref6, _excluded);
|
|
152
162
|
|
|
153
163
|
var _useI18n = useI18n(),
|
|
154
164
|
t = _useI18n.t;
|
|
@@ -211,7 +221,7 @@ var SearchBar = /*#__PURE__*/forwardRef(function (_ref5, ref) {
|
|
|
211
221
|
|
|
212
222
|
return /*#__PURE__*/React.createElement(Paper, _extends({
|
|
213
223
|
component: "form",
|
|
214
|
-
elevation: elevation
|
|
224
|
+
elevation: elevation,
|
|
215
225
|
className: cx(className, classes.root, (_cx = {}, _defineProperty(_cx, classes.flat, !elevation), _defineProperty(_cx, classes.elevation, elevation), _defineProperty(_cx, classes.focused, isFocused && !disabledFocus), _defineProperty(_cx, classes.disabled, disabled), _cx)),
|
|
216
226
|
ref: ref
|
|
217
227
|
}, props), type === 'button' ? /*#__PURE__*/React.createElement(ButtonBase, {
|
|
@@ -246,7 +256,7 @@ var SearchBar = /*#__PURE__*/forwardRef(function (_ref5, ref) {
|
|
|
246
256
|
});
|
|
247
257
|
SearchBar.displayName = 'SearchBar';
|
|
248
258
|
SearchBar.defaultProps = {
|
|
249
|
-
elevation:
|
|
259
|
+
elevation: 1,
|
|
250
260
|
icon: MagnifierIcon,
|
|
251
261
|
size: 'small',
|
|
252
262
|
type: 'search',
|
|
@@ -275,7 +285,7 @@ SearchBar.propTypes = {
|
|
|
275
285
|
defaultValue: PropTypes.string,
|
|
276
286
|
disabledClear: PropTypes.bool,
|
|
277
287
|
disabledFocus: PropTypes.bool,
|
|
278
|
-
elevation: PropTypes.
|
|
288
|
+
elevation: PropTypes.number,
|
|
279
289
|
placeholder: PropTypes.string,
|
|
280
290
|
label: PropTypes.oneOfType([PropTypes.string, PropTypes.func, PropTypes.object]),
|
|
281
291
|
disabled: PropTypes.bool,
|