@atlaskit/primitives 0.2.1 → 0.3.0

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 (56) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/components/inline.partial.js +46 -22
  3. package/dist/cjs/components/internal/base-box.partial.js +99 -78
  4. package/dist/cjs/components/internal/types.js +8 -0
  5. package/dist/cjs/components/internal/utils.js +16 -0
  6. package/dist/cjs/components/stack.partial.js +46 -22
  7. package/dist/cjs/constants.js +13 -0
  8. package/dist/cjs/helpers/responsive/build-media-query-css.js +88 -0
  9. package/dist/cjs/helpers/responsive/constants.js +85 -0
  10. package/dist/cjs/helpers/responsive/index.js +38 -0
  11. package/dist/cjs/helpers/responsive/media-helper.js +84 -0
  12. package/dist/cjs/helpers/responsive/types.js +5 -0
  13. package/dist/cjs/version.json +1 -1
  14. package/dist/es2019/components/inline.partial.js +18 -18
  15. package/dist/es2019/components/internal/base-box.partial.js +75 -70
  16. package/dist/es2019/components/internal/types.js +1 -0
  17. package/dist/es2019/components/internal/utils.js +2 -0
  18. package/dist/es2019/components/stack.partial.js +18 -18
  19. package/dist/es2019/constants.js +3 -1
  20. package/dist/es2019/helpers/responsive/build-media-query-css.js +85 -0
  21. package/dist/es2019/helpers/responsive/constants.js +74 -0
  22. package/dist/es2019/helpers/responsive/index.js +3 -0
  23. package/dist/es2019/helpers/responsive/media-helper.js +78 -0
  24. package/dist/es2019/helpers/responsive/types.js +1 -0
  25. package/dist/es2019/version.json +1 -1
  26. package/dist/esm/components/inline.partial.js +46 -21
  27. package/dist/esm/components/internal/base-box.partial.js +100 -79
  28. package/dist/esm/components/internal/types.js +1 -0
  29. package/dist/esm/components/internal/utils.js +7 -0
  30. package/dist/esm/components/stack.partial.js +46 -21
  31. package/dist/esm/constants.js +3 -1
  32. package/dist/esm/helpers/responsive/build-media-query-css.js +79 -0
  33. package/dist/esm/helpers/responsive/constants.js +76 -0
  34. package/dist/esm/helpers/responsive/index.js +3 -0
  35. package/dist/esm/helpers/responsive/media-helper.js +78 -0
  36. package/dist/esm/helpers/responsive/types.js +1 -0
  37. package/dist/esm/version.json +1 -1
  38. package/dist/types/components/box.d.ts +3 -5
  39. package/dist/types/components/inline.partial.d.ts +16 -18
  40. package/dist/types/components/internal/base-box.partial.d.ts +49 -50
  41. package/dist/types/components/internal/types.d.ts +6 -0
  42. package/dist/types/components/internal/utils.d.ts +3 -0
  43. package/dist/types/components/stack.partial.d.ts +16 -18
  44. package/dist/types/components/types.d.ts +49 -0
  45. package/dist/types/constants.d.ts +2 -0
  46. package/dist/types/helpers/responsive/build-media-query-css.d.ts +57 -0
  47. package/dist/types/helpers/responsive/constants.d.ts +23 -0
  48. package/dist/types/helpers/responsive/index.d.ts +4 -0
  49. package/dist/types/helpers/responsive/media-helper.d.ts +45 -0
  50. package/dist/types/helpers/responsive/types.d.ts +47 -0
  51. package/package.json +6 -3
  52. package/report.api.md +111 -78
  53. package/responsive/package.json +15 -0
  54. package/scripts/spacing-codegen-template.tsx +29 -24
  55. package/scripts/utils.tsx +4 -1
  56. package/tmp/api-report-tmp.d.ts +88 -77
@@ -1,4 +1,3 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
1
  /** @jsx jsx */
3
2
  import { forwardRef, memo } from 'react';
4
3
  import { css, jsx } from '@emotion/react';
