@fluentui/react-tabster 9.10.0 → 9.11.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.
package/CHANGELOG.json CHANGED
@@ -2,7 +2,22 @@
2
2
  "name": "@fluentui/react-tabster",
3
3
  "entries": [
4
4
  {
5
- "date": "Mon, 03 Jul 2023 13:32:38 GMT",
5
+ "date": "Tue, 25 Jul 2023 13:26:25 GMT",
6
+ "tag": "@fluentui/react-tabster_v9.11.0",
7
+ "version": "9.11.0",
8
+ "comments": {
9
+ "minor": [
10
+ {
11
+ "author": "lingfan.gao@microsoft.com",
12
+ "package": "@fluentui/react-tabster",
13
+ "commit": "c0c62f9383781f0dbebd800eaa2c64ef761075a2",
14
+ "comment": "feat: Implement useRestoreFocusSource and useRestoreFocusTarget based on the tabster restorer API"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Mon, 03 Jul 2023 13:34:27 GMT",
6
21
  "tag": "@fluentui/react-tabster_v9.10.0",
7
22
  "version": "9.10.0",
8
23
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,21 @@
1
1
  # Change Log - @fluentui/react-tabster
2
2
 
3
- This log was last generated on Mon, 03 Jul 2023 13:32:38 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 25 Jul 2023 13:26:25 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.11.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabster_v9.11.0)
8
+
9
+ Tue, 25 Jul 2023 13:26:25 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabster_v9.10.0..@fluentui/react-tabster_v9.11.0)
11
+
12
+ ### Minor changes
13
+
14
+ - feat: Implement useRestoreFocusSource and useRestoreFocusTarget based on the tabster restorer API ([PR #28530](https://github.com/microsoft/fluentui/pull/28530) by lingfan.gao@microsoft.com)
15
+
7
16
  ## [9.10.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabster_v9.10.0)
8
17
 
9
- Mon, 03 Jul 2023 13:32:38 GMT
18
+ Mon, 03 Jul 2023 13:34:27 GMT
10
19
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabster_v9.9.2..@fluentui/react-tabster_v9.10.0)
11
20
 
12
21
  ### Minor changes
package/dist/index.d.ts CHANGED
@@ -213,6 +213,18 @@ export declare interface UseModalAttributesOptions {
213
213
 
214
214
  export declare function useObservedElement(name: string | string[]): Types.TabsterDOMAttribute;
215
215
 
216
+ /**
217
+ * Focus will be restored to the most recent target element when it is lost from a source
218
+ * @returns Attribute to apply to the element that might lose focus
219
+ */
220
+ export declare function useRestoreFocusSource(): Types.TabsterDOMAttribute;
221
+
222
+ /**
223
+ * Focus will be restored to the most recent target element when it is lost from a source
224
+ * @returns Attribute to apply to the target element where focus is restored
225
+ */
226
+ export declare function useRestoreFocusTarget(): Types.TabsterDOMAttribute;
227
+
216
228
  /**
217
229
  * @internal
218
230
  * Hook that returns tabster attributes while ensuring tabster exists
@@ -9,3 +9,4 @@ export * from './useTabsterAttributes';
9
9
  export * from './useObservedElement';
10
10
  export * from './useMergeTabsterAttributes';
11
11
  export * from './useFocusObserved';
12
+ export * from './useRestoreFocus';
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './useArrowNavigationGroup';\nexport * from './useFocusableGroup';\nexport * from './useFocusFinders';\nexport * from './useFocusVisible';\nexport * from './useFocusWithin';\nexport * from './useKeyboardNavAttribute';\nexport * from './useModalAttributes';\nexport * from './useTabsterAttributes';\nexport * from './useObservedElement';\nexport * from './useMergeTabsterAttributes';\nexport * from './useFocusObserved';\n"],"names":[],"mappings":"AAAA,cAAc,4BAA4B;AAC1C,cAAc,sBAAsB;AACpC,cAAc,oBAAoB;AAClC,cAAc,oBAAoB;AAClC,cAAc,mBAAmB;AACjC,cAAc,4BAA4B;AAC1C,cAAc,uBAAuB;AACrC,cAAc,yBAAyB;AACvC,cAAc,uBAAuB;AACrC,cAAc,8BAA8B;AAC5C,cAAc,qBAAqB"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './useArrowNavigationGroup';\nexport * from './useFocusableGroup';\nexport * from './useFocusFinders';\nexport * from './useFocusVisible';\nexport * from './useFocusWithin';\nexport * from './useKeyboardNavAttribute';\nexport * from './useModalAttributes';\nexport * from './useTabsterAttributes';\nexport * from './useObservedElement';\nexport * from './useMergeTabsterAttributes';\nexport * from './useFocusObserved';\nexport * from './useRestoreFocus';\n"],"names":[],"mappings":"AAAA,cAAc,4BAA4B;AAC1C,cAAc,sBAAsB;AACpC,cAAc,oBAAoB;AAClC,cAAc,oBAAoB;AAClC,cAAc,mBAAmB;AACjC,cAAc,4BAA4B;AAC1C,cAAc,uBAAuB;AACrC,cAAc,yBAAyB;AACvC,cAAc,uBAAuB;AACrC,cAAc,8BAA8B;AAC5C,cAAc,qBAAqB;AACnC,cAAc,oBAAoB"}
@@ -1,6 +1,6 @@
1
1
  import { useId } from '@fluentui/react-utilities';
2
2
  import { useTabsterAttributes } from './useTabsterAttributes';
3
- import { getDeloser, getModalizer } from 'tabster';
3
+ import { getModalizer, getRestorer, Types as TabsterTypes } from 'tabster';
4
4
  import { useTabster } from './useTabster';
5
5
  /**
6
6
  * Applies modal dialog behaviour through DOM attributes
@@ -11,14 +11,16 @@ import { useTabster } from './useTabster';
11
11
  */ export const useModalAttributes = (options = {})=>{
12
12
  const { trapFocus , alwaysFocusable , legacyTrapFocus } = options;
13
13
  const tabster = useTabster();
14
- // Initializes the modalizer and deloser APIs
14
+ // Initializes the modalizer and restorer APIs
15
15
  if (tabster) {
16
16
  getModalizer(tabster);
17
- getDeloser(tabster);
17
+ getRestorer(tabster);
18
18
  }
19
19
  const id = useId('modal-', options.id);
20
20
  const modalAttributes = useTabsterAttributes({
21
- deloser: {},
21
+ restorer: {
22
+ type: TabsterTypes.RestorerTypes.Source
23
+ },
22
24
  modalizer: {
23
25
  id,
24
26
  isOthersAccessible: !trapFocus,
@@ -27,7 +29,9 @@ import { useTabster } from './useTabster';
27
29
  }
28
30
  });
29
31
  const triggerAttributes = useTabsterAttributes({
30
- deloser: {}
32
+ restorer: {
33
+ type: TabsterTypes.RestorerTypes.Target
34
+ }
31
35
  });
32
36
  return {
33
37
  modalAttributes,
@@ -1 +1 @@
1
- {"version":3,"sources":["useModalAttributes.ts"],"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 * Prefer this to `legacyTrapFocus`\n * it forbids users to tab out of the focus trap into the actual browser.\n */\n trapFocus?: boolean;\n\n /**\n * Traps focus inside the elements the attributes are applied.\n * This prop enables legacy behavior to match previous versions of Fluent and is not\n * recommended for general use.\n * Enabling `legacyTrapFocus` prevents users from tabbing out of the focus trap and into\n * the actual browser. Prefer using `trapFocus` instead of this prop.\n */\n legacyTrapFocus?: boolean;\n\n /**\n * Always reachabled in Tab order\n */\n alwaysFocusable?: boolean;\n\n /**\n * Id to use for the modalizer. An id will be generated if not provided.\n */\n id?: string;\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, legacyTrapFocus } = 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-', options.id);\n const modalAttributes = useTabsterAttributes({\n deloser: {},\n modalizer: {\n id,\n isOthersAccessible: !trapFocus,\n isAlwaysAccessible: alwaysFocusable,\n isTrapped: legacyTrapFocus && trapFocus,\n },\n });\n\n const triggerAttributes = useTabsterAttributes({\n deloser: {},\n });\n\n return { modalAttributes, triggerAttributes };\n};\n"],"names":["useId","useTabsterAttributes","getDeloser","getModalizer","useTabster","useModalAttributes","options","trapFocus","alwaysFocusable","legacyTrapFocus","tabster","id","modalAttributes","deloser","modalizer","isOthersAccessible","isAlwaysAccessible","isTrapped","triggerAttributes"],"mappings":"AAAA,SAASA,KAAK,QAAQ,4BAA4B;AAClD,SAASC,oBAAoB,QAAQ,yBAAyB;AAC9D,SAASC,UAAU,EAAEC,YAAY,QAA+B,UAAU;AAC1E,SAASC,UAAU,QAAQ,eAAe;AA8B1C;;;;;;CAMC,GACD,OAAO,MAAMC,qBAAqB,CAChCC,UAAqC,CAAC,CAAC,GACwE;IAC/G,MAAM,EAAEC,UAAS,EAAEC,gBAAe,EAAEC,gBAAe,EAAE,GAAGH;IACxD,MAAMI,UAAUN;IAChB,6CAA6C;IAC7C,IAAIM,SAAS;QACXP,aAAaO;QACbR,WAAWQ;IACb,CAAC;IAED,MAAMC,KAAKX,MAAM,UAAUM,QAAQK,EAAE;IACrC,MAAMC,kBAAkBX,qBAAqB;QAC3CY,SAAS,CAAC;QACVC,WAAW;YACTH;YACAI,oBAAoB,CAACR;YACrBS,oBAAoBR;YACpBS,WAAWR,mBAAmBF;QAChC;IACF;IAEA,MAAMW,oBAAoBjB,qBAAqB;QAC7CY,SAAS,CAAC;IACZ;IAEA,OAAO;QAAED;QAAiBM;IAAkB;AAC9C,EAAE"}
1
+ {"version":3,"sources":["useModalAttributes.ts"],"sourcesContent":["import { useId } from '@fluentui/react-utilities';\nimport { useTabsterAttributes } from './useTabsterAttributes';\nimport { getModalizer, getRestorer, 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 * Prefer this to `legacyTrapFocus`\n * it forbids users to tab out of the focus trap into the actual browser.\n */\n trapFocus?: boolean;\n\n /**\n * Traps focus inside the elements the attributes are applied.\n * This prop enables legacy behavior to match previous versions of Fluent and is not\n * recommended for general use.\n * Enabling `legacyTrapFocus` prevents users from tabbing out of the focus trap and into\n * the actual browser. Prefer using `trapFocus` instead of this prop.\n */\n legacyTrapFocus?: boolean;\n\n /**\n * Always reachabled in Tab order\n */\n alwaysFocusable?: boolean;\n\n /**\n * Id to use for the modalizer. An id will be generated if not provided.\n */\n id?: string;\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, legacyTrapFocus } = options;\n const tabster = useTabster();\n // Initializes the modalizer and restorer APIs\n if (tabster) {\n getModalizer(tabster);\n getRestorer(tabster);\n }\n\n const id = useId('modal-', options.id);\n const modalAttributes = useTabsterAttributes({\n restorer: { type: TabsterTypes.RestorerTypes.Source },\n modalizer: {\n id,\n isOthersAccessible: !trapFocus,\n isAlwaysAccessible: alwaysFocusable,\n isTrapped: legacyTrapFocus && trapFocus,\n },\n });\n\n const triggerAttributes = useTabsterAttributes({\n restorer: { type: TabsterTypes.RestorerTypes.Target },\n });\n\n return { modalAttributes, triggerAttributes };\n};\n"],"names":["useId","useTabsterAttributes","getModalizer","getRestorer","Types","TabsterTypes","useTabster","useModalAttributes","options","trapFocus","alwaysFocusable","legacyTrapFocus","tabster","id","modalAttributes","restorer","type","RestorerTypes","Source","modalizer","isOthersAccessible","isAlwaysAccessible","isTrapped","triggerAttributes","Target"],"mappings":"AAAA,SAASA,KAAK,QAAQ,4BAA4B;AAClD,SAASC,oBAAoB,QAAQ,yBAAyB;AAC9D,SAASC,YAAY,EAAEC,WAAW,EAAEC,SAASC,YAAY,QAAQ,UAAU;AAC3E,SAASC,UAAU,QAAQ,eAAe;AA8B1C;;;;;;CAMC,GACD,OAAO,MAAMC,qBAAqB,CAChCC,UAAqC,CAAC,CAAC,GACwE;IAC/G,MAAM,EAAEC,UAAS,EAAEC,gBAAe,EAAEC,gBAAe,EAAE,GAAGH;IACxD,MAAMI,UAAUN;IAChB,8CAA8C;IAC9C,IAAIM,SAAS;QACXV,aAAaU;QACbT,YAAYS;IACd,CAAC;IAED,MAAMC,KAAKb,MAAM,UAAUQ,QAAQK,EAAE;IACrC,MAAMC,kBAAkBb,qBAAqB;QAC3Cc,UAAU;YAAEC,MAAMX,aAAaY,aAAa,CAACC,MAAM;QAAC;QACpDC,WAAW;YACTN;YACAO,oBAAoB,CAACX;YACrBY,oBAAoBX;YACpBY,WAAWX,mBAAmBF;QAChC;IACF;IAEA,MAAMc,oBAAoBtB,qBAAqB;QAC7Cc,UAAU;YAAEC,MAAMX,aAAaY,aAAa,CAACO,MAAM;QAAC;IACtD;IAEA,OAAO;QAAEV;QAAiBS;IAAkB;AAC9C,EAAE"}
@@ -0,0 +1,32 @@
1
+ import { getRestorer, getTabsterAttribute, Types as TabsterTypes } from 'tabster';
2
+ import { useTabster } from './useTabster';
3
+ /**
4
+ * Focus will be restored to the most recent target element when it is lost from a source
5
+ * @returns Attribute to apply to the target element where focus is restored
6
+ */ export function useRestoreFocusTarget() {
7
+ const tabster = useTabster();
8
+ // Initializes the restorer API
9
+ if (tabster) {
10
+ getRestorer(tabster);
11
+ }
12
+ return getTabsterAttribute({
13
+ restorer: {
14
+ type: TabsterTypes.RestorerTypes.Target
15
+ }
16
+ });
17
+ }
18
+ /**
19
+ * Focus will be restored to the most recent target element when it is lost from a source
20
+ * @returns Attribute to apply to the element that might lose focus
21
+ */ export function useRestoreFocusSource() {
22
+ const tabster = useTabster();
23
+ // Initializes the restorer API
24
+ if (tabster) {
25
+ getRestorer(tabster);
26
+ }
27
+ return getTabsterAttribute({
28
+ restorer: {
29
+ type: TabsterTypes.RestorerTypes.Source
30
+ }
31
+ });
32
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["useRestoreFocus.ts"],"sourcesContent":["import { getRestorer, getTabsterAttribute, Types as TabsterTypes } from 'tabster';\nimport { useTabster } from './useTabster';\n\n/**\n * Focus will be restored to the most recent target element when it is lost from a source\n * @returns Attribute to apply to the target element where focus is restored\n */\nexport function useRestoreFocusTarget(): TabsterTypes.TabsterDOMAttribute {\n const tabster = useTabster();\n // Initializes the restorer API\n if (tabster) {\n getRestorer(tabster);\n }\n\n return getTabsterAttribute({ restorer: { type: TabsterTypes.RestorerTypes.Target } });\n}\n\n/**\n * Focus will be restored to the most recent target element when it is lost from a source\n * @returns Attribute to apply to the element that might lose focus\n */\nexport function useRestoreFocusSource(): TabsterTypes.TabsterDOMAttribute {\n const tabster = useTabster();\n // Initializes the restorer API\n if (tabster) {\n getRestorer(tabster);\n }\n\n return getTabsterAttribute({ restorer: { type: TabsterTypes.RestorerTypes.Source } });\n}\n"],"names":["getRestorer","getTabsterAttribute","Types","TabsterTypes","useTabster","useRestoreFocusTarget","tabster","restorer","type","RestorerTypes","Target","useRestoreFocusSource","Source"],"mappings":"AAAA,SAASA,WAAW,EAAEC,mBAAmB,EAAEC,SAASC,YAAY,QAAQ,UAAU;AAClF,SAASC,UAAU,QAAQ,eAAe;AAE1C;;;CAGC,GACD,OAAO,SAASC,wBAA0D;IACxE,MAAMC,UAAUF;IAChB,+BAA+B;IAC/B,IAAIE,SAAS;QACXN,YAAYM;IACd,CAAC;IAED,OAAOL,oBAAoB;QAAEM,UAAU;YAAEC,MAAML,aAAaM,aAAa,CAACC,MAAM;QAAC;IAAE;AACrF,CAAC;AAED;;;CAGC,GACD,OAAO,SAASC,wBAA0D;IACxE,MAAML,UAAUF;IAChB,+BAA+B;IAC/B,IAAIE,SAAS;QACXN,YAAYM;IACd,CAAC;IAED,OAAOL,oBAAoB;QAAEM,UAAU;YAAEC,MAAML,aAAaM,aAAa,CAACG,MAAM;QAAC;IAAE;AACrF,CAAC"}
package/lib/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export { useArrowNavigationGroup, useFocusableGroup, useFocusFinders, useFocusVisible, useFocusWithin, useKeyboardNavAttribute, useModalAttributes, useTabsterAttributes, useObservedElement, useFocusObserved, useMergedTabsterAttributes_unstable } from './hooks/index';
1
+ export { useArrowNavigationGroup, useFocusableGroup, useFocusFinders, useFocusVisible, useFocusWithin, useKeyboardNavAttribute, useModalAttributes, useTabsterAttributes, useObservedElement, useFocusObserved, useMergedTabsterAttributes_unstable, useRestoreFocusSource, useRestoreFocusTarget } from './hooks/index';
2
2
  export { createCustomFocusIndicatorStyle, createFocusOutlineStyle } from './focus/index';
3
3
  export { applyFocusVisiblePolyfill } from './focus/index';
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":["export {\n useArrowNavigationGroup,\n useFocusableGroup,\n useFocusFinders,\n useFocusVisible,\n useFocusWithin,\n useKeyboardNavAttribute,\n useModalAttributes,\n useTabsterAttributes,\n useObservedElement,\n useFocusObserved,\n useMergedTabsterAttributes_unstable,\n} from './hooks/index';\nexport type {\n UseArrowNavigationGroupOptions,\n UseFocusableGroupOptions,\n UseModalAttributesOptions,\n} from './hooks/index';\n\nexport { createCustomFocusIndicatorStyle, createFocusOutlineStyle } from './focus/index';\n\nexport type {\n CreateCustomFocusIndicatorStyleOptions,\n CreateFocusOutlineStyleOptions,\n FocusOutlineOffset,\n FocusOutlineStyleOptions,\n} from './focus/index';\n\nexport { applyFocusVisiblePolyfill } from './focus/index';\nimport { Types as TabsterTypes } from 'tabster';\n\nexport type TabsterDOMAttribute = TabsterTypes.TabsterDOMAttribute;\n"],"names":["useArrowNavigationGroup","useFocusableGroup","useFocusFinders","useFocusVisible","useFocusWithin","useKeyboardNavAttribute","useModalAttributes","useTabsterAttributes","useObservedElement","useFocusObserved","useMergedTabsterAttributes_unstable","createCustomFocusIndicatorStyle","createFocusOutlineStyle","applyFocusVisiblePolyfill"],"mappings":"AAAA,SACEA,uBAAuB,EACvBC,iBAAiB,EACjBC,eAAe,EACfC,eAAe,EACfC,cAAc,EACdC,uBAAuB,EACvBC,kBAAkB,EAClBC,oBAAoB,EACpBC,kBAAkB,EAClBC,gBAAgB,EAChBC,mCAAmC,QAC9B,gBAAgB;AAOvB,SAASC,+BAA+B,EAAEC,uBAAuB,QAAQ,gBAAgB;AASzF,SAASC,yBAAyB,QAAQ,gBAAgB"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export {\n useArrowNavigationGroup,\n useFocusableGroup,\n useFocusFinders,\n useFocusVisible,\n useFocusWithin,\n useKeyboardNavAttribute,\n useModalAttributes,\n useTabsterAttributes,\n useObservedElement,\n useFocusObserved,\n useMergedTabsterAttributes_unstable,\n useRestoreFocusSource,\n useRestoreFocusTarget,\n} from './hooks/index';\nexport type {\n UseArrowNavigationGroupOptions,\n UseFocusableGroupOptions,\n UseModalAttributesOptions,\n} from './hooks/index';\n\nexport { createCustomFocusIndicatorStyle, createFocusOutlineStyle } from './focus/index';\n\nexport type {\n CreateCustomFocusIndicatorStyleOptions,\n CreateFocusOutlineStyleOptions,\n FocusOutlineOffset,\n FocusOutlineStyleOptions,\n} from './focus/index';\n\nexport { applyFocusVisiblePolyfill } from './focus/index';\nimport { Types as TabsterTypes } from 'tabster';\n\nexport type TabsterDOMAttribute = TabsterTypes.TabsterDOMAttribute;\n"],"names":["useArrowNavigationGroup","useFocusableGroup","useFocusFinders","useFocusVisible","useFocusWithin","useKeyboardNavAttribute","useModalAttributes","useTabsterAttributes","useObservedElement","useFocusObserved","useMergedTabsterAttributes_unstable","useRestoreFocusSource","useRestoreFocusTarget","createCustomFocusIndicatorStyle","createFocusOutlineStyle","applyFocusVisiblePolyfill"],"mappings":"AAAA,SACEA,uBAAuB,EACvBC,iBAAiB,EACjBC,eAAe,EACfC,eAAe,EACfC,cAAc,EACdC,uBAAuB,EACvBC,kBAAkB,EAClBC,oBAAoB,EACpBC,kBAAkB,EAClBC,gBAAgB,EAChBC,mCAAmC,EACnCC,qBAAqB,EACrBC,qBAAqB,QAChB,gBAAgB;AAOvB,SAASC,+BAA+B,EAAEC,uBAAuB,QAAQ,gBAAgB;AASzF,SAASC,yBAAyB,QAAQ,gBAAgB"}
@@ -14,3 +14,4 @@ _exportStar(require("./useTabsterAttributes"), exports);
14
14
  _exportStar(require("./useObservedElement"), exports);
15
15
  _exportStar(require("./useMergeTabsterAttributes"), exports);
16
16
  _exportStar(require("./useFocusObserved"), exports);
17
+ _exportStar(require("./useRestoreFocus"), exports);
@@ -1 +1 @@
1
- {"version":3,"sources":["index.js"],"sourcesContent":["export * from './useArrowNavigationGroup';\nexport * from './useFocusableGroup';\nexport * from './useFocusFinders';\nexport * from './useFocusVisible';\nexport * from './useFocusWithin';\nexport * from './useKeyboardNavAttribute';\nexport * from './useModalAttributes';\nexport * from './useTabsterAttributes';\nexport * from './useObservedElement';\nexport * from './useMergeTabsterAttributes';\nexport * from './useFocusObserved';\n"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA"}
1
+ {"version":3,"sources":["index.js"],"sourcesContent":["export * from './useArrowNavigationGroup';\nexport * from './useFocusableGroup';\nexport * from './useFocusFinders';\nexport * from './useFocusVisible';\nexport * from './useFocusWithin';\nexport * from './useKeyboardNavAttribute';\nexport * from './useModalAttributes';\nexport * from './useTabsterAttributes';\nexport * from './useObservedElement';\nexport * from './useMergeTabsterAttributes';\nexport * from './useFocusObserved';\nexport * from './useRestoreFocus';\n"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA"}
@@ -13,14 +13,16 @@ const _useTabster = require("./useTabster");
13
13
  const useModalAttributes = (options = {})=>{
14
14
  const { trapFocus , alwaysFocusable , legacyTrapFocus } = options;
15
15
  const tabster = (0, _useTabster.useTabster)();
16
- // Initializes the modalizer and deloser APIs
16
+ // Initializes the modalizer and restorer APIs
17
17
  if (tabster) {
18
18
  (0, _tabster.getModalizer)(tabster);
19
- (0, _tabster.getDeloser)(tabster);
19
+ (0, _tabster.getRestorer)(tabster);
20
20
  }
21
21
  const id = (0, _reactUtilities.useId)('modal-', options.id);
22
22
  const modalAttributes = (0, _useTabsterAttributes.useTabsterAttributes)({
23
- deloser: {},
23
+ restorer: {
24
+ type: _tabster.Types.RestorerTypes.Source
25
+ },
24
26
  modalizer: {
25
27
  id,
26
28
  isOthersAccessible: !trapFocus,
@@ -29,7 +31,9 @@ const useModalAttributes = (options = {})=>{
29
31
  }
30
32
  });
31
33
  const triggerAttributes = (0, _useTabsterAttributes.useTabsterAttributes)({
32
- deloser: {}
34
+ restorer: {
35
+ type: _tabster.Types.RestorerTypes.Target
36
+ }
33
37
  });
34
38
  return {
35
39
  modalAttributes,
@@ -1 +1 @@
1
- {"version":3,"sources":["useModalAttributes.js"],"sourcesContent":["import { useId } from '@fluentui/react-utilities';\nimport { useTabsterAttributes } from './useTabsterAttributes';\nimport { getDeloser, getModalizer } from 'tabster';\nimport { useTabster } from './useTabster';\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 */ export const useModalAttributes = (options = {})=>{\n const { trapFocus , alwaysFocusable , legacyTrapFocus } = options;\n const tabster = useTabster();\n // Initializes the modalizer and deloser APIs\n if (tabster) {\n getModalizer(tabster);\n getDeloser(tabster);\n }\n const id = useId('modal-', options.id);\n const modalAttributes = useTabsterAttributes({\n deloser: {},\n modalizer: {\n id,\n isOthersAccessible: !trapFocus,\n isAlwaysAccessible: alwaysFocusable,\n isTrapped: legacyTrapFocus && trapFocus\n }\n });\n const triggerAttributes = useTabsterAttributes({\n deloser: {}\n });\n return {\n modalAttributes,\n triggerAttributes\n };\n};\n"],"names":["useModalAttributes","options","trapFocus","alwaysFocusable","legacyTrapFocus","tabster","useTabster","getModalizer","getDeloser","id","useId","modalAttributes","useTabsterAttributes","deloser","modalizer","isOthersAccessible","isAlwaysAccessible","isTrapped","triggerAttributes"],"mappings":";;;;+BAUiBA;;aAAAA;;gCAVK;sCACe;yBACI;4BACd;AAOhB,MAAMA,qBAAqB,CAACC,UAAU,CAAC,CAAC,GAAG;IAClD,MAAM,EAAEC,UAAS,EAAGC,gBAAe,EAAGC,gBAAe,EAAG,GAAGH;IAC3D,MAAMI,UAAUC,IAAAA,sBAAU;IAC1B,6CAA6C;IAC7C,IAAID,SAAS;QACTE,IAAAA,qBAAY,EAACF;QACbG,IAAAA,mBAAU,EAACH;IACf,CAAC;IACD,MAAMI,KAAKC,IAAAA,qBAAK,EAAC,UAAUT,QAAQQ,EAAE;IACrC,MAAME,kBAAkBC,IAAAA,0CAAoB,EAAC;QACzCC,SAAS,CAAC;QACVC,WAAW;YACPL;YACAM,oBAAoB,CAACb;YACrBc,oBAAoBb;YACpBc,WAAWb,mBAAmBF;QAClC;IACJ;IACA,MAAMgB,oBAAoBN,IAAAA,0CAAoB,EAAC;QAC3CC,SAAS,CAAC;IACd;IACA,OAAO;QACHF;QACAO;IACJ;AACJ"}
1
+ {"version":3,"sources":["useModalAttributes.js"],"sourcesContent":["import { useId } from '@fluentui/react-utilities';\nimport { useTabsterAttributes } from './useTabsterAttributes';\nimport { getModalizer, getRestorer, Types as TabsterTypes } from 'tabster';\nimport { useTabster } from './useTabster';\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 */ export const useModalAttributes = (options = {})=>{\n const { trapFocus , alwaysFocusable , legacyTrapFocus } = options;\n const tabster = useTabster();\n // Initializes the modalizer and restorer APIs\n if (tabster) {\n getModalizer(tabster);\n getRestorer(tabster);\n }\n const id = useId('modal-', options.id);\n const modalAttributes = useTabsterAttributes({\n restorer: {\n type: TabsterTypes.RestorerTypes.Source\n },\n modalizer: {\n id,\n isOthersAccessible: !trapFocus,\n isAlwaysAccessible: alwaysFocusable,\n isTrapped: legacyTrapFocus && trapFocus\n }\n });\n const triggerAttributes = useTabsterAttributes({\n restorer: {\n type: TabsterTypes.RestorerTypes.Target\n }\n });\n return {\n modalAttributes,\n triggerAttributes\n };\n};\n"],"names":["useModalAttributes","options","trapFocus","alwaysFocusable","legacyTrapFocus","tabster","useTabster","getModalizer","getRestorer","id","useId","modalAttributes","useTabsterAttributes","restorer","type","TabsterTypes","RestorerTypes","Source","modalizer","isOthersAccessible","isAlwaysAccessible","isTrapped","triggerAttributes","Target"],"mappings":";;;;+BAUiBA;;aAAAA;;gCAVK;sCACe;yBAC4B;4BACtC;AAOhB,MAAMA,qBAAqB,CAACC,UAAU,CAAC,CAAC,GAAG;IAClD,MAAM,EAAEC,UAAS,EAAGC,gBAAe,EAAGC,gBAAe,EAAG,GAAGH;IAC3D,MAAMI,UAAUC,IAAAA,sBAAU;IAC1B,8CAA8C;IAC9C,IAAID,SAAS;QACTE,IAAAA,qBAAY,EAACF;QACbG,IAAAA,oBAAW,EAACH;IAChB,CAAC;IACD,MAAMI,KAAKC,IAAAA,qBAAK,EAAC,UAAUT,QAAQQ,EAAE;IACrC,MAAME,kBAAkBC,IAAAA,0CAAoB,EAAC;QACzCC,UAAU;YACNC,MAAMC,cAAY,CAACC,aAAa,CAACC,MAAM;QAC3C;QACAC,WAAW;YACPT;YACAU,oBAAoB,CAACjB;YACrBkB,oBAAoBjB;YACpBkB,WAAWjB,mBAAmBF;QAClC;IACJ;IACA,MAAMoB,oBAAoBV,IAAAA,0CAAoB,EAAC;QAC3CC,UAAU;YACNC,MAAMC,cAAY,CAACC,aAAa,CAACO,MAAM;QAC3C;IACJ;IACA,OAAO;QACHZ;QACAW;IACJ;AACJ"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ useRestoreFocusTarget: ()=>useRestoreFocusTarget,
13
+ useRestoreFocusSource: ()=>useRestoreFocusSource
14
+ });
15
+ const _tabster = require("tabster");
16
+ const _useTabster = require("./useTabster");
17
+ function useRestoreFocusTarget() {
18
+ const tabster = (0, _useTabster.useTabster)();
19
+ // Initializes the restorer API
20
+ if (tabster) {
21
+ (0, _tabster.getRestorer)(tabster);
22
+ }
23
+ return (0, _tabster.getTabsterAttribute)({
24
+ restorer: {
25
+ type: _tabster.Types.RestorerTypes.Target
26
+ }
27
+ });
28
+ }
29
+ function useRestoreFocusSource() {
30
+ const tabster = (0, _useTabster.useTabster)();
31
+ // Initializes the restorer API
32
+ if (tabster) {
33
+ (0, _tabster.getRestorer)(tabster);
34
+ }
35
+ return (0, _tabster.getTabsterAttribute)({
36
+ restorer: {
37
+ type: _tabster.Types.RestorerTypes.Source
38
+ }
39
+ });
40
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["useRestoreFocus.js"],"sourcesContent":["import { getRestorer, getTabsterAttribute, Types as TabsterTypes } from 'tabster';\nimport { useTabster } from './useTabster';\n/**\n * Focus will be restored to the most recent target element when it is lost from a source\n * @returns Attribute to apply to the target element where focus is restored\n */ export function useRestoreFocusTarget() {\n const tabster = useTabster();\n // Initializes the restorer API\n if (tabster) {\n getRestorer(tabster);\n }\n return getTabsterAttribute({\n restorer: {\n type: TabsterTypes.RestorerTypes.Target\n }\n });\n}\n/**\n * Focus will be restored to the most recent target element when it is lost from a source\n * @returns Attribute to apply to the element that might lose focus\n */ export function useRestoreFocusSource() {\n const tabster = useTabster();\n // Initializes the restorer API\n if (tabster) {\n getRestorer(tabster);\n }\n return getTabsterAttribute({\n restorer: {\n type: TabsterTypes.RestorerTypes.Source\n }\n });\n}\n"],"names":["useRestoreFocusTarget","useRestoreFocusSource","tabster","useTabster","getRestorer","getTabsterAttribute","restorer","type","TabsterTypes","RestorerTypes","Target","Source"],"mappings":";;;;;;;;;;;IAKoBA,qBAAqB,MAArBA;IAeAC,qBAAqB,MAArBA;;yBApBoD;4BAC7C;AAIhB,SAASD,wBAAwB;IACxC,MAAME,UAAUC,IAAAA,sBAAU;IAC1B,+BAA+B;IAC/B,IAAID,SAAS;QACTE,IAAAA,oBAAW,EAACF;IAChB,CAAC;IACD,OAAOG,IAAAA,4BAAmB,EAAC;QACvBC,UAAU;YACNC,MAAMC,cAAY,CAACC,aAAa,CAACC,MAAM;QAC3C;IACJ;AACJ;AAIW,SAAST,wBAAwB;IACxC,MAAMC,UAAUC,IAAAA,sBAAU;IAC1B,+BAA+B;IAC/B,IAAID,SAAS;QACTE,IAAAA,oBAAW,EAACF;IAChB,CAAC;IACD,OAAOG,IAAAA,4BAAmB,EAAC;QACvBC,UAAU;YACNC,MAAMC,cAAY,CAACC,aAAa,CAACE,MAAM;QAC3C;IACJ;AACJ"}
@@ -20,6 +20,8 @@ _export(exports, {
20
20
  useObservedElement: ()=>_index.useObservedElement,
21
21
  useFocusObserved: ()=>_index.useFocusObserved,
22
22
  useMergedTabsterAttributes_unstable: ()=>_index.useMergedTabsterAttributes_unstable,
23
+ useRestoreFocusSource: ()=>_index.useRestoreFocusSource,
24
+ useRestoreFocusTarget: ()=>_index.useRestoreFocusTarget,
23
25
  createCustomFocusIndicatorStyle: ()=>_index1.createCustomFocusIndicatorStyle,
24
26
  createFocusOutlineStyle: ()=>_index1.createFocusOutlineStyle,
25
27
  applyFocusVisiblePolyfill: ()=>_index1.applyFocusVisiblePolyfill
@@ -1 +1 @@
1
- {"version":3,"sources":["index.js"],"sourcesContent":["export { useArrowNavigationGroup, useFocusableGroup, useFocusFinders, useFocusVisible, useFocusWithin, useKeyboardNavAttribute, useModalAttributes, useTabsterAttributes, useObservedElement, useFocusObserved, useMergedTabsterAttributes_unstable } from './hooks/index';\nexport { createCustomFocusIndicatorStyle, createFocusOutlineStyle } from './focus/index';\nexport { applyFocusVisiblePolyfill } from './focus/index';\n"],"names":["useArrowNavigationGroup","useFocusableGroup","useFocusFinders","useFocusVisible","useFocusWithin","useKeyboardNavAttribute","useModalAttributes","useTabsterAttributes","useObservedElement","useFocusObserved","useMergedTabsterAttributes_unstable","createCustomFocusIndicatorStyle","createFocusOutlineStyle","applyFocusVisiblePolyfill"],"mappings":";;;;;;;;;;;IAASA,uBAAuB,MAAvBA,8BAAuB;IAAEC,iBAAiB,MAAjBA,wBAAiB;IAAEC,eAAe,MAAfA,sBAAe;IAAEC,eAAe,MAAfA,sBAAe;IAAEC,cAAc,MAAdA,qBAAc;IAAEC,uBAAuB,MAAvBA,8BAAuB;IAAEC,kBAAkB,MAAlBA,yBAAkB;IAAEC,oBAAoB,MAApBA,2BAAoB;IAAEC,kBAAkB,MAAlBA,yBAAkB;IAAEC,gBAAgB,MAAhBA,uBAAgB;IAAEC,mCAAmC,MAAnCA,0CAAmC;IAC1OC,+BAA+B,MAA/BA,uCAA+B;IAAEC,uBAAuB,MAAvBA,+BAAuB;IACxDC,yBAAyB,MAAzBA,iCAAyB;;uBAFyN;wBAClL"}
1
+ {"version":3,"sources":["index.js"],"sourcesContent":["export { useArrowNavigationGroup, useFocusableGroup, useFocusFinders, useFocusVisible, useFocusWithin, useKeyboardNavAttribute, useModalAttributes, useTabsterAttributes, useObservedElement, useFocusObserved, useMergedTabsterAttributes_unstable, useRestoreFocusSource, useRestoreFocusTarget } from './hooks/index';\nexport { createCustomFocusIndicatorStyle, createFocusOutlineStyle } from './focus/index';\nexport { applyFocusVisiblePolyfill } from './focus/index';\n"],"names":["useArrowNavigationGroup","useFocusableGroup","useFocusFinders","useFocusVisible","useFocusWithin","useKeyboardNavAttribute","useModalAttributes","useTabsterAttributes","useObservedElement","useFocusObserved","useMergedTabsterAttributes_unstable","useRestoreFocusSource","useRestoreFocusTarget","createCustomFocusIndicatorStyle","createFocusOutlineStyle","applyFocusVisiblePolyfill"],"mappings":";;;;;;;;;;;IAASA,uBAAuB,MAAvBA,8BAAuB;IAAEC,iBAAiB,MAAjBA,wBAAiB;IAAEC,eAAe,MAAfA,sBAAe;IAAEC,eAAe,MAAfA,sBAAe;IAAEC,cAAc,MAAdA,qBAAc;IAAEC,uBAAuB,MAAvBA,8BAAuB;IAAEC,kBAAkB,MAAlBA,yBAAkB;IAAEC,oBAAoB,MAApBA,2BAAoB;IAAEC,kBAAkB,MAAlBA,yBAAkB;IAAEC,gBAAgB,MAAhBA,uBAAgB;IAAEC,mCAAmC,MAAnCA,0CAAmC;IAAEC,qBAAqB,MAArBA,4BAAqB;IAAEC,qBAAqB,MAArBA,4BAAqB;IACxRC,+BAA+B,MAA/BA,uCAA+B;IAAEC,uBAAuB,MAAvBA,+BAAuB;IACxDC,yBAAyB,MAAzBA,iCAAyB;;uBAFuQ;wBAChO"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-tabster",
3
- "version": "9.10.0",
3
+ "version": "9.11.0",
4
4
  "description": "Utilities for focus management and facade for tabster",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -37,7 +37,7 @@
37
37
  "@griffel/react": "^1.5.7",
38
38
  "@swc/helpers": "^0.4.14",
39
39
  "keyborg": "^2.0.0",
40
- "tabster": "^4.5.1"
40
+ "tabster": "^4.7.0"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@types/react": ">=16.8.0 <19.0.0",