@splunk/react-ui 4.28.1 → 4.29.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.
package/MIGRATION.mdx CHANGED
@@ -5,6 +5,29 @@ import Table from '@splunk/react-ui/Table';
5
5
 
6
6
  This document lists migration guidance for new features and breaking changes.
7
7
 
8
+ ## 4.29.0
9
+
10
+ ### Deprecated `WaitSpinner`'s `children` prop
11
+
12
+ #### Change
13
+
14
+ `WaitSpinner`'s `children` prop has been deprecated and will be removed in the next major version.
15
+
16
+ #### Context
17
+
18
+ `WaitSpinner` does not support `children` and the prop was not applied in the render of the component. This was properly documented in the TypeScript API as: `children?: never;`. But due to a documentation bug this was not as explicit in the PropTypes documentation.
19
+
20
+ #### Migration steps
21
+
22
+ Remove all usage of `WaitSpinner`'s `children` prop. To render a message beside the wait spinner, render a sibling text element and set `screenReaderText` to `null`.
23
+
24
+ Example with a sibling text element:
25
+
26
+ ```jsx
27
+ <WaitSpinner screenReaderText={null} />
28
+ <p>Loading logs</p>
29
+ ```
30
+
8
31
  ## 4.27.0
9
32
 
10
33
  ### New `SingleOpenPanelGroup` API for `CollapsiblePanel`
@@ -161,6 +184,73 @@ No styling is needed.
161
184
  <Heading level="ss"> is equivalent to <StyledSHeading level={5} variant="title5"/>
