@splunk/react-page 7.0.0 → 7.1.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/CHANGELOG.md CHANGED
@@ -1,6 +1,15 @@
1
1
  Change Log
2
2
  ============
3
3
 
4
+ 7.1.0 - July 8, 2024
5
+ ----------
6
+ New Features:
7
+ * Added a new `onLayoutStart` callback (SPL-254150).
8
+ * `AppBar` and `SplunkBar` default placeholder elements are now exported (SPL-254150).
9
+
10
+ API Changes:
11
+ * Internal changes to built output to support multiple exports in future versions. (SUI-6279)
12
+
4
13
  7.0.0 - February 6, 2024
5
14
  ----------
6
15
  API Changes:
@@ -61,72 +61,61 @@
61
61
  e.r(n);
62
62
  // EXPORTS
63
63
  e.d(n, {
64
+ AppBar: () => /* reexport */ y,
65
+ SplunkBar: () => /* reexport */ b,
64
66
  default: () => /* binding */ X
65
67
  });
66
68
  // CONCATENATED MODULE: external "react-dom"
67
69
  const r = require("react-dom");
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
70
  // CONCATENATED MODULE: external "styled-components"
82
- const p = require("styled-components");
83
- var s = e.n(p);
71
+ const t = require("styled-components");
72
+ var a = e.n(t);
84
73
  // CONCATENATED MODULE: external "@splunk/themes"
85
- const v = require("@splunk/themes");
74
+ const i = require("@splunk/themes");
86
75
  // 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() {
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() {
90
79
  return e;
91
80
  };
92
81
  return e;
93
82
  }
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() {
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() {
97
86
  return e;
98
87
  };
99
88
  return e;
100
89
  }
