@atlaskit/primitives 13.2.0 → 13.3.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 +15 -0
- package/dist/cjs/compiled/components/anchor.compiled.css +1 -9
- package/dist/cjs/compiled/components/anchor.js +15 -9
- package/dist/cjs/compiled/components/focusable.compiled.css +6 -0
- package/dist/cjs/compiled/components/focusable.js +59 -0
- package/dist/cjs/compiled/components/pressable.compiled.css +1 -9
- package/dist/cjs/compiled/components/pressable.js +13 -8
- package/dist/cjs/compiled/index.js +13 -0
- package/dist/cjs/components/anchor.js +1 -1
- package/dist/cjs/components/pressable.js +1 -1
- package/dist/es2019/compiled/components/anchor.compiled.css +1 -9
- package/dist/es2019/compiled/components/anchor.js +15 -9
- package/dist/es2019/compiled/components/focusable.compiled.css +6 -0
- package/dist/es2019/compiled/components/focusable.js +42 -0
- package/dist/es2019/compiled/components/pressable.compiled.css +1 -9
- package/dist/es2019/compiled/components/pressable.js +13 -8
- package/dist/es2019/compiled/index.js +2 -2
- package/dist/es2019/components/anchor.js +1 -1
- package/dist/es2019/components/pressable.js +1 -1
- package/dist/esm/compiled/components/anchor.compiled.css +1 -9
- package/dist/esm/compiled/components/anchor.js +15 -9
- package/dist/esm/compiled/components/focusable.compiled.css +6 -0
- package/dist/esm/compiled/components/focusable.js +49 -0
- package/dist/esm/compiled/components/pressable.compiled.css +1 -9
- package/dist/esm/compiled/components/pressable.js +13 -8
- package/dist/esm/compiled/index.js +2 -2
- package/dist/esm/components/anchor.js +1 -1
- package/dist/esm/components/pressable.js +1 -1
- package/dist/types/compiled/components/focusable.d.ts +36 -0
- package/dist/types/compiled/index.d.ts +3 -1
- package/dist/types-ts4.5/compiled/components/focusable.d.ts +36 -0
- package/dist/types-ts4.5/compiled/index.d.ts +3 -1
- package/package.json +6 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/primitives
|
|
2
2
|
|
|
3
|
+
## 13.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 13.3.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#165860](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/165860)
|
|
14
|
+
[`c2dec1ca710f3`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c2dec1ca710f3) -
|
|
15
|
+
Adds an experimental Focusable component under the Compiled entrypoint, which requires a specific
|
|
16
|
+
setup.
|
|
17
|
+
|
|
3
18
|
## 13.2.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
1
|
._1hms8stv{text-decoration-line:underline}
|
|
3
2
|
._4bfu18uv{text-decoration-color:initial}
|
|
4
3
|
._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}}
|
|
4
|
+
._vchhusvi{box-sizing:border-box}
|
|
@@ -14,6 +14,7 @@ var _runtime = require("@compiled/react/runtime");
|
|
|
14
14
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
15
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
16
16
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
17
|
+
var _react2 = require("@compiled/react");
|
|
17
18
|
var _tinyInvariant = _interopRequireDefault(require("tiny-invariant"));
|
|
18
19
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
19
20
|
var _appProvider = require("@atlaskit/app-provider");
|
|
@@ -21,13 +22,13 @@ var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
|
21
22
|
var _useId = require("@atlaskit/ds-lib/use-id");
|
|
22
23
|
var _interactionContext = _interopRequireDefault(require("@atlaskit/interaction-context"));
|
|
23
24
|
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
|
|
25
|
+
var _focusable = _interopRequireDefault(require("./focusable"));
|
|
24
26
|
var _excluded = ["href", "children", "onClick", "interactionName", "componentName", "analyticsContext", "aria-label", "aria-labelledby", "style", "target", "testId", "xcss", "opensInNewWindowLabel"],
|
|
25
27
|
_excluded2 = ["className"];
|
|
26
28
|
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); }
|
|
27
29
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(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; }
|
|
28
30
|
var styles = {
|
|
29
|
-
root: "_vchhusvi _4bfu18uv _1hms8stv _ajmmnqa1"
|
|
30
|
-
focusRing: "_ymio1r31 _ypr0glyw _zcxs1o36 _nt751p6i _mizu1p6i _1bg4v77o _1ah3v77o _49pcnqa1 _ra3xnqa1 _1hvw1bk5 _128m1bk5 _qa7m1r31 _1cvmnqa1 _4davt94y"
|
|
31
|
+
root: "_vchhusvi _4bfu18uv _1hms8stv _ajmmnqa1"
|
|
31
32
|
};
|
|
32
33
|
var IS_EXTERNAL_LINK_REGEX = /^(?:(http|https):\/\/)/;
|
|
33
34
|
var IS_NON_HTTP_BASED = /^(((mailto|tel|sms):)|(#))/;
|
|
@@ -69,7 +70,7 @@ var AnchorNoRef = function AnchorNoRef(_ref, ref) {
|
|
|
69
70
|
action: 'clicked',
|
|
70
71
|
componentName: componentName || 'Anchor',
|
|
71
72
|
packageName: "@atlaskit/primitives",
|
|
72
|
-
packageVersion: "13.
|
|
73
|
+
packageVersion: "13.3.1",
|
|
73
74
|
analyticsData: analyticsContext,
|
|
74
75
|
actionSubject: 'link'
|
|
75
76
|
});
|
|
@@ -93,23 +94,28 @@ var AnchorNoRef = function AnchorNoRef(_ref, ref) {
|
|
|
93
94
|
var hrefObjectUsedWithoutRouterLink = RouterLink === undefined && (0, _typeof2.default)(href) === 'object';
|
|
94
95
|
(0, _tinyInvariant.default)(!hrefObjectUsedWithoutRouterLink, "@atlaskit/primitives: Anchor primitive cannot pass an object to 'href' unless a router link is configured in the AppProvider");
|
|
95
96
|
var Component = isRouterLink ? RouterLink : 'a';
|
|
96
|
-
return /*#__PURE__*/React.createElement(
|
|
97
|
-
//
|
|
97
|
+
return /*#__PURE__*/React.createElement(_focusable.default
|
|
98
|
+
// @ts-expect-error we don't allow `a` on Focusable for makers as they should use Anchor instead
|
|
98
99
|
, (0, _extends2.default)({
|
|
99
|
-
|
|
100
|
+
as: Component
|
|
101
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- TODO: Allow pass-through from `props.xcss`
|
|
102
|
+
,
|
|
103
|
+
className: xcss
|
|
100
104
|
// 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
|
|
101
105
|
,
|
|
102
106
|
style: style,
|
|
103
107
|
ref: ref
|
|
104
108
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
105
109
|
}, safeHtmlAttributes, {
|
|
106
|
-
// @ts-expect-error
|
|
107
110
|
href: !isRouterLink && typeof href !== 'string' ? undefined : href,
|
|
108
111
|
target: target,
|
|
109
112
|
onClick: onClick,
|
|
110
113
|
"aria-label": ariaLabel && target === '_blank' && !ariaLabelledBy ? "".concat(ariaLabel, " ").concat(opensInNewWindowLabel) : ariaLabel,
|
|
111
|
-
"aria-labelledby": ariaLabelledBy && target === '_blank' ? "".concat(ariaLabelledBy, " ").concat(opensNewWindowLabelId) : ariaLabelledBy
|
|
112
|
-
|
|
114
|
+
"aria-labelledby": ariaLabelledBy && target === '_blank' ? "".concat(ariaLabelledBy, " ").concat(opensNewWindowLabelId) : ariaLabelledBy
|
|
115
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- TODO: We need to handle pass-through `xcss` => `xcss` here.
|
|
116
|
+
,
|
|
117
|
+
xcss: (0, _react2.cx)(styles.root, xcss),
|
|
118
|
+
testId: testId,
|
|
113
119
|
"data-is-router-link": testId ? isRouterLink ? 'true' : 'false' : undefined
|
|
114
120
|
}), children, target === '_blank' && (children && !ariaLabel && !ariaLabelledBy || ariaLabelledBy) && /*#__PURE__*/React.createElement(_visuallyHidden.default, {
|
|
115
121
|
id: opensNewWindowLabelId
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
._128m1bk5:focus-visible{outline-width:var(--ds-border-width-outline,2px)}
|
|
2
|
+
._1ah3115h:focus-visible{outline-offset:var(--_1203r2w)}
|
|
3
|
+
._1ah31bk5:focus-visible{outline-offset:var(--ds-border-width-outline,2px)}
|
|
4
|
+
._mizu194a:focus-visible{outline-color:var(--ds-border-focused,#2684ff)}
|
|
5
|
+
._ra3xnqa1:focus-visible{outline-style:solid}
|
|
6
|
+
@media screen and (-ms-high-contrast:active),screen and (forced-colors:active){._1cvmnqa1:focus-visible{outline-style:solid}._4davt94y:focus-visible{outline-width:1px}._2mwq115h:focus-visible{outline-offset:var(--_1203r2w)}}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/* focusable.tsx generated by @compiled/babel-plugin v0.32.2 */
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.default = void 0;
|
|
10
|
+
require("./focusable.compiled.css");
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var React = _react;
|
|
13
|
+
var _runtime = require("@compiled/react/runtime");
|
|
14
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
17
|
+
var _excluded = ["as", "children", "isInset", "testId", "style", "xcss"],
|
|
18
|
+
_excluded2 = ["className"];
|
|
19
|
+
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); }
|
|
20
|
+
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; }
|
|
21
|
+
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; }
|
|
22
|
+
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; }
|
|
23
|
+
var focusRingStyles = null;
|
|
24
|
+
var insetFocusRingStyles = null;
|
|
25
|
+
/**
|
|
26
|
+
* __Focus ring__
|
|
27
|
+
*
|
|
28
|
+
* A focus ring visually indicates the currently focused item.
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
|
+
var Focusable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
32
|
+
var _ref$as = _ref.as,
|
|
33
|
+
Component = _ref$as === void 0 ? 'button' : _ref$as,
|
|
34
|
+
children = _ref.children,
|
|
35
|
+
isInset = _ref.isInset,
|
|
36
|
+
testId = _ref.testId,
|
|
37
|
+
style = _ref.style,
|
|
38
|
+
xcss = _ref.xcss,
|
|
39
|
+
htmlAttributes = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
40
|
+
// This is to remove className from safeHtmlAttributes
|
|
41
|
+
// @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
|
|
42
|
+
var _spreadClass = htmlAttributes.className,
|
|
43
|
+
safeHtmlAttributes = (0, _objectWithoutProperties2.default)(htmlAttributes, _excluded2);
|
|
44
|
+
return /*#__PURE__*/React.createElement(Component, (0, _extends2.default)({}, safeHtmlAttributes, {
|
|
45
|
+
// @ts-ignore Expression produces a union type that is too complex to represent. We may be able to narrow the type here but unsure.
|
|
46
|
+
ref: ref
|
|
47
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
48
|
+
,
|
|
49
|
+
className: (0, _runtime.ax)(["_mizu194a _1ah31bk5 _ra3xnqa1 _128m1bk5 _1cvmnqa1 _4davt94y", isInset && "_1ah3115h _2mwq115h", xcss])
|
|
50
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
51
|
+
,
|
|
52
|
+
|
|
53
|
+
"data-testid": testId,
|
|
54
|
+
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
55
|
+
"--_1203r2w": (0, _runtime.ix)("calc(0px - ".concat("var(--ds-border-width-outline, 2px)", ")"))
|
|
56
|
+
})
|
|
57
|
+
}), children);
|
|
58
|
+
});
|
|
59
|
+
var _default = exports.default = Focusable;
|
|
@@ -2,12 +2,4 @@
|
|
|
2
2
|
._80om13gf{cursor:not-allowed}
|
|
3
3
|
._80omtlke{cursor:pointer}
|
|
4
4
|
._r06hglyw{-webkit-appearance:none;appearance:none}
|
|
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}
|
|
9
|
-
._1bg4v77o:focus, ._1ah3v77o:focus-visible{outline-offset:var(--ds-space-025,2px)}
|
|
10
|
-
._1hvw1bk5:focus, ._128m1bk5:focus-visible{outline-width:var(--ds-border-width-outline,2px)}
|
|
11
|
-
._49pcnqa1:focus, ._ra3xnqa1:focus-visible{outline-style:solid}
|
|
12
|
-
._nt751p6i:focus, ._mizu1p6i:focus-visible{outline-color:var(--ds-border-focused,#388bff)}
|
|
13
|
-
@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}}
|
|
5
|
+
._vchhusvi{box-sizing:border-box}
|
|
@@ -13,17 +13,18 @@ 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 _react2 = require("@compiled/react");
|
|
16
17
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
17
18
|
var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
18
19
|
var _interactionContext = _interopRequireDefault(require("@atlaskit/interaction-context"));
|
|
20
|
+
var _focusable = _interopRequireDefault(require("./focusable"));
|
|
19
21
|
var _excluded = ["children", "isDisabled", "type", "onClick", "interactionName", "componentName", "analyticsContext", "style", "testId", "xcss"],
|
|
20
22
|
_excluded2 = ["className"];
|
|
21
23
|
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); }
|
|
22
24
|
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; }
|
|
23
25
|
var styles = {
|
|
24
26
|
root: "_vchhusvi _r06hglyw _19itglyw _80omtlke",
|
|
25
|
-
disabled: "_80om13gf"
|
|
26
|
-
focusRing: "_ymio1r31 _ypr0glyw _zcxs1o36 _nt751p6i _mizu1p6i _1bg4v77o _1ah3v77o _49pcnqa1 _ra3xnqa1 _1hvw1bk5 _128m1bk5 _qa7m1r31 _1cvmnqa1 _4davt94y"
|
|
27
|
+
disabled: "_80om13gf"
|
|
27
28
|
};
|
|
28
29
|
|
|
29
30
|
/**
|
|
@@ -59,7 +60,7 @@ var Pressable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
59
60
|
action: 'clicked',
|
|
60
61
|
componentName: componentName || 'Pressable',
|
|
61
62
|
packageName: "@atlaskit/primitives",
|
|
62
|
-
packageVersion: "13.
|
|
63
|
+
packageVersion: "13.3.1",
|
|
63
64
|
analyticsData: analyticsContext,
|
|
64
65
|
actionSubject: 'button'
|
|
65
66
|
});
|
|
@@ -68,9 +69,10 @@ var Pressable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
68
69
|
// @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
|
|
69
70
|
var _spreadClass = htmlAttributes.className,
|
|
70
71
|
safeHtmlAttributes = (0, _objectWithoutProperties2.default)(htmlAttributes, _excluded2);
|
|
71
|
-
return /*#__PURE__*/React.createElement(
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
return /*#__PURE__*/React.createElement(_focusable.default
|
|
73
|
+
// @ts-expect-error we don't allow `button` on Focusable for makers as they should use Pressable instead
|
|
74
|
+
, (0, _extends2.default)({
|
|
75
|
+
as: "button"
|
|
74
76
|
// 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
|
|
75
77
|
,
|
|
76
78
|
style: style
|
|
@@ -79,8 +81,11 @@ var Pressable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
79
81
|
// eslint-disable-next-line react/button-has-type
|
|
80
82
|
type: type,
|
|
81
83
|
onClick: onClick,
|
|
82
|
-
disabled: isDisabled
|
|
83
|
-
|
|
84
|
+
disabled: isDisabled
|
|
85
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- TODO: We need to handle pass-through `xcss` => `xcss` here.
|
|
86
|
+
,
|
|
87
|
+
xcss: (0, _react2.cx)(styles.root, isDisabled && styles.disabled, xcss),
|
|
88
|
+
testId: testId,
|
|
84
89
|
ref: ref
|
|
85
90
|
}), children);
|
|
86
91
|
});
|
|
@@ -28,6 +28,12 @@ Object.defineProperty(exports, "Flex", {
|
|
|
28
28
|
return _flex.default;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
+
Object.defineProperty(exports, "Focusable", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function get() {
|
|
34
|
+
return _focusable.default;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
31
37
|
Object.defineProperty(exports, "Grid", {
|
|
32
38
|
enumerable: true,
|
|
33
39
|
get: function get() {
|
|
@@ -58,6 +64,12 @@ Object.defineProperty(exports, "Text", {
|
|
|
58
64
|
return _text.default;
|
|
59
65
|
}
|
|
60
66
|
});
|
|
67
|
+
Object.defineProperty(exports, "UNSAFE_useMediaQuery", {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
get: function get() {
|
|
70
|
+
return _responsive.UNSAFE_useMediaQuery;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
61
73
|
Object.defineProperty(exports, "UNSAFE_useSurface", {
|
|
62
74
|
enumerable: true,
|
|
63
75
|
get: function get() {
|
|
@@ -80,4 +92,5 @@ var _text = _interopRequireDefault(require("./components/text"));
|
|
|
80
92
|
var _pressable = _interopRequireDefault(require("./components/pressable"));
|
|
81
93
|
var _anchor = _interopRequireDefault(require("./components/anchor"));
|
|
82
94
|
var _responsive = require("./responsive");
|
|
95
|
+
var _focusable = _interopRequireDefault(require("./components/focusable"));
|
|
83
96
|
var _surfaceProvider = require("./components/internal/surface-provider");
|
|
@@ -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: "13.
|
|
103
|
+
packageVersion: "13.3.1",
|
|
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: "13.
|
|
98
|
+
packageVersion: "13.3.1",
|
|
99
99
|
analyticsData: analyticsContext,
|
|
100
100
|
actionSubject: 'button'
|
|
101
101
|
});
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
1
|
._1hms8stv{text-decoration-line:underline}
|
|
3
2
|
._4bfu18uv{text-decoration-color:initial}
|
|
4
3
|
._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}}
|
|
4
|
+
._vchhusvi{box-sizing:border-box}
|
|
@@ -4,6 +4,7 @@ import "./anchor.compiled.css";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
6
|
import { forwardRef, useCallback, useContext } from 'react';
|
|
7
|
+
import { cx } from '@compiled/react';
|
|
7
8
|
import invariant from 'tiny-invariant';
|
|
8
9
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
|
|
9
10
|
import { useRouterLink } from '@atlaskit/app-provider';
|
|
@@ -11,9 +12,9 @@ import noop from '@atlaskit/ds-lib/noop';
|
|
|
11
12
|
import { useId } from '@atlaskit/ds-lib/use-id';
|
|
12
13
|
import InteractionContext from '@atlaskit/interaction-context';
|
|
13
14
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
15
|
+
import Focusable from './focusable';
|
|
14
16
|
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
|
+
root: "_vchhusvi _4bfu18uv _1hms8stv _ajmmnqa1"
|
|
17
18
|
};
|
|
18
19
|
const IS_EXTERNAL_LINK_REGEX = /^(?:(http|https):\/\/)/;
|
|
19
20
|
const IS_NON_HTTP_BASED = /^(((mailto|tel|sms):)|(#))/;
|
|
@@ -54,7 +55,7 @@ const AnchorNoRef = ({
|
|
|
54
55
|
action: 'clicked',
|
|
55
56
|
componentName: componentName || 'Anchor',
|
|
56
57
|
packageName: "@atlaskit/primitives",
|
|
57
|
-
packageVersion: "13.
|
|
58
|
+
packageVersion: "13.3.1",
|
|
58
59
|
analyticsData: analyticsContext,
|
|
59
60
|
actionSubject: 'link'
|
|
60
61
|
});
|
|
@@ -80,23 +81,28 @@ const AnchorNoRef = ({
|
|
|
80
81
|
const hrefObjectUsedWithoutRouterLink = RouterLink === undefined && typeof href === 'object';
|
|
81
82
|
invariant(!hrefObjectUsedWithoutRouterLink, `@atlaskit/primitives: Anchor primitive cannot pass an object to 'href' unless a router link is configured in the AppProvider`);
|
|
82
83
|
const Component = isRouterLink ? RouterLink : 'a';
|
|
83
|
-
return /*#__PURE__*/React.createElement(
|
|
84
|
-
//
|
|
84
|
+
return /*#__PURE__*/React.createElement(Focusable
|
|
85
|
+
// @ts-expect-error we don't allow `a` on Focusable for makers as they should use Anchor instead
|
|
85
86
|
, _extends({
|
|
86
|
-
|
|
87
|
+
as: Component
|
|
88
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- TODO: Allow pass-through from `props.xcss`
|
|
89
|
+
,
|
|
90
|
+
className: xcss
|
|
87
91
|
// 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
92
|
,
|
|
89
93
|
style: style,
|
|
90
94
|
ref: ref
|
|
91
95
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
92
96
|
}, safeHtmlAttributes, {
|
|
93
|
-
// @ts-expect-error
|
|
94
97
|
href: !isRouterLink && typeof href !== 'string' ? undefined : href,
|
|
95
98
|
target: target,
|
|
96
99
|
onClick: onClick,
|
|
97
100
|
"aria-label": ariaLabel && target === '_blank' && !ariaLabelledBy ? `${ariaLabel} ${opensInNewWindowLabel}` : ariaLabel,
|
|
98
|
-
"aria-labelledby": ariaLabelledBy && target === '_blank' ? `${ariaLabelledBy} ${opensNewWindowLabelId}` : ariaLabelledBy
|
|
99
|
-
|
|
101
|
+
"aria-labelledby": ariaLabelledBy && target === '_blank' ? `${ariaLabelledBy} ${opensNewWindowLabelId}` : ariaLabelledBy
|
|
102
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- TODO: We need to handle pass-through `xcss` => `xcss` here.
|
|
103
|
+
,
|
|
104
|
+
xcss: cx(styles.root, xcss),
|
|
105
|
+
testId: testId,
|
|
100
106
|
"data-is-router-link": testId ? isRouterLink ? 'true' : 'false' : undefined
|
|
101
107
|
}), children, target === '_blank' && (children && !ariaLabel && !ariaLabelledBy || ariaLabelledBy) && /*#__PURE__*/React.createElement(VisuallyHidden, {
|
|
102
108
|
id: opensNewWindowLabelId
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
._128m1bk5:focus-visible{outline-width:var(--ds-border-width-outline,2px)}
|
|
2
|
+
._1ah311pw:focus-visible{outline-offset:calc(0px - var(--ds-border-width-outline, 2px))}
|
|
3
|
+
._1ah31bk5:focus-visible{outline-offset:var(--ds-border-width-outline,2px)}
|
|
4
|
+
._mizu194a:focus-visible{outline-color:var(--ds-border-focused,#2684ff)}
|
|
5
|
+
._ra3xnqa1:focus-visible{outline-style:solid}
|
|
6
|
+
@media screen and (-ms-high-contrast:active),screen and (forced-colors:active){._1cvmnqa1:focus-visible{outline-style:solid}._4davt94y:focus-visible{outline-width:1px}._2mwq11pw:focus-visible{outline-offset:calc(0px - var(--ds-border-width-outline, 2px))}}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/* focusable.tsx generated by @compiled/babel-plugin v0.32.2 */
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import "./focusable.compiled.css";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
6
|
+
import { forwardRef } from 'react';
|
|
7
|
+
const focusRingStyles = null;
|
|
8
|
+
const insetFocusRingStyles = null;
|
|
9
|
+
/**
|
|
10
|
+
* __Focus ring__
|
|
11
|
+
*
|
|
12
|
+
* A focus ring visually indicates the currently focused item.
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
const Focusable = /*#__PURE__*/forwardRef(({
|
|
16
|
+
as: Component = 'button',
|
|
17
|
+
children,
|
|
18
|
+
isInset,
|
|
19
|
+
testId,
|
|
20
|
+
style,
|
|
21
|
+
xcss,
|
|
22
|
+
...htmlAttributes
|
|
23
|
+
}, ref) => {
|
|
24
|
+
// This is to remove className from safeHtmlAttributes
|
|
25
|
+
// @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
|
|
26
|
+
const {
|
|
27
|
+
className: _spreadClass,
|
|
28
|
+
...safeHtmlAttributes
|
|
29
|
+
} = htmlAttributes;
|
|
30
|
+
return /*#__PURE__*/React.createElement(Component, _extends({}, safeHtmlAttributes, {
|
|
31
|
+
// @ts-ignore Expression produces a union type that is too complex to represent. We may be able to narrow the type here but unsure.
|
|
32
|
+
ref: ref
|
|
33
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
34
|
+
,
|
|
35
|
+
className: ax(["_mizu194a _1ah31bk5 _ra3xnqa1 _128m1bk5 _1cvmnqa1 _4davt94y", isInset && "_1ah311pw _2mwq11pw", xcss])
|
|
36
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
37
|
+
,
|
|
38
|
+
style: style,
|
|
39
|
+
"data-testid": testId
|
|
40
|
+
}), children);
|
|
41
|
+
});
|
|
42
|
+
export default Focusable;
|
|
@@ -2,12 +2,4 @@
|
|
|
2
2
|
._80om13gf{cursor:not-allowed}
|
|
3
3
|
._80omtlke{cursor:pointer}
|
|
4
4
|
._r06hglyw{-webkit-appearance:none;appearance:none}
|
|
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}
|
|
9
|
-
._1bg4v77o:focus, ._1ah3v77o:focus-visible{outline-offset:var(--ds-space-025,2px)}
|
|
10
|
-
._1hvw1bk5:focus, ._128m1bk5:focus-visible{outline-width:var(--ds-border-width-outline,2px)}
|
|
11
|
-
._49pcnqa1:focus, ._ra3xnqa1:focus-visible{outline-style:solid}
|
|
12
|
-
._nt751p6i:focus, ._mizu1p6i:focus-visible{outline-color:var(--ds-border-focused,#388bff)}
|
|
13
|
-
@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}}
|
|
5
|
+
._vchhusvi{box-sizing:border-box}
|
|
@@ -4,13 +4,14 @@ import "./pressable.compiled.css";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
6
|
import { forwardRef, useCallback, useContext } from 'react';
|
|
7
|
+
import { cx } from '@compiled/react';
|
|
7
8
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
|
|
8
9
|
import noop from '@atlaskit/ds-lib/noop';
|
|
9
10
|
import InteractionContext from '@atlaskit/interaction-context';
|
|
11
|
+
import Focusable from './focusable';
|
|
10
12
|
const styles = {
|
|
11
13
|
root: "_vchhusvi _r06hglyw _19itglyw _80omtlke",
|
|
12
|
-
disabled: "_80om13gf"
|
|
13
|
-
focusRing: "_ymio1r31 _ypr0glyw _zcxs1o36 _nt751p6i _mizu1p6i _1bg4v77o _1ah3v77o _49pcnqa1 _ra3xnqa1 _1hvw1bk5 _128m1bk5 _qa7m1r31 _1cvmnqa1 _4davt94y"
|
|
14
|
+
disabled: "_80om13gf"
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
/**
|
|
@@ -45,7 +46,7 @@ const Pressable = /*#__PURE__*/forwardRef(({
|
|
|
45
46
|
action: 'clicked',
|
|
46
47
|
componentName: componentName || 'Pressable',
|
|
47
48
|
packageName: "@atlaskit/primitives",
|
|
48
|
-
packageVersion: "13.
|
|
49
|
+
packageVersion: "13.3.1",
|
|
49
50
|
analyticsData: analyticsContext,
|
|
50
51
|
actionSubject: 'button'
|
|
51
52
|
});
|
|
@@ -56,9 +57,10 @@ const Pressable = /*#__PURE__*/forwardRef(({
|
|
|
56
57
|
className: _spreadClass,
|
|
57
58
|
...safeHtmlAttributes
|
|
58
59
|
} = htmlAttributes;
|
|
59
|
-
return /*#__PURE__*/React.createElement(
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
return /*#__PURE__*/React.createElement(Focusable
|
|
61
|
+
// @ts-expect-error we don't allow `button` on Focusable for makers as they should use Pressable instead
|
|
62
|
+
, _extends({
|
|
63
|
+
as: "button"
|
|
62
64
|
// 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
|
|
63
65
|
,
|
|
64
66
|
style: style
|
|
@@ -67,8 +69,11 @@ const Pressable = /*#__PURE__*/forwardRef(({
|
|
|
67
69
|
// eslint-disable-next-line react/button-has-type
|
|
68
70
|
type: type,
|
|
69
71
|
onClick: onClick,
|
|
70
|
-
disabled: isDisabled
|
|
71
|
-
|
|
72
|
+
disabled: isDisabled
|
|
73
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- TODO: We need to handle pass-through `xcss` => `xcss` here.
|
|
74
|
+
,
|
|
75
|
+
xcss: cx(styles.root, isDisabled && styles.disabled, xcss),
|
|
76
|
+
testId: testId,
|
|
72
77
|
ref: ref
|
|
73
78
|
}), children);
|
|
74
79
|
});
|
|
@@ -7,7 +7,7 @@ export { default as Bleed } from './components/bleed';
|
|
|
7
7
|
export { default as Text } from './components/text';
|
|
8
8
|
export { default as Pressable } from './components/pressable';
|
|
9
9
|
export { default as Anchor } from './components/anchor';
|
|
10
|
-
export { media } from './responsive';
|
|
11
|
-
|
|
10
|
+
export { media, UNSAFE_useMediaQuery } from './responsive';
|
|
11
|
+
export { default as Focusable } from './components/focusable';
|
|
12
12
|
// TODO: This is still not figured out from before…
|
|
13
13
|
export { useSurface as UNSAFE_useSurface } from './components/internal/surface-provider';
|
|
@@ -85,7 +85,7 @@ const Pressable = /*#__PURE__*/forwardRef(({
|
|
|
85
85
|
action: 'clicked',
|
|
86
86
|
componentName: componentName || 'Pressable',
|
|
87
87
|
packageName: "@atlaskit/primitives",
|
|
88
|
-
packageVersion: "13.
|
|
88
|
+
packageVersion: "13.3.1",
|
|
89
89
|
analyticsData: analyticsContext,
|
|
90
90
|
actionSubject: 'button'
|
|
91
91
|
});
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
1
|
._1hms8stv{text-decoration-line:underline}
|
|
3
2
|
._4bfu18uv{text-decoration-color:initial}
|
|
4
3
|
._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}}
|
|
4
|
+
._vchhusvi{box-sizing:border-box}
|
|
@@ -8,6 +8,7 @@ import "./anchor.compiled.css";
|
|
|
8
8
|
import * as React from 'react';
|
|
9
9
|
import { ax, ix } from "@compiled/react/runtime";
|
|
10
10
|
import { forwardRef, useCallback, useContext } from 'react';
|
|
11
|
+
import { cx } from '@compiled/react';
|
|
11
12
|
import invariant from 'tiny-invariant';
|
|
12
13
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
|
|
13
14
|
import { useRouterLink } from '@atlaskit/app-provider';
|
|
@@ -15,9 +16,9 @@ import noop from '@atlaskit/ds-lib/noop';
|
|
|
15
16
|
import { useId } from '@atlaskit/ds-lib/use-id';
|
|
16
17
|
import InteractionContext from '@atlaskit/interaction-context';
|
|
17
18
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
19
|
+
import Focusable from './focusable';
|
|
18
20
|
var styles = {
|
|
19
|
-
root: "_vchhusvi _4bfu18uv _1hms8stv _ajmmnqa1"
|
|
20
|
-
focusRing: "_ymio1r31 _ypr0glyw _zcxs1o36 _nt751p6i _mizu1p6i _1bg4v77o _1ah3v77o _49pcnqa1 _ra3xnqa1 _1hvw1bk5 _128m1bk5 _qa7m1r31 _1cvmnqa1 _4davt94y"
|
|
21
|
+
root: "_vchhusvi _4bfu18uv _1hms8stv _ajmmnqa1"
|
|
21
22
|
};
|
|
22
23
|
var IS_EXTERNAL_LINK_REGEX = /^(?:(http|https):\/\/)/;
|
|
23
24
|
var IS_NON_HTTP_BASED = /^(((mailto|tel|sms):)|(#))/;
|
|
@@ -59,7 +60,7 @@ var AnchorNoRef = function AnchorNoRef(_ref, ref) {
|
|
|
59
60
|
action: 'clicked',
|
|
60
61
|
componentName: componentName || 'Anchor',
|
|
61
62
|
packageName: "@atlaskit/primitives",
|
|
62
|
-
packageVersion: "13.
|
|
63
|
+
packageVersion: "13.3.1",
|
|
63
64
|
analyticsData: analyticsContext,
|
|
64
65
|
actionSubject: 'link'
|
|
65
66
|
});
|
|
@@ -83,23 +84,28 @@ var AnchorNoRef = function AnchorNoRef(_ref, ref) {
|
|
|
83
84
|
var hrefObjectUsedWithoutRouterLink = RouterLink === undefined && _typeof(href) === 'object';
|
|
84
85
|
invariant(!hrefObjectUsedWithoutRouterLink, "@atlaskit/primitives: Anchor primitive cannot pass an object to 'href' unless a router link is configured in the AppProvider");
|
|
85
86
|
var Component = isRouterLink ? RouterLink : 'a';
|
|
86
|
-
return /*#__PURE__*/React.createElement(
|
|
87
|
-
//
|
|
87
|
+
return /*#__PURE__*/React.createElement(Focusable
|
|
88
|
+
// @ts-expect-error we don't allow `a` on Focusable for makers as they should use Anchor instead
|
|
88
89
|
, _extends({
|
|
89
|
-
|
|
90
|
+
as: Component
|
|
91
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- TODO: Allow pass-through from `props.xcss`
|
|
92
|
+
,
|
|
93
|
+
className: xcss
|
|
90
94
|
// 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
|
|
91
95
|
,
|
|
92
96
|
style: style,
|
|
93
97
|
ref: ref
|
|
94
98
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
95
99
|
}, safeHtmlAttributes, {
|
|
96
|
-
// @ts-expect-error
|
|
97
100
|
href: !isRouterLink && typeof href !== 'string' ? undefined : href,
|
|
98
101
|
target: target,
|
|
99
102
|
onClick: onClick,
|
|
100
103
|
"aria-label": ariaLabel && target === '_blank' && !ariaLabelledBy ? "".concat(ariaLabel, " ").concat(opensInNewWindowLabel) : ariaLabel,
|
|
101
|
-
"aria-labelledby": ariaLabelledBy && target === '_blank' ? "".concat(ariaLabelledBy, " ").concat(opensNewWindowLabelId) : ariaLabelledBy
|
|
102
|
-
|
|
104
|
+
"aria-labelledby": ariaLabelledBy && target === '_blank' ? "".concat(ariaLabelledBy, " ").concat(opensNewWindowLabelId) : ariaLabelledBy
|
|
105
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- TODO: We need to handle pass-through `xcss` => `xcss` here.
|
|
106
|
+
,
|
|
107
|
+
xcss: cx(styles.root, xcss),
|
|
108
|
+
testId: testId,
|
|
103
109
|
"data-is-router-link": testId ? isRouterLink ? 'true' : 'false' : undefined
|
|
104
110
|
}), children, target === '_blank' && (children && !ariaLabel && !ariaLabelledBy || ariaLabelledBy) && /*#__PURE__*/React.createElement(VisuallyHidden, {
|
|
105
111
|
id: opensNewWindowLabelId
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
._128m1bk5:focus-visible{outline-width:var(--ds-border-width-outline,2px)}
|
|
2
|
+
._1ah3115h:focus-visible{outline-offset:var(--_1203r2w)}
|
|
3
|
+
._1ah31bk5:focus-visible{outline-offset:var(--ds-border-width-outline,2px)}
|
|
4
|
+
._mizu194a:focus-visible{outline-color:var(--ds-border-focused,#2684ff)}
|
|
5
|
+
._ra3xnqa1:focus-visible{outline-style:solid}
|
|
6
|
+
@media screen and (-ms-high-contrast:active),screen and (forced-colors:active){._1cvmnqa1:focus-visible{outline-style:solid}._4davt94y:focus-visible{outline-width:1px}._2mwq115h:focus-visible{outline-offset:var(--_1203r2w)}}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/* focusable.tsx generated by @compiled/babel-plugin v0.32.2 */
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
|
+
var _excluded = ["as", "children", "isInset", "testId", "style", "xcss"],
|
|
6
|
+
_excluded2 = ["className"];
|
|
7
|
+
import "./focusable.compiled.css";
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
10
|
+
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; }
|
|
11
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
|
+
import { forwardRef } from 'react';
|
|
13
|
+
var focusRingStyles = null;
|
|
14
|
+
var insetFocusRingStyles = null;
|
|
15
|
+
/**
|
|
16
|
+
* __Focus ring__
|
|
17
|
+
*
|
|
18
|
+
* A focus ring visually indicates the currently focused item.
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
var Focusable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
22
|
+
var _ref$as = _ref.as,
|
|
23
|
+
Component = _ref$as === void 0 ? 'button' : _ref$as,
|
|
24
|
+
children = _ref.children,
|
|
25
|
+
isInset = _ref.isInset,
|
|
26
|
+
testId = _ref.testId,
|
|
27
|
+
style = _ref.style,
|
|
28
|
+
xcss = _ref.xcss,
|
|
29
|
+
htmlAttributes = _objectWithoutProperties(_ref, _excluded);
|
|
30
|
+
// This is to remove className from safeHtmlAttributes
|
|
31
|
+
// @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
|
|
32
|
+
var _spreadClass = htmlAttributes.className,
|
|
33
|
+
safeHtmlAttributes = _objectWithoutProperties(htmlAttributes, _excluded2);
|
|
34
|
+
return /*#__PURE__*/React.createElement(Component, _extends({}, safeHtmlAttributes, {
|
|
35
|
+
// @ts-ignore Expression produces a union type that is too complex to represent. We may be able to narrow the type here but unsure.
|
|
36
|
+
ref: ref
|
|
37
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
38
|
+
,
|
|
39
|
+
className: ax(["_mizu194a _1ah31bk5 _ra3xnqa1 _128m1bk5 _1cvmnqa1 _4davt94y", isInset && "_1ah3115h _2mwq115h", xcss])
|
|
40
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
41
|
+
,
|
|
42
|
+
|
|
43
|
+
"data-testid": testId,
|
|
44
|
+
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
45
|
+
"--_1203r2w": ix("calc(0px - ".concat("var(--ds-border-width-outline, 2px)", ")"))
|
|
46
|
+
})
|
|
47
|
+
}), children);
|
|
48
|
+
});
|
|
49
|
+
export default Focusable;
|
|
@@ -2,12 +2,4 @@
|
|
|
2
2
|
._80om13gf{cursor:not-allowed}
|
|
3
3
|
._80omtlke{cursor:pointer}
|
|
4
4
|
._r06hglyw{-webkit-appearance:none;appearance:none}
|
|
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}
|
|
9
|
-
._1bg4v77o:focus, ._1ah3v77o:focus-visible{outline-offset:var(--ds-space-025,2px)}
|
|
10
|
-
._1hvw1bk5:focus, ._128m1bk5:focus-visible{outline-width:var(--ds-border-width-outline,2px)}
|
|
11
|
-
._49pcnqa1:focus, ._ra3xnqa1:focus-visible{outline-style:solid}
|
|
12
|
-
._nt751p6i:focus, ._mizu1p6i:focus-visible{outline-color:var(--ds-border-focused,#388bff)}
|
|
13
|
-
@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}}
|
|
5
|
+
._vchhusvi{box-sizing:border-box}
|
|
@@ -7,13 +7,14 @@ import "./pressable.compiled.css";
|
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import { ax, ix } from "@compiled/react/runtime";
|
|
9
9
|
import { forwardRef, useCallback, useContext } from 'react';
|
|
10
|
+
import { cx } from '@compiled/react';
|
|
10
11
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
|
|
11
12
|
import noop from '@atlaskit/ds-lib/noop';
|
|
12
13
|
import InteractionContext from '@atlaskit/interaction-context';
|
|
14
|
+
import Focusable from './focusable';
|
|
13
15
|
var styles = {
|
|
14
16
|
root: "_vchhusvi _r06hglyw _19itglyw _80omtlke",
|
|
15
|
-
disabled: "_80om13gf"
|
|
16
|
-
focusRing: "_ymio1r31 _ypr0glyw _zcxs1o36 _nt751p6i _mizu1p6i _1bg4v77o _1ah3v77o _49pcnqa1 _ra3xnqa1 _1hvw1bk5 _128m1bk5 _qa7m1r31 _1cvmnqa1 _4davt94y"
|
|
17
|
+
disabled: "_80om13gf"
|
|
17
18
|
};
|
|
18
19
|
|
|
19
20
|
/**
|
|
@@ -49,7 +50,7 @@ var Pressable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
49
50
|
action: 'clicked',
|
|
50
51
|
componentName: componentName || 'Pressable',
|
|
51
52
|
packageName: "@atlaskit/primitives",
|
|
52
|
-
packageVersion: "13.
|
|
53
|
+
packageVersion: "13.3.1",
|
|
53
54
|
analyticsData: analyticsContext,
|
|
54
55
|
actionSubject: 'button'
|
|
55
56
|
});
|
|
@@ -58,9 +59,10 @@ var Pressable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
58
59
|
// @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
|
|
59
60
|
var _spreadClass = htmlAttributes.className,
|
|
60
61
|
safeHtmlAttributes = _objectWithoutProperties(htmlAttributes, _excluded2);
|
|
61
|
-
return /*#__PURE__*/React.createElement(
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
return /*#__PURE__*/React.createElement(Focusable
|
|
63
|
+
// @ts-expect-error we don't allow `button` on Focusable for makers as they should use Pressable instead
|
|
64
|
+
, _extends({
|
|
65
|
+
as: "button"
|
|
64
66
|
// 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
|
|
65
67
|
,
|
|
66
68
|
style: style
|
|
@@ -69,8 +71,11 @@ var Pressable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
69
71
|
// eslint-disable-next-line react/button-has-type
|
|
70
72
|
type: type,
|
|
71
73
|
onClick: onClick,
|
|
72
|
-
disabled: isDisabled
|
|
73
|
-
|
|
74
|
+
disabled: isDisabled
|
|
75
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- TODO: We need to handle pass-through `xcss` => `xcss` here.
|
|
76
|
+
,
|
|
77
|
+
xcss: cx(styles.root, isDisabled && styles.disabled, xcss),
|
|
78
|
+
testId: testId,
|
|
74
79
|
ref: ref
|
|
75
80
|
}), children);
|
|
76
81
|
});
|
|
@@ -7,7 +7,7 @@ export { default as Bleed } from './components/bleed';
|
|
|
7
7
|
export { default as Text } from './components/text';
|
|
8
8
|
export { default as Pressable } from './components/pressable';
|
|
9
9
|
export { default as Anchor } from './components/anchor';
|
|
10
|
-
export { media } from './responsive';
|
|
11
|
-
|
|
10
|
+
export { media, UNSAFE_useMediaQuery } from './responsive';
|
|
11
|
+
export { default as Focusable } from './components/focusable';
|
|
12
12
|
// TODO: This is still not figured out from before…
|
|
13
13
|
export { useSurface as UNSAFE_useSurface } from './components/internal/surface-provider';
|
|
@@ -94,7 +94,7 @@ var AnchorNoRef = function AnchorNoRef(_ref, ref) {
|
|
|
94
94
|
action: 'clicked',
|
|
95
95
|
componentName: componentName || 'Anchor',
|
|
96
96
|
packageName: "@atlaskit/primitives",
|
|
97
|
-
packageVersion: "13.
|
|
97
|
+
packageVersion: "13.3.1",
|
|
98
98
|
analyticsData: analyticsContext,
|
|
99
99
|
actionSubject: 'link'
|
|
100
100
|
});
|
|
@@ -89,7 +89,7 @@ var Pressable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
89
89
|
action: 'clicked',
|
|
90
90
|
componentName: componentName || 'Pressable',
|
|
91
91
|
packageName: "@atlaskit/primitives",
|
|
92
|
-
packageVersion: "13.
|
|
92
|
+
packageVersion: "13.3.1",
|
|
93
93
|
analyticsData: analyticsContext,
|
|
94
94
|
actionSubject: 'button'
|
|
95
95
|
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import { type ComponentPropsWithoutRef, type ComponentPropsWithRef, type ReactElement, type ReactNode } from 'react';
|
|
6
|
+
import type { BasePrimitiveProps, StyleProp } from '../components/types';
|
|
7
|
+
type AllowedElements = Exclude<keyof JSX.IntrinsicElements, 'button' | 'a'>;
|
|
8
|
+
type CustomElement<P = any> = {
|
|
9
|
+
[K in AllowedElements]: P extends JSX.IntrinsicElements[K] ? K : never;
|
|
10
|
+
}[AllowedElements];
|
|
11
|
+
export type FocusableProps<T extends CustomElement> = Omit<ComponentPropsWithoutRef<T>, keyof BaseFocusableProps<T> | 'className' | 'style'> & BasePrimitiveProps & StyleProp & BaseFocusableProps<T>;
|
|
12
|
+
type BaseFocusableProps<T extends CustomElement> = {
|
|
13
|
+
/**
|
|
14
|
+
* The DOM element to render as the Focusable element.
|
|
15
|
+
* @default 'button'
|
|
16
|
+
*/
|
|
17
|
+
as?: T;
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Controls whether the focus ring should be applied around or within the composed element.
|
|
21
|
+
*/
|
|
22
|
+
isInset?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Forwarded ref.
|
|
25
|
+
*/
|
|
26
|
+
ref?: ComponentPropsWithRef<T>['ref'];
|
|
27
|
+
};
|
|
28
|
+
type FocusableComponent = <T extends CustomElement>(props: FocusableProps<T>) => ReactElement;
|
|
29
|
+
/**
|
|
30
|
+
* __Focus ring__
|
|
31
|
+
*
|
|
32
|
+
* A focus ring visually indicates the currently focused item.
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
35
|
+
declare const Focusable: FocusableComponent;
|
|
36
|
+
export default Focusable;
|
|
@@ -7,6 +7,8 @@ export { default as Bleed, type BleedProps } from './components/bleed';
|
|
|
7
7
|
export { default as Text, type TextProps } from './components/text';
|
|
8
8
|
export { default as Pressable, type PressableProps } from './components/pressable';
|
|
9
9
|
export { default as Anchor, type AnchorProps } from './components/anchor';
|
|
10
|
-
export { media, type Breakpoint, type MediaQuery } from './responsive';
|
|
10
|
+
export { media, type Breakpoint, type MediaQuery, UNSAFE_useMediaQuery } from './responsive';
|
|
11
|
+
export { default as Focusable } from './components/focusable';
|
|
12
|
+
export type { FocusableProps } from './components/focusable';
|
|
11
13
|
export { useSurface as UNSAFE_useSurface } from './components/internal/surface-provider';
|
|
12
14
|
export type { BackgroundColorToken as BackgroundColor, PositiveSpaceToken as Space, TextColor, } from './components/types';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import { type ComponentPropsWithoutRef, type ComponentPropsWithRef, type ReactElement, type ReactNode } from 'react';
|
|
6
|
+
import type { BasePrimitiveProps, StyleProp } from '../components/types';
|
|
7
|
+
type AllowedElements = Exclude<keyof JSX.IntrinsicElements, 'button' | 'a'>;
|
|
8
|
+
type CustomElement<P = any> = {
|
|
9
|
+
[K in AllowedElements]: P extends JSX.IntrinsicElements[K] ? K : never;
|
|
10
|
+
}[AllowedElements];
|
|
11
|
+
export type FocusableProps<T extends CustomElement> = Omit<ComponentPropsWithoutRef<T>, keyof BaseFocusableProps<T> | 'className' | 'style'> & BasePrimitiveProps & StyleProp & BaseFocusableProps<T>;
|
|
12
|
+
type BaseFocusableProps<T extends CustomElement> = {
|
|
13
|
+
/**
|
|
14
|
+
* The DOM element to render as the Focusable element.
|
|
15
|
+
* @default 'button'
|
|
16
|
+
*/
|
|
17
|
+
as?: T;
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Controls whether the focus ring should be applied around or within the composed element.
|
|
21
|
+
*/
|
|
22
|
+
isInset?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Forwarded ref.
|
|
25
|
+
*/
|
|
26
|
+
ref?: ComponentPropsWithRef<T>['ref'];
|
|
27
|
+
};
|
|
28
|
+
type FocusableComponent = <T extends CustomElement>(props: FocusableProps<T>) => ReactElement;
|
|
29
|
+
/**
|
|
30
|
+
* __Focus ring__
|
|
31
|
+
*
|
|
32
|
+
* A focus ring visually indicates the currently focused item.
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
35
|
+
declare const Focusable: FocusableComponent;
|
|
36
|
+
export default Focusable;
|
|
@@ -7,6 +7,8 @@ export { default as Bleed, type BleedProps } from './components/bleed';
|
|
|
7
7
|
export { default as Text, type TextProps } from './components/text';
|
|
8
8
|
export { default as Pressable, type PressableProps } from './components/pressable';
|
|
9
9
|
export { default as Anchor, type AnchorProps } from './components/anchor';
|
|
10
|
-
export { media, type Breakpoint, type MediaQuery } from './responsive';
|
|
10
|
+
export { media, type Breakpoint, type MediaQuery, UNSAFE_useMediaQuery } from './responsive';
|
|
11
|
+
export { default as Focusable } from './components/focusable';
|
|
12
|
+
export type { FocusableProps } from './components/focusable';
|
|
11
13
|
export { useSurface as UNSAFE_useSurface } from './components/internal/surface-provider';
|
|
12
14
|
export type { BackgroundColorToken as BackgroundColor, PositiveSpaceToken as Space, TextColor, } from './components/types';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/primitives",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.3.1",
|
|
4
4
|
"description": "Primitives are token-backed low-level building blocks.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"atlassian": {
|
|
20
20
|
"team": "Design System Team",
|
|
21
21
|
"website": {
|
|
22
|
-
"category": "Primitives",
|
|
23
22
|
"name": "Primitives",
|
|
23
|
+
"category": "Primitives",
|
|
24
24
|
"status": {
|
|
25
25
|
"type": "beta"
|
|
26
26
|
},
|
|
@@ -126,11 +126,11 @@
|
|
|
126
126
|
"dependencies": {
|
|
127
127
|
"@atlaskit/analytics-next": "^10.1.0",
|
|
128
128
|
"@atlaskit/app-provider": "^1.4.0",
|
|
129
|
-
"@atlaskit/css": "^0.
|
|
130
|
-
"@atlaskit/ds-lib": "^3.
|
|
129
|
+
"@atlaskit/css": "^0.7.0",
|
|
130
|
+
"@atlaskit/ds-lib": "^3.3.0",
|
|
131
131
|
"@atlaskit/interaction-context": "^2.1.0",
|
|
132
132
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
133
|
-
"@atlaskit/tokens": "^2.
|
|
133
|
+
"@atlaskit/tokens": "^2.4.0",
|
|
134
134
|
"@atlaskit/visually-hidden": "^1.5.0",
|
|
135
135
|
"@babel/runtime": "^7.0.0",
|
|
136
136
|
"@compiled/react": "^0.18.1",
|
|
@@ -145,6 +145,7 @@
|
|
|
145
145
|
"devDependencies": {
|
|
146
146
|
"@af/accessibility-testing": "*",
|
|
147
147
|
"@af/formatting": "*",
|
|
148
|
+
"@af/visual-regression": "*",
|
|
148
149
|
"@atlaskit/ssr": "*",
|
|
149
150
|
"@atlaskit/toggle": "^13.4.0",
|
|
150
151
|
"@atlaskit/tooltip": "^18.9.0",
|