@atlaskit/primitives 1.0.5 → 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.
Files changed (52) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/constellation/bleed/code.mdx +2 -2
  3. package/constellation/bleed/example.mdx +2 -0
  4. package/constellation/box/code.mdx +2 -2
  5. package/constellation/box/examples.mdx +6 -0
  6. package/constellation/flex/code.mdx +2 -2
  7. package/constellation/flex/examples.mdx +7 -2
  8. package/constellation/grid/code.mdx +2 -2
  9. package/constellation/grid/examples.mdx +3 -0
  10. package/constellation/inline/code.mdx +2 -2
  11. package/constellation/inline/examples.mdx +6 -0
  12. package/constellation/overview/index.mdx +12 -15
  13. package/constellation/responsive/01-show/code.mdx +19 -0
  14. package/constellation/responsive/02-hide/code.mdx +19 -0
  15. package/constellation/stack/code.mdx +2 -2
  16. package/constellation/stack/examples.mdx +5 -0
  17. package/dist/cjs/components/box.js +6 -4
  18. package/dist/cjs/components/inline.js +1 -2
  19. package/dist/cjs/components/internal/base-box.js +3 -5
  20. package/dist/cjs/version.json +1 -1
  21. package/dist/es2019/components/box.js +4 -1
  22. package/dist/es2019/components/inline.js +1 -2
  23. package/dist/es2019/components/internal/base-box.js +2 -3
  24. package/dist/es2019/version.json +1 -1
  25. package/dist/esm/components/box.js +7 -4
  26. package/dist/esm/components/inline.js +1 -2
  27. package/dist/esm/components/internal/base-box.js +3 -5
  28. package/dist/esm/version.json +1 -1
  29. package/dist/types/components/box.d.ts +5 -4
  30. package/dist/types/components/flex.d.ts +1 -1
  31. package/dist/types/components/grid.d.ts +1 -1
  32. package/dist/types/components/inline.d.ts +2 -3
  33. package/dist/types/components/internal/base-box.d.ts +11 -10
  34. package/dist/types/components/stack.d.ts +1 -1
  35. package/dist/types/responsive/hide.d.ts +8 -10
  36. package/dist/types/responsive/show.d.ts +8 -10
  37. package/dist/types/xcss/xcss.d.ts +1 -1
  38. package/dist/types-ts4.5/components/box.d.ts +5 -4
  39. package/dist/types-ts4.5/components/flex.d.ts +1 -1
  40. package/dist/types-ts4.5/components/grid.d.ts +1 -1
  41. package/dist/types-ts4.5/components/inline.d.ts +2 -3
  42. package/dist/types-ts4.5/components/internal/base-box.d.ts +11 -10
  43. package/dist/types-ts4.5/components/stack.d.ts +1 -1
  44. package/dist/types-ts4.5/responsive/hide.d.ts +8 -10
  45. package/dist/types-ts4.5/responsive/show.d.ts +8 -10
  46. package/dist/types-ts4.5/xcss/xcss.d.ts +1 -1
  47. package/extract-react-types/box-props.tsx +3 -4
  48. package/extract-react-types/hide-props.tsx +48 -0
  49. package/extract-react-types/show-props.tsx +48 -0
  50. package/package.json +3 -3
  51. package/report.api.md +20 -33
  52. package/tmp/api-report-tmp.d.ts +13 -11
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
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
+
9
+ ## 1.0.6
10
+
11
+ ### Patch Changes
12
+
13
+ - [`aa8ec75ace3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/aa8ec75ace3) - Simplify types for `Show` and `Hide` components. There should be no difference in behavior.
14
+
3
15
  ## 1.0.5
4
16
 
5
17
  ### Patch Changes
@@ -12,8 +12,8 @@ import { CodeDocsHeader } from '@af/design-system-docs-ui';
12
12
  directoryName="primitives"
13
13
  />
14
14
 
15
- import BleedProps from '!!extract-react-types-loader!../../extract-react-types/bleed-props'
15
+ import ERTBleed from '!!extract-react-types-loader!../../extract-react-types/bleed-props'
16
16
 
17
17
  ## Props
18
18
 
19
- <PropsTable heading="" props={BleedProps} />
19
+ <PropsTable heading="" props={ERTBleed} />
@@ -36,11 +36,13 @@ each avatar to overlap its direct sibling and create our desired stack.
36
36
  ## Block whitespace
37
37
 
38
38
  Bleed can be controlled on the block axis (vertical) with the `block` property. The values of this property are tied to our spacing scale.
39
+ Note, in the context of a flex container bleed will collapse the whitespace around its child element.
39
40
 
40
41
  <Example Component={BleedBlock} packageName="@atlaskit/primitives/bleed" />
41
42
 
42
43
  ## Inline whitespace
43
44
 
44
45
  Bleed can also be controlled on the inline axis (horizontal) with the `inline` property. The values of this property are tied to our spacing scale.
46
+ Note, in the context of a flex container bleed will collapse the whitespace around its child element.
45
47
 
46
48
  <Example Component={BleedInline} packageName="@atlaskit/primitives/bleed" />
@@ -12,8 +12,8 @@ import { CodeDocsHeader } from '@af/design-system-docs-ui';
12
12
  directoryName="primitives"
13
13
  />
14
14
 
15
- import BoxProps from '!!extract-react-types-loader!../../extract-react-types/box-props'
15
+ import ERTBox from '!!extract-react-types-loader!../../extract-react-types/box-props'
16
16
 
17
17
  ## Props
18
18
 
19
- <PropsTable heading="" props={BoxProps} />
19
+ <PropsTable heading="" props={ERTBox} />
@@ -8,6 +8,8 @@ import BoxBasic from '../../examples/constellation/box/basic';
8
8
  import BoxPadding from '../../examples/constellation/box/padding';
9
9
  import BoxBackgroundColor from '../../examples/constellation/box/background-color';
10
10
  import BoxXcss from '../../examples/constellation/box/xcss';
11
+ import PracticalUseCase from '../../examples/constellation/box/practical-use-case';
12
+
11
13
  import { CodeDocsHeader } from '@af/design-system-docs-ui';
12
14
 
13
15
  <CodeDocsHeader
@@ -43,3 +45,7 @@ Box also exposes an `xcss` prop. This prop can take `xcss` function calls that c
43
45
  <Example Component={BoxXcss} packageName="@atlaskit/primitives/box" />
44
46
 
45
47
  For more information on xCSS, see the dedicated [xCSS](/components/primitives/xcss) documentation.
48
+
49
+ ## Practical Use Case
50
+
51
+ <Example Component={PracticalUseCase} packageName="@atlaskit/primitives/box" />
@@ -12,8 +12,8 @@ import { CodeDocsHeader } from '@af/design-system-docs-ui';
12
12
  directoryName="primitives"
13
13
  />
14
14
 
15
- import FlexProps from '!!extract-react-types-loader!../../extract-react-types/flex-props'
15
+ import ERTFlex from '!!extract-react-types-loader!../../extract-react-types/flex-props'
16
16
 
17
17
  ## Props
18
18
 
19
- <PropsTable heading="" props={FlexProps} />
19
+ <PropsTable heading="" props={ERTFlex} />
@@ -21,11 +21,16 @@ import { CodeDocsHeader } from '@af/design-system-docs-ui';
21
21
  ## Basic
22
22
 
23
23
  The `Flex` component is designed as a very basic mapping to the CSS Flexbox API.
24
- It can be used as a less richly-configured `Inline` or `Stack`.
24
+ It can be used as a less richly-configured `Inline` or `Stack`. Like `Stack` and `Inline`
25
+ `Flex` exclusively supports token-backed `gap` properties to ensure layouts using `Flex` match
26
+ the Atlassian Design System spacing scale.
25
27
 
26
28
  <Example Component={FlexJustifyContent} packageName="@atlaskit/primitives/flex" />
27
29
 
28
- ## Align items
30
+ ## Align items and justify content
31
+
32
+ `Flex` applies the `alignItems` and `justifyContent` properties to align content
33
+ along its cross and main axes respectively.
29
34
 
30
35
  <Example Component={FlexAlignItems} packageName="@atlaskit/primitives/flex" />
31
36
 
@@ -12,8 +12,8 @@ import { CodeDocsHeader } from '@af/design-system-docs-ui';
12
12
  directoryName="primitives"
13
13
  />
14
14
 
15
- import BoxProps from '!!extract-react-types-loader!../../extract-react-types/grid-props'
15
+ import ERTGrid from '!!extract-react-types-loader!../../extract-react-types/grid-props'
16
16
 
17
17
  ## Props
18
18
 
19
- <PropsTable heading="" props={BoxProps} />
19
+ <PropsTable heading="" props={ERTGrid} />
@@ -44,3 +44,6 @@ Grid-prefixed properties in CSS do not have this prefix in the component API. `g
44
44
 
45
45
  <Example Component={GridAutoFlow} packageName="@atlaskit/primitives/grid" />
46
46
 
47
+ You may also be looking for:
48
+ * [responsive layout grid](/components/grid)
49
+ * [legacy page grid](/components/page/grid)
@@ -12,8 +12,8 @@ import { CodeDocsHeader } from '@af/design-system-docs-ui';
12
12
  directoryName="primitives"
13
13
  />
14
14
 
15
- import InlineProps from '!!extract-react-types-loader!../../extract-react-types/inline-props'
15
+ import ERTInline from '!!extract-react-types-loader!../../extract-react-types/inline-props'
16
16
 
17
17
  ## Props
18
18
 
19
- <PropsTable heading="" props={InlineProps} />
19
+ <PropsTable heading="" props={ERTInline} />
@@ -14,6 +14,7 @@ import InlineWrap from '../../examples/constellation/inline/wrap';
14
14
  import InlineSeparator from '../../examples/constellation/inline/separator';
15
15
  import InlineGrow from '../../examples/constellation/inline/grow';
16
16
  import InlineAs from '../../examples/constellation/inline/as';
17
+ import InlinePracticalUseCase from '../../examples/constellation/inline/practical-use-case';
17
18
 
18
19
  import { CodeDocsHeader } from '@af/design-system-docs-ui';
19
20
 
@@ -23,6 +24,7 @@ import { CodeDocsHeader } from '@af/design-system-docs-ui';
23
24
  directoryName="primitives"
24
25
  />
25
26
 
27
+
26
28
  ## Basic
27
29
 
28
30
  Inline is an abstraction to efficiently lay-out a group of elements horizontally.
@@ -89,3 +91,7 @@ To control that the `grow` prop can be used with the values:
89
91
  It's possible to control the rendered HTML element with the `as` prop.
90
92
 
91
93
  <Example Component={InlineAs} packageName="@atlaskit/primitives/inline" />
94
+
95
+ ## Practical Use Case
96
+
97
+ <Example Component={InlinePracticalUseCase} packageName="@atlaskit/primitives/inline" />
@@ -19,19 +19,18 @@ import { CodeDocsHeader } from '@af/design-system-docs-ui';
19
19
  directoryName="primitives"
20
20
  />
21
21
 
22
- Primitive components are a new type of component for layouts and placement of elements.
23
- They act as building blocks to compose different parts of the user experience,
22
+ Primitives are a new type of component for layouts and the placement of elements.
23
+ They act as simple building blocks to compose different parts of the user experience,
24
24
  from the smallest design decisions (for example, the spacing around an icon) to larger layout decisions (for example, how a page is structured).
25
25
 
26
- Primitives are designed to work hand in hand with design tokens,
27
- to provide opinionated solutions for common low-level design decisions that engineers often have to make.
28
- They are designed to reduce cognitive overhead for engineers by providing guardrails around what is recommended within our design system.
29
-
30
- A primitive component is a pre-built solution in that they will only accept values that are valid in the Atlassian Design System, and help to implement common layout patterns. This reduces the need to look up documentation and write custom CSS.
26
+ Primitives are a combination of design tokens that go a step further.
27
+ These are component-like abstractions powered by design tokens that add a layer of ergonomics and accessibility. Tokens are great at describing the what of a design decision;
28
+ primitives make it easier to reason about the when and how. This reduces cognitive overhead and prevents accidents or mistakes.
31
29
 
32
30
  ## Available Primitives
33
31
 
34
- Each primitive is designed to have a single responsibility, and it should be immediately clear where each primitive should be used. However, they are also flexible enough that they should be able to be used to compose complex designs not otherwise covered in the Design Systems.
32
+ Each primitive is designed to have a single responsibility, and it should be immediately clear where and when each primitive should be used.
33
+ However, they are also flexible enough that they should be able to be used together to compose complex designs not otherwise implemented directly in the Design Systems.
35
34
 
36
35
  Currently, three core primitive components are available - Box, Inline and Stack. A large amount of layout problems can be reduced to laying out content:
37
36
  - in a container (see [box](/components/primitives/box))
@@ -41,7 +40,7 @@ Currently, three core primitive components are available - Box, Inline and Stack
41
40
  Additional layouts not well-expressed by these core primitives can also be composed using:
42
41
  - CSS Flexbox (see [flex](/components/primitives/flex))
43
42
  - CSS Grid (see [grid](/components/primitives/grid))
44
- - Divider (see [divider](/components/primitives/divider))
43
+ - Bleed (see [bleed](/components/primitives/bleed))
45
44
 
46
45
  ## Installation
47
46
 
@@ -52,15 +51,13 @@ $ yarn add @atlaskit/primitives
52
51
 
53
52
  ## Using Primitives
54
53
 
55
- Use primitives for general layout styles for components.
54
+ Use primitives for composing layouts.
56
55
  Primitives are not currently available in Figma, so the first step in implementing primitive components is identifying where they might fit in a given design.
57
56
  This involves breaking down a design into its core layout components to as granular level as is useful.
58
57
 
59
- <SectionMessage appearance="warning">
60
- Primitives should be avoided where absolute DOM control is required or very specific styling values are needed, however, this approach is more likely to produce visual elements that fail to adhere to the guidelines of the Atlassian Design System.
61
- </SectionMessage>
62
-
63
- You might like to think first about breaking down a page into `Box` containers, identifying larger pieces of a design that function in a similar manner or fulfill a singular purpose in a layout and grouping them together under a Box.
58
+ You might like to think first about breaking down a page into `Box` containers,
59
+ identifying larger pieces of a design that function in a similar manner or fulfill a singular purpose
60
+ in a layout and grouping them together under a Box.
64
61
 
65
62
  <Image src={boxUsageExample} />
66
63
 
@@ -0,0 +1,19 @@
1
+ ---
2
+ title: Show
3
+ description: Show is a responsive primitive that displays children at specified breakpoints
4
+ order: 2
5
+ ---
6
+
7
+ import { CodeDocsHeader } from '@af/design-system-docs-ui';
8
+
9
+ <CodeDocsHeader
10
+ name="@atlaskit/primitives"
11
+ repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
12
+ directoryName="primitives"
13
+ />
14
+
15
+ import ShowProps from '!!extract-react-types-loader!../../../extract-react-types/show-props'
16
+
17
+ ## Props
18
+
19
+ <PropsTable heading="" props={ShowProps} />
@@ -0,0 +1,19 @@
1
+ ---
2
+ title: Hide
3
+ description: Hide is a responsive primitive that hides children at specified breakpoints
4
+ order: 2
5
+ ---
6
+
7
+ import { CodeDocsHeader } from '@af/design-system-docs-ui';
8
+
9
+ <CodeDocsHeader
10
+ name="@atlaskit/primitives"
11
+ repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
12
+ directoryName="primitives"
13
+ />
14
+
15
+ import HideProps from '!!extract-react-types-loader!../../../extract-react-types/hide-props'
16
+
17
+ ## Props
18
+
19
+ <PropsTable heading="" props={HideProps} />
@@ -12,8 +12,8 @@ import { CodeDocsHeader } from '@af/design-system-docs-ui';
12
12
  directoryName="primitives"
13
13
  />
14
14
 
15
- import StackProps from '!!extract-react-types-loader!../../extract-react-types/stack-props'
15
+ import ERTStack from '!!extract-react-types-loader!../../extract-react-types/stack-props'
16
16
 
17
17
  ## Props
18
18
 
19
- <PropsTable heading="" props={StackProps} />
19
+ <PropsTable heading="" props={ERTStack} />
@@ -5,6 +5,7 @@ order: 0
5
5
  ---
6
6
 
7
7
  import StackBasic from '../../examples/constellation/stack/basic';
8
+ import PracticalUseCase from '../../examples/constellation/stack/practical-use-case';
8
9
  import StackSpaceBasic from '../../examples/constellation/stack/space-basic';
9
10
  import StackAlignBlock from '../../examples/constellation/stack/align-block';
10
11
  import StackAlignInline from '../../examples/constellation/stack/align-inline';
@@ -68,3 +69,7 @@ To control that the `grow` prop can be used with the values:
68
69
  It's possible to control the rendered HTML element with the `as` prop.
69
70
 
70
71
  <Example Component={StackAs} packageName="@atlaskit/primitives/stack" />
72
+
73
+ ## Practical Use Case
74
+
75
+ <Example Component={PracticalUseCase} packageName="@atlaskit/primitives/stack" />
@@ -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 spreadClass = htmlAttributes.className,
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,
@@ -39,8 +39,7 @@ var Separator = function Separator(_ref) {
39
39
  /**
40
40
  * __Inline__
41
41
  *
42
- * Inline is a primitive component based on flexbox that manages the horizontal layout of direct children.
43
- *
42
+ * Inline is a primitive component based on CSS Flexbox that manages the horizontal layout of direct children.
44
43
  *
45
44
  * @example
46
45
  * ```tsx
@@ -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", "css"];
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 _ref$as = _ref.as,
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
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "sideEffects": false
5
5
  }
@@ -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);
@@ -29,8 +29,7 @@ const Separator = ({
29
29
  /**
30
30
  * __Inline__
31
31
  *
32
- * Inline is a primitive component based on flexbox that manages the horizontal layout of direct children.
33
- *
32
+ * Inline is a primitive component based on CSS Flexbox that manages the horizontal layout of direct children.
34
33
  *
35
34
  * @example
36
35
  * ```tsx
@@ -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 = 'div',
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
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "sideEffects": false
5
5
  }
@@ -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 spreadClass = htmlAttributes.className,
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,
@@ -31,8 +31,7 @@ var Separator = function Separator(_ref) {
31
31
  /**
32
32
  * __Inline__
33
33
  *
34
- * Inline is a primitive component based on flexbox that manages the horizontal layout of direct children.
35
- *
34
+ * Inline is a primitive component based on CSS Flexbox that manages the horizontal layout of direct children.
36
35
  *
37
36
  * @example
38
37
  * ```tsx
@@ -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", "css"];
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 _ref$as = _ref.as,
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
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "sideEffects": false
5
5
  }
@@ -1,8 +1,9 @@
1
1
  /** @jsx jsx */
2
- import { ElementType, FC, ReactElement } from 'react';
3
- import { BaseBoxProps } from './internal/base-box';
4
- export type BoxProps<T extends ElementType = 'div'> = Omit<BaseBoxProps<T>, 'className'>;
5
- type BoxComponent<T extends ElementType = 'div'> = (<T extends ElementType = 'div'>(props: BoxProps<T>) => ReactElement | null) & FC<BoxProps<T>>;
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 | "wrap"> & import("react").RefAttributes<any>>>;
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 | "id" | "autoFlow" | "templateAreas" | "templateRows" | "templateColumns"> & import("react").RefAttributes<any>>>;
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;
@@ -56,8 +56,7 @@ export type Grow = 'hug' | 'fill';
56
56
  /**
57
57
  * __Inline__
58
58
  *
59
- * Inline is a primitive component based on flexbox that manages the horizontal layout of direct children.
60
- *
59
+ * Inline is a primitive component based on CSS Flexbox that manages the horizontal layout of direct children.
61
60
  *
62
61
  * @example
63
62
  * ```tsx
@@ -114,5 +113,5 @@ declare const Inline: import("react").MemoExoticComponent<import("react").Forwar
114
113
  * Forwarded ref element
115
114
  */
116
115
  ref?: any;
117
- } & BasePrimitiveProps, "as" | "children" | keyof BasePrimitiveProps | "space" | "separator" | "alignInline" | "alignBlock" | "shouldWrap" | "spread" | "grow" | "rowSpace"> & import("react").RefAttributes<any>>>;
116
+ } & BasePrimitiveProps, "as" | "children" | "space" | "separator" | keyof BasePrimitiveProps | "alignInline" | "alignBlock" | "shouldWrap" | "spread" | "grow" | "rowSpace"> & import("react").RefAttributes<any>>>;
118
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 = 'div'> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & BasePrimitiveProps & BaseBoxPropsFoundation<T>;
6
- export type As = 'article' | 'aside' | 'button' | 'dialog' | 'div' | 'footer' | 'header' | 'li' | 'main' | 'nav' | 'ol' | 'section' | 'span' | 'ul';
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?: React.ComponentPropsWithRef<T>['ref'];
73
+ ref?: ComponentPropsWithRef<T>['ref'];
73
74
  };
74
- export type BaseBoxComponent<T extends ElementType = 'div'> = (<T extends ElementType = 'div'>(props: BaseBoxProps<T>) => ReactElement | null) & FC<BaseBoxProps<T>>;
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 | "space" | "alignInline" | "alignBlock" | "spread" | "grow"> & import("react").RefAttributes<any>>>;
90
+ } & BasePrimitiveProps, "as" | "children" | "space" | keyof BasePrimitiveProps | "alignInline" | "alignBlock" | "spread" | "grow"> & import("react").RefAttributes<any>>>;
91
91
  export default Stack;