@prom-ui/core 0.0.110 → 0.0.120
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/package.json +1 -1
- package/Body/package.json +1 -1
- package/Box/package.json +1 -1
- package/Button/package.json +1 -1
- package/ButtonPageUp/package.json +1 -1
- package/Checkbox/package.json +1 -1
- package/Flex/package.json +1 -1
- package/Grid/package.json +1 -1
- package/Icon/cjs/index.development.js +2 -2
- package/Icon/cjs/index.development.v2.js +2 -2
- package/Icon/cjs/index.production.js +1 -1
- package/Icon/cjs/index.production.v2.js +1 -1
- package/Icon/cjs/style.development.css +1 -1
- package/Icon/cjs/style.development.v2.css +1 -1
- package/Icon/cjs/style.production.css +1 -1
- package/Icon/cjs/style.production.v2.css +1 -1
- package/Icon/index.d.ts +3 -1
- package/Icon/package.json +1 -1
- package/Image/package.json +1 -1
- package/ImageEmoji/package.json +1 -1
- package/Input/cjs/style.development.css +1 -1
- package/Input/cjs/style.development.v2.css +1 -1
- package/Input/cjs/style.production.css +1 -1
- package/Input/cjs/style.production.v2.css +1 -1
- package/Input/package.json +1 -1
- package/InputField/addons/AfterClearValue.d.ts +4 -0
- package/InputField/addons/AfterCorrectValue.d.ts +2 -0
- package/InputField/addons/AfterLoading.d.ts +2 -0
- package/InputField/addons/AfterTogglePassword.d.ts +7 -0
- package/InputField/cjs/index.development.js +411 -0
- package/InputField/cjs/index.development.v2.js +411 -0
- package/InputField/cjs/index.production.js +1 -0
- package/InputField/cjs/index.production.v2.js +1 -0
- package/InputField/cjs/style.development.css +1 -0
- package/InputField/cjs/style.development.v2.css +1 -0
- package/InputField/cjs/style.production.css +1 -0
- package/InputField/cjs/style.production.v2.css +1 -0
- package/InputField/index.d.ts +12 -0
- package/InputField/index.js +7 -0
- package/InputField/index.v2.js +7 -0
- package/InputField/package.json +12 -0
- package/InputField/utils.d.ts +6 -0
- package/KeyPress/package.json +1 -1
- package/Line/package.json +1 -1
- package/Link/package.json +1 -1
- package/List/package.json +1 -1
- package/Media/package.json +1 -1
- package/OutsideClick/package.json +1 -1
- package/Overlay/package.json +1 -1
- package/Picture/package.json +1 -1
- package/PortableOverlay/package.json +1 -1
- package/Portal/package.json +1 -1
- package/QRCode/package.json +1 -1
- package/Rating/package.json +1 -1
- package/SafeQuery/package.json +1 -1
- package/Scroll/package.json +1 -1
- package/ScrollControls/package.json +1 -1
- package/SideOverlay/package.json +1 -1
- package/SimpleSlider/package.json +1 -1
- package/Skeleton/package.json +1 -1
- package/Spinner/package.json +1 -1
- package/Text/package.json +1 -1
- package/TextEmoji/package.json +1 -1
- package/Tooltip/package.json +1 -1
- package/Tumbler/package.json +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var classNames = require('classnames');
|
|
7
|
+
var Input = require('@prom-ui/core/Input');
|
|
8
|
+
var Button = require('@prom-ui/core/Button');
|
|
9
|
+
var Icon = require('@prom-ui/core/Icon');
|
|
10
|
+
var EyeOpen = require('@prom-ui/icons/EyeOpen');
|
|
11
|
+
var EyeClose = require('@prom-ui/icons/EyeClose');
|
|
12
|
+
var Spinner = require('@prom-ui/core/Spinner');
|
|
13
|
+
var Ok = require('@prom-ui/icons/Ok');
|
|
14
|
+
var Cancel = require('@prom-ui/icons/Cancel');
|
|
15
|
+
|
|
16
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
17
|
+
|
|
18
|
+
function _interopNamespace(e) {
|
|
19
|
+
if (e && e.__esModule) return e;
|
|
20
|
+
var n = Object.create(null);
|
|
21
|
+
if (e) {
|
|
22
|
+
Object.keys(e).forEach(function (k) {
|
|
23
|
+
if (k !== 'default') {
|
|
24
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
25
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () { return e[k]; }
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
n["default"] = e;
|
|
33
|
+
return Object.freeze(n);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
37
|
+
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
38
|
+
|
|
39
|
+
/******************************************************************************
|
|
40
|
+
Copyright (c) Microsoft Corporation.
|
|
41
|
+
|
|
42
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
43
|
+
purpose with or without fee is hereby granted.
|
|
44
|
+
|
|
45
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
46
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
47
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
48
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
49
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
50
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
51
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
52
|
+
***************************************************************************** */
|
|
53
|
+
|
|
54
|
+
var __assign = function() {
|
|
55
|
+
__assign = Object.assign || function __assign(t) {
|
|
56
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
57
|
+
s = arguments[i];
|
|
58
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
59
|
+
}
|
|
60
|
+
return t;
|
|
61
|
+
};
|
|
62
|
+
return __assign.apply(this, arguments);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
function __rest(s, e) {
|
|
66
|
+
var t = {};
|
|
67
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
68
|
+
t[p] = s[p];
|
|
69
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
70
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
71
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
72
|
+
t[p[i]] = s[p[i]];
|
|
73
|
+
}
|
|
74
|
+
return t;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
var AfterTogglePassword = function (_a) {
|
|
78
|
+
var inputType = _a.inputType,
|
|
79
|
+
onChange = _a.onChange;
|
|
80
|
+
|
|
81
|
+
if (inputType === 'text') {
|
|
82
|
+
return React__namespace.createElement(Button.Button, {
|
|
83
|
+
type: 'button',
|
|
84
|
+
"button-height": '1-1',
|
|
85
|
+
"button-width": '1-1',
|
|
86
|
+
"button-padding": 'none',
|
|
87
|
+
onClick: function () {
|
|
88
|
+
return onChange('password');
|
|
89
|
+
},
|
|
90
|
+
title: '\u0421\u043A\u0440\u044B\u0442\u044C \u043F\u0430\u0440\u043E\u043B\u044C',
|
|
91
|
+
tabIndex: -1,
|
|
92
|
+
"data-qaid": 'inputFieldHidePassword',
|
|
93
|
+
"data-testid": 'inputFieldHidePassword'
|
|
94
|
+
}, React__namespace.createElement(Icon.Icon, {
|
|
95
|
+
"icon-as": EyeOpen.SvgEyeOpen,
|
|
96
|
+
"icon-color": 'black-700',
|
|
97
|
+
"icon-events": 'none',
|
|
98
|
+
style: {
|
|
99
|
+
width: 16,
|
|
100
|
+
height: 16
|
|
101
|
+
}
|
|
102
|
+
}));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return React__namespace.createElement(Button.Button, {
|
|
106
|
+
type: 'button',
|
|
107
|
+
"button-height": '1-1',
|
|
108
|
+
"button-width": '1-1',
|
|
109
|
+
"button-padding": 'none',
|
|
110
|
+
onClick: function () {
|
|
111
|
+
return onChange('text');
|
|
112
|
+
},
|
|
113
|
+
title: '\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u043F\u0430\u0440\u043E\u043B\u044C',
|
|
114
|
+
tabIndex: -1,
|
|
115
|
+
"data-qaid": 'inputFieldShowPassword',
|
|
116
|
+
"data-testid": 'inputFieldShowPassword'
|
|
117
|
+
}, React__namespace.createElement(Icon.Icon, {
|
|
118
|
+
"icon-as": EyeClose.SvgEyeClose,
|
|
119
|
+
"icon-color": 'black-600',
|
|
120
|
+
"icon-events": 'none',
|
|
121
|
+
style: {
|
|
122
|
+
width: 16,
|
|
123
|
+
height: 16
|
|
124
|
+
}
|
|
125
|
+
}));
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
var AfterLoading = function () {
|
|
129
|
+
return React__namespace.createElement(Spinner.Spinner, {
|
|
130
|
+
"spinner-color": 'violet-500',
|
|
131
|
+
width: 16,
|
|
132
|
+
height: 16,
|
|
133
|
+
"data-qaid": 'inputFieldLoading',
|
|
134
|
+
"data-testid": 'inputFieldLoading'
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
var AfterCorrectValue = function () {
|
|
139
|
+
return React__namespace.createElement(Icon.Icon, {
|
|
140
|
+
"icon-as": Ok.SvgOk,
|
|
141
|
+
"icon-color": 'green-800',
|
|
142
|
+
"icon-events": 'none',
|
|
143
|
+
"data-qaid": 'inputFieldCorrectValue',
|
|
144
|
+
"data-testid": 'inputFieldCorrectValue',
|
|
145
|
+
style: {
|
|
146
|
+
width: 16,
|
|
147
|
+
height: 16
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
var AfterClearValue = function (props) {
|
|
153
|
+
return React__namespace.createElement(Button.Button, __assign({
|
|
154
|
+
type: 'button',
|
|
155
|
+
"button-height": '1-1',
|
|
156
|
+
"button-width": '1-1',
|
|
157
|
+
"button-padding": 'none',
|
|
158
|
+
title: '\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C',
|
|
159
|
+
tabIndex: -1,
|
|
160
|
+
"data-qaid": 'inputFieldClearValue',
|
|
161
|
+
"data-testid": 'inputFieldClearValue'
|
|
162
|
+
}, props), React__namespace.createElement(Icon.Icon, {
|
|
163
|
+
"icon-as": Cancel.SvgCancel,
|
|
164
|
+
"icon-color": 'black-600',
|
|
165
|
+
"icon-events": 'none',
|
|
166
|
+
style: {
|
|
167
|
+
width: 16,
|
|
168
|
+
height: 16
|
|
169
|
+
}
|
|
170
|
+
}));
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
function resolveOnChange(target, e, onChange, targetValue) {
|
|
174
|
+
if (!onChange) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
var event = e;
|
|
179
|
+
|
|
180
|
+
if (e.type === 'click') {
|
|
181
|
+
// Clone a new target for event.
|
|
182
|
+
// Avoid the following usage, the setQuery method gets the original value.
|
|
183
|
+
//
|
|
184
|
+
// const [query, setQuery] = React.useState('');
|
|
185
|
+
// <InputField
|
|
186
|
+
// value={query}
|
|
187
|
+
// onChange={(e)=> {
|
|
188
|
+
// setQuery((prevStatus) => e.target.value);
|
|
189
|
+
// }}
|
|
190
|
+
// />
|
|
191
|
+
var currentTarget = target.cloneNode(true); // Click clear button
|
|
192
|
+
|
|
193
|
+
event = Object.create(e, {
|
|
194
|
+
target: {
|
|
195
|
+
value: currentTarget
|
|
196
|
+
},
|
|
197
|
+
currentTarget: {
|
|
198
|
+
value: currentTarget
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
currentTarget.value = '';
|
|
202
|
+
onChange(event);
|
|
203
|
+
return;
|
|
204
|
+
} // Trigger by composition event, this means we need force change the input value
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
if (targetValue !== undefined) {
|
|
208
|
+
event = Object.create(e, {
|
|
209
|
+
target: {
|
|
210
|
+
value: target
|
|
211
|
+
},
|
|
212
|
+
currentTarget: {
|
|
213
|
+
value: target
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
target.value = targetValue;
|
|
217
|
+
onChange(event);
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
onChange(event);
|
|
222
|
+
}
|
|
223
|
+
function valueToString(value) {
|
|
224
|
+
if (Number.isInteger(value)) {
|
|
225
|
+
return "".concat(value);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (!value) {
|
|
229
|
+
return '';
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return "".concat(value);
|
|
233
|
+
}
|
|
234
|
+
function isNotEmptyArray(arr) {
|
|
235
|
+
return Array.isArray(arr) && arr.length > 0;
|
|
236
|
+
}
|
|
237
|
+
function getIsValueEmpty(value) {
|
|
238
|
+
return valueToString(value).length <= 0;
|
|
239
|
+
}
|
|
240
|
+
var useForwardRef = function (ref, initialValue) {
|
|
241
|
+
if (initialValue === void 0) {
|
|
242
|
+
initialValue = null;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
var targetRef = React__namespace.useRef(initialValue);
|
|
246
|
+
React__namespace.useEffect(function () {
|
|
247
|
+
if (!ref) return;
|
|
248
|
+
|
|
249
|
+
if (typeof ref === 'function') {
|
|
250
|
+
ref(targetRef.current);
|
|
251
|
+
} else {
|
|
252
|
+
ref.current = targetRef.current;
|
|
253
|
+
}
|
|
254
|
+
}, [ref]);
|
|
255
|
+
return targetRef;
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
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"};
|
|
259
|
+
|
|
260
|
+
var InputField = React__namespace.forwardRef(function (_a, ref) {
|
|
261
|
+
var addonBefore = _a.addonBefore,
|
|
262
|
+
addonAfter = _a.addonAfter,
|
|
263
|
+
_b = _a.addonBeforeWidth,
|
|
264
|
+
addonBeforeWidth = _b === void 0 ? 40 : _b,
|
|
265
|
+
_c = _a.addonAfterWidth,
|
|
266
|
+
addonAfterWidth = _c === void 0 ? 40 : _c,
|
|
267
|
+
_d = _a.error,
|
|
268
|
+
error = _d === void 0 ? false : _d,
|
|
269
|
+
props = __rest(_a, ["addonBefore", "addonAfter", "addonBeforeWidth", "addonAfterWidth", "error"]);
|
|
270
|
+
|
|
271
|
+
var isMounted = React__namespace.useRef(false);
|
|
272
|
+
var isSkipOnFocus = React__namespace.useRef(false);
|
|
273
|
+
var isSkipOnBlur = React__namespace.useRef(false);
|
|
274
|
+
var inputRef = useForwardRef(ref, null);
|
|
275
|
+
|
|
276
|
+
var _e = React__namespace.useState(props.type),
|
|
277
|
+
localType = _e[0],
|
|
278
|
+
setLocalType = _e[1];
|
|
279
|
+
|
|
280
|
+
var _f = React__namespace.useState(getIsValueEmpty(props.value || props.defaultValue)),
|
|
281
|
+
isValueEmpty = _f[0],
|
|
282
|
+
setIsValueEmpty = _f[1];
|
|
283
|
+
|
|
284
|
+
React__namespace.useEffect(function () {
|
|
285
|
+
if (isMounted.current) {
|
|
286
|
+
var nextIsValueEmpty = getIsValueEmpty(props.value);
|
|
287
|
+
|
|
288
|
+
if (nextIsValueEmpty !== isValueEmpty) {
|
|
289
|
+
setIsValueEmpty(nextIsValueEmpty);
|
|
290
|
+
}
|
|
291
|
+
} else {
|
|
292
|
+
isMounted.current = true;
|
|
293
|
+
}
|
|
294
|
+
}, [props.value]);
|
|
295
|
+
var currentAddonAfter = null;
|
|
296
|
+
|
|
297
|
+
if (props.type === 'password' && addonAfter === 'togglePassword') {
|
|
298
|
+
currentAddonAfter = React__namespace.createElement(AfterTogglePassword, {
|
|
299
|
+
inputType: localType,
|
|
300
|
+
onChange: function (type) {
|
|
301
|
+
return setLocalType(type);
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
} else if (addonAfter === 'clearValue') {
|
|
305
|
+
currentAddonAfter = isValueEmpty ? null : React__namespace.createElement(AfterClearValue, {
|
|
306
|
+
onClick: function (e) {
|
|
307
|
+
var _a;
|
|
308
|
+
|
|
309
|
+
if (!getIsValueEmpty(props.value) && !props.onChange) {
|
|
310
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
if (inputRef.current) {
|
|
315
|
+
setIsValueEmpty(true);
|
|
316
|
+
inputRef.current.focus();
|
|
317
|
+
resolveOnChange(inputRef.current, e, props.onChange);
|
|
318
|
+
|
|
319
|
+
if (getIsValueEmpty(props.value)) {
|
|
320
|
+
inputRef.current.value = '';
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
onMouseEnter: function () {
|
|
325
|
+
isSkipOnFocus.current = true;
|
|
326
|
+
isSkipOnBlur.current = true;
|
|
327
|
+
},
|
|
328
|
+
onTouchStart: function () {
|
|
329
|
+
isSkipOnFocus.current = true;
|
|
330
|
+
isSkipOnBlur.current = true;
|
|
331
|
+
},
|
|
332
|
+
onMouseLeave: function () {
|
|
333
|
+
isSkipOnFocus.current = false;
|
|
334
|
+
isSkipOnBlur.current = false;
|
|
335
|
+
},
|
|
336
|
+
onTouchEnd: function () {
|
|
337
|
+
isSkipOnFocus.current = false;
|
|
338
|
+
isSkipOnBlur.current = false;
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
} else if (addonAfter === 'correctValue') {
|
|
342
|
+
currentAddonAfter = React__namespace.createElement(AfterCorrectValue, null);
|
|
343
|
+
} else if (addonAfter === 'loading') {
|
|
344
|
+
currentAddonAfter = React__namespace.createElement(AfterLoading, null);
|
|
345
|
+
} else {
|
|
346
|
+
currentAddonAfter = addonAfter;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
var isBefore = !!addonBefore;
|
|
350
|
+
var isAfter = !!currentAddonAfter;
|
|
351
|
+
var isError = isNotEmptyArray(error) || !!error;
|
|
352
|
+
return React__namespace.createElement(React__namespace.Fragment, null, React__namespace.createElement("div", {
|
|
353
|
+
className: classNames__default["default"](css.root, props.className),
|
|
354
|
+
style: props.style
|
|
355
|
+
}, React__namespace.createElement(Input.Input, __assign({
|
|
356
|
+
ref: inputRef,
|
|
357
|
+
"input-theme": isError ? 'red' : 'white',
|
|
358
|
+
"data-qaid": 'inputField',
|
|
359
|
+
"data-testid": 'inputField'
|
|
360
|
+
}, props, {
|
|
361
|
+
style: {
|
|
362
|
+
paddingLeft: isBefore ? addonBeforeWidth : undefined,
|
|
363
|
+
paddingRight: isAfter ? addonAfterWidth : undefined
|
|
364
|
+
},
|
|
365
|
+
className: css.input,
|
|
366
|
+
type: localType,
|
|
367
|
+
onFocus: function (e) {
|
|
368
|
+
if (!isSkipOnFocus.current && props.onFocus) {
|
|
369
|
+
props.onFocus(e);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
isSkipOnFocus.current = false;
|
|
373
|
+
},
|
|
374
|
+
onBlur: function (e) {
|
|
375
|
+
if (!isSkipOnBlur.current && props.onBlur) {
|
|
376
|
+
props.onBlur(e);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
isSkipOnBlur.current = false;
|
|
380
|
+
},
|
|
381
|
+
onChange: function (e) {
|
|
382
|
+
setIsValueEmpty(getIsValueEmpty(e.target.value));
|
|
383
|
+
resolveOnChange(e.currentTarget, e, props.onChange);
|
|
384
|
+
}
|
|
385
|
+
})), isBefore && React__namespace.createElement("div", {
|
|
386
|
+
className: css.before,
|
|
387
|
+
style: {
|
|
388
|
+
width: addonBeforeWidth
|
|
389
|
+
}
|
|
390
|
+
}, addonBefore), isAfter && React__namespace.createElement("div", {
|
|
391
|
+
className: css.after,
|
|
392
|
+
style: {
|
|
393
|
+
width: addonAfterWidth
|
|
394
|
+
}
|
|
395
|
+
}, currentAddonAfter)), isError && (Array.isArray(error) ? error.map(function (errorItem) {
|
|
396
|
+
return React__namespace.createElement("div", {
|
|
397
|
+
className: css.error,
|
|
398
|
+
key: errorItem,
|
|
399
|
+
"data-qaid": 'inputFieldError',
|
|
400
|
+
"data-testid": 'inputFieldError'
|
|
401
|
+
}, errorItem);
|
|
402
|
+
}) : error === true ? null : React__namespace.createElement("div", {
|
|
403
|
+
className: css.error,
|
|
404
|
+
"data-qaid": 'inputFieldError',
|
|
405
|
+
"data-testid": 'inputFieldError'
|
|
406
|
+
}, error)));
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
exports.InputField = InputField;
|
|
410
|
+
|
|
411
|
+
require('./style.development.v2.css');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("classnames"),n=require("@prom-ui/core/Input"),r=require("@prom-ui/core/Button"),o=require("@prom-ui/core/Icon"),i=require("@prom-ui/icons/EyeOpen"),u=require("@prom-ui/icons/EyeClose"),a=require("@prom-ui/core/Spinner"),c=require("@prom-ui/icons/Ok"),l=require("@prom-ui/icons/Cancel");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function s(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 f=s(e),p=d(t),v=function(){return v=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},v.apply(this,arguments)};var h=function(e){var t=e.inputType,n=e.onChange;return"text"===t?f.createElement(r.Button,{type:"button","button-height":"1-1","button-width":"1-1","button-padding":"none",onClick:function(){return n("password")},title:"Скрыть пароль",tabIndex:-1,"data-qaid":"inputFieldHidePassword","data-testid":"inputFieldHidePassword"},f.createElement(o.Icon,{"icon-as":i.SvgEyeOpen,"icon-color":"black-700","icon-events":"none",style:{width:16,height:16}})):f.createElement(r.Button,{type:"button","button-height":"1-1","button-width":"1-1","button-padding":"none",onClick:function(){return n("text")},title:"Показать пароль",tabIndex:-1,"data-qaid":"inputFieldShowPassword","data-testid":"inputFieldShowPassword"},f.createElement(o.Icon,{"icon-as":u.SvgEyeClose,"icon-color":"black-600","icon-events":"none",style:{width:16,height:16}}))},g=function(){return f.createElement(a.Spinner,{"spinner-color":"violet-500",width:16,height:16,"data-qaid":"inputFieldLoading","data-testid":"inputFieldLoading"})},y=function(){return f.createElement(o.Icon,{"icon-as":c.SvgOk,"icon-color":"green-800","icon-events":"none","data-qaid":"inputFieldCorrectValue","data-testid":"inputFieldCorrectValue",style:{width:16,height:16}})},m=function(e){return f.createElement(r.Button,v({type:"button","button-height":"1-1","button-width":"1-1","button-padding":"none",title:"Очистить",tabIndex:-1,"data-qaid":"inputFieldClearValue","data-testid":"inputFieldClearValue"},e),f.createElement(o.Icon,{"icon-as":l.SvgCancel,"icon-color":"black-600","icon-events":"none",style:{width:16,height:16}}))};function b(e,t,n,r){if(n){var o=t;if("click"===t.type){var i=e.cloneNode(!0);return o=Object.create(t,{target:{value:i},currentTarget:{value:i}}),i.value="",void n(o)}if(void 0!==r)return o=Object.create(t,{target:{value:e},currentTarget:{value:e}}),e.value=r,void n(o);n(o)}}function E(e){return function(e){return Number.isInteger(e)||e?"".concat(e):""}(e).length<=0}var w="UnXum",O="_1Wl0O",q="-TbcG cUXq3",F="QmiGS cUXq3",C="_7Fcq2",j=f.forwardRef((function(e,t){var r=e.addonBefore,o=e.addonAfter,i=e.addonBeforeWidth,u=void 0===i?40:i,a=e.addonAfterWidth,c=void 0===a?40:a,l=e.error,d=void 0!==l&&l,s=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 o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["addonBefore","addonAfter","addonBeforeWidth","addonAfterWidth","error"]),j=f.useRef(!1),S=f.useRef(!1),I=f.useRef(!1),P=function(e,t){void 0===t&&(t=null);var n=f.useRef(t);return f.useEffect((function(){e&&("function"==typeof e?e(n.current):e.current=n.current)}),[e]),n}(t,null),k=f.useState(s.type),B=k[0],x=k[1],N=f.useState(E(s.value||s.defaultValue)),A=N[0],T=N[1];f.useEffect((function(){if(j.current){var e=E(s.value);e!==A&&T(e)}else j.current=!0}),[s.value]);var V=null;V="password"===s.type&&"togglePassword"===o?f.createElement(h,{inputType:B,onChange:function(e){return x(e)}}):"clearValue"===o?A?null:f.createElement(m,{onClick:function(e){var t;E(s.value)||s.onChange?P.current&&(T(!0),P.current.focus(),b(P.current,e,s.onChange),E(s.value)&&(P.current.value="")):null===(t=P.current)||void 0===t||t.focus()},onMouseEnter:function(){S.current=!0,I.current=!0},onTouchStart:function(){S.current=!0,I.current=!0},onMouseLeave:function(){S.current=!1,I.current=!1},onTouchEnd:function(){S.current=!1,I.current=!1}}):"correctValue"===o?f.createElement(y,null):"loading"===o?f.createElement(g,null):o;var R,_=!!r,W=!!V,L=(R=d,Array.isArray(R)&&R.length>0||!!d);return f.createElement(f.Fragment,null,f.createElement("div",{className:p.default(w,s.className),style:s.style},f.createElement(n.Input,v({ref:P,"input-theme":L?"red":"white","data-qaid":"inputField","data-testid":"inputField"},s,{style:{paddingLeft:_?u:void 0,paddingRight:W?c:void 0},className:O,type:B,onFocus:function(e){!S.current&&s.onFocus&&s.onFocus(e),S.current=!1},onBlur:function(e){!I.current&&s.onBlur&&s.onBlur(e),I.current=!1},onChange:function(e){T(E(e.target.value)),b(e.currentTarget,e,s.onChange)}})),_&&f.createElement("div",{className:q,style:{width:u}},r),W&&f.createElement("div",{className:F,style:{width:c}},V)),L&&(Array.isArray(d)?d.map((function(e){return f.createElement("div",{className:C,key:e,"data-qaid":"inputFieldError","data-testid":"inputFieldError"},e)})):!0===d?null:f.createElement("div",{className:C,"data-qaid":"inputFieldError","data-testid":"inputFieldError"},d)))}));exports.InputField=j,require("./style.production.css");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("classnames"),n=require("@prom-ui/core/Input"),r=require("@prom-ui/core/Button"),o=require("@prom-ui/core/Icon"),i=require("@prom-ui/icons/EyeOpen"),u=require("@prom-ui/icons/EyeClose"),a=require("@prom-ui/core/Spinner"),c=require("@prom-ui/icons/Ok"),l=require("@prom-ui/icons/Cancel");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function s(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 f=s(e),p=d(t),v=function(){return v=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},v.apply(this,arguments)};var h=function(e){var t=e.inputType,n=e.onChange;return"text"===t?f.createElement(r.Button,{type:"button","button-height":"1-1","button-width":"1-1","button-padding":"none",onClick:function(){return n("password")},title:"Скрыть пароль",tabIndex:-1,"data-qaid":"inputFieldHidePassword","data-testid":"inputFieldHidePassword"},f.createElement(o.Icon,{"icon-as":i.SvgEyeOpen,"icon-color":"black-700","icon-events":"none",style:{width:16,height:16}})):f.createElement(r.Button,{type:"button","button-height":"1-1","button-width":"1-1","button-padding":"none",onClick:function(){return n("text")},title:"Показать пароль",tabIndex:-1,"data-qaid":"inputFieldShowPassword","data-testid":"inputFieldShowPassword"},f.createElement(o.Icon,{"icon-as":u.SvgEyeClose,"icon-color":"black-600","icon-events":"none",style:{width:16,height:16}}))},g=function(){return f.createElement(a.Spinner,{"spinner-color":"violet-500",width:16,height:16,"data-qaid":"inputFieldLoading","data-testid":"inputFieldLoading"})},y=function(){return f.createElement(o.Icon,{"icon-as":c.SvgOk,"icon-color":"green-800","icon-events":"none","data-qaid":"inputFieldCorrectValue","data-testid":"inputFieldCorrectValue",style:{width:16,height:16}})},m=function(e){return f.createElement(r.Button,v({type:"button","button-height":"1-1","button-width":"1-1","button-padding":"none",title:"Очистить",tabIndex:-1,"data-qaid":"inputFieldClearValue","data-testid":"inputFieldClearValue"},e),f.createElement(o.Icon,{"icon-as":l.SvgCancel,"icon-color":"black-600","icon-events":"none",style:{width:16,height:16}}))};function b(e,t,n,r){if(n){var o=t;if("click"===t.type){var i=e.cloneNode(!0);return o=Object.create(t,{target:{value:i},currentTarget:{value:i}}),i.value="",void n(o)}if(void 0!==r)return o=Object.create(t,{target:{value:e},currentTarget:{value:e}}),e.value=r,void n(o);n(o)}}function E(e){return function(e){return Number.isInteger(e)||e?"".concat(e):""}(e).length<=0}var w="EVTeN",O="rfpBC",q="GeS6- oqO-V",F="Cl38- oqO-V",C="hSs8w",j=f.forwardRef((function(e,t){var r=e.addonBefore,o=e.addonAfter,i=e.addonBeforeWidth,u=void 0===i?40:i,a=e.addonAfterWidth,c=void 0===a?40:a,l=e.error,d=void 0!==l&&l,s=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 o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["addonBefore","addonAfter","addonBeforeWidth","addonAfterWidth","error"]),j=f.useRef(!1),S=f.useRef(!1),I=f.useRef(!1),B=function(e,t){void 0===t&&(t=null);var n=f.useRef(t);return f.useEffect((function(){e&&("function"==typeof e?e(n.current):e.current=n.current)}),[e]),n}(t,null),P=f.useState(s.type),k=P[0],N=P[1],V=f.useState(E(s.value||s.defaultValue)),x=V[0],A=V[1];f.useEffect((function(){if(j.current){var e=E(s.value);e!==x&&A(e)}else j.current=!0}),[s.value]);var T=null;T="password"===s.type&&"togglePassword"===o?f.createElement(h,{inputType:k,onChange:function(e){return N(e)}}):"clearValue"===o?x?null:f.createElement(m,{onClick:function(e){var t;E(s.value)||s.onChange?B.current&&(A(!0),B.current.focus(),b(B.current,e,s.onChange),E(s.value)&&(B.current.value="")):null===(t=B.current)||void 0===t||t.focus()},onMouseEnter:function(){S.current=!0,I.current=!0},onTouchStart:function(){S.current=!0,I.current=!0},onMouseLeave:function(){S.current=!1,I.current=!1},onTouchEnd:function(){S.current=!1,I.current=!1}}):"correctValue"===o?f.createElement(y,null):"loading"===o?f.createElement(g,null):o;var R,L=!!r,M=!!T,W=(R=d,Array.isArray(R)&&R.length>0||!!d);return f.createElement(f.Fragment,null,f.createElement("div",{className:p.default(w,s.className),style:s.style},f.createElement(n.Input,v({ref:B,"input-theme":W?"red":"white","data-qaid":"inputField","data-testid":"inputField"},s,{style:{paddingLeft:L?u:void 0,paddingRight:M?c:void 0},className:O,type:k,onFocus:function(e){!S.current&&s.onFocus&&s.onFocus(e),S.current=!1},onBlur:function(e){!I.current&&s.onBlur&&s.onBlur(e),I.current=!1},onChange:function(e){A(E(e.target.value)),b(e.currentTarget,e,s.onChange)}})),L&&f.createElement("div",{className:q,style:{width:u}},r),M&&f.createElement("div",{className:F,style:{width:c}},T)),W&&(Array.isArray(d)?d.map((function(e){return f.createElement("div",{className:C,key:e,"data-qaid":"inputFieldError","data-testid":"inputFieldError"},e)})):!0===d?null:f.createElement("div",{className:C,"data-qaid":"inputFieldError","data-testid":"inputFieldError"},d)))}));exports.InputField=j,require("./style.production.v2.css");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.InputField__root___UnXum{position:relative}.InputField__input___1Wl0O[type=search]::-ms-clear,.InputField__input___1Wl0O[type=search]::-ms-reveal{display:none;width:0;height:0}.InputField__input___1Wl0O[type=search]::-webkit-search-decoration,.InputField__input___1Wl0O[type=search]::-webkit-search-cancel-button,.InputField__input___1Wl0O[type=search]::-webkit-search-results-button,.InputField__input___1Wl0O[type=search]::-webkit-search-results-decoration{-webkit-appearance:none;appearance:none;display:none}.InputField__beforeAndAfter___cUXq3{position:absolute;top:0;height:100%;display:flex;align-items:center;justify-content:center}.InputField__before___-TbcG{left:0}.InputField__after___QmiGS{right:0}.InputField__error___7Fcq2{margin-top:var(--pds-spacing-xxs);color:var(--red-900)}.InputField__error___7Fcq2+.InputField__error___7Fcq2{margin-top:calc(var(--pds-spacing-xxs)/2)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.InputField__root___EVTeN{position:relative}.InputField__input___rfpBC[type=search]::-ms-clear,.InputField__input___rfpBC[type=search]::-ms-reveal{display:none;width:0;height:0}.InputField__input___rfpBC[type=search]::-webkit-search-decoration,.InputField__input___rfpBC[type=search]::-webkit-search-cancel-button,.InputField__input___rfpBC[type=search]::-webkit-search-results-button,.InputField__input___rfpBC[type=search]::-webkit-search-results-decoration{-webkit-appearance:none;appearance:none;display:none}.InputField__beforeAndAfter___oqO-V{position:absolute;top:0;height:100%;display:flex;align-items:center;justify-content:center}.InputField__before___GeS6-{left:0}.InputField__after___Cl38-{right:0}.InputField__error___hSs8w{margin-top:var(--pds-spacing-xxs);color:var(--red-900)}.InputField__error___hSs8w+.InputField__error___hSs8w{margin-top:calc(var(--pds-spacing-xxs)/2)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.UnXum{position:relative}._1Wl0O[type=search]::-ms-clear,._1Wl0O[type=search]::-ms-reveal{display:none;width:0;height:0}._1Wl0O[type=search]::-webkit-search-decoration,._1Wl0O[type=search]::-webkit-search-cancel-button,._1Wl0O[type=search]::-webkit-search-results-button,._1Wl0O[type=search]::-webkit-search-results-decoration{-webkit-appearance:none;appearance:none;display:none}.cUXq3{position:absolute;top:0;height:100%;display:flex;align-items:center;justify-content:center}.-TbcG{left:0}.QmiGS{right:0}._7Fcq2{margin-top:var(--pds-spacing-xxs);color:var(--red-900)}._7Fcq2+._7Fcq2{margin-top:calc(var(--pds-spacing-xxs)/2)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.EVTeN{position:relative}.rfpBC[type=search]::-ms-clear,.rfpBC[type=search]::-ms-reveal{display:none;width:0;height:0}.rfpBC[type=search]::-webkit-search-decoration,.rfpBC[type=search]::-webkit-search-cancel-button,.rfpBC[type=search]::-webkit-search-results-button,.rfpBC[type=search]::-webkit-search-results-decoration{-webkit-appearance:none;appearance:none;display:none}.oqO-V{position:absolute;top:0;height:100%;display:flex;align-items:center;justify-content:center}.GeS6-{left:0}.Cl38-{right:0}.hSs8w{margin-top:var(--pds-spacing-xxs);color:var(--red-900)}.hSs8w+.hSs8w{margin-top:calc(var(--pds-spacing-xxs)/2)}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare type InputFieldProps = React.ComponentPropsWithRef<"input"> & {
|
|
3
|
+
/** Дополнение слева */
|
|
4
|
+
addonBefore?: React.ReactNode;
|
|
5
|
+
/** Дополнение справа */
|
|
6
|
+
addonAfter?: ('togglePassword' | 'clearValue' | 'correctValue' | 'loading') & React.ReactNode;
|
|
7
|
+
addonBeforeWidth?: string | number;
|
|
8
|
+
addonAfterWidth?: string | number;
|
|
9
|
+
/** Ошибка */
|
|
10
|
+
error?: boolean | string | string[];
|
|
11
|
+
};
|
|
12
|
+
export declare const InputField: React.ForwardRefExoticComponent<Pick<InputFieldProps, "key" | keyof React.InputHTMLAttributes<HTMLInputElement> | "addonBefore" | "addonAfter" | "addonBeforeWidth" | "addonAfterWidth" | "error"> & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare function resolveOnChange<E extends HTMLInputElement | HTMLTextAreaElement>(target: E, e: React.ChangeEvent<E> | React.MouseEvent<HTMLElement, MouseEvent> | React.CompositionEvent<HTMLElement>, onChange?: (event: React.ChangeEvent<E>) => void, targetValue?: string): void;
|
|
3
|
+
export declare function valueToString<T>(value?: T): string;
|
|
4
|
+
export declare function isNotEmptyArray<T>(arr?: T | T[]): boolean;
|
|
5
|
+
export declare function getIsValueEmpty<T>(value: T): boolean;
|
|
6
|
+
export declare const useForwardRef: <T>(ref: React.ForwardedRef<T>, initialValue?: any) => React.MutableRefObject<T>;
|
package/KeyPress/package.json
CHANGED
package/Line/package.json
CHANGED
package/Link/package.json
CHANGED
package/List/package.json
CHANGED
package/Media/package.json
CHANGED
package/Overlay/package.json
CHANGED
package/Picture/package.json
CHANGED
package/Portal/package.json
CHANGED
package/QRCode/package.json
CHANGED
package/Rating/package.json
CHANGED
package/SafeQuery/package.json
CHANGED
package/Scroll/package.json
CHANGED