@splunk/react-ui 4.20.0 → 4.21.1

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 (101) hide show
  1. package/Accordion.js +425 -441
  2. package/Anchor.js +147 -193
  3. package/Animation.js +142 -166
  4. package/AnimationToggle.js +197 -253
  5. package/Box.js +145 -194
  6. package/Breadcrumbs.js +288 -298
  7. package/Button.js +488 -613
  8. package/ButtonGroup.js +160 -212
  9. package/ButtonSimple.js +543 -562
  10. package/CHANGELOG.md +26 -0
  11. package/Calendar.js +1107 -1195
  12. package/Card.js +771 -746
  13. package/CardLayout.js +205 -223
  14. package/Chip.js +509 -612
  15. package/Clickable.js +416 -472
  16. package/CloseButton.js +165 -250
  17. package/Code.js +1808 -2172
  18. package/Code.js.LICENSE.txt +8 -0
  19. package/CollapsiblePanel.js +586 -675
  20. package/Color.js +1066 -1297
  21. package/ColumnLayout.js +402 -465
  22. package/ComboBox.js +892 -969
  23. package/Concertina.js +998 -963
  24. package/ControlGroup.js +687 -718
  25. package/Date.js +567 -697
  26. package/DefinitionList.js +308 -310
  27. package/Divider.js +149 -194
  28. package/Dropdown.js +459 -558
  29. package/DualListbox.js +1480 -1735
  30. package/EventListener.js +94 -165
  31. package/File.js +1051 -1173
  32. package/FormRows.js +885 -880
  33. package/Heading.js +216 -263
  34. package/Image.js +446 -558
  35. package/JSONTree.js +690 -699
  36. package/Layer.js +442 -582
  37. package/Link.js +336 -361
  38. package/List.js +213 -237
  39. package/Markdown.js +510 -612
  40. package/Menu.js +1109 -1331
  41. package/Message.js +474 -629
  42. package/MessageBar.js +387 -561
  43. package/Modal.js +810 -798
  44. package/ModalLayer.js +326 -343
  45. package/Monogram.js +308 -368
  46. package/Multiselect.js +3558 -3998
  47. package/Number.js +729 -843
  48. package/Paginator.js +510 -615
  49. package/Paragraph.js +145 -188
  50. package/Popover.js +1470 -1693
  51. package/Progress.js +301 -362
  52. package/RadioBar.js +610 -651
  53. package/RadioList.js +483 -544
  54. package/Resize.js +530 -623
  55. package/ResultsMenu.js +494 -597
  56. package/ScreenReaderContent.js +142 -187
  57. package/Scroll.js +595 -598
  58. package/ScrollContainerContext.js +197 -278
  59. package/Search.js +745 -817
  60. package/Select.js +2441 -2746
  61. package/SidePanel.js +390 -392
  62. package/Slider.js +668 -825
  63. package/SlidingPanels.js +639 -645
  64. package/SplitButton.js +464 -499
  65. package/StaticContent.js +161 -217
  66. package/StepBar.js +386 -466
  67. package/Switch.js +710 -764
  68. package/TabBar.js +724 -815
  69. package/TabLayout.js +406 -438
  70. package/Table.js +4842 -5121
  71. package/Text.js +1169 -1351
  72. package/TextArea.js +1097 -1307
  73. package/Tooltip.js +624 -721
  74. package/TransitionOpen.js +489 -546
  75. package/Typography.js +176 -229
  76. package/WaitSpinner.js +230 -298
  77. package/package.json +14 -15
  78. package/stubs-splunkui.d.ts +4 -1
  79. package/types/src/ComboBox/Option.d.ts +1 -1
  80. package/types/src/Concertina/Concertina.d.ts +4 -0
  81. package/types/src/JSONTree/JSONTreeContext.d.ts +7 -0
  82. package/types/src/JSONTree/TreeNode.d.ts +5 -0
  83. package/types/src/Link/Link.d.ts +7 -3
  84. package/types/src/Link/docs/examples/NewWindow.d.ts +2 -0
  85. package/types/src/Markdown/Markdown.d.ts +1 -1
  86. package/types/src/Markdown/renderers/MarkdownHeading.d.ts +1 -1
  87. package/types/src/Menu/Item.d.ts +1 -1
  88. package/types/src/Menu/Menu.d.ts +1 -0
  89. package/types/src/MessageBar/docs/examples/WithActions.d.ts +2 -0
  90. package/types/src/Multiselect/Option.d.ts +1 -1
  91. package/types/src/Search/Option.d.ts +1 -1
  92. package/types/src/Select/Option.d.ts +1 -1
  93. package/types/src/Select/OptionBase.d.ts +1 -1
  94. package/types/src/fixtures/FetchOptions.d.ts +2 -8
  95. package/useForceUpdate.js +112 -146
  96. package/useKeyPress.js +74 -128
  97. package/usePrevious.js +65 -129
  98. package/useRovingFocus.js +122 -218
  99. package/types/src/Link/docs/examples/NewTab.d.ts +0 -2
  100. /package/types/src/Table/docs/examples/{DockedHeader.d.ts → DockedHeaderScrollbar.d.ts} +0 -0
  101. /package/types/src/Table/docs/examples/prisma/{DockedHeader.d.ts → DockedHeaderScrollbar.d.ts} +0 -0
