@atlaskit/primitives 0.4.1 → 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.
@@ -0,0 +1,22 @@
1
+ import { css as cssEmotion } from '@emotion/react';
2
+ import { CSSObject, CSSPropertiesWithMultiValues, CSSPseudos } from '@emotion/serialize';
3
+ import { TokenisedProps } from './style-maps';
4
+ declare const uniqueSymbol: unique symbol;
5
+ /**
6
+ * Only exposed for testing.
7
+ * @internal
8
+ */
9
+ export declare const transformStyles: (styleObj?: CSSObject | CSSObject[] | undefined) => CSSObject | CSSObject[] | undefined;
10
+ declare type XCSS = ReturnType<typeof xcss>;
11
+ export declare type SafeCSS = XCSS | XCSS[];
12
+ export declare type SafeCSSObject = CSSPseudos & TokenisedProps & Omit<CSSPropertiesWithMultiValues, keyof TokenisedProps>;
13
+ export declare const xcss: (style?: SafeCSSObject | SafeCSSObject[] | undefined) => {
14
+ readonly symbol: typeof uniqueSymbol;
15
+ readonly styles: import("@emotion/react").SerializedStyles;
16
+ };
17
+ /**
18
+ * @internal used in primitives
19
+ * @returns
20
+ */
21
+ export declare const parseXcss: (args: SafeCSS) => ReturnType<typeof cssEmotion>;
22
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Primitives are token-backed low-level building blocks.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -41,6 +41,7 @@
41
41
  "@atlaskit/tokens": "^1.2.0",
42
42
  "@babel/runtime": "^7.0.0",
43
43
  "@emotion/react": "^11.7.1",
44
+ "@emotion/serialize": "^1.1.0",
44
45
  "tiny-invariant": "^1.2.0"
45
46
  },
46
47
  "peerDependencies": {
@@ -88,4 +89,4 @@
88
89
  }
89
90
  },
90
91
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
91
- }
92
+ }
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,10 +125,40 @@ 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>;
@@ -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;
@@ -408,6 +460,18 @@ const LAYERS: {
408
460
  readonly tooltip: 800;
409
461
  };
410
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
+
411
475
  // @public (undocumented)
412
476
  type Overflow = keyof typeof overflowMap;
413
477
 
@@ -438,6 +502,9 @@ const overflowMap: {
438
502
  // @public (undocumented)
439
503
  type Padding = keyof typeof paddingMap;
440
504
 
505
+ // @public (undocumented)
506
+ type Padding_2 = keyof typeof paddingMap_2;
507
+
441
508
  // @public (undocumented)
442
509
  type PaddingBlock = keyof typeof paddingMap;
443
510
 
@@ -474,6 +541,24 @@ const paddingMap: {
474
541
  readonly 'space.1000': 'var(--ds-space-1000)';
475
542
  };
476
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
+
477
562
  // @public (undocumented)
478
563
  type Position = keyof typeof positionMap;
479
564
 
@@ -496,7 +581,7 @@ type PublicBoxPropsBase = {
496
581
  paddingInline?: PaddingInline;
497
582
  paddingInlineStart?: PaddingInlineStart;
498
583
  paddingInlineEnd?: PaddingInlineEnd;
499
- customStyles?: CustomStyles;
584
+ xcss?: SafeCSS;
500
585
  };
501
586
 
502
587
  // @public
@@ -523,6 +608,14 @@ const rowSpaceMap: {
523
608
  readonly '1000': SerializedStyles;
524
609
  };
525
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
+
526
619
  // @public (undocumented)
527
620
  type Shadow = keyof typeof shadowMap;
528
621
 
@@ -618,6 +711,9 @@ export interface StackProps<T extends ElementType = 'div'> {
618
711
  // @public (undocumented)
619
712
  type TextColor = keyof typeof textColorMap;
620
713
 
714
+ // @public (undocumented)
715
+ type TextColor_2 = keyof typeof textColorMap_2;
716
+
621
717
  // @public (undocumented)
622
718
  const textColorMap: {
623
719
  readonly 'color.text': SerializedStyles;
@@ -653,9 +749,71 @@ const textColorMap: {
653
749
  readonly subtle: SerializedStyles;
654
750
  };
655
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
+
656
811
  // @public (undocumented)
657
812
  type Width = keyof typeof widthMap;
658
813
 
814
+ // @public (undocumented)
815
+ type Width_2 = keyof typeof dimensionMap;
816
+
659
817
  // @public
660
818
  const widthMap: {
661
819
  readonly '100%': SerializedStyles;
@@ -668,6 +826,15 @@ const widthMap: {
668
826
  readonly 'size.1000': SerializedStyles;
669
827
  };
670
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
+
671
838
  // (No @packageDocumentation comment for this package)
672
839
  ```
673
840