@atlaskit/ds-explorations 2.1.1 → 2.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 +16 -0
  2. package/dist/cjs/components/box.partial.js +3 -3
  3. package/dist/cjs/components/inline.partial.js +2 -2
  4. package/dist/cjs/components/stack.partial.js +2 -2
  5. package/dist/cjs/components/text.partial.js +3 -3
  6. package/dist/cjs/version.json +1 -1
  7. package/dist/es2019/components/box.partial.js +3 -3
  8. package/dist/es2019/components/inline.partial.js +2 -2
  9. package/dist/es2019/components/stack.partial.js +2 -2
  10. package/dist/es2019/components/text.partial.js +3 -3
  11. package/dist/es2019/version.json +1 -1
  12. package/dist/esm/components/box.partial.js +3 -3
  13. package/dist/esm/components/inline.partial.js +2 -2
  14. package/dist/esm/components/stack.partial.js +2 -2
  15. package/dist/esm/components/text.partial.js +3 -3
  16. package/dist/esm/version.json +1 -1
  17. package/dist/types/components/box.partial.d.ts +2 -2
  18. package/dist/types/components/inline.partial.d.ts +2 -2
  19. package/dist/types/components/stack.partial.d.ts +2 -2
  20. package/dist/types/components/text.partial.d.ts +1 -1
  21. package/dist/types-ts4.5/components/box.partial.d.ts +355 -0
  22. package/dist/types-ts4.5/components/inline.partial.d.ts +108 -0
  23. package/dist/types-ts4.5/components/interaction-surface.partial.d.ts +49 -0
  24. package/dist/types-ts4.5/components/stack.partial.d.ts +92 -0
  25. package/dist/types-ts4.5/components/surface-provider.d.ts +15 -0
  26. package/dist/types-ts4.5/components/text.partial.d.ts +156 -0
  27. package/dist/types-ts4.5/components/types.d.ts +13 -0
  28. package/dist/types-ts4.5/constants.d.ts +12 -0
  29. package/dist/types-ts4.5/index.d.ts +9 -0
  30. package/dist/types-ts4.5/internal/color-map.d.ts +36 -0
  31. package/dist/types-ts4.5/internal/role-to-element.d.ts +32 -0
  32. package/dist/types-ts4.5/internal/spacing-scale.d.ts +24 -0
  33. package/package.json +2 -2
  34. package/scripts/spacing-codegen-template.tsx +1 -1
  35. package/src/components/__tests__/visual-regression/__image_snapshots__/text-snapshot-test-tsx-text-example-with-font-sizes-should-match-snapshot-1-snap.png +2 -2
  36. package/src/components/box.partial.tsx +3 -3
  37. package/src/components/inline.partial.tsx +2 -2
  38. package/src/components/stack.partial.tsx +2 -2
