@atlaskit/ds-explorations 2.2.15 → 2.3.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.
Files changed (76) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/components/interaction-surface.partial.js +2 -2
  3. package/dist/cjs/components/text.partial.js +2 -2
  4. package/dist/cjs/index.js +0 -21
  5. package/dist/cjs/internal/color-map.js +2 -2
  6. package/dist/es2019/components/interaction-surface.partial.js +2 -2
  7. package/dist/es2019/components/text.partial.js +2 -2
  8. package/dist/es2019/index.js +0 -3
  9. package/dist/es2019/internal/color-map.js +2 -2
  10. package/dist/esm/components/interaction-surface.partial.js +2 -2
  11. package/dist/esm/components/text.partial.js +2 -2
  12. package/dist/esm/index.js +0 -3
  13. package/dist/esm/internal/color-map.js +2 -2
  14. package/dist/types/components/surface-provider.d.ts +2 -2
  15. package/dist/types/components/text.partial.d.ts +2 -2
  16. package/dist/types/index.d.ts +0 -6
  17. package/dist/types/internal/color-map.d.ts +2 -2
  18. package/dist/types-ts4.5/components/surface-provider.d.ts +2 -2
  19. package/dist/types-ts4.5/components/text.partial.d.ts +2 -2
  20. package/dist/types-ts4.5/index.d.ts +0 -6
  21. package/dist/types-ts4.5/internal/color-map.d.ts +2 -2
  22. package/examples/02-text-advanced.tsx +11 -20
  23. package/examples/02-text.tsx +15 -10
  24. package/examples/05-badge.tsx +9 -5
  25. package/examples/06-section-message.tsx +2 -4
  26. package/examples/07-comment.tsx +1 -3
  27. package/examples/08-lozenge.tsx +8 -4
  28. package/examples/99-interactions.tsx +49 -33
  29. package/package.json +4 -6
  30. package/report.api.md +0 -465
  31. package/scripts/codegen-styles.tsx +16 -89
  32. package/src/components/__tests__/unit/interaction-suface.test.tsx +2 -2
  33. package/src/components/interaction-surface.partial.tsx +2 -2
  34. package/src/components/surface-provider.tsx +1 -1
  35. package/src/components/text.partial.tsx +2 -2
  36. package/src/index.tsx +0 -6
  37. package/src/internal/color-map.tsx +2 -2
  38. package/tmp/api-report-tmp.d.ts +0 -451
  39. package/tsconfig.app.json +3 -0
  40. package/tsconfig.dev.json +0 -6
  41. package/box/package.json +0 -15
  42. package/dist/cjs/components/box.partial.js +0 -622
  43. package/dist/cjs/components/inline.partial.js +0 -183
  44. package/dist/cjs/components/stack.partial.js +0 -149
  45. package/dist/es2019/components/box.partial.js +0 -614
  46. package/dist/es2019/components/inline.partial.js +0 -177
  47. package/dist/es2019/components/stack.partial.js +0 -144
  48. package/dist/esm/components/box.partial.js +0 -617
  49. package/dist/esm/components/inline.partial.js +0 -177
  50. package/dist/esm/components/stack.partial.js +0 -143
  51. package/dist/types/components/box.partial.d.ts +0 -357
  52. package/dist/types/components/inline.partial.d.ts +0 -108
  53. package/dist/types/components/stack.partial.d.ts +0 -92
  54. package/dist/types-ts4.5/components/box.partial.d.ts +0 -357
  55. package/dist/types-ts4.5/components/inline.partial.d.ts +0 -108
  56. package/dist/types-ts4.5/components/stack.partial.d.ts +0 -92
  57. package/examples/00-basic.tsx +0 -22
  58. package/examples/01-box.tsx +0 -171
  59. package/examples/03-stack.tsx +0 -99
  60. package/examples/04-inline.tsx +0 -99
  61. package/inline/package.json +0 -15
  62. package/src/components/__tests__/unit/box.test.tsx +0 -55
  63. package/src/components/__tests__/unit/inline.test.tsx +0 -43
  64. package/src/components/__tests__/unit/stack.test.tsx +0 -31
  65. package/src/components/__tests__/visual-regression/__image_snapshots__/inline-snapshot-test-tsx-inline-alignment-example-should-match-snapshot-1-snap.png +0 -3
  66. package/src/components/__tests__/visual-regression/__image_snapshots__/inline-snapshot-test-tsx-inline-spacing-example-should-match-snapshot-1-snap.png +0 -3
  67. package/src/components/__tests__/visual-regression/__image_snapshots__/stack-snapshot-test-tsx-stack-alignment-example-should-match-snapshot-1-snap.png +0 -3
  68. package/src/components/__tests__/visual-regression/__image_snapshots__/stack-snapshot-test-tsx-stack-spacing-example-should-match-snapshot-1-snap.png +0 -3
  69. package/src/components/__tests__/visual-regression/inline-snapshot-test.tsx +0 -28
  70. package/src/components/__tests__/visual-regression/stack-snapshot-test.tsx +0 -28
  71. package/src/components/__tests__/vr-tests/__snapshots__/box--default.png +0 -0
  72. package/src/components/__tests__/vr-tests/box-snapshot-test.vr.tsx +0 -6
  73. package/src/components/box.partial.tsx +0 -706
  74. package/src/components/inline.partial.tsx +0 -218
  75. package/src/components/stack.partial.tsx +0 -174
  76. package/stack/package.json +0 -15
