@atlaskit/checkbox 12.3.4 → 12.3.8

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.
Files changed (54) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/codemods/{12.0.0-lite-mode.ts → 12.0.0-lite-mode.tsx} +1 -1
  3. package/codemods/__tests__/{12.0.0-lite-mode.ts → 12.0.0-lite-mode.tsx} +0 -0
  4. package/codemods/migrations/{remove-imports.ts → remove-imports.tsx} +0 -0
  5. package/codemods/migrations/{remove-props.ts → remove-props.tsx} +0 -0
  6. package/codemods/migrations/{rename-import.ts → rename-import.tsx} +0 -0
  7. package/codemods/migrations/{rename-inputRef-to-ref.ts → rename-input-ref-to-ref.tsx} +0 -0
  8. package/codemods/{utils.ts → utils.tsx} +0 -0
  9. package/dist/cjs/checkbox.js +121 -75
  10. package/dist/cjs/index.js +5 -9
  11. package/dist/cjs/internal/checkbox-icon.js +73 -0
  12. package/dist/cjs/internal/constants.js +13 -0
  13. package/dist/cjs/internal/index.js +3 -3
  14. package/dist/cjs/internal/label-text.js +6 -9
  15. package/dist/cjs/internal/label.js +87 -25
  16. package/dist/cjs/internal/required-indicator.js +10 -15
  17. package/dist/cjs/internal/theme.js +65 -0
  18. package/dist/cjs/version.json +1 -1
  19. package/dist/es2019/checkbox.js +119 -66
  20. package/dist/es2019/index.js +1 -1
  21. package/dist/es2019/internal/checkbox-icon.js +60 -0
  22. package/dist/es2019/internal/constants.js +3 -0
  23. package/dist/es2019/internal/index.js +1 -1
  24. package/dist/es2019/internal/label-text.js +7 -8
  25. package/dist/es2019/internal/label.js +82 -15
  26. package/dist/es2019/internal/required-indicator.js +11 -13
  27. package/dist/es2019/internal/theme.js +56 -0
  28. package/dist/es2019/version.json +1 -1
  29. package/dist/esm/checkbox.js +121 -71
  30. package/dist/esm/index.js +1 -1
  31. package/dist/esm/internal/checkbox-icon.js +61 -0
  32. package/dist/esm/internal/constants.js +3 -0
  33. package/dist/esm/internal/index.js +1 -1
  34. package/dist/esm/internal/label-text.js +7 -8
  35. package/dist/esm/internal/label.js +85 -21
  36. package/dist/esm/internal/required-indicator.js +11 -13
  37. package/dist/esm/internal/theme.js +56 -0
  38. package/dist/esm/version.json +1 -1
  39. package/dist/types/checkbox.d.ts +11 -19
  40. package/dist/types/index.d.ts +1 -1
  41. package/dist/types/internal/checkbox-icon.d.ts +16 -0
  42. package/dist/types/internal/constants.d.ts +2 -0
  43. package/dist/types/internal/index.d.ts +1 -1
  44. package/dist/types/internal/label-text.d.ts +1 -4
  45. package/dist/types/internal/label.d.ts +1 -2
  46. package/dist/types/internal/required-indicator.d.ts +2 -2
  47. package/dist/types/internal/theme.d.ts +55 -0
  48. package/dist/types/types.d.ts +51 -63
  49. package/extract-react-types/checkbox-props.tsx +2 -2
  50. package/package.json +14 -11
  51. package/dist/cjs/internal/styles.js +0 -85
  52. package/dist/es2019/internal/styles.js +0 -226
  53. package/dist/esm/internal/styles.js +0 -72
  54. package/dist/types/internal/styles.d.ts +0 -3
@@ -1,63 +1,131 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
+ var _excluded = ["isChecked", "isDisabled", "isInvalid", "defaultChecked", "isIndeterminate", "size", "onChange", "analyticsContext", "label", "name", "value", "isRequired", "testId"];
4
5
 
5
6
  /** @jsx jsx */
