@splunk/react-ui 4.12.1 → 4.14.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 (122) hide show
  1. package/.storybook-visual/config/snapshotResolver.js +29 -0
  2. package/.storybook-visual/main.js +22 -0
  3. package/.storybook-visual/preview.jsx +31 -0
  4. package/.storybook-visual/scripts/test.sh +108 -0
  5. package/.storybook-visual/test-runner.js +108 -0
  6. package/Accordion.js +4 -4
  7. package/Anchor.js +2 -2
  8. package/Animation.js +6 -6
  9. package/AnimationToggle.js +2 -2
  10. package/Box.js +2 -2
  11. package/Button.js +23 -23
  12. package/ButtonGroup.js +2 -2
  13. package/ButtonSimple.js +7 -7
  14. package/CHANGELOG.md +33 -0
  15. package/Calendar.js +390 -95
  16. package/Card.js +25 -23
  17. package/CardLayout.js +2 -2
  18. package/Chip.js +17 -17
  19. package/Clickable.js +4 -4
  20. package/CloseButton.js +15 -15
  21. package/Code.js +4 -4
  22. package/CollapsiblePanel.js +15 -11
  23. package/Color.js +26 -26
  24. package/ColumnLayout.js +6 -6
  25. package/ComboBox.js +19 -19
  26. package/Concertina.js +6 -6
  27. package/ControlGroup.js +14 -13
  28. package/Date.js +118 -55
  29. package/DefinitionList.js +2 -2
  30. package/Divider.js +194 -0
  31. package/Dropdown.js +17 -13
  32. package/EventListener.js +4 -4
  33. package/File.js +23 -23
  34. package/FormRows.js +14 -14
  35. package/Heading.js +2 -2
  36. package/Image.js +19 -19
  37. package/JSONTree.js +2 -2
  38. package/Layer.js +85 -8
  39. package/Link.js +4 -4
  40. package/List.js +2 -2
  41. package/Markdown.js +18 -18
  42. package/Menu.js +51 -52
  43. package/Message.js +39 -39
  44. package/MessageBar.js +29 -29
  45. package/Modal.js +63 -37
  46. package/ModalLayer.js +11 -11
  47. package/Monogram.js +2 -2
  48. package/Multiselect.js +134 -125
  49. package/Number.js +8 -6
  50. package/Paginator.js +48 -48
  51. package/Paragraph.js +2 -2
  52. package/Popover.js +186 -19
  53. package/Progress.js +8 -8
  54. package/RadioBar.js +2 -2
  55. package/RadioList.js +4 -4
  56. package/Resize.js +4 -4
  57. package/ResultsMenu.js +20 -20
  58. package/ScreenReaderContent.js +2 -2
  59. package/Scroll.js +13 -13
  60. package/ScrollContainerContext.js +154 -3
  61. package/Search.js +25 -25
  62. package/Select.js +114 -105
  63. package/SidePanel.js +6 -6
  64. package/Slider.js +14 -14
  65. package/SlidingPanels.js +11 -11
  66. package/SplitButton.js +511 -0
  67. package/StaticContent.js +2 -2
  68. package/StepBar.js +10 -10
  69. package/Switch.js +8 -8
  70. package/TabBar.js +15 -15
  71. package/TabLayout.js +6 -6
  72. package/Table.js +275 -76
  73. package/Text.js +51 -42
  74. package/TextArea.js +41 -33
  75. package/Tooltip.js +17 -11
  76. package/TransitionOpen.js +39 -15
  77. package/Typography.js +4 -4
  78. package/WaitSpinner.js +4 -4
  79. package/package.json +12 -14
  80. package/test-runner-jest.config.js +18 -5
  81. package/types/src/Button/Button.d.ts +1 -1
  82. package/types/src/Calendar/Calendar.d.ts +15 -2
  83. package/types/src/Calendar/DateTable.d.ts +7 -3
  84. package/types/src/Calendar/Day.d.ts +14 -5
  85. package/types/src/CollapsiblePanel/CollapsiblePanel.d.ts +7 -3
  86. package/types/src/Date/Date.d.ts +17 -8
  87. package/types/src/Date/docs/examples/CustomDate.d.ts +2 -2
  88. package/types/src/Date/docs/examples/Disabled.d.ts +2 -2
  89. package/types/src/Date/docs/examples/prisma/WithoutCalendar.d.ts +2 -0
  90. package/types/src/Divider/Divider.d.ts +20 -0
  91. package/types/src/Divider/docs/examples/AriaHidden.d.ts +2 -0
  92. package/types/src/Divider/docs/examples/Basic.d.ts +2 -0
  93. package/types/src/Divider/docs/examples/CustomStyle.d.ts +2 -0
  94. package/types/src/Divider/docs/examples/Vertical.d.ts +2 -0
  95. package/types/src/Divider/index.d.ts +1 -0
  96. package/types/src/Dropdown/Dropdown.d.ts +11 -3
  97. package/types/src/Modal/Modal.d.ts +7 -3
  98. package/types/src/Modal/ModalContext.d.ts +1 -0
  99. package/types/src/Number/Number.d.ts +5 -1
  100. package/types/src/Popover/Popover.d.ts +5 -1
  101. package/types/src/Popover/getPlacement.d.ts +1 -1
  102. package/types/src/SplitButton/Item.d.ts +45 -0
  103. package/types/src/SplitButton/SplitButton.d.ts +41 -0
  104. package/types/src/SplitButton/docs/examples/Basic.d.ts +1 -0
  105. package/types/src/SplitButton/docs/examples/ChangeLabel.d.ts +1 -0
  106. package/types/src/SplitButton/docs/examples/Disabled.d.ts +1 -0
  107. package/types/src/SplitButton/docs/examples/prisma/Basic.d.ts +1 -0
  108. package/types/src/SplitButton/docs/examples/prisma/Disabled.d.ts +1 -0
  109. package/types/src/SplitButton/index.d.ts +2 -0
  110. package/types/src/Table/HeadCell.d.ts +4 -1
  111. package/types/src/Table/HeadDropdownCell.d.ts +10 -3
  112. package/types/src/Table/docs/examples/FilterColumnValues.d.ts +14 -0
  113. package/types/src/Text/Text.d.ts +5 -1
  114. package/types/src/TextArea/TextArea.d.ts +5 -1
  115. package/types/src/Tooltip/Tooltip.d.ts +10 -5
  116. package/types/src/TransitionOpen/TransitionOpen.d.ts +7 -3
  117. package/types/src/useForceUpdate/index.d.ts +2 -0
  118. package/types/src/useForceUpdate/useForceUpdate.d.ts +9 -0
  119. package/types/src/useKeyPress/index.d.ts +37 -0
  120. package/useForceUpdate.js +151 -0
  121. package/useKeyPress.js +160 -0
  122. package/usePrevious.js +2 -2
