1 | "use strict";
|
2 |
|
3 | exports.__esModule = true;
|
4 | exports.notify = notify;
|
5 | exports.useFirstFocusedRender = useFirstFocusedRender;
|
6 | exports.useInstanceId = void 0;
|
7 |
|
8 | var _react = require("react");
|
9 |
|
10 | let idCount = 0;
|
11 |
|
12 | function uniqueId(prefix) {
|
13 | return '' + ((prefix == null ? '' : prefix) + ++idCount);
|
14 | }
|
15 |
|
16 | function notify(handler, args) {
|
17 |
|
18 | if (handler) handler.apply(null, args);
|
19 | }
|
20 |
|
21 | const useInstanceId = (otherId, suffix = '') => {
|
22 | const id = (0, _react.useRef)();
|
23 | if (!id.current) id.current = uniqueId('rw_');
|
24 | return (otherId || id.current) + suffix;
|
25 | };
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 | exports.useInstanceId = useInstanceId;
|
33 |
|
34 | function useFirstFocusedRender(focused, open) {
|
35 | const ref = (0, _react.useRef)(false);
|
36 | return ref.current || (focused || !!open) && (ref.current = true);
|
37 | } |
\ | No newline at end of file |