@atlaskit/primitives 10.1.0 → 11.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,77 @@
1
1
  # @atlaskit/primitives
2
2
 
3
+ ## 11.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#119548](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/119548)
8
+ [`c99cce707b5cb`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c99cce707b5cb) -
9
+ The separator prop in the inline component has had its type expanded to `ReactNode`.
10
+ - Updated dependencies
11
+
12
+ ## 11.0.0
13
+
14
+ ### Major Changes
15
+
16
+ - [#119014](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/119014)
17
+ [`80c46fcb18957`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/80c46fcb18957) -
18
+ Increased type safety for `xcss`. In general, non-token values for the following properties are no
19
+ longer allowed:
20
+
21
+ - `margin`
22
+ - `marginBlock`
23
+ - `marginBlockEnd`
24
+ - `marginBlockStart`
25
+ - `marginBottom`
26
+ - `marginInline`
27
+ - `marginInlineEnd`
28
+ - `marginInlineStart`
29
+ - `marginLeft`
30
+ - `marginRight`
31
+ - `marginTop`
32
+ - `paddingBottom`
33
+ - `paddingLeft`
34
+ - `paddingRight`
35
+ - `paddingTop`
36
+
37
+ Note: Logical properties for `padding`, e.g. `paddingInline`, already prohibit non-token values.
38
+
39
+ For example:
40
+
41
+ ```typescript
42
+ const styles = xcss({
43
+ padding: '8px', // <-- Type Error
44
+ ^^^^^
45
+ });
46
+ ```
47
+
48
+ A few additional non-token values are still accepted:
49
+
50
+ - `margin`: `'0 auto'` | `'auto'` | `'0'`
51
+ - `marginBlock`: `'auto'` | `'0'`
52
+ - `marginBlockEnd`: `'auto'` | `'0'`
53
+ - `marginBlockStart`: `'auto'` | `'0'`
54
+ - `marginBottom`: `'auto'` | `'0'`
55
+ - `marginInline`: `'auto'` | `'0'`
56
+ - `marginInlineEnd`: `'auto'` | `'0'`
57
+ - `marginInlineStart`: `'auto'` | `'0'`
58
+ - `marginLeft`: `'auto'` | `'0'`
59
+ - `marginRight`: `'auto'` | `'0'`
60
+ - `marginTop`: `'auto'` | `'0'`
61
+ - `paddingBlock`: `'0'`
62
+ - `paddingBlockEnd`: `'0'`
63
+ - `paddingBlockStart`: `'0'`
64
+ - `paddingBottom`: `'0'`
65
+ - `paddingInline`: `'0'`
66
+ - `paddingInlineEnd`: `'0'`
67
+ - `paddingInlineStart`: `'0'`
68
+ - `paddingLeft`: `'0'`
69
+ - `paddingRight`: `'0'`
70
+ - `paddingTop`: `'0'`
71
+
72
+ as well as global CSS properties: `'inherit'` | `'initial'` | `'revert'` | `'revert-layer'` |
73
+ `'unset'`
74
+
3
75
  ## 10.1.0
4
76
 
5
77
  ### Minor Changes
@@ -103,7 +103,7 @@ var AnchorNoRef = function AnchorNoRef(_ref, ref) {
103
103
  action: 'clicked',
104
104
  componentName: componentName || 'Anchor',
105
105
  packageName: "@atlaskit/primitives",
106
- packageVersion: "10.1.0",
106
+ packageVersion: "11.0.1",
107
107
  analyticsData: analyticsContext,
108
108
  actionSubject: 'link'
109
109
  });
@@ -1,15 +1,18 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = void 0;
8
9
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
- var _react = require("react");
10
+ var _react = _interopRequireWildcard(require("react"));
10
11
  var _react2 = require("@emotion/react");
11
12
  var _xcss = require("../xcss/xcss");
12
13
  var _flex = _interopRequireDefault(require("./flex"));
14
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
15
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
13
16
  /* eslint-disable @repo/internal/styles/no-exported-styles */
14
17
  /**
15
18
  * @jsxRuntime classic
@@ -95,7 +95,7 @@ var Pressable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
95
95
  action: 'clicked',
96
96
  componentName: componentName || 'Pressable',
97
97
  packageName: "@atlaskit/primitives",
98
- packageVersion: "10.1.0",
98
+ packageVersion: "11.0.1",
99
99
  analyticsData: analyticsContext,
100
100
  actionSubject: 'button'
101
101
  });
@@ -530,6 +530,8 @@ var fontFamilyMap = exports.fontFamilyMap = {
530
530
  * @codegenEnd
531
531
  */
