@splunk/react-ui 4.32.0 → 4.33.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 (37) hide show
  1. package/Button.js +42 -45
  2. package/ButtonSimple.js +372 -336
  3. package/CHANGELOG.md +23 -0
  4. package/Clickable.js +21 -19
  5. package/FormRows.js +229 -207
  6. package/MIGRATION.mdx +23 -0
  7. package/Menu.js +1 -1
  8. package/Modal.js +156 -131
  9. package/Multiselect.js +47 -33
  10. package/Select.js +236 -220
  11. package/TabBar.js +1 -1
  12. package/Text.js +13 -11
  13. package/package.json +5 -5
  14. package/types/src/Button/Button.d.ts +4 -4
  15. package/types/src/ButtonSimple/ButtonSimple.d.ts +8 -6
  16. package/types/src/ButtonSimple/mixin.d.ts +2 -2
  17. package/types/src/Clickable/Clickable.d.ts +3 -2
  18. package/types/src/Date/Date.d.ts +2 -2
  19. package/types/src/Menu/Item.d.ts +0 -1
  20. package/types/src/Number/Number.d.ts +2 -2
  21. package/types/src/Select/Select.d.ts +6 -2
  22. package/types/src/Select/SelectBase.d.ts +6 -2
  23. package/types/src/Slider/Slider.d.ts +2 -2
  24. package/types/src/Text/docs/examples/Basic.d.ts +1 -9
  25. package/types/src/Text/docs/examples/Error.d.ts +2 -10
  26. package/types/src/Text/docs/examples/Inline.d.ts +1 -9
  27. package/types/src/Text/docs/examples/Multiline.d.ts +1 -9
  28. package/types/src/Text/docs/examples/Password.d.ts +1 -9
  29. package/types/src/Text/docs/examples/Search.d.ts +1 -9
  30. package/types/src/Button/docs/examples/prisma/Basic.d.ts +0 -2
  31. package/types/src/Button/docs/examples/prisma/Block.d.ts +0 -2
  32. package/types/src/Button/docs/examples/prisma/Disabled.d.ts +0 -2
  33. package/types/src/Button/docs/examples/prisma/Icons.d.ts +0 -2
  34. package/types/src/Button/docs/examples/prisma/Menus.d.ts +0 -2
  35. package/types/src/Button/docs/examples/prisma/To.d.ts +0 -2
  36. package/types/src/Button/docs/examples/prisma/Truncated.d.ts +0 -2
  37. /package/types/src/{Button/docs/examples/prisma → Clickable/docs/examples}/Dimmed.d.ts +0 -0
package/Multiselect.js CHANGED
@@ -1380,6 +1380,7 @@
1380
1380
  showSelectedValuesFirst: a().oneOf([ "nextOpen", "immediately", "never" ]),
1381
1381
  suffixLabel: a().string,
1382
1382
  tabConfirmsNewValue: a().bool,
1383
+ toggleContent: a().oneOf([ "optionChildren", "optionLabel" ]),
1383
1384
  values: a().array,
1384
1385
  /** @private. */
1385
1386
  virtualization: a().number
@@ -1402,7 +1403,8 @@
1402
1403
  prepend: false,
1403
1404
  repositionMode: "flip",
1404
1405
  selectAllAppearance: "buttongroup",
1405
- tabConfirmsNewValue: false
1406
+ tabConfirmsNewValue: false,
1407
+ toggleContent: "optionChildren"
1406
1408
  };
1407
1409
  var Yt = ce()((function(e) {
1408
1410
  return [ e ];
@@ -1709,60 +1711,72 @@
1709
1711
  }));
