@atlaskit/primitives 0.4.1 → 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/report.api.md CHANGED
@@ -15,17 +15,23 @@
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
+ import { CSSPropertiesWithMultiValues } from '@emotion/serialize';
24
+ import { CSSPseudos } from '@emotion/serialize';
21
25
  import { ElementType } from 'react';
22
26
  import { FC } from 'react';
23
27
  import { ForwardRefExoticComponent } from 'react';
28
+ import { JSXElementConstructor } from 'react';
24
29
  import { MemoExoticComponent } from 'react';
25
30
  import { ReactElement } from 'react';
26
31
  import { ReactNode } from 'react';
27
32
  import { RefAttributes } from 'react';
28
33
  import { SerializedStyles } from '@emotion/react';
34
+ import { SerializedStyles as SerializedStyles_2 } from '@emotion/serialize';
29
35
 
30
36
  // @public (undocumented)
31
37
  type AlignBlock = 'baseline' | 'center' | 'end' | 'start';
@@ -51,9 +57,18 @@ const alignSelfMap: {
51
57
  readonly baseline: SerializedStyles;
52
58
  };
53
59
 
60
+ // @public (undocumented)
61
+ type AllowedBoxStyles = keyof SafeCSSObject;
62
+
63
+ // @public (undocumented)
64
+ type AllowedInlineStyles = 'backgroundColor' | 'padding';
65
+
54
66
  // @public (undocumented)
55
67
  type BackgroundColor = keyof typeof backgroundColorMap;
56
68
 
69
+ // @public (undocumented)
70
+ type BackgroundColor_2 = keyof typeof backgroundColorMap_2;
71
+
57
72
  // @public (undocumented)
