@panneau/field-text 3.0.118 → 3.0.126
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/lib/index.js +38 -48
- package/package.json +7 -6
package/lib/index.js
CHANGED
|
@@ -11,16 +11,6 @@ var isEmpty = require('lodash/isEmpty');
|
|
|
11
11
|
var PropTypes = require('prop-types');
|
|
12
12
|
var uuid = require('uuid');
|
|
13
13
|
|
|
14
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
|
-
|
|
16
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
17
|
-
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
18
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
19
|
-
var InputGroup__default = /*#__PURE__*/_interopDefaultLegacy(InputGroup);
|
|
20
|
-
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
21
|
-
var isEmpty__default = /*#__PURE__*/_interopDefaultLegacy(isEmpty);
|
|
22
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
23
|
-
|
|
24
14
|
var definition = [{
|
|
25
15
|
id: 'text',
|
|
26
16
|
component: 'text'
|
|
@@ -42,30 +32,30 @@ var styles = {"inputElement":"panneau-field-text-inputElement"};
|
|
|
42
32
|
|
|
43
33
|
var _excluded = ["horizontal"];
|
|
44
34
|
var propTypes$5 = {
|
|
45
|
-
feedback:
|
|
46
|
-
value:
|
|
47
|
-
errors:
|
|
48
|
-
required:
|
|
49
|
-
disabled:
|
|
50
|
-
readOnly:
|
|
51
|
-
nativeOnChange:
|
|
52
|
-
type:
|
|
53
|
-
placeholder:
|
|
54
|
-
onChange:
|
|
55
|
-
onFocus:
|
|
56
|
-
onBlur:
|
|
57
|
-
align:
|
|
58
|
-
size:
|
|
59
|
-
maxLength:
|
|
60
|
-
prepend:
|
|
61
|
-
append:
|
|
62
|
-
min:
|
|
63
|
-
max:
|
|
64
|
-
dataList:
|
|
65
|
-
inputRef:
|
|
66
|
-
current:
|
|
35
|
+
feedback: PropTypes.oneOf(['valid', 'invalid', 'loading']),
|
|
36
|
+
value: PropTypes.string,
|
|
37
|
+
errors: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
|
|
38
|
+
required: PropTypes.bool,
|
|
39
|
+
disabled: PropTypes.bool,
|
|
40
|
+
readOnly: PropTypes.bool,
|
|
41
|
+
nativeOnChange: PropTypes.bool,
|
|
42
|
+
type: PropTypes.oneOf(['text', 'email', 'tel', 'password', 'textarea', 'number']),
|
|
43
|
+
placeholder: PropTypes.string,
|
|
44
|
+
onChange: PropTypes.func,
|
|
45
|
+
onFocus: PropTypes.func,
|
|
46
|
+
onBlur: PropTypes.func,
|
|
47
|
+
align: PropTypes.oneOf(['left', 'center', 'right']),
|
|
48
|
+
size: PropTypes.oneOf([null, 'lg', 'sm']),
|
|
49
|
+
maxLength: PropTypes.number,
|
|
50
|
+
prepend: PropTypes.node,
|
|
51
|
+
append: PropTypes.node,
|
|
52
|
+
min: PropTypes.number,
|
|
53
|
+
max: PropTypes.number,
|
|
54
|
+
dataList: PropTypes.arrayOf(PropTypes.string),
|
|
55
|
+
inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
56
|
+
current: PropTypes.any // eslint-disable-line
|
|
67
57
|
})]),
|
|
68
|
-
className:
|
|
58
|
+
className: PropTypes.string
|
|
69
59
|
};
|
|
70
60
|
var defaultProps$5 = {
|
|
71
61
|
feedback: null,
|
|
@@ -119,7 +109,7 @@ var InputField = function InputField(_ref) {
|
|
|
119
109
|
}, [dataList]);
|
|
120
110
|
var elProps = {
|
|
121
111
|
ref: inputRef,
|
|
122
|
-
className:
|
|
112
|
+
className: classNames([styles.inputElement, 'form-control', _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "form-control-".concat(size), size !== null), 'is-valid', feedback === 'valid'), 'is-invalid', feedback === 'invalid' || errors !== null), className, className !== null)]),
|
|
123
113
|
onFocus: onFocus,
|
|
124
114
|
onBlur: onBlur,
|
|
125
115
|
value: value !== null ? value : '',
|
|
@@ -138,28 +128,28 @@ var InputField = function InputField(_ref) {
|
|
|
138
128
|
onChange: nativeOnChange ? onChange : function (_ref3) {
|
|
139
129
|
var _ref3$target$value = _ref3.target.value,
|
|
140
130
|
newValue = _ref3$target$value === void 0 ? '' : _ref3$target$value;
|
|
141
|
-
return onChange !== null ? onChange(!
|
|
131
|
+
return onChange !== null ? onChange(!isEmpty(newValue) ? newValue : null) : null;
|
|
142
132
|
}
|
|
143
133
|
};
|
|
144
134
|
elProps.horizontal;
|
|
145
|
-
var cleanProps =
|
|
146
|
-
var inputElement = type !== 'textarea' ? /*#__PURE__*/
|
|
135
|
+
var cleanProps = _objectWithoutProperties(elProps, _excluded);
|
|
136
|
+
var inputElement = type !== 'textarea' ? /*#__PURE__*/React.createElement("input", cleanProps) : /*#__PURE__*/React.createElement("textarea", cleanProps);
|
|
147
137
|
var withInputGroup = prepend !== null || append !== null;
|
|
148
|
-
return /*#__PURE__*/
|
|
138
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, withInputGroup ? /*#__PURE__*/React.createElement(InputGroup, {
|
|
149
139
|
prepend: prepend,
|
|
150
140
|
append: append
|
|
151
|
-
}, inputElement) : inputElement, dataListId !== null ? /*#__PURE__*/
|
|
141
|
+
}, inputElement) : inputElement, dataListId !== null ? /*#__PURE__*/React.createElement("datalist", {
|
|
152
142
|
id: dataListId
|
|
153
143
|
}, dataList.map(function (data, dataIndex) {
|
|
154
|
-
return /*#__PURE__*/
|
|
144
|
+
return /*#__PURE__*/React.createElement("option", {
|
|
155
145
|
key: "option-".concat(dataIndex)
|
|
156
146
|
}, data);
|
|
157
147
|
})) : null);
|
|
158
148
|
};
|
|
159
149
|
InputField.propTypes = propTypes$5;
|
|
160
150
|
InputField.defaultProps = defaultProps$5;
|
|
161
|
-
var InputField$1 = /*#__PURE__*/
|
|
162
|
-
return /*#__PURE__*/
|
|
151
|
+
var InputField$1 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
152
|
+
return /*#__PURE__*/React.createElement(InputField, Object.assign({
|
|
163
153
|
inputRef: ref
|
|
164
154
|
}, props));
|
|
165
155
|
});
|
|
@@ -168,7 +158,7 @@ var InputField$1 = /*#__PURE__*/React__default["default"].forwardRef(function (p
|
|
|
168
158
|
var propTypes$4 = {};
|
|
169
159
|
var defaultProps$4 = {};
|
|
170
160
|
var EmailField = function EmailField(props) {
|
|
171
|
-
return /*#__PURE__*/
|
|
161
|
+
return /*#__PURE__*/React.createElement(InputField$1, Object.assign({}, props, {
|
|
172
162
|
type: "email"
|
|
173
163
|
}));
|
|
174
164
|
};
|
|
@@ -180,7 +170,7 @@ var EmailField$1 = EmailField;
|
|
|
180
170
|
var propTypes$3 = {};
|
|
181
171
|
var defaultProps$3 = {};
|
|
182
172
|
var PasswordField = function PasswordField(props) {
|
|
183
|
-
return /*#__PURE__*/
|
|
173
|
+
return /*#__PURE__*/React.createElement(InputField$1, Object.assign({}, props, {
|
|
184
174
|
type: "password"
|
|
185
175
|
}));
|
|
186
176
|
};
|
|
@@ -192,7 +182,7 @@ var PasswordField$1 = PasswordField;
|
|
|
192
182
|
var propTypes$2 = {};
|
|
193
183
|
var defaultProps$2 = {};
|
|
194
184
|
var TelephoneField = function TelephoneField(props) {
|
|
195
|
-
return /*#__PURE__*/
|
|
185
|
+
return /*#__PURE__*/React.createElement(InputField$1, Object.assign({}, props, {
|
|
196
186
|
type: "tel"
|
|
197
187
|
}));
|
|
198
188
|
};
|
|
@@ -204,7 +194,7 @@ var TelephoneField$1 = TelephoneField;
|
|
|
204
194
|
var propTypes$1 = {};
|
|
205
195
|
var defaultProps$1 = {};
|
|
206
196
|
var TextareaField = function TextareaField(props) {
|
|
207
|
-
return /*#__PURE__*/
|
|
197
|
+
return /*#__PURE__*/React.createElement(InputField$1, Object.assign({}, props, {
|
|
208
198
|
type: "textarea"
|
|
209
199
|
}));
|
|
210
200
|
};
|
|
@@ -216,7 +206,7 @@ var TextareaField$1 = TextareaField;
|
|
|
216
206
|
var propTypes = {};
|
|
217
207
|
var defaultProps = {};
|
|
218
208
|
var TextField = function TextField(props) {
|
|
219
|
-
return /*#__PURE__*/
|
|
209
|
+
return /*#__PURE__*/React.createElement(InputField$1, Object.assign({}, props, {
|
|
220
210
|
type: "text"
|
|
221
211
|
}));
|
|
222
212
|
};
|
|
@@ -228,5 +218,5 @@ exports.Email = EmailField$1;
|
|
|
228
218
|
exports.Password = PasswordField$1;
|
|
229
219
|
exports.Telephone = TelephoneField$1;
|
|
230
220
|
exports.Textarea = TextareaField$1;
|
|
231
|
-
exports
|
|
221
|
+
exports.default = TextField$1;
|
|
232
222
|
exports.definition = definition;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/field-text",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.126",
|
|
4
4
|
"description": "A text field",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -41,7 +41,8 @@
|
|
|
41
41
|
"assets"
|
|
42
42
|
],
|
|
43
43
|
"scripts": {
|
|
44
|
-
"
|
|
44
|
+
"prepublishOnly": "npm run build",
|
|
45
|
+
"build": "../../scripts/prepare-package.sh"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
48
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
@@ -53,9 +54,9 @@
|
|
|
53
54
|
},
|
|
54
55
|
"dependencies": {
|
|
55
56
|
"@babel/runtime": "^7.12.5",
|
|
56
|
-
"@panneau/core": "^3.0.
|
|
57
|
-
"@panneau/field-input-group": "^3.0.
|
|
58
|
-
"@panneau/themes": "^3.0.
|
|
57
|
+
"@panneau/core": "^3.0.126",
|
|
58
|
+
"@panneau/field-input-group": "^3.0.126",
|
|
59
|
+
"@panneau/themes": "^3.0.126",
|
|
59
60
|
"classnames": "^2.2.6",
|
|
60
61
|
"lodash": "^4.17.21",
|
|
61
62
|
"prop-types": "^15.7.2",
|
|
@@ -64,5 +65,5 @@
|
|
|
64
65
|
"publishConfig": {
|
|
65
66
|
"access": "public"
|
|
66
67
|
},
|
|
67
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "fa69ddff3f8cf22b00504093087608d5701e6f6a"
|
|
68
69
|
}
|