@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.
Files changed (77) hide show
  1. package/Avatar.js +57 -52
  2. package/Box.js +2 -1
  3. package/CHANGELOG.md +31 -0
  4. package/Calendar.js +8 -4
  5. package/Checkbox.d.ts +2 -0
  6. package/Checkbox.js +350 -0
  7. package/Code.js +151 -132
  8. package/CollapsiblePanel.js +184 -210
  9. package/Color.js +4 -2
  10. package/ControlGroup.js +2 -1
  11. package/Date.js +123 -119
  12. package/DefinitionList.js +100 -77
  13. package/Dropdown.js +2 -2
  14. package/DualListbox.js +409 -353
  15. package/File.js +102 -99
  16. package/JSONTree.js +317 -303
  17. package/Link.js +11 -11
  18. package/MIGRATION.md +27 -0
  19. package/Markdown.js +162 -151
  20. package/Menu.js +44 -42
  21. package/Modal.js +3 -3
  22. package/Multiselect.js +454 -435
  23. package/Paginator.js +2 -1
  24. package/ResultsMenu.js +2 -1
  25. package/Scroll.js +2 -1
  26. package/Search.js +131 -127
  27. package/Select.js +3 -2
  28. package/Switch.js +197 -229
  29. package/Table.js +24 -16
  30. package/Text.js +180 -206
  31. package/TextArea.js +233 -224
  32. package/Tooltip.js +144 -139
  33. package/package.json +9 -10
  34. package/tsconfig.check-docs.json +8 -0
  35. package/types/src/Avatar/docs/examples/Basic.d.ts +1 -1
  36. package/types/src/Checkbox/Checkbox.d.ts +90 -0
  37. package/types/src/Checkbox/docs/examples/Basic.d.ts +7 -0
  38. package/types/src/Checkbox/docs/examples/Disabled.d.ts +6 -0
  39. package/types/src/Checkbox/docs/examples/Error.d.ts +6 -0
  40. package/types/src/Checkbox/docs/examples/Uncontrolled.d.ts +7 -0
  41. package/types/src/Checkbox/index.d.ts +2 -0
  42. package/types/src/Code/Code.d.ts +4 -1
  43. package/types/src/Code/LineHighlights.d.ts +1 -0
  44. package/types/src/Code/LineNumbers.d.ts +2 -1
  45. package/types/src/Code/docs/examples/CustomizeContainer.d.ts +7 -0
  46. package/types/src/ControlGroup/docs/examples/CustomizedLabelTarget.d.ts +3 -3
  47. package/types/src/Date/Date.d.ts +7 -1
  48. package/types/src/DefinitionList/DefinitionList.d.ts +7 -2
  49. package/types/src/DefinitionList/DefinitionListContext.d.ts +1 -1
  50. package/types/src/DefinitionList/docs/examples/StackedLayout.d.ts +6 -0
  51. package/types/src/DualListbox/DualListbox.d.ts +1 -1
  52. package/types/src/DualListbox/Label.d.ts +7 -7
  53. package/types/src/DualListbox/Listbox.d.ts +2 -2
  54. package/types/src/DualListbox/ListboxContext.d.ts +1 -1
  55. package/types/src/File/File.d.ts +7 -1
  56. package/types/src/JSONTree/JSONTreeItem.d.ts +4 -2
  57. package/types/src/JSONTree/renderTreeItems.d.ts +2 -1
  58. package/types/src/Markdown/renderers/MarkdownCodeBlock.d.ts +2 -1
  59. package/types/src/Menu/docs/examples/Dimmed.d.ts +1 -1
  60. package/types/src/Menu/docs/examples/Disabled.d.ts +1 -0
  61. package/types/src/Multiselect/Compact.d.ts +7 -1
  62. package/types/src/Multiselect/Multiselect.d.ts +7 -1
  63. package/types/src/Multiselect/Normal.d.ts +7 -1
  64. package/types/src/Search/Search.d.ts +5 -1
  65. package/types/src/Switch/Switch.d.ts +7 -1
  66. package/types/src/Switch/docs/examples/Basic.d.ts +2 -10
  67. package/types/src/Switch/docs/examples/Disabled.d.ts +2 -9
  68. package/types/src/Table/ExpandButton.d.ts +1 -1
  69. package/types/src/Tooltip/Tooltip.d.ts +14 -1
  70. package/NonInteractiveCheckbox.js +0 -101
  71. package/types/src/CollapsiblePanel/icons/ExpandPanel.d.ts +0 -12
  72. package/types/src/NonInteractiveCheckbox/NonInteractiveCheckbox.d.ts +0 -22
  73. package/types/src/NonInteractiveCheckbox/index.d.ts +0 -1
  74. package/types/src/Switch/docs/examples/Error.d.ts +0 -6
  75. package/types/src/Text/IconOutlinedHide.d.ts +0 -3
  76. package/types/src/Text/IconOutlinedView.d.ts +0 -3
  77. /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.prepend, H = W(e, [ "appearance", "append", "children", "closeDelay", "closeWhen", "content", "contentRelationship", "defaultPlacement", "elementRef", "inline", "onRequestClose", "onRequestOpen", "open", "openDelay", "renderAnchor", "prepend" ]);
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 F = (0, r.useState)(false), K = N(F, 2), V = K[0], U = K[1];
313
- var $ = (0, r.useState)(null), z = N($, 2), X = z[0], Y = z[1];
314
- var Z = (0, r.useState)(null), ee = N(Z, 2), ne = ee[0], re = ee[1];
315
- var te = (0, r.useState)(null), oe = N(te, 2), ae = oe[0], le = oe[1];
316
- var ie = (0, r.useState)(null), ue = N(ie, 2), se = ue[0], ce = ue[1];
317
- var fe = (0, r.useState)((function() {
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
- })), pe = N(fe, 1), ve = pe[0], de = ve.ariaId, me = ve.popoverId;
323
- var be = m()({
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 ye = (0, r.useMemo)((function() {
335
+ var ge = (0, r.useMemo)((function() {
332
336
  var e = !!p;
333
- return !!X && be ? _ : e && V;
334
- }), [ X, p, be, V, _ ]);
335
- var ge = (0, r.useRef)();
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 (ge.current !== undefined) {
339
- clearTimeout(ge.current);
342
+ if (Oe.current !== undefined) {
343
+ clearTimeout(Oe.current);
340
344
  }
341
345
  };
342
346
  }), []);
343
- var Oe = (0, r.useCallback)((function(e, n) {
344
- if (ge.current !== undefined) {
345
- clearTimeout(ge.current);
347
+ var he = (0, r.useCallback)((function(e, n) {
348
+ if (Oe.current !== undefined) {
349
+ clearTimeout(Oe.current);
346
350
  }
347
- ge.current = setTimeout((function() {
348
- if (!be) {
349
- U(false);
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, be, L ]);
354
- var he = (0, r.useCallback)((function(e, n) {
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 (ge.current !== undefined) {
358
- clearTimeout(ge.current);
361
+ if (Oe.current !== undefined) {
362
+ clearTimeout(Oe.current);
359
363
  }
360
- ge.current = setTimeout((function() {
361
- var r = ye;
362
- if (!be) {
363
- U(true);
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
- }), [ be, ye, I, M ]);
370
- var Se = (0, r.useCallback)((function(e) {
371
- he(e, {
373
+ }), [ ye, ge, I, M ]);
374
+ var Ce = (0, r.useCallback)((function(e) {
375
+ Se(e, {
372
376
  reason: "mouseEnterToggle"
373
377
  });
374
- }), [ he ]);
375
- var Ce = (0, r.useCallback)((function(e) {
376
- he(e, {
378
+ }), [ Se ]);
379
+ var ke = (0, r.useCallback)((function(e) {
380
+ Se(e, {
377
381
  reason: "mouseEnterPopover"
378
382
  });
379
- }), [ he ]);
380
- var ke = (0, r.useCallback)((function(e) {
381
- he(e, {
383
+ }), [ Se ]);
384
+ var Ee = (0, r.useCallback)((function(e) {
385
+ Se(e, {
382
386
  reason: "mouseEnterHitArea"
383
387
  });
384
- }), [ he ]);
385
- var Ee = (0, r.useCallback)((function(e) {
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 !== ae && e.relatedTarget !== se) {
388
- Oe(e, {
391
+ if (e.relatedTarget == null || e.relatedTarget !== le && e.relatedTarget !== ce) {
392
+ he(e, {
389
393
  reason: n
390
394
  });
391
395
  }
392
- }), [ Oe, ae, se ]);
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
- Ee(e, "mouseLeaveHitArea");
398
- }), [ Ee ]);
398
+ Te(e, "mouseLeavePopover");
399
+ }), [ Te ]);
399
400
  var je = (0, r.useCallback)((function(e) {
400
- Oe(e, {
401
+ Te(e, "mouseLeaveHitArea");
402
+ }), [ Te ]);
403
+ var we = (0, r.useCallback)((function(e) {
404
+ he(e, {
401
405
  reason: "mouseStopHitArea"
402
406
  });
403
- }), [ Oe ]);
404
- var we = a()(je, 10);
405
- var Re = (0, r.useCallback)((function(e) {
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 (ae) {
423
- ae.removeEventListener("mouseenter", Ce);
424
- ae.removeEventListener("mouseleave", Te);
416
+ } else if (Y) {
417
+ Y.removeEventListener("mouseenter", Ce);
418
+ Y.removeEventListener("mouseleave", Te);
425
419
  }
426
- le(e);
427
- }), [ Ce, Te, ae ]);
420
+ Z(e);
421
+ }), [ Y, Ce, Te ]);
428
422
  var qe = (0, r.useCallback)((function(e) {
429
- ce(e);
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", ke);
437
- e.addEventListener("mousemove", we);
438
- e.addEventListener("mouseleave", Pe);
439
- } else if (ne) {
440
- ne.removeEventListener("mouseenter", ke);
441
- ne.removeEventListener("mousemove", we);
442
- ne.removeEventListener("mouseleave", Pe);
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
- re(e);
445
- }), [ ke, Pe, we, ne ]);
446
- var Ae = (0, r.useCallback)((function(e) {
448
+ te(e);
449
+ }), [ Ee, je, Re, re ]);
450
+ var _e = (0, r.useCallback)((function(e) {
447
451
  if (c !== "notOnClick") {
448
- Oe(e, {
452
+ he(e, {
449
453
  reason: "toggleClick"
450
454
  });
451
455
  }
452
- }), [ c, Oe ]);
453
- var _e = (0, r.useCallback)((function(e) {
454
- he(e, {
456
+ }), [ c, he ]);
457
+ var De = (0, r.useCallback)((function(e) {
458
+ Se(e, {
455
459
  reason: "focusToggle"
456
460
  });
457
- }), [ he ]);
458
- var De = (0, r.useCallback)((function(e) {
459
- Oe(e, {
461
+ }), [ Se ]);
462
+ var Me = (0, r.useCallback)((function(e) {
463
+ he(e, {
460
464
  reason: "blurToggle"
461
465
  });
462
- }), [ Oe ]);
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
- Re(e);
468
+ he(null, e);
469
+ }), [ he ]);
470
+ var xe = (0, r.useCallback)((function(e) {
471
+ Le(e);
468
472
  R(h, e);
469
- }), [ h, Re ]);
470
- var xe = (0, r.useMemo)((function() {
473
+ }), [ h, Le ]);
474
+ var Be = (0, r.useMemo)((function() {
471
475
  return {
472
476
  "data-test": "toggle",
473
- elementRef: Ne,
474
- onBlur: De,
475
- onClick: Ae,
476
- onFocus: _e
477
+ elementRef: xe,
478
+ onBlur: Me,
479
+ onClick: _e,
480
+ onFocus: De
477
481
  };
478
- }), [ De, Ae, _e, Ne ]);
479
- var Be = (0, r.useMemo)((function() {
482
+ }), [ Me, _e, De, xe ]);
483
+ var He = (0, r.useMemo)((function() {
480
484
  return d === "label" ? {
481
- "aria-labelledby": de,
482
- labelledBy: de
485
+ "aria-labelledby": me,
486
+ labelledBy: me
483
487
  } : {
484
- "aria-describedby": de,
485
- describedBy: de
488
+ "aria-describedby": me,
489
+ describedBy: me
486
490
  };
487
- }), [ d, de ]);
488
- var He = (0, r.useMemo)((function() {
491
+ }), [ d, me ]);
492
+ var Fe = (0, r.useMemo)((function() {
489
493
  return {
490
494
  append: o,
491
- prepend: B
495
+ prepend: H
492
496
  };
493
- }), [ o, B ]);
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), He);
499
- }), [ Be, He ]);
500
- var We = (0, r.useCallback)((function() {
501
- if (false) {}
502
- return x === null || x === void 0 ? void 0 : x(A(A(A({}, Fe), Be), He));
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, Ke);
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": de,
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: Ae,
523
- onFocus: _e,
524
- onBlur: De,
525
- ref: Re
526
+ onClick: _e,
527
+ onFocus: De,
528
+ onBlur: Me,
529
+ ref: Le
526
530
  }, e);
527
- }), [ l, C, Ae, _e, De, Re, Ke, de ]);
528
- var Ue = C ? E : k;
529
- var $e = !!p && t().createElement(v(), {
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: de
535
+ id: me
532
536
  }, p);
533
- var ze = t().createElement(f(), {
537
+ var Ge = t().createElement(f(), {
534
538
  role: "tooltip",
535
539
  align: "center",
536
- anchor: X,
540
+ anchor: Y,
537
541
  animationConfig: G,
538
542
  appearance: n,
539
543
  closeReasons: J,
540
544
  defaultPlacement: O,
541
- id: me,
542
- open: ye,
543
- onRequestClose: Me,
544
- elementRef: Le,
545
- hitAreaRef: Ie,
546
- outerRef: qe
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, We(), $e, ze);
555
+ return t().createElement(t().Fragment, null, Ve(), ze, Ge);
551
556
  }
552
557
 
553
- return t().createElement(Ue, q({
558
+ return t().createElement($e, q({
554
559
  "data-test": "tooltip",
555
- "data-test-open": ye,
556
- "data-test-popover-id": me,
560
+ "data-test-open": ge,
561
+ "data-test-popover-id": be,
557
562
  ref: h
558
- }, H), Ve(), $e, ze);
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.2.0",
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:build:cypress && tsc --emitDeclarationOnly --declaration --declarationDir ./types && node ./scripts/pruneTypes.js",
33
- "types:build:cypress": "tsc --p cypress/tsconfig.cypress.json",
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.2.0",
48
- "@splunk/themes": "^1.2.0",
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.0",
63
+ "@splunk/docs-gen": "^1.1.1",
64
64
  "@splunk/eslint-config": "^5.0.0",
65
- "@splunk/react-docs": "^1.2.0",
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.1.0",
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",
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "noEmit": true
5
+ },
6
+ "include": ["stubs-*.d.ts", "src/docs/**/*"],
7
+ "exclude": []
8
+ }
@@ -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 Controlled
4
+ * @description Checkbox can be controlled using the checked prop and an onChange callback.
5
+ */
6
+ declare const Basic: () => React.JSX.Element;
7
+ export default Basic;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ /**
3
+ * @name Disabled
4
+ */
5
+ declare const Disabled: () => React.JSX.Element;
6
+ export default Disabled;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ /**
3
+ * @name Error
4
+ */
5
+ declare function CheckboxError(): React.JSX.Element;
6
+ export default CheckboxError;
@@ -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;
@@ -0,0 +1,2 @@
1
+ export { default } from './Checkbox';
2
+ export * from './Checkbox';
@@ -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>;
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  interface LineHighlightProps {
3
3
  highlight: string;
4
4
  width: number;
5
+ containerAppearance: 'none' | 'section';
5
6
  }
6
7
  type Ranges = [number, number][];
7
8
  declare const parseHighlightLines: (highlight: string) => Ranges;