@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.
Files changed (83) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/codemods/compiled-fork-stage1/transform.tsx +178 -17
  3. package/components/flex/package.json +17 -0
  4. package/constellation/pressable/usage.mdx +2 -0
  5. package/dist/cjs/compiled/components/box.js +2 -2
  6. package/dist/cjs/compiled/components/text.compiled.css +0 -1
  7. package/dist/cjs/compiled/components/text.js +0 -1
  8. package/dist/cjs/components/box.js +2 -2
  9. package/dist/cjs/responsive/build-media-query-css.js +14 -71
  10. package/dist/cjs/responsive/hide.js +4 -3
  11. package/dist/cjs/responsive/media-helper.js +8 -37
  12. package/dist/cjs/responsive/media.js +31 -0
  13. package/dist/cjs/responsive/show.js +4 -3
  14. package/dist/cjs/responsive/unsafe-build-above-media-query-css.js +43 -0
  15. package/dist/cjs/responsive/unsafe-build-below-media-query-css.js +45 -0
  16. package/dist/cjs/utils/surface-context.js +13 -0
  17. package/dist/cjs/utils/surface-provider.js +10 -10
  18. package/dist/cjs/xcss/style-maps.partial.js +2 -5
  19. package/dist/es2019/compiled/components/box.js +1 -1
  20. package/dist/es2019/compiled/components/text.compiled.css +0 -1
  21. package/dist/es2019/compiled/components/text.js +0 -1
  22. package/dist/es2019/components/box.js +1 -1
  23. package/dist/es2019/responsive/build-media-query-css.js +2 -75
  24. package/dist/es2019/responsive/hide.js +2 -1
  25. package/dist/es2019/responsive/media-helper.js +3 -37
  26. package/dist/es2019/responsive/media.js +25 -0
  27. package/dist/es2019/responsive/show.js +2 -1
  28. package/dist/es2019/responsive/unsafe-build-above-media-query-css.js +38 -0
  29. package/dist/es2019/responsive/unsafe-build-below-media-query-css.js +42 -0
  30. package/dist/es2019/utils/surface-context.js +7 -0
  31. package/dist/es2019/utils/surface-provider.js +4 -9
  32. package/dist/es2019/xcss/style-maps.partial.js +2 -5
  33. package/dist/esm/compiled/components/box.js +1 -1
  34. package/dist/esm/compiled/components/text.compiled.css +0 -1
  35. package/dist/esm/compiled/components/text.js +0 -1
  36. package/dist/esm/components/box.js +1 -1
  37. package/dist/esm/responsive/build-media-query-css.js +2 -68
  38. package/dist/esm/responsive/hide.js +2 -1
  39. package/dist/esm/responsive/media-helper.js +3 -37
  40. package/dist/esm/responsive/media.js +25 -0
  41. package/dist/esm/responsive/show.js +2 -1
  42. package/dist/esm/responsive/unsafe-build-above-media-query-css.js +37 -0
  43. package/dist/esm/responsive/unsafe-build-below-media-query-css.js +39 -0
  44. package/dist/esm/utils/surface-context.js +7 -0
  45. package/dist/esm/utils/surface-provider.js +4 -9
  46. package/dist/esm/xcss/style-maps.partial.js +2 -5
  47. package/dist/types/compiled/components/types.d.ts +1 -1
  48. package/dist/types/responsive/build-media-query-css.d.ts +2 -63
  49. package/dist/types/responsive/media-helper.d.ts +1 -35
  50. package/dist/types/responsive/media.d.ts +25 -0
  51. package/dist/types/responsive/types.d.ts +1 -1
  52. package/dist/types/responsive/unsafe-build-above-media-query-css.d.ts +33 -0
  53. package/dist/types/responsive/unsafe-build-below-media-query-css.d.ts +32 -0
  54. package/dist/types/utils/surface-context.d.ts +8 -0
  55. package/dist/types/utils/surface-provider.d.ts +1 -7
  56. package/dist/types/xcss/style-maps.partial.d.ts +2 -4
  57. package/dist/types-ts4.5/compiled/components/types.d.ts +1 -1
  58. package/dist/types-ts4.5/responsive/build-media-query-css.d.ts +2 -63
  59. package/dist/types-ts4.5/responsive/media-helper.d.ts +1 -35
  60. package/dist/types-ts4.5/responsive/media.d.ts +25 -0
  61. package/dist/types-ts4.5/responsive/types.d.ts +1 -1
  62. package/dist/types-ts4.5/responsive/unsafe-build-above-media-query-css.d.ts +33 -0
  63. package/dist/types-ts4.5/responsive/unsafe-build-below-media-query-css.d.ts +32 -0
  64. package/dist/types-ts4.5/utils/surface-context.d.ts +8 -0
  65. package/dist/types-ts4.5/utils/surface-provider.d.ts +1 -7
  66. package/dist/types-ts4.5/xcss/style-maps.partial.d.ts +2 -4
  67. package/package.json +17 -17
  68. package/scripts/capitalize.tsx +2 -0
  69. package/scripts/color-codegen-template.tsx +3 -6
  70. package/scripts/compose.tsx +4 -0
  71. package/scripts/elevation-codegen-template.tsx +3 -6
  72. package/scripts/generate-type-defs.tsx +12 -0
  73. package/scripts/inverse-color-map-template.tsx +4 -1
  74. package/scripts/is-accent.tsx +1 -0
  75. package/scripts/is-hovered.tsx +1 -0
  76. package/scripts/is-pressed.tsx +1 -0
  77. package/scripts/pick.tsx +4 -0
  78. package/scripts/shape-codegen-template.tsx +3 -1
  79. package/scripts/spacing-codegen-template.tsx +2 -1
  80. package/scripts/text-codegen-template.tsx +3 -2
  81. package/scripts/typography-codegen-template.tsx +3 -1
  82. package/scripts/utils.tsx +7 -25
  83. package/offerings.json +0 -298
