@atlaskit/primitives 0.4.0 → 0.4.2

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 (36) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/components/box.js +20 -17
  3. package/dist/cjs/components/inline.partial.js +4 -2
  4. package/dist/cjs/components/internal/base-box.partial.js +3 -3
  5. package/dist/cjs/components/stack.partial.js +4 -2
  6. package/dist/cjs/index.js +7 -0
  7. package/dist/cjs/internal/style-maps.js +130 -0
  8. package/dist/cjs/internal/xcss.js +110 -0
  9. package/dist/cjs/version.json +1 -1
  10. package/dist/es2019/components/box.js +19 -12
  11. package/dist/es2019/components/inline.partial.js +3 -1
  12. package/dist/es2019/components/internal/base-box.partial.js +2 -2
  13. package/dist/es2019/components/stack.partial.js +3 -1
  14. package/dist/es2019/index.js +1 -0
  15. package/dist/es2019/internal/style-maps.js +117 -0
  16. package/dist/es2019/internal/xcss.js +97 -0
  17. package/dist/es2019/version.json +1 -1
  18. package/dist/esm/components/box.js +21 -14
  19. package/dist/esm/components/inline.partial.js +4 -2
  20. package/dist/esm/components/internal/base-box.partial.js +3 -3
  21. package/dist/esm/components/stack.partial.js +4 -2
  22. package/dist/esm/index.js +1 -0
  23. package/dist/esm/internal/style-maps.js +117 -0
  24. package/dist/esm/internal/xcss.js +100 -0
  25. package/dist/esm/version.json +1 -1
  26. package/dist/types/components/box.d.ts +9 -7
  27. package/dist/types/components/inline.partial.d.ts +8 -3
  28. package/dist/types/components/internal/base-box.partial.d.ts +43 -4
  29. package/dist/types/components/stack.partial.d.ts +8 -3
  30. package/dist/types/components/types.d.ts +9 -14
  31. package/dist/types/index.d.ts +1 -0
  32. package/dist/types/internal/style-maps.d.ts +151 -0
  33. package/dist/types/internal/xcss.d.ts +22 -0
  34. package/package.json +3 -2
  35. package/report.api.md +240 -38
  36. package/tmp/api-report-tmp.d.ts +209 -13
package/report.api.md CHANGED
@@ -18,6 +18,8 @@
18
18
  import { ComponentPropsWithoutRef } from 'react';
19
19
  import { ComponentPropsWithRef } from 'react';
20
20
  import type { CSSProperties } from 'react';
21
+ import { CSSPropertiesWithMultiValues } from '@emotion/serialize';
22
+ import { CSSPseudos } from '@emotion/serialize';
21
23
  import { ElementType } from 'react';
22
24
  import { FC } from 'react';
23
25
  import { ForwardRefExoticComponent } from 'react';
