@atlaskit/primitives 0.4.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/primitives
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`e379d04c74a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e379d04c74a) - Expose a new form of `xcss` that is parameterised so it can be statically bound to the intended usage context.
8
+
3
9
  ## 0.4.2
4
10
 
5
11
  ### Patch Changes
@@ -4,11 +4,14 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.xcss = exports.transformStyles = exports.parseXcss = void 0;
7
+ exports.transformStyles = exports.parseXcss = void 0;
8
+ exports.xcss = xcss;
8
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
10
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
10
11
  var _react = require("@emotion/react");
11
12
  var _styleMaps = require("./style-maps");
13
+ /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
14
+
12
15
  var tokensMap = {
13
16
  backgroundColor: _styleMaps.backgroundColorMap,
14
17
  borderColor: _styleMaps.borderColorMap,
@@ -82,7 +85,7 @@ var transformStyles = function transformStyles(styleObj) {
82
85
  return styleObj;
83
86
  };
84
87
  exports.transformStyles = transformStyles;
85
- var xcss = function xcss(style) {
88
+ var baseXcss = function baseXcss(style) {
86
89
  var transformedStyles = transformStyles(style);
87
90
  return {
88
91
  symbol: uniqueSymbol,
@@ -94,7 +97,6 @@ var xcss = function xcss(style) {
94
97
  * @internal used in primitives
95
98
  * @returns
96
99
  */
97
- exports.xcss = xcss;
98
100
  var parseXcss = function parseXcss(args) {
99
101
  if (Array.isArray(args)) {
100
102
  // @ts-expect-error FIXME
@@ -107,4 +109,14 @@ var parseXcss = function parseXcss(args) {
107
109
  }
108
110
  return styles;
109
111
  };
110
- exports.parseXcss = parseXcss;
112
+ exports.parseXcss = parseXcss;
113
+ // unused private functions only so we can extract the return type from a generic function
114
+ var boxWrapper = function boxWrapper(style) {
115
+ return xcss(style);
116
+ };
117
+ var inlineWrapper = function inlineWrapper(style) {
118
+ return xcss(style);
119
+ };
120
+ function xcss(style) {
121
+ return baseXcss(style);
122
+ }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
1
2
  import { css as cssEmotion } from '@emotion/react';
2
3
  import { backgroundColorMap, borderColorMap, borderRadiusMap, borderWidthMap, dimensionMap, paddingMap, textColorMap } from './style-maps';
3
4
  const tokensMap = {
@@ -69,7 +70,7 @@ export const transformStyles = styleObj => {
69
70
  });
70
71
  return styleObj;
71
72
  };
72
- export const xcss = style => {
73
+ const baseXcss = style => {
73
74
  const transformedStyles = transformStyles(style);
74
75
  return {
75
76
  symbol: uniqueSymbol,
@@ -94,4 +95,10 @@ export const parseXcss = args => {
94
95
  throw new Error('Styles generated from unsafe source, use the `xcss` export from `@atlaskit/primitives`.');
95
96
  }
96
97
  return styles;
97
- };
98
+ };
99
+ // unused private functions only so we can extract the return type from a generic function
100
+ const boxWrapper = style => xcss(style);
101
+ const inlineWrapper = style => xcss(style);
102
+ export function xcss(style) {
103
+ return baseXcss(style);
104
+ }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,6 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import _typeof from "@babel/runtime/helpers/typeof";
3
+ /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
3
4
  import { css as cssEmotion } from '@emotion/react';
4
5
  import { backgroundColorMap, borderColorMap, borderRadiusMap, borderWidthMap, dimensionMap, paddingMap, textColorMap } from './style-maps';
5
6
  var tokensMap = {
@@ -74,7 +75,7 @@ export var transformStyles = function transformStyles(styleObj) {
74
75
  });
75
76
  return styleObj;
76
77
  };
77
- export var xcss = function xcss(style) {
78
+ var baseXcss = function baseXcss(style) {
78
79
  var transformedStyles = transformStyles(style);
79
80
  return {
80
81
  symbol: uniqueSymbol,
@@ -97,4 +98,14 @@ export var parseXcss = function parseXcss(args) {
97
98
  throw new Error('Styles generated from unsafe source, use the `xcss` export from `@atlaskit/primitives`.');
98
99
  }
99
100
  return styles;
100
- };
101
+ };
102
+ // unused private functions only so we can extract the return type from a generic function
103
+ var boxWrapper = function boxWrapper(style) {
104
+ return xcss(style);
105
+ };
106
+ var inlineWrapper = function inlineWrapper(style) {
107
+ return xcss(style);
108
+ };
109
+ export function xcss(style) {
110
+ return baseXcss(style);
111
+ }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
4
4
  "sideEffects": false
5
5
  }
@@ -43,9 +43,12 @@ export interface InlineProps<T extends ElementType = 'div'> {
43
43
  */
44
44
  testId?: string;
45
45
  /**
46
- * Elements to be rendered inside the Stack.
46
+ * Elements to be rendered inside the Inline.
47
47
  */
48
48
  children: ReactNode;
49
+ /**
50
+ * Forwarded ref element
51
+ */
49
52
  ref?: ComponentPropsWithRef<T>['ref'];
50
53
  }
51
54
  export declare type AlignInline = 'start' | 'center' | 'end';
@@ -109,5 +112,5 @@ export declare type RowSpace = keyof typeof rowSpaceMap;
109
112
  * ```
