@atlaskit/primitives 0.2.1 → 0.3.0
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/dist/cjs/components/inline.partial.js +46 -22
- package/dist/cjs/components/internal/base-box.partial.js +99 -78
- package/dist/cjs/components/internal/types.js +8 -0
- package/dist/cjs/components/internal/utils.js +16 -0
- package/dist/cjs/components/stack.partial.js +46 -22
- package/dist/cjs/constants.js +13 -0
- package/dist/cjs/helpers/responsive/build-media-query-css.js +88 -0
- package/dist/cjs/helpers/responsive/constants.js +85 -0
- package/dist/cjs/helpers/responsive/index.js +38 -0
- package/dist/cjs/helpers/responsive/media-helper.js +84 -0
- package/dist/cjs/helpers/responsive/types.js +5 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/inline.partial.js +18 -18
- package/dist/es2019/components/internal/base-box.partial.js +75 -70
- package/dist/es2019/components/internal/types.js +1 -0
- package/dist/es2019/components/internal/utils.js +2 -0
- package/dist/es2019/components/stack.partial.js +18 -18
- package/dist/es2019/constants.js +3 -1
- package/dist/es2019/helpers/responsive/build-media-query-css.js +85 -0
- package/dist/es2019/helpers/responsive/constants.js +74 -0
- package/dist/es2019/helpers/responsive/index.js +3 -0
- package/dist/es2019/helpers/responsive/media-helper.js +78 -0
- package/dist/es2019/helpers/responsive/types.js +1 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/inline.partial.js +46 -21
- package/dist/esm/components/internal/base-box.partial.js +100 -79
- package/dist/esm/components/internal/types.js +1 -0
- package/dist/esm/components/internal/utils.js +7 -0
- package/dist/esm/components/stack.partial.js +46 -21
- package/dist/esm/constants.js +3 -1
- package/dist/esm/helpers/responsive/build-media-query-css.js +79 -0
- package/dist/esm/helpers/responsive/constants.js +76 -0
- package/dist/esm/helpers/responsive/index.js +3 -0
- package/dist/esm/helpers/responsive/media-helper.js +78 -0
- package/dist/esm/helpers/responsive/types.js +1 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/components/box.d.ts +3 -5
- package/dist/types/components/inline.partial.d.ts +16 -18
- package/dist/types/components/internal/base-box.partial.d.ts +49 -50
- package/dist/types/components/internal/types.d.ts +6 -0
- package/dist/types/components/internal/utils.d.ts +3 -0
- package/dist/types/components/stack.partial.d.ts +16 -18
- package/dist/types/components/types.d.ts +49 -0
- package/dist/types/constants.d.ts +2 -0
- package/dist/types/helpers/responsive/build-media-query-css.d.ts +57 -0
- package/dist/types/helpers/responsive/constants.d.ts +23 -0
- package/dist/types/helpers/responsive/index.d.ts +4 -0
- package/dist/types/helpers/responsive/media-helper.d.ts +45 -0
- package/dist/types/helpers/responsive/types.d.ts +47 -0
- package/package.json +6 -3
- package/report.api.md +111 -78
- package/responsive/package.json +15 -0
- package/scripts/spacing-codegen-template.tsx +29 -24
- package/scripts/utils.tsx +4 -1
- package/tmp/api-report-tmp.d.ts +88 -77
|
@@ -36,31 +36,29 @@ export declare type Spread = 'space-between';
|
|
|
36
36
|
export declare type Grow = 'hug' | 'fill';
|
|
37
37
|
/**
|
|
38
38
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
39
|
-
* @codegen <<SignedSource::
|
|
39
|
+
* @codegen <<SignedSource::41d7002b7f69aa44d0d8598e07a1afc6>>
|
|
40
40
|
* @codegenId spacing
|
|
41
41
|
* @codegenCommand yarn codegen-styles
|
|
42
42
|
* @codegenParams ["space"]
|
|
43
43
|
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::167d3b69b159ae33e74d4ea5ab7eade6>>
|
|
44
44
|
*/
|
|
45
45
|
declare const spaceMap: {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
readonly '1000': import("@emotion/react").SerializedStyles;
|
|
61
|
-
};
|
|
46
|
+
readonly '0': import("@emotion/react").SerializedStyles;
|
|
47
|
+
readonly '025': import("@emotion/react").SerializedStyles;
|
|
48
|
+
readonly '050': import("@emotion/react").SerializedStyles;
|
|
49
|
+
readonly '075': import("@emotion/react").SerializedStyles;
|
|
50
|
+
readonly '100': import("@emotion/react").SerializedStyles;
|
|
51
|
+
readonly '150': import("@emotion/react").SerializedStyles;
|
|
52
|
+
readonly '200': import("@emotion/react").SerializedStyles;
|
|
53
|
+
readonly '250': import("@emotion/react").SerializedStyles;
|
|
54
|
+
readonly '300': import("@emotion/react").SerializedStyles;
|
|
55
|
+
readonly '400': import("@emotion/react").SerializedStyles;
|
|
56
|
+
readonly '500': import("@emotion/react").SerializedStyles;
|
|
57
|
+
readonly '600': import("@emotion/react").SerializedStyles;
|
|
58
|
+
readonly '800': import("@emotion/react").SerializedStyles;
|
|
59
|
+
readonly '1000': import("@emotion/react").SerializedStyles;
|
|
62
60
|
};
|
|
63
|
-
export declare type Space = keyof typeof spaceMap
|
|
61
|
+
export declare type Space = keyof typeof spaceMap;
|
|
64
62
|
/**
|
|
65
63
|
* __Stack__
|
|
66
64
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties } from 'react';
|
|
2
|
+
import { BorderWidth, Display, Padding, PaddingBlock, PaddingBlockEnd, PaddingBlockStart, PaddingInline, PaddingInlineEnd, PaddingInlineStart } from './internal/base-box.partial';
|
|
2
3
|
/**
|
|
3
4
|
* Restricted set of inline styles to be applied to the primitive.
|
|
4
5
|
* Should be avoided where possible, in favor of the pre-defined props and values on the primitive itself.
|
|
@@ -18,3 +19,51 @@ export interface BasePrimitiveProps {
|
|
|
18
19
|
*/
|
|
19
20
|
UNSAFE_style?: CSSProperties;
|
|
20
21
|
}
|
|
22
|
+
export declare type PublicBoxPropsBase = {
|
|
23
|
+
/**
|
|
24
|
+
* Defines border width.
|
|
25
|
+
*/
|
|
26
|
+
borderWidth?: BorderWidth;
|
|
27
|
+
/**
|
|
28
|
+
* Defines display type and layout. Defaults to `block`.
|
|
29
|
+
*/
|
|
30
|
+
display?: Display;
|
|
31
|
+
/**
|
|
32
|
+
* Tokens representing CSS shorthand for `paddingBlock` and `paddingInline` together.
|
|
33
|
+
*
|
|
34
|
+
* @see paddingBlock
|
|
35
|
+
* @see paddingInline
|
|
36
|
+
*/
|
|
37
|
+
padding?: Padding;
|
|
38
|
+
/**
|
|
39
|
+
* Tokens representing CSS shorthand `paddingBlock`.
|
|
40
|
+
*
|
|
41
|
+
* @see paddingBlockStart
|
|
42
|
+
* @see paddingBlockEnd
|
|
43
|
+
*/
|
|
44
|
+
paddingBlock?: PaddingBlock;
|
|
45
|
+
/**
|
|
46
|
+
* Tokens representing CSS `paddingBlockStart`.
|
|
47
|
+
*/
|
|
48
|
+
paddingBlockStart?: PaddingBlockStart;
|
|
49
|
+
/**
|
|
50
|
+
* Tokens representing CSS `paddingBlockEnd`.
|
|
51
|
+
*/
|
|
52
|
+
paddingBlockEnd?: PaddingBlockEnd;
|
|
53
|
+
/**
|
|
54
|
+
* Tokens representing CSS shorthand `paddingInline`.
|
|
55
|
+
*
|
|
56
|
+
* @see paddingInlineStart
|
|
57
|
+
* @see paddingInlineEnd
|
|
58
|
+
*/
|
|
59
|
+
paddingInline?: PaddingInline;
|
|
60
|
+
/**
|
|
61
|
+
* Tokens representing CSS `paddingInlineStart`.
|
|
62
|
+
*/
|
|
63
|
+
paddingInlineStart?: PaddingInlineStart;
|
|
64
|
+
/**
|
|
65
|
+
* Tokens representing CSS `paddingInlineEnd`.
|
|
66
|
+
*/
|
|
67
|
+
paddingInlineEnd?: PaddingInlineEnd;
|
|
68
|
+
customStyles?: CustomStyles;
|
|
69
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UNSAFE_Breakpoint as Breakpoint, UNSAFE_BreakpointConfig as BreakpointConfig, UNSAFE_BREAKPOINTS_CONFIG as BREAKPOINTS_CONFIG, UNSAFE_BREAKPOINTS_LIST as BREAKPOINTS_LIST } from '@atlaskit/ds-explorations';
|
|
1
2
|
export declare const LAYERS: {
|
|
2
3
|
readonly card: 100;
|
|
3
4
|
readonly navigation: 200;
|
|
@@ -10,3 +11,4 @@ export declare const LAYERS: {
|
|
|
10
11
|
readonly tooltip: 800;
|
|
11
12
|
};
|
|
12
13
|
export declare type Layer = keyof typeof LAYERS;
|
|
14
|
+
export { BREAKPOINTS_CONFIG, BREAKPOINTS_LIST, type Breakpoint, type BreakpointConfig, };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { CSSObject } from '@emotion/react';
|
|
2
|
+
import { SMALLEST_BREAKPOINT } from './constants';
|
|
3
|
+
import type { Breakpoint } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Build a map of breakpoints to css with media queries and nested styles.
|
|
6
|
+
*
|
|
7
|
+
* @experimental Unsafe for usage as the API is not finalized.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* A map to build optional `display:none` for consumption on a div.
|
|
11
|
+
* ```ts
|
|
12
|
+
* const hideMediaQueries = buildAboveMediaQueryCSS({ display: 'none' });
|
|
13
|
+
*
|
|
14
|
+
* const Component = ({ hideAtBreakpoints: ('xs' | 'sm')[], children: ReactNode }) => {
|
|
15
|
+
* return <div css={hideAtBreakpoints.map(b => hideMediaQueries[b])}>{children}</div>;
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* This roughly builds a map that will look roughly like this (if done manually):
|
|
20
|
+
* ```ts
|
|
21
|
+
* {
|
|
22
|
+
* xxs: css({ '@media (min-width: 0px)': { display: 'none' } }),
|
|
23
|
+
* xs: css({ '@media (min-width: …px)': { display: 'none' } }),
|
|
24
|
+
* sm: css({ '@media (min-width: …px)': { display: 'none' } }),
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare const UNSAFE_buildAboveMediaQueryCSS: (input: CSSObject | ((breakpoint: Breakpoint) => CSSObject)) => Required<Partial<Record<Breakpoint, import("@emotion/react").SerializedStyles>>>;
|
|
29
|
+
/**
|
|
30
|
+
* Build a map of breakpoints to css with media queries and nested styles.
|
|
31
|
+
*
|
|
32
|
+
* WARNING: The smallest breakpoint is not a valid key as a media query below 0px is misleading.
|
|
33
|
+
* This is separated from `buildAboveMediaQueryCSS` for that specific reason, you cannot have type safety with this variance.
|
|
34
|
+
*
|
|
35
|
+
* @experimental Unsafe for usage as the API is not finalized.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* A map to build optional `display:none` for consumption on a div.
|
|
39
|
+
* ```ts
|
|
40
|
+
* const hideMediaQueries = buildBelowMediaQueryCSS({ display: 'none' });
|
|
41
|
+
*
|
|
42
|
+
* const Component = ({ hideAtBreakpoints: ('xs' | 'sm')[], children: ReactNode }) => {
|
|
43
|
+
* return <div css={hideAtBreakpoints.map(b => hideMediaQueries[b])}>{children}</div>;
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* This roughly builds a map that will look roughly like this (if done manually):
|
|
48
|
+
* ```ts
|
|
49
|
+
* {
|
|
50
|
+
* xs: css({ '@media (max-width: …px)': { display: 'none' } }),
|
|
51
|
+
* sm: css({ '@media (max-width: …px)': { display: 'none' } }),
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @experimental Unsafe for usage as the API is not finalized.
|
|
56
|
+
*/
|
|
57
|
+
export declare const UNSAFE_buildBelowMediaQueryCSS: (input: CSSObject | ((breakpoint: Exclude<Breakpoint, typeof SMALLEST_BREAKPOINT>) => CSSObject)) => Required<Omit<Partial<Record<Breakpoint, import("@emotion/react").SerializedStyles>>, "xxs">>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Breakpoint, BreakpointConfig } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Our internal configuration for breakpoints configuration.
|
|
4
|
+
*
|
|
5
|
+
* @experimental Unsafe for consumption outside of the design system itself.
|
|
6
|
+
*/
|
|
7
|
+
export declare const UNSAFE_BREAKPOINTS_CONFIG: Record<Breakpoint, BreakpointConfig>;
|
|
8
|
+
/**
|
|
9
|
+
* The list of breakpoints in order from smallest to largest. You may need to clone and reverse this list if you want the opposite.
|
|
10
|
+
*
|
|
11
|
+
* This is intentional for cascading with `min-width` or `media.above`. Media queries go from lowest width to highest.
|
|
12
|
+
*
|
|
13
|
+
* @experimental Unsafe for consumption outside of the design system itself.
|
|
14
|
+
*/
|
|
15
|
+
export declare const UNSAFE_BREAKPOINTS_ORDERED_LIST: ["xxs", "xs", "sm", "md", "lg", "xl", "xxl"];
|
|
16
|
+
/**
|
|
17
|
+
* This is our smallest breakpoint with a few nuances to it:
|
|
18
|
+
* 1. It is the default value for shorthands, eg. `<GridItem span={6} />` maps to `{ [SMALLEST_BREAKPOINT]: props.span }`
|
|
19
|
+
* 2. It's omitted in `media.below` as there's nothing below `0px`.
|
|
20
|
+
*
|
|
21
|
+
* @experimental There's a chance this will change in _value_, but should only be used in a way that it will not matter if this value changes.
|
|
22
|
+
*/
|
|
23
|
+
export declare const SMALLEST_BREAKPOINT: "xxs";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { UNSAFE_media } from './media-helper';
|
|
2
|
+
export { UNSAFE_buildAboveMediaQueryCSS, UNSAFE_buildBelowMediaQueryCSS, } from './build-media-query-css';
|
|
3
|
+
export { UNSAFE_BREAKPOINTS_ORDERED_LIST, UNSAFE_BREAKPOINTS_CONFIG, } from './constants';
|
|
4
|
+
export type { Breakpoint, ResponsiveObject, ResponsiveCSSObject, } from './types';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an object of usable media query helpers using our internal breakpoints configuration.
|
|
3
|
+
*
|
|
4
|
+
* @experimental Unsafe for usage as the API is not finalized.
|
|
5
|
+
*/
|
|
6
|
+
export declare const UNSAFE_media: {
|
|
7
|
+
readonly above: {
|
|
8
|
+
/**
|
|
9
|
+
* `above.xxs` is redundant and no media query should be used, but it's included for programatic purposes…
|
|
10
|
+
*
|
|
11
|
+
* Eg. this is `@media (min-width: 0px)`
|
|
12
|
+
*/
|
|
13
|
+
readonly xxs: `@media (min-width: ${number}px)`;
|
|
14
|
+
readonly xs: `@media (min-width: ${number}px)`;
|
|
15
|
+
readonly sm: `@media (min-width: ${number}px)`;
|
|
16
|
+
readonly md: `@media (min-width: ${number}px)`;
|
|
17
|
+
readonly lg: `@media (min-width: ${number}px)`;
|
|
18
|
+
readonly xl: `@media (min-width: ${number}px)`;
|
|
19
|
+
readonly xxl: `@media (min-width: ${number}px)`;
|
|
20
|
+
};
|
|
21
|
+
readonly below: {
|
|
22
|
+
/**
|
|
23
|
+
* A media query to target viewports below the min width of a given breakpoint.
|
|
24
|
+
* Note that `media.below.xxs` is intentionally omitted as this would be `@media (max-width: 0px)`
|
|
25
|
+
*/
|
|
26
|
+
readonly xs: `@media (max-width: ${number}px)`;
|
|
27
|
+
readonly sm: `@media (max-width: ${number}px)`;
|
|
28
|
+
readonly md: `@media (max-width: ${number}px)`;
|
|
29
|
+
readonly lg: `@media (max-width: ${number}px)`;
|
|
30
|
+
readonly xl: `@media (max-width: ${number}px)`;
|
|
31
|
+
readonly xxl: `@media (max-width: ${number}px)`;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* With these types:
|
|
36
|
+
* ```
|
|
37
|
+
* type MediaQuery = `@media (${string})`;
|
|
38
|
+
* type ResponsiveMediaObject = Record<Breakpoint, MediaQuery>;
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* TODO: This `media` object as of typescript@4.9, would benefit from satisfies, eg.:
|
|
42
|
+
* ```
|
|
43
|
+
* const UNSAFE_media = { … } satisfies Record<'above' | 'only', ResponsiveMediaObject> & { below: Omit<ResponsiveMediaObject, 'xxs'> }
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
|
+
import { token } from '@atlaskit/tokens';
|
|
3
|
+
/**
|
|
4
|
+
* The breakpoints we have for responsiveness.
|
|
5
|
+
*/
|
|
6
|
+
export declare type Breakpoint = 'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
7
|
+
/**
|
|
8
|
+
* An object type mapping a value to each breakpoint (optionally)
|
|
9
|
+
*/
|
|
10
|
+
export declare type ResponsiveObject<T> = Partial<Record<Breakpoint, T>>;
|
|
11
|
+
/**
|
|
12
|
+
* A map of breakpoints to CSS, commonly used to build maps given a responsive object
|
|
13
|
+
* so we can statically compile CSS upfront, but dynamically apply it.
|
|
14
|
+
*
|
|
15
|
+
* @example Here we could conditionally load margins based a `setMarginBreakpoints={['xs', 'md']}` type prop.
|
|
16
|
+
* ```tsx
|
|
17
|
+
* const marginMediaQueries = {
|
|
18
|
+
* xxs: css({ [media.above.xxs]: margin: 0 } }),
|
|
19
|
+
* xs: css({ [media.above.xs]: margin: 4 } }),
|
|
20
|
+
* //…
|
|
21
|
+
* }
|
|
22
|
+
*
|
|
23
|
+
* return <div css={setMarginBreakpoints.map(breakpoint => marginMediaQueries[breakpoint])} />
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare type ResponsiveCSSObject = ResponsiveObject<ReturnType<typeof css>>;
|
|
27
|
+
/**
|
|
28
|
+
* Our internal breakpoint config used to build media queries and define attributes for certain components.
|
|
29
|
+
*/
|
|
30
|
+
export declare type BreakpointConfig = {
|
|
31
|
+
/**
|
|
32
|
+
* The gap between a `GridItem`.
|
|
33
|
+
*/
|
|
34
|
+
gridItemGutter: ReturnType<typeof token>;
|
|
35
|
+
/**
|
|
36
|
+
* The outer whitespace of a `Grid` item.
|
|
37
|
+
*/
|
|
38
|
+
gridMargin: ReturnType<typeof token>;
|
|
39
|
+
/**
|
|
40
|
+
* The min-width used in media queries
|
|
41
|
+
*/
|
|
42
|
+
min: number;
|
|
43
|
+
/**
|
|
44
|
+
* The max-width used in media queries
|
|
45
|
+
*/
|
|
46
|
+
max: number;
|
|
47
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/primitives",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Primitives are token-backed low-level building blocks.",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,12 +34,15 @@
|
|
|
34
34
|
".": "./src/index.tsx",
|
|
35
35
|
"./box": "./src/components/box.tsx",
|
|
36
36
|
"./stack": "./src/components/stack.partial.tsx",
|
|
37
|
-
"./inline": "./src/components/inline.partial.tsx"
|
|
37
|
+
"./inline": "./src/components/inline.partial.tsx",
|
|
38
|
+
"./responsive": "./src/helpers/responsive/index.tsx"
|
|
38
39
|
},
|
|
39
40
|
"dependencies": {
|
|
41
|
+
"@atlaskit/ds-explorations": "*",
|
|
40
42
|
"@atlaskit/tokens": "^1.2.0",
|
|
41
43
|
"@babel/runtime": "^7.0.0",
|
|
42
|
-
"@emotion/react": "^11.7.1"
|
|
44
|
+
"@emotion/react": "^11.7.1",
|
|
45
|
+
"tiny-invariant": "^1.2.0"
|
|
43
46
|
},
|
|
44
47
|
"peerDependencies": {
|
|
45
48
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
package/report.api.md
CHANGED
|
@@ -26,6 +26,7 @@ import { ReactElement } from 'react';
|
|
|
26
26
|
import { ReactNode } from 'react';
|
|
27
27
|
import { RefAttributes } from 'react';
|
|
28
28
|
import { SerializedStyles } from '@emotion/react';
|
|
29
|
+
import { UNSAFE_Breakpoint } from '@atlaskit/ds-explorations';
|
|
29
30
|
|
|
30
31
|
// @public (undocumented)
|
|
31
32
|
type AlignBlock = 'baseline' | 'center' | 'end' | 'start';
|
|
@@ -137,7 +138,7 @@ type BaseBoxPropsFoundation<T extends ElementType> = {
|
|
|
137
138
|
backgroundColor?: BackgroundColor;
|
|
138
139
|
shadow?: Shadow;
|
|
139
140
|
borderStyle?: BorderStyle;
|
|
140
|
-
borderWidth?: BorderWidth
|
|
141
|
+
borderWidth?: BorderWidth | Partial<Record<UNSAFE_Breakpoint, BorderWidth>>;
|
|
141
142
|
borderColor?: BorderColor;
|
|
142
143
|
borderRadius?: BorderRadius;
|
|
143
144
|
layer?: Layer;
|
|
@@ -148,16 +149,28 @@ type BaseBoxPropsFoundation<T extends ElementType> = {
|
|
|
148
149
|
overflow?: Overflow;
|
|
149
150
|
overflowInline?: OverflowInline;
|
|
150
151
|
overflowBlock?: OverflowBlock;
|
|
151
|
-
padding?: Padding
|
|
152
|
-
paddingBlock?:
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
152
|
+
padding?: Padding | Partial<Record<UNSAFE_Breakpoint, Padding>>;
|
|
153
|
+
paddingBlock?:
|
|
154
|
+
| PaddingBlock
|
|
155
|
+
| Partial<Record<UNSAFE_Breakpoint, PaddingBlock>>;
|
|
156
|
+
paddingBlockStart?:
|
|
157
|
+
| PaddingBlockStart
|
|
158
|
+
| Partial<Record<UNSAFE_Breakpoint, PaddingBlockStart>>;
|
|
159
|
+
paddingBlockEnd?:
|
|
160
|
+
| PaddingBlockEnd
|
|
161
|
+
| Partial<Record<UNSAFE_Breakpoint, PaddingBlockEnd>>;
|
|
162
|
+
paddingInline?:
|
|
163
|
+
| PaddingInline
|
|
164
|
+
| Partial<Record<UNSAFE_Breakpoint, PaddingInline>>;
|
|
165
|
+
paddingInlineStart?:
|
|
166
|
+
| PaddingInlineStart
|
|
167
|
+
| Partial<Record<UNSAFE_Breakpoint, PaddingInlineStart>>;
|
|
168
|
+
paddingInlineEnd?:
|
|
169
|
+
| PaddingInlineEnd
|
|
170
|
+
| Partial<Record<UNSAFE_Breakpoint, PaddingInlineEnd>>;
|
|
158
171
|
width?: Width;
|
|
159
172
|
height?: Height;
|
|
160
|
-
display?: Display
|
|
173
|
+
display?: Display | Partial<Record<UNSAFE_Breakpoint, Display>>;
|
|
161
174
|
position?: Position;
|
|
162
175
|
ref?: ComponentPropsWithRef<T>['ref'];
|
|
163
176
|
};
|
|
@@ -223,13 +236,27 @@ type BorderWidth = keyof typeof borderWidthMap;
|
|
|
223
236
|
|
|
224
237
|
// @public (undocumented)
|
|
225
238
|
const borderWidthMap: {
|
|
226
|
-
readonly 'size.
|
|
227
|
-
readonly 'size.
|
|
239
|
+
readonly 'size.0': 'var(--ds-width-0)';
|
|
240
|
+
readonly 'size.050': 'var(--ds-width-050)';
|
|
241
|
+
readonly 'size.100': 'var(--ds-width-100)';
|
|
228
242
|
};
|
|
229
243
|
|
|
230
244
|
// @public
|
|
231
245
|
export const Box: BoxComponent;
|
|
232
246
|
|
|
247
|
+
// @public (undocumented)
|
|
248
|
+
const BOX_RESPONSIVE_PROPS: readonly [
|
|
249
|
+
'borderWidth',
|
|
250
|
+
'display',
|
|
251
|
+
'padding',
|
|
252
|
+
'paddingBlock',
|
|
253
|
+
'paddingBlockStart',
|
|
254
|
+
'paddingBlockEnd',
|
|
255
|
+
'paddingInline',
|
|
256
|
+
'paddingInlineStart',
|
|
257
|
+
'paddingInlineEnd',
|
|
258
|
+
];
|
|
259
|
+
|
|
233
260
|
// @public (undocumented)
|
|
234
261
|
type BoxComponent<T extends ElementType = 'div'> = (<
|
|
235
262
|
T extends ElementType = 'div',
|
|
@@ -241,14 +268,12 @@ type BoxComponent<T extends ElementType = 'div'> = (<
|
|
|
241
268
|
// @public (undocumented)
|
|
242
269
|
export type BoxProps<T extends ElementType = 'div'> = Omit<
|
|
243
270
|
BaseBoxProps<T>,
|
|
244
|
-
'UNSAFE_style' | 'className'
|
|
271
|
+
'UNSAFE_style' | 'className' | BoxResponsiveProp
|
|
245
272
|
> &
|
|
246
|
-
|
|
273
|
+
PublicBoxPropsBase;
|
|
247
274
|
|
|
248
275
|
// @public (undocumented)
|
|
249
|
-
type
|
|
250
|
-
customStyles?: CustomStyles;
|
|
251
|
-
};
|
|
276
|
+
type BoxResponsiveProp = typeof BOX_RESPONSIVE_PROPS[number];
|
|
252
277
|
|
|
253
278
|
// @public
|
|
254
279
|
type CustomStyles = Pick<
|
|
@@ -283,11 +308,11 @@ type Display = keyof typeof displayMap;
|
|
|
283
308
|
|
|
284
309
|
// @public (undocumented)
|
|
285
310
|
const displayMap: {
|
|
286
|
-
readonly block:
|
|
287
|
-
readonly inline:
|
|
288
|
-
readonly flex:
|
|
289
|
-
readonly 'inline-flex':
|
|
290
|
-
readonly 'inline-block':
|
|
311
|
+
readonly block: 'block';
|
|
312
|
+
readonly inline: 'inline';
|
|
313
|
+
readonly flex: 'flex';
|
|
314
|
+
readonly 'inline-flex': 'inline-flex';
|
|
315
|
+
readonly 'inline-block': 'inline-block';
|
|
291
316
|
};
|
|
292
317
|
|
|
293
318
|
// @public (undocumented)
|
|
@@ -399,44 +424,42 @@ const overflowMap: {
|
|
|
399
424
|
};
|
|
400
425
|
|
|
401
426
|
// @public (undocumented)
|
|
402
|
-
type Padding = keyof typeof paddingMap
|
|
427
|
+
type Padding = keyof typeof paddingMap;
|
|
403
428
|
|
|
404
429
|
// @public (undocumented)
|
|
405
|
-
type PaddingBlock = keyof typeof paddingMap
|
|
430
|
+
type PaddingBlock = keyof typeof paddingMap;
|
|
406
431
|
|
|
407
432
|
// @public (undocumented)
|
|
408
|
-
type PaddingBlockEnd = keyof typeof paddingMap
|
|
433
|
+
type PaddingBlockEnd = keyof typeof paddingMap;
|
|
409
434
|
|
|
410
435
|
// @public (undocumented)
|
|
411
|
-
type PaddingBlockStart = keyof typeof paddingMap
|
|
436
|
+
type PaddingBlockStart = keyof typeof paddingMap;
|
|
412
437
|
|
|
413
438
|
// @public (undocumented)
|
|
414
|
-
type PaddingInline = keyof typeof paddingMap
|
|
439
|
+
type PaddingInline = keyof typeof paddingMap;
|
|
415
440
|
|
|
416
441
|
// @public (undocumented)
|
|
417
|
-
type PaddingInlineEnd = keyof typeof paddingMap
|
|
442
|
+
type PaddingInlineEnd = keyof typeof paddingMap;
|
|
418
443
|
|
|
419
444
|
// @public (undocumented)
|
|
420
|
-
type PaddingInlineStart = keyof typeof paddingMap
|
|
445
|
+
type PaddingInlineStart = keyof typeof paddingMap;
|
|
421
446
|
|
|
422
447
|
// @public
|
|
423
448
|
const paddingMap: {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
readonly 'space.1000': SerializedStyles;
|
|
439
|
-
};
|
|
449
|
+
readonly 'space.0': 'var(--ds-space-0)';
|
|
450
|
+
readonly 'space.025': 'var(--ds-space-025)';
|
|
451
|
+
readonly 'space.050': 'var(--ds-space-050)';
|
|
452
|
+
readonly 'space.075': 'var(--ds-space-075)';
|
|
453
|
+
readonly 'space.100': 'var(--ds-space-100)';
|
|
454
|
+
readonly 'space.150': 'var(--ds-space-150)';
|
|
455
|
+
readonly 'space.200': 'var(--ds-space-200)';
|
|
456
|
+
readonly 'space.250': 'var(--ds-space-250)';
|
|
457
|
+
readonly 'space.300': 'var(--ds-space-300)';
|
|
458
|
+
readonly 'space.400': 'var(--ds-space-400)';
|
|
459
|
+
readonly 'space.500': 'var(--ds-space-500)';
|
|
460
|
+
readonly 'space.600': 'var(--ds-space-600)';
|
|
461
|
+
readonly 'space.800': 'var(--ds-space-800)';
|
|
462
|
+
readonly 'space.1000': 'var(--ds-space-1000)';
|
|
440
463
|
};
|
|
441
464
|
|
|
442
465
|
// @public (undocumented)
|
|
@@ -450,6 +473,20 @@ const positionMap: {
|
|
|
450
473
|
readonly static: SerializedStyles;
|
|
451
474
|
};
|
|
452
475
|
|
|
476
|
+
// @public (undocumented)
|
|
477
|
+
type PublicBoxPropsBase = {
|
|
478
|
+
borderWidth?: BorderWidth;
|
|
479
|
+
display?: Display;
|
|
480
|
+
padding?: Padding;
|
|
481
|
+
paddingBlock?: PaddingBlock;
|
|
482
|
+
paddingBlockStart?: PaddingBlockStart;
|
|
483
|
+
paddingBlockEnd?: PaddingBlockEnd;
|
|
484
|
+
paddingInline?: PaddingInline;
|
|
485
|
+
paddingInlineStart?: PaddingInlineStart;
|
|
486
|
+
paddingInlineEnd?: PaddingInlineEnd;
|
|
487
|
+
customStyles?: CustomStyles;
|
|
488
|
+
};
|
|
489
|
+
|
|
453
490
|
// @public (undocumented)
|
|
454
491
|
type Shadow = keyof typeof shadowMap;
|
|
455
492
|
|
|
@@ -463,49 +500,45 @@ const shadowMap: {
|
|
|
463
500
|
};
|
|
464
501
|
|
|
465
502
|
// @public (undocumented)
|
|
466
|
-
type Space = keyof typeof spaceMap
|
|
503
|
+
type Space = keyof typeof spaceMap;
|
|
467
504
|
|
|
468
505
|
// @public (undocumented)
|
|
469
|
-
type Space_2 = keyof typeof spaceMap_2
|
|
506
|
+
type Space_2 = keyof typeof spaceMap_2;
|
|
470
507
|
|
|
471
508
|
// @public
|
|
472
509
|
const spaceMap: {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
readonly '1000': SerializedStyles;
|
|
488
|
-
};
|
|
510
|
+
readonly '0': SerializedStyles;
|
|
511
|
+
readonly '025': SerializedStyles;
|
|
512
|
+
readonly '050': SerializedStyles;
|
|
513
|
+
readonly '075': SerializedStyles;
|
|
514
|
+
readonly '100': SerializedStyles;
|
|
515
|
+
readonly '150': SerializedStyles;
|
|
516
|
+
readonly '200': SerializedStyles;
|
|
517
|
+
readonly '250': SerializedStyles;
|
|
518
|
+
readonly '300': SerializedStyles;
|
|
519
|
+
readonly '400': SerializedStyles;
|
|
520
|
+
readonly '500': SerializedStyles;
|
|
521
|
+
readonly '600': SerializedStyles;
|
|
522
|
+
readonly '800': SerializedStyles;
|
|
523
|
+
readonly '1000': SerializedStyles;
|
|
489
524
|
};
|
|
490
525
|
|
|
491
526
|
// @public
|
|
492
527
|
const spaceMap_2: {
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
readonly '1000': SerializedStyles;
|
|
508
|
-
};
|
|
528
|
+
readonly '0': SerializedStyles;
|
|
529
|
+
readonly '025': SerializedStyles;
|
|
530
|
+
readonly '050': SerializedStyles;
|
|
531
|
+
readonly '075': SerializedStyles;
|
|
532
|
+
readonly '100': SerializedStyles;
|
|
533
|
+
readonly '150': SerializedStyles;
|
|
534
|
+
readonly '200': SerializedStyles;
|
|
535
|
+
readonly '250': SerializedStyles;
|
|
536
|
+
readonly '300': SerializedStyles;
|
|
537
|
+
readonly '400': SerializedStyles;
|
|
538
|
+
readonly '500': SerializedStyles;
|
|
539
|
+
readonly '600': SerializedStyles;
|
|
540
|
+
readonly '800': SerializedStyles;
|
|
541
|
+
readonly '1000': SerializedStyles;
|
|
509
542
|
};
|
|
510
543
|
|
|
511
544
|
// @public (undocumented)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/primitives/responsive",
|
|
3
|
+
"main": "../dist/cjs/helpers/responsive/index.js",
|
|
4
|
+
"module": "../dist/esm/helpers/responsive/index.js",
|
|
5
|
+
"module:es2019": "../dist/es2019/helpers/responsive/index.js",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"types": "../dist/types/helpers/responsive/index.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.0 <4.5": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.0/helpers/responsive/index.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|