@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/Link.js
CHANGED
|
@@ -61,48 +61,73 @@
|
|
|
61
61
|
e.r(n);
|
|
62
62
|
// EXPORTS
|
|
63
63
|
e.d(n, {
|
|
64
|
-
|
|
64
|
+
LinkContext: () => /* reexport */ y,
|
|
65
|
+
LinkProvider: () => /* reexport */ m,
|
|
66
|
+
default: () => /* reexport */ j
|
|
65
67
|
});
|
|
66
68
|
// CONCATENATED MODULE: external "react"
|
|
67
69
|
const t = require("react");
|
|
68
70
|
var r = e.n(t);
|
|
69
71
|
// CONCATENATED MODULE: external "prop-types"
|
|
70
|
-
const
|
|
71
|
-
var a = e.n(
|
|
72
|
+
const i = require("prop-types");
|
|
73
|
+
var a = e.n(i);
|
|
72
74
|
// CONCATENATED MODULE: external "@splunk/react-ui/ScreenReaderContent"
|
|
73
|
-
const
|
|
74
|
-
var l = e.n(
|
|
75
|
+
const o = require("@splunk/react-ui/ScreenReaderContent");
|
|
76
|
+
var l = e.n(o);
|
|
75
77
|
// CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
|
|
76
78
|
const s = require("@splunk/ui-utils/i18n");
|
|
77
79
|
// CONCATENATED MODULE: external "styled-components"
|
|
78
|
-
const
|
|
79
|
-
var
|
|
80
|
+
const d = require("styled-components");
|
|
81
|
+
var c = e.n(d);
|
|
80
82
|
// CONCATENATED MODULE: external "@splunk/react-icons/ArrowSquareTopRightInset"
|
|
81
83
|
const u = require("@splunk/react-icons/ArrowSquareTopRightInset");
|
|
82
|
-
var
|
|
84
|
+
var f = e.n(u);
|
|
83
85
|
// CONCATENATED MODULE: external "@splunk/themes"
|
|
84
|
-
const
|
|
86
|
+
const v = require("@splunk/themes");
|
|
85
87
|
// CONCATENATED MODULE: ./src/Link/icons/External.tsx
|
|
86
|
-
var
|
|
88
|
+
var b = c()(f()).withConfig({
|
|
87
89
|
displayName: "External",
|
|
88
90
|
componentId: "sc-13bdx45-0"
|
|
89
|
-
})([ "vertical-align:text-bottom;margin-left:", ";" ],
|
|
90
|
-
/* harmony default export */ const
|
|
91
|
+
})([ "vertical-align:text-bottom;margin-left:", ";" ], v.variables.spacingXSmall);
|
|
92
|
+
/* harmony default export */ const p = b;
|
|
93
|
+
// CONCATENATED MODULE: ./src/Link/LinkContext.tsx
|
|
94
|
+
var g = {
|
|
95
|
+
enableVisitedStyling: false
|
|
96
|
+
};
|
|
97
|
+
var y = (0, t.createContext)(g);
|
|
98
|
+
/**
|
|
99
|
+
* Control behavior for all children Link components.
|
|
100
|
+
*/ var m = function e(n) {
|
|
101
|
+
var i = n.enableVisitedStyling, a = i === void 0 ? false : i, o = n.children;
|
|
102
|
+
// @docs-props-type LinkProviderProps
|
|
103
|
+
var l = (0, t.useMemo)((function() {
|
|
104
|
+
return {
|
|
105
|
+
enableVisitedStyling: a
|
|
106
|
+
};
|
|
107
|
+
}), [ a ]);
|
|
108
|
+
|
|
109
|
+
return r().createElement(y.Provider, {
|
|
110
|
+
value: l
|
|
111
|
+
}, o);
|
|
112
|
+
};
|
|
91
113
|
// CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
|
|
92
|
-
const
|
|
93
|
-
var
|
|
114
|
+
const h = require("@splunk/react-ui/Clickable");
|
|
115
|
+
var S = e.n(h);
|
|
94
116
|
// CONCATENATED MODULE: ./src/Link/LinkStyles.ts
|
|
95
|
-
var
|
|
117
|
+
var w = c()(S()).withConfig({
|
|
96
118
|
displayName: "LinkStyles__StyledClickable",
|
|
97
119
|
componentId: "sc-1hhltcf-0"
|
|
98
|
-
})([ "", ";text-decoration:none;font-size:inherit;font-weight:inherit;line-height:inherit;color:", ";", " &:not([disabled],[aria-disabled='true']){cursor:pointer;&:hover,&:active,&:focus{color:", ";text-decoration:underline;text-decoration-thickness:2px;}&:focus{box-shadow:", ";outline:0;&:active{box-shadow:none;}}}&[disabled],&[aria-disabled='true']{color:", ";}" ],
|
|
99
|
-
|
|
100
|
-
inline: (0,
|
|
101
|
-
standalone: (0,
|
|
102
|
-
}),
|
|
120
|
+
})([ "", ";text-decoration:none;font-size:inherit;font-weight:inherit;line-height:inherit;color:", ";", " &:not([disabled],[aria-disabled='true']){cursor:pointer;&:hover,&:active,&:focus{color:", ";text-decoration:underline;text-decoration-thickness:2px;}&:focus{box-shadow:", ";outline:0;&:active{box-shadow:none;}}}&[disabled],&[aria-disabled='true']{color:", ";}", "" ], v.mixins.reset("inline"), v.variables.contentColorLink, (0,
|
|
121
|
+
v.pickVariant)("$appearance", {
|
|
122
|
+
inline: (0, d.css)([ "text-decoration:underline;" ]),
|
|
123
|
+
standalone: (0, d.css)([ "font-weight:", ";" ], v.variables.fontWeightSemiBold)
|
|
124
|
+
}), v.variables.contentColorLink, v.variables.focusShadow, v.variables.contentColorLinkDisabled, (function(e) {
|
|
125
|
+
var n = e.$enableVisitedStyling;
|
|
126
|
+
return n && (0, d.css)([ "&:visited{color:", ";}&:where([disabled],[aria-disabled='true']):visited{color:", ";}" ], v.variables.contentColorLinkVisited, v.variables.contentColorLinkVisitedDisabled);
|
|
127
|
+
}));
|
|
103
128
|
// CONCATENATED MODULE: ./src/Link/Link.tsx
|
|
104
|
-
function
|
|
105
|
-
return
|
|
129
|
+
function x() {
|
|
130
|
+
return x = Object.assign ? Object.assign.bind() : function(e) {
|
|
106
131
|
for (var n = 1; n < arguments.length; n++) {
|
|
107
132
|
var t = arguments[n];
|
|
108
133
|
for (var r in t) {
|
|
@@ -110,20 +135,20 @@
|
|
|
110
135
|
}
|
|
111
136
|
}
|
|
112
137
|
return e;
|
|
113
|
-
},
|
|
138
|
+
}, x.apply(null, arguments);
|
|
114
139
|
}
|
|
115
|
-
function
|
|
140
|
+
function O(e, n) {
|
|
116
141
|
if (null == e) return {};
|
|
117
|
-
var t, r,
|
|
142
|
+
var t, r, i = k(e, n);
|
|
118
143
|
if (Object.getOwnPropertySymbols) {
|
|
119
144
|
var a = Object.getOwnPropertySymbols(e);
|
|
120
145
|
for (r = 0; r < a.length; r++) {
|
|
121
|
-
t = a[r], -1 === n.indexOf(t) && {}.propertyIsEnumerable.call(e, t) && (
|
|
146
|
+
t = a[r], -1 === n.indexOf(t) && {}.propertyIsEnumerable.call(e, t) && (i[t] = e[t]);
|
|
122
147
|
}
|
|
123
148
|
}
|
|
124
|
-
return
|
|
149
|
+
return i;
|
|
125
150
|
}
|
|
126
|
-
function
|
|
151
|
+
function k(e, n) {
|
|
127
152
|
if (null == e) return {};
|
|
128
153
|
var t = {};
|
|
129
154
|
for (var r in e) {
|
|
@@ -134,42 +159,47 @@
|
|
|
134
159
|
}
|
|
135
160
|
return t;
|
|
136
161
|
}
|
|
137
|
-
var
|
|
162
|
+
var C = {
|
|
138
163
|
appearance: a().oneOf([ "inline", "standalone" ]),
|
|
139
164
|
children: a().node,
|
|
140
165
|
disabled: a().bool,
|
|
141
166
|
elementRef: a().oneOfType([ a().func, a().object ]),
|
|
167
|
+
enableVisitedStyling: a().bool,
|
|
142
168
|
openInNewContext: a().oneOfType([ a().bool, a().string ]),
|
|
143
169
|
to: a().string
|
|
144
170
|
};
|
|
145
|
-
var
|
|
171
|
+
var V = (0, s._)("(Opens new window)");
|
|
146
172
|
/**
|
|
147
173
|
* `Link` is a simple method for configuring `Button` for inline links. For more complex behaviors,
|
|
148
174
|
* see the `Button` documentation.
|
|
149
|
-
*/ var
|
|
175
|
+
*/ var P = r().forwardRef((function(e,
|
|
150
176
|
// SUI-7623 - needs to be specified for react-docgen versions less than 7.1.0
|
|
151
177
|
n) {
|
|
152
|
-
var
|
|
178
|
+
var i = e.appearance, a = i === void 0 ? "inline" : i, o = e.children, s = e.disabled, d = s === void 0 ? false : s, c = e.elementRef, u = e.enableVisitedStyling, f = e.openInNewContext, v = f === void 0 ? false : f, b = e.tag, g = b === void 0 ? "a" : b, m = e.to, h = O(e, [ "appearance", "children", "disabled", "elementRef", "enableVisitedStyling", "openInNewContext", "tag", "to" ]);
|
|
153
179
|
// @docs-props-type LinkPropsBase
|
|
154
|
-
var
|
|
180
|
+
var S = typeof v === "string" ? v : V;
|
|
155
181
|
// Ensure `Link` always renders as an `a` (unless overriden by `tag`) by passing a value to Clickable,
|
|
156
182
|
// using '' if disabled or the to is not passed.
|
|
157
|
-
var
|
|
183
|
+
var k = g !== "button" ? d && "" || m && m || "" : undefined;
|
|
184
|
+
// Allow the prop to override context
|
|
185
|
+
var C = (0, t.useContext)(y), P = C.enableVisitedStyling;
|
|
186
|
+
var j = u !== null && u !== void 0 ? u : P;
|
|
158
187
|
|
|
159
|
-
return r().createElement(
|
|
188
|
+
return r().createElement(w, x({
|
|
160
189
|
"data-test": "link",
|
|
161
|
-
disabled:
|
|
190
|
+
disabled: d ? "disabled" : undefined,
|
|
162
191
|
elementRef: c,
|
|
163
|
-
openInNewContext: !!
|
|
164
|
-
$appearance:
|
|
192
|
+
openInNewContext: !!v,
|
|
193
|
+
$appearance: a,
|
|
194
|
+
$enableVisitedStyling: j,
|
|
165
195
|
ref: n,
|
|
166
|
-
to:
|
|
167
|
-
},
|
|
168
|
-
tag:
|
|
169
|
-
}),
|
|
196
|
+
to: k
|
|
197
|
+
}, h, {
|
|
198
|
+
tag: g
|
|
199
|
+
}), o, v && r().createElement(r().Fragment, null, r().createElement(p, null), r().createElement(l(), null, S)));
|
|
170
200
|
}));
|
|
171
|
-
|
|
172
|
-
/* harmony default export */ const
|
|
201
|
+
P.propTypes = C;
|
|
202
|
+
/* harmony default export */ const j = P;
|
|
173
203
|
// forwardRef appears to prevent TS from inferring LinkProps in components that import Link
|
|
174
204
|
// so we need to export it separately to prevent the TS build from failing with:
|
|
175
205
|
// "... has or is using name 'LinkPropsBase' from external module "...packages/react-ui/src/Link/Link" but cannot be named."
|
package/MIGRATION.md
CHANGED
|
@@ -2,12 +2,43 @@
|
|
|
2
2
|
|
|
3
3
|
This document lists migration guidance for new features and breaking changes.
|
|
4
4
|
|
|
5
|
+
## 5.5.0
|
|
6
|
+
|
|
7
|
+
### Deprecated `Switch`'s `selectedLabel`, `someSelectedLabel`, and `unselectedLabel` props
|
|
8
|
+
|
|
9
|
+
#### Change
|
|
10
|
+
`Switch`'s `selectedLabel`, `someSelectedLabel`, and `unselectedLabel` props have been deprecated and will be removed in the next major version.
|
|
11
|
+
|
|
12
|
+
#### Context
|
|
13
|
+
`Switch`'s `selectedLabel`, `someSelectedLabel`, and `unselectedLabel` props have low usage and the same behavior can be achieved in other ways.
|
|
14
|
+
|
|
15
|
+
#### Migration steps
|
|
16
|
+
* Remove all usage of `Switch`'s `selectedLabel`, `someSelectedLabel`, and `unselectedLabel` props.
|
|
17
|
+
* Change the content depending on the `selected` prop's value and do any of the following:
|
|
18
|
+
* Set the `aria-label` prop to your content and pass the prop into `Switch`
|
|
19
|
+
* Use the `ScreenReaderContent` component
|
|
20
|
+
* Place content on screen
|
|
21
|
+
|
|
22
|
+
### Add new prop `horizontalOverflow` to `Table`
|
|
23
|
+
|
|
24
|
+
#### Change
|
|
25
|
+
* `Table` supports a new prop called `horizontalOverflow`.
|
|
26
|
+
|
|
27
|
+
#### Context
|
|
28
|
+
The `Table` component's default overflow behavior has changed between version v4 and v5:
|
|
29
|
+
|
|
30
|
+
- **v4**: When the `Table`'s container is smaller than the `Table` it will scroll horizontally. `HeadCell` content remains fully visible and `Cell` content wraps only at word breaks.
|
|
31
|
+
- **v5**: The `Table` has a responsive behavior. `HeadCell` content truncates when needed, `Cell` content wraps to fit available space, and horizontal scrolling occurs only when `Table`'s container is smaller than `Table`'s width.
|
|
32
|
+
|
|
33
|
+
#### Migration Steps
|
|
34
|
+
* To restore v4 behavior, use `horizontalOverflow="scroll"` prop. This enables horizontal scrolling when `Table` has overflow, keeps `HeadCell` content fully visible, and limits `Cell` content wrapping to word breaks only.
|
|
35
|
+
|
|
5
36
|
## 5.3.0
|
|
6
37
|
|
|
7
38
|
### `Switch`'s `appearance="checkbox"` prop has been deprecated in favor of new `Checkbox` component.
|
|
8
39
|
|
|
9
40
|
#### Change
|
|
10
|
-
|
|
41
|
+
`Switch`'s `appearance="checkbox"` prop has been deprecated and will be removed in the next major version.
|
|
11
42
|
|
|
12
43
|
#### Context
|
|
13
44
|
The `Switch` component combines two different components - a checkbox and a toggle. While superficially similar in that they both provide a boolean control, they are semantically different controls.
|
package/Markdown.js
CHANGED
|
@@ -136,6 +136,7 @@
|
|
|
136
136
|
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
137
137
|
}, g(e);
|
|
138
138
|
}
|
|
139
|
+
// eslint-disable-next-line no-relative-imports-of-published -- because MarkdownHeading and MarkdownAnchorHeading come from the same @splunk/react-ui/Markdown top level export so it would be a circular dependency if using the external/alias (ok here because thin/no context)
|
|
139
140
|
// When this is used in MDX, the node isn't guaranteed to be text,
|
|
140
141
|
// so this method extracts the actual text from the node.
|
|
141
142
|
function h(e) {
|
|
@@ -799,15 +800,18 @@
|
|
|
799
800
|
tbody: Me
|
|
800
801
|
};
|
|
801
802
|
}), [ r, g, c, u, s, d, v, y ]);
|
|
803
|
+
var w = (0, n.useMemo)((function() {
|
|
804
|
+
// prettier-ignore
|
|
805
|
+
return {
|
|
806
|
+
pre: (0, f.css)([ ":is(", ")" ], S),
|
|
807
|
+
blockquote: (0, f.css)([ ":is(", ")" ], x)
|
|
808
|
+
};
|
|
809
|
+
}), []);
|
|
802
810
|
|
|
803
811
|
return t().createElement(p(), Ue({
|
|
804
812
|
"data-test": "markdown",
|
|
805
813
|
elementRef: i,
|
|
806
|
-
elementSelectors:
|
|
807
|
-
/* stylelint-disable */
|
|
808
|
-
pre: (0, f.css)([ ":is(", ")" ], S),
|
|
809
|
-
blockquote: (0, f.css)([ ":is(", ")" ], x)
|
|
810
|
-
/* stylelint-enable */ }
|
|
814
|
+
elementSelectors: w
|
|
811
815
|
}, O), t().createElement(a(), Ue({
|
|
812
816
|
remarkPlugins: Qe,
|
|
813
817
|
components: h
|
package/Menu.js
CHANGED
|
@@ -61,10 +61,10 @@
|
|
|
61
61
|
e.r(t);
|
|
62
62
|
// EXPORTS
|
|
63
63
|
e.d(t, {
|
|
64
|
-
Divider: () => /* reexport */
|
|
64
|
+
Divider: () => /* reexport */ H,
|
|
65
65
|
Heading: () => /* reexport */ Z,
|
|
66
66
|
Item: () => /* reexport */ Se,
|
|
67
|
-
MenuContext: () => /* reexport */
|
|
67
|
+
MenuContext: () => /* reexport */ T,
|
|
68
68
|
default: () => /* reexport */ qe
|
|
69
69
|
});
|
|
70
70
|
// CONCATENATED MODULE: external "react"
|
|
@@ -180,10 +180,10 @@
|
|
|
180
180
|
role: "menu",
|
|
181
181
|
preventFocus: false
|
|
182
182
|
});
|
|
183
|
-
/* harmony default export */ const
|
|
183
|
+
/* harmony default export */ const T = D;
|
|
184
184
|
// CONCATENATED MODULE: ./src/Menu/Divider.tsx
|
|
185
|
-
function
|
|
186
|
-
return
|
|
185
|
+
function N() {
|
|
186
|
+
return N = Object.assign ? Object.assign.bind() : function(e) {
|
|
187
187
|
for (var t = 1; t < arguments.length; t++) {
|
|
188
188
|
var r = arguments[t];
|
|
189
189
|
for (var n in r) {
|
|
@@ -191,16 +191,16 @@
|
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
return e;
|
|
194
|
-
},
|
|
194
|
+
}, N.apply(null, arguments);
|
|
195
195
|
}
|
|
196
196
|
var q = {};
|
|
197
197
|
/**
|
|
198
198
|
* A non-interactive menu item used to visually separate groups of items in the menu.
|
|
199
199
|
*/ function $(e) {
|
|
200
|
-
var t =
|
|
201
|
-
var a = (0, r.useContext)(
|
|
200
|
+
var t = N({}, e);
|
|
201
|
+
var a = (0, r.useContext)(T), i = a.role;
|
|
202
202
|
|
|
203
|
-
return n().createElement(A,
|
|
203
|
+
return n().createElement(A, N({
|
|
204
204
|
"aria-hidden": i === "listbox",
|
|
205
205
|
"data-test": "divider",
|
|
206
206
|
role: "separator"
|
|
@@ -211,16 +211,16 @@
|
|
|
211
211
|
/* Remove consecutive items with filterConsecutive = true (Dividers and Headings) */ $.filterConsecutive = true;
|
|
212
212
|
/* Remove the item if it is the last item after filtering. */ $.filterLast = true;
|
|
213
213
|
/* Tag the item as Divider */ $.as = "Divider";
|
|
214
|
-
/* harmony default export */ const
|
|
214
|
+
/* harmony default export */ const H = $;
|
|
215
215
|
// CONCATENATED MODULE: external "@splunk/react-ui/Heading"
|
|
216
|
-
const
|
|
217
|
-
var
|
|
216
|
+
const R = require("@splunk/react-ui/Heading");
|
|
217
|
+
var M = e.n(R);
|
|
218
218
|
// CONCATENATED MODULE: ./src/Menu/HeadingStyles.ts
|
|
219
|
-
var
|
|
219
|
+
var F = u().div.withConfig({
|
|
220
220
|
displayName: "HeadingStyles__Styled",
|
|
221
221
|
componentId: "mcd2ws-0"
|
|
222
222
|
})([ "", " border-top:1px solid transparent;padding:", " ", ";&:not(:first-child){border-top:1px solid ", ";margin-top:", ";}" ], p.mixins.reset("block"), p.variables.spacingSmall, p.variables.spacingLarge, p.variables.borderColor, p.variables.spacingSmall);
|
|
223
|
-
var L = u()(
|
|
223
|
+
var L = u()(M()).withConfig({
|
|
224
224
|
displayName: "HeadingStyles__StyledHeading",
|
|
225
225
|
componentId: "mcd2ws-1"
|
|
226
226
|
})([ "color:", ";" ], p.variables.contentColorDefault);
|
|
@@ -319,7 +319,7 @@
|
|
|
319
319
|
*/ function Y(e) {
|
|
320
320
|
var t = e.children, a = e.outerStyle, i = e.title, o = J(e, [ "children", "outerStyle", "title" ]);
|
|
321
321
|
// @docs-props-type HeadingPropsBase
|
|
322
|
-
var l = (0, r.useContext)(
|
|
322
|
+
var l = (0, r.useContext)(T), s = l.role;
|
|
323
323
|
var c = (0, r.useMemo)((function() {
|
|
324
324
|
return z(z({}, a), {}, {
|
|
325
325
|
margin: 0
|
|
@@ -330,7 +330,7 @@
|
|
|
330
330
|
// of items in the list if it contains a heading or divider
|
|
331
331
|
// so we set them to aria-hidden to prevent that
|
|
332
332
|
|
|
333
|
-
return n().createElement(
|
|
333
|
+
return n().createElement(F, {
|
|
334
334
|
"aria-hidden": s === "listbox" ? true : undefined
|
|
335
335
|
}, n().createElement(L, B({
|
|
336
336
|
style: c,
|
|
@@ -436,109 +436,114 @@
|
|
|
436
436
|
};
|
|
437
437
|
var ye = (0, se._)("(Opens new window)");
|
|
438
438
|
function he(e) {
|
|
439
|
-
var t
|
|
439
|
+
var t;
|
|
440
|
+
var a = e.active, o = e.children, l = e.description, s = e.descriptionPosition, c = s === void 0 ? "bottom" : s, u = e.disabled, d = e.endAdornment, v = e.elementRef, p = e.hasSubmenu, f = e.itemKey, m = e.matchRanges, b = e.onClick, g = e.onFocus, y = e.openInNewContext, w = e.role, A = e.selectable, D = e.selectableAppearance, N = D === void 0 ? "checkmark" : D, q = e.selected, $ = e.startAdornment, H = e.to, R = e.truncate, M = me(e, [ "active", "children", "description", "descriptionPosition", "disabled", "endAdornment", "elementRef", "hasSubmenu", "itemKey", "matchRanges", "onClick", "onFocus", "openInNewContext", "role", "selectable", "selectableAppearance", "selected", "startAdornment", "to", "truncate" ]);
|
|
440
441
|
// @docs-props-type ItemPropsBase
|
|
441
|
-
var F = (0, r.useContext)(
|
|
442
|
+
var F = (0, r.useContext)(T), L = F.preventFocus;
|
|
443
|
+
// Use arguments[0] (raw props) to check if `selectableAppearance` was explicitly passed by the caller.
|
|
444
|
+
// This prevents the default value from incorrectly triggering the dev warning.
|
|
445
|
+
// eslint-disable-next-line prefer-rest-params
|
|
446
|
+
var K = (t = arguments[0]) === null || t === void 0 ? void 0 : t.selectableAppearance;
|
|
442
447
|
(0, r.useEffect)((function() {
|
|
443
448
|
if (false) {}
|
|
444
|
-
}), [ R,
|
|
445
|
-
var
|
|
446
|
-
|
|
447
|
-
itemKey:
|
|
449
|
+
}), [ R, c, m, o, q, A, N, K ]);
|
|
450
|
+
var B = (0, r.useCallback)((function(e) {
|
|
451
|
+
g === null || g === void 0 ? void 0 : g(e, {
|
|
452
|
+
itemKey: f
|
|
448
453
|
});
|
|
449
|
-
}), [
|
|
450
|
-
var
|
|
451
|
-
if (
|
|
454
|
+
}), [ f, g ]);
|
|
455
|
+
var W = (0, r.useCallback)((function(e) {
|
|
456
|
+
if (L) {
|
|
452
457
|
e.preventDefault();
|
|
453
458
|
}
|
|
454
|
-
}), [
|
|
455
|
-
var
|
|
456
|
-
if (!
|
|
457
|
-
return
|
|
459
|
+
}), [ L ]);
|
|
460
|
+
var z = (0, r.useMemo)((function() {
|
|
461
|
+
if (!m || !te()(o)) {
|
|
462
|
+
return o;
|
|
458
463
|
}
|
|
459
464
|
var e = [];
|
|
460
465
|
// before first match. May be empty string.
|
|
461
|
-
e.push(
|
|
462
|
-
|
|
466
|
+
e.push(o.substring(0, m[0].start));
|
|
467
|
+
m.forEach((function(t, r) {
|
|
463
468
|
e.push(
|
|
464
469
|
|
|
465
470
|
// eslint-disable-next-line react/no-array-index-key
|
|
466
471
|
n().createElement(P, {
|
|
467
472
|
key: r,
|
|
468
473
|
"data-test": "match"
|
|
469
|
-
},
|
|
470
|
-
if (r <
|
|
471
|
-
e.push(
|
|
474
|
+
}, o.substring(t.start, t.end)));
|
|
475
|
+
if (r < m.length - 1) {
|
|
476
|
+
e.push(o.substring(t.end, m[r + 1].start));
|
|
472
477
|
} else {
|
|
473
|
-
e.push(
|
|
478
|
+
e.push(o.substring(t.end, o.length));
|
|
474
479
|
}
|
|
475
480
|
}));
|
|
476
481
|
return e;
|
|
477
|
-
}), [
|
|
478
|
-
var
|
|
479
|
-
var
|
|
480
|
-
var
|
|
482
|
+
}), [ o, m ]);
|
|
483
|
+
var V = q === true || q === "some";
|
|
484
|
+
var X = A || V;
|
|
485
|
+
var G = w || {
|
|
481
486
|
nonselectable: "menuitem",
|
|
482
487
|
checkmark: "menuitemradio",
|
|
483
488
|
checkbox: "menuitemcheckbox"
|
|
484
|
-
}[
|
|
485
|
-
var
|
|
486
|
-
"aria-haspopup":
|
|
489
|
+
}[X ? N : "nonselectable"];
|
|
490
|
+
var J = {
|
|
491
|
+
"aria-haspopup": p ? true : undefined
|
|
487
492
|
};
|
|
488
|
-
if (
|
|
489
|
-
|
|
490
|
-
} else if (
|
|
491
|
-
|
|
493
|
+
if (G === "menuitemradio" || G === "menuitemcheckbox") {
|
|
494
|
+
J["aria-checked"] = q === "some" ? "mixed" : V;
|
|
495
|
+
} else if (G === "option") {
|
|
496
|
+
J["aria-selected"] = V;
|
|
492
497
|
}
|
|
493
|
-
var
|
|
494
|
-
var
|
|
495
|
-
var
|
|
498
|
+
var Q = l && c === "right";
|
|
499
|
+
var U = l && !Q;
|
|
500
|
+
var Y = q && N === "checkmark" && n().createElement(O, null, n().createElement(ne(), {
|
|
496
501
|
"data-test": "selected-checkmark",
|
|
497
502
|
inline: true
|
|
498
503
|
}));
|
|
499
|
-
var
|
|
500
|
-
var
|
|
501
|
-
if (
|
|
502
|
-
|
|
503
|
-
|
|
504
|
+
var Z = false;
|
|
505
|
+
var ee;
|
|
506
|
+
if (y) {
|
|
507
|
+
Z = true;
|
|
508
|
+
ee = typeof y === "string" ? y : ye;
|
|
504
509
|
}
|
|
505
510
|
|
|
506
511
|
return n().createElement(C, fe({
|
|
507
|
-
$active:
|
|
508
|
-
$isSelectable:
|
|
509
|
-
$preventFocus:
|
|
510
|
-
$selectableAppearance:
|
|
511
|
-
$selected:
|
|
512
|
-
"data-has-icon":
|
|
512
|
+
$active: a,
|
|
513
|
+
$isSelectable: X,
|
|
514
|
+
$preventFocus: L || false,
|
|
515
|
+
$selectableAppearance: N !== null && N !== void 0 ? N : false,
|
|
516
|
+
$selected: V,
|
|
517
|
+
"data-has-icon": !!$ || !!d,
|
|
513
518
|
"data-test": "item",
|
|
514
|
-
"data-test-selected":
|
|
515
|
-
disabled:
|
|
516
|
-
elementRef:
|
|
517
|
-
onClick:
|
|
518
|
-
onFocus:
|
|
519
|
-
onMouseDown:
|
|
520
|
-
openInNewContext:
|
|
521
|
-
role:
|
|
522
|
-
tabIndex:
|
|
523
|
-
to:
|
|
524
|
-
title: R && te()(
|
|
525
|
-
},
|
|
526
|
-
checked:
|
|
527
|
-
disabled: !!
|
|
519
|
+
"data-test-selected": X ? V : null,
|
|
520
|
+
disabled: u,
|
|
521
|
+
elementRef: v,
|
|
522
|
+
onClick: b,
|
|
523
|
+
onFocus: B,
|
|
524
|
+
onMouseDown: W,
|
|
525
|
+
openInNewContext: Z,
|
|
526
|
+
role: G,
|
|
527
|
+
tabIndex: L ? -1 : undefined,
|
|
528
|
+
to: H,
|
|
529
|
+
title: R && te()(o) ? o : undefined
|
|
530
|
+
}, J, i()(M, "onFocus")), p && n().createElement(j, null, n().createElement(ie(), null)), n().createElement(I, null, A && N === "checkbox" && n().createElement(x, {
|
|
531
|
+
checked: q === "some" ? "indeterminate" : q,
|
|
532
|
+
disabled: !!u,
|
|
528
533
|
inert: true
|
|
529
|
-
}),
|
|
530
|
-
$descriptionBottom: !!
|
|
534
|
+
}), $ && n().createElement(k, null, $), n().createElement(E, {
|
|
535
|
+
$descriptionBottom: !!U,
|
|
531
536
|
$truncate: R !== null && R !== void 0 ? R : false
|
|
532
537
|
}, n().createElement(_, {
|
|
533
538
|
$truncate: R !== null && R !== void 0 ? R : false,
|
|
534
539
|
"data-test": "label"
|
|
535
|
-
},
|
|
540
|
+
}, z, y && n().createElement(n().Fragment, null, n().createElement(pe, null), n().createElement(le(), null, ee))), U && n().createElement(h, {
|
|
536
541
|
"data-test": "description"
|
|
537
|
-
},
|
|
542
|
+
}, l), Q && n().createElement(S, {
|
|
538
543
|
"data-test": "description"
|
|
539
|
-
},
|
|
540
|
-
endAdornment:
|
|
541
|
-
},
|
|
544
|
+
}, l)), d && n().createElement(k, {
|
|
545
|
+
endAdornment: d
|
|
546
|
+
}, d), Y));
|
|
542
547
|
}
|
|
543
548
|
he.propTypes = ge;
|
|
544
549
|
he.as = "Item";
|
|
@@ -626,18 +631,18 @@
|
|
|
626
631
|
enableHomeEnd: true
|
|
627
632
|
};
|
|
628
633
|
};
|
|
629
|
-
var
|
|
634
|
+
var Te = function e(t) {
|
|
630
635
|
var r = t.key;
|
|
631
636
|
// Handle special case for tab navigation
|
|
632
|
-
if (r === "Tab" && (0, s.isTabKey)(t)) {
|
|
637
|
+
if (r === "Tab" && (0, s.isTabKey)(t.nativeEvent)) {
|
|
633
638
|
return t.shiftKey ? "tabShift" : "Tab";
|
|
634
639
|
}
|
|
635
640
|
return r;
|
|
636
641
|
};
|
|
637
|
-
function
|
|
642
|
+
function Ne(e) {
|
|
638
643
|
var t = e.children, a = e.elementRef, o = e.focusMode, l = o === void 0 ? "roving" : o, c = e.stopScrollPropagation, u = Pe(e, [ "children", "elementRef", "focusMode", "stopScrollPropagation" ]);
|
|
639
644
|
// @docs-props-type MenuPropsBase
|
|
640
|
-
var d = (0, r.useContext)(
|
|
645
|
+
var d = (0, r.useContext)(T), v = d.role, p = v === void 0 ? "menu" : v;
|
|
641
646
|
var f = (0, r.useRef)(null);
|
|
642
647
|
var m = r.Children.toArray(t).filter(r.isValidElement).reduce((function(e, t, r, n) {
|
|
643
648
|
/* Filter out initial Dividers
|
|
@@ -672,7 +677,7 @@
|
|
|
672
677
|
if (e.nativeEvent.metaKey) {
|
|
673
678
|
return;
|
|
674
679
|
}
|
|
675
|
-
var t =
|
|
680
|
+
var t = Te(e);
|
|
676
681
|
var r = t === "Tab" || t === "tabShift";
|
|
677
682
|
var n = t === "Enter";
|
|
678
683
|
// Allow default behavior for the enter key.
|
|
@@ -688,11 +693,9 @@
|
|
|
688
693
|
ignoreTabIndex: true
|
|
689
694
|
});
|
|
690
695
|
}
|
|
691
|
-
var o =
|
|
692
|
-
var l =
|
|
693
|
-
|
|
694
|
-
var u = c ? i.indexOf(c) : -1;
|
|
695
|
-
(0, s.handleFocus)(t, i, u, g);
|
|
696
|
+
var o = e.target instanceof HTMLElement ? e.target : a === null || a === void 0 ? void 0 : a.querySelector(":focus");
|
|
697
|
+
var l = o instanceof HTMLElement ? i.indexOf(o) : -1;
|
|
698
|
+
(0, s.handleFocus)(t, i, l, g);
|
|
696
699
|
}), [ g ]);
|
|
697
700
|
var h = function e() {
|
|
698
701
|
return {
|
|
@@ -711,15 +714,15 @@
|
|
|
711
714
|
stopScrollPropagation: true
|
|
712
715
|
}, i()(u, "tagName")), m) : n().createElement(Ce, _e({}, w, {
|
|
713
716
|
ref: b
|
|
714
|
-
}, u), n().createElement(
|
|
717
|
+
}, u), n().createElement(T.Provider, {
|
|
715
718
|
value: h()
|
|
716
719
|
}, m));
|
|
717
720
|
}
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
/* harmony default export */ const qe =
|
|
721
|
+
Ne.propTypes = Ae;
|
|
722
|
+
Ne.Item = Se;
|
|
723
|
+
Ne.Divider = H;
|
|
724
|
+
Ne.Heading = Z;
|
|
725
|
+
/* harmony default export */ const qe = Ne;
|
|
723
726
|
// CONCATENATED MODULE: ./src/Menu/index.ts
|
|
724
727
|
module.exports = t;
|
|
725
728
|
/******/})();
|