@atlaskit/ds-explorations 0.1.2 → 0.1.3

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/ds-explorations
2
2
 
3
+ ## 0.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`d6328e5e1ec`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d6328e5e1ec) - Removes the default values for `<Text />`.
8
+
3
9
  ## 0.1.2
4
10
 
5
11
  ### Patch Changes
@@ -124,8 +124,6 @@ var truncateStyles = (0, _react.css)({
124
124
  */
125
125
 
126
126
  var Text = function Text(_ref) {
127
- var _colorMap$surface;
128
-
129
127
  var _ref$as = _ref.as,
130
128
  Component = _ref$as === void 0 ? 'span' : _ref$as,
131
129
  children = _ref.children,
@@ -145,7 +143,7 @@ var Text = function Text(_ref) {
145
143
  var _ref2 = colorTuple || [],
146
144
  _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
147
145
  _ref3$ = _ref3[0],
148
- color = _ref3$ === void 0 ? (_colorMap$surface = _colorMap.colorMap[surface]) !== null && _colorMap$surface !== void 0 ? _colorMap$surface : 'color.text' : _ref3$,
146
+ color = _ref3$ === void 0 ? _colorMap.colorMap[surface] : _ref3$,
149
147
  fallback = _ref3[1];
150
148
 
151
149
  (0, _tinyInvariant.default)(asAllowlist.includes(Component), "@atlaskit/ds-explorations: Text received an invalid \"as\" value of \"".concat(Component, "\""));
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/ds-explorations",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "sideEffects": false
5
5
  }
@@ -117,11 +117,9 @@ const Text = ({
117
117
  testId,
118
118
  UNSAFE_style
119
119
  }) => {
120
- var _colorMap$surface;
121
-
122
120
  const surface = useSurface(); // @ts-ignore
123
121
 
124
- const [color = (_colorMap$surface = colorMap[surface]) !== null && _colorMap$surface !== void 0 ? _colorMap$surface : 'color.text', fallback] = colorTuple || [];
122
+ const [color = colorMap[surface], fallback] = colorTuple || [];
125
123
  invariant(asAllowlist.includes(Component), `@atlaskit/ds-explorations: Text received an invalid "as" value of "${Component}"`);
126
124
  return jsx(Component, {
127
125
  style: { ...UNSAFE_style,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/ds-explorations",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "sideEffects": false
5
5
  }
@@ -111,8 +111,6 @@ var truncateStyles = css({
111
111
  */
112
112
 
113
113
  var Text = function Text(_ref) {
114
- var _colorMap$surface;
115
-
116
114
  var _ref$as = _ref.as,
117
115
  Component = _ref$as === void 0 ? 'span' : _ref$as,
118
116
  children = _ref.children,
@@ -132,7 +130,7 @@ var Text = function Text(_ref) {
132
130
  var _ref2 = colorTuple || [],
133
131
  _ref3 = _slicedToArray(_ref2, 2),
134
132
  _ref3$ = _ref3[0],
135
- color = _ref3$ === void 0 ? (_colorMap$surface = colorMap[surface]) !== null && _colorMap$surface !== void 0 ? _colorMap$surface : 'color.text' : _ref3$,
133
+ color = _ref3$ === void 0 ? colorMap[surface] : _ref3$,
136
134
  fallback = _ref3[1];
137
135
 
138
136
  invariant(asAllowlist.includes(Component), "@atlaskit/ds-explorations: Text received an invalid \"as\" value of \"".concat(Component, "\""));
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/ds-explorations",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@atlaskit/ds-explorations",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "An experimental package for exploration and validation of spacing / typography foundations.",
5
5
  "license": "Apache-2.0",
6
6
  "atlassian": {
7
7
  "team": "Design System Team",
8
8
  "inPublicMirror": false,
9
- "releaseModel": "scheduled"
9
+ "releaseModel": "continuous"
10
10
  },
11
11
  "publishConfig": {
12
12
  "registry": "https://registry.npmjs.org/"
@@ -52,7 +52,7 @@
52
52
  "@atlaskit/visual-regression": "*",
53
53
  "@atlaskit/webdriver-runner": "*",
54
54
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
55
- "@testing-library/react": "^8.0.1",
55
+ "@testing-library/react": "^12.1.5",
56
56
  "fs-extra": "^4.0.2",
57
57
  "prettier": "^2.1.1",
58
58
  "react-dom": "^16.8.0",
package/report.api.md CHANGED
@@ -4,15 +4,20 @@
4
4
 
5
5
  [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
6
6
 
7
- ```ts
8
- import { CSSProperties } from 'react';
7
+ ````ts
8
+ import type { CSSProperties } from 'react';
9
9
  import { ElementType } from 'react';
10
10
  import { FC } from 'react';
11
11
  import { ForwardRefExoticComponent } from 'react';
12
12
  import { HTMLAttributes } from 'react';
13
+ import { jsx } from '@emotion/react';
13
14
  import { ReactNode } from 'react';
14
15
  import { RefAttributes } from 'react';
15
- import { SerializedStyles } from '@emotion/utils';
16
+ import { SerializedStyles } from '@emotion/react';
17
+
18
+ declare const asAllowlist: readonly ['span', 'div', 'p'];
19
+
20
+ declare type AsElement = typeof asAllowlist[number];
16
21
 
17
22
  declare type BackgroundColor = keyof typeof backgroundColorMap;
18
23
 
@@ -45,6 +50,27 @@ declare const backgroundColorMap: {
45
50
  'elevation.surface.overlay': SerializedStyles;
46
51
  };
47
52
 
53
+ declare const backgroundHoverColorMap: {
54
+ 'inverse.subtle': SerializedStyles;
55
+ input: SerializedStyles;
56
+ neutral: SerializedStyles;
57
+ 'neutral.subtle': SerializedStyles;
58
+ 'neutral.bold': SerializedStyles;
59
+ 'brand.bold': SerializedStyles;
60
+ selected: SerializedStyles;
61
+ 'selected.bold': SerializedStyles;
62
+ danger: SerializedStyles;
63
+ 'danger.bold': SerializedStyles;
64
+ warning: SerializedStyles;
65
+ 'warning.bold': SerializedStyles;
66
+ success: SerializedStyles;
67
+ 'success.bold': SerializedStyles;
68
+ discovery: SerializedStyles;
69
+ 'discovery.bold': SerializedStyles;
70
+ information: SerializedStyles;
71
+ 'information.bold': SerializedStyles;
72
+ };
73
+
48
74
  declare interface BasePrimitiveProps {
49
75
  /**
50
76
  * A unique string that appears as data attribute `data-testid` in the rendered code, serving as a hook for automated tests.
@@ -62,7 +88,7 @@ declare type BorderColor = keyof typeof borderColorMap;
62
88
 
63
89
  /**
64
90
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
65
- * @codegen <<SignedSource::e3f27406477352f51168b4108558f051>>
91
+ * @codegen <<SignedSource::ebb55786a54803214357d0eef0cac448>>
66
92
  * @codegenId colors
67
93
  * @codegenCommand yarn codegen-styles
68
94
  * @codegenParams ["border", "background"]
@@ -109,78 +135,6 @@ declare const borderWidthMap: {
109
135
  '3px': SerializedStyles;
110
136
  };
111
137
 
112
- declare interface BoxProps
113
- extends Omit<HTMLAttributes<HTMLElement>, 'style'>,
114
- BasePrimitiveProps {
115
- /**
116
- * The DOM element to render as the Box. Defaults to `div`.
117
- */
118
- as?: ElementType;
119
- /**
120
- * Elements to be rendered inside the Box.
121
- */
122
- children: ReactNode;
123
- /**
124
- * Token representing background color with a fallback.
125
- */
126
- backgroundColor?: [BackgroundColor, string];
127
- /**
128
- * Defines border style.
129
- */
130
- borderStyle?: BorderStyle;
131
- /**
132
- * Defines border width.
133
- */
134
- borderWidth?: BorderWidth;
135
- /**
136
- * Token representing border color with a fallback.
137
- */
138
- borderColor?: [BorderColor, string];
139
- /**
140
- * Defines border radius.
141
- */
142
- borderRadius?: BorderRadius;
143
- /**
144
- * Defines the main axis direction.
145
- */
146
- flexDirection?: FlexDirection;
147
- /**
148
- * Used to align children along the cross axis.
149
- */
150
- alignItems?: FlexAlignItems;
151
- /**
152
- * Used to align children along the main axis.
153
- */
154
- justifyContent?: FlexJustifyContent;
155
- /**
156
- * Shorthand for `paddingBlock` and `paddingInline` together.
157
- *
158
- * @see paddingBlock
159
- * @see paddingInline
160
- */
161
- padding?: GlobalSpacingToken;
162
- /**
163
- * Token representing CSS `padding-block`.
164
- */
165
- paddingBlock?: GlobalSpacingToken;
166
- /**
167
- * Token representing CSS `padding-inline`.
168
- */
169
- paddingInline?: GlobalSpacingToken;
170
- /**
171
- * Token representing width.
172
- */
173
- width?: GlobalSpacingToken;
174
- /**
175
- * Token representing height.
176
- */
177
- height?: GlobalSpacingToken;
178
- /**
179
- * Defines display type and layout. Defaults to `flex`.
180
- */
181
- display?: Display;
182
- }
183
-
184
138
  declare type Display = keyof typeof displayMap;
185
139
 
186
140
  declare const displayMap: {
@@ -251,9 +205,9 @@ declare const flexJustifyContentMap_3: {
251
205
  declare type FontSize = keyof typeof fontSizeMap;
252
206
 
253
207
  declare const fontSizeMap: {
254
- '11': SerializedStyles;
255
- '12': SerializedStyles;
256
- '14': SerializedStyles;
208
+ '11px': SerializedStyles;
209
+ '12px': SerializedStyles;
210
+ '14px': SerializedStyles;
257
211
  };
258
212
 
259
213
  declare type FontWeight = keyof typeof fontWeightMap;
@@ -261,9 +215,10 @@ declare type FontWeight = keyof typeof fontWeightMap;
261
215
  declare const fontWeightMap: {
262
216
  '400': SerializedStyles;
263
217
  '500': SerializedStyles;
218
+ '700': SerializedStyles;
264
219
  };
265
220
 
266
- declare type GlobalSpacingToken = keyof typeof SPACING_SCALE;
221
+ declare type GlobalSpacingToken = keyof typeof UNSAFE_SPACING_SCALE;
267
222
 
268
223
  declare interface InlineProps extends BasePrimitiveProps {
269
224
  /**
@@ -289,6 +244,13 @@ declare interface InlineProps extends BasePrimitiveProps {
289
244
  children: ReactNode;
290
245
  }
291
246
 
247
+ declare type InteractionBackgroundColor = keyof typeof backgroundHoverColorMap;
248
+
249
+ declare interface InteractionSurfaceProps extends BasePrimitiveProps {
250
+ children?: ReactNode;
251
+ appearance?: InteractionBackgroundColor;
252
+ }
253
+
292
254
  declare type LineHeight = keyof typeof lineHeightMap;
293
255
 
294
256
  declare const lineHeightMap: {
@@ -301,18 +263,10 @@ declare const lineHeightMap: {
301
263
  '40px': SerializedStyles;
302
264
  };
303
265
 
304
- declare const SPACING_SCALE: {
305
- 'sp-0': number;
306
- 'sp-25': number;
307
- 'sp-50': number;
308
- 'sp-75': number;
309
- 'sp-100': number;
310
- 'sp-200': number;
311
- 'sp-300': number;
312
- 'sp-400': number;
313
- 'sp-500': number;
314
- 'sp-600': number;
315
- 'sp-800': number;
266
+ declare const positionMap: {
267
+ absolute: SerializedStyles;
268
+ relative: SerializedStyles;
269
+ static: SerializedStyles;
316
270
  };
317
271
 
318
272
  declare interface StackProps extends BasePrimitiveProps {
@@ -346,7 +300,7 @@ declare type TextColor = keyof typeof textColorMap;
346
300
 
347
301
  /**
348
302
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
349
- * @codegen <<SignedSource::85a0a0bc073c7af8fd63101d6c88d59e>>
303
+ * @codegen <<SignedSource::140ffff6e1310c1c37e2067e2c232b92>>
350
304
  * @codegenId colors
351
305
  * @codegenCommand yarn codegen-styles
352
306
  * @codegenParams ["text"]
@@ -367,65 +321,114 @@ declare const textColorMap: {
367
321
  information: SerializedStyles;
368
322
  };
369
323
 
370
- declare interface TextProps extends BasePrimitiveProps {
324
+ declare type TextTransform = keyof typeof textTransformMap;
325
+
326
+ declare const textTransformMap: {
327
+ none: SerializedStyles;
328
+ lowercase: SerializedStyles;
329
+ uppercase: SerializedStyles;
330
+ };
331
+
332
+ /**
333
+ * __Box__
334
+ *
335
+ * Box is a primitive component that has the design decisions of the Atlassian Design System baked in.
336
+ * Renders a `div` by default.
337
+ *
338
+ * @internal
339
+ */
340
+ export declare const UNSAFE_Box: ForwardRefExoticComponent<
341
+ UNSAFE_BoxProps<HTMLElement> & RefAttributes<HTMLElement>
342
+ >;
343
+
344
+ export declare interface UNSAFE_BoxProps<T extends HTMLElement = HTMLElement>
345
+ extends Omit<HTMLAttributes<T>, 'style' | 'as' | 'className'>,
346
+ BasePrimitiveProps {
371
347
  /**
372
- * HTML tag to be rendered. Defaults to `span`.
348
+ * The DOM element to render as the Box. Defaults to `div`.
373
349
  */
374
- as?:
375
- | 'span'
376
- | 'h1'
377
- | 'h2'
378
- | 'h3'
379
- | 'h4'
380
- | 'h5'
381
- | 'h6'
382
- | 'label'
383
- | 'a'
384
- | 'ul'
385
- | 'ol'
386
- | 'p';
350
+ as?: ElementType;
387
351
  /**
388
- * Elements rendered within the Text element
352
+ * Elements to be rendered inside the Box.
389
353
  */
390
- children: ReactNode;
354
+ children?: ReactNode;
391
355
  /**
392
- * Text color
356
+ * The html className attribute.
357
+ *
358
+ * Before using this prop please ensure:
359
+ * - The styles cannot otherwise be achieved through `Box` directly.
360
+ * - The use case needs custom styles that cannot be designed or implemented differently
361
+ *
362
+ * Ensure you're using the `@atlaskit/eslint-plugin-design-system` with this prop to prevent unbounded usage.
363
+ *
364
+ * @see `@atlaskit/eslint-plugin-design-system`
393
365
  */
394
- color?: [TextColor, string];
366
+ className?: string;
395
367
  /**
396
- * Font size https://developer.mozilla.org/en-US/docs/Web/CSS/font-size
368
+ * Token representing background color with a fallback.
397
369
  */
398
- fontSize?: FontSize;
370
+ backgroundColor?: [BackgroundColor, string];
399
371
  /**
400
- * Font weight https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight
372
+ * Defines border style.
401
373
  */
402
- fontWeight?: FontWeight;
374
+ borderStyle?: BorderStyle;
403
375
  /**
404
- * Line height https://developer.mozilla.org/en-US/docs/Web/CSS/line-height
376
+ * Defines border width.
405
377
  */
406
- lineHeight?: LineHeight;
378
+ borderWidth?: BorderWidth;
407
379
  /**
408
- * Text align https://developer.mozilla.org/en-US/docs/Web/CSS/text-align
380
+ * Token representing border color with a fallback.
409
381
  */
410
- textAlign?: TextAlign;
382
+ borderColor?: [BorderColor, string];
383
+ /**
384
+ * Defines border radius.
385
+ */
386
+ borderRadius?: BorderRadius;
387
+ /**
388
+ * Defines the main axis direction.
389
+ */
390
+ flexDirection?: FlexDirection;
391
+ /**
392
+ * Used to align children along the cross axis.
393
+ */
394
+ alignItems?: FlexAlignItems;
411
395
  /**
412
- * For use with `a` link tags.
396
+ * Used to align children along the main axis.
413
397
  */
414
- href?: string;
398
+ justifyContent?: FlexJustifyContent;
399
+ /**
400
+ * Shorthand for `paddingBlock` and `paddingInline` together.
401
+ *
402
+ * @see paddingBlock
403
+ * @see paddingInline
404
+ */
405
+ padding?: GlobalSpacingToken;
406
+ /**
407
+ * Token representing CSS `padding-block`.
408
+ */
409
+ paddingBlock?: GlobalSpacingToken;
410
+ /**
411
+ * Token representing CSS `padding-inline`.
412
+ */
413
+ paddingInline?: GlobalSpacingToken;
414
+ /**
415
+ * Token representing width.
416
+ */
417
+ width?: GlobalSpacingToken;
418
+ /**
419
+ * Token representing height.
420
+ */
421
+ height?: GlobalSpacingToken;
422
+ /**
423
+ * Defines display type and layout. Defaults to `flex`.
424
+ */
425
+ display?: Display;
426
+ /**
427
+ * CSS position property.
428
+ */
429
+ position?: keyof typeof positionMap;
415
430
  }
416
431
 
417
- /**
418
- * __Box__
419
- *
420
- * Box is a primitive component that has the design decisions of the Atlassian Design System baked in.
421
- * Renders a `div` by default.
422
- *
423
- * @internal
424
- */
425
- export declare const UNSAFE_Box: ForwardRefExoticComponent<
426
- BoxProps & RefAttributes<HTMLElement>
427
- >;
428
-
429
432
  /**
430
433
  * __Inline__
431
434
  *
@@ -437,6 +440,38 @@ export declare const UNSAFE_Inline: ForwardRefExoticComponent<
437
440
  InlineProps & RefAttributes<HTMLDivElement>
438
441
  >;
439
442
 
443
+ /**
444
+ *
445
+ * @example
446
+ * ```js
447
+ * // a minimal icon button
448
+ * <Box as="button">
449
+ * <InteractionSurface />
450
+ * <WarningIcon label="icon button" />
451
+ * </Box>
452
+ * ```
453
+ */
454
+ export declare const UNSAFE_InteractionSurface: ({
455
+ appearance,
456
+ children,
457
+ testId,
458
+ }: InteractionSurfaceProps) => jsx.JSX.Element;
459
+
460
+ export declare const UNSAFE_SPACING_SCALE: {
461
+ 'sp-0': number;
462
+ 'sp-25': number;
463
+ 'sp-50': number;
464
+ 'sp-75': number;
465
+ 'sp-100': number;
466
+ 'sp-150': number;
467
+ 'sp-200': number;
468
+ 'sp-300': number;
469
+ 'sp-400': number;
470
+ 'sp-500': number;
471
+ 'sp-600': number;
472
+ 'sp-800': number;
473
+ };
474
+
440
475
  /**
441
476
  * __Stack__
442
477
  *
@@ -457,7 +492,59 @@ export declare const UNSAFE_Stack: ForwardRefExoticComponent<
457
492
  *
458
493
  * @internal
459
494
  */
460
- export declare const UNSAFE_Text: FC<TextProps>;
495
+ export declare const UNSAFE_Text: FC<UNSAFE_TextProps>;
496
+
497
+ export declare interface UNSAFE_TextProps extends BasePrimitiveProps {
498
+ /**
499
+ * HTML tag to be rendered. Defaults to `span`.
500
+ */
501
+ as?: AsElement;
502
+ /**
503
+ * Elements rendered within the Text element
504
+ */
505
+ children: ReactNode;
506
+ /**
507
+ * Text color
508
+ */
509
+ color?: [TextColor, string];
510
+ /**
511
+ * Font size https://developer.mozilla.org/en-US/docs/Web/CSS/font-size
512
+ */
513
+ fontSize?: FontSize;
514
+ /**
515
+ * Font weight https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight
516
+ */
517
+ fontWeight?: FontWeight;
518
+ /**
519
+ * Line height https://developer.mozilla.org/en-US/docs/Web/CSS/line-height
520
+ */
521
+ lineHeight?: LineHeight;
522
+ /**
523
+ * Truncates text with an ellipsis when text overflows its parent container
524
+ * (i.e. `width` has been set on parent that is shorter than text length).
525
+ */
526
+ shouldTruncate?: boolean;
527
+ /**
528
+ * Text align https://developer.mozilla.org/en-US/docs/Web/CSS/text-align
529
+ */
530
+ textAlign?: TextAlign;
531
+ /**
532
+ * Text transform https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform
533
+ */
534
+ textTransform?: TextTransform;
535
+ /**
536
+ * Vertical align https://developer.mozilla.org/en-US/docs/Web/CSS/vertical-align
537
+ */
538
+ verticalAlign?: VerticalAlign;
539
+ }
540
+
541
+ declare type VerticalAlign = keyof typeof verticalAlignMap;
542
+
543
+ declare const verticalAlignMap: {
544
+ top: SerializedStyles;
545
+ middle: SerializedStyles;
546
+ bottom: SerializedStyles;
547
+ };
461
548
 
462
549
  export {};
463
- ```
550
+ ````
@@ -142,8 +142,7 @@ const Text: FC<TextProps> = ({
142
142
  }: TextProps) => {
143
143
  const surface = useSurface();
144
144
  // @ts-ignore
145
- const [color = colorMap[surface] ?? 'color.text', fallback] =
146
- colorTuple || [];
145
+ const [color = colorMap[surface], fallback] = colorTuple || [];
147
146
  invariant(
148
147
  asAllowlist.includes(Component),
149
148
  `@atlaskit/ds-explorations: Text received an invalid "as" value of "${Component}"`,