@flipdish/ui-library 0.29.0 → 0.30.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 (131) hide show
  1. package/dist/components/atoms/Input/index.cjs +3 -1
  2. package/dist/components/atoms/Input/index.cjs.map +1 -1
  3. package/dist/components/atoms/Input/index.d.ts +5 -1
  4. package/dist/components/atoms/Input/index.d.ts.map +1 -1
  5. package/dist/components/atoms/Input/index.js +3 -1
  6. package/dist/components/atoms/Input/index.js.map +1 -1
  7. package/dist/components/molecules/Select/components/combobox.cjs +3 -1
  8. package/dist/components/molecules/Select/components/combobox.cjs.map +1 -1
  9. package/dist/components/molecules/Select/components/combobox.d.ts.map +1 -1
  10. package/dist/components/molecules/Select/components/combobox.js +3 -1
  11. package/dist/components/molecules/Select/components/combobox.js.map +1 -1
  12. package/dist/components/organisms/ApplicationHeader/applicationHeader.types.d.ts +12 -5
  13. package/dist/components/organisms/ApplicationHeader/applicationHeader.types.d.ts.map +1 -1
  14. package/dist/components/organisms/ApplicationHeader/index.cjs +12 -17
  15. package/dist/components/organisms/ApplicationHeader/index.cjs.map +1 -1
  16. package/dist/components/organisms/ApplicationHeader/index.d.ts +9 -5
  17. package/dist/components/organisms/ApplicationHeader/index.d.ts.map +1 -1
  18. package/dist/components/organisms/ApplicationHeader/index.js +12 -18
  19. package/dist/components/organisms/ApplicationHeader/index.js.map +1 -1
  20. package/dist/components/organisms/Calendar/index.cjs +3 -3
  21. package/dist/components/organisms/Calendar/index.cjs.map +1 -1
  22. package/dist/components/organisms/Calendar/index.js +3 -3
  23. package/dist/components/organisms/Calendar/index.js.map +1 -1
  24. package/dist/components/organisms/CommandMenu/commandMenu.utils.cjs +0 -21
  25. package/dist/components/organisms/CommandMenu/commandMenu.utils.cjs.map +1 -1
  26. package/dist/components/organisms/CommandMenu/commandMenu.utils.d.ts +0 -9
  27. package/dist/components/organisms/CommandMenu/commandMenu.utils.d.ts.map +1 -1
  28. package/dist/components/organisms/CommandMenu/commandMenu.utils.js +1 -21
  29. package/dist/components/organisms/CommandMenu/commandMenu.utils.js.map +1 -1
  30. package/dist/components/organisms/CommandMenu/components/command-input.cjs +2 -2
  31. package/dist/components/organisms/CommandMenu/components/command-input.cjs.map +1 -1
  32. package/dist/components/organisms/CommandMenu/components/command-input.d.ts +3 -2
  33. package/dist/components/organisms/CommandMenu/components/command-input.d.ts.map +1 -1
  34. package/dist/components/organisms/CommandMenu/components/command-input.js +2 -2
  35. package/dist/components/organisms/CommandMenu/components/command-input.js.map +1 -1
  36. package/dist/components/organisms/CommandMenu/components/command-menu-item.cjs +15 -2
  37. package/dist/components/organisms/CommandMenu/components/command-menu-item.cjs.map +1 -1
  38. package/dist/components/organisms/CommandMenu/components/command-menu-item.d.ts +9 -1
  39. package/dist/components/organisms/CommandMenu/components/command-menu-item.d.ts.map +1 -1
  40. package/dist/components/organisms/CommandMenu/components/command-menu-item.js +15 -2
  41. package/dist/components/organisms/CommandMenu/components/command-menu-item.js.map +1 -1
  42. package/dist/components/organisms/CommandMenu/components/command-shortcut.cjs +2 -2
  43. package/dist/components/organisms/CommandMenu/components/command-shortcut.cjs.map +1 -1
  44. package/dist/components/organisms/CommandMenu/components/command-shortcut.d.ts +1 -0
  45. package/dist/components/organisms/CommandMenu/components/command-shortcut.d.ts.map +1 -1
  46. package/dist/components/organisms/CommandMenu/components/command-shortcut.js +2 -2
  47. package/dist/components/organisms/CommandMenu/components/command-shortcut.js.map +1 -1
  48. package/dist/components/organisms/CommandMenu/index.cjs +65 -29
  49. package/dist/components/organisms/CommandMenu/index.cjs.map +1 -1
  50. package/dist/components/organisms/CommandMenu/index.d.ts +29 -2
  51. package/dist/components/organisms/CommandMenu/index.d.ts.map +1 -1
  52. package/dist/components/organisms/CommandMenu/index.js +69 -33
  53. package/dist/components/organisms/CommandMenu/index.js.map +1 -1
  54. package/dist/components/organisms/CommandMenu/providers/command-menu-link-context.cjs +9 -0
  55. package/dist/components/organisms/CommandMenu/providers/command-menu-link-context.cjs.map +1 -0
  56. package/dist/components/organisms/CommandMenu/providers/command-menu-link-context.d.ts +3 -0
  57. package/dist/components/organisms/CommandMenu/providers/command-menu-link-context.d.ts.map +1 -0
  58. package/dist/components/organisms/CommandMenu/providers/command-menu-link-context.js +7 -0
  59. package/dist/components/organisms/CommandMenu/providers/command-menu-link-context.js.map +1 -0
  60. package/dist/components/organisms/DatePicker/components/input-date.cjs +3 -1
  61. package/dist/components/organisms/DatePicker/components/input-date.cjs.map +1 -1
  62. package/dist/components/organisms/DatePicker/components/input-date.d.ts +5 -1
  63. package/dist/components/organisms/DatePicker/components/input-date.d.ts.map +1 -1
  64. package/dist/components/organisms/DatePicker/components/input-date.js +3 -1
  65. package/dist/components/organisms/DatePicker/components/input-date.js.map +1 -1
  66. package/dist/components/organisms/HeaderNavigation/components/nav-account-card.cjs +3 -1
  67. package/dist/components/organisms/HeaderNavigation/components/nav-account-card.cjs.map +1 -1
  68. package/dist/components/organisms/HeaderNavigation/components/nav-account-card.d.ts +1 -1
  69. package/dist/components/organisms/HeaderNavigation/components/nav-account-card.d.ts.map +1 -1
  70. package/dist/components/organisms/HeaderNavigation/components/nav-account-card.js +3 -1
  71. package/dist/components/organisms/HeaderNavigation/components/nav-account-card.js.map +1 -1
  72. package/dist/components/organisms/SidebarNavigation/components/nav-account-card.cjs +3 -1
  73. package/dist/components/organisms/SidebarNavigation/components/nav-account-card.cjs.map +1 -1
  74. package/dist/components/organisms/SidebarNavigation/components/nav-account-card.d.ts +1 -1
  75. package/dist/components/organisms/SidebarNavigation/components/nav-account-card.d.ts.map +1 -1
  76. package/dist/components/organisms/SidebarNavigation/components/nav-account-card.js +3 -1
  77. package/dist/components/organisms/SidebarNavigation/components/nav-account-card.js.map +1 -1
  78. package/dist/components/organisms/SidebarNavigation/index.cjs +15 -5
  79. package/dist/components/organisms/SidebarNavigation/index.cjs.map +1 -1
  80. package/dist/components/organisms/SidebarNavigation/index.d.ts +3 -2
  81. package/dist/components/organisms/SidebarNavigation/index.d.ts.map +1 -1
  82. package/dist/components/organisms/SidebarNavigation/index.js +15 -5
  83. package/dist/components/organisms/SidebarNavigation/index.js.map +1 -1
  84. package/dist/components/organisms/TextEditor/components/text-editor-extensions.cjs +9 -4
  85. package/dist/components/organisms/TextEditor/components/text-editor-extensions.cjs.map +1 -1
  86. package/dist/components/organisms/TextEditor/components/text-editor-extensions.d.ts.map +1 -1
  87. package/dist/components/organisms/TextEditor/components/text-editor-extensions.js +10 -5
  88. package/dist/components/organisms/TextEditor/components/text-editor-extensions.js.map +1 -1
  89. package/dist/components/organisms/TextEditor/components/text-editor-toolbar.cjs +8 -2
  90. package/dist/components/organisms/TextEditor/components/text-editor-toolbar.cjs.map +1 -1
  91. package/dist/components/organisms/TextEditor/components/text-editor-toolbar.d.ts.map +1 -1
  92. package/dist/components/organisms/TextEditor/components/text-editor-toolbar.js +8 -2
  93. package/dist/components/organisms/TextEditor/components/text-editor-toolbar.js.map +1 -1
  94. package/dist/components/organisms/TextEditor/textEditor.utils.cjs +3 -0
  95. package/dist/components/organisms/TextEditor/textEditor.utils.cjs.map +1 -1
  96. package/dist/components/organisms/TextEditor/textEditor.utils.d.ts +4 -0
  97. package/dist/components/organisms/TextEditor/textEditor.utils.d.ts.map +1 -1
  98. package/dist/components/organisms/TextEditor/textEditor.utils.js +3 -1
  99. package/dist/components/organisms/TextEditor/textEditor.utils.js.map +1 -1
  100. package/dist/hooks/__internal__/useHotkeyHint/useHotkeyHint.cjs +24 -0
  101. package/dist/hooks/__internal__/useHotkeyHint/useHotkeyHint.cjs.map +1 -0
  102. package/dist/hooks/__internal__/useHotkeyHint/useHotkeyHint.d.ts +22 -0
  103. package/dist/hooks/__internal__/useHotkeyHint/useHotkeyHint.d.ts.map +1 -0
  104. package/dist/hooks/__internal__/useHotkeyHint/useHotkeyHint.js +22 -0
  105. package/dist/hooks/__internal__/useHotkeyHint/useHotkeyHint.js.map +1 -0
  106. package/dist/hooks/__internal__/useKeySequences/useKeySequences.cjs +54 -0
  107. package/dist/hooks/__internal__/useKeySequences/useKeySequences.cjs.map +1 -0
  108. package/dist/hooks/__internal__/useKeySequences/useKeySequences.d.ts +11 -0
  109. package/dist/hooks/__internal__/useKeySequences/useKeySequences.d.ts.map +1 -0
  110. package/dist/hooks/__internal__/useKeySequences/useKeySequences.js +52 -0
  111. package/dist/hooks/__internal__/useKeySequences/useKeySequences.js.map +1 -0
  112. package/dist/hooks/usePlatform/index.cjs +22 -0
  113. package/dist/hooks/usePlatform/index.cjs.map +1 -0
  114. package/dist/hooks/usePlatform/index.d.ts +22 -0
  115. package/dist/hooks/usePlatform/index.d.ts.map +1 -0
  116. package/dist/hooks/usePlatform/index.js +20 -0
  117. package/dist/hooks/usePlatform/index.js.map +1 -0
  118. package/dist/native/hooks/usePlatform/index.d.ts +12 -0
  119. package/dist/utilities/__internal__/hotkeysUtils/hotkeys.utils.cjs +222 -15
  120. package/dist/utilities/__internal__/hotkeysUtils/hotkeys.utils.cjs.map +1 -1
  121. package/dist/utilities/__internal__/hotkeysUtils/hotkeys.utils.d.ts +60 -5
  122. package/dist/utilities/__internal__/hotkeysUtils/hotkeys.utils.d.ts.map +1 -1
  123. package/dist/utilities/__internal__/hotkeysUtils/hotkeys.utils.js +215 -15
  124. package/dist/utilities/__internal__/hotkeysUtils/hotkeys.utils.js.map +1 -1
  125. package/dist/utilities/__internal__/platformUtils/platform.utils.cjs +26 -0
  126. package/dist/utilities/__internal__/platformUtils/platform.utils.cjs.map +1 -0
  127. package/dist/utilities/__internal__/platformUtils/platform.utils.d.ts +10 -0
  128. package/dist/utilities/__internal__/platformUtils/platform.utils.d.ts.map +1 -0
  129. package/dist/utilities/__internal__/platformUtils/platform.utils.js +23 -0
  130. package/dist/utilities/__internal__/platformUtils/platform.utils.js.map +1 -0
  131. package/package.json +1 -1
