@atlaskit/checkbox 13.0.0 → 13.0.2

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,17 @@
1
1
  # @atlaskit/checkbox
2
2
 
3
+ ## 13.0.2
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
+
9
+ ## 13.0.1
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 13.0.0
4
16
 
5
17
  ### Major Changes
@@ -13,6 +13,7 @@ var _react2 = require("@emotion/react");
13
13
  var _usePlatformLeafEventHandler = require("@atlaskit/analytics-next/usePlatformLeafEventHandler");
14
14
  var _mergeRefs = _interopRequireDefault(require("@atlaskit/ds-lib/merge-refs"));
15
15
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
+ var _colors = require("@atlaskit/theme/colors");
16
17
  var _internal = require("./internal");
17
18
  var _excluded = ["isChecked", "isDisabled", "isInvalid", "defaultChecked", "isIndeterminate", "size", "onChange", "analyticsContext", "label", "name", "value", "isRequired", "testId"];
18
19
  /** @jsx jsx */
@@ -26,6 +27,9 @@ var checkboxStyles = (0, _react2.css)({
26
27
  gridArea: '1 / 1 / 2 / 2',
27
28
  opacity: 0,
28
29
  outline: 'none',
30
+ '&:focus': {
31
+ opacity: 1
32
+ },
29
33
  '& + svg': {
30
34
  /**
31
35
  * Change the variables --checkbox-background-color, --checkbox-border-color
@@ -48,7 +52,9 @@ var checkboxStyles = (0, _react2.css)({
48
52
  }
49
53
  },
50
54
  '&&:focus + svg, &&:checked:focus + svg': {
51
- '--checkbox-border-color': 'var(--local-border-focus)'
55
+ borderRadius: "var(--ds-border-radius, 0.25rem)",
56
+ outline: "var(--ds-border-width-outline, 2px)".concat(" solid ", "var(--ds-border-focused, ".concat(_colors.B200, ")")),
57
+ outlineOffset: '-2px'
52
58
  },
53
59
  '&:hover + svg': {
54
60
  '--checkbox-background-color': 'var(--local-background-hover)',
@@ -161,7 +167,7 @@ var Checkbox = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
161
167
  analyticsData: analyticsContext,
162
168
  componentName: 'checkbox',
163
169
  packageName: "@atlaskit/checkbox",
164
- packageVersion: "13.0.0"
170
+ packageVersion: "13.0.2"
165
171
  });
166
172
  var internalRef = (0, _react.useRef)(null);
167
173
  var mergedRefs = (0, _mergeRefs.default)([internalRef, ref]);
@@ -173,7 +179,10 @@ var Checkbox = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
173
179
  label: label,
174
180
  id: rest.id ? "".concat(rest.id, "-label") : undefined,
175
181
  testId: testId && "".concat(testId, "--checkbox-label")
176
- }, (0, _react2.jsx)("input", (0, _extends2.default)({}, rest, {
182
+ }, (0, _react2.jsx)("input", (0, _extends2.default)({
183
+ // It is necessary only for Safari. It allows to render focus styles.
184
+ tabIndex: 0
185
+ }, rest, {
177
186
  type: "checkbox",
178
187
  ref: mergedRefs,
179
188
  disabled: isDisabled,
@@ -5,6 +5,7 @@ import { css, jsx } from '@emotion/react';
5
5
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
6
6
  import mergeRefs from '@atlaskit/ds-lib/merge-refs';
7
7
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
8
+ import { B200 } from '@atlaskit/theme/colors';
8
9
  import { CheckboxIcon, Label, LabelText, RequiredIndicator } from './internal';
9
10
  /* eslint-disable @atlaskit/design-system/no-nested-styles */
10
11
  const checkboxStyles = css({
@@ -16,6 +17,9 @@ const checkboxStyles = css({
16
17
  gridArea: '1 / 1 / 2 / 2',
17
18
  opacity: 0,
18
19
  outline: 'none',
20
+ '&:focus': {
21
+ opacity: 1
22
+ },
19
23
  '& + svg': {
20
24
  /**
21
25
  * Change the variables --checkbox-background-color, --checkbox-border-color
@@ -38,7 +42,9 @@ const checkboxStyles = css({
38
42
  }
39
43
  },
40
44
  '&&:focus + svg, &&:checked:focus + svg': {
41
- '--checkbox-border-color': 'var(--local-border-focus)'
45
+ borderRadius: "var(--ds-border-radius, 0.25rem)",
46
+ outline: `${"var(--ds-border-width-outline, 2px)"} solid ${`var(--ds-border-focused, ${B200})`}`,
47
+ outlineOffset: '-2px'
42
48
  },
43
49
  '&:hover + svg': {
44
50
  '--checkbox-background-color': 'var(--local-background-hover)',
@@ -145,7 +151,7 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Checkbox(pr
145
151
  analyticsData: analyticsContext,
146
152
  componentName: 'checkbox',
147
153
  packageName: "@atlaskit/checkbox",
148
- packageVersion: "13.0.0"
154
+ packageVersion: "13.0.2"
149
155
  });
150
156
  const internalRef = useRef(null);
151
157
  const mergedRefs = mergeRefs([internalRef, ref]);
@@ -157,7 +163,10 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Checkbox(pr
157
163
  label: label,
158
164
  id: rest.id ? `${rest.id}-label` : undefined,
159
165
  testId: testId && `${testId}--checkbox-label`
160
- }, jsx("input", _extends({}, rest, {
166
+ }, jsx("input", _extends({
167
+ // It is necessary only for Safari. It allows to render focus styles.
168
+ tabIndex: 0
169
+ }, rest, {
161
170
  type: "checkbox",
162
171
  ref: mergedRefs,
163
172
  disabled: isDisabled,
@@ -8,6 +8,7 @@ import { css, jsx } from '@emotion/react';
8
8
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
9
9
  import mergeRefs from '@atlaskit/ds-lib/merge-refs';
10
10
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
11
+ import { B200 } from '@atlaskit/theme/colors';
11
12
  import { CheckboxIcon, Label, LabelText, RequiredIndicator } from './internal';
12
13
  /* eslint-disable @atlaskit/design-system/no-nested-styles */
13
14
  var checkboxStyles = css({
@@ -19,6 +20,9 @@ var checkboxStyles = css({
19
20
  gridArea: '1 / 1 / 2 / 2',
20
21
  opacity: 0,
21
22
  outline: 'none',
23
+ '&:focus': {
24
+ opacity: 1
25
+ },
22
26
  '& + svg': {
23
27
  /**
24
28
  * Change the variables --checkbox-background-color, --checkbox-border-color
@@ -41,7 +45,9 @@ var checkboxStyles = css({
41
45
  }
42
46
  },
43
47
  '&&:focus + svg, &&:checked:focus + svg': {
44
- '--checkbox-border-color': 'var(--local-border-focus)'
48
+ borderRadius: "var(--ds-border-radius, 0.25rem)",
49
+ outline: "var(--ds-border-width-outline, 2px)".concat(" solid ", "var(--ds-border-focused, ".concat(B200, ")")),
50
+ outlineOffset: '-2px'
45
51
  },
46
52
  '&:hover + svg': {
47
53
  '--checkbox-background-color': 'var(--local-background-hover)',
@@ -154,7 +160,7 @@ var Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Checkbox(prop
154
160
  analyticsData: analyticsContext,
155
161
  componentName: 'checkbox',
156
162
  packageName: "@atlaskit/checkbox",
157
- packageVersion: "13.0.0"
163
+ packageVersion: "13.0.2"
158
164
  });
159
165
  var internalRef = useRef(null);
160
166
  var mergedRefs = mergeRefs([internalRef, ref]);
@@ -166,7 +172,10 @@ var Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Checkbox(prop
166
172
  label: label,
167
173
  id: rest.id ? "".concat(rest.id, "-label") : undefined,
168
174
  testId: testId && "".concat(testId, "--checkbox-label")
169
- }, jsx("input", _extends({}, rest, {
175
+ }, jsx("input", _extends({
176
+ // It is necessary only for Safari. It allows to render focus styles.
177
+ tabIndex: 0
178
+ }, rest, {
170
179
  type: "checkbox",
171
180
  ref: mergedRefs,
172
181
  disabled: isDisabled,
@@ -10,11 +10,11 @@ export type Size = 'small' | 'medium' | 'large' | 'xlarge';
10
10
  */
11
11
  export type OwnProps = {
12
12
  /**
13
- * Sets whether the checkbox begins checked.
13
+ * Sets whether the checkbox begins as checked or unchecked.
14
14
  */
15
15
  defaultChecked?: boolean;
16
16
  /**
17
- * id assigned to input
17
+ * The ID assigned to the input.
18
18
  */
19
19
  id?: string;
20
20
  /**
@@ -22,7 +22,7 @@ export type OwnProps = {
22
22
  */
23
23
  isChecked?: boolean;
24
24
  /**
25
- * Sets whether the checkbox is disabled.
25
+ * Sets whether the checkbox is disabled. Don’t use a disabled checkbox if it needs to remain in the tab order for assistive technologies.
26
26
  */
27
27
  isDisabled?: boolean;
28
28
  /**
@@ -49,7 +49,7 @@ export type OwnProps = {
49
49
  name?: string;
50
50
  /**
51
51
  * Function that is called whenever the state of the checkbox changes. It will
52
- * be called with an object containing the react synthetic event. Use currentTarget to get value, name and checked
52
+ * be called with an object containing the react synthetic event. Use `currentTarget` to get value, name and checked.
53
53
  */
54
54
  onChange?: (e: React.ChangeEvent<HTMLInputElement>, analyticsEvent: UIAnalyticsEvent) => void;
55
55
  /**
@@ -57,7 +57,7 @@ export type OwnProps = {
57
57
  */
58
58
  value?: number | string;
59
59
  /**
60
- * The size of the Checkbox
60
+ * The size of the checkbox.
61
61
  */
62
62
  size?: Size;
63
63
  /**
@@ -67,7 +67,7 @@ export type OwnProps = {
67
67
  */
68
68
  testId?: string;
69
69
  /**
70
- * Additional information to be included in the `context` of analytics events that come from radio
70
+ * Additional information to be included in the `context` of analytics events that come from radio.
71
71
  */
72
72
  analyticsContext?: Record<string, any>;
73
73
  };
@@ -91,12 +91,12 @@ export interface LabelTextProps extends React.HTMLProps<HTMLSpanElement> {
91
91
  export interface LabelProps extends React.HTMLProps<HTMLInputElement> {
92
92
  isDisabled?: boolean;
93
93
  /**
94
- * 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
94
+ * 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.
95
95
  */
96
96
  testId?: string;
97
97
  /**
98
98
  * Click handler that is conditionally applied for Firefox
99
- * as Firefox does not dispatch modified click events (e.g. Ctrl+Click) down to the underlying input element
99
+ * as Firefox does not dispatch modified click events (e.g. Ctrl+Click) down to the underlying input element.
100
100
  */
101
101
  onClick?: React.MouseEventHandler;
102
102
  }
@@ -10,11 +10,11 @@ export type Size = 'small' | 'medium' | 'large' | 'xlarge';
10
10
  */
11
11
  export type OwnProps = {
12
12
  /**
13
- * Sets whether the checkbox begins checked.
13
+ * Sets whether the checkbox begins as checked or unchecked.
14
14
  */
15
15
  defaultChecked?: boolean;
16
16
  /**
17
- * id assigned to input
17
+ * The ID assigned to the input.
18
18
  */
19
19
  id?: string;
20
20
  /**
@@ -22,7 +22,7 @@ export type OwnProps = {
22
22
  */
23
23
  isChecked?: boolean;
24
24
  /**
25
- * Sets whether the checkbox is disabled.
25
+ * Sets whether the checkbox is disabled. Don’t use a disabled checkbox if it needs to remain in the tab order for assistive technologies.
26
26
  */
27
27
  isDisabled?: boolean;
28
28
  /**
@@ -49,7 +49,7 @@ export type OwnProps = {
49
49
  name?: string;
50
50
  /**
51
51
  * Function that is called whenever the state of the checkbox changes. It will
52
- * be called with an object containing the react synthetic event. Use currentTarget to get value, name and checked
52
+ * be called with an object containing the react synthetic event. Use `currentTarget` to get value, name and checked.
53
53
  */
54
54
  onChange?: (e: React.ChangeEvent<HTMLInputElement>, analyticsEvent: UIAnalyticsEvent) => void;
55
55
  /**
@@ -57,7 +57,7 @@ export type OwnProps = {
57
57
  */
58
58
  value?: number | string;
59
59
  /**
60
- * The size of the Checkbox
60
+ * The size of the checkbox.
61
61
  */
62
62
  size?: Size;
63
63
  /**
@@ -67,7 +67,7 @@ export type OwnProps = {
67
67
  */
68
68
  testId?: string;
69
69
  /**
70
- * Additional information to be included in the `context` of analytics events that come from radio
70
+ * Additional information to be included in the `context` of analytics events that come from radio.
71
71
  */
72
72
  analyticsContext?: Record<string, any>;
73
73
  };
@@ -91,12 +91,12 @@ export interface LabelTextProps extends React.HTMLProps<HTMLSpanElement> {
91
91
  export interface LabelProps extends React.HTMLProps<HTMLInputElement> {
92
92
  isDisabled?: boolean;
93
93
  /**
94
- * 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
94
+ * 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.
95
95
  */
96
96
  testId?: string;
97
97
  /**
98
98
  * Click handler that is conditionally applied for Firefox
99
- * as Firefox does not dispatch modified click events (e.g. Ctrl+Click) down to the underlying input element
99
+ * as Firefox does not dispatch modified click events (e.g. Ctrl+Click) down to the underlying input element.
100
100
  */
101
101
  onClick?: React.MouseEventHandler;
102
102
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/checkbox",
3
- "version": "13.0.0",
3
+ "version": "13.0.2",
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/"
@@ -37,12 +37,12 @@
37
37
  ".": "./src/index.tsx"
38
38
  },
39
39
  "dependencies": {
40
- "@atlaskit/analytics-next": "^9.1.0",
40
+ "@atlaskit/analytics-next": "^9.2.0",
41
41
  "@atlaskit/ds-lib": "^2.2.0",
42
- "@atlaskit/icon": "^21.12.0",
42
+ "@atlaskit/icon": "^22.1.0",
43
43
  "@atlaskit/platform-feature-flags": "^0.2.0",
44
44
  "@atlaskit/theme": "^12.6.0",
45
- "@atlaskit/tokens": "^1.28.0",
45
+ "@atlaskit/tokens": "^1.39.0",
46
46
  "@babel/runtime": "^7.0.0",
47
47
  "@emotion/react": "^11.7.1"
48
48
  },
@@ -51,10 +51,10 @@
51
51
  },
52
52
  "devDependencies": {
53
53
  "@af/accessibility-testing": "*",
54
+ "@af/integration-testing": "*",
54
55
  "@af/visual-regression": "*",
55
56
  "@atlaskit/ssr": "*",
56
57
  "@atlaskit/visual-regression": "*",
57
- "@atlaskit/webdriver-runner": "*",
58
58
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
59
59
  "@atlassian/feature-flags-test-utils": "*",
60
60
  "@testing-library/react": "^12.1.5",
@@ -96,4 +96,4 @@
96
96
  },
97
97
  "homepage": "https://atlassian.design/components/checkbox/",
98
98
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
99
- }
99
+ }
@@ -1,62 +0,0 @@
1
- ## API Report File for "@atlaskit/checkbox"
2
-
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
-
5
- ```ts
6
-
7
- /// <reference types="react" />
8
-
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 { RefAttributes } from 'react';
14
- import type UIAnalyticsEvent from '@atlaskit/analytics-next/UIAnalyticsEvent';
15
-
16
- // @public
17
- const Checkbox: MemoExoticComponent<ForwardRefExoticComponent<Omit<Omit<InputHTMLAttributes<HTMLInputElement>, "checked" | "css" | "disabled" | "required">, keyof OwnProps> & OwnProps & RefAttributes<HTMLInputElement>>>;
18
- export { Checkbox }
19
- export default Checkbox;
20
-
21
- // @public (undocumented)
22
- export type CheckboxProps = Combine<Omit<React_2.InputHTMLAttributes<HTMLInputElement>,
23
- /**
24
- * 'disabled', 'required', and 'checked' are omitted so that
25
- * consumers must handle state using our props.
26
- *
27
- * 'css' is added globally to element attributes by emotion.
28
- * This was causing a bug, making the css prop required in
29
- * some cases. We explicitly omit it to avoid that.
30
- *
31
- * Because 'className' (which the css prop uses internally)
32
- * is still available, this should not break existing usage.
33
- */
34
- 'checked' | 'css' | 'disabled' | 'required'>, OwnProps>;
35
-
36
- // @public (undocumented)
37
- type Combine<First, Second> = Omit<First, keyof Second> & Second;
38
-
39
- // @public
40
- type OwnProps = {
41
- defaultChecked?: boolean;
42
- id?: string;
43
- isChecked?: boolean;
44
- isDisabled?: boolean;
45
- isIndeterminate?: boolean;
46
- isInvalid?: boolean;
47
- isRequired?: boolean;
48
- label?: React_2.ReactChild;
49
- name?: string;
50
- onChange?: (e: React_2.ChangeEvent<HTMLInputElement>, analyticsEvent: UIAnalyticsEvent) => void;
51
- value?: number | string;
52
- size?: Size;
53
- testId?: string;
54
- analyticsContext?: Record<string, any>;
55
- };
56
-
57
- // @public (undocumented)
58
- type Size = 'large' | 'medium' | 'small' | 'xlarge';
59
-
60
- // (No @packageDocumentation comment for this package)
61
-
62
- ```