@panneau/field-text 3.0.223 → 3.0.226
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/package.json +11 -6
- package/lib/index.js +0 -225
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/field-text",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.226",
|
|
4
4
|
"description": "A text field",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -33,8 +33,13 @@
|
|
|
33
33
|
}
|
|
34
34
|
],
|
|
35
35
|
"license": "ISC",
|
|
36
|
-
"
|
|
36
|
+
"type": "module",
|
|
37
37
|
"module": "es/index.js",
|
|
38
|
+
"exports": {
|
|
39
|
+
".": "./es/index.js",
|
|
40
|
+
"./assets/css/styles": "./assets/css/styles.css",
|
|
41
|
+
"./assets/css/styles.css": "./assets/css/styles.css"
|
|
42
|
+
},
|
|
38
43
|
"files": [
|
|
39
44
|
"lib",
|
|
40
45
|
"es",
|
|
@@ -54,9 +59,9 @@
|
|
|
54
59
|
},
|
|
55
60
|
"dependencies": {
|
|
56
61
|
"@babel/runtime": "^7.12.5",
|
|
57
|
-
"@panneau/core": "^3.0.
|
|
58
|
-
"@panneau/field-input-group": "^3.0.
|
|
59
|
-
"@panneau/themes": "^3.0.
|
|
62
|
+
"@panneau/core": "^3.0.224",
|
|
63
|
+
"@panneau/field-input-group": "^3.0.226",
|
|
64
|
+
"@panneau/themes": "^3.0.224",
|
|
60
65
|
"classnames": "^2.5.1",
|
|
61
66
|
"lodash": "^4.17.21",
|
|
62
67
|
"prop-types": "^15.7.2",
|
|
@@ -65,5 +70,5 @@
|
|
|
65
70
|
"publishConfig": {
|
|
66
71
|
"access": "public"
|
|
67
72
|
},
|
|
68
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "9615a4d3021e9ad9b15be01e998dd6f366f8f705"
|
|
69
74
|
}
|
package/lib/index.js
DELETED
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var React = require('react');
|
|
6
|
-
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
7
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
8
|
-
var classNames = require('classnames');
|
|
9
|
-
var isEmpty = require('lodash/isEmpty');
|
|
10
|
-
var PropTypes = require('prop-types');
|
|
11
|
-
var uuid = require('uuid');
|
|
12
|
-
var InputGroup = require('@panneau/field-input-group');
|
|
13
|
-
|
|
14
|
-
var definition = [{
|
|
15
|
-
id: 'text',
|
|
16
|
-
component: 'text'
|
|
17
|
-
}, {
|
|
18
|
-
id: 'email',
|
|
19
|
-
component: 'email'
|
|
20
|
-
}, {
|
|
21
|
-
id: 'password',
|
|
22
|
-
component: 'password'
|
|
23
|
-
}, {
|
|
24
|
-
id: 'telephone',
|
|
25
|
-
component: 'telephone'
|
|
26
|
-
}, {
|
|
27
|
-
id: 'textarea',
|
|
28
|
-
component: 'textarea'
|
|
29
|
-
}];
|
|
30
|
-
|
|
31
|
-
var styles = {"inputElement":"panneau-field-text-inputElement"};
|
|
32
|
-
|
|
33
|
-
var _excluded = ["horizontal"];
|
|
34
|
-
var propTypes$5 = {
|
|
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
|
|
57
|
-
})]),
|
|
58
|
-
style: PropTypes.shape({}),
|
|
59
|
-
className: PropTypes.string
|
|
60
|
-
};
|
|
61
|
-
var defaultProps$5 = {
|
|
62
|
-
feedback: null,
|
|
63
|
-
value: null,
|
|
64
|
-
errors: null,
|
|
65
|
-
required: false,
|
|
66
|
-
disabled: false,
|
|
67
|
-
readOnly: false,
|
|
68
|
-
nativeOnChange: false,
|
|
69
|
-
type: null,
|
|
70
|
-
placeholder: null,
|
|
71
|
-
onChange: null,
|
|
72
|
-
onFocus: null,
|
|
73
|
-
onBlur: null,
|
|
74
|
-
align: null,
|
|
75
|
-
size: null,
|
|
76
|
-
maxLength: null,
|
|
77
|
-
prepend: null,
|
|
78
|
-
append: null,
|
|
79
|
-
min: null,
|
|
80
|
-
max: null,
|
|
81
|
-
dataList: null,
|
|
82
|
-
inputRef: null,
|
|
83
|
-
style: null,
|
|
84
|
-
className: null
|
|
85
|
-
};
|
|
86
|
-
var InputField = function InputField(_ref) {
|
|
87
|
-
var feedback = _ref.feedback,
|
|
88
|
-
value = _ref.value,
|
|
89
|
-
errors = _ref.errors,
|
|
90
|
-
required = _ref.required,
|
|
91
|
-
disabled = _ref.disabled,
|
|
92
|
-
readOnly = _ref.readOnly,
|
|
93
|
-
nativeOnChange = _ref.nativeOnChange,
|
|
94
|
-
type = _ref.type,
|
|
95
|
-
placeholder = _ref.placeholder,
|
|
96
|
-
onChange = _ref.onChange,
|
|
97
|
-
onFocus = _ref.onFocus,
|
|
98
|
-
onBlur = _ref.onBlur,
|
|
99
|
-
align = _ref.align,
|
|
100
|
-
size = _ref.size,
|
|
101
|
-
maxLength = _ref.maxLength,
|
|
102
|
-
prepend = _ref.prepend,
|
|
103
|
-
append = _ref.append,
|
|
104
|
-
min = _ref.min,
|
|
105
|
-
max = _ref.max,
|
|
106
|
-
dataList = _ref.dataList,
|
|
107
|
-
inputRef = _ref.inputRef,
|
|
108
|
-
style = _ref.style,
|
|
109
|
-
className = _ref.className;
|
|
110
|
-
var dataListId = React.useMemo(function () {
|
|
111
|
-
return dataList !== null ? uuid.v1() : null;
|
|
112
|
-
}, [dataList]);
|
|
113
|
-
var elProps = {
|
|
114
|
-
ref: inputRef,
|
|
115
|
-
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)]),
|
|
116
|
-
onFocus: onFocus,
|
|
117
|
-
onBlur: onBlur,
|
|
118
|
-
value: value !== null ? value : '',
|
|
119
|
-
style: {
|
|
120
|
-
textAlign: align
|
|
121
|
-
},
|
|
122
|
-
placeholder: placeholder,
|
|
123
|
-
type: type,
|
|
124
|
-
maxLength: maxLength,
|
|
125
|
-
min: min,
|
|
126
|
-
max: max,
|
|
127
|
-
required: required,
|
|
128
|
-
disabled: disabled,
|
|
129
|
-
readOnly: readOnly,
|
|
130
|
-
list: dataListId,
|
|
131
|
-
onChange: nativeOnChange ? onChange : function (_ref3) {
|
|
132
|
-
var _ref3$target$value = _ref3.target.value,
|
|
133
|
-
newValue = _ref3$target$value === void 0 ? '' : _ref3$target$value;
|
|
134
|
-
return onChange !== null ? onChange(!isEmpty(newValue) ? newValue : null) : null;
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
elProps.horizontal;
|
|
138
|
-
var cleanProps = _objectWithoutProperties(elProps, _excluded);
|
|
139
|
-
var inputElement = type !== 'textarea' ? /*#__PURE__*/React.createElement("input", Object.assign({}, cleanProps, {
|
|
140
|
-
style: style
|
|
141
|
-
})) : /*#__PURE__*/React.createElement("textarea", Object.assign({
|
|
142
|
-
style: style
|
|
143
|
-
}, cleanProps));
|
|
144
|
-
var withInputGroup = prepend !== null || append !== null;
|
|
145
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, withInputGroup ? /*#__PURE__*/React.createElement(InputGroup, {
|
|
146
|
-
prepend: prepend,
|
|
147
|
-
append: append
|
|
148
|
-
}, inputElement) : inputElement, dataListId !== null ? /*#__PURE__*/React.createElement("datalist", {
|
|
149
|
-
id: dataListId
|
|
150
|
-
}, dataList.map(function (data, dataIndex) {
|
|
151
|
-
return /*#__PURE__*/React.createElement("option", {
|
|
152
|
-
key: "option-".concat(dataIndex)
|
|
153
|
-
}, data);
|
|
154
|
-
})) : null);
|
|
155
|
-
};
|
|
156
|
-
InputField.propTypes = propTypes$5;
|
|
157
|
-
InputField.defaultProps = defaultProps$5;
|
|
158
|
-
var InputField$1 = InputField; // React.forwardRef((props, ref) => <InputField inputRef={ref} {...props} />);
|
|
159
|
-
|
|
160
|
-
/* eslint-disable react/jsx-props-no-spreading */
|
|
161
|
-
var propTypes$4 = {};
|
|
162
|
-
var defaultProps$4 = {};
|
|
163
|
-
var EmailField = function EmailField(props) {
|
|
164
|
-
return /*#__PURE__*/React.createElement(InputField$1, Object.assign({}, props, {
|
|
165
|
-
type: "email"
|
|
166
|
-
}));
|
|
167
|
-
};
|
|
168
|
-
EmailField.propTypes = propTypes$4;
|
|
169
|
-
EmailField.defaultProps = defaultProps$4;
|
|
170
|
-
var EmailField$1 = EmailField;
|
|
171
|
-
|
|
172
|
-
/* eslint-disable react/jsx-props-no-spreading */
|
|
173
|
-
var propTypes$3 = {};
|
|
174
|
-
var defaultProps$3 = {};
|
|
175
|
-
var PasswordField = function PasswordField(props) {
|
|
176
|
-
return /*#__PURE__*/React.createElement(InputField$1, Object.assign({}, props, {
|
|
177
|
-
type: "password"
|
|
178
|
-
}));
|
|
179
|
-
};
|
|
180
|
-
PasswordField.propTypes = propTypes$3;
|
|
181
|
-
PasswordField.defaultProps = defaultProps$3;
|
|
182
|
-
var PasswordField$1 = PasswordField;
|
|
183
|
-
|
|
184
|
-
/* eslint-disable react/jsx-props-no-spreading */
|
|
185
|
-
var propTypes$2 = {};
|
|
186
|
-
var defaultProps$2 = {};
|
|
187
|
-
var TelephoneField = function TelephoneField(props) {
|
|
188
|
-
return /*#__PURE__*/React.createElement(InputField$1, Object.assign({}, props, {
|
|
189
|
-
type: "tel"
|
|
190
|
-
}));
|
|
191
|
-
};
|
|
192
|
-
TelephoneField.propTypes = propTypes$2;
|
|
193
|
-
TelephoneField.defaultProps = defaultProps$2;
|
|
194
|
-
var TelephoneField$1 = TelephoneField;
|
|
195
|
-
|
|
196
|
-
/* eslint-disable react/jsx-props-no-spreading */
|
|
197
|
-
var propTypes$1 = {};
|
|
198
|
-
var defaultProps$1 = {};
|
|
199
|
-
var TextareaField = function TextareaField(props) {
|
|
200
|
-
return /*#__PURE__*/React.createElement(InputField$1, Object.assign({}, props, {
|
|
201
|
-
type: "textarea"
|
|
202
|
-
}));
|
|
203
|
-
};
|
|
204
|
-
TextareaField.propTypes = propTypes$1;
|
|
205
|
-
TextareaField.defaultProps = defaultProps$1;
|
|
206
|
-
var TextareaField$1 = TextareaField;
|
|
207
|
-
|
|
208
|
-
/* eslint-disable react/jsx-props-no-spreading */
|
|
209
|
-
var propTypes = {};
|
|
210
|
-
var defaultProps = {};
|
|
211
|
-
var TextField = function TextField(props) {
|
|
212
|
-
return /*#__PURE__*/React.createElement(InputField$1, Object.assign({}, props, {
|
|
213
|
-
type: "text"
|
|
214
|
-
}));
|
|
215
|
-
};
|
|
216
|
-
TextField.propTypes = propTypes;
|
|
217
|
-
TextField.defaultProps = defaultProps;
|
|
218
|
-
var TextField$1 = TextField;
|
|
219
|
-
|
|
220
|
-
exports.Email = EmailField$1;
|
|
221
|
-
exports.Password = PasswordField$1;
|
|
222
|
-
exports.Telephone = TelephoneField$1;
|
|
223
|
-
exports.Textarea = TextareaField$1;
|
|
224
|
-
exports.default = TextField$1;
|
|
225
|
-
exports.definition = definition;
|