@atlaskit/focus-ring 1.2.2 → 1.2.4
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 +12 -0
- package/dist/cjs/focus-ring.js +7 -9
- package/dist/cjs/index.js +0 -3
- package/dist/cjs/use-focus-ring.js +3 -10
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/focus-ring.js +3 -3
- package/dist/es2019/use-focus-ring.js +0 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/focus-ring.js +6 -6
- package/dist/esm/use-focus-ring.js +3 -7
- package/dist/esm/version.json +1 -1
- package/package.json +2 -2
- package/report.api.md +1 -1
package/CHANGELOG.md
CHANGED
package/dist/cjs/focus-ring.js
CHANGED
|
@@ -4,12 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = require("react");
|
|
9
|
-
|
|
10
8
|
var _react2 = require("@emotion/react");
|
|
11
|
-
|
|
12
9
|
/** @jsx jsx */
|
|
10
|
+
|
|
13
11
|
var BORDER_WIDTH = 2;
|
|
14
12
|
var baseFocusOutsideStyles = (0, _react2.css)({
|
|
15
13
|
outline: "".concat(BORDER_WIDTH, "px solid ", "var(--ds-border-focused, #4C9AFF)"),
|
|
@@ -44,6 +42,7 @@ var insetFocusRingStyles = (0, _react2.css)({
|
|
|
44
42
|
}
|
|
45
43
|
}
|
|
46
44
|
});
|
|
45
|
+
|
|
47
46
|
/**
|
|
48
47
|
* __Focus ring__
|
|
49
48
|
*
|
|
@@ -62,18 +61,18 @@ var insetFocusRingStyles = (0, _react2.css)({
|
|
|
62
61
|
* )
|
|
63
62
|
* ```
|
|
64
63
|
*/
|
|
65
|
-
|
|
66
64
|
var FocusRing = function FocusRing(_ref) {
|
|
67
65
|
var children = _ref.children,
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
isInset = _ref.isInset,
|
|
67
|
+
focus = _ref.focus;
|
|
70
68
|
var controlledStyles = isInset ? baseInsetStyles : baseFocusOutsideStyles;
|
|
71
69
|
var uncontrolledStyles = isInset ? insetFocusRingStyles : focusRingStyles;
|
|
72
70
|
var focusCls = typeof focus === 'undefined' ? uncontrolledStyles : focus === 'on' && controlledStyles;
|
|
73
71
|
return (0, _react2.jsx)(_react2.ClassNames, null, function (_ref2) {
|
|
74
72
|
var css = _ref2.css,
|
|
75
|
-
|
|
76
|
-
return _react.Children.only(
|
|
73
|
+
cx = _ref2.cx;
|
|
74
|
+
return _react.Children.only(
|
|
75
|
+
// This may look unwieldy but means we skip applying styles / cloning if no className is applicable
|
|
77
76
|
focusCls ?
|
|
78
77
|
/*#__PURE__*/
|
|
79
78
|
// eslint-disable-next-line @repo/internal/react/no-clone-element
|
|
@@ -82,6 +81,5 @@ var FocusRing = function FocusRing(_ref) {
|
|
|
82
81
|
}) : children);
|
|
83
82
|
});
|
|
84
83
|
};
|
|
85
|
-
|
|
86
84
|
var _default = FocusRing;
|
|
87
85
|
exports.default = _default;
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -17,7 +16,5 @@ Object.defineProperty(exports, "useFocusRing", {
|
|
|
17
16
|
return _useFocusRing.default;
|
|
18
17
|
}
|
|
19
18
|
});
|
|
20
|
-
|
|
21
19
|
var _focusRing = _interopRequireDefault(require("./focus-ring"));
|
|
22
|
-
|
|
23
20
|
var _useFocusRing = _interopRequireDefault(require("./use-focus-ring"));
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
-
|
|
12
9
|
var _react = require("react");
|
|
13
|
-
|
|
14
10
|
/**
|
|
15
11
|
* __Use focus ring__
|
|
16
12
|
*
|
|
@@ -41,12 +37,10 @@ var _react = require("react");
|
|
|
41
37
|
*/
|
|
42
38
|
var useFocusRing = function useFocusRing() {
|
|
43
39
|
var initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'off';
|
|
44
|
-
|
|
45
40
|
var _useState = (0, _react.useState)(initialState),
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
42
|
+
focusState = _useState2[0],
|
|
43
|
+
setFocusState = _useState2[1];
|
|
50
44
|
var focusProps = (0, _react.useRef)({
|
|
51
45
|
onFocus: function onFocus() {
|
|
52
46
|
return setFocusState('on');
|
|
@@ -60,6 +54,5 @@ var useFocusRing = function useFocusRing() {
|
|
|
60
54
|
focusProps: focusProps.current
|
|
61
55
|
};
|
|
62
56
|
};
|
|
63
|
-
|
|
64
57
|
var _default = useFocusRing;
|
|
65
58
|
exports.default = _default;
|
package/dist/cjs/version.json
CHANGED
|
@@ -35,6 +35,7 @@ const insetFocusRingStyles = css({
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
|
+
|
|
38
39
|
/**
|
|
39
40
|
* __Focus ring__
|
|
40
41
|
*
|
|
@@ -53,7 +54,6 @@ const insetFocusRingStyles = css({
|
|
|
53
54
|
* )
|
|
54
55
|
* ```
|
|
55
56
|
*/
|
|
56
|
-
|
|
57
57
|
const FocusRing = ({
|
|
58
58
|
children,
|
|
59
59
|
isInset,
|
|
@@ -65,7 +65,8 @@ const FocusRing = ({
|
|
|
65
65
|
return jsx(ClassNames, null, ({
|
|
66
66
|
css,
|
|
67
67
|
cx
|
|
68
|
-
}) => Children.only(
|
|
68
|
+
}) => Children.only(
|
|
69
|
+
// This may look unwieldy but means we skip applying styles / cloning if no className is applicable
|
|
69
70
|
focusCls ?
|
|
70
71
|
/*#__PURE__*/
|
|
71
72
|
// eslint-disable-next-line @repo/internal/react/no-clone-element
|
|
@@ -73,5 +74,4 @@ const FocusRing = ({
|
|
|
73
74
|
className: cx([css(focusCls), children.props.className])
|
|
74
75
|
}) : children));
|
|
75
76
|
};
|
|
76
|
-
|
|
77
77
|
export default FocusRing;
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/focus-ring.js
CHANGED
|
@@ -35,6 +35,7 @@ var insetFocusRingStyles = css({
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
|
+
|
|
38
39
|
/**
|
|
39
40
|
* __Focus ring__
|
|
40
41
|
*
|
|
@@ -53,18 +54,18 @@ var insetFocusRingStyles = css({
|
|
|
53
54
|
* )
|
|
54
55
|
* ```
|
|
55
56
|
*/
|
|
56
|
-
|
|
57
57
|
var FocusRing = function FocusRing(_ref) {
|
|
58
58
|
var children = _ref.children,
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
isInset = _ref.isInset,
|
|
60
|
+
focus = _ref.focus;
|
|
61
61
|
var controlledStyles = isInset ? baseInsetStyles : baseFocusOutsideStyles;
|
|
62
62
|
var uncontrolledStyles = isInset ? insetFocusRingStyles : focusRingStyles;
|
|
63
63
|
var focusCls = typeof focus === 'undefined' ? uncontrolledStyles : focus === 'on' && controlledStyles;
|
|
64
64
|
return jsx(ClassNames, null, function (_ref2) {
|
|
65
65
|
var css = _ref2.css,
|
|
66
|
-
|
|
67
|
-
return Children.only(
|
|
66
|
+
cx = _ref2.cx;
|
|
67
|
+
return Children.only(
|
|
68
|
+
// This may look unwieldy but means we skip applying styles / cloning if no className is applicable
|
|
68
69
|
focusCls ?
|
|
69
70
|
/*#__PURE__*/
|
|
70
71
|
// eslint-disable-next-line @repo/internal/react/no-clone-element
|
|
@@ -73,5 +74,4 @@ var FocusRing = function FocusRing(_ref) {
|
|
|
73
74
|
}) : children);
|
|
74
75
|
});
|
|
75
76
|
};
|
|
76
|
-
|
|
77
77
|
export default FocusRing;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import { useRef, useState } from 'react';
|
|
3
|
-
|
|
4
3
|
/**
|
|
5
4
|
* __Use focus ring__
|
|
6
5
|
*
|
|
@@ -31,12 +30,10 @@ import { useRef, useState } from 'react';
|
|
|
31
30
|
*/
|
|
32
31
|
var useFocusRing = function useFocusRing() {
|
|
33
32
|
var initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'off';
|
|
34
|
-
|
|
35
33
|
var _useState = useState(initialState),
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
35
|
+
focusState = _useState2[0],
|
|
36
|
+
setFocusState = _useState2[1];
|
|
40
37
|
var focusProps = useRef({
|
|
41
38
|
onFocus: function onFocus() {
|
|
42
39
|
return setFocusState('on');
|
|
@@ -50,5 +47,4 @@ var useFocusRing = function useFocusRing() {
|
|
|
50
47
|
focusProps: focusProps.current
|
|
51
48
|
};
|
|
52
49
|
};
|
|
53
|
-
|
|
54
50
|
export default useFocusRing;
|
package/dist/esm/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/focus-ring",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"description": "A focus ring is used to indicate the currently focused item.",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
".": "./src/index.tsx"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@atlaskit/tokens": "^0.
|
|
30
|
+
"@atlaskit/tokens": "^1.0.0",
|
|
31
31
|
"@babel/runtime": "^7.0.0",
|
|
32
32
|
"@emotion/react": "^11.7.1"
|
|
33
33
|
},
|
package/report.api.md
CHANGED