@@ -38,30 +37,56 @@ var flexGrowMap = {
38
37
 
39
38
  /**
40
39
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
41
- * @codegen <<SignedSource::0e30ffcc6aef7932f9d8ff2543327236>>
40
+ * @codegen <<SignedSource::41d7002b7f69aa44d0d8598e07a1afc6>>
42
41
  * @codegenId spacing
43
42
  * @codegenCommand yarn codegen-styles
44
43
  * @codegenParams ["space"]
45
44
  * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::167d3b69b159ae33e74d4ea5ab7eade6>>
46
45
  */
47
- var spaceMap = Object.fromEntries(['gap'].map(function (property) {
48
- return [property, {
49
- '0': css(_defineProperty({}, property, "var(--ds-space-0, 0px)")),
50
- '025': css(_defineProperty({}, property, "var(--ds-space-025, 2px)")),
51
- '050': css(_defineProperty({}, property, "var(--ds-space-050, 4px)")),
52
- '075': css(_defineProperty({}, property, "var(--ds-space-075, 6px)")),
53
- '100': css(_defineProperty({}, property, "var(--ds-space-100, 8px)")),
54
- '150': css(_defineProperty({}, property, "var(--ds-space-150, 12px)")),
55
- '200': css(_defineProperty({}, property, "var(--ds-space-200, 16px)")),
56
- '250': css(_defineProperty({}, property, "var(--ds-space-250, 20px)")),
57
- '300': css(_defineProperty({}, property, "var(--ds-space-300, 24px)")),
58
- '400': css(_defineProperty({}, property, "var(--ds-space-400, 32px)")),
59
- '500': css(_defineProperty({}, property, "var(--ds-space-500, 40px)")),
60
- '600': css(_defineProperty({}, property, "var(--ds-space-600, 48px)")),
61
- '800': css(_defineProperty({}, property, "var(--ds-space-800, 64px)")),
62
- '1000': css(_defineProperty({}, property, "var(--ds-space-1000, 80px)"))
63
- }];
64
- }));
46
+ var spaceMap = {
47
+ '0': css({
48
+ gap: "var(--ds-space-0, 0px)"
49
+ }),
50
+ '025': css({
51
+ gap: "var(--ds-space-025, 2px)"
52
+ }),
53
+ '050': css({
54
+ gap: "var(--ds-space-050, 4px)"
55
+ }),
56
+ '075': css({
57
+ gap: "var(--ds-space-075, 6px)"
58
+ }),
59
+ '100': css({
60
+ gap: "var(--ds-space-100, 8px)"
61
+ }),
62
+ '150': css({
63
+ gap: "var(--ds-space-150, 12px)"
64
+ }),
65
+ '200': css({
66
+ gap: "var(--ds-space-200, 16px)"
67
+ }),
68
+ '250': css({
69
+ gap: "var(--ds-space-250, 20px)"
70
+ }),
71
+ '300': css({
72
+ gap: "var(--ds-space-300, 24px)"
73
+ }),
74
+ '400': css({
75
+ gap: "var(--ds-space-400, 32px)"
76
+ }),
77
+ '500': css({
78
+ gap: "var(--ds-space-500, 40px)"
79
+ }),
80
+ '600': css({
81
+ gap: "var(--ds-space-600, 48px)"
82
+ }),
83
+ '800': css({
84
+ gap: "var(--ds-space-800, 64px)"
85
+ }),
86
+ '1000': css({
87
+ gap: "var(--ds-space-1000, 80px)"
88
+ })
89
+ };
65
90
  /**
66
91
  * @codegenEnd
67
92
  */
@@ -96,7 +121,7 @@ var Stack = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref) {
96
121
  testId = _ref.testId;
97
122
  var justifyContent = spread || alignBlock;
98
123
  return jsx("div", {
99
- css: [baseStyles, space && spaceMap.gap[space], alignItems && alignItemsMap[alignItems], grow && flexGrowMap[grow], justifyContent && justifyContentMap[justifyContent]],
124
+ css: [baseStyles, space && spaceMap[space], alignItems && alignItemsMap[alignItems], grow && flexGrowMap[grow], justifyContent && justifyContentMap[justifyContent]],
100
125
  "data-testid": testId,
101
126
  ref: ref
102
127
  }, children);
@@ -1,3 +1,4 @@
1
+ import { UNSAFE_Breakpoint as Breakpoint, UNSAFE_BreakpointConfig as BreakpointConfig, UNSAFE_BREAKPOINTS_CONFIG as BREAKPOINTS_CONFIG, UNSAFE_BREAKPOINTS_LIST as BREAKPOINTS_LIST } from '@atlaskit/ds-explorations';
1
2
  export var LAYERS = {
2
3
  card: 100,
3
4
  navigation: 200,
@@ -8,4 +9,5 @@ export var LAYERS = {
8
9
  flag: 600,
9
10
  spotlight: 700,
10
11
  tooltip: 800
11
- };
12
+ };
13
+ export { BREAKPOINTS_CONFIG, BREAKPOINTS_LIST };
@@ -0,0 +1,79 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
5
+ import { css } from '@emotion/react';
6
+ import { SMALLEST_BREAKPOINT, 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
+ * @experimental Unsafe for usage as the API is not finalized.
12
+ *
13
+ * @example
14
+ * A map to build optional `display:none` for consumption on a div.
15
+ * ```ts
16
+ * const hideMediaQueries = buildAboveMediaQueryCSS({ display: 'none' });
17
+ *
18
+ * const Component = ({ hideAtBreakpoints: ('xs' | 'sm')[], children: ReactNode }) => {
19
+ * return <div css={hideAtBreakpoints.map(b => hideMediaQueries[b])}>{children}</div>;
20
+ * }
21
+ * ```
22
+ *
23
+ * This roughly builds a map that will look roughly like this (if done manually):
24
+ * ```ts
25
+ * {
26
+ * xxs: css({ '@media (min-width: 0px)': { display: 'none' } }),
27
+ * xs: css({ '@media (min-width: …px)': { display: 'none' } }),
28
+ * sm: css({ '@media (min-width: …px)': { display: 'none' } }),
29
+ * }
30
+ * ```
31
+ */
32
+ export var UNSAFE_buildAboveMediaQueryCSS = function UNSAFE_buildAboveMediaQueryCSS(input) {
33
+ return UNSAFE_BREAKPOINTS_ORDERED_LIST.reduce(function (acc, breakpoint) {
34
+ return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, breakpoint, css(_defineProperty({}, UNSAFE_media.above[breakpoint], typeof input === 'function' ? input(breakpoint) : input))));
35
+ }, {});
36
+ };
37
+
38
+ /**
39
+ * Build a map of breakpoints to css with media queries and nested styles.
40
+ *
41
+ * WARNING: The smallest breakpoint is not a valid key as a media query below 0px is misleading.
42
+ * This is separated from `buildAboveMediaQueryCSS` for that specific reason, you cannot have type safety with this variance.
43
+ *
44
+ * @experimental Unsafe for usage as the API is not finalized.
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 (max-width: …px)': { display: 'none' } }),
60
+ * sm: css({ '@media (max-width: …px)': { display: 'none' } }),
61
+ * }
62
+ * ```
63
+ *
64
+ * @experimental Unsafe for usage as the API is not finalized.
65
+ */
66
+ export var UNSAFE_buildBelowMediaQueryCSS = function UNSAFE_buildBelowMediaQueryCSS(input) {
67
+ /**
68
+ * WARNING: it's very important that these are in the correct order.
69
+ * If they are not, cascading is not in the order higher/low breakpoints do not override as expected.
70
+ */
71
+ var reversedBreakpoints = _toConsumableArray(UNSAFE_BREAKPOINTS_ORDERED_LIST).reverse();
72
+ return reversedBreakpoints.reduce(function (acc, breakpoint) {
73
+ // Omit `media.below.xxs` as it's not available as that would be `<0px`…
74
+ if (breakpoint === SMALLEST_BREAKPOINT) {
75
+ return acc;
76
+ }
77
+ return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, breakpoint, css(_defineProperty({}, UNSAFE_media.below[breakpoint], typeof input === 'function' ? input(breakpoint) : input))));
78
+ }, {});
79
+ };
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Our internal configuration for breakpoints configuration.
3
+ *
4
+ * @experimental Unsafe for consumption outside of the design system itself.
5
+ */
6
+ export var UNSAFE_BREAKPOINTS_CONFIG = {
7
+ // mobile
8
+ xxs: {
9
+ gridItemGutter: "var(--ds-space-200, 16px)",
10
+ gridMargin: "var(--ds-space-200, 16px)",
11
+ min: 0,
12
+ max: 479
13
+ },
14
+ // phablet
15
+ xs: {
16
+ gridItemGutter: "var(--ds-space-200, 16px)",
17
+ gridMargin: "var(--ds-space-200, 16px)",
18
+ min: 480,
19
+ max: 767
20
+ },
21
+ // tablet
22
+ sm: {
23
+ gridItemGutter: "var(--ds-space-200, 16px)",
24
+ gridMargin: "var(--ds-space-300, 24px)",
25
+ min: 768,
26
+ max: 1023
27
+ },
28
+ // laptop desktop
29
+ md: {
30
+ gridItemGutter: "var(--ds-space-300, 24px)",
31
+ gridMargin: "var(--ds-space-400, 32px)",
32
+ min: 1024,
33
+ max: 1439
34
+ },
35
+ // monitor
36
+ lg: {
37
+ gridItemGutter: "var(--ds-space-400, 32px)",
38
+ gridMargin: "var(--ds-space-400, 32px)",
39
+ min: 1440,
40
+ max: 1767
41
+ },
42
+ // large high res
43
+ xl: {
44
+ gridItemGutter: "var(--ds-space-400, 32px)",
45
+ gridMargin: "var(--ds-space-500, 40px)",
46
+ min: 1768,
47
+ max: 2159
48
+ },
49
+ // extra large high res
50
+ xxl: {
51
+ gridItemGutter: "var(--ds-space-500, 40px)",
52
+ gridMargin: "var(--ds-space-500, 40px)",
53
+ min: 2160,
54
+ max: Number.MAX_SAFE_INTEGER
55
+ }
56
+ };
57
+
58
+ /**
59
+ * The list of breakpoints in order from smallest to largest. You may need to clone and reverse this list if you want the opposite.
60
+ *
61
+ * This is intentional for cascading with `min-width` or `media.above`. Media queries go from lowest width to highest.
62
+ *
63
+ * @experimental Unsafe for consumption outside of the design system itself.
64
+ */
65
+ export var UNSAFE_BREAKPOINTS_ORDERED_LIST = Object.keys(UNSAFE_BREAKPOINTS_CONFIG).sort(function (a, b) {
66
+ return UNSAFE_BREAKPOINTS_CONFIG[a].min - UNSAFE_BREAKPOINTS_CONFIG[b].min;
67
+ });
68
+
69
+ /**
70
+ * This is our smallest breakpoint with a few nuances to it:
71
+ * 1. It is the default value for shorthands, eg. `<GridItem span={6} />` maps to `{ [SMALLEST_BREAKPOINT]: props.span }`
72
+ * 2. It's omitted in `media.below` as there's nothing below `0px`.
73
+ *
74
+ * @experimental There's a chance this will change in _value_, but should only be used in a way that it will not matter if this value changes.
75
+ */
76
+ export var SMALLEST_BREAKPOINT = UNSAFE_BREAKPOINTS_ORDERED_LIST[0];
@@ -0,0 +1,3 @@
1
+ export { UNSAFE_media } from './media-helper';
2
+ export { UNSAFE_buildAboveMediaQueryCSS, UNSAFE_buildBelowMediaQueryCSS } from './build-media-query-css';
3
+ export { UNSAFE_BREAKPOINTS_ORDERED_LIST, UNSAFE_BREAKPOINTS_CONFIG } from './constants';
@@ -0,0 +1,78 @@
1
+ import { UNSAFE_BREAKPOINTS_CONFIG } from './constants';
2
+
3
+ /**
4
+ * To ensure min-width and max-width do both target at the same time, we subtract a value.
5
+ * We use a fractional value here as used in other libraries and described in @link https://www.w3.org/TR/mediaqueries-4/#mq-min-max: "…possibility of fractional viewport sizes which can occur as a result of non-integer pixel densities…"
6
+ */
7
+ var BELOW_PRECISION = 0.02;
8
+
9
+ /**
10
+ * This is the full internal version. The import has been separated to only expose as-needed.
11
+ */
12
+ var internalMedia = {
13
+ /**
14
+ * A media query to target viewports above the min width of a given breakpoint.
15
+ * Note that `media.above.xs` is redundant and should not be used, but it's included for programatic purposes.
16
+ */
17
+ above: {
18
+ /**
19
+ * `above.xxs` is redundant and no media query should be used, but it's included for programatic purposes…
20
+ *
21
+ * Eg. this is `@media (min-width: 0px)`
22
+ */
23
+ xxs: "@media (min-width: ".concat(UNSAFE_BREAKPOINTS_CONFIG.xxs.min, "px)"),
24
+ xs: "@media (min-width: ".concat(UNSAFE_BREAKPOINTS_CONFIG.xs.min, "px)"),
25
+ sm: "@media (min-width: ".concat(UNSAFE_BREAKPOINTS_CONFIG.sm.min, "px)"),
26
+ md: "@media (min-width: ".concat(UNSAFE_BREAKPOINTS_CONFIG.md.min, "px)"),
27
+ lg: "@media (min-width: ".concat(UNSAFE_BREAKPOINTS_CONFIG.lg.min, "px)"),
28
+ xl: "@media (min-width: ".concat(UNSAFE_BREAKPOINTS_CONFIG.xl.min, "px)"),
29
+ xxl: "@media (min-width: ".concat(UNSAFE_BREAKPOINTS_CONFIG.xxl.min, "px)")
30
+ },
31
+ below: {
32
+ /**
33
+ * A media query to target viewports below the min width of a given breakpoint.
34
+ * Note that `media.below.xxs` is intentionally omitted as this would be `@media (max-width: 0px)`
35
+ */
36
+ xs: "@media (max-width: ".concat(UNSAFE_BREAKPOINTS_CONFIG.xs.min - BELOW_PRECISION, "px)"),
37
+ sm: "@media (max-width: ".concat(UNSAFE_BREAKPOINTS_CONFIG.sm.min - BELOW_PRECISION, "px)"),
38
+ md: "@media (max-width: ".concat(UNSAFE_BREAKPOINTS_CONFIG.md.min - BELOW_PRECISION, "px)"),
39
+ lg: "@media (max-width: ".concat(UNSAFE_BREAKPOINTS_CONFIG.lg.min - BELOW_PRECISION, "px)"),
40
+ xl: "@media (max-width: ".concat(UNSAFE_BREAKPOINTS_CONFIG.xl.min - BELOW_PRECISION, "px)"),
41
+ xxl: "@media (max-width: ".concat(UNSAFE_BREAKPOINTS_CONFIG.xxl.min - BELOW_PRECISION, "px)")
42
+ },
43
+ /**
44
+ * A media query to target viewports exactly between the min and max of a given breakpoint.
45
+ */
46
+ only: {
47
+ xxs: "@media (min-width: ".concat(UNSAFE_BREAKPOINTS_CONFIG.xxs.min, "px) and (max-width: ").concat(UNSAFE_BREAKPOINTS_CONFIG.xxs.max, "px)"),
48
+ xs: "@media (min-width: ".concat(UNSAFE_BREAKPOINTS_CONFIG.xs.min, "px) and (max-width: ").concat(UNSAFE_BREAKPOINTS_CONFIG.xs.max, "px)"),
49
+ sm: "@media (min-width: ".concat(UNSAFE_BREAKPOINTS_CONFIG.sm.min, "px) and (max-width: ").concat(UNSAFE_BREAKPOINTS_CONFIG.sm.max, "px)"),
50
+ md: "@media (min-width: ".concat(UNSAFE_BREAKPOINTS_CONFIG.md.min, "px) and (max-width: ").concat(UNSAFE_BREAKPOINTS_CONFIG.md.max, "px)"),
51
+ lg: "@media (min-width: ".concat(UNSAFE_BREAKPOINTS_CONFIG.lg.min, "px) and (max-width: ").concat(UNSAFE_BREAKPOINTS_CONFIG.lg.max, "px)"),
52
+ xl: "@media (min-width: ".concat(UNSAFE_BREAKPOINTS_CONFIG.xl.min, "px) and (max-width: ").concat(UNSAFE_BREAKPOINTS_CONFIG.xl.max, "px)"),
53
+ xxl: "@media (min-width: ".concat(UNSAFE_BREAKPOINTS_CONFIG.xxl.min, "px) and (max-width: ").concat(UNSAFE_BREAKPOINTS_CONFIG.xxl.max, "px)")
54
+ }
55
+ };
56
+
57
+ /**
58
+ * This is an object of usable media query helpers using our internal breakpoints configuration.
59
+ *
60
+ * @experimental Unsafe for usage as the API is not finalized.
61
+ */
62
+ export var UNSAFE_media = {
63
+ above: internalMedia.above,
64
+ below: internalMedia.below
65
+ };
66
+
67
+ /**
68
+ * With these types:
69
+ * ```
70
+ * type MediaQuery = `@media (${string})`;
71
+ * type ResponsiveMediaObject = Record<Breakpoint, MediaQuery>;
72
+ * ```
73
+ *
74
+ * TODO: This `media` object as of typescript@4.9, would benefit from satisfies, eg.:
75
+ * ```
76
+ * const UNSAFE_media = { … } satisfies Record<'above' | 'only', ResponsiveMediaObject> & { below: Omit<ResponsiveMediaObject, 'xxs'> }
77
+ * ```
78
+ */
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,10 +1,8 @@
1
1
  import { ElementType, FC, ReactElement } from 'react';