@@ -1,92 +0,0 @@
1
- /** @jsx jsx */
2
- import { ReactNode } from 'react';
3
- import { BasePrimitiveProps } from './types';
4
- /**
5
- * @private
6
- * @deprecated DSP-8009: This type is scheduled for deletion.
7
- * Please use `Stack` from `@atlaskit/primitives` instead.
8
- */
9
- export interface StackProps extends BasePrimitiveProps {
10
- /**
11
- * Used to align children along the cross axis.
12
- */
13
- alignItems?: FlexAlignItems;
14
- /**
15
- * Used to align children along the main axis.
16
- */
17
- justifyContent?: FlexJustifyContent;
18
- /**
19
- * Sets whether children are forced onto one line or can wrap onto multiple lines
20
- */
21
- flexWrap?: FlexWrap;
22
- /**
23
- * Token representing gap between children.
24
- */
25
- gap: RowGap;
26
- /**
27
- * Elements to be rendered inside the Stack.
28
- */
29
- children: ReactNode;
30
- }
31
- type FlexAlignItems = keyof typeof flexAlignItemsMap;
32
- declare const flexAlignItemsMap: {
33
- center: import("@emotion/react").SerializedStyles;
34
- baseline: import("@emotion/react").SerializedStyles;
35
- flexStart: import("@emotion/react").SerializedStyles;
36
- flexEnd: import("@emotion/react").SerializedStyles;
37
- start: import("@emotion/react").SerializedStyles;
38
- end: import("@emotion/react").SerializedStyles;
39
- };
40
- type FlexJustifyContent = keyof typeof flexJustifyContentMap;
41
- declare const flexJustifyContentMap: {
42
- center: import("@emotion/react").SerializedStyles;
43
- flexStart: import("@emotion/react").SerializedStyles;
44
- flexEnd: import("@emotion/react").SerializedStyles;
45
- start: import("@emotion/react").SerializedStyles;
46
- end: import("@emotion/react").SerializedStyles;
47
- };
48
- type FlexWrap = keyof typeof flexWrapMap;
49
- declare const flexWrapMap: {
50
- wrap: import("@emotion/react").SerializedStyles;
51
- };
52
- /**
53
- * __Stack__
54
- *
55
- * Stack is a primitive component based on flexbox that manages the vertical layout of direct children.
56
- * Renders a `div` by default.
57
- *
58
- * @private
59
- * @deprecated DSP-8009: This primitive is scheduled for deletion.
60
- * Please use `Stack` from `@atlaskit/primitives` instead.
61
- *
62
- */
63
- declare const Stack: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<StackProps & import("react").RefAttributes<HTMLDivElement>>>;
64
- export default Stack;
65
- /**
66
- * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
67
- * @codegen <<SignedSource::02ffa7c4ee52871441d288f44a054685>>
68
- * @codegenId spacing
69
- * @codegenCommand yarn codegen-styles
70
- * @codegenParams ["rowGap"]
71
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::298080e8024fb3eb37589721413e0156>>
72
- */
73
- declare const rowGapMap: {
74
- 'space.0': import("@emotion/react").SerializedStyles;
75
- 'space.025': import("@emotion/react").SerializedStyles;
76
- 'space.050': import("@emotion/react").SerializedStyles;
77
- 'space.075': import("@emotion/react").SerializedStyles;
78
- 'space.100': import("@emotion/react").SerializedStyles;
79
- 'space.1000': import("@emotion/react").SerializedStyles;
80
- 'space.150': import("@emotion/react").SerializedStyles;
81
- 'space.200': import("@emotion/react").SerializedStyles;
82
- 'space.250': import("@emotion/react").SerializedStyles;
83
- 'space.300': import("@emotion/react").SerializedStyles;
84
- 'space.400': import("@emotion/react").SerializedStyles;
85
- 'space.500': import("@emotion/react").SerializedStyles;
86
- 'space.600': import("@emotion/react").SerializedStyles;
87
- 'space.800': import("@emotion/react").SerializedStyles;
88
- };
89
- export type RowGap = keyof typeof rowGapMap;
90
- /**
91
- * @codegenEnd
92
- */
@@ -1,22 +0,0 @@
1
- import React from 'react';
2
-
3
- import Box from '../src/components/box.partial';
4
- import Text from '../src/components/text.partial';
5
-
6
- export default () => {
7
- return (
8
- <Box>
9
- <Box
10
- paddingBlock="space.400"
11
- paddingInline="space.400"
12
- alignItems="center"
13
- backgroundColor="brand.bold"
14
- UNSAFE_style={{ aspectRatio: '1/1' }}
15
- >
16
- <Text fontWeight="medium" color="inverse">
17
- A basic box
18
- </Text>
19
- </Box>
20
- </Box>
21
- );
22
- };
@@ -1,171 +0,0 @@
1
- import React from 'react';
2
-
3
- import Heading from '@atlaskit/heading';
4
- import Inline from '@atlaskit/primitives/inline';
5
- import Stack from '@atlaskit/primitives/stack';
6
-
7
- import { UNSAFE_Box as Box, UNSAFE_Text as Text } from '../src';
8
- import { spacingScale } from '../src/internal/spacing-scale';
9
-
10
- /**
11
- * Box permutations
12
- */
13
- export default () => {
14
- return (
15
- <Stack space="space.400" alignInline="start">
16
- <Stack space="space.200" testId="box-with-background-and-paddingBlock">
17
- <Heading level="h600">paddingBlock</Heading>
18
- <Inline space="space.200" alignBlock="center">
19
- {spacingScale.map((space) => (
20
- <Box
21
- key={space}
22
- backgroundColor="discovery.bold"
23
- paddingBlock={space}
24
- >
25
- <Box backgroundColor="elevation.surface" justifyContent="center">
26
- <Text>{space}</Text>
27
- </Box>
28
- </Box>
29
- ))}
30
- </Inline>
31
- </Stack>
32
-
33
- <Stack space="space.200" testId="box-with-background-and-paddingInline">
34
- <Heading level="h600">paddingInline</Heading>
35
- <Stack space="space.200" alignInline="center">
36
- {spacingScale.map((space) => (
37
- <Box
38
- key={space}
39
- backgroundColor="discovery.bold"
40
- paddingInline={space}
41
- >
42
- <Box backgroundColor="elevation.surface" justifyContent="center">
43
- <Text>{space}</Text>
44
- </Box>
45
- </Box>
46
- ))}
47
- </Stack>
48
- </Stack>
49
-
50
- <Stack space="space.200" testId="box-with-background-and-padding">
51
- <Heading level="h600">padding</Heading>
52
- <Inline space="space.200" alignBlock="center">
53
- {spacingScale.map((space) => (
54
- <Box key={space} backgroundColor="discovery.bold" padding={space}>
55
- <Box backgroundColor="elevation.surface" justifyContent="center">
56
- <Text>{space}</Text>
57
- </Box>
58
- </Box>
59
- ))}
60
- </Inline>
61
- </Stack>
62
-
63
- <Stack space="space.200" testId="box-with-backgroundColor">
64
- <Heading level="h600">backgroundColor</Heading>
65
- <Inline space="space.200" alignBlock="center">
66
- {(
67
- [
68
- 'discovery.bold',
69
- 'success.bold',
70
- 'warning.bold',
71
- 'danger.bold',
72
- 'information.bold',
73
- 'brand.bold',
74
- ] as const
75
- ).map((bgColor) => (
76
- <Box key={bgColor} backgroundColor={bgColor} padding="space.400">
77
- <Box justifyContent="center">
78
- <Text>{bgColor}</Text>
79
- </Box>
80
- </Box>
81
- ))}
82
- </Inline>
83
- </Stack>
84
-
85
- <Stack space="space.200" testId="box-with-borderColor">
86
- <Heading level="h600">borderColor</Heading>
87
- <Inline space="space.200" alignBlock="center">
88
- {(
89
- [
90
- 'discovery',
91
- 'success',
92
- 'warning',
93
- 'danger',
94
- 'information',
95
- 'brand',
96
- ] as const
97
- ).map((borderColor) => (
98
- <Box
99
- key={borderColor}
100
- backgroundColor="neutral"
101
- borderColor={borderColor}
102
- borderStyle="solid"
103
- borderWidth="2px"
104
- padding="space.400"
105
- >
106
- <Box justifyContent="center">
107
- <Text color="color.text">{borderColor}</Text>
108
- </Box>
109
- </Box>
110
- ))}
111
- </Inline>
112
- </Stack>
113
-
114
- <Stack space="space.200" testId="box-with-shadow">
115
- <Heading level="h600">shadow</Heading>
116
- <Inline space="space.200" alignBlock="center">
117
- {(['raised', 'overflow', 'overlay'] as const).map((shadow) => (
118
- <Box
119
- key={shadow}
120
- backgroundColor="elevation.surface"
121
- shadow={shadow}
122
- padding="space.400"
123
- >
124
- <Box justifyContent="center">
125
- <Text color="color.text">{shadow}</Text>
126
- </Box>
127
- </Box>
128
- ))}
129
- </Inline>
130
- </Stack>
131
-
132
- <Stack space="space.200" testId="box-with-layer">
133
- <Heading level="h600">layer</Heading>
134
- <Box alignItems="center" UNSAFE_style={{ width: 800, height: 650 }}>
135
- {(
136
- [
137
- 'card',
138
- 'navigation',
139
- 'dialog',
140
- 'layer',
141
- 'blanket',
142
- 'modal',
143
- 'flag',
144
- 'spotlight',
145
- 'tooltip',
146
- ] as const
147
- ).map((layer, index) => (
148
- <Box
149
- key={layer}
150
- backgroundColor="elevation.surface"
151
- layer={layer}
152
- shadow="overlay"
153
- padding="space.400"
154
- position="absolute"
155
- UNSAFE_style={{
156
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
157
- top: index * 64,
158
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
159
- left: index * 64,
160
- }}
161
- >
162
- <Box justifyContent="center">
163
- <Text color="color.text">{layer}</Text>
164
- </Box>
165
- </Box>
166
- ))}
167
- </Box>
168
- </Stack>
169
- </Stack>
170
- );
171
- };
@@ -1,99 +0,0 @@
1
- import React from 'react';
2
-
3
- import Heading from '@atlaskit/heading';
4
-
5
- import {
6
- UNSAFE_Box as Box,
7
- UNSAFE_Inline as Inline,
8
- UNSAFE_Stack as Stack,
9
- } from '../src';
10
- import { spacingScale } from '../src/internal/spacing-scale';
11
-
12
- const flexAlignItems = ['center', 'baseline', 'flexStart', 'flexEnd'];
13
- const flexJustifyContent = ['center', 'flexStart', 'flexEnd'];
14
- const flexWrap = ['wrap'];
15
-
16
- /**
17
- * Stack permutations
18
- */
19
- export default () => {
20
- return (
21
- <Stack gap="space.300">
22
- <Stack gap="space.300" testId="stack-spacing">
23
- <Heading level="h700">Spacing</Heading>
24
- <Inline gap="space.400">
25
- {spacingScale.map((space) => (
26
- <Stack key={space} gap="space.300">
27
- <Heading level="h500">{space}</Heading>
28
-
29
- <Box backgroundColor="neutral">
30
- <Stack gap={space} alignItems="center">
31
- <Box padding="space.100" backgroundColor="success.bold" />
32
- <Box padding="space.100" backgroundColor="success.bold" />
33
- <Box padding="space.100" backgroundColor="success.bold" />
34
- </Stack>
35
- </Box>
36
- </Stack>
37
- ))}
38
- </Inline>
39
- </Stack>
40
- <Stack gap="space.300" testId="stack-alignment">
41
- <Heading level="h700">Alignment</Heading>
42
- <Heading level="h600">alignItems</Heading>
43
- <Inline gap="space.400">
44
- {flexAlignItems.map((alignItemsValue) => (
45
- <Stack key={alignItemsValue} gap="space.300">
46
- <Heading level="h500">{alignItemsValue}</Heading>
47
-
48
- <Box backgroundColor="neutral" display="block">
49
- <Stack gap="space.200" alignItems={alignItemsValue as any}>
50
- <Box padding="space.100" backgroundColor="success.bold" />
51
- <Box padding="space.100" backgroundColor="success.bold" />
52
- <Box padding="space.100" backgroundColor="success.bold" />
53
- </Stack>
54
- </Box>
55
- </Stack>
56
- ))}
57
- </Inline>
58
-
59
- <Heading level="h600">justifyContent</Heading>
60
- <Inline gap="space.400">
61
- {flexJustifyContent.map((justifyContentValue) => (
62
- <Stack key={justifyContentValue} gap="space.300">
63
- <Heading level="h500">{justifyContentValue}</Heading>
64
-
65
- <Box backgroundColor="neutral" UNSAFE_style={{ height: '200px' }}>
66
- <Stack
67
- gap="space.200"
68
- justifyContent={justifyContentValue as any}
69
- >
70
- <Box padding="space.100" backgroundColor="success.bold" />
71
- <Box padding="space.100" backgroundColor="success.bold" />
72
- <Box padding="space.100" backgroundColor="success.bold" />
73
- </Stack>
74
- </Box>
75
- </Stack>
76
- ))}
77
- </Inline>
78
-
79
- <Heading level="h700">Overflow</Heading>
80
- <Heading level="h600">flexWrap</Heading>
81
- <Inline gap="space.400">
82
- {flexWrap.map((flexWrapValue) => (
83
- <Stack key={flexWrapValue} gap="space.300">
84
- <Heading level="h500">{flexWrapValue}</Heading>
85
-
86
- <Box backgroundColor="neutral" UNSAFE_style={{ height: '50px' }}>
87
- <Stack gap="space.200" flexWrap={flexWrapValue as any}>
88
- <Box padding="space.100" backgroundColor="success.bold" />
89
- <Box padding="space.100" backgroundColor="success.bold" />
90
- <Box padding="space.100" backgroundColor="success.bold" />
91
- </Stack>
92
- </Box>
93
- </Stack>
94
- ))}
95
- </Inline>
96
- </Stack>
97
- </Stack>
98
- );
99
- };
@@ -1,99 +0,0 @@
1
- import React from 'react';
2
-
3
- import Heading from '@atlaskit/heading';
4
-
5
- import {
6
- UNSAFE_Box as Box,
7
- UNSAFE_Inline as Inline,
8
- UNSAFE_Stack as Stack,
9
- } from '../src';
10
- import { spacingScale } from '../src/internal/spacing-scale';
11
-
12
- const flexAlignItems = ['center', 'baseline', 'flexStart', 'flexEnd'] as const;
13
- const flexJustifyContent = ['center', 'flexStart', 'flexEnd'] as const;
14
- const flexWrap = ['wrap'] as const;
15
-
16
- /**
17
- * Inline permutations
18
- */
19
- export default () => {
20
- return (
21
- <Stack gap="space.300">
22
- <Stack gap="space.300" testId="inline-spacing">
23
- <Heading level="h700">Spacing</Heading>
24
- <Stack gap="space.400">
25
- {spacingScale.map((space) => (
26
- <Inline key={space} gap="space.300">
27
- <Box UNSAFE_style={{ width: 140 }}>
28
- <Heading level="h500">{space}</Heading>
29
- </Box>
30
-
31
- <Box backgroundColor="neutral">
32
- <Inline gap={space} alignItems="center">
33
- <Box padding="space.100" backgroundColor="success.bold" />
34
- <Box padding="space.100" backgroundColor="success.bold" />
35
- <Box padding="space.100" backgroundColor="success.bold" />
36
- </Inline>
37
- </Box>
38
- </Inline>
39
- ))}
40
- </Stack>
41
- </Stack>
42
- <Stack gap="space.300" testId="inline-alignment">
43
- <Heading level="h700">Alignment</Heading>
44
- <Heading level="h600">alignItems</Heading>
45
- <Inline gap="space.400">
46
- {flexAlignItems.map((alignItemsValue) => (
47
- <Stack key={alignItemsValue} gap="space.300">
48
- <Heading level="h500">{alignItemsValue}</Heading>
49
- <Box backgroundColor="neutral" UNSAFE_style={{ height: '100px' }}>
50
- <Inline gap="space.200" alignItems={alignItemsValue}>
51
- <Box padding="space.100" backgroundColor="success.bold" />
52
- <Box padding="space.100" backgroundColor="success.bold" />
53
- <Box padding="space.100" backgroundColor="success.bold" />
54
- </Inline>
55
- </Box>
56
- </Stack>
57
- ))}
58
- </Inline>
59
- <Heading level="h600">justifyContent</Heading>
60
- <Inline gap="space.400">
61
- {flexJustifyContent.map((justifyContentValue) => (
62
- <Stack key={justifyContentValue} gap="space.300">
63
- <Heading level="h500">{justifyContentValue}</Heading>
64
-
65
- <Box
66
- display="block"
67
- backgroundColor="neutral"
68
- UNSAFE_style={{ width: '140px' }}
69
- >
70
- <Inline gap="space.200" justifyContent={justifyContentValue}>
71
- <Box padding="space.100" backgroundColor="success.bold" />
72
- <Box padding="space.100" backgroundColor="success.bold" />
73
- <Box padding="space.100" backgroundColor="success.bold" />
74
- </Inline>
75
- </Box>
76
- </Stack>
77
- ))}
78
- </Inline>
79
-
80
- <Heading level="h700">Overflow</Heading>
81
- <Heading level="h600">flexWrap</Heading>
82
- <Inline gap="space.400">
83
- {flexWrap.map((flexWrapValue) => (
84
- <Stack key={flexWrapValue} gap="space.300">
85
- <Heading level="h500">{flexWrapValue}</Heading>
86
- <Box backgroundColor="neutral" UNSAFE_style={{ width: '50px' }}>
87
- <Inline gap="space.200" flexWrap={flexWrapValue as any}>
88
- <Box padding="space.100" backgroundColor="success.bold" />
89
- <Box padding="space.100" backgroundColor="success.bold" />
90
- <Box padding="space.100" backgroundColor="success.bold" />
91
- </Inline>
92
- </Box>
93
- </Stack>
94
- ))}
95
- </Inline>
96
- </Stack>
97
- </Stack>
98
- );
99
- };
@@ -1,15 +0,0 @@
1
- {
2
- "name": "@atlaskit/ds-explorations/inline",
3
- "main": "../dist/cjs/components/inline.partial.js",
4
- "module": "../dist/esm/components/inline.partial.js",
5
- "module:es2019": "../dist/es2019/components/inline.partial.js",
6
- "sideEffects": false,
7
- "types": "../dist/types/components/inline.partial.d.ts",
8
- "typesVersions": {
9
- ">=4.5 <4.9": {
10
- "*": [
11
- "../dist/types-ts4.5/components/inline.partial.d.ts"
12
- ]
13
- }
14
- }
15
- }
@@ -1,55 +0,0 @@
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
- });
@@ -1,43 +0,0 @@
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
- });
@@ -1,31 +0,0 @@
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
- });
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:98a9a1b3f8173c6ed0520cc3da4493d6963527bb8699be3b26729392e25e0539
3
- size 24062
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:3ec919ee45580a3e93dca991e3c80a0523a142c3096ad364e622ad4b1fdfad76
3
- size 37966
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:3d5a9d4369d39aea2c98b9b329881f1769e29e2931321b85a000d81c88c1f0ab
3
- size 26736
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:7fc46772ba9b71f230f1bfe126adb00e478061bcc01315aeecb1d0634f0c7d85
3
- size 13156