@atlaskit/primitives 0.9.5 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/primitives
2
2
 
3
+ ## 0.10.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`b6302963111`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b6302963111) - Change border.radius.normal to be 3px instead of 4px.
8
+ `display: grid` is now accepted for `xcss`.
9
+
10
+ ## 0.10.0
11
+
12
+ ### Minor Changes
13
+
14
+ - [`313d71fce9c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/313d71fce9c) - Allow media queries at predefined breakpoints to be applied through xCSS.
15
+
3
16
  ## 0.9.5
4
17
 
5
18
  ### Patch Changes
@@ -55,7 +55,7 @@ var Box = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
55
55
  style: style,
56
56
  testId: testId,
57
57
  ref: ref
58
- // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
58
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
59
59
  ,
60
60
  css: className
61
61
  }, safeHtmlAttributes), children);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "0.9.5",
3
+ "version": "0.10.1",
4
4
  "sideEffects": false
5
5
  }
@@ -9,9 +9,9 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
9
9
  var _react = require("@emotion/react");
10
10
  /**
11
11
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
12
- * @codegen <<SignedSource::2c35cc3f884146ac8ccdf053bf413481>>
12
+ * @codegen <<SignedSource::b6657585e3df6f8017d4c35bb9150e3f>>
13
13
  * @codegenId dimensions
14
- * @codegenCommand yarn codegen-styles
14
+ * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
15
15
  * @codegenParams ["dimensions"]
16
16
  * @codegenDependency ../../scripts/codegen-file-templates/dimensions.tsx <<SignedSource::01143ff41135244db1d8ec2efe4339d6>>
17
17
  */
@@ -32,9 +32,9 @@ exports.dimensionMap = dimensionMap;
32
32
 
33
33
  /**
34
34
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
35
- * @codegen <<SignedSource::c32ec2103b151d3533775390e92f0f03>>
35
+ * @codegen <<SignedSource::de092b03d79b8477034921622fcddd53>>
36
36
  * @codegenId spacing
37
- * @codegenCommand yarn codegen-styles
37
+ * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
38
38
  * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::86e173b0e020fe5d091fdf4bff023711>>
39
39
  */
40
40
  var spaceMap = {
@@ -60,9 +60,9 @@ exports.spaceMap = spaceMap;
60
60
 
61
61
  /**
62
62
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
63
- * @codegen <<SignedSource::aa1cfa3cd24f141a85ac1e0b70dbd8a8>>
63
+ * @codegen <<SignedSource::98eba397b6a9706307e40f32a49200fd>>
64
64
  * @codegenId colors
65
- * @codegenCommand yarn codegen-styles
65
+ * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
66
66
  * @codegenParams ["border", "background", "shadow", "text", "fill"]
67
67
  * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::10aa7e87eca39e4d6594a764e78e0698>>
68
68
  */
@@ -270,17 +270,17 @@ exports.fillMap = fillMap;
270
270
 
271
271
  /**
272
272
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
273
- * @codegen <<SignedSource::e63fc5ff12523b2d49dc72925e1648e6>>
273
+ * @codegen <<SignedSource::7787d50b7bc64a9350e4cf35ae608a79>>
274
274
  * @codegenId misc
275
- * @codegenCommand yarn codegen-styles
275
+ * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
276
276
  * @codegenParams ["align-self", "border-style", "display", "flex-direction", "flex-grow", "flex-shrink", "flex", "layer", "overflow", "position"]
277
277
  * @codegenDependency ../../scripts/codegen-file-templates/align-self.tsx <<SignedSource::074079802534462de54bf882bb2073e5>>
278
278
  * @codegenDependency ../../scripts/codegen-file-templates/border-style.tsx <<SignedSource::87e7e289ffeaac901997c4af98084a5f>>
279
279
  * @codegenDependency ../../scripts/codegen-file-templates/dimensions.tsx <<SignedSource::01143ff41135244db1d8ec2efe4339d6>>
280
- * @codegenDependency ../../scripts/codegen-file-templates/display.tsx <<SignedSource::04ea30fcb3c02f2545af7fdc0206e645>>
280
+ * @codegenDependency ../../scripts/codegen-file-templates/display.tsx <<SignedSource::486569d9e228265c1688d0a7122bdedc>>
281
281
  * @codegenDependency ../../scripts/codegen-file-templates/flex-direction.tsx <<SignedSource::19809ba11675679c188b0d98fb651dc1>>
282
282
  * @codegenDependency ../../scripts/codegen-file-templates/flex-grow.tsx <<SignedSource::b8a06b122cb609170f1f42778a6c270e>>
283
- * @codegenDependency ../../scripts/codegen-file-templates/flex-shrink.tsx <<SignedSource::bf6626972898bf22d2eeee2130693d47>>
283
+ * @codegenDependency ../../scripts/codegen-file-templates/flex-shrink.tsx <<SignedSource::77effeb1e5c39997e34b21b000a91faf>>
284
284
  * @codegenDependency ../../scripts/codegen-file-templates/flex.tsx <<SignedSource::ffa0189d14f1f00a16ec1e9f43a17ce9>>
285
285
  * @codegenDependency ../../scripts/codegen-file-templates/layer.tsx <<SignedSource::79d24a1e558f12d671c06a7609f90dc1>>
286
286
  * @codegenDependency ../../scripts/codegen-file-templates/overflow.tsx <<SignedSource::ccb841f2f51525aed895c06e00f15089>>
@@ -304,7 +304,8 @@ var displayMap = {
304
304
  block: 'block',
305
305
  inline: 'inline',
306
306
  inlineBlock: 'inline-block',
307
- inlineFlex: 'inline-flex'
307
+ inlineFlex: 'inline-flex',
308
+ grid: 'grid'
308
309
  };
309
310
  exports.displayMap = displayMap;
310
311
  var flexDirectionMap = {
@@ -318,7 +319,7 @@ var flexGrowMap = {
318
319
  };
319
320
  exports.flexGrowMap = flexGrowMap;
320
321
  var flexShrinkMap = {
321
- '0': 0,
322
+ '0': '0',
322
323
  '1': 1
323
324
  };
324
325
  exports.flexShrinkMap = flexShrinkMap;
@@ -366,9 +367,9 @@ exports.positionMap = positionMap;
366
367
 
367
368
  /**
368
369
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
369
- * @codegen <<SignedSource::80ae367205568f9ca76d35f0cbc9d127>>
370
+ * @codegen <<SignedSource::f923934816cc73cf3f82820a93df5377>>
370
371
  * @codegenId border
371
- * @codegenCommand yarn codegen-styles
372
+ * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
372
373
  * @codegenParams ["width", "radius"]
373
374
  * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-shape.tsx <<SignedSource::81055547b21306c07a3e8a3c734a2f1c>>
374
375
  */
@@ -380,7 +381,7 @@ var borderWidthMap = {
380
381
  exports.borderWidthMap = borderWidthMap;
381
382
  var borderRadiusMap = {
382
383
  'radius.050': "var(--ds-radius-050, 2px)",
383
- 'radius.100': "var(--ds-radius-100, 4px)",
384
+ 'radius.100': "var(--ds-radius-100, 3px)",
384
385
  'radius.200': "var(--ds-radius-200, 8px)",
385
386
  'radius.300': "var(--ds-radius-300, 12px)",
386
387
  'radius.400': "var(--ds-radius-400, 16px)",
@@ -8,9 +8,11 @@ exports.parseXcss = void 0;
8
8
  exports.xcss = xcss;
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
12
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
12
13
  var _react = require("@emotion/react");
13
14
  var _warnOnce = _interopRequireDefault(require("@atlaskit/ds-lib/warn-once"));
15
+ var _responsive = require("../helpers/responsive");
14
16
  var _styleMaps = require("./style-maps.partial");
15
17
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
16
18
 
@@ -81,6 +83,11 @@ var isSafeEnvToThrow = function isSafeEnvToThrow() {
81
83
  };
82
84
  var reNestedSelectors = /(\.|\s|&+|\*\>|#|\[.*\])/;
83
85
  var rePseudos = /^::?.*$/;
86
+ var reMediaQuery = /^@media .*$/;
87
+ var reValidMediaQuery = new RegExp("^(".concat([].concat((0, _toConsumableArray2.default)(Object.values(_responsive.UNSAFE_media.above)), (0, _toConsumableArray2.default)(Object.values(_responsive.UNSAFE_media.below))).map(function (mediaQuery) {
88
+ return mediaQuery.replace(/[.()]/g, '\\$&');
89
+ } // Escape the ".", "(", and ")" in the media query syntax.
90
+ ).join('|'), ")$"));
84
91
  var transformStyles = function transformStyles(styleObj) {
85
92
  if (!styleObj || (0, _typeof2.default)(styleObj) !== 'object') {
86
93
  return styleObj;
@@ -98,7 +105,7 @@ var transformStyles = function transformStyles(styleObj) {
98
105
  value = _ref2[1];
99
106
  if (isSafeEnvToThrow()) {
100
107
  // We don't support `.class`, `[data-testid]`, `> *`, `#some-id`
101
- if (reNestedSelectors.test(key)) {
108
+ if (reNestedSelectors.test(key) && !reValidMediaQuery.test(key)) {
102
109
  throw new Error("Styles not supported for key '".concat(key, "'."));
103
110
  }
104
111
  }
@@ -109,8 +116,10 @@ var transformStyles = function transformStyles(styleObj) {
109
116
  styleObj[key] = transformStyles(value);
110
117
  return;
111
118
  }
112
-
113
- // TODO: Deal with media queries
119
+ if (reMediaQuery.test(key)) {
120
+ styleObj[key] = transformStyles(value);
121
+ return;
122
+ }
114
123
 
115
124
  // We have now dealt with all the special cases, so,
116
125
  // check whether what remains is a style property
@@ -120,7 +129,7 @@ var transformStyles = function transformStyles(styleObj) {
120
129
  }
121
130
  var tokenValue = tokensMap[key][value];
122
131
  if (!tokenValue) {
123
- var message = "Invalid token alias: ".concat(value);
132
+ var message = "Invalid token alias: ".concat(key, ": ").concat(value);
124
133
  (0, _warnOnce.default)(message);
125
134
  }
126
135
  styleObj[key] = tokenValue !== null && tokenValue !== void 0 ? tokenValue : value;
@@ -149,6 +158,10 @@ var parseXcss = function parseXcss(args) {
149
158
  }
150
159
  return styles;
151
160
  };