package/Calendar.js CHANGED
@@ -1,1216 +1,1128 @@
1
- module.exports =
2
- /******/ (function(modules) { // webpackBootstrap
3
- /******/ // The module cache
4
- /******/ var installedModules = {};
5
- /******/
6
- /******/ // The require function
7
- /******/ function __webpack_require__(moduleId) {
8
- /******/
9
- /******/ // Check if module is in cache
10
- /******/ if(installedModules[moduleId]) {
11
- /******/ return installedModules[moduleId].exports;
12
- /******/ }
13
- /******/ // Create a new module (and put it into the cache)
14
- /******/ var module = installedModules[moduleId] = {
15
- /******/ i: moduleId,
16
- /******/ l: false,
17
- /******/ exports: {}
18
- /******/ };
19
- /******/
20
- /******/ // Execute the module function
21
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
22
- /******/
23
- /******/ // Flag the module as loaded
24
- /******/ module.l = true;
25
- /******/
26
- /******/ // Return the exports of the module
27
- /******/ return module.exports;
28
- /******/ }
29
- /******/
30
- /******/
31
- /******/ // expose the modules object (__webpack_modules__)
32
- /******/ __webpack_require__.m = modules;
33
- /******/
34
- /******/ // expose the module cache
35
- /******/ __webpack_require__.c = installedModules;
36
- /******/
37
- /******/ // define getter function for harmony exports
38
- /******/ __webpack_require__.d = function(exports, name, getter) {
39
- /******/ if(!__webpack_require__.o(exports, name)) {
40
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
41
- /******/ }
42
- /******/ };
43
- /******/
44
- /******/ // define __esModule on exports
45
- /******/ __webpack_require__.r = function(exports) {
46
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
47
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
48
- /******/ }
49
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
50
- /******/ };
51
- /******/
52
- /******/ // create a fake namespace object
53
- /******/ // mode & 1: value is a module id, require it
54
- /******/ // mode & 2: merge all properties of value into the ns
55
- /******/ // mode & 4: return value when already ns object
56
- /******/ // mode & 8|1: behave like require
57
- /******/ __webpack_require__.t = function(value, mode) {
58
- /******/ if(mode & 1) value = __webpack_require__(value);
59
- /******/ if(mode & 8) return value;
60
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
61
- /******/ var ns = Object.create(null);
62
- /******/ __webpack_require__.r(ns);
63
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
64
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
65
- /******/ return ns;
66
- /******/ };
67
- /******/
68
- /******/ // getDefaultExport function for compatibility with non-harmony modules
69
- /******/ __webpack_require__.n = function(module) {
70
- /******/ var getter = module && module.__esModule ?
71
- /******/ function getDefault() { return module['default']; } :
72
- /******/ function getModuleExports() { return module; };
73
- /******/ __webpack_require__.d(getter, 'a', getter);
74
- /******/ return getter;
75
- /******/ };
76
- /******/
77
- /******/ // Object.prototype.hasOwnProperty.call
78
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
79
- /******/
80
- /******/ // __webpack_public_path__
81
- /******/ __webpack_require__.p = "";
82
- /******/
83
- /******/
84
- /******/ // Load entry module and return exports
85
- /******/ return __webpack_require__(__webpack_require__.s = 176);
86
- /******/ })
87
- /************************************************************************/
88
- /******/ ({
89
-
90
- /***/ 0:
91
- /***/ (function(module, exports) {
92
-
93
- module.exports = require("@splunk/themes");
94
-
95
- /***/ }),
96
-
97
- /***/ 1:
98
- /***/ (function(module, exports) {
99
-
100
- module.exports = require("prop-types");
101
-
102
- /***/ }),
103
-
104
- /***/ 10:
105
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
106
-
107
- "use strict";
108
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return updateReactRef; });
109
- /**
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 = t => {
12
+ /******/ var r = t && t.__esModule ?
13
+ /******/ () => t["default"]
14
+ /******/ : () => t
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 = (t, r) => {
27
+ /******/ for (var n in r) {
28
+ /******/ if (e.o(r, n) && !e.o(t, n)) {
29
+ /******/ Object.defineProperty(t, n, {
30
+ enumerable: true,
31
+ get: r[n]
32
+ });
33
+ /******/ }
34
+ /******/ }
35
+ /******/ };
36
+ /******/ })();
37
+ /******/
38
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
39
+ /******/ (() => {
40
+ /******/ e.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t)
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 t = {};
60
+ // ESM COMPAT FLAG
61
+ e.r(t);
62
+ // EXPORTS
63
+ e.d(t, {
64
+ calendarActiveSelector: () => /* reexport */ qe,
65
+ default: () => /* reexport */ He
66
+ });
67
+ // CONCATENATED MODULE: external "react"
68
+ const r = require("react");
69
+ var n = e.n(r);
70
+ // CONCATENATED MODULE: external "prop-types"
71
+ const a = require("prop-types");
72
+ var o = e.n(a);
73
+ // CONCATENATED MODULE: external "lodash/keys"
74
+ const l = require("lodash/keys");
75
+ var i = e.n(l);
76
+ // CONCATENATED MODULE: external "lodash/omit"
77
+ const u = require("lodash/omit");
78
+ var c = e.n(u);
79
+ // CONCATENATED MODULE: external "moment"
80
+ const s = require("moment");
81
+ var f = e.n(s);
82
+ // CONCATENATED MODULE: external "@splunk/ui-utils/id"
83
+ const d = require("@splunk/ui-utils/id");
84
+ // CONCATENATED MODULE: external "lodash/times"
85
+ const p = require("lodash/times");
86
+ var v = e.n(p);
87
+ // CONCATENATED MODULE: external "@splunk/themes"
88
+ const y = require("@splunk/themes");
89
+ // CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
90
+ const h = require("@splunk/ui-utils/keyboard");
91
+ // CONCATENATED MODULE: external "@splunk/react-ui/ScreenReaderContent"
92
+ const m = require("@splunk/react-ui/ScreenReaderContent");
93
+ var b = e.n(m);
94
+ // CONCATENATED MODULE: external "styled-components"
95
+ const Y = require("styled-components");
96
+ var g = e.n(Y);
97
+ // CONCATENATED MODULE: ./src/Calendar/DayStyles.ts
98
+ /* Element used to prevent vertical shift on firefox when the font-weight is increased with $selected */
99
+ var M = g().div.withConfig({
100
+ displayName: "DayStyles__StyledValue",
101
+ componentId: "sc-1nryhyt-0"
102
+ })([ "left:0;line-height:", ";position:absolute;top:0;width:100%;" ], (0, y.pick)({
103
+ enterprise: "2em",
104
+ prisma: "36px "
105
+ }));
106
+ var D = g().div.withConfig({
107
+ displayName: "DayStyles__StyledInner",
108
+ componentId: "sc-1nryhyt-1"
109
+ })([ "border:", ";border-radius:", ";color:", ";height:", ";position:relative;text-align:center;width:", ";" ], (0,
110
+ y.pick)({
111
+ enterprise: "1px solid transparent",
112
+ prisma: "none"
113
+ }), (0, y.pick)({
114
+ enterprise: y.variables.borderRadius,
115
+ prisma: "50%"
116
+ }), (0, y.pick)({
117
+ enterprise: {
118
+ light: y.variables.gray45,
119
+ dark: y.variables.gray98
120
+ },
121
+ prisma: y.variables.contentColorActive
122
+ }), (0, y.pick)({
123
+ enterprise: "2em",
124
+ prisma: "36px "
125
+ }), (0, y.pick)({
126
+ enterprise: "calc(2em - 2px)",
127
+ prisma: "36px"
128
+ }));
129
+ var k = g().td.withConfig({
130
+ displayName: "DayStyles__StyledCell",
131
+ componentId: "sc-1nryhyt-2"
132
+ })([ "", ";cursor:pointer;", ";", ";" ], y.mixins.reset("table-cell"), (0, y.pickVariant)("$today", {
133
+ true: {
134
+ enterprise: (0, Y.css)([ "& > ", "{background-color:", ";}&:focus{& > ", "{box-shadow:", ";}}" ],
135
+ /* sc-sel */
136
+ D, (0, y.pick)({
137
+ light: y.variables.gray92,
138
+ dark: y.variables.gray45
139
+ }),
140
+ /* sc-sel */
141
+ D, y.variables.focusShadow),
142
+ prisma: (0, Y.css)([ "& > ", "{box-shadow:inset 0 0 0 1px ", ";}&:focus{& > ", "{box-shadow:inset 0 0 0 1px ", ",", ";}}" ],
143
+ /* sc-sel */
144
+ D, y.variables.interactiveColorBorder,
145
+ /* sc-sel */
146
+ D, y.variables.interactiveColorBorder, y.variables.focusShadow)
147
+ },
148
+ false: (0, Y.css)([ "&:focus{& > ", "{box-shadow:", ";}}" ],
149
+ /* sc-sel */
150
+ D, y.variables.focusShadow)
151
+ }), (0, y.pickVariant)("$selected", {
152
+ true: (0, y.pick)({
153
+ enterprise: (0, Y.css)([ "& > ", "{border-color:", ";}" ],
154
+ /* sc-sel */
155
+ D, y.variables.linkColor),
156
+ prisma: (0, Y.css)([ "& > ", "{background-color:", ";font-weight:", ";}" ],
157
+ /* sc-sel */
158
+ D, y.variables.interactiveColorOverlaySelected, y.variables.fontWeightBold)
159
+ }),
160
+ false: (0, y.pick)({
161
+ enterprise: (0, Y.css)([ "&:hover{& > ", "{background-color:", ";color:", ";}}" ],
162
+ /* sc-sel */
163
+ D, y.variables.backgroundColorHover, y.variables.linkColor),
164
+ prisma: (0, Y.css)([ "&:hover{& > ", "{background-color:", ";}}" ],
165
+ /* sc-sel */
166
+ D, y.variables.interactiveColorOverlayHover)
167
+ })
168
+ }));
169
+ // CONCATENATED MODULE: ./src/Calendar/Day.tsx
170
+ function w() {
171
+ w = Object.assign || function(e) {
172
+ for (var t = 1; t < arguments.length; t++) {
173
+ var r = arguments[t];
174
+ for (var n in r) {
175
+ if (Object.prototype.hasOwnProperty.call(r, n)) {
176
+ e[n] = r[n];
177
+ }
178
+ }
179
+ }
180
+ return e;
181
+ };
182
+ return w.apply(this, arguments);
183
+ }
184
+ function O(e, t) {
185
+ if (e == null) return {};
186
+ var r = C(e, t);
187
+ var n, a;
188
+ if (Object.getOwnPropertySymbols) {
189
+ var o = Object.getOwnPropertySymbols(e);
190
+ for (a = 0; a < o.length; a++) {
191
+ n = o[a];
192
+ if (t.indexOf(n) >= 0) continue;
193
+ if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
194
+ r[n] = e[n];
195
+ }
196
+ }
197
+ return r;
198
+ }
199
+ function C(e, t) {
200
+ if (e == null) return {};
201
+ var r = {};
202
+ var n = Object.keys(e);
203
+ var a, o;
204
+ for (o = 0; o < n.length; o++) {
205
+ a = n[o];
206
+ if (t.indexOf(a) >= 0) continue;
207
+ r[a] = e[a];
208
+ }
209
+ return r;
210
+ }
211
+ var S = {
212
+ active: o().bool,
213
+ locale: o().string,
214
+ onClick: o().func,
215
+ onKeydown: o().func,
216
+ selected: o().bool,
217
+ today: o().bool,
218
+ value: o().string
219
+ };
220
+ function x(e) {
221
+ var t = e.active, a = t === void 0 ? false : t, o = e.locale, l = o === void 0 ? "en_US" : o, i = e.onClick, u = e.onKeyDown, c = e.selected, s = c === void 0 ? false : c, d = e.today, p = d === void 0 ? false : d, v = e.value, y = O(e, [ "active", "locale", "onClick", "onKeyDown", "selected", "today", "value" ]);
222
+ var h = (0, r.useCallback)((function(e) {
223
+ e.preventDefault();
224
+ i === null || i === void 0 ? void 0 : i(e, {
225
+ value: v
226
+ });
227
+ }), [ i, v ]);
228
+ var m = (0, r.useCallback)((function(e) {
229
+ e.preventDefault();
230
+ u === null || u === void 0 ? void 0 : u(e, {
231
+ value: v
232
+ });
233
+ }), [ u, v ]);
234
+ var b = v && f()(v, "YYYY-MM-DD", l).format("D");
235
+
236
+ return n().createElement(k, w({
237
+ tabIndex: a ? 0 : -1,
238
+ "aria-selected": s,
239
+ "data-test-day": b,
240
+ "data-test": "day-of-month",
241
+ "data-active-day": a,
242
+ "data-is-today": p,
243
+ onClick: h,
244
+ onKeyDown: m,
245
+ $today: p,
246
+ $selected: s
247
+ }, y), n().createElement(D, null, n().createElement(M, null, b)));
248
+ }
249
+ x.propTypes = S;
250
+ /* harmony default export */ const j = x;
251
+ // CONCATENATED MODULE: ./src/Calendar/DateTableStyles.ts
252
+ var _ = g().table.withConfig({
253
+ displayName: "DateTableStyles__Styled",
254
+ componentId: "sc-1lbrjq0-0"
255
+ })([ "", ";table-layout:fixed;border-spacing:", ";width:", ";margin:", ";" ], y.mixins.reset("table"), (0,
256
+ y.pick)({
257
+ enterprise: "3px",
258
+ prisma: y.variables.spacingSmall
259
+ }), (0, y.pick)({
260
+ enterprise: "100%",
261
+ prisma: "calc(100% + 16px)"
262
+ }), (0, y.pick)({
263
+ enterprise: "0",
264
+ prisma: "-8px"
265
+ }));
266
+ var T = g().th.withConfig({
267
+ displayName: "DateTableStyles__StyledTableHeader",
268
+ componentId: "sc-1lbrjq0-1"
269
+ })([ "", ";text-align:center;padding-bottom:", ";color:", ";font-size:", ";" ], y.mixins.reset("table-cell"), (0,
270
+ y.pick)({
271
+ enterprise: "2px",
272
+ prisma: y.variables.spacingXSmall
273
+ }), y.variables.contentColorMuted, (0, y.pick)({
274
+ enterprise: y.variables.fontSizeSmall,
275
+ prisma: y.variables.fontSize
276
+ }));
277
+ // CONCATENATED MODULE: ./src/Calendar/DateTable.tsx
278
+ function E() {
279
+ E = Object.assign || function(e) {
280
+ for (var t = 1; t < arguments.length; t++) {
281
+ var r = arguments[t];
282
+ for (var n in r) {
283
+ if (Object.prototype.hasOwnProperty.call(r, n)) {
284
+ e[n] = r[n];
285
+ }
286
+ }
287
+ }
288
+ return e;
289
+ };
290
+ return E.apply(this, arguments);
291
+ }
292
+ function P(e, t) {
293
+ if (e == null) return {};
294
+ var r = I(e, t);
295
+ var n, a;
296
+ if (Object.getOwnPropertySymbols) {
297
+ var o = Object.getOwnPropertySymbols(e);
298
+ for (a = 0; a < o.length; a++) {
299
+ n = o[a];
300
+ if (t.indexOf(n) >= 0) continue;
301
+ if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
302
+ r[n] = e[n];
303
+ }
304
+ }
305
+ return r;
306
+ }
307
+ function I(e, t) {
308
+ if (e == null) return {};
309
+ var r = {};
310
+ var n = Object.keys(e);
311
+ var a, o;
312
+ for (o = 0; o < n.length; o++) {
313
+ a = n[o];
314
+ if (t.indexOf(a) >= 0) continue;
315
+ r[a] = e[a];
316
+ }
317
+ return r;
318
+ }
319
+ var V = {
320
+ displayValue: o().string.isRequired,
321
+ highlightToday: o().bool,
322
+ labelledBy: o().string,
323
+ locale: o().string,
324
+ onChange: o().func,
325
+ onInternalChange: o().func,
326
+ selectedValue: o().string.isRequired,
327
+ todayValue: o().string
328
+ };
329
+ function R(e) {
330
+ return v()(e, (function(e) {
331
+
332
+ return n().createElement("td", {
333
+ key: "".concat(e)
334
+ });
335
+ }));
336
+ }
337
+ function q(e) {
338
+ var t = e.displayValue, r = e.endDate, a = e.highlightToday, o = e.locale, l = e.onChange, i = e.onKeyDown, u = e.selectedDate, c = e.selectedValue, s = e.startDate, d = e.todayValue;
339
+ var p = f()(s).locale(o).startOf("month");
340
+ var v = [];
341
+ while (p.isSameOrBefore(r)) {
342
+ var y = p.format("YYYY-MM-DD");
343
+ var h = y === d;
344
+ var m = y === c;
345
+ var b = y === t;
346
+ v.push( n().createElement(j, {
347
+ key: y,
348
+ locale: o,
349
+ onClick: l,
350
+ onKeyDown: i,
351
+ active: u ? b : h,
352
+ today: a && h,
353
+ value: y,
354
+ selected: m
355
+ }));
356
+ p.add(1, "day");
357
+ }
358
+ return v;
359
+ }
360
+ function B(e) {
361
+ return e.reduce((function(e, t, r) {
362
+ var n = Math.floor(r / 7);
363
+ e[n].push(t);
364
+ return e;
365
+ }), v()(7, (function() {
366
+ return [];
367
+ }))).map((function(e, t) {
368
+
369
+ // eslint-disable-next-line react/no-array-index-key
370
+ return n().createElement("tr", {
371
+ key: "$week-".concat(t)
372
+ }, e);
373
+ }));
374
+ }
375
+ function F(e, t) {
376
+
377
+ return n().createElement("thead", null, n().createElement("tr", null, v()(7, (function(r) {
378
+ var a = f()().locale(e).weekday(r).format(t);
379
+ var o = f()().locale(e).weekday(r).format("dddd");
380
+
381
+ return n().createElement(T, {
382
+ key: a
383
+ }, n().createElement(b(), null, o), n().createElement("span", {
384
+ "aria-hidden": true
385
+ }, a));
386
+ }))));
387
+ }
388
+ function z(e) {
389
+ var t = e.displayValue, r = e.highlightToday, a = r === void 0 ? false : r, o = e.labelledBy, l = e.locale, i = l === void 0 ? "en_US" : l, u = e.onChange, c = e.onInternalChange, s = e.selectedValue, d = e.todayValue, p = P(e, [ "displayValue", "highlightToday", "labelledBy", "locale", "onChange", "onInternalChange", "selectedValue", "todayValue" ]);
390
+ var v = (0, y.useSplunkTheme)(), m = v.family;
391
+ var b = m === "prisma" ? "dd" : "ddd";
392
+ var Y = f()(t, "YYYY-MM-DD", i);
393
+ var g = f()(s, "YYYY-MM-DD", i);
394
+ var M = f()(Y).startOf("month");
395
+ var D = f()(Y).endOf("month").startOf("day");
396
+ var k = function e(t, r) {
397
+ t.preventDefault();
398
+ u === null || u === void 0 ? void 0 : u(t, r);
399
+ };
400
+ var w = function e(t, r) {
401
+ var n = r.value;
402
+ t.preventDefault();
403
+ c === null || c === void 0 ? void 0 : c(t, {
404
+ value: f()(n, "YYYY-MM-DD").add(-1, "d").format("YYYY-MM-DD")
405
+ });
406
+ };
407
+ var O = function e(t, r) {
408
+ var n = r.value;
409
+ t.preventDefault();
410
+ c === null || c === void 0 ? void 0 : c(t, {
411
+ value: f()(n, "YYYY-MM-DD").add(1, "d").format("YYYY-MM-DD")
412
+ });
413
+ };
414
+ var C = function e(t, r) {
415
+ var n = r.value;
416
+ t.preventDefault();
417
+ c === null || c === void 0 ? void 0 : c(t, {
418
+ value: f()(n, "YYYY-MM-DD").add(-1, "w").format("YYYY-MM-DD")
419
+ });
420
+ };
421
+ var S = function e(t, r) {
422
+ var n = r.value;
423
+ t.preventDefault();
424
+ c === null || c === void 0 ? void 0 : c(t, {
425
+ value: f()(n, "YYYY-MM-DD").add(1, "w").format("YYYY-MM-DD")
426
+ });
427
+ };
428
+ var x = function e(t, r) {
429
+ var n = r.value;
430
+ t.preventDefault();
431
+ c === null || c === void 0 ? void 0 : c(t, {
432
+ value: f()(n, "YYYY-MM-DD").add(-1, "M").format("YYYY-MM-DD")
433
+ });
434
+ };
435
+ var j = function e(t, r) {
436
+ var n = r.value;
437
+ t.preventDefault();
438
+ c === null || c === void 0 ? void 0 : c(t, {
439
+ value: f()(n, "YYYY-MM-DD").add(1, "M").format("YYYY-MM-DD")
440
+ });
441
+ };
442
+ var T = function e(t, r) {
443
+ var n = r.value;
444
+ t.preventDefault();
445
+ c === null || c === void 0 ? void 0 : c(t, {
446
+ value: f()(n, "YYYY-MM-DD").add(-1, "y").format("YYYY-MM-DD")
447
+ });
448
+ };
449
+ var I = function e(t, r) {
450
+ var n = r.value;
451
+ t.preventDefault();
452
+ c === null || c === void 0 ? void 0 : c(t, {
453
+ value: f()(n, "YYYY-MM-DD").add(1, "y").format("YYYY-MM-DD")
454
+ });
455
+ };
456
+ var V = function e(t, r) {
457
+ var n = r.value;
458
+ t.preventDefault();
459
+ c === null || c === void 0 ? void 0 : c(t, {
460
+ value: f()(n, "YYYY-MM-DD").startOf("week").format("YYYY-MM-DD")
461
+ });
462
+ };
463
+ var z = function e(t, r) {
464
+ var n = r.value;
465
+ t.preventDefault();
466
+ c === null || c === void 0 ? void 0 : c(t, {
467
+ value: f()(n, "YYYY-MM-DD").endOf("week").format("YYYY-MM-DD")
468
+ });
469
+ };
470
+ var H = function e(t, r) {
471
+ var n = (0, h.keycode)(t.nativeEvent);
472
+ switch (n) {
473
+ case "enter":
474
+ case "space":
475
+ k(t, r);
476
+ break;
477
+
478
+ case "up":
479
+ C(t, r);
480
+ break;
481
+
482
+ case "down":
483
+ S(t, r);
484
+ break;
485
+
486
+ case "left":
487
+ w(t, r);
488
+ break;
489
+
490
+ case "right":
491
+ O(t, r);
492
+ break;
493
+
494
+ case "page up":
495
+ if (t.shiftKey) {
496
+ T(t, r);
497
+ } else {
498
+ x(t, r);
499
+ }
500
+ break;
501
+
502
+ case "page down":
503
+ if (t.shiftKey) {
504
+ I(t, r);
505
+ } else {
506
+ j(t, r);
507
+ }
508
+ break;
509
+
510
+ case "home":
511
+ V(t, r);
512
+ break;
513
+
514
+ case "end":
515
+ z(t, r);
516
+ break;
517
+
518
+ default:
519
+ // do nothing
520
+ }
521
+ };
522
+ var N = R(M.format("e")).concat(q({
523
+ displayValue: t,
524
+ endDate: D,
525
+ highlightToday: a,
526
+ locale: i,
527
+ onChange: u,
528
+ onKeyDown: H,
529
+ selectedDate: g,
530
+ selectedValue: s,
531
+ startDate: M,
532
+ todayValue: d
533
+ })).concat(R(6 - D.format("e")));
534
+
535
+ return n().createElement(_, E({
536
+ role: "grid",
537
+ "aria-labelledby": o
538
+ }, p), F(i, b), n().createElement("tbody", null, B(N)));
539
+ }
540
+ z.propTypes = V;
541
+ /* harmony default export */ const H = z;
542
+ // CONCATENATED MODULE: external "@splunk/react-icons/ChevronLeft"
543
+ const N = require("@splunk/react-icons/ChevronLeft");
544
+ var K = e.n(N);
545
+ // CONCATENATED MODULE: external "@splunk/react-icons/ChevronRight"
546
+ const A = require("@splunk/react-icons/ChevronRight");
547
+ var U = e.n(A);
548
+ // CONCATENATED MODULE: external "@splunk/react-icons/enterprise/ChevronLeft"
549
+ const $ = require("@splunk/react-icons/enterprise/ChevronLeft");
550
+ var L = e.n($);
551
+ // CONCATENATED MODULE: external "@splunk/react-icons/enterprise/ChevronRight"
552
+ const W = require("@splunk/react-icons/enterprise/ChevronRight");
553
+ var X = e.n(W);
554
+ // CONCATENATED MODULE: external "@splunk/react-ui/Button"
555
+ const G = require("@splunk/react-ui/Button");
556
+ var J = e.n(G);
557
+ // CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
558
+ const Q = require("@splunk/ui-utils/i18n");
559
+ // CONCATENATED MODULE: ./src/Calendar/MonthHeaderStyles.ts
560
+ var Z = g().div.withConfig({
561
+ displayName: "MonthHeaderStyles__StyledBox",
562
+ componentId: "sc-18bmbh7-0"
563
+ })([ "display:flex;position:relative;line-height:", ";padding:0 2px;margin-bottom:10px;" ], y.variables.inputHeight);
564
+ var ee = g().span.withConfig({
565
+ displayName: "MonthHeaderStyles__StyledHeading",
566
+ componentId: "sc-18bmbh7-1"
567
+ })([ "display:block;text-align:center;text-transform:", ";flex:1 0 1px;", ";" ], (0,
568
+ y.pick)({
569
+ enterprise: "capitalize",
570
+ prisma: "uppercase"
571
+ }), (0, y.pick)({
572
+ prisma: (0, Y.css)([ "font-size:20px;font-weight:bold;color:", ";" ], y.variables.contentColorActive)
573
+ }));
574
+ // CONCATENATED MODULE: ./src/Calendar/MonthHeader.tsx
575
+ function te(e) {
576
+ "@babel/helpers - typeof";
577
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
578
+ te = function e(t) {
579
+ return typeof t;
580
+ };
581
+ } else {
582
+ te = function e(t) {
583
+ return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
584
+ };
585
+ }
586
+ return te(e);
587
+ }
588
+ function re(e, t) {
589
+ if (e == null) return {};
590
+ var r = ne(e, t);
591
+ var n, a;
592
+ if (Object.getOwnPropertySymbols) {
593
+ var o = Object.getOwnPropertySymbols(e);
594
+ for (a = 0; a < o.length; a++) {
595
+ n = o[a];
596
+ if (t.indexOf(n) >= 0) continue;
597
+ if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
598
+ r[n] = e[n];
599
+ }
600
+ }
601
+ return r;
602
+ }
603
+ function ne(e, t) {
604
+ if (e == null) return {};
605
+ var r = {};
606
+ var n = Object.keys(e);
607
+ var a, o;
608
+ for (o = 0; o < n.length; o++) {
609
+ a = n[o];
610
+ if (t.indexOf(a) >= 0) continue;
611
+ r[a] = e[a];
612
+ }
613
+ return r;
614
+ }
615
+ function ae(e, t) {
616
+ if (!(e instanceof t)) {
617
+ throw new TypeError("Cannot call a class as a function");
618
+ }
619
+ }
620
+ function oe(e, t) {
621
+ for (var r = 0; r < t.length; r++) {
622
+ var n = t[r];
623
+ n.enumerable = n.enumerable || false;
624
+ n.configurable = true;
625
+ if ("value" in n) n.writable = true;
626
+ Object.defineProperty(e, n.key, n);
627
+ }
628
+ }
629
+ function le(e, t, r) {
630
+ if (t) oe(e.prototype, t);
631
+ if (r) oe(e, r);
632
+ return e;
633
+ }
634
+ function ie(e, t) {
635
+ if (typeof t !== "function" && t !== null) {
636
+ throw new TypeError("Super expression must either be null or a function");
637
+ }
638
+ e.prototype = Object.create(t && t.prototype, {
639
+ constructor: {
640
+ value: e,
641
+ writable: true,
642
+ configurable: true
643
+ }
644
+ });
645
+ if (t) ue(e, t);
646
+ }
647
+ function ue(e, t) {
648
+ ue = Object.setPrototypeOf || function e(t, r) {
649
+ t.__proto__ = r;
650
+ return t;
651
+ };
652
+ return ue(e, t);
653
+ }
654
+ function ce(e) {
655
+ var t = de();
656
+ return function r() {
657
+ var n = pe(e), a;
658
+ if (t) {
659
+ var o = pe(this).constructor;
660
+ a = Reflect.construct(n, arguments, o);
661
+ } else {
662
+ a = n.apply(this, arguments);
663
+ }
664
+ return se(this, a);
665
+ };
666
+ }
667
+ function se(e, t) {
668
+ if (t && (te(t) === "object" || typeof t === "function")) {
669
+ return t;
670
+ }
671
+ return fe(e);
672
+ }
673
+ function fe(e) {
674
+ if (e === void 0) {
675
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
676
+ }
677
+ return e;
678
+ }
679
+ function de() {
680
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
681
+ if (Reflect.construct.sham) return false;
682
+ if (typeof Proxy === "function") return true;
683
+ try {
684
+ Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
685
+ return true;
686
+ } catch (e) {
687
+ return false;
688
+ }
689
+ }
690
+ function pe(e) {
691
+ pe = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
692
+ return t.__proto__ || Object.getPrototypeOf(t);
693
+ };
694
+ return pe(e);
695
+ }
696
+ function ve(e, t, r) {
697
+ if (t in e) {
698
+ Object.defineProperty(e, t, {
699
+ value: r,
700
+ enumerable: true,
701
+ configurable: true,
702
+ writable: true
703
+ });
704
+ } else {
705
+ e[t] = r;
706
+ }
707
+ return e;
708
+ }
709
+ var ye = {
710
+ headingId: o().string,
711
+ locale: o().string,
712
+ onChange: o().func,
713
+ /** @private */
714
+ splunkTheme: o().object,
715
+ value: o().string.isRequired
716
+ };
717
+ var he = {
718
+ locale: "en_US"
719
+ };
720
+ var me = function(e) {
721
+ ie(r, e);
722
+ var t = ce(r);
723
+ function r() {
724
+ var e;
725
+ ae(this, r);
726
+ for (var n = arguments.length, a = new Array(n), o = 0; o < n; o++) {
727
+ a[o] = arguments[o];
728
+ }
729
+ e = t.call.apply(t, [ this ].concat(a));
730
+ ve(fe(e), "handlePrevMonthClick", (function(t) {
731
+ e.handleChange(t, -1);
732
+ }));
733
+ ve(fe(e), "handleNextMonthClick", (function(t) {
734
+ e.handleChange(t, 1);
735
+ }));
736
+ return e;
737
+ }
738
+ le(r, [ {
739
+ key: "handleChange",
740
+ value: function e(t, r) {
741
+ var n, a;
742
+ t.stopPropagation();
743
+ var o = f()(this.props.value, "YYYY-MM-DD").add(r, "M").format("YYYY-MM-DD");
744
+ (n = (a = this.props).onChange) === null || n === void 0 ? void 0 : n.call(a, t, {
745
+ value: o
746
+ });
747
+ }
748
+ }, {
749
+ key: "render",
750
+ value: function e() {
751
+ var t = this.props, a = t.headingId, o = t.locale, l = t.value, i = t.splunkTheme, u = re(t, [ "headingId", "locale", "value", "splunkTheme" ]);
752
+ var s = i.isEnterprise, d = i.isPrisma;
753
+ var p = f()(l, "YYYY-MM-DD", o);
754
+ var v = p.format(r.getMonthYearFormat(o, d));
755
+ var h = {
756
+ flex: "0 0 auto"
757
+ };
758
+ var m = (0, Q._)("Previous month");
759
+ var b = (0, Q._)("Next month");
760
+
761
+ return n().createElement(y.SplunkThemeProvider, {
762
+ density: d ? "comfortable" : i.density
763
+ }, n().createElement(Z, c()(u, "onChange"), n().createElement(J(), {
764
+ appearance: "pill",
765
+ icon: s ? n().createElement(L(), {
766
+ hideDefaultTooltip: true,
767
+ screenReaderText: m,
768
+ size: 1
769
+ }) : n().createElement(K(), {
770
+ "aria-label": m,
771
+ height: "24",
772
+ width: "24"
773
+ }),
774
+ "data-test": "previous-month",
775
+ onClick: this.handlePrevMonthClick,
776
+ style: h
777
+ }), n().createElement(ee, {
778
+ id: a,
779
+ "data-test": "header-label"
780
+ }, v), n().createElement(J(), {
781
+ appearance: "pill",
782
+ icon: s ? n().createElement(X(), {
783
+ hideDefaultTooltip: true,
784
+ screenReaderText: b,
785
+ size: 1
786
+ }) : n().createElement(U(), {
787
+ "aria-label": b,
788
+ height: "24",
789
+ width: "24"
790
+ }),
791
+ "data-test": "next-month",
792
+ onClick: this.handleNextMonthClick,
793
+ style: h
794
+ })));
795
+ }
796
+ } ], [ {
797
+ key: "getMonthYearFormat",
798
+ value: function e(t) {
799
+ var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
800
+ var a = t.toLowerCase().replace("_", "-");
801
+ return n ? r.monthYearFormatsShortForm[a] || // full locale match
802
+ r.monthYearFormatsShortForm[a.substr(0, 2)] || // language match
803
+ r.monthYearFormatsShortForm["default"] : r.monthYearFormats[a] || // full locale match
804
+ r.monthYearFormats[a.substr(0, 2)] || // language match
805
+ r.monthYearFormats["default"];
806
+ // default
807
+ }
808
+ } ]);
809
+ return r;
810
+ }(r.Component);
811
+ ve(me, "propTypes", ye);
812
+ ve(me, "defaultProps", he);
813
+ ve(me, "monthYearFormats", {
814
+ default: "MMMM YYYY",
815
+ ja: "YYYY年MMM",
816
+ ko: "YYYY년 MMMM",
817
+ "zh-cn": "YYYY年MMM",
818
+ "zh-tw": "YYYY年MMM"
819
+ });
820
+ ve(me, "monthYearFormatsShortForm", {
821
+ default: "MMM YYYY",
822
+ ja: "YYYY年 MMM",
823
+ ko: "YYYY년 MMMM",
824
+ "zh-cn": "YYYY年 MMM",
825
+ "zh-tw": "YYYY年 MMM"
826
+ });
827
+ var be = (0, y.withSplunkTheme)(me);
828
+ be.propTypes = me.propTypes;
829
+ /* harmony default export */ const Ye = be;
830
+ // CONCATENATED MODULE: external "@splunk/react-ui/Box"
831
+ const ge = require("@splunk/react-ui/Box");
832
+ var Me = e.n(ge);
833
+ // CONCATENATED MODULE: ./src/Calendar/CalendarStyles.ts
834
+ var De = g()(Me()).withConfig({
835
+ displayName: "CalendarStyles__StyledBox",
836
+ componentId: "sc-18925wt-0"
837
+ })([ "width:", ";padding:", ";" ], (0, y.pick)({
838
+ enterprise: "220px",
839
+ prisma: "332px"
840
+ }), (0, y.pick)({
841
+ enterprise: "8px",
842
+ prisma: y.variables.spacingLarge
843
+ }));
844
+ // CONCATENATED MODULE: ./src/utils/updateReactRef.ts
845
+ /**
110
846
  * Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
111
847
  *
112
848
  * @param ref - The React callback or object ref. Can be `null` or `undefined`.
113
849
  * @param current - The new value of the ref.
114
850
  */
