colibri-ui 0.7.54 → 0.7.56

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 (39) hide show
  1. package/Checkbox/Checkbox.module.css +2 -2
  2. package/DotsLoader/DotsLoader.module.css +10 -10
  3. package/InputRadio/InputRadio.module.css +97 -0
  4. package/InputRadio/index.d.ts +23 -0
  5. package/InputRadio/index.js +76 -0
  6. package/InputRadio/package.json +6 -0
  7. package/RadioGroup/Radio.d.ts +19 -0
  8. package/RadioGroup/Radio.js +45 -0
  9. package/RadioGroup/RadioGroup.module.css +30 -0
  10. package/RadioGroup/index.d.ts +26 -0
  11. package/RadioGroup/index.js +68 -0
  12. package/RadioGroup/package.json +6 -0
  13. package/Theme/global.css +3 -0
  14. package/Theme/index.d.ts +5 -0
  15. package/Theme/themes/default.d.ts +5 -0
  16. package/Theme/themes/default.js +5 -0
  17. package/Typography/index.props.d.ts +1 -1
  18. package/esm/Checkbox/Checkbox.module.css +2 -2
  19. package/esm/DotsLoader/DotsLoader.module.css +10 -10
  20. package/esm/InputRadio/InputRadio.module.css +97 -0
  21. package/esm/InputRadio/index.d.ts +23 -0
  22. package/esm/InputRadio/index.js +66 -0
  23. package/esm/RadioGroup/Radio.d.ts +19 -0
  24. package/esm/RadioGroup/Radio.js +37 -0
  25. package/esm/RadioGroup/RadioGroup.module.css +30 -0
  26. package/esm/RadioGroup/index.d.ts +26 -0
  27. package/esm/RadioGroup/index.js +58 -0
  28. package/esm/Theme/global.css +3 -0
  29. package/esm/Theme/index.d.ts +5 -0
  30. package/esm/Theme/themes/default.d.ts +5 -0
  31. package/esm/Theme/themes/default.js +5 -0
  32. package/esm/Typography/index.props.d.ts +1 -1
  33. package/esm/index.d.ts +1 -0
  34. package/esm/index.js +1 -0
  35. package/esm/theme_default_variables.css +5 -0
  36. package/index.d.ts +1 -0
  37. package/index.js +17 -15
  38. package/package.json +1 -2
  39. package/theme_default_variables.css +5 -0
@@ -53,8 +53,8 @@
53
53
  }
54
54
 
55
55
  .variant_primary_error {
56
- border-color: red;
57
- box-shadow: 0 0 0 2px red;
56
+ border-color: var(--palette-alert);
57
+ box-shadow: 0 0 0 2px var(--palette-alert);
58
58
  }
59
59
  .variant_primary_checked::after {
60
60
  border-block-end: 2px solid var(--palette-white);
@@ -4,16 +4,6 @@
4
4
  width: 70px;
5
5
  }
6
6
 
7
- .dot {
8
- animation-duration: 1.6s;
9
- animation-iteration-count: infinite;
10
- animation-name: pending;
11
- background-color: var(--palette-black);
12
- border-radius: 5px;
13
- height: 10px;
14
- transform: scale(0);
15
- width: 10px;
16
- }
17
7
  @keyframes pending {
18
8
  0% {
19
9
  transform: scale(0);
@@ -25,6 +15,16 @@
25
15
  transform: scale(0);
26
16
  }
27
17
  }
18
+ .dot {
19
+ animation-duration: 1.6s;
20
+ animation-iteration-count: infinite;
21
+ animation-name: pending;
22
+ background-color: var(--palette-black);
23
+ border-radius: 5px;
24
+ height: 10px;
25
+ transform: scale(0);
26
+ width: 10px;
27
+ }
28
28
  .dot_first {
29
29
  animation-delay: 0s;
30
30
  }