@@ -0,0 +1,156 @@
1
+ /** @jsx jsx */
2
+ import { FC, ReactNode } from 'react';
3
+ import type { BasePrimitiveProps } from './types';
4
+ declare const asAllowlist: readonly [
5
+ "span",
6
+ "div",
7
+ "p",
8
+ "strong"
9
+ ];
10
+ type AsElement = (typeof asAllowlist)[number];
11
+ export interface TextProps extends BasePrimitiveProps {
12
+ /**
13
+ * HTML tag to be rendered. Defaults to `span`.
14
+ */
15
+ as?: AsElement;
16
+ /**
17
+ * Elements rendered within the Text element
18
+ */
19
+ children: ReactNode;
20
+ /**
21
+ * Text color
22
+ */
23
+ color?: TextColor;
24
+ /**
25
+ * The HTML id attribute https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
26
+ */
27
+ id?: string;
28
+ /**
29
+ * Font size https://developer.mozilla.org/en-US/docs/Web/CSS/font-size
30
+ */
31
+ fontSize?: FontSize;
32
+ /**
33
+ * Font weight https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight
34
+ */
35
+ fontWeight?: FontWeight;
36
+ /**
37
+ * Line height https://developer.mozilla.org/en-US/docs/Web/CSS/line-height
38
+ */
39
+ lineHeight?: LineHeight;
40
+ /**
41
+ * Truncates text with an ellipsis when text overflows its parent container
42
+ * (i.e. `width` has been set on parent that is shorter than text length).
43
+ */
44
+ shouldTruncate?: boolean;
45
+ /**
46
+ * Text align https://developer.mozilla.org/en-US/docs/Web/CSS/text-align
47
+ */
48
+ textAlign?: TextAlign;
49
+ /**
50
+ * Text transform https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform
51
+ */
52
+ textTransform?: TextTransform;
53
+ /**
54
+ * Vertical align https://developer.mozilla.org/en-US/docs/Web/CSS/vertical-align
55
+ */
56
+ verticalAlign?: VerticalAlign;
57
+ }
58
+ type TextAlign = keyof typeof textAlignMap;
59
+ declare const textAlignMap: {
60
+ center: import("@emotion/react").SerializedStyles;
61
+ end: import("@emotion/react").SerializedStyles;
62
+ start: import("@emotion/react").SerializedStyles;
63
+ };
64
+ type TextTransform = keyof typeof textTransformMap;
65
+ declare const textTransformMap: {
66
+ none: import("@emotion/react").SerializedStyles;
67
+ lowercase: import("@emotion/react").SerializedStyles;
68
+ uppercase: import("@emotion/react").SerializedStyles;
69
+ };
70
+ type VerticalAlign = keyof typeof verticalAlignMap;
71
+ declare const verticalAlignMap: {
72
+ top: import("@emotion/react").SerializedStyles;
73
+ middle: import("@emotion/react").SerializedStyles;
74
+ bottom: import("@emotion/react").SerializedStyles;
75
+ };
76
+ /**
77
+ * __Text__
78
+ *
79
+ * Text is a primitive component that has the Atlassian Design System's design guidelines baked in.
80
+ * This includes considerations for text attributes such as color, font size, font weight, and line height.
81
+ * It renders a `span` by default.
82
+ *
83
+ * @internal
84
+ */
85
+ declare const Text: FC<TextProps>;
86
+ export default Text;
87
+ /**
88
+ * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
89
+ * @codegen <<SignedSource::c5cbba9e889615c5824ee237fd52ad2e>>
90
+ * @codegenId typography
91
+ * @codegenCommand yarn codegen-styles
92
+ * @codegenParams ["fontSize", "fontWeight", "fontFamily", "lineHeight"]
93
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-typography.tsx <<SignedSource::e6bf70c53b8eecdb84ae4c79966537e3>>
94
+ */
95
+ declare const fontSizeMap: {
96
+ 'size.050': import("@emotion/react").SerializedStyles;
97
+ 'size.075': import("@emotion/react").SerializedStyles;
98
+ 'size.100': import("@emotion/react").SerializedStyles;
99
+ 'size.200': import("@emotion/react").SerializedStyles;
100
+ 'size.300': import("@emotion/react").SerializedStyles;
101
+ 'size.400': import("@emotion/react").SerializedStyles;
102
+ 'size.500': import("@emotion/react").SerializedStyles;
103
+ 'size.600': import("@emotion/react").SerializedStyles;
104
+ };
105
+ export type FontSize = keyof typeof fontSizeMap;
106
+ declare const fontWeightMap: {
107
+ bold: import("@emotion/react").SerializedStyles;
108
+ medium: import("@emotion/react").SerializedStyles;
109
+ regular: import("@emotion/react").SerializedStyles;
110
+ semibold: import("@emotion/react").SerializedStyles;
111
+ };
112
+ export type FontWeight = keyof typeof fontWeightMap;
113
+ declare const fontFamilyMap: {
114
+ monospace: import("@emotion/react").SerializedStyles;
115
+ sans: import("@emotion/react").SerializedStyles;
116
+ };
117
+ export type FontFamily = keyof typeof fontFamilyMap;
118
+ declare const lineHeightMap: {
119
+ 'lineHeight.100': import("@emotion/react").SerializedStyles;
120
+ 'lineHeight.200': import("@emotion/react").SerializedStyles;
121
+ 'lineHeight.300': import("@emotion/react").SerializedStyles;
122
+ 'lineHeight.400': import("@emotion/react").SerializedStyles;
123
+ 'lineHeight.500': import("@emotion/react").SerializedStyles;
124
+ 'lineHeight.600': import("@emotion/react").SerializedStyles;
125
+ };
126
+ export type LineHeight = keyof typeof lineHeightMap;
127
+ /**
128
+ * @codegenEnd
129
+ */
130
+ /**
131
+ * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
132
+ * @codegen <<SignedSource::3780858df77f5fe0c6e0f39a4c989741>>
133
+ * @codegenId colors
134
+ * @codegenCommand yarn codegen-styles
135
+ * @codegenParams ["text"]
136
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::10aa7e87eca39e4d6594a764e78e0698>>
137
+ */
138
+ declare const textColorMap: {
139
+ readonly 'color.text': import("@emotion/react").SerializedStyles;
140
+ readonly disabled: import("@emotion/react").SerializedStyles;
141
+ readonly inverse: import("@emotion/react").SerializedStyles;
142
+ readonly selected: import("@emotion/react").SerializedStyles;
143
+ readonly brand: import("@emotion/react").SerializedStyles;
144
+ readonly danger: import("@emotion/react").SerializedStyles;
145
+ readonly warning: import("@emotion/react").SerializedStyles;
146
+ readonly 'warning.inverse': import("@emotion/react").SerializedStyles;
147
+ readonly success: import("@emotion/react").SerializedStyles;
148
+ readonly discovery: import("@emotion/react").SerializedStyles;
149
+ readonly information: import("@emotion/react").SerializedStyles;
150
+ readonly subtlest: import("@emotion/react").SerializedStyles;
151
+ readonly subtle: import("@emotion/react").SerializedStyles;
152
+ };
153
+ export type TextColor = keyof typeof textColorMap;
154
+ /**
155
+ * @codegenEnd
156
+ */
@@ -0,0 +1,13 @@
1
+ import type { CSSProperties } from 'react';
2
+ export interface BasePrimitiveProps {
3
+ /**
4
+ * A unique string that appears as data attribute `data-testid` in the rendered code, serving as a hook for automated tests.
5
+ */
6
+ testId?: string;
7
+ /**
8
+ * Inline styles to be applied to the primitive.
9
+ * Marked as "unsafe" because any CSS properties can be provided here without any extra control or validation, including those that would be better managed by the primitive itself via props.
10
+ * Effectively equivalent to the standard `style` prop but marked with a special name so we can rationalise its usage IN THE FUTURE.
11
+ */
12
+ UNSAFE_style?: CSSProperties;
13
+ }
@@ -0,0 +1,12 @@
1
+ export declare const LAYERS: {
2
+ readonly card: 100;
3
+ readonly navigation: 200;
4
+ readonly dialog: 300;
5
+ readonly layer: 400;
6
+ readonly blanket: 500;
7
+ readonly modal: 510;
8
+ readonly flag: 600;
9
+ readonly spotlight: 700;
10
+ readonly tooltip: 800;
11
+ };
12
+ export type Layer = keyof typeof LAYERS;
@@ -0,0 +1,9 @@
1
+ export { default as UNSAFE_Box } from './components/box.partial';
2
+ export { default as UNSAFE_Text } from './components/text.partial';
3
+ export { default as UNSAFE_Inline } from './components/inline.partial';
4
+ export { default as UNSAFE_Stack } from './components/stack.partial';
5
+ export { default as UNSAFE_InteractionSurface } from './components/interaction-surface.partial';
6
+ export type { BoxProps as UNSAFE_BoxProps } from './components/box.partial';
7
+ export type { TextProps as UNSAFE_TextProps } from './components/text.partial';
8
+ export type { InlineProps as UNSAFE_InlineProps } from './components/inline.partial';
9
+ export type { StackProps as UNSAFE_StackProps } from './components/stack.partial';
@@ -0,0 +1,36 @@
1
+ /**
2
+ * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
+ *
4
+ * The color map is used to map a background color token to a matching text color that will meet contrast.
5
+ *
6
+ * @codegen <<SignedSource::d168519874a16bbb92cfbfd4747a39b4>>
7
+ * @codegenCommand yarn codegen-styles
8
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::10aa7e87eca39e4d6594a764e78e0698>>
9
+ */
10
+ declare const _default: {
11
+ readonly 'neutral.bold': "inverse";
12
+ readonly 'neutral.bold.hovered': "inverse";
13
+ readonly 'neutral.bold.pressed': "inverse";
14
+ readonly 'selected.bold': "inverse";
15
+ readonly 'selected.bold.hovered': "inverse";
16
+ readonly 'selected.bold.pressed': "inverse";
17
+ readonly 'brand.bold': "inverse";
18
+ readonly 'brand.bold.hovered': "inverse";
19
+ readonly 'brand.bold.pressed': "inverse";
20
+ readonly 'danger.bold': "inverse";
21
+ readonly 'danger.bold.hovered': "inverse";
22
+ readonly 'danger.bold.pressed': "inverse";
23
+ readonly 'warning.bold': "warning.inverse";
24
+ readonly 'warning.bold.hovered': "warning.inverse";
25
+ readonly 'warning.bold.pressed': "warning.inverse";
26
+ readonly 'success.bold': "inverse";
27
+ readonly 'success.bold.hovered': "inverse";
28
+ readonly 'success.bold.pressed': "inverse";
29
+ readonly 'discovery.bold': "inverse";
30
+ readonly 'discovery.bold.hovered': "inverse";
31
+ readonly 'discovery.bold.pressed': "inverse";
32
+ readonly 'information.bold': "inverse";
33
+ readonly 'information.bold.hovered': "inverse";
34
+ readonly 'information.bold.pressed': "inverse";
35
+ };
36
+ export default _default;
@@ -0,0 +1,32 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * Adapted straight from react-mui, with a small change.
4
+ * @see https://www.unpkg.com/browse/react-gui@0.2.1/src/modules/getAccessibilityElementWithSideEffect.js
5
+ */
6
+ declare const roleToElementType: {
7
+ readonly article: "article";
8
+ readonly banner: "header";
9
+ readonly blockquote: "blockquote";
10
+ readonly button: "button";
11
+ readonly code: "code";
12
+ readonly complementary: "aside";
13
+ readonly contentinfo: "footer";
14
+ readonly deletion: "del";
15
+ readonly emphasis: "em";
16
+ readonly figure: "figure";
17
+ readonly insertion: "ins";
18
+ readonly form: "form";
19
+ readonly link: "a";
20
+ readonly list: "ul";
21
+ readonly listitem: "li";
22
+ readonly main: "main";
23
+ readonly navigation: "nav";
24
+ readonly region: "section";
25
+ readonly strong: "strong";
26
+ readonly presentation: "div";
27
+ readonly group: "fieldset";
28
+ };
29
+ type RoleMap = typeof roleToElementType;
30
+ export type Role = keyof RoleMap;
31
+ export type SupportedElements = RoleMap[Role] & keyof JSX.IntrinsicElements;
32
+ export default roleToElementType;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
+ *
4
+ * Internal codegen of the spacing scale values. Only used for internal examples.
5
+ *
6
+ * @codegen <<SignedSource::885d6c601dfa9fccaf33a7bd461ef59d>>
7
+ * @codegenCommand yarn codegen-styles
8
+ */
9
+ export declare const spacingScale: readonly [
10
+ "space.0",
11
+ "space.025",
12
+ "space.050",
13
+ "space.075",
14
+ "space.100",
15
+ "space.150",
16
+ "space.200",
17
+ "space.250",
18
+ "space.300",
19
+ "space.400",
20
+ "space.500",
21
+ "space.600",
22
+ "space.800",
23
+ "space.1000"
24
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/ds-explorations",
3
- "version": "2.1.1",
3
+ "version": "2.2.0",
4
4
  "description": "An experimental package for exploration and validation of spacing / typography foundations.",
5
5
  "license": "Apache-2.0",
6
6
  "atlassian": {
@@ -39,7 +39,7 @@
39
39
  "./inline": "./src/components/inline.partial.tsx"
40
40
  },
41
41
  "dependencies": {
42
- "@atlaskit/tokens": "^1.4.0",
42
+ "@atlaskit/tokens": "^1.5.0",
43
43
  "@babel/runtime": "^7.0.0",
44
44
  "@emotion/react": "^11.7.1",
45
45
  "tiny-invariant": "^1.2.0"
@@ -32,7 +32,7 @@ const onlySpaceTokens = tokens.filter((token) =>
32
32
 
33
33
  const activeTokens = onlySpaceTokens.map((t) => ({
34
34
  name: t.name,
35
- fallback: t.attributes.pixelValue!,
35
+ fallback: t.value,
36
36
  }));
37
37
 
38
38
  export const createSpacingStylesFromTemplate = (
@@ -1,3 +1,3 @@
1
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:7f58caf93b47b6d2f5061536f06d0a383c012beea2cc7cb350ed92883be1db42
3
- size 29887
2
+ oid sha256:22fba76783544ea81fce5e329173deefcc0e0c72f48be1ac24b4b981f8b21b04
3
+ size 29399
@@ -250,7 +250,7 @@ const borderWidthMap = {
250
250
 
251
251
  type BorderRadius = keyof typeof borderRadiusMap;
252
252
  const borderRadiusMap = {
253
- normal: css({ borderRadius: token('border.radius.100', '3px') }),
253
+ normal: css({ borderRadius: '3px' }),
254
254
  rounded: css({ borderRadius: '50%' }),
255
255
  badge: css({ borderRadius: '8px' }),
256
256
  };
@@ -357,11 +357,11 @@ export type Height = keyof typeof heightMap;
357
357
 
358
358
  /**
359
359
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
360
- * @codegen <<SignedSource::0ba10ee53636df14b0db65fa1adbc94c>>
360
+ * @codegen <<SignedSource::fc99bb48c96c557caeb69d2dcaaa9d3f>>
361
361
  * @codegenId spacing
362
362
  * @codegenCommand yarn codegen-styles
363
363
  * @codegenParams ["padding", "paddingBlock", "paddingInline"]
364
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::167d3b69b159ae33e74d4ea5ab7eade6>>
364
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::86e173b0e020fe5d091fdf4bff023711>>
365
365
  */
366
366
  const paddingMap = {
367
367
  'space.0': css({
@@ -160,11 +160,11 @@ export default Inline;
160
160
 
161
161
  /**
162
162
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
163
- * @codegen <<SignedSource::75d680a1c3c5679ef743f39217148d11>>
163
+ * @codegen <<SignedSource::c96c5857a4f0baed6460df50c2a63f98>>
164
164
  * @codegenId spacing
165
165
  * @codegenCommand yarn codegen-styles
166
166
  * @codegenParams ["columnGap"]
167
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::167d3b69b159ae33e74d4ea5ab7eade6>>
167
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::86e173b0e020fe5d091fdf4bff023711>>
168
168
  */
169
169
  const columnGapMap = {
170
170
  'space.0': css({
@@ -116,11 +116,11 @@ export default Stack;
116
116
 
117
117
  /**
118
118
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
119
- * @codegen <<SignedSource::b762b9e20e785c1909a1c59c2791a66e>>
119
+ * @codegen <<SignedSource::9dc5e6c3922e4561e878c7f33bcec126>>
120
120
  * @codegenId spacing
121
121
  * @codegenCommand yarn codegen-styles
122
122
  * @codegenParams ["rowGap"]
123
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::167d3b69b159ae33e74d4ea5ab7eade6>>
123
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::86e173b0e020fe5d091fdf4bff023711>>
124
124
  */
125
125
  const rowGapMap = {
126
126
  'space.0': css({