@atlaskit/ds-explorations 3.5.2 → 4.0.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 +8 -0
- package/dist/cjs/index.js +0 -7
- package/dist/es2019/index.js +0 -1
- package/dist/esm/index.js +0 -1
- package/dist/types/index.d.ts +0 -2
- package/dist/types-ts4.5/index.d.ts +0 -2
- package/examples/99-interactions.tsx +3 -6
- package/package.json +6 -8
- package/scripts/codegen-styles.tsx +3 -65
- package/src/components/__tests__/unit/interaction-suface.test.tsx +1 -2
- package/src/index.tsx +0 -2
- package/tsconfig.dev.json +0 -12
- package/dist/cjs/components/text.partial.js +0 -280
- package/dist/cjs/internal/spacing-scale.js +0 -15
- package/dist/es2019/components/text.partial.js +0 -271
- package/dist/es2019/internal/spacing-scale.js +0 -9
- package/dist/esm/components/text.partial.js +0 -274
- package/dist/esm/internal/spacing-scale.js +0 -9
- package/dist/types/components/text.partial.d.ts +0 -157
- package/dist/types/internal/spacing-scale.d.ts +0 -9
- package/dist/types-ts4.5/components/text.partial.d.ts +0 -162
- package/dist/types-ts4.5/internal/spacing-scale.d.ts +0 -24
- package/examples/02-text-advanced.tsx +0 -30
- package/examples/02-text.tsx +0 -110
- package/examples/06-section-message.tsx +0 -82
- package/examples/07-comment.tsx +0 -51
- package/examples/08-lozenge.tsx +0 -34
- package/scripts/spacing-codegen-template.tsx +0 -66
- package/scripts/spacing-scale-template.tsx +0 -24
- package/scripts/typography-codegen-template.tsx +0 -72
- package/src/components/__tests__/unit/text.test.tsx +0 -64
- package/src/components/__tests__/vr-tests/__snapshots__/text-snapshot-test/text--default.png +0 -0
- package/src/components/__tests__/vr-tests/text-snapshot-test.vr.tsx +0 -6
- package/src/components/text.partial.tsx +0 -375
- package/src/internal/spacing-scale.tsx +0 -24
- package/text/package.json +0 -15
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
import { createContext, Fragment, useContext } from 'react';
|
|
3
|
-
import { css, jsx } from '@emotion/react';
|
|
4
|
-
import invariant from 'tiny-invariant';
|
|
5
|
-
import surfaceColorMap from '../internal/color-map';
|
|
6
|
-
import { useSurface } from './surface-provider';
|
|
7
|
-
const asAllowlist = ['span', 'div', 'p', 'strong'];
|
|
8
|
-
const textAlignMap = {
|
|
9
|
-
center: css({
|
|
10
|
-
textAlign: 'center'
|
|
11
|
-
}),
|
|
12
|
-
end: css({
|
|
13
|
-
textAlign: 'end'
|
|
14
|
-
}),
|
|
15
|
-
start: css({
|
|
16
|
-
textAlign: 'start'
|
|
17
|
-
})
|
|
18
|
-
};
|
|
19
|
-
const textTransformMap = {
|
|
20
|
-
none: css({
|
|
21
|
-
textTransform: 'none'
|
|
22
|
-
}),
|
|
23
|
-
lowercase: css({
|
|
24
|
-
textTransform: 'lowercase'
|
|
25
|
-
}),
|
|
26
|
-
uppercase: css({
|
|
27
|
-
textTransform: 'uppercase'
|
|
28
|
-
})
|
|
29
|
-
};
|
|
30
|
-
const verticalAlignMap = {
|
|
31
|
-
top: css({
|
|
32
|
-
verticalAlign: 'top'
|
|
33
|
-
}),
|
|
34
|
-
middle: css({
|
|
35
|
-
verticalAlign: 'middle'
|
|
36
|
-
}),
|
|
37
|
-
bottom: css({
|
|
38
|
-
verticalAlign: 'bottom'
|
|
39
|
-
})
|
|
40
|
-
};
|
|
41
|
-
const baseStyles = css({
|
|
42
|
-
boxSizing: 'border-box',
|
|
43
|
-
margin: "var(--ds-space-0, 0px)",
|
|
44
|
-
padding: "var(--ds-space-0, 0px)"
|
|
45
|
-
});
|
|
46
|
-
const truncateStyles = css({
|
|
47
|
-
overflow: 'hidden',
|
|
48
|
-
textOverflow: 'ellipsis',
|
|
49
|
-
whiteSpace: 'nowrap'
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Custom hook designed to abstract the parsing of the color props and make it clearer in the future how color is reconciled between themes and tokens.
|
|
54
|
-
*/
|
|
55
|
-
const useColor = colorProp => {
|
|
56
|
-
const surface = useSurface();
|
|
57
|
-
const inverseTextColor = surfaceColorMap[surface];
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Where the color of the surface is inverted we override the user choice
|
|
61
|
-
* as there is no valid choice that is not covered by the override.
|
|
62
|
-
*/
|
|
63
|
-
const color = inverseTextColor !== null && inverseTextColor !== void 0 ? inverseTextColor : colorProp;
|
|
64
|
-
return color;
|
|
65
|
-
};
|
|
66
|
-
const HasTextAncestorContext = /*#__PURE__*/createContext(false);
|
|
67
|
-
const useHasTextAncestor = () => useContext(HasTextAncestorContext);
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* __Text__
|
|
71
|
-
*
|
|
72
|
-
* Text is a primitive component that has the Atlassian Design System's design guidelines baked in.
|
|
73
|
-
* This includes considerations for text attributes such as color, font size, font weight, and line height.
|
|
74
|
-
* It renders a `span` by default.
|
|
75
|
-
*
|
|
76
|
-
* @internal
|
|
77
|
-
*/
|
|
78
|
-
const Text = ({
|
|
79
|
-
children,
|
|
80
|
-
...props
|
|
81
|
-
}) => {
|
|
82
|
-
const {
|
|
83
|
-
as: Component = 'span',
|
|
84
|
-
color: colorProp,
|
|
85
|
-
fontSize,
|
|
86
|
-
fontWeight,
|
|
87
|
-
lineHeight,
|
|
88
|
-
shouldTruncate = false,
|
|
89
|
-
textAlign,
|
|
90
|
-
textTransform,
|
|
91
|
-
verticalAlign,
|
|
92
|
-
testId,
|
|
93
|
-
UNSAFE_style,
|
|
94
|
-
id
|
|
95
|
-
} = props;
|
|
96
|
-
invariant(asAllowlist.includes(Component), `@atlaskit/ds-explorations: Text received an invalid "as" value of "${Component}"`);
|
|
97
|
-
const color = useColor(colorProp);
|
|
98
|
-
const isWrapped = useHasTextAncestor();
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* If the text is already wrapped and applies no props we can just
|
|
102
|
-
* render the children directly as a fragment.
|
|
103
|
-
*/
|
|
104
|
-
if (isWrapped && Object.keys(props).length === 0) {
|
|
105
|
-
return jsx(Fragment, null, children);
|
|
106
|
-
}
|
|
107
|
-
const component = jsx(Component, {
|
|
108
|
-
style: UNSAFE_style,
|
|
109
|
-
css: [baseStyles, fontFamilyMap.sans, color && textColorMap[color], fontSize && fontSizeMap[fontSize], fontWeight && fontWeightMap[fontWeight], lineHeight && lineHeightMap[lineHeight], shouldTruncate && truncateStyles, textAlign && textAlignMap[textAlign], textTransform && textTransformMap[textTransform], verticalAlign && verticalAlignMap[verticalAlign]],
|
|
110
|
-
"data-testid": testId,
|
|
111
|
-
id: id
|
|
112
|
-
}, children);
|
|
113
|
-
return isWrapped ?
|
|
114
|
-
// no need to re-apply context if the text is already wrapped
|
|
115
|
-
component : jsx(HasTextAncestorContext.Provider, {
|
|
116
|
-
value: true
|
|
117
|
-
}, component);
|
|
118
|
-
};
|
|
119
|
-
export default Text;
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
123
|
-
* @codegen <<SignedSource::c5a6cec604462dc4b48aaf1160b83e59>>
|
|
124
|
-
* @codegenId typography
|
|
125
|
-
* @codegenCommand yarn codegen-styles
|
|
126
|
-
* @codegenParams ["fontSize", "fontWeight", "fontFamily", "lineHeight"]
|
|
127
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-typography-adg3.tsx <<SignedSource::bf3349cf2247aa44fbac47c953fc03b5>>
|
|
128
|
-
*/
|
|
129
|
-
const fontSizeMap = {
|
|
130
|
-
'size.050': css({
|
|
131
|
-
fontSize: "var(--ds-font-size-050, 11px)"
|
|
132
|
-
}),
|
|
133
|
-
'size.075': css({
|
|
134
|
-
fontSize: "var(--ds-font-size-075, 12px)"
|
|
135
|
-
}),
|
|
136
|
-
'size.100': css({
|
|
137
|
-
fontSize: "var(--ds-font-size-100, 14px)"
|
|
138
|
-
}),
|
|
139
|
-
'size.200': css({
|
|
140
|
-
fontSize: "var(--ds-font-size-200, 16px)"
|
|
141
|
-
}),
|
|
142
|
-
'size.300': css({
|
|
143
|
-
fontSize: "var(--ds-font-size-300, 20px)"
|
|
144
|
-
}),
|
|
145
|
-
'size.400': css({
|
|
146
|
-
fontSize: "var(--ds-font-size-400, 24px)"
|
|
147
|
-
}),
|
|
148
|
-
'size.500': css({
|
|
149
|
-
fontSize: "var(--ds-font-size-500, 29px)"
|
|
150
|
-
}),
|
|
151
|
-
'size.600': css({
|
|
152
|
-
fontSize: "var(--ds-font-size-600, 35px)"
|
|
153
|
-
})
|
|
154
|
-
};
|
|
155
|
-
const fontWeightMap = {
|
|
156
|
-
bold: css({
|
|
157
|
-
fontWeight: "var(--ds-font-weight-bold, 700)"
|
|
158
|
-
}),
|
|
159
|
-
medium: css({
|
|
160
|
-
fontWeight: "var(--ds-font-weight-medium, 500)"
|
|
161
|
-
}),
|
|
162
|
-
regular: css({
|
|
163
|
-
fontWeight: "var(--ds-font-weight-regular, 400)"
|
|
164
|
-
}),
|
|
165
|
-
semibold: css({
|
|
166
|
-
fontWeight: "var(--ds-font-weight-semibold, 600)"
|
|
167
|
-
})
|
|
168
|
-
};
|
|
169
|
-
const fontFamilyMap = {
|
|
170
|
-
body: css({
|
|
171
|
-
fontFamily: "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
172
|
-
}),
|
|
173
|
-
'brand.body': css({
|
|
174
|
-
fontFamily: "var(--ds-font-family-brand-body, \"Charlie Text\", ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
175
|
-
}),
|
|
176
|
-
'brand.heading': css({
|
|
177
|
-
fontFamily: "var(--ds-font-family-brand-heading, \"Charlie Display\", ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
178
|
-
}),
|
|
179
|
-
code: css({
|
|
180
|
-
fontFamily: "var(--ds-font-family-code, ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)"
|
|
181
|
-
}),
|
|
182
|
-
heading: css({
|
|
183
|
-
fontFamily: "var(--ds-font-family-heading, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
184
|
-
}),
|
|
185
|
-
monospace: css({
|
|
186
|
-
fontFamily: "var(--ds-font-family-monospace, ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)"
|
|
187
|
-
}),
|
|
188
|
-
sans: css({
|
|
189
|
-
fontFamily: "var(--ds-font-family-sans, -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\", \"Ubuntu\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", sans-serif)"
|
|
190
|
-
})
|
|
191
|
-
};
|
|
192
|
-
const lineHeightMap = {
|
|
193
|
-
'lineHeight.1': css({
|
|
194
|
-
lineHeight: "var(--ds-font-lineHeight-1, 1)"
|
|
195
|
-
}),
|
|
196
|
-
'lineHeight.100': css({
|
|
197
|
-
lineHeight: "var(--ds-font-lineHeight-100, 16px)"
|
|
198
|
-
}),
|
|
199
|
-
'lineHeight.200': css({
|
|
200
|
-
lineHeight: "var(--ds-font-lineHeight-200, 20px)"
|
|
201
|
-
}),
|
|
202
|
-
'lineHeight.300': css({
|
|
203
|
-
lineHeight: "var(--ds-font-lineHeight-300, 24px)"
|
|
204
|
-
}),
|
|
205
|
-
'lineHeight.400': css({
|
|
206
|
-
lineHeight: "var(--ds-font-lineHeight-400, 28px)"
|
|
207
|
-
}),
|
|
208
|
-
'lineHeight.500': css({
|
|
209
|
-
lineHeight: "var(--ds-font-lineHeight-500, 32px)"
|
|
210
|
-
}),
|
|
211
|
-
'lineHeight.600': css({
|
|
212
|
-
lineHeight: "var(--ds-font-lineHeight-600, 40px)"
|
|
213
|
-
})
|
|
214
|
-
};
|
|
215
|
-
/**
|
|
216
|
-
* @codegenEnd
|
|
217
|
-
*/
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
221
|
-
* @codegen <<SignedSource::db9171c09481d187d83bb01192c16c41>>
|
|
222
|
-
* @codegenId colors
|
|
223
|
-
* @codegenCommand yarn codegen-styles
|
|
224
|
-
* @codegenParams ["text"]
|
|
225
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f27d1519d51cc4a85383a00907847774>>
|
|
226
|
-
*/
|
|
227
|
-
const textColorMap = {
|
|
228
|
-
'color.text': css({
|
|
229
|
-
color: "var(--ds-text, #172B4D)"
|
|
230
|
-
}),
|
|
231
|
-
disabled: css({
|
|
232
|
-
color: "var(--ds-text-disabled, #A5ADBA)"
|
|
233
|
-
}),
|
|
234
|
-
inverse: css({
|
|
235
|
-
color: "var(--ds-text-inverse, #FFFFFF)"
|
|
236
|
-
}),
|
|
237
|
-
selected: css({
|
|
238
|
-
color: "var(--ds-text-selected, #0052CC)"
|
|
239
|
-
}),
|
|
240
|
-
brand: css({
|
|
241
|
-
color: "var(--ds-text-brand, #0065FF)"
|
|
242
|
-
}),
|
|
243
|
-
danger: css({
|
|
244
|
-
color: "var(--ds-text-danger, #DE350B)"
|
|
245
|
-
}),
|
|
246
|
-
warning: css({
|
|
247
|
-
color: "var(--ds-text-warning, #974F0C)"
|
|
248
|
-
}),
|
|
249
|
-
'warning.inverse': css({
|
|
250
|
-
color: "var(--ds-text-warning-inverse, #172B4D)"
|
|
251
|
-
}),
|
|
252
|
-
success: css({
|
|
253
|
-
color: "var(--ds-text-success, #006644)"
|
|
254
|
-
}),
|
|
255
|
-
discovery: css({
|
|
256
|
-
color: "var(--ds-text-discovery, #403294)"
|
|
257
|
-
}),
|
|
258
|
-
information: css({
|
|
259
|
-
color: "var(--ds-text-information, #0052CC)"
|
|
260
|
-
}),
|
|
261
|
-
subtlest: css({
|
|
262
|
-
color: "var(--ds-text-subtlest, #7A869A)"
|
|
263
|
-
}),
|
|
264
|
-
subtle: css({
|
|
265
|
-
color: "var(--ds-text-subtle, #42526E)"
|
|
266
|
-
})
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* @codegenEnd
|
|
271
|
-
*/
|
|
@@ -1,9 +0,0 @@
|
|
|
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::33634cd9767c59b9aaaf64fc6f44f852>>
|
|
7
|
-
* @codegenCommand yarn codegen-styles
|
|
8
|
-
*/
|
|
9
|
-
export const spacingScale = ['space.0', 'space.025', 'space.050', 'space.075', 'space.100', 'space.150', 'space.200', 'space.250', 'space.300', 'space.400', 'space.500', 'space.600', 'space.800', 'space.1000'];
|
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
-
var _excluded = ["children"];
|
|
3
|
-
/** @jsx jsx */
|
|
4
|
-
import { createContext, Fragment, useContext } from 'react';
|
|
5
|
-
import { css, jsx } from '@emotion/react';
|
|
6
|
-
import invariant from 'tiny-invariant';
|
|
7
|
-
import surfaceColorMap from '../internal/color-map';
|
|
8
|
-
import { useSurface } from './surface-provider';
|
|
9
|
-
var asAllowlist = ['span', 'div', 'p', 'strong'];
|
|
10
|
-
var textAlignMap = {
|
|
11
|
-
center: css({
|
|
12
|
-
textAlign: 'center'
|
|
13
|
-
}),
|
|
14
|
-
end: css({
|
|
15
|
-
textAlign: 'end'
|
|
16
|
-
}),
|
|
17
|
-
start: css({
|
|
18
|
-
textAlign: 'start'
|
|
19
|
-
})
|
|
20
|
-
};
|
|
21
|
-
var textTransformMap = {
|
|
22
|
-
none: css({
|
|
23
|
-
textTransform: 'none'
|
|
24
|
-
}),
|
|
25
|
-
lowercase: css({
|
|
26
|
-
textTransform: 'lowercase'
|
|
27
|
-
}),
|
|
28
|
-
uppercase: css({
|
|
29
|
-
textTransform: 'uppercase'
|
|
30
|
-
})
|
|
31
|
-
};
|
|
32
|
-
var verticalAlignMap = {
|
|
33
|
-
top: css({
|
|
34
|
-
verticalAlign: 'top'
|
|
35
|
-
}),
|
|
36
|
-
middle: css({
|
|
37
|
-
verticalAlign: 'middle'
|
|
38
|
-
}),
|
|
39
|
-
bottom: css({
|
|
40
|
-
verticalAlign: 'bottom'
|
|
41
|
-
})
|
|
42
|
-
};
|
|
43
|
-
var baseStyles = css({
|
|
44
|
-
boxSizing: 'border-box',
|
|
45
|
-
margin: "var(--ds-space-0, 0px)",
|
|
46
|
-
padding: "var(--ds-space-0, 0px)"
|
|
47
|
-
});
|
|
48
|
-
var truncateStyles = css({
|
|
49
|
-
overflow: 'hidden',
|
|
50
|
-
textOverflow: 'ellipsis',
|
|
51
|
-
whiteSpace: 'nowrap'
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Custom hook designed to abstract the parsing of the color props and make it clearer in the future how color is reconciled between themes and tokens.
|
|
56
|
-
*/
|
|
57
|
-
var useColor = function useColor(colorProp) {
|
|
58
|
-
var surface = useSurface();
|
|
59
|
-
var inverseTextColor = surfaceColorMap[surface];
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Where the color of the surface is inverted we override the user choice
|
|
63
|
-
* as there is no valid choice that is not covered by the override.
|
|
64
|
-
*/
|
|
65
|
-
var color = inverseTextColor !== null && inverseTextColor !== void 0 ? inverseTextColor : colorProp;
|
|
66
|
-
return color;
|
|
67
|
-
};
|
|
68
|
-
var HasTextAncestorContext = /*#__PURE__*/createContext(false);
|
|
69
|
-
var useHasTextAncestor = function useHasTextAncestor() {
|
|
70
|
-
return useContext(HasTextAncestorContext);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* __Text__
|
|
75
|
-
*
|
|
76
|
-
* Text is a primitive component that has the Atlassian Design System's design guidelines baked in.
|
|
77
|
-
* This includes considerations for text attributes such as color, font size, font weight, and line height.
|
|
78
|
-
* It renders a `span` by default.
|
|
79
|
-
*
|
|
80
|
-
* @internal
|
|
81
|
-
*/
|
|
82
|
-
var Text = function Text(_ref) {
|
|
83
|
-
var children = _ref.children,
|
|
84
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
85
|
-
var _props$as = props.as,
|
|
86
|
-
Component = _props$as === void 0 ? 'span' : _props$as,
|
|
87
|
-
colorProp = props.color,
|
|
88
|
-
fontSize = props.fontSize,
|
|
89
|
-
fontWeight = props.fontWeight,
|
|
90
|
-
lineHeight = props.lineHeight,
|
|
91
|
-
_props$shouldTruncate = props.shouldTruncate,
|
|
92
|
-
shouldTruncate = _props$shouldTruncate === void 0 ? false : _props$shouldTruncate,
|
|
93
|
-
textAlign = props.textAlign,
|
|
94
|
-
textTransform = props.textTransform,
|
|
95
|
-
verticalAlign = props.verticalAlign,
|
|
96
|
-
testId = props.testId,
|
|
97
|
-
UNSAFE_style = props.UNSAFE_style,
|
|
98
|
-
id = props.id;
|
|
99
|
-
invariant(asAllowlist.includes(Component), "@atlaskit/ds-explorations: Text received an invalid \"as\" value of \"".concat(Component, "\""));
|
|
100
|
-
var color = useColor(colorProp);
|
|
101
|
-
var isWrapped = useHasTextAncestor();
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* If the text is already wrapped and applies no props we can just
|
|
105
|
-
* render the children directly as a fragment.
|
|
106
|
-
*/
|
|
107
|
-
if (isWrapped && Object.keys(props).length === 0) {
|
|
108
|
-
return jsx(Fragment, null, children);
|
|
109
|
-
}
|
|
110
|
-
var component = jsx(Component, {
|
|
111
|
-
style: UNSAFE_style,
|
|
112
|
-
css: [baseStyles, fontFamilyMap.sans, color && textColorMap[color], fontSize && fontSizeMap[fontSize], fontWeight && fontWeightMap[fontWeight], lineHeight && lineHeightMap[lineHeight], shouldTruncate && truncateStyles, textAlign && textAlignMap[textAlign], textTransform && textTransformMap[textTransform], verticalAlign && verticalAlignMap[verticalAlign]],
|
|
113
|
-
"data-testid": testId,
|
|
114
|
-
id: id
|
|
115
|
-
}, children);
|
|
116
|
-
return isWrapped ?
|
|
117
|
-
// no need to re-apply context if the text is already wrapped
|
|
118
|
-
component : jsx(HasTextAncestorContext.Provider, {
|
|
119
|
-
value: true
|
|
120
|
-
}, component);
|
|
121
|
-
};
|
|
122
|
-
export default Text;
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
126
|
-
* @codegen <<SignedSource::c5a6cec604462dc4b48aaf1160b83e59>>
|
|
127
|
-
* @codegenId typography
|
|
128
|
-
* @codegenCommand yarn codegen-styles
|
|
129
|
-
* @codegenParams ["fontSize", "fontWeight", "fontFamily", "lineHeight"]
|
|
130
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-typography-adg3.tsx <<SignedSource::bf3349cf2247aa44fbac47c953fc03b5>>
|
|
131
|
-
*/
|
|
132
|
-
var fontSizeMap = {
|
|
133
|
-
'size.050': css({
|
|
134
|
-
fontSize: "var(--ds-font-size-050, 11px)"
|
|
135
|
-
}),
|
|
136
|
-
'size.075': css({
|
|
137
|
-
fontSize: "var(--ds-font-size-075, 12px)"
|
|
138
|
-
}),
|
|
139
|
-
'size.100': css({
|
|
140
|
-
fontSize: "var(--ds-font-size-100, 14px)"
|
|
141
|
-
}),
|
|
142
|
-
'size.200': css({
|
|
143
|
-
fontSize: "var(--ds-font-size-200, 16px)"
|
|
144
|
-
}),
|
|
145
|
-
'size.300': css({
|
|
146
|
-
fontSize: "var(--ds-font-size-300, 20px)"
|
|
147
|
-
}),
|
|
148
|
-
'size.400': css({
|
|
149
|
-
fontSize: "var(--ds-font-size-400, 24px)"
|
|
150
|
-
}),
|
|
151
|
-
'size.500': css({
|
|
152
|
-
fontSize: "var(--ds-font-size-500, 29px)"
|
|
153
|
-
}),
|
|
154
|
-
'size.600': css({
|
|
155
|
-
fontSize: "var(--ds-font-size-600, 35px)"
|
|
156
|
-
})
|
|
157
|
-
};
|
|
158
|
-
var fontWeightMap = {
|
|
159
|
-
bold: css({
|
|
160
|
-
fontWeight: "var(--ds-font-weight-bold, 700)"
|
|
161
|
-
}),
|
|
162
|
-
medium: css({
|
|
163
|
-
fontWeight: "var(--ds-font-weight-medium, 500)"
|
|
164
|
-
}),
|
|
165
|
-
regular: css({
|
|
166
|
-
fontWeight: "var(--ds-font-weight-regular, 400)"
|
|
167
|
-
}),
|
|
168
|
-
semibold: css({
|
|
169
|
-
fontWeight: "var(--ds-font-weight-semibold, 600)"
|
|
170
|
-
})
|
|
171
|
-
};
|
|
172
|
-
var fontFamilyMap = {
|
|
173
|
-
body: css({
|
|
174
|
-
fontFamily: "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
175
|
-
}),
|
|
176
|
-
'brand.body': css({
|
|
177
|
-
fontFamily: "var(--ds-font-family-brand-body, \"Charlie Text\", ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
178
|
-
}),
|
|
179
|
-
'brand.heading': css({
|
|
180
|
-
fontFamily: "var(--ds-font-family-brand-heading, \"Charlie Display\", ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
181
|
-
}),
|
|
182
|
-
code: css({
|
|
183
|
-
fontFamily: "var(--ds-font-family-code, ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)"
|
|
184
|
-
}),
|
|
185
|
-
heading: css({
|
|
186
|
-
fontFamily: "var(--ds-font-family-heading, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
187
|
-
}),
|
|
188
|
-
monospace: css({
|
|
189
|
-
fontFamily: "var(--ds-font-family-monospace, ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)"
|
|
190
|
-
}),
|
|
191
|
-
sans: css({
|
|
192
|
-
fontFamily: "var(--ds-font-family-sans, -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\", \"Ubuntu\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", sans-serif)"
|
|
193
|
-
})
|
|
194
|
-
};
|
|
195
|
-
var lineHeightMap = {
|
|
196
|
-
'lineHeight.1': css({
|
|
197
|
-
lineHeight: "var(--ds-font-lineHeight-1, 1)"
|
|
198
|
-
}),
|
|
199
|
-
'lineHeight.100': css({
|
|
200
|
-
lineHeight: "var(--ds-font-lineHeight-100, 16px)"
|
|
201
|
-
}),
|
|
202
|
-
'lineHeight.200': css({
|
|
203
|
-
lineHeight: "var(--ds-font-lineHeight-200, 20px)"
|
|
204
|
-
}),
|
|
205
|
-
'lineHeight.300': css({
|
|
206
|
-
lineHeight: "var(--ds-font-lineHeight-300, 24px)"
|
|
207
|
-
}),
|
|
208
|
-
'lineHeight.400': css({
|
|
209
|
-
lineHeight: "var(--ds-font-lineHeight-400, 28px)"
|
|
210
|
-
}),
|
|
211
|
-
'lineHeight.500': css({
|
|
212
|
-
lineHeight: "var(--ds-font-lineHeight-500, 32px)"
|
|
213
|
-
}),
|
|
214
|
-
'lineHeight.600': css({
|
|
215
|
-
lineHeight: "var(--ds-font-lineHeight-600, 40px)"
|
|
216
|
-
})
|
|
217
|
-
};
|
|
218
|
-
/**
|
|
219
|
-
* @codegenEnd
|
|
220
|
-
*/
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
224
|
-
* @codegen <<SignedSource::db9171c09481d187d83bb01192c16c41>>
|
|
225
|
-
* @codegenId colors
|
|
226
|
-
* @codegenCommand yarn codegen-styles
|
|
227
|
-
* @codegenParams ["text"]
|
|
228
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f27d1519d51cc4a85383a00907847774>>
|
|
229
|
-
*/
|
|
230
|
-
var textColorMap = {
|
|
231
|
-
'color.text': css({
|
|
232
|
-
color: "var(--ds-text, #172B4D)"
|
|
233
|
-
}),
|
|
234
|
-
disabled: css({
|
|
235
|
-
color: "var(--ds-text-disabled, #A5ADBA)"
|
|
236
|
-
}),
|
|
237
|
-
inverse: css({
|
|
238
|
-
color: "var(--ds-text-inverse, #FFFFFF)"
|
|
239
|
-
}),
|
|
240
|
-
selected: css({
|
|
241
|
-
color: "var(--ds-text-selected, #0052CC)"
|
|
242
|
-
}),
|
|
243
|
-
brand: css({
|
|
244
|
-
color: "var(--ds-text-brand, #0065FF)"
|
|
245
|
-
}),
|
|
246
|
-
danger: css({
|
|
247
|
-
color: "var(--ds-text-danger, #DE350B)"
|
|
248
|
-
}),
|
|
249
|
-
warning: css({
|
|
250
|
-
color: "var(--ds-text-warning, #974F0C)"
|
|
251
|
-
}),
|
|
252
|
-
'warning.inverse': css({
|
|
253
|
-
color: "var(--ds-text-warning-inverse, #172B4D)"
|
|
254
|
-
}),
|
|
255
|
-
success: css({
|
|
256
|
-
color: "var(--ds-text-success, #006644)"
|
|
257
|
-
}),
|
|
258
|
-
discovery: css({
|
|
259
|
-
color: "var(--ds-text-discovery, #403294)"
|
|
260
|
-
}),
|
|
261
|
-
information: css({
|
|
262
|
-
color: "var(--ds-text-information, #0052CC)"
|
|
263
|
-
}),
|
|
264
|
-
subtlest: css({
|
|
265
|
-
color: "var(--ds-text-subtlest, #7A869A)"
|
|
266
|
-
}),
|
|
267
|
-
subtle: css({
|
|
268
|
-
color: "var(--ds-text-subtle, #42526E)"
|
|
269
|
-
})
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* @codegenEnd
|
|
274
|
-
*/
|
|
@@ -1,9 +0,0 @@
|
|
|
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::33634cd9767c59b9aaaf64fc6f44f852>>
|
|
7
|
-
* @codegenCommand yarn codegen-styles
|
|
8
|
-
*/
|
|
9
|
-
export var spacingScale = ['space.0', 'space.025', 'space.050', 'space.075', 'space.100', 'space.150', 'space.200', 'space.250', 'space.300', 'space.400', 'space.500', 'space.600', 'space.800', 'space.1000'];
|