@@ -0,0 +1,97 @@
1
+ .label {
2
+ display: inline-block;
3
+ vertical-align: baseline;
4
+ }
5
+
6
+ .text {
7
+ flex-basis: auto;
8
+ flex-grow: 1;
9
+ flex-shrink: 1;
10
+ line-height: 18px;
11
+ margin-inline-start: 8px;
12
+ }
13
+
14
+ .icon {
15
+ background-color: var(--palette-white);
16
+ block-size: 16px;
17
+ border: solid 1px var(--palette-bg-3);
18
+ border-radius: 100%;
19
+ box-sizing: border-box;
20
+ display: block;
21
+ flex-shrink: 0;
22
+ inline-size: 16px;
23
+ margin-block-start: 1px;
24
+ position: relative;
25
+ transition: border-color 0.16s ease, box-shadow 0.16s ease;
26
+ }
27
+
28
+ .container {
29
+ align-items: flex-start;
30
+ cursor: pointer;
31
+ display: flex;
32
+ padding: 3px 0;
33
+ }
34
+ .container_disabled {
35
+ cursor: inherit;
36
+ }
37
+ .container_error .text {
38
+ color: var(--palette-alert);
39
+ }
40
+ .container_error .icon {
41
+ border-color: var(--palette-alert);
42
+ box-shadow: 0 0 0 2px var(--palette-tretiary-2);
43
+ }
44
+
45
+ .input {
46
+ block-size: 1px;
47
+ border: 0;
48
+ clip: rect(0 0 0 0);
49
+ inline-size: 1px;
50
+ margin: -1px;
51
+ overflow: hidden;
52
+ padding: 0;
53
+ position: absolute;
54
+ }
55
+ .input:not(.input_disabled):not(.input_error):hover + .icon {
56
+ border-color: var(--inputradio-primary-background-color-hovered);
57
+ }
58
+ .input:not(.input_disabled):not(.input_error):focus + .icon {
59
+ box-shadow: 0 0 0 2px var(--inputradio-primary-box-shadow-focused);
60
+ }
61
+ .input:not(.input_disabled):not(.input_error):active + .icon {
62
+ background-color: var(--inputradio-primary-background-color-focused);
63
+ border-color: var(--inputradio-primary-border-color-focused);
64
+ box-shadow: 0 0 0 2px var(--inputradio-primary-box-shadow-focused);
65
+ }
66
+ .input:not(.input_disabled):not(.input_error) .input_checked:hover + .icon {
67
+ border-color: var(--inputradio-primary-background-color-hovered);
68
+ }
69
+ .input:not(.input_disabled):not(.input_error) .input_checked:active + .icon {
70
+ background-color: var(--palette-white);
71
+ border: 4px solid var(--inputradio-primary-background-color-checked);
72
+ }
73
+ .input_checked + .icon {
74
+ background-color: var(--palette-white);
75
+ border: 4px solid var(--inputradio-primary-background-color-checked);
76
+ }
77
+ .input_disabled + .icon {
78
+ border-radius: 50%;
79
+ }
80
+ .input_disabled + .icon::after {
81
+ background-color: rgba(246, 246, 246, 0.8);
82
+ content: "";
83
+ display: block;
84
+ inset: 0;
85
+ margin: -1px;
86
+ position: absolute;
87
+ border-radius: 50%;
88
+ }
89
+ .input_checked:disabled + .icon::after {
90
+ margin: -4px;
91
+ }
92
+
93
+ .note {
94
+ color: var(--palette-bg-5);
95
+ margin-block-start: 4px;
96
+ padding-inline-start: 24px;
97
+ }
@@ -0,0 +1,23 @@
1
+ import React from "react";
2
+ import type { FC, CSSProperties, PropsWithChildren, FocusEvent, ChangeEvent } from "react";
3
+ type Props = {
4
+ checked?: boolean;
5
+ className?: string;
6
+ containerClassName?: string;
7
+ disabled?: boolean;
8
+ error?: string;
9
+ id?: string;
10
+ name?: string;
11
+ note?: string;
12
+ onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
13
+ onFocus?: (event: FocusEvent<HTMLInputElement>) => void;
14
+ onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
15
+ onClick?: (event: React.MouseEvent<HTMLLabelElement, MouseEvent>) => void;
16
+ onMouseEnter?: (event: React.MouseEvent<HTMLLabelElement, MouseEvent>) => void;
17
+ style?: CSSProperties;
18
+ text?: string;
19
+ value: string | number;
20
+ testid?: string;
21
+ };
22
+ declare const InputRadio: FC<PropsWithChildren<Props>>;
23
+ export default InputRadio;
@@ -0,0 +1,76 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var tslib = require('tslib');
6
+ var React = require('react');
7
+ var classNames = require('classnames/bind');
8
+ var index = require('../Typography/index.js');
9
+ var styles = require('./InputRadio.module.css');
10
+
11
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
12
+
13
+ var React__default = /*#__PURE__*/_interopDefault(React);
14
+ var classNames__default = /*#__PURE__*/_interopDefault(classNames);
15
+ var styles__default = /*#__PURE__*/_interopDefault(styles);
16
+
17
+ var clx = classNames__default.default.bind(styles__default.default);
18
+ var InputRadio = /*#__PURE__*/React.memo(function (_a) {
19
+ var checked = _a.checked,
20
+ children = _a.children,
21
+ className = _a.className,
22
+ containerClassName = _a.containerClassName,
23
+ disabled = _a.disabled,
24
+ error = _a.error,
25
+ id = _a.id,
26
+ name = _a.name,
27
+ note = _a.note,
28
+ onBlur = _a.onBlur,
29
+ onFocus = _a.onFocus,
30
+ onChange = _a.onChange,
31
+ onClick = _a.onClick,
32
+ onMouseEnter = _a.onMouseEnter,
33
+ style = _a.style,
34
+ text = _a.text,
35
+ value = _a.value,
36
+ testid = _a.testid,
37
+ rest = tslib.__rest(_a, ["checked", "children", "className", "containerClassName", "disabled", "error", "id", "name", "note", "onBlur", "onFocus", "onChange", "onClick", "onMouseEnter", "style", "text", "value", "testid"]);
38
+ return /*#__PURE__*/React__default.default.createElement("label", {
39
+ className: clx(styles__default.default.label, className),
40
+ htmlFor: id,
41
+ style: style,
42
+ onClick: onClick,
43
+ onMouseEnter: onMouseEnter,
44
+ "data-testid": testid
45
+ }, /*#__PURE__*/React__default.default.createElement("div", {
46
+ className: clx(styles__default.default.container, {
47
+ container_disabled: !!disabled,
48
+ container_error: !!error
49
+ }, containerClassName)
50
+ }, /*#__PURE__*/React__default.default.createElement("input", tslib.__assign({
51
+ type: "radio",
52
+ id: id,
53
+ value: value,
54
+ name: name,
55
+ className: clx(styles__default.default.input, {
56
+ input_error: !!error,
57
+ input_checked: !!checked,
58
+ input_disabled: !!disabled
59
+ }),
60
+ checked: checked,
61
+ disabled: disabled,
62
+ onChange: onChange,
63
+ onFocus: onFocus,
64
+ onBlur: onBlur
65
+ }, rest)), /*#__PURE__*/React__default.default.createElement("span", {
66
+ className: clx(styles__default.default.icon)
67
+ }), /*#__PURE__*/React__default.default.createElement("span", {
68
+ className: clx(styles__default.default.text)
69
+ }, !children && text, !text && children)), !!note && ( /*#__PURE__*/React__default.default.createElement(index.default, {
70
+ tag: "p",
71
+ size: "s",
72
+ className: clx(styles__default.default.note)
73
+ }, note)));
74
+ });
75
+
76
+ exports.default = InputRadio;
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "../esm/InputRadio/index.js",
4
+ "main": "./index.js",
5
+ "types": "./index.d.ts"
6
+ }
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ import type { ChangeEvent, FC, FocusEvent } from "react";
3
+ type Props = {
4
+ value: string | number;
5
+ text: string;
6
+ id?: string;
7
+ note?: string;
8
+ name?: string;
9
+ checked?: boolean;
10
+ onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
11
+ onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
12
+ onClick?: (event: React.MouseEvent<HTMLLabelElement, MouseEvent>) => void;
13
+ onMouseEnter?: (event: React.MouseEvent<HTMLLabelElement, MouseEvent>) => void;
14
+ className: string;
15
+ disabled?: boolean;
16
+ testId?: string;
17
+ };
18
+ declare const Radio: FC<Props>;
19
+ export default Radio;
@@ -0,0 +1,45 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+ var index = require('../InputRadio/index.js');
7
+
8
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
+
10
+ var React__default = /*#__PURE__*/_interopDefault(React);
11
+
12
+ var Radio = function Radio(_a) {
13
+ var id = _a.id,
14
+ value = _a.value,
15
+ text = _a.text,
16
+ note = _a.note,
17
+ name = _a.name,
18
+ _b = _a.checked,
19
+ checked = _b === void 0 ? false : _b,
20
+ onChange = _a.onChange,
21
+ onBlur = _a.onBlur,
22
+ onClick = _a.onClick,
23
+ onMouseEnter = _a.onMouseEnter,
24
+ className = _a.className,
25
+ _c = _a.disabled,
26
+ disabled = _c === void 0 ? false : _c,
27
+ testId = _a.testId;
28
+ return /*#__PURE__*/React__default.default.createElement(index.default, {
29
+ id: id,
30
+ value: value,
31
+ checked: checked,
32
+ onChange: onChange,
33
+ onBlur: onBlur,
34
+ onClick: onClick,
35
+ onMouseEnter: onMouseEnter,
36
+ text: text,
37
+ note: note,
38
+ name: name,
39
+ className: className,
40
+ disabled: disabled,
41
+ testid: testId
42
+ });
43
+ };
44
+
45
+ exports.default = Radio;
@@ -0,0 +1,30 @@
1
+ .group {
2
+ display: inline-flex;
3
+ }
4
+ .group_wide {
5
+ inline-size: 100%;
6
+ }
7
+ .group_column {
8
+ flex-direction: column;
9
+ }
10
+ .group_column .radio:not(:last-child) {
11
+ margin-block-end: 16px;
12
+ }
13
+ .group_wrapped {
14
+ flex-wrap: wrap;
15
+ }
16
+ .group_wrapped .radio {
17
+ inline-size: 100%;
18
+ margin: 8px auto;
19
+ }
20
+ .group_wrapped .radio:first-child {
21
+ margin-block-start: 0;
22
+ }
23
+ .group_wrapped .radio:last-child {
24
+ margin-block-end: 0;
25
+ }
26
+
27
+ .radio {
28
+ line-height: 16px;
29
+ margin-inline-end: 20px;
30
+ }
@@ -0,0 +1,26 @@
1
+ import React, { FC } from "react";
2
+ export interface Option {
3
+ id?: string;
4
+ val: string | number;
5
+ text: string;
6
+ note?: string;
7
+ name?: string;
8
+ tooltipContent?: () => React.ReactElement;
9
+ onClick?: (event: React.MouseEvent<HTMLLabelElement, MouseEvent>) => void;
10
+ onMouseEnter?: (event: React.MouseEvent<HTMLLabelElement, MouseEvent>) => void;
11
+ className?: string;
12
+ disabled?: boolean;
13
+ }
14
+ interface Props {
15
+ val?: string | number;
16
+ options: Option[];
17
+ onChange: (value: string) => void;
18
+ onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
19
+ column?: boolean;
20
+ wrapped?: boolean;
21
+ className?: string;
22
+ disabled?: boolean;
23
+ hasError?: boolean;
24
+ }
25
+ declare const RadioGroup: FC<Props>;
26
+ export default RadioGroup;
@@ -0,0 +1,68 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+ var classNames = require('classnames/bind');
7
+ var Radio = require('./Radio.js');
8
+ var styles = require('./RadioGroup.module.css');
9
+
10
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
+
12
+ var React__default = /*#__PURE__*/_interopDefault(React);
13
+ var classNames__default = /*#__PURE__*/_interopDefault(classNames);
14
+ var styles__default = /*#__PURE__*/_interopDefault(styles);
15
+
16
+ var clx = classNames__default.default.bind(styles__default.default);
17
+ var RadioGroup = /*#__PURE__*/React.memo(function (_a) {
18
+ var val = _a.val,
19
+ options = _a.options,
20
+ _onChange = _a.onChange,
21
+ onBlur = _a.onBlur,
22
+ _b = _a.column,
23
+ column = _b === void 0 ? false : _b,
24
+ _c = _a.wrapped,
25
+ wrapped = _c === void 0 ? false : _c,
26
+ className = _a.className,
27
+ _d = _a.disabled,
28
+ disabled = _d === void 0 ? false : _d,
29
+ _e = _a.hasError,
30
+ hasError = _e === void 0 ? false : _e;
31
+ return /*#__PURE__*/React__default.default.createElement("div", {
32
+ className: clx(styles__default.default.group, {
33
+ column: column,
34
+ wrapped: wrapped,
35
+ hasError: hasError
36
+ }, className)
37
+ }, options.map(function (option) {
38
+ var id = option.id,
39
+ optionVal = option.val,
40
+ text = option.text,
41
+ note = option.note,
42
+ name = option.name,
43
+ onClick = option.onClick,
44
+ onMouseEnter = option.onMouseEnter,
45
+ optionClassName = option.className,
46
+ optionDisabled = option.disabled;
47
+ return /*#__PURE__*/React__default.default.createElement(Radio.default, {
48
+ key: optionVal,
49
+ id: id,
50
+ testId: id,
51
+ value: optionVal,
52
+ text: text,
53
+ note: note,
54
+ name: name,
55
+ className: clx(styles__default.default.radio, optionClassName),
56
+ checked: val === optionVal,
57
+ onChange: function onChange(e) {
58
+ return _onChange(e.target.value);
59
+ },
60
+ onBlur: onBlur,
61
+ onClick: onClick,
62
+ onMouseEnter: onMouseEnter,
63
+ disabled: disabled || optionDisabled
64
+ });
65
+ }));
66
+ });
67
+
68
+ exports.default = RadioGroup;
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "../esm/RadioGroup/index.js",
4
+ "main": "./index.js",
5
+ "types": "./index.d.ts"
6
+ }
package/Theme/global.css CHANGED
@@ -17,6 +17,9 @@
17
17
  margin: 0;
