@splunk/react-page 7.1.0 → 8.0.0-beta.2

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 (5) hide show
  1. package/18.js +422 -0
  2. package/CHANGELOG.md +14 -2
  3. package/README.md +10 -0
  4. package/index.js +94 -110
  5. package/package.json +22 -21
package/18.js ADDED
@@ -0,0 +1,422 @@
1
+ /******/ (() => {
2
+ // webpackBootstrap
3
+ /******/ "use strict";
4
+ /******/ // The require scope
5
+ /******/ var e = {};
6
+ /******/
7
+ /************************************************************************/
8
+ /******/ /* webpack/runtime/compat get default export */
9
+ /******/ (() => {
10
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
11
+ /******/ e.n = n => {
12
+ /******/ var r = n && n.__esModule ?
13
+ /******/ () => n["default"]
14
+ /******/ : () => n
15
+ /******/;
16
+ e.d(r, {
17
+ a: r
18
+ });
19
+ /******/ return r;
20
+ /******/ };
21
+ /******/ })();
22
+ /******/
23
+ /******/ /* webpack/runtime/define property getters */
24
+ /******/ (() => {
25
+ /******/ // define getter functions for harmony exports
26
+ /******/ e.d = (n, r) => {
27
+ /******/ for (var t in r) {
28
+ /******/ if (e.o(r, t) && !e.o(n, t)) {
29
+ /******/ Object.defineProperty(n, t, {
30
+ enumerable: true,
31
+ get: r[t]
32
+ });
33
+ /******/ }
34
+ /******/ }
35
+ /******/ };
36
+ /******/ })();
37
+ /******/
38
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
39
+ /******/ (() => {
40
+ /******/ e.o = (e, n) => Object.prototype.hasOwnProperty.call(e, n)
41
+ /******/;
42
+ })();
43
+ /******/
44
+ /******/ /* webpack/runtime/make namespace object */
45
+ /******/ (() => {
46
+ /******/ // define __esModule on exports
47
+ /******/ e.r = e => {
48
+ /******/ if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
49
+ /******/ Object.defineProperty(e, Symbol.toStringTag, {
50
+ value: "Module"
51
+ });
52
+ /******/ }
53
+ /******/ Object.defineProperty(e, "__esModule", {
54
+ value: true
55
+ });
56
+ /******/ };
57
+ /******/ })();
58
+ /******/
59
+ /************************************************************************/ var n = {};
60
+ // ESM COMPAT FLAG
61
+ e.r(n);
62
+ // EXPORTS
63
+ e.d(n, {
64
+ default: () => /* binding */ W
65
+ });
66
+ // CONCATENATED MODULE: external "react-dom/client"
67
+ const r = require("react-dom/client");
68
+ // CONCATENATED MODULE: external "react"
69
+ const t = require("react");
70
+ var a = e.n(t);
71
+ // CONCATENATED MODULE: external "scriptjs"
72
+ const i = require("scriptjs");
73
+ var o = e.n(i);
74
+ // CONCATENATED MODULE: external "@splunk/react-ui/Layer"
75
+ const l = require("@splunk/react-ui/Layer");
76
+ // CONCATENATED MODULE: external "@splunk/splunk-utils/url"
77
+ const u = require("@splunk/splunk-utils/url");
78
+ // CONCATENATED MODULE: external "@splunk/themes/SplunkThemeProvider"
79
+ const c = require("@splunk/themes/SplunkThemeProvider");
80
+ var d = e.n(c);
81
+ // CONCATENATED MODULE: external "styled-components"
82
+ const p = require("styled-components");
83
+ var s = e.n(p);
84
+ // CONCATENATED MODULE: external "@splunk/themes"
85
+ const v = require("@splunk/themes");
86
+ // CONCATENATED MODULE: ./src/LoadingStyles.js
87
+ function f() {
88
+ var e = k([ "\n animation-name: ", ";\n animation-duration: 1.4s;\n animation-iteration-count: infinite;\n animation-fill-mode: both;\n background-color: ", ";\n width: 10px;\n height: 10px;\n border-radius: 5px;\n display: inline-block;\n margin-right: ", ";\n\n &:nth-child(2) {\n animation-delay: 0.2s;\n }\n\n &:nth-child(3) {\n animation-delay: 0.4s;\n }\n" ]);
89
+ f = function n() {
90
+ return e;
91
+ };
92
+ return e;
93
+ }
94
+ function m() {
95
+ var e = k([ "\n color: ", ";\n padding-top: 30vh;\n text-align: center;\n min-height: 400px;\n" ]);
96
+ m = function n() {
97
+ return e;
98
+ };
99
+ return e;
100
+ }
101
+ function h() {
102
+ var e = k([ "\n background-color: ", ";\n min-height: ", "px;\n" ]);
103
+ h = function n() {
104
+ return e;
105
+ };
106
+ return e;
107
+ }
108
+ function b() {
109
+ var e = k([ "\n padding: 0;\n background-color: ", ";\n height: ", "px;\n" ]);
110
+ b = function n() {
111
+ return e;
112
+ };
113
+ return e;
114
+ }
115
+ function y() {
116
+ var e = k([ "\n background-color: ", ";\n position: fixed;\n opacity: 1;\n z-index: 10000;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n" ]);
117
+ y = function n() {
118
+ return e;
119
+ };
120
+ return e;
121
+ }
122
+ function g() {
123
+ var e = k([ "\n 0% {\n opacity: 0.2;\n }\n\n 20% {\n opacity: 1;\n }\n\n 100% {\n opacity: 0.2;\n }\n" ]);
124
+ g = function n() {
125
+ return e;
126
+ };
127
+ return e;
128
+ }
129
+ function k(e, n) {
130
+ return n || (n = e.slice(0)), Object.freeze(Object.defineProperties(e, {
131
+ raw: {
132
+ value: Object.freeze(n)
133
+ }
134
+ }));
135
+ }
136
+ var S = 45;
137
+ var w = 34;
138
+ var E = (0, p.keyframes)(g());
139
+ var j = s().div(y(), v.variables.backgroundColorPage);
140
+ var C = s().div(b(), (0, v.pick)({
141
+ prisma: v.variables.backgroundColorSection,
142
+ enterprise: v.variables.gray20
143
+ }), w);
144
+ var q = s().div(h(), (0, v.pick)({
145
+ prisma: v.variables.backgroundColorPopup,
146
+ enterprise: v.variables.gray30
147
+ }), S);
148
+ var x = s().div(m(), v.variables.contentColorInverted);
149
+ var B = s().div(f(), E, v.variables.neutral500, (0, v.pick)({
150
+ prisma: v.variables.spacingMedium,
151
+ enterprise: v.variables.spacingSmall
152
+ }));
153
+ // CONCATENATED MODULE: external "prop-types"
154
+ const O = require("prop-types");
155
+ var P = e.n(O);
156
+ // CONCATENATED MODULE: external "@splunk/react-ui/ScreenReaderContent"
157
+ const L = require("@splunk/react-ui/ScreenReaderContent");
158
+ var _ = e.n(L);
159
+ // CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
160
+ const A = require("@splunk/ui-utils/i18n");
161
+ // CONCATENATED MODULE: ./src/Loading.jsx
162
+ var F = {
163
+ hideAppBar: P().bool,
164
+ hideChrome: P().bool,
165
+ hideSplunkBar: P().bool,
166
+ AppBarFallback: P().elementType,
167
+ SplunkBarFallback: P().elementType
168
+ };
169
+ function T(e) {
170
+ var n = e.AppBarFallback, r = n === void 0 ? q : n, t = e.hideAppBar, i = e.hideChrome, o = e.hideSplunkBar, l = e.SplunkBarFallback, u = l === void 0 ? C : l;
171
+
172
+ return a().createElement(j, null, !i && !o && a().createElement(u, null), !i && !t && a().createElement(r, null), a().createElement(x, null, a().createElement(B, null), a().createElement(B, null), a().createElement(B, null), a().createElement(_(), null, (0,
173
+ A._)("Loading"))));
174
+ }
175
+ T.propTypes = F;
176
+ /* harmony default export */ const H = T;
177
+ // CONCATENATED MODULE: ./src/baseLayout.jsx
178
+ function M(e, n) {
179
+ if (null == e) return {};
180
+ var r, t, a = z(e, n);
181
+ if (Object.getOwnPropertySymbols) {
182
+ var i = Object.getOwnPropertySymbols(e);
183
+ for (t = 0; t < i.length; t++) {
184
+ r = i[t], n.includes(r) || {}.propertyIsEnumerable.call(e, r) && (a[r] = e[r]);
185
+ }
186
+ }
187
+ return a;
188
+ }
189
+ function z(e, n) {
190
+ if (null == e) return {};
191
+ var r = {};
192
+ for (var t in e) {
193
+ if ({}.hasOwnProperty.call(e, t)) {
194
+ if (n.includes(t)) continue;
195
+ r[t] = e[t];
196
+ }
197
+ }
198
+ return r;
199
+ }
200
+ var G = "build/api/layout.js";
201
+ var I = "build/api/layout-dark.js";
202
+ var R = 'header[data-view="splunkjs/mvc/headerview"]';
203
+ /**
204
+ * Loads the layout from the server, using requirejs if available on the window and scriptjs if not.
205
+ *
206
+ * @param {Function} callback - A callback invoked with the layout module once resolved.
207
+ * @param {object} [options]
208
+ * @param {String} [options.loader = 'scriptjs'] - Configures the loader used for the loading the layout - available loaders are "scriptjs" and "requirejs".
209
+ * @private
210
+ */ function U(e, n) {
211
+ var r = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, t = r.loader, a = t === void 0 ? "scriptjs" : t;
212
+ var i = e === "dark" ? I : G;
213
+ var l = (0, u.createStaticURL)(i);
214
+ if (a === "scriptjs") {
215
+ o()(l, (function() {
216
+ // eslint-disable-next-line no-underscore-dangle
217
+ n(window.__splunk_layout__);
218
+ }));
219
+ } else if (a === "requirejs") {
220
+ if (window.requirejs) {
221
+ window.requirejs([ l ], n);
222
+ } else {
223
+ throw new Error('Error in react-page: options.loader = "requirejs" was set but window.requirejs does not exist.');
224
+ }
225
+ } else {
226
+ throw new Error('Invalid options.loader configuration: must be "scriptjs" or "requirejs".');
227
+ }
228
+ }
229
+ /**
230
+ * Computes the background css of the header container during lazy loading
231
+ *
232
+ * @param {HTMLDivElement} headerContainer
233
+ * @param {object} [options]
234
+ * @private
235
+ */ function D(e) {
236
+ var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
237
+ var r = n.hideSplunkBar, t = n.hideAppBar, a = n.headerHeight;
238
+ var i = e.children[0];
239
+ var o = i && getComputedStyle(i).backgroundColor;
240
+ if (!(r || t)) {
241
+ // compute background color to be same as both fallback components
242
+ var l = i === null || i === void 0 ? void 0 : i.offsetHeight;
243
+ var u = e.children[1];
244
+ var c = u && getComputedStyle(u).backgroundColor;
245
+ var d = Math.round(l / a * 100);
246
+ return "linear-gradient(\n ".concat(o, " 0%,\n ").concat(o, " ").concat(d, "%,\n ").concat(c, " ").concat(d, "%,\n ").concat(c, " 100%\n )");
247
+ }
248
+ return o;
249
+ }
250
+ /**
251
+ * renders body element and attaches it to container node in DOM
252
+ *
253
+ * @param {element} element
254
+ * @param {element} render - A render function that returns an unmount() function.
255
+ * @param {HTMLDivElement} container
256
+ * @param {boolean} useGlobalLayerStack
257
+ * @param {object} splunkTheme
258
+ * @private
259
+ */ function J(e, n, r) {
260
+ var t = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
261
+ var i = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
262
+ var o = t ? a().createElement(l.LayerStackGlobalProvider, null, a().createElement(d(), i, e)) : a().createElement(d(), i, e);
263
+ return n(o, r);
264
+ }
265
+ /**
266
+ * Renders a React element into the Layout API.
267
+ * @public
268
+ * @param {element} element - A React element.
269
+ * @param {element} render - A render function that returns an unmount() function.
270
+ * @param {object} [options]
271
+ * @param {string} [options.pageTitle] - Changes the page title.
272
+ * @param {Boolean} [options.hideAppBar = false] - Hides the app bar.
273
+ * @param {Boolean} [options.hideAppsList = false] - Hides the app list in
274
+ * the Splunk bar.
275
+ * @param {Boolean} [options.hideChrome = false] - Renders only the main content, hiding
276
+ * the Splunk bar, app bar, and footer.
277
+ * @param {Boolean} [options.hideFooter = false] - Hides the footer.
278
+ * @param {Boolean} [options.hideSplunkBar = false] - Hides the Splunk bar.
279
+ * @param {string} [options.layout = 'scrolling'] - Set to `fixed` to fix all navigation bars
280
+ * to the edge of the page.
281
+ * @param {Boolean} [options.useGlobalLayerStack = true] - Wraps elements in @splunk/react-ui's LayerStackGlobalProvider.
282
+ * @param {String} [options.theme = 'light'] - Used to theme UI elements. Ex. "light" or "dark".
283
+ * @param {String} [options.loader = 'scriptjs'] - Configures the loader used for the loading the layout - available loaders are "scriptjs" and "requirejs".
284
+ * Change this only if the default loader does not work for your application.
285
+ * @param {Boolean} [options.lazyLoadLayout = false] - Prioritizes loading the React element and lazily fetches and compiles the layout API (navigation bar).
286
+ * @param {element} [options.SplunkBarFallback = SplunkBar] - A React element used as a placeholder for the splunk bar while the navigation bar is loading.
287
+ * @param {element} [options.AppBarFallback = AppBar] - A React element used as a placeholder for the app bar while the navigation bar is loading.
288
+ * @param {function} [options.onLayoutComplete] - A callback function which executes after layout API is fetched and compiled.
289
+ */ function K(e, n) {
290
+ var r = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
291
+ var t = r.useGlobalLayerStack, i = t === void 0 ? true : t, o = r.pageTitle, l = r.theme, u = l === void 0 ? "light" : l, c = r.loader, p = c === void 0 ? "scriptjs" : c, s = M(r, [ "useGlobalLayerStack", "pageTitle", "theme", "loader" ]);
292
+ if (o) {
293
+ document.title = o;
294
+ }
295
+ var v = s.hideChrome, f = s.hideAppBar, m = s.hideSplunkBar, h = s.SplunkBarFallback, b = h === void 0 ? C : h, y = s.AppBarFallback, g = y === void 0 ? q : y, k = s.lazyLoadLayout, E = k === void 0 ? false : k, j = s.onLayoutComplete, x = s.onLayoutStart;
296
+ var B = document.createElement("div");
297
+ var O = document.createElement("div");
298
+ x === null || x === void 0 ? void 0 : x({
299
+ headerContainer: O,
300
+ bodyContainer: B
301
+ });
302
+ // The "theme" in enterprise used to be "enterprise" instead of "light"...
303
+ var P = u === "light" || u === "enterprise" ? "light" : "dark";
304
+ var L = {
305
+ family: "enterprise",
306
+ colorScheme: P,
307
+ density: "comfortable"
308
+ };
309
+ var _;
310
+ var A;
311
+ if (E) {
312
+ // render the React app immediately without waiting for layout API
313
+ if (!v) {
314
+ document.body.appendChild(O);
315
+ A = n( a().createElement(a().Fragment, null, !m && a().createElement(b, null), !f && a().createElement(g, null)), O);
316
+ // explicitly set height and background of header container to avoid layout and color shift when fallback gets replaced
317
+ var F = O.offsetHeight;
318
+ var T = D(O, {
319
+ hideSplunkBar: m,
320
+ hideAppBar: f,
321
+ headerHeight: F,
322
+ AppBarFallback: g,
323
+ SplunkBarFallback: b
324
+ });
325
+ O.style.height = "".concat(F, "px");
326
+ O.style.background = "".concat(T);
327
+ }
328
+ document.body.appendChild(B);
329
+ _ = J(e, n, B, i, L);
330
+ } else {
331
+ document.body.appendChild(B);
332
+ _ = n( a().createElement(d(), L, a().createElement(H, s)), B);
333
+ }
334
+ U(u, (function(r) {
335
+ var t;
336
+ if (r) {
337
+ t = r.create(s).getContainerElement();
338
+ if (s.layout === "fixed") {
339
+ // the above create method adds flex: 1 0 0
340
+ // IE 11 disregards 0px shorthand for flex-basis component.
341
+ // flex-basis 0% is better than 0px because css minification can remove px
342
+ if (!t.style.flex || t.style.flex === "1 0 0px") {
343
+ t.style.flex = "1 0 0%";
344
+ }
345
+ // all elements in the hierarchy must have 'overflow: hidden' for children
346
+ // to support scrolling correctly.
347
+ if (!t.style.overflow) {
348
+ t.style.overflow = "hidden";
349
+ }
350
+ // splunk hijacks the width of the body when printing, so we have to force width to the size
351
+ // of the viewport so that things print at the correct width
352
+ if (!t.style.width) {
353
+ t.style.width = "100vw";
354
+ }
355
+ }
356
+ } else {
357
+ // eslint-disable-next-line no-console
358
+ console.error("Unable to load layout.");
359
+ t = document.createElement("div");
360
+ document.body.appendChild(t);
361
+ }
362
+ if (E) {
363
+ if (!v) {
364
+ // replace placeholder nav bar with real nav bar
365
+ A.unmount(O);
366
+ var a = document.querySelector(R);
367
+ var o = (!v && !m ? w : 0) + (!v && !f ? S : 0);
368
+ // set a min-height for basic nav bar components and auto height for any additional components like global banner
369
+ O.style.minHeight = "".concat(o, "px");
370
+ O.style.height = "auto";
371
+ O.appendChild(a);
372
+ }
373
+ t.appendChild(B);
374
+ j === null || j === void 0 ? void 0 : j();
375
+ } else {
376
+ setTimeout((function() {
377
+ _.unmount(B);
378
+ _ = J(e, n, B, i, L);
379
+ t.appendChild(B);
380
+ j === null || j === void 0 ? void 0 : j();
381
+ }), 30);
382
+ }
383
+ }), {
384
+ loader: p
385
+ });
386
+ }
387
+ /* harmony default export */ const N = K;
388
+ // CONCATENATED MODULE: ./src/18.jsx
389
+ var Q = function e(n, t) {
390
+ var a = (0, r.createRoot)(t);
391
+ a.render(n);
392
+ return a;
393
+ };
394
+ /**
395
+ * Renders a React element into the Layout API.
396
+ * @public
397
+ * @param {element} element - A React element.
398
+ * @param {object} [options]
399
+ * @param {string} [options.pageTitle] - Changes the page title.
400
+ * @param {Boolean} [options.hideAppBar = false] - Hides the app bar.
401
+ * @param {Boolean} [options.hideAppsList = false] - Hides the app list in
402
+ * the Splunk bar.
403
+ * @param {Boolean} [options.hideChrome = false] - Renders only the main content, hiding
404
+ * the Splunk bar, app bar, and footer.
405
+ * @param {Boolean} [options.hideFooter = false] - Hides the footer.
406
+ * @param {Boolean} [options.hideSplunkBar = false] - Hides the Splunk bar.
407
+ * @param {string} [options.layout = 'scrolling'] - Set to `fixed` to fix all navigation bars
408
+ * to the edge of the page.
409
+ * @param {Boolean} [options.useGlobalLayerStack = true] - Wraps elements in @splunk/react-ui's LayerStackGlobalProvider.
410
+ * @param {String} [options.theme = 'light'] - Used to theme UI elements. Ex. "light" or "dark".
411
+ * @param {String} [options.loader = 'scriptjs'] - Configures the loader used for the loading the layout - available loaders are "scriptjs" and "requirejs".
412
+ * Change this only if the default loader does not work for your application.
413
+ * @param {Boolean} [options.lazyLoadLayout = false] - Prioritizes loading the React element and lazily fetches and compiles the layout API (navigation bar).
414
+ * @param {element} [options.SplunkBarFallback = SplunkBar] - A React element used as a placeholder for the splunk bar while the navigation bar is loading.
415
+ * @param {element} [options.AppBarFallback = AppBar] - A React element used as a placeholder for the app bar while the navigation bar is loading.
416
+ * @param {function} [options.onLayoutComplete] - A callback function which executes after layout API is fetched and compiled.
417
+ */ function V(e, n) {
418
+ N(e, Q, n);
419
+ }
420
+ /* harmony default export */ const W = V;
421
+ module.exports = n;
422
+ /******/})();
package/CHANGELOG.md CHANGED
@@ -1,10 +1,22 @@
1
1
  Change Log
