@atlaskit/primitives 1.0.9 → 1.0.10

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,11 @@
1
1
  # @atlaskit/primitives
2
2
 
3
+ ## 1.0.10
4
+
5
+ ### Patch Changes
6
+
7
+ - [`ac645224013`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ac645224013) - Removes generic for `xcss` fn. Adds support for other `AtTypes`.
8
+
3
9
  ## 1.0.9
4
10
 
5
11
  ### Patch Changes
@@ -26,3 +26,6 @@ To identify usages of `Box` in a given design, look for where a UI element will
26
26
  ## Related
27
27
  - [Learn more about the Inline primitive](/components/primitives/inline/usage)
28
28
  - [Learn more about the Stack primitive](/components/primitives/stack/usage)
29
+ - [Learn more about the Grid primitive](/components/primitives/grid/examples)
30
+ - [Learn more about the Bleed primitive](/components/primitives/bleed/examples)
31
+ - [Learn more about the Flex primitive](/components/primitives/flex/examples)
@@ -4,9 +4,9 @@ description: Inline is a primitive component based on flexbox that manages the h
4
4
  order: 2
5
5
  ---
6
6
 
7
- Primitive components are designed to act as building blocks for composing a user experience. An Inline primitive should be used when you want to layout UI elements horizontally, and make use of the built-in design guidance from the Atlassian Design System.
7
+ Primitive components are designed to act as building blocks for composing a user experience. An Inline primitive should be used when you want to layout UI elements horizontally, and make use of the built-in design guidance from the Atlassian Design System.
8
8
 
9
- Inline primitives work as you might expect, aligning content horizontally across a page or layout, as a container that decides the horizontal layout of its children. Inline components also decide the specifics of how the children are displayed, for example, where they are aligned or how much space is between child elements. Inline should be used purely for visual alignment, and should have no opinions about the functionality of its children.
9
+ Inline primitives work as you might expect, aligning content horizontally across a page or layout, as a container that decides the horizontal layout of its children. Inline components also decide the specifics of how the children are displayed, for example, where they are aligned or how much space is between child elements. Inline should be used purely for visual alignment, and should have no opinions about the functionality of its children.
10
10
 
11
11
  In its simplest form, `Inline` operates like a flexbox row, however adds the built in design token support and guidance.
12
12
 
@@ -18,7 +18,7 @@ In its simplest form, `Inline` operates like a flexbox row, however adds the bui
18
18
  It also has a flex-direction: row; but that’s the default, so not explicitly applied.
19
19
 
20
20
  ## Use `Inline`
21
- The purpose of an Inline is primarily as a container element controlling how child components are displayed and positioned horizontally. Inline should be used any time you wish to layout elements or components horizontally.
21
+ The purpose of an Inline is primarily as a container element controlling how child components are displayed and positioned horizontally. Inline should be used any time you wish to layout elements or components horizontally.
22
22
 
23
23
  The various Inline props can then be used to customize the spacing and styling on any child elements. These include:
24
24
 
@@ -31,6 +31,9 @@ The various Inline props can then be used to customize the spacing and styling o
31
31
  - `rowSpace`
32
32
  - `separator`
33
33
 
34
- ## Related
35
34
  - [Learn more about the Box primitive](/components/primitives/box/usage)
36
35
  - [Learn more about the Stack primitive](/components/primitives/stack/usage)
36
+ - [Learn more about the Grid primitive](/components/primitives/grid/examples)
37
+ - [Learn more about the Bleed primitive](/components/primitives/bleed/examples)
38
+ - [Learn more about the Flex primitive](/components/primitives/flex/examples)
39
+
@@ -23,9 +23,8 @@ Primitives are a new type of component for layouts and the placement of elements
23
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 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.
26
+ Primitives are powered by design tokens and add a layer of ergonomics and accessibility to token application. Tokens are great at describing the what of a design decision;
27
+ primitives make it easier to reason about the when and how. This reduces cognitive overhead, improves productivity and prevents accidents or mistakes.
29
28
 
30
29
  ## Available Primitives
31
30
 
@@ -57,14 +56,14 @@ This involves breaking down a design into its core layout components to as granu
57
56
 
58
57
  You might like to think first about breaking down a page into `Box` containers,
59
58
  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.
59
+ in a layout and grouping them together under a `Box`.
61
60
 
62
61
  <Image src={boxUsageExample} />
63
62
 
64
63
  The behavior within and around these boxes can then be broken down into their horizontal `Inline` and vertical `Stack` components.
65
64
 
66
65
  <SectionMessage>
67
- The ESLint rule use-primitives offers suggestions for possible primitives in a layout.
66
+ The ESLint rule <a href="/components/eslint-plugin-design-system/usage#use-primitives">use-primitives</a> offers suggestions for possible primitives to apply in a layout.
68
67
  </SectionMessage>
69
68
 
70
69
  <Image src={inlineUsageExample} />
@@ -75,3 +74,6 @@ The ESLint rule use-primitives offers suggestions for possible primitives in a l
75
74
  - [Learn more about the Box primitive](/components/primitives/box/usage)
76
75
  - [Learn more about the Inline primitive](/components/primitives/inline/usage)
77
76
  - [Learn more about the Stack primitive](/components/primitives/stack/usage)
77
+ - [Learn more about the Grid primitive](/components/primitives/grid/examples)
78
+ - [Learn more about the Bleed primitive](/components/primitives/bleed/examples)
79
+ - [Learn more about the Fkex primitive](/components/primitives/flex/examples)
@@ -4,9 +4,9 @@ description: Stack is a primitive component based on flexbox that manages the ve
4
4
  order: 2
5
5
  ---
6
6
 
7
- Primitive components are designed to act as building blocks for composing a user experience. A `Stack` primitive should be used when you want to layout UI elements vertically, and make use of the built-in design guidance from the Atlassian Design System.
7
+ Primitive components are designed to act as building blocks for composing a user experience. A `Stack` primitive should be used when you want to layout UI elements vertically, and make use of the built-in design guidance from the Atlassian Design System.
8
8
 
9
- `Stack` primitives work by aligning content vertically on a page or layout, as a container that decides the vertical layout of its children. `Stack` components also decide the specifics of how the children are displayed, for example, where they are aligned or how much space is between child elements. `Stack` should be used purely for visual alignment, and should have no opinions about the functionality of its children.
9
+ `Stack` primitives work by aligning content vertically on a page or layout, as a container that decides the vertical layout of its children. `Stack` components also decide the specifics of how the children are displayed, for example, where they are aligned or how much space is between child elements. `Stack` should be used purely for visual alignment, and should have no opinions about the functionality of its children.
10
10
 
