@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.
- package/CHANGELOG.md +19 -0
- package/codemods/compiled-fork-stage1/transform.tsx +178 -17
- package/components/flex/package.json +17 -0
- package/constellation/pressable/usage.mdx +2 -0
- package/dist/cjs/compiled/components/box.js +2 -2
- package/dist/cjs/compiled/components/text.compiled.css +0 -1
- package/dist/cjs/compiled/components/text.js +0 -1
- package/dist/cjs/components/box.js +2 -2
- package/dist/cjs/responsive/build-media-query-css.js +14 -71
- package/dist/cjs/responsive/hide.js +4 -3
- package/dist/cjs/responsive/media-helper.js +8 -37
- package/dist/cjs/responsive/media.js +31 -0
- package/dist/cjs/responsive/show.js +4 -3
- package/dist/cjs/responsive/unsafe-build-above-media-query-css.js +43 -0
- package/dist/cjs/responsive/unsafe-build-below-media-query-css.js +45 -0
- package/dist/cjs/utils/surface-context.js +13 -0
- package/dist/cjs/utils/surface-provider.js +10 -10
- package/dist/cjs/xcss/style-maps.partial.js +2 -5
- package/dist/es2019/compiled/components/box.js +1 -1
- package/dist/es2019/compiled/components/text.compiled.css +0 -1
- package/dist/es2019/compiled/components/text.js +0 -1
- package/dist/es2019/components/box.js +1 -1
- package/dist/es2019/responsive/build-media-query-css.js +2 -75
- package/dist/es2019/responsive/hide.js +2 -1
- package/dist/es2019/responsive/media-helper.js +3 -37
- package/dist/es2019/responsive/media.js +25 -0
- package/dist/es2019/responsive/show.js +2 -1
- package/dist/es2019/responsive/unsafe-build-above-media-query-css.js +38 -0
- package/dist/es2019/responsive/unsafe-build-below-media-query-css.js +42 -0
- package/dist/es2019/utils/surface-context.js +7 -0
- package/dist/es2019/utils/surface-provider.js +4 -9
- package/dist/es2019/xcss/style-maps.partial.js +2 -5
- package/dist/esm/compiled/components/box.js +1 -1
- package/dist/esm/compiled/components/text.compiled.css +0 -1
- package/dist/esm/compiled/components/text.js +0 -1
- package/dist/esm/components/box.js +1 -1
- package/dist/esm/responsive/build-media-query-css.js +2 -68
- package/dist/esm/responsive/hide.js +2 -1
- package/dist/esm/responsive/media-helper.js +3 -37
- package/dist/esm/responsive/media.js +25 -0
- package/dist/esm/responsive/show.js +2 -1
- package/dist/esm/responsive/unsafe-build-above-media-query-css.js +37 -0
- package/dist/esm/responsive/unsafe-build-below-media-query-css.js +39 -0
- package/dist/esm/utils/surface-context.js +7 -0
- package/dist/esm/utils/surface-provider.js +4 -9
- package/dist/esm/xcss/style-maps.partial.js +2 -5
- package/dist/types/compiled/components/types.d.ts +1 -1
- package/dist/types/responsive/build-media-query-css.d.ts +2 -63
- package/dist/types/responsive/media-helper.d.ts +1 -35
- package/dist/types/responsive/media.d.ts +25 -0
- package/dist/types/responsive/types.d.ts +1 -1
- package/dist/types/responsive/unsafe-build-above-media-query-css.d.ts +33 -0
- package/dist/types/responsive/unsafe-build-below-media-query-css.d.ts +32 -0
- package/dist/types/utils/surface-context.d.ts +8 -0
- package/dist/types/utils/surface-provider.d.ts +1 -7
- package/dist/types/xcss/style-maps.partial.d.ts +2 -4
- package/dist/types-ts4.5/compiled/components/types.d.ts +1 -1
- package/dist/types-ts4.5/responsive/build-media-query-css.d.ts +2 -63
- package/dist/types-ts4.5/responsive/media-helper.d.ts +1 -35
- package/dist/types-ts4.5/responsive/media.d.ts +25 -0
- package/dist/types-ts4.5/responsive/types.d.ts +1 -1
- package/dist/types-ts4.5/responsive/unsafe-build-above-media-query-css.d.ts +33 -0
- package/dist/types-ts4.5/responsive/unsafe-build-below-media-query-css.d.ts +32 -0
- package/dist/types-ts4.5/utils/surface-context.d.ts +8 -0
- package/dist/types-ts4.5/utils/surface-provider.d.ts +1 -7
- package/dist/types-ts4.5/xcss/style-maps.partial.d.ts +2 -4
- package/package.json +17 -17
- package/scripts/capitalize.tsx +2 -0
- package/scripts/color-codegen-template.tsx +3 -6
- package/scripts/compose.tsx +4 -0
- package/scripts/elevation-codegen-template.tsx +3 -6
- package/scripts/generate-type-defs.tsx +12 -0
- package/scripts/inverse-color-map-template.tsx +4 -1
- package/scripts/is-accent.tsx +1 -0
- package/scripts/is-hovered.tsx +1 -0
- package/scripts/is-pressed.tsx +1 -0
- package/scripts/pick.tsx +4 -0
- package/scripts/shape-codegen-template.tsx +3 -1
- package/scripts/spacing-codegen-template.tsx +2 -1
- package/scripts/text-codegen-template.tsx +3 -2
- package/scripts/typography-codegen-template.tsx +3 -1
- package/scripts/utils.tsx +7 -25
- package/offerings.json +0 -298
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/primitives
|
|
2
2
|
|
|
3
|
+
## 19.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`79f04a5184ece`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/79f04a5184ece) -
|
|
8
|
+
Apply a couple of minor fixes to the stage 1 codemod transform
|
|
9
|
+
|
|
10
|
+
## 19.0.0
|
|
11
|
+
|
|
12
|
+
### Major Changes
|
|
13
|
+
|
|
14
|
+
- [`72017386a0120`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/72017386a0120) -
|
|
15
|
+
Remove the deprecated `UNSAFE_small` size for the Text primitive. Please migrate any remaining
|
|
16
|
+
usages to `small`.
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 18.1.4
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -6,6 +6,11 @@ import type {
|
|
|
6
6
|
VariableDeclaration,
|
|
7
7
|
} from 'jscodeshift';
|
|
8
8
|
|
|
9
|
+
// ImportSpecifier with importKind property (exists at runtime but not in type definitions)
|
|
10
|
+
type ImportSpecifierWithKind = ImportSpecifier & {
|
|
11
|
+
importKind?: 'type' | 'value' | undefined;
|
|
12
|
+
};
|
|
13
|
+
|
|
9
14
|
const ANCHOR_PRESSABLE_XCSS_PROPS = [
|
|
10
15
|
'backgroundColor',
|
|
11
16
|
'padding',
|
|
@@ -92,10 +97,21 @@ function transform(file: FileInfo, { jscodeshift: j }: API): string {
|
|
|
92
97
|
path.node.specifiers?.filter(
|
|
93
98
|
(specifier) => j.ImportSpecifier.check(specifier) && specifier.imported.name === 'xcss',
|
|
94
99
|
) ?? [];
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
100
|
+
|
|
101
|
+
// Separate type and value specifiers
|
|
102
|
+
const typeSpecifiers: ImportSpecifier[] = [];
|
|
103
|
+
const valueSpecifiers: ImportSpecifier[] = [];
|
|
104
|
+
|
|
105
|
+
path.node.specifiers?.forEach((specifier) => {
|
|
106
|
+
if (j.ImportSpecifier.check(specifier) && specifier.imported.name !== 'xcss') {
|
|
107
|
+
const specifierWithKind = specifier as ImportSpecifierWithKind;
|
|
108
|
+
if (specifierWithKind.importKind === 'type') {
|
|
109
|
+
typeSpecifiers.push(specifier);
|
|
110
|
+
} else {
|
|
111
|
+
valueSpecifiers.push(specifier);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
});
|
|
99
115
|
|
|
100
116
|
// Find components that use xcss
|
|
101
117
|
const componentsUsingXcss = new Set<string>();
|
|
@@ -118,25 +134,40 @@ function transform(file: FileInfo, { jscodeshift: j }: API): string {
|
|
|
118
134
|
}
|
|
119
135
|
});
|
|
120
136
|
|
|
121
|
-
// Split specifiers based on xcss usage
|
|
122
|
-
const
|
|
137
|
+
// Split value specifiers based on xcss usage
|
|
138
|
+
const valueSpecifiersToKeep = valueSpecifiers.filter(
|
|
123
139
|
(specifier) =>
|
|
124
140
|
j.ImportSpecifier.check(specifier) && componentsUsingXcss.has(specifier.imported.name),
|
|
125
141
|
);
|
|
126
|
-
const
|
|
142
|
+
const valueSpecifiersToMove = valueSpecifiers.filter(
|
|
127
143
|
(specifier) =>
|
|
128
144
|
j.ImportSpecifier.check(specifier) && !componentsUsingXcss.has(specifier.imported.name),
|
|
129
145
|
);
|
|
130
146
|
|
|
131
|
-
if (
|
|
132
|
-
//
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
);
|
|
147
|
+
if (valueSpecifiersToMove.length > 0) {
|
|
148
|
+
// Check if there's an existing compiled import to merge into
|
|
149
|
+
const existingCompiledImports = root.find(j.ImportDeclaration, {
|
|
150
|
+
source: { value: '@atlaskit/primitives/compiled' },
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
if (existingCompiledImports.length > 0) {
|
|
154
|
+
// Merge into first existing compiled import
|
|
155
|
+
const firstCompiledImport = existingCompiledImports.get(0);
|
|
156
|
+
const existingSpecifiers = firstCompiledImport.node.specifiers || [];
|
|
157
|
+
firstCompiledImport.node.specifiers = [...existingSpecifiers, ...valueSpecifiersToMove];
|
|
158
|
+
} else {
|
|
159
|
+
// Create new import for components that don't use xcss
|
|
160
|
+
path.insertAfter(
|
|
161
|
+
j.importDeclaration(
|
|
162
|
+
valueSpecifiersToMove,
|
|
163
|
+
j.literal('@atlaskit/primitives/compiled'),
|
|
164
|
+
),
|
|
165
|
+
);
|
|
166
|
+
}
|
|
136
167
|
}
|
|
137
168
|
|
|
138
|
-
// Update original import to include xcss
|
|
139
|
-
path.node.specifiers = [...xcssSpecifiers, ...
|
|
169
|
+
// Update original import to include xcss, value specifiers, then type specifiers
|
|
170
|
+
path.node.specifiers = [...xcssSpecifiers, ...valueSpecifiersToKeep, ...typeSpecifiers];
|
|
140
171
|
});
|
|
141
172
|
|
|
142
173
|
return root.toSource({ quote: 'single' });
|
|
@@ -230,14 +261,144 @@ function transform(file: FileInfo, { jscodeshift: j }: API): string {
|
|
|
230
261
|
}
|
|
231
262
|
|
|
232
263
|
// Find all import declarations from '@atlaskit/primitives'
|
|
233
|
-
root.find(j.ImportDeclaration, {
|
|
234
|
-
|
|
264
|
+
const primitivesImports = root.find(j.ImportDeclaration, {
|
|
265
|
+
source: { value: '@atlaskit/primitives' },
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
// Collect all value specifiers to move to compiled
|
|
269
|
+
const valueSpecifiersToMove: ImportSpecifier[] = [];
|
|
270
|
+
const typeSpecifiersToKeep: ImportSpecifier[] = [];
|
|
271
|
+
const importsToRemove: Parameters<Parameters<typeof primitivesImports.forEach>[0]>[0][] = [];
|
|
272
|
+
|
|
273
|
+
primitivesImports.forEach((path) => {
|
|
274
|
+
// Handle type-only imports - keep them in @atlaskit/primitives
|
|
235
275
|
if (path.node.importKind === 'type') {
|
|
236
276
|
return;
|
|
237
277
|
}
|
|
238
|
-
|
|
278
|
+
|
|
279
|
+
// Separate type and value specifiers
|
|
280
|
+
const typeSpecs: ImportSpecifier[] = [];
|
|
281
|
+
const valueSpecs: ImportSpecifier[] = [];
|
|
282
|
+
|
|
283
|
+
path.node.specifiers?.forEach((specifier) => {
|
|
284
|
+
if (j.ImportSpecifier.check(specifier)) {
|
|
285
|
+
// Check if this is a type import specifier
|
|
286
|
+
const specifierWithKind = specifier as ImportSpecifierWithKind;
|
|
287
|
+
const isTypeSpec = specifierWithKind.importKind === 'type';
|
|
288
|
+
if (isTypeSpec) {
|
|
289
|
+
typeSpecs.push(specifier);
|
|
290
|
+
} else {
|
|
291
|
+
valueSpecs.push(specifier);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
// If there are type specifiers, keep them in a separate type import
|
|
297
|
+
if (typeSpecs.length > 0) {
|
|
298
|
+
typeSpecifiersToKeep.push(...typeSpecs);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// Collect value specifiers to move
|
|
302
|
+
if (valueSpecs.length > 0) {
|
|
303
|
+
valueSpecifiersToMove.push(...valueSpecs);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// Mark this import for removal if it had value specifiers
|
|
307
|
+
if (valueSpecs.length > 0) {
|
|
308
|
+
importsToRemove.push(path);
|
|
309
|
+
}
|
|
239
310
|
});
|
|
240
311
|
|
|
312
|
+
// Remove imports that had value specifiers (type-only imports stay)
|
|
313
|
+
importsToRemove.forEach((path) => {
|
|
314
|
+
j(path).remove();
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
// If we have type specifiers to keep, create/update a type import
|
|
318
|
+
if (typeSpecifiersToKeep.length > 0) {
|
|
319
|
+
// Check for existing imports from @atlaskit/primitives (not type-only, as we want inline type syntax)
|
|
320
|
+
const existingPrimitivesImports = root
|
|
321
|
+
.find(j.ImportDeclaration, {
|
|
322
|
+
source: { value: '@atlaskit/primitives' },
|
|
323
|
+
})
|
|
324
|
+
.filter((path) => path.node.importKind !== 'type');
|
|
325
|
+
|
|
326
|
+
if (existingPrimitivesImports.length > 0) {
|
|
327
|
+
// Merge type specifiers into first existing import (will use inline type syntax)
|
|
328
|
+
const firstImport = existingPrimitivesImports.get(0);
|
|
329
|
+
const existingSpecifiers = firstImport.node.specifiers || [];
|
|
330
|
+
firstImport.node.specifiers = [...existingSpecifiers, ...typeSpecifiersToKeep];
|
|
331
|
+
} else {
|
|
332
|
+
// Create new import with inline type syntax (regular import, not type-only)
|
|
333
|
+
// The specifiers already have importKind: 'type' which will produce inline type syntax
|
|
334
|
+
const allImports = root.find(j.ImportDeclaration);
|
|
335
|
+
if (allImports.length > 0) {
|
|
336
|
+
allImports
|
|
337
|
+
.at(0)
|
|
338
|
+
.insertBefore(
|
|
339
|
+
j.importDeclaration(typeSpecifiersToKeep, j.literal('@atlaskit/primitives')),
|
|
340
|
+
);
|
|
341
|
+
} else {
|
|
342
|
+
root
|
|
343
|
+
.get()
|
|
344
|
+
.node.program.body.unshift(
|
|
345
|
+
j.importDeclaration(typeSpecifiersToKeep, j.literal('@atlaskit/primitives')),
|
|
346
|
+
);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
// Merge value specifiers into existing compiled import or create new one
|
|
352
|
+
if (valueSpecifiersToMove.length > 0) {
|
|
353
|
+
// Find compiled imports again after removals
|
|
354
|
+
const currentCompiledImports = root.find(j.ImportDeclaration, {
|
|
355
|
+
source: { value: '@atlaskit/primitives/compiled' },
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
if (currentCompiledImports.length > 0) {
|
|
359
|
+
// Collect all specifiers from all existing compiled imports
|
|
360
|
+
const allExistingSpecifiers: ImportSpecifier[] = [];
|
|
361
|
+
currentCompiledImports.forEach((path) => {
|
|
362
|
+
const specifiers = path.node.specifiers || [];
|
|
363
|
+
specifiers.forEach((spec) => {
|
|
364
|
+
if (j.ImportSpecifier.check(spec)) {
|
|
365
|
+
allExistingSpecifiers.push(spec);
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
// Merge all specifiers into first existing compiled import
|
|
371
|
+
const firstCompiledImport = currentCompiledImports.get(0);
|
|
372
|
+
firstCompiledImport.node.specifiers = [...allExistingSpecifiers, ...valueSpecifiersToMove];
|
|
373
|
+
|
|
374
|
+
// Remove the other compiled imports (keep only the first one)
|
|
375
|
+
if (currentCompiledImports.length > 1) {
|
|
376
|
+
currentCompiledImports.forEach((path, index) => {
|
|
377
|
+
if (index > 0) {
|
|
378
|
+
j(path).remove();
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
} else {
|
|
383
|
+
// Create new compiled import after the last import
|
|
384
|
+
const allImports = root.find(j.ImportDeclaration);
|
|
385
|
+
if (allImports.length > 0) {
|
|
386
|
+
allImports
|
|
387
|
+
.at(-1)
|
|
388
|
+
.insertAfter(
|
|
389
|
+
j.importDeclaration(valueSpecifiersToMove, j.literal('@atlaskit/primitives/compiled')),
|
|
390
|
+
);
|
|
391
|
+
} else {
|
|
392
|
+
// No imports at all, add at the beginning
|
|
393
|
+
root
|
|
394
|
+
.get()
|
|
395
|
+
.node.program.body.unshift(
|
|
396
|
+
j.importDeclaration(valueSpecifiersToMove, j.literal('@atlaskit/primitives/compiled')),
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
241
402
|
// Find existing cssMap import or alias
|
|
242
403
|
let cssMapName = 'cssMap';
|
|
243
404
|
const cssMapImport = root.find(j.ImportDeclaration, {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/primitives/components/flex",
|
|
3
|
+
"main": "../../dist/cjs/components/flex.js",
|
|
4
|
+
"module": "../../dist/esm/components/flex.js",
|
|
5
|
+
"module:es2019": "../../dist/es2019/components/flex.js",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"**/*.compiled.css"
|
|
8
|
+
],
|
|
9
|
+
"types": "../../dist/types/components/flex.d.ts",
|
|
10
|
+
"typesVersions": {
|
|
11
|
+
">=4.5 <5.9": {
|
|
12
|
+
"*": [
|
|
13
|
+
"../../dist/types-ts4.5/components/flex.d.ts"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -15,6 +15,8 @@ to an HTML `<button>`, but with Atlassian focus styles, analytics events, and st
|
|
|
15
15
|
For example, you could use pressable to make a colored square button that opens a color picker, or a
|
|
16
16
|
basic card that shows more details when selected.
|
|
17
17
|
|
|
18
|
+
## Parts
|
|
19
|
+
|
|
18
20
|

|
|
19
21
|
|
|
20
22
|
1. **Pressable area:** For accessibility this should be a minimum of 24 by 24 pixels, unless exempt
|
|
@@ -13,7 +13,7 @@ var React = _react;
|
|
|
13
13
|
var _runtime = require("@compiled/react/runtime");
|
|
14
14
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
15
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
16
|
-
var
|
|
16
|
+
var _surfaceContext = require("../../utils/surface-context");
|
|
17
17
|
var _excluded = ["as", "children", "backgroundColor", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "style", "testId", "xcss"],
|
|
18
18
|
_excluded2 = ["className"];
|
|
19
19
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
@@ -346,7 +346,7 @@ var Box = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
346
346
|
"data-testid": testId
|
|
347
347
|
}), children);
|
|
348
348
|
if (backgroundColor) {
|
|
349
|
-
return /*#__PURE__*/React.createElement(
|
|
349
|
+
return /*#__PURE__*/React.createElement(_surfaceContext.SurfaceContext.Provider, {
|
|
350
350
|
value: backgroundColor
|
|
351
351
|
}, node);
|
|
352
352
|
}
|
|
@@ -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}
|
|
@@ -9,7 +9,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
|
-
var
|
|
12
|
+
var _surfaceContext = require("../utils/surface-context");
|
|
13
13
|
var _styleMaps = require("../xcss/style-maps.partial");
|
|
14
14
|
var _xcss = require("../xcss/xcss");
|
|
15
15
|
var _excluded = ["as", "children", "backgroundColor", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "style", "testId", "xcss"],
|
|
@@ -87,7 +87,7 @@ var Box = exports.Box = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
|
|
|
87
87
|
paddingInlineEnd && _styleMaps.paddingStylesMap.paddingInlineEnd[paddingInlineEnd], resolvedStyles.emotion],
|
|
88
88
|
"data-testid": testId
|
|
89
89
|
}), children);
|
|
90
|
-
return backgroundColor ? (0, _react2.jsx)(
|
|
90
|
+
return backgroundColor ? (0, _react2.jsx)(_surfaceContext.SurfaceContext.Provider, {
|
|
91
91
|
value: backgroundColor
|
|
92
92
|
}, node) : node;
|
|
93
93
|
}
|
|
@@ -1,76 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
* A map to build optional `display:none` for consumption on a div.
|
|
22
|
-
* ```ts
|
|
23
|
-
* const hideMediaQueries = buildAboveMediaQueryCSS({ display: 'none' });
|
|
24
|
-
*
|
|
25
|
-
* const Component = ({ hideAtBreakpoints: ('xs' | 'sm')[], children: ReactNode }) => {
|
|
26
|
-
* return <div css={hideAtBreakpoints.map(b => hideMediaQueries[b])}>{children}</div>;
|
|
27
|
-
* }
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* This roughly builds a map that will look roughly like this (if done manually):
|
|
31
|
-
* ```ts
|
|
32
|
-
* {
|
|
33
|
-
* xxs: css({ '@media all': { display: 'none' } }),
|
|
34
|
-
* xs: css({ '@media (min-width: 30rem)': { display: 'none' } }),
|
|
35
|
-
* sm: css({ '@media (min-width: 48rem)': { display: 'none' } }),
|
|
36
|
-
* }
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
var UNSAFE_buildAboveMediaQueryCSS = exports.UNSAFE_buildAboveMediaQueryCSS = function UNSAFE_buildAboveMediaQueryCSS(input) {
|
|
40
|
-
return _constants.UNSAFE_BREAKPOINTS_ORDERED_LIST.reduce(function (acc, breakpoint) {
|
|
41
|
-
return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2.default)({}, breakpoint, (0, _react.css)((0, _defineProperty2.default)({}, _mediaHelper.media.above[breakpoint], typeof input === 'function' ? input(breakpoint) : input))));
|
|
42
|
-
}, {});
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Build a map of breakpoints to css with media queries and nested styles.
|
|
47
|
-
*
|
|
48
|
-
* @internal Not intended to be used outside of DST at this stage.
|
|
49
|
-
* @experimental Not intended to be used outside of DST at this stage.
|
|
50
|
-
*
|
|
51
|
-
* @example
|
|
52
|
-
* A map to build optional `display:none` for consumption on a div.
|
|
53
|
-
* ```ts
|
|
54
|
-
* const hideMediaQueries = buildBelowMediaQueryCSS({ display: 'none' });
|
|
55
|
-
*
|
|
56
|
-
* const Component = ({ hideAtBreakpoints: ('xs' | 'sm')[], children: ReactNode }) => {
|
|
57
|
-
* return <div css={hideAtBreakpoints.map(b => hideMediaQueries[b])}>{children}</div>;
|
|
58
|
-
* }
|
|
59
|
-
* ```
|
|
60
|
-
*
|
|
61
|
-
* This roughly builds a map that will look roughly like this (if done manually):
|
|
62
|
-
* ```ts
|
|
63
|
-
* {
|
|
64
|
-
* xs: css({ '@media not all and (min-width: 30rem)': { display: 'none' } }),
|
|
65
|
-
* sm: css({ '@media not all and (min-width: 48rem)': { display: 'none' } }),
|
|
66
|
-
* }
|
|
67
|
-
* ```
|
|
68
|
-
*/
|
|
69
|
-
var UNSAFE_buildBelowMediaQueryCSS = exports.UNSAFE_buildBelowMediaQueryCSS = function UNSAFE_buildBelowMediaQueryCSS(input) {
|
|
70
|
-
return _constants.UNSAFE_BREAKPOINTS_ORDERED_LIST.reduce(function (acc, breakpoint) {
|
|
71
|
-
if (breakpoint === 'xxs') {
|
|
72
|
-
return acc;
|
|
73
|
-
}
|
|
74
|
-
return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2.default)({}, breakpoint, (0, _react.css)((0, _defineProperty2.default)({}, _mediaHelper.UNSAFE_media.below[breakpoint], typeof input === 'function' ? input(breakpoint) : input))));
|
|
75
|
-
}, {});
|
|
76
|
-
};
|
|
6
|
+
Object.defineProperty(exports, "UNSAFE_buildAboveMediaQueryCSS", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _unsafeBuildAboveMediaQueryCss.UNSAFE_buildAboveMediaQueryCSS;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "UNSAFE_buildBelowMediaQueryCSS", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _unsafeBuildBelowMediaQueryCss.UNSAFE_buildBelowMediaQueryCSS;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _unsafeBuildAboveMediaQueryCss = require("./unsafe-build-above-media-query-css");
|
|
19
|
+
var _unsafeBuildBelowMediaQueryCss = require("./unsafe-build-below-media-query-css");
|
|
@@ -8,7 +8,8 @@ exports.Hide = void 0;
|
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _react = require("@emotion/react");
|
|
10
10
|
var _xcss = require("../xcss/xcss");
|
|
11
|
-
var
|
|
11
|
+
var _unsafeBuildAboveMediaQueryCss = require("./unsafe-build-above-media-query-css");
|
|
12
|
+
var _unsafeBuildBelowMediaQueryCss = require("./unsafe-build-below-media-query-css");
|
|
12
13
|
/**
|
|
13
14
|
* @jsxRuntime classic
|
|
14
15
|
* @jsx jsx
|
|
@@ -16,10 +17,10 @@ var _buildMediaQueryCss = require("./build-media-query-css");
|
|
|
16
17
|
|
|
17
18
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
18
19
|
|
|
19
|
-
var hideAboveQueries = (0,
|
|
20
|
+
var hideAboveQueries = (0, _unsafeBuildAboveMediaQueryCss.UNSAFE_buildAboveMediaQueryCSS)({
|
|
20
21
|
display: 'none'
|
|
21
22
|
});
|
|
22
|
-
var hideBelowQueries = (0,
|
|
23
|
+
var hideBelowQueries = (0, _unsafeBuildBelowMediaQueryCss.UNSAFE_buildBelowMediaQueryCSS)({
|
|
23
24
|
display: 'none'
|
|
24
25
|
});
|
|
25
26
|
/**
|
|
@@ -3,44 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* This means that you should avoid multiple breakpoints taking effect at the same time,
|
|
12
|
-
* eg. ```{ [media.above.xs]: { color: 'red' }, [media.above.sm]: { color: 'green' }}```.
|
|
13
|
-
* Instead, make sure that only one breakpoint can take effect at a time,
|
|
14
|
-
* e.g, ```{ [media.only.xs]: { color: 'red' }, [media.above.sm]: { color: 'green' }}```.
|
|
15
|
-
* For more details, please see <https://compiledcssinjs.com/docs/atomic-css#selector-specificity>.
|
|
16
|
-
*/
|
|
17
|
-
var media = exports.media = {
|
|
18
|
-
above: {
|
|
19
|
-
xxs: '@media all',
|
|
20
|
-
xs: '@media (min-width: 30rem)',
|
|
21
|
-
sm: '@media (min-width: 48rem)',
|
|
22
|
-
md: '@media (min-width: 64rem)',
|
|
23
|
-
lg: '@media (min-width: 90rem)',
|
|
24
|
-
xl: '@media (min-width: 110.5rem)'
|
|
25
|
-
},
|
|
26
|
-
only: {
|
|
27
|
-
xxs: '@media (min-width: 0rem) and (max-width: 29.99rem)',
|
|
28
|
-
xs: '@media (min-width: 30rem) and (max-width: 47.99rem)',
|
|
29
|
-
sm: '@media (min-width: 48rem) and (max-width: 63.99rem)',
|
|
30
|
-
md: '@media (min-width: 64rem) and (max-width: 89.99rem)',
|
|
31
|
-
lg: '@media (min-width: 90rem) and (max-width: 110.49rem)',
|
|
32
|
-
xl: '@media (min-width: 110.5rem)'
|
|
33
|
-
},
|
|
34
|
-
below: {
|
|
35
|
-
xs: '@media not all and (min-width: 30rem)',
|
|
36
|
-
sm: '@media not all and (min-width: 48rem)',
|
|
37
|
-
md: '@media not all and (min-width: 64rem)',
|
|
38
|
-
lg: '@media not all and (min-width: 90rem)',
|
|
39
|
-
xl: '@media not all and (min-width: 110.5rem)'
|
|
6
|
+
exports.UNSAFE_media = void 0;
|
|
7
|
+
Object.defineProperty(exports, "media", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function get() {
|
|
10
|
+
return _media.media;
|
|
40
11
|
}
|
|
41
|
-
};
|
|
42
|
-
|
|
12
|
+
});
|
|
13
|
+
var _media = require("./media");
|
|
43
14
|
/**
|
|
44
15
|
* Keep `UNSAFE_media` for backwards compatibility.
|
|
45
16
|
*/
|
|
46
|
-
var UNSAFE_media = exports.UNSAFE_media = media;
|
|
17
|
+
var UNSAFE_media = exports.UNSAFE_media = _media.media;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.media = void 0;
|
|
7
|
+
var media = exports.media = {
|
|
8
|
+
above: {
|
|
9
|
+
xxs: '@media all',
|
|
10
|
+
xs: '@media (min-width: 30rem)',
|
|
11
|
+
sm: '@media (min-width: 48rem)',
|
|
12
|
+
md: '@media (min-width: 64rem)',
|
|
13
|
+
lg: '@media (min-width: 90rem)',
|
|
14
|
+
xl: '@media (min-width: 110.5rem)'
|
|
15
|
+
},
|
|
16
|
+
only: {
|
|
17
|
+
xxs: '@media (min-width: 0rem) and (max-width: 29.99rem)',
|
|
18
|
+
xs: '@media (min-width: 30rem) and (max-width: 47.99rem)',
|
|
19
|
+
sm: '@media (min-width: 48rem) and (max-width: 63.99rem)',
|
|
20
|
+
md: '@media (min-width: 64rem) and (max-width: 89.99rem)',
|
|
21
|
+
lg: '@media (min-width: 90rem) and (max-width: 110.49rem)',
|
|
22
|
+
xl: '@media (min-width: 110.5rem)'
|
|
23
|
+
},
|
|
24
|
+
below: {
|
|
25
|
+
xs: '@media not all and (min-width: 30rem)',
|
|
26
|
+
sm: '@media not all and (min-width: 48rem)',
|
|
27
|
+
md: '@media not all and (min-width: 64rem)',
|
|
28
|
+
lg: '@media not all and (min-width: 90rem)',
|
|
29
|
+
xl: '@media not all and (min-width: 110.5rem)'
|
|
30
|
+
}
|
|
31
|
+
};
|
|
@@ -8,7 +8,8 @@ exports.Show = void 0;
|
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _react = require("@emotion/react");
|
|
10
10
|
var _xcss = require("../xcss/xcss");
|
|
11
|
-
var
|
|
11
|
+
var _unsafeBuildAboveMediaQueryCss = require("./unsafe-build-above-media-query-css");
|
|
12
|
+
var _unsafeBuildBelowMediaQueryCss = require("./unsafe-build-below-media-query-css");
|
|
12
13
|
/**
|
|
13
14
|
* @jsxRuntime classic
|
|
14
15
|
* @jsx jsx
|
|
@@ -16,10 +17,10 @@ var _buildMediaQueryCss = require("./build-media-query-css");
|
|
|
16
17
|
|
|
17
18
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
18
19
|
|
|
19
|
-
var showAboveQueries = (0,
|
|
20
|
+
var showAboveQueries = (0, _unsafeBuildAboveMediaQueryCss.UNSAFE_buildAboveMediaQueryCSS)({
|
|
20
21
|
display: 'revert'
|
|
21
22
|
});
|
|
22
|
-
var showBelowQueries = (0,
|
|
23
|
+
var showBelowQueries = (0, _unsafeBuildBelowMediaQueryCss.UNSAFE_buildBelowMediaQueryCSS)({
|
|
23
24
|
display: 'revert'
|
|
24
25
|
});
|
|
25
26
|
var defaultHiddenStyles = (0, _react.css)({
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.UNSAFE_buildAboveMediaQueryCSS = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _react = require("@emotion/react");
|
|
10
|
+
var _constants = require("./constants");
|
|
11
|
+
var _media = require("./media");
|
|
12
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
|
|
14
|
+
/**
|
|
15
|
+
* Build a map of breakpoints to css with media queries and nested styles.
|
|
16
|
+
*
|
|
17
|
+
* @internal Not intended to be used outside of DST at this stage.
|
|
18
|
+
* @experimental Not intended to be used outside of DST at this stage.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* A map to build optional `display:none` for consumption on a div.
|
|
22
|
+
* ```ts
|
|
23
|
+
* const hideMediaQueries = buildAboveMediaQueryCSS({ display: 'none' });
|
|
24
|
+
*
|
|
25
|
+
* const Component = ({ hideAtBreakpoints: ('xs' | 'sm')[], children: ReactNode }) => {
|
|
26
|
+
* return <div css={hideAtBreakpoints.map(b => hideMediaQueries[b])}>{children}</div>;
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* This roughly builds a map that will look roughly like this (if done manually):
|
|
31
|
+
* ```ts
|
|
32
|
+
* {
|
|
33
|
+
* xxs: css({ '@media all': { display: 'none' } }),
|
|
34
|
+
* xs: css({ '@media (min-width: 30rem)': { display: 'none' } }),
|
|
35
|
+
* sm: css({ '@media (min-width: 48rem)': { display: 'none' } }),
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
var UNSAFE_buildAboveMediaQueryCSS = exports.UNSAFE_buildAboveMediaQueryCSS = function UNSAFE_buildAboveMediaQueryCSS(input) {
|
|
40
|
+
return _constants.UNSAFE_BREAKPOINTS_ORDERED_LIST.reduce(function (acc, breakpoint) {
|
|
41
|
+
return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2.default)({}, breakpoint, (0, _react.css)((0, _defineProperty2.default)({}, _media.media.above[breakpoint], typeof input === 'function' ? input(breakpoint) : input))));
|
|
42
|
+
}, {});
|
|
43
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.UNSAFE_buildBelowMediaQueryCSS = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _react = require("@emotion/react");
|
|
10
|
+
var _constants = require("./constants");
|
|
11
|
+
var _mediaHelper = require("./media-helper");
|
|
12
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
|
|
14
|
+
/**
|
|
15
|
+
* Build a map of breakpoints to css with media queries and nested styles.
|
|
16
|
+
*
|
|
17
|
+
* @internal Not intended to be used outside of DST at this stage.
|
|
18
|
+
* @experimental Not intended to be used outside of DST at this stage.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* A map to build optional `display:none` for consumption on a div.
|
|
22
|
+
* ```ts
|
|
23
|
+
* const hideMediaQueries = buildBelowMediaQueryCSS({ display: 'none' });
|
|
24
|
+
*
|
|
25
|
+
* const Component = ({ hideAtBreakpoints: ('xs' | 'sm')[], children: ReactNode }) => {
|
|
26
|
+
* return <div css={hideAtBreakpoints.map(b => hideMediaQueries[b])}>{children}</div>;
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* This roughly builds a map that will look roughly like this (if done manually):
|
|
31
|
+
* ```ts
|
|
32
|
+
* {
|
|
33
|
+
* xs: css({ '@media not all and (min-width: 30rem)': { display: 'none' } }),
|
|
34
|
+
* sm: css({ '@media not all and (min-width: 48rem)': { display: 'none' } }),
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
var UNSAFE_buildBelowMediaQueryCSS = exports.UNSAFE_buildBelowMediaQueryCSS = function UNSAFE_buildBelowMediaQueryCSS(input) {
|
|
39
|
+
return _constants.UNSAFE_BREAKPOINTS_ORDERED_LIST.reduce(function (acc, breakpoint) {
|
|
40
|
+
if (breakpoint === 'xxs') {
|
|
41
|
+
return acc;
|
|
42
|
+
}
|
|
43
|
+
return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2.default)({}, breakpoint, (0, _react.css)((0, _defineProperty2.default)({}, _mediaHelper.UNSAFE_media.below[breakpoint], typeof input === 'function' ? input(breakpoint) : input))));
|
|
44
|
+
}, {});
|
|
45
|
+
};
|