@atlaskit/radio 7.0.1 → 7.2.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,25 @@
1
1
  # @atlaskit/radio
2
2
 
3
+ ## 7.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#109060](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/109060)
8
+ [`4660ec858a305`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4660ec858a305) -
9
+ Update `React` from v16 to v18
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 7.1.0
16
+
17
+ ### Minor Changes
18
+
19
+ - [#100775](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/100775)
20
+ [`82ed9ca7cc608`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/82ed9ca7cc608) -
21
+ add aria-describedby for error handling to radio group
22
+
3
23
  ## 7.0.1
4
24
 
5
25
  ### Patch Changes
@@ -11,6 +11,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
11
11
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
12
12
  var _react = _interopRequireWildcard(require("react"));
13
13
  var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
14
+ var _useId = require("@atlaskit/ds-lib/use-id");
14
15
  var _radio = _interopRequireDefault(require("./radio"));
15
16
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
16
17
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -21,6 +22,7 @@ function RadioGroup(props) {
21
22
  options = _props$options === void 0 ? noOptions : _props$options,
22
23
  propValue = props.value,
23
24
  defaultValue = props.defaultValue,
25
+ id = props.id,
24
26
  isDisabled = props.isDisabled,
25
27
  isRequired = props.isRequired,
26
28
  isInvalid = props.isInvalid,
@@ -30,6 +32,7 @@ function RadioGroup(props) {
30
32
  analyticsContext = props.analyticsContext,
31
33
  ariaLabelledBy = props['aria-labelledby'],
32
34
  testId = props.testId;
35
+ var uid = (0, _useId.useId)();
33
36
  var _useState = (0, _react.useState)(propValue !== undefined ? propValue : defaultValue),
34
37
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
35
38
  selectedValue = _useState2[0],
@@ -47,7 +50,9 @@ function RadioGroup(props) {
47
50
  return /*#__PURE__*/_react.default.createElement("div", {
48
51
  role: "radiogroup",
49
52
  "aria-labelledby": ariaLabelledBy,
50
- "data-testid": testId
53
+ "data-testid": testId,
54
+ "aria-describedby": isInvalid ? "".concat(id || uid, "-error") : undefined,
55
+ id: id || uid
51
56
  }, options.map(function (_ref, index) {
52
57
  var optionProps = (0, _extends2.default)({}, ((0, _objectDestructuringEmpty2.default)(_ref), _ref));
53
58
  if (typeof isDisabled !== 'undefined') {
package/dist/cjs/radio.js CHANGED
@@ -1,4 +1,4 @@
1
- /* radio.tsx generated by @compiled/babel-plugin v0.35.0 */
1
+ /* radio.tsx generated by @compiled/babel-plugin v0.36.0 */
2
2
  "use strict";
3
3
 
4
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -21,7 +21,7 @@ var _excluded = ["ariaLabel", "isDisabled", "isRequired", "isInvalid", "isChecke
21
21
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
22
22
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
23
23
  var packageName = "@atlaskit/radio";
24
- var packageVersion = "7.0.1";
24
+ var packageVersion = "7.2.0";
25
25
  var noop = _noop.default;
26
26
  var labelPaddingStyles = null;
27
27
  var labelStyles = null;
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useCallback, useState } from 'react';
3
3
  import noop from '@atlaskit/ds-lib/noop';
4
+ import { useId } from '@atlaskit/ds-lib/use-id';
4
5
  import Radio from './radio';
5
6
  const noOptions = [];
6
7
  export default function RadioGroup(props) {
@@ -9,6 +10,7 @@ export default function RadioGroup(props) {
9
10
  options = noOptions,
10
11
  value: propValue,
11
12
  defaultValue,
13
+ id,
12
14
  isDisabled,
13
15
  isRequired,
14
16
  isInvalid,
@@ -18,6 +20,7 @@ export default function RadioGroup(props) {
18
20
  ['aria-labelledby']: ariaLabelledBy,
19
21
  testId
20
22
  } = props;
23
+ const uid = useId();
21
24
  const [selectedValue, setSelectedValue] = useState(propValue !== undefined ? propValue : defaultValue);
22
25
  const onRadioChange = useCallback((e, analyticsEvent) => {
23
26
  setSelectedValue(e.currentTarget.value);
@@ -32,7 +35,9 @@ export default function RadioGroup(props) {
32
35
  return /*#__PURE__*/React.createElement("div", {
33
36
  role: "radiogroup",
34
37
  "aria-labelledby": ariaLabelledBy,
35
- "data-testid": testId
38
+ "data-testid": testId,
39
+ "aria-describedby": isInvalid ? `${id || uid}-error` : undefined,
40
+ id: id || uid
36
41
  }, options.map(({
37
42
  ...optionProps
38
43
  }, index) => {
@@ -1,4 +1,4 @@
1
- /* radio.tsx generated by @compiled/babel-plugin v0.35.0 */
1
+ /* radio.tsx generated by @compiled/babel-plugin v0.36.0 */
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import "./radio.compiled.css";
4
4
  import * as React from 'react';
@@ -9,7 +9,7 @@ import __noop from '@atlaskit/ds-lib/noop';
9
9
  import { fg } from '@atlaskit/platform-feature-flags';
10
10
  import { B200, B300, B400, B50, N10, N100, N20, N30, N70, N80, N900, R300 } from '@atlaskit/theme/colors';
11
11
  const packageName = "@atlaskit/radio";
12
- const packageVersion = "7.0.1";
12
+ const packageVersion = "7.2.0";
13
13
  const noop = __noop;
14
14
  const labelPaddingStyles = null;
15
15
  const labelStyles = null;
@@ -3,6 +3,7 @@ import _extends from "@babel/runtime/helpers/extends";
3
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
4
  import React, { useCallback, useState } from 'react';
5
5
  import noop from '@atlaskit/ds-lib/noop';
6
+ import { useId } from '@atlaskit/ds-lib/use-id';
6
7
  import Radio from './radio';
7
8
  var noOptions = [];
8
9
  export default function RadioGroup(props) {
@@ -11,6 +12,7 @@ export default function RadioGroup(props) {
11
12
  options = _props$options === void 0 ? noOptions : _props$options,
12
13
  propValue = props.value,
13
14
  defaultValue = props.defaultValue,
15
+ id = props.id,
14
16
  isDisabled = props.isDisabled,
15
17
  isRequired = props.isRequired,
16
18
  isInvalid = props.isInvalid,
@@ -20,6 +22,7 @@ export default function RadioGroup(props) {
20
22
  analyticsContext = props.analyticsContext,
21
23
  ariaLabelledBy = props['aria-labelledby'],
22
24
  testId = props.testId;
25
+ var uid = useId();
23
26
  var _useState = useState(propValue !== undefined ? propValue : defaultValue),
24
27
  _useState2 = _slicedToArray(_useState, 2),
25
28
  selectedValue = _useState2[0],
@@ -37,7 +40,9 @@ export default function RadioGroup(props) {
37
40
  return /*#__PURE__*/React.createElement("div", {
38
41
  role: "radiogroup",
39
42
  "aria-labelledby": ariaLabelledBy,
40
- "data-testid": testId
43
+ "data-testid": testId,
44
+ "aria-describedby": isInvalid ? "".concat(id || uid, "-error") : undefined,
45
+ id: id || uid
41
46
  }, options.map(function (_ref, index) {
42
47
  var optionProps = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
43
48
  if (typeof isDisabled !== 'undefined') {
package/dist/esm/radio.js CHANGED
@@ -1,4 +1,4 @@
1
- /* radio.tsx generated by @compiled/babel-plugin v0.35.0 */
1
+ /* radio.tsx generated by @compiled/babel-plugin v0.36.0 */
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
4
  var _excluded = ["ariaLabel", "isDisabled", "isRequired", "isInvalid", "isChecked", "label", "name", "onChange", "value", "testId", "analyticsContext"];
@@ -11,7 +11,7 @@ import __noop from '@atlaskit/ds-lib/noop';
11
11
  import { fg } from '@atlaskit/platform-feature-flags';
12
12
  import { B200, B300, B400, B50, N10, N100, N20, N30, N70, N80, N900, R300 } from '@atlaskit/theme/colors';
13
13
  var packageName = "@atlaskit/radio";
14
- var packageVersion = "7.0.1";
14
+ var packageVersion = "7.2.0";
15
15
  var noop = __noop;
16
16
  var labelPaddingStyles = null;
17
17
  var labelStyles = null;
@@ -2,6 +2,7 @@ import React, { type SyntheticEvent } from 'react';
2
2
  import { type UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
3
  import { type OptionsPropType, type RadioValue } from './types';
4
4
  export interface RadioGroupProps {
5
+ id?: string;
5
6
  /**
6
7
  * Once set, controls the selected value on the `RadioGroup`.
7
8
  */
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ import { type RadioProps } from './types';
2
3
  /**
3
4
  * __Radio__
4
5
  *
@@ -8,38 +9,5 @@
8
9
  * - [Code](https://atlassian.design/components/radio/code)
9
10
  * - [Usage](https://atlassian.design/components/radio/usage)
10
11
  */
11
- declare const Radio: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Pick<Omit<Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "aria-label" | "disabled" | "required" | "checked" | "value" | "crossOrigin">, keyof {
12
- ariaLabel?: string | undefined;
13
- isDisabled?: boolean | undefined;
14
- isRequired?: boolean | undefined;
15
- isInvalid?: boolean | undefined;
16
- isChecked?: boolean | undefined;
17
- label?: import("react").ReactNode;
18
- onChange?: ((e: import("react").ChangeEvent<HTMLInputElement>, analyticsEvent: import("@atlaskit/analytics-next").UIAnalyticsEvent) => void) | undefined;
19
- value?: string | undefined;
20
- testId?: string | undefined;
21
- analyticsContext?: Record<string, any> | undefined;
22
- }> & {
23
- ariaLabel?: string | undefined;
24
- isDisabled?: boolean | undefined;
25
- isRequired?: boolean | undefined;
26
- isInvalid?: boolean | undefined;
27
- isChecked?: boolean | undefined;
28
- label?: import("react").ReactNode;
29
- onChange?: ((e: import("react").ChangeEvent<HTMLInputElement>, analyticsEvent: import("@atlaskit/analytics-next").UIAnalyticsEvent) => void) | undefined;
30
- value?: string | undefined;
31
- testId?: string | undefined;
32
- analyticsContext?: Record<string, any> | undefined;
33
- } & import("@atlaskit/analytics-next").WithAnalyticsEventsProps, "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "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
- ariaLabel?: string | undefined;
35
- isDisabled?: boolean | undefined;
36
- isRequired?: boolean | undefined;
37
- isInvalid?: boolean | undefined;
38
- isChecked?: boolean | undefined;
39
- label?: import("react").ReactNode;
40
- onChange?: ((e: import("react").ChangeEvent<HTMLInputElement>, analyticsEvent: import("@atlaskit/analytics-next").UIAnalyticsEvent) => void) | undefined;
41
- value?: string | undefined;
42
- testId?: string | undefined;
43
- analyticsContext?: Record<string, any> | undefined;
44
- } | "createAnalyticsEvent"> & import("react").RefAttributes<HTMLInputElement>>>;
12
+ declare const Radio: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Omit<RadioProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>>;
45
13
  export default Radio;
@@ -2,6 +2,7 @@ import React, { type SyntheticEvent } from 'react';
2
2
  import { type UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
3
  import { type OptionsPropType, type RadioValue } from './types';
4
4
  export interface RadioGroupProps {
5
+ id?: string;
5
6
  /**
6
7
  * Once set, controls the selected value on the `RadioGroup`.
7
8
  */
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ import { type RadioProps } from './types';
2
3
  /**
3
4
  * __Radio__
4
5
  *
@@ -8,38 +9,5 @@
8
9
  * - [Code](https://atlassian.design/components/radio/code)
9
10
  * - [Usage](https://atlassian.design/components/radio/usage)
10
11
  */
11
- declare const Radio: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Pick<Omit<Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "aria-label" | "disabled" | "required" | "checked" | "value" | "crossOrigin">, keyof {
12
- ariaLabel?: string | undefined;
13
- isDisabled?: boolean | undefined;
14
- isRequired?: boolean | undefined;
15
- isInvalid?: boolean | undefined;
16
- isChecked?: boolean | undefined;
17
- label?: import("react").ReactNode;
18
- onChange?: ((e: import("react").ChangeEvent<HTMLInputElement>, analyticsEvent: import("@atlaskit/analytics-next").UIAnalyticsEvent) => void) | undefined;
19
- value?: string | undefined;
20
- testId?: string | undefined;
21
- analyticsContext?: Record<string, any> | undefined;
22
- }> & {
23
- ariaLabel?: string | undefined;
24
- isDisabled?: boolean | undefined;
25
- isRequired?: boolean | undefined;
26
- isInvalid?: boolean | undefined;
27
- isChecked?: boolean | undefined;
28
- label?: import("react").ReactNode;
29
- onChange?: ((e: import("react").ChangeEvent<HTMLInputElement>, analyticsEvent: import("@atlaskit/analytics-next").UIAnalyticsEvent) => void) | undefined;
30
- value?: string | undefined;
31
- testId?: string | undefined;
32
- analyticsContext?: Record<string, any> | undefined;
33
- } & import("@atlaskit/analytics-next").WithAnalyticsEventsProps, "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "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
- ariaLabel?: string | undefined;
35
- isDisabled?: boolean | undefined;
36
- isRequired?: boolean | undefined;
37
- isInvalid?: boolean | undefined;
38
- isChecked?: boolean | undefined;
39
- label?: import("react").ReactNode;
40
- onChange?: ((e: import("react").ChangeEvent<HTMLInputElement>, analyticsEvent: import("@atlaskit/analytics-next").UIAnalyticsEvent) => void) | undefined;
41
- value?: string | undefined;
42
- testId?: string | undefined;
43
- analyticsContext?: Record<string, any> | undefined;
44
- } | "createAnalyticsEvent"> & import("react").RefAttributes<HTMLInputElement>>>;
12
+ declare const Radio: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Omit<RadioProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>>;
45
13
  export default Radio;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/radio",
3
- "version": "7.0.1",
3
+ "version": "7.2.0",
4
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/"
@@ -39,12 +39,12 @@
39
39
  ".": "./src/index.tsx"
40
40
  },
41
41
  "dependencies": {
42
- "@atlaskit/analytics-next": "^10.2.0",
43
- "@atlaskit/css": "^0.7.0",
44
- "@atlaskit/ds-lib": "^3.3.0",
42
+ "@atlaskit/analytics-next": "^10.3.0",
43
+ "@atlaskit/css": "^0.8.0",
44
+ "@atlaskit/ds-lib": "^3.5.0",
45
45
  "@atlaskit/platform-feature-flags": "^0.3.0",
46
- "@atlaskit/theme": "^14.0.0",
47
- "@atlaskit/tokens": "^3.0.0",
46
+ "@atlaskit/theme": "^14.1.0",
47
+ "@atlaskit/tokens": "^3.3.0",
48
48
  "@babel/runtime": "^7.0.0",
49
49
  "@compiled/react": "^0.18.1"
50
50
  },
@@ -55,12 +55,12 @@
55
55
  "@af/accessibility-testing": "*",
56
56
  "@af/integration-testing": "*",
57
57
  "@af/visual-regression": "*",
58
- "@atlaskit/checkbox": "^15.2.0",
58
+ "@atlaskit/checkbox": "^15.3.0",
59
59
  "@atlaskit/ssr": "*",
60
60
  "@atlaskit/visual-regression": "*",
61
61
  "@atlassian/feature-flags-test-utils": "*",
62
- "@testing-library/react": "^12.1.5",
63
- "react-dom": "^16.8.0",
62
+ "@testing-library/react": "^13.4.0",
63
+ "react-dom": "^18.2.0",
64
64
  "storybook-addon-performance": "^0.17.3",
65
65
  "typescript": "~5.4.2"
66
66
  },
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
-
3
- import noop from '@atlaskit/ds-lib/noop';
4
-
5
- import { Radio } from '../src';
6
-
7
- export default () => (
8
- <Radio
9
- value="default radio"
10
- label="Default radio"
11
- name="radio-default"
12
- testId="radio-default"
13
- isChecked={true}
14
- onChange={noop}
15
- />
16
- );
@@ -1,84 +0,0 @@
1
- import React from 'react';
2
-
3
- import { fireEvent } from '@testing-library/react';
4
- import { type InteractionTaskArgs, type PublicInteractionTask } from 'storybook-addon-performance';
5
-
6
- import RadioGroup from '../src/radio-group';
7
-
8
- const interactionTasks: PublicInteractionTask[] = [
9
- {
10
- name: 'Select radio input',
11
- description: 'Select a radio input when nothing is selected',
12
- run: async ({ container, controls }: InteractionTaskArgs): Promise<void> => {
13
- const radio: HTMLElement | null = container.querySelector('input[name="color"][value="red"]');
14
- if (radio == null) {
15
- throw new Error('Could not find radio element');
16
- }
17
- await controls.time(async () => {
18
- fireEvent.click(radio);
19
- });
20
- },
21
- },
22
- {
23
- name: 'Hovering radio input',
24
- description: 'Hover over one radio input',
25
- run: async ({ container, controls }: InteractionTaskArgs): Promise<void> => {
26
- const radio: HTMLElement | null = container.querySelector('input[name="color"][value="red"]');
27
- if (radio == null) {
28
- throw new Error('Could not find radio element');
29
- }
30
- await controls.time(async () => {
31
- fireEvent.mouseOver(radio);
32
- });
33
- },
34
- },
35
- {
36
- name: 'Changing radio input',
37
- description: 'Select a radio input then click on another radio input',
38
- run: async ({ container, controls }: InteractionTaskArgs): Promise<void> => {
39
- const redRadio: HTMLElement | null = container.querySelector(
40
- 'input[name="color"][value="red"]',
41
- );
42
- if (redRadio == null) {
43
- throw new Error('Could not find radio element');
44
- }
45
- const blueRadio: HTMLElement | null = container.querySelector(
46
- 'input[name="color"][value="blue"]',
47
- );
48
- if (blueRadio == null) {
49
- throw new Error('Could not find radio element');
50
- }
51
-
52
- fireEvent.click(redRadio);
53
-
54
- await controls.time(async () => {
55
- fireEvent.click(blueRadio);
56
- });
57
- },
58
- },
59
- ];
60
-
61
- function PerformanceComponent() {
62
- return (
63
- <RadioGroup
64
- options={[
65
- { name: 'color', value: 'red', label: 'Red' },
66
- { name: 'color', value: 'blue', label: 'Blue' },
67
- { name: 'color', value: 'yellow', label: 'Yellow' },
68
- { name: 'color', value: 'green', label: 'Green' },
69
- { name: 'color', value: 'black', label: 'Black' },
70
- ]}
71
- />
72
- );
73
- }
74
-
75
- PerformanceComponent.story = {
76
- name: 'Performance',
77
- parameters: {
78
- performance: {
79
- interactions: interactionTasks,
80
- },
81
- },
82
- };
83
-
84
- export default PerformanceComponent;