2
2
  import { BaseBoxProps } from './internal/base-box.partial';
3
- import { CustomStyles } from './types';
4
- declare type BoxPropsBase = {
5
- customStyles?: CustomStyles;
6
- };
7
- export declare type BoxProps<T extends ElementType = 'div'> = Omit<BaseBoxProps<T>, 'className' | 'UNSAFE_style'> & BoxPropsBase;
3
+ import { BoxResponsiveProp } from './internal/types';
4
+ import { PublicBoxPropsBase } from './types';
5
+ export declare type BoxProps<T extends ElementType = 'div'> = Omit<BaseBoxProps<T>, 'className' | 'UNSAFE_style' | BoxResponsiveProp> & PublicBoxPropsBase;
8
6
  declare type BoxComponent<T extends ElementType = 'div'> = (<T extends ElementType = 'div'>(props: BoxProps<T>) => ReactElement | null) & FC<BoxProps<T>>;
9
7
  /**
10
8
  * __Box__
@@ -44,31 +44,29 @@ export declare type Spread = 'space-between';
44
44
  export declare type Grow = 'hug' | 'fill';
45
45
  /**
46
46
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
47
- * @codegen <<SignedSource::0e30ffcc6aef7932f9d8ff2543327236>>
47
+ * @codegen <<SignedSource::41d7002b7f69aa44d0d8598e07a1afc6>>
48
48
  * @codegenId spacing
49
49
  * @codegenCommand yarn codegen-styles
50
50
  * @codegenParams ["space"]
51
51
  * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::167d3b69b159ae33e74d4ea5ab7eade6>>
52
52
  */
