@prom-ui/core 0.0.121 → 0.0.130
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/Avatar/cjs/index.development.js +9 -19
- package/Avatar/cjs/index.development.v2.js +9 -19
- package/Avatar/package.json +1 -1
- package/Body/package.json +1 -1
- package/BodyProvider/BodyContext.d.ts +5 -0
- package/BodyProvider/cjs/index.development.js +264 -0
- package/BodyProvider/cjs/index.development.v2.js +264 -0
- package/BodyProvider/cjs/index.production.js +1 -0
- package/BodyProvider/cjs/index.production.v2.js +1 -0
- package/BodyProvider/index.d.ts +9 -0
- package/BodyProvider/index.js +7 -0
- package/BodyProvider/index.v2.js +7 -0
- package/BodyProvider/package.json +12 -0
- package/BodyProvider/useBodyLocale.d.ts +2 -0
- package/Box/package.json +1 -1
- package/Button/cjs/index.development.js +3 -4
- package/Button/cjs/index.development.v2.js +3 -4
- package/Button/package.json +1 -1
- package/ButtonPageUp/cjs/index.development.js +16 -20
- package/ButtonPageUp/cjs/index.development.v2.js +16 -20
- package/ButtonPageUp/cjs/index.production.js +1 -1
- package/ButtonPageUp/cjs/index.production.v2.js +1 -1
- package/ButtonPageUp/package.json +2 -3
- package/Checkbox/cjs/index.development.js +5 -7
- package/Checkbox/cjs/index.development.v2.js +5 -7
- package/Checkbox/package.json +1 -1
- package/Flex/package.json +1 -1
- package/Grid/package.json +1 -1
- package/Icon/package.json +1 -1
- package/Image/package.json +1 -1
- package/ImageEmoji/cjs/index.development.js +7 -8
- package/ImageEmoji/cjs/index.development.v2.js +7 -8
- package/ImageEmoji/package.json +1 -1
- package/Input/package.json +1 -1
- package/InputField/cjs/index.development.js +33 -44
- package/InputField/cjs/index.development.v2.js +33 -44
- package/InputField/cjs/index.production.js +1 -1
- package/InputField/cjs/index.production.v2.js +1 -1
- package/InputField/package.json +1 -1
- package/KeyPress/cjs/index.development.js +8 -11
- package/KeyPress/cjs/index.development.v2.js +8 -11
- package/KeyPress/package.json +1 -1
- package/Line/package.json +1 -1
- package/Link/cjs/index.development.js +0 -1
- package/Link/cjs/index.development.v2.js +0 -1
- package/Link/package.json +1 -1
- package/List/package.json +1 -1
- package/Media/cjs/index.development.js +12 -18
- package/Media/cjs/index.development.v2.js +12 -18
- package/Media/package.json +1 -1
- package/OutsideClick/cjs/index.development.js +4 -7
- package/OutsideClick/cjs/index.development.v2.js +4 -7
- package/OutsideClick/package.json +1 -1
- package/Overlay/cjs/index.development.js +67 -90
- package/Overlay/cjs/index.development.v2.js +67 -90
- package/Overlay/cjs/index.production.js +1 -1
- package/Overlay/cjs/index.production.v2.js +1 -1
- package/Overlay/package.json +2 -3
- package/Picture/package.json +1 -1
- package/PortableOverlay/cjs/index.development.js +19 -20
- package/PortableOverlay/cjs/index.development.v2.js +19 -20
- package/PortableOverlay/package.json +1 -1
- package/Portal/cjs/index.development.js +5 -10
- package/Portal/cjs/index.development.v2.js +5 -10
- package/Portal/package.json +1 -1
- package/QRCode/cjs/index.development.js +8 -8
- package/QRCode/cjs/index.development.v2.js +8 -8
- package/QRCode/package.json +1 -1
- package/Rating/cjs/index.development.js +8 -9
- package/Rating/cjs/index.development.v2.js +8 -9
- package/Rating/package.json +1 -1
- package/SafeQuery/cjs/index.development.js +19 -19
- package/SafeQuery/cjs/index.development.v2.js +19 -19
- package/SafeQuery/cjs/index.production.js +1 -1
- package/SafeQuery/cjs/index.production.v2.js +1 -1
- package/SafeQuery/package.json +1 -1
- package/Scroll/package.json +1 -1
- package/ScrollControls/cjs/index.development.js +37 -51
- package/ScrollControls/cjs/index.development.v2.js +37 -51
- package/ScrollControls/cjs/index.production.js +1 -1
- package/ScrollControls/cjs/index.production.v2.js +1 -1
- package/ScrollControls/package.json +2 -3
- package/SideOverlay/cjs/index.development.js +40 -41
- package/SideOverlay/cjs/index.development.v2.js +40 -41
- package/SideOverlay/cjs/index.production.js +1 -1
- package/SideOverlay/cjs/index.production.v2.js +1 -1
- package/SideOverlay/package.json +2 -3
- package/SimpleSlider/cjs/index.development.js +53 -89
- package/SimpleSlider/cjs/index.development.v2.js +53 -89
- package/SimpleSlider/cjs/index.production.js +1 -1
- package/SimpleSlider/cjs/index.production.v2.js +1 -1
- package/SimpleSlider/package.json +2 -3
- package/Skeleton/cjs/index.development.js +10 -11
- package/Skeleton/cjs/index.development.v2.js +10 -11
- package/Skeleton/package.json +1 -1
- package/Spinner/package.json +1 -1
- package/Text/package.json +1 -1
- package/TextEmoji/cjs/index.development.js +5 -6
- package/TextEmoji/cjs/index.development.v2.js +5 -6
- package/TextEmoji/package.json +1 -1
- package/Tooltip/cjs/index.development.js +53 -55
- package/Tooltip/cjs/index.development.v2.js +53 -55
- package/Tooltip/package.json +1 -1
- package/Tumbler/cjs/index.development.js +5 -7
- package/Tumbler/cjs/index.development.v2.js +5 -7
- package/Tumbler/package.json +1 -1
- package/package.json +6 -3
|
@@ -6,6 +6,7 @@ var React = require('react');
|
|
|
6
6
|
var Input = require('@prom-ui/core/Input');
|
|
7
7
|
var Button = require('@prom-ui/core/Button');
|
|
8
8
|
var Icon = require('@prom-ui/core/Icon');
|
|
9
|
+
var BodyProvider = require('@prom-ui/core/BodyProvider');
|
|
9
10
|
var EyeOpen = require('@prom-ui/icons/EyeOpen');
|
|
10
11
|
var EyeClose = require('@prom-ui/icons/EyeClose');
|
|
11
12
|
var Spinner = require('@prom-ui/core/Spinner');
|
|
@@ -68,12 +69,17 @@ function __rest(s, e) {
|
|
|
68
69
|
t[p[i]] = s[p[i]];
|
|
69
70
|
}
|
|
70
71
|
return t;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function __makeTemplateObject(cooked, raw) {
|
|
75
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
76
|
+
return cooked;
|
|
71
77
|
}
|
|
72
78
|
|
|
73
79
|
var AfterTogglePassword = function (_a) {
|
|
74
80
|
var inputType = _a.inputType,
|
|
75
|
-
|
|
76
|
-
|
|
81
|
+
onChange = _a.onChange;
|
|
82
|
+
var t = BodyProvider.useBodyLocale().t;
|
|
77
83
|
if (inputType === 'text') {
|
|
78
84
|
return React__namespace.createElement(Button.Button, {
|
|
79
85
|
type: 'button',
|
|
@@ -83,7 +89,7 @@ var AfterTogglePassword = function (_a) {
|
|
|
83
89
|
onClick: function () {
|
|
84
90
|
return onChange('password');
|
|
85
91
|
},
|
|
86
|
-
title:
|
|
92
|
+
title: t(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\u0421\u043A\u0440\u044B\u0442\u044C \u043F\u0430\u0440\u043E\u043B\u044C"], ["\u0421\u043A\u0440\u044B\u0442\u044C \u043F\u0430\u0440\u043E\u043B\u044C"]))),
|
|
87
93
|
tabIndex: -1,
|
|
88
94
|
"data-qaid": 'input_field_hide_password',
|
|
89
95
|
"data-testid": 'input_field_hide_password'
|
|
@@ -97,7 +103,6 @@ var AfterTogglePassword = function (_a) {
|
|
|
97
103
|
}
|
|
98
104
|
}));
|
|
99
105
|
}
|
|
100
|
-
|
|
101
106
|
return React__namespace.createElement(Button.Button, {
|
|
102
107
|
type: 'button',
|
|
103
108
|
"button-height": '1-1',
|
|
@@ -106,7 +111,7 @@ var AfterTogglePassword = function (_a) {
|
|
|
106
111
|
onClick: function () {
|
|
107
112
|
return onChange('text');
|
|
108
113
|
},
|
|
109
|
-
title:
|
|
114
|
+
title: t(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u043F\u0430\u0440\u043E\u043B\u044C"], ["\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u043F\u0430\u0440\u043E\u043B\u044C"]))),
|
|
110
115
|
tabIndex: -1,
|
|
111
116
|
"data-qaid": 'input_field_show_password',
|
|
112
117
|
"data-testid": 'input_field_show_password'
|
|
@@ -120,6 +125,7 @@ var AfterTogglePassword = function (_a) {
|
|
|
120
125
|
}
|
|
121
126
|
}));
|
|
122
127
|
};
|
|
128
|
+
var templateObject_1$1, templateObject_2;
|
|
123
129
|
|
|
124
130
|
var AfterLoading = function () {
|
|
125
131
|
return React__namespace.createElement(Spinner.Spinner, {
|
|
@@ -146,12 +152,13 @@ var AfterCorrectValue = function () {
|
|
|
146
152
|
};
|
|
147
153
|
|
|
148
154
|
var AfterClearValue = function (props) {
|
|
155
|
+
var t = BodyProvider.useBodyLocale().t;
|
|
149
156
|
return React__namespace.createElement(Button.Button, __assign({
|
|
150
157
|
type: 'button',
|
|
151
158
|
"button-height": '1-1',
|
|
152
159
|
"button-width": '1-1',
|
|
153
160
|
"button-padding": 'none',
|
|
154
|
-
title:
|
|
161
|
+
title: t(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C"], ["\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C"]))),
|
|
155
162
|
tabIndex: -1,
|
|
156
163
|
"data-qaid": 'input_field_clear_value',
|
|
157
164
|
"data-testid": 'input_field_clear_value'
|
|
@@ -165,6 +172,7 @@ var AfterClearValue = function (props) {
|
|
|
165
172
|
}
|
|
166
173
|
}));
|
|
167
174
|
};
|
|
175
|
+
var templateObject_1;
|
|
168
176
|
|
|
169
177
|
var css = {"root":"InputField__root___UnXum","input":"InputField__input___1Wl0O","beforeAndAfter":"InputField__beforeAndAfter___cUXq3","before":"InputField__before___-TbcG InputField__beforeAndAfter___cUXq3","after":"InputField__after___QmiGS InputField__beforeAndAfter___cUXq3","error":"InputField__error___7Fcq2","label":"InputField__label___uV711","labelRequired":"InputField__labelRequired___cxqrg"};
|
|
170
178
|
|
|
@@ -177,13 +185,12 @@ var ErrorText = function (_a) {
|
|
|
177
185
|
}, children);
|
|
178
186
|
};
|
|
179
187
|
|
|
188
|
+
// https://github.com/ant-design/ant-design/blob/master/components/input/Input.tsx:36
|
|
180
189
|
function resolveOnChange(target, e, onChange, targetValue) {
|
|
181
190
|
if (!onChange) {
|
|
182
191
|
return;
|
|
183
192
|
}
|
|
184
|
-
|
|
185
193
|
var event = e;
|
|
186
|
-
|
|
187
194
|
if (e.type === 'click') {
|
|
188
195
|
// Clone a new target for event.
|
|
189
196
|
// Avoid the following usage, the setQuery method gets the original value.
|
|
@@ -195,8 +202,8 @@ function resolveOnChange(target, e, onChange, targetValue) {
|
|
|
195
202
|
// setQuery((prevStatus) => e.target.value);
|
|
196
203
|
// }}
|
|
197
204
|
// />
|
|
198
|
-
var currentTarget = target.cloneNode(true);
|
|
199
|
-
|
|
205
|
+
var currentTarget = target.cloneNode(true);
|
|
206
|
+
// Click clear button
|
|
200
207
|
event = Object.create(e, {
|
|
201
208
|
target: {
|
|
202
209
|
value: currentTarget
|
|
@@ -208,9 +215,8 @@ function resolveOnChange(target, e, onChange, targetValue) {
|
|
|
208
215
|
currentTarget.value = '';
|
|
209
216
|
onChange(event);
|
|
210
217
|
return;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
|
|
218
|
+
}
|
|
219
|
+
// Trigger by composition event, this means we need force change the input value
|
|
214
220
|
if (targetValue !== undefined) {
|
|
215
221
|
event = Object.create(e, {
|
|
216
222
|
target: {
|
|
@@ -224,18 +230,15 @@ function resolveOnChange(target, e, onChange, targetValue) {
|
|
|
224
230
|
onChange(event);
|
|
225
231
|
return;
|
|
226
232
|
}
|
|
227
|
-
|
|
228
233
|
onChange(event);
|
|
229
234
|
}
|
|
230
235
|
function valueToString(value) {
|
|
231
236
|
if (Number.isInteger(value)) {
|
|
232
237
|
return "".concat(value);
|
|
233
238
|
}
|
|
234
|
-
|
|
235
239
|
if (!value) {
|
|
236
240
|
return '';
|
|
237
241
|
}
|
|
238
|
-
|
|
239
242
|
return "".concat(value);
|
|
240
243
|
}
|
|
241
244
|
function isNotEmptyArray(arr) {
|
|
@@ -248,11 +251,9 @@ var useForwardRef = function (ref, initialValue) {
|
|
|
248
251
|
if (initialValue === void 0) {
|
|
249
252
|
initialValue = null;
|
|
250
253
|
}
|
|
251
|
-
|
|
252
254
|
var targetRef = React__namespace.useRef(initialValue);
|
|
253
255
|
React__namespace.useEffect(function () {
|
|
254
256
|
if (!ref) return;
|
|
255
|
-
|
|
256
257
|
if (typeof ref === 'function') {
|
|
257
258
|
ref(targetRef.current);
|
|
258
259
|
} else {
|
|
@@ -264,34 +265,29 @@ var useForwardRef = function (ref, initialValue) {
|
|
|
264
265
|
|
|
265
266
|
var InputField = React__namespace.forwardRef(function (_a, ref) {
|
|
266
267
|
var addonBefore = _a.addonBefore,
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
268
|
+
addonAfter = _a.addonAfter,
|
|
269
|
+
_b = _a.addonBeforeWidth,
|
|
270
|
+
addonBeforeWidth = _b === void 0 ? 40 : _b,
|
|
271
|
+
_c = _a.addonAfterWidth,
|
|
272
|
+
addonAfterWidth = _c === void 0 ? 40 : _c,
|
|
273
|
+
_d = _a.error,
|
|
274
|
+
error = _d === void 0 ? false : _d,
|
|
275
|
+
label = _a.label,
|
|
276
|
+
isLabelRequired = _a.isLabelRequired,
|
|
277
|
+
props = __rest(_a, ["addonBefore", "addonAfter", "addonBeforeWidth", "addonAfterWidth", "error", "label", "isLabelRequired"]);
|
|
278
278
|
var isMounted = React__namespace.useRef(false);
|
|
279
279
|
var isSkipOnFocus = React__namespace.useRef(false);
|
|
280
280
|
var isSkipOnBlur = React__namespace.useRef(false);
|
|
281
281
|
var inputRef = useForwardRef(ref, null);
|
|
282
|
-
|
|
283
282
|
var _e = React__namespace.useState(props.type),
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
283
|
+
localType = _e[0],
|
|
284
|
+
setLocalType = _e[1];
|
|
287
285
|
var _f = React__namespace.useState(getIsValueEmpty(props.value || props.defaultValue)),
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
286
|
+
isValueEmpty = _f[0],
|
|
287
|
+
setIsValueEmpty = _f[1];
|
|
291
288
|
React__namespace.useEffect(function () {
|
|
292
289
|
if (isMounted.current) {
|
|
293
290
|
var nextIsValueEmpty = getIsValueEmpty(props.value);
|
|
294
|
-
|
|
295
291
|
if (nextIsValueEmpty !== isValueEmpty) {
|
|
296
292
|
setIsValueEmpty(nextIsValueEmpty);
|
|
297
293
|
}
|
|
@@ -300,7 +296,6 @@ var InputField = React__namespace.forwardRef(function (_a, ref) {
|
|
|
300
296
|
}
|
|
301
297
|
}, [props.value]);
|
|
302
298
|
var currentAddonAfter = null;
|
|
303
|
-
|
|
304
299
|
if (props.type === 'password' && addonAfter === 'togglePassword') {
|
|
305
300
|
currentAddonAfter = React__namespace.createElement(AfterTogglePassword, {
|
|
306
301
|
inputType: localType,
|
|
@@ -312,17 +307,14 @@ var InputField = React__namespace.forwardRef(function (_a, ref) {
|
|
|
312
307
|
currentAddonAfter = isValueEmpty ? null : React__namespace.createElement(AfterClearValue, {
|
|
313
308
|
onClick: function (e) {
|
|
314
309
|
var _a;
|
|
315
|
-
|
|
316
310
|
if (!getIsValueEmpty(props.value) && !props.onChange) {
|
|
317
311
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
318
312
|
return;
|
|
319
313
|
}
|
|
320
|
-
|
|
321
314
|
if (inputRef.current) {
|
|
322
315
|
setIsValueEmpty(true);
|
|
323
316
|
inputRef.current.focus();
|
|
324
317
|
resolveOnChange(inputRef.current, e, props.onChange);
|
|
325
|
-
|
|
326
318
|
if (getIsValueEmpty(props.value)) {
|
|
327
319
|
inputRef.current.value = '';
|
|
328
320
|
}
|
|
@@ -352,7 +344,6 @@ var InputField = React__namespace.forwardRef(function (_a, ref) {
|
|
|
352
344
|
} else {
|
|
353
345
|
currentAddonAfter = addonAfter;
|
|
354
346
|
}
|
|
355
|
-
|
|
356
347
|
var isLabel = !!label;
|
|
357
348
|
var isBefore = !!addonBefore;
|
|
358
349
|
var isAfter = !!currentAddonAfter;
|
|
@@ -390,14 +381,12 @@ var InputField = React__namespace.forwardRef(function (_a, ref) {
|
|
|
390
381
|
if (!isSkipOnFocus.current && props.onFocus) {
|
|
391
382
|
props.onFocus(e);
|
|
392
383
|
}
|
|
393
|
-
|
|
394
384
|
isSkipOnFocus.current = false;
|
|
395
385
|
},
|
|
396
386
|
onBlur: function (e) {
|
|
397
387
|
if (!isSkipOnBlur.current && props.onBlur) {
|
|
398
388
|
props.onBlur(e);
|
|
399
389
|
}
|
|
400
|
-
|
|
401
390
|
isSkipOnBlur.current = false;
|
|
402
391
|
},
|
|
403
392
|
onChange: function (e) {
|
|
@@ -6,6 +6,7 @@ var React = require('react');
|
|
|
6
6
|
var Input = require('@prom-ui/core/Input');
|
|
7
7
|
var Button = require('@prom-ui/core/Button');
|
|
8
8
|
var Icon = require('@prom-ui/core/Icon');
|
|
9
|
+
var BodyProvider = require('@prom-ui/core/BodyProvider');
|
|
9
10
|
var EyeOpen = require('@prom-ui/icons/EyeOpen');
|
|
10
11
|
var EyeClose = require('@prom-ui/icons/EyeClose');
|
|
11
12
|
var Spinner = require('@prom-ui/core/Spinner');
|
|
@@ -68,12 +69,17 @@ function __rest(s, e) {
|
|
|
68
69
|
t[p[i]] = s[p[i]];
|
|
69
70
|
}
|
|
70
71
|
return t;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function __makeTemplateObject(cooked, raw) {
|
|
75
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
76
|
+
return cooked;
|
|
71
77
|
}
|
|
72
78
|
|
|
73
79
|
var AfterTogglePassword = function (_a) {
|
|
74
80
|
var inputType = _a.inputType,
|
|
75
|
-
|
|
76
|
-
|
|
81
|
+
onChange = _a.onChange;
|
|
82
|
+
var t = BodyProvider.useBodyLocale().t;
|
|
77
83
|
if (inputType === 'text') {
|
|
78
84
|
return React__namespace.createElement(Button.Button, {
|
|
79
85
|
type: 'button',
|
|
@@ -83,7 +89,7 @@ var AfterTogglePassword = function (_a) {
|
|
|
83
89
|
onClick: function () {
|
|
84
90
|
return onChange('password');
|
|
85
91
|
},
|
|
86
|
-
title:
|
|
92
|
+
title: t(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\u0421\u043A\u0440\u044B\u0442\u044C \u043F\u0430\u0440\u043E\u043B\u044C"], ["\u0421\u043A\u0440\u044B\u0442\u044C \u043F\u0430\u0440\u043E\u043B\u044C"]))),
|
|
87
93
|
tabIndex: -1,
|
|
88
94
|
"data-qaid": 'input_field_hide_password',
|
|
89
95
|
"data-testid": 'input_field_hide_password'
|
|
@@ -97,7 +103,6 @@ var AfterTogglePassword = function (_a) {
|
|
|
97
103
|
}
|
|
98
104
|
}));
|
|
99
105
|
}
|
|
100
|
-
|
|
101
106
|
return React__namespace.createElement(Button.Button, {
|
|
102
107
|
type: 'button',
|
|
103
108
|
"button-height": '1-1',
|
|
@@ -106,7 +111,7 @@ var AfterTogglePassword = function (_a) {
|
|
|
106
111
|
onClick: function () {
|
|
107
112
|
return onChange('text');
|
|
108
113
|
},
|
|
109
|
-
title:
|
|
114
|
+
title: t(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u043F\u0430\u0440\u043E\u043B\u044C"], ["\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u043F\u0430\u0440\u043E\u043B\u044C"]))),
|
|
110
115
|
tabIndex: -1,
|
|
111
116
|
"data-qaid": 'input_field_show_password',
|
|
112
117
|
"data-testid": 'input_field_show_password'
|
|
@@ -120,6 +125,7 @@ var AfterTogglePassword = function (_a) {
|
|
|
120
125
|
}
|
|
121
126
|
}));
|
|
122
127
|
};
|
|
128
|
+
var templateObject_1$1, templateObject_2;
|
|
123
129
|
|
|
124
130
|
var AfterLoading = function () {
|
|
125
131
|
return React__namespace.createElement(Spinner.Spinner, {
|
|
@@ -146,12 +152,13 @@ var AfterCorrectValue = function () {
|
|
|
146
152
|
};
|
|
147
153
|
|
|
148
154
|
var AfterClearValue = function (props) {
|
|
155
|
+
var t = BodyProvider.useBodyLocale().t;
|
|
149
156
|
return React__namespace.createElement(Button.Button, __assign({
|
|
150
157
|
type: 'button',
|
|
151
158
|
"button-height": '1-1',
|
|
152
159
|
"button-width": '1-1',
|
|
153
160
|
"button-padding": 'none',
|
|
154
|
-
title:
|
|
161
|
+
title: t(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C"], ["\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C"]))),
|
|
155
162
|
tabIndex: -1,
|
|
156
163
|
"data-qaid": 'input_field_clear_value',
|
|
157
164
|
"data-testid": 'input_field_clear_value'
|
|
@@ -165,6 +172,7 @@ var AfterClearValue = function (props) {
|
|
|
165
172
|
}
|
|
166
173
|
}));
|
|
167
174
|
};
|
|
175
|
+
var templateObject_1;
|
|
168
176
|
|
|
169
177
|
var css = {"root":"InputField__root___EVTeN","input":"InputField__input___rfpBC","beforeAndAfter":"InputField__beforeAndAfter___oqO-V","before":"InputField__before___GeS6- InputField__beforeAndAfter___oqO-V","after":"InputField__after___Cl38- InputField__beforeAndAfter___oqO-V","error":"InputField__error___hSs8w","label":"InputField__label___bwxYk","labelRequired":"InputField__labelRequired___bTTTw"};
|
|
170
178
|
|
|
@@ -177,13 +185,12 @@ var ErrorText = function (_a) {
|
|
|
177
185
|
}, children);
|
|
178
186
|
};
|
|
179
187
|
|
|
188
|
+
// https://github.com/ant-design/ant-design/blob/master/components/input/Input.tsx:36
|
|
180
189
|
function resolveOnChange(target, e, onChange, targetValue) {
|
|
181
190
|
if (!onChange) {
|
|
182
191
|
return;
|
|
183
192
|
}
|
|
184
|
-
|
|
185
193
|
var event = e;
|
|
186
|
-
|
|
187
194
|
if (e.type === 'click') {
|
|
188
195
|
// Clone a new target for event.
|
|
189
196
|
// Avoid the following usage, the setQuery method gets the original value.
|
|
@@ -195,8 +202,8 @@ function resolveOnChange(target, e, onChange, targetValue) {
|
|
|
195
202
|
// setQuery((prevStatus) => e.target.value);
|
|
196
203
|
// }}
|
|
197
204
|
// />
|
|
198
|
-
var currentTarget = target.cloneNode(true);
|
|
199
|
-
|
|
205
|
+
var currentTarget = target.cloneNode(true);
|
|
206
|
+
// Click clear button
|
|
200
207
|
event = Object.create(e, {
|
|
201
208
|
target: {
|
|
202
209
|
value: currentTarget
|
|
@@ -208,9 +215,8 @@ function resolveOnChange(target, e, onChange, targetValue) {
|
|
|
208
215
|
currentTarget.value = '';
|
|
209
216
|
onChange(event);
|
|
210
217
|
return;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
|
|
218
|
+
}
|
|
219
|
+
// Trigger by composition event, this means we need force change the input value
|
|
214
220
|
if (targetValue !== undefined) {
|
|
215
221
|
event = Object.create(e, {
|
|
216
222
|
target: {
|
|
@@ -224,18 +230,15 @@ function resolveOnChange(target, e, onChange, targetValue) {
|
|
|
224
230
|
onChange(event);
|
|
225
231
|
return;
|
|
226
232
|
}
|
|
227
|
-
|
|
228
233
|
onChange(event);
|
|
229
234
|
}
|
|
230
235
|
function valueToString(value) {
|
|
231
236
|
if (Number.isInteger(value)) {
|
|
232
237
|
return "".concat(value);
|
|
233
238
|
}
|
|
234
|
-
|
|
235
239
|
if (!value) {
|
|
236
240
|
return '';
|
|
237
241
|
}
|
|
238
|
-
|
|
239
242
|
return "".concat(value);
|
|
240
243
|
}
|
|
241
244
|
function isNotEmptyArray(arr) {
|
|
@@ -248,11 +251,9 @@ var useForwardRef = function (ref, initialValue) {
|
|
|
248
251
|
if (initialValue === void 0) {
|
|
249
252
|
initialValue = null;
|
|
250
253
|
}
|
|
251
|
-
|
|
252
254
|
var targetRef = React__namespace.useRef(initialValue);
|
|
253
255
|
React__namespace.useEffect(function () {
|
|
254
256
|
if (!ref) return;
|
|
255
|
-
|
|
256
257
|
if (typeof ref === 'function') {
|
|
257
258
|
ref(targetRef.current);
|
|
258
259
|
} else {
|
|
@@ -264,34 +265,29 @@ var useForwardRef = function (ref, initialValue) {
|
|
|
264
265
|
|
|
265
266
|
var InputField = React__namespace.forwardRef(function (_a, ref) {
|
|
266
267
|
var addonBefore = _a.addonBefore,
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
268
|
+
addonAfter = _a.addonAfter,
|
|
269
|
+
_b = _a.addonBeforeWidth,
|
|
270
|
+
addonBeforeWidth = _b === void 0 ? 40 : _b,
|
|
271
|
+
_c = _a.addonAfterWidth,
|
|
272
|
+
addonAfterWidth = _c === void 0 ? 40 : _c,
|
|
273
|
+
_d = _a.error,
|
|
274
|
+
error = _d === void 0 ? false : _d,
|
|
275
|
+
label = _a.label,
|
|
276
|
+
isLabelRequired = _a.isLabelRequired,
|
|
277
|
+
props = __rest(_a, ["addonBefore", "addonAfter", "addonBeforeWidth", "addonAfterWidth", "error", "label", "isLabelRequired"]);
|
|
278
278
|
var isMounted = React__namespace.useRef(false);
|
|
279
279
|
var isSkipOnFocus = React__namespace.useRef(false);
|
|
280
280
|
var isSkipOnBlur = React__namespace.useRef(false);
|
|
281
281
|
var inputRef = useForwardRef(ref, null);
|
|
282
|
-
|
|
283
282
|
var _e = React__namespace.useState(props.type),
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
283
|
+
localType = _e[0],
|
|
284
|
+
setLocalType = _e[1];
|
|
287
285
|
var _f = React__namespace.useState(getIsValueEmpty(props.value || props.defaultValue)),
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
286
|
+
isValueEmpty = _f[0],
|
|
287
|
+
setIsValueEmpty = _f[1];
|
|
291
288
|
React__namespace.useEffect(function () {
|
|
292
289
|
if (isMounted.current) {
|
|
293
290
|
var nextIsValueEmpty = getIsValueEmpty(props.value);
|
|
294
|
-
|
|
295
291
|
if (nextIsValueEmpty !== isValueEmpty) {
|
|
296
292
|
setIsValueEmpty(nextIsValueEmpty);
|
|
297
293
|
}
|
|
@@ -300,7 +296,6 @@ var InputField = React__namespace.forwardRef(function (_a, ref) {
|
|
|
300
296
|
}
|
|
301
297
|
}, [props.value]);
|
|
302
298
|
var currentAddonAfter = null;
|
|
303
|
-
|
|
304
299
|
if (props.type === 'password' && addonAfter === 'togglePassword') {
|
|
305
300
|
currentAddonAfter = React__namespace.createElement(AfterTogglePassword, {
|
|
306
301
|
inputType: localType,
|
|
@@ -312,17 +307,14 @@ var InputField = React__namespace.forwardRef(function (_a, ref) {
|
|
|
312
307
|
currentAddonAfter = isValueEmpty ? null : React__namespace.createElement(AfterClearValue, {
|
|
313
308
|
onClick: function (e) {
|
|
314
309
|
var _a;
|
|
315
|
-
|
|
316
310
|
if (!getIsValueEmpty(props.value) && !props.onChange) {
|
|
317
311
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
318
312
|
return;
|
|
319
313
|
}
|
|
320
|
-
|
|
321
314
|
if (inputRef.current) {
|
|
322
315
|
setIsValueEmpty(true);
|
|
323
316
|
inputRef.current.focus();
|
|
324
317
|
resolveOnChange(inputRef.current, e, props.onChange);
|
|
325
|
-
|
|
326
318
|
if (getIsValueEmpty(props.value)) {
|
|
327
319
|
inputRef.current.value = '';
|
|
328
320
|
}
|
|
@@ -352,7 +344,6 @@ var InputField = React__namespace.forwardRef(function (_a, ref) {
|
|
|
352
344
|
} else {
|
|
353
345
|
currentAddonAfter = addonAfter;
|
|
354
346
|
}
|
|
355
|
-
|
|
356
347
|
var isLabel = !!label;
|
|
357
348
|
var isBefore = !!addonBefore;
|
|
358
349
|
var isAfter = !!currentAddonAfter;
|
|
@@ -390,14 +381,12 @@ var InputField = React__namespace.forwardRef(function (_a, ref) {
|
|
|
390
381
|
if (!isSkipOnFocus.current && props.onFocus) {
|
|
391
382
|
props.onFocus(e);
|
|
392
383
|
}
|
|
393
|
-
|
|
394
384
|
isSkipOnFocus.current = false;
|
|
395
385
|
},
|
|
396
386
|
onBlur: function (e) {
|
|
397
387
|
if (!isSkipOnBlur.current && props.onBlur) {
|
|
398
388
|
props.onBlur(e);
|
|
399
389
|
}
|
|
400
|
-
|
|
401
390
|
isSkipOnBlur.current = false;
|
|
402
391
|
},
|
|
403
392
|
onChange: function (e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@prom-ui/core/Input"),n=require("@prom-ui/core/Button"),r=require("@prom-ui/core/Icon"),a=require("@prom-ui/icons/EyeOpen"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@prom-ui/core/Input"),n=require("@prom-ui/core/Button"),r=require("@prom-ui/core/Icon"),a=require("@prom-ui/core/BodyProvider"),i=require("@prom-ui/icons/EyeOpen"),o=require("@prom-ui/icons/EyeClose"),u=require("@prom-ui/core/Spinner"),c=require("@prom-ui/icons/Ok"),l=require("@prom-ui/icons/Cancel");function d(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var s=d(e),f=function(){return f=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},f.apply(this,arguments)};function p(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var v,h,m,_=function(e){var t=e.inputType,u=e.onChange,c=a.useBodyLocale().t;return"text"===t?s.createElement(n.Button,{type:"button","button-height":"1-1","button-width":"1-1","button-padding":"none",onClick:function(){return u("password")},title:c(v||(v=p(["Скрыть пароль"],["Скрыть пароль"]))),tabIndex:-1,"data-qaid":"input_field_hide_password","data-testid":"input_field_hide_password"},s.createElement(r.Icon,{"icon-as":i.SvgEyeOpen,"icon-color":"black-700","icon-events":"none",style:{width:16,height:16}})):s.createElement(n.Button,{type:"button","button-height":"1-1","button-width":"1-1","button-padding":"none",onClick:function(){return u("text")},title:c(h||(h=p(["Показать пароль"],["Показать пароль"]))),tabIndex:-1,"data-qaid":"input_field_show_password","data-testid":"input_field_show_password"},s.createElement(r.Icon,{"icon-as":o.SvgEyeClose,"icon-color":"black-600","icon-events":"none",style:{width:16,height:16}}))},b=function(){return s.createElement(u.Spinner,{"spinner-color":"violet-500",width:16,height:16,"data-qaid":"input_field_loading","data-testid":"input_field_loading"})},y=function(){return s.createElement(r.Icon,{"icon-as":c.SvgOk,"icon-color":"green-800","icon-events":"none","data-qaid":"input_field_correct_value","data-testid":"input_field_correct_value",style:{width:16,height:16}})},g=function(e){var t=a.useBodyLocale().t;return s.createElement(n.Button,f({type:"button","button-height":"1-1","button-width":"1-1","button-padding":"none",title:t(m||(m=p(["Очистить"],["Очистить"]))),tabIndex:-1,"data-qaid":"input_field_clear_value","data-testid":"input_field_clear_value"},e),s.createElement(r.Icon,{"icon-as":l.SvgCancel,"icon-color":"black-600","icon-events":"none",style:{width:16,height:16}}))},E="UnXum",q="_1Wl0O",w="-TbcG cUXq3",O="QmiGS cUXq3",j="_7Fcq2",x="uV711",B="cxqrg",I=function(e){var t=e.children;return s.createElement("div",{className:j,"data-qaid":"input_field_error","data-testid":"input_field_error"},t)};function C(e,t,n,r){if(n){var a=t;if("click"===t.type){var i=e.cloneNode(!0);return a=Object.create(t,{target:{value:i},currentTarget:{value:i}}),i.value="",void n(a)}if(void 0!==r)return a=Object.create(t,{target:{value:e},currentTarget:{value:e}}),e.value=r,void n(a);n(a)}}function N(e){return function(e){return Number.isInteger(e)||e?"".concat(e):""}(e).length<=0}var S=s.forwardRef((function(e,n){var r=e.addonBefore,a=e.addonAfter,i=e.addonBeforeWidth,o=void 0===i?40:i,u=e.addonAfterWidth,c=void 0===u?40:u,l=e.error,d=void 0!==l&&l,p=e.label,v=e.isLabelRequired,h=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n}(e,["addonBefore","addonAfter","addonBeforeWidth","addonAfterWidth","error","label","isLabelRequired"]),m=s.useRef(!1),j=s.useRef(!1),S=s.useRef(!1),k=function(e,t){void 0===t&&(t=null);var n=s.useRef(t);return s.useEffect((function(){e&&("function"==typeof e?e(n.current):e.current=n.current)}),[e]),n}(n,null),P=s.useState(h.type),A=P[0],F=P[1],R=s.useState(N(h.value||h.defaultValue)),T=R[0],L=R[1];s.useEffect((function(){if(m.current){var e=N(h.value);e!==T&&L(e)}else m.current=!0}),[h.value]);var W=null;W="password"===h.type&&"togglePassword"===a?s.createElement(_,{inputType:A,onChange:function(e){return F(e)}}):"clearValue"===a?T?null:s.createElement(g,{onClick:function(e){var t;N(h.value)||h.onChange?k.current&&(L(!0),k.current.focus(),C(k.current,e,h.onChange),N(h.value)&&(k.current.value="")):null===(t=k.current)||void 0===t||t.focus()},onMouseEnter:function(){j.current=!0,S.current=!0},onTouchStart:function(){j.current=!0,S.current=!0},onMouseLeave:function(){j.current=!1,S.current=!1},onTouchEnd:function(){j.current=!1,S.current=!1}}):"correctValue"===a?s.createElement(y,null):"loading"===a?s.createElement(b,null):a;var M,V=!!p,U=!!r,X=!!W,G=(M=d,Array.isArray(M)&&M.length>0||!!d);return s.createElement("div",{className:h.className,style:h.style,"data-qaid":h["data-qaid"]||"input_field","data-testid":h["data-testid"]||"input_field"},V&&s.createElement("div",{className:x},s.createElement("label",{"data-qaid":"input_field_label","data-testid":"input_field_label",htmlFor:h.id},p),!!v&&s.createElement(s.Fragment,null," ",s.createElement("span",{className:B,"data-qaid":"input_field_label_required","data-testid":"input_field_label_required"},"*"))),s.createElement("div",{className:E},s.createElement(t.Input,f({ref:k,"input-theme":G?"red":"white"},h,{"data-qaid":"input_field_textbox","data-testid":"input_field_textbox",style:{paddingLeft:U?o:void 0,paddingRight:X?c:void 0},className:q,type:A,onFocus:function(e){!j.current&&h.onFocus&&h.onFocus(e),j.current=!1},onBlur:function(e){!S.current&&h.onBlur&&h.onBlur(e),S.current=!1},onChange:function(e){L(N(e.target.value)),C(e.currentTarget,e,h.onChange)}})),U&&s.createElement("div",{className:w,style:{width:o}},r),X&&s.createElement("div",{className:O,style:{width:c}},W)),G&&(Array.isArray(d)?d.map((function(e){return s.createElement(I,{key:e},e)})):!0===d?null:s.createElement(I,null,d)))}));S.displayName="InputField",exports.InputField=S,require("./style.production.css");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@prom-ui/core/Input"),n=require("@prom-ui/core/Button"),r=require("@prom-ui/core/Icon"),a=require("@prom-ui/icons/EyeOpen"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@prom-ui/core/Input"),n=require("@prom-ui/core/Button"),r=require("@prom-ui/core/Icon"),a=require("@prom-ui/core/BodyProvider"),i=require("@prom-ui/icons/EyeOpen"),o=require("@prom-ui/icons/EyeClose"),u=require("@prom-ui/core/Spinner"),l=require("@prom-ui/icons/Ok"),c=require("@prom-ui/icons/Cancel");function d(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var s=d(e),f=function(){return f=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},f.apply(this,arguments)};function p(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var v,h,b,m=function(e){var t=e.inputType,u=e.onChange,l=a.useBodyLocale().t;return"text"===t?s.createElement(n.Button,{type:"button","button-height":"1-1","button-width":"1-1","button-padding":"none",onClick:function(){return u("password")},title:l(v||(v=p(["Скрыть пароль"],["Скрыть пароль"]))),tabIndex:-1,"data-qaid":"input_field_hide_password","data-testid":"input_field_hide_password"},s.createElement(r.Icon,{"icon-as":i.SvgEyeOpen,"icon-color":"black-700","icon-events":"none",style:{width:16,height:16}})):s.createElement(n.Button,{type:"button","button-height":"1-1","button-width":"1-1","button-padding":"none",onClick:function(){return u("text")},title:l(h||(h=p(["Показать пароль"],["Показать пароль"]))),tabIndex:-1,"data-qaid":"input_field_show_password","data-testid":"input_field_show_password"},s.createElement(r.Icon,{"icon-as":o.SvgEyeClose,"icon-color":"black-600","icon-events":"none",style:{width:16,height:16}}))},_=function(){return s.createElement(u.Spinner,{"spinner-color":"violet-500",width:16,height:16,"data-qaid":"input_field_loading","data-testid":"input_field_loading"})},y=function(){return s.createElement(r.Icon,{"icon-as":l.SvgOk,"icon-color":"green-800","icon-events":"none","data-qaid":"input_field_correct_value","data-testid":"input_field_correct_value",style:{width:16,height:16}})},g=function(e){var t=a.useBodyLocale().t;return s.createElement(n.Button,f({type:"button","button-height":"1-1","button-width":"1-1","button-padding":"none",title:t(b||(b=p(["Очистить"],["Очистить"]))),tabIndex:-1,"data-qaid":"input_field_clear_value","data-testid":"input_field_clear_value"},e),s.createElement(r.Icon,{"icon-as":c.SvgCancel,"icon-color":"black-600","icon-events":"none",style:{width:16,height:16}}))},E="EVTeN",w="rfpBC",O="GeS6- oqO-V",q="Cl38- oqO-V",j="hSs8w",B="bwxYk",C="bTTTw",x=function(e){var t=e.children;return s.createElement("div",{className:j,"data-qaid":"input_field_error","data-testid":"input_field_error"},t)};function I(e,t,n,r){if(n){var a=t;if("click"===t.type){var i=e.cloneNode(!0);return a=Object.create(t,{target:{value:i},currentTarget:{value:i}}),i.value="",void n(a)}if(void 0!==r)return a=Object.create(t,{target:{value:e},currentTarget:{value:e}}),e.value=r,void n(a);n(a)}}function N(e){return function(e){return Number.isInteger(e)||e?"".concat(e):""}(e).length<=0}var S=s.forwardRef((function(e,n){var r=e.addonBefore,a=e.addonAfter,i=e.addonBeforeWidth,o=void 0===i?40:i,u=e.addonAfterWidth,l=void 0===u?40:u,c=e.error,d=void 0!==c&&c,p=e.label,v=e.isLabelRequired,h=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n}(e,["addonBefore","addonAfter","addonBeforeWidth","addonAfterWidth","error","label","isLabelRequired"]),b=s.useRef(!1),j=s.useRef(!1),S=s.useRef(!1),k=function(e,t){void 0===t&&(t=null);var n=s.useRef(t);return s.useEffect((function(){e&&("function"==typeof e?e(n.current):e.current=n.current)}),[e]),n}(n,null),P=s.useState(h.type),T=P[0],A=P[1],R=s.useState(N(h.value||h.defaultValue)),F=R[0],L=R[1];s.useEffect((function(){if(b.current){var e=N(h.value);e!==F&&L(e)}else b.current=!0}),[h.value]);var V=null;V="password"===h.type&&"togglePassword"===a?s.createElement(m,{inputType:T,onChange:function(e){return A(e)}}):"clearValue"===a?F?null:s.createElement(g,{onClick:function(e){var t;N(h.value)||h.onChange?k.current&&(L(!0),k.current.focus(),I(k.current,e,h.onChange),N(h.value)&&(k.current.value="")):null===(t=k.current)||void 0===t||t.focus()},onMouseEnter:function(){j.current=!0,S.current=!0},onTouchStart:function(){j.current=!0,S.current=!0},onMouseLeave:function(){j.current=!1,S.current=!1},onTouchEnd:function(){j.current=!1,S.current=!1}}):"correctValue"===a?s.createElement(y,null):"loading"===a?s.createElement(_,null):a;var M,W=!!p,z=!!r,D=!!V,G=(M=d,Array.isArray(M)&&M.length>0||!!d);return s.createElement("div",{className:h.className,style:h.style,"data-qaid":h["data-qaid"]||"input_field","data-testid":h["data-testid"]||"input_field"},W&&s.createElement("div",{className:B},s.createElement("label",{"data-qaid":"input_field_label","data-testid":"input_field_label",htmlFor:h.id},p),!!v&&s.createElement(s.Fragment,null," ",s.createElement("span",{className:C,"data-qaid":"input_field_label_required","data-testid":"input_field_label_required"},"*"))),s.createElement("div",{className:E},s.createElement(t.Input,f({ref:k,"input-theme":G?"red":"white"},h,{"data-qaid":"input_field_textbox","data-testid":"input_field_textbox",style:{paddingLeft:z?o:void 0,paddingRight:D?l:void 0},className:w,type:T,onFocus:function(e){!j.current&&h.onFocus&&h.onFocus(e),j.current=!1},onBlur:function(e){!S.current&&h.onBlur&&h.onBlur(e),S.current=!1},onChange:function(e){L(N(e.target.value)),I(e.currentTarget,e,h.onChange)}})),z&&s.createElement("div",{className:O,style:{width:o}},r),D&&s.createElement("div",{className:q,style:{width:l}},V)),G&&(Array.isArray(d)?d.map((function(e){return s.createElement(x,{key:e},e)})):!0===d?null:s.createElement(x,null,d)))}));S.displayName="InputField",exports.InputField=S,require("./style.production.v2.css");
|
package/InputField/package.json
CHANGED
|
@@ -27,21 +27,19 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
|
27
27
|
|
|
28
28
|
var KeyPressApp = function (_a) {
|
|
29
29
|
var code = _a.code,
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
onKeyDown = _a.onKeyDown,
|
|
31
|
+
onKeyUp = _a.onKeyUp;
|
|
32
32
|
useKeyPress.useKeyPress(code, onKeyDown, onKeyUp);
|
|
33
33
|
return null;
|
|
34
34
|
};
|
|
35
|
-
|
|
36
35
|
var KeyPress = function (_a) {
|
|
37
36
|
var _b = _a.isActive,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
isActive = _b === void 0 ? true : _b,
|
|
38
|
+
code = _a.code,
|
|
39
|
+
_c = _a.onKeyDown,
|
|
40
|
+
onKeyDown = _c === void 0 ? function () {} : _c,
|
|
41
|
+
_d = _a.onKeyUp,
|
|
42
|
+
onKeyUp = _d === void 0 ? function () {} : _d;
|
|
45
43
|
if (isActive) {
|
|
46
44
|
return React__namespace.createElement(KeyPressApp, {
|
|
47
45
|
code: code,
|
|
@@ -49,7 +47,6 @@ var KeyPress = function (_a) {
|
|
|
49
47
|
onKeyUp: onKeyUp
|
|
50
48
|
});
|
|
51
49
|
}
|
|
52
|
-
|
|
53
50
|
return null;
|
|
54
51
|
};
|
|
55
52
|
|