110
113
  *
111
114
  */
112
- declare const Inline: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Pick<InlineProps<ElementType<any>>, "space" | "separator" | "as" | "children" | "testId" | "alignInline" | "alignBlock" | "shouldWrap" | "spread" | "grow" | "rowSpace"> & import("react").RefAttributes<any>>>;
115
+ declare const Inline: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Pick<InlineProps<ElementType<any>>, "as" | "children" | "testId" | "alignInline" | "alignBlock" | "shouldWrap" | "spread" | "grow" | "space" | "rowSpace" | "separator"> & import("react").RefAttributes<any>>>;
113
116
  export default Inline;
@@ -33,6 +33,9 @@ export interface StackProps<T extends ElementType = 'div'> {
33
33
  * Elements to be rendered inside the Stack.
34
34
  */
35
35
  children: ReactNode;
36
+ /**
37
+ * Forwarded ref element
38
+ */
36
39
  ref?: ComponentPropsWithRef<T>['ref'];
37
40
  }
38
41
  export declare type AlignInline = 'start' | 'center' | 'end';
@@ -78,5 +81,5 @@ export declare type Space = keyof typeof spaceMap;
78
81
  * ```
79
82
  *
80
83
  */
81
- declare const Stack: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Pick<StackProps<ElementType<any>>, "space" | "as" | "children" | "testId" | "alignInline" | "alignBlock" | "spread" | "grow"> & import("react").RefAttributes<any>>>;
84
+ declare const Stack: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Pick<StackProps<ElementType<any>>, "as" | "children" | "testId" | "alignInline" | "alignBlock" | "spread" | "grow" | "space"> & import("react").RefAttributes<any>>>;
82
85
  export default Stack;
@@ -1,5 +1,5 @@
1
1
  import type { CSSProperties } from 'react';
2
- import type { SafeCSS } from '../internal/xcss';
2
+ import { type BoxXCSS } from '../internal/xcss';
3
3
  import type { BorderWidth, Display, Padding, PaddingBlock, PaddingBlockEnd, PaddingBlockStart, PaddingInline, PaddingInlineEnd, PaddingInlineStart } from './internal/base-box.partial';
4
4
  export declare type BasePrimitiveProps = {
5
5
  /**
@@ -60,5 +60,5 @@ export declare type PublicBoxPropsBase = {
60
60
  /**
61
61
  * Safe subset of styles that can be applied as a classname.
62
62
  */
63
- xcss?: SafeCSS;
63
+ xcss?: BoxXCSS;
64
64
  };
@@ -1,5 +1,7 @@
1
+ /// <reference types="react" />
1
2
  import { css as cssEmotion } from '@emotion/react';
2
- import { CSSObject, CSSPropertiesWithMultiValues, CSSPseudos } from '@emotion/serialize';
3
+ import { CSSObject, CSSPropertiesWithMultiValues, CSSPseudos, SerializedStyles } from '@emotion/serialize';
4
+ import { Box, Inline } from '../index';
3
5
  import { TokenisedProps } from './style-maps';
4
6
  declare const uniqueSymbol: unique symbol;
5
7
  /**
@@ -7,16 +9,43 @@ declare const uniqueSymbol: unique symbol;
7
9
  * @internal
8
10
  */
9
11
  export declare const transformStyles: (styleObj?: CSSObject | CSSObject[] | undefined) => CSSObject | CSSObject[] | undefined;
10
- declare type XCSS = ReturnType<typeof xcss>;
11
- export declare type SafeCSS = XCSS | XCSS[];
12
- export declare type SafeCSSObject = CSSPseudos & TokenisedProps & Omit<CSSPropertiesWithMultiValues, keyof TokenisedProps>;
13
- export declare const xcss: (style?: SafeCSSObject | SafeCSSObject[] | undefined) => {
14
- readonly symbol: typeof uniqueSymbol;
15
- readonly styles: import("@emotion/react").SerializedStyles;
16
- };
17
12
  /**
18
13
  * @internal used in primitives
19
14
  * @returns
20
15
  */
21
16
  export declare const parseXcss: (args: SafeCSS) => ReturnType<typeof cssEmotion>;
17
+ declare type SafeCSSObject = CSSPseudos & TokenisedProps & Omit<CSSPropertiesWithMultiValues, keyof TokenisedProps>;
18
+ declare type ScopedSafeCSSObject<T extends keyof SafeCSSObject> = Pick<SafeCSSObject, T>;
19
+ declare const boxWrapper: (style: any) => {
20
+ readonly symbol: typeof uniqueSymbol;
21
+ readonly styles: BoxStyles;
22
+ };
23
+ declare const inlineWrapper: (style: any) => {
24
+ readonly symbol: typeof uniqueSymbol;
25
+ readonly styles: InlineStyles;
26
+ };
27
+ declare type XCSS = ReturnType<typeof boxWrapper> | ReturnType<typeof inlineWrapper>;
28
+ declare type SafeCSS = XCSS | XCSS[];
29
+ declare type AllowedBoxStyles = keyof SafeCSSObject;
30
+ declare type AllowedInlineStyles = 'backgroundColor' | 'padding';
31
+ export declare function xcss<Primitive extends typeof Box | typeof Inline = typeof Box>(style: Primitive extends typeof Box ? ScopedSafeCSSObject<AllowedBoxStyles> : Primitive extends typeof Inline ? ScopedSafeCSSObject<AllowedInlineStyles> : never): {
32
+ readonly symbol: typeof uniqueSymbol;
33
+ readonly styles: Primitive extends (<T extends import("react").ElementType<any> = "div">(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 import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Pick<import("../index").InlineProps<import("react").ElementType<any>>, "as" | "children" | "testId" | "alignInline" | "alignBlock" | "shouldWrap" | "spread" | "grow" | "space" | "rowSpace" | "separator"> & import("react").RefAttributes<any>>> ? InlineStyles : never;
34
+ };
35
+ declare const boxTag: unique symbol;
36
+ export declare type BoxStyles = SerializedStyles & {
37
+ [boxTag]: true;
38
+ };
39
+ export declare type BoxXCSS = {
40
+ readonly symbol: typeof uniqueSymbol;
41
+ readonly styles: BoxStyles;
42
+ };
43
+ declare const inlineTag: unique symbol;
44
+ export declare type InlineStyles = SerializedStyles & {
45
+ [inlineTag]: true;
46
+ };
47
+ export declare type InlineXCSS = {
48
+ readonly symbol: typeof uniqueSymbol;
49
+ readonly styles: InlineStyles;
50
+ };
22
51
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
4
4
  "description": "Primitives are token-backed low-level building blocks.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
package/report.api.md CHANGED
@@ -15,6 +15,8 @@
15
15
  <!--SECTION START: Main Entry Types-->
16
16
 
17
17
  ```ts
