@fluentui/react-tabster 9.0.0-rc.5 → 9.0.0-rc.8
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 +142 -1
- package/CHANGELOG.md +118 -82
- package/README.md +5 -14
- package/dist/{react-tabster.d.ts → index.d.ts} +14 -8
- package/lib/{symbols.d.ts → focus/constants.d.ts} +4 -0
- package/lib/{symbols.js → focus/constants.js} +5 -1
- package/lib/focus/constants.js.map +1 -0
- package/lib/focus/createCustomFocusIndicatorStyle.d.ts +12 -0
- package/lib/focus/createCustomFocusIndicatorStyle.js +18 -0
- package/lib/focus/createCustomFocusIndicatorStyle.js.map +1 -0
- package/{lib-commonjs/hooks/useFocusIndicatorStyle.d.ts → lib/focus/createFocusOutlineStyle.d.ts} +4 -13
- package/lib/{hooks/useFocusIndicatorStyle.js → focus/createFocusOutlineStyle.js} +20 -40
- package/lib/focus/createFocusOutlineStyle.js.map +1 -0
- package/lib/focus/index.d.ts +2 -0
- package/lib/focus/index.js +3 -0
- package/lib/focus/index.js.map +1 -0
- package/lib/hooks/index.d.ts +2 -3
- package/lib/hooks/index.js +2 -3
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useArrowNavigationGroup.d.ts +6 -2
- package/lib/hooks/useArrowNavigationGroup.js +5 -1
- package/lib/hooks/useArrowNavigationGroup.js.map +1 -1
- package/lib/hooks/useFocusableGroup.js.map +1 -1
- package/lib/hooks/useKeyboardNavAttribute.js +1 -1
- package/lib/hooks/useKeyboardNavAttribute.js.map +1 -1
- package/lib/index.d.ts +4 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/{symbols.d.ts → focus/constants.d.ts} +4 -0
- package/lib-commonjs/{symbols.js → focus/constants.js} +6 -2
- package/lib-commonjs/focus/constants.js.map +1 -0
- package/lib-commonjs/focus/createCustomFocusIndicatorStyle.d.ts +12 -0
- package/lib-commonjs/focus/createCustomFocusIndicatorStyle.js +28 -0
- package/lib-commonjs/focus/createCustomFocusIndicatorStyle.js.map +1 -0
- package/{lib/hooks/useFocusIndicatorStyle.d.ts → lib-commonjs/focus/createFocusOutlineStyle.d.ts} +4 -13
- package/lib-commonjs/{hooks/useFocusIndicatorStyle.js → focus/createFocusOutlineStyle.js} +24 -44
- package/lib-commonjs/focus/createFocusOutlineStyle.js.map +1 -0
- package/lib-commonjs/focus/index.d.ts +2 -0
- package/lib-commonjs/focus/index.js +12 -0
- package/lib-commonjs/focus/index.js.map +1 -0
- package/lib-commonjs/hooks/index.d.ts +2 -3
- package/lib-commonjs/hooks/index.js +4 -6
- package/lib-commonjs/hooks/index.js.map +1 -1
- package/lib-commonjs/hooks/useArrowNavigationGroup.d.ts +6 -2
- package/lib-commonjs/hooks/useArrowNavigationGroup.js +5 -1
- package/lib-commonjs/hooks/useArrowNavigationGroup.js.map +1 -1
- package/lib-commonjs/hooks/useFocusableGroup.js.map +1 -1
- package/lib-commonjs/hooks/useKeyboardNavAttribute.js +3 -3
- package/lib-commonjs/hooks/useKeyboardNavAttribute.js.map +1 -1
- package/lib-commonjs/index.d.ts +4 -1
- package/lib-commonjs/index.js +53 -2
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +10 -15
- package/lib/hooks/useFocusIndicatorStyle.js.map +0 -1
- package/lib/symbols.js.map +0 -1
- package/lib-commonjs/hooks/useFocusIndicatorStyle.js.map +0 -1
- package/lib-commonjs/symbols.js.map +0 -1
@@ -3,11 +3,15 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.createFocusOutlineStyle = void 0;
|
7
7
|
|
8
8
|
const react_theme_1 = /*#__PURE__*/require("@fluentui/react-theme");
|
9
9
|
|
10
|
-
const
|
10
|
+
const react_1 = /*#__PURE__*/require("@griffel/react");
|
11
|
+
|
12
|
+
const createCustomFocusIndicatorStyle_1 = /*#__PURE__*/require("./createCustomFocusIndicatorStyle");
|
13
|
+
|
14
|
+
const constants_1 = /*#__PURE__*/require("./constants");
|
11
15
|
/**
|
12
16
|
* NOTE: the element with the focus outline needs to have `position: relative` so that the
|
13
17
|
* pseudo element can be properly positioned.
|
@@ -30,18 +34,16 @@ const getFocusOutlineStyles = options => {
|
|
30
34
|
const outlineOffsetBottom = ((_b = outlineOffset) === null || _b === void 0 ? void 0 : _b.bottom) || outlineOffset;
|
31
35
|
const outlineOffsetLeft = ((_c = outlineOffset) === null || _c === void 0 ? void 0 : _c.left) || outlineOffset;
|
32
36
|
const outlineOffsetRight = ((_d = outlineOffset) === null || _d === void 0 ? void 0 : _d.right) || outlineOffset;
|
33
|
-
return {
|
34
|
-
borderColor: 'transparent',
|
37
|
+
return { ...react_1.shorthands.borderColor('transparent'),
|
35
38
|
':after': {
|
36
39
|
content: '""',
|
37
40
|
position: 'absolute',
|
38
41
|
pointerEvents: 'none',
|
39
|
-
boxSizing: 'outline-box',
|
40
42
|
zIndex: 1,
|
41
|
-
borderStyle
|
42
|
-
borderWidth
|
43
|
-
borderRadius
|
44
|
-
borderColor
|
43
|
+
...react_1.shorthands.borderStyle('solid'),
|
44
|
+
...react_1.shorthands.borderWidth(outlineWidth),
|
45
|
+
...react_1.shorthands.borderRadius(outlineRadius),
|
46
|
+
...react_1.shorthands.borderColor(outlineColor),
|
45
47
|
top: !outlineOffset ? `-${outlineWidth}` : `calc(0px - ${outlineWidth} - ${outlineOffsetTop})`,
|
46
48
|
bottom: !outlineOffset ? `-${outlineWidth}` : `calc(0px - ${outlineWidth} - ${outlineOffsetBottom})`,
|
47
49
|
left: !outlineOffset ? `-${outlineWidth}` : `calc(0px - ${outlineWidth} - ${outlineOffsetLeft})`,
|
@@ -49,49 +51,27 @@ const getFocusOutlineStyles = options => {
|
|
49
51
|
}
|
50
52
|
};
|
51
53
|
};
|
52
|
-
|
53
|
-
const defaultOptions = {
|
54
|
-
selector: 'focus'
|
55
|
-
};
|
56
54
|
/**
|
57
55
|
* NOTE: The element with the focus outline needs to have `position: relative` so that the
|
58
56
|
* pseudo element can be properly positioned.
|
59
57
|
*
|
60
|
-
* @param theme - Theme used in @see makeStyles
|
61
58
|
* @param options - Configure the style of the focus outline
|
62
59
|
* @returns focus outline styles object for @see makeStyles
|
63
60
|
*/
|
64
61
|
|
65
|
-
const createFocusOutlineStyle = (options = {
|
66
|
-
style: {},
|
67
|
-
...defaultOptions
|
68
|
-
}) => ({
|
69
|
-
':focus-visible': {
|
70
|
-
outlineStyle: 'none'
|
71
|
-
},
|
72
|
-
[`${symbols_1.KEYBOARD_NAV_SELECTOR} :${options.selector || defaultOptions.selector}`]: getFocusOutlineStyles({
|
73
|
-
outlineColor: react_theme_1.tokens.colorStrokeFocus2,
|
74
|
-
outlineRadius: react_theme_1.tokens.borderRadiusMedium,
|
75
|
-
// FIXME: tokens.strokeWidthThick causes some weird bugs
|
76
|
-
outlineWidth: '2px',
|
77
|
-
...options.style
|
78
|
-
})
|
79
|
-
});
|
80
62
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
},
|
93
|
-
[`${symbols_1.KEYBOARD_NAV_SELECTOR} :${options.selector || defaultOptions.selector}`]: style
|
63
|
+
const createFocusOutlineStyle = ({
|
64
|
+
selector = constants_1.defaultOptions.selector,
|
65
|
+
style = constants_1.defaultOptions.style
|
66
|
+
} = constants_1.defaultOptions) => createCustomFocusIndicatorStyle_1.createCustomFocusIndicatorStyle(getFocusOutlineStyles({
|
67
|
+
outlineColor: react_theme_1.tokens.colorStrokeFocus2,
|
68
|
+
outlineRadius: react_theme_1.tokens.borderRadiusMedium,
|
69
|
+
// FIXME: tokens.strokeWidthThick causes some weird bugs
|
70
|
+
outlineWidth: '2px',
|
71
|
+
...style
|
72
|
+
}), {
|
73
|
+
selector
|
94
74
|
});
|
95
75
|
|
96
|
-
exports.
|
97
|
-
//# sourceMappingURL=
|
76
|
+
exports.createFocusOutlineStyle = createFocusOutlineStyle;
|
77
|
+
//# sourceMappingURL=createFocusOutlineStyle.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["focus/createFocusOutlineStyle.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AAEA,MAAA,iCAAA,gBAAA,OAAA,CAAA,mCAAA,CAAA;;AAIA,MAAA,WAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;AAiBA;;;;;;AAMG;;;AACH,MAAM,qBAAqB,GAAI,OAAD,IAAoD;;;AAChF,QAAM;AAAE,IAAA,aAAF;AAAiB,IAAA,YAAjB;AAA+B,IAAA,aAA/B;AAA8C,IAAA;AAA9C,MAA+D,OAArE;AAEA,QAAM,gBAAgB,GAAG,CAAA,CAAA,EAAA,GAAC,aAAD,MAAqC,IAArC,IAAqC,EAAA,KAAA,KAAA,CAArC,GAAqC,KAAA,CAArC,GAAqC,EAAA,CAAE,GAAvC,KAA8C,aAAvE;AACA,QAAM,mBAAmB,GAAG,CAAA,CAAA,EAAA,GAAC,aAAD,MAAqC,IAArC,IAAqC,EAAA,KAAA,KAAA,CAArC,GAAqC,KAAA,CAArC,GAAqC,EAAA,CAAE,MAAvC,KAAiD,aAA7E;AACA,QAAM,iBAAiB,GAAG,CAAA,CAAA,EAAA,GAAC,aAAD,MAAqC,IAArC,IAAqC,EAAA,KAAA,KAAA,CAArC,GAAqC,KAAA,CAArC,GAAqC,EAAA,CAAE,IAAvC,KAA+C,aAAzE;AACA,QAAM,kBAAkB,GAAG,CAAA,CAAA,EAAA,GAAC,aAAD,MAAqC,IAArC,IAAqC,EAAA,KAAA,KAAA,CAArC,GAAqC,KAAA,CAArC,GAAqC,EAAA,CAAE,KAAvC,KAAgD,aAA3E;AAEA,SAAO,EACL,GAAG,OAAA,CAAA,UAAA,CAAW,W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G;AALiB,CAAD,CADvB,EAQE;AAAE,EAAA;AAAF,CARF,CAJK;;AAAM,OAAA,CAAA,uBAAA,GAAuB,uBAAvB","sourcesContent":["import { tokens } from '@fluentui/react-theme';\nimport { shorthands } from '@griffel/react';\nimport type { GriffelStyle } from '@griffel/react';\nimport {\n createCustomFocusIndicatorStyle,\n CreateCustomFocusIndicatorStyleOptions,\n} from './createCustomFocusIndicatorStyle';\nimport { defaultOptions } from './constants';\n\nexport type FocusOutlineOffset = Record<'top' | 'bottom' | 'left' | 'right', string>;\nexport type FocusOutlineStyleOptions = {\n /**\n * Only property not supported by the native CSS `outline`, if this is no longer needed\n * we can just go native instead\n */\n outlineRadius: string;\n outlineColor: string;\n outlineWidth: string;\n outlineOffset?: string | FocusOutlineOffset;\n};\nexport interface CreateFocusOutlineStyleOptions extends CreateCustomFocusIndicatorStyleOptions {\n style?: Partial<FocusOutlineStyleOptions>;\n}\n\n/**\n * NOTE: the element with the focus outline needs to have `position: relative` so that the\n * pseudo element can be properly positioned.\n *\n * @param options - Configures the style of the focus outline\n * @returns focus outline styles object\n */\nconst getFocusOutlineStyles = (options: FocusOutlineStyleOptions): GriffelStyle => {\n const { outlineRadius, outlineColor, outlineOffset, outlineWidth } = options;\n\n const outlineOffsetTop = (outlineOffset as FocusOutlineOffset)?.top || outlineOffset;\n const outlineOffsetBottom = (outlineOffset as FocusOutlineOffset)?.bottom || outlineOffset;\n const outlineOffsetLeft = (outlineOffset as FocusOutlineOffset)?.left || outlineOffset;\n const outlineOffsetRight = (outlineOffset as FocusOutlineOffset)?.right || outlineOffset;\n\n return {\n ...shorthands.borderColor('transparent'),\n ':after': {\n content: '\"\"',\n position: 'absolute',\n pointerEvents: 'none',\n zIndex: 1,\n\n ...shorthands.borderStyle('solid'),\n ...shorthands.borderWidth(outlineWidth),\n ...shorthands.borderRadius(outlineRadius),\n ...shorthands.borderColor(outlineColor),\n\n top: !outlineOffset ? `-${outlineWidth}` : `calc(0px - ${outlineWidth} - ${outlineOffsetTop})`,\n bottom: !outlineOffset ? `-${outlineWidth}` : `calc(0px - ${outlineWidth} - ${outlineOffsetBottom})`,\n left: !outlineOffset ? `-${outlineWidth}` : `calc(0px - ${outlineWidth} - ${outlineOffsetLeft})`,\n right: !outlineOffset ? `-${outlineWidth}` : `calc(0px - ${outlineWidth} - ${outlineOffsetRight})`,\n },\n };\n};\n\n/**\n * NOTE: The element with the focus outline needs to have `position: relative` so that the\n * pseudo element can be properly positioned.\n *\n * @param options - Configure the style of the focus outline\n * @returns focus outline styles object for @see makeStyles\n */\nexport const createFocusOutlineStyle = ({\n selector = defaultOptions.selector,\n style = defaultOptions.style,\n}: CreateFocusOutlineStyleOptions = defaultOptions): GriffelStyle =>\n createCustomFocusIndicatorStyle(\n getFocusOutlineStyles({\n outlineColor: tokens.colorStrokeFocus2,\n outlineRadius: tokens.borderRadiusMedium,\n // FIXME: tokens.strokeWidthThick causes some weird bugs\n outlineWidth: '2px',\n ...style,\n }),\n { selector },\n );\n"],"sourceRoot":"../src/"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
|
7
|
+
const tslib_1 = /*#__PURE__*/require("tslib");
|
8
|
+
|
9
|
+
tslib_1.__exportStar(require("./createCustomFocusIndicatorStyle"), exports);
|
10
|
+
|
11
|
+
tslib_1.__exportStar(require("./createFocusOutlineStyle"), exports);
|
12
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["focus/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,mCAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,2BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './createCustomFocusIndicatorStyle';\nexport * from './createFocusOutlineStyle';\n"],"sourceRoot":"../src/"}
|
@@ -1,7 +1,6 @@
|
|
1
1
|
export * from './useArrowNavigationGroup';
|
2
|
+
export * from './useFocusableGroup';
|
2
3
|
export * from './useFocusFinders';
|
4
|
+
export * from './useKeyboardNavAttribute';
|
3
5
|
export * from './useModalAttributes';
|
4
6
|
export * from './useTabsterAttributes';
|
5
|
-
export * from './useFocusIndicatorStyle';
|
6
|
-
export * from './useKeyboardNavAttribute';
|
7
|
-
export * from './useFocusableGroup';
|
@@ -8,15 +8,13 @@ const tslib_1 = /*#__PURE__*/require("tslib");
|
|
8
8
|
|
9
9
|
tslib_1.__exportStar(require("./useArrowNavigationGroup"), exports);
|
10
10
|
|
11
|
+
tslib_1.__exportStar(require("./useFocusableGroup"), exports);
|
12
|
+
|
11
13
|
tslib_1.__exportStar(require("./useFocusFinders"), exports);
|
12
14
|
|
15
|
+
tslib_1.__exportStar(require("./useKeyboardNavAttribute"), exports);
|
16
|
+
|
13
17
|
tslib_1.__exportStar(require("./useModalAttributes"), exports);
|
14
18
|
|
15
19
|
tslib_1.__exportStar(require("./useTabsterAttributes"), exports);
|
16
|
-
|
17
|
-
tslib_1.__exportStar(require("./useFocusIndicatorStyle"), exports);
|
18
|
-
|
19
|
-
tslib_1.__exportStar(require("./useKeyboardNavAttribute"), exports);
|
20
|
-
|
21
|
-
tslib_1.__exportStar(require("./useFocusableGroup"), exports);
|
22
20
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["hooks/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,2BAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,
|
1
|
+
{"version":3,"sources":["hooks/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,2BAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,qBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,mBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,2BAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,sBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './useArrowNavigationGroup';\nexport * from './useFocusableGroup';\nexport * from './useFocusFinders';\nexport * from './useKeyboardNavAttribute';\nexport * from './useModalAttributes';\nexport * from './useTabsterAttributes';\n"],"sourceRoot":"../src/"}
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { Types } from 'tabster';
|
2
2
|
export interface UseArrowNavigationGroupOptions {
|
3
3
|
/**
|
4
|
-
* Focus will navigate vertically or
|
4
|
+
* Focus will navigate vertically, horizontally or in both directions (grid), defaults to horizontally
|
5
5
|
* @defaultValue vertical
|
6
6
|
*/
|
7
|
-
axis?: 'vertical' | 'horizontal';
|
7
|
+
axis?: 'vertical' | 'horizontal' | 'grid';
|
8
8
|
/**
|
9
9
|
* Focus will cycle to the first/last elements of the group without stopping
|
10
10
|
*/
|
@@ -14,6 +14,10 @@ export interface UseArrowNavigationGroupOptions {
|
|
14
14
|
* available) when tabbing from outside of the group
|
15
15
|
*/
|
16
16
|
memorizeCurrent?: boolean;
|
17
|
+
/**
|
18
|
+
* Allow tabbing within the arrow navigation group items.
|
19
|
+
*/
|
20
|
+
tabbable?: boolean;
|
17
21
|
}
|
18
22
|
/**
|
19
23
|
* A hook that returns the necessary tabster attributes to support arrow key navigation
|
@@ -29,7 +29,8 @@ const useArrowNavigationGroup = options => {
|
|
29
29
|
mover: {
|
30
30
|
cyclic: !!(options === null || options === void 0 ? void 0 : options.circular),
|
31
31
|
direction: axisToMoverDirection((_a = options === null || options === void 0 ? void 0 : options.axis) !== null && _a !== void 0 ? _a : 'vertical'),
|
32
|
-
memorizeCurrent: options === null || options === void 0 ? void 0 : options.memorizeCurrent
|
32
|
+
memorizeCurrent: options === null || options === void 0 ? void 0 : options.memorizeCurrent,
|
33
|
+
tabbable: options === null || options === void 0 ? void 0 : options.tabbable
|
33
34
|
}
|
34
35
|
});
|
35
36
|
};
|
@@ -41,6 +42,9 @@ function axisToMoverDirection(axis) {
|
|
41
42
|
case 'horizontal':
|
42
43
|
return tabster_1.Types.MoverDirections.Horizontal;
|
43
44
|
|
45
|
+
case 'grid':
|
46
|
+
return tabster_1.Types.MoverDirections.Grid;
|
47
|
+
|
44
48
|
case 'vertical':
|
45
49
|
default:
|
46
50
|
return tabster_1.Types.MoverDirections.Vertical;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["hooks/useArrowNavigationGroup.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,SAAA,gBAAA,OAAA,CAAA,SAAA,CAAA;;AACA,MAAA,sBAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;;AACA,MAAA,YAAA,gBAAA,OAAA,CAAA,cAAA,CAAA;
|
1
|
+
{"version":3,"sources":["hooks/useArrowNavigationGroup.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,SAAA,gBAAA,OAAA,CAAA,SAAA,CAAA;;AACA,MAAA,sBAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;;AACA,MAAA,YAAA,gBAAA,OAAA,CAAA,cAAA,CAAA;AAuBA;;;AAGG;;;AACI,MAAM,uBAAuB,GAAI,OAAD,IAAwE;;;AAC7G,QAAM,OAAO,GAAG,YAAA,CAAA,UAAA,EAAhB;;AAEA,MAAI,OAAJ,EAAa;AACX,IAAA,SAAA,CAAA,QAAA,CAAS,OAAT;AACD;;AAED,SAAO,sBAAA,CAAA,oBAAA,CAAqB;AAC1B,IAAA,KAAK,EAAE;AACL,MAAA,MAAM,EAAE,CAAC,EAAC,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,QAAV,CADJ;AAEL,MAAA,SAAS,EAAE,oBAAoB,CAAC,CAAA,EAAA,GAAA,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,IAAT,MAAa,IAAb,IAAa,EAAA,KAAA,KAAA,CAAb,GAAa,EAAb,GAAiB,UAAlB,CAF1B;AAGL,MAAA,eAAe,EAAE,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,eAHrB;AAIL,MAAA,QAAQ,EAAE,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE;AAJd;AADmB,GAArB,CAAP;AAQD,CAfM;;AAAM,OAAA,CAAA,uBAAA,GAAuB,uBAAvB;;AAiBb,SAAS,oBAAT,CAA8B,IAA9B,EAA0E;AACxE,UAAQ,IAAR;AACE,SAAK,YAAL;AACE,aAAO,SAAA,CAAA,KAAA,CAAM,eAAN,CAAsB,UAA7B;;AACF,SAAK,MAAL;AACE,aAAO,SAAA,CAAA,KAAA,CAAM,eAAN,CAAsB,IAA7B;;AAEF,SAAK,UAAL;AACA;AACE,aAAO,SAAA,CAAA,KAAA,CAAM,eAAN,CAAsB,QAA7B;AARJ;AAUD","sourcesContent":["import { Types, getMover } from 'tabster';\nimport { useTabsterAttributes } from './useTabsterAttributes';\nimport { useTabster } from './useTabster';\n\nexport interface UseArrowNavigationGroupOptions {\n /**\n * Focus will navigate vertically, horizontally or in both directions (grid), defaults to horizontally\n * @defaultValue vertical\n */\n axis?: 'vertical' | 'horizontal' | 'grid';\n /**\n * Focus will cycle to the first/last elements of the group without stopping\n */\n circular?: boolean;\n /**\n * Last focused element in the group will be remembered and focused (if still\n * available) when tabbing from outside of the group\n */\n memorizeCurrent?: boolean;\n /**\n * Allow tabbing within the arrow navigation group items.\n */\n tabbable?: boolean;\n}\n\n/**\n * A hook that returns the necessary tabster attributes to support arrow key navigation\n * @param options - Options to configure keyboard navigation\n */\nexport const useArrowNavigationGroup = (options?: UseArrowNavigationGroupOptions): Types.TabsterDOMAttribute => {\n const tabster = useTabster();\n\n if (tabster) {\n getMover(tabster);\n }\n\n return useTabsterAttributes({\n mover: {\n cyclic: !!options?.circular,\n direction: axisToMoverDirection(options?.axis ?? 'vertical'),\n memorizeCurrent: options?.memorizeCurrent,\n tabbable: options?.tabbable,\n },\n });\n};\n\nfunction axisToMoverDirection(axis: UseArrowNavigationGroupOptions['axis']): Types.MoverDirection {\n switch (axis) {\n case 'horizontal':\n return Types.MoverDirections.Horizontal;\n case 'grid':\n return Types.MoverDirections.Grid;\n\n case 'vertical':\n default:\n return Types.MoverDirections.Vertical;\n }\n}\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["hooks/useFocusableGroup.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,SAAA,gBAAA,OAAA,CAAA,SAAA,CAAA;;AACA,MAAA,sBAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;;AACA,MAAA,YAAA,gBAAA,OAAA,CAAA,cAAA,CAAA;AASA;;;AAGG;;;AACI,MAAM,iBAAiB,GAAI,OAAD,
|
1
|
+
{"version":3,"sources":["hooks/useFocusableGroup.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,SAAA,gBAAA,OAAA,CAAA,SAAA,CAAA;;AACA,MAAA,sBAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;;AACA,MAAA,YAAA,gBAAA,OAAA,CAAA,cAAA,CAAA;AASA;;;AAGG;;;AACI,MAAM,iBAAiB,GAAI,OAAD,IAAkE;AACjG,QAAM,OAAO,GAAG,YAAA,CAAA,UAAA,EAAhB;;AAEA,MAAI,OAAJ,EAAa;AACX,IAAA,SAAA,CAAA,WAAA,CAAY,OAAZ;AACD;;AAED,SAAO,sBAAA,CAAA,oBAAA,CAAqB;AAC1B,IAAA,QAAQ,EAAE;AACR,MAAA,WAAW,EAAE,cAAc,CAAC,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,WAAV;AADnB;AADgB,GAArB,CAAP;AAKD,CAZM;;AAAM,OAAA,CAAA,iBAAA,GAAiB,iBAAjB;;AAcb,MAAM,cAAc,GAClB,WADqB,IAEoB;AACzC,UAAQ,WAAR;AACE,SAAK,WAAL;AACE,aAAO,SAAA,CAAA,KAAA,CAAM,qBAAN,CAA4B,SAAnC;;AACF,SAAK,SAAL;AACE,aAAO,SAAA,CAAA,KAAA,CAAM,qBAAN,CAA4B,OAAnC;;AACF,SAAK,kBAAL;AACE,aAAO,SAAA,CAAA,KAAA,CAAM,qBAAN,CAA4B,gBAAnC;;AACF;AACE,aAAO,SAAP;AARJ;AAUD,CAbD","sourcesContent":["import { Types, getGroupper } from 'tabster';\nimport { useTabsterAttributes } from './useTabsterAttributes';\nimport { useTabster } from './useTabster';\n\nexport interface UseFocusableGroupOptions {\n /**\n * Behavior for the Tab key.\n */\n tabBehavior?: 'unlimited' | 'limited' | 'limitedTrapFocus';\n}\n\n/**\n * A hook that returns the necessary tabster attributes to support groupping.\n * @param options - Options to configure keyboard navigation\n */\nexport const useFocusableGroup = (options?: UseFocusableGroupOptions): Types.TabsterDOMAttribute => {\n const tabster = useTabster();\n\n if (tabster) {\n getGroupper(tabster);\n }\n\n return useTabsterAttributes({\n groupper: {\n tabbability: getTabbability(options?.tabBehavior),\n },\n });\n};\n\nconst getTabbability = (\n tabBehavior?: UseFocusableGroupOptions['tabBehavior'],\n): Types.GroupperTabbability | undefined => {\n switch (tabBehavior) {\n case 'unlimited':\n return Types.GroupperTabbabilities.Unlimited;\n case 'limited':\n return Types.GroupperTabbabilities.Limited;\n case 'limitedTrapFocus':\n return Types.GroupperTabbabilities.LimitedTrapFocus;\n default:\n return undefined;\n }\n};\n"],"sourceRoot":"../src/"}
|
@@ -9,7 +9,7 @@ const keyborg_1 = /*#__PURE__*/require("keyborg");
|
|
9
9
|
|
10
10
|
const react_1 = /*#__PURE__*/require("react");
|
11
11
|
|
12
|
-
const
|
12
|
+
const constants_1 = /*#__PURE__*/require("../focus/constants");
|
13
13
|
|
14
14
|
const react_shared_contexts_1 = /*#__PURE__*/require("@fluentui/react-shared-contexts");
|
15
15
|
/**
|
@@ -25,10 +25,10 @@ function useKeyboardNavAttribute() {
|
|
25
25
|
const ref = react_1.useRef(null);
|
26
26
|
react_1.useEffect(() => {
|
27
27
|
if (keyborg) {
|
28
|
-
setBooleanAttribute(ref,
|
28
|
+
setBooleanAttribute(ref, constants_1.KEYBOARD_NAV_ATTRIBUTE, keyborg.isNavigatingWithKeyboard());
|
29
29
|
|
30
30
|
const cb = next => {
|
31
|
-
setBooleanAttribute(ref,
|
31
|
+
setBooleanAttribute(ref, constants_1.KEYBOARD_NAV_ATTRIBUTE, next);
|
32
32
|
};
|
33
33
|
|
34
34
|
keyborg.subscribe(cb);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["hooks/useKeyboardNavAttribute.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,SAAA,gBAAA,OAAA,CAAA,SAAA,CAAA;;AACA,MAAA,OAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,
|
1
|
+
{"version":3,"sources":["hooks/useKeyboardNavAttribute.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,SAAA,gBAAA,OAAA,CAAA,SAAA,CAAA;;AACA,MAAA,OAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,WAAA,gBAAA,OAAA,CAAA,oBAAA,CAAA;;AACA,MAAA,uBAAA,gBAAA,OAAA,CAAA,iCAAA,CAAA;AAIA;;AAEG;;;AACH,SAAgB,uBAAhB,GAAuC;AACrC,QAAM;AAAE,IAAA;AAAF,MAAqB,uBAAA,CAAA,SAAA,EAA3B;AACA,QAAM,OAAO,GAAG,OAAA,CAAA,OAAA,CAAQ,MAAM,cAAc,IAAI,SAAA,CAAA,aAAA,CAAc,cAAc,CAAC,WAA7B,CAAhC,EAA4E,CAAC,cAAD,CAA5E,CAAhB;AACA,QAAM,GAAG,GAAG,OAAA,CAAA,MAAA,CAAU,IAAV,CAAZ;AACA,EAAA,OAAA,CAAA,SAAA,CAAU,MAAK;AACb,QAAI,OAAJ,EAAa;AACX,MAAA,mBAAmB,CAAC,GAAD,EAAM,WAAA,CAAA,sBAAN,EAA8B,OAAO,CAAC,wBAAR,EAA9B,CAAnB;;AACA,YAAM,EAAE,GAAoB,IAAI,IAAG;AACjC,QAAA,mBAAmB,CAAC,GAAD,EAAM,WAAA,CAAA,sBAAN,EAA8B,IAA9B,CAAnB;AACD,OAFD;;AAGA,MAAA,OAAO,CAAC,SAAR,CAAkB,EAAlB;AACA,aAAO,MAAM,OAAO,CAAC,WAAR,CAAoB,EAApB,CAAb;AACD;AACF,GATD,EASG,CAAC,OAAD,CATH;AAUA,SAAO,GAAP;AACD;;AAfD,OAAA,CAAA,uBAAA,GAAA,uBAAA;;AAiBA,SAAS,mBAAT,CAA6B,UAA7B,EAAiE,SAAjE,EAAoF,KAApF,EAAkG;AAChG,MAAI,CAAC,UAAU,CAAC,OAAhB,EAAyB;AACvB;AACD;;AACD,MAAI,KAAJ,EAAW;AACT,IAAA,UAAU,CAAC,OAAX,CAAmB,YAAnB,CAAgC,SAAhC,EAA2C,EAA3C;AACD,GAFD,MAEO;AACL,IAAA,UAAU,CAAC,OAAX,CAAmB,eAAnB,CAAmC,SAAnC;AACD;AACF","sourcesContent":["import { createKeyborg } from 'keyborg';\nimport { useEffect, useMemo, useRef } from 'react';\nimport { KEYBOARD_NAV_ATTRIBUTE } from '../focus/constants';\nimport { useFluent } from '@fluentui/react-shared-contexts';\nimport type { KeyborgCallback } from 'keyborg/dist/Keyborg';\nimport type { RefObject } from 'react';\n\n/**\n * instantiates keyborg and add attribute to ensure focus indicator synced to keyborg logic\n */\nexport function useKeyboardNavAttribute<E extends HTMLElement>() {\n const { targetDocument } = useFluent();\n const keyborg = useMemo(() => targetDocument && createKeyborg(targetDocument.defaultView!), [targetDocument]);\n const ref = useRef<E>(null);\n useEffect(() => {\n if (keyborg) {\n setBooleanAttribute(ref, KEYBOARD_NAV_ATTRIBUTE, keyborg.isNavigatingWithKeyboard());\n const cb: KeyborgCallback = next => {\n setBooleanAttribute(ref, KEYBOARD_NAV_ATTRIBUTE, next);\n };\n keyborg.subscribe(cb);\n return () => keyborg.unsubscribe(cb);\n }\n }, [keyborg]);\n return ref;\n}\n\nfunction setBooleanAttribute(elementRef: RefObject<HTMLElement>, attribute: string, value: boolean) {\n if (!elementRef.current) {\n return;\n }\n if (value) {\n elementRef.current.setAttribute(attribute, '');\n } else {\n elementRef.current.removeAttribute(attribute);\n }\n}\n"],"sourceRoot":"../src/"}
|
package/lib-commonjs/index.d.ts
CHANGED
@@ -1 +1,4 @@
|
|
1
|
-
export
|
1
|
+
export { useArrowNavigationGroup, useFocusableGroup, useFocusFinders, useKeyboardNavAttribute, useModalAttributes, useTabsterAttributes, } from './hooks/index';
|
2
|
+
export type { UseArrowNavigationGroupOptions, UseFocusableGroupOptions, UseModalAttributesOptions, } from './hooks/index';
|
3
|
+
export { createCustomFocusIndicatorStyle, createFocusOutlineStyle } from './focus/index';
|
4
|
+
export type { CreateCustomFocusIndicatorStyleOptions, CreateFocusOutlineStyleOptions, FocusOutlineOffset, FocusOutlineStyleOptions, } from './focus/index';
|
package/lib-commonjs/index.js
CHANGED
@@ -3,8 +3,59 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
+
exports.createFocusOutlineStyle = exports.createCustomFocusIndicatorStyle = exports.useTabsterAttributes = exports.useModalAttributes = exports.useKeyboardNavAttribute = exports.useFocusFinders = exports.useFocusableGroup = exports.useArrowNavigationGroup = void 0;
|
6
7
|
|
7
|
-
|
8
|
+
var index_1 = /*#__PURE__*/require("./hooks/index");
|
8
9
|
|
9
|
-
|
10
|
+
Object.defineProperty(exports, "useArrowNavigationGroup", {
|
11
|
+
enumerable: true,
|
12
|
+
get: function () {
|
13
|
+
return index_1.useArrowNavigationGroup;
|
14
|
+
}
|
15
|
+
});
|
16
|
+
Object.defineProperty(exports, "useFocusableGroup", {
|
17
|
+
enumerable: true,
|
18
|
+
get: function () {
|
19
|
+
return index_1.useFocusableGroup;
|
20
|
+
}
|
21
|
+
});
|
22
|
+
Object.defineProperty(exports, "useFocusFinders", {
|
23
|
+
enumerable: true,
|
24
|
+
get: function () {
|
25
|
+
return index_1.useFocusFinders;
|
26
|
+
}
|
27
|
+
});
|
28
|
+
Object.defineProperty(exports, "useKeyboardNavAttribute", {
|
29
|
+
enumerable: true,
|
30
|
+
get: function () {
|
31
|
+
return index_1.useKeyboardNavAttribute;
|
32
|
+
}
|
33
|
+
});
|
34
|
+
Object.defineProperty(exports, "useModalAttributes", {
|
35
|
+
enumerable: true,
|
36
|
+
get: function () {
|
37
|
+
return index_1.useModalAttributes;
|
38
|
+
}
|
39
|
+
});
|
40
|
+
Object.defineProperty(exports, "useTabsterAttributes", {
|
41
|
+
enumerable: true,
|
42
|
+
get: function () {
|
43
|
+
return index_1.useTabsterAttributes;
|
44
|
+
}
|
45
|
+
});
|
46
|
+
|
47
|
+
var index_2 = /*#__PURE__*/require("./focus/index");
|
48
|
+
|
49
|
+
Object.defineProperty(exports, "createCustomFocusIndicatorStyle", {
|
50
|
+
enumerable: true,
|
51
|
+
get: function () {
|
52
|
+
return index_2.createCustomFocusIndicatorStyle;
|
53
|
+
}
|
54
|
+
});
|
55
|
+
Object.defineProperty(exports, "createFocusOutlineStyle", {
|
56
|
+
enumerable: true,
|
57
|
+
get: function () {
|
58
|
+
return index_2.createFocusOutlineStyle;
|
59
|
+
}
|
60
|
+
});
|
10
61
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.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AA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,OAAA,CAAA,+BAAA;AAA+B;AAA/B,CAAA;AAAiC,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,yBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,OAAA,CAAA,uBAAA;AAAuB;AAAvB,CAAA","sourcesContent":["export {\n useArrowNavigationGroup,\n useFocusableGroup,\n useFocusFinders,\n useKeyboardNavAttribute,\n useModalAttributes,\n useTabsterAttributes,\n} from './hooks/index';\nexport type {\n UseArrowNavigationGroupOptions,\n UseFocusableGroupOptions,\n UseModalAttributesOptions,\n} from './hooks/index';\n\nexport { createCustomFocusIndicatorStyle, createFocusOutlineStyle } from './focus/index';\n\nexport type {\n CreateCustomFocusIndicatorStyleOptions,\n CreateFocusOutlineStyleOptions,\n FocusOutlineOffset,\n FocusOutlineStyleOptions,\n} from './focus/index';\n"],"sourceRoot":"../src/"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-tabster",
|
3
|
-
"version": "9.0.0-rc.
|
3
|
+
"version": "9.0.0-rc.8",
|
4
4
|
"description": "Utilities for focus management and facade for tabster",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -15,32 +15,27 @@
|
|
15
15
|
"build": "just-scripts build",
|
16
16
|
"clean": "just-scripts clean",
|
17
17
|
"code-style": "just-scripts code-style",
|
18
|
+
"e2e": "e2e",
|
18
19
|
"just": "just-scripts",
|
19
20
|
"lint": "just-scripts lint",
|
20
|
-
"storybook": "node
|
21
|
+
"storybook": "node ../../../scripts/storybook/runner",
|
21
22
|
"test": "jest --passWithNoTests",
|
22
23
|
"docs": "api-extractor run --config=config/api-extractor.local.json --local",
|
23
|
-
"build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node
|
24
|
+
"build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node ../../../scripts/typescript/normalize-import --output ./dist/packages/react-components/react-tabster/src && yarn docs",
|
24
25
|
"start": "yarn storybook",
|
25
26
|
"type-check": "tsc -b tsconfig.json"
|
26
27
|
},
|
27
28
|
"devDependencies": {
|
28
29
|
"@fluentui/eslint-plugin": "*",
|
29
|
-
"@fluentui/scripts": "^1.0.0"
|
30
|
-
"@types/react": "16.9.42",
|
31
|
-
"@types/react-dom": "16.9.10",
|
32
|
-
"@types/react-test-renderer": "^16.0.0",
|
33
|
-
"react": "16.8.6",
|
34
|
-
"react-dom": "16.8.6",
|
35
|
-
"react-test-renderer": "^16.3.0"
|
30
|
+
"@fluentui/scripts": "^1.0.0"
|
36
31
|
},
|
37
32
|
"dependencies": {
|
38
|
-
"@griffel/react": "1.0.
|
39
|
-
"@fluentui/react-shared-contexts": "9.0.0-rc.
|
40
|
-
"@fluentui/react-theme": "9.0.0-rc.
|
41
|
-
"@fluentui/react-utilities": "9.0.0-rc.
|
33
|
+
"@griffel/react": "1.0.3",
|
34
|
+
"@fluentui/react-shared-contexts": "9.0.0-rc.6",
|
35
|
+
"@fluentui/react-theme": "9.0.0-rc.6",
|
36
|
+
"@fluentui/react-utilities": "9.0.0-rc.7",
|
42
37
|
"keyborg": "^1.1.0",
|
43
|
-
"tabster": "^1.
|
38
|
+
"tabster": "^1.3.3",
|
44
39
|
"tslib": "^2.1.0"
|
45
40
|
},
|
46
41
|
"peerDependencies": {
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["hooks/useFocusIndicatorStyle.ts"],"names":[],"mappings":"AAAA,SAAS,MAAT,QAAuB,uBAAvB;AACA,SAAS,qBAAT,QAAsC,YAAtC;AAeA;;;;;;AAMG;;AACH,MAAM,qBAAqB,GAAI,OAAD,IAAsC;;;AAClE,QAAM;AAAE,IAAA,aAAF;AAAiB,IAAA,YAAjB;AAA+B,IAAA,aAA/B;AAA8C,IAAA;AA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AAY,EAAjC,GAAsC,cAAc,YAAY,MAAM,iBAAiB,GAdrF;AAeR,MAAA,KAAK,EAAE,CAAC,aAAD,GAAiB,IAAI,YAAY,EAAjC,GAAsC,cAAc,YAAY,MAAM,kBAAkB;AAfvF;AAFL,GAAP;AAoBD,CA5BD;;AAkCA,MAAM,cAAc,GAAyC;AAC3D,EAAA,QAAQ,EAAE;AADiD,CAA7D;AAIA;;;;;;;AAOG;;AACH,OAAO,MAAM,uBAAuB,GAAG,CACrC,OAAA,GAE2C;AAAE,EAAA,KAAK,EAAE,EAAT;AAAa,KAAG;AAAhB,CAHN,MAInB;AAClB,oBAAkB;AAChB,IAAA,YAAY,EAAE;AADE,GADA;AAIlB,GAAC,GAAG,qBAAqB,KAAK,OAAO,CAAC,QAAR,IAAoB,cAAc,CAAC,QAAQ,EAAzE,GAA8E,qBAAqB,CAAC;AAClG,IAAA,YAAY,EAAE,MAAM,CAAC,iBAD6E;AAElG,IAAA,aAAa,EAAE,MAAM,CAAC,kBAF4E;AAGlG;AACA,IAAA,YAAY,EAAE,KAJoF;AAKlG,OAAG,OAAO,CAAC;AALuF,GAAD;AAJjF,CAJmB,CAAhC;AAiBP;;;;;AAKG;;AACH,OAAO,MAAM,+BAA+B,GAAG,CAC7C,KAD6C,EAE7C,OAAA,GAAgD,cAFH,MAG3B;AAClB,oBAAkB;AAChB,IAAA,YAAY,EAAE;AADE,GADA;AAIlB,GAAC,GAAG,qBAAqB,KAAK,OAAO,CAAC,QAAR,IAAoB,cAAc,CAAC,QAAQ,EAAzE,GAA8E;AAJ5D,CAH2B,CAAxC","sourcesContent":["import { tokens } from '@fluentui/react-theme';\nimport { KEYBOARD_NAV_SELECTOR } from '../symbols';\nimport type { GriffelStyle } from '@griffel/react';\n\nexport type FocusOutlineOffset = Record<'top' | 'bottom' | 'left' | 'right', string>;\nexport type FocusOutlineStyleOptions = {\n /**\n * Only property not supported by the native CSS `outline`, if this is no longer needed\n * we can just go native instead\n */\n outlineRadius: string;\n outlineColor: string;\n outlineWidth: string;\n outlineOffset?: string | FocusOutlineOffset;\n};\n\n/**\n * NOTE: the element with the focus outline needs to have `position: relative` so that the\n * pseudo element can be properly positioned.\n *\n * @param options - Configures the style of the focus outline\n * @returns focus outline styles object\n */\nconst getFocusOutlineStyles = (options: FocusOutlineStyleOptions) => {\n const { outlineRadius, outlineColor, outlineOffset, outlineWidth } = options;\n\n const outlineOffsetTop = (outlineOffset as FocusOutlineOffset)?.top || outlineOffset;\n const outlineOffsetBottom = (outlineOffset as FocusOutlineOffset)?.bottom || outlineOffset;\n const outlineOffsetLeft = (outlineOffset as FocusOutlineOffset)?.left || outlineOffset;\n const outlineOffsetRight = (outlineOffset as FocusOutlineOffset)?.right || outlineOffset;\n\n return {\n borderColor: 'transparent',\n ':after': {\n content: '\"\"',\n position: 'absolute',\n pointerEvents: 'none',\n boxSizing: 'outline-box',\n zIndex: 1,\n\n borderStyle: 'solid',\n borderWidth: outlineWidth,\n borderRadius: outlineRadius,\n borderColor: outlineColor,\n\n top: !outlineOffset ? `-${outlineWidth}` : `calc(0px - ${outlineWidth} - ${outlineOffsetTop})`,\n bottom: !outlineOffset ? `-${outlineWidth}` : `calc(0px - ${outlineWidth} - ${outlineOffsetBottom})`,\n left: !outlineOffset ? `-${outlineWidth}` : `calc(0px - ${outlineWidth} - ${outlineOffsetLeft})`,\n right: !outlineOffset ? `-${outlineWidth}` : `calc(0px - ${outlineWidth} - ${outlineOffsetRight})`,\n },\n };\n};\n\nexport interface CreateFocusIndicatorStyleRuleOptions {\n selector?: 'focus' | 'focus-within';\n}\n\nconst defaultOptions: CreateFocusIndicatorStyleRuleOptions = {\n selector: 'focus',\n};\n\n/**\n * NOTE: The element with the focus outline needs to have `position: relative` so that the\n * pseudo element can be properly positioned.\n *\n * @param theme - Theme used in @see makeStyles\n * @param options - Configure the style of the focus outline\n * @returns focus outline styles object for @see makeStyles\n */\nexport const createFocusOutlineStyle = (\n options: {\n style: Partial<FocusOutlineStyleOptions>;\n } & CreateFocusIndicatorStyleRuleOptions = { style: {}, ...defaultOptions },\n): GriffelStyle => ({\n ':focus-visible': {\n outlineStyle: 'none',\n },\n [`${KEYBOARD_NAV_SELECTOR} :${options.selector || defaultOptions.selector}`]: getFocusOutlineStyles({\n outlineColor: tokens.colorStrokeFocus2,\n outlineRadius: tokens.borderRadiusMedium,\n // FIXME: tokens.strokeWidthThick causes some weird bugs\n outlineWidth: '2px',\n ...options.style,\n }),\n});\n\n/**\n * Creates a style for @see makeStyles that includes the necessary selectors for focus.\n * Should be used only when @see createFocusOutlineStyle does not fit requirements\n *\n * @param style - styling applied on focus, defaults to @see getDefaultFocusOutlineStyes\n */\nexport const createCustomFocusIndicatorStyle = (\n style: GriffelStyle,\n options: CreateFocusIndicatorStyleRuleOptions = defaultOptions,\n): GriffelStyle => ({\n ':focus-visible': {\n outlineStyle: 'none',\n },\n [`${KEYBOARD_NAV_SELECTOR} :${options.selector || defaultOptions.selector}`]: style,\n});\n"],"sourceRoot":"../src/"}
|
package/lib/symbols.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"symbols.js","sourceRoot":"../src/","sources":["symbols.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAA4B,CAAC;AACnE,MAAM,CAAC,MAAM,qBAAqB,GAAG,YAAY,sBAAsB,IAAa,CAAC","sourcesContent":["export const KEYBOARD_NAV_ATTRIBUTE = 'data-keyboard-nav' as const;\nexport const KEYBOARD_NAV_SELECTOR = `:global([${KEYBOARD_NAV_ATTRIBUTE}])` as const;\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["hooks/useFocusIndicatorStyle.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,MAAA,SAAA,gBAAA,OAAA,CAAA,YAAA,CAAA;AAeA;;;;;;AAMG;;;AACH,MAAM,qBAAqB,GAAI,OAAD,IAAsC;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{ KEYBOARD_NAV_SELECTOR } from '../symbols';\nimport type { GriffelStyle } from '@griffel/react';\n\nexport type FocusOutlineOffset = Record<'top' | 'bottom' | 'left' | 'right', string>;\nexport type FocusOutlineStyleOptions = {\n /**\n * Only property not supported by the native CSS `outline`, if this is no longer needed\n * we can just go native instead\n */\n outlineRadius: string;\n outlineColor: string;\n outlineWidth: string;\n outlineOffset?: string | FocusOutlineOffset;\n};\n\n/**\n * NOTE: the element with the focus outline needs to have `position: relative` so that the\n * pseudo element can be properly positioned.\n *\n * @param options - Configures the style of the focus outline\n * @returns focus outline styles object\n */\nconst getFocusOutlineStyles = (options: FocusOutlineStyleOptions) => {\n const { outlineRadius, outlineColor, outlineOffset, outlineWidth } = options;\n\n const outlineOffsetTop = (outlineOffset as FocusOutlineOffset)?.top || outlineOffset;\n const outlineOffsetBottom = (outlineOffset as FocusOutlineOffset)?.bottom || outlineOffset;\n const outlineOffsetLeft = (outlineOffset as FocusOutlineOffset)?.left || outlineOffset;\n const outlineOffsetRight = (outlineOffset as FocusOutlineOffset)?.right || outlineOffset;\n\n return {\n borderColor: 'transparent',\n ':after': {\n content: '\"\"',\n position: 'absolute',\n pointerEvents: 'none',\n boxSizing: 'outline-box',\n zIndex: 1,\n\n borderStyle: 'solid',\n borderWidth: outlineWidth,\n borderRadius: outlineRadius,\n borderColor: outlineColor,\n\n top: !outlineOffset ? `-${outlineWidth}` : `calc(0px - ${outlineWidth} - ${outlineOffsetTop})`,\n bottom: !outlineOffset ? `-${outlineWidth}` : `calc(0px - ${outlineWidth} - ${outlineOffsetBottom})`,\n left: !outlineOffset ? `-${outlineWidth}` : `calc(0px - ${outlineWidth} - ${outlineOffsetLeft})`,\n right: !outlineOffset ? `-${outlineWidth}` : `calc(0px - ${outlineWidth} - ${outlineOffsetRight})`,\n },\n };\n};\n\nexport interface CreateFocusIndicatorStyleRuleOptions {\n selector?: 'focus' | 'focus-within';\n}\n\nconst defaultOptions: CreateFocusIndicatorStyleRuleOptions = {\n selector: 'focus',\n};\n\n/**\n * NOTE: The element with the focus outline needs to have `position: relative` so that the\n * pseudo element can be properly positioned.\n *\n * @param theme - Theme used in @see makeStyles\n * @param options - Configure the style of the focus outline\n * @returns focus outline styles object for @see makeStyles\n */\nexport const createFocusOutlineStyle = (\n options: {\n style: Partial<FocusOutlineStyleOptions>;\n } & CreateFocusIndicatorStyleRuleOptions = { style: {}, ...defaultOptions },\n): GriffelStyle => ({\n ':focus-visible': {\n outlineStyle: 'none',\n },\n [`${KEYBOARD_NAV_SELECTOR} :${options.selector || defaultOptions.selector}`]: getFocusOutlineStyles({\n outlineColor: tokens.colorStrokeFocus2,\n outlineRadius: tokens.borderRadiusMedium,\n // FIXME: tokens.strokeWidthThick causes some weird bugs\n outlineWidth: '2px',\n ...options.style,\n }),\n});\n\n/**\n * Creates a style for @see makeStyles that includes the necessary selectors for focus.\n * Should be used only when @see createFocusOutlineStyle does not fit requirements\n *\n * @param style - styling applied on focus, defaults to @see getDefaultFocusOutlineStyes\n */\nexport const createCustomFocusIndicatorStyle = (\n style: GriffelStyle,\n options: CreateFocusIndicatorStyleRuleOptions = defaultOptions,\n): GriffelStyle => ({\n ':focus-visible': {\n outlineStyle: 'none',\n },\n [`${KEYBOARD_NAV_SELECTOR} :${options.selector || defaultOptions.selector}`]: style,\n});\n"],"sourceRoot":"../src/"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["symbols.ts"],"names":[],"mappings":";;;;;;AAAa,OAAA,CAAA,sBAAA,GAAyB,mBAAzB;AACA,OAAA,CAAA,qBAAA,GAAwB,YAAY,OAAA,CAAA,sBAAsB,IAA1D","sourcesContent":["export const KEYBOARD_NAV_ATTRIBUTE = 'data-keyboard-nav' as const;\nexport const KEYBOARD_NAV_SELECTOR = `:global([${KEYBOARD_NAV_ATTRIBUTE}])` as const;\n"],"sourceRoot":"../src/"}
|