@atlaskit/checkbox 13.0.1 → 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,11 @@
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
+
3
9
  ## 13.0.1
4
10
 
5
11
  ### Patch 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.1"
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.1"
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.1"
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/checkbox",
3
- "version": "13.0.1",
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": "^22.0.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
- ```