@atlaskit/primitives 1.0.0 → 1.0.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 (53) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/constellation/flex/code.mdx +7 -0
  3. package/constellation/flex/examples.mdx +34 -0
  4. package/constellation/grid/code.mdx +7 -0
  5. package/constellation/grid/examples.mdx +38 -0
  6. package/constellation/overview/index.mdx +20 -14
  7. package/dist/cjs/components/flex.js +119 -0
  8. package/dist/cjs/components/grid.js +127 -0
  9. package/dist/cjs/components/inline.js +16 -48
  10. package/dist/cjs/components/stack.js +19 -39
  11. package/dist/cjs/index.js +20 -0
  12. package/dist/cjs/responsive/media-helper.js +15 -0
  13. package/dist/cjs/version.json +1 -1
  14. package/dist/cjs/xcss/xcss.js +1 -1
  15. package/dist/es2019/components/flex.js +111 -0
  16. package/dist/es2019/components/grid.js +118 -0
  17. package/dist/es2019/components/inline.js +15 -49
  18. package/dist/es2019/components/stack.js +18 -40
  19. package/dist/es2019/index.js +3 -1
  20. package/dist/es2019/responsive/build-media-query-css.js +0 -1
  21. package/dist/es2019/responsive/media-helper.js +15 -0
  22. package/dist/es2019/version.json +1 -1
  23. package/dist/es2019/xcss/xcss.js +1 -1
  24. package/dist/esm/components/flex.js +111 -0
  25. package/dist/esm/components/grid.js +119 -0
  26. package/dist/esm/components/inline.js +16 -49
  27. package/dist/esm/components/stack.js +19 -40
  28. package/dist/esm/index.js +3 -1
  29. package/dist/esm/responsive/media-helper.js +15 -0
  30. package/dist/esm/version.json +1 -1
  31. package/dist/esm/xcss/xcss.js +1 -1
  32. package/dist/types/components/box.d.ts +1 -2
  33. package/dist/types/components/flex.d.ts +137 -0
  34. package/dist/types/components/grid.d.ts +154 -0
  35. package/dist/types/components/inline.d.ts +50 -12
  36. package/dist/types/components/stack.d.ts +38 -8
  37. package/dist/types/components/types.d.ts +2 -6
  38. package/dist/types/index.d.ts +4 -1
  39. package/dist/types/responsive/media-helper.d.ts +30 -0
  40. package/dist/types/xcss/xcss.d.ts +13 -16
  41. package/dist/types-ts4.5/components/box.d.ts +1 -2
  42. package/dist/types-ts4.5/components/flex.d.ts +137 -0
  43. package/dist/types-ts4.5/components/grid.d.ts +154 -0
  44. package/dist/types-ts4.5/components/inline.d.ts +50 -12
  45. package/dist/types-ts4.5/components/stack.d.ts +38 -8
  46. package/dist/types-ts4.5/components/types.d.ts +2 -6
  47. package/dist/types-ts4.5/index.d.ts +4 -1
  48. package/dist/types-ts4.5/responsive/media-helper.d.ts +30 -0
  49. package/dist/types-ts4.5/xcss/xcss.d.ts +13 -16
  50. package/extract-react-types/box-props.tsx +1 -9
  51. package/package.json +21 -5
  52. package/report.api.md +404 -75
  53. package/tmp/api-report-tmp.d.ts +200 -52
