@atlaskit/radio 5.3.11 → 5.4.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 CHANGED
@@ -1,5 +1,29 @@
1
1
  # @atlaskit/radio
2
2
 
3
+ ## 5.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`54a5b7576a6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/54a5b7576a6) - Updates `@emotion/core` to `@emotion/react`; v10 to v11. There is no expected behavior change.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+
13
+ ## 5.3.13
14
+
15
+ ### Patch Changes
16
+
17
+ - [`8d4228767b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d4228767b0) - Upgrade Typescript from `4.2.4` to `4.3.5`.
18
+
19
+ ## 5.3.12
20
+
21
+ ### Patch Changes
22
+
23
+ - [`72cfbe1a536`](https://bitbucket.org/atlassian/atlassian-frontend/commits/72cfbe1a536) - Internal code change turning on new linting rules.
24
+ - [`fe575d49d66`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fe575d49d66) - Updated styles to use new input design tokens
25
+ - Updated dependencies
26
+
3
27
  ## 5.3.11
4
28
 
5
29
  ### Patch Changes
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@atlaskit/radio/Radio",
3
- "main": "../dist/cjs/Radio.js",
4
- "module": "../dist/esm/Radio.js",
5
- "module:es2019": "../dist/es2019/Radio.js",
3
+ "main": "../dist/cjs/radio.js",
4
+ "module": "../dist/esm/radio.js",
5
+ "module:es2019": "../dist/es2019/radio.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/Radio.d.ts"
7
+ "types": "../dist/types/radio.d.ts"
8
8
  }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@atlaskit/radio/RadioGroup",
3
- "main": "../dist/cjs/RadioGroup.js",
4
- "module": "../dist/esm/RadioGroup.js",
5
- "module:es2019": "../dist/es2019/RadioGroup.js",
3
+ "main": "../dist/cjs/radio-group.js",
4
+ "module": "../dist/esm/radio-group.js",
5
+ "module:es2019": "../dist/es2019/radio-group.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/RadioGroup.d.ts"
7
+ "types": "../dist/types/radio-group.d.ts"
8
8
  }
@@ -1,5 +1,7 @@
1
1
  import React from 'react';
2
2
 
3
+ import noop from '@atlaskit/ds-lib/noop';
4
+
3
5
  import { Radio } from '../src';
4
6
 
5
7
  export default () => (
@@ -9,6 +11,6 @@ export default () => (
9
11
  name="radio-default"
10
12
  testId="radio-default"
11
13
  isChecked={true}
12
- onChange={() => {}}
14
+ onChange={noop}
13
15
  />
14
16
  );
@@ -7,7 +7,7 @@ import {
7
7
  PublicInteractionTask,
8
8
  } from 'storybook-addon-performance';
9
9
 
10
- import RadioGroup from '../src/RadioGroup';
10
+ import RadioGroup from '../src/radio-group';
11
11
 
12
12
  const interactionTasks: PublicInteractionTask[] = [
13
13
  {
package/dist/cjs/index.js CHANGED
@@ -8,16 +8,16 @@ Object.defineProperty(exports, "__esModule", {
8
8
  Object.defineProperty(exports, "Radio", {
9
9
  enumerable: true,
10
10
  get: function get() {
11
- return _Radio.default;
11
+ return _radio.default;
12
12
  }
13
13
  });
14
14
  Object.defineProperty(exports, "RadioGroup", {
15
15
  enumerable: true,
16
16
  get: function get() {
17
- return _RadioGroup.default;
17
+ return _radioGroup.default;
18
18
  }
19
19
  });
20
20
 
21
- var _RadioGroup = _interopRequireDefault(require("./RadioGroup"));
21
+ var _radioGroup = _interopRequireDefault(require("./radio-group"));
22
22
 
23
- var _Radio = _interopRequireDefault(require("./Radio"));
23
+ var _radio = _interopRequireDefault(require("./radio"));
@@ -15,14 +15,14 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
15
15
 
16
16
  var _react = _interopRequireWildcard(require("react"));
17
17
 
18
- var _Radio = _interopRequireDefault(require("./Radio"));
18
+ var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
19
+
20
+ var _radio = _interopRequireDefault(require("./radio"));
19
21
 
20
22
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
23
 
22
24
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
25
 
24
- var noop = function noop() {};
25
-
26
26
  var noOptions = [];
27
27
 
28
28
  function RadioGroup(props) {
@@ -35,7 +35,7 @@ function RadioGroup(props) {
35
35
  isRequired = props.isRequired,
36
36
  isInvalid = props.isInvalid,
37
37
  _props$onInvalid = props.onInvalid,
38
- onInvalid = _props$onInvalid === void 0 ? noop : _props$onInvalid,
38
+ onInvalid = _props$onInvalid === void 0 ? _noop.default : _props$onInvalid,
39
39
  name = props.name,
40
40
  analyticsContext = props.analyticsContext,
41
41
  ariaLabelledBy = props['aria-labelledby'];
@@ -66,7 +66,7 @@ function RadioGroup(props) {
66
66
  }
67
67
 
68
68
  var isChecked = value != null && optionProps.value === value;
69
- return /*#__PURE__*/_react.default.createElement(_Radio.default, (0, _extends2.default)({}, optionProps, {
69
+ return /*#__PURE__*/_react.default.createElement(_radio.default, (0, _extends2.default)({}, optionProps, {
70
70
  name: name || optionProps.name,
71
71
  key: index,
72
72
  onChange: onRadioChange,
@@ -13,10 +13,12 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
13
13
 
14
14
  var _react = require("react");
15
15
 
16
- var _core = require("@emotion/core");
16
+ var _react2 = require("@emotion/react");
17
17
 
18
18
  var _usePlatformLeafEventHandler = require("@atlaskit/analytics-next/usePlatformLeafEventHandler");
19
19
 
20
+ var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
21
+
20
22
  var _colors = require("@atlaskit/theme/colors");
21
23
 
22
24
  var _components = _interopRequireDefault(require("@atlaskit/theme/components"));
@@ -27,15 +29,13 @@ var _styles = _interopRequireDefault(require("./styles"));
27
29
 
28
30
  var _excluded = ["ariaLabel", "isDisabled", "isRequired", "isInvalid", "isChecked", "label", "mode", "name", "onChange", "value", "testId", "analyticsContext"];
29
31
  var packageName = "@atlaskit/radio";
30
- var packageVersion = "5.3.11";
32
+ var packageVersion = "5.4.0";
31
33
  var fontFamily = (0, _constants.fontFamily)();
32
-
33
- var noop = function noop() {};
34
-
35
- var labelPaddingStyles = (0, _core.css)({
34
+ var noop = _noop.default;
35
+ var labelPaddingStyles = (0, _react2.css)({
36
36
  padding: '2px 4px'
37
37
  });
38
- var labelStyles = (0, _core.css)({
38
+ var labelStyles = (0, _react2.css)({
39
39
  display: 'flex',
40
40
  boxSizing: 'border-box',
41
41
  position: 'relative',
@@ -47,13 +47,13 @@ var labelStyles = (0, _core.css)({
47
47
  cursor: 'not-allowed'
48
48
  }
49
49
  });
50
- var lightLabelStyles = (0, _core.css)({
50
+ var lightLabelStyles = (0, _react2.css)({
51
51
  color: "var(--ds-text, ".concat(_colors.N900, ")")
52
52
  });
53
- var darkLabelStyles = (0, _core.css)({
53
+ var darkLabelStyles = (0, _react2.css)({
54
54
  color: "var(--ds-text, ".concat(_colors.DN600, ")")
55
55
  });
56
- var radioStyles = (0, _core.css)({
56
+ var radioStyles = (0, _react2.css)({
57
57
  display: 'flex',
58
58
 
59
59
  /*
@@ -173,17 +173,17 @@ var RadioWithMode = /*#__PURE__*/(0, _react.forwardRef)(function Radio(props, re
173
173
  packageVersion: packageVersion
174
174
  });
175
175
  var radioCustomProperties = (0, _react.useMemo)(function () {
176
- return (0, _core.css)((0, _styles.default)(mode));
176
+ return (0, _react2.css)((0, _styles.default)(mode));
177
177
  }, [mode]);
178
178
  return (// https://product-fabric.atlassian.net/browse/DST-1971
179
179
  // eslint-disable-next-line jsx-a11y/label-has-associated-control,jsx-a11y/label-has-for
180
- (0, _core.jsx)("label", {
180
+ (0, _react2.jsx)("label", {
181
181
  "data-testid": testId && "".concat(testId, "--radio-label"),
182
182
  "data-disabled": isDisabled ? 'true' : undefined // TODO these will no longer be dynamic styles when legacy theming removed
183
183
  // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
184
184
  ,
185
185
  css: [labelStyles, mode === 'light' ? lightLabelStyles : darkLabelStyles]
186
- }, (0, _core.jsx)("input", (0, _extends2.default)({}, rest, {
186
+ }, (0, _react2.jsx)("input", (0, _extends2.default)({}, rest, {
187
187
  "aria-label": ariaLabel,
188
188
  checked: isChecked,
189
189
  disabled: isDisabled,
@@ -200,15 +200,25 @@ var RadioWithMode = /*#__PURE__*/(0, _react.forwardRef)(function Radio(props, re
200
200
  ,
201
201
  css: [radioStyles, radioCustomProperties],
202
202
  ref: ref
203
- })), label ? (0, _core.jsx)("span", {
203
+ })), label ? (0, _react2.jsx)("span", {
204
204
  css: labelPaddingStyles
205
205
  }, label) : null)
206
206
  );
207
207
  });
208
+ /**
209
+ * __Radio__
210
+ *
211
+ * A radio input allows users to select only one option from a number of choices. Radio is generally displayed in a radio group.
212
+ *
213
+ * - [Examples](https://atlassian.design/components/radio/examples)
214
+ * - [Code](https://atlassian.design/components/radio/code)
215
+ * - [Usage](https://atlassian.design/components/radio/usage)
216
+ */
217
+
208
218
  var Radio = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function Radio(props, ref) {
209
- return (0, _core.jsx)(_components.default.Consumer, null, function (_ref) {
219
+ return (0, _react2.jsx)(_components.default.Consumer, null, function (_ref) {
210
220
  var mode = _ref.mode;
211
- return (0, _core.jsx)(RadioWithMode, (0, _extends2.default)({}, props, {
221
+ return (0, _react2.jsx)(RadioWithMode, (0, _extends2.default)({}, props, {
212
222
  ref: ref,
213
223
  mode: mode
214
224
  }));
@@ -10,7 +10,7 @@ var _colors = require("@atlaskit/theme/colors");
10
10
  var radioThemeColors = {
11
11
  light: {
12
12
  background: "var(--ds-background-input, ".concat(_colors.N10, ")"),
13
- backgroundHover: "var(--ds-surface, ".concat(_colors.N30, ")"),
13
+ backgroundHover: "var(--ds-background-input-hovered, ".concat(_colors.N30, ")"),
14
14
  backgroundActive: "var(--ds-background-input-pressed, ".concat(_colors.N30, ")"),
15
15
  backgroundChecked: "var(--ds-background-brand-bold, ".concat(_colors.B400, ")"),
16
16
  backgroundCheckedHover: "var(--ds-background-brand-bold-hovered, ".concat(_colors.B300, ")"),
@@ -19,14 +19,14 @@ var radioThemeColors = {
19
19
  dotChecked: "var(--ds-text-inverse, ".concat(_colors.N10, ")"),
20
20
  dotDisabled: "var(--ds-text-disabled, ".concat(_colors.N70, ")"),
21
21
  dotActive: "var(--ds-text-inverse, ".concat(_colors.B400, ")"),
22
- border: "var(--ds-border, ".concat(_colors.N40, ")"),
23
- borderHover: "var(--ds-border, ".concat(_colors.N40, ")"),
22
+ border: "var(--ds-border-input, ".concat(_colors.N40, ")"),
23
+ borderHover: "var(--ds-border-input, ".concat(_colors.N40, ")"),
24
24
  borderDisabled: "var(--ds-background-disabled, ".concat(_colors.N20, ")"),
25
25
  borderFocus: "var(--ds-border-focused, ".concat(_colors.B100, ")")
26
26
  },
27
27
  dark: {
28
28
  background: "var(--ds-background-input, ".concat(_colors.DN10, ")"),
29
- backgroundHover: "var(--ds-surface, ".concat(_colors.DN30, ")"),
29
+ backgroundHover: "var(--ds-background-input-hovered, ".concat(_colors.DN30, ")"),
30
30
  backgroundActive: "var(--ds-background-input-pressed, ".concat(_colors.B200, ")"),
31
31
  backgroundChecked: "var(--ds-background-brand-bold, ".concat(_colors.B400, ")"),
32
32
  backgroundCheckedHover: "var(--ds-background-brand-bold-hovered, ".concat(_colors.B75, ")"),
@@ -35,8 +35,8 @@ var radioThemeColors = {
35
35
  dotChecked: "var(--ds-text-inverse, ".concat(_colors.DN10, ")"),
36
36
  dotDisabled: "var(--ds-text-disabled, ".concat(_colors.DN90, ")"),
37
37
  dotActive: "var(--ds-text-inverse, ".concat(_colors.DN10, ")"),
38
- border: "var(--ds-border, ".concat(_colors.DN80, ")"),
39
- borderHover: "var(--ds-border, ".concat(_colors.DN200, ")"),
38
+ border: "var(--ds-border-input, ".concat(_colors.DN80, ")"),
39
+ borderHover: "var(--ds-border-input, ".concat(_colors.DN200, ")"),
40
40
  borderDisabled: "var(--ds-background-disabled, ".concat(_colors.DN10, ")"),
41
41
  borderFocus: "var(--ds-border-focused, ".concat(_colors.B75, ")")
42
42
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/radio",
3
- "version": "5.3.11",
3
+ "version": "5.4.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,2 +1,2 @@
1
- export { default as RadioGroup } from './RadioGroup';
2
- export { default as Radio } from './Radio';
1
+ export { default as RadioGroup } from './radio-group';
2
+ export { default as Radio } from './radio';
@@ -1,9 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useCallback, useState } from 'react';
3
- import Radio from './Radio';
4
-
5
- const noop = () => {};
6
-
3
+ import noop from '@atlaskit/ds-lib/noop';
4
+ import Radio from './radio';
7
5
  const noOptions = [];
8
6
  export default function RadioGroup(props) {
9
7
  const {
@@ -2,18 +2,17 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
3
  /** @jsx jsx */
4
4
  import { forwardRef, memo, useMemo } from 'react';
5
- import { css, jsx } from '@emotion/core';
5
+ import { css, jsx } from '@emotion/react';
6
6
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
7
+ import __noop from '@atlaskit/ds-lib/noop';
7
8
  import { DN600, N80, N900 } from '@atlaskit/theme/colors';
8
9
  import GlobalTheme from '@atlaskit/theme/components';
9
10
  import { fontFamily as getFontFamily } from '@atlaskit/theme/constants';
10
11
  import getRadioCustomProperties from './styles';
11
12
  const packageName = "@atlaskit/radio";
12
- const packageVersion = "5.3.11";
13
+ const packageVersion = "5.4.0";
13
14
  const fontFamily = getFontFamily();
14
-
15
- const noop = () => {};
16
-
15
+ const noop = __noop;
17
16
  const labelPaddingStyles = css({
18
17
  padding: '2px 4px'
19
18
  });
@@ -184,6 +183,16 @@ const RadioWithMode = /*#__PURE__*/forwardRef(function Radio(props, ref) {
184
183
  }, label) : null)
185
184
  );
186
185
  });
186
+ /**
187
+ * __Radio__
188
+ *
189
+ * A radio input allows users to select only one option from a number of choices. Radio is generally displayed in a radio group.
190
+ *
191
+ * - [Examples](https://atlassian.design/components/radio/examples)
192
+ * - [Code](https://atlassian.design/components/radio/code)
193
+ * - [Usage](https://atlassian.design/components/radio/usage)
194
+ */
195
+
187
196
  const Radio = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Radio(props, ref) {
188
197
  return jsx(GlobalTheme.Consumer, null, ({
189
198
  mode
@@ -2,7 +2,7 @@ import { B100, B200, B300, B400, B50, B75, DN10, DN200, DN30, DN80, DN90, N10, N
2
2
  const radioThemeColors = {
3
3
  light: {
4
4
  background: `var(--ds-background-input, ${N10})`,
5
- backgroundHover: `var(--ds-surface, ${N30})`,
5
+ backgroundHover: `var(--ds-background-input-hovered, ${N30})`,
6
6
  backgroundActive: `var(--ds-background-input-pressed, ${N30})`,
7
7
  backgroundChecked: `var(--ds-background-brand-bold, ${B400})`,
8
8
  backgroundCheckedHover: `var(--ds-background-brand-bold-hovered, ${B300})`,
@@ -11,14 +11,14 @@ const radioThemeColors = {
11
11
  dotChecked: `var(--ds-text-inverse, ${N10})`,
12
12
  dotDisabled: `var(--ds-text-disabled, ${N70})`,
13
13
  dotActive: `var(--ds-text-inverse, ${B400})`,
14
- border: `var(--ds-border, ${N40})`,
15
- borderHover: `var(--ds-border, ${N40})`,
14
+ border: `var(--ds-border-input, ${N40})`,
15
+ borderHover: `var(--ds-border-input, ${N40})`,
16
16
  borderDisabled: `var(--ds-background-disabled, ${N20})`,
17
17
  borderFocus: `var(--ds-border-focused, ${B100})`
18
18
  },
19
19
  dark: {
20
20
  background: `var(--ds-background-input, ${DN10})`,
21
- backgroundHover: `var(--ds-surface, ${DN30})`,
21
+ backgroundHover: `var(--ds-background-input-hovered, ${DN30})`,
22
22
  backgroundActive: `var(--ds-background-input-pressed, ${B200})`,
23
23
  backgroundChecked: `var(--ds-background-brand-bold, ${B400})`,
24
24
  backgroundCheckedHover: `var(--ds-background-brand-bold-hovered, ${B75})`,
@@ -27,8 +27,8 @@ const radioThemeColors = {
27
27
  dotChecked: `var(--ds-text-inverse, ${DN10})`,
28
28
  dotDisabled: `var(--ds-text-disabled, ${DN90})`,
29
29
  dotActive: `var(--ds-text-inverse, ${DN10})`,
30
- border: `var(--ds-border, ${DN80})`,
31
- borderHover: `var(--ds-border, ${DN200})`,
30
+ border: `var(--ds-border-input, ${DN80})`,
31
+ borderHover: `var(--ds-border-input, ${DN200})`,
32
32
  borderDisabled: `var(--ds-background-disabled, ${DN10})`,
33
33
  borderFocus: `var(--ds-border-focused, ${B75})`
34
34
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/radio",
3
- "version": "5.3.11",
3
+ "version": "5.4.0",
4
4
  "sideEffects": false
5
5
  }
package/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { default as RadioGroup } from './RadioGroup';
2
- export { default as Radio } from './Radio';
1
+ export { default as RadioGroup } from './radio-group';
2
+ export { default as Radio } from './radio';
@@ -1,10 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import React, { useCallback, useState } from 'react';
4
- import Radio from './Radio';
5
-
6
- var noop = function noop() {};
7
-
4
+ import noop from '@atlaskit/ds-lib/noop';
5
+ import Radio from './radio';
8
6
  var noOptions = [];
9
7
  export default function RadioGroup(props) {
10
8
  var onChange = props.onChange,
@@ -4,18 +4,17 @@ var _excluded = ["ariaLabel", "isDisabled", "isRequired", "isInvalid", "isChecke
4
4
 
5
5
  /** @jsx jsx */
6
6
  import { forwardRef, memo, useMemo } from 'react';
7
- import { css, jsx } from '@emotion/core';
7
+ import { css, jsx } from '@emotion/react';
8
8
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
9
+ import __noop from '@atlaskit/ds-lib/noop';
9
10
  import { DN600, N80, N900 } from '@atlaskit/theme/colors';
10
11
  import GlobalTheme from '@atlaskit/theme/components';
11
12
  import { fontFamily as getFontFamily } from '@atlaskit/theme/constants';
12
13
  import getRadioCustomProperties from './styles';
13
14
  var packageName = "@atlaskit/radio";
14
- var packageVersion = "5.3.11";
15
+ var packageVersion = "5.4.0";
15
16
  var fontFamily = getFontFamily();
16
-
17
- var noop = function noop() {};
18
-
17
+ var noop = __noop;
19
18
  var labelPaddingStyles = css({
20
19
  padding: '2px 4px'
21
20
  });
@@ -190,6 +189,16 @@ var RadioWithMode = /*#__PURE__*/forwardRef(function Radio(props, ref) {
190
189
  }, label) : null)
191
190
  );
192
191
  });
192
+ /**
193
+ * __Radio__
194
+ *
195
+ * A radio input allows users to select only one option from a number of choices. Radio is generally displayed in a radio group.
196
+ *
197
+ * - [Examples](https://atlassian.design/components/radio/examples)
198
+ * - [Code](https://atlassian.design/components/radio/code)
199
+ * - [Usage](https://atlassian.design/components/radio/usage)
200
+ */
201
+
193
202
  var Radio = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Radio(props, ref) {
194
203
  return jsx(GlobalTheme.Consumer, null, function (_ref) {
195
204
  var mode = _ref.mode;
@@ -2,7 +2,7 @@ import { B100, B200, B300, B400, B50, B75, DN10, DN200, DN30, DN80, DN90, N10, N
2
2
  var radioThemeColors = {
3
3
  light: {
4
4
  background: "var(--ds-background-input, ".concat(N10, ")"),
5
- backgroundHover: "var(--ds-surface, ".concat(N30, ")"),
5
+ backgroundHover: "var(--ds-background-input-hovered, ".concat(N30, ")"),
6
6
  backgroundActive: "var(--ds-background-input-pressed, ".concat(N30, ")"),
7
7
  backgroundChecked: "var(--ds-background-brand-bold, ".concat(B400, ")"),
8
8
  backgroundCheckedHover: "var(--ds-background-brand-bold-hovered, ".concat(B300, ")"),
@@ -11,14 +11,14 @@ var radioThemeColors = {
11
11
  dotChecked: "var(--ds-text-inverse, ".concat(N10, ")"),
12
12
  dotDisabled: "var(--ds-text-disabled, ".concat(N70, ")"),
13
13
  dotActive: "var(--ds-text-inverse, ".concat(B400, ")"),
14
- border: "var(--ds-border, ".concat(N40, ")"),
15
- borderHover: "var(--ds-border, ".concat(N40, ")"),
14
+ border: "var(--ds-border-input, ".concat(N40, ")"),
15
+ borderHover: "var(--ds-border-input, ".concat(N40, ")"),
16
16
  borderDisabled: "var(--ds-background-disabled, ".concat(N20, ")"),
17
17
  borderFocus: "var(--ds-border-focused, ".concat(B100, ")")
18
18
  },
19
19
  dark: {
20
20
  background: "var(--ds-background-input, ".concat(DN10, ")"),
21
- backgroundHover: "var(--ds-surface, ".concat(DN30, ")"),
21
+ backgroundHover: "var(--ds-background-input-hovered, ".concat(DN30, ")"),
22
22
  backgroundActive: "var(--ds-background-input-pressed, ".concat(B200, ")"),
23
23
  backgroundChecked: "var(--ds-background-brand-bold, ".concat(B400, ")"),
24
24
  backgroundCheckedHover: "var(--ds-background-brand-bold-hovered, ".concat(B75, ")"),
@@ -27,8 +27,8 @@ var radioThemeColors = {
27
27
  dotChecked: "var(--ds-text-inverse, ".concat(DN10, ")"),
28
28
  dotDisabled: "var(--ds-text-disabled, ".concat(DN90, ")"),
29
29
  dotActive: "var(--ds-text-inverse, ".concat(DN10, ")"),
30
- border: "var(--ds-border, ".concat(DN80, ")"),
31
- borderHover: "var(--ds-border, ".concat(DN200, ")"),
30
+ border: "var(--ds-border-input, ".concat(DN80, ")"),
31
+ borderHover: "var(--ds-border-input, ".concat(DN200, ")"),
32
32
  borderDisabled: "var(--ds-background-disabled, ".concat(DN10, ")"),
33
33
  borderFocus: "var(--ds-border-focused, ".concat(B75, ")")
34
34
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/radio",
3
- "version": "5.3.11",
3
+ "version": "5.4.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,2 +1,2 @@
1
- export { default as RadioGroup } from './RadioGroup';
2
- export { default as Radio } from './Radio';
1
+ export { default as RadioGroup } from './radio-group';
2
+ export { default as Radio } from './radio';
@@ -0,0 +1,50 @@
1
+ import React, { SyntheticEvent } from 'react';
2
+ import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
+ import { OptionsPropType, RadioValue } from './types';
4
+ export interface RadioGroupProps {
5
+ /**
6
+ * Once set, controls the selected value on the `RadioGroup`
7
+ */
8
+ value?: RadioValue | null;
9
+ /**
10
+ * Sets the initial selected value on the `RadioGroup`
11
+ */
12
+ defaultValue?: RadioValue | null;
13
+ /**
14
+ * Sets the disabled state of all `Radio` elements in the group. Overrides the `isDisabled` setting of all child `Radio` items.
15
+ */
16
+ isDisabled?: boolean;
17
+ /**
18
+ * Sets the required state of all `Radio` elements in the group
19
+ */
20
+ isRequired?: boolean;
21
+ /**
22
+ * Sets the invalid state of all `Radio` elements in the group
23
+ */
24
+ isInvalid?: boolean;
25
+ /**
26
+ * An array of objects, each object is mapped onto a `Radio` element within the group. Name must be unique to the group.
27
+ */
28
+ options: OptionsPropType;
29
+ /**
30
+ * Function that gets fired after each invalid event
31
+ */
32
+ onInvalid?: (event: SyntheticEvent<any>) => void;
33
+ /**
34
+ * Function that gets after each change event
35
+ */
36
+ onChange?: (e: React.ChangeEvent<HTMLInputElement>, analyticsEvent: UIAnalyticsEvent) => void;
37
+ /**
38
+ * Sets the `name` prop on each of the `Radio` elements in the group
39
+ */
40
+ name?: string;
41
+ /**
42
+ * Additional information to be included in the `context` of analytics events that come from radio
43
+ */
44
+ analyticsContext?: Record<string, any>;
45
+ /**
46
+ * The id of the element that links to this radiogroup.
47
+ */
48
+ 'aria-labelledby'?: string;
49
+ }
50
+ export default function RadioGroup(props: RadioGroupProps): JSX.Element;
@@ -1,4 +1,13 @@
1
1
  /// <reference types="react" />
2
+ /**
3
+ * __Radio__
4
+ *
5
+ * A radio input allows users to select only one option from a number of choices. Radio is generally displayed in a radio group.
6
+ *
7
+ * - [Examples](https://atlassian.design/components/radio/examples)
8
+ * - [Code](https://atlassian.design/components/radio/code)
9
+ * - [Usage](https://atlassian.design/components/radio/usage)
10
+ */
2
11
  declare const Radio: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Pick<Omit<Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "aria-label" | "disabled" | "required" | "checked" | "value">, keyof {
3
12
  ariaLabel?: string | undefined;
4
13
  isDisabled?: boolean | undefined;
@@ -21,7 +30,7 @@ declare const Radio: import("react").MemoExoticComponent<import("react").Forward
21
30
  value?: string | undefined;
22
31
  testId?: string | undefined;
23
32
  analyticsContext?: Record<string, any> | undefined;
24
- } & 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" | "inputMode" | "is" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "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" | "css" | keyof {
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" | "inputMode" | "is" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "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 {
25
34
  ariaLabel?: string | undefined;
26
35
  isDisabled?: boolean | undefined;
27
36
  isRequired?: boolean | undefined;
@@ -6,10 +6,10 @@ export default function getRadioCustomProperties(mode: ThemeModes): {
6
6
  '--local-background-checked-active': "var(--ds-background-brand-bold-pressed)";
7
7
  '--local-background-checked-hover': "var(--ds-background-brand-bold-hovered)";
8
8
  '--local-background-disabled': "var(--ds-background-input)";
9
- '--local-background-hover': "var(--ds-surface)";
10
- '--local-border': "var(--ds-border)";
9
+ '--local-background-hover': "var(--ds-background-input-hovered)";
10
+ '--local-border': "var(--ds-border-input)";
11
11
  '--local-border-disabled': "var(--ds-background-disabled)";
12
- '--local-border-hover': "var(--ds-border)";
12
+ '--local-border-hover': "var(--ds-border-input)";
13
13
  '--local-border-focus': "var(--ds-border-focused)";
14
14
  '--local-dot-active': "var(--ds-text-inverse)";
15
15
  '--local-dot-checked': "var(--ds-text-inverse)";
@@ -10,50 +10,84 @@ export declare type OptionPropType = {
10
10
  export declare type OptionsPropType = Array<OptionPropType>;
11
11
  export declare type RadioValue = string;
12
12
  declare type OwnProps = {
13
- /** the aria-label attribute associated with the radio element */
13
+ /**
14
+ * the aria-label attribute associated with the radio element
15
+ */
14
16
  ariaLabel?: string;
15
- /** Makes a `Radio` field unselectable when true. Overridden by `isDisabled` prop of `RadioGroup`. */
17
+ /**
18
+ * Makes a `Radio` field unselectable when true. Overridden by `isDisabled` prop of `RadioGroup`.
19
+ */
16
20
  isDisabled?: boolean;
17
- /** Marks this as a required field */
21
+ /**
22
+ * Marks this as a required field
23
+ */
18
24
  isRequired?: boolean;
19
- /** Field is invalid */
25
+ /**
26
+ * Field is invalid
27
+ */
20
28
  isInvalid?: boolean;
21
- /** Set the field as checked */
29
+ /**
30
+ * Set the field as checked
31
+ */
22
32
  isChecked?: boolean;
23
- /** The label value for the input rendered to the dom */
33
+ /**
34
+ * The label value for the input rendered to the dom
35
+ */
24
36
  label?: ReactNode;
25
- /** onChange event handler, passed into the props of each `Radio` Component instantiated within `RadioGroup` */
37
+ /**
38
+ * onChange event handler, passed into the props of each `Radio` Component instantiated within `RadioGroup`
39
+ */
26
40
  onChange?: (e: React.ChangeEvent<HTMLInputElement>, analyticsEvent: UIAnalyticsEvent) => void;
27
- /** Field value */
41
+ /**
42
+ * Field value
43
+ */
28
44
  value?: RadioValue;
29
45
  /**
30
- 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
31
- we have 2 different testid generated based on the one you pass to the Radio component:
32
- - `{testId}--radio-input` to check if it got changed to checked/unchecked.
33
- - `{testId}--radio-label` to click the input
34
- */
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
+ * we have 2 different testid generated based on the one you pass to the Radio component:
48
+ * - `{testId}--radio-input` to check if it got changed to checked/unchecked.
49
+ * - `{testId}--radio-label` to click the input
50
+ */
35
51
  testId?: string;
36
- /** Additional information to be included in the `context` of analytics events that come from radio */
52
+ /**
53
+ * Additional information to be included in the `context` of analytics events that come from radio
54
+ */
37
55
  analyticsContext?: Record<string, any>;
38
56
  };
39
57
  declare type Combine<First, Second> = Omit<First, keyof Second> & Second;
40
58
  export declare type RadioProps = Combine<Omit<React.InputHTMLAttributes<HTMLInputElement>, 'aria-label' | 'disabled' | 'required' | 'checked' | 'value'>, OwnProps> & WithAnalyticsEventsProps;
41
59
  export interface ExtractReactTypeProps extends WithAnalyticsEventsProps {
42
- /** the aria-label attribute associated with the radio element */
60
+ /**
61
+ * the aria-label attribute associated with the radio element
62
+ */
43
63
  ariaLabel?: string;
44
- /** Field disabled */
64
+ /**
65
+ * Field disabled
66
+ */
45
67
  isDisabled?: boolean;
46
- /** Marks this as a required field */
68
+ /**
69
+ * Marks this as a required field
70
+ */
47
71
  isRequired?: boolean;
48
- /** Field is invalid */
72
+ /**
73
+ * Field is invalid
74
+ */
49
75
  isInvalid?: boolean;
50
- /** Set the field as checked */
76
+ /**
77
+ * Set the field as checked
78
+ */
51
79
  isChecked?: boolean;
52
- /** The label value for the input rendered to the dom */
80
+ /**
81
+ * The label value for the input rendered to the dom
82
+ */
53
83
  label?: ReactNode;
54
- /** Field name, must be unique to the radio group */
84
+ /**
85
+ * Field name, must be unique to the radio group
86
+ */
55
87
  name?: string;
56
- /** `onChange` event handler, passed into the props of each `Radio` Component instantiated within RadioGroup */
88
+ /**
89
+ * `onChange` event handler, passed into the props of each `Radio` Component instantiated within RadioGroup
90
+ */
57
91
  onChange?: (e: React.ChangeEvent<HTMLInputElement>, analyticsEvent: UIAnalyticsEvent) => void;
58
92
  onBlur?: React.FocusEventHandler<HTMLInputElement>;
59
93
  onFocus?: React.FocusEventHandler<HTMLInputElement>;
@@ -61,18 +95,24 @@ export interface ExtractReactTypeProps extends WithAnalyticsEventsProps {
61
95
  onMouseUp?: React.MouseEventHandler;
62
96
  onMouseEnter?: React.MouseEventHandler;
63
97
  onMouseLeave?: React.MouseEventHandler;
64
- /** `onInvalid` event handler, passed into the props of each `Radio` component instantiated within `RadioGroup` */
98
+ /**
99
+ * `onInvalid` event handler, passed into the props of each `Radio` component instantiated within `RadioGroup`
100
+ */
65
101
  onInvalid?: (e: SyntheticEvent<any>) => void;
66
- /** Field value */
102
+ /**
103
+ * Field value
104
+ */
67
105
  value?: RadioValue;
68
106
  /**
69
- 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
70
- we have two different `testId`s generated based on the one you pass to the Radio component:
71
- - `{testId}--radio-input` to check if it got changed to checked/unchecked.
72
- - `{testId}--radio-label` to click the input
73
- */
107
+ * 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
108
+ * we have two different `testId`s generated based on the one you pass to the Radio component:
109
+ * - `{testId}--radio-input` to check if it got changed to checked/unchecked.
110
+ * - `{testId}--radio-label` to click the input
111
+ */
74
112
  testId?: string;
75
- /** Additional information to be included in the `context` of analytics events that come from radio */
113
+ /**
114
+ * Additional information to be included in the `context` of analytics events that come from radio
115
+ */
76
116
  analyticsContext?: Record<string, any>;
77
117
  }
78
118
  export {};
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@atlaskit/radio",
3
- "version": "5.3.11",
4
- "description": "A radio input allows people to select only one option from a number of choices. Radio is generally displayed in a radio group.",
3
+ "version": "5.4.0",
4
+ "description": "A radio input allows users to select only one option from a number of choices. Radio is generally displayed in a radio group.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
7
7
  },
8
- "repository": "https://bitbucket.org/atlassian/atlassian-frontend",
8
+ "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
9
9
  "author": "Atlassian Pty Ltd",
10
10
  "license": "Apache-2.0",
11
11
  "main": "dist/cjs/index.js",
@@ -13,26 +13,28 @@
13
13
  "module:es2019": "dist/es2019/index.js",
14
14
  "types": "dist/types/index.d.ts",
15
15
  "sideEffects": false,
16
- "atlaskit:src": "src/index.ts",
16
+ "atlaskit:src": "src/index.tsx",
17
17
  "atlassian": {
18
18
  "team": "Design System Team",
19
19
  "releaseModel": "scheduled",
20
20
  "website": {
21
- "name": "Radio"
21
+ "name": "Radio",
22
+ "category": "Components"
22
23
  }
23
24
  },
24
25
  "af:exports": {
25
- "./Radio": "./src/Radio.tsx",
26
- "./RadioGroup": "./src/RadioGroup.tsx",
27
- "./types": "./src/types.ts",
28
- ".": "./src/index.ts"
26
+ "./Radio": "./src/radio.tsx",
27
+ "./RadioGroup": "./src/radio-group.tsx",
28
+ "./types": "./src/types.tsx",
29
+ ".": "./src/index.tsx"
29
30
  },
30
31
  "dependencies": {
31
32
  "@atlaskit/analytics-next": "^8.0.0",
32
- "@atlaskit/theme": "^12.1.0",
33
+ "@atlaskit/ds-lib": "^2.1.0",
34
+ "@atlaskit/theme": "^12.2.0",
33
35
  "@atlaskit/tokens": "^0.10.0",
34
36
  "@babel/runtime": "^7.0.0",
35
- "@emotion/core": "^10.0.9"
37
+ "@emotion/react": "^11.7.1"
36
38
  },
37
39
  "peerDependencies": {
38
40
  "react": "^16.8.0"
@@ -42,7 +44,7 @@
42
44
  "@atlaskit/checkbox": "^12.3.0",
43
45
  "@atlaskit/docs": "^9.0.0",
44
46
  "@atlaskit/form": "^8.5.0",
45
- "@atlaskit/section-message": "^6.1.0",
47
+ "@atlaskit/section-message": "^6.2.0",
46
48
  "@atlaskit/ssr": "*",
47
49
  "@atlaskit/visual-regression": "*",
48
50
  "@atlaskit/webdriver-runner": "*",
@@ -50,7 +52,7 @@
50
52
  "@testing-library/react": "^8.0.1",
51
53
  "react-dom": "^16.8.0",
52
54
  "storybook-addon-performance": "^0.16.0",
53
- "typescript": "4.2.4"
55
+ "typescript": "4.3.5"
54
56
  },
55
57
  "keywords": [
56
58
  "atlaskit",
@@ -62,6 +64,8 @@
62
64
  "import-structure": "atlassian-conventions"
63
65
  },
64
66
  "@repo/internal": {
67
+ "dom-events": "use-bind-event-listener",
68
+ "design-system": "v1",
65
69
  "ui-components": "lite-mode",
66
70
  "analytics": "analytics-next",
67
71
  "styling": [
package/report.api.md ADDED
@@ -0,0 +1,404 @@
1
+ ## API Report File for "@atlaskit/radio"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+ /// <reference types="react" />
7
+
8
+ import { ChangeEvent } from 'react';
9
+ import { ForwardRefExoticComponent } from 'react';
10
+ import { InputHTMLAttributes } from 'react';
11
+ import { MemoExoticComponent } from 'react';
12
+ import { default as React_2 } from 'react';
13
+ import { ReactNode } from 'react';
14
+ import { RefAttributes } from 'react';
15
+ import { SyntheticEvent } from 'react';
16
+ import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
17
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
18
+
19
+ declare type OptionPropType = {
20
+ isDisabled?: boolean;
21
+ label?: ReactNode;
22
+ name?: string;
23
+ value?: RadioValue;
24
+ testId?: string;
25
+ };
26
+
27
+ declare type OptionsPropType = Array<OptionPropType>;
28
+
29
+ export declare const Radio: MemoExoticComponent<ForwardRefExoticComponent<
30
+ Pick<
31
+ Omit<
32
+ Omit<
33
+ InputHTMLAttributes<HTMLInputElement>,
34
+ 'aria-label' | 'disabled' | 'required' | 'checked' | 'value'
35
+ >,
36
+ keyof {
37
+ ariaLabel?: string | undefined;
38
+ isDisabled?: boolean | undefined;
39
+ isRequired?: boolean | undefined;
40
+ isInvalid?: boolean | undefined;
41
+ isChecked?: boolean | undefined;
42
+ label?: ReactNode;
43
+ onChange?:
44
+ | ((
45
+ e: ChangeEvent<HTMLInputElement>,
46
+ analyticsEvent: UIAnalyticsEvent,
47
+ ) => void)
48
+ | undefined;
49
+ value?: string | undefined;
50
+ testId?: string | undefined;
51
+ analyticsContext?: Record<string, any> | undefined;
52
+ }
53
+ > & {
54
+ ariaLabel?: string | undefined;
55
+ isDisabled?: boolean | undefined;
56
+ isRequired?: boolean | undefined;
57
+ isInvalid?: boolean | undefined;
58
+ isChecked?: boolean | undefined;
59
+ label?: ReactNode;
60
+ onChange?:
61
+ | ((
62
+ e: ChangeEvent<HTMLInputElement>,
63
+ analyticsEvent: UIAnalyticsEvent,
64
+ ) => void)
65
+ | undefined;
66
+ value?: string | undefined;
67
+ testId?: string | undefined;
68
+ analyticsContext?: Record<string, any> | undefined;
69
+ } & WithAnalyticsEventsProps,
70
+ | 'accept'
71
+ | 'alt'
72
+ | 'autoComplete'
73
+ | 'autoFocus'
74
+ | 'capture'
75
+ | 'crossOrigin'
76
+ | 'form'
77
+ | 'formAction'
78
+ | 'formEncType'
79
+ | 'formMethod'
80
+ | 'formNoValidate'
81
+ | 'formTarget'
82
+ | 'height'
83
+ | 'list'
84
+ | 'max'
85
+ | 'maxLength'
86
+ | 'min'
87
+ | 'minLength'
88
+ | 'multiple'
89
+ | 'name'
90
+ | 'pattern'
91
+ | 'placeholder'
92
+ | 'readOnly'
93
+ | 'size'
94
+ | 'src'
95
+ | 'step'
96
+ | 'type'
97
+ | 'width'
98
+ | 'defaultChecked'
99
+ | 'defaultValue'
100
+ | 'suppressContentEditableWarning'
101
+ | 'suppressHydrationWarning'
102
+ | 'accessKey'
103
+ | 'className'
104
+ | 'contentEditable'
105
+ | 'contextMenu'
106
+ | 'dir'
107
+ | 'draggable'
108
+ | 'hidden'
109
+ | 'id'
110
+ | 'lang'
111
+ | 'slot'
112
+ | 'spellCheck'
113
+ | 'style'
114
+ | 'tabIndex'
115
+ | 'title'
116
+ | 'inputMode'
117
+ | 'is'
118
+ | 'radioGroup'
119
+ | 'role'
120
+ | 'about'
121
+ | 'datatype'
122
+ | 'inlist'
123
+ | 'prefix'
124
+ | 'property'
125
+ | 'resource'
126
+ | 'typeof'
127
+ | 'vocab'
128
+ | 'autoCapitalize'
129
+ | 'autoCorrect'
130
+ | 'autoSave'
131
+ | 'color'
132
+ | 'itemProp'
133
+ | 'itemScope'
134
+ | 'itemType'
135
+ | 'itemID'
136
+ | 'itemRef'
137
+ | 'results'
138
+ | 'security'
139
+ | 'unselectable'
140
+ | 'aria-activedescendant'
141
+ | 'aria-atomic'
142
+ | 'aria-autocomplete'
143
+ | 'aria-busy'
144
+ | 'aria-checked'
145
+ | 'aria-colcount'
146
+ | 'aria-colindex'
147
+ | 'aria-colspan'
148
+ | 'aria-controls'
149
+ | 'aria-current'
150
+ | 'aria-describedby'
151
+ | 'aria-details'
152
+ | 'aria-disabled'
153
+ | 'aria-dropeffect'
154
+ | 'aria-errormessage'
155
+ | 'aria-expanded'
156
+ | 'aria-flowto'
157
+ | 'aria-grabbed'
158
+ | 'aria-haspopup'
159
+ | 'aria-hidden'
160
+ | 'aria-invalid'
161
+ | 'aria-keyshortcuts'
162
+ | 'aria-labelledby'
163
+ | 'aria-level'
164
+ | 'aria-live'
165
+ | 'aria-modal'
166
+ | 'aria-multiline'
167
+ | 'aria-multiselectable'
168
+ | 'aria-orientation'
169
+ | 'aria-owns'
170
+ | 'aria-placeholder'
171
+ | 'aria-posinset'
172
+ | 'aria-pressed'
173
+ | 'aria-readonly'
174
+ | 'aria-relevant'
175
+ | 'aria-required'
176
+ | 'aria-roledescription'
177
+ | 'aria-rowcount'
178
+ | 'aria-rowindex'
179
+ | 'aria-rowspan'
180
+ | 'aria-selected'
181
+ | 'aria-setsize'
182
+ | 'aria-sort'
183
+ | 'aria-valuemax'
184
+ | 'aria-valuemin'
185
+ | 'aria-valuenow'
186
+ | 'aria-valuetext'
187
+ | 'children'
188
+ | 'dangerouslySetInnerHTML'
189
+ | 'onCopy'
190
+ | 'onCopyCapture'
191
+ | 'onCut'
192
+ | 'onCutCapture'
193
+ | 'onPaste'
194
+ | 'onPasteCapture'
195
+ | 'onCompositionEnd'
196
+ | 'onCompositionEndCapture'
197
+ | 'onCompositionStart'
198
+ | 'onCompositionStartCapture'
199
+ | 'onCompositionUpdate'
200
+ | 'onCompositionUpdateCapture'
201
+ | 'onFocus'
202
+ | 'onFocusCapture'
203
+ | 'onBlur'
204
+ | 'onBlurCapture'
205
+ | 'onChangeCapture'
206
+ | 'onBeforeInput'
207
+ | 'onBeforeInputCapture'
208
+ | 'onInput'
209
+ | 'onInputCapture'
210
+ | 'onReset'
211
+ | 'onResetCapture'
212
+ | 'onSubmit'
213
+ | 'onSubmitCapture'
214
+ | 'onInvalid'
215
+ | 'onInvalidCapture'
216
+ | 'onLoad'
217
+ | 'onLoadCapture'
218
+ | 'onError'
219
+ | 'onErrorCapture'
220
+ | 'onKeyDown'
221
+ | 'onKeyDownCapture'
222
+ | 'onKeyPress'
223
+ | 'onKeyPressCapture'
224
+ | 'onKeyUp'
225
+ | 'onKeyUpCapture'
226
+ | 'onAbort'
227
+ | 'onAbortCapture'
228
+ | 'onCanPlay'
229
+ | 'onCanPlayCapture'
230
+ | 'onCanPlayThrough'
231
+ | 'onCanPlayThroughCapture'
232
+ | 'onDurationChange'
233
+ | 'onDurationChangeCapture'
234
+ | 'onEmptied'
235
+ | 'onEmptiedCapture'
236
+ | 'onEncrypted'
237
+ | 'onEncryptedCapture'
238
+ | 'onEnded'
239
+ | 'onEndedCapture'
240
+ | 'onLoadedData'
241
+ | 'onLoadedDataCapture'
242
+ | 'onLoadedMetadata'
243
+ | 'onLoadedMetadataCapture'
244
+ | 'onLoadStart'
245
+ | 'onLoadStartCapture'
246
+ | 'onPause'
247
+ | 'onPauseCapture'
248
+ | 'onPlay'
249
+ | 'onPlayCapture'
250
+ | 'onPlaying'
251
+ | 'onPlayingCapture'
252
+ | 'onProgress'
253
+ | 'onProgressCapture'
254
+ | 'onRateChange'
255
+ | 'onRateChangeCapture'
256
+ | 'onSeeked'
257
+ | 'onSeekedCapture'
258
+ | 'onSeeking'
259
+ | 'onSeekingCapture'
260
+ | 'onStalled'
261
+ | 'onStalledCapture'
262
+ | 'onSuspend'
263
+ | 'onSuspendCapture'
264
+ | 'onTimeUpdate'
265
+ | 'onTimeUpdateCapture'
266
+ | 'onVolumeChange'
267
+ | 'onVolumeChangeCapture'
268
+ | 'onWaiting'
269
+ | 'onWaitingCapture'
270
+ | 'onAuxClick'
271
+ | 'onAuxClickCapture'
272
+ | 'onClick'
273
+ | 'onClickCapture'
274
+ | 'onContextMenu'
275
+ | 'onContextMenuCapture'
276
+ | 'onDoubleClick'
277
+ | 'onDoubleClickCapture'
278
+ | 'onDrag'
279
+ | 'onDragCapture'
280
+ | 'onDragEnd'
281
+ | 'onDragEndCapture'
282
+ | 'onDragEnter'
283
+ | 'onDragEnterCapture'
284
+ | 'onDragExit'
285
+ | 'onDragExitCapture'
286
+ | 'onDragLeave'
287
+ | 'onDragLeaveCapture'
288
+ | 'onDragOver'
289
+ | 'onDragOverCapture'
290
+ | 'onDragStart'
291
+ | 'onDragStartCapture'
292
+ | 'onDrop'
293
+ | 'onDropCapture'
294
+ | 'onMouseDown'
295
+ | 'onMouseDownCapture'
296
+ | 'onMouseEnter'
297
+ | 'onMouseLeave'
298
+ | 'onMouseMove'
299
+ | 'onMouseMoveCapture'
300
+ | 'onMouseOut'
301
+ | 'onMouseOutCapture'
302
+ | 'onMouseOver'
303
+ | 'onMouseOverCapture'
304
+ | 'onMouseUp'
305
+ | 'onMouseUpCapture'
306
+ | 'onSelect'
307
+ | 'onSelectCapture'
308
+ | 'onTouchCancel'
309
+ | 'onTouchCancelCapture'
310
+ | 'onTouchEnd'
311
+ | 'onTouchEndCapture'
312
+ | 'onTouchMove'
313
+ | 'onTouchMoveCapture'
314
+ | 'onTouchStart'
315
+ | 'onTouchStartCapture'
316
+ | 'onPointerDown'
317
+ | 'onPointerDownCapture'
318
+ | 'onPointerMove'
319
+ | 'onPointerMoveCapture'
320
+ | 'onPointerUp'
321
+ | 'onPointerUpCapture'
322
+ | 'onPointerCancel'
323
+ | 'onPointerCancelCapture'
324
+ | 'onPointerEnter'
325
+ | 'onPointerEnterCapture'
326
+ | 'onPointerLeave'
327
+ | 'onPointerLeaveCapture'
328
+ | 'onPointerOver'
329
+ | 'onPointerOverCapture'
330
+ | 'onPointerOut'
331
+ | 'onPointerOutCapture'
332
+ | 'onGotPointerCapture'
333
+ | 'onGotPointerCaptureCapture'
334
+ | 'onLostPointerCapture'
335
+ | 'onLostPointerCaptureCapture'
336
+ | 'onScroll'
337
+ | 'onScrollCapture'
338
+ | 'onWheel'
339
+ | 'onWheelCapture'
340
+ | 'onAnimationStart'
341
+ | 'onAnimationStartCapture'
342
+ | 'onAnimationEnd'
343
+ | 'onAnimationEndCapture'
344
+ | 'onAnimationIteration'
345
+ | 'onAnimationIterationCapture'
346
+ | 'onTransitionEnd'
347
+ | 'onTransitionEndCapture'
348
+ | 'css'
349
+ | keyof {
350
+ ariaLabel?: string | undefined;
351
+ isDisabled?: boolean | undefined;
352
+ isRequired?: boolean | undefined;
353
+ isInvalid?: boolean | undefined;
354
+ isChecked?: boolean | undefined;
355
+ label?: ReactNode;
356
+ onChange?:
357
+ | ((
358
+ e: ChangeEvent<HTMLInputElement>,
359
+ analyticsEvent: UIAnalyticsEvent,
360
+ ) => void)
361
+ | undefined;
362
+ value?: string | undefined;
363
+ testId?: string | undefined;
364
+ analyticsContext?: Record<string, any> | undefined;
365
+ }
366
+ | 'createAnalyticsEvent'
367
+ > &
368
+ RefAttributes<HTMLInputElement>
369
+ >>;
370
+
371
+ export declare function RadioGroup(props: RadioGroupProps): JSX.Element;
372
+
373
+ declare interface RadioGroupProps {
374
+ /** Once set, controls the selected value on the `RadioGroup` */
375
+ value?: RadioValue | null;
376
+ /** Sets the initial selected value on the `RadioGroup` */
377
+ defaultValue?: RadioValue | null;
378
+ /** Sets the disabled state of all `Radio` elements in the group. Overrides the `isDisabled` setting of all child `Radio` items. */
379
+ isDisabled?: boolean;
380
+ /** Sets the required state of all `Radio` elements in the group */
381
+ isRequired?: boolean;
382
+ /** Sets the invalid state of all `Radio` elements in the group */
383
+ isInvalid?: boolean;
384
+ /** An array of objects, each object is mapped onto a `Radio` element within the group. Name must be unique to the group. */
385
+ options: OptionsPropType;
386
+ /** Function that gets fired after each invalid event */
387
+ onInvalid?: (event: SyntheticEvent<any>) => void;
388
+ /** Function that gets after each change event */
389
+ onChange?: (
390
+ e: React_2.ChangeEvent<HTMLInputElement>,
391
+ analyticsEvent: UIAnalyticsEvent,
392
+ ) => void;
393
+ /** Sets the `name` prop on each of the `Radio` elements in the group */
394
+ name?: string;
395
+ /** Additional information to be included in the `context` of analytics events that come from radio */
396
+ analyticsContext?: Record<string, any>;
397
+ /** The id of the element that links to this radiogroup. */
398
+ 'aria-labelledby'?: string;
399
+ }
400
+
401
+ declare type RadioValue = string;
402
+
403
+ export {};
404
+ ```
@@ -1,28 +0,0 @@
1
- import React, { SyntheticEvent } from 'react';
2
- import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
- import { OptionsPropType, RadioValue } from './types';
4
- export interface RadioGroupProps {
5
- /** Once set, controls the selected value on the `RadioGroup` */
6
- value?: RadioValue | null;
7
- /** Sets the initial selected value on the `RadioGroup` */
8
- defaultValue?: RadioValue | null;
9
- /** Sets the disabled state of all `Radio` elements in the group. Overrides the `isDisabled` setting of all child `Radio` items. */
10
- isDisabled?: boolean;
11
- /** Sets the required state of all `Radio` elements in the group */
12
- isRequired?: boolean;
13
- /** Sets the invalid state of all `Radio` elements in the group */
14
- isInvalid?: boolean;
15
- /** An array of objects, each object is mapped onto a `Radio` element within the group. Name must be unique to the group. */
16
- options: OptionsPropType;
17
- /** Function that gets fired after each invalid event */
18
- onInvalid?: (event: SyntheticEvent<any>) => void;
19
- /** Function that gets after each change event */
20
- onChange?: (e: React.ChangeEvent<HTMLInputElement>, analyticsEvent: UIAnalyticsEvent) => void;
21
- /** Sets the `name` prop on each of the `Radio` elements in the group */
22
- name?: string;
23
- /** Additional information to be included in the `context` of analytics events that come from radio */
24
- analyticsContext?: Record<string, any>;
25
- /** The id of the element that links to this radiogroup. */
26
- 'aria-labelledby'?: string;
27
- }
28
- export default function RadioGroup(props: RadioGroupProps): JSX.Element;