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