115
- function updateReactRef(ref, current) {
116
- if (ref) {
117
- if (typeof ref === 'function') {
118
- ref(current);
119
- } else {
120
- // the public signature of this util uses React.Ref<T> to mirror the way React types refs.
121
- // the intention here is to signal "we will take care of setting 'current', not you".
122
- ref.current = current; // eslint-disable-line no-param-reassign
123
- }
124
- }
125
- }
126
-
127
-
128
-
129
- /***/ }),
130
-
131
- /***/ 14:
132
- /***/ (function(module, exports) {
133
-
134
- module.exports = require("@splunk/react-ui/ScreenReaderContent");
135
-
136
- /***/ }),
137
-
138
- /***/ 17:
139
- /***/ (function(module, exports) {
140
-
141
- module.exports = require("@splunk/react-ui/Button");
142
-
143
- /***/ }),
144
-
145
- /***/ 176:
146
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
147
-
148
- "use strict";
149
- // ESM COMPAT FLAG
150
- __webpack_require__.r(__webpack_exports__);
151
-
152
- // EXPORTS
153
- __webpack_require__.d(__webpack_exports__, "default", function() { return /* reexport */ src_Calendar_Calendar; });
154
- __webpack_require__.d(__webpack_exports__, "calendarActiveSelector", function() { return /* reexport */ calendarActiveSelector; });
155
-
156
- // EXTERNAL MODULE: external "react"
157
- var external_react_ = __webpack_require__(2);
158
- var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
159
-
160
- // EXTERNAL MODULE: external "prop-types"
161
- var external_prop_types_ = __webpack_require__(1);
162
- var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_);
163
-
164
- // EXTERNAL MODULE: external "lodash/keys"
165
- var keys_ = __webpack_require__(9);
166
- var keys_default = /*#__PURE__*/__webpack_require__.n(keys_);
167
-
168
- // EXTERNAL MODULE: external "lodash/omit"
169
- var omit_ = __webpack_require__(5);
170
- var omit_default = /*#__PURE__*/__webpack_require__.n(omit_);
171
-
172
- // EXTERNAL MODULE: external "moment"
173
- var external_moment_ = __webpack_require__(20);
174
- var external_moment_default = /*#__PURE__*/__webpack_require__.n(external_moment_);
175
-
176
- // EXTERNAL MODULE: external "@splunk/ui-utils/id"
177
- var id_ = __webpack_require__(8);
178
-
179
- // EXTERNAL MODULE: external "lodash/times"
180
- var times_ = __webpack_require__(81);
181
- var times_default = /*#__PURE__*/__webpack_require__.n(times_);
182
-
183
- // EXTERNAL MODULE: external "@splunk/themes"
184
- var themes_ = __webpack_require__(0);
185
-
186
- // EXTERNAL MODULE: external "@splunk/ui-utils/keyboard"
187
- var keyboard_ = __webpack_require__(7);
188
-
189
- // EXTERNAL MODULE: external "@splunk/react-ui/ScreenReaderContent"
190
- var ScreenReaderContent_ = __webpack_require__(14);
191
- var ScreenReaderContent_default = /*#__PURE__*/__webpack_require__.n(ScreenReaderContent_);
192
-
193
- // EXTERNAL MODULE: external "styled-components"
194
- var external_styled_components_ = __webpack_require__(3);
195
- var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_);
196
-
197
- // CONCATENATED MODULE: ./src/Calendar/DayStyles.ts
198
-
199
-
200
- /* Element used to prevent vertical shift on firefox when the font-weight is increased with $selected */
201
-
202
- var StyledValue = external_styled_components_default.a.div.withConfig({
203
- displayName: "DayStyles__StyledValue",
204
- componentId: "sc-1nryhyt-0"
205
- })(["left:0;line-height:", ";position:absolute;top:0;width:100%;"], Object(themes_["pick"])({
206
- enterprise: '2em',
207
- prisma: '36px '
208
- }));
209
- var StyledInner = external_styled_components_default.a.div.withConfig({
210
- displayName: "DayStyles__StyledInner",
211
- componentId: "sc-1nryhyt-1"
212
- })(["border:", ";border-radius:", ";color:", ";height:", ";position:relative;text-align:center;width:", ";"], Object(themes_["pick"])({
213
- enterprise: '1px solid transparent',
214
- prisma: 'none'
215
- }), Object(themes_["pick"])({
216
- enterprise: themes_["variables"].borderRadius,
217
- prisma: '50%'
218
- }), Object(themes_["pick"])({
219
- enterprise: {
220
- light: themes_["variables"].gray45,
221
- dark: themes_["variables"].gray98
222
- },
223
- prisma: themes_["variables"].contentColorActive
224
- }), Object(themes_["pick"])({
225
- enterprise: '2em',
226
- prisma: '36px '
227
- }), Object(themes_["pick"])({
228
- enterprise: 'calc(2em - 2px)',
229
- prisma: '36px'
230
- }));
231
- var StyledCell = external_styled_components_default.a.td.withConfig({
232
- displayName: "DayStyles__StyledCell",
233
- componentId: "sc-1nryhyt-2"
234
- })(["", ";cursor:pointer;", ";", ";"], themes_["mixins"].reset('table-cell'), Object(themes_["pickVariant"])('$today', {
235
- "true": {
236
- enterprise: Object(external_styled_components_["css"])(["& > ", "{background-color:", ";}&:focus{& > ", "{box-shadow:", ";}}"],
237
- /* sc-sel */
238
- StyledInner, Object(themes_["pick"])({
239
- light: themes_["variables"].gray92,
240
- dark: themes_["variables"].gray45
241
- }),
242
- /* sc-sel */
243
- StyledInner, themes_["variables"].focusShadow),
244
- prisma: Object(external_styled_components_["css"])(["& > ", "{box-shadow:inset 0 0 0 1px ", ";}&:focus{& > ", "{box-shadow:inset 0 0 0 1px ", ",", ";}}"],
245
- /* sc-sel */
246
- StyledInner, themes_["variables"].interactiveColorBorder,
247
- /* sc-sel */
248
- StyledInner, themes_["variables"].interactiveColorBorder, themes_["variables"].focusShadow)
249
- },
250
- "false": Object(external_styled_components_["css"])(["&:focus{& > ", "{box-shadow:", ";}}"],
251
- /* sc-sel */
252
- StyledInner, themes_["variables"].focusShadow)
253
- }), Object(themes_["pickVariant"])('$selected', {
254
- "true": Object(themes_["pick"])({
255
- enterprise: Object(external_styled_components_["css"])(["& > ", "{border-color:", ";}"],
256
- /* sc-sel */
257
- StyledInner, themes_["variables"].linkColor),
258
- prisma: Object(external_styled_components_["css"])(["& > ", "{background-color:", ";font-weight:", ";}"],
259
- /* sc-sel */
260
- StyledInner, themes_["variables"].interactiveColorOverlaySelected, themes_["variables"].fontWeightBold)
261
- }),
262
- "false": Object(themes_["pick"])({
263
- enterprise: Object(external_styled_components_["css"])(["&:hover{& > ", "{background-color:", ";color:", ";}}"],
264
- /* sc-sel */
265
- StyledInner, themes_["variables"].backgroundColorHover, themes_["variables"].linkColor),
266
- prisma: Object(external_styled_components_["css"])(["&:hover{& > ", "{background-color:", ";}}"],
267
- /* sc-sel */
268
- StyledInner, themes_["variables"].interactiveColorOverlayHover)
269
- })
270
- }));
271
-
272
- // CONCATENATED MODULE: ./src/Calendar/Day.tsx
273
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
274
-
275
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
276
-
277
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
278
-
279
-
280
-
281
-
282
-
283
- var propTypes = {
284
- active: external_prop_types_default.a.bool,
285
- locale: external_prop_types_default.a.string,
286
- onClick: external_prop_types_default.a.func,
287
- onKeydown: external_prop_types_default.a.func,
288
- selected: external_prop_types_default.a.bool,
289
- today: external_prop_types_default.a.bool,
290
- value: external_prop_types_default.a.string
291
- };
292
-
293
- function Day(_ref) {
294
- var _ref$active = _ref.active,
295
- active = _ref$active === void 0 ? false : _ref$active,
296
- _ref$locale = _ref.locale,
297
- locale = _ref$locale === void 0 ? 'en_US' : _ref$locale,
298
- onClick = _ref.onClick,
299
- onKeyDown = _ref.onKeyDown,
300
- _ref$selected = _ref.selected,
301
- selected = _ref$selected === void 0 ? false : _ref$selected,
302
- _ref$today = _ref.today,
303
- today = _ref$today === void 0 ? false : _ref$today,
304
- value = _ref.value,
305
- otherProps = _objectWithoutProperties(_ref, ["active", "locale", "onClick", "onKeyDown", "selected", "today", "value"]);
306
-
307
- var handleClick = Object(external_react_["useCallback"])(function (e) {
308
- e.preventDefault();
309
- onClick === null || onClick === void 0 ? void 0 : onClick(e, {
310
- value: value
311
- });
312
- }, [onClick, value]);
313
- var handleKeyDown = Object(external_react_["useCallback"])(function (e) {
314
- e.preventDefault();
315
- onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e, {
316
- value: value
317
- });
318
- }, [onKeyDown, value]);
319
- var day = value && external_moment_default()(value, 'YYYY-MM-DD', locale).format('D');
320
- return /*#__PURE__*/external_react_default.a.createElement(StyledCell, _extends({
321
- tabIndex: active ? 0 : -1,
322
- "aria-selected": selected,
323
- "data-test-day": day,
324
- "data-test": "day-of-month",
325
- "data-active-day": active,
326
- "data-is-today": today,
327
- onClick: handleClick,
328
- onKeyDown: handleKeyDown,
329
- $today: today,
330
- $selected: selected
331
- }, otherProps), /*#__PURE__*/external_react_default.a.createElement(StyledInner, null, /*#__PURE__*/external_react_default.a.createElement(StyledValue, null, day)));
332
- }
333
-
334
- Day.propTypes = propTypes;
335
- /* harmony default export */ var Calendar_Day = (Day);
336
- // CONCATENATED MODULE: ./src/Calendar/DateTableStyles.ts
337
-
338
-
339
- var Styled = external_styled_components_default.a.table.withConfig({
340
- displayName: "DateTableStyles__Styled",
341
- componentId: "sc-1lbrjq0-0"
342
- })(["", ";table-layout:fixed;border-spacing:", ";width:", ";margin:", ";"], themes_["mixins"].reset('table'), Object(themes_["pick"])({
343
- enterprise: '3px',
344
- prisma: themes_["variables"].spacingSmall
345
- }), Object(themes_["pick"])({
346
- enterprise: '100%',
347
- prisma: 'calc(100% + 16px)'
348
- }), Object(themes_["pick"])({
349
- enterprise: '0',
350
- prisma: '-8px'
351
- }));
352
- var StyledTableHeader = external_styled_components_default.a.th.withConfig({
353
- displayName: "DateTableStyles__StyledTableHeader",
354
- componentId: "sc-1lbrjq0-1"
355
- })(["", ";text-align:center;padding-bottom:", ";color:", ";font-size:", ";"], themes_["mixins"].reset('table-cell'), Object(themes_["pick"])({
356
- enterprise: '2px',
357
- prisma: themes_["variables"].spacingXSmall
358
- }), themes_["variables"].contentColorMuted, Object(themes_["pick"])({
359
- enterprise: themes_["variables"].fontSizeSmall,
360
- prisma: themes_["variables"].fontSize
361
- }));
362
-
363
- // CONCATENATED MODULE: ./src/Calendar/DateTable.tsx
364
- function DateTable_extends() { DateTable_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return DateTable_extends.apply(this, arguments); }
365
-
366
- function DateTable_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = DateTable_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
367
-
368
- function DateTable_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
369
-
370
-
371
-
372
-
373
-
374
-
375
-
376
-
377
-
378
-
379
- var DateTable_propTypes = {
380
- displayValue: external_prop_types_default.a.string.isRequired,
381
- highlightToday: external_prop_types_default.a.bool,
382
- labelledBy: external_prop_types_default.a.string,
383
- locale: external_prop_types_default.a.string,
384
- onChange: external_prop_types_default.a.func,
385
- onInternalChange: external_prop_types_default.a.func,
386
- selectedValue: external_prop_types_default.a.string.isRequired,
387
- todayValue: external_prop_types_default.a.string
388
- };
389
-
390
- function renderPaddingCells(count) {
391
- return times_default()(count, function (i) {
392
- return /*#__PURE__*/external_react_default.a.createElement("td", {
393
- key: "".concat(i)
394
- });
395
- });
396
- }
397
-
398
- function renderDays(_ref) {
399
- var displayValue = _ref.displayValue,
400
- endDate = _ref.endDate,
401
- highlightToday = _ref.highlightToday,
402
- locale = _ref.locale,
403
- onChange = _ref.onChange,
404
- onKeyDown = _ref.onKeyDown,
405
- selectedDate = _ref.selectedDate,
406
- selectedValue = _ref.selectedValue,
407
- startDate = _ref.startDate,
408
- todayValue = _ref.todayValue;
409
- var cursor = external_moment_default()(startDate).locale(locale).startOf('month');
410
- var days = [];
411
-
412
- while (cursor.isSameOrBefore(endDate)) {
413
- var cursorString = cursor.format('YYYY-MM-DD');
414
- var isToday = cursorString === todayValue;
415
- var isSelected = cursorString === selectedValue;
416
- var isActive = cursorString === displayValue;
417
- days.push( /*#__PURE__*/external_react_default.a.createElement(Calendar_Day, {
418
- key: cursorString,
419
- locale: locale,
420
- onClick: onChange,
421
- onKeyDown: onKeyDown,
422
- active: selectedDate ? isActive : isToday,
423
- today: highlightToday && isToday,
424
- value: cursorString,
425
- selected: isSelected
426
- }));
427
- cursor.add(1, 'day');
428
- }
429
-
430
- return days;
431
- }
432
-
433
- function renderRows(cells) {
434
- return cells.reduce(function (accum, el, i) {
435
- var row = Math.floor(i / 7);
436
- accum[row].push(el);
437
- return accum;
438
- }, times_default()(7, function () {
439
- return [];
440
- })).map(function (row, i) {
441
- return (
442
- /*#__PURE__*/
443
- // eslint-disable-next-line react/no-array-index-key
444
- external_react_default.a.createElement("tr", {
445
- key: "$week-".concat(i)
446
- }, row)
447
- );
448
- });
449
- }
450
-
451
- function renderHeader(locale, dayFormat) {
452
- return /*#__PURE__*/external_react_default.a.createElement("thead", null, /*#__PURE__*/external_react_default.a.createElement("tr", null, times_default()(7, function (i) {
453
- var text = external_moment_default()().locale(locale).weekday(i).format(dayFormat);
454
- var label = external_moment_default()().locale(locale).weekday(i).format('dddd');
455
- return /*#__PURE__*/external_react_default.a.createElement(StyledTableHeader, {
456
- key: text
457
- }, /*#__PURE__*/external_react_default.a.createElement(ScreenReaderContent_default.a, null, label), /*#__PURE__*/external_react_default.a.createElement("span", {
458
- "aria-hidden": true
459
- }, text));
460
- })));
461
- }
462
-
463
- function DateTable(_ref2) {
464
- var displayValue = _ref2.displayValue,
465
- _ref2$highlightToday = _ref2.highlightToday,
466
- highlightToday = _ref2$highlightToday === void 0 ? false : _ref2$highlightToday,
467
- labelledBy = _ref2.labelledBy,
468
- _ref2$locale = _ref2.locale,
469
- locale = _ref2$locale === void 0 ? 'en_US' : _ref2$locale,
470
- onChange = _ref2.onChange,
471
- onInternalChange = _ref2.onInternalChange,
472
- selectedValue = _ref2.selectedValue,
473
- todayValue = _ref2.todayValue,
474
- otherProps = DateTable_objectWithoutProperties(_ref2, ["displayValue", "highlightToday", "labelledBy", "locale", "onChange", "onInternalChange", "selectedValue", "todayValue"]);
475
-
476
- var _useSplunkTheme = Object(themes_["useSplunkTheme"])(),
477
- family = _useSplunkTheme.family;
478
-
479
- var dayFormat = family === 'prisma' ? 'dd' : 'ddd';
480
- var displayDate = external_moment_default()(displayValue, 'YYYY-MM-DD', locale);
481
- var selectedDate = external_moment_default()(selectedValue, 'YYYY-MM-DD', locale);
482
- var startDate = external_moment_default()(displayDate).startOf('month');
483
- var endDate = external_moment_default()(displayDate).endOf('month').startOf('day');
484
-
485
- var handleOnChange = function handleOnChange(event, data) {
486
- event.preventDefault();
487
- onChange === null || onChange === void 0 ? void 0 : onChange(event, data);
488
- };
489
-
490
- var handlePreviousDay = function handlePreviousDay(event, _ref3) {
491
- var value = _ref3.value;
492
- event.preventDefault();
493
- onInternalChange === null || onInternalChange === void 0 ? void 0 : onInternalChange(event, {
494
- value: external_moment_default()(value, 'YYYY-MM-DD').add(-1, 'd').format('YYYY-MM-DD')
495
- });
496
- };
497
-
498
- var handleNextDay = function handleNextDay(event, _ref4) {
499
- var value = _ref4.value;
500
- event.preventDefault();
501
- onInternalChange === null || onInternalChange === void 0 ? void 0 : onInternalChange(event, {
502
- value: external_moment_default()(value, 'YYYY-MM-DD').add(1, 'd').format('YYYY-MM-DD')
503
- });
504
- };
505
-
506
- var handlePreviousWeek = function handlePreviousWeek(event, _ref5) {
507
- var value = _ref5.value;
508
- event.preventDefault();
509
- onInternalChange === null || onInternalChange === void 0 ? void 0 : onInternalChange(event, {
510
- value: external_moment_default()(value, 'YYYY-MM-DD').add(-1, 'w').format('YYYY-MM-DD')
511
- });
512
- };
513
-
514
- var handleNextWeek = function handleNextWeek(event, _ref6) {
515
- var value = _ref6.value;
516
- event.preventDefault();
517
- onInternalChange === null || onInternalChange === void 0 ? void 0 : onInternalChange(event, {
518
- value: external_moment_default()(value, 'YYYY-MM-DD').add(1, 'w').format('YYYY-MM-DD')
519
- });
520
- };
521
-
522
- var handlePreviousMonth = function handlePreviousMonth(event, _ref7) {
523
- var value = _ref7.value;
524
- event.preventDefault();
525
- onInternalChange === null || onInternalChange === void 0 ? void 0 : onInternalChange(event, {
526
- value: external_moment_default()(value, 'YYYY-MM-DD').add(-1, 'M').format('YYYY-MM-DD')
527
- });
528
- };
529
-
530
- var handleNextMonth = function handleNextMonth(event, _ref8) {
531
- var value = _ref8.value;
532
- event.preventDefault();
533
- onInternalChange === null || onInternalChange === void 0 ? void 0 : onInternalChange(event, {
534
- value: external_moment_default()(value, 'YYYY-MM-DD').add(1, 'M').format('YYYY-MM-DD')
535
- });
536
- };
537
-
538
- var handlePreviousYear = function handlePreviousYear(event, _ref9) {
539
- var value = _ref9.value;
540
- event.preventDefault();
541
- onInternalChange === null || onInternalChange === void 0 ? void 0 : onInternalChange(event, {
542
- value: external_moment_default()(value, 'YYYY-MM-DD').add(-1, 'y').format('YYYY-MM-DD')
543
- });
544
- };
545
-
546
- var handleNextYear = function handleNextYear(event, _ref10) {
547
- var value = _ref10.value;
548
- event.preventDefault();
549
- onInternalChange === null || onInternalChange === void 0 ? void 0 : onInternalChange(event, {
550
- value: external_moment_default()(value, 'YYYY-MM-DD').add(1, 'y').format('YYYY-MM-DD')
551
- });
552
- };
553
-
554
- var handleStartOfWeek = function handleStartOfWeek(event, _ref11) {
555
- var value = _ref11.value;
556
- event.preventDefault();
557
- onInternalChange === null || onInternalChange === void 0 ? void 0 : onInternalChange(event, {
558
- value: external_moment_default()(value, 'YYYY-MM-DD').startOf('week').format('YYYY-MM-DD')
559
- });
560
- };
561
-
562
- var handleEndOfWeek = function handleEndOfWeek(event, _ref12) {
563
- var value = _ref12.value;
564
- event.preventDefault();
565
- onInternalChange === null || onInternalChange === void 0 ? void 0 : onInternalChange(event, {
566
- value: external_moment_default()(value, 'YYYY-MM-DD').endOf('week').format('YYYY-MM-DD')
567
- });
568
- };
569
-
570
- var handleKeyDown = function handleKeyDown(event, data) {
571
- var eventKeyCode = Object(keyboard_["keycode"])(event.nativeEvent);
572
-
573
- switch (eventKeyCode) {
574
- case 'enter':
575
- case 'space':
576
- handleOnChange(event, data);
577
- break;
578
-
579
- case 'up':
580
- handlePreviousWeek(event, data);
581
- break;
582
-
583
- case 'down':
584
- handleNextWeek(event, data);
585
- break;
586
-
587
- case 'left':
588
- handlePreviousDay(event, data);
589
- break;
590
-
591
- case 'right':
592
- handleNextDay(event, data);
593
- break;
594
-
595
- case 'page up':
596
- if (event.shiftKey) {
597
- handlePreviousYear(event, data);
598
- } else {
599
- handlePreviousMonth(event, data);
851
+ function ke(e, t) {
852
+ if (e) {
853
+ if (typeof e === "function") {
854
+ e(t);
855
+ } else {
856
+ // the public signature of this util uses React.Ref<T> to mirror the way React types refs.
857
+ // the intention here is to signal "we will take care of setting 'current', not you".
858
+ e.current = t;
859
+ // eslint-disable-line no-param-reassign
860
+ }
600
861
  }
601
-
602
- break;
603
-
604
- case 'page down':
605
- if (event.shiftKey) {
606
- handleNextYear(event, data);
862
+ }
863
+ // CONCATENATED MODULE: ./src/Calendar/Calendar.tsx
864
+ function we(e) {
865
+ "@babel/helpers - typeof";
866
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
867
+ we = function e(t) {
868
+ return typeof t;
869
+ };
607
870
  } else {
608
- handleNextMonth(event, data);
871
+ we = function e(t) {
872
+ return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
873
+ };
609
874
  }
610
-
611
- break;
612
-
613
- case 'home':
614
- handleStartOfWeek(event, data);
615
- break;
616
-
617
- case 'end':
618
- handleEndOfWeek(event, data);
619
- break;
620
-
621
- default: // do nothing
622
-
875
+ return we(e);
623
876
  }
624
- };
625
-
626
- var cells = renderPaddingCells(startDate.format('e')).concat(renderDays({
627
- displayValue: displayValue,
628
- endDate: endDate,
629
- highlightToday: highlightToday,
630
- locale: locale,
631
- onChange: onChange,
632
- onKeyDown: handleKeyDown,
633
- selectedDate: selectedDate,
634
- selectedValue: selectedValue,
635
- startDate: startDate,
636
- todayValue: todayValue
637
- })).concat(renderPaddingCells(6 - endDate.format('e')));
638
- return /*#__PURE__*/external_react_default.a.createElement(Styled, DateTable_extends({
639
- role: "grid",
640
- "aria-labelledby": labelledBy
641
- }, otherProps), renderHeader(locale, dayFormat), /*#__PURE__*/external_react_default.a.createElement("tbody", null, renderRows(cells)));
642
- }
643
-
644
- DateTable.propTypes = DateTable_propTypes;
645
- /* harmony default export */ var Calendar_DateTable = (DateTable);
646
- // EXTERNAL MODULE: external "@splunk/react-icons/ChevronLeft"
647
- var ChevronLeft_ = __webpack_require__(86);
648
- var ChevronLeft_default = /*#__PURE__*/__webpack_require__.n(ChevronLeft_);
649
-
650
- // EXTERNAL MODULE: external "@splunk/react-icons/ChevronRight"
651
- var ChevronRight_ = __webpack_require__(46);
652
- var ChevronRight_default = /*#__PURE__*/__webpack_require__.n(ChevronRight_);
653
-
654
- // EXTERNAL MODULE: external "@splunk/react-icons/enterprise/ChevronLeft"
655
- var enterprise_ChevronLeft_ = __webpack_require__(66);
656
- var enterprise_ChevronLeft_default = /*#__PURE__*/__webpack_require__.n(enterprise_ChevronLeft_);
657
-
658
- // EXTERNAL MODULE: external "@splunk/react-icons/enterprise/ChevronRight"
659
- var enterprise_ChevronRight_ = __webpack_require__(38);
660
- var enterprise_ChevronRight_default = /*#__PURE__*/__webpack_require__.n(enterprise_ChevronRight_);
661
-
662
- // EXTERNAL MODULE: external "@splunk/react-ui/Button"
663
- var Button_ = __webpack_require__(17);
664
- var Button_default = /*#__PURE__*/__webpack_require__.n(Button_);
665
-
666
- // EXTERNAL MODULE: external "@splunk/ui-utils/i18n"
667
- var i18n_ = __webpack_require__(4);
668
-
669
- // CONCATENATED MODULE: ./src/Calendar/MonthHeaderStyles.ts
670
-
671
-
672
- var StyledBox = external_styled_components_default.a.div.withConfig({
673
- displayName: "MonthHeaderStyles__StyledBox",
674
- componentId: "sc-18bmbh7-0"
675
- })(["display:flex;position:relative;line-height:", ";padding:0 2px;margin-bottom:10px;"], themes_["variables"].inputHeight);
676
- var StyledHeading = external_styled_components_default.a.span.withConfig({
677
- displayName: "MonthHeaderStyles__StyledHeading",
678
- componentId: "sc-18bmbh7-1"
679
- })(["display:block;text-align:center;text-transform:", ";flex:1 0 1px;", ";"], Object(themes_["pick"])({
680
- enterprise: 'capitalize',
681
- prisma: 'uppercase'
682
- }), Object(themes_["pick"])({
683
- prisma: Object(external_styled_components_["css"])(["font-size:20px;font-weight:bold;color:", ";"], themes_["variables"].contentColorActive)
684
- }));
685
-
686
- // CONCATENATED MODULE: ./src/Calendar/MonthHeader.tsx
687
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
688
-
689
- function MonthHeader_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = MonthHeader_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
690
-
691
- function MonthHeader_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
692
-
693
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
694
-
695
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
696
-
697
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
698
-
699
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
700
-
701
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
702
-
703
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
704
-
705
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
706
-
707
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
708
-
709
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
710
-
711
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
712
-
713
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
714
-
715
-
716
-
717
-
718
-
719
-
720
-
721
-
722
-
723
-
724
-
725
-
726
-
727
- var MonthHeader_propTypes = {
728
- headingId: external_prop_types_default.a.string,
729
- locale: external_prop_types_default.a.string,
730
- onChange: external_prop_types_default.a.func,
731
-
732
- /** @private */
733
- splunkTheme: external_prop_types_default.a.object,
734
- value: external_prop_types_default.a.string.isRequired
735
- };
736
- var defaultProps = {
737
- locale: 'en_US'
738
- };
739
-
740
- var MonthHeader_MonthHeader = /*#__PURE__*/function (_Component) {
741
- _inherits(MonthHeader, _Component);
742
-
743
- var _super = _createSuper(MonthHeader);
744
-
745
- function MonthHeader() {
746
- var _this;
747
-
748
- _classCallCheck(this, MonthHeader);
749
-
750
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
751
- args[_key] = arguments[_key];
877
+ function Oe() {
878
+ Oe = Object.assign || function(e) {
879
+ for (var t = 1; t < arguments.length; t++) {
880
+ var r = arguments[t];
881
+ for (var n in r) {
882
+ if (Object.prototype.hasOwnProperty.call(r, n)) {
883
+ e[n] = r[n];
884
+ }
885
+ }
886
+ }
887
+ return e;
888
+ };
889
+ return Oe.apply(this, arguments);
752
890
  }
753
-
754
- _this = _super.call.apply(_super, [this].concat(args));
755
-
756
- _defineProperty(_assertThisInitialized(_this), "handlePrevMonthClick", function (e) {
757
- _this.handleChange(e, -1);
758
- });
759
-
760
- _defineProperty(_assertThisInitialized(_this), "handleNextMonthClick", function (e) {
761
- _this.handleChange(e, 1);
762
- });
763
-
764
- return _this;
765
- }
766
-
767
- _createClass(MonthHeader, [{
768
- key: "handleChange",
769
- value: function handleChange(e, diff) {
770
- var _this$props$onChange, _this$props;
771
-
772
- e.stopPropagation();
773
- var newValue = external_moment_default()(this.props.value, 'YYYY-MM-DD').add(diff, 'M').format('YYYY-MM-DD');
774
- (_this$props$onChange = (_this$props = this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props, e, {
775
- value: newValue
776
- });
891
+ function Ce(e, t) {
892
+ if (!(e instanceof t)) {
893
+ throw new TypeError("Cannot call a class as a function");
894
+ }
777
895
  }
778
- }, {
779
- key: "render",
780
- value: function render() {
781
- var _this$props2 = this.props,
782
- headingId = _this$props2.headingId,
783
- locale = _this$props2.locale,
784
- value = _this$props2.value,
785
- splunkTheme = _this$props2.splunkTheme,
786
- otherProps = MonthHeader_objectWithoutProperties(_this$props2, ["headingId", "locale", "value", "splunkTheme"]);
787
-
788
- var isEnterprise = splunkTheme.isEnterprise,
789
- isPrisma = splunkTheme.isPrisma;
790
- var date = external_moment_default()(value, 'YYYY-MM-DD', locale);
791
- var monthYear = date.format(MonthHeader.getMonthYearFormat(locale, isPrisma));
792
- var buttonStyles = {
793
- flex: '0 0 auto'
794
- };
795
-
796
- var previousScreenReaderText = Object(i18n_["_"])('Previous month');
797
-
798
- var nextScreenReaderText = Object(i18n_["_"])('Next month');
799
-
800
- return /*#__PURE__*/external_react_default.a.createElement(themes_["SplunkThemeProvider"], {
801
- density: isPrisma ? 'comfortable' : splunkTheme.density
802
- }, /*#__PURE__*/external_react_default.a.createElement(StyledBox, omit_default()(otherProps, 'onChange'), /*#__PURE__*/external_react_default.a.createElement(Button_default.a, {
803
- appearance: "pill",
804
- icon: isEnterprise ? /*#__PURE__*/external_react_default.a.createElement(enterprise_ChevronLeft_default.a, {
805
- hideDefaultTooltip: true,
806
- screenReaderText: previousScreenReaderText,
807
- size: 1
808
- }) : /*#__PURE__*/external_react_default.a.createElement(ChevronLeft_default.a, {
809
- "aria-label": previousScreenReaderText,
810
- height: "24",
811
- width: "24"
812
- }),
813
- "data-test": "previous-month",
814
- onClick: this.handlePrevMonthClick,
815
- style: buttonStyles
816
- }), /*#__PURE__*/external_react_default.a.createElement(StyledHeading, {
817
- id: headingId,
818
- "data-test": "header-label"
819
- }, monthYear), /*#__PURE__*/external_react_default.a.createElement(Button_default.a, {
820
- appearance: "pill",
821
- icon: isEnterprise ? /*#__PURE__*/external_react_default.a.createElement(enterprise_ChevronRight_default.a, {
822
- hideDefaultTooltip: true,
823
- screenReaderText: nextScreenReaderText,
824
- size: 1
825
- }) : /*#__PURE__*/external_react_default.a.createElement(ChevronRight_default.a, {
826
- "aria-label": nextScreenReaderText,
827
- height: "24",
828
- width: "24"
829
- }),
830
- "data-test": "next-month",
831
- onClick: this.handleNextMonthClick,
832
- style: buttonStyles
833
- })));
896
+ function Se(e, t) {
897
+ for (var r = 0; r < t.length; r++) {
898
+ var n = t[r];
899
+ n.enumerable = n.enumerable || false;
900
+ n.configurable = true;
901
+ if ("value" in n) n.writable = true;
902
+ Object.defineProperty(e, n.key, n);
903
+ }
834
904
  }
835
- }], [{
836
- key: "getMonthYearFormat",
837
- value: function getMonthYearFormat(locale) {
838
- var shortForm = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
839
- var localeNormalized = locale.toLowerCase().replace('_', '-');
840
- return shortForm ? MonthHeader.monthYearFormatsShortForm[localeNormalized] || // full locale match
841
- MonthHeader.monthYearFormatsShortForm[localeNormalized.substr(0, 2)] || // language match
842
- MonthHeader.monthYearFormatsShortForm["default"] : MonthHeader.monthYearFormats[localeNormalized] || // full locale match
843
- MonthHeader.monthYearFormats[localeNormalized.substr(0, 2)] || // language match
844
- MonthHeader.monthYearFormats["default"]; // default
905
+ function xe(e, t, r) {
906
+ if (t) Se(e.prototype, t);
907
+ if (r) Se(e, r);
908
+ return e;
845
909
  }
846
- }]);
847
-
848
- return MonthHeader;
849
- }(external_react_["Component"]);
850
-
851
- _defineProperty(MonthHeader_MonthHeader, "propTypes", MonthHeader_propTypes);
852
-
853
- _defineProperty(MonthHeader_MonthHeader, "defaultProps", defaultProps);
854
-
855
- _defineProperty(MonthHeader_MonthHeader, "monthYearFormats", {
856
- "default": 'MMMM YYYY',
857
- ja: 'YYYY年MMM',
858
- ko: 'YYYY년 MMMM',
859
- 'zh-cn': 'YYYY年MMM',
860
- 'zh-tw': 'YYYY年MMM'
861
- });
862
-
863
- _defineProperty(MonthHeader_MonthHeader, "monthYearFormatsShortForm", {
864
- "default": 'MMM YYYY',
865
- ja: 'YYYY年 MMM',
866
- ko: 'YYYY년 MMMM',
867
- 'zh-cn': 'YYYY年 MMM',
868
- 'zh-tw': 'YYYY年 MMM'
869
- });
870
-
871
- var MonthHeaderWithTheme = Object(themes_["withSplunkTheme"])(MonthHeader_MonthHeader);
872
- MonthHeaderWithTheme.propTypes = MonthHeader_MonthHeader.propTypes;
873
- /* harmony default export */ var Calendar_MonthHeader = (MonthHeaderWithTheme);
874
- // EXTERNAL MODULE: external "@splunk/react-ui/Box"
875
- var Box_ = __webpack_require__(6);
876
- var Box_default = /*#__PURE__*/__webpack_require__.n(Box_);
877
-
878
- // CONCATENATED MODULE: ./src/Calendar/CalendarStyles.ts
879
-
880
-
881
-
882
- var CalendarStyles_StyledBox = external_styled_components_default()(Box_default.a).withConfig({
883
- displayName: "CalendarStyles__StyledBox",
884
- componentId: "sc-18925wt-0"
885
- })(["width:", ";padding:", ";"], Object(themes_["pick"])({
886
- enterprise: '220px',
887
- prisma: '332px'
888
- }), Object(themes_["pick"])({
889
- enterprise: '8px',
890
- prisma: themes_["variables"].spacingLarge
891
- }));
892
-
893
- // EXTERNAL MODULE: ./src/utils/updateReactRef.ts
894
- var updateReactRef = __webpack_require__(10);
895
-
896
- // CONCATENATED MODULE: ./src/Calendar/Calendar.tsx
897
- function Calendar_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Calendar_typeof = function _typeof(obj) { return typeof obj; }; } else { Calendar_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Calendar_typeof(obj); }
898
-
899
- function Calendar_extends() { Calendar_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Calendar_extends.apply(this, arguments); }
900
-
901
- function Calendar_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
902
-
903
- function Calendar_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
904
-
905
- function Calendar_createClass(Constructor, protoProps, staticProps) { if (protoProps) Calendar_defineProperties(Constructor.prototype, protoProps); if (staticProps) Calendar_defineProperties(Constructor, staticProps); return Constructor; }
906
-
907
- function Calendar_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) Calendar_setPrototypeOf(subClass, superClass); }
908
-
909
- function Calendar_setPrototypeOf(o, p) { Calendar_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Calendar_setPrototypeOf(o, p); }
910
-
911
- function Calendar_createSuper(Derived) { var hasNativeReflectConstruct = Calendar_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Calendar_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Calendar_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Calendar_possibleConstructorReturn(this, result); }; }
912
-
913
- function Calendar_possibleConstructorReturn(self, call) { if (call && (Calendar_typeof(call) === "object" || typeof call === "function")) { return call; } return Calendar_assertThisInitialized(self); }
914
-
915
- function Calendar_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
916
-
917
- function Calendar_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
918
-
919
- function Calendar_getPrototypeOf(o) { Calendar_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Calendar_getPrototypeOf(o); }
920
-
921
- function Calendar_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
922
-
923
-
924
-
925
-
926
-
927
-
928
-
929
-
930
-
931
-
932
-
933
- var calendarActiveSelector = '[data-active-day="true"]';
934
- var Calendar_propTypes = {
935
- describedBy: external_prop_types_default.a.string,
936
- highlightToday: external_prop_types_default.a.bool,
937
- labelledBy: external_prop_types_default.a.string,
938
- locale: external_prop_types_default.a.string,
939
- onChange: external_prop_types_default.a.func,
940
-
941
- /** @private. */
942
- required: external_prop_types_default.a.bool,
943
- value: external_prop_types_default.a.string,
944
- elementRef: external_prop_types_default.a.oneOfType([external_prop_types_default.a.func, external_prop_types_default.a.object])
945
- };
946
- var Calendar_defaultProps = {
947
- locale: 'en_US',
948
- value: external_moment_default()().format('YYYY-MM-DD')
949
- };
950
-
951
- var Calendar_Calendar = /*#__PURE__*/function (_Component) {
952
- Calendar_inherits(Calendar, _Component);
953
-
954
- var _super = Calendar_createSuper(Calendar);
955
-
956
- function Calendar(props) {
957
- var _this;
958
-
959
- Calendar_classCallCheck(this, Calendar);
960
-
961
- _this = _super.call(this, props);
962
-
963
- Calendar_defineProperty(Calendar_assertThisInitialized(_this), "monthHeaderId", void 0);
964
-
965
- Calendar_defineProperty(Calendar_assertThisInitialized(_this), "todayTimerId", void 0);
966
-
967
- Calendar_defineProperty(Calendar_assertThisInitialized(_this), "calendarRef", void 0);
968
-
969
- Calendar_defineProperty(Calendar_assertThisInitialized(_this), "handleMonthChange", function (e, _ref) {
970
- var value = _ref.value;
971
-
972
- _this.setState({
973
- internalValue: value,
974
- source: 'month'
975
- });
976
- });
977
-
978
- Calendar_defineProperty(Calendar_assertThisInitialized(_this), "handleDayChange", function (e, _ref2) {
979
- var value = _ref2.value;
980
-
981
- _this.setState({
982
- internalValue: value,
983
- source: 'day'
984
- });
985
- });
986
-
987
- Calendar_defineProperty(Calendar_assertThisInitialized(_this), "handleCalendarMount", function (el) {
988
- Object(updateReactRef["a" /* updateReactRef */])(_this.calendarRef, el);
989
- Object(updateReactRef["a" /* updateReactRef */])(_this.props.elementRef, el);
990
- });
991
-
992
- _this.state = {
993
- internalValue: props.value,
994
- todayValue: _this.getToday(),
995
- source: null
996
- };
997
- _this.monthHeaderId = Object(id_["createDOMID"])('header');
998
- _this.calendarRef = /*#__PURE__*/external_react_default.a.createRef();
999
-
1000
- if (false) {}
1001
-
1002
- return _this;
1003
- }
1004
-
1005
- Calendar_createClass(Calendar, [{
1006
- key: "componentDidMount",
1007
- value: function componentDidMount() {
1008
- var _this2 = this;
1009
-
1010
- this.todayTimerId = setInterval(function () {
1011
- var todayValue = _this2.getToday();
1012
-
1013
- if (todayValue !== _this2.state.todayValue) {
1014
- _this2.setState({
1015
- todayValue: todayValue
1016
- });
910
+ function je(e, t) {
911
+ if (typeof t !== "function" && t !== null) {
912
+ throw new TypeError("Super expression must either be null or a function");
1017
913
  }
1018
- }, 1000);
914
+ e.prototype = Object.create(t && t.prototype, {
915
+ constructor: {
916
+ value: e,
917
+ writable: true,
918
+ configurable: true
919
+ }
920
+ });
921
+ if (t) _e(e, t);
1019
922
  }
1020
- }, {
1021
- key: "componentWillUnmount",
1022
- value: function componentWillUnmount() {
1023
- if (this.todayTimerId !== undefined) {
1024
- clearInterval(this.todayTimerId);
1025
- }
923
+ function _e(e, t) {
924
+ _e = Object.setPrototypeOf || function e(t, r) {
925
+ t.__proto__ = r;
926
+ return t;
927
+ };
928
+ return _e(e, t);
1026
929
  }
1027
- }, {
1028
- key: "componentDidUpdate",
1029
- value: function componentDidUpdate(prevProps, prevState) {
1030
- if (false) {}
1031
-
1032
- if (this.state.internalValue !== prevState.internalValue && this.state.source === 'day') {
1033
- this.focusActiveDay();
1034
- }
930
+ function Te(e) {
931
+ var t = Ie();
932
+ return function r() {
933
+ var n = Ve(e), a;
934
+ if (t) {
935
+ var o = Ve(this).constructor;
936
+ a = Reflect.construct(n, arguments, o);
937
+ } else {
938
+ a = n.apply(this, arguments);
939
+ }
940
+ return Ee(this, a);
941
+ };
1035
942
  }
1036
- /**
1037
- * Place focus on the active day.
1038
- */
1039
-
1040
- }, {
1041
- key: "focusActiveDay",
1042
- value: function focusActiveDay() {
1043
- var _this$calendarRef, _this$calendarRef$cur;
1044
-
1045
- var current = (_this$calendarRef = this.calendarRef) === null || _this$calendarRef === void 0 ? void 0 : (_this$calendarRef$cur = _this$calendarRef.current) === null || _this$calendarRef$cur === void 0 ? void 0 : _this$calendarRef$cur.querySelector(calendarActiveSelector);
1046
- current === null || current === void 0 ? void 0 : current.focus();
943
+ function Ee(e, t) {
944
+ if (t && (we(t) === "object" || typeof t === "function")) {
945
+ return t;
946
+ }
947
+ return Pe(e);
1047
948
  }
1048
- }, {
1049
- key: "getToday",
1050
- value: function getToday() {
1051
- var today = external_moment_default()().locale(this.props.locale).format('YYYY-MM-DD');
1052
- return today;
949
+ function Pe(e) {
950
+ if (e === void 0) {
951
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
952
+ }
953
+ return e;
1053
954
  }
1054
- }, {
1055
- key: "render",
1056
- value: function render() {
1057
- var _this$props = this.props,
1058
- describedBy = _this$props.describedBy,
1059
- highlightToday = _this$props.highlightToday,
1060
- labelledBy = _this$props.labelledBy,
1061
- locale = _this$props.locale,
1062
- onChange = _this$props.onChange,
1063
- required = _this$props.required,
1064
- value = _this$props.value;
1065
- var _this$state = this.state,
1066
- internalValue = _this$state.internalValue,
1067
- todayValue = _this$state.todayValue;
1068
- return /*#__PURE__*/external_react_default.a.createElement(CalendarStyles_StyledBox, Calendar_extends({
1069
- inline: true,
1070
- "aria-labelledby": labelledBy,
1071
- "aria-describedby": describedBy,
1072
- "aria-required": required,
1073
- "data-test": "calendar"
1074
- }, omit_default()(this.props, keys_default()(Calendar.propTypes)), {
1075
- elementRef: this.handleCalendarMount
1076
- }), /*#__PURE__*/external_react_default.a.createElement(Calendar_MonthHeader, {
1077
- headingId: this.monthHeaderId,
1078
- locale: locale,
1079
- onChange: this.handleMonthChange,
1080
- value: internalValue
1081
- }), /*#__PURE__*/external_react_default.a.createElement(Calendar_DateTable, {
1082
- displayValue: internalValue,
1083
- highlightToday: highlightToday,
1084
- labelledBy: this.monthHeaderId,
1085
- locale: locale,
1086
- onChange: onChange,
1087
- onInternalChange: this.handleDayChange,
1088
- selectedValue: value,
1089
- todayValue: todayValue
1090
- }));
955
+ function Ie() {
956
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
957
+ if (Reflect.construct.sham) return false;
958
+ if (typeof Proxy === "function") return true;
959
+ try {
960
+ Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
961
+ return true;
962
+ } catch (e) {
963
+ return false;
964
+ }
1091
965
  }
1092
- }], [{
1093
- key: "validateValue",
1094
- value: function validateValue(value) {
1095
- if (!external_moment_default()(value, 'YYYY-MM-DD').isValid()) {
1096
- return new Error("Invalid value prop ".concat(value, " passed to Calendar. value must be a string date formatted 'YYYY-MM-DD'."));
1097
- }
1098
-
1099
- return null;
966
+ function Ve(e) {
967
+ Ve = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
968
+ return t.__proto__ || Object.getPrototypeOf(t);
969
+ };
970
+ return Ve(e);
1100
971
  }
1101
- }]);
1102
-
1103
- return Calendar;
1104
- }(external_react_["Component"]);
1105
-
1106
- Calendar_defineProperty(Calendar_Calendar, "propTypes", Calendar_propTypes);
1107
-
1108
- Calendar_defineProperty(Calendar_Calendar, "defaultProps", Calendar_defaultProps);
1109
-
1110
- /* harmony default export */ var src_Calendar_Calendar = (Calendar_Calendar);
1111
-
1112
- // CONCATENATED MODULE: ./src/Calendar/index.ts
1113
-
1114
-
1115
-
1116
- /***/ }),
1117
-
1118
- /***/ 2:
1119
- /***/ (function(module, exports) {
1120
-
1121
- module.exports = require("react");
1122
-
1123
- /***/ }),
1124
-
1125
- /***/ 20:
1126
- /***/ (function(module, exports) {
1127
-
1128
- module.exports = require("moment");
1129
-
1130
- /***/ }),
1131
-
1132
- /***/ 3:
1133
- /***/ (function(module, exports) {
1134
-
1135
- module.exports = require("styled-components");
1136
-
1137
- /***/ }),
1138
-
1139
- /***/ 38:
1140
- /***/ (function(module, exports) {
1141
-
1142
- module.exports = require("@splunk/react-icons/enterprise/ChevronRight");
1143
-
1144
- /***/ }),
1145
-
1146
- /***/ 4:
1147
- /***/ (function(module, exports) {
1148
-
1149
- module.exports = require("@splunk/ui-utils/i18n");
1150
-
1151
- /***/ }),
1152
-
1153
- /***/ 46:
1154
- /***/ (function(module, exports) {
1155
-
1156
- module.exports = require("@splunk/react-icons/ChevronRight");
1157
-
1158
- /***/ }),
1159
-
1160
- /***/ 5:
1161
- /***/ (function(module, exports) {
1162
-
1163
- module.exports = require("lodash/omit");
1164
-
1165
- /***/ }),
1166
-
1167
- /***/ 6:
1168
- /***/ (function(module, exports) {
1169
-
1170
- module.exports = require("@splunk/react-ui/Box");
1171
-
1172
- /***/ }),
1173
-
1174
- /***/ 66:
1175
- /***/ (function(module, exports) {
1176
-
1177
- module.exports = require("@splunk/react-icons/enterprise/ChevronLeft");
1178
-
1179
- /***/ }),
1180
-
1181
- /***/ 7:
1182
- /***/ (function(module, exports) {
1183
-
1184
- module.exports = require("@splunk/ui-utils/keyboard");
1185
-
1186
- /***/ }),
1187
-
1188
- /***/ 8:
1189
- /***/ (function(module, exports) {
1190
-
1191
- module.exports = require("@splunk/ui-utils/id");
1192
-
1193
- /***/ }),
1194
-
1195
- /***/ 81:
1196
- /***/ (function(module, exports) {
1197
-
1198
- module.exports = require("lodash/times");
1199
-
1200
- /***/ }),
1201
-
1202
- /***/ 86:
1203
- /***/ (function(module, exports) {
1204
-
1205
- module.exports = require("@splunk/react-icons/ChevronLeft");
1206
-
1207
- /***/ }),
1208
-
1209
- /***/ 9:
1210
- /***/ (function(module, exports) {
1211
-
1212
- module.exports = require("lodash/keys");
1213
-
1214
- /***/ })
1215
-
1216
- /******/ });
972
+ function Re(e, t, r) {
973
+ if (t in e) {
974
+ Object.defineProperty(e, t, {
975
+ value: r,
976
+ enumerable: true,
977
+ configurable: true,
978
+ writable: true
979
+ });
980
+ } else {
981
+ e[t] = r;
982
+ }
983
+ return e;
984
+ }
985
+ var qe = '[data-active-day="true"]';
986
+ var Be = {
987
+ describedBy: o().string,
988
+ highlightToday: o().bool,
989
+ labelledBy: o().string,
990
+ locale: o().string,
991
+ onChange: o().func,
992
+ /** @private. */
993
+ required: o().bool,
994
+ value: o().string,
995
+ elementRef: o().oneOfType([ o().func, o().object ])
996
+ };
997
+ var Fe = {
998
+ locale: "en_US",
999
+ value: f()().format("YYYY-MM-DD")
1000
+ };
1001
+ var ze = function(e) {
1002
+ je(r, e);
1003
+ var t = Te(r);
1004
+ function r(e) {
1005
+ var a;
1006
+ Ce(this, r);
1007
+ a = t.call(this, e);
1008
+ Re(Pe(a), "monthHeaderId", void 0);
1009
+ Re(Pe(a), "todayTimerId", void 0);
1010
+ Re(Pe(a), "calendarRef", void 0);
1011
+ Re(Pe(a), "handleMonthChange", (function(e, t) {
1012
+ var r = t.value;
1013
+ a.setState({
1014
+ internalValue: r,
1015
+ source: "month"
1016
+ });
1017
+ }));
1018
+ Re(Pe(a), "handleDayChange", (function(e, t) {
1019
+ var r = t.value;
1020
+ a.setState({
1021
+ internalValue: r,
1022
+ source: "day"
1023
+ });
1024
+ }));
1025
+ Re(Pe(a), "handleCalendarMount", (function(e) {
1026
+ ke(a.calendarRef, e);
1027
+ ke(a.props.elementRef, e);
1028
+ }));
1029
+ a.state = {
1030
+ internalValue: e.value,
1031
+ todayValue: a.getToday(),
1032
+ source: null
1033
+ };
1034
+ a.monthHeaderId = (0, d.createDOMID)("header");
1035
+ a.calendarRef = n().createRef();
1036
+ if (false) {}
1037
+ return a;
1038
+ }
1039
+ xe(r, [ {
1040
+ key: "componentDidMount",
1041
+ value: function e() {
1042
+ var t = this;
1043
+ this.todayTimerId = setInterval((function() {
1044
+ var e = t.getToday();
1045
+ if (e !== t.state.todayValue) {
1046
+ t.setState({
1047
+ todayValue: e
1048
+ });
1049
+ }
1050
+ }), 1e3);
1051
+ }
1052
+ }, {
1053
+ key: "componentWillUnmount",
1054
+ value: function e() {
1055
+ if (this.todayTimerId !== undefined) {
1056
+ clearInterval(this.todayTimerId);
1057
+ }
1058
+ }
1059
+ }, {
1060
+ key: "componentDidUpdate",
1061
+ value: function e(t, r) {
1062
+ if (false) {}
1063
+ if (this.state.internalValue !== r.internalValue && this.state.source === "day") {
1064
+ this.focusActiveDay();
1065
+ }
1066
+ }
1067
+ /**
1068
+ * Place focus on the active day.
1069
+ */ }, {
1070
+ key: "focusActiveDay",
1071
+ value: function e() {
1072
+ var t, r;
1073
+ var n = (t = this.calendarRef) === null || t === void 0 ? void 0 : (r = t.current) === null || r === void 0 ? void 0 : r.querySelector(qe);
1074
+ n === null || n === void 0 ? void 0 : n.focus();
1075
+ }
1076
+ }, {
1077
+ key: "getToday",
1078
+ value: function e() {
1079
+ var t = f()().locale(this.props.locale).format("YYYY-MM-DD");
1080
+ return t;
1081
+ }
1082
+ }, {
1083
+ key: "render",
1084
+ value: function e() {
1085
+ var t = this.props, a = t.describedBy, o = t.highlightToday, l = t.labelledBy, u = t.locale, s = t.onChange, f = t.required, d = t.value;
1086
+ var p = this.state, v = p.internalValue, y = p.todayValue;
1087
+
1088
+ return n().createElement(De, Oe({
1089
+ inline: true,
1090
+ "aria-labelledby": l,
1091
+ "aria-describedby": a,
1092
+ "aria-required": f,
1093
+ "data-test": "calendar"
1094
+ }, c()(this.props, i()(r.propTypes)), {
1095
+ elementRef: this.handleCalendarMount
1096
+ }), n().createElement(Ye, {
1097
+ headingId: this.monthHeaderId,
1098
+ locale: u,
1099
+ onChange: this.handleMonthChange,
1100
+ value: v
1101
+ }), n().createElement(H, {
1102
+ displayValue: v,
1103
+ highlightToday: o,
1104
+ labelledBy: this.monthHeaderId,
1105
+ locale: u,
1106
+ onChange: s,
1107
+ onInternalChange: this.handleDayChange,
1108
+ selectedValue: d,
1109
+ todayValue: y
1110
+ }));
1111
+ }
1112
+ } ], [ {
1113
+ key: "validateValue",
1114
+ value: function e(t) {
1115
+ if (!f()(t, "YYYY-MM-DD").isValid()) {
1116
+ return new Error("Invalid value prop ".concat(t, " passed to Calendar. value must be a string date formatted 'YYYY-MM-DD'."));
1117
+ }
1118
+ return null;
1119
+ }
1120
+ } ]);
1121
+ return r;
1122
+ }(r.Component);
1123
+ Re(ze, "propTypes", Be);
1124
+ Re(ze, "defaultProps", Fe);
1125
+ /* harmony default export */ const He = ze;
1126
+ // CONCATENATED MODULE: ./src/Calendar/index.ts
1127
+ module.exports = t;
1128
+ /******/})();