@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.
- package/CHANGELOG.md +12 -0
- package/constellation/flex/code.mdx +7 -0
- package/constellation/flex/examples.mdx +34 -0
- package/constellation/grid/code.mdx +7 -0
- package/constellation/grid/examples.mdx +38 -0
- package/constellation/overview/index.mdx +20 -14
- package/dist/cjs/components/flex.js +119 -0
- package/dist/cjs/components/grid.js +127 -0
- package/dist/cjs/components/inline.js +16 -48
- package/dist/cjs/components/stack.js +19 -39
- package/dist/cjs/index.js +20 -0
- package/dist/cjs/responsive/media-helper.js +15 -0
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/xcss/xcss.js +1 -1
- package/dist/es2019/components/flex.js +111 -0
- package/dist/es2019/components/grid.js +118 -0
- package/dist/es2019/components/inline.js +15 -49
- package/dist/es2019/components/stack.js +18 -40
- package/dist/es2019/index.js +3 -1
- package/dist/es2019/responsive/build-media-query-css.js +0 -1
- package/dist/es2019/responsive/media-helper.js +15 -0
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/xcss/xcss.js +1 -1
- package/dist/esm/components/flex.js +111 -0
- package/dist/esm/components/grid.js +119 -0
- package/dist/esm/components/inline.js +16 -49
- package/dist/esm/components/stack.js +19 -40
- package/dist/esm/index.js +3 -1
- package/dist/esm/responsive/media-helper.js +15 -0
- package/dist/esm/version.json +1 -1
- package/dist/esm/xcss/xcss.js +1 -1
- package/dist/types/components/box.d.ts +1 -2
- package/dist/types/components/flex.d.ts +137 -0
- package/dist/types/components/grid.d.ts +154 -0
- package/dist/types/components/inline.d.ts +50 -12
- package/dist/types/components/stack.d.ts +38 -8
- package/dist/types/components/types.d.ts +2 -6
- package/dist/types/index.d.ts +4 -1
- package/dist/types/responsive/media-helper.d.ts +30 -0
- package/dist/types/xcss/xcss.d.ts +13 -16
- package/dist/types-ts4.5/components/box.d.ts +1 -2
- package/dist/types-ts4.5/components/flex.d.ts +137 -0
- package/dist/types-ts4.5/components/grid.d.ts +154 -0
- package/dist/types-ts4.5/components/inline.d.ts +50 -12
- package/dist/types-ts4.5/components/stack.d.ts +38 -8
- package/dist/types-ts4.5/components/types.d.ts +2 -6
- package/dist/types-ts4.5/index.d.ts +4 -1
- package/dist/types-ts4.5/responsive/media-helper.d.ts +30 -0
- package/dist/types-ts4.5/xcss/xcss.d.ts +13 -16
- package/extract-react-types/box-props.tsx +1 -9
- package/package.json +21 -5
- package/report.api.md +404 -75
- package/tmp/api-report-tmp.d.ts +200 -52
|
@@ -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 {
|
|
5
|
-
export
|
|
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<
|
|
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
|
-
|
|
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
|
|
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<
|
|
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;
|
|
@@ -9,12 +9,8 @@ export type BasePrimitiveProps = {
|
|
|
9
9
|
* Inline styles to be applied to the primitive.
|
|
10
10
|
*/
|
|
11
11
|
style?: CSSProperties;
|
|
12
|
-
};
|
|
13
|
-
type BoxXCSSArray = Array<BoxXCSSArray | BoxXCSS | false | undefined>;
|
|
14
|
-
export type PublicBoxPropsBase = {
|
|
15
12
|
/**
|
|
16
|
-
*
|
|
13
|
+
* Apply a subset of permitted styles, powered by Atlassian Design System tokens.
|
|
17
14
|
*/
|
|
18
|
-
xcss?: BoxXCSS |
|
|
15
|
+
xcss?: BoxXCSS | BoxXCSS[];
|
|
19
16
|
};
|
|
20
|
-
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
export type { Dimension, BackgroundColor, Space, BorderColor, BorderRadius, BorderWidth, Layer, Shadow, } from './xcss/style-maps.partial';
|
|
1
2
|
export { default as Box, type BoxProps } from './components/box';
|
|
2
3
|
export { default as Pressable, type PressableProps, } from './components/pressable';
|
|
3
4
|
export { default as Inline, type InlineProps } from './components/inline';
|
|
4
5
|
export { xcss } from './xcss/xcss';
|
|
5
6
|
export { default as Stack, type StackProps } from './components/stack';
|
|
6
|
-
export {
|
|
7
|
+
export { default as Flex, type FlexProps } from './components/flex';
|
|
8
|
+
export { default as Grid, type GridProps } from './components/grid';
|
|
9
|
+
export { media, UNSAFE_media, UNSAFE_BREAKPOINTS_CONFIG, type Breakpoint, } from './responsive';
|
|
@@ -13,10 +13,25 @@ export declare const UNSAFE_media: {
|
|
|
13
13
|
* `above.xxs` is redundant and no media query should be used, but it's included for programatic purposes…
|
|
14
14
|
*/
|
|
15
15
|
readonly xxs: "@media all";
|
|
16
|
+
/**
|
|
17
|
+
* Used for mobile viewports.
|
|
18
|
+
*/
|
|
16
19
|
readonly xs: "@media (min-width: 30rem)";
|
|
20
|
+
/**
|
|
21
|
+
* Used for tablet viewports.
|
|
22
|
+
*/
|
|
17
23
|
readonly sm: "@media (min-width: 48rem)";
|
|
24
|
+
/**
|
|
25
|
+
* Used for laptop viewports.
|
|
26
|
+
*/
|
|
18
27
|
readonly md: "@media (min-width: 64rem)";
|
|
28
|
+
/**
|
|
29
|
+
* Used for desktop viewports.
|
|
30
|
+
*/
|
|
19
31
|
readonly lg: "@media (min-width: 90rem)";
|
|
32
|
+
/**
|
|
33
|
+
* Used for wide screen desktop viewports.
|
|
34
|
+
*/
|
|
20
35
|
readonly xl: "@media (min-width: 110rem)";
|
|
21
36
|
};
|
|
22
37
|
/**
|
|
@@ -66,10 +81,25 @@ export declare const media: {
|
|
|
66
81
|
* `above.xxs` is redundant and no media query should be used, but it's included for programatic purposes…
|
|
67
82
|
*/
|
|
68
83
|
readonly xxs: "@media all";
|
|
84
|
+
/**
|
|
85
|
+
* Used for mobile viewports.
|
|
86
|
+
*/
|
|
69
87
|
readonly xs: "@media (min-width: 30rem)";
|
|
88
|
+
/**
|
|
89
|
+
* Used for tablet viewports.
|
|
90
|
+
*/
|
|
70
91
|
readonly sm: "@media (min-width: 48rem)";
|
|
92
|
+
/**
|
|
93
|
+
* Used for laptop viewports.
|
|
94
|
+
*/
|
|
71
95
|
readonly md: "@media (min-width: 64rem)";
|
|
96
|
+
/**
|
|
97
|
+
* Used for desktop viewports.
|
|
98
|
+
*/
|
|
72
99
|
readonly lg: "@media (min-width: 90rem)";
|
|
100
|
+
/**
|
|
101
|
+
* Used for wide screen desktop viewports.
|
|
102
|
+
*/
|
|
73
103
|
readonly xl: "@media (min-width: 110rem)";
|
|
74
104
|
};
|
|
75
105
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { css as cssEmotion } from '@emotion/react';
|
|
3
|
-
import { CSSPropertiesWithMultiValues, SerializedStyles } from '@emotion/serialize';
|
|
3
|
+
import type { CSSPropertiesWithMultiValues, SerializedStyles } from '@emotion/serialize';
|
|
4
4
|
import type * as CSS from 'csstype';
|
|
5
|
-
import { Box
|
|
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,11 +23,11 @@ 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
|
|
27
|
-
readonly [uniqueSymbol]:
|
|
26
|
+
declare const spaceWrapper: (style: any) => {
|
|
27
|
+
readonly [uniqueSymbol]: SpaceStyles;
|
|
28
28
|
};
|
|
29
|
-
type XCSS = ReturnType<typeof boxWrapper> | ReturnType<typeof
|
|
30
|
-
type XCSSArray = Array<XCSS |
|
|
29
|
+
type XCSS = ReturnType<typeof boxWrapper> | ReturnType<typeof spaceWrapper>;
|
|
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';
|
|
33
33
|
/**
|
|
@@ -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 |
|
|
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
|
|
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
|
-
};
|
|
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 {};
|
|
@@ -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
|
-
|
|
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;
|