532
532
 
533
+ // Margin needs some bespoke types: https://atlassian.slack.com/archives/CKRHB23K8/p1712623192772909
534
+
533
535
  // Generate maps for Box props. backgroundColor, padding, etc
534
536
  var spacingProperties = [
535
537
  // Used by Box
@@ -93,7 +93,7 @@ const AnchorNoRef = ({
93
93
  action: 'clicked',
94
94
  componentName: componentName || 'Anchor',
95
95
  packageName: "@atlaskit/primitives",
96
- packageVersion: "10.1.0",
96
+ packageVersion: "11.0.1",
97
97
  analyticsData: analyticsContext,
98
98
  actionSubject: 'link'
99
99
  });
@@ -3,7 +3,7 @@
3
3
  * @jsxRuntime classic
4
4
  */
5
5
  /** @jsx jsx */
6
- import { Children, forwardRef, Fragment, memo } from 'react';
6
+ import React, { Children, forwardRef, Fragment, memo } from 'react';
7
7
 
8
8
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
9
9
  import { css, jsx } from '@emotion/react';
@@ -85,7 +85,7 @@ const Pressable = /*#__PURE__*/forwardRef(({
85
85
  action: 'clicked',
86
86
  componentName: componentName || 'Pressable',
87
87
  packageName: "@atlaskit/primitives",
88
- packageVersion: "10.1.0",
88
+ packageVersion: "11.0.1",
89
89
  analyticsData: analyticsContext,
90
90
  actionSubject: 'button'
91
91
  });
@@ -525,6 +525,8 @@ export const fontFamilyMap = {
525
525
  * @codegenEnd
526
526
  */
527
527
 
528
+ // Margin needs some bespoke types: https://atlassian.slack.com/archives/CKRHB23K8/p1712623192772909
529
+
528
530
  // Generate maps for Box props. backgroundColor, padding, etc
529
531
  const spacingProperties = [
530
532
  // Used by Box
@@ -97,7 +97,7 @@ var AnchorNoRef = function AnchorNoRef(_ref, ref) {
97
97
  action: 'clicked',
98
98
  componentName: componentName || 'Anchor',
99
99
  packageName: "@atlaskit/primitives",
100
- packageVersion: "10.1.0",
100
+ packageVersion: "11.0.1",
101
101
  analyticsData: analyticsContext,
102
102
  actionSubject: 'link'
103
103
  });
@@ -4,7 +4,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
4
4
  * @jsxRuntime classic
5
5
  */
6
6
  /** @jsx jsx */
7
- import { Children, forwardRef, Fragment, memo } from 'react';
7
+ import React, { Children, forwardRef, Fragment, memo } from 'react';
8
8
 
9
9
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
10
10
  import { css, jsx } from '@emotion/react';
@@ -89,7 +89,7 @@ var Pressable = /*#__PURE__*/forwardRef(function (_ref, ref) {
89
89
  action: 'clicked',
90
90
  componentName: componentName || 'Pressable',
91
91
  packageName: "@atlaskit/primitives",
92
- packageVersion: "10.1.0",
92
+ packageVersion: "11.0.1",
93
93
  analyticsData: analyticsContext,
94
94
  actionSubject: 'button'
95
95
  });
@@ -525,6 +525,8 @@ export var fontFamilyMap = {
525
525
  * @codegenEnd
526
526
  */
527
527
 
528
+ // Margin needs some bespoke types: https://atlassian.slack.com/archives/CKRHB23K8/p1712623192772909
529
+
528
530
  // Generate maps for Box props. backgroundColor, padding, etc
529
531
  var spacingProperties = [
530
532
  // Used by Box
@@ -2,7 +2,7 @@
2
2
  * @jsxRuntime classic
3
3
  */
4
4
  /** @jsx jsx */
5
- import { type ElementType, type ReactNode } from 'react';
5
+ import React, { type ElementType, type ReactNode } from 'react';
6
6
  import { type Space } from '../xcss/style-maps.partial';
7
7
  import type { AlignBlock, AlignInline, BasePrimitiveProps, Grow, Spread } from './types';
8
8
  export type InlineProps<T extends ElementType = 'div'> = {
@@ -42,7 +42,7 @@ export type InlineProps<T extends ElementType = 'div'> = {
42
42
  /**
43
43
  * Renders a separator string between each child.
44
44
  */
45
- separator?: string;
45
+ separator?: React.ReactNode;
46
46
  /**
47
47
  * Elements to be rendered inside the Inline.
48
48
  */
@@ -66,7 +66,7 @@ export type InlineProps<T extends ElementType = 'div'> = {
66
66
  * ```
67
67
  *
68
68
  */
69
- declare const Inline: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Pick<{
69
+ declare const Inline: React.MemoExoticComponent<React.ForwardRefExoticComponent<Pick<{
70
70
  /**
71
71
  * The DOM element to render as the Inline. Defaults to `div`.
72
72
  */
@@ -103,7 +103,7 @@ declare const Inline: import("react").MemoExoticComponent<import("react").Forwar
103
103
  /**
104
104
  * Renders a separator string between each child.
105
105
  */
106
- separator?: string | undefined;
106
+ separator?: React.ReactNode;
107
107
  /**
108
108
  * Elements to be rendered inside the Inline.
109
109
  */
@@ -112,5 +112,5 @@ declare const Inline: import("react").MemoExoticComponent<import("react").Forwar
112
112
  * Forwarded ref element.
113
113
  */
114
114
  ref?: any;
115
- } & BasePrimitiveProps, "space" | "separator" | "children" | "as" | keyof BasePrimitiveProps | "alignInline" | "alignBlock" | "shouldWrap" | "spread" | "grow" | "rowSpace"> & import("react").RefAttributes<any>>>;
115
+ } & BasePrimitiveProps, "space" | "separator" | "children" | "as" | keyof BasePrimitiveProps | "alignInline" | "alignBlock" | "shouldWrap" | "spread" | "grow" | "rowSpace"> & React.RefAttributes<any>>>;
116
116
  export default Inline;
@@ -550,7 +550,9 @@ export type FontFamily = keyof typeof fontFamilyMap;
550
550
  /**
551
551
  * @codegenEnd
552
552
  */
553
- type MarginSpace = AllSpace | 'auto';
553
+ type MarginSpace = AllSpace | 'auto' | '0';
554
+ type PaddingSpace = Space | '0';
555
+ type GlobalValue = 'inherit' | 'initial' | 'revert' | 'revert-layer' | 'unset';
554
556
  type AutoComplete<T extends string> = T | Omit<string, T>;
555
557
  export type TokenisedProps = {
556
558
  backgroundColor?: BackgroundColor;
@@ -601,17 +603,17 @@ export type TokenisedProps = {
601
603
  insetInlineEnd?: AutoComplete<AllSpace>;
602
604
  insetInlineStart?: AutoComplete<AllSpace>;
603
605
  left?: AutoComplete<AllSpace>;
604
- margin?: AutoComplete<MarginSpace>;
605
- marginBlock?: AutoComplete<MarginSpace>;
606
- marginBlockEnd?: AutoComplete<MarginSpace>;
607
- marginBlockStart?: AutoComplete<MarginSpace>;
608
- marginBottom?: AutoComplete<MarginSpace>;
609
- marginInline?: AutoComplete<MarginSpace>;
610
- marginInlineEnd?: AutoComplete<MarginSpace>;
611
- marginInlineStart?: AutoComplete<MarginSpace>;
612
- marginLeft?: AutoComplete<MarginSpace>;
613
- marginRight?: AutoComplete<MarginSpace>;
614
- marginTop?: AutoComplete<MarginSpace>;
606
+ margin?: MarginSpace | '0 auto' | GlobalValue;
607
+ marginBlock?: MarginSpace | GlobalValue;
608
+ marginInline?: MarginSpace | GlobalValue;
609
+ marginBlockEnd?: MarginSpace | GlobalValue;
610
+ marginBlockStart?: MarginSpace | GlobalValue;
611
+ marginBottom?: MarginSpace | GlobalValue;
612
+ marginInlineEnd?: MarginSpace | GlobalValue;
613
+ marginInlineStart?: MarginSpace | GlobalValue;
614
+ marginLeft?: MarginSpace | GlobalValue;
615
+ marginRight?: MarginSpace | GlobalValue;
616
+ marginTop?: MarginSpace | GlobalValue;
615
617
  maxBlockSize?: Dimension | string;
616
618
  maxHeight?: Dimension | string;
617
619
  maxInlineSize?: Dimension | string;
@@ -624,17 +626,17 @@ export type TokenisedProps = {
624
626
  outlineColor?: BorderColor;
625
627
  outlineOffset?: AllSpace;
626
628
  outlineWidth?: BorderWidth | string;
627
- padding?: Space;
628
- paddingBlock?: Space;
629
- paddingBlockEnd?: Space;
630
- paddingBlockStart?: Space;
631
- paddingBottom?: AutoComplete<Space>;
632
- paddingInline?: Space;
633
- paddingInlineEnd?: Space;
634
- paddingInlineStart?: Space;
635
- paddingLeft?: AutoComplete<Space>;
636
- paddingRight?: AutoComplete<Space>;
637
- paddingTop?: AutoComplete<Space>;
629
+ padding?: PaddingSpace | GlobalValue;
630
+ paddingBlock?: PaddingSpace | GlobalValue;
631
+ paddingBlockEnd?: PaddingSpace | GlobalValue;
632
+ paddingBlockStart?: PaddingSpace | GlobalValue;
633
+ paddingBottom?: PaddingSpace | GlobalValue;
634
+ paddingInline?: PaddingSpace | GlobalValue;
635
+ paddingInlineEnd?: PaddingSpace | GlobalValue;
636
+ paddingInlineStart?: PaddingSpace | GlobalValue;
637
+ paddingLeft?: PaddingSpace | GlobalValue;
638
+ paddingRight?: PaddingSpace | GlobalValue;
639
+ paddingTop?: PaddingSpace | GlobalValue;
638
640
  right?: AutoComplete<AllSpace>;
639
641
  rowGap?: Space;
640
642
  top?: AutoComplete<AllSpace>;
@@ -2,7 +2,7 @@
2
2
  * @jsxRuntime classic
3
3
  */
4
4
  /** @jsx jsx */
5
- import { type ElementType, type ReactNode } from 'react';
5
+ import React, { type ElementType, type ReactNode } from 'react';
6
6
  import { type Space } from '../xcss/style-maps.partial';
7
7
  import type { AlignBlock, AlignInline, BasePrimitiveProps, Grow, Spread } from './types';
8
8
  export type InlineProps<T extends ElementType = 'div'> = {
@@ -42,7 +42,7 @@ export type InlineProps<T extends ElementType = 'div'> = {
42
42
  /**
43
43
  * Renders a separator string between each child.
44
44
  */
45
- separator?: string;
45
+ separator?: React.ReactNode;
46
46
  /**
47
47
  * Elements to be rendered inside the Inline.
48
48
  */
@@ -66,7 +66,7 @@ export type InlineProps<T extends ElementType = 'div'> = {
66
66
  * ```
67
67
  *
68
68
  */
69
- declare const Inline: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Pick<{
69
+ declare const Inline: React.MemoExoticComponent<React.ForwardRefExoticComponent<Pick<{
70
70
  /**
71
71
  * The DOM element to render as the Inline. Defaults to `div`.
72
72
  */
@@ -103,7 +103,7 @@ declare const Inline: import("react").MemoExoticComponent<import("react").Forwar
103
103
  /**
104
104
  * Renders a separator string between each child.
105
105
  */
106
- separator?: string | undefined;
106
+ separator?: React.ReactNode;
107
107
  /**
108
108
  * Elements to be rendered inside the Inline.
109
109
  */
@@ -112,5 +112,5 @@ declare const Inline: import("react").MemoExoticComponent<import("react").Forwar
112
112
  * Forwarded ref element.
113
113
  */
114
114
  ref?: any;
115
- } & BasePrimitiveProps, "space" | "separator" | "children" | "as" | keyof BasePrimitiveProps | "alignInline" | "alignBlock" | "shouldWrap" | "spread" | "grow" | "rowSpace"> & import("react").RefAttributes<any>>>;
115
+ } & BasePrimitiveProps, "space" | "separator" | "children" | "as" | keyof BasePrimitiveProps | "alignInline" | "alignBlock" | "shouldWrap" | "spread" | "grow" | "rowSpace"> & React.RefAttributes<any>>>;
116
116
  export default Inline;
@@ -550,7 +550,9 @@ export type FontFamily = keyof typeof fontFamilyMap;
550
550
  /**
551
551
  * @codegenEnd
552
552
  */
553
- type MarginSpace = AllSpace | 'auto';
553
+ type MarginSpace = AllSpace | 'auto' | '0';
554
+ type PaddingSpace = Space | '0';
555
+ type GlobalValue = 'inherit' | 'initial' | 'revert' | 'revert-layer' | 'unset';
554
556
  type AutoComplete<T extends string> = T | Omit<string, T>;
555
557
  export type TokenisedProps = {
556
558
  backgroundColor?: BackgroundColor;
@@ -601,17 +603,17 @@ export type TokenisedProps = {
601
603
  insetInlineEnd?: AutoComplete<AllSpace>;
602
604
  insetInlineStart?: AutoComplete<AllSpace>;
603
605
  left?: AutoComplete<AllSpace>;
604
- margin?: AutoComplete<MarginSpace>;
605
- marginBlock?: AutoComplete<MarginSpace>;
606
- marginBlockEnd?: AutoComplete<MarginSpace>;
607
- marginBlockStart?: AutoComplete<MarginSpace>;
608
- marginBottom?: AutoComplete<MarginSpace>;
609
- marginInline?: AutoComplete<MarginSpace>;
610
- marginInlineEnd?: AutoComplete<MarginSpace>;
611
- marginInlineStart?: AutoComplete<MarginSpace>;
612
- marginLeft?: AutoComplete<MarginSpace>;
613
- marginRight?: AutoComplete<MarginSpace>;
614
- marginTop?: AutoComplete<MarginSpace>;
606
+ margin?: MarginSpace | '0 auto' | GlobalValue;
607
+ marginBlock?: MarginSpace | GlobalValue;
608
+ marginInline?: MarginSpace | GlobalValue;
609
+ marginBlockEnd?: MarginSpace | GlobalValue;
610
+ marginBlockStart?: MarginSpace | GlobalValue;
611
+ marginBottom?: MarginSpace | GlobalValue;
612
+ marginInlineEnd?: MarginSpace | GlobalValue;
613
+ marginInlineStart?: MarginSpace | GlobalValue;
614
+ marginLeft?: MarginSpace | GlobalValue;
615
+ marginRight?: MarginSpace | GlobalValue;
616
+ marginTop?: MarginSpace | GlobalValue;
615
617
  maxBlockSize?: Dimension | string;
616
618
  maxHeight?: Dimension | string;
617
619
  maxInlineSize?: Dimension | string;
@@ -624,17 +626,17 @@ export type TokenisedProps = {
624
626
  outlineColor?: BorderColor;
625
627
  outlineOffset?: AllSpace;
626
628
  outlineWidth?: BorderWidth | string;
627
- padding?: Space;
628
- paddingBlock?: Space;
629
- paddingBlockEnd?: Space;
630
- paddingBlockStart?: Space;
631
- paddingBottom?: AutoComplete<Space>;
632
- paddingInline?: Space;
633
- paddingInlineEnd?: Space;
634
- paddingInlineStart?: Space;
635
- paddingLeft?: AutoComplete<Space>;
636
- paddingRight?: AutoComplete<Space>;
637
- paddingTop?: AutoComplete<Space>;
629
+ padding?: PaddingSpace | GlobalValue;
630
+ paddingBlock?: PaddingSpace | GlobalValue;
631
+ paddingBlockEnd?: PaddingSpace | GlobalValue;
632
+ paddingBlockStart?: PaddingSpace | GlobalValue;
633
+ paddingBottom?: PaddingSpace | GlobalValue;
634
+ paddingInline?: PaddingSpace | GlobalValue;
635
+ paddingInlineEnd?: PaddingSpace | GlobalValue;
636
+ paddingInlineStart?: PaddingSpace | GlobalValue;
637
+ paddingLeft?: PaddingSpace | GlobalValue;
638
+ paddingRight?: PaddingSpace | GlobalValue;
639
+ paddingTop?: PaddingSpace | GlobalValue;
638
640
  right?: AutoComplete<AllSpace>;
639
641
  rowGap?: Space;
640
642
  top?: AutoComplete<AllSpace>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "10.1.0",
3
+ "version": "11.0.1",
4
4
  "description": "Primitives are token-backed low-level building blocks.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -128,7 +128,7 @@
128
128
  "@atlaskit/css": "^0.3.0",
129
129
  "@atlaskit/ds-lib": "^2.3.0",
130
130
  "@atlaskit/interaction-context": "^2.1.0",
131
- "@atlaskit/tokens": "^1.53.0",
131
+ "@atlaskit/tokens": "^1.54.0",
132
132
  "@atlaskit/visually-hidden": "^1.4.0",
133
133
  "@babel/runtime": "^7.0.0",
134
134
  "@emotion/react": "^11.7.1",