2
2
  ============
3
3
 
4
+ 8.0.0-beta.2 - March 5, 2025
5
+ ----------
6
+ * Public release of `8.0.0-beta.1`
7
+
8
+ 8.0.0-beta.1 - February 20, 2025
9
+ ----------
10
+ New Features:
11
+ * Added support for using the `createRoot` API if the consuming application is using `react-dom@18`.
12
+
13
+ API Changes:
14
+ * `react` and `react-dom` peer dependencies are now `"^16.8.0 || ^17.0.0 || ^18.0.0"`.
15
+
4
16
  7.1.0 - July 8, 2024
5
17
  ----------
6
18
  New Features:
7
- * Added a new `onLayoutStart` callback (SPL-254150).
19
+ * Added a new `onLayoutStart` callback (SPL-254150).
8
20
  * `AppBar` and `SplunkBar` default placeholder elements are now exported (SPL-254150).
9
21
 
10
22
  API Changes:
@@ -12,7 +24,7 @@ API Changes:
12
24
 
13
25
  7.0.0 - February 6, 2024
14
26
  ----------
15
- API Changes:
27
+ API Changes:
16
28
  * `@splunk/splunk-utils` dependency has been updated to `3.0.0`.
17
29
  * `3.0.0` no longer supports Search V1 for some endpoints and has had the fallback behavior for older versions of Splunk removed (SUI-5957).
