@atlaskit/primitives 18.1.4 → 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 +19 -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/box.js +2 -2
- package/dist/cjs/compiled/components/text.compiled.css +0 -1
- package/dist/cjs/compiled/components/text.js +0 -1
- package/dist/cjs/components/box.js +2 -2
- 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/cjs/xcss/style-maps.partial.js +2 -5
- package/dist/es2019/compiled/components/box.js +1 -1
- package/dist/es2019/compiled/components/text.compiled.css +0 -1
- package/dist/es2019/compiled/components/text.js +0 -1
- package/dist/es2019/components/box.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/es2019/xcss/style-maps.partial.js +2 -5
- package/dist/esm/compiled/components/box.js +1 -1
- package/dist/esm/compiled/components/text.compiled.css +0 -1
- package/dist/esm/compiled/components/text.js +0 -1
- package/dist/esm/components/box.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/esm/xcss/style-maps.partial.js +2 -5
- package/dist/types/compiled/components/types.d.ts +1 -1
- 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/xcss/style-maps.partial.d.ts +2 -4
- package/dist/types-ts4.5/compiled/components/types.d.ts +1 -1
- 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/dist/types-ts4.5/xcss/style-maps.partial.d.ts +2 -4
- package/package.json +17 -17
- 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 -2
- package/scripts/typography-codegen-template.tsx +3 -1
- package/scripts/utils.tsx +7 -25
- package/offerings.json +0 -298
|
@@ -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';
|
|
@@ -515,7 +515,7 @@ export var borderRadiusMap = {
|
|
|
515
515
|
|
|
516
516
|
/**
|
|
517
517
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
518
|
-
* @codegen <<SignedSource::
|
|
518
|
+
* @codegen <<SignedSource::6dffa08c1104af4093361cb0f7e37996>>
|
|
519
519
|
* @codegenId typography
|
|
520
520
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
521
521
|
* @codegenParams ["fontSize", "fontWeight", "fontFamily", "lineHeight", "body", "ui"]
|
|
@@ -524,8 +524,6 @@ export var borderRadiusMap = {
|
|
|
524
524
|
*/
|
|
525
525
|
export var fontMap = {
|
|
526
526
|
'font.body': "var(--ds-font-body, normal 400 14px/20px \"Atlassian Sans\", ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
527
|
-
// @deprecated
|
|
528
|
-
'font.body.UNSAFE_small': "var(--ds-font-body-UNSAFE_small, normal 400 12px/16px \"Atlassian Sans\", ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
529
527
|
'font.body.large': "var(--ds-font-body-large, normal 400 16px/24px \"Atlassian Sans\", ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
530
528
|
'font.body.small': "var(--ds-font-body-small, normal 400 12px/16px \"Atlassian Sans\", ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
531
529
|
'font.code': "var(--ds-font-code, normal 400 0.875em/1 \"Atlassian Mono\", ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)",
|
|
@@ -559,7 +557,7 @@ export var fontFamilyMap = {
|
|
|
559
557
|
|
|
560
558
|
/**
|
|
561
559
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
562
|
-
* @codegen <<SignedSource::
|
|
560
|
+
* @codegen <<SignedSource::b67a50fa5abb078032598ba819a6f691>>
|
|
563
561
|
* @codegenId text
|
|
564
562
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
565
563
|
* @codegenDependency ../../../primitives/scripts/codegen-file-templates/dimensions.tsx <<SignedSource::cc9b3f12104c6ede803da6a42daac0b0>>
|
|
@@ -567,7 +565,6 @@ export var fontFamilyMap = {
|
|
|
567
565
|
*/
|
|
568
566
|
export var textSizeMap = {
|
|
569
567
|
medium: "var(--ds-font-body, normal 400 14px/20px \"Atlassian Sans\", ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
570
|
-
UNSAFE_small: "var(--ds-font-body-UNSAFE_small, normal 400 12px/16px \"Atlassian Sans\", ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
571
568
|
large: "var(--ds-font-body-large, normal 400 16px/24px \"Atlassian Sans\", ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
572
569
|
small: "var(--ds-font-body-small, normal 400 12px/16px \"Atlassian Sans\", ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)"
|
|
573
570
|
};
|
|
@@ -40,6 +40,6 @@ export type GapToken = PositiveSpaceToken;
|
|
|
40
40
|
export type SurfaceColorToken = 'utility.elevation.surface.current' | 'elevation.surface' | 'elevation.surface.overlay' | 'elevation.surface.raised' | 'elevation.surface.sunken';
|
|
41
41
|
export type TextAlign = 'center' | 'end' | 'start';
|
|
42
42
|
export type TextColor = 'color.text' | 'color.text.accent.lime' | 'color.text.accent.lime.bolder' | 'color.text.accent.red' | 'color.text.accent.red.bolder' | 'color.text.accent.orange' | 'color.text.accent.orange.bolder' | 'color.text.accent.yellow' | 'color.text.accent.yellow.bolder' | 'color.text.accent.green' | 'color.text.accent.green.bolder' | 'color.text.accent.teal' | 'color.text.accent.teal.bolder' | 'color.text.accent.blue' | 'color.text.accent.blue.bolder' | 'color.text.accent.purple' | 'color.text.accent.purple.bolder' | 'color.text.accent.magenta' | 'color.text.accent.magenta.bolder' | 'color.text.accent.gray' | 'color.text.accent.gray.bolder' | 'color.text.disabled' | 'color.text.inverse' | 'color.text.selected' | 'color.text.brand' | 'color.text.danger' | 'color.text.warning' | 'color.text.warning.inverse' | 'color.text.success' | 'color.text.discovery' | 'color.text.information' | 'color.text.subtlest' | 'color.text.subtle' | 'color.link' | 'color.link.pressed' | 'color.link.visited' | 'color.link.visited.pressed';
|
|
43
|
-
export type FontSize = 'small' | 'medium' | '
|
|
43
|
+
export type FontSize = 'small' | 'medium' | 'large';
|
|
44
44
|
export type FontWeight = 'bold' | 'medium' | 'regular' | 'semibold';
|
|
45
45
|
export type MetricTextFontSize = 'small' | 'medium' | 'large';
|
|
@@ -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';
|
|
@@ -542,7 +542,7 @@ export type BorderRadius = keyof typeof borderRadiusMap;
|
|
|
542
542
|
*/
|
|
543
543
|
/**
|
|
544
544
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
545
|
-
* @codegen <<SignedSource::
|
|
545
|
+
* @codegen <<SignedSource::6dffa08c1104af4093361cb0f7e37996>>
|
|
546
546
|
* @codegenId typography
|
|
547
547
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
548
548
|
* @codegenParams ["fontSize", "fontWeight", "fontFamily", "lineHeight", "body", "ui"]
|
|
@@ -551,7 +551,6 @@ export type BorderRadius = keyof typeof borderRadiusMap;
|
|
|
551
551
|
*/
|
|
552
552
|
export declare const fontMap: {
|
|
553
553
|
'font.body': 'var(--ds-font-body)';
|
|
554
|
-
'font.body.UNSAFE_small': 'var(--ds-font-body-UNSAFE_small)';
|
|
555
554
|
'font.body.large': 'var(--ds-font-body-large)';
|
|
556
555
|
'font.body.small': 'var(--ds-font-body-small)';
|
|
557
556
|
'font.code': 'var(--ds-font-code)';
|
|
@@ -587,7 +586,7 @@ export type FontFamily = keyof typeof fontFamilyMap;
|
|
|
587
586
|
*/
|
|
588
587
|
/**
|
|
589
588
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
590
|
-
* @codegen <<SignedSource::
|
|
589
|
+
* @codegen <<SignedSource::b67a50fa5abb078032598ba819a6f691>>
|
|
591
590
|
* @codegenId text
|
|
592
591
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
593
592
|
* @codegenDependency ../../../primitives/scripts/codegen-file-templates/dimensions.tsx <<SignedSource::cc9b3f12104c6ede803da6a42daac0b0>>
|
|
@@ -595,7 +594,6 @@ export type FontFamily = keyof typeof fontFamilyMap;
|
|
|
595
594
|
*/
|
|
596
595
|
export declare const textSizeMap: {
|
|
597
596
|
medium: 'var(--ds-font-body)';
|
|
598
|
-
UNSAFE_small: 'var(--ds-font-body-UNSAFE_small)';
|
|
599
597
|
large: 'var(--ds-font-body-large)';
|
|
600
598
|
small: 'var(--ds-font-body-small)';
|
|
601
599
|
};
|
|
@@ -40,6 +40,6 @@ export type GapToken = PositiveSpaceToken;
|
|
|
40
40
|
export type SurfaceColorToken = 'utility.elevation.surface.current' | 'elevation.surface' | 'elevation.surface.overlay' | 'elevation.surface.raised' | 'elevation.surface.sunken';
|
|
41
41
|
export type TextAlign = 'center' | 'end' | 'start';
|
|
42
42
|
export type TextColor = 'color.text' | 'color.text.accent.lime' | 'color.text.accent.lime.bolder' | 'color.text.accent.red' | 'color.text.accent.red.bolder' | 'color.text.accent.orange' | 'color.text.accent.orange.bolder' | 'color.text.accent.yellow' | 'color.text.accent.yellow.bolder' | 'color.text.accent.green' | 'color.text.accent.green.bolder' | 'color.text.accent.teal' | 'color.text.accent.teal.bolder' | 'color.text.accent.blue' | 'color.text.accent.blue.bolder' | 'color.text.accent.purple' | 'color.text.accent.purple.bolder' | 'color.text.accent.magenta' | 'color.text.accent.magenta.bolder' | 'color.text.accent.gray' | 'color.text.accent.gray.bolder' | 'color.text.disabled' | 'color.text.inverse' | 'color.text.selected' | 'color.text.brand' | 'color.text.danger' | 'color.text.warning' | 'color.text.warning.inverse' | 'color.text.success' | 'color.text.discovery' | 'color.text.information' | 'color.text.subtlest' | 'color.text.subtle' | 'color.link' | 'color.link.pressed' | 'color.link.visited' | 'color.link.visited.pressed';
|
|
43
|
-
export type FontSize = 'small' | 'medium' | '
|
|
43
|
+
export type FontSize = 'small' | 'medium' | 'large';
|
|
44
44
|
export type FontWeight = 'bold' | 'medium' | 'regular' | 'semibold';
|
|
45
45
|
export type MetricTextFontSize = 'small' | 'medium' | 'large';
|
|
@@ -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>>>;
|