@atlaskit/checkbox 13.3.0 → 13.4.0

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,13 @@
1
1
  # @atlaskit/checkbox
2
2
 
3
+ ## 13.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#103698](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/103698)
8
+ [`413b5201c8fe`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/413b5201c8fe) -
9
+ Introduce the bounded `xcss` prop.
10
+
3
11
  ## 13.3.0
4
12
 
5
13
  ### Minor Changes
@@ -2,8 +2,8 @@ import React from 'react';
2
2
 
3
3
  import { fireEvent } from '@testing-library/react';
4
4
  import {
5
- InteractionTaskArgs,
6
- PublicInteractionTask,
5
+ type InteractionTaskArgs,
6
+ type PublicInteractionTask,
7
7
  } from 'storybook-addon-performance';
8
8
 
9
9
  import { Checkbox } from '../src';
@@ -1,6 +1,7 @@
1
- import core, {
1
+ import type {
2
2
  API,
3
3
  ASTPath,
4
+ default as core,
4
5
  FileInfo,
5
6
  ImportDeclaration,
6
7
  ImportDefaultSpecifier,
@@ -10,7 +11,7 @@ import core, {
10
11
  Program,
11
12
  VariableDeclaration,
12
13
  } from 'jscodeshift';
13
- import { Collection } from 'jscodeshift/src/Collection';
14
+ import { type Collection } from 'jscodeshift/src/Collection';
14
15
 
15
16
  export type Nullable<T> = T | null;
16
17
 
@@ -14,7 +14,7 @@ var _usePlatformLeafEventHandler = require("@atlaskit/analytics-next/usePlatform
14
14
  var _mergeRefs = _interopRequireDefault(require("@atlaskit/ds-lib/merge-refs"));
15
15
  var _colors = require("@atlaskit/theme/colors");
16
16
  var _internal = require("./internal");
17
- var _excluded = ["isChecked", "isDisabled", "isInvalid", "defaultChecked", "isIndeterminate", "size", "onChange", "analyticsContext", "label", "name", "value", "isRequired", "testId"];
17
+ var _excluded = ["isChecked", "isDisabled", "isInvalid", "defaultChecked", "isIndeterminate", "size", "onChange", "analyticsContext", "label", "name", "value", "isRequired", "testId", "xcss"];
18
18
  /** @jsx jsx */
19
19
  /* eslint-disable @atlaskit/design-system/no-nested-styles */
20
20
  var checkboxStyles = (0, _react2.css)({
@@ -146,6 +146,7 @@ var Checkbox = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
146
146
  value = props.value,
147
147
  isRequired = props.isRequired,
148
148
  testId = props.testId,
149
+ xcss = props.xcss,
149
150
  rest = (0, _objectWithoutProperties2.default)(props, _excluded);
150
151
  var _useState = (0, _react.useState)(isCheckedProp !== undefined ? isCheckedProp : defaultChecked),
151
152
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -163,7 +164,7 @@ var Checkbox = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
163
164
  analyticsData: analyticsContext,
164
165
  componentName: 'checkbox',
165
166
  packageName: "@atlaskit/checkbox",
166
- packageVersion: "13.3.0"
167
+ packageVersion: "13.4.0"
167
168
  });
168
169
  var internalRef = (0, _react.useRef)(null);
169
170
  var mergedRefs = (0, _mergeRefs.default)([internalRef, ref]);
@@ -175,6 +176,11 @@ var Checkbox = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
175
176
  label: label,
176
177
  id: rest.id ? "".concat(rest.id, "-label") : undefined,
177
178
  testId: testId && "".concat(testId, "--checkbox-label")
179
+ // Currently the rule hasn't been updated to enable "allowed" dynamic pass-throughs.
180
+ // When there is more usage of this pattern we'll update the lint rule.
181
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
182
+ ,
183
+ xcss: xcss
178
184
  }, (0, _react2.jsx)("input", (0, _extends2.default)({
179
185
  // It is necessary only for Safari. It allows to render focus styles.
180
186
  tabIndex: 0
@@ -59,8 +59,12 @@ function Label(_ref) {
59
59
  isDisabled = _ref.isDisabled,
60
60
  testId = _ref.testId,
61
61
  label = _ref.label,
62
- id = _ref.id;
62
+ id = _ref.id,
63
+ xcss = _ref.xcss;
63
64
  return (0, _react.jsx)("label", {
65
+ // Because we're using Emotion local jsx namespace we have to coerce xcss prop to a string.
66
+ // When we're fully on Compiled its local jsx namespace accepts the output of xcss prop.
67
+ className: xcss,
64
68
  css: [baseStyles, label && textLabelLayoutStyles, isDisabled && disabledStyles, labelStyles],
65
69
  "data-testid": testId,
66
70
  "data-disabled": isDisabled || undefined,
@@ -132,6 +132,7 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Checkbox(pr
132
132
  value,
133
133
  isRequired,
134
134
  testId,
135
+ xcss,
135
136
  ...rest
136
137
  } = props;
137
138
  const [isCheckedState, setIsCheckedState] = useState(isCheckedProp !== undefined ? isCheckedProp : defaultChecked);
@@ -147,7 +148,7 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Checkbox(pr
147
148
  analyticsData: analyticsContext,
148
149
  componentName: 'checkbox',
149
150
  packageName: "@atlaskit/checkbox",
150
- packageVersion: "13.3.0"
151
+ packageVersion: "13.4.0"
151
152
  });
152
153
  const internalRef = useRef(null);
153
154
  const mergedRefs = mergeRefs([internalRef, ref]);
@@ -159,6 +160,11 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Checkbox(pr
159
160
  label: label,
160
161
  id: rest.id ? `${rest.id}-label` : undefined,
161
162
  testId: testId && `${testId}--checkbox-label`
163
+ // Currently the rule hasn't been updated to enable "allowed" dynamic pass-throughs.
164
+ // When there is more usage of this pattern we'll update the lint rule.
165
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
166
+ ,
167
+ xcss: xcss
162
168
  }, jsx("input", _extends({
163
169
  // It is necessary only for Safari. It allows to render focus styles.
164
170
  tabIndex: 0
@@ -52,9 +52,13 @@ export default function Label({
52
52
  isDisabled,
53
53
  testId,
54
54
  label,
55
- id
55
+ id,
56
+ xcss
56
57
  }) {
57
58
  return jsx("label", {
59
+ // Because we're using Emotion local jsx namespace we have to coerce xcss prop to a string.
60
+ // When we're fully on Compiled its local jsx namespace accepts the output of xcss prop.
61
+ className: xcss,
58
62
  css: [baseStyles, label && textLabelLayoutStyles, isDisabled && disabledStyles, labelStyles],
59
63
  "data-testid": testId,
60
64
  "data-disabled": isDisabled || undefined,
@@ -1,7 +1,7 @@
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
+ var _excluded = ["isChecked", "isDisabled", "isInvalid", "defaultChecked", "isIndeterminate", "size", "onChange", "analyticsContext", "label", "name", "value", "isRequired", "testId", "xcss"];
5
5
  /** @jsx jsx */
6
6
  import { forwardRef, memo, useCallback, useRef, useState } from 'react';
7
7
  import { css, jsx } from '@emotion/react';
@@ -139,6 +139,7 @@ var Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Checkbox(prop
139
139
  value = props.value,
140
140
  isRequired = props.isRequired,
141
141
  testId = props.testId,
142
+ xcss = props.xcss,
142
143
  rest = _objectWithoutProperties(props, _excluded);
143
144
  var _useState = useState(isCheckedProp !== undefined ? isCheckedProp : defaultChecked),
144
145
  _useState2 = _slicedToArray(_useState, 2),
@@ -156,7 +157,7 @@ var Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Checkbox(prop
156
157
  analyticsData: analyticsContext,
157
158
  componentName: 'checkbox',
158
159
  packageName: "@atlaskit/checkbox",
159
- packageVersion: "13.3.0"
160
+ packageVersion: "13.4.0"
160
161
  });
161
162
  var internalRef = useRef(null);
162
163
  var mergedRefs = mergeRefs([internalRef, ref]);
@@ -168,6 +169,11 @@ var Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Checkbox(prop
168
169
  label: label,
169
170
  id: rest.id ? "".concat(rest.id, "-label") : undefined,
170
171
  testId: testId && "".concat(testId, "--checkbox-label")
172
+ // Currently the rule hasn't been updated to enable "allowed" dynamic pass-throughs.
173
+ // When there is more usage of this pattern we'll update the lint rule.
174
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
175
+ ,
176
+ xcss: xcss
171
177
  }, jsx("input", _extends({
172
178
  // It is necessary only for Safari. It allows to render focus styles.
173
179
  tabIndex: 0
@@ -52,8 +52,12 @@ export default function Label(_ref) {
52
52
  isDisabled = _ref.isDisabled,
53
53
  testId = _ref.testId,
54
54
  label = _ref.label,
55
- id = _ref.id;
55
+ id = _ref.id,
56
+ xcss = _ref.xcss;
56
57
  return jsx("label", {
58
+ // Because we're using Emotion local jsx namespace we have to coerce xcss prop to a string.
59
+ // When we're fully on Compiled its local jsx namespace accepts the output of xcss prop.
60
+ className: xcss,
57
61
  css: [baseStyles, label && textLabelLayoutStyles, isDisabled && disabledStyles, labelStyles],
58
62
  "data-testid": testId,
59
63
  "data-disabled": isDisabled || undefined,
@@ -1,4 +1,4 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx } from '@emotion/react';
3
- import { LabelTextProps } from '../types';
3
+ import { type LabelTextProps } from '../types';
4
4
  export default function LabelText({ children }: LabelTextProps): jsx.JSX.Element;
@@ -1,4 +1,4 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx } from '@emotion/react';
3
- import { LabelProps } from '../types';
4
- export default function Label({ children, isDisabled, testId, label, id, }: LabelProps): jsx.JSX.Element;
3
+ import { type LabelProps } from '../types';
4
+ export default function Label({ children, isDisabled, testId, label, id, xcss, }: LabelProps): jsx.JSX.Element;
@@ -1,5 +1,6 @@
1
- import React from 'react';
1
+ import type React from 'react';
2
2
  import type UIAnalyticsEvent from '@atlaskit/analytics-next/UIAnalyticsEvent';
3
+ import { type StrictXCSSProp } from '@atlaskit/css';
3
4
  export type Size = 'small' | 'medium' | 'large' | 'xlarge';
4
5
  /**
5
6
  *
@@ -70,6 +71,11 @@ export type OwnProps = {
70
71
  * Additional information to be included in the `context` of analytics events that come from radio.
71
72
  */
72
73
  analyticsContext?: Record<string, any>;
74
+ /**
75
+ * Bounded style API. Defining allowed styles through this prop will be supported for future component
76
+ * iterations. Any styles that are not allowed by this API will result in type and land blocking violations.
77
+ */
78
+ xcss?: StrictXCSSProp<'alignItems', never>;
73
79
  };
74
80
  type Combine<First, Second> = Omit<First, keyof Second> & Second;
75
81
  export type CheckboxProps = Combine<Omit<React.InputHTMLAttributes<HTMLInputElement>,
@@ -99,5 +105,10 @@ export interface LabelProps extends React.HTMLProps<HTMLInputElement> {
99
105
  * as Firefox does not dispatch modified click events (e.g. Ctrl+Click) down to the underlying input element.
100
106
  */
101
107
  onClick?: React.MouseEventHandler;
108
+ /**
109
+ * Bounded style overrides. Defining allowed styles through this prop will be supported for future component
110
+ * iterations. Any styles that are not allowed by this API will result in type and land blocking violations.
111
+ */
112
+ xcss?: StrictXCSSProp<'alignItems', never>;
102
113
  }
103
114
  export {};
@@ -1,4 +1,4 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx } from '@emotion/react';
3
- import { LabelTextProps } from '../types';
3
+ import { type LabelTextProps } from '../types';
4
4
  export default function LabelText({ children }: LabelTextProps): jsx.JSX.Element;
@@ -1,4 +1,4 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx } from '@emotion/react';
3
- import { LabelProps } from '../types';
4
- export default function Label({ children, isDisabled, testId, label, id, }: LabelProps): jsx.JSX.Element;
3
+ import { type LabelProps } from '../types';
4
+ export default function Label({ children, isDisabled, testId, label, id, xcss, }: LabelProps): jsx.JSX.Element;
@@ -1,5 +1,6 @@
1
- import React from 'react';
1
+ import type React from 'react';
2
2
  import type UIAnalyticsEvent from '@atlaskit/analytics-next/UIAnalyticsEvent';
3
+ import { type StrictXCSSProp } from '@atlaskit/css';
3
4
  export type Size = 'small' | 'medium' | 'large' | 'xlarge';
4
5
  /**
5
6
  *
@@ -70,6 +71,11 @@ export type OwnProps = {
70
71
  * Additional information to be included in the `context` of analytics events that come from radio.
71
72
  */
72
73
  analyticsContext?: Record<string, any>;
74
+ /**
75
+ * Bounded style API. Defining allowed styles through this prop will be supported for future component
76
+ * iterations. Any styles that are not allowed by this API will result in type and land blocking violations.
77
+ */
78
+ xcss?: StrictXCSSProp<'alignItems', never>;
73
79
  };
74
80
  type Combine<First, Second> = Omit<First, keyof Second> & Second;
75
81
  export type CheckboxProps = Combine<Omit<React.InputHTMLAttributes<HTMLInputElement>,
@@ -99,5 +105,10 @@ export interface LabelProps extends React.HTMLProps<HTMLInputElement> {
99
105
  * as Firefox does not dispatch modified click events (e.g. Ctrl+Click) down to the underlying input element.
100
106
  */
101
107
  onClick?: React.MouseEventHandler;
108
+ /**
109
+ * Bounded style overrides. Defining allowed styles through this prop will be supported for future component
110
+ * iterations. Any styles that are not allowed by this API will result in type and land blocking violations.
111
+ */
112
+ xcss?: StrictXCSSProp<'alignItems', never>;
102
113
  }
103
114
  export {};
@@ -1,4 +1,4 @@
1
- import { OwnProps } from '../src/types';
1
+ import { type OwnProps } from '../src/types';
2
2
 
3
3
  export default function CheckboxProps(props: OwnProps) {
4
4
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/checkbox",
3
- "version": "13.3.0",
3
+ "version": "13.4.0",
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/"
@@ -39,10 +39,11 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@atlaskit/analytics-next": "^9.3.0",
42
+ "@atlaskit/css": "^0.1.0",
42
43
  "@atlaskit/ds-lib": "^2.3.0",
43
- "@atlaskit/icon": "^22.1.0",
44
- "@atlaskit/theme": "^12.7.0",
45
- "@atlaskit/tokens": "^1.45.0",
44
+ "@atlaskit/icon": "^22.3.0",
45
+ "@atlaskit/theme": "^12.8.0",
46
+ "@atlaskit/tokens": "^1.49.0",
46
47
  "@babel/runtime": "^7.0.0",
47
48
  "@emotion/react": "^11.7.1"
48
49
  },
@@ -53,6 +54,7 @@
53
54
  "@af/accessibility-testing": "*",
54
55
  "@af/integration-testing": "*",
55
56
  "@af/visual-regression": "*",
57
+ "@atlaskit/primitives": "^6.3.0",
56
58
  "@atlaskit/ssr": "*",
57
59
  "@atlaskit/visual-regression": "*",
58
60
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",