6
- import { forwardRef, memo, useCallback, useMemo, useRef, useState } from 'react';
7
- import { jsx } from '@emotion/core';
7
+ import { forwardRef, memo, useCallback, useRef, useState } from 'react';
8
+ import { css, jsx } from '@emotion/core';
8
9
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
9
- import mergeRefs from '@atlaskit/ds-lib/merge-refs'; // eslint-disable-next-line @atlassian/tangerine/import/entry-points
10
-
11
- import PrimitiveSVGIcon from '@atlaskit/icon/svg';
12
- import GlobalTheme from '@atlaskit/theme/components';
13
- import { getCheckboxStyles, Label, LabelText, RequiredIndicator } from './internal';
10
+ import mergeRefs from '@atlaskit/ds-lib/merge-refs';
11
+ import { CheckboxIcon, Label, LabelText, RequiredIndicator } from './internal';
14
12
  // firefox doesn't handle cmd+click/ctrl+click properly
15
13
  var isFirefox = typeof navigator !== 'undefined' && navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
14
+ /* eslint-disable @repo/internal/styles/no-nested-styles */
16
15
 
17
- function getIcon(isIndeterminate, isChecked) {
18
- if (isIndeterminate) {
19
- return jsx("rect", {
20
- fill: "inherit",
21
- x: "8",
22
- y: "11",
23
- width: "8",
24
- height: "2",
25
- rx: "1"
26
- });
27
- }
28
-
29
- if (isChecked) {
30
- return jsx("path", {
31
- d: "M9.707 11.293a1 1 0 1 0-1.414 1.414l2 2a1 1 0 0 0 1.414 0l4-4a1 1 0 1 0-1.414-1.414L11 12.586l-1.293-1.293z",
32
- fill: "inherit"
33
- });
34
- } // No icon
16
+ var checkboxStyles = css({
17
+ width: 0,
18
+ // Necessary to hide correctly on mobile Safari
19
+ height: 0,
20
+ // Necessary to hide correctly on mobile Safari
21
+ margin: 0,
22
+ appearance: 'none',
23
+ border: 'none',
24
+ // Necessary to hide correctly on mobile Safari
25
+ outline: 'none',
26
+ // Necessary to hide focus ring on Firefox
27
+ '& + svg': {
28
+ flexShrink: 0,
29
+ alignSelf: 'flex-start',
35
30
 
31
+ /**
32
+ * Change the variables --checkbox-background-color, --checkbox-border-color
33
+ * and --checkbox-tick-color according to user interactions.
34
+ * All other variables are constant.
35
+ * All styles from the input target the sibling svg.
36
+ */
37
+ '--checkbox-background-color': 'var(--local-background)',
38
+ '--checkbox-border-color': 'var(--local-border)',
39
+ '--checkbox-tick-color': 'var(--local-tick-rest)',
40
+ color: 'var(--checkbox-background-color)',
41
+ fill: 'var(--checkbox-tick-color)',
42
+ transition: 'color 0.2s ease-in-out, fill 0.2s ease-in-out',
43
+ 'rect:first-of-type': {
44
+ stroke: 'var(--checkbox-border-color)',
45
+ strokeWidth: 2,
46
+ transition: 'stroke 0.2s ease-in-out'
47
+ }
48
+ },
49
+ '&&:focus + svg, &&:checked:focus + svg': {
50
+ '--checkbox-border-color': 'var(--local-border-focus)'
51
+ },
52
+ '&:hover + svg': {
53
+ '--checkbox-background-color': 'var(--local-background-hover)',
54
+ '--checkbox-border-color': 'var(--local-border-hover)'
55
+ },
56
+ '&:checked:hover + svg': {
57
+ '--checkbox-background-color': 'var(--local-background-checked-hover)',
58
+ '--checkbox-border-color': 'var(--local-border-checked-hover)'
59
+ },
60
+ '&:checked + svg': {
61
+ '--checkbox-background-color': 'var(--local-background-checked)',
62
+ '--checkbox-border-color': 'var(--local-border-checked)',
63
+ '--checkbox-tick-color': 'var(--local-tick-checked)'
64
+ },
65
+ '&[data-invalid] + svg': {
66
+ '--checkbox-border-color': 'var(--local-border-invalid)'
67
+ },
68
+ '&:checked[data-invalid] + svg': {
69
+ '--checkbox-border-color': 'var(--local-border-checked-invalid)'
70
+ },
71
+ '&:active + svg': {
72
+ '--checkbox-background-color': 'var(--local-background-active)',
73
+ '--checkbox-border-color': 'var(--local-border-active)'
74
+ },
75
+ '&:checked:active + svg': {
76
+ '--checkbox-background-color': 'var(--local-background-active)',
77
+ '--checkbox-border-color': 'var(--local-border-active)',
78
+ '--checkbox-tick-color': 'var(--local-tick-active)'
79
+ },
80
+ '&:disabled + svg, &:disabled:hover + svg, &:disabled:focus + svg, &:disabled:active + svg, &:disabled[data-invalid] + svg': {
81
+ '--checkbox-background-color': 'var(--local-background-disabled)',
82
+ '--checkbox-border-color': 'var(--local-border-disabled)',
83
+ cursor: 'not-allowed',
84
+ pointerEvents: 'none'
85
+ },
86
+ '&:disabled:checked + svg': {
87
+ '--checkbox-tick-color': 'var(--local-tick-disabled)'
88
+ },
89
+ '@media screen and (forced-colors: active)': {
90
+ '& + svg': {
91
+ '--checkbox-background-color': 'Canvas',
92
+ '--checkbox-border-color': 'CanvasText',
93
+ '--checkbox-tick-color': 'CanvasText'
94
+ },
95
+ '&:checked + svg, &:checked:hover + svg': {
96
+ '--checkbox-background-color': 'Canvas',
97
+ '--checkbox-border-color': 'CanvasText',
98
+ '--checkbox-tick-color': 'CanvasText'
99
+ },
100
+ '&:focus + svg rect:first-of-type': {
101
+ stroke: 'Highlight'
102
+ },
103
+ '&[data-invalid] + svg': {
104
+ '--checkbox-border-color': 'Highlight'
105
+ },
106
+ '&:checked[data-invalid] + svg': {
107
+ '--checkbox-border-color': 'Highlight'
108
+ },
109
+ '&:disabled + svg, &:disabled:hover + svg, &:disabled:focus + svg, &:disabled:active + svg, &:disabled[data-invalid] + svg': {
110
+ '--checkbox-background-color': 'Canvas',
111
+ '--checkbox-border-color': 'GrayText',
112
+ '--checkbox-tick-color': 'GrayText'
113
+ }
114
+ }
115
+ });
116
+ /* eslint-enable @repo/internal/styles/no-nested-styles */
36
117
 
37
- return null;
38
- }
118
+ /**
119
+ * __Checkbox__
120
+ *
121
+ * A checkbox an input control that allows a user to select one or more options from a number of choices.
122
+ *
123
+ * - [Examples](https://atlassian.design/components/checkbox/examples)
124
+ * - [Code](https://atlassian.design/components/checkbox/code)
125
+ * - [Usage](https://atlassian.design/components/checkbox/usage)
126
+ */
39
127
 
