@atlaskit/primitives 0.2.0 → 0.2.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 (42) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/components/box.js +14 -2
  3. package/dist/cjs/components/inline.partial.js +47 -23
  4. package/dist/cjs/components/internal/base-box.partial.js +99 -78
  5. package/dist/cjs/components/internal/types.js +8 -0
  6. package/dist/cjs/components/internal/utils.js +16 -0
  7. package/dist/cjs/components/stack.partial.js +46 -22
  8. package/dist/cjs/constants.js +13 -0
  9. package/dist/cjs/index.js +2 -2
  10. package/dist/cjs/version.json +1 -1
  11. package/dist/es2019/components/box.js +12 -1
  12. package/dist/es2019/components/inline.partial.js +19 -19
  13. package/dist/es2019/components/internal/base-box.partial.js +75 -70
  14. package/dist/es2019/components/internal/types.js +1 -0
  15. package/dist/es2019/components/internal/utils.js +2 -0
  16. package/dist/es2019/components/stack.partial.js +18 -18
  17. package/dist/es2019/constants.js +3 -1
  18. package/dist/es2019/index.js +1 -1
  19. package/dist/es2019/version.json +1 -1
  20. package/dist/esm/components/box.js +12 -1
  21. package/dist/esm/components/inline.partial.js +47 -22
  22. package/dist/esm/components/internal/base-box.partial.js +100 -79
  23. package/dist/esm/components/internal/types.js +1 -0
  24. package/dist/esm/components/internal/utils.js +7 -0
  25. package/dist/esm/components/stack.partial.js +46 -21
  26. package/dist/esm/constants.js +3 -1
  27. package/dist/esm/index.js +1 -1
  28. package/dist/esm/version.json +1 -1
  29. package/dist/types/components/box.d.ts +13 -6
  30. package/dist/types/components/inline.partial.d.ts +16 -18
  31. package/dist/types/components/internal/base-box.partial.d.ts +50 -51
  32. package/dist/types/components/internal/types.d.ts +6 -0
  33. package/dist/types/components/internal/utils.d.ts +3 -0
  34. package/dist/types/components/stack.partial.d.ts +16 -18
  35. package/dist/types/components/types.d.ts +49 -0
  36. package/dist/types/constants.d.ts +2 -0
  37. package/dist/types/index.d.ts +1 -1
  38. package/package.json +4 -2
  39. package/report.api.md +112 -79
  40. package/scripts/spacing-codegen-template.tsx +29 -24
  41. package/scripts/utils.tsx +4 -1
  42. package/tmp/api-report-tmp.d.ts +89 -78
@@ -15,6 +15,7 @@ import { ReactElement } from 'react';
15
15
  import { ReactNode } from 'react';
16
16
  import { RefAttributes } from 'react';
17
17
  import { SerializedStyles } from '@emotion/react';
18
+ import { UNSAFE_Breakpoint } from '@atlaskit/ds-explorations';
18
19
 
19
20
  // @public (undocumented)
20
21
  type AlignBlock = 'baseline' | 'center' | 'end' | 'start';
