@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.
Files changed (114) hide show
  1. package/Accordion.js +31 -31
  2. package/Avatar.js +13 -13
  3. package/Badge.js +154 -0
  4. package/Breadcrumbs.js +66 -63
  5. package/ButtonSimple.js +52 -52
  6. package/CHANGELOG.md +43 -0
  7. package/CardLayout.js +39 -36
  8. package/Clickable.js +5 -6
  9. package/Code.js +917 -424
  10. package/CollapsiblePanel.js +1 -1
  11. package/Color.js +904 -1025
  12. package/ComboBox.js +6 -5
  13. package/DefinitionList.js +1 -1
  14. package/FormRows.js +13 -11
  15. package/JSONTree.js +682 -1408
  16. package/Link.js +74 -44
  17. package/MIGRATION.md +32 -1
  18. package/Markdown.js +9 -5
  19. package/Menu.js +100 -97
  20. package/Multiselect.js +1223 -2858
  21. package/Number.js +3 -3
  22. package/PhoneNumber.d.ts +2 -0
  23. package/PhoneNumber.js +769 -0
  24. package/Popover.js +235 -232
  25. package/RadioList.js +166 -151
  26. package/Resize.js +11 -8
  27. package/ResultsMenu.js +911 -1030
  28. package/ScreenReaderContent.js +86 -130
  29. package/Scroll.js +366 -425
  30. package/Select.js +267 -1947
  31. package/SelectBase.d.ts +2 -0
  32. package/SelectBase.js +1681 -0
  33. package/Slider.js +202 -199
  34. package/SlidingPanels.js +170 -175
  35. package/StepBar.js +123 -97
  36. package/Switch.js +137 -118
  37. package/TabBar.js +296 -295
  38. package/TabLayout.js +14 -14
  39. package/Table.js +1562 -1516
  40. package/TextArea.js +596 -684
  41. package/TransitionOpen.js +82 -74
  42. package/Tree.js +638 -682
  43. package/docker-compose.yml +99 -52
  44. package/package.json +16 -12
  45. package/stubs-splunkui.d.ts +0 -86
  46. package/test-runner-jest.config.js +1 -0
  47. package/types/src/Badge/Badge.d.ts +29 -0
  48. package/types/src/Badge/docs/examples/Basic.d.ts +5 -0
  49. package/types/src/Badge/docs/examples/Count.d.ts +6 -0
  50. package/types/src/Badge/docs/examples/CustomColors.d.ts +8 -0
  51. package/types/src/Badge/docs/examples/Icon.d.ts +6 -0
  52. package/types/src/Badge/index.d.ts +2 -0
  53. package/types/src/Breadcrumbs/Breadcrumbs.d.ts +1 -5
  54. package/types/src/Breadcrumbs/BreadcrumbsContext.d.ts +7 -0
  55. package/types/src/Breadcrumbs/Item.d.ts +1 -1
  56. package/types/src/ButtonSimple/mixin.d.ts +1 -1
  57. package/types/src/Code/Code.d.ts +4 -3
  58. package/types/src/Code/index.d.ts +1 -0
  59. package/types/src/JSONTree/JSONTreeItem.d.ts +1 -1
  60. package/types/src/JSONTree/renderTreeItems.d.ts +1 -1
  61. package/types/src/Link/Link.d.ts +4 -0
  62. package/types/src/Link/LinkContext.d.ts +14 -0
  63. package/types/src/Link/docs/examples/Visited.d.ts +7 -0
  64. package/types/src/Link/index.d.ts +1 -0
  65. package/types/src/Modal/ModalContext.d.ts +1 -1
  66. package/types/src/Multiselect/Compact.d.ts +3 -3
  67. package/types/src/Multiselect/Multiselect.d.ts +1 -1
  68. package/types/src/Multiselect/Normal.d.ts +2 -2
  69. package/types/src/Number/utils.d.ts +1 -1
  70. package/types/src/PhoneNumber/PhoneNumber.d.ts +139 -0
  71. package/types/src/PhoneNumber/docs/examples/Controlled.d.ts +7 -0
  72. package/types/src/PhoneNumber/docs/examples/DefaultCountry.d.ts +7 -0
  73. package/types/src/PhoneNumber/docs/examples/Disabled.d.ts +6 -0
  74. package/types/src/PhoneNumber/docs/examples/Error.d.ts +6 -0
  75. package/types/src/PhoneNumber/docs/examples/Inline.d.ts +7 -0
  76. package/types/src/PhoneNumber/docs/examples/Uncontrolled.d.ts +7 -0
  77. package/types/src/PhoneNumber/index.d.ts +2 -0
  78. package/types/src/PhoneNumber/utils.d.ts +47 -0
  79. package/types/src/Popover/getPlacement.d.ts +1 -1
  80. package/types/src/RadioList/Option.d.ts +7 -2
  81. package/types/src/RadioList/RadioListContext.d.ts +1 -1
  82. package/types/src/RadioList/docs/examples/Description.d.ts +6 -0
  83. package/types/src/Select/Option.d.ts +8 -3
  84. package/types/src/Select/Select.d.ts +1 -1
  85. package/types/src/{Select → SelectBase}/OptionBase.d.ts +8 -2
  86. package/types/src/{Select → SelectBase}/SelectBase.d.ts +3 -1
  87. package/types/src/SelectBase/index.d.ts +2 -0
  88. package/types/src/StepBar/StepBar.d.ts +4 -1
  89. package/types/src/StepBar/StepBarContext.d.ts +1 -0
  90. package/types/src/StepBar/docs/examples/Vertical.d.ts +6 -0
  91. package/types/src/Switch/Switch.d.ts +10 -1
  92. package/types/src/TabBar/Tab.d.ts +3 -1
  93. package/types/src/TabBar/docs/examples/Icons.d.ts +4 -0
  94. package/types/src/TabBar/docs/examples/Tooltips.d.ts +3 -0
  95. package/types/src/TabLayout/Panel.d.ts +2 -0
  96. package/types/src/Table/Body.d.ts +6 -1
  97. package/types/src/Table/Cell.d.ts +5 -1
  98. package/types/src/Table/Head.d.ts +6 -2
  99. package/types/src/Table/HeadCell.d.ts +5 -1
  100. package/types/src/Table/Row.d.ts +5 -1
  101. package/types/src/Table/Table.d.ts +21 -1
  102. package/types/src/Table/TableContext.d.ts +1 -0
  103. package/types/src/Table/docs/examples/HorizontalOverflowScroll.d.ts +8 -0
  104. package/types/src/Table/docs/examples/PinActionColumn.d.ts +7 -0
  105. package/types/src/TransitionOpen/TransitionOpen.d.ts +3 -1
  106. package/types/src/Tree/TreeContext.d.ts +1 -1
  107. package/types/src/useResizeObserver/useResizeObserver.d.ts +2 -0
  108. package/types/src/useRovingFocus/useRovingFocus.d.ts +8 -1
  109. package/useControlled.js +61 -97
  110. package/usePrevious.d.ts +2 -0
  111. package/usePrevious.js +30 -62
  112. package/useResizeObserver.js +71 -136
  113. package/useRovingFocus.js +96 -41
  114. /package/types/src/{Select → SelectBase}/SelectAllOption.d.ts +0 -0
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { TableRequestMoveRowHandler } from './Table';
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, };
@@ -1,5 +1,6 @@
1
1
  export interface TableContext {
2
2
  headType?: 'docked' | 'fixed' | 'inline';
3
+ horizontalOverflow?: 'auto' | 'scroll';
3
4
  resizableFillLayout?: boolean;
4
5
  tableContainerWidthWithoutBorders?: number | null;
5
6
  }