18
+ /// <reference types="react" />
19
+
18
20
  import { ComponentPropsWithoutRef } from 'react';
19
21
  import { ComponentPropsWithRef } from 'react';
20
22
  import type { CSSProperties } from 'react';
@@ -23,11 +25,13 @@ import { CSSPseudos } from '@emotion/serialize';
23
25
  import { ElementType } from 'react';
24
26
  import { FC } from 'react';
25
27
  import { ForwardRefExoticComponent } from 'react';
28
+ import { JSXElementConstructor } from 'react';
26
29
  import { MemoExoticComponent } from 'react';
27
30
  import { ReactElement } from 'react';
28
31
  import { ReactNode } from 'react';
29
32
  import { RefAttributes } from 'react';
30
33
  import { SerializedStyles } from '@emotion/react';
34
+ import { SerializedStyles as SerializedStyles_2 } from '@emotion/serialize';
31
35
 
32
36
  // @public (undocumented)
33
37
  type AlignBlock = 'baseline' | 'center' | 'end' | 'start';
@@ -53,6 +57,12 @@ const alignSelfMap: {
53
57
  readonly baseline: SerializedStyles;
54
58
  };
55
59
 
60
+ // @public (undocumented)
61
+ type AllowedBoxStyles = keyof SafeCSSObject;
62
+
63
+ // @public (undocumented)
64
+ type AllowedInlineStyles = 'backgroundColor' | 'padding';
65
+
56
66
  // @public (undocumented)
