@atlaskit/primitives 1.0.1 → 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 (40) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/constellation/grid/code.mdx +7 -0
  3. package/constellation/grid/examples.mdx +38 -0
  4. package/dist/cjs/components/flex.js +7 -3
  5. package/dist/cjs/components/grid.js +127 -0
  6. package/dist/cjs/components/inline.js +16 -48
  7. package/dist/cjs/components/stack.js +19 -39
  8. package/dist/cjs/index.js +13 -0
  9. package/dist/cjs/version.json +1 -1
  10. package/dist/cjs/xcss/xcss.js +1 -1
  11. package/dist/es2019/components/flex.js +6 -3
  12. package/dist/es2019/components/grid.js +118 -0
  13. package/dist/es2019/components/inline.js +15 -49
  14. package/dist/es2019/components/stack.js +18 -40
  15. package/dist/es2019/index.js +2 -1
  16. package/dist/es2019/responsive/build-media-query-css.js +0 -1
  17. package/dist/es2019/version.json +1 -1
  18. package/dist/es2019/xcss/xcss.js +1 -1
  19. package/dist/esm/components/flex.js +7 -3
  20. package/dist/esm/components/grid.js +119 -0
  21. package/dist/esm/components/inline.js +16 -49
  22. package/dist/esm/components/stack.js +19 -40
  23. package/dist/esm/index.js +2 -1
  24. package/dist/esm/version.json +1 -1
  25. package/dist/esm/xcss/xcss.js +1 -1
  26. package/dist/types/components/flex.d.ts +17 -8
  27. package/dist/types/components/grid.d.ts +154 -0
  28. package/dist/types/components/inline.d.ts +50 -12
  29. package/dist/types/components/stack.d.ts +38 -8
  30. package/dist/types/index.d.ts +2 -1
  31. package/dist/types/xcss/xcss.d.ts +11 -14
  32. package/dist/types-ts4.5/components/flex.d.ts +17 -8
  33. package/dist/types-ts4.5/components/grid.d.ts +154 -0
  34. package/dist/types-ts4.5/components/inline.d.ts +50 -12
  35. package/dist/types-ts4.5/components/stack.d.ts +38 -8
  36. package/dist/types-ts4.5/index.d.ts +2 -1
  37. package/dist/types-ts4.5/xcss/xcss.d.ts +11 -14
  38. package/package.json +21 -14
  39. package/report.api.md +270 -59
  40. package/tmp/api-report-tmp.d.ts +122 -37
@@ -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;
@@ -1,8 +1,8 @@
1
1
  /** @jsx jsx */
2
2
  import { ElementType, ReactNode } from 'react';
3
3
  import { type Space } from '../xcss/style-maps.partial';
