@splunk/react-ui 4.25.0 → 4.27.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 (41) hide show
  1. package/Accordion.js +195 -212
  2. package/Breadcrumbs.js +65 -42
  3. package/CHANGELOG.md +45 -4
  4. package/CollapsiblePanel.js +554 -325
  5. package/Color.js +3 -1
  6. package/ControlGroup.js +1 -0
  7. package/MIGRATION.mdx +78 -0
  8. package/Modal.js +53 -33
  9. package/Table.js +2419 -2600
  10. package/Text.js +30 -40
  11. package/TextArea.js +304 -392
  12. package/package.json +5 -3
  13. package/types/src/Accordion/Accordion.d.ts +2 -2
  14. package/types/src/Accordion/AccordionContext.d.ts +2 -3
  15. package/types/src/Breadcrumbs/Breadcrumbs.d.ts +18 -2
  16. package/types/src/Breadcrumbs/Item.d.ts +7 -1
  17. package/types/src/Breadcrumbs/docs/examples/CustomizedClick.d.ts +2 -0
  18. package/types/src/CollapsiblePanel/CollapsiblePanel.d.ts +49 -15
  19. package/types/src/CollapsiblePanel/SingleOpenPanelGroup.d.ts +62 -0
  20. package/types/src/CollapsiblePanel/SingleOpenPanelGroupContext.d.ts +9 -0
  21. package/types/src/CollapsiblePanel/docs/examples/MultiControlled.d.ts +2 -2
  22. package/types/src/CollapsiblePanel/docs/examples/SingleOpenPanelGroupControlled.d.ts +2 -0
  23. package/types/src/CollapsiblePanel/docs/examples/SingleOpenPanelGroupUncontrolled.d.ts +2 -0
  24. package/types/src/CollapsiblePanel/icons/ExpandPanel.d.ts +7 -5
  25. package/types/src/Modal/Header.d.ts +6 -5
  26. package/types/src/Modal/Modal.d.ts +9 -2
  27. package/types/src/Table/Body.d.ts +26 -22
  28. package/types/src/Table/Cell.d.ts +3 -1
  29. package/types/src/Table/Head.d.ts +2 -2
  30. package/types/src/Table/HeadCell.d.ts +2 -0
  31. package/types/src/Table/Row.d.ts +50 -17
  32. package/types/src/Table/RowDragCell.d.ts +23 -42
  33. package/types/src/Table/Table.d.ts +29 -79
  34. package/types/src/Table/Toggle.d.ts +4 -4
  35. package/types/src/TextArea/TextArea.d.ts +1 -0
  36. package/types/src/fixtures/text.d.ts +1 -0
  37. package/types/src/CollapsiblePanel/docs/examples/prisma/BasicControlled.d.ts +0 -2
  38. package/types/src/CollapsiblePanel/docs/examples/prisma/BasicUncontrolled.d.ts +0 -2
  39. package/types/src/CollapsiblePanel/docs/examples/prisma/Content.d.ts +0 -1
  40. package/types/src/CollapsiblePanel/docs/examples/prisma/MultiControlled.d.ts +0 -2
  41. package/types/src/CollapsiblePanel/docs/examples/prisma/MultiUncontrolled.d.ts +0 -2
package/Breadcrumbs.js CHANGED
@@ -61,7 +61,8 @@
61
61
  e.r(r);
62
62
  // EXPORTS
63
63
  e.d(r, {
64
- Item: () => /* reexport */ h,
64
+ BreadcrumbsContext: () => /* reexport */ E,
65
+ Item: () => /* reexport */ O,
65
66
  default: () => /* reexport */ q
66
67
  });
67
68
  // CONCATENATED MODULE: external "react"
@@ -74,14 +75,14 @@
74
75
  const l = require("@splunk/ui-utils/i18n");
75
76
  // CONCATENATED MODULE: external "styled-components"
76
77
  const i = require("styled-components");
77
- var s = e.n(i);
78
+ var c = e.n(i);
78
79
  // CONCATENATED MODULE: external "@splunk/themes"
79
80
  const u = require("@splunk/themes");
80
81
  // CONCATENATED MODULE: external "@splunk/react-ui/Link"
81
- const c = require("@splunk/react-ui/Link");
82
- var f = e.n(c);
82
+ const s = require("@splunk/react-ui/Link");
83
+ var f = e.n(s);
83
84
  // CONCATENATED MODULE: ./src/Breadcrumbs/ItemStyles.ts
