@atlaskit/primitives 1.0.6 → 1.0.7
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/constellation/bleed/code.mdx +2 -2
- package/constellation/box/code.mdx +2 -2
- package/constellation/flex/code.mdx +2 -2
- package/constellation/grid/code.mdx +2 -2
- package/constellation/inline/code.mdx +2 -2
- package/constellation/stack/code.mdx +2 -2
- package/dist/cjs/components/box.js +6 -4
- package/dist/cjs/components/internal/base-box.js +3 -5
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/box.js +4 -1
- package/dist/es2019/components/internal/base-box.js +2 -3
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/box.js +7 -4
- package/dist/esm/components/internal/base-box.js +3 -5
- package/dist/esm/version.json +1 -1
- package/dist/types/components/box.d.ts +5 -4
- package/dist/types/components/flex.d.ts +1 -1
- package/dist/types/components/grid.d.ts +1 -1
- package/dist/types/components/inline.d.ts +1 -1
- package/dist/types/components/internal/base-box.d.ts +11 -10
- package/dist/types/components/stack.d.ts +1 -1
- package/dist/types/xcss/xcss.d.ts +1 -1
- package/dist/types-ts4.5/components/box.d.ts +5 -4
- package/dist/types-ts4.5/components/flex.d.ts +1 -1
- package/dist/types-ts4.5/components/grid.d.ts +1 -1
- package/dist/types-ts4.5/components/inline.d.ts +1 -1
- package/dist/types-ts4.5/components/internal/base-box.d.ts +11 -10
- package/dist/types-ts4.5/components/stack.d.ts +1 -1
- package/dist/types-ts4.5/xcss/xcss.d.ts +1 -1
- package/extract-react-types/box-props.tsx +3 -4
- package/package.json +3 -3
- package/report.api.md +20 -33
- package/tmp/api-report-tmp.d.ts +13 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/primitives
|
|
2
2
|
|
|
3
|
+
## 1.0.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`6070ef412be`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6070ef412be) - Box now accepts any HTML element for its `as` prop. Fixed issue where types may be incorrect depending on element used for the `as` prop.
|
|
8
|
+
|
|
3
9
|
## 1.0.6
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -12,8 +12,8 @@ import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
|
12
12
|
directoryName="primitives"
|
|
13
13
|
/>
|
|
14
14
|
|
|
15
|
-
import
|
|
15
|
+
import ERTBleed from '!!extract-react-types-loader!../../extract-react-types/bleed-props'
|
|
16
16
|
|
|
17
17
|
## Props
|
|
18
18
|
|
|
19
|
-
<PropsTable heading="" props={
|
|
19
|
+
<PropsTable heading="" props={ERTBleed} />
|
|
@@ -12,8 +12,8 @@ import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
|
12
12
|
directoryName="primitives"
|
|
13
13
|
/>
|
|
14
14
|
|
|
15
|
-
import
|
|
15
|
+
import ERTBox from '!!extract-react-types-loader!../../extract-react-types/box-props'
|
|
16
16
|
|
|
17
17
|
## Props
|
|
18
18
|
|
|
19
|
-
<PropsTable heading="" props={
|
|
19
|
+
<PropsTable heading="" props={ERTBox} />
|
|
@@ -12,8 +12,8 @@ import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
|
12
12
|
directoryName="primitives"
|
|
13
13
|
/>
|
|
14
14
|
|
|
15
|
-
import
|
|
15
|
+
import ERTFlex from '!!extract-react-types-loader!../../extract-react-types/flex-props'
|
|
16
16
|
|
|
17
17
|
## Props
|
|
18
18
|
|
|
19
|
-
<PropsTable heading="" props={
|
|
19
|
+
<PropsTable heading="" props={ERTFlex} />
|
|
@@ -12,8 +12,8 @@ import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
|
12
12
|
directoryName="primitives"
|
|
13
13
|
/>
|
|
14
14
|
|
|
15
|
-
import
|
|
15
|
+
import ERTGrid from '!!extract-react-types-loader!../../extract-react-types/grid-props'
|
|
16
16
|
|
|
17
17
|
## Props
|
|
18
18
|
|
|
19
|
-
<PropsTable heading="" props={
|
|
19
|
+
<PropsTable heading="" props={ERTGrid} />
|
|
@@ -12,8 +12,8 @@ import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
|
12
12
|
directoryName="primitives"
|
|
13
13
|
/>
|
|
14
14
|
|
|
15
|
-
import
|
|
15
|
+
import ERTInline from '!!extract-react-types-loader!../../extract-react-types/inline-props'
|
|
16
16
|
|
|
17
17
|
## Props
|
|
18
18
|
|
|
19
|
-
<PropsTable heading="" props={
|
|
19
|
+
<PropsTable heading="" props={ERTInline} />
|
|
@@ -12,8 +12,8 @@ import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
|
12
12
|
directoryName="primitives"
|
|
13
13
|
/>
|
|
14
14
|
|
|
15
|
-
import
|
|
15
|
+
import ERTStack from '!!extract-react-types-loader!../../extract-react-types/stack-props'
|
|
16
16
|
|
|
17
17
|
## Props
|
|
18
18
|
|
|
19
|
-
<PropsTable heading="" props={
|
|
19
|
+
<PropsTable heading="" props={ERTStack} />
|
|
@@ -5,15 +5,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
+
var _objectDestructuringEmpty2 = _interopRequireDefault(require("@babel/runtime/helpers/objectDestructuringEmpty"));
|
|
8
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
11
|
var _react = require("react");
|
|
11
12
|
var _react2 = require("@emotion/react");
|
|
12
13
|
var _xcss = require("../xcss/xcss");
|
|
13
14
|
var _baseBox = require("./internal/base-box");
|
|
14
|
-
var _excluded = ["as", "children", "backgroundColor", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "style", "testId", "xcss"]
|
|
15
|
-
_excluded2 = ["className"];
|
|
15
|
+
var _excluded = ["as", "children", "backgroundColor", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "style", "testId", "xcss"];
|
|
16
16
|
/** @jsx jsx */
|
|
17
|
+
// Ideally we'd just Omit className from BaseBoxProps however that isn't working as expected
|
|
18
|
+
// So, we're reconstructing the type: this should be the same as BaseBoxProps minus className
|
|
19
|
+
// TODO: Merge Box and BaseBox so there is only one component. There's probably no need for BaseBox anymore.
|
|
17
20
|
/**
|
|
18
21
|
* __Box__
|
|
19
22
|
*
|
|
@@ -39,8 +42,7 @@ var Box = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
39
42
|
testId = _ref.testId,
|
|
40
43
|
xcss = _ref.xcss,
|
|
41
44
|
htmlAttributes = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
42
|
-
var
|
|
43
|
-
safeHtmlAttributes = (0, _objectWithoutProperties2.default)(htmlAttributes, _excluded2);
|
|
45
|
+
var safeHtmlAttributes = (0, _extends2.default)({}, ((0, _objectDestructuringEmpty2.default)(htmlAttributes), htmlAttributes));
|
|
44
46
|
var className = xcss && (0, _xcss.parseXcss)(xcss);
|
|
45
47
|
return (0, _react2.jsx)(_baseBox.BaseBox, (0, _extends2.default)({
|
|
46
48
|
as: as,
|
|
@@ -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"];
|
|
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,8 +24,7 @@ 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
|
|
28
|
-
as = _ref$as === void 0 ? 'div' : _ref$as,
|
|
27
|
+
var as = _ref.as,
|
|
29
28
|
className = _ref.className,
|
|
30
29
|
children = _ref.children,
|
|
31
30
|
backgroundColor = _ref.backgroundColor,
|
|
@@ -38,9 +37,8 @@ var BaseBox = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
38
37
|
paddingInlineEnd = _ref.paddingInlineEnd,
|
|
39
38
|
style = _ref.style,
|
|
40
39
|
testId = _ref.testId,
|
|
41
|
-
css = _ref.css,
|
|
42
40
|
htmlAttributes = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
43
|
-
var Component = as;
|
|
41
|
+
var Component = as || 'div';
|
|
44
42
|
var node = (0, _react2.jsx)(Component, (0, _extends2.default)({
|
|
45
43
|
style: style,
|
|
46
44
|
ref: ref
|
package/dist/cjs/version.json
CHANGED
|
@@ -4,6 +4,10 @@ import { forwardRef } from 'react';
|
|
|
4
4
|
import { jsx } from '@emotion/react';
|
|
5
5
|
import { parseXcss } from '../xcss/xcss';
|
|
6
6
|
import { BaseBox } from './internal/base-box';
|
|
7
|
+
|
|
8
|
+
// Ideally we'd just Omit className from BaseBoxProps however that isn't working as expected
|
|
9
|
+
// So, we're reconstructing the type: this should be the same as BaseBoxProps minus className
|
|
10
|
+
// TODO: Merge Box and BaseBox so there is only one component. There's probably no need for BaseBox anymore.
|
|
7
11
|
/**
|
|
8
12
|
* __Box__
|
|
9
13
|
*
|
|
@@ -31,7 +35,6 @@ const Box = /*#__PURE__*/forwardRef(({
|
|
|
31
35
|
...htmlAttributes
|
|
32
36
|
}, ref) => {
|
|
33
37
|
const {
|
|
34
|
-
className: spreadClass,
|
|
35
38
|
...safeHtmlAttributes
|
|
36
39
|
} = htmlAttributes;
|
|
37
40
|
const className = xcss && parseXcss(xcss);
|
|
@@ -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,
|
|
20
20
|
className,
|
|
21
21
|
children,
|
|
22
22
|
backgroundColor,
|
|
@@ -29,10 +29,9 @@ export const BaseBox = /*#__PURE__*/forwardRef(({
|
|
|
29
29
|
paddingInlineEnd,
|
|
30
30
|
style,
|
|
31
31
|
testId,
|
|
32
|
-
css,
|
|
33
32
|
...htmlAttributes
|
|
34
33
|
}, ref) => {
|
|
35
|
-
const Component = as;
|
|
34
|
+
const Component = as || 'div';
|
|
36
35
|
const node = jsx(Component, _extends({
|
|
37
36
|
style: style,
|
|
38
37
|
ref: ref
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
import _objectDestructuringEmpty from "@babel/runtime/helpers/objectDestructuringEmpty";
|
|
1
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["as", "children", "backgroundColor", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "style", "testId", "xcss"]
|
|
4
|
-
_excluded2 = ["className"];
|
|
4
|
+
var _excluded = ["as", "children", "backgroundColor", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "style", "testId", "xcss"];
|
|
5
5
|
/** @jsx jsx */
|
|
6
6
|
import { forwardRef } from 'react';
|
|
7
7
|
import { jsx } from '@emotion/react';
|
|
8
8
|
import { parseXcss } from '../xcss/xcss';
|
|
9
9
|
import { BaseBox } from './internal/base-box';
|
|
10
|
+
|
|
11
|
+
// Ideally we'd just Omit className from BaseBoxProps however that isn't working as expected
|
|
12
|
+
// So, we're reconstructing the type: this should be the same as BaseBoxProps minus className
|
|
13
|
+
// TODO: Merge Box and BaseBox so there is only one component. There's probably no need for BaseBox anymore.
|
|
10
14
|
/**
|
|
11
15
|
* __Box__
|
|
12
16
|
*
|
|
@@ -32,8 +36,7 @@ var Box = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
32
36
|
testId = _ref.testId,
|
|
33
37
|
xcss = _ref.xcss,
|
|
34
38
|
htmlAttributes = _objectWithoutProperties(_ref, _excluded);
|
|
35
|
-
var
|
|
36
|
-
safeHtmlAttributes = _objectWithoutProperties(htmlAttributes, _excluded2);
|
|
39
|
+
var safeHtmlAttributes = _extends({}, (_objectDestructuringEmpty(htmlAttributes), htmlAttributes));
|
|
37
40
|
var className = xcss && parseXcss(xcss);
|
|
38
41
|
return jsx(BaseBox, _extends({
|
|
39
42
|
as: as,
|
|
@@ -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"];
|
|
4
4
|
/* eslint-disable @repo/internal/styles/no-exported-styles */
|
|
5
5
|
/** @jsx jsx */
|
|
6
6
|
import { forwardRef } from 'react';
|
|
@@ -18,8 +18,7 @@ import { backgroundColorStylesMap, paddingStylesMap } from '../../xcss/style-map
|
|
|
18
18
|
* @internal
|
|
19
19
|
*/
|
|
20
20
|
export var BaseBox = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
21
|
-
var
|
|
22
|
-
as = _ref$as === void 0 ? 'div' : _ref$as,
|
|
21
|
+
var as = _ref.as,
|
|
23
22
|
className = _ref.className,
|
|
24
23
|
children = _ref.children,
|
|
25
24
|
backgroundColor = _ref.backgroundColor,
|
|
@@ -32,9 +31,8 @@ export var BaseBox = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
32
31
|
paddingInlineEnd = _ref.paddingInlineEnd,
|
|
33
32
|
style = _ref.style,
|
|
34
33
|
testId = _ref.testId,
|
|
35
|
-
css = _ref.css,
|
|
36
34
|
htmlAttributes = _objectWithoutProperties(_ref, _excluded);
|
|
37
|
-
var Component = as;
|
|
35
|
+
var Component = as || 'div';
|
|
38
36
|
var node = jsx(Component, _extends({
|
|
39
37
|
style: style,
|
|
40
38
|
ref: ref
|
package/dist/esm/version.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { ElementType, FC, ReactElement } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
type
|
|
2
|
+
import { ComponentPropsWithoutRef, ElementType, FC, ReactElement } from 'react';
|
|
3
|
+
import { BaseBoxPropsFoundation } from './internal/base-box';
|
|
4
|
+
import { BasePrimitiveProps } from './types';
|
|
5
|
+
export type BoxProps<T extends ElementType> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & BasePrimitiveProps & BaseBoxPropsFoundation<T>;
|
|
6
|
+
type BoxComponent<T extends ElementType = 'div'> = (<T extends ElementType>(props: BoxProps<T>) => ReactElement | null) & FC<BoxProps<T>>;
|
|
6
7
|
/**
|
|
7
8
|
* __Box__
|
|
8
9
|
*
|
|
@@ -133,5 +133,5 @@ declare const Flex: import("react").MemoExoticComponent<import("react").ForwardR
|
|
|
133
133
|
* Forwarded ref element
|
|
134
134
|
*/
|
|
135
135
|
ref?: any;
|
|
136
|
-
} & BasePrimitiveProps, "gap" | "rowGap" | "columnGap" | "alignItems" | "direction" | "justifyContent" | "as" | "children" | keyof BasePrimitiveProps
|
|
136
|
+
} & BasePrimitiveProps, "gap" | "rowGap" | "columnGap" | "alignItems" | "direction" | "justifyContent" | "as" | "children" | "wrap" | keyof BasePrimitiveProps> & import("react").RefAttributes<any>>>;
|
|
137
137
|
export default Flex;
|
|
@@ -191,5 +191,5 @@ declare const Grid: import("react").MemoExoticComponent<import("react").ForwardR
|
|
|
191
191
|
* Forwarded ref element
|
|
192
192
|
*/
|
|
193
193
|
ref?: any;
|
|
194
|
-
} & BasePrimitiveProps, "gap" | "rowGap" | "columnGap" | "alignContent" | "alignItems" | "justifyContent" | "justifyItems" | "as" | "children" | keyof BasePrimitiveProps | "
|
|
194
|
+
} & BasePrimitiveProps, "gap" | "rowGap" | "columnGap" | "alignContent" | "alignItems" | "justifyContent" | "justifyItems" | "as" | "id" | "children" | keyof BasePrimitiveProps | "autoFlow" | "templateAreas" | "templateRows" | "templateColumns"> & import("react").RefAttributes<any>>>;
|
|
195
195
|
export default Grid;
|
|
@@ -113,5 +113,5 @@ declare const Inline: import("react").MemoExoticComponent<import("react").Forwar
|
|
|
113
113
|
* Forwarded ref element
|
|
114
114
|
*/
|
|
115
115
|
ref?: any;
|
|
116
|
-
} & BasePrimitiveProps, "as" | "children" |
|
|
116
|
+
} & BasePrimitiveProps, "as" | "children" | "space" | "separator" | keyof BasePrimitiveProps | "alignInline" | "alignBlock" | "shouldWrap" | "spread" | "grow" | "rowSpace"> & import("react").RefAttributes<any>>>;
|
|
117
117
|
export default Inline;
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { ComponentPropsWithoutRef, ElementType, FC, ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { ComponentPropsWithoutRef, ComponentPropsWithRef, ElementType, FC, ReactElement, ReactNode } from 'react';
|
|
3
3
|
import { BackgroundColor, type Space } from '../../xcss/style-maps.partial';
|
|
4
4
|
import type { BasePrimitiveProps } from '../types';
|
|
5
|
-
export type BaseBoxProps<T extends ElementType
|
|
6
|
-
|
|
7
|
-
type BaseBoxPropsFoundation<T extends ElementType = 'div'> = {
|
|
8
|
-
/**
|
|
9
|
-
* The DOM element to render as the Box. Defaults to `div`.
|
|
10
|
-
*/
|
|
11
|
-
as?: As;
|
|
5
|
+
export type BaseBoxProps<T extends ElementType> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & BasePrimitiveProps & BaseBoxPropsFoundation<T> & ClassName;
|
|
6
|
+
type ClassName = {
|
|
12
7
|
/**
|
|
13
8
|
* The HTML className attribute.
|
|
14
9
|
*
|
|
@@ -21,6 +16,12 @@ type BaseBoxPropsFoundation<T extends ElementType = 'div'> = {
|
|
|
21
16
|
* @see `@atlaskit/eslint-plugin-design-system`
|
|
22
17
|
*/
|
|
23
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;
|
|
24
25
|
/**
|
|
25
26
|
* Elements to be rendered inside the Box.
|
|
26
27
|
*/
|
|
@@ -69,9 +70,9 @@ type BaseBoxPropsFoundation<T extends ElementType = 'div'> = {
|
|
|
69
70
|
/**
|
|
70
71
|
* Forwarded ref element
|
|
71
72
|
*/
|
|
72
|
-
ref?:
|
|
73
|
+
ref?: ComponentPropsWithRef<T>['ref'];
|
|
73
74
|
};
|
|
74
|
-
export type BaseBoxComponent<T extends ElementType = 'div'> = (<T extends ElementType
|
|
75
|
+
export type BaseBoxComponent<T extends ElementType = 'div'> = (<T extends ElementType>(props: BaseBoxProps<T>) => ReactElement | null) & FC<BaseBoxProps<T>>;
|
|
75
76
|
/**
|
|
76
77
|
* __Box__
|
|
77
78
|
*
|
|
@@ -87,5 +87,5 @@ declare const Stack: import("react").MemoExoticComponent<import("react").Forward
|
|
|
87
87
|
* Forwarded ref element
|
|
88
88
|
*/
|
|
89
89
|
ref?: any;
|
|
90
|
-
} & BasePrimitiveProps, "as" | "children" | keyof BasePrimitiveProps | "
|
|
90
|
+
} & BasePrimitiveProps, "as" | "children" | "space" | keyof BasePrimitiveProps | "alignInline" | "alignBlock" | "spread" | "grow"> & import("react").RefAttributes<any>>>;
|
|
91
91
|
export default Stack;
|
|
@@ -43,7 +43,7 @@ type Spacing = 'columnGap' | 'gap' | 'inset' | 'insetBlock' | 'insetBlockEnd' |
|
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
|
45
45
|
export declare function xcss<Primitive extends typeof Box | void = typeof Box>(style: Primitive extends typeof Box ? ScopedSafeCSSObject<AllowedBoxStyles> | ScopedSafeCSSObject<AllowedBoxStyles>[] : Primitive extends void ? ScopedSafeCSSObject<Spacing> | ScopedSafeCSSObject<Spacing>[] : never): {
|
|
46
|
-
readonly [uniqueSymbol]: Primitive extends (<T extends import("react").ElementType<any
|
|
46
|
+
readonly [uniqueSymbol]: Primitive extends (<T extends import("react").ElementType<any>>(props: import("../index").BoxProps<T>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null) & import("react").FC<import("../index").BoxProps<"div">> ? BoxStyles : Primitive extends void ? SpaceStyles : never;
|
|
47
47
|
};
|
|
48
48
|
declare const boxTag: unique symbol;
|
|
49
49
|
declare const spaceTag: unique symbol;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { ElementType, FC, ReactElement } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
type
|
|
2
|
+
import { ComponentPropsWithoutRef, ElementType, FC, ReactElement } from 'react';
|
|
3
|
+
import { BaseBoxPropsFoundation } from './internal/base-box';
|
|
4
|
+
import { BasePrimitiveProps } from './types';
|
|
5
|
+
export type BoxProps<T extends ElementType> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & BasePrimitiveProps & BaseBoxPropsFoundation<T>;
|
|
6
|
+
type BoxComponent<T extends ElementType = 'div'> = (<T extends ElementType>(props: BoxProps<T>) => ReactElement | null) & FC<BoxProps<T>>;
|
|
6
7
|
/**
|
|
7
8
|
* __Box__
|
|
8
9
|
*
|
|
@@ -133,5 +133,5 @@ declare const Flex: import("react").MemoExoticComponent<import("react").ForwardR
|
|
|
133
133
|
* Forwarded ref element
|
|
134
134
|
*/
|
|
135
135
|
ref?: any;
|
|
136
|
-
} & BasePrimitiveProps, "gap" | "rowGap" | "columnGap" | "alignItems" | "direction" | "justifyContent" | "as" | "children" | keyof BasePrimitiveProps
|
|
136
|
+
} & BasePrimitiveProps, "gap" | "rowGap" | "columnGap" | "alignItems" | "direction" | "justifyContent" | "as" | "children" | "wrap" | keyof BasePrimitiveProps> & import("react").RefAttributes<any>>>;
|
|
137
137
|
export default Flex;
|
|
@@ -191,5 +191,5 @@ declare const Grid: import("react").MemoExoticComponent<import("react").ForwardR
|
|
|
191
191
|
* Forwarded ref element
|
|
192
192
|
*/
|
|
193
193
|
ref?: any;
|
|
194
|
-
} & BasePrimitiveProps, "gap" | "rowGap" | "columnGap" | "alignContent" | "alignItems" | "justifyContent" | "justifyItems" | "as" | "children" | keyof BasePrimitiveProps | "
|
|
194
|
+
} & BasePrimitiveProps, "gap" | "rowGap" | "columnGap" | "alignContent" | "alignItems" | "justifyContent" | "justifyItems" | "as" | "id" | "children" | keyof BasePrimitiveProps | "autoFlow" | "templateAreas" | "templateRows" | "templateColumns"> & import("react").RefAttributes<any>>>;
|
|
195
195
|
export default Grid;
|
|
@@ -113,5 +113,5 @@ declare const Inline: import("react").MemoExoticComponent<import("react").Forwar
|
|
|
113
113
|
* Forwarded ref element
|
|
114
114
|
*/
|
|
115
115
|
ref?: any;
|
|
116
|
-
} & BasePrimitiveProps, "as" | "children" |
|
|
116
|
+
} & BasePrimitiveProps, "as" | "children" | "space" | "separator" | keyof BasePrimitiveProps | "alignInline" | "alignBlock" | "shouldWrap" | "spread" | "grow" | "rowSpace"> & import("react").RefAttributes<any>>>;
|
|
117
117
|
export default Inline;
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { ComponentPropsWithoutRef, ElementType, FC, ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { ComponentPropsWithoutRef, ComponentPropsWithRef, ElementType, FC, ReactElement, ReactNode } from 'react';
|
|
3
3
|
import { BackgroundColor, type Space } from '../../xcss/style-maps.partial';
|
|
4
4
|
import type { BasePrimitiveProps } from '../types';
|
|
5
|
-
export type BaseBoxProps<T extends ElementType
|
|
6
|
-
|
|
7
|
-
type BaseBoxPropsFoundation<T extends ElementType = 'div'> = {
|
|
8
|
-
/**
|
|
9
|
-
* The DOM element to render as the Box. Defaults to `div`.
|
|
10
|
-
*/
|
|
11
|
-
as?: As;
|
|
5
|
+
export type BaseBoxProps<T extends ElementType> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & BasePrimitiveProps & BaseBoxPropsFoundation<T> & ClassName;
|
|
6
|
+
type ClassName = {
|
|
12
7
|
/**
|
|
13
8
|
* The HTML className attribute.
|
|
14
9
|
*
|
|
@@ -21,6 +16,12 @@ type BaseBoxPropsFoundation<T extends ElementType = 'div'> = {
|
|
|
21
16
|
* @see `@atlaskit/eslint-plugin-design-system`
|
|
22
17
|
*/
|
|
23
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;
|
|
24
25
|
/**
|
|
25
26
|
* Elements to be rendered inside the Box.
|
|
26
27
|
*/
|
|
@@ -69,9 +70,9 @@ type BaseBoxPropsFoundation<T extends ElementType = 'div'> = {
|
|
|
69
70
|
/**
|
|
70
71
|
* Forwarded ref element
|
|
71
72
|
*/
|
|
72
|
-
ref?:
|
|
73
|
+
ref?: ComponentPropsWithRef<T>['ref'];
|
|
73
74
|
};
|
|
74
|
-
export type BaseBoxComponent<T extends ElementType = 'div'> = (<T extends ElementType
|
|
75
|
+
export type BaseBoxComponent<T extends ElementType = 'div'> = (<T extends ElementType>(props: BaseBoxProps<T>) => ReactElement | null) & FC<BaseBoxProps<T>>;
|
|
75
76
|
/**
|
|
76
77
|
* __Box__
|
|
77
78
|
*
|
|
@@ -87,5 +87,5 @@ declare const Stack: import("react").MemoExoticComponent<import("react").Forward
|
|
|
87
87
|
* Forwarded ref element
|
|
88
88
|
*/
|
|
89
89
|
ref?: any;
|
|
90
|
-
} & BasePrimitiveProps, "as" | "children" | keyof BasePrimitiveProps | "
|
|
90
|
+
} & BasePrimitiveProps, "as" | "children" | "space" | keyof BasePrimitiveProps | "alignInline" | "alignBlock" | "spread" | "grow"> & import("react").RefAttributes<any>>>;
|
|
91
91
|
export default Stack;
|
|
@@ -43,7 +43,7 @@ type Spacing = 'columnGap' | 'gap' | 'inset' | 'insetBlock' | 'insetBlockEnd' |
|
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
|
45
45
|
export declare function xcss<Primitive extends typeof Box | void = typeof Box>(style: Primitive extends typeof Box ? ScopedSafeCSSObject<AllowedBoxStyles> | ScopedSafeCSSObject<AllowedBoxStyles>[] : Primitive extends void ? ScopedSafeCSSObject<Spacing> | ScopedSafeCSSObject<Spacing>[] : never): {
|
|
46
|
-
readonly [uniqueSymbol]: Primitive extends (<T extends import("react").ElementType<any
|
|
46
|
+
readonly [uniqueSymbol]: Primitive extends (<T extends import("react").ElementType<any>>(props: import("../index").BoxProps<T>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null) & import("react").FC<import("../index").BoxProps<"div">> ? BoxStyles : Primitive extends void ? SpaceStyles : never;
|
|
47
47
|
};
|
|
48
48
|
declare const boxTag: unique symbol;
|
|
49
49
|
declare const spaceTag: unique symbol;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// TODO: Switch from ERT to ts-morph when this is completed and has reasonable adoption: https://product-fabric.atlassian.net/browse/DSP-10364
|
|
2
|
-
import React, { ReactNode } from 'react';
|
|
2
|
+
import React, { ElementType, ReactNode } from 'react';
|
|
3
3
|
|
|
4
|
-
import { As } from '../src/components/internal/base-box';
|
|
5
4
|
import { BasePrimitiveProps } from '../src/components/types';
|
|
6
5
|
|
|
7
6
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
@@ -31,7 +30,7 @@ export default function Box(
|
|
|
31
30
|
/**
|
|
32
31
|
* The DOM element to render as the Box. Defaults to `div`.
|
|
33
32
|
*/
|
|
34
|
-
as?:
|
|
33
|
+
as?: ElementType;
|
|
35
34
|
|
|
36
35
|
/**
|
|
37
36
|
* Tokens representing CSS shorthand for `paddingBlock` and `paddingInline` together.
|
|
@@ -82,6 +81,6 @@ export default function Box(
|
|
|
82
81
|
/**
|
|
83
82
|
* Forwarded ref element.
|
|
84
83
|
*/
|
|
85
|
-
ref?: React.ComponentPropsWithRef<
|
|
84
|
+
ref?: React.ComponentPropsWithRef<ElementType>['ref'];
|
|
86
85
|
} & BasePrimitiveProps,
|
|
87
86
|
) {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/primitives",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "Primitives are token-backed low-level building blocks.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"sideEffects": false,
|
|
16
16
|
"atlaskit:src": "src/index.tsx",
|
|
17
17
|
"atlassian": {
|
|
18
|
-
"team": "Design System
|
|
18
|
+
"team": "Design System Pyxis",
|
|
19
19
|
"inPublicMirror": false,
|
|
20
20
|
"releaseModel": "continuous",
|
|
21
21
|
"website": {
|
|
@@ -181,4 +181,4 @@
|
|
|
181
181
|
"./responsive": "./src/responsive/index.tsx"
|
|
182
182
|
},
|
|
183
183
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
|
|
184
|
-
}
|
|
184
|
+
}
|
package/report.api.md
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
/// <reference types="react" />
|
|
19
19
|
|
|
20
20
|
import { ComponentPropsWithoutRef } from 'react';
|
|
21
|
+
import { ComponentPropsWithRef } from 'react';
|
|
21
22
|
import type * as CSS_2 from 'csstype';
|
|
22
23
|
import type { CSSProperties } from 'react';
|
|
23
24
|
import type { CSSPropertiesWithMultiValues } from '@emotion/serialize';
|
|
@@ -85,23 +86,6 @@ const alignItemsMap_2: {
|
|
|
85
86
|
// @public (undocumented)
|
|
86
87
|
type AllowedBoxStyles = keyof SafeCSSObject;
|
|
87
88
|
|
|
88
|
-
// @public (undocumented)
|
|
89
|
-
type As =
|
|
90
|
-
| 'article'
|
|
91
|
-
| 'aside'
|
|
92
|
-
| 'button'
|
|
93
|
-
| 'dialog'
|
|
94
|
-
| 'div'
|
|
95
|
-
| 'footer'
|
|
96
|
-
| 'header'
|
|
97
|
-
| 'li'
|
|
98
|
-
| 'main'
|
|
99
|
-
| 'nav'
|
|
100
|
-
| 'ol'
|
|
101
|
-
| 'section'
|
|
102
|
-
| 'span'
|
|
103
|
-
| 'ul';
|
|
104
|
-
|
|
105
89
|
// @public (undocumented)
|
|
106
90
|
type AutoComplete<T extends string> = Omit<string, T> | T;
|
|
107
91
|
|
|
@@ -230,17 +214,17 @@ const backgroundColorMap: {
|
|
|
230
214
|
};
|
|
231
215
|
|
|
232
216
|
// @public (undocumented)
|
|
233
|
-
type BaseBoxProps<T extends ElementType
|
|
217
|
+
type BaseBoxProps<T extends ElementType> = Omit<
|
|
234
218
|
ComponentPropsWithoutRef<T>,
|
|
235
219
|
'as' | 'className'
|
|
236
220
|
> &
|
|
237
221
|
BasePrimitiveProps &
|
|
238
|
-
BaseBoxPropsFoundation<T
|
|
222
|
+
BaseBoxPropsFoundation<T> &
|
|
223
|
+
ClassName;
|
|
239
224
|
|
|
240
225
|
// @public (undocumented)
|
|
241
|
-
type BaseBoxPropsFoundation<T extends ElementType
|
|
242
|
-
as?:
|
|
243
|
-
className?: string;
|
|
226
|
+
type BaseBoxPropsFoundation<T extends ElementType> = {
|
|
227
|
+
as?: T;
|
|
244
228
|
children?: ReactNode;
|
|
245
229
|
backgroundColor?: BackgroundColor;
|
|
246
230
|
padding?: Space;
|
|
@@ -250,7 +234,7 @@ type BaseBoxPropsFoundation<T extends ElementType = 'div'> = {
|
|
|
250
234
|
paddingInline?: Space;
|
|
251
235
|
paddingInlineStart?: Space;
|
|
252
236
|
paddingInlineEnd?: Space;
|
|
253
|
-
ref?:
|
|
237
|
+
ref?: ComponentPropsWithRef<T>['ref'];
|
|
254
238
|
};
|
|
255
239
|
|
|
256
240
|
// @public (undocumented)
|
|
@@ -340,18 +324,18 @@ const borderWidthMap: {
|
|
|
340
324
|
export const Box: BoxComponent;
|
|
341
325
|
|
|
342
326
|
// @public (undocumented)
|
|
343
|
-
type BoxComponent<T extends ElementType = 'div'> = (<
|
|
344
|
-
T extends ElementType = 'div',
|
|
345
|
-
>(
|
|
327
|
+
type BoxComponent<T extends ElementType = 'div'> = (<T extends ElementType>(
|
|
346
328
|
props: BoxProps<T>,
|
|
347
329
|
) => ReactElement | null) &
|
|
348
330
|
FC<BoxProps<T>>;
|
|
349
331
|
|
|
350
332
|
// @public (undocumented)
|
|
351
|
-
export type BoxProps<T extends ElementType
|
|
352
|
-
|
|
353
|
-
'className'
|
|
354
|
-
|
|
333
|
+
export type BoxProps<T extends ElementType> = Omit<
|
|
334
|
+
ComponentPropsWithoutRef<T>,
|
|
335
|
+
'as' | 'className'
|
|
336
|
+
> &
|
|
337
|
+
BasePrimitiveProps &
|
|
338
|
+
BaseBoxPropsFoundation<T>;
|
|
355
339
|
|
|
356
340
|
// @public (undocumented)
|
|
357
341
|
type BoxStyles = SerializedStyles & {
|
|
@@ -372,6 +356,11 @@ type BoxXCSS =
|
|
|
372
356
|
// @public
|
|
373
357
|
export type Breakpoint = 'lg' | 'md' | 'sm' | 'xl' | 'xs' | 'xxs';
|
|
374
358
|
|
|
359
|
+
// @public (undocumented)
|
|
360
|
+
type ClassName = {
|
|
361
|
+
className?: string;
|
|
362
|
+
};
|
|
363
|
+
|
|
375
364
|
// @public (undocumented)
|
|
376
365
|
type CSSMediaQueries = {
|
|
377
366
|
[MQ in MediaQuery]?: Omit<SafeCSSObject, MediaQuery>;
|
|
@@ -1147,9 +1136,7 @@ export function xcss<Primitive extends typeof Box | void = typeof Box>(
|
|
|
1147
1136
|
? ScopedSafeCSSObject<Spacing> | ScopedSafeCSSObject<Spacing>[]
|
|
1148
1137
|
: never,
|
|
1149
1138
|
): {
|
|
1150
|
-
readonly [uniqueSymbol]: Primitive extends (<
|
|
1151
|
-
T extends ElementType<any> = 'div',
|
|
1152
|
-
>(
|
|
1139
|
+
readonly [uniqueSymbol]: Primitive extends (<T extends ElementType<any>>(
|
|
1153
1140
|
props: BoxProps<T>,
|
|
1154
1141
|
) => ReactElement<any, JSXElementConstructor<any> | string> | null) &
|
|
1155
1142
|
FC<BoxProps<'div'>>
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
/// <reference types="react" />
|
|
8
8
|
|
|
9
9
|
import { ComponentPropsWithoutRef } from 'react';
|
|
10
|
+
import { ComponentPropsWithRef } from 'react';
|
|
10
11
|
import type * as CSS_2 from 'csstype';
|
|
11
12
|
import type { CSSProperties } from 'react';
|
|
12
13
|
import type { CSSPropertiesWithMultiValues } from '@emotion/serialize';
|
|
@@ -74,9 +75,6 @@ const alignItemsMap_2: {
|
|
|
74
75
|
// @public (undocumented)
|
|
75
76
|
type AllowedBoxStyles = keyof SafeCSSObject;
|
|
76
77
|
|
|
77
|
-
// @public (undocumented)
|
|
78
|
-
type As = 'article' | 'aside' | 'button' | 'dialog' | 'div' | 'footer' | 'header' | 'li' | 'main' | 'nav' | 'ol' | 'section' | 'span' | 'ul';
|
|
79
|
-
|
|
80
78
|
// @public (undocumented)
|
|
81
79
|
type AutoComplete<T extends string> = Omit<string, T> | T;
|
|
82
80
|
|
|
@@ -205,12 +203,11 @@ const backgroundColorMap: {
|
|
|
205
203
|
};
|
|
206
204
|
|
|
207
205
|
// @public (undocumented)
|
|
208
|
-
type BaseBoxProps<T extends ElementType
|
|
206
|
+
type BaseBoxProps<T extends ElementType> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & BasePrimitiveProps & BaseBoxPropsFoundation<T> & ClassName;
|
|
209
207
|
|
|
210
208
|
// @public (undocumented)
|
|
211
|
-
type BaseBoxPropsFoundation<T extends ElementType
|
|
212
|
-
as?:
|
|
213
|
-
className?: string;
|
|
209
|
+
type BaseBoxPropsFoundation<T extends ElementType> = {
|
|
210
|
+
as?: T;
|
|
214
211
|
children?: ReactNode;
|
|
215
212
|
backgroundColor?: BackgroundColor;
|
|
216
213
|
padding?: Space;
|
|
@@ -220,7 +217,7 @@ type BaseBoxPropsFoundation<T extends ElementType = 'div'> = {
|
|
|
220
217
|
paddingInline?: Space;
|
|
221
218
|
paddingInlineStart?: Space;
|
|
222
219
|
paddingInlineEnd?: Space;
|
|
223
|
-
ref?:
|
|
220
|
+
ref?: ComponentPropsWithRef<T>['ref'];
|
|
224
221
|
};
|
|
225
222
|
|
|
226
223
|
// @public (undocumented)
|
|
@@ -301,10 +298,10 @@ const borderWidthMap: {
|
|
|
301
298
|
export const Box: BoxComponent;
|
|
302
299
|
|
|
303
300
|
// @public (undocumented)
|
|
304
|
-
type BoxComponent<T extends ElementType = 'div'> = (<T extends ElementType
|
|
301
|
+
type BoxComponent<T extends ElementType = 'div'> = (<T extends ElementType>(props: BoxProps<T>) => ReactElement | null) & FC<BoxProps<T>>;
|
|
305
302
|
|
|
306
303
|
// @public (undocumented)
|
|
307
|
-
export type BoxProps<T extends ElementType
|
|
304
|
+
export type BoxProps<T extends ElementType> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & BasePrimitiveProps & BaseBoxPropsFoundation<T>;
|
|
308
305
|
|
|
309
306
|
// @public (undocumented)
|
|
310
307
|
type BoxStyles = SerializedStyles & {
|
|
@@ -322,6 +319,11 @@ type BoxXCSS = false | undefined | {
|
|
|
322
319
|
// @public
|
|
323
320
|
export type Breakpoint = 'lg' | 'md' | 'sm' | 'xl' | 'xs' | 'xxs';
|
|
324
321
|
|
|
322
|
+
// @public (undocumented)
|
|
323
|
+
type ClassName = {
|
|
324
|
+
className?: string;
|
|
325
|
+
};
|
|
326
|
+
|
|
325
327
|
// @public (undocumented)
|
|
326
328
|
type CSSMediaQueries = {
|
|
327
329
|
[MQ in MediaQuery]?: Omit<SafeCSSObject, MediaQuery>;
|
|
@@ -800,7 +802,7 @@ type Wrap = keyof typeof flexWrapMap;
|
|
|
800
802
|
|
|
801
803
|
// @public
|
|
802
804
|
export function xcss<Primitive extends typeof Box | void = typeof Box>(style: Primitive extends typeof Box ? ScopedSafeCSSObject<AllowedBoxStyles> | ScopedSafeCSSObject<AllowedBoxStyles>[] : Primitive extends void ? ScopedSafeCSSObject<Spacing> | ScopedSafeCSSObject<Spacing>[] : never): {
|
|
803
|
-
readonly [uniqueSymbol]: Primitive extends (<T extends ElementType<any
|
|
805
|
+
readonly [uniqueSymbol]: Primitive extends (<T extends ElementType<any>>(props: BoxProps<T>) => ReactElement<any, JSXElementConstructor<any>| string> | null) & FC<BoxProps<"div">> ? BoxStyles : Primitive extends void ? SpaceStyles : never;
|
|
804
806
|
};
|
|
805
807
|
|
|
806
808
|
// (No @packageDocumentation comment for this package)
|