@splunk/react-ui 5.0.0-rc.1 → 5.0.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.
- package/CHANGELOG.md +361 -0
- package/Calendar.js +148 -151
- package/Code.js +197 -167
- package/ComboBox.js +51 -51
- package/ControlGroup.js +1 -1
- package/Date.js +145 -147
- package/Dropdown.js +28 -25
- package/DualListbox.js +468 -469
- package/FetchOptions.d.ts +2 -2
- package/{MIGRATION.mdx → MIGRATION.md} +563 -44
- package/Markdown.js +3 -4
- package/Message.js +47 -43
- package/Modal.js +18 -18
- package/ModalLayer.js +15 -11
- package/Multiselect.js +768 -755
- package/Popover.js +156 -152
- package/README.md +6 -6
- package/Resize.js +149 -151
- package/ResultsMenu.js +116 -115
- package/Select.js +461 -461
- package/Slider.js +337 -339
- package/Table.js +856 -806
- package/Tooltip.js +192 -189
- package/TransitionOpen.js +4 -1
- package/package.json +15 -14
- package/types/src/Code/Code.d.ts +1 -1
- package/types/src/ControlGroup/ControlGroup.d.ts +1 -2
- package/types/src/Dropdown/Dropdown.d.ts +6 -2
- package/types/src/Number/Number.d.ts +1 -1
- package/types/src/Popover/Popover.d.ts +8 -1
- package/types/src/ResultsMenu/ResultsMenu.d.ts +2 -1
- package/types/src/Table/HeadCell.d.ts +6 -1
- package/types/src/Table/HeadInner.d.ts +3 -1
- package/types/src/Tooltip/Tooltip.d.ts +7 -7
- package/types/src/fixtures/useFetchOptions.d.ts +33 -0
- package/CHANGELOG.v5.mdx +0 -335
- package/MIGRATION.v5.mdx +0 -537
- package/types/src/Button/docs/examples/Truncated.d.ts +0 -3
- package/types/src/fixtures/FetchOptions.d.ts +0 -76
package/TransitionOpen.js
CHANGED
|
@@ -369,8 +369,11 @@
|
|
|
369
369
|
U(true);
|
|
370
370
|
}
|
|
371
371
|
}), [ w, H ]);
|
|
372
|
-
// equivalent to componentWillUnmount
|
|
372
|
+
// equivalent to componentDidMount and componentWillUnmount
|
|
373
373
|
(0, r.useEffect)((function() {
|
|
374
|
+
// we need to set this to true on every mount because React.StrictMode will call the effect twice
|
|
375
|
+
// and we need to ensure that allowAnimationUpdates is true while the component is mounted
|
|
376
|
+
L.current = true;
|
|
374
377
|
return function() {
|
|
375
378
|
L.current = false;
|
|
376
379
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@splunk/react-ui",
|
|
3
|
-
"version": "5.0.0
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Library of React components that implement the Splunk design language",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Splunk Inc.",
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
"storybook:build": "yarn sb build",
|
|
27
27
|
"stylelint": "stylelint \"src/**/*.{ts,tsx,js,jsx}\" --config stylelint.config.js",
|
|
28
28
|
"test": "jest",
|
|
29
|
-
"test:ci": "JEST_JUNIT_OUTPUT_DIR=./test-reports JEST_JUNIT_OUTPUT_NAME=unit-results.xml JEST_JUNIT_CLASSNAME=unit yarn run test --ci --reporters=default jest-junit --coverage --coverageDirectory=coverage_report/coverage_maps_unit --coverageReporters=cobertura",
|
|
30
29
|
"test:watch": "jest --watch",
|
|
31
30
|
"test:cypress": "yarn cypress open --component",
|
|
32
31
|
"test:cypress:ci": "yarn cypress run --component",
|
|
@@ -45,9 +44,9 @@
|
|
|
45
44
|
"@dnd-kit/sortable": "^8.0.0",
|
|
46
45
|
"@dnd-kit/utilities": "^3.2.2",
|
|
47
46
|
"@react-spring/web": "^9.7.5",
|
|
48
|
-
"@splunk/react-icons": "5.0.0
|
|
49
|
-
"@splunk/themes": "1.0.0
|
|
50
|
-
"@splunk/ui-utils": "^1.
|
|
47
|
+
"@splunk/react-icons": "^5.0.0",
|
|
48
|
+
"@splunk/themes": "^1.0.0",
|
|
49
|
+
"@splunk/ui-utils": "^1.9.0",
|
|
51
50
|
"decimal.js-light": "^2.2.3",
|
|
52
51
|
"lodash": "^4.17.14",
|
|
53
52
|
"moment": "^2.29.4",
|
|
@@ -61,9 +60,9 @@
|
|
|
61
60
|
"@babel/core": "^7.2.0",
|
|
62
61
|
"@babel/plugin-transform-runtime": "^7.18.6",
|
|
63
62
|
"@splunk/babel-preset": "^4.0.0",
|
|
64
|
-
"@splunk/docs-gen": "1.0.0
|
|
63
|
+
"@splunk/docs-gen": "^1.0.0",
|
|
65
64
|
"@splunk/eslint-config": "^5.0.0",
|
|
66
|
-
"@splunk/react-docs": "1.0.0
|
|
65
|
+
"@splunk/react-docs": "^1.0.0",
|
|
67
66
|
"@splunk/stylelint-config": "^5.0.0",
|
|
68
67
|
"@splunk/test-runner-utils": "^0.4.1",
|
|
69
68
|
"@splunk/webpack-configs": "^7.0.2",
|
|
@@ -75,11 +74,12 @@
|
|
|
75
74
|
"@storybook/react-webpack5": "^7.6.17",
|
|
76
75
|
"@storybook/test-runner": "0.16.0",
|
|
77
76
|
"@testing-library/cypress": "^9.0.0",
|
|
78
|
-
"@testing-library/
|
|
79
|
-
"@testing-library/
|
|
80
|
-
"@testing-library/react
|
|
81
|
-
"@testing-library/
|
|
82
|
-
"@
|
|
77
|
+
"@testing-library/dom": "^10.4.0",
|
|
78
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
79
|
+
"@testing-library/react": "^16.3.0",
|
|
80
|
+
"@testing-library/react-hooks": "^8.0.1",
|
|
81
|
+
"@testing-library/user-event": "^14.6.1",
|
|
82
|
+
"@types/jest": "^29.5.14",
|
|
83
83
|
"@types/lodash": "^4.14.156",
|
|
84
84
|
"@types/node": "^10.17.26",
|
|
85
85
|
"@types/prismjs": "^1.26.3",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"babel-plugin-transform-require-context": "^0.1.1",
|
|
102
102
|
"core-js": "^3.6.4",
|
|
103
103
|
"cross-env": "^6.0.3",
|
|
104
|
-
"cypress": "^
|
|
104
|
+
"cypress": "^13.17.0",
|
|
105
105
|
"cypress-real-events": "^1.9.1",
|
|
106
106
|
"eslint": "^8.57.1",
|
|
107
107
|
"eslint-config-airbnb": "^19.0.4",
|
|
@@ -120,7 +120,8 @@
|
|
|
120
120
|
"fs-readdir-recursive": "^1.0.0",
|
|
121
121
|
"glob": "^7.1.6",
|
|
122
122
|
"http-server": "^14.1.1",
|
|
123
|
-
"jest": "^
|
|
123
|
+
"jest": "^29.7.0",
|
|
124
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
124
125
|
"jest-image-snapshot": "^5.1.0",
|
|
125
126
|
"jest-junit": "^10.0.0",
|
|
126
127
|
"jest-stare": "^2.4.1",
|
package/types/src/Code/Code.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { ComponentProps } from '../utils/types';
|
|
4
|
-
type CodeSupportedLanguages = 'bash' | 'clike' | 'css' | 'html' | 'json' | 'javascript' | 'js' | 'jsx' | 'typescript' | 'ts' | 'tsx' | 'markup' | 'mathml' | 'plain' | 'plaintext' | 'splunk-spl' | 'svg' | 'text' | 'txt' | 'xml' | 'yaml' | 'yml';
|
|
4
|
+
type CodeSupportedLanguages = 'bash' | 'clike' | 'css' | 'html' | 'json' | 'javascript' | 'js' | 'jsx' | 'typescript' | 'ts' | 'tsx' | 'markup' | 'mathml' | 'plain' | 'plaintext' | 'splunk-spl' | 'sql' | 'svg' | 'text' | 'txt' | 'xml' | 'yaml' | 'yml';
|
|
5
5
|
interface CodePropsBase {
|
|
6
6
|
/**
|
|
7
7
|
* A React ref which is set to the DOM element when the component mounts and null when it unmounts.
|
|
@@ -15,8 +15,7 @@ interface ControlGroupPropsBase {
|
|
|
15
15
|
/**
|
|
16
16
|
* Highlight the control group as having an error and optionally provide error text.
|
|
17
17
|
* If error text is provided, displays it below the control.
|
|
18
|
-
*
|
|
19
|
-
* Child components will not turn red.
|
|
18
|
+
* In addition to passing this prop, set the error prop on child components.
|
|
20
19
|
*/
|
|
21
20
|
error?: boolean | string;
|
|
22
21
|
help?: React.ReactNode;
|
|
@@ -8,12 +8,15 @@ type DropdownChildrenRenderer = (data: {
|
|
|
8
8
|
maxHeight: number | null;
|
|
9
9
|
maxWidth: number | null;
|
|
10
10
|
placement: DropdownPlacementStatus | null;
|
|
11
|
+
toggleId?: string;
|
|
11
12
|
}) => React.ReactNode;
|
|
12
13
|
/** @public */
|
|
13
14
|
type DropdownPlacement = 'above' | 'below' | 'left' | 'right' | 'vertical' | 'horizontal';
|
|
14
15
|
/** @public */
|
|
15
16
|
type DropdownPlacementStatus = 'above' | 'below' | 'left' | 'right' | 'misaligned';
|
|
16
17
|
/** @public */
|
|
18
|
+
type DropdownPossibleOpenReason = 'toggleClick' | 'toggleKeydown';
|
|
19
|
+
/** @public */
|
|
17
20
|
type DropdownPossibleCloseReason = 'clickAway' | 'contentClick' | 'escapeKey' | 'offScreen' | 'tabKey' | 'toggleClick';
|
|
18
21
|
/** @public */
|
|
19
22
|
type DropdownRequestCloseHandler = (data: {
|
|
@@ -22,7 +25,7 @@ type DropdownRequestCloseHandler = (data: {
|
|
|
22
25
|
}) => void;
|
|
23
26
|
/** @public */
|
|
24
27
|
type DropdownRequestOpenHandler = (event: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>, data: {
|
|
25
|
-
reason:
|
|
28
|
+
reason: DropdownPossibleOpenReason;
|
|
26
29
|
}) => void;
|
|
27
30
|
/** @public */
|
|
28
31
|
type DropdownToggleElement = React.ReactElement<React.HTMLAttributes<HTMLElement> & {
|
|
@@ -147,7 +150,8 @@ declare namespace Dropdown {
|
|
|
147
150
|
takeFocus: PropTypes.Requireable<boolean>;
|
|
148
151
|
toggle: PropTypes.Validator<PropTypes.ReactElementLike>;
|
|
149
152
|
};
|
|
153
|
+
var possibleOpenReasons: DropdownPossibleOpenReason[];
|
|
150
154
|
var possibleCloseReasons: DropdownPossibleCloseReason[];
|
|
151
155
|
}
|
|
152
156
|
export default Dropdown;
|
|
153
|
-
export type { DropdownChildrenRenderer, DropdownPlacement, DropdownPlacementStatus, DropdownPossibleCloseReason, DropdownRequestCloseHandler, DropdownRequestOpenHandler, DropdownToggleElement, };
|
|
157
|
+
export type { DropdownChildrenRenderer, DropdownPlacement, DropdownPlacementStatus, DropdownPossibleOpenReason, DropdownPossibleCloseReason, DropdownRequestCloseHandler, DropdownRequestOpenHandler, DropdownToggleElement, };
|
|
@@ -9,6 +9,7 @@ type PopoverChildrenRenderer = (data: {
|
|
|
9
9
|
maxHeight: number | null;
|
|
10
10
|
maxWidth: number | null;
|
|
11
11
|
placement: PopoverPlacementStatus | null;
|
|
12
|
+
toggleId?: string;
|
|
12
13
|
}) => React.ReactNode;
|
|
13
14
|
/** @public */
|
|
14
15
|
type PopoverPlacement = 'above' | 'below' | 'left' | 'right' | 'vertical' | 'horizontal';
|
|
@@ -143,6 +144,11 @@ interface PopoverPropsBase {
|
|
|
143
144
|
* Disable this for a `Popover` that has shows on hover, such as a tooltip.
|
|
144
145
|
*/
|
|
145
146
|
takeFocus?: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Id of the toggle is added to aria-labelledby attribute of inner results menu
|
|
149
|
+
* @private
|
|
150
|
+
*/
|
|
151
|
+
toggleId?: string;
|
|
146
152
|
}
|
|
147
153
|
type PopoverProps = ComponentProps<PopoverPropsBase, 'div'>;
|
|
148
154
|
/**
|
|
@@ -150,7 +156,7 @@ type PopoverProps = ComponentProps<PopoverPropsBase, 'div'>;
|
|
|
150
156
|
* this only when the other components don't provide sufficient functionality or control. A controlled
|
|
151
157
|
* `Dropdown` covers use cases where you might consider using `Popover` directly.
|
|
152
158
|
*/
|
|
153
|
-
declare function Popover({ align, anchor, animation, animationConfig, appearance, autoCloseWhenOffScreen, canCoverAnchor, children, closeReasons, defaultPlacement, elementRef, hideArrow, hitAreaRef, id, onRequestClose, open, outerRef, pointTo, repositionMode, retainFocus, takeFocus, ...otherProps }: PopoverProps): React.JSX.Element;
|
|
159
|
+
declare function Popover({ align, anchor, animation, animationConfig, appearance, autoCloseWhenOffScreen, canCoverAnchor, children, closeReasons, defaultPlacement, elementRef, hideArrow, hitAreaRef, id, onRequestClose, open, outerRef, pointTo, repositionMode, retainFocus, takeFocus, toggleId, ...otherProps }: PopoverProps): React.JSX.Element;
|
|
154
160
|
declare namespace Popover {
|
|
155
161
|
var propTypes: {
|
|
156
162
|
align: PropTypes.Requireable<string>;
|
|
@@ -179,6 +185,7 @@ declare namespace Popover {
|
|
|
179
185
|
takeFocus: PropTypes.Requireable<boolean>;
|
|
180
186
|
splunkTheme: PropTypes.Requireable<object>;
|
|
181
187
|
};
|
|
188
|
+
var possibleCloseReasons: PopoverPossibleCloseReason[];
|
|
182
189
|
}
|
|
183
190
|
export default Popover;
|
|
184
191
|
export type { PopoverChildrenRenderer, PopoverPlacement, PopoverPlacementStatus, PopoverPossibleCloseReason, PopoverRequestCloseHandler, };
|
|
@@ -36,6 +36,7 @@ interface ResultsMenuPropsBase {
|
|
|
36
36
|
* children, so therefore it may be necessary to scroll to see the animation.
|
|
37
37
|
*/
|
|
38
38
|
isLoading?: boolean;
|
|
39
|
+
labelledBy?: string;
|
|
39
40
|
loadingMessage?: React.ReactNode;
|
|
40
41
|
menuId?: string;
|
|
41
42
|
noOptionsMessage?: React.ReactNode;
|
|
@@ -66,7 +67,7 @@ declare const propTypes: {
|
|
|
66
67
|
placement: PropTypes.Requireable<string>;
|
|
67
68
|
};
|
|
68
69
|
type ResultsMenuProps = ComponentProps<ResultsMenuPropsBase, 'div'>;
|
|
69
|
-
declare function ResultsMenu({ animateLoading, 'aria-multiselectable': ariaMultiselectable, children, childrenStart, elementRef, focusMode, footerMessage, isLoading, loadingMessage, menuId, noOptionsMessage, onScroll, onScrollBottom, placement, style, tabIndex, ...otherProps }: ResultsMenuProps): React.JSX.Element;
|
|
70
|
+
declare function ResultsMenu({ animateLoading, 'aria-multiselectable': ariaMultiselectable, children, childrenStart, elementRef, focusMode, footerMessage, isLoading, labelledBy, loadingMessage, menuId, noOptionsMessage, onScroll, onScrollBottom, placement, style, tabIndex, ...otherProps }: ResultsMenuProps): React.JSX.Element;
|
|
70
71
|
declare namespace ResultsMenu {
|
|
71
72
|
var propTypes: {
|
|
72
73
|
animateLoading: PropTypes.Requireable<boolean>;
|
|
@@ -75,6 +75,10 @@ interface HeadCellPropsBase {
|
|
|
75
75
|
* The `sortKey` is passed in the data object to the `onSort` callback, if provided.
|
|
76
76
|
*/
|
|
77
77
|
sortKey?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Content to show in a tooltip.
|
|
80
|
+
*/
|
|
81
|
+
tooltip?: React.ReactNode;
|
|
78
82
|
/**
|
|
79
83
|
* Truncate the text in the label. `truncate=false` is not compatible with `Table`'s
|
|
80
84
|
* `onRequestResize`.
|
|
@@ -94,7 +98,7 @@ interface HeadCellPropsBase {
|
|
|
94
98
|
variant?: 'toggleAll' | 'info' | 'actions';
|
|
95
99
|
}
|
|
96
100
|
type HeadCellProps = ComponentProps<HeadCellPropsBase, 'th'>;
|
|
97
|
-
declare function HeadCell({ align, appearClickable, children, columnId, elementRef, dragId, headCellScreenReaderText, id, index, onAutosizeColumn, onClick, onKeyDown, onRequestMoveColumn, onRequestResize, onSort, resizable, sortDir, sortKey, style, truncate: truncateProp, variant, visible, width, ...otherProps }: HeadCellProps): React.JSX.Element;
|
|
101
|
+
declare function HeadCell({ align, appearClickable, children, columnId, elementRef, dragId, headCellScreenReaderText, id, index, onAutosizeColumn, onClick, onKeyDown, onRequestMoveColumn, onRequestResize, onSort, resizable, sortDir, sortKey, style, tooltip, truncate: truncateProp, variant, visible, width, ...otherProps }: HeadCellProps): React.JSX.Element;
|
|
98
102
|
declare namespace HeadCell {
|
|
99
103
|
var propTypes: {
|
|
100
104
|
align: PropTypes.Requireable<string>;
|
|
@@ -124,6 +128,7 @@ declare namespace HeadCell {
|
|
|
124
128
|
resizable: PropTypes.Requireable<boolean>;
|
|
125
129
|
sortDir: PropTypes.Requireable<string>;
|
|
126
130
|
sortKey: PropTypes.Requireable<string>;
|
|
131
|
+
tooltip: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
127
132
|
truncate: PropTypes.Requireable<boolean>;
|
|
128
133
|
/** @private. */
|
|
129
134
|
variant: PropTypes.Requireable<string>;
|
|
@@ -10,6 +10,7 @@ interface HeadInnerPropsBase {
|
|
|
10
10
|
columnId?: string;
|
|
11
11
|
elementRef?: React.Ref<HTMLButtonElement | HTMLDivElement>;
|
|
12
12
|
focusWithin?: boolean;
|
|
13
|
+
hasTooltip?: boolean;
|
|
13
14
|
id?: string;
|
|
14
15
|
index?: number;
|
|
15
16
|
isMenu?: boolean;
|
|
@@ -23,7 +24,7 @@ interface HeadInnerPropsBase {
|
|
|
23
24
|
variant?: 'toggleAll' | 'info' | 'actions';
|
|
24
25
|
}
|
|
25
26
|
type HeadInnerProps = ComponentProps<HeadInnerPropsBase, 'div'>;
|
|
26
|
-
declare function HeadInner({ align, clickable, columnId, elementRef, focusWithin, id, index, isMenu, label, onAutosizeColumn, onRequestResize, resizable, sortDir, truncate, variant, width: widthProp, ...otherProps }: HeadInnerProps): React.JSX.Element;
|
|
27
|
+
declare function HeadInner({ align, clickable, columnId, elementRef, focusWithin, hasTooltip, id, index, isMenu, label, onAutosizeColumn, onRequestResize, resizable, sortDir, truncate, variant, width: widthProp, ...otherProps }: HeadInnerProps): React.JSX.Element;
|
|
27
28
|
declare namespace HeadInner {
|
|
28
29
|
var propTypes: {
|
|
29
30
|
align: PropTypes.Requireable<string>;
|
|
@@ -31,6 +32,7 @@ declare namespace HeadInner {
|
|
|
31
32
|
columnId: PropTypes.Requireable<string>;
|
|
32
33
|
elementRef: PropTypes.Requireable<object>;
|
|
33
34
|
focusWithin: PropTypes.Requireable<boolean>;
|
|
35
|
+
hasTooltip: PropTypes.Requireable<boolean>;
|
|
34
36
|
id: PropTypes.Requireable<string>;
|
|
35
37
|
index: PropTypes.Requireable<number>;
|
|
36
38
|
isMenu: PropTypes.Requireable<boolean>;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { PopoverPossibleCloseReason } from '@splunk/react-ui/Popover';
|
|
4
3
|
import { ComponentProps } from '../utils/types';
|
|
5
4
|
/** @public */
|
|
6
|
-
type
|
|
5
|
+
type TooltipPossibleOpenReason = 'focusToggle' | 'mouseEnterPopover' | 'mouseEnterToggle' | 'mouseEnterHitArea';
|
|
7
6
|
/** @public */
|
|
8
|
-
type
|
|
7
|
+
type TooltipPossibleCloseReason = 'blurToggle' | 'clickAway' | 'escapeKey' | 'mouseLeaveHitArea' | 'mouseLeavePopover' | 'mouseLeaveToggle' | 'mouseStopHitArea' | 'offScreen' | 'tabKey' | 'toggleClick';
|
|
9
8
|
/** @public */
|
|
10
9
|
type TooltipRequestCloseHandler = (event: React.FocusEvent<HTMLSpanElement> | React.MouseEvent | MouseEvent | null, data: {
|
|
11
|
-
reason:
|
|
10
|
+
reason: TooltipPossibleCloseReason;
|
|
12
11
|
}) => void;
|
|
13
12
|
/** @public */
|
|
14
13
|
type TooltipRequestOpenHandler = (event: React.FocusEvent<HTMLSpanElement> | MouseEvent, data: {
|
|
15
|
-
reason:
|
|
14
|
+
reason: TooltipPossibleOpenReason;
|
|
16
15
|
}) => void;
|
|
17
16
|
interface AnchorProps {
|
|
18
17
|
onFocus: React.FocusEventHandler<HTMLElement>;
|
|
@@ -117,7 +116,6 @@ interface TooltipPropsBase {
|
|
|
117
116
|
*/
|
|
118
117
|
renderAnchor?: (props: AnchorProps) => React.ReactNode;
|
|
119
118
|
}
|
|
120
|
-
declare const closeReasons: PopoverPossibleCloseReason[];
|
|
121
119
|
type TooltipProps = ComponentProps<TooltipPropsBase, 'span'>;
|
|
122
120
|
/**
|
|
123
121
|
* The Tooltip component wraps arbitrary content to be displayed when the target element is hovered
|
|
@@ -143,7 +141,9 @@ declare namespace Tooltip {
|
|
|
143
141
|
openDelay: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
144
142
|
renderAnchor: PropTypes.Requireable<(...args: any[]) => any>;
|
|
145
143
|
};
|
|
144
|
+
var possibleOpenReasons: TooltipPossibleOpenReason[];
|
|
145
|
+
var possibleCloseReasons: TooltipPossibleCloseReason[];
|
|
146
146
|
}
|
|
147
147
|
export default Tooltip;
|
|
148
148
|
export { TooltipRequestCloseHandler, TooltipRequestOpenHandler };
|
|
149
|
-
export type { TooltipPropsBase };
|
|
149
|
+
export type { AnchorProps, TooltipPropsBase, TooltipPossibleOpenReason, TooltipPossibleCloseReason, };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import 'core-js/es/promise';
|
|
2
|
+
type Movie = {
|
|
3
|
+
id: number;
|
|
4
|
+
title: string;
|
|
5
|
+
};
|
|
6
|
+
type MovieOption = Movie & {
|
|
7
|
+
matchRanges?: {
|
|
8
|
+
start: number;
|
|
9
|
+
end: number;
|
|
10
|
+
}[];
|
|
11
|
+
};
|
|
12
|
+
declare function isMovieOption(movie: Movie | MovieOption): movie is MovieOption;
|
|
13
|
+
interface FetchOptionsParams {
|
|
14
|
+
fetchTimeout?: number;
|
|
15
|
+
fetchMoreTimeout?: number;
|
|
16
|
+
numberOfResults?: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @param fetchTimeout: number - The number of milliseconds to defer fetching of options.
|
|
20
|
+
* @param fetchMoreTimeout: number - The number of milliseconds to defer fetching additional options.
|
|
21
|
+
* @param numberOfResults: number - Then number of options to retrieve per fetch.
|
|
22
|
+
*/
|
|
23
|
+
export default function useFetchOptions({ fetchTimeout, fetchMoreTimeout, numberOfResults, }?: FetchOptionsParams): {
|
|
24
|
+
fetch: (filter?: string, timeout?: number) => Promise<MovieOption[]>;
|
|
25
|
+
fetchMore: (opts?: MovieOption[]) => Promise<MovieOption[]>;
|
|
26
|
+
reset: () => void;
|
|
27
|
+
stop: () => void;
|
|
28
|
+
getOption: (value: number) => Movie | undefined;
|
|
29
|
+
getSelectedOptions: (values: number[]) => Movie[];
|
|
30
|
+
getCurrentCount: () => number;
|
|
31
|
+
getFullCount: () => number;
|
|
32
|
+
};
|
|
33
|
+
export { isMovieOption, Movie, MovieOption };
|