@atlaskit/primitives 0.15.3 → 1.0.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 +14 -0
- package/dist/cjs/components/internal/base-box.js +5 -3
- package/dist/cjs/components/pressable.js +62 -0
- package/dist/cjs/index.js +7 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/internal/base-box.js +3 -2
- package/dist/es2019/components/pressable.js +52 -0
- package/dist/es2019/index.js +1 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/internal/base-box.js +5 -3
- package/dist/esm/components/pressable.js +54 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/components/internal/base-box.d.ts +1 -1
- package/dist/types/components/pressable.d.ts +23 -0
- package/dist/types/components/types.d.ts +3 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/xcss/xcss.d.ts +2 -1
- package/dist/types-ts4.5/components/internal/base-box.d.ts +1 -1
- package/dist/types-ts4.5/components/pressable.d.ts +23 -0
- package/dist/types-ts4.5/components/types.d.ts +3 -1
- package/dist/types-ts4.5/index.d.ts +1 -0
- package/dist/types-ts4.5/xcss/xcss.d.ts +2 -1
- package/package.json +4 -1
- package/report.api.md +23 -1
- package/tmp/api-report-tmp.d.ts +17 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/primitives
|
|
2
2
|
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`fec62731e2e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fec62731e2e) - This package is now in open beta and is no longer considered experimental. We will be making iterative improvements until GA. While the API is likely to be stable, we reserve the right to make changes if required. This version contains no changes whatsoever.
|
|
8
|
+
|
|
9
|
+
P.S. The reason for the change is to aid package deduplication in the product.
|
|
10
|
+
|
|
11
|
+
## 0.16.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [`fe3ef707163`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fe3ef707163) - Initial Pressable primitive (not ready for production)
|
|
16
|
+
|
|
3
17
|
## 0.15.3
|
|
4
18
|
|
|
5
19
|
### 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
|
|
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"));
|
package/dist/cjs/version.json
CHANGED
|
@@ -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
|
|
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;
|
package/dist/es2019/index.js
CHANGED
package/dist/es2019/version.json
CHANGED
|
@@ -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
|
|
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
package/dist/esm/version.json
CHANGED
|
@@ -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 |
|
|
18
|
+
xcss?: BoxXCSS | BoxXCSSArray;
|
|
18
19
|
};
|
|
20
|
+
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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';
|
|
@@ -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 |
|
|
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 |
|
|
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';
|
|
@@ -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 |
|
|
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.
|
|
3
|
+
"version": "1.0.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,6 +102,7 @@
|
|
|
102
102
|
"./responsive": "./src/responsive/index.tsx"
|
|
103
103
|
},
|
|
104
104
|
"dependencies": {
|
|
105
|
+
"@atlaskit/focus-ring": "^1.3.0",
|
|
105
106
|
"@atlaskit/tokens": "^1.11.0",
|
|
106
107
|
"@babel/runtime": "^7.0.0",
|
|
107
108
|
"@emotion/react": "^11.7.1",
|
|
@@ -115,6 +116,8 @@
|
|
|
115
116
|
"@af/visual-regression": "*",
|
|
116
117
|
"@atlaskit/ds-lib": "*",
|
|
117
118
|
"@atlaskit/ssr": "*",
|
|
119
|
+
"@atlaskit/theme": "*",
|
|
120
|
+
"@atlaskit/tooltip": "*",
|
|
118
121
|
"@atlaskit/visual-regression": "*",
|
|
119
122
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
120
123
|
"@atlassian/codegen": "^0.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'
|
|
@@ -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?:
|
|
440
|
+
xcss?: BoxXCSS | BoxXCSSArray;
|
|
419
441
|
};
|
|
420
442
|
|
|
421
443
|
// @public (undocumented)
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -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;
|
|
@@ -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?:
|
|
376
|
+
xcss?: BoxXCSS | BoxXCSSArray;
|
|
362
377
|
};
|
|
363
378
|
|
|
364
379
|
// @public (undocumented)
|