@atlaskit/ds-explorations 2.3.1 → 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.
Files changed (72) hide show
  1. package/CHANGELOG.md +70 -58
  2. package/box/package.json +15 -0
  3. package/dist/cjs/components/box.partial.js +620 -0
  4. package/dist/cjs/components/inline.partial.js +182 -0
  5. package/dist/cjs/components/interaction-surface.partial.js +1 -2
  6. package/dist/cjs/components/stack.partial.js +148 -0
  7. package/dist/cjs/components/surface-provider.js +2 -4
  8. package/dist/cjs/components/text.partial.js +5 -6
  9. package/dist/cjs/constants.js +2 -3
  10. package/dist/cjs/index.js +21 -0
  11. package/dist/cjs/internal/color-map.js +2 -3
  12. package/dist/cjs/internal/role-to-element.js +1 -2
  13. package/dist/cjs/internal/spacing-scale.js +1 -2
  14. package/dist/es2019/components/box.partial.js +614 -0
  15. package/dist/es2019/components/inline.partial.js +177 -0
  16. package/dist/es2019/components/stack.partial.js +144 -0
  17. package/dist/es2019/components/text.partial.js +4 -4
  18. package/dist/es2019/index.js +3 -0
  19. package/dist/esm/components/box.partial.js +617 -0
  20. package/dist/esm/components/inline.partial.js +177 -0
  21. package/dist/esm/components/stack.partial.js +143 -0
  22. package/dist/esm/components/text.partial.js +4 -4
  23. package/dist/esm/index.js +3 -0
  24. package/dist/types/components/box.partial.d.ts +357 -0
  25. package/dist/types/components/inline.partial.d.ts +108 -0
  26. package/dist/types/components/stack.partial.d.ts +92 -0
  27. package/dist/types/components/surface-provider.d.ts +2 -2
  28. package/dist/types/components/text.partial.d.ts +2 -2
  29. package/dist/types/index.d.ts +6 -0
  30. package/dist/types-ts4.5/components/box.partial.d.ts +357 -0
  31. package/dist/types-ts4.5/components/inline.partial.d.ts +108 -0
  32. package/dist/types-ts4.5/components/stack.partial.d.ts +92 -0
  33. package/dist/types-ts4.5/components/surface-provider.d.ts +2 -2
  34. package/dist/types-ts4.5/components/text.partial.d.ts +2 -2
  35. package/dist/types-ts4.5/index.d.ts +6 -0
  36. package/examples/00-basic.tsx +22 -0
  37. package/examples/01-box.tsx +171 -0
  38. package/examples/02-text-advanced.tsx +20 -11
  39. package/examples/02-text.tsx +10 -15
  40. package/examples/03-stack.tsx +99 -0
  41. package/examples/04-inline.tsx +99 -0
  42. package/examples/05-badge.tsx +5 -9
  43. package/examples/06-section-message.tsx +4 -2
  44. package/examples/07-comment.tsx +3 -1
  45. package/examples/08-lozenge.tsx +4 -8
  46. package/examples/99-interactions.tsx +33 -49
  47. package/inline/package.json +15 -0
  48. package/package.json +6 -4
  49. package/report.api.md +465 -0
  50. package/scripts/codegen-styles.tsx +89 -16
  51. package/src/components/__tests__/unit/box.test.tsx +55 -0
  52. package/src/components/__tests__/unit/inline.test.tsx +43 -0
  53. package/src/components/__tests__/unit/interaction-suface.test.tsx +2 -2
  54. package/src/components/__tests__/unit/stack.test.tsx +31 -0
  55. package/src/components/__tests__/visual-regression/__image_snapshots__/inline-snapshot-test-tsx-inline-alignment-example-should-match-snapshot-1-snap.png +3 -0
  56. package/src/components/__tests__/visual-regression/__image_snapshots__/inline-snapshot-test-tsx-inline-spacing-example-should-match-snapshot-1-snap.png +3 -0
  57. package/src/components/__tests__/visual-regression/__image_snapshots__/stack-snapshot-test-tsx-stack-alignment-example-should-match-snapshot-1-snap.png +3 -0
  58. package/src/components/__tests__/visual-regression/__image_snapshots__/stack-snapshot-test-tsx-stack-spacing-example-should-match-snapshot-1-snap.png +3 -0
  59. package/src/components/__tests__/visual-regression/inline-snapshot-test.tsx +28 -0
  60. package/src/components/__tests__/visual-regression/stack-snapshot-test.tsx +28 -0
  61. package/src/components/__tests__/vr-tests/__snapshots__/box--default.png +0 -0
  62. package/src/components/__tests__/vr-tests/box-snapshot-test.vr.tsx +6 -0
  63. package/src/components/box.partial.tsx +706 -0
  64. package/src/components/inline.partial.tsx +218 -0
  65. package/src/components/stack.partial.tsx +174 -0
  66. package/src/components/surface-provider.tsx +1 -1
  67. package/src/components/text.partial.tsx +4 -4
  68. package/src/index.tsx +6 -0
  69. package/stack/package.json +15 -0
  70. package/tmp/api-report-tmp.d.ts +451 -0
  71. package/tsconfig.app.json +0 -3
  72. 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
