colibri-ui 0.7.152 → 0.7.154
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/Calendar/index.js +8 -4
- package/Checkbox/Checkbox.module.css +0 -4
- package/Checkbox/index.js +13 -18
- package/Checkbox/index.props.d.ts +12 -12
- package/Datepicker/components/DatePicker/index.d.ts +1 -1
- package/Datepicker/components/DatePicker/index.js +23 -10
- package/Datepicker/components/DatePicker/index.module.css +27 -20
- package/Input/index.d.ts +1 -1
- package/Input/index.js +4 -4
- package/Input/index.props.d.ts +9 -9
- package/MultiSelect/index.d.ts +1 -1
- package/MultiSelect/index.js +58 -64
- package/MultiSelect/index.module.css +2 -3
- package/Select/index.d.ts +1 -1
- package/Select/index.js +3 -3
- package/Select/index.props.d.ts +14 -14
- package/TextArea/index.d.ts +1 -1
- package/TextArea/index.js +4 -4
- package/TextArea/index.props.d.ts +1 -1
- package/base/FormField/index.d.ts +1 -1
- package/base/FormField/index.js +8 -10
- package/base/FormField/index.props.d.ts +4 -4
- package/base/InputRoot/index.d.ts +1 -1
- package/base/InputRoot/index.js +6 -7
- package/base/InputRoot/index.props.d.ts +1 -1
- package/esm/Calendar/index.js +8 -4
- package/esm/Checkbox/Checkbox.module.css +0 -4
- package/esm/Checkbox/index.js +13 -18
- package/esm/Checkbox/index.props.d.ts +12 -12
- package/esm/Datepicker/components/DatePicker/index.d.ts +1 -1
- package/esm/Datepicker/components/DatePicker/index.js +23 -10
- package/esm/Datepicker/components/DatePicker/index.module.css +27 -20
- package/esm/Input/index.d.ts +1 -1
- package/esm/Input/index.js +4 -4
- package/esm/Input/index.props.d.ts +9 -9
- package/esm/MultiSelect/index.d.ts +1 -1
- package/esm/MultiSelect/index.js +59 -65
- package/esm/MultiSelect/index.module.css +2 -3
- package/esm/Select/index.d.ts +1 -1
- package/esm/Select/index.js +3 -3
- package/esm/Select/index.props.d.ts +14 -14
- package/esm/TextArea/index.d.ts +1 -1
- package/esm/TextArea/index.js +4 -4
- package/esm/TextArea/index.props.d.ts +1 -1
- package/esm/base/FormField/index.d.ts +1 -1
- package/esm/base/FormField/index.js +8 -10
- package/esm/base/FormField/index.props.d.ts +4 -4
- package/esm/base/InputRoot/index.d.ts +1 -1
- package/esm/base/InputRoot/index.js +6 -7
- package/esm/base/InputRoot/index.props.d.ts +1 -1
- package/package.json +1 -1
package/esm/MultiSelect/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __spreadArray, __assign } from 'tslib';
|
|
2
2
|
import React__default, { useState, useMemo, useCallback } from 'react';
|
|
3
3
|
import classNames from 'classnames/bind';
|
|
4
4
|
import Dropdown from '../Dropdown/index.js';
|
|
@@ -13,23 +13,27 @@ import Chevron from '../Icons/Chevron.js';
|
|
|
13
13
|
import CrossFill from '../Icons/CrossFill.js';
|
|
14
14
|
|
|
15
15
|
var clx = classNames.bind(styles);
|
|
16
|
-
var
|
|
17
|
-
return items.sort(function (a, b) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
groupB = _b[1],
|
|
29
|
-
optionB = _b[2];
|
|
16
|
+
var sortItems = function sortItems(items) {
|
|
17
|
+
return __spreadArray([], items, true).sort(function (a, b) {
|
|
18
|
+
var parseKey = function parseKey(key) {
|
|
19
|
+
var _a;
|
|
20
|
+
return ((_a = key.match(/group-(\d+)-option-(\d+)/)) === null || _a === void 0 ? void 0 : _a.slice(1).map(Number)) || [];
|
|
21
|
+
};
|
|
22
|
+
var _a = parseKey(a),
|
|
23
|
+
groupA = _a[0],
|
|
24
|
+
optionA = _a[1];
|
|
25
|
+
var _b = parseKey(b),
|
|
26
|
+
groupB = _b[0],
|
|
27
|
+
optionB = _b[1];
|
|
30
28
|
return groupA - groupB || optionA - optionB;
|
|
31
29
|
});
|
|
32
30
|
};
|
|
31
|
+
var getValue = function getValue(options) {
|
|
32
|
+
return options.map(function (_a) {
|
|
33
|
+
var label = _a.label;
|
|
34
|
+
return label;
|
|
35
|
+
}).join(", ");
|
|
36
|
+
};
|
|
33
37
|
var MultiSelect = function MultiSelect(_a) {
|
|
34
38
|
var className = _a.className,
|
|
35
39
|
groups = _a.groups,
|
|
@@ -41,7 +45,7 @@ var MultiSelect = function MultiSelect(_a) {
|
|
|
41
45
|
required = _a.required,
|
|
42
46
|
label = _a.label,
|
|
43
47
|
hint = _a.hint,
|
|
44
|
-
|
|
48
|
+
hasError = _a.hasError,
|
|
45
49
|
_c = _a.size,
|
|
46
50
|
size = _c === void 0 ? "m" : _c,
|
|
47
51
|
placeholder = _a.placeholder,
|
|
@@ -59,7 +63,7 @@ var MultiSelect = function MultiSelect(_a) {
|
|
|
59
63
|
return __assign(__assign({}, group), {
|
|
60
64
|
options: group.options.map(function (option) {
|
|
61
65
|
return __assign(__assign({}, option), {
|
|
62
|
-
selected:
|
|
66
|
+
selected: value.includes(createGroupOptionString(group.value, option.value))
|
|
63
67
|
});
|
|
64
68
|
})
|
|
65
69
|
});
|
|
@@ -67,35 +71,40 @@ var MultiSelect = function MultiSelect(_a) {
|
|
|
67
71
|
}, [value, groups]);
|
|
68
72
|
var handleChange = useCallback(function (key) {
|
|
69
73
|
setValue(function (prev) {
|
|
70
|
-
var newValue = prev.
|
|
71
|
-
return
|
|
72
|
-
}) :
|
|
73
|
-
|
|
74
|
-
onChange(newValue);
|
|
75
|
-
}
|
|
74
|
+
var newValue = prev.includes(key) ? prev.filter(function (v) {
|
|
75
|
+
return v !== key;
|
|
76
|
+
}) : sortItems(__spreadArray(__spreadArray([], prev, true), [key], false));
|
|
77
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
76
78
|
return newValue;
|
|
77
79
|
});
|
|
78
80
|
}, [onChange]);
|
|
79
|
-
var
|
|
80
|
-
return preparedGroups.flatMap(function (
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
var preparedLabel = useMemo(function () {
|
|
82
|
+
return preparedGroups.flatMap(function (_a) {
|
|
83
|
+
var groupVal = _a.value,
|
|
84
|
+
options = _a.options;
|
|
85
|
+
return options.filter(function (_a) {
|
|
86
|
+
var selected = _a.selected;
|
|
87
|
+
return selected;
|
|
88
|
+
}).map(
|
|
89
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
90
|
+
function (_a) {
|
|
91
|
+
var label = _a.label,
|
|
92
|
+
optVal = _a.value;
|
|
84
93
|
return {
|
|
85
|
-
label:
|
|
86
|
-
key: createGroupOptionString(
|
|
94
|
+
label: label,
|
|
95
|
+
key: createGroupOptionString(groupVal, optVal)
|
|
87
96
|
};
|
|
88
97
|
});
|
|
89
98
|
});
|
|
90
99
|
}, [preparedGroups]);
|
|
91
100
|
return /*#__PURE__*/React__default.createElement(FormField, {
|
|
92
101
|
className: clx(styles["form-field"], {
|
|
93
|
-
"full-width": fullWidth
|
|
102
|
+
"full-width": fullWidth
|
|
94
103
|
}, className),
|
|
95
104
|
required: required,
|
|
96
105
|
label: label,
|
|
97
106
|
hint: hint,
|
|
98
|
-
|
|
107
|
+
hasError: hasError
|
|
99
108
|
}, /*#__PURE__*/React__default.createElement(Dropdown, {
|
|
100
109
|
placement: "bottom-start",
|
|
101
110
|
preventOverflow: true,
|
|
@@ -103,63 +112,48 @@ var MultiSelect = function MultiSelect(_a) {
|
|
|
103
112
|
trigger: ["click"],
|
|
104
113
|
zIndex: zIndex,
|
|
105
114
|
fontSize: fontSize,
|
|
106
|
-
disabled:
|
|
115
|
+
disabled: disabled,
|
|
107
116
|
overlay: /*#__PURE__*/React__default.createElement(MenuOverlay, {
|
|
108
117
|
groups: preparedGroups,
|
|
109
118
|
onChange: handleChange
|
|
110
119
|
}),
|
|
111
120
|
samewidth: true
|
|
112
|
-
},
|
|
113
|
-
|
|
121
|
+
}, /*#__PURE__*/React__default.createElement(InputRoot, {
|
|
122
|
+
hasError: hasError,
|
|
114
123
|
size: size,
|
|
115
124
|
className: clx(styles.root, {
|
|
116
|
-
|
|
125
|
+
root_auto: preparedLabel.length
|
|
117
126
|
}),
|
|
118
127
|
endIcon: /*#__PURE__*/React__default.createElement(Chevron, {
|
|
119
128
|
className: clx(styles.icon, {
|
|
120
|
-
icon_isOpen: isOpen
|
|
129
|
+
icon_isOpen: isOpen
|
|
121
130
|
})
|
|
122
131
|
}),
|
|
123
|
-
disabled:
|
|
132
|
+
disabled: Boolean(disabled)
|
|
124
133
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
125
|
-
className: clx(styles["base-input"], styles["base-input-flex"])
|
|
126
|
-
},
|
|
134
|
+
className: clx(styles["base-input"], styles[type === "chip" ? "base-input-flex" : "base-input-text"])
|
|
135
|
+
}, preparedLabel.length ? type === "chip" ?
|
|
136
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
137
|
+
preparedLabel.map(function (_a) {
|
|
138
|
+
var label = _a.label,
|
|
139
|
+
key = _a.key;
|
|
127
140
|
return /*#__PURE__*/React__default.createElement(Chip, {
|
|
141
|
+
key: key,
|
|
128
142
|
size: "s",
|
|
129
143
|
iconEnd: /*#__PURE__*/React__default.createElement(CrossFill, null),
|
|
130
144
|
"data-ignore-click": true,
|
|
131
|
-
key: "item-".concat(index),
|
|
132
145
|
onClickIcon: function onClickIcon() {
|
|
133
|
-
return handleChange(
|
|
146
|
+
return handleChange(key);
|
|
134
147
|
}
|
|
135
|
-
},
|
|
136
|
-
}))
|
|
137
|
-
className: clx(styles.placeholder)
|
|
138
|
-
}, placeholder))), /*#__PURE__*/React__default.createElement("input", {
|
|
139
|
-
type: "hidden",
|
|
140
|
-
name: name,
|
|
141
|
-
tabIndex: -1,
|
|
142
|
-
value: value || ""
|
|
143
|
-
}))) : (/*#__PURE__*/React__default.createElement(InputRoot, {
|
|
144
|
-
error: error,
|
|
145
|
-
size: size,
|
|
146
|
-
className: clx(styles.root),
|
|
147
|
-
endIcon: /*#__PURE__*/React__default.createElement(Chevron, {
|
|
148
|
-
className: clx(styles.icon, {
|
|
149
|
-
icon_isOpen: isOpen ? 1 : 0
|
|
150
|
-
})
|
|
151
|
-
}),
|
|
152
|
-
disabled: !!disabled
|
|
153
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
154
|
-
className: clx(styles["base-input"], styles["base-input-text"])
|
|
155
|
-
}, prepraredLabel.length ? prepraredLabel.join(", ") : (/*#__PURE__*/React__default.createElement("span", {
|
|
148
|
+
}, label);
|
|
149
|
+
}) : getValue(preparedLabel) : (/*#__PURE__*/React__default.createElement("span", {
|
|
156
150
|
className: clx(styles.placeholder)
|
|
157
151
|
}, placeholder))), /*#__PURE__*/React__default.createElement("input", {
|
|
158
152
|
type: "hidden",
|
|
159
153
|
name: name,
|
|
160
154
|
tabIndex: -1,
|
|
161
|
-
value: value || ""
|
|
162
|
-
}))))
|
|
155
|
+
value: value.join(",") || ""
|
|
156
|
+
}))));
|
|
163
157
|
};
|
|
164
158
|
|
|
165
159
|
export { MultiSelect as default };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
cursor: pointer;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
.
|
|
5
|
+
.root_auto {
|
|
6
6
|
height: auto;
|
|
7
7
|
min-height: 36px;
|
|
8
8
|
}
|
|
@@ -18,10 +18,9 @@
|
|
|
18
18
|
.base-input {
|
|
19
19
|
background: transparent;
|
|
20
20
|
border: none;
|
|
21
|
-
display:
|
|
21
|
+
display: flex;
|
|
22
22
|
flex: 1;
|
|
23
23
|
margin: 7px 0;
|
|
24
|
-
width: 100%;
|
|
25
24
|
}
|
|
26
25
|
.base-input ::placeholder {
|
|
27
26
|
color: var(--palette-bg-2);
|
package/esm/Select/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { SelectProps } from "./index.props";
|
|
3
|
-
declare const Select: <T extends string>({ options, value, name, zIndex, fontSize, label, hint,
|
|
3
|
+
declare const Select: <T extends string>({ options, value, name, zIndex, fontSize, label, hint, hasError, required, placeholder, disabled, size, fullWidth, customInputRoot, className, onChange, }: SelectProps<T>) => React.JSX.Element;
|
|
4
4
|
export default Select;
|
package/esm/Select/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var Select = function Select(_a) {
|
|
|
17
17
|
fontSize = _a.fontSize,
|
|
18
18
|
label = _a.label,
|
|
19
19
|
hint = _a.hint,
|
|
20
|
-
|
|
20
|
+
hasError = _a.hasError,
|
|
21
21
|
required = _a.required,
|
|
22
22
|
placeholder = _a.placeholder,
|
|
23
23
|
disabled = _a.disabled,
|
|
@@ -58,7 +58,7 @@ var Select = function Select(_a) {
|
|
|
58
58
|
required: required,
|
|
59
59
|
label: label,
|
|
60
60
|
hint: hint,
|
|
61
|
-
|
|
61
|
+
hasError: hasError
|
|
62
62
|
}, /*#__PURE__*/React__default.createElement(Dropdown, {
|
|
63
63
|
placement: "bottom-start",
|
|
64
64
|
preventOverflow: true,
|
|
@@ -73,7 +73,7 @@ var Select = function Select(_a) {
|
|
|
73
73
|
}),
|
|
74
74
|
samewidth: true
|
|
75
75
|
}, customInputRoot ? customInputRoot : (/*#__PURE__*/React__default.createElement(InputRoot, {
|
|
76
|
-
|
|
76
|
+
hasError: hasError,
|
|
77
77
|
size: size,
|
|
78
78
|
className: clx(styles.root),
|
|
79
79
|
endIcon: /*#__PURE__*/React__default.createElement(Chevron, {
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import type { FormFieldProps } from "../base/FormField/index.props";
|
|
3
3
|
type Size = "s" | "m" | "l";
|
|
4
|
+
export type Coordinates = {
|
|
5
|
+
height: number;
|
|
6
|
+
top: number;
|
|
7
|
+
};
|
|
4
8
|
export interface IOption<T extends string> {
|
|
5
|
-
value: T;
|
|
6
|
-
label: ReactNode;
|
|
7
9
|
disabled?: boolean;
|
|
10
|
+
label: ReactNode;
|
|
11
|
+
value: T;
|
|
8
12
|
}
|
|
9
13
|
export interface SelectProps<T extends string> extends Omit<FormFieldProps, "children"> {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
className?: string;
|
|
15
|
+
customInputRoot?: ReactNode;
|
|
16
|
+
disabled?: boolean;
|
|
13
17
|
fontSize?: number;
|
|
18
|
+
fullWidth?: boolean;
|
|
19
|
+
name?: string;
|
|
14
20
|
onChange: (value: T) => void;
|
|
15
|
-
|
|
21
|
+
options: IOption<T>[];
|
|
16
22
|
placeholder?: string;
|
|
17
|
-
fullWidth?: boolean;
|
|
18
23
|
required?: boolean;
|
|
19
24
|
size?: Size;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
name?: string;
|
|
25
|
+
value?: T;
|
|
26
|
+
zIndex?: number;
|
|
23
27
|
}
|
|
24
|
-
export type Coordinates = {
|
|
25
|
-
top: number;
|
|
26
|
-
height: number;
|
|
27
|
-
};
|
|
28
28
|
export {};
|
package/esm/TextArea/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { ITextAreaProps } from "./index.props";
|
|
3
|
-
declare const TextArea: ({ className, value, minRows, maxRows, onChange, label, required,
|
|
3
|
+
declare const TextArea: ({ className, value, minRows, maxRows, onChange, label, required, hasError, hint, disabled, inputRef, ref, ...props }: ITextAreaProps) => React.JSX.Element;
|
|
4
4
|
export default TextArea;
|
package/esm/TextArea/index.js
CHANGED
|
@@ -18,12 +18,12 @@ var TextArea = function TextArea(_a) {
|
|
|
18
18
|
onChange = _a.onChange,
|
|
19
19
|
label = _a.label,
|
|
20
20
|
required = _a.required,
|
|
21
|
-
|
|
21
|
+
hasError = _a.hasError,
|
|
22
22
|
hint = _a.hint,
|
|
23
23
|
disabled = _a.disabled,
|
|
24
24
|
inputRef = _a.inputRef,
|
|
25
25
|
ref = _a.ref,
|
|
26
|
-
props = __rest(_a, ["className", "value", "minRows", "maxRows", "onChange", "label", "required", "
|
|
26
|
+
props = __rest(_a, ["className", "value", "minRows", "maxRows", "onChange", "label", "required", "hasError", "hint", "disabled", "inputRef", "ref"]);
|
|
27
27
|
var onChangeHandler = function onChangeHandler(event) {
|
|
28
28
|
if (onChange) onChange(event.target.value, event);
|
|
29
29
|
};
|
|
@@ -33,10 +33,10 @@ var TextArea = function TextArea(_a) {
|
|
|
33
33
|
required: required,
|
|
34
34
|
label: label,
|
|
35
35
|
hint: hint,
|
|
36
|
-
|
|
36
|
+
hasError: hasError
|
|
37
37
|
}, /*#__PURE__*/React__default.createElement(InputRoot, {
|
|
38
38
|
disabled: !!disabled,
|
|
39
|
-
|
|
39
|
+
hasError: hasError
|
|
40
40
|
}, /*#__PURE__*/React__default.createElement(TextareaAutosize, __assign({
|
|
41
41
|
ref: inputRef,
|
|
42
42
|
"data-testid": "textarea",
|
|
@@ -5,7 +5,7 @@ export interface ITextAreaProps extends Omit<TextareaHTMLAttributes<HTMLTextArea
|
|
|
5
5
|
value?: string;
|
|
6
6
|
label?: ReactNode;
|
|
7
7
|
hint?: ReactNode;
|
|
8
|
-
|
|
8
|
+
hasError?: boolean;
|
|
9
9
|
required?: boolean;
|
|
10
10
|
onChange?: (value: string, e: ChangeEvent<HTMLTextAreaElement>) => void;
|
|
11
11
|
inputRef?: ForwardedRef<HTMLTextAreaElement>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { FormFieldProps } from "./index.props";
|
|
3
|
-
declare const FormField: ({ label, hint, children,
|
|
3
|
+
declare const FormField: ({ label, hint, children, hasError, required, className, ref, }: FormFieldProps) => React.JSX.Element;
|
|
4
4
|
export default FormField;
|
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
|
-
import classNames from 'classnames
|
|
2
|
+
import classNames from 'classnames';
|
|
3
3
|
import Typography from '../../Typography/index.js';
|
|
4
4
|
import styles from './FormField.module.css';
|
|
5
5
|
|
|
6
|
-
var clx = classNames.bind(styles);
|
|
7
6
|
var FormField = function FormField(_a) {
|
|
7
|
+
var _b;
|
|
8
8
|
var label = _a.label,
|
|
9
9
|
hint = _a.hint,
|
|
10
10
|
children = _a.children,
|
|
11
|
-
|
|
11
|
+
hasError = _a.hasError,
|
|
12
12
|
required = _a.required,
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
className = _a.className,
|
|
14
|
+
ref = _a.ref;
|
|
15
15
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
16
|
-
className:
|
|
16
|
+
className: classNames(styles.container, className),
|
|
17
17
|
ref: ref
|
|
18
18
|
}, label && (/*#__PURE__*/React__default.createElement(Typography, {
|
|
19
|
-
className:
|
|
20
|
-
label_required: !!required
|
|
21
|
-
}),
|
|
19
|
+
className: classNames(styles.label, (_b = {}, _b[styles.label_required] = required, _b)),
|
|
22
20
|
tag: "label"
|
|
23
21
|
}, label)), children, hint && (/*#__PURE__*/React__default.createElement(Typography, {
|
|
24
|
-
variant:
|
|
22
|
+
variant: hasError ? "alert" : "secondary",
|
|
25
23
|
tag: "span"
|
|
26
24
|
}, hint)));
|
|
27
25
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import type { PropsWithChildren } from "react";
|
|
3
3
|
export type FormFieldProps = PropsWithChildren<{
|
|
4
|
-
label?: ReactNode;
|
|
5
|
-
hint?: ReactNode;
|
|
6
|
-
error?: boolean;
|
|
7
|
-
required?: boolean;
|
|
8
4
|
className?: string;
|
|
5
|
+
hasError?: boolean;
|
|
6
|
+
hint?: ReactNode;
|
|
7
|
+
label?: ReactNode;
|
|
9
8
|
ref?: React.Ref<HTMLDivElement>;
|
|
9
|
+
required?: boolean;
|
|
10
10
|
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { InputProps } from "./index.props";
|
|
3
|
-
declare const InputRoot: ({ className, startIcon, endIcon, children, variant, disabled,
|
|
3
|
+
declare const InputRoot: ({ className, startIcon, endIcon, children, variant, disabled, hasError, style, size, ref, }: InputProps) => React.JSX.Element;
|
|
4
4
|
export default InputRoot;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
|
-
import classNames from 'classnames
|
|
2
|
+
import classNames from 'classnames';
|
|
3
3
|
import styles from './InputRoot.module.css';
|
|
4
4
|
|
|
5
|
-
var clx = classNames.bind(styles);
|
|
6
5
|
var InputRoot = function InputRoot(_a) {
|
|
7
6
|
var _b;
|
|
8
7
|
var className = _a.className,
|
|
@@ -12,20 +11,20 @@ var InputRoot = function InputRoot(_a) {
|
|
|
12
11
|
_c = _a.variant,
|
|
13
12
|
variant = _c === void 0 ? "primary" : _c,
|
|
14
13
|
disabled = _a.disabled,
|
|
15
|
-
|
|
14
|
+
hasError = _a.hasError,
|
|
16
15
|
style = _a.style,
|
|
17
16
|
size = _a.size,
|
|
18
17
|
ref = _a.ref;
|
|
19
18
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
20
19
|
ref: ref,
|
|
21
20
|
style: style,
|
|
22
|
-
className:
|
|
21
|
+
className: classNames(styles.root, styles["variant_".concat(variant)], size && styles["size_".concat(size)], (_b = {}, _b[styles["variant_".concat(variant, "_disabled")]] = disabled, _b[styles["variant_".concat(variant, "_error")]] = hasError, _b), className)
|
|
23
22
|
}, startIcon && /*#__PURE__*/React__default.createElement("div", {
|
|
24
|
-
className:
|
|
23
|
+
className: styles["base-icon"]
|
|
25
24
|
}, startIcon), children, endIcon && /*#__PURE__*/React__default.createElement("div", {
|
|
26
|
-
className:
|
|
25
|
+
className: styles["base-icon"]
|
|
27
26
|
}, endIcon), disabled && /*#__PURE__*/React__default.createElement("div", {
|
|
28
|
-
className:
|
|
27
|
+
className: styles["base-disable-wrapper"]
|
|
29
28
|
}));
|
|
30
29
|
};
|
|
31
30
|
|