colibri-ui 0.8.14 → 0.8.16
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/Counter/Counter.module.css +1 -2
- package/MultiSelect/index.props.d.ts +1 -1
- package/Switch/Switch.module.css +35 -2
- package/Switch/index.d.ts +1 -1
- package/Switch/index.js +20 -5
- package/Switch/index.props.d.ts +4 -1
- package/esm/Counter/Counter.module.css +1 -2
- package/esm/MultiSelect/index.props.d.ts +1 -1
- package/esm/Switch/Switch.module.css +35 -2
- package/esm/Switch/index.d.ts +1 -1
- package/esm/Switch/index.js +20 -5
- package/esm/Switch/index.props.d.ts +4 -1
- package/package.json +1 -1
package/Switch/Switch.module.css
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
.root {
|
|
2
2
|
display: inline-flex;
|
|
3
|
-
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 8px;
|
|
4
5
|
position: relative;
|
|
5
6
|
}
|
|
6
7
|
.root_disabled {
|
|
@@ -8,6 +9,14 @@
|
|
|
8
9
|
pointer-events: none;
|
|
9
10
|
}
|
|
10
11
|
|
|
12
|
+
.label {
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
gap: 8px;
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
position: relative;
|
|
18
|
+
}
|
|
19
|
+
|
|
11
20
|
.wrapper {
|
|
12
21
|
border-radius: 17px;
|
|
13
22
|
border-style: solid;
|
|
@@ -16,11 +25,20 @@
|
|
|
16
25
|
height: 22px;
|
|
17
26
|
position: relative;
|
|
18
27
|
width: 40px;
|
|
28
|
+
transition: all 150ms ease;
|
|
19
29
|
}
|
|
20
30
|
.wrapper_variant_primary {
|
|
21
31
|
background-color: var(--switch-bg);
|
|
22
32
|
border-color: var(--switch-border-color);
|
|
23
33
|
}
|
|
34
|
+
.wrapper_disabled {
|
|
35
|
+
opacity: 0.5;
|
|
36
|
+
cursor: not-allowed;
|
|
37
|
+
}
|
|
38
|
+
.wrapper_error {
|
|
39
|
+
border-color: var(--color-error, #ef4444);
|
|
40
|
+
box-shadow: 0 0 0 1px var(--color-error, #ef4444);
|
|
41
|
+
}
|
|
24
42
|
|
|
25
43
|
.base-switch {
|
|
26
44
|
background: var(--palette-white);
|
|
@@ -29,8 +47,9 @@
|
|
|
29
47
|
left: 2px;
|
|
30
48
|
position: absolute;
|
|
31
49
|
top: 2px;
|
|
32
|
-
transition: transform 150ms;
|
|
50
|
+
transition: transform 150ms ease;
|
|
33
51
|
width: 16px;
|
|
52
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
34
53
|
}
|
|
35
54
|
|
|
36
55
|
.checkbox {
|
|
@@ -53,4 +72,18 @@
|
|
|
53
72
|
}
|
|
54
73
|
.checkbox:checked + .wrapper .base-switch {
|
|
55
74
|
transform: translateX(18px);
|
|
75
|
+
}
|
|
76
|
+
.checkbox:focus + .wrapper {
|
|
77
|
+
outline: 2px solid var(--focus-color, #3b82f6);
|
|
78
|
+
outline-offset: 2px;
|
|
79
|
+
}
|
|
80
|
+
.checkbox:disabled {
|
|
81
|
+
cursor: not-allowed;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.text {
|
|
85
|
+
font-size: 16px;
|
|
86
|
+
line-height: 1.4;
|
|
87
|
+
color: var(--text-primary, #1f2937);
|
|
88
|
+
user-select: none;
|
|
56
89
|
}
|
package/Switch/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { SwitchProps } from "./index.props";
|
|
3
|
-
declare const Switch: ({ disabled, className, variant, ref, ...props }: SwitchProps) => React.JSX.Element;
|
|
3
|
+
declare const Switch: ({ disabled, className, variant, hint, hasError, id, label, ref, ...props }: SwitchProps) => React.JSX.Element;
|
|
4
4
|
export default Switch;
|
package/Switch/index.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var classNames = require('classnames/bind');
|
|
8
|
+
var index = require('../Typography/index.js');
|
|
8
9
|
var styles = require('./Switch.module.css');
|
|
9
10
|
|
|
10
11
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -20,21 +21,35 @@ var Switch = function Switch(_a) {
|
|
|
20
21
|
className = _a.className,
|
|
21
22
|
_c = _a.variant,
|
|
22
23
|
variant = _c === void 0 ? "primary" : _c,
|
|
24
|
+
hint = _a.hint,
|
|
25
|
+
hasError = _a.hasError,
|
|
26
|
+
id = _a.id,
|
|
27
|
+
label = _a.label,
|
|
23
28
|
ref = _a.ref,
|
|
24
|
-
props = tslib.__rest(_a, ["disabled", "className", "variant", "ref"]);
|
|
29
|
+
props = tslib.__rest(_a, ["disabled", "className", "variant", "hint", "hasError", "id", "label", "ref"]);
|
|
25
30
|
return /*#__PURE__*/React__default.default.createElement("div", {
|
|
26
31
|
className: clx(styles__default.default.root, {
|
|
27
|
-
root_disabled: disabled
|
|
32
|
+
root_disabled: disabled
|
|
28
33
|
}, className)
|
|
34
|
+
}, /*#__PURE__*/React__default.default.createElement("label", {
|
|
35
|
+
className: clx(styles__default.default.label),
|
|
36
|
+
htmlFor: id
|
|
29
37
|
}, /*#__PURE__*/React__default.default.createElement("input", tslib.__assign({
|
|
30
38
|
className: clx(styles__default.default.checkbox),
|
|
31
39
|
ref: ref,
|
|
32
|
-
|
|
40
|
+
id: id,
|
|
41
|
+
type: "checkbox",
|
|
42
|
+
disabled: disabled
|
|
33
43
|
}, props)), /*#__PURE__*/React__default.default.createElement("div", {
|
|
34
|
-
className: clx(styles__default.default.wrapper, (_b = {}, _b["wrapper_variant_".concat(variant)] = variant
|
|
44
|
+
className: clx(styles__default.default.wrapper, (_b = {}, _b["wrapper_variant_".concat(variant)] = variant, _b.wrapper_disabled = disabled, _b.wrapper_error = hasError, _b))
|
|
35
45
|
}, /*#__PURE__*/React__default.default.createElement("div", {
|
|
36
46
|
className: clx(styles__default.default["base-switch"])
|
|
37
|
-
}))
|
|
47
|
+
})), label && /*#__PURE__*/React__default.default.createElement("span", {
|
|
48
|
+
className: clx(styles__default.default.text)
|
|
49
|
+
}, label)), hint && (/*#__PURE__*/React__default.default.createElement(index.default, {
|
|
50
|
+
variant: hasError ? "alert" : "secondary",
|
|
51
|
+
tag: "span"
|
|
52
|
+
}, hint)));
|
|
38
53
|
};
|
|
39
54
|
|
|
40
55
|
exports.default = Switch;
|
package/Switch/index.props.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import type { InputHTMLAttributes } from "react";
|
|
1
|
+
import type { InputHTMLAttributes, ReactNode } from "react";
|
|
2
2
|
export interface SwitchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type"> {
|
|
3
3
|
variant?: "primary";
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
ref?: React.Ref<HTMLInputElement>;
|
|
6
|
+
hint?: ReactNode;
|
|
7
|
+
hasError?: boolean;
|
|
8
|
+
label?: ReactNode;
|
|
6
9
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
.root {
|
|
2
2
|
display: inline-flex;
|
|
3
|
-
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 8px;
|
|
4
5
|
position: relative;
|
|
5
6
|
}
|
|
6
7
|
.root_disabled {
|
|
@@ -8,6 +9,14 @@
|
|
|
8
9
|
pointer-events: none;
|
|
9
10
|
}
|
|
10
11
|
|
|
12
|
+
.label {
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
gap: 8px;
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
position: relative;
|
|
18
|
+
}
|
|
19
|
+
|
|
11
20
|
.wrapper {
|
|
12
21
|
border-radius: 17px;
|
|
13
22
|
border-style: solid;
|
|
@@ -16,11 +25,20 @@
|
|
|
16
25
|
height: 22px;
|
|
17
26
|
position: relative;
|
|
18
27
|
width: 40px;
|
|
28
|
+
transition: all 150ms ease;
|
|
19
29
|
}
|
|
20
30
|
.wrapper_variant_primary {
|
|
21
31
|
background-color: var(--switch-bg);
|
|
22
32
|
border-color: var(--switch-border-color);
|
|
23
33
|
}
|
|
34
|
+
.wrapper_disabled {
|
|
35
|
+
opacity: 0.5;
|
|
36
|
+
cursor: not-allowed;
|
|
37
|
+
}
|
|
38
|
+
.wrapper_error {
|
|
39
|
+
border-color: var(--color-error, #ef4444);
|
|
40
|
+
box-shadow: 0 0 0 1px var(--color-error, #ef4444);
|
|
41
|
+
}
|
|
24
42
|
|
|
25
43
|
.base-switch {
|
|
26
44
|
background: var(--palette-white);
|
|
@@ -29,8 +47,9 @@
|
|
|
29
47
|
left: 2px;
|
|
30
48
|
position: absolute;
|
|
31
49
|
top: 2px;
|
|
32
|
-
transition: transform 150ms;
|
|
50
|
+
transition: transform 150ms ease;
|
|
33
51
|
width: 16px;
|
|
52
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
34
53
|
}
|
|
35
54
|
|
|
36
55
|
.checkbox {
|
|
@@ -53,4 +72,18 @@
|
|
|
53
72
|
}
|
|
54
73
|
.checkbox:checked + .wrapper .base-switch {
|
|
55
74
|
transform: translateX(18px);
|
|
75
|
+
}
|
|
76
|
+
.checkbox:focus + .wrapper {
|
|
77
|
+
outline: 2px solid var(--focus-color, #3b82f6);
|
|
78
|
+
outline-offset: 2px;
|
|
79
|
+
}
|
|
80
|
+
.checkbox:disabled {
|
|
81
|
+
cursor: not-allowed;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.text {
|
|
85
|
+
font-size: 16px;
|
|
86
|
+
line-height: 1.4;
|
|
87
|
+
color: var(--text-primary, #1f2937);
|
|
88
|
+
user-select: none;
|
|
56
89
|
}
|
package/esm/Switch/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { SwitchProps } from "./index.props";
|
|
3
|
-
declare const Switch: ({ disabled, className, variant, ref, ...props }: SwitchProps) => React.JSX.Element;
|
|
3
|
+
declare const Switch: ({ disabled, className, variant, hint, hasError, id, label, ref, ...props }: SwitchProps) => React.JSX.Element;
|
|
4
4
|
export default Switch;
|
package/esm/Switch/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __rest, __assign } from 'tslib';
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import classNames from 'classnames/bind';
|
|
4
|
+
import Typography from '../Typography/index.js';
|
|
4
5
|
import styles from './Switch.module.css';
|
|
5
6
|
|
|
6
7
|
var clx = classNames.bind(styles);
|
|
@@ -10,21 +11,35 @@ var Switch = function Switch(_a) {
|
|
|
10
11
|
className = _a.className,
|
|
11
12
|
_c = _a.variant,
|
|
12
13
|
variant = _c === void 0 ? "primary" : _c,
|
|
14
|
+
hint = _a.hint,
|
|
15
|
+
hasError = _a.hasError,
|
|
16
|
+
id = _a.id,
|
|
17
|
+
label = _a.label,
|
|
13
18
|
ref = _a.ref,
|
|
14
|
-
props = __rest(_a, ["disabled", "className", "variant", "ref"]);
|
|
19
|
+
props = __rest(_a, ["disabled", "className", "variant", "hint", "hasError", "id", "label", "ref"]);
|
|
15
20
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
16
21
|
className: clx(styles.root, {
|
|
17
|
-
root_disabled: disabled
|
|
22
|
+
root_disabled: disabled
|
|
18
23
|
}, className)
|
|
24
|
+
}, /*#__PURE__*/React__default.createElement("label", {
|
|
25
|
+
className: clx(styles.label),
|
|
26
|
+
htmlFor: id
|
|
19
27
|
}, /*#__PURE__*/React__default.createElement("input", __assign({
|
|
20
28
|
className: clx(styles.checkbox),
|
|
21
29
|
ref: ref,
|
|
22
|
-
|
|
30
|
+
id: id,
|
|
31
|
+
type: "checkbox",
|
|
32
|
+
disabled: disabled
|
|
23
33
|
}, props)), /*#__PURE__*/React__default.createElement("div", {
|
|
24
|
-
className: clx(styles.wrapper, (_b = {}, _b["wrapper_variant_".concat(variant)] = variant
|
|
34
|
+
className: clx(styles.wrapper, (_b = {}, _b["wrapper_variant_".concat(variant)] = variant, _b.wrapper_disabled = disabled, _b.wrapper_error = hasError, _b))
|
|
25
35
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
26
36
|
className: clx(styles["base-switch"])
|
|
27
|
-
}))
|
|
37
|
+
})), label && /*#__PURE__*/React__default.createElement("span", {
|
|
38
|
+
className: clx(styles.text)
|
|
39
|
+
}, label)), hint && (/*#__PURE__*/React__default.createElement(Typography, {
|
|
40
|
+
variant: hasError ? "alert" : "secondary",
|
|
41
|
+
tag: "span"
|
|
42
|
+
}, hint)));
|
|
28
43
|
};
|
|
29
44
|
|
|
30
45
|
export { Switch as default };
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import type { InputHTMLAttributes } from "react";
|
|
1
|
+
import type { InputHTMLAttributes, ReactNode } from "react";
|
|
2
2
|
export interface SwitchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type"> {
|
|
3
3
|
variant?: "primary";
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
ref?: React.Ref<HTMLInputElement>;
|
|
6
|
+
hint?: ReactNode;
|
|
7
|
+
hasError?: boolean;
|
|
8
|
+
label?: ReactNode;
|
|
6
9
|
}
|