@atlaskit/radio 5.6.9 → 6.0.0
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/CHANGELOG.md +53 -41
- package/dist/cjs/radio-group.js +1 -1
- package/dist/cjs/radio.js +30 -49
- package/dist/es2019/radio-group.js +1 -1
- package/dist/es2019/radio.js +30 -45
- package/dist/esm/radio-group.js +1 -1
- package/dist/esm/radio.js +31 -49
- package/dist/types/radio-group.d.ts +9 -9
- package/dist/types/radio.d.ts +1 -1
- package/dist/types/types.d.ts +20 -20
- package/dist/types-ts4.5/radio-group.d.ts +9 -9
- package/dist/types-ts4.5/radio.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +20 -20
- package/package.json +3 -3
- package/report.api.md +1 -0
- package/tmp/api-report-tmp.d.ts +1 -1
- package/dist/cjs/styles.js +0 -62
- package/dist/es2019/styles.js +0 -56
- package/dist/esm/styles.js +0 -56
- package/dist/types/styles.d.ts +0 -18
- package/dist/types-ts4.5/styles.d.ts +0 -18
package/dist/es2019/radio.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
import { forwardRef, memo
|
|
3
|
+
import { forwardRef, memo } from 'react';
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
5
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
|
|
6
6
|
import __noop from '@atlaskit/ds-lib/noop';
|
|
7
7
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
|
-
import {
|
|
9
|
-
import GlobalTheme from '@atlaskit/theme/components';
|
|
8
|
+
import { B100, B300, B400, B50, N10, N100, N20, N30, N40, N70, N80, N900, R300 } from '@atlaskit/theme/colors';
|
|
10
9
|
import { fontFamily as getFontFamily } from '@atlaskit/theme/constants';
|
|
11
|
-
import getRadioCustomProperties from './styles';
|
|
12
10
|
const packageName = "@atlaskit/radio";
|
|
13
|
-
const packageVersion = "
|
|
11
|
+
const packageVersion = "6.0.0";
|
|
14
12
|
const fontFamily = getFontFamily();
|
|
15
13
|
const noop = __noop;
|
|
16
14
|
const labelPaddingStyles = css({
|
|
@@ -21,6 +19,7 @@ const labelStyles = css({
|
|
|
21
19
|
boxSizing: 'border-box',
|
|
22
20
|
position: 'relative',
|
|
23
21
|
alignItems: 'flex-start',
|
|
22
|
+
color: `var(--ds-text, ${N900})`,
|
|
24
23
|
fontFamily: fontFamily,
|
|
25
24
|
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
26
25
|
'&[data-disabled]': {
|
|
@@ -28,12 +27,6 @@ const labelStyles = css({
|
|
|
28
27
|
cursor: 'not-allowed'
|
|
29
28
|
}
|
|
30
29
|
});
|
|
31
|
-
const lightLabelStyles = css({
|
|
32
|
-
color: `var(--ds-text, ${N900})`
|
|
33
|
-
});
|
|
34
|
-
const darkLabelStyles = css({
|
|
35
|
-
color: `var(--ds-text, ${DN600})`
|
|
36
|
-
});
|
|
37
30
|
const radioStyles = css({
|
|
38
31
|
display: 'flex',
|
|
39
32
|
// TODO https://product-fabric.atlassian.net/browse/DSP-10507 revisit and remove the scale of 14/24
|
|
@@ -63,9 +56,9 @@ const radioStyles = css({
|
|
|
63
56
|
-radio-dot-color and -radio-dot-opacity according to user interactions.
|
|
64
57
|
All other variables are constant
|
|
65
58
|
*/
|
|
66
|
-
'--radio-background-color':
|
|
67
|
-
'--radio-border-color': 'var(--
|
|
68
|
-
'--radio-dot-color':
|
|
59
|
+
'--radio-background-color': `var(--ds-background-input, ${N10})`,
|
|
60
|
+
'--radio-border-color': getBooleanFF('platform.design-system-team.update-border-radio-checkbox_7askv') ? `var(--ds-border-bold, ${N100})` : `var(--ds-border-input, ${N40})`,
|
|
61
|
+
'--radio-dot-color': `var(--ds-icon-inverse, ${N10})`,
|
|
69
62
|
'--radio-dot-opacity': 0,
|
|
70
63
|
/* 24px * 7 / 12 === 14px height and width */
|
|
71
64
|
transform: 'scale(calc(7 / 12))',
|
|
@@ -85,44 +78,44 @@ const radioStyles = css({
|
|
|
85
78
|
transition: 'background-color 0.2s ease-in-out, opacity 0.2s ease-in-out'
|
|
86
79
|
},
|
|
87
80
|
'&:hover': {
|
|
88
|
-
'--radio-background-color':
|
|
89
|
-
'--radio-border-color': 'var(
|
|
81
|
+
'--radio-background-color': `var(--ds-background-input-hovered, ${N30})`,
|
|
82
|
+
'--radio-border-color': getBooleanFF('platform.design-system-team.update-border-radio-checkbox_7askv') ? `var(--ds-border-bold, ${N100})` : `var(--ds-border-input, ${N40})`
|
|
90
83
|
},
|
|
91
84
|
'&:active': {
|
|
92
|
-
'--radio-background-color':
|
|
85
|
+
'--radio-background-color': `var(--ds-background-input-pressed, ${N30})`
|
|
93
86
|
},
|
|
94
87
|
'&:focus': {
|
|
95
|
-
'--radio-border-color':
|
|
88
|
+
'--radio-border-color': `var(--ds-border-focused, ${B100})`
|
|
96
89
|
},
|
|
97
90
|
'&:checked': {
|
|
98
|
-
'--radio-background-color':
|
|
99
|
-
'--radio-border-color':
|
|
91
|
+
'--radio-background-color': `var(--ds-background-selected-bold, ${B400})`,
|
|
92
|
+
'--radio-border-color': `var(--ds-background-selected-bold, ${B400})`,
|
|
100
93
|
'--radio-dot-opacity': 1
|
|
101
94
|
},
|
|
102
95
|
'&:checked:hover': {
|
|
103
|
-
'--radio-background-color':
|
|
104
|
-
'--radio-border-color':
|
|
96
|
+
'--radio-background-color': `var(--ds-background-selected-bold-hovered, ${B300})`,
|
|
97
|
+
'--radio-border-color': `var(--ds-background-selected-bold-hovered, ${B300})`
|
|
105
98
|
},
|
|
106
99
|
'&:checked:active': {
|
|
107
|
-
'--radio-background-color':
|
|
108
|
-
'--radio-border-color': 'var(--
|
|
109
|
-
'--radio-dot-color':
|
|
100
|
+
'--radio-background-color': `var(--ds-background-selected-bold-pressed, ${B50})`,
|
|
101
|
+
'--radio-border-color': getBooleanFF('platform.design-system-team.update-border-radio-checkbox_7askv') ? `var(--ds-border-bold, ${N100})` : `var(--ds-border-input, ${N40})`,
|
|
102
|
+
'--radio-dot-color': `var(--ds-icon-inverse, ${B400})`
|
|
110
103
|
},
|
|
111
104
|
'&:checked:focus': {
|
|
112
|
-
'--radio-border-color':
|
|
105
|
+
'--radio-border-color': `var(--ds-border-focused, ${B100})`
|
|
113
106
|
},
|
|
114
107
|
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
115
108
|
'&[data-invalid], &:checked[data-invalid]': {
|
|
116
|
-
'--radio-border-color':
|
|
109
|
+
'--radio-border-color': `var(--ds-icon-danger, ${R300})`
|
|
117
110
|
},
|
|
118
111
|
'&:disabled, &:disabled:hover, &:disabled:focus, &:disabled:active, &:disabled[data-invalid]': {
|
|
119
112
|
cursor: 'not-allowed',
|
|
120
|
-
'--radio-background-color':
|
|
121
|
-
'--radio-border-color':
|
|
122
|
-
'--radio-dot-color':
|
|
113
|
+
'--radio-background-color': `var(--ds-background-disabled, ${N20})`,
|
|
114
|
+
'--radio-border-color': `var(--ds-border-disabled, ${N20})`,
|
|
115
|
+
'--radio-dot-color': `var(--ds-icon-disabled, ${N70})`
|
|
123
116
|
}
|
|
124
117
|
});
|
|
125
|
-
const
|
|
118
|
+
const InnerRadio = /*#__PURE__*/forwardRef(function Radio(props, ref) {
|
|
126
119
|
const {
|
|
127
120
|
ariaLabel,
|
|
128
121
|
isDisabled = false,
|
|
@@ -130,7 +123,6 @@ const RadioWithMode = /*#__PURE__*/forwardRef(function Radio(props, ref) {
|
|
|
130
123
|
isInvalid = false,
|
|
131
124
|
isChecked = false,
|
|
132
125
|
label,
|
|
133
|
-
mode,
|
|
134
126
|
name,
|
|
135
127
|
onChange = noop,
|
|
136
128
|
value,
|
|
@@ -147,11 +139,10 @@ const RadioWithMode = /*#__PURE__*/forwardRef(function Radio(props, ref) {
|
|
|
147
139
|
packageName,
|
|
148
140
|
packageVersion
|
|
149
141
|
});
|
|
150
|
-
const radioCustomProperties = useMemo(() => css(getRadioCustomProperties(mode)), [mode]);
|
|
151
142
|
return jsx("label", {
|
|
152
143
|
"data-testid": testId && `${testId}--radio-label`,
|
|
153
144
|
"data-disabled": isDisabled ? 'true' : undefined,
|
|
154
|
-
css:
|
|
145
|
+
css: labelStyles
|
|
155
146
|
}, jsx("input", _extends({}, rest, {
|
|
156
147
|
"aria-label": ariaLabel,
|
|
157
148
|
checked: isChecked,
|
|
@@ -165,11 +156,8 @@ const RadioWithMode = /*#__PURE__*/forwardRef(function Radio(props, ref) {
|
|
|
165
156
|
// isInvalid is used in a nonstandard way so cannot
|
|
166
157
|
// use :invalid selector
|
|
167
158
|
,
|
|
168
|
-
"data-invalid": isInvalid ? 'true' : undefined
|
|
169
|
-
|
|
170
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
171
|
-
,
|
|
172
|
-
css: [radioStyles, radioCustomProperties],
|
|
159
|
+
"data-invalid": isInvalid ? 'true' : undefined,
|
|
160
|
+
css: radioStyles,
|
|
173
161
|
ref: ref
|
|
174
162
|
})), label ? jsx("span", {
|
|
175
163
|
css: labelPaddingStyles
|
|
@@ -186,11 +174,8 @@ const RadioWithMode = /*#__PURE__*/forwardRef(function Radio(props, ref) {
|
|
|
186
174
|
* - [Usage](https://atlassian.design/components/radio/usage)
|
|
187
175
|
*/
|
|
188
176
|
const Radio = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Radio(props, ref) {
|
|
189
|
-
return jsx(
|
|
190
|
-
|
|
191
|
-
})
|
|
192
|
-
ref: ref,
|
|
193
|
-
mode: mode
|
|
194
|
-
})));
|
|
177
|
+
return jsx(InnerRadio, _extends({}, props, {
|
|
178
|
+
ref: ref
|
|
179
|
+
}));
|
|
195
180
|
}));
|
|
196
181
|
export default Radio;
|
package/dist/esm/radio-group.js
CHANGED
|
@@ -41,7 +41,7 @@ export default function RadioGroup(props) {
|
|
|
41
41
|
if (typeof isDisabled !== 'undefined') {
|
|
42
42
|
optionProps.isDisabled = isDisabled;
|
|
43
43
|
}
|
|
44
|
-
var isChecked = value
|
|
44
|
+
var isChecked = value !== null && optionProps.value === value;
|
|
45
45
|
return /*#__PURE__*/React.createElement(Radio, _extends({}, optionProps, {
|
|
46
46
|
name: name || optionProps.name,
|
|
47
47
|
key: index,
|
package/dist/esm/radio.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["ariaLabel", "isDisabled", "isRequired", "isInvalid", "isChecked", "label", "
|
|
3
|
+
var _excluded = ["ariaLabel", "isDisabled", "isRequired", "isInvalid", "isChecked", "label", "name", "onChange", "value", "testId", "analyticsContext"];
|
|
4
4
|
/** @jsx jsx */
|
|
5
|
-
import { forwardRef, memo
|
|
5
|
+
import { forwardRef, memo } from 'react';
|
|
6
6
|
import { css, jsx } from '@emotion/react';
|
|
7
7
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
|
|
8
8
|
import __noop from '@atlaskit/ds-lib/noop';
|
|
9
9
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
10
|
-
import {
|
|
11
|
-
import GlobalTheme from '@atlaskit/theme/components';
|
|
10
|
+
import { B100, B300, B400, B50, N10, N100, N20, N30, N40, N70, N80, N900, R300 } from '@atlaskit/theme/colors';
|
|
12
11
|
import { fontFamily as getFontFamily } from '@atlaskit/theme/constants';
|
|
13
|
-
import getRadioCustomProperties from './styles';
|
|
14
12
|
var packageName = "@atlaskit/radio";
|
|
15
|
-
var packageVersion = "
|
|
13
|
+
var packageVersion = "6.0.0";
|
|
16
14
|
var fontFamily = getFontFamily();
|
|
17
15
|
var noop = __noop;
|
|
18
16
|
var labelPaddingStyles = css({
|
|
@@ -23,6 +21,7 @@ var labelStyles = css({
|
|
|
23
21
|
boxSizing: 'border-box',
|
|
24
22
|
position: 'relative',
|
|
25
23
|
alignItems: 'flex-start',
|
|
24
|
+
color: "var(--ds-text, ".concat(N900, ")"),
|
|
26
25
|
fontFamily: fontFamily,
|
|
27
26
|
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
28
27
|
'&[data-disabled]': {
|
|
@@ -30,12 +29,6 @@ var labelStyles = css({
|
|
|
30
29
|
cursor: 'not-allowed'
|
|
31
30
|
}
|
|
32
31
|
});
|
|
33
|
-
var lightLabelStyles = css({
|
|
34
|
-
color: "var(--ds-text, ".concat(N900, ")")
|
|
35
|
-
});
|
|
36
|
-
var darkLabelStyles = css({
|
|
37
|
-
color: "var(--ds-text, ".concat(DN600, ")")
|
|
38
|
-
});
|
|
39
32
|
var radioStyles = css({
|
|
40
33
|
display: 'flex',
|
|
41
34
|
// TODO https://product-fabric.atlassian.net/browse/DSP-10507 revisit and remove the scale of 14/24
|
|
@@ -65,9 +58,9 @@ var radioStyles = css({
|
|
|
65
58
|
-radio-dot-color and -radio-dot-opacity according to user interactions.
|
|
66
59
|
All other variables are constant
|
|
67
60
|
*/
|
|
68
|
-
'--radio-background-color':
|
|
69
|
-
'--radio-border-color': 'var(--
|
|
70
|
-
'--radio-dot-color':
|
|
61
|
+
'--radio-background-color': "var(--ds-background-input, ".concat(N10, ")"),
|
|
62
|
+
'--radio-border-color': getBooleanFF('platform.design-system-team.update-border-radio-checkbox_7askv') ? "var(--ds-border-bold, ".concat(N100, ")") : "var(--ds-border-input, ".concat(N40, ")"),
|
|
63
|
+
'--radio-dot-color': "var(--ds-icon-inverse, ".concat(N10, ")"),
|
|
71
64
|
'--radio-dot-opacity': 0,
|
|
72
65
|
/* 24px * 7 / 12 === 14px height and width */
|
|
73
66
|
transform: 'scale(calc(7 / 12))',
|
|
@@ -87,44 +80,44 @@ var radioStyles = css({
|
|
|
87
80
|
transition: 'background-color 0.2s ease-in-out, opacity 0.2s ease-in-out'
|
|
88
81
|
},
|
|
89
82
|
'&:hover': {
|
|
90
|
-
'--radio-background-color':
|
|
91
|
-
'--radio-border-color': 'var(
|
|
83
|
+
'--radio-background-color': "var(--ds-background-input-hovered, ".concat(N30, ")"),
|
|
84
|
+
'--radio-border-color': getBooleanFF('platform.design-system-team.update-border-radio-checkbox_7askv') ? "var(--ds-border-bold, ".concat(N100, ")") : "var(--ds-border-input, ".concat(N40, ")")
|
|
92
85
|
},
|
|
93
86
|
'&:active': {
|
|
94
|
-
'--radio-background-color':
|
|
87
|
+
'--radio-background-color': "var(--ds-background-input-pressed, ".concat(N30, ")")
|
|
95
88
|
},
|
|
96
89
|
'&:focus': {
|
|
97
|
-
'--radio-border-color':
|
|
90
|
+
'--radio-border-color': "var(--ds-border-focused, ".concat(B100, ")")
|
|
98
91
|
},
|
|
99
92
|
'&:checked': {
|
|
100
|
-
'--radio-background-color':
|
|
101
|
-
'--radio-border-color':
|
|
93
|
+
'--radio-background-color': "var(--ds-background-selected-bold, ".concat(B400, ")"),
|
|
94
|
+
'--radio-border-color': "var(--ds-background-selected-bold, ".concat(B400, ")"),
|
|
102
95
|
'--radio-dot-opacity': 1
|
|
103
96
|
},
|
|
104
97
|
'&:checked:hover': {
|
|
105
|
-
'--radio-background-color':
|
|
106
|
-
'--radio-border-color':
|
|
98
|
+
'--radio-background-color': "var(--ds-background-selected-bold-hovered, ".concat(B300, ")"),
|
|
99
|
+
'--radio-border-color': "var(--ds-background-selected-bold-hovered, ".concat(B300, ")")
|
|
107
100
|
},
|
|
108
101
|
'&:checked:active': {
|
|
109
|
-
'--radio-background-color':
|
|
110
|
-
'--radio-border-color': 'var(--
|
|
111
|
-
'--radio-dot-color':
|
|
102
|
+
'--radio-background-color': "var(--ds-background-selected-bold-pressed, ".concat(B50, ")"),
|
|
103
|
+
'--radio-border-color': getBooleanFF('platform.design-system-team.update-border-radio-checkbox_7askv') ? "var(--ds-border-bold, ".concat(N100, ")") : "var(--ds-border-input, ".concat(N40, ")"),
|
|
104
|
+
'--radio-dot-color': "var(--ds-icon-inverse, ".concat(B400, ")")
|
|
112
105
|
},
|
|
113
106
|
'&:checked:focus': {
|
|
114
|
-
'--radio-border-color':
|
|
107
|
+
'--radio-border-color': "var(--ds-border-focused, ".concat(B100, ")")
|
|
115
108
|
},
|
|
116
109
|
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
117
110
|
'&[data-invalid], &:checked[data-invalid]': {
|
|
118
|
-
'--radio-border-color':
|
|
111
|
+
'--radio-border-color': "var(--ds-icon-danger, ".concat(R300, ")")
|
|
119
112
|
},
|
|
120
113
|
'&:disabled, &:disabled:hover, &:disabled:focus, &:disabled:active, &:disabled[data-invalid]': {
|
|
121
114
|
cursor: 'not-allowed',
|
|
122
|
-
'--radio-background-color':
|
|
123
|
-
'--radio-border-color':
|
|
124
|
-
'--radio-dot-color':
|
|
115
|
+
'--radio-background-color': "var(--ds-background-disabled, ".concat(N20, ")"),
|
|
116
|
+
'--radio-border-color': "var(--ds-border-disabled, ".concat(N20, ")"),
|
|
117
|
+
'--radio-dot-color': "var(--ds-icon-disabled, ".concat(N70, ")")
|
|
125
118
|
}
|
|
126
119
|
});
|
|
127
|
-
var
|
|
120
|
+
var InnerRadio = /*#__PURE__*/forwardRef(function Radio(props, ref) {
|
|
128
121
|
var ariaLabel = props.ariaLabel,
|
|
129
122
|
_props$isDisabled = props.isDisabled,
|
|
130
123
|
isDisabled = _props$isDisabled === void 0 ? false : _props$isDisabled,
|
|
@@ -134,7 +127,6 @@ var RadioWithMode = /*#__PURE__*/forwardRef(function Radio(props, ref) {
|
|
|
134
127
|
_props$isChecked = props.isChecked,
|
|
135
128
|
isChecked = _props$isChecked === void 0 ? false : _props$isChecked,
|
|
136
129
|
label = props.label,
|
|
137
|
-
mode = props.mode,
|
|
138
130
|
name = props.name,
|
|
139
131
|
_props$onChange = props.onChange,
|
|
140
132
|
onChange = _props$onChange === void 0 ? noop : _props$onChange,
|
|
@@ -150,13 +142,10 @@ var RadioWithMode = /*#__PURE__*/forwardRef(function Radio(props, ref) {
|
|
|
150
142
|
packageName: packageName,
|
|
151
143
|
packageVersion: packageVersion
|
|
152
144
|
});
|
|
153
|
-
var radioCustomProperties = useMemo(function () {
|
|
154
|
-
return css(getRadioCustomProperties(mode));
|
|
155
|
-
}, [mode]);
|
|
156
145
|
return jsx("label", {
|
|
157
146
|
"data-testid": testId && "".concat(testId, "--radio-label"),
|
|
158
147
|
"data-disabled": isDisabled ? 'true' : undefined,
|
|
159
|
-
css:
|
|
148
|
+
css: labelStyles
|
|
160
149
|
}, jsx("input", _extends({}, rest, {
|
|
161
150
|
"aria-label": ariaLabel,
|
|
162
151
|
checked: isChecked,
|
|
@@ -170,11 +159,8 @@ var RadioWithMode = /*#__PURE__*/forwardRef(function Radio(props, ref) {
|
|
|
170
159
|
// isInvalid is used in a nonstandard way so cannot
|
|
171
160
|
// use :invalid selector
|
|
172
161
|
,
|
|
173
|
-
"data-invalid": isInvalid ? 'true' : undefined
|
|
174
|
-
|
|
175
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
176
|
-
,
|
|
177
|
-
css: [radioStyles, radioCustomProperties],
|
|
162
|
+
"data-invalid": isInvalid ? 'true' : undefined,
|
|
163
|
+
css: radioStyles,
|
|
178
164
|
ref: ref
|
|
179
165
|
})), label ? jsx("span", {
|
|
180
166
|
css: labelPaddingStyles
|
|
@@ -191,12 +177,8 @@ var RadioWithMode = /*#__PURE__*/forwardRef(function Radio(props, ref) {
|
|
|
191
177
|
* - [Usage](https://atlassian.design/components/radio/usage)
|
|
192
178
|
*/
|
|
193
179
|
var Radio = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Radio(props, ref) {
|
|
194
|
-
return jsx(
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
ref: ref,
|
|
198
|
-
mode: mode
|
|
199
|
-
}));
|
|
200
|
-
});
|
|
180
|
+
return jsx(InnerRadio, _extends({}, props, {
|
|
181
|
+
ref: ref
|
|
182
|
+
}));
|
|
201
183
|
}));
|
|
202
184
|
export default Radio;
|
|
@@ -3,11 +3,11 @@ import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
|
3
3
|
import { OptionsPropType, RadioValue } from './types';
|
|
4
4
|
export interface RadioGroupProps {
|
|
5
5
|
/**
|
|
6
|
-
* Once set, controls the selected value on the `RadioGroup
|
|
6
|
+
* Once set, controls the selected value on the `RadioGroup`.
|
|
7
7
|
*/
|
|
8
8
|
value?: RadioValue | null;
|
|
9
9
|
/**
|
|
10
|
-
* Sets the initial selected value on the `RadioGroup
|
|
10
|
+
* Sets the initial selected value on the `RadioGroup`.
|
|
11
11
|
*/
|
|
12
12
|
defaultValue?: RadioValue | null;
|
|
13
13
|
/**
|
|
@@ -15,11 +15,11 @@ export interface RadioGroupProps {
|
|
|
15
15
|
*/
|
|
16
16
|
isDisabled?: boolean;
|
|
17
17
|
/**
|
|
18
|
-
* Sets the required state of all `Radio` elements in the group
|
|
18
|
+
* Sets the required state of all `Radio` elements in the group.
|
|
19
19
|
*/
|
|
20
20
|
isRequired?: boolean;
|
|
21
21
|
/**
|
|
22
|
-
* Sets the invalid state of all `Radio` elements in the group
|
|
22
|
+
* Sets the invalid state of all `Radio` elements in the group.
|
|
23
23
|
*/
|
|
24
24
|
isInvalid?: boolean;
|
|
25
25
|
/**
|
|
@@ -27,23 +27,23 @@ export interface RadioGroupProps {
|
|
|
27
27
|
*/
|
|
28
28
|
options: OptionsPropType;
|
|
29
29
|
/**
|
|
30
|
-
* Function that gets fired after each invalid event
|
|
30
|
+
* Function that gets fired after each invalid event.
|
|
31
31
|
*/
|
|
32
32
|
onInvalid?: (event: SyntheticEvent<any>) => void;
|
|
33
33
|
/**
|
|
34
|
-
* Function that gets after each change event
|
|
34
|
+
* Function that gets after each change event.
|
|
35
35
|
*/
|
|
36
36
|
onChange?: (e: React.ChangeEvent<HTMLInputElement>, analyticsEvent: UIAnalyticsEvent) => void;
|
|
37
37
|
/**
|
|
38
|
-
* Sets the `name` prop on each of the `Radio` elements in the group
|
|
38
|
+
* Sets the `name` prop on each of the `Radio` elements in the group.
|
|
39
39
|
*/
|
|
40
40
|
name?: string;
|
|
41
41
|
/**
|
|
42
|
-
* Additional information to be included in the `context` of analytics events that come from radio
|
|
42
|
+
* Additional information to be included in the `context` of analytics events that come from radio.
|
|
43
43
|
*/
|
|
44
44
|
analyticsContext?: Record<string, any>;
|
|
45
45
|
/**
|
|
46
|
-
* The id of the element that links to this
|
|
46
|
+
* The id of the element that links to this radio group.
|
|
47
47
|
*/
|
|
48
48
|
'aria-labelledby'?: string;
|
|
49
49
|
}
|
package/dist/types/radio.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ declare const Radio: import("react").MemoExoticComponent<import("react").Forward
|
|
|
30
30
|
value?: string | undefined;
|
|
31
31
|
testId?: string | undefined;
|
|
32
32
|
analyticsContext?: Record<string, any> | undefined;
|
|
33
|
-
} & import("@atlaskit/analytics-next").WithAnalyticsEventsProps, "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "crossOrigin" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "list" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "name" | "pattern" | "placeholder" | "readOnly" | "size" | "src" | "step" | "type" | "width" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "
|
|
33
|
+
} & import("@atlaskit/analytics-next").WithAnalyticsEventsProps, "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "crossOrigin" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "list" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "name" | "pattern" | "placeholder" | "readOnly" | "size" | "src" | "step" | "type" | "width" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | keyof {
|
|
34
34
|
ariaLabel?: string | undefined;
|
|
35
35
|
isDisabled?: boolean | undefined;
|
|
36
36
|
isRequired?: boolean | undefined;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export type OptionsPropType = Array<OptionPropType>;
|
|
|
11
11
|
export type RadioValue = string;
|
|
12
12
|
type OwnProps = {
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* The aria-label attribute associated with the radio element.
|
|
15
15
|
*/
|
|
16
16
|
ariaLabel?: string;
|
|
17
17
|
/**
|
|
@@ -19,38 +19,38 @@ type OwnProps = {
|
|
|
19
19
|
*/
|
|
20
20
|
isDisabled?: boolean;
|
|
21
21
|
/**
|
|
22
|
-
* Marks this as a required field
|
|
22
|
+
* Marks this as a required field.
|
|
23
23
|
*/
|
|
24
24
|
isRequired?: boolean;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Marks this as an invalid field.
|
|
27
27
|
*/
|
|
28
28
|
isInvalid?: boolean;
|
|
29
29
|
/**
|
|
30
|
-
* Set the field as checked
|
|
30
|
+
* Set the field as checked.
|
|
31
31
|
*/
|
|
32
32
|
isChecked?: boolean;
|
|
33
33
|
/**
|
|
34
|
-
* The label value for the input rendered to the
|
|
34
|
+
* The label value for the input rendered to the DOM.
|
|
35
35
|
*/
|
|
36
36
|
label?: ReactNode;
|
|
37
37
|
/**
|
|
38
|
-
* onChange event handler, passed into the props of each `Radio` Component instantiated within `RadioGroup
|
|
38
|
+
* onChange event handler, passed into the props of each `Radio` Component instantiated within `RadioGroup`.
|
|
39
39
|
*/
|
|
40
40
|
onChange?: (e: React.ChangeEvent<HTMLInputElement>, analyticsEvent: UIAnalyticsEvent) => void;
|
|
41
41
|
/**
|
|
42
|
-
* Field value
|
|
42
|
+
* Field value.
|
|
43
43
|
*/
|
|
44
44
|
value?: RadioValue;
|
|
45
45
|
/**
|
|
46
46
|
* A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests
|
|
47
47
|
* we have 2 different testid generated based on the one you pass to the Radio component:
|
|
48
48
|
* - `{testId}--radio-input` to check if it got changed to checked/unchecked.
|
|
49
|
-
* - `{testId}--radio-label` to click the input
|
|
49
|
+
* - `{testId}--radio-label` to click the input.
|
|
50
50
|
*/
|
|
51
51
|
testId?: string;
|
|
52
52
|
/**
|
|
53
|
-
* Additional information to be included in the `context` of analytics events that come from radio
|
|
53
|
+
* Additional information to be included in the `context` of analytics events that come from radio.
|
|
54
54
|
*/
|
|
55
55
|
analyticsContext?: Record<string, any>;
|
|
56
56
|
};
|
|
@@ -58,35 +58,35 @@ type Combine<First, Second> = Omit<First, keyof Second> & Second;
|
|
|
58
58
|
export type RadioProps = Combine<Omit<React.InputHTMLAttributes<HTMLInputElement>, 'aria-label' | 'disabled' | 'required' | 'checked' | 'value'>, OwnProps> & WithAnalyticsEventsProps;
|
|
59
59
|
export interface ExtractReactTypeProps extends WithAnalyticsEventsProps {
|
|
60
60
|
/**
|
|
61
|
-
*
|
|
61
|
+
* The aria-label attribute associated with the radio element.
|
|
62
62
|
*/
|
|
63
63
|
ariaLabel?: string;
|
|
64
64
|
/**
|
|
65
|
-
*
|
|
65
|
+
* Marks this as a disabled field.
|
|
66
66
|
*/
|
|
67
67
|
isDisabled?: boolean;
|
|
68
68
|
/**
|
|
69
|
-
* Marks this as a required field
|
|
69
|
+
* Marks this as a required field.
|
|
70
70
|
*/
|
|
71
71
|
isRequired?: boolean;
|
|
72
72
|
/**
|
|
73
|
-
*
|
|
73
|
+
* Marks this as an invalid field.
|
|
74
74
|
*/
|
|
75
75
|
isInvalid?: boolean;
|
|
76
76
|
/**
|
|
77
|
-
* Set the field as checked
|
|
77
|
+
* Set the field as checked.
|
|
78
78
|
*/
|
|
79
79
|
isChecked?: boolean;
|
|
80
80
|
/**
|
|
81
|
-
* The label value for the input rendered to the
|
|
81
|
+
* The label value for the input rendered to the DOM.
|
|
82
82
|
*/
|
|
83
83
|
label?: ReactNode;
|
|
84
84
|
/**
|
|
85
|
-
* Field name, must be unique to the radio group
|
|
85
|
+
* Field name, must be unique to the radio group.
|
|
86
86
|
*/
|
|
87
87
|
name?: string;
|
|
88
88
|
/**
|
|
89
|
-
* `onChange` event handler, passed into the props of each `Radio` Component instantiated within RadioGroup
|
|
89
|
+
* `onChange` event handler, passed into the props of each `Radio` Component instantiated within RadioGroup.
|
|
90
90
|
*/
|
|
91
91
|
onChange?: (e: React.ChangeEvent<HTMLInputElement>, analyticsEvent: UIAnalyticsEvent) => void;
|
|
92
92
|
onBlur?: React.FocusEventHandler<HTMLInputElement>;
|
|
@@ -96,11 +96,11 @@ export interface ExtractReactTypeProps extends WithAnalyticsEventsProps {
|
|
|
96
96
|
onMouseEnter?: React.MouseEventHandler;
|
|
97
97
|
onMouseLeave?: React.MouseEventHandler;
|
|
98
98
|
/**
|
|
99
|
-
* `onInvalid` event handler, passed into the props of each `Radio` component instantiated within `RadioGroup
|
|
99
|
+
* `onInvalid` event handler, passed into the props of each `Radio` component instantiated within `RadioGroup`.
|
|
100
100
|
*/
|
|
101
101
|
onInvalid?: (e: SyntheticEvent<any>) => void;
|
|
102
102
|
/**
|
|
103
|
-
* Field value
|
|
103
|
+
* Field value.
|
|
104
104
|
*/
|
|
105
105
|
value?: RadioValue;
|
|
106
106
|
/**
|
|
@@ -111,7 +111,7 @@ export interface ExtractReactTypeProps extends WithAnalyticsEventsProps {
|
|
|
111
111
|
*/
|
|
112
112
|
testId?: string;
|
|
113
113
|
/**
|
|
114
|
-
* Additional information to be included in the `context` of analytics events that come from radio
|
|
114
|
+
* Additional information to be included in the `context` of analytics events that come from radio.
|
|
115
115
|
*/
|
|
116
116
|
analyticsContext?: Record<string, any>;
|
|
117
117
|
}
|
|
@@ -3,11 +3,11 @@ import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
|
3
3
|
import { OptionsPropType, RadioValue } from './types';
|
|
4
4
|
export interface RadioGroupProps {
|
|
5
5
|
/**
|
|
6
|
-
* Once set, controls the selected value on the `RadioGroup
|
|
6
|
+
* Once set, controls the selected value on the `RadioGroup`.
|
|
7
7
|
*/
|
|
8
8
|
value?: RadioValue | null;
|
|
9
9
|
/**
|
|
10
|
-
* Sets the initial selected value on the `RadioGroup
|
|
10
|
+
* Sets the initial selected value on the `RadioGroup`.
|
|
11
11
|
*/
|
|
12
12
|
defaultValue?: RadioValue | null;
|
|
13
13
|
/**
|
|
@@ -15,11 +15,11 @@ export interface RadioGroupProps {
|
|
|
15
15
|
*/
|
|
16
16
|
isDisabled?: boolean;
|
|
17
17
|
/**
|
|
18
|
-
* Sets the required state of all `Radio` elements in the group
|
|
18
|
+
* Sets the required state of all `Radio` elements in the group.
|
|
19
19
|
*/
|
|
20
20
|
isRequired?: boolean;
|
|
21
21
|
/**
|
|
22
|
-
* Sets the invalid state of all `Radio` elements in the group
|
|
22
|
+
* Sets the invalid state of all `Radio` elements in the group.
|
|
23
23
|
*/
|
|
24
24
|
isInvalid?: boolean;
|
|
25
25
|
/**
|
|
@@ -27,23 +27,23 @@ export interface RadioGroupProps {
|
|
|
27
27
|
*/
|
|
28
28
|
options: OptionsPropType;
|
|
29
29
|
/**
|
|
30
|
-
* Function that gets fired after each invalid event
|
|
30
|
+
* Function that gets fired after each invalid event.
|
|
31
31
|
*/
|
|
32
32
|
onInvalid?: (event: SyntheticEvent<any>) => void;
|
|
33
33
|
/**
|
|
34
|
-
* Function that gets after each change event
|
|
34
|
+
* Function that gets after each change event.
|
|
35
35
|
*/
|
|
36
36
|
onChange?: (e: React.ChangeEvent<HTMLInputElement>, analyticsEvent: UIAnalyticsEvent) => void;
|
|
37
37
|
/**
|
|
38
|
-
* Sets the `name` prop on each of the `Radio` elements in the group
|
|
38
|
+
* Sets the `name` prop on each of the `Radio` elements in the group.
|
|
39
39
|
*/
|
|
40
40
|
name?: string;
|
|
41
41
|
/**
|
|
42
|
-
* Additional information to be included in the `context` of analytics events that come from radio
|
|
42
|
+
* Additional information to be included in the `context` of analytics events that come from radio.
|
|
43
43
|
*/
|
|
44
44
|
analyticsContext?: Record<string, any>;
|
|
45
45
|
/**
|
|
46
|
-
* The id of the element that links to this
|
|
46
|
+
* The id of the element that links to this radio group.
|
|
47
47
|
*/
|
|
48
48
|
'aria-labelledby'?: string;
|
|
49
49
|
}
|