58
73
  const backgroundColorMap: {
59
74
  readonly 'accent.red.subtlest': SerializedStyles;
@@ -120,10 +135,40 @@ const backgroundColorMap: {
120
135
  readonly 'elevation.surface.sunken': SerializedStyles;
121
136
  };
122
137
 
138
+ // @public (undocumented)
139
+ const backgroundColorMap_2: {
140
+ readonly disabled: 'var(--ds-background-disabled)';
141
+ readonly input: 'var(--ds-background-input)';
142
+ readonly 'inverse.subtle': 'var(--ds-background-inverse-subtle)';
143
+ readonly neutral: 'var(--ds-background-neutral)';
144
+ readonly 'neutral.subtle': 'var(--ds-background-neutral-subtle)';
145
+ readonly 'neutral.bold': 'var(--ds-background-neutral-bold)';
146
+ readonly selected: 'var(--ds-background-selected)';
147
+ readonly 'selected.bold': 'var(--ds-background-selected-bold)';
148
+ readonly 'brand.bold': 'var(--ds-background-brand-bold)';
149
+ readonly danger: 'var(--ds-background-danger)';
150
+ readonly 'danger.bold': 'var(--ds-background-danger-bold)';
151
+ readonly warning: 'var(--ds-background-warning)';
152
+ readonly 'warning.bold': 'var(--ds-background-warning-bold)';
153
+ readonly success: 'var(--ds-background-success)';
154
+ readonly 'success.bold': 'var(--ds-background-success-bold)';
155
+ readonly discovery: 'var(--ds-background-discovery)';
156
+ readonly 'discovery.bold': 'var(--ds-background-discovery-bold)';
157
+ readonly information: 'var(--ds-background-information)';
158
+ readonly 'information.bold': 'var(--ds-background-information-bold)';
159
+ readonly 'color.blanket': 'var(--ds-blanket)';
160
+ readonly 'color.blanket.selected': 'var(--ds-blanket-selected)';
161
+ readonly 'color.blanket.danger': 'var(--ds-blanket-danger)';
162
+ readonly 'elevation.surface': 'var(--ds-surface)';
163
+ readonly 'elevation.surface.overlay': 'var(--ds-surface-overlay)';
164
+ readonly 'elevation.surface.raised': 'var(--ds-surface-raised)';
165
+ readonly 'elevation.surface.sunken': 'var(--ds-surface-sunken)';
166
+ };
167
+
123
168
  // @public (undocumented)
124
169
  type BaseBoxProps<T extends ElementType = 'div'> = Omit<
125
170
  ComponentPropsWithoutRef<T>,
126
- 'as' | 'className' | 'style'
171
+ 'as' | 'className'
127
172
  > &
128
173
  BasePrimitiveProps &
129
174
  BaseBoxPropsFoundation<T>;
@@ -165,14 +210,17 @@ type BaseBoxPropsFoundation<T extends ElementType> = {
165
210
  };
166
211
 
167
212
  // @public (undocumented)
168
- interface BasePrimitiveProps {
213
+ type BasePrimitiveProps = {
169
214
  testId?: string;
170
- UNSAFE_style?: CSSProperties;
171
- }
215
+ style?: CSSProperties;
216
+ };
172
217
 
173
218
  // @public (undocumented)
174
219
  type BorderColor = keyof typeof borderColorMap;
175
220
 
221
+ // @public (undocumented)
222
+ type BorderColor_2 = keyof typeof borderColorMap_2;
223
+
176
224
  // @public
177
225
  const borderColorMap: {
178
226
  readonly 'color.border': SerializedStyles;
@@ -199,6 +247,23 @@ const borderColorMap: {
199
247
  readonly bold: SerializedStyles;
200
248
  };
201
249
 
250
+ // @public (undocumented)
251
+ const borderColorMap_2: {
252
+ readonly 'color.border': 'var(--ds-border)';
253
+ readonly disabled: 'var(--ds-border-disabled)';
254
+ readonly focused: 'var(--ds-border-focused)';
255
+ readonly input: 'var(--ds-border-input)';
256
+ readonly inverse: 'var(--ds-border-inverse)';
257
+ readonly selected: 'var(--ds-border-selected)';
258
+ readonly brand: 'var(--ds-border-brand)';
259
+ readonly danger: 'var(--ds-border-danger)';
260
+ readonly warning: 'var(--ds-border-warning)';
261
+ readonly success: 'var(--ds-border-success)';
262
+ readonly discovery: 'var(--ds-border-discovery)';
263
+ readonly information: 'var(--ds-border-information)';
264
+ readonly bold: 'var(--ds-border-bold)';
265
+ };
266
+
202
267
  // @public (undocumented)
203
268
  type BorderRadius = keyof typeof borderRadiusMap;
204
269
 
@@ -223,6 +288,9 @@ const borderStyleMap: {
223
288
  // @public (undocumented)
224
289
  type BorderWidth = keyof typeof borderWidthMap;
225
290
 
291
+ // @public (undocumented)
292
+ type BorderWidth_2 = keyof typeof borderWidthMap_2;
293
+
226
294
  // @public (undocumented)
227
295
  const borderWidthMap: {
228
296
  readonly 'size.0': 'var(--ds-width-0)';
@@ -230,6 +298,13 @@ const borderWidthMap: {
230
298
  readonly 'size.100': 'var(--ds-width-100)';
231
299
  };
232
300
 
301
+ // @public (undocumented)
302
+ const borderWidthMap_2: {
303
+ readonly 'size.0': 'var(--ds-width-0)';
304
+ readonly 'size.050': 'var(--ds-width-050)';
305
+ readonly 'size.100': 'var(--ds-width-100)';
306
+ };
307
+
233
308
  // @public
234
309
  export const Box: BoxComponent;
235
310
 
@@ -257,43 +332,41 @@ type BoxComponent<T extends ElementType = 'div'> = (<
257
332
  // @public (undocumented)
258
333
  export type BoxProps<T extends ElementType = 'div'> = Omit<
259
334
  BaseBoxProps<T>,
260
- 'UNSAFE_style' | 'className' | BoxResponsiveProp
335
+ 'className' | BoxResponsiveProp
261
336
  > &
262
337
  PublicBoxPropsBase;
263
338
 
264
339
  // @public (undocumented)
265
340
  type BoxResponsiveProp = typeof BOX_RESPONSIVE_PROPS[number];
266
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
+
267
356
  // @public
268
357
  type Breakpoint = 'lg' | 'md' | 'sm' | 'xl' | 'xs' | 'xxl' | 'xxs';
269
358
 
270
- // @public
271
- type CustomStyles = Pick<
272
- CSSProperties,
273
- | 'flex'
274
- | 'flexBasis'
275
- | 'float'
276
- | 'height'
277
- | 'insetBlockStart'
278
- | 'insetInlineEnd'
279
- | 'insetInlineStart'
280
- | 'margin'
281
- | 'marginBlock'
282
- | 'marginBlockEnd'
283
- | 'marginBlockStart'
284
- | 'marginInline'
285
- | 'marginInlineEnd'
286
- | 'marginInlineStart'
287
- | 'maxHeight'
288
- | 'maxWidth'
289
- | 'minHeight'
290
- | 'minWidth'
291
- | 'paddingBottom'
292
- | 'paddingLeft'
293
- | 'paddingRight'
294
- | 'paddingTop'
295
- | 'width'
296
- >;
359
+ // @public (undocumented)
360
+ const dimensionMap: {
361
+ readonly '100%': '100%';
362
+ readonly 'size.100': '16px';
363
+ readonly 'size.200': '24px';
364
+ readonly 'size.300': '32px';
365
+ readonly 'size.400': '40px';
366
+ readonly 'size.500': '48px';
367
+ readonly 'size.600': '96px';
368
+ readonly 'size.1000': '192px';
369
+ };
297
370
 
298
371
  // @public (undocumented)
299
372
  type Display = keyof typeof displayMap;
@@ -342,6 +415,9 @@ type Grow_2 = 'fill' | 'hug';
342
415
  // @public (undocumented)
343
416
  type Height = keyof typeof heightMap;
344
417
 
418
+ // @public (undocumented)
419
+ type Height_2 = keyof typeof dimensionMap;
420
+
345
421
  // @public (undocumented)
346
422
  const heightMap: {
347
423
  readonly '100%': SerializedStyles;
@@ -382,7 +458,6 @@ export interface InlineProps<T extends ElementType = 'div'> {
382
458
  as?: 'div' | 'ol' | 'span' | 'ul';
383
459
  children: ReactNode;
384
460
  grow?: Grow;
385
- // (undocumented)
386
461
  ref?: ComponentPropsWithRef<T>['ref'];
387
462
  rowSpace?: RowSpace;
388
463
  separator?: string;
@@ -392,6 +467,14 @@ export interface InlineProps<T extends ElementType = 'div'> {
392
467
  testId?: string;
393
468
  }
394
469
 
470
+ // @public (undocumented)
471
+ type InlineStyles = SerializedStyles_2 & {
472
+ [inlineTag]: true;
473
+ };
474
+
475
+ // @public (undocumented)
476
+ const inlineTag: unique symbol;
477
+
395
478
  // @public (undocumented)
396
479
  type Layer = keyof typeof LAYERS;
397
480
 
@@ -408,6 +491,18 @@ const LAYERS: {
408
491
  readonly tooltip: 800;
409
492
  };
410
493
 
494
+ // @public (undocumented)
495
+ type MaxHeight = keyof typeof dimensionMap;
496
+
497
+ // @public (undocumented)
498
+ type MaxWidth = keyof typeof dimensionMap;
499
+
500
+ // @public (undocumented)
501
+ type MinHeight = keyof typeof dimensionMap;
502
+
503
+ // @public (undocumented)
504
+ type MinWidth = keyof typeof dimensionMap;
505
+
411
506
  // @public (undocumented)
412
507
  type Overflow = keyof typeof overflowMap;
413
508
 
@@ -438,6 +533,9 @@ const overflowMap: {
438
533
  // @public (undocumented)
439
534
  type Padding = keyof typeof paddingMap;
440
535
 
536
+ // @public (undocumented)
537
+ type Padding_2 = keyof typeof paddingMap_2;
538
+
441
539
  // @public (undocumented)
442
540
  type PaddingBlock = keyof typeof paddingMap;
443
541
 
@@ -474,6 +572,24 @@ const paddingMap: {
474
572
  readonly 'space.1000': 'var(--ds-space-1000)';
475
573
  };
476
574
 
575
+ // @public (undocumented)
576
+ const paddingMap_2: {
577
+ readonly 'space.0': 'var(--ds-space-0)';
578
+ readonly 'space.025': 'var(--ds-space-025)';
579
+ readonly 'space.050': 'var(--ds-space-050)';
580
+ readonly 'space.075': 'var(--ds-space-075)';
581
+ readonly 'space.100': 'var(--ds-space-100)';
582
+ readonly 'space.150': 'var(--ds-space-150)';
583
+ readonly 'space.200': 'var(--ds-space-200)';
584
+ readonly 'space.250': 'var(--ds-space-250)';
585
+ readonly 'space.300': 'var(--ds-space-300)';
586
+ readonly 'space.400': 'var(--ds-space-400)';
587
+ readonly 'space.500': 'var(--ds-space-500)';
588
+ readonly 'space.600': 'var(--ds-space-600)';
589
+ readonly 'space.800': 'var(--ds-space-800)';
590
+ readonly 'space.1000': 'var(--ds-space-1000)';
591
+ };
592
+
477
593
  // @public (undocumented)
478
594
  type Position = keyof typeof positionMap;
479
595
 
@@ -496,7 +612,7 @@ type PublicBoxPropsBase = {
496
612
  paddingInline?: PaddingInline;
497
613
  paddingInlineStart?: PaddingInlineStart;
498
614
  paddingInlineEnd?: PaddingInlineEnd;
499
- customStyles?: CustomStyles;
615
+ xcss?: BoxXCSS;
500
616
  };
501
617
 
502
618
  // @public
@@ -523,6 +639,17 @@ const rowSpaceMap: {
523
639
  readonly '1000': SerializedStyles;
524
640
  };
525
641
 
642
+ // @public (undocumented)
643
+ type SafeCSSObject = CSSPseudos &
644
+ TokenisedProps &
645
+ Omit<CSSPropertiesWithMultiValues, keyof TokenisedProps>;
646
+
647
+ // @public (undocumented)
648
+ type ScopedSafeCSSObject<T extends keyof SafeCSSObject> = Pick<
649
+ SafeCSSObject,
650
+ T
651
+ >;
652
+
526
653
  // @public (undocumented)
527
654
  type Shadow = keyof typeof shadowMap;
528
655
 
@@ -608,7 +735,6 @@ export interface StackProps<T extends ElementType = 'div'> {
608
735
  as?: 'div' | 'ol' | 'span' | 'ul';
609
736
  children: ReactNode;
610
737
  grow?: Grow_2;
611
- // (undocumented)
612
738
  ref?: ComponentPropsWithRef<T>['ref'];
613
739
  space?: Space_2;
614
740
  spread?: Spread_2;
@@ -618,6 +744,9 @@ export interface StackProps<T extends ElementType = 'div'> {
618
744
  // @public (undocumented)
619
745
  type TextColor = keyof typeof textColorMap;
620
746
 
747
+ // @public (undocumented)
748
+ type TextColor_2 = keyof typeof textColorMap_2;
749
+
621
750
  // @public (undocumented)
622
751
  const textColorMap: {
623
752
  readonly 'color.text': SerializedStyles;
@@ -653,9 +782,71 @@ const textColorMap: {
653
782
  readonly subtle: SerializedStyles;
654
783
  };
655
784
 
785
+ // @public (undocumented)
786
+ const textColorMap_2: {
787
+ readonly 'color.text': 'var(--ds-text)';
788
+ readonly 'accent.red': 'var(--ds-text-accent-red)';
789
+ readonly 'accent.red.bolder': 'var(--ds-text-accent-red-bolder)';
790
+ readonly 'accent.orange': 'var(--ds-text-accent-orange)';
791
+ readonly 'accent.orange.bolder': 'var(--ds-text-accent-orange-bolder)';
792
+ readonly 'accent.yellow': 'var(--ds-text-accent-yellow)';
793
+ readonly 'accent.yellow.bolder': 'var(--ds-text-accent-yellow-bolder)';
794
+ readonly 'accent.green': 'var(--ds-text-accent-green)';
795
+ readonly 'accent.green.bolder': 'var(--ds-text-accent-green-bolder)';
796
+ readonly 'accent.teal': 'var(--ds-text-accent-teal)';
797
+ readonly 'accent.teal.bolder': 'var(--ds-text-accent-teal-bolder)';
798
+ readonly 'accent.blue': 'var(--ds-text-accent-blue)';
799
+ readonly 'accent.blue.bolder': 'var(--ds-text-accent-blue-bolder)';
800
+ readonly 'accent.purple': 'var(--ds-text-accent-purple)';
801
+ readonly 'accent.purple.bolder': 'var(--ds-text-accent-purple-bolder)';
802
+ readonly 'accent.magenta': 'var(--ds-text-accent-magenta)';
803
+ readonly 'accent.magenta.bolder': 'var(--ds-text-accent-magenta-bolder)';
804
+ readonly 'accent.gray': 'var(--ds-text-accent-gray)';
805
+ readonly 'accent.gray.bolder': 'var(--ds-text-accent-gray-bolder)';
806
+ readonly disabled: 'var(--ds-text-disabled)';
807
+ readonly inverse: 'var(--ds-text-inverse)';
808
+ readonly selected: 'var(--ds-text-selected)';
809
+ readonly brand: 'var(--ds-text-brand)';
810
+ readonly danger: 'var(--ds-text-danger)';
811
+ readonly warning: 'var(--ds-text-warning)';
812
+ readonly 'warning.inverse': 'var(--ds-text-warning-inverse)';
813
+ readonly success: 'var(--ds-text-success)';
814
+ readonly discovery: 'var(--ds-text-discovery)';
815
+ readonly information: 'var(--ds-text-information)';
816
+ readonly subtlest: 'var(--ds-text-subtlest)';
817
+ readonly subtle: 'var(--ds-text-subtle)';
818
+ };
819
+
820
+ // @public (undocumented)
821
+ type TokenisedProps = {
822
+ backgroundColor?: BackgroundColor_2;
823
+ borderColor?: BorderColor_2;
824
+ borderWidth?: BorderWidth_2;
825
+ color?: TextColor_2;
826
+ height?: Height_2;
827
+ minHeight?: MinHeight;
828
+ minWidth?: MinWidth;
829
+ maxHeight?: MaxHeight;
830
+ maxWidth?: MaxWidth;
831
+ padding?: Padding_2;
832
+ paddingBlock?: Padding_2;
833
+ paddingInline?: Padding_2;
834
+ paddingBlockStart?: Padding_2;
835
+ paddingBlockEnd?: Padding_2;
836
+ paddingInlineStart?: Padding_2;
837
+ paddingInlineEnd?: Padding_2;
838
+ width?: Width_2;
839
+ };
840
+
841
+ // @public (undocumented)
842
+ const uniqueSymbol: unique symbol;
843
+
656
844
  // @public (undocumented)
657
845
  type Width = keyof typeof widthMap;
658
846
 
847
+ // @public (undocumented)
848
+ type Width_2 = keyof typeof dimensionMap;
849
+
659
850
  // @public
660
851
  const widthMap: {
661
852
  readonly '100%': SerializedStyles;
@@ -668,6 +859,43 @@ const widthMap: {
668
859
  readonly 'size.1000': SerializedStyles;
669
860
  };
670
861
 
862
+ // @public (undocumented)
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
+ ): {
870
+ readonly symbol: typeof uniqueSymbol;
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;
897
+ };
898
+
671
899
  // (No @packageDocumentation comment for this package)
672
900
  ```
673
901