cozy-ui 130.11.1 → 131.0.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 +21 -0
- package/package.json +1 -1
- package/react/Contacts/GroupsSelect/GroupCreation.jsx +1 -1
- package/react/Contacts/GroupsSelect/SelectBox/EditGroupName.jsx +1 -1
- package/react/CozyDialogs/SpecificDialogs/helpers/shortcuts.js +3 -1
- package/react/Field/index.jsx +1 -1
- package/react/Input/index.js +3 -0
- package/react/InputGroup/Readme.md +7 -7
- package/react/InputLabel/index.js +3 -0
- package/react/Label/Readme.md +3 -3
- package/react/Labs/PasswordInput/index.jsx +1 -1
- package/react/ListItem/ListItemBase/Renaming/RenameInput.jsx +1 -1
- package/react/TextField/MobileSelect.jsx +60 -18
- package/react/TextField/Readme.md +50 -3
- package/react/TextField/helpers.js +23 -0
- package/react/TextField/index.jsx +36 -33
- package/react/Wizard/index.jsx +1 -1
- package/react/index.js +0 -1
- package/react/{Input → legacy/Input}/Readme.md +7 -7
- package/react/{Input → legacy/Input}/styles.styl +1 -1
- package/stylus/cozy-ui/build.styl +1 -1
- package/transpiled/react/Contacts/GroupsSelect/GroupCreation.js +1 -1
- package/transpiled/react/Contacts/GroupsSelect/SelectBox/EditGroupName.js +1 -1
- package/transpiled/react/CozyDialogs/SpecificDialogs/helpers/shortcuts.js +22 -14
- package/transpiled/react/Field/index.js +1 -1
- package/transpiled/react/Input/index.d.ts +1 -2
- package/transpiled/react/Input/index.js +1 -64
- package/transpiled/react/InputLabel/index.d.ts +2 -0
- package/transpiled/react/InputLabel/index.js +2 -0
- package/transpiled/react/Labs/PasswordInput/index.js +1 -1
- package/transpiled/react/ListItem/ListItemBase/Renaming/RenameInput.js +1 -1
- package/transpiled/react/TextField/MobileSelect.js +29 -18
- package/transpiled/react/TextField/helpers.d.ts +2 -0
- package/transpiled/react/TextField/helpers.js +30 -0
- package/transpiled/react/TextField/index.js +10 -3
- package/transpiled/react/Wizard/index.js +1 -1
- package/transpiled/react/index.d.ts +0 -1
- package/transpiled/react/index.js +0 -1
- package/transpiled/react/legacy/Input/index.d.ts +3 -0
- package/transpiled/react/legacy/Input/index.js +65 -0
- package/transpiled/react/stylesheet.css +1 -1
- /package/react/{Input → legacy/Input}/index.jsx +0 -0
|
@@ -54,27 +54,35 @@ export var checkAndSaveShortcut = /*#__PURE__*/function () {
|
|
|
54
54
|
return _context.abrupt("return");
|
|
55
55
|
|
|
56
56
|
case 9:
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
57
|
+
_context.prev = 9;
|
|
58
|
+
_context.next = 12;
|
|
59
|
+
return onSave(validFileName, validURL);
|
|
60
|
+
|
|
61
|
+
case 12:
|
|
62
|
+
showAlert({
|
|
63
|
+
message: isEditing ? t('shortcut-dialog.edited') : t('shortcut-dialog.created'),
|
|
64
|
+
severity: 'success'
|
|
65
|
+
});
|
|
66
|
+
_context.next = 18;
|
|
67
|
+
break;
|
|
68
|
+
|
|
69
|
+
case 15:
|
|
70
|
+
_context.prev = 15;
|
|
71
|
+
_context.t0 = _context["catch"](9);
|
|
72
|
+
showAlert({
|
|
73
|
+
message: t('shortcut-dialog.errored'),
|
|
74
|
+
severity: 'error'
|
|
75
|
+
});
|
|
69
76
|
|
|
77
|
+
case 18:
|
|
70
78
|
onClose();
|
|
71
79
|
|
|
72
|
-
case
|
|
80
|
+
case 19:
|
|
73
81
|
case "end":
|
|
74
82
|
return _context.stop();
|
|
75
83
|
}
|
|
76
84
|
}
|
|
77
|
-
}, _callee);
|
|
85
|
+
}, _callee, null, [[9, 15]]);
|
|
78
86
|
}));
|
|
79
87
|
|
|
80
88
|
return function checkAndSaveShortcut(_x) {
|
|
@@ -23,7 +23,7 @@ var styles = {
|
|
|
23
23
|
"o-side-fullwidth": "styles__o-side-fullwidth___7WcCI"
|
|
24
24
|
};
|
|
25
25
|
import ContactPicker from "cozy-ui/transpiled/react/ContactPicker";
|
|
26
|
-
import Input from "cozy-ui/transpiled/react/Input";
|
|
26
|
+
import Input from "cozy-ui/transpiled/react/legacy/Input";
|
|
27
27
|
import Label from "cozy-ui/transpiled/react/Label";
|
|
28
28
|
var labelStyles = {
|
|
29
29
|
"c-label": "styles__c-label___o4ozG",
|
|
@@ -1,65 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["autoComplete", "disabled", "type", "id", "className", "value", "placeholder", "error", "size", "fullwidth"];
|
|
5
|
-
import cx from 'classnames';
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
|
-
import React, { forwardRef } from 'react';
|
|
8
|
-
var styles = {
|
|
9
|
-
"c-input-text": "styles__c-input-text___3TAv1",
|
|
10
|
-
"is-error": "styles__is-error___3lsCJ",
|
|
11
|
-
"c-input-text--tiny": "styles__c-input-text--tiny___MzMoD",
|
|
12
|
-
"c-input-text--medium": "styles__c-input-text--medium___28jPV",
|
|
13
|
-
"c-input-text--large": "styles__c-input-text--large___28EaR",
|
|
14
|
-
"c-input-text--fullwidth": "styles__c-input-text--fullwidth___33o_f"
|
|
15
|
-
};
|
|
16
|
-
var Input = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
17
|
-
var _cx;
|
|
18
|
-
|
|
19
|
-
var autoComplete = props.autoComplete,
|
|
20
|
-
disabled = props.disabled,
|
|
21
|
-
type = props.type,
|
|
22
|
-
id = props.id,
|
|
23
|
-
className = props.className,
|
|
24
|
-
value = props.value,
|
|
25
|
-
placeholder = props.placeholder,
|
|
26
|
-
error = props.error,
|
|
27
|
-
size = props.size,
|
|
28
|
-
fullwidth = props.fullwidth,
|
|
29
|
-
restProps = _objectWithoutProperties(props, _excluded);
|
|
30
|
-
|
|
31
|
-
return /*#__PURE__*/React.createElement("input", _extends({
|
|
32
|
-
"aria-disabled": disabled,
|
|
33
|
-
autoComplete: autoComplete,
|
|
34
|
-
type: type,
|
|
35
|
-
id: id,
|
|
36
|
-
ref: ref,
|
|
37
|
-
className: cx(styles['c-input-text'], (_cx = {}, _defineProperty(_cx, styles["is-error"], error), _defineProperty(_cx, styles["c-input-text--".concat(size)], size), _defineProperty(_cx, styles["c-input-text--fullwidth"], fullwidth), _cx), className),
|
|
38
|
-
disabled: disabled,
|
|
39
|
-
placeholder: placeholder,
|
|
40
|
-
value: value,
|
|
41
|
-
spellCheck: false
|
|
42
|
-
}, restProps));
|
|
43
|
-
});
|
|
44
|
-
Input.displayName = 'Input';
|
|
45
|
-
Input.propTypes = {
|
|
46
|
-
autoComplete: PropTypes.string,
|
|
47
|
-
disabled: PropTypes.bool,
|
|
48
|
-
type: PropTypes.oneOf(['date', 'email', 'number', 'password', 'text', 'url', 'tel']),
|
|
49
|
-
id: PropTypes.string,
|
|
50
|
-
className: PropTypes.string,
|
|
51
|
-
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
52
|
-
placeholder: PropTypes.string,
|
|
53
|
-
error: PropTypes.bool,
|
|
54
|
-
size: PropTypes.oneOf(['tiny', 'medium', 'large']),
|
|
55
|
-
fullwidth: PropTypes.bool,
|
|
56
|
-
onChange: PropTypes.func,
|
|
57
|
-
onKeyUp: PropTypes.func
|
|
58
|
-
};
|
|
59
|
-
Input.defaultProps = {
|
|
60
|
-
type: 'text',
|
|
61
|
-
error: false,
|
|
62
|
-
fullwidth: false,
|
|
63
|
-
size: 'large'
|
|
64
|
-
};
|
|
1
|
+
import Input from '@material-ui/core/Input';
|
|
65
2
|
export default Input;
|
|
@@ -20,7 +20,7 @@ var styles = {
|
|
|
20
20
|
import Icon from "cozy-ui/transpiled/react/Icon";
|
|
21
21
|
import EyeIcon from "cozy-ui/transpiled/react/Icons/Eye";
|
|
22
22
|
import EyeClosedIcon from "cozy-ui/transpiled/react/Icons/EyeClosed";
|
|
23
|
-
import Input from "cozy-ui/transpiled/react/Input";
|
|
23
|
+
import Input from "cozy-ui/transpiled/react/legacy/Input";
|
|
24
24
|
import InputGroup from "cozy-ui/transpiled/react/InputGroup";
|
|
25
25
|
|
|
26
26
|
var HideShowButton = function HideShowButton(props) {
|
|
@@ -7,7 +7,7 @@ import { useClient } from 'cozy-client';
|
|
|
7
7
|
import { splitFilename } from 'cozy-client/dist/models/file';
|
|
8
8
|
import RenameDialog from "cozy-ui/transpiled/react/ListItem/ListItemBase/Renaming/RenameDialog";
|
|
9
9
|
import { renameFile } from "cozy-ui/transpiled/react/ListItem/ListItemBase/Renaming/helpers";
|
|
10
|
-
import Input from "cozy-ui/transpiled/react/Input";
|
|
10
|
+
import Input from "cozy-ui/transpiled/react/legacy/Input";
|
|
11
11
|
import InputGroup from "cozy-ui/transpiled/react/InputGroup";
|
|
12
12
|
import Spinner from "cozy-ui/transpiled/react/Spinner";
|
|
13
13
|
import { makeStyles } from "cozy-ui/transpiled/react/styles";
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["name", "options", "disabled", "value", "children", "onClick", "onChange"];
|
|
4
|
+
var _excluded = ["id", "name", "options", "disabled", "value", "children", "onClick", "onChange"];
|
|
5
5
|
import MuiTextField from '@material-ui/core/TextField';
|
|
6
6
|
import merge from 'lodash/merge';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import React, { forwardRef, useEffect, useState } from 'react';
|
|
9
|
+
import { getLabelByValue, toggleInArray } from "cozy-ui/transpiled/react/TextField/helpers";
|
|
9
10
|
import ActionsMenuItem from "cozy-ui/transpiled/react/ActionsMenu/ActionsMenuItem";
|
|
10
11
|
import ActionsMenuWrapper from "cozy-ui/transpiled/react/ActionsMenu/ActionsMenuWrapper";
|
|
12
|
+
import Checkbox from "cozy-ui/transpiled/react/Checkbox";
|
|
11
13
|
import Icon from "cozy-ui/transpiled/react/Icon";
|
|
12
14
|
import BottomIcon from "cozy-ui/transpiled/react/Icons/Bottom";
|
|
13
15
|
import InputAdornment from "cozy-ui/transpiled/react/InputAdornment";
|
|
@@ -15,9 +17,8 @@ import ListItemIcon from "cozy-ui/transpiled/react/ListItemIcon";
|
|
|
15
17
|
import ListItemText from "cozy-ui/transpiled/react/ListItemText";
|
|
16
18
|
import Radio from "cozy-ui/transpiled/react/Radios";
|
|
17
19
|
var MobileSelect = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
var name = _ref.name,
|
|
20
|
+
var id = _ref.id,
|
|
21
|
+
name = _ref.name,
|
|
21
22
|
options = _ref.options,
|
|
22
23
|
disabled = _ref.disabled,
|
|
23
24
|
value = _ref.value,
|
|
@@ -26,11 +27,12 @@ var MobileSelect = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
26
27
|
onChange = _ref.onChange,
|
|
27
28
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
28
29
|
|
|
29
|
-
// As they are controlled input, we have to set empty string as default
|
|
30
|
+
var isMultiple = Array.isArray(value); // As they are controlled input, we have to set empty string as default
|
|
30
31
|
// because values can't be undefined and then defined
|
|
32
|
+
|
|
31
33
|
var _useState = useState({
|
|
32
34
|
label: '',
|
|
33
|
-
value: ''
|
|
35
|
+
value: isMultiple ? [] : ''
|
|
34
36
|
}),
|
|
35
37
|
_useState2 = _slicedToArray(_useState, 2),
|
|
36
38
|
state = _useState2[0],
|
|
@@ -41,9 +43,9 @@ var MobileSelect = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
41
43
|
showDrawer = _useState4[0],
|
|
42
44
|
setShowDrawer = _useState4[1];
|
|
43
45
|
|
|
44
|
-
var initialLabel =
|
|
45
|
-
return
|
|
46
|
-
}))
|
|
46
|
+
var initialLabel = isMultiple ? value.map(function (v) {
|
|
47
|
+
return getLabelByValue(options, v);
|
|
48
|
+
}).join(', ') : getLabelByValue(options, value);
|
|
47
49
|
|
|
48
50
|
var handleClick = function handleClick() {
|
|
49
51
|
setShowDrawer(true);
|
|
@@ -55,18 +57,20 @@ var MobileSelect = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
55
57
|
children = _ref2.children,
|
|
56
58
|
onClick = _ref2.onClick;
|
|
57
59
|
return function (ev) {
|
|
60
|
+
var _value = isMultiple ? toggleInArray(state.value, value) : value;
|
|
61
|
+
|
|
58
62
|
onClick === null || onClick === void 0 ? void 0 : onClick(merge({}, ev, {
|
|
59
63
|
target: {
|
|
60
|
-
value:
|
|
64
|
+
value: _value
|
|
61
65
|
}
|
|
62
66
|
}));
|
|
63
67
|
setState({
|
|
64
68
|
label: children,
|
|
65
|
-
value:
|
|
69
|
+
value: _value
|
|
66
70
|
});
|
|
67
71
|
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
68
72
|
target: {
|
|
69
|
-
value:
|
|
73
|
+
value: _value
|
|
70
74
|
}
|
|
71
75
|
});
|
|
72
76
|
};
|
|
@@ -79,10 +83,11 @@ var MobileSelect = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
79
83
|
useEffect(function () {
|
|
80
84
|
setState({
|
|
81
85
|
label: initialLabel || '',
|
|
82
|
-
value: value || ''
|
|
86
|
+
value: value || (isMultiple ? [] : '')
|
|
83
87
|
});
|
|
84
|
-
}, [initialLabel, value]);
|
|
88
|
+
}, [initialLabel, value, isMultiple]);
|
|
85
89
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MuiTextField, {
|
|
90
|
+
id: id,
|
|
86
91
|
style: {
|
|
87
92
|
display: 'none'
|
|
88
93
|
},
|
|
@@ -105,20 +110,25 @@ var MobileSelect = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
105
110
|
position: "end"
|
|
106
111
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
107
112
|
icon: BottomIcon,
|
|
113
|
+
rotate: showDrawer ? 180 : 0,
|
|
108
114
|
color: disabled ? 'var(--disabledTextColor)' : 'var(--iconTextColor)'
|
|
109
115
|
}))
|
|
110
116
|
},
|
|
111
117
|
onClick: handleClick
|
|
112
118
|
})), showDrawer && /*#__PURE__*/React.createElement(ActionsMenuWrapper, {
|
|
113
119
|
open: true,
|
|
114
|
-
autoClose:
|
|
120
|
+
autoClose: !isMultiple,
|
|
115
121
|
onClose: handleClose
|
|
116
122
|
}, React.Children.map(children, function (child) {
|
|
117
123
|
return /*#__PURE__*/React.isValidElement(child) ? /*#__PURE__*/React.createElement(ActionsMenuItem, _extends({}, child.props, {
|
|
118
124
|
size: "small",
|
|
119
|
-
autoFocus: child.props.value === value,
|
|
125
|
+
autoFocus: isMultiple ? child.props.value === value[0] : child.props.value === value,
|
|
120
126
|
onClick: handleItemClick(child.props)
|
|
121
|
-
}), /*#__PURE__*/React.createElement(ListItemIcon, null, /*#__PURE__*/React.createElement(
|
|
127
|
+
}), /*#__PURE__*/React.createElement(ListItemIcon, null, isMultiple ? /*#__PURE__*/React.createElement(Checkbox, {
|
|
128
|
+
"aria-hidden": "true",
|
|
129
|
+
tabIndex: "-1",
|
|
130
|
+
checked: state.value.includes(child.props.value)
|
|
131
|
+
}) : /*#__PURE__*/React.createElement(Radio, {
|
|
122
132
|
"aria-hidden": "true",
|
|
123
133
|
tabIndex: "-1",
|
|
124
134
|
checked: child.props.value === state.value
|
|
@@ -127,11 +137,12 @@ var MobileSelect = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
127
137
|
})) : null;
|
|
128
138
|
})));
|
|
129
139
|
});
|
|
140
|
+
MobileSelect.displayName = 'MobileSelect';
|
|
130
141
|
MobileSelect.propTypes = {
|
|
131
142
|
name: PropTypes.string,
|
|
132
143
|
options: PropTypes.array,
|
|
133
144
|
disabled: PropTypes.bool,
|
|
134
|
-
value: PropTypes.string,
|
|
145
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
|
|
135
146
|
children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)]),
|
|
136
147
|
onClick: PropTypes.func,
|
|
137
148
|
onChange: PropTypes.func
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Add or Remove a value inside an array
|
|
3
|
+
* @param {array} arr
|
|
4
|
+
* @param {string} value
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
7
|
+
export var toggleInArray = function toggleInArray(arr, value) {
|
|
8
|
+
var s = new Set(arr);
|
|
9
|
+
|
|
10
|
+
if (s.has(value)) {
|
|
11
|
+
s.delete(value);
|
|
12
|
+
} else {
|
|
13
|
+
s.add(value);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return Array.from(s);
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* @param {array} options
|
|
20
|
+
* @param {string} value
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
export var getLabelByValue = function getLabelByValue(options, value) {
|
|
25
|
+
var _options$find;
|
|
26
|
+
|
|
27
|
+
return (_options$find = options.find(function (option) {
|
|
28
|
+
return option.value === value;
|
|
29
|
+
})) === null || _options$find === void 0 ? void 0 : _options$find.label;
|
|
30
|
+
};
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
1
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["select", "options", "children"];
|
|
4
|
+
var _excluded = ["select", "SelectProps", "options", "children"];
|
|
5
|
+
|
|
6
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
|
+
|
|
8
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
9
|
+
|
|
4
10
|
import MuiTextField from '@material-ui/core/TextField';
|
|
5
11
|
import React, { forwardRef } from 'react';
|
|
6
12
|
import MobileSelect from "cozy-ui/transpiled/react/TextField/MobileSelect";
|
|
@@ -10,6 +16,7 @@ import { getRandomUUID } from "cozy-ui/transpiled/react/helpers/getRandomUUID";
|
|
|
10
16
|
import { useBreakpoints } from "cozy-ui/transpiled/react/providers/Breakpoints";
|
|
11
17
|
var TextField = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
12
18
|
var select = _ref.select,
|
|
19
|
+
SelectProps = _ref.SelectProps,
|
|
13
20
|
options = _ref.options,
|
|
14
21
|
children = _ref.children,
|
|
15
22
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -33,14 +40,14 @@ var TextField = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
33
40
|
ref: ref,
|
|
34
41
|
id: uuid,
|
|
35
42
|
select: select,
|
|
36
|
-
SelectProps: {
|
|
43
|
+
SelectProps: _objectSpread(_objectSpread({}, SelectProps), {}, {
|
|
37
44
|
IconComponent: function IconComponent(iconProps) {
|
|
38
45
|
return /*#__PURE__*/React.createElement(Icon, _extends({}, iconProps, {
|
|
39
46
|
icon: BottomIcon,
|
|
40
47
|
color: props.disabled ? 'var(--disabledTextColor)' : 'var(--iconTextColor)'
|
|
41
48
|
}));
|
|
42
49
|
}
|
|
43
|
-
}
|
|
50
|
+
})
|
|
44
51
|
}, props), children);
|
|
45
52
|
});
|
|
46
53
|
TextField.displayName = 'TextField';
|
|
@@ -46,7 +46,7 @@ var styles = {
|
|
|
46
46
|
};
|
|
47
47
|
import Icon from "cozy-ui/transpiled/react/Icon";
|
|
48
48
|
import CloudIcon from "cozy-ui/transpiled/react/Icons/Cloud";
|
|
49
|
-
import Input from "cozy-ui/transpiled/react/Input";
|
|
49
|
+
import Input from "cozy-ui/transpiled/react/legacy/Input";
|
|
50
50
|
import Typography from "cozy-ui/transpiled/react/Typography";
|
|
51
51
|
import Button from "cozy-ui/transpiled/react/deprecated/Button";
|
|
52
52
|
export var Wizard = function Wizard(_ref) {
|
|
@@ -25,7 +25,6 @@ export { default as MidEllipsis } from "./MidEllipsis";
|
|
|
25
25
|
export { default as ActionsMenu } from "./ActionsMenu";
|
|
26
26
|
export { default as Overlay } from "./deprecated/Overlay";
|
|
27
27
|
export { default as Label } from "./Label";
|
|
28
|
-
export { default as Input } from "./Input";
|
|
29
28
|
export { default as Checkbox } from "./Checkbox";
|
|
30
29
|
export { default as Radio } from "./deprecated/Radio";
|
|
31
30
|
export { default as Textarea } from "./Textarea";
|
|
@@ -31,7 +31,6 @@ export { default as ActionMenu, ActionMenuItem, ActionMenuHeader, ActionMenuRadi
|
|
|
31
31
|
export { default as ActionsMenu } from './ActionsMenu';
|
|
32
32
|
export { default as Overlay } from './deprecated/Overlay';
|
|
33
33
|
export { default as Label } from './Label';
|
|
34
|
-
export { default as Input } from './Input';
|
|
35
34
|
export { default as Checkbox } from './Checkbox';
|
|
36
35
|
export { default as Radio } from './deprecated/Radio';
|
|
37
36
|
export { default as Textarea } from './Textarea';
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["autoComplete", "disabled", "type", "id", "className", "value", "placeholder", "error", "size", "fullwidth"];
|
|
5
|
+
import cx from 'classnames';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import React, { forwardRef } from 'react';
|
|
8
|
+
var styles = {
|
|
9
|
+
"c-input-text": "styles__c-input-text___1Tl4E",
|
|
10
|
+
"is-error": "styles__is-error___wKsQv",
|
|
11
|
+
"c-input-text--tiny": "styles__c-input-text--tiny___wubKz",
|
|
12
|
+
"c-input-text--medium": "styles__c-input-text--medium___1ISo1",
|
|
13
|
+
"c-input-text--large": "styles__c-input-text--large___2sSPx",
|
|
14
|
+
"c-input-text--fullwidth": "styles__c-input-text--fullwidth___cqKU6"
|
|
15
|
+
};
|
|
16
|
+
var Input = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
17
|
+
var _cx;
|
|
18
|
+
|
|
19
|
+
var autoComplete = props.autoComplete,
|
|
20
|
+
disabled = props.disabled,
|
|
21
|
+
type = props.type,
|
|
22
|
+
id = props.id,
|
|
23
|
+
className = props.className,
|
|
24
|
+
value = props.value,
|
|
25
|
+
placeholder = props.placeholder,
|
|
26
|
+
error = props.error,
|
|
27
|
+
size = props.size,
|
|
28
|
+
fullwidth = props.fullwidth,
|
|
29
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
30
|
+
|
|
31
|
+
return /*#__PURE__*/React.createElement("input", _extends({
|
|
32
|
+
"aria-disabled": disabled,
|
|
33
|
+
autoComplete: autoComplete,
|
|
34
|
+
type: type,
|
|
35
|
+
id: id,
|
|
36
|
+
ref: ref,
|
|
37
|
+
className: cx(styles['c-input-text'], (_cx = {}, _defineProperty(_cx, styles["is-error"], error), _defineProperty(_cx, styles["c-input-text--".concat(size)], size), _defineProperty(_cx, styles["c-input-text--fullwidth"], fullwidth), _cx), className),
|
|
38
|
+
disabled: disabled,
|
|
39
|
+
placeholder: placeholder,
|
|
40
|
+
value: value,
|
|
41
|
+
spellCheck: false
|
|
42
|
+
}, restProps));
|
|
43
|
+
});
|
|
44
|
+
Input.displayName = 'Input';
|
|
45
|
+
Input.propTypes = {
|
|
46
|
+
autoComplete: PropTypes.string,
|
|
47
|
+
disabled: PropTypes.bool,
|
|
48
|
+
type: PropTypes.oneOf(['date', 'email', 'number', 'password', 'text', 'url', 'tel']),
|
|
49
|
+
id: PropTypes.string,
|
|
50
|
+
className: PropTypes.string,
|
|
51
|
+
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
52
|
+
placeholder: PropTypes.string,
|
|
53
|
+
error: PropTypes.bool,
|
|
54
|
+
size: PropTypes.oneOf(['tiny', 'medium', 'large']),
|
|
55
|
+
fullwidth: PropTypes.bool,
|
|
56
|
+
onChange: PropTypes.func,
|
|
57
|
+
onKeyUp: PropTypes.func
|
|
58
|
+
};
|
|
59
|
+
Input.defaultProps = {
|
|
60
|
+
type: 'text',
|
|
61
|
+
error: false,
|
|
62
|
+
fullwidth: false,
|
|
63
|
+
size: 'large'
|
|
64
|
+
};
|
|
65
|
+
export default Input;
|