@atlaskit/primitives 12.2.6 → 13.0.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.
- package/CHANGELOG.md +32 -0
- package/compiled/package.json +15 -0
- package/dist/cjs/compiled/components/anchor.compiled.css +12 -0
- package/dist/cjs/compiled/components/anchor.js +130 -0
- package/dist/cjs/compiled/components/bleed.compiled.css +11 -0
- package/dist/cjs/compiled/components/bleed.js +49 -0
- package/dist/cjs/compiled/components/box.compiled.css +266 -0
- package/dist/cjs/compiled/components/box.js +367 -0
- package/dist/cjs/compiled/components/flex.compiled.css +46 -0
- package/dist/cjs/compiled/components/flex.js +119 -0
- package/dist/cjs/compiled/components/grid.compiled.css +54 -0
- package/dist/cjs/compiled/components/grid.js +129 -0
- package/dist/cjs/compiled/components/inline.compiled.css +8 -0
- package/dist/cjs/compiled/components/inline.js +83 -0
- package/dist/cjs/compiled/components/internal/surface-provider.js +25 -0
- package/dist/cjs/compiled/components/internal/types.js +1 -0
- package/dist/cjs/compiled/components/pressable.compiled.css +13 -0
- package/dist/cjs/compiled/components/pressable.js +87 -0
- package/dist/cjs/compiled/components/stack.compiled.css +3 -0
- package/dist/cjs/compiled/components/stack.js +64 -0
- package/dist/cjs/compiled/components/text.compiled.css +60 -0
- package/dist/cjs/compiled/components/text.js +177 -0
- package/dist/cjs/compiled/components/types.js +5 -0
- package/dist/cjs/compiled/index.js +83 -0
- package/dist/cjs/compiled/responsive/hide.compiled.css +11 -0
- package/dist/cjs/compiled/responsive/hide.js +46 -0
- package/dist/cjs/compiled/responsive/index.js +33 -0
- package/dist/cjs/compiled/responsive/media-helper.js +42 -0
- package/dist/cjs/compiled/responsive/show.compiled.css +11 -0
- package/dist/cjs/compiled/responsive/show.js +47 -0
- package/dist/cjs/compiled/responsive/types.js +5 -0
- package/dist/cjs/compiled/responsive/use-media-query.js +77 -0
- package/dist/cjs/components/anchor.js +1 -1
- package/dist/cjs/components/pressable.js +1 -1
- package/dist/cjs/index.js +0 -6
- package/dist/cjs/xcss/style-maps.partial.js +7 -6
- package/dist/es2019/compiled/components/anchor.compiled.css +12 -0
- package/dist/es2019/compiled/components/anchor.js +117 -0
- package/dist/es2019/compiled/components/bleed.compiled.css +11 -0
- package/dist/es2019/compiled/components/bleed.js +43 -0
- package/dist/es2019/compiled/components/box.compiled.css +266 -0
- package/dist/es2019/compiled/components/box.js +351 -0
- package/dist/es2019/compiled/components/flex.compiled.css +46 -0
- package/dist/es2019/compiled/components/flex.js +110 -0
- package/dist/es2019/compiled/components/grid.compiled.css +54 -0
- package/dist/es2019/compiled/components/grid.js +121 -0
- package/dist/es2019/compiled/components/inline.compiled.css +8 -0
- package/dist/es2019/compiled/components/inline.js +71 -0
- package/dist/es2019/compiled/components/internal/surface-provider.js +19 -0
- package/dist/es2019/compiled/components/internal/types.js +0 -0
- package/dist/es2019/compiled/components/pressable.compiled.css +13 -0
- package/dist/es2019/compiled/components/pressable.js +75 -0
- package/dist/es2019/compiled/components/stack.compiled.css +3 -0
- package/dist/es2019/compiled/components/stack.js +54 -0
- package/dist/es2019/compiled/components/text.compiled.css +60 -0
- package/dist/es2019/compiled/components/text.js +164 -0
- package/dist/es2019/compiled/components/types.js +1 -0
- package/dist/es2019/compiled/index.js +13 -0
- package/dist/es2019/compiled/responsive/hide.compiled.css +11 -0
- package/dist/es2019/compiled/responsive/hide.js +37 -0
- package/dist/es2019/compiled/responsive/index.js +4 -0
- package/dist/es2019/compiled/responsive/media-helper.js +36 -0
- package/dist/es2019/compiled/responsive/show.compiled.css +11 -0
- package/dist/es2019/compiled/responsive/show.js +38 -0
- package/dist/es2019/compiled/responsive/types.js +1 -0
- package/dist/es2019/compiled/responsive/use-media-query.js +71 -0
- package/dist/es2019/components/anchor.js +1 -1
- package/dist/es2019/components/pressable.js +1 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/xcss/style-maps.partial.js +7 -6
- package/dist/esm/compiled/components/anchor.compiled.css +12 -0
- package/dist/esm/compiled/components/anchor.js +120 -0
- package/dist/esm/compiled/components/bleed.compiled.css +11 -0
- package/dist/esm/compiled/components/bleed.js +42 -0
- package/dist/esm/compiled/components/box.compiled.css +266 -0
- package/dist/esm/compiled/components/box.js +358 -0
- package/dist/esm/compiled/components/flex.compiled.css +46 -0
- package/dist/esm/compiled/components/flex.js +110 -0
- package/dist/esm/compiled/components/grid.compiled.css +54 -0
- package/dist/esm/compiled/components/grid.js +120 -0
- package/dist/esm/compiled/components/inline.compiled.css +8 -0
- package/dist/esm/compiled/components/inline.js +73 -0
- package/dist/esm/compiled/components/internal/surface-provider.js +19 -0
- package/dist/esm/compiled/components/internal/types.js +0 -0
- package/dist/esm/compiled/components/pressable.compiled.css +13 -0
- package/dist/esm/compiled/components/pressable.js +77 -0
- package/dist/esm/compiled/components/stack.compiled.css +3 -0
- package/dist/esm/compiled/components/stack.js +54 -0
- package/dist/esm/compiled/components/text.compiled.css +60 -0
- package/dist/esm/compiled/components/text.js +167 -0
- package/dist/esm/compiled/components/types.js +1 -0
- package/dist/esm/compiled/index.js +13 -0
- package/dist/esm/compiled/responsive/hide.compiled.css +11 -0
- package/dist/esm/compiled/responsive/hide.js +37 -0
- package/dist/esm/compiled/responsive/index.js +4 -0
- package/dist/esm/compiled/responsive/media-helper.js +36 -0
- package/dist/esm/compiled/responsive/show.compiled.css +11 -0
- package/dist/esm/compiled/responsive/show.js +38 -0
- package/dist/esm/compiled/responsive/types.js +1 -0
- package/dist/esm/compiled/responsive/use-media-query.js +71 -0
- package/dist/esm/components/anchor.js +1 -1
- package/dist/esm/components/pressable.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/xcss/style-maps.partial.js +7 -6
- package/dist/types/compiled/components/anchor.d.ts +63 -0
- package/dist/types/compiled/components/bleed.d.ts +34 -0
- package/dist/types/compiled/components/box.d.ts +105 -0
- package/dist/types/compiled/components/flex.d.ts +111 -0
- package/dist/types/compiled/components/grid.d.ts +131 -0
- package/dist/types/compiled/components/inline.d.ts +116 -0
- package/dist/types/compiled/components/internal/surface-provider.d.ts +16 -0
- package/dist/types/compiled/components/internal/types.d.ts +5 -0
- package/dist/types/compiled/components/pressable.d.ts +49 -0
- package/dist/types/compiled/components/stack.d.ts +90 -0
- package/dist/types/compiled/components/text.d.ts +91 -0
- package/dist/types/compiled/components/types.d.ts +45 -0
- package/dist/types/compiled/index.d.ts +12 -0
- package/dist/types/compiled/responsive/hide.d.ts +39 -0
- package/dist/types/compiled/responsive/index.d.ts +5 -0
- package/dist/types/compiled/responsive/media-helper.d.ts +35 -0
- package/dist/types/compiled/responsive/show.d.ts +39 -0
- package/dist/types/compiled/responsive/types.d.ts +10 -0
- package/dist/types/compiled/responsive/use-media-query.d.ts +23 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/xcss/style-maps.partial.d.ts +7 -6
- package/dist/types/xcss/xcss.d.ts +1 -0
- package/dist/types-ts4.5/compiled/components/anchor.d.ts +63 -0
- package/dist/types-ts4.5/compiled/components/bleed.d.ts +34 -0
- package/dist/types-ts4.5/compiled/components/box.d.ts +105 -0
- package/dist/types-ts4.5/compiled/components/flex.d.ts +111 -0
- package/dist/types-ts4.5/compiled/components/grid.d.ts +131 -0
- package/dist/types-ts4.5/compiled/components/inline.d.ts +116 -0
- package/dist/types-ts4.5/compiled/components/internal/surface-provider.d.ts +16 -0
- package/dist/types-ts4.5/compiled/components/internal/types.d.ts +5 -0
- package/dist/types-ts4.5/compiled/components/pressable.d.ts +49 -0
- package/dist/types-ts4.5/compiled/components/stack.d.ts +90 -0
- package/dist/types-ts4.5/compiled/components/text.d.ts +96 -0
- package/dist/types-ts4.5/compiled/components/types.d.ts +45 -0
- package/dist/types-ts4.5/compiled/index.d.ts +12 -0
- package/dist/types-ts4.5/compiled/responsive/hide.d.ts +39 -0
- package/dist/types-ts4.5/compiled/responsive/index.d.ts +5 -0
- package/dist/types-ts4.5/compiled/responsive/media-helper.d.ts +35 -0
- package/dist/types-ts4.5/compiled/responsive/show.d.ts +39 -0
- package/dist/types-ts4.5/compiled/responsive/types.d.ts +10 -0
- package/dist/types-ts4.5/compiled/responsive/use-media-query.d.ts +23 -0
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/xcss/style-maps.partial.d.ts +7 -6
- package/dist/types-ts4.5/xcss/xcss.d.ts +1 -0
- package/package.json +4 -2
- package/scripts/codegen-file-templates/layer.tsx +1 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "Anchor", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function get() {
|
|
10
|
+
return _anchor.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "Bleed", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function get() {
|
|
16
|
+
return _bleed.default;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "Box", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function get() {
|
|
22
|
+
return _box.default;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "Flex", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function get() {
|
|
28
|
+
return _flex.default;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, "Grid", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function get() {
|
|
34
|
+
return _grid.default;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, "Inline", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function get() {
|
|
40
|
+
return _inline.default;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(exports, "Pressable", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function get() {
|
|
46
|
+
return _pressable.default;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(exports, "Stack", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function get() {
|
|
52
|
+
return _stack.default;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(exports, "Text", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function get() {
|
|
58
|
+
return _text.default;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
Object.defineProperty(exports, "UNSAFE_useSurface", {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
get: function get() {
|
|
64
|
+
return _surfaceProvider.useSurface;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
Object.defineProperty(exports, "media", {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
get: function get() {
|
|
70
|
+
return _responsive.media;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
var _box = _interopRequireDefault(require("./components/box"));
|
|
74
|
+
var _inline = _interopRequireDefault(require("./components/inline"));
|
|
75
|
+
var _stack = _interopRequireDefault(require("./components/stack"));
|
|
76
|
+
var _flex = _interopRequireDefault(require("./components/flex"));
|
|
77
|
+
var _grid = _interopRequireDefault(require("./components/grid"));
|
|
78
|
+
var _bleed = _interopRequireDefault(require("./components/bleed"));
|
|
79
|
+
var _text = _interopRequireDefault(require("./components/text"));
|
|
80
|
+
var _pressable = _interopRequireDefault(require("./components/pressable"));
|
|
81
|
+
var _anchor = _interopRequireDefault(require("./components/anchor"));
|
|
82
|
+
var _responsive = require("./responsive");
|
|
83
|
+
var _surfaceProvider = require("./components/internal/surface-provider");
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
@media (min-width:30rem){._114bglyw{display:none}}
|
|
3
|
+
@media not all and (min-width:30rem){._1m0aglyw{display:none}}
|
|
4
|
+
@media (min-width:48rem){._181nglyw{display:none}}
|
|
5
|
+
@media not all and (min-width:48rem){._sugaglyw{display:none}}
|
|
6
|
+
@media (min-width:64rem){._dm25glyw{display:none}}
|
|
7
|
+
@media not all and (min-width:64rem){._1mjbglyw{display:none}}
|
|
8
|
+
@media (min-width:90rem){._je3oglyw{display:none}}
|
|
9
|
+
@media not all and (min-width:90rem){._liwcglyw{display:none}}
|
|
10
|
+
@media (min-width:110.5rem){._1uxvglyw{display:none}}
|
|
11
|
+
@media not all and (min-width:110.5rem){._14wzglyw{display:none}}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/* hide.tsx generated by @compiled/babel-plugin v0.32.2 */
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.Hide = void 0;
|
|
9
|
+
require("./hide.compiled.css");
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _runtime = require("@compiled/react/runtime");
|
|
12
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
13
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
|
+
var styles = {
|
|
15
|
+
'above.xs': "_114bglyw",
|
|
16
|
+
'above.sm': "_181nglyw",
|
|
17
|
+
'above.md': "_dm25glyw",
|
|
18
|
+
'above.lg': "_je3oglyw",
|
|
19
|
+
'above.xl': "_1uxvglyw",
|
|
20
|
+
'below.xs': "_1m0aglyw",
|
|
21
|
+
'below.sm': "_sugaglyw",
|
|
22
|
+
'below.md': "_1mjbglyw",
|
|
23
|
+
'below.lg': "_liwcglyw",
|
|
24
|
+
'below.xl': "_14wzglyw"
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Hides the content at a given breakpoint. By default, content is shown. The primary use case is for visual presentation.
|
|
28
|
+
* Mix `<Hide above="md">` with `<Show above="md">` to achieve content that shifts at a breakpoint.
|
|
29
|
+
*
|
|
30
|
+
* Please note:
|
|
31
|
+
* - This only uses `display: none` hide, it does not skip rendering of children trees.
|
|
32
|
+
* - As this is rendered at all times, there is little performance savings here (just that this is not painted).
|
|
33
|
+
*/
|
|
34
|
+
var Hide = exports.Hide = function Hide(_ref) {
|
|
35
|
+
var above = _ref.above,
|
|
36
|
+
below = _ref.below,
|
|
37
|
+
children = _ref.children,
|
|
38
|
+
_ref$as = _ref.as,
|
|
39
|
+
AsElement = _ref$as === void 0 ? 'div' : _ref$as,
|
|
40
|
+
xcss = _ref.xcss;
|
|
41
|
+
return /*#__PURE__*/React.createElement(AsElement
|
|
42
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- TODO: Allow pass-through from `props.xcss`
|
|
43
|
+
, {
|
|
44
|
+
className: (0, _runtime.ax)([above && styles["above.".concat(above)], below && styles["below.".concat(below)], xcss])
|
|
45
|
+
}, children);
|
|
46
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "Hide", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _hide.Hide;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "Show", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _show.Show;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "UNSAFE_useMediaQuery", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _useMediaQuery.UNSAFE_useMediaQuery;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "media", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _mediaHelper.media;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
var _mediaHelper = require("./media-helper");
|
|
31
|
+
var _useMediaQuery = require("./use-media-query");
|
|
32
|
+
var _show = require("./show");
|
|
33
|
+
var _hide = require("./hide");
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.media = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* This is an object of usable media query helpers using our internal breakpoints configuration.
|
|
9
|
+
*
|
|
10
|
+
* When using Compiled CSS-in-JS, please ensure that only a single declaration can take effect at a time.
|
|
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
|
+
// TODO: Should this even exist, we don't want `css({ [media.above.xxs]: { … } })` because that just adds duplicates styles!
|
|
20
|
+
xxs: '@media all',
|
|
21
|
+
xs: '@media (min-width: 30rem)',
|
|
22
|
+
sm: '@media (min-width: 48rem)',
|
|
23
|
+
md: '@media (min-width: 64rem)',
|
|
24
|
+
lg: '@media (min-width: 90rem)',
|
|
25
|
+
xl: '@media (min-width: 110.5rem)'
|
|
26
|
+
},
|
|
27
|
+
only: {
|
|
28
|
+
xxs: '@media (min-width: 0rem) and (max-width: 29.99rem)',
|
|
29
|
+
xs: '@media (min-width: 30rem) and (max-width: 47.99rem)',
|
|
30
|
+
sm: '@media (min-width: 48rem) and (max-width: 63.99rem)',
|
|
31
|
+
md: '@media (min-width: 64rem) and (max-width: 89.99rem)',
|
|
32
|
+
lg: '@media (min-width: 90rem) and (max-width: 110.49rem)',
|
|
33
|
+
xl: '@media (min-width: 110.5rem)'
|
|
34
|
+
},
|
|
35
|
+
below: {
|
|
36
|
+
xs: '@media not all and (min-width: 30rem)',
|
|
37
|
+
sm: '@media not all and (min-width: 48rem)',
|
|
38
|
+
md: '@media not all and (min-width: 64rem)',
|
|
39
|
+
lg: '@media not all and (min-width: 90rem)',
|
|
40
|
+
xl: '@media not all and (min-width: 110.5rem)'
|
|
41
|
+
}
|
|
42
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
._1e0cglyw{display:none}
|
|
2
|
+
@media (min-width:30rem){._114b19ly{display:revert}}
|
|
3
|
+
@media not all and (min-width:30rem){._1m0a19ly{display:revert}}
|
|
4
|
+
@media (min-width:48rem){._181n19ly{display:revert}}
|
|
5
|
+
@media not all and (min-width:48rem){._suga19ly{display:revert}}
|
|
6
|
+
@media (min-width:64rem){._dm2519ly{display:revert}}
|
|
7
|
+
@media not all and (min-width:64rem){._1mjb19ly{display:revert}}
|
|
8
|
+
@media (min-width:90rem){._je3o19ly{display:revert}}
|
|
9
|
+
@media not all and (min-width:90rem){._liwc19ly{display:revert}}
|
|
10
|
+
@media (min-width:110.5rem){._1uxv19ly{display:revert}}
|
|
11
|
+
@media not all and (min-width:110.5rem){._14wz19ly{display:revert}}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/* show.tsx generated by @compiled/babel-plugin v0.32.2 */
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.Show = void 0;
|
|
9
|
+
require("./show.compiled.css");
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _runtime = require("@compiled/react/runtime");
|
|
12
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
13
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
|
+
var styles = {
|
|
15
|
+
default: "_1e0cglyw",
|
|
16
|
+
'above.xs': "_114b19ly",
|
|
17
|
+
'above.sm': "_181n19ly",
|
|
18
|
+
'above.md': "_dm2519ly",
|
|
19
|
+
'above.lg': "_je3o19ly",
|
|
20
|
+
'above.xl': "_1uxv19ly",
|
|
21
|
+
'below.xs': "_1m0a19ly",
|
|
22
|
+
'below.sm': "_suga19ly",
|
|
23
|
+
'below.md': "_1mjb19ly",
|
|
24
|
+
'below.lg': "_liwc19ly",
|
|
25
|
+
'below.xl': "_14wz19ly"
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Shows the content at a given breakpoint. By default, content is hidden. The primary use case is for visual presentation.
|
|
29
|
+
* Mix `<Show above="md">` with `<Hide above="md">` to achieve content that shifts at a breakpoint.
|
|
30
|
+
*
|
|
31
|
+
* Please note:
|
|
32
|
+
* - This only uses `display: none` and `display: revert` to show/hide, it does not skip rendering of children trees.
|
|
33
|
+
* - As this is rendered at all times, there is little performance savings here (just that this is not painted).
|
|
34
|
+
*/
|
|
35
|
+
var Show = exports.Show = function Show(_ref) {
|
|
36
|
+
var above = _ref.above,
|
|
37
|
+
below = _ref.below,
|
|
38
|
+
children = _ref.children,
|
|
39
|
+
_ref$as = _ref.as,
|
|
40
|
+
AsElement = _ref$as === void 0 ? 'div' : _ref$as,
|
|
41
|
+
xcss = _ref.xcss;
|
|
42
|
+
return /*#__PURE__*/React.createElement(AsElement
|
|
43
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- TODO: Allow pass-through from `props.xcss`
|
|
44
|
+
, {
|
|
45
|
+
className: (0, _runtime.ax)([styles.default, above && styles["above.".concat(above)], below && styles["below.".concat(below)], xcss])
|
|
46
|
+
}, children);
|
|
47
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.UNSAFE_useMediaQuery = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _bindEventListener = require("bind-event-listener");
|
|
9
|
+
var _mediaHelper = require("./media-helper");
|
|
10
|
+
var _window, _window$matchMedia, _window2, _window2$matchMedia, _window3, _window3$matchMedia, _window4, _window4$matchMedia, _window5, _window5$matchMedia, _window6, _window6$matchMedia, _window7, _window7$matchMedia, _window8, _window8$matchMedia, _window9, _window9$matchMedia, _window10, _window10$matchMedia, _window11, _window11$matchMedia;
|
|
11
|
+
var queries = {
|
|
12
|
+
'above.xxs': typeof window === 'undefined' ? undefined : (_window = window) === null || _window === void 0 || (_window$matchMedia = _window.matchMedia) === null || _window$matchMedia === void 0 ? void 0 : _window$matchMedia.call(_window, _mediaHelper.media.above.xxs.replace('@media ', '').trim()),
|
|
13
|
+
'above.xs': typeof window === 'undefined' ? undefined : (_window2 = window) === null || _window2 === void 0 || (_window2$matchMedia = _window2.matchMedia) === null || _window2$matchMedia === void 0 ? void 0 : _window2$matchMedia.call(_window2, _mediaHelper.media.above.xs.replace('@media ', '').trim()),
|
|
14
|
+
'above.sm': typeof window === 'undefined' ? undefined : (_window3 = window) === null || _window3 === void 0 || (_window3$matchMedia = _window3.matchMedia) === null || _window3$matchMedia === void 0 ? void 0 : _window3$matchMedia.call(_window3, _mediaHelper.media.above.sm.replace('@media ', '').trim()),
|
|
15
|
+
'above.md': typeof window === 'undefined' ? undefined : (_window4 = window) === null || _window4 === void 0 || (_window4$matchMedia = _window4.matchMedia) === null || _window4$matchMedia === void 0 ? void 0 : _window4$matchMedia.call(_window4, _mediaHelper.media.above.md.replace('@media ', '').trim()),
|
|
16
|
+
'above.lg': typeof window === 'undefined' ? undefined : (_window5 = window) === null || _window5 === void 0 || (_window5$matchMedia = _window5.matchMedia) === null || _window5$matchMedia === void 0 ? void 0 : _window5$matchMedia.call(_window5, _mediaHelper.media.above.lg.replace('@media ', '').trim()),
|
|
17
|
+
'above.xl': typeof window === 'undefined' ? undefined : (_window6 = window) === null || _window6 === void 0 || (_window6$matchMedia = _window6.matchMedia) === null || _window6$matchMedia === void 0 ? void 0 : _window6$matchMedia.call(_window6, _mediaHelper.media.above.xl.replace('@media ', '').trim()),
|
|
18
|
+
'below.xs': typeof window === 'undefined' ? undefined : (_window7 = window) === null || _window7 === void 0 || (_window7$matchMedia = _window7.matchMedia) === null || _window7$matchMedia === void 0 ? void 0 : _window7$matchMedia.call(_window7, _mediaHelper.media.below.xs.replace('@media ', '').trim()),
|
|
19
|
+
'below.sm': typeof window === 'undefined' ? undefined : (_window8 = window) === null || _window8 === void 0 || (_window8$matchMedia = _window8.matchMedia) === null || _window8$matchMedia === void 0 ? void 0 : _window8$matchMedia.call(_window8, _mediaHelper.media.below.sm.replace('@media ', '').trim()),
|
|
20
|
+
'below.md': typeof window === 'undefined' ? undefined : (_window9 = window) === null || _window9 === void 0 || (_window9$matchMedia = _window9.matchMedia) === null || _window9$matchMedia === void 0 ? void 0 : _window9$matchMedia.call(_window9, _mediaHelper.media.below.md.replace('@media ', '').trim()),
|
|
21
|
+
'below.lg': typeof window === 'undefined' ? undefined : (_window10 = window) === null || _window10 === void 0 || (_window10$matchMedia = _window10.matchMedia) === null || _window10$matchMedia === void 0 ? void 0 : _window10$matchMedia.call(_window10, _mediaHelper.media.below.lg.replace('@media ', '').trim()),
|
|
22
|
+
'below.xl': typeof window === 'undefined' ? undefined : (_window11 = window) === null || _window11 === void 0 || (_window11$matchMedia = _window11.matchMedia) === null || _window11$matchMedia === void 0 ? void 0 : _window11$matchMedia.call(_window11, _mediaHelper.media.below.xl.replace('@media ', '').trim())
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* A hook which returnes a `window.matchMedia` result to help you build responsively around breakpoints in JavaScript.
|
|
27
|
+
*
|
|
28
|
+
* The returning value **WILL NOT** update or react to change. You can use `mq.matches` to get the latest version and you can use the optional listener argument to react to changes as desired.
|
|
29
|
+
*
|
|
30
|
+
* @important
|
|
31
|
+
* - This will always be `null` in SSR and the event listener should not fire on SSR => clientside hydration.
|
|
32
|
+
* - `above.xxs` will always be truthy, your listener should never fire.
|
|
33
|
+
*
|
|
34
|
+
* @experimental This hook only works on the client-side and is not safe in an SSR environment as `window` is unavailable (and the user's viewport would be unknown)
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* const mq = useMediaQuery('below.md', useCallback((event) => console.log('changed', event.matches)), []))
|
|
38
|
+
* const isMobile = mq?.matches;
|
|
39
|
+
*
|
|
40
|
+
* @returns
|
|
41
|
+
* - `MediaQueryList`, primarily used to get if that media query is currently
|
|
42
|
+
* - `null` when `matchMedia` is unavailable, eg. in SSR.
|
|
43
|
+
*/
|
|
44
|
+
var UNSAFE_useMediaQuery = exports.UNSAFE_useMediaQuery = function UNSAFE_useMediaQuery(queryString, listener) {
|
|
45
|
+
var listenerRef = (0, _react.useRef)(listener);
|
|
46
|
+
(0, _react.useEffect)(function () {
|
|
47
|
+
// Bind the listener if changed so it's called on the next change event; no guarantee on timing.
|
|
48
|
+
listenerRef.current = listener;
|
|
49
|
+
}, [listener]);
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* We explicitly only react to boolean changes for binding our listener
|
|
53
|
+
* Changes to the functional reference are ignored.
|
|
54
|
+
*/
|
|
55
|
+
var hasListener = !!listener;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The `matchMedia(…)` return value for our breakpoint query.
|
|
59
|
+
*/
|
|
60
|
+
var mq = queries[queryString];
|
|
61
|
+
(0, _react.useLayoutEffect)(function () {
|
|
62
|
+
listenerRef.current = listener; // Bind the listener now in case the `useEffect` hasn't fired above yet
|
|
63
|
+
if (!mq || !hasListener || !listenerRef.current) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
return (0, _bindEventListener.bind)(mq, {
|
|
67
|
+
type: 'change',
|
|
68
|
+
listener: function listener(event) {
|
|
69
|
+
// We explicitly call the current version of the function
|
|
70
|
+
return listenerRef.current(event);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- explicitly do not trigger the effect on `listener` reference change, only on a boolean representation of it.
|
|
75
|
+
[mq, hasListener]);
|
|
76
|
+
return mq || null;
|
|
77
|
+
};
|
|
@@ -100,7 +100,7 @@ var AnchorNoRef = function AnchorNoRef(_ref, ref) {
|
|
|
100
100
|
action: 'clicked',
|
|
101
101
|
componentName: componentName || 'Anchor',
|
|
102
102
|
packageName: "@atlaskit/primitives",
|
|
103
|
-
packageVersion: "
|
|
103
|
+
packageVersion: "13.0.0",
|
|
104
104
|
analyticsData: analyticsContext,
|
|
105
105
|
actionSubject: 'link'
|
|
106
106
|
});
|
|
@@ -95,7 +95,7 @@ var Pressable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
95
95
|
action: 'clicked',
|
|
96
96
|
componentName: componentName || 'Pressable',
|
|
97
97
|
packageName: "@atlaskit/primitives",
|
|
98
|
-
packageVersion: "
|
|
98
|
+
packageVersion: "13.0.0",
|
|
99
99
|
analyticsData: analyticsContext,
|
|
100
100
|
actionSubject: 'button'
|
|
101
101
|
});
|
package/dist/cjs/index.js
CHANGED
|
@@ -70,12 +70,6 @@ Object.defineProperty(exports, "UNSAFE_BREAKPOINTS_CONFIG", {
|
|
|
70
70
|
return _responsive.UNSAFE_BREAKPOINTS_CONFIG;
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
|
-
Object.defineProperty(exports, "UNSAFE_SurfaceContext", {
|
|
74
|
-
enumerable: true,
|
|
75
|
-
get: function get() {
|
|
76
|
-
return _surfaceProvider.SurfaceContext;
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
73
|
Object.defineProperty(exports, "UNSAFE_inverseColorMap", {
|
|
80
74
|
enumerable: true,
|
|
81
75
|
get: function get() {
|
|
@@ -448,14 +448,15 @@ var fillMap = exports.fillMap = {
|
|
|
448
448
|
|
|
449
449
|
/**
|
|
450
450
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
451
|
-
* @codegen <<SignedSource::
|
|
451
|
+
* @codegen <<SignedSource::042cbfe8041c09e3817ae74154994f32>>
|
|
452
452
|
* @codegenId misc
|
|
453
453
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
454
454
|
* @codegenParams ["layer"]
|
|
455
455
|
* @codegenDependency ../../../primitives/scripts/codegen-file-templates/dimensions.tsx <<SignedSource::cc9b3f12104c6ede803da6a42daac0b0>>
|
|
456
|
-
* @codegenDependency ../../../primitives/scripts/codegen-file-templates/layer.tsx <<SignedSource::
|
|
456
|
+
* @codegenDependency ../../../primitives/scripts/codegen-file-templates/layer.tsx <<SignedSource::92793ca02dbfdad66e53ffbe9f0baa0a>>
|
|
457
457
|
*/
|
|
458
458
|
var layerMap = exports.layerMap = {
|
|
459
|
+
'1': 1,
|
|
459
460
|
card: 100,
|
|
460
461
|
navigation: 200,
|
|
461
462
|
dialog: 300,
|
|
@@ -499,12 +500,12 @@ var borderRadiusMap = exports.borderRadiusMap = {
|
|
|
499
500
|
|
|
500
501
|
/**
|
|
501
502
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
502
|
-
* @codegen <<SignedSource::
|
|
503
|
+
* @codegen <<SignedSource::96d9a841cb440c2bd770d0af5c670f10>>
|
|
503
504
|
* @codegenId typography
|
|
504
505
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
505
506
|
* @codegenParams ["fontSize", "fontWeight", "fontFamily", "lineHeight", "body", "ui"]
|
|
506
507
|
* @codegenDependency ../../../primitives/scripts/codegen-file-templates/dimensions.tsx <<SignedSource::cc9b3f12104c6ede803da6a42daac0b0>>
|
|
507
|
-
* @codegenDependency ../../../primitives/scripts/codegen-file-templates/layer.tsx <<SignedSource::
|
|
508
|
+
* @codegenDependency ../../../primitives/scripts/codegen-file-templates/layer.tsx <<SignedSource::92793ca02dbfdad66e53ffbe9f0baa0a>>
|
|
508
509
|
*/
|
|
509
510
|
var fontMap = exports.fontMap = {
|
|
510
511
|
'font.body': "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
@@ -539,11 +540,11 @@ var fontFamilyMap = exports.fontFamilyMap = {
|
|
|
539
540
|
|
|
540
541
|
/**
|
|
541
542
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
542
|
-
* @codegen <<SignedSource::
|
|
543
|
+
* @codegen <<SignedSource::ae96213e36b930556f9ad18382088ff8>>
|
|
543
544
|
* @codegenId text
|
|
544
545
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
545
546
|
* @codegenDependency ../../../primitives/scripts/codegen-file-templates/dimensions.tsx <<SignedSource::cc9b3f12104c6ede803da6a42daac0b0>>
|
|
546
|
-
* @codegenDependency ../../../primitives/scripts/codegen-file-templates/layer.tsx <<SignedSource::
|
|
547
|
+
* @codegenDependency ../../../primitives/scripts/codegen-file-templates/layer.tsx <<SignedSource::92793ca02dbfdad66e53ffbe9f0baa0a>>
|
|
547
548
|
*/
|
|
548
549
|
var textSizeMap = exports.textSizeMap = {
|
|
549
550
|
medium: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
._1hms8stv{text-decoration-line:underline}
|
|
3
|
+
._4bfu18uv{text-decoration-color:initial}
|
|
4
|
+
._ajmmnqa1{text-decoration-style:solid}
|
|
5
|
+
._vchhusvi{box-sizing:border-box}
|
|
6
|
+
._ymio1r31:focus:not(:focus-visible){outline-color:currentColor}
|
|
7
|
+
._ypr0glyw:focus:not(:focus-visible){outline-style:none}
|
|
8
|
+
._zcxs1o36:focus:not(:focus-visible){outline-width:medium}._1bg4v77o:focus, ._1ah3v77o:focus-visible{outline-offset:var(--ds-space-025,2px)}
|
|
9
|
+
._1hvw1bk5:focus, ._128m1bk5:focus-visible{outline-width:var(--ds-border-width-outline,2px)}
|
|
10
|
+
._49pcnqa1:focus, ._ra3xnqa1:focus-visible{outline-style:solid}
|
|
11
|
+
._nt751p6i:focus, ._mizu1p6i:focus-visible{outline-color:var(--ds-border-focused,#388bff)}
|
|
12
|
+
@media screen and (-ms-high-contrast:active),screen and (forced-colors:active){._qa7m1r31:focus-visible{outline-color:currentColor}._1cvmnqa1:focus-visible{outline-style:solid}._4davt94y:focus-visible{outline-width:1px}}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/* anchor.tsx generated by @compiled/babel-plugin v0.32.2 */
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import "./anchor.compiled.css";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
6
|
+
import { forwardRef, useCallback, useContext } from 'react';
|
|
7
|
+
import invariant from 'tiny-invariant';
|
|
8
|
+
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
|
|
9
|
+
import { useRouterLink } from '@atlaskit/app-provider';
|
|
10
|
+
import noop from '@atlaskit/ds-lib/noop';
|
|
11
|
+
import { useId } from '@atlaskit/ds-lib/use-id';
|
|
12
|
+
import InteractionContext from '@atlaskit/interaction-context';
|
|
13
|
+
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
14
|
+
const styles = {
|
|
15
|
+
root: "_vchhusvi _4bfu18uv _1hms8stv _ajmmnqa1",
|
|
16
|
+
focusRing: "_ymio1r31 _ypr0glyw _zcxs1o36 _nt751p6i _mizu1p6i _1bg4v77o _1ah3v77o _49pcnqa1 _ra3xnqa1 _1hvw1bk5 _128m1bk5 _qa7m1r31 _1cvmnqa1 _4davt94y"
|
|
17
|
+
};
|
|
18
|
+
const IS_EXTERNAL_LINK_REGEX = /^(?:(http|https):\/\/)/;
|
|
19
|
+
const IS_NON_HTTP_BASED = /^(((mailto|tel|sms):)|(#))/;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* __Anchor__
|
|
23
|
+
*
|
|
24
|
+
* A primitive for building custom anchor links.
|
|
25
|
+
*
|
|
26
|
+
* - [Examples](https://atlassian.design/components/primitives/anchor/examples)
|
|
27
|
+
* - [Code](https://atlassian.design/components/primitives/anchor/code)
|
|
28
|
+
* - [Usage](https://atlassian.design/components/primitives/anchor/usage)
|
|
29
|
+
*/
|
|
30
|
+
const AnchorNoRef = ({
|
|
31
|
+
href,
|
|
32
|
+
children,
|
|
33
|
+
onClick: providedOnClick = noop,
|
|
34
|
+
interactionName,
|
|
35
|
+
componentName,
|
|
36
|
+
analyticsContext,
|
|
37
|
+
'aria-label': ariaLabel,
|
|
38
|
+
'aria-labelledby': ariaLabelledBy,
|
|
39
|
+
style,
|
|
40
|
+
target,
|
|
41
|
+
testId,
|
|
42
|
+
xcss,
|
|
43
|
+
opensInNewWindowLabel = '(opens new window)',
|
|
44
|
+
...htmlAttributes
|
|
45
|
+
}, ref) => {
|
|
46
|
+
const interactionContext = useContext(InteractionContext);
|
|
47
|
+
const handleClick = useCallback((e, analyticsEvent) => {
|
|
48
|
+
interactionContext && interactionContext.tracePress(interactionName, e.timeStamp);
|
|
49
|
+
providedOnClick(e, analyticsEvent);
|
|
50
|
+
}, [providedOnClick, interactionContext, interactionName]);
|
|
51
|
+
const opensNewWindowLabelId = useId();
|
|
52
|
+
const onClick = usePlatformLeafEventHandler({
|
|
53
|
+
fn: handleClick,
|
|
54
|
+
action: 'clicked',
|
|
55
|
+
componentName: componentName || 'Anchor',
|
|
56
|
+
packageName: "@atlaskit/primitives",
|
|
57
|
+
packageVersion: "13.0.0",
|
|
58
|
+
analyticsData: analyticsContext,
|
|
59
|
+
actionSubject: 'link'
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// This is to remove className from safeHtmlAttributes
|
|
63
|
+
// @ts-expect-error className doesn't exist in the prop definition but we want to ensure it cannot be applied even if types are bypassed
|
|
64
|
+
const {
|
|
65
|
+
className: _spreadClass,
|
|
66
|
+
...safeHtmlAttributes
|
|
67
|
+
} = htmlAttributes;
|
|
68
|
+
const RouterLink = useRouterLink();
|
|
69
|
+
const isExternal = typeof href === 'string' && IS_EXTERNAL_LINK_REGEX.test(href);
|
|
70
|
+
const isNonHttpBased = typeof href === 'string' && IS_NON_HTTP_BASED.test(href);
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Renders a router link if:
|
|
74
|
+
*
|
|
75
|
+
* - a link component is set in the app provider
|
|
76
|
+
* - it's not an external link (starting with `http://` or `https://`)
|
|
77
|
+
* - it's not a non-HTTP-based link (e.g. emails, phone numbers, hash links etc.).
|
|
78
|
+
*/
|
|
79
|
+
const isRouterLink = RouterLink && !isExternal && !isNonHttpBased;
|
|
80
|
+
const hrefObjectUsedWithoutRouterLink = RouterLink === undefined && typeof href === 'object';
|
|
81
|
+
invariant(!hrefObjectUsedWithoutRouterLink, `@atlaskit/primitives: Anchor primitive cannot pass an object to 'href' unless a router link is configured in the AppProvider`);
|
|
82
|
+
const Component = isRouterLink ? RouterLink : 'a';
|
|
83
|
+
return /*#__PURE__*/React.createElement(Component
|
|
84
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- TODO: Allow pass-through from `props.xcss`
|
|
85
|
+
, _extends({
|
|
86
|
+
className: ax([styles.root, styles.focusRing, xcss])
|
|
87
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- TODO: Properly type this and allow pass-through if we can determine the type
|
|
88
|
+
,
|
|
89
|
+
style: style,
|
|
90
|
+
ref: ref
|
|
91
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
92
|
+
}, safeHtmlAttributes, {
|
|
93
|
+
// @ts-expect-error
|
|
94
|
+
href: !isRouterLink && typeof href !== 'string' ? undefined : href,
|
|
95
|
+
target: target,
|
|
96
|
+
onClick: onClick,
|
|
97
|
+
"aria-label": ariaLabel && target === '_blank' && !ariaLabelledBy ? `${ariaLabel} ${opensInNewWindowLabel}` : ariaLabel,
|
|
98
|
+
"aria-labelledby": ariaLabelledBy && target === '_blank' ? `${ariaLabelledBy} ${opensNewWindowLabelId}` : ariaLabelledBy,
|
|
99
|
+
"data-testid": testId,
|
|
100
|
+
"data-is-router-link": testId ? isRouterLink ? 'true' : 'false' : undefined
|
|
101
|
+
}), children, target === '_blank' && (children && !ariaLabel && !ariaLabelledBy || ariaLabelledBy) && /*#__PURE__*/React.createElement(VisuallyHidden, {
|
|
102
|
+
id: opensNewWindowLabelId
|
|
103
|
+
}, opensInNewWindowLabel));
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// Workarounds to support generic types with forwardRef
|
|
107
|
+
/**
|
|
108
|
+
* __Anchor__
|
|
109
|
+
*
|
|
110
|
+
* Anchor is a primitive for building custom anchor links. It's a wrapper around the HTML `<a>` element that provides a consistent API for handling client-side routing and Atlassian Design System styling.
|
|
111
|
+
*
|
|
112
|
+
* - [Examples](https://atlassian.design/components/primitives/anchor/examples)
|
|
113
|
+
* - [Code](https://atlassian.design/components/primitives/anchor/code)
|
|
114
|
+
* - [Usage](https://atlassian.design/components/primitives/anchor/usage)
|
|
115
|
+
*/
|
|
116
|
+
const Anchor = /*#__PURE__*/forwardRef(AnchorNoRef);
|
|
117
|
+
export default Anchor;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
._195g1e8l{margin-inline:var(--ds-space-negative-200,-1rem)}
|
|
2
|
+
._195g4pxn{margin-inline:var(--ds-space-negative-025,-.125rem)}
|
|
3
|
+
._195ggp71{margin-inline:var(--ds-space-negative-050,-.25rem)}
|
|
4
|
+
._195gkqjj{margin-inline:var(--ds-space-negative-150,-.75rem)}
|
|
5
|
+
._195gtdkl{margin-inline:var(--ds-space-negative-100,-.5rem)}
|
|
6
|
+
._1mou1e8l{margin-block:var(--ds-space-negative-200,-1rem)}
|
|
7
|
+
._1mou4pxn{margin-block:var(--ds-space-negative-025,-.125rem)}
|
|
8
|
+
._1mougp71{margin-block:var(--ds-space-negative-050,-.25rem)}
|
|
9
|
+
._1moukqjj{margin-block:var(--ds-space-negative-150,-.75rem)}
|
|
10
|
+
._1moutdkl{margin-block:var(--ds-space-negative-100,-.5rem)}
|
|
11
|
+
._vchhusvi{box-sizing:border-box}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/* bleed.tsx generated by @compiled/babel-plugin v0.32.2 */
|
|
2
|
+
import "./bleed.compiled.css";
|
|
3
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
// NOTE: This maintains a full map of 10 styles as Bleed is a bit of a semantic outlier
|
|
6
|
+
const styles = {
|
|
7
|
+
root: "_vchhusvi",
|
|
8
|
+
'inline.space.025': "_195g4pxn",
|
|
9
|
+
'inline.space.050': "_195ggp71",
|
|
10
|
+
'inline.space.100': "_195gtdkl",
|
|
11
|
+
'inline.space.150': "_195gkqjj",
|
|
12
|
+
'inline.space.200': "_195g1e8l",
|
|
13
|
+
'block.space.025': "_1mou4pxn",
|
|
14
|
+
'block.space.050': "_1mougp71",
|
|
15
|
+
'block.space.100': "_1moutdkl",
|
|
16
|
+
'block.space.150': "_1moukqjj",
|
|
17
|
+
'block.space.200': "_1mou1e8l"
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* __Bleed__
|
|
22
|
+
*
|
|
23
|
+
* `Bleed` is a primitive layout component that controls negative whitespace.
|
|
24
|
+
*
|
|
25
|
+
* - [Examples](https://atlassian.design/components/primitives/bleed/examples)
|
|
26
|
+
* - [Code](https://atlassian.design/components/primitives/bleed/code)
|
|
27
|
+
*/
|
|
28
|
+
const Bleed = /*#__PURE__*/React.memo(({
|
|
29
|
+
children,
|
|
30
|
+
testId,
|
|
31
|
+
inline,
|
|
32
|
+
block,
|
|
33
|
+
all,
|
|
34
|
+
xcss
|
|
35
|
+
}) => {
|
|
36
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
37
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- TODO: Allow pass-through from `props.xcss`
|
|
38
|
+
className: ax([styles.root, all && styles[`inline.${all}`], inline && styles[`inline.${inline}`], all && styles[`block.${all}`], block && styles[`block.${block}`], xcss]),
|
|
39
|
+
"data-testid": testId
|
|
40
|
+
}, children);
|
|
41
|
+
});
|
|
42
|
+
Bleed.displayName = 'Bleed';
|
|
43
|
+
export default Bleed;
|