@@ -0,0 +1,22 @@
1
+ export interface HotkeyHintOptions {
2
+ /**
3
+ * Which devices press ⌘ for `mod`. `mac` matches `react-hotkeys-hook`, which uses ⌘ on macOS only.
4
+ * `apple` matches editors built on ProseMirror, which also use ⌘ on iPhone and iPad.
5
+ * @default "mac"
6
+ */
7
+ commandOn?: 'mac' | 'apple';
8
+ }
9
+ /**
10
+ * Turns a shortcut into the label for the user's device: `mod+k` and `⌘K` both read `⌘K` on macOS and
11
+ * `Ctrl K` elsewhere. Serves every shortcut label in the library, whether the value is a real hotkey or
12
+ * display text: text that is not a hotkey (`Hold to talk`) is returned exactly as written. Reads as
13
+ * the non-Mac form on the server and during hydration.
14
+ *
15
+ * @param hotkey `react-hotkeys-hook` syntax (`mod+k`, `mod+slash`, a sequence such as `g>p`), the symbol
16
+ * shorthand (`⌘K`), a shortcut written out (`Ctrl+K`), or any other text.
17
+ * @returns The label, or `undefined` when nothing is given.
18
+ *
19
+ * @summary format a hotkey as a platform-aware label such as ⌘K or Ctrl K
20
+ */
21
+ export declare const useHotkeyHint: (hotkey: string | null | undefined, { commandOn }?: HotkeyHintOptions) => string | undefined;
22
+ //# sourceMappingURL=useHotkeyHint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useHotkeyHint.d.ts","sourceRoot":"","sources":["../../../../src/hooks/__internal__/useHotkeyHint/useHotkeyHint.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,SAAS,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;CAC7B;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,GAAI,QAAQ,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,gBAAuB,iBAAsB,KAAG,MAAM,GAAG,SAIzH,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { usePlatform } from '@flipdish/ui-library/hooks/usePlatform';
2
+ import { formatHotkeyLabel } from '../../../utilities/__internal__/hotkeysUtils/hotkeys.utils.js';
3
+
4
+ /**
5
+ * Turns a shortcut into the label for the user's device: `mod+k` and `⌘K` both read `⌘K` on macOS and
6
+ * `Ctrl K` elsewhere. Serves every shortcut label in the library, whether the value is a real hotkey or
7
+ * display text: text that is not a hotkey (`Hold to talk`) is returned exactly as written. Reads as
8
+ * the non-Mac form on the server and during hydration.
9
+ *
10
+ * @param hotkey `react-hotkeys-hook` syntax (`mod+k`, `mod+slash`, a sequence such as `g>p`), the symbol
11
+ * shorthand (`⌘K`), a shortcut written out (`Ctrl+K`), or any other text.
12
+ * @returns The label, or `undefined` when nothing is given.
13
+ *
14
+ * @summary format a hotkey as a platform-aware label such as ⌘K or Ctrl K
15
+ */
16
+ const useHotkeyHint = (hotkey, { commandOn = 'mac' } = {}) => {
17
+ const { isMac, isApple } = usePlatform();
18
+ return hotkey ? formatHotkeyLabel(hotkey, commandOn === 'apple' ? isApple : isMac) : undefined;
19
+ };
20
+
21
+ export { useHotkeyHint };
22
+ //# sourceMappingURL=useHotkeyHint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useHotkeyHint.js","sources":["../../../../src/hooks/__internal__/useHotkeyHint/useHotkeyHint.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAcA;;;;;;;;;;;AAWG;AACI,MAAM,aAAa,GAAG,CAAC,MAAiC,EAAE,EAAE,SAAS,GAAG,KAAK,EAAA,GAAwB,EAAE,KAAwB;IACpI,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,WAAW,EAAE;IAExC,OAAO,MAAM,GAAG,iBAAiB,CAAC,MAAM,EAAE,SAAS,KAAK,OAAO,GAAG,OAAO,GAAG,KAAK,CAAC,GAAG,SAAS;AAChG;;;;"}
@@ -0,0 +1,54 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var hotkeys_utils = require('../../../utilities/__internal__/hotkeysUtils/hotkeys.utils.cjs');
5
+ var platform_utils = require('../../../utilities/__internal__/platformUtils/platform.utils.cjs');
6
+
7
+ /**
8
+ * Listens for plain-key shortcuts typed anywhere on the page: single keys (`?`) and sequences
9
+ * (`g` then `p`), including sequences that share a first key, which `react-hotkeys-hook` cannot
10
+ * tell apart. Keys pressed with ⌘/Ctrl/Alt or Shift plus a letter, or while focus is in a field, are ignored so ordinary
11
+ * typing and other shortcuts are never hijacked. A sequence must be completed within `timeoutMs`
12
+ * of its previous key.
13
+ *
14
+ * @summary match single-key and multi-key plain shortcuts outside form fields
15
+ */
16
+ const useKeySequences = (sequences, onMatch, timeoutMs = 1000) => {
17
+ const latest = React.useRef({ sequences, onMatch });
18
+ React.useEffect(() => {
19
+ latest.current = { sequences, onMatch };
20
+ });
21
+ const hasSequences = sequences.length > 0;
22
+ React.useEffect(() => {
23
+ if (!hasSequences)
24
+ return;
25
+ let buffer = [];
26
+ let lastKeyAt = 0;
27
+ const onKeyDown = (event) => {
28
+ // A key name longer than one character (Shift, Enter, ArrowDown) is not a typed character.
29
+ if (event.defaultPrevented || event.repeat || event.key.length !== 1 || hotkeys_utils.isTypingInField(event))
30
+ return;
31
+ // AltGr (reported as Ctrl+Alt on Windows) and Option on Apple keyboards type characters such as `@` or `[` on many layouts.
32
+ const os = platform_utils.getPlatformOs();
33
+ const typesCharacter = event.getModifierState('AltGraph') || ((os === 'macos' || os === 'ios') && event.altKey && !event.ctrlKey);
34
+ if (event.metaKey || ((event.ctrlKey || event.altKey) && !typesCharacter))
35
+ return;
36
+ // Shift plus a letter is its own shortcut (`⇧d`), not the letter.
37
+ if (event.shiftKey && event.key.toLowerCase() !== event.key.toUpperCase())
38
+ return;
39
+ const now = Date.now();
40
+ const result = hotkeys_utils.advanceKeySequence(now - lastKeyAt > timeoutMs ? [] : buffer, event.key.toLowerCase(), latest.current.sequences);
41
+ buffer = result.buffer;
42
+ lastKeyAt = now;
43
+ if (result.matched !== undefined) {
44
+ event.preventDefault();
45
+ latest.current.onMatch(result.matched);
46
+ }
47
+ };
48
+ document.addEventListener('keydown', onKeyDown);
49
+ return () => document.removeEventListener('keydown', onKeyDown);
50
+ }, [hasSequences, timeoutMs]);
51
+ };
52
+
53
+ exports.useKeySequences = useKeySequences;
54
+ //# sourceMappingURL=useKeySequences.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useKeySequences.cjs","sources":["../../../../src/hooks/__internal__/useKeySequences/useKeySequences.ts"],"sourcesContent":[null],"names":["useRef","useEffect","isTypingInField","getPlatformOs","advanceKeySequence"],"mappings":";;;;;;AAMA;;;;;;;;AAQG;AACI,MAAM,eAAe,GAAG,CAAC,SAAqB,EAAE,OAAgC,EAAE,SAAS,GAAG,IAAI,KAAU;IACjH,MAAM,MAAM,GAAGA,YAAM,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;IAC7CC,eAAS,CAAC,MAAK;QACb,MAAM,CAAC,OAAO,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE;AACzC,IAAA,CAAC,CAAC;AAEF,IAAA,MAAM,YAAY,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC;IAEzCA,eAAS,CAAC,MAAK;AACb,QAAA,IAAI,CAAC,YAAY;YAAE;QAEnB,IAAI,MAAM,GAAa,EAAE;QACzB,IAAI,SAAS,GAAG,CAAC;AAEjB,QAAA,MAAM,SAAS,GAAG,CAAC,KAAoB,KAAI;;AAEzC,YAAA,IAAI,KAAK,CAAC,gBAAgB,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,KAAK,CAAC,IAAIC,6BAAe,CAAC,KAAK,CAAC;gBAAE;;AAEhG,YAAA,MAAM,EAAE,GAAGC,4BAAa,EAAE;AAC1B,YAAA,MAAM,cAAc,GAAG,KAAK,CAAC,gBAAgB,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,KAAK,OAAO,IAAI,EAAE,KAAK,KAAK,KAAK,KAAK,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;AACjI,YAAA,IAAI,KAAK,CAAC,OAAO,KAAK,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,cAAc,CAAC;gBAAE;;AAE3E,YAAA,IAAI,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC,GAAG,CAAC,WAAW,EAAE;gBAAE;AAE3E,YAAA,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE;AACtB,YAAA,MAAM,MAAM,GAAGC,gCAAkB,CAAC,GAAG,GAAG,SAAS,GAAG,SAAS,GAAG,EAAE,GAAG,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC;AAC/H,YAAA,MAAM,GAAG,MAAM,CAAC,MAAM;YACtB,SAAS,GAAG,GAAG;AAEf,YAAA,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,EAAE;gBAChC,KAAK,CAAC,cAAc,EAAE;gBACtB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;YACxC;AACF,QAAA,CAAC;AAED,QAAA,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC;QAC/C,OAAO,MAAM,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC;AACjE,IAAA,CAAC,EAAE,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;AAC/B;;;;"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Listens for plain-key shortcuts typed anywhere on the page: single keys (`?`) and sequences
3
+ * (`g` then `p`), including sequences that share a first key, which `react-hotkeys-hook` cannot
4
+ * tell apart. Keys pressed with ⌘/Ctrl/Alt or Shift plus a letter, or while focus is in a field, are ignored so ordinary
5
+ * typing and other shortcuts are never hijacked. A sequence must be completed within `timeoutMs`
6
+ * of its previous key.
7
+ *
8
+ * @summary match single-key and multi-key plain shortcuts outside form fields
9
+ */
10
+ export declare const useKeySequences: (sequences: string[][], onMatch: (index: number) => void, timeoutMs?: number) => void;
11
+ //# sourceMappingURL=useKeySequences.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useKeySequences.d.ts","sourceRoot":"","sources":["../../../../src/hooks/__internal__/useKeySequences/useKeySequences.ts"],"names":[],"mappings":"AAMA;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,GAAI,WAAW,MAAM,EAAE,EAAE,EAAE,SAAS,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,EAAE,kBAAgB,KAAG,IAsC3G,CAAC"}
@@ -0,0 +1,52 @@
1
+ import { useRef, useEffect } from 'react';
2
+ import { isTypingInField, advanceKeySequence } from '../../../utilities/__internal__/hotkeysUtils/hotkeys.utils.js';
3
+ import { getPlatformOs } from '../../../utilities/__internal__/platformUtils/platform.utils.js';
4
+
5
+ /**
6
+ * Listens for plain-key shortcuts typed anywhere on the page: single keys (`?`) and sequences
7
+ * (`g` then `p`), including sequences that share a first key, which `react-hotkeys-hook` cannot
8
+ * tell apart. Keys pressed with ⌘/Ctrl/Alt or Shift plus a letter, or while focus is in a field, are ignored so ordinary
9
+ * typing and other shortcuts are never hijacked. A sequence must be completed within `timeoutMs`
10
+ * of its previous key.
11
+ *
12
+ * @summary match single-key and multi-key plain shortcuts outside form fields
13
+ */
14
+ const useKeySequences = (sequences, onMatch, timeoutMs = 1000) => {
15
+ const latest = useRef({ sequences, onMatch });
16
+ useEffect(() => {
17
+ latest.current = { sequences, onMatch };
18
+ });
19
+ const hasSequences = sequences.length > 0;
20
+ useEffect(() => {
21
+ if (!hasSequences)
22
+ return;
23
+ let buffer = [];
24
+ let lastKeyAt = 0;
25
+ const onKeyDown = (event) => {
26
+ // A key name longer than one character (Shift, Enter, ArrowDown) is not a typed character.
27
+ if (event.defaultPrevented || event.repeat || event.key.length !== 1 || isTypingInField(event))
28
+ return;
29
+ // AltGr (reported as Ctrl+Alt on Windows) and Option on Apple keyboards type characters such as `@` or `[` on many layouts.
30
+ const os = getPlatformOs();
31
+ const typesCharacter = event.getModifierState('AltGraph') || ((os === 'macos' || os === 'ios') && event.altKey && !event.ctrlKey);
32
+ if (event.metaKey || ((event.ctrlKey || event.altKey) && !typesCharacter))
33
+ return;
34
+ // Shift plus a letter is its own shortcut (`⇧d`), not the letter.
35
+ if (event.shiftKey && event.key.toLowerCase() !== event.key.toUpperCase())
36
+ return;
37
+ const now = Date.now();
38
+ const result = advanceKeySequence(now - lastKeyAt > timeoutMs ? [] : buffer, event.key.toLowerCase(), latest.current.sequences);
39
+ buffer = result.buffer;
40
+ lastKeyAt = now;
41
+ if (result.matched !== undefined) {
42
+ event.preventDefault();
43
+ latest.current.onMatch(result.matched);
44
+ }
45
+ };
46
+ document.addEventListener('keydown', onKeyDown);
47
+ return () => document.removeEventListener('keydown', onKeyDown);
48
+ }, [hasSequences, timeoutMs]);
49
+ };
50
+
51
+ export { useKeySequences };
52
+ //# sourceMappingURL=useKeySequences.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useKeySequences.js","sources":["../../../../src/hooks/__internal__/useKeySequences/useKeySequences.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAMA;;;;;;;;AAQG;AACI,MAAM,eAAe,GAAG,CAAC,SAAqB,EAAE,OAAgC,EAAE,SAAS,GAAG,IAAI,KAAU;IACjH,MAAM,MAAM,GAAG,MAAM,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;IAC7C,SAAS,CAAC,MAAK;QACb,MAAM,CAAC,OAAO,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE;AACzC,IAAA,CAAC,CAAC;AAEF,IAAA,MAAM,YAAY,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC;IAEzC,SAAS,CAAC,MAAK;AACb,QAAA,IAAI,CAAC,YAAY;YAAE;QAEnB,IAAI,MAAM,GAAa,EAAE;QACzB,IAAI,SAAS,GAAG,CAAC;AAEjB,QAAA,MAAM,SAAS,GAAG,CAAC,KAAoB,KAAI;;AAEzC,YAAA,IAAI,KAAK,CAAC,gBAAgB,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,KAAK,CAAC,IAAI,eAAe,CAAC,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var React = require('react');
4
+ var platform_utils = require('../../utilities/__internal__/platformUtils/platform.utils.cjs');
5
+
6
+ const subscribeToNothing = () => () => { };
7
+ const getServerOs = () => 'unknown';
8
+ /**
9
+ * Reports the operating system of the user's device, for wording that depends on it: a shortcut
10
+ * label, a download link, a help article. Detection reads the user agent, so treat it as a best
11
+ * guess and never as a reason to change behaviour; use `useBreakpoints` or feature detection for
12
+ * that. Every flag is `false` on the server and during hydration, then settles on the real device.
13
+ *
14
+ * @summary detect the user's operating system, safely across hydration
15
+ */
16
+ const usePlatform = () => {
17
+ const os = React.useSyncExternalStore(subscribeToNothing, platform_utils.getPlatformOs, getServerOs);
18
+ return React.useMemo(() => ({ os, isMac: os === 'macos', isApple: os === 'macos' || os === 'ios', isWindows: os === 'windows' }), [os]);
19
+ };
20
+
21
+ exports.usePlatform = usePlatform;
22
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/hooks/usePlatform/index.ts"],"sourcesContent":[null],"names":["useSyncExternalStore","getPlatformOs","useMemo"],"mappings":";;;;;AAmBA,MAAM,kBAAkB,GAAG,MAAM,MAAK,EAAE,CAAC;AACzC,MAAM,WAAW,GAAG,MAAkB,SAAS;AAE/C;;;;;;;AAOG;AACI,MAAM,WAAW,GAAG,MAAmB;IAC5C,MAAM,EAAE,GAAGA,0BAAoB,CAAC,kBAAkB,EAAEC,4BAAa,EAAE,WAAW,CAAC;AAE/E,IAAA,OAAOC,aAAO,CAAC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,OAAO,EAAE,OAAO,EAAE,EAAE,KAAK,OAAO,IAAI,EAAE,KAAK,KAAK,EAAE,SAAS,EAAE,EAAE,KAAK,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AACnI;;;;"}
@@ -0,0 +1,22 @@
1
+ import type { PlatformOs } from '../../utilities/__internal__/platformUtils/platform.utils';
2
+ export type { PlatformOs };
3
+ export interface PlatformInfo {
4
+ /** The operating system, or `unknown` on the server, during hydration and when it cannot be told. */
5
+ os: PlatformOs;
6
+ /** macOS only, where ⌘ is the primary shortcut modifier. Also true for an iPad in desktop mode, which reports itself as a Mac. */
7
+ isMac: boolean;
8
+ /** Any Apple device: macOS, iPhone or iPad. */
9
+ isApple: boolean;
10
+ /** Windows only, where the primary shortcut modifier is `ctrl`. */
11
+ isWindows: boolean;
12
+ }
13
+ /**
14
+ * Reports the operating system of the user's device, for wording that depends on it: a shortcut
15
+ * label, a download link, a help article. Detection reads the user agent, so treat it as a best
16
+ * guess and never as a reason to change behaviour; use `useBreakpoints` or feature detection for
17
+ * that. Every flag is `false` on the server and during hydration, then settles on the real device.
18
+ *
19
+ * @summary detect the user's operating system, safely across hydration
20
+ */
21
+ export declare const usePlatform: () => PlatformInfo;
22
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/usePlatform/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2DAA2D,CAAC;AAE5F,YAAY,EAAE,UAAU,EAAE,CAAC;AAE3B,MAAM,WAAW,YAAY;IAC3B,qGAAqG;IACrG,EAAE,EAAE,UAAU,CAAC;IACf,kIAAkI;IAClI,KAAK,EAAE,OAAO,CAAC;IACf,+CAA+C;IAC/C,OAAO,EAAE,OAAO,CAAC;IACjB,mEAAmE;IACnE,SAAS,EAAE,OAAO,CAAC;CACpB;AAKD;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,QAAO,YAI9B,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { useSyncExternalStore, useMemo } from 'react';
2
+ import { getPlatformOs } from '../../utilities/__internal__/platformUtils/platform.utils.js';
3
+
4
+ const subscribeToNothing = () => () => { };
5
+ const getServerOs = () => 'unknown';
6
+ /**
7
+ * Reports the operating system of the user's device, for wording that depends on it: a shortcut
8
+ * label, a download link, a help article. Detection reads the user agent, so treat it as a best
9
+ * guess and never as a reason to change behaviour; use `useBreakpoints` or feature detection for
10
+ * that. Every flag is `false` on the server and during hydration, then settles on the real device.
11
+ *
12
+ * @summary detect the user's operating system, safely across hydration
13
+ */
14
+ const usePlatform = () => {
15
+ const os = useSyncExternalStore(subscribeToNothing, getPlatformOs, getServerOs);
16
+ return useMemo(() => ({ os, isMac: os === 'macos', isApple: os === 'macos' || os === 'ios', isWindows: os === 'windows' }), [os]);
17
+ };
18
+
19
+ export { usePlatform };
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/hooks/usePlatform/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAmBA,MAAM,kBAAkB,GAAG,MAAM,MAAK,EAAE,CAAC;AACzC,MAAM,WAAW,GAAG,MAAkB,SAAS;AAE/C;;;;;;;AAOG;AACI,MAAM,WAAW,GAAG,MAAmB;IAC5C,MAAM,EAAE,GAAG,oBAAoB,CAAC,kBAAkB,EAAE,aAAa,EAAE,WAAW,CAAC;AAE/E,IAAA,OAAO,OAAO,CAAC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,OAAO,EAAE,OAAO,EAAE,EAAE,KAAK,OAAO,IAAI,EAAE,KAAK,KAAK,EAAE,SAAS,EAAE,EAAE,KAAK,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AACnI;;;;"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * `usePlatform` 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/usePlatform` 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 `usePlatform` 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;
@@ -8,7 +8,8 @@
8
8
  * package directly. Keep it in sync with the source rather than editing it:
