@fluentui/react-tabster 9.0.0-rc.4 → 9.0.0-rc.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.json CHANGED
@@ -2,7 +2,140 @@
2
2
  "name": "@fluentui/react-tabster",
3
3
  "entries": [
4
4
  {
5
- "date": "Tue, 01 Mar 2022 02:16:13 GMT",
5
+ "date": "Mon, 25 Apr 2022 09:31:17 GMT",
6
+ "tag": "@fluentui/react-tabster_v9.0.0-rc.7",
7
+ "version": "9.0.0-rc.7",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "marata@microsoft.com",
12
+ "package": "@fluentui/react-tabster",
13
+ "commit": "f94b48c825ca8c8b2e3b6755bdd29fe15c7d435d",
14
+ "comment": "Adjusting accordion keyboard navigation."
15
+ }
16
+ ],
17
+ "none": [
18
+ {
19
+ "author": "martinhochel@microsoft.com",
20
+ "package": "@fluentui/react-tabster",
21
+ "commit": "31e8b97573aeba761d14b937378bb95d578c4c90",
22
+ "comment": "docs(react-tabster): remove old info about provider"
23
+ }
24
+ ]
25
+ }
26
+ },
27
+ {
28
+ "date": "Tue, 19 Apr 2022 19:16:59 GMT",
29
+ "tag": "@fluentui/react-tabster_v9.0.0-rc.6",
30
+ "version": "9.0.0-rc.6",
31
+ "comments": {
32
+ "prerelease": [
33
+ {
34
+ "author": "olfedias@microsoft.com",
35
+ "package": "@fluentui/react-tabster",
36
+ "commit": "e569d6e04d83cbcc6225e61db52ff81d2addd363",
37
+ "comment": "chore: Update Griffel to latest version"
38
+ },
39
+ {
40
+ "author": "Humberto.Morimoto@microsoft.com",
41
+ "package": "@fluentui/react-tabster",
42
+ "commit": "9c8592decacb9f7b1dc608a03c9f991918806008",
43
+ "comment": "Removing star exports at src/index.ts."
44
+ },
45
+ {
46
+ "author": "olfedias@microsoft.com",
47
+ "package": "@fluentui/react-tabster",
48
+ "commit": "829295c714ac9ff8063f5e086513574ad2e7990b",
49
+ "comment": "fix styles in getFocusOutlineStyles()"
50
+ },
51
+ {
52
+ "author": "jukapsia@microsoft.com",
53
+ "package": "@fluentui/react-tabster",
54
+ "commit": "dc1f7a2c0cb8e7a3cc51d69ce3327f44d29109d1",
55
+ "comment": "feat(react-tabster): Add grid navigation"
56
+ },
57
+ {
58
+ "author": "Humberto.Morimoto@microsoft.com",
59
+ "package": "@fluentui/react-tabster",
60
+ "commit": "2fcf8bd0341c71507dc625eeb60b4acda6369672",
61
+ "comment": "Upgrading tabster to latest version."
62
+ },
63
+ {
64
+ "author": "beachball",
65
+ "package": "@fluentui/react-tabster",
66
+ "comment": "Bump @fluentui/react-shared-contexts to v9.0.0-rc.5",
67
+ "commit": "f94b48c825ca8c8b2e3b6755bdd29fe15c7d435d"
68
+ },
69
+ {
70
+ "author": "beachball",
71
+ "package": "@fluentui/react-tabster",
72
+ "comment": "Bump @fluentui/react-theme to v9.0.0-rc.5",
73
+ "commit": "f94b48c825ca8c8b2e3b6755bdd29fe15c7d435d"
74
+ },
75
+ {
76
+ "author": "beachball",
77
+ "package": "@fluentui/react-tabster",
78
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.6",
79
+ "commit": "f94b48c825ca8c8b2e3b6755bdd29fe15c7d435d"
80
+ }
81
+ ],
82
+ "none": [
83
+ {
84
+ "author": "elcraig@microsoft.com",
85
+ "package": "@fluentui/react-tabster",
86
+ "commit": "b7f17e976f9e058f39c9fce4f0f9bb6eb4dfa577",
87
+ "comment": "Update React dev deps and hoist them to the repo root"
88
+ },
89
+ {
90
+ "author": "lingfangao@hotmail.com",
91
+ "package": "@fluentui/react-tabster",
92
+ "commit": "67dd475e49182d17dbf7d9195c5df9bce02b7b3c",
93
+ "comment": "chore: Update e2e tests to use cypress component testing"
94
+ },
95
+ {
96
+ "author": "mgodbolt@microsoft.com",
97
+ "package": "@fluentui/react-tabster",
98
+ "commit": "905e46db07ada986fd7885531f72a71b7bbaabdc",
99
+ "comment": "create v9 api extractor config and set all v9 packags to use it, suppress forgotten export"
100
+ }
101
+ ]
102
+ }
103
+ },
104
+ {
105
+ "date": "Fri, 04 Mar 2022 05:17:31 GMT",
106
+ "tag": "@fluentui/react-tabster_v9.0.0-rc.5",
107
+ "version": "9.0.0-rc.5",
108
+ "comments": {
109
+ "prerelease": [
110
+ {
111
+ "author": "dzearing@microsoft.com",
112
+ "package": "@fluentui/react-tabster",
113
+ "commit": "f2f1c0ea948cc3517eeb442c05433eb0918def29",
114
+ "comment": "Adding explicit export maps on all consumer packages for FUIR 8 and 9."
115
+ },
116
+ {
117
+ "author": "beachball",
118
+ "package": "@fluentui/react-tabster",
119
+ "comment": "Bump @fluentui/react-shared-contexts to v9.0.0-rc.4",
120
+ "commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
121
+ },
122
+ {
123
+ "author": "beachball",
124
+ "package": "@fluentui/react-tabster",
125
+ "comment": "Bump @fluentui/react-theme to v9.0.0-rc.4",
126
+ "commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
127
+ },
128
+ {
129
+ "author": "beachball",
130
+ "package": "@fluentui/react-tabster",
131
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.5",
132
+ "commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
133
+ }
134
+ ]
135
+ }
136
+ },
137
+ {
138
+ "date": "Tue, 01 Mar 2022 02:17:39 GMT",
6
139
  "tag": "@fluentui/react-tabster_v9.0.0-rc.4",
7
140
  "version": "9.0.0-rc.4",
8
141
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,49 @@
1
1
  # Change Log - @fluentui/react-tabster
2
2
 
3
- This log was last generated on Tue, 01 Mar 2022 02:16:13 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 25 Apr 2022 09:31:17 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.0.0-rc.7](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabster_v9.0.0-rc.7)
8
+
9
+ Mon, 25 Apr 2022 09:31:17 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabster_v9.0.0-rc.6..@fluentui/react-tabster_v9.0.0-rc.7)
11
+
12
+ ### Changes
13
+
14
+ - Adjusting accordion keyboard navigation. ([PR #21995](https://github.com/microsoft/fluentui/pull/21995) by marata@microsoft.com)
15
+
16
+ ## [9.0.0-rc.6](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabster_v9.0.0-rc.6)
17
+
18
+ Tue, 19 Apr 2022 19:16:59 GMT
19
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabster_v9.0.0-rc.5..@fluentui/react-tabster_v9.0.0-rc.6)
20
+
21
+ ### Changes
22
+
23
+ - chore: Update Griffel to latest version ([PR #21976](https://github.com/microsoft/fluentui/pull/21976) by olfedias@microsoft.com)
24
+ - Removing star exports at src/index.ts. ([PR #22367](https://github.com/microsoft/fluentui/pull/22367) by Humberto.Morimoto@microsoft.com)
25
+ - fix styles in getFocusOutlineStyles() ([PR #22070](https://github.com/microsoft/fluentui/pull/22070) by olfedias@microsoft.com)
26
+ - feat(react-tabster): Add grid navigation ([PR #22085](https://github.com/microsoft/fluentui/pull/22085) by jukapsia@microsoft.com)
27
+ - Upgrading tabster to latest version. ([PR #22492](https://github.com/microsoft/fluentui/pull/22492) by Humberto.Morimoto@microsoft.com)
28
+ - Bump @fluentui/react-shared-contexts to v9.0.0-rc.5 ([PR #21995](https://github.com/microsoft/fluentui/pull/21995) by beachball)
29
+ - Bump @fluentui/react-theme to v9.0.0-rc.5 ([PR #21995](https://github.com/microsoft/fluentui/pull/21995) by beachball)
30
+ - Bump @fluentui/react-utilities to v9.0.0-rc.6 ([PR #21995](https://github.com/microsoft/fluentui/pull/21995) by beachball)
31
+
32
+ ## [9.0.0-rc.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabster_v9.0.0-rc.5)
33
+
34
+ Fri, 04 Mar 2022 05:17:31 GMT
35
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabster_v9.0.0-rc.4..@fluentui/react-tabster_v9.0.0-rc.5)
36
+
37
+ ### Changes
38
+
39
+ - Adding explicit export maps on all consumer packages for FUIR 8 and 9. ([PR #21508](https://github.com/microsoft/fluentui/pull/21508) by dzearing@microsoft.com)
40
+ - Bump @fluentui/react-shared-contexts to v9.0.0-rc.4 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
41
+ - Bump @fluentui/react-theme to v9.0.0-rc.4 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
42
+ - Bump @fluentui/react-utilities to v9.0.0-rc.5 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
43
+
7
44
  ## [9.0.0-rc.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabster_v9.0.0-rc.4)
8
45
 
9
- Tue, 01 Mar 2022 02:16:13 GMT
46
+ Tue, 01 Mar 2022 02:17:39 GMT
10
47
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabster_v9.0.0-rc.3..@fluentui/react-tabster_v9.0.0-rc.4)
11
48
 
12
49
  ### Changes
package/README.md CHANGED
@@ -2,19 +2,14 @@
2
2
 
3
3
  **Tabster components for [Fluent UI React](https://developer.microsoft.com/en-us/fluentui)**
4
4
 
5
- Experimental library for focus management that leverages [tabster](https://github.com/microsoft/tabster).
6
-
7
- These library is not production-ready and **should never be used in product**. This space is useful for testing new features whose APIs might change before final release.
8
-
9
- The provider needs to be wrapped around your application:
10
-
11
- ```tsx
12
- <TabsterProvider>{children}</TabsterProvider>
13
- ```
5
+ Library for focus management that leverages [tabster](https://github.com/microsoft/tabster).
14
6
 
15
7
  The API currently only supports declarative data-\* attributes that are returned using the exported react hooks:
16
8
 
17
9
  ```tsx
10
+ import * as React from 'react';
11
+ import { useArrowNavigationGroup } from '@fluentui/react-tabster';
12
+
18
13
  const Item: React.FC = ({ children }) => <div tabIndex={0}>Item</div>;
19
14
 
20
15
  const ArrowNavigationExample: React.FC = ({ children }) => {
@@ -33,10 +28,6 @@ const ArrowNavigationExample: React.FC = ({ children }) => {
33
28
  };
34
29
 
35
30
  const App: React.FC = () => {
36
- return (
37
- <TabsterProvider>
38
- <ArrowNavigationExample />
39
- </TabsterProvider>
40
- );
31
+ return <ArrowNavigationExample />;
41
32
  };
42
33
  ```
@@ -7,6 +7,7 @@ import { Types } from 'tabster';
7
7
  * Should be used only when @see createFocusOutlineStyle does not fit requirements
8
8
  *
9
9
  * @param style - styling applied on focus, defaults to @see getDefaultFocusOutlineStyes
10
+ * @param options - Configure the style of the focus outline
10
11
  */
11
12
  export declare const createCustomFocusIndicatorStyle: (style: GriffelStyle, options?: CreateFocusIndicatorStyleRuleOptions) => GriffelStyle;
12
13
 
@@ -18,7 +19,6 @@ export declare interface CreateFocusIndicatorStyleRuleOptions {
18
19
  * NOTE: The element with the focus outline needs to have `position: relative` so that the
19
20
  * pseudo element can be properly positioned.
20
21
  *
21
- * @param theme - Theme used in @see makeStyles
22
22
  * @param options - Configure the style of the focus outline
23
23
  * @returns focus outline styles object for @see makeStyles
24
24
  */
@@ -47,10 +47,10 @@ export declare const useArrowNavigationGroup: (options?: UseArrowNavigationGroup
47
47
 
48
48
  export declare interface UseArrowNavigationGroupOptions {
49
49
  /**
50
- * Focus will navigate vertically or horizontally, defaults to horizontally
50
+ * Focus will navigate vertically, horizontally or in both directions (grid), defaults to horizontally
51
51
  * @defaultValue vertical
52
52
  */
53
- axis?: 'vertical' | 'horizontal';
53
+ axis?: 'vertical' | 'horizontal' | 'grid';
54
54
  /**
55
55
  * Focus will cycle to the first/last elements of the group without stopping
56
56
  */
@@ -60,6 +60,10 @@ export declare interface UseArrowNavigationGroupOptions {
60
60
  * available) when tabbing from outside of the group
61
61
  */
62
62
  memorizeCurrent?: boolean;
63
+ /**
64
+ * Allow tabbing within the arrow navigation group items.
65
+ */
66
+ tabbable?: boolean;
63
67
  }
64
68
 
65
69
  /**
@@ -1,7 +1,7 @@
1
1
  export * from './useArrowNavigationGroup';
2
+ export * from './useFocusableGroup';
2
3
  export * from './useFocusFinders';
3
- export * from './useModalAttributes';
4
- export * from './useTabsterAttributes';
5
4
  export * from './useFocusIndicatorStyle';
6
5
  export * from './useKeyboardNavAttribute';
7
- export * from './useFocusableGroup';
6
+ export * from './useModalAttributes';
7
+ export * from './useTabsterAttributes';
@@ -1,8 +1,8 @@
1
1
  export * from './useArrowNavigationGroup';
2
+ export * from './useFocusableGroup';
2
3
  export * from './useFocusFinders';
3
- export * from './useModalAttributes';
4
- export * from './useTabsterAttributes';
5
4
  export * from './useFocusIndicatorStyle';
6
5
  export * from './useKeyboardNavAttribute';
7
- export * from './useFocusableGroup';
6
+ export * from './useModalAttributes';
7
+ export * from './useTabsterAttributes';
8
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC","sourcesContent":["export * from './useArrowNavigationGroup';\nexport * from './useFocusFinders';\nexport * from './useModalAttributes';\nexport * from './useTabsterAttributes';\nexport * from './useFocusIndicatorStyle';\nexport * from './useKeyboardNavAttribute';\nexport * from './useFocusableGroup';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC","sourcesContent":["export * from './useArrowNavigationGroup';\nexport * from './useFocusableGroup';\nexport * from './useFocusFinders';\nexport * from './useFocusIndicatorStyle';\nexport * from './useKeyboardNavAttribute';\nexport * from './useModalAttributes';\nexport * from './useTabsterAttributes';\n"]}
@@ -1,10 +1,10 @@
1
1
  import { Types } from 'tabster';
2
2
  export interface UseArrowNavigationGroupOptions {
3
3
  /**
4
- * Focus will navigate vertically or horizontally, defaults to horizontally
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
@@ -19,7 +19,8 @@ export const useArrowNavigationGroup = options => {
19
19
  mover: {
20
20
  cyclic: !!(options === null || options === void 0 ? void 0 : options.circular),
21
21
  direction: axisToMoverDirection((_a = options === null || options === void 0 ? void 0 : options.axis) !== null && _a !== void 0 ? _a : 'vertical'),
22
- memorizeCurrent: options === null || options === void 0 ? void 0 : options.memorizeCurrent
22
+ memorizeCurrent: options === null || options === void 0 ? void 0 : options.memorizeCurrent,
23
+ tabbable: options === null || options === void 0 ? void 0 : options.tabbable
23
24
  }
24
25
  });
25
26
  };
@@ -29,6 +30,9 @@ function axisToMoverDirection(axis) {
29
30
  case 'horizontal':
30
31
  return Types.MoverDirections.Horizontal;
31
32
 
33
+ case 'grid':
34
+ return Types.MoverDirections.Grid;
35
+
32
36
  case 'vertical':
33
37
  default:
34
38
  return Types.MoverDirections.Vertical;
@@ -1 +1 @@
1
- {"version":3,"sources":["hooks/useArrowNavigationGroup.ts"],"names":[],"mappings":"AAAA,SAAS,KAAT,EAAgB,QAAhB,QAAgC,SAAhC;AACA,SAAS,oBAAT,QAAqC,wBAArC;AACA,SAAS,UAAT,QAA2B,cAA3B;AAmBA;;;AAGG;;AACH,OAAO,MAAM,uBAAuB,GAAI,OAAD,IAA6C;;;AAClF,QAAM,OAAO,GAAG,UAAU,EAA1B;;AAEA,MAAI,OAAJ,EAAa;AACX,IAAA,QAAQ,CAAC,OAAD,CAAR;AACD;;AAED,SAAO,oBAAoB,CAAC;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;AAHrB;AADmB,GAAD,CAA3B;AAOD,CAdM;;AAgBP,SAAS,oBAAT,CAA8B,IAA9B,EAA0E;AACxE,UAAQ,IAAR;AACE,SAAK,YAAL;AACE,aAAO,KAAK,CAAC,eAAN,CAAsB,UAA7B;;AAEF,SAAK,UAAL;AACA;AACE,aAAO,KAAK,CAAC,eAAN,CAAsB,QAA7B;AANJ;AAQD","sourcesContent":["import { Types, getMover } from 'tabster';\nimport { useTabsterAttributes } from './useTabsterAttributes';\nimport { useTabster } from './useTabster';\n\nexport interface UseArrowNavigationGroupOptions {\n /**\n * Focus will navigate vertically or horizontally, defaults to horizontally\n * @defaultValue vertical\n */\n axis?: 'vertical' | 'horizontal';\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\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) => {\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 },\n });\n};\n\nfunction axisToMoverDirection(axis: UseArrowNavigationGroupOptions['axis']): Types.MoverDirection {\n switch (axis) {\n case 'horizontal':\n return Types.MoverDirections.Horizontal;\n\n case 'vertical':\n default:\n return Types.MoverDirections.Vertical;\n }\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["hooks/useArrowNavigationGroup.ts"],"names":[],"mappings":"AAAA,SAAS,KAAT,EAAgB,QAAhB,QAAgC,SAAhC;AACA,SAAS,oBAAT,QAAqC,wBAArC;AACA,SAAS,UAAT,QAA2B,cAA3B;AAuBA;;;AAGG;;AACH,OAAO,MAAM,uBAAuB,GAAI,OAAD,IAAwE;;;AAC7G,QAAM,OAAO,GAAG,UAAU,EAA1B;;AAEA,MAAI,OAAJ,EAAa;AACX,IAAA,QAAQ,CAAC,OAAD,CAAR;AACD;;AAED,SAAO,oBAAoB,CAAC;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,GAAD,CAA3B;AAQD,CAfM;;AAiBP,SAAS,oBAAT,CAA8B,IAA9B,EAA0E;AACxE,UAAQ,IAAR;AACE,SAAK,YAAL;AACE,aAAO,KAAK,CAAC,eAAN,CAAsB,UAA7B;;AACF,SAAK,MAAL;AACE,aAAO,KAAK,CAAC,eAAN,CAAsB,IAA7B;;AAEF,SAAK,UAAL;AACA;AACE,aAAO,KAAK,CAAC,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/"}
@@ -17,7 +17,6 @@ export interface CreateFocusIndicatorStyleRuleOptions {
17
17
  * NOTE: The element with the focus outline needs to have `position: relative` so that the
18
18
  * pseudo element can be properly positioned.
19
19
  *
20
- * @param theme - Theme used in @see makeStyles
21
20
  * @param options - Configure the style of the focus outline
22
21
  * @returns focus outline styles object for @see makeStyles
23
22
  */
@@ -29,5 +28,6 @@ export declare const createFocusOutlineStyle: (options?: {
29
28
  * Should be used only when @see createFocusOutlineStyle does not fit requirements
30
29
  *
31
30
  * @param style - styling applied on focus, defaults to @see getDefaultFocusOutlineStyes
31
+ * @param options - Configure the style of the focus outline
32
32
  */
33
33
  export declare const createCustomFocusIndicatorStyle: (style: GriffelStyle, options?: CreateFocusIndicatorStyleRuleOptions) => GriffelStyle;
@@ -1,5 +1,6 @@
1
1
  import { tokens } from '@fluentui/react-theme';
2
2
  import { KEYBOARD_NAV_SELECTOR } from '../symbols';
3
+ import { shorthands } from '@griffel/react';
3
4
  /**
4
5
  * NOTE: the element with the focus outline needs to have `position: relative` so that the
5
6
  * pseudo element can be properly positioned.
@@ -21,18 +22,16 @@ const getFocusOutlineStyles = options => {
21
22
  const outlineOffsetBottom = ((_b = outlineOffset) === null || _b === void 0 ? void 0 : _b.bottom) || outlineOffset;
22
23
  const outlineOffsetLeft = ((_c = outlineOffset) === null || _c === void 0 ? void 0 : _c.left) || outlineOffset;
23
24
  const outlineOffsetRight = ((_d = outlineOffset) === null || _d === void 0 ? void 0 : _d.right) || outlineOffset;
24
- return {
25
- borderColor: 'transparent',
25
+ return { ...shorthands.borderColor('transparent'),
26
26
  ':after': {
27
27
  content: '""',
28
28
  position: 'absolute',
29
29
  pointerEvents: 'none',
30
- boxSizing: 'outline-box',
31
30
  zIndex: 1,
32
- borderStyle: 'solid',
33
- borderWidth: outlineWidth,
34
- borderRadius: outlineRadius,
35
- borderColor: outlineColor,
31
+ ...shorthands.borderStyle('solid'),
32
+ ...shorthands.borderWidth(outlineWidth),
33
+ ...shorthands.borderRadius(outlineRadius),
34
+ ...shorthands.borderColor(outlineColor),
36
35
  top: !outlineOffset ? `-${outlineWidth}` : `calc(0px - ${outlineWidth} - ${outlineOffsetTop})`,
37
36
  bottom: !outlineOffset ? `-${outlineWidth}` : `calc(0px - ${outlineWidth} - ${outlineOffsetBottom})`,
38
37
  left: !outlineOffset ? `-${outlineWidth}` : `calc(0px - ${outlineWidth} - ${outlineOffsetLeft})`,
@@ -48,7 +47,6 @@ const defaultOptions = {
48
47
  * NOTE: The element with the focus outline needs to have `position: relative` so that the
49
48
  * pseudo element can be properly positioned.
50
49
  *
51
- * @param theme - Theme used in @see makeStyles
52
50
  * @param options - Configure the style of the focus outline
53
51
  * @returns focus outline styles object for @see makeStyles
54
52
  */
@@ -73,6 +71,7 @@ export const createFocusOutlineStyle = (options = {
73
71
  * Should be used only when @see createFocusOutlineStyle does not fit requirements
74
72
  *
75
73
  * @param style - styling applied on focus, defaults to @see getDefaultFocusOutlineStyes
74
+ * @param options - Configure the style of the focus outline
76
75
  */
77
76
 
78
77
  export const createCustomFocusIndicatorStyle = (style, options = defaultOptions) => ({
@@ -1 +1 @@
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,IA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AAI,YAAY,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/"}
1
+ {"version":3,"sources":["hooks/useFocusIndicatorStyle.ts"],"names":[],"mappings":"AAAA,SAAS,MAAT,QAAuB,uBAAvB;AACA,SAAS,qBAAT,QAAsC,YAAtC;AACA,SAAS,UAAT,QAA2B,gBAA3B;AAeA;;;;;;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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AAE;AADiD,CAA7D;AAIA;;;;;;AAMG;;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;;;;;;AAMG;;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 { shorthands } from '@griffel/react';\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): 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\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 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 * @param options - Configure the style of the focus outline\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 +1 @@
1
- {"version":3,"sources":["hooks/useFocusableGroup.ts"],"names":[],"mappings":"AAAA,SAAS,KAAT,EAAgB,WAAhB,QAAmC,SAAnC;AACA,SAAS,oBAAT,QAAqC,wBAArC;AACA,SAAS,UAAT,QAA2B,cAA3B;AASA;;;AAGG;;AACH,OAAO,MAAM,iBAAiB,GAAI,OAAD,IAAuC;AACtE,QAAM,OAAO,GAAG,UAAU,EAA1B;;AAEA,MAAI,OAAJ,EAAa;AACX,IAAA,WAAW,CAAC,OAAD,CAAX;AACD;;AAED,SAAO,oBAAoB,CAAC;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,GAAD,CAA3B;AAKD,CAZM;;AAcP,MAAM,cAAc,GAClB,WADqB,IAEoB;AACzC,UAAQ,WAAR;AACE,SAAK,WAAL;AACE,aAAO,KAAK,CAAC,qBAAN,CAA4B,SAAnC;;AACF,SAAK,SAAL;AACE,aAAO,KAAK,CAAC,qBAAN,CAA4B,OAAnC;;AACF,SAAK,kBAAL;AACE,aAAO,KAAK,CAAC,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) => {\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/"}
1
+ {"version":3,"sources":["hooks/useFocusableGroup.ts"],"names":[],"mappings":"AAAA,SAAS,KAAT,EAAgB,WAAhB,QAAmC,SAAnC;AACA,SAAS,oBAAT,QAAqC,wBAArC;AACA,SAAS,UAAT,QAA2B,cAA3B;AASA;;;AAGG;;AACH,OAAO,MAAM,iBAAiB,GAAI,OAAD,IAAkE;AACjG,QAAM,OAAO,GAAG,UAAU,EAA1B;;AAEA,MAAI,OAAJ,EAAa;AACX,IAAA,WAAW,CAAC,OAAD,CAAX;AACD;;AAED,SAAO,oBAAoB,CAAC;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,GAAD,CAA3B;AAKD,CAZM;;AAcP,MAAM,cAAc,GAClB,WADqB,IAEoB;AACzC,UAAQ,WAAR;AACE,SAAK,WAAL;AACE,aAAO,KAAK,CAAC,qBAAN,CAA4B,SAAnC;;AACF,SAAK,SAAL;AACE,aAAO,KAAK,CAAC,qBAAN,CAA4B,OAAnC;;AACF,SAAK,kBAAL;AACE,aAAO,KAAK,CAAC,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/"}
package/lib/index.d.ts CHANGED
@@ -1 +1,2 @@
1
- export * from './hooks/index';
1
+ export { createCustomFocusIndicatorStyle, createFocusOutlineStyle, useArrowNavigationGroup, useFocusableGroup, useFocusFinders, useKeyboardNavAttribute, useModalAttributes, useTabsterAttributes, } from './hooks/index';
2
+ export type { CreateFocusIndicatorStyleRuleOptions, FocusOutlineOffset, FocusOutlineStyleOptions, UseArrowNavigationGroupOptions, UseFocusableGroupOptions, UseModalAttributesOptions, } from './hooks/index';
package/lib/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export * from './hooks/index';
1
+ export { createCustomFocusIndicatorStyle, createFocusOutlineStyle, useArrowNavigationGroup, useFocusableGroup, useFocusFinders, useKeyboardNavAttribute, useModalAttributes, useTabsterAttributes } from './hooks/index';
2
2
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC","sourcesContent":["export * from './hooks/index';\n"]}
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,SACE,+BADF,EAEE,uBAFF,EAGE,uBAHF,EAIE,iBAJF,EAKE,eALF,EAME,uBANF,EAOE,kBAPF,EAQE,oBARF,QASO,eATP","sourcesContent":["export {\n createCustomFocusIndicatorStyle,\n createFocusOutlineStyle,\n useArrowNavigationGroup,\n useFocusableGroup,\n useFocusFinders,\n useKeyboardNavAttribute,\n useModalAttributes,\n useTabsterAttributes,\n} from './hooks/index';\nexport type {\n CreateFocusIndicatorStyleRuleOptions,\n FocusOutlineOffset,\n FocusOutlineStyleOptions,\n UseArrowNavigationGroupOptions,\n UseFocusableGroupOptions,\n UseModalAttributesOptions,\n} from './hooks/index';\n"],"sourceRoot":"../src/"}
@@ -1,7 +1,7 @@
1
1
  export * from './useArrowNavigationGroup';
2
+ export * from './useFocusableGroup';
2
3
  export * from './useFocusFinders';
3
- export * from './useModalAttributes';
4
- export * from './useTabsterAttributes';
5
4
  export * from './useFocusIndicatorStyle';
6
5
  export * from './useKeyboardNavAttribute';
7
- export * from './useFocusableGroup';
6
+ export * from './useModalAttributes';
7
+ export * from './useTabsterAttributes';
@@ -8,15 +8,15 @@ const tslib_1 = /*#__PURE__*/require("tslib");
8
8
 
9
9
  tslib_1.__exportStar(require("./useArrowNavigationGroup"), exports);
10
10
 
11
- tslib_1.__exportStar(require("./useFocusFinders"), exports);
12
-
13
- tslib_1.__exportStar(require("./useModalAttributes"), exports);
11
+ tslib_1.__exportStar(require("./useFocusableGroup"), exports);
14
12
 
15
- tslib_1.__exportStar(require("./useTabsterAttributes"), exports);
13
+ tslib_1.__exportStar(require("./useFocusFinders"), exports);
16
14
 
17
15
  tslib_1.__exportStar(require("./useFocusIndicatorStyle"), exports);
18
16
 
19
17
  tslib_1.__exportStar(require("./useKeyboardNavAttribute"), exports);
20
18
 
21
- tslib_1.__exportStar(require("./useFocusableGroup"), exports);
19
+ tslib_1.__exportStar(require("./useModalAttributes"), exports);
20
+
21
+ tslib_1.__exportStar(require("./useTabsterAttributes"), exports);
22
22
  //# 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,mBAAA,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;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,0BAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,2BAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,qBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './useArrowNavigationGroup';\nexport * from './useFocusFinders';\nexport * from './useModalAttributes';\nexport * from './useTabsterAttributes';\nexport * from './useFocusIndicatorStyle';\nexport * from './useKeyboardNavAttribute';\nexport * from './useFocusableGroup';\n"],"sourceRoot":"../src/"}
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,0BAAA,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 './useFocusIndicatorStyle';\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 horizontally, defaults to horizontally
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;AAmBA;;;AAGG;;;AACI,MAAM,uBAAuB,GAAI,OAAD,IAA6C;;;AAClF,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;AAHrB;AADmB,GAArB,CAAP;AAOD,CAdM;;AAAM,OAAA,CAAA,uBAAA,GAAuB,uBAAvB;;AAgBb,SAAS,oBAAT,CAA8B,IAA9B,EAA0E;AACxE,UAAQ,IAAR;AACE,SAAK,YAAL;AACE,aAAO,SAAA,CAAA,KAAA,CAAM,eAAN,CAAsB,UAA7B;;AAEF,SAAK,UAAL;AACA;AACE,aAAO,SAAA,CAAA,KAAA,CAAM,eAAN,CAAsB,QAA7B;AANJ;AAQD","sourcesContent":["import { Types, getMover } from 'tabster';\nimport { useTabsterAttributes } from './useTabsterAttributes';\nimport { useTabster } from './useTabster';\n\nexport interface UseArrowNavigationGroupOptions {\n /**\n * Focus will navigate vertically or horizontally, defaults to horizontally\n * @defaultValue vertical\n */\n axis?: 'vertical' | 'horizontal';\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\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) => {\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 },\n });\n};\n\nfunction axisToMoverDirection(axis: UseArrowNavigationGroupOptions['axis']): Types.MoverDirection {\n switch (axis) {\n case 'horizontal':\n return Types.MoverDirections.Horizontal;\n\n case 'vertical':\n default:\n return Types.MoverDirections.Vertical;\n }\n}\n"],"sourceR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AAA,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/"}
@@ -17,7 +17,6 @@ export interface CreateFocusIndicatorStyleRuleOptions {
17
17
  * NOTE: The element with the focus outline needs to have `position: relative` so that the
18
18
  * pseudo element can be properly positioned.
19
19
  *
20
- * @param theme - Theme used in @see makeStyles
21
20
  * @param options - Configure the style of the focus outline
22
21
  * @returns focus outline styles object for @see makeStyles
23
22
  */
@@ -29,5 +28,6 @@ export declare const createFocusOutlineStyle: (options?: {
29
28
  * Should be used only when @see createFocusOutlineStyle does not fit requirements
30
29
  *
31
30
  * @param style - styling applied on focus, defaults to @see getDefaultFocusOutlineStyes
31
+ * @param options - Configure the style of the focus outline
32
32
  */
33
33
  export declare const createCustomFocusIndicatorStyle: (style: GriffelStyle, options?: CreateFocusIndicatorStyleRuleOptions) => GriffelStyle;
@@ -8,6 +8,8 @@ exports.createCustomFocusIndicatorStyle = exports.createFocusOutlineStyle = void
8
8
  const react_theme_1 = /*#__PURE__*/require("@fluentui/react-theme");
9
9
 
10
10
  const symbols_1 = /*#__PURE__*/require("../symbols");
11
+
12
+ const react_1 = /*#__PURE__*/require("@griffel/react");
11
13
  /**
12
14
  * NOTE: the element with the focus outline needs to have `position: relative` so that the
13
15
  * pseudo element can be properly positioned.
@@ -30,18 +32,16 @@ const getFocusOutlineStyles = options => {
30
32
  const outlineOffsetBottom = ((_b = outlineOffset) === null || _b === void 0 ? void 0 : _b.bottom) || outlineOffset;
31
33
  const outlineOffsetLeft = ((_c = outlineOffset) === null || _c === void 0 ? void 0 : _c.left) || outlineOffset;
32
34
  const outlineOffsetRight = ((_d = outlineOffset) === null || _d === void 0 ? void 0 : _d.right) || outlineOffset;
33
- return {
34
- borderColor: 'transparent',
35
+ return { ...react_1.shorthands.borderColor('transparent'),
35
36
  ':after': {
36
37
  content: '""',
37
38
  position: 'absolute',
38
39
  pointerEvents: 'none',
39
- boxSizing: 'outline-box',
40
40
  zIndex: 1,
41
- borderStyle: 'solid',
42
- borderWidth: outlineWidth,
43
- borderRadius: outlineRadius,
44
- borderColor: outlineColor,
41
+ ...react_1.shorthands.borderStyle('solid'),
42
+ ...react_1.shorthands.borderWidth(outlineWidth),
43
+ ...react_1.shorthands.borderRadius(outlineRadius),
44
+ ...react_1.shorthands.borderColor(outlineColor),
45
45
  top: !outlineOffset ? `-${outlineWidth}` : `calc(0px - ${outlineWidth} - ${outlineOffsetTop})`,
46
46
  bottom: !outlineOffset ? `-${outlineWidth}` : `calc(0px - ${outlineWidth} - ${outlineOffsetBottom})`,
47
47
  left: !outlineOffset ? `-${outlineWidth}` : `calc(0px - ${outlineWidth} - ${outlineOffsetLeft})`,
@@ -57,7 +57,6 @@ const defaultOptions = {
57
57
  * NOTE: The element with the focus outline needs to have `position: relative` so that the
58
58
  * pseudo element can be properly positioned.
59
59
  *
60
- * @param theme - Theme used in @see makeStyles
61
60
  * @param options - Configure the style of the focus outline
62
61
  * @returns focus outline styles object for @see makeStyles
63
62
  */
@@ -84,6 +83,7 @@ exports.createFocusOutlineStyle = createFocusOutlineStyle;
84
83
  * Should be used only when @see createFocusOutlineStyle does not fit requirements
85
84
  *
86
85
  * @param style - styling applied on focus, defaults to @see getDefaultFocusOutlineStyes
86
+ * @param options - Configure the style of the focus outline
87
87
  */
88
88
 
89
89
  const createCustomFocusIndicatorStyle = (style, options = defaultOptions) => ({
@@ -1 +1 @@
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;;;AAClE,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,EA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;;;;;AAOG;;AACI,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,SAAA,CAAA,qBAAqB,KAAK,OAAO,CAAC,QAAR,IAAoB,cAAc,CAAC,QAAQ,EAAzE,GAA8E,qBAAqB,CAAC;AAClG,IAAA,YAAY,EAAE,aAAA,CAAA,MAAA,CAAO,iBAD6E;AAElG,IAAA,aAAa,EAAE,aAAA,CAAA,MAAA,CAAO,kBAF4E;AAGlG;AACA,IAAA,YAAY,EAAE,KAJoF;AAKlG,OAAG,OAAO,CAAC;AALuF,GAAD;AAJjF,CAJmB,CAAhC;;AAAM,OAAA,CAAA,uBAAA,GAAuB,uBAAvB;AAiBb;;;;;AAKG;;AACI,MAAM,+BAA+B,GAAG,CAC7C,KAD6C,EAE7C,OAAA,GAAgD,cAFH,MAG3B;AAClB,oBAAkB;AAChB,IAAA,YAAY,EAAE;AADE,GADA;AAIlB,GAAC,GAAG,SAAA,CAAA,qBAAqB,KAAK,OAAO,CAAC,QAAR,IAAoB,cAAc,CAAC,QAAQ,EAAzE,GAA8E;AAJ5D,CAH2B,CAAxC;;AAAM,OAAA,CAAA,+BAAA,GAA+B,+BAA/B","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/"}
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;;AACA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;AAeA;;;;;;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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;;;;;;AAMG;;AACI,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,SAAA,CAAA,qBAAqB,KAAK,OAAO,CAAC,QAAR,IAAoB,cAAc,CAAC,QAAQ,EAAzE,GAA8E,qBAAqB,CAAC;AAClG,IAAA,YAAY,EAAE,aAAA,CAAA,MAAA,CAAO,iBAD6E;AAElG,IAAA,aAAa,EAAE,aAAA,CAAA,MAAA,CAAO,kBAF4E;AAGlG;AACA,IAAA,YAAY,EAAE,KAJoF;AAKlG,OAAG,OAAO,CAAC;AALuF,GAAD;AAJjF,CAJmB,CAAhC;;AAAM,OAAA,CAAA,uBAAA,GAAuB,uBAAvB;AAiBb;;;;;;AAMG;;AACI,MAAM,+BAA+B,GAAG,CAC7C,KAD6C,EAE7C,OAAA,GAAgD,cAFH,MAG3B;AAClB,oBAAkB;AAChB,IAAA,YAAY,EAAE;AADE,GADA;AAIlB,GAAC,GAAG,SAAA,CAAA,qBAAqB,KAAK,OAAO,CAAC,QAAR,IAAoB,cAAc,CAAC,QAAQ,EAAzE,GAA8E;AAJ5D,CAH2B,CAAxC;;AAAM,OAAA,CAAA,+BAAA,GAA+B,+BAA/B","sourcesContent":["import { tokens } from '@fluentui/react-theme';\nimport { KEYBOARD_NAV_SELECTOR } from '../symbols';\nimport { shorthands } from '@griffel/react';\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): 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\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 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 * @param options - Configure the style of the focus outline\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 +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,IAAuC;AACtE,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) => {\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/"}
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/"}
@@ -1 +1,2 @@
1
- export * from './hooks/index';
1
+ export { createCustomFocusIndicatorStyle, createFocusOutlineStyle, useArrowNavigationGroup, useFocusableGroup, useFocusFinders, useKeyboardNavAttribute, useModalAttributes, useTabsterAttributes, } from './hooks/index';
2
+ export type { CreateFocusIndicatorStyleRuleOptions, FocusOutlineOffset, FocusOutlineStyleOptions, UseArrowNavigationGroupOptions, UseFocusableGroupOptions, UseModalAttributesOptions, } from './hooks/index';
@@ -3,8 +3,56 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.useTabsterAttributes = exports.useModalAttributes = exports.useKeyboardNavAttribute = exports.useFocusFinders = exports.useFocusableGroup = exports.useArrowNavigationGroup = exports.createFocusOutlineStyle = exports.createCustomFocusIndicatorStyle = void 0;
6
7
 
7
- const 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, "createCustomFocusIndicatorStyle", {
11
+ enumerable: true,
12
+ get: function () {
13
+ return index_1.createCustomFocusIndicatorStyle;
14
+ }
15
+ });
16
+ Object.defineProperty(exports, "createFocusOutlineStyle", {
17
+ enumerable: true,
18
+ get: function () {
19
+ return index_1.createFocusOutlineStyle;
20
+ }
21
+ });
22
+ Object.defineProperty(exports, "useArrowNavigationGroup", {
23
+ enumerable: true,
24
+ get: function () {
25
+ return index_1.useArrowNavigationGroup;
26
+ }
27
+ });
28
+ Object.defineProperty(exports, "useFocusableGroup", {
29
+ enumerable: true,
30
+ get: function () {
31
+ return index_1.useFocusableGroup;
32
+ }
33
+ });
34
+ Object.defineProperty(exports, "useFocusFinders", {
35
+ enumerable: true,
36
+ get: function () {
37
+ return index_1.useFocusFinders;
38
+ }
39
+ });
40
+ Object.defineProperty(exports, "useKeyboardNavAttribute", {
41
+ enumerable: true,
42
+ get: function () {
43
+ return index_1.useKeyboardNavAttribute;
44
+ }
45
+ });
46
+ Object.defineProperty(exports, "useModalAttributes", {
47
+ enumerable: true,
48
+ get: function () {
49
+ return index_1.useModalAttributes;
50
+ }
51
+ });
52
+ Object.defineProperty(exports, "useTabsterAttributes", {
53
+ enumerable: true,
54
+ get: function () {
55
+ return index_1.useTabsterAttributes;
56
+ }
57
+ });
10
58
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './hooks/index';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,OAAA,gBAAA,OAAA,CAAA,eAAA,CAAA;;AACE,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;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,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","sourcesContent":["export {\n createCustomFocusIndicatorStyle,\n createFocusOutlineStyle,\n useArrowNavigationGroup,\n useFocusableGroup,\n useFocusFinders,\n useKeyboardNavAttribute,\n useModalAttributes,\n useTabsterAttributes,\n} from './hooks/index';\nexport type {\n CreateFocusIndicatorStyleRuleOptions,\n FocusOutlineOffset,\n FocusOutlineStyleOptions,\n UseArrowNavigationGroupOptions,\n UseFocusableGroupOptions,\n UseModalAttributesOptions,\n} from './hooks/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.4",
3
+ "version": "9.0.0-rc.7",
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,6 +15,7 @@
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
21
  "storybook": "node ../../scripts/storybook/runner",
@@ -26,21 +27,15 @@
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.0",
39
- "@fluentui/react-shared-contexts": "9.0.0-rc.3",
40
- "@fluentui/react-theme": "9.0.0-rc.3",
41
- "@fluentui/react-utilities": "9.0.0-rc.4",
33
+ "@griffel/react": "1.0.3",
34
+ "@fluentui/react-shared-contexts": "9.0.0-rc.5",
35
+ "@fluentui/react-theme": "9.0.0-rc.5",
36
+ "@fluentui/react-utilities": "9.0.0-rc.6",
42
37
  "keyborg": "^1.1.0",
43
- "tabster": "^1.1.1",
38
+ "tabster": "^1.3.3",
44
39
  "tslib": "^2.1.0"
45
40
  },
46
41
  "peerDependencies": {
@@ -55,5 +50,12 @@
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
  }