+ var 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
+ var 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
+ var flexWrapMap = {
55
+ wrap: css({
56
+ flexWrap: 'wrap'
57
+ })
58
+ };
59
+ var baseStyles = css({
60
+ display: 'flex',
61
+ boxSizing: 'border-box',
62
+ flexDirection: 'row'
63
+ });
64
+ var dividerStyles = css({
65
+ margin: "0 ".concat("var(--ds-space-negative-025, -2px)"),
66
+ color: "var(--ds-text-subtle, #42526E)",
67
+ pointerEvents: 'none',
68
+ userSelect: 'none'
69
+ });
70
+ var Divider = function Divider(_ref) {
71
+ var children = _ref.children;
72
+ return jsx("span", {
73
+ css: dividerStyles
74
+ }, children);
75
+ };
76
+
77
+ /**
78
+ * __Inline__
79
+ *
80
+ * Inline is a primitive component based on flexbox that manages the horizontal layout of direct children.
81
+ * Renders a `div` by default.
82
+ *
83
+ * @private
84
+ * @deprecated DSP-8009: This primitive is scheduled for deletion.
85
+ * Please use `Inline` from `@atlaskit/primitives` instead.
86
+ *
87
+ * @example
88
+ * ```tsx
89
+ * const App = () => (
90
+ * <Inline gap="space.100">
91
+ * <Button />
92
+ * <Button />
93
+ * </Inline>
94
+ * )
95
+ * ```
96
+ */
97
+ var Inline = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref2, ref) {
98
+ var gap = _ref2.gap,
99
+ alignItems = _ref2.alignItems,
100
+ justifyContent = _ref2.justifyContent,
101
+ flexWrap = _ref2.flexWrap,
102
+ divider = _ref2.divider,
103
+ UNSAFE_style = _ref2.UNSAFE_style,
104
+ rawChildren = _ref2.children,
105
+ testId = _ref2.testId;
106
+ var dividerComponent = typeof divider === 'string' ? jsx(Divider, null, divider) : divider;
107
+ var children = divider ? Children.toArray(rawChildren).filter(Boolean).map(function (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
+ var 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,143 @@
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
+ var 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
+ var 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
+ var flexWrapMap = {
49
+ wrap: css({
50
+ flexWrap: 'wrap'
51
+ })
52
+ };
53
+ var 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
+ var Stack = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref) {
71
+ var gap = _ref.gap,
72
+ alignItems = _ref.alignItems,
73
+ justifyContent = _ref.justifyContent,
74
+ flexWrap = _ref.flexWrap,
75
+ children = _ref.children,
76
+ UNSAFE_style = _ref.UNSAFE_style,
77
+ testId = _ref.testId;
78
+ return jsx("div", {
79
+ style: UNSAFE_style,
80
+ css: [baseStyles, gap && rowGapMap[gap], alignItems && flexAlignItemsMap[alignItems], justifyContent && flexJustifyContentMap[justifyContent], flexWrap && flexWrapMap[flexWrap]],
81
+ "data-testid": testId,
82
+ ref: ref
83
+ }, children);
84
+ }));
85
+ Stack.displayName = 'Stack';
86
+ export default Stack;
87
+
88
+ /**
89
+ * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
90
+ * @codegen <<SignedSource::02ffa7c4ee52871441d288f44a054685>>
91
+ * @codegenId spacing
92
+ * @codegenCommand yarn codegen-styles
93
+ * @codegenParams ["rowGap"]
94
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::298080e8024fb3eb37589721413e0156>>
95
+ */
96
+ var rowGapMap = {
97
+ 'space.0': css({
98
+ rowGap: "var(--ds-space-0, 0px)"
99
+ }),
100
+ 'space.025': css({
101
+ rowGap: "var(--ds-space-025, 2px)"
102
+ }),
103
+ 'space.050': css({
104
+ rowGap: "var(--ds-space-050, 4px)"
105
+ }),
106
+ 'space.075': css({
107
+ rowGap: "var(--ds-space-075, 6px)"
108
+ }),
109
+ 'space.100': css({
110
+ rowGap: "var(--ds-space-100, 8px)"
111
+ }),
112
+ 'space.1000': css({
113
+ rowGap: "var(--ds-space-1000, 80px)"
114
+ }),
115
+ 'space.150': css({
116
+ rowGap: "var(--ds-space-150, 12px)"
117
+ }),
118
+ 'space.200': css({
119
+ rowGap: "var(--ds-space-200, 16px)"
120
+ }),
121
+ 'space.250': css({
122
+ rowGap: "var(--ds-space-250, 20px)"
123
+ }),
124
+ 'space.300': css({
125
+ rowGap: "var(--ds-space-300, 24px)"
126
+ }),
127
+ 'space.400': css({
128
+ rowGap: "var(--ds-space-400, 32px)"
129
+ }),
130
+ 'space.500': css({
131
+ rowGap: "var(--ds-space-500, 40px)"
132
+ }),
133
+ 'space.600': css({
134
+ rowGap: "var(--ds-space-600, 48px)"
135
+ }),
136
+ 'space.800': css({
137
+ rowGap: "var(--ds-space-800, 64px)"
138
+ })
139
+ };
140
+
141
+ /**
142
+ * @codegenEnd
143
+ */
@@ -129,11 +129,11 @@ export default Text;
129
129
 
