@splunk/react-ui 5.2.0 → 5.4.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 (114) hide show
  1. package/Accordion.js +31 -31
  2. package/Avatar.js +64 -59
  3. package/Box.js +2 -1
  4. package/Breadcrumbs.js +66 -63
  5. package/ButtonSimple.js +52 -52
  6. package/CHANGELOG.md +47 -0
  7. package/Calendar.js +8 -4
  8. package/CardLayout.js +39 -36
  9. package/Checkbox.d.ts +2 -0
  10. package/Checkbox.js +350 -0
  11. package/Clickable.js +5 -6
  12. package/Code.js +451 -536
  13. package/CollapsiblePanel.js +184 -210
  14. package/Color.js +903 -1023
  15. package/ControlGroup.js +2 -1
  16. package/Date.js +123 -119
  17. package/DefinitionList.js +100 -77
  18. package/Dropdown.js +2 -2
  19. package/DualListbox.js +409 -353
  20. package/File.js +102 -99
  21. package/FormRows.js +13 -11
  22. package/JSONTree.js +679 -1391
  23. package/Link.js +7 -7
  24. package/MIGRATION.md +27 -0
  25. package/Markdown.js +171 -156
  26. package/Menu.js +107 -100
  27. package/Modal.js +3 -3
  28. package/Multiselect.js +2698 -2767
  29. package/Paginator.js +2 -1
  30. package/Popover.js +201 -196
  31. package/Resize.js +11 -8
  32. package/ResultsMenu.js +913 -1029
  33. package/ScreenReaderContent.js +86 -130
  34. package/Scroll.js +366 -424
  35. package/Search.js +131 -127
  36. package/Select.js +1741 -1831
  37. package/Slider.js +1 -1
  38. package/SlidingPanels.js +129 -127
  39. package/StepBar.js +123 -97
  40. package/Switch.js +214 -242
  41. package/TabBar.js +10 -10
  42. package/Table.js +1255 -1248
  43. package/Text.js +180 -206
  44. package/TextArea.js +596 -675
  45. package/Tooltip.js +144 -139
  46. package/Tree.js +638 -682
  47. package/package.json +15 -16
  48. package/tsconfig.check-docs.json +8 -0
  49. package/types/src/Avatar/docs/examples/Basic.d.ts +1 -1
  50. package/types/src/Breadcrumbs/Breadcrumbs.d.ts +1 -5
  51. package/types/src/Breadcrumbs/BreadcrumbsContext.d.ts +7 -0
  52. package/types/src/Breadcrumbs/Item.d.ts +1 -1
  53. package/types/src/ButtonSimple/mixin.d.ts +1 -1
  54. package/types/src/Checkbox/Checkbox.d.ts +90 -0
  55. package/types/src/Checkbox/docs/examples/Basic.d.ts +7 -0
  56. package/types/src/Checkbox/docs/examples/Disabled.d.ts +6 -0
  57. package/types/src/Checkbox/docs/examples/Error.d.ts +6 -0
  58. package/types/src/Checkbox/docs/examples/Uncontrolled.d.ts +7 -0
  59. package/types/src/Checkbox/index.d.ts +2 -0
  60. package/types/src/Code/Code.d.ts +4 -1
  61. package/types/src/Code/LineHighlights.d.ts +1 -0
  62. package/types/src/Code/LineNumbers.d.ts +2 -1
  63. package/types/src/Code/docs/examples/CustomizeContainer.d.ts +7 -0
  64. package/types/src/ControlGroup/docs/examples/CustomizedLabelTarget.d.ts +3 -3
  65. package/types/src/Date/Date.d.ts +7 -1
  66. package/types/src/DefinitionList/DefinitionList.d.ts +7 -2
  67. package/types/src/DefinitionList/DefinitionListContext.d.ts +1 -1
  68. package/types/src/DefinitionList/docs/examples/StackedLayout.d.ts +6 -0
  69. package/types/src/DualListbox/DualListbox.d.ts +1 -1
  70. package/types/src/DualListbox/Label.d.ts +7 -7
  71. package/types/src/DualListbox/Listbox.d.ts +2 -2
  72. package/types/src/DualListbox/ListboxContext.d.ts +1 -1
  73. package/types/src/File/File.d.ts +7 -1
  74. package/types/src/JSONTree/JSONTreeItem.d.ts +5 -3
  75. package/types/src/JSONTree/renderTreeItems.d.ts +3 -2
  76. package/types/src/Markdown/renderers/MarkdownCodeBlock.d.ts +2 -1
  77. package/types/src/Menu/docs/examples/Dimmed.d.ts +1 -1
  78. package/types/src/Menu/docs/examples/Disabled.d.ts +1 -0
  79. package/types/src/Modal/ModalContext.d.ts +1 -1
  80. package/types/src/Multiselect/Compact.d.ts +9 -3
  81. package/types/src/Multiselect/Multiselect.d.ts +7 -1
  82. package/types/src/Multiselect/Normal.d.ts +9 -3
  83. package/types/src/Number/utils.d.ts +1 -1
  84. package/types/src/Popover/getPlacement.d.ts +1 -1
  85. package/types/src/RadioList/Option.d.ts +1 -1
  86. package/types/src/RadioList/RadioListContext.d.ts +1 -1
  87. package/types/src/Search/Search.d.ts +5 -1
  88. package/types/src/StepBar/StepBar.d.ts +4 -1
  89. package/types/src/StepBar/StepBarContext.d.ts +1 -0
  90. package/types/src/StepBar/docs/examples/Vertical.d.ts +6 -0
  91. package/types/src/Switch/Switch.d.ts +13 -1
  92. package/types/src/Switch/docs/examples/Basic.d.ts +2 -10
  93. package/types/src/Switch/docs/examples/Disabled.d.ts +2 -9
  94. package/types/src/TabBar/Tab.d.ts +3 -1
  95. package/types/src/TabBar/docs/examples/Icons.d.ts +4 -0
  96. package/types/src/TabBar/docs/examples/Tooltips.d.ts +3 -0
  97. package/types/src/TabLayout/Panel.d.ts +2 -0
  98. package/types/src/Table/ExpandButton.d.ts +1 -1
  99. package/types/src/Table/Head.d.ts +1 -1
  100. package/types/src/Table/Row.d.ts +1 -1
  101. package/types/src/Table/Table.d.ts +1 -0
  102. package/types/src/Tooltip/Tooltip.d.ts +14 -1
  103. package/types/src/Tree/TreeContext.d.ts +1 -1
  104. package/useControlled.js +61 -97
  105. package/usePrevious.js +30 -62
  106. package/useResizeObserver.js +95 -127
  107. package/NonInteractiveCheckbox.js +0 -101
  108. package/types/src/CollapsiblePanel/icons/ExpandPanel.d.ts +0 -12
  109. package/types/src/NonInteractiveCheckbox/NonInteractiveCheckbox.d.ts +0 -22
  110. package/types/src/NonInteractiveCheckbox/index.d.ts +0 -1
  111. package/types/src/Switch/docs/examples/Error.d.ts +0 -6
  112. package/types/src/Text/IconOutlinedHide.d.ts +0 -3
  113. package/types/src/Text/IconOutlinedView.d.ts +0 -3
  114. /package/cypress/{tsconfig.cypress.json → tsconfig.check-cypress.json} +0 -0