18
18
  padding: 0;
19
19
  }
20
+ [data-page=colibri-ui] *, [data-page=colibri-ui] *::before, [data-page=colibri-ui] *::after {
21
+ box-sizing: inherit;
22
+ }
20
23
  [data-page=colibri-ui] input,
21
24
  [data-page=colibri-ui] textarea,
22
25
  [data-page=colibri-ui] select,
package/Theme/index.d.ts CHANGED
@@ -73,6 +73,11 @@ export declare const THEMES: {
73
73
  "checkbox-primary-border-color-active": string;
74
74
  "checkbox-primary-box-shadow-active": string;
75
75
  "checkbox-primary-background-color-disabled": string;
76
+ "inputradio-primary-background-color-checked": string;
77
+ "inputradio-primary-background-color-hovered": string;
78
+ "inputradio-primary-box-shadow-focused": string;
79
+ "inputradio-primary-background-color-focused": string;
80
+ "inputradio-primary-border-color-focused": string;
76
81
  "switch-primary-background-color": string;
77
82
  "switch-primary-border-color": string;
78
83
  "switch-primary-background-color-checked": string;
@@ -72,6 +72,11 @@ declare const _default: {
72
72
  "checkbox-primary-border-color-active": string;
73
73
  "checkbox-primary-box-shadow-active": string;
74
74
  "checkbox-primary-background-color-disabled": string;
75
+ "inputradio-primary-background-color-checked": string;
76
+ "inputradio-primary-background-color-hovered": string;
77
+ "inputradio-primary-box-shadow-focused": string;
78
+ "inputradio-primary-background-color-focused": string;
79
+ "inputradio-primary-border-color-focused": string;
75
80
  "switch-primary-background-color": string;
76
81
  "switch-primary-border-color": string;
77
82
  "switch-primary-background-color-checked": string;
@@ -78,6 +78,11 @@ var THEME_DEFAULT = {
78
78
  "checkbox-primary-border-color-active": color.Color.PRIMARY_4,
79
79
  "checkbox-primary-box-shadow-active": color.Color.PRIMARY_4,
80
80
  "checkbox-primary-background-color-disabled": color.Color.PRIMARY_1,
81
+ "inputradio-primary-background-color-checked": color.Color.PRIMARY_4,
82
+ "inputradio-primary-background-color-hovered": color.Color.PRIMARY_4,
83
+ "inputradio-primary-box-shadow-focused": color.Color.PRIMARY_1,
84
+ "inputradio-primary-background-color-focused": color.Color.PRIMARY_1,
85
+ "inputradio-primary-border-color-focused": color.Color.PRIMARY_1,
81
86
  "switch-primary-background-color": color.Color.BG_2,
82
87
  "switch-primary-border-color": color.Color.BG_2,
83
88
  "switch-primary-background-color-checked": color.Color.PRIMARY_5,
@@ -1,4 +1,4 @@
1
- import { CSSProperties } from "react";
1
+ import type { CSSProperties } from "react";
2
2
  export type TypographyVariant = "alert" | "success" | "secondary";
3
3
  export type TypographyFontWeight = "normal" | "medium" | "bold";
4
4
  export type TypographySize = "xs" | "s" | "m" | "l" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
@@ -53,8 +53,8 @@
53
53
  }
54
54
 
55
55
  .variant_primary_error {
56
- border-color: red;
57
- box-shadow: 0 0 0 2px red;
56
+ border-color: var(--palette-alert);
57
+ box-shadow: 0 0 0 2px var(--palette-alert);
58
58
  }
59
59
  .variant_primary_checked::after {
60
60
  border-block-end: 2px solid var(--palette-white);
@@ -4,16 +4,6 @@
4
4
  width: 70px;
5
5
  }
6
6
 
7
- .dot {
8
- animation-duration: 1.6s;
9
- animation-iteration-count: infinite;
10
- animation-name: pending;
11
- background-color: var(--palette-black);
12
- border-radius: 5px;
13
- height: 10px;
14
- transform: scale(0);
15
- width: 10px;
16
- }
17
7
  @keyframes pending {
18
8
  0% {
19
9
  transform: scale(0);
@@ -25,6 +15,16 @@
25
15
  transform: scale(0);
26
16
  }
27
17
  }
18
+ .dot {
19
+ animation-duration: 1.6s;
20
+ animation-iteration-count: infinite;
21
+ animation-name: pending;
22
+ background-color: var(--palette-black);
23
+ border-radius: 5px;
24
+ height: 10px;
25
+ transform: scale(0);
26
+ width: 10px;
27
+ }
28
28
  .dot_first {
29
29
  animation-delay: 0s;
30
30
  }
@@ -0,0 +1,97 @@
1
+ .label {
2
+ display: inline-block;
3
+ vertical-align: baseline;
4
+ }
5
+
6
+ .text {
7
+ flex-basis: auto;
8
+ flex-grow: 1;
9
+ flex-shrink: 1;
10
+ line-height: 18px;
11
+ margin-inline-start: 8px;
12
+ }
13
+
14
+ .icon {
15
+ background-color: var(--palette-white);
16
+ block-size: 16px;
17
+ border: solid 1px var(--palette-bg-3);
18
+ border-radius: 100%;
19
+ box-sizing: border-box;
20
+ display: block;
21
+ flex-shrink: 0;
22
+ inline-size: 16px;
23
+ margin-block-start: 1px;
24
+ position: relative;
25
+ transition: border-color 0.16s ease, box-shadow 0.16s ease;
26
+ }
27
+
28
+ .container {
29
+ align-items: flex-start;
30
+ cursor: pointer;
31
+ display: flex;
32
+ padding: 3px 0;
33
+ }
34
+ .container_disabled {
35
+ cursor: inherit;
36
+ }
37
+ .container_error .text {
38
+ color: var(--palette-alert);
39
+ }
40
+ .container_error .icon {
41
+ border-color: var(--palette-alert);
42
+ box-shadow: 0 0 0 2px var(--palette-tretiary-2);
43
+ }
44
+
45
+ .input {
46
+ block-size: 1px;
47
+ border: 0;
48
+ clip: rect(0 0 0 0);
49
+ inline-size: 1px;
50
+ margin: -1px;
51
+ overflow: hidden;
52
+ padding: 0;
53
+ position: absolute;
54
+ }
55
+ .input:not(.input_disabled):not(.input_error):hover + .icon {
56
+ border-color: var(--inputradio-primary-background-color-hovered);
57
+ }
58
+ .input:not(.input_disabled):not(.input_error):focus + .icon {
59
+ box-shadow: 0 0 0 2px var(--inputradio-primary-box-shadow-focused);
60
+ }
61
+ .input:not(.input_disabled):not(.input_error):active + .icon {
62
+ background-color: var(--inputradio-primary-background-color-focused);
63
+ border-color: var(--inputradio-primary-border-color-focused);
64
+ box-shadow: 0 0 0 2px var(--inputradio-primary-box-shadow-focused);
65
+ }
66
+ .input:not(.input_disabled):not(.input_error) .input_checked:hover + .icon {
67
+ border-color: var(--inputradio-primary-background-color-hovered);
68
+ }
69
+ .input:not(.input_disabled):not(.input_error) .input_checked:active + .icon {
70
+ background-color: var(--palette-white);
71
+ border: 4px solid var(--inputradio-primary-background-color-checked);
72
+ }
73
+ .input_checked + .icon {
74
+ background-color: var(--palette-white);
75
+ border: 4px solid var(--inputradio-primary-background-color-checked);
76
+ }
77
+ .input_disabled + .icon {
78
+ border-radius: 50%;
79
+ }
80
+ .input_disabled + .icon::after {
81
+ background-color: rgba(246, 246, 246, 0.8);
82
+ content: "";
83
+ display: block;
84
+ inset: 0;
85
+ margin: -1px;
86
+ position: absolute;
87
+ border-radius: 50%;
88
+ }
89
+ .input_checked:disabled + .icon::after {
90
+ margin: -4px;
91
+ }
92
+
93
+ .note {
94
+ color: var(--palette-bg-5);
95
+ margin-block-start: 4px;
96
+ padding-inline-start: 24px;
97
+ }
@@ -0,0 +1,23 @@
1
+ import React from "react";
2
+ import type { FC, CSSProperties, PropsWithChildren, FocusEvent, ChangeEvent } from "react";
3
+ type Props = {
4
+ checked?: boolean;
5
+ className?: string;
6
+ containerClassName?: string;
7
+ disabled?: boolean;
8
+ error?: string;
9
+ id?: string;
10
+ name?: string;
11
+ note?: string;
12
+ onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
13
+ onFocus?: (event: FocusEvent<HTMLInputElement>) => void;
14
+ onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
15
+ onClick?: (event: React.MouseEvent<HTMLLabelElement, MouseEvent>) => void;
16
+ onMouseEnter?: (event: React.MouseEvent<HTMLLabelElement, MouseEvent>) => void;
17
+ style?: CSSProperties;
18
+ text?: string;
19
+ value: string | number;
20
+ testid?: string;
21
+ };
22
+ declare const InputRadio: FC<PropsWithChildren<Props>>;
23
+ export default InputRadio;
@@ -0,0 +1,66 @@
1
+ import { __rest, __assign } from 'tslib';
2
+ import React, { memo } from 'react';
3
+ import classNames from 'classnames/bind';
4
+ import Typography from '../Typography/index.js';
5
+ import styles from './InputRadio.module.css';
6
+
7
+ var clx = classNames.bind(styles);
8
+ var InputRadio = /*#__PURE__*/memo(function (_a) {
9
+ var checked = _a.checked,
10
+ children = _a.children,
11
+ className = _a.className,
12
+ containerClassName = _a.containerClassName,
13
+ disabled = _a.disabled,
14
+ error = _a.error,
15
+ id = _a.id,
16
+ name = _a.name,
17
+ note = _a.note,
18
+ onBlur = _a.onBlur,
19
+ onFocus = _a.onFocus,
20
+ onChange = _a.onChange,
21
+ onClick = _a.onClick,
22
+ onMouseEnter = _a.onMouseEnter,
23
+ style = _a.style,
24
+ text = _a.text,
25
+ value = _a.value,
26
+ testid = _a.testid,
27
+ rest = __rest(_a, ["checked", "children", "className", "containerClassName", "disabled", "error", "id", "name", "note", "onBlur", "onFocus", "onChange", "onClick", "onMouseEnter", "style", "text", "value", "testid"]);
28
+ return /*#__PURE__*/React.createElement("label", {
29
+ className: clx(styles.label, className),
30
+ htmlFor: id,
31
+ style: style,
32
+ onClick: onClick,
33
+ onMouseEnter: onMouseEnter,
34
+ "data-testid": testid
35
+ }, /*#__PURE__*/React.createElement("div", {
36
+ className: clx(styles.container, {
37
+ container_disabled: !!disabled,
38
+ container_error: !!error
39
+ }, containerClassName)
40
+ }, /*#__PURE__*/React.createElement("input", __assign({
41
+ type: "radio",
42
+ id: id,
43
+ value: value,
44
+ name: name,
45
+ className: clx(styles.input, {
46
+ input_error: !!error,
47
+ input_checked: !!checked,
48
+ input_disabled: !!disabled
49
+ }),
50
+ checked: checked,
51
+ disabled: disabled,
52
+ onChange: onChange,
53
+ onFocus: onFocus,
54
+ onBlur: onBlur
55
+ }, rest)), /*#__PURE__*/React.createElement("span", {
56
+ className: clx(styles.icon)
57
+ }), /*#__PURE__*/React.createElement("span", {
58
+ className: clx(styles.text)
59
+ }, !children && text, !text && children)), !!note && ( /*#__PURE__*/React.createElement(Typography, {
60
+ tag: "p",
61
+ size: "s",
62
+ className: clx(styles.note)
63
+ }, note)));
64
+ });
65
+
66
+ export { InputRadio as default };
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ import type { ChangeEvent, FC, FocusEvent } from "react";
3
+ type Props = {
4
+ value: string | number;
5
+ text: string;
6
+ id?: string;
7
+ note?: string;
8
+ name?: string;
9
+ checked?: boolean;
10
+ onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
11
+ onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
12
+ onClick?: (event: React.MouseEvent<HTMLLabelElement, MouseEvent>) => void;
13
+ onMouseEnter?: (event: React.MouseEvent<HTMLLabelElement, MouseEvent>) => void;
14
+ className: string;
15
+ disabled?: boolean;
16
+ testId?: string;
17
+ };
18
+ declare const Radio: FC<Props>;
19
+ export default Radio;
@@ -0,0 +1,37 @@
1
+ import React from 'react';
2
+ import InputRadio from '../InputRadio/index.js';
3
+
4
+ var Radio = function Radio(_a) {
5
+ var id = _a.id,
6
+ value = _a.value,
7
+ text = _a.text,
8
+ note = _a.note,
9
+ name = _a.name,
10
+ _b = _a.checked,
11
+ checked = _b === void 0 ? false : _b,
12
+ onChange = _a.onChange,
13
+ onBlur = _a.onBlur,
14
+ onClick = _a.onClick,
15
+ onMouseEnter = _a.onMouseEnter,
16
+ className = _a.className,
17
+ _c = _a.disabled,
18
+ disabled = _c === void 0 ? false : _c,
19
+ testId = _a.testId;
20
+ return /*#__PURE__*/React.createElement(InputRadio, {
21
+ id: id,
22
+ value: value,
23
+ checked: checked,
24
+ onChange: onChange,
25
+ onBlur: onBlur,
26
+ onClick: onClick,
27
+ onMouseEnter: onMouseEnter,
28
+ text: text,
29
+ note: note,
30
+ name: name,
31
+ className: className,
32
+ disabled: disabled,
33
+ testid: testId
34
+ });
35
+ };
36
+
37
+ export { Radio as default };
@@ -0,0 +1,30 @@
1
+ .group {
2
+ display: inline-flex;
3
+ }
4
+ .group_wide {
5
+ inline-size: 100%;
6
+ }
7
+ .group_column {
8
+ flex-direction: column;
9
+ }
10
+ .group_column .radio:not(:last-child) {
11
+ margin-block-end: 16px;
12
+ }
13
+ .group_wrapped {
14
+ flex-wrap: wrap;
15
+ }
16
+ .group_wrapped .radio {
17
+ inline-size: 100%;
18
+ margin: 8px auto;
19
+ }
20
+ .group_wrapped .radio:first-child {
21
+ margin-block-start: 0;
22
+ }
23
+ .group_wrapped .radio:last-child {
24
+ margin-block-end: 0;
25
+ }
26
+
27
+ .radio {
28
+ line-height: 16px;
29
+ margin-inline-end: 20px;
30
+ }
@@ -0,0 +1,26 @@
1
+ import React, { FC } from "react";
2
+ export interface Option {
3
+ id?: string;
4
+ val: string | number;
5
+ text: string;
6
+ note?: string;
7
+ name?: string;
8
+ tooltipContent?: () => React.ReactElement;
9
+ onClick?: (event: React.MouseEvent<HTMLLabelElement, MouseEvent>) => void;
10
+ onMouseEnter?: (event: React.MouseEvent<HTMLLabelElement, MouseEvent>) => void;
11
+ className?: string;
12
+ disabled?: boolean;
13
+ }
14
+ interface Props {
15
+ val?: string | number;
16
+ options: Option[];
17
+ onChange: (value: string) => void;
18
+ onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
19
+ column?: boolean;
20
+ wrapped?: boolean;
21
+ className?: string;
22
+ disabled?: boolean;
23
+ hasError?: boolean;
24
+ }
25
+ declare const RadioGroup: FC<Props>;
26
+ export default RadioGroup;
@@ -0,0 +1,58 @@
1
+ import React, { memo } from 'react';
2
+ import classNames from 'classnames/bind';
3
+ import Radio from './Radio.js';
4
+ import styles from './RadioGroup.module.css';
5
+
6
+ var clx = classNames.bind(styles);
7
+ var RadioGroup = /*#__PURE__*/memo(function (_a) {
8
+ var val = _a.val,
9
+ options = _a.options,
10
+ _onChange = _a.onChange,
11
+ onBlur = _a.onBlur,
12
+ _b = _a.column,
13
+ column = _b === void 0 ? false : _b,
14
+ _c = _a.wrapped,
15
+ wrapped = _c === void 0 ? false : _c,
16
+ className = _a.className,
17
+ _d = _a.disabled,
18
+ disabled = _d === void 0 ? false : _d,
19
+ _e = _a.hasError,
20
+ hasError = _e === void 0 ? false : _e;
21
+ return /*#__PURE__*/React.createElement("div", {
22
+ className: clx(styles.group, {
23
+ column: column,
24
+ wrapped: wrapped,
25
+ hasError: hasError
26
+ }, className)
27
+ }, options.map(function (option) {
28
+ var id = option.id,
29
+ optionVal = option.val,
30
+ text = option.text,
31
+ note = option.note,
32
+ name = option.name,
33
+ onClick = option.onClick,
34
+ onMouseEnter = option.onMouseEnter,
35
+ optionClassName = option.className,
36
+ optionDisabled = option.disabled;
37
+ return /*#__PURE__*/React.createElement(Radio, {
38
+ key: optionVal,
39
+ id: id,
40
+ testId: id,
41
+ value: optionVal,
42
+ text: text,
43
+ note: note,
44
+ name: name,
45
+ className: clx(styles.radio, optionClassName),
46
+ checked: val === optionVal,
47
+ onChange: function onChange(e) {
48
+ return _onChange(e.target.value);
49
+ },
50
+ onBlur: onBlur,
51
+ onClick: onClick,
52
+ onMouseEnter: onMouseEnter,
53
+ disabled: disabled || optionDisabled
54
+ });
55
+ }));
56
+ });
57
+
58
+ export { RadioGroup as default };
@@ -17,6 +17,9 @@
17
17
  margin: 0;
18
18
  padding: 0;
19
19
  }
20
+ [data-page=colibri-ui] *, [data-page=colibri-ui] *::before, [data-page=colibri-ui] *::after {
21
+ box-sizing: inherit;
22
+ }
20
23
  [data-page=colibri-ui] input,
21
24
  [data-page=colibri-ui] textarea,
22
25
  [data-page=colibri-ui] select,
@@ -73,6 +73,11 @@ export declare const THEMES: {
73
73
  "checkbox-primary-border-color-active": string;
74
74
  "checkbox-primary-box-shadow-active": string;
75
75
  "checkbox-primary-background-color-disabled": string;
76
+ "inputradio-primary-background-color-checked": string;
77
+ "inputradio-primary-background-color-hovered": string;
78
+ "inputradio-primary-box-shadow-focused": string;
79
+ "inputradio-primary-background-color-focused": string;
80
+ "inputradio-primary-border-color-focused": string;
76
81
  "switch-primary-background-color": string;
77
82
  "switch-primary-border-color": string;
78
83
  "switch-primary-background-color-checked": string;
@@ -72,6 +72,11 @@ declare const _default: {
72
72
  "checkbox-primary-border-color-active": string;
73
73
  "checkbox-primary-box-shadow-active": string;
74
74
  "checkbox-primary-background-color-disabled": string;
75
+ "inputradio-primary-background-color-checked": string;
76
+ "inputradio-primary-background-color-hovered": string;
77
+ "inputradio-primary-box-shadow-focused": string;
78
+ "inputradio-primary-background-color-focused": string;
79
+ "inputradio-primary-border-color-focused": string;
75
80
  "switch-primary-background-color": string;
76
81
  "switch-primary-border-color": string;
77
82
  "switch-primary-background-color-checked": string;
@@ -74,6 +74,11 @@ var THEME_DEFAULT = {
74
74
  "checkbox-primary-border-color-active": Color.PRIMARY_4,
75
75
  "checkbox-primary-box-shadow-active": Color.PRIMARY_4,
76
76
  "checkbox-primary-background-color-disabled": Color.PRIMARY_1,
77
+ "inputradio-primary-background-color-checked": Color.PRIMARY_4,
78
+ "inputradio-primary-background-color-hovered": Color.PRIMARY_4,
79
+ "inputradio-primary-box-shadow-focused": Color.PRIMARY_1,
80
+ "inputradio-primary-background-color-focused": Color.PRIMARY_1,
81
+ "inputradio-primary-border-color-focused": Color.PRIMARY_1,
77
82
  "switch-primary-background-color": Color.BG_2,
78
83
  "switch-primary-border-color": Color.BG_2,
79
84
  "switch-primary-background-color-checked": Color.PRIMARY_5,
@@ -1,4 +1,4 @@
1
- import { CSSProperties } from "react";
1
+ import type { CSSProperties } from "react";
2
2
  export type TypographyVariant = "alert" | "success" | "secondary";
3
3
  export type TypographyFontWeight = "normal" | "medium" | "bold";
4
4
  export type TypographySize = "xs" | "s" | "m" | "l" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
package/esm/index.d.ts CHANGED
@@ -11,6 +11,7 @@ export { default as Input } from "./Input";
11
11
  export { default as Menu } from "./Menu";
12
12
  export { default as Modal } from "./Modal";
13
13
  export { default as Portal } from "./Portal";
14
+ export { default as RadioGroup } from './RadioGroup';
14
15
  export { default as Select } from "./Select";
15
16
  export { default as Separator } from "./Separator";
16
17
  export { SkeletonText, SkeletonRect } from "./Skeleton";
package/esm/index.js CHANGED
@@ -11,6 +11,7 @@ export { default as Input } from './Input/index.js';
11
11
  export { default as Menu } from './Menu/index.js';
12
12
  export { default as Modal } from './Modal/index.js';
13
13
  export { default as Portal } from './Portal/index.js';
14
+ export { default as RadioGroup } from './RadioGroup/index.js';
14
15
  export { default as Select } from './Select/index.js';
15
16
  export { default as Separator } from './Separator/index.js';
16
17
  export { SkeletonRect, SkeletonText } from './Skeleton/index.js';
@@ -72,6 +72,11 @@
72
72
  --checkbox-primary-border-color-active: #067AFF;
73
73
  --checkbox-primary-box-shadow-active: #067AFF;
74
74
  --checkbox-primary-background-color-disabled: #E8F0FE;
75
+ --inputradio-primary-background-color-checked: #067AFF;
76
+ --inputradio-primary-background-color-hovered: #067AFF;
77
+ --inputradio-primary-box-shadow-focused: #E8F0FE;
78
+ --inputradio-primary-background-color-focused: #E8F0FE;
79
+ --inputradio-primary-border-color-focused: #E8F0FE;
75
80
  --switch-primary-background-color: #e6e6e6;
76
81
  --switch-primary-border-color: #e6e6e6;
77
82
  --switch-primary-background-color-checked: #0066DC;
package/index.d.ts CHANGED
@@ -11,6 +11,7 @@ export { default as Input } from "./Input";
11
11
  export { default as Menu } from "./Menu";
12
12
  export { default as Modal } from "./Modal";
13
13
  export { default as Portal } from "./Portal";
14
+ export { default as RadioGroup } from './RadioGroup';
14
15
  export { default as Select } from "./Select";
15
16
  export { default as Separator } from "./Separator";
16
17
  export { SkeletonText, SkeletonRect } from "./Skeleton";
package/index.js CHANGED
@@ -13,13 +13,14 @@ var index$9 = require('./Input/index.js');
13
13
  var index$a = require('./Menu/index.js');
14
14
  var index$b = require('./Modal/index.js');
15
15
  var index$c = require('./Portal/index.js');
16
- var index$d = require('./Select/index.js');
17
- var index$e = require('./Separator/index.js');
18
- var index$f = require('./Skeleton/index.js');
19
- var index$g = require('./Switch/index.js');
20
- var index$h = require('./Theme/index.js');
21
- var index$i = require('./Typography/index.js');
22
- var index$j = require('./hooks/useMediaSizes/index.js');
16
+ var index$d = require('./RadioGroup/index.js');
17
+ var index$e = require('./Select/index.js');
18
+ var index$f = require('./Separator/index.js');
19
+ var index$g = require('./Skeleton/index.js');
20
+ var index$h = require('./Switch/index.js');
21
+ var index$i = require('./Theme/index.js');
22
+ var index$j = require('./Typography/index.js');
23
+ var index$k = require('./hooks/useMediaSizes/index.js');
23
24
  require('./Icons/index.js');
24
25
  var Cart = require('./Icons/Cart.js');
25
26
  var Chevron = require('./Icons/Chevron.js');
@@ -49,14 +50,15 @@ exports.Input = index$9.default;
49
50
  exports.Menu = index$a.default;
50
51
  exports.Modal = index$b.default;
51
52
  exports.Portal = index$c.default;
52
- exports.Select = index$d.default;
53
- exports.Separator = index$e.default;
54
- exports.SkeletonRect = index$f.SkeletonRect;
55
- exports.SkeletonText = index$f.SkeletonText;
56
- exports.Switch = index$g.default;
57
- exports.THEMES = index$h.THEMES;
58
- exports.Typography = index$i.default;
59
- exports.useMediaSizes = index$j.default;
53
+ exports.RadioGroup = index$d.default;
54
+ exports.Select = index$e.default;
55
+ exports.Separator = index$f.default;
56
+ exports.SkeletonRect = index$g.SkeletonRect;
57
+ exports.SkeletonText = index$g.SkeletonText;
58
+ exports.Switch = index$h.default;
59
+ exports.THEMES = index$i.THEMES;
60
+ exports.Typography = index$j.default;
61
+ exports.useMediaSizes = index$k.default;
60
62
  exports.Cart = Cart.default;
61
63
  exports.Chevron = Chevron.default;
62
64
  exports.Close = Close.default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "colibri-ui",
3
- "version": "0.7.54",
3
+ "version": "0.7.56",
4
4
  "description": "React UI components library",
5
5
  "main": "index.js",
6
6
  "scripts": {},
@@ -24,7 +24,6 @@
24
24
  "dependencies": {
25
25
  "@popperjs/core": "^2.11.8",
26
26
  "classnames": "^2.5.1",
27
- "cssmem": "^1.3.0",
28
27
  "react": "^17.0.0 || ^18.0.0",
29
28
  "react-dom": "^17.0.0 || ^18.0.0",
30
29
  "react-popper": "^2.3.0"
@@ -72,6 +72,11 @@
72
72
  --checkbox-primary-border-color-active: #067AFF;
73
73
  --checkbox-primary-box-shadow-active: #067AFF;
74
74
  --checkbox-primary-background-color-disabled: #E8F0FE;
75
+ --inputradio-primary-background-color-checked: #067AFF;
76
+ --inputradio-primary-background-color-hovered: #067AFF;
77
+ --inputradio-primary-box-shadow-focused: #E8F0FE;
78
+ --inputradio-primary-background-color-focused: #E8F0FE;
79
+ --inputradio-primary-border-color-focused: #E8F0FE;
75
80
  --switch-primary-background-color: #e6e6e6;
76
81
  --switch-primary-border-color: #e6e6e6;
77
82
  --switch-primary-background-color-checked: #0066DC;