130
130
  /**
131
131
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
132
- * @codegen <<SignedSource::de3943f17f27e9d5895c249c30c12802>>
132
+ * @codegen <<SignedSource::14dcf59f69533f453ffa8a5c5d165d19>>
133
133
  * @codegenId typography
134
134
  * @codegenCommand yarn codegen-styles
135
135
  * @codegenParams ["fontSize", "fontWeight", "fontFamily", "lineHeight"]
136
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-typography.tsx <<SignedSource::85d34d11efbf90832fccaf960c2ea033>>
136
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-typography.tsx <<SignedSource::b01e60e475c0cb12960865631f2b4e2c>>
137
137
  */
138
138
  var fontSizeMap = {
139
139
  'size.050': css({
@@ -177,7 +177,7 @@ var fontWeightMap = {
177
177
  };
178
178
  var fontFamilyMap = {
179
179
  body: css({
180
- fontFamily: "var(--ds-font-family-body, ui-sans-serif, \"Segoe UI\", system-ui, Ubuntu, \"Helvetica Neue\", sans-serif)"
180
+ fontFamily: "var(--ds-font-family-body, ui-sans-serif, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
181
181
  }),
182
182
  brand: css({
183
183
  fontFamily: "var(--ds-font-family-brand, Charlie Sans)"
@@ -186,7 +186,7 @@ var fontFamilyMap = {
186
186
  fontFamily: "var(--ds-font-family-code, ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)"
187
187
  }),
188
188
  heading: css({
189
- fontFamily: "var(--ds-font-family-heading, ui-sans-serif, \"Segoe UI\", system-ui, Ubuntu, \"Helvetica Neue\", sans-serif)"
189
+ fontFamily: "var(--ds-font-family-heading, ui-sans-serif, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
190
190
  }),
191
191
  monospace: css({
192
192
  fontFamily: "var(--ds-font-family-monospace, ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)"
package/dist/esm/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';