@atlaskit/ds-explorations 0.1.5 → 1.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 +22 -0
- package/box/package.json +15 -0
- package/dist/cjs/components/box.partial.js +182 -205
- package/dist/cjs/components/inline.partial.js +28 -34
- package/dist/cjs/components/interaction-surface.partial.js +32 -1
- package/dist/cjs/components/stack.partial.js +28 -36
- package/dist/cjs/components/text.partial.js +114 -85
- package/dist/cjs/index.js +1 -9
- package/dist/cjs/internal/color-map.js +6 -5
- package/dist/cjs/internal/spacing-scale.js +17 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/box.partial.js +181 -189
- package/dist/es2019/components/inline.partial.js +27 -28
- package/dist/es2019/components/interaction-surface.partial.js +32 -1
- package/dist/es2019/components/stack.partial.js +27 -28
- package/dist/es2019/components/text.partial.js +71 -35
- package/dist/es2019/index.js +1 -2
- package/dist/es2019/internal/color-map.js +4 -3
- package/dist/es2019/internal/spacing-scale.js +9 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/box.partial.js +181 -201
- package/dist/esm/components/inline.partial.js +27 -33
- package/dist/esm/components/interaction-surface.partial.js +32 -1
- package/dist/esm/components/stack.partial.js +27 -33
- package/dist/esm/components/text.partial.js +76 -46
- package/dist/esm/index.js +1 -2
- package/dist/esm/internal/color-map.js +4 -3
- package/dist/esm/internal/spacing-scale.js +9 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/components/box.partial.d.ts +109 -21
- package/dist/types/components/inline.partial.d.ts +25 -3
- package/dist/types/components/interaction-surface.partial.d.ts +3 -0
- package/dist/types/components/stack.partial.d.ts +24 -2
- package/dist/types/components/text.partial.d.ts +5 -3
- package/dist/types/index.d.ts +0 -1
- package/dist/types/internal/color-map.d.ts +11 -9
- package/dist/types/internal/spacing-scale.d.ts +9 -0
- package/dist/types-ts4.0/components/box.partial.d.ts +109 -27
- package/dist/types-ts4.0/components/inline.partial.d.ts +25 -3
- package/dist/types-ts4.0/components/interaction-surface.partial.d.ts +3 -0
- package/dist/types-ts4.0/components/stack.partial.d.ts +24 -2
- package/dist/types-ts4.0/components/text.partial.d.ts +5 -6
- package/dist/types-ts4.0/index.d.ts +0 -1
- package/dist/types-ts4.0/internal/color-map.d.ts +11 -9
- package/dist/types-ts4.0/internal/spacing-scale.d.ts +22 -0
- package/examples/00-basic.tsx +4 -4
- package/examples/01-box.tsx +29 -46
- package/examples/02-text-advanced.tsx +38 -0
- package/examples/02-text.tsx +72 -62
- package/examples/03-stack.tsx +36 -75
- package/examples/04-inline.tsx +34 -76
- package/examples/05-badge.tsx +2 -2
- package/examples/06-section-message.tsx +7 -7
- package/examples/07-comment.tsx +4 -6
- package/examples/08-lozenge.tsx +9 -5
- package/examples/99-interactions.tsx +20 -20
- package/examples/config.jsonc +11 -0
- package/package.json +5 -2
- package/report.api.md +187 -48
- package/scripts/__tests__/__snapshots__/codegen.test.tsx.snap +52 -64
- package/scripts/codegen-styles.tsx +34 -6
- package/scripts/color-codegen-template.tsx +10 -15
- package/scripts/color-map-template.tsx +1 -1
- package/scripts/spacing-codegen-template.tsx +42 -12
- package/scripts/spacing-scale-template.tsx +40 -0
- package/scripts/utils.tsx +1 -3
- package/src/components/__tests__/unit/box.test.tsx +8 -11
- package/src/components/__tests__/unit/inline.test.tsx +3 -3
- package/src/components/__tests__/unit/interaction-suface.test.tsx +1 -1
- package/src/components/__tests__/unit/stack.test.tsx +2 -2
- package/src/components/__tests__/unit/text.test.tsx +23 -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 +2 -2
- 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 +2 -2
- package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-background-and-padding-should-match-snapshot-1-snap.png +2 -2
- package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-background-color-should-match-snapshot-1-snap.png +2 -2
- package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-border-color-should-match-snapshot-1-snap.png +2 -2
- package/src/components/__tests__/visual-regression/__image_snapshots__/inline-snapshot-test-tsx-inline-alignment-example-should-match-snapshot-1-snap.png +2 -2
- package/src/components/__tests__/visual-regression/__image_snapshots__/inline-snapshot-test-tsx-inline-spacing-example-should-match-snapshot-1-snap.png +2 -2
- package/src/components/__tests__/visual-regression/__image_snapshots__/stack-snapshot-test-tsx-stack-alignment-example-should-match-snapshot-1-snap.png +2 -2
- package/src/components/__tests__/visual-regression/__image_snapshots__/stack-snapshot-test-tsx-stack-spacing-example-should-match-snapshot-1-snap.png +2 -2
- package/src/components/__tests__/visual-regression/__image_snapshots__/text-snapshot-test-tsx-text-example-with-line-heights-should-match-snapshot-1-snap.png +2 -2
- package/src/components/__tests__/visual-regression/__image_snapshots__/text-snapshot-test-tsx-text-example-with-testing-should-match-snapshot-1-snap.png +2 -2
- package/src/components/box.partial.tsx +293 -160
- package/src/components/inline.partial.tsx +44 -17
- package/src/components/interaction-surface.partial.tsx +2 -1
- package/src/components/stack.partial.tsx +43 -16
- package/src/components/text.partial.tsx +76 -41
- package/src/index.tsx +0 -1
- package/src/internal/color-map.tsx +4 -3
- package/src/internal/spacing-scale.tsx +22 -0
- package/text/package.json +15 -0
- package/tmp/api-report-tmp.d.ts +176 -43
- package/dist/cjs/constants.js +0 -21
- package/dist/es2019/constants.js +0 -14
- package/dist/esm/constants.js +0 -14
- package/dist/types/constants.d.ts +0 -15
- package/dist/types-ts4.0/constants.d.ts +0 -15
- package/src/constants.tsx +0 -16
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { Children, forwardRef, Fragment } from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
|
-
import { SPACING_SCALE } from '../constants';
|
|
5
4
|
import Text from './text.partial';
|
|
6
5
|
const flexAlignItemsMap = {
|
|
7
6
|
center: css({
|
|
@@ -70,8 +69,7 @@ const Inline = /*#__PURE__*/forwardRef(({
|
|
|
70
69
|
}, ref) => {
|
|
71
70
|
const dividerComponent = typeof divider === 'string' ? jsx(Text, null, divider) : divider;
|
|
72
71
|
return jsx("div", {
|
|
73
|
-
style:
|
|
74
|
-
},
|
|
72
|
+
style: UNSAFE_style,
|
|
75
73
|
css: [baseStyles, gap && columnGapMap[gap], alignItems && flexAlignItemsMap[alignItems], justifyContent && flexJustifyContentMap[justifyContent], flexWrap && flexWrapMap[flexWrap]],
|
|
76
74
|
"data-testid": testId,
|
|
77
75
|
ref: ref
|
|
@@ -83,48 +81,49 @@ Inline.displayName = 'Inline';
|
|
|
83
81
|
export default Inline;
|
|
84
82
|
/**
|
|
85
83
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
86
|
-
* @codegen <<SignedSource::
|
|
84
|
+
* @codegen <<SignedSource::cff5655983f2243060cade5b107d7762>>
|
|
87
85
|
* @codegenId spacing
|
|
88
86
|
* @codegenCommand yarn codegen-styles
|
|
89
87
|
* @codegenParams ["columnGap"]
|
|
88
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::0c1fe9904b2ff2465a532b97ab76491e>>
|
|
90
89
|
*/
|
|
91
90
|
|
|
92
91
|
const columnGapMap = {
|
|
93
|
-
'
|
|
94
|
-
columnGap:
|
|
92
|
+
'scale.0': css({
|
|
93
|
+
columnGap: "var(--ds-scale-0, 0px)"
|
|
95
94
|
}),
|
|
96
|
-
'
|
|
97
|
-
columnGap:
|
|
95
|
+
'scale.025': css({
|
|
96
|
+
columnGap: "var(--ds-scale-025, 2px)"
|
|
98
97
|
}),
|
|
99
|
-
'
|
|
100
|
-
columnGap:
|
|
98
|
+
'scale.050': css({
|
|
99
|
+
columnGap: "var(--ds-scale-050, 4px)"
|
|
101
100
|
}),
|
|
102
|
-
'
|
|
103
|
-
columnGap:
|
|
101
|
+
'scale.075': css({
|
|
102
|
+
columnGap: "var(--ds-scale-075, 6px)"
|
|
104
103
|
}),
|
|
105
|
-
'
|
|
106
|
-
columnGap:
|
|
104
|
+
'scale.100': css({
|
|
105
|
+
columnGap: "var(--ds-scale-100, 8px)"
|
|
107
106
|
}),
|
|
108
|
-
'
|
|
109
|
-
columnGap:
|
|
107
|
+
'scale.150': css({
|
|
108
|
+
columnGap: "var(--ds-scale-150, 12px)"
|
|
110
109
|
}),
|
|
111
|
-
'
|
|
112
|
-
columnGap:
|
|
110
|
+
'scale.200': css({
|
|
111
|
+
columnGap: "var(--ds-scale-200, 16px)"
|
|
113
112
|
}),
|
|
114
|
-
'
|
|
115
|
-
columnGap:
|
|
113
|
+
'scale.250': css({
|
|
114
|
+
columnGap: "var(--ds-scale-250, 20px)"
|
|
116
115
|
}),
|
|
117
|
-
'
|
|
118
|
-
columnGap:
|
|
116
|
+
'scale.300': css({
|
|
117
|
+
columnGap: "var(--ds-scale-300, 24px)"
|
|
119
118
|
}),
|
|
120
|
-
'
|
|
121
|
-
columnGap:
|
|
119
|
+
'scale.400': css({
|
|
120
|
+
columnGap: "var(--ds-scale-400, 32px)"
|
|
122
121
|
}),
|
|
123
|
-
'
|
|
124
|
-
columnGap:
|
|
122
|
+
'scale.500': css({
|
|
123
|
+
columnGap: "var(--ds-scale-500, 40px)"
|
|
125
124
|
}),
|
|
126
|
-
'
|
|
127
|
-
columnGap:
|
|
125
|
+
'scale.600': css({
|
|
126
|
+
columnGap: "var(--ds-scale-600, 48px)"
|
|
128
127
|
})
|
|
129
128
|
};
|
|
130
129
|
/**
|
|
@@ -49,10 +49,11 @@ const InteractionSurface = ({
|
|
|
49
49
|
export default InteractionSurface;
|
|
50
50
|
/**
|
|
51
51
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
52
|
-
* @codegen <<SignedSource::
|
|
52
|
+
* @codegen <<SignedSource::1bad97ad2c03ae813521797686ac780d>>
|
|
53
53
|
* @codegenId interactions
|
|
54
54
|
* @codegenCommand yarn codegen-styles
|
|
55
55
|
* @codegenParams ["background"]
|
|
56
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::0c1fe9904b2ff2465a532b97ab76491e>>
|
|
56
57
|
*/
|
|
57
58
|
|
|
58
59
|
const backgroundActiveColorMap = {
|
|
@@ -145,6 +146,21 @@ const backgroundActiveColorMap = {
|
|
|
145
146
|
':active': {
|
|
146
147
|
backgroundColor: "var(--ds-background-information-bold-pressed, #09326C)"
|
|
147
148
|
}
|
|
149
|
+
}),
|
|
150
|
+
'elevation.surface': css({
|
|
151
|
+
':active': {
|
|
152
|
+
backgroundColor: "var(--ds-surface-pressed, #DCDFE4)"
|
|
153
|
+
}
|
|
154
|
+
}),
|
|
155
|
+
'elevation.surface.raised': css({
|
|
156
|
+
':active': {
|
|
157
|
+
backgroundColor: "var(--ds-surface-raised-pressed, #DCDFE4)"
|
|
158
|
+
}
|
|
159
|
+
}),
|
|
160
|
+
'elevation.surface.overlay': css({
|
|
161
|
+
':active': {
|
|
162
|
+
backgroundColor: "var(--ds-surface-overlay-pressed, #DCDFE4)"
|
|
163
|
+
}
|
|
148
164
|
})
|
|
149
165
|
};
|
|
150
166
|
const backgroundHoverColorMap = {
|
|
@@ -237,6 +253,21 @@ const backgroundHoverColorMap = {
|
|
|
237
253
|
':hover': {
|
|
238
254
|
backgroundColor: "var(--ds-background-information-bold-hovered, #0055CC)"
|
|
239
255
|
}
|
|
256
|
+
}),
|
|
257
|
+
'elevation.surface': css({
|
|
258
|
+
':hover': {
|
|
259
|
+
backgroundColor: "var(--ds-surface-hovered, #F1F2F4)"
|
|
260
|
+
}
|
|
261
|
+
}),
|
|
262
|
+
'elevation.surface.raised': css({
|
|
263
|
+
':hover': {
|
|
264
|
+
backgroundColor: "var(--ds-surface-raised-hovered, #F1F2F4)"
|
|
265
|
+
}
|
|
266
|
+
}),
|
|
267
|
+
'elevation.surface.overlay': css({
|
|
268
|
+
':hover': {
|
|
269
|
+
backgroundColor: "var(--ds-surface-overlay-hovered, #F1F2F4)"
|
|
270
|
+
}
|
|
240
271
|
})
|
|
241
272
|
};
|
|
242
273
|
/**
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
|
-
import { SPACING_SCALE } from '../constants';
|
|
5
4
|
const flexAlignItemsMap = {
|
|
6
5
|
center: css({
|
|
7
6
|
alignItems: 'center'
|
|
@@ -67,8 +66,7 @@ const Stack = /*#__PURE__*/forwardRef(({
|
|
|
67
66
|
testId
|
|
68
67
|
}, ref) => {
|
|
69
68
|
return jsx("div", {
|
|
70
|
-
style:
|
|
71
|
-
},
|
|
69
|
+
style: UNSAFE_style,
|
|
72
70
|
css: [baseStyles, gap && rowGapMap[gap], alignItems && flexAlignItemsMap[alignItems], justifyContent && flexJustifyContentMap[justifyContent], flexWrap && flexWrapMap[flexWrap]],
|
|
73
71
|
"data-testid": testId,
|
|
74
72
|
ref: ref
|
|
@@ -78,48 +76,49 @@ Stack.displayName = 'Stack';
|
|
|
78
76
|
export default Stack;
|
|
79
77
|
/**
|
|
80
78
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
81
|
-
* @codegen <<SignedSource::
|
|
79
|
+
* @codegen <<SignedSource::c486b14097494305925c3c989823d602>>
|
|
82
80
|
* @codegenId spacing
|
|
83
81
|
* @codegenCommand yarn codegen-styles
|
|
84
82
|
* @codegenParams ["rowGap"]
|
|
83
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::0c1fe9904b2ff2465a532b97ab76491e>>
|
|
85
84
|
*/
|
|
86
85
|
|
|
87
86
|
const rowGapMap = {
|
|
88
|
-
'
|
|
89
|
-
rowGap:
|
|
87
|
+
'scale.0': css({
|
|
88
|
+
rowGap: "var(--ds-scale-0, 0px)"
|
|
90
89
|
}),
|
|
91
|
-
'
|
|
92
|
-
rowGap:
|
|
90
|
+
'scale.025': css({
|
|
91
|
+
rowGap: "var(--ds-scale-025, 2px)"
|
|
93
92
|
}),
|
|
94
|
-
'
|
|
95
|
-
rowGap:
|
|
93
|
+
'scale.050': css({
|
|
94
|
+
rowGap: "var(--ds-scale-050, 4px)"
|
|
96
95
|
}),
|
|
97
|
-
'
|
|
98
|
-
rowGap:
|
|
96
|
+
'scale.075': css({
|
|
97
|
+
rowGap: "var(--ds-scale-075, 6px)"
|
|
99
98
|
}),
|
|
100
|
-
'
|
|
101
|
-
rowGap:
|
|
99
|
+
'scale.100': css({
|
|
100
|
+
rowGap: "var(--ds-scale-100, 8px)"
|
|
102
101
|
}),
|
|
103
|
-
'
|
|
104
|
-
rowGap:
|
|
102
|
+
'scale.150': css({
|
|
103
|
+
rowGap: "var(--ds-scale-150, 12px)"
|
|
105
104
|
}),
|
|
106
|
-
'
|
|
107
|
-
rowGap:
|
|
105
|
+
'scale.200': css({
|
|
106
|
+
rowGap: "var(--ds-scale-200, 16px)"
|
|
108
107
|
}),
|
|
109
|
-
'
|
|
110
|
-
rowGap:
|
|
108
|
+
'scale.250': css({
|
|
109
|
+
rowGap: "var(--ds-scale-250, 20px)"
|
|
111
110
|
}),
|
|
112
|
-
'
|
|
113
|
-
rowGap:
|
|
111
|
+
'scale.300': css({
|
|
112
|
+
rowGap: "var(--ds-scale-300, 24px)"
|
|
114
113
|
}),
|
|
115
|
-
'
|
|
116
|
-
rowGap:
|
|
114
|
+
'scale.400': css({
|
|
115
|
+
rowGap: "var(--ds-scale-400, 32px)"
|
|
117
116
|
}),
|
|
118
|
-
'
|
|
119
|
-
rowGap:
|
|
117
|
+
'scale.500': css({
|
|
118
|
+
rowGap: "var(--ds-scale-500, 40px)"
|
|
120
119
|
}),
|
|
121
|
-
'
|
|
122
|
-
rowGap:
|
|
120
|
+
'scale.600': css({
|
|
121
|
+
rowGap: "var(--ds-scale-600, 48px)"
|
|
123
122
|
})
|
|
124
123
|
};
|
|
125
124
|
/**
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
+
import { createContext, Fragment, useContext } from 'react';
|
|
2
3
|
import { css, jsx } from '@emotion/react';
|
|
3
4
|
import invariant from 'tiny-invariant';
|
|
4
|
-
import
|
|
5
|
+
import surfaceColorMap from '../internal/color-map';
|
|
5
6
|
import { useSurface } from './surface-provider';
|
|
6
7
|
const asAllowlist = ['span', 'div', 'p'];
|
|
7
8
|
const fontFamily = `-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif`;
|
|
@@ -24,6 +25,9 @@ const fontWeightMap = {
|
|
|
24
25
|
'500': css({
|
|
25
26
|
fontWeight: 500
|
|
26
27
|
}),
|
|
28
|
+
'600': css({
|
|
29
|
+
fontWeight: 600
|
|
30
|
+
}),
|
|
27
31
|
'700': css({
|
|
28
32
|
fontWeight: 700
|
|
29
33
|
})
|
|
@@ -95,6 +99,25 @@ const truncateStyles = css({
|
|
|
95
99
|
textOverflow: 'ellipsis',
|
|
96
100
|
whiteSpace: 'nowrap'
|
|
97
101
|
});
|
|
102
|
+
/**
|
|
103
|
+
* 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.
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
const useColor = colorProp => {
|
|
107
|
+
const surface = useSurface();
|
|
108
|
+
const inverseTextColor = surfaceColorMap[surface];
|
|
109
|
+
/**
|
|
110
|
+
* Where the color of the surface is inverted we override the user choice
|
|
111
|
+
* as there is no valid choice that is not covered by the override.
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
const color = inverseTextColor !== null && inverseTextColor !== void 0 ? inverseTextColor : colorProp;
|
|
115
|
+
return color;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const HasTextAncestorContext = /*#__PURE__*/createContext(false);
|
|
119
|
+
|
|
120
|
+
const useHasTextAncestor = () => useContext(HasTextAncestorContext);
|
|
98
121
|
/**
|
|
99
122
|
* __Text__
|
|
100
123
|
*
|
|
@@ -105,83 +128,96 @@ const truncateStyles = css({
|
|
|
105
128
|
* @internal
|
|
106
129
|
*/
|
|
107
130
|
|
|
131
|
+
|
|
108
132
|
const Text = ({
|
|
109
|
-
as: Component = 'span',
|
|
110
133
|
children,
|
|
111
|
-
|
|
112
|
-
fontSize,
|
|
113
|
-
fontWeight,
|
|
114
|
-
lineHeight,
|
|
115
|
-
shouldTruncate = false,
|
|
116
|
-
textAlign,
|
|
117
|
-
textTransform,
|
|
118
|
-
verticalAlign,
|
|
119
|
-
testId,
|
|
120
|
-
UNSAFE_style
|
|
134
|
+
...props
|
|
121
135
|
}) => {
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
136
|
+
const {
|
|
137
|
+
as: Component = 'span',
|
|
138
|
+
color: colorProp,
|
|
139
|
+
fontSize,
|
|
140
|
+
fontWeight,
|
|
141
|
+
lineHeight,
|
|
142
|
+
shouldTruncate = false,
|
|
143
|
+
textAlign,
|
|
144
|
+
textTransform,
|
|
145
|
+
verticalAlign,
|
|
146
|
+
testId,
|
|
147
|
+
UNSAFE_style
|
|
148
|
+
} = props;
|
|
125
149
|
invariant(asAllowlist.includes(Component), `@atlaskit/ds-explorations: Text received an invalid "as" value of "${Component}"`);
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
150
|
+
const color = useColor(colorProp);
|
|
151
|
+
const isWrapped = useHasTextAncestor();
|
|
152
|
+
/**
|
|
153
|
+
* If the text is already wrapped and applies no props we can just
|
|
154
|
+
* render the children directly as a fragment.
|
|
155
|
+
*/
|
|
156
|
+
|
|
157
|
+
if (isWrapped && Object.keys(props).length === 0) {
|
|
158
|
+
return jsx(Fragment, null, children);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const component = jsx(Component, {
|
|
162
|
+
style: UNSAFE_style,
|
|
132
163
|
css: [baseStyles, color && textColorMap[color], fontSize && fontSizeMap[fontSize], fontWeight && fontWeightMap[fontWeight], lineHeight && lineHeightMap[lineHeight], shouldTruncate && truncateStyles, textAlign && textAlignMap[textAlign], textTransform && textTransformMap[textTransform], verticalAlign && verticalAlignMap[verticalAlign]],
|
|
133
164
|
"data-testid": testId
|
|
134
165
|
}, children);
|
|
166
|
+
return isWrapped ? // no need to re-apply context if the text is already wrapped
|
|
167
|
+
component : jsx(HasTextAncestorContext.Provider, {
|
|
168
|
+
value: true
|
|
169
|
+
}, component);
|
|
135
170
|
};
|
|
136
171
|
|
|
137
172
|
export default Text;
|
|
138
173
|
/**
|
|
139
174
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
140
|
-
* @codegen <<SignedSource::
|
|
175
|
+
* @codegen <<SignedSource::21771f01de3c37646642de03274f0738>>
|
|
141
176
|
* @codegenId colors
|
|
142
177
|
* @codegenCommand yarn codegen-styles
|
|
143
178
|
* @codegenParams ["text"]
|
|
179
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::0c1fe9904b2ff2465a532b97ab76491e>>
|
|
144
180
|
*/
|
|
145
181
|
|
|
146
182
|
const textColorMap = {
|
|
147
183
|
'color.text': css({
|
|
148
|
-
color: "var(--ds-text,
|
|
184
|
+
color: "var(--ds-text, #172B4D)"
|
|
149
185
|
}),
|
|
150
186
|
subtle: css({
|
|
151
|
-
color: "var(--ds-text-subtle,
|
|
187
|
+
color: "var(--ds-text-subtle, #42526E)"
|
|
152
188
|
}),
|
|
153
189
|
subtlest: css({
|
|
154
|
-
color: "var(--ds-text-subtlest,
|
|
190
|
+
color: "var(--ds-text-subtlest, #7A869A)"
|
|
155
191
|
}),
|
|
156
192
|
disabled: css({
|
|
157
|
-
color: "var(--ds-text-disabled,
|
|
193
|
+
color: "var(--ds-text-disabled, #A5ADBA)"
|
|
158
194
|
}),
|
|
159
195
|
inverse: css({
|
|
160
|
-
color: "var(--ds-text-inverse,
|
|
196
|
+
color: "var(--ds-text-inverse, #FFFFFF)"
|
|
161
197
|
}),
|
|
162
198
|
brand: css({
|
|
163
|
-
color: "var(--ds-text-brand,
|
|
199
|
+
color: "var(--ds-text-brand, #0065FF)"
|
|
164
200
|
}),
|
|
165
201
|
selected: css({
|
|
166
|
-
color: "var(--ds-text-selected,
|
|
202
|
+
color: "var(--ds-text-selected, #0052CC)"
|
|
167
203
|
}),
|
|
168
204
|
danger: css({
|
|
169
|
-
color: "var(--ds-text-danger,
|
|
205
|
+
color: "var(--ds-text-danger, #DE350B)"
|
|
170
206
|
}),
|
|
171
207
|
warning: css({
|
|
172
|
-
color: "var(--ds-text-warning,
|
|
208
|
+
color: "var(--ds-text-warning, #974F0C)"
|
|
173
209
|
}),
|
|
174
210
|
'warning.inverse': css({
|
|
175
|
-
color: "var(--ds-text-warning-inverse,
|
|
211
|
+
color: "var(--ds-text-warning-inverse, #172B4D)"
|
|
176
212
|
}),
|
|
177
213
|
success: css({
|
|
178
|
-
color: "var(--ds-text-success,
|
|
214
|
+
color: "var(--ds-text-success, #006644)"
|
|
179
215
|
}),
|
|
180
216
|
discovery: css({
|
|
181
|
-
color: "var(--ds-text-discovery,
|
|
217
|
+
color: "var(--ds-text-discovery, #403294)"
|
|
182
218
|
}),
|
|
183
219
|
information: css({
|
|
184
|
-
color: "var(--ds-text-information,
|
|
220
|
+
color: "var(--ds-text-information, #0052CC)"
|
|
185
221
|
})
|
|
186
222
|
};
|
|
187
223
|
/**
|
package/dist/es2019/index.js
CHANGED
|
@@ -2,5 +2,4 @@ export { default as UNSAFE_Box } from './components/box.partial';
|
|
|
2
2
|
export { default as UNSAFE_Text } from './components/text.partial';
|
|
3
3
|
export { default as UNSAFE_Inline } from './components/inline.partial';
|
|
4
4
|
export { default as UNSAFE_Stack } from './components/stack.partial';
|
|
5
|
-
export { default as UNSAFE_InteractionSurface } from './components/interaction-surface.partial';
|
|
6
|
-
export { SPACING_SCALE as UNSAFE_SPACING_SCALE } from './constants';
|
|
5
|
+
export { default as UNSAFE_InteractionSurface } from './components/interaction-surface.partial';
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* The color map is used to map a background color token to a matching text color that will meet contrast.
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::c9429c38d12f88de9f5be644bf5e704a>>
|
|
7
7
|
* @codegenCommand yarn codegen-styles
|
|
8
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::0c1fe9904b2ff2465a532b97ab76491e>>
|
|
8
9
|
*/
|
|
9
|
-
export
|
|
10
|
+
export default {
|
|
10
11
|
'neutral.bold': 'inverse',
|
|
11
12
|
'neutral.bold.hovered': 'inverse',
|
|
12
13
|
'neutral.bold.pressed': 'inverse',
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
+
*
|
|
4
|
+
* Some artifact
|
|
5
|
+
*
|
|
6
|
+
* @codegen <<SignedSource::caecb926afa82b027fba396074de5c2c>>
|
|
7
|
+
* @codegenCommand yarn codegen-styles
|
|
8
|
+
*/
|
|
9
|
+
export const spacingScale = ['scale.0', 'scale.025', 'scale.050', 'scale.075', 'scale.100', 'scale.150', 'scale.200', 'scale.250', 'scale.300', 'scale.400', 'scale.500', 'scale.600'];
|
package/dist/es2019/version.json
CHANGED