@splunk/react-ui 5.2.0 → 5.3.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/Avatar.js +57 -52
- package/Box.js +2 -1
- package/CHANGELOG.md +31 -0
- package/Calendar.js +8 -4
- package/Checkbox.d.ts +2 -0
- package/Checkbox.js +350 -0
- package/Code.js +151 -132
- package/CollapsiblePanel.js +184 -210
- package/Color.js +4 -2
- package/ControlGroup.js +2 -1
- package/Date.js +123 -119
- package/DefinitionList.js +100 -77
- package/Dropdown.js +2 -2
- package/DualListbox.js +409 -353
- package/File.js +102 -99
- package/JSONTree.js +317 -303
- package/Link.js +11 -11
- package/MIGRATION.md +27 -0
- package/Markdown.js +162 -151
- package/Menu.js +44 -42
- package/Modal.js +3 -3
- package/Multiselect.js +454 -435
- package/Paginator.js +2 -1
- package/ResultsMenu.js +2 -1
- package/Scroll.js +2 -1
- package/Search.js +131 -127
- package/Select.js +3 -2
- package/Switch.js +197 -229
- package/Table.js +24 -16
- package/Text.js +180 -206
- package/TextArea.js +233 -224
- package/Tooltip.js +144 -139
- package/package.json +9 -10
- package/tsconfig.check-docs.json +8 -0
- package/types/src/Avatar/docs/examples/Basic.d.ts +1 -1
- package/types/src/Checkbox/Checkbox.d.ts +90 -0
- package/types/src/Checkbox/docs/examples/Basic.d.ts +7 -0
- package/types/src/Checkbox/docs/examples/Disabled.d.ts +6 -0
- package/types/src/Checkbox/docs/examples/Error.d.ts +6 -0
- package/types/src/Checkbox/docs/examples/Uncontrolled.d.ts +7 -0
- package/types/src/Checkbox/index.d.ts +2 -0
- package/types/src/Code/Code.d.ts +4 -1
- package/types/src/Code/LineHighlights.d.ts +1 -0
- package/types/src/Code/LineNumbers.d.ts +2 -1
- package/types/src/Code/docs/examples/CustomizeContainer.d.ts +7 -0
- package/types/src/ControlGroup/docs/examples/CustomizedLabelTarget.d.ts +3 -3
- package/types/src/Date/Date.d.ts +7 -1
- package/types/src/DefinitionList/DefinitionList.d.ts +7 -2
- package/types/src/DefinitionList/DefinitionListContext.d.ts +1 -1
- package/types/src/DefinitionList/docs/examples/StackedLayout.d.ts +6 -0
- package/types/src/DualListbox/DualListbox.d.ts +1 -1
- package/types/src/DualListbox/Label.d.ts +7 -7
- package/types/src/DualListbox/Listbox.d.ts +2 -2
- package/types/src/DualListbox/ListboxContext.d.ts +1 -1
- package/types/src/File/File.d.ts +7 -1
- package/types/src/JSONTree/JSONTreeItem.d.ts +4 -2
- package/types/src/JSONTree/renderTreeItems.d.ts +2 -1
- package/types/src/Markdown/renderers/MarkdownCodeBlock.d.ts +2 -1
- package/types/src/Menu/docs/examples/Dimmed.d.ts +1 -1
- package/types/src/Menu/docs/examples/Disabled.d.ts +1 -0
- package/types/src/Multiselect/Compact.d.ts +7 -1
- package/types/src/Multiselect/Multiselect.d.ts +7 -1
- package/types/src/Multiselect/Normal.d.ts +7 -1
- package/types/src/Search/Search.d.ts +5 -1
- package/types/src/Switch/Switch.d.ts +7 -1
- package/types/src/Switch/docs/examples/Basic.d.ts +2 -10
- package/types/src/Switch/docs/examples/Disabled.d.ts +2 -9
- package/types/src/Table/ExpandButton.d.ts +1 -1
- package/types/src/Tooltip/Tooltip.d.ts +14 -1
- package/NonInteractiveCheckbox.js +0 -101
- package/types/src/CollapsiblePanel/icons/ExpandPanel.d.ts +0 -12
- package/types/src/NonInteractiveCheckbox/NonInteractiveCheckbox.d.ts +0 -22
- package/types/src/NonInteractiveCheckbox/index.d.ts +0 -1
- package/types/src/Switch/docs/examples/Error.d.ts +0 -6
- package/types/src/Text/IconOutlinedHide.d.ts +0 -3
- package/types/src/Text/IconOutlinedView.d.ts +0 -3
- /package/cypress/{tsconfig.cypress.json → tsconfig.check-cypress.json} +0 -0
package/Tooltip.js
CHANGED
|
@@ -294,6 +294,10 @@
|
|
|
294
294
|
onRequestOpen: i().func,
|
|
295
295
|
open: i().bool,
|
|
296
296
|
openDelay: i().oneOfType([ i().oneOf([ "primary", "secondary" ]), i().number ]),
|
|
297
|
+
pointTo: i().shape({
|
|
298
|
+
x: i().number,
|
|
299
|
+
y: i().number
|
|
300
|
+
}),
|
|
297
301
|
/** @private */
|
|
298
302
|
prepend: i().bool,
|
|
299
303
|
renderAnchor: i().func
|
|
@@ -307,20 +311,20 @@
|
|
|
307
311
|
* The Tooltip component wraps arbitrary content to be displayed when the target element is hovered
|
|
308
312
|
* or focused.
|
|
309
313
|
*/ function X(e) {
|
|
310
|
-
var n = e.appearance, o = e.append, l = e.children, i = e.closeDelay, u = i === void 0 ? 300 : i, s = e.closeWhen, c = s === void 0 ? "default" : s, p = e.content, d = e.contentRelationship, g = e.defaultPlacement, O = g === void 0 ? "above" : g, h = e.elementRef, S = e.inline, C = S === void 0 ? true : S, L = e.onRequestClose, I = e.onRequestOpen, _ = e.open, D = e.openDelay, M = D === void 0 ? "primary" : D, x = e.renderAnchor, B = e.
|
|
314
|
+
var n = e.appearance, o = e.append, l = e.children, i = e.closeDelay, u = i === void 0 ? 300 : i, s = e.closeWhen, c = s === void 0 ? "default" : s, p = e.content, d = e.contentRelationship, g = e.defaultPlacement, O = g === void 0 ? "above" : g, h = e.elementRef, S = e.inline, C = S === void 0 ? true : S, L = e.onRequestClose, I = e.onRequestOpen, _ = e.open, D = e.openDelay, M = D === void 0 ? "primary" : D, x = e.renderAnchor, B = e.pointTo, H = e.prepend, F = W(e, [ "appearance", "append", "children", "closeDelay", "closeWhen", "content", "contentRelationship", "defaultPlacement", "elementRef", "inline", "onRequestClose", "onRequestOpen", "open", "openDelay", "renderAnchor", "pointTo", "prepend" ]);
|
|
311
315
|
// @docs-props-type TooltipPropsBase
|
|
312
|
-
var
|
|
313
|
-
var
|
|
314
|
-
var
|
|
315
|
-
var
|
|
316
|
-
var
|
|
317
|
-
var
|
|
316
|
+
var K = (0, r.useState)(false), V = N(K, 2), U = V[0], $ = V[1];
|
|
317
|
+
var z = (0, r.useState)(null), X = N(z, 2), Y = X[0], Z = X[1];
|
|
318
|
+
var ee = (0, r.useState)(null), ne = N(ee, 2), re = ne[0], te = ne[1];
|
|
319
|
+
var oe = (0, r.useState)(null), ae = N(oe, 2), le = ae[0], ie = ae[1];
|
|
320
|
+
var ue = (0, r.useState)(null), se = N(ue, 2), ce = se[0], fe = se[1];
|
|
321
|
+
var pe = (0, r.useState)((function() {
|
|
318
322
|
return {
|
|
319
323
|
ariaId: (0, y.createDOMID)("aria-id"),
|
|
320
324
|
popoverId: (0, y.createDOMID)("popover")
|
|
321
325
|
};
|
|
322
|
-
})),
|
|
323
|
-
var
|
|
326
|
+
})), ve = N(pe, 1), de = ve[0], me = de.ariaId, be = de.popoverId;
|
|
327
|
+
var ye = m()({
|
|
324
328
|
componentName: "Tooltip",
|
|
325
329
|
/* eslint-disable-next-line prefer-rest-params */
|
|
326
330
|
componentProps: arguments[0],
|
|
@@ -328,189 +332,189 @@
|
|
|
328
332
|
defaultValuePropName: "defaultOpen",
|
|
329
333
|
valuePropName: "open"
|
|
330
334
|
});
|
|
331
|
-
var
|
|
335
|
+
var ge = (0, r.useMemo)((function() {
|
|
332
336
|
var e = !!p;
|
|
333
|
-
return !!
|
|
334
|
-
}), [
|
|
335
|
-
var
|
|
337
|
+
return !!Y && ye ? _ : e && U;
|
|
338
|
+
}), [ Y, p, ye, U, _ ]);
|
|
339
|
+
var Oe = (0, r.useRef)();
|
|
336
340
|
(0, r.useEffect)((function() {
|
|
337
341
|
return function() {
|
|
338
|
-
if (
|
|
339
|
-
clearTimeout(
|
|
342
|
+
if (Oe.current !== undefined) {
|
|
343
|
+
clearTimeout(Oe.current);
|
|
340
344
|
}
|
|
341
345
|
};
|
|
342
346
|
}), []);
|
|
343
|
-
var
|
|
344
|
-
if (
|
|
345
|
-
clearTimeout(
|
|
347
|
+
var he = (0, r.useCallback)((function(e, n) {
|
|
348
|
+
if (Oe.current !== undefined) {
|
|
349
|
+
clearTimeout(Oe.current);
|
|
346
350
|
}
|
|
347
|
-
|
|
348
|
-
if (!
|
|
349
|
-
|
|
351
|
+
Oe.current = setTimeout((function() {
|
|
352
|
+
if (!ye) {
|
|
353
|
+
$(false);
|
|
350
354
|
}
|
|
351
355
|
L === null || L === void 0 ? void 0 : L(e, n);
|
|
352
356
|
}), u);
|
|
353
|
-
}), [ u,
|
|
354
|
-
var
|
|
357
|
+
}), [ u, ye, L ]);
|
|
358
|
+
var Se = (0, r.useCallback)((function(e, n) {
|
|
355
359
|
var r = M === "primary" ? 300 : 750;
|
|
356
360
|
var t = typeof M === "number" ? M : r;
|
|
357
|
-
if (
|
|
358
|
-
clearTimeout(
|
|
361
|
+
if (Oe.current !== undefined) {
|
|
362
|
+
clearTimeout(Oe.current);
|
|
359
363
|
}
|
|
360
|
-
|
|
361
|
-
var r =
|
|
362
|
-
if (!
|
|
363
|
-
|
|
364
|
+
Oe.current = setTimeout((function() {
|
|
365
|
+
var r = ge;
|
|
366
|
+
if (!ye) {
|
|
367
|
+
$(true);
|
|
364
368
|
}
|
|
365
369
|
if (!r) {
|
|
366
370
|
I === null || I === void 0 ? void 0 : I(e, n);
|
|
367
371
|
}
|
|
368
372
|
}), t);
|
|
369
|
-
}), [
|
|
370
|
-
var
|
|
371
|
-
|
|
373
|
+
}), [ ye, ge, I, M ]);
|
|
374
|
+
var Ce = (0, r.useCallback)((function(e) {
|
|
375
|
+
Se(e, {
|
|
372
376
|
reason: "mouseEnterToggle"
|
|
373
377
|
});
|
|
374
|
-
}), [
|
|
375
|
-
var
|
|
376
|
-
|
|
378
|
+
}), [ Se ]);
|
|
379
|
+
var ke = (0, r.useCallback)((function(e) {
|
|
380
|
+
Se(e, {
|
|
377
381
|
reason: "mouseEnterPopover"
|
|
378
382
|
});
|
|
379
|
-
}), [
|
|
380
|
-
var
|
|
381
|
-
|
|
383
|
+
}), [ Se ]);
|
|
384
|
+
var Ee = (0, r.useCallback)((function(e) {
|
|
385
|
+
Se(e, {
|
|
382
386
|
reason: "mouseEnterHitArea"
|
|
383
387
|
});
|
|
384
|
-
}), [
|
|
385
|
-
var
|
|
388
|
+
}), [ Se ]);
|
|
389
|
+
var Te = (0, r.useCallback)((function(e) {
|
|
386
390
|
var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "mouseLeaveToggle";
|
|
387
|
-
if (e.relatedTarget == null || e.relatedTarget !==
|
|
388
|
-
|
|
391
|
+
if (e.relatedTarget == null || e.relatedTarget !== le && e.relatedTarget !== ce) {
|
|
392
|
+
he(e, {
|
|
389
393
|
reason: n
|
|
390
394
|
});
|
|
391
395
|
}
|
|
392
|
-
}), [
|
|
393
|
-
var Te = (0, r.useCallback)((function(e) {
|
|
394
|
-
Ee(e, "mouseLeavePopover");
|
|
395
|
-
}), [ Ee ]);
|
|
396
|
+
}), [ he, le, ce ]);
|
|
396
397
|
var Pe = (0, r.useCallback)((function(e) {
|
|
397
|
-
|
|
398
|
-
}), [
|
|
398
|
+
Te(e, "mouseLeavePopover");
|
|
399
|
+
}), [ Te ]);
|
|
399
400
|
var je = (0, r.useCallback)((function(e) {
|
|
400
|
-
|
|
401
|
+
Te(e, "mouseLeaveHitArea");
|
|
402
|
+
}), [ Te ]);
|
|
403
|
+
var we = (0, r.useCallback)((function(e) {
|
|
404
|
+
he(e, {
|
|
401
405
|
reason: "mouseStopHitArea"
|
|
402
406
|
});
|
|
403
|
-
}), [
|
|
404
|
-
var
|
|
405
|
-
var
|
|
407
|
+
}), [ he ]);
|
|
408
|
+
var Re = a()(we, 10);
|
|
409
|
+
var Le = (0, r.useCallback)((function(e) {
|
|
406
410
|
// Handle mouse events with native events due to current issues with how they
|
|
407
411
|
// are handled by react. See https://github.com/facebook/react/issues/4251,
|
|
408
412
|
// https://github.com/facebook/react/issues/19419, and SUI-1232.
|
|
409
|
-
if (e) {
|
|
410
|
-
e.addEventListener("mouseenter", Se);
|
|
411
|
-
e.addEventListener("mouseleave", Ee);
|
|
412
|
-
} else if (X) {
|
|
413
|
-
X.removeEventListener("mouseenter", Se);
|
|
414
|
-
X.removeEventListener("mouseleave", Ee);
|
|
415
|
-
}
|
|
416
|
-
Y(e);
|
|
417
|
-
}), [ X, Se, Ee ]);
|
|
418
|
-
var Le = (0, r.useCallback)((function(e) {
|
|
419
413
|
if (e) {
|
|
420
414
|
e.addEventListener("mouseenter", Ce);
|
|
421
415
|
e.addEventListener("mouseleave", Te);
|
|
422
|
-
} else if (
|
|
423
|
-
|
|
424
|
-
|
|
416
|
+
} else if (Y) {
|
|
417
|
+
Y.removeEventListener("mouseenter", Ce);
|
|
418
|
+
Y.removeEventListener("mouseleave", Te);
|
|
425
419
|
}
|
|
426
|
-
|
|
427
|
-
}), [ Ce, Te
|
|
420
|
+
Z(e);
|
|
421
|
+
}), [ Y, Ce, Te ]);
|
|
428
422
|
var qe = (0, r.useCallback)((function(e) {
|
|
429
|
-
|
|
430
|
-
|
|
423
|
+
if (e) {
|
|
424
|
+
e.addEventListener("mouseenter", ke);
|
|
425
|
+
e.addEventListener("mouseleave", Pe);
|
|
426
|
+
} else if (le) {
|
|
427
|
+
le.removeEventListener("mouseenter", ke);
|
|
428
|
+
le.removeEventListener("mouseleave", Pe);
|
|
429
|
+
}
|
|
430
|
+
ie(e);
|
|
431
|
+
}), [ ke, Pe, le ]);
|
|
431
432
|
var Ie = (0, r.useCallback)((function(e) {
|
|
433
|
+
fe(e);
|
|
434
|
+
}), []);
|
|
435
|
+
var Ae = (0, r.useCallback)((function(e) {
|
|
432
436
|
// Handle mouse events with native events due to current issues with how they
|
|
433
437
|
// are handled by react. See https://github.com/facebook/react/issues/4251,
|
|
434
438
|
// https://github.com/facebook/react/issues/19419, and SUI-1232.
|
|
435
439
|
if (e) {
|
|
436
|
-
e.addEventListener("mouseenter",
|
|
437
|
-
e.addEventListener("mousemove",
|
|
438
|
-
e.addEventListener("mouseleave",
|
|
439
|
-
} else if (
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
440
|
+
e.addEventListener("mouseenter", Ee);
|
|
441
|
+
e.addEventListener("mousemove", Re);
|
|
442
|
+
e.addEventListener("mouseleave", je);
|
|
443
|
+
} else if (re) {
|
|
444
|
+
re.removeEventListener("mouseenter", Ee);
|
|
445
|
+
re.removeEventListener("mousemove", Re);
|
|
446
|
+
re.removeEventListener("mouseleave", je);
|
|
443
447
|
}
|
|
444
|
-
|
|
445
|
-
}), [
|
|
446
|
-
var
|
|
448
|
+
te(e);
|
|
449
|
+
}), [ Ee, je, Re, re ]);
|
|
450
|
+
var _e = (0, r.useCallback)((function(e) {
|
|
447
451
|
if (c !== "notOnClick") {
|
|
448
|
-
|
|
452
|
+
he(e, {
|
|
449
453
|
reason: "toggleClick"
|
|
450
454
|
});
|
|
451
455
|
}
|
|
452
|
-
}), [ c,
|
|
453
|
-
var
|
|
454
|
-
|
|
456
|
+
}), [ c, he ]);
|
|
457
|
+
var De = (0, r.useCallback)((function(e) {
|
|
458
|
+
Se(e, {
|
|
455
459
|
reason: "focusToggle"
|
|
456
460
|
});
|
|
457
|
-
}), [
|
|
458
|
-
var
|
|
459
|
-
|
|
461
|
+
}), [ Se ]);
|
|
462
|
+
var Me = (0, r.useCallback)((function(e) {
|
|
463
|
+
he(e, {
|
|
460
464
|
reason: "blurToggle"
|
|
461
465
|
});
|
|
462
|
-
}), [
|
|
463
|
-
var Me = (0, r.useCallback)((function(e) {
|
|
464
|
-
Oe(null, e);
|
|
465
|
-
}), [ Oe ]);
|
|
466
|
+
}), [ he ]);
|
|
466
467
|
var Ne = (0, r.useCallback)((function(e) {
|
|
467
|
-
|
|
468
|
+
he(null, e);
|
|
469
|
+
}), [ he ]);
|
|
470
|
+
var xe = (0, r.useCallback)((function(e) {
|
|
471
|
+
Le(e);
|
|
468
472
|
R(h, e);
|
|
469
|
-
}), [ h,
|
|
470
|
-
var
|
|
473
|
+
}), [ h, Le ]);
|
|
474
|
+
var Be = (0, r.useMemo)((function() {
|
|
471
475
|
return {
|
|
472
476
|
"data-test": "toggle",
|
|
473
|
-
elementRef:
|
|
474
|
-
onBlur:
|
|
475
|
-
onClick:
|
|
476
|
-
onFocus:
|
|
477
|
+
elementRef: xe,
|
|
478
|
+
onBlur: Me,
|
|
479
|
+
onClick: _e,
|
|
480
|
+
onFocus: De
|
|
477
481
|
};
|
|
478
|
-
}), [
|
|
479
|
-
var
|
|
482
|
+
}), [ Me, _e, De, xe ]);
|
|
483
|
+
var He = (0, r.useMemo)((function() {
|
|
480
484
|
return d === "label" ? {
|
|
481
|
-
"aria-labelledby":
|
|
482
|
-
labelledBy:
|
|
485
|
+
"aria-labelledby": me,
|
|
486
|
+
labelledBy: me
|
|
483
487
|
} : {
|
|
484
|
-
"aria-describedby":
|
|
485
|
-
describedBy:
|
|
488
|
+
"aria-describedby": me,
|
|
489
|
+
describedBy: me
|
|
486
490
|
};
|
|
487
|
-
}), [ d,
|
|
488
|
-
var
|
|
491
|
+
}), [ d, me ]);
|
|
492
|
+
var Fe = (0, r.useMemo)((function() {
|
|
489
493
|
return {
|
|
490
494
|
append: o,
|
|
491
|
-
prepend:
|
|
495
|
+
prepend: H
|
|
492
496
|
};
|
|
493
|
-
}), [ o,
|
|
494
|
-
var Fe = (0, r.useMemo)((function() {
|
|
495
|
-
return A(A(A({}, Be), xe), He);
|
|
496
|
-
}), [ Be, xe, He ]);
|
|
497
|
+
}), [ o, H ]);
|
|
497
498
|
var Ke = (0, r.useMemo)((function() {
|
|
498
|
-
return A(A({}, Be),
|
|
499
|
-
}), [ Be,
|
|
500
|
-
var We = (0, r.
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
}), [ Be, Fe, l, He, x ]);
|
|
499
|
+
return A(A(A({}, He), Be), Fe);
|
|
500
|
+
}), [ He, Be, Fe ]);
|
|
501
|
+
var We = (0, r.useMemo)((function() {
|
|
502
|
+
return A(A({}, He), Fe);
|
|
503
|
+
}), [ He, Fe ]);
|
|
504
504
|
var Ve = (0, r.useCallback)((function() {
|
|
505
|
+
if (false) {}
|
|
506
|
+
return x === null || x === void 0 ? void 0 : x(A(A(A({}, Ke), He), Fe));
|
|
507
|
+
}), [ He, Ke, l, Fe, x ]);
|
|
508
|
+
var Ue = (0, r.useCallback)((function() {
|
|
505
509
|
var e;
|
|
506
510
|
if ( (0, r.isValidElement)(l)) {
|
|
507
|
-
e = (0, r.cloneElement)(l,
|
|
511
|
+
e = (0, r.cloneElement)(l, We);
|
|
508
512
|
} else if (l) {
|
|
509
513
|
e = l;
|
|
510
514
|
} else {
|
|
511
515
|
e = t().createElement(w, {
|
|
512
516
|
appearance: "subtle",
|
|
513
|
-
"aria-describedby":
|
|
517
|
+
"aria-describedby": me,
|
|
514
518
|
"aria-label": (0, b._)("More info"),
|
|
515
519
|
icon: Q
|
|
516
520
|
});
|
|
@@ -519,43 +523,44 @@
|
|
|
519
523
|
|
|
520
524
|
return t().createElement(n, {
|
|
521
525
|
"data-test": "toggle",
|
|
522
|
-
onClick:
|
|
523
|
-
onFocus:
|
|
524
|
-
onBlur:
|
|
525
|
-
ref:
|
|
526
|
+
onClick: _e,
|
|
527
|
+
onFocus: De,
|
|
528
|
+
onBlur: Me,
|
|
529
|
+
ref: Le
|
|
526
530
|
}, e);
|
|
527
|
-
}), [ l, C,
|
|
528
|
-
var
|
|
529
|
-
var
|
|
531
|
+
}), [ l, C, _e, De, Me, Le, We, me ]);
|
|
532
|
+
var $e = C ? E : k;
|
|
533
|
+
var ze = !!p && t().createElement(v(), {
|
|
530
534
|
"aria-hidden": "true",
|
|
531
|
-
id:
|
|
535
|
+
id: me
|
|
532
536
|
}, p);
|
|
533
|
-
var
|
|
537
|
+
var Ge = t().createElement(f(), {
|
|
534
538
|
role: "tooltip",
|
|
535
539
|
align: "center",
|
|
536
|
-
anchor:
|
|
540
|
+
anchor: Y,
|
|
537
541
|
animationConfig: G,
|
|
538
542
|
appearance: n,
|
|
539
543
|
closeReasons: J,
|
|
540
544
|
defaultPlacement: O,
|
|
541
|
-
id:
|
|
542
|
-
open:
|
|
543
|
-
onRequestClose:
|
|
544
|
-
elementRef:
|
|
545
|
-
hitAreaRef:
|
|
546
|
-
outerRef:
|
|
545
|
+
id: be,
|
|
546
|
+
open: ge,
|
|
547
|
+
onRequestClose: Ne,
|
|
548
|
+
elementRef: qe,
|
|
549
|
+
hitAreaRef: Ae,
|
|
550
|
+
outerRef: Ie,
|
|
551
|
+
pointTo: B
|
|
547
552
|
}, t().createElement(j, null, p));
|
|
548
553
|
if (x) {
|
|
549
554
|
|
|
550
|
-
return t().createElement(t().Fragment, null,
|
|
555
|
+
return t().createElement(t().Fragment, null, Ve(), ze, Ge);
|
|
551
556
|
}
|
|
552
557
|
|
|
553
|
-
return t().createElement(
|
|
558
|
+
return t().createElement($e, q({
|
|
554
559
|
"data-test": "tooltip",
|
|
555
|
-
"data-test-open":
|
|
556
|
-
"data-test-popover-id":
|
|
560
|
+
"data-test-open": ge,
|
|
561
|
+
"data-test-popover-id": be,
|
|
557
562
|
ref: h
|
|
558
|
-
},
|
|
563
|
+
}, F), Ue(), ze, Ge);
|
|
559
564
|
}
|
|
560
565
|
X.propTypes = z;
|
|
561
566
|
X.possibleOpenReasons = U;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@splunk/react-ui",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"description": "Library of React components that implement the Splunk design language",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Splunk Inc.",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"docs:publish:external": "eval $(splunk-docs-package docs-external --suffix=public) && artifact-ci publish generic $DOCS_GEN_OUTPUT_NAME $DOCS_GEN_REMOTE_PATH",
|
|
12
12
|
"docs:start": "INTERNAL=true webpack serve --config docs.gen.webpack.config.js",
|
|
13
13
|
"docs:start:external": "webpack serve --config docs.gen.webpack.config.js",
|
|
14
|
-
"eslint": "eslint src .storybook --ext \".ts,.tsx,.js,.jsx\"",
|
|
14
|
+
"eslint": "eslint --rulesdir ../../infra/eslint/rules src .storybook --ext \".ts,.tsx,.js,.jsx\"",
|
|
15
15
|
"eslint:fix": "yarn run eslint --fix",
|
|
16
16
|
"eslint:ci": "yarn run eslint -f junit -o test-reports/lint-results.xml",
|
|
17
17
|
"lint": "yarn run eslint && yarn run stylelint",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"test:watch": "jest --watch",
|
|
30
30
|
"test:cypress": "yarn cypress open --component",
|
|
31
31
|
"test:cypress:ci": "yarn cypress run --component",
|
|
32
|
-
"types:build": "yarn types:
|
|
33
|
-
"types:
|
|
32
|
+
"types:build": "yarn types:noemit && yarn tsc --emitDeclarationOnly --declaration --declarationDir ./types && node ./scripts/pruneTypes.js",
|
|
33
|
+
"types:noemit": "tsc --p cypress/tsconfig.check-cypress.json && tsc --p tsconfig.check-docs.json",
|
|
34
34
|
"types:start": "yarn types:build --watch"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"@dnd-kit/sortable": "^8.0.0",
|
|
45
45
|
"@dnd-kit/utilities": "^3.2.2",
|
|
46
46
|
"@react-spring/web": "^9.7.5",
|
|
47
|
-
"@splunk/react-icons": "^5.
|
|
48
|
-
"@splunk/themes": "^1.2.
|
|
47
|
+
"@splunk/react-icons": "^5.3.0",
|
|
48
|
+
"@splunk/themes": "^1.2.1",
|
|
49
49
|
"@splunk/ui-utils": "^1.10.0",
|
|
50
50
|
"decimal.js-light": "^2.2.3",
|
|
51
51
|
"lodash": "^4.17.14",
|
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
"@babel/core": "^7.28.0",
|
|
61
61
|
"@babel/plugin-transform-runtime": "^7.28.0",
|
|
62
62
|
"@splunk/babel-preset": "^4.0.0",
|
|
63
|
-
"@splunk/docs-gen": "^1.1.
|
|
63
|
+
"@splunk/docs-gen": "^1.1.1",
|
|
64
64
|
"@splunk/eslint-config": "^5.0.0",
|
|
65
|
-
"@splunk/react-docs": "^1.
|
|
65
|
+
"@splunk/react-docs": "^1.3.0",
|
|
66
66
|
"@splunk/stylelint-config": "^5.0.0",
|
|
67
67
|
"@splunk/test-runner-utils": "^0.4.1",
|
|
68
68
|
"@splunk/webpack-configs": "^7.0.2",
|
|
@@ -87,14 +87,13 @@
|
|
|
87
87
|
"@types/react-dom": "^18.2.0",
|
|
88
88
|
"@types/styled-components": "^5.1.0",
|
|
89
89
|
"@types/tinycolor2": "^1.4.2",
|
|
90
|
-
"@types/webdriverio": "^5.0.0",
|
|
91
90
|
"@types/webpack-env": "^1.15.2",
|
|
92
91
|
"@typescript-eslint/eslint-plugin": "^8.29.1",
|
|
93
92
|
"@typescript-eslint/parser": "^8.29.1",
|
|
94
93
|
"axe-html-reporter": "^2.2.11",
|
|
95
94
|
"axe-playwright": "^1.1.11",
|
|
96
95
|
"babel-loader": "^8.3.0",
|
|
97
|
-
"babel-plugin-istanbul": "^5.
|
|
96
|
+
"babel-plugin-istanbul": "^5.2.0",
|
|
98
97
|
"babel-plugin-styled-components": "^1.10.7",
|
|
99
98
|
"babel-plugin-transform-imports": "^2.0.0",
|
|
100
99
|
"babel-plugin-transform-require-context": "^0.1.1",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* @name Basic
|
|
4
|
-
* @description An Avatar can show one to three characters. You can use the getInitials helper to shorten a name.
|
|
4
|
+
* @description An Avatar can show one to three characters. You can use the `getInitials` helper to shorten a name.
|
|
5
5
|
*/
|
|
6
6
|
export default function Basic(): React.JSX.Element;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { ComponentProps } from '../utils/types';
|
|
4
|
+
/** @public */
|
|
5
|
+
type CheckboxChangeHandler = (event: React.ChangeEvent<HTMLInputElement>, data: {
|
|
6
|
+
checked: boolean;
|
|
7
|
+
name?: string;
|
|
8
|
+
value?: string;
|
|
9
|
+
}) => void;
|
|
10
|
+
interface CheckboxPropsBase {
|
|
11
|
+
/**
|
|
12
|
+
* Setting this value makes the component controlled. If set, the onChange callback is required.
|
|
13
|
+
* A setting of "indeterminate" is considered unchecked for the purposes of form submission.
|
|
14
|
+
*/
|
|
15
|
+
checked?: boolean | 'indeterminate';
|
|
16
|
+
/** The content to display inside the checkbox label. */
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
/** Set this property instead of checked to make the component uncontrolled. */
|
|
19
|
+
defaultChecked?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* The id of the description.
|
|
22
|
+
* When placed in a ControlGroup, this is automatically set to the ControlGroup's help component.
|
|
23
|
+
*/
|
|
24
|
+
describedBy?: string;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* A React ref which is set to the DOM element when the component mounts, and null when it unmounts.
|
|
28
|
+
*/
|
|
29
|
+
elementRef?: React.Ref<HTMLDivElement>;
|
|
30
|
+
/**
|
|
31
|
+
* Mark the component as having an error.
|
|
32
|
+
*/
|
|
33
|
+
error?: boolean;
|
|
34
|
+
inert?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* A React ref which is set to the input element when the component mounts and null when it unmounts.
|
|
37
|
+
*/
|
|
38
|
+
inputRef?: React.Ref<HTMLInputElement>;
|
|
39
|
+
/**
|
|
40
|
+
* The id of the label.
|
|
41
|
+
* When placed in a ControlGroup, this is automatically set to the ControlGroup's label.
|
|
42
|
+
*/
|
|
43
|
+
labelledBy?: string;
|
|
44
|
+
/**
|
|
45
|
+
* The name is returned with onChange events, which can be used to identify the
|
|
46
|
+
* control when multiple controls share an onChange callback.
|
|
47
|
+
*/
|
|
48
|
+
name?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Fires when the checked state changes.
|
|
51
|
+
*/
|
|
52
|
+
onChange?: CheckboxChangeHandler;
|
|
53
|
+
/** @private. */
|
|
54
|
+
required?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Returned by the onChange handler and submitted during form submission if the checkbox is checked.
|
|
57
|
+
* This defaults to "on" if the input is checked.
|
|
58
|
+
*/
|
|
59
|
+
value?: string;
|
|
60
|
+
}
|
|
61
|
+
interface CheckboxPropsBaseControlled extends CheckboxPropsBase {
|
|
62
|
+
defaultChecked?: never;
|
|
63
|
+
onChange: CheckboxChangeHandler;
|
|
64
|
+
}
|
|
65
|
+
interface CheckboxPropsBaseUncontrolled extends CheckboxPropsBase {
|
|
66
|
+
defaultChecked?: boolean;
|
|
67
|
+
checked?: never;
|
|
68
|
+
}
|
|
69
|
+
type CheckboxProps = ComponentProps<CheckboxPropsBaseControlled | CheckboxPropsBaseUncontrolled, 'input'>;
|
|
70
|
+
declare const Checkbox: {
|
|
71
|
+
({ checked, children, defaultChecked, describedBy, disabled, elementRef, error, id, inert, inputRef, labelledBy, name, onChange, required, role, tabIndex, value, ...otherProps }: CheckboxProps): React.JSX.Element;
|
|
72
|
+
propTypes: {
|
|
73
|
+
checked: PropTypes.Requireable<string | boolean>;
|
|
74
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
75
|
+
defaultChecked: PropTypes.Requireable<boolean>;
|
|
76
|
+
describedBy: PropTypes.Requireable<string>;
|
|
77
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
78
|
+
elementRef: PropTypes.Requireable<object>;
|
|
79
|
+
error: PropTypes.Requireable<boolean>;
|
|
80
|
+
inert: PropTypes.Requireable<boolean>;
|
|
81
|
+
inputRef: PropTypes.Requireable<object>;
|
|
82
|
+
labelledBy: PropTypes.Requireable<string>;
|
|
83
|
+
name: PropTypes.Requireable<string>;
|
|
84
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
85
|
+
/** @private. */
|
|
86
|
+
required: PropTypes.Requireable<boolean>;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
export default Checkbox;
|
|
90
|
+
export { CheckboxChangeHandler, CheckboxPropsBase, CheckboxPropsBaseControlled, CheckboxPropsBaseUncontrolled, };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @name Uncontrolled
|
|
4
|
+
* @description Checkbox can also used as an uncontrolled component, using defaultChecked to set the initial checked state.
|
|
5
|
+
*/
|
|
6
|
+
declare const Uncontrolled: () => React.JSX.Element;
|
|
7
|
+
export default Uncontrolled;
|
package/types/src/Code/Code.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import { ComponentProps } from '../utils/types';
|
|
4
4
|
type CodeSupportedLanguages = 'bash' | 'clike' | 'css' | 'html' | 'json' | 'javascript' | 'js' | 'jsx' | 'typescript' | 'ts' | 'tsx' | 'markup' | 'mathml' | 'plain' | 'plaintext' | 'splunk-spl' | 'sql' | 'svg' | 'text' | 'txt' | 'xml' | 'yaml' | 'yml';
|
|
5
5
|
interface CodePropsBase {
|
|
6
|
+
/** Change the style of the Code container. */
|
|
7
|
+
containerAppearance?: 'none' | 'section';
|
|
6
8
|
/**
|
|
7
9
|
* A React ref which is set to the DOM element when the component mounts and null when it unmounts.
|
|
8
10
|
*/
|
|
@@ -43,9 +45,10 @@ interface CodePropsBase {
|
|
|
43
45
|
value?: string;
|
|
44
46
|
}
|
|
45
47
|
type CodeProps = ComponentProps<CodePropsBase, 'pre'>;
|
|
46
|
-
declare function Code({ elementRef, indentChars, language, languageFallback, lineHighlights, lineNumberStart, showIndentGuide, showLineNumbers, value, ...otherProps }: CodeProps): React.JSX.Element;
|
|
48
|
+
declare function Code({ containerAppearance, elementRef, indentChars, language, languageFallback, lineHighlights, lineNumberStart, showIndentGuide, showLineNumbers, value, ...otherProps }: CodeProps): React.JSX.Element;
|
|
47
49
|
declare namespace Code {
|
|
48
50
|
var propTypes: {
|
|
51
|
+
containerAppearance: PropTypes.Requireable<string>;
|
|
49
52
|
elementRef: PropTypes.Requireable<object>;
|
|
50
53
|
indentChars: PropTypes.Requireable<number>;
|
|
51
54
|
language: PropTypes.Requireable<string>;
|