@atlaskit/focus-ring 1.0.6 → 1.0.7
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 +6 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/version.json +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 +14 -7
package/CHANGELOG.md
CHANGED
package/dist/cjs/version.json
CHANGED
package/dist/es2019/version.json
CHANGED
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.0.7",
|
|
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,13 +20,20 @@
|
|
|
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
39
|
"@emotion/core": "^10.0.9"
|
|
@@ -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.2.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": {
|