@prom-ui/core 0.0.110 → 0.0.121

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