57
67
  type BackgroundColor = keyof typeof backgroundColorMap;
58
68
 
@@ -329,6 +339,20 @@ export type BoxProps<T extends ElementType = 'div'> = Omit<
329
339
  // @public (undocumented)
330
340
  type BoxResponsiveProp = typeof BOX_RESPONSIVE_PROPS[number];
331
341
 
342
+ // @public (undocumented)
343
+ type BoxStyles = SerializedStyles_2 & {
344
+ [boxTag]: true;
345
+ };
346
+
347
+ // @public (undocumented)
348
+ const boxTag: unique symbol;
349
+
350
+ // @public (undocumented)
351
+ type BoxXCSS = {
352
+ readonly symbol: typeof uniqueSymbol;
353
+ readonly styles: BoxStyles;
354
+ };
355
+
332
356
  // @public
333
357
  type Breakpoint = 'lg' | 'md' | 'sm' | 'xl' | 'xs' | 'xxl' | 'xxs';
334
358
 
@@ -434,7 +458,6 @@ export interface InlineProps<T extends ElementType = 'div'> {
434
458
  as?: 'div' | 'ol' | 'span' | 'ul';
435
459
  children: ReactNode;
436
460
  grow?: Grow;
437
- // (undocumented)
438
461
  ref?: ComponentPropsWithRef<T>['ref'];
439
462
  rowSpace?: RowSpace;
440
463
  separator?: string;
@@ -444,6 +467,14 @@ export interface InlineProps<T extends ElementType = 'div'> {
444
467
  testId?: string;
445
468
  }
446
469
 
470
+ // @public (undocumented)
471
+ type InlineStyles = SerializedStyles_2 & {
472
+ [inlineTag]: true;
473
+ };
474
+
475
+ // @public (undocumented)
476
+ const inlineTag: unique symbol;
477
+
447
478
  // @public (undocumented)
448
479
  type Layer = keyof typeof LAYERS;
449
480
 
@@ -581,7 +612,7 @@ type PublicBoxPropsBase = {
581
612
  paddingInline?: PaddingInline;
582
613
  paddingInlineStart?: PaddingInlineStart;
583
614
  paddingInlineEnd?: PaddingInlineEnd;
584
- xcss?: SafeCSS;
615
+ xcss?: BoxXCSS;
585
616
  };
586
617
 
587
618
  // @public
@@ -608,14 +639,17 @@ const rowSpaceMap: {
608
639
  readonly '1000': SerializedStyles;
609
640
  };
610
641
 
611
- // @public (undocumented)
612
- type SafeCSS = XCSS | XCSS[];
613
-
614
642
  // @public (undocumented)
615
643
  type SafeCSSObject = CSSPseudos &
616
644
  TokenisedProps &
617
645
  Omit<CSSPropertiesWithMultiValues, keyof TokenisedProps>;
618
646
 
647
+ // @public (undocumented)
648
+ type ScopedSafeCSSObject<T extends keyof SafeCSSObject> = Pick<
649
+ SafeCSSObject,
650
+ T
651
+ >;
652
+
619
653
  // @public (undocumented)
620
654
  type Shadow = keyof typeof shadowMap;
621
655
 
@@ -701,7 +735,6 @@ export interface StackProps<T extends ElementType = 'div'> {
701
735
  as?: 'div' | 'ol' | 'span' | 'ul';
702
736
  children: ReactNode;
703
737
  grow?: Grow_2;
704
- // (undocumented)
705
738
  ref?: ComponentPropsWithRef<T>['ref'];
706
739
  space?: Space_2;
707
740
  spread?: Spread_2;
@@ -827,12 +860,40 @@ const widthMap: {
827
860
  };
828
861
 
829
862
  // @public (undocumented)
830
- type XCSS = ReturnType<typeof xcss>;
831
-
832
- // @public (undocumented)
833
- export const xcss: (style?: SafeCSSObject | SafeCSSObject[] | undefined) => {
863
+ export function xcss<Primitive extends typeof Box | typeof Inline = typeof Box>(
864
+ style: Primitive extends typeof Box
865
+ ? ScopedSafeCSSObject<AllowedBoxStyles>
866
+ : Primitive extends typeof Inline
867
+ ? ScopedSafeCSSObject<AllowedInlineStyles>
868
+ : never,
869
+ ): {
834
870
  readonly symbol: typeof uniqueSymbol;
835
- readonly styles: SerializedStyles;
871
+ readonly styles: Primitive extends (<T extends ElementType<any> = 'div'>(
872
+ props: BoxProps<T>,
873
+ ) => ReactElement<any, JSXElementConstructor<any> | string> | null) &
874
+ FC<BoxProps<'div'>>
875
+ ? BoxStyles
876
+ : Primitive extends MemoExoticComponent<
877
+ ForwardRefExoticComponent<
878
+ Pick<
879
+ InlineProps<ElementType<any>>,
880
+ | 'alignBlock'
881
+ | 'alignInline'
882
+ | 'as'
883
+ | 'children'
884
+ | 'grow'
885
+ | 'rowSpace'
886
+ | 'separator'
887
+ | 'shouldWrap'
888
+ | 'space'
889
+ | 'spread'
890
+ | 'testId'
891
+ > &
892
+ RefAttributes<any>
893
+ >
894
+ >
895
+ ? InlineStyles
896
+ : never;
836
897
  };
837
898
 
838
899
  // (No @packageDocumentation comment for this package)
@@ -4,6 +4,8 @@
4
4
 
5
5
  ```ts
6
6
 
7
+ /// <reference types="react" />
8
+
7
9
  import { ComponentPropsWithoutRef } from 'react';
8
10
  import { ComponentPropsWithRef } from 'react';
9
11
  import type { CSSProperties } from 'react';
@@ -12,11 +14,13 @@ import { CSSPseudos } from '@emotion/serialize';
12
14
  import { ElementType } from 'react';
13
15
  import { FC } from 'react';
14
16
  import { ForwardRefExoticComponent } from 'react';
17
+ import { JSXElementConstructor } from 'react';
15
18
  import { MemoExoticComponent } from 'react';
16
19
  import { ReactElement } from 'react';
17
20
  import { ReactNode } from 'react';
18
21
  import { RefAttributes } from 'react';
19
22
  import { SerializedStyles } from '@emotion/react';
23
+ import { SerializedStyles as SerializedStyles_2 } from '@emotion/serialize';
20
24
 
21
25
  // @public (undocumented)
22
26
  type AlignBlock = 'baseline' | 'center' | 'end' | 'start';
@@ -42,6 +46,12 @@ const alignSelfMap: {
42
46
  readonly baseline: SerializedStyles;
43
47
  };
44
48
 
49
+ // @public (undocumented)
50
+ type AllowedBoxStyles = keyof SafeCSSObject;
51
+
52
+ // @public (undocumented)
53
+ type AllowedInlineStyles = 'backgroundColor' | 'padding';
54
+
45
55
  // @public (undocumented)
46
56
  type BackgroundColor = keyof typeof backgroundColorMap;
47
57
 
@@ -292,6 +302,20 @@ export type BoxProps<T extends ElementType = 'div'> = Omit<BaseBoxProps<T>, 'cla
292
302
  // @public (undocumented)
293
303
  type BoxResponsiveProp = typeof BOX_RESPONSIVE_PROPS[number];
294
304
 
305
+ // @public (undocumented)
306
+ type BoxStyles = SerializedStyles_2 & {
307
+ [boxTag]: true;
308
+ };
309
+
310
+ // @public (undocumented)
311
+ const boxTag: unique symbol;
312
+
313
+ // @public (undocumented)
314
+ type BoxXCSS = {
315
+ readonly symbol: typeof uniqueSymbol;
316
+ readonly styles: BoxStyles;
317
+ };
318
+
295
319
  // @public
296
320
  type Breakpoint = 'lg' | 'md' | 'sm' | 'xl' | 'xs' | 'xxl' | 'xxs';
297
321
 
@@ -379,7 +403,6 @@ export interface InlineProps<T extends ElementType = 'div'> {
379
403
  as?: 'div' | 'ol' | 'span' | 'ul';
380
404
  children: ReactNode;
381
405
  grow?: Grow;
382
- // (undocumented)
383
406
  ref?: ComponentPropsWithRef<T>['ref'];
384
407
  rowSpace?: RowSpace;
385
408
  separator?: string;
@@ -389,6 +412,14 @@ export interface InlineProps<T extends ElementType = 'div'> {
389
412
  testId?: string;
390
413
  }
391
414
 
415
+ // @public (undocumented)
416
+ type InlineStyles = SerializedStyles_2 & {
417
+ [inlineTag]: true;
418
+ };
419
+
420
+ // @public (undocumented)
421
+ const inlineTag: unique symbol;
422
+
392
423
  // @public (undocumented)
393
424
  type Layer = keyof typeof LAYERS;
394
425
 
@@ -526,7 +557,7 @@ type PublicBoxPropsBase = {
526
557
  paddingInline?: PaddingInline;
527
558
  paddingInlineStart?: PaddingInlineStart;
528
559
  paddingInlineEnd?: PaddingInlineEnd;
529
- xcss?: SafeCSS;
560
+ xcss?: BoxXCSS;
530
561
  };
531
562
 
532
563
  // @public
@@ -554,10 +585,10 @@ const rowSpaceMap: {
554
585
  };
555
586
 
556
587
  // @public (undocumented)
557
- type SafeCSS = XCSS | XCSS[];
588
+ type SafeCSSObject = CSSPseudos & TokenisedProps & Omit<CSSPropertiesWithMultiValues, keyof TokenisedProps>;
558
589
 
559
590
  // @public (undocumented)
560
- type SafeCSSObject = CSSPseudos & TokenisedProps & Omit<CSSPropertiesWithMultiValues, keyof TokenisedProps>;
591
+ type ScopedSafeCSSObject<T extends keyof SafeCSSObject> = Pick<SafeCSSObject, T>;
561
592
 
562
593
  // @public (undocumented)
563
594
  type Shadow = keyof typeof shadowMap;
@@ -629,7 +660,6 @@ export interface StackProps<T extends ElementType = 'div'> {
629
660
  as?: 'div' | 'ol' | 'span' | 'ul';
630
661
  children: ReactNode;
631
662
  grow?: Grow_2;
632
- // (undocumented)
633
663
  ref?: ComponentPropsWithRef<T>['ref'];
634
664
  space?: Space_2;
635
665
  spread?: Spread_2;
@@ -755,12 +785,9 @@ const widthMap: {
755
785
  };
756
786
 
757
787
  // @public (undocumented)
758
- type XCSS = ReturnType<typeof xcss>;
759
-
760
- // @public (undocumented)
761
- export const xcss: (style?: SafeCSSObject | SafeCSSObject[] | undefined) => {
788
+ export function xcss<Primitive extends typeof Box | typeof Inline = typeof Box>(style: Primitive extends typeof Box ? ScopedSafeCSSObject<AllowedBoxStyles> : Primitive extends typeof Inline ? ScopedSafeCSSObject<AllowedInlineStyles> : never): {
762
789
  readonly symbol: typeof uniqueSymbol;
763
- readonly styles: SerializedStyles;
790
+ readonly styles: Primitive extends (<T extends ElementType<any> = "div">(props: BoxProps<T>) => ReactElement<any, JSXElementConstructor<any>| string> | null) & FC<BoxProps<"div">> ? BoxStyles : Primitive extends MemoExoticComponent<ForwardRefExoticComponent<Pick<InlineProps<ElementType<any>>, "alignBlock" | "alignInline" | "as" | "children" | "grow" | "rowSpace" | "separator" | "shouldWrap" | "space" | "spread" | "testId"> & RefAttributes<any>>> ? InlineStyles : never;
764
791
  };
765
792
 
766
793
  // (No @packageDocumentation comment for this package)