@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,66 +0,0 @@
|
|
|
1
|
-
import format from '@af/formatting/sync';
|
|
2
|
-
import { spacing as tokens } from '@atlaskit/tokens/tokens-raw';
|
|
3
|
-
|
|
4
|
-
import { capitalize, tokenToStyle } from './utils';
|
|
5
|
-
|
|
6
|
-
const spacingProperties = {
|
|
7
|
-
padding: {
|
|
8
|
-
cssProperty: 'padding',
|
|
9
|
-
},
|
|
10
|
-
paddingBlock: {
|
|
11
|
-
cssProperty: 'paddingBlock',
|
|
12
|
-
},
|
|
13
|
-
paddingInline: {
|
|
14
|
-
cssProperty: 'paddingInline',
|
|
15
|
-
},
|
|
16
|
-
gap: {
|
|
17
|
-
cssProperty: 'gap',
|
|
18
|
-
},
|
|
19
|
-
columnGap: {
|
|
20
|
-
cssProperty: 'columnGap',
|
|
21
|
-
},
|
|
22
|
-
rowGap: {
|
|
23
|
-
cssProperty: 'rowGap',
|
|
24
|
-
},
|
|
25
|
-
} as const;
|
|
26
|
-
|
|
27
|
-
const onlySpaceTokens = tokens
|
|
28
|
-
.filter((token) => token.name.startsWith('space.'))
|
|
29
|
-
.filter((token) => !token.name.includes('.negative'));
|
|
30
|
-
|
|
31
|
-
const activeTokens = onlySpaceTokens.map((t) => ({
|
|
32
|
-
name: t.cleanName,
|
|
33
|
-
fallback: t.value,
|
|
34
|
-
}));
|
|
35
|
-
|
|
36
|
-
export const createSpacingStylesFromTemplate = (
|
|
37
|
-
spacingProperty: keyof typeof spacingProperties,
|
|
38
|
-
) => {
|
|
39
|
-
if (!spacingProperties[spacingProperty]) {
|
|
40
|
-
throw new Error(`[codegen] Unknown option found "${spacingProperty}"`);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const { cssProperty } = spacingProperties[spacingProperty];
|
|
44
|
-
|
|
45
|
-
return (format(
|
|
46
|
-
`
|
|
47
|
-
const ${spacingProperty}Map = {
|
|
48
|
-
${activeTokens
|
|
49
|
-
.sort((a, b) => (a.name < b.name ? -1 : 1))
|
|
50
|
-
.map((token) => {
|
|
51
|
-
const propName = token.name;
|
|
52
|
-
return `'${propName}': ${tokenToStyle(
|
|
53
|
-
cssProperty,
|
|
54
|
-
token.name,
|
|
55
|
-
token.fallback,
|
|
56
|
-
)}`;
|
|
57
|
-
})
|
|
58
|
-
.join(',\n\t')}
|
|
59
|
-
};`,
|
|
60
|
-
'typescript',
|
|
61
|
-
) +
|
|
62
|
-
`\nexport type ${capitalize(
|
|
63
|
-
spacingProperty,
|
|
64
|
-
)} = keyof typeof ${spacingProperty}Map;\n`
|
|
65
|
-
);
|
|
66
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import format from '@af/formatting/sync';
|
|
2
|
-
import { spacing as tokens } from '@atlaskit/tokens/tokens-raw';
|
|
3
|
-
|
|
4
|
-
const onlySpaceTokens = tokens
|
|
5
|
-
.filter((token) => token.name.startsWith('space.'))
|
|
6
|
-
.filter((token) => !token.name.includes('.negative'));
|
|
7
|
-
|
|
8
|
-
const activeTokens = onlySpaceTokens.map((t) => `'${t.cleanName}'`);
|
|
9
|
-
|
|
10
|
-
export const createSpacingScaleTemplate = () => {
|
|
11
|
-
return format(
|
|
12
|
-
`
|
|
13
|
-
export const spacingScale = [
|
|
14
|
-
${activeTokens
|
|
15
|
-
.sort((a, b) => {
|
|
16
|
-
const spaceValueA = Number(a.match(/(\d+)/)![0]);
|
|
17
|
-
const spaceValueB = Number(b.match(/(\d+)/)![0]);
|
|
18
|
-
return spaceValueA < spaceValueB ? -1 : 1;
|
|
19
|
-
})
|
|
20
|
-
.join(',\n\t')}
|
|
21
|
-
] as const;`,
|
|
22
|
-
'typescript',
|
|
23
|
-
);
|
|
24
|
-
};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import format from '@af/formatting/sync';
|
|
2
|
-
import { typographyAdg3 as tokens } from '@atlaskit/tokens/tokens-raw';
|
|
3
|
-
|
|
4
|
-
import { capitalize, tokenToStyle } from './utils';
|
|
5
|
-
|
|
6
|
-
type Token = {
|
|
7
|
-
name: string;
|
|
8
|
-
fallback: string;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const typographyProperties = {
|
|
12
|
-
fontSize: {
|
|
13
|
-
cssProperty: 'fontSize',
|
|
14
|
-
prefix: 'font.',
|
|
15
|
-
filterFn: <T extends Token>(t: T) => t.name.startsWith('font.size'),
|
|
16
|
-
},
|
|
17
|
-
fontWeight: {
|
|
18
|
-
cssProperty: 'fontWeight',
|
|
19
|
-
prefix: 'font.weight.',
|
|
20
|
-
filterFn: <T extends Token>(t: T) => t.name.startsWith('font.weight'),
|
|
21
|
-
},
|
|
22
|
-
fontFamily: {
|
|
23
|
-
cssProperty: 'fontFamily',
|
|
24
|
-
prefix: 'font.family.',
|
|
25
|
-
filterFn: <T extends Token>(t: T) => t.name.startsWith('font.family'),
|
|
26
|
-
},
|
|
27
|
-
lineHeight: {
|
|
28
|
-
cssProperty: 'lineHeight',
|
|
29
|
-
prefix: 'font.',
|
|
30
|
-
filterFn: <T extends Token>(t: T) => t.name.startsWith('font.lineHeight'),
|
|
31
|
-
},
|
|
32
|
-
} as const;
|
|
33
|
-
|
|
34
|
-
const activeTokens: Token[] = tokens.map((t) => ({
|
|
35
|
-
name: t.name,
|
|
36
|
-
fallback: t.value,
|
|
37
|
-
}));
|
|
38
|
-
|
|
39
|
-
export const createTypographyStylesFromTemplate = (
|
|
40
|
-
typographyProperty: keyof typeof typographyProperties,
|
|
41
|
-
) => {
|
|
42
|
-
if (!typographyProperties[typographyProperty]) {
|
|
43
|
-
throw new Error(`[codegen] Unknown option found "${typographyProperty}"`);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const { cssProperty, prefix, filterFn } =
|
|
47
|
-
typographyProperties[typographyProperty];
|
|
48
|
-
|
|
49
|
-
return (format(
|
|
50
|
-
`
|
|
51
|
-
const ${typographyProperty}Map = {
|
|
52
|
-
${activeTokens
|
|
53
|
-
.filter(filterFn)
|
|
54
|
-
.sort((a, b) => (a.name < b.name ? -1 : 1))
|
|
55
|
-
.map((token) => {
|
|
56
|
-
const propName = token.name.replace(prefix, '');
|
|
57
|
-
|
|
58
|
-
return `'${propName}': ${tokenToStyle(
|
|
59
|
-
cssProperty,
|
|
60
|
-
token.name,
|
|
61
|
-
token.fallback,
|
|
62
|
-
)}`;
|
|
63
|
-
})
|
|
64
|
-
.join(',\n\t')}
|
|
65
|
-
};`,
|
|
66
|
-
'typescript',
|
|
67
|
-
) +
|
|
68
|
-
`\nexport type ${capitalize(
|
|
69
|
-
typographyProperty,
|
|
70
|
-
)} = keyof typeof ${typographyProperty}Map;\n`
|
|
71
|
-
);
|
|
72
|
-
};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { queryByAttribute, render, screen } from '@testing-library/react';
|
|
4
|
-
|
|
5
|
-
import { UNSAFE_Text as Text } from '../../../index';
|
|
6
|
-
|
|
7
|
-
describe('Text component', () => {
|
|
8
|
-
it('should render given text', () => {
|
|
9
|
-
render(<Text>Text</Text>);
|
|
10
|
-
expect(screen.getByText('Text')).toBeInTheDocument();
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('should not render redundant DOM nodes', () => {
|
|
14
|
-
render(
|
|
15
|
-
<Text testId="test">
|
|
16
|
-
<Text>Text</Text>
|
|
17
|
-
</Text>,
|
|
18
|
-
);
|
|
19
|
-
expect(screen.getByTestId('test')).toMatchInlineSnapshot(`
|
|
20
|
-
.emotion-0 {
|
|
21
|
-
box-sizing: border-box;
|
|
22
|
-
margin: var(--ds-space-0, 0px);
|
|
23
|
-
padding: var(--ds-space-0, 0px);
|
|
24
|
-
font-family: var(--ds-font-family-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
<span
|
|
28
|
-
class="emotion-0"
|
|
29
|
-
data-testid="test"
|
|
30
|
-
>
|
|
31
|
-
Text
|
|
32
|
-
</span>
|
|
33
|
-
`);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('should render with given test id', () => {
|
|
37
|
-
render(<Text testId="test">Text</Text>);
|
|
38
|
-
expect(screen.getByTestId('test')).toBeInTheDocument();
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('should render with id attribute', () => {
|
|
42
|
-
const id = 'some-id';
|
|
43
|
-
const { container } = render(<Text id={id}>Text</Text>);
|
|
44
|
-
const queryById = queryByAttribute.bind(null, 'id');
|
|
45
|
-
const component = queryById(container, id);
|
|
46
|
-
expect(component).toBeDefined();
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
describe('"as" prop behaviour', () => {
|
|
50
|
-
it('renders without errors when a valid "as" value is given', () => {
|
|
51
|
-
render(<Text as="div">Text</Text>);
|
|
52
|
-
expect(screen.getByText('Text')).toBeInTheDocument();
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('throws when an invalid "as" value is given', () => {
|
|
56
|
-
// @ts-ignore purposefully providing an invalid value to test invariant behaviour
|
|
57
|
-
expect(() => render(<Text as="address">Text</Text>)).toThrow(
|
|
58
|
-
new Error(
|
|
59
|
-
'Invariant failed: @atlaskit/ds-explorations: Text received an invalid "as" value of "address"',
|
|
60
|
-
),
|
|
61
|
-
);
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
});
|
package/src/components/__tests__/vr-tests/__snapshots__/text-snapshot-test/text--default.png
DELETED
|
Binary file
|
|
@@ -1,375 +0,0 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
import { createContext, type FC, Fragment, type ReactNode, useContext } from 'react';
|
|
3
|
-
|
|
4
|
-
import { css, jsx } from '@emotion/react';
|
|
5
|
-
import invariant from 'tiny-invariant';
|
|
6
|
-
|
|
7
|
-
import { token } from '@atlaskit/tokens';
|
|
8
|
-
|
|
9
|
-
import surfaceColorMap from '../internal/color-map';
|
|
10
|
-
|
|
11
|
-
import { useSurface } from './surface-provider';
|
|
12
|
-
import type { BasePrimitiveProps } from './types';
|
|
13
|
-
|
|
14
|
-
const asAllowlist = ['span', 'div', 'p', 'strong'] as const;
|
|
15
|
-
type AsElement = (typeof asAllowlist)[number];
|
|
16
|
-
export interface TextProps extends BasePrimitiveProps {
|
|
17
|
-
/**
|
|
18
|
-
* HTML tag to be rendered. Defaults to `span`.
|
|
19
|
-
*/
|
|
20
|
-
as?: AsElement;
|
|
21
|
-
/**
|
|
22
|
-
* Elements rendered within the Text element
|
|
23
|
-
*/
|
|
24
|
-
children: ReactNode;
|
|
25
|
-
/**
|
|
26
|
-
* Text color
|
|
27
|
-
*/
|
|
28
|
-
color?: TextColor;
|
|
29
|
-
/**
|
|
30
|
-
* The HTML id attribute https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
|
|
31
|
-
*/
|
|
32
|
-
id?: string;
|
|
33
|
-
/**
|
|
34
|
-
* Font size https://developer.mozilla.org/en-US/docs/Web/CSS/font-size
|
|
35
|
-
*/
|
|
36
|
-
fontSize?: FontSize;
|
|
37
|
-
/**
|
|
38
|
-
* Font weight https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight
|
|
39
|
-
*/
|
|
40
|
-
fontWeight?: FontWeight;
|
|
41
|
-
/**
|
|
42
|
-
* Line height https://developer.mozilla.org/en-US/docs/Web/CSS/line-height
|
|
43
|
-
*/
|
|
44
|
-
lineHeight?: LineHeight;
|
|
45
|
-
/**
|
|
46
|
-
* Truncates text with an ellipsis when text overflows its parent container
|
|
47
|
-
* (i.e. `width` has been set on parent that is shorter than text length).
|
|
48
|
-
*/
|
|
49
|
-
shouldTruncate?: boolean;
|
|
50
|
-
/**
|
|
51
|
-
* Text align https://developer.mozilla.org/en-US/docs/Web/CSS/text-align
|
|
52
|
-
*/
|
|
53
|
-
textAlign?: TextAlign;
|
|
54
|
-
/**
|
|
55
|
-
* Text transform https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform
|
|
56
|
-
*/
|
|
57
|
-
textTransform?: TextTransform;
|
|
58
|
-
/**
|
|
59
|
-
* Vertical align https://developer.mozilla.org/en-US/docs/Web/CSS/vertical-align
|
|
60
|
-
*/
|
|
61
|
-
verticalAlign?: VerticalAlign;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
type TextAlign = keyof typeof textAlignMap;
|
|
65
|
-
const textAlignMap = {
|
|
66
|
-
center: css({ textAlign: 'center' }),
|
|
67
|
-
end: css({ textAlign: 'end' }),
|
|
68
|
-
start: css({ textAlign: 'start' }),
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
type TextTransform = keyof typeof textTransformMap;
|
|
72
|
-
const textTransformMap = {
|
|
73
|
-
none: css({ textTransform: 'none' }),
|
|
74
|
-
lowercase: css({ textTransform: 'lowercase' }),
|
|
75
|
-
uppercase: css({ textTransform: 'uppercase' }),
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
type VerticalAlign = keyof typeof verticalAlignMap;
|
|
79
|
-
const verticalAlignMap = {
|
|
80
|
-
top: css({ verticalAlign: 'top' }),
|
|
81
|
-
middle: css({ verticalAlign: 'middle' }),
|
|
82
|
-
bottom: css({ verticalAlign: 'bottom' }),
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
const baseStyles = css({
|
|
86
|
-
boxSizing: 'border-box',
|
|
87
|
-
margin: token('space.0', '0px'),
|
|
88
|
-
padding: token('space.0', '0px'),
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
const truncateStyles = css({
|
|
92
|
-
overflow: 'hidden',
|
|
93
|
-
textOverflow: 'ellipsis',
|
|
94
|
-
whiteSpace: 'nowrap',
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* 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.
|
|
99
|
-
*/
|
|
100
|
-
const useColor = (colorProp: TextColor): NonNullable<TextColor> => {
|
|
101
|
-
const surface = useSurface();
|
|
102
|
-
const inverseTextColor =
|
|
103
|
-
surfaceColorMap[surface as keyof typeof surfaceColorMap];
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Where the color of the surface is inverted we override the user choice
|
|
107
|
-
* as there is no valid choice that is not covered by the override.
|
|
108
|
-
*/
|
|
109
|
-
const color = inverseTextColor ?? colorProp;
|
|
110
|
-
|
|
111
|
-
return color;
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
const HasTextAncestorContext = createContext(false);
|
|
115
|
-
const useHasTextAncestor = () => useContext(HasTextAncestorContext);
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* __Text__
|
|
119
|
-
*
|
|
120
|
-
* Text is a primitive component that has the Atlassian Design System's design guidelines baked in.
|
|
121
|
-
* This includes considerations for text attributes such as color, font size, font weight, and line height.
|
|
122
|
-
* It renders a `span` by default.
|
|
123
|
-
*
|
|
124
|
-
* @internal
|
|
125
|
-
*/
|
|
126
|
-
const Text: FC<TextProps> = ({ children, ...props }) => {
|
|
127
|
-
const {
|
|
128
|
-
as: Component = 'span',
|
|
129
|
-
color: colorProp,
|
|
130
|
-
fontSize,
|
|
131
|
-
fontWeight,
|
|
132
|
-
lineHeight,
|
|
133
|
-
shouldTruncate = false,
|
|
134
|
-
textAlign,
|
|
135
|
-
textTransform,
|
|
136
|
-
verticalAlign,
|
|
137
|
-
testId,
|
|
138
|
-
UNSAFE_style,
|
|
139
|
-
id,
|
|
140
|
-
} = props;
|
|
141
|
-
invariant(
|
|
142
|
-
asAllowlist.includes(Component),
|
|
143
|
-
`@atlaskit/ds-explorations: Text received an invalid "as" value of "${Component}"`,
|
|
144
|
-
);
|
|
145
|
-
const color = useColor(colorProp!);
|
|
146
|
-
const isWrapped = useHasTextAncestor();
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* If the text is already wrapped and applies no props we can just
|
|
150
|
-
* render the children directly as a fragment.
|
|
151
|
-
*/
|
|
152
|
-
if (isWrapped && Object.keys(props).length === 0) {
|
|
153
|
-
return <Fragment>{children}</Fragment>;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
const component = (
|
|
157
|
-
<Component
|
|
158
|
-
style={UNSAFE_style}
|
|
159
|
-
css={[
|
|
160
|
-
baseStyles,
|
|
161
|
-
fontFamilyMap.sans,
|
|
162
|
-
color && textColorMap[color],
|
|
163
|
-
fontSize && fontSizeMap[fontSize],
|
|
164
|
-
fontWeight && fontWeightMap[fontWeight],
|
|
165
|
-
lineHeight && lineHeightMap[lineHeight],
|
|
166
|
-
shouldTruncate && truncateStyles,
|
|
167
|
-
textAlign && textAlignMap[textAlign],
|
|
168
|
-
textTransform && textTransformMap[textTransform],
|
|
169
|
-
verticalAlign && verticalAlignMap[verticalAlign],
|
|
170
|
-
]}
|
|
171
|
-
data-testid={testId}
|
|
172
|
-
id={id}
|
|
173
|
-
>
|
|
174
|
-
{children}
|
|
175
|
-
</Component>
|
|
176
|
-
);
|
|
177
|
-
|
|
178
|
-
return isWrapped ? (
|
|
179
|
-
// no need to re-apply context if the text is already wrapped
|
|
180
|
-
component
|
|
181
|
-
) : (
|
|
182
|
-
<HasTextAncestorContext.Provider value={true}>
|
|
183
|
-
{component}
|
|
184
|
-
</HasTextAncestorContext.Provider>
|
|
185
|
-
);
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
export default Text;
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
192
|
-
* @codegen <<SignedSource::c5a6cec604462dc4b48aaf1160b83e59>>
|
|
193
|
-
* @codegenId typography
|
|
194
|
-
* @codegenCommand yarn codegen-styles
|
|
195
|
-
* @codegenParams ["fontSize", "fontWeight", "fontFamily", "lineHeight"]
|
|
196
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-typography-adg3.tsx <<SignedSource::bf3349cf2247aa44fbac47c953fc03b5>>
|
|
197
|
-
*/
|
|
198
|
-
const fontSizeMap = {
|
|
199
|
-
'size.050': css({
|
|
200
|
-
fontSize: token('font.size.050', '11px'),
|
|
201
|
-
}),
|
|
202
|
-
'size.075': css({
|
|
203
|
-
fontSize: token('font.size.075', '12px'),
|
|
204
|
-
}),
|
|
205
|
-
'size.100': css({
|
|
206
|
-
fontSize: token('font.size.100', '14px'),
|
|
207
|
-
}),
|
|
208
|
-
'size.200': css({
|
|
209
|
-
fontSize: token('font.size.200', '16px'),
|
|
210
|
-
}),
|
|
211
|
-
'size.300': css({
|
|
212
|
-
fontSize: token('font.size.300', '20px'),
|
|
213
|
-
}),
|
|
214
|
-
'size.400': css({
|
|
215
|
-
fontSize: token('font.size.400', '24px'),
|
|
216
|
-
}),
|
|
217
|
-
'size.500': css({
|
|
218
|
-
fontSize: token('font.size.500', '29px'),
|
|
219
|
-
}),
|
|
220
|
-
'size.600': css({
|
|
221
|
-
fontSize: token('font.size.600', '35px'),
|
|
222
|
-
}),
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
export type FontSize = keyof typeof fontSizeMap;
|
|
226
|
-
|
|
227
|
-
const fontWeightMap = {
|
|
228
|
-
bold: css({
|
|
229
|
-
fontWeight: token('font.weight.bold', '700'),
|
|
230
|
-
}),
|
|
231
|
-
medium: css({
|
|
232
|
-
fontWeight: token('font.weight.medium', '500'),
|
|
233
|
-
}),
|
|
234
|
-
regular: css({
|
|
235
|
-
fontWeight: token('font.weight.regular', '400'),
|
|
236
|
-
}),
|
|
237
|
-
semibold: css({
|
|
238
|
-
fontWeight: token('font.weight.semibold', '600'),
|
|
239
|
-
}),
|
|
240
|
-
};
|
|
241
|
-
|
|
242
|
-
export type FontWeight = keyof typeof fontWeightMap;
|
|
243
|
-
|
|
244
|
-
const fontFamilyMap = {
|
|
245
|
-
body: css({
|
|
246
|
-
fontFamily: token(
|
|
247
|
-
'font.family.body',
|
|
248
|
-
'ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Ubuntu, system-ui, "Helvetica Neue", sans-serif',
|
|
249
|
-
),
|
|
250
|
-
}),
|
|
251
|
-
'brand.body': css({
|
|
252
|
-
fontFamily: token(
|
|
253
|
-
'font.family.brand.body',
|
|
254
|
-
'"Charlie Text", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Ubuntu, system-ui, "Helvetica Neue", sans-serif',
|
|
255
|
-
),
|
|
256
|
-
}),
|
|
257
|
-
'brand.heading': css({
|
|
258
|
-
fontFamily: token(
|
|
259
|
-
'font.family.brand.heading',
|
|
260
|
-
'"Charlie Display", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Ubuntu, system-ui, "Helvetica Neue", sans-serif',
|
|
261
|
-
),
|
|
262
|
-
}),
|
|
263
|
-
code: css({
|
|
264
|
-
fontFamily: token(
|
|
265
|
-
'font.family.code',
|
|
266
|
-
'ui-monospace, Menlo, "Segoe UI Mono", "Ubuntu Mono", monospace',
|
|
267
|
-
),
|
|
268
|
-
}),
|
|
269
|
-
heading: css({
|
|
270
|
-
fontFamily: token(
|
|
271
|
-
'font.family.heading',
|
|
272
|
-
'ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Ubuntu, system-ui, "Helvetica Neue", sans-serif',
|
|
273
|
-
),
|
|
274
|
-
}),
|
|
275
|
-
monospace: css({
|
|
276
|
-
fontFamily: token(
|
|
277
|
-
'font.family.monospace',
|
|
278
|
-
'ui-monospace, Menlo, "Segoe UI Mono", "Ubuntu Mono", monospace',
|
|
279
|
-
),
|
|
280
|
-
}),
|
|
281
|
-
sans: css({
|
|
282
|
-
fontFamily: token(
|
|
283
|
-
'font.family.sans',
|
|
284
|
-
'-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif',
|
|
285
|
-
),
|
|
286
|
-
}),
|
|
287
|
-
};
|
|
288
|
-
|
|
289
|
-
export type FontFamily = keyof typeof fontFamilyMap;
|
|
290
|
-
|
|
291
|
-
const lineHeightMap = {
|
|
292
|
-
'lineHeight.1': css({
|
|
293
|
-
lineHeight: token('font.lineHeight.1', '1'),
|
|
294
|
-
}),
|
|
295
|
-
'lineHeight.100': css({
|
|
296
|
-
lineHeight: token('font.lineHeight.100', '16px'),
|
|
297
|
-
}),
|
|
298
|
-
'lineHeight.200': css({
|
|
299
|
-
lineHeight: token('font.lineHeight.200', '20px'),
|
|
300
|
-
}),
|
|
301
|
-
'lineHeight.300': css({
|
|
302
|
-
lineHeight: token('font.lineHeight.300', '24px'),
|
|
303
|
-
}),
|
|
304
|
-
'lineHeight.400': css({
|
|
305
|
-
lineHeight: token('font.lineHeight.400', '28px'),
|
|
306
|
-
}),
|
|
307
|
-
'lineHeight.500': css({
|
|
308
|
-
lineHeight: token('font.lineHeight.500', '32px'),
|
|
309
|
-
}),
|
|
310
|
-
'lineHeight.600': css({
|
|
311
|
-
lineHeight: token('font.lineHeight.600', '40px'),
|
|
312
|
-
}),
|
|
313
|
-
};
|
|
314
|
-
|
|
315
|
-
export type LineHeight = keyof typeof lineHeightMap;
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* @codegenEnd
|
|
319
|
-
*/
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
323
|
-
* @codegen <<SignedSource::db9171c09481d187d83bb01192c16c41>>
|
|
324
|
-
* @codegenId colors
|
|
325
|
-
* @codegenCommand yarn codegen-styles
|
|
326
|
-
* @codegenParams ["text"]
|
|
327
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f27d1519d51cc4a85383a00907847774>>
|
|
328
|
-
*/
|
|
329
|
-
const textColorMap = {
|
|
330
|
-
'color.text': css({
|
|
331
|
-
color: token('color.text', '#172B4D'),
|
|
332
|
-
}),
|
|
333
|
-
disabled: css({
|
|
334
|
-
color: token('color.text.disabled', '#A5ADBA'),
|
|
335
|
-
}),
|
|
336
|
-
inverse: css({
|
|
337
|
-
color: token('color.text.inverse', '#FFFFFF'),
|
|
338
|
-
}),
|
|
339
|
-
selected: css({
|
|
340
|
-
color: token('color.text.selected', '#0052CC'),
|
|
341
|
-
}),
|
|
342
|
-
brand: css({
|
|
343
|
-
color: token('color.text.brand', '#0065FF'),
|
|
344
|
-
}),
|
|
345
|
-
danger: css({
|
|
346
|
-
color: token('color.text.danger', '#DE350B'),
|
|
347
|
-
}),
|
|
348
|
-
warning: css({
|
|
349
|
-
color: token('color.text.warning', '#974F0C'),
|
|
350
|
-
}),
|
|
351
|
-
'warning.inverse': css({
|
|
352
|
-
color: token('color.text.warning.inverse', '#172B4D'),
|
|
353
|
-
}),
|
|
354
|
-
success: css({
|
|
355
|
-
color: token('color.text.success', '#006644'),
|
|
356
|
-
}),
|
|
357
|
-
discovery: css({
|
|
358
|
-
color: token('color.text.discovery', '#403294'),
|
|
359
|
-
}),
|
|
360
|
-
information: css({
|
|
361
|
-
color: token('color.text.information', '#0052CC'),
|
|
362
|
-
}),
|
|
363
|
-
subtlest: css({
|
|
364
|
-
color: token('color.text.subtlest', '#7A869A'),
|
|
365
|
-
}),
|
|
366
|
-
subtle: css({
|
|
367
|
-
color: token('color.text.subtle', '#42526E'),
|
|
368
|
-
}),
|
|
369
|
-
} as const;
|
|
370
|
-
|
|
371
|
-
export type TextColor = keyof typeof textColorMap;
|
|
372
|
-
|
|
373
|
-
/**
|
|
374
|
-
* @codegenEnd
|
|
375
|
-
*/
|
|
@@ -1,24 +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 = [
|
|
10
|
-
'space.0',
|
|
11
|
-
'space.025',
|
|
12
|
-
'space.050',
|
|
13
|
-
'space.075',
|
|
14
|
-
'space.100',
|
|
15
|
-
'space.150',
|
|
16
|
-
'space.200',
|
|
17
|
-
'space.250',
|
|
18
|
-
'space.300',
|
|
19
|
-
'space.400',
|
|
20
|
-
'space.500',
|
|
21
|
-
'space.600',
|
|
22
|
-
'space.800',
|
|
23
|
-
'space.1000',
|
|
24
|
-
] as const;
|
package/text/package.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@atlaskit/ds-explorations/text",
|
|
3
|
-
"main": "../dist/cjs/components/text.partial.js",
|
|
4
|
-
"module": "../dist/esm/components/text.partial.js",
|
|
5
|
-
"module:es2019": "../dist/es2019/components/text.partial.js",
|
|
6
|
-
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/components/text.partial.d.ts",
|
|
8
|
-
"typesVersions": {
|
|
9
|
-
">=4.5 <5.4": {
|
|
10
|
-
"*": [
|
|
11
|
-
"../dist/types-ts4.5/components/text.partial.d.ts"
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|