1710
1712
  Jt($t(a), "createToggle", (function() {
1711
1713
  var e;
1712
- var t = a.props, i = t.toggle, l = t.appearance, s = t.children, p = t.describedBy, f = t.disabled, d = t.elementRef, v = t.error, h = t.inline, b = t.labelledBy, y = t.labelText, m = t.multiple, g = t.placeholder, O = t.prefixLabel, w = t.required, S = t.suffixLabel;
1713
- var C;
1714
+ var t = a.props, i = t.toggle, l = t.appearance, s = t.children, p = t.describedBy, f = t.disabled, d = t.elementRef, v = t.error, h = t.inline, b = t.labelledBy, y = t.labelText, m = t.multiple, g = t.placeholder, O = t.prefixLabel, w = t.required, S = t.suffixLabel, C = t.toggleContent;
1714
1715
  var x;
1716
+ var k;
1717
+ var I = [];
1715
1718
  // Generate buttonLabels
1716
- var k = (e = a.getCurrentValues()) !== null && e !== void 0 ? e : [];
1717
- var I = n.Children.toArray(s);
1718
- var _ = k.reduce((function(e, t, n, r) {
1719
- var o = Z()(I, (function(e) {
1719
+ var _ = (e = a.getCurrentValues()) !== null && e !== void 0 ? e : [];
1720
+ var j = n.Children.toArray(s);
1721
+ var E = _.reduce((function(e, t, n, r) {
1722
+ var o = Z()(j, (function(e) {
1720
1723
  return tn(e) && e.props.value === t;
1721
1724
  }));
1722
1725
  if (o) {
1723
- e.push(o.props.children || o.props.label);
1726
+ var a = C !== "optionLabel" && o.props.children ? o.props.children : o.props.label;
1727
+ e.push(a);
1728
+ I.push(o.props.label);
1724
1729
  // if not in multiple mode, add the icon
1725
- if (!m && k.length === 1) {
1726
- C = o.props.icon;
1730
+ if (!m && _.length === 1) {
1731
+ x = o.props.icon;
1727
1732
  }
1728
1733
  } else if (m) {
1729
1734
  // only add values that don't match an option in "multiple" mode to preserve old behaviour
1730
1735
  e.push(t);
1736
+ I.push(t.toString());
1731
1737
  }
1732
1738
  if (n < r.length - 1) {
1733
1739
  e.push((0, u._)(", "));
1740
+ I.push((0, u._)(", "));
1734
1741
  }
1735
1742
  return e;
1736
1743
  }), []);
1737
- x = _;
1744
+ k = E;
1738
1745
  // only apply prefix / suffix if the label is not empty
1739
- if (x.length > 0) {
1740
- x = a.wrapLabel({
1746
+ if (k.length > 0) {
1747
+ k = a.wrapLabel({
1741
1748
  prefixLabel: O,
1742
- label: x,
1749
+ label: k,
1743
1750
  suffixLabel: S
1744
1751
  });
1745
1752
  }
1746
1753
  // single <Select> behaviour is to show the placeholder if all parts of the the label
1747
1754
  // are empty strings so we replicate this behaviour here
1748
- if (x.length === 0 || !m && x.every((function(e) {
1755
+ if (k.length === 0 || !m && k.every((function(e) {
1749
1756
  return e === "";
1750
1757
  }))) {
1751
- x = Yt(g);
1758
+ k = Yt(g);
1759
+ // placeholder has a default value so will not be undefined
1760
+ I = Yt(g);
1752
1761
  }
1753
- var j = x;
1754
1762
  // If there's more than one item selected, read out the selected total
1755
1763
  // rather than reading out each selected item
1756
- if (x.length > 1) {
1757
- j = a.wrapLabel({
1764
+ if (k.length > 1) {
1765
+ I = a.wrapLabel({
1766
+ prefixLabel: O,
1767
+ label: [ "".concat(_.length, " items selected") ],
1768
+ suffixLabel: S
1769
+ });
1770
+ } else {
1771
+ I = a.wrapLabel({
1758
1772
  prefixLabel: O,
1759
- label: [ "".concat(k.length, " items selected") ],
1773
+ label: I,
1760
1774
  suffixLabel: S
1761
1775
  });
1762
1776
  }
1763
- var E = Gt({
1777
+ var M = Gt({
1764
1778
  "aria-describedby": p,
1765
- "aria-label": "".concat(y ? "".concat(y, ", ") : "").concat(j),
1779
+ "aria-label": "".concat(y ? "".concat(y, ", ") : "").concat(I.join("")),
1766
1780
  "aria-labelledby": y ? undefined : b,
1767
1781
  "aria-required": w,
1768
1782
  "data-select-appearance": l,
@@ -1772,36 +1786,36 @@
1772
1786
  error: v
1773
1787
  }, c()(a.props, le()(o.propTypes)));
1774
1788
  if (m) {
1775
- E["data-test-values"] = JSON.stringify(k);
1789
+ M["data-test-values"] = JSON.stringify(_);
1776
1790
  } else {
1777
- var M = It(k, 1), A = M[0];
1778
- E["data-test-value"] = A;
1791
+ var A = It(_, 1), P = A[0];
1792
+ M["data-test-value"] = P;
1779
1793
  }
1780
1794
  if (i) {
1781
1795
 
1782
- return (0, n.cloneElement)(i, E);
1796
+ return (0, n.cloneElement)(i, M);
1783
1797
  }
1784
1798
  if (l === "link") {
1785
1799
 
1786
- return r().createElement(Se(), kt({}, E, {
1800
+ return r().createElement(Se(), kt({}, M, {
1787
1801
  "data-select-appearance": "link"
1788
- }), !!C && r().createElement(ft, null, C), x || g, r().createElement(dt, null, r().createElement(Ve, null)));
1802
+ }), !!x && r().createElement(ft, null, x), k || g, r().createElement(dt, null, r().createElement(Ve, null)));
1789
1803
  }
1790
1804
 
1791
- return r().createElement(pt, kt({}, E, {
1805
+ return r().createElement(pt, kt({}, M, {
1792
1806
  $multiple: m,
1793
1807
  appearance: l,
1794
- label: x,
1808
+ label: k,
1795
1809
  error: v,
1796
- icon: C,
1810
+ icon: x,
1797
1811
  inline: h,
1798
1812
  isMenu: true,
1799
1813
  "aria-haspopup": "listbox",
1800
1814
  "aria-owns": a.menuId,
1801
1815
  onClick: a.props.onClick
1802
- }, pe()(a.props, o.invalidLinkAppearanceProps)), !!k.length && m && r().createElement(bt, {
1816
+ }, pe()(a.props, o.invalidLinkAppearanceProps)), !!_.length && m && r().createElement(bt, {
1803
1817
  "data-role": "count"
1804
- }, "(", k.length, ")"));
1818
+ }, "(", _.length, ")"));
1805
1819
  }));
1806
1820
  Jt($t(a), "createChildren", (function() {
1807
1821
  var e = a.state, t = e.filterKeyword, o = e.textHasFocus, i = e.topValues;