mimir-ui-kit 1.19.2 → 1.19.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{Input-DdKAiGfJ.js → Input-C8BYj-Cv.js} +2 -13
- package/dist/assets/TextArea.css +1 -1
- package/dist/components/DatePicker/DatePicker.js +1 -1
- package/dist/components/Input/Input.d.ts +0 -8
- package/dist/components/Input/Input.js +1 -1
- package/dist/components/Input/index.js +1 -1
- package/dist/components/InputPassword/InputPassword.js +1 -1
- package/dist/components/InputPhoneNumber/InputPhoneNumber.js +1 -1
- package/dist/components/OtpInput/OtpInput.js +1 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts +1 -12
- package/dist/components/RadioGroup/RadioGroup.js +6 -10
- package/dist/components/SelectSearch/SelectSearch.js +4 -6
- package/dist/components/SelectSearch/types.d.ts +1 -3
- package/dist/components/Steps/constants.d.ts +5 -0
- package/dist/components/Steps/constants.js +5 -0
- package/dist/components/Switch/Switch.js +18 -11
- package/dist/components/TextArea/TextArea.js +28 -21
- package/dist/components/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{label-C_5Syaoj.js → label-BTEGh6O_.js} +21 -8
- package/package.json +1 -1
@@ -91,8 +91,6 @@ const Input = memo(
|
|
91
91
|
rightAddon,
|
92
92
|
leftAddon,
|
93
93
|
size = "m",
|
94
|
-
numbersOnly,
|
95
|
-
maxLength,
|
96
94
|
...otherProps
|
97
95
|
} = props;
|
98
96
|
const [isFocused, setIsFocused] = useState(autofocus);
|
@@ -130,16 +128,9 @@ const Input = memo(
|
|
130
128
|
}
|
131
129
|
};
|
132
130
|
const handleChange = (event) => {
|
133
|
-
|
134
|
-
|
135
|
-
newValue = newValue.replace(/\D/g, "");
|
136
|
-
}
|
137
|
-
if (maxLength !== void 0) {
|
138
|
-
newValue = newValue.slice(0, maxLength);
|
139
|
-
}
|
140
|
-
event.target.value = newValue;
|
131
|
+
const targetValue = event.target.value;
|
132
|
+
setWithValue(!!targetValue);
|
141
133
|
onChange == null ? void 0 : onChange(event);
|
142
|
-
setWithValue(!!newValue);
|
143
134
|
};
|
144
135
|
const currentLeftAddon = renderAddon(leftAddon);
|
145
136
|
const currentRightAddon = renderAddon(rightAddon);
|
@@ -197,8 +188,6 @@ const Input = memo(
|
|
197
188
|
readOnly: readonly,
|
198
189
|
value,
|
199
190
|
onChange: handleChange,
|
200
|
-
maxLength,
|
201
|
-
disabled: disabled2,
|
202
191
|
...otherProps
|
203
192
|
}
|
204
193
|
),
|
package/dist/assets/TextArea.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
.
|
1
|
+
._textarea-wrapper_1hbfy_2 ._textarea_1hbfy_2{min-height:var(--textarea-height);padding-top:var(--textarea-space)!important;padding-bottom:var(--textarea-space);resize:none}._textarea-wrapper_1hbfy_2 ._textarea_1hbfy_2._has-label_1hbfy_8{padding-top:var(--textarea-top-space)!important}._textarea-wrapper_1hbfy_2 ._label_1hbfy_11{position:absolute;top:calc(var(--input-space) / 2 - var(--input-space) / 2);left:var(--space-m);z-index:1;display:block;color:var(--label-color);font-size:var(--input-font-size);white-space:nowrap;transform-origin:left center;transition:transform .15s ease-out,left .15s ease-out,color .15s ease-out;pointer-events:none}._textarea-wrapper_1hbfy_2 ._label_1hbfy_11._has-left-slot_1hbfy_24{left:calc(var(--space-m) + var(--icon-size) + var(--clear-button-mg))}._textarea-wrapper_1hbfy_2 ._label_1hbfy_11._active-label_1hbfy_27{transform:scale(var(--label-scaled)) translateY(calc(var(--textarea-transform-label) * -1))}._textarea-wrapper_1hbfy_2 ._label_1hbfy_11._active-label_1hbfy_27._has-left-slot_1hbfy_24{left:calc(var(--space-m) + var(--icon-size) + var(--space-s));transform:scale(var(--label-scaled)) translate(calc((var(--space-m) + var(--left-addon-position)) * 2 * -1),calc(var(--textarea-transform-label) * -1))}._s_1hbfy_35{--textarea-space: var(--space-2s);--textarea-top-space: var(--space-l);--textarea-transform-label: var(--space-xss);--textarea-height: 76px;--textarea-padding: var(--space-xs) var(--space-s)}._m_1hbfy_43{--textarea-space: var(--space-2s);--textarea-top-space: var(--space-l);--textarea-transform-label: var(--space-s);--textarea-height: 88px;--textarea-padding: var(--space-xs) var(--space-s)}._l_1hbfy_11{--textarea-space: var(--space-2m);--textarea-top-space: 25px;--textarea-transform-label: var(--space-m);--textarea-height: 120px;--textarea-padding: var(--space-2m)}
|
@@ -5,7 +5,7 @@ import { c as cls, D as DatePickerModal } from "../../DatePickerModal-BM0BgzTb.j
|
|
5
5
|
import { useClickOutside } from "../../hooks/useClickOutside/useClickOutside.js";
|
6
6
|
import { formating } from "../../utils/index.js";
|
7
7
|
import { Button } from "../Button/Button.js";
|
8
|
-
import { I as Input } from "../../Input-
|
8
|
+
import { I as Input } from "../../Input-C8BYj-Cv.js";
|
9
9
|
const DatePicker = memo(
|
10
10
|
forwardRef(
|
11
11
|
({ size, value, onChangeValue, name, before, ...props }, ref) => {
|
@@ -42,14 +42,6 @@ export type TAdditionalProps = {
|
|
42
42
|
* Флаг, показывающий наличие кнопки очистки.
|
43
43
|
*/
|
44
44
|
withClearButton?: boolean;
|
45
|
-
/**
|
46
|
-
* Разрешить только числовой ввод
|
47
|
-
*/
|
48
|
-
numbersOnly?: boolean;
|
49
|
-
/**
|
50
|
-
* Максимальная длина ввода
|
51
|
-
*/
|
52
|
-
maxLength?: number;
|
53
45
|
};
|
54
46
|
export type TProps = TInputProps & TAdditionalProps;
|
55
47
|
export declare const Input: import('react').MemoExoticComponent<import('react').ForwardRefExoticComponent<TInputProps & TAdditionalProps & import('react').RefAttributes<HTMLInputElement>>>;
|
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
|
|
2
2
|
import "../../index-CweZ_OcN.js";
|
3
3
|
import "react";
|
4
4
|
import "./constants.js";
|
5
|
-
import { I } from "../../Input-
|
5
|
+
import { I } from "../../Input-C8BYj-Cv.js";
|
6
6
|
import "../../hooks/useMergeRefs/useMergeRefs.js";
|
7
7
|
import "../../icons/Icon.js";
|
8
8
|
import "../Button/Button.js";
|
@@ -2,7 +2,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { memo, forwardRef, useState } from "react";
|
3
3
|
import { Icon } from "../../icons/Icon.js";
|
4
4
|
import { Button } from "../Button/Button.js";
|
5
|
-
import { I as Input } from "../../Input-
|
5
|
+
import { I as Input } from "../../Input-C8BYj-Cv.js";
|
6
6
|
import '../../assets/InputPassword.css';const input = "_input_mam1g_2";
|
7
7
|
const wrapper = "_wrapper_mam1g_6";
|
8
8
|
const button = "_button_mam1g_17";
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
2
2
|
import { memo, forwardRef, useState, useCallback, useImperativeHandle } from "react";
|
3
3
|
import { getMaskedInputPhoneValue, getUnmaskedInputValue } from "./utils.js";
|
4
|
-
import { I as Input } from "../../Input-
|
4
|
+
import { I as Input } from "../../Input-C8BYj-Cv.js";
|
5
5
|
const InputPhoneNumber = memo(
|
6
6
|
forwardRef(
|
7
7
|
({ value = "", onChange, ...props }, ref) => {
|
@@ -3,7 +3,7 @@ import { c as classNames } from "../../index-CweZ_OcN.js";
|
|
3
3
|
import { forwardRef, useImperativeHandle, Fragment } from "react";
|
4
4
|
import { ITEMS_PER_SEPARATOR, DEFAULT_VALUE_LENGTH } from "./constants.js";
|
5
5
|
import { useOTPInput } from "./hooks.js";
|
6
|
-
import { I as Input } from "../../Input-
|
6
|
+
import { I as Input } from "../../Input-C8BYj-Cv.js";
|
7
7
|
import '../../assets/OtpInput.css';const otp = "_otp_196ev_3";
|
8
8
|
const input = "_input_196ev_14";
|
9
9
|
const separator = "_separator_196ev_28";
|
@@ -1,9 +1,8 @@
|
|
1
1
|
import { RadioGroupProps } from '@headlessui/react';
|
2
|
-
import { ReactNode } from 'react';
|
3
2
|
|
4
3
|
export interface TRadioOption {
|
5
4
|
value: string;
|
6
|
-
label:
|
5
|
+
label: string;
|
7
6
|
}
|
8
7
|
/**
|
9
8
|
* Свойства компонента RadioGroup.
|
@@ -24,11 +23,6 @@ export type TRadioGroupProps = Omit<RadioGroupProps, 'value'> & {
|
|
24
23
|
* Может быть необязательным.
|
25
24
|
*/
|
26
25
|
label?: string;
|
27
|
-
/**
|
28
|
-
* Дополнительный класснейм для элементов радиогруппы.
|
29
|
-
*
|
30
|
-
*/
|
31
|
-
classNameRadioWrapper?: string;
|
32
26
|
};
|
33
27
|
/**
|
34
28
|
* Компонент RadioGroup для выбора одной опции из нескольких.
|
@@ -49,9 +43,4 @@ export declare const RadioGroup: import('react').ForwardRefExoticComponent<Omit<
|
|
49
43
|
* Может быть необязательным.
|
50
44
|
*/
|
51
45
|
label?: string;
|
52
|
-
/**
|
53
|
-
* Дополнительный класснейм для элементов радиогруппы.
|
54
|
-
*
|
55
|
-
*/
|
56
|
-
classNameRadioWrapper?: string;
|
57
46
|
} & import('react').RefAttributes<HTMLElement>>;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
2
|
-
import { K, w, a, z as z$1, U, l, T, j as j$1, u as u$1, I, G, p } from "../../label-
|
2
|
+
import { K, w, a, z as z$1, U, l, T, j as j$1, u as u$1, I, G, p } from "../../label-BTEGh6O_.js";
|
3
3
|
import { W, y, o, H, s, n, $ as $f7dceffc5ad7768b$export$4e328f61c538687f, b as $6179b936705e76d3$export$ae780daf29e6d456, D, a as u$2, u as u$3, c as o$1 } from "../../keyboard-B256ZoM-.js";
|
4
4
|
import React__default, { createContext, useId, useReducer, useRef, useMemo, useCallback, useContext, forwardRef } from "react";
|
5
5
|
import { u } from "../../use-by-comparator-BUO78DGe.js";
|
@@ -120,14 +120,10 @@ const cls = {
|
|
120
120
|
checked
|
121
121
|
};
|
122
122
|
const RadioGroup = forwardRef(
|
123
|
-
({ options, value, onChange, label: label2,
|
124
|
-
const radioClasses = classNames(
|
125
|
-
cls
|
126
|
-
|
127
|
-
{
|
128
|
-
[cls.disabled]: props.disabled
|
129
|
-
}
|
130
|
-
);
|
123
|
+
({ options, value, onChange, label: label2, ...props }, ref) => {
|
124
|
+
const radioClasses = classNames(cls["radio-wrapper"], {
|
125
|
+
[cls.disabled]: props.disabled
|
126
|
+
});
|
131
127
|
return /* @__PURE__ */ jsxs(
|
132
128
|
Tt,
|
133
129
|
{
|
@@ -167,7 +163,7 @@ const RadioGroup = forwardRef(
|
|
167
163
|
label22
|
168
164
|
] })
|
169
165
|
},
|
170
|
-
|
166
|
+
label22
|
171
167
|
)) })
|
172
168
|
]
|
173
169
|
}
|
@@ -4,14 +4,14 @@ import * as React from "react";
|
|
4
4
|
import React__default, { useReducer, useMemo, useSyncExternalStore, useId as useId$1, useEffect, useCallback, useRef, useLayoutEffect, createContext, useContext, useState, Fragment, createRef, forwardRef } from "react";
|
5
5
|
import { ESelectSearchSize } from "./constants.js";
|
6
6
|
import { Icon } from "../../icons/Icon.js";
|
7
|
-
import { I as Input } from "../../Input-
|
7
|
+
import { I as Input } from "../../Input-C8BYj-Cv.js";
|
8
8
|
import { EInputVariant, EInputSize } from "../Input/constants.js";
|
9
9
|
import { n as n$2, u as u$3, d as o$1, s as s$3, o as o$2, p as p$1, t as t$3, e as s$4, W as W$1, y as y$3, T, H, M as M$1, a as u$5, $ as $f7dceffc5ad7768b$export$4e328f61c538687f, b as $6179b936705e76d3$export$ae780daf29e6d456, D as D$2, c as o$3 } from "../../keyboard-B256ZoM-.js";
|
10
10
|
import * as ReactDOM from "react-dom";
|
11
11
|
import { flushSync, createPortal } from "react-dom";
|
12
12
|
import { w } from "../../use-active-press-B6yeSopF.js";
|
13
13
|
import { u as u$4 } from "../../use-by-comparator-BUO78DGe.js";
|
14
|
-
import { K, a as a$5, l as l$3, T as T$1, z, j as j$1, u as u$6, I as I$1, G } from "../../label-
|
14
|
+
import { K, a as a$5, l as l$3, T as T$1, z, j as j$1, u as u$6, I as I$1, G } from "../../label-BTEGh6O_.js";
|
15
15
|
import { A, h as h$1, f as f$6, _ } from "../../focus-management-1rQPII7Z.js";
|
16
16
|
import { T as T$2 } from "../../use-resolve-button-type-B6LE6gU3.js";
|
17
17
|
import { c as c$2, i as i$2, u as u$7, V, A as A$1 } from "../../open-closed-CbXq00et.js";
|
@@ -3798,8 +3798,7 @@ const SelectSearch = forwardRef(
|
|
3798
3798
|
onSearch,
|
3799
3799
|
variant = EInputVariant.DefaultGray,
|
3800
3800
|
menuPlacement = "bottom",
|
3801
|
-
disabled: disabled2 = false
|
3802
|
-
searchProps
|
3801
|
+
disabled: disabled2 = false
|
3803
3802
|
} = props;
|
3804
3803
|
const [inputValue, setInputValue] = useState("");
|
3805
3804
|
const mapSizeToInputSize = (size22) => {
|
@@ -3864,8 +3863,7 @@ const SelectSearch = forwardRef(
|
|
3864
3863
|
onChange: handleInputChange,
|
3865
3864
|
value: inputValue,
|
3866
3865
|
disabled: disabled2,
|
3867
|
-
variant
|
3868
|
-
...searchProps
|
3866
|
+
variant
|
3869
3867
|
}
|
3870
3868
|
),
|
3871
3869
|
showArrow && /* @__PURE__ */ jsx(Ho, { className: cls.button, disabled: disabled2, children: /* @__PURE__ */ jsx(
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { ReactNode } from 'react';
|
2
2
|
import { ESelectSearchSize } from './constants';
|
3
|
-
import {
|
3
|
+
import { TVariant } from '../Input';
|
4
4
|
|
5
5
|
export type TSelectOption = {
|
6
6
|
name: string;
|
@@ -50,6 +50,4 @@ export type TSelectSearchProps = {
|
|
50
50
|
menuPlacement?: TMenuPlacement;
|
51
51
|
/** Отключает компонент SelectSearch */
|
52
52
|
disabled?: boolean;
|
53
|
-
/** Пропсы для инпута поиска опций */
|
54
|
-
searchProps?: Pick<TInputProps, 'numbersOnly' | 'maxLength'>;
|
55
53
|
};
|
@@ -3,6 +3,7 @@ export declare const DIFF_BETWEEN_STEP_AND_INDEX = 1;
|
|
3
3
|
export declare const ID_SEPARATOR = "-//-";
|
4
4
|
export declare enum EStepsSize {
|
5
5
|
XS = "XS",
|
6
|
+
XS1 = "XS1",
|
6
7
|
S = "S",
|
7
8
|
M = "M",
|
8
9
|
L = "L"
|
@@ -12,6 +13,10 @@ export declare const StepSize: {
|
|
12
13
|
width: number;
|
13
14
|
height: number;
|
14
15
|
};
|
16
|
+
XS1: {
|
17
|
+
width: number;
|
18
|
+
height: number;
|
19
|
+
};
|
15
20
|
S: {
|
16
21
|
width: number;
|
17
22
|
height: number;
|
@@ -3,6 +3,7 @@ const DIFF_BETWEEN_STEP_AND_INDEX = 1;
|
|
3
3
|
const ID_SEPARATOR = "-//-";
|
4
4
|
var EStepsSize = /* @__PURE__ */ ((EStepsSize2) => {
|
5
5
|
EStepsSize2["XS"] = "XS";
|
6
|
+
EStepsSize2["XS1"] = "XS1";
|
6
7
|
EStepsSize2["S"] = "S";
|
7
8
|
EStepsSize2["M"] = "M";
|
8
9
|
EStepsSize2["L"] = "L";
|
@@ -13,6 +14,10 @@ const StepSize = {
|
|
13
14
|
width: 19,
|
14
15
|
height: 8
|
15
16
|
},
|
17
|
+
XS1: {
|
18
|
+
width: 32,
|
19
|
+
height: 12
|
20
|
+
},
|
16
21
|
S: {
|
17
22
|
width: 36,
|
18
23
|
height: 12
|
@@ -1,28 +1,34 @@
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
2
|
-
import { c as
|
2
|
+
import { W, p, o, $ as $f7dceffc5ad7768b$export$4e328f61c538687f, b as $6179b936705e76d3$export$ae780daf29e6d456, D, H as H$1, c as o$1 } from "../../keyboard-B256ZoM-.js";
|
3
3
|
import React__default, { useId, useState, useMemo, useCallback, forwardRef, useEffect } from "react";
|
4
|
-
import { Icon } from "../../icons/Icon.js";
|
5
|
-
import { W, p, o, $ as $f7dceffc5ad7768b$export$4e328f61c538687f, b as $6179b936705e76d3$export$ae780daf29e6d456, D, H, c as o$1 } from "../../keyboard-B256ZoM-.js";
|
6
4
|
import { w } from "../../use-active-press-B6yeSopF.js";
|
7
|
-
import { u, a, l, T, I, G, j, p as p$1 } from "../../label-
|
5
|
+
import { u, a, l, T, I, G, j, p as p$1, z, U, b as l$1, f, W as W$1, K } from "../../label-BTEGh6O_.js";
|
8
6
|
import { r } from "../../bugs-CSBdWk0R.js";
|
7
|
+
import { c as classNames } from "../../index-CweZ_OcN.js";
|
8
|
+
import { Icon } from "../../icons/Icon.js";
|
9
9
|
import '../../assets/Switch.css';let se = "span";
|
10
10
|
function ie(T$1, h) {
|
11
|
-
let C = useId(), k = u(), x = a(), { id: g = k || `headlessui-checkbox-${C}`, disabled: e = x || false, autoFocus: s = false, checked: E, defaultChecked: v, onChange: P, name: d, value: D$1, form: R, indeterminate: n = false, ...
|
11
|
+
let C = useId(), k = u(), x = a(), { id: g = k || `headlessui-checkbox-${C}`, disabled: e = x || false, autoFocus: s = false, checked: E, defaultChecked: v, onChange: P, name: d, value: D$1, form: R, indeterminate: n = false, ...A2 } = T$1, r$1 = l(v), [a$1, t] = T(E, P, r$1 != null ? r$1 : false), F = I(), K2 = G(), _ = p(), [p$2, c] = useState(false), u$1 = o(() => {
|
12
12
|
c(true), t == null || t(!a$1), _.nextFrame(() => {
|
13
13
|
c(false);
|
14
14
|
});
|
15
|
-
}),
|
15
|
+
}), H2 = o((o2) => {
|
16
16
|
if (r(o2.currentTarget)) return o2.preventDefault();
|
17
17
|
o2.preventDefault(), u$1();
|
18
18
|
}), B = o((o2) => {
|
19
19
|
o2.key === o$1.Space ? (o2.preventDefault(), u$1()) : o2.key === o$1.Enter && p$1(o2.currentTarget);
|
20
|
-
}),
|
20
|
+
}), L2 = o((o2) => o2.preventDefault()), { isFocusVisible: m, focusProps: I$1 } = $f7dceffc5ad7768b$export$4e328f61c538687f({ autoFocus: s }), { isHovered: f2, hoverProps: M } = $6179b936705e76d3$export$ae780daf29e6d456({ isDisabled: e }), { pressed: b, pressProps: U2 } = w({ disabled: e }), O = D({ ref: h, id: g, role: "checkbox", "aria-checked": n ? "mixed" : a$1 ? "true" : "false", "aria-labelledby": F, "aria-describedby": K2, "aria-disabled": e ? true : void 0, indeterminate: n ? "true" : void 0, tabIndex: e ? void 0 : 0, onKeyUp: e ? void 0 : B, onKeyPress: e ? void 0 : L2, onClick: e ? void 0 : H2 }, I$1, M, U2), X = useMemo(() => ({ checked: a$1, disabled: e, hover: f2, focus: m, active: b, indeterminate: n, changing: p$2, autofocus: s }), [a$1, n, e, f2, m, b, p$2, s]), G$1 = useCallback(() => {
|
21
21
|
if (r$1 !== void 0) return t == null ? void 0 : t(r$1);
|
22
22
|
}, [t, r$1]);
|
23
|
-
return React__default.createElement(React__default.Fragment, null, d != null && React__default.createElement(j, { disabled: e, data: { [d]: D$1 || "on" }, overrides: { type: "checkbox", checked: a$1 }, form: R, onReset: G$1 }), H({ ourProps: O, theirProps:
|
23
|
+
return React__default.createElement(React__default.Fragment, null, d != null && React__default.createElement(j, { disabled: e, data: { [d]: D$1 || "on" }, overrides: { type: "checkbox", checked: a$1 }, form: R, onReset: G$1 }), H$1({ ourProps: O, theirProps: A2, slot: X, defaultTag: se, name: "Checkbox" }));
|
24
24
|
}
|
25
25
|
let Re = W(ie);
|
26
|
+
let A = "div";
|
27
|
+
function L(d, l2) {
|
28
|
+
let t = `headlessui-control-${useId()}`, [s, p2] = z(), [n, a$1] = U(), m = a(), { disabled: e = m || false, ...o2 } = d, i = useMemo(() => ({ disabled: e }), [e]);
|
29
|
+
return React__default.createElement(l$1, { value: e }, React__default.createElement(p2, { value: s }, React__default.createElement(a$1, { value: n }, React__default.createElement(f, { id: t }, H$1({ ourProps: { ref: l2, disabled: e || void 0, "aria-disabled": e || void 0 }, theirProps: { ...o2, children: React__default.createElement(W$1, null, typeof o2.children == "function" ? o2.children(i) : o2.children) }, slot: i, defaultTag: A, name: "Field" })))));
|
30
|
+
}
|
31
|
+
let H = W(L);
|
26
32
|
const container = "_container_18cvn_2";
|
27
33
|
const label = "_label_18cvn_27";
|
28
34
|
const enabled = "_enabled_18cvn_31";
|
@@ -34,7 +40,7 @@ const cls = {
|
|
34
40
|
};
|
35
41
|
const Switch = forwardRef(
|
36
42
|
(props, ref) => {
|
37
|
-
const { checked, onChange, children, ...restProps } = props;
|
43
|
+
const { checked, onChange, children, id, ...restProps } = props;
|
38
44
|
const [enabled2, setEnabled] = useState(checked);
|
39
45
|
const handleChange = (value) => {
|
40
46
|
setEnabled(value);
|
@@ -43,10 +49,11 @@ const Switch = forwardRef(
|
|
43
49
|
useEffect(() => {
|
44
50
|
setEnabled(!!checked);
|
45
51
|
}, [checked]);
|
46
|
-
return /* @__PURE__ */ jsxs(
|
52
|
+
return /* @__PURE__ */ jsxs(H, { className: cls.container, children: [
|
47
53
|
/* @__PURE__ */ jsx(
|
48
54
|
Re,
|
49
55
|
{
|
56
|
+
id,
|
50
57
|
ref,
|
51
58
|
checked: enabled2,
|
52
59
|
onChange: handleChange,
|
@@ -57,7 +64,7 @@ const Switch = forwardRef(
|
|
57
64
|
children: /* @__PURE__ */ jsx(Icon, { iconName: "Done16px" })
|
58
65
|
}
|
59
66
|
),
|
60
|
-
children && /* @__PURE__ */ jsx(
|
67
|
+
children && /* @__PURE__ */ jsx(K, { htmlFor: id, className: cls.label, children })
|
61
68
|
] });
|
62
69
|
}
|
63
70
|
);
|
@@ -5,18 +5,23 @@ import { useAutoResizeTextArea } from "./hooks.js";
|
|
5
5
|
import { useMergeRefs } from "../../hooks/useMergeRefs/useMergeRefs.js";
|
6
6
|
import { Icon } from "../../icons/Icon.js";
|
7
7
|
import { Button } from "../Button/Button.js";
|
8
|
-
import { c as cls } from "../../Input-
|
8
|
+
import { c as cls } from "../../Input-C8BYj-Cv.js";
|
9
9
|
import { EInputVariant } from "../Input/constants.js";
|
10
|
-
import '../../assets/TextArea.css';const textarea = "
|
11
|
-
const
|
12
|
-
const
|
13
|
-
const
|
10
|
+
import '../../assets/TextArea.css';const textarea = "_textarea_1hbfy_2";
|
11
|
+
const label = "_label_1hbfy_11";
|
12
|
+
const s = "_s_1hbfy_35";
|
13
|
+
const m = "_m_1hbfy_43";
|
14
|
+
const l = "_l_1hbfy_11";
|
14
15
|
const textareaCls = {
|
16
|
+
"textarea-wrapper": "_textarea-wrapper_1hbfy_2",
|
15
17
|
textarea,
|
18
|
+
"has-label": "_has-label_1hbfy_8",
|
19
|
+
label,
|
20
|
+
"has-left-slot": "_has-left-slot_1hbfy_24",
|
21
|
+
"active-label": "_active-label_1hbfy_27",
|
16
22
|
s,
|
17
23
|
m,
|
18
|
-
l
|
19
|
-
"has-label": "_has-label_46c4k_21"
|
24
|
+
l
|
20
25
|
};
|
21
26
|
const renderAddon = (addon) => {
|
22
27
|
var _a, _b;
|
@@ -62,7 +67,7 @@ const TextArea = memo(
|
|
62
67
|
id,
|
63
68
|
onFocus,
|
64
69
|
onBlur,
|
65
|
-
label,
|
70
|
+
label: label2,
|
66
71
|
onChange,
|
67
72
|
withClearButton,
|
68
73
|
disabled,
|
@@ -73,14 +78,14 @@ const TextArea = memo(
|
|
73
78
|
} = props;
|
74
79
|
const [isFocused, setIsFocused] = useState(autofocus);
|
75
80
|
const [withValue, setWithValue] = useState(!!value);
|
76
|
-
const
|
77
|
-
const
|
81
|
+
const textareaRef = useRef(null);
|
82
|
+
const mergedTextareaRef = useMergeRefs(textareaRef, ref);
|
78
83
|
useEffect(() => {
|
79
84
|
if (autofocus) {
|
80
85
|
setIsFocused(true);
|
81
86
|
}
|
82
87
|
}, [autofocus]);
|
83
|
-
const handleResize = useAutoResizeTextArea(
|
88
|
+
const handleResize = useAutoResizeTextArea(textareaRef.current);
|
84
89
|
const handleBlur = (event) => {
|
85
90
|
const currentValue = event.currentTarget.value;
|
86
91
|
onBlur == null ? void 0 : onBlur(event);
|
@@ -97,9 +102,9 @@ const TextArea = memo(
|
|
97
102
|
onFocus == null ? void 0 : onFocus(event);
|
98
103
|
};
|
99
104
|
const handleClear = () => {
|
100
|
-
if (
|
101
|
-
|
102
|
-
|
105
|
+
if (textareaRef == null ? void 0 : textareaRef.current) {
|
106
|
+
textareaRef.current.value = "";
|
107
|
+
textareaRef.current.focus();
|
103
108
|
setWithValue(false);
|
104
109
|
handleResize();
|
105
110
|
onChange == null ? void 0 : onChange({
|
@@ -121,14 +126,15 @@ const TextArea = memo(
|
|
121
126
|
[cls.disabled]: disabled || readonly,
|
122
127
|
[cls["has-left-slot"]]: !!currentLeftAddon,
|
123
128
|
[cls["has-right-slot"]]: !!currentRightAddon,
|
124
|
-
[textareaCls["has-label"]]: !!
|
129
|
+
[textareaCls["has-label"]]: !!label2
|
125
130
|
};
|
126
131
|
const labelClassNames = classNames(
|
127
132
|
cls.label,
|
133
|
+
textareaCls.label,
|
128
134
|
{
|
129
|
-
[
|
135
|
+
[textareaCls["active-label"]]: isFocused || value,
|
130
136
|
[cls.disabled]: disabled || readonly,
|
131
|
-
[
|
137
|
+
[textareaCls["has-left-slot"]]: !!currentLeftAddon
|
132
138
|
},
|
133
139
|
className,
|
134
140
|
cls[size]
|
@@ -145,6 +151,7 @@ const TextArea = memo(
|
|
145
151
|
{
|
146
152
|
className: classNames(
|
147
153
|
cls["input-wrapper"],
|
154
|
+
textareaCls["textarea-wrapper"],
|
148
155
|
cls[variant],
|
149
156
|
textareaCls[size],
|
150
157
|
cls[size],
|
@@ -155,13 +162,13 @@ const TextArea = memo(
|
|
155
162
|
wrapperClassName
|
156
163
|
),
|
157
164
|
children: [
|
158
|
-
|
165
|
+
label2 && /* @__PURE__ */ jsx("label", { htmlFor: id, className: labelClassNames, children: label2 }),
|
159
166
|
currentLeftAddon && /* @__PURE__ */ jsx(
|
160
167
|
"span",
|
161
168
|
{
|
162
169
|
className: classNames(cls["left-slot"], {
|
163
170
|
[cls.focused]: isFocused,
|
164
|
-
[cls["has-label"]]: !!
|
171
|
+
[cls["has-label"]]: !!label2
|
165
172
|
}),
|
166
173
|
children: currentLeftAddon
|
167
174
|
}
|
@@ -169,7 +176,7 @@ const TextArea = memo(
|
|
169
176
|
/* @__PURE__ */ jsx(
|
170
177
|
"textarea",
|
171
178
|
{
|
172
|
-
ref:
|
179
|
+
ref: mergedTextareaRef,
|
173
180
|
id,
|
174
181
|
className: inputClassNames,
|
175
182
|
onFocus: handleFocus,
|
@@ -185,7 +192,7 @@ const TextArea = memo(
|
|
185
192
|
{
|
186
193
|
className: classNames(cls["right-slot"], {
|
187
194
|
[cls.focused]: isFocused,
|
188
|
-
[cls["has-label"]]: !!
|
195
|
+
[cls["has-label"]]: !!label2
|
189
196
|
}),
|
190
197
|
children: currentRightAddon
|
191
198
|
}
|
package/dist/components/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Button } from "./Button/Button.js";
|
2
2
|
import { EButtonForm, EButtonSize, EButtonVariantDefault, EButtonVariantOutline, EButtonVariantRound } from "./Button/constants.js";
|
3
|
-
import { I } from "../Input-
|
3
|
+
import { I } from "../Input-C8BYj-Cv.js";
|
4
4
|
import { EInputSize, EInputVariant } from "./Input/constants.js";
|
5
5
|
import { TextArea } from "./TextArea/TextArea.js";
|
6
6
|
import { InputPassword } from "./InputPassword/InputPassword.js";
|
package/dist/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Button } from "./components/Button/Button.js";
|
2
2
|
import { EButtonForm, EButtonSize, EButtonVariantDefault, EButtonVariantOutline, EButtonVariantRound } from "./components/Button/constants.js";
|
3
|
-
import { I } from "./Input-
|
3
|
+
import { I } from "./Input-C8BYj-Cv.js";
|
4
4
|
import { EInputSize, EInputVariant } from "./components/Input/constants.js";
|
5
5
|
import { TextArea } from "./components/TextArea/TextArea.js";
|
6
6
|
import { InputPassword } from "./components/InputPassword/InputPassword.js";
|
@@ -1,11 +1,14 @@
|
|
1
1
|
import React__default, { createContext, useContext, useState, useRef, useEffect, useMemo, useId } from "react";
|
2
|
-
import { o as o$1, p as p$1, m, W, y, n, H } from "./keyboard-B256ZoM-.js";
|
2
|
+
import { o as o$1, p as p$1, m, W as W$1, y, n, H } from "./keyboard-B256ZoM-.js";
|
3
3
|
import { createPortal } from "react-dom";
|
4
4
|
import { T as T$1, s } from "./hidden-BuVoeHNy.js";
|
5
5
|
let e$2 = createContext(void 0);
|
6
6
|
function a$1() {
|
7
7
|
return useContext(e$2);
|
8
8
|
}
|
9
|
+
function l$1({ value: t, children: o2 }) {
|
10
|
+
return React__default.createElement(e$2.Provider, { value: t }, o2);
|
11
|
+
}
|
9
12
|
function T(l2, r, c2) {
|
10
13
|
let [i, s2] = useState(c2), e2 = l2 !== void 0, t = useRef(e2), u2 = useRef(false), d = useRef(false);
|
11
14
|
return e2 && !t.current && !u2.current ? (u2.current = true, t.current = e2, console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")) : !e2 && t.current && !d.current && (d.current = true, t.current = e2, console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")), [e2 ? l2 : i, o$1((n2) => (e2 || s2(n2), r == null ? void 0 : r(n2)))];
|
@@ -15,14 +18,14 @@ function l(e2) {
|
|
15
18
|
return t;
|
16
19
|
}
|
17
20
|
function e$1(i = {}, s2 = null, t = []) {
|
18
|
-
for (let [r, n2] of Object.entries(i)) o(t, f$
|
21
|
+
for (let [r, n2] of Object.entries(i)) o(t, f$3(s2, r), n2);
|
19
22
|
return t;
|
20
23
|
}
|
21
|
-
function f$
|
24
|
+
function f$3(i, s2) {
|
22
25
|
return i ? i + "[" + s2 + "]" : s2;
|
23
26
|
}
|
24
27
|
function o(i, s2, t) {
|
25
|
-
if (Array.isArray(t)) for (let [r, n2] of t.entries()) o(i, f$
|
28
|
+
if (Array.isArray(t)) for (let [r, n2] of t.entries()) o(i, f$3(s2, r.toString()), n2);
|
26
29
|
else t instanceof Date ? i.push([s2, t.toISOString()]) : typeof t == "boolean" ? i.push([s2, t ? "1" : "0"]) : typeof t == "string" ? i.push([s2, t]) : typeof t == "number" ? i.push([s2, `${t}`]) : t == null ? i.push([s2, ""]) : e$1(t, s2, i);
|
27
30
|
}
|
28
31
|
function p(i) {
|
@@ -36,9 +39,13 @@ function p(i) {
|
|
36
39
|
(r = s2.requestSubmit) == null || r.call(s2);
|
37
40
|
}
|
38
41
|
}
|
39
|
-
let f$
|
42
|
+
let f$2 = createContext(null);
|
43
|
+
function W(t) {
|
44
|
+
let [e2, r] = useState(null);
|
45
|
+
return React__default.createElement(f$2.Provider, { value: { target: e2 } }, t.children, React__default.createElement(T$1, { features: s.Hidden, ref: r }));
|
46
|
+
}
|
40
47
|
function c$1({ children: t }) {
|
41
|
-
let e2 = useContext(f$
|
48
|
+
let e2 = useContext(f$2);
|
42
49
|
if (!e2) return React__default.createElement(React__default.Fragment, null, t);
|
43
50
|
let { target: r } = e2;
|
44
51
|
return r ? createPortal(React__default.createElement(React__default.Fragment, null, t), r) : null;
|
@@ -65,6 +72,9 @@ let e = createContext(void 0);
|
|
65
72
|
function u() {
|
66
73
|
return useContext(e);
|
67
74
|
}
|
75
|
+
function f$1({ id: t, children: r }) {
|
76
|
+
return React__default.createElement(e.Provider, { value: t }, r);
|
77
|
+
}
|
68
78
|
let a = createContext(null);
|
69
79
|
a.displayName = "DescriptionContext";
|
70
80
|
function f() {
|
@@ -96,7 +106,7 @@ function C(r, e2) {
|
|
96
106
|
let o2 = t || false, p2 = useMemo(() => ({ ...n$1.slot, disabled: o2 }), [n$1.slot, o2]), D = { ref: s2, ...n$1.props, id: i };
|
97
107
|
return H({ ourProps: D, theirProps: l2, slot: p2, defaultTag: S, name: n$1.name || "Description" });
|
98
108
|
}
|
99
|
-
let _ = W(C), w = Object.assign(_, {});
|
109
|
+
let _ = W$1(C), w = Object.assign(_, {});
|
100
110
|
let c = createContext(null);
|
101
111
|
c.displayName = "LabelContext";
|
102
112
|
function P() {
|
@@ -142,14 +152,17 @@ function G(r, l2) {
|
|
142
152
|
}), d = g || false, C2 = useMemo(() => ({ ...e2.slot, disabled: d }), [e2.slot, d]), f2 = { ref: p2, ...e2.props, id: t, htmlFor: s2, onClick: u$1 };
|
143
153
|
return m2 && ("onClick" in f2 && (delete f2.htmlFor, delete f2.onClick), "onClick" in i && delete i.onClick), H({ ourProps: f2, theirProps: i, slot: C2, defaultTag: s2 ? N : "div", name: e2.name || "Label" });
|
144
154
|
}
|
145
|
-
let U = W(G), K = Object.assign(U, {});
|
155
|
+
let U = W$1(G), K = Object.assign(U, {});
|
146
156
|
export {
|
147
157
|
G$1 as G,
|
148
158
|
I,
|
149
159
|
K,
|
150
160
|
T,
|
151
161
|
U$1 as U,
|
162
|
+
W,
|
152
163
|
a$1 as a,
|
164
|
+
l$1 as b,
|
165
|
+
f$1 as f,
|
153
166
|
j,
|
154
167
|
l,
|
155
168
|
p,
|