101
- function h() {
102
- var e = k([ "\n background-color: ", ";\n min-height: ", "px;\n" ]);
103
- h = function n() {
90
+ function u() {
91
+ var e = s([ "\n background-color: ", ";\n min-height: ", "px;\n" ]);
92
+ u = function n() {
104
93
  return e;
105
94
  };
106
95
  return e;
107
96
  }
108
- function b() {
109
- var e = k([ "\n padding: 0;\n background-color: ", ";\n height: ", "px;\n" ]);
110
- b = function n() {
97
+ function c() {
98
+ var e = s([ "\n padding: 0;\n background-color: ", ";\n height: ", "px;\n" ]);
99
+ c = function n() {
111
100
  return e;
112
101
  };
113
102
  return e;
114
103
  }
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() {
104
+ 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" ]);
106
+ d = function n() {
118
107
  return e;
119
108
  };
120
109
  return e;
121
110
  }
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() {
111
+ 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" ]);
113
+ p = function n() {
125
114
  return e;
126
115
  };
127
116
  return e;
128
117
  }
129
- function k(e, n) {
118
+ function s(e, n) {
130
119
  if (!n) {
131
120
  n = e.slice(0);
132
121
  }
@@ -136,23 +125,36 @@
136
125
  }
137
126
  }));
138
127
  }
139
- var S = 45;
140
- var j = 34;
141
- var w = (0, p.keyframes)(g());
142
- var E = s().div(y(), v.variables.backgroundColorPage);
143
- var C = s().div(b(), (0, v.pick)({
144
- prisma: v.variables.backgroundColorSection,
145
- enterprise: v.variables.gray20
146
- }), j);
147
- var B = s().div(h(), (0, v.pick)({
148
- prisma: v.variables.backgroundColorPopup,
149
- enterprise: v.variables.gray30
150
- }), S);
151
- var x = s().div(m(), v.variables.contentColorInverted);
152
- var q = s().div(f(), w, v.variables.neutral500, (0, v.pick)({
153
- prisma: v.variables.spacingMedium,
154
- enterprise: v.variables.spacingHalf
128
+ var v = 45;
129
+ var f = 34;
130
+ var h = (0, t.keyframes)(p());
131
+ var m = a().div(d(), i.variables.backgroundColorPage);
132
+ var b = a().div(c(), (0, i.pick)({
133
+ prisma: i.variables.backgroundColorSection,
134
+ enterprise: i.variables.gray20
135
+ }), f);
136
+ var y = a().div(u(), (0, i.pick)({
137
+ prisma: i.variables.backgroundColorPopup,
138
+ enterprise: i.variables.gray30
139
+ }), v);
140
+ var g = a().div(l(), i.variables.contentColorInverted);
141
+ var k = a().div(o(), h, i.variables.neutral500, (0, i.pick)({
142
+ prisma: i.variables.spacingMedium,
143
+ enterprise: i.variables.spacingHalf
155
144
  }));
145
+ // CONCATENATED MODULE: external "react"
146
+ const S = require("react");
147
+ var j = e.n(S);
148
+ // CONCATENATED MODULE: external "scriptjs"
149
+ const w = require("scriptjs");
150
+ var C = e.n(w);
151
+ // CONCATENATED MODULE: external "@splunk/react-ui/Layer"
152
+ const B = require("@splunk/react-ui/Layer");
153
+ // CONCATENATED MODULE: external "@splunk/splunk-utils/url"
154
+ const E = require("@splunk/splunk-utils/url");
155
+ // CONCATENATED MODULE: external "@splunk/themes/SplunkThemeProvider"
156
+ const x = require("@splunk/themes/SplunkThemeProvider");
157
+ var q = e.n(x);
156
158
  // CONCATENATED MODULE: external "prop-types"
157
159
  const O = require("prop-types");
158
160
  var A = e.n(O);
@@ -160,9 +162,9 @@
160
162
  const P = require("@splunk/react-ui/ScreenReaderContent");
161
163
  var F = e.n(P);
162
164
  // CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
163
- const _ = require("@splunk/ui-utils/i18n");
165
+ const L = require("@splunk/ui-utils/i18n");
164
166
  // CONCATENATED MODULE: ./src/Loading.jsx
165
- var L = {
167
+ var _ = {
166
168
  hideAppBar: A().bool,
167
169
  hideChrome: A().bool,
168
170
  hideSplunkBar: A().bool,
@@ -173,16 +175,16 @@
173
175
  hideAppBar: false,
174
176
  hideChrome: false,
175
177
  hideSplunkBar: false,
176
- AppBarFallback: B,
177
- SplunkBarFallback: C
178
+ AppBarFallback: y,
179
+ SplunkBarFallback: b
178
180
  };
179
181
  function H(e) {
180
- var n = e.hideAppBar, r = e.hideChrome, t = e.hideSplunkBar, i = e.SplunkBarFallback, o = e.AppBarFallback;
182
+ var n = e.hideAppBar, r = e.hideChrome, t = e.hideSplunkBar, a = e.SplunkBarFallback, i = e.AppBarFallback;
181
183
 
182
- return a().createElement(E, null, !r && !t && a().createElement(i, null), !r && !n && a().createElement(o, null), a().createElement(x, null, a().createElement(q, null), a().createElement(q, null), a().createElement(q, null), a().createElement(F(), null, (0,
183
- _._)("Loading"))));
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"))));
184
186
  }
185
- H.propTypes = L;
187
+ H.propTypes = _;
186
188
  H.defaultProps = T;
187
189
  /* harmony default export */ const M = H;
188
190
  // CONCATENATED MODULE: ./src/baseLayout.jsx
@@ -226,15 +228,15 @@
226
228
  */ function N(e, n) {
227
229
  var r = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, t = r.loader, a = t === void 0 ? "scriptjs" : t;
228
230
  var i = e === "dark" ? R : I;
229
- var l = (0, u.createStaticURL)(i);
231
+ var o = (0, E.createStaticURL)(i);
230
232
  if (a === "scriptjs") {
231
- o()(l, (function() {
233
+ C()(o, (function() {
232
234
  // eslint-disable-next-line no-underscore-dangle
233
235
  n(window.__splunk_layout__);
234
236
  }));
235
237
  } else if (a === "requirejs") {
236
238
  if (window.requirejs) {
237
- window.requirejs([ l ], n);
239
+ window.requirejs([ o ], n);
238
240
  } else {
239
241
  throw new Error('Error in react-page: options.loader = "requirejs" was set but window.requirejs does not exist.');
240
242
  }
@@ -274,9 +276,9 @@
274
276
  * @private
275
277
  */ function J(e, n, r) {
276
278
  var t = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
277
- var i = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
278
- var o = t ? a().createElement(l.LayerStackGlobalProvider, null, a().createElement(d(), i, e)) : a().createElement(d(), i, e);
279
- return n(o, r);
279
+ 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);
281
+ return n(i, r);
280
282
  }
281
283
  /**
282
284
  * Renders a React element into the Layout API.
@@ -304,50 +306,54 @@
304
306
  * @param {function} [options.onLayoutComplete] - A callback function which executes after layout API is fetched and compiled.
305
307
  */ function K(e, n) {
306
308
  var r = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
307
- 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 = z(r, [ "useGlobalLayerStack", "pageTitle", "theme", "loader" ]);
308
- if (o) {
309
- document.title = o;
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" ]);
310
+ if (i) {
311
+ document.title = i;
310
312
  }
311
- 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 ? B : y, k = s.lazyLoadLayout, w = k === void 0 ? false : k, E = s.onLayoutComplete;
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;
312
314
  var x = document.createElement("div");
313
- var q = document.createElement("div");
315
+ var O = document.createElement("div");
316
+ E === null || E === void 0 ? void 0 : E({
317
+ headerContainer: O,
318
+ bodyContainer: x
319
+ });
314
320
  // The "theme" in enterprise used to be "enterprise" instead of "light"...
315
- var O = u === "light" || u === "enterprise" ? "light" : "dark";
316
- var A = {
321
+ var A = l === "light" || l === "enterprise" ? "light" : "dark";
322
+ var P = {
317
323
  family: "enterprise",
318
- colorScheme: O,
324
+ colorScheme: A,
319
325
  density: "comfortable"
320
326
  };
321
- var P;
322
327
  var F;
323
- if (w) {
328
+ var L;
329
+ if (C) {
324
330
  // render the React app immediately without waiting for layout API
325
- if (!v) {
326
- document.body.appendChild(q);
327
- F = n( a().createElement(a().Fragment, null, !m && a().createElement(b, null), !f && a().createElement(g, null)), q);
331
+ if (!p) {
332
+ document.body.appendChild(O);
333
+ L = n( j().createElement(j().Fragment, null, !h && j().createElement(g, null), !s && j().createElement(S, null)), O);
328
334
  // explicitly set height and background of header container to avoid layout and color shift when fallback gets replaced
329
- var _ = q.offsetHeight;
330
- var L = D(q, {
331
- hideSplunkBar: m,
332
- hideAppBar: f,
335
+ var _ = O.offsetHeight;
336
+ var T = D(O, {
337
+ hideSplunkBar: h,
338
+ hideAppBar: s,
333
339
  headerHeight: _,
334
- AppBarFallback: g,
335
- SplunkBarFallback: b
340
+ AppBarFallback: S,
341
+ SplunkBarFallback: g
336
342
  });
337
- q.style.height = "".concat(_, "px");
338
- q.style.background = "".concat(L);
343
+ O.style.height = "".concat(_, "px");
344
+ O.style.background = "".concat(T);
339
345
  }
340
346
  document.body.appendChild(x);
341
- P = J(e, n, x, i, A);
347
+ F = J(e, n, x, a, P);
342
348
  } else {
343
349
  document.body.appendChild(x);
344
- P = n( a().createElement(d(), A, a().createElement(M, s)), x);
350
+ F = n( j().createElement(q(), P, j().createElement(M, d)), x);
345
351
  }
346
- N(u, (function(r) {
352
+ N(l, (function(r) {
347
353
  var t;
348
354
  if (r) {
349
- t = r.create(s).getContainerElement();
350
- if (s.layout === "fixed") {
355
+ t = r.create(d).getContainerElement();
356
+ if (d.layout === "fixed") {
351
357
  // the above create method adds flex: 1 0 0
352
358
  // IE 11 disregards 0px shorthand for flex-basis component.
353
359
  // flex-basis 0% is better than 0px because css minification can remove px
@@ -371,29 +377,29 @@
371
377
  t = document.createElement("div");
372
378
  document.body.appendChild(t);
373
379
  }
374
- if (w) {
375
- if (!v) {
380
+ if (C) {
381
+ if (!p) {
376
382
  // replace placeholder nav bar with real nav bar
377
- F.unmount(q);
378
- var a = document.querySelector(U);
379
- var o = (!v && !m ? j : 0) + (!v && !f ? S : 0);
383
+ L.unmount(O);
384
+ var i = document.querySelector(U);
385
+ var o = (!p && !h ? f : 0) + (!p && !s ? v : 0);
380
386
  // set a min-height for basic nav bar components and auto height for any additional components like global banner
381
- q.style.minHeight = "".concat(o, "px");
382
- q.style.height = "auto";
383
- q.appendChild(a);
387
+ O.style.minHeight = "".concat(o, "px");
388
+ O.style.height = "auto";
389
+ O.appendChild(i);
384
390
  }
385
391
  t.appendChild(x);
386
- E === null || E === void 0 ? void 0 : E();
392
+ B === null || B === void 0 ? void 0 : B();
387
393
  } else {
388
394
  setTimeout((function() {
389
- P.unmount(x);
390
- P = J(e, n, x, i, A);
395
+ F.unmount(x);
396
+ F = J(e, n, x, a, P);
391
397
  t.appendChild(x);
392
- E === null || E === void 0 ? void 0 : E();
398
+ B === null || B === void 0 ? void 0 : B();
393
399
  }), 30);
394
400
  }
395
401
  }), {
396
- loader: p
402
+ loader: c
397
403
  });
398
404
  }
399
405
  /* harmony default export */ const Q = K;
@@ -429,6 +435,7 @@
429
435
  * @param {element} [options.SplunkBarFallback = SplunkBar] - A React element used as a placeholder for the splunk bar while the navigation bar is loading.
430
436
  * @param {element} [options.AppBarFallback = AppBar] - A React element used as a placeholder for the app bar while the navigation bar is loading.
431
437
  * @param {function} [options.onLayoutComplete] - A callback function which executes after layout API is fetched and compiled.
438
+ * @param {function} [options.onLayoutStart] - A callback function which executes once the layout starts to render
432
439
  */ function W(e, n) {
433
440
  Q(e, V, n);
434
441
  }
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@splunk/react-page",
3
- "version": "7.0.0",
3
+ "version": "7.1.0",
4
4
  "description": "Load React components into the latest layout from Splunk Enterprise",
5
- "main": "lib/index.js",
6
5
  "license": "Apache-2.0",
7
6
  "author": "Splunk Inc.",
8
7
  "scripts": {
@@ -22,9 +21,9 @@
22
21
  "test:cypress:ci": "node src/tests/run-cypress-tests.js"
23
22
  },
24
23
  "dependencies": {
25
- "@splunk/react-ui": "^4.25.0",
26
- "@splunk/splunk-utils": "^3.0.0",
27
- "@splunk/themes": "^0.16.4",
24
+ "@splunk/react-ui": "^4.33.0",
25
+ "@splunk/splunk-utils": "^3.1.0",
26
+ "@splunk/themes": "^0.19.0",
28
27
  "@splunk/ui-utils": "^1.6.0",
29
28
  "prop-types": "^15.6.2",
30
29
  "scriptjs": "^2.5.8"