@splunk/react-ui 5.3.0 → 5.5.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/Accordion.js +31 -31
- package/Avatar.js +13 -13
- package/Badge.js +154 -0
- package/Breadcrumbs.js +66 -63
- package/ButtonSimple.js +52 -52
- package/CHANGELOG.md +43 -0
- package/CardLayout.js +39 -36
- package/Clickable.js +5 -6
- package/Code.js +917 -424
- package/CollapsiblePanel.js +1 -1
- package/Color.js +904 -1025
- package/ComboBox.js +6 -5
- package/DefinitionList.js +1 -1
- package/FormRows.js +13 -11
- package/JSONTree.js +682 -1408
- package/Link.js +74 -44
- package/MIGRATION.md +32 -1
- package/Markdown.js +9 -5
- package/Menu.js +100 -97
- package/Multiselect.js +1223 -2858
- package/Number.js +3 -3
- package/PhoneNumber.d.ts +2 -0
- package/PhoneNumber.js +769 -0
- package/Popover.js +235 -232
- package/RadioList.js +166 -151
- package/Resize.js +11 -8
- package/ResultsMenu.js +911 -1030
- package/ScreenReaderContent.js +86 -130
- package/Scroll.js +366 -425
- package/Select.js +267 -1947
- package/SelectBase.d.ts +2 -0
- package/SelectBase.js +1681 -0
- package/Slider.js +202 -199
- package/SlidingPanels.js +170 -175
- package/StepBar.js +123 -97
- package/Switch.js +137 -118
- package/TabBar.js +296 -295
- package/TabLayout.js +14 -14
- package/Table.js +1562 -1516
- package/TextArea.js +596 -684
- package/TransitionOpen.js +82 -74
- package/Tree.js +638 -682
- package/docker-compose.yml +99 -52
- package/package.json +16 -12
- package/stubs-splunkui.d.ts +0 -86
- package/test-runner-jest.config.js +1 -0
- package/types/src/Badge/Badge.d.ts +29 -0
- package/types/src/Badge/docs/examples/Basic.d.ts +5 -0
- package/types/src/Badge/docs/examples/Count.d.ts +6 -0
- package/types/src/Badge/docs/examples/CustomColors.d.ts +8 -0
- package/types/src/Badge/docs/examples/Icon.d.ts +6 -0
- package/types/src/Badge/index.d.ts +2 -0
- package/types/src/Breadcrumbs/Breadcrumbs.d.ts +1 -5
- package/types/src/Breadcrumbs/BreadcrumbsContext.d.ts +7 -0
- package/types/src/Breadcrumbs/Item.d.ts +1 -1
- package/types/src/ButtonSimple/mixin.d.ts +1 -1
- package/types/src/Code/Code.d.ts +4 -3
- package/types/src/Code/index.d.ts +1 -0
- package/types/src/JSONTree/JSONTreeItem.d.ts +1 -1
- package/types/src/JSONTree/renderTreeItems.d.ts +1 -1
- package/types/src/Link/Link.d.ts +4 -0
- package/types/src/Link/LinkContext.d.ts +14 -0
- package/types/src/Link/docs/examples/Visited.d.ts +7 -0
- package/types/src/Link/index.d.ts +1 -0
- package/types/src/Modal/ModalContext.d.ts +1 -1
- package/types/src/Multiselect/Compact.d.ts +3 -3
- package/types/src/Multiselect/Multiselect.d.ts +1 -1
- package/types/src/Multiselect/Normal.d.ts +2 -2
- package/types/src/Number/utils.d.ts +1 -1
- package/types/src/PhoneNumber/PhoneNumber.d.ts +139 -0
- package/types/src/PhoneNumber/docs/examples/Controlled.d.ts +7 -0
- package/types/src/PhoneNumber/docs/examples/DefaultCountry.d.ts +7 -0
- package/types/src/PhoneNumber/docs/examples/Disabled.d.ts +6 -0
- package/types/src/PhoneNumber/docs/examples/Error.d.ts +6 -0
- package/types/src/PhoneNumber/docs/examples/Inline.d.ts +7 -0
- package/types/src/PhoneNumber/docs/examples/Uncontrolled.d.ts +7 -0
- package/types/src/PhoneNumber/index.d.ts +2 -0
- package/types/src/PhoneNumber/utils.d.ts +47 -0
- package/types/src/Popover/getPlacement.d.ts +1 -1
- package/types/src/RadioList/Option.d.ts +7 -2
- package/types/src/RadioList/RadioListContext.d.ts +1 -1
- package/types/src/RadioList/docs/examples/Description.d.ts +6 -0
- package/types/src/Select/Option.d.ts +8 -3
- package/types/src/Select/Select.d.ts +1 -1
- package/types/src/{Select → SelectBase}/OptionBase.d.ts +8 -2
- package/types/src/{Select → SelectBase}/SelectBase.d.ts +3 -1
- package/types/src/SelectBase/index.d.ts +2 -0
- package/types/src/StepBar/StepBar.d.ts +4 -1
- package/types/src/StepBar/StepBarContext.d.ts +1 -0
- package/types/src/StepBar/docs/examples/Vertical.d.ts +6 -0
- package/types/src/Switch/Switch.d.ts +10 -1
- package/types/src/TabBar/Tab.d.ts +3 -1
- package/types/src/TabBar/docs/examples/Icons.d.ts +4 -0
- package/types/src/TabBar/docs/examples/Tooltips.d.ts +3 -0
- package/types/src/TabLayout/Panel.d.ts +2 -0
- package/types/src/Table/Body.d.ts +6 -1
- package/types/src/Table/Cell.d.ts +5 -1
- package/types/src/Table/Head.d.ts +6 -2
- package/types/src/Table/HeadCell.d.ts +5 -1
- package/types/src/Table/Row.d.ts +5 -1
- package/types/src/Table/Table.d.ts +21 -1
- package/types/src/Table/TableContext.d.ts +1 -0
- package/types/src/Table/docs/examples/HorizontalOverflowScroll.d.ts +8 -0
- package/types/src/Table/docs/examples/PinActionColumn.d.ts +7 -0
- package/types/src/TransitionOpen/TransitionOpen.d.ts +3 -1
- package/types/src/Tree/TreeContext.d.ts +1 -1
- package/types/src/useResizeObserver/useResizeObserver.d.ts +2 -0
- package/types/src/useRovingFocus/useRovingFocus.d.ts +8 -1
- package/useControlled.js +61 -97
- package/usePrevious.d.ts +2 -0
- package/usePrevious.js +30 -62
- package/useResizeObserver.js +71 -136
- package/useRovingFocus.js +96 -41
- /package/types/src/{Select → SelectBase}/SelectAllOption.d.ts +0 -0
package/types/src/Table/Row.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { TableRequestMoveRowHandler } from '
|
|
3
|
+
import { PinnedColumnsProp, TableRequestMoveRowHandler } from '@splunk/react-ui/Table';
|
|
4
4
|
import { ComponentProps } from '../utils/types';
|
|
5
5
|
/** @public */
|
|
6
6
|
type RowActionPrimaryClickHandler = (event: React.MouseEvent, data?: any) => void;
|
|
@@ -77,6 +77,8 @@ interface RowPropsBase {
|
|
|
77
77
|
* An event handler for toggle of the row. resize of columns. The function is passed the event and the `data` prop for this row.
|
|
78
78
|
*/
|
|
79
79
|
onRequestToggle?: RowRequestToggleHandler;
|
|
80
|
+
/** @private. */
|
|
81
|
+
pinnedColumns?: PinnedColumnsProp;
|
|
80
82
|
/**
|
|
81
83
|
* @private. Generally passed by Table rather than added directly. Indicates the column to use as the primary label for each row.
|
|
82
84
|
*/
|
|
@@ -128,6 +130,8 @@ declare namespace Row {
|
|
|
128
130
|
/** @private. Generally passed by `Table` rather than added directly. */
|
|
129
131
|
onRequestMoveRow: PropTypes.Requireable<(...args: any[]) => any>;
|
|
130
132
|
onRequestToggle: PropTypes.Requireable<(...args: any[]) => any>;
|
|
133
|
+
/** @private. */
|
|
134
|
+
pinnedColumns: PropTypes.Requireable<object>;
|
|
131
135
|
/** @private. Generally passed by `Table` rather than added directly. */
|
|
132
136
|
primaryColumnIndex: PropTypes.Requireable<number>;
|
|
133
137
|
rowScreenReaderText: PropTypes.Requireable<string>;
|
|
@@ -25,6 +25,10 @@ type TableRequestResizeColumnHandler = (event: React.MouseEvent<HTMLHRElement> |
|
|
|
25
25
|
index: number;
|
|
26
26
|
width: number;
|
|
27
27
|
}) => void;
|
|
28
|
+
/** @public */
|
|
29
|
+
type PinnedColumnsProp = {
|
|
30
|
+
actions?: boolean;
|
|
31
|
+
};
|
|
28
32
|
interface TablePropsBase {
|
|
29
33
|
/**
|
|
30
34
|
* Adds table-level actions. Not compatible with `onRequestResize`.
|
|
@@ -63,6 +67,14 @@ interface TablePropsBase {
|
|
|
63
67
|
* the table.
|
|
64
68
|
*/
|
|
65
69
|
headType?: 'docked' | 'fixed' | 'inline';
|
|
70
|
+
/**
|
|
71
|
+
* Controls how the Table handles horizontal content overflow:
|
|
72
|
+
*
|
|
73
|
+
* * `auto`: The default behavior for overflow. `HeadCell` content will truncate and `Cell` content will wrap.
|
|
74
|
+
* The Table will scroll horizontally when the container's width exceeds the Table's width.
|
|
75
|
+
* * `scroll`: The Table will scroll horizontally. `HeadCell` content will not truncate and `Cell` content will wrap only for word breaks.
|
|
76
|
+
*/
|
|
77
|
+
horizontalOverflow?: 'auto' | 'scroll';
|
|
66
78
|
/**
|
|
67
79
|
* Style specification for the inner container, which is the scrolling container.
|
|
68
80
|
*/
|
|
@@ -79,6 +91,11 @@ interface TablePropsBase {
|
|
|
79
91
|
* Style specification for the outer container.
|
|
80
92
|
*/
|
|
81
93
|
outerStyle?: React.CSSProperties;
|
|
94
|
+
/**
|
|
95
|
+
* Optionally pin the actions column to the end of the table by passing `pinnedColumns={{ actions: true }}.`
|
|
96
|
+
* When using pinned columns `horizontalOverflow` should be set to `scroll`.
|
|
97
|
+
*/
|
|
98
|
+
pinnedColumns?: PinnedColumnsProp;
|
|
82
99
|
/**
|
|
83
100
|
* Adds a column to the table with an expansion button for each row that has expansion
|
|
84
101
|
* content. Supported values:
|
|
@@ -119,6 +136,7 @@ interface TablePropsBase {
|
|
|
119
136
|
/**
|
|
120
137
|
* An event handler for resize of columns for the current column being resized. The function is passed an event and a data
|
|
121
138
|
* object with `columnId`, `id`, `index`, and `width`.
|
|
139
|
+
* Every Table.HeadCell must have a width prop when using onRequestResizeColumn. Table with resizableFillLayout supports width of "auto".
|
|
122
140
|
*/
|
|
123
141
|
onRequestResizeColumn?: TableRequestResizeColumnHandler;
|
|
124
142
|
/**
|
|
@@ -137,10 +155,12 @@ declare namespace Table {
|
|
|
137
155
|
dockScrollBar: PropTypes.Requireable<boolean>;
|
|
138
156
|
elementRef: PropTypes.Requireable<object>;
|
|
139
157
|
headType: PropTypes.Requireable<string>;
|
|
158
|
+
horizontalOverflow: PropTypes.Requireable<string>;
|
|
140
159
|
innerStyle: PropTypes.Requireable<object>;
|
|
141
160
|
onRequestToggleAllRows: PropTypes.Requireable<(...args: any[]) => any>;
|
|
142
161
|
onScroll: PropTypes.Requireable<(...args: any[]) => any>;
|
|
143
162
|
outerStyle: PropTypes.Requireable<object>;
|
|
163
|
+
pinnedColumns: PropTypes.Requireable<object>;
|
|
144
164
|
primaryColumnIndex: PropTypes.Requireable<number>;
|
|
145
165
|
rowExpansion: PropTypes.Requireable<string>;
|
|
146
166
|
rowSelection: PropTypes.Requireable<string>;
|
|
@@ -161,4 +181,4 @@ declare namespace Table {
|
|
|
161
181
|
}
|
|
162
182
|
export default Table;
|
|
163
183
|
export { Body, Caption, Cell, Head, HeadCell, HeadDropdownCell, Row };
|
|
164
|
-
export type { CellClickHandler, HeadCellSortHandler, HeadDropdownCellPossibleCloseReason, HeadDropdownCellRequestCloseHandler, HeadDropdownCellRequestOpenHandler, RowActionPrimaryClickHandler, RowActionSecondaryClickHandler, RowClickHandler, RowRequestToggleHandler, TableRequestMoveColumnHandler, TableRequestMoveRowHandler, TableRequestResizeColumnHandler, };
|
|
184
|
+
export type { CellClickHandler, HeadCellSortHandler, HeadDropdownCellPossibleCloseReason, HeadDropdownCellRequestCloseHandler, HeadDropdownCellRequestOpenHandler, RowActionPrimaryClickHandler, RowActionSecondaryClickHandler, RowClickHandler, RowRequestToggleHandler, TableRequestMoveColumnHandler, TableRequestMoveRowHandler, TableRequestResizeColumnHandler, PinnedColumnsProp, };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @name Horizontal overflow scroll
|
|
4
|
+
* @description Table handles overflow by horizontally scrolling.
|
|
5
|
+
* Set `horizontalOverflow="scroll"` for `HeadCell` content to not truncate or `Cell` content to wrap for word breaks.
|
|
6
|
+
*/
|
|
7
|
+
declare function HorizontalOverflowScroll(): React.JSX.Element;
|
|
8
|
+
export default HorizontalOverflowScroll;
|
|
@@ -17,6 +17,7 @@ interface TransitionOpenPropsBase {
|
|
|
17
17
|
innerClassName?: string;
|
|
18
18
|
innerStyle?: React.CSSProperties;
|
|
19
19
|
onAnimationEnd?: () => void;
|
|
20
|
+
onAnimationStart?: () => void;
|
|
20
21
|
/** Whether the component is currently open or not. */
|
|
21
22
|
open?: boolean;
|
|
22
23
|
/** An additional className to outer container. */
|
|
@@ -38,7 +39,7 @@ interface TransitionOpenPropsBase {
|
|
|
38
39
|
takeFocus?: boolean;
|
|
39
40
|
}
|
|
40
41
|
type TransitionOpenProps = ComponentProps<TransitionOpenPropsBase, 'div'>;
|
|
41
|
-
declare function TransitionOpen({ animation, animateOnMount, children, className, elementRef, id, innerClassName, innerStyle, onAnimationEnd, open, outerClassName, outerId, outerStyle, renderChildrenWhenCollapsed, retainFocus, takeFocus: takeFocusProp, ...otherProps }: TransitionOpenProps): React.JSX.Element;
|
|
42
|
+
declare function TransitionOpen({ animation, animateOnMount, children, className, elementRef, id, innerClassName, innerStyle, onAnimationEnd, onAnimationStart, open, outerClassName, outerId, outerStyle, renderChildrenWhenCollapsed, retainFocus, takeFocus: takeFocusProp, ...otherProps }: TransitionOpenProps): React.JSX.Element;
|
|
42
43
|
declare namespace TransitionOpen {
|
|
43
44
|
var propTypes: {
|
|
44
45
|
animation: PropTypes.Requireable<string>;
|
|
@@ -50,6 +51,7 @@ declare namespace TransitionOpen {
|
|
|
50
51
|
innerClassName: PropTypes.Requireable<string>;
|
|
51
52
|
innerStyle: PropTypes.Requireable<object>;
|
|
52
53
|
onAnimationEnd: PropTypes.Requireable<(...args: any[]) => any>;
|
|
54
|
+
onAnimationStart: PropTypes.Requireable<(...args: any[]) => any>;
|
|
53
55
|
open: PropTypes.Requireable<boolean>;
|
|
54
56
|
outerClassName: PropTypes.Requireable<string>;
|
|
55
57
|
outerId: PropTypes.Requireable<string>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { RemoveNodeHandler, SetNodeHandler } from '@splunk/react-ui/Tree';
|
|
1
2
|
import { TreeItemClickHandler, TreeItemKeyDownHandler } from './Item';
|
|
2
|
-
import { RemoveNodeHandler, SetNodeHandler } from './Tree';
|
|
3
3
|
export interface TreeContext {
|
|
4
4
|
defaultIndent?: boolean;
|
|
5
5
|
onItemKeyDown?: TreeItemKeyDownHandler;
|
|
@@ -6,8 +6,10 @@ type Dimensions = {
|
|
|
6
6
|
type ResizeHandler = (data: Dimensions) => void;
|
|
7
7
|
/**
|
|
8
8
|
* Watches a React ref element for changes in size.
|
|
9
|
+
* Uses useSyncExternalStore for better React 18 concurrent rendering support.
|
|
9
10
|
*
|
|
10
11
|
* @param ref - The React ref to observe size changes on
|
|
12
|
+
* @param onResize - Callback function that receives the new dimensions
|
|
11
13
|
*/
|
|
12
14
|
declare const useResizeObserver: (ref: React.MutableRefObject<HTMLElement | null>, onResize?: ResizeHandler) => Dimensions;
|
|
13
15
|
export default useResizeObserver;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
type RovingFocusOptions = {
|
|
2
|
+
enableLoop?: boolean;
|
|
3
|
+
orientation?: 'horizontal' | 'vertical';
|
|
4
|
+
enableTab?: boolean;
|
|
5
|
+
enableHomeEnd?: boolean;
|
|
6
|
+
};
|
|
1
7
|
/**
|
|
2
8
|
* This is a private hook not intended for use outside @splunk/react-ui
|
|
3
9
|
*
|
|
@@ -18,10 +24,11 @@
|
|
|
18
24
|
* </div>
|
|
19
25
|
* ```
|
|
20
26
|
*/
|
|
21
|
-
declare function useRovingFocus(): {
|
|
27
|
+
declare function useRovingFocus(options?: {}): {
|
|
22
28
|
ref: (element: HTMLDivElement | null) => void;
|
|
23
29
|
onBlur: (e: React.FocusEvent) => void;
|
|
24
30
|
onFocus: (e: React.FocusEvent) => void;
|
|
25
31
|
onKeyDown: (e: React.KeyboardEvent<HTMLDivElement>) => void;
|
|
26
32
|
};
|
|
27
33
|
export default useRovingFocus;
|
|
34
|
+
export type { RovingFocusOptions };
|
package/useControlled.js
CHANGED
|
@@ -1,67 +1,34 @@
|
|
|
1
1
|
/******/ (() => {
|
|
2
2
|
// webpackBootstrap
|
|
3
3
|
/******/ "use strict";
|
|
4
|
-
/******/
|
|
5
|
-
|
|
6
|
-
/***/ e => {
|
|
7
|
-
e.exports = require("lodash/has");
|
|
8
|
-
/***/ },
|
|
9
|
-
/***/ 9497:
|
|
10
|
-
/***/ e => {
|
|
11
|
-
e.exports = require("react");
|
|
12
|
-
/***/
|
|
13
|
-
/******/ }
|
|
14
|
-
};
|
|
15
|
-
/************************************************************************/
|
|
16
|
-
/******/ // The module cache
|
|
17
|
-
/******/ var r = {};
|
|
18
|
-
/******/
|
|
19
|
-
/******/ // The require function
|
|
20
|
-
/******/ function t(o) {
|
|
21
|
-
/******/ // Check if module is in cache
|
|
22
|
-
/******/ var n = r[o];
|
|
23
|
-
/******/ if (n !== undefined) {
|
|
24
|
-
/******/ return n.exports;
|
|
25
|
-
/******/ }
|
|
26
|
-
/******/ // Create a new module (and put it into the cache)
|
|
27
|
-
/******/ var u = r[o] = {
|
|
28
|
-
/******/ // no module.id needed
|
|
29
|
-
/******/ // no module.loaded needed
|
|
30
|
-
/******/ exports: {}
|
|
31
|
-
/******/ };
|
|
32
|
-
/******/
|
|
33
|
-
/******/ // Execute the module function
|
|
34
|
-
/******/ e[o](u, u.exports, t);
|
|
35
|
-
/******/
|
|
36
|
-
/******/ // Return the exports of the module
|
|
37
|
-
/******/ return u.exports;
|
|
38
|
-
/******/ }
|
|
4
|
+
/******/ // The require scope
|
|
5
|
+
/******/ var e = {};
|
|
39
6
|
/******/
|
|
40
7
|
/************************************************************************/
|
|
41
8
|
/******/ /* webpack/runtime/compat get default export */
|
|
42
9
|
/******/ (() => {
|
|
43
10
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
44
|
-
/******/
|
|
45
|
-
/******/ var
|
|
46
|
-
/******/ () =>
|
|
47
|
-
/******/ : () =>
|
|
11
|
+
/******/ e.n = r => {
|
|
12
|
+
/******/ var t = r && r.__esModule ?
|
|
13
|
+
/******/ () => r["default"]
|
|
14
|
+
/******/ : () => r
|
|
48
15
|
/******/;
|
|
49
|
-
|
|
50
|
-
a:
|
|
16
|
+
e.d(t, {
|
|
17
|
+
a: t
|
|
51
18
|
});
|
|
52
|
-
/******/ return
|
|
19
|
+
/******/ return t;
|
|
53
20
|
/******/ };
|
|
54
21
|
/******/ })();
|
|
55
22
|
/******/
|
|
56
23
|
/******/ /* webpack/runtime/define property getters */
|
|
57
24
|
/******/ (() => {
|
|
58
25
|
/******/ // define getter functions for harmony exports
|
|
59
|
-
/******/
|
|
60
|
-
/******/ for (var o in
|
|
61
|
-
/******/ if (
|
|
62
|
-
/******/ Object.defineProperty(
|
|
26
|
+
/******/ e.d = (r, t) => {
|
|
27
|
+
/******/ for (var o in t) {
|
|
28
|
+
/******/ if (e.o(t, o) && !e.o(r, o)) {
|
|
29
|
+
/******/ Object.defineProperty(r, o, {
|
|
63
30
|
enumerable: true,
|
|
64
|
-
get:
|
|
31
|
+
get: t[o]
|
|
65
32
|
});
|
|
66
33
|
/******/ }
|
|
67
34
|
/******/ }
|
|
@@ -70,14 +37,14 @@
|
|
|
70
37
|
/******/
|
|
71
38
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
72
39
|
/******/ (() => {
|
|
73
|
-
/******/
|
|
40
|
+
/******/ e.o = (e, r) => Object.prototype.hasOwnProperty.call(e, r)
|
|
74
41
|
/******/;
|
|
75
42
|
})();
|
|
76
43
|
/******/
|
|
77
44
|
/******/ /* webpack/runtime/make namespace object */
|
|
78
45
|
/******/ (() => {
|
|
79
46
|
/******/ // define __esModule on exports
|
|
80
|
-
/******/
|
|
47
|
+
/******/ e.r = e => {
|
|
81
48
|
/******/ if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
|
|
82
49
|
/******/ Object.defineProperty(e, Symbol.toStringTag, {
|
|
83
50
|
value: "Module"
|
|
@@ -89,38 +56,36 @@
|
|
|
89
56
|
/******/ };
|
|
90
57
|
/******/ })();
|
|
91
58
|
/******/
|
|
92
|
-
/************************************************************************/ var
|
|
93
|
-
//
|
|
94
|
-
(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
59
|
+
/************************************************************************/ var r = {};
|
|
60
|
+
// ESM COMPAT FLAG
|
|
61
|
+
e.r(r);
|
|
62
|
+
// EXPORTS
|
|
63
|
+
e.d(r, {
|
|
64
|
+
default: () => /* reexport */ l,
|
|
65
|
+
isAllowedType: () => /* reexport */ f,
|
|
66
|
+
isPrimitive: () => /* reexport */ a
|
|
67
|
+
});
|
|
68
|
+
// CONCATENATED MODULE: external "react"
|
|
69
|
+
const t = require("react");
|
|
70
|
+
// CONCATENATED MODULE: external "lodash/isEqual"
|
|
71
|
+
const o = require("lodash/isEqual");
|
|
72
|
+
// CONCATENATED MODULE: external "lodash/has"
|
|
73
|
+
const n = require("lodash/has");
|
|
74
|
+
var u = e.n(n);
|
|
75
|
+
// CONCATENATED MODULE: ./src/useControlled/useControlled.tsx
|
|
76
|
+
function a(e) {
|
|
77
|
+
return e === null || e === undefined || typeof e === "boolean" || typeof e === "string" || typeof e === "number";
|
|
78
|
+
}
|
|
79
|
+
function f(e) {
|
|
80
|
+
if (a(e)) {
|
|
81
|
+
return true;
|
|
113
82
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
return true;
|
|
117
|
-
}
|
|
118
|
-
if (Array.isArray(e)) {
|
|
119
|
-
return e.every(a);
|
|
120
|
-
}
|
|
121
|
-
return false;
|
|
83
|
+
if (Array.isArray(e)) {
|
|
84
|
+
return e.every(a);
|
|
122
85
|
}
|
|
123
|
-
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
124
89
|
* This is a private component not intended for use outside @splunk/react-ui
|
|
125
90
|
*
|
|
126
91
|
* A hook that accepts a default value (as used in an uncontrolled component)
|
|
@@ -129,22 +94,21 @@
|
|
|
129
94
|
* are not happening.
|
|
130
95
|
*
|
|
131
96
|
* Return the controlled state of the component.
|
|
132
|
-
*/
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
module.exports = o;
|
|
97
|
+
*/ function i(e) {
|
|
98
|
+
var r = e.componentProps, o = e.componentName, n = o === void 0 ? "this component" : o, a = e.defaultValuePropName, f = a === void 0 ? "defaultValue" : a, i = e.valuePropName, l = i === void 0 ? "value" : i;
|
|
99
|
+
var s = (0, t.useRef)(u()(r, l));
|
|
100
|
+
var d = (0, t.useRef)(r[f]);
|
|
101
|
+
(0, t.useEffect)((function() {
|
|
102
|
+
if (false) {}
|
|
103
|
+
}), [ n, r, f, l ]);
|
|
104
|
+
(0, t.useEffect)((function() {
|
|
105
|
+
if (false) {}
|
|
106
|
+
if (false) {}
|
|
107
|
+
if (false) {}
|
|
108
|
+
}), [ n, r, f, l ]);
|
|
109
|
+
return s.current;
|
|
110
|
+
}
|
|
111
|
+
/* harmony default export */ const l = i;
|
|
112
|
+
// CONCATENATED MODULE: ./src/useControlled/index.ts
|
|
113
|
+
module.exports = r;
|
|
150
114
|
/******/})();
|
package/usePrevious.d.ts
ADDED
package/usePrevious.js
CHANGED
|
@@ -1,48 +1,19 @@
|
|
|
1
1
|
/******/ (() => {
|
|
2
2
|
// webpackBootstrap
|
|
3
3
|
/******/ "use strict";
|
|
4
|
-
/******/
|
|
5
|
-
|
|
6
|
-
/***/ e => {
|
|
7
|
-
e.exports = require("react");
|
|
8
|
-
/***/
|
|
9
|
-
/******/ }
|
|
10
|
-
};
|
|
11
|
-
/************************************************************************/
|
|
12
|
-
/******/ // The module cache
|
|
13
|
-
/******/ var r = {};
|
|
14
|
-
/******/
|
|
15
|
-
/******/ // The require function
|
|
16
|
-
/******/ function t(o) {
|
|
17
|
-
/******/ // Check if module is in cache
|
|
18
|
-
/******/ var n = r[o];
|
|
19
|
-
/******/ if (n !== undefined) {
|
|
20
|
-
/******/ return n.exports;
|
|
21
|
-
/******/ }
|
|
22
|
-
/******/ // Create a new module (and put it into the cache)
|
|
23
|
-
/******/ var u = r[o] = {
|
|
24
|
-
/******/ // no module.id needed
|
|
25
|
-
/******/ // no module.loaded needed
|
|
26
|
-
/******/ exports: {}
|
|
27
|
-
/******/ };
|
|
28
|
-
/******/
|
|
29
|
-
/******/ // Execute the module function
|
|
30
|
-
/******/ e[o](u, u.exports, t);
|
|
31
|
-
/******/
|
|
32
|
-
/******/ // Return the exports of the module
|
|
33
|
-
/******/ return u.exports;
|
|
34
|
-
/******/ }
|
|
4
|
+
/******/ // The require scope
|
|
5
|
+
/******/ var e = {};
|
|
35
6
|
/******/
|
|
36
7
|
/************************************************************************/
|
|
37
8
|
/******/ /* webpack/runtime/define property getters */
|
|
38
9
|
/******/ (() => {
|
|
39
10
|
/******/ // define getter functions for harmony exports
|
|
40
|
-
/******/
|
|
41
|
-
/******/ for (var o in
|
|
42
|
-
/******/ if (
|
|
43
|
-
/******/ Object.defineProperty(
|
|
11
|
+
/******/ e.d = (r, t) => {
|
|
12
|
+
/******/ for (var o in t) {
|
|
13
|
+
/******/ if (e.o(t, o) && !e.o(r, o)) {
|
|
14
|
+
/******/ Object.defineProperty(r, o, {
|
|
44
15
|
enumerable: true,
|
|
45
|
-
get:
|
|
16
|
+
get: t[o]
|
|
46
17
|
});
|
|
47
18
|
/******/ }
|
|
48
19
|
/******/ }
|
|
@@ -51,14 +22,14 @@
|
|
|
51
22
|
/******/
|
|
52
23
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
53
24
|
/******/ (() => {
|
|
54
|
-
/******/
|
|
25
|
+
/******/ e.o = (e, r) => Object.prototype.hasOwnProperty.call(e, r)
|
|
55
26
|
/******/;
|
|
56
27
|
})();
|
|
57
28
|
/******/
|
|
58
29
|
/******/ /* webpack/runtime/make namespace object */
|
|
59
30
|
/******/ (() => {
|
|
60
31
|
/******/ // define __esModule on exports
|
|
61
|
-
/******/
|
|
32
|
+
/******/ e.r = e => {
|
|
62
33
|
/******/ if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
|
|
63
34
|
/******/ Object.defineProperty(e, Symbol.toStringTag, {
|
|
64
35
|
value: "Module"
|
|
@@ -70,19 +41,17 @@
|
|
|
70
41
|
/******/ };
|
|
71
42
|
/******/ })();
|
|
72
43
|
/******/
|
|
73
|
-
/************************************************************************/ var
|
|
74
|
-
//
|
|
75
|
-
(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
// CONCATENATED MODULE: ./src/usePrevious/usePrevious.tsx
|
|
85
|
-
/**
|
|
44
|
+
/************************************************************************/ var r = {};
|
|
45
|
+
// ESM COMPAT FLAG
|
|
46
|
+
e.r(r);
|
|
47
|
+
// EXPORTS
|
|
48
|
+
e.d(r, {
|
|
49
|
+
default: () => /* reexport */ n
|
|
50
|
+
});
|
|
51
|
+
// CONCATENATED MODULE: external "react"
|
|
52
|
+
const t = require("react");
|
|
53
|
+
// CONCATENATED MODULE: ./src/usePrevious/usePrevious.tsx
|
|
54
|
+
/**
|
|
86
55
|
* This is a private component not intended for use outside @splunk/react-ui
|
|
87
56
|
*
|
|
88
57
|
* Keeps the previous version of a value. Useful for emulating the "prevState"
|
|
@@ -91,15 +60,14 @@
|
|
|
91
60
|
*
|
|
92
61
|
* @param value - The value to store
|
|
93
62
|
*/
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
module.exports = o;
|
|
63
|
+
function o(e) {
|
|
64
|
+
var r = (0, t.useRef)();
|
|
65
|
+
(0, t.useEffect)((function() {
|
|
66
|
+
r.current = e;
|
|
67
|
+
}), [ e ]);
|
|
68
|
+
return r.current;
|
|
69
|
+
}
|
|
70
|
+
/* harmony default export */ const n = o;
|
|
71
|
+
// CONCATENATED MODULE: ./src/usePrevious/index.ts
|
|
72
|
+
module.exports = r;
|
|
105
73
|
/******/})();
|