@atlaskit/primitives 4.0.2 → 4.1.1
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 +12 -0
- package/constellation/text/examples.mdx +1 -1
- package/constellation/text/usage.mdx +1 -1
- package/dist/cjs/components/anchor.js +1 -1
- package/dist/cjs/components/internal/types.js +1 -5
- package/dist/cjs/components/pressable.js +1 -1
- package/dist/cjs/components/text.js +12 -10
- package/dist/cjs/xcss/style-maps.partial.js +13 -13
- package/dist/es2019/components/anchor.js +1 -1
- package/dist/es2019/components/internal/types.js +0 -1
- package/dist/es2019/components/pressable.js +1 -1
- package/dist/es2019/components/text.js +11 -9
- package/dist/es2019/xcss/style-maps.partial.js +12 -12
- package/dist/esm/components/anchor.js +1 -1
- package/dist/esm/components/internal/types.js +0 -1
- package/dist/esm/components/pressable.js +1 -1
- package/dist/esm/components/text.js +12 -10
- package/dist/esm/xcss/style-maps.partial.js +12 -12
- package/dist/types/components/text.d.ts +7 -3
- package/dist/types/xcss/style-maps.partial.d.ts +13 -13
- package/dist/types-ts4.5/components/text.d.ts +7 -3
- package/dist/types-ts4.5/xcss/style-maps.partial.d.ts +13 -13
- package/package.json +1 -1
- package/scripts/typography-codegen-template.tsx +9 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/primitives
|
|
2
2
|
|
|
3
|
+
## 4.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#81644](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/81644) [`8ab7a816dca7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8ab7a816dca7) - Revert input border change from the previous version
|
|
8
|
+
|
|
9
|
+
## 4.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#80528](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/80528) [`8877e9b57d55`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8877e9b57d55) - Added `size` prop which will replace `variant` prop in the next major version.
|
|
14
|
+
|
|
3
15
|
## 4.0.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -13,7 +13,7 @@ import AsElement from '../../examples/constellation/text/as-element';
|
|
|
13
13
|
|
|
14
14
|
Implements the [Atlassian typography system](/foundations/typography/) as a component, scoped to body text usages.
|
|
15
15
|
|
|
16
|
-
The `
|
|
16
|
+
The `size` prop expresses the visual appearance of the text element.
|
|
17
17
|
|
|
18
18
|
<Example Component={Basic} pacckageName="@atlaskit/primitives" />
|
|
19
19
|
|
|
@@ -6,4 +6,4 @@ order: 2
|
|
|
6
6
|
|
|
7
7
|
## Usage
|
|
8
8
|
|
|
9
|
-
Use body text for main content, such as detailed descriptions or for text in components. For each
|
|
9
|
+
Use body text for main content, such as detailed descriptions or for text in components. For each size, we have coupled a line height ensuring that it is compliant with accessibility standards.
|
|
@@ -76,7 +76,7 @@ var Anchor = function Anchor(_ref, ref) {
|
|
|
76
76
|
action: 'clicked',
|
|
77
77
|
componentName: componentName || 'Anchor',
|
|
78
78
|
packageName: "@atlaskit/primitives",
|
|
79
|
-
packageVersion: "4.
|
|
79
|
+
packageVersion: "4.1.1",
|
|
80
80
|
analyticsData: analyticsContext,
|
|
81
81
|
actionSubject: 'link'
|
|
82
82
|
});
|
|
@@ -80,7 +80,7 @@ var UNSAFE_PRESSABLE = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
|
|
|
80
80
|
action: 'clicked',
|
|
81
81
|
componentName: componentName || 'Pressable',
|
|
82
82
|
packageName: "@atlaskit/primitives",
|
|
83
|
-
packageVersion: "4.
|
|
83
|
+
packageVersion: "4.1.1",
|
|
84
84
|
analyticsData: analyticsContext,
|
|
85
85
|
actionSubject: 'button'
|
|
86
86
|
});
|
|
@@ -47,6 +47,11 @@ var wordBreakMap = {
|
|
|
47
47
|
wordBreak: 'break-all'
|
|
48
48
|
})
|
|
49
49
|
};
|
|
50
|
+
var tempVariantSizeMap = {
|
|
51
|
+
body: 'medium',
|
|
52
|
+
'body.small': 'small',
|
|
53
|
+
'body.large': 'large'
|
|
54
|
+
};
|
|
50
55
|
var HasTextAncestorContext = /*#__PURE__*/(0, _react.createContext)(false);
|
|
51
56
|
var useHasTextAncestor = function useHasTextAncestor() {
|
|
52
57
|
return (0, _react.useContext)(HasTextAncestorContext);
|
|
@@ -92,20 +97,17 @@ var Text = function Text(_ref) {
|
|
|
92
97
|
textAlign = props.textAlign,
|
|
93
98
|
testId = props.testId,
|
|
94
99
|
id = props.id,
|
|
95
|
-
_props$
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
// Remove the ability to bypass typescript errors for maxLines
|
|
101
|
-
var maxLines;
|
|
102
|
-
if ('maxLines' in props && variant.includes('body')) {
|
|
100
|
+
_props$size = props.size,
|
|
101
|
+
size = _props$size === void 0 ? 'medium' : _props$size,
|
|
102
|
+
variant = props.variant,
|
|
103
|
+
weight = props.weight,
|
|
103
104
|
maxLines = props.maxLines;
|
|
104
|
-
|
|
105
|
+
(0, _tinyInvariant.default)(asAllowlist.includes(Component), "@atlaskit/primitives: Text received an invalid \"as\" value of \"".concat(Component, "\""));
|
|
106
|
+
var localSize = variant && tempVariantSizeMap[variant] || size;
|
|
105
107
|
var hasTextAncestor = useHasTextAncestor();
|
|
106
108
|
var color = useColor(colorProp, hasTextAncestor);
|
|
107
109
|
var component = (0, _react2.jsx)(Component, {
|
|
108
|
-
css: [resetStyles, _styleMaps.fontStylesMap[
|
|
110
|
+
css: [resetStyles, _styleMaps.fontStylesMap[localSize], color && _styleMaps.textColorStylesMap[color], maxLines && truncationStyles, maxLines === 1 && wordBreakMap.breakAll, textAlign && textAlignMap[textAlign], weight && _styleMaps.fontWeightStylesMap[weight], Component === 'em' && emStyles, Component === 'strong' && strongStyles],
|
|
109
111
|
style: {
|
|
110
112
|
WebkitLineClamp: maxLines
|
|
111
113
|
},
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.textColorStylesMap = exports.textColorMap = exports.surfaceColorStylesMap = exports.surfaceColorMap = exports.spaceStylesMap = exports.shadowMap = exports.positiveSpaceMap = exports.paddingStylesMap = exports.opacityMap = exports.negativeSpaceMap = exports.layerMap = exports.isSurfaceColorToken = exports.inverseColorMap = exports.fontWeightStylesMap = exports.fontWeightMap = exports.fontStylesMap = exports.fontFamilyStylesMap = exports.fontFamilyMap = exports.fillMap = exports.dimensionMap = exports.borderWidthMap = exports.borderRadiusMap = exports.borderColorMap = exports.
|
|
7
|
+
exports.textColorStylesMap = exports.textColorMap = exports.surfaceColorStylesMap = exports.surfaceColorMap = exports.spaceStylesMap = exports.shadowMap = exports.positiveSpaceMap = exports.paddingStylesMap = exports.opacityMap = exports.negativeSpaceMap = exports.layerMap = exports.isSurfaceColorToken = exports.inverseColorMap = exports.fontWeightStylesMap = exports.fontWeightMap = exports.fontStylesMap = exports.fontSizeMap = exports.fontFamilyStylesMap = exports.fontFamilyMap = exports.fillMap = exports.dimensionMap = exports.borderWidthMap = exports.borderRadiusMap = exports.borderColorMap = exports.backgroundColorStylesMap = exports.backgroundColorMap = exports.allSpaceMap = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _react = require("@emotion/react");
|
|
10
10
|
var _tokens = require("@atlaskit/tokens");
|
|
@@ -73,10 +73,10 @@ var allSpaceMap = exports.allSpaceMap = _objectSpread(_objectSpread({}, positive
|
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
75
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
76
|
-
* @codegen <<SignedSource::
|
|
76
|
+
* @codegen <<SignedSource::fcf1cfc01cda3c278e69b0b564c7746d>>
|
|
77
77
|
* @codegenId inverse-colors
|
|
78
78
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
79
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::
|
|
79
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
|
|
80
80
|
*/
|
|
81
81
|
var inverseColorMap = exports.inverseColorMap = {
|
|
82
82
|
'color.background.neutral.bold': 'color.text.inverse',
|
|
@@ -114,11 +114,11 @@ var inverseColorMap = exports.inverseColorMap = {
|
|
|
114
114
|
|
|
115
115
|
/**
|
|
116
116
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
117
|
-
* @codegen <<SignedSource::
|
|
117
|
+
* @codegen <<SignedSource::8c10abde8168de6260b5aa120dd948bc>>
|
|
118
118
|
* @codegenId elevation
|
|
119
119
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
120
120
|
* @codegenParams ["opacity", "shadow", "surface"]
|
|
121
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::
|
|
121
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
|
|
122
122
|
*/
|
|
123
123
|
var opacityMap = exports.opacityMap = {
|
|
124
124
|
'opacity.disabled': "var(--ds-opacity-disabled, 0.4)",
|
|
@@ -149,11 +149,11 @@ var surfaceColorMap = exports.surfaceColorMap = {
|
|
|
149
149
|
|
|
150
150
|
/**
|
|
151
151
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
152
|
-
* @codegen <<SignedSource::
|
|
152
|
+
* @codegen <<SignedSource::0f7982208166d5dae0e25517d29aeaef>>
|
|
153
153
|
* @codegenId colors
|
|
154
154
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
155
155
|
* @codegenParams ["border", "background", "text", "fill"]
|
|
156
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::
|
|
156
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
|
|
157
157
|
*/
|
|
158
158
|
var borderColorMap = exports.borderColorMap = {
|
|
159
159
|
'color.border': "var(--ds-border, #091e4221)",
|
|
@@ -496,17 +496,17 @@ var borderRadiusMap = exports.borderRadiusMap = {
|
|
|
496
496
|
|
|
497
497
|
/**
|
|
498
498
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
499
|
-
* @codegen <<SignedSource::
|
|
499
|
+
* @codegen <<SignedSource::64be523321fab6adc76673ef5f93e3d1>>
|
|
500
500
|
* @codegenId typography
|
|
501
501
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
502
502
|
* @codegenParams ["fontSize", "fontWeight", "fontFamily", "lineHeight", "body", "ui"]
|
|
503
503
|
* @codegenDependency ../../scripts/codegen-file-templates/dimensions.tsx <<SignedSource::0cd422575c3f2a3784eeef767abe71f4>>
|
|
504
504
|
* @codegenDependency ../../scripts/codegen-file-templates/layer.tsx <<SignedSource::79d24a1e558f12d671c06a7609f90dc1>>
|
|
505
505
|
*/
|
|
506
|
-
var
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
506
|
+
var fontSizeMap = exports.fontSizeMap = {
|
|
507
|
+
medium: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
508
|
+
large: "var(--ds-font-body-large, normal 400 16px/24px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
509
|
+
small: "var(--ds-font-body-small, normal 400 11px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
510
510
|
};
|
|
511
511
|
var fontWeightMap = exports.fontWeightMap = {
|
|
512
512
|
bold: "var(--ds-font-weight-bold, 700)",
|
|
@@ -547,7 +547,7 @@ var backgroundColorStylesMap = exports.backgroundColorStylesMap = getSerializedS
|
|
|
547
547
|
var textColorStylesMap = exports.textColorStylesMap = getSerializedStylesMap('color', textColorMap);
|
|
548
548
|
var fontWeightStylesMap = exports.fontWeightStylesMap = getSerializedStylesMap('fontWeight', fontWeightMap);
|
|
549
549
|
var fontFamilyStylesMap = exports.fontFamilyStylesMap = getSerializedStylesMap('fontFamily', fontFamilyMap);
|
|
550
|
-
var fontStylesMap = exports.fontStylesMap = getSerializedStylesMap('font',
|
|
550
|
+
var fontStylesMap = exports.fontStylesMap = getSerializedStylesMap('font', fontSizeMap);
|
|
551
551
|
var surfaceColorStylesMap = exports.surfaceColorStylesMap = getSerializedStylesMap(_tokens.CURRENT_SURFACE_CSS_VAR, surfaceColorMap);
|
|
552
552
|
var isSurfaceColorToken = exports.isSurfaceColorToken = function isSurfaceColorToken(color) {
|
|
553
553
|
return surfaceColorMap[color] !== undefined;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -66,7 +66,7 @@ const UNSAFE_PRESSABLE = /*#__PURE__*/forwardRef(({
|
|
|
66
66
|
action: 'clicked',
|
|
67
67
|
componentName: componentName || 'Pressable',
|
|
68
68
|
packageName: "@atlaskit/primitives",
|
|
69
|
-
packageVersion: "4.
|
|
69
|
+
packageVersion: "4.1.1",
|
|
70
70
|
analyticsData: analyticsContext,
|
|
71
71
|
actionSubject: 'button'
|
|
72
72
|
});
|
|
@@ -38,6 +38,11 @@ const wordBreakMap = {
|
|
|
38
38
|
wordBreak: 'break-all'
|
|
39
39
|
})
|
|
40
40
|
};
|
|
41
|
+
const tempVariantSizeMap = {
|
|
42
|
+
body: 'medium',
|
|
43
|
+
'body.small': 'small',
|
|
44
|
+
'body.large': 'large'
|
|
45
|
+
};
|
|
41
46
|
const HasTextAncestorContext = /*#__PURE__*/createContext(false);
|
|
42
47
|
const useHasTextAncestor = () => useContext(HasTextAncestorContext);
|
|
43
48
|
|
|
@@ -82,20 +87,17 @@ const Text = ({
|
|
|
82
87
|
textAlign,
|
|
83
88
|
testId,
|
|
84
89
|
id,
|
|
85
|
-
|
|
86
|
-
|
|
90
|
+
size = 'medium',
|
|
91
|
+
variant,
|
|
92
|
+
weight,
|
|
93
|
+
maxLines
|
|
87
94
|
} = props;
|
|
88
95
|
invariant(asAllowlist.includes(Component), `@atlaskit/primitives: Text received an invalid "as" value of "${Component}"`);
|
|
89
|
-
|
|
90
|
-
// Remove the ability to bypass typescript errors for maxLines
|
|
91
|
-
let maxLines;
|
|
92
|
-
if ('maxLines' in props && variant.includes('body')) {
|
|
93
|
-
maxLines = props.maxLines;
|
|
94
|
-
}
|
|
96
|
+
const localSize = variant && tempVariantSizeMap[variant] || size;
|
|
95
97
|
const hasTextAncestor = useHasTextAncestor();
|
|
96
98
|
const color = useColor(colorProp, hasTextAncestor);
|
|
97
99
|
const component = jsx(Component, {
|
|
98
|
-
css: [resetStyles, fontStylesMap[
|
|
100
|
+
css: [resetStyles, fontStylesMap[localSize], color && textColorStylesMap[color], maxLines && truncationStyles, maxLines === 1 && wordBreakMap.breakAll, textAlign && textAlignMap[textAlign], weight && fontWeightStylesMap[weight], Component === 'em' && emStyles, Component === 'strong' && strongStyles],
|
|
99
101
|
style: {
|
|
100
102
|
WebkitLineClamp: maxLines
|
|
101
103
|
},
|
|
@@ -67,10 +67,10 @@ export const allSpaceMap = {
|
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
70
|
-
* @codegen <<SignedSource::
|
|
70
|
+
* @codegen <<SignedSource::fcf1cfc01cda3c278e69b0b564c7746d>>
|
|
71
71
|
* @codegenId inverse-colors
|
|
72
72
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
73
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::
|
|
73
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
|
|
74
74
|
*/
|
|
75
75
|
export const inverseColorMap = {
|
|
76
76
|
'color.background.neutral.bold': 'color.text.inverse',
|
|
@@ -108,11 +108,11 @@ export const inverseColorMap = {
|
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
110
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
111
|
-
* @codegen <<SignedSource::
|
|
111
|
+
* @codegen <<SignedSource::8c10abde8168de6260b5aa120dd948bc>>
|
|
112
112
|
* @codegenId elevation
|
|
113
113
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
114
114
|
* @codegenParams ["opacity", "shadow", "surface"]
|
|
115
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::
|
|
115
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
|
|
116
116
|
*/
|
|
117
117
|
export const opacityMap = {
|
|
118
118
|
'opacity.disabled': "var(--ds-opacity-disabled, 0.4)",
|
|
@@ -143,11 +143,11 @@ export const surfaceColorMap = {
|
|
|
143
143
|
|
|
144
144
|
/**
|
|
145
145
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
146
|
-
* @codegen <<SignedSource::
|
|
146
|
+
* @codegen <<SignedSource::0f7982208166d5dae0e25517d29aeaef>>
|
|
147
147
|
* @codegenId colors
|
|
148
148
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
149
149
|
* @codegenParams ["border", "background", "text", "fill"]
|
|
150
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::
|
|
150
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
|
|
151
151
|
*/
|
|
152
152
|
export const borderColorMap = {
|
|
153
153
|
'color.border': "var(--ds-border, #091e4221)",
|
|
@@ -490,17 +490,17 @@ export const borderRadiusMap = {
|
|
|
490
490
|
|
|
491
491
|
/**
|
|
492
492
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
493
|
-
* @codegen <<SignedSource::
|
|
493
|
+
* @codegen <<SignedSource::64be523321fab6adc76673ef5f93e3d1>>
|
|
494
494
|
* @codegenId typography
|
|
495
495
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
496
496
|
* @codegenParams ["fontSize", "fontWeight", "fontFamily", "lineHeight", "body", "ui"]
|
|
497
497
|
* @codegenDependency ../../scripts/codegen-file-templates/dimensions.tsx <<SignedSource::0cd422575c3f2a3784eeef767abe71f4>>
|
|
498
498
|
* @codegenDependency ../../scripts/codegen-file-templates/layer.tsx <<SignedSource::79d24a1e558f12d671c06a7609f90dc1>>
|
|
499
499
|
*/
|
|
500
|
-
export const
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
500
|
+
export const fontSizeMap = {
|
|
501
|
+
medium: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
502
|
+
large: "var(--ds-font-body-large, normal 400 16px/24px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
503
|
+
small: "var(--ds-font-body-small, normal 400 11px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
504
504
|
};
|
|
505
505
|
export const fontWeightMap = {
|
|
506
506
|
bold: "var(--ds-font-weight-bold, 700)",
|
|
@@ -543,6 +543,6 @@ export const backgroundColorStylesMap = getSerializedStylesMap('backgroundColor'
|
|
|
543
543
|
export const textColorStylesMap = getSerializedStylesMap('color', textColorMap);
|
|
544
544
|
export const fontWeightStylesMap = getSerializedStylesMap('fontWeight', fontWeightMap);
|
|
545
545
|
export const fontFamilyStylesMap = getSerializedStylesMap('fontFamily', fontFamilyMap);
|
|
546
|
-
export const fontStylesMap = getSerializedStylesMap('font',
|
|
546
|
+
export const fontStylesMap = getSerializedStylesMap('font', fontSizeMap);
|
|
547
547
|
export const surfaceColorStylesMap = getSerializedStylesMap(CURRENT_SURFACE_CSS_VAR, surfaceColorMap);
|
|
548
548
|
export const isSurfaceColorToken = color => surfaceColorMap[color] !== undefined;
|
|
@@ -66,7 +66,7 @@ var Anchor = function Anchor(_ref, ref) {
|
|
|
66
66
|
action: 'clicked',
|
|
67
67
|
componentName: componentName || 'Anchor',
|
|
68
68
|
packageName: "@atlaskit/primitives",
|
|
69
|
-
packageVersion: "4.
|
|
69
|
+
packageVersion: "4.1.1",
|
|
70
70
|
analyticsData: analyticsContext,
|
|
71
71
|
actionSubject: 'link'
|
|
72
72
|
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -70,7 +70,7 @@ var UNSAFE_PRESSABLE = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
70
70
|
action: 'clicked',
|
|
71
71
|
componentName: componentName || 'Pressable',
|
|
72
72
|
packageName: "@atlaskit/primitives",
|
|
73
|
-
packageVersion: "4.
|
|
73
|
+
packageVersion: "4.1.1",
|
|
74
74
|
analyticsData: analyticsContext,
|
|
75
75
|
actionSubject: 'button'
|
|
76
76
|
});
|
|
@@ -40,6 +40,11 @@ var wordBreakMap = {
|
|
|
40
40
|
wordBreak: 'break-all'
|
|
41
41
|
})
|
|
42
42
|
};
|
|
43
|
+
var tempVariantSizeMap = {
|
|
44
|
+
body: 'medium',
|
|
45
|
+
'body.small': 'small',
|
|
46
|
+
'body.large': 'large'
|
|
47
|
+
};
|
|
43
48
|
var HasTextAncestorContext = /*#__PURE__*/createContext(false);
|
|
44
49
|
var useHasTextAncestor = function useHasTextAncestor() {
|
|
45
50
|
return useContext(HasTextAncestorContext);
|
|
@@ -85,20 +90,17 @@ var Text = function Text(_ref) {
|
|
|
85
90
|
textAlign = props.textAlign,
|
|
86
91
|
testId = props.testId,
|
|
87
92
|
id = props.id,
|
|
88
|
-
_props$
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
// Remove the ability to bypass typescript errors for maxLines
|
|
94
|
-
var maxLines;
|
|
95
|
-
if ('maxLines' in props && variant.includes('body')) {
|
|
93
|
+
_props$size = props.size,
|
|
94
|
+
size = _props$size === void 0 ? 'medium' : _props$size,
|
|
95
|
+
variant = props.variant,
|
|
96
|
+
weight = props.weight,
|
|
96
97
|
maxLines = props.maxLines;
|
|
97
|
-
|
|
98
|
+
invariant(asAllowlist.includes(Component), "@atlaskit/primitives: Text received an invalid \"as\" value of \"".concat(Component, "\""));
|
|
99
|
+
var localSize = variant && tempVariantSizeMap[variant] || size;
|
|
98
100
|
var hasTextAncestor = useHasTextAncestor();
|
|
99
101
|
var color = useColor(colorProp, hasTextAncestor);
|
|
100
102
|
var component = jsx(Component, {
|
|
101
|
-
css: [resetStyles, fontStylesMap[
|
|
103
|
+
css: [resetStyles, fontStylesMap[localSize], color && textColorStylesMap[color], maxLines && truncationStyles, maxLines === 1 && wordBreakMap.breakAll, textAlign && textAlignMap[textAlign], weight && fontWeightStylesMap[weight], Component === 'em' && emStyles, Component === 'strong' && strongStyles],
|
|
102
104
|
style: {
|
|
103
105
|
WebkitLineClamp: maxLines
|
|
104
106
|
},
|
|
@@ -67,10 +67,10 @@ export var allSpaceMap = _objectSpread(_objectSpread({}, positiveSpaceMap), nega
|
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
70
|
-
* @codegen <<SignedSource::
|
|
70
|
+
* @codegen <<SignedSource::fcf1cfc01cda3c278e69b0b564c7746d>>
|
|
71
71
|
* @codegenId inverse-colors
|
|
72
72
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
73
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::
|
|
73
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
|
|
74
74
|
*/
|
|
75
75
|
export var inverseColorMap = {
|
|
76
76
|
'color.background.neutral.bold': 'color.text.inverse',
|
|
@@ -108,11 +108,11 @@ export var inverseColorMap = {
|
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
110
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
111
|
-
* @codegen <<SignedSource::
|
|
111
|
+
* @codegen <<SignedSource::8c10abde8168de6260b5aa120dd948bc>>
|
|
112
112
|
* @codegenId elevation
|
|
113
113
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
114
114
|
* @codegenParams ["opacity", "shadow", "surface"]
|
|
115
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::
|
|
115
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
|
|
116
116
|
*/
|
|
117
117
|
export var opacityMap = {
|
|
118
118
|
'opacity.disabled': "var(--ds-opacity-disabled, 0.4)",
|
|
@@ -143,11 +143,11 @@ export var surfaceColorMap = {
|
|
|
143
143
|
|
|
144
144
|
/**
|
|
145
145
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
146
|
-
* @codegen <<SignedSource::
|
|
146
|
+
* @codegen <<SignedSource::0f7982208166d5dae0e25517d29aeaef>>
|
|
147
147
|
* @codegenId colors
|
|
148
148
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
149
149
|
* @codegenParams ["border", "background", "text", "fill"]
|
|
150
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::
|
|
150
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
|
|
151
151
|
*/
|
|
152
152
|
export var borderColorMap = {
|
|
153
153
|
'color.border': "var(--ds-border, #091e4221)",
|
|
@@ -490,17 +490,17 @@ export var borderRadiusMap = {
|
|
|
490
490
|
|
|
491
491
|
/**
|
|
492
492
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
493
|
-
* @codegen <<SignedSource::
|
|
493
|
+
* @codegen <<SignedSource::64be523321fab6adc76673ef5f93e3d1>>
|
|
494
494
|
* @codegenId typography
|
|
495
495
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
496
496
|
* @codegenParams ["fontSize", "fontWeight", "fontFamily", "lineHeight", "body", "ui"]
|
|
497
497
|
* @codegenDependency ../../scripts/codegen-file-templates/dimensions.tsx <<SignedSource::0cd422575c3f2a3784eeef767abe71f4>>
|
|
498
498
|
* @codegenDependency ../../scripts/codegen-file-templates/layer.tsx <<SignedSource::79d24a1e558f12d671c06a7609f90dc1>>
|
|
499
499
|
*/
|
|
500
|
-
export var
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
500
|
+
export var fontSizeMap = {
|
|
501
|
+
medium: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
502
|
+
large: "var(--ds-font-body-large, normal 400 16px/24px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
503
|
+
small: "var(--ds-font-body-small, normal 400 11px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
504
504
|
};
|
|
505
505
|
export var fontWeightMap = {
|
|
506
506
|
bold: "var(--ds-font-weight-bold, 700)",
|
|
@@ -541,7 +541,7 @@ export var backgroundColorStylesMap = getSerializedStylesMap('backgroundColor',
|
|
|
541
541
|
export var textColorStylesMap = getSerializedStylesMap('color', textColorMap);
|
|
542
542
|
export var fontWeightStylesMap = getSerializedStylesMap('fontWeight', fontWeightMap);
|
|
543
543
|
export var fontFamilyStylesMap = getSerializedStylesMap('fontFamily', fontFamilyMap);
|
|
544
|
-
export var fontStylesMap = getSerializedStylesMap('font',
|
|
544
|
+
export var fontStylesMap = getSerializedStylesMap('font', fontSizeMap);
|
|
545
545
|
export var surfaceColorStylesMap = getSerializedStylesMap(CURRENT_SURFACE_CSS_VAR, surfaceColorMap);
|
|
546
546
|
export var isSurfaceColorToken = function isSurfaceColorToken(color) {
|
|
547
547
|
return surfaceColorMap[color] !== undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { FC, ReactNode } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { FontSize, FontWeight, TextColor } from '../xcss/style-maps.partial';
|
|
4
4
|
import type { BasePrimitiveProps } from './types';
|
|
5
5
|
declare const asAllowlist: readonly ["span", "p", "strong", "em"];
|
|
6
6
|
type AsElement = (typeof asAllowlist)[number];
|
|
@@ -34,9 +34,13 @@ type TextPropsBase = {
|
|
|
34
34
|
*/
|
|
35
35
|
textAlign?: TextAlign;
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* @deprecated. Use size instead.
|
|
38
38
|
*/
|
|
39
|
-
variant?:
|
|
39
|
+
variant?: 'body' | 'body.small' | 'body.large';
|
|
40
|
+
/**
|
|
41
|
+
* Text size.
|
|
42
|
+
*/
|
|
43
|
+
size?: FontSize;
|
|
40
44
|
/**
|
|
41
45
|
* The [HTML `font-weight` attribute](https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight).
|
|
42
46
|
*/
|
|
@@ -88,10 +88,10 @@ export type AllSpace = keyof typeof allSpaceMap;
|
|
|
88
88
|
*/
|
|
89
89
|
/**
|
|
90
90
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
91
|
-
* @codegen <<SignedSource::
|
|
91
|
+
* @codegen <<SignedSource::fcf1cfc01cda3c278e69b0b564c7746d>>
|
|
92
92
|
* @codegenId inverse-colors
|
|
93
93
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
94
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::
|
|
94
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
|
|
95
95
|
*/
|
|
96
96
|
export declare const inverseColorMap: {
|
|
97
97
|
readonly 'color.background.neutral.bold': "color.text.inverse";
|
|
@@ -127,11 +127,11 @@ export declare const inverseColorMap: {
|
|
|
127
127
|
*/
|
|
128
128
|
/**
|
|
129
129
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
130
|
-
* @codegen <<SignedSource::
|
|
130
|
+
* @codegen <<SignedSource::8c10abde8168de6260b5aa120dd948bc>>
|
|
131
131
|
* @codegenId elevation
|
|
132
132
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
133
133
|
* @codegenParams ["opacity", "shadow", "surface"]
|
|
134
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::
|
|
134
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
|
|
135
135
|
*/
|
|
136
136
|
export declare const opacityMap: {
|
|
137
137
|
readonly 'opacity.disabled': "var(--ds-opacity-disabled)";
|
|
@@ -164,11 +164,11 @@ export type SurfaceColor = keyof typeof surfaceColorMap;
|
|
|
164
164
|
*/
|
|
165
165
|
/**
|
|
166
166
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
167
|
-
* @codegen <<SignedSource::
|
|
167
|
+
* @codegen <<SignedSource::0f7982208166d5dae0e25517d29aeaef>>
|
|
168
168
|
* @codegenId colors
|
|
169
169
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
170
170
|
* @codegenParams ["border", "background", "text", "fill"]
|
|
171
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::
|
|
171
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
|
|
172
172
|
*/
|
|
173
173
|
export declare const borderColorMap: {
|
|
174
174
|
readonly 'color.border': "var(--ds-border)";
|
|
@@ -515,19 +515,19 @@ export type BorderRadius = keyof typeof borderRadiusMap;
|
|
|
515
515
|
*/
|
|
516
516
|
/**
|
|
517
517
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
518
|
-
* @codegen <<SignedSource::
|
|
518
|
+
* @codegen <<SignedSource::64be523321fab6adc76673ef5f93e3d1>>
|
|
519
519
|
* @codegenId typography
|
|
520
520
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
521
521
|
* @codegenParams ["fontSize", "fontWeight", "fontFamily", "lineHeight", "body", "ui"]
|
|
522
522
|
* @codegenDependency ../../scripts/codegen-file-templates/dimensions.tsx <<SignedSource::0cd422575c3f2a3784eeef767abe71f4>>
|
|
523
523
|
* @codegenDependency ../../scripts/codegen-file-templates/layer.tsx <<SignedSource::79d24a1e558f12d671c06a7609f90dc1>>
|
|
524
524
|
*/
|
|
525
|
-
export declare const
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
525
|
+
export declare const fontSizeMap: {
|
|
526
|
+
medium: "var(--ds-font-body)";
|
|
527
|
+
large: "var(--ds-font-body-large)";
|
|
528
|
+
small: "var(--ds-font-body-small)";
|
|
529
529
|
};
|
|
530
|
-
export type
|
|
530
|
+
export type FontSize = keyof typeof fontSizeMap;
|
|
531
531
|
export declare const fontWeightMap: {
|
|
532
532
|
bold: "var(--ds-font-weight-bold)";
|
|
533
533
|
medium: "var(--ds-font-weight-medium)";
|
|
@@ -642,7 +642,7 @@ type SurfaceColorToken = keyof typeof surfaceColorMap;
|
|
|
642
642
|
type TextColorToken = keyof typeof textColorMap;
|
|
643
643
|
type FontWeightToken = keyof typeof fontWeightMap;
|
|
644
644
|
type FontFamilyToken = keyof typeof fontFamilyMap;
|
|
645
|
-
type BodyFontToken = keyof typeof
|
|
645
|
+
type BodyFontToken = keyof typeof fontSizeMap;
|
|
646
646
|
type SpacingStyleMap = Record<SpacingProperty, Record<SpacingToken, SerializedStyles>>;
|
|
647
647
|
type BackgroundColorStyleMap = Record<BackgroundColorToken, SerializedStyles>;
|
|
648
648
|
type SurfaceColorStyleMap = Record<SurfaceColorToken, SerializedStyles>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { FC, ReactNode } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { FontSize, FontWeight, TextColor } from '../xcss/style-maps.partial';
|
|
4
4
|
import type { BasePrimitiveProps } from './types';
|
|
5
5
|
declare const asAllowlist: readonly [
|
|
6
6
|
"span",
|
|
@@ -39,9 +39,13 @@ type TextPropsBase = {
|
|
|
39
39
|
*/
|
|
40
40
|
textAlign?: TextAlign;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* @deprecated. Use size instead.
|
|
43
43
|
*/
|
|
44
|
-
variant?:
|
|
44
|
+
variant?: 'body' | 'body.small' | 'body.large';
|
|
45
|
+
/**
|
|
46
|
+
* Text size.
|
|
47
|
+
*/
|
|
48
|
+
size?: FontSize;
|
|
45
49
|
/**
|
|
46
50
|
* The [HTML `font-weight` attribute](https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight).
|
|
47
51
|
*/
|
|
@@ -88,10 +88,10 @@ export type AllSpace = keyof typeof allSpaceMap;
|
|
|
88
88
|
*/
|
|
89
89
|
/**
|
|
90
90
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
91
|
-
* @codegen <<SignedSource::
|
|
91
|
+
* @codegen <<SignedSource::fcf1cfc01cda3c278e69b0b564c7746d>>
|
|
92
92
|
* @codegenId inverse-colors
|
|
93
93
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
94
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::
|
|
94
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
|
|
95
95
|
*/
|
|
96
96
|
export declare const inverseColorMap: {
|
|
97
97
|
readonly 'color.background.neutral.bold': "color.text.inverse";
|
|
@@ -127,11 +127,11 @@ export declare const inverseColorMap: {
|
|
|
127
127
|
*/
|
|
128
128
|
/**
|
|
129
129
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
130
|
-
* @codegen <<SignedSource::
|
|
130
|
+
* @codegen <<SignedSource::8c10abde8168de6260b5aa120dd948bc>>
|
|
131
131
|
* @codegenId elevation
|
|
132
132
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
133
133
|
* @codegenParams ["opacity", "shadow", "surface"]
|
|
134
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::
|
|
134
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
|
|
135
135
|
*/
|
|
136
136
|
export declare const opacityMap: {
|
|
137
137
|
readonly 'opacity.disabled': "var(--ds-opacity-disabled)";
|
|
@@ -164,11 +164,11 @@ export type SurfaceColor = keyof typeof surfaceColorMap;
|
|
|
164
164
|
*/
|
|
165
165
|
/**
|
|
166
166
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
167
|
-
* @codegen <<SignedSource::
|
|
167
|
+
* @codegen <<SignedSource::0f7982208166d5dae0e25517d29aeaef>>
|
|
168
168
|
* @codegenId colors
|
|
169
169
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
170
170
|
* @codegenParams ["border", "background", "text", "fill"]
|
|
171
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::
|
|
171
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
|
|
172
172
|
*/
|
|
173
173
|
export declare const borderColorMap: {
|
|
174
174
|
readonly 'color.border': "var(--ds-border)";
|
|
@@ -515,19 +515,19 @@ export type BorderRadius = keyof typeof borderRadiusMap;
|
|
|
515
515
|
*/
|
|
516
516
|
/**
|
|
517
517
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
518
|
-
* @codegen <<SignedSource::
|
|
518
|
+
* @codegen <<SignedSource::64be523321fab6adc76673ef5f93e3d1>>
|
|
519
519
|
* @codegenId typography
|
|
520
520
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
521
521
|
* @codegenParams ["fontSize", "fontWeight", "fontFamily", "lineHeight", "body", "ui"]
|
|
522
522
|
* @codegenDependency ../../scripts/codegen-file-templates/dimensions.tsx <<SignedSource::0cd422575c3f2a3784eeef767abe71f4>>
|
|
523
523
|
* @codegenDependency ../../scripts/codegen-file-templates/layer.tsx <<SignedSource::79d24a1e558f12d671c06a7609f90dc1>>
|
|
524
524
|
*/
|
|
525
|
-
export declare const
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
525
|
+
export declare const fontSizeMap: {
|
|
526
|
+
medium: "var(--ds-font-body)";
|
|
527
|
+
large: "var(--ds-font-body-large)";
|
|
528
|
+
small: "var(--ds-font-body-small)";
|
|
529
529
|
};
|
|
530
|
-
export type
|
|
530
|
+
export type FontSize = keyof typeof fontSizeMap;
|
|
531
531
|
export declare const fontWeightMap: {
|
|
532
532
|
bold: "var(--ds-font-weight-bold)";
|
|
533
533
|
medium: "var(--ds-font-weight-medium)";
|
|
@@ -653,7 +653,7 @@ type SurfaceColorToken = keyof typeof surfaceColorMap;
|
|
|
653
653
|
type TextColorToken = keyof typeof textColorMap;
|
|
654
654
|
type FontWeightToken = keyof typeof fontWeightMap;
|
|
655
655
|
type FontFamilyToken = keyof typeof fontFamilyMap;
|
|
656
|
-
type BodyFontToken = keyof typeof
|
|
656
|
+
type BodyFontToken = keyof typeof fontSizeMap;
|
|
657
657
|
type SpacingStyleMap = Record<SpacingProperty, Record<SpacingToken, SerializedStyles>>;
|
|
658
658
|
type BackgroundColorStyleMap = Record<BackgroundColorToken, SerializedStyles>;
|
|
659
659
|
type SurfaceColorStyleMap = Record<SurfaceColorToken, SerializedStyles>;
|
package/package.json
CHANGED
|
@@ -19,7 +19,7 @@ const activeTokens: Token[] = tokens
|
|
|
19
19
|
|
|
20
20
|
const typographyProperties = [
|
|
21
21
|
{
|
|
22
|
-
objectName: '
|
|
22
|
+
objectName: 'fontSize',
|
|
23
23
|
cssProperty: 'font',
|
|
24
24
|
prefix: 'font.body',
|
|
25
25
|
filterFn: <T extends Token>(t: T) => t.name.startsWith('font.body'),
|
|
@@ -38,10 +38,17 @@ const typographyProperties = [
|
|
|
38
38
|
},
|
|
39
39
|
] as const;
|
|
40
40
|
|
|
41
|
+
const bodySizeMap = {
|
|
42
|
+
body: 'medium',
|
|
43
|
+
'body.small': 'small',
|
|
44
|
+
'body.large': 'large',
|
|
45
|
+
};
|
|
46
|
+
|
|
41
47
|
const removeVerbosity = (name: string): string => {
|
|
42
48
|
const partialRemove = ['font.body'];
|
|
43
49
|
if (partialRemove.some(s => name.includes(s))) {
|
|
44
|
-
|
|
50
|
+
// @ts-expect-error Indexing bodySizeMap
|
|
51
|
+
return bodySizeMap[name.replace('font.', '')];
|
|
45
52
|
}
|
|
46
53
|
|
|
47
54
|
const fullRemove = ['font.weight'];
|