@atlaskit/primitives 1.0.1 → 1.0.3

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 (62) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/constellation/box/code.mdx +8 -0
  3. package/constellation/box/examples.mdx +8 -1
  4. package/constellation/flex/code.mdx +14 -2
  5. package/constellation/flex/examples.mdx +9 -0
  6. package/constellation/grid/code.mdx +19 -0
  7. package/constellation/grid/examples.mdx +46 -0
  8. package/constellation/inline/code.mdx +8 -0
  9. package/constellation/inline/examples.mdx +9 -1
  10. package/constellation/overview/index.mdx +8 -0
  11. package/constellation/responsive/01-show/examples.mdx +31 -0
  12. package/constellation/responsive/02-hide/examples.mdx +30 -0
  13. package/constellation/responsive/03-breakpoints/examples.mdx +51 -0
  14. package/constellation/responsive/examples.mdx +12 -23
  15. package/constellation/stack/code.mdx +8 -0
  16. package/constellation/stack/examples.mdx +9 -1
  17. package/constellation/xcss/examples.mdx +8 -0
  18. package/dist/cjs/components/flex.js +7 -3
  19. package/dist/cjs/components/grid.js +127 -0
  20. package/dist/cjs/components/inline.js +16 -48
  21. package/dist/cjs/components/stack.js +19 -39
  22. package/dist/cjs/index.js +13 -0
  23. package/dist/cjs/version.json +1 -1
  24. package/dist/cjs/xcss/style-maps.partial.js +8 -2
  25. package/dist/cjs/xcss/xcss.js +1 -1
  26. package/dist/es2019/components/flex.js +6 -3
  27. package/dist/es2019/components/grid.js +118 -0
  28. package/dist/es2019/components/inline.js +15 -49
  29. package/dist/es2019/components/stack.js +18 -40
  30. package/dist/es2019/index.js +2 -1
  31. package/dist/es2019/responsive/build-media-query-css.js +0 -1
  32. package/dist/es2019/version.json +1 -1
  33. package/dist/es2019/xcss/style-maps.partial.js +8 -2
  34. package/dist/es2019/xcss/xcss.js +1 -1
  35. package/dist/esm/components/flex.js +7 -3
  36. package/dist/esm/components/grid.js +119 -0
  37. package/dist/esm/components/inline.js +16 -49
  38. package/dist/esm/components/stack.js +19 -40
  39. package/dist/esm/index.js +2 -1
  40. package/dist/esm/version.json +1 -1
  41. package/dist/esm/xcss/style-maps.partial.js +8 -2
  42. package/dist/esm/xcss/xcss.js +1 -1
  43. package/dist/types/components/flex.d.ts +17 -8
  44. package/dist/types/components/grid.d.ts +154 -0
  45. package/dist/types/components/inline.d.ts +50 -12
  46. package/dist/types/components/stack.d.ts +38 -8
  47. package/dist/types/index.d.ts +2 -1
  48. package/dist/types/xcss/style-maps.partial.d.ts +8 -2
  49. package/dist/types/xcss/xcss.d.ts +11 -14
  50. package/dist/types-ts4.5/components/flex.d.ts +17 -8
  51. package/dist/types-ts4.5/components/grid.d.ts +154 -0
  52. package/dist/types-ts4.5/components/inline.d.ts +50 -12
  53. package/dist/types-ts4.5/components/stack.d.ts +38 -8
  54. package/dist/types-ts4.5/index.d.ts +2 -1
  55. package/dist/types-ts4.5/xcss/style-maps.partial.d.ts +8 -2
  56. package/dist/types-ts4.5/xcss/xcss.d.ts +11 -14
  57. package/extract-react-types/flex-props.tsx +80 -0
  58. package/extract-react-types/grid-props.tsx +102 -0
  59. package/package.json +47 -40
  60. package/report.api.md +276 -59
  61. package/scripts/__tests__/__snapshots__/codegen.test.tsx.snap +24 -0
  62. package/tmp/api-report-tmp.d.ts +0 -670
@@ -1,64 +1,27 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.default = void 0;
8
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
7
9
  var _react = require("react");
