@panneau/field-text 4.0.37 → 4.0.40-alpha.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/dist/index.js +125 -98
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
|
-
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
1
|
+
import { c } from 'react/compiler-runtime';
|
|
4
2
|
import classNames from 'classnames';
|
|
5
3
|
import isEmpty from 'lodash/isEmpty';
|
|
6
4
|
import { useMemo } from 'react';
|
|
@@ -27,66 +25,44 @@ var definition = [{
|
|
|
27
25
|
|
|
28
26
|
var styles = {"inputElement":"panneau-field-text-inputElement"};
|
|
29
27
|
|
|
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
|
-
onBlur = _ref$onBlur === void 0 ? null : _ref$onBlur,
|
|
60
|
-
_ref$align = _ref.align,
|
|
61
|
-
align = _ref$align === void 0 ? null : _ref$align,
|
|
62
|
-
_ref$size = _ref.size,
|
|
63
|
-
size = _ref$size === void 0 ? null : _ref$size,
|
|
64
|
-
_ref$maxLength = _ref.maxLength,
|
|
65
|
-
maxLength = _ref$maxLength === void 0 ? null : _ref$maxLength,
|
|
66
|
-
_ref$prepend = _ref.prepend,
|
|
67
|
-
prepend = _ref$prepend === void 0 ? null : _ref$prepend,
|
|
68
|
-
_ref$append = _ref.append,
|
|
69
|
-
append = _ref$append === void 0 ? null : _ref$append,
|
|
70
|
-
_ref$min = _ref.min,
|
|
71
|
-
min = _ref$min === void 0 ? null : _ref$min,
|
|
72
|
-
_ref$max = _ref.max,
|
|
73
|
-
max = _ref$max === void 0 ? null : _ref$max,
|
|
74
|
-
_ref$dataList = _ref.dataList,
|
|
75
|
-
dataList = _ref$dataList === void 0 ? null : _ref$dataList,
|
|
76
|
-
_ref$inputRef = _ref.inputRef,
|
|
77
|
-
inputRef = _ref$inputRef === void 0 ? null : _ref$inputRef,
|
|
78
|
-
_ref$style = _ref.style,
|
|
79
|
-
style = _ref$style === void 0 ? null : _ref$style,
|
|
80
|
-
_ref$className = _ref.className,
|
|
81
|
-
className = _ref$className === void 0 ? null : _ref$className;
|
|
82
|
-
var dataListId = useMemo(function () {
|
|
83
|
-
return dataList !== null ? v1() : null;
|
|
84
|
-
}, [dataList]);
|
|
85
|
-
var elProps = {
|
|
28
|
+
function InputField({
|
|
29
|
+
feedback = null,
|
|
30
|
+
value = null,
|
|
31
|
+
errors = null,
|
|
32
|
+
required = false,
|
|
33
|
+
disabled = false,
|
|
34
|
+
readOnly = false,
|
|
35
|
+
nativeOnChange = false,
|
|
36
|
+
pattern = null,
|
|
37
|
+
title = null,
|
|
38
|
+
type = null,
|
|
39
|
+
placeholder = null,
|
|
40
|
+
onChange = null,
|
|
41
|
+
onFocus = null,
|
|
42
|
+
onBlur = null,
|
|
43
|
+
align = null,
|
|
44
|
+
size = null,
|
|
45
|
+
maxLength = null,
|
|
46
|
+
prepend = null,
|
|
47
|
+
append = null,
|
|
48
|
+
min = null,
|
|
49
|
+
max = null,
|
|
50
|
+
dataList = null,
|
|
51
|
+
inputRef = null,
|
|
52
|
+
style = null,
|
|
53
|
+
className = null
|
|
54
|
+
}) {
|
|
55
|
+
const dataListId = useMemo(() => dataList !== null ? v1() : null, [dataList]);
|
|
56
|
+
const elProps = {
|
|
86
57
|
ref: inputRef,
|
|
87
|
-
className: classNames([styles.inputElement, 'form-control',
|
|
88
|
-
|
|
89
|
-
|
|
58
|
+
className: classNames([styles.inputElement, 'form-control', {
|
|
59
|
+
[`form-control-${size}`]: size !== null,
|
|
60
|
+
'is-valid': feedback === 'valid',
|
|
61
|
+
'is-invalid': feedback === 'invalid' || errors !== null,
|
|
62
|
+
[className]: className !== null
|
|
63
|
+
}]),
|
|
64
|
+
onFocus,
|
|
65
|
+
onBlur,
|
|
90
66
|
value: value !== null ? value : '',
|
|
91
67
|
style: {
|
|
92
68
|
textAlign: align || undefined
|
|
@@ -96,27 +72,30 @@ function InputField(_ref) {
|
|
|
96
72
|
maxLength: maxLength || undefined,
|
|
97
73
|
min: min || undefined,
|
|
98
74
|
max: max || undefined,
|
|
99
|
-
required
|
|
100
|
-
disabled
|
|
101
|
-
readOnly
|
|
75
|
+
required,
|
|
76
|
+
disabled,
|
|
77
|
+
readOnly,
|
|
102
78
|
list: dataListId || undefined,
|
|
103
79
|
pattern: pattern || undefined,
|
|
104
80
|
title: title || undefined,
|
|
105
|
-
onChange: nativeOnChange ? onChange :
|
|
106
|
-
|
|
107
|
-
newValue =
|
|
108
|
-
|
|
109
|
-
}
|
|
81
|
+
onChange: nativeOnChange ? onChange : ({
|
|
82
|
+
target: {
|
|
83
|
+
value: newValue = ''
|
|
84
|
+
}
|
|
85
|
+
}) => onChange !== null ? onChange(!isEmpty(newValue) ? newValue : null) : null
|
|
110
86
|
};
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
87
|
+
const {
|
|
88
|
+
horizontal,
|
|
89
|
+
...cleanProps
|
|
90
|
+
} = elProps;
|
|
91
|
+
const inputElement = type !== 'textarea' ? /*#__PURE__*/jsx("input", {
|
|
92
|
+
...cleanProps,
|
|
115
93
|
style: style || undefined
|
|
116
|
-
})
|
|
117
|
-
style: style || undefined
|
|
118
|
-
|
|
119
|
-
|
|
94
|
+
}) : /*#__PURE__*/jsx("textarea", {
|
|
95
|
+
style: style || undefined,
|
|
96
|
+
...cleanProps
|
|
97
|
+
});
|
|
98
|
+
const withInputGroup = prepend !== null || append !== null;
|
|
120
99
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
121
100
|
children: [withInputGroup ? /*#__PURE__*/jsx(InputGroup, {
|
|
122
101
|
prepend: prepend,
|
|
@@ -124,43 +103,91 @@ function InputField(_ref) {
|
|
|
124
103
|
children: inputElement
|
|
125
104
|
}) : inputElement, dataListId !== null ? /*#__PURE__*/jsx("datalist", {
|
|
126
105
|
id: dataListId,
|
|
127
|
-
children: dataList.map(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}, "option-".concat(dataIndex));
|
|
131
|
-
})
|
|
106
|
+
children: dataList.map((data, dataIndex) => /*#__PURE__*/jsx("option", {
|
|
107
|
+
children: data
|
|
108
|
+
}, `option-${dataIndex}`))
|
|
132
109
|
}) : null]
|
|
133
110
|
});
|
|
134
111
|
}
|
|
135
112
|
|
|
136
113
|
function EmailField(props) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
114
|
+
const $ = c(2);
|
|
115
|
+
let t0;
|
|
116
|
+
if ($[0] !== props) {
|
|
117
|
+
t0 = /*#__PURE__*/jsx(InputField, {
|
|
118
|
+
...props,
|
|
119
|
+
type: "email"
|
|
120
|
+
});
|
|
121
|
+
$[0] = props;
|
|
122
|
+
$[1] = t0;
|
|
123
|
+
} else {
|
|
124
|
+
t0 = $[1];
|
|
125
|
+
}
|
|
126
|
+
return t0;
|
|
140
127
|
}
|
|
141
128
|
|
|
142
129
|
function PasswordField(props) {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
130
|
+
const $ = c(2);
|
|
131
|
+
let t0;
|
|
132
|
+
if ($[0] !== props) {
|
|
133
|
+
t0 = /*#__PURE__*/jsx(InputField, {
|
|
134
|
+
...props,
|
|
135
|
+
type: "password"
|
|
136
|
+
});
|
|
137
|
+
$[0] = props;
|
|
138
|
+
$[1] = t0;
|
|
139
|
+
} else {
|
|
140
|
+
t0 = $[1];
|
|
141
|
+
}
|
|
142
|
+
return t0;
|
|
146
143
|
}
|
|
147
144
|
|
|
148
145
|
function TelephoneField(props) {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
146
|
+
const $ = c(2);
|
|
147
|
+
let t0;
|
|
148
|
+
if ($[0] !== props) {
|
|
149
|
+
t0 = /*#__PURE__*/jsx(InputField, {
|
|
150
|
+
...props,
|
|
151
|
+
type: "tel"
|
|
152
|
+
});
|
|
153
|
+
$[0] = props;
|
|
154
|
+
$[1] = t0;
|
|
155
|
+
} else {
|
|
156
|
+
t0 = $[1];
|
|
157
|
+
}
|
|
158
|
+
return t0;
|
|
152
159
|
}
|
|
153
160
|
|
|
154
161
|
function TextareaField(props) {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
162
|
+
const $ = c(2);
|
|
163
|
+
let t0;
|
|
164
|
+
if ($[0] !== props) {
|
|
165
|
+
t0 = /*#__PURE__*/jsx(InputField, {
|
|
166
|
+
...props,
|
|
167
|
+
type: "textarea"
|
|
168
|
+
});
|
|
169
|
+
$[0] = props;
|
|
170
|
+
$[1] = t0;
|
|
171
|
+
} else {
|
|
172
|
+
t0 = $[1];
|
|
173
|
+
}
|
|
174
|
+
return t0;
|
|
158
175
|
}
|
|
159
176
|
|
|
160
177
|
function TextField(props) {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
178
|
+
const $ = c(2);
|
|
179
|
+
let t0;
|
|
180
|
+
if ($[0] !== props) {
|
|
181
|
+
t0 = /*#__PURE__*/jsx(InputField, {
|
|
182
|
+
...props,
|
|
183
|
+
type: "text"
|
|
184
|
+
});
|
|
185
|
+
$[0] = props;
|
|
186
|
+
$[1] = t0;
|
|
187
|
+
} else {
|
|
188
|
+
t0 = $[1];
|
|
189
|
+
}
|
|
190
|
+
return t0;
|
|
164
191
|
}
|
|
165
192
|
|
|
166
193
|
export { EmailField as Email, PasswordField as Password, TelephoneField as Telephone, TextareaField as Textarea, TextField as default, definition };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/field-text",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.40-alpha.1",
|
|
4
4
|
"description": "A text field",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -64,9 +64,9 @@
|
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"@babel/runtime": "^7.28.6",
|
|
67
|
-
"@panneau/core": "^4.0.
|
|
68
|
-
"@panneau/field-input-group": "^4.0.
|
|
69
|
-
"@panneau/themes": "^4.0.
|
|
67
|
+
"@panneau/core": "^4.0.40-alpha.1",
|
|
68
|
+
"@panneau/field-input-group": "^4.0.40-alpha.1",
|
|
69
|
+
"@panneau/themes": "^4.0.40-alpha.1",
|
|
70
70
|
"classnames": "^2.5.1",
|
|
71
71
|
"lodash": "^4.17.21",
|
|
72
72
|
"uuid": "^9.0.1"
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"publishConfig": {
|
|
75
75
|
"access": "public"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "66520f92373b3aa371222b354d60ed3cf3d20c96"
|
|
78
78
|
}
|