@alphakits/ui 2.5.7 → 2.5.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/amount/component.js +39 -39
- package/dist/amount-input/component.js +146 -110
- package/dist/amount-input/index.css +1 -1
- package/dist/amount-input/index.module.css.js +16 -10
- package/dist/amount-input/utils/index.d.ts +13 -2
- package/dist/amount-input/utils/index.js +93 -15
- package/dist/calendar/components/days-table/index.css +1 -1
- package/dist/calendar/components/header/index.css +1 -1
- package/dist/calendar/components/months-table/index.css +1 -1
- package/dist/calendar/components/select-button/index.css +1 -1
- package/dist/calendar/components/years-table/index.css +1 -1
- package/dist/calendar/index.css +1 -1
- package/dist/calendar-input/index.css +1 -1
- package/dist/form/templates/base-form/index.js +8 -8
- package/dist/form/templates/filters-form/index.js +13 -13
- package/dist/form/templates/rest-form/form.js +28 -28
- package/dist/form/templates/rest-form/index.js +12 -12
- package/dist/form-control/component.d.ts +8 -0
- package/dist/form-control/component.js +49 -28
- package/dist/index.js +43 -42
- package/dist/input/component.d.ts +4 -0
- package/dist/input/component.js +159 -105
- package/dist/input/index.css +1 -1
- package/dist/input/index.module.css.js +16 -8
- package/dist/input/utils/get-default-input-mode.d.ts +3 -0
- package/dist/input/utils/get-default-input-mode.js +14 -0
- package/dist/input-autocomplete/component.d.ts +4 -0
- package/dist/masked-input/component.d.ts +2 -0
- package/dist/select/component.d.ts +4 -0
- package/dist/select/components/arrow/index.css +1 -1
- package/dist/select/components/checkmark/index.css +1 -1
- package/dist/select/components/field/index.css +1 -1
- package/dist/select/components/optgroup/index.css +1 -1
- package/dist/select/components/option/index.css +1 -1
- package/dist/select/components/options-list/index.css +1 -1
- package/dist/select/components/virtual-options-list/index.css +1 -1
- package/dist/toast/component.d.ts +1 -1
- package/dist/utils/format-amount/util.d.ts +1 -0
- package/dist/utils/format-amount/util.js +31 -26
- package/dist/utils/index.js +33 -32
- package/dist/with-suffix/component.d.ts +2 -0
- package/package.json +3 -2
|
@@ -1,70 +1,91 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as c, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import e from "classnames";
|
|
3
|
-
import
|
|
3
|
+
import I from "react";
|
|
4
4
|
import s from "./index.module.css.js";
|
|
5
|
-
const
|
|
5
|
+
const z = I.forwardRef(
|
|
6
6
|
({
|
|
7
7
|
block: m = !1,
|
|
8
|
-
size:
|
|
9
|
-
className:
|
|
8
|
+
size: h = "s",
|
|
9
|
+
className: p,
|
|
10
10
|
required: f,
|
|
11
11
|
fieldClassName: N,
|
|
12
12
|
labelClassName: u,
|
|
13
13
|
addonsClassName: o,
|
|
14
|
-
disabled:
|
|
15
|
-
focused:
|
|
14
|
+
disabled: b,
|
|
15
|
+
focused: v,
|
|
16
16
|
filled: x,
|
|
17
17
|
error: r,
|
|
18
18
|
hint: t,
|
|
19
19
|
label: i,
|
|
20
|
-
leftAddons:
|
|
21
|
-
rightAddons:
|
|
20
|
+
leftAddons: d,
|
|
21
|
+
rightAddons: l,
|
|
22
22
|
bottomAddons: R,
|
|
23
23
|
children: g,
|
|
24
24
|
dataTestId: j,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
inputId: y,
|
|
26
|
+
labelId: F,
|
|
27
|
+
hintId: L,
|
|
28
|
+
errorId: k,
|
|
29
|
+
...w
|
|
30
|
+
}, E) => {
|
|
31
|
+
const n = typeof r == "string" ? r : "";
|
|
32
|
+
return /* @__PURE__ */ c(
|
|
29
33
|
"div",
|
|
30
34
|
{
|
|
31
35
|
"data-test-id": j,
|
|
32
|
-
className: e(s.component,
|
|
36
|
+
className: e(s.component, p, s[h], {
|
|
33
37
|
[s.block]: m,
|
|
34
|
-
[s.hasLeftAddons]:
|
|
35
|
-
[s.hasRightAddons]:
|
|
38
|
+
[s.hasLeftAddons]: d,
|
|
39
|
+
[s.hasRightAddons]: l || r
|
|
36
40
|
}),
|
|
37
41
|
children: [
|
|
38
|
-
/* @__PURE__ */
|
|
42
|
+
/* @__PURE__ */ c(
|
|
39
43
|
"div",
|
|
40
44
|
{
|
|
41
|
-
...
|
|
45
|
+
...w,
|
|
42
46
|
className: e(N, s.inner, {
|
|
43
|
-
[s.focused]:
|
|
44
|
-
[s.disabled]:
|
|
47
|
+
[s.focused]: v,
|
|
48
|
+
[s.disabled]: b,
|
|
45
49
|
[s.filled]: x,
|
|
46
50
|
[s.hasError]: r,
|
|
47
51
|
[s.hasLabel]: i
|
|
48
52
|
}),
|
|
49
|
-
ref:
|
|
53
|
+
ref: E,
|
|
50
54
|
children: [
|
|
51
|
-
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
i && /* @__PURE__ */ a(
|
|
55
|
+
d && /* @__PURE__ */ a("div", { className: e(s.addons, s.leftAddons, o), children: d }),
|
|
56
|
+
/* @__PURE__ */ c("div", { className: s.inputWrapper, children: [
|
|
57
|
+
i && /* @__PURE__ */ a(
|
|
58
|
+
"label",
|
|
59
|
+
{
|
|
60
|
+
id: F,
|
|
61
|
+
htmlFor: y,
|
|
62
|
+
className: e(s.label, u),
|
|
63
|
+
children: /* @__PURE__ */ a("span", { className: s.labelInner, children: f ? `${i} *` : i })
|
|
64
|
+
}
|
|
65
|
+
),
|
|
54
66
|
/* @__PURE__ */ a("div", { className: s.input, children: g })
|
|
55
67
|
] }),
|
|
56
|
-
|
|
68
|
+
l && /* @__PURE__ */ a("div", { className: e(s.addons, s.rightAddons, o), children: l })
|
|
57
69
|
]
|
|
58
70
|
}
|
|
59
71
|
),
|
|
60
72
|
R,
|
|
61
|
-
|
|
62
|
-
|
|
73
|
+
n && /* @__PURE__ */ a(
|
|
74
|
+
"span",
|
|
75
|
+
{
|
|
76
|
+
id: k,
|
|
77
|
+
role: "alert",
|
|
78
|
+
"data-attribute": "form-error",
|
|
79
|
+
className: e(s.sub, s.error),
|
|
80
|
+
children: n
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
t && !n && /* @__PURE__ */ a("span", { id: L, className: e(s.sub, s.hint), children: t })
|
|
63
84
|
]
|
|
64
85
|
}
|
|
65
86
|
);
|
|
66
87
|
}
|
|
67
88
|
);
|
|
68
89
|
export {
|
|
69
|
-
|
|
90
|
+
z as FormControl
|
|
70
91
|
};
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import { ButtonArrow as C } from "./button-arrow/component.js";
|
|
|
11
11
|
import { Calendar as k } from "./calendar/component.js";
|
|
12
12
|
import { useCalendar as M } from "./calendar/use-calendar.js";
|
|
13
13
|
import { usePeriod as P } from "./calendar/use-period.js";
|
|
14
|
-
import { DAYS_IN_WEEK as F, MONTHS_IN_YEAR as R, SUNDAY_INDEX as
|
|
14
|
+
import { DAYS_IN_WEEK as F, MONTHS_IN_YEAR as R, SUNDAY_INDEX as y, dateInLimits as B, limitDate as L, monthName as b, russianWeekDay as w } from "./calendar/utils.js";
|
|
15
15
|
import { CalendarInput as N } from "./calendar-input/component.js";
|
|
16
16
|
import { DATE_FORMAT as v, DATE_MASK as G, IS_BROWSER as H, NATIVE_DATE_FORMAT as U, SUPPORTS_INPUT_TYPE_DATE as q, isCompleteDateInput as z, isInputDateSupported as K, parseDateString as V } from "./calendar-input/utils.js";
|
|
17
17
|
import { Card as J } from "./card/component.js";
|
|
@@ -31,8 +31,8 @@ import { Dot as ko } from "./dot/component.js";
|
|
|
31
31
|
import { EmptyPage as Mo } from "./empty-page/component.js";
|
|
32
32
|
import { FilterTag as Po } from "./filter-tag/component.js";
|
|
33
33
|
import { Flex as Fo } from "./flex/component.js";
|
|
34
|
-
import { FlexColumns as
|
|
35
|
-
import { Footer as
|
|
34
|
+
import { FlexColumns as yo } from "./flex-columns/component.js";
|
|
35
|
+
import { Footer as Lo } from "./footer/component.js";
|
|
36
36
|
import { FiltersForm as wo } from "./form/templates/filters-form/index.js";
|
|
37
37
|
import { FormControl as No } from "./form-control/component.js";
|
|
38
38
|
import { ErrorMessage as vo, FastField as Go, Field as Ho, FieldArray as Uo, Form as qo, Formik as zo, connect as Ko, useField as Vo, useFormik as jo, useFormikContext as Jo, withFormik as Xo } from "formik";
|
|
@@ -52,8 +52,8 @@ import { InfoBlockHeader as kr } from "./info-block-header/component.js";
|
|
|
52
52
|
import { InfoBlockItem as Mr } from "./info-block-item/component.js";
|
|
53
53
|
import { InfoBlockWrapper as Pr } from "./info-block-wrapper/component.js";
|
|
54
54
|
import { Input as Fr } from "./input/component.js";
|
|
55
|
-
import { InputAutocomplete as
|
|
56
|
-
import { InputGhost as
|
|
55
|
+
import { InputAutocomplete as yr } from "./input-autocomplete/component.js";
|
|
56
|
+
import { InputGhost as Lr } from "./input-ghost/component.js";
|
|
57
57
|
import { Link as wr } from "./link/component.js";
|
|
58
58
|
import { ListAllert as Nr } from "./list-allert/component.js";
|
|
59
59
|
import { Loader as vr } from "./loader/component.js";
|
|
@@ -78,8 +78,8 @@ import { Radio as ke } from "./radio/component.js";
|
|
|
78
78
|
import { RadioGroup as Me } from "./radio-group/component.js";
|
|
79
79
|
import { RadioGroups as Pe } from "./radio-groups/component.js";
|
|
80
80
|
import { SectionWrapper as Fe } from "./section-wrapper/component.js";
|
|
81
|
-
import { Select as
|
|
82
|
-
import { Arrow as
|
|
81
|
+
import { Select as ye } from "./select/component.js";
|
|
82
|
+
import { Arrow as Le } from "./select/components/arrow/component.js";
|
|
83
83
|
import { BaseSelect as we } from "./select/components/base-select/component.js";
|
|
84
84
|
import { SelectField as Ne } from "./select/components/field/component.js";
|
|
85
85
|
import { Optgroup as ve } from "./select/components/optgroup/component.js";
|
|
@@ -101,8 +101,8 @@ import { SteppedProgressBar as Dt, useSteps as kt } from "./stepped-progress-bar
|
|
|
101
101
|
import { Sticker as Mt } from "./sticker/component.js";
|
|
102
102
|
import { SuffixInput as Pt } from "./suffix-input/component.js";
|
|
103
103
|
import { SuperListHeader as Ft } from "./super-list-header/component.js";
|
|
104
|
-
import { SuperListItem as
|
|
105
|
-
import { Switch as
|
|
104
|
+
import { SuperListItem as yt } from "./super-list-item/component.js";
|
|
105
|
+
import { Switch as Lt } from "./switch/component.js";
|
|
106
106
|
import { Table as wt } from "./table/component.js";
|
|
107
107
|
import { TableCell as Nt } from "./table/components/cell/component.js";
|
|
108
108
|
import { TableStatus as vt } from "./table-status/component.js";
|
|
@@ -116,21 +116,21 @@ import { ToastNotifier as mp } from "./toast-notifier/component.js";
|
|
|
116
116
|
import { ToastPlate as ap } from "./toast-plate/component.js";
|
|
117
117
|
import { Tooltip as sp } from "./tooltip/component.js";
|
|
118
118
|
import { Typography as np } from "./typography/component.js";
|
|
119
|
-
import { add as lp, addDays as dp, addMonths as Sp, addYears as cp, eachDayOfInterval as Tp, eachMonthOfInterval as Op, eachYearOfInterval as hp, endOfDay as Ip, endOfISOWeek as Ap, endOfWeek as Cp, endOfYear as Dp, format as kp, isAfter as Ep, isBefore as Mp, isEqual as gp, isLastDayOfMonth as Pp, isSameDay as _p, isSameMonth as Fp, isSameYear as Rp, isThisMonth as
|
|
119
|
+
import { add as lp, addDays as dp, addMonths as Sp, addYears as cp, eachDayOfInterval as Tp, eachMonthOfInterval as Op, eachYearOfInterval as hp, endOfDay as Ip, endOfISOWeek as Ap, endOfWeek as Cp, endOfYear as Dp, format as kp, isAfter as Ep, isBefore as Mp, isEqual as gp, isLastDayOfMonth as Pp, isSameDay as _p, isSameMonth as Fp, isSameYear as Rp, isThisMonth as yp, isThisYear as Bp, isToday as Lp, isWithinInterval as bp, lastDayOfMonth as wp, max as Wp, min as Np, parse as Yp, parseISO as vp, startOfDay as Gp, startOfISOWeek as Hp, startOfMonth as Up, startOfWeek as qp, startOfYear as zp, subDays as Kp, subMonths as Vp, subWeeks as jp, subYears as Jp, weekDaysShort as Xp } from "./utils/date/index.js";
|
|
120
120
|
import { debounce as Zp } from "./utils/debounce.js";
|
|
121
|
-
import { AMOUNT_MAJOR_MINOR_PARTS_SEPARATOR as om, THINSP as rm, formatAmount as em } from "./utils/format-amount/util.js";
|
|
122
|
-
import { formatDate as
|
|
123
|
-
import { safeStringify as
|
|
124
|
-
import { showCompactSuccess as
|
|
125
|
-
import { splitAmount as
|
|
126
|
-
import { capitalize as
|
|
127
|
-
import { WelcomeContainer as
|
|
128
|
-
import { withSuffix as
|
|
121
|
+
import { AMOUNT_MAJOR_MINOR_PARTS_SEPARATOR as om, THINSP as rm, formatAmount as em, isCurrencyFirst as tm } from "./utils/format-amount/util.js";
|
|
122
|
+
import { formatDate as mm, locales as fm } from "./utils/format-date/index.js";
|
|
123
|
+
import { safeStringify as xm } from "./utils/safe-stringify.js";
|
|
124
|
+
import { showCompactSuccess as im, showError as nm, showSuccess as um } from "./utils/show-toast/index.js";
|
|
125
|
+
import { splitAmount as dm } from "./utils/split-amount/util.js";
|
|
126
|
+
import { capitalize as cm } from "./utils/string.js";
|
|
127
|
+
import { WelcomeContainer as Om } from "./welcome-layout/component.js";
|
|
128
|
+
import { withSuffix as Im } from "./with-suffix/component.js";
|
|
129
129
|
export {
|
|
130
130
|
om as AMOUNT_MAJOR_MINOR_PARTS_SEPARATOR,
|
|
131
131
|
e as Amount,
|
|
132
132
|
p as AmountInput,
|
|
133
|
-
|
|
133
|
+
Le as Arrow,
|
|
134
134
|
f as Avatar,
|
|
135
135
|
x as BackButton,
|
|
136
136
|
i as Badge,
|
|
@@ -167,8 +167,8 @@ export {
|
|
|
167
167
|
Po as FilterTag,
|
|
168
168
|
wo as FiltersForm,
|
|
169
169
|
Fo as Flex,
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
yo as FlexColumns,
|
|
171
|
+
Lo as Footer,
|
|
172
172
|
qo as Form,
|
|
173
173
|
No as FormControl,
|
|
174
174
|
co as FormattedDate,
|
|
@@ -184,8 +184,8 @@ export {
|
|
|
184
184
|
Mr as InfoBlockItem,
|
|
185
185
|
Pr as InfoBlockWrapper,
|
|
186
186
|
Fr as Input,
|
|
187
|
-
|
|
188
|
-
|
|
187
|
+
yr as InputAutocomplete,
|
|
188
|
+
Lr as InputGhost,
|
|
189
189
|
jt as LOACAL_STORAGE_THEME_KEY,
|
|
190
190
|
ue as LabeledButton,
|
|
191
191
|
wr as Link,
|
|
@@ -219,10 +219,10 @@ export {
|
|
|
219
219
|
T as Radiuses,
|
|
220
220
|
or as Row,
|
|
221
221
|
Jt as STYLE_TAG_ID,
|
|
222
|
-
|
|
222
|
+
y as SUNDAY_INDEX,
|
|
223
223
|
q as SUPPORTS_INPUT_TYPE_DATE,
|
|
224
224
|
Fe as SectionWrapper,
|
|
225
|
-
|
|
225
|
+
ye as Select,
|
|
226
226
|
Ne as SelectField,
|
|
227
227
|
ft as Sidepanel,
|
|
228
228
|
xt as SidepanelHeader,
|
|
@@ -237,8 +237,8 @@ export {
|
|
|
237
237
|
Mt as Sticker,
|
|
238
238
|
Pt as SuffixInput,
|
|
239
239
|
Ft as SuperListHeader,
|
|
240
|
-
|
|
241
|
-
|
|
240
|
+
yt as SuperListItem,
|
|
241
|
+
Lt as Switch,
|
|
242
242
|
Xt as THEME,
|
|
243
243
|
Qt as THEME_DATA_ATTR,
|
|
244
244
|
rm as THINSP,
|
|
@@ -255,15 +255,15 @@ export {
|
|
|
255
255
|
sp as Tooltip,
|
|
256
256
|
np as Typography,
|
|
257
257
|
Ke as VirtualOptionsList,
|
|
258
|
-
|
|
258
|
+
Om as WelcomeContainer,
|
|
259
259
|
lp as add,
|
|
260
260
|
dp as addDays,
|
|
261
261
|
Sp as addMonths,
|
|
262
262
|
cp as addYears,
|
|
263
|
-
|
|
263
|
+
cm as capitalize,
|
|
264
264
|
Ko as connect,
|
|
265
265
|
Ze as convertToOptions,
|
|
266
|
-
|
|
266
|
+
B as dateInLimits,
|
|
267
267
|
Zp as debounce,
|
|
268
268
|
rp as defaultThemes,
|
|
269
269
|
Tp as eachDayOfInterval,
|
|
@@ -275,10 +275,11 @@ export {
|
|
|
275
275
|
Dp as endOfYear,
|
|
276
276
|
kp as format,
|
|
277
277
|
em as formatAmount,
|
|
278
|
-
|
|
278
|
+
mm as formatDate,
|
|
279
279
|
Ep as isAfter,
|
|
280
280
|
Mp as isBefore,
|
|
281
281
|
z as isCompleteDateInput,
|
|
282
|
+
tm as isCurrencyFirst,
|
|
282
283
|
gp as isEqual,
|
|
283
284
|
$e as isGroup,
|
|
284
285
|
K as isInputDateSupported,
|
|
@@ -287,15 +288,15 @@ export {
|
|
|
287
288
|
_p as isSameDay,
|
|
288
289
|
Fp as isSameMonth,
|
|
289
290
|
Rp as isSameYear,
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
291
|
+
yp as isThisMonth,
|
|
292
|
+
Bp as isThisYear,
|
|
293
|
+
Lp as isToday,
|
|
293
294
|
bp as isWithinInterval,
|
|
294
295
|
rt as joinOptions,
|
|
295
296
|
wp as lastDayOfMonth,
|
|
296
297
|
et as lastIndexOf,
|
|
297
|
-
|
|
298
|
-
|
|
298
|
+
L as limitDate,
|
|
299
|
+
fm as locales,
|
|
299
300
|
Wp as max,
|
|
300
301
|
Np as min,
|
|
301
302
|
b as monthName,
|
|
@@ -304,13 +305,13 @@ export {
|
|
|
304
305
|
vp as parseISO,
|
|
305
306
|
tt as processOptions,
|
|
306
307
|
w as russianWeekDay,
|
|
307
|
-
|
|
308
|
+
xm as safeStringify,
|
|
308
309
|
io as showAlert,
|
|
309
|
-
|
|
310
|
+
im as showCompactSuccess,
|
|
310
311
|
no as showConfirm,
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
312
|
+
nm as showError,
|
|
313
|
+
um as showSuccess,
|
|
314
|
+
dm as splitAmount,
|
|
314
315
|
ht as stackingOrder,
|
|
315
316
|
Gp as startOfDay,
|
|
316
317
|
Hp as startOfISOWeek,
|
|
@@ -340,5 +341,5 @@ export {
|
|
|
340
341
|
pt as useVisibleOptions,
|
|
341
342
|
Xp as weekDaysShort,
|
|
342
343
|
Xo as withFormik,
|
|
343
|
-
|
|
344
|
+
Im as withSuffix
|
|
344
345
|
};
|
|
@@ -9,8 +9,10 @@ export type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 't
|
|
|
9
9
|
error?: string | boolean;
|
|
10
10
|
success?: boolean;
|
|
11
11
|
hint?: string;
|
|
12
|
+
showCount?: boolean;
|
|
12
13
|
label?: React.ReactNode;
|
|
13
14
|
type?: 'number' | 'card' | 'email' | 'money' | 'password' | 'tel' | 'text';
|
|
15
|
+
passwordReveal?: boolean;
|
|
14
16
|
wrapperRef?: React.Ref<HTMLDivElement>;
|
|
15
17
|
leftAddons?: React.ReactNode;
|
|
16
18
|
rightAddons?: React.ReactNode;
|
|
@@ -41,8 +43,10 @@ export declare const Input: React.ForwardRefExoticComponent<Omit<React.InputHTML
|
|
|
41
43
|
error?: string | boolean | undefined;
|
|
42
44
|
success?: boolean | undefined;
|
|
43
45
|
hint?: string | undefined;
|
|
46
|
+
showCount?: boolean | undefined;
|
|
44
47
|
label?: React.ReactNode;
|
|
45
48
|
type?: "number" | "text" | "tel" | "email" | "card" | "money" | "password" | undefined;
|
|
49
|
+
passwordReveal?: boolean | undefined;
|
|
46
50
|
wrapperRef?: React.Ref<HTMLDivElement> | undefined;
|
|
47
51
|
leftAddons?: React.ReactNode;
|
|
48
52
|
rightAddons?: React.ReactNode;
|
package/dist/input/component.js
CHANGED
|
@@ -1,132 +1,186 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as o, jsxs as Ne } from "react/jsx-runtime";
|
|
2
2
|
import I from "classnames";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
3
|
+
import Be from "@alphakits/icons/dist/CancelM";
|
|
4
|
+
import $e from "@alphakits/icons/dist/AlertCircleM";
|
|
5
|
+
import ke from "@alphakits/icons/dist/CheckmarkCircleM";
|
|
6
|
+
import ye from "@alphakits/icons/dist/EyeM";
|
|
7
|
+
import Fe, { useRef as xe, useId as je, useState as k, useMemo as He, useCallback as u, Fragment as Pe } from "react";
|
|
8
|
+
import Te from "react-merge-refs";
|
|
9
|
+
import { Button as E } from "../button/component.js";
|
|
10
|
+
import { FormControl as Ae } from "../form-control/component.js";
|
|
11
|
+
import { useFocus as Ce } from "../hooks/useFocus/index.js";
|
|
8
12
|
import s from "./index.module.css.js";
|
|
9
|
-
|
|
13
|
+
import { getDefaultInputMode as Se } from "./utils/get-default-input-mode.js";
|
|
14
|
+
const Ze = Fe.forwardRef(
|
|
10
15
|
({
|
|
11
|
-
size:
|
|
12
|
-
type:
|
|
13
|
-
block:
|
|
14
|
-
bottomAddons:
|
|
15
|
-
dataTestId:
|
|
16
|
-
clear:
|
|
17
|
-
disabled:
|
|
18
|
-
error:
|
|
19
|
-
success:
|
|
20
|
-
required:
|
|
21
|
-
hint:
|
|
16
|
+
size: q = "m",
|
|
17
|
+
type: b = "text",
|
|
18
|
+
block: z = !1,
|
|
19
|
+
bottomAddons: G,
|
|
20
|
+
dataTestId: J,
|
|
21
|
+
clear: K = !1,
|
|
22
|
+
disabled: a,
|
|
23
|
+
error: t,
|
|
24
|
+
success: y,
|
|
25
|
+
required: F,
|
|
26
|
+
hint: i,
|
|
27
|
+
showCount: f = !1,
|
|
22
28
|
className: L,
|
|
23
|
-
fieldClassName:
|
|
24
|
-
inputClassName:
|
|
25
|
-
labelClassName:
|
|
26
|
-
addonsClassName:
|
|
27
|
-
focusedClassName:
|
|
28
|
-
filledClassName:
|
|
29
|
-
label:
|
|
30
|
-
maxLength:
|
|
31
|
-
leftAddons:
|
|
32
|
-
onFocus:
|
|
33
|
-
onBlur:
|
|
34
|
-
onChange:
|
|
35
|
-
onClear:
|
|
36
|
-
onClick:
|
|
37
|
-
onMouseDown:
|
|
38
|
-
onMouseUp:
|
|
39
|
-
rightAddons:
|
|
40
|
-
value:
|
|
41
|
-
defaultValue:
|
|
42
|
-
wrapperRef:
|
|
43
|
-
readOnly:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
29
|
+
fieldClassName: Q,
|
|
30
|
+
inputClassName: U,
|
|
31
|
+
labelClassName: W,
|
|
32
|
+
addonsClassName: X,
|
|
33
|
+
focusedClassName: Y,
|
|
34
|
+
filledClassName: Z,
|
|
35
|
+
label: m,
|
|
36
|
+
maxLength: x = 100,
|
|
37
|
+
leftAddons: _,
|
|
38
|
+
onFocus: g,
|
|
39
|
+
onBlur: R,
|
|
40
|
+
onChange: r,
|
|
41
|
+
onClear: V,
|
|
42
|
+
onClick: O,
|
|
43
|
+
onMouseDown: ee,
|
|
44
|
+
onMouseUp: te,
|
|
45
|
+
rightAddons: j,
|
|
46
|
+
value: H,
|
|
47
|
+
defaultValue: se,
|
|
48
|
+
wrapperRef: oe,
|
|
49
|
+
readOnly: c,
|
|
50
|
+
passwordReveal: ae = !0,
|
|
51
|
+
inputMode: ie,
|
|
52
|
+
enterKeyHint: re,
|
|
53
|
+
id: ne,
|
|
54
|
+
...ce
|
|
55
|
+
}, le) => {
|
|
56
|
+
const l = H === void 0, n = xe(null), de = je(), [ue] = Ce(n, "keyboard"), [h, P] = k(!1), [fe, T] = k(se || ""), [p, me] = k(!1), d = ne ?? de, A = m ? `${d}-label` : void 0, w = i || f ? `${d}-hint` : void 0, M = t && typeof t == "string" ? `${d}-error` : void 0, N = l ? fe : H ?? "", B = !!N, C = typeof t == "string" ? t : "", pe = He(
|
|
57
|
+
() => [C ? M : null, i || f ? w : null].filter(Boolean).join(" ") || void 0,
|
|
58
|
+
[C, M, i, f, w]
|
|
59
|
+
), $ = f ? `${N.length}/${x}` : "", ve = i && $ ? `${i} · ${$}` : $ || i, S = b === "password", D = S && ae && !a && !c, Ie = S && p ? "text" : b, be = ie ?? Se(b), v = K && B && !a && !c, ge = u(
|
|
60
|
+
(e) => {
|
|
61
|
+
c || P(!0), g && g(e);
|
|
49
62
|
},
|
|
50
|
-
[
|
|
51
|
-
),
|
|
52
|
-
(
|
|
53
|
-
|
|
63
|
+
[g, c]
|
|
64
|
+
), Re = u(
|
|
65
|
+
(e) => {
|
|
66
|
+
P(!1), R && R(e);
|
|
54
67
|
},
|
|
55
|
-
[
|
|
56
|
-
),
|
|
57
|
-
(
|
|
58
|
-
|
|
68
|
+
[R]
|
|
69
|
+
), Ve = u(
|
|
70
|
+
(e) => {
|
|
71
|
+
r && r(e, { value: e.target.value }), l && T(e.target.value);
|
|
59
72
|
},
|
|
60
|
-
[
|
|
61
|
-
),
|
|
62
|
-
(
|
|
63
|
-
|
|
73
|
+
[r, l]
|
|
74
|
+
), he = u(
|
|
75
|
+
(e) => {
|
|
76
|
+
v && (l && T(""), r && r(
|
|
77
|
+
{
|
|
78
|
+
...e,
|
|
79
|
+
target: n.current,
|
|
80
|
+
currentTarget: n.current
|
|
81
|
+
},
|
|
82
|
+
{ value: "" }
|
|
83
|
+
), V && V(e), n.current?.focus());
|
|
64
84
|
},
|
|
65
|
-
[
|
|
66
|
-
),
|
|
67
|
-
|
|
68
|
-
|
|
85
|
+
[v, r, V, l]
|
|
86
|
+
), we = u(() => {
|
|
87
|
+
me((e) => !e), n.current?.focus();
|
|
88
|
+
}, []), Me = () => (v || j || y || t || D) && /* @__PURE__ */ Ne(Pe, { children: [
|
|
89
|
+
v && /* @__PURE__ */ o(
|
|
90
|
+
E,
|
|
69
91
|
{
|
|
70
92
|
type: "button",
|
|
71
93
|
view: "ghost",
|
|
72
|
-
disabled:
|
|
94
|
+
disabled: a,
|
|
73
95
|
"aria-label": "Очистить",
|
|
74
96
|
className: s.clearButton,
|
|
75
|
-
onClick:
|
|
76
|
-
children: /* @__PURE__ */
|
|
97
|
+
onClick: he,
|
|
98
|
+
children: /* @__PURE__ */ o(Be, { className: s.clearIcon, "aria-hidden": "true" })
|
|
99
|
+
}
|
|
100
|
+
),
|
|
101
|
+
D && /* @__PURE__ */ o(
|
|
102
|
+
E,
|
|
103
|
+
{
|
|
104
|
+
type: "button",
|
|
105
|
+
view: "ghost",
|
|
106
|
+
disabled: a,
|
|
107
|
+
"aria-label": p ? "Скрыть пароль" : "Показать пароль",
|
|
108
|
+
"aria-pressed": p,
|
|
109
|
+
className: s.passwordRevealButton,
|
|
110
|
+
onClick: we,
|
|
111
|
+
children: /* @__PURE__ */ o(
|
|
112
|
+
ye,
|
|
113
|
+
{
|
|
114
|
+
className: I(s.passwordRevealIcon, {
|
|
115
|
+
[s.passwordRevealIconHidden]: p
|
|
116
|
+
}),
|
|
117
|
+
"aria-hidden": "true"
|
|
118
|
+
}
|
|
119
|
+
)
|
|
77
120
|
}
|
|
78
121
|
),
|
|
79
|
-
|
|
80
|
-
|
|
122
|
+
t && /* @__PURE__ */ o($e, { className: s.errorIcon, "aria-hidden": "true" }),
|
|
123
|
+
y && !t && /* @__PURE__ */ o(ke, { className: s.successIcon, "aria-hidden": "true" }),
|
|
124
|
+
j
|
|
81
125
|
] });
|
|
82
|
-
return /* @__PURE__ */
|
|
83
|
-
|
|
126
|
+
return /* @__PURE__ */ o(
|
|
127
|
+
Ae,
|
|
84
128
|
{
|
|
85
|
-
ref:
|
|
86
|
-
className: I(L,
|
|
87
|
-
fieldClassName: I(
|
|
88
|
-
[s.focusVisible]:
|
|
129
|
+
ref: oe,
|
|
130
|
+
className: I(L, h && Y, B && Z),
|
|
131
|
+
fieldClassName: I(Q, {
|
|
132
|
+
[s.focusVisible]: ue
|
|
89
133
|
}),
|
|
90
|
-
labelClassName:
|
|
91
|
-
addonsClassName:
|
|
92
|
-
size:
|
|
93
|
-
block:
|
|
94
|
-
required:
|
|
95
|
-
disabled:
|
|
96
|
-
filled:
|
|
97
|
-
focused:
|
|
98
|
-
error:
|
|
99
|
-
label:
|
|
100
|
-
hint:
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
134
|
+
labelClassName: W,
|
|
135
|
+
addonsClassName: X,
|
|
136
|
+
size: q,
|
|
137
|
+
block: z,
|
|
138
|
+
required: F,
|
|
139
|
+
disabled: a,
|
|
140
|
+
filled: B || h,
|
|
141
|
+
focused: h,
|
|
142
|
+
error: t,
|
|
143
|
+
label: m,
|
|
144
|
+
hint: ve,
|
|
145
|
+
inputId: d,
|
|
146
|
+
labelId: A,
|
|
147
|
+
hintId: w,
|
|
148
|
+
errorId: M,
|
|
149
|
+
leftAddons: _,
|
|
150
|
+
rightAddons: Me(),
|
|
151
|
+
bottomAddons: G,
|
|
152
|
+
onClick: O,
|
|
153
|
+
onMouseDown: ee,
|
|
154
|
+
onMouseUp: te,
|
|
155
|
+
children: /* @__PURE__ */ o(
|
|
108
156
|
"input",
|
|
109
157
|
{
|
|
110
|
-
...
|
|
158
|
+
...ce,
|
|
159
|
+
id: d,
|
|
111
160
|
className: I(
|
|
112
161
|
s.input,
|
|
113
162
|
{
|
|
114
|
-
[s.hasLabel]:
|
|
163
|
+
[s.hasLabel]: m
|
|
115
164
|
},
|
|
116
|
-
|
|
165
|
+
U
|
|
117
166
|
),
|
|
118
|
-
disabled:
|
|
119
|
-
onBlur:
|
|
120
|
-
onFocus:
|
|
121
|
-
onChange:
|
|
122
|
-
maxLength:
|
|
123
|
-
ref:
|
|
124
|
-
type:
|
|
125
|
-
value:
|
|
126
|
-
readOnly:
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
"
|
|
167
|
+
disabled: a,
|
|
168
|
+
onBlur: Re,
|
|
169
|
+
onFocus: ge,
|
|
170
|
+
onChange: Ve,
|
|
171
|
+
maxLength: x,
|
|
172
|
+
ref: Te([le, n]),
|
|
173
|
+
type: Ie,
|
|
174
|
+
value: N,
|
|
175
|
+
readOnly: c,
|
|
176
|
+
inputMode: be,
|
|
177
|
+
enterKeyHint: re,
|
|
178
|
+
"data-test-id": J,
|
|
179
|
+
"data-error": !!t,
|
|
180
|
+
"aria-invalid": t ? !0 : void 0,
|
|
181
|
+
"aria-required": F || void 0,
|
|
182
|
+
"aria-describedby": pe,
|
|
183
|
+
"aria-labelledby": m ? A : void 0
|
|
130
184
|
}
|
|
131
185
|
)
|
|
132
186
|
}
|
|
@@ -134,5 +188,5 @@ const Vt = st.forwardRef(
|
|
|
134
188
|
}
|
|
135
189
|
);
|
|
136
190
|
export {
|
|
137
|
-
|
|
191
|
+
Ze as Input
|
|
138
192
|
};
|