@@ -54,6 +56,9 @@ const alignSelfMap: {
54
56
  // @public (undocumented)
55
57
  type BackgroundColor = keyof typeof backgroundColorMap;
56
58
 
59
+ // @public (undocumented)
60
+ type BackgroundColor_2 = keyof typeof backgroundColorMap_2;
61
+
57
62
  // @public (undocumented)
58
63
  const backgroundColorMap: {
59
64
  readonly 'accent.red.subtlest': SerializedStyles;
@@ -120,17 +125,47 @@ const backgroundColorMap: {
120
125
  readonly 'elevation.surface.sunken': SerializedStyles;
121
126
  };
122
127
 
128
+ // @public (undocumented)
129
+ const backgroundColorMap_2: {
130
+ readonly disabled: 'var(--ds-background-disabled)';
131
+ readonly input: 'var(--ds-background-input)';
132
+ readonly 'inverse.subtle': 'var(--ds-background-inverse-subtle)';
133
+ readonly neutral: 'var(--ds-background-neutral)';
134
+ readonly 'neutral.subtle': 'var(--ds-background-neutral-subtle)';
135
+ readonly 'neutral.bold': 'var(--ds-background-neutral-bold)';
136
+ readonly selected: 'var(--ds-background-selected)';
137
+ readonly 'selected.bold': 'var(--ds-background-selected-bold)';
138
+ readonly 'brand.bold': 'var(--ds-background-brand-bold)';
139
+ readonly danger: 'var(--ds-background-danger)';
140
+ readonly 'danger.bold': 'var(--ds-background-danger-bold)';
141
+ readonly warning: 'var(--ds-background-warning)';
142
+ readonly 'warning.bold': 'var(--ds-background-warning-bold)';
143
+ readonly success: 'var(--ds-background-success)';
144
+ readonly 'success.bold': 'var(--ds-background-success-bold)';
145
+ readonly discovery: 'var(--ds-background-discovery)';
146
+ readonly 'discovery.bold': 'var(--ds-background-discovery-bold)';
147
+ readonly information: 'var(--ds-background-information)';
148
+ readonly 'information.bold': 'var(--ds-background-information-bold)';
149
+ readonly 'color.blanket': 'var(--ds-blanket)';
150
+ readonly 'color.blanket.selected': 'var(--ds-blanket-selected)';
151
+ readonly 'color.blanket.danger': 'var(--ds-blanket-danger)';
152
+ readonly 'elevation.surface': 'var(--ds-surface)';
153
+ readonly 'elevation.surface.overlay': 'var(--ds-surface-overlay)';
154
+ readonly 'elevation.surface.raised': 'var(--ds-surface-raised)';
155
+ readonly 'elevation.surface.sunken': 'var(--ds-surface-sunken)';
156
+ };
157
+
123
158
  // @public (undocumented)
124
159
  type BaseBoxProps<T extends ElementType = 'div'> = Omit<
125
160
  ComponentPropsWithoutRef<T>,
126
- 'as' | 'className' | 'style'
161
+ 'as' | 'className'
127
162
  > &
128
163
  BasePrimitiveProps &
129
164
  BaseBoxPropsFoundation<T>;
130
165
 
131
166
  // @public (undocumented)
132
167
  type BaseBoxPropsFoundation<T extends ElementType> = {
133
- as?: 'div' | 'span';
168
+ as?: 'div' | 'li' | 'span';
134
169
  className?: string;
135
170
  children?: ReactNode;
136
171
  color?: TextColor;
@@ -165,14 +200,17 @@ type BaseBoxPropsFoundation<T extends ElementType> = {
165
200
  };
166
201
 
167
202
  // @public (undocumented)
168
- interface BasePrimitiveProps {
203
+ type BasePrimitiveProps = {
169
204
  testId?: string;
170
- UNSAFE_style?: CSSProperties;
171
- }
205
+ style?: CSSProperties;
206
+ };
172
207
 
173
208
  // @public (undocumented)
174
209
  type BorderColor = keyof typeof borderColorMap;
175
210
 
211
+ // @public (undocumented)
212
+ type BorderColor_2 = keyof typeof borderColorMap_2;
213
+
176
214
  // @public
177
215
  const borderColorMap: {
178
216
  readonly 'color.border': SerializedStyles;
@@ -199,6 +237,23 @@ const borderColorMap: {
199
237
  readonly bold: SerializedStyles;
200
238
  };
201
239
 
240
+ // @public (undocumented)
241
+ const borderColorMap_2: {
242
+ readonly 'color.border': 'var(--ds-border)';
243
+ readonly disabled: 'var(--ds-border-disabled)';
244
+ readonly focused: 'var(--ds-border-focused)';
245
+ readonly input: 'var(--ds-border-input)';
246
+ readonly inverse: 'var(--ds-border-inverse)';
247
+ readonly selected: 'var(--ds-border-selected)';
248
+ readonly brand: 'var(--ds-border-brand)';
249
+ readonly danger: 'var(--ds-border-danger)';
250
+ readonly warning: 'var(--ds-border-warning)';
251
+ readonly success: 'var(--ds-border-success)';
252
+ readonly discovery: 'var(--ds-border-discovery)';
253
+ readonly information: 'var(--ds-border-information)';
254
+ readonly bold: 'var(--ds-border-bold)';
255
+ };
256
+
202
257
  // @public (undocumented)
203
258
  type BorderRadius = keyof typeof borderRadiusMap;
204
259
 
@@ -223,6 +278,9 @@ const borderStyleMap: {
223
278
  // @public (undocumented)
224
279
  type BorderWidth = keyof typeof borderWidthMap;
225
280
 
281
+ // @public (undocumented)
282
+ type BorderWidth_2 = keyof typeof borderWidthMap_2;
283
+
226
284
  // @public (undocumented)
227
285
  const borderWidthMap: {
228
286
  readonly 'size.0': 'var(--ds-width-0)';
@@ -230,6 +288,13 @@ const borderWidthMap: {
230
288
  readonly 'size.100': 'var(--ds-width-100)';
231
289
  };
232
290
 
291
+ // @public (undocumented)
292
+ const borderWidthMap_2: {
293
+ readonly 'size.0': 'var(--ds-width-0)';
294
+ readonly 'size.050': 'var(--ds-width-050)';
295
+ readonly 'size.100': 'var(--ds-width-100)';
296
+ };
297
+
233
298
  // @public
234
299
  export const Box: BoxComponent;
235
300
 
@@ -257,7 +322,7 @@ type BoxComponent<T extends ElementType = 'div'> = (<
257
322
  // @public (undocumented)
258
323
  export type BoxProps<T extends ElementType = 'div'> = Omit<
259
324
  BaseBoxProps<T>,
260
- 'UNSAFE_style' | 'className' | BoxResponsiveProp
325
+ 'className' | BoxResponsiveProp
261
326
  > &
262
327
  PublicBoxPropsBase;
263
328
 
@@ -267,33 +332,17 @@ type BoxResponsiveProp = typeof BOX_RESPONSIVE_PROPS[number];
267
332
  // @public
268
333
  type Breakpoint = 'lg' | 'md' | 'sm' | 'xl' | 'xs' | 'xxl' | 'xxs';
269
334
 
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
- >;
335
+ // @public (undocumented)
336
+ const dimensionMap: {
337
+ readonly '100%': '100%';
338
+ readonly 'size.100': '16px';
339
+ readonly 'size.200': '24px';
340
+ readonly 'size.300': '32px';
341
+ readonly 'size.400': '40px';
342
+ readonly 'size.500': '48px';
343
+ readonly 'size.600': '96px';
344
+ readonly 'size.1000': '192px';
345
+ };
297
346
 
298
347
  // @public (undocumented)
299
348
  type Display = keyof typeof displayMap;
@@ -342,6 +391,9 @@ type Grow_2 = 'fill' | 'hug';
342
391
  // @public (undocumented)
343
392
  type Height = keyof typeof heightMap;
344
393
 
394
+ // @public (undocumented)
395
+ type Height_2 = keyof typeof dimensionMap;
396
+
345
397
  // @public (undocumented)
346
398
  const heightMap: {
347
399
  readonly '100%': SerializedStyles;
@@ -356,15 +408,34 @@ const heightMap: {
356
408
 
357
409
  // @public
358
410
  export const Inline: MemoExoticComponent<
359
- ForwardRefExoticComponent<InlineProps & RefAttributes<HTMLDivElement>>
411
+ ForwardRefExoticComponent<
412
+ Pick<
413
+ InlineProps<ElementType<any>>,
414
+ | 'alignBlock'
415
+ | 'alignInline'
416
+ | 'as'
417
+ | 'children'
418
+ | 'grow'
419
+ | 'rowSpace'
420
+ | 'separator'
421
+ | 'shouldWrap'
422
+ | 'space'
423
+ | 'spread'
424
+ | 'testId'
425
+ > &
426
+ RefAttributes<any>
427
+ >
360
428
  >;
361
429
 
362
430
  // @public (undocumented)
363
- export interface InlineProps {
431
+ export interface InlineProps<T extends ElementType = 'div'> {
364
432
  alignBlock?: AlignBlock;
365
433
  alignInline?: AlignInline;
434
+ as?: 'div' | 'ol' | 'span' | 'ul';
366
435
  children: ReactNode;
367
436
  grow?: Grow;
437
+ // (undocumented)
438
+ ref?: ComponentPropsWithRef<T>['ref'];
368
439
  rowSpace?: RowSpace;
369
440
  separator?: string;
370
441
  shouldWrap?: boolean;
@@ -389,6 +460,18 @@ const LAYERS: {
389
460
  readonly tooltip: 800;
390
461
  };
391
462
 
463
+ // @public (undocumented)
464
+ type MaxHeight = keyof typeof dimensionMap;
465
+
466
+ // @public (undocumented)
467
+ type MaxWidth = keyof typeof dimensionMap;
468
+
469
+ // @public (undocumented)
470
+ type MinHeight = keyof typeof dimensionMap;
471
+
472
+ // @public (undocumented)
473
+ type MinWidth = keyof typeof dimensionMap;
474
+
392
475
  // @public (undocumented)
393
476
  type Overflow = keyof typeof overflowMap;
394
477
 
@@ -419,6 +502,9 @@ const overflowMap: {
419
502
  // @public (undocumented)
420
503
  type Padding = keyof typeof paddingMap;
421
504
 
505
+ // @public (undocumented)
506
+ type Padding_2 = keyof typeof paddingMap_2;
507
+
422
508
  // @public (undocumented)
423
509
  type PaddingBlock = keyof typeof paddingMap;
424
510
 
@@ -455,6 +541,24 @@ const paddingMap: {
455
541
  readonly 'space.1000': 'var(--ds-space-1000)';
456
542
  };
457
543
 
544
+ // @public (undocumented)
545
+ const paddingMap_2: {
546
+ readonly 'space.0': 'var(--ds-space-0)';
547
+ readonly 'space.025': 'var(--ds-space-025)';
548
+ readonly 'space.050': 'var(--ds-space-050)';
549
+ readonly 'space.075': 'var(--ds-space-075)';
550
+ readonly 'space.100': 'var(--ds-space-100)';
551
+ readonly 'space.150': 'var(--ds-space-150)';
552
+ readonly 'space.200': 'var(--ds-space-200)';
553
+ readonly 'space.250': 'var(--ds-space-250)';
554
+ readonly 'space.300': 'var(--ds-space-300)';
555
+ readonly 'space.400': 'var(--ds-space-400)';
556
+ readonly 'space.500': 'var(--ds-space-500)';
557
+ readonly 'space.600': 'var(--ds-space-600)';
558
+ readonly 'space.800': 'var(--ds-space-800)';
559
+ readonly 'space.1000': 'var(--ds-space-1000)';
560
+ };
561
+
458
562
  // @public (undocumented)
459
563
  type Position = keyof typeof positionMap;
460
564
 
@@ -477,7 +581,7 @@ type PublicBoxPropsBase = {
477
581
  paddingInline?: PaddingInline;
478
582
  paddingInlineStart?: PaddingInlineStart;
479
583
  paddingInlineEnd?: PaddingInlineEnd;
480
- customStyles?: CustomStyles;
584
+ xcss?: SafeCSS;
481
585
  };
482
586
 
483
587
  // @public
@@ -504,6 +608,14 @@ const rowSpaceMap: {
504
608
  readonly '1000': SerializedStyles;
505
609
  };
506
610
 
611
+ // @public (undocumented)
612
+ type SafeCSS = XCSS | XCSS[];
613
+
614
+ // @public (undocumented)
615
+ type SafeCSSObject = CSSPseudos &
616
+ TokenisedProps &
617
+ Omit<CSSPropertiesWithMultiValues, keyof TokenisedProps>;
618
+
507
619
  // @public (undocumented)
508
620
  type Shadow = keyof typeof shadowMap;
509
621
 
@@ -566,15 +678,31 @@ type Spread_2 = 'space-between';
566
678
 
567
679
  // @public
568
680
  export const Stack: MemoExoticComponent<
569
- ForwardRefExoticComponent<StackProps & RefAttributes<HTMLDivElement>>
681
+ ForwardRefExoticComponent<
682
+ Pick<
683
+ StackProps<ElementType<any>>,
684
+ | 'alignBlock'
685
+ | 'alignInline'
686
+ | 'as'
687
+ | 'children'
688
+ | 'grow'
689
+ | 'space'
690
+ | 'spread'
691
+ | 'testId'
692
+ > &
693
+ RefAttributes<any>
694
+ >
570
695
  >;
571
696
 
572
697
  // @public (undocumented)
573
- export interface StackProps {
698
+ export interface StackProps<T extends ElementType = 'div'> {
574
699
  alignBlock?: AlignBlock_2;
575
700
  alignInline?: AlignInline_2;
701
+ as?: 'div' | 'ol' | 'span' | 'ul';
576
702
  children: ReactNode;
577
703
  grow?: Grow_2;
704
+ // (undocumented)
705
+ ref?: ComponentPropsWithRef<T>['ref'];
578
706
  space?: Space_2;
579
707
  spread?: Spread_2;
580
708
  testId?: string;
@@ -583,6 +711,9 @@ export interface StackProps {
583
711
  // @public (undocumented)
584
712
  type TextColor = keyof typeof textColorMap;
585
713
 
714
+ // @public (undocumented)
715
+ type TextColor_2 = keyof typeof textColorMap_2;
716
+
586
717
  // @public (undocumented)
587
718
  const textColorMap: {
588
719
  readonly 'color.text': SerializedStyles;
@@ -618,9 +749,71 @@ const textColorMap: {
618
749
  readonly subtle: SerializedStyles;
619
750
  };
620
751
 
752
+ // @public (undocumented)
753
+ const textColorMap_2: {
754
+ readonly 'color.text': 'var(--ds-text)';
755
+ readonly 'accent.red': 'var(--ds-text-accent-red)';
756
+ readonly 'accent.red.bolder': 'var(--ds-text-accent-red-bolder)';
757
+ readonly 'accent.orange': 'var(--ds-text-accent-orange)';
758
+ readonly 'accent.orange.bolder': 'var(--ds-text-accent-orange-bolder)';
759
+ readonly 'accent.yellow': 'var(--ds-text-accent-yellow)';
760
+ readonly 'accent.yellow.bolder': 'var(--ds-text-accent-yellow-bolder)';
761
+ readonly 'accent.green': 'var(--ds-text-accent-green)';
762
+ readonly 'accent.green.bolder': 'var(--ds-text-accent-green-bolder)';
763
+ readonly 'accent.teal': 'var(--ds-text-accent-teal)';
764
+ readonly 'accent.teal.bolder': 'var(--ds-text-accent-teal-bolder)';
765
+ readonly 'accent.blue': 'var(--ds-text-accent-blue)';
766
+ readonly 'accent.blue.bolder': 'var(--ds-text-accent-blue-bolder)';
767
+ readonly 'accent.purple': 'var(--ds-text-accent-purple)';
768
+ readonly 'accent.purple.bolder': 'var(--ds-text-accent-purple-bolder)';
769
+ readonly 'accent.magenta': 'var(--ds-text-accent-magenta)';
770
+ readonly 'accent.magenta.bolder': 'var(--ds-text-accent-magenta-bolder)';
771
+ readonly 'accent.gray': 'var(--ds-text-accent-gray)';
772
+ readonly 'accent.gray.bolder': 'var(--ds-text-accent-gray-bolder)';
773
+ readonly disabled: 'var(--ds-text-disabled)';
774
+ readonly inverse: 'var(--ds-text-inverse)';
775
+ readonly selected: 'var(--ds-text-selected)';
776
+ readonly brand: 'var(--ds-text-brand)';
777
+ readonly danger: 'var(--ds-text-danger)';
778
+ readonly warning: 'var(--ds-text-warning)';
779
+ readonly 'warning.inverse': 'var(--ds-text-warning-inverse)';
780
+ readonly success: 'var(--ds-text-success)';
781
+ readonly discovery: 'var(--ds-text-discovery)';
782
+ readonly information: 'var(--ds-text-information)';
783
+ readonly subtlest: 'var(--ds-text-subtlest)';
784
+ readonly subtle: 'var(--ds-text-subtle)';
785
+ };
786
+
787
+ // @public (undocumented)
788
+ type TokenisedProps = {
789
+ backgroundColor?: BackgroundColor_2;
790
+ borderColor?: BorderColor_2;
791
+ borderWidth?: BorderWidth_2;
792
+ color?: TextColor_2;
793
+ height?: Height_2;
794
+ minHeight?: MinHeight;
795
+ minWidth?: MinWidth;
796
+ maxHeight?: MaxHeight;
797
+ maxWidth?: MaxWidth;
798
+ padding?: Padding_2;
799
+ paddingBlock?: Padding_2;
800
+ paddingInline?: Padding_2;
801
+ paddingBlockStart?: Padding_2;
802
+ paddingBlockEnd?: Padding_2;
803
+ paddingInlineStart?: Padding_2;
804
+ paddingInlineEnd?: Padding_2;
805
+ width?: Width_2;
806
+ };
807
+
808
+ // @public (undocumented)
809
+ const uniqueSymbol: unique symbol;
810
+
621
811
  // @public (undocumented)
622
812
  type Width = keyof typeof widthMap;
623
813
 
814
+ // @public (undocumented)
815
+ type Width_2 = keyof typeof dimensionMap;
816
+
624
817
  // @public
625
818
  const widthMap: {
626
819
  readonly '100%': SerializedStyles;
@@ -633,6 +826,15 @@ const widthMap: {
633
826
  readonly 'size.1000': SerializedStyles;
634
827
  };
635
828
 
829
+ // @public (undocumented)
830
+ type XCSS = ReturnType<typeof xcss>;
831
+
832
+ // @public (undocumented)
833
+ export const xcss: (style?: SafeCSSObject | SafeCSSObject[] | undefined) => {
834
+ readonly symbol: typeof uniqueSymbol;
835
+ readonly styles: SerializedStyles;
836
+ };
837
+
636
838
  // (No @packageDocumentation comment for this package)
637
839
  ```
638
840