@@ -0,0 +1,37 @@
1
+ /**
2
+ * TargetKey is any key available via event.key: [https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key).
3
+ *
4
+ * This example shows a simple function by pressing the arrow up key.
5
+ *
6
+ *
7
+ * ```
8
+ * import React from 'react';
9
+ * import { useKeyPress } from '../../useKeyPress';
10
+ *
11
+ * const YEP = 'Yep';
12
+ * const NOPE = 'Nope';
13
+ *
14
+ * const BasicExample = () => {
15
+ * const [pressed, setPressed] = React.useState(false);
16
+ *
17
+ * const handleKeyPress = () => {
18
+ * setPressed(true);
19
+ * };
20
+ *
21
+ * useKeyPress('ArrowUp', handleKeyPress);
22
+ *
23
+ * return <div>{pressed ? YEP : NOPE}</div>;
24
+ * };
25
+ *
26
+ * export default BasicExample;
27
+ * ```
28
+ *
29
+ * @param {String} targetKey - The key value to listen to.
30
+ * @param {Function} handler - A function invoked when the target key is pressed.
31
+ * @public
32
+ */
33
+ declare type KeyboardEventKeys = 'Unidentified' | 'Alt' | 'AltGraph' | 'CapsLock' | 'Control' | 'Fn' | 'FnLock' | 'Hyper' | 'Meta' | 'NumLock' | 'ScrollLock' | 'Shift' | 'Super' | 'Symbol' | 'SymbolLock' | 'Enter' | 'Tab' | ' ' | 'ArrowDown' | 'ArrowLeft' | 'ArrowRight' | 'ArrowUp' | 'End' | 'Home' | 'PageDown' | 'PageUp' | 'Backspace' | 'Clear' | 'Copy' | 'CrSel' | 'Cut' | 'Delete' | 'EraseEof' | 'ExSel' | 'Insert' | 'Paste' | 'Redo' | 'Undo' | 'Accept' | 'Again' | 'Attn' | 'Cancel' | 'ContextMenu' | 'Escape' | 'Execute' | 'Find' | 'Finish' | 'Help' | 'Pause' | 'Play' | 'Props' | 'Select' | 'ZoomIn' | 'ZoomOut' | 'BrightnessDown' | 'BrightnessUp' | 'Eject' | 'LogOff' | 'Power' | 'PowerOff' | 'PrintScreen' | 'Hibernate' | 'Standby' | 'WakeUp' | 'AllCandidates' | 'Alphanumeric' | 'CodeInput' | 'Compose' | 'Convert' | 'Dead' | 'FinalMode' | 'GroupFirst' | 'GroupLast' | 'GroupNext' | 'GroupPrevious' | 'ModeChange' | 'NextCandidate' | 'NonConvert' | 'PreviousCandidate' | 'Process' | 'SingleCandidate' | 'HangulMode' | 'HanjaMode' | 'JunjaMode' | 'Eisu' | 'Hankaku' | 'Hiragana' | 'HiraganaKatakana' | 'KanaMode' | 'KanjiMode' | 'Katakana' | 'Romaji' | 'Zenkaku' | 'ZenkakuHanaku' | 'F1' | 'F2' | 'F3' | 'F4' | 'F5' | 'F6' | 'F7' | 'F8' | 'F9' | 'F10' | 'F11' | 'F12' | 'F13' | 'F14' | 'F15' | 'F16' | 'F17' | 'F18' | 'F19' | 'F20' | 'Soft1' | 'Soft2' | 'Soft3' | 'Soft4' | 'AppSwitch' | 'Call' | 'Camera' | 'CameraFocus' | 'EndCall' | 'GoBack' | 'GoHome' | 'HeadsetHook' | 'LastNumberRedial' | 'Notification' | 'MannerMode' | 'VoiceDial' | 'ChannelDown' | 'ChannelUp' | 'MediaFastForward' | 'MediaPause' | 'MediaPlay' | 'MediaPlayPause' | 'MediaRecord' | 'MediaRewind' | 'MediaStop' | 'MediaTrackNext' | 'MediaTrackPrevious' | 'AudioBalanceLeft' | 'AudioBalanceRight' | 'AudioBassDown' | 'AudioBassBoostDown' | 'AudioBassBoostToggle' | 'AudioBassBoostUp' | 'AudioBassUp' | 'AudioFaderFront' | 'AudioFaderRear' | 'AudioSurroundModeNext' | 'AudioTrebleDown' | 'AudioTrebleUp' | 'AudioVolumeDown' | 'AudioVolumeMute' | 'AudioVolumeUp' | 'MicrophoneToggle' | 'MicrophoneVolumeDown' | 'MicrophoneVolumeMute' | 'MicrophoneVolumeUp' | 'TV' | 'TV3DMode' | 'TVAntennaCable' | 'TVAudioDescription' | 'TVAudioDescriptionMixDown' | 'TVAudioDescriptionMixUp' | 'TVContentsMenu' | 'TVDataService' | 'TVInput' | 'TVInputComponent1' | 'TVInputComponent2' | 'TVInputComposite1' | 'TVInputComposite2' | 'TVInputHDMI1' | 'TVInputHDMI2' | 'TVInputHDMI3' | 'TVInputHDMI4' | 'TVInputVGA1' | 'TVMediaContext' | 'TVNetwork' | 'TVNumberEntry' | 'TVPower' | 'TVRadioService' | 'TVSatellite' | 'TVSatelliteBS' | 'TVSatelliteCS' | 'TVSatelliteToggle' | 'TVTerrestrialAnalog' | 'TVTerrestrialDigital' | 'TVTimer' | 'AVRInput' | 'AVRPower' | 'ColorF0Red' | 'ColorF1Green' | 'ColorF2Yellow' | 'ColorF3Blue' | 'ColorF4Grey' | 'ColorF5Brown' | 'ClosedCaptionToggle' | 'Dimmer' | 'DisplaySwap' | 'DVR' | 'Exit' | 'FavoriteClear0' | 'FavoriteClear1' | 'FavoriteClear2' | 'FavoriteClear3' | 'FavoriteRecall0' | 'FavoriteRecall1' | 'FavoriteRecall2' | 'FavoriteRecall3' | 'FavoriteStore0' | 'FavoriteStore1' | 'FavoriteStore2' | 'FavoriteStore3' | 'Guide' | 'GuideNextDay' | 'GuidePreviousDay' | 'Info' | 'InstantReplay' | 'Link' | 'ListProgram' | 'LiveContent' | 'Lock' | 'MediaApps' | 'MediaAudioTrack' | 'MediaLast' | 'MediaSkipBackward' | 'MediaSkipForward' | 'MediaStepBackward' | 'MediaStepForward' | 'MediaTopMenu' | 'NavigateIn' | 'NavigateNext' | 'NavigateOut' | 'NavigatePrevious' | 'NextFavoriteChannel' | 'NextUserProfile' | 'OnDemand' | 'Pairing' | 'PinPDown' | 'PinPMove' | 'PinPToggle' | 'PinPUp' | 'PlaySpeedDown' | 'PlaySpeedReset' | 'PlaySpeedUp' | 'RandomToggle' | 'RcLowBattery' | 'RecordSpeedNext' | 'RfBypass' | 'ScanChannelsToggle' | 'ScreenModeNext' | 'Settings' | 'SplitScreenToggle' | 'STBInput' | 'STBPower' | 'Subtitle' | 'Teletext' | 'VideoModeNext' | 'Wink' | 'ZoomToggle' | 'SpeechCorrectionList' | 'SpeechInputToggle' | 'Close' | 'New' | 'Open' | 'Print' | 'Save' | 'SpellCheck' | 'MailForward' | 'MailReply' | 'MailSend' | 'LaunchCalculator' | 'LaunchCalendar' | 'LaunchContacts' | 'LaunchMail' | 'LaunchMediaPlayer' | 'LaunchMusicPlayer' | 'LaunchMyComputer' | 'LaunchPhone' | 'LaunchScreenSaver' | 'LaunchSpreadsheet' | 'LaunchWebBrowser' | 'LaunchWebCam' | 'LaunchWordProcessor' | 'LaunchApplication1' | 'LaunchApplication2' | 'LaunchApplication3' | 'LaunchApplication4' | 'LaunchApplication5' | 'LaunchApplication6' | 'LaunchApplication7' | 'LaunchApplication8' | 'LaunchApplication9' | 'LaunchApplication10' | 'LaunchApplication11' | 'LaunchApplication12' | 'LaunchApplication13' | 'LaunchApplication14' | 'LaunchApplication15' | 'LaunchApplication16' | 'BrowserBack' | 'BrowserFavorites' | 'BrowserForward' | 'BrowserHome' | 'BrowserRefresh' | 'BrowserSearch' | 'BrowserStop' | 'Decimal' | 'Key11' | 'Key12' | 'Multiply' | 'Add' | 'Clear' | 'Divide' | 'Subtract' | 'Separator' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
34
+ declare type Handler = (event: Event) => void;
35
+ export declare function useKeyPress(targetKey: KeyboardEventKeys, handler: Handler): void;
36
+ export default useKeyPress;
37
+ export { Handler, KeyboardEventKeys };
@@ -0,0 +1,151 @@
1
+ module.exports =
2
+ /******/ (function(modules) { // webpackBootstrap
3
+ /******/ // The module cache
4
+ /******/ var installedModules = {};
5
+ /******/
6
+ /******/ // The require function
7
+ /******/ function __webpack_require__(moduleId) {
8
+ /******/
9
+ /******/ // Check if module is in cache
10
+ /******/ if(installedModules[moduleId]) {
11
+ /******/ return installedModules[moduleId].exports;
12
+ /******/ }
13
+ /******/ // Create a new module (and put it into the cache)
14
+ /******/ var module = installedModules[moduleId] = {
15
+ /******/ i: moduleId,
16
+ /******/ l: false,
17
+ /******/ exports: {}
18
+ /******/ };
19
+ /******/
20
+ /******/ // Execute the module function
21
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
22
+ /******/
23
+ /******/ // Flag the module as loaded
24
+ /******/ module.l = true;
25
+ /******/
26
+ /******/ // Return the exports of the module
27
+ /******/ return module.exports;
28
+ /******/ }
29
+ /******/
30
+ /******/
31
+ /******/ // expose the modules object (__webpack_modules__)
32
+ /******/ __webpack_require__.m = modules;
33
+ /******/
34
+ /******/ // expose the module cache
35
+ /******/ __webpack_require__.c = installedModules;
36
+ /******/
37
+ /******/ // define getter function for harmony exports
38
+ /******/ __webpack_require__.d = function(exports, name, getter) {
39
+ /******/ if(!__webpack_require__.o(exports, name)) {
40
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
41
+ /******/ }
42
+ /******/ };
43
+ /******/
44
+ /******/ // define __esModule on exports
45
+ /******/ __webpack_require__.r = function(exports) {
46
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
47
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
48
+ /******/ }
49
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
50
+ /******/ };
51
+ /******/
52
+ /******/ // create a fake namespace object
53
+ /******/ // mode & 1: value is a module id, require it
54
+ /******/ // mode & 2: merge all properties of value into the ns
55
+ /******/ // mode & 4: return value when already ns object
56
+ /******/ // mode & 8|1: behave like require
57
+ /******/ __webpack_require__.t = function(value, mode) {
58
+ /******/ if(mode & 1) value = __webpack_require__(value);
59
+ /******/ if(mode & 8) return value;
60
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
61
+ /******/ var ns = Object.create(null);
62
+ /******/ __webpack_require__.r(ns);
63
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
64
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
65
+ /******/ return ns;
66
+ /******/ };
67
+ /******/
68
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
69
+ /******/ __webpack_require__.n = function(module) {
70
+ /******/ var getter = module && module.__esModule ?
71
+ /******/ function getDefault() { return module['default']; } :
72
+ /******/ function getModuleExports() { return module; };
73
+ /******/ __webpack_require__.d(getter, 'a', getter);
74
+ /******/ return getter;
75
+ /******/ };
76
+ /******/
77
+ /******/ // Object.prototype.hasOwnProperty.call
78
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
79
+ /******/
80
+ /******/ // __webpack_public_path__
81
+ /******/ __webpack_require__.p = "";
82
+ /******/
83
+ /******/
84
+ /******/ // Load entry module and return exports
85
+ /******/ return __webpack_require__(__webpack_require__.s = 187);
86
+ /******/ })
87
+ /************************************************************************/
88
+ /******/ ({
89
+
90
+ /***/ 187:
91
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
92
+
93
+ "use strict";
94
+ // ESM COMPAT FLAG
95
+ __webpack_require__.r(__webpack_exports__);
96
+
97
+ // EXPORTS
98
+ __webpack_require__.d(__webpack_exports__, "default", function() { return /* reexport */ useForceUpdate_useForceUpdate; });
99
+
100
+ // EXTERNAL MODULE: external "react"
101
+ var external_react_ = __webpack_require__(2);
102
+
103
+ // CONCATENATED MODULE: ./src/useForceUpdate/useForceUpdate.tsx
104
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
105
+
106
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
107
+
108
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
109
+
110
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
111
+
112
+ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
113
+
114
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
115
+
116
+
117
+ /**
118
+ * This is a private component not intended for use outside @splunk/react-ui
119
+ *
120
+ * Triggers a rerender of a functional component. Useful as an escape hatch when a render is needed regardless of state.
121
+ * See https://reactjs.org/docs/hooks-faq.html#is-there-something-like-forceupdate
122
+ *
123
+ */
124
+
125
+ function useForceUpdate() {
126
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
127
+ var _useReducer = Object(external_react_["useReducer"])(function (x) {
128
+ return x + 1;
129
+ }, 0),
130
+ _useReducer2 = _slicedToArray(_useReducer, 2),
131
+ ignored = _useReducer2[0],
132
+ forceUpdate = _useReducer2[1];
133
+
134
+ return forceUpdate;
135
+ }
136
+
137
+ /* harmony default export */ var useForceUpdate_useForceUpdate = (useForceUpdate);
138
+ // CONCATENATED MODULE: ./src/useForceUpdate/index.ts
139
+
140
+
141
+
142
+ /***/ }),
143
+
144
+ /***/ 2:
145
+ /***/ (function(module, exports) {
146
+
147
+ module.exports = require("react");
148
+
149
+ /***/ })
150
+
151
+ /******/ });
package/useKeyPress.js ADDED
@@ -0,0 +1,160 @@
1
+ module.exports =
2
+ /******/ (function(modules) { // webpackBootstrap
3
+ /******/ // The module cache
4
+ /******/ var installedModules = {};
5
+ /******/
6
+ /******/ // The require function
7
+ /******/ function __webpack_require__(moduleId) {
8
+ /******/
9
+ /******/ // Check if module is in cache
10
+ /******/ if(installedModules[moduleId]) {
11
+ /******/ return installedModules[moduleId].exports;
12
+ /******/ }
13
+ /******/ // Create a new module (and put it into the cache)
14
+ /******/ var module = installedModules[moduleId] = {
15
+ /******/ i: moduleId,
16
+ /******/ l: false,
17
+ /******/ exports: {}
18
+ /******/ };
19
+ /******/
20
+ /******/ // Execute the module function
21
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
22
+ /******/
23
+ /******/ // Flag the module as loaded
24
+ /******/ module.l = true;
25
+ /******/
26
+ /******/ // Return the exports of the module
27
+ /******/ return module.exports;
28
+ /******/ }
29
+ /******/
30
+ /******/
31
+ /******/ // expose the modules object (__webpack_modules__)
32
+ /******/ __webpack_require__.m = modules;
33
+ /******/
34
+ /******/ // expose the module cache
35
+ /******/ __webpack_require__.c = installedModules;
36
+ /******/
37
+ /******/ // define getter function for harmony exports
38
+ /******/ __webpack_require__.d = function(exports, name, getter) {
39
+ /******/ if(!__webpack_require__.o(exports, name)) {
40
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
41
+ /******/ }
42
+ /******/ };
43
+ /******/
44
+ /******/ // define __esModule on exports
45
+ /******/ __webpack_require__.r = function(exports) {
46
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
47
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
48
+ /******/ }
49
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
50
+ /******/ };
51
+ /******/
52
+ /******/ // create a fake namespace object
53
+ /******/ // mode & 1: value is a module id, require it
54
+ /******/ // mode & 2: merge all properties of value into the ns
55
+ /******/ // mode & 4: return value when already ns object
56
+ /******/ // mode & 8|1: behave like require
57
+ /******/ __webpack_require__.t = function(value, mode) {
58
+ /******/ if(mode & 1) value = __webpack_require__(value);
59
+ /******/ if(mode & 8) return value;
60
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
61
+ /******/ var ns = Object.create(null);
62
+ /******/ __webpack_require__.r(ns);
63
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
64
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
65
+ /******/ return ns;
66
+ /******/ };
67
+ /******/
68
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
69
+ /******/ __webpack_require__.n = function(module) {
70
+ /******/ var getter = module && module.__esModule ?
71
+ /******/ function getDefault() { return module['default']; } :
72
+ /******/ function getModuleExports() { return module; };
73
+ /******/ __webpack_require__.d(getter, 'a', getter);
74
+ /******/ return getter;
75
+ /******/ };
76
+ /******/
77
+ /******/ // Object.prototype.hasOwnProperty.call
78
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
79
+ /******/
80
+ /******/ // __webpack_public_path__
81
+ /******/ __webpack_require__.p = "";
82
+ /******/
83
+ /******/
84
+ /******/ // Load entry module and return exports
85
+ /******/ return __webpack_require__(__webpack_require__.s = 114);
86
+ /******/ })
87
+ /************************************************************************/
88
+ /******/ ({
89
+
90
+ /***/ 114:
91
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
92
+
93
+ "use strict";
94
+ __webpack_require__.r(__webpack_exports__);
95
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useKeyPress", function() { return useKeyPress; });
96
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
97
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
98
+
99
+ /**
100
+ * TargetKey is any key available via event.key: [https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key).
101
+ *
102
+ * This example shows a simple function by pressing the arrow up key.
103
+ *
104
+ *
105
+ * ```
106
+ * import React from 'react';
107
+ * import { useKeyPress } from '../../useKeyPress';
108
+ *
109
+ * const YEP = 'Yep';
110
+ * const NOPE = 'Nope';
111
+ *
112
+ * const BasicExample = () => {
113
+ * const [pressed, setPressed] = React.useState(false);
114
+ *
115
+ * const handleKeyPress = () => {
116
+ * setPressed(true);
117
+ * };
118
+ *
119
+ * useKeyPress('ArrowUp', handleKeyPress);
120
+ *
121
+ * return <div>{pressed ? YEP : NOPE}</div>;
122
+ * };
123
+ *
124
+ * export default BasicExample;
125
+ * ```
126
+ *
127
+ * @param {String} targetKey - The key value to listen to.
128
+ * @param {Function} handler - A function invoked when the target key is pressed.
129
+ * @public
130
+ */
131
+
132
+ function useKeyPress(targetKey, handler) {
133
+ var handleKeyUp = Object(react__WEBPACK_IMPORTED_MODULE_0__["useCallback"])(function (event) {
134
+ if (event.key === targetKey) {
135
+ handler(event);
136
+ event.preventDefault();
137
+ }
138
+ }, [handler, targetKey]); // eslint-disable-next-line consistent-return
139
+
140
+ Object(react__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(function () {
141
+ if (typeof window !== 'undefined') {
142
+ window.addEventListener('keyup', handleKeyUp);
143
+ return function () {
144
+ window.removeEventListener('keyup', handleKeyUp);
145
+ };
146
+ }
147
+ }, [handleKeyUp]);
148
+ }
149
+ /* harmony default export */ __webpack_exports__["default"] = (useKeyPress);
150
+
151
+ /***/ }),
152
+
153
+ /***/ 2:
154
+ /***/ (function(module, exports) {
155
+
156
+ module.exports = require("react");
157
+
158
+ /***/ })
159
+
160
+ /******/ });
package/usePrevious.js CHANGED
@@ -82,12 +82,12 @@ module.exports =
82
82
  /******/
83
83
  /******/
84
84
  /******/ // Load entry module and return exports
85
- /******/ return __webpack_require__(__webpack_require__.s = 180);
85
+ /******/ return __webpack_require__(__webpack_require__.s = 188);
86
86
  /******/ })
87
87
  /************************************************************************/
88
88
  /******/ ({
89
89
 
90
- /***/ 180:
90
+ /***/ 188:
91
91
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
92
92
 
93
93
  "use strict";