8
10
  var _react2 = require("@emotion/react");
9
- var _styleMaps = require("../xcss/style-maps.partial");
10
11
  var _xcss = require("../xcss/xcss");
12
+ var _flex = _interopRequireDefault(require("./flex"));
11
13
  /* eslint-disable @repo/internal/styles/no-exported-styles */
12
14
  /** @jsx jsx */
13
15
 
14
- var alignItemsMap = {
15
- center: (0, _react2.css)({
16
- alignItems: 'center'
17
- }),
18
- baseline: (0, _react2.css)({
19
- alignItems: 'baseline'
20
- }),
21
- start: (0, _react2.css)({
22
- alignItems: 'flex-start'
23
- }),
24
- end: (0, _react2.css)({
25
- alignItems: 'flex-end'
26
- }),
27
- stretch: (0, _react2.css)({
28
- alignItems: 'stretch'
29
- })
30
- };
31
- var justifyContentMap = {
32
- start: (0, _react2.css)({
33
- justifyContent: 'flex-start'
34
- }),
35
- center: (0, _react2.css)({
36
- justifyContent: 'center'
37
- }),
38
- end: (0, _react2.css)({
39
- justifyContent: 'flex-end'
40
- }),
41
- 'space-between': (0, _react2.css)({
42
- justifyContent: 'space-between'
43
- })
44
- };
45
16
  var flexGrowMap = {
46
- hug: (0, _react2.css)({
17
+ hug: (0, _xcss.xcss)({
47
18
  flexGrow: 0
48
19
  }),
49
- fill: (0, _react2.css)({
20
+ fill: (0, _xcss.xcss)({
50
21
  width: '100%',
51
22
  flexGrow: 1
52
23
  })
53
24
  };
54
- var flexWrapStyles = (0, _react2.css)({
55
- flexWrap: 'wrap'
56
- });
57
- var baseStyles = (0, _react2.css)({
58
- display: 'flex',
59
- boxSizing: 'border-box',
60
- flexDirection: 'row'
61
- });
62
25
  var separatorStyles = (0, _react2.css)({
63
26
  color: "var(--ds-text-subtle, #42526E)",
64
27
  marginBlock: "var(--ds-space-0, 0px)",
@@ -103,7 +66,6 @@ var Inline = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(
103
66
  xcss = _ref2.xcss,
104
67
  testId = _ref2.testId,
105
68
  rawChildren = _ref2.children;
106
- var Component = as || 'div';
107
69
  var separatorComponent = typeof separator === 'string' ? (0, _react2.jsx)(Separator, null, separator) : separator;
108
70
  var children = separatorComponent ? _react.Children.toArray(rawChildren).filter(Boolean).map(function (child, index) {
109
71
  return (0, _react2.jsx)(_react.Fragment, {
@@ -111,12 +73,18 @@ var Inline = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(
111
73
  }, separator && index > 0 ? separatorComponent : null, child);
112
74
  }) : rawChildren;
113
75
  var justifyContent = spread || alignInline;
114
- var className = xcss && (0, _xcss.parseXcss)(xcss);
115
- return (0, _react2.jsx)(Component, {
116
- css: [
76
+ return (0, _react2.jsx)(_flex.default, {
77
+ as: as,
78
+ alignItems: alignItems,
79
+ justifyContent: justifyContent,
80
+ direction: "row",
81
+ gap: space,
82
+ rowGap: rowSpace,
83
+ wrap: shouldWrap ? 'wrap' : undefined,
84
+ xcss: grow ? [flexGrowMap[grow]].concat((0, _toConsumableArray2.default)(Array.isArray(xcss) ? xcss : [xcss])) :
117
85
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
118
- className, baseStyles, space && _styleMaps.spaceStylesMap.gap[space], justifyContent && justifyContentMap[justifyContent], grow && flexGrowMap[grow], alignItems && alignItemsMap[alignItems], shouldWrap && flexWrapStyles, rowSpace && _styleMaps.spaceStylesMap.rowGap[rowSpace]],
119
- "data-testid": testId,
86
+ xcss,
87
+ testId: testId,
120
88
  ref: ref
121
89
  }, children);
122
90
  }));
@@ -1,59 +1,32 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.default = void 0;
8
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
7
9
  var _react = require("react");
8
10
  var _react2 = require("@emotion/react");
9
- var _styleMaps = require("../xcss/style-maps.partial");
11
+ var _xcss = require("../xcss/xcss");
12
+ var _flex = _interopRequireDefault(require("./flex"));
10
13
  /* eslint-disable @repo/internal/styles/no-exported-styles */
11
14
  /** @jsx jsx */
12
15
 
13
- var justifyContentMap = {
14
- start: (0, _react2.css)({
15
- justifyContent: 'start'
16
- }),
17
- center: (0, _react2.css)({
18
- justifyContent: 'center'
19
- }),
20
- end: (0, _react2.css)({
21
- justifyContent: 'end'
22
- }),
23
- 'space-between': (0, _react2.css)({
24
- justifyContent: 'space-between'
25
- })
26
- };
27
- var alignItemsMap = {
28
- start: (0, _react2.css)({
29
- alignItems: 'start'
30
- }),
31
- center: (0, _react2.css)({
32
- alignItems: 'center'
33
- }),
34
- end: (0, _react2.css)({
35
- alignItems: 'end'
36
- })
37
- };
38
16
  var flexGrowMap = {
39
- hug: (0, _react2.css)({
17
+ hug: (0, _xcss.xcss)({
40
18
  flexGrow: 0
41
19
  }),
42
- fill: (0, _react2.css)({
20
+ fill: (0, _xcss.xcss)({
43
21
  width: '100%',
44
22
  flexGrow: 1
45
23
  })
46
24
  };
47
- var baseStyles = (0, _react2.css)({
48
- display: 'flex',
49
- boxSizing: 'border-box',
50
- flexDirection: 'column'
51
- });
52
25
 
53
26
  /**
54
27
  * __Stack__
55
28
  *
56
- * Stack is a primitive component based on flexbox that manages the vertical layout of direct children.
29
+ * Stack is a primitive component based on flexbox that manages the block layout of direct children.
57
30
  *
58
31
  * @example
59
32
  * ```tsx
@@ -72,12 +45,19 @@ var Stack = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(f
72
45
  grow = _ref.grow,
73
46
  space = _ref.space,
74
47
  children = _ref.children,
75
- testId = _ref.testId;
76
- var Component = as || 'div';
48
+ testId = _ref.testId,
49
+ xcss = _ref.xcss;
77
50
  var justifyContent = spread || alignBlock;
78
- return (0, _react2.jsx)(Component, {
79
- css: [baseStyles, space && _styleMaps.spaceStylesMap.gap[space], alignItems && alignItemsMap[alignItems], grow && flexGrowMap[grow], justifyContent && justifyContentMap[justifyContent]],
80
- "data-testid": testId,
51
+ return (0, _react2.jsx)(_flex.default, {
52
+ as: as,
53
+ gap: space,
54
+ direction: "column",
55
+ alignItems: alignItems,
56
+ justifyContent: justifyContent,
57
+ xcss: grow ? [flexGrowMap[grow]].concat((0, _toConsumableArray2.default)(Array.isArray(xcss) ? xcss : [xcss])) :
58
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
59
+ xcss,
60
+ testId: testId,
81
61
  ref: ref
82
62
  }, children);
83
63
  }));
package/dist/cjs/index.js CHANGED
@@ -16,6 +16,12 @@ Object.defineProperty(exports, "Flex", {
16
16
  return _flex.default;
17
17
  }
18
18
  });
19
+ Object.defineProperty(exports, "Grid", {
20
+ enumerable: true,
21
+ get: function get() {
22
+ return _grid.default;
23
+ }
24
+ });
19
25
  Object.defineProperty(exports, "Inline", {
20
26
  enumerable: true,
21
27
  get: function get() {
@@ -46,6 +52,12 @@ Object.defineProperty(exports, "UNSAFE_media", {
46
52
  return _responsive.UNSAFE_media;
47
53
  }
48
54
  });
55
+ Object.defineProperty(exports, "media", {
56
+ enumerable: true,
57
+ get: function get() {
58
+ return _responsive.media;
59
+ }
60
+ });
49
61
  Object.defineProperty(exports, "xcss", {
50
62
  enumerable: true,
51
63
  get: function get() {
@@ -58,4 +70,5 @@ var _inline = _interopRequireDefault(require("./components/inline"));
58
70
  var _xcss = require("./xcss/xcss");
59
71
  var _stack = _interopRequireDefault(require("./components/stack"));
60
72
  var _flex = _interopRequireDefault(require("./components/flex"));
73
+ var _grid = _interopRequireDefault(require("./components/grid"));
61
74
  var _responsive = require("./responsive");
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "sideEffects": false
5
5
  }
@@ -60,11 +60,11 @@ exports.spaceMap = spaceMap;
60
60
 
61
61
  /**
62
62
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
63
- * @codegen <<SignedSource::65b57f72ff07d4c4245a3eafe8cef786>>
63
+ * @codegen <<SignedSource::ce1e2114942246d556d0b102fe77b724>>
64
64
  * @codegenId colors
65
65
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
66
66
  * @codegenParams ["border", "background", "shadow", "text", "fill"]
67
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::efb3dfea27ab3db2fb3756ed9657c5cb>>
67
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::d09e7cd13e24113267155813747b3bd4>>
68
68
  */
69
69
  var borderColorMap = {
70
70
  'color.border': "var(--ds-border, #091e4221)",
@@ -155,9 +155,15 @@ var backgroundColorMap = {
155
155
  'color.background.selected.bold': "var(--ds-background-selected-bold, #0052CC)",
156
156
  'color.background.selected.bold.hovered': "var(--ds-background-selected-bold-hovered, #2684FF)",
157
157
  'color.background.selected.bold.pressed': "var(--ds-background-selected-bold-pressed, #0052CC)",
158
+ 'color.background.brand.subtlest': "var(--ds-background-brand-subtlest, #B3D4FF)",
159
+ 'color.background.brand.subtlest.hovered': "var(--ds-background-brand-subtlest-hovered, #DEEBFF)",
160
+ 'color.background.brand.subtlest.pressed': "var(--ds-background-brand-subtlest-pressed, #4C9AFF)",
158
161
  'color.background.brand.bold': "var(--ds-background-brand-bold, #0052CC)",
159
162
  'color.background.brand.bold.hovered': "var(--ds-background-brand-bold-hovered, #0065FF)",
160
163
  'color.background.brand.bold.pressed': "var(--ds-background-brand-bold-pressed, #0747A6)",
164
+ 'color.background.brand.boldest': "var(--ds-background-brand-boldest, #0747A6)",
165
+ 'color.background.brand.boldest.hovered': "var(--ds-background-brand-boldest-hovered, #0052CC)",
166
+ 'color.background.brand.boldest.pressed': "var(--ds-background-brand-boldest-pressed, #0747A6)",
161
167
  'color.background.danger': "var(--ds-background-danger, #FFEBE6)",
162
168
  'color.background.danger.hovered': "var(--ds-background-danger-hovered, #FFBDAD)",
163
169
  'color.background.danger.pressed': "var(--ds-background-danger-pressed, #FF8F73)",
@@ -161,7 +161,7 @@ exports.parseXcss = parseXcss;
161
161
  var boxWrapper = function boxWrapper(style) {
162
162
  return xcss(style);
163
163
  };
164
- var inlineWrapper = function inlineWrapper(style) {
164
+ var spaceWrapper = function spaceWrapper(style) {
165
165
  return xcss(style);
166
166
  };
167
167
  /**
@@ -55,6 +55,9 @@ const alignItemsMap = {
55
55
  }),
56
56
  end: css({
57
57
  alignItems: 'end'
58
+ }),
59
+ stretch: css({
60
+ alignItems: 'stretch'
58
61
  })
59
62
  };
60
63
  const baseStyles = css({
@@ -83,10 +86,11 @@ const baseStyles = css({
83
86
  * ```
84
87
  */
85
88
  const Flex = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
86
- as,
89
+ as: Component = 'div',
87
90
  alignItems,
88
91
  justifyContent,
89
92
  gap,
93
+ columnGap,
90
94
  rowGap,
91
95
  children,
92
96
  testId,
@@ -94,10 +98,9 @@ const Flex = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
94
98
  wrap,
95
99
  xcss
96
100
  }, ref) => {
97
- const Component = as || 'div';
98
101
  const xcssClassName = xcss && parseXcss(xcss);
99
102
  return jsx(Component, {
100
- css: [baseStyles, gap && spaceStylesMap.gap[gap], rowGap && spaceStylesMap.rowGap[rowGap], alignItems && alignItemsMap[alignItems], direction && flexDirectionMap[direction], justifyContent && justifyContentMap[justifyContent], wrap && flexWrapMap[wrap],
103
+ css: [baseStyles, gap && spaceStylesMap.gap[gap], columnGap && spaceStylesMap.columnGap[columnGap], rowGap && spaceStylesMap.rowGap[rowGap], alignItems && alignItemsMap[alignItems], direction && flexDirectionMap[direction], justifyContent && justifyContentMap[justifyContent], wrap && flexWrapMap[wrap],
101
104
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
102
105
  xcssClassName && xcssClassName],
103
106
  "data-testid": testId,
@@ -0,0 +1,118 @@
1
+ /* eslint-disable @repo/internal/styles/no-exported-styles */
2
+ /** @jsx jsx */
3
+ import { forwardRef, memo } from 'react';
4
+ import { css, jsx } from '@emotion/react';
5
+ import { spaceStylesMap } from '../xcss/style-maps.partial';
6
+ import { parseXcss } from '../xcss/xcss';
7
+ const justifyContentMap = {
8
+ start: css({
9
+ justifyContent: 'start'
10
+ }),
11
+ center: css({
12
+ justifyContent: 'center'
13
+ }),
14
+ end: css({
15
+ justifyContent: 'end'
16
+ }),
17
+ 'space-between': css({
18
+ justifyContent: 'space-between'
19
+ }),
20
+ 'space-around': css({
21
+ justifyContent: 'space-around'
22
+ }),
23
+ 'space-evenly': css({
24
+ justifyContent: 'space-evenly'
25
+ }),
26
+ stretch: css({
27
+ justifyContent: 'stretch'
28
+ })
29
+ };
30
+ const alignItemsMap = {
31
+ start: css({
32
+ alignItems: 'start'
33
+ }),
34
+ center: css({
35
+ alignItems: 'center'
36
+ }),
37
+ baseline: css({
38
+ alignItems: 'baseline'
39
+ }),
40
+ end: css({
41
+ alignItems: 'end'
42
+ })
43
+ };
44
+ const baseStyles = css({
45
+ display: 'grid',
46
+ boxSizing: 'border-box'
47
+ });
48
+ const gridAutoFlowMap = {
49
+ row: css({
50
+ gridAutoFlow: 'row'
51
+ }),
52
+ column: css({
53
+ gridAutoFlow: 'column'
54
+ }),
55
+ dense: css({
56
+ gridAutoFlow: 'dense'
57
+ }),
58
+ 'row dense': css({
59
+ gridAutoFlow: 'row dense'
60
+ }),
61
+ 'column dense': css({
62
+ gridAutoFlow: 'column dense'
63
+ })
64
+ };
65
+
66
+ /**
67
+ * __Grid__
68
+ *
69
+ * `Grid` is a primitive component that implements the CSS Grid API.
70
+ *
71
+ * - [Examples](https://atlassian.design/components/primitives/grid/examples)
72
+ * - [Code](https://atlassian.design/components/primitives/grid/code)
73
+ *
74
+ * @example
75
+ * ```tsx
76
+ * import { Grid, Box } from '@atlaskit/primitives'
77
+ *
78
+ * const Component = () => (
79
+ * <Grid gap="space.100" gridColumns="1fr 1fr">
80
+ * <Box padding="space.100" backgroundColor="neutral"></Box>
81
+ * <Box padding="space.100" backgroundColor="neutral"></Box>
82
+ * </Grid>
83
+ * )
84
+ * ```
85
+ */
86
+ const Grid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
87
+ as,
88
+ alignItems,
89
+ justifyContent,
90
+ gap,
91
+ columnGap,
92
+ rowGap,
93
+ children,
94
+ testId,
95
+ autoFlow,
96
+ templateAreas: gridTemplateAreas,
97
+ templateRows: gridTemplateRows,
98
+ templateColumns: gridTemplateColumns,
99
+ xcss
100
+ }, ref) => {
101
+ const Component = as || 'div';
102
+ const xcssClassName = xcss && parseXcss(xcss);
103
+ const style = gridTemplateAreas || gridTemplateColumns || gridTemplateRows ? Object.assign({}, {
104
+ gridTemplateAreas: gridTemplateAreas ? gridTemplateAreas.map(str => `"${str}"`).join('\n') : undefined,
105
+ gridTemplateColumns,
106
+ gridTemplateRows
107
+ }) : undefined;
108
+ return jsx(Component, {
109
+ style: style,
110
+ css: [baseStyles, gap && spaceStylesMap.gap[gap], columnGap && spaceStylesMap.columnGap[columnGap], rowGap && spaceStylesMap.rowGap[rowGap], alignItems && alignItemsMap[alignItems], justifyContent && justifyContentMap[justifyContent], autoFlow && gridAutoFlowMap[autoFlow],
111
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
112
+ xcssClassName && xcssClassName],
113
+ "data-testid": testId,
114
+ ref: ref
115
+ }, children);
116
+ }));
117
+ Grid.displayName = 'Grid';
118
+ export default Grid;
@@ -2,56 +2,17 @@
2
2
  /** @jsx jsx */
3
3
  import { Children, forwardRef, Fragment, memo } from 'react';
4
4
  import { css, jsx } from '@emotion/react';
5
- import { spaceStylesMap } from '../xcss/style-maps.partial';
6
- import { parseXcss } from '../xcss/xcss';
7
- const alignItemsMap = {
8
- center: css({
9
- alignItems: 'center'
10
- }),
11
- baseline: css({
12
- alignItems: 'baseline'
13
- }),
14
- start: css({
15
- alignItems: 'flex-start'
16
- }),
17
- end: css({
18
- alignItems: 'flex-end'
19
- }),
20
- stretch: css({
21
- alignItems: 'stretch'
22
- })
23
- };
24
- const justifyContentMap = {
25
- start: css({
26
- justifyContent: 'flex-start'
27
- }),
28
- center: css({
29
- justifyContent: 'center'
30
- }),
31
- end: css({
32
- justifyContent: 'flex-end'
33
- }),
34
- 'space-between': css({
35
- justifyContent: 'space-between'
36
- })
37
- };
5
+ import { xcss } from '../xcss/xcss';
6
+ import Flex from './flex';
38
7
  const flexGrowMap = {
39
- hug: css({
8
+ hug: xcss({
40
9
  flexGrow: 0
41
10
  }),
42
- fill: css({
11
+ fill: xcss({
43
12
  width: '100%',
44
13
  flexGrow: 1
45
14
  })
46
15
  };
47
- const flexWrapStyles = css({
48
- flexWrap: 'wrap'
49
- });
50
- const baseStyles = css({
51
- display: 'flex',
52
- boxSizing: 'border-box',
53
- flexDirection: 'row'
54
- });
55
16
  const separatorStyles = css({
56
17
  color: "var(--ds-text-subtle, #42526E)",
57
18
  marginBlock: "var(--ds-space-0, 0px)",
@@ -94,7 +55,6 @@ const Inline = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
94
55
  testId,
95
56
  children: rawChildren
96
57
  }, ref) => {
97
- const Component = as || 'div';
98
58
  const separatorComponent = typeof separator === 'string' ? jsx(Separator, null, separator) : separator;
99
59
  const children = separatorComponent ? Children.toArray(rawChildren).filter(Boolean).map((child, index) => {
100
60
  return jsx(Fragment, {
@@ -102,12 +62,18 @@ const Inline = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
102
62
  }, separator && index > 0 ? separatorComponent : null, child);
103
63
  }) : rawChildren;
104
64
  const justifyContent = spread || alignInline;
105
- const className = xcss && parseXcss(xcss);
106
- return jsx(Component, {
107
- css: [
65
+ return jsx(Flex, {
66
+ as: as,
67
+ alignItems: alignItems,
68
+ justifyContent: justifyContent,
69
+ direction: "row",
70
+ gap: space,
71
+ rowGap: rowSpace,
72
+ wrap: shouldWrap ? 'wrap' : undefined,
73
+ xcss: grow ? [flexGrowMap[grow], ...(Array.isArray(xcss) ? xcss : [xcss])] :
108
74
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
109
- className, baseStyles, space && spaceStylesMap.gap[space], justifyContent && justifyContentMap[justifyContent], grow && flexGrowMap[grow], alignItems && alignItemsMap[alignItems], shouldWrap && flexWrapStyles, rowSpace && spaceStylesMap.rowGap[rowSpace]],
110
- "data-testid": testId,
75
+ xcss,
76
+ testId: testId,
111
77
  ref: ref
112
78
  }, children);
113
79
  }));
@@ -1,52 +1,23 @@
1
1
  /* eslint-disable @repo/internal/styles/no-exported-styles */
2
2
  /** @jsx jsx */
3
3
  import { forwardRef, memo } from 'react';
4
- import { css, jsx } from '@emotion/react';
5
- import { spaceStylesMap } from '../xcss/style-maps.partial';
6
- const justifyContentMap = {
7
- start: css({
8
- justifyContent: 'start'
9
- }),
10
- center: css({
11
- justifyContent: 'center'
12
- }),
13
- end: css({
14
- justifyContent: 'end'
15
- }),
16
- 'space-between': css({
17
- justifyContent: 'space-between'
18
- })
19
- };
20
- const alignItemsMap = {
21
- start: css({
22
- alignItems: 'start'
23
- }),
24
- center: css({
25
- alignItems: 'center'
26
- }),
27
- end: css({
28
- alignItems: 'end'
29
- })
30
- };
4
+ import { jsx } from '@emotion/react';
5
+ import { xcss } from '../xcss/xcss';
6
+ import Flex from './flex';
31
7
  const flexGrowMap = {
32
- hug: css({
8
+ hug: xcss({
33
9
  flexGrow: 0
34
10
  }),
35
- fill: css({
11
+ fill: xcss({
36
12
  width: '100%',
37
13
  flexGrow: 1
38
14
  })
39
15
  };
40
- const baseStyles = css({
41
- display: 'flex',
42
- boxSizing: 'border-box',
43
- flexDirection: 'column'
44
- });
45
16
 
46
17
  /**
47
18
  * __Stack__
48
19
  *
49
- * Stack is a primitive component based on flexbox that manages the vertical layout of direct children.
20
+ * Stack is a primitive component based on flexbox that manages the block layout of direct children.
50
21
  *
51
22
  * @example
52
23
  * ```tsx
@@ -65,13 +36,20 @@ const Stack = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
65
36
  grow,
66
37
  space,
67
38
  children,
68
- testId
39
+ testId,
40
+ xcss
69
41
  }, ref) => {
70
- const Component = as || 'div';
71
42
  const justifyContent = spread || alignBlock;
72
- return jsx(Component, {
73
- css: [baseStyles, space && spaceStylesMap.gap[space], alignItems && alignItemsMap[alignItems], grow && flexGrowMap[grow], justifyContent && justifyContentMap[justifyContent]],
74
- "data-testid": testId,
43
+ return jsx(Flex, {
44
+ as: as,
45
+ gap: space,
46
+ direction: "column",
47
+ alignItems: alignItems,
48
+ justifyContent: justifyContent,
49
+ xcss: grow ? [flexGrowMap[grow], ...(Array.isArray(xcss) ? xcss : [xcss])] :
50
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
51
+ xcss,
52
+ testId: testId,
75
53
  ref: ref
76
54
  }, children);
77
55
  }));
@@ -4,4 +4,5 @@ export { default as Inline } from './components/inline';
4
4
  export { xcss } from './xcss/xcss';
5
5
  export { default as Stack } from './components/stack';
6
6
  export { default as Flex } from './components/flex';
7
- export { UNSAFE_media, UNSAFE_BREAKPOINTS_CONFIG } from './responsive';
7
+ export { default as Grid } from './components/grid';
8
+ export { media, UNSAFE_media, UNSAFE_BREAKPOINTS_CONFIG } from './responsive';
@@ -30,7 +30,6 @@ export const UNSAFE_buildAboveMediaQueryCSS = input => {
30
30
  return UNSAFE_BREAKPOINTS_ORDERED_LIST.reduce((acc, breakpoint) => ({
31
31
  ...acc,
32
32
  [breakpoint]: css({
33
- // eslint-disable-next-line @repo/internal/styles/no-nested-styles
34
33
  [media.above[breakpoint]]: typeof input === 'function' ? input(breakpoint) : input
35
34
  })
36
35
  }), {});
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "sideEffects": false
5
5
  }
@@ -48,11 +48,11 @@ export const spaceMap = {
48
48
  */
49
49
  /**
50
50
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
51
- * @codegen <<SignedSource::65b57f72ff07d4c4245a3eafe8cef786>>
51
+ * @codegen <<SignedSource::ce1e2114942246d556d0b102fe77b724>>
52
52
  * @codegenId colors
53
53
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
54
54
  * @codegenParams ["border", "background", "shadow", "text", "fill"]
55
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::efb3dfea27ab3db2fb3756ed9657c5cb>>
55
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::d09e7cd13e24113267155813747b3bd4>>
56
56
  */
57
57
  export const borderColorMap = {
58
58
  'color.border': "var(--ds-border, #091e4221)",
@@ -142,9 +142,15 @@ export const backgroundColorMap = {
142
142
  'color.background.selected.bold': "var(--ds-background-selected-bold, #0052CC)",
143
143
  'color.background.selected.bold.hovered': "var(--ds-background-selected-bold-hovered, #2684FF)",
144
144
  'color.background.selected.bold.pressed': "var(--ds-background-selected-bold-pressed, #0052CC)",
145
+ 'color.background.brand.subtlest': "var(--ds-background-brand-subtlest, #B3D4FF)",
146
+ 'color.background.brand.subtlest.hovered': "var(--ds-background-brand-subtlest-hovered, #DEEBFF)",
147
+ 'color.background.brand.subtlest.pressed': "var(--ds-background-brand-subtlest-pressed, #4C9AFF)",
145
148
  'color.background.brand.bold': "var(--ds-background-brand-bold, #0052CC)",
146
149
  'color.background.brand.bold.hovered': "var(--ds-background-brand-bold-hovered, #0065FF)",
147
150
  'color.background.brand.bold.pressed': "var(--ds-background-brand-bold-pressed, #0747A6)",
151
+ 'color.background.brand.boldest': "var(--ds-background-brand-boldest, #0747A6)",
152
+ 'color.background.brand.boldest.hovered': "var(--ds-background-brand-boldest-hovered, #0052CC)",
153
+ 'color.background.brand.boldest.pressed': "var(--ds-background-brand-boldest-pressed, #0747A6)",
148
154
  'color.background.danger': "var(--ds-background-danger, #FFEBE6)",
149
155
  'color.background.danger.hovered': "var(--ds-background-danger-hovered, #FFBDAD)",
150
156
  'color.background.danger.pressed': "var(--ds-background-danger-pressed, #FF8F73)",
@@ -142,7 +142,7 @@ export const parseXcss = args => {
142
142
 
143
143
  // unused private functions only so we can extract the return type from a generic function
144
144
  const boxWrapper = style => xcss(style);
145
- const inlineWrapper = style => xcss(style);
145
+ const spaceWrapper = style => xcss(style);
146
146
  /**
147
147
  * ### xcss
148
148
  *