@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,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.UNSAFE_buildBelowMediaQueryCSS = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _react = require("@emotion/react");
|
|
10
|
+
var _constants = require("./constants");
|
|
11
|
+
var _mediaHelper = require("./media-helper");
|
|
12
|
+
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; }
|
|
13
|
+
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) { (0, _defineProperty2.default)(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; } // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
|
|
14
|
+
/**
|
|
15
|
+
* Build a map of breakpoints to css with media queries and nested styles.
|
|
16
|
+
*
|
|
17
|
+
* @internal Not intended to be used outside of DST at this stage.
|
|
18
|
+
* @experimental Not intended to be used outside of DST at this stage.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* A map to build optional `display:none` for consumption on a div.
|
|
22
|
+
* ```ts
|
|
23
|
+
* const hideMediaQueries = buildBelowMediaQueryCSS({ display: 'none' });
|
|
24
|
+
*
|
|
25
|
+
* const Component = ({ hideAtBreakpoints: ('xs' | 'sm')[], children: ReactNode }) => {
|
|
26
|
+
* return <div css={hideAtBreakpoints.map(b => hideMediaQueries[b])}>{children}</div>;
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* This roughly builds a map that will look roughly like this (if done manually):
|
|
31
|
+
* ```ts
|
|
32
|
+
* {
|
|
33
|
+
* xs: css({ '@media not all and (min-width: 30rem)': { display: 'none' } }),
|
|
34
|
+
* sm: css({ '@media not all and (min-width: 48rem)': { display: 'none' } }),
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
var UNSAFE_buildBelowMediaQueryCSS = exports.UNSAFE_buildBelowMediaQueryCSS = function UNSAFE_buildBelowMediaQueryCSS(input) {
|
|
39
|
+
return _constants.UNSAFE_BREAKPOINTS_ORDERED_LIST.reduce(function (acc, breakpoint) {
|
|
40
|
+
if (breakpoint === 'xxs') {
|
|
41
|
+
return acc;
|
|
42
|
+
}
|
|
43
|
+
return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2.default)({}, breakpoint, (0, _react.css)((0, _defineProperty2.default)({}, _mediaHelper.UNSAFE_media.below[breakpoint], typeof input === 'function' ? input(breakpoint) : input))));
|
|
44
|
+
}, {});
|
|
45
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SurfaceContext = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
/**
|
|
9
|
+
* __Surface context__
|
|
10
|
+
*
|
|
11
|
+
* A surface context provides context information on the current background (if set).
|
|
12
|
+
*/
|
|
13
|
+
var SurfaceContext = exports.SurfaceContext = /*#__PURE__*/(0, _react.createContext)('elevation.surface');
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
Object.defineProperty(exports, "SurfaceContext", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _surfaceContext.SurfaceContext;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
exports.useSurface = void 0;
|
|
7
13
|
var _react = require("react");
|
|
8
|
-
|
|
9
|
-
* __Surface context__
|
|
10
|
-
*
|
|
11
|
-
* A surface context provides context information on the current background (if set).
|
|
12
|
-
*/
|
|
13
|
-
var SurfaceContext = exports.SurfaceContext = /*#__PURE__*/(0, _react.createContext)('elevation.surface');
|
|
14
|
-
|
|
14
|
+
var _surfaceContext = require("./surface-context");
|
|
15
15
|
/**
|
|
16
16
|
* __useSurface__
|
|
17
17
|
*
|
|
@@ -20,6 +20,6 @@ var SurfaceContext = exports.SurfaceContext = /*#__PURE__*/(0, _react.createCont
|
|
|
20
20
|
* @see SurfaceContext
|
|
21
21
|
*/
|
|
22
22
|
var useSurface = exports.useSurface = function useSurface() {
|
|
23
|
-
return (0, _react.useContext)(SurfaceContext);
|
|
23
|
+
return (0, _react.useContext)(_surfaceContext.SurfaceContext);
|
|
24
24
|
};
|
|
25
|
-
SurfaceContext.displayName = 'SurfaceProvider';
|
|
25
|
+
_surfaceContext.SurfaceContext.displayName = 'SurfaceProvider';
|
|
@@ -56,7 +56,7 @@ const AnchorNoRef = ({
|
|
|
56
56
|
action: 'clicked',
|
|
57
57
|
componentName: componentName || 'Anchor',
|
|
58
58
|
packageName: "@atlaskit/primitives",
|
|
59
|
-
packageVersion: "
|
|
59
|
+
packageVersion: "0.0.0-development",
|
|
60
60
|
analyticsData: analyticsContext,
|
|
61
61
|
actionSubject: 'link'
|
|
62
62
|
});
|
|
@@ -4,7 +4,7 @@ import "./box.compiled.css";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
6
|
import { forwardRef } from 'react';
|
|
7
|
-
import { SurfaceContext } from '../../utils/surface-
|
|
7
|
+
import { SurfaceContext } from '../../utils/surface-context';
|
|
8
8
|
|
|
9
9
|
// Can either Exclude or Extract - here we're excluding all SVG-related elements, <button> elements (handled by Pressable), and <a> elements (handled by Anchor)
|
|
10
10
|
|
|
@@ -48,7 +48,7 @@ const Pressable = /*#__PURE__*/forwardRef(({
|
|
|
48
48
|
action: 'clicked',
|
|
49
49
|
componentName: componentName || 'Pressable',
|
|
50
50
|
packageName: "@atlaskit/primitives",
|
|
51
|
-
packageVersion: "
|
|
51
|
+
packageVersion: "0.0.0-development",
|
|
52
52
|
analyticsData: analyticsContext,
|
|
53
53
|
actionSubject: 'button'
|
|
54
54
|
});
|
|
@@ -94,7 +94,7 @@ const AnchorNoRef = ({
|
|
|
94
94
|
action: 'clicked',
|
|
95
95
|
componentName: componentName || 'Anchor',
|
|
96
96
|
packageName: "@atlaskit/primitives",
|
|
97
|
-
packageVersion: "
|
|
97
|
+
packageVersion: "0.0.0-development",
|
|
98
98
|
analyticsData: analyticsContext,
|
|
99
99
|
actionSubject: 'link'
|
|
100
100
|
});
|
|
@@ -7,7 +7,7 @@ import { forwardRef } from 'react';
|
|
|
7
7
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
|
-
import { SurfaceContext } from '../utils/surface-
|
|
10
|
+
import { SurfaceContext } from '../utils/surface-context';
|
|
11
11
|
import { backgroundColorStylesMap, isSurfaceColorToken, paddingStylesMap, surfaceColorStylesMap } from '../xcss/style-maps.partial';
|
|
12
12
|
import { parseXcss } from '../xcss/xcss';
|
|
13
13
|
|
|
@@ -86,7 +86,7 @@ const Pressable = /*#__PURE__*/forwardRef(({
|
|
|
86
86
|
action: 'clicked',
|
|
87
87
|
componentName: componentName || 'Pressable',
|
|
88
88
|
packageName: "@atlaskit/primitives",
|
|
89
|
-
packageVersion: "
|
|
89
|
+
packageVersion: "0.0.0-development",
|
|
90
90
|
analyticsData: analyticsContext,
|
|
91
91
|
actionSubject: 'button'
|
|
92
92
|
});
|
|
@@ -1,77 +1,4 @@
|
|
|
1
1
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
2
|
-
import { css } from '@emotion/react';
|
|
3
|
-
import { UNSAFE_BREAKPOINTS_ORDERED_LIST } from './constants';
|
|
4
|
-
import { media, UNSAFE_media } from './media-helper';
|
|
5
|
-
/**
|
|
6
|
-
* Build a map of breakpoints to css with media queries and nested styles.
|
|
7
|
-
*
|
|
8
|
-
* @internal Not intended to be used outside of DST at this stage.
|
|
9
|
-
* @experimental Not intended to be used outside of DST at this stage.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* A map to build optional `display:none` for consumption on a div.
|
|
13
|
-
* ```ts
|
|
14
|
-
* const hideMediaQueries = buildAboveMediaQueryCSS({ display: 'none' });
|
|
15
|
-
*
|
|
16
|
-
* const Component = ({ hideAtBreakpoints: ('xs' | 'sm')[], children: ReactNode }) => {
|
|
17
|
-
* return <div css={hideAtBreakpoints.map(b => hideMediaQueries[b])}>{children}</div>;
|
|
18
|
-
* }
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* This roughly builds a map that will look roughly like this (if done manually):
|
|
22
|
-
* ```ts
|
|
23
|
-
* {
|
|
24
|
-
* xxs: css({ '@media all': { display: 'none' } }),
|
|
25
|
-
* xs: css({ '@media (min-width: 30rem)': { display: 'none' } }),
|
|
26
|
-
* sm: css({ '@media (min-width: 48rem)': { display: 'none' } }),
|
|
27
|
-
* }
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
export const UNSAFE_buildAboveMediaQueryCSS = input => {
|
|
31
|
-
return UNSAFE_BREAKPOINTS_ORDERED_LIST.reduce((acc, breakpoint) => ({
|
|
32
|
-
...acc,
|
|
33
|
-
[breakpoint]: css({
|
|
34
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
35
|
-
[media.above[breakpoint]]: typeof input === 'function' ? input(breakpoint) : input
|
|
36
|
-
})
|
|
37
|
-
}), {});
|
|
38
|
-
};
|
|
39
2
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
*
|
|
43
|
-
* @internal Not intended to be used outside of DST at this stage.
|
|
44
|
-
* @experimental Not intended to be used outside of DST at this stage.
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* A map to build optional `display:none` for consumption on a div.
|
|
48
|
-
* ```ts
|
|
49
|
-
* const hideMediaQueries = buildBelowMediaQueryCSS({ display: 'none' });
|
|
50
|
-
*
|
|
51
|
-
* const Component = ({ hideAtBreakpoints: ('xs' | 'sm')[], children: ReactNode }) => {
|
|
52
|
-
* return <div css={hideAtBreakpoints.map(b => hideMediaQueries[b])}>{children}</div>;
|
|
53
|
-
* }
|
|
54
|
-
* ```
|
|
55
|
-
*
|
|
56
|
-
* This roughly builds a map that will look roughly like this (if done manually):
|
|
57
|
-
* ```ts
|
|
58
|
-
* {
|
|
59
|
-
* xs: css({ '@media not all and (min-width: 30rem)': { display: 'none' } }),
|
|
60
|
-
* sm: css({ '@media not all and (min-width: 48rem)': { display: 'none' } }),
|
|
61
|
-
* }
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
export const UNSAFE_buildBelowMediaQueryCSS = input => {
|
|
65
|
-
return UNSAFE_BREAKPOINTS_ORDERED_LIST.reduce((acc, breakpoint) => {
|
|
66
|
-
if (breakpoint === 'xxs') {
|
|
67
|
-
return acc;
|
|
68
|
-
}
|
|
69
|
-
return {
|
|
70
|
-
...acc,
|
|
71
|
-
[breakpoint]: css({
|
|
72
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
73
|
-
[UNSAFE_media.below[breakpoint]]: typeof input === 'function' ? input(breakpoint) : input
|
|
74
|
-
})
|
|
75
|
-
};
|
|
76
|
-
}, {});
|
|
77
|
-
};
|
|
3
|
+
export { UNSAFE_buildAboveMediaQueryCSS } from './unsafe-build-above-media-query-css';
|
|
4
|
+
export { UNSAFE_buildBelowMediaQueryCSS } from './unsafe-build-below-media-query-css';
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
7
7
|
import { jsx } from '@emotion/react';
|
|
8
8
|
import { parseXcss } from '../xcss/xcss';
|
|
9
|
-
import { UNSAFE_buildAboveMediaQueryCSS
|
|
9
|
+
import { UNSAFE_buildAboveMediaQueryCSS } from './unsafe-build-above-media-query-css';
|
|
10
|
+
import { UNSAFE_buildBelowMediaQueryCSS } from './unsafe-build-below-media-query-css';
|
|
10
11
|
const hideAboveQueries = UNSAFE_buildAboveMediaQueryCSS({
|
|
11
12
|
display: 'none'
|
|
12
13
|
});
|
|
@@ -1,40 +1,6 @@
|
|
|
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 const media = {
|
|
12
|
-
above: {
|
|
13
|
-
xxs: '@media all',
|
|
14
|
-
xs: '@media (min-width: 30rem)',
|
|
15
|
-
sm: '@media (min-width: 48rem)',
|
|
16
|
-
md: '@media (min-width: 64rem)',
|
|
17
|
-
lg: '@media (min-width: 90rem)',
|
|
18
|
-
xl: '@media (min-width: 110.5rem)'
|
|
19
|
-
},
|
|
20
|
-
only: {
|
|
21
|
-
xxs: '@media (min-width: 0rem) and (max-width: 29.99rem)',
|
|
22
|
-
xs: '@media (min-width: 30rem) and (max-width: 47.99rem)',
|
|
23
|
-
sm: '@media (min-width: 48rem) and (max-width: 63.99rem)',
|
|
24
|
-
md: '@media (min-width: 64rem) and (max-width: 89.99rem)',
|
|
25
|
-
lg: '@media (min-width: 90rem) and (max-width: 110.49rem)',
|
|
26
|
-
xl: '@media (min-width: 110.5rem)'
|
|
27
|
-
},
|
|
28
|
-
below: {
|
|
29
|
-
xs: '@media not all and (min-width: 30rem)',
|
|
30
|
-
sm: '@media not all and (min-width: 48rem)',
|
|
31
|
-
md: '@media not all and (min-width: 64rem)',
|
|
32
|
-
lg: '@media not all and (min-width: 90rem)',
|
|
33
|
-
xl: '@media not all and (min-width: 110.5rem)'
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
|
|
1
|
+
import { media } from './media';
|
|
37
2
|
/**
|
|
38
3
|
* Keep `UNSAFE_media` for backwards compatibility.
|
|
39
4
|
*/
|
|
40
|
-
export const UNSAFE_media = media;
|
|
5
|
+
export const UNSAFE_media = media;
|
|
6
|
+
export { media } from './media';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const 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
|
+
};
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
7
|
import { css, jsx } from '@emotion/react';
|
|
8
8
|
import { parseXcss } from '../xcss/xcss';
|
|
9
|
-
import { UNSAFE_buildAboveMediaQueryCSS
|
|
9
|
+
import { UNSAFE_buildAboveMediaQueryCSS } from './unsafe-build-above-media-query-css';
|
|
10
|
+
import { UNSAFE_buildBelowMediaQueryCSS } from './unsafe-build-below-media-query-css';
|
|
10
11
|
const showAboveQueries = UNSAFE_buildAboveMediaQueryCSS({
|
|
11
12
|
display: 'revert'
|
|
12
13
|
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
|
|
2
|
+
import { css } from '@emotion/react';
|
|
3
|
+
import { UNSAFE_BREAKPOINTS_ORDERED_LIST } from './constants';
|
|
4
|
+
import { media } from './media';
|
|
5
|
+
/**
|
|
6
|
+
* Build a map of breakpoints to css with media queries and nested styles.
|
|
7
|
+
*
|
|
8
|
+
* @internal Not intended to be used outside of DST at this stage.
|
|
9
|
+
* @experimental Not intended to be used outside of DST at this stage.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* A map to build optional `display:none` for consumption on a div.
|
|
13
|
+
* ```ts
|
|
14
|
+
* const hideMediaQueries = buildAboveMediaQueryCSS({ display: 'none' });
|
|
15
|
+
*
|
|
16
|
+
* const Component = ({ hideAtBreakpoints: ('xs' | 'sm')[], children: ReactNode }) => {
|
|
17
|
+
* return <div css={hideAtBreakpoints.map(b => hideMediaQueries[b])}>{children}</div>;
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* This roughly builds a map that will look roughly like this (if done manually):
|
|
22
|
+
* ```ts
|
|
23
|
+
* {
|
|
24
|
+
* xxs: css({ '@media all': { display: 'none' } }),
|
|
25
|
+
* xs: css({ '@media (min-width: 30rem)': { display: 'none' } }),
|
|
26
|
+
* sm: css({ '@media (min-width: 48rem)': { display: 'none' } }),
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export const UNSAFE_buildAboveMediaQueryCSS = input => {
|
|
31
|
+
return UNSAFE_BREAKPOINTS_ORDERED_LIST.reduce((acc, breakpoint) => ({
|
|
32
|
+
...acc,
|
|
33
|
+
[breakpoint]: css({
|
|
34
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
35
|
+
[media.above[breakpoint]]: typeof input === 'function' ? input(breakpoint) : input
|
|
36
|
+
})
|
|
37
|
+
}), {});
|
|
38
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
|
|
2
|
+
import { css } from '@emotion/react';
|
|
3
|
+
import { UNSAFE_BREAKPOINTS_ORDERED_LIST } from './constants';
|
|
4
|
+
import { UNSAFE_media } from './media-helper';
|
|
5
|
+
/**
|
|
6
|
+
* Build a map of breakpoints to css with media queries and nested styles.
|
|
7
|
+
*
|
|
8
|
+
* @internal Not intended to be used outside of DST at this stage.
|
|
9
|
+
* @experimental Not intended to be used outside of DST at this stage.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* A map to build optional `display:none` for consumption on a div.
|
|
13
|
+
* ```ts
|
|
14
|
+
* const hideMediaQueries = buildBelowMediaQueryCSS({ display: 'none' });
|
|
15
|
+
*
|
|
16
|
+
* const Component = ({ hideAtBreakpoints: ('xs' | 'sm')[], children: ReactNode }) => {
|
|
17
|
+
* return <div css={hideAtBreakpoints.map(b => hideMediaQueries[b])}>{children}</div>;
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* This roughly builds a map that will look roughly like this (if done manually):
|
|
22
|
+
* ```ts
|
|
23
|
+
* {
|
|
24
|
+
* xs: css({ '@media not all and (min-width: 30rem)': { display: 'none' } }),
|
|
25
|
+
* sm: css({ '@media not all and (min-width: 48rem)': { display: 'none' } }),
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export const UNSAFE_buildBelowMediaQueryCSS = input => {
|
|
30
|
+
return UNSAFE_BREAKPOINTS_ORDERED_LIST.reduce((acc, breakpoint) => {
|
|
31
|
+
if (breakpoint === 'xxs') {
|
|
32
|
+
return acc;
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
...acc,
|
|
36
|
+
[breakpoint]: css({
|
|
37
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
38
|
+
[UNSAFE_media.below[breakpoint]]: typeof input === 'function' ? input(breakpoint) : input
|
|
39
|
+
})
|
|
40
|
+
};
|
|
41
|
+
}, {});
|
|
42
|
+
};
|
|
@@ -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 const 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 const SurfaceContext = /*#__PURE__*/createContext('elevation.surface');
|
|
|
16
10
|
export const useSurface = () => {
|
|
17
11
|
return useContext(SurfaceContext);
|
|
18
12
|
};
|
|
19
|
-
SurfaceContext.displayName = 'SurfaceProvider';
|
|
13
|
+
SurfaceContext.displayName = 'SurfaceProvider';
|
|
14
|
+
export { SurfaceContext } from './surface-context';
|
|
@@ -61,7 +61,7 @@ var AnchorNoRef = function AnchorNoRef(_ref, ref) {
|
|
|
61
61
|
action: 'clicked',
|
|
62
62
|
componentName: componentName || 'Anchor',
|
|
63
63
|
packageName: "@atlaskit/primitives",
|
|
64
|
-
packageVersion: "
|
|
64
|
+
packageVersion: "0.0.0-development",
|
|
65
65
|
analyticsData: analyticsContext,
|
|
66
66
|
actionSubject: 'link'
|
|
67
67
|
});
|
|
@@ -7,7 +7,7 @@ import "./box.compiled.css";
|
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import { ax, ix } from "@compiled/react/runtime";
|
|
9
9
|
import { forwardRef } from 'react';
|
|
10
|
-
import { SurfaceContext } from '../../utils/surface-
|
|
10
|
+
import { SurfaceContext } from '../../utils/surface-context';
|
|
11
11
|
|
|
12
12
|
// Can either Exclude or Extract - here we're excluding all SVG-related elements, <button> elements (handled by Pressable), and <a> elements (handled by Anchor)
|
|
13
13
|
|
|
@@ -52,7 +52,7 @@ var Pressable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
52
52
|
action: 'clicked',
|
|
53
53
|
componentName: componentName || 'Pressable',
|
|
54
54
|
packageName: "@atlaskit/primitives",
|
|
55
|
-
packageVersion: "
|
|
55
|
+
packageVersion: "0.0.0-development",
|
|
56
56
|
analyticsData: analyticsContext,
|
|
57
57
|
actionSubject: 'button'
|
|
58
58
|
});
|
|
@@ -99,7 +99,7 @@ var AnchorNoRef = function AnchorNoRef(_ref, ref) {
|
|
|
99
99
|
action: 'clicked',
|
|
100
100
|
componentName: componentName || 'Anchor',
|
|
101
101
|
packageName: "@atlaskit/primitives",
|
|
102
|
-
packageVersion: "
|
|
102
|
+
packageVersion: "0.0.0-development",
|
|
103
103
|
analyticsData: analyticsContext,
|
|
104
104
|
actionSubject: 'link'
|
|
105
105
|
});
|
|
@@ -10,7 +10,7 @@ import { forwardRef } from 'react';
|
|
|
10
10
|
|
|
11
11
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
12
12
|
import { css, jsx } from '@emotion/react';
|
|
13
|
-
import { SurfaceContext } from '../utils/surface-
|
|
13
|
+
import { SurfaceContext } from '../utils/surface-context';
|
|
14
14
|
import { backgroundColorStylesMap, isSurfaceColorToken, paddingStylesMap, surfaceColorStylesMap } from '../xcss/style-maps.partial';
|
|
15
15
|
import { parseXcss } from '../xcss/xcss';
|
|
16
16
|
|
|
@@ -91,7 +91,7 @@ var Pressable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
91
91
|
action: 'clicked',
|
|
92
92
|
componentName: componentName || 'Pressable',
|
|
93
93
|
packageName: "@atlaskit/primitives",
|
|
94
|
-
packageVersion: "
|
|
94
|
+
packageVersion: "0.0.0-development",
|
|
95
95
|
analyticsData: analyticsContext,
|
|
96
96
|
actionSubject: 'button'
|
|
97
97
|
});
|
|
@@ -1,70 +1,4 @@
|
|
|
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
1
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
5
|
-
import { css } from '@emotion/react';
|
|
6
|
-
import { UNSAFE_BREAKPOINTS_ORDERED_LIST } from './constants';
|
|
7
|
-
import { media, 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 = 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
|
-
};
|
|
38
2
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
*
|
|
42
|
-
* @internal Not intended to be used outside of DST at this stage.
|
|
43
|
-
* @experimental Not intended to be used outside of DST at this stage.
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* A map to build optional `display:none` for consumption on a div.
|
|
47
|
-
* ```ts
|
|
48
|
-
* const hideMediaQueries = buildBelowMediaQueryCSS({ display: 'none' });
|
|
49
|
-
*
|
|
50
|
-
* const Component = ({ hideAtBreakpoints: ('xs' | 'sm')[], children: ReactNode }) => {
|
|
51
|
-
* return <div css={hideAtBreakpoints.map(b => hideMediaQueries[b])}>{children}</div>;
|
|
52
|
-
* }
|
|
53
|
-
* ```
|
|
54
|
-
*
|
|
55
|
-
* This roughly builds a map that will look roughly like this (if done manually):
|
|
56
|
-
* ```ts
|
|
57
|
-
* {
|
|
58
|
-
* xs: css({ '@media not all and (min-width: 30rem)': { display: 'none' } }),
|
|
59
|
-
* sm: css({ '@media not all and (min-width: 48rem)': { display: 'none' } }),
|
|
60
|
-
* }
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
63
|
-
export var UNSAFE_buildBelowMediaQueryCSS = function UNSAFE_buildBelowMediaQueryCSS(input) {
|
|
64
|
-
return UNSAFE_BREAKPOINTS_ORDERED_LIST.reduce(function (acc, breakpoint) {
|
|
65
|
-
if (breakpoint === 'xxs') {
|
|
66
|
-
return acc;
|
|
67
|
-
}
|
|
68
|
-
return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, breakpoint, css(_defineProperty({}, UNSAFE_media.below[breakpoint], typeof input === 'function' ? input(breakpoint) : input))));
|
|
69
|
-
}, {});
|
|
70
|
-
};
|
|
3
|
+
export { UNSAFE_buildAboveMediaQueryCSS } from './unsafe-build-above-media-query-css';
|
|
4
|
+
export { UNSAFE_buildBelowMediaQueryCSS } from './unsafe-build-below-media-query-css';
|
|
@@ -7,7 +7,8 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
8
8
|
import { 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 hideAboveQueries = UNSAFE_buildAboveMediaQueryCSS({
|
|
12
13
|
display: 'none'
|
|
13
14
|
});
|
|
@@ -1,40 +1,6 @@
|
|
|
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 var media = {
|
|
12
|
-
above: {
|
|
13
|
-
xxs: '@media all',
|
|
14
|
-
xs: '@media (min-width: 30rem)',
|
|
15
|
-
sm: '@media (min-width: 48rem)',
|
|
16
|
-
md: '@media (min-width: 64rem)',
|
|
17
|
-
lg: '@media (min-width: 90rem)',
|
|
18
|
-
xl: '@media (min-width: 110.5rem)'
|
|
19
|
-
},
|
|
20
|
-
only: {
|
|
21
|
-
xxs: '@media (min-width: 0rem) and (max-width: 29.99rem)',
|
|
22
|
-
xs: '@media (min-width: 30rem) and (max-width: 47.99rem)',
|
|
23
|
-
sm: '@media (min-width: 48rem) and (max-width: 63.99rem)',
|
|
24
|
-
md: '@media (min-width: 64rem) and (max-width: 89.99rem)',
|
|
25
|
-
lg: '@media (min-width: 90rem) and (max-width: 110.49rem)',
|
|
26
|
-
xl: '@media (min-width: 110.5rem)'
|
|
27
|
-
},
|
|
28
|
-
below: {
|
|
29
|
-
xs: '@media not all and (min-width: 30rem)',
|
|
30
|
-
sm: '@media not all and (min-width: 48rem)',
|
|
31
|
-
md: '@media not all and (min-width: 64rem)',
|
|
32
|
-
lg: '@media not all and (min-width: 90rem)',
|
|
33
|
-
xl: '@media not all and (min-width: 110.5rem)'
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
|
|
1
|
+
import { media } from './media';
|
|
37
2
|
/**
|
|
38
3
|
* Keep `UNSAFE_media` for backwards compatibility.
|
|
39
4
|
*/
|
|
40
|
-
export var UNSAFE_media = media;
|
|
5
|
+
export var UNSAFE_media = media;
|
|
6
|
+
export { media } from './media';
|