@atlaskit/primitives 13.1.0 → 13.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -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/components/text.compiled.css +0 -4
- package/dist/cjs/compiled/components/text.js +6 -3
- 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/cjs/components/text.js +6 -3
- 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/components/text.compiled.css +0 -4
- package/dist/es2019/compiled/components/text.js +6 -2
- 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/es2019/components/text.js +6 -2
- 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/components/text.compiled.css +0 -4
- package/dist/esm/compiled/components/text.js +6 -3
- 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/esm/components/text.js +6 -3
- 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 +23 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/primitives
|
|
2
2
|
|
|
3
|
+
## 13.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#165860](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/165860)
|
|
8
|
+
[`c2dec1ca710f3`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c2dec1ca710f3) -
|
|
9
|
+
Adds an experimental Focusable component under the Compiled entrypoint, which requires a specific
|
|
10
|
+
setup.
|
|
11
|
+
|
|
12
|
+
## 13.2.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- [#162507](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/162507)
|
|
17
|
+
[`55f201f2b2d04`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/55f201f2b2d04) -
|
|
18
|
+
[ux] Text to inherit size when nested in other Text component behind a feature flag. If testing
|
|
19
|
+
successful, this change will be made available in a later release.
|
|
20
|
+
|
|
3
21
|
## 13.1.0
|
|
4
22
|
|
|
5
23
|
### 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.0",
|
|
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.0",
|
|
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
|
});
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
._11c81doa{font:var(--ds-font-body-large,normal 400 1pc/24px ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,system-ui,"Helvetica Neue",sans-serif)}
|
|
2
|
-
._11c81oud{font:var(--ds-font-body,normal 400 14px/20px ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,system-ui,"Helvetica Neue",sans-serif)}
|
|
3
|
-
._11c81vlj{font:var(--ds-font-body-small,normal 400 11px/1pc ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,system-ui,"Helvetica Neue",sans-serif)}
|
|
4
|
-
._11c8qk37{font:var(--ds-font-body-UNSAFE_small,normal 400 9pt/1pc ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,system-ui,"Helvetica Neue",sans-serif)}
|
|
5
1
|
._18m915vq{overflow-y:hidden}
|
|
6
2
|
._18u0idpf{margin-left:0}
|
|
7
3
|
._19pkidpf{margin-top:0}
|
|
@@ -12,6 +12,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
12
12
|
var React = _react;
|
|
13
13
|
var _runtime = require("@compiled/react/runtime");
|
|
14
14
|
var _tinyInvariant = _interopRequireDefault(require("tiny-invariant"));
|
|
15
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
16
|
var _surfaceProvider = require("./internal/surface-provider");
|
|
16
17
|
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); }
|
|
17
18
|
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; }
|
|
@@ -149,14 +150,16 @@ var Text = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
149
150
|
align = _ref.align,
|
|
150
151
|
testId = _ref.testId,
|
|
151
152
|
id = _ref.id,
|
|
152
|
-
|
|
153
|
-
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
153
|
+
size = _ref.size,
|
|
154
154
|
weight = _ref.weight,
|
|
155
155
|
maxLines = _ref.maxLines,
|
|
156
156
|
children = _ref.children;
|
|
157
157
|
(0, _tinyInvariant.default)(asAllowlist.includes(Component), "@atlaskit/primitives: Text received an invalid \"as\" value of \"".concat(Component, "\""));
|
|
158
158
|
var hasTextAncestor = useHasTextAncestor();
|
|
159
159
|
var color = useColor(colorProp, hasTextAncestor);
|
|
160
|
+
if (!(0, _platformFeatureFlags.fg)('platform-primitives-nested-text-inherit-size') && !size) {
|
|
161
|
+
size = 'medium';
|
|
162
|
+
}
|
|
160
163
|
var component = /*#__PURE__*/React.createElement(Component, {
|
|
161
164
|
id: id,
|
|
162
165
|
style: {
|
|
@@ -164,7 +167,7 @@ var Text = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
164
167
|
},
|
|
165
168
|
"data-testid": testId,
|
|
166
169
|
ref: ref,
|
|
167
|
-
className: (0, _runtime.ax)([styles.root,
|
|
170
|
+
className: (0, _runtime.ax)([styles.root, color && textColorMap[color], maxLines && styles.truncation, maxLines === 1 && styles.breakAll, align && styles["textAlign.".concat(align)], weight && fontWeightMap[weight], Component === 'em' && styles['as.em'], Component === 'strong' && styles['as.strong']])
|
|
168
171
|
}, children);
|
|
169
172
|
if (hasTextAncestor) {
|
|
170
173
|
// no need to re-apply context if the text is already wrapped
|
|
@@ -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.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: "13.
|
|
98
|
+
packageVersion: "13.3.0",
|
|
99
99
|
analyticsData: analyticsContext,
|
|
100
100
|
actionSubject: 'button'
|
|
101
101
|
});
|
|
@@ -8,6 +8,7 @@ exports.default = void 0;
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _react2 = require("@emotion/react");
|
|
10
10
|
var _tinyInvariant = _interopRequireDefault(require("tiny-invariant"));
|
|
11
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
12
|
var _styleMaps = require("../xcss/style-maps.partial");
|
|
12
13
|
var _surfaceProvider = require("./internal/surface-provider");
|
|
13
14
|
/**
|
|
@@ -95,19 +96,21 @@ var Text = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
95
96
|
align = _ref.align,
|
|
96
97
|
testId = _ref.testId,
|
|
97
98
|
id = _ref.id,
|
|
98
|
-
|
|
99
|
-
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
99
|
+
size = _ref.size,
|
|
100
100
|
weight = _ref.weight,
|
|
101
101
|
maxLines = _ref.maxLines,
|
|
102
102
|
children = _ref.children;
|
|
103
103
|
(0, _tinyInvariant.default)(asAllowlist.includes(Component), "@atlaskit/primitives: Text received an invalid \"as\" value of \"".concat(Component, "\""));
|
|
104
104
|
var hasTextAncestor = useHasTextAncestor();
|
|
105
105
|
var color = useColor(colorProp, hasTextAncestor);
|
|
106
|
+
if (!(0, _platformFeatureFlags.fg)('platform-primitives-nested-text-inherit-size') && !size) {
|
|
107
|
+
size = 'medium';
|
|
108
|
+
}
|
|
106
109
|
var component = (0, _react2.jsx)(Component, {
|
|
107
110
|
ref: ref,
|
|
108
111
|
css: [resetStyles,
|
|
109
112
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
110
|
-
_styleMaps.textSizeStylesMap[size],
|
|
113
|
+
size ? _styleMaps.textSizeStylesMap[size] : !hasTextAncestor && _styleMaps.textSizeStylesMap.medium,
|
|
111
114
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
112
115
|
color && _styleMaps.textColorStylesMap[color], maxLines && truncationStyles, maxLines === 1 && wordBreakMap.breakAll, align && textAlignMap[align],
|
|
113
116
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
@@ -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.0",
|
|
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.0",
|
|
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
|
});
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
._11c81doa{font:var(--ds-font-body-large,normal 400 1pc/24px ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,system-ui,"Helvetica Neue",sans-serif)}
|
|
2
|
-
._11c81oud{font:var(--ds-font-body,normal 400 14px/20px ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,system-ui,"Helvetica Neue",sans-serif)}
|
|
3
|
-
._11c81vlj{font:var(--ds-font-body-small,normal 400 11px/1pc ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,system-ui,"Helvetica Neue",sans-serif)}
|
|
4
|
-
._11c8qk37{font:var(--ds-font-body-UNSAFE_small,normal 400 9pt/1pc ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,system-ui,"Helvetica Neue",sans-serif)}
|
|
5
1
|
._18m915vq{overflow-y:hidden}
|
|
6
2
|
._18u0idpf{margin-left:0}
|
|
7
3
|
._19pkidpf{margin-top:0}
|
|
@@ -4,6 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
5
|
import { createContext, forwardRef, useContext } from 'react';
|
|
6
6
|
import invariant from 'tiny-invariant';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { useSurface } from './internal/surface-provider';
|
|
8
9
|
const asAllowlist = ['span', 'p', 'strong', 'em'];
|
|
9
10
|
const HasTextAncestorContext = /*#__PURE__*/createContext(false);
|
|
@@ -136,7 +137,7 @@ const Text = /*#__PURE__*/forwardRef(({
|
|
|
136
137
|
align,
|
|
137
138
|
testId,
|
|
138
139
|
id,
|
|
139
|
-
size
|
|
140
|
+
size,
|
|
140
141
|
weight,
|
|
141
142
|
maxLines,
|
|
142
143
|
children
|
|
@@ -144,6 +145,9 @@ const Text = /*#__PURE__*/forwardRef(({
|
|
|
144
145
|
invariant(asAllowlist.includes(Component), `@atlaskit/primitives: Text received an invalid "as" value of "${Component}"`);
|
|
145
146
|
const hasTextAncestor = useHasTextAncestor();
|
|
146
147
|
const color = useColor(colorProp, hasTextAncestor);
|
|
148
|
+
if (!fg('platform-primitives-nested-text-inherit-size') && !size) {
|
|
149
|
+
size = 'medium';
|
|
150
|
+
}
|
|
147
151
|
const component = /*#__PURE__*/React.createElement(Component, {
|
|
148
152
|
id: id,
|
|
149
153
|
style: {
|
|
@@ -151,7 +155,7 @@ const Text = /*#__PURE__*/forwardRef(({
|
|
|
151
155
|
},
|
|
152
156
|
"data-testid": testId,
|
|
153
157
|
ref: ref,
|
|
154
|
-
className: ax([styles.root,
|
|
158
|
+
className: ax([styles.root, color && textColorMap[color], maxLines && styles.truncation, maxLines === 1 && styles.breakAll, align && styles[`textAlign.${align}`], weight && fontWeightMap[weight], Component === 'em' && styles['as.em'], Component === 'strong' && styles['as.strong']])
|
|
155
159
|
}, children);
|
|
156
160
|
if (hasTextAncestor) {
|
|
157
161
|
// no need to re-apply context if the text is already wrapped
|
|
@@ -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.0",
|
|
89
89
|
analyticsData: analyticsContext,
|
|
90
90
|
actionSubject: 'button'
|
|
91
91
|
});
|
|
@@ -7,6 +7,7 @@ import { createContext, forwardRef, useContext } from 'react';
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
9
|
import invariant from 'tiny-invariant';
|
|
10
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
11
|
import { inverseColorMap, textColorStylesMap, textSizeStylesMap, textWeightStylesMap } from '../xcss/style-maps.partial';
|
|
11
12
|
import { useSurface } from './internal/surface-provider';
|
|
12
13
|
const asAllowlist = ['span', 'p', 'strong', 'em'];
|
|
@@ -84,7 +85,7 @@ const Text = /*#__PURE__*/forwardRef(({
|
|
|
84
85
|
align,
|
|
85
86
|
testId,
|
|
86
87
|
id,
|
|
87
|
-
size
|
|
88
|
+
size,
|
|
88
89
|
weight,
|
|
89
90
|
maxLines,
|
|
90
91
|
children
|
|
@@ -92,11 +93,14 @@ const Text = /*#__PURE__*/forwardRef(({
|
|
|
92
93
|
invariant(asAllowlist.includes(Component), `@atlaskit/primitives: Text received an invalid "as" value of "${Component}"`);
|
|
93
94
|
const hasTextAncestor = useHasTextAncestor();
|
|
94
95
|
const color = useColor(colorProp, hasTextAncestor);
|
|
96
|
+
if (!fg('platform-primitives-nested-text-inherit-size') && !size) {
|
|
97
|
+
size = 'medium';
|
|
98
|
+
}
|
|
95
99
|
const component = jsx(Component, {
|
|
96
100
|
ref: ref,
|
|
97
101
|
css: [resetStyles,
|
|
98
102
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
99
|
-
textSizeStylesMap[size],
|
|
103
|
+
size ? textSizeStylesMap[size] : !hasTextAncestor && textSizeStylesMap.medium,
|
|
100
104
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
101
105
|
color && textColorStylesMap[color], maxLines && truncationStyles, maxLines === 1 && wordBreakMap.breakAll, align && textAlignMap[align],
|
|
102
106
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
@@ -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.0",
|
|
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.0",
|
|
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
|
});
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
._11c81doa{font:var(--ds-font-body-large,normal 400 1pc/24px ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,system-ui,"Helvetica Neue",sans-serif)}
|
|
2
|
-
._11c81oud{font:var(--ds-font-body,normal 400 14px/20px ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,system-ui,"Helvetica Neue",sans-serif)}
|
|
3
|
-
._11c81vlj{font:var(--ds-font-body-small,normal 400 11px/1pc ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,system-ui,"Helvetica Neue",sans-serif)}
|
|
4
|
-
._11c8qk37{font:var(--ds-font-body-UNSAFE_small,normal 400 9pt/1pc ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,system-ui,"Helvetica Neue",sans-serif)}
|
|
5
1
|
._18m915vq{overflow-y:hidden}
|
|
6
2
|
._18u0idpf{margin-left:0}
|
|
7
3
|
._19pkidpf{margin-top:0}
|
|
@@ -4,6 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
5
|
import { createContext, forwardRef, useContext } from 'react';
|
|
6
6
|
import invariant from 'tiny-invariant';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { useSurface } from './internal/surface-provider';
|
|
8
9
|
var asAllowlist = ['span', 'p', 'strong', 'em'];
|
|
9
10
|
var HasTextAncestorContext = /*#__PURE__*/createContext(false);
|
|
@@ -139,14 +140,16 @@ var Text = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
139
140
|
align = _ref.align,
|
|
140
141
|
testId = _ref.testId,
|
|
141
142
|
id = _ref.id,
|
|
142
|
-
|
|
143
|
-
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
143
|
+
size = _ref.size,
|
|
144
144
|
weight = _ref.weight,
|
|
145
145
|
maxLines = _ref.maxLines,
|
|
146
146
|
children = _ref.children;
|
|
147
147
|
invariant(asAllowlist.includes(Component), "@atlaskit/primitives: Text received an invalid \"as\" value of \"".concat(Component, "\""));
|
|
148
148
|
var hasTextAncestor = useHasTextAncestor();
|
|
149
149
|
var color = useColor(colorProp, hasTextAncestor);
|
|
150
|
+
if (!fg('platform-primitives-nested-text-inherit-size') && !size) {
|
|
151
|
+
size = 'medium';
|
|
152
|
+
}
|
|
150
153
|
var component = /*#__PURE__*/React.createElement(Component, {
|
|
151
154
|
id: id,
|
|
152
155
|
style: {
|
|
@@ -154,7 +157,7 @@ var Text = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
154
157
|
},
|
|
155
158
|
"data-testid": testId,
|
|
156
159
|
ref: ref,
|
|
157
|
-
className: ax([styles.root,
|
|
160
|
+
className: ax([styles.root, color && textColorMap[color], maxLines && styles.truncation, maxLines === 1 && styles.breakAll, align && styles["textAlign.".concat(align)], weight && fontWeightMap[weight], Component === 'em' && styles['as.em'], Component === 'strong' && styles['as.strong']])
|
|
158
161
|
}, children);
|
|
159
162
|
if (hasTextAncestor) {
|
|
160
163
|
// no need to re-apply context if the text is already wrapped
|
|
@@ -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.0",
|
|
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.0",
|
|
93
93
|
analyticsData: analyticsContext,
|
|
94
94
|
actionSubject: 'button'
|
|
95
95
|
});
|
|
@@ -7,6 +7,7 @@ import { createContext, forwardRef, useContext } from 'react';
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
9
|
import invariant from 'tiny-invariant';
|
|
10
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
11
|
import { inverseColorMap, textColorStylesMap, textSizeStylesMap, textWeightStylesMap } from '../xcss/style-maps.partial';
|
|
11
12
|
import { useSurface } from './internal/surface-provider';
|
|
12
13
|
var asAllowlist = ['span', 'p', 'strong', 'em'];
|
|
@@ -87,19 +88,21 @@ var Text = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
87
88
|
align = _ref.align,
|
|
88
89
|
testId = _ref.testId,
|
|
89
90
|
id = _ref.id,
|
|
90
|
-
|
|
91
|
-
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
91
|
+
size = _ref.size,
|
|
92
92
|
weight = _ref.weight,
|
|
93
93
|
maxLines = _ref.maxLines,
|
|
94
94
|
children = _ref.children;
|
|
95
95
|
invariant(asAllowlist.includes(Component), "@atlaskit/primitives: Text received an invalid \"as\" value of \"".concat(Component, "\""));
|
|
96
96
|
var hasTextAncestor = useHasTextAncestor();
|
|
97
97
|
var color = useColor(colorProp, hasTextAncestor);
|
|
98
|
+
if (!fg('platform-primitives-nested-text-inherit-size') && !size) {
|
|
99
|
+
size = 'medium';
|
|
100
|
+
}
|
|
98
101
|
var component = jsx(Component, {
|
|
99
102
|
ref: ref,
|
|
100
103
|
css: [resetStyles,
|
|
101
104
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
102
|
-
textSizeStylesMap[size],
|
|
105
|
+
size ? textSizeStylesMap[size] : !hasTextAncestor && textSizeStylesMap.medium,
|
|
103
106
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
104
107
|
color && textColorStylesMap[color], maxLines && truncationStyles, maxLines === 1 && wordBreakMap.breakAll, align && textAlignMap[align],
|
|
105
108
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
@@ -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.0",
|
|
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
|
},
|
|
@@ -77,7 +77,17 @@
|
|
|
77
77
|
"title": "XCSS",
|
|
78
78
|
"folder": "xcss",
|
|
79
79
|
"slug": "primitives/xcss",
|
|
80
|
-
"id": "@atlaskit/primitives/xcss"
|
|
80
|
+
"id": "@atlaskit/primitives/xcss",
|
|
81
|
+
"status": {
|
|
82
|
+
"type": "intent-to-deprecate",
|
|
83
|
+
"description": "We are planning on deprecating XCSS. We recommend using @atlaskit/css instead.",
|
|
84
|
+
"actions": [
|
|
85
|
+
{
|
|
86
|
+
"text": "View @atlaskit/css documentation",
|
|
87
|
+
"href": "https://atlassian.design/components/css/"
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
}
|
|
81
91
|
},
|
|
82
92
|
{
|
|
83
93
|
"title": "Responsive",
|
|
@@ -117,9 +127,10 @@
|
|
|
117
127
|
"@atlaskit/analytics-next": "^10.1.0",
|
|
118
128
|
"@atlaskit/app-provider": "^1.4.0",
|
|
119
129
|
"@atlaskit/css": "^0.6.0",
|
|
120
|
-
"@atlaskit/ds-lib": "^3.
|
|
130
|
+
"@atlaskit/ds-lib": "^3.2.0",
|
|
121
131
|
"@atlaskit/interaction-context": "^2.1.0",
|
|
122
|
-
"@atlaskit/
|
|
132
|
+
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
133
|
+
"@atlaskit/tokens": "^2.3.0",
|
|
123
134
|
"@atlaskit/visually-hidden": "^1.5.0",
|
|
124
135
|
"@babel/runtime": "^7.0.0",
|
|
125
136
|
"@compiled/react": "^0.18.1",
|
|
@@ -134,9 +145,10 @@
|
|
|
134
145
|
"devDependencies": {
|
|
135
146
|
"@af/accessibility-testing": "*",
|
|
136
147
|
"@af/formatting": "*",
|
|
148
|
+
"@af/visual-regression": "*",
|
|
137
149
|
"@atlaskit/ssr": "*",
|
|
138
150
|
"@atlaskit/toggle": "^13.4.0",
|
|
139
|
-
"@atlaskit/tooltip": "^18.
|
|
151
|
+
"@atlaskit/tooltip": "^18.9.0",
|
|
140
152
|
"@atlaskit/visual-regression": "*",
|
|
141
153
|
"@atlassian/codegen": "^0.1.0",
|
|
142
154
|
"@testing-library/react": "^12.1.5",
|
|
@@ -173,6 +185,11 @@
|
|
|
173
185
|
}
|
|
174
186
|
},
|
|
175
187
|
"homepage": "https://atlassian.design/components/primitives/overview/",
|
|
188
|
+
"platform-feature-flags": {
|
|
189
|
+
"platform-primitives-nested-text-inherit-size": {
|
|
190
|
+
"type": "boolean"
|
|
191
|
+
}
|
|
192
|
+
},
|
|
176
193
|
"typesVersions": {
|
|
177
194
|
">=4.5 <4.9": {
|
|
178
195
|
"*": [
|