@fluentui/react-tabster 9.0.0-alpha.68 → 9.0.0-alpha.73
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.json +97 -1
- package/CHANGELOG.md +44 -2
- package/dist/react-tabster.d.ts +33 -1
- package/lib/hooks/useFocusIndicatorStyle.d.ts +30 -2
- package/lib/hooks/useFocusIndicatorStyle.js +70 -5
- package/lib/hooks/useFocusIndicatorStyle.js.map +1 -1
- package/lib-commonjs/hooks/useFocusIndicatorStyle.d.ts +30 -2
- package/lib-commonjs/hooks/useFocusIndicatorStyle.js +75 -7
- package/lib-commonjs/hooks/useFocusIndicatorStyle.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.json
CHANGED
@@ -2,7 +2,103 @@
|
|
2
2
|
"name": "@fluentui/react-tabster",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
5
|
+
"date": "Tue, 05 Oct 2021 12:47:00 GMT",
|
6
|
+
"tag": "@fluentui/react-tabster_v9.0.0-alpha.73",
|
7
|
+
"version": "9.0.0-alpha.73",
|
8
|
+
"comments": {
|
9
|
+
"prerelease": [
|
10
|
+
{
|
11
|
+
"author": "beachball",
|
12
|
+
"package": "@fluentui/react-tabster",
|
13
|
+
"comment": "Bump @fluentui/make-styles to v9.0.0-alpha.35",
|
14
|
+
"commit": "c41b8f8996acd5b970d894fc910cc4d661f8e3cb"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"author": "beachball",
|
18
|
+
"package": "@fluentui/react-tabster",
|
19
|
+
"comment": "Bump @fluentui/react-make-styles to v9.0.0-alpha.78",
|
20
|
+
"commit": "c41b8f8996acd5b970d894fc910cc4d661f8e3cb"
|
21
|
+
}
|
22
|
+
]
|
23
|
+
}
|
24
|
+
},
|
25
|
+
{
|
26
|
+
"date": "Tue, 05 Oct 2021 09:28:07 GMT",
|
27
|
+
"tag": "@fluentui/react-tabster_v9.0.0-alpha.72",
|
28
|
+
"version": "9.0.0-alpha.72",
|
29
|
+
"comments": {
|
30
|
+
"prerelease": [
|
31
|
+
{
|
32
|
+
"author": "beachball",
|
33
|
+
"package": "@fluentui/react-tabster",
|
34
|
+
"comment": "Bump @fluentui/react-make-styles to v9.0.0-alpha.77",
|
35
|
+
"commit": "3b16677a03035dcf03c1297268b85c6d4bd3f839"
|
36
|
+
},
|
37
|
+
{
|
38
|
+
"author": "beachball",
|
39
|
+
"package": "@fluentui/react-tabster",
|
40
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-alpha.56",
|
41
|
+
"commit": "3b16677a03035dcf03c1297268b85c6d4bd3f839"
|
42
|
+
}
|
43
|
+
]
|
44
|
+
}
|
45
|
+
},
|
46
|
+
{
|
47
|
+
"date": "Fri, 01 Oct 2021 14:13:08 GMT",
|
48
|
+
"tag": "@fluentui/react-tabster_v9.0.0-alpha.71",
|
49
|
+
"version": "9.0.0-alpha.71",
|
50
|
+
"comments": {
|
51
|
+
"prerelease": [
|
52
|
+
{
|
53
|
+
"author": "lingfangao@hotmail.com",
|
54
|
+
"package": "@fluentui/react-tabster",
|
55
|
+
"comment": "Bump v9 prerelease versions to rerelease",
|
56
|
+
"commit": "4fa0856ad0353b787b8ae59229e6f64ef0719824"
|
57
|
+
},
|
58
|
+
{
|
59
|
+
"author": "beachball",
|
60
|
+
"package": "@fluentui/react-tabster",
|
61
|
+
"comment": "Bump @fluentui/make-styles to v9.0.0-alpha.34",
|
62
|
+
"commit": "4fa0856ad0353b787b8ae59229e6f64ef0719824"
|
63
|
+
},
|
64
|
+
{
|
65
|
+
"author": "beachball",
|
66
|
+
"package": "@fluentui/react-tabster",
|
67
|
+
"comment": "Bump @fluentui/react-make-styles to v9.0.0-alpha.76",
|
68
|
+
"commit": "4fa0856ad0353b787b8ae59229e6f64ef0719824"
|
69
|
+
},
|
70
|
+
{
|
71
|
+
"author": "beachball",
|
72
|
+
"package": "@fluentui/react-tabster",
|
73
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.0.0-alpha.28",
|
74
|
+
"commit": "4fa0856ad0353b787b8ae59229e6f64ef0719824"
|
75
|
+
},
|
76
|
+
{
|
77
|
+
"author": "beachball",
|
78
|
+
"package": "@fluentui/react-tabster",
|
79
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-alpha.55",
|
80
|
+
"commit": "4fa0856ad0353b787b8ae59229e6f64ef0719824"
|
81
|
+
}
|
82
|
+
]
|
83
|
+
}
|
84
|
+
},
|
85
|
+
{
|
86
|
+
"date": "Fri, 01 Oct 2021 09:44:56 GMT",
|
87
|
+
"tag": "@fluentui/react-tabster_v9.0.0-alpha.69",
|
88
|
+
"version": "9.0.0-alpha.69",
|
89
|
+
"comments": {
|
90
|
+
"prerelease": [
|
91
|
+
{
|
92
|
+
"author": "lingfangao@hotmail.com",
|
93
|
+
"package": "@fluentui/react-tabster",
|
94
|
+
"comment": "chore(react-tabster): Update default focus ring styles",
|
95
|
+
"commit": "0ebd18ceaba3d032748f76da4ce06fcf8942c6c5"
|
96
|
+
}
|
97
|
+
]
|
98
|
+
}
|
99
|
+
},
|
100
|
+
{
|
101
|
+
"date": "Wed, 29 Sep 2021 08:06:11 GMT",
|
6
102
|
"tag": "@fluentui/react-tabster_v9.0.0-alpha.68",
|
7
103
|
"version": "9.0.0-alpha.68",
|
8
104
|
"comments": {
|
package/CHANGELOG.md
CHANGED
@@ -1,12 +1,54 @@
|
|
1
1
|
# Change Log - @fluentui/react-tabster
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Tue, 05 Oct 2021 12:47:00 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.0.0-alpha.73](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabster_v9.0.0-alpha.73)
|
8
|
+
|
9
|
+
Tue, 05 Oct 2021 12:47:00 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabster_v9.0.0-alpha.72..@fluentui/react-tabster_v9.0.0-alpha.73)
|
11
|
+
|
12
|
+
### Changes
|
13
|
+
|
14
|
+
- Bump @fluentui/make-styles to v9.0.0-alpha.35 ([PR #20108](https://github.com/microsoft/fluentui/pull/20108) by beachball)
|
15
|
+
- Bump @fluentui/react-make-styles to v9.0.0-alpha.78 ([PR #20108](https://github.com/microsoft/fluentui/pull/20108) by beachball)
|
16
|
+
|
17
|
+
## [9.0.0-alpha.72](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabster_v9.0.0-alpha.72)
|
18
|
+
|
19
|
+
Tue, 05 Oct 2021 09:28:07 GMT
|
20
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabster_v9.0.0-alpha.71..@fluentui/react-tabster_v9.0.0-alpha.72)
|
21
|
+
|
22
|
+
### Changes
|
23
|
+
|
24
|
+
- Bump @fluentui/react-make-styles to v9.0.0-alpha.77 ([PR #20081](https://github.com/microsoft/fluentui/pull/20081) by beachball)
|
25
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.56 ([PR #20081](https://github.com/microsoft/fluentui/pull/20081) by beachball)
|
26
|
+
|
27
|
+
## [9.0.0-alpha.71](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabster_v9.0.0-alpha.71)
|
28
|
+
|
29
|
+
Fri, 01 Oct 2021 14:13:08 GMT
|
30
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabster_v9.0.0-alpha.69..@fluentui/react-tabster_v9.0.0-alpha.71)
|
31
|
+
|
32
|
+
### Changes
|
33
|
+
|
34
|
+
- Bump v9 prerelease versions to rerelease ([PR #20069](https://github.com/microsoft/fluentui/pull/20069) by lingfangao@hotmail.com)
|
35
|
+
- Bump @fluentui/make-styles to v9.0.0-alpha.34 ([PR #20069](https://github.com/microsoft/fluentui/pull/20069) by beachball)
|
36
|
+
- Bump @fluentui/react-make-styles to v9.0.0-alpha.76 ([PR #20069](https://github.com/microsoft/fluentui/pull/20069) by beachball)
|
37
|
+
- Bump @fluentui/react-shared-contexts to v9.0.0-alpha.28 ([PR #20069](https://github.com/microsoft/fluentui/pull/20069) by beachball)
|
38
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.55 ([PR #20069](https://github.com/microsoft/fluentui/pull/20069) by beachball)
|
39
|
+
|
40
|
+
## [9.0.0-alpha.69](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabster_v9.0.0-alpha.69)
|
41
|
+
|
42
|
+
Fri, 01 Oct 2021 09:44:56 GMT
|
43
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabster_v9.0.0-alpha.68..@fluentui/react-tabster_v9.0.0-alpha.69)
|
44
|
+
|
45
|
+
### Changes
|
46
|
+
|
47
|
+
- chore(react-tabster): Update default focus ring styles ([PR #19990](https://github.com/microsoft/fluentui/pull/19990) by lingfangao@hotmail.com)
|
48
|
+
|
7
49
|
## [9.0.0-alpha.68](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabster_v9.0.0-alpha.68)
|
8
50
|
|
9
|
-
Wed, 29 Sep 2021 08:
|
51
|
+
Wed, 29 Sep 2021 08:06:11 GMT
|
10
52
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabster_v9.0.0-alpha.67..@fluentui/react-tabster_v9.0.0-alpha.68)
|
11
53
|
|
12
54
|
### Changes
|
package/dist/react-tabster.d.ts
CHANGED
@@ -1,14 +1,46 @@
|
|
1
|
+
import type { MakeStyles } from '@fluentui/make-styles';
|
1
2
|
import type { MakeStylesStyleRule } from '@fluentui/make-styles';
|
2
3
|
import type { RefObject } from 'react';
|
3
4
|
import type { Theme } from '@fluentui/react-theme';
|
4
5
|
import { Types } from 'tabster';
|
5
6
|
|
6
|
-
|
7
|
+
/**
|
8
|
+
* Creates a style rule for @see makeStyles that includes the necessary selectors for focus.
|
9
|
+
* Should be used only when @see createFocusOutlineStyle does not fit requirements
|
10
|
+
*
|
11
|
+
* @param rule - styling applied on focus, defaults to @see getDefaultFocusOutlineStyes
|
12
|
+
*/
|
13
|
+
export declare const createCustomFocusIndicatorStyle: (rule: MakeStylesStyleRule<Theme>, options?: CreateFocusIndicatorStyleRuleOptions) => MakeStylesStyleRule<Theme>;
|
7
14
|
|
8
15
|
export declare interface CreateFocusIndicatorStyleRuleOptions {
|
9
16
|
selector?: 'focus' | 'focus-within';
|
10
17
|
}
|
11
18
|
|
19
|
+
/**
|
20
|
+
* NOTE: The element with the focus outline needs to have `position: relative` so that the
|
21
|
+
* pseudo element can be properly positioned.
|
22
|
+
*
|
23
|
+
* @param theme - Theme used in @see makeStyles
|
24
|
+
* @param options - Configure the style of the focus outline
|
25
|
+
* @returns focus outline styles object for @see makeStyles
|
26
|
+
*/
|
27
|
+
export declare const createFocusOutlineStyle: (theme: Theme, options?: {
|
28
|
+
style: Partial<FocusOutlineStyleOptions>;
|
29
|
+
} & CreateFocusIndicatorStyleRuleOptions) => MakeStyles;
|
30
|
+
|
31
|
+
export declare type FocusOutlineOffset = Record<'top' | 'bottom' | 'left' | 'right', string>;
|
32
|
+
|
33
|
+
export declare type FocusOutlineStyleOptions = {
|
34
|
+
/**
|
35
|
+
* Only property not supported by the native CSS `outline`, if this is no longer needed
|
36
|
+
* we can just go native instead
|
37
|
+
*/
|
38
|
+
outlineRadius: string;
|
39
|
+
outlineColor: string;
|
40
|
+
outlineWidth: string;
|
41
|
+
outlineOffset?: string | FocusOutlineOffset;
|
42
|
+
};
|
43
|
+
|
12
44
|
/**
|
13
45
|
* A hook that returns the necessary tabster attributes to support arrow key navigation
|
14
46
|
* @param options - Options to configure keyboard navigation
|
@@ -1,6 +1,34 @@
|
|
1
1
|
import type { Theme } from '@fluentui/react-theme';
|
2
|
-
import type { MakeStylesStyleRule } from '@fluentui/make-styles';
|
2
|
+
import type { MakeStyles, MakeStylesStyleRule } from '@fluentui/make-styles';
|
3
|
+
export declare type FocusOutlineOffset = Record<'top' | 'bottom' | 'left' | 'right', string>;
|
4
|
+
export declare type FocusOutlineStyleOptions = {
|
5
|
+
/**
|
6
|
+
* Only property not supported by the native CSS `outline`, if this is no longer needed
|
7
|
+
* we can just go native instead
|
8
|
+
*/
|
9
|
+
outlineRadius: string;
|
10
|
+
outlineColor: string;
|
11
|
+
outlineWidth: string;
|
12
|
+
outlineOffset?: string | FocusOutlineOffset;
|
13
|
+
};
|
3
14
|
export interface CreateFocusIndicatorStyleRuleOptions {
|
4
15
|
selector?: 'focus' | 'focus-within';
|
5
16
|
}
|
6
|
-
|
17
|
+
/**
|
18
|
+
* NOTE: The element with the focus outline needs to have `position: relative` so that the
|
19
|
+
* pseudo element can be properly positioned.
|
20
|
+
*
|
21
|
+
* @param theme - Theme used in @see makeStyles
|
22
|
+
* @param options - Configure the style of the focus outline
|
23
|
+
* @returns focus outline styles object for @see makeStyles
|
24
|
+
*/
|
25
|
+
export declare const createFocusOutlineStyle: (theme: Theme, options?: {
|
26
|
+
style: Partial<FocusOutlineStyleOptions>;
|
27
|
+
} & CreateFocusIndicatorStyleRuleOptions) => MakeStyles;
|
28
|
+
/**
|
29
|
+
* Creates a style rule for @see makeStyles that includes the necessary selectors for focus.
|
30
|
+
* Should be used only when @see createFocusOutlineStyle does not fit requirements
|
31
|
+
*
|
32
|
+
* @param rule - styling applied on focus, defaults to @see getDefaultFocusOutlineStyes
|
33
|
+
*/
|
34
|
+
export declare const createCustomFocusIndicatorStyle: (rule: MakeStylesStyleRule<Theme>, options?: CreateFocusIndicatorStyleRuleOptions) => MakeStylesStyleRule<Theme>;
|
@@ -1,19 +1,84 @@
|
|
1
|
+
import { __assign } from "tslib";
|
1
2
|
import { KEYBOARD_NAV_SELECTOR } from '../symbols';
|
3
|
+
/**
|
4
|
+
* NOTE: the element with the focus outline needs to have `position: relative` so that the
|
5
|
+
* pseudo element can be properly positioned.
|
6
|
+
*
|
7
|
+
* @param options - Configures the style of the focus outline
|
8
|
+
* @returns focus outline styles object
|
9
|
+
*/
|
2
10
|
|
3
|
-
var
|
11
|
+
var getFocusOutlineStyles = function (options) {
|
12
|
+
var _a, _b, _c, _d;
|
13
|
+
|
14
|
+
var outlineRadius = options.outlineRadius,
|
15
|
+
outlineColor = options.outlineColor,
|
16
|
+
outlineOffset = options.outlineOffset,
|
17
|
+
outlineWidth = options.outlineWidth;
|
18
|
+
var outlineOffsetTop = ((_a = outlineOffset) === null || _a === void 0 ? void 0 : _a.top) || outlineOffset;
|
19
|
+
var outlineOffsetBottom = ((_b = outlineOffset) === null || _b === void 0 ? void 0 : _b.bottom) || outlineOffset;
|
20
|
+
var outlineOffsetLeft = ((_c = outlineOffset) === null || _c === void 0 ? void 0 : _c.left) || outlineOffset;
|
21
|
+
var outlineOffsetRight = ((_d = outlineOffset) === null || _d === void 0 ? void 0 : _d.right) || outlineOffset;
|
4
22
|
return {
|
5
|
-
|
23
|
+
borderColor: 'transparent',
|
24
|
+
':after': {
|
25
|
+
content: '""',
|
26
|
+
position: 'absolute',
|
27
|
+
pointerEvents: 'none',
|
28
|
+
boxSizing: 'outline-box',
|
29
|
+
zIndex: 1,
|
30
|
+
borderStyle: 'solid',
|
31
|
+
borderWidth: outlineWidth,
|
32
|
+
borderRadius: outlineRadius,
|
33
|
+
borderColor: outlineColor,
|
34
|
+
top: !outlineOffset ? "-" + outlineWidth : "calc(0px - " + outlineWidth + " - " + outlineOffsetTop + ")",
|
35
|
+
bottom: !outlineOffset ? "-" + outlineWidth : "calc(0px - " + outlineWidth + " - " + outlineOffsetBottom + ")",
|
36
|
+
left: !outlineOffset ? "-" + outlineWidth : "calc(0px - " + outlineWidth + " - " + outlineOffsetLeft + ")",
|
37
|
+
right: !outlineOffset ? "-" + outlineWidth : "calc(0px - " + outlineWidth + " - " + outlineOffsetRight + ")"
|
38
|
+
}
|
6
39
|
};
|
7
40
|
};
|
8
41
|
|
9
42
|
var defaultOptions = {
|
10
43
|
selector: 'focus'
|
11
44
|
};
|
12
|
-
|
13
|
-
|
14
|
-
|
45
|
+
/**
|
46
|
+
* NOTE: The element with the focus outline needs to have `position: relative` so that the
|
47
|
+
* pseudo element can be properly positioned.
|
48
|
+
*
|
49
|
+
* @param theme - Theme used in @see makeStyles
|
50
|
+
* @param options - Configure the style of the focus outline
|
51
|
+
* @returns focus outline styles object for @see makeStyles
|
52
|
+
*/
|
53
|
+
|
54
|
+
export var createFocusOutlineStyle = function (theme, options) {
|
55
|
+
var _a;
|
56
|
+
|
57
|
+
if (options === void 0) {
|
58
|
+
options = __assign({
|
59
|
+
style: {}
|
60
|
+
}, defaultOptions);
|
15
61
|
}
|
16
62
|
|
63
|
+
return _a = {
|
64
|
+
':focus-visible': {
|
65
|
+
outline: 'none'
|
66
|
+
}
|
67
|
+
}, _a[KEYBOARD_NAV_SELECTOR + " :" + (options.selector || defaultOptions.selector)] = getFocusOutlineStyles(__assign({
|
68
|
+
outlineColor: theme.colorStrokeFocus2,
|
69
|
+
outlineRadius: theme.borderRadiusMedium,
|
70
|
+
// FIXME: theme.global.strokeWidth.thick causes some weird bugs
|
71
|
+
outlineWidth: '2px'
|
72
|
+
}, options.style)), _a;
|
73
|
+
};
|
74
|
+
/**
|
75
|
+
* Creates a style rule for @see makeStyles that includes the necessary selectors for focus.
|
76
|
+
* Should be used only when @see createFocusOutlineStyle does not fit requirements
|
77
|
+
*
|
78
|
+
* @param rule - styling applied on focus, defaults to @see getDefaultFocusOutlineStyes
|
79
|
+
*/
|
80
|
+
|
81
|
+
export var createCustomFocusIndicatorStyle = function (rule, options) {
|
17
82
|
if (options === void 0) {
|
18
83
|
options = defaultOptions;
|
19
84
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useFocusIndicatorStyle.ts"],"names":[],"mappings":"AAEA,SAAS,qBAAT,QAAsC,YAAtC;;
|
1
|
+
{"version":3,"sources":["../../src/hooks/useFocusIndicatorStyle.ts"],"names":[],"mappings":";AAEA,SAAS,qBAAT,QAAsC,YAAtC;AAcA;;;;;;AAMG;;AACH,IAAM,qBAAqB,GAAG,UAAC,OAAD,EAAkC;;;AACtD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A,KAAA,CAAA,EAAA;AAAA,IAAA,OAAA,GAAA,cAAA;AAA8D;;AAC/B,SAAA,UAAA,KAAA,EAAK;;;AAAI,WAAA,EAAA,GAAA;AACxC,wBAAkB;AAChB,QAAA,OAAO,EAAE;AADO;AADsB,KAAA,EAIxC,EAAA,CAAI,qBAAqB,GAAA,IAArB,IAA0B,OAAO,CAAC,QAAR,IAAoB,cAAc,CAAC,QAA7D,CAAJ,CAAA,GACE,OAAO,IAAP,KAAgB,UAAhB,GAA6B,IAAI,CAAC,KAAD,CAAjC,GAA2C,IALL,EAMxC,EANwC;AAMxC,GAN+B;AAM/B,CATK","sourceRoot":""}
|
@@ -1,6 +1,34 @@
|
|
1
1
|
import type { Theme } from '@fluentui/react-theme';
|
2
|
-
import type { MakeStylesStyleRule } from '@fluentui/make-styles';
|
2
|
+
import type { MakeStyles, MakeStylesStyleRule } from '@fluentui/make-styles';
|
3
|
+
export declare type FocusOutlineOffset = Record<'top' | 'bottom' | 'left' | 'right', string>;
|
4
|
+
export declare type FocusOutlineStyleOptions = {
|
5
|
+
/**
|
6
|
+
* Only property not supported by the native CSS `outline`, if this is no longer needed
|
7
|
+
* we can just go native instead
|
8
|
+
*/
|
9
|
+
outlineRadius: string;
|
10
|
+
outlineColor: string;
|
11
|
+
outlineWidth: string;
|
12
|
+
outlineOffset?: string | FocusOutlineOffset;
|
13
|
+
};
|
3
14
|
export interface CreateFocusIndicatorStyleRuleOptions {
|
4
15
|
selector?: 'focus' | 'focus-within';
|
5
16
|
}
|
6
|
-
|
17
|
+
/**
|
18
|
+
* NOTE: The element with the focus outline needs to have `position: relative` so that the
|
19
|
+
* pseudo element can be properly positioned.
|
20
|
+
*
|
21
|
+
* @param theme - Theme used in @see makeStyles
|
22
|
+
* @param options - Configure the style of the focus outline
|
23
|
+
* @returns focus outline styles object for @see makeStyles
|
24
|
+
*/
|
25
|
+
export declare const createFocusOutlineStyle: (theme: Theme, options?: {
|
26
|
+
style: Partial<FocusOutlineStyleOptions>;
|
27
|
+
} & CreateFocusIndicatorStyleRuleOptions) => MakeStyles;
|
28
|
+
/**
|
29
|
+
* Creates a style rule for @see makeStyles that includes the necessary selectors for focus.
|
30
|
+
* Should be used only when @see createFocusOutlineStyle does not fit requirements
|
31
|
+
*
|
32
|
+
* @param rule - styling applied on focus, defaults to @see getDefaultFocusOutlineStyes
|
33
|
+
*/
|
34
|
+
export declare const createCustomFocusIndicatorStyle: (rule: MakeStylesStyleRule<Theme>, options?: CreateFocusIndicatorStyleRuleOptions) => MakeStylesStyleRule<Theme>;
|
@@ -3,25 +3,93 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.createCustomFocusIndicatorStyle = exports.createFocusOutlineStyle = void 0;
|
7
|
+
|
8
|
+
var tslib_1 = /*#__PURE__*/require("tslib");
|
7
9
|
|
8
10
|
var symbols_1 = /*#__PURE__*/require("../symbols");
|
11
|
+
/**
|
12
|
+
* NOTE: the element with the focus outline needs to have `position: relative` so that the
|
13
|
+
* pseudo element can be properly positioned.
|
14
|
+
*
|
15
|
+
* @param options - Configures the style of the focus outline
|
16
|
+
* @returns focus outline styles object
|
17
|
+
*/
|
18
|
+
|
9
19
|
|
10
|
-
var
|
20
|
+
var getFocusOutlineStyles = function (options) {
|
21
|
+
var _a, _b, _c, _d;
|
22
|
+
|
23
|
+
var outlineRadius = options.outlineRadius,
|
24
|
+
outlineColor = options.outlineColor,
|
25
|
+
outlineOffset = options.outlineOffset,
|
26
|
+
outlineWidth = options.outlineWidth;
|
27
|
+
var outlineOffsetTop = ((_a = outlineOffset) === null || _a === void 0 ? void 0 : _a.top) || outlineOffset;
|
28
|
+
var outlineOffsetBottom = ((_b = outlineOffset) === null || _b === void 0 ? void 0 : _b.bottom) || outlineOffset;
|
29
|
+
var outlineOffsetLeft = ((_c = outlineOffset) === null || _c === void 0 ? void 0 : _c.left) || outlineOffset;
|
30
|
+
var outlineOffsetRight = ((_d = outlineOffset) === null || _d === void 0 ? void 0 : _d.right) || outlineOffset;
|
11
31
|
return {
|
12
|
-
|
32
|
+
borderColor: 'transparent',
|
33
|
+
':after': {
|
34
|
+
content: '""',
|
35
|
+
position: 'absolute',
|
36
|
+
pointerEvents: 'none',
|
37
|
+
boxSizing: 'outline-box',
|
38
|
+
zIndex: 1,
|
39
|
+
borderStyle: 'solid',
|
40
|
+
borderWidth: outlineWidth,
|
41
|
+
borderRadius: outlineRadius,
|
42
|
+
borderColor: outlineColor,
|
43
|
+
top: !outlineOffset ? "-" + outlineWidth : "calc(0px - " + outlineWidth + " - " + outlineOffsetTop + ")",
|
44
|
+
bottom: !outlineOffset ? "-" + outlineWidth : "calc(0px - " + outlineWidth + " - " + outlineOffsetBottom + ")",
|
45
|
+
left: !outlineOffset ? "-" + outlineWidth : "calc(0px - " + outlineWidth + " - " + outlineOffsetLeft + ")",
|
46
|
+
right: !outlineOffset ? "-" + outlineWidth : "calc(0px - " + outlineWidth + " - " + outlineOffsetRight + ")"
|
47
|
+
}
|
13
48
|
};
|
14
49
|
};
|
15
50
|
|
16
51
|
var defaultOptions = {
|
17
52
|
selector: 'focus'
|
18
53
|
};
|
54
|
+
/**
|
55
|
+
* NOTE: The element with the focus outline needs to have `position: relative` so that the
|
56
|
+
* pseudo element can be properly positioned.
|
57
|
+
*
|
58
|
+
* @param theme - Theme used in @see makeStyles
|
59
|
+
* @param options - Configure the style of the focus outline
|
60
|
+
* @returns focus outline styles object for @see makeStyles
|
61
|
+
*/
|
62
|
+
|
63
|
+
var createFocusOutlineStyle = function (theme, options) {
|
64
|
+
var _a;
|
19
65
|
|
20
|
-
|
21
|
-
|
22
|
-
|
66
|
+
if (options === void 0) {
|
67
|
+
options = tslib_1.__assign({
|
68
|
+
style: {}
|
69
|
+
}, defaultOptions);
|
23
70
|
}
|
24
71
|
|
72
|
+
return _a = {
|
73
|
+
':focus-visible': {
|
74
|
+
outline: 'none'
|
75
|
+
}
|
76
|
+
}, _a[symbols_1.KEYBOARD_NAV_SELECTOR + " :" + (options.selector || defaultOptions.selector)] = getFocusOutlineStyles(tslib_1.__assign({
|
77
|
+
outlineColor: theme.colorStrokeFocus2,
|
78
|
+
outlineRadius: theme.borderRadiusMedium,
|
79
|
+
// FIXME: theme.global.strokeWidth.thick causes some weird bugs
|
80
|
+
outlineWidth: '2px'
|
81
|
+
}, options.style)), _a;
|
82
|
+
};
|
83
|
+
|
84
|
+
exports.createFocusOutlineStyle = createFocusOutlineStyle;
|
85
|
+
/**
|
86
|
+
* Creates a style rule for @see makeStyles that includes the necessary selectors for focus.
|
87
|
+
* Should be used only when @see createFocusOutlineStyle does not fit requirements
|
88
|
+
*
|
89
|
+
* @param rule - styling applied on focus, defaults to @see getDefaultFocusOutlineStyes
|
90
|
+
*/
|
91
|
+
|
92
|
+
var createCustomFocusIndicatorStyle = function (rule, options) {
|
25
93
|
if (options === void 0) {
|
26
94
|
options = defaultOptions;
|
27
95
|
}
|
@@ -37,5 +105,5 @@ var createFocusIndicatorStyleRule = function (rule, options) {
|
|
37
105
|
};
|
38
106
|
};
|
39
107
|
|
40
|
-
exports.
|
108
|
+
exports.createCustomFocusIndicatorStyle = createCustomFocusIndicatorStyle;
|
41
109
|
//# sourceMappingURL=useFocusIndicatorStyle.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useFocusIndicatorStyle.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"sources":["../../src/hooks/useFocusIndicatorStyle.ts"],"names":[],"mappings":";;;;;;;;;AAEA,IAAA,SAAA,gBAAA,OAAA,CAAA,YAAA,CAAA;AAcA;;;;;;AAMG;;;AACH,IAAM,qBAAqB,GAAG,UAAC,OAAD,EAAkC;;;AACtD,MAAA,aAAa,GAAgD,OAAO,CAAvD,aAAb;AAAA,MAAe,YAAY,GAAkC,OAAO,CAAzC,YAA3B;AAAA,MAA6B,aAAa,GAAmB,OAAO,CAA1B,aAA1C;AAAA,MAA4C,YAAY,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AAK;;;AAAI,WAAA,EAAA,GAAA;AACxC,wBAAkB;AAChB,QAAA,OAAO,EAAE;AADO;AADsB,KAAA,EAIxC,EAAA,CAAI,SAAA,CAAA,qBAAA,GAAqB,IAArB,IAA0B,OAAO,CAAC,QAAR,IAAoB,cAAc,CAAC,QAA7D,CAAJ,CAAA,GACE,OAAO,IAAP,KAAgB,UAAhB,GAA6B,IAAI,CAAC,KAAD,CAAjC,GAA2C,IALL,EAMxC,EANwC;AAMxC,GAN+B;AAM/B,CATK;;AAAM,OAAA,CAAA,+BAAA,GAA+B,+BAA/B","sourceRoot":""}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-tabster",
|
3
|
-
"version": "9.0.0-alpha.
|
3
|
+
"version": "9.0.0-alpha.73",
|
4
4
|
"description": "Utilities for focus management and facade for tabster",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -34,10 +34,10 @@
|
|
34
34
|
"react-test-renderer": "^16.3.0"
|
35
35
|
},
|
36
36
|
"dependencies": {
|
37
|
-
"@fluentui/make-styles": "9.0.0-alpha.
|
38
|
-
"@fluentui/react-make-styles": "9.0.0-alpha.
|
39
|
-
"@fluentui/react-shared-contexts": "9.0.0-alpha.
|
40
|
-
"@fluentui/react-utilities": "9.0.0-alpha.
|
37
|
+
"@fluentui/make-styles": "9.0.0-alpha.35",
|
38
|
+
"@fluentui/react-make-styles": "9.0.0-alpha.78",
|
39
|
+
"@fluentui/react-shared-contexts": "9.0.0-alpha.28",
|
40
|
+
"@fluentui/react-utilities": "9.0.0-alpha.56",
|
41
41
|
"keyborg": "^1.0.0",
|
42
42
|
"tabster": "^1.0.0",
|
43
43
|
"tslib": "^2.1.0"
|