@atlaskit/radio 6.0.2 → 6.0.3

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,11 @@
1
1
  # @atlaskit/radio
2
2
 
3
+ ## 6.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#78598](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/78598) [`cabae83473c3`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/cabae83473c3) - [ux] Focus styles for Checkbox and Radio components
8
+
3
9
  ## 6.0.2
4
10
 
5
11
  ### Patch Changes
package/dist/cjs/radio.js CHANGED
@@ -17,7 +17,7 @@ var _constants = require("@atlaskit/theme/constants");
17
17
  var _excluded = ["ariaLabel", "isDisabled", "isRequired", "isInvalid", "isChecked", "label", "name", "onChange", "value", "testId", "analyticsContext"];
18
18
  /** @jsx jsx */
19
19
  var packageName = "@atlaskit/radio";
20
- var packageVersion = "6.0.2";
20
+ var packageVersion = "6.0.3";
21
21
  var fontFamily = (0, _constants.fontFamily)();
22
22
  var noop = _noop.default;
23
23
  var labelPaddingStyles = (0, _react2.css)({
@@ -94,7 +94,8 @@ var radioStyles = (0, _react2.css)({
94
94
  '--radio-background-color': "var(--ds-background-input-pressed, ".concat(_colors.N30, ")")
95
95
  },
96
96
  '&:focus': {
97
- '--radio-border-color': "var(--ds-border-focused, ".concat(_colors.B100, ")")
97
+ outline: "var(--ds-border-width-outline, 3px)".concat(" solid ", "var(--ds-border-focused, ".concat(_colors.B200, ")")),
98
+ outlineOffset: "var(--ds-border-width-indicator, 3px)"
98
99
  },
99
100
  '&:checked': {
100
101
  '--radio-background-color': "var(--ds-background-selected-bold, ".concat(_colors.B400, ")"),
@@ -111,7 +112,8 @@ var radioStyles = (0, _react2.css)({
111
112
  '--radio-dot-color': "var(--ds-icon-inverse, ".concat(_colors.B400, ")")
112
113
  },
113
114
  '&:checked:focus': {
114
- '--radio-border-color': "var(--ds-border-focused, ".concat(_colors.B100, ")")
115
+ outline: "var(--ds-border-width-outline, 3px)".concat(" solid ", "var(--ds-border-focused, ".concat(_colors.B200, ")")),
116
+ outlineOffset: "var(--ds-border-width-indicator, 3px)"
115
117
  },
116
118
  // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
117
119
  '&[data-invalid], &:checked[data-invalid]': {
@@ -154,6 +156,8 @@ var InnerRadio = /*#__PURE__*/(0, _react.forwardRef)(function Radio(props, ref)
154
156
  "data-disabled": isDisabled ? 'true' : undefined,
155
157
  css: labelStyles
156
158
  }, (0, _react2.jsx)("input", (0, _extends2.default)({}, rest, {
159
+ // It is necessary only for Safari. It allows to render focus styles.
160
+ tabIndex: 0,
157
161
  "aria-label": ariaLabel,
158
162
  checked: isChecked,
159
163
  disabled: isDisabled,
@@ -5,10 +5,10 @@ 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 { B100, B300, B400, B50, N10, N100, N20, N30, N40, N70, N80, N900, R300 } from '@atlaskit/theme/colors';
8
+ import { B200, B300, B400, B50, N10, N100, N20, N30, N40, N70, N80, N900, R300 } from '@atlaskit/theme/colors';
9
9
  import { fontFamily as getFontFamily } from '@atlaskit/theme/constants';
10
10
  const packageName = "@atlaskit/radio";
11
- const packageVersion = "6.0.2";
11
+ const packageVersion = "6.0.3";
12
12
  const fontFamily = getFontFamily();
13
13
  const noop = __noop;
14
14
  const labelPaddingStyles = css({
@@ -85,7 +85,8 @@ const radioStyles = css({
85
85
  '--radio-background-color': `var(--ds-background-input-pressed, ${N30})`
86
86
  },
87
87
  '&:focus': {
88
- '--radio-border-color': `var(--ds-border-focused, ${B100})`
88
+ outline: `${"var(--ds-border-width-outline, 3px)"} solid ${`var(--ds-border-focused, ${B200})`}`,
89
+ outlineOffset: "var(--ds-border-width-indicator, 3px)"
89
90
  },
90
91
  '&:checked': {
91
92
  '--radio-background-color': `var(--ds-background-selected-bold, ${B400})`,
@@ -102,7 +103,8 @@ const radioStyles = css({
102
103
  '--radio-dot-color': `var(--ds-icon-inverse, ${B400})`
103
104
  },
104
105
  '&:checked:focus': {
105
- '--radio-border-color': `var(--ds-border-focused, ${B100})`
106
+ outline: `${"var(--ds-border-width-outline, 3px)"} solid ${`var(--ds-border-focused, ${B200})`}`,
107
+ outlineOffset: "var(--ds-border-width-indicator, 3px)"
106
108
  },
107
109
  // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
108
110
  '&[data-invalid], &:checked[data-invalid]': {
@@ -144,6 +146,8 @@ const InnerRadio = /*#__PURE__*/forwardRef(function Radio(props, ref) {
144
146
  "data-disabled": isDisabled ? 'true' : undefined,
145
147
  css: labelStyles
146
148
  }, jsx("input", _extends({}, rest, {
149
+ // It is necessary only for Safari. It allows to render focus styles.
150
+ tabIndex: 0,
147
151
  "aria-label": ariaLabel,
148
152
  checked: isChecked,
149
153
  disabled: isDisabled,
package/dist/esm/radio.js CHANGED
@@ -7,10 +7,10 @@ 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 { B100, B300, B400, B50, N10, N100, N20, N30, N40, N70, N80, N900, R300 } from '@atlaskit/theme/colors';
10
+ import { B200, B300, B400, B50, N10, N100, N20, N30, N40, N70, N80, N900, R300 } from '@atlaskit/theme/colors';
11
11
  import { fontFamily as getFontFamily } from '@atlaskit/theme/constants';
12
12
  var packageName = "@atlaskit/radio";
13
- var packageVersion = "6.0.2";
13
+ var packageVersion = "6.0.3";
14
14
  var fontFamily = getFontFamily();
15
15
  var noop = __noop;
16
16
  var labelPaddingStyles = css({
@@ -87,7 +87,8 @@ var radioStyles = css({
87
87
  '--radio-background-color': "var(--ds-background-input-pressed, ".concat(N30, ")")
88
88
  },
89
89
  '&:focus': {
90
- '--radio-border-color': "var(--ds-border-focused, ".concat(B100, ")")
90
+ outline: "var(--ds-border-width-outline, 3px)".concat(" solid ", "var(--ds-border-focused, ".concat(B200, ")")),
91
+ outlineOffset: "var(--ds-border-width-indicator, 3px)"
91
92
  },
92
93
  '&:checked': {
93
94
  '--radio-background-color': "var(--ds-background-selected-bold, ".concat(B400, ")"),
@@ -104,7 +105,8 @@ var radioStyles = css({
104
105
  '--radio-dot-color': "var(--ds-icon-inverse, ".concat(B400, ")")
105
106
  },
106
107
  '&:checked:focus': {
107
- '--radio-border-color': "var(--ds-border-focused, ".concat(B100, ")")
108
+ outline: "var(--ds-border-width-outline, 3px)".concat(" solid ", "var(--ds-border-focused, ".concat(B200, ")")),
109
+ outlineOffset: "var(--ds-border-width-indicator, 3px)"
108
110
  },
109
111
  // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
110
112
  '&[data-invalid], &:checked[data-invalid]': {
@@ -147,6 +149,8 @@ var InnerRadio = /*#__PURE__*/forwardRef(function Radio(props, ref) {
147
149
  "data-disabled": isDisabled ? 'true' : undefined,
148
150
  css: labelStyles
149
151
  }, jsx("input", _extends({}, rest, {
152
+ // It is necessary only for Safari. It allows to render focus styles.
153
+ tabIndex: 0,
150
154
  "aria-label": ariaLabel,
151
155
  checked: isChecked,
152
156
  disabled: isDisabled,
@@ -47,7 +47,7 @@ export interface RadioGroupProps {
47
47
  */
48
48
  'aria-labelledby'?: string;
49
49
  /**
50
- * 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
50
+ * 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.
51
51
  * The specified `testId` is applied to the root element of `RadioGroup`. If no `testId` is supplied in the `options` prop, then the one supplied to `RadioGroup` will also be propagated to
52
52
  * the `Radio` children. Otherwise, the `testId` supplied in the `options` prop will be used.
53
53
  *
@@ -11,7 +11,7 @@ export type OptionsPropType = Array<OptionPropType>;
11
11
  export type RadioValue = string;
12
12
  type OwnProps = {
13
13
  /**
14
- * The aria-label attribute associated with the radio element.
14
+ * The `aria-label` attribute associated with the radio element.
15
15
  */
16
16
  ariaLabel?: string;
17
17
  /**
@@ -35,7 +35,7 @@ type OwnProps = {
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
  /**
@@ -47,7 +47,7 @@ export interface RadioGroupProps {
47
47
  */
48
48
  'aria-labelledby'?: string;
49
49
  /**
50
- * 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
50
+ * 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.
51
51
  * The specified `testId` is applied to the root element of `RadioGroup`. If no `testId` is supplied in the `options` prop, then the one supplied to `RadioGroup` will also be propagated to
52
52
  * the `Radio` children. Otherwise, the `testId` supplied in the `options` prop will be used.
53
53
  *
@@ -11,7 +11,7 @@ export type OptionsPropType = Array<OptionPropType>;
11
11
  export type RadioValue = string;
12
12
  type OwnProps = {
13
13
  /**
14
- * The aria-label attribute associated with the radio element.
14
+ * The `aria-label` attribute associated with the radio element.
15
15
  */
16
16
  ariaLabel?: string;
17
17
  /**
@@ -35,7 +35,7 @@ type OwnProps = {
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
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/radio",
3
- "version": "6.0.2",
3
+ "version": "6.0.3",
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/"
@@ -44,7 +44,7 @@
44
44
  "@atlaskit/ds-lib": "^2.2.0",
45
45
  "@atlaskit/platform-feature-flags": "^0.2.0",
46
46
  "@atlaskit/theme": "^12.6.0",
47
- "@atlaskit/tokens": "^1.36.0",
47
+ "@atlaskit/tokens": "^1.39.0",
48
48
  "@babel/runtime": "^7.0.0",
49
49
  "@emotion/react": "^11.7.1"
50
50
  },
@@ -95,4 +95,4 @@
95
95
  },
96
96
  "homepage": "https://atlassian.design/components/radio/",
97
97
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
98
- }
98
+ }