161
+
162
+ // Media queries should not contain nested media queries
163
+
164
+ // Pseudos should not contain nested pseudos, or media queries
152
165
  exports.parseXcss = parseXcss;
153
166
  // unused private functions only so we can extract the return type from a generic function
154
167
  var boxWrapper = function boxWrapper(style) {
@@ -48,7 +48,7 @@ const Box = /*#__PURE__*/forwardRef(({
48
48
  style: style,
49
49
  testId: testId,
50
50
  ref: ref
51
- // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
51
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
52
52
  ,
53
53
  css: className
54
54
  }, safeHtmlAttributes), children);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "0.9.5",
3
+ "version": "0.10.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,9 +1,9 @@
1
1
  import { css } from '@emotion/react';
2
2
  /**
3
3
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
4
- * @codegen <<SignedSource::2c35cc3f884146ac8ccdf053bf413481>>
4
+ * @codegen <<SignedSource::b6657585e3df6f8017d4c35bb9150e3f>>
5
5
  * @codegenId dimensions
6
- * @codegenCommand yarn codegen-styles
6
+ * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
7
7
  * @codegenParams ["dimensions"]
8
8
  * @codegenDependency ../../scripts/codegen-file-templates/dimensions.tsx <<SignedSource::01143ff41135244db1d8ec2efe4339d6>>
9
9
  */
@@ -22,9 +22,9 @@ export const dimensionMap = {
22
22
  */
23
23
  /**
24
24
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
25
- * @codegen <<SignedSource::c32ec2103b151d3533775390e92f0f03>>
25
+ * @codegen <<SignedSource::de092b03d79b8477034921622fcddd53>>
26
26
  * @codegenId spacing
27
- * @codegenCommand yarn codegen-styles
27
+ * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
28
28
  * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::86e173b0e020fe5d091fdf4bff023711>>
29
29
  */
30
30
  export const spaceMap = {
@@ -48,9 +48,9 @@ export const spaceMap = {
48
48
  */
49
49
  /**
50
50
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
51
- * @codegen <<SignedSource::aa1cfa3cd24f141a85ac1e0b70dbd8a8>>
51
+ * @codegen <<SignedSource::98eba397b6a9706307e40f32a49200fd>>
52
52
  * @codegenId colors
53
- * @codegenCommand yarn codegen-styles
53
+ * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
54
54
  * @codegenParams ["border", "background", "shadow", "text", "fill"]
55
55
  * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::10aa7e87eca39e4d6594a764e78e0698>>
56
56
  */
@@ -252,17 +252,17 @@ export const fillMap = {
252
252
  */
253
253
  /**
254
254
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
255
- * @codegen <<SignedSource::e63fc5ff12523b2d49dc72925e1648e6>>
255
+ * @codegen <<SignedSource::7787d50b7bc64a9350e4cf35ae608a79>>
256
256
  * @codegenId misc
257
- * @codegenCommand yarn codegen-styles
257
+ * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
258
258
  * @codegenParams ["align-self", "border-style", "display", "flex-direction", "flex-grow", "flex-shrink", "flex", "layer", "overflow", "position"]
259
259
  * @codegenDependency ../../scripts/codegen-file-templates/align-self.tsx <<SignedSource::074079802534462de54bf882bb2073e5>>
260
260
  * @codegenDependency ../../scripts/codegen-file-templates/border-style.tsx <<SignedSource::87e7e289ffeaac901997c4af98084a5f>>
261
261
  * @codegenDependency ../../scripts/codegen-file-templates/dimensions.tsx <<SignedSource::01143ff41135244db1d8ec2efe4339d6>>
262
- * @codegenDependency ../../scripts/codegen-file-templates/display.tsx <<SignedSource::04ea30fcb3c02f2545af7fdc0206e645>>
262
+ * @codegenDependency ../../scripts/codegen-file-templates/display.tsx <<SignedSource::486569d9e228265c1688d0a7122bdedc>>
263
263
  * @codegenDependency ../../scripts/codegen-file-templates/flex-direction.tsx <<SignedSource::19809ba11675679c188b0d98fb651dc1>>
264
264
  * @codegenDependency ../../scripts/codegen-file-templates/flex-grow.tsx <<SignedSource::b8a06b122cb609170f1f42778a6c270e>>
265
- * @codegenDependency ../../scripts/codegen-file-templates/flex-shrink.tsx <<SignedSource::bf6626972898bf22d2eeee2130693d47>>
265
+ * @codegenDependency ../../scripts/codegen-file-templates/flex-shrink.tsx <<SignedSource::77effeb1e5c39997e34b21b000a91faf>>
266
266
  * @codegenDependency ../../scripts/codegen-file-templates/flex.tsx <<SignedSource::ffa0189d14f1f00a16ec1e9f43a17ce9>>
267
267
  * @codegenDependency ../../scripts/codegen-file-templates/layer.tsx <<SignedSource::79d24a1e558f12d671c06a7609f90dc1>>
268
268
  * @codegenDependency ../../scripts/codegen-file-templates/overflow.tsx <<SignedSource::ccb841f2f51525aed895c06e00f15089>>
@@ -284,7 +284,8 @@ export const displayMap = {
284
284
  block: 'block',
285
285
  inline: 'inline',
286
286
  inlineBlock: 'inline-block',
287
- inlineFlex: 'inline-flex'
287
+ inlineFlex: 'inline-flex',
288
+ grid: 'grid'
288
289
  };
289
290
  export const flexDirectionMap = {
290
291
  row: 'row',
@@ -295,7 +296,7 @@ export const flexGrowMap = {
295
296
  '1': 1
296
297
  };
297
298
  export const flexShrinkMap = {
298
- '0': 0,
299
+ '0': '0',
299
300
  '1': 1
300
301
  };
301
302
  export const flexMap = {
@@ -335,9 +336,9 @@ export const positionMap = {
335
336
  */
336
337
  /**
337
338
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
338
- * @codegen <<SignedSource::80ae367205568f9ca76d35f0cbc9d127>>
339
+ * @codegen <<SignedSource::f923934816cc73cf3f82820a93df5377>>
339
340
  * @codegenId border
340
- * @codegenCommand yarn codegen-styles
341
+ * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
341
342
  * @codegenParams ["width", "radius"]
342
343
  * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-shape.tsx <<SignedSource::81055547b21306c07a3e8a3c734a2f1c>>
343
344
  */
@@ -348,7 +349,7 @@ export const borderWidthMap = {
348
349
  };
349
350
  export const borderRadiusMap = {
350
351
  'radius.050': "var(--ds-radius-050, 2px)",
351
- 'radius.100': "var(--ds-radius-100, 4px)",
352
+ 'radius.100': "var(--ds-radius-100, 3px)",
352
353
  'radius.200': "var(--ds-radius-200, 8px)",
353
354
  'radius.300': "var(--ds-radius-300, 12px)",
354
355
  'radius.400': "var(--ds-radius-400, 16px)",
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
2
2
  import { css as cssEmotion } from '@emotion/react';
3
3
  import warnOnce from '@atlaskit/ds-lib/warn-once';
4
+ import { UNSAFE_media } from '../helpers/responsive';
4
5
  import { alignSelfMap, backgroundColorMap, borderColorMap, borderRadiusMap, borderStyleMap, borderWidthMap, dimensionMap, displayMap, fillMap, flexDirectionMap, flexGrowMap, flexMap, flexShrinkMap, layerMap, overflowBlockMap, overflowInlineMap, overflowMap, positionMap, shadowMap, spaceMap, textColorMap } from './style-maps.partial';
5
6
  const tokensMap = {
6
7
  alignSelf: alignSelfMap,
@@ -67,6 +68,9 @@ const uniqueSymbol = Symbol('UNSAFE_INTERNAL_styles');
67
68
  const isSafeEnvToThrow = () => typeof process === 'object' && typeof process.env === 'object' && process.env.NODE_ENV !== 'production';
68
69
  const reNestedSelectors = /(\.|\s|&+|\*\>|#|\[.*\])/;
69
70
  const rePseudos = /^::?.*$/;
71
+ const reMediaQuery = /^@media .*$/;
72
+ const reValidMediaQuery = new RegExp(`^(${[...Object.values(UNSAFE_media.above), ...Object.values(UNSAFE_media.below)].map(mediaQuery => mediaQuery.replace(/[.()]/g, '\\$&') // Escape the ".", "(", and ")" in the media query syntax.
73
+ ).join('|')})$`);
70
74
  const transformStyles = styleObj => {
71
75
  if (!styleObj || typeof styleObj !== 'object') {
72
76
  return styleObj;
@@ -81,7 +85,7 @@ const transformStyles = styleObj => {
81
85
  Object.entries(styleObj).forEach(([key, value]) => {
82
86
  if (isSafeEnvToThrow()) {
83
87
  // We don't support `.class`, `[data-testid]`, `> *`, `#some-id`
84
- if (reNestedSelectors.test(key)) {
88
+ if (reNestedSelectors.test(key) && !reValidMediaQuery.test(key)) {
85
89
  throw new Error(`Styles not supported for key '${key}'.`);
86
90
  }
87
91
  }
@@ -92,8 +96,10 @@ const transformStyles = styleObj => {
92
96
  styleObj[key] = transformStyles(value);
93
97
  return;
94
98
  }
95
-
96
- // TODO: Deal with media queries
99
+ if (reMediaQuery.test(key)) {
100
+ styleObj[key] = transformStyles(value);
101
+ return;
102
+ }
97
103
 
98
104
  // We have now dealt with all the special cases, so,
99
105
  // check whether what remains is a style property
@@ -103,7 +109,7 @@ const transformStyles = styleObj => {
103
109
  }
104
110
  const tokenValue = tokensMap[key][value];
105
111
  if (!tokenValue) {
106
- const message = `Invalid token alias: ${value}`;
112
+ const message = `Invalid token alias: ${key}: ${value}`;
107
113
  warnOnce(message);
108
114
  }
109
115
  styleObj[key] = tokenValue !== null && tokenValue !== void 0 ? tokenValue : value;
@@ -134,6 +140,11 @@ export const parseXcss = args => {
134
140
  }
135
141
  return styles;
136
142
  };
143
+
144
+ // Media queries should not contain nested media queries
145
+
146
+ // Pseudos should not contain nested pseudos, or media queries
147
+
137
148
  // unused private functions only so we can extract the return type from a generic function
138
149
  const boxWrapper = style => xcss(style);
139
150
  const inlineWrapper = style => xcss(style);
@@ -48,7 +48,7 @@ var Box = /*#__PURE__*/forwardRef(function (_ref, ref) {
48
48
  style: style,
49
49
  testId: testId,
50
50
  ref: ref
51
- // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
51
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
52
52
  ,
53
53
  css: className
54
54
  }, safeHtmlAttributes), children);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "0.9.5",
3
+ "version": "0.10.1",
4
4
  "sideEffects": false
5
5
  }
@@ -2,9 +2,9 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { css } from '@emotion/react';
3
3
  /**
4
4
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
5
- * @codegen <<SignedSource::2c35cc3f884146ac8ccdf053bf413481>>
5
+ * @codegen <<SignedSource::b6657585e3df6f8017d4c35bb9150e3f>>
6
6
  * @codegenId dimensions
7
- * @codegenCommand yarn codegen-styles
7
+ * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
8
8
  * @codegenParams ["dimensions"]
9
9
  * @codegenDependency ../../scripts/codegen-file-templates/dimensions.tsx <<SignedSource::01143ff41135244db1d8ec2efe4339d6>>
10
10
  */
@@ -23,9 +23,9 @@ export var dimensionMap = {
23
23
  */
24
24
  /**
25
25
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
26
- * @codegen <<SignedSource::c32ec2103b151d3533775390e92f0f03>>
26
+ * @codegen <<SignedSource::de092b03d79b8477034921622fcddd53>>
27
27
  * @codegenId spacing
28
- * @codegenCommand yarn codegen-styles
28
+ * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
29
29
  * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::86e173b0e020fe5d091fdf4bff023711>>
30
30
  */
31
31
  export var spaceMap = {
@@ -49,9 +49,9 @@ export var spaceMap = {
49
49
  */
50
50
  /**
51
51
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
52
- * @codegen <<SignedSource::aa1cfa3cd24f141a85ac1e0b70dbd8a8>>
52
+ * @codegen <<SignedSource::98eba397b6a9706307e40f32a49200fd>>
53
53
  * @codegenId colors
54
- * @codegenCommand yarn codegen-styles
54
+ * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
55
55
  * @codegenParams ["border", "background", "shadow", "text", "fill"]
56
56
  * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::10aa7e87eca39e4d6594a764e78e0698>>
57
57
  */
@@ -253,17 +253,17 @@ export var fillMap = {
253
253
  */
254
254
  /**
255
255
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
256
- * @codegen <<SignedSource::e63fc5ff12523b2d49dc72925e1648e6>>
256
+ * @codegen <<SignedSource::7787d50b7bc64a9350e4cf35ae608a79>>
257
257
  * @codegenId misc
258
- * @codegenCommand yarn codegen-styles
258
+ * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
259
259
  * @codegenParams ["align-self", "border-style", "display", "flex-direction", "flex-grow", "flex-shrink", "flex", "layer", "overflow", "position"]
260
260
  * @codegenDependency ../../scripts/codegen-file-templates/align-self.tsx <<SignedSource::074079802534462de54bf882bb2073e5>>
261
261
  * @codegenDependency ../../scripts/codegen-file-templates/border-style.tsx <<SignedSource::87e7e289ffeaac901997c4af98084a5f>>
262
262
  * @codegenDependency ../../scripts/codegen-file-templates/dimensions.tsx <<SignedSource::01143ff41135244db1d8ec2efe4339d6>>
263
- * @codegenDependency ../../scripts/codegen-file-templates/display.tsx <<SignedSource::04ea30fcb3c02f2545af7fdc0206e645>>
263
+ * @codegenDependency ../../scripts/codegen-file-templates/display.tsx <<SignedSource::486569d9e228265c1688d0a7122bdedc>>
264
264
  * @codegenDependency ../../scripts/codegen-file-templates/flex-direction.tsx <<SignedSource::19809ba11675679c188b0d98fb651dc1>>
265
265
  * @codegenDependency ../../scripts/codegen-file-templates/flex-grow.tsx <<SignedSource::b8a06b122cb609170f1f42778a6c270e>>
266
- * @codegenDependency ../../scripts/codegen-file-templates/flex-shrink.tsx <<SignedSource::bf6626972898bf22d2eeee2130693d47>>
266
+ * @codegenDependency ../../scripts/codegen-file-templates/flex-shrink.tsx <<SignedSource::77effeb1e5c39997e34b21b000a91faf>>
267
267
  * @codegenDependency ../../scripts/codegen-file-templates/flex.tsx <<SignedSource::ffa0189d14f1f00a16ec1e9f43a17ce9>>
268
268
  * @codegenDependency ../../scripts/codegen-file-templates/layer.tsx <<SignedSource::79d24a1e558f12d671c06a7609f90dc1>>
269
269
  * @codegenDependency ../../scripts/codegen-file-templates/overflow.tsx <<SignedSource::ccb841f2f51525aed895c06e00f15089>>
@@ -285,7 +285,8 @@ export var displayMap = {
285
285
  block: 'block',
286
286
  inline: 'inline',
287
287
  inlineBlock: 'inline-block',
288
- inlineFlex: 'inline-flex'
288
+ inlineFlex: 'inline-flex',
289
+ grid: 'grid'
289
290
  };
290
291
  export var flexDirectionMap = {
291
292
  row: 'row',
@@ -296,7 +297,7 @@ export var flexGrowMap = {
296
297
  '1': 1
297
298
  };
298
299
  export var flexShrinkMap = {
299
- '0': 0,
300
+ '0': '0',
300
301
  '1': 1
301
302
  };
302
303
  export var flexMap = {
@@ -336,9 +337,9 @@ export var positionMap = {
336
337
  */
337
338
  /**
338
339
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
339
- * @codegen <<SignedSource::80ae367205568f9ca76d35f0cbc9d127>>
340
+ * @codegen <<SignedSource::f923934816cc73cf3f82820a93df5377>>
340
341
  * @codegenId border
341
- * @codegenCommand yarn codegen-styles
342
+ * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
342
343
  * @codegenParams ["width", "radius"]
343
344
  * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-shape.tsx <<SignedSource::81055547b21306c07a3e8a3c734a2f1c>>
344
345
  */
@@ -349,7 +350,7 @@ export var borderWidthMap = {
349
350
  };
350
351
  export var borderRadiusMap = {
351
352
  'radius.050': "var(--ds-radius-050, 2px)",
352
- 'radius.100': "var(--ds-radius-100, 4px)",
353
+ 'radius.100': "var(--ds-radius-100, 3px)",
353
354
  'radius.200': "var(--ds-radius-200, 8px)",
354
355
  'radius.300': "var(--ds-radius-300, 12px)",
355
356
  'radius.400': "var(--ds-radius-400, 16px)",
@@ -1,9 +1,11 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
4
  import _typeof from "@babel/runtime/helpers/typeof";
4
5
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
5
6
  import { css as cssEmotion } from '@emotion/react';
6
7
  import warnOnce from '@atlaskit/ds-lib/warn-once';
8
+ import { UNSAFE_media } from '../helpers/responsive';
7
9
  import { alignSelfMap, backgroundColorMap, borderColorMap, borderRadiusMap, borderStyleMap, borderWidthMap, dimensionMap, displayMap, fillMap, flexDirectionMap, flexGrowMap, flexMap, flexShrinkMap, layerMap, overflowBlockMap, overflowInlineMap, overflowMap, positionMap, shadowMap, spaceMap, textColorMap } from './style-maps.partial';
8
10
  var tokensMap = {
9
11
  alignSelf: alignSelfMap,
@@ -72,6 +74,11 @@ var isSafeEnvToThrow = function isSafeEnvToThrow() {
72
74
  };
73
75
  var reNestedSelectors = /(\.|\s|&+|\*\>|#|\[.*\])/;
74
76
  var rePseudos = /^::?.*$/;
77
+ var reMediaQuery = /^@media .*$/;
78
+ var reValidMediaQuery = new RegExp("^(".concat([].concat(_toConsumableArray(Object.values(UNSAFE_media.above)), _toConsumableArray(Object.values(UNSAFE_media.below))).map(function (mediaQuery) {
79
+ return mediaQuery.replace(/[.()]/g, '\\$&');
80
+ } // Escape the ".", "(", and ")" in the media query syntax.
81
+ ).join('|'), ")$"));
75
82
  var transformStyles = function transformStyles(styleObj) {
76
83
  if (!styleObj || _typeof(styleObj) !== 'object') {
77
84
  return styleObj;
@@ -89,7 +96,7 @@ var transformStyles = function transformStyles(styleObj) {
89
96
  value = _ref2[1];
90
97
  if (isSafeEnvToThrow()) {
91
98
  // We don't support `.class`, `[data-testid]`, `> *`, `#some-id`
92
- if (reNestedSelectors.test(key)) {
99
+ if (reNestedSelectors.test(key) && !reValidMediaQuery.test(key)) {
93
100
  throw new Error("Styles not supported for key '".concat(key, "'."));
94
101
  }
95
102
  }
@@ -100,8 +107,10 @@ var transformStyles = function transformStyles(styleObj) {
100
107
  styleObj[key] = transformStyles(value);
101
108
  return;
102
109
  }
103
-
104
- // TODO: Deal with media queries
110
+ if (reMediaQuery.test(key)) {
111
+ styleObj[key] = transformStyles(value);
112
+ return;
113
+ }
105
114
 
106
115
  // We have now dealt with all the special cases, so,
107
116
  // check whether what remains is a style property
@@ -111,7 +120,7 @@ var transformStyles = function transformStyles(styleObj) {
111
120
  }
112
121
  var tokenValue = tokensMap[key][value];
113
122
  if (!tokenValue) {
114
- var message = "Invalid token alias: ".concat(value);
123
+ var message = "Invalid token alias: ".concat(key, ": ").concat(value);
115
124
  warnOnce(message);
116
125
  }
117
126
  styleObj[key] = tokenValue !== null && tokenValue !== void 0 ? tokenValue : value;
@@ -140,6 +149,11 @@ export var parseXcss = function parseXcss(args) {
140
149
  }
141
150
  return styles;
142
151
  };
152
+
153
+ // Media queries should not contain nested media queries
154
+
155
+ // Pseudos should not contain nested pseudos, or media queries
156
+
143
157
  // unused private functions only so we can extract the return type from a generic function
144
158
  var boxWrapper = function boxWrapper(style) {
145
159
  return xcss(style);
@@ -1,9 +1,11 @@
1
1
  import { SerializedStyles } from '@emotion/react';
2
2
  import { token } from '@atlaskit/tokens';
3
+ import { UNSAFE_media } from './media-helper';
3
4
  /**
4
5
  * The breakpoints we have for responsiveness.
5
6
  */
6
7
  export type Breakpoint = 'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
8
+ export type MediaQuery = (typeof UNSAFE_media.above)[Breakpoint] | (typeof UNSAFE_media.below)[Exclude<Breakpoint, 'xxs'>];
7
9
  /**
8
10
  * An object type mapping a value to each breakpoint (optionally)
9
11
  */
@@ -1,9 +1,9 @@
1
1
  import { SerializedStyles } from '@emotion/react';
2
2
  /**
3
3
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
4
- * @codegen <<SignedSource::2c35cc3f884146ac8ccdf053bf413481>>
4
+ * @codegen <<SignedSource::b6657585e3df6f8017d4c35bb9150e3f>>
5
5
  * @codegenId dimensions
6
- * @codegenCommand yarn codegen-styles
6
+ * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
7
7
  * @codegenParams ["dimensions"]
8
8
  * @codegenDependency ../../scripts/codegen-file-templates/dimensions.tsx <<SignedSource::01143ff41135244db1d8ec2efe4339d6>>
9
9
  */
@@ -39,9 +39,9 @@ export type MinInlineSize = Dimension;
39
39
  */
40
40
  /**
41
41
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
42
- * @codegen <<SignedSource::c32ec2103b151d3533775390e92f0f03>>
42
+ * @codegen <<SignedSource::de092b03d79b8477034921622fcddd53>>
43
43
  * @codegenId spacing
44
- * @codegenCommand yarn codegen-styles
44
+ * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
45
45
  * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::86e173b0e020fe5d091fdf4bff023711>>
46
46
  */
47
47
  export declare const spaceMap: {
@@ -66,9 +66,9 @@ export type Space = keyof typeof spaceMap;
66
66
  */
67
67
  /**
68
68
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
69
- * @codegen <<SignedSource::aa1cfa3cd24f141a85ac1e0b70dbd8a8>>
69
+ * @codegen <<SignedSource::98eba397b6a9706307e40f32a49200fd>>
70
70
  * @codegenId colors
71
- * @codegenCommand yarn codegen-styles
71
+ * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
72
72
  * @codegenParams ["border", "background", "shadow", "text", "fill"]
73
73
  * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::10aa7e87eca39e4d6594a764e78e0698>>
74
74
  */
@@ -275,17 +275,17 @@ export type Fill = keyof typeof fillMap;
275
275
  */
276
276
  /**
277
277
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
278
- * @codegen <<SignedSource::e63fc5ff12523b2d49dc72925e1648e6>>
278
+ * @codegen <<SignedSource::7787d50b7bc64a9350e4cf35ae608a79>>
279
279
  * @codegenId misc
280
- * @codegenCommand yarn codegen-styles
280
+ * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
281
281
  * @codegenParams ["align-self", "border-style", "display", "flex-direction", "flex-grow", "flex-shrink", "flex", "layer", "overflow", "position"]
282
282
  * @codegenDependency ../../scripts/codegen-file-templates/align-self.tsx <<SignedSource::074079802534462de54bf882bb2073e5>>
283
283
  * @codegenDependency ../../scripts/codegen-file-templates/border-style.tsx <<SignedSource::87e7e289ffeaac901997c4af98084a5f>>
284
284
  * @codegenDependency ../../scripts/codegen-file-templates/dimensions.tsx <<SignedSource::01143ff41135244db1d8ec2efe4339d6>>
285
- * @codegenDependency ../../scripts/codegen-file-templates/display.tsx <<SignedSource::04ea30fcb3c02f2545af7fdc0206e645>>
285
+ * @codegenDependency ../../scripts/codegen-file-templates/display.tsx <<SignedSource::486569d9e228265c1688d0a7122bdedc>>
286
286
  * @codegenDependency ../../scripts/codegen-file-templates/flex-direction.tsx <<SignedSource::19809ba11675679c188b0d98fb651dc1>>
287
287
  * @codegenDependency ../../scripts/codegen-file-templates/flex-grow.tsx <<SignedSource::b8a06b122cb609170f1f42778a6c270e>>
288
- * @codegenDependency ../../scripts/codegen-file-templates/flex-shrink.tsx <<SignedSource::bf6626972898bf22d2eeee2130693d47>>
288
+ * @codegenDependency ../../scripts/codegen-file-templates/flex-shrink.tsx <<SignedSource::77effeb1e5c39997e34b21b000a91faf>>
289
289
  * @codegenDependency ../../scripts/codegen-file-templates/flex.tsx <<SignedSource::ffa0189d14f1f00a16ec1e9f43a17ce9>>
290
290
  * @codegenDependency ../../scripts/codegen-file-templates/layer.tsx <<SignedSource::79d24a1e558f12d671c06a7609f90dc1>>
291
291
  * @codegenDependency ../../scripts/codegen-file-templates/overflow.tsx <<SignedSource::ccb841f2f51525aed895c06e00f15089>>
@@ -310,6 +310,7 @@ export declare const displayMap: {
310
310
  readonly inline: "inline";
311
311
  readonly inlineBlock: "inline-block";
312
312
  readonly inlineFlex: "inline-flex";
313
+ readonly grid: "grid";
313
314
  };
314
315
  export type Display = keyof typeof displayMap;
315
316
  export declare const flexDirectionMap: {
@@ -323,7 +324,7 @@ export declare const flexGrowMap: {
323
324
  };
324
325
  export type FlexGrow = keyof typeof flexGrowMap;
325
326
  export declare const flexShrinkMap: {
326
- readonly '0': 0;
327
+ readonly '0': "0";
327
328
  readonly '1': 1;
328
329
  };
329
330
  export type FlexShrink = keyof typeof flexShrinkMap;
@@ -370,9 +371,9 @@ export type Position = keyof typeof positionMap;
370
371
  */
371
372
  /**
372
373
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
373
- * @codegen <<SignedSource::80ae367205568f9ca76d35f0cbc9d127>>
374
+ * @codegen <<SignedSource::f923934816cc73cf3f82820a93df5377>>
374
375
  * @codegenId border
375
- * @codegenCommand yarn codegen-styles
376
+ * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
376
377
  * @codegenParams ["width", "radius"]
377
378
  * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-shape.tsx <<SignedSource::81055547b21306c07a3e8a3c734a2f1c>>
378
379
  */
@@ -2,6 +2,7 @@
2
2
  import { css as cssEmotion } from '@emotion/react';
3
3
  import { CSSPropertiesWithMultiValues, SerializedStyles } from '@emotion/serialize';
4
4
  import type * as CSS from 'csstype';
5
+ import { MediaQuery } from '../helpers/responsive/types';
5
6
  import { Box, Inline } from '../index';
6
7
  import { TokenisedProps } from './style-maps.partial';
7
8
  declare const uniqueSymbol: unique symbol;
@@ -11,10 +12,13 @@ declare const uniqueSymbol: unique symbol;
11
12
  */
12
13
  type ParsedXcss = ReturnType<typeof cssEmotion> | ReturnType<typeof cssEmotion>[];
13
14
  export declare const parseXcss: (args: XCSS | Array<XCSS | false | undefined>) => ParsedXcss;
15
+ type CSSMediaQueries = {
16
+ [MQ in MediaQuery]?: Omit<SafeCSSObject, MediaQuery>;
17
+ };
14
18
  type CSSPseudos = {
15
- [Pseudo in CSS.Pseudos]?: SafeCSSObject;
19
+ [Pseudo in CSS.Pseudos]?: Omit<SafeCSSObject, CSS.Pseudos | MediaQuery>;
16
20
  };
17
- type SafeCSSObject = CSSPseudos & TokenisedProps & Omit<CSSPropertiesWithMultiValues, keyof TokenisedProps>;
21
+ type SafeCSSObject = CSSPseudos & TokenisedProps & CSSMediaQueries & Omit<CSSPropertiesWithMultiValues, keyof TokenisedProps>;
18
22
  type ScopedSafeCSSObject<T extends keyof SafeCSSObject> = Pick<SafeCSSObject, T>;
19
23
  declare const boxWrapper: (style: any) => {
20
24
  readonly [uniqueSymbol]: BoxStyles;
@@ -1,9 +1,11 @@
1
1
  import { SerializedStyles } from '@emotion/react';
2
2
  import { token } from '@atlaskit/tokens';
3
+ import { UNSAFE_media } from './media-helper';
3
4
  /**
4
5
  * The breakpoints we have for responsiveness.
5
6
  */
6
7
  export type Breakpoint = 'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
8
+ export type MediaQuery = (typeof UNSAFE_media.above)[Breakpoint] | (typeof UNSAFE_media.below)[Exclude<Breakpoint, 'xxs'>];
7
9
  /**
8
10
  * An object type mapping a value to each breakpoint (optionally)
9
11
  */
@@ -1,9 +1,9 @@
1
1
  import { SerializedStyles } from '@emotion/react';
2
2
  /**
3
3
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
4
- * @codegen <<SignedSource::2c35cc3f884146ac8ccdf053bf413481>>
4
+ * @codegen <<SignedSource::b6657585e3df6f8017d4c35bb9150e3f>>
5
5
  * @codegenId dimensions
6
- * @codegenCommand yarn codegen-styles
6
+ * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
7
7
  * @codegenParams ["dimensions"]
8
8
  * @codegenDependency ../../scripts/codegen-file-templates/dimensions.tsx <<SignedSource::01143ff41135244db1d8ec2efe4339d6>>
9
9
  */
@@ -39,9 +39,9 @@ export type MinInlineSize = Dimension;
39
39
  */
40
40
  /**
41
41
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
42
- * @codegen <<SignedSource::c32ec2103b151d3533775390e92f0f03>>
42
+ * @codegen <<SignedSource::de092b03d79b8477034921622fcddd53>>
43
43
  * @codegenId spacing
44
- * @codegenCommand yarn codegen-styles
44
+ * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
45
45
  * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::86e173b0e020fe5d091fdf4bff023711>>
46
46
  */
47
47
  export declare const spaceMap: {
@@ -66,9 +66,9 @@ export type Space = keyof typeof spaceMap;
66
66
  */
67
67
  /**
68
68
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
69
- * @codegen <<SignedSource::aa1cfa3cd24f141a85ac1e0b70dbd8a8>>
69
+ * @codegen <<SignedSource::98eba397b6a9706307e40f32a49200fd>>
70
70
  * @codegenId colors
71
- * @codegenCommand yarn codegen-styles
71
+ * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
72
72
  * @codegenParams ["border", "background", "shadow", "text", "fill"]
73
73
  * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::10aa7e87eca39e4d6594a764e78e0698>>
74
74
  */
@@ -275,17 +275,17 @@ export type Fill = keyof typeof fillMap;
275
275
  */
276
276
  /**
277
277
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
278
- * @codegen <<SignedSource::e63fc5ff12523b2d49dc72925e1648e6>>
278
+ * @codegen <<SignedSource::7787d50b7bc64a9350e4cf35ae608a79>>
279
279
  * @codegenId misc
280
- * @codegenCommand yarn codegen-styles
280
+ * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
281
281
  * @codegenParams ["align-self", "border-style", "display", "flex-direction", "flex-grow", "flex-shrink", "flex", "layer", "overflow", "position"]
282
282
  * @codegenDependency ../../scripts/codegen-file-templates/align-self.tsx <<SignedSource::074079802534462de54bf882bb2073e5>>
283
283
  * @codegenDependency ../../scripts/codegen-file-templates/border-style.tsx <<SignedSource::87e7e289ffeaac901997c4af98084a5f>>
284
284
  * @codegenDependency ../../scripts/codegen-file-templates/dimensions.tsx <<SignedSource::01143ff41135244db1d8ec2efe4339d6>>
285
- * @codegenDependency ../../scripts/codegen-file-templates/display.tsx <<SignedSource::04ea30fcb3c02f2545af7fdc0206e645>>
285
+ * @codegenDependency ../../scripts/codegen-file-templates/display.tsx <<SignedSource::486569d9e228265c1688d0a7122bdedc>>
286
286
  * @codegenDependency ../../scripts/codegen-file-templates/flex-direction.tsx <<SignedSource::19809ba11675679c188b0d98fb651dc1>>
287
287
  * @codegenDependency ../../scripts/codegen-file-templates/flex-grow.tsx <<SignedSource::b8a06b122cb609170f1f42778a6c270e>>
288
- * @codegenDependency ../../scripts/codegen-file-templates/flex-shrink.tsx <<SignedSource::bf6626972898bf22d2eeee2130693d47>>
288
+ * @codegenDependency ../../scripts/codegen-file-templates/flex-shrink.tsx <<SignedSource::77effeb1e5c39997e34b21b000a91faf>>
289
289
  * @codegenDependency ../../scripts/codegen-file-templates/flex.tsx <<SignedSource::ffa0189d14f1f00a16ec1e9f43a17ce9>>
290
290
  * @codegenDependency ../../scripts/codegen-file-templates/layer.tsx <<SignedSource::79d24a1e558f12d671c06a7609f90dc1>>
291
291
  * @codegenDependency ../../scripts/codegen-file-templates/overflow.tsx <<SignedSource::ccb841f2f51525aed895c06e00f15089>>
@@ -310,6 +310,7 @@ export declare const displayMap: {
310
310
  readonly inline: "inline";
311
311
  readonly inlineBlock: "inline-block";
312
312
  readonly inlineFlex: "inline-flex";
313
+ readonly grid: "grid";
313
314
  };
314
315
  export type Display = keyof typeof displayMap;
315
316
  export declare const flexDirectionMap: {
@@ -323,7 +324,7 @@ export declare const flexGrowMap: {
323
324
  };
324
325
  export type FlexGrow = keyof typeof flexGrowMap;
325
326
  export declare const flexShrinkMap: {
326
- readonly '0': 0;
327
+ readonly '0': "0";
327
328
  readonly '1': 1;
328
329
  };
329
330
  export type FlexShrink = keyof typeof flexShrinkMap;
@@ -370,9 +371,9 @@ export type Position = keyof typeof positionMap;
370
371
  */
371
372
  /**
372
373
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
373
- * @codegen <<SignedSource::80ae367205568f9ca76d35f0cbc9d127>>
374
+ * @codegen <<SignedSource::f923934816cc73cf3f82820a93df5377>>
374
375
  * @codegenId border
375
- * @codegenCommand yarn codegen-styles
376
+ * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
376
377
  * @codegenParams ["width", "radius"]
377
378
  * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-shape.tsx <<SignedSource::81055547b21306c07a3e8a3c734a2f1c>>
378
379
  */
@@ -2,6 +2,7 @@
2
2
  import { css as cssEmotion } from '@emotion/react';
3
3
  import { CSSPropertiesWithMultiValues, SerializedStyles } from '@emotion/serialize';
4
4
  import type * as CSS from 'csstype';
5
+ import { MediaQuery } from '../helpers/responsive/types';
5
6
  import { Box, Inline } from '../index';
6
7
  import { TokenisedProps } from './style-maps.partial';
7
8
  declare const uniqueSymbol: unique symbol;
@@ -11,10 +12,13 @@ declare const uniqueSymbol: unique symbol;
11
12
  */
12
13
  type ParsedXcss = ReturnType<typeof cssEmotion> | ReturnType<typeof cssEmotion>[];
13
14
  export declare const parseXcss: (args: XCSS | Array<XCSS | false | undefined>) => ParsedXcss;
15
+ type CSSMediaQueries = {
16
+ [MQ in MediaQuery]?: Omit<SafeCSSObject, MediaQuery>;
17
+ };
14
18
  type CSSPseudos = {
15
- [Pseudo in CSS.Pseudos]?: SafeCSSObject;
19
+ [Pseudo in CSS.Pseudos]?: Omit<SafeCSSObject, CSS.Pseudos | MediaQuery>;
16
20
  };
17
- type SafeCSSObject = CSSPseudos & TokenisedProps & Omit<CSSPropertiesWithMultiValues, keyof TokenisedProps>;
21
+ type SafeCSSObject = CSSPseudos & TokenisedProps & CSSMediaQueries & Omit<CSSPropertiesWithMultiValues, keyof TokenisedProps>;
18
22
  type ScopedSafeCSSObject<T extends keyof SafeCSSObject> = Pick<SafeCSSObject, T>;
19
23
  declare const boxWrapper: (style: any) => {
20
24
  readonly [uniqueSymbol]: BoxStyles;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "0.9.5",
3
+ "version": "0.10.1",
4
4
  "description": "Primitives are token-backed low-level building blocks.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -69,7 +69,7 @@
69
69
  }
70
70
  },
71
71
  "scripts": {
72
- "codegen-styles": "ts-node --project ./tsconfig.node.json ./scripts/codegen-styles"
72
+ "codegen-styles": "ts-node -r tsconfig-paths/register ./scripts/codegen-styles.tsx"
73
73
  },
74
74
  "main": "dist/cjs/index.js",
75
75
  "module": "dist/esm/index.js",
@@ -122,7 +122,7 @@
122
122
  "@atlaskit/visual-regression": "*",
123
123
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
124
124
  "@atlassian/codegen": "^0.1.0",
125
- "@atlassian/gemini-visual-regression": "^0.0.24",
125
+ "@atlassian/gemini-visual-regression": "^0.0.27",
126
126
  "@testing-library/react": "^12.1.5",
127
127
  "csstype": "^3.1.0",
128
128
  "prettier": "^2.8.0",
package/report.api.md CHANGED
@@ -316,9 +316,17 @@ type BoxXCSS = {
316
316
  readonly [uniqueSymbol]: BoxStyles;
317
317
  };
318
318
 
319
+ // @public
320
+ type Breakpoint = 'lg' | 'md' | 'sm' | 'xl' | 'xs' | 'xxl' | 'xxs';
321
+
322
+ // @public (undocumented)
323
+ type CSSMediaQueries = {
324
+ [MQ in MediaQuery]?: Omit<SafeCSSObject, MediaQuery>;
325
+ };
326
+
319
327
  // @public (undocumented)
320
328
  type CSSPseudos = {
321
- [Pseudo in CSS_2.Pseudos]?: SafeCSSObject;
329
+ [Pseudo in CSS_2.Pseudos]?: Omit<SafeCSSObject, CSS_2.Pseudos | MediaQuery>;
322
330
  };
323
331
 
324
332
  // @public (undocumented)
@@ -346,6 +354,7 @@ const displayMap: {
346
354
  readonly inline: 'inline';
347
355
  readonly inlineBlock: 'inline-block';
348
356
  readonly inlineFlex: 'inline-flex';
357
+ readonly grid: 'grid';
349
358
  };
350
359
 
351
360
  // @public (undocumented)
@@ -407,7 +416,7 @@ type FlexShrink = keyof typeof flexShrinkMap;
407
416
 
408
417
  // @public (undocumented)
409
418
  const flexShrinkMap: {
410
- readonly '0': 0;
419
+ readonly '0': '0';
411
420
  readonly '1': 1;
412
421
  };
413
422
 
@@ -499,6 +508,11 @@ type MaxInlineSize = Dimension;
499
508
  // @public (undocumented)
500
509
  type MaxWidth = Dimension;
501
510
 
511
+ // @public (undocumented)
512
+ type MediaQuery =
513
+ | (typeof UNSAFE_media.above)[Breakpoint]
514
+ | (typeof UNSAFE_media.below)[Exclude<Breakpoint, 'xxs'>];
515
+
502
516
  // @public (undocumented)
503
517
  type MinBlockSize = Dimension;
504
518
 
@@ -560,6 +574,7 @@ type Right = Dimension;
560
574
  // @public (undocumented)
561
575
  type SafeCSSObject = CSSPseudos &
562
576
  TokenisedProps &
577
+ CSSMediaQueries &
563
578
  Omit<CSSPropertiesWithMultiValues, keyof TokenisedProps>;
564
579
 
565
580
  // @public (undocumented)
@@ -741,6 +756,27 @@ type Top = Dimension;
741
756
  // @public (undocumented)
742
757
  const uniqueSymbol: unique symbol;
743
758
 
759
+ // @public
760
+ const UNSAFE_media: {
761
+ readonly above: {
762
+ readonly xxs: `@media (min-width: ${number}rem)`;
763
+ readonly xs: `@media (min-width: ${number}rem)`;
764
+ readonly sm: `@media (min-width: ${number}rem)`;
765
+ readonly md: `@media (min-width: ${number}rem)`;
766
+ readonly lg: `@media (min-width: ${number}rem)`;
767
+ readonly xl: `@media (min-width: ${number}rem)`;
768
+ readonly xxl: `@media (min-width: ${number}rem)`;
769
+ };
770
+ readonly below: {
771
+ readonly xs: `@media (max-width: ${number}rem)`;
772
+ readonly sm: `@media (max-width: ${number}rem)`;
773
+ readonly md: `@media (max-width: ${number}rem)`;
774
+ readonly lg: `@media (max-width: ${number}rem)`;
775
+ readonly xl: `@media (max-width: ${number}rem)`;
776
+ readonly xxl: `@media (max-width: ${number}rem)`;
777
+ };
778
+ };
779
+
744
780
  // @public (undocumented)
745
781
  type Width = Dimension;
746
782
 
@@ -36,7 +36,7 @@ const activeTokens = tokens
36
36
  .map(
37
37
  (t): Token => ({
38
38
  token: t.name,
39
- fallback: t.value as string,
39
+ fallback: t.value === '4px' ? '3px' : (t.value as string),
40
40
  isDeprecated: t.attributes.state === 'deprecated',
41
41
  }),
42
42
  );
@@ -4,6 +4,7 @@ export const displayMap = {
4
4
  inline: 'inline',
5
5
  inlineBlock: 'inline-block',
6
6
  inlineFlex: 'inline-flex',
7
+ grid: 'grid',
7
8
  } as const;
8
9
 
9
10
  export type Display = keyof typeof displayMap;
@@ -1,5 +1,5 @@
1
1
  export const flexShrinkMap = {
2
- '0': 0,
2
+ '0': '0',
3
3
  '1': 1,
4
4
  } as const;
5
5
 
@@ -38,7 +38,7 @@ const sourceFns = [
38
38
  () =>
39
39
  createPartialSignedArtifact(
40
40
  options => options.map(createStylesFromFileTemplate).join('\n'),
41
- 'yarn codegen-styles',
41
+ 'yarn workspace @atlaskit/primitives codegen-styles',
42
42
  {
43
43
  id: 'dimensions',
44
44
  absoluteFilePath: targetPath,
@@ -49,7 +49,7 @@ const sourceFns = [
49
49
  () =>
50
50
  createPartialSignedArtifact(
51
51
  createSpacingStylesFromTemplate,
52
- 'yarn codegen-styles',
52
+ 'yarn workspace @atlaskit/primitives codegen-styles',
53
53
  {
54
54
  id: 'spacing',
55
55
  absoluteFilePath: targetPath,
@@ -60,7 +60,7 @@ const sourceFns = [
60
60
  () =>
61
61
  createPartialSignedArtifact(
62
62
  options => options.map(createColorStylesFromTemplate).join('\n'),
63
- 'yarn codegen-styles',
63
+ 'yarn workspace @atlaskit/primitives codegen-styles',
64
64
  {
65
65
  id: 'colors',
66
66
  absoluteFilePath: targetPath,
@@ -71,7 +71,7 @@ const sourceFns = [
71
71
  () =>
72
72
  createPartialSignedArtifact(
73
73
  options => options.map(createBorderStylesFromTemplate).join('\n'),
74
- 'yarn codegen-styles',
74
+ 'yarn workspace @atlaskit/primitives codegen-styles',
75
75
  {
76
76
  id: 'border',
77
77
  absoluteFilePath: targetPath,
@@ -82,7 +82,7 @@ const sourceFns = [
82
82
  () =>
83
83
  createPartialSignedArtifact(
84
84
  options => options.map(createStylesFromFileTemplate).join('\n'),
85
- 'yarn codegen-styles',
85
+ 'yarn workspace @atlaskit/primitives codegen-styles',
86
86
  {
87
87
  id: 'misc',
88
88
  absoluteFilePath: targetPath,
@@ -278,9 +278,17 @@ type BoxXCSS = {
278
278
  readonly [uniqueSymbol]: BoxStyles;
279
279
  };
280
280
 
281
+ // @public
282
+ type Breakpoint = 'lg' | 'md' | 'sm' | 'xl' | 'xs' | 'xxl' | 'xxs';
283
+
284
+ // @public (undocumented)
285
+ type CSSMediaQueries = {
286
+ [MQ in MediaQuery]?: Omit<SafeCSSObject, MediaQuery>;
287
+ };
288
+
281
289
  // @public (undocumented)
282
290
  type CSSPseudos = {
283
- [Pseudo in CSS_2.Pseudos]?: SafeCSSObject;
291
+ [Pseudo in CSS_2.Pseudos]?: Omit<SafeCSSObject, CSS_2.Pseudos | MediaQuery>;
284
292
  };
285
293
 
286
294
  // @public (undocumented)
@@ -308,6 +316,7 @@ const displayMap: {
308
316
  readonly inline: "inline";
309
317
  readonly inlineBlock: "inline-block";
310
318
  readonly inlineFlex: "inline-flex";
319
+ readonly grid: "grid";
311
320
  };
312
321
 
313
322
  // @public (undocumented)
@@ -369,7 +378,7 @@ type FlexShrink = keyof typeof flexShrinkMap;
369
378
 
370
379
  // @public (undocumented)
371
380
  const flexShrinkMap: {
372
- readonly '0': 0;
381
+ readonly '0': "0";
373
382
  readonly '1': 1;
374
383
  };
375
384
 
@@ -443,6 +452,9 @@ type MaxInlineSize = Dimension;
443
452
  // @public (undocumented)
444
453
  type MaxWidth = Dimension;
445
454
 
455
+ // @public (undocumented)
456
+ type MediaQuery = (typeof UNSAFE_media.above)[Breakpoint] | (typeof UNSAFE_media.below)[Exclude<Breakpoint, 'xxs'>];
457
+
446
458
  // @public (undocumented)
447
459
  type MinBlockSize = Dimension;
448
460
 
@@ -502,7 +514,7 @@ type PublicBoxPropsBase = {
502
514
  type Right = Dimension;
503
515
 
504
516
  // @public (undocumented)
505
- type SafeCSSObject = CSSPseudos & TokenisedProps & Omit<CSSPropertiesWithMultiValues, keyof TokenisedProps>;
517
+ type SafeCSSObject = CSSPseudos & TokenisedProps & CSSMediaQueries & Omit<CSSPropertiesWithMultiValues, keyof TokenisedProps>;
506
518
 
507
519
  // @public (undocumented)
508
520
  type ScopedSafeCSSObject<T extends keyof SafeCSSObject> = Pick<SafeCSSObject, T>;
@@ -665,6 +677,27 @@ type Top = Dimension;
665
677
  // @public (undocumented)
666
678
  const uniqueSymbol: unique symbol;
667
679
 
680
+ // @public
681
+ const UNSAFE_media: {
682
+ readonly above: {
683
+ readonly xxs: `@media (min-width: ${number}rem)`;
684
+ readonly xs: `@media (min-width: ${number}rem)`;
685
+ readonly sm: `@media (min-width: ${number}rem)`;
686
+ readonly md: `@media (min-width: ${number}rem)`;
687
+ readonly lg: `@media (min-width: ${number}rem)`;
688
+ readonly xl: `@media (min-width: ${number}rem)`;
689
+ readonly xxl: `@media (min-width: ${number}rem)`;
690
+ };
691
+ readonly below: {
692
+ readonly xs: `@media (max-width: ${number}rem)`;
693
+ readonly sm: `@media (max-width: ${number}rem)`;
694
+ readonly md: `@media (max-width: ${number}rem)`;
695
+ readonly lg: `@media (max-width: ${number}rem)`;
696
+ readonly xl: `@media (max-width: ${number}rem)`;
697
+ readonly xxl: `@media (max-width: ${number}rem)`;
698
+ };
699
+ };
700
+
668
701
  // @public (undocumented)
669
702
  type Width = Dimension;
670
703
 
@@ -1,7 +0,0 @@
1
- {
2
- "extends": "../../../tsconfig.node.json",
3
- "ts-node": {
4
- // TODO: Remove this line when/if ../../../tsconfig.node.json adds it instead: https://atlassian.slack.com/archives/C048B3HSFB9/p1684121217771909
5
- "require": ["tsconfig-paths/register"]
6
- }
7
- }