@atlaskit/checkbox 13.0.1 → 13.1.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,21 @@
1
1
  # @atlaskit/checkbox
2
2
 
3
+ ## 13.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#80805](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/80805) [`427c2dd9e0d6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/427c2dd9e0d6) - [ux] update border with from 2px to 1px with darker color to meet 3:1 color contrast for accessibility improvement
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+
13
+ ## 13.0.2
14
+
15
+ ### Patch Changes
16
+
17
+ - [#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
18
+
3
19
  ## 13.0.1
4
20
 
5
21
  ### Patch Changes
@@ -12,7 +12,7 @@ var _react = require("react");
12
12
  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
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
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"];
18
18
  /** @jsx jsx */
@@ -26,6 +26,9 @@ var checkboxStyles = (0, _react2.css)({
26
26
  gridArea: '1 / 1 / 2 / 2',
27
27
  opacity: 0,
28
28
  outline: 'none',
29
+ '&:focus': {
30
+ opacity: 1
31
+ },
29
32
  '& + svg': {
30
33
  /**
31
34
  * Change the variables --checkbox-background-color, --checkbox-border-color
@@ -43,12 +46,14 @@ var checkboxStyles = (0, _react2.css)({
43
46
  transition: 'color 0.2s ease-in-out, fill 0.2s ease-in-out',
44
47
  'rect:first-of-type': {
45
48
  stroke: 'var(--checkbox-border-color)',
46
- strokeWidth: (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.update-border-radio-checkbox_7askv') ? "var(--ds-border-width, 1px)" : 2,
49
+ strokeWidth: "var(--ds-border-width, 1px)",
47
50
  transition: 'stroke 0.2s ease-in-out'
48
51
  }
49
52
  },
50
53
  '&&:focus + svg, &&:checked:focus + svg': {
51
- '--checkbox-border-color': 'var(--local-border-focus)'
54
+ borderRadius: "var(--ds-border-radius, 0.25rem)",
55
+ outline: "var(--ds-border-width-outline, 2px)".concat(" solid ", "var(--ds-border-focused, ".concat(_colors.B200, ")")),
56
+ outlineOffset: '-2px'
52
57
  },
53
58
  '&:hover + svg': {
54
59
  '--checkbox-background-color': 'var(--local-background-hover)',
@@ -161,7 +166,7 @@ var Checkbox = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
161
166
  analyticsData: analyticsContext,
162
167
  componentName: 'checkbox',
163
168
  packageName: "@atlaskit/checkbox",
164
- packageVersion: "13.0.1"
169
+ packageVersion: "13.1.0"
165
170
  });
166
171
  var internalRef = (0, _react.useRef)(null);
167
172
  var mergedRefs = (0, _mergeRefs.default)([internalRef, ref]);
@@ -173,7 +178,10 @@ var Checkbox = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
173
178
  label: label,
174
179
  id: rest.id ? "".concat(rest.id, "-label") : undefined,
175
180
  testId: testId && "".concat(testId, "--checkbox-label")
176
- }, (0, _react2.jsx)("input", (0, _extends2.default)({}, rest, {
181
+ }, (0, _react2.jsx)("input", (0, _extends2.default)({
182
+ // It is necessary only for Safari. It allows to render focus styles.
183
+ tabIndex: 0
184
+ }, rest, {
177
185
  type: "checkbox",
178
186
  ref: mergedRefs,
179
187
  disabled: isDisabled,
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = Label;
7
7
  var _react = require("@emotion/react");
8
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
9
8
  var _colors = require("@atlaskit/theme/colors");
10
9
  var _constants = require("./constants");
11
10
  /** @jsx jsx */
@@ -39,14 +38,14 @@ var labelStyles = (0, _react.css)({
39
38
  /**
40
39
  * Border
41
40
  */
42
- '--local-border': (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.update-border-radio-checkbox_7askv') ? "var(--ds-border-bold, ".concat(_colors.N100, ")") : "var(--ds-border-input, ".concat(_colors.N40, ")"),
41
+ '--local-border': "var(--ds-border-input, ".concat(_colors.N100, ")"),
43
42
  '--local-border-active': "var(--ds-border, ".concat(_colors.B50, ")"),
44
43
  '--local-border-checked': "var(--ds-background-selected-bold, ".concat(_colors.B400, ")"),
45
44
  '--local-border-checked-hover': "var(--ds-background-selected-bold-hovered, ".concat(_colors.B300, ")"),
46
45
  '--local-border-checked-invalid': "var(--ds-border-danger, ".concat(_colors.R300, ")"),
47
46
  '--local-border-disabled': "var(--ds-background-disabled, ".concat(_colors.N20, ")"),
48
47
  '--local-border-focus': "var(--ds-border-focused, ".concat(_colors.B200, ")"),
49
- '--local-border-hover': (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.update-border-radio-checkbox_7askv') ? "var(--ds-border-bold, ".concat(_colors.N100, ")") : "var(--ds-border-input, ".concat(_colors.N40, ")"),
48
+ '--local-border-hover': "var(--ds-border-input, ".concat(_colors.N100, ")"),
50
49
  '--local-border-invalid': "var(--ds-border-danger, ".concat(_colors.R300, ")"),
51
50
  /**
52
51
  * Tick
@@ -4,7 +4,7 @@ import { forwardRef, memo, useCallback, useRef, useState } from 'react';
4
4
  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
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
7
+ import { B200 } from '@atlaskit/theme/colors';
8
8
  import { CheckboxIcon, Label, LabelText, RequiredIndicator } from './internal';
9
9
  /* eslint-disable @atlaskit/design-system/no-nested-styles */
10
10
  const checkboxStyles = css({
@@ -16,6 +16,9 @@ const checkboxStyles = css({
16
16
  gridArea: '1 / 1 / 2 / 2',
17
17
  opacity: 0,
18
18
  outline: 'none',
19
+ '&:focus': {
20
+ opacity: 1
21
+ },
19
22
  '& + svg': {
20
23
  /**
21
24
  * Change the variables --checkbox-background-color, --checkbox-border-color
@@ -33,12 +36,14 @@ const checkboxStyles = css({
33
36
  transition: 'color 0.2s ease-in-out, fill 0.2s ease-in-out',
34
37
  'rect:first-of-type': {
35
38
  stroke: 'var(--checkbox-border-color)',
36
- strokeWidth: getBooleanFF('platform.design-system-team.update-border-radio-checkbox_7askv') ? "var(--ds-border-width, 1px)" : 2,
39
+ strokeWidth: "var(--ds-border-width, 1px)",
37
40
  transition: 'stroke 0.2s ease-in-out'
38
41
  }
39
42
  },
40
43
  '&&:focus + svg, &&:checked:focus + svg': {
41
- '--checkbox-border-color': 'var(--local-border-focus)'
44
+ borderRadius: "var(--ds-border-radius, 0.25rem)",
45
+ outline: `${"var(--ds-border-width-outline, 2px)"} solid ${`var(--ds-border-focused, ${B200})`}`,
46
+ outlineOffset: '-2px'
42
47
  },
43
48
  '&:hover + svg': {
44
49
  '--checkbox-background-color': 'var(--local-background-hover)',
@@ -145,7 +150,7 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Checkbox(pr
145
150
  analyticsData: analyticsContext,
146
151
  componentName: 'checkbox',
147
152
  packageName: "@atlaskit/checkbox",
148
- packageVersion: "13.0.1"
153
+ packageVersion: "13.1.0"
149
154
  });
150
155
  const internalRef = useRef(null);
151
156
  const mergedRefs = mergeRefs([internalRef, ref]);
@@ -157,7 +162,10 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Checkbox(pr
157
162
  label: label,
158
163
  id: rest.id ? `${rest.id}-label` : undefined,
159
164
  testId: testId && `${testId}--checkbox-label`
160
- }, jsx("input", _extends({}, rest, {
165
+ }, jsx("input", _extends({
166
+ // It is necessary only for Safari. It allows to render focus styles.
167
+ tabIndex: 0
168
+ }, rest, {
161
169
  type: "checkbox",
162
170
  ref: mergedRefs,
163
171
  disabled: isDisabled,
@@ -1,7 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import { css, jsx } from '@emotion/react';
3
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
4
- import { B200, B300, B400, B50, N10, N100, N20, N30, N40, N70, N80, N900, R300 } from '@atlaskit/theme/colors';
3
+ import { B200, B300, B400, B50, N10, N100, N20, N30, N70, N80, N900, R300 } from '@atlaskit/theme/colors';
5
4
  import { fontFamily } from './constants';
6
5
  const baseStyles = css({
7
6
  display: 'grid',
@@ -32,14 +31,14 @@ const labelStyles = css({
32
31
  /**
33
32
  * Border
34
33
  */
35
- '--local-border': getBooleanFF('platform.design-system-team.update-border-radio-checkbox_7askv') ? `var(--ds-border-bold, ${N100})` : `var(--ds-border-input, ${N40})`,
34
+ '--local-border': `var(--ds-border-input, ${N100})`,
36
35
  '--local-border-active': `var(--ds-border, ${B50})`,
37
36
  '--local-border-checked': `var(--ds-background-selected-bold, ${B400})`,
38
37
  '--local-border-checked-hover': `var(--ds-background-selected-bold-hovered, ${B300})`,
39
38
  '--local-border-checked-invalid': `var(--ds-border-danger, ${R300})`,
40
39
  '--local-border-disabled': `var(--ds-background-disabled, ${N20})`,
41
40
  '--local-border-focus': `var(--ds-border-focused, ${B200})`,
42
- '--local-border-hover': getBooleanFF('platform.design-system-team.update-border-radio-checkbox_7askv') ? `var(--ds-border-bold, ${N100})` : `var(--ds-border-input, ${N40})`,
41
+ '--local-border-hover': `var(--ds-border-input, ${N100})`,
43
42
  '--local-border-invalid': `var(--ds-border-danger, ${R300})`,
44
43
  /**
45
44
  * Tick
@@ -7,7 +7,7 @@ import { forwardRef, memo, useCallback, useRef, useState } from 'react';
7
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
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
10
+ import { B200 } from '@atlaskit/theme/colors';
11
11
  import { CheckboxIcon, Label, LabelText, RequiredIndicator } from './internal';
12
12
  /* eslint-disable @atlaskit/design-system/no-nested-styles */
13
13
  var checkboxStyles = css({
@@ -19,6 +19,9 @@ var checkboxStyles = css({
19
19
  gridArea: '1 / 1 / 2 / 2',
20
20
  opacity: 0,
21
21
  outline: 'none',
22
+ '&:focus': {
23
+ opacity: 1
24
+ },
22
25
  '& + svg': {
23
26
  /**
24
27
  * Change the variables --checkbox-background-color, --checkbox-border-color
@@ -36,12 +39,14 @@ var checkboxStyles = css({
36
39
  transition: 'color 0.2s ease-in-out, fill 0.2s ease-in-out',
37
40
  'rect:first-of-type': {
38
41
  stroke: 'var(--checkbox-border-color)',
39
- strokeWidth: getBooleanFF('platform.design-system-team.update-border-radio-checkbox_7askv') ? "var(--ds-border-width, 1px)" : 2,
42
+ strokeWidth: "var(--ds-border-width, 1px)",
40
43
  transition: 'stroke 0.2s ease-in-out'
41
44
  }
42
45
  },
43
46
  '&&:focus + svg, &&:checked:focus + svg': {
44
- '--checkbox-border-color': 'var(--local-border-focus)'
47
+ borderRadius: "var(--ds-border-radius, 0.25rem)",
48
+ outline: "var(--ds-border-width-outline, 2px)".concat(" solid ", "var(--ds-border-focused, ".concat(B200, ")")),
49
+ outlineOffset: '-2px'
45
50
  },
46
51
  '&:hover + svg': {
47
52
  '--checkbox-background-color': 'var(--local-background-hover)',
@@ -154,7 +159,7 @@ var Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Checkbox(prop
154
159
  analyticsData: analyticsContext,
155
160
  componentName: 'checkbox',
156
161
  packageName: "@atlaskit/checkbox",
157
- packageVersion: "13.0.1"
162
+ packageVersion: "13.1.0"
158
163
  });
159
164
  var internalRef = useRef(null);
160
165
  var mergedRefs = mergeRefs([internalRef, ref]);
@@ -166,7 +171,10 @@ var Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Checkbox(prop
166
171
  label: label,
167
172
  id: rest.id ? "".concat(rest.id, "-label") : undefined,
168
173
  testId: testId && "".concat(testId, "--checkbox-label")
169
- }, jsx("input", _extends({}, rest, {
174
+ }, jsx("input", _extends({
175
+ // It is necessary only for Safari. It allows to render focus styles.
176
+ tabIndex: 0
177
+ }, rest, {
170
178
  type: "checkbox",
171
179
  ref: mergedRefs,
172
180
  disabled: isDisabled,
@@ -1,7 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import { css, jsx } from '@emotion/react';
3
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
4
- import { B200, B300, B400, B50, N10, N100, N20, N30, N40, N70, N80, N900, R300 } from '@atlaskit/theme/colors';
3
+ import { B200, B300, B400, B50, N10, N100, N20, N30, N70, N80, N900, R300 } from '@atlaskit/theme/colors';
5
4
  import { fontFamily } from './constants';
6
5
  var baseStyles = css({
7
6
  display: 'grid',
@@ -32,14 +31,14 @@ var labelStyles = css({
32
31
  /**
33
32
  * Border
34
33
  */
35
- '--local-border': getBooleanFF('platform.design-system-team.update-border-radio-checkbox_7askv') ? "var(--ds-border-bold, ".concat(N100, ")") : "var(--ds-border-input, ".concat(N40, ")"),
34
+ '--local-border': "var(--ds-border-input, ".concat(N100, ")"),
36
35
  '--local-border-active': "var(--ds-border, ".concat(B50, ")"),
37
36
  '--local-border-checked': "var(--ds-background-selected-bold, ".concat(B400, ")"),
38
37
  '--local-border-checked-hover': "var(--ds-background-selected-bold-hovered, ".concat(B300, ")"),
39
38
  '--local-border-checked-invalid': "var(--ds-border-danger, ".concat(R300, ")"),
40
39
  '--local-border-disabled': "var(--ds-background-disabled, ".concat(N20, ")"),
41
40
  '--local-border-focus': "var(--ds-border-focused, ".concat(B200, ")"),
42
- '--local-border-hover': getBooleanFF('platform.design-system-team.update-border-radio-checkbox_7askv') ? "var(--ds-border-bold, ".concat(N100, ")") : "var(--ds-border-input, ".concat(N40, ")"),
41
+ '--local-border-hover': "var(--ds-border-input, ".concat(N100, ")"),
43
42
  '--local-border-invalid': "var(--ds-border-danger, ".concat(R300, ")"),
44
43
  /**
45
44
  * Tick
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/checkbox",
3
- "version": "13.0.1",
3
+ "version": "13.1.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/"
@@ -37,12 +37,11 @@
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",
43
- "@atlaskit/platform-feature-flags": "^0.2.0",
42
+ "@atlaskit/icon": "^22.1.0",
44
43
  "@atlaskit/theme": "^12.6.0",
45
- "@atlaskit/tokens": "^1.28.0",
44
+ "@atlaskit/tokens": "^1.41.0",
46
45
  "@babel/runtime": "^7.0.0",
47
46
  "@emotion/react": "^11.7.1"
48
47
  },
@@ -51,10 +50,10 @@
51
50
  },
52
51
  "devDependencies": {
53
52
  "@af/accessibility-testing": "*",
53
+ "@af/integration-testing": "*",
54
54
  "@af/visual-regression": "*",
55
55
  "@atlaskit/ssr": "*",
56
56
  "@atlaskit/visual-regression": "*",
57
- "@atlaskit/webdriver-runner": "*",
58
57
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
59
58
  "@atlassian/feature-flags-test-utils": "*",
60
59
  "@testing-library/react": "^12.1.5",
@@ -89,11 +88,6 @@
89
88
  ]
90
89
  }
91
90
  },
92
- "platform-feature-flags": {
93
- "platform.design-system-team.update-border-radio-checkbox_7askv": {
94
- "type": "boolean"
95
- }
96
- },
97
91
  "homepage": "https://atlassian.design/components/checkbox/",
98
92
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
99
93
  }
@@ -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
- ```