@atlaskit/checkbox 12.3.13 → 12.3.14
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 +6 -0
- package/dist/cjs/checkbox.js +10 -25
- package/dist/cjs/internal/label-text.js +2 -4
- package/dist/cjs/internal/label.js +5 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/checkbox.js +10 -25
- package/dist/es2019/internal/label-text.js +2 -3
- package/dist/es2019/internal/label.js +6 -3
- package/dist/es2019/version.json +1 -1
- package/dist/esm/checkbox.js +10 -25
- package/dist/esm/internal/label-text.js +2 -3
- package/dist/esm/internal/label.js +5 -2
- package/dist/esm/version.json +1 -1
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/checkbox
|
|
2
2
|
|
|
3
|
+
## 12.3.14
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`ff75f6c3189`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ff75f6c3189) - [ux] Checkbox now uses grid layout in order to position the hidden checkbox over the area where the icon is. This improves the virtual cursor for screen readers while also meaning that modifier keys used when clicking the checkbox work."
|
|
8
|
+
|
|
3
9
|
## 12.3.13
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/cjs/checkbox.js
CHANGED
|
@@ -24,25 +24,18 @@ var _mergeRefs = _interopRequireDefault(require("@atlaskit/ds-lib/merge-refs"));
|
|
|
24
24
|
var _internal = require("./internal");
|
|
25
25
|
|
|
26
26
|
var _excluded = ["isChecked", "isDisabled", "isInvalid", "defaultChecked", "isIndeterminate", "size", "onChange", "analyticsContext", "label", "name", "value", "isRequired", "testId"];
|
|
27
|
-
// firefox doesn't handle cmd+click/ctrl+click properly
|
|
28
|
-
var isFirefox = typeof navigator !== 'undefined' && navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
|
29
|
-
/* eslint-disable @repo/internal/styles/no-nested-styles */
|
|
30
27
|
|
|
28
|
+
/* eslint-disable @repo/internal/styles/no-nested-styles */
|
|
31
29
|
var checkboxStyles = (0, _core.css)({
|
|
32
|
-
width:
|
|
33
|
-
|
|
34
|
-
height: 0,
|
|
35
|
-
// Necessary to hide correctly on mobile Safari
|
|
30
|
+
width: '100%',
|
|
31
|
+
height: '100%',
|
|
36
32
|
margin: 0,
|
|
37
33
|
appearance: 'none',
|
|
38
34
|
border: 'none',
|
|
39
|
-
|
|
35
|
+
gridArea: '1 / 1 / 2 / 2',
|
|
36
|
+
opacity: 0,
|
|
40
37
|
outline: 'none',
|
|
41
|
-
// Necessary to hide focus ring on Firefox
|
|
42
38
|
'& + svg': {
|
|
43
|
-
flexShrink: 0,
|
|
44
|
-
alignSelf: 'flex-start',
|
|
45
|
-
|
|
46
39
|
/**
|
|
47
40
|
* Change the variables --checkbox-background-color, --checkbox-border-color
|
|
48
41
|
* and --checkbox-tick-color according to user interactions.
|
|
@@ -54,6 +47,8 @@ var checkboxStyles = (0, _core.css)({
|
|
|
54
47
|
'--checkbox-tick-color': 'var(--local-tick-rest)',
|
|
55
48
|
color: 'var(--checkbox-background-color)',
|
|
56
49
|
fill: 'var(--checkbox-tick-color)',
|
|
50
|
+
gridArea: '1 / 1 / 2 / 2',
|
|
51
|
+
pointerEvents: 'none',
|
|
57
52
|
transition: 'color 0.2s ease-in-out, fill 0.2s ease-in-out',
|
|
58
53
|
'rect:first-of-type': {
|
|
59
54
|
stroke: 'var(--checkbox-border-color)',
|
|
@@ -179,25 +174,15 @@ var Checkbox = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
|
|
|
179
174
|
analyticsData: analyticsContext,
|
|
180
175
|
componentName: 'checkbox',
|
|
181
176
|
packageName: "@atlaskit/checkbox",
|
|
182
|
-
packageVersion: "12.3.
|
|
177
|
+
packageVersion: "12.3.14"
|
|
183
178
|
});
|
|
184
179
|
var internalRef = (0, _react.useRef)(null);
|
|
185
|
-
var mergedRefs = (0, _mergeRefs.default)([internalRef, ref]); //
|
|
186
|
-
|
|
187
|
-
var onClickLabel = function onClickLabel(event) {
|
|
188
|
-
if (event.ctrlKey || event.metaKey || event.shiftKey) {
|
|
189
|
-
var _internalRef$current;
|
|
190
|
-
|
|
191
|
-
(_internalRef$current = internalRef.current) === null || _internalRef$current === void 0 ? void 0 : _internalRef$current.click();
|
|
192
|
-
}
|
|
193
|
-
}; // Use isChecked from the state if it is controlled
|
|
194
|
-
|
|
180
|
+
var mergedRefs = (0, _mergeRefs.default)([internalRef, ref]); // Use isChecked from the state if it is controlled
|
|
195
181
|
|
|
196
182
|
var isChecked = isCheckedProp === undefined ? isCheckedState : isCheckedProp;
|
|
197
183
|
return (0, _core.jsx)(_internal.Label, {
|
|
198
184
|
isDisabled: isDisabled,
|
|
199
|
-
testId: testId && "".concat(testId, "--checkbox-label")
|
|
200
|
-
onClick: isFirefox ? onClickLabel : undefined
|
|
185
|
+
testId: testId && "".concat(testId, "--checkbox-label")
|
|
201
186
|
}, (0, _core.jsx)("input", (0, _extends2.default)({}, rest, {
|
|
202
187
|
type: "checkbox",
|
|
203
188
|
ref: mergedRefs,
|
|
@@ -7,12 +7,10 @@ exports.default = LabelText;
|
|
|
7
7
|
|
|
8
8
|
var _core = require("@emotion/core");
|
|
9
9
|
|
|
10
|
-
var _constants = require("./constants");
|
|
11
|
-
|
|
12
10
|
/** @jsx jsx */
|
|
13
11
|
var labelTextStyles = (0, _core.css)({
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
alignSelf: 'center',
|
|
13
|
+
gridArea: '1 / 2 / 2 / 3'
|
|
16
14
|
});
|
|
17
15
|
|
|
18
16
|
function LabelText(_ref) {
|
|
@@ -19,8 +19,11 @@ var _theme = _interopRequireDefault(require("./theme"));
|
|
|
19
19
|
|
|
20
20
|
/** @jsx jsx */
|
|
21
21
|
var labelStyles = (0, _core.css)({
|
|
22
|
-
display: '
|
|
23
|
-
|
|
22
|
+
display: 'grid',
|
|
23
|
+
gap: '0 4px',
|
|
24
|
+
gridAutoColumns: '1fr',
|
|
25
|
+
gridAutoRows: 'min-content',
|
|
26
|
+
gridTemplateColumns: 'min-content auto',
|
|
24
27
|
color: "var(--ds-text, ".concat(_colors.N900, ")"),
|
|
25
28
|
cursor: 'default',
|
|
26
29
|
fontFamily: _constants.fontFamily
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/checkbox.js
CHANGED
|
@@ -6,25 +6,18 @@ import { css, jsx } from '@emotion/core';
|
|
|
6
6
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
|
|
7
7
|
import mergeRefs from '@atlaskit/ds-lib/merge-refs';
|
|
8
8
|
import { CheckboxIcon, Label, LabelText, RequiredIndicator } from './internal';
|
|
9
|
-
// firefox doesn't handle cmd+click/ctrl+click properly
|
|
10
|
-
const isFirefox = typeof navigator !== 'undefined' && navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
|
11
|
-
/* eslint-disable @repo/internal/styles/no-nested-styles */
|
|
12
9
|
|
|
10
|
+
/* eslint-disable @repo/internal/styles/no-nested-styles */
|
|
13
11
|
const checkboxStyles = css({
|
|
14
|
-
width:
|
|
15
|
-
|
|
16
|
-
height: 0,
|
|
17
|
-
// Necessary to hide correctly on mobile Safari
|
|
12
|
+
width: '100%',
|
|
13
|
+
height: '100%',
|
|
18
14
|
margin: 0,
|
|
19
15
|
appearance: 'none',
|
|
20
16
|
border: 'none',
|
|
21
|
-
|
|
17
|
+
gridArea: '1 / 1 / 2 / 2',
|
|
18
|
+
opacity: 0,
|
|
22
19
|
outline: 'none',
|
|
23
|
-
// Necessary to hide focus ring on Firefox
|
|
24
20
|
'& + svg': {
|
|
25
|
-
flexShrink: 0,
|
|
26
|
-
alignSelf: 'flex-start',
|
|
27
|
-
|
|
28
21
|
/**
|
|
29
22
|
* Change the variables --checkbox-background-color, --checkbox-border-color
|
|
30
23
|
* and --checkbox-tick-color according to user interactions.
|
|
@@ -36,6 +29,8 @@ const checkboxStyles = css({
|
|
|
36
29
|
'--checkbox-tick-color': 'var(--local-tick-rest)',
|
|
37
30
|
color: 'var(--checkbox-background-color)',
|
|
38
31
|
fill: 'var(--checkbox-tick-color)',
|
|
32
|
+
gridArea: '1 / 1 / 2 / 2',
|
|
33
|
+
pointerEvents: 'none',
|
|
39
34
|
transition: 'color 0.2s ease-in-out, fill 0.2s ease-in-out',
|
|
40
35
|
'rect:first-of-type': {
|
|
41
36
|
stroke: 'var(--checkbox-border-color)',
|
|
@@ -153,25 +148,15 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Checkbox(pr
|
|
|
153
148
|
analyticsData: analyticsContext,
|
|
154
149
|
componentName: 'checkbox',
|
|
155
150
|
packageName: "@atlaskit/checkbox",
|
|
156
|
-
packageVersion: "12.3.
|
|
151
|
+
packageVersion: "12.3.14"
|
|
157
152
|
});
|
|
158
153
|
const internalRef = useRef(null);
|
|
159
|
-
const mergedRefs = mergeRefs([internalRef, ref]); //
|
|
160
|
-
|
|
161
|
-
const onClickLabel = event => {
|
|
162
|
-
if (event.ctrlKey || event.metaKey || event.shiftKey) {
|
|
163
|
-
var _internalRef$current;
|
|
164
|
-
|
|
165
|
-
(_internalRef$current = internalRef.current) === null || _internalRef$current === void 0 ? void 0 : _internalRef$current.click();
|
|
166
|
-
}
|
|
167
|
-
}; // Use isChecked from the state if it is controlled
|
|
168
|
-
|
|
154
|
+
const mergedRefs = mergeRefs([internalRef, ref]); // Use isChecked from the state if it is controlled
|
|
169
155
|
|
|
170
156
|
const isChecked = isCheckedProp === undefined ? isCheckedState : isCheckedProp;
|
|
171
157
|
return jsx(Label, {
|
|
172
158
|
isDisabled: isDisabled,
|
|
173
|
-
testId: testId && `${testId}--checkbox-label
|
|
174
|
-
onClick: isFirefox ? onClickLabel : undefined
|
|
159
|
+
testId: testId && `${testId}--checkbox-label`
|
|
175
160
|
}, jsx("input", _extends({}, rest, {
|
|
176
161
|
type: "checkbox",
|
|
177
162
|
ref: mergedRefs,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { css, jsx } from '@emotion/core';
|
|
3
|
-
import { gridSize } from './constants';
|
|
4
3
|
const labelTextStyles = css({
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
alignSelf: 'center',
|
|
5
|
+
gridArea: '1 / 2 / 2 / 3'
|
|
7
6
|
});
|
|
8
7
|
export default function LabelText({
|
|
9
8
|
children
|
|
@@ -5,11 +5,14 @@ import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
|
5
5
|
import { fontFamily } from './constants';
|
|
6
6
|
import theme from './theme';
|
|
7
7
|
const labelStyles = css({
|
|
8
|
-
display: '
|
|
9
|
-
|
|
8
|
+
display: 'grid',
|
|
9
|
+
gap: '0 4px',
|
|
10
|
+
gridAutoColumns: '1fr',
|
|
11
|
+
gridAutoRows: 'min-content',
|
|
12
|
+
gridTemplateColumns: 'min-content auto',
|
|
10
13
|
color: `var(--ds-text, ${N900})`,
|
|
11
14
|
cursor: 'default',
|
|
12
|
-
fontFamily
|
|
15
|
+
fontFamily: fontFamily
|
|
13
16
|
});
|
|
14
17
|
const disabledStyles = css({
|
|
15
18
|
color: `var(--ds-text-disabled, ${N80})`,
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/checkbox.js
CHANGED
|
@@ -9,25 +9,18 @@ import { css, jsx } from '@emotion/core';
|
|
|
9
9
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
|
|
10
10
|
import mergeRefs from '@atlaskit/ds-lib/merge-refs';
|
|
11
11
|
import { CheckboxIcon, Label, LabelText, RequiredIndicator } from './internal';
|
|
12
|
-
// firefox doesn't handle cmd+click/ctrl+click properly
|
|
13
|
-
var isFirefox = typeof navigator !== 'undefined' && navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
|
14
|
-
/* eslint-disable @repo/internal/styles/no-nested-styles */
|
|
15
12
|
|
|
13
|
+
/* eslint-disable @repo/internal/styles/no-nested-styles */
|
|
16
14
|
var checkboxStyles = css({
|
|
17
|
-
width:
|
|
18
|
-
|
|
19
|
-
height: 0,
|
|
20
|
-
// Necessary to hide correctly on mobile Safari
|
|
15
|
+
width: '100%',
|
|
16
|
+
height: '100%',
|
|
21
17
|
margin: 0,
|
|
22
18
|
appearance: 'none',
|
|
23
19
|
border: 'none',
|
|
24
|
-
|
|
20
|
+
gridArea: '1 / 1 / 2 / 2',
|
|
21
|
+
opacity: 0,
|
|
25
22
|
outline: 'none',
|
|
26
|
-
// Necessary to hide focus ring on Firefox
|
|
27
23
|
'& + svg': {
|
|
28
|
-
flexShrink: 0,
|
|
29
|
-
alignSelf: 'flex-start',
|
|
30
|
-
|
|
31
24
|
/**
|
|
32
25
|
* Change the variables --checkbox-background-color, --checkbox-border-color
|
|
33
26
|
* and --checkbox-tick-color according to user interactions.
|
|
@@ -39,6 +32,8 @@ var checkboxStyles = css({
|
|
|
39
32
|
'--checkbox-tick-color': 'var(--local-tick-rest)',
|
|
40
33
|
color: 'var(--checkbox-background-color)',
|
|
41
34
|
fill: 'var(--checkbox-tick-color)',
|
|
35
|
+
gridArea: '1 / 1 / 2 / 2',
|
|
36
|
+
pointerEvents: 'none',
|
|
42
37
|
transition: 'color 0.2s ease-in-out, fill 0.2s ease-in-out',
|
|
43
38
|
'rect:first-of-type': {
|
|
44
39
|
stroke: 'var(--checkbox-border-color)',
|
|
@@ -164,25 +159,15 @@ var Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Checkbox(prop
|
|
|
164
159
|
analyticsData: analyticsContext,
|
|
165
160
|
componentName: 'checkbox',
|
|
166
161
|
packageName: "@atlaskit/checkbox",
|
|
167
|
-
packageVersion: "12.3.
|
|
162
|
+
packageVersion: "12.3.14"
|
|
168
163
|
});
|
|
169
164
|
var internalRef = useRef(null);
|
|
170
|
-
var mergedRefs = mergeRefs([internalRef, ref]); //
|
|
171
|
-
|
|
172
|
-
var onClickLabel = function onClickLabel(event) {
|
|
173
|
-
if (event.ctrlKey || event.metaKey || event.shiftKey) {
|
|
174
|
-
var _internalRef$current;
|
|
175
|
-
|
|
176
|
-
(_internalRef$current = internalRef.current) === null || _internalRef$current === void 0 ? void 0 : _internalRef$current.click();
|
|
177
|
-
}
|
|
178
|
-
}; // Use isChecked from the state if it is controlled
|
|
179
|
-
|
|
165
|
+
var mergedRefs = mergeRefs([internalRef, ref]); // Use isChecked from the state if it is controlled
|
|
180
166
|
|
|
181
167
|
var isChecked = isCheckedProp === undefined ? isCheckedState : isCheckedProp;
|
|
182
168
|
return jsx(Label, {
|
|
183
169
|
isDisabled: isDisabled,
|
|
184
|
-
testId: testId && "".concat(testId, "--checkbox-label")
|
|
185
|
-
onClick: isFirefox ? onClickLabel : undefined
|
|
170
|
+
testId: testId && "".concat(testId, "--checkbox-label")
|
|
186
171
|
}, jsx("input", _extends({}, rest, {
|
|
187
172
|
type: "checkbox",
|
|
188
173
|
ref: mergedRefs,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { css, jsx } from '@emotion/core';
|
|
3
|
-
import { gridSize } from './constants';
|
|
4
3
|
var labelTextStyles = css({
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
alignSelf: 'center',
|
|
5
|
+
gridArea: '1 / 2 / 2 / 3'
|
|
7
6
|
});
|
|
8
7
|
export default function LabelText(_ref) {
|
|
9
8
|
var children = _ref.children;
|
|
@@ -5,8 +5,11 @@ import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
|
5
5
|
import { fontFamily } from './constants';
|
|
6
6
|
import theme from './theme';
|
|
7
7
|
var labelStyles = css({
|
|
8
|
-
display: '
|
|
9
|
-
|
|
8
|
+
display: 'grid',
|
|
9
|
+
gap: '0 4px',
|
|
10
|
+
gridAutoColumns: '1fr',
|
|
11
|
+
gridAutoRows: 'min-content',
|
|
12
|
+
gridTemplateColumns: 'min-content auto',
|
|
10
13
|
color: "var(--ds-text, ".concat(N900, ")"),
|
|
11
14
|
cursor: 'default',
|
|
12
15
|
fontFamily: fontFamily
|
package/dist/esm/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/checkbox",
|
|
3
|
-
"version": "12.3.
|
|
3
|
+
"version": "12.3.14",
|
|
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/"
|
|
7
7
|
},
|
|
8
|
-
"repository": "https://bitbucket.org/atlassian/atlassian-frontend",
|
|
8
|
+
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
9
9
|
"author": "Atlassian Pty Ltd",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"main": "dist/cjs/index.js",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"team": "Design System Team",
|
|
19
19
|
"releaseModel": "scheduled",
|
|
20
20
|
"website": {
|
|
21
|
-
"name": "Checkbox"
|
|
21
|
+
"name": "Checkbox",
|
|
22
|
+
"category": "Components"
|
|
22
23
|
}
|
|
23
24
|
},
|
|
24
25
|
"af:exports": {
|