@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
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
  ```
@@ -1,18 +1,17 @@
1
- import type { MakeStyles } from '@fluentui/make-styles';
2
- import type { MakeStylesStyleRule } from '@fluentui/make-styles';
1
+ import type { GriffelStyle } from '@griffel/react';
3
2
  import type { RefObject } from 'react';
4
- import type { Theme } from '@fluentui/react-theme';
5
3
  import { Types } from 'tabster';
6
4
 
7
5
  /**
8
- * Creates a style rule for @see makeStyles that includes the necessary selectors for focus.
6
+ * Creates a style for @see makeStyles that includes the necessary selectors for focus.
9
7
  * Should be used only when @see createFocusOutlineStyle does not fit requirements
10
8
  *
11
- * @param rule - styling applied on focus, defaults to @see getDefaultFocusOutlineStyes
9
+ * @param style - styling applied on focus, defaults to @see getDefaultFocusOutlineStyes
10
+ * @param options - Configure the style of the focus outline
12
11
  */
13
- export declare const createCustomFocusIndicatorStyle: (rule: MakeStylesStyleRule<Theme>, options?: CreateFocusIndicatorStyleRuleOptions) => MakeStylesStyleRule<Theme>;
12
+ export declare const createCustomFocusIndicatorStyle: (style: GriffelStyle, { selector }?: CreateCustomFocusIndicatorStyleOptions) => GriffelStyle;
14
13
 
15
- export declare interface CreateFocusIndicatorStyleRuleOptions {
14
+ export declare interface CreateCustomFocusIndicatorStyleOptions {
16
15
  selector?: 'focus' | 'focus-within';
17
16
  }
18
17
 
@@ -20,27 +19,13 @@ export declare interface CreateFocusIndicatorStyleRuleOptions {
20
19
  * NOTE: The element with the focus outline needs to have `position: relative` so that the
21
20
  * pseudo element can be properly positioned.
22
21
  *
23
- * @param theme - Theme used in @see makeStyles
24
22
  * @param options - Configure the style of the focus outline
25
23
  * @returns focus outline styles object for @see makeStyles
26
24
  */
27
- export declare const createFocusOutlineStyle: (theme: Theme, options?: {
28
- style: Partial<FocusOutlineStyleOptions>;
29
- } & CreateFocusIndicatorStyleRuleOptions) => MakeStyles;
25
+ export declare const createFocusOutlineStyle: ({ selector, style, }?: CreateFocusOutlineStyleOptions) => GriffelStyle;
30
26
 
31
- export declare enum FocusableGroupTabBehavior {
32
- /**
33
- * Tab will cycle into and out of the groupper content.
34
- */
35
- Unlimited,
36
- /**
37
- * Tab will cycle out of the container, but not into it.
38
- */
39
- Limited,
40
- /**
41
- * Tab only cycles the inner elements.
42
- */
43
- LimitedTrapFocus
27
+ export declare interface CreateFocusOutlineStyleOptions extends CreateCustomFocusIndicatorStyleOptions {
28
+ style?: Partial<FocusOutlineStyleOptions>;
44
29
  }
45
30
 
46
31
  export declare type FocusOutlineOffset = Record<'top' | 'bottom' | 'left' | 'right', string>;
@@ -64,10 +49,10 @@ export declare const useArrowNavigationGroup: (options?: UseArrowNavigationGroup
64
49
 
65
50
  export declare interface UseArrowNavigationGroupOptions {
66
51
  /**
67
- * Focus will navigate vertically or horizontally, defaults to horizontally
52
+ * Focus will navigate vertically, horizontally or in both directions (grid), defaults to horizontally
68
53
  * @defaultValue vertical
69
54
  */
70
- axis?: 'vertical' | 'horizontal';
55
+ axis?: 'vertical' | 'horizontal' | 'grid';
71
56
  /**
72
57
  * Focus will cycle to the first/last elements of the group without stopping
73
58
  */
@@ -77,6 +62,10 @@ export declare interface UseArrowNavigationGroupOptions {
77
62
  * available) when tabbing from outside of the group
78
63
  */
79
64
  memorizeCurrent?: boolean;
65
+ /**
66
+ * Allow tabbing within the arrow navigation group items.
67
+ */
68
+ tabbable?: boolean;
80
69
  }
81
70
 
82
71
  /**
@@ -87,9 +76,9 @@ export declare const useFocusableGroup: (options?: UseFocusableGroupOptions | un
87
76
 
88
77
  export declare interface UseFocusableGroupOptions {
89
78
  /**
90
- * Type of TAB key interaction.
79
+ * Behavior for the Tab key.
91
80
  */
92
- tabBehavior?: FocusableGroupTabBehavior;
81
+ tabBehavior?: 'unlimited' | 'limited' | 'limitedTrapFocus';
93
82
  }
94
83
 
95
84
  /**
@@ -99,8 +88,8 @@ export declare const useFocusFinders: () => {
99
88
  findAllFocusable: (container: HTMLElement, acceptCondition: (el: HTMLElement) => boolean) => HTMLElement[];
100
89
  findFirstFocusable: (container: HTMLElement) => HTMLElement | null | undefined;
101
90
  findLastFocusable: (container: HTMLElement) => HTMLElement | null | undefined;
102
- findNextFocusable: (currentElement: HTMLElement) => HTMLElement | null | undefined;
103
- findPrevFocusable: (currentElement: HTMLElement) => HTMLElement | null | undefined;
91
+ findNextFocusable: (currentElement: HTMLElement, options?: Pick<Types.FindNextProps, 'container'>) => HTMLElement | null | undefined;
92
+ findPrevFocusable: (currentElement: HTMLElement, options?: Pick<Types.FindNextProps, 'container'>) => HTMLElement | null | undefined;
104
93
  };
105
94
 
106
95
  /**
File without changes
@@ -0,0 +1,7 @@
1
+ export const KEYBOARD_NAV_ATTRIBUTE = 'data-keyboard-nav';
2
+ export const KEYBOARD_NAV_SELECTOR = `:global([${KEYBOARD_NAV_ATTRIBUTE}])`;
3
+ export const defaultOptions = {
4
+ style: {},
5
+ selector: 'focus'
6
+ };
7
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["focus/constants.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,sBAAsB,GAAG,mBAA/B;AACP,OAAO,MAAM,qBAAqB,GAAG,YAAY,sBAAsB,IAAhE;AACP,OAAO,MAAM,cAAc,GAAG;AAC5B,EAAA,KAAK,EAAE,EADqB;AAE5B,EAAA,QAAQ,EAAE;AAFkB,CAAvB","sourcesContent":["export const KEYBOARD_NAV_ATTRIBUTE = 'data-keyboard-nav' as const;\nexport const KEYBOARD_NAV_SELECTOR = `:global([${KEYBOARD_NAV_ATTRIBUTE}])` as const;\nexport const defaultOptions = {\n style: {},\n selector: 'focus',\n} as const;\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,18 @@
1
+ import { KEYBOARD_NAV_SELECTOR, defaultOptions } from './constants';
2
+ /**
3
+ * Creates a style for @see makeStyles that includes the necessary selectors for focus.
4
+ * Should be used only when @see createFocusOutlineStyle does not fit requirements
5
+ *
6
+ * @param style - styling applied on focus, defaults to @see getDefaultFocusOutlineStyes
7
+ * @param options - Configure the style of the focus outline
8
+ */
9
+
10
+ export const createCustomFocusIndicatorStyle = (style, {
11
+ selector = defaultOptions.selector
12
+ } = defaultOptions) => ({
13
+ ':focus-visible': {
14
+ outlineStyle: 'none'
15
+ },
16
+ [`${KEYBOARD_NAV_SELECTOR} :${selector}`]: style
17
+ });
18
+ //# sourceMappingURL=createCustomFocusIndicatorStyle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["focus/createCustomFocusIndicatorStyle.ts"],"names":[],"mappings":"AAAA,SAAS,qBAAT,EAAgC,cAAhC,QAAsD,aAAtD;AAOA;;;;;;AAMG;;AACH,OAAO,MAAM,+BAA+B,GAAG,CAC7C,KAD6C,EAE7C;AAAE,EAAA,QAAQ,GAAG,cAAc,CAAC;AAA5B,IAAiF,cAFpC,MAG3B;AAClB,oBAAkB;AAChB,IAAA,YAAY,EAAE;AADE,GADA;AAIlB,GAAC,GAAG,qBAAqB,KAAK,QAAQ,EAAtC,GAA2C;AAJzB,CAH2B,CAAxC","sourcesContent":["import { KEYBOARD_NAV_SELECTOR, defaultOptions } from './constants';\nimport type { GriffelStyle } from '@griffel/react';\n\nexport interface CreateCustomFocusIndicatorStyleOptions {\n selector?: 'focus' | 'focus-within';\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 { selector = defaultOptions.selector }: CreateCustomFocusIndicatorStyleOptions = defaultOptions,\n): GriffelStyle => ({\n ':focus-visible': {\n outlineStyle: 'none',\n },\n [`${KEYBOARD_NAV_SELECTOR} :${selector}`]: style,\n});\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,64 @@
1
+ import { tokens } from '@fluentui/react-theme';
2
+ import { shorthands } from '@griffel/react';
3
+ import { createCustomFocusIndicatorStyle } from './createCustomFocusIndicatorStyle';
4
+ import { defaultOptions } from './constants';
5
+ /**
6
+ * NOTE: the element with the focus outline needs to have `position: relative` so that the
7
+ * pseudo element can be properly positioned.
8
+ *
9
+ * @param options - Configures the style of the focus outline
10
+ * @returns focus outline styles object
11
+ */
12
+
13
+ const getFocusOutlineStyles = options => {
14
+ var _a, _b, _c, _d;
15
+
16
+ const {
17
+ outlineRadius,
18
+ outlineColor,
19
+ outlineOffset,
20
+ outlineWidth
21
+ } = options;
22
+ const outlineOffsetTop = ((_a = outlineOffset) === null || _a === void 0 ? void 0 : _a.top) || outlineOffset;
23
+ const outlineOffsetBottom = ((_b = outlineOffset) === null || _b === void 0 ? void 0 : _b.bottom) || outlineOffset;
24
+ const outlineOffsetLeft = ((_c = outlineOffset) === null || _c === void 0 ? void 0 : _c.left) || outlineOffset;
25
+ const outlineOffsetRight = ((_d = outlineOffset) === null || _d === void 0 ? void 0 : _d.right) || outlineOffset;
26
+ return { ...shorthands.borderColor('transparent'),
27
+ ':after': {
28
+ content: '""',
29
+ position: 'absolute',
30
+ pointerEvents: 'none',
31
+ zIndex: 1,
32
+ ...shorthands.borderStyle('solid'),
33
+ ...shorthands.borderWidth(outlineWidth),
34
+ ...shorthands.borderRadius(outlineRadius),
35
+ ...shorthands.borderColor(outlineColor),
36
+ top: !outlineOffset ? `-${outlineWidth}` : `calc(0px - ${outlineWidth} - ${outlineOffsetTop})`,
37
+ bottom: !outlineOffset ? `-${outlineWidth}` : `calc(0px - ${outlineWidth} - ${outlineOffsetBottom})`,
38
+ left: !outlineOffset ? `-${outlineWidth}` : `calc(0px - ${outlineWidth} - ${outlineOffsetLeft})`,
39
+ right: !outlineOffset ? `-${outlineWidth}` : `calc(0px - ${outlineWidth} - ${outlineOffsetRight})`
40
+ }
41
+ };
42
+ };
43
+ /**
44
+ * NOTE: The element with the focus outline needs to have `position: relative` so that the
45
+ * pseudo element can be properly positioned.
46
+ *
47
+ * @param options - Configure the style of the focus outline
48
+ * @returns focus outline styles object for @see makeStyles
49
+ */
50
+
51
+
52
+ export const createFocusOutlineStyle = ({
53
+ selector = defaultOptions.selector,
54
+ style = defaultOptions.style
55
+ } = defaultOptions) => createCustomFocusIndicatorStyle(getFocusOutlineStyles({
56
+ outlineColor: tokens.colorStrokeFocus2,
57
+ outlineRadius: tokens.borderRadiusMedium,
58
+ // FIXME: tokens.strokeWidthThick causes some weird bugs
59
+ outlineWidth: '2px',
60
+ ...style
61
+ }), {
62
+ selector
63
+ });
64
+ //# sourceMappingURL=createFocusOutlineStyle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["focus/createFocusOutlineStyle.ts"],"names":[],"mappings":"AAAA,SAAS,MAAT,QAAuB,uBAAvB;AACA,SAAS,UAAT,QAA2B,gBAA3B;AAEA,SACE,+BADF,QAGO,mCAHP;AAIA,SAAS,cAAT,QAA+B,aAA/B;AAiBA;;;;;;AAMG;;AACH,MAAM,qBAAqB,GAAI,OAAD,IAAoD;;;AAChF,QAAM;AAAE,IAAA,aAAF;AAAiB,IAAA,YAAjB;AAA+B,IAAA,aAA/B;AAA8C,IAAA;AAA9C,MAA+D,OAArE;AAEA,QAAM,gBAAgB,GAAG,CAAA,CAAA,EAAA,GAAC,aAAD,MAAqC,IAArC,IAAqC,EAAA,KAAA,KAAA,CAArC,GAAqC,KAAA,CAArC,GAAqC,EAAA,CAAE,GAAvC,KAA8C,aAAvE;AACA,QAAM,mBAAmB,GAAG,CAAA,CAAA,EAAA,GAAC,aAAD,MAAqC,IAArC,IAAqC,EAAA,KAAA,KA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AMG;;;AACH,OAAO,MAAM,uBAAuB,GAAG,CAAC;AACtC,EAAA,QAAQ,GAAG,cAAc,CAAC,QADY;AAEtC,EAAA,KAAK,GAAG,cAAc,CAAC;AAFe,IAGJ,cAHG,KAIrC,+BAA+B,CAC7B,qBAAqB,CAAC;AACpB,EAAA,YAAY,EAAE,MAAM,CAAC,iBADD;AAEpB,EAAA,aAAa,EAAE,MAAM,CAAC,kBAFF;AAGpB;AACA,EAAA,YAAY,EAAE,KAJM;AAKpB,KAAG;AALiB,CAAD,CADQ,EAQ7B;AAAE,EAAA;AAAF,CAR6B,CAJ1B","sourcesContent":["import { tokens } from '@fluentui/react-theme';\nimport { shorthands } from '@griffel/react';\nimport type { GriffelStyle } from '@griffel/react';\nimport {\n createCustomFocusIndicatorStyle,\n CreateCustomFocusIndicatorStyleOptions,\n} from './createCustomFocusIndicatorStyle';\nimport { defaultOptions } from './constants';\n\nexport type FocusOutlineOffset = Record<'top' | 'bottom' | 'left' | 'right', string>;\nexport type FocusOutlineStyleOptions = {\n /**\n * Only property not supported by the native CSS `outline`, if this is no longer needed\n * we can just go native instead\n */\n outlineRadius: string;\n outlineColor: string;\n outlineWidth: string;\n outlineOffset?: string | FocusOutlineOffset;\n};\nexport interface CreateFocusOutlineStyleOptions extends CreateCustomFocusIndicatorStyleOptions {\n style?: Partial<FocusOutlineStyleOptions>;\n}\n\n/**\n * NOTE: the element with the focus outline needs to have `position: relative` so that the\n * pseudo element can be properly positioned.\n *\n * @param options - Configures the style of the focus outline\n * @returns focus outline styles object\n */\nconst getFocusOutlineStyles = (options: FocusOutlineStyleOptions): GriffelStyle => {\n const { outlineRadius, outlineColor, outlineOffset, outlineWidth } = options;\n\n const outlineOffsetTop = (outlineOffset as FocusOutlineOffset)?.top || outlineOffset;\n const outlineOffsetBottom = (outlineOffset as FocusOutlineOffset)?.bottom || outlineOffset;\n const outlineOffsetLeft = (outlineOffset as FocusOutlineOffset)?.left || outlineOffset;\n const outlineOffsetRight = (outlineOffset as FocusOutlineOffset)?.right || outlineOffset;\n\n return {\n ...shorthands.borderColor('transparent'),\n ':after': {\n content: '\"\"',\n position: 'absolute',\n pointerEvents: 'none',\n zIndex: 1,\n\n ...shorthands.borderStyle('solid'),\n ...shorthands.borderWidth(outlineWidth),\n ...shorthands.borderRadius(outlineRadius),\n ...shorthands.borderColor(outlineColor),\n\n top: !outlineOffset ? `-${outlineWidth}` : `calc(0px - ${outlineWidth} - ${outlineOffsetTop})`,\n bottom: !outlineOffset ? `-${outlineWidth}` : `calc(0px - ${outlineWidth} - ${outlineOffsetBottom})`,\n left: !outlineOffset ? `-${outlineWidth}` : `calc(0px - ${outlineWidth} - ${outlineOffsetLeft})`,\n right: !outlineOffset ? `-${outlineWidth}` : `calc(0px - ${outlineWidth} - ${outlineOffsetRight})`,\n },\n };\n};\n\n/**\n * NOTE: The element with the focus outline needs to have `position: relative` so that the\n * pseudo element can be properly positioned.\n *\n * @param options - Configure the style of the focus outline\n * @returns focus outline styles object for @see makeStyles\n */\nexport const createFocusOutlineStyle = ({\n selector = defaultOptions.selector,\n style = defaultOptions.style,\n}: CreateFocusOutlineStyleOptions = defaultOptions): GriffelStyle =>\n createCustomFocusIndicatorStyle(\n getFocusOutlineStyles({\n outlineColor: tokens.colorStrokeFocus2,\n outlineRadius: tokens.borderRadiusMedium,\n // FIXME: tokens.strokeWidthThick causes some weird bugs\n outlineWidth: '2px',\n ...style,\n }),\n { selector },\n );\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,3 @@
1
+ export * from './createCustomFocusIndicatorStyle';
2
+ export * from './createFocusOutlineStyle';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["focus/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,2BAA2B,CAAC","sourcesContent":["export * from './createCustomFocusIndicatorStyle';\nexport * from './createFocusOutlineStyle';\n"]}
@@ -1,8 +1,7 @@
1
1
  export * from './useArrowNavigationGroup';
2
+ export * from './useFocusableGroup';
2
3
  export * from './useFocusFinders';
4
+ export * from './useKeyboardNavAttribute';
3
5
  export * from './useModalAttributes';
4
6
  export * from './useTabsterAttributes';
5
- export * from './useFocusIndicatorStyle';
6
- export * from './useKeyboardNavAttribute';
7
- export * from './useFocusableGroup';
8
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/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"}
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,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC","sourcesContent":["export * from './useArrowNavigationGroup';\nexport * from './useFocusableGroup';\nexport * from './useFocusFinders';\nexport * from './useKeyboardNavAttribute';\nexport * from './useModalAttributes';\nexport * from './useTabsterAttributes';\n"]}
@@ -6,10 +6,10 @@ import { useTabster } from './useTabster';
6
6
  * @param options - Options to configure keyboard navigation
7
7
  */
8
8
 
9
- export var useArrowNavigationGroup = function (options) {
9
+ export const useArrowNavigationGroup = options => {
10
10
  var _a;
11
11
 
12
- var tabster = useTabster();
12
+ const tabster = useTabster();
13
13
 
14
14
  if (tabster) {
15
15
  getMover(tabster);
@@ -19,7 +19,8 @@ export var useArrowNavigationGroup = function (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":["../../src/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,IAAM,uBAAuB,GAAG,UAAC,OAAD,EAAyC;;;AAC9E,MAAM,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,CAAA,CAAA,EAAA,GAAC,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,IAAV,MAAc,IAAd,IAAc,EAAA,KAAA,KAAA,CAAd,GAAc,EAAd,GAAkB,UAAlB,CAF1B;AAGL,MAAA,eAAe,EAAE,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAA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,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/"}
@@ -4,41 +4,33 @@ import { useTabster } from './useTabster';
4
4
  * Returns a set of helper functions that will traverse focusable elements in the context of a root DOM element
5
5
  */
6
6
 
7
- export var useFocusFinders = function () {
8
- var tabster = useTabster(); // Narrow props for now and let need dictate additional props in the future
7
+ export const useFocusFinders = () => {
8
+ const tabster = useTabster(); // Narrow props for now and let need dictate additional props in the future
9
9
 
10
- var findAllFocusable = React.useCallback(function (container, acceptCondition) {
11
- return (tabster === null || tabster === void 0 ? void 0 : tabster.focusable.findAll({
12
- container: container,
13
- acceptCondition: acceptCondition
14
- })) || [];
15
- }, [tabster]);
16
- var findFirstFocusable = React.useCallback(function (container) {
17
- return tabster === null || tabster === void 0 ? void 0 : tabster.focusable.findFirst({
18
- container: container
19
- });
20
- }, [tabster]);
21
- var findLastFocusable = React.useCallback(function (container) {
22
- return tabster === null || tabster === void 0 ? void 0 : tabster.focusable.findLast({
23
- container: container
24
- });
25
- }, [tabster]);
26
- var findNextFocusable = React.useCallback(function (currentElement) {
27
- return tabster === null || tabster === void 0 ? void 0 : tabster.focusable.findNext({
28
- currentElement: currentElement
29
- });
30
- }, [tabster]);
31
- var findPrevFocusable = React.useCallback(function (currentElement) {
32
- return tabster === null || tabster === void 0 ? void 0 : tabster.focusable.findPrev({
33
- currentElement: currentElement
34
- });
35
- }, [tabster]);
10
+ const findAllFocusable = React.useCallback((container, acceptCondition) => (tabster === null || tabster === void 0 ? void 0 : tabster.focusable.findAll({
11
+ container,
12
+ acceptCondition
13
+ })) || [], [tabster]);
14
+ const findFirstFocusable = React.useCallback(container => tabster === null || tabster === void 0 ? void 0 : tabster.focusable.findFirst({
15
+ container
16
+ }), [tabster]);
17
+ const findLastFocusable = React.useCallback(container => tabster === null || tabster === void 0 ? void 0 : tabster.focusable.findLast({
18
+ container
19
+ }), [tabster]);
20
+ const findNextFocusable = React.useCallback((currentElement, options = {}) => tabster === null || tabster === void 0 ? void 0 : tabster.focusable.findNext({
21
+ currentElement,
22
+ ...options
23
+ }), [tabster]);
24
+ const findPrevFocusable = React.useCallback((currentElement, options = {}) => tabster === null || tabster === void 0 ? void 0 : tabster.focusable.findPrev({
25
+ currentElement,
26
+ ...options
27
+ }), [tabster]);
36
28
  return {
37
- findAllFocusable: findAllFocusable,
38
- findFirstFocusable: findFirstFocusable,
39
- findLastFocusable: findLastFocusable,
40
- findNextFocusable: findNextFocusable,
41
- findPrevFocusable: findPrevFocusable
29
+ findAllFocusable,
30
+ findFirstFocusable,
31
+ findLastFocusable,
32
+ findNextFocusable,
33
+ findPrevFocusable
42
34
  };
43
35
  };
44
36
  //# sourceMappingURL=useFocusFinders.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/hooks/useFocusFinders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,UAAT,QAA2B,cAA3B;AAEA;;AAEG;;AACH,OAAO,IAAM,eAAe,GAAG,YAAA;AAC7B,MAAM,OAAO,GAAG,UAAU,EAA1B,CAD6B,CAG7B;;AACA,MAAM,gBAAgB,GAAG,KAAK,CAAC,WAAN,CACvB,UAAC,SAAD,EAAyB,eAAzB,EAAsE;AACpE,WAAA,CAAA,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,SAAT,CAAmB,OAAnB,CAA2B;AAAE,MAAA,SAAS,EAAA,SAAX;AAAa,MAAA,eAAe,EAAA;AAA5B,KAA3B,CAAA,KAA8D,EAA9D;AAAgE,GAF3C,EAGvB,CAAC,OAAD,CAHuB,CAAzB;AAMA,MAAM,kBAAkB,GAAG,KAAK,CAAC,WAAN,CACzB,UAAC,SAAD,EAAuB;AAAA,WAAK,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,SAAT,CAAmB,SAAnB,CAA6B;AAAE,MAAA,SAAS,EAAA;AAAX,KAA7B,CAAL;AAAgD,GAD9C,EAEzB,CAA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EAAvF,KACE,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,SAAT,CAAmB,QAAnB,CAA4B;AAAE,IAAA,cAAF;AAAkB,OAAG;AAArB,GAA5B,CAFsB,EAGxB,CAAC,OAAD,CAHwB,CAA1B;AAMA,SAAO;AACL,IAAA,gBADK;AAEL,IAAA,kBAFK;AAGL,IAAA,iBAHK;AAIL,IAAA,iBAJK;AAKL,IAAA;AALK,GAAP;AAOD,CAtCM","sourcesContent":["import * as React from 'react';\nimport { Types as TabsterTypes } from 'tabster';\nimport { useTabster } from './useTabster';\n\n/**\n * Returns a set of helper functions that will traverse focusable elements in the context of a root DOM element\n */\nexport const useFocusFinders = () => {\n const tabster = useTabster();\n\n // Narrow props for now and let need dictate additional props in the future\n const findAllFocusable = React.useCallback(\n (container: HTMLElement, acceptCondition: (el: HTMLElement) => boolean) =>\n tabster?.focusable.findAll({ container, acceptCondition }) || [],\n [tabster],\n );\n\n const findFirstFocusable = React.useCallback(\n (container: HTMLElement) => tabster?.focusable.findFirst({ container }),\n [tabster],\n );\n\n const findLastFocusable = React.useCallback((container: HTMLElement) => tabster?.focusable.findLast({ container }), [\n tabster,\n ]);\n\n const findNextFocusable = React.useCallback(\n (currentElement: HTMLElement, options: Pick<TabsterTypes.FindNextProps, 'container'> = {}) =>\n tabster?.focusable.findNext({ currentElement, ...options }),\n [tabster],\n );\n\n const findPrevFocusable = React.useCallback(\n (currentElement: HTMLElement, options: Pick<TabsterTypes.FindNextProps, 'container'> = {}) =>\n tabster?.focusable.findPrev({ currentElement, ...options }),\n [tabster],\n );\n\n return {\n findAllFocusable,\n findFirstFocusable,\n findLastFocusable,\n findNextFocusable,\n findPrevFocusable,\n };\n};\n"],"sourceRoot":"../src/"}
@@ -1,32 +1,13 @@
1
1
  import { Types, getGroupper } from 'tabster';
2
2
  import { useTabsterAttributes } from './useTabsterAttributes';
3
3
  import { useTabster } from './useTabster';
4
- export var FocusableGroupTabBehavior;
5
-
6
- (function (FocusableGroupTabBehavior) {
7
- /**
8
- * Tab will cycle into and out of the groupper content.
9
- */
10
- FocusableGroupTabBehavior[FocusableGroupTabBehavior["Unlimited"] = Types.GroupperTabbabilities.Unlimited] = "Unlimited";
11
- /**
12
- * Tab will cycle out of the container, but not into it.
13
- */
14
-
15
- FocusableGroupTabBehavior[FocusableGroupTabBehavior["Limited"] = Types.GroupperTabbabilities.Limited] = "Limited";
16
- /**
17
- * Tab only cycles the inner elements.
18
- */
19
-
20
- FocusableGroupTabBehavior[FocusableGroupTabBehavior["LimitedTrapFocus"] = Types.GroupperTabbabilities.LimitedTrapFocus] = "LimitedTrapFocus";
21
- })(FocusableGroupTabBehavior || (FocusableGroupTabBehavior = {}));
22
4
  /**
23
5
  * A hook that returns the necessary tabster attributes to support groupping.
24
6
  * @param options - Options to configure keyboard navigation
25
7
  */
26
8
 
27
-
28
- export var useFocusableGroup = function (options) {
29
- var tabster = useTabster();
9
+ export const useFocusableGroup = options => {
10
+ const tabster = useTabster();
30
11
 
31
12
  if (tabster) {
32
13
  getGroupper(tabster);
@@ -34,8 +15,24 @@ export var useFocusableGroup = function (options) {
34
15
 
35
16
  return useTabsterAttributes({
36
17
  groupper: {
37
- tabbability: options === null || options === void 0 ? void 0 : options.tabBehavior
18
+ tabbability: getTabbability(options === null || options === void 0 ? void 0 : options.tabBehavior)
38
19
  }
39
20
  });
40
21
  };
22
+
23
+ const getTabbability = tabBehavior => {
24
+ switch (tabBehavior) {
25
+ case 'unlimited':
26
+ return Types.GroupperTabbabilities.Unlimited;
27
+
28
+ case 'limited':
29
+ return Types.GroupperTabbabilities.Limited;
30
+
31
+ case 'limitedTrapFocus':
32
+ return Types.GroupperTabbabilities.LimitedTrapFocus;
33
+
34
+ default:
35
+ return undefined;
36
+ }
37
+ };
41
38
  //# sourceMappingURL=useFocusableGroup.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/hooks/useFocusableGroup.ts"],"names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O,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/"}
@@ -1,29 +1,27 @@
1
1
  import { createKeyborg } from 'keyborg';
2
2
  import { useEffect, useMemo, useRef } from 'react';
3
- import { KEYBOARD_NAV_ATTRIBUTE } from '../symbols';
3
+ import { KEYBOARD_NAV_ATTRIBUTE } from '../focus/constants';
4
4
  import { useFluent } from '@fluentui/react-shared-contexts';
5
5
  /**
6
6
  * instantiates keyborg and add attribute to ensure focus indicator synced to keyborg logic
7
7
  */
8
8
 
9
9
  export function useKeyboardNavAttribute() {
10
- var targetDocument = useFluent().targetDocument;
11
- var keyborg = useMemo(function () {
12
- return targetDocument && createKeyborg(targetDocument.defaultView);
13
- }, [targetDocument]);
14
- var ref = useRef(null);
15
- useEffect(function () {
10
+ const {
11
+ targetDocument
12
+ } = useFluent();
13
+ const keyborg = useMemo(() => targetDocument && createKeyborg(targetDocument.defaultView), [targetDocument]);
14
+ const ref = useRef(null);
15
+ useEffect(() => {
16
16
  if (keyborg) {
17
17
  setBooleanAttribute(ref, KEYBOARD_NAV_ATTRIBUTE, keyborg.isNavigatingWithKeyboard());
18
18
 
19
- var cb_1 = function (next) {
19
+ const cb = next => {
20
20
  setBooleanAttribute(ref, KEYBOARD_NAV_ATTRIBUTE, next);
21
21
  };
22
22
 
23
- keyborg.subscribe(cb_1);
24
- return function () {
25
- return keyborg.unsubscribe(cb_1);
26
- };
23
+ keyborg.subscribe(cb);
24
+ return () => keyborg.unsubscribe(cb);
27
25
  }
28
26
  }, [keyborg]);
29
27
  return ref;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/hooks/useKeyboardNavAttribute.ts"],"names":[],"mappings":"AAAA,SAAS,aAAT,QAA8B,SAA9B;AACA,SAAS,SAAT,EAAoB,OAApB,EAA6B,MAA7B,QAA2C,OAA3C;AACA,SAAS,sBAAT,QAAuC,YAAvC;AACA,SAAS,SAAT,QAA0B,iCAA1B;AAIA;;AAEG;;AACH,OAAM,SAAU,uBAAV,GAAiC;AAC7B,MAA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ACH,OAAM,SAAU,uBAAV,GAAiC;AACrC,QAAM;AAAE,IAAA;AAAF,MAAqB,SAAS,EAApC;AACA,QAAM,OAAO,GAAG,OAAO,CAAC,MAAM,cAAc,IAAI,aAAa,CAAC,cAAc,CAAC,WAAhB,CAAtC,EAAqE,CAAC,cAAD,CAArE,CAAvB;AACA,QAAM,GAAG,GAAG,MAAM,CAAI,IAAJ,CAAlB;AACA,EAAA,SAAS,CAAC,MAAK;AACb,QAAI,OAAJ,EAAa;AACX,MAAA,mBAAmB,CAAC,GAAD,EAAM,sBAAN,EAA8B,OAAO,CAAC,wBAAR,EAA9B,CAAnB;;AACA,YAAM,EAAE,GAAoB,IAAI,IAAG;AACjC,QAAA,mBAAmB,CAAC,GAAD,EAAM,sBAAN,EAA8B,IAA9B,CAAnB;AACD,OAFD;;AAGA,MAAA,OAAO,CAAC,SAAR,CAAkB,EAAlB;AACA,aAAO,MAAM,OAAO,CAAC,WAAR,CAAoB,EAApB,CAAb;AACD;AACF,GATQ,EASN,CAAC,OAAD,CATM,CAAT;AAUA,SAAO,GAAP;AACD;;AAED,SAAS,mBAAT,CAA6B,UAA7B,EAAiE,SAAjE,EAAoF,KAApF,EAAkG;AAChG,MAAI,CAAC,UAAU,CAAC,OAAhB,EAAyB;AACvB;AACD;;AACD,MAAI,KAAJ,EAAW;AACT,IAAA,UAAU,CAAC,OAAX,CAAmB,YAAnB,CAAgC,SAAhC,EAA2C,EAA3C;AACD,GAFD,MAEO;AACL,IAAA,UAAU,CAAC,OAAX,CAAmB,eAAnB,CAAmC,SAAnC;AACD;AACF","sourcesContent":["import { createKeyborg } from 'keyborg';\nimport { useEffect, useMemo, useRef } from 'react';\nimport { KEYBOARD_NAV_ATTRIBUTE } from '../focus/constants';\nimport { useFluent } from '@fluentui/react-shared-contexts';\nimport type { KeyborgCallback } from 'keyborg/dist/Keyborg';\nimport type { RefObject } from 'react';\n\n/**\n * instantiates keyborg and add attribute to ensure focus indicator synced to keyborg logic\n */\nexport function useKeyboardNavAttribute<E extends HTMLElement>() {\n const { targetDocument } = useFluent();\n const keyborg = useMemo(() => targetDocument && createKeyborg(targetDocument.defaultView!), [targetDocument]);\n const ref = useRef<E>(null);\n useEffect(() => {\n if (keyborg) {\n setBooleanAttribute(ref, KEYBOARD_NAV_ATTRIBUTE, keyborg.isNavigatingWithKeyboard());\n const cb: KeyborgCallback = next => {\n setBooleanAttribute(ref, KEYBOARD_NAV_ATTRIBUTE, next);\n };\n keyborg.subscribe(cb);\n return () => keyborg.unsubscribe(cb);\n }\n }, [keyborg]);\n return ref;\n}\n\nfunction setBooleanAttribute(elementRef: RefObject<HTMLElement>, attribute: string, value: boolean) {\n if (!elementRef.current) {\n return;\n }\n if (value) {\n elementRef.current.setAttribute(attribute, '');\n } else {\n elementRef.current.removeAttribute(attribute);\n }\n}\n"],"sourceRoot":"../src/"}
@@ -10,35 +10,33 @@ import { useTabster } from './useTabster';
10
10
  * @returns DOM attributes to apply to the modal element and its trigger
11
11
  */
12
12
 
13
- export var useModalAttributes = function (options) {
14
- if (options === void 0) {
15
- options = {};
16
- }
17
-
18
- var trapFocus = options.trapFocus,
19
- alwaysFocusable = options.alwaysFocusable;
20
- var tabster = useTabster(); // Initializes the modalizer and deloser APIs
13
+ export const useModalAttributes = (options = {}) => {
14
+ const {
15
+ trapFocus,
16
+ alwaysFocusable
17
+ } = options;
18
+ const tabster = useTabster(); // Initializes the modalizer and deloser APIs
21
19
 
22
20
  if (tabster) {
23
21
  getModalizer(tabster);
24
22
  getDeloser(tabster);
25
23
  }
26
24
 
27
- var id = useId('modal-');
28
- var modalAttributes = useTabsterAttributes({
25
+ const id = useId('modal-');
26
+ const modalAttributes = useTabsterAttributes({
29
27
  deloser: {},
30
28
  modalizer: {
31
- id: id,
29
+ id,
32
30
  isOthersAccessible: !trapFocus,
33
31
  isAlwaysAccessible: alwaysFocusable
34
32
  }
35
33
  });
36
- var triggerAttributes = useTabsterAttributes({
34
+ const triggerAttributes = useTabsterAttributes({
37
35
  deloser: {}
38
36
  });
39
37
  return {
40
- modalAttributes: modalAttributes,
41
- triggerAttributes: triggerAttributes
38
+ modalAttributes,
39
+ triggerAttributes
42
40
  };
43
41
  };
44
42
  //# sourceMappingURL=useModalAttributes.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/hooks/useModalAttributes.ts"],"names":[],"mappings":"AAAA,SAAS,KAAT,QAAsB,2BAAtB;AACA,SAAS,oBAAT,QAAqC,wBAArC;AACA,SAAS,UAAT,EAAqB,YAArB,QAAgE,SAAhE;AACA,SAAS,UAAT,QAA2B,cAA3B;AAcA;;;;;;AAMG;;AACH,OAAO,IAAM,kBAAkB,GAAG,UAChC,OADgC,EACO;AAAvC,MAAA,OAAA,KAAA,KAAA,CAAA,EAAA;AAAA,IAAA,OAAA,GAAA,EAAA;AAAuC;;AAE/B,MAAA,SAAS,GAAsB,OAAO,CAA7B,SAAT;AAAA,MAAW,eAAe,GAAK,OAAO,CAAZ,eAA1B;AACR,MAAM,OAAO,GAAG,UAAU,EAA1B,CAHuC,CAIvC;;AACA,MAAI,OAAJ,EAAa;AACX,IAAA,YAAY,CAAC,OAAD,CAAZ;AACA,IAAA,UAAU,CAAC,OAAD,CAAV;AACD;;AAED,MAAM,EAAE,GAAG,KAAK,CAAC,QAAD,CAAhB;AACA,MAAM,eAAe,GAAG,oBAAoB,CAAC;AAC3C,IAAA,OAAO,EAAE,EADkC;AAE3C,IAAA,SAAS,EAAE;AAAE,MAAA,EAAE,EAAA,EAAJ;AAAM,MAAA,kBAAkB,EAAE,CAAC,SAA3B;AAAsC,MAAA,kBAAkB,EAAE;AAA1D;AAFgC,GAAD,CAA5C;AAKA,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AAC7C,IAAA,OAAO,EAAE;AADoC,GAAD,CAA9C;AAIA,SAAO;AAAE,IAAA,eAAe,EAAA,eAAjB;AAAmB,IAAA,iBAAiB,EAAA;AAApC,GAAP;AACD,CAtBM","sourceRoot":""}
1
+ {"version":3,"sources":["hooks/useModalAttributes.ts"],"names":[],"mappings":"AAAA,SAAS,KAAT,QAAsB,2BAAtB;AACA,SAAS,oBAAT,QAAqC,wBAArC;AACA,SAAS,UAAT,EAAqB,YAArB,QAAgE,SAAhE;AACA,SAAS,UAAT,QAA2B,cAA3B;AAcA;;;;;;AAMG;;AACH,OAAO,MAAM,kBAAkB,GAAG,CAChC,OAAA,GAAqC,EADL,KAE8E;AAC9G,QAAM;AAAE,IAAA,SAAF;AAAa,IAAA;AAAb,MAAiC,OAAvC;AACA,QAAM,OAAO,GAAG,UAAU,EAA1B,CAF8G,CAG9G;;AACA,MAAI,OAAJ,EAAa;AACX,IAAA,YAAY,CAAC,OAAD,CAAZ;AACA,IAAA,UAAU,CAAC,OAAD,CAAV;AACD;;AAED,QAAM,EAAE,GAAG,KAAK,CAAC,QAAD,CAAhB;AACA,QAAM,eAAe,GAAG,oBAAoB,CAAC;AAC3C,IAAA,OAAO,EAAE,EADkC;AAE3C,IAAA,SAAS,EAAE;AAAE,MAAA,EAAF;AAAM,MAAA,kBAAkB,EAAE,CAAC,SAA3B;AAAsC,MAAA,kBAAkB,EAAE;AAA1D;AAFgC,GAAD,CAA5C;AAKA,QAAM,iBAAiB,GAAG,oBAAoB,CAAC;AAC7C,IAAA,OAAO,EAAE;AADoC,GAAD,CAA9C;AAIA,SAAO;AAAE,IAAA,eAAF;AAAmB,IAAA;AAAnB,GAAP;AACD,CAtBM","sourcesContent":["import { useId } from '@fluentui/react-utilities';\nimport { useTabsterAttributes } from './useTabsterAttributes';\nimport { getDeloser, getModalizer, Types as TabsterTypes } from 'tabster';\nimport { useTabster } from './useTabster';\n\nexport interface UseModalAttributesOptions {\n /**\n * Traps focus inside the elements the attributes are applied\n */\n trapFocus?: boolean;\n\n /**\n * Always reachabled in Tab order\n */\n alwaysFocusable?: boolean;\n}\n\n/**\n * Applies modal dialog behaviour through DOM attributes\n * Modal element will focus trap and hide other content on the page\n * The trigger element will be focused if focus is lost after the modal element is removed\n *\n * @returns DOM attributes to apply to the modal element and its trigger\n */\nexport const useModalAttributes = (\n options: UseModalAttributesOptions = {},\n): { modalAttributes: TabsterTypes.TabsterDOMAttribute; triggerAttributes: TabsterTypes.TabsterDOMAttribute } => {\n const { trapFocus, alwaysFocusable } = options;\n const tabster = useTabster();\n // Initializes the modalizer and deloser APIs\n if (tabster) {\n getModalizer(tabster);\n getDeloser(tabster);\n }\n\n const id = useId('modal-');\n const modalAttributes = useTabsterAttributes({\n deloser: {},\n modalizer: { id, isOthersAccessible: !trapFocus, isAlwaysAccessible: alwaysFocusable },\n });\n\n const triggerAttributes = useTabsterAttributes({\n deloser: {},\n });\n\n return { modalAttributes, triggerAttributes };\n};\n"],"sourceRoot":"../src/"}
@@ -8,13 +8,16 @@ import { getCurrentTabster, createTabster } from 'tabster';
8
8
  * @returns Tabster core instance
9
9
  */
10
10
 
11
- export var useTabster = function () {
11
+ export const useTabster = () => {
12
12
  var _a;
13
13
 
14
- var targetDocument = useFluent().targetDocument;
15
- var defaultView = (targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView) || undefined;
16
- var tabsterOptions = {
17
- autoRoot: {}
14
+ const {
15
+ targetDocument
16
+ } = useFluent();
17
+ const defaultView = (targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView) || undefined;
18
+ const tabsterOptions = {
19
+ autoRoot: {},
20
+ controlTab: false
18
21
  };
19
22
 
20
23
  if (!defaultView) {