@atlaskit/primitives 1.4.4 → 1.5.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 +10 -0
- package/constellation/heading/code.mdx +19 -0
- package/constellation/heading/examples.mdx +28 -0
- package/constellation/heading/usage.mdx +21 -0
- package/dist/cjs/components/box.js +1 -1
- package/dist/cjs/components/heading-context.js +44 -0
- package/dist/cjs/components/heading.js +95 -0
- package/dist/cjs/xcss/style-maps.partial.js +26 -5
- package/dist/es2019/components/box.js +2 -2
- package/dist/es2019/components/heading-context.js +35 -0
- package/dist/es2019/components/heading.js +87 -0
- package/dist/es2019/xcss/style-maps.partial.js +21 -4
- package/dist/esm/components/box.js +2 -2
- package/dist/esm/components/heading-context.js +34 -0
- package/dist/esm/components/heading.js +87 -0
- package/dist/esm/xcss/style-maps.partial.js +23 -4
- package/dist/types/components/heading-context.d.ts +31 -0
- package/dist/types/components/heading.d.ts +45 -0
- package/dist/types/components/internal/surface-provider.d.ts +2 -2
- package/dist/types/xcss/style-maps.partial.d.ts +20 -2
- package/dist/types-ts4.5/components/heading-context.d.ts +31 -0
- package/dist/types-ts4.5/components/heading.d.ts +45 -0
- package/dist/types-ts4.5/components/internal/surface-provider.d.ts +2 -2
- package/dist/types-ts4.5/xcss/style-maps.partial.d.ts +20 -2
- package/extract-react-types/box-props.tsx +3 -1
- package/extract-react-types/heading-props.tsx +3 -0
- package/heading/package.json +15 -0
- package/heading-context/package.json +15 -0
- package/package.json +14 -2
- package/report.api.md +1 -0
- package/scripts/__tests__/__snapshots__/codegen.test.tsx.snap +34 -0
- package/scripts/__tests__/codegen.test.tsx +4 -0
- package/scripts/color-codegen-template.tsx +9 -0
- package/tmp/api-report-tmp.d.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/primitives",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Primitives are token-backed low-level building blocks.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -108,6 +108,15 @@
|
|
|
108
108
|
"status": {
|
|
109
109
|
"type": "beta"
|
|
110
110
|
}
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"title": "Heading",
|
|
114
|
+
"folder": "heading",
|
|
115
|
+
"slug": "primitives/heading",
|
|
116
|
+
"id": "@atlaskit/primitives/heading",
|
|
117
|
+
"status": {
|
|
118
|
+
"type": "alpha"
|
|
119
|
+
}
|
|
111
120
|
}
|
|
112
121
|
]
|
|
113
122
|
}
|
|
@@ -127,6 +136,7 @@
|
|
|
127
136
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
128
137
|
},
|
|
129
138
|
"devDependencies": {
|
|
139
|
+
"@af/accessibility-testing": "*",
|
|
130
140
|
"@atlaskit/ds-lib": "*",
|
|
131
141
|
"@atlaskit/ssr": "*",
|
|
132
142
|
"@atlaskit/visual-regression": "*",
|
|
@@ -181,7 +191,9 @@
|
|
|
181
191
|
"./stack": "./src/components/stack.tsx",
|
|
182
192
|
"./inline": "./src/components/inline.tsx",
|
|
183
193
|
"./pressable": "./src/components/pressable.tsx",
|
|
194
|
+
"./heading": "./src/components/heading.tsx",
|
|
195
|
+
"./heading-context": "./src/components/heading-context.tsx",
|
|
184
196
|
"./responsive": "./src/responsive/index.tsx"
|
|
185
197
|
},
|
|
186
198
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
|
|
187
|
-
}
|
|
199
|
+
}
|
package/report.api.md
CHANGED
|
@@ -292,6 +292,7 @@ const backgroundColorMap: {
|
|
|
292
292
|
readonly 'elevation.surface.raised.hovered': 'var(--ds-surface-raised-hovered)';
|
|
293
293
|
readonly 'elevation.surface.raised.pressed': 'var(--ds-surface-raised-pressed)';
|
|
294
294
|
readonly 'elevation.surface.sunken': 'var(--ds-surface-sunken)';
|
|
295
|
+
readonly 'utility.elevation.surface.current': 'var(--ds-elevation-surface-current)';
|
|
295
296
|
};
|
|
296
297
|
|
|
297
298
|
// @public (undocumented)
|
|
@@ -727,6 +727,10 @@ exports[`@atlaskit/primitives bg styles are generated correctly 1`] = `
|
|
|
727
727
|
'#F4F5F7',
|
|
728
728
|
),
|
|
729
729
|
'elevation.surface.sunken': token('elevation.surface.sunken', '#F4F5F7'),
|
|
730
|
+
'utility.elevation.surface.current': token(
|
|
731
|
+
'utility.elevation.surface.current',
|
|
732
|
+
'#FFFFFF',
|
|
733
|
+
),
|
|
730
734
|
} as const;
|
|
731
735
|
|
|
732
736
|
export type BackgroundColor = keyof typeof backgroundColorMap;
|
|
@@ -767,6 +771,36 @@ export type BorderColor = keyof typeof borderColorMap;
|
|
|
767
771
|
"
|
|
768
772
|
`;
|
|
769
773
|
|
|
774
|
+
exports[`@atlaskit/primitives surface styles are generated correctly 1`] = `
|
|
775
|
+
"export const surfaceColorMap = {
|
|
776
|
+
'elevation.surface': token('elevation.surface', '#FFFFFF'),
|
|
777
|
+
'elevation.surface.hovered': token('elevation.surface.hovered', '#FAFBFC'),
|
|
778
|
+
'elevation.surface.pressed': token('elevation.surface.pressed', '#F4F5F7'),
|
|
779
|
+
'elevation.surface.overlay': token('elevation.surface.overlay', '#FFFFFF'),
|
|
780
|
+
'elevation.surface.overlay.hovered': token(
|
|
781
|
+
'elevation.surface.overlay.hovered',
|
|
782
|
+
'#FAFBFC',
|
|
783
|
+
),
|
|
784
|
+
'elevation.surface.overlay.pressed': token(
|
|
785
|
+
'elevation.surface.overlay.pressed',
|
|
786
|
+
'#F4F5F7',
|
|
787
|
+
),
|
|
788
|
+
'elevation.surface.raised': token('elevation.surface.raised', '#FFFFFF'),
|
|
789
|
+
'elevation.surface.raised.hovered': token(
|
|
790
|
+
'elevation.surface.raised.hovered',
|
|
791
|
+
'#FAFBFC',
|
|
792
|
+
),
|
|
793
|
+
'elevation.surface.raised.pressed': token(
|
|
794
|
+
'elevation.surface.raised.pressed',
|
|
795
|
+
'#F4F5F7',
|
|
796
|
+
),
|
|
797
|
+
'elevation.surface.sunken': token('elevation.surface.sunken', '#F4F5F7'),
|
|
798
|
+
} as const;
|
|
799
|
+
|
|
800
|
+
export type SurfaceColor = keyof typeof surfaceColorMap;
|
|
801
|
+
"
|
|
802
|
+
`;
|
|
803
|
+
|
|
770
804
|
exports[`@atlaskit/primitives text styles are generated correctly 1`] = `
|
|
771
805
|
"export const textColorMap = {
|
|
772
806
|
'color.text': token('color.text', '#172B4D'),
|
|
@@ -12,6 +12,10 @@ describe('@atlaskit/primitives', () => {
|
|
|
12
12
|
expect(createColorStylesFromTemplate('border')).toMatchSnapshot();
|
|
13
13
|
});
|
|
14
14
|
|
|
15
|
+
test('surface styles are generated correctly', () => {
|
|
16
|
+
expect(createColorStylesFromTemplate('surface')).toMatchSnapshot();
|
|
17
|
+
});
|
|
18
|
+
|
|
15
19
|
test('incorrect config throws', () => {
|
|
16
20
|
expect(() =>
|
|
17
21
|
createColorStylesFromTemplate('fizzbuzz' as any),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import prettier from 'prettier';
|
|
2
2
|
import parserTypeScript from 'prettier/parser-typescript';
|
|
3
3
|
|
|
4
|
+
import { CURRENT_SURFACE_CSS_VAR } from '@atlaskit/tokens';
|
|
4
5
|
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
5
6
|
import legacyTokens from '@atlaskit/tokens/src/artifacts/tokens-raw/atlassian-legacy-light';
|
|
6
7
|
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
@@ -35,6 +36,7 @@ const tokenStyles = {
|
|
|
35
36
|
filterFn: <T extends Token>(t: T) =>
|
|
36
37
|
t.token.startsWith(tokenStyles.background.prefix) ||
|
|
37
38
|
t.token.startsWith('elevation.surface') ||
|
|
39
|
+
t.token.startsWith('utility.elevation.surface') ||
|
|
38
40
|
t.token.startsWith('color.blanket'),
|
|
39
41
|
},
|
|
40
42
|
border: {
|
|
@@ -58,6 +60,13 @@ const tokenStyles = {
|
|
|
58
60
|
filterFn: <T extends Token>(t: T) =>
|
|
59
61
|
t.token.startsWith(tokenStyles.fill.prefix),
|
|
60
62
|
},
|
|
63
|
+
surface: {
|
|
64
|
+
objectName: 'surfaceColor',
|
|
65
|
+
prefix: 'elevation.surface.',
|
|
66
|
+
cssProperty: CURRENT_SURFACE_CSS_VAR,
|
|
67
|
+
filterFn: <T extends Token>(t: T) =>
|
|
68
|
+
t.token.startsWith(tokenStyles.surface.prefix),
|
|
69
|
+
},
|
|
61
70
|
} as const;
|
|
62
71
|
|
|
63
72
|
const bothTokens = tokens.map((t, i) => [t, legacyTokens[i]]);
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -276,6 +276,7 @@ const backgroundColorMap: {
|
|
|
276
276
|
readonly 'elevation.surface.raised.hovered': "var(--ds-surface-raised-hovered)";
|
|
277
277
|
readonly 'elevation.surface.raised.pressed': "var(--ds-surface-raised-pressed)";
|
|
278
278
|
readonly 'elevation.surface.sunken': "var(--ds-surface-sunken)";
|
|
279
|
+
readonly 'utility.elevation.surface.current': "var(--ds-elevation-surface-current)";
|
|
279
280
|
};
|
|
280
281
|
|
|
281
282
|
// @public (undocumented)
|