@@ -0,0 +1,119 @@
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
+ var 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
+ var 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
+ var baseStyles = css({
45
+ display: 'grid',
46
+ boxSizing: 'border-box'
47
+ });
48
+ var 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
+ var Grid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref) {
87
+ var as = _ref.as,
88
+ alignItems = _ref.alignItems,
89
+ justifyContent = _ref.justifyContent,
90
+ gap = _ref.gap,
91
+ columnGap = _ref.columnGap,
92
+ rowGap = _ref.rowGap,
93
+ children = _ref.children,
94
+ testId = _ref.testId,
95
+ autoFlow = _ref.autoFlow,
96
+ gridTemplateAreas = _ref.templateAreas,
97
+ gridTemplateRows = _ref.templateRows,
98
+ gridTemplateColumns = _ref.templateColumns,
99
+ xcss = _ref.xcss;
100
+ var Component = as || 'div';
101
+ var xcssClassName = xcss && parseXcss(xcss);
102
+ var style = gridTemplateAreas || gridTemplateColumns || gridTemplateRows ? Object.assign({}, {
103
+ gridTemplateAreas: gridTemplateAreas ? gridTemplateAreas.map(function (str) {
104
+ return "\"".concat(str, "\"");
105
+ }).join('\n') : undefined,
106
+ gridTemplateColumns: gridTemplateColumns,
107
+ gridTemplateRows: gridTemplateRows
108
+ }) : undefined;
109
+ return jsx(Component, {
110
+ style: style,
111
+ css: [baseStyles, gap && spaceStylesMap.gap[gap], columnGap && spaceStylesMap.columnGap[columnGap], rowGap && spaceStylesMap.rowGap[rowGap], alignItems && alignItemsMap[alignItems], justifyContent && justifyContentMap[justifyContent], autoFlow && gridAutoFlowMap[autoFlow],
112
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
113
+ xcssClassName && xcssClassName],
114
+ "data-testid": testId,
115
+ ref: ref
116
+ }, children);
117
+ }));
118
+ Grid.displayName = 'Grid';
119
+ export default Grid;
@@ -1,57 +1,19 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
1
2
  /* eslint-disable @repo/internal/styles/no-exported-styles */
2
3
  /** @jsx jsx */
3
4
  import { Children, forwardRef, Fragment, memo } from 'react';
4
5
  import { css, jsx } from '@emotion/react';
