@fluentui/react-tabster 0.0.0-nightlyfc5cfdc52420220215.1 → 0.0.0

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 (82) hide show
  1. package/CHANGELOG.json +460 -10
  2. package/CHANGELOG.md +231 -85
  3. package/README.md +5 -14
  4. package/dist/{react-tabster.d.ts → index.d.ts} +30 -11
  5. package/{lib → dist}/tsdoc-metadata.json +0 -0
  6. package/lib/{symbols.js → focus/constants.js} +5 -1
  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/{hooks/useFocusIndicatorStyle.js → focus/createFocusOutlineStyle.js} +21 -41
  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 +5 -1
  17. package/lib/hooks/useArrowNavigationGroup.js.map +1 -1
  18. package/lib/hooks/useFocusFinders.js.map +1 -1
  19. package/lib/hooks/useFocusableGroup.js +1 -1
  20. package/lib/hooks/useFocusableGroup.js.map +1 -1
  21. package/lib/hooks/useKeyboardNavAttribute.js +5 -3
  22. package/lib/hooks/useKeyboardNavAttribute.js.map +1 -1
  23. package/lib/hooks/useModalAttributes.js +4 -2
  24. package/lib/hooks/useModalAttributes.js.map +1 -1
  25. package/lib/hooks/useTabster.js +1 -1
  26. package/lib/hooks/useTabster.js.map +1 -1
  27. package/lib/hooks/useTabsterAttributes.js +1 -0
  28. package/lib/hooks/useTabsterAttributes.js.map +1 -1
  29. package/lib/index.js +2 -1
  30. package/lib/index.js.map +1 -1
  31. package/lib-commonjs/{symbols.js → focus/constants.js} +6 -2
  32. package/lib-commonjs/focus/constants.js.map +1 -0
  33. package/lib-commonjs/focus/createCustomFocusIndicatorStyle.js +28 -0
  34. package/lib-commonjs/focus/createCustomFocusIndicatorStyle.js.map +1 -0
  35. package/lib-commonjs/{hooks/useFocusIndicatorStyle.js → focus/createFocusOutlineStyle.js} +25 -45
  36. package/lib-commonjs/focus/createFocusOutlineStyle.js.map +1 -0
  37. package/lib-commonjs/focus/index.js +12 -0
  38. package/lib-commonjs/focus/index.js.map +1 -0
  39. package/lib-commonjs/hooks/index.js +4 -6
  40. package/lib-commonjs/hooks/index.js.map +1 -1
  41. package/lib-commonjs/hooks/useArrowNavigationGroup.js +5 -1
  42. package/lib-commonjs/hooks/useArrowNavigationGroup.js.map +1 -1
  43. package/lib-commonjs/hooks/useFocusFinders.js.map +1 -1
  44. package/lib-commonjs/hooks/useFocusableGroup.js +1 -1
  45. package/lib-commonjs/hooks/useFocusableGroup.js.map +1 -1
  46. package/lib-commonjs/hooks/useKeyboardNavAttribute.js +7 -5
  47. package/lib-commonjs/hooks/useKeyboardNavAttribute.js.map +1 -1
  48. package/lib-commonjs/hooks/useModalAttributes.js +4 -2
  49. package/lib-commonjs/hooks/useModalAttributes.js.map +1 -1
  50. package/lib-commonjs/hooks/useTabster.js +1 -1
  51. package/lib-commonjs/hooks/useTabster.js.map +1 -1
  52. package/lib-commonjs/hooks/useTabsterAttributes.js +1 -0
  53. package/lib-commonjs/hooks/useTabsterAttributes.js.map +1 -1
  54. package/lib-commonjs/index.js +53 -2
  55. package/lib-commonjs/index.js.map +1 -1
  56. package/package.json +20 -18
  57. package/lib/hooks/index.d.ts +0 -7
  58. package/lib/hooks/useArrowNavigationGroup.d.ts +0 -22
  59. package/lib/hooks/useFocusFinders.d.ts +0 -11
  60. package/lib/hooks/useFocusIndicatorStyle.d.ts +0 -33
  61. package/lib/hooks/useFocusIndicatorStyle.js.map +0 -1
  62. package/lib/hooks/useFocusableGroup.d.ts +0 -12
  63. package/lib/hooks/useKeyboardNavAttribute.d.ts +0 -5
  64. package/lib/hooks/useModalAttributes.d.ts +0 -22
  65. package/lib/hooks/useTabster.d.ts +0 -9
  66. package/lib/hooks/useTabsterAttributes.d.ts +0 -5
  67. package/lib/index.d.ts +0 -1
  68. package/lib/symbols.d.ts +0 -2
  69. package/lib/symbols.js.map +0 -1
  70. package/lib-commonjs/hooks/index.d.ts +0 -7
  71. package/lib-commonjs/hooks/useArrowNavigationGroup.d.ts +0 -22
  72. package/lib-commonjs/hooks/useFocusFinders.d.ts +0 -11
  73. package/lib-commonjs/hooks/useFocusIndicatorStyle.d.ts +0 -33
  74. package/lib-commonjs/hooks/useFocusIndicatorStyle.js.map +0 -1
  75. package/lib-commonjs/hooks/useFocusableGroup.d.ts +0 -12
  76. package/lib-commonjs/hooks/useKeyboardNavAttribute.d.ts +0 -5
  77. package/lib-commonjs/hooks/useModalAttributes.d.ts +0 -22
  78. package/lib-commonjs/hooks/useTabster.d.ts +0 -9
  79. package/lib-commonjs/hooks/useTabsterAttributes.d.ts +0 -5
  80. package/lib-commonjs/index.d.ts +0 -1
  81. package/lib-commonjs/symbols.d.ts +0 -2
  82. package/lib-commonjs/symbols.js.map +0 -1
