@atlaskit/checkbox 12.4.1 → 12.4.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
+ ## 12.4.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`ed1b0fd2c2d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ed1b0fd2c2d) - [ux] Removes redundant whitespace from checkbox when no visual label is applied - eg when an aria-label or id is used instead.
8
+
3
9
  ## 12.4.1
4
10
 
5
11
  ### Patch Changes
@@ -29,7 +29,7 @@ var _excluded = ["isChecked", "isDisabled", "isInvalid", "defaultChecked", "isIn
29
29
  var checkboxStyles = (0, _react2.css)({
30
30
  width: '100%',
31
31
  height: '100%',
32
- margin: 0,
32
+ margin: "var(--ds-space-0, 0px)",
33
33
  appearance: 'none',
34
34
  border: 'none',
35
35
  gridArea: '1 / 1 / 2 / 2',
@@ -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.4.1"
177
+ packageVersion: "12.4.2"
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, _react2.jsx)(_internal.Label, {
184
184
  isDisabled: isDisabled,
185
+ label: label,
185
186
  id: rest.id ? "".concat(rest.id, "-label") : undefined,
186
187
  testId: testId && "".concat(testId, "--checkbox-label")
187
188
  }, (0, _react2.jsx)("input", (0, _extends2.default)({}, rest, {
@@ -20,13 +20,15 @@ var _theme = _interopRequireDefault(require("./theme"));
20
20
  /** @jsx jsx */
21
21
  var labelStyles = (0, _react.css)({
22
22
  display: 'grid',
23
- gap: '0 4px',
24
23
  gridAutoColumns: '1fr',
25
24
  gridAutoRows: 'min-content',
26
- gridTemplateColumns: 'min-content auto',
27
25
  color: "var(--ds-text, ".concat(_colors.N900, ")"),
28
26
  cursor: 'default',
29
- fontFamily: _constants.fontFamily
27
+ fontFamily: "var(--ds-font-family-sans, ".concat(_constants.fontFamily, ")")
28
+ });
29
+ var textLabelLayoutStyles = (0, _react.css)({
30
+ gap: "var(--ds-space-0, 0px)".concat(" ", "var(--ds-space-050, 4px)"),
31
+ gridTemplateColumns: 'min-content auto'
30
32
  });
31
33
  var disabledStyles = (0, _react.css)({
32
34
  color: "var(--ds-text-disabled, ".concat(_colors.N80, ")"),
@@ -104,6 +106,7 @@ function Label(_ref) {
104
106
  isDisabled = _ref.isDisabled,
105
107
  testId = _ref.testId,
106
108
  onClick = _ref.onClick,
109
+ label = _ref.label,
107
110
  id = _ref.id;
108
111
 
109
112
  var _useGlobalTheme = (0, _components.useGlobalTheme)(),
@@ -111,7 +114,7 @@ function Label(_ref) {
111
114
 
112
115
  return (// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
113
116
  (0, _react.jsx)("label", {
114
- css: [labelStyles, isDisabled && disabledStyles, mode === 'light' && themeStyles.light, mode === 'dark' && themeStyles.dark],
117
+ css: [labelStyles, label && textLabelLayoutStyles, isDisabled && disabledStyles, mode === 'light' && themeStyles.light, mode === 'dark' && themeStyles.dark],
115
118
  "data-testid": testId,
116
119
  "data-disabled": isDisabled || undefined,
117
120
  onClick: onClick,
@@ -9,11 +9,9 @@ var _react = require("@emotion/react");
9
9
 
10
10
  var _colors = require("@atlaskit/theme/colors");
11
11
 
12
- var _constants = require("./constants");
13
-
14
12
  /** @jsx jsx */
15
13
  var requiredIndicatorStyles = (0, _react.css)({
16
- paddingLeft: _constants.gridSize * 0.25,
14
+ paddingLeft: "var(--ds-space-025, 2px)",
17
15
  color: "var(--ds-text-danger, ".concat(_colors.R500, ")")
18
16
  });
19
17
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/checkbox",
3
- "version": "12.4.1",
3
+ "version": "12.4.2",
4
4
  "sideEffects": false
5
5
  }
@@ -11,7 +11,7 @@ import { CheckboxIcon, Label, LabelText, RequiredIndicator } from './internal';
11
11
  const checkboxStyles = css({
12
12
  width: '100%',
13
13
  height: '100%',
14
- margin: 0,
14
+ margin: "var(--ds-space-0, 0px)",
15
15
  appearance: 'none',
16
16
  border: 'none',
17
17
  gridArea: '1 / 1 / 2 / 2',
@@ -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.4.1"
151
+ packageVersion: "12.4.2"
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
+ label: label,
159
160
  id: rest.id ? `${rest.id}-label` : undefined,
160
161
  testId: testId && `${testId}--checkbox-label`
161
162
  }, jsx("input", _extends({}, rest, {
@@ -6,13 +6,15 @@ import { fontFamily } from './constants';
6
6
  import theme from './theme';
7
7
  const labelStyles = css({
8
8
  display: 'grid',
9
- gap: '0 4px',
10
9
  gridAutoColumns: '1fr',
11
10
  gridAutoRows: 'min-content',
12
- gridTemplateColumns: 'min-content auto',
13
11
  color: `var(--ds-text, ${N900})`,
14
12
  cursor: 'default',
15
- fontFamily: fontFamily
13
+ fontFamily: `var(--ds-font-family-sans, ${fontFamily})`
14
+ });
15
+ const textLabelLayoutStyles = css({
16
+ gap: `${"var(--ds-space-0, 0px)"} ${"var(--ds-space-050, 4px)"}`,
17
+ gridTemplateColumns: 'min-content auto'
16
18
  });
17
19
  const disabledStyles = css({
18
20
  color: `var(--ds-text-disabled, ${N80})`,
@@ -89,6 +91,7 @@ export default function Label({
89
91
  isDisabled,
90
92
  testId,
91
93
  onClick,
94
+ label,
92
95
  id
93
96
  }) {
94
97
  const {
@@ -96,7 +99,7 @@ export default function Label({
96
99
  } = useGlobalTheme();
97
100
  return (// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
98
101
  jsx("label", {
99
- css: [labelStyles, isDisabled && disabledStyles, mode === 'light' && themeStyles.light, mode === 'dark' && themeStyles.dark],
102
+ css: [labelStyles, label && textLabelLayoutStyles, isDisabled && disabledStyles, mode === 'light' && themeStyles.light, mode === 'dark' && themeStyles.dark],
100
103
  "data-testid": testId,
101
104
  "data-disabled": isDisabled || undefined,
102
105
  onClick: onClick,
@@ -1,9 +1,8 @@
1
1
  /** @jsx jsx */
2
2
  import { css, jsx } from '@emotion/react';
3
3
  import { R500 } from '@atlaskit/theme/colors';
4
- import { gridSize } from './constants';
5
4
  const requiredIndicatorStyles = css({
6
- paddingLeft: gridSize * 0.25,
5
+ paddingLeft: "var(--ds-space-025, 2px)",
7
6
  color: `var(--ds-text-danger, ${R500})`
8
7
  });
9
8
  export default function RequiredIndicator() {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/checkbox",
3
- "version": "12.4.1",
3
+ "version": "12.4.2",
4
4
  "sideEffects": false
5
5
  }
@@ -14,7 +14,7 @@ import { CheckboxIcon, Label, LabelText, RequiredIndicator } from './internal';
14
14
  var checkboxStyles = css({
15
15
  width: '100%',
16
16
  height: '100%',
17
- margin: 0,
17
+ margin: "var(--ds-space-0, 0px)",
18
18
  appearance: 'none',
19
19
  border: 'none',
20
20
  gridArea: '1 / 1 / 2 / 2',
@@ -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.4.1"
162
+ packageVersion: "12.4.2"
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
+ label: label,
170
171
  id: rest.id ? "".concat(rest.id, "-label") : undefined,
171
172
  testId: testId && "".concat(testId, "--checkbox-label")
172
173
  }, jsx("input", _extends({}, rest, {
@@ -6,13 +6,15 @@ import { fontFamily } from './constants';
6
6
  import theme from './theme';
7
7
  var labelStyles = css({
8
8
  display: 'grid',
9
- gap: '0 4px',
10
9
  gridAutoColumns: '1fr',
11
10
  gridAutoRows: 'min-content',
12
- gridTemplateColumns: 'min-content auto',
13
11
  color: "var(--ds-text, ".concat(N900, ")"),
14
12
  cursor: 'default',
15
- fontFamily: fontFamily
13
+ fontFamily: "var(--ds-font-family-sans, ".concat(fontFamily, ")")
14
+ });
15
+ var textLabelLayoutStyles = css({
16
+ gap: "var(--ds-space-0, 0px)".concat(" ", "var(--ds-space-050, 4px)"),
17
+ gridTemplateColumns: 'min-content auto'
16
18
  });
17
19
  var disabledStyles = css({
18
20
  color: "var(--ds-text-disabled, ".concat(N80, ")"),
@@ -89,6 +91,7 @@ export default function Label(_ref) {
89
91
  isDisabled = _ref.isDisabled,
90
92
  testId = _ref.testId,
91
93
  onClick = _ref.onClick,
94
+ label = _ref.label,
92
95
  id = _ref.id;
93
96
 
94
97
  var _useGlobalTheme = useGlobalTheme(),
@@ -96,7 +99,7 @@ export default function Label(_ref) {
96
99
 
97
100
  return (// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
98
101
  jsx("label", {
99
- css: [labelStyles, isDisabled && disabledStyles, mode === 'light' && themeStyles.light, mode === 'dark' && themeStyles.dark],
102
+ css: [labelStyles, label && textLabelLayoutStyles, isDisabled && disabledStyles, mode === 'light' && themeStyles.light, mode === 'dark' && themeStyles.dark],
100
103
  "data-testid": testId,
101
104
  "data-disabled": isDisabled || undefined,
102
105
  onClick: onClick,
@@ -1,9 +1,8 @@
1
1
  /** @jsx jsx */
2
2
  import { css, jsx } from '@emotion/react';
3
3
  import { R500 } from '@atlaskit/theme/colors';
4
- import { gridSize } from './constants';
5
4
  var requiredIndicatorStyles = css({
6
- paddingLeft: gridSize * 0.25,
5
+ paddingLeft: "var(--ds-space-025, 2px)",
7
6
  color: "var(--ds-text-danger, ".concat(R500, ")")
8
7
  });
9
8
  export default function RequiredIndicator() {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/checkbox",
3
- "version": "12.4.1",
3
+ "version": "12.4.2",
4
4
  "sideEffects": false
5
5
  }
@@ -1,4 +1,4 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx } from '@emotion/react';
3
3
  import { LabelProps } from '../types';
4
- export default function Label({ children, isDisabled, testId, onClick, id, }: LabelProps): jsx.JSX.Element;
4
+ export default function Label({ children, isDisabled, testId, onClick, label, id, }: LabelProps): jsx.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/checkbox",
3
- "version": "12.4.1",
3
+ "version": "12.4.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/"
@@ -70,6 +70,7 @@
70
70
  "ui-components": "lite-mode",
71
71
  "analytics": "analytics-next",
72
72
  "theming": "tokens",
73
+ "design-tokens": "spacing",
73
74
  "deprecation": "no-deprecated-imports",
74
75
  "styling": [
75
76
  "emotion",