@atlaskit/checkbox 13.5.2 → 13.6.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,14 @@
1
1
  # @atlaskit/checkbox
2
2
 
3
+ ## 13.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#126756](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/126756)
8
+ [`be7f8b7ab5827`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/be7f8b7ab5827) -
9
+ Accessibility changes. Removed `aria-checked` attribute, and set `indeterminate` to `true` if
10
+ nested checkbox is checked.
11
+
3
12
  ## 13.5.2
4
13
 
5
14
  ### Patch Changes
@@ -15,7 +15,10 @@ var _mergeRefs = _interopRequireDefault(require("@atlaskit/ds-lib/merge-refs"));
15
15
  var _colors = require("@atlaskit/theme/colors");
16
16
  var _internal = require("./internal");
17
17
  var _excluded = ["isChecked", "isDisabled", "isInvalid", "defaultChecked", "isIndeterminate", "size", "onChange", "analyticsContext", "label", "name", "value", "isRequired", "testId", "xcss"];
18
- /** @jsx jsx */
18
+ /**
19
+ * @jsxRuntime classic
20
+ * @jsx jsx
21
+ */
19
22
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
20
23
  /* eslint-disable @atlaskit/design-system/no-nested-styles */
21
24
  var checkboxStyles = (0, _react2.css)({
@@ -102,6 +105,18 @@ var checkboxStyles = (0, _react2.css)({
102
105
  '&:disabled:checked + svg': {
103
106
  '--checkbox-tick-color': 'var(--local-tick-disabled)'
104
107
  },
108
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-19551
109
+ '&:indeterminate + svg': {
110
+ '--checkbox-background-color': 'var(--local-background-checked)',
111
+ '--checkbox-border-color': 'var(--local-border-checked)',
112
+ '--checkbox-tick-color': 'var(--local-tick-checked)'
113
+ },
114
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-19551
115
+ '&:disabled:indeterminate + svg': {
116
+ '--checkbox-background-color': 'var(--local-background-disabled)',
117
+ '--checkbox-border-color': 'var(--local-border-disabled)',
118
+ '--checkbox-tick-color': 'var(--local-tick-disabled)'
119
+ },
105
120
  '@media screen and (forced-colors: active)': {
106
121
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
107
122
  '& + svg': {
@@ -183,13 +198,18 @@ var Checkbox = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
183
198
  analyticsData: analyticsContext,
184
199
  componentName: 'checkbox',
185
200
  packageName: "@atlaskit/checkbox",
186
- packageVersion: "13.5.2"
201
+ packageVersion: "13.6.0"
187
202
  });
188
203
  var internalRef = (0, _react.useRef)(null);
189
204
  var mergedRefs = (0, _mergeRefs.default)([internalRef, ref]);
190
205
 
191
206
  // Use isChecked from the state if it is controlled
192
207
  var isChecked = isCheckedProp === undefined ? isCheckedState : isCheckedProp;
208
+ (0, _react.useEffect)(function () {
209
+ if (internalRef.current) {
210
+ internalRef.current.indeterminate = isIndeterminate;
211
+ }
212
+ }, [isIndeterminate]);
193
213
  return (0, _react2.jsx)(_internal.Label, {
194
214
  isDisabled: isDisabled,
195
215
  label: label,
@@ -213,7 +233,6 @@ var Checkbox = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
213
233
  required: isRequired,
214
234
  css: checkboxStyles,
215
235
  onChange: onChangeAnalytics,
216
- "aria-checked": isIndeterminate ? 'mixed' : isChecked,
217
236
  "aria-invalid": isInvalid ? 'true' : undefined,
218
237
  "data-testid": testId && "".concat(testId, "--hidden-checkbox"),
219
238
  "data-invalid": isInvalid ? 'true' : undefined
@@ -8,7 +8,10 @@ exports.default = void 0;
8
8
  var _react = require("react");
9
9
  var _react2 = require("@emotion/react");
10
10
  var _svg = _interopRequireDefault(require("@atlaskit/icon/svg"));
11
- /** @jsx jsx */
11
+ /**
12
+ * @jsxRuntime classic
13
+ * @jsx jsx
14
+ */
12
15
 
13
16
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
14
17
 
@@ -7,8 +7,8 @@ exports.default = LabelText;
7
7
  var _react = require("@emotion/react");
8
8
  /**
9
9
  * @jsxRuntime classic
10
+ * @jsx jsx
10
11
  */
11
- /** @jsx jsx */
12
12
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
13
13
 
14
14
  var labelTextStyles = (0, _react.css)({
@@ -8,8 +8,8 @@ var _react = require("@emotion/react");
8
8
  var _colors = require("@atlaskit/theme/colors");
9
9
  /**
10
10
  * @jsxRuntime classic
11
+ * @jsx jsx
11
12
  */
12
- /** @jsx jsx */
13
13
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
14
14
 
15
15
  var baseStyles = (0, _react.css)({
@@ -8,8 +8,8 @@ var _react = require("@emotion/react");
8
8
  var _colors = require("@atlaskit/theme/colors");
9
9
  /**
10
10
  * @jsxRuntime classic
11
+ * @jsx jsx
11
12
  */
12
- /** @jsx jsx */
13
13
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
14
14
 
15
15
  var requiredIndicatorStyles = (0, _react.css)({
@@ -1,6 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- /** @jsx jsx */
3
- import { forwardRef, memo, useCallback, useRef, useState } from 'react';
2
+ /**
3
+ * @jsxRuntime classic
4
+ * @jsx jsx
5
+ */
6
+ import { forwardRef, memo, useCallback, useEffect, useRef, useState } from 'react';
4
7
 
5
8
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
6
9
  import { css, jsx } from '@emotion/react';
@@ -93,6 +96,18 @@ const checkboxStyles = css({
93
96
  '&:disabled:checked + svg': {
94
97
  '--checkbox-tick-color': 'var(--local-tick-disabled)'
95
98
  },
99
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-19551
100
+ '&:indeterminate + svg': {
101
+ '--checkbox-background-color': 'var(--local-background-checked)',
102
+ '--checkbox-border-color': 'var(--local-border-checked)',
103
+ '--checkbox-tick-color': 'var(--local-tick-checked)'
104
+ },
105
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-19551
106
+ '&:disabled:indeterminate + svg': {
107
+ '--checkbox-background-color': 'var(--local-background-disabled)',
108
+ '--checkbox-border-color': 'var(--local-border-disabled)',
109
+ '--checkbox-tick-color': 'var(--local-tick-disabled)'
110
+ },
96
111
  '@media screen and (forced-colors: active)': {
97
112
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
98
113
  '& + svg': {
@@ -168,13 +183,18 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Checkbox(pr
168
183
  analyticsData: analyticsContext,
169
184
  componentName: 'checkbox',
170
185
  packageName: "@atlaskit/checkbox",
171
- packageVersion: "13.5.2"
186
+ packageVersion: "13.6.0"
172
187
  });
173
188
  const internalRef = useRef(null);
174
189
  const mergedRefs = mergeRefs([internalRef, ref]);
175
190
 
176
191
  // Use isChecked from the state if it is controlled
177
192
  const isChecked = isCheckedProp === undefined ? isCheckedState : isCheckedProp;
193
+ useEffect(() => {
194
+ if (internalRef.current) {
195
+ internalRef.current.indeterminate = isIndeterminate;
196
+ }
197
+ }, [isIndeterminate]);
178
198
  return jsx(Label, {
179
199
  isDisabled: isDisabled,
180
200
  label: label,
@@ -198,7 +218,6 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Checkbox(pr
198
218
  required: isRequired,
199
219
  css: checkboxStyles,
200
220
  onChange: onChangeAnalytics,
201
- "aria-checked": isIndeterminate ? 'mixed' : isChecked,
202
221
  "aria-invalid": isInvalid ? 'true' : undefined,
203
222
  "data-testid": testId && `${testId}--hidden-checkbox`,
204
223
  "data-invalid": isInvalid ? 'true' : undefined
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import { memo, useMemo } from 'react';
3
6
 
4
7
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @jsxRuntime classic
3
+ * @jsx jsx
3
4
  */
4
- /** @jsx jsx */
5
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
6
6
  import { css, jsx } from '@emotion/react';
7
7
  const labelTextStyles = css({
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @jsxRuntime classic
3
+ * @jsx jsx
3
4
  */
4
- /** @jsx jsx */
5
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
6
6
  import { css, jsx } from '@emotion/react';
7
7
  import { B200, B300, B400, B50, N10, N100, N20, N30, N70, N80, N900, R300 } from '@atlaskit/theme/colors';
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @jsxRuntime classic
3
+ * @jsx jsx
3
4
  */
4
- /** @jsx jsx */
5
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
6
6
  import { css, jsx } from '@emotion/react';
7
7
  import { R500 } from '@atlaskit/theme/colors';
@@ -2,8 +2,11 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
4
  var _excluded = ["isChecked", "isDisabled", "isInvalid", "defaultChecked", "isIndeterminate", "size", "onChange", "analyticsContext", "label", "name", "value", "isRequired", "testId", "xcss"];
5
- /** @jsx jsx */
6
- import { forwardRef, memo, useCallback, useRef, useState } from 'react';
5
+ /**
6
+ * @jsxRuntime classic
7
+ * @jsx jsx
8
+ */
9
+ import { forwardRef, memo, useCallback, useEffect, useRef, useState } from 'react';
7
10
 
8
11
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
9
12
  import { css, jsx } from '@emotion/react';
@@ -96,6 +99,18 @@ var checkboxStyles = css({
96
99
  '&:disabled:checked + svg': {
97
100
  '--checkbox-tick-color': 'var(--local-tick-disabled)'
98
101
  },
102
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-19551
103
+ '&:indeterminate + svg': {
104
+ '--checkbox-background-color': 'var(--local-background-checked)',
105
+ '--checkbox-border-color': 'var(--local-border-checked)',
106
+ '--checkbox-tick-color': 'var(--local-tick-checked)'
107
+ },
108
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-19551
109
+ '&:disabled:indeterminate + svg': {
110
+ '--checkbox-background-color': 'var(--local-background-disabled)',
111
+ '--checkbox-border-color': 'var(--local-border-disabled)',
112
+ '--checkbox-tick-color': 'var(--local-tick-disabled)'
113
+ },
99
114
  '@media screen and (forced-colors: active)': {
100
115
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
101
116
  '& + svg': {
@@ -177,13 +192,18 @@ var Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Checkbox(prop
177
192
  analyticsData: analyticsContext,
178
193
  componentName: 'checkbox',
179
194
  packageName: "@atlaskit/checkbox",
180
- packageVersion: "13.5.2"
195
+ packageVersion: "13.6.0"
181
196
  });
182
197
  var internalRef = useRef(null);
183
198
  var mergedRefs = mergeRefs([internalRef, ref]);
184
199
 
185
200
  // Use isChecked from the state if it is controlled
186
201
  var isChecked = isCheckedProp === undefined ? isCheckedState : isCheckedProp;
202
+ useEffect(function () {
203
+ if (internalRef.current) {
204
+ internalRef.current.indeterminate = isIndeterminate;
205
+ }
206
+ }, [isIndeterminate]);
187
207
  return jsx(Label, {
188
208
  isDisabled: isDisabled,
189
209
  label: label,
@@ -207,7 +227,6 @@ var Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Checkbox(prop
207
227
  required: isRequired,
208
228
  css: checkboxStyles,
209
229
  onChange: onChangeAnalytics,
210
- "aria-checked": isIndeterminate ? 'mixed' : isChecked,
211
230
  "aria-invalid": isInvalid ? 'true' : undefined,
212
231
  "data-testid": testId && "".concat(testId, "--hidden-checkbox"),
213
232
  "data-invalid": isInvalid ? 'true' : undefined
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import { memo, useMemo } from 'react';
3
6
 
4
7
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @jsxRuntime classic
3
+ * @jsx jsx
3
4
  */
4
- /** @jsx jsx */
5
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
6
6
  import { css, jsx } from '@emotion/react';
7
7
  var labelTextStyles = css({
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @jsxRuntime classic
3
+ * @jsx jsx
3
4
  */
4
- /** @jsx jsx */
5
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
6
6
  import { css, jsx } from '@emotion/react';
7
7
  import { B200, B300, B400, B50, N10, N100, N20, N30, N70, N80, N900, R300 } from '@atlaskit/theme/colors';
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @jsxRuntime classic
3
+ * @jsx jsx
3
4
  */
4
- /** @jsx jsx */
5
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
6
6
  import { css, jsx } from '@emotion/react';
7
7
  import { R500 } from '@atlaskit/theme/colors';
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @jsxRuntime classic
3
+ * @jsx jsx
3
4
  */
4
- /** @jsx jsx */
5
5
  import { jsx } from '@emotion/react';
6
6
  import { type LabelTextProps } from '../types';
7
7
  export default function LabelText({ children }: LabelTextProps): jsx.JSX.Element;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @jsxRuntime classic
3
+ * @jsx jsx
3
4
  */
4
- /** @jsx jsx */
5
5
  import { jsx } from '@emotion/react';
6
6
  import { type LabelProps } from '../types';
7
7
  export default function Label({ children, isDisabled, testId, label, id, xcss }: LabelProps): jsx.JSX.Element;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @jsxRuntime classic
3
+ * @jsx jsx
3
4
  */
4
- /** @jsx jsx */
5
5
  import { jsx } from '@emotion/react';
6
6
  export default function RequiredIndicator(): jsx.JSX.Element;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @jsxRuntime classic
3
+ * @jsx jsx
3
4
  */
4
- /** @jsx jsx */
5
5
  import { jsx } from '@emotion/react';
6
6
  import { type LabelTextProps } from '../types';
7
7
  export default function LabelText({ children }: LabelTextProps): jsx.JSX.Element;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @jsxRuntime classic
3
+ * @jsx jsx
3
4
  */
4
- /** @jsx jsx */
5
5
  import { jsx } from '@emotion/react';
6
6
  import { type LabelProps } from '../types';
7
7
  export default function Label({ children, isDisabled, testId, label, id, xcss }: LabelProps): jsx.JSX.Element;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @jsxRuntime classic
3
+ * @jsx jsx
3
4
  */
4
- /** @jsx jsx */
5
5
  import { jsx } from '@emotion/react';
6
6
  export default function RequiredIndicator(): jsx.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/checkbox",
3
- "version": "13.5.2",
3
+ "version": "13.6.0",
4
4
  "description": "A checkbox is an input control that allows a user to select one or more options from a number of choices.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -41,9 +41,9 @@
41
41
  "@atlaskit/analytics-next": "^9.3.0",
42
42
  "@atlaskit/css": "^0.3.0",
43
43
  "@atlaskit/ds-lib": "^2.3.0",
44
- "@atlaskit/icon": "^22.6.0",
44
+ "@atlaskit/icon": "^22.10.0",
45
45
  "@atlaskit/theme": "^12.11.0",
46
- "@atlaskit/tokens": "^1.53.0",
46
+ "@atlaskit/tokens": "^1.57.0",
47
47
  "@babel/runtime": "^7.0.0",
48
48
  "@emotion/react": "^11.7.1"
49
49
  },
@@ -54,7 +54,7 @@
54
54
  "@af/accessibility-testing": "*",
55
55
  "@af/integration-testing": "*",
56
56
  "@af/visual-regression": "*",
57
- "@atlaskit/primitives": "^10.1.0",
57
+ "@atlaskit/primitives": "^11.1.0",
58
58
  "@atlaskit/ssr": "*",
59
59
  "@atlaskit/visual-regression": "*",
60
60
  "@atlassian/feature-flags-test-utils": "*",