@bigbinary/neeto-molecules 1.0.52 → 1.0.53

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-molecules",
3
- "version": "1.0.52",
3
+ "version": "1.0.53",
4
4
  "description": "A package of reusable molecular components for neeto products.",
5
5
  "repository": "git@github.com:bigbinary/neeto-molecules.git",
6
6
  "author": "Amaljith K <amaljith.k@bigbinary.com>",
@@ -0,0 +1,21 @@
1
+ import React from "react";
2
+ /**
3
+ *
4
+ * A button that copies the given value to the clipboard.
5
+ *
6
+ * @example
7
+ *
8
+ * import CopyToClipboardButton from "@bigbinary/neeto-molecules/CopyToClipboardButton";
9
+ *
10
+ * const CopyToClipboardDemo = ({ value }) => (
11
+ * <CopyToClipboardButton label="Copy text" value={value} />
12
+ * );
13
+ * @endexample
14
+ */
15
+ const CopyToClipboardButton: React.FC<{
16
+ className?: string;
17
+ icon?: string | any;
18
+ label?: string;
19
+ value: string;
20
+ }>;
21
+ export default CopyToClipboardButton;
@@ -8,7 +8,7 @@ interface Category {
8
8
  [index: string]: Shortcut | string;
9
9
  fullShortcutsLink?: string;
10
10
  }
11
- interface ProductShortcuts {
11
+ interface ShortcutsObject {
12
12
  [index: string | TFunction]: Category;
13
13
  }
14
14
  /**
@@ -96,11 +96,48 @@ interface ProductShortcuts {
96
96
  * </>
97
97
  * );
98
98
  * @endexample
99
+ * This constant exposes the list of global shortcuts displayed by the pane to the product.
100
+ *
101
+ * It will give the following shortcuts:
102
+ *
103
+ * @example
104
+ *
105
+ * {
106
+ * GLOBAL: {
107
+ * openKeyboardShortcutsPane: {
108
+ * sequence: "shift+/",
109
+ * description: "See keyboard shortcuts",
110
+ * },
111
+ * close: {
112
+ * sequence: "esc",
113
+ * description: "Close modals, panes",
114
+ * },
115
+ * submitForm: {
116
+ * sequence: "command+return",
117
+ * description: "Submit form or text input",
118
+ * },
119
+ * },
120
+ * }
121
+ * @endexample
122
+ * It can be used by the product to implement the shortcuts without needing to define the shortcut constant again.
123
+ *
124
+ * @example
125
+ *
126
+ * import KeyboardShortcuts from "@bigbinary/neeto-molecules/KeyboardShortcuts";
127
+ * import { useHotKeys } from "neetocommons/react-utils";
128
+ *
129
+ * useHotKeys(
130
+ * KeyboardShortcuts.GLOBAL_SHORTCUTS.GLOBAL.submitForm.sequence,
131
+ * keyboardShortCutHandlers.SUBMIT_FORM,
132
+ * { mode: "global" }
133
+ * );
134
+ * @endexample
99
135
  */
100
136
  const KeyboardShortcuts: {
101
137
  Pane: React.FC<{
102
- productShortcuts?: ProductShortcuts;
138
+ productShortcuts?: ShortcutsObject;
103
139
  }>;
104
140
  usePaneState(): [boolean, React.Dispatch<React.SetStateAction<boolean>>];
141
+ GLOBAL_SHORTCUTS: ShortcutsObject;
105
142
  };
106
143
  export default KeyboardShortcuts;