@alfalab/core-components-radio-group 2.7.1 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{dist/esm/Component.d.ts → Component.d.ts} +9 -1
- package/{dist/Component.js → Component.js} +3 -3
- package/{dist → cssm}/Component.d.ts +9 -1
- package/{dist/cssm → cssm}/Component.js +2 -2
- package/{dist/cssm → cssm}/index.d.ts +0 -0
- package/{dist/cssm → cssm}/index.js +0 -0
- package/{dist/cssm → cssm}/index.module.css +0 -0
- package/{dist/modern → esm}/Component.d.ts +9 -1
- package/{dist/esm → esm}/Component.js +3 -3
- package/{dist/esm → esm}/index.css +17 -17
- package/{dist/esm → esm}/index.d.ts +0 -0
- package/{dist/esm → esm}/index.js +0 -0
- package/{dist/index.css → index.css} +17 -17
- package/{dist/index.d.ts → index.d.ts} +0 -0
- package/{dist/index.js → index.js} +0 -0
- package/{dist/cssm → modern}/Component.d.ts +9 -1
- package/{dist/modern → modern}/Component.js +3 -3
- package/{dist/modern → modern}/index.css +17 -17
- package/{dist/modern → modern}/index.d.ts +0 -0
- package/{dist/modern → modern}/index.js +0 -0
- package/package.json +7 -10
- package/{dist/send-stats.js → send-stats.js} +0 -0
- package/CHANGELOG.md +0 -215
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { ReactNode, ChangeEvent, MouseEvent } from "react";
|
|
3
|
+
import { ReactNode, ChangeEvent, MouseEvent, FocusEvent } from "react";
|
|
4
4
|
type Direction = 'horizontal' | 'vertical';
|
|
5
5
|
type RadioGroupType = 'radio' | 'tag';
|
|
6
6
|
type RadioGroupProps = {
|
|
@@ -39,6 +39,14 @@ type RadioGroupProps = {
|
|
|
39
39
|
value: string;
|
|
40
40
|
name?: string;
|
|
41
41
|
}) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Обработчик блюра.
|
|
44
|
+
*/
|
|
45
|
+
onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
46
|
+
/**
|
|
47
|
+
* Обработчик фокуса.
|
|
48
|
+
*/
|
|
49
|
+
onFocus?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
42
50
|
/**
|
|
43
51
|
* Управление возможностью изменения состояния 'checked' дочерних компонентов Radio | Tag
|
|
44
52
|
*/
|
|
@@ -37,12 +37,12 @@ var __assign = function () {
|
|
|
37
37
|
return __assign.apply(this, arguments);
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
var styles = {"component":"radio-
|
|
40
|
+
var styles = {"component":"radio-group__component_1orgk","error":"radio-group__error_1orgk","radioList":"radio-group__radioList_1orgk","vertical":"radio-group__vertical_1orgk","radio":"radio-group__radio_1orgk","horizontal":"radio-group__horizontal_1orgk","tag":"radio-group__tag_1orgk","tagLabel":"radio-group__tagLabel_1orgk","label":"radio-group__label_1orgk","sub":"radio-group__sub_1orgk","errorMessage":"radio-group__errorMessage_1orgk","hint":"radio-group__hint_1orgk","hiddenInput":"radio-group__hiddenInput_1orgk"};
|
|
41
41
|
require('./index.css')
|
|
42
42
|
|
|
43
43
|
var RadioGroup = React.forwardRef(function (_a, ref) {
|
|
44
44
|
var _b;
|
|
45
|
-
var children = _a.children, className = _a.className, _c = _a.direction, direction = _c === void 0 ? 'vertical' : _c, label = _a.label, error = _a.error, hint = _a.hint, onChange = _a.onChange, _d = _a.type, type = _d === void 0 ? 'radio' : _d, dataTestId = _a.dataTestId, _e = _a.disabled, disabled = _e === void 0 ? false : _e, name = _a.name, value = _a.value;
|
|
45
|
+
var children = _a.children, className = _a.className, _c = _a.direction, direction = _c === void 0 ? 'vertical' : _c, label = _a.label, error = _a.error, hint = _a.hint, onChange = _a.onChange, onBlur = _a.onBlur, onFocus = _a.onFocus, _d = _a.type, type = _d === void 0 ? 'radio' : _d, dataTestId = _a.dataTestId, _e = _a.disabled, disabled = _e === void 0 ? false : _e, name = _a.name, value = _a.value;
|
|
46
46
|
var _f = React.useState(''), stateValue = _f[0], setStateValue = _f[1];
|
|
47
47
|
var renderRadio = function (child) {
|
|
48
48
|
var childClassName = child.props.className;
|
|
@@ -75,7 +75,7 @@ var RadioGroup = React.forwardRef(function (_a, ref) {
|
|
|
75
75
|
var errorMessage = typeof error === 'boolean' ? '' : error;
|
|
76
76
|
return (React__default['default'].createElement("div", { className: cn__default['default'](styles.component, styles[type], styles[direction], (_b = {}, _b[styles.error] = error, _b), className), "data-test-id": dataTestId, ref: ref },
|
|
77
77
|
label ? React__default['default'].createElement("span", { className: styles.label }, label) : null,
|
|
78
|
-
children ? (React__default['default'].createElement("div", { className: styles.radioList }, React.Children.map(children, function (child) {
|
|
78
|
+
children ? (React__default['default'].createElement("div", { className: styles.radioList, onBlur: onBlur, onFocus: onFocus }, React.Children.map(children, function (child) {
|
|
79
79
|
if (React.isValidElement(child)) {
|
|
80
80
|
return type === 'radio' ? renderRadio(child) : renderTag(child);
|
|
81
81
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { ReactNode, ChangeEvent, MouseEvent } from "react";
|
|
3
|
+
import { ReactNode, ChangeEvent, MouseEvent, FocusEvent } from "react";
|
|
4
4
|
type Direction = 'horizontal' | 'vertical';
|
|
5
5
|
type RadioGroupType = 'radio' | 'tag';
|
|
6
6
|
type RadioGroupProps = {
|
|
@@ -39,6 +39,14 @@ type RadioGroupProps = {
|
|
|
39
39
|
value: string;
|
|
40
40
|
name?: string;
|
|
41
41
|
}) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Обработчик блюра.
|
|
44
|
+
*/
|
|
45
|
+
onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
46
|
+
/**
|
|
47
|
+
* Обработчик фокуса.
|
|
48
|
+
*/
|
|
49
|
+
onFocus?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
42
50
|
/**
|
|
43
51
|
* Управление возможностью изменения состояния 'checked' дочерних компонентов Radio | Tag
|
|
44
52
|
*/
|
|
@@ -41,7 +41,7 @@ var __assign = function () {
|
|
|
41
41
|
|
|
42
42
|
var RadioGroup = React.forwardRef(function (_a, ref) {
|
|
43
43
|
var _b;
|
|
44
|
-
var children = _a.children, className = _a.className, _c = _a.direction, direction = _c === void 0 ? 'vertical' : _c, label = _a.label, error = _a.error, hint = _a.hint, onChange = _a.onChange, _d = _a.type, type = _d === void 0 ? 'radio' : _d, dataTestId = _a.dataTestId, _e = _a.disabled, disabled = _e === void 0 ? false : _e, name = _a.name, value = _a.value;
|
|
44
|
+
var children = _a.children, className = _a.className, _c = _a.direction, direction = _c === void 0 ? 'vertical' : _c, label = _a.label, error = _a.error, hint = _a.hint, onChange = _a.onChange, onBlur = _a.onBlur, onFocus = _a.onFocus, _d = _a.type, type = _d === void 0 ? 'radio' : _d, dataTestId = _a.dataTestId, _e = _a.disabled, disabled = _e === void 0 ? false : _e, name = _a.name, value = _a.value;
|
|
45
45
|
var _f = React.useState(''), stateValue = _f[0], setStateValue = _f[1];
|
|
46
46
|
var renderRadio = function (child) {
|
|
47
47
|
var childClassName = child.props.className;
|
|
@@ -74,7 +74,7 @@ var RadioGroup = React.forwardRef(function (_a, ref) {
|
|
|
74
74
|
var errorMessage = typeof error === 'boolean' ? '' : error;
|
|
75
75
|
return (React__default['default'].createElement("div", { className: cn__default['default'](styles__default['default'].component, styles__default['default'][type], styles__default['default'][direction], (_b = {}, _b[styles__default['default'].error] = error, _b), className), "data-test-id": dataTestId, ref: ref },
|
|
76
76
|
label ? React__default['default'].createElement("span", { className: styles__default['default'].label }, label) : null,
|
|
77
|
-
children ? (React__default['default'].createElement("div", { className: styles__default['default'].radioList }, React.Children.map(children, function (child) {
|
|
77
|
+
children ? (React__default['default'].createElement("div", { className: styles__default['default'].radioList, onBlur: onBlur, onFocus: onFocus }, React.Children.map(children, function (child) {
|
|
78
78
|
if (React.isValidElement(child)) {
|
|
79
79
|
return type === 'radio' ? renderRadio(child) : renderTag(child);
|
|
80
80
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { ReactNode, ChangeEvent, MouseEvent } from "react";
|
|
3
|
+
import { ReactNode, ChangeEvent, MouseEvent, FocusEvent } from "react";
|
|
4
4
|
type Direction = 'horizontal' | 'vertical';
|
|
5
5
|
type RadioGroupType = 'radio' | 'tag';
|
|
6
6
|
type RadioGroupProps = {
|
|
@@ -39,6 +39,14 @@ type RadioGroupProps = {
|
|
|
39
39
|
value: string;
|
|
40
40
|
name?: string;
|
|
41
41
|
}) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Обработчик блюра.
|
|
44
|
+
*/
|
|
45
|
+
onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
46
|
+
/**
|
|
47
|
+
* Обработчик фокуса.
|
|
48
|
+
*/
|
|
49
|
+
onFocus?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
42
50
|
/**
|
|
43
51
|
* Управление возможностью изменения состояния 'checked' дочерних компонентов Radio | Tag
|
|
44
52
|
*/
|
|
@@ -28,12 +28,12 @@ var __assign = function () {
|
|
|
28
28
|
return __assign.apply(this, arguments);
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
var styles = {"component":"radio-
|
|
31
|
+
var styles = {"component":"radio-group__component_1orgk","error":"radio-group__error_1orgk","radioList":"radio-group__radioList_1orgk","vertical":"radio-group__vertical_1orgk","radio":"radio-group__radio_1orgk","horizontal":"radio-group__horizontal_1orgk","tag":"radio-group__tag_1orgk","tagLabel":"radio-group__tagLabel_1orgk","label":"radio-group__label_1orgk","sub":"radio-group__sub_1orgk","errorMessage":"radio-group__errorMessage_1orgk","hint":"radio-group__hint_1orgk","hiddenInput":"radio-group__hiddenInput_1orgk"};
|
|
32
32
|
require('./index.css')
|
|
33
33
|
|
|
34
34
|
var RadioGroup = forwardRef(function (_a, ref) {
|
|
35
35
|
var _b;
|
|
36
|
-
var children = _a.children, className = _a.className, _c = _a.direction, direction = _c === void 0 ? 'vertical' : _c, label = _a.label, error = _a.error, hint = _a.hint, onChange = _a.onChange, _d = _a.type, type = _d === void 0 ? 'radio' : _d, dataTestId = _a.dataTestId, _e = _a.disabled, disabled = _e === void 0 ? false : _e, name = _a.name, value = _a.value;
|
|
36
|
+
var children = _a.children, className = _a.className, _c = _a.direction, direction = _c === void 0 ? 'vertical' : _c, label = _a.label, error = _a.error, hint = _a.hint, onChange = _a.onChange, onBlur = _a.onBlur, onFocus = _a.onFocus, _d = _a.type, type = _d === void 0 ? 'radio' : _d, dataTestId = _a.dataTestId, _e = _a.disabled, disabled = _e === void 0 ? false : _e, name = _a.name, value = _a.value;
|
|
37
37
|
var _f = useState(''), stateValue = _f[0], setStateValue = _f[1];
|
|
38
38
|
var renderRadio = function (child) {
|
|
39
39
|
var childClassName = child.props.className;
|
|
@@ -66,7 +66,7 @@ var RadioGroup = forwardRef(function (_a, ref) {
|
|
|
66
66
|
var errorMessage = typeof error === 'boolean' ? '' : error;
|
|
67
67
|
return (React.createElement("div", { className: cn(styles.component, styles[type], styles[direction], (_b = {}, _b[styles.error] = error, _b), className), "data-test-id": dataTestId, ref: ref },
|
|
68
68
|
label ? React.createElement("span", { className: styles.label }, label) : null,
|
|
69
|
-
children ? (React.createElement("div", { className: styles.radioList }, Children.map(children, function (child) {
|
|
69
|
+
children ? (React.createElement("div", { className: styles.radioList, onBlur: onBlur, onFocus: onFocus }, Children.map(children, function (child) {
|
|
70
70
|
if (isValidElement(child)) {
|
|
71
71
|
return type === 'radio' ? renderRadio(child) : renderTag(child);
|
|
72
72
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: t9ghx */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-text-negative: #d91d0b;
|
|
4
4
|
--color-light-text-primary: #0b1f35;
|
|
@@ -25,68 +25,68 @@
|
|
|
25
25
|
--radio-group-hint-color: var(--color-light-text-secondary);
|
|
26
26
|
--radio-group-label-color: var(--color-light-text-primary);
|
|
27
27
|
}
|
|
28
|
-
.radio-
|
|
28
|
+
.radio-group__component_1orgk {
|
|
29
29
|
display: flex;
|
|
30
30
|
flex-direction: column;
|
|
31
31
|
}
|
|
32
|
-
.radio-
|
|
32
|
+
.radio-group__error_1orgk {
|
|
33
33
|
padding-left: var(--gap-xs);
|
|
34
34
|
border-left: 1px solid var(--radio-group-error-color);
|
|
35
35
|
}
|
|
36
|
-
.radio-
|
|
36
|
+
.radio-group__radioList_1orgk {
|
|
37
37
|
display: flex;
|
|
38
38
|
}
|
|
39
|
-
.radio-
|
|
39
|
+
.radio-group__vertical_1orgk .radio-group__radioList_1orgk {
|
|
40
40
|
flex-direction: column;
|
|
41
41
|
align-items: flex-start;
|
|
42
42
|
}
|
|
43
|
-
.radio-
|
|
43
|
+
.radio-group__vertical_1orgk .radio-group__radio_1orgk {
|
|
44
44
|
margin-bottom: var(--gap-m)
|
|
45
45
|
}
|
|
46
|
-
.radio-
|
|
46
|
+
.radio-group__vertical_1orgk .radio-group__radio_1orgk:last-child {
|
|
47
47
|
margin-bottom: 0;
|
|
48
48
|
}
|
|
49
|
-
.radio-
|
|
49
|
+
.radio-group__horizontal_1orgk .radio-group__radioList_1orgk {
|
|
50
50
|
flex-wrap: wrap;
|
|
51
51
|
margin-right: var(--gap-xl-neg);
|
|
52
52
|
margin-bottom: var(--gap-xs-neg);
|
|
53
53
|
}
|
|
54
|
-
.radio-
|
|
54
|
+
.radio-group__tag_1orgk.radio-group__horizontal_1orgk .radio-group__radioList_1orgk {
|
|
55
55
|
margin-right: var(--gap-xs-neg);
|
|
56
56
|
}
|
|
57
|
-
.radio-
|
|
57
|
+
.radio-group__horizontal_1orgk .radio-group__radio_1orgk {
|
|
58
58
|
margin-right: var(--gap-xl);
|
|
59
59
|
margin-bottom: var(--gap-xs);
|
|
60
60
|
}
|
|
61
|
-
.radio-
|
|
61
|
+
.radio-group__horizontal_1orgk .radio-group__tagLabel_1orgk {
|
|
62
62
|
margin-right: var(--gap-xs);
|
|
63
63
|
}
|
|
64
|
-
.radio-
|
|
64
|
+
.radio-group__label_1orgk {
|
|
65
65
|
font-size: 16px;
|
|
66
66
|
line-height: 24px;
|
|
67
67
|
font-weight: 400;
|
|
68
68
|
margin-bottom: var(--gap-s);
|
|
69
69
|
color: var(--radio-group-label-color);
|
|
70
70
|
}
|
|
71
|
-
.radio-
|
|
71
|
+
.radio-group__sub_1orgk {
|
|
72
72
|
font-size: 14px;
|
|
73
73
|
line-height: 18px;
|
|
74
74
|
font-weight: 400;
|
|
75
75
|
margin-top: var(--gap-s);
|
|
76
76
|
}
|
|
77
|
-
.radio-
|
|
77
|
+
.radio-group__errorMessage_1orgk {
|
|
78
78
|
color: var(--radio-group-error-color);
|
|
79
79
|
}
|
|
80
|
-
.radio-
|
|
80
|
+
.radio-group__hint_1orgk {
|
|
81
81
|
color: var(--radio-group-hint-color);
|
|
82
82
|
}
|
|
83
|
-
.radio-
|
|
83
|
+
.radio-group__hiddenInput_1orgk {
|
|
84
84
|
position: absolute;
|
|
85
85
|
z-index: -1;
|
|
86
86
|
top: 0;
|
|
87
87
|
left: 0;
|
|
88
88
|
opacity: 0;
|
|
89
89
|
}
|
|
90
|
-
.radio-
|
|
90
|
+
.radio-group__tagLabel_1orgk {
|
|
91
91
|
position: relative;
|
|
92
92
|
}
|
|
File without changes
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: t9ghx */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-text-negative: #d91d0b;
|
|
4
4
|
--color-light-text-primary: #0b1f35;
|
|
@@ -25,68 +25,68 @@
|
|
|
25
25
|
--radio-group-hint-color: var(--color-light-text-secondary);
|
|
26
26
|
--radio-group-label-color: var(--color-light-text-primary);
|
|
27
27
|
}
|
|
28
|
-
.radio-
|
|
28
|
+
.radio-group__component_1orgk {
|
|
29
29
|
display: flex;
|
|
30
30
|
flex-direction: column;
|
|
31
31
|
}
|
|
32
|
-
.radio-
|
|
32
|
+
.radio-group__error_1orgk {
|
|
33
33
|
padding-left: var(--gap-xs);
|
|
34
34
|
border-left: 1px solid var(--radio-group-error-color);
|
|
35
35
|
}
|
|
36
|
-
.radio-
|
|
36
|
+
.radio-group__radioList_1orgk {
|
|
37
37
|
display: flex;
|
|
38
38
|
}
|
|
39
|
-
.radio-
|
|
39
|
+
.radio-group__vertical_1orgk .radio-group__radioList_1orgk {
|
|
40
40
|
flex-direction: column;
|
|
41
41
|
align-items: flex-start;
|
|
42
42
|
}
|
|
43
|
-
.radio-
|
|
43
|
+
.radio-group__vertical_1orgk .radio-group__radio_1orgk {
|
|
44
44
|
margin-bottom: var(--gap-m)
|
|
45
45
|
}
|
|
46
|
-
.radio-
|
|
46
|
+
.radio-group__vertical_1orgk .radio-group__radio_1orgk:last-child {
|
|
47
47
|
margin-bottom: 0;
|
|
48
48
|
}
|
|
49
|
-
.radio-
|
|
49
|
+
.radio-group__horizontal_1orgk .radio-group__radioList_1orgk {
|
|
50
50
|
flex-wrap: wrap;
|
|
51
51
|
margin-right: var(--gap-xl-neg);
|
|
52
52
|
margin-bottom: var(--gap-xs-neg);
|
|
53
53
|
}
|
|
54
|
-
.radio-
|
|
54
|
+
.radio-group__tag_1orgk.radio-group__horizontal_1orgk .radio-group__radioList_1orgk {
|
|
55
55
|
margin-right: var(--gap-xs-neg);
|
|
56
56
|
}
|
|
57
|
-
.radio-
|
|
57
|
+
.radio-group__horizontal_1orgk .radio-group__radio_1orgk {
|
|
58
58
|
margin-right: var(--gap-xl);
|
|
59
59
|
margin-bottom: var(--gap-xs);
|
|
60
60
|
}
|
|
61
|
-
.radio-
|
|
61
|
+
.radio-group__horizontal_1orgk .radio-group__tagLabel_1orgk {
|
|
62
62
|
margin-right: var(--gap-xs);
|
|
63
63
|
}
|
|
64
|
-
.radio-
|
|
64
|
+
.radio-group__label_1orgk {
|
|
65
65
|
font-size: 16px;
|
|
66
66
|
line-height: 24px;
|
|
67
67
|
font-weight: 400;
|
|
68
68
|
margin-bottom: var(--gap-s);
|
|
69
69
|
color: var(--radio-group-label-color);
|
|
70
70
|
}
|
|
71
|
-
.radio-
|
|
71
|
+
.radio-group__sub_1orgk {
|
|
72
72
|
font-size: 14px;
|
|
73
73
|
line-height: 18px;
|
|
74
74
|
font-weight: 400;
|
|
75
75
|
margin-top: var(--gap-s);
|
|
76
76
|
}
|
|
77
|
-
.radio-
|
|
77
|
+
.radio-group__errorMessage_1orgk {
|
|
78
78
|
color: var(--radio-group-error-color);
|
|
79
79
|
}
|
|
80
|
-
.radio-
|
|
80
|
+
.radio-group__hint_1orgk {
|
|
81
81
|
color: var(--radio-group-hint-color);
|
|
82
82
|
}
|
|
83
|
-
.radio-
|
|
83
|
+
.radio-group__hiddenInput_1orgk {
|
|
84
84
|
position: absolute;
|
|
85
85
|
z-index: -1;
|
|
86
86
|
top: 0;
|
|
87
87
|
left: 0;
|
|
88
88
|
opacity: 0;
|
|
89
89
|
}
|
|
90
|
-
.radio-
|
|
90
|
+
.radio-group__tagLabel_1orgk {
|
|
91
91
|
position: relative;
|
|
92
92
|
}
|
|
File without changes
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { ReactNode, ChangeEvent, MouseEvent } from "react";
|
|
3
|
+
import { ReactNode, ChangeEvent, MouseEvent, FocusEvent } from "react";
|
|
4
4
|
type Direction = 'horizontal' | 'vertical';
|
|
5
5
|
type RadioGroupType = 'radio' | 'tag';
|
|
6
6
|
type RadioGroupProps = {
|
|
@@ -39,6 +39,14 @@ type RadioGroupProps = {
|
|
|
39
39
|
value: string;
|
|
40
40
|
name?: string;
|
|
41
41
|
}) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Обработчик блюра.
|
|
44
|
+
*/
|
|
45
|
+
onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
46
|
+
/**
|
|
47
|
+
* Обработчик фокуса.
|
|
48
|
+
*/
|
|
49
|
+
onFocus?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
42
50
|
/**
|
|
43
51
|
* Управление возможностью изменения состояния 'checked' дочерних компонентов Radio | Tag
|
|
44
52
|
*/
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { forwardRef, useState, Children, isValidElement, cloneElement } from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
|
|
4
|
-
var styles = {"component":"radio-
|
|
4
|
+
var styles = {"component":"radio-group__component_1orgk","error":"radio-group__error_1orgk","radioList":"radio-group__radioList_1orgk","vertical":"radio-group__vertical_1orgk","radio":"radio-group__radio_1orgk","horizontal":"radio-group__horizontal_1orgk","tag":"radio-group__tag_1orgk","tagLabel":"radio-group__tagLabel_1orgk","label":"radio-group__label_1orgk","sub":"radio-group__sub_1orgk","errorMessage":"radio-group__errorMessage_1orgk","hint":"radio-group__hint_1orgk","hiddenInput":"radio-group__hiddenInput_1orgk"};
|
|
5
5
|
require('./index.css')
|
|
6
6
|
|
|
7
|
-
const RadioGroup = forwardRef(({ children, className, direction = 'vertical', label, error, hint, onChange, type = 'radio', dataTestId, disabled = false, name, value, }, ref) => {
|
|
7
|
+
const RadioGroup = forwardRef(({ children, className, direction = 'vertical', label, error, hint, onChange, onBlur, onFocus, type = 'radio', dataTestId, disabled = false, name, value, }, ref) => {
|
|
8
8
|
const [stateValue, setStateValue] = useState('');
|
|
9
9
|
const renderRadio = (child) => {
|
|
10
10
|
const { className: childClassName } = child.props;
|
|
@@ -48,7 +48,7 @@ const RadioGroup = forwardRef(({ children, className, direction = 'vertical', la
|
|
|
48
48
|
const errorMessage = typeof error === 'boolean' ? '' : error;
|
|
49
49
|
return (React.createElement("div", { className: cn(styles.component, styles[type], styles[direction], { [styles.error]: error }, className), "data-test-id": dataTestId, ref: ref },
|
|
50
50
|
label ? React.createElement("span", { className: styles.label }, label) : null,
|
|
51
|
-
children ? (React.createElement("div", { className: styles.radioList }, Children.map(children, child => {
|
|
51
|
+
children ? (React.createElement("div", { className: styles.radioList, onBlur: onBlur, onFocus: onFocus }, Children.map(children, child => {
|
|
52
52
|
if (isValidElement(child)) {
|
|
53
53
|
return type === 'radio' ? renderRadio(child) : renderTag(child);
|
|
54
54
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: t9ghx */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-text-negative: #d91d0b;
|
|
4
4
|
--color-light-text-primary: #0b1f35;
|
|
@@ -25,68 +25,68 @@
|
|
|
25
25
|
--radio-group-hint-color: var(--color-light-text-secondary);
|
|
26
26
|
--radio-group-label-color: var(--color-light-text-primary);
|
|
27
27
|
}
|
|
28
|
-
.radio-
|
|
28
|
+
.radio-group__component_1orgk {
|
|
29
29
|
display: flex;
|
|
30
30
|
flex-direction: column;
|
|
31
31
|
}
|
|
32
|
-
.radio-
|
|
32
|
+
.radio-group__error_1orgk {
|
|
33
33
|
padding-left: var(--gap-xs);
|
|
34
34
|
border-left: 1px solid var(--radio-group-error-color);
|
|
35
35
|
}
|
|
36
|
-
.radio-
|
|
36
|
+
.radio-group__radioList_1orgk {
|
|
37
37
|
display: flex;
|
|
38
38
|
}
|
|
39
|
-
.radio-
|
|
39
|
+
.radio-group__vertical_1orgk .radio-group__radioList_1orgk {
|
|
40
40
|
flex-direction: column;
|
|
41
41
|
align-items: flex-start;
|
|
42
42
|
}
|
|
43
|
-
.radio-
|
|
43
|
+
.radio-group__vertical_1orgk .radio-group__radio_1orgk {
|
|
44
44
|
margin-bottom: var(--gap-m)
|
|
45
45
|
}
|
|
46
|
-
.radio-
|
|
46
|
+
.radio-group__vertical_1orgk .radio-group__radio_1orgk:last-child {
|
|
47
47
|
margin-bottom: 0;
|
|
48
48
|
}
|
|
49
|
-
.radio-
|
|
49
|
+
.radio-group__horizontal_1orgk .radio-group__radioList_1orgk {
|
|
50
50
|
flex-wrap: wrap;
|
|
51
51
|
margin-right: var(--gap-xl-neg);
|
|
52
52
|
margin-bottom: var(--gap-xs-neg);
|
|
53
53
|
}
|
|
54
|
-
.radio-
|
|
54
|
+
.radio-group__tag_1orgk.radio-group__horizontal_1orgk .radio-group__radioList_1orgk {
|
|
55
55
|
margin-right: var(--gap-xs-neg);
|
|
56
56
|
}
|
|
57
|
-
.radio-
|
|
57
|
+
.radio-group__horizontal_1orgk .radio-group__radio_1orgk {
|
|
58
58
|
margin-right: var(--gap-xl);
|
|
59
59
|
margin-bottom: var(--gap-xs);
|
|
60
60
|
}
|
|
61
|
-
.radio-
|
|
61
|
+
.radio-group__horizontal_1orgk .radio-group__tagLabel_1orgk {
|
|
62
62
|
margin-right: var(--gap-xs);
|
|
63
63
|
}
|
|
64
|
-
.radio-
|
|
64
|
+
.radio-group__label_1orgk {
|
|
65
65
|
font-size: 16px;
|
|
66
66
|
line-height: 24px;
|
|
67
67
|
font-weight: 400;
|
|
68
68
|
margin-bottom: var(--gap-s);
|
|
69
69
|
color: var(--radio-group-label-color);
|
|
70
70
|
}
|
|
71
|
-
.radio-
|
|
71
|
+
.radio-group__sub_1orgk {
|
|
72
72
|
font-size: 14px;
|
|
73
73
|
line-height: 18px;
|
|
74
74
|
font-weight: 400;
|
|
75
75
|
margin-top: var(--gap-s);
|
|
76
76
|
}
|
|
77
|
-
.radio-
|
|
77
|
+
.radio-group__errorMessage_1orgk {
|
|
78
78
|
color: var(--radio-group-error-color);
|
|
79
79
|
}
|
|
80
|
-
.radio-
|
|
80
|
+
.radio-group__hint_1orgk {
|
|
81
81
|
color: var(--radio-group-hint-color);
|
|
82
82
|
}
|
|
83
|
-
.radio-
|
|
83
|
+
.radio-group__hiddenInput_1orgk {
|
|
84
84
|
position: absolute;
|
|
85
85
|
z-index: -1;
|
|
86
86
|
top: 0;
|
|
87
87
|
left: 0;
|
|
88
88
|
opacity: 0;
|
|
89
89
|
}
|
|
90
|
-
.radio-
|
|
90
|
+
.radio-group__tagLabel_1orgk {
|
|
91
91
|
position: relative;
|
|
92
92
|
}
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfalab/core-components-radio-group",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Radio group",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"main": "
|
|
8
|
-
"module": "./
|
|
9
|
-
"files": [
|
|
10
|
-
"dist"
|
|
11
|
-
],
|
|
7
|
+
"main": "index.js",
|
|
8
|
+
"module": "./esm/index.js",
|
|
12
9
|
"scripts": {
|
|
13
|
-
"postinstall": "node -e \"if (require('fs').existsSync('./
|
|
10
|
+
"postinstall": "node -e \"if (require('fs').existsSync('./send-stats.js')){require('./send-stats.js')} \""
|
|
14
11
|
},
|
|
15
12
|
"publishConfig": {
|
|
16
|
-
"access": "public"
|
|
13
|
+
"access": "public",
|
|
14
|
+
"directory": "dist"
|
|
17
15
|
},
|
|
18
16
|
"peerDependencies": {
|
|
19
17
|
"react": "^16.9.0 || ^17.0.1 || ^18.0.0",
|
|
@@ -21,6 +19,5 @@
|
|
|
21
19
|
},
|
|
22
20
|
"dependencies": {
|
|
23
21
|
"classnames": "^2.3.1"
|
|
24
|
-
}
|
|
25
|
-
"gitHead": "4d6c8965d07839e339b370bb7c92bd7f9e24b1f3"
|
|
22
|
+
}
|
|
26
23
|
}
|
|
File without changes
|
package/CHANGELOG.md
DELETED
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
## [2.7.1](https://github.com/core-ds/core-components/compare/@alfalab/core-components-radio-group@2.7.0...@alfalab/core-components-radio-group@2.7.1) (2022-08-17)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
### Bug Fixes
|
|
10
|
-
|
|
11
|
-
* returned dist directory ([#199](https://github.com/core-ds/core-components/issues/199)) ([fabc15e](https://github.com/core-ds/core-components/commit/fabc15effa1457ca65ec7238206f1b1fc2a2a613))
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
# [2.7.0](https://github.com/core-ds/core-components/compare/@alfalab/core-components-radio-group@2.6.4...@alfalab/core-components-radio-group@2.7.0) (2022-08-04)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
### Features
|
|
21
|
-
|
|
22
|
-
* react 18 support ([#159](https://github.com/core-ds/core-components/issues/159)) ([2e6693c](https://github.com/core-ds/core-components/commit/2e6693c62f534e333aadb7d3fff4ffd78ac84c63))
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
## [2.6.4](https://github.com/core-ds/core-components/compare/@alfalab/core-components-radio-group@2.6.3...@alfalab/core-components-radio-group@2.6.4) (2022-07-18)
|
|
29
|
-
|
|
30
|
-
**Note:** Version bump only for package @alfalab/core-components-radio-group
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## [2.6.3](https://github.com/core-ds/core-components/compare/@alfalab/core-components-radio-group@2.6.2...@alfalab/core-components-radio-group@2.6.3) (2022-07-15)
|
|
37
|
-
|
|
38
|
-
**Note:** Version bump only for package @alfalab/core-components-radio-group
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
## [2.6.2](https://github.com/core-ds/core-components/compare/@alfalab/core-components-radio-group@2.6.1...@alfalab/core-components-radio-group@2.6.2) (2022-07-15)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
### Bug Fixes
|
|
48
|
-
|
|
49
|
-
* bump packages version ([#153](https://github.com/core-ds/core-components/issues/153)) ([fd3e082](https://github.com/core-ds/core-components/commit/fd3e08205672129cdce04e1000c673f2cd9c10da))
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
## [2.6.1](https://github.com/core-ds/core-components/compare/@alfalab/core-components-radio-group@2.6.0...@alfalab/core-components-radio-group@2.6.1) (2022-07-14)
|
|
56
|
-
|
|
57
|
-
**Note:** Version bump only for package @alfalab/core-components-radio-group
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
# [2.6.0](https://github.com/core-ds/core-components/compare/@alfalab/core-components-radio-group@2.5.0...@alfalab/core-components-radio-group@2.6.0) (2022-06-28)
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
### Features
|
|
67
|
-
|
|
68
|
-
* circumflexus retrieval ([#57](https://github.com/core-ds/core-components/issues/57)) ([3820da8](https://github.com/core-ds/core-components/commit/3820da818bcdcbee6904c648b3e29c3c828fe202))
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
# [2.4.0](https://github.com/core-ds/core-components/compare/@alfalab/core-components-radio-group@2.3.0...@alfalab/core-components-radio-group@2.4.0) (2022-03-22)
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
### Bug Fixes
|
|
78
|
-
|
|
79
|
-
* **radio-group:** add missing 'value' attribute to 'input' tag ([#1033](https://github.com/core-ds/core-components/issues/1033)) ([0f9cf0e](https://github.com/core-ds/core-components/commit/0f9cf0ecd74f4764ccd0b2839ba0cdf1b96e75cb)), closes [#1031](https://github.com/core-ds/core-components/issues/1031)
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
### Features
|
|
83
|
-
|
|
84
|
-
* Исправить импорты в сторях. ([#998](https://github.com/core-ds/core-components/issues/998)) ([e6a654a](https://github.com/core-ds/core-components/commit/e6a654a0599451c7d149484cb61d8067eed083b7))
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
# [2.3.0](https://github.com/core-ds/core-components/compare/@alfalab/core-components-radio-group@2.2.0...@alfalab/core-components-radio-group@2.3.0) (2021-10-11)
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
### Features
|
|
94
|
-
|
|
95
|
-
* проставлен role=alert для ошибок ([#850](https://github.com/core-ds/core-components/issues/850)) ([dc634a3](https://github.com/core-ds/core-components/commit/dc634a3d008accfab10192ce234c12ef0ecc7fa9))
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
# [2.2.0](https://github.com/core-ds/core-components/compare/@alfalab/core-components-radio-group@2.1.0...@alfalab/core-components-radio-group@2.2.0) (2021-09-14)
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
### Features
|
|
105
|
-
|
|
106
|
-
* change error type to ReactNode ([#825](https://github.com/core-ds/core-components/issues/825)) ([c6d95c1](https://github.com/core-ds/core-components/commit/c6d95c1c6239f2b2a3bf2c1639554d8500e794f3))
|
|
107
|
-
* **tag:** add inverted colors ([#784](https://github.com/core-ds/core-components/issues/784)) ([d3681ae](https://github.com/core-ds/core-components/commit/d3681aeefe02e5f481d066013911a1877a165bb2))
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
# [2.1.0](https://github.com/core-ds/core-components/compare/@alfalab/core-components-radio-group@2.0.1...@alfalab/core-components-radio-group@2.1.0) (2021-07-23)
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
### Features
|
|
117
|
-
|
|
118
|
-
* checkbox/radio/switch design updates (PDS-252) ([#735](https://github.com/core-ds/core-components/issues/735)) ([62f3c63](https://github.com/core-ds/core-components/commit/62f3c63279872a80ffb1c018b08addf897597b26))
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
## [2.0.1](https://github.com/core-ds/core-components/compare/@alfalab/core-components-radio-group@2.0.0...@alfalab/core-components-radio-group@2.0.1) (2021-07-09)
|
|
125
|
-
|
|
126
|
-
**Note:** Version bump only for package @alfalab/core-components-radio-group
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
# [2.0.0](https://github.com/core-ds/core-components/compare/@alfalab/core-components-radio-group@1.1.11...@alfalab/core-components-radio-group@2.0.0) (2021-07-08)
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
### Features
|
|
136
|
-
|
|
137
|
-
* upgrade storybook ([#696](https://github.com/core-ds/core-components/issues/696))
|
|
138
|
-
|
|
139
|
-
## [1.1.11](https://github.com/core-ds/core-components/compare/@alfalab/core-components-radio-group@1.1.10...@alfalab/core-components-radio-group@1.1.11) (2021-04-26)
|
|
140
|
-
|
|
141
|
-
**Note:** Version bump only for package @alfalab/core-components-radio-group
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
## [1.1.10](https://github.com/core-ds/core-components/compare/@alfalab/core-components-radio-group@1.1.9...@alfalab/core-components-radio-group@1.1.10) (2021-04-01)
|
|
148
|
-
|
|
149
|
-
**Note:** Version bump only for package @alfalab/core-components-radio-group
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
## [1.1.9](https://github.com/core-ds/core-components/compare/@alfalab/core-components-radio-group@1.1.7...@alfalab/core-components-radio-group@1.1.9) (2021-03-18)
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
### Bug Fixes
|
|
159
|
-
|
|
160
|
-
* one more sborka bug ([#579](https://github.com/core-ds/core-components/issues/579)) ([9fbe0be](https://github.com/core-ds/core-components/commit/9fbe0beca56ec5971de78b3f6cda25305b260efc))
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
## [1.1.7](https://github.com/core-ds/core-components/compare/@alfalab/core-components-radio-group@1.1.5...@alfalab/core-components-radio-group@1.1.7) (2021-03-16)
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
### Bug Fixes
|
|
170
|
-
|
|
171
|
-
* border-radius in packages ([781749e](https://github.com/core-ds/core-components/commit/781749ef38aefd5a6707ac56d2e297dce9f3e073))
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
## [1.1.5](https://github.com/core-ds/core-components/compare/@alfalab/core-components-radio-group@1.1.4...@alfalab/core-components-radio-group@1.1.5) (2021-03-14)
|
|
178
|
-
|
|
179
|
-
**Note:** Version bump only for package @alfalab/core-components-radio-group
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
## [1.1.4](https://github.com/core-ds/core-components/compare/@alfalab/core-components-radio-group@1.1.3...@alfalab/core-components-radio-group@1.1.4) (2021-03-04)
|
|
186
|
-
|
|
187
|
-
**Note:** Version bump only for package @alfalab/core-components-radio-group
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
## [1.1.3](https://github.com/core-ds/core-components/compare/@alfalab/core-components-radio-group@1.1.2...@alfalab/core-components-radio-group@1.1.3) (2021-03-03)
|
|
194
|
-
|
|
195
|
-
**Note:** Version bump only for package @alfalab/core-components-radio-group
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
## [1.1.2](https://github.com/core-ds/core-components/compare/@alfalab/core-components-radio-group@1.1.1...@alfalab/core-components-radio-group@1.1.2) (2021-02-20)
|
|
202
|
-
|
|
203
|
-
**Note:** Version bump only for package @alfalab/core-components-radio-group
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
## [1.1.1](https://github.com/core-ds/core-components/compare/@alfalab/core-components-radio-group@1.1.0...@alfalab/core-components-radio-group@1.1.1) (2021-02-18)
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
### Bug Fixes
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
* update versions ([#525](https://github.com/core-ds/core-components/issues/525)) ([31b2e4c](https://github.com/core-ds/core-components/commit/31b2e4c92fde6e2b63a3391a4e053cd328e93e70))
|