53
53
  declare const spaceMap: {
54
- [k: string]: {
55
- readonly '0': import("@emotion/react").SerializedStyles;
56
- readonly '025': import("@emotion/react").SerializedStyles;
57
- readonly '050': import("@emotion/react").SerializedStyles;
58
- readonly '075': import("@emotion/react").SerializedStyles;
59
- readonly '100': import("@emotion/react").SerializedStyles;
60
- readonly '150': import("@emotion/react").SerializedStyles;
61
- readonly '200': import("@emotion/react").SerializedStyles;
62
- readonly '250': import("@emotion/react").SerializedStyles;
63
- readonly '300': import("@emotion/react").SerializedStyles;
64
- readonly '400': import("@emotion/react").SerializedStyles;
65
- readonly '500': import("@emotion/react").SerializedStyles;
66
- readonly '600': import("@emotion/react").SerializedStyles;
67
- readonly '800': import("@emotion/react").SerializedStyles;
68
- readonly '1000': import("@emotion/react").SerializedStyles;
69
- };
54
+ readonly '0': import("@emotion/react").SerializedStyles;
55
+ readonly '025': import("@emotion/react").SerializedStyles;
56
+ readonly '050': import("@emotion/react").SerializedStyles;
57
+ readonly '075': import("@emotion/react").SerializedStyles;
58
+ readonly '100': import("@emotion/react").SerializedStyles;
59
+ readonly '150': import("@emotion/react").SerializedStyles;
60
+ readonly '200': import("@emotion/react").SerializedStyles;
61
+ readonly '250': import("@emotion/react").SerializedStyles;
62
+ readonly '300': import("@emotion/react").SerializedStyles;
63
+ readonly '400': import("@emotion/react").SerializedStyles;
64
+ readonly '500': import("@emotion/react").SerializedStyles;
65
+ readonly '600': import("@emotion/react").SerializedStyles;
66
+ readonly '800': import("@emotion/react").SerializedStyles;
67
+ readonly '1000': import("@emotion/react").SerializedStyles;
70
68
  };
