@atlaskit/focus-ring 1.0.6 → 1.1.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 +12 -0
- package/dist/cjs/focus-ring.js +6 -6
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/focus-ring.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/focus-ring.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types-ts4.0/focus-ring.d.ts +23 -0
- package/dist/types-ts4.0/index.d.ts +3 -0
- package/dist/types-ts4.0/types.d.ts +22 -0
- package/dist/types-ts4.0/use-focus-ring.d.ts +34 -0
- package/package.json +15 -8
- package/report.api.md +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/focus-ring
|
|
2
2
|
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`b5d79ded842`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b5d79ded842) - Updates `@emotion/core` to `@emotion/react`; v10 to v11. There is no expected behavior change.
|
|
8
|
+
|
|
9
|
+
## 1.0.7
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`8cc2f888c83`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cc2f888c83) - Upgrade Typescript from `4.3.5` to `4.5.5`
|
|
14
|
+
|
|
3
15
|
## 1.0.6
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/cjs/focus-ring.js
CHANGED
|
@@ -7,21 +7,21 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _react2 = require("@emotion/react");
|
|
11
11
|
|
|
12
12
|
var _colors = require("@atlaskit/theme/colors");
|
|
13
13
|
|
|
14
14
|
/** @jsx jsx */
|
|
15
15
|
var BORDER_WIDTH = 2;
|
|
16
|
-
var baseFocusOutsideStyles = (0,
|
|
16
|
+
var baseFocusOutsideStyles = (0, _react2.css)({
|
|
17
17
|
outline: "".concat(BORDER_WIDTH, "px solid ", "var(--ds-border-focused, ".concat(_colors.B100, ")")),
|
|
18
18
|
outlineOffset: BORDER_WIDTH
|
|
19
19
|
});
|
|
20
|
-
var baseInsetStyles = (0,
|
|
20
|
+
var baseInsetStyles = (0, _react2.css)({
|
|
21
21
|
boxShadow: "inset 0px 0px 0px ".concat(BORDER_WIDTH, "px ", "var(--ds-border-focused, ".concat(_colors.B100, ")")),
|
|
22
22
|
outline: 'none'
|
|
23
23
|
});
|
|
24
|
-
var focusRingStyles = (0,
|
|
24
|
+
var focusRingStyles = (0, _react2.css)({
|
|
25
25
|
'&:focus-visible': baseFocusOutsideStyles,
|
|
26
26
|
'@supports not selector(*:focus-visible)': {
|
|
27
27
|
'&:focus': baseFocusOutsideStyles
|
|
@@ -32,7 +32,7 @@ var focusRingStyles = (0, _core.css)({
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
|
-
var insetFocusRingStyles = (0,
|
|
35
|
+
var insetFocusRingStyles = (0, _react2.css)({
|
|
36
36
|
'&:focus-visible': baseInsetStyles,
|
|
37
37
|
'@supports not selector(*:focus-visible)': {
|
|
38
38
|
'&:focus': baseInsetStyles
|
|
@@ -70,7 +70,7 @@ var FocusRing = function FocusRing(_ref) {
|
|
|
70
70
|
var controlledStyles = isInset ? baseInsetStyles : baseFocusOutsideStyles;
|
|
71
71
|
var uncontrolledStyles = isInset ? insetFocusRingStyles : focusRingStyles;
|
|
72
72
|
var focusCls = typeof focus === 'undefined' ? uncontrolledStyles : focus === 'on' && controlledStyles;
|
|
73
|
-
return (0,
|
|
73
|
+
return (0, _react2.jsx)(_react2.ClassNames, null, function (_ref2) {
|
|
74
74
|
var css = _ref2.css,
|
|
75
75
|
cx = _ref2.cx;
|
|
76
76
|
return _react.Children.only( // This may look unwieldy but means we skip applying styles / cloning if no className is applicable
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { Children, cloneElement } from 'react';
|
|
3
|
-
import { ClassNames, css, jsx } from '@emotion/
|
|
3
|
+
import { ClassNames, css, jsx } from '@emotion/react';
|
|
4
4
|
import { B100 } from '@atlaskit/theme/colors';
|
|
5
5
|
const BORDER_WIDTH = 2;
|
|
6
6
|
const baseFocusOutsideStyles = css({
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/focus-ring.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { Children, cloneElement } from 'react';
|
|
3
|
-
import { ClassNames, css, jsx } from '@emotion/
|
|
3
|
+
import { ClassNames, css, jsx } from '@emotion/react';
|
|
4
4
|
import { B100 } from '@atlaskit/theme/colors';
|
|
5
5
|
var BORDER_WIDTH = 2;
|
|
6
6
|
var baseFocusOutsideStyles = css({
|
package/dist/esm/version.json
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
import type { FocusRingProps } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* __Focus ring__
|
|
6
|
+
*
|
|
7
|
+
* A focus ring is used indicate the currently focused item.
|
|
8
|
+
*
|
|
9
|
+
* - [Code](https://atlaskit.atlassian.com/packages/design-system/focus-ring)
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```jsx
|
|
13
|
+
* import FocusRing from '@atlaskit/focus-ring';
|
|
14
|
+
*
|
|
15
|
+
* const InteractiveComponent = () => (
|
|
16
|
+
* <FocusRing>
|
|
17
|
+
* <button type="button">Hello</button>
|
|
18
|
+
* </FocusRing>
|
|
19
|
+
* )
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
declare const FocusRing: FC<FocusRingProps>;
|
|
23
|
+
export default FocusRing;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { FocusEventHandler, ReactElement } from 'react';
|
|
2
|
+
export interface FocusEventHandlers {
|
|
3
|
+
onFocus: FocusEventHandler;
|
|
4
|
+
onBlur: FocusEventHandler;
|
|
5
|
+
}
|
|
6
|
+
export declare type FocusState = 'on' | 'off';
|
|
7
|
+
export interface FocusRingProps {
|
|
8
|
+
/**
|
|
9
|
+
* Makes the `FocusRing` a controlled component (opting out of native focus behavior). The focus ring
|
|
10
|
+
* will apply the visual focus indicator when the `focus` prop is set to `on`. This prop should be used
|
|
11
|
+
* in conjunction with `useFocusRing`.
|
|
12
|
+
*/
|
|
13
|
+
focus?: FocusState;
|
|
14
|
+
/**
|
|
15
|
+
* Controls whether the focus ring should be applied around or within the composed element.
|
|
16
|
+
*/
|
|
17
|
+
isInset?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The focusable element to be rendered within the `FocusRing`.
|
|
20
|
+
*/
|
|
21
|
+
children: ReactElement;
|
|
22
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { FocusEventHandlers, FocusState } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* __Use focus ring__
|
|
4
|
+
*
|
|
5
|
+
* The `useFocusRing` hook is designed to manage focus for the `FocusRing` in cases where the `FocusRing`'s visual application
|
|
6
|
+
* and the element that takes focus, differ. See the `focus` prop of `FocusRing` for more information.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```jsx
|
|
10
|
+
* import VisuallyHidden from '@atlaskit/visuall-hidden';
|
|
11
|
+
* import FocusRing, { useFocusRing } from '@atlaskit/focus-ring';
|
|
12
|
+
*
|
|
13
|
+
* const InteractiveComponent = () => {
|
|
14
|
+
* const { focusState, focusProps } = useFocusRing();
|
|
15
|
+
*
|
|
16
|
+
* return (
|
|
17
|
+
* <div>
|
|
18
|
+
* <VisuallHidden>
|
|
19
|
+
* <input {...focusProps} />
|
|
20
|
+
* </VisuallyHidden>
|
|
21
|
+
* <FocusRing focus={focusState}>
|
|
22
|
+
* <div role="button">Hello</div>
|
|
23
|
+
* </FocusRing>
|
|
24
|
+
* </div>
|
|
25
|
+
* );
|
|
26
|
+
*
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
declare const useFocusRing: (initialState?: FocusState) => {
|
|
31
|
+
readonly focusState: "on" | "off";
|
|
32
|
+
readonly focusProps: FocusEventHandlers;
|
|
33
|
+
};
|
|
34
|
+
export default useFocusRing;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/focus-ring",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
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",
|
|
@@ -20,16 +20,23 @@
|
|
|
20
20
|
"module": "dist/esm/index.js",
|
|
21
21
|
"module:es2019": "dist/es2019/index.js",
|
|
22
22
|
"types": "dist/types/index.d.ts",
|
|
23
|
+
"typesVersions": {
|
|
24
|
+
">=4.0 <4.5": {
|
|
25
|
+
"*": [
|
|
26
|
+
"dist/types-ts4.0/*"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
23
30
|
"sideEffects": false,
|
|
24
31
|
"atlaskit:src": "src/index.tsx",
|
|
25
32
|
"af:exports": {
|
|
26
33
|
".": "./src/index.tsx"
|
|
27
34
|
},
|
|
28
35
|
"dependencies": {
|
|
29
|
-
"@atlaskit/theme": "^12.
|
|
36
|
+
"@atlaskit/theme": "^12.2.0",
|
|
30
37
|
"@atlaskit/tokens": "^0.10.0",
|
|
31
38
|
"@babel/runtime": "^7.0.0",
|
|
32
|
-
"@emotion/
|
|
39
|
+
"@emotion/react": "^11.7.1"
|
|
33
40
|
},
|
|
34
41
|
"peerDependencies": {
|
|
35
42
|
"react": "^16.8.0"
|
|
@@ -37,16 +44,16 @@
|
|
|
37
44
|
"devDependencies": {
|
|
38
45
|
"@atlaskit/button": "^16.3.0",
|
|
39
46
|
"@atlaskit/docs": "*",
|
|
40
|
-
"@atlaskit/progress-indicator": "^9.
|
|
47
|
+
"@atlaskit/progress-indicator": "^9.3.0",
|
|
41
48
|
"@atlaskit/ssr": "*",
|
|
42
|
-
"@atlaskit/textfield": "^5.
|
|
49
|
+
"@atlaskit/textfield": "^5.3.0",
|
|
43
50
|
"@atlaskit/visual-regression": "*",
|
|
44
|
-
"@atlaskit/visually-hidden": "^1.
|
|
51
|
+
"@atlaskit/visually-hidden": "^1.1.0",
|
|
45
52
|
"@atlaskit/webdriver-runner": "*",
|
|
46
53
|
"@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
|
|
47
|
-
"@testing-library/react": "^
|
|
54
|
+
"@testing-library/react": "^12.1.5",
|
|
48
55
|
"react-dom": "^16.8.0",
|
|
49
|
-
"typescript": "4.
|
|
56
|
+
"typescript": "4.5.5",
|
|
50
57
|
"wait-for-expect": "^1.2.0"
|
|
51
58
|
},
|
|
52
59
|
"techstack": {
|
package/report.api.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
## API Report File for "@atlaskit/focus-ring"
|
|
1
|
+
## API Report File for "@atlaskit/focus-ring".
|
|
2
2
|
|
|
3
|
-
> Do not edit this file.
|
|
3
|
+
> Do not edit this file. This report is auto-generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
[Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
4
6
|
|
|
5
7
|
````ts
|
|
6
8
|
import { FC } from 'react';
|