84
- var d = s()(f()).withConfig({
85
+ var d = c()(f()).withConfig({
85
86
  displayName: "ItemStyles__StyledLink",
86
87
  componentId: "sc-1ywtawf-0"
87
88
  })([ "display:flex;align-items:center;gap:", ";white-space:nowrap;color:", ";&:where(:hover,:focus):not([disabled],[aria-disabled='true']){color:", ";}" ], u.variables.spacingXSmall, u.variables.contentColorDefault, u.variables.contentColorActive);
@@ -102,7 +103,7 @@
102
103
  }
103
104
  function b(e, r) {
104
105
  if (e == null) return {};
105
- var t = m(e, r);
106
+ var t = v(e, r);
106
107
  var n, a;
107
108
  if (Object.getOwnPropertySymbols) {
108
109
  var o = Object.getOwnPropertySymbols(e);
@@ -115,7 +116,7 @@
115
116
  }
116
117
  return t;
117
118
  }
118
- function m(e, r) {
119
+ function v(e, r) {
119
120
  if (e == null) return {};
120
121
  var t = {};
121
122
  var n = Object.keys(e);
@@ -127,7 +128,7 @@
127
128
  }
128
129
  return t;
129
130
  }
130
- var v = Object.freeze({
131
+ var m = Object.freeze({
131
132
  allowDisabledLink: true,
132
133
  disabled: true,
133
134
  to: ""
@@ -138,6 +139,7 @@
138
139
  endAdornment: o().node,
139
140
  isCurrent: o().bool,
140
141
  label: o().string.isRequired,
142
+ onClick: o().func,
141
143
  startAdornment: o().node,
142
144
  to: o().string.isRequired
143
145
  };
@@ -145,42 +147,56 @@
145
147
  enableCurrentPage: false,
146
148
  isCurrent: false
147
149
  };
148
- function O(e) {
149
- var r = e.enableCurrentPage, t = e.endAdornment, a = e.isCurrent, o = e.label, l = e.startAdornment, i = e.to, s = b(e, [ "enableCurrentPage", "endAdornment", "isCurrent", "label", "startAdornment", "to" ]);
150
+ function C(e) {
151
+ var r = e.enableCurrentPage, a = e.endAdornment, o = e.isCurrent, l = e.label, i = e.onClick, c = e.startAdornment, u = e.to, s = b(e, [ "enableCurrentPage", "endAdornment", "isCurrent", "label", "onClick", "startAdornment", "to" ]);
150
152
  // @docs-props-type ItemPropsBase
151
- var u = {
152
- to: i
153
+ var f = (0, t.useContext)(E), v = f.onClick;
154
+ var y = {
155
+ to: u
153
156
  };
154
- if (a) {
155
- u["aria-current"] = "page";
157
+ var g = (0, t.useCallback)((function(e) {
158
+ i === null || i === void 0 ? void 0 : i(e, {
159
+ label: l,
160
+ to: u
161
+ });
162
+ v === null || v === void 0 ? void 0 : v(e, {
163
+ label: l,
164
+ to: u
165
+ });
166
+ }), [ i, v, l, u ]);
167
+ if (o) {
168
+ y["aria-current"] = "page";
156
169
  if (!r) {
157
- Object.assign(u, v);
170
+ Object.assign(y, m);
158
171
  }
159
172
  }
173
+ var C = i || v ? {
174
+ onClick: g
175
+ } : {};
160
176
 
161
177
  return n().createElement(d, p({
162
178
  "data-test": "item"
163
- }, u, s), l && l, o, t && t);
179
+ }, C, y, s), c && c, l, a && a);
164
180
  }
165
- O.propTypes = y;
166
- O.defaultProps = g;
167
- /* harmony default export */ const h = O;
181
+ C.propTypes = y;
182
+ C.defaultProps = g;
183
+ /* harmony default export */ const O = C;
168
184
  // CONCATENATED MODULE: ./src/Breadcrumbs/BreadcrumbsStyles.ts
169
- var C = s().ol.withConfig({
185
+ var h = c().ol.withConfig({
170
186
  displayName: "BreadcrumbsStyles__StyledList",
171
187
  componentId: "sc-1maeyfk-0"
172
188
  })([ "", " flex-wrap:wrap;" ], u.mixins.reset("flex"));
173
- var w = s().li.withConfig({
189
+ var k = c().li.withConfig({
174
190
  displayName: "BreadcrumbsStyles__StyledListItem",
175
191
  componentId: "sc-1maeyfk-1"
176
192
  })([ "display:flex;min-width:max-content;a[aria-current]{font-weight:", ";color:", ";cursor:default;}" ], u.variables.fontWeightSemiBold, u.variables.contentColorActive);
177
- var P = s().span.withConfig({
193
+ var P = c().span.withConfig({
178
194
  displayName: "BreadcrumbsStyles__StyledSeparator",
179
195
  componentId: "sc-1maeyfk-2"
180
196
  })([ "cursor:default;padding:0 ", ";color:", ";" ], u.variables.spacingSmall, u.variables.contentColorDefault);
181
197
  // CONCATENATED MODULE: ./src/Breadcrumbs/Breadcrumbs.tsx
182
- function S() {
183
- S = Object.assign || function(e) {
198
+ function w() {
199
+ w = Object.assign || function(e) {
184
200
  for (var r = 1; r < arguments.length; r++) {
185
201
  var t = arguments[r];
186
202
  for (var n in t) {
@@ -191,11 +207,11 @@
191
207
  }
192
208
  return e;
193
209
  };
194
- return S.apply(this, arguments);
210
+ return w.apply(this, arguments);
195
211
  }
196
- function j(e, r) {
212
+ function S(e, r) {
197
213
  if (e == null) return {};
198
- var t = _(e, r);
214
+ var t = j(e, r);
199
215
  var n, a;
200
216
  if (Object.getOwnPropertySymbols) {
201
217
  var o = Object.getOwnPropertySymbols(e);
@@ -208,7 +224,7 @@
208
224
  }
209
225
  return t;
210
226
  }
211
- function _(e, r) {
227
+ function j(e, r) {
212
228
  if (e == null) return {};
213
229
  var t = {};
214
230
  var n = Object.keys(e);
@@ -220,44 +236,51 @@
220
236
  }
221
237
  return t;
222
238
  }
223
- var k = {
239
+ var x = {
224
240
  children: o().node.isRequired,
225
241
  elementRef: o().oneOfType([ o().func, o().object ]),
226
- enableCurrentPage: o().bool
242
+ enableCurrentPage: o().bool,
243
+ onClick: o().func
227
244
  };
228
- var x = {
245
+ var _ = {
229
246
  enableCurrentPage: false
230
247
  };
248
+ var E = n().createContext({});
231
249
  function I(e) {
232
- var r = e.children, a = e.elementRef, o = e.enableCurrentPage, i = j(e, [ "children", "elementRef", "enableCurrentPage" ]);
250
+ var r = e.children, a = e.elementRef, o = e.enableCurrentPage, i = e.onClick, c = S(e, [ "children", "elementRef", "enableCurrentPage", "onClick" ]);
233
251
  // @docs-props-type BreadcrumbsPropsBase
234
- var s;
235
- var u = t.Children.toArray(r).filter(t.isValidElement).map((function(e, a) {
252
+ var u;
253
+ var s = t.Children.toArray(r).filter(t.isValidElement).map((function(e, a) {
236
254
  if (false) {}
237
255
  if (false) {}
238
- // Set the last child as the current Breadcrumb.Item
256
+ // Set the last child as the current Breadcrumbs.Item
239
257
  var l = a === t.Children.count(r) - 1;
240
258
  var i = (0, t.cloneElement)(e, {
241
259
  isCurrent: l,
242
260
  enableCurrentPage: o
243
261
  });
244
262
 
245
- return n().createElement(w, {
263
+ return n().createElement(k, {
246
264
  key: e.props.to
247
265
  }, i, !l && n().createElement(P, {
248
266
  "aria-hidden": "true"
249
267
  }, "/"));
250
268
  }));
269
+ var f = {
270
+ onClick: i
271
+ };
251
272
 
252
- return n().createElement("nav", S({
273
+ return n().createElement(E.Provider, {
274
+ value: f
275
+ }, n().createElement("nav", w({
253
276
  "data-test": "breadcrumbs",
254
- "aria-label": (0, l._)("Breadcrumb"),
277
+ "aria-label": (0, l._)("Breadcrumbs"),
255
278
  ref: a
256
- }, i), n().createElement(C, null, u));
279
+ }, c), n().createElement(h, null, s)));
257
280
  }
258
- I.propTypes = k;
259
- I.defaultProps = x;
260
- I.Item = h;
281
+ I.propTypes = x;
282
+ I.defaultProps = _;
283
+ I.Item = O;
261
284
  /* harmony default export */ const q = I;
262
285
  // CONCATENATED MODULE: ./src/Breadcrumbs/index.ts
263
286
  module.exports = r;
package/CHANGELOG.md CHANGED
@@ -1,14 +1,54 @@
1
1
  Change Log
2
2
  ============
3
3
 
4
+ 4.27.0 - TBD
5
+ ----------
6
+ New Features:
7
+ * `CollapsiblePanel` now supports functionalities of `Accordion` (SUI-5719):
8
+ * The new `SingleOpenPanelGroup` component can be used wrap multiple `CollapsiblePanel` to replicate the expand/collapse behavior of `Accordion`.
9
+ * `CollapsiblePanel` supports a new `inset` prop with similar functionality as the same prop in `Accordion`.
10
+ * A new `onChange` prop consolidates the callback behavior of the `onRequestClose` and `onRequestOpen` props.
11
+ * The separate `onRequestClose` and `onRequestOpen` props have been deprecated and will be removed in the next major version.
12
+ * `ControlGroup` now supports `data-test-required` test hook. (SUI-6067).
13
+
14
+ Bug Fixes:
15
+ * `Text`'s focus style has been replaced with `@splunk/theme`'s `focusShadow` in Prisma themes to have a visible focus indicator (WCAG SC 2.4.7) (SUI-5321).
16
+ * Error state is now visible when inputs are focused.
17
+ * This change also affects the following components: `Combobox`, `Date`, `TextArea`, `Number`, `Select`'s and `Mutltiselect`'s filters, and `Search`.
18
+ * `Table`'s column resize handle is now correctly announced by screen readers (SUI-5967).
19
+ * The element has been changed from a `button` to an `hr` to have the correct role of `separator`.
20
+ * `Table`'s selectable row checkboxes are now accessible with VoiceOver keys (SUI-5958).
21
+ * `Table`'s selectable row checkboxes will no longer receive focus when the row is `disabled` (SUI-5824).
22
+ * `CollapsiblePanel`'s toggle has consistent spacing and improved focus styling when `titleWithActions` is enabled(SUI-5433).
23
+
24
+ Typescript:
25
+ * The `event` type for `TableRequestResizeColumnHandler` in the `Table` has been changed from a `button` event type to an `hr` event type: `event: React.MouseEvent<HTMLHRElement> | React.KeyboardEvent<HTMLHRElement> | MouseEvent`.
26
+
27
+ 4.26.0 - Feb 21, 2024
28
+ ----------
29
+ New Features:
30
+ * `Modal` automatically returns focus to the invoking element after close when a ref is provided to the new prop `returnFocus` (SUI-2834).
31
+ * `Breadcrumbs` and `Breadcrumbs.Item` now support `onClick` prop (SUI-5911).
32
+
33
+ Bug Fixes:
34
+ * `TextArea`'s test selector is now `data-test="text-area"` rather than `data-test="text"` (SUI-5964).
35
+ * The icon in `Modal.Header` is now aligned with the top of the title (SUI-5930).
36
+ * `TextArea` renders at the correct size when `minRows={1}` (SUI-6010).
37
+ * `TextArea` has consistent height when rendering rows regardless if value is present.
38
+ * Fixed spurious deprecation warnings for `canClear` and `placeholder` props in `TextArea`.
39
+ * Fixed regression in `TextArea` where placeholder text could be cut off.
40
+
41
+ API Changes:
42
+ * Corrected the type of `Modal`'s `initialFocus` prop to include `React.Component & { focus: () => void }` instead of `React.Component & { focus: () => {} }`.
43
+
4
44
  4.25.0 - Feb 6, 2024
5
45
  ----------
6
- New Features:
7
- * Modal supports `subtitle` and `icon` props in Enterprise themes (SUI-5924).
46
+ New Features:
47
+ * `Modal` supports `subtitle` and `icon` props in Enterprise themes (SUI-5924).
8
48
  * `Button` now supports a new `"dimmed"` value for the `disabled` prop (SUI-5819).
9
49
 
10
50
  Bug Fixes:
11
- * Modal `subtitle` is used as the accessible description for the dialog (SUI-5264).
51
+ * `Modal`'s `subtitle` is used as the accessible description for the dialog (SUI-5264).
12
52
  * `Color`'s `required` attribute is correctly applied when inside a `ControlGroup` in Prisma themes (SUI-5386).
13
53
  * `RadioList`'s `required` attribute is correctly applied when inside a `ControlGroup` (SUI-5386).
14
54
 
@@ -30,6 +70,7 @@ New Features:
30
70
  Bug Fixes:
31
71
  * The system color picker for `Color` no longer closes unexpectedly during color selection in Safari (SUI-5831).
32
72
  * `ComboBox`'s options are no longer clickable while closing (SUI-5825).
73
+ * Improved the row drag and drop experience and performance by adopting `@dnd-kit` in `Table` component (SUI-5134).
33
74
 
34
75
  Deprecations:
35
76
  * `JSONTree`'s `expandChildren="withShiftModifier"` value has been deprecated and will be removed in a future major version. Use the `expandChildrenOnShiftKey` prop instead (SUI-5771).
@@ -87,7 +128,7 @@ Docs:
87
128
  4.20.0 - September 5, 2023
88
129
  ----------
89
130
  New Features:
90
- * New `Breacrumbs` component (SUI-1819).
131
+ * New `Breadcrumbs` component (SUI-1819).
91
132
  * `Code` now supports `language="splunk-spl"` (SUI-5737).
92
133
 
93
134
  Bug Fixes: