@splunk/react-page 8.1.0 → 8.2.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/18.js CHANGED
@@ -61,145 +61,201 @@
61
61
  e.r(n);
62
62
  // EXPORTS
63
63
  e.d(n, {
64
- default: () => /* binding */ W
64
+ default: () => /* binding */ se
65
65
  });
66
66
  // CONCATENATED MODULE: external "react-dom/client"
67
67
  const r = require("react-dom/client");
68
- // CONCATENATED MODULE: external "react"
69
- const t = require("react");
68
+ // CONCATENATED MODULE: external "@babel/runtime/helpers/objectWithoutProperties"
69
+ const t = require("@babel/runtime/helpers/objectWithoutProperties");
70
70
  var a = e.n(t);
71
+ // CONCATENATED MODULE: external "@babel/runtime/helpers/defineProperty"
72
+ const o = require("@babel/runtime/helpers/defineProperty");
73
+ var i = e.n(o);
74
+ // CONCATENATED MODULE: external "@babel/runtime/helpers/asyncToGenerator"
75
+ const l = require("@babel/runtime/helpers/asyncToGenerator");
76
+ var u = e.n(l);
77
+ // CONCATENATED MODULE: external "@babel/runtime/regenerator"
78
+ const c = require("@babel/runtime/regenerator");
79
+ var d = e.n(c);
80
+ // CONCATENATED MODULE: external "react"
81
+ const s = require("react");
82
+ var p = e.n(s);
71
83
  // CONCATENATED MODULE: external "scriptjs"
72
- const i = require("scriptjs");
73
- var o = e.n(i);
84
+ const v = require("scriptjs");
85
+ var f = e.n(v);
74
86
  // CONCATENATED MODULE: external "@splunk/react-ui/Layer"
75
- const l = require("@splunk/react-ui/Layer");
87
+ const h = require("@splunk/react-ui/Layer");
76
88
  // CONCATENATED MODULE: external "@splunk/splunk-utils/url"
77
- const u = require("@splunk/splunk-utils/url");
89
+ const m = require("@splunk/splunk-utils/url");
78
90
  // CONCATENATED MODULE: external "@splunk/themes/SplunkThemeProvider"
79
- const c = require("@splunk/themes/SplunkThemeProvider");
80
- var d = e.n(c);
91
+ const b = require("@splunk/themes/SplunkThemeProvider");
92
+ var y = e.n(b);
93
+ // CONCATENATED MODULE: external "@splunk/ui-utils/boolean"
94
+ const g = require("@splunk/ui-utils/boolean");
95
+ // CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
96
+ const k = require("@splunk/ui-utils/i18n");
97
+ // CONCATENATED MODULE: external "@splunk/splunk-utils/fetch"
98
+ const w = require("@splunk/splunk-utils/fetch");
99
+ // CONCATENATED MODULE: external "prop-types"
100
+ const j = require("prop-types");
101
+ var S = e.n(j);
102
+ // CONCATENATED MODULE: external "@splunk/react-ui/ScreenReaderContent"
103
+ const E = require("@splunk/react-ui/ScreenReaderContent");
104
+ var O = e.n(E);
105
+ // CONCATENATED MODULE: external "@babel/runtime/helpers/taggedTemplateLiteral"
106
+ const q = require("@babel/runtime/helpers/taggedTemplateLiteral");
107
+ var x = e.n(q);
81
108
  // CONCATENATED MODULE: external "styled-components"
82
- const p = require("styled-components");
83
- var s = e.n(p);
109
+ const C = require("styled-components");
110
+ var B = e.n(C);
84
111
  // CONCATENATED MODULE: external "@splunk/themes"
85
- const v = require("@splunk/themes");
112
+ const P = require("@splunk/themes");
86
113
  // 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() {
