@atlaskit/ds-explorations 0.0.3 → 0.1.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.
- package/CHANGELOG.md +15 -0
- package/dist/cjs/components/box.partial.js +215 -83
- package/dist/cjs/components/inline.partial.js +120 -0
- package/dist/cjs/components/stack.partial.js +112 -0
- package/dist/cjs/components/text.partial.js +92 -34
- package/dist/cjs/components/types.js +5 -0
- package/dist/cjs/constants.js +2 -0
- package/dist/cjs/index.js +34 -3
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/box.partial.js +198 -83
- package/dist/es2019/components/inline.partial.js +107 -0
- package/dist/es2019/components/stack.partial.js +102 -0
- package/dist/es2019/components/text.partial.js +80 -34
- package/dist/es2019/components/types.js +1 -0
- package/dist/es2019/constants.js +2 -0
- package/dist/es2019/index.js +4 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/box.partial.js +210 -83
- package/dist/esm/components/inline.partial.js +106 -0
- package/dist/esm/components/stack.partial.js +101 -0
- package/dist/esm/components/text.partial.js +89 -33
- package/dist/esm/components/types.js +1 -0
- package/dist/esm/constants.js +2 -0
- package/dist/esm/index.js +4 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/components/box.partial.d.ts +86 -26
- package/dist/types/components/inline.partial.d.ts +52 -0
- package/dist/types/components/stack.partial.d.ts +47 -0
- package/dist/types/components/text.partial.d.ts +63 -15
- package/dist/types/components/types.d.ts +13 -0
- package/dist/types/constants.d.ts +2 -0
- package/dist/types/index.d.ts +4 -2
- package/examples/00-basic.tsx +18 -1
- package/examples/01-box.tsx +126 -2
- package/examples/02-text.tsx +55 -2
- package/examples/03-stack.tsx +125 -0
- package/examples/04-inline.tsx +134 -0
- package/examples/{03-badge.tsx → 05-badge.tsx} +4 -4
- package/examples/{04-section-message.tsx → 06-section-message.tsx} +5 -5
- package/examples/{05-comment.tsx → 07-comment.tsx} +10 -8
- package/examples/08-lozenge.tsx +29 -0
- package/package.json +1 -1
- package/report.api.md +457 -4
- package/scripts/__tests__/__snapshots__/codegen.test.tsx.snap +80 -47
- package/scripts/codegen-styles.tsx +5 -1
- package/scripts/color-codegen-template.tsx +33 -11
- package/scripts/spacing-codegen-template.tsx +9 -1
- package/src/components/__tests__/unit/box.test.tsx +20 -0
- package/src/components/__tests__/unit/inline.test.tsx +43 -0
- package/src/components/__tests__/unit/stack.test.tsx +31 -0
- package/src/components/__tests__/unit/text.test.tsx +17 -0
- package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-basic-example-should-match-production-example-1-snap.png +3 -0
- package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-alignment-should-match-snapshot-1-snap.png +3 -0
- package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-background-and-padding-block-should-match-snapshot-1-snap.png +3 -0
- package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-background-and-padding-inline-should-match-snapshot-1-snap.png +3 -0
- package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-background-and-padding-should-match-snapshot-1-snap.png +3 -0
- package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-background-color-should-match-snapshot-1-snap.png +3 -0
- package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-border-color-should-match-snapshot-1-snap.png +3 -0
- package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-border-should-match-snapshot-1-snap.png +3 -0
- package/src/components/__tests__/visual-regression/__image_snapshots__/inline-snapshot-test-tsx-inline-alignment-example-should-match-snapshot-1-snap.png +3 -0
- package/src/components/__tests__/visual-regression/__image_snapshots__/inline-snapshot-test-tsx-inline-spacing-example-should-match-snapshot-1-snap.png +3 -0
- package/src/components/__tests__/visual-regression/__image_snapshots__/stack-snapshot-test-tsx-stack-alignment-example-should-match-snapshot-1-snap.png +3 -0
- package/src/components/__tests__/visual-regression/__image_snapshots__/stack-snapshot-test-tsx-stack-spacing-example-should-match-snapshot-1-snap.png +3 -0
- package/src/components/__tests__/visual-regression/__image_snapshots__/text-snapshot-test-tsx-text-example-with-font-sizes-should-match-snapshot-1-snap.png +3 -0
- package/src/components/__tests__/visual-regression/__image_snapshots__/text-snapshot-test-tsx-text-example-with-font-weights-should-match-snapshot-1-snap.png +3 -0
- package/src/components/__tests__/visual-regression/__image_snapshots__/text-snapshot-test-tsx-text-example-with-line-heights-should-match-snapshot-1-snap.png +3 -0
- package/src/components/__tests__/visual-regression/__image_snapshots__/text-snapshot-test-tsx-text-example-with-testing-should-match-snapshot-1-snap.png +3 -0
- package/src/components/__tests__/visual-regression/box-snapshot-test.tsx +33 -0
- package/src/components/__tests__/visual-regression/inline-snapshot-test.tsx +28 -0
- package/src/components/__tests__/visual-regression/stack-snapshot-test.tsx +28 -0
- package/src/components/__tests__/visual-regression/text-snapshot-test.tsx +31 -0
- package/src/components/box.partial.tsx +253 -116
- package/src/components/inline.partial.tsx +117 -0
- package/src/components/stack.partial.tsx +101 -0
- package/src/components/text.partial.tsx +109 -35
- package/src/components/types.tsx +15 -0
- package/src/constants.tsx +2 -0
- package/src/index.tsx +4 -1
- package/dist/cjs/components/inline.js +0 -45
- package/dist/cjs/components/stack.js +0 -33
- package/dist/es2019/components/inline.js +0 -31
- package/dist/es2019/components/stack.js +0 -22
- package/dist/esm/components/inline.js +0 -30
- package/dist/esm/components/stack.js +0 -21
- package/dist/types/components/inline.d.ts +0 -19
- package/dist/types/components/stack.d.ts +0 -16
- package/src/components/inline.tsx +0 -49
- package/src/components/stack.tsx +0 -30
|
@@ -1,100 +1,146 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { css, jsx } from '@emotion/core';
|
|
3
|
-
// These values are pulled from @atlaskit/theme
|
|
4
|
-
const fontSize = 14;
|
|
5
|
-
const fontSizeExtraSmall = 11;
|
|
6
|
-
const fontSizeSmall = 12;
|
|
7
3
|
const fontFamily = `-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif`;
|
|
8
4
|
const fontSizeMap = {
|
|
9
|
-
|
|
10
|
-
fontSize:
|
|
5
|
+
'11': css({
|
|
6
|
+
fontSize: '11px'
|
|
11
7
|
}),
|
|
12
|
-
|
|
13
|
-
fontSize:
|
|
8
|
+
'12': css({
|
|
9
|
+
fontSize: '12px'
|
|
14
10
|
}),
|
|
15
|
-
|
|
16
|
-
fontSize
|
|
11
|
+
'14': css({
|
|
12
|
+
fontSize: '14px'
|
|
17
13
|
})
|
|
18
14
|
};
|
|
15
|
+
// NOTE: can't use numbers as keys or Constellation won't build. Weird one.
|
|
19
16
|
const fontWeightMap = {
|
|
20
|
-
400: css({
|
|
17
|
+
'400': css({
|
|
21
18
|
fontWeight: 400
|
|
22
19
|
}),
|
|
23
|
-
500: css({
|
|
20
|
+
'500': css({
|
|
24
21
|
fontWeight: 500
|
|
25
22
|
})
|
|
26
23
|
};
|
|
24
|
+
const lineHeightMap = {
|
|
25
|
+
'12px': css({
|
|
26
|
+
lineHeight: '12px'
|
|
27
|
+
}),
|
|
28
|
+
'16px': css({
|
|
29
|
+
lineHeight: '16px'
|
|
30
|
+
}),
|
|
31
|
+
'20px': css({
|
|
32
|
+
lineHeight: '20px'
|
|
33
|
+
}),
|
|
34
|
+
'24px': css({
|
|
35
|
+
lineHeight: '24px'
|
|
36
|
+
}),
|
|
37
|
+
'28px': css({
|
|
38
|
+
lineHeight: '28px'
|
|
39
|
+
}),
|
|
40
|
+
'32px': css({
|
|
41
|
+
lineHeight: '32px'
|
|
42
|
+
}),
|
|
43
|
+
'40px': css({
|
|
44
|
+
lineHeight: '40px'
|
|
45
|
+
})
|
|
46
|
+
};
|
|
47
|
+
const textAlignMap = {
|
|
48
|
+
center: css({
|
|
49
|
+
textAlign: 'center'
|
|
50
|
+
}),
|
|
51
|
+
end: css({
|
|
52
|
+
textAlign: 'end'
|
|
53
|
+
}),
|
|
54
|
+
start: css({
|
|
55
|
+
textAlign: 'start'
|
|
56
|
+
})
|
|
57
|
+
};
|
|
27
58
|
const baseStyles = css({
|
|
28
59
|
fontFamily
|
|
29
60
|
});
|
|
30
61
|
/**
|
|
31
62
|
* __Text__
|
|
32
63
|
*
|
|
33
|
-
*
|
|
64
|
+
* Text is a primitive component that has the Atlassian Design System's design guidelines baked in.
|
|
65
|
+
* This includes considerations for text attributes such as color, font size, font weight, and line height.
|
|
66
|
+
* It renders a `span` by default.
|
|
34
67
|
*
|
|
35
68
|
* @internal
|
|
36
69
|
*/
|
|
37
70
|
|
|
38
|
-
|
|
71
|
+
const Text = ({
|
|
39
72
|
as: Component = 'span',
|
|
40
73
|
children,
|
|
41
|
-
color,
|
|
74
|
+
color: colorTuple,
|
|
42
75
|
fontSize,
|
|
43
|
-
fontWeight
|
|
44
|
-
|
|
76
|
+
fontWeight,
|
|
77
|
+
lineHeight,
|
|
78
|
+
textAlign,
|
|
79
|
+
href,
|
|
80
|
+
testId,
|
|
81
|
+
UNSAFE_style
|
|
82
|
+
}) => {
|
|
83
|
+
const [color, fallback] = colorTuple || [];
|
|
45
84
|
return jsx(Component, {
|
|
46
|
-
|
|
85
|
+
style: { ...UNSAFE_style,
|
|
86
|
+
...(fallback && {
|
|
87
|
+
'--ds-co-fb': fallback
|
|
88
|
+
})
|
|
89
|
+
},
|
|
90
|
+
css: [baseStyles, color && textColorMap[color], fontSize && fontSizeMap[fontSize], fontWeight && fontWeightMap[fontWeight], lineHeight && lineHeightMap[lineHeight], textAlign && textAlignMap[textAlign]],
|
|
91
|
+
href: href,
|
|
92
|
+
"data-testid": testId
|
|
47
93
|
}, children);
|
|
48
|
-
}
|
|
94
|
+
};
|
|
49
95
|
|
|
50
96
|
export default Text;
|
|
51
97
|
/**
|
|
52
98
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
53
|
-
* @codegen <<SignedSource::
|
|
99
|
+
* @codegen <<SignedSource::85a0a0bc073c7af8fd63101d6c88d59e>>
|
|
54
100
|
* @codegenId colors
|
|
55
101
|
* @codegenCommand yarn codegen-styles
|
|
56
102
|
* @codegenParams ["text"]
|
|
57
103
|
*/
|
|
58
104
|
|
|
59
105
|
const textColorMap = {
|
|
60
|
-
|
|
61
|
-
color: "var(--ds-text,
|
|
106
|
+
'color.text': css({
|
|
107
|
+
color: "var(--ds-text, var(--ds-co-fb))"
|
|
62
108
|
}),
|
|
63
109
|
subtle: css({
|
|
64
|
-
color: "var(--ds-text-subtle,
|
|
110
|
+
color: "var(--ds-text-subtle, var(--ds-co-fb))"
|
|
65
111
|
}),
|
|
66
112
|
subtlest: css({
|
|
67
|
-
color: "var(--ds-text-subtlest,
|
|
113
|
+
color: "var(--ds-text-subtlest, var(--ds-co-fb))"
|
|
68
114
|
}),
|
|
69
115
|
disabled: css({
|
|
70
|
-
color: "var(--ds-text-disabled,
|
|
116
|
+
color: "var(--ds-text-disabled, var(--ds-co-fb))"
|
|
71
117
|
}),
|
|
72
118
|
inverse: css({
|
|
73
|
-
color: "var(--ds-text-inverse,
|
|
119
|
+
color: "var(--ds-text-inverse, var(--ds-co-fb))"
|
|
74
120
|
}),
|
|
75
121
|
brand: css({
|
|
76
|
-
color: "var(--ds-text-brand,
|
|
122
|
+
color: "var(--ds-text-brand, var(--ds-co-fb))"
|
|
77
123
|
}),
|
|
78
124
|
selected: css({
|
|
79
|
-
color: "var(--ds-text-selected,
|
|
125
|
+
color: "var(--ds-text-selected, var(--ds-co-fb))"
|
|
80
126
|
}),
|
|
81
127
|
danger: css({
|
|
82
|
-
color: "var(--ds-text-danger,
|
|
128
|
+
color: "var(--ds-text-danger, var(--ds-co-fb))"
|
|
83
129
|
}),
|
|
84
130
|
warning: css({
|
|
85
|
-
color: "var(--ds-text-warning,
|
|
131
|
+
color: "var(--ds-text-warning, var(--ds-co-fb))"
|
|
86
132
|
}),
|
|
87
133
|
'warning.inverse': css({
|
|
88
|
-
color: "var(--ds-text-warning-inverse,
|
|
134
|
+
color: "var(--ds-text-warning-inverse, var(--ds-co-fb))"
|
|
89
135
|
}),
|
|
90
136
|
success: css({
|
|
91
|
-
color: "var(--ds-text-success,
|
|
137
|
+
color: "var(--ds-text-success, var(--ds-co-fb))"
|
|
92
138
|
}),
|
|
93
139
|
discovery: css({
|
|
94
|
-
color: "var(--ds-text-discovery,
|
|
140
|
+
color: "var(--ds-text-discovery, var(--ds-co-fb))"
|
|
95
141
|
}),
|
|
96
142
|
information: css({
|
|
97
|
-
color: "var(--ds-text-information,
|
|
143
|
+
color: "var(--ds-text-information, var(--ds-co-fb))"
|
|
98
144
|
})
|
|
99
145
|
};
|
|
100
146
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/es2019/constants.js
CHANGED
package/dist/es2019/index.js
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
export default
|
|
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';
|
package/dist/es2019/version.json
CHANGED