@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,177 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Children, forwardRef, Fragment, memo } from 'react';
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @private
|
|
7
|
+
* @deprecated DSP-8009: This type is scheduled for deletion.
|
|
8
|
+
* Please use `Inline` from `@atlaskit/primitives` instead.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const flexAlignItemsMap = {
|
|
12
|
+
center: css({
|
|
13
|
+
alignItems: 'center'
|
|
14
|
+
}),
|
|
15
|
+
baseline: css({
|
|
16
|
+
alignItems: 'baseline'
|
|
17
|
+
}),
|
|
18
|
+
flexStart: css({
|
|
19
|
+
alignItems: 'flex-start'
|
|
20
|
+
}),
|
|
21
|
+
flexEnd: css({
|
|
22
|
+
alignItems: 'flex-end'
|
|
23
|
+
}),
|
|
24
|
+
start: css({
|
|
25
|
+
alignItems: 'start'
|
|
26
|
+
}),
|
|
27
|
+
end: css({
|
|
28
|
+
alignItems: 'end'
|
|
29
|
+
})
|
|
30
|
+
};
|
|
31
|
+
const flexJustifyContentMap = {
|
|
32
|
+
center: css({
|
|
33
|
+
justifyContent: 'center'
|
|
34
|
+
}),
|
|
35
|
+
flexStart: css({
|
|
36
|
+
justifyContent: 'flex-start'
|
|
37
|
+
}),
|
|
38
|
+
'space-between': css({
|
|
39
|
+
justifyContent: 'space-between'
|
|
40
|
+
}),
|
|
41
|
+
flexEnd: css({
|
|
42
|
+
justifyContent: 'flex-end'
|
|
43
|
+
}),
|
|
44
|
+
start: css({
|
|
45
|
+
justifyContent: 'start'
|
|
46
|
+
}),
|
|
47
|
+
end: css({
|
|
48
|
+
justifyContent: 'end'
|
|
49
|
+
}),
|
|
50
|
+
spaceBetween: css({
|
|
51
|
+
justifyContent: 'space-between'
|
|
52
|
+
})
|
|
53
|
+
};
|
|
54
|
+
const flexWrapMap = {
|
|
55
|
+
wrap: css({
|
|
56
|
+
flexWrap: 'wrap'
|
|
57
|
+
})
|
|
58
|
+
};
|
|
59
|
+
const baseStyles = css({
|
|
60
|
+
display: 'flex',
|
|
61
|
+
boxSizing: 'border-box',
|
|
62
|
+
flexDirection: 'row'
|
|
63
|
+
});
|
|
64
|
+
const dividerStyles = css({
|
|
65
|
+
margin: `0 ${"var(--ds-space-negative-025, -2px)"}`,
|
|
66
|
+
color: "var(--ds-text-subtle, #42526E)",
|
|
67
|
+
pointerEvents: 'none',
|
|
68
|
+
userSelect: 'none'
|
|
69
|
+
});
|
|
70
|
+
const Divider = ({
|
|
71
|
+
children
|
|
72
|
+
}) => jsx("span", {
|
|
73
|
+
css: dividerStyles
|
|
74
|
+
}, children);
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* __Inline__
|
|
78
|
+
*
|
|
79
|
+
* Inline is a primitive component based on flexbox that manages the horizontal layout of direct children.
|
|
80
|
+
* Renders a `div` by default.
|
|
81
|
+
*
|
|
82
|
+
* @private
|
|
83
|
+
* @deprecated DSP-8009: This primitive is scheduled for deletion.
|
|
84
|
+
* Please use `Inline` from `@atlaskit/primitives` instead.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```tsx
|
|
88
|
+
* const App = () => (
|
|
89
|
+
* <Inline gap="space.100">
|
|
90
|
+
* <Button />
|
|
91
|
+
* <Button />
|
|
92
|
+
* </Inline>
|
|
93
|
+
* )
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
const Inline = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
97
|
+
gap,
|
|
98
|
+
alignItems,
|
|
99
|
+
justifyContent,
|
|
100
|
+
flexWrap,
|
|
101
|
+
divider,
|
|
102
|
+
UNSAFE_style,
|
|
103
|
+
children: rawChildren,
|
|
104
|
+
testId
|
|
105
|
+
}, ref) => {
|
|
106
|
+
const dividerComponent = typeof divider === 'string' ? jsx(Divider, null, divider) : divider;
|
|
107
|
+
const children = divider ? Children.toArray(rawChildren).filter(Boolean).map((child, index) => {
|
|
108
|
+
return jsx(Fragment, {
|
|
109
|
+
key: index
|
|
110
|
+
}, divider && index > 0 ? dividerComponent : null, child);
|
|
111
|
+
}) : rawChildren;
|
|
112
|
+
return jsx("div", {
|
|
113
|
+
style: UNSAFE_style,
|
|
114
|
+
css: [baseStyles, gap && columnGapMap[gap], alignItems && flexAlignItemsMap[alignItems], justifyContent && flexJustifyContentMap[justifyContent], flexWrap && flexWrapMap[flexWrap]],
|
|
115
|
+
"data-testid": testId,
|
|
116
|
+
ref: ref
|
|
117
|
+
}, children);
|
|
118
|
+
}));
|
|
119
|
+
Inline.displayName = 'Inline';
|
|
120
|
+
export default Inline;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
124
|
+
* @codegen <<SignedSource::63747c8b92ba373ad2259fa1fff3f434>>
|
|
125
|
+
* @codegenId spacing
|
|
126
|
+
* @codegenCommand yarn codegen-styles
|
|
127
|
+
* @codegenParams ["columnGap"]
|
|
128
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::298080e8024fb3eb37589721413e0156>>
|
|
129
|
+
*/
|
|
130
|
+
const columnGapMap = {
|
|
131
|
+
'space.0': css({
|
|
132
|
+
columnGap: "var(--ds-space-0, 0px)"
|
|
133
|
+
}),
|
|
134
|
+
'space.025': css({
|
|
135
|
+
columnGap: "var(--ds-space-025, 2px)"
|
|
136
|
+
}),
|
|
137
|
+
'space.050': css({
|
|
138
|
+
columnGap: "var(--ds-space-050, 4px)"
|
|
139
|
+
}),
|
|
140
|
+
'space.075': css({
|
|
141
|
+
columnGap: "var(--ds-space-075, 6px)"
|
|
142
|
+
}),
|
|
143
|
+
'space.100': css({
|
|
144
|
+
columnGap: "var(--ds-space-100, 8px)"
|
|
145
|
+
}),
|
|
146
|
+
'space.1000': css({
|
|
147
|
+
columnGap: "var(--ds-space-1000, 80px)"
|
|
148
|
+
}),
|
|
149
|
+
'space.150': css({
|
|
150
|
+
columnGap: "var(--ds-space-150, 12px)"
|
|
151
|
+
}),
|
|
152
|
+
'space.200': css({
|
|
153
|
+
columnGap: "var(--ds-space-200, 16px)"
|
|
154
|
+
}),
|
|
155
|
+
'space.250': css({
|
|
156
|
+
columnGap: "var(--ds-space-250, 20px)"
|
|
157
|
+
}),
|
|
158
|
+
'space.300': css({
|
|
159
|
+
columnGap: "var(--ds-space-300, 24px)"
|
|
160
|
+
}),
|
|
161
|
+
'space.400': css({
|
|
162
|
+
columnGap: "var(--ds-space-400, 32px)"
|
|
163
|
+
}),
|
|
164
|
+
'space.500': css({
|
|
165
|
+
columnGap: "var(--ds-space-500, 40px)"
|
|
166
|
+
}),
|
|
167
|
+
'space.600': css({
|
|
168
|
+
columnGap: "var(--ds-space-600, 48px)"
|
|
169
|
+
}),
|
|
170
|
+
'space.800': css({
|
|
171
|
+
columnGap: "var(--ds-space-800, 64px)"
|
|
172
|
+
})
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* @codegenEnd
|
|
177
|
+
*/
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { forwardRef, memo } from 'react';
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @private
|
|
7
|
+
* @deprecated DSP-8009: This type is scheduled for deletion.
|
|
8
|
+
* Please use `Stack` from `@atlaskit/primitives` instead.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const flexAlignItemsMap = {
|
|
12
|
+
center: css({
|
|
13
|
+
alignItems: 'center'
|
|
14
|
+
}),
|
|
15
|
+
baseline: css({
|
|
16
|
+
alignItems: 'baseline'
|
|
17
|
+
}),
|
|
18
|
+
flexStart: css({
|
|
19
|
+
alignItems: 'flex-start'
|
|
20
|
+
}),
|
|
21
|
+
flexEnd: css({
|
|
22
|
+
alignItems: 'flex-end'
|
|
23
|
+
}),
|
|
24
|
+
start: css({
|
|
25
|
+
alignItems: 'start'
|
|
26
|
+
}),
|
|
27
|
+
end: css({
|
|
28
|
+
alignItems: 'end'
|
|
29
|
+
})
|
|
30
|
+
};
|
|
31
|
+
const flexJustifyContentMap = {
|
|
32
|
+
center: css({
|
|
33
|
+
justifyContent: 'center'
|
|
34
|
+
}),
|
|
35
|
+
flexStart: css({
|
|
36
|
+
justifyContent: 'flex-start'
|
|
37
|
+
}),
|
|
38
|
+
flexEnd: css({
|
|
39
|
+
justifyContent: 'flex-end'
|
|
40
|
+
}),
|
|
41
|
+
start: css({
|
|
42
|
+
justifyContent: 'start'
|
|
43
|
+
}),
|
|
44
|
+
end: css({
|
|
45
|
+
justifyContent: 'end'
|
|
46
|
+
})
|
|
47
|
+
};
|
|
48
|
+
const flexWrapMap = {
|
|
49
|
+
wrap: css({
|
|
50
|
+
flexWrap: 'wrap'
|
|
51
|
+
})
|
|
52
|
+
};
|
|
53
|
+
const baseStyles = css({
|
|
54
|
+
display: 'flex',
|
|
55
|
+
boxSizing: 'border-box',
|
|
56
|
+
flexDirection: 'column'
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* __Stack__
|
|
61
|
+
*
|
|
62
|
+
* Stack is a primitive component based on flexbox that manages the vertical layout of direct children.
|
|
63
|
+
* Renders a `div` by default.
|
|
64
|
+
*
|
|
65
|
+
* @private
|
|
66
|
+
* @deprecated DSP-8009: This primitive is scheduled for deletion.
|
|
67
|
+
* Please use `Stack` from `@atlaskit/primitives` instead.
|
|
68
|
+
*
|
|
69
|
+
*/
|
|
70
|
+
const Stack = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
71
|
+
gap,
|
|
72
|
+
alignItems,
|
|
73
|
+
justifyContent,
|
|
74
|
+
flexWrap,
|
|
75
|
+
children,
|
|
76
|
+
UNSAFE_style,
|
|
77
|
+
testId
|
|
78
|
+
}, ref) => {
|
|
79
|
+
return jsx("div", {
|
|
80
|
+
style: UNSAFE_style,
|
|
81
|
+
css: [baseStyles, gap && rowGapMap[gap], alignItems && flexAlignItemsMap[alignItems], justifyContent && flexJustifyContentMap[justifyContent], flexWrap && flexWrapMap[flexWrap]],
|
|
82
|
+
"data-testid": testId,
|
|
83
|
+
ref: ref
|
|
84
|
+
}, children);
|
|
85
|
+
}));
|
|
86
|
+
Stack.displayName = 'Stack';
|
|
87
|
+
export default Stack;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
91
|
+
* @codegen <<SignedSource::02ffa7c4ee52871441d288f44a054685>>
|
|
92
|
+
* @codegenId spacing
|
|
93
|
+
* @codegenCommand yarn codegen-styles
|
|
94
|
+
* @codegenParams ["rowGap"]
|
|
95
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::298080e8024fb3eb37589721413e0156>>
|
|
96
|
+
*/
|
|
97
|
+
const rowGapMap = {
|
|
98
|
+
'space.0': css({
|
|
99
|
+
rowGap: "var(--ds-space-0, 0px)"
|
|
100
|
+
}),
|
|
101
|
+
'space.025': css({
|
|
102
|
+
rowGap: "var(--ds-space-025, 2px)"
|
|
103
|
+
}),
|
|
104
|
+
'space.050': css({
|
|
105
|
+
rowGap: "var(--ds-space-050, 4px)"
|
|
106
|
+
}),
|
|
107
|
+
'space.075': css({
|
|
108
|
+
rowGap: "var(--ds-space-075, 6px)"
|
|
109
|
+
}),
|
|
110
|
+
'space.100': css({
|
|
111
|
+
rowGap: "var(--ds-space-100, 8px)"
|
|
112
|
+
}),
|
|
113
|
+
'space.1000': css({
|
|
114
|
+
rowGap: "var(--ds-space-1000, 80px)"
|
|
115
|
+
}),
|
|
116
|
+
'space.150': css({
|
|
117
|
+
rowGap: "var(--ds-space-150, 12px)"
|
|
118
|
+
}),
|
|
119
|
+
'space.200': css({
|
|
120
|
+
rowGap: "var(--ds-space-200, 16px)"
|
|
121
|
+
}),
|
|
122
|
+
'space.250': css({
|
|
123
|
+
rowGap: "var(--ds-space-250, 20px)"
|
|
124
|
+
}),
|
|
125
|
+
'space.300': css({
|
|
126
|
+
rowGap: "var(--ds-space-300, 24px)"
|
|
127
|
+
}),
|
|
128
|
+
'space.400': css({
|
|
129
|
+
rowGap: "var(--ds-space-400, 32px)"
|
|
130
|
+
}),
|
|
131
|
+
'space.500': css({
|
|
132
|
+
rowGap: "var(--ds-space-500, 40px)"
|
|
133
|
+
}),
|
|
134
|
+
'space.600': css({
|
|
135
|
+
rowGap: "var(--ds-space-600, 48px)"
|
|
136
|
+
}),
|
|
137
|
+
'space.800': css({
|
|
138
|
+
rowGap: "var(--ds-space-800, 64px)"
|
|
139
|
+
})
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* @codegenEnd
|
|
144
|
+
*/
|
package/dist/es2019/index.js
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
+
export { default as UNSAFE_Box } from './components/box.partial';
|
|
1
2
|
export { default as UNSAFE_Text } from './components/text.partial';
|
|
3
|
+
export { default as UNSAFE_Inline } from './components/inline.partial';
|
|
4
|
+
export { default as UNSAFE_Stack } from './components/stack.partial';
|
|
2
5
|
export { default as UNSAFE_InteractionSurface } from './components/interaction-surface.partial';
|