@splunk/react-ui 5.3.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 (60) hide show
  1. package/Accordion.js +31 -31
  2. package/Avatar.js +13 -13
  3. package/Breadcrumbs.js +66 -63
  4. package/ButtonSimple.js +52 -52
  5. package/CHANGELOG.md +16 -0
  6. package/CardLayout.js +39 -36
  7. package/Clickable.js +5 -6
  8. package/Code.js +424 -528
  9. package/CollapsiblePanel.js +1 -1
  10. package/Color.js +903 -1025
  11. package/DefinitionList.js +1 -1
  12. package/FormRows.js +13 -11
  13. package/JSONTree.js +682 -1408
  14. package/Link.js +5 -5
  15. package/Markdown.js +9 -5
  16. package/Menu.js +72 -67
  17. package/Multiselect.js +2692 -2780
  18. package/Popover.js +201 -196
  19. package/Resize.js +11 -8
  20. package/ResultsMenu.js +913 -1030
  21. package/ScreenReaderContent.js +86 -130
  22. package/Scroll.js +366 -425
  23. package/Select.js +1741 -1832
  24. package/Slider.js +1 -1
  25. package/SlidingPanels.js +129 -127
  26. package/StepBar.js +123 -97
  27. package/Switch.js +115 -111
  28. package/TabBar.js +10 -10
  29. package/Table.js +1239 -1240
  30. package/TextArea.js +596 -684
  31. package/Tree.js +638 -682
  32. package/package.json +11 -11
  33. package/types/src/Breadcrumbs/Breadcrumbs.d.ts +1 -5
  34. package/types/src/Breadcrumbs/BreadcrumbsContext.d.ts +7 -0
  35. package/types/src/Breadcrumbs/Item.d.ts +1 -1
  36. package/types/src/ButtonSimple/mixin.d.ts +1 -1
  37. package/types/src/JSONTree/JSONTreeItem.d.ts +1 -1
  38. package/types/src/JSONTree/renderTreeItems.d.ts +1 -1
  39. package/types/src/Modal/ModalContext.d.ts +1 -1
  40. package/types/src/Multiselect/Compact.d.ts +2 -2
  41. package/types/src/Multiselect/Normal.d.ts +2 -2
  42. package/types/src/Number/utils.d.ts +1 -1
  43. package/types/src/Popover/getPlacement.d.ts +1 -1
  44. package/types/src/RadioList/Option.d.ts +1 -1
  45. package/types/src/RadioList/RadioListContext.d.ts +1 -1
  46. package/types/src/StepBar/StepBar.d.ts +4 -1
  47. package/types/src/StepBar/StepBarContext.d.ts +1 -0
  48. package/types/src/StepBar/docs/examples/Vertical.d.ts +6 -0
  49. package/types/src/Switch/Switch.d.ts +7 -1
  50. package/types/src/TabBar/Tab.d.ts +3 -1
  51. package/types/src/TabBar/docs/examples/Icons.d.ts +4 -0
  52. package/types/src/TabBar/docs/examples/Tooltips.d.ts +3 -0
  53. package/types/src/TabLayout/Panel.d.ts +2 -0
  54. package/types/src/Table/Head.d.ts +1 -1
  55. package/types/src/Table/Row.d.ts +1 -1
  56. package/types/src/Table/Table.d.ts +1 -0
  57. package/types/src/Tree/TreeContext.d.ts +1 -1
  58. package/useControlled.js +61 -97
  59. package/usePrevious.js +30 -62
  60. package/useResizeObserver.js +95 -127
package/StepBar.js CHANGED
@@ -61,20 +61,21 @@
61
61
  e.r(t);
62
62
  // EXPORTS
63
63
  e.d(t, {
64
- Step: () => /* reexport */ A,
65
- default: () => /* reexport */ V
64
+ Step: () => /* reexport */ N,
65
+ default: () => /* reexport */ D
66
66
  });
67
67
  // CONCATENATED MODULE: external "react"
68
68
  const r = require("react");
69
69
  var n = e.n(r);
70
70
  // CONCATENATED MODULE: external "prop-types"
71
71
  const a = require("prop-types");
72
- var o = e.n(a);
72
+ var i = e.n(a);
73
73
  // CONCATENATED MODULE: external "@splunk/ui-utils/id"
