@atlaskit/ds-explorations 2.3.2 → 2.4.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 +6 -0
- package/box/package.json +15 -0
- package/dist/cjs/components/box.partial.js +620 -0
- package/dist/cjs/components/inline.partial.js +182 -0
- package/dist/cjs/components/stack.partial.js +148 -0
- package/dist/cjs/index.js +21 -0
- package/dist/es2019/components/box.partial.js +614 -0
- package/dist/es2019/components/inline.partial.js +177 -0
- package/dist/es2019/components/stack.partial.js +144 -0
- package/dist/es2019/index.js +3 -0
- package/dist/esm/components/box.partial.js +617 -0
- package/dist/esm/components/inline.partial.js +177 -0
- package/dist/esm/components/stack.partial.js +143 -0
- package/dist/esm/index.js +3 -0
- package/dist/types/components/box.partial.d.ts +357 -0
- package/dist/types/components/inline.partial.d.ts +108 -0
- package/dist/types/components/stack.partial.d.ts +92 -0
- package/dist/types/components/surface-provider.d.ts +2 -2
- package/dist/types/index.d.ts +6 -0
- package/dist/types-ts4.5/components/box.partial.d.ts +357 -0
- package/dist/types-ts4.5/components/inline.partial.d.ts +108 -0
- package/dist/types-ts4.5/components/stack.partial.d.ts +92 -0
- package/dist/types-ts4.5/components/surface-provider.d.ts +2 -2
- package/dist/types-ts4.5/index.d.ts +6 -0
- package/examples/00-basic.tsx +22 -0
- package/examples/01-box.tsx +171 -0
- package/examples/02-text-advanced.tsx +20 -11
- package/examples/02-text.tsx +10 -15
- package/examples/03-stack.tsx +99 -0
- package/examples/04-inline.tsx +99 -0
- package/examples/05-badge.tsx +5 -9
- package/examples/06-section-message.tsx +4 -2
- package/examples/07-comment.tsx +3 -1
- package/examples/08-lozenge.tsx +4 -8
- package/examples/99-interactions.tsx +33 -49
- package/inline/package.json +15 -0
- package/package.json +5 -3
- package/report.api.md +465 -0
- package/scripts/codegen-styles.tsx +89 -16
- package/src/components/__tests__/unit/box.test.tsx +55 -0
- package/src/components/__tests__/unit/inline.test.tsx +43 -0
- package/src/components/__tests__/unit/interaction-suface.test.tsx +2 -2
- package/src/components/__tests__/unit/stack.test.tsx +31 -0
- package/src/components/__tests__/visual-regression/__image_snapshots__/inline-snapshot-test-tsx-inline-alignment-example-should-match-snapshot-1-snap.png +3 -0
- package/src/components/__tests__/visual-regression/__image_snapshots__/inline-snapshot-test-tsx-inline-spacing-example-should-match-snapshot-1-snap.png +3 -0
- package/src/components/__tests__/visual-regression/__image_snapshots__/stack-snapshot-test-tsx-stack-alignment-example-should-match-snapshot-1-snap.png +3 -0
- package/src/components/__tests__/visual-regression/__image_snapshots__/stack-snapshot-test-tsx-stack-spacing-example-should-match-snapshot-1-snap.png +3 -0
- package/src/components/__tests__/visual-regression/inline-snapshot-test.tsx +28 -0
- package/src/components/__tests__/visual-regression/stack-snapshot-test.tsx +28 -0
- package/src/components/__tests__/vr-tests/__snapshots__/box--default.png +0 -0
- package/src/components/__tests__/vr-tests/box-snapshot-test.vr.tsx +6 -0
- package/src/components/box.partial.tsx +706 -0
- package/src/components/inline.partial.tsx +218 -0
- package/src/components/stack.partial.tsx +174 -0
- package/src/components/surface-provider.tsx +1 -1
- package/src/index.tsx +6 -0
- package/stack/package.json +15 -0
- package/tmp/api-report-tmp.d.ts +451 -0
- package/tsconfig.app.json +0 -3
- package/tsconfig.dev.json +6 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { render } from '@testing-library/react';
|
|
4
|
+
|
|
5
|
+
import { token } from '@atlaskit/tokens';
|
|
6
|
+
|
|
7
|
+
import { UNSAFE_Box as Box, UNSAFE_Text as Text } from '../../../index';
|
|
8
|
+
|
|
9
|
+
describe('Box component', () => {
|
|
10
|
+
const testId = 'test';
|
|
11
|
+
|
|
12
|
+
it('should render box', () => {
|
|
13
|
+
const { getByText } = render(
|
|
14
|
+
<Box>
|
|
15
|
+
<Text>Box</Text>
|
|
16
|
+
</Box>,
|
|
17
|
+
);
|
|
18
|
+
expect(getByText('Box')).toBeInTheDocument();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
describe('with SurfaceContext', () => {
|
|
22
|
+
it('should respect text color when text sets its own color and bg is non-bold', () => {
|
|
23
|
+
const { getByText } = render(
|
|
24
|
+
<Box backgroundColor="information">
|
|
25
|
+
<Text color="color.text">Text</Text>
|
|
26
|
+
</Box>,
|
|
27
|
+
);
|
|
28
|
+
const element = getByText('Text');
|
|
29
|
+
expect(element).toHaveStyleDeclaration('color', token('color.text'));
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("should override text color when background won't meet contrast", () => {
|
|
33
|
+
const { getByText } = render(
|
|
34
|
+
<Box backgroundColor="brand.bold">
|
|
35
|
+
<Text color="disabled">Text</Text>
|
|
36
|
+
</Box>,
|
|
37
|
+
);
|
|
38
|
+
const element = getByText('Text');
|
|
39
|
+
expect(element).toHaveStyleDeclaration(
|
|
40
|
+
'color',
|
|
41
|
+
token('color.text.inverse', '#FFFFFF'),
|
|
42
|
+
);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('should render with a given test id', () => {
|
|
47
|
+
const { getByTestId } = render(
|
|
48
|
+
<Box testId={testId}>
|
|
49
|
+
<Text>Box with testid</Text>
|
|
50
|
+
</Box>,
|
|
51
|
+
);
|
|
52
|
+
const element = getByTestId(testId);
|
|
53
|
+
expect(element).toBeInTheDocument();
|
|
54
|
+
});
|
|
55
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { render } from '@testing-library/react';
|
|
4
|
+
|
|
5
|
+
import { UNSAFE_Inline as Inline, UNSAFE_Text as Text } from '../../../index';
|
|
6
|
+
|
|
7
|
+
describe('Inline component', () => {
|
|
8
|
+
const testId = 'test';
|
|
9
|
+
|
|
10
|
+
it('should render inline', () => {
|
|
11
|
+
const { getByText } = render(
|
|
12
|
+
<Inline gap="space.050">
|
|
13
|
+
<Text>1</Text>
|
|
14
|
+
<Text>2</Text>
|
|
15
|
+
</Inline>,
|
|
16
|
+
);
|
|
17
|
+
expect(getByText('1')).toBeInTheDocument();
|
|
18
|
+
expect(getByText('2')).toBeInTheDocument();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('should render inline with dividers', () => {
|
|
22
|
+
const { getByText } = render(
|
|
23
|
+
<Inline gap="space.050" divider="/">
|
|
24
|
+
<Text>1</Text>
|
|
25
|
+
<Text>2</Text>
|
|
26
|
+
</Inline>,
|
|
27
|
+
);
|
|
28
|
+
expect(getByText('1')).toBeInTheDocument();
|
|
29
|
+
expect(getByText('2')).toBeInTheDocument();
|
|
30
|
+
expect(getByText('/')).toBeInTheDocument();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('should render with a given test id', () => {
|
|
34
|
+
const { getByTestId } = render(
|
|
35
|
+
<Inline gap="space.050" testId={testId}>
|
|
36
|
+
<Text>1</Text>
|
|
37
|
+
<Text>2</Text>
|
|
38
|
+
</Inline>,
|
|
39
|
+
);
|
|
40
|
+
const element = getByTestId(testId);
|
|
41
|
+
expect(element).toBeInTheDocument();
|
|
42
|
+
});
|
|
43
|
+
});
|
|
@@ -2,10 +2,10 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { act, fireEvent, render } from '@testing-library/react';
|
|
4
4
|
|
|
5
|
-
import { Box } from '@atlaskit/primitives';
|
|
6
5
|
import { token } from '@atlaskit/tokens';
|
|
7
6
|
|
|
8
7
|
import {
|
|
8
|
+
UNSAFE_Box as Box,
|
|
9
9
|
UNSAFE_InteractionSurface as InteractionSurface,
|
|
10
10
|
UNSAFE_Text as Text,
|
|
11
11
|
} from '../../../index';
|
|
@@ -57,7 +57,7 @@ describe('InteractionSurface component', () => {
|
|
|
57
57
|
|
|
58
58
|
it('should render an inherited hover state if a Box context is present', () => {
|
|
59
59
|
const { getByTestId } = render(
|
|
60
|
-
<Box backgroundColor="
|
|
60
|
+
<Box backgroundColor="brand.bold">
|
|
61
61
|
<InteractionSurface testId="surface">
|
|
62
62
|
<Text>hello</Text>
|
|
63
63
|
</InteractionSurface>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { render } from '@testing-library/react';
|
|
4
|
+
|
|
5
|
+
import { UNSAFE_Stack as Stack, UNSAFE_Text as Text } from '../../../index';
|
|
6
|
+
|
|
7
|
+
describe('Stack component', () => {
|
|
8
|
+
const testId = 'test';
|
|
9
|
+
|
|
10
|
+
it('should render stack', () => {
|
|
11
|
+
const { getByText } = render(
|
|
12
|
+
<Stack gap="space.050">
|
|
13
|
+
<Text>1</Text>
|
|
14
|
+
<Text>2</Text>
|
|
15
|
+
</Stack>,
|
|
16
|
+
);
|
|
17
|
+
expect(getByText('1')).toBeInTheDocument();
|
|
18
|
+
expect(getByText('2')).toBeInTheDocument();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('should render with a given test id', () => {
|
|
22
|
+
const { getByTestId } = render(
|
|
23
|
+
<Stack gap="space.050" testId={testId}>
|
|
24
|
+
<Text>1</Text>
|
|
25
|
+
<Text>2</Text>
|
|
26
|
+
</Stack>,
|
|
27
|
+
);
|
|
28
|
+
const element = getByTestId(testId);
|
|
29
|
+
expect(element).toBeInTheDocument();
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getExampleUrl,
|
|
3
|
+
loadPage,
|
|
4
|
+
takeElementScreenShot,
|
|
5
|
+
} from '@atlaskit/visual-regression/helper';
|
|
6
|
+
|
|
7
|
+
describe('Inline', () => {
|
|
8
|
+
it.each(['spacing', 'alignment'])(
|
|
9
|
+
`%s example should match snapshot`,
|
|
10
|
+
async (selector) => {
|
|
11
|
+
const url = getExampleUrl(
|
|
12
|
+
'design-system',
|
|
13
|
+
'ds-explorations',
|
|
14
|
+
'inline',
|
|
15
|
+
global.__BASEURL__,
|
|
16
|
+
);
|
|
17
|
+
const { page } = global;
|
|
18
|
+
|
|
19
|
+
await loadPage(page, url);
|
|
20
|
+
|
|
21
|
+
const image = await takeElementScreenShot(
|
|
22
|
+
page,
|
|
23
|
+
`[data-testid="inline-${selector}"]`,
|
|
24
|
+
);
|
|
25
|
+
expect(image).toMatchProdImageSnapshot();
|
|
26
|
+
},
|
|
27
|
+
);
|
|
28
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getExampleUrl,
|
|
3
|
+
loadPage,
|
|
4
|
+
takeElementScreenShot,
|
|
5
|
+
} from '@atlaskit/visual-regression/helper';
|
|
6
|
+
|
|
7
|
+
describe('Stack', () => {
|
|
8
|
+
it.each(['spacing', 'alignment'])(
|
|
9
|
+
`%s example should match snapshot`,
|
|
10
|
+
async (selector) => {
|
|
11
|
+
const url = getExampleUrl(
|
|
12
|
+
'design-system',
|
|
13
|
+
'ds-explorations',
|
|
14
|
+
'stack',
|
|
15
|
+
global.__BASEURL__,
|
|
16
|
+
);
|
|
17
|
+
const { page } = global;
|
|
18
|
+
|
|
19
|
+
await loadPage(page, url);
|
|
20
|
+
|
|
21
|
+
const image = await takeElementScreenShot(
|
|
22
|
+
page,
|
|
23
|
+
`[data-testid="stack-${selector}"]`,
|
|
24
|
+
);
|
|
25
|
+
expect(image).toMatchProdImageSnapshot();
|
|
26
|
+
},
|
|
27
|
+
);
|
|
28
|
+
});
|
|
Binary file
|