18
30
  * `react-page` does not use these endpoints directly but apps leveraging `react-page` and search endpoints should use search V2. See the `@splunk/splunk-utils` CHANGELOG and [Semantic API Versioning](https://docs.splunk.com/Documentation/Splunk/9.1.2/RESTREF/RESTsearch#Semantic_API_versioning) for more details.
package/README.md CHANGED
@@ -29,3 +29,13 @@ import MyPage from 'pages/MyPage';
29
29
 
30
30
  layout(<MyPage />, { pageTitle: 'A React Page', hideFooter: true, layout: 'fixed' });
31
31
  ```
32
+
33
+ ### React 18
34
+ To use the new [createRoot](https://react.dev/reference/react-dom/client/createRoot#createroot) functionality introducted in React 18, use the `'@splunk/react-page/18'` import instead of `@splunk/react-page`.
35
+
36
+ ```js
37
+ import layout from '@splunk/react-page/18';
38
+ import MyPage from 'pages/MyPage';
39
+
40
+ layout(<MyPage />, { pageTitle: 'A React Page', hideFooter: true, layout: 'fixed' });
41
+ ```
package/index.js CHANGED
@@ -63,7 +63,7 @@
63
63
  e.d(n, {
64
64
  AppBar: () => /* reexport */ y,
65
65
  SplunkBar: () => /* reexport */ b,
66
- default: () => /* binding */ X
66
+ default: () => /* binding */ W
67
67
  });
68
68
  // CONCATENATED MODULE: external "react-dom"
69
69
  const r = require("react-dom");
@@ -116,10 +116,7 @@
116
116
  return e;
117
117
  }
118
118
  function s(e, n) {
119
- if (!n) {
120
- n = e.slice(0);
121
- }
122
- return Object.freeze(Object.defineProperties(e, {
119
+ return n || (n = e.slice(0)), Object.freeze(Object.defineProperties(e, {
123
120
  raw: {
124
121
  value: Object.freeze(n)
125
122
  }
@@ -127,8 +124,8 @@
127
124
  }
128
125
  var v = 45;
129
126
  var f = 34;
130
- var h = (0, t.keyframes)(p());
131
- var m = a().div(d(), i.variables.backgroundColorPage);
127
+ var m = (0, t.keyframes)(p());
128
+ var h = a().div(d(), i.variables.backgroundColorPage);
132
129
  var b = a().div(c(), (0, i.pick)({
133
130
  prisma: i.variables.backgroundColorSection,
134
131
  enterprise: i.variables.gray20
@@ -138,86 +135,73 @@
138
135
  enterprise: i.variables.gray30
139
136
  }), v);
140
137
  var g = a().div(l(), i.variables.contentColorInverted);
141
- var k = a().div(o(), h, i.variables.neutral500, (0, i.pick)({
138
+ var k = a().div(o(), m, i.variables.neutral500, (0, i.pick)({
142
139
  prisma: i.variables.spacingMedium,
143
- enterprise: i.variables.spacingHalf
140
+ enterprise: i.variables.spacingSmall
144
141
  }));
145
142
  // CONCATENATED MODULE: external "react"
146
143
  const S = require("react");
147
- var j = e.n(S);
144
+ var w = e.n(S);
148
145
  // CONCATENATED MODULE: external "scriptjs"
149
- const w = require("scriptjs");
150
- var C = e.n(w);
146
+ const C = require("scriptjs");
147
+ var E = e.n(C);
151
148
  // CONCATENATED MODULE: external "@splunk/react-ui/Layer"
152
- const B = require("@splunk/react-ui/Layer");
149
+ const j = require("@splunk/react-ui/Layer");
153
150
  // CONCATENATED MODULE: external "@splunk/splunk-utils/url"
154
- const E = require("@splunk/splunk-utils/url");
151
+ const B = require("@splunk/splunk-utils/url");
155
152
  // CONCATENATED MODULE: external "@splunk/themes/SplunkThemeProvider"
156
- const x = require("@splunk/themes/SplunkThemeProvider");
157
- var q = e.n(x);
153
+ const q = require("@splunk/themes/SplunkThemeProvider");
154
+ var x = e.n(q);
158
155
  // CONCATENATED MODULE: external "prop-types"
159
156
  const O = require("prop-types");
160
- var A = e.n(O);
157
+ var P = e.n(O);
161
158
  // CONCATENATED MODULE: external "@splunk/react-ui/ScreenReaderContent"
162
- const P = require("@splunk/react-ui/ScreenReaderContent");
163
- var F = e.n(P);
159
+ const A = require("@splunk/react-ui/ScreenReaderContent");
160
+ var L = e.n(A);
164
161
  // CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
165
- const L = require("@splunk/ui-utils/i18n");
162
+ const _ = require("@splunk/ui-utils/i18n");
166
163
  // CONCATENATED MODULE: ./src/Loading.jsx
167
- var _ = {
168
- hideAppBar: A().bool,
169
- hideChrome: A().bool,
170
- hideSplunkBar: A().bool,
171
- AppBarFallback: A().elementType,
172
- SplunkBarFallback: A().elementType
173
- };
174
- var T = {
175
- hideAppBar: false,
176
- hideChrome: false,
177
- hideSplunkBar: false,
178
- AppBarFallback: y,
179
- SplunkBarFallback: b
164
+ var F = {
165
+ hideAppBar: P().bool,
166
+ hideChrome: P().bool,
167
+ hideSplunkBar: P().bool,
168
+ AppBarFallback: P().elementType,
169
+ SplunkBarFallback: P().elementType
180
170
  };
181
- function H(e) {
182
- var n = e.hideAppBar, r = e.hideChrome, t = e.hideSplunkBar, a = e.SplunkBarFallback, i = e.AppBarFallback;
171
+ function T(e) {
172
+ var n = e.AppBarFallback, r = n === void 0 ? y : n, t = e.hideAppBar, a = e.hideChrome, i = e.hideSplunkBar, o = e.SplunkBarFallback, l = o === void 0 ? b : o;
183
173
 
184
- return j().createElement(m, null, !r && !t && j().createElement(a, null), !r && !n && j().createElement(i, null), j().createElement(g, null, j().createElement(k, null), j().createElement(k, null), j().createElement(k, null), j().createElement(F(), null, (0,
185
- L._)("Loading"))));
174
+ return w().createElement(h, null, !a && !i && w().createElement(l, null), !a && !t && w().createElement(r, null), w().createElement(g, null, w().createElement(k, null), w().createElement(k, null), w().createElement(k, null), w().createElement(L(), null, (0,
175
+ _._)("Loading"))));
186
176
  }
187
- H.propTypes = _;
188
- H.defaultProps = T;
189
- /* harmony default export */ const M = H;
177
+ T.propTypes = F;
178
+ /* harmony default export */ const H = T;
190
179
  // CONCATENATED MODULE: ./src/baseLayout.jsx
191
- function z(e, n) {
192
- if (e == null) return {};
193
- var r = G(e, n);
194
- var t, a;
180
+ function M(e, n) {
181
+ if (null == e) return {};
182
+ var r, t, a = z(e, n);
195
183
  if (Object.getOwnPropertySymbols) {
196
184
  var i = Object.getOwnPropertySymbols(e);
197
- for (a = 0; a < i.length; a++) {
198
- t = i[a];
199
- if (n.indexOf(t) >= 0) continue;
200
- if (!Object.prototype.propertyIsEnumerable.call(e, t)) continue;
201
- r[t] = e[t];
185
+ for (t = 0; t < i.length; t++) {
186
+ r = i[t], n.includes(r) || {}.propertyIsEnumerable.call(e, r) && (a[r] = e[r]);
202
187
  }
203
188
  }
204
- return r;
189
+ return a;
205
190
  }
206
- function G(e, n) {
207
- if (e == null) return {};
191
+ function z(e, n) {
192
+ if (null == e) return {};
208
193
  var r = {};
209
- var t = Object.keys(e);
210
- var a, i;
211
- for (i = 0; i < t.length; i++) {
212
- a = t[i];
213
- if (n.indexOf(a) >= 0) continue;
214
- r[a] = e[a];
194
+ for (var t in e) {
195
+ if ({}.hasOwnProperty.call(e, t)) {
196
+ if (n.includes(t)) continue;
197
+ r[t] = e[t];
198
+ }
215
199
  }
216
200
  return r;
217
201
  }
218
- var I = "build/api/layout.js";
219
- var R = "build/api/layout-dark.js";
220
- var U = 'header[data-view="splunkjs/mvc/headerview"]';
202
+ var G = "build/api/layout.js";
203
+ var I = "build/api/layout-dark.js";
204
+ var R = 'header[data-view="splunkjs/mvc/headerview"]';
221
205
  /**
222
206
  * Loads the layout from the server, using requirejs if available on the window and scriptjs if not.
223
207
  *
@@ -225,12 +209,12 @@
225
209
  * @param {object} [options]
226
210
  * @param {String} [options.loader = 'scriptjs'] - Configures the loader used for the loading the layout - available loaders are "scriptjs" and "requirejs".
227
211
  * @private
228
- */ function N(e, n) {
212
+ */ function U(e, n) {
229
213
  var r = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, t = r.loader, a = t === void 0 ? "scriptjs" : t;
230
- var i = e === "dark" ? R : I;
231
- var o = (0, E.createStaticURL)(i);
214
+ var i = e === "dark" ? I : G;
215
+ var o = (0, B.createStaticURL)(i);
232
216
  if (a === "scriptjs") {
233
- C()(o, (function() {
217
+ E()(o, (function() {
234
218
  // eslint-disable-next-line no-underscore-dangle
235
219
  n(window.__splunk_layout__);
236
220
  }));
@@ -250,7 +234,7 @@
250
234
  * @param {HTMLDivElement} headerContainer
251
235
  * @param {object} [options]
252
236
  * @private
253
- */ function D(e) {
237
+ */ function N(e) {
254
238
  var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
255
239
  var r = n.hideSplunkBar, t = n.hideAppBar, a = n.headerHeight;
256
240
  var i = e.children[0];
@@ -274,10 +258,10 @@
274
258
  * @param {boolean} useGlobalLayerStack
275
259
  * @param {object} splunkTheme
276
260
  * @private
277
- */ function J(e, n, r) {
261
+ */ function D(e, n, r) {
278
262
  var t = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
279
263
  var a = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
280
- var i = t ? j().createElement(B.LayerStackGlobalProvider, null, j().createElement(q(), a, e)) : j().createElement(q(), a, e);
264
+ var i = t ? w().createElement(j.LayerStackGlobalProvider, null, w().createElement(x(), a, e)) : w().createElement(x(), a, e);
281
265
  return n(i, r);
282
266
  }
283
267
  /**
@@ -304,52 +288,52 @@
304
288
  * @param {element} [options.SplunkBarFallback = SplunkBar] - A React element used as a placeholder for the splunk bar while the navigation bar is loading.
305
289
  * @param {element} [options.AppBarFallback = AppBar] - A React element used as a placeholder for the app bar while the navigation bar is loading.
306
290
  * @param {function} [options.onLayoutComplete] - A callback function which executes after layout API is fetched and compiled.
307
- */ function K(e, n) {
291
+ */ function J(e, n) {
308
292
  var r = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
309
- var t = r.useGlobalLayerStack, a = t === void 0 ? true : t, i = r.pageTitle, o = r.theme, l = o === void 0 ? "light" : o, u = r.loader, c = u === void 0 ? "scriptjs" : u, d = z(r, [ "useGlobalLayerStack", "pageTitle", "theme", "loader" ]);
293
+ var t = r.useGlobalLayerStack, a = t === void 0 ? true : t, i = r.pageTitle, o = r.theme, l = o === void 0 ? "light" : o, u = r.loader, c = u === void 0 ? "scriptjs" : u, d = M(r, [ "useGlobalLayerStack", "pageTitle", "theme", "loader" ]);
310
294
  if (i) {
311
295
  document.title = i;
312
296
  }
313
- var p = d.hideChrome, s = d.hideAppBar, h = d.hideSplunkBar, m = d.SplunkBarFallback, g = m === void 0 ? b : m, k = d.AppBarFallback, S = k === void 0 ? y : k, w = d.lazyLoadLayout, C = w === void 0 ? false : w, B = d.onLayoutComplete, E = d.onLayoutStart;
314
- var x = document.createElement("div");
297
+ var p = d.hideChrome, s = d.hideAppBar, m = d.hideSplunkBar, h = d.SplunkBarFallback, g = h === void 0 ? b : h, k = d.AppBarFallback, S = k === void 0 ? y : k, C = d.lazyLoadLayout, E = C === void 0 ? false : C, j = d.onLayoutComplete, B = d.onLayoutStart;
298
+ var q = document.createElement("div");
315
299
  var O = document.createElement("div");
316
- E === null || E === void 0 ? void 0 : E({
300
+ B === null || B === void 0 ? void 0 : B({
317
301
  headerContainer: O,
318
- bodyContainer: x
302
+ bodyContainer: q
319
303
  });
320
- // The "theme" in enterprise used to be "enterprise" instead of "light"...
321
- var A = l === "light" || l === "enterprise" ? "light" : "dark";
322
- var P = {
304
+ // The "theme" in enterprise used to be "enterprise" instead of "light"...
305
+ var P = l === "light" || l === "enterprise" ? "light" : "dark";
306
+ var A = {
323
307
  family: "enterprise",
324
- colorScheme: A,
308
+ colorScheme: P,
325
309
  density: "comfortable"
326
310
  };
327
- var F;
328
311
  var L;
329
- if (C) {
312
+ var _;
313
+ if (E) {
330
314
  // render the React app immediately without waiting for layout API
331
315
  if (!p) {
332
316
  document.body.appendChild(O);
333
- L = n( j().createElement(j().Fragment, null, !h && j().createElement(g, null), !s && j().createElement(S, null)), O);
334
- // explicitly set height and background of header container to avoid layout and color shift when fallback gets replaced
335
- var _ = O.offsetHeight;
336
- var T = D(O, {
337
- hideSplunkBar: h,
317
+ _ = n( w().createElement(w().Fragment, null, !m && w().createElement(g, null), !s && w().createElement(S, null)), O);
318
+ // explicitly set height and background of header container to avoid layout and color shift when fallback gets replaced
319
+ var F = O.offsetHeight;
320
+ var T = N(O, {
321
+ hideSplunkBar: m,
338
322
  hideAppBar: s,
339
- headerHeight: _,
323
+ headerHeight: F,
340
324
  AppBarFallback: S,
341
325
  SplunkBarFallback: g
342
326
  });
343
- O.style.height = "".concat(_, "px");
327
+ O.style.height = "".concat(F, "px");
344
328
  O.style.background = "".concat(T);
345
329
  }
346
- document.body.appendChild(x);
347
- F = J(e, n, x, a, P);
330
+ document.body.appendChild(q);
331
+ L = D(e, n, q, a, A);
348
332
  } else {
349
- document.body.appendChild(x);
350
- F = n( j().createElement(q(), P, j().createElement(M, d)), x);
333
+ document.body.appendChild(q);
334
+ L = n( w().createElement(x(), A, w().createElement(H, d)), q);
351
335
  }
352
- N(l, (function(r) {
336
+ U(l, (function(r) {
353
337
  var t;
354
338
  if (r) {
355
339
  t = r.create(d).getContainerElement();
@@ -360,12 +344,12 @@
360
344
  if (!t.style.flex || t.style.flex === "1 0 0px") {
361
345
  t.style.flex = "1 0 0%";
362
346
  }
363
- // all elements in the hierarchy must have 'overflow: hidden' for children
347
+ // all elements in the hierarchy must have 'overflow: hidden' for children
364
348
  // to support scrolling correctly.
365
349
  if (!t.style.overflow) {
366
350
  t.style.overflow = "hidden";
367
351
  }
368
- // splunk hijacks the width of the body when printing, so we have to force width to the size
352
+ // splunk hijacks the width of the body when printing, so we have to force width to the size
369
353
  // of the viewport so that things print at the correct width
370
354
  if (!t.style.width) {
371
355
  t.style.width = "100vw";
@@ -377,34 +361,34 @@
377
361
  t = document.createElement("div");
378
362
  document.body.appendChild(t);
379
363
  }
380
- if (C) {
364
+ if (E) {
381
365
  if (!p) {
382
366
  // replace placeholder nav bar with real nav bar
383
- L.unmount(O);
384
- var i = document.querySelector(U);
385
- var o = (!p && !h ? f : 0) + (!p && !s ? v : 0);
386
- // set a min-height for basic nav bar components and auto height for any additional components like global banner
367
+ _.unmount(O);
368
+ var i = document.querySelector(R);
369
+ var o = (!p && !m ? f : 0) + (!p && !s ? v : 0);
370
+ // set a min-height for basic nav bar components and auto height for any additional components like global banner
387
371
  O.style.minHeight = "".concat(o, "px");
388
372
  O.style.height = "auto";
389
373
  O.appendChild(i);
390
374
  }
391
- t.appendChild(x);
392
- B === null || B === void 0 ? void 0 : B();
375
+ t.appendChild(q);
376
+ j === null || j === void 0 ? void 0 : j();
393
377
  } else {
394
378
  setTimeout((function() {
395
- F.unmount(x);
396
- F = J(e, n, x, a, P);
397
- t.appendChild(x);
398
- B === null || B === void 0 ? void 0 : B();
379
+ L.unmount(q);
380
+ L = D(e, n, q, a, A);
381
+ t.appendChild(q);
382
+ j === null || j === void 0 ? void 0 : j();
399
383
  }), 30);
400
384
  }
401
385
  }), {
402
386
  loader: c
403
387
  });
404
388
  }
405
- /* harmony default export */ const Q = K;
389
+ /* harmony default export */ const K = J;
406
390
  // CONCATENATED MODULE: ./src/index.jsx
407
- var V = function e(n, t) {
391
+ var Q = function e(n, t) {
408
392
  (0, r.render)(n, t);
409
393
  return {
410
394
  unmount: function e() {
@@ -436,9 +420,9 @@
436
420
  * @param {element} [options.AppBarFallback = AppBar] - A React element used as a placeholder for the app bar while the navigation bar is loading.
437
421
  * @param {function} [options.onLayoutComplete] - A callback function which executes after layout API is fetched and compiled.
438
422
  * @param {function} [options.onLayoutStart] - A callback function which executes once the layout starts to render
439
- */ function W(e, n) {
440
- Q(e, V, n);
423
+ */ function V(e, n) {
424
+ K(e, Q, n);
441
425
  }
442
- /* harmony default export */ const X = W;
426
+ /* harmony default export */ const W = V;
443
427
  module.exports = n;
444
428
  /******/})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splunk/react-page",
3
- "version": "7.1.0",
3
+ "version": "8.0.0-beta.2",
4
4
  "description": "Load React components into the latest layout from Splunk Enterprise",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Splunk Inc.",
@@ -21,45 +21,46 @@
21
21
  "test:cypress:ci": "node src/tests/run-cypress-tests.js"
22
22
  },
23
23
  "dependencies": {
24
- "@splunk/react-ui": "^4.33.0",
25
- "@splunk/splunk-utils": "^3.1.0",
26
- "@splunk/themes": "^0.19.0",
27
- "@splunk/ui-utils": "^1.6.0",
24
+ "@splunk/react-ui": "5.0.0-beta.2",
25
+ "@splunk/splunk-utils": "^3.2.0",
26
+ "@splunk/themes": "1.0.0-beta.2",
27
+ "@splunk/ui-utils": "^1.8.0",
28
28
  "prop-types": "^15.6.2",
29
29
  "scriptjs": "^2.5.8"
30
30
  },
31
31
  "devDependencies": {
32
- "@babel/core": "^7.2.0",
32
+ "@babel/core": "^7.16.0",
33
+ "@babel/eslint-parser": "^7.16.0",
33
34
  "@splunk/babel-preset": "^4.0.0",
34
- "@splunk/eslint-config": "^4.0.0",
35
- "@splunk/stylelint-config": "^4.0.0",
35
+ "@splunk/eslint-config": "^5.0.0",
36
+ "@splunk/react-docs": "1.0.0-beta.21.v5.2",
37
+ "@splunk/stylelint-config": "^5.0.0",
36
38
  "@splunk/webpack-configs": "^7.0.2",
37
- "babel-eslint": "^10.1.0",
38
39
  "babel-loader": "^8.3.0",
39
40
  "babel-plugin-transform-imports": "^2.0.0",
40
41
  "cross-env": "^6.0.3",
41
42
  "cypress": "^12.17.1",
42
- "eslint": "^7.14.0",
43
- "eslint-config-airbnb": "^18.2.1",
44
- "eslint-config-prettier": "^6.15.0",
43
+ "eslint": "^8.57.1",
44
+ "eslint-config-airbnb": "^19.0.4",
45
+ "eslint-config-prettier": "^9.1.0",
45
46
  "eslint-import-resolver-webpack": "^0.13.4",
46
- "eslint-plugin-import": "^2.22.1",
47
- "eslint-plugin-jsx-a11y": "^6.4.1",
48
- "eslint-plugin-react": "^7.21.5",
49
- "eslint-plugin-react-hooks": "^4.2.0",
47
+ "eslint-plugin-import": "^2.30.1",
48
+ "eslint-plugin-jsx-a11y": "^6.10.0",
49
+ "eslint-plugin-react": "^7.36.1",
50
+ "eslint-plugin-react-hooks": "^4.6.2",
50
51
  "execa": "^4.0.0",
51
- "react": "^16.12.0",
52
- "react-dom": "^16.12.0",
52
+ "react": "^18.2.0",
53
+ "react-dom": "^18.2.0",
53
54
  "styled-components": "^5.3.10",
54
- "stylelint": "^13.0.0",
55
+ "stylelint": "^15.11.0",
55
56
  "webpack": "^5.88.2",
56
57
  "webpack-cli": "^5.1.4",
57
58
  "webpack-dev-server": "^4.15.1",
58
59
  "webpack-merge": "^5.9.0"
59
60
  },
60
61
  "peerDependencies": {
61
- "react": "^16.8",
62
- "react-dom": "^16.8",
62
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
63
+ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
63
64
  "styled-components": "^5.3.10"
64
65
  },
65
66
  "engines": {