@flipdish/ui-library 0.71.0 → 0.72.1

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 (29) hide show
  1. package/dist/components/organisms/Tables/Table/hooks/useTableFocusHandOff.cjs +1 -1
  2. package/dist/components/organisms/Tables/Table/hooks/useTableFocusHandOff.d.ts.map +1 -1
  3. package/dist/components/organisms/Tables/Table/hooks/useTableFocusHandOff.js +1 -1
  4. package/dist/hooks/{useFocusHandOff/index.cjs → __internal__/useFocusHandOff/useFocusHandOff.cjs} +2 -2
  5. package/dist/hooks/__internal__/useFocusHandOff/useFocusHandOff.cjs.map +1 -0
  6. package/dist/hooks/{useFocusHandOff/index.d.ts → __internal__/useFocusHandOff/useFocusHandOff.d.ts} +1 -1
  7. package/dist/hooks/__internal__/useFocusHandOff/useFocusHandOff.d.ts.map +1 -0
  8. package/dist/hooks/{useFocusHandOff/index.js → __internal__/useFocusHandOff/useFocusHandOff.js} +2 -2
  9. package/dist/hooks/__internal__/useFocusHandOff/useFocusHandOff.js.map +1 -0
  10. package/dist/hooks/useClipboard/clipboard.utils.cjs +33 -0
  11. package/dist/hooks/useClipboard/clipboard.utils.cjs.map +1 -0
  12. package/dist/hooks/useClipboard/clipboard.utils.d.ts +15 -0
  13. package/dist/hooks/useClipboard/clipboard.utils.d.ts.map +1 -0
  14. package/dist/hooks/useClipboard/clipboard.utils.js +31 -0
  15. package/dist/hooks/useClipboard/clipboard.utils.js.map +1 -0
  16. package/dist/hooks/useClipboard/index.cjs +17 -42
  17. package/dist/hooks/useClipboard/index.cjs.map +1 -1
  18. package/dist/hooks/useClipboard/index.d.ts.map +1 -1
  19. package/dist/hooks/useClipboard/index.js +17 -42
  20. package/dist/hooks/useClipboard/index.js.map +1 -1
  21. package/dist/hooks/useFocusAfterRetry/index.cjs +2 -2
  22. package/dist/hooks/useFocusAfterRetry/index.d.ts +1 -1
  23. package/dist/hooks/useFocusAfterRetry/index.js +2 -2
  24. package/dist/styles.css +3 -3
  25. package/package.json +1 -1
  26. package/dist/hooks/useFocusHandOff/index.cjs.map +0 -1
  27. package/dist/hooks/useFocusHandOff/index.d.ts.map +0 -1
  28. package/dist/hooks/useFocusHandOff/index.js.map +0 -1
  29. package/dist/native/hooks/useFocusHandOff/index.d.ts +0 -12
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var useFocusHandOff = require('@flipdish/ui-library/hooks/useFocusHandOff');
4
3
  var React = require('react');
4
+ var useFocusHandOff = require('../../../../../hooks/__internal__/useFocusHandOff/useFocusHandOff.cjs');
5
5
  var tableFocusHandOff_utils = require('../utilities/tableFocusHandOff.utils.cjs');
6
6
 