@@ -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;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ /**
3
+ * @name Pin action column
4
+ * @description Pins action column to the end of the table.
5
+ */
6
+ declare function PinActionColumn(): React.JSX.Element;
7
+ export default PinActionColumn;
@@ -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
- /******/ var e = {
5
- /***/ 5919:
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
- /******/ t.n = e => {
45
- /******/ var r = e && e.__esModule ?
46
- /******/ () => e["default"]
47
- /******/ : () => e
11
+ /******/ e.n = r => {
12
+ /******/ var t = r && r.__esModule ?
13
+ /******/ () => r["default"]
14
+ /******/ : () => r
48
15
  /******/;
49
- t.d(r, {
50
- a: r
16
+ e.d(t, {
17
+ a: t
51
18
  });
52
- /******/ return r;
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
- /******/ t.d = (e, r) => {
60
- /******/ for (var o in r) {
61
- /******/ if (t.o(r, o) && !t.o(e, o)) {
62
- /******/ Object.defineProperty(e, o, {
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: r[o]
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
- /******/ t.o = (e, r) => Object.prototype.hasOwnProperty.call(e, r)
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
- /******/ t.r = e => {
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 o = {};
93
- // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
94
- (() => {
95
- // ESM COMPAT FLAG
96
- t.r(o);
97
- // EXPORTS
98
- t.d(o, {
99
- default: () => /* reexport */ l,
100
- isAllowedType: () => /* reexport */ f,
101
- isPrimitive: () => /* reexport */ a
102
- });
103
- // EXTERNAL MODULE: external "react"
104
- var e = t(9497);
105
- // CONCATENATED MODULE: external "lodash/isEqual"
106
- const r = require("lodash/isEqual");
107
- // EXTERNAL MODULE: external "lodash/has"
108
- var n = t(5919);
109
- var u = t.n(n);
110
- // CONCATENATED MODULE: ./src/useControlled/useControlled.tsx
111
- function a(e) {
112
- return e === null || e === undefined || typeof e === "boolean" || typeof e === "string" || typeof e === "number";
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
- function f(e) {
115
- if (a(e)) {
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
- */ function i(r) {
133
- var t = r.componentProps, o = r.componentName, n = o === void 0 ? "this component" : o, a = r.defaultValuePropName, f = a === void 0 ? "defaultValue" : a, i = r.valuePropName, l = i === void 0 ? "value" : i;
134
- var s = (0, e.useRef)(u()(t, l));
135
- var d = (0, e.useRef)(t[f]);
136
- (0, e.useEffect)((function() {
137
- if (false) {}
138
- }), [ n, t, f, l ]);
139
- (0, e.useEffect)((function() {
140
- if (false) {}
141
- if (false) {}
142
- if (false) {}
143
- }), [ n, t, f, l ]);
144
- return s.current;
145
- }
146
- /* harmony default export */ const l = i;
147
- }) // CONCATENATED MODULE: ./src/useControlled/index.ts
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
  /******/})();
@@ -0,0 +1,2 @@
1
+ export { default } from './types/src/usePrevious';
2
+ export * from './types/src/usePrevious';
package/usePrevious.js CHANGED
@@ -1,48 +1,19 @@
1
1
  /******/ (() => {
2
2
  // webpackBootstrap
3
3
  /******/ "use strict";
4
- /******/ var e = {
5
- /***/ 9497:
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
- /******/ t.d = (e, r) => {
41
- /******/ for (var o in r) {
42
- /******/ if (t.o(r, o) && !t.o(e, o)) {
43
- /******/ Object.defineProperty(e, o, {
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: r[o]
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
- /******/ t.o = (e, r) => Object.prototype.hasOwnProperty.call(e, r)
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
- /******/ t.r = e => {
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 o = {};
74
- // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
75
- (() => {
76
- // ESM COMPAT FLAG
77
- t.r(o);
78
- // EXPORTS
79
- t.d(o, {
80
- default: () => /* reexport */ n
81
- });
82
- // EXTERNAL MODULE: external "react"
83
- var e = t(9497);
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
- function r(r) {
95
- var t = (0, e.useRef)();
96
- (0, e.useEffect)((function() {
97
- t.current = r;
98
- }), [ r ]);
99
- return t.current;
100
- }
101
- /* harmony default export */ const n = r;
102
- }) // CONCATENATED MODULE: ./src/usePrevious/index.ts
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
  /******/})();