5
- import { spaceStylesMap } from '../xcss/style-maps.partial';
6
- import { parseXcss } from '../xcss/xcss';
7
- var 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
- var 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
- };
6
+ import { xcss } from '../xcss/xcss';
7
+ import Flex from './flex';
38
8
  var flexGrowMap = {
39
- hug: css({
9
+ hug: xcss({
40
10
  flexGrow: 0
41
11
  }),
42
- fill: css({
12
+ fill: xcss({
43
13
  width: '100%',
44
14
  flexGrow: 1
45
15
  })
46
16
  };
47
- var flexWrapStyles = css({
48
- flexWrap: 'wrap'
49
- });
50
- var baseStyles = css({
51
- display: 'flex',
52
- boxSizing: 'border-box',
53
- flexDirection: 'row'
54
- });
55
17
  var separatorStyles = css({
56
18
  color: "var(--ds-text-subtle, #42526E)",
57
19
  marginBlock: "var(--ds-space-0, 0px)",
@@ -96,7 +58,6 @@ var Inline = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref2, ref) {
96
58
  xcss = _ref2.xcss,
97
59
  testId = _ref2.testId,
98
60
  rawChildren = _ref2.children;
99
- var Component = as || 'div';
100
61
  var separatorComponent = typeof separator === 'string' ? jsx(Separator, null, separator) : separator;
101
62
  var children = separatorComponent ? Children.toArray(rawChildren).filter(Boolean).map(function (child, index) {
102
63
  return jsx(Fragment, {
@@ -104,12 +65,18 @@ var Inline = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref2, ref) {
104
65
  }, separator && index > 0 ? separatorComponent : null, child);
105
66
  }) : rawChildren;
106
67
  var justifyContent = spread || alignInline;
107
- var className = xcss && parseXcss(xcss);
108
- return jsx(Component, {
109
- css: [
68
+ return jsx(Flex, {
69
+ as: as,
70
+ alignItems: alignItems,
71
+ justifyContent: justifyContent,
72
+ direction: "row",
73
+ gap: space,
74
+ rowGap: rowSpace,
75
+ wrap: shouldWrap ? 'wrap' : undefined,
76
+ xcss: grow ? [flexGrowMap[grow]].concat(_toConsumableArray(Array.isArray(xcss) ? xcss : [xcss])) :
110
77
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
111
- className, baseStyles, space && spaceStylesMap.gap[space], justifyContent && justifyContentMap[justifyContent], grow && flexGrowMap[grow], alignItems && alignItemsMap[alignItems], shouldWrap && flexWrapStyles, rowSpace && spaceStylesMap.rowGap[rowSpace]],
112
- "data-testid": testId,
78
+ xcss,
79
+ testId: testId,
113
80
  ref: ref
114
81
  }, children);
115
82
  }));
@@ -1,52 +1,24 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
1
2
  /* eslint-disable @repo/internal/styles/no-exported-styles */
2
3
  /** @jsx jsx */
3
4
  import { forwardRef, memo } from 'react';
4
- import { css, jsx } from '@emotion/react';
5
- import { spaceStylesMap } from '../xcss/style-maps.partial';
6
- var 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
- var alignItemsMap = {
21
- start: css({
22
- alignItems: 'start'
23
- }),
24
- center: css({
25
- alignItems: 'center'
26
- }),
27
- end: css({
28
- alignItems: 'end'
29
- })
30
- };
5
+ import { jsx } from '@emotion/react';
6
+ import { xcss } from '../xcss/xcss';
7
+ import Flex from './flex';
31
8
  var flexGrowMap = {
32
- hug: css({
9
+ hug: xcss({
33
10
  flexGrow: 0
34
11
  }),
35
- fill: css({
12
+ fill: xcss({
36
13
  width: '100%',
37
14
  flexGrow: 1
38
15
  })
39
16
  };
40
- var baseStyles = css({
41
- display: 'flex',
42
- boxSizing: 'border-box',
43
- flexDirection: 'column'
44
- });
45
17
 
46
18
  /**
47
19
  * __Stack__
48
20
  *
49
- * Stack is a primitive component based on flexbox that manages the vertical layout of direct children.
21
+ * Stack is a primitive component based on flexbox that manages the block layout of direct children.
50
22
  *
51
23
  * @example
52
24
  * ```tsx
@@ -65,12 +37,19 @@ var Stack = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref) {
65
37
  grow = _ref.grow,
66
38
  space = _ref.space,
67
39
  children = _ref.children,
68
- testId = _ref.testId;
69
- var Component = as || 'div';
40
+ testId = _ref.testId,
41
+ xcss = _ref.xcss;
70
42
  var justifyContent = spread || alignBlock;
71
- return jsx(Component, {
72
- css: [baseStyles, space && spaceStylesMap.gap[space], alignItems && alignItemsMap[alignItems], grow && flexGrowMap[grow], justifyContent && justifyContentMap[justifyContent]],
73
- "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]].concat(_toConsumableArray(Array.isArray(xcss) ? xcss : [xcss])) :
50
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
51
+ xcss,
52
+ testId: testId,
74
53
  ref: ref
75
54
  }, children);
76
55
  }));
package/dist/esm/index.js CHANGED
@@ -3,4 +3,6 @@ export { default as Pressable } from './components/pressable';
3
3
  export { default as Inline } from './components/inline';
4
4
  export { xcss } from './xcss/xcss';
5
5
  export { default as Stack } from './components/stack';
6
- export { UNSAFE_media, UNSAFE_BREAKPOINTS_CONFIG } from './responsive';
6
+ export { default as Flex } from './components/flex';
7
+ export { default as Grid } from './components/grid';
8
+ export { media, UNSAFE_media, UNSAFE_BREAKPOINTS_CONFIG } from './responsive';
@@ -15,10 +15,25 @@ export var UNSAFE_media = {
15
15
  * `above.xxs` is redundant and no media query should be used, but it's included for programatic purposes…
16
16
  */
17
17
  xxs: "@media all",
18
+ /**
19
+ * Used for mobile viewports.
20
+ */
18
21
  xs: "@media (min-width: ".concat(UNSAFE_BREAKPOINTS_CONFIG.xs.min, ")"),
22
+ /**
23
+ * Used for tablet viewports.
24
+ */
19
25
  sm: "@media (min-width: ".concat(UNSAFE_BREAKPOINTS_CONFIG.sm.min, ")"),
26
+ /**
27
+ * Used for laptop viewports.
28
+ */
20
29
  md: "@media (min-width: ".concat(UNSAFE_BREAKPOINTS_CONFIG.md.min, ")"),
30
+ /**
31
+ * Used for desktop viewports.
32
+ */
21
33
  lg: "@media (min-width: ".concat(UNSAFE_BREAKPOINTS_CONFIG.lg.min, ")"),
34
+ /**
35
+ * Used for wide screen desktop viewports.
36
+ */
22
37
  xl: "@media (min-width: ".concat(UNSAFE_BREAKPOINTS_CONFIG.xl.min, ")")
23
38
  },
24
39
  /**
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "sideEffects": false
5
5
  }
@@ -152,7 +152,7 @@ export var parseXcss = function parseXcss(args) {
152
152
  var boxWrapper = function boxWrapper(style) {
153
153
  return xcss(style);
154
154
  };
155
- var inlineWrapper = function inlineWrapper(style) {
155
+ var spaceWrapper = function spaceWrapper(style) {
156
156
  return xcss(style);
157
157
  };
158
158
  /**
@@ -1,8 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import { ElementType, FC, ReactElement } from 'react';
3
3
  import { BaseBoxProps } from './internal/base-box';
4
- import type { PublicBoxPropsBase } from './types';
5
- export type BoxProps<T extends ElementType = 'div'> = Omit<BaseBoxProps<T>, 'className'> & PublicBoxPropsBase;
4
+ export type BoxProps<T extends ElementType = 'div'> = Omit<BaseBoxProps<T>, 'className'>;
6
5
  type BoxComponent<T extends ElementType = 'div'> = (<T extends ElementType = 'div'>(props: BoxProps<T>) => ReactElement | null) & FC<BoxProps<T>>;
7
6
  /**
8
7
  * __Box__
@@ -0,0 +1,137 @@
1
+ /** @jsx jsx */
2
+ import { ElementType, ReactNode } from 'react';
3
+ import { type Space } from '../xcss/style-maps.partial';
4
+ import type { BasePrimitiveProps } from './types';
5
+ export type FlexProps<T extends ElementType = 'div'> = {
6
+ /**
7
+ * The DOM element to render as the Flex. Defaults to `div`.
8
+ */
9
+ as?: 'div' | 'span' | 'ul' | 'ol' | 'li';
10
+ /**
11
+ * Used to align children along the main axis.
12
+ */
13
+ justifyContent?: JustifyContent;
14
+ /**
15
+ * Used to align children along the cross axis.
16
+ */
17
+ alignItems?: AlignItems;
18
+ /**
19
+ * Represents the space between each child.
20
+ */
21
+ columnGap?: Space;
22
+ /**
23
+ * Represents the space between each child.
24
+ */
25
+ gap?: Space;
26
+ /**
27
+ * Represents the space between each child.
28
+ */
29
+ rowGap?: Space;
30
+ /**
31
+ * Represents the flex direction property of CSS flexbox.
32
+ */
33
+ direction?: Direction;
34
+ /**
35
+ * Represents the flex wrap property of CSS flexbox.
36
+ */
37
+ wrap?: Wrap;
38
+ /**
39
+ * Elements to be rendered inside the Flex.
40
+ */
41
+ children: ReactNode;
42
+ /**
43
+ * Forwarded ref element
44
+ */
45
+ ref?: React.ComponentPropsWithRef<T>['ref'];
46
+ } & BasePrimitiveProps;
47
+ export type AlignItems = keyof typeof alignItemsMap;
48
+ export type JustifyContent = keyof typeof justifyContentMap;
49
+ export type Direction = keyof typeof flexDirectionMap;
50
+ export type Wrap = keyof typeof flexWrapMap;
51
+ declare const justifyContentMap: {
52
+ readonly start: import("@emotion/react").SerializedStyles;
53
+ readonly center: import("@emotion/react").SerializedStyles;
54
+ readonly end: import("@emotion/react").SerializedStyles;
55
+ readonly 'space-between': import("@emotion/react").SerializedStyles;
56
+ readonly 'space-around': import("@emotion/react").SerializedStyles;
57
+ readonly 'space-evenly': import("@emotion/react").SerializedStyles;
58
+ readonly stretch: import("@emotion/react").SerializedStyles;
59
+ };
60
+ declare const flexDirectionMap: {
61
+ readonly column: import("@emotion/react").SerializedStyles;
62
+ readonly row: import("@emotion/react").SerializedStyles;
63
+ };
64
+ declare const flexWrapMap: {
65
+ readonly wrap: import("@emotion/react").SerializedStyles;
66
+ readonly nowrap: import("@emotion/react").SerializedStyles;
67
+ };
68
+ declare const alignItemsMap: {
69
+ readonly start: import("@emotion/react").SerializedStyles;
70
+ readonly center: import("@emotion/react").SerializedStyles;
71
+ readonly baseline: import("@emotion/react").SerializedStyles;
72
+ readonly end: import("@emotion/react").SerializedStyles;
73
+ readonly stretch: import("@emotion/react").SerializedStyles;
74
+ };
75
+ /**
76
+ * __Flex__
77
+ *
78
+ * `Flex` is a primitive component that implements the CSS Flexbox API.
79
+ *
80
+ * - [Examples](https://atlassian.design/components/primitives/flex/examples)
81
+ * - [Code](https://atlassian.design/components/primitives/flex/code)
82
+ *
83
+ * @example
84
+ * ```tsx
85
+ * import { Flex, Box } from '@atlaskit/primitives'
86
+ *
87
+ * const Component = () => (
88
+ * <Flex direction="column">
89
+ * <Box padding="space.100" backgroundColor="neutral"></Box>
90
+ * <Box padding="space.100" backgroundColor="neutral"></Box>
91
+ * </Flex>
92
+ * )
93
+ * ```
94
+ */
95
+ declare const Flex: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Pick<{
96
+ /**
97
+ * The DOM element to render as the Flex. Defaults to `div`.
98
+ */
99
+ as?: "div" | "li" | "ol" | "span" | "ul" | undefined;
100
+ /**
101
+ * Used to align children along the main axis.
102
+ */
103
+ justifyContent?: "space-around" | "space-between" | "space-evenly" | "stretch" | "center" | "end" | "start" | undefined;
104
+ /**
105
+ * Used to align children along the cross axis.
106
+ */
107
+ alignItems?: "stretch" | "center" | "end" | "start" | "baseline" | undefined;
108
+ /**
109
+ * Represents the space between each child.
110
+ */
111
+ columnGap?: "space.0" | "space.025" | "space.050" | "space.075" | "space.100" | "space.150" | "space.200" | "space.250" | "space.300" | "space.400" | "space.500" | "space.600" | "space.800" | "space.1000" | undefined;
112
+ /**
113
+ * Represents the space between each child.
114
+ */
115
+ gap?: "space.0" | "space.025" | "space.050" | "space.075" | "space.100" | "space.150" | "space.200" | "space.250" | "space.300" | "space.400" | "space.500" | "space.600" | "space.800" | "space.1000" | undefined;
116
+ /**
117
+ * Represents the space between each child.
118
+ */
119
+ rowGap?: "space.0" | "space.025" | "space.050" | "space.075" | "space.100" | "space.150" | "space.200" | "space.250" | "space.300" | "space.400" | "space.500" | "space.600" | "space.800" | "space.1000" | undefined;
120
+ /**
121
+ * Represents the flex direction property of CSS flexbox.
122
+ */
123
+ direction?: "column" | "row" | undefined;
124
+ /**
125
+ * Represents the flex wrap property of CSS flexbox.
126
+ */
127
+ wrap?: "nowrap" | "wrap" | undefined;
128
+ /**
129
+ * Elements to be rendered inside the Flex.
130
+ */
131
+ children: ReactNode;
132
+ /**
133
+ * Forwarded ref element
134
+ */
135
+ ref?: any;
136
+ } & BasePrimitiveProps, "gap" | "rowGap" | "columnGap" | "alignItems" | "direction" | "justifyContent" | "as" | "children" | keyof BasePrimitiveProps | "wrap"> & import("react").RefAttributes<any>>>;
137
+ export default Flex;
@@ -0,0 +1,154 @@
1
+ /** @jsx jsx */
2
+ import { ElementType, ReactNode } from 'react';
3
+ import { type Space } from '../xcss/style-maps.partial';
4
+ import type { BasePrimitiveProps } from './types';
5
+ export type GridProps<T extends ElementType = 'div'> = {
6
+ /**
7
+ * The DOM element to render as the Flex. Defaults to `div`.
8
+ */
9
+ as?: 'div' | 'span' | 'ul' | 'ol';
10
+ /**
11
+ * Used to align children along the inline axis.
12
+ */
13
+ justifyContent?: JustifyContent;
14
+ /**
15
+ * Used to align children along the block axis.
16
+ */
17
+ alignItems?: AlignItems;
18
+ /**
19
+ * Represents the space between each column.
20
+ */
21
+ columnGap?: Space;
22
+ /**
23
+ * Represents the space between each child across both axes.
24
+ */
25
+ gap?: Space;
26
+ /**
27
+ * Represents the space between each row.
28
+ */
29
+ rowGap?: Space;
30
+ /**
31
+ * Specifies how auto-placed items get flowed into the grid. CSS `grid-auto-flow`.
32
+ */
33
+ autoFlow?: AutoFlow;
34
+ /**
35
+ * CSS `grid-template-rows`.
36
+ */
37
+ templateRows?: string;
38
+ /**
39
+ * CSS `grid-template-columns`.
40
+ */
41
+ templateColumns?: string;
42
+ /**
43
+ * CSS `grid-template-areas`.
44
+ *
45
+ * Each item in the passed array is a grid row.
46
+ */
47
+ templateAreas?: string[];
48
+ /**
49
+ * Elements to be rendered inside the grid. Required as a grid without children should not be a grid.
50
+ */
51
+ children: ReactNode;
52
+ /**
53
+ * Forwarded ref element
54
+ */
55
+ ref?: React.ComponentPropsWithRef<T>['ref'];
56
+ } & BasePrimitiveProps;
57
+ export type JustifyContent = keyof typeof justifyContentMap;
58
+ export type AlignItems = keyof typeof alignItemsMap;
59
+ declare const justifyContentMap: {
60
+ readonly start: import("@emotion/react").SerializedStyles;
61
+ readonly center: import("@emotion/react").SerializedStyles;
62
+ readonly end: import("@emotion/react").SerializedStyles;
63
+ readonly 'space-between': import("@emotion/react").SerializedStyles;
64
+ readonly 'space-around': import("@emotion/react").SerializedStyles;
65
+ readonly 'space-evenly': import("@emotion/react").SerializedStyles;
66
+ readonly stretch: import("@emotion/react").SerializedStyles;
67
+ };
68
+ declare const alignItemsMap: {
69
+ readonly start: import("@emotion/react").SerializedStyles;
70
+ readonly center: import("@emotion/react").SerializedStyles;
71
+ readonly baseline: import("@emotion/react").SerializedStyles;
72
+ readonly end: import("@emotion/react").SerializedStyles;
73
+ };
74
+ type AutoFlow = keyof typeof gridAutoFlowMap;
75
+ declare const gridAutoFlowMap: {
76
+ readonly row: import("@emotion/react").SerializedStyles;
77
+ readonly column: import("@emotion/react").SerializedStyles;
78
+ readonly dense: import("@emotion/react").SerializedStyles;
79
+ readonly 'row dense': import("@emotion/react").SerializedStyles;
80
+ readonly 'column dense': import("@emotion/react").SerializedStyles;
81
+ };
82
+ /**
83
+ * __Grid__
84
+ *
85
+ * `Grid` is a primitive component that implements the CSS Grid API.
86
+ *
87
+ * - [Examples](https://atlassian.design/components/primitives/grid/examples)
88
+ * - [Code](https://atlassian.design/components/primitives/grid/code)
89
+ *
90
+ * @example
91
+ * ```tsx
92
+ * import { Grid, Box } from '@atlaskit/primitives'
93
+ *
94
+ * const Component = () => (
95
+ * <Grid gap="space.100" gridColumns="1fr 1fr">
96
+ * <Box padding="space.100" backgroundColor="neutral"></Box>
97
+ * <Box padding="space.100" backgroundColor="neutral"></Box>
98
+ * </Grid>
99
+ * )
100
+ * ```
101
+ */
102
+ declare const Grid: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Pick<{
103
+ /**
104
+ * The DOM element to render as the Flex. Defaults to `div`.
105
+ */
106
+ as?: "div" | "ol" | "span" | "ul" | undefined;
107
+ /**
108
+ * Used to align children along the inline axis.
109
+ */
110
+ justifyContent?: "space-around" | "space-between" | "space-evenly" | "stretch" | "center" | "end" | "start" | undefined;
111
+ /**
112
+ * Used to align children along the block axis.
113
+ */
114
+ alignItems?: "center" | "end" | "start" | "baseline" | undefined;
115
+ /**
116
+ * Represents the space between each column.
117
+ */
118
+ columnGap?: "space.0" | "space.025" | "space.050" | "space.075" | "space.100" | "space.150" | "space.200" | "space.250" | "space.300" | "space.400" | "space.500" | "space.600" | "space.800" | "space.1000" | undefined;
119
+ /**
120
+ * Represents the space between each child across both axes.
121
+ */
122
+ gap?: "space.0" | "space.025" | "space.050" | "space.075" | "space.100" | "space.150" | "space.200" | "space.250" | "space.300" | "space.400" | "space.500" | "space.600" | "space.800" | "space.1000" | undefined;
123
+ /**
124
+ * Represents the space between each row.
125
+ */
126
+ rowGap?: "space.0" | "space.025" | "space.050" | "space.075" | "space.100" | "space.150" | "space.200" | "space.250" | "space.300" | "space.400" | "space.500" | "space.600" | "space.800" | "space.1000" | undefined;
127
+ /**
128
+ * Specifies how auto-placed items get flowed into the grid. CSS `grid-auto-flow`.
129
+ */
130
+ autoFlow?: "column" | "row" | "dense" | "row dense" | "column dense" | undefined;
131
+ /**
132
+ * CSS `grid-template-rows`.
133
+ */
134
+ templateRows?: string | undefined;
135
+ /**
136
+ * CSS `grid-template-columns`.
137
+ */
138
+ templateColumns?: string | undefined;
139
+ /**
140
+ * CSS `grid-template-areas`.
141
+ *
142
+ * Each item in the passed array is a grid row.
143
+ */
144
+ templateAreas?: string[] | undefined;
145
+ /**
146
+ * Elements to be rendered inside the grid. Required as a grid without children should not be a grid.
147
+ */
148
+ children: ReactNode;
149
+ /**
150
+ * Forwarded ref element
151
+ */
152
+ ref?: any;
153
+ } & BasePrimitiveProps, "gap" | "rowGap" | "columnGap" | "alignItems" | "justifyContent" | "as" | "children" | keyof BasePrimitiveProps | "autoFlow" | "templateAreas" | "templateRows" | "templateColumns"> & import("react").RefAttributes<any>>>;
154
+ export default Grid;