@@ -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.useSurface = exports.SurfaceContext = void 0;
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';
@@ -521,7 +521,7 @@ var borderRadiusMap = exports.borderRadiusMap = {
521
521
 
522
522
  /**
523
523
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
524
- * @codegen <<SignedSource::64331f0b8b5e2f090a3aad153d92deb6>>
524
+ * @codegen <<SignedSource::6dffa08c1104af4093361cb0f7e37996>>
525
525
  * @codegenId typography
526
526
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
527
527
  * @codegenParams ["fontSize", "fontWeight", "fontFamily", "lineHeight", "body", "ui"]
@@ -530,8 +530,6 @@ var borderRadiusMap = exports.borderRadiusMap = {
530
530
  */
531
531
  var fontMap = exports.fontMap = {
532
532
  '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)",
533
- // @deprecated
534
- '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)",
535
533
  '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)",
536
534
  '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)",
537
535
  'font.code': "var(--ds-font-code, normal 400 0.875em/1 \"Atlassian Mono\", ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)",
@@ -565,7 +563,7 @@ var fontFamilyMap = exports.fontFamilyMap = {
565
563
 
566
564
  /**
567
565
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
568
- * @codegen <<SignedSource::aeebc24b95e2189021f1d98f1715a6a0>>
566
+ * @codegen <<SignedSource::b67a50fa5abb078032598ba819a6f691>>
569
567
  * @codegenId text
570
568
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
571
569
  * @codegenDependency ../../../primitives/scripts/codegen-file-templates/dimensions.tsx <<SignedSource::cc9b3f12104c6ede803da6a42daac0b0>>
@@ -573,7 +571,6 @@ var fontFamilyMap = exports.fontFamilyMap = {
573
571
  */
574
572
  var textSizeMap = exports.textSizeMap = {
575
573
  medium: "var(--ds-font-body, normal 400 14px/20px \"Atlassian Sans\", ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
576
- 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)",
577
574
  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)",
578
575
  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)"
579
576
  };
@@ -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-provider';
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
 
@@ -1,6 +1,5 @@
1
1
  ._11c81d4k{font:var(--ds-font-body-large,normal 400 1pc/24px "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
2
2
  ._11c8fhey{font:var(--ds-font-body,normal 400 14px/20px "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
3
- ._11c8rymc{font:var(--ds-font-body-UNSAFE_small,normal 400 9pt/1pc "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
4
3
  ._11c8wadc{font:var(--ds-font-body-small,normal 400 9pt/1pc "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
5
4
  ._18m915vq{overflow-y:hidden}
6
5
  ._18u0idpf{margin-left:0}
@@ -38,7 +38,6 @@ const styles = {
38
38
  };
39
39
  const fontSizeMap = {
40
40
  medium: "_11c8fhey",
41
- UNSAFE_small: "_11c8rymc",
42
41
  large: "_11c81d4k",
43
42
  small: "_11c8wadc"
44
43
  };
@@ -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-provider';
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
 
@@ -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
- * Build a map of breakpoints to css with media queries and nested styles.
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, UNSAFE_buildBelowMediaQueryCSS } from './build-media-query-css';
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, UNSAFE_buildBelowMediaQueryCSS } from './build-media-query-css';
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
+ };
@@ -0,0 +1,7 @@
1
+ import { createContext } from 'react';
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');
@@ -1,11 +1,5 @@
1
- import { createContext, useContext } from 'react';
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';
@@ -515,7 +515,7 @@ export const borderRadiusMap = {
515
515
 
516
516
  /**
517
517
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
518
- * @codegen <<SignedSource::64331f0b8b5e2f090a3aad153d92deb6>>
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 const borderRadiusMap = {
524
524
  */
525
525
  export const 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 const fontFamilyMap = {
559
557
 
560
558
  /**
561
559
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
562
- * @codegen <<SignedSource::aeebc24b95e2189021f1d98f1715a6a0>>
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 const fontFamilyMap = {
567
565
  */
568
566
  export const 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
  };
@@ -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-provider';
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
 
@@ -1,6 +1,5 @@
1
1
  ._11c81d4k{font:var(--ds-font-body-large,normal 400 1pc/24px "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
2
2
  ._11c8fhey{font:var(--ds-font-body,normal 400 14px/20px "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
3
- ._11c8rymc{font:var(--ds-font-body-UNSAFE_small,normal 400 9pt/1pc "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
4
3
  ._11c8wadc{font:var(--ds-font-body-small,normal 400 9pt/1pc "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
5
4
  ._18m915vq{overflow-y:hidden}
6
5
  ._18u0idpf{margin-left:0}
@@ -38,7 +38,6 @@ var styles = {
38
38
  };
39
39
  var fontSizeMap = {
40
40
  medium: "_11c8fhey",
41
- UNSAFE_small: "_11c8rymc",
42
41
  large: "_11c81d4k",
43
42
  small: "_11c8wadc"
44
43
  };
@@ -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-provider';
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
 
@@ -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
- * Build a map of breakpoints to css with media queries and nested styles.
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, UNSAFE_buildBelowMediaQueryCSS } from './build-media-query-css';
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
+ };