@splunk/react-ui 5.4.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/Badge.js +154 -0
- package/CHANGELOG.md +27 -0
- package/Code.js +1097 -500
- package/Color.js +142 -141
- package/ComboBox.js +6 -5
- package/Link.js +74 -44
- package/MIGRATION.md +32 -1
- package/Menu.js +41 -43
- package/Multiselect.js +596 -2143
- package/Number.js +3 -3
- package/PhoneNumber.d.ts +2 -0
- package/PhoneNumber.js +769 -0
- package/Popover.js +73 -75
- package/RadioList.js +166 -151
- package/ResultsMenu.js +27 -29
- package/Select.js +179 -1768
- package/SelectBase.d.ts +2 -0
- package/SelectBase.js +1681 -0
- package/Slider.js +202 -199
- package/SlidingPanels.js +55 -62
- package/Switch.js +42 -27
- package/TabBar.js +295 -294
- package/TabLayout.js +14 -14
- package/Table.js +1087 -1040
- package/TransitionOpen.js +82 -74
- package/docker-compose.yml +99 -52
- package/package.json +9 -5
- 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/Code/Code.d.ts +4 -3
- package/types/src/Code/index.d.ts +1 -0
- 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/Multiselect/Compact.d.ts +1 -1
- package/types/src/Multiselect/Multiselect.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/RadioList/Option.d.ts +6 -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/Switch/Switch.d.ts +3 -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 +20 -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/useResizeObserver/useResizeObserver.d.ts +2 -0
- package/types/src/useRovingFocus/useRovingFocus.d.ts +8 -1
- package/usePrevious.d.ts +2 -0
- package/useResizeObserver.js +59 -92
- 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 '@splunk/react-ui/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:
|
|
@@ -138,10 +155,12 @@ declare namespace Table {
|
|
|
138
155
|
dockScrollBar: PropTypes.Requireable<boolean>;
|
|
139
156
|
elementRef: PropTypes.Requireable<object>;
|
|
140
157
|
headType: PropTypes.Requireable<string>;
|
|
158
|
+
horizontalOverflow: PropTypes.Requireable<string>;
|
|
141
159
|
innerStyle: PropTypes.Requireable<object>;
|
|
142
160
|
onRequestToggleAllRows: PropTypes.Requireable<(...args: any[]) => any>;
|
|
143
161
|
onScroll: PropTypes.Requireable<(...args: any[]) => any>;
|
|
144
162
|
outerStyle: PropTypes.Requireable<object>;
|
|
163
|
+
pinnedColumns: PropTypes.Requireable<object>;
|
|
145
164
|
primaryColumnIndex: PropTypes.Requireable<number>;
|
|
146
165
|
rowExpansion: PropTypes.Requireable<string>;
|
|
147
166
|
rowSelection: PropTypes.Requireable<string>;
|
|
@@ -162,4 +181,4 @@ declare namespace Table {
|
|
|
162
181
|
}
|
|
163
182
|
export default Table;
|
|
164
183
|
export { Body, Caption, Cell, Head, HeadCell, HeadDropdownCell, Row };
|
|
165
|
-
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>;
|
|
@@ -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/usePrevious.d.ts
ADDED
package/useResizeObserver.js
CHANGED
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
/******/ /* webpack/runtime/define property getters */
|
|
9
9
|
/******/ (() => {
|
|
10
10
|
/******/ // define getter functions for harmony exports
|
|
11
|
-
/******/ e.d = (
|
|
12
|
-
/******/ for (var n in
|
|
13
|
-
/******/ if (e.o(
|
|
14
|
-
/******/ Object.defineProperty(
|
|
11
|
+
/******/ e.d = (r, t) => {
|
|
12
|
+
/******/ for (var n in t) {
|
|
13
|
+
/******/ if (e.o(t, n) && !e.o(r, n)) {
|
|
14
|
+
/******/ Object.defineProperty(r, n, {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get:
|
|
16
|
+
get: t[n]
|
|
17
17
|
});
|
|
18
18
|
/******/ }
|
|
19
19
|
/******/ }
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
/******/
|
|
23
23
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
24
24
|
/******/ (() => {
|
|
25
|
-
/******/ e.o = (e,
|
|
25
|
+
/******/ e.o = (e, r) => Object.prototype.hasOwnProperty.call(e, r)
|
|
26
26
|
/******/;
|
|
27
27
|
})();
|
|
28
28
|
/******/
|
|
@@ -41,104 +41,71 @@
|
|
|
41
41
|
/******/ };
|
|
42
42
|
/******/ })();
|
|
43
43
|
/******/
|
|
44
|
-
/************************************************************************/ var
|
|
44
|
+
/************************************************************************/ var r = {};
|
|
45
45
|
// ESM COMPAT FLAG
|
|
46
|
-
e.r(
|
|
46
|
+
e.r(r);
|
|
47
47
|
// EXPORTS
|
|
48
|
-
e.d(
|
|
49
|
-
default: () => /* reexport */
|
|
48
|
+
e.d(r, {
|
|
49
|
+
default: () => /* reexport */ u
|
|
50
50
|
});
|
|
51
51
|
// CONCATENATED MODULE: external "react"
|
|
52
|
-
const
|
|
52
|
+
const t = require("react");
|
|
53
|
+
// CONCATENATED MODULE: external "use-sync-external-store/shim"
|
|
54
|
+
const n = require("use-sync-external-store/shim");
|
|
53
55
|
// CONCATENATED MODULE: ./src/useResizeObserver/useResizeObserver.ts
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
function o(e, t) {
|
|
61
|
-
if (e) {
|
|
62
|
-
if ("string" == typeof e) return u(e, t);
|
|
63
|
-
var r = {}.toString.call(e).slice(8, -1);
|
|
64
|
-
return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? u(e, t) : void 0;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
function u(e, t) {
|
|
68
|
-
(null == t || t > e.length) && (t = e.length);
|
|
69
|
-
for (var r = 0, n = Array(t); r < t; r++) {
|
|
70
|
-
n[r] = e[r];
|
|
71
|
-
}
|
|
72
|
-
return n;
|
|
73
|
-
}
|
|
74
|
-
function l(e, t) {
|
|
75
|
-
var r = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
76
|
-
if (null != r) {
|
|
77
|
-
var n, i, o, u, l = [], a = !0, f = !1;
|
|
78
|
-
try {
|
|
79
|
-
if (o = (r = r.call(e)).next, 0 === t) {
|
|
80
|
-
if (Object(r) !== r) return;
|
|
81
|
-
a = !1;
|
|
82
|
-
} else for (;!(a = (n = o.call(r)).done) && (l.push(n.value), l.length !== t); a = !0) {
|
|
83
|
-
}
|
|
84
|
-
} catch (e) {
|
|
85
|
-
f = !0, i = e;
|
|
86
|
-
} finally {
|
|
87
|
-
try {
|
|
88
|
-
if (!a && null != r["return"] && (u = r["return"](), Object(u) !== u)) return;
|
|
89
|
-
} finally {
|
|
90
|
-
if (f) throw i;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return l;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
function a(e) {
|
|
97
|
-
if (Array.isArray(e)) return e;
|
|
98
|
-
}
|
|
56
|
+
// This shim is here for React 16 support
|
|
57
|
+
// Cache the server snapshot to avoid creating new objects on every render
|
|
58
|
+
var i = {
|
|
59
|
+
width: 0,
|
|
60
|
+
height: 0
|
|
61
|
+
};
|
|
99
62
|
/**
|
|
100
63
|
* Watches a React ref element for changes in size.
|
|
64
|
+
* Uses useSyncExternalStore for better React 18 concurrent rendering support.
|
|
101
65
|
*
|
|
102
66
|
* @param ref - The React ref to observe size changes on
|
|
103
|
-
|
|
104
|
-
|
|
67
|
+
* @param onResize - Callback function that receives the new dimensions
|
|
68
|
+
*/ var o = function e(r, o) {
|
|
69
|
+
var u = (0, t.useRef)({
|
|
105
70
|
width: 0,
|
|
106
71
|
height: 0
|
|
107
|
-
})
|
|
108
|
-
(0,
|
|
109
|
-
var
|
|
110
|
-
if (typeof window
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
if (e.height !== o.height || e.width !== o.width) {
|
|
120
|
-
i === null || i === void 0 ? void 0 : i(o);
|
|
121
|
-
return o;
|
|
122
|
-
}
|
|
123
|
-
return e;
|
|
124
|
-
}));
|
|
125
|
-
}
|
|
126
|
-
}));
|
|
127
|
-
if (e) {
|
|
128
|
-
r.observe(e);
|
|
129
|
-
}
|
|
130
|
-
return function() {
|
|
131
|
-
if (e) {
|
|
132
|
-
r.unobserve(e);
|
|
133
|
-
}
|
|
72
|
+
});
|
|
73
|
+
var d = (0, t.useCallback)((function(e) {
|
|
74
|
+
var t = r.current;
|
|
75
|
+
if (!t || typeof window === "undefined" || !window.ResizeObserver) {
|
|
76
|
+
return function() {};
|
|
77
|
+
// No-op if not in browser or no ResizeObserver support
|
|
78
|
+
}
|
|
79
|
+
var n = function t() {
|
|
80
|
+
var n, i;
|
|
81
|
+
var d = {
|
|
82
|
+
width: (r === null || r === void 0 ? void 0 : (n = r.current) === null || n === void 0 ? void 0 : n.getBoundingClientRect().width) || 0,
|
|
83
|
+
height: (r === null || r === void 0 ? void 0 : (i = r.current) === null || i === void 0 ? void 0 : i.getBoundingClientRect().height) || 0
|
|
134
84
|
};
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
85
|
+
if (u.current.width !== d.width || u.current.height !== d.height) {
|
|
86
|
+
u.current = d;
|
|
87
|
+
o === null || o === void 0 ? void 0 : o(d);
|
|
88
|
+
e();
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
var i = new ResizeObserver(n);
|
|
92
|
+
i.observe(t);
|
|
93
|
+
// Initial measurement
|
|
94
|
+
n();
|
|
95
|
+
return function() {
|
|
96
|
+
i.disconnect();
|
|
97
|
+
};
|
|
98
|
+
}), [ r, o ]);
|
|
99
|
+
// Use useSyncExternalStore to handle the subscription to ensure proper synchronization with
|
|
100
|
+
// Reacts concurrent rendering, it handles cases where the resize event might be interrupted
|
|
101
|
+
// or batched with other updates
|
|
102
|
+
return (0, n.useSyncExternalStore)(d, (function() {
|
|
103
|
+
return u.current;
|
|
104
|
+
}), (function() {
|
|
105
|
+
return i;
|
|
106
|
+
}));
|
|
140
107
|
};
|
|
141
|
-
/* harmony default export */ const
|
|
108
|
+
/* harmony default export */ const u = o;
|
|
142
109
|
// CONCATENATED MODULE: ./src/useResizeObserver/index.ts
|
|
143
|
-
module.exports =
|
|
110
|
+
module.exports = r;
|
|
144
111
|
/******/})();
|
package/useRovingFocus.js
CHANGED
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
/******/ /* webpack/runtime/define property getters */
|
|
9
9
|
/******/ (() => {
|
|
10
10
|
/******/ // define getter functions for harmony exports
|
|
11
|
-
/******/ e.d = (
|
|
12
|
-
/******/ for (var n in
|
|
13
|
-
/******/ if (e.o(
|
|
14
|
-
/******/ Object.defineProperty(
|
|
11
|
+
/******/ e.d = (r, t) => {
|
|
12
|
+
/******/ for (var n in t) {
|
|
13
|
+
/******/ if (e.o(t, n) && !e.o(r, n)) {
|
|
14
|
+
/******/ Object.defineProperty(r, n, {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get:
|
|
16
|
+
get: t[n]
|
|
17
17
|
});
|
|
18
18
|
/******/ }
|
|
19
19
|
/******/ }
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
/******/
|
|
23
23
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
24
24
|
/******/ (() => {
|
|
25
|
-
/******/ e.o = (e,
|
|
25
|
+
/******/ e.o = (e, r) => Object.prototype.hasOwnProperty.call(e, r)
|
|
26
26
|
/******/;
|
|
27
27
|
})();
|
|
28
28
|
/******/
|
|
@@ -41,19 +41,70 @@
|
|
|
41
41
|
/******/ };
|
|
42
42
|
/******/ })();
|
|
43
43
|
/******/
|
|
44
|
-
/************************************************************************/ var
|
|
44
|
+
/************************************************************************/ var r = {};
|
|
45
45
|
// ESM COMPAT FLAG
|
|
46
|
-
e.r(
|
|
46
|
+
e.r(r);
|
|
47
47
|
// EXPORTS
|
|
48
|
-
e.d(
|
|
49
|
-
default: () => /* reexport */
|
|
48
|
+
e.d(r, {
|
|
49
|
+
default: () => /* reexport */ s
|
|
50
50
|
});
|
|
51
51
|
// CONCATENATED MODULE: external "react"
|
|
52
|
-
const
|
|
52
|
+
const t = require("react");
|
|
53
53
|
// CONCATENATED MODULE: external "@splunk/ui-utils/focus"
|
|
54
54
|
const n = require("@splunk/ui-utils/focus");
|
|
55
55
|
// CONCATENATED MODULE: ./src/useRovingFocus/useRovingFocus.tsx
|
|
56
|
-
|
|
56
|
+
function o(e) {
|
|
57
|
+
"@babel/helpers - typeof";
|
|
58
|
+
return o = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
|
|
59
|
+
return typeof e;
|
|
60
|
+
} : function(e) {
|
|
61
|
+
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
62
|
+
}, o(e);
|
|
63
|
+
}
|
|
64
|
+
function u(e, r) {
|
|
65
|
+
var t = Object.keys(e);
|
|
66
|
+
if (Object.getOwnPropertySymbols) {
|
|
67
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
68
|
+
r && (n = n.filter((function(r) {
|
|
69
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
70
|
+
}))), t.push.apply(t, n);
|
|
71
|
+
}
|
|
72
|
+
return t;
|
|
73
|
+
}
|
|
74
|
+
function i(e) {
|
|
75
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
76
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
77
|
+
r % 2 ? u(Object(t), !0).forEach((function(r) {
|
|
78
|
+
a(e, r, t[r]);
|
|
79
|
+
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : u(Object(t)).forEach((function(r) {
|
|
80
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
83
|
+
return e;
|
|
84
|
+
}
|
|
85
|
+
function a(e, r, t) {
|
|
86
|
+
return (r = c(r)) in e ? Object.defineProperty(e, r, {
|
|
87
|
+
value: t,
|
|
88
|
+
enumerable: !0,
|
|
89
|
+
configurable: !0,
|
|
90
|
+
writable: !0
|
|
91
|
+
}) : e[r] = t, e;
|
|
92
|
+
}
|
|
93
|
+
function c(e) {
|
|
94
|
+
var r = f(e, "string");
|
|
95
|
+
return "symbol" == o(r) ? r : r + "";
|
|
96
|
+
}
|
|
97
|
+
function f(e, r) {
|
|
98
|
+
if ("object" != o(e) || !e) return e;
|
|
99
|
+
var t = e[Symbol.toPrimitive];
|
|
100
|
+
if (void 0 !== t) {
|
|
101
|
+
var n = t.call(e, r || "default");
|
|
102
|
+
if ("object" != o(n)) return n;
|
|
103
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
104
|
+
}
|
|
105
|
+
return ("string" === r ? String : Number)(e);
|
|
106
|
+
}
|
|
107
|
+
var l = {
|
|
57
108
|
enableLoop: false,
|
|
58
109
|
orientation: "horizontal",
|
|
59
110
|
enableTab: false,
|
|
@@ -78,48 +129,52 @@
|
|
|
78
129
|
* <button type="button">second</button>
|
|
79
130
|
* </div>
|
|
80
131
|
* ```
|
|
81
|
-
*/ function
|
|
82
|
-
var e =
|
|
83
|
-
var
|
|
84
|
-
var o =
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
132
|
+
*/ function b() {
|
|
133
|
+
var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
134
|
+
var r = (0, t.useRef)(0);
|
|
135
|
+
var o = (0, t.useRef)([]);
|
|
136
|
+
var u = i(i({}, l), e);
|
|
137
|
+
var a = function e(t) {
|
|
138
|
+
r.current = t;
|
|
139
|
+
o.current.forEach((function(e, t) {
|
|
140
|
+
return t === r.current ? e.removeAttribute("tabindex") : e.setAttribute("tabindex", "-1");
|
|
88
141
|
}));
|
|
89
142
|
};
|
|
90
|
-
var
|
|
91
|
-
|
|
143
|
+
var c = function e(t) {
|
|
144
|
+
o.current = t != null ? (0, n.getSortedTabbableElements)(t, {
|
|
92
145
|
ignoreTabIndex: true
|
|
93
146
|
}) : [];
|
|
94
|
-
|
|
147
|
+
a(r.current);
|
|
95
148
|
};
|
|
96
|
-
var
|
|
97
|
-
var
|
|
98
|
-
if (!
|
|
99
|
-
|
|
149
|
+
var f = function e(r) {
|
|
150
|
+
var t = r.relatedTarget instanceof HTMLElement && o.current.includes(r.relatedTarget);
|
|
151
|
+
if (!t) {
|
|
152
|
+
a(0);
|
|
100
153
|
}
|
|
101
154
|
};
|
|
102
|
-
var
|
|
103
|
-
var
|
|
104
|
-
if (
|
|
105
|
-
|
|
155
|
+
var b = function e(r) {
|
|
156
|
+
var t = r.target instanceof HTMLElement ? o.current.indexOf(r.target) : -1;
|
|
157
|
+
if (t >= 0) {
|
|
158
|
+
a(t);
|
|
106
159
|
}
|
|
107
160
|
};
|
|
108
|
-
var
|
|
109
|
-
var
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
161
|
+
var s = function e(r) {
|
|
162
|
+
var t = r.nativeEvent.target;
|
|
163
|
+
var i = t instanceof HTMLElement ? o.current.indexOf(t) : -1;
|
|
164
|
+
if (i === -1) {
|
|
165
|
+
return;
|
|
113
166
|
}
|
|
167
|
+
/* Only apply focus if we are among the navigable items in this container */ (0,
|
|
168
|
+
n.handleFocus)(r.key, o.current, i, u);
|
|
114
169
|
};
|
|
115
170
|
return {
|
|
116
|
-
ref:
|
|
117
|
-
onBlur:
|
|
118
|
-
onFocus:
|
|
119
|
-
onKeyDown:
|
|
171
|
+
ref: c,
|
|
172
|
+
onBlur: f,
|
|
173
|
+
onFocus: b,
|
|
174
|
+
onKeyDown: s
|
|
120
175
|
};
|
|
121
176
|
}
|
|
122
|
-
/* harmony default export */ const
|
|
177
|
+
/* harmony default export */ const s = b;
|
|
123
178
|
// CONCATENATED MODULE: ./src/useRovingFocus/index.ts
|
|
124
|
-
module.exports =
|
|
179
|
+
module.exports = r;
|
|
125
180
|
/******/})();
|
|
File without changes
|