@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.
@@ -4,17 +4,23 @@
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
+ import { CSSPropertiesWithMultiValues } from '@emotion/serialize';
13
+ import { CSSPseudos } from '@emotion/serialize';
10
14
  import { ElementType } from 'react';
11
15
  import { FC } from 'react';
12
16
  import { ForwardRefExoticComponent } from 'react';
17
+ import { JSXElementConstructor } from 'react';
13
18
  import { MemoExoticComponent } from 'react';
14
19
  import { ReactElement } from 'react';
15
20
  import { ReactNode } from 'react';
16
21
  import { RefAttributes } from 'react';
17
22
  import { SerializedStyles } from '@emotion/react';
23
+ import { SerializedStyles as SerializedStyles_2 } from '@emotion/serialize';
18
24
 
19
25
  // @public (undocumented)
20
26
  type AlignBlock = 'baseline' | 'center' | 'end' | 'start';
@@ -40,9 +46,18 @@ const alignSelfMap: {
40
46
  readonly baseline: SerializedStyles;
41
47
  };
42
48
 
49
+ // @public (undocumented)
50
+ type AllowedBoxStyles = keyof SafeCSSObject;
51
+
52
+ // @public (undocumented)
53
+ type AllowedInlineStyles = 'backgroundColor' | 'padding';
54
+
43
55
  // @public (undocumented)
44
56
  type BackgroundColor = keyof typeof backgroundColorMap;
45
57
 
58
+ // @public (undocumented)
59
+ type BackgroundColor_2 = keyof typeof backgroundColorMap_2;
60
+
46
61
  // @public (undocumented)