package/Link.js CHANGED
@@ -99,7 +99,7 @@
99
99
  f.pickVariant)("$appearance", {
100
100
  inline: (0, c.css)([ "text-decoration:underline;" ]),
101
101
  standalone: (0, c.css)([ "font-weight:", ";" ], f.variables.fontWeightSemiBold)
102
- }), f.variables.contentColorLink, f.variables.focusShadow, f.variables.contentColorDisabled);
102
+ }), f.variables.contentColorLink, f.variables.focusShadow, f.variables.contentColorAccentWeak);
103
103
  // CONCATENATED MODULE: ./src/Link/Link.tsx
104
104
  function y() {
105
105
  return y = Object.assign ? Object.assign.bind() : function(e) {
@@ -142,19 +142,19 @@
142
142
  openInNewContext: a().oneOfType([ a().bool, a().string ]),
143
143
  to: a().string
144
144
  };
145
- var S = (0, s._)("(Opens new window)");
145
+ var k = (0, s._)("(Opens new window)");
146
146
  /**
147
147
  * `Link` is a simple method for configuring `Button` for inline links. For more complex behaviors,
148
148
  * see the `Button` documentation.
149
- */ var k = r().forwardRef((function(e,
149
+ */ var S = r().forwardRef((function(e,
150
150
  // SUI-7623 - needs to be specified for react-docgen versions less than 7.1.0
151
151
  n) {
152
152
  var t = e.appearance, o = t === void 0 ? "inline" : t, a = e.children, i = e.disabled, s = i === void 0 ? false : i, c = e.elementRef, d = e.openInNewContext, u = d === void 0 ? false : d, p = e.tag, f = p === void 0 ? "a" : p, b = e.to, g = w(e, [ "appearance", "children", "disabled", "elementRef", "openInNewContext", "tag", "to" ]);
153
153
  // @docs-props-type LinkPropsBase
154
- var m = typeof u === "string" ? u : S;
154
+ var m = typeof u === "string" ? u : k;
155
155
  // Ensure `Link` always renders as an `a` (unless overriden by `tag`) by passing a value to Clickable,
156
156
  // using '' if disabled or the to is not passed.
157
- var O = s && "" || b && b || "";
157
+ var O = f !== "button" ? s && "" || b && b || "" : undefined;
158
158
 
159
159
  return r().createElement(h, y({
160
160
  "data-test": "link",
@@ -168,8 +168,8 @@
168
168
  tag: f
169
169
  }), a, u && r().createElement(r().Fragment, null, r().createElement(v, null), r().createElement(l(), null, m)));
170
170
  }));
171
- k.propTypes = x;
172
- /* harmony default export */ const C = k;
171
+ S.propTypes = x;
172
+ /* harmony default export */ const C = S;
173
173
  // forwardRef appears to prevent TS from inferring LinkProps in components that import Link
174
174
  // so we need to export it separately to prevent the TS build from failing with:
175
175
  // "... has or is using name 'LinkPropsBase' from external module "...packages/react-ui/src/Link/Link" but cannot be named."
package/MIGRATION.md CHANGED
@@ -2,6 +2,33 @@
2
2
 
3
3
  This document lists migration guidance for new features and breaking changes.
4
4
 
5
+ ## 5.3.0
6
+
7
+ ### `Switch`'s `appearance="checkbox"` prop has been deprecated in favor of new `Checkbox` component.
8
+
9
+ #### Change
10
+ ### `Switch`'s `appearance="checkbox"` prop has been deprecated and will be removed in the next major verion.
11
+
12
+ #### Context
13
+ 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.
14
+
15
+ * `appearance="toggle"` is semantically a button, and should have an immediate effect
16
+ * `appearance="checkbox"` is semantically a checkbox, and should not take effect until a form submission or similar action has been taken
17
+
18
+ Additionally, there are several properties (error, indeterminate state) that exist as props on `Switch` despite only being supported when `appearance="checkbox"`.
19
+
20
+ Given this, we are introducing a new `<Checkbox>` component that can replace `<Switch appearance="checkbox">`.
21
+
22
+ #### Migration steps
23
+ * Replace `<Switch appearance="checkbox">` with `<Checkbox />`, and update the following props:
24
+ * replace `onClick` with `onChange`
25
+ * note that `onChange` reports the new state of the `Checkbox`, whereas `onClick` reported the old state of the `Switch`
26
+ * replace `toggleRef` with `inputRef`
27
+ * replace `selected` with `checked`
28
+ * replace `selected="some"` with `checked="indeterminate"`
29
+ * replace `selectedLabel`, `someSelectedLabel`, or `unselectedLabel` with an `aria-label` that matches `checked`
30
+ * consider whether or not these three props are necessary, and if a visible label can be used instead
31
+
5
32
  ## 5.0.0
6
33
 
7
34
  ### Component spacing