@@ -1,22 +0,0 @@
1
- import { Types as TabsterTypes } from 'tabster';
2
- export interface UseModalAttributesOptions {
3
- /**
4
- * Traps focus inside the elements the attributes are applied
5
- */
6
- trapFocus?: boolean;
7
- /**
8
- * Always reachabled in Tab order
9
- */
10
- alwaysFocusable?: boolean;
11
- }
12
- /**
13
- * Applies modal dialog behaviour through DOM attributes
14
- * Modal element will focus trap and hide other content on the page
15
- * The trigger element will be focused if focus is lost after the modal element is removed
16
- *
17
- * @returns DOM attributes to apply to the modal element and its trigger
18
- */
19
- export declare const useModalAttributes: (options?: UseModalAttributesOptions) => {
20
- modalAttributes: TabsterTypes.TabsterDOMAttribute;
21
- triggerAttributes: TabsterTypes.TabsterDOMAttribute;
22
- };
@@ -1,9 +0,0 @@
1
- import { Types as TabsterTypes } from 'tabster';
2
- /**
3
- * Tries to get a tabster instance on the current window or creates a new one
4
- * Since Tabster is single instance only, feel free to call this hook to ensure Tabster exists if necessary
5
- *
6
- * @internal
7
- * @returns Tabster core instance
8
- */
9
- export declare const useTabster: () => TabsterTypes.TabsterCore | null;
@@ -1,5 +0,0 @@
1
- import { Types as TabsterTypes } from 'tabster';
2
- /**
3
- * Hook that returns tabster attributes while ensuring tabster exists
4
- */
5
- export declare const useTabsterAttributes: (props: TabsterTypes.TabsterAttributeProps) => TabsterTypes.TabsterDOMAttribute;
package/lib/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './hooks/index';
package/lib/symbols.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare const KEYBOARD_NAV_ATTRIBUTE: "data-keyboard-nav";
2
- export declare const KEYBOARD_NAV_SELECTOR: ":global([data-keyboard-nav])";
@@ -1 +0,0 @@
1
- {"version":3,"file":"symbols.js","sourceRoot":"","sources":["../src/symbols.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAA4B,CAAC;AACnE,MAAM,CAAC,MAAM,qBAAqB,GAAG,YAAY,sBAAsB,IAAa,CAAC"}
@@ -1,7 +0,0 @@
1
- export * from './useArrowNavigationGroup';
2
- export * from './useFocusFinders';
3
- export * from './useModalAttributes';
4
- export * from './useTabsterAttributes';
5
- export * from './useFocusIndicatorStyle';
6
- export * from './useKeyboardNavAttribute';
7
- export * from './useFocusableGroup';
@@ -1,22 +0,0 @@
1
- import { Types } from 'tabster';
2
- export interface UseArrowNavigationGroupOptions {
3
- /**
4
- * Focus will navigate vertically or horizontally, defaults to horizontally
5
- * @defaultValue vertical
6
- */
7
- axis?: 'vertical' | 'horizontal';
8
- /**
9
- * Focus will cycle to the first/last elements of the group without stopping
10
- */
11
- circular?: boolean;
12
- /**
13
- * Last focused element in the group will be remembered and focused (if still
14
- * available) when tabbing from outside of the group
15
- */
16
- memorizeCurrent?: boolean;
17
- }
18
- /**
19
- * A hook that returns the necessary tabster attributes to support arrow key navigation
20
- * @param options - Options to configure keyboard navigation
21
- */
22
- export declare const useArrowNavigationGroup: (options?: UseArrowNavigationGroupOptions | undefined) => Types.TabsterDOMAttribute;
@@ -1,11 +0,0 @@
1
- import { Types as TabsterTypes } from 'tabster';
2
- /**
3
- * Returns a set of helper functions that will traverse focusable elements in the context of a root DOM element
4
- */
5
- export declare const useFocusFinders: () => {
6
- findAllFocusable: (container: HTMLElement, acceptCondition: (el: HTMLElement) => boolean) => HTMLElement[];
7
- findFirstFocusable: (container: HTMLElement) => HTMLElement | null | undefined;
8
- findLastFocusable: (container: HTMLElement) => HTMLElement | null | undefined;
9
- findNextFocusable: (currentElement: HTMLElement, options?: Pick<TabsterTypes.FindNextProps, 'container'>) => HTMLElement | null | undefined;
10
- findPrevFocusable: (currentElement: HTMLElement, options?: Pick<TabsterTypes.FindNextProps, 'container'>) => HTMLElement | null | undefined;
11
- };
@@ -1,33 +0,0 @@
1
- import type { GriffelStyle } from '@griffel/react';
2
- export declare type FocusOutlineOffset = Record<'top' | 'bottom' | 'left' | 'right', string>;
3
- export declare type FocusOutlineStyleOptions = {
4
- /**
5
- * Only property not supported by the native CSS `outline`, if this is no longer needed
6
- * we can just go native instead
7
- */
8
- outlineRadius: string;
9
- outlineColor: string;
10
- outlineWidth: string;
11
- outlineOffset?: string | FocusOutlineOffset;
12
- };
13
- export interface CreateFocusIndicatorStyleRuleOptions {
14
- selector?: 'focus' | 'focus-within';
15
- }
16
- /**
17
- * NOTE: The element with the focus outline needs to have `position: relative` so that the
18
- * pseudo element can be properly positioned.
19
- *
20
- * @param theme - Theme used in @see makeStyles
21
- * @param options - Configure the style of the focus outline
22
- * @returns focus outline styles object for @see makeStyles
23
- */
24
- export declare const createFocusOutlineStyle: (options?: {
25
- style: Partial<FocusOutlineStyleOptions>;
26
- } & CreateFocusIndicatorStyleRuleOptions) => GriffelStyle;
27
- /**
28
- * Creates a style for @see makeStyles that includes the necessary selectors for focus.
29
- * Should be used only when @see createFocusOutlineStyle does not fit requirements
30
- *
31
- * @param style - styling applied on focus, defaults to @see getDefaultFocusOutlineStyes
32
- */
33
- export declare const createCustomFocusIndicatorStyle: (style: GriffelStyle, options?: CreateFocusIndicatorStyleRuleOptions) => GriffelStyle;
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/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,EAAA,KAAA,KAAA,CAArC,GAAqC,KAAA,CAArC,GAAqC,EAAA,CAAE,MAAvC,KAAiD,aAA7E;AACA,QAAM,iBAAiB,GAAG,CAAA,CAAA,EAAA,GAAC,aAAD,MAAqC,IAArC,IAAqC,EAAA,KAAA,KAAA,CAArC,GAAqC,KAAA,CAArC,GAAqC,EAAA,CAAE,IAAvC,KAA+C,aAAzE;AACA,QAAM,kBAAkB,GAAG,CAAA,CAAA,EAAA,GAAC,aAAD,MAAqC,IAArC,IAAqC,EAAA,KAAA,KAAA,CAArC,GAAqC,KAAA,CAArC,GAAqC,EAAA,CAAE,KAAvC,KAAgD,aAA3E;AAEA,SAAO;AACL,IAAA,WAAW,EAAE,aADR;AAEL,cAAU;AACR,MAAA,OAAO,EAAE,IADD;AAER,MAAA,QAAQ,EAAE,UAFF;AAGR,MAAA,aAAa,E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BAAvB;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","sourceRoot":""}
@@ -1,12 +0,0 @@
1
- import { Types } from 'tabster';
2
- export interface UseFocusableGroupOptions {
3
- /**
4
- * Behavior for the Tab key.
5
- */
6
- tabBehavior?: 'unlimited' | 'limited' | 'limitedTrapFocus';
7
- }
8
- /**
9
- * A hook that returns the necessary tabster attributes to support groupping.
10
- * @param options - Options to configure keyboard navigation
11
- */
12
- export declare const useFocusableGroup: (options?: UseFocusableGroupOptions | undefined) => Types.TabsterDOMAttribute;
@@ -1,5 +0,0 @@
1
- import type { RefObject } from 'react';
2
- /**
3
- * instantiates keyborg and add attribute to ensure focus indicator synced to keyborg logic
4
- */
5
- export declare function useKeyboardNavAttribute<E extends HTMLElement>(): RefObject<E>;
@@ -1,22 +0,0 @@
1
- import { Types as TabsterTypes } from 'tabster';
2
- export interface UseModalAttributesOptions {
3
- /**
4
- * Traps focus inside the elements the attributes are applied
5
- */
6
- trapFocus?: boolean;
7
- /**
8
- * Always reachabled in Tab order
9
- */
10
- alwaysFocusable?: boolean;
11
- }
12
- /**
13
- * Applies modal dialog behaviour through DOM attributes
14
- * Modal element will focus trap and hide other content on the page
15
- * The trigger element will be focused if focus is lost after the modal element is removed
16
- *
17
- * @returns DOM attributes to apply to the modal element and its trigger
18
- */
19
- export declare const useModalAttributes: (options?: UseModalAttributesOptions) => {
20
- modalAttributes: TabsterTypes.TabsterDOMAttribute;
21
- triggerAttributes: TabsterTypes.TabsterDOMAttribute;
22
- };
@@ -1,9 +0,0 @@
1
- import { Types as TabsterTypes } from 'tabster';
2
- /**
3
- * Tries to get a tabster instance on the current window or creates a new one
4
- * Since Tabster is single instance only, feel free to call this hook to ensure Tabster exists if necessary
5
- *
6
- * @internal
7
- * @returns Tabster core instance
8
- */
9
- export declare const useTabster: () => TabsterTypes.TabsterCore | null;
@@ -1,5 +0,0 @@
1
- import { Types as TabsterTypes } from 'tabster';
2
- /**
3
- * Hook that returns tabster attributes while ensuring tabster exists
4
- */
5
- export declare const useTabsterAttributes: (props: TabsterTypes.TabsterAttributeProps) => TabsterTypes.TabsterDOMAttribute;
@@ -1 +0,0 @@
1
- export * from './hooks/index';
@@ -1,2 +0,0 @@
1
- export declare const KEYBOARD_NAV_ATTRIBUTE: "data-keyboard-nav";
2
- export declare const KEYBOARD_NAV_SELECTOR: ":global([data-keyboard-nav])";
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/symbols.ts"],"names":[],"mappings":";;;;;;AAAa,OAAA,CAAA,sBAAA,GAAyB,mBAAzB;AACA,OAAA,CAAA,qBAAA,GAAwB,YAAY,OAAA,CAAA,sBAAsB,IAA1D","sourceRoot":""}