@atlaskit/primitives 19.0.0 → 19.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -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.compiled.css +1 -1
- package/dist/cjs/compiled/components/box.js +3 -3
- package/dist/cjs/compiled/components/pressable.js +1 -1
- package/dist/cjs/compiled/components/text.js +2 -0
- package/dist/cjs/components/anchor.js +1 -1
- package/dist/cjs/components/box.js +4 -2
- package/dist/cjs/components/pressable.js +1 -1
- package/dist/cjs/responsive/build-media-query-css.js +14 -71
- package/dist/cjs/responsive/constants.js +2 -0
- 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/has-text-ancestor-context.js +1 -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 +27 -7
- package/dist/cjs/xcss/xcss.js +2 -0
- package/dist/es2019/compiled/components/anchor.js +1 -1
- package/dist/es2019/compiled/components/box.compiled.css +1 -1
- package/dist/es2019/compiled/components/box.js +2 -2
- package/dist/es2019/compiled/components/pressable.js +1 -1
- package/dist/es2019/compiled/components/text.js +2 -0
- package/dist/es2019/components/anchor.js +1 -1
- package/dist/es2019/components/box.js +3 -1
- package/dist/es2019/components/pressable.js +1 -1
- package/dist/es2019/responsive/build-media-query-css.js +2 -75
- package/dist/es2019/responsive/constants.js +2 -0
- 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/has-text-ancestor-context.js +1 -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 +27 -7
- package/dist/es2019/xcss/xcss.js +2 -0
- package/dist/esm/compiled/components/anchor.js +1 -1
- package/dist/esm/compiled/components/box.compiled.css +1 -1
- package/dist/esm/compiled/components/box.js +2 -2
- package/dist/esm/compiled/components/pressable.js +1 -1
- package/dist/esm/compiled/components/text.js +2 -0
- package/dist/esm/components/anchor.js +1 -1
- package/dist/esm/components/box.js +3 -1
- package/dist/esm/components/pressable.js +1 -1
- package/dist/esm/responsive/build-media-query-css.js +2 -68
- package/dist/esm/responsive/constants.js +2 -0
- 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/has-text-ancestor-context.js +1 -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 +27 -7
- package/dist/esm/xcss/xcss.js +2 -0
- 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/utils/types.d.ts +1 -1
- package/dist/types/xcss/style-maps.partial.d.ts +26 -6
- 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/utils/types.d.ts +1 -1
- package/dist/types-ts4.5/xcss/style-maps.partial.d.ts +26 -6
- package/package.json +21 -45
- package/primitives.docs.tsx +359 -356
- 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,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';
|
|
@@ -67,10 +67,10 @@ export const allSpaceMap = {
|
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
70
|
-
* @codegen <<SignedSource::
|
|
70
|
+
* @codegen <<SignedSource::5181bd08725ac44b53e0ae9f914067c1>>
|
|
71
71
|
* @codegenId inverse-colors
|
|
72
72
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
73
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::
|
|
73
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::3c254494d015dde7566fc7c46750adf2>>
|
|
74
74
|
*/
|
|
75
75
|
export const inverseColorMap = {
|
|
76
76
|
'color.background.neutral.bold': 'color.text.inverse',
|
|
@@ -108,11 +108,11 @@ export const inverseColorMap = {
|
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
110
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
111
|
-
* @codegen <<SignedSource::
|
|
111
|
+
* @codegen <<SignedSource::54e9dee77c5da7d77db6b6cb20970356>>
|
|
112
112
|
* @codegenId elevation
|
|
113
113
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
114
114
|
* @codegenParams ["opacity", "shadow", "surface"]
|
|
115
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::
|
|
115
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::3c254494d015dde7566fc7c46750adf2>>
|
|
116
116
|
*/
|
|
117
117
|
export const opacityMap = {
|
|
118
118
|
'opacity.disabled': "var(--ds-opacity-disabled, 0.4)",
|
|
@@ -143,24 +143,34 @@ export const surfaceColorMap = {
|
|
|
143
143
|
|
|
144
144
|
/**
|
|
145
145
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
146
|
-
* @codegen <<SignedSource::
|
|
146
|
+
* @codegen <<SignedSource::5fd7f92fbc474ab0beacc4e06dad8fca>>
|
|
147
147
|
* @codegenId colors
|
|
148
148
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
149
149
|
* @codegenParams ["border", "background", "text", "fill"]
|
|
150
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::
|
|
150
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::3c254494d015dde7566fc7c46750adf2>>
|
|
151
151
|
*/
|
|
152
152
|
export const borderColorMap = {
|
|
153
153
|
'color.border': "var(--ds-border, #0B120E24)",
|
|
154
154
|
'color.border.accent.lime': "var(--ds-border-accent-lime, #6A9A23)",
|
|
155
|
+
'color.border.accent.lime.subtle': "var(--ds-border-accent-lime-subtle, #B3DF72)",
|
|
155
156
|
'color.border.accent.red': "var(--ds-border-accent-red, #E2483D)",
|
|
157
|
+
'color.border.accent.red.subtle': "var(--ds-border-accent-red-subtle, #FD9891)",
|
|
156
158
|
'color.border.accent.orange': "var(--ds-border-accent-orange, #E06C00)",
|
|
159
|
+
'color.border.accent.orange.subtle': "var(--ds-border-accent-orange-subtle, #FBC828)",
|
|
157
160
|
'color.border.accent.yellow': "var(--ds-border-accent-yellow, #B38600)",
|
|
161
|
+
'color.border.accent.yellow.subtle': "var(--ds-border-accent-yellow-subtle, #EED12B)",
|
|
158
162
|
'color.border.accent.green': "var(--ds-border-accent-green, #22A06B)",
|
|
163
|
+
'color.border.accent.green.subtle': "var(--ds-border-accent-green-subtle, #7EE2B8)",
|
|
159
164
|
'color.border.accent.teal': "var(--ds-border-accent-teal, #2898BD)",
|
|
165
|
+
'color.border.accent.teal.subtle': "var(--ds-border-accent-teal-subtle, #9DD9EE)",
|
|
160
166
|
'color.border.accent.blue': "var(--ds-border-accent-blue, #357DE8)",
|
|
167
|
+
'color.border.accent.blue.subtle': "var(--ds-border-accent-blue-subtle, #8FB8F6)",
|
|
161
168
|
'color.border.accent.purple': "var(--ds-border-accent-purple, #AF59E1)",
|
|
169
|
+
'color.border.accent.purple.subtle': "var(--ds-border-accent-purple-subtle, #D8A0F7)",
|
|
162
170
|
'color.border.accent.magenta': "var(--ds-border-accent-magenta, #CD519D)",
|
|
171
|
+
'color.border.accent.magenta.subtle': "var(--ds-border-accent-magenta-subtle, #F797D2)",
|
|
163
172
|
'color.border.accent.gray': "var(--ds-border-accent-gray, #7D818A)",
|
|
173
|
+
'color.border.accent.gray.subtle': "var(--ds-border-accent-gray-subtle, #DDDEE1)",
|
|
164
174
|
'color.border.disabled': "var(--ds-border-disabled, #0515240F)",
|
|
165
175
|
'color.border.focused': "var(--ds-border-focused, #4688EC)",
|
|
166
176
|
'color.border.input': "var(--ds-border-input, #8C8F97)",
|
|
@@ -168,10 +178,15 @@ export const borderColorMap = {
|
|
|
168
178
|
'color.border.selected': "var(--ds-border-selected, #1868DB)",
|
|
169
179
|
'color.border.brand': "var(--ds-border-brand, #1868DB)",
|
|
170
180
|
'color.border.danger': "var(--ds-border-danger, #E2483D)",
|
|
181
|
+
'color.border.danger.subtle': "var(--ds-border-danger-subtle, #FD9891)",
|
|
171
182
|
'color.border.warning': "var(--ds-border-warning, #E06C00)",
|
|
183
|
+
'color.border.warning.subtle': "var(--ds-border-warning-subtle, #FBC828)",
|
|
172
184
|
'color.border.success': "var(--ds-border-success, #6A9A23)",
|
|
185
|
+
'color.border.success.subtle': "var(--ds-border-success-subtle, #B3DF72)",
|
|
173
186
|
'color.border.discovery': "var(--ds-border-discovery, #AF59E1)",
|
|
187
|
+
'color.border.discovery.subtle': "var(--ds-border-discovery-subtle, #D8A0F7)",
|
|
174
188
|
'color.border.information': "var(--ds-border-information, #357DE8)",
|
|
189
|
+
'color.border.information.subtle': "var(--ds-border-information-subtle, #8FB8F6)",
|
|
175
190
|
'color.border.bold': "var(--ds-border-bold, #7D818A)"
|
|
176
191
|
};
|
|
177
192
|
export const backgroundColorMap = {
|
|
@@ -295,7 +310,7 @@ export const backgroundColorMap = {
|
|
|
295
310
|
'color.background.accent.gray.bolder': "var(--ds-background-accent-gray-bolder, #6B6E76)",
|
|
296
311
|
'color.background.accent.gray.bolder.hovered': "var(--ds-background-accent-gray-bolder-hovered, #505258)",
|
|
297
312
|
'color.background.accent.gray.bolder.pressed': "var(--ds-background-accent-gray-bolder-pressed, #3B3D42)",
|
|
298
|
-
'color.background.disabled': "var(--ds-background-disabled, #
|
|
313
|
+
'color.background.disabled': "var(--ds-background-disabled, #0515240F)",
|
|
299
314
|
'color.background.input': "var(--ds-background-input, #FFFFFF)",
|
|
300
315
|
'color.background.input.hovered': "var(--ds-background-input-hovered, #F8F8F8)",
|
|
301
316
|
'color.background.input.pressed': "var(--ds-background-input-pressed, #FFFFFF)",
|
|
@@ -332,6 +347,7 @@ export const backgroundColorMap = {
|
|
|
332
347
|
'color.background.danger.subtler': "var(--ds-background-danger-subtler, #FFD5D2)",
|
|
333
348
|
'color.background.danger.subtler.hovered': "var(--ds-background-danger-subtler-hovered, #FFB8B2)",
|
|
334
349
|
'color.background.danger.subtler.pressed': "var(--ds-background-danger-subtler-pressed, #FD9891)",
|
|
350
|
+
'color.background.danger.subtle': "var(--ds-background-danger-subtle, #FD9891)",
|
|
335
351
|
'color.background.danger.bold': "var(--ds-background-danger-bold, #C9372C)",
|
|
336
352
|
'color.background.danger.bold.hovered': "var(--ds-background-danger-bold-hovered, #AE2E24)",
|
|
337
353
|
'color.background.danger.bold.pressed': "var(--ds-background-danger-bold-pressed, #872821)",
|
|
@@ -341,6 +357,7 @@ export const backgroundColorMap = {
|
|
|
341
357
|
'color.background.warning.subtler': "var(--ds-background-warning-subtler, #FCE4A6)",
|
|
342
358
|
'color.background.warning.subtler.hovered': "var(--ds-background-warning-subtler-hovered, #FBD779)",
|
|
343
359
|
'color.background.warning.subtler.pressed': "var(--ds-background-warning-subtler-pressed, #FBC828)",
|
|
360
|
+
'color.background.warning.subtle': "var(--ds-background-warning-subtle, #FBD779)",
|
|
344
361
|
'color.background.warning.bold': "var(--ds-background-warning-bold, #FBC828)",
|
|
345
362
|
'color.background.warning.bold.hovered': "var(--ds-background-warning-bold-hovered, #FCA700)",
|
|
346
363
|
'color.background.warning.bold.pressed': "var(--ds-background-warning-bold-pressed, #F68909)",
|
|
@@ -350,6 +367,7 @@ export const backgroundColorMap = {
|
|
|
350
367
|
'color.background.success.subtler': "var(--ds-background-success-subtler, #D3F1A7)",
|
|
351
368
|
'color.background.success.subtler.hovered': "var(--ds-background-success-subtler-hovered, #BDE97C)",
|
|
352
369
|
'color.background.success.subtler.pressed': "var(--ds-background-success-subtler-pressed, #B3DF72)",
|
|
370
|
+
'color.background.success.subtle': "var(--ds-background-success-subtle, #B3DF72)",
|
|
353
371
|
'color.background.success.bold': "var(--ds-background-success-bold, #5B7F24)",
|
|
354
372
|
'color.background.success.bold.hovered': "var(--ds-background-success-bold-hovered, #4C6B1F)",
|
|
355
373
|
'color.background.success.bold.pressed': "var(--ds-background-success-bold-pressed, #3F5224)",
|
|
@@ -359,6 +377,7 @@ export const backgroundColorMap = {
|
|
|
359
377
|
'color.background.discovery.subtler': "var(--ds-background-discovery-subtler, #EED7FC)",
|
|
360
378
|
'color.background.discovery.subtler.hovered': "var(--ds-background-discovery-subtler-hovered, #E3BDFA)",
|
|
361
379
|
'color.background.discovery.subtler.pressed': "var(--ds-background-discovery-subtler-pressed, #D8A0F7)",
|
|
380
|
+
'color.background.discovery.subtle': "var(--ds-background-discovery-subtle, #D8A0F7)",
|
|
362
381
|
'color.background.discovery.bold': "var(--ds-background-discovery-bold, #964AC0)",
|
|
363
382
|
'color.background.discovery.bold.hovered': "var(--ds-background-discovery-bold-hovered, #803FA5)",
|
|
364
383
|
'color.background.discovery.bold.pressed': "var(--ds-background-discovery-bold-pressed, #673286)",
|
|
@@ -368,6 +387,7 @@ export const backgroundColorMap = {
|
|
|
368
387
|
'color.background.information.subtler': "var(--ds-background-information-subtler, #CFE1FD)",
|
|
369
388
|
'color.background.information.subtler.hovered': "var(--ds-background-information-subtler-hovered, #ADCBFB)",
|
|
370
389
|
'color.background.information.subtler.pressed': "var(--ds-background-information-subtler-pressed, #8FB8F6)",
|
|
390
|
+
'color.background.information.subtle': "var(--ds-background-information-subtle, #8FB8F6)",
|
|
371
391
|
'color.background.information.bold': "var(--ds-background-information-bold, #1868DB)",
|
|
372
392
|
'color.background.information.bold.hovered': "var(--ds-background-information-bold-hovered, #1558BC)",
|
|
373
393
|
'color.background.information.bold.pressed': "var(--ds-background-information-bold-pressed, #144794)",
|
package/dist/es2019/xcss/xcss.js
CHANGED
|
@@ -149,6 +149,7 @@ const baseXcss = style => {
|
|
|
149
149
|
* @private
|
|
150
150
|
* @deprecated
|
|
151
151
|
*/
|
|
152
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
152
153
|
export const parseXcss = args => {
|
|
153
154
|
if (Array.isArray(args)) {
|
|
154
155
|
const emotion = [];
|
|
@@ -210,6 +211,7 @@ export const parseXcss = args => {
|
|
|
210
211
|
* @deprecated Use `@atlaskit/css` with `@atlaskit/primitives/compiled` instead.
|
|
211
212
|
* {@link https://hello.atlassian.net/wiki/spaces/DST/pages/4992259434/Guidance+Migrating+to+atlaskit+css+from+xcss Internal documentation for migration; no external access}
|
|
212
213
|
*/
|
|
214
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
213
215
|
export function xcss(style) {
|
|
214
216
|
return baseXcss(style);
|
|
215
217
|
}
|
|
@@ -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: "19.0.
|
|
64
|
+
packageVersion: "19.0.1",
|
|
65
65
|
analyticsData: analyticsContext,
|
|
66
66
|
actionSubject: 'link'
|
|
67
67
|
});
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
._bfhk16zl{background-color:var(--ds-background-accent-teal-subtle-pressed,#b1e4f7)}
|
|
57
57
|
._bfhk1773{background-color:var(--ds-background-accent-yellow-subtler,#f5e989)}
|
|
58
58
|
._bfhk1856{background-color:var(--ds-background-brand-bold,#1868db)}
|
|
59
|
+
._bfhk187o{background-color:var(--ds-background-disabled,#0515240f)}
|
|
59
60
|
._bfhk18ah{background-color:var(--ds-background-accent-purple-subtle,#c97cf4)}
|
|
60
61
|
._bfhk18j9{background-color:var(--ds-background-accent-gray-subtle,#8c8f97)}
|
|
61
62
|
._bfhk18ut{background-color:var(--ds-background-accent-gray-subtlest-pressed,#b7b9be)}
|
|
@@ -159,7 +160,6 @@
|
|
|
159
160
|
._bfhkattl{background-color:var(--ds-background-accent-purple-subtler-hovered,#e3bdfa)}
|
|
160
161
|
._bfhkaxpp{background-color:var(--ds-background-accent-orange-subtle-pressed,#fbd779)}
|
|
161
162
|
._bfhkbq5w{background-color:var(--ds-background-accent-lime-subtle,#94c748)}
|
|
162
|
-
._bfhkby5v{background-color:var(--ds-background-disabled,#17171708)}
|
|
163
163
|
._bfhkbyip{background-color:var(--ds-background-accent-gray-bolder-hovered,#505258)}
|
|
164
164
|
._bfhkc3uk{background-color:var(--ds-background-accent-magenta-bolder,#ae4787)}
|
|
165
165
|
._bfhkchd4{background-color:var(--ds-elevation-surface-current,#fff)}
|
|
@@ -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
|
|
|
@@ -136,7 +136,7 @@ var backgroundColorMap = {
|
|
|
136
136
|
'color.background.accent.gray.bolder': "_bfhk1i45",
|
|
137
137
|
'color.background.accent.gray.bolder.hovered': "_bfhkbyip",
|
|
138
138
|
'color.background.accent.gray.bolder.pressed': "_bfhk1van",
|
|
139
|
-
'color.background.disabled': "
|
|
139
|
+
'color.background.disabled': "_bfhk187o",
|
|
140
140
|
'color.background.input': "_bfhk1j9a",
|
|
141
141
|
'color.background.input.hovered': "_bfhkl4ek",
|
|
142
142
|
'color.background.input.pressed': "_bfhkr01l",
|
|
@@ -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: "19.0.
|
|
55
|
+
packageVersion: "19.0.1",
|
|
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: "19.0.
|
|
102
|
+
packageVersion: "19.0.1",
|
|
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
|
|
|
@@ -89,6 +89,8 @@ export var Box = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
89
89
|
// @ts-ignore This typescript error has been surpessed while locally enrolling `@atlaskit/primitives` into Jira
|
|
90
90
|
// The return type of `BoxComponent` does not match the return type of `forwardRef` in React 18
|
|
91
91
|
);
|
|
92
|
+
|
|
93
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
92
94
|
export default Box;
|
|
93
95
|
var baseStyles = css({
|
|
94
96
|
boxSizing: 'border-box',
|
|
@@ -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: "19.0.
|
|
94
|
+
packageVersion: "19.0.1",
|
|
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';
|
|
@@ -59,6 +59,7 @@ export var UNSAFE_BREAKPOINTS_CONFIG = {
|
|
|
59
59
|
*
|
|
60
60
|
* @experimental Unsafe for consumption outside of the design system itself.
|
|
61
61
|
*/
|
|
62
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
62
63
|
export var UNSAFE_BREAKPOINTS_ORDERED_LIST = Object.keys(UNSAFE_BREAKPOINTS_CONFIG);
|
|
63
64
|
|
|
64
65
|
/**
|
|
@@ -66,4 +67,5 @@ export var UNSAFE_BREAKPOINTS_ORDERED_LIST = Object.keys(UNSAFE_BREAKPOINTS_CONF
|
|
|
66
67
|
* 1. It is the default value for shorthands, eg. `<GridItem span={6} />` maps to `{ [SMALLEST_BREAKPOINT]: props.span }`
|
|
67
68
|
* 2. It's omitted in `media.below` as there's nothing below `0px`.
|
|
68
69
|
*/
|
|
70
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
69
71
|
export var SMALLEST_BREAKPOINT = UNSAFE_BREAKPOINTS_ORDERED_LIST[0];
|
|
@@ -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';
|
|
@@ -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
|
+
};
|