@atlaskit/ds-explorations 0.0.3 → 0.1.2

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 (114) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/cjs/components/box.partial.js +355 -185
  3. package/dist/cjs/components/inline.partial.js +124 -0
  4. package/dist/cjs/components/interaction-surface.partial.js +253 -0
  5. package/dist/cjs/components/stack.partial.js +116 -0
  6. package/dist/cjs/components/surface-provider.js +31 -0
  7. package/dist/cjs/components/text.partial.js +152 -49
  8. package/dist/cjs/components/types.js +5 -0
  9. package/dist/cjs/constants.js +3 -0
  10. package/dist/cjs/index.js +50 -3
  11. package/dist/cjs/internal/color-map.js +42 -0
  12. package/dist/cjs/internal/role-to-element.js +36 -0
  13. package/dist/cjs/version.json +1 -1
  14. package/dist/es2019/components/box.partial.js +259 -113
  15. package/dist/es2019/components/inline.partial.js +111 -0
  16. package/dist/es2019/components/interaction-surface.partial.js +243 -0
  17. package/dist/es2019/components/stack.partial.js +106 -0
  18. package/dist/es2019/components/surface-provider.js +20 -0
  19. package/dist/es2019/components/text.partial.js +122 -35
  20. package/dist/es2019/components/types.js +1 -0
  21. package/dist/es2019/constants.js +3 -0
  22. package/dist/es2019/index.js +6 -1
  23. package/dist/es2019/internal/color-map.js +34 -0
  24. package/dist/es2019/internal/role-to-element.js +28 -0
  25. package/dist/es2019/version.json +1 -1
  26. package/dist/esm/components/box.partial.js +274 -109
  27. package/dist/esm/components/inline.partial.js +110 -0
  28. package/dist/esm/components/interaction-surface.partial.js +242 -0
  29. package/dist/esm/components/stack.partial.js +105 -0
  30. package/dist/esm/components/surface-provider.js +20 -0
  31. package/dist/esm/components/text.partial.js +132 -34
  32. package/dist/esm/components/types.js +1 -0
  33. package/dist/esm/constants.js +3 -0
  34. package/dist/esm/index.js +6 -1
  35. package/dist/esm/internal/color-map.js +34 -0
  36. package/dist/esm/internal/role-to-element.js +28 -0
  37. package/dist/esm/version.json +1 -1
  38. package/dist/types/components/box.partial.d.ts +157 -76
  39. package/dist/types/components/inline.partial.d.ts +52 -0
  40. package/dist/types/components/interaction-surface.partial.d.ts +45 -0
  41. package/dist/types/components/stack.partial.d.ts +47 -0
  42. package/dist/types/components/surface-provider.d.ts +15 -0
  43. package/dist/types/components/text.partial.d.ts +100 -28
  44. package/dist/types/components/types.d.ts +13 -0
  45. package/dist/types/constants.d.ts +3 -0
  46. package/dist/types/index.d.ts +8 -2
  47. package/dist/types/internal/color-map.d.ts +34 -0
  48. package/dist/types/internal/role-to-element.d.ts +32 -0
  49. package/examples/00-basic.tsx +18 -1
  50. package/examples/01-box.tsx +126 -2
  51. package/examples/02-text.tsx +76 -2
  52. package/examples/03-stack.tsx +125 -0
  53. package/examples/04-inline.tsx +134 -0
  54. package/examples/{03-badge.tsx → 05-badge.tsx} +4 -4
  55. package/examples/{04-section-message.tsx → 06-section-message.tsx} +6 -6
  56. package/examples/{05-comment.tsx → 07-comment.tsx} +11 -9
  57. package/examples/08-lozenge.tsx +29 -0
  58. package/examples/99-interactions.tsx +175 -0
  59. package/package.json +8 -5
  60. package/report.api.md +457 -4
  61. package/scripts/__tests__/__snapshots__/codegen.test.tsx.snap +244 -50
  62. package/scripts/__tests__/codegen.test.tsx +5 -0
  63. package/scripts/codegen-styles.tsx +46 -10
  64. package/scripts/color-codegen-template.tsx +34 -12
  65. package/scripts/color-map-template.tsx +52 -0
  66. package/scripts/interaction-codegen.tsx +109 -0
  67. package/scripts/spacing-codegen-template.tsx +9 -1
  68. package/scripts/utils.tsx +5 -1
  69. package/src/components/__tests__/unit/box.test.tsx +50 -0
  70. package/src/components/__tests__/unit/inline.test.tsx +43 -0
  71. package/src/components/__tests__/unit/interaction-suface.test.tsx +70 -0
  72. package/src/components/__tests__/unit/stack.test.tsx +31 -0
  73. package/src/components/__tests__/unit/text.test.tsx +33 -0
  74. package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-basic-example-should-match-production-example-1-snap.png +3 -0
  75. package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-alignment-should-match-snapshot-1-snap.png +3 -0
  76. package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-background-and-padding-block-should-match-snapshot-1-snap.png +3 -0
  77. package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-background-and-padding-inline-should-match-snapshot-1-snap.png +3 -0
  78. package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-background-and-padding-should-match-snapshot-1-snap.png +3 -0
  79. package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-background-color-should-match-snapshot-1-snap.png +3 -0
  80. package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-border-color-should-match-snapshot-1-snap.png +3 -0
  81. package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-border-should-match-snapshot-1-snap.png +3 -0
  82. package/src/components/__tests__/visual-regression/__image_snapshots__/inline-snapshot-test-tsx-inline-alignment-example-should-match-snapshot-1-snap.png +3 -0
  83. package/src/components/__tests__/visual-regression/__image_snapshots__/inline-snapshot-test-tsx-inline-spacing-example-should-match-snapshot-1-snap.png +3 -0
  84. package/src/components/__tests__/visual-regression/__image_snapshots__/stack-snapshot-test-tsx-stack-alignment-example-should-match-snapshot-1-snap.png +3 -0
  85. package/src/components/__tests__/visual-regression/__image_snapshots__/stack-snapshot-test-tsx-stack-spacing-example-should-match-snapshot-1-snap.png +3 -0
  86. package/src/components/__tests__/visual-regression/__image_snapshots__/text-snapshot-test-tsx-text-example-with-font-sizes-should-match-snapshot-1-snap.png +3 -0
  87. package/src/components/__tests__/visual-regression/__image_snapshots__/text-snapshot-test-tsx-text-example-with-font-weights-should-match-snapshot-1-snap.png +3 -0
  88. package/src/components/__tests__/visual-regression/__image_snapshots__/text-snapshot-test-tsx-text-example-with-line-heights-should-match-snapshot-1-snap.png +3 -0
  89. package/src/components/__tests__/visual-regression/__image_snapshots__/text-snapshot-test-tsx-text-example-with-testing-should-match-snapshot-1-snap.png +3 -0
  90. package/src/components/__tests__/visual-regression/box-snapshot-test.tsx +33 -0
  91. package/src/components/__tests__/visual-regression/inline-snapshot-test.tsx +28 -0
  92. package/src/components/__tests__/visual-regression/stack-snapshot-test.tsx +28 -0
  93. package/src/components/__tests__/visual-regression/text-snapshot-test.tsx +31 -0
  94. package/src/components/box.partial.tsx +305 -127
  95. package/src/components/inline.partial.tsx +120 -0
  96. package/src/components/interaction-surface.partial.tsx +237 -0
  97. package/src/components/stack.partial.tsx +104 -0
  98. package/src/components/surface-provider.tsx +25 -0
  99. package/src/components/text.partial.tsx +149 -38
  100. package/src/components/types.tsx +15 -0
  101. package/src/constants.tsx +3 -0
  102. package/src/index.tsx +8 -1
  103. package/src/internal/color-map.tsx +34 -0
  104. package/src/internal/role-to-element.tsx +34 -0
  105. package/dist/cjs/components/inline.js +0 -45
  106. package/dist/cjs/components/stack.js +0 -33
  107. package/dist/es2019/components/inline.js +0 -31
  108. package/dist/es2019/components/stack.js +0 -22
  109. package/dist/esm/components/inline.js +0 -30
  110. package/dist/esm/components/stack.js +0 -21
  111. package/dist/types/components/inline.d.ts +0 -19
  112. package/dist/types/components/stack.d.ts +0 -16
  113. package/src/components/inline.tsx +0 -49
  114. package/src/components/stack.tsx +0 -30
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _react = require("react");
11
+
12
+ var _react2 = require("@emotion/react");
13
+
14
+ var _constants = require("../constants");
15
+
16
+ var _text = _interopRequireDefault(require("./text.partial"));
17
+
18
+ /** @jsx jsx */
19
+ var flexAlignItemsMap = {
20
+ center: (0, _react2.css)({
21
+ alignItems: 'center'
22
+ }),
23
+ baseline: (0, _react2.css)({
24
+ alignItems: 'baseline'
25
+ }),
26
+ flexStart: (0, _react2.css)({
27
+ alignItems: 'flex-start'
28
+ }),
29
+ flexEnd: (0, _react2.css)({
30
+ alignItems: 'flex-end'
31
+ })
32
+ };
33
+ var flexJustifyContentMap = {
34
+ center: (0, _react2.css)({
35
+ justifyContent: 'center'
36
+ }),
37
+ flexStart: (0, _react2.css)({
38
+ justifyContent: 'flex-start'
39
+ }),
40
+ flexEnd: (0, _react2.css)({
41
+ justifyContent: 'flex-end'
42
+ })
43
+ };
44
+ var baseStyles = (0, _react2.css)({
45
+ display: 'flex',
46
+ boxSizing: 'border-box',
47
+ flexDirection: 'row'
48
+ });
49
+ /**
50
+ * __Inline__
51
+ *
52
+ * Inline is a primitive component based on flexbox that manages the horizontal layout of direct children.
53
+ * Renders a `div` by default.
54
+ *
55
+ */
56
+
57
+ var Inline = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
58
+ var gap = _ref.gap,
59
+ alignItems = _ref.alignItems,
60
+ justifyContent = _ref.justifyContent,
61
+ divider = _ref.divider,
62
+ children = _ref.children,
63
+ testId = _ref.testId;
64
+ var dividerComponent = typeof divider === 'string' ? (0, _react2.jsx)(_text.default, null, divider) : divider;
65
+ return (0, _react2.jsx)("div", {
66
+ css: [baseStyles, gap && gapMap[gap], alignItems && flexAlignItemsMap[alignItems], justifyContent && flexJustifyContentMap[justifyContent]],
67
+ "data-testid": testId,
68
+ ref: ref
69
+ }, _react.Children.map(children, function (child, index) {
70
+ return (0, _react2.jsx)(_react.Fragment, null, divider && index > 0 ? dividerComponent : null, child);
71
+ }));
72
+ });
73
+ Inline.displayName = 'Inline';
74
+ var _default = Inline;
75
+ /**
76
+ * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
77
+ * @codegen <<SignedSource::36d00b5586593733c7f84e9a10ddb7fd>>
78
+ * @codegenId spacing
79
+ * @codegenCommand yarn codegen-styles
80
+ * @codegenParams ["gap"]
81
+ */
82
+
83
+ exports.default = _default;
84
+ var gapMap = {
85
+ 'sp-0': (0, _react2.css)({
86
+ gap: _constants.SPACING_SCALE['sp-0']
87
+ }),
88
+ 'sp-25': (0, _react2.css)({
89
+ gap: _constants.SPACING_SCALE['sp-25']
90
+ }),
91
+ 'sp-50': (0, _react2.css)({
92
+ gap: _constants.SPACING_SCALE['sp-50']
93
+ }),
94
+ 'sp-75': (0, _react2.css)({
95
+ gap: _constants.SPACING_SCALE['sp-75']
96
+ }),
97
+ 'sp-100': (0, _react2.css)({
98
+ gap: _constants.SPACING_SCALE['sp-100']
99
+ }),
100
+ 'sp-150': (0, _react2.css)({
101
+ gap: _constants.SPACING_SCALE['sp-150']
102
+ }),
103
+ 'sp-200': (0, _react2.css)({
104
+ gap: _constants.SPACING_SCALE['sp-200']
105
+ }),
106
+ 'sp-300': (0, _react2.css)({
107
+ gap: _constants.SPACING_SCALE['sp-300']
108
+ }),
109
+ 'sp-400': (0, _react2.css)({
110
+ gap: _constants.SPACING_SCALE['sp-400']
111
+ }),
112
+ 'sp-500': (0, _react2.css)({
113
+ gap: _constants.SPACING_SCALE['sp-500']
114
+ }),
115
+ 'sp-600': (0, _react2.css)({
116
+ gap: _constants.SPACING_SCALE['sp-600']
117
+ }),
118
+ 'sp-800': (0, _react2.css)({
119
+ gap: _constants.SPACING_SCALE['sp-800']
120
+ })
121
+ };
122
+ /**
123
+ * @codegenEnd
124
+ */
@@ -0,0 +1,253 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = require("react");
9
+
10
+ var _react2 = require("@emotion/react");
11
+
12
+ var _surfaceProvider = require("./surface-provider");
13
+
14
+ /** @jsx jsx */
15
+ var baseStyles = (0, _react2.css)({
16
+ position: 'absolute',
17
+ borderRadius: 'inherit',
18
+ cursor: 'pointer',
19
+ inset: 0,
20
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
21
+ '~ *': {
22
+ position: 'relative',
23
+ pointerEvents: 'none'
24
+ }
25
+ });
26
+
27
+ /**
28
+ *
29
+ * @example
30
+ * ```js
31
+ * // a minimal icon button
32
+ * <Box as="button">
33
+ * <InteractionSurface />
34
+ * <WarningIcon label="icon button" />
35
+ * </Box>
36
+ * ```
37
+ */
38
+ var InteractionSurface = function InteractionSurface(_ref) {
39
+ var appearance = _ref.appearance,
40
+ children = _ref.children,
41
+ testId = _ref.testId;
42
+ var defaultSurface = (0, _react.useContext)(_surfaceProvider.SurfaceContext);
43
+ var surface = appearance || defaultSurface; // This case will occur if the Box has not set a bg color and the ancestor surface
44
+ // is an elevation. An alternative would be to throw an error here as it may be better
45
+ // to ensure correct predictable behaviour based on user specification.
46
+
47
+ if (!(surface in backgroundActiveColorMap)) {
48
+ surface = 'neutral';
49
+ }
50
+
51
+ return (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)("span", {
52
+ "data-testid": testId,
53
+ css: [baseStyles, surface && backgroundHoverColorMap[surface], surface && backgroundActiveColorMap[surface]]
54
+ }), children);
55
+ };
56
+
57
+ var _default = InteractionSurface;
58
+ /**
59
+ * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
60
+ * @codegen <<SignedSource::45000716488a9f41306a232c1f4c9f8d>>
61
+ * @codegenId interactions
62
+ * @codegenCommand yarn codegen-styles
63
+ * @codegenParams ["background"]
64
+ */
65
+
66
+ exports.default = _default;
67
+ var backgroundActiveColorMap = {
68
+ 'inverse.subtle': (0, _react2.css)({
69
+ ':active': {
70
+ backgroundColor: "var(--ds-background-inverse-subtle-pressed, #00000052)"
71
+ }
72
+ }),
73
+ input: (0, _react2.css)({
74
+ ':active': {
75
+ backgroundColor: "var(--ds-background-input-pressed, #FFFFFF)"
76
+ }
77
+ }),
78
+ neutral: (0, _react2.css)({
79
+ ':active': {
80
+ backgroundColor: "var(--ds-background-neutral-pressed, #091E424F)"
81
+ }
82
+ }),
83
+ 'neutral.subtle': (0, _react2.css)({
84
+ ':active': {
85
+ backgroundColor: "var(--ds-background-neutral-subtle-pressed, #091E4224)"
86
+ }
87
+ }),
88
+ 'neutral.bold': (0, _react2.css)({
89
+ ':active': {
90
+ backgroundColor: "var(--ds-background-neutral-bold-pressed, #172B4D)"
91
+ }
92
+ }),
93
+ 'brand.bold': (0, _react2.css)({
94
+ ':active': {
95
+ backgroundColor: "var(--ds-background-brand-bold-pressed, #09326C)"
96
+ }
97
+ }),
98
+ selected: (0, _react2.css)({
99
+ ':active': {
100
+ backgroundColor: "var(--ds-background-selected-pressed, #85B8FF)"
101
+ }
102
+ }),
103
+ 'selected.bold': (0, _react2.css)({
104
+ ':active': {
105
+ backgroundColor: "var(--ds-background-selected-bold-pressed, #09326C)"
106
+ }
107
+ }),
108
+ danger: (0, _react2.css)({
109
+ ':active': {
110
+ backgroundColor: "var(--ds-background-danger-pressed, #FF9C8F)"
111
+ }
112
+ }),
113
+ 'danger.bold': (0, _react2.css)({
114
+ ':active': {
115
+ backgroundColor: "var(--ds-background-danger-bold-pressed, #601E16)"
116
+ }
117
+ }),
118
+ warning: (0, _react2.css)({
119
+ ':active': {
120
+ backgroundColor: "var(--ds-background-warning-pressed, #F5CD47)"
121
+ }
122
+ }),
123
+ 'warning.bold': (0, _react2.css)({
124
+ ':active': {
125
+ backgroundColor: "var(--ds-background-warning-bold-pressed, #B38600)"
126
+ }
127
+ }),
128
+ success: (0, _react2.css)({
129
+ ':active': {
130
+ backgroundColor: "var(--ds-background-success-pressed, #7EE2B8)"
131
+ }
132
+ }),
133
+ 'success.bold': (0, _react2.css)({
134
+ ':active': {
135
+ backgroundColor: "var(--ds-background-success-bold-pressed, #164B35)"
136
+ }
137
+ }),
138
+ discovery: (0, _react2.css)({
139
+ ':active': {
140
+ backgroundColor: "var(--ds-background-discovery-pressed, #B8ACF6)"
141
+ }
142
+ }),
143
+ 'discovery.bold': (0, _react2.css)({
144
+ ':active': {
145
+ backgroundColor: "var(--ds-background-discovery-bold-pressed, #352C63)"
146
+ }
147
+ }),
148
+ information: (0, _react2.css)({
149
+ ':active': {
150
+ backgroundColor: "var(--ds-background-information-pressed, #85B8FF)"
151
+ }
152
+ }),
153
+ 'information.bold': (0, _react2.css)({
154
+ ':active': {
155
+ backgroundColor: "var(--ds-background-information-bold-pressed, #09326C)"
156
+ }
157
+ })
158
+ };
159
+ var backgroundHoverColorMap = {
160
+ 'inverse.subtle': (0, _react2.css)({
161
+ ':hover': {
162
+ backgroundColor: "var(--ds-background-inverse-subtle-hovered, #0000003D)"
163
+ }
164
+ }),
165
+ input: (0, _react2.css)({
166
+ ':hover': {
167
+ backgroundColor: "var(--ds-background-input-hovered, #F7F8F9)"
168
+ }
169
+ }),
170
+ neutral: (0, _react2.css)({
171
+ ':hover': {
172
+ backgroundColor: "var(--ds-background-neutral-hovered, #091E4224)"
173
+ }
174
+ }),
175
+ 'neutral.subtle': (0, _react2.css)({
176
+ ':hover': {
177
+ backgroundColor: "var(--ds-background-neutral-subtle-hovered, #091E420F)"
178
+ }
179
+ }),
180
+ 'neutral.bold': (0, _react2.css)({
181
+ ':hover': {
182
+ backgroundColor: "var(--ds-background-neutral-bold-hovered, #2C3E5D)"
183
+ }
184
+ }),
185
+ 'brand.bold': (0, _react2.css)({
186
+ ':hover': {
187
+ backgroundColor: "var(--ds-background-brand-bold-hovered, #0055CC)"
188
+ }
189
+ }),
190
+ selected: (0, _react2.css)({
191
+ ':hover': {
192
+ backgroundColor: "var(--ds-background-selected-hovered, #CCE0FF)"
193
+ }
194
+ }),
195
+ 'selected.bold': (0, _react2.css)({
196
+ ':hover': {
197
+ backgroundColor: "var(--ds-background-selected-bold-hovered, #0055CC)"
198
+ }
199
+ }),
200
+ danger: (0, _react2.css)({
201
+ ':hover': {
202
+ backgroundColor: "var(--ds-background-danger-hovered, #FFD2CC)"
203
+ }
204
+ }),
205
+ 'danger.bold': (0, _react2.css)({
206
+ ':hover': {
207
+ backgroundColor: "var(--ds-background-danger-bold-hovered, #AE2A19)"
208
+ }
209
+ }),
210
+ warning: (0, _react2.css)({
211
+ ':hover': {
212
+ backgroundColor: "var(--ds-background-warning-hovered, #F8E6A0)"
213
+ }
214
+ }),
215
+ 'warning.bold': (0, _react2.css)({
216
+ ':hover': {
217
+ backgroundColor: "var(--ds-background-warning-bold-hovered, #CF9F02)"
218
+ }
219
+ }),
220
+ success: (0, _react2.css)({
221
+ ':hover': {
222
+ backgroundColor: "var(--ds-background-success-hovered, #BAF3DB)"
223
+ }
224
+ }),
225
+ 'success.bold': (0, _react2.css)({
226
+ ':hover': {
227
+ backgroundColor: "var(--ds-background-success-bold-hovered, #216E4E)"
228
+ }
229
+ }),
230
+ discovery: (0, _react2.css)({
231
+ ':hover': {
232
+ backgroundColor: "var(--ds-background-discovery-hovered, #DFD8FD)"
233
+ }
234
+ }),
235
+ 'discovery.bold': (0, _react2.css)({
236
+ ':hover': {
237
+ backgroundColor: "var(--ds-background-discovery-bold-hovered, #5E4DB2)"
238
+ }
239
+ }),
240
+ information: (0, _react2.css)({
241
+ ':hover': {
242
+ backgroundColor: "var(--ds-background-information-hovered, #CCE0FF)"
243
+ }
244
+ }),
245
+ 'information.bold': (0, _react2.css)({
246
+ ':hover': {
247
+ backgroundColor: "var(--ds-background-information-bold-hovered, #0055CC)"
248
+ }
249
+ })
250
+ };
251
+ /**
252
+ * @codegenEnd
253
+ */
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = require("react");
9
+
10
+ var _react2 = require("@emotion/react");
11
+
12
+ var _constants = require("../constants");
13
+
14
+ /** @jsx jsx */
15
+ var flexAlignItemsMap = {
16
+ center: (0, _react2.css)({
17
+ alignItems: 'center'
18
+ }),
19
+ baseline: (0, _react2.css)({
20
+ alignItems: 'baseline'
21
+ }),
22
+ flexStart: (0, _react2.css)({
23
+ alignItems: 'flex-start'
24
+ }),
25
+ flexEnd: (0, _react2.css)({
26
+ alignItems: 'flex-end'
27
+ })
28
+ };
29
+ var flexJustifyContentMap = {
30
+ center: (0, _react2.css)({
31
+ justifyContent: 'center'
32
+ }),
33
+ flexStart: (0, _react2.css)({
34
+ justifyContent: 'flex-start'
35
+ }),
36
+ flexEnd: (0, _react2.css)({
37
+ justifyContent: 'flex-end'
38
+ })
39
+ };
40
+ var baseStyles = (0, _react2.css)({
41
+ display: 'flex',
42
+ boxSizing: 'border-box',
43
+ flexDirection: 'column'
44
+ });
45
+ /**
46
+ * __Stack__
47
+ *
48
+ * Stack is a primitive component based on flexbox that manages the vertical layout of direct children.
49
+ * Renders a `div` by default.
50
+ *
51
+ */
52
+
53
+ var Stack = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
54
+ var gap = _ref.gap,
55
+ alignItems = _ref.alignItems,
56
+ justifyContent = _ref.justifyContent,
57
+ children = _ref.children,
58
+ testId = _ref.testId;
59
+ return (0, _react2.jsx)("div", {
60
+ css: [baseStyles, gap && gapMap[gap], alignItems && flexAlignItemsMap[alignItems], justifyContent && flexJustifyContentMap[justifyContent]],
61
+ "data-testid": testId,
62
+ ref: ref
63
+ }, children);
64
+ });
65
+ Stack.displayName = 'Stack';
66
+ var _default = Stack;
67
+ /**
68
+ * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
69
+ * @codegen <<SignedSource::36d00b5586593733c7f84e9a10ddb7fd>>
70
+ * @codegenId spacing
71
+ * @codegenCommand yarn codegen-styles
72
+ * @codegenParams ["gap"]
73
+ */
74
+
75
+ exports.default = _default;
76
+ var gapMap = {
77
+ 'sp-0': (0, _react2.css)({
78
+ gap: _constants.SPACING_SCALE['sp-0']
79
+ }),
80
+ 'sp-25': (0, _react2.css)({
81
+ gap: _constants.SPACING_SCALE['sp-25']
82
+ }),
83
+ 'sp-50': (0, _react2.css)({
84
+ gap: _constants.SPACING_SCALE['sp-50']
85
+ }),
86
+ 'sp-75': (0, _react2.css)({
87
+ gap: _constants.SPACING_SCALE['sp-75']
88
+ }),
89
+ 'sp-100': (0, _react2.css)({
90
+ gap: _constants.SPACING_SCALE['sp-100']
91
+ }),
92
+ 'sp-150': (0, _react2.css)({
93
+ gap: _constants.SPACING_SCALE['sp-150']
94
+ }),
95
+ 'sp-200': (0, _react2.css)({
96
+ gap: _constants.SPACING_SCALE['sp-200']
97
+ }),
98
+ 'sp-300': (0, _react2.css)({
99
+ gap: _constants.SPACING_SCALE['sp-300']
100
+ }),
101
+ 'sp-400': (0, _react2.css)({
102
+ gap: _constants.SPACING_SCALE['sp-400']
103
+ }),
104
+ 'sp-500': (0, _react2.css)({
105
+ gap: _constants.SPACING_SCALE['sp-500']
106
+ }),
107
+ 'sp-600': (0, _react2.css)({
108
+ gap: _constants.SPACING_SCALE['sp-600']
109
+ }),
110
+ 'sp-800': (0, _react2.css)({
111
+ gap: _constants.SPACING_SCALE['sp-800']
112
+ })
113
+ };
114
+ /**
115
+ * @codegenEnd
116
+ */
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useSurface = exports.SurfaceContext = void 0;
7
+
8
+ var _react = require("react");
9
+
10
+ /**
11
+ * __Surface context__
12
+ *
13
+ * A surface context provides context information on the current background (if set).
14
+ */
15
+ var SurfaceContext = /*#__PURE__*/(0, _react.createContext)('elevation.surface');
16
+ /**
17
+ * __useSurface__
18
+ *
19
+ * Return the current surface. If no parent sets a surface color it falls back to the default surface.
20
+ *
21
+ * @see SurfaceContext
22
+ */
23
+
24
+ exports.SurfaceContext = SurfaceContext;
25
+
26
+ var useSurface = function useSurface() {
27
+ return (0, _react.useContext)(SurfaceContext);
28
+ };
29
+
30
+ exports.useSurface = useSurface;
31
+ SurfaceContext.displayName = 'SurfaceProvider';