40
- var CheckboxIcon = /*#__PURE__*/memo(function (_ref) {
41
- var size = _ref.size,
42
- isIndeterminate = _ref.isIndeterminate,
43
- isChecked = _ref.isChecked;
44
- return jsx(PrimitiveSVGIcon, {
45
- label: "",
46
- size: size,
47
- primaryColor: "var(--checkbox-background-color)",
48
- secondaryColor: "var(--checkbox-tick-color)"
49
- }, jsx("g", {
50
- fillRule: "evenodd"
51
- }, jsx("rect", {
52
- fill: "currentColor",
53
- x: "6",
54
- y: "6",
55
- width: "12",
56
- height: "12",
57
- rx: "2"
58
- }), getIcon(isIndeterminate, isChecked)));
59
- });
60
- var CheckboxWithMode = /*#__PURE__*/forwardRef(function Checkbox(props, ref) {
128
+ var Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Checkbox(props, ref) {
61
129
  var isCheckedProp = props.isChecked,
62
130
  _props$isDisabled = props.isDisabled,
63
131
  isDisabled = _props$isDisabled === void 0 ? false : _props$isDisabled,
@@ -72,12 +140,11 @@ var CheckboxWithMode = /*#__PURE__*/forwardRef(function Checkbox(props, ref) {
72
140
  onChangeProps = props.onChange,
73
141
  analyticsContext = props.analyticsContext,
74
142
  label = props.label,
75
- mode = props.mode,
76
143
  name = props.name,
77
144
  value = props.value,
78
145
  isRequired = props.isRequired,
79
146
  testId = props.testId,
80
- rest = _objectWithoutProperties(props, ["isChecked", "isDisabled", "isInvalid", "defaultChecked", "isIndeterminate", "size", "onChange", "analyticsContext", "label", "mode", "name", "value", "isRequired", "testId"]);
147
+ rest = _objectWithoutProperties(props, _excluded);
81
148
 
82
149
  var _useState = useState(isCheckedProp !== undefined ? isCheckedProp : defaultChecked),
83
150
  _useState2 = _slicedToArray(_useState, 2),
@@ -97,7 +164,7 @@ var CheckboxWithMode = /*#__PURE__*/forwardRef(function Checkbox(props, ref) {
97
164
  analyticsData: analyticsContext,
98
165
  componentName: 'checkbox',
99
166
  packageName: "@atlaskit/checkbox",
100
- packageVersion: "12.3.4"
167
+ packageVersion: "12.3.8"
101
168
  });
102
169
  var internalRef = useRef(null);
103
170
  var mergedRefs = mergeRefs([internalRef, ref]); // firefox doesn't properly dispatch events from label to its child input elements
@@ -111,13 +178,7 @@ var CheckboxWithMode = /*#__PURE__*/forwardRef(function Checkbox(props, ref) {
111
178
  }; // Use isChecked from the state if it is controlled
112
179
 
113
180
 
114
- var isChecked = isCheckedProp === undefined ? isCheckedState : isCheckedProp; // The styles are being generated for the input but are being
115
- // applied to the svg with a sibling selector so we have access
116
- // to the pseudo-classes of the input
117
-
118
- var styles = useMemo(function () {
119
- return getCheckboxStyles(mode);
120
- }, [mode]);
181
+ var isChecked = isCheckedProp === undefined ? isCheckedState : isCheckedProp;
121
182
  return jsx(Label, {
122
183
  isDisabled: isDisabled,
123
184
  testId: testId && "".concat(testId, "--checkbox-label"),
@@ -130,7 +191,7 @@ var CheckboxWithMode = /*#__PURE__*/forwardRef(function Checkbox(props, ref) {
130
191
  value: value,
131
192
  name: name,
132
193
  required: isRequired,
133
- css: styles,
194
+ css: checkboxStyles,
134
195
  onChange: onChangeAnalytics,
135
196
  "aria-checked": isIndeterminate ? 'mixed' : isChecked,
136
197
  "aria-invalid": isInvalid ? 'true' : undefined,
@@ -140,18 +201,7 @@ var CheckboxWithMode = /*#__PURE__*/forwardRef(function Checkbox(props, ref) {
140
201
  size: size,
141
202
  isIndeterminate: isIndeterminate,
142
203
  isChecked: isChecked
143
- }), label && jsx(LabelText, null, label, isRequired && jsx(RequiredIndicator, {
144
- "aria-hidden": "true"
145
- })));
146
- });
147
- export var Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Checkbox(props, ref) {
148
- return jsx(GlobalTheme.Consumer, null, function (_ref2) {
149
- var mode = _ref2.mode;
150
- return jsx(CheckboxWithMode, _extends({}, props, {
151
- ref: ref,
152
- mode: mode
153
- }));
154
- });
204
+ }), label && jsx(LabelText, null, label, isRequired && jsx(RequiredIndicator, null)));
155
205
  }));
156
206
  Checkbox.displayName = 'Checkbox';
157
207
  export default Checkbox;
package/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // This allows you to import Checkbox as a default or named export
2
- export { default, Checkbox } from './checkbox';
2
+ export { default, default as Checkbox } from './checkbox';
@@ -0,0 +1,61 @@
1
+ /** @jsx jsx */
2
+ import { memo, useMemo } from 'react';
3
+ import { jsx } from '@emotion/core';
4
+ import PrimitiveSVGIcon from '@atlaskit/icon/svg';
5
+
6
+ function getIcon(isIndeterminate, isChecked) {
7
+ if (isIndeterminate) {
8
+ return jsx("rect", {
9
+ fill: "inherit",
10
+ x: "8",
11
+ y: "11",
12
+ width: "8",
13
+ height: "2",
14
+ rx: "1"
15
+ });
16
+ }
17
+
18
+ if (isChecked) {
19
+ return jsx("path", {
20
+ d: "M9.707 11.293a1 1 0 1 0-1.414 1.414l2 2a1 1 0 0 0 1.414 0l4-4a1 1 0 1 0-1.414-1.414L11 12.586l-1.293-1.293z",
21
+ fill: "inherit"
22
+ });
23
+ } // No icon
24
+
25
+
26
+ return null;
27
+ }
28
+ /**
29
+ * __Checkbox icon__
30
+ *
31
+ * A checkbox icon is the visual representation of checkbox state,
32
+ * which is shown instead of the native input.
33
+ *
34
+ * @internal
35
+ */
36
+
37
+
38
+ var CheckboxIcon = /*#__PURE__*/memo(function (_ref) {
39
+ var size = _ref.size,
40
+ isIndeterminate = _ref.isIndeterminate,
41
+ isChecked = _ref.isChecked;
42
+ var icon = useMemo(function () {
43
+ return getIcon(isIndeterminate, isChecked);
44
+ }, [isIndeterminate, isChecked]);
45
+ return jsx(PrimitiveSVGIcon, {
46
+ label: "",
47
+ size: size,
48
+ primaryColor: "var(--checkbox-background-color)",
49
+ secondaryColor: "var(--checkbox-tick-color)"
50
+ }, jsx("g", {
51
+ fillRule: "evenodd"
52
+ }, jsx("rect", {
53
+ fill: "currentColor",
54
+ x: "6",
55
+ y: "6",
56
+ width: "12",
57
+ height: "12",
58
+ rx: "2"
59
+ }), icon));
60
+ });
61
+ export default CheckboxIcon;
@@ -0,0 +1,3 @@
1
+ import { fontFamily as getFontFamily, gridSize as getGridSize } from '@atlaskit/theme/constants';
2
+ export var fontFamily = getFontFamily();
3
+ export var gridSize = getGridSize();
@@ -1,4 +1,4 @@
1
- export { default as getCheckboxStyles } from './styles';
1
+ export { default as CheckboxIcon } from './checkbox-icon';
2
2
  export { default as Label } from './label';
3
3
  export { default as LabelText } from './label-text';
4
4
  export { default as RequiredIndicator } from './required-indicator';
@@ -1,14 +1,13 @@
1
1
  /** @jsx jsx */
2
- import { jsx } from '@emotion/core';
3
- import { gridSize } from '@atlaskit/theme/constants';
4
- var padding = gridSize() * 0.5;
5
- export var labelTextCSS = {
6
- paddingRight: padding,
7
- paddingLeft: padding
8
- };
2
+ import { css, jsx } from '@emotion/core';
3
+ import { gridSize } from './constants';
4
+ var labelTextStyles = css({
5
+ paddingRight: 0.5 * gridSize,
6
+ paddingLeft: 0.5 * gridSize
7
+ });
9
8
  export default function LabelText(_ref) {
10
9
  var children = _ref.children;
11
10
  return jsx("span", {
12
- css: labelTextCSS
11
+ css: labelTextStyles
13
12
  }, children);
14
13
  }
@@ -1,33 +1,97 @@
1
1
  /** @jsx jsx */
2
- import { useMemo } from 'react';
3
- import { jsx } from '@emotion/core';
2
+ import { css, jsx } from '@emotion/core';
4
3
  import { N80, N900 } from '@atlaskit/theme/colors';
5
- import { fontFamily as getFontFamily } from '@atlaskit/theme/constants';
6
- import { token } from '@atlaskit/tokens';
7
- var fontFamily = getFontFamily();
8
- export var labelCSS = function labelCSS() {
9
- return {
10
- fontFamily: fontFamily,
11
- alignItems: 'center',
12
- display: 'flex',
13
- color: token('color.text.highEmphasis', N900),
14
- cursor: 'default',
15
- '&[data-disabled]': {
16
- color: token('color.text.disabled', N80),
17
- cursor: 'not-allowed'
18
- }
19
- };
4
+ import { useGlobalTheme } from '@atlaskit/theme/components';
5
+ import { fontFamily } from './constants';
6
+ import theme from './theme';
7
+ var labelStyles = css({
8
+ display: 'flex',
9
+ alignItems: 'center',
10
+ color: "var(--ds-text, ".concat(N900, ")"),
11
+ cursor: 'default',
12
+ fontFamily: fontFamily
13
+ });
14
+ var disabledStyles = css({
15
+ color: "var(--ds-text-disabled, ".concat(N80, ")"),
16
+ cursor: 'not-allowed'
17
+ });
18
+ var themeStyles = {
19
+ light: css({
20
+ /**
21
+ * Background
22
+ */
23
+ '--local-background': theme.light.boxColor.rest,
24
+ '--local-background-active': theme.light.boxColor.active,
25
+ '--local-background-checked': theme.light.boxColor.checked,
26
+ '--local-background-checked-hover': theme.light.boxColor.hoveredAndChecked,
27
+ '--local-background-disabled': theme.light.boxColor.disabled,
28
+ '--local-background-hover': theme.light.boxColor.hovered,
29
+
30
+ /**
31
+ * Border
32
+ */
33
+ '--local-border': theme.light.borderColor.rest,
34
+ '--local-border-active': theme.light.borderColor.active,
35
+ '--local-border-checked': theme.light.borderColor.checked,
36
+ '--local-border-checked-hover': theme.light.borderColor.hoveredAndChecked,
37
+ '--local-border-checked-invalid': theme.light.borderColor.invalidAndChecked,
38
+ '--local-border-disabled': theme.light.borderColor.disabled,
39
+ '--local-border-focus': theme.light.borderColor.focused,
40
+ '--local-border-hover': theme.light.borderColor.hovered,
41
+ '--local-border-invalid': theme.light.borderColor.invalid,
42
+
43
+ /**
44
+ * Tick
45
+ */
46
+ '--local-tick-active': theme.light.tickColor.activeAndChecked,
47
+ '--local-tick-checked': theme.light.tickColor.checked,
48
+ '--local-tick-disabled': theme.light.tickColor.disabledAndChecked,
49
+ '--local-tick-rest': 'transparent'
50
+ }),
51
+ dark: css({
52
+ /**
53
+ * Background
54
+ */
55
+ '--local-background': theme.dark.boxColor.rest,
56
+ '--local-background-active': theme.dark.boxColor.active,
57
+ '--local-background-checked': theme.dark.boxColor.checked,
58
+ '--local-background-checked-hover': theme.dark.boxColor.hoveredAndChecked,
59
+ '--local-background-disabled': theme.dark.boxColor.disabled,
60
+ '--local-background-hover': theme.dark.boxColor.hovered,
61
+
62
+ /**
63
+ * Border
64
+ */
65
+ '--local-border': theme.dark.borderColor.rest,
66
+ '--local-border-active': theme.dark.borderColor.active,
67
+ '--local-border-checked': theme.dark.borderColor.checked,
68
+ '--local-border-checked-hover': theme.dark.borderColor.hoveredAndChecked,
69
+ '--local-border-checked-invalid': theme.dark.borderColor.invalidAndChecked,
70
+ '--local-border-disabled': theme.dark.borderColor.disabled,
71
+ '--local-border-focus': theme.dark.borderColor.focused,
72
+ '--local-border-hover': theme.dark.borderColor.hovered,
73
+ '--local-border-invalid': theme.dark.borderColor.invalid,
74
+
75
+ /**
76
+ * Tick
77
+ */
78
+ '--local-tick-active': theme.dark.tickColor.activeAndChecked,
79
+ '--local-tick-checked': theme.dark.tickColor.checked,
80
+ '--local-tick-disabled': theme.dark.tickColor.disabledAndChecked,
81
+ '--local-tick-rest': 'transparent'
82
+ })
20
83
  };
21
84
  export default function Label(_ref) {
22
85
  var children = _ref.children,
23
86
  isDisabled = _ref.isDisabled,
24
87
  testId = _ref.testId,
25
88
  onClick = _ref.onClick;
26
- var styles = useMemo(function () {
27
- return labelCSS();
28
- }, []);
89
+
90
+ var _useGlobalTheme = useGlobalTheme(),
91
+ mode = _useGlobalTheme.mode;
92
+
29
93
  return jsx("label", {
30
- css: styles,
94
+ css: [labelStyles, isDisabled && disabledStyles, mode === 'light' && themeStyles.light, mode === 'dark' && themeStyles.dark],
31
95
  "data-testid": testId,
32
96
  "data-disabled": isDisabled || undefined,
33
97
  onClick: onClick
@@ -1,16 +1,14 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
-
3
1
  /** @jsx jsx */
4
- import { jsx } from '@emotion/core';
2
+ import { css, jsx } from '@emotion/core';
5
3
  import { R500 } from '@atlaskit/theme/colors';
6
- import { gridSize } from '@atlaskit/theme/constants';
7
- import { token } from '@atlaskit/tokens';
8
- var paddingLeft = "".concat(gridSize() * 0.25, "px");
9
- export default function RequiredIndicator(props) {
10
- return jsx("span", _extends({
11
- css: {
12
- color: token('color.text.danger', R500),
13
- paddingLeft: paddingLeft
14
- }
15
- }, props), "*");
4
+ import { gridSize } from './constants';
5
+ var requiredIndicatorStyles = css({
6
+ paddingLeft: gridSize * 0.25,
7
+ color: "var(--ds-text-danger, ".concat(R500, ")")
8
+ });
9
+ export default function RequiredIndicator() {
10
+ return jsx("span", {
11
+ css: requiredIndicatorStyles,
12
+ "aria-hidden": true
13
+ }, "*");
16
14
  }
@@ -0,0 +1,56 @@
1
+ import { B100, B200, B300, B400, B50, B75, DN10, DN200, DN30, DN80, DN90, N10, N20, N30, N40, N70, R300 } from '@atlaskit/theme/colors';
2
+ var theme = {
3
+ light: {
4
+ borderColor: {
5
+ rest: "var(--ds-border, ".concat(N40, ")"),
6
+ hovered: "var(--ds-border, ".concat(N40, ")"),
7
+ disabled: "var(--ds-background-disabled, ".concat(N20, ")"),
8
+ checked: "var(--ds-background-brand-bold, ".concat(B400, ")"),
9
+ active: "var(--ds-border, ".concat(B50, ")"),
10
+ invalid: "var(--ds-border-danger, ".concat(R300, ")"),
11
+ invalidAndChecked: "var(--ds-border-danger, ".concat(R300, ")"),
12
+ focused: "var(--ds-border-focused, ".concat(B100, ")"),
13
+ hoveredAndChecked: "var(--ds-background-brand-bold-hovered, ".concat(B300, ")")
14
+ },
15
+ boxColor: {
16
+ rest: "var(--ds-background-input, ".concat(N10, ")"),
17
+ hovered: "var(--ds-surface, ".concat(N30, ")"),
18
+ disabled: "var(--ds-background-disabled, ".concat(N20, ")"),
19
+ active: "var(--ds-background-input-pressed, ".concat(B50, ")"),
20
+ hoveredAndChecked: "var(--ds-background-brand-bold-hovered, ".concat(B300, ")"),
21
+ checked: "var(--ds-background-brand-bold, ".concat(B400, ")")
22
+ },
23
+ tickColor: {
24
+ disabledAndChecked: "var(--ds-text-disabled, ".concat(N70, ")"),
25
+ activeAndChecked: "var(--ds-text-inverse, ".concat(B400, ")"),
26
+ checked: "var(--ds-text-inverse, ".concat(N10, ")")
27
+ }
28
+ },
29
+ dark: {
30
+ borderColor: {
31
+ rest: "var(--ds-border, ".concat(DN80, ")"),
32
+ hovered: "var(--ds-border, ".concat(DN200, ")"),
33
+ disabled: "var(--ds-background-disabled, ".concat(DN10, ")"),
34
+ checked: "var(--ds-background-brand-bold, ".concat(B400, ")"),
35
+ active: "var(--ds-border, ".concat(B200, ")"),
36
+ invalid: "var(--ds-border-danger, ".concat(R300, ")"),
37
+ invalidAndChecked: "var(--ds-border-danger, ".concat(R300, ")"),
38
+ focused: "var(--ds-border-focused, ".concat(B75, ")"),
39
+ hoveredAndChecked: "var(--ds-background-brand-bold-hovered, ".concat(B75, ")")
40
+ },
41
+ boxColor: {
42
+ rest: "var(--ds-background-input, ".concat(DN10, ")"),
43
+ hovered: "var(--ds-surface, ".concat(DN30, ")"),
44
+ disabled: "var(--ds-background-disabled, ".concat(DN10, ")"),
45
+ active: "var(--ds-background-input-pressed, ".concat(B200, ")"),
46
+ hoveredAndChecked: "var(--ds-background-brand-bold-hovered, ".concat(B75, ")"),
47
+ checked: "var(--ds-background-brand-bold, ".concat(B400, ")")
48
+ },
49
+ tickColor: {
50
+ disabledAndChecked: "var(--ds-text-disabled, ".concat(DN90, ")"),
51
+ activeAndChecked: "var(--ds-text-inverse, ".concat(DN10, ")"),
52
+ checked: "var(--ds-text-inverse, ".concat(DN10, ")")
53
+ }
54
+ }
55
+ };
56
+ export default theme;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/checkbox",
3
- "version": "12.3.4",
3
+ "version": "12.3.8",
4
4
  "sideEffects": false
5
5
  }