@atlaskit/primitives 0.1.0 → 0.2.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.
Files changed (38) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/components/box.js +80 -6
  3. package/dist/cjs/components/inline.partial.js +22 -46
  4. package/dist/cjs/components/internal/base-box.partial.js +822 -0
  5. package/dist/cjs/components/stack.partial.js +22 -46
  6. package/dist/cjs/index.js +2 -2
  7. package/dist/cjs/version.json +1 -1
  8. package/dist/es2019/components/box.js +75 -1
  9. package/dist/es2019/components/inline.partial.js +20 -20
  10. package/dist/es2019/components/internal/base-box.partial.js +839 -0
  11. package/dist/es2019/components/stack.partial.js +20 -20
  12. package/dist/es2019/index.js +2 -2
  13. package/dist/es2019/version.json +1 -1
  14. package/dist/esm/components/box.js +77 -1
  15. package/dist/esm/components/inline.partial.js +21 -46
  16. package/dist/esm/components/internal/base-box.partial.js +817 -0
  17. package/dist/esm/components/stack.partial.js +21 -46
  18. package/dist/esm/index.js +2 -2
  19. package/dist/esm/version.json +1 -1
  20. package/dist/types/components/box.d.ts +10 -1
  21. package/dist/types/components/inline.partial.d.ts +18 -16
  22. package/dist/types/components/internal/base-box.partial.d.ts +483 -0
  23. package/dist/types/components/stack.partial.d.ts +18 -16
  24. package/dist/types/components/types.d.ts +8 -1
  25. package/dist/types/index.d.ts +3 -3
  26. package/package.json +2 -3
  27. package/report.api.md +505 -46
  28. package/scripts/__tests__/__snapshots__/codegen.test.tsx.snap +204 -0
  29. package/scripts/codegen-styles.tsx +31 -16
  30. package/scripts/color-codegen-template.tsx +10 -7
  31. package/scripts/dimension-codegen-template.tsx +14 -2
  32. package/scripts/misc-codegen-template.tsx +1 -1
  33. package/scripts/spacing-codegen-template.tsx +37 -33
  34. package/tmp/api-report-tmp.d.ts +466 -46
  35. package/dist/cjs/components/internal/box.partial.js +0 -605
  36. package/dist/es2019/components/internal/box.partial.js +0 -597
  37. package/dist/esm/components/internal/box.partial.js +0 -600
  38. package/dist/types/components/internal/box.partial.d.ts +0 -348