74
- const i = require("@splunk/ui-utils/id");
74
+ const o = require("@splunk/ui-utils/id");
75
75
  // CONCATENATED MODULE: ./src/StepBar/StepBarContext.tsx
76
76
  var l = (0, r.createContext)({
77
- activeStepId: 0
77
+ activeStepId: 0,
78
+ orientation: "horizontal"
78
79
  });
79
80
  l.displayName = "StepBar";
80
81
  /* harmony default export */ const c = l;
@@ -90,21 +91,24 @@
90
91
  // CONCATENATED MODULE: external "@splunk/themes"
91
92
  const b = require("@splunk/themes");
92
93
  // CONCATENATED MODULE: ./src/StepBar/StepStyles.ts
93
- var y = "2px";
94
- var m = "24px";
94
+ var m = "2px";
95
+ var y = "24px";
95
96
  var g = "10px";
96
97
  /* half of the actual rendered svg size (20px) */ var h = (0,
97
- s.css)([ "height:", ";width:", ";" ], m, m);
98
+ s.css)([ "height:", ";width:", ";" ], y, y);
98
99
  var C = p().div.withConfig({
99
100
  displayName: "StepStyles__StyledBar",
100
101
  componentId: "sc-756fxp-0"
101
- })([ "position:absolute;top:10px;height:", ";width:100%;&::before,&::after{content:'';display:block;height:", ";}" ], y, y);
102
+ })([ "position:absolute;top:10px;height:", ";width:100%;&::before,&::after{content:'';display:block;height:", ";}" ], m, m);
102
103
  var S = p().li.withConfig({
103
104
  displayName: "StepStyles__Styled",
104
105
  componentId: "sc-756fxp-1"
105
- })([ "", ";display:grid;gap:", ";grid-template-rows:auto 1fr;justify-items:center;min-width:min-content;position:relative;overflow:hidden;text-align:center;color:", ";counter-increment:", ";&:not(:first-of-type){", "{&::before{box-shadow:inset 500px 0 ", ";width:calc(50% - ", ");}}}&:not(:last-of-type){", "{&::after{width:50%;position:absolute;top:0;box-shadow:inset 500px 0 ", ";left:calc(50% + ", ");}}}" ], b.mixins.typography("body", {
106
+ })([ "", ";display:grid;", " min-width:min-content;position:relative;overflow:hidden;color:", ";counter-increment:", ";&:not(:first-of-type){", "{&::before{box-shadow:inset 500px 0 ", ";width:calc(50% - ", ");}}}&:not(:last-of-type){", "{&::after{width:50%;position:absolute;top:0;box-shadow:inset 500px 0 ", ";inset-inline-start:calc(50% + ", ");}}}" ], b.mixins.typography("body", {
106
107
  weight: "semiBold"
107
- }), b.variables.spacingXSmall, (0, b.pickVariant)("$status", {
108
+ }), (0, b.pickVariant)("$orientation", {
109
+ horizontal: (0, s.css)([ "grid-template-rows:auto 1fr;row-gap:", ";justify-items:center;" ], b.variables.spacingXSmall),
110
+ vertical: (0, s.css)([ "grid-template-rows:1lh auto;grid-template-columns:auto 1fr;column-gap:", ";align-items:center;" ], b.variables.spacingMedium)
111
+ }), (0, b.pickVariant)("$status", {
108
112
  error: b.variables.contentColorActive,
109
113
  active: b.variables.contentColorAccent,
110
114
  next: b.variables.contentColorDefault,
@@ -123,33 +127,42 @@
123
127
  next: b.variables.borderColor,
124
128
  prev: b.variables.contentColorAccent
125
129
  }), g);
126
- var x = "16px";
127
- var w = p().span.withConfig({
128
- displayName: "StepStyles__StyledCircle",
130
+ var x = p().div.withConfig({
131
+ displayName: "StepStyles__StyledStepIndicatorWrapper",
129
132
  componentId: "sc-756fxp-2"
130
- })([ "display:grid;height:", ";width:", ";border-radius:50%;margin:2px;", " &::before{content:counter(", ");line-height:", ";}" ], x, x, (0,
133
+ })([ "", "" ], (0, b.pickVariant)("$orientation", {
134
+ vertical: (0, s.css)([ "grid-row:1;" ])
135
+ }));
136
+ var w = "16px";
137
+ var O = p().span.withConfig({
138
+ displayName: "StepStyles__StyledCircle",
139
+ componentId: "sc-756fxp-3"
140
+ })([ "display:grid;height:", ";width:", ";border-radius:50%;margin:2px;", " &::before{content:counter(", ");line-height:", ";text-align:center;}" ], w, w, (0,
131
141
  b.pickVariant)("$status", {
132
142
  active: (0, s.css)([ "background-color:", ";border:2px solid ", ";color:", ";" ], b.variables.contentColorAccent, b.variables.contentColorAccent, b.variables.contentColorInverted),
133
143
  next: (0, s.css)([ "border:2px solid ", ";color:", ";" ], b.variables.contentColorDefault, b.variables.contentColorDefault)
134
144
  }), (function(e) {
135
145
  var t = e.$idCounter;
136
146
  return t;
137
- }), x);
138
- var O = p()(u()).withConfig({
147
+ }), w);
148
+ var I = p()(u()).withConfig({
139
149
  displayName: "StepStyles__StyledCheckCircleIcon",
140
- componentId: "sc-756fxp-3"
150
+ componentId: "sc-756fxp-4"
141
151
  })([ "", ";color:", ";" ], h, b.variables.contentColorAccent);
142
- var I = p()(f()).withConfig({
152
+ var $ = p()(f()).withConfig({
143
153
  displayName: "StepStyles__StyledExclamationCircleIcon",
144
- componentId: "sc-756fxp-4"
154
+ componentId: "sc-756fxp-5"
145
155
  })([ "", ";color:", ";" ], h, b.variables.contentColorNegative);
146
156
  var _ = p().span.withConfig({
147
157
  displayName: "StepStyles__StyledStepLabel",
148
- componentId: "sc-756fxp-5"
149
- })([ "padding-inline:calc(", " / 2);" ], b.variables.spacingXXLarge);
158
+ componentId: "sc-756fxp-6"
159
+ })([ "", "" ], (0, b.pickVariant)("$orientation", {
160
+ horizontal: (0, s.css)([ "padding-inline:calc(", " / 2);text-align:center;" ], b.variables.spacingXXLarge),
161
+ vertical: (0, s.css)([ "grid-row:1 / -1;" ])
162
+ }));
150
163
  // CONCATENATED MODULE: ./src/StepBar/Step.tsx
151
- function $() {
152
- return $ = Object.assign ? Object.assign.bind() : function(e) {
164
+ function k() {
165
+ return k = Object.assign ? Object.assign.bind() : function(e) {
153
166
  for (var t = 1; t < arguments.length; t++) {
154
167
  var r = arguments[t];
155
168
  for (var n in r) {
@@ -157,15 +170,15 @@
157
170
  }
158
171
  }
159
172
  return e;
160
- }, $.apply(null, arguments);
173
+ }, k.apply(null, arguments);
161
174
  }
162
175
  function E(e, t) {
163
176
  if (null == e) return {};
164
177
  var r, n, a = j(e, t);
165
178
  if (Object.getOwnPropertySymbols) {
166
- var o = Object.getOwnPropertySymbols(e);
167
- for (n = 0; n < o.length; n++) {
168
- r = o[n], -1 === t.indexOf(r) && {}.propertyIsEnumerable.call(e, r) && (a[r] = e[r]);
179
+ var i = Object.getOwnPropertySymbols(e);
180
+ for (n = 0; n < i.length; n++) {
181
+ r = i[n], -1 === t.indexOf(r) && {}.propertyIsEnumerable.call(e, r) && (a[r] = e[r]);
169
182
  }
170
183
  }
171
184
  return a;
@@ -182,63 +195,73 @@
182
195
  return r;
183
196
  }
184
197
  var P = {
185
- children: o().node,
186
- elementRef: o().oneOfType([ o().func, o().object ]),
187
- error: o().bool,
188
- stepId: o().any
198
+ children: i().node,
199
+ elementRef: i().oneOfType([ i().func, i().object ]),
200
+ error: i().bool,
201
+ stepId: i().any
189
202
  };
190
- function k(e) {
191
- var t = e.children, a = e.elementRef, o = e.error, i = o === void 0 ? false : o, c = e.stepId, s = E(e, [ "children", "elementRef", "error", "stepId" ]);
203
+ function A(e) {
204
+ var t = e.children, a = e.elementRef, i = e.error, o = i === void 0 ? false : i, c = e.stepId, s = E(e, [ "children", "elementRef", "error", "stepId" ]);
192
205
  // @docs-props-type StepPropsBase
193
- var p = (0, r.useContext)(l), d = p.activeStepId, u = p.idCounter;
194
- var v = "next";
195
- var f = d === c;
206
+ var p = (0, r.useContext)(l), d = p.activeStepId, u = p.idCounter, v = p.orientation;
207
+ var f = "next";
208
+ var b = d === c;
196
209
  if (c != null && c < d) {
197
- v = "prev";
210
+ f = "prev";
198
211
  }
199
- if (f && !i) {
200
- v = "active";
212
+ if (b && !o) {
213
+ f = "active";
201
214
  }
202
- if (f && i) {
203
- v = "error";
215
+ if (b && o) {
216
+ f = "error";
204
217
  }
205
- var b = {
206
- error: n().createElement(I, null),
207
- prev: n().createElement(O, null),
208
- next: n().createElement(w, {
209
- $status: v,
218
+ var m = {
219
+ error: n().createElement($, null),
220
+ prev: n().createElement(I, null),
221
+ next: n().createElement(O, {
222
+ $status: f,
210
223
  $idCounter: u
211
224
  }),
212
- active: n().createElement(w, {
213
- $status: v,
225
+ active: n().createElement(O, {
226
+ $status: f,
214
227
  $idCounter: u
215
228
  })
216
229
  };
217
230
 
218
- return n().createElement(S, $({
219
- $status: v,
220
- "data-test-status": v,
231
+ return n().createElement(S, k({
232
+ $status: f,
233
+ "data-test-status": f,
221
234
  "data-test": "step",
222
235
  "data-test-step-id": c,
223
236
  ref: a
224
237
  }, s, {
225
- $idCounter: u
226
- }), n().createElement(C, {
227
- $status: v
228
- }), n().createElement("div", null, b[v]), n().createElement(_, null, t));
238
+ $idCounter: u,
239
+ $orientation: v
240
+ }), v === "horizontal" && n().createElement(C, {
241
+ $status: f
242
+ }), n().createElement(x, {
243
+ $orientation: v
244
+ }, m[f]), n().createElement(_, {
245
+ $orientation: v
246
+ }, t));
229
247
  }
230
- k.propTypes = P;
231
- /* harmony default export */ const A = k;
248
+ A.propTypes = P;
249
+ /* harmony default export */ const N = A;
232
250
  // CONCATENATED MODULE: ./src/StepBar/StepBarStyles.ts
233
- var N = p().ul.withConfig({
251
+ var V = p().ul.withConfig({
234
252
  displayName: "StepBarStyles__Styled",
235
253
  componentId: "sc-13bf2x4-0"
236
- })([ "", ";grid-auto-flow:column;padding:", ";counter-reset:", ";", ";" ], b.mixins.reset("grid"), b.variables.spacingXLarge, (function(e) {
254
+ })([ "", ";", " counter-reset:", ";", ";" ], b.mixins.reset("grid"), (0, b.pickVariant)("$orientation", {
255
+ horizontal: (0, s.css)([ "grid-auto-flow:column;padding:", ";" ], b.variables.spacingXLarge),
256
+ vertical: (0, s.css)([ "gap:", ";" ], b.variables.spacingXLarge)
257
+ }), (function(e) {
237
258
  var t = e.$idCounter;
238
259
  return t;
239
260
  }), (function(e) {
240
261
  var t = e.$inline;
241
- return t && (0, s.css)([ "display:inline-flex;" ]);
262
+ return t && (0, s.css)([ "display:inline-flex;", "" ], (0, b.pickVariant)("$orientation", {
263
+ vertical: (0, s.css)([ "display:inline-grid;" ])
264
+ }));
242
265
  }));
243
266
  // CONCATENATED MODULE: ./src/StepBar/StepBar.tsx
244
267
  function q() {
@@ -254,16 +277,16 @@
254
277
  }
255
278
  function R(e, t) {
256
279
  if (null == e) return {};
257
- var r, n, a = T(e, t);
280
+ var r, n, a = z(e, t);
258
281
  if (Object.getOwnPropertySymbols) {
259
- var o = Object.getOwnPropertySymbols(e);
260
- for (n = 0; n < o.length; n++) {
261
- r = o[n], -1 === t.indexOf(r) && {}.propertyIsEnumerable.call(e, r) && (a[r] = e[r]);
282
+ var i = Object.getOwnPropertySymbols(e);
283
+ for (n = 0; n < i.length; n++) {
284
+ r = i[n], -1 === t.indexOf(r) && {}.propertyIsEnumerable.call(e, r) && (a[r] = e[r]);
262
285
  }
263
286
  }
264
287
  return a;
265
288
  }
266
- function T(e, t) {
289
+ function z(e, t) {
267
290
  if (null == e) return {};
268
291
  var r = {};
269
292
  for (var n in e) {
@@ -274,56 +297,59 @@
274
297
  }
275
298
  return r;
276
299
  }
277
- var D = {
278
- activeStepId: o().any.isRequired,
279
- children: o().node,
280
- elementRef: o().oneOfType([ o().func, o().object ]),
281
- inline: o().bool
300
+ var M = {
301
+ activeStepId: i().any.isRequired,
302
+ children: i().node,
303
+ elementRef: i().oneOfType([ i().func, i().object ]),
304
+ inline: i().bool,
305
+ orientation: i().oneOf([ "horizontal", "vertical" ])
282
306
  };
283
- function M(e) {
284
- var t = e.activeStepId, a = e.children, o = e.elementRef, l = e.inline, s = l === void 0 ? false : l, p = R(e, [ "activeStepId", "children", "elementRef", "inline" ]);
307
+ function T(e) {
308
+ var t = e.activeStepId, a = e.children, i = e.elementRef, l = e.inline, s = l === void 0 ? false : l, p = e.orientation, d = p === void 0 ? "horizontal" : p, u = R(e, [ "activeStepId", "children", "elementRef", "inline", "orientation" ]);
285
309
  // @docs-props-type StepBarPropsBase
286
- var d = (0, r.useRef)((0, i.createDOMID)("stepbar")), u = d.current;
287
- var v = 0;
288
- var f = r.Children.toArray(a).filter(r.isValidElement);
289
- var b = f.length - 1;
290
- var y = f.map((function(e, n) {
310
+ var v = (0, r.useRef)((0, o.createDOMID)("stepbar")), f = v.current;
311
+ var b = 0;
312
+ var m = r.Children.toArray(a).filter(r.isValidElement);
313
+ var y = m.length - 1;
314
+ var g = m.map((function(e, n) {
291
315
  var a = e.props.stepId || n;
292
- var o = e.props.error;
316
+ var i = e.props.error;
293
317
  if (a === t) {
294
- v = n;
318
+ b = n;
295
319
  }
296
320
 
297
321
  return (0, r.cloneElement)(e, {
298
322
  stepId: a,
299
- error: o
323
+ error: i
300
324
  });
301
325
  }));
302
- var m = (0, r.useMemo)((function() {
326
+ var h = (0, r.useMemo)((function() {
303
327
  return {
304
- idCounter: u,
305
- lastChildIndex: b,
306
- activeStepId: t
328
+ idCounter: f,
329
+ lastChildIndex: y,
330
+ activeStepId: t,
331
+ orientation: d
307
332
  };
308
- }), [ t, u, b ]);
333
+ }), [ t, f, y, d ]);
309
334
 
310
- return n().createElement(N, q({
335
+ return n().createElement(V, q({
311
336
  $inline: s,
312
337
  "data-test": "step-bar",
313
338
  "data-test-active-step-id": t,
314
339
  role: "progressbar",
315
340
  "aria-valuemin": 1,
316
- "aria-valuemax": b + 1,
317
- "aria-valuenow": v + 1,
318
- $idCounter: u,
319
- ref: o
320
- }, p), n().createElement(c.Provider, {
321
- value: m
322
- }, y));
341
+ "aria-valuemax": y + 1,
342
+ "aria-valuenow": b + 1,
343
+ $idCounter: f,
344
+ $orientation: d,
345
+ ref: i
346
+ }, u), n().createElement(c.Provider, {
347
+ value: h
348
+ }, g));
323
349
  }
324
- M.propTypes = D;
325
- M.Step = A;
326
- /* harmony default export */ const V = M;
350
+ T.propTypes = M;
351
+ T.Step = N;
352
+ /* harmony default export */ const D = T;
327
353
  // CONCATENATED MODULE: ./src/StepBar/index.ts
328
354
  module.exports = t;
329
355
  /******/})();