@fluentui/react-tabster 9.0.0-nightly.d730088d7f.0 → 9.0.0-rc.10

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.
Files changed (88) hide show
  1. package/CHANGELOG.json +502 -15
  2. package/CHANGELOG.md +223 -84
  3. package/README.md +5 -14
  4. package/dist/{react-tabster.d.ts → index.d.ts} +19 -30
  5. package/{lib → dist}/tsdoc-metadata.json +0 -0
  6. package/lib/focus/constants.js +7 -0
  7. package/lib/focus/constants.js.map +1 -0
  8. package/lib/focus/createCustomFocusIndicatorStyle.js +18 -0
  9. package/lib/focus/createCustomFocusIndicatorStyle.js.map +1 -0
  10. package/lib/focus/createFocusOutlineStyle.js +64 -0
  11. package/lib/focus/createFocusOutlineStyle.js.map +1 -0
  12. package/lib/focus/index.js +3 -0
  13. package/lib/focus/index.js.map +1 -0
  14. package/lib/hooks/index.js +2 -3
  15. package/lib/hooks/index.js.map +1 -1
  16. package/lib/hooks/useArrowNavigationGroup.js +7 -3
  17. package/lib/hooks/useArrowNavigationGroup.js.map +1 -1
  18. package/lib/hooks/useFocusFinders.js +25 -33
  19. package/lib/hooks/useFocusFinders.js.map +1 -1
  20. package/lib/hooks/useFocusableGroup.js +19 -22
  21. package/lib/hooks/useFocusableGroup.js.map +1 -1
  22. package/lib/hooks/useKeyboardNavAttribute.js +10 -12
  23. package/lib/hooks/useKeyboardNavAttribute.js.map +1 -1
  24. package/lib/hooks/useModalAttributes.js +12 -14
  25. package/lib/hooks/useModalAttributes.js.map +1 -1
  26. package/lib/hooks/useTabster.js +8 -5
  27. package/lib/hooks/useTabster.js.map +1 -1
  28. package/lib/hooks/useTabsterAttributes.js +1 -1
  29. package/lib/hooks/useTabsterAttributes.js.map +1 -1
  30. package/lib/index.js +2 -1
  31. package/lib/index.js.map +1 -1
  32. package/lib-commonjs/focus/constants.js +13 -0
  33. package/lib-commonjs/focus/constants.js.map +1 -0
  34. package/lib-commonjs/focus/createCustomFocusIndicatorStyle.js +28 -0
  35. package/lib-commonjs/focus/createCustomFocusIndicatorStyle.js.map +1 -0
  36. package/lib-commonjs/focus/createFocusOutlineStyle.js +77 -0
  37. package/lib-commonjs/focus/createFocusOutlineStyle.js.map +1 -0
  38. package/lib-commonjs/focus/index.js +12 -0
  39. package/lib-commonjs/focus/index.js.map +1 -0
  40. package/lib-commonjs/hooks/index.js +5 -7
  41. package/lib-commonjs/hooks/index.js.map +1 -1
  42. package/lib-commonjs/hooks/useArrowNavigationGroup.js +10 -6
  43. package/lib-commonjs/hooks/useArrowNavigationGroup.js.map +1 -1
  44. package/lib-commonjs/hooks/useFocusFinders.js +27 -35
  45. package/lib-commonjs/hooks/useFocusFinders.js.map +1 -1
  46. package/lib-commonjs/hooks/useFocusableGroup.js +23 -26
  47. package/lib-commonjs/hooks/useFocusableGroup.js.map +1 -1
  48. package/lib-commonjs/hooks/useKeyboardNavAttribute.js +15 -17
  49. package/lib-commonjs/hooks/useKeyboardNavAttribute.js.map +1 -1
  50. package/lib-commonjs/hooks/useModalAttributes.js +16 -18
  51. package/lib-commonjs/hooks/useModalAttributes.js.map +1 -1
  52. package/lib-commonjs/hooks/useTabster.js +10 -7
  53. package/lib-commonjs/hooks/useTabster.js.map +1 -1
  54. package/lib-commonjs/hooks/useTabsterAttributes.js +3 -3
  55. package/lib-commonjs/hooks/useTabsterAttributes.js.map +1 -1
  56. package/lib-commonjs/index.js +53 -2
  57. package/lib-commonjs/index.js.map +1 -1
  58. package/package.json +21 -19
  59. package/lib/hooks/index.d.ts +0 -7
  60. package/lib/hooks/useArrowNavigationGroup.d.ts +0 -22
  61. package/lib/hooks/useFocusFinders.d.ts +0 -10
  62. package/lib/hooks/useFocusIndicatorStyle.d.ts +0 -34
  63. package/lib/hooks/useFocusIndicatorStyle.js +0 -96
  64. package/lib/hooks/useFocusIndicatorStyle.js.map +0 -1
  65. package/lib/hooks/useFocusableGroup.d.ts +0 -26
  66. package/lib/hooks/useKeyboardNavAttribute.d.ts +0 -5
  67. package/lib/hooks/useModalAttributes.d.ts +0 -22
  68. package/lib/hooks/useTabster.d.ts +0 -9
  69. package/lib/hooks/useTabsterAttributes.d.ts +0 -5
  70. package/lib/index.d.ts +0 -1
  71. package/lib/symbols.d.ts +0 -2
  72. package/lib/symbols.js +0 -3
  73. package/lib/symbols.js.map +0 -1
  74. package/lib-commonjs/hooks/index.d.ts +0 -7
  75. package/lib-commonjs/hooks/useArrowNavigationGroup.d.ts +0 -22
  76. package/lib-commonjs/hooks/useFocusFinders.d.ts +0 -10
  77. package/lib-commonjs/hooks/useFocusIndicatorStyle.d.ts +0 -34
  78. package/lib-commonjs/hooks/useFocusIndicatorStyle.js +0 -109
  79. package/lib-commonjs/hooks/useFocusIndicatorStyle.js.map +0 -1
  80. package/lib-commonjs/hooks/useFocusableGroup.d.ts +0 -26
  81. package/lib-commonjs/hooks/useKeyboardNavAttribute.d.ts +0 -5
  82. package/lib-commonjs/hooks/useModalAttributes.d.ts +0 -22
  83. package/lib-commonjs/hooks/useTabster.d.ts +0 -9
  84. package/lib-commonjs/hooks/useTabsterAttributes.d.ts +0 -5
  85. package/lib-commonjs/index.d.ts +0 -1
  86. package/lib-commonjs/symbols.d.ts +0 -2
  87. package/lib-commonjs/symbols.js +0 -9
  88. package/lib-commonjs/symbols.js.map +0 -1
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.useTabster = void 0;
7
7
 