114
+ function L() {
115
+ var e = x()([ "\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" ]);
116
+ L = function n() {
90
117
  return e;
91
118
  };
92
119
  return e;
93
120
  }
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() {
121
+ function _() {
122
+ var e = x()([ "\n color: ", ";\n padding-top: 30vh;\n text-align: center;\n min-height: 400px;\n" ]);
123
+ _ = function n() {
97
124
  return e;
98
125
  };
99
126
  return e;
100
127
  }
101
- function h() {
102
- var e = k([ "\n background-color: ", ";\n min-height: ", "px;\n" ]);
103
- h = function n() {
128
+ function T() {
129
+ var e = x()([ "\n background-color: ", ";\n min-height: ", "px;\n" ]);
130
+ T = function n() {
104
131
  return e;
105
132
  };
106
133
  return e;
107
134
  }
108
- function y() {
109
- var e = k([ "\n padding: 0;\n background-color: ", ";\n height: ", "px;\n" ]);
110
- y = function n() {
135
+ function F() {
136
+ var e = x()([ "\n padding: 0;\n background-color: ", ";\n height: ", "px;\n" ]);
137
+ F = function n() {
111
138
  return e;
112
139
  };
113
140
  return e;
114
141
  }
115
- function b() {
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
- b = function n() {
142
+ function A() {
143
+ var e = x()([ "\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" ]);
144
+ A = function n() {
118
145
  return e;
119
146
  };
120
147
  return e;
121
148
  }
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() {
149
+ function D() {
150
+ var e = x()([ "\n 0% {\n opacity: 0.2;\n }\n\n 20% {\n opacity: 1;\n }\n\n 100% {\n opacity: 0.2;\n }\n" ]);
151
+ D = function n() {
125
152
  return e;
126
153
  };
127
154
  return e;
128
155
  }
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(b(), v.variables.backgroundColorPage);
140
- var C = s().div(y(), (0, v.pick)({
141
- prisma: v.variables.backgroundColorSection,
142
- enterprise: v.variables.gray20
143
- }), w);
144
- var x = s().div(h(), (0, v.pick)({
145
- prisma: v.variables.backgroundColorPopup,
146
- enterprise: v.variables.gray30
147
- }), S);
148
- var q = 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
156
+ var R = 45;
157
+ var G = 34;
158
+ var H = (0, C.keyframes)(D());
159
+ var M = B().div(A(), P.variables.backgroundColorPage);
160
+ var z = B().div(F(), (0, P.pick)({
161
+ prisma: P.variables.backgroundColorSection,
162
+ enterprise: P.variables.gray20
163
+ }), G);
164
+ var U = B().div(T(), (0, P.pick)({
165
+ prisma: P.variables.backgroundColorPopup,
166
+ enterprise: P.variables.gray30
167
+ }), R);
168
+ var I = B().div(_(), P.variables.contentColorInverted);
169
+ var W = B().div(L(), H, P.variables.neutral500, (0, P.pick)({
170
+ prisma: P.variables.spacingMedium,
171
+ enterprise: P.variables.spacingSmall
152
172
  }));
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 F = require("@splunk/react-ui/ScreenReaderContent");
158
- var L = e.n(F);
159
- // CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
160
- const _ = require("@splunk/ui-utils/i18n");
161
173
  // CONCATENATED MODULE: ./src/Loading.jsx
162
- var A = {
163
- hideAppBar: P().bool,
164
- hideChrome: P().bool,
165
- hideSplunkBar: P().bool,
166
- AppBarFallback: P().elementType,
167
- SplunkBarFallback: P().elementType
174
+ var J = {
175
+ hideAppBar: S().bool,
176
+ hideChrome: S().bool,
177
+ hideSplunkBar: S().bool,
178
+ AppBarFallback: S().elementType,
179
+ SplunkBarFallback: S().elementType
168
180
  };
169
- function T(e) {
170
- var n = e.AppBarFallback, r = n === void 0 ? x : n, t = e.hideAppBar, i = e.hideChrome, o = e.hideSplunkBar, l = e.SplunkBarFallback, u = l === void 0 ? C : l;
181
+ function K(e) {
182
+ var n = e.AppBarFallback, r = n === void 0 ? U : n, t = e.hideAppBar, a = e.hideChrome, o = e.hideSplunkBar, i = e.SplunkBarFallback, l = i === void 0 ? z : i;
171
183
 
172
- return a().createElement(j, null, !i && !o && a().createElement(u, null), !i && !t && a().createElement(r, null), a().createElement(q, null, a().createElement(B, null), a().createElement(B, null), a().createElement(B, null), a().createElement(L(), null, (0,
173
- _._)("Loading"))));
184
+ return p().createElement(M, null, !a && !o && p().createElement(l, null), !a && !t && p().createElement(r, null), p().createElement(I, null, p().createElement(W, null), p().createElement(W, null), p().createElement(W, null), p().createElement(O(), null, (0,
185
+ k._)("Loading"))));
174
186
  }
175
- T.propTypes = A;
176
- /* harmony default export */ const H = T;
187
+ K.propTypes = J;
188
+ /* harmony default export */ const N = K;
177
189
  // CONCATENATED MODULE: ./src/baseLayout.jsx
178
- function M(e, n) {
179
- if (null == e) return {};
180
- var r, t, a = z(e, n);
190
+ function Q(e, n) {
191
+ var r = Object.keys(e);
181
192
  if (Object.getOwnPropertySymbols) {
182
- var i = Object.getOwnPropertySymbols(e);
183
- for (t = 0; t < i.length; t++) {
184
- r = i[t], -1 === n.indexOf(r) && {}.propertyIsEnumerable.call(e, r) && (a[r] = e[r]);
185
- }
193
+ var t = Object.getOwnPropertySymbols(e);
194
+ n && (t = t.filter((function(n) {
195
+ return Object.getOwnPropertyDescriptor(e, n).enumerable;
196
+ }))), r.push.apply(r, t);
186
197
  }
187
- return a;
198
+ return r;
188
199
  }
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 (-1 !== n.indexOf(t)) continue;
195
- r[t] = e[t];
196
- }
200
+ function V(e) {
201
+ for (var n = 1; n < arguments.length; n++) {
202
+ var r = null != arguments[n] ? arguments[n] : {};
203
+ n % 2 ? Q(Object(r), !0).forEach((function(n) {
204
+ i()(e, n, r[n]);
205
+ })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : Q(Object(r)).forEach((function(n) {
206
+ Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
207
+ }));
197
208
  }
198
- return r;
209
+ return e;
199
210
  }
200
- var G = "build/api/layout.js";
201
- var I = "build/api/layout-dark.js";
202
- var R = 'header[data-view="splunkjs/mvc/headerview"]';
211
+ var X = function e() {
212
+ return fetch((0, m.createRESTURL)("web-features?output_mode=json", {
213
+ app: "-",
214
+ owner: "-",
215
+ sharing: "system"
216
+ })).then((0, w.handleResponse)(200))["catch"]((0, w.handleError)((0, k._)("failed to get web features")));
217
+ };
218
+ var Y = "feature:modern-nav";
219
+ var Z = function() {
220
+ var e = u()( d().mark((function e(n) {
221
+ var r, t;
222
+ var a, o;
223
+ return d().wrap((function e(i) {
224
+ while (1) {
225
+ switch (i.prev = i.next) {
226
+ case 0:
227
+ if (!(n !== "auto")) {
228
+ i.next = 2;
229
+ break;
230
+ }
231
+ return i.abrupt("return", false);
232
+
233
+ case 2:
234
+ i.next = 4;
235
+ return X();
236
+
237
+ case 4:
238
+ a = i.sent;
239
+ o = a.entry.find((function(e) {
240
+ return e.name === Y;
241
+ }));
242
+ return i.abrupt("return", (r = (0, g.normalizeBoolean)(o === null || o === void 0 ? void 0 : (t = o.content) === null || t === void 0 ? void 0 : t.enable_nav_vnext)) !== null && r !== void 0 ? r : false);
243
+
244
+ case 7:
245
+ case "end":
246
+ return i.stop();
247
+ }
248
+ }
249
+ }), e);
250
+ })));
251
+ return function n(r) {
252
+ return e.apply(this, arguments);
253
+ };
254
+ }();
255
+ var $ = "build/api/layout.js";
256
+ var ee = "build/api/layout-dark.js";
257
+ var ne = "build/api/layout-modern-nav.js";
258
+ var re = 'header[data-view="splunkjs/mvc/headerview"]';
203
259
  /**
204
260
  * Loads the layout from the server, using requirejs if available on the window and scriptjs if not.
205
261
  *
@@ -207,24 +263,31 @@
207
263
  * @param {object} [options]
208
264
  * @param {String} [options.loader = 'scriptjs'] - Configures the loader used for the loading the layout - available loaders are "scriptjs" and "requirejs".
209
265
  * @private
210
- */ function D(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);
266
+ */ function te(e, n, r) {
267
+ var t = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}, a = t.loader, o = a === void 0 ? "scriptjs" : a;
268
+ Z(n).then((function(n) {
269
+ var t;
270
+ if (n) {
271
+ t = ne;
222
272
  } else {
223
- throw new Error('Error in react-page: options.loader = "requirejs" was set but window.requirejs does not exist.');
273
+ t = e === "dark" ? ee : $;
224
274
  }
225
- } else {
226
- throw new Error('Invalid options.loader configuration: must be "scriptjs" or "requirejs".');
227
- }
275
+ var a = (0, m.createStaticURL)(t);
276
+ if (o === "scriptjs") {
277
+ f()(a, (function() {
278
+ // eslint-disable-next-line no-underscore-dangle
279
+ r(window.__splunk_layout__);
280
+ }));
281
+ } else if (o === "requirejs") {
282
+ if (window.requirejs) {
283
+ window.requirejs([ a ], r);
284
+ } else {
285
+ throw new Error('Error in react-page: options.loader = "requirejs" was set but window.requirejs does not exist.');
286
+ }
287
+ } else {
288
+ throw new Error('Invalid options.loader configuration: must be "scriptjs" or "requirejs".');
289
+ }
290
+ }));
228
291
  }
229
292
  /**
230
293
  * Computes the background css of the header container during lazy loading
@@ -232,20 +295,24 @@
232
295
  * @param {HTMLDivElement} headerContainer
233
296
  * @param {object} [options]
234
297
  * @private
235
- */ function U(e) {
298
+ */ function ae(e) {
236
299
  var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
237
300
  var r = n.hideSplunkBar, t = n.hideAppBar, a = n.headerHeight;
238
- var i = e.children[0];
239
- var o = i && getComputedStyle(i).backgroundColor;
301
+ var o = e.children[0];
302
+ var i = o && getComputedStyle(o).backgroundColor;
240
303
  if (!(r || t)) {
241
304
  // compute background color to be same as both fallback components
242
- var l = i === null || i === void 0 ? void 0 : i.offsetHeight;
305
+ var l = o === null || o === void 0 ? void 0 : o.offsetHeight;
243
306
  var u = e.children[1];
244
307
  var c = u && getComputedStyle(u).backgroundColor;
245
308
  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 )");
309
+ return "linear-gradient(\n ".concat(i, " 0%,\n ").concat(i, " ").concat(d, "%,\n ").concat(c, " ").concat(d, "%,\n ").concat(c, " 100%\n )");
247
310
  }
248
- return o;
311
+ return i;
312
+ }
313
+ function oe(e) {
314
+ var n = e.navLayout, r = e.baseOptions, t = e.additionalOptions;
315
+ return n === "auto" ? V(V({}, r), t) : r;
249
316
  }
250
317
  /**
251
318
  * renders body element and attaches it to container node in DOM
@@ -256,10 +323,10 @@
256
323
  * @param {boolean} useGlobalLayerStack
257
324
  * @param {object} splunkTheme
258
325
  * @private
259
- */ function J(e, n, r) {
326
+ */ function ie(e, n, r) {
260
327
  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);
328
+ var a = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
329
+ var o = t ? p().createElement(h.LayerStackGlobalProvider, null, p().createElement(y(), a, e)) : p().createElement(y(), a, e);
263
330
  return n(o, r);
264
331
  }
265
332
  /**
@@ -278,7 +345,8 @@
278
345
  * @param {Boolean} [options.hideSplunkBar = false] - Hides the Splunk bar.
279
346
  * @param {string} [options.layout = 'scrolling'] - Set to `fixed` to fix all navigation bars
280
347
  * to the edge of the page.
281
- * @param {Boolean} [options.useGlobalLayerStack = true] - Wraps elements in `@splunk/react-ui`'s LayerStackGlobalProvider.
348
+ * @param {Boolean} [options.useGlobalLayerStack = true] - Wraps elements in @splunk/react-ui's LayerStackGlobalProvider.
349
+ * @param {Boolean} [options.navLayout = 'classic'] - Used to determine layout asset to load. Ex. "classic" or "auto".
282
350
  * @param {String} [options.theme = 'light'] - Used to theme UI elements. Ex. "light" or "dark".
283
351
  * @param {String} [options.themeFamily = 'enterprise'] - Ex. Theme family to use for UI elements. Ex. "enterprise" or "prisma".
284
352
  * @param {String} [options.themeDensity] - Ex. Theme density to use for UI elements. Ex. "compact" or "comfortable".
@@ -288,55 +356,66 @@
288
356
  * @param {element} [options.SplunkBarFallback = SplunkBar] - A React element used as a placeholder for the splunk bar while the navigation bar is loading.
289
357
  * @param {element} [options.AppBarFallback = AppBar] - A React element used as a placeholder for the app bar while the navigation bar is loading.
290
358
  * @param {function} [options.onLayoutComplete] - A callback function which executes after layout API is fetched and compiled.
291
- */ function K(e, n) {
359
+ */ function le(e, n) {
292
360
  var r = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
293
- var t = r.useGlobalLayerStack, i = t === void 0 ? true : t, o = r.pageTitle, l = r.theme, u = l === void 0 ? "light" : l, c = r.themeDensity, p = r.loader, s = p === void 0 ? "scriptjs" : p, v = M(r, [ "useGlobalLayerStack", "pageTitle", "theme", "themeDensity", "loader" ]);
294
- if (o) {
295
- document.title = o;
361
+ var t = r.useGlobalLayerStack, o = t === void 0 ? true : t, i = r.pageTitle, l = r.theme, u = l === void 0 ? "light" : l, c = r.themeDensity, d = r.loader, s = d === void 0 ? "scriptjs" : d, v = a()(r, [ "useGlobalLayerStack", "pageTitle", "theme", "themeDensity", "loader" ]);
362
+ if (i) {
363
+ document.title = i;
296
364
  }
297
- var f = v.hideChrome, m = v.themeFamily, h = m === void 0 ? "enterprise" : m, y = v.hideAppBar, b = v.hideSplunkBar, g = v.SplunkBarFallback, k = g === void 0 ? C : g, E = v.AppBarFallback, j = E === void 0 ? x : E, q = v.lazyLoadLayout, B = q === void 0 ? false : q, O = v.onLayoutComplete, P = v.onLayoutStart;
298
- var F = document.createElement("div");
365
+ var f = v.hideChrome, h = v.themeFamily, m = h === void 0 ? "enterprise" : h, b = v.hideAppBar, g = v.hideSplunkBar, k = v.SplunkBarFallback, w = k === void 0 ? z : k, j = v.AppBarFallback, S = j === void 0 ? U : j, E = v.lazyLoadLayout, O = E === void 0 ? false : E, q = v.onLayoutComplete, x = v.onLayoutStart, C = v.navLayout, B = C === void 0 ? "classic" : C;
366
+ var P = document.createElement("div");
299
367
  var L = document.createElement("div");
300
- P === null || P === void 0 ? void 0 : P({
368
+ x === null || x === void 0 ? void 0 : x({
301
369
  headerContainer: L,
302
- bodyContainer: F
370
+ bodyContainer: P
303
371
  });
304
372
  // The "theme" in enterprise used to be "enterprise" instead of "light"...
305
373
  var _ = u === "light" || u === "enterprise" ? "light" : "dark";
306
- var A = {
307
- family: h,
374
+ var T = {
375
+ family: m,
308
376
  colorScheme: _,
309
- density: c || (h === "prisma" ? "compact" : "comfortable")
377
+ density: c || (m === "prisma" ? "compact" : "comfortable")
310
378
  };
311
- var T;
312
- var z;
313
- if (B) {
379
+ var F;
380
+ var A;
381
+ if (v.navLayout === "auto") {
382
+ P.style.flexGrow = "1";
383
+ }
384
+ if (O) {
314
385
  // render the React app immediately without waiting for layout API
315
386
  if (!f) {
316
387
  document.body.appendChild(L);
317
- z = n( a().createElement(a().Fragment, null, !b && a().createElement(k, null), !y && a().createElement(j, null)), L);
388
+ A = n( p().createElement(p().Fragment, null, !g && p().createElement(w, null), !b && p().createElement(S, null)), L);
318
389
  // explicitly set height and background of header container to avoid layout and color shift when fallback gets replaced
319
- var G = L.offsetHeight;
320
- var I = U(L, {
321
- hideSplunkBar: b,
322
- hideAppBar: y,
323
- headerHeight: G,
324
- AppBarFallback: j,
325
- SplunkBarFallback: k
390
+ var D = L.offsetHeight;
391
+ var H = ae(L, {
392
+ hideSplunkBar: g,
393
+ hideAppBar: b,
394
+ headerHeight: D,
395
+ AppBarFallback: S,
396
+ SplunkBarFallback: w
326
397
  });
327
- L.style.height = "".concat(G, "px");
328
- L.style.background = "".concat(I);
398
+ L.style.height = "".concat(D, "px");
399
+ L.style.background = "".concat(H);
329
400
  }
330
- document.body.appendChild(F);
331
- T = J(e, n, F, i, A);
401
+ document.body.appendChild(P);
402
+ F = ie(e, n, P, o, T);
332
403
  } else {
333
- document.body.appendChild(F);
334
- T = n( a().createElement(d(), A, a().createElement(H, v)), F);
404
+ document.body.appendChild(P);
405
+ F = n( p().createElement(y(), T, p().createElement(N, v)), P);
335
406
  }
336
- D(u, (function(r) {
407
+ te(u, B, (function(r) {
337
408
  var t;
338
409
  if (r) {
339
- t = r.create(v).getContainerElement();
410
+ var a = oe({
411
+ navLayout: B,
412
+ baseOptions: v,
413
+ additionalOptions: {
414
+ theme: u,
415
+ themeFamily: m
416
+ }
417
+ });
418
+ t = r.create(a).getContainerElement();
340
419
  if (v.layout === "fixed") {
341
420
  // the above create method adds flex: 1 0 0
342
421
  // IE 11 disregards 0px shorthand for flex-basis component.
@@ -361,34 +440,34 @@
361
440
  t = document.createElement("div");
362
441
  document.body.appendChild(t);
363
442
  }
364
- if (B) {
443
+ if (O) {
365
444
  if (!f) {
366
445
  // replace placeholder nav bar with real nav bar
367
- z.unmount(L);
368
- var a = document.querySelector(R);
369
- var o = (!f && !b ? w : 0) + (!f && !y ? S : 0);
446
+ A.unmount(L);
447
+ var i = document.querySelector(re);
448
+ var l = (!f && !g ? G : 0) + (!f && !b ? R : 0);
370
449
  // set a min-height for basic nav bar components and auto height for any additional components like global banner
371
- L.style.minHeight = "".concat(o, "px");
450
+ L.style.minHeight = "".concat(l, "px");
372
451
  L.style.height = "auto";
373
- L.appendChild(a);
452
+ L.appendChild(i);
374
453
  }
375
- t.appendChild(F);
376
- O === null || O === void 0 ? void 0 : O();
454
+ t.appendChild(P);
455
+ q === null || q === void 0 ? void 0 : q();
377
456
  } else {
378
457
  setTimeout((function() {
379
- T.unmount(F);
380
- T = J(e, n, F, i, A);
381
- t.appendChild(F);
382
- O === null || O === void 0 ? void 0 : O();
458
+ F.unmount(P);
459
+ F = ie(e, n, P, o, T);
460
+ t.appendChild(P);
461
+ q === null || q === void 0 ? void 0 : q();
383
462
  }), 30);
384
463
  }
385
464
  }), {
386
465
  loader: s
387
466
  });
388
467
  }
389
- /* harmony default export */ const N = K;
468
+ /* harmony default export */ const ue = le;
390
469
  // CONCATENATED MODULE: ./src/18.jsx
391
- var Q = function e(n, t) {
470
+ var ce = function e(n, t) {
392
471
  var a = (0, r.createRoot)(t);
393
472
  a.render(n);
394
473
  return a;
@@ -416,9 +495,9 @@
416
495
  * @param {element} [options.SplunkBarFallback = SplunkBar] - A React element used as a placeholder for the splunk bar while the navigation bar is loading.
417
496
  * @param {element} [options.AppBarFallback = AppBar] - A React element used as a placeholder for the app bar while the navigation bar is loading.
418
497
  * @param {function} [options.onLayoutComplete] - A callback function which executes after layout API is fetched and compiled.
419
- */ function V(e, n) {
420
- N(e, Q, n);
498
+ */ function de(e, n) {
499
+ ue(e, ce, n);
421
500
  }
422
- /* harmony default export */ const W = V;
501
+ /* harmony default export */ const se = de;
423
502
  module.exports = n;
424
503
  /******/})();
package/CHANGELOG.md CHANGED
@@ -1,10 +1,19 @@
1
1
  Change Log
2
2
  ============
3
3
 
4
+ 8.2.0 - January 8, 2025
5
+ ----------
6
+ New Features:
7
+ * Added a new `options.navLayout` parameter.
8
+
9
+ 8.2.0-beta.1 - October 14, 2025
10
+ ----------
11
+ * No public API changes.
12
+
4
13
  8.1.0 - September 2, 2025
5
14
  ----------
6
15
  New Features:
7
- * `react-page` now provides Typescript type defitions (SUI-8002).
16
+ * `react-page` now provides Typescript type definitions (SUI-8002).
8
17
 
9
18
  8.0.0 - June 3, 2025
10
19
  ----------
package/baseLayout.d.ts CHANGED
@@ -15,7 +15,8 @@ export default layout;
15
15
  * @param {Boolean} [options.hideSplunkBar = false] - Hides the Splunk bar.
16
16
  * @param {string} [options.layout = 'scrolling'] - Set to `fixed` to fix all navigation bars
17
17
  * to the edge of the page.
18
- * @param {Boolean} [options.useGlobalLayerStack = true] - Wraps elements in `@splunk/react-ui`'s LayerStackGlobalProvider.
18
+ * @param {Boolean} [options.useGlobalLayerStack = true] - Wraps elements in @splunk/react-ui's LayerStackGlobalProvider.
19
+ * @param {Boolean} [options.navLayout = 'classic'] - Used to determine layout asset to load. Ex. "classic" or "auto".
19
20
  * @param {String} [options.theme = 'light'] - Used to theme UI elements. Ex. "light" or "dark".
20
21
  * @param {String} [options.themeFamily = 'enterprise'] - Ex. Theme family to use for UI elements. Ex. "enterprise" or "prisma".
21
22
  * @param {String} [options.themeDensity] - Ex. Theme density to use for UI elements. Ex. "compact" or "comfortable".
@@ -35,12 +36,4 @@ declare function layout(element: any, render: any, { useGlobalLayerStack, pageTi
35
36
  hideSplunkBar?: boolean;
36
37
  layout?: string;
37
38
  useGlobalLayerStack?: boolean;
38
- theme?: string;
39
- themeFamily?: string;
40
- themeDensity?: string;
41
- loader?: string;
42
- lazyLoadLayout?: boolean;
43
- SplunkBarFallback?: any;
44
- AppBarFallback?: any;
45
- onLayoutComplete?: Function;
46
39
  }): void;
package/index.js CHANGED
@@ -61,147 +61,203 @@
61
61
  e.r(n);
62
62
  // EXPORTS
63
63
  e.d(n, {
64
- AppBar: () => /* reexport */ b,
64
+ AppBar: () => /* reexport */ g,
65
65
  SplunkBar: () => /* reexport */ y,
66
- default: () => /* binding */ W
66
+ default: () => /* binding */ se
67
67
  });
68
68
  // CONCATENATED MODULE: external "react-dom"
69
69
  const r = require("react-dom");
70
- // CONCATENATED MODULE: external "styled-components"
71
- const t = require("styled-components");
70
+ // CONCATENATED MODULE: external "@babel/runtime/helpers/taggedTemplateLiteral"
71
+ const t = require("@babel/runtime/helpers/taggedTemplateLiteral");
72
72
  var a = e.n(t);
73
+ // CONCATENATED MODULE: external "styled-components"
74
+ const o = require("styled-components");
75
+ var i = e.n(o);
73
76
  // CONCATENATED MODULE: external "@splunk/themes"
74
- const i = require("@splunk/themes");
77
+ const l = require("@splunk/themes");
75
78
  // CONCATENATED MODULE: ./src/LoadingStyles.js
76
- function o() {
77
- var e = s([ "\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" ]);
78
- o = function n() {
79
- return e;
80
- };
81
- return e;
82
- }
83
- function l() {
84
- var e = s([ "\n color: ", ";\n padding-top: 30vh;\n text-align: center;\n min-height: 400px;\n" ]);
85
- l = function n() {
86
- return e;
87
- };
88
- return e;
89
- }
90
79
  function u() {
91
- var e = s([ "\n background-color: ", ";\n min-height: ", "px;\n" ]);
80
+ var e = a()([ "\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" ]);
92
81
  u = function n() {
93
82
  return e;
94
83
  };
95
84
  return e;
96
85
  }
97
86
  function c() {
98
- var e = s([ "\n padding: 0;\n background-color: ", ";\n height: ", "px;\n" ]);
87
+ var e = a()([ "\n color: ", ";\n padding-top: 30vh;\n text-align: center;\n min-height: 400px;\n" ]);
99
88
  c = function n() {
100
89
  return e;
101
90
  };
102
91
  return e;
103
92
  }
104
93
  function d() {
105
- var e = s([ "\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" ]);
94
+ var e = a()([ "\n background-color: ", ";\n min-height: ", "px;\n" ]);
106
95
  d = function n() {
107
96
  return e;
108
97
  };
109
98
  return e;
110
99
  }
100
+ function s() {
101
+ var e = a()([ "\n padding: 0;\n background-color: ", ";\n height: ", "px;\n" ]);
102
+ s = function n() {
103
+ return e;
104
+ };
105
+ return e;
106
+ }
111
107
  function p() {
112
- var e = s([ "\n 0% {\n opacity: 0.2;\n }\n\n 20% {\n opacity: 1;\n }\n\n 100% {\n opacity: 0.2;\n }\n" ]);
108
+ var e = a()([ "\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" ]);
113
109
  p = function n() {
114
110
  return e;
115
111
  };
116
112
  return e;
117
113
  }
118
- function s(e, n) {
119
- return n || (n = e.slice(0)), Object.freeze(Object.defineProperties(e, {
120
- raw: {
121
- value: Object.freeze(n)
122
- }
123
- }));
114
+ function v() {
115
+ var e = a()([ "\n 0% {\n opacity: 0.2;\n }\n\n 20% {\n opacity: 1;\n }\n\n 100% {\n opacity: 0.2;\n }\n" ]);
116
+ v = function n() {
117
+ return e;
118
+ };
119
+ return e;
124
120
  }
125
- var v = 45;
121
+ var f = 45;
126
122
  var m = 34;
127
- var f = (0, t.keyframes)(p());
128
- var h = a().div(d(), i.variables.backgroundColorPage);
129
- var y = a().div(c(), (0, i.pick)({
130
- prisma: i.variables.backgroundColorSection,
131
- enterprise: i.variables.gray20
123
+ var h = (0, o.keyframes)(v());
124
+ var b = i().div(p(), l.variables.backgroundColorPage);
125
+ var y = i().div(s(), (0, l.pick)({
126
+ prisma: l.variables.backgroundColorSection,
127
+ enterprise: l.variables.gray20
132
128
  }), m);
133
- var b = a().div(u(), (0, i.pick)({
134
- prisma: i.variables.backgroundColorPopup,
135
- enterprise: i.variables.gray30
136
- }), v);
137
- var g = a().div(l(), i.variables.contentColorInverted);
138
- var k = a().div(o(), f, i.variables.neutral500, (0, i.pick)({
139
- prisma: i.variables.spacingMedium,
140
- enterprise: i.variables.spacingSmall
129
+ var g = i().div(d(), (0, l.pick)({
130
+ prisma: l.variables.backgroundColorPopup,
131
+ enterprise: l.variables.gray30
132
+ }), f);
133
+ var k = i().div(c(), l.variables.contentColorInverted);
134
+ var w = i().div(u(), h, l.variables.neutral500, (0, l.pick)({
135
+ prisma: l.variables.spacingMedium,
136
+ enterprise: l.variables.spacingSmall
141
137
  }));
138
+ // CONCATENATED MODULE: external "@babel/runtime/helpers/objectWithoutProperties"
139
+ const j = require("@babel/runtime/helpers/objectWithoutProperties");
140
+ var S = e.n(j);
141
+ // CONCATENATED MODULE: external "@babel/runtime/helpers/defineProperty"
142
+ const E = require("@babel/runtime/helpers/defineProperty");
143
+ var O = e.n(E);
144
+ // CONCATENATED MODULE: external "@babel/runtime/helpers/asyncToGenerator"
145
+ const q = require("@babel/runtime/helpers/asyncToGenerator");
146
+ var C = e.n(q);
147
+ // CONCATENATED MODULE: external "@babel/runtime/regenerator"
148
+ const x = require("@babel/runtime/regenerator");
149
+ var B = e.n(x);
142
150
  // CONCATENATED MODULE: external "react"
143
- const S = require("react");
144
- var w = e.n(S);
151
+ const P = require("react");
152
+ var L = e.n(P);
145
153
  // CONCATENATED MODULE: external "scriptjs"
146
- const C = require("scriptjs");
147
- var E = e.n(C);
154
+ const _ = require("scriptjs");
155
+ var T = e.n(_);
148
156
  // CONCATENATED MODULE: external "@splunk/react-ui/Layer"
149
- const j = require("@splunk/react-ui/Layer");
157
+ const A = require("@splunk/react-ui/Layer");
150
158
  // CONCATENATED MODULE: external "@splunk/splunk-utils/url"
151
- const x = require("@splunk/splunk-utils/url");
159
+ const F = require("@splunk/splunk-utils/url");
152
160
  // CONCATENATED MODULE: external "@splunk/themes/SplunkThemeProvider"
153
- const B = require("@splunk/themes/SplunkThemeProvider");
154
- var q = e.n(B);
161
+ const D = require("@splunk/themes/SplunkThemeProvider");
162
+ var G = e.n(D);
163
+ // CONCATENATED MODULE: external "@splunk/ui-utils/boolean"
164
+ const H = require("@splunk/ui-utils/boolean");
165
+ // CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
166
+ const M = require("@splunk/ui-utils/i18n");
167
+ // CONCATENATED MODULE: external "@splunk/splunk-utils/fetch"
168
+ const R = require("@splunk/splunk-utils/fetch");
155
169
  // CONCATENATED MODULE: external "prop-types"
156
- const O = require("prop-types");
157
- var P = e.n(O);
170
+ const z = require("prop-types");
171
+ var U = e.n(z);
158
172
  // CONCATENATED MODULE: external "@splunk/react-ui/ScreenReaderContent"
159
- const A = require("@splunk/react-ui/ScreenReaderContent");
160
- var F = e.n(A);
161
- // CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
162
- const L = require("@splunk/ui-utils/i18n");
173
+ const I = require("@splunk/react-ui/ScreenReaderContent");
174
+ var N = e.n(I);
163
175
  // CONCATENATED MODULE: ./src/Loading.jsx
164
- var _ = {
165
- hideAppBar: P().bool,
166
- hideChrome: P().bool,
167
- hideSplunkBar: P().bool,
168
- AppBarFallback: P().elementType,
169
- SplunkBarFallback: P().elementType
176
+ var W = {
177
+ hideAppBar: U().bool,
178
+ hideChrome: U().bool,
179
+ hideSplunkBar: U().bool,
180
+ AppBarFallback: U().elementType,
181
+ SplunkBarFallback: U().elementType
170
182
  };
171
- function T(e) {
172
- var n = e.AppBarFallback, r = n === void 0 ? b : n, t = e.hideAppBar, a = e.hideChrome, i = e.hideSplunkBar, o = e.SplunkBarFallback, l = o === void 0 ? y : o;
183
+ function J(e) {
184
+ var n = e.AppBarFallback, r = n === void 0 ? g : n, t = e.hideAppBar, a = e.hideChrome, o = e.hideSplunkBar, i = e.SplunkBarFallback, l = i === void 0 ? y : i;
173
185
 
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(F(), null, (0,
175
- L._)("Loading"))));
186
+ return L().createElement(b, null, !a && !o && L().createElement(l, null), !a && !t && L().createElement(r, null), L().createElement(k, null, L().createElement(w, null), L().createElement(w, null), L().createElement(w, null), L().createElement(N(), null, (0,
187
+ M._)("Loading"))));
176
188
  }
177
- T.propTypes = _;
178
- /* harmony default export */ const H = T;
189
+ J.propTypes = W;
190
+ /* harmony default export */ const K = J;
179
191
  // CONCATENATED MODULE: ./src/baseLayout.jsx
180
- function M(e, n) {
181
- if (null == e) return {};
182
- var r, t, a = z(e, n);
192
+ function Q(e, n) {
193
+ var r = Object.keys(e);
183
194
  if (Object.getOwnPropertySymbols) {
184
- var i = Object.getOwnPropertySymbols(e);
185
- for (t = 0; t < i.length; t++) {
186
- r = i[t], -1 === n.indexOf(r) && {}.propertyIsEnumerable.call(e, r) && (a[r] = e[r]);
187
- }
195
+ var t = Object.getOwnPropertySymbols(e);
196
+ n && (t = t.filter((function(n) {
197
+ return Object.getOwnPropertyDescriptor(e, n).enumerable;
198
+ }))), r.push.apply(r, t);
188
199
  }
189
- return a;
200
+ return r;
190
201
  }
191
- function z(e, n) {
192
- if (null == e) return {};
193
- var r = {};
194
- for (var t in e) {
195
- if ({}.hasOwnProperty.call(e, t)) {
196
- if (-1 !== n.indexOf(t)) continue;
197
- r[t] = e[t];
198
- }
202
+ function V(e) {
203
+ for (var n = 1; n < arguments.length; n++) {
204
+ var r = null != arguments[n] ? arguments[n] : {};
205
+ n % 2 ? Q(Object(r), !0).forEach((function(n) {
206
+ O()(e, n, r[n]);
207
+ })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : Q(Object(r)).forEach((function(n) {
208
+ Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
209
+ }));
199
210
  }
200
- return r;
211
+ return e;
201
212
  }
202
- var G = "build/api/layout.js";
203
- var I = "build/api/layout-dark.js";
204
- var D = 'header[data-view="splunkjs/mvc/headerview"]';
213
+ var X = function e() {
214
+ return fetch((0, F.createRESTURL)("web-features?output_mode=json", {
215
+ app: "-",
216
+ owner: "-",
217
+ sharing: "system"
218
+ })).then((0, R.handleResponse)(200))["catch"]((0, R.handleError)((0, M._)("failed to get web features")));
219
+ };
220
+ var Y = "feature:modern-nav";
221
+ var Z = function() {
222
+ var e = C()( B().mark((function e(n) {
223
+ var r, t;
224
+ var a, o;
225
+ return B().wrap((function e(i) {
226
+ while (1) {
227
+ switch (i.prev = i.next) {
228
+ case 0:
229
+ if (!(n !== "auto")) {
230
+ i.next = 2;
231
+ break;
232
+ }
233
+ return i.abrupt("return", false);
234
+
235
+ case 2:
236
+ i.next = 4;
237
+ return X();
238
+
239
+ case 4:
240
+ a = i.sent;
241
+ o = a.entry.find((function(e) {
242
+ return e.name === Y;
243
+ }));
244
+ return i.abrupt("return", (r = (0, H.normalizeBoolean)(o === null || o === void 0 ? void 0 : (t = o.content) === null || t === void 0 ? void 0 : t.enable_nav_vnext)) !== null && r !== void 0 ? r : false);
245
+
246
+ case 7:
247
+ case "end":
248
+ return i.stop();
249
+ }
250
+ }
251
+ }), e);
252
+ })));
253
+ return function n(r) {
254
+ return e.apply(this, arguments);
255
+ };
256
+ }();
257
+ var $ = "build/api/layout.js";
258
+ var ee = "build/api/layout-dark.js";
259
+ var ne = "build/api/layout-modern-nav.js";
260
+ var re = 'header[data-view="splunkjs/mvc/headerview"]';
205
261
  /**
206
262
  * Loads the layout from the server, using requirejs if available on the window and scriptjs if not.
207
263
  *
@@ -209,24 +265,31 @@
209
265
  * @param {object} [options]
210
266
  * @param {String} [options.loader = 'scriptjs'] - Configures the loader used for the loading the layout - available loaders are "scriptjs" and "requirejs".
211
267
  * @private
212
- */ function R(e, n) {
213
- var r = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, t = r.loader, a = t === void 0 ? "scriptjs" : t;
214
- var i = e === "dark" ? I : G;
215
- var o = (0, x.createStaticURL)(i);
216
- if (a === "scriptjs") {
217
- E()(o, (function() {
218
- // eslint-disable-next-line no-underscore-dangle
219
- n(window.__splunk_layout__);
220
- }));
221
- } else if (a === "requirejs") {
222
- if (window.requirejs) {
223
- window.requirejs([ o ], n);
268
+ */ function te(e, n, r) {
269
+ var t = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}, a = t.loader, o = a === void 0 ? "scriptjs" : a;
270
+ Z(n).then((function(n) {
271
+ var t;
272
+ if (n) {
273
+ t = ne;
224
274
  } else {
225
- throw new Error('Error in react-page: options.loader = "requirejs" was set but window.requirejs does not exist.');
275
+ t = e === "dark" ? ee : $;
226
276
  }
227
- } else {
228
- throw new Error('Invalid options.loader configuration: must be "scriptjs" or "requirejs".');
229
- }
277
+ var a = (0, F.createStaticURL)(t);
278
+ if (o === "scriptjs") {
279
+ T()(a, (function() {
280
+ // eslint-disable-next-line no-underscore-dangle
281
+ r(window.__splunk_layout__);
282
+ }));
283
+ } else if (o === "requirejs") {
284
+ if (window.requirejs) {
285
+ window.requirejs([ a ], r);
286
+ } else {
287
+ throw new Error('Error in react-page: options.loader = "requirejs" was set but window.requirejs does not exist.');
288
+ }
289
+ } else {
290
+ throw new Error('Invalid options.loader configuration: must be "scriptjs" or "requirejs".');
291
+ }
292
+ }));
230
293
  }
231
294
  /**
232
295
  * Computes the background css of the header container during lazy loading
@@ -234,20 +297,24 @@
234
297
  * @param {HTMLDivElement} headerContainer
235
298
  * @param {object} [options]
236
299
  * @private
237
- */ function U(e) {
300
+ */ function ae(e) {
238
301
  var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
239
302
  var r = n.hideSplunkBar, t = n.hideAppBar, a = n.headerHeight;
240
- var i = e.children[0];
241
- var o = i && getComputedStyle(i).backgroundColor;
303
+ var o = e.children[0];
304
+ var i = o && getComputedStyle(o).backgroundColor;
242
305
  if (!(r || t)) {
243
306
  // compute background color to be same as both fallback components
244
- var l = i === null || i === void 0 ? void 0 : i.offsetHeight;
307
+ var l = o === null || o === void 0 ? void 0 : o.offsetHeight;
245
308
  var u = e.children[1];
246
309
  var c = u && getComputedStyle(u).backgroundColor;
247
310
  var d = Math.round(l / a * 100);
248
- return "linear-gradient(\n ".concat(o, " 0%,\n ").concat(o, " ").concat(d, "%,\n ").concat(c, " ").concat(d, "%,\n ").concat(c, " 100%\n )");
311
+ return "linear-gradient(\n ".concat(i, " 0%,\n ").concat(i, " ").concat(d, "%,\n ").concat(c, " ").concat(d, "%,\n ").concat(c, " 100%\n )");
249
312
  }
250
- return o;
313
+ return i;
314
+ }
315
+ function oe(e) {
316
+ var n = e.navLayout, r = e.baseOptions, t = e.additionalOptions;
317
+ return n === "auto" ? V(V({}, r), t) : r;
251
318
  }
252
319
  /**
253
320
  * renders body element and attaches it to container node in DOM
@@ -258,11 +325,11 @@
258
325
  * @param {boolean} useGlobalLayerStack
259
326
  * @param {object} splunkTheme
260
327
  * @private
261
- */ function N(e, n, r) {
328
+ */ function ie(e, n, r) {
262
329
  var t = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
263
330
  var a = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
264
- var i = t ? w().createElement(j.LayerStackGlobalProvider, null, w().createElement(q(), a, e)) : w().createElement(q(), a, e);
265
- return n(i, r);
331
+ var o = t ? L().createElement(A.LayerStackGlobalProvider, null, L().createElement(G(), a, e)) : L().createElement(G(), a, e);
332
+ return n(o, r);
266
333
  }
267
334
  /**
268
335
  * Renders a React element into the Layout API.
@@ -280,7 +347,8 @@
280
347
  * @param {Boolean} [options.hideSplunkBar = false] - Hides the Splunk bar.
281
348
  * @param {string} [options.layout = 'scrolling'] - Set to `fixed` to fix all navigation bars
282
349
  * to the edge of the page.
283
- * @param {Boolean} [options.useGlobalLayerStack = true] - Wraps elements in `@splunk/react-ui`'s LayerStackGlobalProvider.
350
+ * @param {Boolean} [options.useGlobalLayerStack = true] - Wraps elements in @splunk/react-ui's LayerStackGlobalProvider.
351
+ * @param {Boolean} [options.navLayout = 'classic'] - Used to determine layout asset to load. Ex. "classic" or "auto".
284
352
  * @param {String} [options.theme = 'light'] - Used to theme UI elements. Ex. "light" or "dark".
285
353
  * @param {String} [options.themeFamily = 'enterprise'] - Ex. Theme family to use for UI elements. Ex. "enterprise" or "prisma".
286
354
  * @param {String} [options.themeDensity] - Ex. Theme density to use for UI elements. Ex. "compact" or "comfortable".
@@ -290,56 +358,67 @@
290
358
  * @param {element} [options.SplunkBarFallback = SplunkBar] - A React element used as a placeholder for the splunk bar while the navigation bar is loading.
291
359
  * @param {element} [options.AppBarFallback = AppBar] - A React element used as a placeholder for the app bar while the navigation bar is loading.
292
360
  * @param {function} [options.onLayoutComplete] - A callback function which executes after layout API is fetched and compiled.
293
- */ function J(e, n) {
361
+ */ function le(e, n) {
294
362
  var r = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
295
- var t = r.useGlobalLayerStack, a = t === void 0 ? true : t, i = r.pageTitle, o = r.theme, l = o === void 0 ? "light" : o, u = r.themeDensity, c = r.loader, d = c === void 0 ? "scriptjs" : c, p = M(r, [ "useGlobalLayerStack", "pageTitle", "theme", "themeDensity", "loader" ]);
296
- if (i) {
297
- document.title = i;
363
+ var t = r.useGlobalLayerStack, a = t === void 0 ? true : t, o = r.pageTitle, i = r.theme, l = i === void 0 ? "light" : i, u = r.themeDensity, c = r.loader, d = c === void 0 ? "scriptjs" : c, s = S()(r, [ "useGlobalLayerStack", "pageTitle", "theme", "themeDensity", "loader" ]);
364
+ if (o) {
365
+ document.title = o;
298
366
  }
299
- var s = p.hideChrome, f = p.themeFamily, h = f === void 0 ? "enterprise" : f, g = p.hideAppBar, k = p.hideSplunkBar, S = p.SplunkBarFallback, C = S === void 0 ? y : S, E = p.AppBarFallback, j = E === void 0 ? b : E, x = p.lazyLoadLayout, B = x === void 0 ? false : x, O = p.onLayoutComplete, P = p.onLayoutStart;
367
+ var p = s.hideChrome, v = s.themeFamily, h = v === void 0 ? "enterprise" : v, b = s.hideAppBar, k = s.hideSplunkBar, w = s.SplunkBarFallback, j = w === void 0 ? y : w, E = s.AppBarFallback, O = E === void 0 ? g : E, q = s.lazyLoadLayout, C = q === void 0 ? false : q, x = s.onLayoutComplete, B = s.onLayoutStart, P = s.navLayout, _ = P === void 0 ? "classic" : P;
368
+ var T = document.createElement("div");
300
369
  var A = document.createElement("div");
301
- var F = document.createElement("div");
302
- P === null || P === void 0 ? void 0 : P({
303
- headerContainer: F,
304
- bodyContainer: A
370
+ B === null || B === void 0 ? void 0 : B({
371
+ headerContainer: A,
372
+ bodyContainer: T
305
373
  });
306
374
  // The "theme" in enterprise used to be "enterprise" instead of "light"...
307
- var L = l === "light" || l === "enterprise" ? "light" : "dark";
308
- var _ = {
375
+ var F = l === "light" || l === "enterprise" ? "light" : "dark";
376
+ var D = {
309
377
  family: h,
310
- colorScheme: L,
378
+ colorScheme: F,
311
379
  density: u || (h === "prisma" ? "compact" : "comfortable")
312
380
  };
313
- var T;
314
- var z;
315
- if (B) {
381
+ var H;
382
+ var M;
383
+ if (s.navLayout === "auto") {
384
+ T.style.flexGrow = "1";
385
+ }
386
+ if (C) {
316
387
  // render the React app immediately without waiting for layout API
317
- if (!s) {
318
- document.body.appendChild(F);
319
- z = n( w().createElement(w().Fragment, null, !k && w().createElement(C, null), !g && w().createElement(j, null)), F);
388
+ if (!p) {
389
+ document.body.appendChild(A);
390
+ M = n( L().createElement(L().Fragment, null, !k && L().createElement(j, null), !b && L().createElement(O, null)), A);
320
391
  // explicitly set height and background of header container to avoid layout and color shift when fallback gets replaced
321
- var G = F.offsetHeight;
322
- var I = U(F, {
392
+ var R = A.offsetHeight;
393
+ var z = ae(A, {
323
394
  hideSplunkBar: k,
324
- hideAppBar: g,
325
- headerHeight: G,
326
- AppBarFallback: j,
327
- SplunkBarFallback: C
395
+ hideAppBar: b,
396
+ headerHeight: R,
397
+ AppBarFallback: O,
398
+ SplunkBarFallback: j
328
399
  });
329
- F.style.height = "".concat(G, "px");
330
- F.style.background = "".concat(I);
400
+ A.style.height = "".concat(R, "px");
401
+ A.style.background = "".concat(z);
331
402
  }
332
- document.body.appendChild(A);
333
- T = N(e, n, A, a, _);
403
+ document.body.appendChild(T);
404
+ H = ie(e, n, T, a, D);
334
405
  } else {
335
- document.body.appendChild(A);
336
- T = n( w().createElement(q(), _, w().createElement(H, p)), A);
406
+ document.body.appendChild(T);
407
+ H = n( L().createElement(G(), D, L().createElement(K, s)), T);
337
408
  }
338
- R(l, (function(r) {
409
+ te(l, _, (function(r) {
339
410
  var t;
340
411
  if (r) {
341
- t = r.create(p).getContainerElement();
342
- if (p.layout === "fixed") {
412
+ var o = oe({
413
+ navLayout: _,
414
+ baseOptions: s,
415
+ additionalOptions: {
416
+ theme: l,
417
+ themeFamily: h
418
+ }
419
+ });
420
+ t = r.create(o).getContainerElement();
421
+ if (s.layout === "fixed") {
343
422
  // the above create method adds flex: 1 0 0
344
423
  // IE 11 disregards 0px shorthand for flex-basis component.
345
424
  // flex-basis 0% is better than 0px because css minification can remove px
@@ -363,34 +442,34 @@
363
442
  t = document.createElement("div");
364
443
  document.body.appendChild(t);
365
444
  }
366
- if (B) {
367
- if (!s) {
445
+ if (C) {
446
+ if (!p) {
368
447
  // replace placeholder nav bar with real nav bar
369
- z.unmount(F);
370
- var i = document.querySelector(D);
371
- var o = (!s && !k ? m : 0) + (!s && !g ? v : 0);
448
+ M.unmount(A);
449
+ var i = document.querySelector(re);
450
+ var u = (!p && !k ? m : 0) + (!p && !b ? f : 0);
372
451
  // set a min-height for basic nav bar components and auto height for any additional components like global banner
373
- F.style.minHeight = "".concat(o, "px");
374
- F.style.height = "auto";
375
- F.appendChild(i);
452
+ A.style.minHeight = "".concat(u, "px");
453
+ A.style.height = "auto";
454
+ A.appendChild(i);
376
455
  }
377
- t.appendChild(A);
378
- O === null || O === void 0 ? void 0 : O();
456
+ t.appendChild(T);
457
+ x === null || x === void 0 ? void 0 : x();
379
458
  } else {
380
459
  setTimeout((function() {
381
- T.unmount(A);
382
- T = N(e, n, A, a, _);
383
- t.appendChild(A);
384
- O === null || O === void 0 ? void 0 : O();
460
+ H.unmount(T);
461
+ H = ie(e, n, T, a, D);
462
+ t.appendChild(T);
463
+ x === null || x === void 0 ? void 0 : x();
385
464
  }), 30);
386
465
  }
387
466
  }), {
388
467
  loader: d
389
468
  });
390
469
  }
391
- /* harmony default export */ const K = J;
470
+ /* harmony default export */ const ue = le;
392
471
  // CONCATENATED MODULE: ./src/index.jsx
393
- var Q = function e(n, t) {
472
+ var ce = function e(n, t) {
394
473
  (0, r.render)(n, t);
395
474
  return {
396
475
  unmount: function e() {
@@ -424,9 +503,9 @@
424
503
  * @param {element} [options.AppBarFallback = AppBar] - A React element used as a placeholder for the app bar while the navigation bar is loading.
425
504
  * @param {function} [options.onLayoutComplete] - A callback function which executes after layout API is fetched and compiled.
426
505
  * @param {function} [options.onLayoutStart] - A callback function which executes once the layout starts to render
427
- */ function V(e, n) {
428
- K(e, Q, n);
506
+ */ function de(e, n) {
507
+ ue(e, ce, n);
429
508
  }
430
- /* harmony default export */ const W = V;
509
+ /* harmony default export */ const se = de;
431
510
  module.exports = n;
432
511
  /******/})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splunk/react-page",
3
- "version": "8.1.0",
3
+ "version": "8.2.0",
4
4
  "description": "Load React components into the latest layout from Splunk Enterprise",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Splunk Inc.",
@@ -25,21 +25,22 @@
25
25
  "types:start": "yarn types:build --watch"
26
26
  },
27
27
  "dependencies": {
28
- "@splunk/react-ui": "^5.3.0",
29
- "@splunk/splunk-utils": "^3.3.0",
30
- "@splunk/themes": "^1.2.1",
31
- "@splunk/ui-utils": "^1.10.0",
28
+ "@splunk/react-ui": "^5.7.1",
29
+ "@splunk/splunk-utils": "^3.4.0",
30
+ "@splunk/themes": "^1.4.1",
31
+ "@splunk/ui-utils": "^1.12.0",
32
32
  "prop-types": "^15.6.2",
33
33
  "scriptjs": "^2.5.8"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@babel/core": "^7.28.0",
37
37
  "@babel/eslint-parser": "^7.28.0",
38
+ "@babel/plugin-transform-runtime": "^7.28.3",
38
39
  "@splunk/babel-preset": "^4.0.0",
39
40
  "@splunk/eslint-config": "^5.0.0",
40
- "@splunk/react-docs": "^1.3.0",
41
+ "@splunk/react-docs": "^1.4.0",
41
42
  "@splunk/stylelint-config": "^5.0.0",
42
- "@splunk/webpack-configs": "^7.0.2",
43
+ "@splunk/webpack-configs": "^7.0.3",
43
44
  "babel-loader": "^8.3.0",
44
45
  "babel-plugin-transform-imports": "^2.0.0",
45
46
  "cross-env": "^6.0.3",