@@ -121,7 +122,7 @@ type BaseBoxPropsFoundation<T extends ElementType> = {
121
122
  backgroundColor?: BackgroundColor;
122
123
  shadow?: Shadow;
123
124
  borderStyle?: BorderStyle;
124
- borderWidth?: BorderWidth;
125
+ borderWidth?: BorderWidth | Partial<Record<UNSAFE_Breakpoint, BorderWidth>>;
125
126
  borderColor?: BorderColor;
126
127
  borderRadius?: BorderRadius;
127
128
  layer?: Layer;
@@ -132,16 +133,16 @@ type BaseBoxPropsFoundation<T extends ElementType> = {
132
133
  overflow?: Overflow;
133
134
  overflowInline?: OverflowInline;
134
135
  overflowBlock?: OverflowBlock;
135
- padding?: Padding;
136
- paddingBlock?: PaddingBlock;
137
- paddingBlockStart?: PaddingBlockStart;
138
- paddingBlockEnd?: PaddingBlockEnd;
139
- paddingInline?: PaddingInline;
140
- paddingInlineStart?: PaddingInlineStart;
141
- paddingInlineEnd?: PaddingInlineEnd;
136
+ padding?: Padding | Partial<Record<UNSAFE_Breakpoint, Padding>>;
137
+ paddingBlock?: PaddingBlock | Partial<Record<UNSAFE_Breakpoint, PaddingBlock>>;
138
+ paddingBlockStart?: PaddingBlockStart | Partial<Record<UNSAFE_Breakpoint, PaddingBlockStart>>;
139
+ paddingBlockEnd?: PaddingBlockEnd | Partial<Record<UNSAFE_Breakpoint, PaddingBlockEnd>>;
140
+ paddingInline?: PaddingInline | Partial<Record<UNSAFE_Breakpoint, PaddingInline>>;
141
+ paddingInlineStart?: PaddingInlineStart | Partial<Record<UNSAFE_Breakpoint, PaddingInlineStart>>;
142
+ paddingInlineEnd?: PaddingInlineEnd | Partial<Record<UNSAFE_Breakpoint, PaddingInlineEnd>>;
142
143
  width?: Width;
143
144
  height?: Height;
144
- display?: Display;
145
+ display?: Display | Partial<Record<UNSAFE_Breakpoint, Display>>;
145
146
  position?: Position;
146
147
  ref?: ComponentPropsWithRef<T>['ref'];
147
148
  };
@@ -207,23 +208,25 @@ type BorderWidth = keyof typeof borderWidthMap;
207
208
 
208
209
  // @public (undocumented)
209
210
  const borderWidthMap: {
210
- readonly 'size.050': SerializedStyles;
211
- readonly 'size.100': SerializedStyles;
211
+ readonly 'size.0': "var(--ds-width-0)";
212
+ readonly 'size.050': "var(--ds-width-050)";
213
+ readonly 'size.100': "var(--ds-width-100)";
212
214
  };
213
215
 
214
- // @public (undocumented)
216
+ // @public
215
217
  export const Box: BoxComponent;
216
218
 
219
+ // @public (undocumented)
220
+ const BOX_RESPONSIVE_PROPS: readonly ["borderWidth", "display", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd"];
221
+
217
222
  // @public (undocumented)
218
223
  type BoxComponent<T extends ElementType = 'div'> = (<T extends ElementType = 'div'>(props: BoxProps<T>) => ReactElement | null) & FC<BoxProps<T>>;
219
224
 
220
225
  // @public (undocumented)
221
- export type BoxProps<T extends ElementType = 'div'> = Omit<BaseBoxProps<T>, 'UNSAFE_style' | 'className'> & BoxPropsBase;
226
+ export type BoxProps<T extends ElementType = 'div'> = Omit<BaseBoxProps<T>, 'UNSAFE_style' | 'className' | BoxResponsiveProp> & PublicBoxPropsBase;
222
227
 
223
228
  // @public (undocumented)
224
- type BoxPropsBase = {
225
- customStyles?: CustomStyles;
226
- };
229
+ type BoxResponsiveProp = typeof BOX_RESPONSIVE_PROPS[number];
227
230
 
228
231
  // @public
229
232
  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'>;
@@ -233,11 +236,11 @@ type Display = keyof typeof displayMap;
233
236
 
234
237
  // @public (undocumented)
235
238
  const displayMap: {
236
- readonly block: SerializedStyles;
237
- readonly inline: SerializedStyles;
238
- readonly flex: SerializedStyles;
239
- readonly 'inline-flex': SerializedStyles;
240
- readonly 'inline-block': SerializedStyles;
239
+ readonly block: "block";
240
+ readonly inline: "inline";
241
+ readonly flex: "flex";
242
+ readonly 'inline-flex': "inline-flex";
243
+ readonly 'inline-block': "inline-block";
241
244
  };
242
245
 
243
246
  // @public (undocumented)
@@ -347,44 +350,42 @@ const overflowMap: {
347
350
  };
348
351
 
349
352
  // @public (undocumented)
350
- type Padding = keyof typeof paddingMap.padding;
353
+ type Padding = keyof typeof paddingMap;
351
354
 
352
355
  // @public (undocumented)
353
- type PaddingBlock = keyof typeof paddingMap.paddingBlock;
356
+ type PaddingBlock = keyof typeof paddingMap;
354
357
 
355
358
  // @public (undocumented)
356
- type PaddingBlockEnd = keyof typeof paddingMap.paddingBlockEnd;
359
+ type PaddingBlockEnd = keyof typeof paddingMap;
357
360
 
358
361
  // @public (undocumented)
359
- type PaddingBlockStart = keyof typeof paddingMap.paddingBlockStart;
362
+ type PaddingBlockStart = keyof typeof paddingMap;
360
363
 
361
364
  // @public (undocumented)
362
- type PaddingInline = keyof typeof paddingMap.paddingInline;
365
+ type PaddingInline = keyof typeof paddingMap;
363
366
 
364
367
  // @public (undocumented)
365
- type PaddingInlineEnd = keyof typeof paddingMap.paddingInlineEnd;
368
+ type PaddingInlineEnd = keyof typeof paddingMap;
366
369
 
367
370
  // @public (undocumented)
368
- type PaddingInlineStart = keyof typeof paddingMap.paddingInlineStart;
371
+ type PaddingInlineStart = keyof typeof paddingMap;
369
372
 
370
373
  // @public
371
374
  const paddingMap: {
372
- [k: string]: {
373
- readonly 'space.0': SerializedStyles;
374
- readonly 'space.025': SerializedStyles;
375
- readonly 'space.050': SerializedStyles;
376
- readonly 'space.075': SerializedStyles;
377
- readonly 'space.100': SerializedStyles;
378
- readonly 'space.150': SerializedStyles;
379
- readonly 'space.200': SerializedStyles;
380
- readonly 'space.250': SerializedStyles;
381
- readonly 'space.300': SerializedStyles;
382
- readonly 'space.400': SerializedStyles;
383
- readonly 'space.500': SerializedStyles;
384
- readonly 'space.600': SerializedStyles;
385
- readonly 'space.800': SerializedStyles;
386
- readonly 'space.1000': SerializedStyles;
387
- };
375
+ readonly 'space.0': "var(--ds-space-0)";
376
+ readonly 'space.025': "var(--ds-space-025)";
377
+ readonly 'space.050': "var(--ds-space-050)";
378
+ readonly 'space.075': "var(--ds-space-075)";
379
+ readonly 'space.100': "var(--ds-space-100)";
380
+ readonly 'space.150': "var(--ds-space-150)";
381
+ readonly 'space.200': "var(--ds-space-200)";
382
+ readonly 'space.250': "var(--ds-space-250)";
383
+ readonly 'space.300': "var(--ds-space-300)";
384
+ readonly 'space.400': "var(--ds-space-400)";
385
+ readonly 'space.500': "var(--ds-space-500)";
386
+ readonly 'space.600': "var(--ds-space-600)";
387
+ readonly 'space.800': "var(--ds-space-800)";
388
+ readonly 'space.1000': "var(--ds-space-1000)";
388
389
  };
389
390
 
390
391
  // @public (undocumented)
@@ -398,6 +399,20 @@ const positionMap: {
398
399
  readonly static: SerializedStyles;
399
400
  };
400
401
 
402
+ // @public (undocumented)
403
+ type PublicBoxPropsBase = {
404
+ borderWidth?: BorderWidth;
405
+ display?: Display;
406
+ padding?: Padding;
407
+ paddingBlock?: PaddingBlock;
408
+ paddingBlockStart?: PaddingBlockStart;
409
+ paddingBlockEnd?: PaddingBlockEnd;
410
+ paddingInline?: PaddingInline;
411
+ paddingInlineStart?: PaddingInlineStart;
412
+ paddingInlineEnd?: PaddingInlineEnd;
413
+ customStyles?: CustomStyles;
414
+ };
415
+
401
416
  // @public (undocumented)
402
417
  type Shadow = keyof typeof shadowMap;
403
418
 
@@ -411,49 +426,45 @@ const shadowMap: {
411
426
  };
412
427
 
413
428
  // @public (undocumented)
414
- type Space = keyof typeof spaceMap.gap;
429
+ type Space = keyof typeof spaceMap;
415
430
 
416
431
  // @public (undocumented)
417
- type Space_2 = keyof typeof spaceMap_2.gap;
432
+ type Space_2 = keyof typeof spaceMap_2;
418
433
 
419
434
  // @public
420
435
  const spaceMap: {
421
- [k: string]: {
422
- readonly '0': SerializedStyles;
423
- readonly '025': SerializedStyles;
424
- readonly '050': SerializedStyles;
425
- readonly '075': SerializedStyles;
426
- readonly '100': SerializedStyles;
427
- readonly '150': SerializedStyles;
428
- readonly '200': SerializedStyles;
429
- readonly '250': SerializedStyles;
430
- readonly '300': SerializedStyles;
431
- readonly '400': SerializedStyles;
432
- readonly '500': SerializedStyles;
433
- readonly '600': SerializedStyles;
434
- readonly '800': SerializedStyles;
435
- readonly '1000': SerializedStyles;
436
- };
436
+ readonly '0': SerializedStyles;
437
+ readonly '025': SerializedStyles;
438
+ readonly '050': SerializedStyles;
439
+ readonly '075': SerializedStyles;
440
+ readonly '100': SerializedStyles;
441
+ readonly '150': SerializedStyles;
442
+ readonly '200': SerializedStyles;
443
+ readonly '250': SerializedStyles;
444
+ readonly '300': SerializedStyles;
445
+ readonly '400': SerializedStyles;
446
+ readonly '500': SerializedStyles;
447
+ readonly '600': SerializedStyles;
448
+ readonly '800': SerializedStyles;
449
+ readonly '1000': SerializedStyles;
437
450
  };
438
451
 
439
452
  // @public
440
453
  const spaceMap_2: {
441
- [k: string]: {
442
- readonly '0': SerializedStyles;
443
- readonly '025': SerializedStyles;
444
- readonly '050': SerializedStyles;
445
- readonly '075': SerializedStyles;
446
- readonly '100': SerializedStyles;
447
- readonly '150': SerializedStyles;
448
- readonly '200': SerializedStyles;
449
- readonly '250': SerializedStyles;
450
- readonly '300': SerializedStyles;
451
- readonly '400': SerializedStyles;
452
- readonly '500': SerializedStyles;
453
- readonly '600': SerializedStyles;
454
- readonly '800': SerializedStyles;
455
- readonly '1000': SerializedStyles;
456
- };
454
+ readonly '0': SerializedStyles;
455
+ readonly '025': SerializedStyles;
456
+ readonly '050': SerializedStyles;
457
+ readonly '075': SerializedStyles;
458
+ readonly '100': SerializedStyles;
459
+ readonly '150': SerializedStyles;
460
+ readonly '200': SerializedStyles;
461
+ readonly '250': SerializedStyles;
462
+ readonly '300': SerializedStyles;
463
+ readonly '400': SerializedStyles;
464
+ readonly '500': SerializedStyles;
465
+ readonly '600': SerializedStyles;
466
+ readonly '800': SerializedStyles;
467
+ readonly '1000': SerializedStyles;
457
468
  };
458
469
 
459
470
  // @public (undocumented)