@atlaskit/primitives 0.13.0 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/constellation/xcss/examples.mdx +9 -2
  3. package/constellation/xcss/migration.mdx +14 -18
  4. package/constellation/xcss/usage.mdx +57 -19
  5. package/dist/cjs/index.js +14 -1
  6. package/dist/cjs/version.json +1 -1
  7. package/dist/cjs/xcss/style-maps.partial.js +6 -78
  8. package/dist/cjs/xcss/xcss.js +11 -16
  9. package/dist/es2019/index.js +2 -1
  10. package/dist/es2019/version.json +1 -1
  11. package/dist/es2019/xcss/style-maps.partial.js +5 -66
  12. package/dist/es2019/xcss/xcss.js +12 -17
  13. package/dist/esm/index.js +2 -1
  14. package/dist/esm/version.json +1 -1
  15. package/dist/esm/xcss/style-maps.partial.js +5 -66
  16. package/dist/esm/xcss/xcss.js +12 -17
  17. package/dist/types/index.d.ts +1 -0
  18. package/dist/types/xcss/style-maps.partial.d.ts +22 -122
  19. package/dist/types/xcss/xcss.d.ts +1 -1
  20. package/dist/types-ts4.5/index.d.ts +1 -0
  21. package/dist/types-ts4.5/xcss/style-maps.partial.d.ts +22 -122
  22. package/dist/types-ts4.5/xcss/xcss.d.ts +1 -1
  23. package/package.json +2 -2
  24. package/report.api.md +91 -213
  25. package/scripts/codegen-file-templates/dimensions.tsx +1 -18
  26. package/scripts/codegen-styles.tsx +1 -1
  27. package/scripts/misc-codegen-template.tsx +1 -10
  28. package/tmp/api-report-tmp.d.ts +85 -214
  29. package/scripts/codegen-file-templates/align-self.tsx +0 -9
  30. package/scripts/codegen-file-templates/border-style.tsx +0 -6
  31. package/scripts/codegen-file-templates/display.tsx +0 -10
  32. package/scripts/codegen-file-templates/flex-direction.tsx +0 -6
  33. package/scripts/codegen-file-templates/flex-grow.tsx +0 -6
  34. package/scripts/codegen-file-templates/flex-shrink.tsx +0 -6
  35. package/scripts/codegen-file-templates/flex.tsx +0 -5
  36. package/scripts/codegen-file-templates/overflow.tsx +0 -20
  37. package/scripts/codegen-file-templates/position.tsx +0 -8
package/report.api.md CHANGED
@@ -43,18 +43,6 @@ type AlignInline = 'center' | 'end' | 'start';
43
43
  // @public (undocumented)
44
44
  type AlignInline_2 = 'center' | 'end' | 'start';
45
45
 
46
- // @public (undocumented)
47
- type AlignSelf = keyof typeof alignSelfMap;
48
-
49
- // @public
50
- const alignSelfMap: {
51
- readonly center: 'center';
52
- readonly start: 'start';
53
- readonly stretch: 'stretch';
54
- readonly end: 'end';
55
- readonly baseline: 'baseline';
56
- };
57
-
58
46
  // @public (undocumented)
59
47
  type AllowedBoxStyles = keyof SafeCSSObject;
60
48
 
@@ -222,9 +210,6 @@ type BasePrimitiveProps = {
222
210
  style?: CSSProperties;
223
211
  };
224
212
 
225
- // @public (undocumented)
226
- type BlockSize = Dimension;
227
-
228
213
  // @public (undocumented)
229
214
  type BorderColor = keyof typeof borderColorMap;
230
215
 
@@ -269,15 +254,6 @@ const borderRadiusMap: {
269
254
  readonly 'border.radius.circle': 'var(--ds-border-radius-circle)';
270
255
  };
271
256
 
272
- // @public (undocumented)
273
- type BorderStyle = keyof typeof borderStyleMap;
274
-
275
- // @public (undocumented)
276
- const borderStyleMap: {
277
- readonly none: 'none';
278
- readonly solid: 'solid';
279
- };
280
-
281
257
  // @public (undocumented)
282
258
  type BorderWidth = keyof typeof borderWidthMap;
283
259
 
@@ -289,9 +265,6 @@ const borderWidthMap: {
289
265
  readonly 'border.width.100': 'var(--ds-border-width-100)';
290
266
  };
291
267
 
292
- // @public (undocumented)
293
- type Bottom = Dimension;
294
-
295
268
  // @public
296
269
  export const Box: BoxComponent;
297
270
 
