@atlaskit/primitives 0.15.2 → 0.16.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,17 @@
1
1
  # @atlaskit/primitives
2
2
 
3
+ ## 0.16.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`fe3ef707163`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fe3ef707163) - Initial Pressable primitive (not ready for production)
8
+
9
+ ## 0.15.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [`27f6081edf2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/27f6081edf2) - Regenerates codegen hashes to surface changes to tokens
14
+
3
15
  ## 0.15.2
4
16
 
5
17
  ### Patch Changes
@@ -10,7 +10,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
10
10
  var _react = require("react");
11
11
  var _react2 = require("@emotion/react");
12
12
  var _styleMaps = require("../../xcss/style-maps.partial");
13
- var _excluded = ["as", "className", "children", "backgroundColor", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "style", "testId"];
13
+ var _excluded = ["as", "className", "children", "backgroundColor", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "style", "testId", "css"];
14
14
  /* eslint-disable @repo/internal/styles/no-exported-styles */
15
15
  /** @jsx jsx */
16
16
  // Without this type annotation on Box we don't get autocomplete for props due to forwardRef types
@@ -24,7 +24,8 @@ var _excluded = ["as", "className", "children", "backgroundColor", "padding", "p
24
24
  * @internal
25
25
  */
26
26
  var BaseBox = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
27
- var as = _ref.as,
27
+ var _ref$as = _ref.as,
28
+ as = _ref$as === void 0 ? 'div' : _ref$as,
28
29
  className = _ref.className,
29
30
  children = _ref.children,
30
31
  backgroundColor = _ref.backgroundColor,
@@ -37,8 +38,9 @@ var BaseBox = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
37
38
  paddingInlineEnd = _ref.paddingInlineEnd,
38
39
  style = _ref.style,
39
40
  testId = _ref.testId,
41
+ css = _ref.css,
40
42
  htmlAttributes = (0, _objectWithoutProperties2.default)(_ref, _excluded);
41
- var Component = as || 'div';
43
+ var Component = as;
42
44
  var node = (0, _react2.jsx)(Component, (0, _extends2.default)({
43
45
  style: style,
44
46
  ref: ref
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
+ var _react = require("react");
11
+ var _react2 = require("@emotion/react");
12
+ var _focusRing = _interopRequireDefault(require("@atlaskit/focus-ring"));
13
+ var _baseBox = _interopRequireDefault(require("./internal/base-box"));
14
+ var _excluded = ["children", "backgroundColor", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "isDisabled", "type", "testId"];
15
+ /** @jsx jsx */
16
+ var defaultStyles = (0, _react2.css)({
17
+ cursor: 'pointer'
18
+ });
19
+
20
+ /**
21
+ * __Pressable__
22
+ *
23
+ * A Pressable is a primitive component that renders a `<button>`.
24
+ *
25
+ * - [Examples](https://atlassian.design/components/primitives/pressable/examples)
26
+ * - [Code](https://atlassian.design/components/primitives/pressable/code)
27
+ * - [Usage](https://atlassian.design/components/primitives/pressable/usage)
28
+ */
29
+ var Pressable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
30
+ var children = _ref.children,
31
+ backgroundColor = _ref.backgroundColor,
32
+ padding = _ref.padding,
33
+ paddingBlock = _ref.paddingBlock,
34
+ paddingBlockStart = _ref.paddingBlockStart,
35
+ paddingBlockEnd = _ref.paddingBlockEnd,
36
+ paddingInline = _ref.paddingInline,
37
+ paddingInlineStart = _ref.paddingInlineStart,
38
+ paddingInlineEnd = _ref.paddingInlineEnd,
39
+ isDisabled = _ref.isDisabled,
40
+ _ref$type = _ref.type,
41
+ type = _ref$type === void 0 ? 'button' : _ref$type,
42
+ testId = _ref.testId,
43
+ htmlAttributes = (0, _objectWithoutProperties2.default)(_ref, _excluded);
44
+ return (0, _react2.jsx)(_focusRing.default, null, (0, _react2.jsx)(_baseBox.default, (0, _extends2.default)({}, htmlAttributes, {
45
+ ref: ref,
46
+ testId: testId,
47
+ type: type,
48
+ backgroundColor: backgroundColor,
49
+ padding: padding,
50
+ paddingBlock: paddingBlock,
51
+ paddingBlockStart: paddingBlockStart,
52
+ paddingBlockEnd: paddingBlockEnd,
53
+ paddingInline: paddingInline,
54
+ paddingInlineStart: paddingInlineStart,
55
+ paddingInlineEnd: paddingInlineEnd,
56
+ as: "button",
57
+ css: defaultStyles,
58
+ disabled: isDisabled
59
+ }), children));
60
+ });
61
+ var _default = Pressable;
62
+ exports.default = _default;
package/dist/cjs/index.js CHANGED
@@ -16,6 +16,12 @@ Object.defineProperty(exports, "Inline", {
16
16
  return _inline.default;
17
17
  }
18
18
  });
19
+ Object.defineProperty(exports, "Pressable", {
20
+ enumerable: true,
21
+ get: function get() {
22
+ return _pressable.default;
23
+ }
24
+ });
19
25
  Object.defineProperty(exports, "Stack", {
20
26
  enumerable: true,
21
27
  get: function get() {
@@ -41,6 +47,7 @@ Object.defineProperty(exports, "xcss", {
41
47
  }
42
48
  });
43
49
  var _box = _interopRequireDefault(require("./components/box"));
50
+ var _pressable = _interopRequireDefault(require("./components/pressable"));
44
51
  var _inline = _interopRequireDefault(require("./components/inline"));
45
52
  var _xcss = require("./xcss/xcss");
46
53
  var _stack = _interopRequireDefault(require("./components/stack"));
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "0.15.2",
3
+ "version": "0.16.0",
4
4
  "sideEffects": false
5
5
  }
@@ -60,11 +60,11 @@ exports.spaceMap = spaceMap;
60
60
 
61
61
  /**
62
62
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
63
- * @codegen <<SignedSource::80db0ba91b44837306516b95e9cf080e>>
63
+ * @codegen <<SignedSource::65b57f72ff07d4c4245a3eafe8cef786>>
64
64
  * @codegenId colors
65
65
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
66
66
  * @codegenParams ["border", "background", "shadow", "text", "fill"]
67
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::c829bed8504655cd09b971d338d7f3a1>>
67
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::efb3dfea27ab3db2fb3756ed9657c5cb>>
68
68
  */
69
69
  var borderColorMap = {
70
70
  'color.border': "var(--ds-border, #091e4221)",
@@ -303,17 +303,17 @@ exports.layerMap = layerMap;
303
303
 
304
304
  /**
305
305
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
306
- * @codegen <<SignedSource::cc9d48c89e323c87a3a00966f631120f>>
306
+ * @codegen <<SignedSource::ffa10f95df2d9bbc0f5d91f9d19b9a69>>
307
307
  * @codegenId border
308
308
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
309
309
  * @codegenParams ["width", "radius"]
310
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-shape.tsx <<SignedSource::f2aa6660594ff30e42a666fb87655052>>
310
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-shape.tsx <<SignedSource::25105916a589322f57c322068cb0074a>>
311
311
  */
312
312
  var borderWidthMap = {
313
313
  'border.width': "var(--ds-border-width, 1px)",
314
314
  'border.width.0': "var(--ds-border-width-0, 0px)",
315
- 'border.width.050': "var(--ds-border-width-050, 1px)",
316
- 'border.width.100': "var(--ds-border-width-100, 2px)"
315
+ 'border.width.indicator': "var(--ds-border-width-indicator, 3px)",
316
+ 'border.width.outline': "var(--ds-border-width-outline, 2px)"
317
317
  };
318
318
  exports.borderWidthMap = borderWidthMap;
319
319
  var borderRadiusMap = {
@@ -16,7 +16,7 @@ import { backgroundColorStylesMap, paddingStylesMap } from '../../xcss/style-map
16
16
  * @internal
17
17
  */
18
18
  export const BaseBox = /*#__PURE__*/forwardRef(({
19
- as,
19
+ as = 'div',
20
20
  className,
21
21
  children,
22
22
  backgroundColor,
@@ -29,9 +29,10 @@ export const BaseBox = /*#__PURE__*/forwardRef(({
29
29
  paddingInlineEnd,
30
30
  style,
31
31
  testId,
32
+ css,
32
33
  ...htmlAttributes
33
34
  }, ref) => {
34
- const Component = as || 'div';
35
+ const Component = as;
35
36
  const node = jsx(Component, _extends({
36
37
  style: style,
37
38
  ref: ref
@@ -0,0 +1,52 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ /** @jsx jsx */
3
+ import { forwardRef } from 'react';
4
+ import { css, jsx } from '@emotion/react';
5
+ import FocusRing from '@atlaskit/focus-ring';
6
+ import BaseBox from './internal/base-box';
7
+ const defaultStyles = css({
8
+ cursor: 'pointer'
9
+ });
10
+
11
+ /**
12
+ * __Pressable__
13
+ *
14
+ * A Pressable is a primitive component that renders a `<button>`.
15
+ *
16
+ * - [Examples](https://atlassian.design/components/primitives/pressable/examples)
17
+ * - [Code](https://atlassian.design/components/primitives/pressable/code)
18
+ * - [Usage](https://atlassian.design/components/primitives/pressable/usage)
19
+ */
20
+ const Pressable = /*#__PURE__*/forwardRef(({
21
+ children,
22
+ backgroundColor,
23
+ padding,
24
+ paddingBlock,
25
+ paddingBlockStart,
26
+ paddingBlockEnd,
27
+ paddingInline,
28
+ paddingInlineStart,
29
+ paddingInlineEnd,
30
+ isDisabled,
31
+ type = 'button',
32
+ testId,
33
+ ...htmlAttributes
34
+ }, ref) => {
35
+ return jsx(FocusRing, null, jsx(BaseBox, _extends({}, htmlAttributes, {
36
+ ref: ref,
37
+ testId: testId,
38
+ type: type,
39
+ backgroundColor: backgroundColor,
40
+ padding: padding,
41
+ paddingBlock: paddingBlock,
42
+ paddingBlockStart: paddingBlockStart,
43
+ paddingBlockEnd: paddingBlockEnd,
44
+ paddingInline: paddingInline,
45
+ paddingInlineStart: paddingInlineStart,
46
+ paddingInlineEnd: paddingInlineEnd,
47
+ as: "button",
48
+ css: defaultStyles,
49
+ disabled: isDisabled
50
+ }), children));
51
+ });
52
+ export default Pressable;
@@ -1,4 +1,5 @@
1
1
  export { default as Box } from './components/box';
2
+ export { default as Pressable } from './components/pressable';
2
3
  export { default as Inline } from './components/inline';
3
4
  export { xcss } from './xcss/xcss';
4
5
  export { default as Stack } from './components/stack';
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "0.15.2",
3
+ "version": "0.16.0",
4
4
  "sideEffects": false
5
5
  }
@@ -48,11 +48,11 @@ export const spaceMap = {
48
48
  */
49
49
  /**
50
50
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
51
- * @codegen <<SignedSource::80db0ba91b44837306516b95e9cf080e>>
51
+ * @codegen <<SignedSource::65b57f72ff07d4c4245a3eafe8cef786>>
52
52
  * @codegenId colors
53
53
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
54
54
  * @codegenParams ["border", "background", "shadow", "text", "fill"]
55
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::c829bed8504655cd09b971d338d7f3a1>>
55
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::efb3dfea27ab3db2fb3756ed9657c5cb>>
56
56
  */
57
57
  export const borderColorMap = {
58
58
  'color.border': "var(--ds-border, #091e4221)",
@@ -283,17 +283,17 @@ export const layerMap = {
283
283
  */
284
284
  /**
285
285
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
286
- * @codegen <<SignedSource::cc9d48c89e323c87a3a00966f631120f>>
286
+ * @codegen <<SignedSource::ffa10f95df2d9bbc0f5d91f9d19b9a69>>
287
287
  * @codegenId border
288
288
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
289
289
  * @codegenParams ["width", "radius"]
290
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-shape.tsx <<SignedSource::f2aa6660594ff30e42a666fb87655052>>
290
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-shape.tsx <<SignedSource::25105916a589322f57c322068cb0074a>>
291
291
  */
292
292
  export const borderWidthMap = {
293
293
  'border.width': "var(--ds-border-width, 1px)",
294
294
  'border.width.0': "var(--ds-border-width-0, 0px)",
295
- 'border.width.050': "var(--ds-border-width-050, 1px)",
296
- 'border.width.100': "var(--ds-border-width-100, 2px)"
295
+ 'border.width.indicator': "var(--ds-border-width-indicator, 3px)",
296
+ 'border.width.outline': "var(--ds-border-width-outline, 2px)"
297
297
  };
298
298
  export const borderRadiusMap = {
299
299
  'border.radius.050': "var(--ds-border-radius-050, 2px)",
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["as", "className", "children", "backgroundColor", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "style", "testId"];
3
+ var _excluded = ["as", "className", "children", "backgroundColor", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "style", "testId", "css"];
4
4
  /* eslint-disable @repo/internal/styles/no-exported-styles */
5
5
  /** @jsx jsx */
6
6
  import { forwardRef } from 'react';
@@ -18,7 +18,8 @@ import { backgroundColorStylesMap, paddingStylesMap } from '../../xcss/style-map
18
18
  * @internal
19
19
  */
20
20
  export var BaseBox = /*#__PURE__*/forwardRef(function (_ref, ref) {
21
- var as = _ref.as,
21
+ var _ref$as = _ref.as,
22
+ as = _ref$as === void 0 ? 'div' : _ref$as,
22
23
  className = _ref.className,
23
24
  children = _ref.children,
24
25
  backgroundColor = _ref.backgroundColor,
@@ -31,8 +32,9 @@ export var BaseBox = /*#__PURE__*/forwardRef(function (_ref, ref) {
31
32
  paddingInlineEnd = _ref.paddingInlineEnd,
32
33
  style = _ref.style,
33
34
  testId = _ref.testId,
35
+ css = _ref.css,
34
36
  htmlAttributes = _objectWithoutProperties(_ref, _excluded);
35
- var Component = as || 'div';
37
+ var Component = as;
36
38
  var node = jsx(Component, _extends({
37
39
  style: style,
38
40
  ref: ref
@@ -0,0 +1,54 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["children", "backgroundColor", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "isDisabled", "type", "testId"];
4
+ /** @jsx jsx */
5
+ import { forwardRef } from 'react';
6
+ import { css, jsx } from '@emotion/react';
7
+ import FocusRing from '@atlaskit/focus-ring';
8
+ import BaseBox from './internal/base-box';
9
+ var defaultStyles = css({
10
+ cursor: 'pointer'
11
+ });
12
+
13
+ /**
14
+ * __Pressable__
15
+ *
16
+ * A Pressable is a primitive component that renders a `<button>`.
17
+ *
18
+ * - [Examples](https://atlassian.design/components/primitives/pressable/examples)
19
+ * - [Code](https://atlassian.design/components/primitives/pressable/code)
20
+ * - [Usage](https://atlassian.design/components/primitives/pressable/usage)
21
+ */
22
+ var Pressable = /*#__PURE__*/forwardRef(function (_ref, ref) {
23
+ var children = _ref.children,
24
+ backgroundColor = _ref.backgroundColor,
25
+ padding = _ref.padding,
26
+ paddingBlock = _ref.paddingBlock,
27
+ paddingBlockStart = _ref.paddingBlockStart,
28
+ paddingBlockEnd = _ref.paddingBlockEnd,
29
+ paddingInline = _ref.paddingInline,
30
+ paddingInlineStart = _ref.paddingInlineStart,
31
+ paddingInlineEnd = _ref.paddingInlineEnd,
32
+ isDisabled = _ref.isDisabled,
33
+ _ref$type = _ref.type,
34
+ type = _ref$type === void 0 ? 'button' : _ref$type,
35
+ testId = _ref.testId,
36
+ htmlAttributes = _objectWithoutProperties(_ref, _excluded);
37
+ return jsx(FocusRing, null, jsx(BaseBox, _extends({}, htmlAttributes, {
38
+ ref: ref,
39
+ testId: testId,
40
+ type: type,
41
+ backgroundColor: backgroundColor,
42
+ padding: padding,
43
+ paddingBlock: paddingBlock,
44
+ paddingBlockStart: paddingBlockStart,
45
+ paddingBlockEnd: paddingBlockEnd,
46
+ paddingInline: paddingInline,
47
+ paddingInlineStart: paddingInlineStart,
48
+ paddingInlineEnd: paddingInlineEnd,
49
+ as: "button",
50
+ css: defaultStyles,
51
+ disabled: isDisabled
52
+ }), children));
53
+ });
54
+ export default Pressable;
package/dist/esm/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export { default as Box } from './components/box';
2
+ export { default as Pressable } from './components/pressable';
2
3
  export { default as Inline } from './components/inline';
3
4
  export { xcss } from './xcss/xcss';
4
5
  export { default as Stack } from './components/stack';
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "0.15.2",
3
+ "version": "0.16.0",
4
4
  "sideEffects": false
5
5
  }
@@ -49,11 +49,11 @@ export var spaceMap = {
49
49
  */
50
50
  /**
51
51
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
52
- * @codegen <<SignedSource::80db0ba91b44837306516b95e9cf080e>>
52
+ * @codegen <<SignedSource::65b57f72ff07d4c4245a3eafe8cef786>>
53
53
  * @codegenId colors
54
54
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
55
55
  * @codegenParams ["border", "background", "shadow", "text", "fill"]
56
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::c829bed8504655cd09b971d338d7f3a1>>
56
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::efb3dfea27ab3db2fb3756ed9657c5cb>>
57
57
  */
58
58
  export var borderColorMap = {
59
59
  'color.border': "var(--ds-border, #091e4221)",
@@ -284,17 +284,17 @@ export var layerMap = {
284
284
  */
285
285
  /**
286
286
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
287
- * @codegen <<SignedSource::cc9d48c89e323c87a3a00966f631120f>>
287
+ * @codegen <<SignedSource::ffa10f95df2d9bbc0f5d91f9d19b9a69>>
288
288
  * @codegenId border
289
289
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
290
290
  * @codegenParams ["width", "radius"]
291
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-shape.tsx <<SignedSource::f2aa6660594ff30e42a666fb87655052>>
291
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-shape.tsx <<SignedSource::25105916a589322f57c322068cb0074a>>
292
292
  */
293
293
  export var borderWidthMap = {
294
294
  'border.width': "var(--ds-border-width, 1px)",
295
295
  'border.width.0': "var(--ds-border-width-0, 0px)",
296
- 'border.width.050': "var(--ds-border-width-050, 1px)",
297
- 'border.width.100': "var(--ds-border-width-100, 2px)"
296
+ 'border.width.indicator': "var(--ds-border-width-indicator, 3px)",
297
+ 'border.width.outline': "var(--ds-border-width-outline, 2px)"
298
298
  };
299
299
  export var borderRadiusMap = {
300
300
  'border.radius.050': "var(--ds-border-radius-050, 2px)",
@@ -3,7 +3,7 @@ import { ComponentPropsWithoutRef, ElementType, FC, ReactElement, ReactNode } fr
3
3
  import { BackgroundColor, type Space } from '../../xcss/style-maps.partial';
4
4
  import type { BasePrimitiveProps } from '../types';
5
5
  export type BaseBoxProps<T extends ElementType = 'div'> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & BasePrimitiveProps & BaseBoxPropsFoundation<T>;
6
- export type As = 'article' | 'aside' | 'dialog' | 'div' | 'footer' | 'header' | 'li' | 'main' | 'nav' | 'ol' | 'section' | 'span' | 'ul';
6
+ export type As = 'article' | 'aside' | 'button' | 'dialog' | 'div' | 'footer' | 'header' | 'li' | 'main' | 'nav' | 'ol' | 'section' | 'span' | 'ul';
7
7
  type BaseBoxPropsFoundation<T extends ElementType = 'div'> = {
8
8
  /**
9
9
  * The DOM element to render as the Box. Defaults to `div`.
@@ -0,0 +1,23 @@
1
+ /** @jsx jsx */
2
+ import { type ReactElement, type ReactNode } from 'react';
3
+ import { type BaseBoxProps } from './internal/base-box';
4
+ export type PressableProps = Omit<BaseBoxProps<'button'>, 'disabled' | 'as' | 'children' | 'role' | 'style'> & {
5
+ /**
6
+ * `children` should be defined to ensure buttons are not empty,
7
+ * because they should have labels.
8
+ */
9
+ children: ReactNode;
10
+ isDisabled?: boolean;
11
+ };
12
+ type PressableComponent = (props: PressableProps, displayName: string) => ReactElement | null;
13
+ /**
14
+ * __Pressable__
15
+ *
16
+ * A Pressable is a primitive component that renders a `<button>`.
17
+ *
18
+ * - [Examples](https://atlassian.design/components/primitives/pressable/examples)
19
+ * - [Code](https://atlassian.design/components/primitives/pressable/code)
20
+ * - [Usage](https://atlassian.design/components/primitives/pressable/usage)
21
+ */
22
+ declare const Pressable: PressableComponent;
23
+ export default Pressable;
@@ -10,9 +10,11 @@ export type BasePrimitiveProps = {
10
10
  */
11
11
  style?: CSSProperties;
12
12
  };
13
+ type BoxXCSSArray = Array<BoxXCSSArray | BoxXCSS | false | undefined>;
13
14
  export type PublicBoxPropsBase = {
14
15
  /**
15
16
  * Safe subset of styles that can be applied as a classname.
16
17
  */
17
- xcss?: BoxXCSS | Array<BoxXCSS | false | undefined>;
18
+ xcss?: BoxXCSS | BoxXCSSArray;
18
19
  };
20
+ export {};
@@ -1,4 +1,5 @@
1
1
  export { default as Box, type BoxProps } from './components/box';
2
+ export { default as Pressable, type PressableProps, } from './components/pressable';
2
3
  export { default as Inline, type InlineProps } from './components/inline';
3
4
  export { xcss } from './xcss/xcss';
4
5
  export { default as Stack, type StackProps } from './components/stack';
@@ -50,11 +50,11 @@ export type Space = keyof typeof spaceMap;
50
50
  */
51
51
  /**
52
52
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
53
- * @codegen <<SignedSource::80db0ba91b44837306516b95e9cf080e>>
53
+ * @codegen <<SignedSource::65b57f72ff07d4c4245a3eafe8cef786>>
54
54
  * @codegenId colors
55
55
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
56
56
  * @codegenParams ["border", "background", "shadow", "text", "fill"]
57
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::c829bed8504655cd09b971d338d7f3a1>>
57
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::efb3dfea27ab3db2fb3756ed9657c5cb>>
58
58
  */
59
59
  export declare const borderColorMap: {
60
60
  readonly 'color.border': "var(--ds-border)";
@@ -291,17 +291,17 @@ export type Layer = keyof typeof layerMap;
291
291
  */
292
292
  /**
293
293
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
294
- * @codegen <<SignedSource::cc9d48c89e323c87a3a00966f631120f>>
294
+ * @codegen <<SignedSource::ffa10f95df2d9bbc0f5d91f9d19b9a69>>
295
295
  * @codegenId border
296
296
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
297
297
  * @codegenParams ["width", "radius"]
298
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-shape.tsx <<SignedSource::f2aa6660594ff30e42a666fb87655052>>
298
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-shape.tsx <<SignedSource::25105916a589322f57c322068cb0074a>>
299
299
  */
300
300
  export declare const borderWidthMap: {
301
301
  readonly 'border.width': "var(--ds-border-width)";
302
302
  readonly 'border.width.0': "var(--ds-border-width-0)";
303
- readonly 'border.width.050': "var(--ds-border-width-050)";
304
- readonly 'border.width.100': "var(--ds-border-width-100)";
303
+ readonly 'border.width.indicator': "var(--ds-border-width-indicator)";
304
+ readonly 'border.width.outline': "var(--ds-border-width-outline)";
305
305
  };
306
306
  export type BorderWidth = keyof typeof borderWidthMap;
307
307
  export declare const borderRadiusMap: {
@@ -11,7 +11,7 @@ declare const uniqueSymbol: unique symbol;
11
11
  * @returns a collection of styles that can be applied to the respective primitive
12
12
  */
13
13
  type ParsedXcss = ReturnType<typeof cssEmotion> | ReturnType<typeof cssEmotion>[];
14
- export declare const parseXcss: (args: XCSS | Array<XCSS | false | undefined>) => ParsedXcss;
14
+ export declare const parseXcss: (args: XCSS | XCSSArray) => ParsedXcss;
15
15
  type CSSMediaQueries = {
16
16
  [MQ in MediaQuery]?: Omit<SafeCSSObject, MediaQuery>;
17
17
  };
@@ -27,6 +27,7 @@ declare const inlineWrapper: (style: any) => {
27
27
  readonly [uniqueSymbol]: InlineStyles;
28
28
  };
29
29
  type XCSS = ReturnType<typeof boxWrapper> | ReturnType<typeof inlineWrapper>;
30
+ type XCSSArray = Array<XCSS | XCSSArray | false | undefined>;
30
31
  type AllowedBoxStyles = keyof SafeCSSObject;
31
32
  type Spacing = 'columnGap' | 'gap' | 'inset' | 'insetBlock' | 'insetBlockEnd' | 'insetBlockStart' | 'insetInline' | 'insetInlineEnd' | 'insetInlineStart' | 'margin' | 'marginBlock' | 'marginBlockEnd' | 'marginBlockStart' | 'marginInline' | 'marginInlineEnd' | 'marginInlineStart' | 'outlineOffset' | 'padding' | 'paddingBlock' | 'paddingBlockEnd' | 'paddingBlockStart' | 'paddingBottom' | 'paddingInline' | 'paddingInlineEnd' | 'paddingInlineStart' | 'paddingLeft' | 'paddingRight' | 'paddingTop' | 'rowGap';
32
33
  /**
@@ -3,7 +3,7 @@ import { ComponentPropsWithoutRef, ElementType, FC, ReactElement, ReactNode } fr
3
3
  import { BackgroundColor, type Space } from '../../xcss/style-maps.partial';
4
4
  import type { BasePrimitiveProps } from '../types';
5
5
  export type BaseBoxProps<T extends ElementType = 'div'> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & BasePrimitiveProps & BaseBoxPropsFoundation<T>;
6
- export type As = 'article' | 'aside' | 'dialog' | 'div' | 'footer' | 'header' | 'li' | 'main' | 'nav' | 'ol' | 'section' | 'span' | 'ul';
6
+ export type As = 'article' | 'aside' | 'button' | 'dialog' | 'div' | 'footer' | 'header' | 'li' | 'main' | 'nav' | 'ol' | 'section' | 'span' | 'ul';
7
7
  type BaseBoxPropsFoundation<T extends ElementType = 'div'> = {
8
8
  /**
9
9
  * The DOM element to render as the Box. Defaults to `div`.
@@ -0,0 +1,23 @@
1
+ /** @jsx jsx */
2
+ import { type ReactElement, type ReactNode } from 'react';
3
+ import { type BaseBoxProps } from './internal/base-box';
4
+ export type PressableProps = Omit<BaseBoxProps<'button'>, 'disabled' | 'as' | 'children' | 'role' | 'style'> & {
5
+ /**
6
+ * `children` should be defined to ensure buttons are not empty,
7
+ * because they should have labels.
8
+ */
9
+ children: ReactNode;
10
+ isDisabled?: boolean;
11
+ };
12
+ type PressableComponent = (props: PressableProps, displayName: string) => ReactElement | null;
13
+ /**
14
+ * __Pressable__
15
+ *
16
+ * A Pressable is a primitive component that renders a `<button>`.
17
+ *
18
+ * - [Examples](https://atlassian.design/components/primitives/pressable/examples)
19
+ * - [Code](https://atlassian.design/components/primitives/pressable/code)
20
+ * - [Usage](https://atlassian.design/components/primitives/pressable/usage)
21
+ */
22
+ declare const Pressable: PressableComponent;
23
+ export default Pressable;
@@ -10,9 +10,11 @@ export type BasePrimitiveProps = {
10
10
  */
11
11
  style?: CSSProperties;
12
12
  };
13
+ type BoxXCSSArray = Array<BoxXCSSArray | BoxXCSS | false | undefined>;
13
14
  export type PublicBoxPropsBase = {
14
15
  /**
15
16
  * Safe subset of styles that can be applied as a classname.
16
17
  */
17
- xcss?: BoxXCSS | Array<BoxXCSS | false | undefined>;
18
+ xcss?: BoxXCSS | BoxXCSSArray;
18
19
  };
20
+ export {};
@@ -1,4 +1,5 @@
1
1
  export { default as Box, type BoxProps } from './components/box';
2
+ export { default as Pressable, type PressableProps, } from './components/pressable';
2
3
  export { default as Inline, type InlineProps } from './components/inline';
3
4
  export { xcss } from './xcss/xcss';
4
5
  export { default as Stack, type StackProps } from './components/stack';
@@ -50,11 +50,11 @@ export type Space = keyof typeof spaceMap;
50
50
  */
51
51
  /**
52
52
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
53
- * @codegen <<SignedSource::80db0ba91b44837306516b95e9cf080e>>
53
+ * @codegen <<SignedSource::65b57f72ff07d4c4245a3eafe8cef786>>
54
54
  * @codegenId colors
55
55
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
56
56
  * @codegenParams ["border", "background", "shadow", "text", "fill"]
57
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::c829bed8504655cd09b971d338d7f3a1>>
57
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::efb3dfea27ab3db2fb3756ed9657c5cb>>
58
58
  */
59
59
  export declare const borderColorMap: {
60
60
  readonly 'color.border': "var(--ds-border)";
@@ -291,17 +291,17 @@ export type Layer = keyof typeof layerMap;
291
291
  */
292
292
  /**
293
293
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
294
- * @codegen <<SignedSource::cc9d48c89e323c87a3a00966f631120f>>
294
+ * @codegen <<SignedSource::ffa10f95df2d9bbc0f5d91f9d19b9a69>>
295
295
  * @codegenId border
296
296
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
297
297
  * @codegenParams ["width", "radius"]
298
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-shape.tsx <<SignedSource::f2aa6660594ff30e42a666fb87655052>>
298
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-shape.tsx <<SignedSource::25105916a589322f57c322068cb0074a>>
299
299
  */
300
300
  export declare const borderWidthMap: {
301
301
  readonly 'border.width': "var(--ds-border-width)";
302
302
  readonly 'border.width.0': "var(--ds-border-width-0)";
303
- readonly 'border.width.050': "var(--ds-border-width-050)";
304
- readonly 'border.width.100': "var(--ds-border-width-100)";
303
+ readonly 'border.width.indicator': "var(--ds-border-width-indicator)";
304
+ readonly 'border.width.outline': "var(--ds-border-width-outline)";
305
305
  };
306
306
  export type BorderWidth = keyof typeof borderWidthMap;
307
307
  export declare const borderRadiusMap: {
@@ -11,7 +11,7 @@ declare const uniqueSymbol: unique symbol;
11
11
  * @returns a collection of styles that can be applied to the respective primitive
12
12
  */
13
13
  type ParsedXcss = ReturnType<typeof cssEmotion> | ReturnType<typeof cssEmotion>[];
14
- export declare const parseXcss: (args: XCSS | Array<XCSS | false | undefined>) => ParsedXcss;
14
+ export declare const parseXcss: (args: XCSS | XCSSArray) => ParsedXcss;
15
15
  type CSSMediaQueries = {
16
16
  [MQ in MediaQuery]?: Omit<SafeCSSObject, MediaQuery>;
17
17
  };
@@ -27,6 +27,7 @@ declare const inlineWrapper: (style: any) => {
27
27
  readonly [uniqueSymbol]: InlineStyles;
28
28
  };
29
29
  type XCSS = ReturnType<typeof boxWrapper> | ReturnType<typeof inlineWrapper>;
30
+ type XCSSArray = Array<XCSS | XCSSArray | false | undefined>;
30
31
  type AllowedBoxStyles = keyof SafeCSSObject;
31
32
  type Spacing = 'columnGap' | 'gap' | 'inset' | 'insetBlock' | 'insetBlockEnd' | 'insetBlockStart' | 'insetInline' | 'insetInlineEnd' | 'insetInlineStart' | 'margin' | 'marginBlock' | 'marginBlockEnd' | 'marginBlockStart' | 'marginInline' | 'marginInlineEnd' | 'marginInlineStart' | 'outlineOffset' | 'padding' | 'paddingBlock' | 'paddingBlockEnd' | 'paddingBlockStart' | 'paddingBottom' | 'paddingInline' | 'paddingInlineEnd' | 'paddingInlineStart' | 'paddingLeft' | 'paddingRight' | 'paddingTop' | 'rowGap';
32
33
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "0.15.2",
3
+ "version": "0.16.0",
4
4
  "description": "Primitives are token-backed low-level building blocks.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -102,7 +102,8 @@
102
102
  "./responsive": "./src/responsive/index.tsx"
103
103
  },
104
104
  "dependencies": {
105
- "@atlaskit/tokens": "^1.10.0",
105
+ "@atlaskit/focus-ring": "^1.3.0",
106
+ "@atlaskit/tokens": "^1.11.0",
106
107
  "@babel/runtime": "^7.0.0",
107
108
  "@emotion/react": "^11.7.1",
108
109
  "@emotion/serialize": "^1.1.0",
@@ -112,26 +113,14 @@
112
113
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
113
114
  },
114
115
  "devDependencies": {
115
- "@atlaskit/avatar": "*",
116
- "@atlaskit/badge": "*",
117
- "@atlaskit/button": "*",
118
- "@atlaskit/code": "*",
119
- "@atlaskit/docs": "*",
120
- "@atlaskit/dropdown-menu": "*",
116
+ "@af/visual-regression": "*",
121
117
  "@atlaskit/ds-lib": "*",
122
- "@atlaskit/heading": "*",
123
- "@atlaskit/icon": "*",
124
- "@atlaskit/icon-object": "*",
125
- "@atlaskit/logo": "*",
126
- "@atlaskit/lozenge": "*",
127
- "@atlaskit/radio": "^5.6.0",
128
- "@atlaskit/range": "^7.1.0",
129
118
  "@atlaskit/ssr": "*",
130
119
  "@atlaskit/theme": "*",
120
+ "@atlaskit/tooltip": "*",
131
121
  "@atlaskit/visual-regression": "*",
132
122
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
133
123
  "@atlassian/codegen": "^0.1.0",
134
- "@atlassian/gemini-visual-regression": "^0.0.35",
135
124
  "@testing-library/react": "^12.1.5",
136
125
  "@testing-library/react-hooks": "^8.0.1",
137
126
  "csstype": "^3.1.0",
package/report.api.md CHANGED
@@ -50,6 +50,7 @@ type AllowedBoxStyles = keyof SafeCSSObject;
50
50
  type As =
51
51
  | 'article'
52
52
  | 'aside'
53
+ | 'button'
53
54
  | 'dialog'
54
55
  | 'div'
55
56
  | 'footer'
@@ -261,8 +262,8 @@ type BorderWidth = keyof typeof borderWidthMap;
261
262
  const borderWidthMap: {
262
263
  readonly 'border.width': 'var(--ds-border-width)';
263
264
  readonly 'border.width.0': 'var(--ds-border-width-0)';
264
- readonly 'border.width.050': 'var(--ds-border-width-050)';
265
- readonly 'border.width.100': 'var(--ds-border-width-100)';
265
+ readonly 'border.width.indicator': 'var(--ds-border-width-indicator)';
266
+ readonly 'border.width.outline': 'var(--ds-border-width-outline)';
266
267
  };
267
268
 
268
269
  // @public
@@ -296,6 +297,9 @@ type BoxXCSS = {
296
297
  readonly [uniqueSymbol]: BoxStyles;
297
298
  };
298
299
 
300
+ // @public (undocumented)
301
+ type BoxXCSSArray = Array<BoxXCSS | BoxXCSSArray | false | undefined>;
302
+
299
303
  // @public
300
304
  export type Breakpoint = 'lg' | 'md' | 'sm' | 'xl' | 'xs' | 'xxs';
301
305
 
@@ -413,9 +417,27 @@ const media: {
413
417
  // @public
414
418
  type MediaQuery = (typeof media.above)[Breakpoint];
415
419
 
420
+ // @public
421
+ export const Pressable: PressableComponent;
422
+
423
+ // @public (undocumented)
424
+ type PressableComponent = (
425
+ props: PressableProps,
426
+ displayName: string,
427
+ ) => ReactElement | null;
428
+
429
+ // @public (undocumented)
430
+ export type PressableProps = Omit<
431
+ BaseBoxProps<'button'>,
432
+ 'as' | 'children' | 'disabled' | 'role' | 'style'
433
+ > & {
434
+ children: ReactNode;
435
+ isDisabled?: boolean;
436
+ };
437
+
416
438
  // @public (undocumented)
417
439
  type PublicBoxPropsBase = {
418
- xcss?: Array<BoxXCSS | false | undefined> | BoxXCSS;
440
+ xcss?: BoxXCSS | BoxXCSSArray;
419
441
  };
420
442
 
421
443
  // @public (undocumented)
@@ -36,7 +36,7 @@ type AlignInline_2 = 'center' | 'end' | 'start';
36
36
  type AllowedBoxStyles = keyof SafeCSSObject;
37
37
 
38
38
  // @public (undocumented)
39
- type As = 'article' | 'aside' | 'dialog' | 'div' | 'footer' | 'header' | 'li' | 'main' | 'nav' | 'ol' | 'section' | 'span' | 'ul';
39
+ type As = 'article' | 'aside' | 'button' | 'dialog' | 'div' | 'footer' | 'header' | 'li' | 'main' | 'nav' | 'ol' | 'section' | 'span' | 'ul';
40
40
 
41
41
  // @public (undocumented)
42
42
  type AutoComplete<T extends string> = Omit<string, T> | T;
@@ -232,8 +232,8 @@ type BorderWidth = keyof typeof borderWidthMap;
232
232
  const borderWidthMap: {
233
233
  readonly 'border.width': "var(--ds-border-width)";
234
234
  readonly 'border.width.0': "var(--ds-border-width-0)";
235
- readonly 'border.width.050': "var(--ds-border-width-050)";
236
- readonly 'border.width.100': "var(--ds-border-width-100)";
235
+ readonly 'border.width.indicator': "var(--ds-border-width-indicator)";
236
+ readonly 'border.width.outline': "var(--ds-border-width-outline)";
237
237
  };
238
238
 
239
239
  // @public
@@ -258,6 +258,9 @@ type BoxXCSS = {
258
258
  readonly [uniqueSymbol]: BoxStyles;
259
259
  };
260
260
 
261
+ // @public (undocumented)
262
+ type BoxXCSSArray = Array<BoxXCSS | BoxXCSSArray | false | undefined>;
263
+
261
264
  // @public
262
265
  export type Breakpoint = 'lg' | 'md' | 'sm' | 'xl' | 'xs' | 'xxs';
263
266
 
@@ -356,9 +359,21 @@ const media: {
356
359
  // @public
357
360
  type MediaQuery = (typeof media.above)[Breakpoint];
358
361
 
362
+ // @public
363
+ export const Pressable: PressableComponent;
364
+
365
+ // @public (undocumented)
366
+ type PressableComponent = (props: PressableProps, displayName: string) => ReactElement | null;
367
+
368
+ // @public (undocumented)
369
+ export type PressableProps = Omit<BaseBoxProps<'button'>, 'as' | 'children' | 'disabled' | 'role' | 'style'> & {
370
+ children: ReactNode;
371
+ isDisabled?: boolean;
372
+ };
373
+
359
374
  // @public (undocumented)
360
375
  type PublicBoxPropsBase = {
361
- xcss?: Array<BoxXCSS | false | undefined> | BoxXCSS;
376
+ xcss?: BoxXCSS | BoxXCSSArray;
362
377
  };
363
378
 
364
379
  // @public (undocumented)