9
9
  * https://github.com/JohannesKlauss/react-hotkeys-hook/blob/main/packages/react-hotkeys-hook/src/lib/parseHotkeys.ts
10
10
  *
11
- * The display section below it is ours: platform detection and hint formatting built on that parser.
11
+ * The display section below it is ours: normalising and formatting hotkeys for labels, built on that parser.
12
+ * Platform detection lives in `platformUtils/platform.utils.ts`.
12
13
  */
13
14
  const reservedModifierKeywords = ['shift', 'alt', 'meta', 'mod', 'ctrl', 'control'];
14
15
  const mappedKeys = {
@@ -73,33 +74,239 @@ function parseHotkey(hotkey, splitKey = '+', sequenceSplitKey = '>', useKey = fa
73
74
  }
74
75
  // #endregion
75
76
  // #region Display
76
- const APPLE_MODIFIERS = { mod: '⌘', meta: '⌘', ctrl: '⌃', control: '⌃', alt: '⌥', shift: '⇧' };
77
+ const MAC_MODIFIERS = { mod: '⌘', meta: '⌘', ctrl: '⌃', control: '⌃', alt: '⌥', shift: '⇧' };
77
78
  const OTHER_MODIFIERS = { mod: 'Ctrl', meta: 'Win', ctrl: 'Ctrl', control: 'Ctrl', alt: 'Alt', shift: 'Shift' };
79
+ const LEGACY_SYMBOLS = { '⌘': 'mod', '⌃': 'ctrl', '⌥': 'alt', '⇧': 'shift' };
80
+ // `react-hotkeys-hook` matches the physical key, so it knows punctuation by name (`slash`), never by character (`/`).
81
+ const PUNCTUATION_KEY_NAMES = {
82
+ '/': 'slash',
83
+ ',': 'comma',
84
+ '.': 'period',
85
+ ';': 'semicolon',
86
+ "'": 'quote',
87
+ '[': 'bracketleft',
88
+ ']': 'bracketright',
89
+ '\\': 'backslash',
90
+ '-': 'minus',
91
+ '=': 'equal',
92
+ '`': 'backquote',
93
+ };
94
+ const KEY_NAME_CHARACTERS = Object.fromEntries(Object.entries(PUNCTUATION_KEY_NAMES).map(([character, name]) => [name, character]));
95
+ // Characters typed with Shift on a US layout, and the key they sit on.
96
+ const SHIFTED_KEYS = {
97
+ '?': 'slash',
98
+ '<': 'comma',
99
+ '>': 'period',
100
+ ':': 'semicolon',
101
+ '"': 'quote',
102
+ '{': 'bracketleft',
103
+ '}': 'bracketright',
104
+ '|': 'backslash',
105
+ _: 'minus',
106
+ '~': 'backquote',
107
+ '!': '1',
108
+ '@': '2',
109
+ '#': '3',
110
+ $: '4',
111
+ '%': '5',
112
+ '^': '6',
113
+ '&': '7',
114
+ '*': '8',
115
+ '(': '9',
116
+ ')': '0',
117
+ };
118
+ /** The character a key name stands for (`slash` is `/`), or the name itself when it is not punctuation. */
119
+ const hotkeyCharacter = (key) => KEY_NAME_CHARACTERS[key] ?? key;
120
+ /**
121
+ * Accepts a hotkey in `react-hotkeys-hook` format (`mod+k`) or the symbol shorthand (`⌘K`, `⌘⇧P`,
122
+ * `⌘+Shift+K`) and returns the hook format. `⌘` becomes `mod`, so it also works with Ctrl outside
123
+ * macOS. Within a token, leading symbols are modifiers and whatever follows them is one key.
124
+ * Punctuation becomes the key name the hook matches on (`⌘/` is `mod+slash`).
125
+ *
126
+ * `forDisplay` keeps a shifted symbol as written (`⌘?`). Without it, a shifted symbol in a combination
127
+ * becomes Shift plus its key (`mod+shift+slash`), which is the form that can be registered.
128
+ */
129
+ const normalizeHotkey = (hotkey, { forDisplay = false } = {}) => {
130
+ const keys = hotkey
131
+ .split('+')
132
+ .flatMap((token) => {
133
+ const characters = [...token.trim()];
134
+ const symbolCount = characters.findIndex((character) => !(character in LEGACY_SYMBOLS));
135
+ const symbols = symbolCount === -1 ? characters : characters.slice(0, symbolCount);
136
+ const key = symbolCount === -1 ? '' : characters.slice(symbolCount).join('');
137
+ return [...symbols.map((symbol) => LEGACY_SYMBOLS[symbol]), PUNCTUATION_KEY_NAMES[key] ?? key.toLowerCase()];
138
+ })
139
+ .filter(Boolean);
140
+ // On its own a shifted symbol stays a character, so it is matched as typed on any keyboard layout.
141
+ const expandShifted = !forDisplay && keys.some(isHotkeyModifier);
142
+ return [...new Set(keys.flatMap((key) => (expandShifted && key in SHIFTED_KEYS ? ['shift', SHIFTED_KEYS[key]] : [key])))].join('+');
143
+ };
144
+ /**
145
+ * Turns an item's `shortcutKeys` into hook-format steps. Each entry is one step (`['⌘e']` is a combination,
146
+ * `['g', 'p']` is G then P), except that an entry holding only modifiers joins the entry after it, so the
147
+ * older `['⌘', 'H']` spelling still means ⌘H.
148
+ */
149
+ const toHotkeySteps = (shortcutKeys, options) => {
150
+ const steps = [];
151
+ let pendingModifiers = [];
152
+ for (const entry of shortcutKeys) {
153
+ const normalized = normalizeHotkey(entry, options);
154
+ if (!normalized)
155
+ continue;
156
+ if (normalized.split('+').every(isHotkeyModifier)) {
157
+ pendingModifiers.push(normalized);
158
+ continue;
159
+ }
160
+ steps.push([...pendingModifiers, normalized].join('+'));
161
+ pendingModifiers = [];
162
+ }
163
+ return pendingModifiers.length ? [...steps, pendingModifiers.join('+')] : steps;
164
+ };
165
+ /**
166
+ * Sorts an item shortcut by how it can be triggered:
167
+ * - `combination`: one step held with ⌘/Ctrl/Alt, safe to fire even while the user is typing.
168
+ * - `guarded`: one step that typing could produce (Shift+A) or a named key (F1), so it is ignored in fields.
169
+ * - `typed`: character keys pressed in turn (`?`, G then P), also ignored in fields.
170
+ * - `unsupported`: several steps with a modifier or named key, which no handler can match.
171
+ */
172
+ const getItemHotkeyKind = (steps) => {
173
+ const stepKeys = steps.map((step) => step.split('+'));
174
+ const keys = stepKeys.flat();
175
+ const modifiers = keys.filter(isHotkeyModifier);
176
+ // A step with no key of its own would fire on every press of the modifier.
177
+ if (stepKeys.some((step) => step.every(isHotkeyModifier)))
178
+ return 'unsupported';
179
+ if (modifiers.length === 0 && keys.every((key) => hotkeyCharacter(key).length === 1))
180
+ return 'typed';
181
+ if (steps.length !== 1)
182
+ return 'unsupported';
183
+ return modifiers.some((modifier) => modifier !== 'shift') ? 'combination' : 'guarded';
184
+ };
185
+ const EDITABLE_TAGS = ['INPUT', 'TEXTAREA', 'SELECT'];
186
+ const EDITABLE_ROLES = ['textbox', 'searchbox', 'combobox', 'spinbutton'];
187
+ const isEditable = (target) => target instanceof HTMLElement &&
188
+ (target.isContentEditable || EDITABLE_TAGS.includes(target.tagName) || EDITABLE_ROLES.includes(target.getAttribute('role') ?? ''));
189
+ const deepActiveElement = () => {
190
+ let element = document.activeElement;
191
+ while (element?.shadowRoot?.activeElement)
192
+ element = element.shadowRoot.activeElement;
193
+ return element;
194
+ };
78
195
  /**
79
- * Whether `mod` means ⌘ on this device. Mirrors `react-hotkeys-hook`'s own rule exactly (macOS only, not
80
- * iOS/iPadOS) so a hint always names the key that fires the hotkey. Always `false` on the server.
196
+ * Whether a key event happened while the user is typing in a field, including one inside a shadow root.
197
+ * Checks the focused element as well as the event target, because react-aria re-dispatches keys typed
198
+ * in a combobox onto its list.
81
199
  */
82
- const isApplePlatform = () => typeof navigator !== 'undefined' && /mac/i.test(navigator.userAgent) && !/iphone|ipad|ipod/i.test(navigator.userAgent);
200
+ const isTypingInField = (event) => isEditable(event.composedPath()[0] ?? event.target) || isEditable(event.target) || isEditable(deepActiveElement());
201
+ const startsWith = (sequence, prefix) => prefix.every((key, index) => sequence[index] === key);
202
+ /**
203
+ * Feeds one typed key into the keys typed so far and reports whether a sequence is now complete.
204
+ * Returns the index of the matched sequence and an empty buffer, or the buffer to carry forward:
205
+ * the longest run of recent keys that still begins some sequence.
206
+ */
207
+ const advanceKeySequence = (typedKeys, key, sequences) => {
208
+ const typed = [...typedKeys, key];
209
+ for (let start = 0; start < typed.length; start++) {
210
+ const candidate = typed.slice(start);
211
+ const matched = sequences.findIndex((sequence) => sequence.length === candidate.length && startsWith(sequence, candidate));
212
+ if (matched !== -1)
213
+ return { buffer: [], matched };
214
+ if (sequences.some((sequence) => startsWith(sequence, candidate)))
215
+ return { buffer: candidate };
216
+ }
217
+ return { buffer: [] };
218
+ };
219
+ const NAMED_KEYS = new Set([
220
+ 'enter',
221
+ 'escape',
222
+ 'tab',
223
+ 'space',
224
+ 'backspace',
225
+ 'delete',
226
+ 'insert',
227
+ 'home',
228
+ 'end',
229
+ 'pageup',
230
+ 'pagedown',
231
+ 'arrowup',
232
+ 'arrowdown',
233
+ 'arrowleft',
234
+ 'arrowright',
235
+ ...Object.values(PUNCTUATION_KEY_NAMES),
236
+ ]);
237
+ const FUNCTION_KEY = /^f([1-9]|1\d|2[0-4])$/;
238
+ /**
239
+ * Whether a normalised hotkey is made only of modifiers and real keys. Display props accept any text
240
+ * (`"Ctrl K"`, `"Hold to talk"`), and formatting text that is not a hotkey would mangle it.
241
+ */
242
+ const isRecognisedHotkey = (hotkey) => {
243
+ const keys = hotkey.split('+').map(mapCode).filter(Boolean);
244
+ const isKey = (key) => [...key].length === 1 || FUNCTION_KEY.test(key) || NAMED_KEYS.has(key);
245
+ // A hotkey with no key of its own is usually one whose `+` key was lost in parsing (`⌘+`), so leave it alone.
246
+ return keys.some(isKey) && keys.every((key) => isHotkeyModifier(key) || isKey(key));
247
+ };
248
+ const KEY_LABELS = {
249
+ escape: 'Esc',
250
+ arrowup: '↑',
251
+ arrowdown: '↓',
252
+ arrowleft: '←',
253
+ arrowright: '→',
254
+ pageup: 'Page Up',
255
+ pagedown: 'Page Down',
256
+ };
257
+ const keyLabel = (key) => {
258
+ const character = hotkeyCharacter(key);
259
+ if (character.length === 1 || FUNCTION_KEY.test(key))
260
+ return character.toUpperCase();
261
+ return KEY_LABELS[key] ?? `${key[0].toUpperCase()}${key.slice(1)}`;
262
+ };
263
+ // Outside macOS, modifiers are conventionally written Win, Ctrl, Alt, Shift whatever order the author used.
264
+ const MODIFIER_ORDER = ['meta', 'mod', 'ctrl', 'control', 'alt', 'shift'];
83
265
  /**
84
266
  * Formats a hotkey for display: `mod+k` reads `⌘K` on macOS and `Ctrl K` elsewhere.
85
- * When several comma-separated alternatives are given, only the first is shown.
267
+ * `isMac` says whether `mod` is ⌘. For a `react-hotkeys-hook` key that is macOS only (not iOS).
268
+ * Formats one hotkey: of several comma-separated alternatives it draws only the first. `formatHotkeyLabel`
269
+ * is the entry point that draws them all.
86
270
  */
87
- const formatHotkeyHint = (hotkey, isApple) => {
88
- const modifiers = isApple ? APPLE_MODIFIERS : OTHER_MODIFIERS;
271
+ const formatHotkeyHint = (hotkey, isMac) => {
272
+ const modifiers = isMac ? MAC_MODIFIERS : OTHER_MODIFIERS;
89
273
  const [firstHotkey = ''] = parseKeysHookInput(hotkey);
90
- return firstHotkey
91
- .split('+')
92
- .map(mapCode)
93
- .filter(Boolean)
94
- .map((key) => (isHotkeyModifier(key) ? modifiers[key] : key.toUpperCase()))
95
- .join(isApple ? '' : ' ');
274
+ const keys = firstHotkey.split('+').map(mapCode).filter(Boolean);
275
+ const heldKeys = keys.filter(isHotkeyModifier);
276
+ const orderedModifiers = isMac ? heldKeys : [...heldKeys].sort((first, second) => MODIFIER_ORDER.indexOf(first) - MODIFIER_ORDER.indexOf(second));
277
+ return [...orderedModifiers.map((key) => modifiers[key]), ...keys.filter((key) => !isHotkeyModifier(key)).map(keyLabel)].join(isMac ? '' : ' ');
278
+ };
279
+ // `>` or `->` separates the steps of a sequence, unless `>` is itself the key (`mod+>`).
280
+ const SEQUENCE_SEPARATOR = /(?<=[^+\s])\s*(?:->|>)\s*(?=\S)/;
281
+ const ALTERNATIVE_SEPARATOR = /,(?=\s*\S)/;
282
+ const formatSteps = (hotkey, isMac) => {
283
+ const steps = hotkey.split(SEQUENCE_SEPARATOR).map((step) => normalizeHotkey(step, { forDisplay: true }));
284
+ return steps.every(isRecognisedHotkey) ? steps.map((step) => formatHotkeyHint(step, isMac)).join(' → ') : undefined;
285
+ };
286
+ /**
287
+ * Labels a shortcut for the platform. Accepts `react-hotkeys-hook` syntax (`mod+k`, `g>p`), the symbol
288
+ * shorthand (`⌘K`) or a shortcut written out (`Ctrl+K`), and draws each distinct comma-separated alternative.
289
+ * Text that is not a hotkey (`Hold to talk`) is returned exactly as written, so a display prop can take
290
+ * any label.
291
+ */
292
+ const formatHotkeyLabel = (hotkey, isMac) => {
293
+ const alternatives = hotkey.split(ALTERNATIVE_SEPARATOR).map((alternative) => formatSteps(alternative, isMac));
294
+ // `mod+k, ctrl+k` is two keys on a Mac but one label elsewhere, so repeats are dropped.
295
+ return alternatives.every((alternative) => alternative !== undefined) ? [...new Set(alternatives)].join(', ') : hotkey;
96
296
  };
97
297
  // #endregion
98
298
 
299
+ exports.advanceKeySequence = advanceKeySequence;
99
300
  exports.formatHotkeyHint = formatHotkeyHint;
100
- exports.isApplePlatform = isApplePlatform;
301
+ exports.formatHotkeyLabel = formatHotkeyLabel;
302
+ exports.getItemHotkeyKind = getItemHotkeyKind;
303
+ exports.hotkeyCharacter = hotkeyCharacter;
101
304
  exports.isHotkeyModifier = isHotkeyModifier;
305
+ exports.isRecognisedHotkey = isRecognisedHotkey;
306
+ exports.isTypingInField = isTypingInField;
102
307
  exports.mapCode = mapCode;
308
+ exports.normalizeHotkey = normalizeHotkey;
103
309
  exports.parseHotkey = parseHotkey;
104
310
  exports.parseKeysHookInput = parseKeysHookInput;
311
+ exports.toHotkeySteps = toHotkeySteps;
105
312
  //# sourceMappingURL=hotkeys.utils.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"hotkeys.utils.cjs","sources":["../../../../src/utilities/__internal__/hotkeysUtils/hotkeys.utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;;;;;;;AASG;AAoBH,MAAM,wBAAwB,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC;AAEnF,MAAM,UAAU,GAA2B;AACzC,IAAA,GAAG,EAAE,QAAQ;AACb,IAAA,MAAM,EAAE,OAAO;AACf,IAAA,IAAI,EAAE,WAAW;AACjB,IAAA,KAAK,EAAE,YAAY;AACnB,IAAA,EAAE,EAAE,SAAS;AACb,IAAA,IAAI,EAAE,WAAW;AACjB,IAAA,SAAS,EAAE,OAAO;AAClB,IAAA,UAAU,EAAE,OAAO;AACnB,IAAA,OAAO,EAAE,KAAK;AACd,IAAA,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AAO,GAAG,eAAe,GAAG,eAAe;IAC7D,MAAM,CAAC,WAAW,GAAG,EAAE,CAAC,GAAG,kBAAkB,CAAC,MAAM,CAAC;AAErD,IAAA,OAAO;SACJ,KAAK,CAAC,GAAG;SACT,GAAG,CAAC,OAAO;SACX,MAAM,CAAC,OAAO;SACd,GAAG,CAAC,CAAC,GAAG,MAAM,gBAAgB,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;SACzE,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,GAAG,CAAC;AAC7B;AACA;;;;;;;;;"}
1
+ {"version":3,"file":"hotkeys.utils.cjs","sources":["../../../../src/utilities/__internal__/hotkeysUtils/hotkeys.utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;;;;;;;;AAUG;AAoBH,MAAM,wBAAwB,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC;AAEnF,MAAM,UAAU,GAA2B;AACzC,IAAA,GAAG,EAAE,QAAQ;AACb,IAAA,MAAM,EAAE,OAAO;AACf,IAAA,IAAI,EAAE,WAAW;AACjB,IAAA,KAAK,EAAE,YAAY;AACnB,IAAA,EAAE,EAAE,SAAS;AACb,IAAA,IAAI,EAAE,WAAW;AACjB,IAAA,SAAS,EAAE,OAAO;AAClB,IAAA,UAAU,EAAE,OAAO;AACnB,IAAA,OAAO,EAAE,KAAK;AACd,IAAA,QAAQ,EAAE,KAAK;AACf,IAAA,QAAQ,EAAE,MAAM;AAChB,IAAA,SAAS,EAAE,MAAM;AACjB,IAAA,MAAM,EAAE,MAAM;AACd,IAAA,OAAO,EAAE,MAAM;AACf,IAAA,WAAW,EAAE,MAAM;AACnB,IAAA,YAAY,EAAE,MAAM;CACrB;AAEK,SAAU,OAAO,CAAC,GAAW,EAAA;IACjC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,E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