@atlaskit/checkbox 12.3.15 → 12.3.16
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 +2 -1
- package/dist/cjs/internal/label.js +11 -7
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/checkbox.js +2 -1
- package/dist/es2019/internal/label.js +11 -7
- package/dist/es2019/version.json +1 -1
- package/dist/esm/checkbox.js +2 -1
- package/dist/esm/internal/label.js +11 -7
- package/dist/esm/version.json +1 -1
- package/dist/types/internal/label.d.ts +1 -1
- package/package.json +1 -1
- package/report.api.md +51 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/checkbox
|
|
2
2
|
|
|
3
|
+
## 12.3.16
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`f55cf469372`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f55cf469372) - Added id property to the checkbox label for compatibility with aria-labelledby
|
|
8
|
+
|
|
3
9
|
## 12.3.15
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/cjs/checkbox.js
CHANGED
|
@@ -174,7 +174,7 @@ var Checkbox = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
|
|
|
174
174
|
analyticsData: analyticsContext,
|
|
175
175
|
componentName: 'checkbox',
|
|
176
176
|
packageName: "@atlaskit/checkbox",
|
|
177
|
-
packageVersion: "12.3.
|
|
177
|
+
packageVersion: "12.3.16"
|
|
178
178
|
});
|
|
179
179
|
var internalRef = (0, _react.useRef)(null);
|
|
180
180
|
var mergedRefs = (0, _mergeRefs.default)([internalRef, ref]); // Use isChecked from the state if it is controlled
|
|
@@ -182,6 +182,7 @@ var Checkbox = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
|
|
|
182
182
|
var isChecked = isCheckedProp === undefined ? isCheckedState : isCheckedProp;
|
|
183
183
|
return (0, _core.jsx)(_internal.Label, {
|
|
184
184
|
isDisabled: isDisabled,
|
|
185
|
+
id: rest.id ? "".concat(rest.id, "-label") : undefined,
|
|
185
186
|
testId: testId && "".concat(testId, "--checkbox-label")
|
|
186
187
|
}, (0, _core.jsx)("input", (0, _extends2.default)({}, rest, {
|
|
187
188
|
type: "checkbox",
|
|
@@ -103,15 +103,19 @@ function Label(_ref) {
|
|
|
103
103
|
var children = _ref.children,
|
|
104
104
|
isDisabled = _ref.isDisabled,
|
|
105
105
|
testId = _ref.testId,
|
|
106
|
-
onClick = _ref.onClick
|
|
106
|
+
onClick = _ref.onClick,
|
|
107
|
+
id = _ref.id;
|
|
107
108
|
|
|
108
109
|
var _useGlobalTheme = (0, _components.useGlobalTheme)(),
|
|
109
110
|
mode = _useGlobalTheme.mode;
|
|
110
111
|
|
|
111
|
-
return (
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
112
|
+
return (// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
113
|
+
(0, _core.jsx)("label", {
|
|
114
|
+
css: [labelStyles, isDisabled && disabledStyles, mode === 'light' && themeStyles.light, mode === 'dark' && themeStyles.dark],
|
|
115
|
+
"data-testid": testId,
|
|
116
|
+
"data-disabled": isDisabled || undefined,
|
|
117
|
+
onClick: onClick,
|
|
118
|
+
id: id
|
|
119
|
+
}, children)
|
|
120
|
+
);
|
|
117
121
|
}
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/checkbox.js
CHANGED
|
@@ -148,7 +148,7 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Checkbox(pr
|
|
|
148
148
|
analyticsData: analyticsContext,
|
|
149
149
|
componentName: 'checkbox',
|
|
150
150
|
packageName: "@atlaskit/checkbox",
|
|
151
|
-
packageVersion: "12.3.
|
|
151
|
+
packageVersion: "12.3.16"
|
|
152
152
|
});
|
|
153
153
|
const internalRef = useRef(null);
|
|
154
154
|
const mergedRefs = mergeRefs([internalRef, ref]); // Use isChecked from the state if it is controlled
|
|
@@ -156,6 +156,7 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Checkbox(pr
|
|
|
156
156
|
const isChecked = isCheckedProp === undefined ? isCheckedState : isCheckedProp;
|
|
157
157
|
return jsx(Label, {
|
|
158
158
|
isDisabled: isDisabled,
|
|
159
|
+
id: rest.id ? `${rest.id}-label` : undefined,
|
|
159
160
|
testId: testId && `${testId}--checkbox-label`
|
|
160
161
|
}, jsx("input", _extends({}, rest, {
|
|
161
162
|
type: "checkbox",
|
|
@@ -88,15 +88,19 @@ export default function Label({
|
|
|
88
88
|
children,
|
|
89
89
|
isDisabled,
|
|
90
90
|
testId,
|
|
91
|
-
onClick
|
|
91
|
+
onClick,
|
|
92
|
+
id
|
|
92
93
|
}) {
|
|
93
94
|
const {
|
|
94
95
|
mode
|
|
95
96
|
} = useGlobalTheme();
|
|
96
|
-
return jsx
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
97
|
+
return (// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
98
|
+
jsx("label", {
|
|
99
|
+
css: [labelStyles, isDisabled && disabledStyles, mode === 'light' && themeStyles.light, mode === 'dark' && themeStyles.dark],
|
|
100
|
+
"data-testid": testId,
|
|
101
|
+
"data-disabled": isDisabled || undefined,
|
|
102
|
+
onClick: onClick,
|
|
103
|
+
id: id
|
|
104
|
+
}, children)
|
|
105
|
+
);
|
|
102
106
|
}
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/checkbox.js
CHANGED
|
@@ -159,7 +159,7 @@ var Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Checkbox(prop
|
|
|
159
159
|
analyticsData: analyticsContext,
|
|
160
160
|
componentName: 'checkbox',
|
|
161
161
|
packageName: "@atlaskit/checkbox",
|
|
162
|
-
packageVersion: "12.3.
|
|
162
|
+
packageVersion: "12.3.16"
|
|
163
163
|
});
|
|
164
164
|
var internalRef = useRef(null);
|
|
165
165
|
var mergedRefs = mergeRefs([internalRef, ref]); // Use isChecked from the state if it is controlled
|
|
@@ -167,6 +167,7 @@ var Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Checkbox(prop
|
|
|
167
167
|
var isChecked = isCheckedProp === undefined ? isCheckedState : isCheckedProp;
|
|
168
168
|
return jsx(Label, {
|
|
169
169
|
isDisabled: isDisabled,
|
|
170
|
+
id: rest.id ? "".concat(rest.id, "-label") : undefined,
|
|
170
171
|
testId: testId && "".concat(testId, "--checkbox-label")
|
|
171
172
|
}, jsx("input", _extends({}, rest, {
|
|
172
173
|
type: "checkbox",
|
|
@@ -88,15 +88,19 @@ export default function Label(_ref) {
|
|
|
88
88
|
var children = _ref.children,
|
|
89
89
|
isDisabled = _ref.isDisabled,
|
|
90
90
|
testId = _ref.testId,
|
|
91
|
-
onClick = _ref.onClick
|
|
91
|
+
onClick = _ref.onClick,
|
|
92
|
+
id = _ref.id;
|
|
92
93
|
|
|
93
94
|
var _useGlobalTheme = useGlobalTheme(),
|
|
94
95
|
mode = _useGlobalTheme.mode;
|
|
95
96
|
|
|
96
|
-
return jsx
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
97
|
+
return (// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
98
|
+
jsx("label", {
|
|
99
|
+
css: [labelStyles, isDisabled && disabledStyles, mode === 'light' && themeStyles.light, mode === 'dark' && themeStyles.dark],
|
|
100
|
+
"data-testid": testId,
|
|
101
|
+
"data-disabled": isDisabled || undefined,
|
|
102
|
+
onClick: onClick,
|
|
103
|
+
id: id
|
|
104
|
+
}, children)
|
|
105
|
+
);
|
|
102
106
|
}
|
package/dist/esm/version.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { LabelProps } from '../types';
|
|
3
|
-
export default function Label({ children, isDisabled, testId, onClick, }: LabelProps): JSX.Element;
|
|
3
|
+
export default function Label({ children, isDisabled, testId, onClick, id, }: LabelProps): JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/checkbox",
|
|
3
|
-
"version": "12.3.
|
|
3
|
+
"version": "12.3.16",
|
|
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/"
|
package/report.api.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
/// <reference types="react" />
|
|
7
|
+
|
|
8
|
+
import { ForwardRefExoticComponent } from 'react';
|
|
9
|
+
import { InputHTMLAttributes } from 'react';
|
|
10
|
+
import { MemoExoticComponent } from 'react';
|
|
11
|
+
import { default as React_2 } from 'react';
|
|
12
|
+
import { RefAttributes } from 'react';
|
|
13
|
+
import type UIAnalyticsEvent from '@atlaskit/analytics-next/UIAnalyticsEvent';
|
|
14
|
+
|
|
15
|
+
// @public
|
|
16
|
+
const Checkbox: MemoExoticComponent<ForwardRefExoticComponent<
|
|
17
|
+
Omit<
|
|
18
|
+
Omit<
|
|
19
|
+
InputHTMLAttributes<HTMLInputElement>,
|
|
20
|
+
'disabled' | 'required' | 'checked' | 'css'
|
|
21
|
+
>,
|
|
22
|
+
keyof OwnProps
|
|
23
|
+
> &
|
|
24
|
+
OwnProps &
|
|
25
|
+
RefAttributes<HTMLInputElement>
|
|
26
|
+
>>;
|
|
27
|
+
export { Checkbox };
|
|
28
|
+
export default Checkbox;
|
|
29
|
+
|
|
30
|
+
// @public (undocumented)
|
|
31
|
+
export type CheckboxProps = Combine<
|
|
32
|
+
Omit<
|
|
33
|
+
React_2.InputHTMLAttributes<HTMLInputElement>,
|
|
34
|
+
/**
|
|
35
|
+
* 'disabled', 'required', and 'checked' are omitted so that
|
|
36
|
+
* consumers must handle state using our props.
|
|
37
|
+
*
|
|
38
|
+
* 'css' is added globally to element attributes by emotion.
|
|
39
|
+
* This was causing a bug, making the css prop required in
|
|
40
|
+
* some cases. We explicitly omit it to avoid that.
|
|
41
|
+
*
|
|
42
|
+
* Because 'className' (which the css prop uses internally)
|
|
43
|
+
* is still available, this should not break existing usage.
|
|
44
|
+
*/
|
|
45
|
+
'disabled' | 'required' | 'checked' | 'css'
|
|
46
|
+
>,
|
|
47
|
+
OwnProps
|
|
48
|
+
>;
|
|
49
|
+
|
|
50
|
+
// (No @packageDocumentation comment for this package)
|
|
51
|
+
```
|