@atlaskit/primitives 1.2.3 → 1.3.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 +6 -0
- package/dist/cjs/components/box.js +33 -25
- package/dist/cjs/components/internal/types.js +5 -0
- package/dist/es2019/components/box.js +31 -26
- package/dist/es2019/components/internal/types.js +1 -0
- package/dist/esm/components/box.js +32 -26
- package/dist/esm/components/internal/types.js +1 -0
- package/dist/types/components/box.d.ts +66 -6
- package/dist/types/components/internal/types.d.ts +1 -0
- package/dist/types-ts4.5/components/box.d.ts +66 -6
- package/dist/types-ts4.5/components/internal/types.d.ts +1 -0
- package/package.json +1 -1
- package/report.api.md +74 -7
- package/tmp/api-report-tmp.d.ts +14 -4
- package/dist/cjs/components/internal/base-box.js +0 -61
- package/dist/es2019/components/internal/base-box.js +0 -52
- package/dist/esm/components/internal/base-box.js +0 -53
- package/dist/types/components/internal/base-box.d.ts +0 -85
- package/dist/types-ts4.5/components/internal/base-box.d.ts +0 -85
package/CHANGELOG.md
CHANGED
|
@@ -4,19 +4,21 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.default = void 0;
|
|
7
|
+
exports.default = exports.Box = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
|
+
var _styleMaps = require("../xcss/style-maps.partial");
|
|
12
13
|
var _xcss = require("../xcss/xcss");
|
|
13
|
-
var _baseBox = require("./internal/base-box");
|
|
14
14
|
var _excluded = ["as", "children", "backgroundColor", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "style", "testId", "xcss"],
|
|
15
15
|
_excluded2 = ["className"];
|
|
16
16
|
/** @jsx jsx */
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
//
|
|
17
|
+
// Can either Exclude or Extract - here we're excluding all SVG-related elements
|
|
18
|
+
|
|
19
|
+
// Basically just ElementType but without ComponentType, it makes sense to keep the "Type" suffix
|
|
20
|
+
// eslint-disable-next-line @repo/internal/react/consistent-types-definitions
|
|
21
|
+
|
|
20
22
|
/**
|
|
21
23
|
* __Box__
|
|
22
24
|
*
|
|
@@ -28,7 +30,8 @@ var _excluded = ["as", "children", "backgroundColor", "padding", "paddingBlock",
|
|
|
28
30
|
* - [Usage](https://atlassian.design/components/primitives/box/usage)
|
|
29
31
|
*/
|
|
30
32
|
var Box = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
31
|
-
var as = _ref.as,
|
|
33
|
+
var _ref$as = _ref.as,
|
|
34
|
+
as = _ref$as === void 0 ? 'div' : _ref$as,
|
|
32
35
|
children = _ref.children,
|
|
33
36
|
backgroundColor = _ref.backgroundColor,
|
|
34
37
|
padding = _ref.padding,
|
|
@@ -42,28 +45,33 @@ var Box = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
42
45
|
testId = _ref.testId,
|
|
43
46
|
xcss = _ref.xcss,
|
|
44
47
|
htmlAttributes = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
48
|
+
var Component = as;
|
|
45
49
|
// This is to remove className from safeHtmlAttributes
|
|
50
|
+
// @ts-expect-error className doesn't exist in the prop definition but we want to ensure it cannot be applied even if types are bypassed
|
|
46
51
|
var _spreadClass = htmlAttributes.className,
|
|
47
52
|
safeHtmlAttributes = (0, _objectWithoutProperties2.default)(htmlAttributes, _excluded2);
|
|
48
53
|
var className = xcss && (0, _xcss.parseXcss)(xcss);
|
|
49
|
-
return (
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
css: className
|
|
65
|
-
}, safeHtmlAttributes), children);
|
|
54
|
+
return (
|
|
55
|
+
// @ts-expect-error Expression produces a union type that is too complex to represent. I think this is unavoidable
|
|
56
|
+
(0, _react2.jsx)(Component, (0, _extends2.default)({
|
|
57
|
+
style: style
|
|
58
|
+
// @ts-expect-error Expression produces a union type that is too complex to represent. We may be able to narrow the type here but unsure.
|
|
59
|
+
,
|
|
60
|
+
ref: ref
|
|
61
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
62
|
+
}, safeHtmlAttributes, {
|
|
63
|
+
css: [baseStyles, backgroundColor && _styleMaps.backgroundColorStylesMap[backgroundColor], padding && _styleMaps.paddingStylesMap.padding[padding], paddingBlock && _styleMaps.paddingStylesMap.paddingBlock[paddingBlock], paddingBlockStart && _styleMaps.paddingStylesMap.paddingBlockStart[paddingBlockStart], paddingBlockEnd && _styleMaps.paddingStylesMap.paddingBlockEnd[paddingBlockEnd], paddingInline && _styleMaps.paddingStylesMap.paddingInline[paddingInline], paddingInlineStart && _styleMaps.paddingStylesMap.paddingInlineStart[paddingInlineStart], paddingInlineEnd && _styleMaps.paddingStylesMap.paddingInlineEnd[paddingInlineEnd],
|
|
64
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
65
|
+
className],
|
|
66
|
+
"data-testid": testId
|
|
67
|
+
}), children)
|
|
68
|
+
);
|
|
66
69
|
});
|
|
67
|
-
Box
|
|
70
|
+
exports.Box = Box;
|
|
68
71
|
var _default = Box;
|
|
69
|
-
exports.default = _default;
|
|
72
|
+
exports.default = _default;
|
|
73
|
+
var baseStyles = (0, _react2.css)({
|
|
74
|
+
boxSizing: 'border-box',
|
|
75
|
+
appearance: 'none',
|
|
76
|
+
border: 'none'
|
|
77
|
+
});
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
|
-
import { jsx } from '@emotion/react';
|
|
4
|
+
import { css, jsx } from '@emotion/react';
|
|
5
|
+
import { backgroundColorStylesMap, paddingStylesMap } from '../xcss/style-maps.partial';
|
|
5
6
|
import { parseXcss } from '../xcss/xcss';
|
|
6
|
-
import { BaseBox } from './internal/base-box';
|
|
7
7
|
|
|
8
|
-
//
|
|
9
|
-
|
|
10
|
-
//
|
|
8
|
+
// Can either Exclude or Extract - here we're excluding all SVG-related elements
|
|
9
|
+
|
|
10
|
+
// Basically just ElementType but without ComponentType, it makes sense to keep the "Type" suffix
|
|
11
|
+
// eslint-disable-next-line @repo/internal/react/consistent-types-definitions
|
|
11
12
|
/**
|
|
12
13
|
* __Box__
|
|
13
14
|
*
|
|
@@ -18,8 +19,8 @@ import { BaseBox } from './internal/base-box';
|
|
|
18
19
|
* - [Code](https://atlassian.design/components/primitives/box/code)
|
|
19
20
|
* - [Usage](https://atlassian.design/components/primitives/box/usage)
|
|
20
21
|
*/
|
|
21
|
-
const Box = /*#__PURE__*/forwardRef(({
|
|
22
|
-
as,
|
|
22
|
+
export const Box = /*#__PURE__*/forwardRef(({
|
|
23
|
+
as = 'div',
|
|
23
24
|
children,
|
|
24
25
|
backgroundColor,
|
|
25
26
|
padding,
|
|
@@ -34,29 +35,33 @@ const Box = /*#__PURE__*/forwardRef(({
|
|
|
34
35
|
xcss,
|
|
35
36
|
...htmlAttributes
|
|
36
37
|
}, ref) => {
|
|
38
|
+
const Component = as;
|
|
37
39
|
// This is to remove className from safeHtmlAttributes
|
|
40
|
+
// @ts-expect-error className doesn't exist in the prop definition but we want to ensure it cannot be applied even if types are bypassed
|
|
38
41
|
const {
|
|
39
42
|
className: _spreadClass,
|
|
40
43
|
...safeHtmlAttributes
|
|
41
44
|
} = htmlAttributes;
|
|
42
45
|
const className = xcss && parseXcss(xcss);
|
|
43
|
-
return
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
css: className
|
|
59
|
-
}, safeHtmlAttributes), children);
|
|
46
|
+
return (
|
|
47
|
+
// @ts-expect-error Expression produces a union type that is too complex to represent. I think this is unavoidable
|
|
48
|
+
jsx(Component, _extends({
|
|
49
|
+
style: style
|
|
50
|
+
// @ts-expect-error Expression produces a union type that is too complex to represent. We may be able to narrow the type here but unsure.
|
|
51
|
+
,
|
|
52
|
+
ref: ref
|
|
53
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
54
|
+
}, safeHtmlAttributes, {
|
|
55
|
+
css: [baseStyles, backgroundColor && backgroundColorStylesMap[backgroundColor], padding && paddingStylesMap.padding[padding], paddingBlock && paddingStylesMap.paddingBlock[paddingBlock], paddingBlockStart && paddingStylesMap.paddingBlockStart[paddingBlockStart], paddingBlockEnd && paddingStylesMap.paddingBlockEnd[paddingBlockEnd], paddingInline && paddingStylesMap.paddingInline[paddingInline], paddingInlineStart && paddingStylesMap.paddingInlineStart[paddingInlineStart], paddingInlineEnd && paddingStylesMap.paddingInlineEnd[paddingInlineEnd],
|
|
56
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
57
|
+
className],
|
|
58
|
+
"data-testid": testId
|
|
59
|
+
}), children)
|
|
60
|
+
);
|
|
60
61
|
});
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
export default Box;
|
|
63
|
+
const baseStyles = css({
|
|
64
|
+
boxSizing: 'border-box',
|
|
65
|
+
appearance: 'none',
|
|
66
|
+
border: 'none'
|
|
67
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,13 +4,14 @@ var _excluded = ["as", "children", "backgroundColor", "padding", "paddingBlock",
|
|
|
4
4
|
_excluded2 = ["className"];
|
|
5
5
|
/** @jsx jsx */
|
|
6
6
|
import { forwardRef } from 'react';
|
|
7
|
-
import { jsx } from '@emotion/react';
|
|
7
|
+
import { css, jsx } from '@emotion/react';
|
|
8
|
+
import { backgroundColorStylesMap, paddingStylesMap } from '../xcss/style-maps.partial';
|
|
8
9
|
import { parseXcss } from '../xcss/xcss';
|
|
9
|
-
import { BaseBox } from './internal/base-box';
|
|
10
10
|
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
//
|
|
11
|
+
// Can either Exclude or Extract - here we're excluding all SVG-related elements
|
|
12
|
+
|
|
13
|
+
// Basically just ElementType but without ComponentType, it makes sense to keep the "Type" suffix
|
|
14
|
+
// eslint-disable-next-line @repo/internal/react/consistent-types-definitions
|
|
14
15
|
/**
|
|
15
16
|
* __Box__
|
|
16
17
|
*
|
|
@@ -21,8 +22,9 @@ import { BaseBox } from './internal/base-box';
|
|
|
21
22
|
* - [Code](https://atlassian.design/components/primitives/box/code)
|
|
22
23
|
* - [Usage](https://atlassian.design/components/primitives/box/usage)
|
|
23
24
|
*/
|
|
24
|
-
var Box = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
25
|
-
var as = _ref.as,
|
|
25
|
+
export var Box = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
26
|
+
var _ref$as = _ref.as,
|
|
27
|
+
as = _ref$as === void 0 ? 'div' : _ref$as,
|
|
26
28
|
children = _ref.children,
|
|
27
29
|
backgroundColor = _ref.backgroundColor,
|
|
28
30
|
padding = _ref.padding,
|
|
@@ -36,27 +38,31 @@ var Box = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
36
38
|
testId = _ref.testId,
|
|
37
39
|
xcss = _ref.xcss,
|
|
38
40
|
htmlAttributes = _objectWithoutProperties(_ref, _excluded);
|
|
41
|
+
var Component = as;
|
|
39
42
|
// This is to remove className from safeHtmlAttributes
|
|
43
|
+
// @ts-expect-error className doesn't exist in the prop definition but we want to ensure it cannot be applied even if types are bypassed
|
|
40
44
|
var _spreadClass = htmlAttributes.className,
|
|
41
45
|
safeHtmlAttributes = _objectWithoutProperties(htmlAttributes, _excluded2);
|
|
42
46
|
var className = xcss && parseXcss(xcss);
|
|
43
|
-
return
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
css: className
|
|
59
|
-
}, safeHtmlAttributes), children);
|
|
47
|
+
return (
|
|
48
|
+
// @ts-expect-error Expression produces a union type that is too complex to represent. I think this is unavoidable
|
|
49
|
+
jsx(Component, _extends({
|
|
50
|
+
style: style
|
|
51
|
+
// @ts-expect-error Expression produces a union type that is too complex to represent. We may be able to narrow the type here but unsure.
|
|
52
|
+
,
|
|
53
|
+
ref: ref
|
|
54
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
55
|
+
}, safeHtmlAttributes, {
|
|
56
|
+
css: [baseStyles, backgroundColor && backgroundColorStylesMap[backgroundColor], padding && paddingStylesMap.padding[padding], paddingBlock && paddingStylesMap.paddingBlock[paddingBlock], paddingBlockStart && paddingStylesMap.paddingBlockStart[paddingBlockStart], paddingBlockEnd && paddingStylesMap.paddingBlockEnd[paddingBlockEnd], paddingInline && paddingStylesMap.paddingInline[paddingInline], paddingInlineStart && paddingStylesMap.paddingInlineStart[paddingInlineStart], paddingInlineEnd && paddingStylesMap.paddingInlineEnd[paddingInlineEnd],
|
|
57
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
58
|
+
className],
|
|
59
|
+
"data-testid": testId
|
|
60
|
+
}), children)
|
|
61
|
+
);
|
|
60
62
|
});
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
export default Box;
|
|
64
|
+
var baseStyles = css({
|
|
65
|
+
boxSizing: 'border-box',
|
|
66
|
+
appearance: 'none',
|
|
67
|
+
border: 'none'
|
|
68
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,9 +1,69 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { ComponentPropsWithoutRef,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
type
|
|
2
|
+
import { ComponentPropsWithoutRef, ComponentPropsWithRef, ReactElement, ReactNode } from 'react';
|
|
3
|
+
import { BackgroundColor, type Space } from '../xcss/style-maps.partial';
|
|
4
|
+
import { SVGElements } from './internal/types';
|
|
5
|
+
import type { BasePrimitiveProps } from './types';
|
|
6
|
+
type AllowedElements = Exclude<keyof JSX.IntrinsicElements, SVGElements>;
|
|
7
|
+
type CustomElementType<P = any> = {
|
|
8
|
+
[K in AllowedElements]: P extends JSX.IntrinsicElements[K] ? K : never;
|
|
9
|
+
}[AllowedElements];
|
|
10
|
+
export type BoxProps<T extends CustomElementType> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & BasePrimitiveProps & BaseBoxProps<T>;
|
|
11
|
+
type BaseBoxProps<T extends CustomElementType> = {
|
|
12
|
+
/**
|
|
13
|
+
* The DOM element to render as the Box. Defaults to `div`.
|
|
14
|
+
*/
|
|
15
|
+
as?: T;
|
|
16
|
+
/**
|
|
17
|
+
* Elements to be rendered inside the Box.
|
|
18
|
+
*/
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Token representing background color with a built-in fallback value.
|
|
22
|
+
*/
|
|
23
|
+
backgroundColor?: BackgroundColor;
|
|
24
|
+
/**
|
|
25
|
+
* Tokens representing CSS shorthand for `paddingBlock` and `paddingInline` together.
|
|
26
|
+
*
|
|
27
|
+
* @see paddingBlock
|
|
28
|
+
* @see paddingInline
|
|
29
|
+
*/
|
|
30
|
+
padding?: Space;
|
|
31
|
+
/**
|
|
32
|
+
* Tokens representing CSS shorthand `paddingBlock`.
|
|
33
|
+
*
|
|
34
|
+
* @see paddingBlockStart
|
|
35
|
+
* @see paddingBlockEnd
|
|
36
|
+
*/
|
|
37
|
+
paddingBlock?: Space;
|
|
38
|
+
/**
|
|
39
|
+
* Tokens representing CSS `paddingBlockStart`.
|
|
40
|
+
*/
|
|
41
|
+
paddingBlockStart?: Space;
|
|
42
|
+
/**
|
|
43
|
+
* Tokens representing CSS `paddingBlockEnd`.
|
|
44
|
+
*/
|
|
45
|
+
paddingBlockEnd?: Space;
|
|
46
|
+
/**
|
|
47
|
+
* Tokens representing CSS shorthand `paddingInline`.
|
|
48
|
+
*
|
|
49
|
+
* @see paddingInlineStart
|
|
50
|
+
* @see paddingInlineEnd
|
|
51
|
+
*/
|
|
52
|
+
paddingInline?: Space;
|
|
53
|
+
/**
|
|
54
|
+
* Tokens representing CSS `paddingInlineStart`.
|
|
55
|
+
*/
|
|
56
|
+
paddingInlineStart?: Space;
|
|
57
|
+
/**
|
|
58
|
+
* Tokens representing CSS `paddingInlineEnd`.
|
|
59
|
+
*/
|
|
60
|
+
paddingInlineEnd?: Space;
|
|
61
|
+
/**
|
|
62
|
+
* Forwarded ref
|
|
63
|
+
*/
|
|
64
|
+
ref?: ComponentPropsWithRef<T>['ref'];
|
|
65
|
+
};
|
|
66
|
+
type BoxComponent = <T extends CustomElementType>(props: BoxProps<T>) => ReactElement | null;
|
|
7
67
|
/**
|
|
8
68
|
* __Box__
|
|
9
69
|
*
|
|
@@ -14,5 +74,5 @@ type BoxComponent<T extends ElementType = 'div'> = (<T extends ElementType>(prop
|
|
|
14
74
|
* - [Code](https://atlassian.design/components/primitives/box/code)
|
|
15
75
|
* - [Usage](https://atlassian.design/components/primitives/box/usage)
|
|
16
76
|
*/
|
|
17
|
-
declare const Box: BoxComponent;
|
|
77
|
+
export declare const Box: BoxComponent;
|
|
18
78
|
export default Box;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type SVGElements = 'svg' | 'animate' | 'animateMotion' | 'animateTransform' | 'circle' | 'clipPath' | 'defs' | 'desc' | 'ellipse' | 'feBlend' | 'feColorMatrix' | 'feComponentTransfer' | 'feComposite' | 'feConvolveMatrix' | 'feDiffuseLighting' | 'feDisplacementMap' | 'feDistantLight' | 'feDropShadow' | 'feFlood' | 'feFuncA' | 'feFuncB' | 'feFuncG' | 'feFuncR' | 'feGaussianBlur' | 'feImage' | 'feMerge' | 'feMergeNode' | 'feMorphology' | 'feOffset' | 'fePointLight' | 'feSpecularLighting' | 'feSpotLight' | 'feTile' | 'feTurbulence' | 'filter' | 'foreignObject' | 'g' | 'image' | 'line' | 'linearGradient' | 'marker' | 'mask' | 'metadata' | 'mpath' | 'path' | 'pattern' | 'polygon' | 'polyline' | 'radialGradient' | 'rect' | 'stop' | 'switch' | 'symbol' | 'text' | 'textPath' | 'tspan' | 'use' | 'view';
|
|
@@ -1,9 +1,69 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { ComponentPropsWithoutRef,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
type
|
|
2
|
+
import { ComponentPropsWithoutRef, ComponentPropsWithRef, ReactElement, ReactNode } from 'react';
|
|
3
|
+
import { BackgroundColor, type Space } from '../xcss/style-maps.partial';
|
|
4
|
+
import { SVGElements } from './internal/types';
|
|
5
|
+
import type { BasePrimitiveProps } from './types';
|
|
6
|
+
type AllowedElements = Exclude<keyof JSX.IntrinsicElements, SVGElements>;
|
|
7
|
+
type CustomElementType<P = any> = {
|
|
8
|
+
[K in AllowedElements]: P extends JSX.IntrinsicElements[K] ? K : never;
|
|
9
|
+
}[AllowedElements];
|
|
10
|
+
export type BoxProps<T extends CustomElementType> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & BasePrimitiveProps & BaseBoxProps<T>;
|
|
11
|
+
type BaseBoxProps<T extends CustomElementType> = {
|
|
12
|
+
/**
|
|
13
|
+
* The DOM element to render as the Box. Defaults to `div`.
|
|
14
|
+
*/
|
|
15
|
+
as?: T;
|
|
16
|
+
/**
|
|
17
|
+
* Elements to be rendered inside the Box.
|
|
18
|
+
*/
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Token representing background color with a built-in fallback value.
|
|
22
|
+
*/
|
|
23
|
+
backgroundColor?: BackgroundColor;
|
|
24
|
+
/**
|
|
25
|
+
* Tokens representing CSS shorthand for `paddingBlock` and `paddingInline` together.
|
|
26
|
+
*
|
|
27
|
+
* @see paddingBlock
|
|
28
|
+
* @see paddingInline
|
|
29
|
+
*/
|
|
30
|
+
padding?: Space;
|
|
31
|
+
/**
|
|
32
|
+
* Tokens representing CSS shorthand `paddingBlock`.
|
|
33
|
+
*
|
|
34
|
+
* @see paddingBlockStart
|
|
35
|
+
* @see paddingBlockEnd
|
|
36
|
+
*/
|
|
37
|
+
paddingBlock?: Space;
|
|
38
|
+
/**
|
|
39
|
+
* Tokens representing CSS `paddingBlockStart`.
|
|
40
|
+
*/
|
|
41
|
+
paddingBlockStart?: Space;
|
|
42
|
+
/**
|
|
43
|
+
* Tokens representing CSS `paddingBlockEnd`.
|
|
44
|
+
*/
|
|
45
|
+
paddingBlockEnd?: Space;
|
|
46
|
+
/**
|
|
47
|
+
* Tokens representing CSS shorthand `paddingInline`.
|
|
48
|
+
*
|
|
49
|
+
* @see paddingInlineStart
|
|
50
|
+
* @see paddingInlineEnd
|
|
51
|
+
*/
|
|
52
|
+
paddingInline?: Space;
|
|
53
|
+
/**
|
|
54
|
+
* Tokens representing CSS `paddingInlineStart`.
|
|
55
|
+
*/
|
|
56
|
+
paddingInlineStart?: Space;
|
|
57
|
+
/**
|
|
58
|
+
* Tokens representing CSS `paddingInlineEnd`.
|
|
59
|
+
*/
|
|
60
|
+
paddingInlineEnd?: Space;
|
|
61
|
+
/**
|
|
62
|
+
* Forwarded ref
|
|
63
|
+
*/
|
|
64
|
+
ref?: ComponentPropsWithRef<T>['ref'];
|
|
65
|
+
};
|
|
66
|
+
type BoxComponent = <T extends CustomElementType>(props: BoxProps<T>) => ReactElement | null;
|
|
7
67
|
/**
|
|
8
68
|
* __Box__
|
|
9
69
|
*
|
|
@@ -14,5 +74,5 @@ type BoxComponent<T extends ElementType = 'div'> = (<T extends ElementType>(prop
|
|
|
14
74
|
* - [Code](https://atlassian.design/components/primitives/box/code)
|
|
15
75
|
* - [Usage](https://atlassian.design/components/primitives/box/usage)
|
|
16
76
|
*/
|
|
17
|
-
declare const Box: BoxComponent;
|
|
77
|
+
export declare const Box: BoxComponent;
|
|
18
78
|
export default Box;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type SVGElements = 'svg' | 'animate' | 'animateMotion' | 'animateTransform' | 'circle' | 'clipPath' | 'defs' | 'desc' | 'ellipse' | 'feBlend' | 'feColorMatrix' | 'feComponentTransfer' | 'feComposite' | 'feConvolveMatrix' | 'feDiffuseLighting' | 'feDisplacementMap' | 'feDistantLight' | 'feDropShadow' | 'feFlood' | 'feFuncA' | 'feFuncB' | 'feFuncG' | 'feFuncR' | 'feGaussianBlur' | 'feImage' | 'feMerge' | 'feMergeNode' | 'feMorphology' | 'feOffset' | 'fePointLight' | 'feSpecularLighting' | 'feSpotLight' | 'feTile' | 'feTurbulence' | 'filter' | 'foreignObject' | 'g' | 'image' | 'line' | 'linearGradient' | 'marker' | 'mask' | 'metadata' | 'mpath' | 'path' | 'pattern' | 'polygon' | 'polyline' | 'radialGradient' | 'rect' | 'stop' | 'switch' | 'symbol' | 'text' | 'textPath' | 'tspan' | 'use' | 'view';
|
package/package.json
CHANGED
package/report.api.md
CHANGED
|
@@ -21,7 +21,6 @@ import type * as CSS_2 from 'csstype';
|
|
|
21
21
|
import type { CSSProperties } from 'react';
|
|
22
22
|
import type { CSSPropertiesWithMultiValues } from '@emotion/serialize';
|
|
23
23
|
import { ElementType } from 'react';
|
|
24
|
-
import { FC } from 'react';
|
|
25
24
|
import { ForwardRefExoticComponent } from 'react';
|
|
26
25
|
import { jsx } from '@emotion/react';
|
|
27
26
|
import { MemoExoticComponent } from 'react';
|
|
@@ -82,6 +81,9 @@ type AllMedia =
|
|
|
82
81
|
| '@media screen and (forced-colors: active), screen and (-ms-high-contrast: active)'
|
|
83
82
|
| MediaQuery;
|
|
84
83
|
|
|
84
|
+
// @public (undocumented)
|
|
85
|
+
type AllowedElements = Exclude<keyof JSX.IntrinsicElements, SVGElements>;
|
|
86
|
+
|
|
85
87
|
// @public (undocumented)
|
|
86
88
|
type AtRulesWithoutMedia = Exclude<CSS_2.AtRules, '@media'>;
|
|
87
89
|
|
|
@@ -213,7 +215,7 @@ const backgroundColorMap: {
|
|
|
213
215
|
};
|
|
214
216
|
|
|
215
217
|
// @public (undocumented)
|
|
216
|
-
type
|
|
218
|
+
type BaseBoxProps<T extends CustomElementType> = {
|
|
217
219
|
as?: T;
|
|
218
220
|
children?: ReactNode;
|
|
219
221
|
backgroundColor?: BackgroundColor;
|
|
@@ -314,18 +316,17 @@ const borderWidthMap: {
|
|
|
314
316
|
export const Box: BoxComponent;
|
|
315
317
|
|
|
316
318
|
// @public (undocumented)
|
|
317
|
-
type BoxComponent
|
|
319
|
+
type BoxComponent = <T extends CustomElementType>(
|
|
318
320
|
props: BoxProps<T>,
|
|
319
|
-
) => ReactElement | null
|
|
320
|
-
FC<BoxProps<T>>;
|
|
321
|
+
) => ReactElement | null;
|
|
321
322
|
|
|
322
323
|
// @public (undocumented)
|
|
323
|
-
export type BoxProps<T extends
|
|
324
|
+
export type BoxProps<T extends CustomElementType> = Omit<
|
|
324
325
|
ComponentPropsWithoutRef<T>,
|
|
325
326
|
'as' | 'className'
|
|
326
327
|
> &
|
|
327
328
|
BasePrimitiveProps &
|
|
328
|
-
|
|
329
|
+
BaseBoxProps<T>;
|
|
329
330
|
|
|
330
331
|
// @public
|
|
331
332
|
export type Breakpoint = 'lg' | 'md' | 'sm' | 'xl' | 'xs' | 'xxs';
|
|
@@ -348,6 +349,11 @@ type CSSPseudos = {
|
|
|
348
349
|
[Pseudo in CSS_2.Pseudos]?: Omit<SafeCSSObject, AllMedia | CSS_2.Pseudos>;
|
|
349
350
|
};
|
|
350
351
|
|
|
352
|
+
// @public (undocumented)
|
|
353
|
+
type CustomElementType<P = any> = {
|
|
354
|
+
[K in AllowedElements]: P extends JSX.IntrinsicElements[K] ? K : never;
|
|
355
|
+
}[AllowedElements];
|
|
356
|
+
|
|
351
357
|
// @public (undocumented)
|
|
352
358
|
export type Dimension = keyof typeof dimensionMap;
|
|
353
359
|
|
|
@@ -874,6 +880,67 @@ export type StackProps<T extends ElementType = 'div'> = {
|
|
|
874
880
|
ref?: React.ComponentPropsWithRef<T>['ref'];
|
|
875
881
|
} & BasePrimitiveProps;
|
|
876
882
|
|
|
883
|
+
// @public (undocumented)
|
|
884
|
+
type SVGElements =
|
|
885
|
+
| 'animate'
|
|
886
|
+
| 'animateMotion'
|
|
887
|
+
| 'animateTransform'
|
|
888
|
+
| 'circle'
|
|
889
|
+
| 'clipPath'
|
|
890
|
+
| 'defs'
|
|
891
|
+
| 'desc'
|
|
892
|
+
| 'ellipse'
|
|
893
|
+
| 'feBlend'
|
|
894
|
+
| 'feColorMatrix'
|
|
895
|
+
| 'feComponentTransfer'
|
|
896
|
+
| 'feComposite'
|
|
897
|
+
| 'feConvolveMatrix'
|
|
898
|
+
| 'feDiffuseLighting'
|
|
899
|
+
| 'feDisplacementMap'
|
|
900
|
+
| 'feDistantLight'
|
|
901
|
+
| 'feDropShadow'
|
|
902
|
+
| 'feFlood'
|
|
903
|
+
| 'feFuncA'
|
|
904
|
+
| 'feFuncB'
|
|
905
|
+
| 'feFuncG'
|
|
906
|
+
| 'feFuncR'
|
|
907
|
+
| 'feGaussianBlur'
|
|
908
|
+
| 'feImage'
|
|
909
|
+
| 'feMerge'
|
|
910
|
+
| 'feMergeNode'
|
|
911
|
+
| 'feMorphology'
|
|
912
|
+
| 'feOffset'
|
|
913
|
+
| 'fePointLight'
|
|
914
|
+
| 'feSpecularLighting'
|
|
915
|
+
| 'feSpotLight'
|
|
916
|
+
| 'feTile'
|
|
917
|
+
| 'feTurbulence'
|
|
918
|
+
| 'filter'
|
|
919
|
+
| 'foreignObject'
|
|
920
|
+
| 'g'
|
|
921
|
+
| 'image'
|
|
922
|
+
| 'line'
|
|
923
|
+
| 'linearGradient'
|
|
924
|
+
| 'marker'
|
|
925
|
+
| 'mask'
|
|
926
|
+
| 'metadata'
|
|
927
|
+
| 'mpath'
|
|
928
|
+
| 'path'
|
|
929
|
+
| 'pattern'
|
|
930
|
+
| 'polygon'
|
|
931
|
+
| 'polyline'
|
|
932
|
+
| 'radialGradient'
|
|
933
|
+
| 'rect'
|
|
934
|
+
| 'stop'
|
|
935
|
+
| 'svg'
|
|
936
|
+
| 'switch'
|
|
937
|
+
| 'symbol'
|
|
938
|
+
| 'text'
|
|
939
|
+
| 'textPath'
|
|
940
|
+
| 'tspan'
|
|
941
|
+
| 'use'
|
|
942
|
+
| 'view';
|
|
943
|
+
|
|
877
944
|
// @public (undocumented)
|
|
878
945
|
export type TextColor = keyof typeof textColorMap;
|
|
879
946
|
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ import type * as CSS_2 from 'csstype';
|
|
|
10
10
|
import type { CSSProperties } from 'react';
|
|
11
11
|
import type { CSSPropertiesWithMultiValues } from '@emotion/serialize';
|
|
12
12
|
import { ElementType } from 'react';
|
|
13
|
-
import { FC } from 'react';
|
|
14
13
|
import { ForwardRefExoticComponent } from 'react';
|
|
15
14
|
import { jsx } from '@emotion/react';
|
|
16
15
|
import { MemoExoticComponent } from 'react';
|
|
@@ -66,6 +65,9 @@ const alignItemsMap_2: {
|
|
|
66
65
|
// @public (undocumented)
|
|
67
66
|
type AllMedia = '@media (prefers-color-scheme: dark)' | '@media (prefers-color-scheme: light)' | '@media (prefers-reduced-motion: reduce)' | '@media screen and (forced-colors: active), screen and (-ms-high-contrast: active)' | MediaQuery;
|
|
68
67
|
|
|
68
|
+
// @public (undocumented)
|
|
69
|
+
type AllowedElements = Exclude<keyof JSX.IntrinsicElements, SVGElements>;
|
|
70
|
+
|
|
69
71
|
// @public (undocumented)
|
|
70
72
|
type AtRulesWithoutMedia = Exclude<CSS_2.AtRules, '@media'>;
|
|
71
73
|
|
|
@@ -197,7 +199,7 @@ const backgroundColorMap: {
|
|
|
197
199
|
};
|
|
198
200
|
|
|
199
201
|
// @public (undocumented)
|
|
200
|
-
type
|
|
202
|
+
type BaseBoxProps<T extends CustomElementType> = {
|
|
201
203
|
as?: T;
|
|
202
204
|
children?: ReactNode;
|
|
203
205
|
backgroundColor?: BackgroundColor;
|
|
@@ -289,10 +291,10 @@ const borderWidthMap: {
|
|
|
289
291
|
export const Box: BoxComponent;
|
|
290
292
|
|
|
291
293
|
// @public (undocumented)
|
|
292
|
-
type BoxComponent
|
|
294
|
+
type BoxComponent = <T extends CustomElementType>(props: BoxProps<T>) => ReactElement | null;
|
|
293
295
|
|
|
294
296
|
// @public (undocumented)
|
|
295
|
-
export type BoxProps<T extends
|
|
297
|
+
export type BoxProps<T extends CustomElementType> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & BasePrimitiveProps & BaseBoxProps<T>;
|
|
296
298
|
|
|
297
299
|
// @public
|
|
298
300
|
export type Breakpoint = 'lg' | 'md' | 'sm' | 'xl' | 'xs' | 'xxs';
|
|
@@ -312,6 +314,11 @@ type CSSPseudos = {
|
|
|
312
314
|
[Pseudo in CSS_2.Pseudos]?: Omit<SafeCSSObject, AllMedia | CSS_2.Pseudos>;
|
|
313
315
|
};
|
|
314
316
|
|
|
317
|
+
// @public (undocumented)
|
|
318
|
+
type CustomElementType<P = any> = {
|
|
319
|
+
[K in AllowedElements]: P extends JSX.IntrinsicElements[K] ? K : never;
|
|
320
|
+
}[AllowedElements];
|
|
321
|
+
|
|
315
322
|
// @public (undocumented)
|
|
316
323
|
export type Dimension = keyof typeof dimensionMap;
|
|
317
324
|
|
|
@@ -586,6 +593,9 @@ export type StackProps<T extends ElementType = 'div'> = {
|
|
|
586
593
|
ref?: React.ComponentPropsWithRef<T>['ref'];
|
|
587
594
|
} & BasePrimitiveProps;
|
|
588
595
|
|
|
596
|
+
// @public (undocumented)
|
|
597
|
+
type SVGElements = 'animate' | 'animateMotion' | 'animateTransform' | 'circle' | 'clipPath' | 'defs' | 'desc' | 'ellipse' | 'feBlend' | 'feColorMatrix' | 'feComponentTransfer' | 'feComposite' | 'feConvolveMatrix' | 'feDiffuseLighting' | 'feDisplacementMap' | 'feDistantLight' | 'feDropShadow' | 'feFlood' | 'feFuncA' | 'feFuncB' | 'feFuncG' | 'feFuncR' | 'feGaussianBlur' | 'feImage' | 'feMerge' | 'feMergeNode' | 'feMorphology' | 'feOffset' | 'fePointLight' | 'feSpecularLighting' | 'feSpotLight' | 'feTile' | 'feTurbulence' | 'filter' | 'foreignObject' | 'g' | 'image' | 'line' | 'linearGradient' | 'marker' | 'mask' | 'metadata' | 'mpath' | 'path' | 'pattern' | 'polygon' | 'polyline' | 'radialGradient' | 'rect' | 'stop' | 'svg' | 'switch' | 'symbol' | 'text' | 'textPath' | 'tspan' | 'use' | 'view';
|
|
598
|
+
|
|
589
599
|
// @public (undocumented)
|
|
590
600
|
export type TextColor = keyof typeof textColorMap;
|
|
591
601
|
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = exports.BaseBox = 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 _styleMaps = require("../../xcss/style-maps.partial");
|
|
13
|
-
var _excluded = ["as", "className", "children", "backgroundColor", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "style", "testId"];
|
|
14
|
-
/* eslint-disable @repo/internal/styles/no-exported-styles */
|
|
15
|
-
/** @jsx jsx */
|
|
16
|
-
// Without this type annotation on Box we don't get autocomplete for props due to forwardRef types
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* __Box__
|
|
20
|
-
*
|
|
21
|
-
* Box is a primitive component that has the design decisions of the Atlassian Design System baked in.
|
|
22
|
-
* Renders a `div` by default.
|
|
23
|
-
*
|
|
24
|
-
* @internal
|
|
25
|
-
*/
|
|
26
|
-
var BaseBox = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
27
|
-
var as = _ref.as,
|
|
28
|
-
className = _ref.className,
|
|
29
|
-
children = _ref.children,
|
|
30
|
-
backgroundColor = _ref.backgroundColor,
|
|
31
|
-
padding = _ref.padding,
|
|
32
|
-
paddingBlock = _ref.paddingBlock,
|
|
33
|
-
paddingBlockStart = _ref.paddingBlockStart,
|
|
34
|
-
paddingBlockEnd = _ref.paddingBlockEnd,
|
|
35
|
-
paddingInline = _ref.paddingInline,
|
|
36
|
-
paddingInlineStart = _ref.paddingInlineStart,
|
|
37
|
-
paddingInlineEnd = _ref.paddingInlineEnd,
|
|
38
|
-
style = _ref.style,
|
|
39
|
-
testId = _ref.testId,
|
|
40
|
-
htmlAttributes = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
41
|
-
var Component = as || 'div';
|
|
42
|
-
var node = (0, _react2.jsx)(Component, (0, _extends2.default)({
|
|
43
|
-
style: style,
|
|
44
|
-
ref: ref
|
|
45
|
-
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
46
|
-
}, htmlAttributes, {
|
|
47
|
-
className: className,
|
|
48
|
-
css: [baseStyles, backgroundColor && _styleMaps.backgroundColorStylesMap[backgroundColor], padding && _styleMaps.paddingStylesMap.padding[padding], paddingBlock && _styleMaps.paddingStylesMap.paddingBlock[paddingBlock], paddingBlockStart && _styleMaps.paddingStylesMap.paddingBlockStart[paddingBlockStart], paddingBlockEnd && _styleMaps.paddingStylesMap.paddingBlockEnd[paddingBlockEnd], paddingInline && _styleMaps.paddingStylesMap.paddingInline[paddingInline], paddingInlineStart && _styleMaps.paddingStylesMap.paddingInlineStart[paddingInlineStart], paddingInlineEnd && _styleMaps.paddingStylesMap.paddingInlineEnd[paddingInlineEnd]],
|
|
49
|
-
"data-testid": testId
|
|
50
|
-
}), children);
|
|
51
|
-
return node;
|
|
52
|
-
});
|
|
53
|
-
exports.BaseBox = BaseBox;
|
|
54
|
-
BaseBox.displayName = 'BaseBox';
|
|
55
|
-
var _default = BaseBox;
|
|
56
|
-
exports.default = _default;
|
|
57
|
-
var baseStyles = (0, _react2.css)({
|
|
58
|
-
boxSizing: 'border-box',
|
|
59
|
-
appearance: 'none',
|
|
60
|
-
border: 'none'
|
|
61
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
/* eslint-disable @repo/internal/styles/no-exported-styles */
|
|
3
|
-
/** @jsx jsx */
|
|
4
|
-
import { forwardRef } from 'react';
|
|
5
|
-
import { css, jsx } from '@emotion/react';
|
|
6
|
-
import { backgroundColorStylesMap, paddingStylesMap } from '../../xcss/style-maps.partial';
|
|
7
|
-
|
|
8
|
-
// Without this type annotation on Box we don't get autocomplete for props due to forwardRef types
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* __Box__
|
|
12
|
-
*
|
|
13
|
-
* Box is a primitive component that has the design decisions of the Atlassian Design System baked in.
|
|
14
|
-
* Renders a `div` by default.
|
|
15
|
-
*
|
|
16
|
-
* @internal
|
|
17
|
-
*/
|
|
18
|
-
export const BaseBox = /*#__PURE__*/forwardRef(({
|
|
19
|
-
as,
|
|
20
|
-
className,
|
|
21
|
-
children,
|
|
22
|
-
backgroundColor,
|
|
23
|
-
padding,
|
|
24
|
-
paddingBlock,
|
|
25
|
-
paddingBlockStart,
|
|
26
|
-
paddingBlockEnd,
|
|
27
|
-
paddingInline,
|
|
28
|
-
paddingInlineStart,
|
|
29
|
-
paddingInlineEnd,
|
|
30
|
-
style,
|
|
31
|
-
testId,
|
|
32
|
-
...htmlAttributes
|
|
33
|
-
}, ref) => {
|
|
34
|
-
const Component = as || 'div';
|
|
35
|
-
const node = jsx(Component, _extends({
|
|
36
|
-
style: style,
|
|
37
|
-
ref: ref
|
|
38
|
-
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
39
|
-
}, htmlAttributes, {
|
|
40
|
-
className: className,
|
|
41
|
-
css: [baseStyles, backgroundColor && backgroundColorStylesMap[backgroundColor], padding && paddingStylesMap.padding[padding], paddingBlock && paddingStylesMap.paddingBlock[paddingBlock], paddingBlockStart && paddingStylesMap.paddingBlockStart[paddingBlockStart], paddingBlockEnd && paddingStylesMap.paddingBlockEnd[paddingBlockEnd], paddingInline && paddingStylesMap.paddingInline[paddingInline], paddingInlineStart && paddingStylesMap.paddingInlineStart[paddingInlineStart], paddingInlineEnd && paddingStylesMap.paddingInlineEnd[paddingInlineEnd]],
|
|
42
|
-
"data-testid": testId
|
|
43
|
-
}), children);
|
|
44
|
-
return node;
|
|
45
|
-
});
|
|
46
|
-
BaseBox.displayName = 'BaseBox';
|
|
47
|
-
export default BaseBox;
|
|
48
|
-
const baseStyles = css({
|
|
49
|
-
boxSizing: 'border-box',
|
|
50
|
-
appearance: 'none',
|
|
51
|
-
border: 'none'
|
|
52
|
-
});
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["as", "className", "children", "backgroundColor", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "style", "testId"];
|
|
4
|
-
/* eslint-disable @repo/internal/styles/no-exported-styles */
|
|
5
|
-
/** @jsx jsx */
|
|
6
|
-
import { forwardRef } from 'react';
|
|
7
|
-
import { css, jsx } from '@emotion/react';
|
|
8
|
-
import { backgroundColorStylesMap, paddingStylesMap } from '../../xcss/style-maps.partial';
|
|
9
|
-
|
|
10
|
-
// Without this type annotation on Box we don't get autocomplete for props due to forwardRef types
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* __Box__
|
|
14
|
-
*
|
|
15
|
-
* Box is a primitive component that has the design decisions of the Atlassian Design System baked in.
|
|
16
|
-
* Renders a `div` by default.
|
|
17
|
-
*
|
|
18
|
-
* @internal
|
|
19
|
-
*/
|
|
20
|
-
export var BaseBox = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
21
|
-
var as = _ref.as,
|
|
22
|
-
className = _ref.className,
|
|
23
|
-
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
|
-
style = _ref.style,
|
|
33
|
-
testId = _ref.testId,
|
|
34
|
-
htmlAttributes = _objectWithoutProperties(_ref, _excluded);
|
|
35
|
-
var Component = as || 'div';
|
|
36
|
-
var node = jsx(Component, _extends({
|
|
37
|
-
style: style,
|
|
38
|
-
ref: ref
|
|
39
|
-
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
40
|
-
}, htmlAttributes, {
|
|
41
|
-
className: className,
|
|
42
|
-
css: [baseStyles, backgroundColor && backgroundColorStylesMap[backgroundColor], padding && paddingStylesMap.padding[padding], paddingBlock && paddingStylesMap.paddingBlock[paddingBlock], paddingBlockStart && paddingStylesMap.paddingBlockStart[paddingBlockStart], paddingBlockEnd && paddingStylesMap.paddingBlockEnd[paddingBlockEnd], paddingInline && paddingStylesMap.paddingInline[paddingInline], paddingInlineStart && paddingStylesMap.paddingInlineStart[paddingInlineStart], paddingInlineEnd && paddingStylesMap.paddingInlineEnd[paddingInlineEnd]],
|
|
43
|
-
"data-testid": testId
|
|
44
|
-
}), children);
|
|
45
|
-
return node;
|
|
46
|
-
});
|
|
47
|
-
BaseBox.displayName = 'BaseBox';
|
|
48
|
-
export default BaseBox;
|
|
49
|
-
var baseStyles = css({
|
|
50
|
-
boxSizing: 'border-box',
|
|
51
|
-
appearance: 'none',
|
|
52
|
-
border: 'none'
|
|
53
|
-
});
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
import { ComponentPropsWithoutRef, ComponentPropsWithRef, ElementType, FC, ReactElement, ReactNode } from 'react';
|
|
3
|
-
import { BackgroundColor, type Space } from '../../xcss/style-maps.partial';
|
|
4
|
-
import type { BasePrimitiveProps } from '../types';
|
|
5
|
-
export type BaseBoxProps<T extends ElementType> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & BasePrimitiveProps & BaseBoxPropsFoundation<T> & ClassName;
|
|
6
|
-
type ClassName = {
|
|
7
|
-
/**
|
|
8
|
-
* The HTML className attribute.
|
|
9
|
-
*
|
|
10
|
-
* Before using this prop please ensure:
|
|
11
|
-
* - The styles cannot otherwise be achieved through `Box` directly.
|
|
12
|
-
* - The use case needs custom styles that cannot be designed or implemented differently
|
|
13
|
-
*
|
|
14
|
-
* Ensure you're using the `@atlaskit/eslint-plugin-design-system` with this prop to prevent unbounded usage.
|
|
15
|
-
*
|
|
16
|
-
* @see `@atlaskit/eslint-plugin-design-system`
|
|
17
|
-
*/
|
|
18
|
-
className?: string;
|
|
19
|
-
};
|
|
20
|
-
export type BaseBoxPropsFoundation<T extends ElementType> = {
|
|
21
|
-
/**
|
|
22
|
-
* The DOM element to render as the Box. Defaults to `div`.
|
|
23
|
-
*/
|
|
24
|
-
as?: T;
|
|
25
|
-
/**
|
|
26
|
-
* Elements to be rendered inside the Box.
|
|
27
|
-
*/
|
|
28
|
-
children?: ReactNode;
|
|
29
|
-
/**
|
|
30
|
-
* Token representing background color with a built-in fallback value.
|
|
31
|
-
*/
|
|
32
|
-
backgroundColor?: BackgroundColor;
|
|
33
|
-
/**
|
|
34
|
-
* Tokens representing CSS shorthand for `paddingBlock` and `paddingInline` together.
|
|
35
|
-
*
|
|
36
|
-
* @see paddingBlock
|
|
37
|
-
* @see paddingInline
|
|
38
|
-
*/
|
|
39
|
-
padding?: Space;
|
|
40
|
-
/**
|
|
41
|
-
* Tokens representing CSS shorthand `paddingBlock`.
|
|
42
|
-
*
|
|
43
|
-
* @see paddingBlockStart
|
|
44
|
-
* @see paddingBlockEnd
|
|
45
|
-
*/
|
|
46
|
-
paddingBlock?: Space;
|
|
47
|
-
/**
|
|
48
|
-
* Tokens representing CSS `paddingBlockStart`.
|
|
49
|
-
*/
|
|
50
|
-
paddingBlockStart?: Space;
|
|
51
|
-
/**
|
|
52
|
-
* Tokens representing CSS `paddingBlockEnd`.
|
|
53
|
-
*/
|
|
54
|
-
paddingBlockEnd?: Space;
|
|
55
|
-
/**
|
|
56
|
-
* Tokens representing CSS shorthand `paddingInline`.
|
|
57
|
-
*
|
|
58
|
-
* @see paddingInlineStart
|
|
59
|
-
* @see paddingInlineEnd
|
|
60
|
-
*/
|
|
61
|
-
paddingInline?: Space;
|
|
62
|
-
/**
|
|
63
|
-
* Tokens representing CSS `paddingInlineStart`.
|
|
64
|
-
*/
|
|
65
|
-
paddingInlineStart?: Space;
|
|
66
|
-
/**
|
|
67
|
-
* Tokens representing CSS `paddingInlineEnd`.
|
|
68
|
-
*/
|
|
69
|
-
paddingInlineEnd?: Space;
|
|
70
|
-
/**
|
|
71
|
-
* Forwarded ref element
|
|
72
|
-
*/
|
|
73
|
-
ref?: ComponentPropsWithRef<T>['ref'];
|
|
74
|
-
};
|
|
75
|
-
export type BaseBoxComponent<T extends ElementType = 'div'> = (<T extends ElementType>(props: BaseBoxProps<T>) => ReactElement | null) & FC<BaseBoxProps<T>>;
|
|
76
|
-
/**
|
|
77
|
-
* __Box__
|
|
78
|
-
*
|
|
79
|
-
* Box is a primitive component that has the design decisions of the Atlassian Design System baked in.
|
|
80
|
-
* Renders a `div` by default.
|
|
81
|
-
*
|
|
82
|
-
* @internal
|
|
83
|
-
*/
|
|
84
|
-
export declare const BaseBox: BaseBoxComponent;
|
|
85
|
-
export default BaseBox;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
import { ComponentPropsWithoutRef, ComponentPropsWithRef, ElementType, FC, ReactElement, ReactNode } from 'react';
|
|
3
|
-
import { BackgroundColor, type Space } from '../../xcss/style-maps.partial';
|
|
4
|
-
import type { BasePrimitiveProps } from '../types';
|
|
5
|
-
export type BaseBoxProps<T extends ElementType> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & BasePrimitiveProps & BaseBoxPropsFoundation<T> & ClassName;
|
|
6
|
-
type ClassName = {
|
|
7
|
-
/**
|
|
8
|
-
* The HTML className attribute.
|
|
9
|
-
*
|
|
10
|
-
* Before using this prop please ensure:
|
|
11
|
-
* - The styles cannot otherwise be achieved through `Box` directly.
|
|
12
|
-
* - The use case needs custom styles that cannot be designed or implemented differently
|
|
13
|
-
*
|
|
14
|
-
* Ensure you're using the `@atlaskit/eslint-plugin-design-system` with this prop to prevent unbounded usage.
|
|
15
|
-
*
|
|
16
|
-
* @see `@atlaskit/eslint-plugin-design-system`
|
|
17
|
-
*/
|
|
18
|
-
className?: string;
|
|
19
|
-
};
|
|
20
|
-
export type BaseBoxPropsFoundation<T extends ElementType> = {
|
|
21
|
-
/**
|
|
22
|
-
* The DOM element to render as the Box. Defaults to `div`.
|
|
23
|
-
*/
|
|
24
|
-
as?: T;
|
|
25
|
-
/**
|
|
26
|
-
* Elements to be rendered inside the Box.
|
|
27
|
-
*/
|
|
28
|
-
children?: ReactNode;
|
|
29
|
-
/**
|
|
30
|
-
* Token representing background color with a built-in fallback value.
|
|
31
|
-
*/
|
|
32
|
-
backgroundColor?: BackgroundColor;
|
|
33
|
-
/**
|
|
34
|
-
* Tokens representing CSS shorthand for `paddingBlock` and `paddingInline` together.
|
|
35
|
-
*
|
|
36
|
-
* @see paddingBlock
|
|
37
|
-
* @see paddingInline
|
|
38
|
-
*/
|
|
39
|
-
padding?: Space;
|
|
40
|
-
/**
|
|
41
|
-
* Tokens representing CSS shorthand `paddingBlock`.
|
|
42
|
-
*
|
|
43
|
-
* @see paddingBlockStart
|
|
44
|
-
* @see paddingBlockEnd
|
|
45
|
-
*/
|
|
46
|
-
paddingBlock?: Space;
|
|
47
|
-
/**
|
|
48
|
-
* Tokens representing CSS `paddingBlockStart`.
|
|
49
|
-
*/
|
|
50
|
-
paddingBlockStart?: Space;
|
|
51
|
-
/**
|
|
52
|
-
* Tokens representing CSS `paddingBlockEnd`.
|
|
53
|
-
*/
|
|
54
|
-
paddingBlockEnd?: Space;
|
|
55
|
-
/**
|
|
56
|
-
* Tokens representing CSS shorthand `paddingInline`.
|
|
57
|
-
*
|
|
58
|
-
* @see paddingInlineStart
|
|
59
|
-
* @see paddingInlineEnd
|
|
60
|
-
*/
|
|
61
|
-
paddingInline?: Space;
|
|
62
|
-
/**
|
|
63
|
-
* Tokens representing CSS `paddingInlineStart`.
|
|
64
|
-
*/
|
|
65
|
-
paddingInlineStart?: Space;
|
|
66
|
-
/**
|
|
67
|
-
* Tokens representing CSS `paddingInlineEnd`.
|
|
68
|
-
*/
|
|
69
|
-
paddingInlineEnd?: Space;
|
|
70
|
-
/**
|
|
71
|
-
* Forwarded ref element
|
|
72
|
-
*/
|
|
73
|
-
ref?: ComponentPropsWithRef<T>['ref'];
|
|
74
|
-
};
|
|
75
|
-
export type BaseBoxComponent<T extends ElementType = 'div'> = (<T extends ElementType>(props: BaseBoxProps<T>) => ReactElement | null) & FC<BaseBoxProps<T>>;
|
|
76
|
-
/**
|
|
77
|
-
* __Box__
|
|
78
|
-
*
|
|
79
|
-
* Box is a primitive component that has the design decisions of the Atlassian Design System baked in.
|
|
80
|
-
* Renders a `div` by default.
|
|
81
|
-
*
|
|
82
|
-
* @internal
|
|
83
|
-
*/
|
|
84
|
-
export declare const BaseBox: BaseBoxComponent;
|
|
85
|
-
export default BaseBox;
|