11
11
  In its simplest form, `Stack` operates like a flexbox column, however adds the built in design token support and guidance.
12
12
 
@@ -17,7 +17,7 @@ In its simplest form, `Stack` operates like a flexbox column, however adds the b
17
17
  ```
18
18
 
19
19
  ## Use `Stack`
20
- The purpose of a `Stack` is primarily as a container element controlling how content is displayed and aligned vertically. `Stack` should be used any time you wish to layout elements or components vertically.
20
+ The purpose of a `Stack` is primarily as a container element controlling how content is displayed and aligned vertically. `Stack` should be used any time you wish to layout elements or components vertically.
21
21
 
22
22
  The various `Stack` props can then be used to customize the spacing and styling on any child elements. These include:
23
23
  - `alignBlock`
@@ -27,5 +27,9 @@ The various `Stack` props can then be used to customize the spacing and styling
27
27
  - `space`
28
28
 
29
29
  ## Related
30
- - [Learn more about the Box primitive](/primitives/box/usage)
31
- - [Learn more about the Stack primitive](/primitives/box/usage)
30
+
31
+ - [Learn more about the Box primitive](/components/primitives/box/usage)
32
+ - [Learn more about the Inline primitive](/components/primitives/inline/usage)
33
+ - [Learn more about the Grid primitive](/components/primitives/grid/examples)
34
+ - [Learn more about the Bleed primitive](/components/primitives/bleed/examples)
35
+ - [Learn more about the Flex primitive](/components/primitives/flex/examples)
@@ -109,6 +109,7 @@ For richer examples of how to use `xcss` please see the [primitives `xcss` docum
109
109
 
110
110
  ### Media Queries
111
111
  xcss can create responsive layouts at predefined breakpoints that are consistent with the Atlassian Design System. To enable responsive behavior, xcss exposes the following pre-defined breakpoints:
112
+
112
113
  <MediaQueriesTable />
113
114
 
114
115
  Media queries can be applied through keys that can be imported from `@atlaskit/primitives/responsive`.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "sideEffects": false
5
5
  }
@@ -10,7 +10,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
10
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
11
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
12
12
  var _react = require("@emotion/react");
13
- var _mediaHelper = require("../responsive/media-helper");
14
13
  var _styleMaps = require("./style-maps.partial");
15
14
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
16
15
 
@@ -75,16 +74,7 @@ var isSafeEnvToThrow = function isSafeEnvToThrow() {
75
74
  return (typeof process === "undefined" ? "undefined" : (0, _typeof2.default)(process)) === 'object' && (0, _typeof2.default)(process.env) === 'object' && process.env.NODE_ENV !== 'production';
76
75
  };
77
76
  var reNestedSelectors = /(\.|\s|&+|\*\>|#|\[.*\])/;
78
- var rePseudos = /^::?.*$/;
79
- var reMediaQuery = /^@media .*$/;
80
-
81
- /**
82
- * Reduce our media queries into a safe string for regex comparison.
83
- */
84
- var reValidMediaQuery = new RegExp("^(".concat(Object.values(_mediaHelper.media.above).map(function (mediaQuery) {
85
- return mediaQuery.replace(/[.()]/g, '\\$&');
86
- } // Escape the ".", "(", and ")" in the media query syntax.
87
- ).join('|'), ")$"));
77
+ var safeSelectors = /^@media .*$|^::?.*$|^@supports .*$/;
88
78
  var transformStyles = function transformStyles(styleObj) {
89
79
  if (!styleObj || (0, _typeof2.default)(styleObj) !== 'object') {
90
80
  return styleObj;
@@ -100,23 +90,17 @@ var transformStyles = function transformStyles(styleObj) {
100
90
  var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
101
91
  key = _ref2[0],
102
92
  value = _ref2[1];
103
- if (isSafeEnvToThrow()) {
104
- // We don't support `.class`, `[data-testid]`, `> *`, `#some-id`
105
- if (reNestedSelectors.test(key) && !reValidMediaQuery.test(key)) {
106
- throw new Error("Styles not supported for key '".concat(key, "'."));
107
- }
108
- }
109
-
110
93
  // If key is a pseudo class or a pseudo element, then value should be an object.
111
94
  // So, call transformStyles on the value