4
- import { type InlineXCSS } from '../xcss/xcss';
5
- export interface InlineProps<T extends ElementType = 'div'> {
4
+ import { BasePrimitiveProps } from './types';
5
+ export type InlineProps<T extends ElementType = 'div'> = {
6
6
  /**
7
7
  * The DOM element to render as the Inline. Defaults to `div`.
8
8
  */
@@ -40,14 +40,6 @@ export interface InlineProps<T extends ElementType = 'div'> {
40
40
  * Renders a separator string between each child.
41
41
  */
42
42
  separator?: string;
43
- /**
44
- * Safe subset of styles that can be applied as a classname.
45
- */
46
- xcss?: InlineXCSS | Array<InlineXCSS | false | undefined>;
47
- /**
48
- * A unique string that appears as data attribute data-testid in the rendered code, serving as a hook for automated tests.
49
- */
50
- testId?: string;
51
43
  /**
52
44
  * Elements to be rendered inside the Inline.
53
45
  */
@@ -56,7 +48,7 @@ export interface InlineProps<T extends ElementType = 'div'> {
56
48
  * Forwarded ref element
57
49
  */
58
50
  ref?: React.ComponentPropsWithRef<T>['ref'];
59
- }
51
+ } & BasePrimitiveProps;
60
52
  export type AlignInline = 'start' | 'center' | 'end';
61
53
  export type AlignBlock = 'start' | 'center' | 'end' | 'baseline' | 'stretch';
62
54
  export type Spread = 'space-between';
@@ -76,5 +68,51 @@ export type Grow = 'hug' | 'fill';
76
68
  * ```
77
69
  *
78
70
  */
79
- declare const Inline: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Pick<InlineProps<ElementType<any>>, "as" | "children" | "testId" | "xcss" | "alignInline" | "alignBlock" | "shouldWrap" | "spread" | "grow" | "space" | "rowSpace" | "separator"> & import("react").RefAttributes<any>>>;
71
+ declare const Inline: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Pick<{
72
+ /**
73
+ * The DOM element to render as the Inline. Defaults to `div`.
74
+ */
75
+ as?: "div" | "li" | "ol" | "span" | "ul" | undefined;
76
+ /**
77
+ * Used to align children along the main axis.
78
+ */
79
+ alignBlock?: AlignBlock | undefined;
80
+ /**
81
+ * Used to align children along the cross axis.
82
+ */
83
+ alignInline?: AlignInline | undefined;
84
+ /**
85
+ * Used to set whether children are forced onto one line or will wrap onto multiple lines.
86
+ */
87
+ shouldWrap?: boolean | undefined;
88
+ /**
89
+ * Used to distribute the children along the main axis.
90
+ */
91
+ spread?: "space-between" | undefined;
92
+ /**
93
+ * Used to set whether the container should grow to fill the available space.
94
+ */
95
+ grow?: Grow | undefined;
96
+ /**
97
+ * Represents the space between each child.
98
+ */
99
+ space?: "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;
100
+ /**
101
+ * Represents the space between rows when content wraps.
102
+ * Used to override the `space` value in between rows.
103
+ */
104
+ rowSpace?: "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;
105
+ /**
106
+ * Renders a separator string between each child.
107
+ */
108
+ separator?: string | undefined;
109
+ /**
110
+ * Elements to be rendered inside the Inline.
111
+ */
112
+ children: ReactNode;
113
+ /**
114
+ * Forwarded ref element
115
+ */
116
+ ref?: any;
117
+ } & BasePrimitiveProps, "as" | "children" | keyof BasePrimitiveProps | "space" | "separator" | "alignInline" | "alignBlock" | "shouldWrap" | "spread" | "grow" | "rowSpace"> & import("react").RefAttributes<any>>>;
80
118
  export default Inline;
@@ -1,7 +1,8 @@
1
1
  /** @jsx jsx */
2
2
  import { ElementType, ReactNode } from 'react';
3
3
  import { type Space } from '../xcss/style-maps.partial';
4
- export interface StackProps<T extends ElementType = 'div'> {
4
+ import type { BasePrimitiveProps } from './types';
5
+ export type StackProps<T extends ElementType = 'div'> = {
5
6
  /**
6
7
  * The DOM element to render as the Stack. Defaults to `div`.
7
8
  */
@@ -26,10 +27,6 @@ export interface StackProps<T extends ElementType = 'div'> {
26
27
  * Represents the space between each child.
27
28
  */
28
29
  space?: Space;
29
- /**
30
- * A unique string that appears as data attribute data-testid in the rendered code, serving as a hook for automated tests.
31
- */
32
- testId?: string;
33
30
  /**
34
31
  * Elements to be rendered inside the Stack.
35
32
  */
@@ -38,7 +35,7 @@ export interface StackProps<T extends ElementType = 'div'> {
38
35
  * Forwarded ref element
39
36
  */
40
37
  ref?: React.ComponentPropsWithRef<T>['ref'];
41
- }
38
+ } & BasePrimitiveProps;
42
39
  export type AlignInline = 'start' | 'center' | 'end';
43
40
  export type AlignBlock = 'start' | 'center' | 'end';
44
41
  export type Spread = 'space-between';
@@ -46,7 +43,7 @@ export type Grow = 'hug' | 'fill';
46
43
  /**
47
44
  * __Stack__
48
45
  *
49
- * Stack is a primitive component based on flexbox that manages the vertical layout of direct children.
46
+ * Stack is a primitive component based on flexbox that manages the block layout of direct children.
50
47
  *
51
48
  * @example
52
49
  * ```tsx
@@ -57,5 +54,38 @@ export type Grow = 'hug' | 'fill';
57
54
  * ```
58
55
  *
59
56
  */
60
- declare const Stack: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Pick<StackProps<ElementType<any>>, "as" | "children" | "testId" | "alignInline" | "alignBlock" | "spread" | "grow" | "space"> & import("react").RefAttributes<any>>>;
57
+ declare const Stack: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Pick<{
58
+ /**
59
+ * The DOM element to render as the Stack. Defaults to `div`.
60
+ */
61
+ as?: "div" | "ol" | "span" | "ul" | undefined;
62
+ /**
63
+ * Used to align children along the main axis.
64
+ */
65
+ alignBlock?: AlignBlock | undefined;
66
+ /**
67
+ * Used to align children along the cross axis.
68
+ */
69
+ alignInline?: AlignInline | undefined;
70
+ /**
71
+ * Used to distribute the children along the main axis.
72
+ */
73
+ spread?: "space-between" | undefined;
74
+ /**
75
+ * Used to set whether the container should grow to fill the available space.
76
+ */
77
+ grow?: Grow | undefined;
78
+ /**
79
+ * Represents the space between each child.
80
+ */
81
+ space?: "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;
82
+ /**
83
+ * Elements to be rendered inside the Stack.
84
+ */
85
+ children: ReactNode;
86
+ /**
87
+ * Forwarded ref element
88
+ */
89
+ ref?: any;
90
+ } & BasePrimitiveProps, "as" | "children" | keyof BasePrimitiveProps | "space" | "alignInline" | "alignBlock" | "spread" | "grow"> & import("react").RefAttributes<any>>>;
61
91
  export default Stack;
@@ -5,4 +5,5 @@ export { default as Inline, type InlineProps } from './components/inline';
5
5
  export { xcss } from './xcss/xcss';
6
6
  export { default as Stack, type StackProps } from './components/stack';
7
7
  export { default as Flex, type FlexProps } from './components/flex';
8
- export { UNSAFE_media, UNSAFE_BREAKPOINTS_CONFIG, type Breakpoint, } from './responsive';
8
+ export { default as Grid, type GridProps } from './components/grid';
9
+ export { media, UNSAFE_media, UNSAFE_BREAKPOINTS_CONFIG, type Breakpoint, } from './responsive';
@@ -2,7 +2,7 @@
2
2
  import { css as cssEmotion } from '@emotion/react';
3
3
  import type { CSSPropertiesWithMultiValues, SerializedStyles } from '@emotion/serialize';
4
4
  import type * as CSS from 'csstype';
5
- import { Box, Inline } from '../index';
5
+ import { Box } from '../index';
6
6
  import type { MediaQuery } from '../responsive/types';
7
7
  import { TokenisedProps } from './style-maps.partial';
8
8
  declare const uniqueSymbol: unique symbol;
@@ -23,10 +23,10 @@ type ScopedSafeCSSObject<T extends keyof SafeCSSObject> = Pick<SafeCSSObject, T>
23
23
  declare const boxWrapper: (style: any) => {
24
24
  readonly [uniqueSymbol]: BoxStyles;
25
25
  };
26
- declare const inlineWrapper: (style: any) => {
27
- readonly [uniqueSymbol]: InlineStyles;
26
+ declare const spaceWrapper: (style: any) => {
27
+ readonly [uniqueSymbol]: SpaceStyles;
28
28
  };
29
- type XCSS = ReturnType<typeof boxWrapper> | ReturnType<typeof inlineWrapper>;
29
+ type XCSS = ReturnType<typeof boxWrapper> | ReturnType<typeof spaceWrapper>;
30
30
  type XCSSArray = Array<XCSS | false | undefined>;
31
31
  type AllowedBoxStyles = keyof SafeCSSObject;
32
32
  type Spacing = 'columnGap' | 'gap' | 'inset' | 'insetBlock' | 'insetBlockEnd' | 'insetBlockStart' | 'insetInline' | 'insetInlineEnd' | 'insetInlineStart' | 'margin' | 'marginBlock' | 'marginBlockEnd' | 'marginBlockStart' | 'marginInline' | 'marginInlineEnd' | 'marginInlineStart' | 'outlineOffset' | 'padding' | 'paddingBlock' | 'paddingBlockEnd' | 'paddingBlockStart' | 'paddingBottom' | 'paddingInline' | 'paddingInlineEnd' | 'paddingInlineStart' | 'paddingLeft' | 'paddingRight' | 'paddingTop' | 'rowGap';
@@ -42,21 +42,18 @@ type Spacing = 'columnGap' | 'gap' | 'inset' | 'insetBlock' | 'insetBlockEnd' |
42
42
  * })
43
43
  * ```
44
44
  */
45
- export declare function xcss<Primitive extends typeof Box | typeof Inline = typeof Box>(style: Primitive extends typeof Box ? ScopedSafeCSSObject<AllowedBoxStyles> | ScopedSafeCSSObject<AllowedBoxStyles>[] : Primitive extends typeof Inline ? ScopedSafeCSSObject<Spacing> | ScopedSafeCSSObject<Spacing>[] : never): {
46
- readonly [uniqueSymbol]: Primitive extends (<T extends import("react").ElementType<any> = "div">(props: import("../index").BoxProps<T>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null) & import("react").FC<import("../index").BoxProps<"div">> ? BoxStyles : Primitive extends import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Pick<import("../index").InlineProps<import("react").ElementType<any>>, "as" | "children" | "testId" | "xcss" | "alignInline" | "alignBlock" | "shouldWrap" | "spread" | "grow" | "space" | "rowSpace" | "separator"> & import("react").RefAttributes<any>>> ? InlineStyles : never;
45
+ export declare function xcss<Primitive extends typeof Box | void = typeof Box>(style: Primitive extends typeof Box ? ScopedSafeCSSObject<AllowedBoxStyles> | ScopedSafeCSSObject<AllowedBoxStyles>[] : Primitive extends void ? ScopedSafeCSSObject<Spacing> | ScopedSafeCSSObject<Spacing>[] : never): {
46
+ readonly [uniqueSymbol]: Primitive extends (<T extends import("react").ElementType<any> = "div">(props: import("../index").BoxProps<T>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null) & import("react").FC<import("../index").BoxProps<"div">> ? BoxStyles : Primitive extends void ? SpaceStyles : never;
47
47
  };
48
48
  declare const boxTag: unique symbol;
49
+ declare const spaceTag: unique symbol;
49
50
  export type BoxStyles = SerializedStyles & {
50
51
  [boxTag]: true;
51
52
  };
53
+ export type SpaceStyles = SerializedStyles & {
54
+ [spaceTag]: true;
55
+ };
52
56
  export type BoxXCSS = {
53
57
  readonly [uniqueSymbol]: BoxStyles;
54
- } | false;
55
- declare const inlineTag: unique symbol;
56
- export type InlineStyles = SerializedStyles & {
57
- [inlineTag]: true;
58
- };
59
- export type InlineXCSS = {
60
- readonly [uniqueSymbol]: InlineStyles;
61
- };
58
+ } | false | undefined;
62
59
  export {};
@@ -6,7 +6,7 @@ export type FlexProps<T extends ElementType = 'div'> = {
6
6
  /**
7
7
  * The DOM element to render as the Flex. Defaults to `div`.
8
8
  */
9
- as?: 'div' | 'span' | 'ul' | 'ol';
9
+ as?: 'div' | 'span' | 'ul' | 'ol' | 'li';
10
10
  /**
11
11
  * Used to align children along the main axis.
12
12
  */
@@ -15,6 +15,10 @@ export type FlexProps<T extends ElementType = 'div'> = {
15
15
  * Used to align children along the cross axis.
16
16
  */
17
17
  alignItems?: AlignItems;
18
+ /**
19
+ * Represents the space between each child.
20
+ */
21
+ columnGap?: Space;
18
22
  /**
19
23
  * Represents the space between each child.
20
24
  */
@@ -32,7 +36,7 @@ export type FlexProps<T extends ElementType = 'div'> = {
32
36
  */
33
37
  wrap?: Wrap;
34
38
  /**
35
- * Elements to be rendered inside the Stack.
39
+ * Elements to be rendered inside the Flex.
36
40
  */
37
41
  children: ReactNode;
38
42
  /**
@@ -66,6 +70,7 @@ declare const alignItemsMap: {
66
70
  readonly center: import("@emotion/react").SerializedStyles;
67
71
  readonly baseline: import("@emotion/react").SerializedStyles;
68
72
  readonly end: import("@emotion/react").SerializedStyles;
73
+ readonly stretch: import("@emotion/react").SerializedStyles;
69
74
  };
70
75
  /**
71
76
  * __Flex__
@@ -91,15 +96,19 @@ declare const Flex: import("react").MemoExoticComponent<import("react").ForwardR
91
96
  /**
92
97
  * The DOM element to render as the Flex. Defaults to `div`.
93
98
  */
94
- as?: "div" | "ol" | "span" | "ul" | undefined;
99
+ as?: "div" | "li" | "ol" | "span" | "ul" | undefined;
95
100
  /**
96
101
  * Used to align children along the main axis.
97
102
  */
98
- justifyContent?: "start" | "center" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined;
103
+ justifyContent?: "space-around" | "space-between" | "space-evenly" | "stretch" | "center" | "end" | "start" | undefined;
99
104
  /**
100
105
  * Used to align children along the cross axis.
101
106
  */
102
- alignItems?: "start" | "center" | "end" | "baseline" | undefined;
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;
103
112
  /**
104
113
  * Represents the space between each child.
105
114
  */
@@ -115,14 +124,14 @@ declare const Flex: import("react").MemoExoticComponent<import("react").ForwardR
115
124
  /**
116
125
  * Represents the flex wrap property of CSS flexbox.
117
126
  */
118
- wrap?: "wrap" | "nowrap" | undefined;
127
+ wrap?: "nowrap" | "wrap" | undefined;
119
128
  /**
120
- * Elements to be rendered inside the Stack.
129
+ * Elements to be rendered inside the Flex.
121
130
  */
122
131
  children: ReactNode;
123
132
  /**
124
133
  * Forwarded ref element
125
134
  */
126
135
  ref?: any;
127
- } & BasePrimitiveProps, "gap" | "rowGap" | "alignItems" | "direction" | "justifyContent" | "as" | "children" | keyof BasePrimitiveProps | "wrap"> & import("react").RefAttributes<any>>>;
136
+ } & BasePrimitiveProps, "gap" | "rowGap" | "columnGap" | "alignItems" | "direction" | "justifyContent" | "as" | "children" | keyof BasePrimitiveProps | "wrap"> & import("react").RefAttributes<any>>>;
128
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;