8
- var react_shared_contexts_1 = /*#__PURE__*/require("@fluentui/react-shared-contexts");
8
+ const react_shared_contexts_1 = /*#__PURE__*/require("@fluentui/react-shared-contexts");
9
9
 
10
- var tabster_1 = /*#__PURE__*/require("tabster");
10
+ const tabster_1 = /*#__PURE__*/require("tabster");
11
11
  /**
12
12
  * Tries to get a tabster instance on the current window or creates a new one
13
13
  * Since Tabster is single instance only, feel free to call this hook to ensure Tabster exists if necessary
@@ -17,13 +17,16 @@ var tabster_1 = /*#__PURE__*/require("tabster");
17
17
  */
18
18
 
19
19
 
20
- var useTabster = function () {
20
+ const useTabster = () => {
21
21
  var _a;
22
22
 
23
- var targetDocument = react_shared_contexts_1.useFluent().targetDocument;
24
- var defaultView = (targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView) || undefined;
25
- var tabsterOptions = {
26
- autoRoot: {}
23
+ const {
24
+ targetDocument
25
+ } = react_shared_contexts_1.useFluent();
26
+ const defaultView = (targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView) || undefined;
27
+ const tabsterOptions = {
28
+ autoRoot: {},
29
+ controlTab: false
27
30
  };
28
31
 
29
32
  if (!defaultView) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/hooks/useTabster.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,uBAAA,gBAAA,OAAA,CAAA,iCAAA,CAAA;;AACA,IAAA,SAAA,gBAAA,OAAA,CAAA,SAAA,CAAA;AAEA;;;;;;AAMG;;;AACI,IAAM,UAAU,GAAG,YAAA;;;AAChB,MAAA,cAAc,GAAK,uBAAA,CAAA,SAAA,GAAL,cAAd;AAER,MAAM,WAAW,GAAG,CAAA,cAAc,KAAA,IAAd,IAAA,cAAc,KAAA,KAAA,CAAd,GAAc,KAAA,CAAd,GAAA,cAAc,CAAE,WAAhB,KAA+B,SAAnD;AACA,MAAM,cAAc,GAAG;AAAE,IAAA,QAAQ,EAAE;AAAZ,GAAvB;;AAEA,MAAI,CAAC,WAAL,EAAkB;AAChB,WAAO,IAAP;AACD,GARuB,CAUxB;;;AACA,SAAA,CAAA,EAAA,GAAO,SAAA,CAAA,iBAAA,CAAkB,WAAlB,CAAP,MAAqC,IAArC,IAAqC,EAAA,KAAA,KAAA,CAArC,GAAqC,EAArC,GAAyC,SAAA,CAAA,aAAA,CAAc,WAAd,EAA2B,cAA3B,CAAzC;AACD,CAZM;;AAAM,OAAA,CAAA,UAAA,GAAU,UAAV","sourceRoot":""}
1
+ {"version":3,"sources":["hooks/useTabster.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,uBAAA,gBAAA,OAAA,CAAA,iCAAA,CAAA;;AACA,MAAA,SAAA,gBAAA,OAAA,CAAA,SAAA,CAAA;AAEA;;;;;;AAMG;;;AACI,MAAM,UAAU,GAAG,MAAsC;;;AAC9D,QAAM;AAAE,IAAA;AAAF,MAAqB,uBAAA,CAAA,SAAA,EAA3B;AAEA,QAAM,WAAW,GAAG,CAAA,cAAc,KAAA,IAAd,IAAA,cAAc,KAAA,KAAA,CAAd,GAAc,KAAA,CAAd,GAAA,cAAc,CAAE,WAAhB,KAA+B,SAAnD;AACA,QAAM,cAAc,GAAkC;AAAE,IAAA,QAAQ,EAAE,EAAZ;AAAgB,IAAA,UAAU,EAAE;AAA5B,GAAtD;;AAEA,MAAI,CAAC,WAAL,EAAkB;AAChB,WAAO,IAAP;AACD,GAR6D,CAU9D;;;AACA,SAAO,CAAA,EAAA,GAAA,SAAA,CAAA,iBAAA,CAAkB,WAAlB,CAAA,MAA8B,IAA9B,IAA8B,EAAA,KAAA,KAAA,CAA9B,GAA8B,EAA9B,GAAkC,SAAA,CAAA,aAAA,CAAc,WAAd,EAA2B,cAA3B,CAAzC;AACD,CAZM;;AAAM,OAAA,CAAA,UAAA,GAAU,UAAV","sourcesContent":["import { useFluent } from '@fluentui/react-shared-contexts';\nimport { getCurrentTabster, createTabster, Types as TabsterTypes } from 'tabster';\n\n/**\n * Tries to get a tabster instance on the current window or creates a new one\n * Since Tabster is single instance only, feel free to call this hook to ensure Tabster exists if necessary\n *\n * @internal\n * @returns Tabster core instance\n */\nexport const useTabster = (): TabsterTypes.TabsterCore | null => {\n const { targetDocument } = useFluent();\n\n const defaultView = targetDocument?.defaultView || undefined;\n const tabsterOptions: TabsterTypes.TabsterCoreProps = { autoRoot: {}, controlTab: false };\n\n if (!defaultView) {\n return null;\n }\n\n // TODO: worth memoizing once more tabster options are used\n return getCurrentTabster(defaultView) ?? createTabster(defaultView, tabsterOptions);\n};\n"],"sourceRoot":"../src/"}
@@ -5,15 +5,15 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.useTabsterAttributes = void 0;
7
7
 
8
- var tabster_1 = /*#__PURE__*/require("tabster");
8
+ const tabster_1 = /*#__PURE__*/require("tabster");
9
9
 
10
- var useTabster_1 = /*#__PURE__*/require("./useTabster");
10
+ const useTabster_1 = /*#__PURE__*/require("./useTabster");
11
11
  /**
12
12
  * Hook that returns tabster attributes while ensuring tabster exists
13
13
  */
14
14
 
15
15
 
16
- var useTabsterAttributes = function (props) {
16
+ const useTabsterAttributes = props => {
17
17
  // A tabster instance is not necessary to generate tabster attributes
18
18
  // but calling the hook will ensure that a tabster instance exists internally and avoids consumers doing the same
19
19
  useTabster_1.useTabster();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/hooks/useTabsterAttributes.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,SAAA,gBAAA,OAAA,CAAA,SAAA,CAAA;;AACA,IAAA,YAAA,gBAAA,OAAA,CAAA,cAAA,CAAA;AAEA;;AAEG;;;AACI,IAAM,oBAAoB,GAAG,UAAC,KAAD,EAA0C;AAC5E;AACA;AACA,EAAA,YAAA,CAAA,UAAA;AAEA,SAAO,SAAA,CAAA,mBAAA,CAAoB,KAApB,CAAP;AACD,CANM;;AAAM,OAAA,CAAA,oBAAA,GAAoB,oBAApB","sourceRoot":""}
1
+ {"version":3,"sources":["hooks/useTabsterAttributes.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,SAAA,gBAAA,OAAA,CAAA,SAAA,CAAA;;AACA,MAAA,YAAA,gBAAA,OAAA,CAAA,cAAA,CAAA;AAEA;;AAEG;;;AACI,MAAM,oBAAoB,GAAI,KAAD,IAAgF;AAClH;AACA;AACA,EAAA,YAAA,CAAA,UAAA;AAEA,SAAO,SAAA,CAAA,mBAAA,CAAoB,KAApB,CAAP;AACD,CANM;;AAAM,OAAA,CAAA,oBAAA,GAAoB,oBAApB","sourcesContent":["import { getTabsterAttribute, Types as TabsterTypes } from 'tabster';\nimport { useTabster } from './useTabster';\n\n/**\n * Hook that returns tabster attributes while ensuring tabster exists\n */\nexport const useTabsterAttributes = (props: TabsterTypes.TabsterAttributeProps): TabsterTypes.TabsterDOMAttribute => {\n // A tabster instance is not necessary to generate tabster attributes\n // but calling the hook will ensure that a tabster instance exists internally and avoids consumers doing the same\n useTabster();\n\n return getTabsterAttribute(props);\n};\n"],"sourceRoot":"../src/"}
@@ -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
- var tslib_1 = /*#__PURE__*/require("tslib");
8
+ var index_1 = /*#__PURE__*/require("./hooks/index");
8
9
 
9
- tslib_1.__exportStar(require("./hooks/index"), exports);
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":["../src/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA","sourceRoot":""}
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,OAAA,gBAAA,OAAA,CAAA,eAAA,CAAA;;AACE,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;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,mBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,OAAA,CAAA,iBAAA;AAAiB;AAAjB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,iBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,OAAA,CAAA,eAAA;AAAe;AAAf,CAAA;AACA,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;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,oBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,OAAA,CAAA,kBAAA;AAAkB;AAAlB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,sBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,OAAA,CAAA,oBAAA;AAAoB;AAApB,CAAA;;AAQF,IAAA,OAAA,gBAAA,OAAA,CAAA,eAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,iCAAA,EAAA;AAAA,EAAA,UAAA,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,10 +1,10 @@
1
1
  {
2
2
  "name": "@fluentui/react-tabster",
3
- "version": "9.0.0-nightly.d730088d7f.0",
3
+ "version": "9.0.0-rc.10",
4
4
  "description": "Utilities for focus management and facade for tabster",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
7
- "typings": "lib/index.d.ts",
7
+ "typings": "dist/index.d.ts",
8
8
  "sideEffects": false,
9
9
  "repository": {
10
10
  "type": "git",
@@ -15,31 +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": "start-storybook",
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 . --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output dist/react-tabster/src && yarn docs",
24
- "start": "yarn storybook"
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",
25
+ "start": "yarn storybook",
26
+ "type-check": "tsc -b tsconfig.json"
25
27
  },
26
28
  "devDependencies": {
27
29
  "@fluentui/eslint-plugin": "*",
28
- "@fluentui/scripts": "^1.0.0",
29
- "@types/react": "16.9.42",
30
- "@types/react-dom": "16.9.10",
31
- "@types/react-test-renderer": "^16.0.0",
32
- "react": "16.8.6",
33
- "react-dom": "16.8.6",
34
- "react-test-renderer": "^16.3.0"
30
+ "@fluentui/scripts": "^1.0.0"
35
31
  },
36
32
  "dependencies": {
37
- "@fluentui/make-styles": "9.0.0-nightly.d730088d7f.0",
38
- "@fluentui/react-make-styles": "9.0.0-nightly.d730088d7f.0",
39
- "@fluentui/react-shared-contexts": "9.0.0-nightly.d730088d7f.0",
40
- "@fluentui/react-utilities": "9.0.0-nightly.d730088d7f.0",
41
- "keyborg": "^1.0.0",
42
- "tabster": "^1.0.0",
33
+ "@griffel/react": "1.0.5",
34
+ "@fluentui/react-shared-contexts": "9.0.0-rc.8",
35
+ "@fluentui/react-theme": "9.0.0-rc.8",
36
+ "@fluentui/react-utilities": "9.0.0-rc.9",
37
+ "keyborg": "^1.1.0",
38
+ "tabster": "^1.4.0",
43
39
  "tslib": "^2.1.0"
44
40
  },
45
41
  "peerDependencies": {
@@ -49,11 +45,17 @@
49
45
  "react-dom": ">=16.8.0 <18.0.0"
50
46
  },
51
47
  "beachball": {
52
- "tag": "beta",
53
48
  "disallowedChangeTypes": [
54
49
  "major",
55
50
  "minor",
56
51
  "patch"
57
52
  ]
53
+ },
54
+ "exports": {
55
+ ".": {
56
+ "types": "./lib/index.d.ts",
57
+ "import": "./lib/index.js",
58
+ "require": "./lib-commonjs/index.js"
59
+ }
58
60
  }
59
61
  }
@@ -1,7 +0,0 @@
1
- export * from './useArrowNavigationGroup';
2
- export * from './useFocusFinders';
3
- export * from './useModalAttributes';
4
- export * from './useTabsterAttributes';
5
- export * from './useFocusIndicatorStyle';
6
- export * from './useKeyboardNavAttribute';
7
- export * from './useFocusableGroup';
@@ -1,22 +0,0 @@
1
- import { Types } from 'tabster';
2
- export interface UseArrowNavigationGroupOptions {
3
- /**
4
- * Focus will navigate vertically or horizontally, defaults to horizontally
5
- * @defaultValue vertical
6
- */
7
- axis?: 'vertical' | 'horizontal';
8
- /**
9
- * Focus will cycle to the first/last elements of the group without stopping
10
- */
11
- circular?: boolean;
12
- /**
13
- * Last focused element in the group will be remembered and focused (if still
14
- * available) when tabbing from outside of the group
15
- */
16
- memorizeCurrent?: boolean;
17
- }
18
- /**
19
- * A hook that returns the necessary tabster attributes to support arrow key navigation
20
- * @param options - Options to configure keyboard navigation
21
- */
22
- export declare const useArrowNavigationGroup: (options?: UseArrowNavigationGroupOptions | undefined) => Types.TabsterDOMAttribute;
@@ -1,10 +0,0 @@
1
- /**
2
- * Returns a set of helper functions that will traverse focusable elements in the context of a root DOM element
3
- */
4
- export declare const useFocusFinders: () => {
5
- findAllFocusable: (container: HTMLElement, acceptCondition: (el: HTMLElement) => boolean) => HTMLElement[];
6
- findFirstFocusable: (container: HTMLElement) => HTMLElement | null | undefined;
7
- findLastFocusable: (container: HTMLElement) => HTMLElement | null | undefined;
8
- findNextFocusable: (currentElement: HTMLElement) => HTMLElement | null | undefined;
9
- findPrevFocusable: (currentElement: HTMLElement) => HTMLElement | null | undefined;
10
- };
@@ -1,34 +0,0 @@
1
- import type { Theme } from '@fluentui/react-theme';
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
- };
14
- export interface CreateFocusIndicatorStyleRuleOptions {
15
- selector?: 'focus' | 'focus-within';
16
- }
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,96 +0,0 @@
1
- import { __assign } from "tslib";
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
- */
10
-
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;
22
- return {
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
- }
39
- };
40
- };
41
-
42
- var defaultOptions = {
43
- selector: 'focus'
44
- };
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);
61
- }
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) {
82
- if (options === void 0) {
83
- options = defaultOptions;
84
- }
85
-
86
- return function (theme) {
87
- var _a;
88
-
89
- return _a = {
90
- ':focus-visible': {
91
- outline: 'none'
92
- }
93
- }, _a[KEYBOARD_NAV_SELECTOR + " :" + (options.selector || defaultOptions.selector)] = typeof rule === 'function' ? rule(theme) : rule, _a;
94
- };
95
- };
96
- //# sourceMappingURL=useFocusIndicatorStyle.js.map
@@ -1 +0,0 @@
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,MAAA,aAAa,GAAgD,OAAO,CAAvD,aAAb;AAAA,MAAe,YAAY,GAAkC,OAAO,CAAzC,YAA3B;AAAA,MAA6B,aAAa,GAAmB,OAAO,CAA1B,aAA1C;AAAA,MAA4C,YAAY,GAAK,OAAO,CAAZ,YAAxD;AAER,MAAM,gBAAgB,GAAG,CAAA,CAAA,EAAA,GAAC,aAAD,MAAqC,IAArC,IAAqC,EAAA,KAAA,KAAA,CAArC,GAAqC,KAAA,CAArC,GAAqC,EAAA,CAAE,GAAvC,KAA8C,aAAvE;AACA,MAAM,mB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,EAMxC,EANwC;AAMxC,GAN+B;AAM/B,CATK","sourceRoot":""}
@@ -1,26 +0,0 @@
1
- import { Types } from 'tabster';
2
- export declare enum FocusableGroupTabBehavior {
3
- /**
4
- * Tab will cycle into and out of the groupper content.
5
- */
6
- Unlimited,
7
- /**
8
- * Tab will cycle out of the container, but not into it.
9
- */
10
- Limited,
11
- /**
12
- * Tab only cycles the inner elements.
13
- */
14
- LimitedTrapFocus
15
- }
16
- export interface UseFocusableGroupOptions {
17
- /**
18
- * Type of TAB key interaction.
19
- */
20
- tabBehavior?: FocusableGroupTabBehavior;
21
- }
22
- /**
23
- * A hook that returns the necessary tabster attributes to support groupping.
24
- * @param options - Options to configure keyboard navigation
25
- */
26
- export declare const useFocusableGroup: (options?: UseFocusableGroupOptions | undefined) => Types.TabsterDOMAttribute;
@@ -1,5 +0,0 @@
1
- import type { RefObject } from 'react';
2
- /**
3
- * instantiates keyborg and add attribute to ensure focus indicator synced to keyborg logic
4
- */
5
- export declare function useKeyboardNavAttribute<E extends HTMLElement>(): RefObject<E>;
@@ -1,22 +0,0 @@
1
- import { Types as TabsterTypes } from 'tabster';
2
- export interface UseModalAttributesOptions {
3
- /**
4
- * Traps focus inside the elements the attributes are applied
5
- */
6
- trapFocus?: boolean;
7
- /**
8
- * Always reachabled in Tab order
9
- */
10
- alwaysFocusable?: boolean;
11
- }
12
- /**
13
- * Applies modal dialog behaviour through DOM attributes
14
- * Modal element will focus trap and hide other content on the page
15
- * The trigger element will be focused if focus is lost after the modal element is removed
16
- *
17
- * @returns DOM attributes to apply to the modal element and its trigger
18
- */
19
- export declare const useModalAttributes: (options?: UseModalAttributesOptions) => {
20
- modalAttributes: TabsterTypes.TabsterDOMAttribute;
21
- triggerAttributes: TabsterTypes.TabsterDOMAttribute;
22
- };
@@ -1,9 +0,0 @@
1
- import { Types as TabsterTypes } from 'tabster';
2
- /**
3
- * Tries to get a tabster instance on the current window or creates a new one
4
- * Since Tabster is single instance only, feel free to call this hook to ensure Tabster exists if necessary
5
- *
6
- * @internal
7
- * @returns Tabster core instance
8
- */
9
- export declare const useTabster: () => TabsterTypes.TabsterCore | null;
@@ -1,5 +0,0 @@
1
- import { Types as TabsterTypes } from 'tabster';
2
- /**
3
- * Hook that returns tabster attributes while ensuring tabster exists
4
- */
5
- export declare const useTabsterAttributes: (props: TabsterTypes.TabsterAttributeProps) => TabsterTypes.TabsterDOMAttribute;
package/lib/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './hooks/index';
package/lib/symbols.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare const KEYBOARD_NAV_ATTRIBUTE: "data-keyboard-nav";
2
- export declare const KEYBOARD_NAV_SELECTOR: ":global([data-keyboard-nav])";
package/lib/symbols.js DELETED
@@ -1,3 +0,0 @@
1
- export var KEYBOARD_NAV_ATTRIBUTE = 'data-keyboard-nav';
2
- export var KEYBOARD_NAV_SELECTOR = ":global([" + KEYBOARD_NAV_ATTRIBUTE + "])";
3
- //# sourceMappingURL=symbols.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"symbols.js","sourceRoot":"","sources":["../src/symbols.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,sBAAsB,GAAG,mBAA4B,CAAC;AACnE,MAAM,CAAC,IAAM,qBAAqB,GAAG,cAAY,sBAAsB,OAAa,CAAC"}
@@ -1,7 +0,0 @@
1
- export * from './useArrowNavigationGroup';
2
- export * from './useFocusFinders';
3
- export * from './useModalAttributes';
4
- export * from './useTabsterAttributes';
5
- export * from './useFocusIndicatorStyle';
6
- export * from './useKeyboardNavAttribute';
7
- export * from './useFocusableGroup';
@@ -1,22 +0,0 @@
1
- import { Types } from 'tabster';
2
- export interface UseArrowNavigationGroupOptions {
3
- /**
4
- * Focus will navigate vertically or horizontally, defaults to horizontally
5
- * @defaultValue vertical
6
- */
7
- axis?: 'vertical' | 'horizontal';
8
- /**
9
- * Focus will cycle to the first/last elements of the group without stopping
10
- */
11
- circular?: boolean;
12
- /**
13
- * Last focused element in the group will be remembered and focused (if still
14
- * available) when tabbing from outside of the group
15
- */
16
- memorizeCurrent?: boolean;
17
- }
18
- /**
19
- * A hook that returns the necessary tabster attributes to support arrow key navigation
20
- * @param options - Options to configure keyboard navigation
21
- */
22
- export declare const useArrowNavigationGroup: (options?: UseArrowNavigationGroupOptions | undefined) => Types.TabsterDOMAttribute;
@@ -1,10 +0,0 @@
1
- /**
2
- * Returns a set of helper functions that will traverse focusable elements in the context of a root DOM element
3
- */
4
- export declare const useFocusFinders: () => {
5
- findAllFocusable: (container: HTMLElement, acceptCondition: (el: HTMLElement) => boolean) => HTMLElement[];
6
- findFirstFocusable: (container: HTMLElement) => HTMLElement | null | undefined;
7
- findLastFocusable: (container: HTMLElement) => HTMLElement | null | undefined;
8
- findNextFocusable: (currentElement: HTMLElement) => HTMLElement | null | undefined;
9
- findPrevFocusable: (currentElement: HTMLElement) => HTMLElement | null | undefined;
10
- };
@@ -1,34 +0,0 @@
1
- import type { Theme } from '@fluentui/react-theme';
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
- };
14
- export interface CreateFocusIndicatorStyleRuleOptions {
15
- selector?: 'focus' | 'focus-within';
16
- }
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>;