112
- if (rePseudos.test(key)) {
95
+ if ((0, _typeof2.default)(value) === 'object' && safeSelectors.test(key)) {
113
96
  styleObj[key] = transformStyles(value);
114
97
  return;
115
98
  }
116
- if (reMediaQuery.test(key)) {
117
- // @ts-expect-error
118
- styleObj[key] = transformStyles(value);
119
- return;
99
+ if (isSafeEnvToThrow()) {
100
+ // We don't support `.class`, `[data-testid]`, `> *`, `#some-id`
101
+ if (reNestedSelectors.test(key)) {
102
+ throw new Error("Styles not supported for key '".concat(key, "'."));
103
+ }
120
104
  }
121
105
 
122
106
  // We have now dealt with all the special cases, so,
@@ -157,13 +141,6 @@ var parseXcss = function parseXcss(args) {
157
141
 
158
142
  // Pseudos should not contain nested pseudos, or media queries
159
143
  exports.parseXcss = parseXcss;
160
- // unused private functions only so we can extract the return type from a generic function
161
- var boxWrapper = function boxWrapper(style) {
162
- return xcss(style);
163
- };
164
- var spaceWrapper = function spaceWrapper(style) {
165
- return xcss(style);
166
- };
167
144
  /**
168
145
  * ### xcss
169
146
  *
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "sideEffects": false
5
5
  }
@@ -1,6 +1,5 @@
1
1
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
2
2
  import { css as cssEmotion } from '@emotion/react';
3
- import { media } from '../responsive/media-helper';
4
3
  import { backgroundColorMap, borderColorMap, borderRadiusMap, borderWidthMap, dimensionMap, layerMap, shadowMap, spaceMap, textColorMap } from './style-maps.partial';
5
4
  const tokensMap = {
6
5
  backgroundColor: backgroundColorMap,
@@ -61,14 +60,7 @@ const tokensMap = {
61
60
  const uniqueSymbol = Symbol('UNSAFE_INTERNAL_styles');
62
61
  const isSafeEnvToThrow = () => typeof process === 'object' && typeof process.env === 'object' && process.env.NODE_ENV !== 'production';
63
62
  const reNestedSelectors = /(\.|\s|&+|\*\>|#|\[.*\])/;
64
- const rePseudos = /^::?.*$/;
65
- const reMediaQuery = /^@media .*$/;
66
-
67
- /**
68
- * Reduce our media queries into a safe string for regex comparison.
69
- */
70
- const reValidMediaQuery = new RegExp(`^(${Object.values(media.above).map(mediaQuery => mediaQuery.replace(/[.()]/g, '\\$&') // Escape the ".", "(", and ")" in the media query syntax.
71
- ).join('|')})$`);
63
+ const safeSelectors = /^@media .*$|^::?.*$|^@supports .*$/;
72
64
  const transformStyles = styleObj => {
73
65
  if (!styleObj || typeof styleObj !== 'object') {
74
66
  return styleObj;
@@ -81,23 +73,17 @@ const transformStyles = styleObj => {
81
73
 
82
74
  // Modifies styleObj in place. Be careful.
83
75
  Object.entries(styleObj).forEach(([key, value]) => {
84
- if (isSafeEnvToThrow()) {
85
- // We don't support `.class`, `[data-testid]`, `> *`, `#some-id`
86
- if (reNestedSelectors.test(key) && !reValidMediaQuery.test(key)) {
87
- throw new Error(`Styles not supported for key '${key}'.`);
88
- }
89
- }
90
-
91
76
  // If key is a pseudo class or a pseudo element, then value should be an object.
92
77
  // So, call transformStyles on the value
93
- if (rePseudos.test(key)) {
78
+ if (typeof value === 'object' && safeSelectors.test(key)) {
94
79
  styleObj[key] = transformStyles(value);
95
80
  return;
96
81
  }
97
- if (reMediaQuery.test(key)) {
98
- // @ts-expect-error
99
- styleObj[key] = transformStyles(value);
100
- return;
82
+ if (isSafeEnvToThrow()) {
83
+ // We don't support `.class`, `[data-testid]`, `> *`, `#some-id`
84
+ if (reNestedSelectors.test(key)) {
85
+ throw new Error(`Styles not supported for key '${key}'.`);
86
+ }
101
87
  }
102
88
 
103
89
  // We have now dealt with all the special cases, so,
@@ -140,9 +126,6 @@ export const parseXcss = args => {
140
126
 
141
127
  // Pseudos should not contain nested pseudos, or media queries
142
128
 
143
- // unused private functions only so we can extract the return type from a generic function
144
- const boxWrapper = style => xcss(style);
145
- const spaceWrapper = style => xcss(style);
146
129
  /**
147
130
  * ### xcss
148
131
  *
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "sideEffects": false
5
5
  }
@@ -3,7 +3,6 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _typeof from "@babel/runtime/helpers/typeof";
4
4
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
5
5
  import { css as cssEmotion } from '@emotion/react';
6
- import { media } from '../responsive/media-helper';
7
6
  import { backgroundColorMap, borderColorMap, borderRadiusMap, borderWidthMap, dimensionMap, layerMap, shadowMap, spaceMap, textColorMap } from './style-maps.partial';
8
7
  var tokensMap = {
9
8
  backgroundColor: backgroundColorMap,
@@ -66,16 +65,7 @@ var isSafeEnvToThrow = function isSafeEnvToThrow() {
66
65
  return (typeof process === "undefined" ? "undefined" : _typeof(process)) === 'object' && _typeof(process.env) === 'object' && process.env.NODE_ENV !== 'production';
67
66
  };
68
67
  var reNestedSelectors = /(\.|\s|&+|\*\>|#|\[.*\])/;
69
- var rePseudos = /^::?.*$/;
70
- var reMediaQuery = /^@media .*$/;
71
-
72
- /**
73
- * Reduce our media queries into a safe string for regex comparison.
74
- */
75
- var reValidMediaQuery = new RegExp("^(".concat(Object.values(media.above).map(function (mediaQuery) {
76
- return mediaQuery.replace(/[.()]/g, '\\$&');
77
- } // Escape the ".", "(", and ")" in the media query syntax.
78
- ).join('|'), ")$"));
68
+ var safeSelectors = /^@media .*$|^::?.*$|^@supports .*$/;
79
69
  var transformStyles = function transformStyles(styleObj) {
80
70
  if (!styleObj || _typeof(styleObj) !== 'object') {
81
71
  return styleObj;
@@ -91,23 +81,17 @@ var transformStyles = function transformStyles(styleObj) {
91
81
  var _ref2 = _slicedToArray(_ref, 2),
92
82
  key = _ref2[0],
93
83
  value = _ref2[1];
94
- if (isSafeEnvToThrow()) {
95
- // We don't support `.class`, `[data-testid]`, `> *`, `#some-id`
96
- if (reNestedSelectors.test(key) && !reValidMediaQuery.test(key)) {
97
- throw new Error("Styles not supported for key '".concat(key, "'."));
98
- }
99
- }
100
-
101
84
  // If key is a pseudo class or a pseudo element, then value should be an object.
102
85
  // So, call transformStyles on the value
103
- if (rePseudos.test(key)) {
86
+ if (_typeof(value) === 'object' && safeSelectors.test(key)) {
104
87
  styleObj[key] = transformStyles(value);
105
88
  return;
106
89
  }
107
- if (reMediaQuery.test(key)) {
108
- // @ts-expect-error
109
- styleObj[key] = transformStyles(value);
110
- return;
90
+ if (isSafeEnvToThrow()) {
91
+ // We don't support `.class`, `[data-testid]`, `> *`, `#some-id`
92
+ if (reNestedSelectors.test(key)) {
93
+ throw new Error("Styles not supported for key '".concat(key, "'."));
94
+ }
111
95
  }
112
96
 
113
97
  // We have now dealt with all the special cases, so,
@@ -148,13 +132,6 @@ export var parseXcss = function parseXcss(args) {
148
132
 
149
133
  // Pseudos should not contain nested pseudos, or media queries
150
134
 
151
- // unused private functions only so we can extract the return type from a generic function
152
- var boxWrapper = function boxWrapper(style) {
153
- return xcss(style);
154
- };
155
- var spaceWrapper = function spaceWrapper(style) {
156
- return xcss(style);
157
- };
158
135
  /**
159
136
  * ### xcss
160
137
  *
@@ -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" | "wrap" | keyof BasePrimitiveProps> & import("react").RefAttributes<any>>>;
136
+ } & BasePrimitiveProps, "gap" | "rowGap" | "columnGap" | "alignItems" | "direction" | "justifyContent" | "wrap" | "as" | "children" | keyof BasePrimitiveProps> & import("react").RefAttributes<any>>>;
137
137
  export default Flex;
@@ -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" | "space" | "separator" | keyof BasePrimitiveProps | "alignInline" | "alignBlock" | "shouldWrap" | "spread" | "grow" | "rowSpace"> & import("react").RefAttributes<any>>>;
116
+ } & BasePrimitiveProps, "space" | "separator" | "as" | "children" | keyof BasePrimitiveProps | "alignInline" | "alignBlock" | "shouldWrap" | "spread" | "grow" | "rowSpace"> & import("react").RefAttributes<any>>>;
117
117
  export default Inline;
@@ -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" | "space" | keyof BasePrimitiveProps | "alignInline" | "alignBlock" | "spread" | "grow"> & import("react").RefAttributes<any>>>;
90
+ } & BasePrimitiveProps, "space" | "as" | "children" | keyof BasePrimitiveProps | "alignInline" | "alignBlock" | "spread" | "grow"> & import("react").RefAttributes<any>>>;
91
91
  export default Stack;
@@ -1,18 +1,19 @@
1
1
  import type { CSSProperties } from 'react';
2
- import { type BoxXCSS } from '../xcss/xcss';
2
+ import type { XCSS } from '../xcss/xcss';
3
3
  export type BasePrimitiveProps = {
4
4
  /**
5
5
  * A unique string that appears as data attribute `data-testid` in the rendered code, serving as a hook for automated tests.
6
6
  */
7
7
  testId?: string;
8
8
  /**
9
- * Inline styles to be applied to the primitive.
9
+ * Inline styles to be applied to the primitive. Only apply as a last resort, or where
10
+ * styles cannot otherwise be calculated outside of the runtime of the component they're applied.
10
11
  */
11
12
  style?: CSSProperties;
12
13
  /**
13
14
  * Apply a subset of permitted styles, powered by Atlassian Design System tokens.
14
15
  */
15
- xcss?: BoxXCSS | BoxXCSS[];
16
+ xcss?: XCSS | Array<XCSS | false | undefined>;
16
17
  /**
17
18
  * Accessible role
18
19
  */
@@ -1,8 +1,6 @@
1
- /// <reference types="react" />
2
1
  import { css as cssEmotion } from '@emotion/react';
3
2
  import type { CSSPropertiesWithMultiValues, SerializedStyles } from '@emotion/serialize';
4
3
  import type * as CSS from 'csstype';
5
- import { Box } from '../index';
6
4
  import type { MediaQuery } from '../responsive/types';
7
5
  import { TokenisedProps } from './style-maps.partial';
8
6
  declare const uniqueSymbol: unique symbol;
@@ -11,25 +9,20 @@ declare const uniqueSymbol: unique symbol;
11
9
  * @returns a collection of styles that can be applied to the respective primitive
12
10
  */
13
11
  type ParsedXcss = ReturnType<typeof cssEmotion> | ReturnType<typeof cssEmotion>[];
14
- export declare const parseXcss: (args: XCSS | XCSSArray) => ParsedXcss;
12
+ export declare const parseXcss: (args: XCSS | (XCSS | false | undefined)[]) => ParsedXcss;
13
+ type AllMedia = MediaQuery | '@media screen and (forced-colors: active), screen and (-ms-high-contrast: active)' | '@media (prefers-color-scheme: dark)' | '@media (prefers-color-scheme: light)' | '@media (prefers-reduced-motion: reduce)';
15
14
  type CSSMediaQueries = {
16
- [MQ in MediaQuery]?: Omit<SafeCSSObject, MediaQuery>;
15
+ [MQ in AllMedia]?: Omit<SafeCSSObject, AllMedia>;
17
16
  };
18
17
  type CSSPseudos = {
19
- [Pseudo in CSS.Pseudos]?: Omit<SafeCSSObject, CSS.Pseudos | MediaQuery>;
18
+ [Pseudo in CSS.Pseudos]?: Omit<SafeCSSObject, CSS.Pseudos | AllMedia>;
20
19
  };
21
- type SafeCSSObject = CSSPseudos & TokenisedProps & CSSMediaQueries & Omit<CSSPropertiesWithMultiValues, keyof TokenisedProps>;
22
- type ScopedSafeCSSObject<T extends keyof SafeCSSObject> = Pick<SafeCSSObject, T>;
23
- declare const boxWrapper: (style: any) => {
24
- readonly [uniqueSymbol]: BoxStyles;
20
+ type AtRulesWithoutMedia = Exclude<CSS.AtRules, '@media'>;
21
+ type CSSAtRules = {
22
+ [AtRule in AtRulesWithoutMedia as `${AtRule}${string}`]?: Omit<SafeCSSObject, AtRulesWithoutMedia>;
25
23
  };
26
- declare const spaceWrapper: (style: any) => {
27
- readonly [uniqueSymbol]: SpaceStyles;
28
- };
29
- type XCSS = ReturnType<typeof boxWrapper> | ReturnType<typeof spaceWrapper>;
30
- type XCSSArray = Array<XCSS | false | undefined>;
31
- type AllowedBoxStyles = keyof SafeCSSObject;
32
- type Spacing = 'columnGap' | 'gap' | 'inset' | 'insetBlock' | 'insetBlockEnd' | 'insetBlockStart' | 'insetInline' | 'insetInlineEnd' | 'insetInlineStart' | 'margin' | 'marginBlock' | 'marginBlockEnd' | 'marginBlockStart' | 'marginInline' | 'marginInlineEnd' | 'marginInlineStart' | 'outlineOffset' | 'padding' | 'paddingBlock' | 'paddingBlockEnd' | 'paddingBlockStart' | 'paddingBottom' | 'paddingInline' | 'paddingInlineEnd' | 'paddingInlineStart' | 'paddingLeft' | 'paddingRight' | 'paddingTop' | 'rowGap';
24
+ type SafeCSSObject = CSSPseudos & CSSAtRules & TokenisedProps & CSSMediaQueries & Omit<CSSPropertiesWithMultiValues, keyof TokenisedProps>;
25
+ export type XCSS = ReturnType<typeof xcss>;
33
26
  /**
34
27
  * ### xcss
35
28
  *
@@ -42,18 +35,7 @@ type Spacing = 'columnGap' | 'gap' | 'inset' | 'insetBlock' | 'insetBlockEnd' |
42
35
  * })
43
36
  * ```
44
37
  */
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>>(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
- };
48
- declare const boxTag: unique symbol;
49
- declare const spaceTag: unique symbol;
50
- export type BoxStyles = SerializedStyles & {
51
- [boxTag]: true;
52
- };
53
- export type SpaceStyles = SerializedStyles & {
54
- [spaceTag]: true;
38
+ export declare function xcss(style: SafeCSSObject): {
39
+ readonly [uniqueSymbol]: SerializedStyles;
55
40
  };
56
- export type BoxXCSS = {
57
- readonly [uniqueSymbol]: BoxStyles;
58
- } | false | undefined;
59
41
  export {};
@@ -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" | "wrap" | keyof BasePrimitiveProps> & import("react").RefAttributes<any>>>;
136
+ } & BasePrimitiveProps, "gap" | "rowGap" | "columnGap" | "alignItems" | "direction" | "justifyContent" | "wrap" | "as" | "children" | keyof BasePrimitiveProps> & import("react").RefAttributes<any>>>;
137
137
  export default Flex;
@@ -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" | "space" | "separator" | keyof BasePrimitiveProps | "alignInline" | "alignBlock" | "shouldWrap" | "spread" | "grow" | "rowSpace"> & import("react").RefAttributes<any>>>;
116
+ } & BasePrimitiveProps, "space" | "separator" | "as" | "children" | keyof BasePrimitiveProps | "alignInline" | "alignBlock" | "shouldWrap" | "spread" | "grow" | "rowSpace"> & import("react").RefAttributes<any>>>;
117
117
  export default Inline;
@@ -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" | "space" | keyof BasePrimitiveProps | "alignInline" | "alignBlock" | "spread" | "grow"> & import("react").RefAttributes<any>>>;
90
+ } & BasePrimitiveProps, "space" | "as" | "children" | keyof BasePrimitiveProps | "alignInline" | "alignBlock" | "spread" | "grow"> & import("react").RefAttributes<any>>>;
91
91
  export default Stack;
@@ -1,18 +1,19 @@
1
1
  import type { CSSProperties } from 'react';
2
- import { type BoxXCSS } from '../xcss/xcss';
2
+ import type { XCSS } from '../xcss/xcss';
3
3
  export type BasePrimitiveProps = {
4
4
  /**
5
5
  * A unique string that appears as data attribute `data-testid` in the rendered code, serving as a hook for automated tests.
6
6
  */
7
7
  testId?: string;
8
8
  /**
9
- * Inline styles to be applied to the primitive.
9
+ * Inline styles to be applied to the primitive. Only apply as a last resort, or where
10
+ * styles cannot otherwise be calculated outside of the runtime of the component they're applied.
10
11
  */
11
12
  style?: CSSProperties;
12
13
  /**
13
14
  * Apply a subset of permitted styles, powered by Atlassian Design System tokens.
14
15
  */
15
- xcss?: BoxXCSS | BoxXCSS[];
16
+ xcss?: XCSS | Array<XCSS | false | undefined>;
16
17
  /**
17
18
  * Accessible role
18
19
  */
@@ -1,8 +1,6 @@
1
- /// <reference types="react" />
2
1
  import { css as cssEmotion } from '@emotion/react';
3
2
  import type { CSSPropertiesWithMultiValues, SerializedStyles } from '@emotion/serialize';
4
3
  import type * as CSS from 'csstype';
5
- import { Box } from '../index';
6
4
  import type { MediaQuery } from '../responsive/types';
7
5
  import { TokenisedProps } from './style-maps.partial';
8
6
  declare const uniqueSymbol: unique symbol;
@@ -11,25 +9,20 @@ declare const uniqueSymbol: unique symbol;
11
9
  * @returns a collection of styles that can be applied to the respective primitive
12
10
  */
13
11
  type ParsedXcss = ReturnType<typeof cssEmotion> | ReturnType<typeof cssEmotion>[];
14
- export declare const parseXcss: (args: XCSS | XCSSArray) => ParsedXcss;
12
+ export declare const parseXcss: (args: XCSS | (XCSS | false | undefined)[]) => ParsedXcss;
13
+ type AllMedia = MediaQuery | '@media screen and (forced-colors: active), screen and (-ms-high-contrast: active)' | '@media (prefers-color-scheme: dark)' | '@media (prefers-color-scheme: light)' | '@media (prefers-reduced-motion: reduce)';
15
14
  type CSSMediaQueries = {
16
- [MQ in MediaQuery]?: Omit<SafeCSSObject, MediaQuery>;
15
+ [MQ in AllMedia]?: Omit<SafeCSSObject, AllMedia>;
17
16
  };
18
17
  type CSSPseudos = {
19
- [Pseudo in CSS.Pseudos]?: Omit<SafeCSSObject, CSS.Pseudos | MediaQuery>;
18
+ [Pseudo in CSS.Pseudos]?: Omit<SafeCSSObject, CSS.Pseudos | AllMedia>;
20
19
  };
21
- type SafeCSSObject = CSSPseudos & TokenisedProps & CSSMediaQueries & Omit<CSSPropertiesWithMultiValues, keyof TokenisedProps>;
22
- type ScopedSafeCSSObject<T extends keyof SafeCSSObject> = Pick<SafeCSSObject, T>;
23
- declare const boxWrapper: (style: any) => {
24
- readonly [uniqueSymbol]: BoxStyles;
20
+ type AtRulesWithoutMedia = Exclude<CSS.AtRules, '@media'>;
21
+ type CSSAtRules = {
22
+ [AtRule in AtRulesWithoutMedia as `${AtRule}${string}`]?: Omit<SafeCSSObject, AtRulesWithoutMedia>;
25
23
  };
26
- declare const spaceWrapper: (style: any) => {
27
- readonly [uniqueSymbol]: SpaceStyles;
28
- };
29
- type XCSS = ReturnType<typeof boxWrapper> | ReturnType<typeof spaceWrapper>;
30
- type XCSSArray = Array<XCSS | false | undefined>;
31
- type AllowedBoxStyles = keyof SafeCSSObject;
32
- type Spacing = 'columnGap' | 'gap' | 'inset' | 'insetBlock' | 'insetBlockEnd' | 'insetBlockStart' | 'insetInline' | 'insetInlineEnd' | 'insetInlineStart' | 'margin' | 'marginBlock' | 'marginBlockEnd' | 'marginBlockStart' | 'marginInline' | 'marginInlineEnd' | 'marginInlineStart' | 'outlineOffset' | 'padding' | 'paddingBlock' | 'paddingBlockEnd' | 'paddingBlockStart' | 'paddingBottom' | 'paddingInline' | 'paddingInlineEnd' | 'paddingInlineStart' | 'paddingLeft' | 'paddingRight' | 'paddingTop' | 'rowGap';
24
+ type SafeCSSObject = CSSPseudos & CSSAtRules & TokenisedProps & CSSMediaQueries & Omit<CSSPropertiesWithMultiValues, keyof TokenisedProps>;
25
+ export type XCSS = ReturnType<typeof xcss>;
33
26
  /**
34
27
  * ### xcss
35
28
  *
@@ -42,18 +35,7 @@ type Spacing = 'columnGap' | 'gap' | 'inset' | 'insetBlock' | 'insetBlockEnd' |
42
35
  * })
43
36
  * ```
44
37
  */
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>>(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
- };
48
- declare const boxTag: unique symbol;
49
- declare const spaceTag: unique symbol;
50
- export type BoxStyles = SerializedStyles & {
51
- [boxTag]: true;
52
- };
53
- export type SpaceStyles = SerializedStyles & {
54
- [spaceTag]: true;
38
+ export declare function xcss(style: SafeCSSObject): {
39
+ readonly [uniqueSymbol]: SerializedStyles;
55
40
  };
56
- export type BoxXCSS = {
57
- readonly [uniqueSymbol]: BoxStyles;
58
- } | false | undefined;
59
41
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "Primitives are token-backed low-level building blocks.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -22,7 +22,7 @@
22
22
  "category": "Primitives",
23
23
  "name": "Primitives",
24
24
  "status": {
25
- "type": "closed-beta"
25
+ "type": "beta"
26
26
  },
27
27
  "pages": [
28
28
  {
@@ -31,7 +31,7 @@
31
31
  "folder": "overview",
32
32
  "slug": "primitives/overview",
33
33
  "status": {
34
- "type": "closed-beta"
34
+ "type": "beta"
35
35
  }
36
36
  },
37
37
  {
@@ -40,7 +40,7 @@
40
40
  "slug": "primitives/box",
41
41
  "id": "@atlaskit/primitives/box",
42
42
  "status": {
43
- "type": "closed-beta"
43
+ "type": "beta"
44
44
  }
45
45
  },
46
46
  {
@@ -49,7 +49,7 @@
49
49
  "slug": "primitives/inline",
50
50
  "id": "@atlaskit/primitives/inline",
51
51
  "status": {
52
- "type": "closed-beta"
52
+ "type": "beta"
53
53
  }
54
54
  },
55
55
  {
@@ -58,7 +58,7 @@
58
58
  "slug": "primitives/stack",
59
59
  "id": "@atlaskit/primitives/stack",
60
60
  "status": {
61
- "type": "closed-beta"
61
+ "type": "beta"
62
62
  }
63
63
  },
64
64
  {
@@ -67,7 +67,7 @@
67
67
  "slug": "primitives/flex",
68
68
  "id": "@atlaskit/primitives/flex",
69
69
  "status": {
70
- "type": "closed-beta"
70
+ "type": "beta"
71
71
  }
72
72
  },
73
73
  {
@@ -76,7 +76,7 @@
76
76
  "slug": "primitives/grid",
77
77
  "id": "@atlaskit/primitives/grid",
78
78
  "status": {
79
- "type": "closed-beta"
79
+ "type": "beta"
80
80
  }
81
81
  },
82
82
  {
@@ -85,7 +85,7 @@
85
85
  "slug": "primitives/bleed",
86
86
  "id": "@atlaskit/primitives/bleed",
87
87
  "status": {
88
- "type": "closed-beta"
88
+ "type": "beta"
89
89
  }
90
90
  },
91
91
  {
@@ -94,7 +94,7 @@
94
94
  "slug": "primitives/xcss",
95
95
  "id": "@atlaskit/primitives/xcss",
96
96
  "status": {
97
- "type": "closed-beta"
97
+ "type": "beta"
98
98
  }
99
99
  },
100
100
  {
@@ -103,7 +103,7 @@
103
103
  "slug": "primitives/responsive",
104
104
  "id": "@atlaskit/primitives/responsive",
105
105
  "status": {
106
- "type": "closed-beta"
106
+ "type": "beta"
107
107
  }
108
108
  }
109
109
  ]
@@ -114,7 +114,7 @@
114
114
  },
115
115
  "dependencies": {
116
116
  "@atlaskit/focus-ring": "^1.3.0",
117
- "@atlaskit/tokens": "^1.13.0",
117
+ "@atlaskit/tokens": "^1.14.0",
118
118
  "@babel/runtime": "^7.0.0",
119
119
  "@emotion/react": "^11.7.1",
120
120
  "@emotion/serialize": "^1.1.0",
@@ -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
@@ -15,8 +15,6 @@
15
15
  <!--SECTION START: Main Entry Types-->
16
16
 
17
17
  ```ts
18
- /// <reference types="react" />
19
-
20
18
  import { ComponentPropsWithoutRef } from 'react';
21
19
  import { ComponentPropsWithRef } from 'react';
22
20
  import type * as CSS_2 from 'csstype';
@@ -26,7 +24,6 @@ import { ElementType } from 'react';
26
24
  import { FC } from 'react';
27
25
  import { ForwardRefExoticComponent } from 'react';
28
26
  import { jsx } from '@emotion/react';
29
- import { JSXElementConstructor } from 'react';
30
27
  import { MemoExoticComponent } from 'react';
31
28
  import { ReactElement } from 'react';
32
29
  import { ReactNode } from 'react';
@@ -84,7 +81,15 @@ const alignItemsMap_2: {
84
81
  };
85
82
 
86
83
  // @public (undocumented)
87
- type AllowedBoxStyles = keyof SafeCSSObject;
84
+ type AllMedia =
85
+ | '@media (prefers-color-scheme: dark)'
86
+ | '@media (prefers-color-scheme: light)'
87
+ | '@media (prefers-reduced-motion: reduce)'
88
+ | '@media screen and (forced-colors: active), screen and (-ms-high-contrast: active)'
89
+ | MediaQuery;
90
+
91
+ // @public (undocumented)
92
+ type AtRulesWithoutMedia = Exclude<CSS_2.AtRules, '@media'>;
88
93
 
89
94
  // @public (undocumented)
90
95
  type AutoComplete<T extends string> = Omit<string, T> | T;
@@ -241,7 +246,7 @@ type BaseBoxPropsFoundation<T extends ElementType> = {
241
246
  type BasePrimitiveProps = {
242
247
  testId?: string;
243
248
  style?: CSSProperties;
244
- xcss?: BoxXCSS | BoxXCSS[];
249
+ xcss?: Array<XCSS | false | undefined> | XCSS;
245
250
  role?: string;
246
251
  };
247
252
 
@@ -337,22 +342,6 @@ export type BoxProps<T extends ElementType> = Omit<
337
342
  BasePrimitiveProps &
338
343
  BaseBoxPropsFoundation<T>;
339
344
 
340
- // @public (undocumented)
341
- type BoxStyles = SerializedStyles & {
342
- [boxTag]: true;
343
- };
344
-
345
- // @public (undocumented)
346
- const boxTag: unique symbol;
347
-
348
- // @public (undocumented)
349
- type BoxXCSS =
350
- | false
351
- | undefined
352
- | {
353
- readonly [uniqueSymbol]: BoxStyles;
354
- };
355
-
356
345
  // @public
357
346
  export type Breakpoint = 'lg' | 'md' | 'sm' | 'xl' | 'xs' | 'xxs';
358
347
 
@@ -361,14 +350,22 @@ type ClassName = {
361
350
  className?: string;
362
351
  };
363
352
 
353
+ // @public (undocumented)
354
+ type CSSAtRules = {
355
+ [AtRule in AtRulesWithoutMedia as `${AtRule}${string}`]?: Omit<
356
+ SafeCSSObject,
357
+ AtRulesWithoutMedia
358
+ >;
359
+ };
360
+
364
361
  // @public (undocumented)
365
362
  type CSSMediaQueries = {
366
- [MQ in MediaQuery]?: Omit<SafeCSSObject, MediaQuery>;
363
+ [MQ in AllMedia]?: Omit<SafeCSSObject, AllMedia>;
367
364
  };
368
365
 
369
366
  // @public (undocumented)
370
367
  type CSSPseudos = {
371
- [Pseudo in CSS_2.Pseudos]?: Omit<SafeCSSObject, CSS_2.Pseudos | MediaQuery>;
368
+ [Pseudo in CSS_2.Pseudos]?: Omit<SafeCSSObject, AllMedia | CSS_2.Pseudos>;
372
369
  };
373
370
 
374
371
  // @public (undocumented)
@@ -815,16 +812,11 @@ export type PressableProps = Omit<
815
812
 
816
813
  // @public (undocumented)
817
814
  type SafeCSSObject = CSSPseudos &
815
+ CSSAtRules &
818
816
  TokenisedProps &
819
817
  CSSMediaQueries &
820
818
  Omit<CSSPropertiesWithMultiValues, keyof TokenisedProps>;
821
819
 
822
- // @public (undocumented)
823
- type ScopedSafeCSSObject<T extends keyof SafeCSSObject> = Pick<
824
- SafeCSSObject,
825
- T
826
- >;
827
-
828
820
  // @public (undocumented)
829
821
  export type Shadow = keyof typeof shadowMap;
830
822
 
@@ -866,46 +858,6 @@ const spaceMap: {
866
858
  'space.1000': 'var(--ds-space-1000)';
867
859
  };
868
860
 
869
- // @public (undocumented)
870
- type SpaceStyles = SerializedStyles & {
871
- [spaceTag]: true;
872
- };
873
-
874
- // @public (undocumented)
875
- const spaceTag: unique symbol;
876
-
877
- // @public (undocumented)
878
- type Spacing =
879
- | 'columnGap'
880
- | 'gap'
881
- | 'inset'
882
- | 'insetBlock'
883
- | 'insetBlockEnd'
884
- | 'insetBlockStart'
885
- | 'insetInline'
886
- | 'insetInlineEnd'
887
- | 'insetInlineStart'
888
- | 'margin'
889
- | 'marginBlock'
890
- | 'marginBlockEnd'
891
- | 'marginBlockStart'
892
- | 'marginInline'
893
- | 'marginInlineEnd'
894
- | 'marginInlineStart'
895
- | 'outlineOffset'
896
- | 'padding'
897
- | 'paddingBlock'
898
- | 'paddingBlockEnd'
899
- | 'paddingBlockStart'
900
- | 'paddingBottom'
901
- | 'paddingInline'
902
- | 'paddingInlineEnd'
903
- | 'paddingInlineStart'
904
- | 'paddingLeft'
905
- | 'paddingRight'
906
- | 'paddingTop'
907
- | 'rowGap';
908
-
909
861
  // @public (undocumented)
910
862
  type Spread = 'space-between';
911
863
 
@@ -1126,24 +1078,12 @@ export const UNSAFE_media: {
1126
1078
  // @public (undocumented)
1127
1079
  type Wrap = keyof typeof flexWrapMap;
1128
1080
 
1081
+ // @public (undocumented)
1082
+ type XCSS = ReturnType<typeof xcss>;
1083
+
1129
1084
  // @public
1130
- export function xcss<Primitive extends typeof Box | void = typeof Box>(
1131
- style: Primitive extends typeof Box
1132
- ?
1133
- | ScopedSafeCSSObject<AllowedBoxStyles>
1134
- | ScopedSafeCSSObject<AllowedBoxStyles>[]
1135
- : Primitive extends void
1136
- ? ScopedSafeCSSObject<Spacing> | ScopedSafeCSSObject<Spacing>[]
1137
- : never,
1138
- ): {
1139
- readonly [uniqueSymbol]: Primitive extends (<T extends ElementType<any>>(
1140
- props: BoxProps<T>,
1141
- ) => ReactElement<any, JSXElementConstructor<any> | string> | null) &
1142
- FC<BoxProps<'div'>>
1143
- ? BoxStyles
1144
- : Primitive extends void
1145
- ? SpaceStyles
1146
- : never;
1085
+ export function xcss(style: SafeCSSObject): {
1086
+ readonly [uniqueSymbol]: SerializedStyles;
1147
1087
  };
1148
1088
 
1149
1089
  // (No @packageDocumentation comment for this package)
@@ -4,8 +4,6 @@
4
4
 
5
5
  ```ts
6
6
 
7
- /// <reference types="react" />
8
-
9
7
  import { ComponentPropsWithoutRef } from 'react';
10
8
  import { ComponentPropsWithRef } from 'react';
11
9
  import type * as CSS_2 from 'csstype';
@@ -15,7 +13,6 @@ import { ElementType } from 'react';
15
13
  import { FC } from 'react';
16
14
  import { ForwardRefExoticComponent } from 'react';
17
15
  import { jsx } from '@emotion/react';
18
- import { JSXElementConstructor } from 'react';
19
16
  import { MemoExoticComponent } from 'react';
20
17
  import { ReactElement } from 'react';
21
18
  import { ReactNode } from 'react';
@@ -73,7 +70,10 @@ const alignItemsMap_2: {
73
70
  };
74
71
 
75
72
  // @public (undocumented)
76
- type AllowedBoxStyles = keyof SafeCSSObject;
73
+ 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;
74
+
75
+ // @public (undocumented)
76
+ type AtRulesWithoutMedia = Exclude<CSS_2.AtRules, '@media'>;
77
77
 
78
78
  // @public (undocumented)
79
79
  type AutoComplete<T extends string> = Omit<string, T> | T;
@@ -224,7 +224,7 @@ type BaseBoxPropsFoundation<T extends ElementType> = {
224
224
  type BasePrimitiveProps = {
225
225
  testId?: string;
226
226
  style?: CSSProperties;
227
- xcss?: BoxXCSS | BoxXCSS[];
227
+ xcss?: Array<XCSS | false | undefined> | XCSS;
228
228
  role?: string;
229
229
  };
230
230
 
@@ -303,19 +303,6 @@ type BoxComponent<T extends ElementType = 'div'> = (<T extends ElementType>(prop
303
303
  // @public (undocumented)
304
304
  export type BoxProps<T extends ElementType> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & BasePrimitiveProps & BaseBoxPropsFoundation<T>;
305
305
 
306
- // @public (undocumented)
307
- type BoxStyles = SerializedStyles & {
308
- [boxTag]: true;
309
- };
310
-
311
- // @public (undocumented)
312
- const boxTag: unique symbol;
313
-
314
- // @public (undocumented)
315
- type BoxXCSS = false | undefined | {
316
- readonly [uniqueSymbol]: BoxStyles;
317
- };
318
-
319
306
  // @public
320
307
  export type Breakpoint = 'lg' | 'md' | 'sm' | 'xl' | 'xs' | 'xxs';
321
308
 
@@ -324,14 +311,19 @@ type ClassName = {
324
311
  className?: string;
325
312
  };
326
313
 
314
+ // @public (undocumented)
315
+ type CSSAtRules = {
316
+ [AtRule in AtRulesWithoutMedia as `${AtRule}${string}`]?: Omit<SafeCSSObject, AtRulesWithoutMedia>;
317
+ };
318
+
327
319
  // @public (undocumented)
328
320
  type CSSMediaQueries = {
329
- [MQ in MediaQuery]?: Omit<SafeCSSObject, MediaQuery>;
321
+ [MQ in AllMedia]?: Omit<SafeCSSObject, AllMedia>;
330
322
  };
331
323
 
332
324
  // @public (undocumented)
333
325
  type CSSPseudos = {
334
- [Pseudo in CSS_2.Pseudos]?: Omit<SafeCSSObject, CSS_2.Pseudos | MediaQuery>;
326
+ [Pseudo in CSS_2.Pseudos]?: Omit<SafeCSSObject, AllMedia | CSS_2.Pseudos>;
335
327
  };
336
328
 
337
329
  // @public (undocumented)
@@ -558,10 +550,7 @@ export type PressableProps = Omit<BaseBoxProps<'button'>, 'as' | 'children' | 'd
558
550
  };
559
551
 
560
552
  // @public (undocumented)
561
- type SafeCSSObject = CSSPseudos & TokenisedProps & CSSMediaQueries & Omit<CSSPropertiesWithMultiValues, keyof TokenisedProps>;
562
-
563
- // @public (undocumented)
564
- type ScopedSafeCSSObject<T extends keyof SafeCSSObject> = Pick<SafeCSSObject, T>;
553
+ type SafeCSSObject = CSSPseudos & CSSAtRules & TokenisedProps & CSSMediaQueries & Omit<CSSPropertiesWithMultiValues, keyof TokenisedProps>;
565
554
 
566
555
  // @public (undocumented)
567
556
  export type Shadow = keyof typeof shadowMap;
@@ -599,17 +588,6 @@ const spaceMap: {
599
588
  'space.1000': "var(--ds-space-1000)";
600
589
  };
601
590
 
602
- // @public (undocumented)
603
- type SpaceStyles = SerializedStyles & {
604
- [spaceTag]: true;
605
- };
606
-
607
- // @public (undocumented)
608
- const spaceTag: unique symbol;
609
-
610
- // @public (undocumented)
611
- type Spacing = 'columnGap' | 'gap' | 'inset' | 'insetBlock' | 'insetBlockEnd' | 'insetBlockStart' | 'insetInline' | 'insetInlineEnd' | 'insetInlineStart' | 'margin' | 'marginBlock' | 'marginBlockEnd' | 'marginBlockStart' | 'marginInline' | 'marginInlineEnd' | 'marginInlineStart' | 'outlineOffset' | 'padding' | 'paddingBlock' | 'paddingBlockEnd' | 'paddingBlockStart' | 'paddingBottom' | 'paddingInline' | 'paddingInlineEnd' | 'paddingInlineStart' | 'paddingLeft' | 'paddingRight' | 'paddingTop' | 'rowGap';
612
-
613
591
  // @public (undocumented)
614
592
  type Spread = 'space-between';
615
593
 
@@ -800,9 +778,12 @@ export const UNSAFE_media: {
800
778
  // @public (undocumented)
801
779
  type Wrap = keyof typeof flexWrapMap;
802
780
 
781
+ // @public (undocumented)
782
+ type XCSS = ReturnType<typeof xcss>;
783
+
803
784
  // @public
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): {
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;
785
+ export function xcss(style: SafeCSSObject): {
786
+ readonly [uniqueSymbol]: SerializedStyles;
806
787
  };
807
788
 
808
789
  // (No @packageDocumentation comment for this package)
@@ -1,9 +0,0 @@
1
- ---
2
- title: Accessibility
3
- description: Primitives accessibility.
4
- order: 0
5
- ---
6
-
7
- ## Default
8
-
9
- This is placeholder text.