71
- export declare type Space = keyof typeof spaceMap.gap;
69
+ export declare type Space = keyof typeof spaceMap;
72
70
  /**
73
71
  * __Inline__
74
72
  *
@@ -1,6 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import { ComponentPropsWithoutRef, ComponentPropsWithRef, ElementType, FC, ReactElement, ReactNode } from 'react';
3
- import { Layer } from '../../constants';
3
+ import { Breakpoint, Layer } from '../../constants';
4
4
  import type { BasePrimitiveProps } from '../types';
5
5
  export declare type BaseBoxProps<T extends ElementType = 'div'> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className' | 'style'> & BasePrimitiveProps & BaseBoxPropsFoundation<T>;
6
6
  declare type BaseBoxPropsFoundation<T extends ElementType> = {
@@ -43,7 +43,7 @@ declare type BaseBoxPropsFoundation<T extends ElementType> = {
43
43
  /**
44
44
  * Defines border width.
45
45
  */
46
- borderWidth?: BorderWidth;
46
+ borderWidth?: BorderWidth | Partial<Record<Breakpoint, BorderWidth>>;
47
47
  /**
48
48
  * Token representing border color with a fallback.
49
49
  */
@@ -89,42 +89,42 @@ declare type BaseBoxPropsFoundation<T extends ElementType> = {
89
89
  */
90
90
  overflowBlock?: OverflowBlock;
91
91
  /**
92
- * Shorthand for `paddingBlock` and `paddingInline` together.
92
+ * Tokens representing CSS shorthand for `paddingBlock` and `paddingInline` together.
93
93
  *
94
94
  * @see paddingBlock
95
95
  * @see paddingInline
96
96
  */
97
- padding?: Padding;
97
+ padding?: Padding | Partial<Record<Breakpoint, Padding>>;
98
98
  /**
99
- * Token representing CSS shorthand `paddingBlock`.
99
+ * Tokens representing CSS shorthand `paddingBlock`.
100
100
  *
101
101
  * @see paddingBlockStart
102
102
  * @see paddingBlockEnd
103
103
  */
104
- paddingBlock?: PaddingBlock;
104
+ paddingBlock?: PaddingBlock | Partial<Record<Breakpoint, PaddingBlock>>;
105
105
  /**
106
- * Token representing CSS `paddingBlockStart`.
106
+ * Tokens representing CSS `paddingBlockStart`.
107
107
  */
108
- paddingBlockStart?: PaddingBlockStart;
108
+ paddingBlockStart?: PaddingBlockStart | Partial<Record<Breakpoint, PaddingBlockStart>>;
109
109
  /**
110
- * Token representing CSS `paddingBlockEnd`.
110
+ * Tokens representing CSS `paddingBlockEnd`.
111
111
  */
112
- paddingBlockEnd?: PaddingBlockEnd;
112
+ paddingBlockEnd?: PaddingBlockEnd | Partial<Record<Breakpoint, PaddingBlockEnd>>;
113
113
  /**
114
- * Token representing CSS shorthand `paddingInline`.
114
+ * Tokens representing CSS shorthand `paddingInline`.
115
115
  *
116
116
  * @see paddingInlineStart
117
117
  * @see paddingInlineEnd
118
118
  */
119
- paddingInline?: PaddingInline;
119
+ paddingInline?: PaddingInline | Partial<Record<Breakpoint, PaddingInline>>;
120
120
  /**
121
- * Token representing CSS `paddingInlineStart`.
121
+ * Tokens representing CSS `paddingInlineStart`.
122
122
  */
123
- paddingInlineStart?: PaddingInlineStart;
123
+ paddingInlineStart?: PaddingInlineStart | Partial<Record<Breakpoint, PaddingInlineStart>>;
124
124
  /**
125
- * Token representing CSS `paddingInlineEnd`.
125
+ * Tokens representing CSS `paddingInlineEnd`.
126
126
  */
127
- paddingInlineEnd?: PaddingInlineEnd;
127
+ paddingInlineEnd?: PaddingInlineEnd | Partial<Record<Breakpoint, PaddingInlineEnd>>;
128
128
  /**
129
129
  * Token representing width.
130
130
  * @experimental The existing tokens will be replaced to better reflect dimensions.
@@ -138,7 +138,7 @@ declare type BaseBoxPropsFoundation<T extends ElementType> = {
138
138
  /**
139
139
  * Defines display type and layout. Defaults to `block`.
140
140
  */
141
- display?: Display;
141
+ display?: Display | Partial<Record<Breakpoint, Display>>;
142
142
  /**
143
143
  * CSS position property.
144
144
  */
@@ -161,10 +161,11 @@ declare const borderStyleMap: {
161
161
  readonly none: import("@emotion/react").SerializedStyles;
162
162
  readonly solid: import("@emotion/react").SerializedStyles;
163
163
  };
164
- declare type BorderWidth = keyof typeof borderWidthMap;
164
+ export declare type BorderWidth = keyof typeof borderWidthMap;
165
165
  declare const borderWidthMap: {
166
- readonly 'size.050': import("@emotion/react").SerializedStyles;
167
- readonly 'size.100': import("@emotion/react").SerializedStyles;
166
+ readonly 'size.0': "var(--ds-width-0)";
167
+ readonly 'size.050': "var(--ds-width-050)";
168
+ readonly 'size.100': "var(--ds-width-100)";
168
169
  };
169
170
  declare type BorderRadius = keyof typeof borderRadiusMap;
170
171
  declare const borderRadiusMap: {
@@ -196,13 +197,13 @@ declare const alignSelfMap: {
196
197
  readonly end: import("@emotion/react").SerializedStyles;
197
198
  readonly baseline: import("@emotion/react").SerializedStyles;
198
199
  };
199
- declare type Display = keyof typeof displayMap;
200
+ export declare type Display = keyof typeof displayMap;
200
201
  declare const displayMap: {
201
- readonly block: import("@emotion/react").SerializedStyles;
202
- readonly inline: import("@emotion/react").SerializedStyles;
203
- readonly flex: import("@emotion/react").SerializedStyles;
204
- readonly 'inline-flex': import("@emotion/react").SerializedStyles;
205
- readonly 'inline-block': import("@emotion/react").SerializedStyles;
202
+ readonly block: "block";
203
+ readonly inline: "inline";
204
+ readonly flex: "flex";
205
+ readonly 'inline-flex': "inline-flex";
206
+ readonly 'inline-block': "inline-block";
206
207
  };
207
208
  declare type Position = keyof typeof positionMap;
208
209
  declare const positionMap: {
@@ -304,37 +305,35 @@ export declare type MaxHeight = keyof typeof maxHeightMap;
304
305
  */
305
306
  /**
306
307
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
307
- * @codegen <<SignedSource::6da0ceaa2c227230e3a93bc724ff8648>>
308
+ * @codegen <<SignedSource::84fd352b0e6509d380a0dcf8ad023ca2>>
308
309
  * @codegenId spacing
309
310
  * @codegenCommand yarn codegen-styles
310
311
  * @codegenParams ["padding"]
311
312
  * @codegenDependency ../../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::167d3b69b159ae33e74d4ea5ab7eade6>>
312
313
  */
313
314
  declare const paddingMap: {
314
- [k: string]: {
315
- readonly 'space.0': import("@emotion/react").SerializedStyles;
316
- readonly 'space.025': import("@emotion/react").SerializedStyles;
317
- readonly 'space.050': import("@emotion/react").SerializedStyles;
318
- readonly 'space.075': import("@emotion/react").SerializedStyles;
319
- readonly 'space.100': import("@emotion/react").SerializedStyles;
320
- readonly 'space.150': import("@emotion/react").SerializedStyles;
321
- readonly 'space.200': import("@emotion/react").SerializedStyles;
322
- readonly 'space.250': import("@emotion/react").SerializedStyles;
323
- readonly 'space.300': import("@emotion/react").SerializedStyles;
324
- readonly 'space.400': import("@emotion/react").SerializedStyles;
325
- readonly 'space.500': import("@emotion/react").SerializedStyles;
326
- readonly 'space.600': import("@emotion/react").SerializedStyles;
327
- readonly 'space.800': import("@emotion/react").SerializedStyles;
328
- readonly 'space.1000': import("@emotion/react").SerializedStyles;
329
- };
315
+ readonly 'space.0': "var(--ds-space-0)";
316
+ readonly 'space.025': "var(--ds-space-025)";
317
+ readonly 'space.050': "var(--ds-space-050)";
318
+ readonly 'space.075': "var(--ds-space-075)";
319
+ readonly 'space.100': "var(--ds-space-100)";
320
+ readonly 'space.150': "var(--ds-space-150)";
321
+ readonly 'space.200': "var(--ds-space-200)";
322
+ readonly 'space.250': "var(--ds-space-250)";
323
+ readonly 'space.300': "var(--ds-space-300)";
324
+ readonly 'space.400': "var(--ds-space-400)";
325
+ readonly 'space.500': "var(--ds-space-500)";
326
+ readonly 'space.600': "var(--ds-space-600)";
327
+ readonly 'space.800': "var(--ds-space-800)";
328
+ readonly 'space.1000': "var(--ds-space-1000)";
330
329
  };
331
- export declare type Padding = keyof typeof paddingMap.padding;
332
- export declare type PaddingBlock = keyof typeof paddingMap.paddingBlock;
333
- export declare type PaddingBlockStart = keyof typeof paddingMap.paddingBlockStart;
334
- export declare type PaddingBlockEnd = keyof typeof paddingMap.paddingBlockEnd;
335
- export declare type PaddingInline = keyof typeof paddingMap.paddingInline;
336
- export declare type PaddingInlineStart = keyof typeof paddingMap.paddingInlineStart;
337
- export declare type PaddingInlineEnd = keyof typeof paddingMap.paddingInlineEnd;
330
+ export declare type Padding = keyof typeof paddingMap;
331
+ export declare type PaddingBlock = keyof typeof paddingMap;
332
+ export declare type PaddingBlockStart = keyof typeof paddingMap;
333
+ export declare type PaddingBlockEnd = keyof typeof paddingMap;
334
+ export declare type PaddingInline = keyof typeof paddingMap;
335
+ export declare type PaddingInlineStart = keyof typeof paddingMap;
336
+ export declare type PaddingInlineEnd = keyof typeof paddingMap;
338
337
  /**
339
338
  * @codegenEnd
340
339
  */
@@ -0,0 +1,6 @@
1
+ import { SerializedStyles } from '@emotion/react';
2
+ import { Breakpoint } from '../../constants';
3
+ export declare const BOX_RESPONSIVE_PROPS: readonly ["borderWidth", "display", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd"];
4
+ export declare type BoxResponsiveProp = typeof BOX_RESPONSIVE_PROPS[number];
5
+ export declare type BreakpointIndexedStyle = Record<Breakpoint | 'static', SerializedStyles>;
6
+ export declare type GenericPropertyValue = string | Partial<Record<Breakpoint, string>> | undefined;
@@ -0,0 +1,3 @@
1
+ import { GenericPropertyValue } from './types';
2
+ export declare const isResponsiveStyleProp: (propertyValue: GenericPropertyValue) => propertyValue is object;
3
+ export declare const isStaticStyleProp: (propertyValue: GenericPropertyValue) => propertyValue is string;