7
7
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"useTableFocusHandOff.d.ts","sourceRoot":"","sources":["../../../../../../src/components/organisms/Tables/Table/hooks/useTableFocusHandOff.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,GAAG,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAA8B,MAAM,OAAO,CAAC;AAGxH,MAAM,WAAW,iBAAiB;IAChC,+HAA+H;IAC/H,MAAM,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IACjC,6HAA6H;IAC7H,QAAQ,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IACnC,uGAAuG;IACvG,UAAU,EAAE;QACV,GAAG,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;QACzB,gBAAgB,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;QAC9D,cAAc,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;KAC9D,CAAC;CACH;AAOD;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,QAAO,iBA+DvC,CAAC"}
1
+ {"version":3,"file":"useTableFocusHandOff.d.ts","sourceRoot":"","sources":["../../../../../../src/components/organisms/Tables/Table/hooks/useTableFocusHandOff.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,GAAG,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAA8B,MAAM,OAAO,CAAC;AAIxH,MAAM,WAAW,iBAAiB;IAChC,+HAA+H;IAC/H,MAAM,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IACjC,6HAA6H;IAC7H,QAAQ,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IACnC,uGAAuG;IACvG,UAAU,EAAE;QACV,GAAG,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;QACzB,gBAAgB,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;QAC9D,cAAc,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;KAC9D,CAAC;CACH;AAOD;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,QAAO,iBA+DvC,CAAC"}
@@ -1,5 +1,5 @@
1
- import { useFocusHandOff } from '@flipdish/ui-library/hooks/useFocusHandOff';
2
1
  import { useRef, useEffect, useMemo } from 'react';
2
+ import { useFocusHandOff } from '../../../../../hooks/__internal__/useFocusHandOff/useFocusHandOff.js';
3
3
  import { pressedControlOf, isPressKey, watchForLeaving } from '../utilities/tableFocusHandOff.utils.js';
4
4
 
5
5
  /**
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var React = require('react');
4
- var focusFromCode_utils = require('../../utilities/__internal__/focusUtils/focusFromCode.utils.cjs');
4
+ var focusFromCode_utils = require('../../../utilities/__internal__/focusUtils/focusFromCode.utils.cjs');
5
5
 
6
6
  // What `styles.css` draws the keyboard-only focus ring from; also spelled there.
7
7
  const FOCUS_TARGET_ATTRIBUTE = 'data-focus-hand-off-target';
@@ -64,4 +64,4 @@ const useFocusHandOff = () => {
64
64
  };
65
65
 
66
66
  exports.useFocusHandOff = useFocusHandOff;
67
- //# sourceMappingURL=index.cjs.map
67
+ //# sourceMappingURL=useFocusHandOff.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFocusHandOff.cjs","sources":["../../../../src/hooks/__internal__/useFocusHandOff/useFocusHandOff.ts"],"sourcesContent":[null],"names":["isFocusableFromCodeOnly","takeFocusFromCodeOnly","useRef","useCallback"],"mappings":";;;;;AAKA;AACA,MAAM,sBAAsB,GAAG,4BAA4B;AAE3D;AACA;AACA,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC;AAEnE,MAAM,aAAa,GAAG,CAAC,OAAoB,KAAI;IAC7C,MAAM,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC,iBAAiB,CAAC;AACrD,IAAA,OAAO,KAAK,KAAK,IAAI,IAAI,mBAAmB,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;AACvE,CAAC;AAED;AACA;AACA;AACA,MAAM,eAAe,GAAG,CAAC,OAAoB,KAAI;IAC/C,IAAI,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,IAAI,aAAa,CAAC,OAAO,CAAC,IAAIA,2CAAuB,CAAC,OAAO,CAAC;QAAE;IAC7HC,yCAAqB,CAAC,OAAO,CAAC;AAC9B,IAAA,OAAO,CAAC,YAAY,CAAC,sBAAsB,EAAE,EAAE,CAAC;AAClD,CAAC;AAED;;;;;;;;;;;AAWG;AACI,MAAM,eAAe,GAAG,MAAK;AAClC,IAAA,MAAM,SAAS,GAAGC,YAAM,CAAC,KAAK,CAAC;AAE/B,IAAA,MAAM,OAAO,GAAGC,iBAAW,CACzB,CAAiC,MAAiC,KAChE,CAAC,GAAG,IAAU,KAAY;AACxB,QAAA,SAAS,CAAC,OAAO,GAAG,IAAI;AACxB,QAAA,IAAI;AACF,YAAA,OAAO,MAAM,CAAC,GAAG,IAAI,CAAC;QACxB;QAAE,OAAO,KAAK,EAAE;;AAEd,YAAA,SAAS,CAAC,OAAO,GAAG,KAAK;AACzB,YAAA,MAAM,KAAK;QACb;IACF,CAAC,EACH,EAAE,CACH;AAED,IAAA,MAAM,SAAS,GAAGA,iBAAW,CAAC,CAAC,MAA0B,KAAI;AAC3D,QAAA,IAAI,CAAC,MAAM;YAAE;QACb,eAAe,CAAC,MAAM,CAAC;QACvB,IAAI,CAAC,SAAS,CAAC,OAAO;YAAE;AACxB,QAAA,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM;;AAEhC,QAAA,IAAI,aAAa,CAAC,aAAa,KAAK,aAAa,CAAC,IAAI;YAAE,MAAM,CAAC,KAAK,EAAE;;AAEtE,QAAA,IAAI,aAAa,CAAC,aAAa,KAAK,aAAa,CAAC,IAAI;AAAE,YAAA,SAAS,CAAC,OAAO,GAAG,KAAK;IACnF,CAAC,EAAE,EAAE,CAAC;AAEN,IAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE;AAC/B;;"}
@@ -14,4 +14,4 @@ export declare const useFocusHandOff: () => {
14
14
  handOff: <Args extends unknown[], Result>(action: (...args: Args) => Result) => (...args: Args) => Result;
15
15
  targetRef: (target: HTMLElement | null) => void;
16
16
  };
17
- //# sourceMappingURL=index.d.ts.map
17
+ //# sourceMappingURL=useFocusHandOff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFocusHandOff.d.ts","sourceRoot":"","sources":["../../../../src/hooks/__internal__/useFocusHandOff/useFocusHandOff.ts"],"names":[],"mappings":"AA0BA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe;cAIvB,IAAI,SAAS,OAAO,EAAE,EAAE,MAAM,UAAU,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,MAAM,eACtD,IAAI,KAAG,MAAM;wBAaY,WAAW,GAAG,IAAI;CAY1D,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { useRef, useCallback } from 'react';
2
- import { isFocusableFromCodeOnly, takeFocusFromCodeOnly } from '../../utilities/__internal__/focusUtils/focusFromCode.utils.js';
2
+ import { isFocusableFromCodeOnly, takeFocusFromCodeOnly } from '../../../utilities/__internal__/focusUtils/focusFromCode.utils.js';
3
3
 
4
4
  // What `styles.css` draws the keyboard-only focus ring from; also spelled there.
5
5
  const FOCUS_TARGET_ATTRIBUTE = 'data-focus-hand-off-target';
@@ -62,4 +62,4 @@ const useFocusHandOff = () => {
62
62
  };
63
63
 
64
64
  export { useFocusHandOff };
65
- //# sourceMappingURL=index.js.map
65
+ //# sourceMappingURL=useFocusHandOff.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFocusHandOff.js","sources":["../../../../src/hooks/__internal__/useFocusHandOff/useFocusHandOff.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAKA;AACA,MAAM,sBAAsB,GAAG,4BAA4B;AAE3D;AACA;AACA,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC;AAEnE,MAAM,aAAa,GAAG,CAAC,OAAoB,KAAI;IAC7C,MAAM,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC,iBAAiB,CAAC;AACrD,IAAA,OAAO,KAAK,KAAK,IAAI,IAAI,mBAAmB,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;AACvE,CAAC;AAED;AACA;AACA;AACA,MAAM,eAAe,GAAG,CAAC,OAAoB,KAAI;IAC/C,IAAI,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,IAAI,aAAa,CAAC,OAAO,CAAC,IAAI,uBAAuB,CAAC,OAAO,CAAC;QAAE;IAC7H,qBAAqB,CAAC,OAAO,CAAC;AAC9B,IAAA,OAAO,CAAC,YAAY,CAAC,sBAAsB,EAAE,EAAE,CAAC;AAClD,CAAC;AAED;;;;;;;;;;;AAWG;AACI,MAAM,eAAe,GAAG,MAAK;AAClC,IAAA,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC;AAE/B,IAAA,MAAM,OAAO,GAAG,WAAW,CACzB,CAAiC,MAAiC,KAChE,CAAC,GAAG,IAAU,KAAY;AACxB,QAAA,SAAS,CAAC,OAAO,GAAG,IAAI;AACxB,QAAA,IAAI;AACF,YAAA,OAAO,MAAM,CAAC,GAAG,IAAI,CAAC;QACxB;QAAE,OAAO,KAAK,EAAE;;AAEd,YAAA,SAAS,CAAC,OAAO,GAAG,KAAK;AACzB,YAAA,MAAM,KAAK;QACb;IACF,CAAC,EACH,EAAE,CACH;AAED,IAAA,MAAM,SAAS,GAAG,WAAW,CAAC,CAAC,MAA0B,KAAI;AAC3D,QAAA,IAAI,CAAC,MAAM;YAAE;QACb,eAAe,CAAC,MAAM,CAAC;QACvB,IAAI,CAAC,SAAS,CAAC,OAAO;YAAE;AACxB,QAAA,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM;;AAEhC,QAAA,IAAI,aAAa,CAAC,aAAa,KAAK,aAAa,CAAC,IAAI;YAAE,MAAM,CAAC,KAAK,EAAE;;AAEtE,QAAA,IAAI,aAAa,CAAC,aAAa,KAAK,aAAa,CAAC,IAAI;AAAE,YAAA,SAAS,CAAC,OAAO,GAAG,KAAK;IACnF,CAAC,EAAE,EAAE,CAAC;AAEN,IAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE;AAC/B;;"}
@@ -0,0 +1,33 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Copies text with `document.execCommand` when the async Clipboard API is missing or rejects, and removes the helper textarea even if the command throws.
5
+ *
6
+ * @param text The text to place on the clipboard.
7
+ * @returns Whether the browser accepted the command, or the error when it refused or threw.
8
+ */
9
+ const copyWithExecCommand = (text) => {
10
+ const textArea = document.createElement('textarea');
11
+ textArea.value = text;
12
+ // Off-screen so the selection the command needs never flashes on the page.
13
+ textArea.style.position = 'absolute';
14
+ textArea.style.left = '-99999px';
15
+ document.body.appendChild(textArea);
16
+ try {
17
+ textArea.select();
18
+ const success = document.execCommand('copy');
19
+ return success ? { success: true } : { success: false, error: new Error('execCommand returned false') };
20
+ }
21
+ catch (err) {
22
+ return {
23
+ success: false,
24
+ error: err instanceof Error ? err : new Error('Fallback copy failed'),
25
+ };
26
+ }
27
+ finally {
28
+ textArea.remove();
29
+ }
30
+ };
31
+
32
+ exports.copyWithExecCommand = copyWithExecCommand;
33
+ //# sourceMappingURL=clipboard.utils.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clipboard.utils.cjs","sources":["../../../src/hooks/useClipboard/clipboard.utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAQA;;;;;AAKG;AACI,MAAM,mBAAmB,GAAG,CAAC,IAAY,KAA0B;IACxE,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC;AACnD,IAAA,QAAQ,CAAC,KAAK,GAAG,IAAI;;AAErB,IAAA,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,UAAU;AACpC,IAAA,QAAQ,CAAC,KAAK,CAAC,IAAI,GAAG,UAAU;AAChC,IAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC;AAEnC,IAAA,IAAI;QACF,QAAQ,CAAC,MAAM,EAAE;QACjB,MAAM,OAAO,GAAG,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC;QAC5C,OAAO,OAAO,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,KAAK,CAAC,4BAA4B,CAAC,EAAE;IACzG;IAAE,OAAO,GAAG,EAAE;QACZ,OAAO;AACL,YAAA,OAAO,EAAE,KAAK;AACd,YAAA,KAAK,EAAE,GAAG,YAAY,KAAK,GAAG,GAAG,GAAG,IAAI,KAAK,CAAC,sBAAsB,CAAC;SACtE;IACH;YAAU;QACR,QAAQ,CAAC,MAAM,EAAE;IACnB;AACF;;"}
@@ -0,0 +1,15 @@
1
+ /** Outcome of one `document.execCommand('copy')` attempt. */
2
+ export interface ClipboardWriteResult {
3
+ /** Whether the browser reported that the text reached the clipboard. */
4
+ success: boolean;
5
+ /** Why the command was refused or threw; absent when `success` is true. */
6
+ error?: Error;
7
+ }
8
+ /**
9
+ * Copies text with `document.execCommand` when the async Clipboard API is missing or rejects, and removes the helper textarea even if the command throws.
10
+ *
11
+ * @param text The text to place on the clipboard.
12
+ * @returns Whether the browser accepted the command, or the error when it refused or threw.
13
+ */
14
+ export declare const copyWithExecCommand: (text: string) => ClipboardWriteResult;
15
+ //# sourceMappingURL=clipboard.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clipboard.utils.d.ts","sourceRoot":"","sources":["../../../src/hooks/useClipboard/clipboard.utils.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,MAAM,WAAW,oBAAoB;IACnC,wEAAwE;IACxE,OAAO,EAAE,OAAO,CAAC;IACjB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM,KAAG,oBAoBlD,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Copies text with `document.execCommand` when the async Clipboard API is missing or rejects, and removes the helper textarea even if the command throws.
3
+ *
4
+ * @param text The text to place on the clipboard.
5
+ * @returns Whether the browser accepted the command, or the error when it refused or threw.
6
+ */
7
+ const copyWithExecCommand = (text) => {
8
+ const textArea = document.createElement('textarea');
9
+ textArea.value = text;
10
+ // Off-screen so the selection the command needs never flashes on the page.
11
+ textArea.style.position = 'absolute';
12
+ textArea.style.left = '-99999px';
13
+ document.body.appendChild(textArea);
14
+ try {
15
+ textArea.select();
16
+ const success = document.execCommand('copy');
17
+ return success ? { success: true } : { success: false, error: new Error('execCommand returned false') };
18
+ }
19
+ catch (err) {
20
+ return {
21
+ success: false,
22
+ error: err instanceof Error ? err : new Error('Fallback copy failed'),
23
+ };
24
+ }
25
+ finally {
26
+ textArea.remove();
27
+ }
28
+ };
29
+
30
+ export { copyWithExecCommand };
31
+ //# sourceMappingURL=clipboard.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clipboard.utils.js","sources":["../../../src/hooks/useClipboard/clipboard.utils.ts"],"sourcesContent":[null],"names":[],"mappings":"AAQA;;;;;AAKG;AACI,MAAM,mBAAmB,GAAG,CAAC,IAAY,KAA0B;IACxE,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC;AACnD,IAAA,QAAQ,CAAC,KAAK,GAAG,IAAI;;AAErB,IAAA,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,UAAU;AACpC,IAAA,QAAQ,CAAC,KAAK,CAAC,IAAI,GAAG,UAAU;AAChC,IAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC;AAEnC,IAAA,IAAI;QACF,QAAQ,CAAC,MAAM,EAAE;QACjB,MAAM,OAAO,GAAG,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC;QAC5C,OAAO,OAAO,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,KAAK,CAAC,4BAA4B,CAAC,EAAE;IACzG;IAAE,OAAO,GAAG,EAAE;QACZ,OAAO;AACL,YAAA,OAAO,EAAE,KAAK;AACd,YAAA,KAAK,EAAE,GAAG,YAAY,KAAK,GAAG,GAAG,GAAG,IAAI,KAAK,CAAC,sBAAsB,CAAC;SACtE;IACH;YAAU;QACR,QAAQ,CAAC,MAAM,EAAE;IACnB;AACF;;"}
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var React = require('react');
4
+ var clipboard_utils = require('./clipboard.utils.cjs');
4
5
 
5
6
  const DEFAULT_TIMEOUT = 2000;
6
7
  /**
@@ -17,11 +18,6 @@ const useClipboard = () => {
17
18
  // `copy` awaits the async clipboard API; guard its post-await setState so a copy
18
19
  // resolving after unmount doesn't set state on an unmounted component.
19
20
  const isMountedRef = React.useRef(true);
20
- const scheduleReset = () => {
21
- if (resetTimerRef.current)
22
- clearTimeout(resetTimerRef.current);
23
- resetTimerRef.current = setTimeout(() => setCopied(false), DEFAULT_TIMEOUT);
24
- };
25
21
  React.useEffect(() => {
26
22
  isMountedRef.current = true;
27
23
  return () => {
@@ -30,51 +26,30 @@ const useClipboard = () => {
30
26
  clearTimeout(resetTimerRef.current);
31
27
  };
32
28
  }, []);
33
- // Fallback function for older browsers
34
- const fallback = (text, id) => {
35
- // Textarea to copy the text to the clipboard
36
- const textArea = document.createElement('textarea');
37
- textArea.value = text;
38
- textArea.style.position = 'absolute';
39
- textArea.style.left = '-99999px';
40
- document.body.appendChild(textArea);
41
- try {
42
- textArea.select();
43
- const success = document.execCommand('copy');
44
- if (success && isMountedRef.current) {
45
- setCopied(id || true);
46
- scheduleReset();
47
- }
48
- return success ? { success: true } : { success: false, error: new Error('execCommand returned false') };
49
- }
50
- catch (err) {
51
- return {
52
- success: false,
53
- error: err instanceof Error ? err : new Error('Fallback copy failed'),
54
- };
55
- }
56
- finally {
57
- // Always remove the textarea, even when execCommand throws, so a failed copy doesn't leak it into the DOM.
58
- textArea.remove();
59
- }
60
- };
61
- // biome-ignore lint/correctness/useExhaustiveDependencies: We need to return the copied state and the copy function
62
29
  const copy = React.useCallback(async (text, id) => {
30
+ // A second copy restarts the window, so the first one cannot clear the newer copied state.
31
+ const noteCopied = () => {
32
+ if (!isMountedRef.current)
33
+ return;
34
+ setCopied(id || true);
35
+ if (resetTimerRef.current)
36
+ clearTimeout(resetTimerRef.current);
37
+ resetTimerRef.current = setTimeout(() => setCopied(false), DEFAULT_TIMEOUT);
38
+ };
63
39
  if (navigator.clipboard && window.isSecureContext) {
64
40
  try {
65
41
  await navigator.clipboard.writeText(text);
66
- if (isMountedRef.current) {
67
- setCopied(id || true);
68
- scheduleReset();
69
- }
42
+ noteCopied();
70
43
  return { success: true };
71
44
  }
72
- catch (_err) {
73
- // If modern method fails, try fallback
74
- return fallback(text, id);
45
+ catch {
46
+ // A secure context can still refuse the async API; the textarea command is the fallback.
75
47
  }
76
48
  }
77
- return fallback(text, id);
49
+ const result = clipboard_utils.copyWithExecCommand(text);
50
+ if (result.success)
51
+ noteCopied();
52
+ return result;
78
53
  }, []);
79
54
  return { copied, copy };
80
55
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../src/hooks/useClipboard/index.ts"],"sourcesContent":[null],"names":["useState","useRef","useEffect","useCallback"],"mappings":";;;;AAIA,MAAM,eAAe,GAAG,IAAI;AAqB5B;;;;;;;AAOG;AACI,MAAM,YAAY,GAAG,MAA6B;IACvD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAGA,cAAQ,CAAmB,KAAK,CAAC;AAC7D,IAAA,MAAM,aAAa,GAAGC,YAAM,CAAuC,IAAI,CAAC;;;AAGxE,IAAA,MAAM,YAAY,GAAGA,YAAM,CAAC,IAAI,CAAC;IAEjC,MAAM,aAAa,GAAG,MAAK;QACzB,IAAI,aAAa,CAAC,OAAO;AAAE,YAAA,YAAY,CAAC,aAAa,CAAC,OAAO,CAAC;AAC9D,QAAA,aAAa,CAAC,OAAO,GAAG,UAAU,CAAC,MAAM,SAAS,CAAC,KAAK,CAAC,EAAE,eAAe,CAAC;AAC7E,IAAA,CAAC;IAEDC,eAAS,CAAC,MAAK;AACb,QAAA,YAAY,CAAC,OAAO,GAAG,IAAI;AAC3B,QAAA,OAAO,MAAK;AACV,YAAA,YAAY,CAAC,OAAO,GAAG,KAAK;YAC5B,IAAI,aAAa,CAAC,OAAO;AAAE,gBAAA,YAAY,CAAC,aAAa,CAAC,OAAO,CAAC;AAChE,QAAA,CAAC;IACH,CAAC,EAAE,EAAE,CAAC;;AAGN,IAAA,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,EAAW,KAAI;;QAE7C,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAA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EAAE,IAAI,EAAE;YAC1B;YAAE,OAAO,IAAI,EAAE;;AAEb,gBAAA,OAAO,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC;YAC3B;QACF;AACA,QAAA,OAAO,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC;IAC3B,CAAC,EAAE,EAAE,CAAC;AAEN,IAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE;AACzB;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/hooks/useClipboard/index.ts"],"sourcesContent":[null],"names":["useState","useRef","useEffect","useCallback","copyWithExecCommand"],"mappings":";;;;;AAKA,MAAM,eAAe,GAAG,IAAI;AAqB5B;;;;;;;AAOG;AACI,MAAM,YAAY,GAAG,MAA6B;IACvD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAGA,cAAQ,CAAmB,KAAK,CAAC;AAC7D,IAAA,MAAM,aAAa,GAAGC,YAAM,CAAuC,IAAI,CAAC;;;AAGxE,IAAA,MAAM,YAAY,GAAGA,YAAM,CAAC,IAAI,CAAC;IAEjCC,eAAS,CAAC,MAAK;AACb,QAAA,YAAY,CAAC,OAAO,GAAG,IAAI;AAC3B,QAAA,OAAO,MAAK;AACV,YAAA,YAAY,CAAC,OAAO,GAAG,KAAK;YAC5B,IAAI,aAAa,CAAC,OAAO;AAAE,gBAAA,YAAY,CAAC,aAAa,CAAC,OAAO,CAAC;AAChE,QAAA,CAAC;IACH,CAAC,EAAE,EAAE,CAAC;IAEN,MAAM,IAAI,GAAGC,iBAAW,CAAC,OAAO,IAAY,EAAE,EAAW,KAAI;;QAE3D,MAAM,UAAU,GAAG,MAAK;YACtB,IAAI,CAAC,YAAY,CAAC,OAAO;gBAAE;AAC3B,YAAA,SAAS,CAAC,EAAE,IAAI,IAAI,CAAC;YACrB,IAAI,aAAa,CAAC,OAAO;AAAE,gBAAA,YAAY,CAAC,aAAa,CAAC,OAAO,CAAC;AAC9D,YAAA,aAAa,CAAC,OAAO,GAAG,UAAU,CAAC,MAAM,SAAS,CAAC,KAAK,CAAC,EAAE,eAAe,CAAC;AAC7E,QAAA,CAAC;QAED,IAAI,SAAS,CAAC,SAAS,IAAI,MAAM,CAAC,eAAe,EAAE;AACjD,YAAA,IAAI;gBACF,MAAM,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC;AACzC,gBAAA,UAAU,EAAE;AACZ,gBAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;YAC1B;AAAE,YAAA,MAAM;;YAER;QACF;AAEA,QAAA,MAAM,MAAM,GAAGC,mCAAmB,CAAC,IAAI,CAAC;QACxC,IAAI,MAAM,CAAC,OAAO;AAAE,YAAA,UAAU,EAAE;AAChC,QAAA,OAAO,MAAM;IACf,CAAC,EAAE,EAAE,CAAC;AAEN,IAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE;AACzB;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/useClipboard/index.ts"],"names":[],"mappings":"AAMA,KAAK,sBAAsB,GAAG;IAC5B;;;OAGG;IACH,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IACzB;;;;;;;;;OASG;IACH,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,KAAK,CAAA;KAAE,CAAC,CAAC;CACnF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,QAAO,sBAyE/B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/useClipboard/index.ts"],"names":[],"mappings":"AAOA,KAAK,sBAAsB,GAAG;IAC5B;;;OAGG;IACH,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IACzB;;;;;;;;;OASG;IACH,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,KAAK,CAAA;KAAE,CAAC,CAAC;CACnF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,QAAO,sBAwC/B,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { useState, useRef, useEffect, useCallback } from 'react';
2
+ import { copyWithExecCommand } from './clipboard.utils.js';
2
3
 
3
4
  const DEFAULT_TIMEOUT = 2000;
4
5
  /**
@@ -15,11 +16,6 @@ const useClipboard = () => {
15
16
  // `copy` awaits the async clipboard API; guard its post-await setState so a copy
16
17
  // resolving after unmount doesn't set state on an unmounted component.
17
18
  const isMountedRef = useRef(true);
18
- const scheduleReset = () => {
19
- if (resetTimerRef.current)
20
- clearTimeout(resetTimerRef.current);
21
- resetTimerRef.current = setTimeout(() => setCopied(false), DEFAULT_TIMEOUT);
22
- };
23
19
  useEffect(() => {
24
20
  isMountedRef.current = true;
25
21
  return () => {
@@ -28,51 +24,30 @@ const useClipboard = () => {
28
24
  clearTimeout(resetTimerRef.current);
29
25
  };
30
26
  }, []);
31
- // Fallback function for older browsers
32
- const fallback = (text, id) => {
33
- // Textarea to copy the text to the clipboard
34
- const textArea = document.createElement('textarea');
35
- textArea.value = text;
36
- textArea.style.position = 'absolute';
37
- textArea.style.left = '-99999px';
38
- document.body.appendChild(textArea);
39
- try {
40
- textArea.select();
41
- const success = document.execCommand('copy');
42
- if (success && isMountedRef.current) {
43
- setCopied(id || true);
44
- scheduleReset();
45
- }
46
- return success ? { success: true } : { success: false, error: new Error('execCommand returned false') };
47
- }
48
- catch (err) {
49
- return {
50
- success: false,
51
- error: err instanceof Error ? err : new Error('Fallback copy failed'),
52
- };
53
- }
54
- finally {
55
- // Always remove the textarea, even when execCommand throws, so a failed copy doesn't leak it into the DOM.
56
- textArea.remove();
57
- }
58
- };
59
- // biome-ignore lint/correctness/useExhaustiveDependencies: We need to return the copied state and the copy function
60
27
  const copy = useCallback(async (text, id) => {
28
+ // A second copy restarts the window, so the first one cannot clear the newer copied state.
29
+ const noteCopied = () => {
30
+ if (!isMountedRef.current)
31
+ return;
32
+ setCopied(id || true);
33
+ if (resetTimerRef.current)
34
+ clearTimeout(resetTimerRef.current);
35
+ resetTimerRef.current = setTimeout(() => setCopied(false), DEFAULT_TIMEOUT);
36
+ };
61
37
  if (navigator.clipboard && window.isSecureContext) {
62
38
  try {
63
39
  await navigator.clipboard.writeText(text);
64
- if (isMountedRef.current) {
65
- setCopied(id || true);
66
- scheduleReset();
67
- }
40
+ noteCopied();
68
41
  return { success: true };
69
42
  }
70
- catch (_err) {
71
- // If modern method fails, try fallback
72
- return fallback(text, id);
43
+ catch {
44
+ // A secure context can still refuse the async API; the textarea command is the fallback.
73
45
  }
74
46
  }
75
- return fallback(text, id);
47
+ const result = copyWithExecCommand(text);
48
+ if (result.success)
49
+ noteCopied();
50
+ return result;
76
51
  }, []);
77
52
  return { copied, copy };
78
53
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/hooks/useClipboard/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAIA,MAAM,eAAe,GAAG,IAAI;AAqB5B;;;;;;;AAOG;AACI,MAAM,YAAY,GAAG,MAA6B;IACvD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAmB,KAAK,CAAC;AAC7D,IAAA,MAAM,aAAa,GAAG,MAAM,CAAuC,IAAI,CAAC;;;AAGxE,IAAA,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC;IAEjC,MAAM,aAAa,GAAG,MAAK;QACzB,IAAI,aAAa,CAAC,OAAO;AAAE,YAAA,YAAY,CAAC,aAAa,CAAC,OAAO,CAAC;AAC9D,QAAA,aAAa,CAAC,OAAO,GAAG,UAAU,CAAC,MAAM,SAAS,CAAC,KAAK,CAAC,EAAE,eAAe,CAAC;AAC7E,IAAA,CAAC;IAED,SAAS,CAAC,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IAAI,GAAG,WAAW,CAAC,OAAO,IAAY,EAAE,EAAW,KAAI;;QAE3D,MAAM,UAAU,GAAG,MAAK;YACtB,IAAI,CAAC,YAAY,CAAC,OAAO;gBAAE;AAC3B,YAAA,SAAS,CAAC,EAAE,IAAI,IAAI,CAAC;YACrB,IAAI,aAAa,CAAC,OAAO;AAAE,gBAAA,YAAY,CAAC,aAAa,CAAC,OAAO,CAAC;AAC9D,YAAA,aAAa,CAAC,OAAO,GAAG,UAAU,CAAC,MAAM,SAAS,CAAC,KAAK,CAAC,EAAE,eAAe,CAAC;AAC7E,QAAA,CAAC;QAED,IAAI,SAAS,CAAC,SAAS,IAAI,MAAM,CAAC,eAAe,EAAE;AACjD,YAAA,IAAI;gBACF,MAAM,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC;AACzC,gBAAA,UAAU,EAAE;AACZ,gBAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;YAC1B;AAAE,YAAA,MAAM;;YAER;QACF;AAEA,QAAA,MAAM,MAAM,GAAG,mBAAmB,CAAC,IAAI,CAAC;QACxC,IAAI,MAAM,CAAC,OAAO;AAAE,YAAA,UAAU,EAAE;AAChC,QAAA,OAAO,MAAM;IACf,CAAC,EAAE,EAAE,CAAC;AAEN,IAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE;AACzB;;"}
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var useFocusHandOff = require('@flipdish/ui-library/hooks/useFocusHandOff');
3
+ var useFocusHandOff = require('../__internal__/useFocusHandOff/useFocusHandOff.cjs');
4
4
 
5
5
  // The ring `contentProps` spreads, for the callers still on it.
6
6
  const FOCUS_TARGET_CLASSES = 'outline-focus-ring focus-visible:outline-2 focus-visible:outline-offset-2';
7
7
  /**
8
8
  * Keeps keyboard focus in place across a retry. A "Try again" button unmounts once the data arrives, and focus would
9
9
  * otherwise fall back to the top of the page; use it wherever a load error is replaced by the content it failed to load.
10
- * It is `useFocusHandOff` for one action; for several controls that hand focus on, use that hook.
10
+ * Inside a `Table`'s `renderEmptyState` the table hands focus to its rows or cards and to an `EmptyState.Title` itself; any other heading takes it through this hook.
11
11
  *
12
12
  * @param retry Starts the failed request again.
13
13
  * @returns `retryLoad` for the retry button, and `contentRef` for the element that replaces the error. That element takes
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Keeps keyboard focus in place across a retry. A "Try again" button unmounts once the data arrives, and focus would
3
3
  * otherwise fall back to the top of the page; use it wherever a load error is replaced by the content it failed to load.
4
- * It is `useFocusHandOff` for one action; for several controls that hand focus on, use that hook.
4
+ * Inside a `Table`'s `renderEmptyState` the table hands focus to its rows or cards and to an `EmptyState.Title` itself; any other heading takes it through this hook.
5
5
  *
6
6
  * @param retry Starts the failed request again.
7
7
  * @returns `retryLoad` for the retry button, and `contentRef` for the element that replaces the error. That element takes
@@ -1,11 +1,11 @@
1
- import { useFocusHandOff } from '@flipdish/ui-library/hooks/useFocusHandOff';
1
+ import { useFocusHandOff } from '../__internal__/useFocusHandOff/useFocusHandOff.js';
2
2
 
3
3
  // The ring `contentProps` spreads, for the callers still on it.
4
4
  const FOCUS_TARGET_CLASSES = 'outline-focus-ring focus-visible:outline-2 focus-visible:outline-offset-2';
5
5
  /**
6
6
  * Keeps keyboard focus in place across a retry. A "Try again" button unmounts once the data arrives, and focus would
7
7
  * otherwise fall back to the top of the page; use it wherever a load error is replaced by the content it failed to load.
8
- * It is `useFocusHandOff` for one action; for several controls that hand focus on, use that hook.
8
+ * Inside a `Table`'s `renderEmptyState` the table hands focus to its rows or cards and to an `EmptyState.Title` itself; any other heading takes it through this hook.
9
9
  *
10
10
  * @param retry Starts the failed request again.
11
11
  * @returns `retryLoad` for the retry button, and `contentRef` for the element that replaces the error. That element takes
package/dist/styles.css CHANGED
@@ -142,9 +142,9 @@
142
142
  }
143
143
 
144
144
  /*
145
- * The keyboard focus ring of an element `useFocusHandOff` (or `useFocusAfterRetry`, built on it) made focusable, which marks
146
- * it with this attribute, so the element keeps its own classes. In `base`, so a utility on the element such as
147
- * `focus-visible:outline-hidden` still wins.
145
+ * The keyboard focus ring of an element `hooks/__internal__/useFocusHandOff` made focusable, behind `useFocusAfterRetry` and
146
+ * `Table`, which marks it with this attribute, so the element keeps its own classes. In `base`, so a utility on the element
147
+ * such as `focus-visible:outline-hidden` still wins.
148
148
  */
149
149
  @layer base {
150
150
  [data-focus-hand-off-target]:focus-visible {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flipdish/ui-library",
3
- "version": "0.71.0",
3
+ "version": "0.72.1",
4
4
  "description": "Flipdish Design System — atomic-design component library (Tailwind v4 + UntitledUI + React Aria).",
5
5
  "type": "module",
6
6
  "imports": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../src/hooks/useFocusHandOff/index.ts"],"sourcesContent":[null],"names":["isFocusableFromCodeOnly","takeFocusFromCodeOnly","useRef","useCallback"],"mappings":";;;;;AAKA;AACA,MAAM,sBAAsB,GAAG,4BAA4B;AAE3D;AACA;AACA,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC;AAEnE,MAAM,aAAa,GAAG,CAAC,OAAoB,KAAI;IAC7C,MAAM,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC,iBAAiB,CAAC;AACrD,IAAA,OAAO,KAAK,KAAK,IAAI,IAAI,mBAAmB,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;AACvE,CAAC;AAED;AACA;AACA;AACA,MAAM,eAAe,GAAG,CAAC,OAAoB,KAAI;IAC/C,IAAI,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,IAAI,aAAa,CAAC,OAAO,CAAC,IAAIA,2CAAuB,CAAC,OAAO,CAAC;QAAE;IAC7HC,yCAAqB,CAAC,OAAO,CAAC;AAC9B,IAAA,O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AACzB,YAAA,MAAM,KAAK;QACb;IACF,CAAC,EACH,EAAE,CACH;AAED,IAAA,MAAM,SAAS,GAAG,WAAW,CAAC,CAAC,MAA0B,KAAI;AAC3D,QAAA,IAAI,CAAC,MAAM;YAAE;QACb,eAAe,CAAC,MAAM,CAAC;QACvB,IAAI,CAAC,SAAS,CAAC,OAAO;YAAE;AACxB,QAAA,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM;;AAEhC,QAAA,IAAI,aAAa,CAAC,aAAa,KAAK,aAAa,CAAC,IAAI;YAAE,MAAM,CAAC,KAAK,EAAE;;AAEtE,QAAA,IAAI,aAAa,CAAC,aAAa,KAAK,aAAa,CAAC,IAAI;AAAE,YAAA,SAAS,CAAC,OAAO,GAAG,KAAK;IACnF,CAAC,EAAE,EAAE,CAAC;AAEN,IAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE;AAC/B;;"}
@@ -1,12 +0,0 @@
1
- /**
2
- * `useFocusHandOff` has no React Native implementation.
3
- *
4
- * This is a generated types-only stub (scripts/emit-native-stubs.mjs). It exists so
5
- * that importing `@flipdish/ui-library/hooks/useFocusHandOff` from React Native fails at
6
- * compile time rather than resolving to the web build's types. There is no
7
- * matching `index.js`, so Metro cannot bundle this module either.
8
- *
9
- * To make `useFocusHandOff` available on React Native, add an `index.native.tsx` beside
10
- * its `index.tsx` — the build picks it up automatically and this stub disappears.
11
- */
12
- export declare const __NO_REACT_NATIVE_IMPLEMENTATION__: never;