162
185
  ```
163
186
 
187
+ ## 4.17.1
188
+
189
+ ### `TextArea`'s `canClear` prop has been deprecated
190
+
191
+ #### Context
192
+ The clear button causes styling issues in TextArea that made it undesirable to support. When the scrollbar appears in a TextArea the clear button is positioned outside, which causes excessive negative space between the input border and scrollbar. This feature is supported in `Text` and `Search` but those components do not run into the styling issues because they do not have scrollbars.
193
+
194
+ Additionally, when entering text into a `TextArea` users can clear the contents using "Select all" via keyboard shortcut or mouse selection. These are natively supported actions and don't require a custom control. It was uncommon to see a clear button in other text areas when doing competitive analysis of other design systems.
195
+
196
+ #### Migration Step
197
+
198
+ Remove the `canClear` prop from `TextArea`. If supporting a one-click clear action is critical, there are two possible methods to add this feature:
199
+
200
+ 1) Use the `endAdornment` prop:
201
+
202
+ ```jsx
203
+ const [text, setText] = useState('I am clearable content.');
204
+ const handleChange = (e, { value }) => {
205
+ setText(value);
206
+ };
207
+
208
+ const handleClearClick = () => {
209
+ setText('');
210
+ };
211
+
212
+ return (
213
+ <TextArea
214
+ onChange={handleChange}
215
+ value={text}
216
+ endAdornment={
217
+ <StyledButton
218
+ appearance="secondary"
219
+ aria-label="Clear text"
220
+ icon={<Cross />}
221
+ onClick={handleClearClick}
222
+ />
223
+ />
224
+ );
225
+ />
226
+ ```
227
+
228
+ 2) Render a clear action outside of the TextArea:
229
+
230
+ ```jsx
231
+ const [text, setText] = useState('I am clearable content.');
232
+ const handleChange = (e, { value }) => {
233
+ setText(value);
234
+ };
235
+
236
+ const handleClearClick = () => {
237
+ setText('');
238
+ };
239
+
240
+ return (
241
+ <>
242
+ <TextArea onChange={handleChange} value={text} />
243
+ <StyledButton
244
+ appearance="secondary"
245
+ label="Clear text"
246
+ icon={<Cross />}
247
+ onClick={handleClearClick}
248
+ />
249
+ </>
250
+ );
251
+ ```
252
+
253
+
164
254
  ## 4.17.0
165
255
 
166
256
  ### `Typography` `weight` prop
package/Modal.js CHANGED
@@ -692,6 +692,7 @@
692
692
  }
693
693
  var qe = {
694
694
  children: i().node,
695
+ closeOnClickAway: i().bool,
695
696
  divider: i().oneOf([ "header", "footer", "both", "none" ]),
696
697
  elementRef: i().oneOfType([ i().func, i().object ]),
697
698
  initialFocus: i().oneOfType([ i().object, i().oneOf([ "first", "container" ]) ]),
@@ -700,6 +701,8 @@
700
701
  returnFocus: i().oneOfType([ i().func, i().object ])
701
702
  };
702
703
  var Fe = {
704
+ // TODO: Set to `false` in next major version
705
+ closeOnClickAway: true,
703
706
  divider: "both",
704
707
  initialFocus: "first",
705
708
  open: false
@@ -860,13 +863,16 @@
860
863
  }, {
861
864
  key: "render",
862
865
  value: function e() {
866
+ var t = this.props.closeOnClickAway;
867
+ var r = t ? "interactive" : "visible";
863
868
 
864
869
  return n().createElement(b(), {
865
- open: this.props.open,
866
870
  getDefaultMotionStyle: this.getDefaultMotionStyle,
867
- renderModal: this.renderModal,
868
871
  getMotionStyle: this.getMotionStyle,
869
- onRequestClose: this.handleRequestClose
872
+ onRequestClose: this.handleRequestClose,
873
+ open: this.props.open,
874
+ renderModal: this.renderModal,
875
+ scrim: r
870
876
  });
871
877
  }
872
878
  } ]);
package/ModalLayer.js CHANGED
@@ -9,26 +9,26 @@
9
9
  /******/ (() => {
10
10
  /******/ // getDefaultExport function for compatibility with non-harmony modules
11
11
  /******/ e.n = t => {
12
- /******/ var r = t && t.__esModule ?
12
+ /******/ var n = t && t.__esModule ?
13
13
  /******/ () => t["default"]
14
14
  /******/ : () => t
15
15
  /******/;
16
- e.d(r, {
17
- a: r
16
+ e.d(n, {
17
+ a: n
18
18
  });
19
- /******/ return r;
19
+ /******/ return n;
20
20
  /******/ };
21
21
  /******/ })();
22
22
  /******/
23
23
  /******/ /* webpack/runtime/define property getters */
24
24
  /******/ (() => {
25
25
  /******/ // define getter functions for harmony exports
26
- /******/ e.d = (t, r) => {
27
- /******/ for (var n in r) {
28
- /******/ if (e.o(r, n) && !e.o(t, n)) {
29
- /******/ Object.defineProperty(t, n, {
26
+ /******/ e.d = (t, n) => {
27
+ /******/ for (var r in n) {
28
+ /******/ if (e.o(n, r) && !e.o(t, r)) {
29
+ /******/ Object.defineProperty(t, r, {
30
30
  enumerable: true,
31
- get: r[n]
31
+ get: n[r]
32
32
  });
33
33
  /******/ }
34
34
  /******/ }
@@ -64,66 +64,66 @@
64
64
  default: () => /* reexport */ E
65
65
  });
66
66
  // CONCATENATED MODULE: external "react"
67
- const r = require("react");
68
- var n = e.n(r);
67
+ const n = require("react");
68
+ var r = e.n(n);
69
69
  // CONCATENATED MODULE: external "prop-types"
70
70
  const o = require("prop-types");
71
71
  var i = e.n(o);
72
72
  // CONCATENATED MODULE: external "@splunk/react-ui/Animation"
73
73
  const a = require("@splunk/react-ui/Animation");
74
74
  // CONCATENATED MODULE: external "@splunk/react-ui/Layer"
75
- const l = require("@splunk/react-ui/Layer");
76
- var u = e.n(l);
75
+ const c = require("@splunk/react-ui/Layer");
76
+ var l = e.n(c);
77
77
  // CONCATENATED MODULE: external "styled-components"
78
- const c = require("styled-components");
79
- var s = e.n(c);
78
+ const u = require("styled-components");
79
+ var s = e.n(u);
80
80
  // CONCATENATED MODULE: external "react-spring"
81
81
  const f = require("react-spring");
82
82
  // CONCATENATED MODULE: external "@splunk/themes"
83
83
  const p = require("@splunk/themes");
84
84
  // CONCATENATED MODULE: ./src/ModalLayer/ModalLayerStyles.ts
85
- var y = (0, c.css)([ "", ";position:fixed;top:0;right:0;bottom:0;left:0;" ], p.mixins.reset("block"));
85
+ var y = (0, u.css)([ "", ";position:fixed;top:0;right:0;bottom:0;left:0;" ], p.mixins.reset("block"));
86
86
  var d = s()(f.animated.div).withConfig({
87
87
  displayName: "ModalLayerStyles__StyledClickAwayOverlay",
88
88
  componentId: "sc-1sa3n1j-0"
89
89
  })([ "", ";background-color:", ";z-index:", ";" ], y, p.variables.backgroundColorScrim, p.variables.zindexModalBackdrop);
90
90
  // CONCATENATED MODULE: ./src/ModalLayer/ModalLayer.tsx
91
- function b(e) {
91
+ function v(e) {
92
92
  "@babel/helpers - typeof";
93
93
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
94
- b = function e(t) {
94
+ v = function e(t) {
95
95
  return typeof t;
96
96
  };
97
97
  } else {
98
- b = function e(t) {
98
+ v = function e(t) {
99
99
  return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
100
100
  };
101
101
  }
102
- return b(e);
102
+ return v(e);
103
103
  }
104
- function v(e, t) {
105
- var r = Object.keys(e);
104
+ function b(e, t) {
105
+ var n = Object.keys(e);
106
106
  if (Object.getOwnPropertySymbols) {
107
- var n = Object.getOwnPropertySymbols(e);
108
- if (t) n = n.filter((function(t) {
107
+ var r = Object.getOwnPropertySymbols(e);
108
+ if (t) r = r.filter((function(t) {
109
109
  return Object.getOwnPropertyDescriptor(e, t).enumerable;
110
110
  }));
111
- r.push.apply(r, n);
111
+ n.push.apply(n, r);
112
112
  }
113
- return r;
113
+ return n;
114
114
  }
115
115
  function m(e) {
116
116
  for (var t = 1; t < arguments.length; t++) {
117
- var r = arguments[t] != null ? arguments[t] : {};
117
+ var n = arguments[t] != null ? arguments[t] : {};
118
118
  if (t % 2) {
119
- v(Object(r), true).forEach((function(t) {
120
- _(e, t, r[t]);
119
+ b(Object(n), true).forEach((function(t) {
120
+ R(e, t, n[t]);
121
121
  }));
122
122
  } else if (Object.getOwnPropertyDescriptors) {
123
- Object.defineProperties(e, Object.getOwnPropertyDescriptors(r));
123
+ Object.defineProperties(e, Object.getOwnPropertyDescriptors(n));
124
124
  } else {
125
- v(Object(r)).forEach((function(t) {
126
- Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t));
125
+ b(Object(n)).forEach((function(t) {
126
+ Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
127
127
  }));
128
128
  }
129
129
  }
@@ -135,17 +135,17 @@
135
135
  }
136
136
  }
137
137
  function h(e, t) {
138
- for (var r = 0; r < t.length; r++) {
139
- var n = t[r];
140
- n.enumerable = n.enumerable || false;
141
- n.configurable = true;
142
- if ("value" in n) n.writable = true;
143
- Object.defineProperty(e, n.key, n);
138
+ for (var n = 0; n < t.length; n++) {
139
+ var r = t[n];
140
+ r.enumerable = r.enumerable || false;
141
+ r.configurable = true;
142
+ if ("value" in r) r.writable = true;
143
+ Object.defineProperty(e, r.key, r);
144
144
  }
145
145
  }
146
- function g(e, t, r) {
146
+ function g(e, t, n) {
147
147
  if (t) h(e.prototype, t);
148
- if (r) h(e, r);
148
+ if (n) h(e, n);
149
149
  return e;
150
150
  }
151
151
  function w(e, t) {
@@ -162,27 +162,27 @@
162
162
  if (t) j(e, t);
163
163
  }
164
164
  function j(e, t) {
165
- j = Object.setPrototypeOf || function e(t, r) {
166
- t.__proto__ = r;
165
+ j = Object.setPrototypeOf || function e(t, n) {
166
+ t.__proto__ = n;
167
167
  return t;
168
168
  };
169
169
  return j(e, t);
170
170
  }
171
171
  function S(e) {
172
172
  var t = A();
173
- return function r() {
174
- var n = C(e), o;
173
+ return function n() {
174
+ var r = _(e), o;
175
175
  if (t) {
176
- var i = C(this).constructor;
177
- o = Reflect.construct(n, arguments, i);
176
+ var i = _(this).constructor;
177
+ o = Reflect.construct(r, arguments, i);
178
178
  } else {
179
- o = n.apply(this, arguments);
179
+ o = r.apply(this, arguments);
180
180
  }
181
181
  return P(this, o);
182
182
  };
183
183
  }
184
184
  function P(e, t) {
185
- if (t && (b(t) === "object" || typeof t === "function")) {
185
+ if (t && (v(t) === "object" || typeof t === "function")) {
186
186
  return t;
187
187
  }
188
188
  return k(e);
@@ -204,82 +204,82 @@
204
204
  return false;
205
205
  }
206
206
  }
207
- function C(e) {
208
- C = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
207
+ function _(e) {
208
+ _ = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
209
209
  return t.__proto__ || Object.getPrototypeOf(t);
210
210
  };
211
- return C(e);
211
+ return _(e);
212
212
  }
213
- function _(e, t, r) {
213
+ function R(e, t, n) {
214
214
  if (t in e) {
215
215
  Object.defineProperty(e, t, {
216
- value: r,
216
+ value: n,
217
217
  enumerable: true,
218
218
  configurable: true,
219
219
  writable: true
220
220
  });
221
221
  } else {
222
- e[t] = r;
222
+ e[t] = n;
223
223
  }
224
224
  return e;
225
225
  }
226
- var R = {
226
+ var q = {
227
227
  childrenInAnimation: i().bool,
228
228
  getDefaultMotionStyle: i().func,
229
229
  getMotionStyle: i().func,
230
230
  onRequestClose: i().func,
231
231
  open: i().bool,
232
232
  renderModal: i().func.isRequired,
233
- useLayerForClickAway: i().bool
233
+ scrim: i().oneOf([ "visible", "hidden", "interactive" ])
234
234
  };
235
- var q = {
235
+ var M = {
236
236
  childrenInAnimation: false,
237
237
  open: false,
238
- useLayerForClickAway: true
238
+ scrim: "interactive"
239
239
  };
240
- var M = function(e) {
241
- w(r, e);
242
- var t = S(r);
243
- function r(e) {
240
+ var C = function(e) {
241
+ w(n, e);
242
+ var t = S(n);
243
+ function n(e) {
244
244
  var o;
245
- O(this, r);
245
+ O(this, n);
246
246
  o = t.call(this, e);
247
- _(k(o), "allowAnimationUpdates", true);
248
- _(k(o), "handleClickAway", (function(e) {
249
- var t, r;
250
- (t = (r = o.props).onRequestClose) === null || t === void 0 ? void 0 : t.call(r, {
247
+ R(k(o), "allowAnimationUpdates", true);
248
+ R(k(o), "handleClickAway", (function(e) {
249
+ var t, n;
250
+ (t = (n = o.props).onRequestClose) === null || t === void 0 ? void 0 : t.call(n, {
251
251
  reason: "clickAway",
252
252
  event: e
253
253
  });
254
254
  }));
255
- _(k(o), "handleAnimationEnd", (function() {
255
+ R(k(o), "handleAnimationEnd", (function() {
256
256
  if (o.allowAnimationUpdates) {
257
257
  o.setState({
258
258
  animating: false
259
259
  });
260
260
  }
261
261
  }));
262
- _(k(o), "renderLayer", (function() {
263
- var e = o.props, t = e.getDefaultMotionStyle, r = e.getMotionStyle, i = e.renderModal, l = e.useLayerForClickAway;
264
- var u = o.props.open || o.state.animating;
262
+ R(k(o), "renderLayer", (function() {
263
+ var e = o.props, t = e.getDefaultMotionStyle, n = e.getMotionStyle, i = e.renderModal, c = e.scrim;
264
+ var l = o.props.open || o.state.animating;
265
265
 
266
- return n().createElement(a.Spring, {
266
+ return r().createElement(a.Spring, {
267
267
  from: m(m({}, t === null || t === void 0 ? void 0 : t()), {}, {
268
268
  overlayOpacity: 0,
269
269
  opacity: 0
270
270
  }),
271
- to: m(m({}, r === null || r === void 0 ? void 0 : r()), {}, {
271
+ to: m(m({}, n === null || n === void 0 ? void 0 : n()), {}, {
272
272
  overlayOpacity: o.props.open ? 1 : 0,
273
273
  opacity: o.props.open ? 1 : 0
274
274
  }),
275
275
  onRest: o.handleAnimationEnd
276
276
  }, (function(e) {
277
277
 
278
- return n().createElement("div", null,
278
+ return r().createElement("div", null,
279
279
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
280
- i(e), u && l && n().createElement(d, {
280
+ i(e), l && (c === "visible" || "interactive") && r().createElement(d, {
281
281
  "data-test": "modal-overlay",
282
- onMouseDown: o.handleClickAway,
282
+ onMouseDown: c === "interactive" ? o.handleClickAway : undefined,
283
283
  key: "clickAway",
284
284
  style: {
285
285
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
@@ -294,7 +294,7 @@
294
294
  };
295
295
  return o;
296
296
  }
297
- g(r, [ {
297
+ g(n, [ {
298
298
  key: "componentWillUnmount",
299
299
  value: function e() {
300
300
  this.allowAnimationUpdates = false;
@@ -305,18 +305,18 @@
305
305
  value: function e() {
306
306
  var t = this.props.open || this.state.animating || this.props.childrenInAnimation;
307
307
 
308
- return n().createElement(u(), {
308
+ return r().createElement(l(), {
309
309
  open: t,
310
310
  closeReasons: [ "escapeKey" ],
311
311
  onRequestClose: this.props.onRequestClose
312
312
  }, t && this.renderLayer());
313
313
  }
314
314
  } ]);
315
- return r;
316
- }(r.Component);
317
- _(M, "propTypes", R);
318
- _(M, "defaultProps", q);
319
- _(M, "getDerivedStateFromProps", (function(e, t) {
315
+ return n;
316
+ }(n.Component);
317
+ R(C, "propTypes", q);
318
+ R(C, "defaultProps", M);
319
+ R(C, "getDerivedStateFromProps", (function(e, t) {
320
320
  if (e.open !== t.prevOpen) {
321
321
  return {
322
322
  animating: true,
@@ -325,7 +325,7 @@
325
325
  }
326
326
  return null;
327
327
  }));
328
- /* harmony default export */ const E = M;
328
+ /* harmony default export */ const E = C;
329
329
  // CONCATENATED MODULE: ./src/ModalLayer/index.ts
330
330
  module.exports = t;
331
331
  /******/})();