@@ -324,7 +297,7 @@ type BoxXCSS = {
324
297
  };
325
298
 
326
299
  // @public
327
- type Breakpoint = 'lg' | 'md' | 'sm' | 'xl' | 'xs' | 'xxs';
300
+ export type Breakpoint = 'lg' | 'md' | 'sm' | 'xl' | 'xs' | 'xxs';
328
301
 
329
302
  // @public (undocumented)
330
303
  type CSSMediaQueries = {
@@ -351,92 +324,12 @@ const dimensionMap: {
351
324
  readonly 'size.1000': '12rem';
352
325
  };
353
326
 
354
- // @public (undocumented)
355
- type Display = keyof typeof displayMap;
356
-
357
- // @public (undocumented)
358
- const displayMap: {
359
- readonly flex: 'flex';
360
- readonly block: 'block';
361
- readonly inline: 'inline';
362
- readonly inlineBlock: 'inline-block';
363
- readonly inlineFlex: 'inline-flex';
364
- readonly grid: 'grid';
365
- };
366
-
367
- // @public (undocumented)
368
- type Fill = keyof typeof fillMap;
369
-
370
- // @public (undocumented)
371
- const fillMap: {
372
- readonly 'color.icon': 'var(--ds-icon)';
373
- readonly 'color.icon.accent.lime': 'var(--ds-icon-accent-lime)';
374
- readonly 'color.icon.accent.red': 'var(--ds-icon-accent-red)';
375
- readonly 'color.icon.accent.orange': 'var(--ds-icon-accent-orange)';
376
- readonly 'color.icon.accent.yellow': 'var(--ds-icon-accent-yellow)';
377
- readonly 'color.icon.accent.green': 'var(--ds-icon-accent-green)';
378
- readonly 'color.icon.accent.teal': 'var(--ds-icon-accent-teal)';
379
- readonly 'color.icon.accent.blue': 'var(--ds-icon-accent-blue)';
380
- readonly 'color.icon.accent.purple': 'var(--ds-icon-accent-purple)';
381
- readonly 'color.icon.accent.magenta': 'var(--ds-icon-accent-magenta)';
382
- readonly 'color.icon.accent.gray': 'var(--ds-icon-accent-gray)';
383
- readonly 'color.icon.disabled': 'var(--ds-icon-disabled)';
384
- readonly 'color.icon.inverse': 'var(--ds-icon-inverse)';
385
- readonly 'color.icon.selected': 'var(--ds-icon-selected)';
386
- readonly 'color.icon.brand': 'var(--ds-icon-brand)';
387
- readonly 'color.icon.danger': 'var(--ds-icon-danger)';
388
- readonly 'color.icon.warning': 'var(--ds-icon-warning)';
389
- readonly 'color.icon.warning.inverse': 'var(--ds-icon-warning-inverse)';
390
- readonly 'color.icon.success': 'var(--ds-icon-success)';
391
- readonly 'color.icon.discovery': 'var(--ds-icon-discovery)';
392
- readonly 'color.icon.information': 'var(--ds-icon-information)';
393
- readonly 'color.icon.subtle': 'var(--ds-icon-subtle)';
394
- };
395
-
396
- // @public (undocumented)
397
- type Flex = keyof typeof flexMap;
398
-
399
- // @public (undocumented)
400
- type FlexDirection = keyof typeof flexDirectionMap;
401
-
402
- // @public (undocumented)
403
- const flexDirectionMap: {
404
- readonly row: 'row';
405
- readonly column: 'column';
406
- };
407
-
408
- // @public (undocumented)
409
- type FlexGrow = keyof typeof flexGrowMap;
410
-
411
- // @public (undocumented)
412
- const flexGrowMap: {
413
- readonly '0': 0;
414
- readonly '1': 1;
415
- };
416
-
417
- // @public (undocumented)
418
- const flexMap: {
419
- readonly '1': 1;
420
- };
421
-
422
- // @public (undocumented)
423
- type FlexShrink = keyof typeof flexShrinkMap;
424
-
425
- // @public (undocumented)
426
- const flexShrinkMap: {
427
- readonly '0': '0';
428
- readonly '1': 1;
429
- };
430
-
431
327
  // @public (undocumented)
432
328
  type Grow = 'fill' | 'hug';
433
329
 
434
330
  // @public (undocumented)
435
331
  type Grow_2 = 'fill' | 'hug';
436
332
 
437
- // @public (undocumented)
438
- type Height = Dimension;
439
-
440
333
  // @public
441
334
  export const Inline: MemoExoticComponent<
442
335
  ForwardRefExoticComponent<
@@ -476,9 +369,6 @@ export interface InlineProps<T extends ElementType = 'div'> {
476
369
  xcss?: Array<InlineXCSS | false | undefined> | InlineXCSS;
477
370
  }
478
371
 
479
- // @public (undocumented)
480
- type InlineSize = Dimension;
481
-
482
372
  // @public (undocumented)
483
373
  type InlineStyles = SerializedStyles & {
484
374
  [inlineTag]: true;
@@ -495,7 +385,7 @@ type InlineXCSS = {
495
385
  // @public (undocumented)
496
386
  type Layer = keyof typeof layerMap;
497
387
 
498
- // @public (undocumented)
388
+ // @public
499
389
  const layerMap: {
500
390
  readonly card: 100;
501
391
  readonly navigation: 200;
@@ -508,21 +398,6 @@ const layerMap: {
508
398
  readonly tooltip: 800;
509
399
  };
510
400
 
511
- // @public (undocumented)
512
- type Left = Dimension;
513
-
514
- // @public (undocumented)
515
- type MaxBlockSize = Dimension;
516
-
517
- // @public (undocumented)
518
- type MaxHeight = Dimension;
519
-
520
- // @public (undocumented)
521
- type MaxInlineSize = Dimension;
522
-
523
- // @public (undocumented)
524
- type MaxWidth = Dimension;
525
-
526
401
  // @public
527
402
  const media: {
528
403
  readonly above: {
@@ -538,64 +413,11 @@ const media: {
538
413
  // @public
539
414
  type MediaQuery = (typeof media.above)[Breakpoint];
540
415
 
541
- // @public (undocumented)
542
- type MinBlockSize = Dimension;
543
-
544
- // @public (undocumented)
545
- type MinHeight = Dimension;
546
-
547
- // @public (undocumented)
548
- type MinInlineSize = Dimension;
549
-
550
- // @public (undocumented)
551
- type MinWidth = Dimension;
552
-
553
- // @public (undocumented)
554
- type Overflow = keyof typeof overflowMap;
555
-
556
- // @public (undocumented)
557
- type OverflowBlock = keyof typeof overflowBlockMap;
558
-
559
- // @public (undocumented)
560
- const overflowBlockMap: {
561
- readonly auto: 'auto';
562
- readonly hidden: 'hidden';
563
- };
564
-
565
- // @public (undocumented)
566
- type OverflowInline = keyof typeof overflowInlineMap;
567
-
568
- // @public (undocumented)
569
- const overflowInlineMap: {
570
- readonly auto: 'auto';
571
- readonly hidden: 'hidden';
572
- };
573
-
574
- // @public (undocumented)
575
- const overflowMap: {
576
- readonly auto: 'auto';
577
- readonly hidden: 'hidden';
578
- };
579
-
580
- // @public (undocumented)
581
- type Position = keyof typeof positionMap;
582
-
583
- // @public (undocumented)
584
- const positionMap: {
585
- readonly absolute: 'absolute';
586
- readonly fixed: 'fixed';
587
- readonly relative: 'relative';
588
- readonly static: 'static';
589
- };
590
-
591
416
  // @public (undocumented)
592
417
  type PublicBoxPropsBase = {
593
418
  xcss?: Array<BoxXCSS | false | undefined> | BoxXCSS;
594
419
  };
595
420
 
596
- // @public (undocumented)
597
- type Right = Dimension;
598
-
599
421
  // @public (undocumented)
600
422
  type SafeCSSObject = CSSPseudos &
601
423
  TokenisedProps &
@@ -652,6 +474,13 @@ type Spacing =
652
474
  | 'insetInline'
653
475
  | 'insetInlineEnd'
654
476
  | 'insetInlineStart'
477
+ | 'margin'
478
+ | 'marginBlock'
479
+ | 'marginBlockEnd'
480
+ | 'marginBlockStart'
481
+ | 'marginInline'
482
+ | 'marginInlineEnd'
483
+ | 'marginInlineStart'
655
484
  | 'outlineOffset'
656
485
  | 'padding'
657
486
  | 'paddingBlock'
@@ -745,26 +574,18 @@ const textColorMap: {
745
574
 
746
575
  // @public (undocumented)
747
576
  type TokenisedProps = {
748
- alignSelf?: AlignSelf;
749
577
  backgroundColor?: BackgroundColor;
750
- blockSize?: BlockSize;
578
+ blockSize?: AutoComplete<Dimension>;
751
579
  borderColor?: BorderColor;
752
580
  borderRadius?: BorderRadius;
753
- borderStyle?: BorderStyle;
754
581
  borderWidth?: BorderWidth;
755
- bottom?: Bottom;
582
+ bottom?: AutoComplete<Space>;
756
583
  boxShadow?: Shadow;
757
584
  color?: TextColor;
758
585
  columnGap?: Space;
759
- display?: Display;
760
- fill?: Fill;
761
- flex?: Flex;
762
- flexDirection?: FlexDirection;
763
- flexGrow?: FlexGrow;
764
- flexShrink?: FlexShrink;
765
586
  gap?: Space;
766
- height?: AutoComplete<Height>;
767
- inlineSize?: InlineSize;
587
+ height?: AutoComplete<Dimension>;
588
+ inlineSize?: AutoComplete<Dimension>;
768
589
  inset?: Space;
769
590
  insetBlock?: Space;
770
591
  insetBlockEnd?: Space;
@@ -772,21 +593,18 @@ type TokenisedProps = {
772
593
  insetInline?: Space;
773
594
  insetInlineEnd?: Space;
774
595
  insetInlineStart?: Space;
775
- left?: Left;
776
- maxBlockSize?: AutoComplete<MaxBlockSize>;
777
- maxHeight?: AutoComplete<MaxHeight>;
778
- maxInlineSize?: AutoComplete<MaxInlineSize>;
779
- maxWidth?: AutoComplete<MaxWidth>;
780
- minBlockSize?: AutoComplete<MinBlockSize>;
781
- minHeight?: AutoComplete<MinHeight>;
782
- minInlineSize?: AutoComplete<MinInlineSize>;
783
- minWidth?: AutoComplete<MinWidth>;
596
+ left?: AutoComplete<Space>;
597
+ maxBlockSize?: AutoComplete<Dimension>;
598
+ maxHeight?: AutoComplete<Dimension>;
599
+ maxInlineSize?: AutoComplete<Dimension>;
600
+ maxWidth?: AutoComplete<Dimension>;
601
+ minBlockSize?: AutoComplete<Dimension>;
602
+ minHeight?: AutoComplete<Dimension>;
603
+ minInlineSize?: AutoComplete<Dimension>;
604
+ minWidth?: AutoComplete<Dimension>;
784
605
  outlineColor?: BorderColor;
785
606
  outlineOffset?: Space;
786
607
  outlineWidth?: BorderWidth;
787
- overflow?: Overflow;
788
- overflowBlock?: OverflowBlock;
789
- overflowInline?: OverflowInline;
790
608
  padding?: Space;
791
609
  paddingBlock?: Space;
792
610
  paddingBlockEnd?: Space;
@@ -794,22 +612,82 @@ type TokenisedProps = {
794
612
  paddingInline?: Space;
795
613
  paddingInlineEnd?: Space;
796
614
  paddingInlineStart?: Space;
797
- position?: Position;
798
- right?: Right;
615
+ right?: AutoComplete<Space>;
799
616
  rowGap?: Space;
800
- top?: Top;
801
- width?: AutoComplete<Width>;
617
+ top?: AutoComplete<Space>;
618
+ width?: AutoComplete<Dimension>;
802
619
  zIndex?: Layer;
803
620
  };
804
621
 
805
- // @public (undocumented)
806
- type Top = Dimension;
807
-
808
622
  // @public (undocumented)
809
623
  const uniqueSymbol: unique symbol;
810
624
 
811
- // @public (undocumented)
812
- type Width = Dimension;
625
+ // @public
626
+ export const UNSAFE_BREAKPOINTS_CONFIG: {
627
+ readonly xxs: {
628
+ readonly gridItemGutter: 'var(--ds-space-200)';
629
+ readonly gridMargin: 'var(--ds-space-200)';
630
+ readonly min: '0rem';
631
+ readonly max: '29.99rem';
632
+ };
633
+ readonly xs: {
634
+ readonly gridItemGutter: 'var(--ds-space-200)';
635
+ readonly gridMargin: 'var(--ds-space-200)';
636
+ readonly min: '30rem';
637
+ readonly max: '47.99rem';
638
+ };
639
+ readonly sm: {
640
+ readonly gridItemGutter: 'var(--ds-space-200)';
641
+ readonly gridMargin: 'var(--ds-space-300)';
642
+ readonly min: '48rem';
643
+ readonly max: '63.99rem';
644
+ };
645
+ readonly md: {
646
+ readonly gridItemGutter: 'var(--ds-space-300)';
647
+ readonly gridMargin: 'var(--ds-space-400)';
648
+ readonly min: '64rem';
649
+ readonly max: '89.99rem';
650
+ };
651
+ readonly lg: {
652
+ readonly gridItemGutter: 'var(--ds-space-400)';
653
+ readonly gridMargin: 'var(--ds-space-400)';
654
+ readonly min: '90rem';
655
+ readonly max: '109.99rem';
656
+ };
657
+ readonly xl: {
658
+ readonly gridItemGutter: 'var(--ds-space-400)';
659
+ readonly gridMargin: 'var(--ds-space-500)';
660
+ readonly min: '110rem';
661
+ readonly max: null;
662
+ };
663
+ };
664
+
665
+ // @internal
666
+ export const UNSAFE_media: {
667
+ above: {
668
+ readonly xxs: '@media all';
669
+ readonly xs: '@media (min-width: 30rem)';
670
+ readonly sm: '@media (min-width: 48rem)';
671
+ readonly md: '@media (min-width: 64rem)';
672
+ readonly lg: '@media (min-width: 90rem)';
673
+ readonly xl: '@media (min-width: 110rem)';
674
+ };
675
+ below: {
676
+ readonly xs: '@media not all and (min-width: 30rem)';
677
+ readonly sm: '@media not all and (min-width: 48rem)';
678
+ readonly md: '@media not all and (min-width: 64rem)';
679
+ readonly lg: '@media not all and (min-width: 90rem)';
680
+ readonly xl: '@media not all and (min-width: 110rem)';
681
+ };
682
+ only: {
683
+ readonly xxs: '@media (min-width: 0rem) and (max-width: 29.99rem)';
684
+ readonly xs: '@media (min-width: 30rem) and (max-width: 47.99rem)';
685
+ readonly sm: '@media (min-width: 48rem) and (max-width: 63.99rem)';
686
+ readonly md: '@media (min-width: 64rem) and (max-width: 89.99rem)';
687
+ readonly lg: '@media (min-width: 90rem) and (max-width: 109.99rem)';
688
+ readonly xl: '@media (min-width: 110rem)';
689
+ };
690
+ };
813
691
 
814
692
  // @public
815
693
  export function xcss<Primitive extends typeof Box | typeof Inline = typeof Box>(
@@ -8,21 +8,4 @@ export const dimensionMap = {
8
8
  'size.600': '6rem',
9
9
  'size.1000': '12rem',
10
10
  } as const;
11
- type Dimension = keyof typeof dimensionMap;
12
-
13
- export type Width = Dimension;
14
- export type Height = Dimension;
15
- export type MinWidth = Dimension;
16
- export type MaxWidth = Dimension;
17
- export type MinHeight = Dimension;
18
- export type MaxHeight = Dimension;
19
- export type Top = Dimension;
20
- export type Left = Dimension;
21
- export type Bottom = Dimension;
22
- export type Right = Dimension;
23
- export type BlockSize = Dimension;
24
- export type InlineSize = Dimension;
25
- export type MaxBlockSize = Dimension;
26
- export type MaxInlineSize = Dimension;
27
- export type MinBlockSize = Dimension;
28
- export type MinInlineSize = Dimension;
11
+ export type Dimension = keyof typeof dimensionMap;
@@ -78,7 +78,7 @@ const sourceFns = [
78
78
  dependencies: [shapeTokensDependencyPath],
79
79
  },
80
80
  ),
81
- // align-self, border-color, border-radius, border-style, border-width, display, flex-grow, flex-shrink, flex, layer, overflow, position',
81
+ // border-color, border-radius, border-width, layer',
82
82
  () =>
83
83
  createPartialSignedArtifact(
84
84
  options => options.map(createStylesFromFileTemplate).join('\n'),
@@ -3,20 +3,11 @@ import { join } from 'path';
3
3
 
4
4
  export const createStylesFromFileTemplate = (
5
5
  property:
6
- | 'align-self'
7
6
  | 'border-color'
8
7
  | 'border-radius'
9
- | 'border-style'
10
8
  | 'border-width'
11
9
  | 'dimensions'
12
- | 'display'
13
- | 'flex-direction'
14
- | 'flex-grow'
15
- | 'flex-shrink'
16
- | 'flex'
17
- | 'layer'
18
- | 'overflow'
19
- | 'position',
10
+ | 'layer',
20
11
  ) => {
21
12
  const path = join(__dirname, './codegen-file-templates', `${property}.tsx`);
22
13
  const source = readFileSync(path);