47
62
  const backgroundColorMap: {
48
63
  readonly 'accent.red.subtlest': SerializedStyles;
@@ -110,7 +125,37 @@ const backgroundColorMap: {
110
125
  };
111
126
 
112
127
  // @public (undocumented)
113
- type BaseBoxProps<T extends ElementType = 'div'> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className' | 'style'> & BasePrimitiveProps & BaseBoxPropsFoundation<T>;
128
+ const backgroundColorMap_2: {
129
+ readonly disabled: "var(--ds-background-disabled)";
130
+ readonly input: "var(--ds-background-input)";
131
+ readonly 'inverse.subtle': "var(--ds-background-inverse-subtle)";
132
+ readonly neutral: "var(--ds-background-neutral)";
133
+ readonly 'neutral.subtle': "var(--ds-background-neutral-subtle)";
134
+ readonly 'neutral.bold': "var(--ds-background-neutral-bold)";
135
+ readonly selected: "var(--ds-background-selected)";
136
+ readonly 'selected.bold': "var(--ds-background-selected-bold)";
137
+ readonly 'brand.bold': "var(--ds-background-brand-bold)";
138
+ readonly danger: "var(--ds-background-danger)";
139
+ readonly 'danger.bold': "var(--ds-background-danger-bold)";
140
+ readonly warning: "var(--ds-background-warning)";
141
+ readonly 'warning.bold': "var(--ds-background-warning-bold)";
142
+ readonly success: "var(--ds-background-success)";
143
+ readonly 'success.bold': "var(--ds-background-success-bold)";
144
+ readonly discovery: "var(--ds-background-discovery)";
145
+ readonly 'discovery.bold': "var(--ds-background-discovery-bold)";
146
+ readonly information: "var(--ds-background-information)";
147
+ readonly 'information.bold': "var(--ds-background-information-bold)";
148
+ readonly 'color.blanket': "var(--ds-blanket)";
149
+ readonly 'color.blanket.selected': "var(--ds-blanket-selected)";
150
+ readonly 'color.blanket.danger': "var(--ds-blanket-danger)";
151
+ readonly 'elevation.surface': "var(--ds-surface)";
152
+ readonly 'elevation.surface.overlay': "var(--ds-surface-overlay)";
153
+ readonly 'elevation.surface.raised': "var(--ds-surface-raised)";
154
+ readonly 'elevation.surface.sunken': "var(--ds-surface-sunken)";
155
+ };
156
+
157
+ // @public (undocumented)
158
+ type BaseBoxProps<T extends ElementType = 'div'> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & BasePrimitiveProps & BaseBoxPropsFoundation<T>;
114
159
 
115
160
  // @public (undocumented)
116
161
  type BaseBoxPropsFoundation<T extends ElementType> = {
@@ -147,14 +192,17 @@ type BaseBoxPropsFoundation<T extends ElementType> = {
147
192
  };
148
193
 
149
194
  // @public (undocumented)
150
- interface BasePrimitiveProps {
195
+ type BasePrimitiveProps = {
151
196
  testId?: string;
152
- UNSAFE_style?: CSSProperties;
153
- }
197
+ style?: CSSProperties;
198
+ };
154
199
 
155
200
  // @public (undocumented)
156
201
  type BorderColor = keyof typeof borderColorMap;
157
202
 
203
+ // @public (undocumented)
204
+ type BorderColor_2 = keyof typeof borderColorMap_2;
205
+
158
206
  // @public
159
207
  const borderColorMap: {
160
208
  readonly 'color.border': SerializedStyles;
@@ -181,6 +229,23 @@ const borderColorMap: {
181
229
  readonly bold: SerializedStyles;
182
230
  };
183
231
 
232
+ // @public (undocumented)
233
+ const borderColorMap_2: {
234
+ readonly 'color.border': "var(--ds-border)";
235
+ readonly disabled: "var(--ds-border-disabled)";
236
+ readonly focused: "var(--ds-border-focused)";
237
+ readonly input: "var(--ds-border-input)";
238
+ readonly inverse: "var(--ds-border-inverse)";
239
+ readonly selected: "var(--ds-border-selected)";
240
+ readonly brand: "var(--ds-border-brand)";
241
+ readonly danger: "var(--ds-border-danger)";
242
+ readonly warning: "var(--ds-border-warning)";
243
+ readonly success: "var(--ds-border-success)";
244
+ readonly discovery: "var(--ds-border-discovery)";
245
+ readonly information: "var(--ds-border-information)";
246
+ readonly bold: "var(--ds-border-bold)";
247
+ };
248
+
184
249
  // @public (undocumented)
185
250
  type BorderRadius = keyof typeof borderRadiusMap;
186
251
 
@@ -205,6 +270,9 @@ const borderStyleMap: {
205
270
  // @public (undocumented)
206
271
  type BorderWidth = keyof typeof borderWidthMap;
207
272
 
273
+ // @public (undocumented)
274
+ type BorderWidth_2 = keyof typeof borderWidthMap_2;
275
+
208
276
  // @public (undocumented)
209
277
  const borderWidthMap: {
210
278
  readonly 'size.0': "var(--ds-width-0)";
@@ -212,6 +280,13 @@ const borderWidthMap: {
212
280
  readonly 'size.100': "var(--ds-width-100)";
213
281
  };
214
282
 
283
+ // @public (undocumented)
284
+ const borderWidthMap_2: {
285
+ readonly 'size.0': "var(--ds-width-0)";
286
+ readonly 'size.050': "var(--ds-width-050)";
287
+ readonly 'size.100': "var(--ds-width-100)";
288
+ };
289
+
215
290
  // @public
216
291
  export const Box: BoxComponent;
217
292
 
@@ -222,16 +297,39 @@ const BOX_RESPONSIVE_PROPS: readonly ["borderWidth", "display", "padding", "padd
222
297
  type BoxComponent<T extends ElementType = 'div'> = (<T extends ElementType = 'div'>(props: BoxProps<T>) => ReactElement | null) & FC<BoxProps<T>>;
223
298
 
224
299
  // @public (undocumented)
225
- export type BoxProps<T extends ElementType = 'div'> = Omit<BaseBoxProps<T>, 'UNSAFE_style' | 'className' | BoxResponsiveProp> & PublicBoxPropsBase;
300
+ export type BoxProps<T extends ElementType = 'div'> = Omit<BaseBoxProps<T>, 'className' | BoxResponsiveProp> & PublicBoxPropsBase;
226
301
 
227
302
  // @public (undocumented)
228
303
  type BoxResponsiveProp = typeof BOX_RESPONSIVE_PROPS[number];
229
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
+
230
319
  // @public
231
320
  type Breakpoint = 'lg' | 'md' | 'sm' | 'xl' | 'xs' | 'xxl' | 'xxs';
232
321
 
233
- // @public
234
- type CustomStyles = Pick<CSSProperties, 'flex' | 'flexBasis' | 'float' | 'height' | 'insetBlockStart' | 'insetInlineEnd' | 'insetInlineStart' | 'margin' | 'marginBlock' | 'marginBlockEnd' | 'marginBlockStart' | 'marginInline' | 'marginInlineEnd' | 'marginInlineStart' | 'maxHeight' | 'maxWidth' | 'minHeight' | 'minWidth' | 'paddingBottom' | 'paddingLeft' | 'paddingRight' | 'paddingTop' | 'width'>;
322
+ // @public (undocumented)
323
+ const dimensionMap: {
324
+ readonly '100%': "100%";
325
+ readonly 'size.100': "16px";
326
+ readonly 'size.200': "24px";
327
+ readonly 'size.300': "32px";
328
+ readonly 'size.400': "40px";
329
+ readonly 'size.500': "48px";
330
+ readonly 'size.600': "96px";
331
+ readonly 'size.1000': "192px";
332
+ };
235
333
 
236
334
  // @public (undocumented)
237
335
  type Display = keyof typeof displayMap;
@@ -280,6 +378,9 @@ type Grow_2 = 'fill' | 'hug';
280
378
  // @public (undocumented)
281
379
  type Height = keyof typeof heightMap;
282
380
 
381
+ // @public (undocumented)
382
+ type Height_2 = keyof typeof dimensionMap;
383
+
283
384
  // @public (undocumented)
284
385
  const heightMap: {
285
386
  readonly '100%': SerializedStyles;
@@ -302,7 +403,6 @@ export interface InlineProps<T extends ElementType = 'div'> {
302
403
  as?: 'div' | 'ol' | 'span' | 'ul';
303
404
  children: ReactNode;
304
405
  grow?: Grow;
305
- // (undocumented)
306
406
  ref?: ComponentPropsWithRef<T>['ref'];
307
407
  rowSpace?: RowSpace;
308
408
  separator?: string;
@@ -312,6 +412,14 @@ export interface InlineProps<T extends ElementType = 'div'> {
312
412
  testId?: string;
313
413
  }
314
414
 
415
+ // @public (undocumented)
416
+ type InlineStyles = SerializedStyles_2 & {
417
+ [inlineTag]: true;
418
+ };
419
+
420
+ // @public (undocumented)
421
+ const inlineTag: unique symbol;
422
+
315
423
  // @public (undocumented)
316
424
  type Layer = keyof typeof LAYERS;
317
425
 
@@ -328,6 +436,18 @@ const LAYERS: {
328
436
  readonly tooltip: 800;
329
437
  };
330
438
 
439
+ // @public (undocumented)
440
+ type MaxHeight = keyof typeof dimensionMap;
441
+
442
+ // @public (undocumented)
443
+ type MaxWidth = keyof typeof dimensionMap;
444
+
445
+ // @public (undocumented)
446
+ type MinHeight = keyof typeof dimensionMap;
447
+
448
+ // @public (undocumented)
449
+ type MinWidth = keyof typeof dimensionMap;
450
+
331
451
  // @public (undocumented)
332
452
  type Overflow = keyof typeof overflowMap;
333
453
 
@@ -358,6 +478,9 @@ const overflowMap: {
358
478
  // @public (undocumented)
359
479
  type Padding = keyof typeof paddingMap;
360
480
 
481
+ // @public (undocumented)
482
+ type Padding_2 = keyof typeof paddingMap_2;
483
+
361
484
  // @public (undocumented)
362
485
  type PaddingBlock = keyof typeof paddingMap;
363
486
 
@@ -394,6 +517,24 @@ const paddingMap: {
394
517
  readonly 'space.1000': "var(--ds-space-1000)";
395
518
  };
396
519
 
520
+ // @public (undocumented)
521
+ const paddingMap_2: {
522
+ readonly 'space.0': "var(--ds-space-0)";
523
+ readonly 'space.025': "var(--ds-space-025)";
524
+ readonly 'space.050': "var(--ds-space-050)";
525
+ readonly 'space.075': "var(--ds-space-075)";
526
+ readonly 'space.100': "var(--ds-space-100)";
527
+ readonly 'space.150': "var(--ds-space-150)";
528
+ readonly 'space.200': "var(--ds-space-200)";
529
+ readonly 'space.250': "var(--ds-space-250)";
530
+ readonly 'space.300': "var(--ds-space-300)";
531
+ readonly 'space.400': "var(--ds-space-400)";
532
+ readonly 'space.500': "var(--ds-space-500)";
533
+ readonly 'space.600': "var(--ds-space-600)";
534
+ readonly 'space.800': "var(--ds-space-800)";
535
+ readonly 'space.1000': "var(--ds-space-1000)";
536
+ };
537
+
397
538
  // @public (undocumented)
398
539
  type Position = keyof typeof positionMap;
399
540
 
@@ -416,7 +557,7 @@ type PublicBoxPropsBase = {
416
557
  paddingInline?: PaddingInline;
417
558
  paddingInlineStart?: PaddingInlineStart;
418
559
  paddingInlineEnd?: PaddingInlineEnd;
419
- customStyles?: CustomStyles;
560
+ xcss?: BoxXCSS;
420
561
  };
421
562
 
422
563
  // @public
@@ -443,6 +584,12 @@ const rowSpaceMap: {
443
584
  readonly '1000': SerializedStyles;
444
585
  };
445
586
 
587
+ // @public (undocumented)
588
+ type SafeCSSObject = CSSPseudos & TokenisedProps & Omit<CSSPropertiesWithMultiValues, keyof TokenisedProps>;
589
+
590
+ // @public (undocumented)
591
+ type ScopedSafeCSSObject<T extends keyof SafeCSSObject> = Pick<SafeCSSObject, T>;
592
+
446
593
  // @public (undocumented)
447
594
  type Shadow = keyof typeof shadowMap;
448
595
 
@@ -513,7 +660,6 @@ export interface StackProps<T extends ElementType = 'div'> {
513
660
  as?: 'div' | 'ol' | 'span' | 'ul';
514
661
  children: ReactNode;
515
662
  grow?: Grow_2;
516
- // (undocumented)
517
663
  ref?: ComponentPropsWithRef<T>['ref'];
518
664
  space?: Space_2;
519
665
  spread?: Spread_2;
@@ -523,6 +669,9 @@ export interface StackProps<T extends ElementType = 'div'> {
523
669
  // @public (undocumented)
524
670
  type TextColor = keyof typeof textColorMap;
525
671
 
672
+ // @public (undocumented)
673
+ type TextColor_2 = keyof typeof textColorMap_2;
674
+
526
675
  // @public (undocumented)
527
676
  const textColorMap: {
528
677
  readonly 'color.text': SerializedStyles;
@@ -558,9 +707,71 @@ const textColorMap: {
558
707
  readonly subtle: SerializedStyles;
559
708
  };
560
709
 
710
+ // @public (undocumented)
711
+ const textColorMap_2: {
712
+ readonly 'color.text': "var(--ds-text)";
713
+ readonly 'accent.red': "var(--ds-text-accent-red)";
714
+ readonly 'accent.red.bolder': "var(--ds-text-accent-red-bolder)";
715
+ readonly 'accent.orange': "var(--ds-text-accent-orange)";
716
+ readonly 'accent.orange.bolder': "var(--ds-text-accent-orange-bolder)";
717
+ readonly 'accent.yellow': "var(--ds-text-accent-yellow)";
718
+ readonly 'accent.yellow.bolder': "var(--ds-text-accent-yellow-bolder)";
719
+ readonly 'accent.green': "var(--ds-text-accent-green)";
720
+ readonly 'accent.green.bolder': "var(--ds-text-accent-green-bolder)";
721
+ readonly 'accent.teal': "var(--ds-text-accent-teal)";
722
+ readonly 'accent.teal.bolder': "var(--ds-text-accent-teal-bolder)";
723
+ readonly 'accent.blue': "var(--ds-text-accent-blue)";
724
+ readonly 'accent.blue.bolder': "var(--ds-text-accent-blue-bolder)";
725
+ readonly 'accent.purple': "var(--ds-text-accent-purple)";
726
+ readonly 'accent.purple.bolder': "var(--ds-text-accent-purple-bolder)";
727
+ readonly 'accent.magenta': "var(--ds-text-accent-magenta)";
728
+ readonly 'accent.magenta.bolder': "var(--ds-text-accent-magenta-bolder)";
729
+ readonly 'accent.gray': "var(--ds-text-accent-gray)";
730
+ readonly 'accent.gray.bolder': "var(--ds-text-accent-gray-bolder)";
731
+ readonly disabled: "var(--ds-text-disabled)";
732
+ readonly inverse: "var(--ds-text-inverse)";
733
+ readonly selected: "var(--ds-text-selected)";
734
+ readonly brand: "var(--ds-text-brand)";
735
+ readonly danger: "var(--ds-text-danger)";
736
+ readonly warning: "var(--ds-text-warning)";
737
+ readonly 'warning.inverse': "var(--ds-text-warning-inverse)";
738
+ readonly success: "var(--ds-text-success)";
739
+ readonly discovery: "var(--ds-text-discovery)";
740
+ readonly information: "var(--ds-text-information)";
741
+ readonly subtlest: "var(--ds-text-subtlest)";
742
+ readonly subtle: "var(--ds-text-subtle)";
743
+ };
744
+
745
+ // @public (undocumented)
746
+ type TokenisedProps = {
747
+ backgroundColor?: BackgroundColor_2;
748
+ borderColor?: BorderColor_2;
749
+ borderWidth?: BorderWidth_2;
750
+ color?: TextColor_2;
751
+ height?: Height_2;
752
+ minHeight?: MinHeight;
753
+ minWidth?: MinWidth;
754
+ maxHeight?: MaxHeight;
755
+ maxWidth?: MaxWidth;
756
+ padding?: Padding_2;
757
+ paddingBlock?: Padding_2;
758
+ paddingInline?: Padding_2;
759
+ paddingBlockStart?: Padding_2;
760
+ paddingBlockEnd?: Padding_2;
761
+ paddingInlineStart?: Padding_2;
762
+ paddingInlineEnd?: Padding_2;
763
+ width?: Width_2;
764
+ };
765
+
766
+ // @public (undocumented)
767
+ const uniqueSymbol: unique symbol;
768
+
561
769
  // @public (undocumented)
562
770
  type Width = keyof typeof widthMap;
563
771
 
772
+ // @public (undocumented)
773
+ type Width_2 = keyof typeof dimensionMap;
774
+
564
775
  // @public
565
776
  const widthMap: {
566
777
  readonly '100%': SerializedStyles;
@@ -573,6 +784,12 @@ const widthMap: {
573
784
  readonly 'size.1000': SerializedStyles;
574
785
  };
575
786
 
787
+ // @public (undocumented)
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): {
789
+ readonly symbol: typeof uniqueSymbol;
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;
791
+ };
792
+
576
793
  // (No @packageDocumentation comment for this package)
577
794
 
578
795
  ```