@atlaskit/primitives 19.0.0 → 19.0.1
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 +7 -0
- package/codemods/compiled-fork-stage1/transform.tsx +178 -17
- package/components/flex/package.json +17 -0
- package/constellation/pressable/usage.mdx +2 -0
- package/dist/cjs/compiled/components/anchor.js +1 -1
- package/dist/cjs/compiled/components/box.js +2 -2
- package/dist/cjs/compiled/components/pressable.js +1 -1
- package/dist/cjs/components/anchor.js +1 -1
- package/dist/cjs/components/box.js +2 -2
- package/dist/cjs/components/pressable.js +1 -1
- package/dist/cjs/responsive/build-media-query-css.js +14 -71
- package/dist/cjs/responsive/hide.js +4 -3
- package/dist/cjs/responsive/media-helper.js +8 -37
- package/dist/cjs/responsive/media.js +31 -0
- package/dist/cjs/responsive/show.js +4 -3
- package/dist/cjs/responsive/unsafe-build-above-media-query-css.js +43 -0
- package/dist/cjs/responsive/unsafe-build-below-media-query-css.js +45 -0
- package/dist/cjs/utils/surface-context.js +13 -0
- package/dist/cjs/utils/surface-provider.js +10 -10
- package/dist/es2019/compiled/components/anchor.js +1 -1
- package/dist/es2019/compiled/components/box.js +1 -1
- package/dist/es2019/compiled/components/pressable.js +1 -1
- package/dist/es2019/components/anchor.js +1 -1
- package/dist/es2019/components/box.js +1 -1
- package/dist/es2019/components/pressable.js +1 -1
- package/dist/es2019/responsive/build-media-query-css.js +2 -75
- package/dist/es2019/responsive/hide.js +2 -1
- package/dist/es2019/responsive/media-helper.js +3 -37
- package/dist/es2019/responsive/media.js +25 -0
- package/dist/es2019/responsive/show.js +2 -1
- package/dist/es2019/responsive/unsafe-build-above-media-query-css.js +38 -0
- package/dist/es2019/responsive/unsafe-build-below-media-query-css.js +42 -0
- package/dist/es2019/utils/surface-context.js +7 -0
- package/dist/es2019/utils/surface-provider.js +4 -9
- package/dist/esm/compiled/components/anchor.js +1 -1
- package/dist/esm/compiled/components/box.js +1 -1
- package/dist/esm/compiled/components/pressable.js +1 -1
- package/dist/esm/components/anchor.js +1 -1
- package/dist/esm/components/box.js +1 -1
- package/dist/esm/components/pressable.js +1 -1
- package/dist/esm/responsive/build-media-query-css.js +2 -68
- package/dist/esm/responsive/hide.js +2 -1
- package/dist/esm/responsive/media-helper.js +3 -37
- package/dist/esm/responsive/media.js +25 -0
- package/dist/esm/responsive/show.js +2 -1
- package/dist/esm/responsive/unsafe-build-above-media-query-css.js +37 -0
- package/dist/esm/responsive/unsafe-build-below-media-query-css.js +39 -0
- package/dist/esm/utils/surface-context.js +7 -0
- package/dist/esm/utils/surface-provider.js +4 -9
- package/dist/types/responsive/build-media-query-css.d.ts +2 -63
- package/dist/types/responsive/media-helper.d.ts +1 -35
- package/dist/types/responsive/media.d.ts +25 -0
- package/dist/types/responsive/types.d.ts +1 -1
- package/dist/types/responsive/unsafe-build-above-media-query-css.d.ts +33 -0
- package/dist/types/responsive/unsafe-build-below-media-query-css.d.ts +32 -0
- package/dist/types/utils/surface-context.d.ts +8 -0
- package/dist/types/utils/surface-provider.d.ts +1 -7
- package/dist/types-ts4.5/responsive/build-media-query-css.d.ts +2 -63
- package/dist/types-ts4.5/responsive/media-helper.d.ts +1 -35
- package/dist/types-ts4.5/responsive/media.d.ts +25 -0
- package/dist/types-ts4.5/responsive/types.d.ts +1 -1
- package/dist/types-ts4.5/responsive/unsafe-build-above-media-query-css.d.ts +33 -0
- package/dist/types-ts4.5/responsive/unsafe-build-below-media-query-css.d.ts +32 -0
- package/dist/types-ts4.5/utils/surface-context.d.ts +8 -0
- package/dist/types-ts4.5/utils/surface-provider.d.ts +1 -7
- package/package.json +16 -16
- package/scripts/capitalize.tsx +2 -0
- package/scripts/color-codegen-template.tsx +3 -6
- package/scripts/compose.tsx +4 -0
- package/scripts/elevation-codegen-template.tsx +3 -6
- package/scripts/generate-type-defs.tsx +12 -0
- package/scripts/inverse-color-map-template.tsx +4 -1
- package/scripts/is-accent.tsx +1 -0
- package/scripts/is-hovered.tsx +1 -0
- package/scripts/is-pressed.tsx +1 -0
- package/scripts/pick.tsx +4 -0
- package/scripts/shape-codegen-template.tsx +3 -1
- package/scripts/spacing-codegen-template.tsx +2 -1
- package/scripts/text-codegen-template.tsx +3 -1
- package/scripts/typography-codegen-template.tsx +3 -1
- package/scripts/utils.tsx +7 -25
- package/offerings.json +0 -298
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export var media = {
|
|
2
|
+
above: {
|
|
3
|
+
xxs: '@media all',
|
|
4
|
+
xs: '@media (min-width: 30rem)',
|
|
5
|
+
sm: '@media (min-width: 48rem)',
|
|
6
|
+
md: '@media (min-width: 64rem)',
|
|
7
|
+
lg: '@media (min-width: 90rem)',
|
|
8
|
+
xl: '@media (min-width: 110.5rem)'
|
|
9
|
+
},
|
|
10
|
+
only: {
|
|
11
|
+
xxs: '@media (min-width: 0rem) and (max-width: 29.99rem)',
|
|
12
|
+
xs: '@media (min-width: 30rem) and (max-width: 47.99rem)',
|
|
13
|
+
sm: '@media (min-width: 48rem) and (max-width: 63.99rem)',
|
|
14
|
+
md: '@media (min-width: 64rem) and (max-width: 89.99rem)',
|
|
15
|
+
lg: '@media (min-width: 90rem) and (max-width: 110.49rem)',
|
|
16
|
+
xl: '@media (min-width: 110.5rem)'
|
|
17
|
+
},
|
|
18
|
+
below: {
|
|
19
|
+
xs: '@media not all and (min-width: 30rem)',
|
|
20
|
+
sm: '@media not all and (min-width: 48rem)',
|
|
21
|
+
md: '@media not all and (min-width: 64rem)',
|
|
22
|
+
lg: '@media not all and (min-width: 90rem)',
|
|
23
|
+
xl: '@media not all and (min-width: 110.5rem)'
|
|
24
|
+
}
|
|
25
|
+
};
|
|
@@ -7,7 +7,8 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
9
|
import { parseXcss } from '../xcss/xcss';
|
|
10
|
-
import { UNSAFE_buildAboveMediaQueryCSS
|
|
10
|
+
import { UNSAFE_buildAboveMediaQueryCSS } from './unsafe-build-above-media-query-css';
|
|
11
|
+
import { UNSAFE_buildBelowMediaQueryCSS } from './unsafe-build-below-media-query-css';
|
|
11
12
|
var showAboveQueries = UNSAFE_buildAboveMediaQueryCSS({
|
|
12
13
|
display: 'revert'
|
|
13
14
|
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
|
|
5
|
+
import { css } from '@emotion/react';
|
|
6
|
+
import { UNSAFE_BREAKPOINTS_ORDERED_LIST } from './constants';
|
|
7
|
+
import { media } from './media';
|
|
8
|
+
/**
|
|
9
|
+
* Build a map of breakpoints to css with media queries and nested styles.
|
|
10
|
+
*
|
|
11
|
+
* @internal Not intended to be used outside of DST at this stage.
|
|
12
|
+
* @experimental Not intended to be used outside of DST at this stage.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* A map to build optional `display:none` for consumption on a div.
|
|
16
|
+
* ```ts
|
|
17
|
+
* const hideMediaQueries = buildAboveMediaQueryCSS({ display: 'none' });
|
|
18
|
+
*
|
|
19
|
+
* const Component = ({ hideAtBreakpoints: ('xs' | 'sm')[], children: ReactNode }) => {
|
|
20
|
+
* return <div css={hideAtBreakpoints.map(b => hideMediaQueries[b])}>{children}</div>;
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* This roughly builds a map that will look roughly like this (if done manually):
|
|
25
|
+
* ```ts
|
|
26
|
+
* {
|
|
27
|
+
* xxs: css({ '@media all': { display: 'none' } }),
|
|
28
|
+
* xs: css({ '@media (min-width: 30rem)': { display: 'none' } }),
|
|
29
|
+
* sm: css({ '@media (min-width: 48rem)': { display: 'none' } }),
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export var UNSAFE_buildAboveMediaQueryCSS = function UNSAFE_buildAboveMediaQueryCSS(input) {
|
|
34
|
+
return UNSAFE_BREAKPOINTS_ORDERED_LIST.reduce(function (acc, breakpoint) {
|
|
35
|
+
return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, breakpoint, css(_defineProperty({}, media.above[breakpoint], typeof input === 'function' ? input(breakpoint) : input))));
|
|
36
|
+
}, {});
|
|
37
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
|
|
5
|
+
import { css } from '@emotion/react';
|
|
6
|
+
import { UNSAFE_BREAKPOINTS_ORDERED_LIST } from './constants';
|
|
7
|
+
import { UNSAFE_media } from './media-helper';
|
|
8
|
+
/**
|
|
9
|
+
* Build a map of breakpoints to css with media queries and nested styles.
|
|
10
|
+
*
|
|
11
|
+
* @internal Not intended to be used outside of DST at this stage.
|
|
12
|
+
* @experimental Not intended to be used outside of DST at this stage.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* A map to build optional `display:none` for consumption on a div.
|
|
16
|
+
* ```ts
|
|
17
|
+
* const hideMediaQueries = buildBelowMediaQueryCSS({ display: 'none' });
|
|
18
|
+
*
|
|
19
|
+
* const Component = ({ hideAtBreakpoints: ('xs' | 'sm')[], children: ReactNode }) => {
|
|
20
|
+
* return <div css={hideAtBreakpoints.map(b => hideMediaQueries[b])}>{children}</div>;
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* This roughly builds a map that will look roughly like this (if done manually):
|
|
25
|
+
* ```ts
|
|
26
|
+
* {
|
|
27
|
+
* xs: css({ '@media not all and (min-width: 30rem)': { display: 'none' } }),
|
|
28
|
+
* sm: css({ '@media not all and (min-width: 48rem)': { display: 'none' } }),
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export var UNSAFE_buildBelowMediaQueryCSS = function UNSAFE_buildBelowMediaQueryCSS(input) {
|
|
33
|
+
return UNSAFE_BREAKPOINTS_ORDERED_LIST.reduce(function (acc, breakpoint) {
|
|
34
|
+
if (breakpoint === 'xxs') {
|
|
35
|
+
return acc;
|
|
36
|
+
}
|
|
37
|
+
return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, breakpoint, css(_defineProperty({}, UNSAFE_media.below[breakpoint], typeof input === 'function' ? input(breakpoint) : input))));
|
|
38
|
+
}, {});
|
|
39
|
+
};
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
* __Surface context__
|
|
4
|
-
*
|
|
5
|
-
* A surface context provides context information on the current background (if set).
|
|
6
|
-
*/
|
|
7
|
-
export var SurfaceContext = /*#__PURE__*/createContext('elevation.surface');
|
|
8
|
-
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { SurfaceContext } from './surface-context';
|
|
9
3
|
/**
|
|
10
4
|
* __useSurface__
|
|
11
5
|
*
|
|
@@ -16,4 +10,5 @@ export var SurfaceContext = /*#__PURE__*/createContext('elevation.surface');
|
|
|
16
10
|
export var useSurface = function useSurface() {
|
|
17
11
|
return useContext(SurfaceContext);
|
|
18
12
|
};
|
|
19
|
-
SurfaceContext.displayName = 'SurfaceProvider';
|
|
13
|
+
SurfaceContext.displayName = 'SurfaceProvider';
|
|
14
|
+
export { SurfaceContext } from './surface-context';
|
|
@@ -1,63 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Build a map of breakpoints to css with media queries and nested styles.
|
|
5
|
-
*
|
|
6
|
-
* @internal Not intended to be used outside of DST at this stage.
|
|
7
|
-
* @experimental Not intended to be used outside of DST at this stage.
|
|
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 all': { display: 'none' } }),
|
|
23
|
-
* xs: css({ '@media (min-width: 30rem)': { display: 'none' } }),
|
|
24
|
-
* sm: css({ '@media (min-width: 48rem)': { display: 'none' } }),
|
|
25
|
-
* }
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export declare const UNSAFE_buildAboveMediaQueryCSS: (
|
|
29
|
-
/**
|
|
30
|
-
* The desired CSS to place inside of the media query.
|
|
31
|
-
* This can either be a css object directly or functional with `breakpoint` as the arg to return a css object.
|
|
32
|
-
*/
|
|
33
|
-
input: CSSObject | ((breakpoint: Breakpoint) => CSSObject)) => Required<Partial<Record<Breakpoint, SerializedStyles>>>;
|
|
34
|
-
/**
|
|
35
|
-
* Build a map of breakpoints to css with media queries and nested styles.
|
|
36
|
-
*
|
|
37
|
-
* @internal Not intended to be used outside of DST at this stage.
|
|
38
|
-
* @experimental Not intended to be used outside of DST at this stage.
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* A map to build optional `display:none` for consumption on a div.
|
|
42
|
-
* ```ts
|
|
43
|
-
* const hideMediaQueries = buildBelowMediaQueryCSS({ display: 'none' });
|
|
44
|
-
*
|
|
45
|
-
* const Component = ({ hideAtBreakpoints: ('xs' | 'sm')[], children: ReactNode }) => {
|
|
46
|
-
* return <div css={hideAtBreakpoints.map(b => hideMediaQueries[b])}>{children}</div>;
|
|
47
|
-
* }
|
|
48
|
-
* ```
|
|
49
|
-
*
|
|
50
|
-
* This roughly builds a map that will look roughly like this (if done manually):
|
|
51
|
-
* ```ts
|
|
52
|
-
* {
|
|
53
|
-
* xs: css({ '@media not all and (min-width: 30rem)': { display: 'none' } }),
|
|
54
|
-
* sm: css({ '@media not all and (min-width: 48rem)': { display: 'none' } }),
|
|
55
|
-
* }
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
export declare const UNSAFE_buildBelowMediaQueryCSS: (
|
|
59
|
-
/**
|
|
60
|
-
* The desired CSS to place inside of the media query.
|
|
61
|
-
* This can either be a css object directly or functional with `breakpoint` as the arg to return a css object.
|
|
62
|
-
*/
|
|
63
|
-
input: CSSObject | ((breakpoint: Breakpoint) => CSSObject)) => Required<Partial<Record<Breakpoint, SerializedStyles>>>;
|
|
1
|
+
export { UNSAFE_buildAboveMediaQueryCSS } from './unsafe-build-above-media-query-css';
|
|
2
|
+
export { UNSAFE_buildBelowMediaQueryCSS } from './unsafe-build-below-media-query-css';
|
|
@@ -1,38 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is an object of usable media query helpers using our internal breakpoints configuration.
|
|
3
|
-
*
|
|
4
|
-
* When using Compiled CSS-in-JS, please ensure that only a single declaration can take effect at a time.
|
|
5
|
-
* This means that you should avoid multiple breakpoints taking effect at the same time,
|
|
6
|
-
* eg. ```{ [media.above.xs]: { color: 'red' }, [media.above.sm]: { color: 'green' }}```.
|
|
7
|
-
* Instead, make sure that only one breakpoint can take effect at a time,
|
|
8
|
-
* e.g, ```{ [media.only.xs]: { color: 'red' }, [media.above.sm]: { color: 'green' }}```.
|
|
9
|
-
* For more details, please see <https://compiledcssinjs.com/docs/atomic-css#selector-specificity>.
|
|
10
|
-
*/
|
|
11
|
-
export declare const media: {
|
|
12
|
-
above: {
|
|
13
|
-
readonly xxs: "@media all";
|
|
14
|
-
readonly xs: "@media (min-width: 30rem)";
|
|
15
|
-
readonly sm: "@media (min-width: 48rem)";
|
|
16
|
-
readonly md: "@media (min-width: 64rem)";
|
|
17
|
-
readonly lg: "@media (min-width: 90rem)";
|
|
18
|
-
readonly xl: "@media (min-width: 110.5rem)";
|
|
19
|
-
};
|
|
20
|
-
only: {
|
|
21
|
-
readonly xxs: "@media (min-width: 0rem) and (max-width: 29.99rem)";
|
|
22
|
-
readonly xs: "@media (min-width: 30rem) and (max-width: 47.99rem)";
|
|
23
|
-
readonly sm: "@media (min-width: 48rem) and (max-width: 63.99rem)";
|
|
24
|
-
readonly md: "@media (min-width: 64rem) and (max-width: 89.99rem)";
|
|
25
|
-
readonly lg: "@media (min-width: 90rem) and (max-width: 110.49rem)";
|
|
26
|
-
readonly xl: "@media (min-width: 110.5rem)";
|
|
27
|
-
};
|
|
28
|
-
below: {
|
|
29
|
-
readonly xs: "@media not all and (min-width: 30rem)";
|
|
30
|
-
readonly sm: "@media not all and (min-width: 48rem)";
|
|
31
|
-
readonly md: "@media not all and (min-width: 64rem)";
|
|
32
|
-
readonly lg: "@media not all and (min-width: 90rem)";
|
|
33
|
-
readonly xl: "@media not all and (min-width: 110.5rem)";
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
1
|
/**
|
|
37
2
|
* Keep `UNSAFE_media` for backwards compatibility.
|
|
38
3
|
*/
|
|
@@ -61,3 +26,4 @@ export declare const UNSAFE_media: {
|
|
|
61
26
|
readonly xl: '@media not all and (min-width: 110.5rem)';
|
|
62
27
|
};
|
|
63
28
|
};
|
|
29
|
+
export { media } from './media';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const media: {
|
|
2
|
+
above: {
|
|
3
|
+
readonly xxs: "@media all";
|
|
4
|
+
readonly xs: "@media (min-width: 30rem)";
|
|
5
|
+
readonly sm: "@media (min-width: 48rem)";
|
|
6
|
+
readonly md: "@media (min-width: 64rem)";
|
|
7
|
+
readonly lg: "@media (min-width: 90rem)";
|
|
8
|
+
readonly xl: "@media (min-width: 110.5rem)";
|
|
9
|
+
};
|
|
10
|
+
only: {
|
|
11
|
+
readonly xxs: "@media (min-width: 0rem) and (max-width: 29.99rem)";
|
|
12
|
+
readonly xs: "@media (min-width: 30rem) and (max-width: 47.99rem)";
|
|
13
|
+
readonly sm: "@media (min-width: 48rem) and (max-width: 63.99rem)";
|
|
14
|
+
readonly md: "@media (min-width: 64rem) and (max-width: 89.99rem)";
|
|
15
|
+
readonly lg: "@media (min-width: 90rem) and (max-width: 110.49rem)";
|
|
16
|
+
readonly xl: "@media (min-width: 110.5rem)";
|
|
17
|
+
};
|
|
18
|
+
below: {
|
|
19
|
+
readonly xs: "@media not all and (min-width: 30rem)";
|
|
20
|
+
readonly sm: "@media not all and (min-width: 48rem)";
|
|
21
|
+
readonly md: "@media not all and (min-width: 64rem)";
|
|
22
|
+
readonly lg: "@media not all and (min-width: 90rem)";
|
|
23
|
+
readonly xl: "@media not all and (min-width: 110.5rem)";
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type CSSObject, type SerializedStyles } from '@emotion/react';
|
|
2
|
+
import type { Breakpoint } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Build a map of breakpoints to css with media queries and nested styles.
|
|
5
|
+
*
|
|
6
|
+
* @internal Not intended to be used outside of DST at this stage.
|
|
7
|
+
* @experimental Not intended to be used outside of DST at this stage.
|
|
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 all': { display: 'none' } }),
|
|
23
|
+
* xs: css({ '@media (min-width: 30rem)': { display: 'none' } }),
|
|
24
|
+
* sm: css({ '@media (min-width: 48rem)': { display: 'none' } }),
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare const UNSAFE_buildAboveMediaQueryCSS: (
|
|
29
|
+
/**
|
|
30
|
+
* The desired CSS to place inside of the media query.
|
|
31
|
+
* This can either be a css object directly or functional with `breakpoint` as the arg to return a css object.
|
|
32
|
+
*/
|
|
33
|
+
input: CSSObject | ((breakpoint: Breakpoint) => CSSObject)) => Required<Partial<Record<Breakpoint, SerializedStyles>>>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type CSSObject, type SerializedStyles } from '@emotion/react';
|
|
2
|
+
import type { Breakpoint } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Build a map of breakpoints to css with media queries and nested styles.
|
|
5
|
+
*
|
|
6
|
+
* @internal Not intended to be used outside of DST at this stage.
|
|
7
|
+
* @experimental Not intended to be used outside of DST at this stage.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* A map to build optional `display:none` for consumption on a div.
|
|
11
|
+
* ```ts
|
|
12
|
+
* const hideMediaQueries = buildBelowMediaQueryCSS({ 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
|
+
* xs: css({ '@media not all and (min-width: 30rem)': { display: 'none' } }),
|
|
23
|
+
* sm: css({ '@media not all and (min-width: 48rem)': { display: 'none' } }),
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare const UNSAFE_buildBelowMediaQueryCSS: (
|
|
28
|
+
/**
|
|
29
|
+
* The desired CSS to place inside of the media query.
|
|
30
|
+
* This can either be a css object directly or functional with `breakpoint` as the arg to return a css object.
|
|
31
|
+
*/
|
|
32
|
+
input: CSSObject | ((breakpoint: Breakpoint) => CSSObject)) => Required<Partial<Record<Breakpoint, SerializedStyles>>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Context } from 'react';
|
|
2
|
+
import type { BackgroundColorToken } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* __Surface context__
|
|
5
|
+
*
|
|
6
|
+
* A surface context provides context information on the current background (if set).
|
|
7
|
+
*/
|
|
8
|
+
export declare const SurfaceContext: Context<BackgroundColorToken>;
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import { type Context } from 'react';
|
|
2
1
|
import type { BackgroundColorToken } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* __Surface context__
|
|
5
|
-
*
|
|
6
|
-
* A surface context provides context information on the current background (if set).
|
|
7
|
-
*/
|
|
8
|
-
export declare const SurfaceContext: Context<BackgroundColorToken>;
|
|
9
2
|
/**
|
|
10
3
|
* __useSurface__
|
|
11
4
|
*
|
|
@@ -14,3 +7,4 @@ export declare const SurfaceContext: Context<BackgroundColorToken>;
|
|
|
14
7
|
* @see SurfaceContext
|
|
15
8
|
*/
|
|
16
9
|
export declare const useSurface: () => BackgroundColorToken;
|
|
10
|
+
export { SurfaceContext } from './surface-context';
|
|
@@ -1,63 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Build a map of breakpoints to css with media queries and nested styles.
|
|
5
|
-
*
|
|
6
|
-
* @internal Not intended to be used outside of DST at this stage.
|
|
7
|
-
* @experimental Not intended to be used outside of DST at this stage.
|
|
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 all': { display: 'none' } }),
|
|
23
|
-
* xs: css({ '@media (min-width: 30rem)': { display: 'none' } }),
|
|
24
|
-
* sm: css({ '@media (min-width: 48rem)': { display: 'none' } }),
|
|
25
|
-
* }
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export declare const UNSAFE_buildAboveMediaQueryCSS: (
|
|
29
|
-
/**
|
|
30
|
-
* The desired CSS to place inside of the media query.
|
|
31
|
-
* This can either be a css object directly or functional with `breakpoint` as the arg to return a css object.
|
|
32
|
-
*/
|
|
33
|
-
input: CSSObject | ((breakpoint: Breakpoint) => CSSObject)) => Required<Partial<Record<Breakpoint, SerializedStyles>>>;
|
|
34
|
-
/**
|
|
35
|
-
* Build a map of breakpoints to css with media queries and nested styles.
|
|
36
|
-
*
|
|
37
|
-
* @internal Not intended to be used outside of DST at this stage.
|
|
38
|
-
* @experimental Not intended to be used outside of DST at this stage.
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* A map to build optional `display:none` for consumption on a div.
|
|
42
|
-
* ```ts
|
|
43
|
-
* const hideMediaQueries = buildBelowMediaQueryCSS({ display: 'none' });
|
|
44
|
-
*
|
|
45
|
-
* const Component = ({ hideAtBreakpoints: ('xs' | 'sm')[], children: ReactNode }) => {
|
|
46
|
-
* return <div css={hideAtBreakpoints.map(b => hideMediaQueries[b])}>{children}</div>;
|
|
47
|
-
* }
|
|
48
|
-
* ```
|
|
49
|
-
*
|
|
50
|
-
* This roughly builds a map that will look roughly like this (if done manually):
|
|
51
|
-
* ```ts
|
|
52
|
-
* {
|
|
53
|
-
* xs: css({ '@media not all and (min-width: 30rem)': { display: 'none' } }),
|
|
54
|
-
* sm: css({ '@media not all and (min-width: 48rem)': { display: 'none' } }),
|
|
55
|
-
* }
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
export declare const UNSAFE_buildBelowMediaQueryCSS: (
|
|
59
|
-
/**
|
|
60
|
-
* The desired CSS to place inside of the media query.
|
|
61
|
-
* This can either be a css object directly or functional with `breakpoint` as the arg to return a css object.
|
|
62
|
-
*/
|
|
63
|
-
input: CSSObject | ((breakpoint: Breakpoint) => CSSObject)) => Required<Partial<Record<Breakpoint, SerializedStyles>>>;
|
|
1
|
+
export { UNSAFE_buildAboveMediaQueryCSS } from './unsafe-build-above-media-query-css';
|
|
2
|
+
export { UNSAFE_buildBelowMediaQueryCSS } from './unsafe-build-below-media-query-css';
|
|
@@ -1,38 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is an object of usable media query helpers using our internal breakpoints configuration.
|
|
3
|
-
*
|
|
4
|
-
* When using Compiled CSS-in-JS, please ensure that only a single declaration can take effect at a time.
|
|
5
|
-
* This means that you should avoid multiple breakpoints taking effect at the same time,
|
|
6
|
-
* eg. ```{ [media.above.xs]: { color: 'red' }, [media.above.sm]: { color: 'green' }}```.
|
|
7
|
-
* Instead, make sure that only one breakpoint can take effect at a time,
|
|
8
|
-
* e.g, ```{ [media.only.xs]: { color: 'red' }, [media.above.sm]: { color: 'green' }}```.
|
|
9
|
-
* For more details, please see <https://compiledcssinjs.com/docs/atomic-css#selector-specificity>.
|
|
10
|
-
*/
|
|
11
|
-
export declare const media: {
|
|
12
|
-
above: {
|
|
13
|
-
readonly xxs: "@media all";
|
|
14
|
-
readonly xs: "@media (min-width: 30rem)";
|
|
15
|
-
readonly sm: "@media (min-width: 48rem)";
|
|
16
|
-
readonly md: "@media (min-width: 64rem)";
|
|
17
|
-
readonly lg: "@media (min-width: 90rem)";
|
|
18
|
-
readonly xl: "@media (min-width: 110.5rem)";
|
|
19
|
-
};
|
|
20
|
-
only: {
|
|
21
|
-
readonly xxs: "@media (min-width: 0rem) and (max-width: 29.99rem)";
|
|
22
|
-
readonly xs: "@media (min-width: 30rem) and (max-width: 47.99rem)";
|
|
23
|
-
readonly sm: "@media (min-width: 48rem) and (max-width: 63.99rem)";
|
|
24
|
-
readonly md: "@media (min-width: 64rem) and (max-width: 89.99rem)";
|
|
25
|
-
readonly lg: "@media (min-width: 90rem) and (max-width: 110.49rem)";
|
|
26
|
-
readonly xl: "@media (min-width: 110.5rem)";
|
|
27
|
-
};
|
|
28
|
-
below: {
|
|
29
|
-
readonly xs: "@media not all and (min-width: 30rem)";
|
|
30
|
-
readonly sm: "@media not all and (min-width: 48rem)";
|
|
31
|
-
readonly md: "@media not all and (min-width: 64rem)";
|
|
32
|
-
readonly lg: "@media not all and (min-width: 90rem)";
|
|
33
|
-
readonly xl: "@media not all and (min-width: 110.5rem)";
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
1
|
/**
|
|
37
2
|
* Keep `UNSAFE_media` for backwards compatibility.
|
|
38
3
|
*/
|
|
@@ -61,3 +26,4 @@ export declare const UNSAFE_media: {
|
|
|
61
26
|
readonly xl: '@media not all and (min-width: 110.5rem)';
|
|
62
27
|
};
|
|
63
28
|
};
|
|
29
|
+
export { media } from './media';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const media: {
|
|
2
|
+
above: {
|
|
3
|
+
readonly xxs: "@media all";
|
|
4
|
+
readonly xs: "@media (min-width: 30rem)";
|
|
5
|
+
readonly sm: "@media (min-width: 48rem)";
|
|
6
|
+
readonly md: "@media (min-width: 64rem)";
|
|
7
|
+
readonly lg: "@media (min-width: 90rem)";
|
|
8
|
+
readonly xl: "@media (min-width: 110.5rem)";
|
|
9
|
+
};
|
|
10
|
+
only: {
|
|
11
|
+
readonly xxs: "@media (min-width: 0rem) and (max-width: 29.99rem)";
|
|
12
|
+
readonly xs: "@media (min-width: 30rem) and (max-width: 47.99rem)";
|
|
13
|
+
readonly sm: "@media (min-width: 48rem) and (max-width: 63.99rem)";
|
|
14
|
+
readonly md: "@media (min-width: 64rem) and (max-width: 89.99rem)";
|
|
15
|
+
readonly lg: "@media (min-width: 90rem) and (max-width: 110.49rem)";
|
|
16
|
+
readonly xl: "@media (min-width: 110.5rem)";
|
|
17
|
+
};
|
|
18
|
+
below: {
|
|
19
|
+
readonly xs: "@media not all and (min-width: 30rem)";
|
|
20
|
+
readonly sm: "@media not all and (min-width: 48rem)";
|
|
21
|
+
readonly md: "@media not all and (min-width: 64rem)";
|
|
22
|
+
readonly lg: "@media not all and (min-width: 90rem)";
|
|
23
|
+
readonly xl: "@media not all and (min-width: 110.5rem)";
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type CSSObject, type SerializedStyles } from '@emotion/react';
|
|
2
|
+
import type { Breakpoint } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Build a map of breakpoints to css with media queries and nested styles.
|
|
5
|
+
*
|
|
6
|
+
* @internal Not intended to be used outside of DST at this stage.
|
|
7
|
+
* @experimental Not intended to be used outside of DST at this stage.
|
|
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 all': { display: 'none' } }),
|
|
23
|
+
* xs: css({ '@media (min-width: 30rem)': { display: 'none' } }),
|
|
24
|
+
* sm: css({ '@media (min-width: 48rem)': { display: 'none' } }),
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare const UNSAFE_buildAboveMediaQueryCSS: (
|
|
29
|
+
/**
|
|
30
|
+
* The desired CSS to place inside of the media query.
|
|
31
|
+
* This can either be a css object directly or functional with `breakpoint` as the arg to return a css object.
|
|
32
|
+
*/
|
|
33
|
+
input: CSSObject | ((breakpoint: Breakpoint) => CSSObject)) => Required<Partial<Record<Breakpoint, SerializedStyles>>>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type CSSObject, type SerializedStyles } from '@emotion/react';
|
|
2
|
+
import type { Breakpoint } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Build a map of breakpoints to css with media queries and nested styles.
|
|
5
|
+
*
|
|
6
|
+
* @internal Not intended to be used outside of DST at this stage.
|
|
7
|
+
* @experimental Not intended to be used outside of DST at this stage.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* A map to build optional `display:none` for consumption on a div.
|
|
11
|
+
* ```ts
|
|
12
|
+
* const hideMediaQueries = buildBelowMediaQueryCSS({ 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
|
+
* xs: css({ '@media not all and (min-width: 30rem)': { display: 'none' } }),
|
|
23
|
+
* sm: css({ '@media not all and (min-width: 48rem)': { display: 'none' } }),
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare const UNSAFE_buildBelowMediaQueryCSS: (
|
|
28
|
+
/**
|
|
29
|
+
* The desired CSS to place inside of the media query.
|
|
30
|
+
* This can either be a css object directly or functional with `breakpoint` as the arg to return a css object.
|
|
31
|
+
*/
|
|
32
|
+
input: CSSObject | ((breakpoint: Breakpoint) => CSSObject)) => Required<Partial<Record<Breakpoint, SerializedStyles>>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Context } from 'react';
|
|
2
|
+
import type { BackgroundColorToken } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* __Surface context__
|
|
5
|
+
*
|
|
6
|
+
* A surface context provides context information on the current background (if set).
|
|
7
|
+
*/
|
|
8
|
+
export declare const SurfaceContext: Context<BackgroundColorToken>;
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import { type Context } from 'react';
|
|
2
1
|
import type { BackgroundColorToken } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* __Surface context__
|
|
5
|
-
*
|
|
6
|
-
* A surface context provides context information on the current background (if set).
|
|
7
|
-
*/
|
|
8
|
-
export declare const SurfaceContext: Context<BackgroundColorToken>;
|
|
9
2
|
/**
|
|
10
3
|
* __useSurface__
|
|
11
4
|
*
|
|
@@ -14,3 +7,4 @@ export declare const SurfaceContext: Context<BackgroundColorToken>;
|
|
|
14
7
|
* @see SurfaceContext
|
|
15
8
|
*/
|
|
16
9
|
export declare const useSurface: () => BackgroundColorToken;
|
|
10
|
+
export { SurfaceContext } from './surface-context';
|