@splunk/react-ui 5.0.0-beta.4 → 5.0.0-beta.5
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/Button.js +3 -1
- package/CHANGELOG.md +4 -1
- package/CHANGELOG.v5.mdx +35 -0
- package/Card.js +163 -162
- package/Chip.js +171 -225
- package/Clickable.js +79 -76
- package/ComboBox.js +1 -1
- package/Date.js +160 -184
- package/DualListbox.js +439 -504
- package/File.js +449 -324
- package/FormRows.js +143 -142
- package/JSONTree.js +496 -521
- package/Layer.js +162 -97
- package/Link.js +20 -13
- package/MIGRATION.v5.mdx +47 -0
- package/Markdown.js +1 -1
- package/Message.js +119 -141
- package/MessageBar.js +109 -168
- package/Multiselect.js +595 -602
- package/Popover.js +194 -190
- package/Progress.js +68 -54
- package/RadioBar.js +4 -1
- package/RadioList.js +67 -65
- package/Resize.js +377 -265
- package/ResultsMenu.js +573 -661
- package/ScrollContainerContext.js +13 -9
- package/Search.js +1 -1
- package/Select.js +206 -199
- package/Slider.js +455 -329
- package/StepBar.js +2 -2
- package/Switch.js +88 -87
- package/TabBar.js +322 -317
- package/TabLayout.js +34 -34
- package/Table.js +548 -525
- package/Text.js +20 -19
- package/TextArea.js +278 -152
- package/Tooltip.js +173 -177
- package/Tree.js +2 -2
- package/Typography.js +30 -28
- package/WaitSpinner.js +6 -11
- package/cypress/support/commands.ts +14 -4
- package/cypress/support/index.d.ts +1 -1
- package/package.json +5 -5
- package/stubs-splunkui.d.ts +0 -4
- package/types/src/Card/Card.d.ts +3 -1
- package/types/src/Card/Header.d.ts +2 -0
- package/types/src/Card/docs/examples/HeadingTitle.d.ts +3 -0
- package/types/src/Clickable/Clickable.d.ts +11 -3
- package/types/src/Link/Link.d.ts +4 -0
- package/types/src/Message/Message.d.ts +1 -1
- package/types/src/MessageBar/MessageBar.d.ts +1 -1
- package/types/src/Multiselect/Multiselect.d.ts +1 -8
- package/types/src/Multiselect/Normal.d.ts +1 -7
- package/types/src/Multiselect/docs/examples/Children.d.ts +2 -9
- package/types/src/Multiselect/docs/examples/Controlled.d.ts +2 -9
- package/types/src/Multiselect/docs/examples/CustomizeSelected.d.ts +2 -9
- package/types/src/Multiselect/docs/examples/Disabled.d.ts +2 -9
- package/types/src/Multiselect/docs/examples/Error.d.ts +2 -9
- package/types/src/Multiselect/docs/examples/Fetching.d.ts +2 -22
- package/types/src/Multiselect/docs/examples/Headings.d.ts +2 -1
- package/types/src/Multiselect/docs/examples/LoadMoreOnScrollBottom.d.ts +2 -25
- package/types/src/Multiselect/docs/examples/NewValues.d.ts +2 -9
- package/types/src/Multiselect/docs/examples/TabInput.d.ts +2 -9
- package/types/src/ResultsMenu/ResultsMenu.d.ts +23 -34
- package/types/src/Select/SelectBase.d.ts +2 -2
- package/types/src/TabBar/TabBar.d.ts +8 -5
- package/types/src/TabBar/TabBarContext.d.ts +1 -1
- package/types/src/TabLayout/TabLayout.d.ts +8 -5
- package/types/src/Typography/Typography.d.ts +27 -22
- package/types/src/Date/Icon.d.ts +0 -3
- package/types/src/TabBar/docs/examples/IconsAbove.d.ts +0 -3
- package/types/src/TabBar/docs/examples/VerticalIconsAbove.d.ts +0 -3
- /package/types/src/TabBar/docs/examples/{IconsLeft.d.ts → Icons.d.ts} +0 -0
- /package/types/src/TabBar/docs/examples/{VerticalIconsLeft.d.ts → VerticalIcons.d.ts} +0 -0
package/Clickable.js
CHANGED
|
@@ -72,15 +72,15 @@
|
|
|
72
72
|
var t = e.n(r);
|
|
73
73
|
// CONCATENATED MODULE: external "prop-types"
|
|
74
74
|
const i = require("prop-types");
|
|
75
|
-
var
|
|
75
|
+
var a = e.n(i);
|
|
76
76
|
// CONCATENATED MODULE: external "lodash/has"
|
|
77
|
-
const
|
|
77
|
+
const o = require("lodash/has");
|
|
78
78
|
// CONCATENATED MODULE: external "lodash/isString"
|
|
79
79
|
const l = require("lodash/isString");
|
|
80
80
|
var u = e.n(l);
|
|
81
81
|
// CONCATENATED MODULE: external "lodash/omit"
|
|
82
|
-
const
|
|
83
|
-
var
|
|
82
|
+
const d = require("lodash/omit");
|
|
83
|
+
var c = e.n(d);
|
|
84
84
|
// CONCATENATED MODULE: external "styled-components"
|
|
85
85
|
const s = require("styled-components");
|
|
86
86
|
var f = e.n(s);
|
|
@@ -94,25 +94,25 @@
|
|
|
94
94
|
// CONCATENATED MODULE: ./src/Clickable/NavigationProvider.tsx
|
|
95
95
|
/** @public */
|
|
96
96
|
var p = {
|
|
97
|
-
children:
|
|
98
|
-
onClick:
|
|
99
|
-
onLinkClick:
|
|
100
|
-
transformUrl:
|
|
97
|
+
children: a().node,
|
|
98
|
+
onClick: a().func,
|
|
99
|
+
onLinkClick: a().func,
|
|
100
|
+
transformUrl: a().func
|
|
101
101
|
};
|
|
102
102
|
var m = t().createContext({});
|
|
103
103
|
/**
|
|
104
104
|
* Used to provide an override for the `onClick` for links for single page applications so that
|
|
105
105
|
* internal links can navigate without a page reload.
|
|
106
106
|
*/ function y(e) {
|
|
107
|
-
var n = e.children, i = e.onClick,
|
|
107
|
+
var n = e.children, i = e.onClick, a = e.onLinkClick, o = e.transformUrl;
|
|
108
108
|
// @docs-props-type NavigationProviderProps
|
|
109
109
|
var l = (0, r.useMemo)((function() {
|
|
110
110
|
return {
|
|
111
111
|
onClick: i,
|
|
112
|
-
onLinkClick:
|
|
113
|
-
transformUrl:
|
|
112
|
+
onLinkClick: a,
|
|
113
|
+
transformUrl: o
|
|
114
114
|
};
|
|
115
|
-
}), [ i,
|
|
115
|
+
}), [ i, a, o ]);
|
|
116
116
|
|
|
117
117
|
return t().createElement(m.Provider, {
|
|
118
118
|
value: l
|
|
@@ -152,16 +152,16 @@
|
|
|
152
152
|
}
|
|
153
153
|
function g(e, n) {
|
|
154
154
|
if (null == e) return {};
|
|
155
|
-
var r, t, i =
|
|
155
|
+
var r, t, i = O(e, n);
|
|
156
156
|
if (Object.getOwnPropertySymbols) {
|
|
157
|
-
var
|
|
158
|
-
for (t = 0; t <
|
|
159
|
-
r =
|
|
157
|
+
var a = Object.getOwnPropertySymbols(e);
|
|
158
|
+
for (t = 0; t < a.length; t++) {
|
|
159
|
+
r = a[t], n.includes(r) || {}.propertyIsEnumerable.call(e, r) && (i[r] = e[r]);
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
return i;
|
|
163
163
|
}
|
|
164
|
-
function
|
|
164
|
+
function O(e, n) {
|
|
165
165
|
if (null == e) return {};
|
|
166
166
|
var r = {};
|
|
167
167
|
for (var t in e) {
|
|
@@ -172,127 +172,130 @@
|
|
|
172
172
|
}
|
|
173
173
|
return r;
|
|
174
174
|
}
|
|
175
|
-
var
|
|
175
|
+
var h = /^[a-z0-9]+:/;
|
|
176
176
|
var w = /^\/\//;
|
|
177
177
|
var P = /^\//;
|
|
178
178
|
var S = function e(n) {
|
|
179
179
|
return n != null && P.test(n);
|
|
180
180
|
};
|
|
181
181
|
var j = function e(n) {
|
|
182
|
-
return n != null && !
|
|
182
|
+
return n != null && !h.test(n) && !w.test(n);
|
|
183
183
|
};
|
|
184
184
|
var x = {
|
|
185
|
-
children:
|
|
186
|
-
disabled:
|
|
187
|
-
elementRef:
|
|
188
|
-
onClick:
|
|
189
|
-
openInNewContext:
|
|
190
|
-
navigationLabel:
|
|
191
|
-
to:
|
|
185
|
+
children: a().node,
|
|
186
|
+
disabled: a().oneOfType([ a().bool, a().oneOf([ "dimmed", "disabled" ]) ]),
|
|
187
|
+
elementRef: a().oneOfType([ a().func, a().object ]),
|
|
188
|
+
onClick: a().func,
|
|
189
|
+
openInNewContext: a().bool,
|
|
190
|
+
navigationLabel: a().string,
|
|
191
|
+
to: a().oneOfType([ a().string, a().oneOf([ undefined ]) ])
|
|
192
192
|
};
|
|
193
|
-
function L(e
|
|
194
|
-
return
|
|
193
|
+
function L(e) {
|
|
194
|
+
return e !== undefined;
|
|
195
195
|
}
|
|
196
196
|
/**
|
|
197
197
|
* `Clickable` renders as a `button` element, or as an `a` element if the `to` prop is set
|
|
198
198
|
* and the `disabled` prop is `false`. This is called link mode.
|
|
199
|
-
*/ var I = t().forwardRef((function(e,
|
|
200
|
-
|
|
199
|
+
*/ var I = t().forwardRef((function(e,
|
|
200
|
+
// SUI-7623 - needs to be specified for react-docgen versions less than 7.1.0
|
|
201
|
+
n) {
|
|
202
|
+
var i = e.children, a = e.disabled, o = e.elementRef, l = e.navigationLabel, d = e.onClick, s = e.openInNewContext, f = e.tag, v = e.to, p = g(e, [ "children", "disabled", "elementRef", "navigationLabel", "onClick", "openInNewContext", "tag", "to" ]);
|
|
201
203
|
// @docs-props-type ClickablePropsBase
|
|
202
|
-
var
|
|
204
|
+
var y = (0, r.useContext)(m), O = y.onClick, h = y.onLinkClick, w = y.transformUrl;
|
|
203
205
|
(0, r.useEffect)((function() {
|
|
204
206
|
if (false) {}
|
|
205
207
|
// this effect only runs once
|
|
206
208
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
207
209
|
}), []);
|
|
208
|
-
var
|
|
209
|
-
k(
|
|
210
|
+
var P = (0, r.useCallback)((function(e) {
|
|
211
|
+
k(o, e);
|
|
210
212
|
k(n, e);
|
|
211
|
-
}), [
|
|
213
|
+
}), [ o, n ]);
|
|
212
214
|
// memoizing this result causes TS to lose track of the type guard established by isLinkCheck
|
|
213
|
-
var
|
|
215
|
+
var x = L(v);
|
|
214
216
|
// ideally we wouldn't need to pass "to" as "toValue" here
|
|
215
217
|
// but without doing that TS thinks the return value of this is
|
|
216
218
|
// string | undefined which doesn't work for usages of this function
|
|
217
|
-
var
|
|
218
|
-
return
|
|
219
|
+
var I = (0, r.useCallback)((function(e) {
|
|
220
|
+
return w != null ? w(e, {
|
|
219
221
|
isInternal: j(e),
|
|
220
222
|
isRootRelative: S(e)
|
|
221
223
|
}) : e;
|
|
222
|
-
}), [
|
|
223
|
-
var
|
|
224
|
-
if (
|
|
224
|
+
}), [ w ]);
|
|
225
|
+
var R = (0, r.useCallback)((function(e) {
|
|
226
|
+
if (x) {
|
|
225
227
|
// when user command-click on mac or ctrl-click on other platforms, and
|
|
226
228
|
// Tag is an <a>, let the click pass through, let the <a> to achieve user's
|
|
227
229
|
// intent of 'open in new context'
|
|
228
230
|
// on mac, ctrl-click will be caught and open option menu even before hitting
|
|
229
231
|
// the DOM, so we're safe to check both metaKey and ctrlKey here
|
|
230
232
|
// without platform sniffing
|
|
231
|
-
if ((e.metaKey || e.ctrlKey) &&
|
|
233
|
+
if ((e.metaKey || e.ctrlKey) && v) {
|
|
232
234
|
return;
|
|
233
235
|
}
|
|
234
236
|
}
|
|
235
|
-
|
|
236
|
-
var n =
|
|
237
|
-
if (
|
|
237
|
+
d === null || d === void 0 ? void 0 : d(e);
|
|
238
|
+
var n = d == null && O != null;
|
|
239
|
+
if (x && (n || h != null)) {
|
|
238
240
|
var r = l;
|
|
239
241
|
if (!r && u()(i)) {
|
|
240
242
|
r = i;
|
|
241
243
|
}
|
|
242
244
|
var t = {
|
|
243
|
-
to:
|
|
244
|
-
originalTo:
|
|
245
|
+
to: I(v),
|
|
246
|
+
originalTo: v,
|
|
245
247
|
openInNewContext: s,
|
|
246
248
|
label: r
|
|
247
249
|
};
|
|
248
250
|
if (n) {
|
|
249
|
-
|
|
251
|
+
O(e, t);
|
|
250
252
|
}
|
|
251
253
|
h === null || h === void 0 ? void 0 : h(e, t);
|
|
252
254
|
}
|
|
253
|
-
}), [ i,
|
|
254
|
-
// Only set the href attribute when enabled
|
|
255
|
-
if (
|
|
256
|
-
|
|
257
|
-
|
|
255
|
+
}), [ i, I, x, l, d, O, h, s, v ]);
|
|
256
|
+
// Only set the href attribute when enabled and therefore using an <a> tag
|
|
257
|
+
if (x && f !== "button") {
|
|
258
|
+
if (a) {
|
|
259
|
+
|
|
260
|
+
return t().createElement(b, C({
|
|
261
|
+
"data-test": "clickable",
|
|
262
|
+
"data-test-disabled": a,
|
|
263
|
+
ref: P,
|
|
264
|
+
role: "link",
|
|
265
|
+
"aria-disabled": "true"
|
|
266
|
+
}, p), i);
|
|
267
|
+
}
|
|
268
|
+
var T = s ? "_blank" : undefined;
|
|
269
|
+
var q = s && j(v) ? "noopener noreferrer" : undefined;
|
|
258
270
|
|
|
259
271
|
return t().createElement(b, C({
|
|
260
272
|
"data-test": "clickable",
|
|
261
|
-
ref:
|
|
262
|
-
href:
|
|
263
|
-
target:
|
|
273
|
+
ref: P,
|
|
274
|
+
href: I(v),
|
|
275
|
+
target: T,
|
|
264
276
|
rel: q,
|
|
265
|
-
onClick:
|
|
266
|
-
},
|
|
267
|
-
}
|
|
268
|
-
if (o && f != null) {
|
|
269
|
-
|
|
270
|
-
return t().createElement(b, C({
|
|
271
|
-
"data-test": "clickable",
|
|
272
|
-
ref: w,
|
|
273
|
-
role: "link",
|
|
274
|
-
"aria-disabled": "true"
|
|
275
|
-
}, v), i);
|
|
277
|
+
onClick: R
|
|
278
|
+
}, c()(p)), i);
|
|
276
279
|
}
|
|
277
280
|
// button variant
|
|
278
|
-
var N =
|
|
279
|
-
var
|
|
281
|
+
var N = a === true || a === "dimmed" || undefined;
|
|
282
|
+
var _;
|
|
280
283
|
if (N) {
|
|
281
|
-
|
|
282
|
-
} else if (
|
|
283
|
-
|
|
284
|
+
_ = "dimmed";
|
|
285
|
+
} else if (a === "disabled") {
|
|
286
|
+
_ = "disabled";
|
|
284
287
|
}
|
|
285
288
|
|
|
286
289
|
return t().createElement(b, C({
|
|
287
290
|
as: "button",
|
|
288
291
|
"aria-disabled": N,
|
|
289
292
|
"data-test": "clickable",
|
|
290
|
-
"data-test-disabled":
|
|
291
|
-
ref:
|
|
293
|
+
"data-test-disabled": _,
|
|
294
|
+
ref: P,
|
|
292
295
|
type: "button",
|
|
293
|
-
disabled:
|
|
294
|
-
onClick:
|
|
295
|
-
},
|
|
296
|
+
disabled: a === "disabled",
|
|
297
|
+
onClick: d && !a ? R : undefined
|
|
298
|
+
}, c()(p, "disabled")), i);
|
|
296
299
|
}));
|
|
297
300
|
I.propTypes = x;
|
|
298
301
|
/* harmony default export */ const R = I;
|