@@ -1,600 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["children", "as", "className", "display", "flexDirection", "alignItems", "justifyContent", "backgroundColor", "borderColor", "borderStyle", "borderWidth", "borderRadius", "shadow", "layer", "padding", "paddingBlock", "paddingInline", "position", "height", "overflow", "width", "UNSAFE_style", "testId"];
4
- /** @jsx jsx */
5
- import { forwardRef } from 'react';
6
- import { css, jsx } from '@emotion/react';
7
- import { LAYERS } from '../../constants';
8
- /**
9
- * __Box__
10
- *
11
- * Box is a primitive component that has the design decisions of the Atlassian Design System baked in.
12
- * Renders a `div` by default.
13
- *
14
- * @internal
15
- */
16
- export var Box = /*#__PURE__*/forwardRef(function (_ref, ref) {
17
- var children = _ref.children,
18
- as = _ref.as,
19
- className = _ref.className,
20
- _ref$display = _ref.display,
21
- display = _ref$display === void 0 ? 'flex' : _ref$display,
22
- flexDirection = _ref.flexDirection,
23
- alignItems = _ref.alignItems,
24
- justifyContent = _ref.justifyContent,
25
- backgroundColor = _ref.backgroundColor,
26
- borderColor = _ref.borderColor,
27
- borderStyle = _ref.borderStyle,
28
- borderWidth = _ref.borderWidth,
29
- borderRadius = _ref.borderRadius,
30
- shadow = _ref.shadow,
31
- layer = _ref.layer,
32
- padding = _ref.padding,
33
- paddingBlock = _ref.paddingBlock,
34
- paddingInline = _ref.paddingInline,
35
- _ref$position = _ref.position,
36
- position = _ref$position === void 0 ? 'relative' : _ref$position,
37
- height = _ref.height,
38
- overflow = _ref.overflow,
39
- width = _ref.width,
40
- UNSAFE_style = _ref.UNSAFE_style,
41
- testId = _ref.testId,
42
- htmlAttributes = _objectWithoutProperties(_ref, _excluded);
43
- var Component = as || 'div';
44
- var node = jsx(Component, _extends({
45
- style: UNSAFE_style,
46
- ref: ref
47
- // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
48
- }, htmlAttributes, {
49
- className: className,
50
- css: [baseStyles, display && displayMap[display], padding && paddingMap[padding], position && positionMap[position], paddingBlock && paddingBlockMap[paddingBlock], paddingInline && paddingInlineMap[paddingInline], alignItems && flexAlignItemsMap[alignItems], justifyContent && flexJustifyContentMap[justifyContent], backgroundColor && backgroundColorMap[backgroundColor], borderColor && borderColorMap[borderColor], borderStyle && borderStyleMap[borderStyle], borderWidth && borderWidthMap[borderWidth], borderRadius && borderRadiusMap[borderRadius], shadow && shadowMap[shadow], layer && layerMap[layer], flexDirection && flexDirectionMap[flexDirection], overflow && overflowMap[overflow], width && widthMap[width], height && heightMap[height]],
51
- "data-testid": testId
52
- }), children);
53
- return node;
54
- });
55
- Box.displayName = 'Box';
56
- export default Box;
57
-
58
- // <<< STYLES GO HERE >>>
59
-
60
- var borderStyleMap = {
61
- none: css({
62
- borderStyle: 'none'
63
- }),
64
- solid: css({
65
- borderStyle: 'solid'
66
- }),
67
- dashed: css({
68
- borderStyle: 'dashed'
69
- }),
70
- dotted: css({
71
- borderStyle: 'dotted'
72
- })
73
- };
74
- var borderWidthMap = {
75
- '0px': css({
76
- borderWidth: '0px'
77
- }),
78
- '1px': css({
79
- borderWidth: '1px'
80
- }),
81
- '2px': css({
82
- borderWidth: '2px'
83
- }),
84
- '3px': css({
85
- borderWidth: '3px'
86
- })
87
- };
88
- var borderRadiusMap = {
89
- normal: css({
90
- borderRadius: '3px'
91
- }),
92
- rounded: css({
93
- borderRadius: '50%'
94
- }),
95
- badge: css({
96
- borderRadius: '8px'
97
- })
98
- };
99
-
100
- /**
101
- * @experimental - this is likely to be removed
102
- */
103
-
104
- var flexDirectionMap = {
105
- column: css({
106
- flexDirection: 'column'
107
- }),
108
- row: css({
109
- flexDirection: 'row'
110
- })
111
- };
112
-
113
- /**
114
- * @experimental - this is likely to be removed
115
- */
116
-
117
- var flexAlignItemsMap = {
118
- center: css({
119
- alignItems: 'center'
120
- }),
121
- baseline: css({
122
- alignItems: 'baseline'
123
- }),
124
- flexStart: css({
125
- alignItems: 'flex-start'
126
- }),
127
- flexEnd: css({
128
- alignItems: 'flex-end'
129
- }),
130
- start: css({
131
- alignItems: 'start'
132
- }),
133
- end: css({
134
- alignItems: 'end'
135
- })
136
- };
137
-
138
- /**
139
- * @experimental - this is likely to be removed
140
- */
141
-
142
- var flexJustifyContentMap = {
143
- center: css({
144
- justifyContent: 'center'
145
- }),
146
- flexStart: css({
147
- justifyContent: 'flex-start'
148
- }),
149
- flexEnd: css({
150
- justifyContent: 'flex-end'
151
- }),
152
- start: css({
153
- alignItems: 'start'
154
- }),
155
- end: css({
156
- alignItems: 'end'
157
- })
158
- };
159
- var displayMap = {
160
- block: css({
161
- display: 'block'
162
- }),
163
- inline: css({
164
- display: 'inline'
165
- }),
166
- flex: css({
167
- display: 'flex'
168
- }),
169
- inlineFlex: css({
170
- display: 'inline-flex'
171
- }),
172
- inlineBlock: css({
173
- display: 'inline-block'
174
- })
175
- };
176
- var positionMap = {
177
- absolute: css({
178
- position: 'absolute'
179
- }),
180
- fixed: css({
181
- position: 'fixed'
182
- }),
183
- relative: css({
184
- position: 'relative'
185
- }),
186
- static: css({
187
- position: 'static'
188
- })
189
- };
190
- var overflowMap = {
191
- auto: css({
192
- overflow: 'auto'
193
- }),
194
- hidden: css({
195
- overflow: 'hidden'
196
- })
197
- };
198
- var baseStyles = css({
199
- boxSizing: 'border-box',
200
- appearance: 'none',
201
- border: 'none'
202
- });
203
-
204
- /**
205
- * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
206
- * @codegen <<SignedSource::327e769aaa3da9422a919a0ca9490070>>
207
- * @codegenId dimensions
208
- * @codegenCommand yarn codegen-styles
209
- * @codegenParams ["width", "height"]
210
- */
211
- var widthMap = {
212
- '100%': css({
213
- width: '100%'
214
- }),
215
- 'size.100': css({
216
- width: '16px'
217
- }),
218
- 'size.1000': css({
219
- width: '192px'
220
- }),
221
- 'size.200': css({
222
- width: '24px'
223
- }),
224
- 'size.300': css({
225
- width: '32px'
226
- }),
227
- 'size.400': css({
228
- width: '40px'
229
- }),
230
- 'size.500': css({
231
- width: '48px'
232
- }),
233
- 'size.600': css({
234
- width: '96px'
235
- })
236
- };
237
- var heightMap = {
238
- '100%': css({
239
- height: '100%'
240
- }),
241
- 'size.100': css({
242
- height: '16px'
243
- }),
244
- 'size.1000': css({
245
- height: '192px'
246
- }),
247
- 'size.200': css({
248
- height: '24px'
249
- }),
250
- 'size.300': css({
251
- height: '32px'
252
- }),
253
- 'size.400': css({
254
- height: '40px'
255
- }),
256
- 'size.500': css({
257
- height: '48px'
258
- }),
259
- 'size.600': css({
260
- height: '96px'
261
- })
262
- };
263
- /**
264
- * @codegenEnd
265
- */
266
-
267
- /**
268
- * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
269
- * @codegen <<SignedSource::bb003484c6ad12a718912942b07dbf6e>>
270
- * @codegenId spacing
271
- * @codegenCommand yarn codegen-styles
272
- * @codegenParams ["padding", "paddingBlock", "paddingInline"]
273
- * @codegenDependency ../../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::167d3b69b159ae33e74d4ea5ab7eade6>>
274
- */
275
- var paddingMap = {
276
- 'space.0': css({
277
- padding: "var(--ds-space-0, 0px)"
278
- }),
279
- 'space.025': css({
280
- padding: "var(--ds-space-025, 2px)"
281
- }),
282
- 'space.050': css({
283
- padding: "var(--ds-space-050, 4px)"
284
- }),
285
- 'space.075': css({
286
- padding: "var(--ds-space-075, 6px)"
287
- }),
288
- 'space.100': css({
289
- padding: "var(--ds-space-100, 8px)"
290
- }),
291
- 'space.1000': css({
292
- padding: "var(--ds-space-1000, 80px)"
293
- }),
294
- 'space.150': css({
295
- padding: "var(--ds-space-150, 12px)"
296
- }),
297
- 'space.200': css({
298
- padding: "var(--ds-space-200, 16px)"
299
- }),
300
- 'space.250': css({
301
- padding: "var(--ds-space-250, 20px)"
302
- }),
303
- 'space.300': css({
304
- padding: "var(--ds-space-300, 24px)"
305
- }),
306
- 'space.400': css({
307
- padding: "var(--ds-space-400, 32px)"
308
- }),
309
- 'space.500': css({
310
- padding: "var(--ds-space-500, 40px)"
311
- }),
312
- 'space.600': css({
313
- padding: "var(--ds-space-600, 48px)"
314
- }),
315
- 'space.800': css({
316
- padding: "var(--ds-space-800, 64px)"
317
- })
318
- };
319
- var paddingBlockMap = {
320
- 'space.0': css({
321
- paddingBlock: "var(--ds-space-0, 0px)"
322
- }),
323
- 'space.025': css({
324
- paddingBlock: "var(--ds-space-025, 2px)"
325
- }),
326
- 'space.050': css({
327
- paddingBlock: "var(--ds-space-050, 4px)"
328
- }),
329
- 'space.075': css({
330
- paddingBlock: "var(--ds-space-075, 6px)"
331
- }),
332
- 'space.100': css({
333
- paddingBlock: "var(--ds-space-100, 8px)"
334
- }),
335
- 'space.1000': css({
336
- paddingBlock: "var(--ds-space-1000, 80px)"
337
- }),
338
- 'space.150': css({
339
- paddingBlock: "var(--ds-space-150, 12px)"
340
- }),
341
- 'space.200': css({
342
- paddingBlock: "var(--ds-space-200, 16px)"
343
- }),
344
- 'space.250': css({
345
- paddingBlock: "var(--ds-space-250, 20px)"
346
- }),
347
- 'space.300': css({
348
- paddingBlock: "var(--ds-space-300, 24px)"
349
- }),
350
- 'space.400': css({
351
- paddingBlock: "var(--ds-space-400, 32px)"
352
- }),
353
- 'space.500': css({
354
- paddingBlock: "var(--ds-space-500, 40px)"
355
- }),
356
- 'space.600': css({
357
- paddingBlock: "var(--ds-space-600, 48px)"
358
- }),
359
- 'space.800': css({
360
- paddingBlock: "var(--ds-space-800, 64px)"
361
- })
362
- };
363
- var paddingInlineMap = {
364
- 'space.0': css({
365
- paddingInline: "var(--ds-space-0, 0px)"
366
- }),
367
- 'space.025': css({
368
- paddingInline: "var(--ds-space-025, 2px)"
369
- }),
370
- 'space.050': css({
371
- paddingInline: "var(--ds-space-050, 4px)"
372
- }),
373
- 'space.075': css({
374
- paddingInline: "var(--ds-space-075, 6px)"
375
- }),
376
- 'space.100': css({
377
- paddingInline: "var(--ds-space-100, 8px)"
378
- }),
379
- 'space.1000': css({
380
- paddingInline: "var(--ds-space-1000, 80px)"
381
- }),
382
- 'space.150': css({
383
- paddingInline: "var(--ds-space-150, 12px)"
384
- }),
385
- 'space.200': css({
386
- paddingInline: "var(--ds-space-200, 16px)"
387
- }),
388
- 'space.250': css({
389
- paddingInline: "var(--ds-space-250, 20px)"
390
- }),
391
- 'space.300': css({
392
- paddingInline: "var(--ds-space-300, 24px)"
393
- }),
394
- 'space.400': css({
395
- paddingInline: "var(--ds-space-400, 32px)"
396
- }),
397
- 'space.500': css({
398
- paddingInline: "var(--ds-space-500, 40px)"
399
- }),
400
- 'space.600': css({
401
- paddingInline: "var(--ds-space-600, 48px)"
402
- }),
403
- 'space.800': css({
404
- paddingInline: "var(--ds-space-800, 64px)"
405
- })
406
- };
407
- /**
408
- * @codegenEnd
409
- */
410
-
411
- /**
412
- * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
413
- * @codegen <<SignedSource::997d215fff7bb2f824f7a0f600fe892e>>
414
- * @codegenId colors
415
- * @codegenCommand yarn codegen-styles
416
- * @codegenParams ["border", "background", "shadow"]
417
- * @codegenDependency ../../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::10aa7e87eca39e4d6594a764e78e0698>>
418
- */
419
- var borderColorMap = {
420
- 'color.border': css({
421
- borderColor: "var(--ds-border, #091e4221)"
422
- }),
423
- disabled: css({
424
- borderColor: "var(--ds-border-disabled, #FAFBFC)"
425
- }),
426
- focused: css({
427
- borderColor: "var(--ds-border-focused, #4C9AFF)"
428
- }),
429
- input: css({
430
- borderColor: "var(--ds-border-input, #FAFBFC)"
431
- }),
432
- inverse: css({
433
- borderColor: "var(--ds-border-inverse, #FFFFFF)"
434
- }),
435
- selected: css({
436
- borderColor: "var(--ds-border-selected, #0052CC)"
437
- }),
438
- brand: css({
439
- borderColor: "var(--ds-border-brand, #0052CC)"
440
- }),
441
- danger: css({
442
- borderColor: "var(--ds-border-danger, #FF5630)"
443
- }),
444
- warning: css({
445
- borderColor: "var(--ds-border-warning, #FFC400)"
446
- }),
447
- success: css({
448
- borderColor: "var(--ds-border-success, #00875A)"
449
- }),
450
- discovery: css({
451
- borderColor: "var(--ds-border-discovery, #998DD9)"
452
- }),
453
- information: css({
454
- borderColor: "var(--ds-border-information, #0065FF)"
455
- }),
456
- bold: css({
457
- borderColor: "var(--ds-border-bold, #344563)"
458
- })
459
- };
460
- var backgroundColorMap = {
461
- disabled: css({
462
- backgroundColor: "var(--ds-background-disabled, #091e4289)"
463
- }),
464
- input: css({
465
- backgroundColor: "var(--ds-background-input, #FAFBFC)"
466
- }),
467
- 'inverse.subtle': css({
468
- backgroundColor: "var(--ds-background-inverse-subtle, #00000029)"
469
- }),
470
- neutral: css({
471
- backgroundColor: "var(--ds-background-neutral, #DFE1E6)"
472
- }),
473
- 'neutral.subtle': css({
474
- backgroundColor: "var(--ds-background-neutral-subtle, transparent)"
475
- }),
476
- 'neutral.bold': css({
477
- backgroundColor: "var(--ds-background-neutral-bold, #42526E)"
478
- }),
479
- selected: css({
480
- backgroundColor: "var(--ds-background-selected, #DEEBFF)"
481
- }),
482
- 'selected.bold': css({
483
- backgroundColor: "var(--ds-background-selected-bold, #0052CC)"
484
- }),
485
- 'brand.bold': css({
486
- backgroundColor: "var(--ds-background-brand-bold, #0052CC)"
487
- }),
488
- danger: css({
489
- backgroundColor: "var(--ds-background-danger, #FFEBE6)"
490
- }),
491
- 'danger.bold': css({
492
- backgroundColor: "var(--ds-background-danger-bold, #DE350B)"
493
- }),
494
- warning: css({
495
- backgroundColor: "var(--ds-background-warning, #FFFAE6)"
496
- }),
497
- 'warning.bold': css({
498
- backgroundColor: "var(--ds-background-warning-bold, #FFAB00)"
499
- }),
500
- success: css({
501
- backgroundColor: "var(--ds-background-success, #E3FCEF)"
502
- }),
503
- 'success.bold': css({
504
- backgroundColor: "var(--ds-background-success-bold, #00875A)"
505
- }),
506
- discovery: css({
507
- backgroundColor: "var(--ds-background-discovery, #EAE6FF)"
508
- }),
509
- 'discovery.bold': css({
510
- backgroundColor: "var(--ds-background-discovery-bold, #5243AA)"
511
- }),
512
- information: css({
513
- backgroundColor: "var(--ds-background-information, #DEEBFF)"
514
- }),
515
- 'information.bold': css({
516
- backgroundColor: "var(--ds-background-information-bold, #0052CC)"
517
- }),
518
- 'color.blanket': css({
519
- backgroundColor: "var(--ds-blanket, #091e4289)"
520
- }),
521
- 'color.blanket.selected': css({
522
- backgroundColor: "var(--ds-blanket-selected, #388BFF14)"
523
- }),
524
- 'color.blanket.danger': css({
525
- backgroundColor: "var(--ds-blanket-danger, #EF5C4814)"
526
- }),
527
- 'elevation.surface': css({
528
- backgroundColor: "var(--ds-surface, #FFFFFF)"
529
- }),
530
- 'elevation.surface.overlay': css({
531
- backgroundColor: "var(--ds-surface-overlay, #FFFFFF)"
532
- }),
533
- 'elevation.surface.raised': css({
534
- backgroundColor: "var(--ds-surface-raised, #FFFFFF)"
535
- }),
536
- 'elevation.surface.sunken': css({
537
- backgroundColor: "var(--ds-surface-sunken, #F4F5F7)"
538
- })
539
- };
540
- var shadowMap = {
541
- overflow: css({
542
- boxShadow: "var(--ds-shadow-overflow, 0px 0px 8px #091e423f, 0px 0px 1px #091e424f)"
543
- }),
544
- 'overflow.perimeter': css({
545
- boxShadow: "var(--ds-shadow-overflow-perimeter, #091e421f)"
546
- }),
547
- 'overflow.spread': css({
548
- boxShadow: "var(--ds-shadow-overflow-spread, #091e4229)"
549
- }),
550
- overlay: css({
551
- boxShadow: "var(--ds-shadow-overlay, 0px 8px 12px #091e423f, 0px 0px 1px #091e424f)"
552
- }),
553
- raised: css({
554
- boxShadow: "var(--ds-shadow-raised, 0px 1px 1px #091e423f, 0px 0px 1px #091e4221)"
555
- })
556
- };
557
- /**
558
- * @codegenEnd
559
- */
560
-
561
- /**
562
- * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
563
- * @codegen <<SignedSource::bacbea271b30ec7d2f61306c9a8a9e63>>
564
- * @codegenId misc
565
- * @codegenCommand yarn codegen-styles
566
- * @codegenParams ["layer"]
567
- */
568
- var layerMap = {
569
- card: css({
570
- zIndex: LAYERS['card']
571
- }),
572
- navigation: css({
573
- zIndex: LAYERS['navigation']
574
- }),
575
- dialog: css({
576
- zIndex: LAYERS['dialog']
577
- }),
578
- layer: css({
579
- zIndex: LAYERS['layer']
580
- }),
581
- blanket: css({
582
- zIndex: LAYERS['blanket']
583
- }),
584
- modal: css({
585
- zIndex: LAYERS['modal']
586
- }),
587
- flag: css({
588
- zIndex: LAYERS['flag']
589
- }),
590
- spotlight: css({
591
- zIndex: LAYERS['spotlight']
592
- }),
593
- tooltip: css({
594
- zIndex: LAYERS['tooltip']
595
- })
596
- };
597
-
598
- /**
599
- * @codegenEnd
600
- */