1 | (function (global, factory) {
|
2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('react-dom')) :
|
3 | typeof define === 'function' && define.amd ? define(['exports', 'react', 'react-dom'], factory) :
|
4 | (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.PatternFlyReact = {}, global.React, global.ReactDOM));
|
5 | })(this, (function (exports, React, ReactDOM) { 'use strict';
|
6 |
|
7 | function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
8 |
|
9 | function _interopNamespace(e) {
|
10 | if (e && e.__esModule) return e;
|
11 | var n = Object.create(null);
|
12 | if (e) {
|
13 | Object.keys(e).forEach(function (k) {
|
14 | if (k !== 'default') {
|
15 | var d = Object.getOwnPropertyDescriptor(e, k);
|
16 | Object.defineProperty(n, k, d.get ? d : {
|
17 | enumerable: true,
|
18 | get: function () { return e[k]; }
|
19 | });
|
20 | }
|
21 | });
|
22 | }
|
23 | n["default"] = e;
|
24 | return Object.freeze(n);
|
25 | }
|
26 |
|
27 | var React__namespace = _interopNamespace(React);
|
28 | var React__default = _interopDefaultLegacy(React);
|
29 | var ReactDOM__namespace = _interopNamespace(ReactDOM);
|
30 |
|
31 | |
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 | function __rest$1(s, e) {
|
47 | var t = {};
|
48 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
49 | t[p] = s[p];
|
50 | if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
51 | for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
52 | if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
53 | t[p[i]] = s[p[i]];
|
54 | }
|
55 | return t;
|
56 | }
|
57 |
|
58 | function __awaiter$1(thisArg, _arguments, P, generator) {
|
59 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
60 | return new (P || (P = Promise))(function (resolve, reject) {
|
61 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
62 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
63 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
64 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
65 | });
|
66 | }
|
67 |
|
68 | |
69 |
|
70 |
|
71 |
|
72 | function css(...args) {
|
73 |
|
74 | const classes = [];
|
75 | const hasOwn = {}.hasOwnProperty;
|
76 | args.filter(Boolean).forEach((arg) => {
|
77 | const argType = typeof arg;
|
78 | if (argType === 'string' || argType === 'number') {
|
79 | classes.push(arg);
|
80 | }
|
81 | else if (Array.isArray(arg) && arg.length) {
|
82 | const inner = css(...arg);
|
83 | if (inner) {
|
84 | classes.push(inner);
|
85 | }
|
86 | }
|
87 | else if (argType === 'object') {
|
88 | for (const key in arg) {
|
89 | if (hasOwn.call(arg, key) && arg[key]) {
|
90 | classes.push(key);
|
91 | }
|
92 | }
|
93 | }
|
94 | });
|
95 | return classes.join(' ');
|
96 | }
|
97 |
|
98 | Promise.resolve().then(function () { return backdrop; });
|
99 | var styles$1i = {
|
100 | "backdrop": "pf-c-backdrop",
|
101 | "backdropOpen": "pf-c-backdrop__open"
|
102 | };
|
103 |
|
104 | const KEY_CODES = { ARROW_UP: 38, ARROW_DOWN: 40, ESCAPE_KEY: 27, TAB: 9, ENTER: 13, SPACE: 32 };
|
105 | const SIDE = { RIGHT: 'right', LEFT: 'left', BOTH: 'both', NONE: 'none' };
|
106 | const KEYHANDLER_DIRECTION = { UP: 'up', DOWN: 'down', RIGHT: 'right', LEFT: 'left' };
|
107 | exports.ValidatedOptions = void 0;
|
108 | (function (ValidatedOptions) {
|
109 | ValidatedOptions["success"] = "success";
|
110 | ValidatedOptions["error"] = "error";
|
111 | ValidatedOptions["warning"] = "warning";
|
112 | ValidatedOptions["default"] = "default";
|
113 | })(exports.ValidatedOptions || (exports.ValidatedOptions = {}));
|
114 | const KeyTypes = {
|
115 | Tab: 'Tab',
|
116 | Space: ' ',
|
117 | Escape: 'Escape',
|
118 | Enter: 'Enter',
|
119 | ArrowUp: 'ArrowUp',
|
120 | ArrowDown: 'ArrowDown',
|
121 | ArrowLeft: 'ArrowLeft',
|
122 | ArrowRight: 'ArrowRight'
|
123 | };
|
124 |
|
125 | |
126 |
|
127 |
|
128 |
|
129 | var candidateSelectors = ['input', 'select', 'textarea', 'a[href]', 'button', '[tabindex]', 'audio[controls]', 'video[controls]', '[contenteditable]:not([contenteditable="false"])', 'details>summary:first-of-type', 'details'];
|
130 | var candidateSelector = candidateSelectors.join(',');
|
131 | var matches = typeof Element === 'undefined' ? function () {} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
|
132 |
|
133 | var getCandidates = function getCandidates(el, includeContainer, filter) {
|
134 | var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));
|
135 |
|
136 | if (includeContainer && matches.call(el, candidateSelector)) {
|
137 | candidates.unshift(el);
|
138 | }
|
139 |
|
140 | candidates = candidates.filter(filter);
|
141 | return candidates;
|
142 | };
|
143 |
|
144 | var isContentEditable = function isContentEditable(node) {
|
145 | return node.contentEditable === 'true';
|
146 | };
|
147 |
|
148 | var getTabindex = function getTabindex(node) {
|
149 | var tabindexAttr = parseInt(node.getAttribute('tabindex'), 10);
|
150 |
|
151 | if (!isNaN(tabindexAttr)) {
|
152 | return tabindexAttr;
|
153 | }
|
154 |
|
155 |
|
156 |
|
157 | if (isContentEditable(node)) {
|
158 | return 0;
|
159 | }
|
160 |
|
161 |
|
162 |
|
163 |
|
164 |
|
165 |
|
166 | if ((node.nodeName === 'AUDIO' || node.nodeName === 'VIDEO' || node.nodeName === 'DETAILS') && node.getAttribute('tabindex') === null) {
|
167 | return 0;
|
168 | }
|
169 |
|
170 | return node.tabIndex;
|
171 | };
|
172 |
|
173 | var sortOrderedTabbables = function sortOrderedTabbables(a, b) {
|
174 | return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
|
175 | };
|
176 |
|
177 | var isInput$1 = function isInput(node) {
|
178 | return node.tagName === 'INPUT';
|
179 | };
|
180 |
|
181 | var isHiddenInput = function isHiddenInput(node) {
|
182 | return isInput$1(node) && node.type === 'hidden';
|
183 | };
|
184 |
|
185 | var isDetailsWithSummary = function isDetailsWithSummary(node) {
|
186 | var r = node.tagName === 'DETAILS' && Array.prototype.slice.apply(node.children).some(function (child) {
|
187 | return child.tagName === 'SUMMARY';
|
188 | });
|
189 | return r;
|
190 | };
|
191 |
|
192 | var getCheckedRadio = function getCheckedRadio(nodes, form) {
|
193 | for (var i = 0; i < nodes.length; i++) {
|
194 | if (nodes[i].checked && nodes[i].form === form) {
|
195 | return nodes[i];
|
196 | }
|
197 | }
|
198 | };
|
199 |
|
200 | var isTabbableRadio = function isTabbableRadio(node) {
|
201 | if (!node.name) {
|
202 | return true;
|
203 | }
|
204 |
|
205 | var radioScope = node.form || node.ownerDocument;
|
206 | var radioSet = radioScope.querySelectorAll('input[type="radio"][name="' + node.name + '"]');
|
207 | var checked = getCheckedRadio(radioSet, node.form);
|
208 | return !checked || checked === node;
|
209 | };
|
210 |
|
211 | var isRadio = function isRadio(node) {
|
212 | return isInput$1(node) && node.type === 'radio';
|
213 | };
|
214 |
|
215 | var isNonTabbableRadio = function isNonTabbableRadio(node) {
|
216 | return isRadio(node) && !isTabbableRadio(node);
|
217 | };
|
218 |
|
219 | var isHidden = function isHidden(node) {
|
220 | if (getComputedStyle(node).visibility === 'hidden') {
|
221 | return true;
|
222 | }
|
223 |
|
224 | var isDirectSummary = matches.call(node, 'details>summary:first-of-type');
|
225 | var nodeUnderDetails = isDirectSummary ? node.parentElement : node;
|
226 |
|
227 | if (matches.call(nodeUnderDetails, 'details:not([open]) *')) {
|
228 | return true;
|
229 | }
|
230 |
|
231 | while (node) {
|
232 | if (getComputedStyle(node).display === 'none') {
|
233 | return true;
|
234 | }
|
235 |
|
236 | node = node.parentElement;
|
237 | }
|
238 |
|
239 | return false;
|
240 | };
|
241 |
|
242 | var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable(node) {
|
243 | if (node.disabled || isHiddenInput(node) || isHidden(node) ||
|
244 |
|
245 | isDetailsWithSummary(node)) {
|
246 | return false;
|
247 | }
|
248 |
|
249 | return true;
|
250 | };
|
251 |
|
252 | var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable(node) {
|
253 | if (!isNodeMatchingSelectorFocusable(node) || isNonTabbableRadio(node) || getTabindex(node) < 0) {
|
254 | return false;
|
255 | }
|
256 |
|
257 | return true;
|
258 | };
|
259 |
|
260 | var tabbable = function tabbable(el, options) {
|
261 | options = options || {};
|
262 | var regularTabbables = [];
|
263 | var orderedTabbables = [];
|
264 | var candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorTabbable);
|
265 | candidates.forEach(function (candidate, i) {
|
266 | var candidateTabindex = getTabindex(candidate);
|
267 |
|
268 | if (candidateTabindex === 0) {
|
269 | regularTabbables.push(candidate);
|
270 | } else {
|
271 | orderedTabbables.push({
|
272 | documentOrder: i,
|
273 | tabIndex: candidateTabindex,
|
274 | node: candidate
|
275 | });
|
276 | }
|
277 | });
|
278 | var tabbableNodes = orderedTabbables.sort(sortOrderedTabbables).map(function (a) {
|
279 | return a.node;
|
280 | }).concat(regularTabbables);
|
281 | return tabbableNodes;
|
282 | };
|
283 |
|
284 | var focusableCandidateSelector = candidateSelectors.concat('iframe').join(',');
|
285 |
|
286 | var isFocusable = function isFocusable(node) {
|
287 | if (!node) {
|
288 | throw new Error('No node provided');
|
289 | }
|
290 |
|
291 | if (matches.call(node, focusableCandidateSelector) === false) {
|
292 | return false;
|
293 | }
|
294 |
|
295 | return isNodeMatchingSelectorFocusable(node);
|
296 | };
|
297 |
|
298 | |
299 |
|
300 |
|
301 |
|
302 |
|
303 | function _defineProperty$1(obj, key, value) {
|
304 | if (key in obj) {
|
305 | Object.defineProperty(obj, key, {
|
306 | value: value,
|
307 | enumerable: true,
|
308 | configurable: true,
|
309 | writable: true
|
310 | });
|
311 | } else {
|
312 | obj[key] = value;
|
313 | }
|
314 |
|
315 | return obj;
|
316 | }
|
317 |
|
318 | function ownKeys(object, enumerableOnly) {
|
319 | var keys = Object.keys(object);
|
320 |
|
321 | if (Object.getOwnPropertySymbols) {
|
322 | var symbols = Object.getOwnPropertySymbols(object);
|
323 | if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
324 | return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
325 | });
|
326 | keys.push.apply(keys, symbols);
|
327 | }
|
328 |
|
329 | return keys;
|
330 | }
|
331 |
|
332 | function _objectSpread2(target) {
|
333 | for (var i = 1; i < arguments.length; i++) {
|
334 | var source = arguments[i] != null ? arguments[i] : {};
|
335 |
|
336 | if (i % 2) {
|
337 | ownKeys(Object(source), true).forEach(function (key) {
|
338 | _defineProperty$1(target, key, source[key]);
|
339 | });
|
340 | } else if (Object.getOwnPropertyDescriptors) {
|
341 | Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
342 | } else {
|
343 | ownKeys(Object(source)).forEach(function (key) {
|
344 | Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
345 | });
|
346 | }
|
347 | }
|
348 |
|
349 | return target;
|
350 | }
|
351 |
|
352 | var activeFocusDelay;
|
353 |
|
354 | var activeFocusTraps = function () {
|
355 | var trapQueue = [];
|
356 | return {
|
357 | activateTrap: function activateTrap(trap) {
|
358 | if (trapQueue.length > 0) {
|
359 | var activeTrap = trapQueue[trapQueue.length - 1];
|
360 |
|
361 | if (activeTrap !== trap) {
|
362 | activeTrap.pause();
|
363 | }
|
364 | }
|
365 |
|
366 | var trapIndex = trapQueue.indexOf(trap);
|
367 |
|
368 | if (trapIndex === -1) {
|
369 | trapQueue.push(trap);
|
370 | } else {
|
371 |
|
372 | trapQueue.splice(trapIndex, 1);
|
373 | trapQueue.push(trap);
|
374 | }
|
375 | },
|
376 | deactivateTrap: function deactivateTrap(trap) {
|
377 | var trapIndex = trapQueue.indexOf(trap);
|
378 |
|
379 | if (trapIndex !== -1) {
|
380 | trapQueue.splice(trapIndex, 1);
|
381 | }
|
382 |
|
383 | if (trapQueue.length > 0) {
|
384 | trapQueue[trapQueue.length - 1].unpause();
|
385 | }
|
386 | }
|
387 | };
|
388 | }();
|
389 |
|
390 | var isSelectableInput = function isSelectableInput(node) {
|
391 | return node.tagName && node.tagName.toLowerCase() === 'input' && typeof node.select === 'function';
|
392 | };
|
393 |
|
394 | var isEscapeEvent = function isEscapeEvent(e) {
|
395 | return e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27;
|
396 | };
|
397 |
|
398 | var isTabEvent = function isTabEvent(e) {
|
399 | return e.key === 'Tab' || e.keyCode === 9;
|
400 | };
|
401 |
|
402 | var delay = function delay(fn) {
|
403 | return setTimeout(fn, 0);
|
404 | };
|
405 |
|
406 | var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
407 | var doc = document;
|
408 |
|
409 | var config = _objectSpread2({
|
410 | returnFocusOnDeactivate: true,
|
411 | escapeDeactivates: true,
|
412 | delayInitialFocus: true
|
413 | }, userOptions);
|
414 |
|
415 | var state = {
|
416 |
|
417 | containers: [],
|
418 |
|
419 |
|
420 |
|
421 |
|
422 |
|
423 |
|
424 |
|
425 | tabbableGroups: [],
|
426 | nodeFocusedBeforeActivation: null,
|
427 | mostRecentlyFocusedNode: null,
|
428 | active: false,
|
429 | paused: false
|
430 | };
|
431 | var trap;
|
432 |
|
433 | var containersContain = function containersContain(element) {
|
434 | return state.containers.some(function (container) {
|
435 | return container.contains(element);
|
436 | });
|
437 | };
|
438 |
|
439 | var getNodeForOption = function getNodeForOption(optionName) {
|
440 | var optionValue = config[optionName];
|
441 |
|
442 | if (!optionValue) {
|
443 | return null;
|
444 | }
|
445 |
|
446 | var node = optionValue;
|
447 |
|
448 | if (typeof optionValue === 'string') {
|
449 | node = doc.querySelector(optionValue);
|
450 |
|
451 | if (!node) {
|
452 | throw new Error("`".concat(optionName, "` refers to no known node"));
|
453 | }
|
454 | }
|
455 |
|
456 | if (typeof optionValue === 'function') {
|
457 | node = optionValue();
|
458 |
|
459 | if (!node) {
|
460 | throw new Error("`".concat(optionName, "` did not return a node"));
|
461 | }
|
462 | }
|
463 |
|
464 | return node;
|
465 | };
|
466 |
|
467 | var getInitialFocusNode = function getInitialFocusNode() {
|
468 | var node;
|
469 |
|
470 | if (getNodeForOption('initialFocus') !== null) {
|
471 | node = getNodeForOption('initialFocus');
|
472 | } else if (containersContain(doc.activeElement)) {
|
473 | node = doc.activeElement;
|
474 | } else {
|
475 | var firstTabbableGroup = state.tabbableGroups[0];
|
476 | var firstTabbableNode = firstTabbableGroup && firstTabbableGroup.firstTabbableNode;
|
477 | node = firstTabbableNode || getNodeForOption('fallbackFocus');
|
478 | }
|
479 |
|
480 | if (!node) {
|
481 | throw new Error('Your focus-trap needs to have at least one focusable element');
|
482 | }
|
483 |
|
484 | return node;
|
485 | };
|
486 |
|
487 | var updateTabbableNodes = function updateTabbableNodes() {
|
488 | state.tabbableGroups = state.containers.map(function (container) {
|
489 | var tabbableNodes = tabbable(container);
|
490 |
|
491 | if (tabbableNodes.length > 0) {
|
492 | return {
|
493 | firstTabbableNode: tabbableNodes[0],
|
494 | lastTabbableNode: tabbableNodes[tabbableNodes.length - 1]
|
495 | };
|
496 | }
|
497 |
|
498 | return undefined;
|
499 | }).filter(function (group) {
|
500 | return !!group;
|
501 | });
|
502 |
|
503 |
|
504 | if (state.tabbableGroups.length <= 0 && !getNodeForOption('fallbackFocus')) {
|
505 | throw new Error('Your focus-trap must have at least one container with at least one tabbable node in it at all times');
|
506 | }
|
507 | };
|
508 |
|
509 | var tryFocus = function tryFocus(node) {
|
510 | if (node === doc.activeElement) {
|
511 | return;
|
512 | }
|
513 |
|
514 | if (!node || !node.focus) {
|
515 | tryFocus(getInitialFocusNode());
|
516 | return;
|
517 | }
|
518 |
|
519 | node.focus({
|
520 | preventScroll: !!config.preventScroll
|
521 | });
|
522 | state.mostRecentlyFocusedNode = node;
|
523 |
|
524 | if (isSelectableInput(node)) {
|
525 | node.select();
|
526 | }
|
527 | };
|
528 |
|
529 | var getReturnFocusNode = function getReturnFocusNode(previousActiveElement) {
|
530 | var node = getNodeForOption('setReturnFocus');
|
531 | return node ? node : previousActiveElement;
|
532 | };
|
533 |
|
534 |
|
535 |
|
536 | var checkPointerDown = function checkPointerDown(e) {
|
537 | if (containersContain(e.target)) {
|
538 |
|
539 | return;
|
540 | }
|
541 |
|
542 | if (config.clickOutsideDeactivates) {
|
543 |
|
544 | trap.deactivate({
|
545 |
|
546 |
|
547 |
|
548 |
|
549 |
|
550 |
|
551 |
|
552 |
|
553 |
|
554 |
|
555 |
|
556 | returnFocus: config.returnFocusOnDeactivate && !isFocusable(e.target)
|
557 | });
|
558 | return;
|
559 | }
|
560 |
|
561 |
|
562 |
|
563 |
|
564 | if (config.allowOutsideClick && (typeof config.allowOutsideClick === 'boolean' ? config.allowOutsideClick : config.allowOutsideClick(e))) {
|
565 |
|
566 | return;
|
567 | }
|
568 |
|
569 |
|
570 | e.preventDefault();
|
571 | };
|
572 |
|
573 |
|
574 | var checkFocusIn = function checkFocusIn(e) {
|
575 | var targetContained = containersContain(e.target);
|
576 |
|
577 | if (targetContained || e.target instanceof Document) {
|
578 | if (targetContained) {
|
579 | state.mostRecentlyFocusedNode = e.target;
|
580 | }
|
581 | } else {
|
582 |
|
583 | e.stopImmediatePropagation();
|
584 | tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
|
585 | }
|
586 | };
|
587 |
|
588 |
|
589 |
|
590 |
|
591 |
|
592 | var checkTab = function checkTab(e) {
|
593 | updateTabbableNodes();
|
594 | var destinationNode = null;
|
595 |
|
596 | if (state.tabbableGroups.length > 0) {
|
597 | if (e.shiftKey) {
|
598 | var startOfGroupIndex = state.tabbableGroups.findIndex(function (_ref) {
|
599 | var firstTabbableNode = _ref.firstTabbableNode;
|
600 | return e.target === firstTabbableNode;
|
601 | });
|
602 |
|
603 | if (startOfGroupIndex >= 0) {
|
604 | var destinationGroupIndex = startOfGroupIndex === 0 ? state.tabbableGroups.length - 1 : startOfGroupIndex - 1;
|
605 | var destinationGroup = state.tabbableGroups[destinationGroupIndex];
|
606 | destinationNode = destinationGroup.lastTabbableNode;
|
607 | }
|
608 | } else {
|
609 | var lastOfGroupIndex = state.tabbableGroups.findIndex(function (_ref2) {
|
610 | var lastTabbableNode = _ref2.lastTabbableNode;
|
611 | return e.target === lastTabbableNode;
|
612 | });
|
613 |
|
614 | if (lastOfGroupIndex >= 0) {
|
615 | var _destinationGroupIndex = lastOfGroupIndex === state.tabbableGroups.length - 1 ? 0 : lastOfGroupIndex + 1;
|
616 |
|
617 | var _destinationGroup = state.tabbableGroups[_destinationGroupIndex];
|
618 | destinationNode = _destinationGroup.firstTabbableNode;
|
619 | }
|
620 | }
|
621 | } else {
|
622 | destinationNode = getNodeForOption('fallbackFocus');
|
623 | }
|
624 |
|
625 | if (destinationNode) {
|
626 | e.preventDefault();
|
627 | tryFocus(destinationNode);
|
628 | }
|
629 | };
|
630 |
|
631 | var checkKey = function checkKey(e) {
|
632 | if (config.escapeDeactivates !== false && isEscapeEvent(e)) {
|
633 | e.preventDefault();
|
634 | trap.deactivate();
|
635 | return;
|
636 | }
|
637 |
|
638 | if (isTabEvent(e)) {
|
639 | checkTab(e);
|
640 | return;
|
641 | }
|
642 | };
|
643 |
|
644 | var checkClick = function checkClick(e) {
|
645 | if (config.clickOutsideDeactivates) {
|
646 | return;
|
647 | }
|
648 |
|
649 | if (containersContain(e.target)) {
|
650 | return;
|
651 | }
|
652 |
|
653 | if (config.allowOutsideClick && (typeof config.allowOutsideClick === 'boolean' ? config.allowOutsideClick : config.allowOutsideClick(e))) {
|
654 | return;
|
655 | }
|
656 |
|
657 | e.preventDefault();
|
658 | e.stopImmediatePropagation();
|
659 | };
|
660 |
|
661 |
|
662 |
|
663 |
|
664 | var addListeners = function addListeners() {
|
665 | if (!state.active) {
|
666 | return;
|
667 | }
|
668 |
|
669 |
|
670 | activeFocusTraps.activateTrap(trap);
|
671 |
|
672 |
|
673 | activeFocusDelay = config.delayInitialFocus ? delay(function () {
|
674 | tryFocus(getInitialFocusNode());
|
675 | }) : tryFocus(getInitialFocusNode());
|
676 | doc.addEventListener('focusin', checkFocusIn, true);
|
677 | doc.addEventListener('mousedown', checkPointerDown, {
|
678 | capture: true,
|
679 | passive: false
|
680 | });
|
681 | doc.addEventListener('touchstart', checkPointerDown, {
|
682 | capture: true,
|
683 | passive: false
|
684 | });
|
685 | doc.addEventListener('click', checkClick, {
|
686 | capture: true,
|
687 | passive: false
|
688 | });
|
689 | doc.addEventListener('keydown', checkKey, {
|
690 | capture: true,
|
691 | passive: false
|
692 | });
|
693 | return trap;
|
694 | };
|
695 |
|
696 | var removeListeners = function removeListeners() {
|
697 | if (!state.active) {
|
698 | return;
|
699 | }
|
700 |
|
701 | doc.removeEventListener('focusin', checkFocusIn, true);
|
702 | doc.removeEventListener('mousedown', checkPointerDown, true);
|
703 | doc.removeEventListener('touchstart', checkPointerDown, true);
|
704 | doc.removeEventListener('click', checkClick, true);
|
705 | doc.removeEventListener('keydown', checkKey, true);
|
706 | return trap;
|
707 | };
|
708 |
|
709 |
|
710 |
|
711 |
|
712 | trap = {
|
713 | activate: function activate(activateOptions) {
|
714 | if (state.active) {
|
715 | return this;
|
716 | }
|
717 |
|
718 | updateTabbableNodes();
|
719 | state.active = true;
|
720 | state.paused = false;
|
721 | state.nodeFocusedBeforeActivation = doc.activeElement;
|
722 | var onActivate = activateOptions && activateOptions.onActivate ? activateOptions.onActivate : config.onActivate;
|
723 |
|
724 | if (onActivate) {
|
725 | onActivate();
|
726 | }
|
727 |
|
728 | addListeners();
|
729 | return this;
|
730 | },
|
731 | deactivate: function deactivate(deactivateOptions) {
|
732 | if (!state.active) {
|
733 | return this;
|
734 | }
|
735 |
|
736 | clearTimeout(activeFocusDelay);
|
737 | removeListeners();
|
738 | state.active = false;
|
739 | state.paused = false;
|
740 | activeFocusTraps.deactivateTrap(trap);
|
741 | var onDeactivate = deactivateOptions && deactivateOptions.onDeactivate !== undefined ? deactivateOptions.onDeactivate : config.onDeactivate;
|
742 |
|
743 | if (onDeactivate) {
|
744 | onDeactivate();
|
745 | }
|
746 |
|
747 | var returnFocus = deactivateOptions && deactivateOptions.returnFocus !== undefined ? deactivateOptions.returnFocus : config.returnFocusOnDeactivate;
|
748 |
|
749 | if (returnFocus) {
|
750 | delay(function () {
|
751 | tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation));
|
752 | });
|
753 | }
|
754 |
|
755 | return this;
|
756 | },
|
757 | pause: function pause() {
|
758 | if (state.paused || !state.active) {
|
759 | return this;
|
760 | }
|
761 |
|
762 | state.paused = true;
|
763 | removeListeners();
|
764 | return this;
|
765 | },
|
766 | unpause: function unpause() {
|
767 | if (!state.paused || !state.active) {
|
768 | return this;
|
769 | }
|
770 |
|
771 | state.paused = false;
|
772 | updateTabbableNodes();
|
773 | addListeners();
|
774 | return this;
|
775 | },
|
776 | updateContainerElements: function updateContainerElements(containerElements) {
|
777 | var elementsAsArray = [].concat(containerElements).filter(Boolean);
|
778 | state.containers = elementsAsArray.map(function (element) {
|
779 | return typeof element === 'string' ? doc.querySelector(element) : element;
|
780 | });
|
781 |
|
782 | if (state.active) {
|
783 | updateTabbableNodes();
|
784 | }
|
785 |
|
786 | return this;
|
787 | }
|
788 | };
|
789 |
|
790 | trap.updateContainerElements(elements);
|
791 | return trap;
|
792 | };
|
793 |
|
794 | class FocusTrap extends React__namespace.Component {
|
795 | constructor(props) {
|
796 | super(props);
|
797 | this.divRef = React__namespace.createRef();
|
798 | if (typeof document !== 'undefined') {
|
799 | this.previouslyFocusedElement = document.activeElement;
|
800 | }
|
801 | }
|
802 | componentDidMount() {
|
803 |
|
804 |
|
805 |
|
806 |
|
807 |
|
808 | this.focusTrap = createFocusTrap(this.divRef.current, Object.assign(Object.assign({}, this.props.focusTrapOptions), { returnFocusOnDeactivate: false }));
|
809 | if (this.props.active) {
|
810 | this.focusTrap.activate();
|
811 | }
|
812 | if (this.props.paused) {
|
813 | this.focusTrap.pause();
|
814 | }
|
815 | }
|
816 | componentDidUpdate(prevProps) {
|
817 | if (prevProps.active && !this.props.active) {
|
818 | this.focusTrap.deactivate();
|
819 | }
|
820 | else if (!prevProps.active && this.props.active) {
|
821 | this.focusTrap.activate();
|
822 | }
|
823 | if (prevProps.paused && !this.props.paused) {
|
824 | this.focusTrap.unpause();
|
825 | }
|
826 | else if (!prevProps.paused && this.props.paused) {
|
827 | this.focusTrap.pause();
|
828 | }
|
829 | }
|
830 | componentWillUnmount() {
|
831 | this.focusTrap.deactivate();
|
832 | if (this.props.focusTrapOptions.returnFocusOnDeactivate !== false &&
|
833 | this.previouslyFocusedElement &&
|
834 | this.previouslyFocusedElement.focus) {
|
835 | this.previouslyFocusedElement.focus({ preventScroll: this.props.preventScrollOnDeactivate });
|
836 | }
|
837 | }
|
838 | render() {
|
839 |
|
840 | const _a = this.props, { children, className, focusTrapOptions, active, paused, preventScrollOnDeactivate } = _a, rest = __rest$1(_a, ["children", "className", "focusTrapOptions", "active", "paused", "preventScrollOnDeactivate"]);
|
841 | return (React__namespace.createElement("div", Object.assign({ ref: this.divRef, className: className }, rest), children));
|
842 | }
|
843 | }
|
844 | FocusTrap.displayName = 'FocusTrap';
|
845 | FocusTrap.defaultProps = {
|
846 | active: true,
|
847 | paused: false,
|
848 | focusTrapOptions: {},
|
849 | preventScrollOnDeactivate: false
|
850 | };
|
851 |
|
852 | |
853 |
|
854 |
|
855 |
|
856 |
|
857 |
|
858 |
|
859 |
|
860 |
|
861 |
|
862 |
|
863 |
|
864 | let currentId$3 = 0;
|
865 | class GenerateId extends React__namespace.Component {
|
866 | constructor() {
|
867 | super(...arguments);
|
868 | this.id = `${this.props.prefix}${currentId$3++}`;
|
869 | }
|
870 | render() {
|
871 | return this.props.children(this.id);
|
872 | }
|
873 | }
|
874 | GenerateId.displayName = 'GenerateId';
|
875 | GenerateId.defaultProps = {
|
876 | prefix: 'pf-random-id-'
|
877 | };
|
878 |
|
879 | const ASTERISK = '*';
|
880 |
|
881 | let uid = 0;
|
882 | const ouiaPrefix = 'OUIA-Generated-';
|
883 | const ouiaIdByRoute = {};
|
884 | |
885 |
|
886 |
|
887 |
|
888 |
|
889 |
|
890 |
|
891 |
|
892 |
|
893 |
|
894 |
|
895 |
|
896 |
|
897 |
|
898 |
|
899 |
|
900 |
|
901 | function getOUIAProps(componentType, id, ouiaSafe = true) {
|
902 | return {
|
903 | 'data-ouia-component-type': `PF4/${componentType}`,
|
904 | 'data-ouia-safe': ouiaSafe,
|
905 | 'data-ouia-component-id': id
|
906 | };
|
907 | }
|
908 | |
909 |
|
910 |
|
911 |
|
912 |
|
913 |
|
914 |
|
915 |
|
916 |
|
917 | const useOUIAProps = (componentType, id, ouiaSafe = true, variant) => ({
|
918 | 'data-ouia-component-type': `PF4/${componentType}`,
|
919 | 'data-ouia-safe': ouiaSafe,
|
920 | 'data-ouia-component-id': useOUIAId(componentType, id, variant)
|
921 | });
|
922 | |
923 |
|
924 |
|
925 |
|
926 |
|
927 |
|
928 |
|
929 | const useOUIAId = (componentType, id, variant) => {
|
930 | if (id !== undefined) {
|
931 | return id;
|
932 | }
|
933 | return React.useMemo(() => getDefaultOUIAId(componentType, variant), [componentType, variant]);
|
934 | };
|
935 | |
936 |
|
937 |
|
938 |
|
939 |
|
940 |
|
941 | function getDefaultOUIAId(componentType, variant) {
|
942 | |
943 |
|
944 |
|
945 |
|
946 |
|
947 | try {
|
948 | let key;
|
949 | if (typeof window !== 'undefined') {
|
950 |
|
951 | key = `${window.location.href}-${componentType}-${variant || ''}`;
|
952 | }
|
953 | else {
|
954 |
|
955 | key = `${componentType}-${variant || ''}`;
|
956 | }
|
957 | if (!ouiaIdByRoute[key]) {
|
958 | ouiaIdByRoute[key] = 0;
|
959 | }
|
960 | return `${ouiaPrefix}${componentType}-${variant ? `${variant}-` : ''}${++ouiaIdByRoute[key]}`;
|
961 | }
|
962 | catch (exception) {
|
963 | return `${ouiaPrefix}${componentType}-${variant ? `${variant}-` : ''}${++uid}`;
|
964 | }
|
965 | }
|
966 |
|
967 | |
968 |
|
969 |
|
970 | function capitalize(input) {
|
971 | return input[0].toUpperCase() + input.substring(1);
|
972 | }
|
973 | |
974 |
|
975 |
|
976 | function getUniqueId(prefix = 'pf') {
|
977 | const uid = new Date().getTime() +
|
978 | Math.random()
|
979 | .toString(36)
|
980 | .slice(2);
|
981 | return `${prefix}-${uid}`;
|
982 | }
|
983 | |
984 |
|
985 |
|
986 |
|
987 |
|
988 | function debounce$1(func, wait) {
|
989 | let timeout;
|
990 | return (...args) => {
|
991 | clearTimeout(timeout);
|
992 | timeout = setTimeout(() => func.apply(this, args), wait);
|
993 | };
|
994 | }
|
995 | |
996 |
|
997 |
|
998 |
|
999 |
|
1000 |
|
1001 |
|
1002 |
|
1003 |
|
1004 |
|
1005 | function isElementInView(container, element, partial, strict = false) {
|
1006 | if (!container || !element) {
|
1007 | return false;
|
1008 | }
|
1009 | const containerBounds = container.getBoundingClientRect();
|
1010 | const elementBounds = element.getBoundingClientRect();
|
1011 | const containerBoundsLeft = Math.ceil(containerBounds.left);
|
1012 | const containerBoundsRight = Math.floor(containerBounds.right);
|
1013 | const elementBoundsLeft = Math.ceil(elementBounds.left);
|
1014 | const elementBoundsRight = Math.floor(elementBounds.right);
|
1015 |
|
1016 | const isTotallyInView = elementBoundsLeft >= containerBoundsLeft && elementBoundsRight <= containerBoundsRight;
|
1017 | const isPartiallyInView = (partial || (!strict && containerBounds.width < elementBounds.width)) &&
|
1018 | ((elementBoundsLeft < containerBoundsLeft && elementBoundsRight > containerBoundsLeft) ||
|
1019 | (elementBoundsRight > containerBoundsRight && elementBoundsLeft < containerBoundsRight));
|
1020 |
|
1021 | return isTotallyInView || isPartiallyInView;
|
1022 | }
|
1023 | |
1024 |
|
1025 |
|
1026 |
|
1027 |
|
1028 |
|
1029 |
|
1030 | function sideElementIsOutOfView(container, element) {
|
1031 | const containerBounds = container.getBoundingClientRect();
|
1032 | const elementBounds = element.getBoundingClientRect();
|
1033 | const containerBoundsLeft = Math.floor(containerBounds.left);
|
1034 | const containerBoundsRight = Math.floor(containerBounds.right);
|
1035 | const elementBoundsLeft = Math.floor(elementBounds.left);
|
1036 | const elementBoundsRight = Math.floor(elementBounds.right);
|
1037 |
|
1038 | const isOffLeft = elementBoundsLeft < containerBoundsLeft;
|
1039 | const isOffRight = elementBoundsRight > containerBoundsRight;
|
1040 | let side = SIDE.NONE;
|
1041 | if (isOffRight && isOffLeft) {
|
1042 | side = SIDE.BOTH;
|
1043 | }
|
1044 | else if (isOffRight) {
|
1045 | side = SIDE.RIGHT;
|
1046 | }
|
1047 | else if (isOffLeft) {
|
1048 | side = SIDE.LEFT;
|
1049 | }
|
1050 |
|
1051 | return side;
|
1052 | }
|
1053 | |
1054 |
|
1055 |
|
1056 |
|
1057 |
|
1058 |
|
1059 |
|
1060 |
|
1061 |
|
1062 |
|
1063 |
|
1064 |
|
1065 |
|
1066 |
|
1067 |
|
1068 |
|
1069 | function fillTemplate(templateString, templateVars) {
|
1070 | return templateString.replace(/\${(.*?)}/g, (_, match) => templateVars[match] || '');
|
1071 | }
|
1072 | |
1073 |
|
1074 |
|
1075 |
|
1076 |
|
1077 |
|
1078 |
|
1079 |
|
1080 |
|
1081 |
|
1082 | function keyHandler(index, innerIndex, position, refsCollection, kids, custom = false) {
|
1083 | if (!Array.isArray(kids)) {
|
1084 | return;
|
1085 | }
|
1086 | const isMultiDimensional = refsCollection.filter(ref => ref)[0].constructor === Array;
|
1087 | let nextIndex = index;
|
1088 | let nextInnerIndex = innerIndex;
|
1089 | if (position === 'up') {
|
1090 | if (index === 0) {
|
1091 |
|
1092 | nextIndex = kids.length - 1;
|
1093 | }
|
1094 | else {
|
1095 | nextIndex = index - 1;
|
1096 | }
|
1097 | }
|
1098 | else if (position === 'down') {
|
1099 | if (index === kids.length - 1) {
|
1100 |
|
1101 | nextIndex = 0;
|
1102 | }
|
1103 | else {
|
1104 | nextIndex = index + 1;
|
1105 | }
|
1106 | }
|
1107 | else if (position === 'left') {
|
1108 | if (innerIndex === 0) {
|
1109 | nextInnerIndex = refsCollection[index].length - 1;
|
1110 | }
|
1111 | else {
|
1112 | nextInnerIndex = innerIndex - 1;
|
1113 | }
|
1114 | }
|
1115 | else if (position === 'right') {
|
1116 | if (innerIndex === refsCollection[index].length - 1) {
|
1117 | nextInnerIndex = 0;
|
1118 | }
|
1119 | else {
|
1120 | nextInnerIndex = innerIndex + 1;
|
1121 | }
|
1122 | }
|
1123 | if (refsCollection[nextIndex] === null ||
|
1124 | refsCollection[nextIndex] === undefined ||
|
1125 | (isMultiDimensional &&
|
1126 | (refsCollection[nextIndex][nextInnerIndex] === null || refsCollection[nextIndex][nextInnerIndex] === undefined))) {
|
1127 | keyHandler(nextIndex, nextInnerIndex, position, refsCollection, kids, custom);
|
1128 | }
|
1129 | else if (custom) {
|
1130 | if (refsCollection[nextIndex].focus) {
|
1131 | refsCollection[nextIndex].focus();
|
1132 | }
|
1133 |
|
1134 | const element = ReactDOM__namespace.findDOMNode(refsCollection[nextIndex]);
|
1135 | element.focus();
|
1136 | }
|
1137 | else if (position !== 'tab') {
|
1138 | if (isMultiDimensional) {
|
1139 | refsCollection[nextIndex][nextInnerIndex].focus();
|
1140 | }
|
1141 | else {
|
1142 | refsCollection[nextIndex].focus();
|
1143 | }
|
1144 | }
|
1145 | }
|
1146 | |
1147 |
|
1148 |
|
1149 |
|
1150 |
|
1151 | function findTabbableElements(containerRef, tababbleSelectors) {
|
1152 | const tabbable = containerRef.current.querySelectorAll(tababbleSelectors);
|
1153 | const list = Array.prototype.filter.call(tabbable, function (item) {
|
1154 | return item.tabIndex >= '0';
|
1155 | });
|
1156 | return list;
|
1157 | }
|
1158 | |
1159 |
|
1160 |
|
1161 |
|
1162 |
|
1163 |
|
1164 | function getNextIndex(index, position, collection) {
|
1165 | let nextIndex;
|
1166 | if (position === 'up') {
|
1167 | if (index === 0) {
|
1168 |
|
1169 | nextIndex = collection.length - 1;
|
1170 | }
|
1171 | else {
|
1172 | nextIndex = index - 1;
|
1173 | }
|
1174 | }
|
1175 | else if (index === collection.length - 1) {
|
1176 |
|
1177 | nextIndex = 0;
|
1178 | }
|
1179 | else {
|
1180 | nextIndex = index + 1;
|
1181 | }
|
1182 | if (collection[nextIndex] === undefined || collection[nextIndex][0] === null) {
|
1183 | return getNextIndex(nextIndex, position, collection);
|
1184 | }
|
1185 | else {
|
1186 | return nextIndex;
|
1187 | }
|
1188 | }
|
1189 | |
1190 |
|
1191 |
|
1192 |
|
1193 |
|
1194 |
|
1195 |
|
1196 | function pluralize(i, singular, plural) {
|
1197 | if (!plural) {
|
1198 | plural = `${singular}s`;
|
1199 | }
|
1200 | return `${i || 0} ${i === 1 ? singular : plural}`;
|
1201 | }
|
1202 | |
1203 |
|
1204 |
|
1205 |
|
1206 |
|
1207 |
|
1208 | const setBreakpointCssVars = (mods, cssVar) => Object.entries(mods || {}).reduce((acc, [breakpoint, value]) => breakpoint === 'default' ? Object.assign(Object.assign({}, acc), { [cssVar]: value }) : Object.assign(Object.assign({}, acc), { [`${cssVar}-on-${breakpoint}`]: value }), {});
|
1209 | |
1210 |
|
1211 |
|
1212 |
|
1213 |
|
1214 |
|
1215 | const formatBreakpointMods = (mods, styles, stylePrefix = '', breakpoint) => {
|
1216 | if (!mods) {
|
1217 | return '';
|
1218 | }
|
1219 | if (breakpoint) {
|
1220 | if (breakpoint in mods) {
|
1221 | return styles.modifiers[toCamel(`${stylePrefix}${mods[breakpoint]}`)];
|
1222 | }
|
1223 |
|
1224 | const breakpointsOrder = ['2xl', 'xl', 'lg', 'md', 'sm', 'default'];
|
1225 | const breakpointsIndex = breakpointsOrder.indexOf(breakpoint);
|
1226 | for (let i = breakpointsIndex; i < breakpointsOrder.length; i++) {
|
1227 | if (breakpointsOrder[i] in mods) {
|
1228 | return styles.modifiers[toCamel(`${stylePrefix}${mods[breakpointsOrder[i]]}`)];
|
1229 | }
|
1230 | }
|
1231 | return '';
|
1232 | }
|
1233 | return Object.entries(mods || {})
|
1234 | .map(([breakpoint, mod]) => `${stylePrefix}${mod}${breakpoint !== 'default' ? `-on-${breakpoint}` : ''}`)
|
1235 | .map(toCamel)
|
1236 | .map(mod => mod.replace(/-?(\dxl)/gi, (_res, group) => `_${group}`))
|
1237 | .map(modifierKey => styles.modifiers[modifierKey])
|
1238 | .filter(Boolean)
|
1239 | .join(' ');
|
1240 | };
|
1241 | |
1242 |
|
1243 |
|
1244 |
|
1245 |
|
1246 |
|
1247 | const getBreakpoint = (width) => {
|
1248 | if (width === null) {
|
1249 | return null;
|
1250 | }
|
1251 | if (width >= 1450) {
|
1252 | return '2xl';
|
1253 | }
|
1254 | if (width >= 1200) {
|
1255 | return 'xl';
|
1256 | }
|
1257 | if (width >= 992) {
|
1258 | return 'lg';
|
1259 | }
|
1260 | if (width >= 768) {
|
1261 | return 'md';
|
1262 | }
|
1263 | if (width >= 576) {
|
1264 | return 'sm';
|
1265 | }
|
1266 | return 'default';
|
1267 | };
|
1268 | const camelize = (s) => s
|
1269 | .toUpperCase()
|
1270 | .replace('-', '')
|
1271 | .replace('_', '');
|
1272 | |
1273 |
|
1274 |
|
1275 |
|
1276 | const toCamel = (s) => s.replace(/([-_][a-z])/gi, camelize);
|
1277 | |
1278 |
|
1279 |
|
1280 | const canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
1281 | |
1282 |
|
1283 |
|
1284 |
|
1285 |
|
1286 |
|
1287 |
|
1288 |
|
1289 | const getTextWidth = (text, node) => {
|
1290 | const computedStyle = getComputedStyle(node);
|
1291 |
|
1292 | const getFontFromComputedStyle = () => {
|
1293 | let computedFont = '';
|
1294 |
|
1295 |
|
1296 |
|
1297 | const fontStretchLookupTable = {
|
1298 | '50%': 'ultra-condensed',
|
1299 | '62.5%': 'extra-condensed',
|
1300 | '75%': 'condensed',
|
1301 | '87.5%': 'semi-condensed',
|
1302 | '100%': 'normal',
|
1303 | '112.5%': 'semi-expanded',
|
1304 | '125%': 'expanded',
|
1305 | '150%': 'extra-expanded',
|
1306 | '200%': 'ultra-expanded'
|
1307 | };
|
1308 |
|
1309 |
|
1310 | let fontStretch;
|
1311 | if (computedStyle.fontStretch in fontStretchLookupTable) {
|
1312 | fontStretch = fontStretchLookupTable[computedStyle.fontStretch];
|
1313 | }
|
1314 | else {
|
1315 | fontStretch = 'normal';
|
1316 | }
|
1317 | computedFont =
|
1318 | computedStyle.fontStyle +
|
1319 | ' ' +
|
1320 | computedStyle.fontVariant +
|
1321 | ' ' +
|
1322 | computedStyle.fontWeight +
|
1323 | ' ' +
|
1324 | fontStretch +
|
1325 | ' ' +
|
1326 | computedStyle.fontSize +
|
1327 | '/' +
|
1328 | computedStyle.lineHeight +
|
1329 | ' ' +
|
1330 | computedStyle.fontFamily;
|
1331 | return computedFont;
|
1332 | };
|
1333 | const canvas = document.createElement('canvas');
|
1334 | const context = canvas.getContext('2d');
|
1335 | context.font = computedStyle.font || getFontFromComputedStyle();
|
1336 | return context.measureText(text).width;
|
1337 | };
|
1338 | |
1339 |
|
1340 |
|
1341 |
|
1342 |
|
1343 | const innerDimensions = (node) => {
|
1344 | const computedStyle = getComputedStyle(node);
|
1345 | let width = node.clientWidth;
|
1346 | let height = node.clientHeight;
|
1347 | height -= parseFloat(computedStyle.paddingTop) + parseFloat(computedStyle.paddingBottom);
|
1348 | width -= parseFloat(computedStyle.paddingLeft) + parseFloat(computedStyle.paddingRight);
|
1349 | return { height, width };
|
1350 | };
|
1351 | |
1352 |
|
1353 |
|
1354 |
|
1355 |
|
1356 |
|
1357 | const trimLeft = (node, value) => {
|
1358 | const availableWidth = innerDimensions(node).width;
|
1359 | let newValue = value;
|
1360 | if (getTextWidth(value, node) > availableWidth) {
|
1361 |
|
1362 | while (getTextWidth(`...${newValue}`, node) > availableWidth) {
|
1363 | newValue = newValue.substring(1);
|
1364 | }
|
1365 |
|
1366 | if (node.value) {
|
1367 | node.value = `...${newValue}`;
|
1368 | }
|
1369 | else {
|
1370 | node.innerText = `...${newValue}`;
|
1371 | }
|
1372 | }
|
1373 | else {
|
1374 | if (node.value) {
|
1375 | node.value = value;
|
1376 | }
|
1377 | else {
|
1378 | node.innerText = value;
|
1379 | }
|
1380 | }
|
1381 | };
|
1382 | |
1383 |
|
1384 |
|
1385 | const preventedEvents = (events) => events.reduce((handlers, eventToPrevent) => (Object.assign(Object.assign({}, handlers), { [eventToPrevent]: (event) => {
|
1386 | event.preventDefault();
|
1387 | } })), {});
|
1388 |
|
1389 | |
1390 |
|
1391 |
|
1392 |
|
1393 |
|
1394 |
|
1395 |
|
1396 |
|
1397 | class FindRefWrapper extends React__namespace.Component {
|
1398 | componentDidMount() {
|
1399 |
|
1400 | const root = ReactDOM__namespace.findDOMNode(this);
|
1401 | this.props.onFoundRef(root);
|
1402 | }
|
1403 | render() {
|
1404 | return this.props.children || null;
|
1405 | }
|
1406 | }
|
1407 | FindRefWrapper.displayName = 'FindRefWrapper';
|
1408 |
|
1409 | |
1410 |
|
1411 |
|
1412 | function getBoundingClientRect(element) {
|
1413 | const rect = element.getBoundingClientRect();
|
1414 | return {
|
1415 | width: rect.width,
|
1416 | height: rect.height,
|
1417 | top: rect.top,
|
1418 | right: rect.right,
|
1419 | bottom: rect.bottom,
|
1420 | left: rect.left,
|
1421 | x: rect.left,
|
1422 | y: rect.top
|
1423 | };
|
1424 | }
|
1425 |
|
1426 |
|
1427 |
|
1428 |
|
1429 | |
1430 |
|
1431 |
|
1432 | function getWindow(node) {
|
1433 | if (node.toString() !== '[object Window]') {
|
1434 | const ownerDocument = node.ownerDocument;
|
1435 | return ownerDocument ? ownerDocument.defaultView : window;
|
1436 | }
|
1437 | return node;
|
1438 | }
|
1439 |
|
1440 |
|
1441 | |
1442 |
|
1443 |
|
1444 | function getWindowScroll(node) {
|
1445 | const win = getWindow(node);
|
1446 | const scrollLeft = win.pageXOffset;
|
1447 | const scrollTop = win.pageYOffset;
|
1448 | return {
|
1449 | scrollLeft,
|
1450 | scrollTop
|
1451 | };
|
1452 | }
|
1453 |
|
1454 |
|
1455 | |
1456 |
|
1457 | |
1458 |
|
1459 |
|
1460 | function isElement(node) {
|
1461 | const OwnElement = getWindow(node).Element;
|
1462 | return node instanceof OwnElement || node instanceof Element;
|
1463 | }
|
1464 | |
1465 |
|
1466 | |
1467 |
|
1468 |
|
1469 | function isHTMLElement(node) {
|
1470 | const OwnElement = getWindow(node).HTMLElement;
|
1471 | return node instanceof OwnElement || node instanceof HTMLElement;
|
1472 | }
|
1473 |
|
1474 |
|
1475 | |
1476 |
|
1477 |
|
1478 | function getHTMLElementScroll(element) {
|
1479 | return {
|
1480 | scrollLeft: element.scrollLeft,
|
1481 | scrollTop: element.scrollTop
|
1482 | };
|
1483 | }
|
1484 |
|
1485 |
|
1486 | |
1487 |
|
1488 |
|
1489 | function getNodeScroll(node) {
|
1490 | if (node === getWindow(node) || !isHTMLElement(node)) {
|
1491 | return getWindowScroll(node);
|
1492 | }
|
1493 | else {
|
1494 | return getHTMLElementScroll(node);
|
1495 | }
|
1496 | }
|
1497 |
|
1498 | |
1499 |
|
1500 |
|
1501 | function getNodeName(element) {
|
1502 | return element ? (element.nodeName || '').toLowerCase() : null;
|
1503 | }
|
1504 |
|
1505 |
|
1506 | |
1507 |
|
1508 |
|
1509 | function getDocumentElement(element) {
|
1510 |
|
1511 | return (isElement(element) ? element.ownerDocument : element.document).documentElement;
|
1512 | }
|
1513 |
|
1514 |
|
1515 | |
1516 |
|
1517 |
|
1518 | function getWindowScrollBarX(element) {
|
1519 |
|
1520 |
|
1521 |
|
1522 |
|
1523 |
|
1524 |
|
1525 |
|
1526 | return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
|
1527 | }
|
1528 |
|
1529 |
|
1530 | |
1531 |
|
1532 |
|
1533 | function getComputedStyle$1(element) {
|
1534 | return getWindow(element).getComputedStyle(element);
|
1535 | }
|
1536 |
|
1537 |
|
1538 | |
1539 |
|
1540 |
|
1541 | function isScrollParent(element) {
|
1542 |
|
1543 | const { overflow, overflowX, overflowY } = getComputedStyle$1(element);
|
1544 | return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
|
1545 | }
|
1546 |
|
1547 |
|
1548 |
|
1549 | |
1550 |
|
1551 |
|
1552 |
|
1553 |
|
1554 | function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed = false) {
|
1555 | const documentElement = getDocumentElement(offsetParent);
|
1556 | const rect = getBoundingClientRect(elementOrVirtualElement);
|
1557 | const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
1558 | let scroll = { scrollLeft: 0, scrollTop: 0 };
|
1559 | let offsets = { x: 0, y: 0 };
|
1560 | if (isOffsetParentAnElement || (!isOffsetParentAnElement && !isFixed)) {
|
1561 | if (getNodeName(offsetParent) !== 'body' ||
|
1562 | isScrollParent(documentElement)) {
|
1563 | scroll = getNodeScroll(offsetParent);
|
1564 | }
|
1565 | if (isHTMLElement(offsetParent)) {
|
1566 | offsets = getBoundingClientRect(offsetParent);
|
1567 | offsets.x += offsetParent.clientLeft;
|
1568 | offsets.y += offsetParent.clientTop;
|
1569 | }
|
1570 | else if (documentElement) {
|
1571 | offsets.x = getWindowScrollBarX(documentElement);
|
1572 | }
|
1573 | }
|
1574 | return {
|
1575 | x: rect.left + scroll.scrollLeft - offsets.x,
|
1576 | y: rect.top + scroll.scrollTop - offsets.y,
|
1577 | width: rect.width,
|
1578 | height: rect.height
|
1579 | };
|
1580 | }
|
1581 |
|
1582 |
|
1583 |
|
1584 | |
1585 |
|
1586 |
|
1587 | function getLayoutRect(element) {
|
1588 | return {
|
1589 | x: element.offsetLeft,
|
1590 | y: element.offsetTop,
|
1591 | width: element.offsetWidth,
|
1592 | height: element.offsetHeight
|
1593 | };
|
1594 | }
|
1595 |
|
1596 |
|
1597 | |
1598 |
|
1599 |
|
1600 | function getParentNode(element) {
|
1601 | if (getNodeName(element) === 'html') {
|
1602 | return element;
|
1603 | }
|
1604 | return (
|
1605 |
|
1606 | element.assignedSlot ||
|
1607 | element.parentNode ||
|
1608 |
|
1609 | element.host ||
|
1610 |
|
1611 | getDocumentElement(element)
|
1612 | );
|
1613 | }
|
1614 |
|
1615 |
|
1616 | |
1617 |
|
1618 |
|
1619 | function getScrollParent(node) {
|
1620 | if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
|
1621 |
|
1622 | return node.ownerDocument.body;
|
1623 | }
|
1624 | if (isHTMLElement(node) && isScrollParent(node)) {
|
1625 | return node;
|
1626 | }
|
1627 | return getScrollParent(getParentNode(node));
|
1628 | }
|
1629 |
|
1630 |
|
1631 | |
1632 |
|
1633 |
|
1634 |
|
1635 |
|
1636 |
|
1637 | |
1638 |
|
1639 |
|
1640 |
|
1641 | function listScrollParents(element, list = []) {
|
1642 | const scrollParent = getScrollParent(element);
|
1643 | const isBody = getNodeName(scrollParent) === 'body';
|
1644 | const win = getWindow(scrollParent);
|
1645 | const target = isBody
|
1646 | ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : [])
|
1647 | : scrollParent;
|
1648 | const updatedList = list.concat(target);
|
1649 | return isBody
|
1650 | ? updatedList
|
1651 | : updatedList.concat(listScrollParents(getParentNode(target)));
|
1652 | }
|
1653 |
|
1654 |
|
1655 | |
1656 |
|
1657 |
|
1658 | function isTableElement(element) {
|
1659 | return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
|
1660 | }
|
1661 |
|
1662 |
|
1663 | |
1664 |
|
1665 |
|
1666 | function getTrueOffsetParent(element) {
|
1667 | if (!isHTMLElement(element) ||
|
1668 | getComputedStyle$1(element).position === 'fixed') {
|
1669 | return null;
|
1670 | }
|
1671 | const offsetParent = element.offsetParent;
|
1672 | if (offsetParent) {
|
1673 | const html = getDocumentElement(offsetParent);
|
1674 | if (getNodeName(offsetParent) === 'body' &&
|
1675 | getComputedStyle$1(offsetParent).position === 'static' &&
|
1676 | getComputedStyle$1(html).position !== 'static') {
|
1677 | return html;
|
1678 | }
|
1679 | }
|
1680 | return offsetParent;
|
1681 | }
|
1682 |
|
1683 |
|
1684 | |
1685 |
|
1686 |
|
1687 | function getContainingBlock(element) {
|
1688 | let currentNode = getParentNode(element);
|
1689 | while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
|
1690 | const css = getComputedStyle$1(currentNode);
|
1691 |
|
1692 |
|
1693 | if (css.transform !== 'none' || css.perspective !== 'none' || (css.willChange && css.willChange !== 'auto')) {
|
1694 | return currentNode;
|
1695 | }
|
1696 | else {
|
1697 | currentNode = currentNode.parentNode;
|
1698 | }
|
1699 | }
|
1700 | return null;
|
1701 | }
|
1702 |
|
1703 |
|
1704 | |
1705 |
|
1706 |
|
1707 | function getOffsetParent(element) {
|
1708 | const window = getWindow(element);
|
1709 | let offsetParent = getTrueOffsetParent(element);
|
1710 | while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
|
1711 | offsetParent = getTrueOffsetParent(offsetParent);
|
1712 | }
|
1713 | if (offsetParent && getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static') {
|
1714 | return window;
|
1715 | }
|
1716 | return offsetParent || getContainingBlock(element) || window;
|
1717 | }
|
1718 |
|
1719 |
|
1720 | const top = 'top';
|
1721 | const bottom = 'bottom';
|
1722 | const right = 'right';
|
1723 | const left = 'left';
|
1724 | const auto = 'auto';
|
1725 | const basePlacements = [top, bottom, right, left];
|
1726 | const start = 'start';
|
1727 | const end = 'end';
|
1728 | const clippingParents = 'clippingParents';
|
1729 | const viewport = 'viewport';
|
1730 | const popper = 'popper';
|
1731 | const reference = 'reference';
|
1732 | const variationPlacements = basePlacements.reduce((acc, placement) => acc.concat([`${placement}-${start}`, `${placement}-${end}`]), []);
|
1733 | const placements = [...basePlacements, auto].reduce((acc, placement) => acc.concat([placement, `${placement}-${start}`, `${placement}-${end}`]), []);
|
1734 |
|
1735 | const beforeRead = 'beforeRead';
|
1736 | const read = 'read';
|
1737 | const afterRead = 'afterRead';
|
1738 |
|
1739 | const beforeMain = 'beforeMain';
|
1740 | const main = 'main';
|
1741 | const afterMain = 'afterMain';
|
1742 |
|
1743 | const beforeWrite = 'beforeWrite';
|
1744 | const write = 'write';
|
1745 | const afterWrite = 'afterWrite';
|
1746 | const modifierPhases = [
|
1747 | beforeRead,
|
1748 | read,
|
1749 | afterRead,
|
1750 | beforeMain,
|
1751 | main,
|
1752 | afterMain,
|
1753 | beforeWrite,
|
1754 | write,
|
1755 | afterWrite
|
1756 | ];
|
1757 |
|
1758 |
|
1759 | |
1760 |
|
1761 |
|
1762 | function order(modifiers) {
|
1763 | const map = new Map();
|
1764 | const visited = new Set();
|
1765 | const result = [];
|
1766 | modifiers.forEach(modifier => {
|
1767 | map.set(modifier.name, modifier);
|
1768 | });
|
1769 |
|
1770 | |
1771 |
|
1772 |
|
1773 | function sort(modifier) {
|
1774 | visited.add(modifier.name);
|
1775 | const requires = [...(modifier.requires || []), ...(modifier.requiresIfExists || [])];
|
1776 | requires.forEach(dep => {
|
1777 | if (!visited.has(dep)) {
|
1778 | const depModifier = map.get(dep);
|
1779 | if (depModifier) {
|
1780 | sort(depModifier);
|
1781 | }
|
1782 | }
|
1783 | });
|
1784 | result.push(modifier);
|
1785 | }
|
1786 | modifiers.forEach(modifier => {
|
1787 | if (!visited.has(modifier.name)) {
|
1788 |
|
1789 | sort(modifier);
|
1790 | }
|
1791 | });
|
1792 | return result;
|
1793 | }
|
1794 | |
1795 |
|
1796 |
|
1797 | function orderModifiers(modifiers) {
|
1798 |
|
1799 | const orderedModifiers = order(modifiers);
|
1800 |
|
1801 | return modifierPhases.reduce((acc, phase) => acc.concat(orderedModifiers.filter(modifier => modifier.phase === phase)), []);
|
1802 | }
|
1803 |
|
1804 |
|
1805 | |
1806 |
|
1807 |
|
1808 | function debounce(fn) {
|
1809 | let pending;
|
1810 | return () => {
|
1811 | if (!pending) {
|
1812 | pending = new Promise(resolve => {
|
1813 | Promise.resolve().then(() => {
|
1814 | pending = undefined;
|
1815 | resolve(fn());
|
1816 | });
|
1817 | });
|
1818 | }
|
1819 | return pending;
|
1820 | };
|
1821 | }
|
1822 |
|
1823 | |
1824 |
|
1825 |
|
1826 | function getBasePlacement(placement) {
|
1827 | return placement.split('-')[0];
|
1828 | }
|
1829 |
|
1830 | |
1831 |
|
1832 |
|
1833 | function mergeByName(modifiers) {
|
1834 | const merged = modifiers.reduce((merged, current) => {
|
1835 | const existing = merged[current.name];
|
1836 | merged[current.name] = existing
|
1837 | ? Object.assign(Object.assign(Object.assign({}, existing), current), { options: Object.assign(Object.assign({}, existing.options), current.options), data: Object.assign(Object.assign({}, existing.data), current.data) }) : current;
|
1838 | return merged;
|
1839 | }, {});
|
1840 |
|
1841 | return Object.keys(merged).map(key => merged[key]);
|
1842 | }
|
1843 |
|
1844 |
|
1845 | |
1846 |
|
1847 |
|
1848 | function getViewportRect(element) {
|
1849 | const win = getWindow(element);
|
1850 | const html = getDocumentElement(element);
|
1851 | const visualViewport = win.visualViewport;
|
1852 | let width = html.clientWidth;
|
1853 | let height = html.clientHeight;
|
1854 | let x = 0;
|
1855 | let y = 0;
|
1856 |
|
1857 |
|
1858 |
|
1859 |
|
1860 |
|
1861 | if (visualViewport) {
|
1862 | width = visualViewport.width;
|
1863 | height = visualViewport.height;
|
1864 |
|
1865 |
|
1866 |
|
1867 |
|
1868 |
|
1869 |
|
1870 |
|
1871 |
|
1872 | if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
|
1873 | x = visualViewport.offsetLeft;
|
1874 | y = visualViewport.offsetTop;
|
1875 | }
|
1876 | }
|
1877 | return {
|
1878 | width,
|
1879 | height,
|
1880 | x: x + getWindowScrollBarX(element),
|
1881 | y
|
1882 | };
|
1883 | }
|
1884 |
|
1885 |
|
1886 |
|
1887 | |
1888 |
|
1889 |
|
1890 | function getDocumentRect(element) {
|
1891 | const html = getDocumentElement(element);
|
1892 | const winScroll = getWindowScroll(element);
|
1893 | const body = element.ownerDocument.body;
|
1894 | const width = Math.max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
|
1895 | const height = Math.max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
1896 | let x = -winScroll.scrollLeft + getWindowScrollBarX(element);
|
1897 | const y = -winScroll.scrollTop;
|
1898 | if (getComputedStyle$1(body || html).direction === 'rtl') {
|
1899 | x += Math.max(html.clientWidth, body ? body.clientWidth : 0) - width;
|
1900 | }
|
1901 | return { width, height, x, y };
|
1902 | }
|
1903 |
|
1904 |
|
1905 | |
1906 |
|
1907 |
|
1908 |
|
1909 | function contains(parent, child) {
|
1910 |
|
1911 | const isShadow = Boolean(child.getRootNode && child.getRootNode().host);
|
1912 |
|
1913 | if (parent.contains(child)) {
|
1914 | return true;
|
1915 | }
|
1916 | else if (isShadow) {
|
1917 | let next = child;
|
1918 | do {
|
1919 | if (next && parent.isSameNode(next)) {
|
1920 | return true;
|
1921 | }
|
1922 |
|
1923 | next = next.parentNode || next.host;
|
1924 | } while (next);
|
1925 | }
|
1926 |
|
1927 | return false;
|
1928 | }
|
1929 |
|
1930 | |
1931 |
|
1932 |
|
1933 | function rectToClientRect(rect) {
|
1934 | return Object.assign(Object.assign({}, rect), { left: rect.x, top: rect.y, right: rect.x + rect.width, bottom: rect.y + rect.height });
|
1935 | }
|
1936 |
|
1937 | |
1938 |
|
1939 |
|
1940 | function getInnerBoundingClientRect(element) {
|
1941 | const rect = getBoundingClientRect(element);
|
1942 | rect.top = rect.top + element.clientTop;
|
1943 | rect.left = rect.left + element.clientLeft;
|
1944 | rect.bottom = rect.top + element.clientHeight;
|
1945 | rect.right = rect.left + element.clientWidth;
|
1946 | rect.width = element.clientWidth;
|
1947 | rect.height = element.clientHeight;
|
1948 | rect.x = rect.left;
|
1949 | rect.y = rect.top;
|
1950 | return rect;
|
1951 | }
|
1952 | |
1953 |
|
1954 |
|
1955 |
|
1956 | function getClientRectFromMixedType(element, clippingParent) {
|
1957 | return clippingParent === viewport
|
1958 | ? rectToClientRect(getViewportRect(element))
|
1959 | : isHTMLElement(clippingParent)
|
1960 | ? getInnerBoundingClientRect(clippingParent)
|
1961 | : rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
1962 | }
|
1963 |
|
1964 |
|
1965 |
|
1966 | |
1967 |
|
1968 |
|
1969 | function getClippingParents(element) {
|
1970 | const clippingParents = listScrollParents(getParentNode(element));
|
1971 | const canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle$1(element).position) >= 0;
|
1972 | const clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
|
1973 | if (!isElement(clipperElement)) {
|
1974 | return [];
|
1975 | }
|
1976 |
|
1977 | return clippingParents.filter(clippingParent => isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body');
|
1978 | }
|
1979 |
|
1980 |
|
1981 | |
1982 |
|
1983 |
|
1984 |
|
1985 |
|
1986 | function getClippingRect(element, boundary, rootBoundary) {
|
1987 | const mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
|
1988 | const clippingParents = [...mainClippingParents, rootBoundary];
|
1989 | const firstClippingParent = clippingParents[0];
|
1990 | const clippingRect = clippingParents.reduce((accRect, clippingParent) => {
|
1991 | const rect = getClientRectFromMixedType(element, clippingParent);
|
1992 | accRect.top = Math.max(rect.top, accRect.top);
|
1993 | accRect.right = Math.min(rect.right, accRect.right);
|
1994 | accRect.bottom = Math.min(rect.bottom, accRect.bottom);
|
1995 | accRect.left = Math.max(rect.left, accRect.left);
|
1996 | return accRect;
|
1997 | }, getClientRectFromMixedType(element, firstClippingParent));
|
1998 | clippingRect.width = clippingRect.right - clippingRect.left;
|
1999 | clippingRect.height = clippingRect.bottom - clippingRect.top;
|
2000 | clippingRect.x = clippingRect.left;
|
2001 | clippingRect.y = clippingRect.top;
|
2002 | return clippingRect;
|
2003 | }
|
2004 |
|
2005 | |
2006 |
|
2007 |
|
2008 | function getVariation(placement) {
|
2009 | return placement.split('-')[1];
|
2010 | }
|
2011 |
|
2012 | |
2013 |
|
2014 |
|
2015 | function getMainAxisFromPlacement(placement) {
|
2016 | return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
|
2017 | }
|
2018 |
|
2019 |
|
2020 | |
2021 |
|
2022 |
|
2023 | function computeOffsets({ reference, element, placement }) {
|
2024 | const basePlacement = placement ? getBasePlacement(placement) : null;
|
2025 | const variation = placement ? getVariation(placement) : null;
|
2026 | const commonX = reference.x + reference.width / 2 - element.width / 2;
|
2027 | const commonY = reference.y + reference.height / 2 - element.height / 2;
|
2028 | let offsets;
|
2029 | switch (basePlacement) {
|
2030 | case top:
|
2031 | offsets = {
|
2032 | x: commonX,
|
2033 | y: reference.y - element.height
|
2034 | };
|
2035 | break;
|
2036 | case bottom:
|
2037 | offsets = {
|
2038 | x: commonX,
|
2039 | y: reference.y + reference.height
|
2040 | };
|
2041 | break;
|
2042 | case right:
|
2043 | offsets = {
|
2044 | x: reference.x + reference.width,
|
2045 | y: commonY
|
2046 | };
|
2047 | break;
|
2048 | case left:
|
2049 | offsets = {
|
2050 | x: reference.x - element.width,
|
2051 | y: commonY
|
2052 | };
|
2053 | break;
|
2054 | default:
|
2055 | offsets = {
|
2056 | x: reference.x,
|
2057 | y: reference.y
|
2058 | };
|
2059 | }
|
2060 | const mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
|
2061 | if (mainAxis != null) {
|
2062 | const len = mainAxis === 'y' ? 'height' : 'width';
|
2063 | switch (variation) {
|
2064 | case start:
|
2065 | offsets[mainAxis] = Math.floor(offsets[mainAxis]) - Math.floor(reference[len] / 2 - element[len] / 2);
|
2066 | break;
|
2067 | case end:
|
2068 | offsets[mainAxis] = Math.floor(offsets[mainAxis]) + Math.ceil(reference[len] / 2 - element[len] / 2);
|
2069 | break;
|
2070 | }
|
2071 | }
|
2072 | return offsets;
|
2073 | }
|
2074 |
|
2075 | |
2076 |
|
2077 |
|
2078 | function getFreshSideObject() {
|
2079 | return {
|
2080 | top: 0,
|
2081 | right: 0,
|
2082 | bottom: 0,
|
2083 | left: 0
|
2084 | };
|
2085 | }
|
2086 |
|
2087 | |
2088 |
|
2089 |
|
2090 | function mergePaddingObject(paddingObject) {
|
2091 | return Object.assign(Object.assign({}, getFreshSideObject()), paddingObject);
|
2092 | }
|
2093 |
|
2094 |
|
2095 | |
2096 |
|
2097 |
|
2098 |
|
2099 | function expandToHashMap(value, keys) {
|
2100 | return keys.reduce((hashMap, key) => {
|
2101 | hashMap[key] = value;
|
2102 | return hashMap;
|
2103 | }, {});
|
2104 | }
|
2105 |
|
2106 | |
2107 |
|
2108 |
|
2109 |
|
2110 | function detectOverflow(state, options = {}) {
|
2111 | const { placement = state.placement, boundary = clippingParents, rootBoundary = viewport, elementContext = popper, altBoundary = false, padding = 0 } = options;
|
2112 | const paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
|
2113 | const altContext = elementContext === popper ? reference : popper;
|
2114 | const referenceElement = state.elements.reference;
|
2115 | const popperRect = state.rects.popper;
|
2116 | const element = state.elements[altBoundary ? altContext : elementContext];
|
2117 | const clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
|
2118 | const referenceClientRect = getBoundingClientRect(referenceElement);
|
2119 | const popperOffsets = computeOffsets({
|
2120 | reference: referenceClientRect,
|
2121 | element: popperRect,
|
2122 | strategy: 'absolute',
|
2123 | placement
|
2124 | });
|
2125 | const popperClientRect = rectToClientRect(Object.assign(Object.assign({}, popperRect), popperOffsets));
|
2126 | const elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect;
|
2127 |
|
2128 |
|
2129 | const overflowOffsets = {
|
2130 | top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
|
2131 | bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
|
2132 | left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
|
2133 | right: elementClientRect.right - clippingClientRect.right + paddingObject.right
|
2134 | };
|
2135 | const offsetData = state.modifiersData.offset;
|
2136 |
|
2137 | if (elementContext === popper && offsetData) {
|
2138 | const offset = offsetData[placement];
|
2139 | Object.keys(overflowOffsets).forEach(key => {
|
2140 | const multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
|
2141 | const axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
|
2142 | overflowOffsets[key] += offset[axis] * multiply;
|
2143 | });
|
2144 | }
|
2145 | return overflowOffsets;
|
2146 | }
|
2147 |
|
2148 | const DEFAULT_OPTIONS = {
|
2149 | placement: 'bottom',
|
2150 | modifiers: [],
|
2151 | strategy: 'absolute'
|
2152 | };
|
2153 | |
2154 |
|
2155 |
|
2156 | function areValidElements(...args) {
|
2157 | return !args.some(element => !(element && typeof element.getBoundingClientRect === 'function'));
|
2158 | }
|
2159 | |
2160 |
|
2161 |
|
2162 | function popperGenerator(generatorOptions = {}) {
|
2163 | const { defaultModifiers = [], defaultOptions = DEFAULT_OPTIONS } = generatorOptions;
|
2164 | return function createPopper(reference, popper, options = defaultOptions) {
|
2165 | let state = {
|
2166 | placement: 'bottom',
|
2167 | orderedModifiers: [],
|
2168 | options: Object.assign(Object.assign({}, DEFAULT_OPTIONS), defaultOptions),
|
2169 | modifiersData: {},
|
2170 | elements: {
|
2171 | reference,
|
2172 | popper
|
2173 | },
|
2174 | attributes: {},
|
2175 | styles: {}
|
2176 | };
|
2177 | let effectCleanupFns = [];
|
2178 | let isDestroyed = false;
|
2179 | const instance = {
|
2180 | state,
|
2181 | setOptions(options) {
|
2182 | cleanupModifierEffects();
|
2183 | state.options = Object.assign(Object.assign(Object.assign({}, defaultOptions), state.options), options);
|
2184 | state.scrollParents = {
|
2185 | reference: isElement(reference)
|
2186 | ? listScrollParents(reference)
|
2187 | : reference.contextElement
|
2188 | ? listScrollParents(reference.contextElement)
|
2189 | : [],
|
2190 | popper: listScrollParents(popper)
|
2191 | };
|
2192 |
|
2193 |
|
2194 | const orderedModifiers = orderModifiers(mergeByName([...defaultModifiers, ...state.options.modifiers]));
|
2195 |
|
2196 | state.orderedModifiers = orderedModifiers.filter(m => m.enabled);
|
2197 | runModifierEffects();
|
2198 | return instance.update();
|
2199 | },
|
2200 |
|
2201 |
|
2202 |
|
2203 |
|
2204 |
|
2205 | forceUpdate() {
|
2206 | if (isDestroyed) {
|
2207 | return;
|
2208 | }
|
2209 | const { reference, popper } = state.elements;
|
2210 |
|
2211 |
|
2212 | if (!areValidElements(reference, popper)) {
|
2213 | return;
|
2214 | }
|
2215 |
|
2216 | state.rects = {
|
2217 | reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
|
2218 | popper: getLayoutRect(popper)
|
2219 | };
|
2220 |
|
2221 |
|
2222 |
|
2223 |
|
2224 |
|
2225 | state.reset = false;
|
2226 | state.placement = state.options.placement;
|
2227 |
|
2228 |
|
2229 |
|
2230 |
|
2231 | state.orderedModifiers.forEach(modifier => (state.modifiersData[modifier.name] = Object.assign({}, modifier.data)));
|
2232 | for (let index = 0; index < state.orderedModifiers.length; index++) {
|
2233 | if (state.reset === true) {
|
2234 | state.reset = false;
|
2235 | index = -1;
|
2236 | continue;
|
2237 | }
|
2238 | const { fn, options = {}, name } = state.orderedModifiers[index];
|
2239 | if (typeof fn === 'function') {
|
2240 | state = fn({ state, options, name, instance }) || state;
|
2241 | }
|
2242 | }
|
2243 | },
|
2244 |
|
2245 |
|
2246 | update: debounce(() => new Promise(resolve => {
|
2247 | instance.forceUpdate();
|
2248 | resolve(state);
|
2249 | })),
|
2250 | destroy() {
|
2251 | cleanupModifierEffects();
|
2252 | isDestroyed = true;
|
2253 | }
|
2254 | };
|
2255 | if (!areValidElements(reference, popper)) {
|
2256 | return instance;
|
2257 | }
|
2258 | instance.setOptions(options).then(state => {
|
2259 | if (!isDestroyed && options.onFirstUpdate) {
|
2260 | options.onFirstUpdate(state);
|
2261 | }
|
2262 | });
|
2263 |
|
2264 |
|
2265 |
|
2266 |
|
2267 |
|
2268 | |
2269 |
|
2270 |
|
2271 | function runModifierEffects() {
|
2272 | state.orderedModifiers.forEach(({ name, options = {}, effect }) => {
|
2273 | if (typeof effect === 'function') {
|
2274 | const cleanupFn = effect({ state, name, instance, options });
|
2275 | const noopFn = () => { };
|
2276 | effectCleanupFns.push(cleanupFn || noopFn);
|
2277 | }
|
2278 | });
|
2279 | }
|
2280 | |
2281 |
|
2282 |
|
2283 | function cleanupModifierEffects() {
|
2284 | effectCleanupFns.forEach(fn => fn());
|
2285 | effectCleanupFns = [];
|
2286 | }
|
2287 | return instance;
|
2288 | };
|
2289 | }
|
2290 |
|
2291 | const passive = { passive: true };
|
2292 | |
2293 |
|
2294 |
|
2295 | function effect$2({ state, instance, options }) {
|
2296 | const { scroll = true, resize = true } = options;
|
2297 | const window = getWindow(state.elements.popper);
|
2298 | const scrollParents = [...state.scrollParents.reference, ...state.scrollParents.popper];
|
2299 | if (scroll) {
|
2300 | scrollParents.forEach(scrollParent => {
|
2301 | scrollParent.addEventListener('scroll', instance.update, passive);
|
2302 | });
|
2303 | }
|
2304 | if (resize) {
|
2305 | window.addEventListener('resize', instance.update, passive);
|
2306 | }
|
2307 | return () => {
|
2308 | if (scroll) {
|
2309 | scrollParents.forEach(scrollParent => {
|
2310 | scrollParent.removeEventListener('scroll', instance.update, passive);
|
2311 | });
|
2312 | }
|
2313 | if (resize) {
|
2314 | window.removeEventListener('resize', instance.update, passive);
|
2315 | }
|
2316 | };
|
2317 | }
|
2318 | var eventListeners = {
|
2319 | name: 'eventListeners',
|
2320 | enabled: true,
|
2321 | phase: 'write',
|
2322 | fn: () => { },
|
2323 | effect: effect$2,
|
2324 | data: {}
|
2325 | };
|
2326 |
|
2327 | |
2328 |
|
2329 |
|
2330 | function popperOffsets({ state, name }) {
|
2331 |
|
2332 |
|
2333 |
|
2334 |
|
2335 | state.modifiersData[name] = computeOffsets({
|
2336 | reference: state.rects.reference,
|
2337 | element: state.rects.popper,
|
2338 | strategy: 'absolute',
|
2339 | placement: state.placement
|
2340 | });
|
2341 | }
|
2342 | var popperOffsets$1 = {
|
2343 | name: 'popperOffsets',
|
2344 | enabled: true,
|
2345 | phase: 'read',
|
2346 | fn: popperOffsets,
|
2347 | data: {}
|
2348 | };
|
2349 |
|
2350 | const unsetSides = {
|
2351 | top: 'auto',
|
2352 | right: 'auto',
|
2353 | bottom: 'auto',
|
2354 | left: 'auto'
|
2355 | };
|
2356 |
|
2357 |
|
2358 |
|
2359 | |
2360 |
|
2361 |
|
2362 | function roundOffsets({ x, y }) {
|
2363 | const win = window;
|
2364 | const dpr = win.devicePixelRatio || 1;
|
2365 | return {
|
2366 | x: Math.round(x * dpr) / dpr || 0,
|
2367 | y: Math.round(y * dpr) / dpr || 0
|
2368 | };
|
2369 | }
|
2370 | |
2371 |
|
2372 |
|
2373 | function mapToStyles({ popper, popperRect, placement, offsets, position, gpuAcceleration, adaptive }) {
|
2374 | let { x, y } = roundOffsets(offsets);
|
2375 | const hasX = offsets.hasOwnProperty('x');
|
2376 | const hasY = offsets.hasOwnProperty('y');
|
2377 | let sideX = left;
|
2378 | let sideY = top;
|
2379 | const win = window;
|
2380 | if (adaptive) {
|
2381 | let offsetParent = getOffsetParent(popper);
|
2382 | if (offsetParent === getWindow(popper)) {
|
2383 | offsetParent = getDocumentElement(popper);
|
2384 | }
|
2385 |
|
2386 |
|
2387 | if (placement === top) {
|
2388 | sideY = bottom;
|
2389 | y -= offsetParent.clientHeight - popperRect.height;
|
2390 | y *= gpuAcceleration ? 1 : -1;
|
2391 | }
|
2392 | if (placement === left) {
|
2393 | sideX = right;
|
2394 | x -= offsetParent.clientWidth - popperRect.width;
|
2395 | x *= gpuAcceleration ? 1 : -1;
|
2396 | }
|
2397 | }
|
2398 | const commonStyles = Object.assign({ position }, (adaptive && unsetSides));
|
2399 | if (gpuAcceleration) {
|
2400 | return Object.assign(Object.assign({}, commonStyles), { [sideY]: hasY ? '0' : '', [sideX]: hasX ? '0' : '',
|
2401 |
|
2402 |
|
2403 |
|
2404 | transform: (win.devicePixelRatio || 1) < 2 ? `translate(${x}px, ${y}px)` : `translate3d(${x}px, ${y}px, 0)` });
|
2405 | }
|
2406 | return Object.assign(Object.assign({}, commonStyles), { [sideY]: hasY ? `${y}px` : '', [sideX]: hasX ? `${x}px` : '', transform: '' });
|
2407 | }
|
2408 | |
2409 |
|
2410 |
|
2411 | function computeStyles({ state, options }) {
|
2412 | const { gpuAcceleration = true, adaptive = true } = options;
|
2413 | const commonStyles = {
|
2414 | placement: getBasePlacement(state.placement),
|
2415 | popper: state.elements.popper,
|
2416 | popperRect: state.rects.popper,
|
2417 | gpuAcceleration
|
2418 | };
|
2419 | if (state.modifiersData.popperOffsets != null) {
|
2420 | state.styles.popper = Object.assign(Object.assign({}, state.styles.popper), mapToStyles(Object.assign(Object.assign({}, commonStyles), { offsets: state.modifiersData.popperOffsets, position: state.options.strategy, adaptive })));
|
2421 | }
|
2422 | if (state.modifiersData.arrow != null) {
|
2423 | state.styles.arrow = Object.assign(Object.assign({}, state.styles.arrow), mapToStyles(Object.assign(Object.assign({}, commonStyles), { offsets: state.modifiersData.arrow, position: 'absolute', adaptive: false })));
|
2424 | }
|
2425 | state.attributes.popper = Object.assign(Object.assign({}, state.attributes.popper), { 'data-popper-placement': state.placement });
|
2426 | }
|
2427 | var computeStyles$1 = {
|
2428 | name: 'computeStyles',
|
2429 | enabled: true,
|
2430 | phase: 'beforeWrite',
|
2431 | fn: computeStyles,
|
2432 | data: {}
|
2433 | };
|
2434 |
|
2435 |
|
2436 |
|
2437 | |
2438 |
|
2439 |
|
2440 | function applyStyles({ state }) {
|
2441 | Object.keys(state.elements).forEach(name => {
|
2442 | const style = state.styles[name] || {};
|
2443 | const attributes = state.attributes[name] || {};
|
2444 | const element = state.elements[name];
|
2445 |
|
2446 | if (!isHTMLElement(element) || !getNodeName(element)) {
|
2447 | return;
|
2448 | }
|
2449 |
|
2450 |
|
2451 |
|
2452 | Object.assign(element.style, style);
|
2453 | Object.keys(attributes).forEach(name => {
|
2454 | const value = attributes[name];
|
2455 | if (value === false) {
|
2456 | element.removeAttribute(name);
|
2457 | }
|
2458 | else {
|
2459 | element.setAttribute(name, value === true ? '' : value);
|
2460 | }
|
2461 | });
|
2462 | });
|
2463 | }
|
2464 | |
2465 |
|
2466 |
|
2467 | function effect$1({ state }) {
|
2468 | const initialStyles = {
|
2469 | popper: {
|
2470 | position: state.options.strategy,
|
2471 | left: '0',
|
2472 | top: '0',
|
2473 | margin: '0'
|
2474 | },
|
2475 | arrow: {
|
2476 | position: 'absolute'
|
2477 | },
|
2478 | reference: {}
|
2479 | };
|
2480 | Object.assign(state.elements.popper.style, initialStyles.popper);
|
2481 | if (state.elements.arrow) {
|
2482 | Object.assign(state.elements.arrow.style, initialStyles.arrow);
|
2483 | }
|
2484 | return () => {
|
2485 | Object.keys(state.elements).forEach(name => {
|
2486 | const element = state.elements[name];
|
2487 | const attributes = state.attributes[name] || {};
|
2488 | const styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
|
2489 |
|
2490 | const style = styleProperties.reduce((style, property) => {
|
2491 | style[property] = '';
|
2492 | return style;
|
2493 | }, {});
|
2494 |
|
2495 | if (!isHTMLElement(element) || !getNodeName(element)) {
|
2496 | return;
|
2497 | }
|
2498 |
|
2499 |
|
2500 |
|
2501 | Object.assign(element.style, style);
|
2502 | Object.keys(attributes).forEach(attribute => {
|
2503 | element.removeAttribute(attribute);
|
2504 | });
|
2505 | });
|
2506 | };
|
2507 | }
|
2508 | var applyStyles$1 = {
|
2509 | name: 'applyStyles',
|
2510 | enabled: true,
|
2511 | phase: 'write',
|
2512 | fn: applyStyles,
|
2513 | effect: effect$1,
|
2514 | requires: ['computeStyles']
|
2515 | };
|
2516 |
|
2517 | |
2518 |
|
2519 |
|
2520 |
|
2521 |
|
2522 | function distanceAndSkiddingToXY(placement, rects, offset) {
|
2523 | const basePlacement = getBasePlacement(placement);
|
2524 | const invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
|
2525 | let [skidding, distance] = typeof offset === 'function'
|
2526 | ? offset(Object.assign(Object.assign({}, rects), { placement }))
|
2527 | : offset;
|
2528 | skidding = skidding || 0;
|
2529 | distance = (distance || 0) * invertDistance;
|
2530 | return [left, right].indexOf(basePlacement) >= 0 ? { x: distance, y: skidding } : { x: skidding, y: distance };
|
2531 | }
|
2532 | |
2533 |
|
2534 |
|
2535 | function offset({ state, options, name }) {
|
2536 | const { offset = [0, 0] } = options;
|
2537 | const data = placements.reduce((acc, placement) => {
|
2538 | acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
|
2539 | return acc;
|
2540 | }, {});
|
2541 | const { x, y } = data[state.placement];
|
2542 | if (state.modifiersData.popperOffsets != null) {
|
2543 | state.modifiersData.popperOffsets.x += x;
|
2544 | state.modifiersData.popperOffsets.y += y;
|
2545 | }
|
2546 | state.modifiersData[name] = data;
|
2547 | }
|
2548 | var offset$1 = {
|
2549 | name: 'offset',
|
2550 | enabled: true,
|
2551 | phase: 'main',
|
2552 | requires: ['popperOffsets'],
|
2553 | fn: offset
|
2554 | };
|
2555 |
|
2556 | const hash$2 = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
|
2557 | |
2558 |
|
2559 |
|
2560 | function getOppositePlacement$1(placement) {
|
2561 | return placement.replace(/left|right|bottom|top/g, matched => hash$2[matched]);
|
2562 | }
|
2563 |
|
2564 | const hash$1 = { start: 'end', end: 'start' };
|
2565 | |
2566 |
|
2567 |
|
2568 | function getOppositeVariationPlacement(placement) {
|
2569 | return placement.replace(/start|end/g, matched => hash$1[matched]);
|
2570 | }
|
2571 |
|
2572 |
|
2573 |
|
2574 | |
2575 |
|
2576 |
|
2577 |
|
2578 | function computeAutoPlacement(state, options = {}) {
|
2579 | const { placement, boundary, rootBoundary, padding, flipVariations, allowedAutoPlacements = placements } = options;
|
2580 | const variation = getVariation(placement);
|
2581 | const placements$1 = variation
|
2582 | ? flipVariations
|
2583 | ? variationPlacements
|
2584 | : variationPlacements.filter(placement => getVariation(placement) === variation)
|
2585 | : basePlacements;
|
2586 |
|
2587 | let allowedPlacements = placements$1.filter(placement => allowedAutoPlacements.indexOf(placement) >= 0);
|
2588 | if (allowedPlacements.length === 0) {
|
2589 | allowedPlacements = placements$1;
|
2590 | }
|
2591 |
|
2592 | const overflows = allowedPlacements.reduce((acc, placement) => {
|
2593 | acc[placement] = detectOverflow(state, {
|
2594 | placement,
|
2595 | boundary,
|
2596 | rootBoundary,
|
2597 | padding
|
2598 | })[getBasePlacement(placement)];
|
2599 | return acc;
|
2600 | }, {});
|
2601 | return Object.keys(overflows).sort((a, b) => overflows[a] - overflows[b]);
|
2602 | }
|
2603 |
|
2604 | |
2605 |
|
2606 |
|
2607 | function getExpandedFallbackPlacements(placement) {
|
2608 | if (getBasePlacement(placement) === auto) {
|
2609 | return [];
|
2610 | }
|
2611 | const oppositePlacement = getOppositePlacement$1(placement);
|
2612 | return [
|
2613 | getOppositeVariationPlacement(placement),
|
2614 | oppositePlacement,
|
2615 | getOppositeVariationPlacement(oppositePlacement)
|
2616 | ];
|
2617 | }
|
2618 | |
2619 |
|
2620 |
|
2621 | function flip({ state, options, name }) {
|
2622 | if (state.modifiersData[name]._skip) {
|
2623 | return;
|
2624 | }
|
2625 | const { mainAxis: checkMainAxis = true, altAxis: checkAltAxis = true, fallbackPlacements: specifiedFallbackPlacements, padding, boundary, rootBoundary, altBoundary, flipVariations = true, allowedAutoPlacements } = options;
|
2626 | const preferredPlacement = state.options.placement;
|
2627 | const basePlacement = getBasePlacement(preferredPlacement);
|
2628 | const isBasePlacement = basePlacement === preferredPlacement;
|
2629 | const fallbackPlacements = specifiedFallbackPlacements ||
|
2630 | (isBasePlacement || !flipVariations
|
2631 | ? [getOppositePlacement$1(preferredPlacement)]
|
2632 | : getExpandedFallbackPlacements(preferredPlacement));
|
2633 | const placements = [preferredPlacement, ...fallbackPlacements].reduce((acc, placement) => acc.concat(getBasePlacement(placement) === auto
|
2634 | ? computeAutoPlacement(state, {
|
2635 | placement,
|
2636 | boundary,
|
2637 | rootBoundary,
|
2638 | padding,
|
2639 | flipVariations,
|
2640 | allowedAutoPlacements
|
2641 | })
|
2642 | : placement), []);
|
2643 | const referenceRect = state.rects.reference;
|
2644 | const popperRect = state.rects.popper;
|
2645 | const checksMap = new Map();
|
2646 | let makeFallbackChecks = true;
|
2647 | let firstFittingPlacement = placements[0];
|
2648 | for (let i = 0; i < placements.length; i++) {
|
2649 | const placement = placements[i];
|
2650 | const basePlacement = getBasePlacement(placement);
|
2651 | const isStartVariation = getVariation(placement) === start;
|
2652 | const isVertical = [top, bottom].indexOf(basePlacement) >= 0;
|
2653 | const len = isVertical ? 'width' : 'height';
|
2654 | const overflow = detectOverflow(state, {
|
2655 | placement,
|
2656 | boundary,
|
2657 | rootBoundary,
|
2658 | altBoundary,
|
2659 | padding
|
2660 | });
|
2661 | let mainVariationSide = isVertical ? (isStartVariation ? right : left) : isStartVariation ? bottom : top;
|
2662 | if (referenceRect[len] > popperRect[len]) {
|
2663 | mainVariationSide = getOppositePlacement$1(mainVariationSide);
|
2664 | }
|
2665 | const altVariationSide = getOppositePlacement$1(mainVariationSide);
|
2666 | const checks = [];
|
2667 | if (checkMainAxis) {
|
2668 | checks.push(overflow[basePlacement] <= 0);
|
2669 | }
|
2670 | if (checkAltAxis) {
|
2671 | checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
|
2672 | }
|
2673 | if (checks.every(check => check)) {
|
2674 | firstFittingPlacement = placement;
|
2675 | makeFallbackChecks = false;
|
2676 | break;
|
2677 | }
|
2678 | checksMap.set(placement, checks);
|
2679 | }
|
2680 | if (makeFallbackChecks) {
|
2681 |
|
2682 | const numberOfChecks = flipVariations ? 3 : 1;
|
2683 | for (let i = numberOfChecks; i > 0; i--) {
|
2684 | const fittingPlacement = placements.find(placement => {
|
2685 | const checks = checksMap.get(placement);
|
2686 | if (checks) {
|
2687 | return checks.slice(0, i).every(check => check);
|
2688 | }
|
2689 | });
|
2690 | if (fittingPlacement) {
|
2691 | firstFittingPlacement = fittingPlacement;
|
2692 | break;
|
2693 | }
|
2694 | }
|
2695 | }
|
2696 | if (state.placement !== firstFittingPlacement) {
|
2697 | state.modifiersData[name]._skip = true;
|
2698 | state.placement = firstFittingPlacement;
|
2699 | state.reset = true;
|
2700 | }
|
2701 | }
|
2702 | var flip$1 = {
|
2703 | name: 'flip',
|
2704 | enabled: true,
|
2705 | phase: 'main',
|
2706 | fn: flip,
|
2707 | requiresIfExists: ['offset'],
|
2708 | data: { _skip: false }
|
2709 | };
|
2710 |
|
2711 |
|
2712 | |
2713 |
|
2714 |
|
2715 | function getAltAxis(axis) {
|
2716 | return axis === 'x' ? 'y' : 'x';
|
2717 | }
|
2718 |
|
2719 |
|
2720 | |
2721 |
|
2722 |
|
2723 |
|
2724 |
|
2725 | function within(min, value, max) {
|
2726 | return Math.max(min, Math.min(value, max));
|
2727 | }
|
2728 |
|
2729 |
|
2730 | |
2731 |
|
2732 |
|
2733 | function preventOverflow({ state, options, name }) {
|
2734 | const { mainAxis: checkMainAxis = true, altAxis: checkAltAxis = false, boundary, rootBoundary, altBoundary, padding, tether = true, tetherOffset = 0 } = options;
|
2735 | const overflow = detectOverflow(state, {
|
2736 | boundary,
|
2737 | rootBoundary,
|
2738 | padding,
|
2739 | altBoundary
|
2740 | });
|
2741 | const basePlacement = getBasePlacement(state.placement);
|
2742 | const variation = getVariation(state.placement);
|
2743 | const isBasePlacement = !variation;
|
2744 | const mainAxis = getMainAxisFromPlacement(basePlacement);
|
2745 | const altAxis = getAltAxis(mainAxis);
|
2746 | const popperOffsets = state.modifiersData.popperOffsets;
|
2747 | const referenceRect = state.rects.reference;
|
2748 | const popperRect = state.rects.popper;
|
2749 | const tetherOffsetValue = typeof tetherOffset === 'function'
|
2750 | ? tetherOffset(Object.assign(Object.assign({}, state.rects), { placement: state.placement }))
|
2751 | : tetherOffset;
|
2752 | const data = { x: 0, y: 0 };
|
2753 | if (!popperOffsets) {
|
2754 | return;
|
2755 | }
|
2756 | if (checkMainAxis) {
|
2757 | const mainSide = mainAxis === 'y' ? top : left;
|
2758 | const altSide = mainAxis === 'y' ? bottom : right;
|
2759 | const len = mainAxis === 'y' ? 'height' : 'width';
|
2760 | const offset = popperOffsets[mainAxis];
|
2761 | const min = popperOffsets[mainAxis] + overflow[mainSide];
|
2762 | const max = popperOffsets[mainAxis] - overflow[altSide];
|
2763 | const additive = tether ? -popperRect[len] / 2 : 0;
|
2764 | const minLen = variation === start ? referenceRect[len] : popperRect[len];
|
2765 | const maxLen = variation === start ? -popperRect[len] : -referenceRect[len];
|
2766 |
|
2767 |
|
2768 | const arrowElement = state.elements.arrow;
|
2769 | const arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : { width: 0, height: 0 };
|
2770 | const arrowPaddingObject = state.modifiersData['arrow#persistent']
|
2771 | ? state.modifiersData['arrow#persistent'].padding
|
2772 | : getFreshSideObject();
|
2773 | const arrowPaddingMin = arrowPaddingObject[mainSide];
|
2774 | const arrowPaddingMax = arrowPaddingObject[altSide];
|
2775 |
|
2776 |
|
2777 |
|
2778 |
|
2779 |
|
2780 | const arrowLen = within(0, referenceRect[len], arrowRect[len]);
|
2781 | const minOffset = isBasePlacement
|
2782 | ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - tetherOffsetValue
|
2783 | : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue;
|
2784 | const maxOffset = isBasePlacement
|
2785 | ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + tetherOffsetValue
|
2786 | : maxLen + arrowLen + arrowPaddingMax + tetherOffsetValue;
|
2787 | const arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
|
2788 | const clientOffset = arrowOffsetParent
|
2789 | ? mainAxis === 'y'
|
2790 | ? arrowOffsetParent.clientTop || 0
|
2791 | : arrowOffsetParent.clientLeft || 0
|
2792 | : 0;
|
2793 | const offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 0;
|
2794 | const tetherMin = popperOffsets[mainAxis] + minOffset - offsetModifierValue - clientOffset;
|
2795 | const tetherMax = popperOffsets[mainAxis] + maxOffset - offsetModifierValue;
|
2796 | const preventedOffset = within(tether ? Math.min(min, tetherMin) : min, offset, tether ? Math.max(max, tetherMax) : max);
|
2797 | popperOffsets[mainAxis] = preventedOffset;
|
2798 | data[mainAxis] = preventedOffset - offset;
|
2799 | }
|
2800 | if (checkAltAxis) {
|
2801 | const mainSide = mainAxis === 'x' ? top : left;
|
2802 | const altSide = mainAxis === 'x' ? bottom : right;
|
2803 | const offset = popperOffsets[altAxis];
|
2804 | const min = offset + overflow[mainSide];
|
2805 | const max = offset - overflow[altSide];
|
2806 | const preventedOffset = within(min, offset, max);
|
2807 | popperOffsets[altAxis] = preventedOffset;
|
2808 | data[altAxis] = preventedOffset - offset;
|
2809 | }
|
2810 | state.modifiersData[name] = data;
|
2811 | }
|
2812 | var preventOverflow$1 = {
|
2813 | name: 'preventOverflow',
|
2814 | enabled: true,
|
2815 | phase: 'main',
|
2816 | fn: preventOverflow,
|
2817 | requiresIfExists: ['offset']
|
2818 | };
|
2819 |
|
2820 | |
2821 |
|
2822 |
|
2823 | function arrow({ state, name }) {
|
2824 | const arrowElement = state.elements.arrow;
|
2825 | const popperOffsets = state.modifiersData.popperOffsets;
|
2826 | const basePlacement = getBasePlacement(state.placement);
|
2827 | const axis = getMainAxisFromPlacement(basePlacement);
|
2828 | const isVertical = [left, right].indexOf(basePlacement) >= 0;
|
2829 | const len = isVertical ? 'height' : 'width';
|
2830 | if (!arrowElement || !popperOffsets) {
|
2831 | return;
|
2832 | }
|
2833 | const paddingObject = state.modifiersData[`${name}#persistent`].padding;
|
2834 | const arrowRect = getLayoutRect(arrowElement);
|
2835 | const minProp = axis === 'y' ? top : left;
|
2836 | const maxProp = axis === 'y' ? bottom : right;
|
2837 | const endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
|
2838 | const startDiff = popperOffsets[axis] - state.rects.reference[axis];
|
2839 | const arrowOffsetParent = getOffsetParent(arrowElement);
|
2840 | const clientSize = arrowOffsetParent
|
2841 | ? axis === 'y'
|
2842 | ? arrowOffsetParent.clientHeight || 0
|
2843 | : arrowOffsetParent.clientWidth || 0
|
2844 | : 0;
|
2845 | const centerToReference = endDiff / 2 - startDiff / 2;
|
2846 |
|
2847 |
|
2848 | const min = paddingObject[minProp];
|
2849 | const max = clientSize - arrowRect[len] - paddingObject[maxProp];
|
2850 | const center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
|
2851 | const offset = within(min, center, max);
|
2852 |
|
2853 | const axisProp = axis;
|
2854 | state.modifiersData[name] = {
|
2855 | [axisProp]: offset,
|
2856 | centerOffset: offset - center
|
2857 | };
|
2858 | }
|
2859 | |
2860 |
|
2861 |
|
2862 | function effect({ state, options, name }) {
|
2863 | let { element: arrowElement = '[data-popper-arrow]', padding = 0 } = options;
|
2864 | if (arrowElement == null) {
|
2865 | return;
|
2866 | }
|
2867 |
|
2868 | if (typeof arrowElement === 'string') {
|
2869 | arrowElement = state.elements.popper.querySelector(arrowElement);
|
2870 | if (!arrowElement) {
|
2871 | return;
|
2872 | }
|
2873 | }
|
2874 | if (!contains(state.elements.popper, arrowElement)) {
|
2875 | return;
|
2876 | }
|
2877 | state.elements.arrow = arrowElement;
|
2878 | state.modifiersData[`${name}#persistent`] = {
|
2879 | padding: mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements))
|
2880 | };
|
2881 | }
|
2882 | var arrow$1 = {
|
2883 | name: 'arrow',
|
2884 | enabled: true,
|
2885 | phase: 'main',
|
2886 | fn: arrow,
|
2887 | effect,
|
2888 | requires: ['popperOffsets'],
|
2889 | requiresIfExists: ['preventOverflow']
|
2890 | };
|
2891 |
|
2892 | |
2893 |
|
2894 |
|
2895 |
|
2896 |
|
2897 | function getSideOffsets(overflow, rect, preventedOffsets = { x: 0, y: 0 }) {
|
2898 | return {
|
2899 | top: overflow.top - rect.height - preventedOffsets.y,
|
2900 | right: overflow.right - rect.width + preventedOffsets.x,
|
2901 | bottom: overflow.bottom - rect.height + preventedOffsets.y,
|
2902 | left: overflow.left - rect.width - preventedOffsets.x
|
2903 | };
|
2904 | }
|
2905 | |
2906 |
|
2907 |
|
2908 | function isAnySideFullyClipped(overflow) {
|
2909 | return [top, right, bottom, left].some(side => overflow[side] >= 0);
|
2910 | }
|
2911 | |
2912 |
|
2913 |
|
2914 | function hide({ state, name }) {
|
2915 | const referenceRect = state.rects.reference;
|
2916 | const popperRect = state.rects.popper;
|
2917 | const preventedOffsets = state.modifiersData.preventOverflow;
|
2918 | const referenceOverflow = detectOverflow(state, {
|
2919 | elementContext: 'reference'
|
2920 | });
|
2921 | const popperAltOverflow = detectOverflow(state, {
|
2922 | altBoundary: true
|
2923 | });
|
2924 | const referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
|
2925 | const popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
|
2926 | const isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
|
2927 | const hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
|
2928 | state.modifiersData[name] = {
|
2929 | referenceClippingOffsets,
|
2930 | popperEscapeOffsets,
|
2931 | isReferenceHidden,
|
2932 | hasPopperEscaped
|
2933 | };
|
2934 | state.attributes.popper = Object.assign(Object.assign({}, state.attributes.popper), { 'data-popper-reference-hidden': isReferenceHidden, 'data-popper-escaped': hasPopperEscaped });
|
2935 | }
|
2936 | var hide$1 = {
|
2937 | name: 'hide',
|
2938 | enabled: true,
|
2939 | phase: 'main',
|
2940 | requiresIfExists: ['preventOverflow'],
|
2941 | fn: hide
|
2942 | };
|
2943 |
|
2944 |
|
2945 | const defaultModifiers = [
|
2946 | eventListeners,
|
2947 | popperOffsets$1,
|
2948 | computeStyles$1,
|
2949 | applyStyles$1,
|
2950 | offset$1,
|
2951 | flip$1,
|
2952 | preventOverflow$1,
|
2953 | arrow$1,
|
2954 | hide$1
|
2955 | ];
|
2956 | const createPopper = popperGenerator({ defaultModifiers });
|
2957 |
|
2958 | |
2959 |
|
2960 |
|
2961 | const useIsomorphicLayoutEffect = canUseDOM ? React__namespace.useLayoutEffect : React__namespace.useEffect;
|
2962 |
|
2963 |
|
2964 | const isEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
2965 | |
2966 |
|
2967 |
|
2968 | const fromEntries = (entries) => entries.reduce((acc, [key, value]) => {
|
2969 | acc[key] = value;
|
2970 | return acc;
|
2971 | }, {});
|
2972 | const EMPTY_MODIFIERS = [];
|
2973 | const usePopper = (referenceElement, popperElement, options = {}) => {
|
2974 | const prevOptions = React__namespace.useRef(null);
|
2975 | const optionsWithDefaults = {
|
2976 | onFirstUpdate: options.onFirstUpdate,
|
2977 | placement: options.placement || 'bottom',
|
2978 | strategy: options.strategy || 'absolute',
|
2979 | modifiers: options.modifiers || EMPTY_MODIFIERS
|
2980 | };
|
2981 | const [state, setState] = React__namespace.useState({
|
2982 | styles: {
|
2983 | popper: {
|
2984 | position: optionsWithDefaults.strategy,
|
2985 | left: '0',
|
2986 | top: '0'
|
2987 | }
|
2988 | },
|
2989 | attributes: {}
|
2990 | });
|
2991 | const updateStateModifier = React__namespace.useMemo(() => ({
|
2992 | name: 'updateState',
|
2993 | enabled: true,
|
2994 | phase: 'write',
|
2995 |
|
2996 | fn: ({ state }) => {
|
2997 | const elements = Object.keys(state.elements);
|
2998 | setState({
|
2999 | styles: fromEntries(elements.map(element => [element, state.styles[element] || {}])),
|
3000 | attributes: fromEntries(elements.map(element => [element, state.attributes[element]]))
|
3001 | });
|
3002 | },
|
3003 | requires: ['computeStyles']
|
3004 | }), []);
|
3005 | const popperOptions = React__namespace.useMemo(() => {
|
3006 | const newOptions = {
|
3007 | onFirstUpdate: optionsWithDefaults.onFirstUpdate,
|
3008 | placement: optionsWithDefaults.placement,
|
3009 | strategy: optionsWithDefaults.strategy,
|
3010 | modifiers: [...optionsWithDefaults.modifiers, updateStateModifier, { name: 'applyStyles', enabled: false }]
|
3011 | };
|
3012 | if (isEqual(prevOptions.current, newOptions)) {
|
3013 | return prevOptions.current || newOptions;
|
3014 | }
|
3015 | else {
|
3016 | prevOptions.current = newOptions;
|
3017 | return newOptions;
|
3018 | }
|
3019 | }, [
|
3020 | optionsWithDefaults.onFirstUpdate,
|
3021 | optionsWithDefaults.placement,
|
3022 | optionsWithDefaults.strategy,
|
3023 | optionsWithDefaults.modifiers,
|
3024 | updateStateModifier
|
3025 | ]);
|
3026 | const popperInstanceRef = React__namespace.useRef();
|
3027 | useIsomorphicLayoutEffect(() => {
|
3028 | if (popperInstanceRef && popperInstanceRef.current) {
|
3029 | popperInstanceRef.current.setOptions(popperOptions);
|
3030 | }
|
3031 | }, [popperOptions]);
|
3032 | useIsomorphicLayoutEffect(() => {
|
3033 | if (referenceElement == null || popperElement == null) {
|
3034 | return;
|
3035 | }
|
3036 | const createPopper$1 = options.createPopper || createPopper;
|
3037 | const popperInstance = createPopper$1(referenceElement, popperElement, popperOptions);
|
3038 | popperInstanceRef.current = popperInstance;
|
3039 | return () => {
|
3040 | popperInstance.destroy();
|
3041 | popperInstanceRef.current = null;
|
3042 | };
|
3043 | }, [referenceElement, popperElement, options.createPopper]);
|
3044 | return {
|
3045 | state: popperInstanceRef.current ? popperInstanceRef.current.state : null,
|
3046 | styles: state.styles,
|
3047 | attributes: state.attributes,
|
3048 | update: popperInstanceRef.current ? popperInstanceRef.current.update : null,
|
3049 | forceUpdate: popperInstanceRef.current ? popperInstanceRef.current.forceUpdate : null
|
3050 | };
|
3051 | };
|
3052 |
|
3053 | const hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
|
3054 | const getOppositePlacement = (placement) => placement.replace(/left|right|bottom|top/g, (matched) => hash[matched]);
|
3055 | const getOpacityTransition = (animationDuration) => `opacity ${animationDuration}ms cubic-bezier(.54, 1.5, .38, 1.11)`;
|
3056 | const Popper = ({ trigger, popper, popperMatchesTriggerWidth = true, direction = 'down', position = 'left', placement, appendTo = () => document.body, zIndex = 9999, isVisible = true, positionModifiers, distance = 0, onMouseEnter, onMouseLeave, onFocus, onBlur, onDocumentClick, onTriggerClick, onTriggerEnter, onPopperClick, onDocumentKeyDown, enableFlip = true, flipBehavior = 'flip', reference }) => {
|
3057 | const [triggerElement, setTriggerElement] = React__namespace.useState(null);
|
3058 | const [refElement, setRefElement] = React__namespace.useState(null);
|
3059 | const [popperElement, setPopperElement] = React__namespace.useState(null);
|
3060 | const [ready, setReady] = React__namespace.useState(false);
|
3061 | const refOrTrigger = refElement || triggerElement;
|
3062 | const onDocumentClickCallback = React__namespace.useCallback((event) => onDocumentClick(event, refOrTrigger, popperElement), [isVisible, triggerElement, refElement, popperElement, onDocumentClick]);
|
3063 | React__namespace.useEffect(() => {
|
3064 | setReady(true);
|
3065 | }, []);
|
3066 | React__namespace.useEffect(() => {
|
3067 | if (reference) {
|
3068 | if (reference.current) {
|
3069 | setRefElement(reference.current);
|
3070 | }
|
3071 | else if (typeof reference === 'function') {
|
3072 | setRefElement(reference());
|
3073 | }
|
3074 | }
|
3075 | }, [reference]);
|
3076 | const addEventListener = (listener, element, event) => {
|
3077 | if (listener && element) {
|
3078 | element.addEventListener(event, listener);
|
3079 | }
|
3080 | };
|
3081 | const removeEventListener = (listener, element, event) => {
|
3082 | if (listener && element) {
|
3083 | element.removeEventListener(event, listener);
|
3084 | }
|
3085 | };
|
3086 | React__namespace.useEffect(() => {
|
3087 | addEventListener(onMouseEnter, refOrTrigger, 'mouseenter');
|
3088 | addEventListener(onMouseLeave, refOrTrigger, 'mouseleave');
|
3089 | addEventListener(onFocus, refOrTrigger, 'focus');
|
3090 | addEventListener(onBlur, refOrTrigger, 'blur');
|
3091 | addEventListener(onTriggerClick, refOrTrigger, 'click');
|
3092 | addEventListener(onTriggerEnter, refOrTrigger, 'keydown');
|
3093 | addEventListener(onPopperClick, popperElement, 'click');
|
3094 | onDocumentClick && addEventListener(onDocumentClickCallback, document, 'click');
|
3095 | addEventListener(onDocumentKeyDown, document, 'keydown');
|
3096 |
|
3097 | const observer = new MutationObserver(() => {
|
3098 | update && update();
|
3099 | });
|
3100 | popperElement && observer.observe(popperElement, { attributes: true, childList: true, subtree: true });
|
3101 | return () => {
|
3102 | removeEventListener(onMouseEnter, refOrTrigger, 'mouseenter');
|
3103 | removeEventListener(onMouseLeave, refOrTrigger, 'mouseleave');
|
3104 | removeEventListener(onFocus, refOrTrigger, 'focus');
|
3105 | removeEventListener(onBlur, refOrTrigger, 'blur');
|
3106 | removeEventListener(onTriggerClick, refOrTrigger, 'click');
|
3107 | removeEventListener(onTriggerEnter, refOrTrigger, 'keydown');
|
3108 | removeEventListener(onPopperClick, popperElement, 'click');
|
3109 | onDocumentClick && removeEventListener(onDocumentClickCallback, document, 'click');
|
3110 | removeEventListener(onDocumentKeyDown, document, 'keydown');
|
3111 | observer.disconnect();
|
3112 | };
|
3113 | }, [
|
3114 | triggerElement,
|
3115 | popperElement,
|
3116 | onMouseEnter,
|
3117 | onMouseLeave,
|
3118 | onFocus,
|
3119 | onBlur,
|
3120 | onTriggerClick,
|
3121 | onTriggerEnter,
|
3122 | onPopperClick,
|
3123 | onDocumentClick,
|
3124 | onDocumentKeyDown,
|
3125 | refElement
|
3126 | ]);
|
3127 | const getPlacement = () => {
|
3128 | if (placement) {
|
3129 | return placement;
|
3130 | }
|
3131 | let convertedPlacement = direction === 'up' ? 'top' : 'bottom';
|
3132 | if (position !== 'center') {
|
3133 | convertedPlacement = `${convertedPlacement}-${position === 'right' ? 'end' : 'start'}`;
|
3134 | }
|
3135 | return convertedPlacement;
|
3136 | };
|
3137 | const getPlacementMemo = React__namespace.useMemo(getPlacement, [direction, position, placement]);
|
3138 | const getOppositePlacementMemo = React__namespace.useMemo(() => getOppositePlacement(getPlacement()), [
|
3139 | direction,
|
3140 | position,
|
3141 | placement
|
3142 | ]);
|
3143 | const sameWidthMod = React__namespace.useMemo(() => ({
|
3144 | name: 'sameWidth',
|
3145 | enabled: popperMatchesTriggerWidth,
|
3146 | phase: 'beforeWrite',
|
3147 | requires: ['computeStyles'],
|
3148 | fn: ({ state }) => {
|
3149 | state.styles.popper.width = `${state.rects.reference.width}px`;
|
3150 | },
|
3151 | effect: ({ state }) => {
|
3152 | state.elements.popper.style.width = `${state.elements.reference.offsetWidth}px`;
|
3153 | return () => { };
|
3154 | }
|
3155 | }), [popperMatchesTriggerWidth]);
|
3156 | const { styles: popperStyles, attributes, update } = usePopper(refOrTrigger, popperElement, {
|
3157 | placement: getPlacementMemo,
|
3158 | modifiers: [
|
3159 | {
|
3160 | name: 'offset',
|
3161 | options: {
|
3162 | offset: [0, distance]
|
3163 | }
|
3164 | },
|
3165 | {
|
3166 | name: 'preventOverflow',
|
3167 | enabled: false
|
3168 | },
|
3169 | {
|
3170 |
|
3171 | name: 'hide',
|
3172 | enabled: true
|
3173 | },
|
3174 | {
|
3175 | name: 'flip',
|
3176 | enabled: getPlacementMemo.startsWith('auto') || enableFlip,
|
3177 | options: {
|
3178 | fallbackPlacements: flipBehavior === 'flip' ? [getOppositePlacementMemo] : flipBehavior
|
3179 | }
|
3180 | },
|
3181 | sameWidthMod
|
3182 | ]
|
3183 | });
|
3184 |
|
3185 |
|
3186 | const modifierFromPopperPosition = () => {
|
3187 | if (attributes && attributes.popper && attributes.popper['data-popper-placement']) {
|
3188 | const popperPlacement = attributes.popper['data-popper-placement'];
|
3189 | return positionModifiers[popperPlacement];
|
3190 | }
|
3191 | return positionModifiers.top;
|
3192 | };
|
3193 | const menuWithPopper = React__namespace.cloneElement(popper, Object.assign({ className: css(popper.props && popper.props.className, positionModifiers && modifierFromPopperPosition()), style: Object.assign(Object.assign(Object.assign({}, ((popper.props && popper.props.style) || {})), popperStyles.popper), { zIndex }) }, attributes.popper));
|
3194 | const getTarget = () => {
|
3195 | if (typeof appendTo === 'function') {
|
3196 | return appendTo();
|
3197 | }
|
3198 | return appendTo;
|
3199 | };
|
3200 | return (React__namespace.createElement(React__namespace.Fragment, null,
|
3201 | !reference && trigger && (React__namespace.createElement(FindRefWrapper, { onFoundRef: (foundRef) => setTriggerElement(foundRef) }, trigger)),
|
3202 | ready &&
|
3203 | isVisible &&
|
3204 | ReactDOM__namespace.createPortal(React__namespace.createElement(FindRefWrapper, { onFoundRef: (foundRef) => setPopperElement(foundRef) }, menuWithPopper), getTarget())));
|
3205 | };
|
3206 | Popper.displayName = 'Popper';
|
3207 |
|
3208 | |
3209 |
|
3210 |
|
3211 |
|
3212 |
|
3213 |
|
3214 |
|
3215 |
|
3216 |
|
3217 |
|
3218 |
|
3219 |
|
3220 |
|
3221 | const handleArrows = (event, navigableElements, isActiveElement = element => document.activeElement.contains(element), getFocusableElement = element => element, validSiblingTags = ['A', 'BUTTON', 'INPUT'], noVerticalArrowHandling = false, noHorizontalArrowHandling = false, updateTabIndex = true, onlyTraverseSiblings = true) => {
|
3222 | const activeElement = document.activeElement;
|
3223 | const key = event.key;
|
3224 | let moveTarget = null;
|
3225 |
|
3226 | if (!noVerticalArrowHandling) {
|
3227 | if (['ArrowUp', 'ArrowDown'].includes(key)) {
|
3228 | event.preventDefault();
|
3229 | event.stopImmediatePropagation();
|
3230 |
|
3231 | let currentIndex = -1;
|
3232 |
|
3233 | navigableElements.forEach((element, index) => {
|
3234 | if (isActiveElement(element)) {
|
3235 |
|
3236 | let increment = 0;
|
3237 |
|
3238 | while (!moveTarget && increment < navigableElements.length && increment * -1 < navigableElements.length) {
|
3239 | key === 'ArrowUp' ? increment-- : increment++;
|
3240 | currentIndex = index + increment;
|
3241 | if (currentIndex >= navigableElements.length) {
|
3242 | currentIndex = 0;
|
3243 | }
|
3244 | if (currentIndex < 0) {
|
3245 | currentIndex = navigableElements.length - 1;
|
3246 | }
|
3247 |
|
3248 | moveTarget = getFocusableElement(navigableElements[currentIndex]);
|
3249 | }
|
3250 | }
|
3251 | });
|
3252 |
|
3253 | }
|
3254 | }
|
3255 |
|
3256 | if (!noHorizontalArrowHandling) {
|
3257 | if (['ArrowLeft', 'ArrowRight'].includes(key)) {
|
3258 | event.preventDefault();
|
3259 | event.stopImmediatePropagation();
|
3260 | let currentIndex = -1;
|
3261 | navigableElements.forEach((element, index) => {
|
3262 | if (isActiveElement(element)) {
|
3263 | const activeRow = navigableElements[index].querySelectorAll(validSiblingTags.join(','));
|
3264 | if (!activeRow.length || onlyTraverseSiblings) {
|
3265 | let nextSibling = activeElement;
|
3266 |
|
3267 | while (nextSibling) {
|
3268 |
|
3269 | nextSibling = key === 'ArrowLeft' ? nextSibling.previousElementSibling : nextSibling.nextElementSibling;
|
3270 | if (nextSibling) {
|
3271 | if (validSiblingTags.includes(nextSibling.tagName)) {
|
3272 |
|
3273 | moveTarget = nextSibling;
|
3274 | break;
|
3275 | }
|
3276 |
|
3277 | }
|
3278 | }
|
3279 | }
|
3280 | else {
|
3281 | activeRow.forEach((focusableElement, index) => {
|
3282 | if (event.target === focusableElement) {
|
3283 |
|
3284 | const increment = key === 'ArrowLeft' ? -1 : 1;
|
3285 | currentIndex = index + increment;
|
3286 | if (currentIndex >= activeRow.length) {
|
3287 | currentIndex = 0;
|
3288 | }
|
3289 | if (currentIndex < 0) {
|
3290 | currentIndex = activeRow.length - 1;
|
3291 | }
|
3292 |
|
3293 | moveTarget = activeRow[currentIndex];
|
3294 | }
|
3295 | });
|
3296 | }
|
3297 | }
|
3298 | });
|
3299 | }
|
3300 | }
|
3301 | if (moveTarget) {
|
3302 |
|
3303 |
|
3304 | if (updateTabIndex) {
|
3305 | activeElement.tabIndex = -1;
|
3306 | moveTarget.tabIndex = 0;
|
3307 | }
|
3308 |
|
3309 | moveTarget.focus();
|
3310 | }
|
3311 | };
|
3312 | |
3313 |
|
3314 |
|
3315 |
|
3316 |
|
3317 | const setTabIndex = (options) => {
|
3318 | if (options && options.length > 0) {
|
3319 |
|
3320 | options.forEach((option) => {
|
3321 | option.tabIndex = -1;
|
3322 | });
|
3323 |
|
3324 | options[0].tabIndex = 0;
|
3325 | }
|
3326 | };
|
3327 | class KeyboardHandler extends React__namespace.Component {
|
3328 | constructor() {
|
3329 | super(...arguments);
|
3330 | this.keyHandler = (event) => {
|
3331 | const { isEventFromContainer } = this.props;
|
3332 |
|
3333 | if (isEventFromContainer ? !isEventFromContainer(event) : !this._isEventFromContainer(event)) {
|
3334 | return;
|
3335 | }
|
3336 | const { isActiveElement, getFocusableElement, noVerticalArrowHandling, noHorizontalArrowHandling, noEnterHandling, noSpaceHandling, updateTabIndex, validSiblingTags, additionalKeyHandler, createNavigableElements, onlyTraverseSiblings } = this.props;
|
3337 |
|
3338 | additionalKeyHandler && additionalKeyHandler(event);
|
3339 |
|
3340 | const navigableElements = createNavigableElements();
|
3341 | if (!navigableElements) {
|
3342 |
|
3343 | console.warn('No navigable elements have been passed to the KeyboardHandler. Keyboard navigation provided by this component will be ignored.');
|
3344 | return;
|
3345 | }
|
3346 | const key = event.key;
|
3347 |
|
3348 | if (!noEnterHandling) {
|
3349 | if (key === 'Enter') {
|
3350 | event.preventDefault();
|
3351 | event.stopImmediatePropagation();
|
3352 | document.activeElement.click();
|
3353 | }
|
3354 | }
|
3355 |
|
3356 | if (!noSpaceHandling) {
|
3357 | if (key === ' ') {
|
3358 | event.preventDefault();
|
3359 | event.stopImmediatePropagation();
|
3360 | document.activeElement.click();
|
3361 | }
|
3362 | }
|
3363 |
|
3364 | handleArrows(event, navigableElements, isActiveElement, getFocusableElement, validSiblingTags, noVerticalArrowHandling, noHorizontalArrowHandling, updateTabIndex, onlyTraverseSiblings);
|
3365 | };
|
3366 | this._isEventFromContainer = (event) => {
|
3367 | const { containerRef } = this.props;
|
3368 | return containerRef.current && containerRef.current.contains(event.target);
|
3369 | };
|
3370 | }
|
3371 | componentDidMount() {
|
3372 | if (canUseDOM) {
|
3373 | window.addEventListener('keydown', this.keyHandler);
|
3374 | }
|
3375 | }
|
3376 | componentWillUnmount() {
|
3377 | if (canUseDOM) {
|
3378 | window.removeEventListener('keydown', this.keyHandler);
|
3379 | }
|
3380 | }
|
3381 | render() {
|
3382 | return null;
|
3383 | }
|
3384 | }
|
3385 | KeyboardHandler.displayName = 'KeyboardHandler';
|
3386 | KeyboardHandler.defaultProps = {
|
3387 | containerRef: null,
|
3388 | createNavigableElements: () => null,
|
3389 | isActiveElement: (navigableElement) => document.activeElement === navigableElement,
|
3390 | getFocusableElement: (navigableElement) => navigableElement,
|
3391 | validSiblingTags: ['BUTTON', 'A'],
|
3392 | onlyTraverseSiblings: true,
|
3393 | updateTabIndex: true,
|
3394 | noHorizontalArrowHandling: false,
|
3395 | noVerticalArrowHandling: false,
|
3396 | noEnterHandling: false,
|
3397 | noSpaceHandling: false
|
3398 | };
|
3399 |
|
3400 | |
3401 |
|
3402 |
|
3403 |
|
3404 |
|
3405 |
|
3406 |
|
3407 |
|
3408 |
|
3409 |
|
3410 |
|
3411 |
|
3412 |
|
3413 |
|
3414 |
|
3415 |
|
3416 |
|
3417 |
|
3418 |
|
3419 |
|
3420 |
|
3421 |
|
3422 |
|
3423 |
|
3424 |
|
3425 |
|
3426 |
|
3427 |
|
3428 |
|
3429 |
|
3430 |
|
3431 |
|
3432 |
|
3433 |
|
3434 |
|
3435 |
|
3436 |
|
3437 |
|
3438 |
|
3439 |
|
3440 |
|
3441 |
|
3442 |
|
3443 |
|
3444 |
|
3445 |
|
3446 |
|
3447 |
|
3448 |
|
3449 |
|
3450 |
|
3451 |
|
3452 |
|
3453 |
|
3454 |
|
3455 |
|
3456 |
|
3457 |
|
3458 |
|
3459 |
|
3460 | const getResizeObserver = (containerRefElement, handleResize) => {
|
3461 | let unobserve;
|
3462 | if (canUseDOM) {
|
3463 | const { ResizeObserver } = window;
|
3464 | if (containerRefElement && ResizeObserver) {
|
3465 | const resizeObserver = new ResizeObserver((entries) => {
|
3466 |
|
3467 | window.requestAnimationFrame(() => {
|
3468 | if (Array.isArray(entries) && entries.length > 0) {
|
3469 | handleResize();
|
3470 | }
|
3471 | });
|
3472 | });
|
3473 | resizeObserver.observe(containerRefElement);
|
3474 | unobserve = () => resizeObserver.unobserve(containerRefElement);
|
3475 | }
|
3476 | else {
|
3477 | window.addEventListener('resize', handleResize);
|
3478 | unobserve = () => window.removeEventListener('resize', handleResize);
|
3479 | }
|
3480 | }
|
3481 | return () => {
|
3482 | if (unobserve) {
|
3483 | unobserve();
|
3484 | }
|
3485 | };
|
3486 | };
|
3487 |
|
3488 | |
3489 |
|
3490 |
|
3491 |
|
3492 | function useInterval(callback, delay) {
|
3493 | const savedCallback = React__namespace.useRef(() => { });
|
3494 | React__namespace.useEffect(() => {
|
3495 | savedCallback.current = callback;
|
3496 | }, [callback]);
|
3497 | React__namespace.useEffect(() => {
|
3498 | function tick() {
|
3499 | savedCallback.current();
|
3500 | }
|
3501 | if (delay !== null) {
|
3502 | const id = setInterval(tick, delay);
|
3503 | return () => clearInterval(id);
|
3504 | }
|
3505 | }, [delay]);
|
3506 | }
|
3507 |
|
3508 | Promise.resolve().then(function () { return bullseye; });
|
3509 | var styles$1h = {
|
3510 | "bullseye": "pf-l-bullseye"
|
3511 | };
|
3512 |
|
3513 | Promise.resolve().then(function () { return aboutModalBox; });
|
3514 | var styles$1g = {
|
3515 | "aboutModalBox": "pf-c-about-modal-box",
|
3516 | "aboutModalBoxBrand": "pf-c-about-modal-box__brand",
|
3517 | "aboutModalBoxBrandImage": "pf-c-about-modal-box__brand-image",
|
3518 | "aboutModalBoxClose": "pf-c-about-modal-box__close",
|
3519 | "aboutModalBoxContent": "pf-c-about-modal-box__content",
|
3520 | "aboutModalBoxHeader": "pf-c-about-modal-box__header",
|
3521 | "aboutModalBoxHero": "pf-c-about-modal-box__hero",
|
3522 | "aboutModalBoxStrapline": "pf-c-about-modal-box__strapline",
|
3523 | "button": "pf-c-button",
|
3524 | "card": "pf-c-card",
|
3525 | "modifiers": {
|
3526 | "plain": "pf-m-plain"
|
3527 | }
|
3528 | };
|
3529 |
|
3530 | Promise.resolve().then(function () { return content; });
|
3531 | var styles$1f = {
|
3532 | "content": "pf-c-content",
|
3533 | "modifiers": {
|
3534 | "visited": "pf-m-visited",
|
3535 | "overpassFont": "pf-m-overpass-font"
|
3536 | }
|
3537 | };
|
3538 |
|
3539 | const AboutModalBoxContent = (_a) => {
|
3540 | var { children, className = '', trademark, id, noAboutModalBoxContentContainer = false } = _a, props = __rest$1(_a, ["children", "className", "trademark", "id", "noAboutModalBoxContentContainer"]);
|
3541 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$1g.aboutModalBoxContent, className), id: id }, props),
|
3542 | React__namespace.createElement("div", { className: css('pf-c-about-modal-box__body') }, noAboutModalBoxContentContainer ? children : React__namespace.createElement("div", { className: css(styles$1f.content) }, children)),
|
3543 | React__namespace.createElement("p", { className: css(styles$1g.aboutModalBoxStrapline) }, trademark)));
|
3544 | };
|
3545 | AboutModalBoxContent.displayName = 'AboutModalBoxContent';
|
3546 |
|
3547 | Promise.resolve().then(function () { return title; });
|
3548 | var styles$1e = {
|
3549 | "modifiers": {
|
3550 | "4xl": "pf-m-4xl",
|
3551 | "3xl": "pf-m-3xl",
|
3552 | "2xl": "pf-m-2xl",
|
3553 | "xl": "pf-m-xl",
|
3554 | "lg": "pf-m-lg",
|
3555 | "md": "pf-m-md",
|
3556 | "overpassFont": "pf-m-overpass-font"
|
3557 | },
|
3558 | "title": "pf-c-title"
|
3559 | };
|
3560 |
|
3561 | exports.TitleSizes = void 0;
|
3562 | (function (TitleSizes) {
|
3563 | TitleSizes["md"] = "md";
|
3564 | TitleSizes["lg"] = "lg";
|
3565 | TitleSizes["xl"] = "xl";
|
3566 | TitleSizes["2xl"] = "2xl";
|
3567 | TitleSizes["3xl"] = "3xl";
|
3568 | TitleSizes["4xl"] = "4xl";
|
3569 | })(exports.TitleSizes || (exports.TitleSizes = {}));
|
3570 | var headingLevelSizeMap;
|
3571 | (function (headingLevelSizeMap) {
|
3572 | headingLevelSizeMap["h1"] = "2xl";
|
3573 | headingLevelSizeMap["h2"] = "xl";
|
3574 | headingLevelSizeMap["h3"] = "lg";
|
3575 | headingLevelSizeMap["h4"] = "md";
|
3576 | headingLevelSizeMap["h5"] = "md";
|
3577 | headingLevelSizeMap["h6"] = "md";
|
3578 | })(headingLevelSizeMap || (headingLevelSizeMap = {}));
|
3579 | const Title = (_a) => {
|
3580 | var { className = '', children = '', headingLevel: HeadingLevel, size = headingLevelSizeMap[HeadingLevel], ouiaId, ouiaSafe = true } = _a, props = __rest$1(_a, ["className", "children", "headingLevel", "size", "ouiaId", "ouiaSafe"]);
|
3581 | const ouiaProps = useOUIAProps(Title.displayName, ouiaId, ouiaSafe);
|
3582 | return (React__namespace.createElement(HeadingLevel, Object.assign({}, ouiaProps, props, { className: css(styles$1e.title, size && styles$1e.modifiers[size], className) }), children));
|
3583 | };
|
3584 | Title.displayName = 'Title';
|
3585 |
|
3586 | const AboutModalBoxHeader = (_a) => {
|
3587 | var { className = '', productName = '', id } = _a, props = __rest$1(_a, ["className", "productName", "id"]);
|
3588 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$1g.aboutModalBoxHeader, className) }, props),
|
3589 | React__namespace.createElement(Title, { headingLevel: "h1", size: "4xl", id: id }, productName)));
|
3590 | };
|
3591 | AboutModalBoxHeader.displayName = 'AboutModalBoxHeader';
|
3592 |
|
3593 | const c_about_modal_box__hero_sm_BackgroundImage = {
|
3594 | "name": "--pf-c-about-modal-box__hero--sm--BackgroundImage",
|
3595 | "value": "url(\"../../assets/images/pfbg_992@2x.jpg\")",
|
3596 | "var": "var(--pf-c-about-modal-box__hero--sm--BackgroundImage)"
|
3597 | };
|
3598 | var c_about_modal_box__hero_sm_BackgroundImage$1 = c_about_modal_box__hero_sm_BackgroundImage;
|
3599 |
|
3600 | const AboutModalBoxHero = (_a) => {
|
3601 | var { className, backgroundImageSrc } = _a, props = __rest$1(_a, ["className", "backgroundImageSrc"]);
|
3602 | return (React__namespace.createElement("div", Object.assign({ style:
|
3603 |
|
3604 | backgroundImageSrc !== ''
|
3605 | ? { [c_about_modal_box__hero_sm_BackgroundImage$1.name]: `url(${backgroundImageSrc})` }
|
3606 | : {}, className: css(styles$1g.aboutModalBoxHero, className) }, props)));
|
3607 | };
|
3608 | AboutModalBoxHero.displayName = 'AboutModalBoxHero';
|
3609 |
|
3610 | const AboutModalBoxBrand = (_a) => {
|
3611 | var { className = '', src = '', alt } = _a, props = __rest$1(_a, ["className", "src", "alt"]);
|
3612 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$1g.aboutModalBoxBrand, className) }, props),
|
3613 | React__namespace.createElement("img", { className: css(styles$1g.aboutModalBoxBrandImage), src: src, alt: alt })));
|
3614 | };
|
3615 | AboutModalBoxBrand.displayName = 'AboutModalBoxBrand';
|
3616 |
|
3617 | Promise.resolve().then(function () { return button; });
|
3618 | var buttonStyles = {
|
3619 | "button": "pf-c-button",
|
3620 | "buttonIcon": "pf-c-button__icon",
|
3621 | "buttonProgress": "pf-c-button__progress",
|
3622 | "modifiers": {
|
3623 | "active": "pf-m-active",
|
3624 | "block": "pf-m-block",
|
3625 | "small": "pf-m-small",
|
3626 | "primary": "pf-m-primary",
|
3627 | "displayLg": "pf-m-display-lg",
|
3628 | "secondary": "pf-m-secondary",
|
3629 | "tertiary": "pf-m-tertiary",
|
3630 | "link": "pf-m-link",
|
3631 | "inline": "pf-m-inline",
|
3632 | "danger": "pf-m-danger",
|
3633 | "warning": "pf-m-warning",
|
3634 | "control": "pf-m-control",
|
3635 | "expanded": "pf-m-expanded",
|
3636 | "plain": "pf-m-plain",
|
3637 | "disabled": "pf-m-disabled",
|
3638 | "ariaDisabled": "pf-m-aria-disabled",
|
3639 | "progress": "pf-m-progress",
|
3640 | "inProgress": "pf-m-in-progress",
|
3641 | "start": "pf-m-start",
|
3642 | "end": "pf-m-end",
|
3643 | "overpassFont": "pf-m-overpass-font"
|
3644 | },
|
3645 | "spinner": "pf-c-spinner"
|
3646 | };
|
3647 |
|
3648 | Promise.resolve().then(function () { return spinner; });
|
3649 | var styles$1d = {
|
3650 | "modifiers": {
|
3651 | "sm": "pf-m-sm",
|
3652 | "md": "pf-m-md",
|
3653 | "lg": "pf-m-lg",
|
3654 | "xl": "pf-m-xl"
|
3655 | },
|
3656 | "spinner": "pf-c-spinner",
|
3657 | "spinnerClipper": "pf-c-spinner__clipper",
|
3658 | "spinnerLeadBall": "pf-c-spinner__lead-ball",
|
3659 | "spinnerPath": "pf-c-spinner__path",
|
3660 | "spinnerTailBall": "pf-c-spinner__tail-ball"
|
3661 | };
|
3662 |
|
3663 | exports.spinnerSize = void 0;
|
3664 | (function (spinnerSize) {
|
3665 | spinnerSize["sm"] = "sm";
|
3666 | spinnerSize["md"] = "md";
|
3667 | spinnerSize["lg"] = "lg";
|
3668 | spinnerSize["xl"] = "xl";
|
3669 | })(exports.spinnerSize || (exports.spinnerSize = {}));
|
3670 | const Spinner = (_a) => {
|
3671 | var {
|
3672 |
|
3673 | className = '', size = 'xl', 'aria-valuetext': ariaValueText = 'Loading...', isSVG = false, diameter, 'aria-label': ariaLabel, 'aria-labelledBy': ariaLabelledBy } = _a, props = __rest$1(_a, ["className", "size", 'aria-valuetext', "isSVG", "diameter", 'aria-label', 'aria-labelledBy']);
|
3674 | const Component = isSVG ? 'svg' : 'span';
|
3675 | return (React__namespace.createElement(Component, Object.assign({ className: css(styles$1d.spinner, styles$1d.modifiers[size], className), role: "progressbar", "aria-valuetext": ariaValueText }, (isSVG && { viewBox: '0 0 100 100' }), (diameter && { style: { '--pf-c-spinner--diameter': diameter } }), (ariaLabel && { 'aria-label': ariaLabel }), (ariaLabelledBy && { 'aria-labelledBy': ariaLabelledBy }), (!ariaLabel && !ariaLabelledBy && { 'aria-label': 'Contents' }), props), isSVG ? (React__namespace.createElement("circle", { className: styles$1d.spinnerPath, cx: "50", cy: "50", r: "45", fill: "none" })) : (React__namespace.createElement(React__namespace.Fragment, null,
|
3676 | React__namespace.createElement("span", { className: css(styles$1d.spinnerClipper) }),
|
3677 | React__namespace.createElement("span", { className: css(styles$1d.spinnerLeadBall) }),
|
3678 | React__namespace.createElement("span", { className: css(styles$1d.spinnerTailBall) })))));
|
3679 | };
|
3680 | Spinner.displayName = 'Spinner';
|
3681 |
|
3682 | exports.ButtonVariant = void 0;
|
3683 | (function (ButtonVariant) {
|
3684 | ButtonVariant["primary"] = "primary";
|
3685 | ButtonVariant["secondary"] = "secondary";
|
3686 | ButtonVariant["tertiary"] = "tertiary";
|
3687 | ButtonVariant["danger"] = "danger";
|
3688 | ButtonVariant["warning"] = "warning";
|
3689 | ButtonVariant["link"] = "link";
|
3690 | ButtonVariant["plain"] = "plain";
|
3691 | ButtonVariant["control"] = "control";
|
3692 | })(exports.ButtonVariant || (exports.ButtonVariant = {}));
|
3693 | exports.ButtonType = void 0;
|
3694 | (function (ButtonType) {
|
3695 | ButtonType["button"] = "button";
|
3696 | ButtonType["submit"] = "submit";
|
3697 | ButtonType["reset"] = "reset";
|
3698 | })(exports.ButtonType || (exports.ButtonType = {}));
|
3699 | const ButtonBase = (_a) => {
|
3700 | var { children = null, className = '', component = 'button', isActive = false, isBlock = false, isDisabled = false, isAriaDisabled = false, isLoading = null, isDanger = false, spinnerAriaValueText, spinnerAriaLabelledBy, spinnerAriaLabel, isSmall = false, isLarge = false, inoperableEvents = ['onClick', 'onKeyPress'], isInline = false, type = exports.ButtonType.button, variant = exports.ButtonVariant.primary, iconPosition = 'left', 'aria-label': ariaLabel = null, icon = null, ouiaId, ouiaSafe = true, tabIndex = null, innerRef } = _a, props = __rest$1(_a, ["children", "className", "component", "isActive", "isBlock", "isDisabled", "isAriaDisabled", "isLoading", "isDanger", "spinnerAriaValueText", "spinnerAriaLabelledBy", "spinnerAriaLabel", "isSmall", "isLarge", "inoperableEvents", "isInline", "type", "variant", "iconPosition", 'aria-label', "icon", "ouiaId", "ouiaSafe", "tabIndex", "innerRef"]);
|
3701 | const ouiaProps = useOUIAProps(Button.displayName, ouiaId, ouiaSafe, variant);
|
3702 | const Component = component;
|
3703 | const isButtonElement = Component === 'button';
|
3704 | const isInlineSpan = isInline && Component === 'span';
|
3705 | const preventedEvents = inoperableEvents.reduce((handlers, eventToPrevent) => (Object.assign(Object.assign({}, handlers), { [eventToPrevent]: (event) => {
|
3706 | event.preventDefault();
|
3707 | } })), {});
|
3708 | const getDefaultTabIdx = () => {
|
3709 | if (isDisabled) {
|
3710 | return isButtonElement ? null : -1;
|
3711 | }
|
3712 | else if (isAriaDisabled) {
|
3713 | return null;
|
3714 | }
|
3715 | else if (isInlineSpan) {
|
3716 | return 0;
|
3717 | }
|
3718 | };
|
3719 | return (React__namespace.createElement(Component, Object.assign({}, props, (isAriaDisabled ? preventedEvents : null), { "aria-disabled": isDisabled || isAriaDisabled, "aria-label": ariaLabel, className: css(buttonStyles.button, buttonStyles.modifiers[variant], isBlock && buttonStyles.modifiers.block, isDisabled && buttonStyles.modifiers.disabled, isAriaDisabled && buttonStyles.modifiers.ariaDisabled, isActive && buttonStyles.modifiers.active, isInline && variant === exports.ButtonVariant.link && buttonStyles.modifiers.inline, isDanger && (variant === exports.ButtonVariant.secondary || variant === exports.ButtonVariant.link) && buttonStyles.modifiers.danger, isLoading !== null && children !== null && buttonStyles.modifiers.progress, isLoading && buttonStyles.modifiers.inProgress, isSmall && buttonStyles.modifiers.small, isLarge && buttonStyles.modifiers.displayLg, className), disabled: isButtonElement ? isDisabled : null, tabIndex: tabIndex !== null ? tabIndex : getDefaultTabIdx(), type: isButtonElement || isInlineSpan ? type : null, role: isInlineSpan ? 'button' : null, ref: innerRef }, ouiaProps),
|
3720 | isLoading && (React__namespace.createElement("span", { className: css(buttonStyles.buttonProgress) },
|
3721 | React__namespace.createElement(Spinner, { size: exports.spinnerSize.md, "aria-valuetext": spinnerAriaValueText, "aria-label": spinnerAriaLabel, "aria-labelledby": spinnerAriaLabelledBy }))),
|
3722 | variant === exports.ButtonVariant.plain && children === null && icon ? icon : null,
|
3723 | variant !== exports.ButtonVariant.plain && icon && iconPosition === 'left' && (React__namespace.createElement("span", { className: css(buttonStyles.buttonIcon, buttonStyles.modifiers.start) }, icon)),
|
3724 | children,
|
3725 | variant !== exports.ButtonVariant.plain && icon && iconPosition === 'right' && (React__namespace.createElement("span", { className: css(buttonStyles.buttonIcon, buttonStyles.modifiers.end) }, icon))));
|
3726 | };
|
3727 | const Button = React__namespace.forwardRef((props, ref) => (React__namespace.createElement(ButtonBase, Object.assign({ innerRef: ref }, props))));
|
3728 | Button.displayName = 'Button';
|
3729 |
|
3730 | |
3731 |
|
3732 |
|
3733 |
|
3734 |
|
3735 |
|
3736 |
|
3737 |
|
3738 |
|
3739 |
|
3740 |
|
3741 |
|
3742 |
|
3743 |
|
3744 |
|
3745 | function __rest(s, e) {
|
3746 | var t = {};
|
3747 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
3748 | t[p] = s[p];
|
3749 | if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
3750 | for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
3751 | if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
3752 | t[p[i]] = s[p[i]];
|
3753 | }
|
3754 | return t;
|
3755 | }
|
3756 |
|
3757 | var IconSize;
|
3758 | (function (IconSize) {
|
3759 | IconSize["sm"] = "sm";
|
3760 | IconSize["md"] = "md";
|
3761 | IconSize["lg"] = "lg";
|
3762 | IconSize["xl"] = "xl";
|
3763 | })(IconSize || (IconSize = {}));
|
3764 | const getSize = (size) => {
|
3765 | switch (size) {
|
3766 | case IconSize.sm:
|
3767 | return '1em';
|
3768 | case IconSize.md:
|
3769 | return '1.5em';
|
3770 | case IconSize.lg:
|
3771 | return '2em';
|
3772 | case IconSize.xl:
|
3773 | return '3em';
|
3774 | default:
|
3775 | return '1em';
|
3776 | }
|
3777 | };
|
3778 | let currentId$2 = 0;
|
3779 | |
3780 |
|
3781 |
|
3782 | function createIcon({ name, xOffset = 0, yOffset = 0, width, height, svgPath }) {
|
3783 | var _a;
|
3784 | return _a = class SVGIcon extends React__namespace.Component {
|
3785 | constructor() {
|
3786 | super(...arguments);
|
3787 | this.id = `icon-title-${currentId$2++}`;
|
3788 | }
|
3789 | render() {
|
3790 | const _a = this.props, { size, color, title, noVerticalAlign } = _a, props = __rest(_a, ["size", "color", "title", "noVerticalAlign"]);
|
3791 | const hasTitle = Boolean(title);
|
3792 | const heightWidth = getSize(size);
|
3793 | const baseAlign = -0.125 * Number.parseFloat(heightWidth);
|
3794 | const style = noVerticalAlign ? null : { verticalAlign: `${baseAlign}em` };
|
3795 | const viewBox = [xOffset, yOffset, width, height].join(' ');
|
3796 | return (React__namespace.createElement("svg", Object.assign({ style: style, fill: color, height: heightWidth, width: heightWidth, viewBox: viewBox, "aria-labelledby": hasTitle ? this.id : null, "aria-hidden": hasTitle ? null : true, role: "img" }, props),
|
3797 | hasTitle && React__namespace.createElement("title", { id: this.id }, title),
|
3798 | React__namespace.createElement("path", { d: svgPath })));
|
3799 | }
|
3800 | },
|
3801 | _a.displayName = name,
|
3802 | _a.defaultProps = {
|
3803 | color: 'currentColor',
|
3804 | size: IconSize.sm,
|
3805 | noVerticalAlign: false
|
3806 | },
|
3807 | _a;
|
3808 | }
|
3809 |
|
3810 | const TimesIconConfig = {
|
3811 | name: 'TimesIcon',
|
3812 | height: 512,
|
3813 | width: 352,
|
3814 | svgPath: 'M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z',
|
3815 | yOffset: 0,
|
3816 | xOffset: 0,
|
3817 | };
|
3818 |
|
3819 | const TimesIcon = createIcon(TimesIconConfig);
|
3820 |
|
3821 | var TimesIcon$1 = TimesIcon;
|
3822 |
|
3823 | const AboutModalBoxCloseButton = (_a) => {
|
3824 | var { className = '', onClose = () => undefined, 'aria-label': ariaLabel = 'Close Dialog' } = _a, props = __rest$1(_a, ["className", "onClose", 'aria-label']);
|
3825 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$1g.aboutModalBoxClose, className) }, props),
|
3826 | React__namespace.createElement(Button, { variant: "plain", onClick: onClose, "aria-label": ariaLabel },
|
3827 | React__namespace.createElement(TimesIcon$1, null))));
|
3828 | };
|
3829 | AboutModalBoxCloseButton.displayName = 'AboutModalBoxCloseButton';
|
3830 |
|
3831 | const AboutModalBox = (_a) => {
|
3832 | var { children, className = '' } = _a, props = __rest$1(_a, ["children", "className"]);
|
3833 | return (React__namespace.createElement("div", Object.assign({ role: "dialog", "aria-modal": "true", className: css(styles$1g.aboutModalBox, className) }, props), children));
|
3834 | };
|
3835 | AboutModalBox.displayName = 'AboutModalBox';
|
3836 |
|
3837 | const Backdrop = (_a) => {
|
3838 | var { children = null, className = '' } = _a, props = __rest$1(_a, ["children", "className"]);
|
3839 | return (React__namespace.createElement("div", Object.assign({}, props, { className: css(styles$1i.backdrop, className) }), children));
|
3840 | };
|
3841 | Backdrop.displayName = 'Backdrop';
|
3842 |
|
3843 | const AboutModalContainer = (_a) => {
|
3844 | var { children, className = '', isOpen = false, onClose = () => undefined, productName = '', trademark, brandImageSrc, brandImageAlt, backgroundImageSrc, closeButtonAriaLabel, aboutModalBoxHeaderId, aboutModalBoxContentId, disableFocusTrap = false } = _a, props = __rest$1(_a, ["children", "className", "isOpen", "onClose", "productName", "trademark", "brandImageSrc", "brandImageAlt", "backgroundImageSrc", "closeButtonAriaLabel", "aboutModalBoxHeaderId", "aboutModalBoxContentId", "disableFocusTrap"]);
|
3845 | if (!isOpen) {
|
3846 | return null;
|
3847 | }
|
3848 | return (React__namespace.createElement(Backdrop, null,
|
3849 | React__namespace.createElement(FocusTrap, { active: !disableFocusTrap, focusTrapOptions: { clickOutsideDeactivates: true }, className: css(styles$1h.bullseye) },
|
3850 | React__namespace.createElement(AboutModalBox, { className: className, "aria-labelledby": aboutModalBoxHeaderId, "aria-describedby": aboutModalBoxContentId },
|
3851 | React__namespace.createElement(AboutModalBoxBrand, { src: brandImageSrc, alt: brandImageAlt }),
|
3852 | React__namespace.createElement(AboutModalBoxCloseButton, { "aria-label": closeButtonAriaLabel, onClose: onClose }),
|
3853 | productName && React__namespace.createElement(AboutModalBoxHeader, { id: aboutModalBoxHeaderId, productName: productName }),
|
3854 | React__namespace.createElement(AboutModalBoxContent, Object.assign({ trademark: trademark, id: aboutModalBoxContentId, noAboutModalBoxContentContainer: false }, props), children),
|
3855 | React__namespace.createElement(AboutModalBoxHero, { backgroundImageSrc: backgroundImageSrc })))));
|
3856 | };
|
3857 | AboutModalContainer.displayName = 'AboutModalContainer';
|
3858 |
|
3859 | class AboutModal extends React__namespace.Component {
|
3860 | constructor(props) {
|
3861 | super(props);
|
3862 | this.id = AboutModal.currentId++;
|
3863 | this.ariaLabelledBy = `pf-about-modal-title-${this.id}`;
|
3864 | this.ariaDescribedBy = `pf-about-modal-content-${this.id}`;
|
3865 | this.handleEscKeyClick = (event) => {
|
3866 | if (event.keyCode === KEY_CODES.ESCAPE_KEY && this.props.isOpen) {
|
3867 | this.props.onClose();
|
3868 | }
|
3869 | };
|
3870 | this.toggleSiblingsFromScreenReaders = (hide) => {
|
3871 | const { appendTo } = this.props;
|
3872 | const target = this.getElement(appendTo);
|
3873 | const bodyChildren = target.children;
|
3874 | for (const child of Array.from(bodyChildren)) {
|
3875 | if (child !== this.state.container) {
|
3876 | hide ? child.setAttribute('aria-hidden', '' + hide) : child.removeAttribute('aria-hidden');
|
3877 | }
|
3878 | }
|
3879 | };
|
3880 | this.getElement = (appendTo) => {
|
3881 | if (typeof appendTo === 'function') {
|
3882 | return appendTo();
|
3883 | }
|
3884 | return appendTo || document.body;
|
3885 | };
|
3886 | this.state = {
|
3887 | container: undefined
|
3888 | };
|
3889 | if (props.brandImageSrc && !props.brandImageAlt) {
|
3890 |
|
3891 | console.error('AboutModal:', 'brandImageAlt is required when a brandImageSrc is specified');
|
3892 | }
|
3893 | }
|
3894 | componentDidMount() {
|
3895 | const container = document.createElement('div');
|
3896 | const target = this.getElement(this.props.appendTo);
|
3897 | this.setState({ container });
|
3898 | target.appendChild(container);
|
3899 | target.addEventListener('keydown', this.handleEscKeyClick, false);
|
3900 | if (this.props.isOpen) {
|
3901 | target.classList.add(css(styles$1i.backdropOpen));
|
3902 | }
|
3903 | else {
|
3904 | target.classList.remove(css(styles$1i.backdropOpen));
|
3905 | }
|
3906 | }
|
3907 | componentDidUpdate() {
|
3908 | const target = this.getElement(this.props.appendTo);
|
3909 | if (this.props.isOpen) {
|
3910 | target.classList.add(css(styles$1i.backdropOpen));
|
3911 | this.toggleSiblingsFromScreenReaders(true);
|
3912 | }
|
3913 | else {
|
3914 | target.classList.remove(css(styles$1i.backdropOpen));
|
3915 | this.toggleSiblingsFromScreenReaders(false);
|
3916 | }
|
3917 | }
|
3918 | componentWillUnmount() {
|
3919 | const target = this.getElement(this.props.appendTo);
|
3920 | if (this.state.container) {
|
3921 | target.removeChild(this.state.container);
|
3922 | }
|
3923 | target.removeEventListener('keydown', this.handleEscKeyClick, false);
|
3924 | target.classList.remove(css(styles$1i.backdropOpen));
|
3925 | }
|
3926 | render() {
|
3927 |
|
3928 | const _a = this.props, props = __rest$1(_a, ["appendTo"]);
|
3929 | const { container } = this.state;
|
3930 | if (!canUseDOM || !container) {
|
3931 | return null;
|
3932 | }
|
3933 | return ReactDOM__namespace.createPortal(React__namespace.createElement(AboutModalContainer, Object.assign({ aboutModalBoxHeaderId: this.ariaLabelledBy, aboutModalBoxContentId: this.ariaDescribedBy }, props)), container);
|
3934 | }
|
3935 | }
|
3936 | AboutModal.displayName = 'AboutModal';
|
3937 | AboutModal.currentId = 0;
|
3938 | AboutModal.defaultProps = {
|
3939 | className: '',
|
3940 | isOpen: false,
|
3941 | onClose: () => undefined,
|
3942 | productName: '',
|
3943 | trademark: '',
|
3944 | backgroundImageSrc: '',
|
3945 | noAboutModalBoxContentContainer: false,
|
3946 | appendTo: null
|
3947 | };
|
3948 |
|
3949 | Promise.resolve().then(function () { return accordion; });
|
3950 | var styles$1c = {
|
3951 | "accordion": "pf-c-accordion",
|
3952 | "accordionExpandedContent": "pf-c-accordion__expanded-content",
|
3953 | "accordionExpandedContentBody": "pf-c-accordion__expanded-content-body",
|
3954 | "accordionToggle": "pf-c-accordion__toggle",
|
3955 | "accordionToggleIcon": "pf-c-accordion__toggle-icon",
|
3956 | "accordionToggleText": "pf-c-accordion__toggle-text",
|
3957 | "modifiers": {
|
3958 | "displayLg": "pf-m-display-lg",
|
3959 | "bordered": "pf-m-bordered",
|
3960 | "expanded": "pf-m-expanded",
|
3961 | "fixed": "pf-m-fixed"
|
3962 | }
|
3963 | };
|
3964 |
|
3965 | const AccordionContext = React__namespace.createContext({});
|
3966 |
|
3967 | const Accordion = (_a) => {
|
3968 | var { children = null, className = '', 'aria-label': ariaLabel = '', headingLevel = 'h3', asDefinitionList = true, isBordered = false, displaySize = 'default' } = _a, props = __rest$1(_a, ["children", "className", 'aria-label', "headingLevel", "asDefinitionList", "isBordered", "displaySize"]);
|
3969 | const AccordionList = asDefinitionList ? 'dl' : 'div';
|
3970 | return (React__namespace.createElement(AccordionList, Object.assign({ className: css(styles$1c.accordion, isBordered && styles$1c.modifiers.bordered, displaySize === 'large' && styles$1c.modifiers.displayLg, className), "aria-label": ariaLabel }, props),
|
3971 | React__namespace.createElement(AccordionContext.Provider, { value: {
|
3972 | ContentContainer: asDefinitionList ? 'dd' : 'div',
|
3973 | ToggleContainer: asDefinitionList ? 'dt' : headingLevel
|
3974 | } }, children)));
|
3975 | };
|
3976 | Accordion.displayName = 'Accordion';
|
3977 |
|
3978 | const AccordionExpandedContentBody = ({ children = null }) => React__namespace.createElement("div", { className: css(styles$1c.accordionExpandedContentBody) }, children);
|
3979 | AccordionExpandedContentBody.displayName = 'AccordionExpandedContentBody';
|
3980 |
|
3981 | const AccordionContent = (_a) => {
|
3982 | var { className = '', children = null, id = '', isHidden = false, isFixed = false, isCustomContent = false, 'aria-label': ariaLabel = '', component } = _a, props = __rest$1(_a, ["className", "children", "id", "isHidden", "isFixed", "isCustomContent", 'aria-label', "component"]);
|
3983 | return (React__namespace.createElement(AccordionContext.Consumer, null, ({ ContentContainer }) => {
|
3984 | const Container = component || ContentContainer;
|
3985 | return (React__namespace.createElement(Container, Object.assign({ id: id, className: css(styles$1c.accordionExpandedContent, isFixed && styles$1c.modifiers.fixed, !isHidden && styles$1c.modifiers.expanded, className), hidden: isHidden, "aria-label": ariaLabel }, props), isCustomContent ? children : React__namespace.createElement(AccordionExpandedContentBody, null, children)));
|
3986 | }));
|
3987 | };
|
3988 | AccordionContent.displayName = 'AccordionContent';
|
3989 |
|
3990 | const AccordionItem = ({ children = null }) => (React__namespace.createElement(React__namespace.Fragment, null, children));
|
3991 | AccordionItem.displayName = 'AccordionItem';
|
3992 |
|
3993 | const AngleRightIconConfig = {
|
3994 | name: 'AngleRightIcon',
|
3995 | height: 512,
|
3996 | width: 256,
|
3997 | svgPath: 'M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z',
|
3998 | yOffset: 0,
|
3999 | xOffset: 0,
|
4000 | };
|
4001 |
|
4002 | const AngleRightIcon = createIcon(AngleRightIconConfig);
|
4003 |
|
4004 | var AngleRightIcon$1 = AngleRightIcon;
|
4005 |
|
4006 | const AccordionToggle = (_a) => {
|
4007 | var { className = '', id, isExpanded = false, children = null, component } = _a, props = __rest$1(_a, ["className", "id", "isExpanded", "children", "component"]);
|
4008 | return (React__namespace.createElement(AccordionContext.Consumer, null, ({ ToggleContainer }) => {
|
4009 | const Container = component || ToggleContainer;
|
4010 | return (React__namespace.createElement(Container, null,
|
4011 | React__namespace.createElement("button", Object.assign({ id: id, className: css(styles$1c.accordionToggle, isExpanded && styles$1c.modifiers.expanded, className), "aria-expanded": isExpanded, type: "button" }, props),
|
4012 | React__namespace.createElement("span", { className: css(styles$1c.accordionToggleText) }, children),
|
4013 | React__namespace.createElement("span", { className: css(styles$1c.accordionToggleIcon) },
|
4014 | React__namespace.createElement(AngleRightIcon$1, null)))));
|
4015 | }));
|
4016 | };
|
4017 | AccordionToggle.displayName = 'AccordionToggle';
|
4018 |
|
4019 | Promise.resolve().then(function () { return actionList; });
|
4020 | var styles$1b = {
|
4021 | "actionList": "pf-c-action-list",
|
4022 | "actionListGroup": "pf-c-action-list__group",
|
4023 | "modifiers": {
|
4024 | "icons": "pf-m-icons"
|
4025 | }
|
4026 | };
|
4027 |
|
4028 | const ActionList = (_a) => {
|
4029 | var { children, isIconList, className = '' } = _a, props = __rest$1(_a, ["children", "isIconList", "className"]);
|
4030 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$1b.actionList, isIconList && styles$1b.modifiers.icons, className) }, props), children));
|
4031 | };
|
4032 | ActionList.displayName = 'ActionList';
|
4033 |
|
4034 | const ActionListGroup = (_a) => {
|
4035 | var { children, className = '' } = _a, props = __rest$1(_a, ["children", "className"]);
|
4036 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$1b.actionListGroup, className) }, props), children));
|
4037 | };
|
4038 | ActionListGroup.displayName = 'ActionListGroup';
|
4039 |
|
4040 | const ActionListItem = (_a) => {
|
4041 | var { children, className = '' } = _a, props = __rest$1(_a, ["children", "className"]);
|
4042 | return (React__namespace.createElement("div", Object.assign({ className: css('pf-c-action-list__item', className) }, props), children));
|
4043 | };
|
4044 | ActionListItem.displayName = 'ActionListItem';
|
4045 |
|
4046 | Promise.resolve().then(function () { return alert; });
|
4047 | var styles$1a = {
|
4048 | "alert": "pf-c-alert",
|
4049 | "alertAction": "pf-c-alert__action",
|
4050 | "alertActionGroup": "pf-c-alert__action-group",
|
4051 | "alertDescription": "pf-c-alert__description",
|
4052 | "alertIcon": "pf-c-alert__icon",
|
4053 | "alertTitle": "pf-c-alert__title",
|
4054 | "alertToggle": "pf-c-alert__toggle",
|
4055 | "alertToggleIcon": "pf-c-alert__toggle-icon",
|
4056 | "button": "pf-c-button",
|
4057 | "modifiers": {
|
4058 | "success": "pf-m-success",
|
4059 | "danger": "pf-m-danger",
|
4060 | "warning": "pf-m-warning",
|
4061 | "info": "pf-m-info",
|
4062 | "inline": "pf-m-inline",
|
4063 | "plain": "pf-m-plain",
|
4064 | "expandable": "pf-m-expandable",
|
4065 | "expanded": "pf-m-expanded",
|
4066 | "truncate": "pf-m-truncate",
|
4067 | "overpassFont": "pf-m-overpass-font"
|
4068 | }
|
4069 | };
|
4070 |
|
4071 | Promise.resolve().then(function () { return accessibility; });
|
4072 | var a11yStyles = {
|
4073 | "hidden": "pf-u-hidden",
|
4074 | "hiddenOnLg": "pf-u-hidden-on-lg",
|
4075 | "hiddenOnMd": "pf-u-hidden-on-md",
|
4076 | "hiddenOnSm": "pf-u-hidden-on-sm",
|
4077 | "hiddenOnXl": "pf-u-hidden-on-xl",
|
4078 | "hiddenOn_2xl": "pf-u-hidden-on-2xl",
|
4079 | "screenReader": "pf-u-screen-reader",
|
4080 | "screenReaderOnLg": "pf-u-screen-reader-on-lg",
|
4081 | "screenReaderOnMd": "pf-u-screen-reader-on-md",
|
4082 | "screenReaderOnSm": "pf-u-screen-reader-on-sm",
|
4083 | "screenReaderOnXl": "pf-u-screen-reader-on-xl",
|
4084 | "screenReaderOn_2xl": "pf-u-screen-reader-on-2xl",
|
4085 | "visible": "pf-u-visible",
|
4086 | "visibleOnLg": "pf-u-visible-on-lg",
|
4087 | "visibleOnMd": "pf-u-visible-on-md",
|
4088 | "visibleOnSm": "pf-u-visible-on-sm",
|
4089 | "visibleOnXl": "pf-u-visible-on-xl",
|
4090 | "visibleOn_2xl": "pf-u-visible-on-2xl"
|
4091 | };
|
4092 |
|
4093 | const CheckCircleIconConfig = {
|
4094 | name: 'CheckCircleIcon',
|
4095 | height: 512,
|
4096 | width: 512,
|
4097 | svgPath: 'M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z',
|
4098 | yOffset: 0,
|
4099 | xOffset: 0,
|
4100 | };
|
4101 |
|
4102 | const CheckCircleIcon = createIcon(CheckCircleIconConfig);
|
4103 |
|
4104 | var CheckCircleIcon$1 = CheckCircleIcon;
|
4105 |
|
4106 | const ExclamationCircleIconConfig = {
|
4107 | name: 'ExclamationCircleIcon',
|
4108 | height: 512,
|
4109 | width: 512,
|
4110 | svgPath: 'M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zm-248 50c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z',
|
4111 | yOffset: 0,
|
4112 | xOffset: 0,
|
4113 | };
|
4114 |
|
4115 | const ExclamationCircleIcon = createIcon(ExclamationCircleIconConfig);
|
4116 |
|
4117 | var ExclamationCircleIcon$1 = ExclamationCircleIcon;
|
4118 |
|
4119 | const ExclamationTriangleIconConfig = {
|
4120 | name: 'ExclamationTriangleIcon',
|
4121 | height: 512,
|
4122 | width: 576,
|
4123 | svgPath: 'M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z',
|
4124 | yOffset: 0,
|
4125 | xOffset: 0,
|
4126 | };
|
4127 |
|
4128 | const ExclamationTriangleIcon = createIcon(ExclamationTriangleIconConfig);
|
4129 |
|
4130 | var ExclamationTriangleIcon$1 = ExclamationTriangleIcon;
|
4131 |
|
4132 | const InfoCircleIconConfig = {
|
4133 | name: 'InfoCircleIcon',
|
4134 | height: 512,
|
4135 | width: 512,
|
4136 | svgPath: 'M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 110c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z',
|
4137 | yOffset: 0,
|
4138 | xOffset: 0,
|
4139 | };
|
4140 |
|
4141 | const InfoCircleIcon = createIcon(InfoCircleIconConfig);
|
4142 |
|
4143 | var InfoCircleIcon$1 = InfoCircleIcon;
|
4144 |
|
4145 | const BellIconConfig = {
|
4146 | name: 'BellIcon',
|
4147 | height: 1024,
|
4148 | width: 896,
|
4149 | svgPath: 'M448,0 C465.333333,0 480.333333,6.33333333 493,19 C505.666667,31.6666667 512,46.6666667 512,64 L512,106 L514.23,106.45 C587.89,121.39 648.48,157.24 696,214 C744,271.333333 768,338.666667 768,416 C768,500 780,568.666667 804,622 C818.666667,652.666667 841.333333,684 872,716 C873.773676,718.829136 875.780658,721.505113 878,724 C890,737.333333 896,752.333333 896,769 C896,785.666667 890,800.333333 878,813 C866,825.666667 850.666667,832 832,832 L63.3,832 C44.9533333,831.84 29.8533333,825.506667 18,813 C6,800.333333 0,785.666667 0,769 C0,752.333333 6,737.333333 18,724 L24,716 L25.06,714.9 C55.1933333,683.28 77.5066667,652.313333 92,622 C116,568.666667 128,500 128,416 C128,338.666667 152,271.333333 200,214 C248,156.666667 309.333333,120.666667 384,106 L384,63.31 C384.166667,46.27 390.5,31.5 403,19 C415.666667,6.33333333 430.666667,0 448,0 Z M576,896 L576,897.08 C575.74,932.6 563.073333,962.573333 538,987 C512.666667,1011.66667 482.666667,1024 448,1024 C413.333333,1024 383.333333,1011.66667 358,987 C332.666667,962.333333 320,932 320,896 L576,896 Z',
|
4150 | yOffset: 0,
|
4151 | xOffset: 0,
|
4152 | };
|
4153 |
|
4154 | const BellIcon = createIcon(BellIconConfig);
|
4155 |
|
4156 | var BellIcon$1 = BellIcon;
|
4157 |
|
4158 | const variantIcons$2 = {
|
4159 | success: CheckCircleIcon$1,
|
4160 | danger: ExclamationCircleIcon$1,
|
4161 | warning: ExclamationTriangleIcon$1,
|
4162 | info: InfoCircleIcon$1,
|
4163 | default: BellIcon$1
|
4164 | };
|
4165 | const AlertIcon = (_a) => {
|
4166 | var { variant, customIcon, className = '' } = _a, props = __rest$1(_a, ["variant", "customIcon", "className"]);
|
4167 | const Icon = variantIcons$2[variant];
|
4168 | return (React__namespace.createElement("div", Object.assign({}, props, { className: css(styles$1a.alertIcon, className) }), customIcon || React__namespace.createElement(Icon, null)));
|
4169 | };
|
4170 |
|
4171 | const AlertContext = React__namespace.createContext(null);
|
4172 |
|
4173 | const c_alert__title_max_lines = {
|
4174 | "name": "--pf-c-alert__title--max-lines",
|
4175 | "value": "1",
|
4176 | "var": "var(--pf-c-alert__title--max-lines)"
|
4177 | };
|
4178 | var maxLines$2 = c_alert__title_max_lines;
|
4179 |
|
4180 | Promise.resolve().then(function () { return tooltip; });
|
4181 | var styles$19 = {
|
4182 | "modifiers": {
|
4183 | "top": "pf-m-top",
|
4184 | "topLeft": "pf-m-top-left",
|
4185 | "topRight": "pf-m-top-right",
|
4186 | "bottom": "pf-m-bottom",
|
4187 | "bottomLeft": "pf-m-bottom-left",
|
4188 | "bottomRight": "pf-m-bottom-right",
|
4189 | "left": "pf-m-left",
|
4190 | "leftTop": "pf-m-left-top",
|
4191 | "leftBottom": "pf-m-left-bottom",
|
4192 | "right": "pf-m-right",
|
4193 | "rightTop": "pf-m-right-top",
|
4194 | "rightBottom": "pf-m-right-bottom",
|
4195 | "textAlignLeft": "pf-m-text-align-left"
|
4196 | },
|
4197 | "tooltip": "pf-c-tooltip",
|
4198 | "tooltipArrow": "pf-c-tooltip__arrow",
|
4199 | "tooltipContent": "pf-c-tooltip__content"
|
4200 | };
|
4201 |
|
4202 | const TooltipContent = (_a) => {
|
4203 | var { className, children, isLeftAligned } = _a, props = __rest$1(_a, ["className", "children", "isLeftAligned"]);
|
4204 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$19.tooltipContent, isLeftAligned && styles$19.modifiers.textAlignLeft, className) }, props), children));
|
4205 | };
|
4206 | TooltipContent.displayName = 'TooltipContent';
|
4207 |
|
4208 | const TooltipArrow = (_a) => {
|
4209 | var { className } = _a, props = __rest$1(_a, ["className"]);
|
4210 | return React__namespace.createElement("div", Object.assign({ className: css(styles$19.tooltipArrow, className) }, props));
|
4211 | };
|
4212 | TooltipArrow.displayName = 'TooltipArrow';
|
4213 |
|
4214 | const c_tooltip_MaxWidth = {
|
4215 | "name": "--pf-c-tooltip--MaxWidth",
|
4216 | "value": "18.75rem",
|
4217 | "var": "var(--pf-c-tooltip--MaxWidth)"
|
4218 | };
|
4219 | var tooltipMaxWidth = c_tooltip_MaxWidth;
|
4220 |
|
4221 | exports.TooltipPosition = void 0;
|
4222 | (function (TooltipPosition) {
|
4223 | TooltipPosition["auto"] = "auto";
|
4224 | TooltipPosition["top"] = "top";
|
4225 | TooltipPosition["bottom"] = "bottom";
|
4226 | TooltipPosition["left"] = "left";
|
4227 | TooltipPosition["right"] = "right";
|
4228 | TooltipPosition["topStart"] = "top-start";
|
4229 | TooltipPosition["topEnd"] = "top-end";
|
4230 | TooltipPosition["bottomStart"] = "bottom-start";
|
4231 | TooltipPosition["bottomEnd"] = "bottom-end";
|
4232 | TooltipPosition["leftStart"] = "left-start";
|
4233 | TooltipPosition["leftEnd"] = "left-end";
|
4234 | TooltipPosition["rightStart"] = "right-start";
|
4235 | TooltipPosition["rightEnd"] = "right-end";
|
4236 | })(exports.TooltipPosition || (exports.TooltipPosition = {}));
|
4237 |
|
4238 | let pfTooltipIdCounter = 1;
|
4239 | const Tooltip = (_a) => {
|
4240 | var { content: bodyContent, position = 'top', trigger = 'mouseenter focus', isVisible = false, isContentLeftAligned = false, enableFlip = true, className = '', entryDelay = 300, exitDelay = 0, appendTo = () => document.body, zIndex = 9999, maxWidth = tooltipMaxWidth.value, distance = 15, aria = 'describedby',
|
4241 |
|
4242 | flipBehavior = ['top', 'right', 'bottom', 'left', 'top', 'right', 'bottom'], id = `pf-tooltip-${pfTooltipIdCounter++}`, children, animationDuration = 300, reference, 'aria-live': ariaLive = reference ? 'polite' : 'off', boundary, isAppLauncher, tippyProps } = _a, rest = __rest$1(_a, ["content", "position", "trigger", "isVisible", "isContentLeftAligned", "enableFlip", "className", "entryDelay", "exitDelay", "appendTo", "zIndex", "maxWidth", "distance", "aria", "flipBehavior", "id", "children", "animationDuration", "reference", 'aria-live', "boundary", "isAppLauncher", "tippyProps"]);
|
4243 | {
|
4244 | boundary !== undefined &&
|
4245 | console.warn('The Tooltip boundary prop has been deprecated. If you want to constrain the popper to a specific element use the appendTo prop instead.');
|
4246 | isAppLauncher !== undefined &&
|
4247 | console.warn('The Tooltip isAppLauncher prop has been deprecated and is no longer used.');
|
4248 | tippyProps !== undefined && console.warn('The Tooltip tippyProps prop has been deprecated and is no longer used.');
|
4249 | }
|
4250 | const triggerOnMouseenter = trigger.includes('mouseenter');
|
4251 | const triggerOnFocus = trigger.includes('focus');
|
4252 | const triggerOnClick = trigger.includes('click');
|
4253 | const triggerManually = trigger === 'manual';
|
4254 | const [visible, setVisible] = React__namespace.useState(false);
|
4255 | const [opacity, setOpacity] = React__namespace.useState(0);
|
4256 | const transitionTimerRef = React__namespace.useRef(null);
|
4257 | const showTimerRef = React__namespace.useRef(null);
|
4258 | const hideTimerRef = React__namespace.useRef(null);
|
4259 | const clearTimeouts = (timeoutRefs) => {
|
4260 | timeoutRefs.forEach(ref => {
|
4261 | if (ref.current) {
|
4262 | clearTimeout(ref.current);
|
4263 | }
|
4264 | });
|
4265 | };
|
4266 |
|
4267 | React__namespace.useEffect(() => () => {
|
4268 | clearTimeouts([transitionTimerRef, hideTimerRef, showTimerRef]);
|
4269 | }, []);
|
4270 | const onDocumentKeyDown = (event) => {
|
4271 | if (!triggerManually) {
|
4272 | if (event.keyCode === KEY_CODES.ESCAPE_KEY && visible) {
|
4273 | hide();
|
4274 | }
|
4275 | }
|
4276 | };
|
4277 | const onTriggerEnter = (event) => {
|
4278 | if (event.keyCode === KEY_CODES.ENTER) {
|
4279 | if (!visible) {
|
4280 | show();
|
4281 | }
|
4282 | else {
|
4283 | hide();
|
4284 | }
|
4285 | }
|
4286 | };
|
4287 | React__namespace.useEffect(() => {
|
4288 | if (isVisible) {
|
4289 | show();
|
4290 | }
|
4291 | else {
|
4292 | hide();
|
4293 | }
|
4294 | }, [isVisible]);
|
4295 | const show = () => {
|
4296 | clearTimeouts([transitionTimerRef, hideTimerRef]);
|
4297 | showTimerRef.current = setTimeout(() => {
|
4298 | setVisible(true);
|
4299 | setOpacity(1);
|
4300 | }, entryDelay);
|
4301 | };
|
4302 | const hide = () => {
|
4303 | clearTimeouts([showTimerRef]);
|
4304 | hideTimerRef.current = setTimeout(() => {
|
4305 | setOpacity(0);
|
4306 | transitionTimerRef.current = setTimeout(() => setVisible(false), animationDuration);
|
4307 | }, exitDelay);
|
4308 | };
|
4309 | const positionModifiers = {
|
4310 | top: styles$19.modifiers.top,
|
4311 | bottom: styles$19.modifiers.bottom,
|
4312 | left: styles$19.modifiers.left,
|
4313 | right: styles$19.modifiers.right,
|
4314 | 'top-start': styles$19.modifiers.topLeft,
|
4315 | 'top-end': styles$19.modifiers.topRight,
|
4316 | 'bottom-start': styles$19.modifiers.bottomLeft,
|
4317 | 'bottom-end': styles$19.modifiers.bottomRight,
|
4318 | 'left-start': styles$19.modifiers.leftTop,
|
4319 | 'left-end': styles$19.modifiers.leftBottom,
|
4320 | 'right-start': styles$19.modifiers.rightTop,
|
4321 | 'right-end': styles$19.modifiers.rightBottom
|
4322 | };
|
4323 | const hasCustomMaxWidth = maxWidth !== tooltipMaxWidth.value;
|
4324 | const content = (React__namespace.createElement("div", Object.assign({ "aria-live": ariaLive, className: css(styles$19.tooltip, className), role: "tooltip", id: id, style: {
|
4325 | maxWidth: hasCustomMaxWidth ? maxWidth : null,
|
4326 | opacity,
|
4327 | transition: getOpacityTransition(animationDuration)
|
4328 | } }, rest),
|
4329 | React__namespace.createElement(TooltipArrow, null),
|
4330 | React__namespace.createElement(TooltipContent, { isLeftAligned: isContentLeftAligned }, bodyContent)));
|
4331 | const onDocumentClick = (event, triggerElement) => {
|
4332 |
|
4333 |
|
4334 | {
|
4335 |
|
4336 | if (visible) {
|
4337 | hide();
|
4338 | }
|
4339 | else if (event.target === triggerElement) {
|
4340 | show();
|
4341 | }
|
4342 | }
|
4343 | };
|
4344 | const addAriaToTrigger = () => {
|
4345 | if (aria === 'describedby' && children && children.props && !children.props['aria-describedby']) {
|
4346 | return React__namespace.cloneElement(children, { 'aria-describedby': id });
|
4347 | }
|
4348 | else if (aria === 'labelledby' && children.props && !children.props['aria-labelledby']) {
|
4349 | return React__namespace.cloneElement(children, { 'aria-labelledby': id });
|
4350 | }
|
4351 | return children;
|
4352 | };
|
4353 | return (React__namespace.createElement(Popper, { trigger: aria !== 'none' && visible ? addAriaToTrigger() : children, reference: reference, popper: content, popperMatchesTriggerWidth: false, appendTo: appendTo, isVisible: visible, positionModifiers: positionModifiers, distance: distance, placement: position, onMouseEnter: triggerOnMouseenter && show, onMouseLeave: triggerOnMouseenter && hide, onFocus: triggerOnFocus && show, onBlur: triggerOnFocus && hide, onDocumentClick: triggerOnClick && onDocumentClick, onDocumentKeyDown: triggerManually ? null : onDocumentKeyDown, onTriggerEnter: triggerManually ? null : onTriggerEnter, enableFlip: enableFlip, zIndex: zIndex, flipBehavior: flipBehavior }));
|
4354 | };
|
4355 | Tooltip.displayName = 'Tooltip';
|
4356 |
|
4357 | const AlertToggleExpandButton = (_a) => {
|
4358 | var { 'aria-label': ariaLabel, variantLabel, onToggleExpand, isExpanded } = _a, props = __rest$1(_a, ['aria-label', "variantLabel", "onToggleExpand", "isExpanded"]);
|
4359 | const { title, variantLabel: alertVariantLabel } = React__namespace.useContext(AlertContext);
|
4360 | return (React__namespace.createElement(Button, Object.assign({ variant: exports.ButtonVariant.plain, onClick: onToggleExpand, "aria-expanded": isExpanded, "aria-label": ariaLabel === '' ? `Toggle ${variantLabel || alertVariantLabel} alert: ${title}` : ariaLabel }, props),
|
4361 | React__namespace.createElement("span", { className: css(styles$1a.alertToggleIcon) },
|
4362 | React__namespace.createElement(AngleRightIcon$1, { "aria-hidden": "true" }))));
|
4363 | };
|
4364 | AlertToggleExpandButton.displayName = 'AlertToggleExpandButton';
|
4365 |
|
4366 | exports.AlertVariant = void 0;
|
4367 | (function (AlertVariant) {
|
4368 | AlertVariant["success"] = "success";
|
4369 | AlertVariant["danger"] = "danger";
|
4370 | AlertVariant["warning"] = "warning";
|
4371 | AlertVariant["info"] = "info";
|
4372 | AlertVariant["default"] = "default";
|
4373 | })(exports.AlertVariant || (exports.AlertVariant = {}));
|
4374 | const Alert = (_a) => {
|
4375 | var { variant = exports.AlertVariant.default, isInline = false, isPlain = false, isLiveRegion = false, variantLabel = `${capitalize(variant)} alert:`, 'aria-label': ariaLabel = `${capitalize(variant)} Alert`, actionClose, actionLinks, title, titleHeadingLevel: TitleHeadingLevel = 'h4', children = '', className = '', ouiaId, ouiaSafe = true, timeout = false, timeoutAnimation = 3000, onTimeout = () => { }, truncateTitle = 0, tooltipPosition, customIcon, isExpandable = false, toggleAriaLabel = `${capitalize(variant)} alert details`, onMouseEnter = () => { }, onMouseLeave = () => { } } = _a, props = __rest$1(_a, ["variant", "isInline", "isPlain", "isLiveRegion", "variantLabel", 'aria-label', "actionClose", "actionLinks", "title", "titleHeadingLevel", "children", "className", "ouiaId", "ouiaSafe", "timeout", "timeoutAnimation", "onTimeout", "truncateTitle", "tooltipPosition", "customIcon", "isExpandable", "toggleAriaLabel", "onMouseEnter", "onMouseLeave"]);
|
4376 | const ouiaProps = useOUIAProps(Alert.displayName, ouiaId, ouiaSafe, variant);
|
4377 | const getHeadingContent = (React__namespace.createElement(React__namespace.Fragment, null,
|
4378 | React__namespace.createElement("span", { className: css(a11yStyles.screenReader) }, variantLabel),
|
4379 | title));
|
4380 | const titleRef = React__namespace.useRef(null);
|
4381 | const divRef = React__namespace.useRef();
|
4382 | const [isTooltipVisible, setIsTooltipVisible] = React.useState(false);
|
4383 | React__namespace.useEffect(() => {
|
4384 | if (!titleRef.current || !truncateTitle) {
|
4385 | return;
|
4386 | }
|
4387 | titleRef.current.style.setProperty(maxLines$2.name, truncateTitle.toString());
|
4388 | const showTooltip = titleRef.current && titleRef.current.offsetHeight < titleRef.current.scrollHeight;
|
4389 | if (isTooltipVisible !== showTooltip) {
|
4390 | setIsTooltipVisible(showTooltip);
|
4391 | }
|
4392 | }, [titleRef, truncateTitle, isTooltipVisible]);
|
4393 | const [timedOut, setTimedOut] = React.useState(false);
|
4394 | const [timedOutAnimation, setTimedOutAnimation] = React.useState(true);
|
4395 | const [isMouseOver, setIsMouseOver] = React.useState();
|
4396 | const [containsFocus, setContainsFocus] = React.useState();
|
4397 | const dismissed = timedOut && timedOutAnimation && !isMouseOver && !containsFocus;
|
4398 | React__namespace.useEffect(() => {
|
4399 | timeout = timeout === true ? 8000 : Number(timeout);
|
4400 | if (timeout > 0) {
|
4401 | const timer = setTimeout(() => setTimedOut(true), timeout);
|
4402 | return () => clearTimeout(timer);
|
4403 | }
|
4404 | }, []);
|
4405 | React__namespace.useEffect(() => {
|
4406 | const onDocumentFocus = () => {
|
4407 | if (divRef.current) {
|
4408 | if (divRef.current.contains(document.activeElement)) {
|
4409 | setContainsFocus(true);
|
4410 | setTimedOutAnimation(false);
|
4411 | }
|
4412 | else if (containsFocus) {
|
4413 | setContainsFocus(false);
|
4414 | }
|
4415 | }
|
4416 | };
|
4417 | document.addEventListener('focus', onDocumentFocus, true);
|
4418 | return () => document.removeEventListener('focus', onDocumentFocus, true);
|
4419 | }, [containsFocus]);
|
4420 | React__namespace.useEffect(() => {
|
4421 | if (containsFocus === false || isMouseOver === false) {
|
4422 | const timer = setTimeout(() => setTimedOutAnimation(true), timeoutAnimation);
|
4423 | return () => clearTimeout(timer);
|
4424 | }
|
4425 | }, [containsFocus, isMouseOver]);
|
4426 | React__namespace.useEffect(() => {
|
4427 | dismissed && onTimeout();
|
4428 | }, [dismissed]);
|
4429 | const [isExpanded, setIsExpanded] = React.useState(false);
|
4430 | const onToggleExpand = () => {
|
4431 | setIsExpanded(!isExpanded);
|
4432 | };
|
4433 | const myOnMouseEnter = (ev) => {
|
4434 | setIsMouseOver(true);
|
4435 | setTimedOutAnimation(false);
|
4436 | onMouseEnter(ev);
|
4437 | };
|
4438 | const myOnMouseLeave = (ev) => {
|
4439 | setIsMouseOver(false);
|
4440 | onMouseLeave(ev);
|
4441 | };
|
4442 | if (dismissed) {
|
4443 | return null;
|
4444 | }
|
4445 | const Title = (React__namespace.createElement(TitleHeadingLevel, Object.assign({}, (isTooltipVisible && { tabIndex: 0 }), { ref: titleRef, className: css(styles$1a.alertTitle, truncateTitle && styles$1a.modifiers.truncate) }), getHeadingContent));
|
4446 | return (React__namespace.createElement("div", Object.assign({ ref: divRef, className: css(styles$1a.alert, isInline && styles$1a.modifiers.inline, isPlain && styles$1a.modifiers.plain, isExpandable && styles$1a.modifiers.expandable, isExpanded && styles$1a.modifiers.expanded, styles$1a.modifiers[variant], className), "aria-label": ariaLabel }, ouiaProps, (isLiveRegion && {
|
4447 | 'aria-live': 'polite',
|
4448 | 'aria-atomic': 'false'
|
4449 | }), { onMouseEnter: myOnMouseEnter, onMouseLeave: myOnMouseLeave }, props),
|
4450 | isExpandable && (React__namespace.createElement(AlertContext.Provider, { value: { title, variantLabel } },
|
4451 | React__namespace.createElement("div", { className: css(styles$1a.alertToggle) },
|
4452 | React__namespace.createElement(AlertToggleExpandButton, { isExpanded: isExpanded, onToggleExpand: onToggleExpand, "aria-label": toggleAriaLabel })))),
|
4453 | React__namespace.createElement(AlertIcon, { variant: variant, customIcon: customIcon }),
|
4454 | isTooltipVisible ? (React__namespace.createElement(Tooltip, { content: getHeadingContent, position: tooltipPosition }, Title)) : (Title),
|
4455 | actionClose && (React__namespace.createElement(AlertContext.Provider, { value: { title, variantLabel } },
|
4456 | React__namespace.createElement("div", { className: css(styles$1a.alertAction) }, actionClose))),
|
4457 | children && (!isExpandable || (isExpandable && isExpanded)) && (React__namespace.createElement("div", { className: css(styles$1a.alertDescription) }, children)),
|
4458 | actionLinks && React__namespace.createElement("div", { className: css(styles$1a.alertActionGroup) }, actionLinks)));
|
4459 | };
|
4460 | Alert.displayName = 'Alert';
|
4461 |
|
4462 | const AlertActionCloseButton = (_a) => {
|
4463 | var {
|
4464 |
|
4465 | className = '', onClose = () => undefined, 'aria-label': ariaLabel = '', variantLabel } = _a, props = __rest$1(_a, ["className", "onClose", 'aria-label', "variantLabel"]);
|
4466 | return (React__namespace.createElement(AlertContext.Consumer, null, ({ title, variantLabel: alertVariantLabel }) => (React__namespace.createElement(Button, Object.assign({ variant: exports.ButtonVariant.plain, onClick: onClose, "aria-label": ariaLabel === '' ? `Close ${variantLabel || alertVariantLabel} alert: ${title}` : ariaLabel }, props),
|
4467 | React__namespace.createElement(TimesIcon$1, null)))));
|
4468 | };
|
4469 | AlertActionCloseButton.displayName = 'AlertActionCloseButton';
|
4470 |
|
4471 | const AlertActionLink = (_a) => {
|
4472 | var { className = '', children } = _a, props = __rest$1(_a, ["className", "children"]);
|
4473 | return (React__namespace.createElement(Button, Object.assign({ variant: exports.ButtonVariant.link, isInline: true, className: className }, props), children));
|
4474 | };
|
4475 | AlertActionLink.displayName = 'AlertActionLink';
|
4476 |
|
4477 | Promise.resolve().then(function () { return alertGroup; });
|
4478 | var styles$18 = {
|
4479 | "alertGroup": "pf-c-alert-group",
|
4480 | "alertGroupOverflowButton": "pf-c-alert-group__overflow-button",
|
4481 | "modifiers": {
|
4482 | "toast": "pf-m-toast"
|
4483 | }
|
4484 | };
|
4485 |
|
4486 | const AlertGroupInline = (_a) => {
|
4487 | var { className, children, isToast, isLiveRegion, onOverflowClick, overflowMessage } = _a, rest = __rest$1(_a, ["className", "children", "isToast", "isLiveRegion", "onOverflowClick", "overflowMessage"]);
|
4488 | return (React__namespace.createElement("ul", Object.assign({ "aria-live": isLiveRegion ? 'polite' : null, "aria-atomic": isLiveRegion ? false : null, className: css(styles$18.alertGroup, className, isToast ? styles$18.modifiers.toast : '') }, rest),
|
4489 | React__namespace.Children.toArray(children).map((Alert, index) => (React__namespace.createElement("li", { key: index }, Alert))),
|
4490 | overflowMessage && (React__namespace.createElement("li", null,
|
4491 | React__namespace.createElement("button", { onClick: onOverflowClick, className: css(styles$18.alertGroupOverflowButton) }, overflowMessage)))));
|
4492 | };
|
4493 | AlertGroupInline.displayName = 'AlertGroupInline';
|
4494 |
|
4495 | class AlertGroup extends React__namespace.Component {
|
4496 | constructor() {
|
4497 | super(...arguments);
|
4498 | this.state = {
|
4499 | container: undefined
|
4500 | };
|
4501 | }
|
4502 | componentDidMount() {
|
4503 | const container = document.createElement('div');
|
4504 | const target = this.getTargetElement();
|
4505 | this.setState({ container });
|
4506 | target.appendChild(container);
|
4507 | }
|
4508 | componentWillUnmount() {
|
4509 | const target = this.getTargetElement();
|
4510 | if (this.state.container) {
|
4511 | target.removeChild(this.state.container);
|
4512 | }
|
4513 | }
|
4514 | getTargetElement() {
|
4515 | const appendTo = this.props.appendTo;
|
4516 | if (typeof appendTo === 'function') {
|
4517 | return appendTo();
|
4518 | }
|
4519 | return appendTo || document.body;
|
4520 | }
|
4521 | render() {
|
4522 | const _a = this.props, { className, children, isToast, isLiveRegion, onOverflowClick, overflowMessage } = _a, props = __rest$1(_a, ["className", "children", "isToast", "isLiveRegion", "onOverflowClick", "overflowMessage"]);
|
4523 | const alertGroup = (React__namespace.createElement(AlertGroupInline, Object.assign({ onOverflowClick: onOverflowClick, className: className, isToast: isToast, isLiveRegion: isLiveRegion, overflowMessage: overflowMessage }, props), children));
|
4524 | if (!this.props.isToast) {
|
4525 | return alertGroup;
|
4526 | }
|
4527 | const container = this.state.container;
|
4528 | if (!canUseDOM || !container) {
|
4529 | return null;
|
4530 | }
|
4531 | return ReactDOM__namespace.createPortal(alertGroup, container);
|
4532 | }
|
4533 | }
|
4534 | AlertGroup.displayName = 'AlertGroup';
|
4535 |
|
4536 | Promise.resolve().then(function () { return appLauncher; });
|
4537 | var styles$17 = {
|
4538 | "appLauncher": "pf-c-app-launcher",
|
4539 | "appLauncherGroup": "pf-c-app-launcher__group",
|
4540 | "appLauncherGroupTitle": "pf-c-app-launcher__group-title",
|
4541 | "appLauncherMenu": "pf-c-app-launcher__menu",
|
4542 | "appLauncherMenuItem": "pf-c-app-launcher__menu-item",
|
4543 | "appLauncherMenuItemExternalIcon": "pf-c-app-launcher__menu-item-external-icon",
|
4544 | "appLauncherMenuItemIcon": "pf-c-app-launcher__menu-item-icon",
|
4545 | "appLauncherMenuSearch": "pf-c-app-launcher__menu-search",
|
4546 | "appLauncherMenuWrapper": "pf-c-app-launcher__menu-wrapper",
|
4547 | "appLauncherToggle": "pf-c-app-launcher__toggle",
|
4548 | "divider": "pf-c-divider",
|
4549 | "modifiers": {
|
4550 | "expanded": "pf-m-expanded",
|
4551 | "active": "pf-m-active",
|
4552 | "alignRight": "pf-m-align-right",
|
4553 | "top": "pf-m-top",
|
4554 | "favorite": "pf-m-favorite",
|
4555 | "focus": "pf-m-focus",
|
4556 | "disabled": "pf-m-disabled",
|
4557 | "external": "pf-m-external",
|
4558 | "link": "pf-m-link",
|
4559 | "action": "pf-m-action"
|
4560 | }
|
4561 | };
|
4562 |
|
4563 | Promise.resolve().then(function () { return formControl; });
|
4564 | var formStyles = {
|
4565 | "formControl": "pf-c-form-control",
|
4566 | "modifiers": {
|
4567 | "success": "pf-m-success",
|
4568 | "expanded": "pf-m-expanded",
|
4569 | "icon": "pf-m-icon",
|
4570 | "warning": "pf-m-warning",
|
4571 | "search": "pf-m-search",
|
4572 | "calendar": "pf-m-calendar",
|
4573 | "clock": "pf-m-clock",
|
4574 | "iconSprite": "pf-m-icon-sprite",
|
4575 | "placeholder": "pf-m-placeholder",
|
4576 | "resizeVertical": "pf-m-resize-vertical",
|
4577 | "resizeHorizontal": "pf-m-resize-horizontal"
|
4578 | }
|
4579 | };
|
4580 |
|
4581 | const ThIconConfig = {
|
4582 | name: 'ThIcon',
|
4583 | height: 512,
|
4584 | width: 512,
|
4585 | svgPath: 'M149.333 56v80c0 13.255-10.745 24-24 24H24c-13.255 0-24-10.745-24-24V56c0-13.255 10.745-24 24-24h101.333c13.255 0 24 10.745 24 24zm181.334 240v-80c0-13.255-10.745-24-24-24H205.333c-13.255 0-24 10.745-24 24v80c0 13.255 10.745 24 24 24h101.333c13.256 0 24.001-10.745 24.001-24zm32-240v80c0 13.255 10.745 24 24 24H488c13.255 0 24-10.745 24-24V56c0-13.255-10.745-24-24-24H386.667c-13.255 0-24 10.745-24 24zm-32 80V56c0-13.255-10.745-24-24-24H205.333c-13.255 0-24 10.745-24 24v80c0 13.255 10.745 24 24 24h101.333c13.256 0 24.001-10.745 24.001-24zm-205.334 56H24c-13.255 0-24 10.745-24 24v80c0 13.255 10.745 24 24 24h101.333c13.255 0 24-10.745 24-24v-80c0-13.255-10.745-24-24-24zM0 376v80c0 13.255 10.745 24 24 24h101.333c13.255 0 24-10.745 24-24v-80c0-13.255-10.745-24-24-24H24c-13.255 0-24 10.745-24 24zm386.667-56H488c13.255 0 24-10.745 24-24v-80c0-13.255-10.745-24-24-24H386.667c-13.255 0-24 10.745-24 24v80c0 13.255 10.745 24 24 24zm0 160H488c13.255 0 24-10.745 24-24v-80c0-13.255-10.745-24-24-24H386.667c-13.255 0-24 10.745-24 24v80c0 13.255 10.745 24 24 24zM181.333 376v80c0 13.255 10.745 24 24 24h101.333c13.255 0 24-10.745 24-24v-80c0-13.255-10.745-24-24-24H205.333c-13.255 0-24 10.745-24 24z',
|
4586 | yOffset: 0,
|
4587 | xOffset: 0,
|
4588 | };
|
4589 |
|
4590 | const ThIcon = createIcon(ThIconConfig);
|
4591 |
|
4592 | var ThIcon$1 = ThIcon;
|
4593 |
|
4594 | Promise.resolve().then(function () { return dropdown; });
|
4595 | var styles$16 = {
|
4596 | "badge": "pf-c-badge",
|
4597 | "check": "pf-c-check",
|
4598 | "divider": "pf-c-divider",
|
4599 | "dropdown": "pf-c-dropdown",
|
4600 | "dropdownGroup": "pf-c-dropdown__group",
|
4601 | "dropdownGroupTitle": "pf-c-dropdown__group-title",
|
4602 | "dropdownMenu": "pf-c-dropdown__menu",
|
4603 | "dropdownMenuItem": "pf-c-dropdown__menu-item",
|
4604 | "dropdownMenuItemDescription": "pf-c-dropdown__menu-item-description",
|
4605 | "dropdownMenuItemIcon": "pf-c-dropdown__menu-item-icon",
|
4606 | "dropdownMenuItemMain": "pf-c-dropdown__menu-item-main",
|
4607 | "dropdownToggle": "pf-c-dropdown__toggle",
|
4608 | "dropdownToggleButton": "pf-c-dropdown__toggle-button",
|
4609 | "dropdownToggleCheck": "pf-c-dropdown__toggle-check",
|
4610 | "dropdownToggleIcon": "pf-c-dropdown__toggle-icon",
|
4611 | "dropdownToggleImage": "pf-c-dropdown__toggle-image",
|
4612 | "dropdownToggleText": "pf-c-dropdown__toggle-text",
|
4613 | "menu": "pf-c-menu",
|
4614 | "modifiers": {
|
4615 | "fullHeight": "pf-m-full-height",
|
4616 | "expanded": "pf-m-expanded",
|
4617 | "action": "pf-m-action",
|
4618 | "disabled": "pf-m-disabled",
|
4619 | "plain": "pf-m-plain",
|
4620 | "text": "pf-m-text",
|
4621 | "splitButton": "pf-m-split-button",
|
4622 | "primary": "pf-m-primary",
|
4623 | "active": "pf-m-active",
|
4624 | "secondary": "pf-m-secondary",
|
4625 | "top": "pf-m-top",
|
4626 | "alignRight": "pf-m-align-right",
|
4627 | "alignLeft": "pf-m-align-left",
|
4628 | "alignRightOnSm": "pf-m-align-right-on-sm",
|
4629 | "alignLeftOnSm": "pf-m-align-left-on-sm",
|
4630 | "alignRightOnMd": "pf-m-align-right-on-md",
|
4631 | "alignLeftOnMd": "pf-m-align-left-on-md",
|
4632 | "alignRightOnLg": "pf-m-align-right-on-lg",
|
4633 | "alignLeftOnLg": "pf-m-align-left-on-lg",
|
4634 | "alignRightOnXl": "pf-m-align-right-on-xl",
|
4635 | "alignLeftOnXl": "pf-m-align-left-on-xl",
|
4636 | "alignRightOn_2xl": "pf-m-align-right-on-2xl",
|
4637 | "alignLeftOn_2xl": "pf-m-align-left-on-2xl",
|
4638 | "ariaDisabled": "pf-m-aria-disabled",
|
4639 | "icon": "pf-m-icon",
|
4640 | "description": "pf-m-description"
|
4641 | }
|
4642 | };
|
4643 |
|
4644 | exports.DropdownPosition = void 0;
|
4645 | (function (DropdownPosition) {
|
4646 | DropdownPosition["right"] = "right";
|
4647 | DropdownPosition["left"] = "left";
|
4648 | })(exports.DropdownPosition || (exports.DropdownPosition = {}));
|
4649 | exports.DropdownDirection = void 0;
|
4650 | (function (DropdownDirection) {
|
4651 | DropdownDirection["up"] = "up";
|
4652 | DropdownDirection["down"] = "down";
|
4653 | })(exports.DropdownDirection || (exports.DropdownDirection = {}));
|
4654 | const DropdownContext = React__namespace.createContext({
|
4655 |
|
4656 | onSelect: (event) => undefined,
|
4657 | id: '',
|
4658 | toggleIndicatorClass: '',
|
4659 | toggleIconClass: '',
|
4660 | toggleTextClass: '',
|
4661 | menuClass: '',
|
4662 | itemClass: '',
|
4663 | toggleClass: '',
|
4664 | baseClass: '',
|
4665 | baseComponent: 'div',
|
4666 | sectionClass: '',
|
4667 | sectionTitleClass: '',
|
4668 | sectionComponent: 'section',
|
4669 | disabledClass: '',
|
4670 | plainTextClass: '',
|
4671 | menuComponent: 'ul'
|
4672 | });
|
4673 | const DropdownArrowContext = React__namespace.createContext({
|
4674 | keyHandler: null,
|
4675 | sendRef: null
|
4676 | });
|
4677 |
|
4678 | class DropdownMenu extends React__namespace.Component {
|
4679 | constructor() {
|
4680 | super(...arguments);
|
4681 | this.refsCollection = [];
|
4682 | this.componentWillUnmount = () => {
|
4683 | document.removeEventListener('keydown', this.onKeyDown);
|
4684 | };
|
4685 | this.onKeyDown = (event) => {
|
4686 | if (!this.props.isOpen ||
|
4687 | !Array.from(document.activeElement.classList).find(className => DropdownMenu.validToggleClasses.concat(this.context.toggleClass).includes(className))) {
|
4688 | return;
|
4689 | }
|
4690 | const refs = this.refsCollection;
|
4691 | if (event.key === 'ArrowDown') {
|
4692 | const firstFocusTargetCollection = refs.find(ref => ref && ref[0] && !ref[0].hasAttribute('disabled'));
|
4693 | DropdownMenu.focusFirstRef(firstFocusTargetCollection);
|
4694 | event.stopPropagation();
|
4695 | }
|
4696 | else if (event.key === 'ArrowUp') {
|
4697 | const collectionLength = refs.length;
|
4698 | const lastFocusTargetCollection = refs.slice(collectionLength - 1, collectionLength);
|
4699 | const lastFocusTarget = lastFocusTargetCollection && lastFocusTargetCollection[0];
|
4700 | DropdownMenu.focusFirstRef(lastFocusTarget);
|
4701 | event.stopPropagation();
|
4702 | }
|
4703 | };
|
4704 | this.childKeyHandler = (index, innerIndex, position, custom = false) => {
|
4705 | keyHandler(index, innerIndex, position, this.refsCollection, this.props.isGrouped ? this.refsCollection : React__namespace.Children.toArray(this.props.children), custom);
|
4706 | };
|
4707 | this.sendRef = (index, nodes, isDisabled, isSeparator) => {
|
4708 | this.refsCollection[index] = [];
|
4709 | nodes.map((node, innerIndex) => {
|
4710 | if (!node) {
|
4711 | this.refsCollection[index][innerIndex] = null;
|
4712 | }
|
4713 | else if (!node.getAttribute) {
|
4714 |
|
4715 | this.refsCollection[index][innerIndex] = ReactDOM__namespace.findDOMNode(node);
|
4716 | }
|
4717 | else if (isSeparator) {
|
4718 | this.refsCollection[index][innerIndex] = null;
|
4719 | }
|
4720 | else {
|
4721 | this.refsCollection[index][innerIndex] = node;
|
4722 | }
|
4723 | });
|
4724 | };
|
4725 | }
|
4726 | componentDidMount() {
|
4727 | document.addEventListener('keydown', this.onKeyDown);
|
4728 | const { autoFocus } = this.props;
|
4729 | if (autoFocus) {
|
4730 |
|
4731 | const focusTargetCollection = this.refsCollection.find(ref => ref && ref[0] && !ref[0].hasAttribute('disabled'));
|
4732 | const focusTarget = focusTargetCollection && focusTargetCollection[0];
|
4733 | if (focusTarget && focusTarget.focus) {
|
4734 | setTimeout(() => focusTarget.focus());
|
4735 | }
|
4736 | }
|
4737 | }
|
4738 | shouldComponentUpdate() {
|
4739 |
|
4740 | this.refsCollection = [];
|
4741 | return true;
|
4742 | }
|
4743 | extendChildren() {
|
4744 | const { children, isGrouped } = this.props;
|
4745 | if (isGrouped) {
|
4746 | let index = 0;
|
4747 | return React__namespace.Children.map(children, groupedChildren => {
|
4748 | const group = groupedChildren;
|
4749 | const props = {};
|
4750 | if (group.props && group.props.children) {
|
4751 | if (Array.isArray(group.props.children)) {
|
4752 | props.children = React__namespace.Children.map(group.props.children, option => React__namespace.cloneElement(option, {
|
4753 | index: index++
|
4754 | }));
|
4755 | }
|
4756 | else {
|
4757 | props.children = React__namespace.cloneElement(group.props.children, {
|
4758 | index: index++
|
4759 | });
|
4760 | }
|
4761 | }
|
4762 | return React__namespace.cloneElement(group, props);
|
4763 | });
|
4764 | }
|
4765 | return React__namespace.Children.map(children, (child, index) => React__namespace.cloneElement(child, {
|
4766 | index
|
4767 | }));
|
4768 | }
|
4769 | render() {
|
4770 | const _a = this.props, { className, isOpen, position, children, component, isGrouped, setMenuComponentRef,
|
4771 |
|
4772 | openedOnEnter, alignments } = _a, props = __rest$1(_a, ["className", "isOpen", "position", "children", "component", "isGrouped", "setMenuComponentRef", "openedOnEnter", "alignments"]);
|
4773 | return (React__namespace.createElement(DropdownArrowContext.Provider, { value: {
|
4774 | keyHandler: this.childKeyHandler,
|
4775 | sendRef: this.sendRef
|
4776 | } }, component === 'div' ? (React__namespace.createElement(DropdownContext.Consumer, null, ({ onSelect, menuClass }) => (React__namespace.createElement("div", { className: css(menuClass, position === exports.DropdownPosition.right && styles$16.modifiers.alignRight, formatBreakpointMods(alignments, styles$16, 'align-'), className), hidden: !isOpen, onClick: event => onSelect && onSelect(event), ref: setMenuComponentRef }, children)))) : ((isGrouped && (React__namespace.createElement(DropdownContext.Consumer, null, ({ menuClass, menuComponent }) => {
|
4777 | const MenuComponent = (menuComponent || 'div');
|
4778 | return (React__namespace.createElement(MenuComponent, Object.assign({}, props, { className: css(menuClass, position === exports.DropdownPosition.right && styles$16.modifiers.alignRight, formatBreakpointMods(alignments, styles$16, 'align-'), className), hidden: !isOpen, role: "menu", ref: setMenuComponentRef }), this.extendChildren()));
|
4779 | }))) || (React__namespace.createElement(DropdownContext.Consumer, null, ({ menuClass, menuComponent }) => {
|
4780 | const MenuComponent = (menuComponent || component);
|
4781 | return (React__namespace.createElement(MenuComponent, Object.assign({}, props, { className: css(menuClass, position === exports.DropdownPosition.right && styles$16.modifiers.alignRight, formatBreakpointMods(alignments, styles$16, 'align-'), className), hidden: !isOpen, role: "menu", ref: setMenuComponentRef }), this.extendChildren()));
|
4782 | })))));
|
4783 | }
|
4784 | }
|
4785 | DropdownMenu.displayName = 'DropdownMenu';
|
4786 | DropdownMenu.defaultProps = {
|
4787 | className: '',
|
4788 | isOpen: true,
|
4789 | openedOnEnter: false,
|
4790 | autoFocus: true,
|
4791 | position: exports.DropdownPosition.left,
|
4792 | component: 'ul',
|
4793 | isGrouped: false,
|
4794 | setMenuComponentRef: null
|
4795 | };
|
4796 | DropdownMenu.validToggleClasses = [styles$16.dropdownToggle, styles$16.dropdownToggleButton];
|
4797 | DropdownMenu.focusFirstRef = (refCollection) => {
|
4798 | if (refCollection && refCollection[0] && refCollection[0].focus) {
|
4799 | setTimeout(() => refCollection[0].focus());
|
4800 | }
|
4801 | };
|
4802 | DropdownMenu.contextType = DropdownContext;
|
4803 |
|
4804 | class DropdownWithContext extends React__namespace.Component {
|
4805 | constructor(props) {
|
4806 | super(props);
|
4807 | this.openedOnEnter = false;
|
4808 | this.baseComponentRef = React__namespace.createRef();
|
4809 | this.menuComponentRef = React__namespace.createRef();
|
4810 | this.onEnter = () => {
|
4811 | this.openedOnEnter = true;
|
4812 | };
|
4813 | this.setMenuComponentRef = (element) => {
|
4814 | this.menuComponentRef = element;
|
4815 | };
|
4816 | this.getMenuComponentRef = () => this.menuComponentRef;
|
4817 | if (props.dropdownItems && props.dropdownItems.length > 0 && props.children) {
|
4818 |
|
4819 | console.error('Children and dropdownItems props have been provided. Only the dropdownItems prop items will be rendered');
|
4820 | }
|
4821 | }
|
4822 | componentDidUpdate() {
|
4823 | if (!this.props.isOpen) {
|
4824 | this.openedOnEnter = false;
|
4825 | }
|
4826 | }
|
4827 | render() {
|
4828 | const _a = this.props, { children, className, direction, dropdownItems, isOpen, isPlain, isText, isGrouped, isFullHeight,
|
4829 |
|
4830 | onSelect, position, toggle, autoFocus, menuAppendTo } = _a, props = __rest$1(_a, ["children", "className", "direction", "dropdownItems", "isOpen", "isPlain", "isText", "isGrouped", "isFullHeight", "onSelect", "position", "toggle", "autoFocus", "menuAppendTo"]);
|
4831 | const id = toggle.props.id || `pf-dropdown-toggle-id-${DropdownWithContext.currentId++}`;
|
4832 | let component;
|
4833 | let renderedContent;
|
4834 | let ariaHasPopup = false;
|
4835 | if (dropdownItems && dropdownItems.length > 0) {
|
4836 | component = 'ul';
|
4837 | renderedContent = dropdownItems;
|
4838 | ariaHasPopup = true;
|
4839 | }
|
4840 | else {
|
4841 | component = 'div';
|
4842 | renderedContent = React__namespace.Children.toArray(children);
|
4843 | }
|
4844 | const openedOnEnter = this.openedOnEnter;
|
4845 | return (React__namespace.createElement(DropdownContext.Consumer, null, ({ baseClass, baseComponent, id: contextId, ouiaId, ouiaComponentType, ouiaSafe, alignments }) => {
|
4846 | const BaseComponent = baseComponent;
|
4847 | const menuContainer = (React__namespace.createElement(DropdownMenu, { setMenuComponentRef: this.setMenuComponentRef, component: component, isOpen: isOpen, position: position, "aria-labelledby": contextId ? `${contextId}-toggle` : id, isGrouped: isGrouped, autoFocus: openedOnEnter && autoFocus, alignments: alignments }, renderedContent));
|
4848 | const popperContainer = (React__namespace.createElement("div", { className: css(baseClass, direction === exports.DropdownDirection.up && styles$16.modifiers.top, position === exports.DropdownPosition.right && styles$16.modifiers.alignRight, isOpen && styles$16.modifiers.expanded, className) }, isOpen && menuContainer));
|
4849 | const mainContainer = (React__namespace.createElement(BaseComponent, Object.assign({}, props, { className: css(baseClass, direction === exports.DropdownDirection.up && styles$16.modifiers.top, position === exports.DropdownPosition.right && styles$16.modifiers.alignRight, isOpen && styles$16.modifiers.expanded, isFullHeight && styles$16.modifiers.fullHeight, className), ref: this.baseComponentRef }, getOUIAProps(ouiaComponentType, ouiaId, ouiaSafe)),
|
4850 | React__namespace.Children.map(toggle, oneToggle => React__namespace.cloneElement(oneToggle, {
|
4851 | parentRef: this.baseComponentRef,
|
4852 | getMenuRef: this.getMenuComponentRef,
|
4853 | isOpen,
|
4854 | id,
|
4855 | isPlain,
|
4856 | isText,
|
4857 | 'aria-haspopup': ariaHasPopup,
|
4858 | onEnter: () => {
|
4859 | this.onEnter();
|
4860 | oneToggle.props.onEnter && oneToggle.props.onEnter();
|
4861 | }
|
4862 | })),
|
4863 | menuAppendTo === 'inline' && isOpen && menuContainer));
|
4864 | const getParentElement = () => {
|
4865 | if (this.baseComponentRef && this.baseComponentRef.current) {
|
4866 | return this.baseComponentRef.current.parentElement;
|
4867 | }
|
4868 | return null;
|
4869 | };
|
4870 | return menuAppendTo === 'inline' ? (mainContainer) : (React__namespace.createElement(Popper, { trigger: mainContainer, popper: popperContainer, direction: direction, position: position, appendTo: menuAppendTo === 'parent' ? getParentElement() : menuAppendTo, isVisible: isOpen }));
|
4871 | }));
|
4872 | }
|
4873 | }
|
4874 | DropdownWithContext.displayName = 'DropdownWithContext';
|
4875 |
|
4876 | DropdownWithContext.currentId = 0;
|
4877 | DropdownWithContext.defaultProps = {
|
4878 | className: '',
|
4879 | dropdownItems: [],
|
4880 | isOpen: false,
|
4881 | isPlain: false,
|
4882 | isText: false,
|
4883 | isGrouped: false,
|
4884 | position: exports.DropdownPosition.left,
|
4885 | direction: exports.DropdownDirection.down,
|
4886 | onSelect: () => undefined,
|
4887 | autoFocus: true,
|
4888 | menuAppendTo: 'inline'
|
4889 | };
|
4890 |
|
4891 | const Dropdown = (_a) => {
|
4892 | var { onSelect,
|
4893 |
|
4894 | ref,
|
4895 | ouiaId, ouiaSafe, alignments, contextProps } = _a, props = __rest$1(_a, ["onSelect", "ref", "ouiaId", "ouiaSafe", "alignments", "contextProps"]);
|
4896 | return (React__namespace.createElement(DropdownContext.Provider, { value: Object.assign({ onSelect: event => onSelect && onSelect(event), toggleTextClass: styles$16.dropdownToggleText, toggleIconClass: styles$16.dropdownToggleImage, toggleIndicatorClass: styles$16.dropdownToggleIcon, menuClass: styles$16.dropdownMenu, itemClass: styles$16.dropdownMenuItem, toggleClass: styles$16.dropdownToggle, baseClass: styles$16.dropdown, baseComponent: 'div', sectionClass: styles$16.dropdownGroup, sectionTitleClass: styles$16.dropdownGroupTitle, sectionComponent: 'section', disabledClass: styles$16.modifiers.disabled, plainTextClass: styles$16.modifiers.text, ouiaId: useOUIAId(Dropdown.displayName, ouiaId), ouiaSafe, ouiaComponentType: Dropdown.displayName, alignments }, contextProps) },
|
4897 | React__namespace.createElement(DropdownWithContext, Object.assign({}, props))));
|
4898 | };
|
4899 | Dropdown.displayName = 'Dropdown';
|
4900 |
|
4901 | const DropdownGroup = (_a) => {
|
4902 | var { children = null, className = '', label = '' } = _a, props = __rest$1(_a, ["children", "className", "label"]);
|
4903 | return (React__namespace.createElement(DropdownContext.Consumer, null, ({ sectionClass, sectionTitleClass, sectionComponent }) => {
|
4904 | const SectionComponent = sectionComponent;
|
4905 | return (React__namespace.createElement(SectionComponent, Object.assign({ className: css(sectionClass, className) }, props),
|
4906 | label && (React__namespace.createElement("h1", { className: css(sectionTitleClass), "aria-hidden": true }, label)),
|
4907 | React__namespace.createElement("ul", { role: "none" }, children)));
|
4908 | }));
|
4909 | };
|
4910 | DropdownGroup.displayName = 'DropdownGroup';
|
4911 |
|
4912 | class InternalDropdownItem extends React__namespace.Component {
|
4913 | constructor() {
|
4914 | super(...arguments);
|
4915 | this.ref = React__namespace.createRef();
|
4916 | this.additionalRef = React__namespace.createRef();
|
4917 | this.getInnerNode = (node) => (node && node.childNodes && node.childNodes.length ? node.childNodes[0] : node);
|
4918 | this.onKeyDown = (event) => {
|
4919 |
|
4920 | const innerIndex = event.target === this.ref.current ? 0 : 1;
|
4921 | if (!this.props.customChild) {
|
4922 | event.preventDefault();
|
4923 | }
|
4924 | if (event.key === 'ArrowUp') {
|
4925 | this.props.context.keyHandler(this.props.index, innerIndex, KEYHANDLER_DIRECTION.UP);
|
4926 | event.stopPropagation();
|
4927 | }
|
4928 | else if (event.key === 'ArrowDown') {
|
4929 | this.props.context.keyHandler(this.props.index, innerIndex, KEYHANDLER_DIRECTION.DOWN);
|
4930 | event.stopPropagation();
|
4931 | }
|
4932 | else if (event.key === 'ArrowRight') {
|
4933 | this.props.context.keyHandler(this.props.index, innerIndex, KEYHANDLER_DIRECTION.RIGHT);
|
4934 | event.stopPropagation();
|
4935 | }
|
4936 | else if (event.key === 'ArrowLeft') {
|
4937 | this.props.context.keyHandler(this.props.index, innerIndex, KEYHANDLER_DIRECTION.LEFT);
|
4938 | event.stopPropagation();
|
4939 | }
|
4940 | else if (event.key === 'Enter' || event.key === ' ') {
|
4941 | event.target.click();
|
4942 | this.props.enterTriggersArrowDown &&
|
4943 | this.props.context.keyHandler(this.props.index, innerIndex, KEYHANDLER_DIRECTION.DOWN);
|
4944 | }
|
4945 | };
|
4946 | this.componentRef = (element) => {
|
4947 | this.ref.current = element;
|
4948 | const { component } = this.props;
|
4949 | const ref = component.ref;
|
4950 | if (ref) {
|
4951 | if (typeof ref === 'function') {
|
4952 | ref(element);
|
4953 | }
|
4954 | else {
|
4955 | ref.current = element;
|
4956 | }
|
4957 | }
|
4958 | };
|
4959 | }
|
4960 | componentDidMount() {
|
4961 | const { context, index, isDisabled, role, customChild, autoFocus } = this.props;
|
4962 | const customRef = customChild ? this.getInnerNode(this.ref.current) : this.ref.current;
|
4963 | context.sendRef(index, [customRef, customChild ? customRef : this.additionalRef.current], isDisabled, role === 'separator');
|
4964 | autoFocus && setTimeout(() => customRef.focus());
|
4965 | }
|
4966 | componentDidUpdate() {
|
4967 | const { context, index, isDisabled, role, customChild } = this.props;
|
4968 | const customRef = customChild ? this.getInnerNode(this.ref.current) : this.ref.current;
|
4969 | context.sendRef(index, [customRef, customChild ? customRef : this.additionalRef.current], isDisabled, role === 'separator');
|
4970 | }
|
4971 | extendAdditionalChildRef() {
|
4972 | const { additionalChild } = this.props;
|
4973 | return React__namespace.cloneElement(additionalChild, {
|
4974 | ref: this.additionalRef
|
4975 | });
|
4976 | }
|
4977 | render() {
|
4978 |
|
4979 | const _a = this.props, { className, children, isHovered, context, onClick, component, role, isDisabled, isAriaDisabled, isPlainText, index, href, tooltip, tooltipProps, id, componentID, listItemClassName, additionalChild, customChild, enterTriggersArrowDown, icon, autoFocus, styleChildren, description, inoperableEvents } = _a, additionalProps = __rest$1(_a, ["className", "children", "isHovered", "context", "onClick", "component", "role", "isDisabled", "isAriaDisabled", "isPlainText", "index", "href", "tooltip", "tooltipProps", "id", "componentID", "listItemClassName", "additionalChild", "customChild", "enterTriggersArrowDown", "icon", "autoFocus", "styleChildren", "description", "inoperableEvents"]);
|
4980 |
|
4981 | let classes = css(icon && styles$16.modifiers.icon, isAriaDisabled && styles$16.modifiers.ariaDisabled, className);
|
4982 | if (component === 'a') {
|
4983 | additionalProps['aria-disabled'] = isDisabled || isAriaDisabled;
|
4984 | }
|
4985 | else if (component === 'button') {
|
4986 | additionalProps['aria-disabled'] = isDisabled || isAriaDisabled;
|
4987 | additionalProps.type = additionalProps.type || 'button';
|
4988 | }
|
4989 | const renderWithTooltip = (childNode) => tooltip ? (React__namespace.createElement(Tooltip, Object.assign({ content: tooltip }, tooltipProps), childNode)) : (childNode);
|
4990 | const renderClonedComponent = (element) => React__namespace.cloneElement(element, Object.assign(Object.assign({}, (styleChildren && {
|
4991 | className: css(element.props.className, classes)
|
4992 | })), (this.props.role !== 'separator' && { ref: this.componentRef })));
|
4993 | const renderDefaultComponent = (tag) => {
|
4994 | const Component = tag;
|
4995 | const componentContent = description ? (React__namespace.createElement(React__namespace.Fragment, null,
|
4996 | React__namespace.createElement("div", { className: styles$16.dropdownMenuItemMain },
|
4997 | icon && React__namespace.createElement("span", { className: css(styles$16.dropdownMenuItemIcon) }, icon),
|
4998 | children),
|
4999 | React__namespace.createElement("div", { className: styles$16.dropdownMenuItemDescription }, description))) : (React__namespace.createElement(React__namespace.Fragment, null,
|
5000 | icon && React__namespace.createElement("span", { className: css(styles$16.dropdownMenuItemIcon) }, icon),
|
5001 | children));
|
5002 | return (React__namespace.createElement(Component, Object.assign({}, additionalProps, (isDisabled || isAriaDisabled ? preventedEvents(inoperableEvents) : null), { href: href, ref: this.ref, className: classes, id: componentID }), componentContent));
|
5003 | };
|
5004 | return (React__namespace.createElement(DropdownContext.Consumer, null, ({ onSelect, itemClass, disabledClass, plainTextClass }) => {
|
5005 | if (this.props.role !== 'separator') {
|
5006 | classes = css(classes, isDisabled && disabledClass, isPlainText && plainTextClass, itemClass, description && styles$16.modifiers.description);
|
5007 | }
|
5008 | if (customChild) {
|
5009 | return React__namespace.cloneElement(customChild, {
|
5010 | ref: this.ref,
|
5011 | onKeyDown: this.onKeyDown
|
5012 | });
|
5013 | }
|
5014 | return (React__namespace.createElement("li", { className: listItemClassName || null, role: role, onKeyDown: this.onKeyDown, onClick: (event) => {
|
5015 | if (!isDisabled && !isAriaDisabled) {
|
5016 | onClick(event);
|
5017 | onSelect(event);
|
5018 | }
|
5019 | }, id: id },
|
5020 | renderWithTooltip(React__namespace.isValidElement(component)
|
5021 | ? renderClonedComponent(component)
|
5022 | : renderDefaultComponent(component)),
|
5023 | additionalChild && this.extendAdditionalChildRef()));
|
5024 | }));
|
5025 | }
|
5026 | }
|
5027 | InternalDropdownItem.displayName = 'InternalDropdownItem';
|
5028 | InternalDropdownItem.defaultProps = {
|
5029 | className: '',
|
5030 | isHovered: false,
|
5031 | component: 'a',
|
5032 | role: 'none',
|
5033 | isDisabled: false,
|
5034 | isPlainText: false,
|
5035 | tooltipProps: {},
|
5036 |
|
5037 | onClick: (event) => undefined,
|
5038 | index: -1,
|
5039 | context: {
|
5040 | keyHandler: () => { },
|
5041 | sendRef: () => { }
|
5042 | },
|
5043 | enterTriggersArrowDown: false,
|
5044 | icon: null,
|
5045 | styleChildren: true,
|
5046 | description: null,
|
5047 | inoperableEvents: ['onClick', 'onKeyPress']
|
5048 | };
|
5049 |
|
5050 | const DropdownItem = (_a) => {
|
5051 | var { children, className, component = 'a', isDisabled = false, isAriaDisabled = false, isPlainText = false, isHovered = false, href, tooltip, tooltipProps = {}, listItemClassName, onClick,
|
5052 |
|
5053 | ref,
|
5054 | additionalChild, customChild, tabIndex = -1, icon = null, autoFocus, description = null, styleChildren, ouiaId, ouiaSafe } = _a, props = __rest$1(_a, ["children", "className", "component", "isDisabled", "isAriaDisabled", "isPlainText", "isHovered", "href", "tooltip", "tooltipProps", "listItemClassName", "onClick", "ref", "additionalChild", "customChild", "tabIndex", "icon", "autoFocus", "description", "styleChildren", "ouiaId", "ouiaSafe"]);
|
5055 | const ouiaProps = useOUIAProps(DropdownItem.displayName, ouiaId, ouiaSafe);
|
5056 | return (React__namespace.createElement(DropdownArrowContext.Consumer, null, context => (React__namespace.createElement(InternalDropdownItem, Object.assign({ context: context, role: "menuitem", tabIndex: tabIndex, className: className, component: component, isDisabled: isDisabled, isAriaDisabled: isAriaDisabled, isPlainText: isPlainText, isHovered: isHovered, href: href, tooltip: tooltip, tooltipProps: tooltipProps, listItemClassName: listItemClassName, onClick: onClick, additionalChild: additionalChild, customChild: customChild, icon: icon, autoFocus: autoFocus, styleChildren: styleChildren, description: description }, ouiaProps, props), children))));
|
5057 | };
|
5058 | DropdownItem.displayName = 'DropdownItem';
|
5059 |
|
5060 | Promise.resolve().then(function () { return divider; });
|
5061 | var styles$15 = {
|
5062 | "divider": "pf-c-divider",
|
5063 | "modifiers": {
|
5064 | "hidden": "pf-m-hidden",
|
5065 | "hiddenOnSm": "pf-m-hidden-on-sm",
|
5066 | "visibleOnSm": "pf-m-visible-on-sm",
|
5067 | "hiddenOnMd": "pf-m-hidden-on-md",
|
5068 | "visibleOnMd": "pf-m-visible-on-md",
|
5069 | "hiddenOnLg": "pf-m-hidden-on-lg",
|
5070 | "visibleOnLg": "pf-m-visible-on-lg",
|
5071 | "hiddenOnXl": "pf-m-hidden-on-xl",
|
5072 | "visibleOnXl": "pf-m-visible-on-xl",
|
5073 | "hiddenOn_2xl": "pf-m-hidden-on-2xl",
|
5074 | "visibleOn_2xl": "pf-m-visible-on-2xl",
|
5075 | "vertical": "pf-m-vertical",
|
5076 | "insetNone": "pf-m-inset-none",
|
5077 | "insetXs": "pf-m-inset-xs",
|
5078 | "insetSm": "pf-m-inset-sm",
|
5079 | "insetMd": "pf-m-inset-md",
|
5080 | "insetLg": "pf-m-inset-lg",
|
5081 | "insetXl": "pf-m-inset-xl",
|
5082 | "inset_2xl": "pf-m-inset-2xl",
|
5083 | "inset_3xl": "pf-m-inset-3xl",
|
5084 | "horizontalOnSm": "pf-m-horizontal-on-sm",
|
5085 | "verticalOnSm": "pf-m-vertical-on-sm",
|
5086 | "insetNoneOnSm": "pf-m-inset-none-on-sm",
|
5087 | "insetXsOnSm": "pf-m-inset-xs-on-sm",
|
5088 | "insetSmOnSm": "pf-m-inset-sm-on-sm",
|
5089 | "insetMdOnSm": "pf-m-inset-md-on-sm",
|
5090 | "insetLgOnSm": "pf-m-inset-lg-on-sm",
|
5091 | "insetXlOnSm": "pf-m-inset-xl-on-sm",
|
5092 | "inset_2xlOnSm": "pf-m-inset-2xl-on-sm",
|
5093 | "inset_3xlOnSm": "pf-m-inset-3xl-on-sm",
|
5094 | "horizontalOnMd": "pf-m-horizontal-on-md",
|
5095 | "verticalOnMd": "pf-m-vertical-on-md",
|
5096 | "insetNoneOnMd": "pf-m-inset-none-on-md",
|
5097 | "insetXsOnMd": "pf-m-inset-xs-on-md",
|
5098 | "insetSmOnMd": "pf-m-inset-sm-on-md",
|
5099 | "insetMdOnMd": "pf-m-inset-md-on-md",
|
5100 | "insetLgOnMd": "pf-m-inset-lg-on-md",
|
5101 | "insetXlOnMd": "pf-m-inset-xl-on-md",
|
5102 | "inset_2xlOnMd": "pf-m-inset-2xl-on-md",
|
5103 | "inset_3xlOnMd": "pf-m-inset-3xl-on-md",
|
5104 | "horizontalOnLg": "pf-m-horizontal-on-lg",
|
5105 | "verticalOnLg": "pf-m-vertical-on-lg",
|
5106 | "insetNoneOnLg": "pf-m-inset-none-on-lg",
|
5107 | "insetXsOnLg": "pf-m-inset-xs-on-lg",
|
5108 | "insetSmOnLg": "pf-m-inset-sm-on-lg",
|
5109 | "insetMdOnLg": "pf-m-inset-md-on-lg",
|
5110 | "insetLgOnLg": "pf-m-inset-lg-on-lg",
|
5111 | "insetXlOnLg": "pf-m-inset-xl-on-lg",
|
5112 | "inset_2xlOnLg": "pf-m-inset-2xl-on-lg",
|
5113 | "inset_3xlOnLg": "pf-m-inset-3xl-on-lg",
|
5114 | "horizontalOnXl": "pf-m-horizontal-on-xl",
|
5115 | "verticalOnXl": "pf-m-vertical-on-xl",
|
5116 | "insetNoneOnXl": "pf-m-inset-none-on-xl",
|
5117 | "insetXsOnXl": "pf-m-inset-xs-on-xl",
|
5118 | "insetSmOnXl": "pf-m-inset-sm-on-xl",
|
5119 | "insetMdOnXl": "pf-m-inset-md-on-xl",
|
5120 | "insetLgOnXl": "pf-m-inset-lg-on-xl",
|
5121 | "insetXlOnXl": "pf-m-inset-xl-on-xl",
|
5122 | "inset_2xlOnXl": "pf-m-inset-2xl-on-xl",
|
5123 | "inset_3xlOnXl": "pf-m-inset-3xl-on-xl",
|
5124 | "horizontalOn_2xl": "pf-m-horizontal-on-2xl",
|
5125 | "verticalOn_2xl": "pf-m-vertical-on-2xl",
|
5126 | "insetNoneOn_2xl": "pf-m-inset-none-on-2xl",
|
5127 | "insetXsOn_2xl": "pf-m-inset-xs-on-2xl",
|
5128 | "insetSmOn_2xl": "pf-m-inset-sm-on-2xl",
|
5129 | "insetMdOn_2xl": "pf-m-inset-md-on-2xl",
|
5130 | "insetLgOn_2xl": "pf-m-inset-lg-on-2xl",
|
5131 | "insetXlOn_2xl": "pf-m-inset-xl-on-2xl",
|
5132 | "inset_2xlOn_2xl": "pf-m-inset-2xl-on-2xl",
|
5133 | "inset_3xlOn_2xl": "pf-m-inset-3xl-on-2xl"
|
5134 | }
|
5135 | };
|
5136 |
|
5137 | exports.DividerVariant = void 0;
|
5138 | (function (DividerVariant) {
|
5139 | DividerVariant["hr"] = "hr";
|
5140 | DividerVariant["li"] = "li";
|
5141 | DividerVariant["div"] = "div";
|
5142 | })(exports.DividerVariant || (exports.DividerVariant = {}));
|
5143 | const Divider = (_a) => {
|
5144 | var { className, component = exports.DividerVariant.hr, isVertical = false, inset, orientation } = _a, props = __rest$1(_a, ["className", "component", "isVertical", "inset", "orientation"]);
|
5145 | const Component = component;
|
5146 | return (React__namespace.createElement(Component, Object.assign({ className: css(styles$15.divider, isVertical && styles$15.modifiers.vertical, formatBreakpointMods(inset, styles$15), formatBreakpointMods(orientation, styles$15), className) }, (component !== 'hr' && { role: 'separator' }), props)));
|
5147 | };
|
5148 | Divider.displayName = 'Divider';
|
5149 |
|
5150 | const DropdownSeparator = (_a) => {
|
5151 | var { className = '',
|
5152 |
|
5153 | ref,
|
5154 | ouiaId, ouiaSafe } = _a, props = __rest$1(_a, ["className", "ref", "ouiaId", "ouiaSafe"]);
|
5155 | const ouiaProps = useOUIAProps(DropdownSeparator.displayName, ouiaId, ouiaSafe);
|
5156 | return (React__namespace.createElement(DropdownArrowContext.Consumer, null, context => (React__namespace.createElement(InternalDropdownItem, Object.assign({}, props, { context: context, component: React__namespace.createElement(Divider, { component: exports.DividerVariant.div }), className: className, role: "separator" }, ouiaProps)))));
|
5157 | };
|
5158 | DropdownSeparator.displayName = 'DropdownSeparator';
|
5159 |
|
5160 | const CaretDownIconConfig = {
|
5161 | name: 'CaretDownIcon',
|
5162 | height: 512,
|
5163 | width: 320,
|
5164 | svgPath: 'M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z',
|
5165 | yOffset: 0,
|
5166 | xOffset: 0,
|
5167 | };
|
5168 |
|
5169 | const CaretDownIcon = createIcon(CaretDownIconConfig);
|
5170 |
|
5171 | var CaretDownIcon$1 = CaretDownIcon;
|
5172 |
|
5173 | const buttonVariantStyles = {
|
5174 | default: '',
|
5175 | primary: styles$16.modifiers.primary,
|
5176 | secondary: styles$16.modifiers.secondary
|
5177 | };
|
5178 | class Toggle extends React__namespace.Component {
|
5179 | constructor() {
|
5180 | super(...arguments);
|
5181 | this.buttonRef = React__namespace.createRef();
|
5182 | this.componentDidMount = () => {
|
5183 | document.addEventListener('click', this.onDocClick);
|
5184 | document.addEventListener('touchstart', this.onDocClick);
|
5185 | document.addEventListener('keydown', this.onEscPress);
|
5186 | };
|
5187 | this.componentWillUnmount = () => {
|
5188 | document.removeEventListener('click', this.onDocClick);
|
5189 | document.removeEventListener('touchstart', this.onDocClick);
|
5190 | document.removeEventListener('keydown', this.onEscPress);
|
5191 | };
|
5192 | this.onDocClick = (event) => {
|
5193 | const { isOpen, parentRef, onToggle, getMenuRef } = this.props;
|
5194 | const menuRef = getMenuRef && getMenuRef();
|
5195 | const clickedOnToggle = parentRef && parentRef.current && parentRef.current.contains(event.target);
|
5196 | const clickedWithinMenu = menuRef && menuRef.contains && menuRef.contains(event.target);
|
5197 | if (isOpen && !(clickedOnToggle || clickedWithinMenu)) {
|
5198 | onToggle(false, event);
|
5199 | }
|
5200 | };
|
5201 | this.onEscPress = (event) => {
|
5202 | const { parentRef, getMenuRef } = this.props;
|
5203 | const keyCode = event.keyCode || event.which;
|
5204 | const menuRef = getMenuRef && getMenuRef();
|
5205 | const escFromToggle = parentRef && parentRef.current && parentRef.current.contains(event.target);
|
5206 | const escFromWithinMenu = menuRef && menuRef.contains && menuRef.contains(event.target);
|
5207 | if (this.props.isOpen &&
|
5208 | (keyCode === KEY_CODES.ESCAPE_KEY || event.key === 'Tab') &&
|
5209 | (escFromToggle || escFromWithinMenu)) {
|
5210 | this.props.onToggle(false, event);
|
5211 | this.buttonRef.current.focus();
|
5212 | }
|
5213 | };
|
5214 | this.onKeyDown = (event) => {
|
5215 | if (event.key === 'Tab' && !this.props.isOpen) {
|
5216 | return;
|
5217 | }
|
5218 | if ((event.key === 'Tab' || event.key === 'Enter' || event.key === ' ') && this.props.isOpen) {
|
5219 | if (!this.props.bubbleEvent) {
|
5220 | event.stopPropagation();
|
5221 | }
|
5222 | event.preventDefault();
|
5223 | this.props.onToggle(!this.props.isOpen, event);
|
5224 | }
|
5225 | else if ((event.key === 'Enter' || event.key === ' ') && !this.props.isOpen) {
|
5226 | if (!this.props.bubbleEvent) {
|
5227 | event.stopPropagation();
|
5228 | }
|
5229 | event.preventDefault();
|
5230 | this.props.onToggle(!this.props.isOpen, event);
|
5231 | this.props.onEnter();
|
5232 | }
|
5233 | };
|
5234 | }
|
5235 | render() {
|
5236 | const _a = this.props, { className, children, isOpen, isDisabled, isPlain, isText, isPrimary, isSplitButton, toggleVariant, onToggle, 'aria-haspopup': ariaHasPopup,
|
5237 |
|
5238 | isActive, bubbleEvent, onEnter, parentRef, getMenuRef,
|
5239 |
|
5240 | id, type } = _a, props = __rest$1(_a, ["className", "children", "isOpen", "isDisabled", "isPlain", "isText", "isPrimary", "isSplitButton", "toggleVariant", "onToggle", 'aria-haspopup', "isActive", "bubbleEvent", "onEnter", "parentRef", "getMenuRef", "id", "type"]);
|
5241 | return (React__namespace.createElement(DropdownContext.Consumer, null, ({ toggleClass }) => (React__namespace.createElement("button", Object.assign({}, props, { id: id, ref: this.buttonRef, className: css(isSplitButton ? styles$16.dropdownToggleButton : toggleClass || styles$16.dropdownToggle, isActive && styles$16.modifiers.active, isPlain && styles$16.modifiers.plain, isText && styles$16.modifiers.text, isPrimary && styles$16.modifiers.primary, buttonVariantStyles[toggleVariant], className), type: type || 'button', onClick: event => onToggle(!isOpen, event), "aria-expanded": isOpen, "aria-haspopup": ariaHasPopup, onKeyDown: event => this.onKeyDown(event), disabled: isDisabled }), children))));
|
5242 | }
|
5243 | }
|
5244 | Toggle.displayName = 'Toggle';
|
5245 | Toggle.defaultProps = {
|
5246 | className: '',
|
5247 | isOpen: false,
|
5248 | isActive: false,
|
5249 | isDisabled: false,
|
5250 | isPlain: false,
|
5251 | isText: false,
|
5252 | isPrimary: false,
|
5253 | isSplitButton: false,
|
5254 | onToggle: () => { },
|
5255 | onEnter: () => { },
|
5256 | bubbleEvent: false
|
5257 | };
|
5258 |
|
5259 | Promise.resolve().then(function () { return badge; });
|
5260 | var badgeStyles = {
|
5261 | "badge": "pf-c-badge",
|
5262 | "modifiers": {
|
5263 | "read": "pf-m-read",
|
5264 | "unread": "pf-m-unread"
|
5265 | }
|
5266 | };
|
5267 |
|
5268 | const Badge = (_a) => {
|
5269 | var { isRead = false, className = '', children = '' } = _a, props = __rest$1(_a, ["isRead", "className", "children"]);
|
5270 | return (React__namespace.createElement("span", Object.assign({}, props, { className: css(badgeStyles.badge, (isRead ? badgeStyles.modifiers.read : badgeStyles.modifiers.unread), className) }), children));
|
5271 | };
|
5272 | Badge.displayName = 'Badge';
|
5273 |
|
5274 | const BadgeToggle = (_a) => {
|
5275 | var { id = '', children = null, badgeProps = { isRead: true }, className = '', isOpen = false, 'aria-label': ariaLabel = 'Actions', parentRef = null, getMenuRef = null, isActive = false, isPlain = null, isDisabled = false, bubbleEvent = false, onToggle = () => undefined,
|
5276 |
|
5277 | ref } = _a,
|
5278 | props = __rest$1(_a, ["id", "children", "badgeProps", "className", "isOpen", 'aria-label', "parentRef", "getMenuRef", "isActive", "isPlain", "isDisabled", "bubbleEvent", "onToggle", "ref"]);
|
5279 | return (React__namespace.createElement(Toggle, Object.assign({ id: id, className: className, isOpen: isOpen, "aria-label": ariaLabel, parentRef: parentRef, getMenuRef: getMenuRef, isActive: isActive, isPlain: isPlain || true, isDisabled: isDisabled, onToggle: onToggle, bubbleEvent: bubbleEvent }, props),
|
5280 | React__namespace.createElement(Badge, Object.assign({}, badgeProps),
|
5281 | children,
|
5282 | React__namespace.createElement("span", { className: css(styles$16.dropdownToggleIcon) },
|
5283 | React__namespace.createElement(CaretDownIcon$1, null)))));
|
5284 | };
|
5285 | BadgeToggle.displayName = 'BadgeToggle';
|
5286 |
|
5287 | const EllipsisVIconConfig = {
|
5288 | name: 'EllipsisVIcon',
|
5289 | height: 512,
|
5290 | width: 192,
|
5291 | svgPath: 'M96 184c39.8 0 72 32.2 72 72s-32.2 72-72 72-72-32.2-72-72 32.2-72 72-72zM24 80c0 39.8 32.2 72 72 72s72-32.2 72-72S135.8 8 96 8 24 40.2 24 80zm0 352c0 39.8 32.2 72 72 72s72-32.2 72-72-32.2-72-72-72-72 32.2-72 72z',
|
5292 | yOffset: 0,
|
5293 | xOffset: 0,
|
5294 | };
|
5295 |
|
5296 | const EllipsisVIcon = createIcon(EllipsisVIconConfig);
|
5297 |
|
5298 | var EllipsisVIcon$1 = EllipsisVIcon;
|
5299 |
|
5300 | const KebabToggle = (_a) => {
|
5301 | var { id = '',
|
5302 |
|
5303 | children = null, className = '', isOpen = false, 'aria-label': ariaLabel = 'Actions', parentRef = null, getMenuRef = null, isActive = false, isPlain = false, isDisabled = false, bubbleEvent = false, onToggle = () => undefined,
|
5304 |
|
5305 | ref } = _a,
|
5306 | props = __rest$1(_a, ["id", "children", "className", "isOpen", 'aria-label', "parentRef", "getMenuRef", "isActive", "isPlain", "isDisabled", "bubbleEvent", "onToggle", "ref"]);
|
5307 | return (React__namespace.createElement(Toggle, Object.assign({ id: id, className: className, isOpen: isOpen, "aria-label": ariaLabel, parentRef: parentRef, getMenuRef: getMenuRef, isActive: isActive, isPlain: isPlain, isDisabled: isDisabled, onToggle: onToggle, bubbleEvent: bubbleEvent }, props),
|
5308 | React__namespace.createElement(EllipsisVIcon$1, null)));
|
5309 | };
|
5310 | KebabToggle.displayName = 'KebabToggle';
|
5311 |
|
5312 | const DropdownToggle = (_a) => {
|
5313 | var { id = '', children = null, className = '', isOpen = false, parentRef = null, getMenuRef = null, isDisabled = false, isPlain = false, isText = false, isPrimary = false, toggleVariant = 'default',
|
5314 |
|
5315 | isActive = false,
|
5316 |
|
5317 | onToggle = (_isOpen) => undefined, icon = null, toggleIndicator: ToggleIndicator = CaretDownIcon$1, splitButtonItems, splitButtonVariant = 'checkbox', 'aria-haspopup': ariaHasPopup, ouiaId, ouiaSafe,
|
5318 |
|
5319 | ref } = _a,
|
5320 | props = __rest$1(_a, ["id", "children", "className", "isOpen", "parentRef", "getMenuRef", "isDisabled", "isPlain", "isText", "isPrimary", "toggleVariant", "isActive", "onToggle", "icon", "toggleIndicator", "splitButtonItems", "splitButtonVariant", 'aria-haspopup', "ouiaId", "ouiaSafe", "ref"]);
|
5321 | const ouiaProps = useOUIAProps(DropdownToggle.displayName, ouiaId, ouiaSafe);
|
5322 | const toggle = (React__namespace.createElement(DropdownContext.Consumer, null, ({ toggleTextClass, toggleIndicatorClass, toggleIconClass }) => (React__namespace.createElement(Toggle, Object.assign({}, props, { id: id, className: className, isOpen: isOpen, parentRef: parentRef, getMenuRef: getMenuRef, isActive: isActive, isDisabled: isDisabled, isPlain: isPlain, isText: isText, isPrimary: isPrimary, toggleVariant: toggleVariant, onToggle: onToggle, "aria-haspopup": ariaHasPopup }, ouiaProps, (splitButtonItems && { isSplitButton: true, 'aria-label': props['aria-label'] || 'Select' })),
|
5323 | icon && React__namespace.createElement("span", { className: css(toggleIconClass) }, icon),
|
5324 | children && React__namespace.createElement("span", { className: ToggleIndicator && css(toggleTextClass) }, children),
|
5325 | ToggleIndicator && (React__namespace.createElement("span", { className: css(!splitButtonItems && toggleIndicatorClass) },
|
5326 | React__namespace.createElement(ToggleIndicator, null)))))));
|
5327 | if (splitButtonItems) {
|
5328 | return (React__namespace.createElement("div", { className: css(styles$16.dropdownToggle, styles$16.modifiers.splitButton, splitButtonVariant === 'action' && styles$16.modifiers.action, (toggleVariant === 'primary' || isPrimary) && splitButtonVariant === 'action' && styles$16.modifiers.primary, isDisabled && styles$16.modifiers.disabled) },
|
5329 | splitButtonItems,
|
5330 | toggle));
|
5331 | }
|
5332 | return toggle;
|
5333 | };
|
5334 | DropdownToggle.displayName = 'DropdownToggle';
|
5335 |
|
5336 | class DropdownToggleCheckbox extends React__namespace.Component {
|
5337 | constructor(props) {
|
5338 | super(props);
|
5339 | this.handleChange = (event) => {
|
5340 | this.props.onChange(event.target.checked, event);
|
5341 | };
|
5342 | this.calculateChecked = () => {
|
5343 | const { isChecked, checked } = this.props;
|
5344 | if (isChecked === null) {
|
5345 |
|
5346 | return false;
|
5347 | }
|
5348 | else if (isChecked !== undefined) {
|
5349 | return isChecked;
|
5350 | }
|
5351 | return checked;
|
5352 | };
|
5353 | this.state = {
|
5354 | ouiaStateId: getDefaultOUIAId(DropdownToggleCheckbox.displayName)
|
5355 | };
|
5356 | }
|
5357 | render() {
|
5358 | const _a = this.props, { className, isValid, isDisabled, isChecked, children, ouiaId, ouiaSafe,
|
5359 |
|
5360 | onChange, checked } = _a,
|
5361 |
|
5362 | props = __rest$1(_a, ["className", "isValid", "isDisabled", "isChecked", "children", "ouiaId", "ouiaSafe", "onChange", "checked"]);
|
5363 | const text = children && (React__namespace.createElement("span", { className: css(styles$16.dropdownToggleText, className), "aria-hidden": "true", id: `${props.id}-text` }, children));
|
5364 | return (React__namespace.createElement("label", { className: css(styles$16.dropdownToggleCheck, className), htmlFor: props.id },
|
5365 | React__namespace.createElement("input", Object.assign({}, props, (this.calculateChecked() !== undefined && { onChange: this.handleChange }), { type: "checkbox", ref: elem => elem && (elem.indeterminate = isChecked === null), "aria-invalid": !isValid, disabled: isDisabled, checked: this.calculateChecked() }, getOUIAProps(DropdownToggleCheckbox.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId, ouiaSafe))),
|
5366 | text));
|
5367 | }
|
5368 | }
|
5369 | DropdownToggleCheckbox.displayName = 'DropdownToggleCheckbox';
|
5370 | DropdownToggleCheckbox.defaultProps = {
|
5371 | className: '',
|
5372 | isValid: true,
|
5373 | isDisabled: false,
|
5374 | onChange: () => undefined
|
5375 | };
|
5376 |
|
5377 | class DropdownToggleAction extends React__namespace.Component {
|
5378 | render() {
|
5379 | const _a = this.props, { id, className, onClick, isDisabled, children } = _a, props = __rest$1(_a, ["id", "className", "onClick", "isDisabled", "children"]);
|
5380 | return (React__namespace.createElement("button", Object.assign({ id: id, className: css(styles$16.dropdownToggleButton, className), onClick: onClick }, (isDisabled && { disabled: true, 'aria-disabled': true }), props), children));
|
5381 | }
|
5382 | }
|
5383 | DropdownToggleAction.displayName = 'DropdownToggleAction';
|
5384 | DropdownToggleAction.defaultProps = {
|
5385 | className: '',
|
5386 | isDisabled: false,
|
5387 | onClick: () => { }
|
5388 | };
|
5389 |
|
5390 | const ApplicationLauncherGroup = (_a) => {
|
5391 | var { children } = _a, props = __rest$1(_a, ["children"]);
|
5392 | return React__namespace.createElement(DropdownGroup, Object.assign({}, props), children);
|
5393 | };
|
5394 | ApplicationLauncherGroup.displayName = 'ApplicationLauncherGroup';
|
5395 |
|
5396 | const ApplicationLauncherSeparator = (_a) => {
|
5397 | var props = __rest$1(_a, ["children"]);
|
5398 | return React__namespace.createElement(DropdownSeparator, Object.assign({}, props));
|
5399 | };
|
5400 | ApplicationLauncherSeparator.displayName = 'ApplicationLauncherSeparator';
|
5401 |
|
5402 | const ApplicationLauncherIcon = (_a) => {
|
5403 | var {
|
5404 |
|
5405 | className = '', children } = _a, props = __rest$1(_a, ["className", "children"]);
|
5406 | return (React__namespace.createElement("span", Object.assign({ className: css(styles$17.appLauncherMenuItemIcon) }, props), children));
|
5407 | };
|
5408 | ApplicationLauncherIcon.displayName = 'ApplicationLauncherIcon';
|
5409 |
|
5410 | const ApplicationLauncherText = (_a) => {
|
5411 | var { className = '', children } = _a, props = __rest$1(_a, ["className", "children"]);
|
5412 | return (React__namespace.createElement("span", Object.assign({ className: css('pf-c-app-launcher__menu-item-text', className) }, props), children));
|
5413 | };
|
5414 | ApplicationLauncherText.displayName = 'ApplicationLauncherText';
|
5415 |
|
5416 | const ExternalLinkAltIconConfig = {
|
5417 | name: 'ExternalLinkAltIcon',
|
5418 | height: 512,
|
5419 | width: 512,
|
5420 | svgPath: 'M432,320H400a16,16,0,0,0-16,16V448H64V128H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V336A16,16,0,0,0,432,320ZM488,0h-128c-21.37,0-32.05,25.91-17,41l35.73,35.73L135,320.37a24,24,0,0,0,0,34L157.67,377a24,24,0,0,0,34,0L435.28,133.32,471,169c15,15,41,4.5,41-17V24A24,24,0,0,0,488,0Z',
|
5421 | yOffset: 0,
|
5422 | xOffset: 0,
|
5423 | };
|
5424 |
|
5425 | const ExternalLinkAltIcon = createIcon(ExternalLinkAltIconConfig);
|
5426 |
|
5427 | var ExternalLinkAltIcon$1 = ExternalLinkAltIcon;
|
5428 |
|
5429 | const ApplicationLauncherItemContext = React__namespace.createContext({ isExternal: false, icon: null });
|
5430 |
|
5431 | const ApplicationLauncherContent = ({ children }) => (React__namespace.createElement(ApplicationLauncherItemContext.Consumer, null, ({ isExternal, icon }) => (React__namespace.createElement(React__namespace.Fragment, null,
|
5432 | icon && React__namespace.createElement(ApplicationLauncherIcon, null, icon),
|
5433 | icon ? React__namespace.createElement(ApplicationLauncherText, null, children) : children,
|
5434 | isExternal && (React__namespace.createElement(React__namespace.Fragment, null,
|
5435 | React__namespace.createElement("span", { className: css(styles$17.appLauncherMenuItemExternalIcon) },
|
5436 | React__namespace.createElement(ExternalLinkAltIcon$1, null)),
|
5437 | React__namespace.createElement("span", { className: css(a11yStyles.screenReader) }, "(opens new window)")))))));
|
5438 | ApplicationLauncherContent.displayName = 'ApplicationLauncherContent';
|
5439 |
|
5440 | const ApplicationLauncherContext = React__namespace.createContext({
|
5441 |
|
5442 | onFavorite: (itemId, isFavorite) => { }
|
5443 | });
|
5444 |
|
5445 | const StarIconConfig = {
|
5446 | name: 'StarIcon',
|
5447 | height: 512,
|
5448 | width: 576,
|
5449 | svgPath: 'M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z',
|
5450 | yOffset: 0,
|
5451 | xOffset: 0,
|
5452 | };
|
5453 |
|
5454 | const StarIcon = createIcon(StarIconConfig);
|
5455 |
|
5456 | var StarIcon$1 = StarIcon;
|
5457 |
|
5458 | const ApplicationLauncherItem = (_a) => {
|
5459 | var { className = '', id, children, icon = null, isExternal = false, href, tooltip = null, tooltipProps = null, component = 'a', isFavorite = null, ariaIsFavoriteLabel = 'starred', ariaIsNotFavoriteLabel = 'not starred', customChild, enterTriggersArrowDown = false } = _a, props = __rest$1(_a, ["className", "id", "children", "icon", "isExternal", "href", "tooltip", "tooltipProps", "component", "isFavorite", "ariaIsFavoriteLabel", "ariaIsNotFavoriteLabel", "customChild", "enterTriggersArrowDown"]);
|
5460 | return (React__namespace.createElement(ApplicationLauncherItemContext.Provider, { value: { isExternal, icon } },
|
5461 | React__namespace.createElement(ApplicationLauncherContext.Consumer, null, ({ onFavorite }) => (React__namespace.createElement(DropdownItem, Object.assign({ id: id, component: component, href: href || null, className: css(isExternal && styles$17.modifiers.external, isFavorite !== null && styles$17.modifiers.link, className), listItemClassName: css(onFavorite && styles$17.appLauncherMenuWrapper, isFavorite && styles$17.modifiers.favorite), tooltip: tooltip, tooltipProps: tooltipProps }, (enterTriggersArrowDown === true && { enterTriggersArrowDown }), (customChild && { customChild }), (isFavorite !== null && {
|
5462 | additionalChild: (React__namespace.createElement("button", { className: css(styles$17.appLauncherMenuItem, styles$17.modifiers.action), "aria-label": isFavorite ? ariaIsFavoriteLabel : ariaIsNotFavoriteLabel, onClick: () => {
|
5463 | onFavorite((id || getUniqueId('app-launcher-option')).replace('favorite-', ''), isFavorite);
|
5464 | } },
|
5465 | React__namespace.createElement(StarIcon$1, null)))
|
5466 | }), props), children && React__namespace.createElement(ApplicationLauncherContent, null, children))))));
|
5467 | };
|
5468 | ApplicationLauncherItem.displayName = 'ApplicationLauncherItem';
|
5469 |
|
5470 | |
5471 |
|
5472 |
|
5473 |
|
5474 |
|
5475 |
|
5476 |
|
5477 |
|
5478 | const createRenderableFavorites = (items, isGrouped, favorites, isEnterTriggersArrowDown) => {
|
5479 | if (isGrouped) {
|
5480 | const favoriteItems = [];
|
5481 | items.forEach(group => {
|
5482 | if (favorites.length > 0) {
|
5483 | return (group.props.children &&
|
5484 | group.props.children
|
5485 | .filter(item => favorites.includes(item.props.id))
|
5486 | .map(item => {
|
5487 | if (isEnterTriggersArrowDown) {
|
5488 | return favoriteItems.push(React__namespace.cloneElement(item, {
|
5489 | isFavorite: true,
|
5490 | enterTriggersArrowDown: isEnterTriggersArrowDown,
|
5491 | id: `favorite-${item.props.id}`
|
5492 | }));
|
5493 | }
|
5494 | else {
|
5495 | return favoriteItems.push(React__namespace.cloneElement(item, { isFavorite: true, id: `favorite-${item.props.id}` }));
|
5496 | }
|
5497 | }));
|
5498 | }
|
5499 | });
|
5500 | return favoriteItems;
|
5501 | }
|
5502 | return items
|
5503 | .filter(item => favorites.includes(item.props.id))
|
5504 | .map(item => React__namespace.cloneElement(item, { isFavorite: true, enterTriggersArrowDown: isEnterTriggersArrowDown }));
|
5505 | };
|
5506 | |
5507 |
|
5508 |
|
5509 |
|
5510 |
|
5511 |
|
5512 |
|
5513 | const extendItemsWithFavorite = (items, isGrouped, favorites) => {
|
5514 | if (isGrouped) {
|
5515 | return items.map(group => React__namespace.cloneElement(group, {
|
5516 | children: React__namespace.Children.map(group.props.children, item => {
|
5517 | if (item.type === ApplicationLauncherSeparator || item.type === Divider) {
|
5518 | return item;
|
5519 | }
|
5520 | return React__namespace.cloneElement(item, {
|
5521 | isFavorite: favorites.some(favoriteId => favoriteId === item.props.id || `favorite-${favoriteId}` === item.props.id)
|
5522 | });
|
5523 | })
|
5524 | }));
|
5525 | }
|
5526 | return items.map(item => React__namespace.cloneElement(item, {
|
5527 | isFavorite: favorites.some(favoriteId => favoriteId === item.props.id)
|
5528 | }));
|
5529 | };
|
5530 |
|
5531 | class ApplicationLauncher extends React__namespace.Component {
|
5532 | constructor() {
|
5533 | super(...arguments);
|
5534 | this.createSearchBox = () => {
|
5535 | const { onSearch, searchPlaceholderText, searchProps } = this.props;
|
5536 | return (React__namespace.createElement("div", { key: "search", className: css(styles$17.appLauncherMenuSearch) },
|
5537 | React__namespace.createElement(ApplicationLauncherItem, { customChild: React__namespace.createElement("input", Object.assign({ type: "search", className: css(formStyles.formControl), placeholder: searchPlaceholderText, onChange: e => onSearch(e.target.value) }, searchProps)) })));
|
5538 | };
|
5539 | }
|
5540 | render() {
|
5541 | const _a = this.props, { 'aria-label': ariaLabel, isOpen, onToggle, toggleIcon, toggleId, onSelect, isDisabled, className, isGrouped, favorites, onFavorite, onSearch, items,
|
5542 |
|
5543 | searchPlaceholderText, searchProps, ref,
|
5544 |
|
5545 | favoritesLabel, searchNoResultsText, menuAppendTo } = _a, props = __rest$1(_a, ['aria-label', "isOpen", "onToggle", "toggleIcon", "toggleId", "onSelect", "isDisabled", "className", "isGrouped", "favorites", "onFavorite", "onSearch", "items", "searchPlaceholderText", "searchProps", "ref", "favoritesLabel", "searchNoResultsText", "menuAppendTo"]);
|
5546 | let renderableItems = [];
|
5547 | if (onFavorite) {
|
5548 | let favoritesGroup = [];
|
5549 | let renderableFavorites = [];
|
5550 | if (favorites.length > 0) {
|
5551 | renderableFavorites = createRenderableFavorites(items, isGrouped, favorites, true);
|
5552 | favoritesGroup = [
|
5553 | React__namespace.createElement(ApplicationLauncherGroup, { key: "favorites", label: favoritesLabel },
|
5554 | renderableFavorites,
|
5555 | React__namespace.createElement(ApplicationLauncherSeparator, { key: "separator" }))
|
5556 | ];
|
5557 | }
|
5558 | if (renderableFavorites.length > 0) {
|
5559 | renderableItems = favoritesGroup.concat(extendItemsWithFavorite(items, isGrouped, favorites));
|
5560 | }
|
5561 | else {
|
5562 | renderableItems = extendItemsWithFavorite(items, isGrouped, favorites);
|
5563 | }
|
5564 | }
|
5565 | else {
|
5566 | renderableItems = items;
|
5567 | }
|
5568 | if (items.length === 0) {
|
5569 | renderableItems = [
|
5570 | React__namespace.createElement(ApplicationLauncherGroup, { key: "no-results-group" },
|
5571 | React__namespace.createElement(ApplicationLauncherItem, { key: "no-results" }, searchNoResultsText))
|
5572 | ];
|
5573 | }
|
5574 | if (onSearch) {
|
5575 | renderableItems = [this.createSearchBox(), ...renderableItems];
|
5576 | }
|
5577 | return (React__namespace.createElement(ApplicationLauncherContext.Provider, { value: { onFavorite } },
|
5578 | React__namespace.createElement(DropdownContext.Provider, { value: {
|
5579 | onSelect,
|
5580 | menuClass: styles$17.appLauncherMenu,
|
5581 | itemClass: styles$17.appLauncherMenuItem,
|
5582 | toggleClass: styles$17.appLauncherToggle,
|
5583 | baseClass: styles$17.appLauncher,
|
5584 | baseComponent: 'nav',
|
5585 | sectionClass: styles$17.appLauncherGroup,
|
5586 | sectionTitleClass: styles$17.appLauncherGroupTitle,
|
5587 | sectionComponent: 'section',
|
5588 | disabledClass: styles$17.modifiers.disabled,
|
5589 | ouiaComponentType: ApplicationLauncher.displayName
|
5590 | } },
|
5591 | React__namespace.createElement(DropdownWithContext, Object.assign({}, props, { dropdownItems: renderableItems, isOpen: isOpen, className: className, "aria-label": ariaLabel, menuAppendTo: menuAppendTo, toggle: React__namespace.createElement(DropdownToggle, { id: toggleId, toggleIndicator: null, isOpen: isOpen, onToggle: onToggle, isDisabled: isDisabled, "aria-label": ariaLabel }, toggleIcon), isGrouped: isGrouped })))));
|
5592 | }
|
5593 | }
|
5594 | ApplicationLauncher.displayName = 'ApplicationLauncher';
|
5595 | ApplicationLauncher.defaultProps = {
|
5596 | className: '',
|
5597 | isDisabled: false,
|
5598 | direction: exports.DropdownDirection.down,
|
5599 | favorites: [],
|
5600 | isOpen: false,
|
5601 | position: exports.DropdownPosition.left,
|
5602 |
|
5603 | onSelect: (_event) => undefined,
|
5604 | onToggle: (_value) => undefined,
|
5605 |
|
5606 | 'aria-label': 'Application launcher',
|
5607 | isGrouped: false,
|
5608 | toggleIcon: React__namespace.createElement(ThIcon$1, null),
|
5609 | searchPlaceholderText: 'Filter by name...',
|
5610 | searchNoResultsText: 'No results found',
|
5611 | favoritesLabel: 'Favorites',
|
5612 | menuAppendTo: 'inline'
|
5613 | };
|
5614 |
|
5615 | Promise.resolve().then(function () { return avatar; });
|
5616 | var styles$14 = {
|
5617 | "avatar": "pf-c-avatar",
|
5618 | "modifiers": {
|
5619 | "light": "pf-m-light",
|
5620 | "dark": "pf-m-dark",
|
5621 | "sm": "pf-m-sm",
|
5622 | "md": "pf-m-md",
|
5623 | "lg": "pf-m-lg",
|
5624 | "xl": "pf-m-xl"
|
5625 | }
|
5626 | };
|
5627 |
|
5628 | const Avatar = (_a) => {
|
5629 | var { className = '', src = '', alt, border, size } = _a, props = __rest$1(_a, ["className", "src", "alt", "border", "size"]);
|
5630 | return (React__namespace.createElement("img", Object.assign({ src: src, alt: alt, className: css(styles$14.avatar, styles$14.modifiers[size], border === 'light' && styles$14.modifiers.light, border === 'dark' && styles$14.modifiers.dark, className) }, props)));
|
5631 | };
|
5632 | Avatar.displayName = 'Avatar';
|
5633 |
|
5634 | Promise.resolve().then(function () { return backToTop; });
|
5635 | var styles$13 = {
|
5636 | "backToTop": "pf-c-back-to-top",
|
5637 | "button": "pf-c-button",
|
5638 | "modifiers": {
|
5639 | "hidden": "pf-m-hidden"
|
5640 | }
|
5641 | };
|
5642 |
|
5643 | const AngleUpIconConfig = {
|
5644 | name: 'AngleUpIcon',
|
5645 | height: 512,
|
5646 | width: 320,
|
5647 | svgPath: 'M177 159.7l136 136c9.4 9.4 9.4 24.6 0 33.9l-22.6 22.6c-9.4 9.4-24.6 9.4-33.9 0L160 255.9l-96.4 96.4c-9.4 9.4-24.6 9.4-33.9 0L7 329.7c-9.4-9.4-9.4-24.6 0-33.9l136-136c9.4-9.5 24.6-9.5 34-.1z',
|
5648 | yOffset: 0,
|
5649 | xOffset: 0,
|
5650 | };
|
5651 |
|
5652 | const AngleUpIcon = createIcon(AngleUpIconConfig);
|
5653 |
|
5654 | var AngleUpIcon$1 = AngleUpIcon;
|
5655 |
|
5656 | const BackToTopBase = (_a) => {
|
5657 | var { className, title = 'Back to top', innerRef, scrollableSelector, isAlwaysVisible = false } = _a, props = __rest$1(_a, ["className", "title", "innerRef", "scrollableSelector", "isAlwaysVisible"]);
|
5658 | const [visible, setVisible] = React__namespace.useState(isAlwaysVisible);
|
5659 | React__namespace.useEffect(() => {
|
5660 | setVisible(isAlwaysVisible);
|
5661 | }, [isAlwaysVisible]);
|
5662 | const [scrollElement, setScrollElement] = React__namespace.useState(null);
|
5663 | const toggleVisible = () => {
|
5664 | const scrolled = scrollElement.scrollY ? scrollElement.scrollY : scrollElement.scrollTop;
|
5665 | if (!isAlwaysVisible) {
|
5666 | if (scrolled > 400) {
|
5667 | setVisible(true);
|
5668 | }
|
5669 | else {
|
5670 | setVisible(false);
|
5671 | }
|
5672 | }
|
5673 | };
|
5674 | React__namespace.useEffect(() => {
|
5675 | const hasScrollSpy = Boolean(scrollableSelector);
|
5676 | if (hasScrollSpy) {
|
5677 | const scrollEl = document.querySelector(scrollableSelector);
|
5678 | if (!canUseDOM || !(scrollEl instanceof HTMLElement)) {
|
5679 | return;
|
5680 | }
|
5681 | setScrollElement(scrollEl);
|
5682 | scrollEl.addEventListener('scroll', toggleVisible);
|
5683 | return () => {
|
5684 | scrollEl.removeEventListener('scroll', toggleVisible);
|
5685 | };
|
5686 | }
|
5687 | else {
|
5688 | if (!canUseDOM) {
|
5689 | return;
|
5690 | }
|
5691 | const scrollEl = window;
|
5692 | setScrollElement(scrollEl);
|
5693 | scrollEl.addEventListener('scroll', toggleVisible);
|
5694 | return () => {
|
5695 | scrollEl.removeEventListener('scroll', toggleVisible);
|
5696 | };
|
5697 | }
|
5698 | }, [scrollableSelector, toggleVisible]);
|
5699 | const handleClick = () => {
|
5700 | scrollElement.scrollTo({ top: 0, behavior: 'smooth' });
|
5701 | };
|
5702 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$13.backToTop, !visible && styles$13.modifiers.hidden, className), ref: innerRef, onClick: handleClick }, props),
|
5703 | React__namespace.createElement(Button, { variant: "primary", icon: React__namespace.createElement(AngleUpIcon$1, { "aria-hidden": "true" }), iconPosition: "right" }, title)));
|
5704 | };
|
5705 | const BackToTop = React__namespace.forwardRef((props, ref) => (React__namespace.createElement(BackToTopBase, Object.assign({ innerRef: ref }, props))));
|
5706 | BackToTop.displayName = 'BackToTop';
|
5707 |
|
5708 | const c_background_image_BackgroundImage = {
|
5709 | "name": "--pf-c-background-image--BackgroundImage",
|
5710 | "value": "url(\"../../assets/images/pfbg_576.jpg\")",
|
5711 | "var": "var(--pf-c-background-image--BackgroundImage)"
|
5712 | };
|
5713 | var cssVar = c_background_image_BackgroundImage;
|
5714 |
|
5715 | const c_background_image_BackgroundImage_2x = {
|
5716 | "name": "--pf-c-background-image--BackgroundImage-2x",
|
5717 | "value": "url(\"../../assets/images/pfbg_576@2x.jpg\")",
|
5718 | "var": "var(--pf-c-background-image--BackgroundImage-2x)"
|
5719 | };
|
5720 | var cssVarName2x = c_background_image_BackgroundImage_2x;
|
5721 |
|
5722 | const c_background_image_BackgroundImage_sm = {
|
5723 | "name": "--pf-c-background-image--BackgroundImage--sm",
|
5724 | "value": "url(\"../../assets/images/pfbg_768.jpg\")",
|
5725 | "var": "var(--pf-c-background-image--BackgroundImage--sm)"
|
5726 | };
|
5727 | var cssVarNameSm = c_background_image_BackgroundImage_sm;
|
5728 |
|
5729 | const c_background_image_BackgroundImage_sm_2x = {
|
5730 | "name": "--pf-c-background-image--BackgroundImage--sm-2x",
|
5731 | "value": "url(\"../../assets/images/pfbg_768@2x.jpg\")",
|
5732 | "var": "var(--pf-c-background-image--BackgroundImage--sm-2x)"
|
5733 | };
|
5734 | var cssVarNameSm2x = c_background_image_BackgroundImage_sm_2x;
|
5735 |
|
5736 | const c_background_image_BackgroundImage_lg = {
|
5737 | "name": "--pf-c-background-image--BackgroundImage--lg",
|
5738 | "value": "url(\"../../assets/images/pfbg_2000.jpg\")",
|
5739 | "var": "var(--pf-c-background-image--BackgroundImage--lg)"
|
5740 | };
|
5741 | var cssVarNameLg = c_background_image_BackgroundImage_lg;
|
5742 |
|
5743 | const c_background_image_Filter = {
|
5744 | "name": "--pf-c-background-image--Filter",
|
5745 | "value": "url(\"#image_overlay\")",
|
5746 | "var": "var(--pf-c-background-image--Filter)"
|
5747 | };
|
5748 | var cssVarNameFilter = c_background_image_Filter;
|
5749 |
|
5750 | Promise.resolve().then(function () { return backgroundImage; });
|
5751 | var styles$12 = {
|
5752 | "backgroundImage": "pf-c-background-image",
|
5753 | "backgroundImageFilter": "pf-c-background-image__filter"
|
5754 | };
|
5755 |
|
5756 | const defaultFilter = (React__namespace.createElement("filter", null,
|
5757 | React__namespace.createElement("feColorMatrix", { type: "matrix", values: "1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 0" }),
|
5758 | React__namespace.createElement("feComponentTransfer", { colorInterpolationFilters: "sRGB", result: "duotone" },
|
5759 | React__namespace.createElement("feFuncR", { type: "table", tableValues: "0.086274509803922 0.43921568627451" }),
|
5760 | React__namespace.createElement("feFuncG", { type: "table", tableValues: "0.086274509803922 0.43921568627451" }),
|
5761 | React__namespace.createElement("feFuncB", { type: "table", tableValues: "0.086274509803922 0.43921568627451" }),
|
5762 | React__namespace.createElement("feFuncA", { type: "table", tableValues: "0 1" }))));
|
5763 | let filterCounter = 0;
|
5764 | const BackgroundImage = (_a) => {
|
5765 | var { className, src, filter = defaultFilter } = _a, props = __rest$1(_a, ["className", "src", "filter"]);
|
5766 | const getUrlValue = (size) => {
|
5767 | if (typeof src === 'string') {
|
5768 | return `url(${src})`;
|
5769 | }
|
5770 | else if (typeof src === 'object') {
|
5771 | return `url(${src[size]})`;
|
5772 | }
|
5773 | return '';
|
5774 | };
|
5775 | const filterNum = React__namespace.useMemo(() => filterCounter++, []);
|
5776 | const filterId = `patternfly-background-image-filter-overlay${filterNum}`;
|
5777 | const style = {
|
5778 | [cssVar.name]: getUrlValue('xs'),
|
5779 | [cssVarName2x.name]: getUrlValue('xs2x'),
|
5780 | [cssVarNameSm.name]: getUrlValue('sm'),
|
5781 | [cssVarNameSm2x.name]: getUrlValue('sm2x'),
|
5782 | [cssVarNameLg.name]: getUrlValue('lg'),
|
5783 | [cssVarNameFilter.name]: `url(#${filterId})`
|
5784 | };
|
5785 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$12.backgroundImage, className), style: style }, props),
|
5786 | React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", className: "pf-c-background-image__filter", width: "0", height: "0" }, React__namespace.cloneElement(filter, { id: filterId }))));
|
5787 | };
|
5788 | BackgroundImage.displayName = 'BackgroundImage';
|
5789 |
|
5790 | Promise.resolve().then(function () { return banner; });
|
5791 | var styles$11 = {
|
5792 | "banner": "pf-c-banner",
|
5793 | "button": "pf-c-button",
|
5794 | "card": "pf-c-card",
|
5795 | "modifiers": {
|
5796 | "warning": "pf-m-warning",
|
5797 | "info": "pf-m-info",
|
5798 | "danger": "pf-m-danger",
|
5799 | "success": "pf-m-success",
|
5800 | "sticky": "pf-m-sticky",
|
5801 | "disabled": "pf-m-disabled",
|
5802 | "inline": "pf-m-inline"
|
5803 | }
|
5804 | };
|
5805 |
|
5806 | const Banner = (_a) => {
|
5807 | var { children, className, variant = 'default', isSticky = false } = _a, props = __rest$1(_a, ["children", "className", "variant", "isSticky"]);
|
5808 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$11.banner, styles$11.modifiers[variant], isSticky && styles$11.modifiers.sticky, className) }, props), children));
|
5809 | };
|
5810 | Banner.displayName = 'Banner';
|
5811 |
|
5812 | Promise.resolve().then(function () { return brand; });
|
5813 | var styles$10 = {
|
5814 | "brand": "pf-c-brand",
|
5815 | "modifiers": {
|
5816 | "picture": "pf-m-picture"
|
5817 | }
|
5818 | };
|
5819 |
|
5820 | const Brand = (_a) => {
|
5821 | var { className = '', src = '', alt, children, widths, heights, style } = _a, props = __rest$1(_a, ["className", "src", "alt", "children", "widths", "heights", "style"]);
|
5822 | if (children !== undefined && widths !== undefined) {
|
5823 | style = Object.assign(Object.assign({}, style), setBreakpointCssVars(widths, '--pf-c-brand--Width'));
|
5824 | }
|
5825 | if (children !== undefined && heights !== undefined) {
|
5826 | style = Object.assign(Object.assign({}, style), setBreakpointCssVars(heights, '--pf-c-brand--Height'));
|
5827 | }
|
5828 | return (
|
5829 |
|
5830 | children !== undefined ? (React__namespace.createElement("picture", Object.assign({ className: css(styles$10.brand, styles$10.modifiers.picture, className), style: style }, props),
|
5831 | children,
|
5832 | React__namespace.createElement("img", { src: src, alt: alt }))) : (React__namespace.createElement("img", Object.assign({}, props, { className: css(styles$10.brand, className), src: src, alt: alt }))));
|
5833 | };
|
5834 | Brand.displayName = 'Brand';
|
5835 |
|
5836 | Promise.resolve().then(function () { return breadcrumb; });
|
5837 | var styles$$ = {
|
5838 | "breadcrumb": "pf-c-breadcrumb",
|
5839 | "breadcrumbDropdown": "pf-c-breadcrumb__dropdown",
|
5840 | "breadcrumbHeading": "pf-c-breadcrumb__heading",
|
5841 | "breadcrumbItem": "pf-c-breadcrumb__item",
|
5842 | "breadcrumbItemDivider": "pf-c-breadcrumb__item-divider",
|
5843 | "breadcrumbLink": "pf-c-breadcrumb__link",
|
5844 | "breadcrumbList": "pf-c-breadcrumb__list",
|
5845 | "dropdownToggle": "pf-c-dropdown__toggle",
|
5846 | "modifiers": {
|
5847 | "current": "pf-m-current",
|
5848 | "overpassFont": "pf-m-overpass-font"
|
5849 | }
|
5850 | };
|
5851 |
|
5852 | const Breadcrumb = (_a) => {
|
5853 | var { children = null, className = '', 'aria-label': ariaLabel = 'Breadcrumb', ouiaId, ouiaSafe = true } = _a, props = __rest$1(_a, ["children", "className", 'aria-label', "ouiaId", "ouiaSafe"]);
|
5854 | const ouiaProps = useOUIAProps(Breadcrumb.displayName, ouiaId, ouiaSafe);
|
5855 | return (React__namespace.createElement("nav", Object.assign({}, props, { "aria-label": ariaLabel, className: css(styles$$.breadcrumb, className) }, ouiaProps),
|
5856 | React__namespace.createElement("ol", { className: styles$$.breadcrumbList }, React__namespace.Children.map(children, (child, index) => {
|
5857 | const showDivider = index > 0;
|
5858 | if (React__namespace.isValidElement(child)) {
|
5859 | return React__namespace.cloneElement(child, { showDivider });
|
5860 | }
|
5861 | return child;
|
5862 | }))));
|
5863 | };
|
5864 | Breadcrumb.displayName = 'Breadcrumb';
|
5865 |
|
5866 | const BreadcrumbItem = (_a) => {
|
5867 | var { children = null, className: classNameProp = '', to = undefined, isActive = false, isDropdown = false, showDivider, target = undefined, component = 'a', render = undefined } = _a, props = __rest$1(_a, ["children", "className", "to", "isActive", "isDropdown", "showDivider", "target", "component", "render"]);
|
5868 | const Component = component;
|
5869 | const ariaCurrent = isActive ? 'page' : undefined;
|
5870 | const className = css(styles$$.breadcrumbLink, isActive && styles$$.modifiers.current);
|
5871 | return (React__namespace.createElement("li", Object.assign({}, props, { className: css(styles$$.breadcrumbItem, classNameProp) }),
|
5872 | showDivider && (React__namespace.createElement("span", { className: styles$$.breadcrumbItemDivider },
|
5873 | React__namespace.createElement(AngleRightIcon$1, null))),
|
5874 | component === 'button' && (React__namespace.createElement("button", { className: className, "aria-current": ariaCurrent, type: "button" }, children)),
|
5875 | isDropdown && React__namespace.createElement("span", { className: css(styles$$.breadcrumbDropdown) }, children),
|
5876 | render && render({ className, ariaCurrent }),
|
5877 | to && !render && (React__namespace.createElement(Component, { href: to, target: target, className: className, "aria-current": ariaCurrent }, children)),
|
5878 | !to && component !== 'button' && !isDropdown && children));
|
5879 | };
|
5880 | BreadcrumbItem.displayName = 'BreadcrumbItem';
|
5881 |
|
5882 | const BreadcrumbHeading = (_a) => {
|
5883 | var { children = null, className = '', to = undefined, target = undefined, component = 'a', showDivider } = _a, props = __rest$1(_a, ["children", "className", "to", "target", "component", "showDivider"]);
|
5884 | const Component = component;
|
5885 | return (React__namespace.createElement("li", Object.assign({}, props, { className: css(styles$$.breadcrumbItem, className) }),
|
5886 | showDivider && (React__namespace.createElement("span", { className: styles$$.breadcrumbItemDivider },
|
5887 | React__namespace.createElement(AngleRightIcon$1, null))),
|
5888 | React__namespace.createElement("h1", { className: styles$$.breadcrumbHeading },
|
5889 | !to && component === 'button' && (React__namespace.createElement("button", { className: css(styles$$.breadcrumbLink, styles$$.modifiers.current), "aria-current": true, type: "button" }, children)),
|
5890 | to && (React__namespace.createElement(Component, { href: to, target: target, className: css(styles$$.breadcrumbLink, styles$$.modifiers.current), "aria-current": "page" }, children)),
|
5891 | !to && component !== 'button' && React__namespace.createElement(React__namespace.Fragment, null, children))));
|
5892 | };
|
5893 | BreadcrumbHeading.displayName = 'BreadcrumbHeading';
|
5894 |
|
5895 | exports.TextInputTypes = void 0;
|
5896 | (function (TextInputTypes) {
|
5897 | TextInputTypes["text"] = "text";
|
5898 | TextInputTypes["date"] = "date";
|
5899 | TextInputTypes["datetimeLocal"] = "datetime-local";
|
5900 | TextInputTypes["email"] = "email";
|
5901 | TextInputTypes["month"] = "month";
|
5902 | TextInputTypes["number"] = "number";
|
5903 | TextInputTypes["password"] = "password";
|
5904 | TextInputTypes["search"] = "search";
|
5905 | TextInputTypes["tel"] = "tel";
|
5906 | TextInputTypes["time"] = "time";
|
5907 | TextInputTypes["url"] = "url";
|
5908 | })(exports.TextInputTypes || (exports.TextInputTypes = {}));
|
5909 | class TextInputBase extends React__namespace.Component {
|
5910 | constructor(props) {
|
5911 | super(props);
|
5912 | this.inputRef = React__namespace.createRef();
|
5913 | this.observer = () => { };
|
5914 | this.handleChange = (event) => {
|
5915 | if (this.props.onChange) {
|
5916 | this.props.onChange(event.currentTarget.value, event);
|
5917 | }
|
5918 | };
|
5919 | this.handleResize = () => {
|
5920 | const inputRef = this.props.innerRef || this.inputRef;
|
5921 | if (inputRef && inputRef.current) {
|
5922 | trimLeft(inputRef.current, String(this.props.value));
|
5923 | }
|
5924 | };
|
5925 | this.restoreText = () => {
|
5926 | const inputRef = this.props.innerRef || this.inputRef;
|
5927 |
|
5928 | inputRef.current.value = String(this.props.value);
|
5929 |
|
5930 | inputRef.current.scrollLeft = inputRef.current.scrollWidth;
|
5931 | };
|
5932 | this.onFocus = (event) => {
|
5933 | const { isLeftTruncated, onFocus } = this.props;
|
5934 | if (isLeftTruncated) {
|
5935 | this.restoreText();
|
5936 | }
|
5937 | onFocus && onFocus(event);
|
5938 | };
|
5939 | this.onBlur = (event) => {
|
5940 | const { isLeftTruncated, onBlur } = this.props;
|
5941 | if (isLeftTruncated) {
|
5942 | this.handleResize();
|
5943 | }
|
5944 | onBlur && onBlur(event);
|
5945 | };
|
5946 | this.sanitizeInputValue = (value) => typeof value === 'string' ? value.replace(/\n/g, ' ') : value;
|
5947 | if (!props.id && !props['aria-label'] && !props['aria-labelledby']) {
|
5948 |
|
5949 | console.error('Text input:', 'Text input requires either an id or aria-label to be specified');
|
5950 | }
|
5951 | this.state = {
|
5952 | ouiaStateId: getDefaultOUIAId(TextInputBase.displayName)
|
5953 | };
|
5954 | }
|
5955 | componentDidMount() {
|
5956 | if (this.props.isLeftTruncated) {
|
5957 | const inputRef = this.props.innerRef || this.inputRef;
|
5958 | this.observer = getResizeObserver(inputRef.current, this.handleResize);
|
5959 | this.handleResize();
|
5960 | }
|
5961 | }
|
5962 | componentWillUnmount() {
|
5963 | if (this.props.isLeftTruncated) {
|
5964 | this.observer();
|
5965 | }
|
5966 | }
|
5967 | render() {
|
5968 | const _a = this.props, { innerRef, className, type, value, validated,
|
5969 |
|
5970 | onChange, onFocus, onBlur, isLeftTruncated,
|
5971 |
|
5972 | isReadOnly, isRequired, isDisabled, isIconSprite, iconVariant, customIconUrl, customIconDimensions, ouiaId, ouiaSafe } = _a, props = __rest$1(_a, ["innerRef", "className", "type", "value", "validated", "onChange", "onFocus", "onBlur", "isLeftTruncated", "isReadOnly", "isRequired", "isDisabled", "isIconSprite", "iconVariant", "customIconUrl", "customIconDimensions", "ouiaId", "ouiaSafe"]);
|
5973 | const customIconStyle = {};
|
5974 | if (customIconUrl) {
|
5975 | customIconStyle.backgroundImage = `url('${customIconUrl}')`;
|
5976 | }
|
5977 | if (customIconDimensions) {
|
5978 | customIconStyle.backgroundSize = customIconDimensions;
|
5979 | }
|
5980 | return (React__namespace.createElement("input", Object.assign({}, props, { onFocus: this.onFocus, onBlur: this.onBlur, className: css(formStyles.formControl, isIconSprite && formStyles.modifiers.iconSprite, validated === exports.ValidatedOptions.success && formStyles.modifiers.success, validated === exports.ValidatedOptions.warning && formStyles.modifiers.warning, ((iconVariant && iconVariant !== 'search') || customIconUrl) && formStyles.modifiers.icon, iconVariant && formStyles.modifiers[iconVariant], className), onChange: this.handleChange, type: type, value: this.sanitizeInputValue(value), "aria-invalid": props['aria-invalid'] ? props['aria-invalid'] : validated === exports.ValidatedOptions.error, required: isRequired, disabled: isDisabled, readOnly: isReadOnly, ref: innerRef || this.inputRef }, ((customIconUrl || customIconDimensions) && { style: customIconStyle }), getOUIAProps(TextInput.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId, ouiaSafe))));
|
5981 | }
|
5982 | }
|
5983 | TextInputBase.displayName = 'TextInputBase';
|
5984 | TextInputBase.defaultProps = {
|
5985 | 'aria-label': null,
|
5986 | className: '',
|
5987 | isRequired: false,
|
5988 | validated: 'default',
|
5989 | isDisabled: false,
|
5990 | isReadOnly: false,
|
5991 | isIconSprite: false,
|
5992 | type: exports.TextInputTypes.text,
|
5993 | isLeftTruncated: false,
|
5994 | onChange: () => undefined,
|
5995 | ouiaSafe: true
|
5996 | };
|
5997 | const TextInput = React__namespace.forwardRef((props, ref) => (React__namespace.createElement(TextInputBase, Object.assign({}, props, { innerRef: ref }))));
|
5998 | TextInput.displayName = 'TextInput';
|
5999 |
|
6000 | Promise.resolve().then(function () { return select; });
|
6001 | var styles$_ = {
|
6002 | "check": "pf-c-check",
|
6003 | "checkLabel": "pf-c-check__label",
|
6004 | "chipGroup": "pf-c-chip-group",
|
6005 | "divider": "pf-c-divider",
|
6006 | "formControl": "pf-c-form-control",
|
6007 | "modifiers": {
|
6008 | "invalid": "pf-m-invalid",
|
6009 | "success": "pf-m-success",
|
6010 | "warning": "pf-m-warning",
|
6011 | "disabled": "pf-m-disabled",
|
6012 | "active": "pf-m-active",
|
6013 | "expanded": "pf-m-expanded",
|
6014 | "plain": "pf-m-plain",
|
6015 | "typeahead": "pf-m-typeahead",
|
6016 | "placeholder": "pf-m-placeholder",
|
6017 | "top": "pf-m-top",
|
6018 | "alignRight": "pf-m-align-right",
|
6019 | "favorite": "pf-m-favorite",
|
6020 | "favoriteAction": "pf-m-favorite-action",
|
6021 | "focus": "pf-m-focus",
|
6022 | "link": "pf-m-link",
|
6023 | "action": "pf-m-action",
|
6024 | "selected": "pf-m-selected",
|
6025 | "description": "pf-m-description",
|
6026 | "load": "pf-m-load",
|
6027 | "loading": "pf-m-loading"
|
6028 | },
|
6029 | "select": "pf-c-select",
|
6030 | "selectListItem": "pf-c-select__list-item",
|
6031 | "selectMenu": "pf-c-select__menu",
|
6032 | "selectMenuFieldset": "pf-c-select__menu-fieldset",
|
6033 | "selectMenuFooter": "pf-c-select__menu-footer",
|
6034 | "selectMenuGroup": "pf-c-select__menu-group",
|
6035 | "selectMenuGroupTitle": "pf-c-select__menu-group-title",
|
6036 | "selectMenuItem": "pf-c-select__menu-item",
|
6037 | "selectMenuItemActionIcon": "pf-c-select__menu-item-action-icon",
|
6038 | "selectMenuItemCount": "pf-c-select__menu-item-count",
|
6039 | "selectMenuItemDescription": "pf-c-select__menu-item-description",
|
6040 | "selectMenuItemIcon": "pf-c-select__menu-item-icon",
|
6041 | "selectMenuItemMain": "pf-c-select__menu-item-main",
|
6042 | "selectMenuItemMatch": "pf-c-select__menu-item--match",
|
6043 | "selectMenuItemRow": "pf-c-select__menu-item-row",
|
6044 | "selectMenuItemText": "pf-c-select__menu-item-text",
|
6045 | "selectMenuSearch": "pf-c-select__menu-search",
|
6046 | "selectMenuWrapper": "pf-c-select__menu-wrapper",
|
6047 | "selectToggle": "pf-c-select__toggle",
|
6048 | "selectToggleArrow": "pf-c-select__toggle-arrow",
|
6049 | "selectToggleBadge": "pf-c-select__toggle-badge",
|
6050 | "selectToggleButton": "pf-c-select__toggle-button",
|
6051 | "selectToggleClear": "pf-c-select__toggle-clear",
|
6052 | "selectToggleIcon": "pf-c-select__toggle-icon",
|
6053 | "selectToggleStatusIcon": "pf-c-select__toggle-status-icon",
|
6054 | "selectToggleText": "pf-c-select__toggle-text",
|
6055 | "selectToggleTypeahead": "pf-c-select__toggle-typeahead",
|
6056 | "selectToggleWrapper": "pf-c-select__toggle-wrapper"
|
6057 | };
|
6058 |
|
6059 | const TimesCircleIconConfig = {
|
6060 | name: 'TimesCircleIcon',
|
6061 | height: 512,
|
6062 | width: 512,
|
6063 | svgPath: 'M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm121.6 313.1c4.7 4.7 4.7 12.3 0 17L338 377.6c-4.7 4.7-12.3 4.7-17 0L256 312l-65.1 65.6c-4.7 4.7-12.3 4.7-17 0L134.4 338c-4.7-4.7-4.7-12.3 0-17l65.6-65-65.6-65.1c-4.7-4.7-4.7-12.3 0-17l39.6-39.6c4.7-4.7 12.3-4.7 17 0l65 65.7 65.1-65.6c4.7-4.7 12.3-4.7 17 0l39.6 39.6c4.7 4.7 4.7 12.3 0 17L312 256l65.6 65.1z',
|
6064 | yOffset: 0,
|
6065 | xOffset: 0,
|
6066 | };
|
6067 |
|
6068 | const TimesCircleIcon = createIcon(TimesCircleIconConfig);
|
6069 |
|
6070 | var TimesCircleIcon$1 = TimesCircleIcon;
|
6071 |
|
6072 | Promise.resolve().then(function () { return form; });
|
6073 | var styles$Z = {
|
6074 | "form": "pf-c-form",
|
6075 | "formActions": "pf-c-form__actions",
|
6076 | "formFieldGroup": "pf-c-form__field-group",
|
6077 | "formFieldGroupBody": "pf-c-form__field-group-body",
|
6078 | "formFieldGroupHeader": "pf-c-form__field-group-header",
|
6079 | "formFieldGroupHeaderActions": "pf-c-form__field-group-header-actions",
|
6080 | "formFieldGroupHeaderDescription": "pf-c-form__field-group-header-description",
|
6081 | "formFieldGroupHeaderMain": "pf-c-form__field-group-header-main",
|
6082 | "formFieldGroupHeaderTitle": "pf-c-form__field-group-header-title",
|
6083 | "formFieldGroupHeaderTitleText": "pf-c-form__field-group-header-title-text",
|
6084 | "formFieldGroupToggle": "pf-c-form__field-group-toggle",
|
6085 | "formFieldGroupToggleButton": "pf-c-form__field-group-toggle-button",
|
6086 | "formFieldGroupToggleIcon": "pf-c-form__field-group-toggle-icon",
|
6087 | "formFieldset": "pf-c-form__fieldset",
|
6088 | "formGroup": "pf-c-form__group",
|
6089 | "formGroupControl": "pf-c-form__group-control",
|
6090 | "formGroupLabel": "pf-c-form__group-label",
|
6091 | "formGroupLabelHelp": "pf-c-form__group-label-help",
|
6092 | "formGroupLabelInfo": "pf-c-form__group-label-info",
|
6093 | "formGroupLabelMain": "pf-c-form__group-label-main",
|
6094 | "formHelperText": "pf-c-form__helper-text",
|
6095 | "formHelperTextIcon": "pf-c-form__helper-text-icon",
|
6096 | "formLabel": "pf-c-form__label",
|
6097 | "formLabelRequired": "pf-c-form__label-required",
|
6098 | "formLabelText": "pf-c-form__label-text",
|
6099 | "formSection": "pf-c-form__section",
|
6100 | "formSectionTitle": "pf-c-form__section-title",
|
6101 | "modifiers": {
|
6102 | "horizontal": "pf-m-horizontal",
|
6103 | "alignRight": "pf-m-align-right",
|
6104 | "noPaddingTop": "pf-m-no-padding-top",
|
6105 | "horizontalOnXs": "pf-m-horizontal-on-xs",
|
6106 | "horizontalOnSm": "pf-m-horizontal-on-sm",
|
6107 | "horizontalOnMd": "pf-m-horizontal-on-md",
|
6108 | "horizontalOnLg": "pf-m-horizontal-on-lg",
|
6109 | "horizontalOnXl": "pf-m-horizontal-on-xl",
|
6110 | "horizontalOn_2xl": "pf-m-horizontal-on-2xl",
|
6111 | "limitWidth": "pf-m-limit-width",
|
6112 | "action": "pf-m-action",
|
6113 | "info": "pf-m-info",
|
6114 | "disabled": "pf-m-disabled",
|
6115 | "inline": "pf-m-inline",
|
6116 | "stack": "pf-m-stack",
|
6117 | "error": "pf-m-error",
|
6118 | "success": "pf-m-success",
|
6119 | "warning": "pf-m-warning",
|
6120 | "inactive": "pf-m-inactive",
|
6121 | "hidden": "pf-m-hidden",
|
6122 | "expanded": "pf-m-expanded"
|
6123 | }
|
6124 | };
|
6125 |
|
6126 | Promise.resolve().then(function () { return check; });
|
6127 | var styles$Y = {
|
6128 | "check": "pf-c-check",
|
6129 | "checkBody": "pf-c-check__body",
|
6130 | "checkDescription": "pf-c-check__description",
|
6131 | "checkInput": "pf-c-check__input",
|
6132 | "checkLabel": "pf-c-check__label",
|
6133 | "modifiers": {
|
6134 | "standalone": "pf-m-standalone",
|
6135 | "disabled": "pf-m-disabled"
|
6136 | }
|
6137 | };
|
6138 |
|
6139 | const CheckIconConfig = {
|
6140 | name: 'CheckIcon',
|
6141 | height: 512,
|
6142 | width: 512,
|
6143 | svgPath: 'M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z',
|
6144 | yOffset: 0,
|
6145 | xOffset: 0,
|
6146 | };
|
6147 |
|
6148 | const CheckIcon = createIcon(CheckIconConfig);
|
6149 |
|
6150 | var CheckIcon$1 = CheckIcon;
|
6151 |
|
6152 | const SelectContext = React__namespace.createContext(null);
|
6153 | const SelectProvider = SelectContext.Provider;
|
6154 | const SelectConsumer = SelectContext.Consumer;
|
6155 | exports.SelectVariant = void 0;
|
6156 | (function (SelectVariant) {
|
6157 | SelectVariant["single"] = "single";
|
6158 | SelectVariant["checkbox"] = "checkbox";
|
6159 | SelectVariant["typeahead"] = "typeahead";
|
6160 | SelectVariant["typeaheadMulti"] = "typeaheadmulti";
|
6161 | })(exports.SelectVariant || (exports.SelectVariant = {}));
|
6162 | exports.SelectPosition = void 0;
|
6163 | (function (SelectPosition) {
|
6164 | SelectPosition["right"] = "right";
|
6165 | SelectPosition["left"] = "left";
|
6166 | })(exports.SelectPosition || (exports.SelectPosition = {}));
|
6167 | exports.SelectDirection = void 0;
|
6168 | (function (SelectDirection) {
|
6169 | SelectDirection["up"] = "up";
|
6170 | SelectDirection["down"] = "down";
|
6171 | })(exports.SelectDirection || (exports.SelectDirection = {}));
|
6172 | const SelectFooterTabbableItems = 'input, button, select, textarea, a[href]';
|
6173 |
|
6174 | class SelectOption extends React__namespace.Component {
|
6175 | constructor() {
|
6176 | super(...arguments);
|
6177 | this.ref = React__namespace.createRef();
|
6178 | this.liRef = React__namespace.createRef();
|
6179 | this.favoriteRef = React__namespace.createRef();
|
6180 | this.onKeyDown = (event, innerIndex, onEnter, isCheckbox) => {
|
6181 | const { index, keyHandler, isLastOptionBeforeFooter } = this.props;
|
6182 | let isLastItemBeforeFooter = false;
|
6183 | if (isLastOptionBeforeFooter !== undefined) {
|
6184 | isLastItemBeforeFooter = isLastOptionBeforeFooter(index);
|
6185 | }
|
6186 | if (event.key === KeyTypes.Tab) {
|
6187 |
|
6188 | if (isCheckbox && !isLastItemBeforeFooter) {
|
6189 | if (event.shiftKey) {
|
6190 | keyHandler(index, innerIndex, 'up');
|
6191 | }
|
6192 | else {
|
6193 | keyHandler(index, innerIndex, 'down');
|
6194 | }
|
6195 | event.stopPropagation();
|
6196 | }
|
6197 | else {
|
6198 | if (event.shiftKey) {
|
6199 | keyHandler(index, innerIndex, 'up');
|
6200 | }
|
6201 | else {
|
6202 | keyHandler(index, innerIndex, 'tab');
|
6203 | }
|
6204 | }
|
6205 | }
|
6206 | event.preventDefault();
|
6207 | if (event.key === KeyTypes.ArrowUp) {
|
6208 | keyHandler(index, innerIndex, 'up');
|
6209 | }
|
6210 | else if (event.key === KeyTypes.ArrowDown) {
|
6211 | keyHandler(index, innerIndex, 'down');
|
6212 | }
|
6213 | else if (event.key === KeyTypes.ArrowLeft) {
|
6214 | keyHandler(index, innerIndex, 'left');
|
6215 | }
|
6216 | else if (event.key === KeyTypes.ArrowRight) {
|
6217 | keyHandler(index, innerIndex, 'right');
|
6218 | }
|
6219 | else if (event.key === KeyTypes.Enter) {
|
6220 | if (onEnter !== undefined) {
|
6221 | onEnter();
|
6222 | }
|
6223 | else {
|
6224 | this.ref.current.click();
|
6225 | }
|
6226 | }
|
6227 | };
|
6228 | }
|
6229 | componentDidMount() {
|
6230 | this.props.sendRef(this.props.isDisabled ? null : this.ref.current, this.props.isDisabled ? null : this.favoriteRef.current, this.props.isDisabled ? null : this.liRef.current, this.props.index);
|
6231 | }
|
6232 | componentDidUpdate() {
|
6233 | this.props.sendRef(this.props.isDisabled ? null : this.ref.current, this.props.isDisabled ? null : this.favoriteRef.current, this.props.isDisabled ? null : this.liRef.current, this.props.index);
|
6234 | }
|
6235 | render() {
|
6236 |
|
6237 | const _a = this.props, { children, className, id, description, itemCount, value, onClick, isDisabled, isPlaceholder, isNoResultsOption, isSelected, isChecked, isFocused, sendRef, keyHandler, index, component, inputId, isFavorite, ariaIsFavoriteLabel = 'starred', ariaIsNotFavoriteLabel = 'not starred', isLoad, isLoading, setViewMoreNextIndex,
|
6238 |
|
6239 | isLastOptionBeforeFooter, isGrouped = false } = _a, props = __rest$1(_a, ["children", "className", "id", "description", "itemCount", "value", "onClick", "isDisabled", "isPlaceholder", "isNoResultsOption", "isSelected", "isChecked", "isFocused", "sendRef", "keyHandler", "index", "component", "inputId", "isFavorite", "ariaIsFavoriteLabel", "ariaIsNotFavoriteLabel", "isLoad", "isLoading", "setViewMoreNextIndex", "isLastOptionBeforeFooter", "isGrouped"]);
|
6240 |
|
6241 | const Component = component;
|
6242 | if (!id && isFavorite !== null) {
|
6243 |
|
6244 | console.error('Please provide an id to use the favorites feature.');
|
6245 | }
|
6246 | const generatedId = id || getUniqueId('select-option');
|
6247 | const favoriteButton = (onFavorite) => (React__namespace.createElement("button", { className: css(styles$_.selectMenuItem, styles$_.modifiers.action, styles$_.modifiers.favoriteAction), "aria-label": isFavorite ? ariaIsFavoriteLabel : ariaIsNotFavoriteLabel, onClick: () => {
|
6248 | onFavorite(generatedId.replace('favorite-', ''), isFavorite);
|
6249 | }, onKeyDown: event => {
|
6250 | this.onKeyDown(event, 1, () => onFavorite(generatedId.replace('favorite-', ''), isFavorite));
|
6251 | }, ref: this.favoriteRef },
|
6252 | React__namespace.createElement("span", { className: css(styles$_.selectMenuItemActionIcon) },
|
6253 | React__namespace.createElement(StarIcon$1, null))));
|
6254 | const itemDisplay = itemCount ? (React__namespace.createElement("span", { className: css(styles$_.selectMenuItemRow) },
|
6255 | React__namespace.createElement("span", { className: css(styles$_.selectMenuItemText) }, children || (value && value.toString && value.toString())),
|
6256 | React__namespace.createElement("span", { className: css(styles$_.selectMenuItemCount) }, itemCount))) : (children || value.toString());
|
6257 | const onViewMoreClick = (event) => {
|
6258 |
|
6259 | setViewMoreNextIndex();
|
6260 | onClick(event);
|
6261 | };
|
6262 | const renderOption = (onSelect, onClose, variant, inputIdPrefix, onFavorite, shouldResetOnSelect) => {
|
6263 | if (variant !== exports.SelectVariant.checkbox && isLoading && isGrouped) {
|
6264 | return (React__namespace.createElement("div", { role: "presentation", className: css(styles$_.selectListItem, isLoading && styles$_.modifiers.loading, className) }, children));
|
6265 | }
|
6266 | else if (variant !== exports.SelectVariant.checkbox && isLoad && isGrouped) {
|
6267 | return (React__namespace.createElement("div", null,
|
6268 | React__namespace.createElement("button", Object.assign({}, props, { role: "presentation", className: css(styles$_.selectMenuItem, styles$_.modifiers.load, className), onClick: (event) => {
|
6269 | onViewMoreClick(event);
|
6270 | event.stopPropagation();
|
6271 | }, ref: this.ref, type: "button" }), children || value.toString())));
|
6272 | }
|
6273 | else if (variant !== exports.SelectVariant.checkbox) {
|
6274 | return (React__namespace.createElement("li", { id: generatedId, role: "presentation", className: css(isLoading && styles$_.selectListItem, !isLoading && styles$_.selectMenuWrapper, isFavorite && styles$_.modifiers.favorite, isFocused && styles$_.modifiers.focus, isLoading && styles$_.modifiers.loading), ref: this.liRef },
|
6275 | isLoading && children,
|
6276 | isLoad && !isGrouped && (React__namespace.createElement("button", Object.assign({}, props, { className: css(styles$_.selectMenuItem, styles$_.modifiers.load, className), onClick: (event) => {
|
6277 | onViewMoreClick(event);
|
6278 | event.stopPropagation();
|
6279 | }, ref: this.ref, onKeyDown: (event) => {
|
6280 | this.onKeyDown(event, 0);
|
6281 | }, type: "button" }), itemDisplay)),
|
6282 | !isLoading && !isLoad && (React__namespace.createElement(React__namespace.Fragment, null,
|
6283 | React__namespace.createElement(Component, Object.assign({}, props, { className: css(styles$_.selectMenuItem, isLoad && styles$_.modifiers.load, isSelected && styles$_.modifiers.selected, isDisabled && styles$_.modifiers.disabled, description && styles$_.modifiers.description, isFavorite !== null && styles$_.modifiers.link, className), onClick: (event) => {
|
6284 | if (!isDisabled) {
|
6285 | onClick(event);
|
6286 | onSelect(event, value, isPlaceholder);
|
6287 | shouldResetOnSelect && onClose();
|
6288 | }
|
6289 | }, role: "option", "aria-selected": isSelected || null, ref: this.ref, onKeyDown: (event) => {
|
6290 | this.onKeyDown(event, 0);
|
6291 | }, type: "button" }),
|
6292 | description && (React__namespace.createElement(React__namespace.Fragment, null,
|
6293 | React__namespace.createElement("span", { className: css(styles$_.selectMenuItemMain) },
|
6294 | itemDisplay,
|
6295 | isSelected && (React__namespace.createElement("span", { className: css(styles$_.selectMenuItemIcon) },
|
6296 | React__namespace.createElement(CheckIcon$1, { "aria-hidden": true })))),
|
6297 | React__namespace.createElement("span", { className: css(styles$_.selectMenuItemDescription) }, description))),
|
6298 | !description && (React__namespace.createElement(React__namespace.Fragment, null,
|
6299 | itemDisplay,
|
6300 | isSelected && (React__namespace.createElement("span", { className: css(styles$_.selectMenuItemIcon) },
|
6301 | React__namespace.createElement(CheckIcon$1, { "aria-hidden": true })))))),
|
6302 | isFavorite !== null && id && favoriteButton(onFavorite)))));
|
6303 | }
|
6304 | else if (variant === exports.SelectVariant.checkbox && isLoad) {
|
6305 | return (React__namespace.createElement("button", { className: css(styles$_.selectMenuItem, styles$_.modifiers.load, isFocused && styles$_.modifiers.focus, className), onKeyDown: (event) => {
|
6306 | this.onKeyDown(event, 0, undefined, true);
|
6307 | }, onClick: (event) => {
|
6308 | onViewMoreClick(event);
|
6309 | event.stopPropagation();
|
6310 | }, ref: this.ref }, children || (value && value.toString && value.toString())));
|
6311 | }
|
6312 | else if (variant === exports.SelectVariant.checkbox && isLoading) {
|
6313 | return (React__namespace.createElement("div", { className: css(styles$_.selectListItem, isLoading && styles$_.modifiers.loading, className) }, children));
|
6314 | }
|
6315 | else if (variant === exports.SelectVariant.checkbox && !isNoResultsOption && !isLoading && !isLoad) {
|
6316 | return (React__namespace.createElement("label", Object.assign({}, props, { className: css(styles$Y.check, styles$_.selectMenuItem, isDisabled && styles$_.modifiers.disabled, description && styles$_.modifiers.description, className), onKeyDown: (event) => {
|
6317 | this.onKeyDown(event, 0, undefined, true);
|
6318 | } }),
|
6319 | React__namespace.createElement("input", { id: inputId || `${inputIdPrefix}-${value.toString()}`, className: css(styles$Y.checkInput), type: "checkbox", onChange: event => {
|
6320 | if (!isDisabled) {
|
6321 | onClick(event);
|
6322 | onSelect(event, value);
|
6323 | }
|
6324 | }, ref: this.ref, checked: isChecked || false, disabled: isDisabled }),
|
6325 | React__namespace.createElement("span", { className: css(styles$Y.checkLabel, isDisabled && styles$_.modifiers.disabled) }, itemDisplay),
|
6326 | description && React__namespace.createElement("div", { className: css(styles$Y.checkDescription) }, description)));
|
6327 | }
|
6328 | else if (variant === exports.SelectVariant.checkbox && isNoResultsOption && !isLoading && !isLoad) {
|
6329 | return (React__namespace.createElement("div", null,
|
6330 | React__namespace.createElement(Component, Object.assign({}, props, { className: css(styles$_.selectMenuItem, isSelected && styles$_.modifiers.selected, isDisabled && styles$_.modifiers.disabled, className), role: "option", "aria-selected": isSelected || null, ref: this.ref, onKeyDown: (event) => {
|
6331 | this.onKeyDown(event, 0, undefined, true);
|
6332 | }, type: "button" }), itemDisplay)));
|
6333 | }
|
6334 | };
|
6335 | return (React__namespace.createElement(SelectConsumer, null, ({ onSelect, onClose, variant, inputIdPrefix, onFavorite, shouldResetOnSelect }) => (React__namespace.createElement(React__namespace.Fragment, null, renderOption(onSelect, onClose, variant, inputIdPrefix, onFavorite, shouldResetOnSelect)))));
|
6336 | }
|
6337 | }
|
6338 | SelectOption.displayName = 'SelectOption';
|
6339 | SelectOption.defaultProps = {
|
6340 | className: '',
|
6341 | value: '',
|
6342 | index: 0,
|
6343 | isDisabled: false,
|
6344 | isPlaceholder: false,
|
6345 | isSelected: false,
|
6346 | isChecked: false,
|
6347 | isNoResultsOption: false,
|
6348 | component: 'button',
|
6349 | onClick: () => { },
|
6350 | sendRef: () => { },
|
6351 | keyHandler: () => { },
|
6352 | inputId: '',
|
6353 | isFavorite: null,
|
6354 | isLoad: false,
|
6355 | isLoading: false,
|
6356 | setViewMoreNextIndex: () => { },
|
6357 | isLastOptionBeforeFooter: () => false
|
6358 | };
|
6359 |
|
6360 | const SelectGroup = (_a) => {
|
6361 | var { children = [], className = '', label = '', titleId = '' } = _a, props = __rest$1(_a, ["children", "className", "label", "titleId"]);
|
6362 | return (React__namespace.createElement(SelectConsumer, null, ({ variant }) => (React__namespace.createElement("div", Object.assign({}, props, { className: css(styles$_.selectMenuGroup, className) }),
|
6363 | React__namespace.createElement("div", { className: css(styles$_.selectMenuGroupTitle), id: titleId, "aria-hidden": true }, label),
|
6364 | variant === exports.SelectVariant.checkbox ? children : React__namespace.createElement("ul", { role: "listbox" }, children)))));
|
6365 | };
|
6366 | SelectGroup.displayName = 'SelectGroup';
|
6367 |
|
6368 | class SelectMenuWithRef extends React__namespace.Component {
|
6369 | extendChildren(randomId) {
|
6370 | const { children, hasInlineFilter, isGrouped } = this.props;
|
6371 | const childrenArray = children;
|
6372 | let index = hasInlineFilter ? 1 : 0;
|
6373 | if (isGrouped) {
|
6374 | return React__namespace.Children.map(childrenArray, (group) => {
|
6375 | if (group.type === SelectGroup) {
|
6376 | return React__namespace.cloneElement(group, {
|
6377 | titleId: group.props.label && group.props.label.replace(/\W/g, '-'),
|
6378 | children: React__namespace.Children.map(group.props.children, (option) => this.cloneOption(option, index++, randomId))
|
6379 | });
|
6380 | }
|
6381 | else {
|
6382 | return this.cloneOption(group, index++, randomId);
|
6383 | }
|
6384 | });
|
6385 | }
|
6386 | return React__namespace.Children.map(childrenArray, (child) => this.cloneOption(child, index++, randomId));
|
6387 | }
|
6388 | cloneOption(child, index, randomId) {
|
6389 | const { selected, sendRef, keyHandler } = this.props;
|
6390 | const isSelected = this.checkForValue(child.props.value, selected);
|
6391 | if (child.type === Divider) {
|
6392 | return child;
|
6393 | }
|
6394 | return React__namespace.cloneElement(child, {
|
6395 | inputId: `${randomId}-${index}`,
|
6396 | isSelected,
|
6397 | sendRef,
|
6398 | keyHandler,
|
6399 | index
|
6400 | });
|
6401 | }
|
6402 | checkForValue(valueToCheck, options) {
|
6403 | if (!options || !valueToCheck) {
|
6404 | return false;
|
6405 | }
|
6406 | const isSelectOptionObject = typeof valueToCheck !== 'string' &&
|
6407 | valueToCheck.toString &&
|
6408 | valueToCheck.compareTo;
|
6409 | if (Array.isArray(options)) {
|
6410 | if (isSelectOptionObject) {
|
6411 | return options.some(option => option.compareTo(valueToCheck));
|
6412 | }
|
6413 | else {
|
6414 | return options.includes(valueToCheck);
|
6415 | }
|
6416 | }
|
6417 | else {
|
6418 | if (isSelectOptionObject) {
|
6419 | return options.compareTo(valueToCheck);
|
6420 | }
|
6421 | else {
|
6422 | return options === valueToCheck;
|
6423 | }
|
6424 | }
|
6425 | }
|
6426 | extendCheckboxChildren(children) {
|
6427 | const { isGrouped, checked, sendRef, keyHandler, hasInlineFilter, isLastOptionBeforeFooter } = this.props;
|
6428 | let index = hasInlineFilter ? 1 : 0;
|
6429 | if (isGrouped) {
|
6430 | return React__namespace.Children.map(children, (group) => {
|
6431 | if (group.type === Divider) {
|
6432 | return group;
|
6433 | }
|
6434 | else if (group.type === SelectOption) {
|
6435 | return React__namespace.cloneElement(group, {
|
6436 | isChecked: this.checkForValue(group.props.value, checked),
|
6437 | sendRef,
|
6438 | keyHandler,
|
6439 | index: index++,
|
6440 | isLastOptionBeforeFooter
|
6441 | });
|
6442 | }
|
6443 | return React__namespace.cloneElement(group, {
|
6444 | titleId: group.props.label && group.props.label.replace(/\W/g, '-'),
|
6445 | children: group.props.children ? (React__namespace.createElement("fieldset", { "aria-labelledby": group.props.label && group.props.label.replace(/\W/g, '-'), className: css(styles$_.selectMenuFieldset) }, React__namespace.Children.map(group.props.children, (option) => option.type === Divider
|
6446 | ? option
|
6447 | : React__namespace.cloneElement(option, {
|
6448 | isChecked: this.checkForValue(option.props.value, checked),
|
6449 | sendRef,
|
6450 | keyHandler,
|
6451 | index: index++,
|
6452 | isLastOptionBeforeFooter
|
6453 | })))) : null
|
6454 | });
|
6455 | });
|
6456 | }
|
6457 | return React__namespace.Children.map(children, (child) => child.type === Divider
|
6458 | ? child
|
6459 | : React__namespace.cloneElement(child, {
|
6460 | isChecked: this.checkForValue(child.props.value, checked),
|
6461 | sendRef,
|
6462 | keyHandler,
|
6463 | index: index++,
|
6464 | isLastOptionBeforeFooter
|
6465 | }));
|
6466 | }
|
6467 | renderSelectMenu({ variant, inputIdPrefix }) {
|
6468 |
|
6469 | const _a = this.props, { children, isCustomContent, className, isExpanded, openedOnEnter, selected, checked, isGrouped, position, sendRef, keyHandler, maxHeight, noResultsFoundText, createText, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, hasInlineFilter, innerRef, footer, footerRef, isLastOptionBeforeFooter } = _a, props = __rest$1(_a, ["children", "isCustomContent", "className", "isExpanded", "openedOnEnter", "selected", "checked", "isGrouped", "position", "sendRef", "keyHandler", "maxHeight", "noResultsFoundText", "createText", 'aria-label', 'aria-labelledby', "hasInlineFilter", "innerRef", "footer", "footerRef", "isLastOptionBeforeFooter"]);
|
6470 |
|
6471 | let Component = 'div';
|
6472 | const variantProps = Object.assign({ ref: innerRef, className: css(!footer ? styles$_.selectMenu : 'pf-c-select__menu-list', position === exports.SelectPosition.right && styles$_.modifiers.alignRight, className) }, (maxHeight && { style: { maxHeight, overflow: 'auto' } }));
|
6473 | const extendedChildren = () => variant === exports.SelectVariant.checkbox
|
6474 | ? this.extendCheckboxChildren(children)
|
6475 | : this.extendChildren(inputIdPrefix);
|
6476 | if (isCustomContent) {
|
6477 | variantProps.children = children;
|
6478 | }
|
6479 | else if (hasInlineFilter) {
|
6480 | if (React__namespace.Children.count(children) === 0) {
|
6481 | variantProps.children = React__namespace.createElement("fieldset", { className: css(styles$_.selectMenuFieldset) });
|
6482 | }
|
6483 | else {
|
6484 | variantProps.children = (React__namespace.createElement("fieldset", { "aria-label": ariaLabel, "aria-labelledby": (!ariaLabel && ariaLabelledBy) || null, className: css(styles$Z.formFieldset) },
|
6485 | children.shift(),
|
6486 | extendedChildren()));
|
6487 | }
|
6488 | }
|
6489 | else {
|
6490 | variantProps.children = extendedChildren();
|
6491 | if (!isGrouped) {
|
6492 | Component = 'ul';
|
6493 | variantProps.role = 'listbox';
|
6494 | variantProps['aria-label'] = ariaLabel;
|
6495 | variantProps['aria-labelledby'] = (!ariaLabel && ariaLabelledBy) || null;
|
6496 | }
|
6497 | }
|
6498 | return (React__namespace.createElement(React__namespace.Fragment, null,
|
6499 | React__namespace.createElement(Component, Object.assign({}, variantProps, props)),
|
6500 | footer && (React__namespace.createElement("div", { className: css(styles$_.selectMenuFooter), ref: footerRef }, footer))));
|
6501 | }
|
6502 | render() {
|
6503 | return React__namespace.createElement(SelectConsumer, null, context => this.renderSelectMenu(context));
|
6504 | }
|
6505 | }
|
6506 | SelectMenuWithRef.displayName = 'SelectMenu';
|
6507 | SelectMenuWithRef.defaultProps = {
|
6508 | className: '',
|
6509 | isExpanded: false,
|
6510 | isGrouped: false,
|
6511 | openedOnEnter: false,
|
6512 | selected: '',
|
6513 | maxHeight: '',
|
6514 | position: exports.SelectPosition.left,
|
6515 | sendRef: () => { },
|
6516 | keyHandler: () => { },
|
6517 | isCustomContent: false,
|
6518 | hasInlineFilter: false,
|
6519 | isLastOptionBeforeFooter: () => { }
|
6520 | };
|
6521 | const SelectMenu = React__namespace.forwardRef((props, ref) => (React__namespace.createElement(SelectMenuWithRef, Object.assign({ innerRef: ref }, props), props.children)));
|
6522 |
|
6523 | class SelectToggle extends React__namespace.Component {
|
6524 | constructor(props) {
|
6525 | super(props);
|
6526 | this.onDocClick = (event) => {
|
6527 | const { parentRef, menuRef, footerRef, isOpen, onToggle, onClose } = this.props;
|
6528 | const clickedOnToggle = parentRef && parentRef.current && parentRef.current.contains(event.target);
|
6529 | const clickedWithinMenu = menuRef && menuRef.current && menuRef.current.contains && menuRef.current.contains(event.target);
|
6530 | const clickedWithinFooter = footerRef && footerRef.current && footerRef.current.contains && footerRef.current.contains(event.target);
|
6531 | if (isOpen && !(clickedOnToggle || clickedWithinMenu || clickedWithinFooter)) {
|
6532 | onToggle(false, event);
|
6533 | onClose();
|
6534 | }
|
6535 | };
|
6536 | this.handleGlobalKeys = (event) => {
|
6537 | const { parentRef, menuRef, hasFooter, footerRef, isOpen, variant, onToggle, onClose, moveFocusToLastMenuItem } = this.props;
|
6538 | const escFromToggle = parentRef && parentRef.current && parentRef.current.contains(event.target);
|
6539 | const escFromWithinMenu = menuRef && menuRef.current && menuRef.current.contains && menuRef.current.contains(event.target);
|
6540 | if (isOpen &&
|
6541 | event.key === KeyTypes.Tab &&
|
6542 | (variant === exports.SelectVariant.typeahead || variant === exports.SelectVariant.typeaheadMulti)) {
|
6543 | this.props.handleTypeaheadKeys('tab', event.shiftKey);
|
6544 | event.preventDefault();
|
6545 | return;
|
6546 | }
|
6547 | if (isOpen && event.key === KeyTypes.Tab && hasFooter) {
|
6548 | const tabbableItems = findTabbableElements(footerRef, SelectFooterTabbableItems);
|
6549 |
|
6550 | if (tabbableItems.length <= 0) {
|
6551 | onToggle(false, event);
|
6552 | onClose();
|
6553 | this.toggle.current.focus();
|
6554 | return;
|
6555 | }
|
6556 | else {
|
6557 |
|
6558 | const currentElementIndex = tabbableItems.findIndex((item) => item === document.activeElement);
|
6559 | if (currentElementIndex === -1) {
|
6560 | if (event.shiftKey) {
|
6561 | if (variant !== 'checkbox') {
|
6562 |
|
6563 | onToggle(false, event);
|
6564 | onClose();
|
6565 | this.toggle.current.focus();
|
6566 | }
|
6567 | }
|
6568 | else {
|
6569 |
|
6570 | tabbableItems[0].focus();
|
6571 | return;
|
6572 | }
|
6573 | }
|
6574 |
|
6575 | if (event.shiftKey) {
|
6576 |
|
6577 | if (currentElementIndex === 0) {
|
6578 | moveFocusToLastMenuItem();
|
6579 | event.preventDefault();
|
6580 | }
|
6581 | return;
|
6582 | }
|
6583 |
|
6584 | if (currentElementIndex + 1 < tabbableItems.length) {
|
6585 | tabbableItems[currentElementIndex + 1].focus();
|
6586 | }
|
6587 | else {
|
6588 |
|
6589 | onToggle(false, event);
|
6590 | onClose();
|
6591 | this.toggle.current.focus();
|
6592 | }
|
6593 | event.preventDefault();
|
6594 | return;
|
6595 | }
|
6596 | }
|
6597 | if (isOpen &&
|
6598 | (event.key === KeyTypes.Escape || event.key === KeyTypes.Tab) &&
|
6599 | (escFromToggle || escFromWithinMenu)) {
|
6600 | onToggle(false, event);
|
6601 | onClose();
|
6602 | this.toggle.current.focus();
|
6603 | }
|
6604 | };
|
6605 | this.onKeyDown = (event) => {
|
6606 | const { isOpen, onToggle, variant, onClose, onEnter, handleTypeaheadKeys } = this.props;
|
6607 | if (variant === exports.SelectVariant.typeahead || variant === exports.SelectVariant.typeaheadMulti) {
|
6608 | if (event.key === KeyTypes.ArrowDown || event.key === KeyTypes.ArrowUp) {
|
6609 | handleTypeaheadKeys((event.key === KeyTypes.ArrowDown && 'down') || (event.key === KeyTypes.ArrowUp && 'up'));
|
6610 | event.preventDefault();
|
6611 | }
|
6612 | else if (event.key === KeyTypes.Enter) {
|
6613 | if (isOpen) {
|
6614 | handleTypeaheadKeys('enter');
|
6615 | }
|
6616 | else {
|
6617 | onToggle(!isOpen, event);
|
6618 | }
|
6619 | }
|
6620 | }
|
6621 | if (variant === exports.SelectVariant.typeahead ||
|
6622 | variant === exports.SelectVariant.typeaheadMulti ||
|
6623 | (event.key === KeyTypes.Tab && !isOpen) ||
|
6624 | (event.key !== KeyTypes.Enter && event.key !== KeyTypes.Space)) {
|
6625 | return;
|
6626 | }
|
6627 | event.preventDefault();
|
6628 | if ((event.key === KeyTypes.Tab || event.key === KeyTypes.Enter || event.key === KeyTypes.Space) && isOpen) {
|
6629 | onToggle(!isOpen, event);
|
6630 | onClose();
|
6631 | this.toggle.current.focus();
|
6632 | }
|
6633 | else if ((event.key === KeyTypes.Enter || event.key === KeyTypes.Space) && !isOpen) {
|
6634 | onToggle(!isOpen, event);
|
6635 | onEnter();
|
6636 | }
|
6637 | };
|
6638 | const { variant } = props;
|
6639 | const isTypeahead = variant === exports.SelectVariant.typeahead || variant === exports.SelectVariant.typeaheadMulti;
|
6640 | this.toggle = isTypeahead ? React__namespace.createRef() : React__namespace.createRef();
|
6641 | }
|
6642 | componentDidMount() {
|
6643 | document.addEventListener('click', this.onDocClick, { capture: true });
|
6644 | document.addEventListener('touchstart', this.onDocClick);
|
6645 | document.addEventListener('keydown', this.handleGlobalKeys);
|
6646 | }
|
6647 | componentWillUnmount() {
|
6648 | document.removeEventListener('click', this.onDocClick);
|
6649 | document.removeEventListener('touchstart', this.onDocClick);
|
6650 | document.removeEventListener('keydown', this.handleGlobalKeys);
|
6651 | }
|
6652 | render() {
|
6653 |
|
6654 | const _a = this.props, { className, children, isOpen, isActive, isPlain, isDisabled, hasPlaceholderStyle, variant, onToggle, onEnter, onClose, onBlur, onClickTypeaheadToggleButton, handleTypeaheadKeys, moveFocusToLastMenuItem, parentRef, menuRef, id, type, hasClearButton, 'aria-labelledby': ariaLabelledBy, 'aria-label': ariaLabel, hasFooter, footerRef } = _a, props = __rest$1(_a, ["className", "children", "isOpen", "isActive", "isPlain", "isDisabled", "hasPlaceholderStyle", "variant", "onToggle", "onEnter", "onClose", "onBlur", "onClickTypeaheadToggleButton", "handleTypeaheadKeys", "moveFocusToLastMenuItem", "parentRef", "menuRef", "id", "type", "hasClearButton", 'aria-labelledby', 'aria-label', "hasFooter", "footerRef"]);
|
6655 |
|
6656 | const isTypeahead = variant === exports.SelectVariant.typeahead || variant === exports.SelectVariant.typeaheadMulti || hasClearButton;
|
6657 | const toggleProps = {
|
6658 | id,
|
6659 | 'aria-labelledby': ariaLabelledBy,
|
6660 | 'aria-expanded': isOpen,
|
6661 | 'aria-haspopup': (variant !== exports.SelectVariant.checkbox && 'listbox') || null
|
6662 | };
|
6663 | return (React__namespace.createElement(React__namespace.Fragment, null,
|
6664 | !isTypeahead && (React__namespace.createElement("button", Object.assign({}, props, toggleProps, { ref: this.toggle, type: type, className: css(styles$_.selectToggle, hasPlaceholderStyle && styles$_.modifiers.placeholder, isDisabled && styles$_.modifiers.disabled, isPlain && styles$_.modifiers.plain, isActive && styles$_.modifiers.active, className), "aria-label": ariaLabel, onBlur: onBlur,
|
6665 |
|
6666 | onClick: event => {
|
6667 | onToggle(!isOpen, event);
|
6668 | if (isOpen) {
|
6669 | onClose();
|
6670 | }
|
6671 | }, onKeyDown: this.onKeyDown, disabled: isDisabled }),
|
6672 | children,
|
6673 | React__namespace.createElement("span", { className: css(styles$_.selectToggleArrow) },
|
6674 | React__namespace.createElement(CaretDownIcon$1, null)))),
|
6675 | isTypeahead && (React__namespace.createElement("div", Object.assign({}, props, { ref: this.toggle, className: css(styles$_.selectToggle, hasPlaceholderStyle && styles$_.modifiers.placeholder, isDisabled && styles$_.modifiers.disabled, isPlain && styles$_.modifiers.plain, isTypeahead && styles$_.modifiers.typeahead, className), onBlur: onBlur,
|
6676 |
|
6677 | onClick: event => {
|
6678 | if (!isDisabled) {
|
6679 | onToggle(!isOpen, event);
|
6680 | if (isOpen) {
|
6681 | onClose();
|
6682 | }
|
6683 | }
|
6684 | }, onKeyDown: this.onKeyDown }),
|
6685 | children,
|
6686 | React__namespace.createElement("button", Object.assign({}, toggleProps, { type: type, className: css(buttonStyles.button, styles$_.selectToggleButton, styles$_.modifiers.plain), "aria-label": ariaLabel, onClick: event => {
|
6687 | onToggle(!isOpen, event);
|
6688 | if (isOpen) {
|
6689 | onClose();
|
6690 | }
|
6691 | onClickTypeaheadToggleButton();
|
6692 | } }, ((variant === exports.SelectVariant.typeahead || variant === exports.SelectVariant.typeaheadMulti) && {
|
6693 | tabIndex: -1
|
6694 | }), { disabled: isDisabled }),
|
6695 | React__namespace.createElement(CaretDownIcon$1, { className: css(styles$_.selectToggleArrow) }))))));
|
6696 | }
|
6697 | }
|
6698 | SelectToggle.displayName = 'SelectToggle';
|
6699 | SelectToggle.defaultProps = {
|
6700 | className: '',
|
6701 | isOpen: false,
|
6702 | isActive: false,
|
6703 | isPlain: false,
|
6704 | isDisabled: false,
|
6705 | hasPlaceholderStyle: false,
|
6706 | hasClearButton: false,
|
6707 | hasFooter: false,
|
6708 | variant: 'single',
|
6709 | 'aria-labelledby': '',
|
6710 | 'aria-label': '',
|
6711 | type: 'button',
|
6712 | onToggle: () => { },
|
6713 | onEnter: () => { },
|
6714 | onClose: () => { },
|
6715 | onClickTypeaheadToggleButton: () => { }
|
6716 | };
|
6717 |
|
6718 | Promise.resolve().then(function () { return chipGroup; });
|
6719 | var styles$X = {
|
6720 | "chipGroup": "pf-c-chip-group",
|
6721 | "chipGroupClose": "pf-c-chip-group__close",
|
6722 | "chipGroupLabel": "pf-c-chip-group__label",
|
6723 | "chipGroupList": "pf-c-chip-group__list",
|
6724 | "chipGroupListItem": "pf-c-chip-group__list-item",
|
6725 | "chipGroupMain": "pf-c-chip-group__main",
|
6726 | "modifiers": {
|
6727 | "category": "pf-m-category"
|
6728 | }
|
6729 | };
|
6730 |
|
6731 | Promise.resolve().then(function () { return chip; });
|
6732 | var styles$W = {
|
6733 | "badge": "pf-c-badge",
|
6734 | "button": "pf-c-button",
|
6735 | "chip": "pf-c-chip",
|
6736 | "chipIcon": "pf-c-chip__icon",
|
6737 | "chipText": "pf-c-chip__text",
|
6738 | "modifiers": {
|
6739 | "overflow": "pf-m-overflow",
|
6740 | "draggable": "pf-m-draggable"
|
6741 | }
|
6742 | };
|
6743 |
|
6744 | class Chip extends React__namespace.Component {
|
6745 | constructor(props) {
|
6746 | super(props);
|
6747 | this.span = React__namespace.createRef();
|
6748 | this.renderOverflowChip = () => {
|
6749 | const { children, className, onClick, ouiaId } = this.props;
|
6750 | const Component = this.props.component;
|
6751 | return (React__namespace.createElement(Component, Object.assign({ onClick: onClick, className: css(styles$W.chip, styles$W.modifiers.overflow, className) }, (this.props.component === 'button' ? { type: 'button' } : {}), getOUIAProps('OverflowChip', ouiaId !== undefined ? ouiaId : this.state.ouiaStateId)),
|
6752 | React__namespace.createElement("span", { className: css(styles$W.chipText) }, children)));
|
6753 | };
|
6754 | this.renderChip = (randomId) => {
|
6755 | const { children, tooltipPosition } = this.props;
|
6756 | if (this.state.isTooltipVisible) {
|
6757 | return (React__namespace.createElement(Tooltip, { position: tooltipPosition, content: children }, this.renderInnerChip(randomId)));
|
6758 | }
|
6759 | return this.renderInnerChip(randomId);
|
6760 | };
|
6761 | this.state = {
|
6762 | isTooltipVisible: false,
|
6763 | ouiaStateId: getDefaultOUIAId(Chip.displayName)
|
6764 | };
|
6765 | }
|
6766 | componentDidMount() {
|
6767 | this.setState({
|
6768 | isTooltipVisible: Boolean(this.span.current && this.span.current.offsetWidth < this.span.current.scrollWidth)
|
6769 | });
|
6770 | }
|
6771 | renderInnerChip(id) {
|
6772 | const { children, className, onClick, closeBtnAriaLabel, isReadOnly, component, ouiaId } = this.props;
|
6773 | const Component = component;
|
6774 | return (React__namespace.createElement(Component, Object.assign({ className: css(styles$W.chip, className) }, (this.state.isTooltipVisible && { tabIndex: 0 }), getOUIAProps(Chip.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId)),
|
6775 | React__namespace.createElement("span", { ref: this.span, className: css(styles$W.chipText), id: id }, children),
|
6776 | !isReadOnly && (React__namespace.createElement(Button, { onClick: onClick, variant: "plain", "aria-label": closeBtnAriaLabel, id: `remove_${id}`, "aria-labelledby": `remove_${id} ${id}`, ouiaId: ouiaId || closeBtnAriaLabel },
|
6777 | React__namespace.createElement(TimesIcon$1, { "aria-hidden": "true" })))));
|
6778 | }
|
6779 | render() {
|
6780 | const { isOverflowChip } = this.props;
|
6781 | return (React__namespace.createElement(GenerateId, null, randomId => (isOverflowChip ? this.renderOverflowChip() : this.renderChip(this.props.id || randomId))));
|
6782 | }
|
6783 | }
|
6784 | Chip.displayName = 'Chip';
|
6785 | Chip.defaultProps = {
|
6786 | closeBtnAriaLabel: 'close',
|
6787 | className: '',
|
6788 | isOverflowChip: false,
|
6789 | isReadOnly: false,
|
6790 | tooltipPosition: 'top',
|
6791 |
|
6792 | onClick: (_e) => undefined,
|
6793 | component: 'div'
|
6794 | };
|
6795 |
|
6796 | class ChipGroup extends React__namespace.Component {
|
6797 | constructor(props) {
|
6798 | super(props);
|
6799 | this.headingRef = React__namespace.createRef();
|
6800 | this.toggleCollapse = () => {
|
6801 | this.setState(prevState => ({
|
6802 | isOpen: !prevState.isOpen,
|
6803 | isTooltipVisible: Boolean(this.headingRef.current && this.headingRef.current.offsetWidth < this.headingRef.current.scrollWidth)
|
6804 | }));
|
6805 | };
|
6806 | this.state = {
|
6807 | isOpen: this.props.defaultIsOpen,
|
6808 | isTooltipVisible: false
|
6809 | };
|
6810 | }
|
6811 | componentDidMount() {
|
6812 | this.setState({
|
6813 | isTooltipVisible: Boolean(this.headingRef.current && this.headingRef.current.offsetWidth < this.headingRef.current.scrollWidth)
|
6814 | });
|
6815 | }
|
6816 | renderLabel(id) {
|
6817 | const { categoryName, tooltipPosition } = this.props;
|
6818 | const { isTooltipVisible } = this.state;
|
6819 | return isTooltipVisible ? (React__namespace.createElement(Tooltip, { position: tooltipPosition, content: categoryName },
|
6820 | React__namespace.createElement("span", { tabIndex: 0, ref: this.headingRef, className: css(styles$X.chipGroupLabel) },
|
6821 | React__namespace.createElement("span", { id: id }, categoryName)))) : (React__namespace.createElement("span", { ref: this.headingRef, className: css(styles$X.chipGroupLabel), id: id }, categoryName));
|
6822 | }
|
6823 | render() {
|
6824 | const _a = this.props, { categoryName, children, className, isClosable, closeBtnAriaLabel, 'aria-label': ariaLabel, onClick, onOverflowChipClick, numChips, expandedText, collapsedText, ouiaId,
|
6825 |
|
6826 | defaultIsOpen, tooltipPosition } = _a,
|
6827 |
|
6828 | rest = __rest$1(_a, ["categoryName", "children", "className", "isClosable", "closeBtnAriaLabel", 'aria-label', "onClick", "onOverflowChipClick", "numChips", "expandedText", "collapsedText", "ouiaId", "defaultIsOpen", "tooltipPosition"]);
|
6829 | const { isOpen } = this.state;
|
6830 | const numChildren = React__namespace.Children.count(children);
|
6831 | const collapsedTextResult = fillTemplate(collapsedText, {
|
6832 | remaining: React__namespace.Children.count(children) - numChips
|
6833 | });
|
6834 | const renderChipGroup = (id) => {
|
6835 | const chipArray = !isOpen
|
6836 | ? React__namespace.Children.toArray(children).slice(0, numChips)
|
6837 | : React__namespace.Children.toArray(children);
|
6838 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$X.chipGroup, className, categoryName && styles$X.modifiers.category), role: "group" }, (categoryName && { 'aria-labelledby': id }), (!categoryName && { 'aria-label': ariaLabel }), getOUIAProps(ChipGroup.displayName, ouiaId)),
|
6839 | React__namespace.createElement("div", { className: css(styles$X.chipGroupMain) },
|
6840 | categoryName && this.renderLabel(id),
|
6841 | React__namespace.createElement("ul", Object.assign({ className: css(styles$X.chipGroupList) }, (categoryName && { 'aria-labelledby': id }), (!categoryName && { 'aria-label': ariaLabel }), { role: "list" }, rest),
|
6842 | chipArray.map((child, i) => (React__namespace.createElement("li", { className: css(styles$X.chipGroupListItem), key: i }, child))),
|
6843 | numChildren > numChips && (React__namespace.createElement("li", { className: css(styles$X.chipGroupListItem) },
|
6844 | React__namespace.createElement(Chip, { isOverflowChip: true, onClick: event => {
|
6845 | this.toggleCollapse();
|
6846 | onOverflowChipClick(event);
|
6847 | }, component: "button" }, isOpen ? expandedText : collapsedTextResult))))),
|
6848 | isClosable && (React__namespace.createElement("div", { className: css(styles$X.chipGroupClose) },
|
6849 | React__namespace.createElement(Button, { variant: "plain", "aria-label": closeBtnAriaLabel, onClick: onClick, id: `remove_group_${id}`, "aria-labelledby": `remove_group_${id} ${id}`, ouiaId: ouiaId || closeBtnAriaLabel },
|
6850 | React__namespace.createElement(TimesCircleIcon$1, { "aria-hidden": "true" }))))));
|
6851 | };
|
6852 | return numChildren === 0 ? null : React__namespace.createElement(GenerateId, null, randomId => renderChipGroup(this.props.id || randomId));
|
6853 | }
|
6854 | }
|
6855 | ChipGroup.displayName = 'ChipGroup';
|
6856 | ChipGroup.defaultProps = {
|
6857 | expandedText: 'Show Less',
|
6858 | collapsedText: '${remaining} more',
|
6859 | categoryName: '',
|
6860 | defaultIsOpen: false,
|
6861 | numChips: 3,
|
6862 | isClosable: false,
|
6863 |
|
6864 | onClick: (_e) => undefined,
|
6865 | onOverflowChipClick: (_e) => undefined,
|
6866 | closeBtnAriaLabel: 'Close chip group',
|
6867 | tooltipPosition: 'top',
|
6868 | 'aria-label': 'Chip group category'
|
6869 | };
|
6870 |
|
6871 |
|
6872 | let currentId$1 = 0;
|
6873 | class Select extends React__namespace.Component {
|
6874 | constructor() {
|
6875 | super(...arguments);
|
6876 | this.parentRef = React__namespace.createRef();
|
6877 | this.menuComponentRef = React__namespace.createRef();
|
6878 | this.filterRef = React__namespace.createRef();
|
6879 | this.clearRef = React__namespace.createRef();
|
6880 | this.inputRef = React__namespace.createRef();
|
6881 | this.refCollection = [[]];
|
6882 | this.optionContainerRefCollection = [];
|
6883 | this.footerRef = React__namespace.createRef();
|
6884 | this.state = {
|
6885 | focusFirstOption: false,
|
6886 | typeaheadInputValue: null,
|
6887 | typeaheadFilteredChildren: React__namespace.Children.toArray(this.props.children),
|
6888 | favoritesGroup: [],
|
6889 | typeaheadCurrIndex: -1,
|
6890 | typeaheadStoredIndex: -1,
|
6891 | creatableValue: '',
|
6892 | tabbedIntoFavoritesMenu: false,
|
6893 | ouiaStateId: getDefaultOUIAId(Select.displayName, this.props.variant),
|
6894 | viewMoreNextIndex: -1
|
6895 | };
|
6896 | this.getTypeaheadActiveChild = (typeaheadCurrIndex) => this.refCollection[typeaheadCurrIndex] ? this.refCollection[typeaheadCurrIndex][0] : null;
|
6897 | this.componentDidUpdate = (prevProps, prevState) => {
|
6898 | if (this.props.hasInlineFilter) {
|
6899 | this.refCollection[0][0] = this.filterRef.current;
|
6900 | }
|
6901 |
|
6902 | if (!prevState.focusFirstOption && this.state.focusFirstOption && !this.props.customContent) {
|
6903 | const firstRef = this.refCollection.find(ref => ref !== null);
|
6904 | if (firstRef && firstRef[0]) {
|
6905 | firstRef[0].focus();
|
6906 | }
|
6907 | }
|
6908 | else if (
|
6909 |
|
6910 | this.state.viewMoreNextIndex !== -1 &&
|
6911 | this.refCollection.length > this.state.viewMoreNextIndex &&
|
6912 | this.props.loadingVariant !== 'spinner' &&
|
6913 | this.refCollection[this.state.viewMoreNextIndex][0] &&
|
6914 | this.props.variant !== 'typeahead' &&
|
6915 | this.props.variant !== 'typeaheadmulti') {
|
6916 | this.refCollection[this.state.viewMoreNextIndex][0].focus();
|
6917 | }
|
6918 | const hasUpdatedChildren = prevProps.children.length !== this.props.children.length ||
|
6919 | prevProps.children.some((prevChild, index) => {
|
6920 | const prevChildProps = prevChild.props;
|
6921 | const currChild = this.props.children[index];
|
6922 | const { props: currChildProps } = currChild;
|
6923 | if (prevChildProps && currChildProps) {
|
6924 | return (prevChildProps.value !== currChildProps.value ||
|
6925 | prevChildProps.label !== currChildProps.label ||
|
6926 | prevChildProps.isDisabled !== currChildProps.isDisabled ||
|
6927 | prevChildProps.isPlaceholder !== currChildProps.isPlaceholder);
|
6928 | }
|
6929 | else {
|
6930 | return prevChild !== currChild;
|
6931 | }
|
6932 | });
|
6933 | if (hasUpdatedChildren) {
|
6934 | this.updateTypeAheadFilteredChildren(prevState.typeaheadInputValue || '', null);
|
6935 | }
|
6936 |
|
6937 |
|
6938 |
|
6939 | if (this.props.onFavorite &&
|
6940 | (this.props.favorites.length !== prevProps.favorites.length ||
|
6941 | this.state.typeaheadFilteredChildren !== prevState.typeaheadFilteredChildren)) {
|
6942 | const tempRenderableChildren = this.props.variant === 'typeahead' || this.props.variant === 'typeaheadmulti'
|
6943 | ? this.state.typeaheadFilteredChildren
|
6944 | : this.props.children;
|
6945 | const renderableFavorites = createRenderableFavorites(tempRenderableChildren, this.props.isGrouped, this.props.favorites);
|
6946 | const favoritesGroup = renderableFavorites.length
|
6947 | ? [
|
6948 | React__namespace.createElement(SelectGroup, { key: "favorites", label: this.props.favoritesLabel }, renderableFavorites),
|
6949 | React__namespace.createElement(Divider, { key: "favorites-group-divider" })
|
6950 | ]
|
6951 | : [];
|
6952 | this.setState({ favoritesGroup });
|
6953 | }
|
6954 | };
|
6955 | this.onEnter = () => {
|
6956 | this.setState({ focusFirstOption: true });
|
6957 | };
|
6958 | this.onToggle = (isExpanded, e) => {
|
6959 | const { isInputValuePersisted, onSelect, onToggle, hasInlineFilter } = this.props;
|
6960 | if (!isExpanded && isInputValuePersisted && onSelect) {
|
6961 | onSelect(undefined, this.inputRef.current ? this.inputRef.current.value : '');
|
6962 | }
|
6963 | if (isExpanded && hasInlineFilter) {
|
6964 | this.setState({
|
6965 | focusFirstOption: true
|
6966 | });
|
6967 | }
|
6968 | onToggle(isExpanded, e);
|
6969 | };
|
6970 | this.onClose = () => {
|
6971 | const { isInputFilterPersisted } = this.props;
|
6972 | this.setState(Object.assign(Object.assign({ focusFirstOption: false, typeaheadInputValue: null }, (!isInputFilterPersisted && {
|
6973 | typeaheadFilteredChildren: React__namespace.Children.toArray(this.props.children)
|
6974 | })), { typeaheadCurrIndex: -1, tabbedIntoFavoritesMenu: false, viewMoreNextIndex: -1 }));
|
6975 | };
|
6976 | this.onChange = (e) => {
|
6977 | if (e.target.value.toString() !== '' && !this.props.isOpen) {
|
6978 | this.onToggle(true, e);
|
6979 | }
|
6980 | if (this.props.onTypeaheadInputChanged) {
|
6981 | this.props.onTypeaheadInputChanged(e.target.value.toString());
|
6982 | }
|
6983 | this.setState({
|
6984 | typeaheadCurrIndex: -1,
|
6985 | typeaheadInputValue: e.target.value,
|
6986 | creatableValue: e.target.value
|
6987 | });
|
6988 | this.updateTypeAheadFilteredChildren(e.target.value.toString(), e);
|
6989 | this.refCollection = [[]];
|
6990 | };
|
6991 | this.updateTypeAheadFilteredChildren = (typeaheadInputValue, e) => {
|
6992 | let typeaheadFilteredChildren;
|
6993 | const { onFilter, isCreatable, onCreateOption, createText, noResultsFoundText, children, isGrouped, isCreateSelectOptionObject, loadingVariant } = this.props;
|
6994 | if (onFilter) {
|
6995 | |
6996 |
|
6997 |
|
6998 | typeaheadFilteredChildren = onFilter(e, e ? e.target.value : typeaheadInputValue) || children;
|
6999 | }
|
7000 | else {
|
7001 | let input;
|
7002 | try {
|
7003 | input = new RegExp(typeaheadInputValue.toString(), 'i');
|
7004 | }
|
7005 | catch (err) {
|
7006 | input = new RegExp(typeaheadInputValue.toString().replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'i');
|
7007 | }
|
7008 | const childrenArray = React__namespace.Children.toArray(children);
|
7009 | if (isGrouped) {
|
7010 | const childFilter = (child) => child.props.value &&
|
7011 | child.props.value.toString &&
|
7012 | this.getDisplay(child.props.value.toString(), 'text').search(input) === 0;
|
7013 | typeaheadFilteredChildren =
|
7014 | typeaheadInputValue.toString() !== ''
|
7015 | ? React__namespace.Children.map(children, group => {
|
7016 | if (React__namespace.isValidElement(group) && group.type === SelectGroup) {
|
7017 | const filteredGroupChildren = React__namespace.Children.toArray(group.props.children).filter(childFilter);
|
7018 | if (filteredGroupChildren.length > 0) {
|
7019 | return React__namespace.cloneElement(group, {
|
7020 | titleId: group.props.label && group.props.label.replace(/\W/g, '-'),
|
7021 | children: filteredGroupChildren
|
7022 | });
|
7023 | }
|
7024 | }
|
7025 | else {
|
7026 | return React__namespace.Children.toArray(group).filter(childFilter);
|
7027 | }
|
7028 | })
|
7029 | : childrenArray;
|
7030 | }
|
7031 | else {
|
7032 | typeaheadFilteredChildren =
|
7033 | typeaheadInputValue.toString() !== ''
|
7034 | ? childrenArray.filter(child => {
|
7035 | const valueToCheck = child.props.value;
|
7036 |
|
7037 | if (!valueToCheck) {
|
7038 | return true;
|
7039 | }
|
7040 | const isSelectOptionObject = typeof valueToCheck !== 'string' &&
|
7041 | valueToCheck.toString &&
|
7042 | valueToCheck.compareTo;
|
7043 |
|
7044 | if (loadingVariant !== 'spinner' && (loadingVariant === null || loadingVariant === void 0 ? void 0 : loadingVariant.text) === valueToCheck) {
|
7045 | return true;
|
7046 | }
|
7047 |
|
7048 | if (loadingVariant === 'spinner' && valueToCheck === 'loading') {
|
7049 | return true;
|
7050 | }
|
7051 | if (isSelectOptionObject) {
|
7052 | return valueToCheck.compareTo(typeaheadInputValue);
|
7053 | }
|
7054 | else {
|
7055 | return this.getDisplay(child.props.value.toString(), 'text').search(input) === 0;
|
7056 | }
|
7057 | })
|
7058 | : childrenArray;
|
7059 | }
|
7060 | }
|
7061 | if (!typeaheadFilteredChildren) {
|
7062 | typeaheadFilteredChildren = [];
|
7063 | }
|
7064 | if (typeaheadFilteredChildren.length === 0) {
|
7065 | !isCreatable &&
|
7066 | typeaheadFilteredChildren.push(React__namespace.createElement(SelectOption, { isDisabled: true, key: "no-results", value: noResultsFoundText, isNoResultsOption: true }));
|
7067 | }
|
7068 | if (isCreatable && typeaheadInputValue !== '') {
|
7069 | const newValue = typeaheadInputValue;
|
7070 | if (!typeaheadFilteredChildren.find((i) => i.props.value && i.props.value.toString().toLowerCase() === newValue.toString().toLowerCase())) {
|
7071 | const newOptionValue = isCreateSelectOptionObject
|
7072 | ? {
|
7073 | toString: () => newValue,
|
7074 | compareTo: value => this.toString()
|
7075 | .toLowerCase()
|
7076 | .includes(value.toString().toLowerCase())
|
7077 | }
|
7078 | : newValue;
|
7079 | typeaheadFilteredChildren.push(React__namespace.createElement(SelectOption, { key: `create ${newValue}`, value: newOptionValue, onClick: () => onCreateOption && onCreateOption(newValue) },
|
7080 | createText,
|
7081 | " \"",
|
7082 | newValue,
|
7083 | "\""));
|
7084 | }
|
7085 | }
|
7086 | this.setState({
|
7087 | typeaheadFilteredChildren
|
7088 | });
|
7089 | };
|
7090 | this.onClick = (e) => {
|
7091 | if (!this.props.isOpen) {
|
7092 | this.onToggle(true, e);
|
7093 | }
|
7094 | };
|
7095 | this.clearSelection = (_e) => {
|
7096 | this.setState({
|
7097 | typeaheadInputValue: null,
|
7098 | typeaheadFilteredChildren: React__namespace.Children.toArray(this.props.children),
|
7099 | typeaheadCurrIndex: -1
|
7100 | });
|
7101 | };
|
7102 | this.sendRef = (optionRef, favoriteRef, optionContainerRef, index) => {
|
7103 | this.refCollection[index] = [optionRef, favoriteRef];
|
7104 | this.optionContainerRefCollection[index] = optionContainerRef;
|
7105 | };
|
7106 | this.handleMenuKeys = (index, innerIndex, position) => {
|
7107 | keyHandler(index, innerIndex, position, this.refCollection, this.refCollection);
|
7108 | if (this.props.variant === exports.SelectVariant.typeahead || this.props.variant === exports.SelectVariant.typeaheadMulti) {
|
7109 | if (position !== 'tab') {
|
7110 | this.handleTypeaheadKeys(position);
|
7111 | }
|
7112 | }
|
7113 | };
|
7114 | this.moveFocus = (nextIndex, updateCurrentIndex = true) => {
|
7115 | const { isCreatable, createText } = this.props;
|
7116 | const hasDescriptionElm = Boolean(this.refCollection[nextIndex][0] && this.refCollection[nextIndex][0].classList.contains('pf-m-description'));
|
7117 | const isLoad = Boolean(this.refCollection[nextIndex][0] && this.refCollection[nextIndex][0].classList.contains('pf-m-load'));
|
7118 | const optionTextElm = hasDescriptionElm
|
7119 | ? this.refCollection[nextIndex][0].firstElementChild
|
7120 | : this.refCollection[nextIndex][0];
|
7121 | let typeaheadInputValue = '';
|
7122 | if (isCreatable && optionTextElm.innerText.includes(createText)) {
|
7123 | typeaheadInputValue = this.state.creatableValue;
|
7124 | }
|
7125 | else if (optionTextElm && !isLoad) {
|
7126 |
|
7127 | typeaheadInputValue = optionTextElm.innerText;
|
7128 | }
|
7129 | this.setState(prevState => ({
|
7130 | typeaheadCurrIndex: updateCurrentIndex ? nextIndex : prevState.typeaheadCurrIndex,
|
7131 | typeaheadStoredIndex: nextIndex,
|
7132 | typeaheadInputValue
|
7133 | }));
|
7134 | };
|
7135 | this.switchFocusToFavoriteMenu = () => {
|
7136 | const { typeaheadCurrIndex, typeaheadStoredIndex } = this.state;
|
7137 | let indexForFocus = 0;
|
7138 | if (typeaheadCurrIndex !== -1) {
|
7139 | indexForFocus = typeaheadCurrIndex;
|
7140 | }
|
7141 | else if (typeaheadStoredIndex !== -1) {
|
7142 | indexForFocus = typeaheadStoredIndex;
|
7143 | }
|
7144 | if (this.refCollection[indexForFocus] !== null && this.refCollection[indexForFocus][0] !== null) {
|
7145 | this.refCollection[indexForFocus][0].focus();
|
7146 | }
|
7147 | else {
|
7148 | this.clearRef.current.focus();
|
7149 | }
|
7150 | this.setState({
|
7151 | tabbedIntoFavoritesMenu: true,
|
7152 | typeaheadCurrIndex: -1
|
7153 | });
|
7154 | };
|
7155 | this.moveFocusToLastMenuItem = () => {
|
7156 | const refCollectionLen = this.refCollection.length;
|
7157 | if (refCollectionLen > 0 &&
|
7158 | this.refCollection[refCollectionLen - 1] !== null &&
|
7159 | this.refCollection[refCollectionLen - 1][0] !== null) {
|
7160 | this.refCollection[refCollectionLen - 1][0].focus();
|
7161 | }
|
7162 | };
|
7163 | this.handleTypeaheadKeys = (position, shiftKey = false) => {
|
7164 | const { isOpen, onFavorite } = this.props;
|
7165 | const { typeaheadCurrIndex, tabbedIntoFavoritesMenu } = this.state;
|
7166 | const typeaheadActiveChild = this.getTypeaheadActiveChild(typeaheadCurrIndex);
|
7167 | if (isOpen) {
|
7168 | if (position === 'enter') {
|
7169 | if (typeaheadCurrIndex !== -1 &&
|
7170 | (typeaheadActiveChild || (this.refCollection[0] && this.refCollection[0][0]))) {
|
7171 | if (typeaheadActiveChild) {
|
7172 | if (!typeaheadActiveChild.classList.contains('pf-m-load')) {
|
7173 | const hasDescriptionElm = typeaheadActiveChild.childElementCount > 1;
|
7174 | const typeaheadActiveChildText = hasDescriptionElm
|
7175 | ? typeaheadActiveChild.firstChild.innerText
|
7176 | : typeaheadActiveChild.innerText;
|
7177 | this.setState({
|
7178 | typeaheadInputValue: typeaheadActiveChildText
|
7179 | });
|
7180 | }
|
7181 | }
|
7182 | else if (this.refCollection[0] && this.refCollection[0][0]) {
|
7183 | this.setState({
|
7184 | typeaheadInputValue: this.refCollection[0][0].innerText
|
7185 | });
|
7186 | }
|
7187 | if (typeaheadActiveChild) {
|
7188 | typeaheadActiveChild.click();
|
7189 | }
|
7190 | else {
|
7191 | this.refCollection[0][0].click();
|
7192 | }
|
7193 | }
|
7194 | }
|
7195 | else if (position === 'tab') {
|
7196 | if (onFavorite) {
|
7197 |
|
7198 | if (this.inputRef.current === document.activeElement) {
|
7199 |
|
7200 | if (this.props.footer && shiftKey) {
|
7201 | const tabbableItems = findTabbableElements(this.footerRef, SelectFooterTabbableItems);
|
7202 | if (tabbableItems.length > 0) {
|
7203 | if (tabbableItems[tabbableItems.length - 1]) {
|
7204 | tabbableItems[tabbableItems.length - 1].focus();
|
7205 | }
|
7206 | }
|
7207 | }
|
7208 | else {
|
7209 | this.switchFocusToFavoriteMenu();
|
7210 | }
|
7211 | }
|
7212 | else {
|
7213 |
|
7214 | if (this.props.footer) {
|
7215 | let tabbedIntoMenu = false;
|
7216 | const tabbableItems = findTabbableElements(this.footerRef, SelectFooterTabbableItems);
|
7217 | if (tabbableItems.length > 0) {
|
7218 |
|
7219 |
|
7220 | const currentElementIndex = tabbableItems.findIndex((item) => item === document.activeElement);
|
7221 | if (currentElementIndex === -1) {
|
7222 | if (shiftKey) {
|
7223 |
|
7224 | this.inputRef.current.focus();
|
7225 | }
|
7226 | else {
|
7227 |
|
7228 | tabbableItems[0].focus();
|
7229 | }
|
7230 | }
|
7231 | else {
|
7232 |
|
7233 | if (shiftKey) {
|
7234 |
|
7235 | if (currentElementIndex === 0) {
|
7236 |
|
7237 | this.switchFocusToFavoriteMenu();
|
7238 | tabbedIntoMenu = true;
|
7239 | }
|
7240 | else {
|
7241 |
|
7242 | tabbableItems[currentElementIndex - 1].focus();
|
7243 | }
|
7244 | }
|
7245 | else {
|
7246 |
|
7247 | if (tabbableItems[currentElementIndex + 1]) {
|
7248 | tabbableItems[currentElementIndex + 1].focus();
|
7249 | }
|
7250 | else {
|
7251 | this.inputRef.current.focus();
|
7252 | }
|
7253 | }
|
7254 | }
|
7255 | }
|
7256 | else {
|
7257 |
|
7258 | this.inputRef.current.focus();
|
7259 | tabbedIntoMenu = false;
|
7260 | }
|
7261 | this.setState({ tabbedIntoFavoritesMenu: tabbedIntoMenu });
|
7262 | }
|
7263 | else {
|
7264 | this.inputRef.current.focus();
|
7265 | this.setState({ tabbedIntoFavoritesMenu: false });
|
7266 | }
|
7267 | }
|
7268 | }
|
7269 | else {
|
7270 |
|
7271 | if (!this.props.footer) {
|
7272 | this.onToggle(false, null);
|
7273 | this.onClose();
|
7274 | }
|
7275 | else {
|
7276 |
|
7277 | const tabbableItems = findTabbableElements(this.footerRef, SelectFooterTabbableItems);
|
7278 | const currentElementIndex = tabbableItems.findIndex((item) => item === document.activeElement);
|
7279 | if (this.inputRef.current === document.activeElement) {
|
7280 | if (shiftKey) {
|
7281 |
|
7282 | this.onToggle(false, null);
|
7283 | this.onClose();
|
7284 | }
|
7285 | else {
|
7286 |
|
7287 | if (tabbableItems[0]) {
|
7288 | tabbableItems[0].focus();
|
7289 | }
|
7290 | else {
|
7291 | this.onToggle(false, null);
|
7292 | this.onClose();
|
7293 | }
|
7294 | }
|
7295 | }
|
7296 | else {
|
7297 |
|
7298 | if (shiftKey) {
|
7299 | if (currentElementIndex === 0) {
|
7300 |
|
7301 | this.inputRef.current.focus();
|
7302 | }
|
7303 | else {
|
7304 |
|
7305 | tabbableItems[currentElementIndex - 1].focus();
|
7306 | }
|
7307 | }
|
7308 | else {
|
7309 |
|
7310 | if (tabbableItems[currentElementIndex + 1]) {
|
7311 | tabbableItems[currentElementIndex + 1].focus();
|
7312 | }
|
7313 | else {
|
7314 |
|
7315 | this.onToggle(false, null);
|
7316 | this.inputRef.current.focus();
|
7317 | this.onClose();
|
7318 | }
|
7319 | }
|
7320 | }
|
7321 | }
|
7322 | }
|
7323 | }
|
7324 | else if (!tabbedIntoFavoritesMenu) {
|
7325 | if (this.refCollection[0][0] === null) {
|
7326 | return;
|
7327 | }
|
7328 | let nextIndex;
|
7329 | if (typeaheadCurrIndex === -1 && position === 'down') {
|
7330 | nextIndex = 0;
|
7331 | }
|
7332 | else if (typeaheadCurrIndex === -1 && position === 'up') {
|
7333 | nextIndex = this.refCollection.length - 1;
|
7334 | }
|
7335 | else if (position !== 'left' && position !== 'right') {
|
7336 | nextIndex = getNextIndex(typeaheadCurrIndex, position, this.refCollection);
|
7337 | }
|
7338 | else {
|
7339 | nextIndex = typeaheadCurrIndex;
|
7340 | }
|
7341 | if (this.refCollection[nextIndex] === null) {
|
7342 | return;
|
7343 | }
|
7344 | this.moveFocus(nextIndex);
|
7345 | }
|
7346 | else {
|
7347 | const nextIndex = this.refCollection.findIndex(ref => ref !== undefined && (ref[0] === document.activeElement || ref[1] === document.activeElement));
|
7348 | this.moveFocus(nextIndex);
|
7349 | }
|
7350 | }
|
7351 | };
|
7352 | this.onClickTypeaheadToggleButton = () => {
|
7353 | if (this.inputRef && this.inputRef.current) {
|
7354 | this.inputRef.current.focus();
|
7355 | }
|
7356 | };
|
7357 | this.getDisplay = (value, type = 'node') => {
|
7358 | if (!value) {
|
7359 | return;
|
7360 | }
|
7361 | const item = this.props.isGrouped
|
7362 | ? React__namespace.Children.toArray(this.props.children)
|
7363 | .reduce((acc, curr) => [...acc, ...React__namespace.Children.toArray(curr.props.children)], [])
|
7364 | .find(child => child.props.value.toString() === value.toString())
|
7365 | : React__namespace.Children.toArray(this.props.children).find(child => child.props.value &&
|
7366 | child.props.value.toString() === value.toString());
|
7367 | if (item) {
|
7368 | if (item && item.props.children) {
|
7369 | if (type === 'node') {
|
7370 | return item.props.children;
|
7371 | }
|
7372 | return this.findText(item);
|
7373 | }
|
7374 | return item.props.value.toString();
|
7375 | }
|
7376 | return value.toString();
|
7377 | };
|
7378 | this.findText = (item) => {
|
7379 | if (typeof item === 'string') {
|
7380 | return item;
|
7381 | }
|
7382 | else if (!React__namespace.isValidElement(item)) {
|
7383 | return '';
|
7384 | }
|
7385 | else {
|
7386 | const multi = [];
|
7387 | React__namespace.Children.toArray(item.props.children).forEach(child => multi.push(this.findText(child)));
|
7388 | return multi.join('');
|
7389 | }
|
7390 | };
|
7391 | this.generateSelectedBadge = () => {
|
7392 | const { customBadgeText, selections } = this.props;
|
7393 | if (customBadgeText !== null) {
|
7394 | return customBadgeText;
|
7395 | }
|
7396 | if (Array.isArray(selections) && selections.length > 0) {
|
7397 | return selections.length;
|
7398 | }
|
7399 | return null;
|
7400 | };
|
7401 | this.setVieMoreNextIndex = () => {
|
7402 | this.setState({ viewMoreNextIndex: this.refCollection.length - 1 });
|
7403 | };
|
7404 | this.isLastOptionBeforeFooter = (index) => this.props.footer && index === this.refCollection.length - 1 ? true : false;
|
7405 | }
|
7406 | extendTypeaheadChildren(typeaheadCurrIndex, favoritesGroup) {
|
7407 | const { isGrouped, onFavorite } = this.props;
|
7408 | const typeaheadChildren = favoritesGroup
|
7409 | ? favoritesGroup.concat(this.state.typeaheadFilteredChildren)
|
7410 | : this.state.typeaheadFilteredChildren;
|
7411 | const activeElement = this.optionContainerRefCollection[typeaheadCurrIndex];
|
7412 | let typeaheadActiveChild = this.getTypeaheadActiveChild(typeaheadCurrIndex);
|
7413 | if (typeaheadActiveChild && typeaheadActiveChild.classList.contains('pf-m-description')) {
|
7414 | typeaheadActiveChild = typeaheadActiveChild.firstElementChild;
|
7415 | }
|
7416 | this.refCollection = [[]];
|
7417 | this.optionContainerRefCollection = [];
|
7418 | if (isGrouped) {
|
7419 | return React__namespace.Children.map(typeaheadChildren, (group) => {
|
7420 | if (group.type === Divider) {
|
7421 | return group;
|
7422 | }
|
7423 | else if (group.type === SelectGroup && onFavorite) {
|
7424 | return React__namespace.cloneElement(group, {
|
7425 | titleId: group.props.label && group.props.label.replace(/\W/g, '-'),
|
7426 | children: React__namespace.Children.map(group.props.children, (child) => child.type === Divider
|
7427 | ? child
|
7428 | : React__namespace.cloneElement(child, {
|
7429 | isFocused: activeElement &&
|
7430 | (activeElement.id === child.props.id ||
|
7431 | (this.props.isCreatable &&
|
7432 | typeaheadActiveChild.innerText ===
|
7433 | `{createText} "${group.props.value}"`))
|
7434 | }))
|
7435 | });
|
7436 | }
|
7437 | else if (group.type === SelectGroup) {
|
7438 | return React__namespace.cloneElement(group, {
|
7439 | titleId: group.props.label && group.props.label.replace(/\W/g, '-'),
|
7440 | children: React__namespace.Children.map(group.props.children, (child) => child.type === Divider
|
7441 | ? child
|
7442 | : React__namespace.cloneElement(child, {
|
7443 | isFocused: typeaheadActiveChild &&
|
7444 | (typeaheadActiveChild.innerText === child.props.value.toString() ||
|
7445 | (this.props.isCreatable &&
|
7446 | typeaheadActiveChild.innerText ===
|
7447 | `{createText} "${child.props.value}"`))
|
7448 | }))
|
7449 | });
|
7450 | }
|
7451 | else {
|
7452 |
|
7453 | return React__namespace.cloneElement(group, {
|
7454 | isFocused: typeaheadActiveChild &&
|
7455 | (typeaheadActiveChild.innerText === group.props.value.toString() ||
|
7456 | (this.props.isCreatable && typeaheadActiveChild.innerText === `{createText} "${group.props.value}"`))
|
7457 | });
|
7458 | }
|
7459 | });
|
7460 | }
|
7461 | return typeaheadChildren.map((child, index) => {
|
7462 | const childElement = child;
|
7463 | return childElement.type.displayName === 'Divider'
|
7464 | ? child
|
7465 | : React__namespace.cloneElement(child, {
|
7466 | isFocused: typeaheadActiveChild
|
7467 | ? typeaheadActiveChild.innerText === child.props.value.toString() ||
|
7468 | (this.props.isCreatable &&
|
7469 | typeaheadActiveChild.innerText === `{createText} "${child.props.value}"`)
|
7470 | : index === typeaheadCurrIndex
|
7471 | });
|
7472 | });
|
7473 | }
|
7474 | render() {
|
7475 | const _a = this.props, { children, chipGroupProps, chipGroupComponent, className, customContent, variant, direction, onSelect, onClear, onBlur, toggleId, isOpen, isGrouped, isPlain, isDisabled, hasPlaceholderStyle, validated, selections: selectionsProp, typeAheadAriaLabel, clearSelectionsAriaLabel, toggleAriaLabel, removeSelectionAriaLabel, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedby, 'aria-invalid': ariaInvalid, placeholderText, width, maxHeight, toggleIcon, ouiaId, ouiaSafe, hasInlineFilter, isCheckboxSelectionBadgeHidden, inlineFilterPlaceholderText,
|
7476 |
|
7477 | onFilter,
|
7478 |
|
7479 | onTypeaheadInputChanged, onCreateOption, isCreatable, onToggle, createText, noResultsFoundText, customBadgeText, inputIdPrefix, inputAutoComplete,
|
7480 |
|
7481 | isInputValuePersisted, isInputFilterPersisted,
|
7482 |
|
7483 | menuAppendTo, favorites, onFavorite,
|
7484 |
|
7485 | favoritesLabel, footer, loadingVariant, isCreateSelectOptionObject, shouldResetOnSelect } = _a, props = __rest$1(_a, ["children", "chipGroupProps", "chipGroupComponent", "className", "customContent", "variant", "direction", "onSelect", "onClear", "onBlur", "toggleId", "isOpen", "isGrouped", "isPlain", "isDisabled", "hasPlaceholderStyle", "validated", "selections", "typeAheadAriaLabel", "clearSelectionsAriaLabel", "toggleAriaLabel", "removeSelectionAriaLabel", 'aria-label', 'aria-labelledby', 'aria-describedby', 'aria-invalid', "placeholderText", "width", "maxHeight", "toggleIcon", "ouiaId", "ouiaSafe", "hasInlineFilter", "isCheckboxSelectionBadgeHidden", "inlineFilterPlaceholderText", "onFilter", "onTypeaheadInputChanged", "onCreateOption", "isCreatable", "onToggle", "createText", "noResultsFoundText", "customBadgeText", "inputIdPrefix", "inputAutoComplete", "isInputValuePersisted", "isInputFilterPersisted", "menuAppendTo", "favorites", "onFavorite", "favoritesLabel", "footer", "loadingVariant", "isCreateSelectOptionObject", "shouldResetOnSelect"]);
|
7486 | const { focusFirstOption: openedOnEnter, typeaheadCurrIndex, typeaheadInputValue, typeaheadFilteredChildren, favoritesGroup } = this.state;
|
7487 | const selectToggleId = toggleId || `pf-select-toggle-id-${currentId$1++}`;
|
7488 | const selections = Array.isArray(selectionsProp) ? selectionsProp : [selectionsProp];
|
7489 |
|
7490 | const selectedOption = React__namespace.Children.toArray(children).find((option) => option.props.value === selections[0]);
|
7491 | const isSelectedPlaceholder = selectedOption && selectedOption.props.isPlaceholder;
|
7492 | const hasAnySelections = Boolean(selections[0] && selections[0] !== '');
|
7493 | const typeaheadActiveChild = this.getTypeaheadActiveChild(typeaheadCurrIndex);
|
7494 | let childPlaceholderText = null;
|
7495 |
|
7496 | let renderableItems = [];
|
7497 | if (onFavorite) {
|
7498 |
|
7499 | let tempExtendedChildren = children;
|
7500 | if (variant === 'typeahead' || variant === 'typeaheadmulti') {
|
7501 | tempExtendedChildren = this.extendTypeaheadChildren(typeaheadCurrIndex, favoritesGroup);
|
7502 | }
|
7503 | else if (onFavorite) {
|
7504 | tempExtendedChildren = favoritesGroup.concat(children);
|
7505 | }
|
7506 |
|
7507 | renderableItems = extendItemsWithFavorite(tempExtendedChildren, isGrouped, favorites);
|
7508 | }
|
7509 | else {
|
7510 | renderableItems = children;
|
7511 | }
|
7512 | if (!customContent) {
|
7513 | if (!hasAnySelections && !placeholderText) {
|
7514 | const childPlaceholder = React__namespace.Children.toArray(children).filter((child) => child.props.isPlaceholder === true);
|
7515 | childPlaceholderText =
|
7516 | (childPlaceholder[0] && this.getDisplay(childPlaceholder[0].props.value, 'node')) ||
|
7517 | (children[0] && this.getDisplay(children[0].props.value, 'node'));
|
7518 | }
|
7519 | }
|
7520 | if (isOpen) {
|
7521 | if (renderableItems.find(item => { var _a; return ((_a = item) === null || _a === void 0 ? void 0 : _a.key) === 'loading'; }) === undefined) {
|
7522 | if (loadingVariant === 'spinner') {
|
7523 | renderableItems.push(React__namespace.createElement(SelectOption, { isLoading: true, key: "loading", value: "loading" },
|
7524 | React__namespace.createElement(Spinner, { size: "lg" })));
|
7525 | }
|
7526 | else if (loadingVariant === null || loadingVariant === void 0 ? void 0 : loadingVariant.text) {
|
7527 | renderableItems.push(React__namespace.createElement(SelectOption, { isLoad: true, key: "loading", value: loadingVariant.text, setViewMoreNextIndex: this.setVieMoreNextIndex, onClick: loadingVariant === null || loadingVariant === void 0 ? void 0 : loadingVariant.onClick }));
|
7528 | }
|
7529 | }
|
7530 | }
|
7531 | const hasOnClear = onClear !== Select.defaultProps.onClear;
|
7532 | const clearBtn = (React__namespace.createElement("button", { className: css(buttonStyles.button, buttonStyles.modifiers.plain, styles$_.selectToggleClear), onClick: e => {
|
7533 | this.clearSelection(e);
|
7534 | onClear(e);
|
7535 | e.stopPropagation();
|
7536 | }, "aria-label": clearSelectionsAriaLabel, type: "button", disabled: isDisabled, ref: this.clearRef, onKeyDown: event => {
|
7537 | if (event.key === KeyTypes.Enter) {
|
7538 | this.clearRef.current.click();
|
7539 | }
|
7540 | } },
|
7541 | React__namespace.createElement(TimesCircleIcon$1, { "aria-hidden": true })));
|
7542 | let selectedChips = null;
|
7543 | if (variant === exports.SelectVariant.typeaheadMulti) {
|
7544 | selectedChips = chipGroupComponent ? (chipGroupComponent) : (React__namespace.createElement(ChipGroup, Object.assign({}, chipGroupProps), selections &&
|
7545 | selections.map(item => (React__namespace.createElement(Chip, { key: item, onClick: (e) => onSelect(e, item), closeBtnAriaLabel: removeSelectionAriaLabel }, this.getDisplay(item, 'node'))))));
|
7546 | }
|
7547 | if (hasInlineFilter) {
|
7548 | const filterBox = (React__namespace.createElement(React__namespace.Fragment, null,
|
7549 | React__namespace.createElement("div", { key: "inline-filter", className: css(styles$_.selectMenuSearch) },
|
7550 | React__namespace.createElement("input", { key: "inline-filter-input", type: "search", className: css(formStyles.formControl, formStyles.modifiers.search), onChange: this.onChange, placeholder: inlineFilterPlaceholderText, onKeyDown: event => {
|
7551 | if (event.key === KeyTypes.ArrowUp) {
|
7552 | this.handleMenuKeys(0, 0, 'up');
|
7553 | event.preventDefault();
|
7554 | }
|
7555 | else if (event.key === KeyTypes.ArrowDown) {
|
7556 | this.handleMenuKeys(0, 0, 'down');
|
7557 | event.preventDefault();
|
7558 | }
|
7559 | else if (event.key === KeyTypes.ArrowLeft) {
|
7560 | this.handleMenuKeys(0, 0, 'left');
|
7561 | event.preventDefault();
|
7562 | }
|
7563 | else if (event.key === KeyTypes.ArrowRight) {
|
7564 | this.handleMenuKeys(0, 0, 'right');
|
7565 | event.preventDefault();
|
7566 | }
|
7567 | else if (event.key === KeyTypes.Tab && variant !== exports.SelectVariant.checkbox && this.props.footer) {
|
7568 |
|
7569 | if (event.shiftKey) {
|
7570 | this.onToggle(false, event);
|
7571 | }
|
7572 | else {
|
7573 | const tabbableItems = findTabbableElements(this.footerRef, SelectFooterTabbableItems);
|
7574 | if (tabbableItems.length > 0) {
|
7575 | tabbableItems[0].focus();
|
7576 | event.stopPropagation();
|
7577 | event.preventDefault();
|
7578 | }
|
7579 | else {
|
7580 | this.onToggle(false, event);
|
7581 | }
|
7582 | }
|
7583 | }
|
7584 | else if (event.key === KeyTypes.Tab && variant === exports.SelectVariant.checkbox) {
|
7585 |
|
7586 |
|
7587 | if (event.shiftKey) {
|
7588 | this.handleMenuKeys(0, 0, 'up');
|
7589 | }
|
7590 | else {
|
7591 | this.handleMenuKeys(0, 0, 'down');
|
7592 | }
|
7593 | event.stopPropagation();
|
7594 | event.preventDefault();
|
7595 | }
|
7596 | }, ref: this.filterRef, autoComplete: inputAutoComplete })),
|
7597 | React__namespace.createElement(Divider, { key: "inline-filter-divider" })));
|
7598 | renderableItems = [filterBox, ...typeaheadFilteredChildren].map((option, index) => React__namespace.cloneElement(option, { key: index }));
|
7599 | }
|
7600 | let variantProps;
|
7601 | let variantChildren;
|
7602 | if (customContent) {
|
7603 | variantProps = {
|
7604 | selected: selections,
|
7605 | openedOnEnter,
|
7606 | isCustomContent: true
|
7607 | };
|
7608 | variantChildren = customContent;
|
7609 | }
|
7610 | else {
|
7611 | switch (variant) {
|
7612 | case 'single':
|
7613 | variantProps = {
|
7614 | selected: selections[0],
|
7615 | hasInlineFilter,
|
7616 | openedOnEnter
|
7617 | };
|
7618 | variantChildren = renderableItems;
|
7619 | break;
|
7620 | case 'checkbox':
|
7621 | variantProps = {
|
7622 | checked: selections,
|
7623 | isGrouped,
|
7624 | hasInlineFilter,
|
7625 | openedOnEnter
|
7626 | };
|
7627 | variantChildren = renderableItems;
|
7628 | break;
|
7629 | case 'typeahead':
|
7630 | variantProps = {
|
7631 | selected: selections[0],
|
7632 | openedOnEnter
|
7633 | };
|
7634 | variantChildren = onFavorite ? renderableItems : this.extendTypeaheadChildren(typeaheadCurrIndex);
|
7635 | if (variantChildren.length === 0) {
|
7636 | variantChildren.push(React__namespace.createElement(SelectOption, { isDisabled: true, key: 0, value: noResultsFoundText, isNoResultsOption: true }));
|
7637 | }
|
7638 | break;
|
7639 | case 'typeaheadmulti':
|
7640 | variantProps = {
|
7641 | selected: selections,
|
7642 | openedOnEnter
|
7643 | };
|
7644 | variantChildren = onFavorite ? renderableItems : this.extendTypeaheadChildren(typeaheadCurrIndex);
|
7645 | if (variantChildren.length === 0) {
|
7646 | variantChildren.push(React__namespace.createElement(SelectOption, { isDisabled: true, key: 0, value: noResultsFoundText, isNoResultsOption: true }));
|
7647 | }
|
7648 | break;
|
7649 | }
|
7650 | }
|
7651 | const innerMenu = (React__namespace.createElement(SelectMenu, Object.assign({}, props, { isGrouped: isGrouped, selected: selections }, variantProps, { openedOnEnter: openedOnEnter, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, sendRef: this.sendRef, keyHandler: this.handleMenuKeys, maxHeight: maxHeight, ref: this.menuComponentRef, footer: footer, footerRef: this.footerRef, isLastOptionBeforeFooter: this.isLastOptionBeforeFooter }), variantChildren));
|
7652 | const menuContainer = footer ? React__namespace.createElement("div", { className: css(styles$_.selectMenu) },
|
7653 | " ",
|
7654 | innerMenu,
|
7655 | " ") : innerMenu;
|
7656 | const popperContainer = (React__namespace.createElement("div", Object.assign({ className: css(styles$_.select, isOpen && styles$_.modifiers.expanded, validated === exports.ValidatedOptions.success && styles$_.modifiers.success, validated === exports.ValidatedOptions.warning && styles$_.modifiers.warning, validated === exports.ValidatedOptions.error && styles$_.modifiers.invalid, direction === exports.SelectDirection.up && styles$_.modifiers.top, className) }, (width && { style: { width } }), (validated !== exports.ValidatedOptions.default && { 'aria-describedby': ariaDescribedby }), (validated !== exports.ValidatedOptions.default && { 'aria-invalid': ariaInvalid })), isOpen && menuContainer));
|
7657 | const mainContainer = (React__namespace.createElement("div", Object.assign({ className: css(styles$_.select, isOpen && styles$_.modifiers.expanded, validated === exports.ValidatedOptions.success && styles$_.modifiers.success, validated === exports.ValidatedOptions.warning && styles$_.modifiers.warning, validated === exports.ValidatedOptions.error && styles$_.modifiers.invalid, direction === exports.SelectDirection.up && styles$_.modifiers.top, className), ref: this.parentRef }, getOUIAProps(Select.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId, ouiaSafe), (width && { style: { width } }), (validated !== exports.ValidatedOptions.default && { 'aria-describedby': ariaDescribedby }), (validated !== exports.ValidatedOptions.default && { 'aria-invalid': ariaInvalid })),
|
7658 | React__namespace.createElement(SelectToggle, Object.assign({ id: selectToggleId, parentRef: this.parentRef, menuRef: this.menuComponentRef }, (footer && { footerRef: this.footerRef }), { isOpen: isOpen, isPlain: isPlain, hasPlaceholderStyle: hasPlaceholderStyle && (!selections.length || selections[0] === null || isSelectedPlaceholder), onToggle: this.onToggle, onEnter: this.onEnter, onClose: this.onClose, onBlur: onBlur, variant: variant, "aria-labelledby": `${ariaLabelledBy || ''} ${selectToggleId}`, "aria-label": toggleAriaLabel, handleTypeaheadKeys: this.handleTypeaheadKeys, moveFocusToLastMenuItem: this.moveFocusToLastMenuItem, isDisabled: isDisabled, hasClearButton: hasOnClear, hasFooter: footer !== undefined, onClickTypeaheadToggleButton: this.onClickTypeaheadToggleButton }),
|
7659 | customContent && (React__namespace.createElement("div", { className: css(styles$_.selectToggleWrapper) },
|
7660 | toggleIcon && React__namespace.createElement("span", { className: css(styles$_.selectToggleIcon) }, toggleIcon),
|
7661 | React__namespace.createElement("span", { className: css(styles$_.selectToggleText) }, placeholderText))),
|
7662 | variant === exports.SelectVariant.single && !customContent && (React__namespace.createElement(React__namespace.Fragment, null,
|
7663 | React__namespace.createElement("div", { className: css(styles$_.selectToggleWrapper) },
|
7664 | toggleIcon && React__namespace.createElement("span", { className: css(styles$_.selectToggleIcon) }, toggleIcon),
|
7665 | React__namespace.createElement("span", { className: css(styles$_.selectToggleText) }, this.getDisplay(selections[0], 'node') || placeholderText || childPlaceholderText)),
|
7666 | hasOnClear && hasAnySelections && clearBtn)),
|
7667 | variant === exports.SelectVariant.checkbox && !customContent && (React__namespace.createElement(React__namespace.Fragment, null,
|
7668 | React__namespace.createElement("div", { className: css(styles$_.selectToggleWrapper) },
|
7669 | toggleIcon && React__namespace.createElement("span", { className: css(styles$_.selectToggleIcon) }, toggleIcon),
|
7670 | React__namespace.createElement("span", { className: css(styles$_.selectToggleText) }, placeholderText),
|
7671 | !isCheckboxSelectionBadgeHidden && hasAnySelections && (React__namespace.createElement("div", { className: css(styles$_.selectToggleBadge) },
|
7672 | React__namespace.createElement("span", { className: css(badgeStyles.badge, badgeStyles.modifiers.read) }, this.generateSelectedBadge())))),
|
7673 | hasOnClear && hasAnySelections && clearBtn)),
|
7674 | variant === exports.SelectVariant.typeahead && !customContent && (React__namespace.createElement(React__namespace.Fragment, null,
|
7675 | React__namespace.createElement("div", { className: css(styles$_.selectToggleWrapper) },
|
7676 | toggleIcon && React__namespace.createElement("span", { className: css(styles$_.selectToggleIcon) }, toggleIcon),
|
7677 | React__namespace.createElement("input", { className: css(formStyles.formControl, styles$_.selectToggleTypeahead), "aria-activedescendant": typeaheadActiveChild && typeaheadActiveChild.id, id: `${selectToggleId}-select-typeahead`, "aria-label": typeAheadAriaLabel, placeholder: placeholderText, value: typeaheadInputValue !== null
|
7678 | ? typeaheadInputValue
|
7679 | : this.getDisplay(selections[0], 'text') || '', type: "text", onClick: this.onClick, onChange: this.onChange, autoComplete: inputAutoComplete, disabled: isDisabled, ref: this.inputRef })),
|
7680 | hasOnClear && (selections[0] || typeaheadInputValue) && clearBtn)),
|
7681 | variant === exports.SelectVariant.typeaheadMulti && !customContent && (React__namespace.createElement(React__namespace.Fragment, null,
|
7682 | React__namespace.createElement("div", { className: css(styles$_.selectToggleWrapper) },
|
7683 | toggleIcon && React__namespace.createElement("span", { className: css(styles$_.selectToggleIcon) }, toggleIcon),
|
7684 | selections && Array.isArray(selections) && selections.length > 0 && selectedChips,
|
7685 | React__namespace.createElement("input", { className: css(formStyles.formControl, styles$_.selectToggleTypeahead), "aria-activedescendant": typeaheadActiveChild && typeaheadActiveChild.id, id: `${selectToggleId}-select-multi-typeahead-typeahead`, "aria-label": typeAheadAriaLabel, "aria-invalid": validated === exports.ValidatedOptions.error, placeholder: placeholderText, value: typeaheadInputValue !== null ? typeaheadInputValue : '', type: "text", onChange: this.onChange, onClick: this.onClick, autoComplete: inputAutoComplete, disabled: isDisabled, ref: this.inputRef })),
|
7686 | hasOnClear && ((selections && selections.length > 0) || typeaheadInputValue) && clearBtn)),
|
7687 | validated === exports.ValidatedOptions.success && (React__namespace.createElement("span", { className: css(styles$_.selectToggleStatusIcon) },
|
7688 | React__namespace.createElement(CheckCircleIcon$1, { "aria-hidden": "true" }))),
|
7689 | validated === exports.ValidatedOptions.error && (React__namespace.createElement("span", { className: css(styles$_.selectToggleStatusIcon) },
|
7690 | React__namespace.createElement(ExclamationCircleIcon$1, { "aria-hidden": "true" }))),
|
7691 | validated === exports.ValidatedOptions.warning && (React__namespace.createElement("span", { className: css(styles$_.selectToggleStatusIcon) },
|
7692 | React__namespace.createElement(ExclamationTriangleIcon$1, { "aria-hidden": "true" })))),
|
7693 | isOpen && menuAppendTo === 'inline' && menuContainer));
|
7694 | const getParentElement = () => {
|
7695 | if (this.parentRef && this.parentRef.current) {
|
7696 | return this.parentRef.current.parentElement;
|
7697 | }
|
7698 | return null;
|
7699 | };
|
7700 | return (React__namespace.createElement(GenerateId, null, randomId => (React__namespace.createElement(SelectContext.Provider, { value: {
|
7701 | onSelect,
|
7702 | onFavorite,
|
7703 | onClose: this.onClose,
|
7704 | variant,
|
7705 | inputIdPrefix: inputIdPrefix || randomId,
|
7706 | shouldResetOnSelect
|
7707 | } }, menuAppendTo === 'inline' ? (mainContainer) : (React__namespace.createElement(Popper, { trigger: mainContainer, popper: popperContainer, direction: direction, appendTo: menuAppendTo === 'parent' ? getParentElement() : menuAppendTo, isVisible: isOpen }))))));
|
7708 | }
|
7709 | }
|
7710 | Select.displayName = 'Select';
|
7711 | Select.defaultProps = {
|
7712 | children: [],
|
7713 | className: '',
|
7714 | position: exports.SelectPosition.left,
|
7715 | direction: exports.SelectDirection.down,
|
7716 | toggleId: null,
|
7717 | isOpen: false,
|
7718 | isGrouped: false,
|
7719 | isPlain: false,
|
7720 | isDisabled: false,
|
7721 | hasPlaceholderStyle: false,
|
7722 | isCreatable: false,
|
7723 | validated: 'default',
|
7724 | 'aria-label': '',
|
7725 | 'aria-labelledby': '',
|
7726 | 'aria-describedby': '',
|
7727 | 'aria-invalid': false,
|
7728 | typeAheadAriaLabel: '',
|
7729 | clearSelectionsAriaLabel: 'Clear all',
|
7730 | toggleAriaLabel: 'Options menu',
|
7731 | removeSelectionAriaLabel: 'Remove',
|
7732 | selections: [],
|
7733 | createText: 'Create',
|
7734 | placeholderText: '',
|
7735 | noResultsFoundText: 'No results found',
|
7736 | variant: exports.SelectVariant.single,
|
7737 | width: '',
|
7738 | onClear: () => undefined,
|
7739 | onCreateOption: () => undefined,
|
7740 | toggleIcon: null,
|
7741 | onFilter: null,
|
7742 | onTypeaheadInputChanged: null,
|
7743 | customContent: null,
|
7744 | hasInlineFilter: false,
|
7745 | inlineFilterPlaceholderText: null,
|
7746 | customBadgeText: null,
|
7747 | inputIdPrefix: '',
|
7748 | inputAutoComplete: 'off',
|
7749 | menuAppendTo: 'inline',
|
7750 | favorites: [],
|
7751 | favoritesLabel: 'Favorites',
|
7752 | ouiaSafe: true,
|
7753 | chipGroupComponent: null,
|
7754 | isInputValuePersisted: false,
|
7755 | isInputFilterPersisted: false,
|
7756 | isCreateSelectOptionObject: false,
|
7757 | shouldResetOnSelect: true
|
7758 | };
|
7759 |
|
7760 | const ArrowLeftIconConfig = {
|
7761 | name: 'ArrowLeftIcon',
|
7762 | height: 512,
|
7763 | width: 448,
|
7764 | svgPath: 'M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z',
|
7765 | yOffset: 0,
|
7766 | xOffset: 0,
|
7767 | };
|
7768 |
|
7769 | const ArrowLeftIcon = createIcon(ArrowLeftIconConfig);
|
7770 |
|
7771 | var ArrowLeftIcon$1 = ArrowLeftIcon;
|
7772 |
|
7773 | const ArrowRightIconConfig = {
|
7774 | name: 'ArrowRightIcon',
|
7775 | height: 512,
|
7776 | width: 448,
|
7777 | svgPath: 'M190.5 66.9l22.2-22.2c9.4-9.4 24.6-9.4 33.9 0L441 239c9.4 9.4 9.4 24.6 0 33.9L246.6 467.3c-9.4 9.4-24.6 9.4-33.9 0l-22.2-22.2c-9.5-9.5-9.3-25 .4-34.3L311.4 296H24c-13.3 0-24-10.7-24-24v-32c0-13.3 10.7-24 24-24h287.4L190.9 101.2c-9.8-9.3-10-24.8-.4-34.3z',
|
7778 | yOffset: 0,
|
7779 | xOffset: 0,
|
7780 | };
|
7781 |
|
7782 | const ArrowRightIcon = createIcon(ArrowRightIconConfig);
|
7783 |
|
7784 | var ArrowRightIcon$1 = ArrowRightIcon;
|
7785 |
|
7786 | Promise.resolve().then(function () { return calendarMonth; });
|
7787 | var styles$V = {
|
7788 | "calendarMonth": "pf-c-calendar-month",
|
7789 | "calendarMonthCalendar": "pf-c-calendar-month__calendar",
|
7790 | "calendarMonthDate": "pf-c-calendar-month__date",
|
7791 | "calendarMonthDatesCell": "pf-c-calendar-month__dates-cell",
|
7792 | "calendarMonthDatesRow": "pf-c-calendar-month__dates-row",
|
7793 | "calendarMonthDay": "pf-c-calendar-month__day",
|
7794 | "calendarMonthDays": "pf-c-calendar-month__days",
|
7795 | "calendarMonthHeader": "pf-c-calendar-month__header",
|
7796 | "calendarMonthHeaderMonth": "pf-c-calendar-month__header-month",
|
7797 | "calendarMonthHeaderNavControl": "pf-c-calendar-month__header-nav-control",
|
7798 | "calendarMonthHeaderYear": "pf-c-calendar-month__header-year",
|
7799 | "modifiers": {
|
7800 | "prevMonth": "pf-m-prev-month",
|
7801 | "nextMonth": "pf-m-next-month",
|
7802 | "current": "pf-m-current",
|
7803 | "inRange": "pf-m-in-range",
|
7804 | "startRange": "pf-m-start-range",
|
7805 | "endRange": "pf-m-end-range",
|
7806 | "adjacentMonth": "pf-m-adjacent-month",
|
7807 | "selected": "pf-m-selected",
|
7808 | "disabled": "pf-m-disabled",
|
7809 | "hover": "pf-m-hover",
|
7810 | "focus": "pf-m-focus"
|
7811 | }
|
7812 | };
|
7813 |
|
7814 | exports.Weekday = void 0;
|
7815 | (function (Weekday) {
|
7816 | Weekday[Weekday["Sunday"] = 0] = "Sunday";
|
7817 | Weekday[Weekday["Monday"] = 1] = "Monday";
|
7818 | Weekday[Weekday["Tuesday"] = 2] = "Tuesday";
|
7819 | Weekday[Weekday["Wednesday"] = 3] = "Wednesday";
|
7820 | Weekday[Weekday["Thursday"] = 4] = "Thursday";
|
7821 | Weekday[Weekday["Friday"] = 5] = "Friday";
|
7822 | Weekday[Weekday["Saturday"] = 6] = "Saturday";
|
7823 | })(exports.Weekday || (exports.Weekday = {}));
|
7824 |
|
7825 | const yearFormat = (date) => date.getFullYear();
|
7826 | const buildCalendar = (year, month, weekStart, validators) => {
|
7827 | const defaultDate = new Date(year, month);
|
7828 | const firstDayOfWeek = new Date(defaultDate);
|
7829 | firstDayOfWeek.setDate(firstDayOfWeek.getDate() - firstDayOfWeek.getDay() + weekStart);
|
7830 |
|
7831 |
|
7832 | const calendarWeeks = [];
|
7833 | for (let i = 0; i < 6; i++) {
|
7834 | const week = [];
|
7835 | for (let j = 0; j < 7; j++) {
|
7836 | const date = new Date(firstDayOfWeek);
|
7837 | week.push({
|
7838 | date,
|
7839 | isValid: validators.every(validator => validator(date))
|
7840 | });
|
7841 | firstDayOfWeek.setDate(firstDayOfWeek.getDate() + 1);
|
7842 | }
|
7843 | calendarWeeks.push(week);
|
7844 | }
|
7845 | return calendarWeeks;
|
7846 | };
|
7847 | const isSameDate = (d1, d2) => d1.getFullYear() === d2.getFullYear() && d1.getMonth() === d2.getMonth() && d1.getDate() === d2.getDate();
|
7848 | const isValidDate = (date) => Boolean(date && !isNaN(date));
|
7849 | const today = new Date();
|
7850 | const CalendarMonth = (_a) => {
|
7851 | var { date: dateProp, locale = undefined, monthFormat = date => date.toLocaleDateString(locale, { month: 'long' }), weekdayFormat = date => date.toLocaleDateString(locale, { weekday: 'narrow' }), longWeekdayFormat = date => date.toLocaleDateString(locale, { weekday: 'long' }), dayFormat = date => date.getDate(), weekStart = 0,
|
7852 | onChange = () => { }, validators = [() => true], className, onSelectToggle = () => { }, rangeStart, prevMonthAriaLabel = 'Previous month', nextMonthAriaLabel = 'Next month', yearInputAriaLabel = 'Select year', cellAriaLabel } = _a, props = __rest$1(_a, ["date", "locale", "monthFormat", "weekdayFormat", "longWeekdayFormat", "dayFormat", "weekStart", "onChange", "validators", "className", "onSelectToggle", "rangeStart", "prevMonthAriaLabel", "nextMonthAriaLabel", "yearInputAriaLabel", "cellAriaLabel"]);
|
7853 | const longMonths = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].map(monthNum => new Date(1990, monthNum)).map(monthFormat);
|
7854 | const [isSelectOpen, setIsSelectOpen] = React__default["default"].useState(false);
|
7855 |
|
7856 | let [focusedDate, setFocusedDate] = React__default["default"].useState(new Date(dateProp));
|
7857 | if (!isValidDate(focusedDate)) {
|
7858 | if (isValidDate(rangeStart)) {
|
7859 | focusedDate = rangeStart;
|
7860 | }
|
7861 | else {
|
7862 | focusedDate = today;
|
7863 | }
|
7864 | }
|
7865 | const [hoveredDate, setHoveredDate] = React__default["default"].useState(new Date(focusedDate));
|
7866 | const focusRef = React__default["default"].useRef();
|
7867 | const [hiddenMonthId] = React__default["default"].useState(getUniqueId('hidden-month-span'));
|
7868 | const [shouldFocus, setShouldFocus] = React__default["default"].useState(false);
|
7869 | const isValidated = (date) => validators.every(validator => validator(date));
|
7870 | const focusedDateValidated = isValidated(focusedDate);
|
7871 | React.useEffect(() => {
|
7872 | if (!(isValidDate(dateProp) && isSameDate(focusedDate, dateProp))) {
|
7873 | setFocusedDate(dateProp);
|
7874 | }
|
7875 | }, [dateProp]);
|
7876 | React.useEffect(() => {
|
7877 |
|
7878 | if (shouldFocus) {
|
7879 | if (focusRef.current && focusedDateValidated) {
|
7880 | focusRef.current.focus();
|
7881 | }
|
7882 | }
|
7883 | else {
|
7884 | setShouldFocus(true);
|
7885 | }
|
7886 | }, [focusedDate]);
|
7887 | const onMonthClick = (newDate) => {
|
7888 | setFocusedDate(newDate);
|
7889 | setHoveredDate(newDate);
|
7890 | setShouldFocus(false);
|
7891 | };
|
7892 | const onKeyDown = (ev) => {
|
7893 | const newDate = new Date(focusedDate);
|
7894 | if (ev.key === 'ArrowUp') {
|
7895 | newDate.setDate(newDate.getDate() - 7);
|
7896 | }
|
7897 | else if (ev.key === 'ArrowRight') {
|
7898 | newDate.setDate(newDate.getDate() + 1);
|
7899 | }
|
7900 | else if (ev.key === 'ArrowDown') {
|
7901 | newDate.setDate(newDate.getDate() + 7);
|
7902 | }
|
7903 | else if (ev.key === 'ArrowLeft') {
|
7904 | newDate.setDate(newDate.getDate() - 1);
|
7905 | }
|
7906 | if (newDate.getTime() !== focusedDate.getTime() && isValidated(newDate)) {
|
7907 | ev.preventDefault();
|
7908 | setFocusedDate(newDate);
|
7909 | setHoveredDate(newDate);
|
7910 | setShouldFocus(true);
|
7911 | }
|
7912 | };
|
7913 | const addMonth = (toAdd) => {
|
7914 | const newDate = new Date(focusedDate);
|
7915 | newDate.setMonth(newDate.getMonth() + toAdd);
|
7916 | return newDate;
|
7917 | };
|
7918 | const prevMonth = addMonth(-1);
|
7919 | const nextMonth = addMonth(1);
|
7920 | const focusedYear = focusedDate.getFullYear();
|
7921 | const focusedMonth = focusedDate.getMonth();
|
7922 | const calendar = React__default["default"].useMemo(() => buildCalendar(focusedYear, focusedMonth, weekStart, validators), [
|
7923 | focusedYear,
|
7924 | focusedMonth,
|
7925 | weekStart,
|
7926 | validators
|
7927 | ]);
|
7928 | if (!focusedDateValidated) {
|
7929 | const toFocus = calendar
|
7930 | .reduce((acc, cur) => [...acc, ...cur], [])
|
7931 | .filter(({ date, isValid }) => isValid && date.getMonth() === focusedMonth)
|
7932 | .map(({ date }) => ({ date, days: Math.abs(focusedDate.getTime() - date.getTime()) }))
|
7933 | .sort((o1, o2) => o1.days - o2.days)
|
7934 | .map(({ date }) => date)[0];
|
7935 | if (toFocus) {
|
7936 | setFocusedDate(toFocus);
|
7937 | setHoveredDate(toFocus);
|
7938 | }
|
7939 | }
|
7940 | const isHoveredDateValid = isValidated(hoveredDate);
|
7941 | const monthFormatted = monthFormat(focusedDate);
|
7942 | const yearFormatted = yearFormat(focusedDate);
|
7943 | return (React__default["default"].createElement("div", Object.assign({ className: css(styles$V.calendarMonth, className) }, props),
|
7944 | React__default["default"].createElement("div", { className: styles$V.calendarMonthHeader },
|
7945 | React__default["default"].createElement("div", { className: css(styles$V.calendarMonthHeaderNavControl, styles$V.modifiers.prevMonth) },
|
7946 | React__default["default"].createElement(Button, { variant: "plain", "aria-label": prevMonthAriaLabel, onClick: () => onMonthClick(prevMonth) },
|
7947 | React__default["default"].createElement(ArrowLeftIcon$1, { "aria-hidden": true }))),
|
7948 | React__default["default"].createElement("div", { className: styles$V.calendarMonthHeaderMonth },
|
7949 | React__default["default"].createElement("span", { id: hiddenMonthId, hidden: true }, "Month"),
|
7950 | React__default["default"].createElement(Select
|
7951 |
|
7952 | , {
|
7953 |
|
7954 | width: "140px", "aria-labelledby": hiddenMonthId, isOpen: isSelectOpen, onToggle: () => {
|
7955 | setIsSelectOpen(!isSelectOpen);
|
7956 | onSelectToggle(!isSelectOpen);
|
7957 | }, onSelect: (_ev, monthNum) => {
|
7958 |
|
7959 |
|
7960 | setTimeout(() => {
|
7961 | setIsSelectOpen(false);
|
7962 | onSelectToggle(false);
|
7963 | const newDate = new Date(focusedDate);
|
7964 | newDate.setMonth(Number(monthNum));
|
7965 | setFocusedDate(newDate);
|
7966 | setHoveredDate(newDate);
|
7967 | setShouldFocus(false);
|
7968 | }, 0);
|
7969 | }, variant: "single", selections: monthFormatted }, longMonths.map((longMonth, index) => (React__default["default"].createElement(SelectOption, { key: index, value: index, isSelected: longMonth === monthFormatted }, longMonth))))),
|
7970 | React__default["default"].createElement("div", { className: styles$V.calendarMonthHeaderYear },
|
7971 | React__default["default"].createElement(TextInput, { "aria-label": yearInputAriaLabel, type: "number", value: yearFormatted, onChange: year => {
|
7972 | const newDate = new Date(focusedDate);
|
7973 | newDate.setFullYear(+year);
|
7974 | setFocusedDate(newDate);
|
7975 | setHoveredDate(newDate);
|
7976 | setShouldFocus(false);
|
7977 | } })),
|
7978 | React__default["default"].createElement("div", { className: css(styles$V.calendarMonthHeaderNavControl, styles$V.modifiers.nextMonth) },
|
7979 | React__default["default"].createElement(Button, { variant: "plain", "aria-label": nextMonthAriaLabel, onClick: () => onMonthClick(nextMonth) },
|
7980 | React__default["default"].createElement(ArrowRightIcon$1, { "aria-hidden": true })))),
|
7981 | React__default["default"].createElement("table", { className: styles$V.calendarMonthCalendar },
|
7982 | React__default["default"].createElement("thead", { className: styles$V.calendarMonthDays },
|
7983 | React__default["default"].createElement("tr", null, calendar[0].map(({ date }, index) => (React__default["default"].createElement("th", { key: index, className: styles$V.calendarMonthDay, scope: "col" },
|
7984 | React__default["default"].createElement("span", { className: "pf-screen-reader" }, longWeekdayFormat(date)),
|
7985 | React__default["default"].createElement("span", { "aria-hidden": true }, weekdayFormat(date))))))),
|
7986 | React__default["default"].createElement("tbody", { onKeyDown: onKeyDown }, calendar.map((week, index) => (React__default["default"].createElement("tr", { key: index, className: styles$V.calendarMonthDatesRow }, week.map(({ date, isValid }, index) => {
|
7987 | const dayFormatted = dayFormat(date);
|
7988 | const isToday = isSameDate(date, today);
|
7989 | const isSelected = isValidDate(dateProp) && isSameDate(date, dateProp);
|
7990 | const isFocused = isSameDate(date, focusedDate);
|
7991 | const isAdjacentMonth = date.getMonth() !== focusedDate.getMonth();
|
7992 | const isRangeStart = isValidDate(rangeStart) && isSameDate(date, rangeStart);
|
7993 | let isInRange = false;
|
7994 | let isRangeEnd = false;
|
7995 | if (isValidDate(rangeStart) && isValidDate(dateProp)) {
|
7996 | isInRange = date > rangeStart && date < dateProp;
|
7997 | isRangeEnd = isSameDate(date, dateProp);
|
7998 | }
|
7999 | else if (isValidDate(rangeStart) && isHoveredDateValid) {
|
8000 | if (hoveredDate > rangeStart || isSameDate(hoveredDate, rangeStart)) {
|
8001 | isInRange = date > rangeStart && date < hoveredDate;
|
8002 | isRangeEnd = isSameDate(date, hoveredDate);
|
8003 | }
|
8004 |
|
8005 |
|
8006 | }
|
8007 | return (React__default["default"].createElement("td", { key: index, className: css(styles$V.calendarMonthDatesCell, isAdjacentMonth && styles$V.modifiers.adjacentMonth, isToday && styles$V.modifiers.current, (isSelected || isRangeStart) && styles$V.modifiers.selected, !isValid && styles$V.modifiers.disabled, (isInRange || isRangeStart || isRangeEnd) && styles$V.modifiers.inRange, isRangeStart && styles$V.modifiers.startRange, isRangeEnd && styles$V.modifiers.endRange) },
|
8008 | React__default["default"].createElement("button", Object.assign({ className: css(styles$V.calendarMonthDate, isRangeEnd && styles$V.modifiers.hover, !isValid && styles$V.modifiers.disabled), type: "button", onClick: () => onChange(date), onMouseOver: () => setHoveredDate(date), tabIndex: isFocused ? 0 : -1, disabled: !isValid, "aria-label": cellAriaLabel ? cellAriaLabel(date) : `${dayFormatted} ${monthFormatted} ${yearFormatted}` }, (isFocused && { ref: focusRef })), dayFormatted)));
|
8009 | }))))))));
|
8010 | };
|
8011 |
|
8012 | Promise.resolve().then(function () { return card; });
|
8013 | var styles$U = {
|
8014 | "card": "pf-c-card",
|
8015 | "cardActions": "pf-c-card__actions",
|
8016 | "cardBody": "pf-c-card__body",
|
8017 | "cardExpandableContent": "pf-c-card__expandable-content",
|
8018 | "cardFooter": "pf-c-card__footer",
|
8019 | "cardHeader": "pf-c-card__header",
|
8020 | "cardHeaderToggle": "pf-c-card__header-toggle",
|
8021 | "cardHeaderToggleIcon": "pf-c-card__header-toggle-icon",
|
8022 | "cardTitle": "pf-c-card__title",
|
8023 | "divider": "pf-c-divider",
|
8024 | "modifiers": {
|
8025 | "hoverable": "pf-m-hoverable",
|
8026 | "selectable": "pf-m-selectable",
|
8027 | "selected": "pf-m-selected",
|
8028 | "hoverableRaised": "pf-m-hoverable-raised",
|
8029 | "selectableRaised": "pf-m-selectable-raised",
|
8030 | "nonSelectableRaised": "pf-m-non-selectable-raised",
|
8031 | "selectedRaised": "pf-m-selected-raised",
|
8032 | "compact": "pf-m-compact",
|
8033 | "displayLg": "pf-m-display-lg",
|
8034 | "flat": "pf-m-flat",
|
8035 | "plain": "pf-m-plain",
|
8036 | "rounded": "pf-m-rounded",
|
8037 | "expanded": "pf-m-expanded",
|
8038 | "fullHeight": "pf-m-full-height",
|
8039 | "toggleRight": "pf-m-toggle-right",
|
8040 | "noOffset": "pf-m-no-offset",
|
8041 | "noFill": "pf-m-no-fill",
|
8042 | "overpassFont": "pf-m-overpass-font"
|
8043 | }
|
8044 | };
|
8045 |
|
8046 | const CardContext = React__namespace.createContext({
|
8047 | cardId: '',
|
8048 | registerTitleId: () => { },
|
8049 | isExpanded: false
|
8050 | });
|
8051 | const Card = (_a) => {
|
8052 | var { children = null, id = '', className = '', component = 'article', isHoverable = false, isCompact = false, isSelectable = false, isSelectableRaised = false, isSelected = false, isDisabledRaised = false, isFlat = false, isExpanded = false, isRounded = false, isLarge = false, isFullHeight = false, isPlain = false, ouiaId, ouiaSafe = true, hasSelectableInput = false, selectableInputAriaLabel, onSelectableInputChange = () => { } } = _a, props = __rest$1(_a, ["children", "id", "className", "component", "isHoverable", "isCompact", "isSelectable", "isSelectableRaised", "isSelected", "isDisabledRaised", "isFlat", "isExpanded", "isRounded", "isLarge", "isFullHeight", "isPlain", "ouiaId", "ouiaSafe", "hasSelectableInput", "selectableInputAriaLabel", "onSelectableInputChange"]);
|
8053 | const Component = component;
|
8054 | const ouiaProps = useOUIAProps(Card.displayName, ouiaId, ouiaSafe);
|
8055 | const [titleId, setTitleId] = React__namespace.useState('');
|
8056 | const [ariaProps, setAriaProps] = React__namespace.useState();
|
8057 | if (isCompact && isLarge) {
|
8058 |
|
8059 | console.warn('Card: Cannot use isCompact with isLarge. Defaulting to isCompact');
|
8060 | isLarge = false;
|
8061 | }
|
8062 | const getSelectableModifiers = () => {
|
8063 | if (isDisabledRaised) {
|
8064 | return css(styles$U.modifiers.nonSelectableRaised);
|
8065 | }
|
8066 | if (isSelectableRaised) {
|
8067 | return css(styles$U.modifiers.selectableRaised, isSelected && styles$U.modifiers.selectedRaised);
|
8068 | }
|
8069 | if (isSelectable || isHoverable) {
|
8070 | return css(styles$U.modifiers.selectable, isSelected && styles$U.modifiers.selected);
|
8071 | }
|
8072 | return '';
|
8073 | };
|
8074 | const containsCardTitleChildRef = React__namespace.useRef(false);
|
8075 | const registerTitleId = (id) => {
|
8076 | setTitleId(id);
|
8077 | containsCardTitleChildRef.current = !!id;
|
8078 | };
|
8079 | React__namespace.useEffect(() => {
|
8080 | if (selectableInputAriaLabel) {
|
8081 | setAriaProps({ 'aria-label': selectableInputAriaLabel });
|
8082 | }
|
8083 | else if (titleId) {
|
8084 | setAriaProps({ 'aria-labelledby': titleId });
|
8085 | }
|
8086 | else if (hasSelectableInput && !containsCardTitleChildRef.current) {
|
8087 | setAriaProps({});
|
8088 |
|
8089 | console.warn('If no CardTitle component is passed as a child of Card the selectableInputAriaLabel prop must be passed');
|
8090 | }
|
8091 | }, [hasSelectableInput, selectableInputAriaLabel, titleId]);
|
8092 | return (React__namespace.createElement(CardContext.Provider, { value: {
|
8093 | cardId: id,
|
8094 | registerTitleId,
|
8095 | isExpanded
|
8096 | } },
|
8097 | hasSelectableInput && (React__namespace.createElement("input", Object.assign({ className: "pf-screen-reader", id: `${id}-input` }, ariaProps, { type: "checkbox", checked: isSelected, onChange: event => onSelectableInputChange(id, event), disabled: isDisabledRaised, tabIndex: -1 }))),
|
8098 | React__namespace.createElement(Component, Object.assign({ id: id, className: css(styles$U.card, isCompact && styles$U.modifiers.compact, isExpanded && styles$U.modifiers.expanded, isFlat && styles$U.modifiers.flat, isRounded && styles$U.modifiers.rounded, isLarge && styles$U.modifiers.displayLg, isFullHeight && styles$U.modifiers.fullHeight, isPlain && styles$U.modifiers.plain, getSelectableModifiers(), className), tabIndex: isSelectable || isSelectableRaised ? '0' : undefined }, props, ouiaProps), children)));
|
8099 | };
|
8100 | Card.displayName = 'Card';
|
8101 |
|
8102 | const CardActions = (_a) => {
|
8103 | var { children = null, className = '', hasNoOffset = false } = _a, props = __rest$1(_a, ["children", "className", "hasNoOffset"]);
|
8104 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$U.cardActions, hasNoOffset && styles$U.modifiers.noOffset, className) }, props), children));
|
8105 | };
|
8106 | CardActions.displayName = 'CardActions';
|
8107 |
|
8108 | const CardBody = (_a) => {
|
8109 | var { children = null, className = '', component = 'div', isFilled = true } = _a, props = __rest$1(_a, ["children", "className", "component", "isFilled"]);
|
8110 | const Component = component;
|
8111 | return (React__namespace.createElement(Component, Object.assign({ className: css(styles$U.cardBody, !isFilled && styles$U.modifiers.noFill, className) }, props), children));
|
8112 | };
|
8113 | CardBody.displayName = 'CardBody';
|
8114 |
|
8115 | const CardExpandableContent = (_a) => {
|
8116 | var { children = null, className = '' } = _a, props = __rest$1(_a, ["children", "className"]);
|
8117 | return (React__namespace.createElement(CardContext.Consumer, null, ({ isExpanded }) => isExpanded ? (React__namespace.createElement("div", Object.assign({ className: css(styles$U.cardExpandableContent, className) }, props), children)) : null));
|
8118 | };
|
8119 | CardExpandableContent.displayName = 'CardExpandableContent';
|
8120 |
|
8121 | const CardFooter = (_a) => {
|
8122 | var { children = null, className = '', component = 'div' } = _a, props = __rest$1(_a, ["children", "className", "component"]);
|
8123 | const Component = component;
|
8124 | return (React__namespace.createElement(Component, Object.assign({ className: css(styles$U.cardFooter, className) }, props), children));
|
8125 | };
|
8126 | CardFooter.displayName = 'CardFooter';
|
8127 |
|
8128 | const CardTitle = (_a) => {
|
8129 | var { children = null, className = '', component = 'div' } = _a, props = __rest$1(_a, ["children", "className", "component"]);
|
8130 | const { cardId, registerTitleId } = React__namespace.useContext(CardContext);
|
8131 | const Component = component;
|
8132 | const titleId = cardId ? `${cardId}-title` : '';
|
8133 | React__namespace.useEffect(() => {
|
8134 | registerTitleId(titleId);
|
8135 | return () => registerTitleId('');
|
8136 | }, [registerTitleId, titleId]);
|
8137 | return (React__namespace.createElement(Component, Object.assign({ className: css(styles$U.cardTitle, className), id: titleId || undefined }, props), children));
|
8138 | };
|
8139 | CardTitle.displayName = 'CardTitle';
|
8140 |
|
8141 | const CardHeader = (_a) => {
|
8142 | var { children = null, className = '', id, onExpand, toggleButtonProps, isToggleRightAligned } = _a, props = __rest$1(_a, ["children", "className", "id", "onExpand", "toggleButtonProps", "isToggleRightAligned"]);
|
8143 | return (React__namespace.createElement(CardContext.Consumer, null, ({ cardId }) => {
|
8144 | const cardHeaderToggle = (React__namespace.createElement("div", { className: css(styles$U.cardHeaderToggle) },
|
8145 | React__namespace.createElement(Button, Object.assign({ variant: "plain", type: "button", onClick: evt => {
|
8146 | onExpand(evt, cardId);
|
8147 | } }, toggleButtonProps),
|
8148 | React__namespace.createElement("span", { className: css(styles$U.cardHeaderToggleIcon) },
|
8149 | React__namespace.createElement(AngleRightIcon$1, { "aria-hidden": "true" })))));
|
8150 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$U.cardHeader, isToggleRightAligned && styles$U.modifiers.toggleRight, className), id: id }, props),
|
8151 | onExpand && !isToggleRightAligned && cardHeaderToggle,
|
8152 | children,
|
8153 | onExpand && isToggleRightAligned && cardHeaderToggle));
|
8154 | }));
|
8155 | };
|
8156 | CardHeader.displayName = 'CardHeader';
|
8157 |
|
8158 | const CardHeaderMain = (_a) => {
|
8159 | var { children = null, className = '' } = _a, props = __rest$1(_a, ["children", "className"]);
|
8160 | return (React__namespace.createElement("div", Object.assign({ className: className }, props), children));
|
8161 | };
|
8162 | CardHeaderMain.displayName = 'CardHeaderMain';
|
8163 |
|
8164 |
|
8165 | const defaultOnChange = () => { };
|
8166 | class Checkbox extends React__namespace.Component {
|
8167 | constructor(props) {
|
8168 | super(props);
|
8169 | this.handleChange = (event) => {
|
8170 | this.props.onChange(event.currentTarget.checked, event);
|
8171 | };
|
8172 | this.state = {
|
8173 | ouiaStateId: getDefaultOUIAId(Checkbox.displayName)
|
8174 | };
|
8175 | }
|
8176 | render() {
|
8177 | const _a = this.props, { 'aria-label': ariaLabel, className, onChange, isValid, isDisabled, isChecked, label, checked, defaultChecked, description, body, ouiaId, ouiaSafe } = _a, props = __rest$1(_a, ['aria-label', "className", "onChange", "isValid", "isDisabled", "isChecked", "label", "checked", "defaultChecked", "description", "body", "ouiaId", "ouiaSafe"]);
|
8178 | if (!props.id) {
|
8179 |
|
8180 | console.error('Checkbox:', 'id is required to make input accessible');
|
8181 | }
|
8182 | const checkedProps = {};
|
8183 | if ([true, false].includes(checked) || isChecked === true) {
|
8184 | checkedProps.checked = checked || isChecked;
|
8185 | }
|
8186 | if (onChange !== defaultOnChange) {
|
8187 | checkedProps.checked = isChecked;
|
8188 | }
|
8189 | if ([false, true].includes(defaultChecked)) {
|
8190 | checkedProps.defaultChecked = defaultChecked;
|
8191 | }
|
8192 | checkedProps.checked = checkedProps.checked === null ? false : checkedProps.checked;
|
8193 | return (React__namespace.createElement("div", { className: css(styles$Y.check, !label && styles$Y.modifiers.standalone, className) },
|
8194 | React__namespace.createElement("input", Object.assign({}, props, { className: css(styles$Y.checkInput), type: "checkbox", onChange: this.handleChange, "aria-invalid": !isValid, "aria-label": ariaLabel, disabled: isDisabled, ref: elem => elem && (elem.indeterminate = isChecked === null) }, checkedProps, getOUIAProps(Checkbox.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId, ouiaSafe))),
|
8195 | label && (React__namespace.createElement("label", { className: css(styles$Y.checkLabel, isDisabled && styles$Y.modifiers.disabled), htmlFor: props.id }, label)),
|
8196 | description && React__namespace.createElement("span", { className: css(styles$Y.checkDescription) }, description),
|
8197 | body && React__namespace.createElement("span", { className: css(styles$Y.checkBody) }, body)));
|
8198 | }
|
8199 | }
|
8200 | Checkbox.displayName = 'Checkbox';
|
8201 | Checkbox.defaultProps = {
|
8202 | className: '',
|
8203 | isValid: true,
|
8204 | isDisabled: false,
|
8205 | isChecked: false,
|
8206 | onChange: defaultOnChange,
|
8207 | ouiaSafe: true
|
8208 | };
|
8209 |
|
8210 | Promise.resolve().then(function () { return clipboardCopy; });
|
8211 | var styles$T = {
|
8212 | "button": "pf-c-button",
|
8213 | "clipboardCopy": "pf-c-clipboard-copy",
|
8214 | "clipboardCopyActions": "pf-c-clipboard-copy__actions",
|
8215 | "clipboardCopyActionsItem": "pf-c-clipboard-copy__actions-item",
|
8216 | "clipboardCopyExpandableContent": "pf-c-clipboard-copy__expandable-content",
|
8217 | "clipboardCopyGroup": "pf-c-clipboard-copy__group",
|
8218 | "clipboardCopyText": "pf-c-clipboard-copy__text",
|
8219 | "clipboardCopyToggleIcon": "pf-c-clipboard-copy__toggle-icon",
|
8220 | "modifiers": {
|
8221 | "expanded": "pf-m-expanded",
|
8222 | "inline": "pf-m-inline",
|
8223 | "block": "pf-m-block",
|
8224 | "code": "pf-m-code"
|
8225 | }
|
8226 | };
|
8227 |
|
8228 | Promise.resolve().then(function () { return popover; });
|
8229 | var styles$S = {
|
8230 | "button": "pf-c-button",
|
8231 | "modifiers": {
|
8232 | "noPadding": "pf-m-no-padding",
|
8233 | "widthAuto": "pf-m-width-auto",
|
8234 | "top": "pf-m-top",
|
8235 | "topLeft": "pf-m-top-left",
|
8236 | "topRight": "pf-m-top-right",
|
8237 | "bottom": "pf-m-bottom",
|
8238 | "bottomLeft": "pf-m-bottom-left",
|
8239 | "bottomRight": "pf-m-bottom-right",
|
8240 | "left": "pf-m-left",
|
8241 | "leftTop": "pf-m-left-top",
|
8242 | "leftBottom": "pf-m-left-bottom",
|
8243 | "right": "pf-m-right",
|
8244 | "rightTop": "pf-m-right-top",
|
8245 | "rightBottom": "pf-m-right-bottom",
|
8246 | "danger": "pf-m-danger",
|
8247 | "warning": "pf-m-warning",
|
8248 | "success": "pf-m-success",
|
8249 | "default": "pf-m-default",
|
8250 | "info": "pf-m-info",
|
8251 | "icon": "pf-m-icon"
|
8252 | },
|
8253 | "popover": "pf-c-popover",
|
8254 | "popoverArrow": "pf-c-popover__arrow",
|
8255 | "popoverBody": "pf-c-popover__body",
|
8256 | "popoverContent": "pf-c-popover__content",
|
8257 | "popoverFooter": "pf-c-popover__footer",
|
8258 | "popoverTitle": "pf-c-popover__title",
|
8259 | "popoverTitleIcon": "pf-c-popover__title-icon",
|
8260 | "popoverTitleText": "pf-c-popover__title-text",
|
8261 | "title": "pf-c-title"
|
8262 | };
|
8263 |
|
8264 | const PopoverContext = React__namespace.createContext({});
|
8265 |
|
8266 | const PopoverContent = (_a) => {
|
8267 | var { className = null, children } = _a, props = __rest$1(_a, ["className", "children"]);
|
8268 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$S.popoverContent, className) }, props), children));
|
8269 | };
|
8270 | PopoverContent.displayName = 'PopoverContent';
|
8271 |
|
8272 | const PopoverBody = (_a) => {
|
8273 | var { children, id, className } = _a, props = __rest$1(_a, ["children", "id", "className"]);
|
8274 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$S.popoverBody, className), id: id }, props), children));
|
8275 | };
|
8276 | PopoverBody.displayName = 'PopoverBody';
|
8277 |
|
8278 | const PopoverHeaderIcon = (_a) => {
|
8279 | var { children, className } = _a, props = __rest$1(_a, ["children", "className"]);
|
8280 | return (React__namespace.createElement("span", Object.assign({ className: css(styles$S.popoverTitleIcon, className) }, props), children));
|
8281 | };
|
8282 | PopoverHeaderIcon.displayName = 'PopoverHeaderIcon';
|
8283 |
|
8284 | const PopoverHeaderText = (_a) => {
|
8285 | var { children, className } = _a, props = __rest$1(_a, ["children", "className"]);
|
8286 | return (React__namespace.createElement("span", Object.assign({ className: css(styles$S.popoverTitleText, className) }, props), children));
|
8287 | };
|
8288 | PopoverHeaderText.displayName = 'PopoverHeaderText';
|
8289 |
|
8290 | const PopoverHeader = (_a) => {
|
8291 | var { children, icon, className, titleHeadingLevel = 'h6', alertSeverityVariant, id, alertSeverityScreenReaderText } = _a, props = __rest$1(_a, ["children", "icon", "className", "titleHeadingLevel", "alertSeverityVariant", "id", "alertSeverityScreenReaderText"]);
|
8292 | const HeadingLevel = titleHeadingLevel;
|
8293 | return icon || alertSeverityVariant ? (React__namespace.createElement("header", Object.assign({ className: css('pf-c-popover__header', className), id: id }, props),
|
8294 | React__namespace.createElement(HeadingLevel, { className: css(styles$S.popoverTitle, icon && styles$S.modifiers.icon) },
|
8295 | icon && React__namespace.createElement(PopoverHeaderIcon, null, icon),
|
8296 | alertSeverityVariant && alertSeverityScreenReaderText && (React__namespace.createElement("span", { className: "pf-u-screen-reader" }, alertSeverityScreenReaderText)),
|
8297 | React__namespace.createElement(PopoverHeaderText, null, children)))) : (React__namespace.createElement(Title, Object.assign({ headingLevel: titleHeadingLevel, size: exports.TitleSizes.md, id: id, className: className }, props), children));
|
8298 | };
|
8299 | PopoverHeader.displayName = 'PopoverHeader';
|
8300 |
|
8301 | const PopoverFooter = (_a) => {
|
8302 | var { children, className = '' } = _a, props = __rest$1(_a, ["children", "className"]);
|
8303 | return (React__namespace.createElement("footer", Object.assign({ className: css(styles$S.popoverFooter, className) }, props), children));
|
8304 | };
|
8305 | PopoverFooter.displayName = 'PopoverFooter';
|
8306 |
|
8307 | const PopoverCloseButton = (_a) => {
|
8308 | var { onClose = () => undefined } = _a, props = __rest$1(_a, ["onClose"]);
|
8309 | const [closeButtonElement, setCloseButtonElement] = React__namespace.useState(null);
|
8310 | React__namespace.useEffect(() => {
|
8311 | closeButtonElement && closeButtonElement.addEventListener('click', onClose, false);
|
8312 | return () => {
|
8313 | closeButtonElement && closeButtonElement.removeEventListener('click', onClose, false);
|
8314 | };
|
8315 | }, [closeButtonElement]);
|
8316 | return (React__namespace.createElement(FindRefWrapper, { onFoundRef: (foundRef) => setCloseButtonElement(foundRef) },
|
8317 | React__namespace.createElement(Button, Object.assign({ variant: "plain", "aria-label": true }, props, { style: { pointerEvents: 'auto' } }),
|
8318 | React__namespace.createElement(TimesIcon$1, null))));
|
8319 | };
|
8320 | PopoverCloseButton.displayName = 'PopoverCloseButton';
|
8321 |
|
8322 | const PopoverArrow = (_a) => {
|
8323 | var { className = '' } = _a, props = __rest$1(_a, ["className"]);
|
8324 | return React__namespace.createElement("div", Object.assign({ className: css(styles$S.popoverArrow, className) }, props));
|
8325 | };
|
8326 | PopoverArrow.displayName = 'PopoverArrow';
|
8327 |
|
8328 | const c_popover_MaxWidth = {
|
8329 | "name": "--pf-c-popover--MaxWidth",
|
8330 | "value": "none",
|
8331 | "var": "var(--pf-c-popover--MaxWidth)"
|
8332 | };
|
8333 | var popoverMaxWidth = c_popover_MaxWidth;
|
8334 |
|
8335 | const c_popover_MinWidth = {
|
8336 | "name": "--pf-c-popover--MinWidth",
|
8337 | "value": "auto",
|
8338 | "var": "var(--pf-c-popover--MinWidth)"
|
8339 | };
|
8340 | var popoverMinWidth = c_popover_MinWidth;
|
8341 |
|
8342 | exports.PopoverPosition = void 0;
|
8343 | (function (PopoverPosition) {
|
8344 | PopoverPosition["auto"] = "auto";
|
8345 | PopoverPosition["top"] = "top";
|
8346 | PopoverPosition["bottom"] = "bottom";
|
8347 | PopoverPosition["left"] = "left";
|
8348 | PopoverPosition["right"] = "right";
|
8349 | PopoverPosition["topStart"] = "top-start";
|
8350 | PopoverPosition["topEnd"] = "top-end";
|
8351 | PopoverPosition["bottomStart"] = "bottom-start";
|
8352 | PopoverPosition["bottomEnd"] = "bottom-end";
|
8353 | PopoverPosition["leftStart"] = "left-start";
|
8354 | PopoverPosition["leftEnd"] = "left-end";
|
8355 | PopoverPosition["rightStart"] = "right-start";
|
8356 | PopoverPosition["rightEnd"] = "right-end";
|
8357 | })(exports.PopoverPosition || (exports.PopoverPosition = {}));
|
8358 | const alertStyle = {
|
8359 | default: styles$S.modifiers.default,
|
8360 | info: styles$S.modifiers.info,
|
8361 | success: styles$S.modifiers.success,
|
8362 | warning: styles$S.modifiers.warning,
|
8363 | danger: styles$S.modifiers.danger
|
8364 | };
|
8365 | const Popover = (_a) => {
|
8366 | var { children, position = 'top', enableFlip = true, className = '', isVisible = null, shouldClose = () => null, shouldOpen = () => null, 'aria-label': ariaLabel = '', bodyContent, headerContent = null, headerComponent = 'h6', headerIcon = null, alertSeverityVariant, alertSeverityScreenReaderText, footerContent = null, appendTo = () => document.body, hideOnOutsideClick = true, onHide = () => null, onHidden = () => null, onShow = () => null, onShown = () => null, onMount = () => null, zIndex = 9999, minWidth = popoverMinWidth && popoverMinWidth.value, maxWidth = popoverMaxWidth && popoverMaxWidth.value, closeBtnAriaLabel = 'Close', showClose = true, distance = 25,
|
8367 |
|
8368 | flipBehavior = ['top', 'right', 'bottom', 'left', 'top', 'right', 'bottom'], animationDuration = 300, id, withFocusTrap: propWithFocusTrap, boundary, tippyProps, reference, hasNoPadding = false, hasAutoWidth = false } = _a, rest = __rest$1(_a, ["children", "position", "enableFlip", "className", "isVisible", "shouldClose", "shouldOpen", 'aria-label', "bodyContent", "headerContent", "headerComponent", "headerIcon", "alertSeverityVariant", "alertSeverityScreenReaderText", "footerContent", "appendTo", "hideOnOutsideClick", "onHide", "onHidden", "onShow", "onShown", "onMount", "zIndex", "minWidth", "maxWidth", "closeBtnAriaLabel", "showClose", "distance", "flipBehavior", "animationDuration", "id", "withFocusTrap", "boundary", "tippyProps", "reference", "hasNoPadding", "hasAutoWidth"]);
|
8369 | {
|
8370 | boundary !== undefined &&
|
8371 | console.warn('The Popover boundary prop has been deprecated. If you want to constrain the popper to a specific element use the appendTo prop instead.');
|
8372 | tippyProps !== undefined && console.warn('The Popover tippyProps prop has been deprecated and is no longer used.');
|
8373 | }
|
8374 |
|
8375 |
|
8376 | const uniqueId = id || getUniqueId();
|
8377 | const triggerManually = isVisible !== null;
|
8378 | const [visible, setVisible] = React__namespace.useState(false);
|
8379 | const [opacity, setOpacity] = React__namespace.useState(0);
|
8380 | const [focusTrapActive, setFocusTrapActive] = React__namespace.useState(Boolean(propWithFocusTrap));
|
8381 | const transitionTimerRef = React__namespace.useRef(null);
|
8382 | const showTimerRef = React__namespace.useRef(null);
|
8383 | const hideTimerRef = React__namespace.useRef(null);
|
8384 | React__namespace.useEffect(() => {
|
8385 | onMount();
|
8386 | }, []);
|
8387 | React__namespace.useEffect(() => {
|
8388 | if (triggerManually) {
|
8389 | if (isVisible) {
|
8390 | show();
|
8391 | }
|
8392 | else {
|
8393 | hide();
|
8394 | }
|
8395 | }
|
8396 | }, [isVisible, triggerManually]);
|
8397 | const show = (withFocusTrap) => {
|
8398 | onShow();
|
8399 | if (transitionTimerRef.current) {
|
8400 | clearTimeout(transitionTimerRef.current);
|
8401 | }
|
8402 | if (hideTimerRef.current) {
|
8403 | clearTimeout(hideTimerRef.current);
|
8404 | }
|
8405 | showTimerRef.current = setTimeout(() => {
|
8406 | setVisible(true);
|
8407 | setOpacity(1);
|
8408 | propWithFocusTrap !== false && withFocusTrap && setFocusTrapActive(true);
|
8409 | onShown();
|
8410 | }, 0);
|
8411 | };
|
8412 | const hide = () => {
|
8413 | onHide();
|
8414 | if (showTimerRef.current) {
|
8415 | clearTimeout(showTimerRef.current);
|
8416 | }
|
8417 | hideTimerRef.current = setTimeout(() => {
|
8418 | setVisible(false);
|
8419 | setOpacity(0);
|
8420 | setFocusTrapActive(false);
|
8421 | transitionTimerRef.current = setTimeout(() => {
|
8422 | onHidden();
|
8423 | }, animationDuration);
|
8424 | }, 0);
|
8425 | };
|
8426 | const positionModifiers = {
|
8427 | top: styles$S.modifiers.top,
|
8428 | bottom: styles$S.modifiers.bottom,
|
8429 | left: styles$S.modifiers.left,
|
8430 | right: styles$S.modifiers.right,
|
8431 | 'top-start': styles$S.modifiers.topLeft,
|
8432 | 'top-end': styles$S.modifiers.topRight,
|
8433 | 'bottom-start': styles$S.modifiers.bottomLeft,
|
8434 | 'bottom-end': styles$S.modifiers.bottomRight,
|
8435 | 'left-start': styles$S.modifiers.leftTop,
|
8436 | 'left-end': styles$S.modifiers.leftBottom,
|
8437 | 'right-start': styles$S.modifiers.rightTop,
|
8438 | 'right-end': styles$S.modifiers.rightBottom
|
8439 | };
|
8440 | const hasCustomMinWidth = minWidth !== popoverMinWidth.value;
|
8441 | const hasCustomMaxWidth = maxWidth !== popoverMaxWidth.value;
|
8442 | const onDocumentKeyDown = (event) => {
|
8443 | if (event.keyCode === KEY_CODES.ESCAPE_KEY && visible) {
|
8444 | if (triggerManually) {
|
8445 | shouldClose(null, hide, event);
|
8446 | }
|
8447 | else {
|
8448 | hide();
|
8449 | }
|
8450 | }
|
8451 | };
|
8452 | const onDocumentClick = (event, triggerElement, popperElement) => {
|
8453 | if (hideOnOutsideClick && visible) {
|
8454 |
|
8455 | const isChild = popperElement && popperElement.contains(event.target);
|
8456 | if (isChild) {
|
8457 |
|
8458 | return;
|
8459 | }
|
8460 | if (triggerManually) {
|
8461 | shouldClose(null, hide, event);
|
8462 | }
|
8463 | else {
|
8464 | hide();
|
8465 | }
|
8466 | }
|
8467 | };
|
8468 | const onTriggerClick = (event) => {
|
8469 | if (triggerManually) {
|
8470 | if (visible) {
|
8471 | shouldClose(null, hide, event);
|
8472 | }
|
8473 | else {
|
8474 | shouldOpen(show, event);
|
8475 | }
|
8476 | }
|
8477 | else {
|
8478 | if (visible) {
|
8479 | hide();
|
8480 | }
|
8481 | else {
|
8482 | show(true);
|
8483 | }
|
8484 | }
|
8485 | };
|
8486 | const onContentMouseDown = () => {
|
8487 | if (focusTrapActive) {
|
8488 | setFocusTrapActive(false);
|
8489 | }
|
8490 | };
|
8491 | const closePopover = (event) => {
|
8492 | event.stopPropagation();
|
8493 | if (triggerManually) {
|
8494 | shouldClose(null, hide, event);
|
8495 | }
|
8496 | else {
|
8497 | hide();
|
8498 | }
|
8499 | };
|
8500 | const content = (React__namespace.createElement(FocusTrap, Object.assign({ active: focusTrapActive, focusTrapOptions: {
|
8501 | returnFocusOnDeactivate: true,
|
8502 | clickOutsideDeactivates: true,
|
8503 | fallbackFocus: () => {
|
8504 |
|
8505 |
|
8506 |
|
8507 |
|
8508 | let node = null;
|
8509 | if (document && document.activeElement) {
|
8510 | node = document.activeElement;
|
8511 | }
|
8512 | return node;
|
8513 | }
|
8514 | }, preventScrollOnDeactivate: true, className: css(styles$S.popover, alertSeverityVariant && alertStyle[alertSeverityVariant], hasNoPadding && styles$S.modifiers.noPadding, hasAutoWidth && styles$S.modifiers.widthAuto, className), role: "dialog", "aria-modal": "true", "aria-label": headerContent ? undefined : ariaLabel, "aria-labelledby": headerContent ? `popover-${uniqueId}-header` : undefined, "aria-describedby": `popover-${uniqueId}-body`, onMouseDown: onContentMouseDown, style: {
|
8515 | minWidth: hasCustomMinWidth ? minWidth : null,
|
8516 | maxWidth: hasCustomMaxWidth ? maxWidth : null,
|
8517 | opacity,
|
8518 | transition: getOpacityTransition(animationDuration)
|
8519 | } }, rest),
|
8520 | React__namespace.createElement(PopoverArrow, null),
|
8521 | React__namespace.createElement(PopoverContent, null,
|
8522 | showClose && React__namespace.createElement(PopoverCloseButton, { onClose: closePopover, "aria-label": closeBtnAriaLabel }),
|
8523 | headerContent && (React__namespace.createElement(PopoverHeader, { id: `popover-${uniqueId}-header`, icon: headerIcon, alertSeverityVariant: alertSeverityVariant, alertSeverityScreenReaderText: alertSeverityScreenReaderText || `${alertSeverityVariant} alert:`, titleHeadingLevel: headerComponent }, typeof headerContent === 'function' ? headerContent(hide) : headerContent)),
|
8524 | React__namespace.createElement(PopoverBody, { id: `popover-${uniqueId}-body` }, typeof bodyContent === 'function' ? bodyContent(hide) : bodyContent),
|
8525 | footerContent && (React__namespace.createElement(PopoverFooter, { id: `popover-${uniqueId}-footer` }, typeof footerContent === 'function' ? footerContent(hide) : footerContent)))));
|
8526 | return (React__namespace.createElement(PopoverContext.Provider, { value: { headerComponent } },
|
8527 | React__namespace.createElement(Popper, { trigger: children, reference: reference, popper: content, popperMatchesTriggerWidth: false, appendTo: appendTo, isVisible: visible, positionModifiers: positionModifiers, distance: distance, placement: position, onTriggerClick: onTriggerClick, onDocumentClick: onDocumentClick, onDocumentKeyDown: onDocumentKeyDown, enableFlip: enableFlip, zIndex: zIndex, flipBehavior: flipBehavior })));
|
8528 | };
|
8529 | Popover.displayName = 'Popover';
|
8530 |
|
8531 | const CopyIconConfig = {
|
8532 | name: 'CopyIcon',
|
8533 | height: 512,
|
8534 | width: 448,
|
8535 | svgPath: 'M320 448v40c0 13.255-10.745 24-24 24H24c-13.255 0-24-10.745-24-24V120c0-13.255 10.745-24 24-24h72v296c0 30.879 25.121 56 56 56h168zm0-344V0H152c-13.255 0-24 10.745-24 24v368c0 13.255 10.745 24 24 24h272c13.255 0 24-10.745 24-24V128H344c-13.2 0-24-10.8-24-24zm120.971-31.029L375.029 7.029A24 24 0 0 0 358.059 0H352v96h96v-6.059a24 24 0 0 0-7.029-16.97z',
|
8536 | yOffset: 0,
|
8537 | xOffset: 0,
|
8538 | };
|
8539 |
|
8540 | const CopyIcon = createIcon(CopyIconConfig);
|
8541 |
|
8542 | var CopyIcon$1 = CopyIcon;
|
8543 |
|
8544 | const ClipboardCopyButton = (_a) => {
|
8545 | var { onClick, exitDelay = 0, entryDelay = 300, maxWidth = '100px', position = 'top', 'aria-label': ariaLabel = 'Copyable input', id, textId, children, variant = 'control' } = _a, props = __rest$1(_a, ["onClick", "exitDelay", "entryDelay", "maxWidth", "position", 'aria-label', "id", "textId", "children", "variant"]);
|
8546 | return (React__namespace.createElement(Tooltip, { trigger: "mouseenter focus click", exitDelay: exitDelay, entryDelay: entryDelay, maxWidth: maxWidth, position: position, "aria-live": "polite", aria: "none", content: React__namespace.createElement("div", null, children) },
|
8547 | React__namespace.createElement(Button, Object.assign({ type: "button", variant: variant, onClick: onClick, "aria-label": ariaLabel, id: id, "aria-labelledby": `${id} ${textId}` }, props),
|
8548 | React__namespace.createElement(CopyIcon$1, null))));
|
8549 | };
|
8550 | ClipboardCopyButton.displayName = 'ClipboardCopyButton';
|
8551 |
|
8552 | const AngleDownIconConfig = {
|
8553 | name: 'AngleDownIcon',
|
8554 | height: 512,
|
8555 | width: 320,
|
8556 | svgPath: 'M143 352.3L7 216.3c-9.4-9.4-9.4-24.6 0-33.9l22.6-22.6c9.4-9.4 24.6-9.4 33.9 0l96.4 96.4 96.4-96.4c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9l-136 136c-9.2 9.4-24.4 9.4-33.8 0z',
|
8557 | yOffset: 0,
|
8558 | xOffset: 0,
|
8559 | };
|
8560 |
|
8561 | const AngleDownIcon = createIcon(AngleDownIconConfig);
|
8562 |
|
8563 | var AngleDownIcon$1 = AngleDownIcon;
|
8564 |
|
8565 | const ClipboardCopyToggle = (_a) => {
|
8566 | var { onClick, id, textId, contentId, isExpanded = false } = _a, props = __rest$1(_a, ["onClick", "id", "textId", "contentId", "isExpanded"]);
|
8567 | return (React__namespace.createElement(Button, Object.assign({ type: "button", variant: "control", onClick: onClick, id: id, "aria-labelledby": `${id} ${textId}`, "aria-controls": `${id} ${contentId}`, "aria-expanded": isExpanded }, props), isExpanded ? React__namespace.createElement(AngleDownIcon$1, { "aria-hidden": "true" }) : React__namespace.createElement(AngleRightIcon$1, { "aria-hidden": "true" })));
|
8568 | };
|
8569 | ClipboardCopyToggle.displayName = 'ClipboardCopyToggle';
|
8570 |
|
8571 | class ClipboardCopyExpanded extends React__namespace.Component {
|
8572 | constructor(props) {
|
8573 | super(props);
|
8574 | }
|
8575 | render() {
|
8576 | const _a = this.props, { className, children, onChange, isReadOnly, isCode } = _a, props = __rest$1(_a, ["className", "children", "onChange", "isReadOnly", "isCode"]);
|
8577 | return (React__namespace.createElement("div", Object.assign({ suppressContentEditableWarning: true, className: css(styles$T.clipboardCopyExpandableContent, className), onInput: (e) => onChange(e.target.innerText, e), contentEditable: !isReadOnly }, props), isCode ? React__namespace.createElement("pre", null, children) : children));
|
8578 | }
|
8579 | }
|
8580 | ClipboardCopyExpanded.displayName = 'ClipboardCopyExpanded';
|
8581 | ClipboardCopyExpanded.defaultProps = {
|
8582 | onChange: () => undefined,
|
8583 | className: '',
|
8584 | isReadOnly: false,
|
8585 | isCode: false
|
8586 | };
|
8587 |
|
8588 | const clipboardCopyFunc = (event, text) => {
|
8589 | const clipboard = event.currentTarget.parentElement;
|
8590 | const el = document.createElement('textarea');
|
8591 | el.value = text.toString();
|
8592 | clipboard.appendChild(el);
|
8593 | el.select();
|
8594 | document.execCommand('copy');
|
8595 | clipboard.removeChild(el);
|
8596 | };
|
8597 | exports.ClipboardCopyVariant = void 0;
|
8598 | (function (ClipboardCopyVariant) {
|
8599 | ClipboardCopyVariant["inline"] = "inline";
|
8600 | ClipboardCopyVariant["expansion"] = "expansion";
|
8601 | ClipboardCopyVariant["inlineCompact"] = "inline-compact";
|
8602 | })(exports.ClipboardCopyVariant || (exports.ClipboardCopyVariant = {}));
|
8603 | class ClipboardCopy extends React__namespace.Component {
|
8604 | constructor(props) {
|
8605 | super(props);
|
8606 | this.timer = null;
|
8607 |
|
8608 | this.componentDidUpdate = (prevProps, prevState) => {
|
8609 | if (prevProps.children !== this.props.children) {
|
8610 | this.updateText(this.props.children);
|
8611 | }
|
8612 | };
|
8613 | this.componentWillUnmount = () => {
|
8614 | if (this.timer) {
|
8615 | window.clearTimeout(this.timer);
|
8616 | }
|
8617 | };
|
8618 |
|
8619 | this.expandContent = (_event) => {
|
8620 | this.setState(prevState => ({
|
8621 | expanded: !prevState.expanded
|
8622 | }));
|
8623 | };
|
8624 | this.updateText = (text) => {
|
8625 | this.setState({ text });
|
8626 | this.props.onChange(text);
|
8627 | };
|
8628 | this.render = () => {
|
8629 | const _a = this.props, {
|
8630 |
|
8631 | isExpanded, onChange,
|
8632 |
|
8633 | isReadOnly, isCode, isBlock, exitDelay, maxWidth, entryDelay, switchDelay, onCopy, hoverTip, clickTip, textAriaLabel, toggleAriaLabel, variant, position, className, additionalActions } = _a, divProps = __rest$1(_a, ["isExpanded", "onChange", "isReadOnly", "isCode", "isBlock", "exitDelay", "maxWidth", "entryDelay", "switchDelay", "onCopy", "hoverTip", "clickTip", "textAriaLabel", "toggleAriaLabel", "variant", "position", "className", "additionalActions"]);
|
8634 | const textIdPrefix = 'text-input-';
|
8635 | const toggleIdPrefix = 'toggle-';
|
8636 | const contentIdPrefix = 'content-';
|
8637 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$T.clipboardCopy, variant === 'inline-compact' && styles$T.modifiers.inline, isBlock && styles$T.modifiers.block, this.state.expanded && styles$T.modifiers.expanded, className) }, divProps),
|
8638 | variant === 'inline-compact' && (React__namespace.createElement(GenerateId, { prefix: "" }, id => (React__namespace.createElement(React__namespace.Fragment, null,
|
8639 | !isCode && (React__namespace.createElement("span", { className: css(styles$T.clipboardCopyText), id: `${textIdPrefix}${id}` }, this.state.text)),
|
8640 | isCode && (React__namespace.createElement("code", { className: css(styles$T.clipboardCopyText, styles$T.modifiers.code), id: `${textIdPrefix}${id}` }, this.state.text)),
|
8641 | React__namespace.createElement("span", { className: css(styles$T.clipboardCopyActions) },
|
8642 | React__namespace.createElement("span", { className: css(styles$T.clipboardCopyActionsItem) },
|
8643 | React__namespace.createElement(ClipboardCopyButton, { variant: "plain", exitDelay: exitDelay, entryDelay: entryDelay, maxWidth: maxWidth, position: position, id: `copy-button-${id}`, textId: `text-input-${id}`, "aria-label": hoverTip, onClick: (event) => {
|
8644 | if (this.timer) {
|
8645 | window.clearTimeout(this.timer);
|
8646 | this.setState({ copied: false });
|
8647 | }
|
8648 | onCopy(event, this.state.text);
|
8649 | this.setState({ copied: true }, () => {
|
8650 | this.timer = window.setTimeout(() => {
|
8651 | this.setState({ copied: false });
|
8652 | this.timer = null;
|
8653 | }, switchDelay);
|
8654 | });
|
8655 | } }, this.state.copied ? clickTip : hoverTip)),
|
8656 | additionalActions && additionalActions))))),
|
8657 | variant !== 'inline-compact' && (React__namespace.createElement(GenerateId, { prefix: "" }, id => (React__namespace.createElement(React__namespace.Fragment, null,
|
8658 | React__namespace.createElement("div", { className: css(styles$T.clipboardCopyGroup) },
|
8659 | variant === 'expansion' && (React__namespace.createElement(ClipboardCopyToggle, { isExpanded: this.state.expanded, onClick: this.expandContent, id: `${toggleIdPrefix}${id}`, textId: `${textIdPrefix}${id}`, contentId: `${contentIdPrefix}${id}`, "aria-label": toggleAriaLabel })),
|
8660 | React__namespace.createElement(TextInput, { isReadOnly: isReadOnly || this.state.expanded, onChange: this.updateText, value: this.state.text, id: `text-input-${id}`, "aria-label": textAriaLabel }),
|
8661 | React__namespace.createElement(ClipboardCopyButton, { exitDelay: exitDelay, entryDelay: entryDelay, maxWidth: maxWidth, position: position, id: `copy-button-${id}`, textId: `text-input-${id}`, "aria-label": hoverTip, onClick: (event) => {
|
8662 | if (this.timer) {
|
8663 | window.clearTimeout(this.timer);
|
8664 | this.setState({ copied: false });
|
8665 | }
|
8666 | onCopy(event, this.state.text);
|
8667 | this.setState({ copied: true }, () => {
|
8668 | this.timer = window.setTimeout(() => {
|
8669 | this.setState({ copied: false });
|
8670 | this.timer = null;
|
8671 | }, switchDelay);
|
8672 | });
|
8673 | } }, this.state.copied ? clickTip : hoverTip)),
|
8674 | this.state.expanded && (React__namespace.createElement(ClipboardCopyExpanded, { isReadOnly: isReadOnly, isCode: isCode, id: `content-${id}`, onChange: this.updateText }, this.state.text))))))));
|
8675 | };
|
8676 | this.state = {
|
8677 | text: Array.isArray(this.props.children)
|
8678 | ? this.props.children.join('')
|
8679 | : this.props.children,
|
8680 | expanded: this.props.isExpanded,
|
8681 | copied: false
|
8682 | };
|
8683 | }
|
8684 | }
|
8685 | ClipboardCopy.displayName = 'ClipboardCopy';
|
8686 | ClipboardCopy.defaultProps = {
|
8687 | hoverTip: 'Copy to clipboard',
|
8688 | clickTip: 'Successfully copied to clipboard!',
|
8689 | isReadOnly: false,
|
8690 | isExpanded: false,
|
8691 | isCode: false,
|
8692 | variant: 'inline',
|
8693 | position: exports.PopoverPosition.top,
|
8694 | maxWidth: '150px',
|
8695 | exitDelay: 1600,
|
8696 | entryDelay: 300,
|
8697 | switchDelay: 2000,
|
8698 | onCopy: clipboardCopyFunc,
|
8699 | onChange: () => undefined,
|
8700 | textAriaLabel: 'Copyable input',
|
8701 | toggleAriaLabel: 'Show content',
|
8702 | additionalActions: null
|
8703 | };
|
8704 |
|
8705 | const ClipboardCopyAction = (_a) => {
|
8706 | var { children = null, className = '' } = _a, props = __rest$1(_a, ["children", "className"]);
|
8707 | return (React__namespace.createElement("span", Object.assign({ className: css(styles$T.clipboardCopyActionsItem, className) }, props), children));
|
8708 | };
|
8709 | ClipboardCopyAction.displayName = 'ClipboardCopyAction';
|
8710 |
|
8711 | Promise.resolve().then(function () { return codeBlock; });
|
8712 | var styles$R = {
|
8713 | "codeBlock": "pf-c-code-block",
|
8714 | "codeBlockActions": "pf-c-code-block__actions",
|
8715 | "codeBlockCode": "pf-c-code-block__code",
|
8716 | "codeBlockContent": "pf-c-code-block__content",
|
8717 | "codeBlockHeader": "pf-c-code-block__header",
|
8718 | "codeBlockPre": "pf-c-code-block__pre"
|
8719 | };
|
8720 |
|
8721 | const CodeBlock = (_a) => {
|
8722 | var { children = null, className, actions = null } = _a, props = __rest$1(_a, ["children", "className", "actions"]);
|
8723 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$R.codeBlock, className) }, props),
|
8724 | React__namespace.createElement("div", { className: css(styles$R.codeBlockHeader) },
|
8725 | React__namespace.createElement("div", { className: css(styles$R.codeBlockActions) }, actions && actions)),
|
8726 | React__namespace.createElement("div", { className: css(styles$R.codeBlockContent) }, children)));
|
8727 | };
|
8728 | CodeBlock.displayName = 'CodeBlock';
|
8729 |
|
8730 | const CodeBlockCode = (_a) => {
|
8731 | var { children = null, className, codeClassName } = _a, props = __rest$1(_a, ["children", "className", "codeClassName"]);
|
8732 | return (React__namespace.createElement("pre", Object.assign({ className: css(styles$R.codeBlockPre, className) }, props),
|
8733 | React__namespace.createElement("code", { className: css(styles$R.codeBlockCode, codeClassName) }, children)));
|
8734 | };
|
8735 | CodeBlockCode.displayName = 'CodeBlockCode';
|
8736 |
|
8737 | const CodeBlockAction = (_a) => {
|
8738 | var { children = null, className } = _a, props = __rest$1(_a, ["children", "className"]);
|
8739 | return (React__namespace.createElement("div", Object.assign({ className: css('pf-c-code-block__actions-item', className) }, props), children));
|
8740 | };
|
8741 | CodeBlockAction.displayName = 'CodeBlockAction';
|
8742 |
|
8743 | Promise.resolve().then(function () { return contextSelector; });
|
8744 | var styles$Q = {
|
8745 | "contextSelector": "pf-c-context-selector",
|
8746 | "contextSelectorMenu": "pf-c-context-selector__menu",
|
8747 | "contextSelectorMenuFooter": "pf-c-context-selector__menu-footer",
|
8748 | "contextSelectorMenuList": "pf-c-context-selector__menu-list",
|
8749 | "contextSelectorMenuListItem": "pf-c-context-selector__menu-list-item",
|
8750 | "contextSelectorMenuSearch": "pf-c-context-selector__menu-search",
|
8751 | "contextSelectorToggle": "pf-c-context-selector__toggle",
|
8752 | "contextSelectorToggleIcon": "pf-c-context-selector__toggle-icon",
|
8753 | "contextSelectorToggleText": "pf-c-context-selector__toggle-text",
|
8754 | "modifiers": {
|
8755 | "fullHeight": "pf-m-full-height",
|
8756 | "large": "pf-m-large",
|
8757 | "pageInsets": "pf-m-page-insets",
|
8758 | "active": "pf-m-active",
|
8759 | "expanded": "pf-m-expanded",
|
8760 | "plain": "pf-m-plain",
|
8761 | "text": "pf-m-text",
|
8762 | "disabled": "pf-m-disabled"
|
8763 | }
|
8764 | };
|
8765 |
|
8766 | const SearchIconConfig = {
|
8767 | name: 'SearchIcon',
|
8768 | height: 512,
|
8769 | width: 512,
|
8770 | svgPath: 'M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z',
|
8771 | yOffset: 0,
|
8772 | xOffset: 0,
|
8773 | };
|
8774 |
|
8775 | const SearchIcon = createIcon(SearchIconConfig);
|
8776 |
|
8777 | var SearchIcon$1 = SearchIcon;
|
8778 |
|
8779 | class ContextSelectorToggle extends React__namespace.Component {
|
8780 | constructor() {
|
8781 | super(...arguments);
|
8782 | this.toggle = React__namespace.createRef();
|
8783 | this.componentDidMount = () => {
|
8784 | document.addEventListener('mousedown', this.onDocClick);
|
8785 | document.addEventListener('touchstart', this.onDocClick);
|
8786 | document.addEventListener('keydown', this.onEscPress);
|
8787 | };
|
8788 | this.componentWillUnmount = () => {
|
8789 | document.removeEventListener('mousedown', this.onDocClick);
|
8790 | document.removeEventListener('touchstart', this.onDocClick);
|
8791 | document.removeEventListener('keydown', this.onEscPress);
|
8792 | };
|
8793 | this.onDocClick = (event) => {
|
8794 | const { isOpen, parentRef, onToggle } = this.props;
|
8795 | if (isOpen && (parentRef === null || parentRef === void 0 ? void 0 : parentRef.current) && !parentRef.current.contains(event.target)) {
|
8796 | onToggle(null, false);
|
8797 | this.toggle.current.focus();
|
8798 | }
|
8799 | };
|
8800 | this.onEscPress = (event) => {
|
8801 | const { isOpen, onToggle } = this.props;
|
8802 | const keyCode = event.keyCode || event.which;
|
8803 | if (isOpen && keyCode === KEY_CODES.ESCAPE_KEY) {
|
8804 | onToggle(null, false);
|
8805 | this.toggle.current.focus();
|
8806 | }
|
8807 | };
|
8808 | this.onKeyDown = (event) => {
|
8809 | const { isOpen, onToggle, onEnter } = this.props;
|
8810 | if ((event.keyCode === KEY_CODES.TAB && !isOpen) || event.key !== KEY_CODES.ENTER) {
|
8811 | return;
|
8812 | }
|
8813 | event.preventDefault();
|
8814 | if ((event.keyCode === KEY_CODES.TAB || event.keyCode === KEY_CODES.ENTER || event.key !== KEY_CODES.SPACE) &&
|
8815 | isOpen) {
|
8816 | onToggle(null, !isOpen);
|
8817 | }
|
8818 | else if ((event.keyCode === KEY_CODES.ENTER || event.key === ' ') && !isOpen) {
|
8819 | onToggle(null, !isOpen);
|
8820 | onEnter();
|
8821 | }
|
8822 | };
|
8823 | }
|
8824 | render() {
|
8825 | const _a = this.props, { className, toggleText, isOpen, onToggle, id, isPlain, isText,
|
8826 |
|
8827 | isActive, onEnter, parentRef } = _a,
|
8828 |
|
8829 | props = __rest$1(_a, ["className", "toggleText", "isOpen", "onToggle", "id", "isPlain", "isText", "isActive", "onEnter", "parentRef"]);
|
8830 | return (React__namespace.createElement("button", Object.assign({}, props, { id: id, ref: this.toggle, className: css(styles$Q.contextSelectorToggle, isActive && styles$Q.modifiers.active, isPlain && styles$Q.modifiers.plain, isText && styles$Q.modifiers.text, className), type: "button", onClick: event => onToggle(event, !isOpen), "aria-expanded": isOpen, onKeyDown: this.onKeyDown }),
|
8831 | React__namespace.createElement("span", { className: css(styles$Q.contextSelectorToggleText) }, toggleText),
|
8832 | React__namespace.createElement("span", { className: css(styles$Q.contextSelectorToggleIcon) },
|
8833 | React__namespace.createElement(CaretDownIcon$1, { "aria-hidden": true }))));
|
8834 | }
|
8835 | }
|
8836 | ContextSelectorToggle.displayName = 'ContextSelectorToggle';
|
8837 | ContextSelectorToggle.defaultProps = {
|
8838 | className: '',
|
8839 | toggleText: '',
|
8840 | isOpen: false,
|
8841 | onEnter: () => undefined,
|
8842 | parentRef: null,
|
8843 | isActive: false,
|
8844 |
|
8845 | onToggle: (event, value) => undefined
|
8846 | };
|
8847 |
|
8848 | class ContextSelectorMenuList extends React__namespace.Component {
|
8849 | constructor() {
|
8850 | super(...arguments);
|
8851 | this.refsCollection = [];
|
8852 | this.sendRef = (index, ref) => {
|
8853 | this.refsCollection[index] = ref;
|
8854 | };
|
8855 | this.render = () => {
|
8856 |
|
8857 | const _a = this.props, { className, isOpen, children } = _a, props = __rest$1(_a, ["className", "isOpen", "children"]);
|
8858 | return (React__namespace.createElement("ul", Object.assign({ className: css(styles$Q.contextSelectorMenuList, className), hidden: !isOpen, role: "menu" }, props), this.extendChildren()));
|
8859 | };
|
8860 | }
|
8861 | extendChildren() {
|
8862 | return React__namespace.Children.map(this.props.children, (child, index) => React__namespace.cloneElement(child, {
|
8863 | sendRef: this.sendRef,
|
8864 | index
|
8865 | }));
|
8866 | }
|
8867 | }
|
8868 | ContextSelectorMenuList.displayName = 'ContextSelectorMenuList';
|
8869 | ContextSelectorMenuList.defaultProps = {
|
8870 | children: null,
|
8871 | className: '',
|
8872 | isOpen: true
|
8873 | };
|
8874 |
|
8875 | const ContextSelectorContext = React__namespace.createContext({
|
8876 |
|
8877 | onSelect: (event, value) => undefined
|
8878 | });
|
8879 |
|
8880 | Promise.resolve().then(function () { return inputGroup; });
|
8881 | var styles$P = {
|
8882 | "formControl": "pf-c-form-control",
|
8883 | "inputGroup": "pf-c-input-group",
|
8884 | "inputGroupText": "pf-c-input-group__text",
|
8885 | "modifiers": {
|
8886 | "plain": "pf-m-plain"
|
8887 | }
|
8888 | };
|
8889 |
|
8890 | class FormSelect extends React__namespace.Component {
|
8891 | constructor(props) {
|
8892 | super(props);
|
8893 | this.handleChange = (event) => {
|
8894 | this.props.onChange(event.currentTarget.value, event);
|
8895 | };
|
8896 | if (!props.id && !props['aria-label']) {
|
8897 |
|
8898 | console.error('FormSelect requires either an id or aria-label to be specified');
|
8899 | }
|
8900 | this.state = {
|
8901 | ouiaStateId: getDefaultOUIAId(FormSelect.displayName, props.validated)
|
8902 | };
|
8903 | }
|
8904 | render() {
|
8905 | const _a = this.props, { children, className, value, validated, isDisabled, isRequired, isIconSprite, ouiaId, ouiaSafe } = _a, props = __rest$1(_a, ["children", "className", "value", "validated", "isDisabled", "isRequired", "isIconSprite", "ouiaId", "ouiaSafe"]);
|
8906 |
|
8907 | const selectedOption = React__namespace.Children.toArray(children).find((option) => option.props.value === value);
|
8908 | const isSelectedPlaceholder = selectedOption && selectedOption.props.isPlaceholder;
|
8909 | return (React__namespace.createElement("select", Object.assign({}, props, { className: css(formStyles.formControl, isIconSprite && formStyles.modifiers.iconSprite, className, validated === exports.ValidatedOptions.success && formStyles.modifiers.success, validated === exports.ValidatedOptions.warning && formStyles.modifiers.warning, isSelectedPlaceholder && formStyles.modifiers.placeholder), "aria-invalid": validated === exports.ValidatedOptions.error }, getOUIAProps(FormSelect.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId, ouiaSafe), { onChange: this.handleChange, disabled: isDisabled, required: isRequired, value: value }), children));
|
8910 | }
|
8911 | }
|
8912 | FormSelect.displayName = 'FormSelect';
|
8913 | FormSelect.defaultProps = {
|
8914 | className: '',
|
8915 | value: '',
|
8916 | validated: 'default',
|
8917 | isDisabled: false,
|
8918 | isRequired: false,
|
8919 | isIconSprite: false,
|
8920 | onBlur: () => undefined,
|
8921 | onFocus: () => undefined,
|
8922 | onChange: () => undefined,
|
8923 | ouiaSafe: true
|
8924 | };
|
8925 |
|
8926 | const FormSelectOption = (_a) => {
|
8927 | var { className = '', value = '', isDisabled = false, label,
|
8928 |
|
8929 | isPlaceholder = false } = _a, props = __rest$1(_a, ["className", "value", "isDisabled", "label", "isPlaceholder"]);
|
8930 | return (React__namespace.createElement("option", Object.assign({}, props, { className: className, value: value, disabled: isDisabled }), label));
|
8931 | };
|
8932 | FormSelectOption.displayName = 'FormSelectOption';
|
8933 |
|
8934 | const FormSelectOptionGroup = (_a) => {
|
8935 | var { children = null, className = '', isDisabled = false, label } = _a, props = __rest$1(_a, ["children", "className", "isDisabled", "label"]);
|
8936 | return (React__namespace.createElement("optgroup", Object.assign({}, props, { disabled: !!isDisabled, className: className, label: label }), children));
|
8937 | };
|
8938 | FormSelectOptionGroup.displayName = 'FormSelectOptionGroup';
|
8939 |
|
8940 | const c_form_control_textarea_Height = {
|
8941 | "name": "--pf-c-form-control--textarea--Height",
|
8942 | "value": "auto",
|
8943 | "var": "var(--pf-c-form-control--textarea--Height)"
|
8944 | };
|
8945 | var heightToken = c_form_control_textarea_Height;
|
8946 |
|
8947 | exports.TextAreResizeOrientation = void 0;
|
8948 | (function (TextAreResizeOrientation) {
|
8949 | TextAreResizeOrientation["horizontal"] = "horizontal";
|
8950 | TextAreResizeOrientation["vertical"] = "vertical";
|
8951 | TextAreResizeOrientation["both"] = "both";
|
8952 | })(exports.TextAreResizeOrientation || (exports.TextAreResizeOrientation = {}));
|
8953 | class TextAreaBase extends React__namespace.Component {
|
8954 | constructor(props) {
|
8955 | super(props);
|
8956 | this.handleChange = (event) => {
|
8957 |
|
8958 | const field = event.currentTarget;
|
8959 | if (this.props.autoResize && canUseDOM) {
|
8960 | field.style.setProperty(heightToken.name, 'inherit');
|
8961 | const computed = window.getComputedStyle(field);
|
8962 |
|
8963 | const height = parseInt(computed.getPropertyValue('border-top-width')) +
|
8964 | parseInt(computed.getPropertyValue('padding-top')) +
|
8965 | field.scrollHeight +
|
8966 | parseInt(computed.getPropertyValue('padding-bottom')) +
|
8967 | parseInt(computed.getPropertyValue('border-bottom-width'));
|
8968 | field.style.setProperty(heightToken.name, `${height}px`);
|
8969 | }
|
8970 | if (this.props.onChange) {
|
8971 | this.props.onChange(field.value, event);
|
8972 | }
|
8973 | };
|
8974 | if (!props.id && !props['aria-label']) {
|
8975 |
|
8976 | console.error('TextArea: TextArea requires either an id or aria-label to be specified');
|
8977 | }
|
8978 | }
|
8979 | render() {
|
8980 | const _a = this.props, { className, value, validated, isRequired, isDisabled, isIconSprite, isReadOnly, resizeOrientation, innerRef, readOnly, disabled,
|
8981 |
|
8982 | autoResize, onChange } = _a,
|
8983 |
|
8984 | props = __rest$1(_a, ["className", "value", "validated", "isRequired", "isDisabled", "isIconSprite", "isReadOnly", "resizeOrientation", "innerRef", "readOnly", "disabled", "autoResize", "onChange"]);
|
8985 | const orientation = `resize${capitalize(resizeOrientation)}`;
|
8986 | return (React__namespace.createElement("textarea", Object.assign({ className: css(formStyles.formControl, isIconSprite && formStyles.modifiers.iconSprite, className, resizeOrientation !== exports.TextAreResizeOrientation.both && formStyles.modifiers[orientation], validated === exports.ValidatedOptions.success && formStyles.modifiers.success, validated === exports.ValidatedOptions.warning && formStyles.modifiers.warning), onChange: this.handleChange }, (typeof this.props.defaultValue !== 'string' && { value }), { "aria-invalid": validated === exports.ValidatedOptions.error, required: isRequired, disabled: isDisabled || disabled, readOnly: isReadOnly || readOnly, ref: innerRef }, props)));
|
8987 | }
|
8988 | }
|
8989 | TextAreaBase.displayName = 'TextArea';
|
8990 | TextAreaBase.defaultProps = {
|
8991 | innerRef: React__namespace.createRef(),
|
8992 | className: '',
|
8993 | isRequired: false,
|
8994 | isDisabled: false,
|
8995 | isIconSprite: false,
|
8996 | validated: 'default',
|
8997 | resizeOrientation: 'both',
|
8998 | 'aria-label': null
|
8999 | };
|
9000 | const TextArea = React__namespace.forwardRef((props, ref) => (React__namespace.createElement(TextAreaBase, Object.assign({}, props, { innerRef: ref }))));
|
9001 | TextArea.displayName = 'TextArea';
|
9002 |
|
9003 | const InputGroup = (_a) => {
|
9004 | var { className = '', children } = _a, props = __rest$1(_a, ["className", "children"]);
|
9005 | const formCtrls = [FormSelect, TextArea, TextInput].map(comp => comp.displayName);
|
9006 | const idItem = React__namespace.Children.toArray(children).find((child) => !formCtrls.includes(child.type.displayName) && child.props.id);
|
9007 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$P.inputGroup, className) }, props), idItem
|
9008 | ? React__namespace.Children.map(children, (child) => formCtrls.includes(child.type.displayName)
|
9009 | ? React__namespace.cloneElement(child, { 'aria-describedby': idItem.props.id })
|
9010 | : child)
|
9011 | : children));
|
9012 | };
|
9013 | InputGroup.displayName = 'InputGroup';
|
9014 |
|
9015 | exports.InputGroupTextVariant = void 0;
|
9016 | (function (InputGroupTextVariant) {
|
9017 | InputGroupTextVariant["default"] = "default";
|
9018 | InputGroupTextVariant["plain"] = "plain";
|
9019 | })(exports.InputGroupTextVariant || (exports.InputGroupTextVariant = {}));
|
9020 | const InputGroupText = (_a) => {
|
9021 | var { className = '', component = 'span', children, variant = exports.InputGroupTextVariant.default } = _a, props = __rest$1(_a, ["className", "component", "children", "variant"]);
|
9022 | const Component = component;
|
9023 | return (React__namespace.createElement(Component, Object.assign({ className: css(styles$P.inputGroupText, variant === exports.InputGroupTextVariant.plain && styles$P.modifiers.plain, className) }, props), children));
|
9024 | };
|
9025 | InputGroupText.displayName = 'InputGroupText';
|
9026 |
|
9027 |
|
9028 | let currentId = 0;
|
9029 | const newId = currentId++;
|
9030 | class ContextSelector extends React__namespace.Component {
|
9031 | constructor(props) {
|
9032 | super(props);
|
9033 | this.parentRef = React__namespace.createRef();
|
9034 | this.popperRef = React__namespace.createRef();
|
9035 | this.onEnterPressed = (event) => {
|
9036 | if (event.charCode === KEY_CODES.ENTER) {
|
9037 | this.props.onSearchButtonClick();
|
9038 | }
|
9039 | };
|
9040 | this.state = {
|
9041 | ouiaStateId: getDefaultOUIAId(ContextSelector.displayName)
|
9042 | };
|
9043 | }
|
9044 | render() {
|
9045 | const toggleId = `pf-context-selector-toggle-id-${newId}`;
|
9046 | const screenReaderLabelId = `pf-context-selector-label-id-${newId}`;
|
9047 | const searchButtonId = `pf-context-selector-search-button-id-${newId}`;
|
9048 | const _a = this.props, { children, className, isOpen, isFullHeight, onToggle, onSelect, screenReaderLabel, toggleText, searchButtonAriaLabel, searchInputValue, onSearchInputChange, searchInputPlaceholder, onSearchButtonClick, menuAppendTo, ouiaId, ouiaSafe, isPlain, isText, footer, disableFocusTrap } = _a, props = __rest$1(_a, ["children", "className", "isOpen", "isFullHeight", "onToggle", "onSelect", "screenReaderLabel", "toggleText", "searchButtonAriaLabel", "searchInputValue", "onSearchInputChange", "searchInputPlaceholder", "onSearchButtonClick", "menuAppendTo", "ouiaId", "ouiaSafe", "isPlain", "isText", "footer", "disableFocusTrap"]);
|
9049 | const menuContainer = (React__namespace.createElement("div", { className: css(styles$Q.contextSelectorMenu) }, isOpen && (React__namespace.createElement(FocusTrap, { active: !disableFocusTrap, focusTrapOptions: { clickOutsideDeactivates: true } },
|
9050 | React__namespace.createElement("div", { className: css(styles$Q.contextSelectorMenuSearch) },
|
9051 | React__namespace.createElement(InputGroup, null,
|
9052 | React__namespace.createElement(TextInput, { value: searchInputValue, type: "search", placeholder: searchInputPlaceholder, onChange: onSearchInputChange, onKeyPress: this.onEnterPressed, "aria-labelledby": searchButtonId }),
|
9053 | React__namespace.createElement(Button, { variant: exports.ButtonVariant.control, "aria-label": searchButtonAriaLabel, id: searchButtonId, onClick: onSearchButtonClick },
|
9054 | React__namespace.createElement(SearchIcon$1, { "aria-hidden": "true" })))),
|
9055 | React__namespace.createElement(ContextSelectorContext.Provider, { value: { onSelect } },
|
9056 | React__namespace.createElement(ContextSelectorMenuList, { isOpen: isOpen }, children)),
|
9057 | footer))));
|
9058 | const popperContainer = (React__namespace.createElement("div", Object.assign({ className: css(styles$Q.contextSelector, isOpen && styles$Q.modifiers.expanded, className), ref: this.popperRef }, props), isOpen && menuContainer));
|
9059 | const mainContainer = (React__namespace.createElement("div", Object.assign({ className: css(styles$Q.contextSelector, isOpen && styles$Q.modifiers.expanded, isFullHeight && styles$Q.modifiers.fullHeight, className), ref: this.parentRef }, getOUIAProps(ContextSelector.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId, ouiaSafe), props),
|
9060 | screenReaderLabel && (React__namespace.createElement("span", { id: screenReaderLabelId, hidden: true }, screenReaderLabel)),
|
9061 | React__namespace.createElement(ContextSelectorToggle, { onToggle: onToggle, isOpen: isOpen, toggleText: toggleText, id: toggleId, parentRef: menuAppendTo === 'inline' ? this.parentRef : this.popperRef, "aria-labelledby": `${screenReaderLabelId} ${toggleId}`, isPlain: isPlain, isText: isText }),
|
9062 | isOpen && menuAppendTo === 'inline' && menuContainer));
|
9063 | const getParentElement = () => {
|
9064 | if (this.parentRef && this.parentRef.current) {
|
9065 | return this.parentRef.current.parentElement;
|
9066 | }
|
9067 | return null;
|
9068 | };
|
9069 | return menuAppendTo === 'inline' ? (mainContainer) : (React__namespace.createElement(Popper, { trigger: mainContainer, popper: popperContainer, appendTo: menuAppendTo === 'parent' ? getParentElement() : menuAppendTo, isVisible: isOpen }));
|
9070 | }
|
9071 | }
|
9072 | ContextSelector.displayName = 'ContextSelector';
|
9073 | ContextSelector.defaultProps = {
|
9074 | children: null,
|
9075 | className: '',
|
9076 | isOpen: false,
|
9077 | onToggle: () => undefined,
|
9078 | onSelect: () => undefined,
|
9079 | screenReaderLabel: '',
|
9080 | toggleText: '',
|
9081 | searchButtonAriaLabel: 'Search menu items',
|
9082 | searchInputValue: '',
|
9083 | onSearchInputChange: () => undefined,
|
9084 | searchInputPlaceholder: 'Search',
|
9085 | onSearchButtonClick: () => undefined,
|
9086 | menuAppendTo: 'inline',
|
9087 | ouiaSafe: true,
|
9088 | disableFocusTrap: false,
|
9089 | footer: null,
|
9090 | isPlain: false,
|
9091 | isText: false
|
9092 | };
|
9093 |
|
9094 | class ContextSelectorItem extends React__namespace.Component {
|
9095 | constructor() {
|
9096 | super(...arguments);
|
9097 | this.ref = React__namespace.createRef();
|
9098 | }
|
9099 | componentDidMount() {
|
9100 |
|
9101 | this.props.sendRef(this.props.index, this.ref.current);
|
9102 | }
|
9103 | render() {
|
9104 |
|
9105 | const _a = this.props, { className, children, onClick, isDisabled, index, sendRef, href } = _a, props = __rest$1(_a, ["className", "children", "onClick", "isDisabled", "index", "sendRef", "href"]);
|
9106 | const Component = href ? 'a' : 'button';
|
9107 | const isDisabledLink = href && isDisabled;
|
9108 | return (React__namespace.createElement(ContextSelectorContext.Consumer, null, ({ onSelect }) => (React__namespace.createElement("li", { role: "none" },
|
9109 | React__namespace.createElement(Component, Object.assign({ className: css(styles$Q.contextSelectorMenuListItem, isDisabledLink && styles$Q.modifiers.disabled, className), ref: this.ref, onClick: event => {
|
9110 | if (!isDisabled) {
|
9111 | onClick(event);
|
9112 | onSelect(event, children);
|
9113 | }
|
9114 | }, disabled: isDisabled && !href, href: href }, (isDisabledLink && { 'aria-disabled': true, tabIndex: -1 }), props), children)))));
|
9115 | }
|
9116 | }
|
9117 | ContextSelectorItem.displayName = 'ContextSelectorItem';
|
9118 | ContextSelectorItem.defaultProps = {
|
9119 | children: null,
|
9120 | className: '',
|
9121 | isDisabled: false,
|
9122 | onClick: () => undefined,
|
9123 | index: undefined,
|
9124 | sendRef: () => { },
|
9125 | href: null
|
9126 | };
|
9127 |
|
9128 | const ContextSelectorFooter = (_a) => {
|
9129 | var { children = null, className = '' } = _a, props = __rest$1(_a, ["children", "className"]);
|
9130 | return (React__namespace.createElement("div", Object.assign({}, props, { className: css(styles$Q.contextSelectorMenuFooter, className) }), children));
|
9131 | };
|
9132 | ContextSelectorFooter.displayName = 'ContextSelectorFooter';
|
9133 |
|
9134 | Promise.resolve().then(function () { return dataList; });
|
9135 | var styles$O = {
|
9136 | "dataList": "pf-c-data-list",
|
9137 | "dataListAction": "pf-c-data-list__action",
|
9138 | "dataListCell": "pf-c-data-list__cell",
|
9139 | "dataListCheck": "pf-c-data-list__check",
|
9140 | "dataListExpandableContent": "pf-c-data-list__expandable-content",
|
9141 | "dataListExpandableContentBody": "pf-c-data-list__expandable-content-body",
|
9142 | "dataListItem": "pf-c-data-list__item",
|
9143 | "dataListItemAction": "pf-c-data-list__item-action",
|
9144 | "dataListItemContent": "pf-c-data-list__item-content",
|
9145 | "dataListItemControl": "pf-c-data-list__item-control",
|
9146 | "dataListItemDraggableButton": "pf-c-data-list__item-draggable-button",
|
9147 | "dataListItemDraggableIcon": "pf-c-data-list__item-draggable-icon",
|
9148 | "dataListItemRow": "pf-c-data-list__item-row",
|
9149 | "dataListText": "pf-c-data-list__text",
|
9150 | "dataListToggle": "pf-c-data-list__toggle",
|
9151 | "dataListToggleIcon": "pf-c-data-list__toggle-icon",
|
9152 | "modifiers": {
|
9153 | "hidden": "pf-m-hidden",
|
9154 | "hiddenOnSm": "pf-m-hidden-on-sm",
|
9155 | "visibleOnSm": "pf-m-visible-on-sm",
|
9156 | "hiddenOnMd": "pf-m-hidden-on-md",
|
9157 | "visibleOnMd": "pf-m-visible-on-md",
|
9158 | "hiddenOnLg": "pf-m-hidden-on-lg",
|
9159 | "visibleOnLg": "pf-m-visible-on-lg",
|
9160 | "hiddenOnXl": "pf-m-hidden-on-xl",
|
9161 | "visibleOnXl": "pf-m-visible-on-xl",
|
9162 | "hiddenOn_2xl": "pf-m-hidden-on-2xl",
|
9163 | "visibleOn_2xl": "pf-m-visible-on-2xl",
|
9164 | "icon": "pf-m-icon",
|
9165 | "alignRight": "pf-m-align-right",
|
9166 | "noFill": "pf-m-no-fill",
|
9167 | "flex_2": "pf-m-flex-2",
|
9168 | "flex_3": "pf-m-flex-3",
|
9169 | "flex_4": "pf-m-flex-4",
|
9170 | "flex_5": "pf-m-flex-5",
|
9171 | "gridNone": "pf-m-grid-none",
|
9172 | "gridSm": "pf-m-grid-sm",
|
9173 | "gridMd": "pf-m-grid-md",
|
9174 | "gridLg": "pf-m-grid-lg",
|
9175 | "gridXl": "pf-m-grid-xl",
|
9176 | "grid_2xl": "pf-m-grid-2xl",
|
9177 | "compact": "pf-m-compact",
|
9178 | "dragOver": "pf-m-drag-over",
|
9179 | "truncate": "pf-m-truncate",
|
9180 | "breakWord": "pf-m-break-word",
|
9181 | "nowrap": "pf-m-nowrap",
|
9182 | "selectable": "pf-m-selectable",
|
9183 | "selected": "pf-m-selected",
|
9184 | "ghostRow": "pf-m-ghost-row",
|
9185 | "expanded": "pf-m-expanded",
|
9186 | "disabled": "pf-m-disabled",
|
9187 | "noPadding": "pf-m-no-padding"
|
9188 | }
|
9189 | };
|
9190 |
|
9191 | Promise.resolve().then(function () { return dataListGrid; });
|
9192 | var stylesGrid = {
|
9193 | "dataList": "pf-c-data-list",
|
9194 | "dataListCell": "pf-c-data-list__cell",
|
9195 | "dataListExpandableContent": "pf-c-data-list__expandable-content",
|
9196 | "dataListItemContent": "pf-c-data-list__item-content",
|
9197 | "modifiers": {
|
9198 | "icon": "pf-m-icon",
|
9199 | "alignRight": "pf-m-align-right",
|
9200 | "noFill": "pf-m-no-fill",
|
9201 | "flex_2": "pf-m-flex-2",
|
9202 | "flex_3": "pf-m-flex-3",
|
9203 | "flex_4": "pf-m-flex-4",
|
9204 | "flex_5": "pf-m-flex-5",
|
9205 | "gridNone": "pf-m-grid-none",
|
9206 | "gridSm": "pf-m-grid-sm",
|
9207 | "gridMd": "pf-m-grid-md",
|
9208 | "gridLg": "pf-m-grid-lg",
|
9209 | "gridXl": "pf-m-grid-xl",
|
9210 | "grid_2xl": "pf-m-grid-2xl"
|
9211 | }
|
9212 | };
|
9213 |
|
9214 | const gridBreakpointClasses = {
|
9215 | none: stylesGrid.modifiers.gridNone,
|
9216 | always: 'pf-m-grid',
|
9217 | sm: stylesGrid.modifiers.gridSm,
|
9218 | md: stylesGrid.modifiers.gridMd,
|
9219 | lg: stylesGrid.modifiers.gridLg,
|
9220 | xl: stylesGrid.modifiers.gridXl,
|
9221 | '2xl': stylesGrid.modifiers.grid_2xl
|
9222 | };
|
9223 | exports.DataListWrapModifier = void 0;
|
9224 | (function (DataListWrapModifier) {
|
9225 | DataListWrapModifier["nowrap"] = "nowrap";
|
9226 | DataListWrapModifier["truncate"] = "truncate";
|
9227 | DataListWrapModifier["breakWord"] = "breakWord";
|
9228 | })(exports.DataListWrapModifier || (exports.DataListWrapModifier = {}));
|
9229 | const DataListContext = React__namespace.createContext({
|
9230 | isSelectable: false
|
9231 | });
|
9232 | const moveItem = (arr, i1, toIndex) => {
|
9233 | const fromIndex = arr.indexOf(i1);
|
9234 | if (fromIndex === toIndex) {
|
9235 | return arr;
|
9236 | }
|
9237 | const temp = arr.splice(fromIndex, 1);
|
9238 | arr.splice(toIndex, 0, temp[0]);
|
9239 | return arr;
|
9240 | };
|
9241 | class DataList extends React__namespace.Component {
|
9242 | constructor(props) {
|
9243 | super(props);
|
9244 | this.dragFinished = false;
|
9245 | this.html5DragDrop = false;
|
9246 | this.arrayCopy = React__namespace.Children.toArray(this.props.children);
|
9247 | this.ref = React__namespace.createRef();
|
9248 | this.state = {
|
9249 | tempItemOrder: [],
|
9250 | draggedItemId: null,
|
9251 | draggingToItemIndex: null,
|
9252 | dragging: false
|
9253 | };
|
9254 | this.getIndex = (id) => Array.from(this.ref.current.children).findIndex(item => item.id === id);
|
9255 | this.move = (itemOrder) => {
|
9256 | const ulNode = this.ref.current;
|
9257 | const nodes = Array.from(ulNode.children);
|
9258 | if (nodes.map(node => node.id).every((id, i) => id === itemOrder[i])) {
|
9259 | return;
|
9260 | }
|
9261 | while (ulNode.firstChild) {
|
9262 | ulNode.removeChild(ulNode.lastChild);
|
9263 | }
|
9264 | itemOrder.forEach(id => {
|
9265 | ulNode.appendChild(nodes.find(n => n.id === id));
|
9266 | });
|
9267 | };
|
9268 | this.dragStart0 = (el) => {
|
9269 | const { onDragStart } = this.props;
|
9270 | const draggedItemId = el.id;
|
9271 | el.classList.add(styles$O.modifiers.ghostRow);
|
9272 | el.setAttribute('aria-pressed', 'true');
|
9273 | this.setState({
|
9274 | draggedItemId,
|
9275 | dragging: true
|
9276 | });
|
9277 | onDragStart && onDragStart(draggedItemId);
|
9278 | };
|
9279 | this.dragStart = (evt) => {
|
9280 | evt.dataTransfer.effectAllowed = 'move';
|
9281 | evt.dataTransfer.setData('text/plain', evt.currentTarget.id);
|
9282 | this.dragStart0(evt.currentTarget);
|
9283 | };
|
9284 | this.onDragCancel = () => {
|
9285 | this.move(this.props.itemOrder);
|
9286 | Array.from(this.ref.current.children).forEach(el => {
|
9287 | el.classList.remove(styles$O.modifiers.ghostRow);
|
9288 | el.classList.remove(styles$O.modifiers.dragOver);
|
9289 | el.setAttribute('aria-pressed', 'false');
|
9290 | });
|
9291 | this.setState({
|
9292 | draggedItemId: null,
|
9293 | draggingToItemIndex: null,
|
9294 | dragging: false
|
9295 | });
|
9296 | if (this.props.onDragCancel) {
|
9297 | this.props.onDragCancel();
|
9298 | }
|
9299 | };
|
9300 | this.dragLeave = (evt) => {
|
9301 |
|
9302 | if (!this.isValidDrop(evt)) {
|
9303 | this.move(this.props.itemOrder);
|
9304 | this.setState({
|
9305 | draggingToItemIndex: null
|
9306 | });
|
9307 | }
|
9308 | };
|
9309 | this.dragEnd0 = (el) => {
|
9310 | el.classList.remove(styles$O.modifiers.ghostRow);
|
9311 | el.classList.remove(styles$O.modifiers.dragOver);
|
9312 | el.setAttribute('aria-pressed', 'false');
|
9313 | this.setState({
|
9314 | draggedItemId: null,
|
9315 | draggingToItemIndex: null,
|
9316 | dragging: false
|
9317 | });
|
9318 | };
|
9319 | this.dragEnd = (evt) => {
|
9320 | this.dragEnd0(evt.target);
|
9321 | };
|
9322 | this.isValidDrop = (evt) => {
|
9323 | const ulRect = this.ref.current.getBoundingClientRect();
|
9324 | return (evt.clientX > ulRect.x &&
|
9325 | evt.clientX < ulRect.x + ulRect.width &&
|
9326 | evt.clientY > ulRect.y &&
|
9327 | evt.clientY < ulRect.y + ulRect.height);
|
9328 | };
|
9329 | this.drop = (evt) => {
|
9330 | if (this.isValidDrop(evt)) {
|
9331 | this.props.onDragFinish(this.state.tempItemOrder);
|
9332 | }
|
9333 | else {
|
9334 | this.onDragCancel();
|
9335 | }
|
9336 | };
|
9337 | this.dragOver0 = (id) => {
|
9338 | const draggingToItemIndex = Array.from(this.ref.current.children).findIndex(item => item.id === id);
|
9339 | if (draggingToItemIndex !== this.state.draggingToItemIndex) {
|
9340 | const tempItemOrder = moveItem([...this.props.itemOrder], this.state.draggedItemId, draggingToItemIndex);
|
9341 | this.move(tempItemOrder);
|
9342 | this.setState({
|
9343 | draggingToItemIndex,
|
9344 | tempItemOrder
|
9345 | });
|
9346 | }
|
9347 | };
|
9348 | this.dragOver = (evt) => {
|
9349 | evt.preventDefault();
|
9350 | const curListItem = evt.target.closest('li');
|
9351 | if (!curListItem || !this.ref.current.contains(curListItem) || curListItem.id === this.state.draggedItemId) {
|
9352 |
|
9353 | return null;
|
9354 | }
|
9355 | else {
|
9356 | this.dragOver0(curListItem.id);
|
9357 | }
|
9358 | };
|
9359 | this.handleDragButtonKeys = (evt) => {
|
9360 | const { dragging } = this.state;
|
9361 | if (![' ', 'Escape', 'Enter', 'ArrowUp', 'ArrowDown'].includes(evt.key) || !this.html5DragDrop) {
|
9362 | if (dragging) {
|
9363 | evt.preventDefault();
|
9364 | }
|
9365 | return;
|
9366 | }
|
9367 | evt.preventDefault();
|
9368 | const dragItem = evt.target.closest('li');
|
9369 | if (evt.key === ' ' || (evt.key === 'Enter' && !dragging)) {
|
9370 | this.dragStart0(dragItem);
|
9371 | }
|
9372 | else if (dragging) {
|
9373 | if (evt.key === 'Escape' || evt.key === 'Enter') {
|
9374 | this.setState({
|
9375 | dragging: false
|
9376 | });
|
9377 | this.dragFinished = true;
|
9378 | if (evt.key === 'Enter') {
|
9379 | this.dragEnd0(dragItem);
|
9380 | this.props.onDragFinish(this.state.tempItemOrder);
|
9381 | }
|
9382 | else {
|
9383 | this.onDragCancel();
|
9384 | }
|
9385 | }
|
9386 | else if (evt.key === 'ArrowUp') {
|
9387 | const nextSelection = dragItem.previousSibling;
|
9388 | if (nextSelection) {
|
9389 | this.dragOver0(nextSelection.id);
|
9390 | dragItem.querySelector(`.${styles$O.dataListItemDraggableButton}`).focus();
|
9391 | }
|
9392 | }
|
9393 | else if (evt.key === 'ArrowDown') {
|
9394 | const nextSelection = dragItem.nextSibling;
|
9395 | if (nextSelection) {
|
9396 | this.dragOver0(nextSelection.id);
|
9397 | dragItem.querySelector(`.${styles$O.dataListItemDraggableButton}`).focus();
|
9398 | }
|
9399 | }
|
9400 | }
|
9401 | };
|
9402 | this.html5DragDrop = Boolean(props.onDragFinish || props.onDragStart || props.onDragMove || props.onDragCancel);
|
9403 | if (this.html5DragDrop) {
|
9404 |
|
9405 | console.warn("DataList's onDrag API is deprecated. Use DragDrop instead.");
|
9406 | }
|
9407 | }
|
9408 | componentDidUpdate(oldProps) {
|
9409 | if (this.dragFinished) {
|
9410 | this.dragFinished = false;
|
9411 | this.setState({
|
9412 | tempItemOrder: [...this.props.itemOrder],
|
9413 | draggedItemId: null,
|
9414 | dragging: false
|
9415 | });
|
9416 | }
|
9417 | if (oldProps.itemOrder !== this.props.itemOrder) {
|
9418 | this.move(this.props.itemOrder);
|
9419 | }
|
9420 | }
|
9421 | render() {
|
9422 | const _a = this.props, { className, children, onSelectDataListItem, selectedDataListItemId, isCompact, wrapModifier,
|
9423 |
|
9424 | onDragStart, onDragMove, onDragCancel, onDragFinish, gridBreakpoint, itemOrder } = _a,
|
9425 |
|
9426 | props = __rest$1(_a, ["className", "children", "onSelectDataListItem", "selectedDataListItemId", "isCompact", "wrapModifier", "onDragStart", "onDragMove", "onDragCancel", "onDragFinish", "gridBreakpoint", "itemOrder"]);
|
9427 | const { dragging } = this.state;
|
9428 | const isSelectable = onSelectDataListItem !== undefined;
|
9429 | const updateSelectedDataListItem = (id) => {
|
9430 | onSelectDataListItem(id);
|
9431 | };
|
9432 | const dragProps = this.html5DragDrop && {
|
9433 | onDragOver: this.dragOver,
|
9434 | onDrop: this.dragOver,
|
9435 | onDragLeave: this.dragLeave
|
9436 | };
|
9437 | return (React__namespace.createElement(DataListContext.Provider, { value: {
|
9438 | isSelectable,
|
9439 | selectedDataListItemId,
|
9440 | updateSelectedDataListItem,
|
9441 | isDraggable: this.html5DragDrop,
|
9442 | dragStart: this.dragStart,
|
9443 | dragEnd: this.dragEnd,
|
9444 | drop: this.drop,
|
9445 | dragKeyHandler: this.handleDragButtonKeys
|
9446 | } },
|
9447 | React__namespace.createElement("ul", Object.assign({ className: css(styles$O.dataList, isCompact && styles$O.modifiers.compact, gridBreakpointClasses[gridBreakpoint], wrapModifier && styles$O.modifiers[wrapModifier], dragging && styles$O.modifiers.dragOver, className), style: props.style }, props, dragProps, { ref: this.ref }), children)));
|
9448 | }
|
9449 | }
|
9450 | DataList.displayName = 'DataList';
|
9451 | DataList.defaultProps = {
|
9452 | children: null,
|
9453 | className: '',
|
9454 | selectedDataListItemId: '',
|
9455 | isCompact: false,
|
9456 | gridBreakpoint: 'md',
|
9457 | wrapModifier: null
|
9458 | };
|
9459 |
|
9460 | const DataListAction = (_a) => {
|
9461 | var { children, className, visibility,
|
9462 |
|
9463 | id, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, isPlainButtonAction } = _a,
|
9464 |
|
9465 | props = __rest$1(_a, ["children", "className", "visibility", "id", 'aria-label', 'aria-labelledby', "isPlainButtonAction"]);
|
9466 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$O.dataListItemAction, formatBreakpointMods(visibility, styles$O), className) }, props), isPlainButtonAction ? React__namespace.createElement("div", { className: css(styles$O.dataListAction) }, children) : children));
|
9467 | };
|
9468 | DataListAction.displayName = 'DataListAction';
|
9469 |
|
9470 | const DataListCell = (_a) => {
|
9471 | var { children = null, className = '', width = 1, isFilled = true, alignRight = false, isIcon = false, wrapModifier = null } = _a, props = __rest$1(_a, ["children", "className", "width", "isFilled", "alignRight", "isIcon", "wrapModifier"]);
|
9472 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$O.dataListCell, width > 1 && styles$O.modifiers[`flex_${width}`], !isFilled && styles$O.modifiers.noFill, alignRight && styles$O.modifiers.alignRight, isIcon && styles$O.modifiers.icon, className, wrapModifier && styles$O.modifiers[wrapModifier]) }, props), children));
|
9473 | };
|
9474 | DataListCell.displayName = 'DataListCell';
|
9475 |
|
9476 | const DataListCheck = (_a) => {
|
9477 | var { className = '',
|
9478 |
|
9479 | onChange = (checked, event) => { }, isValid = true, isDisabled = false, isChecked = null, checked = null, defaultChecked, otherControls = false } = _a, props = __rest$1(_a, ["className", "onChange", "isValid", "isDisabled", "isChecked", "checked", "defaultChecked", "otherControls"]);
|
9480 | const check = (React__namespace.createElement("div", { className: css(styles$O.dataListCheck) },
|
9481 | React__namespace.createElement("input", Object.assign({}, props, { type: "checkbox", onChange: event => onChange(event.currentTarget.checked, event), "aria-invalid": !isValid, disabled: isDisabled }, ([true, false].includes(defaultChecked) && { defaultChecked }), (![true, false].includes(defaultChecked) && { checked: isChecked || checked })))));
|
9482 | return (React__namespace.createElement(React__namespace.Fragment, null,
|
9483 | !otherControls && React__namespace.createElement("div", { className: css(styles$O.dataListItemControl, className) }, check),
|
9484 | otherControls && check));
|
9485 | };
|
9486 | DataListCheck.displayName = 'DataListCheck';
|
9487 |
|
9488 | const DataListControl = (_a) => {
|
9489 | var { children, className = '' } = _a, props = __rest$1(_a, ["children", "className"]);
|
9490 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$O.dataListItemControl, className) }, props), children));
|
9491 | };
|
9492 | DataListControl.displayName = 'DataListControl';
|
9493 |
|
9494 | const GripVerticalIconConfig = {
|
9495 | name: 'GripVerticalIcon',
|
9496 | height: 512,
|
9497 | width: 320,
|
9498 | svgPath: 'M96 32H32C14.33 32 0 46.33 0 64v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32V64c0-17.67-14.33-32-32-32zm0 160H32c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zm0 160H32c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zM288 32h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32V64c0-17.67-14.33-32-32-32zm0 160h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zm0 160h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32z',
|
9499 | yOffset: 0,
|
9500 | xOffset: 0,
|
9501 | };
|
9502 |
|
9503 | const GripVerticalIcon = createIcon(GripVerticalIconConfig);
|
9504 |
|
9505 | var GripVerticalIcon$1 = GripVerticalIcon;
|
9506 |
|
9507 | const DataListDragButton = (_a) => {
|
9508 | var { className = '', isDisabled = false } = _a, props = __rest$1(_a, ["className", "isDisabled"]);
|
9509 | return (React__namespace.createElement(DataListContext.Consumer, null, ({ dragKeyHandler }) => (React__namespace.createElement("button", Object.assign({ className: css(styles$O.dataListItemDraggableButton, isDisabled && styles$O.modifiers.disabled, className), onKeyDown: dragKeyHandler, type: "button", disabled: isDisabled }, props),
|
9510 | React__namespace.createElement("span", { className: css(styles$O.dataListItemDraggableIcon) },
|
9511 | React__namespace.createElement(GripVerticalIcon$1, null))))));
|
9512 | };
|
9513 | DataListDragButton.displayName = 'DataListDragButton';
|
9514 |
|
9515 | function findDataListDragButton(node) {
|
9516 | if (!React__namespace.isValidElement(node)) {
|
9517 | return null;
|
9518 | }
|
9519 | if (node.type === DataListDragButton) {
|
9520 | return node;
|
9521 | }
|
9522 | if (node.props.children) {
|
9523 | for (const child of React__namespace.Children.toArray(node.props.children)) {
|
9524 | const button = findDataListDragButton(child);
|
9525 | if (button) {
|
9526 | return button;
|
9527 | }
|
9528 | }
|
9529 | }
|
9530 | return null;
|
9531 | }
|
9532 | class DataListItem extends React__namespace.Component {
|
9533 | render() {
|
9534 | const _a = this.props, { children, isExpanded, className, id, 'aria-labelledby': ariaLabelledBy } = _a, props = __rest$1(_a, ["children", "isExpanded", "className", "id", 'aria-labelledby']);
|
9535 | return (React__namespace.createElement(DataListContext.Consumer, null, ({ isSelectable, selectedDataListItemId, updateSelectedDataListItem, isDraggable, dragStart, dragEnd, drop }) => {
|
9536 | const selectDataListItem = (event) => {
|
9537 | let target = event.target;
|
9538 | while (event.currentTarget !== target) {
|
9539 | if (('onclick' in target && target.onclick) ||
|
9540 | target.parentNode.classList.contains(styles$O.dataListItemAction) ||
|
9541 | target.parentNode.classList.contains(styles$O.dataListItemControl)) {
|
9542 |
|
9543 | return;
|
9544 | }
|
9545 | else {
|
9546 | target = target.parentNode;
|
9547 | }
|
9548 | }
|
9549 | updateSelectedDataListItem(id);
|
9550 | };
|
9551 | const onKeyDown = (event) => {
|
9552 | if (event.key === KeyTypes.Enter) {
|
9553 | updateSelectedDataListItem(id);
|
9554 | }
|
9555 | };
|
9556 |
|
9557 |
|
9558 |
|
9559 | const dragButton = findDataListDragButton(children);
|
9560 | const dragProps = isDraggable && {
|
9561 | draggable: dragButton ? !dragButton.props.isDisabled : true,
|
9562 | onDrop: drop,
|
9563 | onDragEnd: dragEnd,
|
9564 | onDragStart: dragStart
|
9565 | };
|
9566 | return (React__namespace.createElement("li", Object.assign({ id: id, className: css(styles$O.dataListItem, isExpanded && styles$O.modifiers.expanded, isSelectable && styles$O.modifiers.selectable, selectedDataListItemId && selectedDataListItemId === id && styles$O.modifiers.selected, className), "aria-labelledby": ariaLabelledBy }, (isSelectable && { tabIndex: 0, onClick: selectDataListItem, onKeyDown }), (isSelectable && selectedDataListItemId === id && { 'aria-selected': true }), props, dragProps), React__namespace.Children.map(children, child => React__namespace.isValidElement(child) &&
|
9567 | React__namespace.cloneElement(child, {
|
9568 | rowid: ariaLabelledBy
|
9569 | }))));
|
9570 | }));
|
9571 | }
|
9572 | }
|
9573 | DataListItem.displayName = 'DataListItem';
|
9574 | DataListItem.defaultProps = {
|
9575 | isExpanded: false,
|
9576 | className: '',
|
9577 | id: '',
|
9578 | children: null,
|
9579 | 'aria-labelledby': ''
|
9580 | };
|
9581 |
|
9582 | const DataListItemCells = (_a) => {
|
9583 | var { className = '', dataListCells,
|
9584 |
|
9585 | rowid = '' } = _a, props = __rest$1(_a, ["className", "dataListCells", "rowid"]);
|
9586 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$O.dataListItemContent, className) }, props), dataListCells));
|
9587 | };
|
9588 | DataListItemCells.displayName = 'DataListItemCells';
|
9589 |
|
9590 | const DataListItemRow = (_a) => {
|
9591 | var { children, className = '', rowid = '', wrapModifier = null } = _a, props = __rest$1(_a, ["children", "className", "rowid", "wrapModifier"]);
|
9592 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$O.dataListItemRow, className, wrapModifier && styles$O.modifiers[wrapModifier]) }, props), React__namespace.Children.map(children, child => React__namespace.isValidElement(child) &&
|
9593 | React__namespace.cloneElement(child, {
|
9594 | rowid
|
9595 | }))));
|
9596 | };
|
9597 | DataListItemRow.displayName = 'DataListItemRow';
|
9598 |
|
9599 | const DataListToggle = (_a) => {
|
9600 | var { className = '', isExpanded = false, 'aria-controls': ariaControls = '', 'aria-label': ariaLabel = 'Details', rowid = '', id } = _a, props = __rest$1(_a, ["className", "isExpanded", 'aria-controls', 'aria-label', "rowid", "id"]);
|
9601 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$O.dataListItemControl, className) }, props),
|
9602 | React__namespace.createElement("div", { className: css(styles$O.dataListToggle) },
|
9603 | React__namespace.createElement(Button, { id: id, variant: exports.ButtonVariant.plain, "aria-controls": ariaControls !== '' && ariaControls, "aria-label": ariaLabel, "aria-labelledby": ariaLabel !== 'Details' ? null : `${rowid} ${id}`, "aria-expanded": isExpanded },
|
9604 | React__namespace.createElement("div", { className: css(styles$O.dataListToggleIcon) },
|
9605 | React__namespace.createElement(AngleRightIcon$1, null))))));
|
9606 | };
|
9607 | DataListToggle.displayName = 'DataListToggle';
|
9608 |
|
9609 | const DataListContent = (_a) => {
|
9610 | var { className = '', children = null, id = '', isHidden = false, 'aria-label': ariaLabel, hasNoPadding = false,
|
9611 |
|
9612 | rowid = '' } = _a, props = __rest$1(_a, ["className", "children", "id", "isHidden", 'aria-label', "hasNoPadding", "rowid"]);
|
9613 | return (React__namespace.createElement("section", Object.assign({ id: id, className: css(styles$O.dataListExpandableContent, className), hidden: isHidden, "aria-label": ariaLabel }, props),
|
9614 | React__namespace.createElement("div", { className: css(styles$O.dataListExpandableContentBody, hasNoPadding && styles$O.modifiers.noPadding) }, children)));
|
9615 | };
|
9616 | DataListContent.displayName = 'DataListContent';
|
9617 |
|
9618 | const DataListText = (_a) => {
|
9619 | var { children = null, className = '', component = 'span', wrapModifier = null, tooltip: tooltipProp = '', onMouseEnter: onMouseEnterProp = () => { } } = _a, props = __rest$1(_a, ["children", "className", "component", "wrapModifier", "tooltip", "onMouseEnter"]);
|
9620 | const Component = component;
|
9621 | const [tooltip, setTooltip] = React__namespace.useState('');
|
9622 | const onMouseEnter = (event) => {
|
9623 | if (event.target.offsetWidth < event.target.scrollWidth) {
|
9624 | setTooltip(tooltipProp || event.target.innerHTML);
|
9625 | }
|
9626 | else {
|
9627 | setTooltip('');
|
9628 | }
|
9629 | onMouseEnterProp(event);
|
9630 | };
|
9631 | const text = (React__namespace.createElement(Component, Object.assign({ onMouseEnter: onMouseEnter, className: css(className, wrapModifier && styles$O.modifiers[wrapModifier], styles$O.dataListText) }, props), children));
|
9632 | return tooltip !== '' ? (React__namespace.createElement(Tooltip, { content: tooltip, isVisible: true }, text)) : (text);
|
9633 | };
|
9634 | DataListText.displayName = 'DataListText';
|
9635 |
|
9636 | Promise.resolve().then(function () { return datePicker; });
|
9637 | var datePickerStyles = {
|
9638 | "datePicker": "pf-c-date-picker",
|
9639 | "datePickerCalendar": "pf-c-date-picker__calendar",
|
9640 | "datePickerHelperText": "pf-c-date-picker__helper-text",
|
9641 | "datePickerInput": "pf-c-date-picker__input",
|
9642 | "formControl": "pf-c-form-control",
|
9643 | "modifiers": {
|
9644 | "error": "pf-m-error",
|
9645 | "alignRight": "pf-m-align-right",
|
9646 | "top": "pf-m-top"
|
9647 | }
|
9648 | };
|
9649 |
|
9650 | const OutlinedCalendarAltIconConfig = {
|
9651 | name: 'OutlinedCalendarAltIcon',
|
9652 | height: 512,
|
9653 | width: 448,
|
9654 | svgPath: 'M148 288h-40c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12zm108-12v-40c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12zm96 0v-40c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12zm-96 96v-40c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12zm-96 0v-40c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12zm192 0v-40c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12zm96-260v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V112c0-26.5 21.5-48 48-48h48V12c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v52h128V12c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v52h48c26.5 0 48 21.5 48 48zm-48 346V160H48v298c0 3.3 2.7 6 6 6h340c3.3 0 6-2.7 6-6z',
|
9655 | yOffset: 0,
|
9656 | xOffset: 0,
|
9657 | };
|
9658 |
|
9659 | const OutlinedCalendarAltIcon = createIcon(OutlinedCalendarAltIconConfig);
|
9660 |
|
9661 | var OutlinedCalendarAltIcon$1 = OutlinedCalendarAltIcon;
|
9662 |
|
9663 | const yyyyMMddFormat = (date) => `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date
|
9664 | .getDate()
|
9665 | .toString()
|
9666 | .padStart(2, '0')}`;
|
9667 | const DatePickerBase = (_a, ref) => {
|
9668 | var { className, locale = undefined, dateFormat = yyyyMMddFormat, dateParse = (val) => val.split('-').length === 3 && new Date(`${val}T00:00:00`), isDisabled = false, placeholder = 'YYYY-MM-DD', value: valueProp = '', 'aria-label': ariaLabel = 'Date picker', buttonAriaLabel = 'Toggle date picker', onChange = () => undefined, onBlur = () => undefined, invalidFormatText = 'Invalid date', helperText, appendTo, popoverProps, monthFormat, weekdayFormat, longWeekdayFormat, dayFormat, weekStart, validators = [], rangeStart, style: styleProps = {}, inputProps = {} } = _a, props = __rest$1(_a, ["className", "locale", "dateFormat", "dateParse", "isDisabled", "placeholder", "value", 'aria-label', "buttonAriaLabel", "onChange", "onBlur", "invalidFormatText", "helperText", "appendTo", "popoverProps", "monthFormat", "weekdayFormat", "longWeekdayFormat", "dayFormat", "weekStart", "validators", "rangeStart", "style", "inputProps"]);
|
9669 | const [value, setValue] = React__namespace.useState(valueProp);
|
9670 | const [valueDate, setValueDate] = React__namespace.useState(dateParse(value));
|
9671 | const [errorText, setErrorText] = React__namespace.useState('');
|
9672 | const [popoverOpen, setPopoverOpen] = React__namespace.useState(false);
|
9673 | const [selectOpen, setSelectOpen] = React__namespace.useState(false);
|
9674 | const [pristine, setPristine] = React__namespace.useState(true);
|
9675 | const widthChars = React__namespace.useMemo(() => Math.max(dateFormat(new Date()).length, placeholder.length), [dateFormat]);
|
9676 | const style = Object.assign({ '--pf-c-date-picker__input--c-form-control--width-chars': widthChars }, styleProps);
|
9677 | const buttonRef = React__namespace.useRef();
|
9678 | React__namespace.useEffect(() => {
|
9679 | setValue(valueProp);
|
9680 | setValueDate(dateParse(valueProp));
|
9681 | }, [valueProp]);
|
9682 | React__namespace.useEffect(() => {
|
9683 | setPristine(!value);
|
9684 | }, [value]);
|
9685 | const setError = (date) => setErrorText(validators.map(validator => validator(date)).join('\n') || '');
|
9686 | const onTextInput = (value) => {
|
9687 | setValue(value);
|
9688 | setErrorText('');
|
9689 | const newValueDate = dateParse(value);
|
9690 | setValueDate(newValueDate);
|
9691 | if (isValidDate(newValueDate)) {
|
9692 | onChange(value, new Date(newValueDate));
|
9693 | }
|
9694 | else {
|
9695 | onChange(value);
|
9696 | }
|
9697 | };
|
9698 | const onInputBlur = () => {
|
9699 | if (pristine) {
|
9700 | return;
|
9701 | }
|
9702 | const newValueDate = dateParse(value);
|
9703 | if (isValidDate(newValueDate)) {
|
9704 | onBlur(value, new Date(newValueDate));
|
9705 | setError(newValueDate);
|
9706 | }
|
9707 | else {
|
9708 | onBlur(value);
|
9709 | setErrorText(invalidFormatText);
|
9710 | }
|
9711 | };
|
9712 | const onDateClick = (newValueDate) => {
|
9713 | const newValue = dateFormat(newValueDate);
|
9714 | setValue(newValue);
|
9715 | setValueDate(newValueDate);
|
9716 | setError(newValueDate);
|
9717 | setPopoverOpen(false);
|
9718 | onChange(newValue, new Date(newValueDate));
|
9719 | };
|
9720 | const onKeyPress = (ev) => {
|
9721 | if (ev.key === 'Enter' && value) {
|
9722 | if (isValidDate(valueDate)) {
|
9723 | setError(valueDate);
|
9724 | }
|
9725 | else {
|
9726 | setErrorText(invalidFormatText);
|
9727 | }
|
9728 | }
|
9729 | };
|
9730 | React.useImperativeHandle(ref, () => ({
|
9731 | setCalendarOpen: (isOpen) => setPopoverOpen(isOpen),
|
9732 | toggleCalendar: () => setPopoverOpen(prev => !prev)
|
9733 | }), [setPopoverOpen]);
|
9734 | return (React__namespace.createElement("div", Object.assign({ className: css(datePickerStyles.datePicker, className), style: style }, props),
|
9735 | React__namespace.createElement(Popover, Object.assign({ position: "bottom", bodyContent: React__namespace.createElement(CalendarMonth, { date: valueDate, onChange: onDateClick, locale: locale,
|
9736 |
|
9737 | validators: validators.map(validator => (date) => !validator(date)), onSelectToggle: open => setSelectOpen(open), monthFormat: monthFormat, weekdayFormat: weekdayFormat, longWeekdayFormat: longWeekdayFormat, dayFormat: dayFormat, weekStart: weekStart, rangeStart: rangeStart }), showClose: false, isVisible: popoverOpen, shouldClose: (_1, _2, event) => {
|
9738 | event = event;
|
9739 |
|
9740 | if (event.keyCode && event.keyCode === 27 && selectOpen) {
|
9741 | return false;
|
9742 | }
|
9743 |
|
9744 | if (buttonRef.current && buttonRef.current.contains(event.target)) {
|
9745 | return false;
|
9746 | }
|
9747 | setPopoverOpen(false);
|
9748 | return true;
|
9749 | }, withFocusTrap: true, hasNoPadding: true, hasAutoWidth: true, appendTo: appendTo }, popoverProps),
|
9750 | React__namespace.createElement("div", { className: datePickerStyles.datePickerInput },
|
9751 | React__namespace.createElement(InputGroup, null,
|
9752 | React__namespace.createElement(TextInput, Object.assign({ isDisabled: isDisabled, "aria-label": ariaLabel, placeholder: placeholder, validated: errorText ? 'error' : 'default', value: value, onChange: onTextInput, onBlur: onInputBlur, onKeyPress: onKeyPress }, inputProps)),
|
9753 | React__namespace.createElement("button", { ref: buttonRef, className: css(buttonStyles.button, buttonStyles.modifiers.control), "aria-label": buttonAriaLabel, type: "button", onClick: () => setPopoverOpen(!popoverOpen), disabled: isDisabled },
|
9754 | React__namespace.createElement(OutlinedCalendarAltIcon$1, null))))),
|
9755 | helperText && React__namespace.createElement("div", { className: datePickerStyles.datePickerHelperText }, helperText),
|
9756 | errorText.trim() && React__namespace.createElement("div", { className: css(datePickerStyles.datePickerHelperText, datePickerStyles.modifiers.error) }, errorText)));
|
9757 | };
|
9758 | const DatePicker = React__namespace.forwardRef(DatePickerBase);
|
9759 | DatePicker.displayName = 'DatePicker';
|
9760 |
|
9761 | Promise.resolve().then(function () { return descriptionList; });
|
9762 | var styles$N = {
|
9763 | "descriptionList": "pf-c-description-list",
|
9764 | "descriptionListDescription": "pf-c-description-list__description",
|
9765 | "descriptionListGroup": "pf-c-description-list__group",
|
9766 | "descriptionListTerm": "pf-c-description-list__term",
|
9767 | "descriptionListTermIcon": "pf-c-description-list__term-icon",
|
9768 | "descriptionListText": "pf-c-description-list__text",
|
9769 | "modifiers": {
|
9770 | "inlineGrid": "pf-m-inline-grid",
|
9771 | "autoColumnWidths": "pf-m-auto-column-widths",
|
9772 | "autoFit": "pf-m-auto-fit",
|
9773 | "compact": "pf-m-compact",
|
9774 | "fluid": "pf-m-fluid",
|
9775 | "fillColumns": "pf-m-fill-columns",
|
9776 | "helpText": "pf-m-help-text",
|
9777 | "1Col": "pf-m-1-col",
|
9778 | "2Col": "pf-m-2-col",
|
9779 | "3Col": "pf-m-3-col",
|
9780 | "horizontal": "pf-m-horizontal",
|
9781 | "vertical": "pf-m-vertical",
|
9782 | "1ColOnSm": "pf-m-1-col-on-sm",
|
9783 | "2ColOnSm": "pf-m-2-col-on-sm",
|
9784 | "3ColOnSm": "pf-m-3-col-on-sm",
|
9785 | "horizontalOnSm": "pf-m-horizontal-on-sm",
|
9786 | "verticalOnSm": "pf-m-vertical-on-sm",
|
9787 | "1ColOnMd": "pf-m-1-col-on-md",
|
9788 | "2ColOnMd": "pf-m-2-col-on-md",
|
9789 | "3ColOnMd": "pf-m-3-col-on-md",
|
9790 | "horizontalOnMd": "pf-m-horizontal-on-md",
|
9791 | "verticalOnMd": "pf-m-vertical-on-md",
|
9792 | "1ColOnLg": "pf-m-1-col-on-lg",
|
9793 | "2ColOnLg": "pf-m-2-col-on-lg",
|
9794 | "3ColOnLg": "pf-m-3-col-on-lg",
|
9795 | "horizontalOnLg": "pf-m-horizontal-on-lg",
|
9796 | "verticalOnLg": "pf-m-vertical-on-lg",
|
9797 | "1ColOnXl": "pf-m-1-col-on-xl",
|
9798 | "2ColOnXl": "pf-m-2-col-on-xl",
|
9799 | "3ColOnXl": "pf-m-3-col-on-xl",
|
9800 | "horizontalOnXl": "pf-m-horizontal-on-xl",
|
9801 | "verticalOnXl": "pf-m-vertical-on-xl",
|
9802 | "1ColOn_2xl": "pf-m-1-col-on-2xl",
|
9803 | "2ColOn_2xl": "pf-m-2-col-on-2xl",
|
9804 | "3ColOn_2xl": "pf-m-3-col-on-2xl",
|
9805 | "horizontalOn_2xl": "pf-m-horizontal-on-2xl",
|
9806 | "verticalOn_2xl": "pf-m-vertical-on-2xl"
|
9807 | }
|
9808 | };
|
9809 |
|
9810 | const setBreakpointModifiers = (prefix, modifiers) => {
|
9811 | const mods = modifiers;
|
9812 | return Object.keys(mods || {}).reduce((acc, curr) => curr === 'default' ? Object.assign(Object.assign({}, acc), { [prefix]: mods[curr] }) : Object.assign(Object.assign({}, acc), { [`${prefix}-on-${curr}`]: mods[curr] }), {});
|
9813 | };
|
9814 | const DescriptionList = (_a) => {
|
9815 | var { className = '', children = null, isHorizontal = false, isAutoColumnWidths, isAutoFit, isInlineGrid, isCompact, isFluid, isFillColumns, columnModifier, autoFitMinModifier, horizontalTermWidthModifier, orientation, style } = _a, props = __rest$1(_a, ["className", "children", "isHorizontal", "isAutoColumnWidths", "isAutoFit", "isInlineGrid", "isCompact", "isFluid", "isFillColumns", "columnModifier", "autoFitMinModifier", "horizontalTermWidthModifier", "orientation", "style"]);
|
9816 | if (isAutoFit && autoFitMinModifier) {
|
9817 | style = Object.assign(Object.assign({}, style), setBreakpointModifiers('--pf-c-description-list--GridTemplateColumns--min', autoFitMinModifier));
|
9818 | }
|
9819 | if (isHorizontal && horizontalTermWidthModifier) {
|
9820 | style = Object.assign(Object.assign({}, style), setBreakpointModifiers('--pf-c-description-list--m-horizontal__term--width', horizontalTermWidthModifier));
|
9821 | }
|
9822 | return (React__namespace.createElement("dl", Object.assign({ className: css(styles$N.descriptionList, (isHorizontal || isFluid) && styles$N.modifiers.horizontal, isAutoColumnWidths && styles$N.modifiers.autoColumnWidths, isAutoFit && styles$N.modifiers.autoFit, formatBreakpointMods(columnModifier, styles$N), formatBreakpointMods(orientation, styles$N), isInlineGrid && styles$N.modifiers.inlineGrid, isCompact && styles$N.modifiers.compact, isFluid && styles$N.modifiers.fluid, isFillColumns && styles$N.modifiers.fillColumns, className), style: style }, props), children));
|
9823 | };
|
9824 | DescriptionList.displayName = 'DescriptionList';
|
9825 |
|
9826 | const DescriptionListDescription = (_a) => {
|
9827 | var { children = null, className } = _a, props = __rest$1(_a, ["children", "className"]);
|
9828 | return (React__namespace.createElement("dd", Object.assign({ className: css(styles$N.descriptionListDescription, className) }, props),
|
9829 | React__namespace.createElement("div", { className: 'pf-c-description-list__text' }, children)));
|
9830 | };
|
9831 | DescriptionListDescription.displayName = 'DescriptionListDescription';
|
9832 |
|
9833 | const DescriptionListGroup = (_a) => {
|
9834 | var { className, children } = _a, props = __rest$1(_a, ["className", "children"]);
|
9835 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$N.descriptionListGroup, className) }, props), children));
|
9836 | };
|
9837 | DescriptionListGroup.displayName = 'DescriptionListGroup';
|
9838 |
|
9839 | const DescriptionListTerm = (_a) => {
|
9840 | var { children, className, icon } = _a, props = __rest$1(_a, ["children", "className", "icon"]);
|
9841 | return (React__namespace.createElement("dt", Object.assign({ className: css(styles$N.descriptionListTerm, className) }, props),
|
9842 | icon ? React__namespace.createElement("span", { className: css(styles$N.descriptionListTermIcon) }, icon) : null,
|
9843 | React__namespace.createElement("span", { className: css(styles$N.descriptionListText) }, children)));
|
9844 | };
|
9845 | DescriptionListTerm.displayName = 'DescriptionListTerm';
|
9846 |
|
9847 | const DescriptionListTermHelpText = (_a) => {
|
9848 | var { children, className } = _a, props = __rest$1(_a, ["children", "className"]);
|
9849 | return (React__namespace.createElement("dt", Object.assign({ className: css(styles$N.descriptionListTerm, className) }, props), children));
|
9850 | };
|
9851 | DescriptionListTermHelpText.displayName = 'DescriptionListTermHelpText';
|
9852 |
|
9853 | const DescriptionListTermHelpTextButton = (_a) => {
|
9854 | var { children, className } = _a, props = __rest$1(_a, ["children", "className"]);
|
9855 | return (React__namespace.createElement("span", Object.assign({ className: css(className, styles$N.descriptionListText, styles$N.modifiers.helpText), role: "button", type: "button", tabIndex: 0 }, props), children));
|
9856 | };
|
9857 | DescriptionListTermHelpTextButton.displayName = 'DescriptionListTermHelpTextButton';
|
9858 |
|
9859 | Promise.resolve().then(function () { return drawer; });
|
9860 | var styles$M = {
|
9861 | "drawer": "pf-c-drawer",
|
9862 | "drawerActions": "pf-c-drawer__actions",
|
9863 | "drawerBody": "pf-c-drawer__body",
|
9864 | "drawerClose": "pf-c-drawer__close",
|
9865 | "drawerContent": "pf-c-drawer__content",
|
9866 | "drawerHead": "pf-c-drawer__head",
|
9867 | "drawerMain": "pf-c-drawer__main",
|
9868 | "drawerPanel": "pf-c-drawer__panel",
|
9869 | "drawerPanelMain": "pf-c-drawer__panel-main",
|
9870 | "drawerSection": "pf-c-drawer__section",
|
9871 | "drawerSplitter": "pf-c-drawer__splitter",
|
9872 | "drawerSplitterHandle": "pf-c-drawer__splitter-handle",
|
9873 | "modifiers": {
|
9874 | "panelBottom": "pf-m-panel-bottom",
|
9875 | "inline": "pf-m-inline",
|
9876 | "noBorder": "pf-m-no-border",
|
9877 | "resizable": "pf-m-resizable",
|
9878 | "static": "pf-m-static",
|
9879 | "panelLeft": "pf-m-panel-left",
|
9880 | "expanded": "pf-m-expanded",
|
9881 | "resizing": "pf-m-resizing",
|
9882 | "noBackground": "pf-m-no-background",
|
9883 | "light_200": "pf-m-light-200",
|
9884 | "noPadding": "pf-m-no-padding",
|
9885 | "padding": "pf-m-padding",
|
9886 | "vertical": "pf-m-vertical",
|
9887 | "width_25": "pf-m-width-25",
|
9888 | "width_33": "pf-m-width-33",
|
9889 | "width_50": "pf-m-width-50",
|
9890 | "width_66": "pf-m-width-66",
|
9891 | "width_75": "pf-m-width-75",
|
9892 | "width_100": "pf-m-width-100",
|
9893 | "width_25OnLg": "pf-m-width-25-on-lg",
|
9894 | "width_33OnLg": "pf-m-width-33-on-lg",
|
9895 | "width_50OnLg": "pf-m-width-50-on-lg",
|
9896 | "width_66OnLg": "pf-m-width-66-on-lg",
|
9897 | "width_75OnLg": "pf-m-width-75-on-lg",
|
9898 | "width_100OnLg": "pf-m-width-100-on-lg",
|
9899 | "width_25OnXl": "pf-m-width-25-on-xl",
|
9900 | "width_33OnXl": "pf-m-width-33-on-xl",
|
9901 | "width_50OnXl": "pf-m-width-50-on-xl",
|
9902 | "width_66OnXl": "pf-m-width-66-on-xl",
|
9903 | "width_75OnXl": "pf-m-width-75-on-xl",
|
9904 | "width_100OnXl": "pf-m-width-100-on-xl",
|
9905 | "width_25On_2xl": "pf-m-width-25-on-2xl",
|
9906 | "width_33On_2xl": "pf-m-width-33-on-2xl",
|
9907 | "width_50On_2xl": "pf-m-width-50-on-2xl",
|
9908 | "width_66On_2xl": "pf-m-width-66-on-2xl",
|
9909 | "width_75On_2xl": "pf-m-width-75-on-2xl",
|
9910 | "width_100On_2xl": "pf-m-width-100-on-2xl",
|
9911 | "inlineOnLg": "pf-m-inline-on-lg",
|
9912 | "staticOnLg": "pf-m-static-on-lg",
|
9913 | "inlineOnXl": "pf-m-inline-on-xl",
|
9914 | "staticOnXl": "pf-m-static-on-xl",
|
9915 | "inlineOn_2xl": "pf-m-inline-on-2xl",
|
9916 | "staticOn_2xl": "pf-m-static-on-2xl"
|
9917 | },
|
9918 | "pageMain": "pf-c-page__main"
|
9919 | };
|
9920 |
|
9921 | exports.DrawerColorVariant = void 0;
|
9922 | (function (DrawerColorVariant) {
|
9923 | DrawerColorVariant["default"] = "default";
|
9924 | DrawerColorVariant["light200"] = "light-200";
|
9925 | })(exports.DrawerColorVariant || (exports.DrawerColorVariant = {}));
|
9926 | const DrawerContext = React__namespace.createContext({
|
9927 | isExpanded: false,
|
9928 | isStatic: false,
|
9929 | onExpand: () => { },
|
9930 | position: 'right',
|
9931 | drawerRef: null,
|
9932 | isInline: false
|
9933 | });
|
9934 | const Drawer = (_a) => {
|
9935 | var { className = '', children, isExpanded = false, isInline = false, isStatic = false, position = 'right', onExpand = () => { } } = _a, props = __rest$1(_a, ["className", "children", "isExpanded", "isInline", "isStatic", "position", "onExpand"]);
|
9936 | const drawerRef = React__namespace.useRef();
|
9937 | return (React__namespace.createElement(DrawerContext.Provider, { value: { isExpanded, isStatic, onExpand, position, drawerRef, isInline } },
|
9938 | React__namespace.createElement("div", Object.assign({ className: css(styles$M.drawer, isExpanded && styles$M.modifiers.expanded, isInline && styles$M.modifiers.inline, isStatic && styles$M.modifiers.static, position === 'left' && styles$M.modifiers.panelLeft, position === 'bottom' && styles$M.modifiers.panelBottom, className), ref: drawerRef }, props), children)));
|
9939 | };
|
9940 | Drawer.displayName = 'Drawer';
|
9941 |
|
9942 | const DrawerActions = (_a) => {
|
9943 | var {
|
9944 |
|
9945 | className = '', children } = _a, props = __rest$1(_a, ["className", "children"]);
|
9946 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$M.drawerActions, className) }, props), children));
|
9947 | };
|
9948 | DrawerActions.displayName = 'DrawerActions';
|
9949 |
|
9950 | const DrawerCloseButton = (_a) => {
|
9951 | var {
|
9952 |
|
9953 | className = '', onClose = () => undefined, 'aria-label': ariaLabel = 'Close drawer panel' } = _a, props = __rest$1(_a, ["className", "onClose", 'aria-label']);
|
9954 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$M.drawerClose, className) }, props),
|
9955 | React__namespace.createElement(Button, { variant: "plain", onClick: onClose, "aria-label": ariaLabel },
|
9956 | React__namespace.createElement(TimesIcon$1, null))));
|
9957 | };
|
9958 | DrawerCloseButton.displayName = 'DrawerCloseButton';
|
9959 |
|
9960 | const DrawerMain = (_a) => {
|
9961 | var {
|
9962 |
|
9963 | className = '', children } = _a, props = __rest$1(_a, ["className", "children"]);
|
9964 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$M.drawerMain, className) }, props), children));
|
9965 | };
|
9966 | DrawerMain.displayName = 'DrawerMain';
|
9967 |
|
9968 | const DrawerContent = (_a) => {
|
9969 | var {
|
9970 |
|
9971 | className = '', children, panelContent, colorVariant = exports.DrawerColorVariant.default } = _a, props = __rest$1(_a, ["className", "children", "panelContent", "colorVariant"]);
|
9972 | const drawerContentRef = React__namespace.useRef();
|
9973 | return (React__namespace.createElement(DrawerMain, null,
|
9974 | React__namespace.createElement("div", Object.assign({ className: css(styles$M.drawerContent, colorVariant === exports.DrawerColorVariant.light200 && styles$M.modifiers.light_200, className), ref: drawerContentRef }, props), children),
|
9975 | panelContent && React__namespace.cloneElement(panelContent, { drawerContentRef })));
|
9976 | };
|
9977 | DrawerContent.displayName = 'DrawerContent';
|
9978 |
|
9979 | const DrawerContentBody = (_a) => {
|
9980 | var {
|
9981 |
|
9982 | className = '', children, hasPadding = false } = _a, props = __rest$1(_a, ["className", "children", "hasPadding"]);
|
9983 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$M.drawerBody, hasPadding && styles$M.modifiers.padding, className) }, props), children));
|
9984 | };
|
9985 | DrawerContentBody.displayName = 'DrawerContentBody';
|
9986 |
|
9987 | const DrawerPanelBody = (_a) => {
|
9988 | var {
|
9989 |
|
9990 | className = '', children, hasNoPadding = false } = _a, props = __rest$1(_a, ["className", "children", "hasNoPadding"]);
|
9991 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$M.drawerBody, hasNoPadding && styles$M.modifiers.noPadding, className) }, props), children));
|
9992 | };
|
9993 | DrawerPanelBody.displayName = 'DrawerPanelBody';
|
9994 |
|
9995 | const DrawerHead = (_a) => {
|
9996 | var {
|
9997 |
|
9998 | className = '', children, hasNoPadding = false } = _a, props = __rest$1(_a, ["className", "children", "hasNoPadding"]);
|
9999 | return (React__namespace.createElement(DrawerPanelBody, { hasNoPadding: hasNoPadding },
|
10000 | React__namespace.createElement("div", Object.assign({ className: css(styles$M.drawerHead, className) }, props), children)));
|
10001 | };
|
10002 | DrawerHead.displayName = 'DrawerHead';
|
10003 |
|
10004 | let isResizing = null;
|
10005 | let newSize = 0;
|
10006 | const DrawerPanelContent = (_a) => {
|
10007 | var { className = '', id, children, hasNoBorder = false, isResizable = false, onResize, minSize, defaultSize, maxSize, increment = 5, resizeAriaLabel = 'Resize', widths, colorVariant = exports.DrawerColorVariant.default, drawerContentRef } = _a, props = __rest$1(_a, ["className", "id", "children", "hasNoBorder", "isResizable", "onResize", "minSize", "defaultSize", "maxSize", "increment", "resizeAriaLabel", "widths", "colorVariant", "drawerContentRef"]);
|
10008 | const panel = React__namespace.useRef();
|
10009 | const splitterRef = React__namespace.useRef();
|
10010 | const [separatorValue, setSeparatorValue] = React__namespace.useState(0);
|
10011 | const { position, isExpanded, isStatic, onExpand, drawerRef, isInline } = React__namespace.useContext(DrawerContext);
|
10012 | const hidden = isStatic ? false : !isExpanded;
|
10013 | const [isExpandedInternal, setIsExpandedInternal] = React__namespace.useState(!hidden);
|
10014 | let currWidth = 0;
|
10015 | let panelRect;
|
10016 | let right;
|
10017 | let left;
|
10018 | let bottom;
|
10019 | let setInitialVals = true;
|
10020 | React__namespace.useEffect(() => {
|
10021 | if (!isStatic && isExpanded) {
|
10022 | setIsExpandedInternal(isExpanded);
|
10023 | }
|
10024 | }, [isStatic, isExpanded]);
|
10025 | const calcValueNow = () => {
|
10026 | let splitterPos;
|
10027 | let drawerSize;
|
10028 | if (isInline && position === 'right') {
|
10029 | splitterPos = panel.current.getBoundingClientRect().right - splitterRef.current.getBoundingClientRect().left;
|
10030 | drawerSize = drawerRef.current.getBoundingClientRect().right - drawerRef.current.getBoundingClientRect().left;
|
10031 | }
|
10032 | else if (isInline && position === 'left') {
|
10033 | splitterPos = splitterRef.current.getBoundingClientRect().right - panel.current.getBoundingClientRect().left;
|
10034 | drawerSize = drawerRef.current.getBoundingClientRect().right - drawerRef.current.getBoundingClientRect().left;
|
10035 | }
|
10036 | else if (position === 'right') {
|
10037 | splitterPos =
|
10038 | drawerContentRef.current.getBoundingClientRect().right - splitterRef.current.getBoundingClientRect().left;
|
10039 | drawerSize =
|
10040 | drawerContentRef.current.getBoundingClientRect().right - drawerContentRef.current.getBoundingClientRect().left;
|
10041 | }
|
10042 | else if (position === 'left') {
|
10043 | splitterPos =
|
10044 | splitterRef.current.getBoundingClientRect().right - drawerContentRef.current.getBoundingClientRect().left;
|
10045 | drawerSize =
|
10046 | drawerContentRef.current.getBoundingClientRect().right - drawerContentRef.current.getBoundingClientRect().left;
|
10047 | }
|
10048 | else if (position === 'bottom') {
|
10049 | splitterPos =
|
10050 | drawerContentRef.current.getBoundingClientRect().bottom - splitterRef.current.getBoundingClientRect().top;
|
10051 | drawerSize =
|
10052 | drawerContentRef.current.getBoundingClientRect().bottom - drawerContentRef.current.getBoundingClientRect().top;
|
10053 | }
|
10054 | const newSplitterPos = (splitterPos / drawerSize) * 100;
|
10055 | return Math.round((newSplitterPos + Number.EPSILON) * 100) / 100;
|
10056 | };
|
10057 | const handleTouchStart = (e) => {
|
10058 | e.stopPropagation();
|
10059 | document.addEventListener('touchmove', callbackTouchMove, { passive: false });
|
10060 | document.addEventListener('touchend', callbackTouchEnd);
|
10061 | isResizing = true;
|
10062 | };
|
10063 | const handleMousedown = (e) => {
|
10064 | e.stopPropagation();
|
10065 | e.preventDefault();
|
10066 | document.addEventListener('mousemove', callbackMouseMove);
|
10067 | document.addEventListener('mouseup', callbackMouseUp);
|
10068 | drawerRef.current.classList.add(css(styles$M.modifiers.resizing));
|
10069 | isResizing = true;
|
10070 | setInitialVals = true;
|
10071 | };
|
10072 | const handleMouseMove = (e) => {
|
10073 | const mousePos = position === 'bottom' ? e.clientY : e.clientX;
|
10074 | handleControlMove(e, mousePos);
|
10075 | };
|
10076 | const handleTouchMove = (e) => {
|
10077 | e.preventDefault();
|
10078 | e.stopImmediatePropagation();
|
10079 | const touchPos = position === 'bottom' ? e.touches[0].clientY : e.touches[0].clientX;
|
10080 | handleControlMove(e, touchPos);
|
10081 | };
|
10082 | const handleControlMove = (e, controlPosition) => {
|
10083 | e.stopPropagation();
|
10084 | if (!isResizing) {
|
10085 | return;
|
10086 | }
|
10087 | if (setInitialVals) {
|
10088 | panelRect = panel.current.getBoundingClientRect();
|
10089 | right = panelRect.right;
|
10090 | left = panelRect.left;
|
10091 | bottom = panelRect.bottom;
|
10092 | setInitialVals = false;
|
10093 | }
|
10094 | const mousePos = controlPosition;
|
10095 | let newSize = 0;
|
10096 | if (position === 'right') {
|
10097 | newSize = right - mousePos;
|
10098 | }
|
10099 | else if (position === 'left') {
|
10100 | newSize = mousePos - left;
|
10101 | }
|
10102 | else {
|
10103 | newSize = bottom - mousePos;
|
10104 | }
|
10105 | if (position === 'bottom') {
|
10106 | panel.current.style.overflowAnchor = 'none';
|
10107 | }
|
10108 | panel.current.style.setProperty('--pf-c-drawer__panel--md--FlexBasis', newSize + 'px');
|
10109 | currWidth = newSize;
|
10110 | setSeparatorValue(calcValueNow());
|
10111 | };
|
10112 | const handleMouseup = () => {
|
10113 | if (!isResizing) {
|
10114 | return;
|
10115 | }
|
10116 | drawerRef.current.classList.remove(css(styles$M.modifiers.resizing));
|
10117 | isResizing = false;
|
10118 | onResize && onResize(currWidth, id);
|
10119 | setInitialVals = true;
|
10120 | document.removeEventListener('mousemove', callbackMouseMove);
|
10121 | document.removeEventListener('mouseup', callbackMouseUp);
|
10122 | };
|
10123 | const handleTouchEnd = (e) => {
|
10124 | e.stopPropagation();
|
10125 | if (!isResizing) {
|
10126 | return;
|
10127 | }
|
10128 | isResizing = false;
|
10129 | onResize && onResize(currWidth, id);
|
10130 | document.removeEventListener('touchmove', callbackTouchMove);
|
10131 | document.removeEventListener('touchend', callbackTouchEnd);
|
10132 | };
|
10133 | const callbackMouseMove = React__namespace.useCallback(handleMouseMove, []);
|
10134 | const callbackTouchEnd = React__namespace.useCallback(handleTouchEnd, []);
|
10135 | const callbackTouchMove = React__namespace.useCallback(handleTouchMove, []);
|
10136 | const callbackMouseUp = React__namespace.useCallback(handleMouseup, []);
|
10137 | const handleKeys = (e) => {
|
10138 | const key = e.key;
|
10139 | if (key !== 'Escape' &&
|
10140 | key !== 'Enter' &&
|
10141 | key !== 'ArrowUp' &&
|
10142 | key !== 'ArrowDown' &&
|
10143 | key !== 'ArrowLeft' &&
|
10144 | key !== 'ArrowRight') {
|
10145 | if (isResizing) {
|
10146 | e.preventDefault();
|
10147 | }
|
10148 | return;
|
10149 | }
|
10150 | e.preventDefault();
|
10151 | if (key === 'Escape' || key === 'Enter') {
|
10152 | onResize && onResize(currWidth, id);
|
10153 | }
|
10154 | const panelRect = panel.current.getBoundingClientRect();
|
10155 | newSize = position === 'bottom' ? panelRect.height : panelRect.width;
|
10156 | let delta = 0;
|
10157 | if (key === 'ArrowRight') {
|
10158 | delta = position === 'left' ? increment : -increment;
|
10159 | }
|
10160 | else if (key === 'ArrowLeft') {
|
10161 | delta = position === 'left' ? -increment : increment;
|
10162 | }
|
10163 | else if (key === 'ArrowUp') {
|
10164 | delta = increment;
|
10165 | }
|
10166 | else if (key === 'ArrowDown') {
|
10167 | delta = -increment;
|
10168 | }
|
10169 | newSize = newSize + delta;
|
10170 | if (position === 'bottom') {
|
10171 | panel.current.style.overflowAnchor = 'none';
|
10172 | }
|
10173 | panel.current.style.setProperty('--pf-c-drawer__panel--md--FlexBasis', newSize + 'px');
|
10174 | currWidth = newSize;
|
10175 | setSeparatorValue(calcValueNow());
|
10176 | };
|
10177 | const boundaryCssVars = {};
|
10178 | if (defaultSize) {
|
10179 | boundaryCssVars['--pf-c-drawer__panel--md--FlexBasis'] = defaultSize;
|
10180 | }
|
10181 | if (minSize) {
|
10182 | boundaryCssVars['--pf-c-drawer__panel--md--FlexBasis--min'] = minSize;
|
10183 | }
|
10184 | if (maxSize) {
|
10185 | boundaryCssVars['--pf-c-drawer__panel--md--FlexBasis--max'] = maxSize;
|
10186 | }
|
10187 | return (React__namespace.createElement(GenerateId, { prefix: "pf-drawer-panel-" }, panelId => (React__namespace.createElement("div", Object.assign({ id: id || panelId, className: css(styles$M.drawerPanel, isResizable && styles$M.modifiers.resizable, hasNoBorder && styles$M.modifiers.noBorder, formatBreakpointMods(widths, styles$M), colorVariant === exports.DrawerColorVariant.light200 && styles$M.modifiers.light_200, className), ref: panel, onTransitionEnd: ev => {
|
10188 | if (!hidden && ev.nativeEvent.propertyName === 'transform') {
|
10189 | onExpand();
|
10190 | }
|
10191 | setIsExpandedInternal(!hidden);
|
10192 | }, hidden: hidden }, ((defaultSize || minSize || maxSize) && {
|
10193 | style: boundaryCssVars
|
10194 | }), props), isExpandedInternal && (React__namespace.createElement(React__namespace.Fragment, null,
|
10195 | isResizable && (React__namespace.createElement(React__namespace.Fragment, null,
|
10196 | React__namespace.createElement("div", { className: css(styles$M.drawerSplitter, position !== 'bottom' && styles$M.modifiers.vertical), role: "separator", tabIndex: 0, "aria-orientation": position === 'bottom' ? 'horizontal' : 'vertical', "aria-label": resizeAriaLabel, "aria-valuenow": separatorValue, "aria-valuemin": 0, "aria-valuemax": 100, "aria-controls": id || panelId, onMouseDown: handleMousedown, onKeyDown: handleKeys, onTouchStart: handleTouchStart, ref: splitterRef },
|
10197 | React__namespace.createElement("div", { className: css(styles$M.drawerSplitterHandle), "aria-hidden": true })),
|
10198 | React__namespace.createElement("div", { className: css(styles$M.drawerPanelMain) }, children))),
|
10199 | !isResizable && children))))));
|
10200 | };
|
10201 | DrawerPanelContent.displayName = 'DrawerPanelContent';
|
10202 |
|
10203 | const DrawerSection = (_a) => {
|
10204 | var {
|
10205 |
|
10206 | className = '', children, colorVariant = exports.DrawerColorVariant.default } = _a, props = __rest$1(_a, ["className", "children", "colorVariant"]);
|
10207 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$M.drawerSection, colorVariant === exports.DrawerColorVariant.light200 && styles$M.modifiers.light_200, className) }, props), children));
|
10208 | };
|
10209 | DrawerSection.displayName = 'DrawerSection';
|
10210 |
|
10211 | Promise.resolve().then(function () { return dualListSelector; });
|
10212 | var styles$L = {
|
10213 | "badge": "pf-c-badge",
|
10214 | "button": "pf-c-button",
|
10215 | "dualListSelector": "pf-c-dual-list-selector",
|
10216 | "dualListSelectorControls": "pf-c-dual-list-selector__controls",
|
10217 | "dualListSelectorDraggable": "pf-c-dual-list-selector__draggable",
|
10218 | "dualListSelectorHeader": "pf-c-dual-list-selector__header",
|
10219 | "dualListSelectorItem": "pf-c-dual-list-selector__item",
|
10220 | "dualListSelectorItemCheck": "pf-c-dual-list-selector__item-check",
|
10221 | "dualListSelectorItemCount": "pf-c-dual-list-selector__item-count",
|
10222 | "dualListSelectorItemMain": "pf-c-dual-list-selector__item-main",
|
10223 | "dualListSelectorItemText": "pf-c-dual-list-selector__item-text",
|
10224 | "dualListSelectorItemToggle": "pf-c-dual-list-selector__item-toggle",
|
10225 | "dualListSelectorItemToggleIcon": "pf-c-dual-list-selector__item-toggle-icon",
|
10226 | "dualListSelectorList": "pf-c-dual-list-selector__list",
|
10227 | "dualListSelectorListItem": "pf-c-dual-list-selector__list-item",
|
10228 | "dualListSelectorListItemRow": "pf-c-dual-list-selector__list-item-row",
|
10229 | "dualListSelectorMain": "pf-c-dual-list-selector__main",
|
10230 | "dualListSelectorMenu": "pf-c-dual-list-selector__menu",
|
10231 | "dualListSelectorPane": "pf-c-dual-list-selector__pane",
|
10232 | "dualListSelectorStatus": "pf-c-dual-list-selector__status",
|
10233 | "dualListSelectorStatusText": "pf-c-dual-list-selector__status-text",
|
10234 | "dualListSelectorTitleText": "pf-c-dual-list-selector__title-text",
|
10235 | "dualListSelectorTools": "pf-c-dual-list-selector__tools",
|
10236 | "dualListSelectorToolsActions": "pf-c-dual-list-selector__tools-actions",
|
10237 | "dualListSelectorToolsFilter": "pf-c-dual-list-selector__tools-filter",
|
10238 | "modifiers": {
|
10239 | "chosen": "pf-m-chosen",
|
10240 | "dragOver": "pf-m-drag-over",
|
10241 | "expandable": "pf-m-expandable",
|
10242 | "expanded": "pf-m-expanded",
|
10243 | "disabled": "pf-m-disabled",
|
10244 | "selected": "pf-m-selected",
|
10245 | "check": "pf-m-check",
|
10246 | "ghostRow": "pf-m-ghost-row",
|
10247 | "read": "pf-m-read"
|
10248 | }
|
10249 | };
|
10250 |
|
10251 | const AngleDoubleLeftIconConfig = {
|
10252 | name: 'AngleDoubleLeftIcon',
|
10253 | height: 512,
|
10254 | width: 448,
|
10255 | svgPath: 'M223.7 239l136-136c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9L319.9 256l96.4 96.4c9.4 9.4 9.4 24.6 0 33.9L393.7 409c-9.4 9.4-24.6 9.4-33.9 0l-136-136c-9.5-9.4-9.5-24.6-.1-34zm-192 34l136 136c9.4 9.4 24.6 9.4 33.9 0l22.6-22.6c9.4-9.4 9.4-24.6 0-33.9L127.9 256l96.4-96.4c9.4-9.4 9.4-24.6 0-33.9L201.7 103c-9.4-9.4-24.6-9.4-33.9 0l-136 136c-9.5 9.4-9.5 24.6-.1 34z',
|
10256 | yOffset: 0,
|
10257 | xOffset: 0,
|
10258 | };
|
10259 |
|
10260 | const AngleDoubleLeftIcon = createIcon(AngleDoubleLeftIconConfig);
|
10261 |
|
10262 | var AngleDoubleLeftIcon$1 = AngleDoubleLeftIcon;
|
10263 |
|
10264 | const AngleLeftIconConfig = {
|
10265 | name: 'AngleLeftIcon',
|
10266 | height: 512,
|
10267 | width: 256,
|
10268 | svgPath: 'M31.7 239l136-136c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9L127.9 256l96.4 96.4c9.4 9.4 9.4 24.6 0 33.9L201.7 409c-9.4 9.4-24.6 9.4-33.9 0l-136-136c-9.5-9.4-9.5-24.6-.1-34z',
|
10269 | yOffset: 0,
|
10270 | xOffset: 0,
|
10271 | };
|
10272 |
|
10273 | const AngleLeftIcon = createIcon(AngleLeftIconConfig);
|
10274 |
|
10275 | var AngleLeftIcon$1 = AngleLeftIcon;
|
10276 |
|
10277 | const AngleDoubleRightIconConfig = {
|
10278 | name: 'AngleDoubleRightIcon',
|
10279 | height: 512,
|
10280 | width: 448,
|
10281 | svgPath: 'M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34zm192-34l-136-136c-9.4-9.4-24.6-9.4-33.9 0l-22.6 22.6c-9.4 9.4-9.4 24.6 0 33.9l96.4 96.4-96.4 96.4c-9.4 9.4-9.4 24.6 0 33.9l22.6 22.6c9.4 9.4 24.6 9.4 33.9 0l136-136c9.4-9.2 9.4-24.4 0-33.8z',
|
10282 | yOffset: 0,
|
10283 | xOffset: 0,
|
10284 | };
|
10285 |
|
10286 | const AngleDoubleRightIcon = createIcon(AngleDoubleRightIconConfig);
|
10287 |
|
10288 | var AngleDoubleRightIcon$1 = AngleDoubleRightIcon;
|
10289 |
|
10290 | function flattenTree(tree) {
|
10291 | let result = [];
|
10292 | tree.forEach(item => {
|
10293 | if (item.children) {
|
10294 | result = result.concat(flattenTree(item.children));
|
10295 | }
|
10296 | else {
|
10297 | result.push(item.id);
|
10298 | }
|
10299 | });
|
10300 | return result;
|
10301 | }
|
10302 | function flattenTreeWithFolders(tree) {
|
10303 | let result = [];
|
10304 | tree.forEach(item => {
|
10305 | result.push(item.id);
|
10306 | if (item.children) {
|
10307 | result = result.concat(flattenTreeWithFolders(item.children));
|
10308 | }
|
10309 | });
|
10310 | return result;
|
10311 | }
|
10312 | function filterFolders(tree, inputList) {
|
10313 | let result = [];
|
10314 | tree.forEach(item => {
|
10315 | if (item.children) {
|
10316 | result = result.concat(filterFolders(item.children, inputList));
|
10317 | }
|
10318 | else {
|
10319 | if (inputList.includes(item.id)) {
|
10320 | result.push(item.id);
|
10321 | }
|
10322 | }
|
10323 | });
|
10324 | return result;
|
10325 | }
|
10326 | function filterTreeItems(item, inputList) {
|
10327 | if (inputList.includes(item.id)) {
|
10328 | return true;
|
10329 | }
|
10330 | if (item.children) {
|
10331 | return ((item.children = item.children
|
10332 | .map(opt => Object.assign({}, opt))
|
10333 | .filter(child => filterTreeItems(child, inputList))).length > 0);
|
10334 | }
|
10335 | }
|
10336 | function filterTreeItemsWithoutFolders(item, inputList) {
|
10337 | if (item.children) {
|
10338 | return ((item.children = item.children
|
10339 | .map(opt => Object.assign({}, opt))
|
10340 | .filter(child => child.children ? filterTreeItemsWithoutFolders(child, inputList) : filterTreeItems(child, inputList))).length > 0);
|
10341 | }
|
10342 | if (inputList.includes(item.id)) {
|
10343 | return true;
|
10344 | }
|
10345 | }
|
10346 | function filterRestTreeItems(item, inputList) {
|
10347 | if (item.children) {
|
10348 | const child = (item.children = item.children
|
10349 | .map(opt => Object.assign({}, opt))
|
10350 | .filter(child => filterRestTreeItems(child, inputList))).length > 0;
|
10351 | return child;
|
10352 | }
|
10353 | if (!inputList.includes(item.id)) {
|
10354 | return true;
|
10355 | }
|
10356 | }
|
10357 |
|
10358 | const DualListSelectorContext = React__namespace.createContext({ isTree: false });
|
10359 | const DualListSelectorListContext = React__namespace.createContext({});
|
10360 | const DualListSelectorPaneContext = React__namespace.createContext({ isChosen: false });
|
10361 |
|
10362 | const DualListSelectorTreeItemBase = (_a) => {
|
10363 | var { onOptionCheck, children, className, id, text, defaultExpanded, hasBadge, isChecked, checkProps, badgeProps, itemData, isDisabled = false,
|
10364 |
|
10365 | useMemo } = _a, props = __rest$1(_a, ["onOptionCheck", "children", "className", "id", "text", "defaultExpanded", "hasBadge", "isChecked", "checkProps", "badgeProps", "itemData", "isDisabled", "useMemo"]);
|
10366 | const ref = React__namespace.useRef(null);
|
10367 | const [isExpanded, setIsExpanded] = React__namespace.useState(defaultExpanded || false);
|
10368 | const { setFocusedOption } = React__namespace.useContext(DualListSelectorListContext);
|
10369 | React__namespace.useEffect(() => {
|
10370 | setIsExpanded(defaultExpanded);
|
10371 | }, [defaultExpanded]);
|
10372 | return (React__namespace.createElement("li", Object.assign({ className: css(styles$L.dualListSelectorListItem, className, children && styles$L.modifiers.expandable, isExpanded && styles$L.modifiers.expanded, isDisabled && styles$L.modifiers.disabled), id: id }, props, { "aria-selected": isChecked, role: "treeitem" }, (isExpanded && { 'aria-expanded': 'true' })),
|
10373 | React__namespace.createElement("div", { className: css(styles$L.dualListSelectorListItemRow, isChecked && styles$L.modifiers.selected, styles$L.modifiers.check) },
|
10374 | React__namespace.createElement("div", { className: css(styles$L.dualListSelectorItem), ref: ref, tabIndex: -1, onClick: isDisabled
|
10375 | ? undefined
|
10376 | : evt => {
|
10377 | onOptionCheck && onOptionCheck(evt, !isChecked, itemData);
|
10378 | setFocusedOption(id);
|
10379 | } },
|
10380 | React__namespace.createElement("span", { className: css(styles$L.dualListSelectorItemMain) },
|
10381 | children && (React__namespace.createElement("div", { className: css(styles$L.dualListSelectorItemToggle), onClick: e => {
|
10382 | if (children) {
|
10383 | setIsExpanded(!isExpanded);
|
10384 | }
|
10385 | e.stopPropagation();
|
10386 | }, onKeyDown: (e) => {
|
10387 | if (e.key === ' ' || e.key === 'Enter') {
|
10388 | document.activeElement.click();
|
10389 | e.preventDefault();
|
10390 | }
|
10391 | }, tabIndex: -1 },
|
10392 | React__namespace.createElement("span", { className: css(styles$L.dualListSelectorItemToggleIcon) },
|
10393 | React__namespace.createElement(AngleRightIcon$1, { "aria-hidden": true })))),
|
10394 | React__namespace.createElement("span", { className: css(styles$L.dualListSelectorItemCheck) },
|
10395 | React__namespace.createElement("input", Object.assign({ type: "checkbox", onChange: (evt) => {
|
10396 | onOptionCheck && onOptionCheck(evt, !isChecked, itemData);
|
10397 | setFocusedOption(id);
|
10398 | }, onClick: (evt) => evt.stopPropagation(), onKeyDown: (e) => {
|
10399 | if (e.key === ' ' || e.key === 'Enter') {
|
10400 | onOptionCheck && onOptionCheck(e, !isChecked, itemData);
|
10401 | setFocusedOption(id);
|
10402 | e.preventDefault();
|
10403 | }
|
10404 | }, ref: elem => elem && (elem.indeterminate = isChecked === null), checked: isChecked || false, tabIndex: -1 }, checkProps))),
|
10405 | React__namespace.createElement("span", { className: css(styles$L.dualListSelectorItemText) }, text),
|
10406 | hasBadge && children && (React__namespace.createElement("span", { className: css(styles$L.dualListSelectorItemCount) },
|
10407 | React__namespace.createElement(Badge, Object.assign({}, badgeProps), flattenTree(children.props.data).length)))))),
|
10408 | isExpanded && children));
|
10409 | };
|
10410 | const DualListSelectorTreeItem = React__namespace.memo(DualListSelectorTreeItemBase, (prevProps, nextProps) => {
|
10411 | if (!nextProps.useMemo) {
|
10412 | return false;
|
10413 | }
|
10414 | if (prevProps.className !== nextProps.className ||
|
10415 | prevProps.text !== nextProps.text ||
|
10416 | prevProps.id !== nextProps.id ||
|
10417 | prevProps.defaultExpanded !== nextProps.defaultExpanded ||
|
10418 | prevProps.checkProps !== nextProps.checkProps ||
|
10419 | prevProps.hasBadge !== nextProps.hasBadge ||
|
10420 | prevProps.badgeProps !== nextProps.badgeProps ||
|
10421 | prevProps.isChecked !== nextProps.isChecked ||
|
10422 | prevProps.itemData !== nextProps.itemData) {
|
10423 | return false;
|
10424 | }
|
10425 | return true;
|
10426 | });
|
10427 | DualListSelectorTreeItem.displayName = 'DualListSelectorTreeItem';
|
10428 |
|
10429 | const DualListSelectorTree = (_a) => {
|
10430 | var { data, hasBadges = false, isNested = false, defaultAllExpanded = false, onOptionCheck, isDisabled = false } = _a, props = __rest$1(_a, ["data", "hasBadges", "isNested", "defaultAllExpanded", "onOptionCheck", "isDisabled"]);
|
10431 | const dataToRender = typeof data === 'function' ? data() : data;
|
10432 | const tree = dataToRender.map(item => (React__namespace.createElement(DualListSelectorTreeItem, Object.assign({ key: item.id, text: item.text, id: item.id, defaultExpanded: item.defaultExpanded !== undefined ? item.defaultExpanded : defaultAllExpanded, onOptionCheck: onOptionCheck, isChecked: item.isChecked, checkProps: item.checkProps, hasBadge: item.hasBadge !== undefined ? item.hasBadge : hasBadges, badgeProps: item.badgeProps, itemData: item, isDisabled: isDisabled, useMemo: true }, (item.children && {
|
10433 | children: (React__namespace.createElement(DualListSelectorTree, { isNested: true, data: item.children, hasBadges: hasBadges, defaultAllExpanded: defaultAllExpanded, onOptionCheck: onOptionCheck, isDisabled: isDisabled }))
|
10434 | })))));
|
10435 | return isNested ? (React__namespace.createElement("ul", Object.assign({ className: css(styles$L.dualListSelectorList), role: "group" }, props), tree)) : (React__namespace.createElement(React__namespace.Fragment, null, tree));
|
10436 | };
|
10437 | DualListSelectorTree.displayName = 'DualListSelectorTree';
|
10438 |
|
10439 | const DualListSelectorListItemBase = (_a) => {
|
10440 | var { onOptionSelect, orderIndex, children, className, id = getUniqueId('dual-list-selector-list-item'), isSelected, innerRef, isDraggable = false, isDisabled,
|
10441 |
|
10442 | draggableButtonAriaLabel = 'Reorder option' } = _a, props = __rest$1(_a, ["onOptionSelect", "orderIndex", "children", "className", "id", "isSelected", "innerRef", "isDraggable", "isDisabled", "draggableButtonAriaLabel"]);
|
10443 | const ref = innerRef || React__namespace.useRef(null);
|
10444 | const { setFocusedOption } = React__namespace.useContext(DualListSelectorListContext);
|
10445 | return (React__namespace.createElement("li", Object.assign({ className: css(styles$L.dualListSelectorListItem, className, isDisabled && styles$L.modifiers.disabled), key: orderIndex, onClick: isDisabled
|
10446 | ? undefined
|
10447 | : (e) => {
|
10448 | setFocusedOption(id);
|
10449 | onOptionSelect(e, id);
|
10450 | }, onKeyDown: (e) => {
|
10451 | if (e.key === ' ' || e.key === 'Enter') {
|
10452 | document.activeElement.click();
|
10453 | e.preventDefault();
|
10454 | }
|
10455 | }, "aria-selected": isSelected, id: id, ref: ref, role: "option", tabIndex: -1 }, props),
|
10456 | React__namespace.createElement("div", { className: css(styles$L.dualListSelectorListItemRow, isSelected && styles$L.modifiers.selected) },
|
10457 | isDraggable && !isDisabled && (React__namespace.createElement("div", { className: css(styles$L.dualListSelectorDraggable) },
|
10458 | React__namespace.createElement(Button, { variant: exports.ButtonVariant.plain, component: "span" },
|
10459 | React__namespace.createElement(GripVerticalIcon$1, { style: { verticalAlign: '-0.3em' } })))),
|
10460 | React__namespace.createElement("span", { className: css(styles$L.dualListSelectorItem) },
|
10461 | React__namespace.createElement("span", { className: css(styles$L.dualListSelectorItemMain) },
|
10462 | React__namespace.createElement("span", { className: css(styles$L.dualListSelectorItemText) }, children))))));
|
10463 | };
|
10464 | DualListSelectorListItemBase.displayName = 'DualListSelectorListItemBase';
|
10465 | const DualListSelectorListItem = React__namespace.forwardRef((props, ref) => (React__namespace.createElement(DualListSelectorListItemBase, Object.assign({ innerRef: ref }, props))));
|
10466 | DualListSelectorListItem.displayName = 'DualListSelectorListItem';
|
10467 |
|
10468 | const DualListSelectorList = (_a) => {
|
10469 | var { children } = _a, props = __rest$1(_a, ["children"]);
|
10470 | const { setFocusedOption, isTree, ariaLabelledBy, focusedOption, displayOption, selectedOptions, id, onOptionSelect, options, isDisabled } = React__namespace.useContext(DualListSelectorListContext);
|
10471 |
|
10472 | const onOptionClick = (e, index, id) => {
|
10473 | setFocusedOption(id);
|
10474 | onOptionSelect(e, index, id);
|
10475 | };
|
10476 | return (React__namespace.createElement("ul", Object.assign({ className: css(styles$L.dualListSelectorList), role: isTree ? 'tree' : 'listbox', "aria-multiselectable": "true", "aria-labelledby": ariaLabelledBy, "aria-activedescendant": focusedOption, "aria-disabled": isDisabled ? 'true' : undefined }, props), options.length === 0
|
10477 | ? children
|
10478 | : options.map((option, index) => {
|
10479 | if (displayOption(option)) {
|
10480 | return (React__namespace.createElement(DualListSelectorListItem, { key: index, isSelected: selectedOptions.indexOf(index) !== -1, id: `${id}-option-${index}`, onOptionSelect: (e, id) => onOptionClick(e, index, id), orderIndex: index, isDisabled: isDisabled }, option));
|
10481 | }
|
10482 | return;
|
10483 | })));
|
10484 | };
|
10485 | DualListSelectorList.displayName = 'DualListSelectorList';
|
10486 |
|
10487 | const DualListSelectorListWrapperBase = (_a) => {
|
10488 | var { className, children, 'aria-labelledby': ariaLabelledBy, innerRef, options = [], selectedOptions = [], onOptionSelect, displayOption, id = getUniqueId('dual-list-selector-list'), isDisabled = false } = _a, props = __rest$1(_a, ["className", "children", 'aria-labelledby', "innerRef", "options", "selectedOptions", "onOptionSelect", "displayOption", "id", "isDisabled"]);
|
10489 | const [focusedOption, setFocusedOption] = React__namespace.useState('');
|
10490 | const menuRef = innerRef || React__namespace.useRef(null);
|
10491 | const { isTree } = React__namespace.useContext(DualListSelectorContext);
|
10492 |
|
10493 |
|
10494 | const handleKeys = (event) => {
|
10495 | if (!menuRef.current ||
|
10496 | (menuRef.current !== event.target.closest('.pf-c-dual-list-selector__menu') &&
|
10497 | !Array.from(menuRef.current.getElementsByClassName('pf-c-dual-list-selector__menu')).includes(event.target.closest('.pf-c-dual-list-selector__menu')))) {
|
10498 | return;
|
10499 | }
|
10500 | event.stopImmediatePropagation();
|
10501 | const validOptions = isTree
|
10502 | ? Array.from(menuRef.current.querySelectorAll('.pf-c-dual-list-selector__item-toggle, .pf-c-dual-list-selector__item-check > input'))
|
10503 | : Array.from(menuRef.current.getElementsByTagName('LI')).filter(el => !el.classList.contains('pf-m-disabled'));
|
10504 | const activeElement = document.activeElement;
|
10505 | handleArrows(event, validOptions, (element) => activeElement.contains(element), (element) => {
|
10506 | if (element.classList.contains('.pf-c-dual-list-selector__list-item')) {
|
10507 | setFocusedOption(element.id);
|
10508 | }
|
10509 | else {
|
10510 | setFocusedOption(element.closest('.pf-c-dual-list-selector__list-item').id);
|
10511 | }
|
10512 | return element;
|
10513 | }, ['.pf-c-dual-list-selector__item-toggle', '.pf-c-dual-list-selector__item-check > input'], undefined, false, false, false);
|
10514 | };
|
10515 | React__namespace.useEffect(() => {
|
10516 | window.addEventListener('keydown', handleKeys);
|
10517 | return () => {
|
10518 | window.removeEventListener('keydown', handleKeys);
|
10519 | };
|
10520 | }, [menuRef.current]);
|
10521 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$L.dualListSelectorMenu, className), ref: menuRef, tabIndex: 0 }, props),
|
10522 | React__namespace.createElement(DualListSelectorListContext.Provider, { value: {
|
10523 | setFocusedOption,
|
10524 | isTree,
|
10525 | focusedOption,
|
10526 | ariaLabelledBy,
|
10527 | displayOption,
|
10528 | selectedOptions,
|
10529 | id,
|
10530 | options,
|
10531 | onOptionSelect,
|
10532 | isDisabled
|
10533 | } }, children ? children : React__namespace.createElement(DualListSelectorList, null))));
|
10534 | };
|
10535 | DualListSelectorListWrapperBase.displayName = 'DualListSelectorListWrapperBase';
|
10536 | const DualListSelectorListWrapper = React__namespace.forwardRef((props, ref) => (React__namespace.createElement(DualListSelectorListWrapperBase, Object.assign({ innerRef: ref }, props))));
|
10537 | DualListSelectorListWrapper.displayName = 'DualListSelectorListWrapper';
|
10538 |
|
10539 | const DualListSelectorPane = (_a) => {
|
10540 | var { isChosen = false, className = '', status = '', actions, searchInput, children, onOptionSelect, onOptionCheck, title = '', options = [], selectedOptions = [], isSearchable = false, searchInputAriaLabel = '', onFilterUpdate, onSearchInputChanged, filterOption, id = getUniqueId('dual-list-selector-pane'), isDisabled = false } = _a, props = __rest$1(_a, ["isChosen", "className", "status", "actions", "searchInput", "children", "onOptionSelect", "onOptionCheck", "title", "options", "selectedOptions", "isSearchable", "searchInputAriaLabel", "onFilterUpdate", "onSearchInputChanged", "filterOption", "id", "isDisabled"]);
|
10541 | const [input, setInput] = React__namespace.useState('');
|
10542 | const { isTree } = React__namespace.useContext(DualListSelectorContext);
|
10543 |
|
10544 | const onChange = (e) => {
|
10545 | const newValue = e.target.value;
|
10546 | let filtered;
|
10547 | if (isTree) {
|
10548 | filtered = options
|
10549 | .map(opt => Object.assign({}, opt))
|
10550 | .filter(item => filterInput(item, newValue));
|
10551 | }
|
10552 | else {
|
10553 | filtered = options.filter(option => {
|
10554 | if (displayOption(option)) {
|
10555 | return option;
|
10556 | }
|
10557 | });
|
10558 | }
|
10559 | onFilterUpdate(filtered, isChosen ? 'chosen' : 'available', newValue === '');
|
10560 | if (onSearchInputChanged) {
|
10561 | onSearchInputChanged(newValue, e);
|
10562 | }
|
10563 | setInput(newValue);
|
10564 | };
|
10565 |
|
10566 | const filterInput = (item, input) => {
|
10567 | if (filterOption) {
|
10568 | return filterOption(item, input);
|
10569 | }
|
10570 | else {
|
10571 | if (item.text.toLowerCase().includes(input.toLowerCase()) || input === '') {
|
10572 | return true;
|
10573 | }
|
10574 | }
|
10575 | if (item.children) {
|
10576 | return ((item.children = item.children.map(opt => Object.assign({}, opt)).filter(child => filterInput(child, input)))
|
10577 | .length > 0);
|
10578 | }
|
10579 | };
|
10580 |
|
10581 | const displayOption = (option) => {
|
10582 | if (filterOption) {
|
10583 | return filterOption(option, input);
|
10584 | }
|
10585 | else {
|
10586 | return option
|
10587 | .toString()
|
10588 | .toLowerCase()
|
10589 | .includes(input.toLowerCase());
|
10590 | }
|
10591 | };
|
10592 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$L.dualListSelectorPane, isChosen ? styles$L.modifiers.chosen : 'pf-m-available', className) }, props),
|
10593 | title && (React__namespace.createElement("div", { className: css(styles$L.dualListSelectorHeader) },
|
10594 | React__namespace.createElement("div", { className: "pf-c-dual-list-selector__title" },
|
10595 | React__namespace.createElement("div", { className: css(styles$L.dualListSelectorTitleText) }, title)))),
|
10596 | (actions || searchInput || isSearchable) && (React__namespace.createElement("div", { className: css(styles$L.dualListSelectorTools) },
|
10597 | (isSearchable || searchInput) && (React__namespace.createElement("div", { className: css(styles$L.dualListSelectorToolsFilter) }, searchInput ? (searchInput) : (React__namespace.createElement("input", { className: css(formStyles.formControl, formStyles.modifiers.search), type: "search", onChange: isDisabled ? undefined : onChange, "aria-label": searchInputAriaLabel, disabled: isDisabled })))),
|
10598 | actions && React__namespace.createElement("div", { className: css(styles$L.dualListSelectorToolsActions) }, actions))),
|
10599 | status && (React__namespace.createElement("div", { className: css(styles$L.dualListSelectorStatus) },
|
10600 | React__namespace.createElement("div", { className: css(styles$L.dualListSelectorStatusText), id: `${id}-status` }, status))),
|
10601 | React__namespace.createElement(DualListSelectorPaneContext.Provider, { value: { isChosen } },
|
10602 | !isTree && (React__namespace.createElement(DualListSelectorListWrapper, { "aria-labelledby": `${id}-status`, options: options, selectedOptions: selectedOptions, onOptionSelect: (e, index, id) => onOptionSelect(e, index, isChosen, id), displayOption: displayOption, id: `${id}-list`, isDisabled: isDisabled }, children)),
|
10603 | isTree && (React__namespace.createElement(DualListSelectorListWrapper, { "aria-labelledby": `${id}-status`, id: `${id}-list` }, options.length > 0 ? (React__namespace.createElement(DualListSelectorList, null,
|
10604 | React__namespace.createElement(DualListSelectorTree, { data: isSearchable
|
10605 | ? options
|
10606 | .map(opt => Object.assign({}, opt))
|
10607 | .filter(item => filterInput(item, input))
|
10608 | : options, onOptionCheck: onOptionCheck, id: `${id}-tree`, isDisabled: isDisabled }))) : (children))))));
|
10609 | };
|
10610 | DualListSelectorPane.displayName = 'DualListSelectorPane';
|
10611 |
|
10612 | const DualListSelectorControlsWrapperBase = (_a) => {
|
10613 | var { innerRef, children = null, className, 'aria-label': ariaLabel = 'Controls for moving options between lists' } = _a, props = __rest$1(_a, ["innerRef", "children", "className", 'aria-label']);
|
10614 | const wrapperRef = innerRef || React__namespace.useRef(null);
|
10615 |
|
10616 |
|
10617 | const handleKeys = (event) => {
|
10618 | if (!wrapperRef.current ||
|
10619 | (wrapperRef.current !== event.target.closest('.pf-c-dual-list-selector__controls') &&
|
10620 | !Array.from(wrapperRef.current.getElementsByClassName('pf-c-dual-list-selector__controls')).includes(event.target.closest('.pf-c-dual-list-selector__controls')))) {
|
10621 | return;
|
10622 | }
|
10623 | event.stopImmediatePropagation();
|
10624 | const controls = Array.from(wrapperRef.current.getElementsByTagName('BUTTON')).filter(el => !el.classList.contains('pf-m-disabled'));
|
10625 | const activeElement = document.activeElement;
|
10626 | handleArrows(event, controls, (element) => activeElement.contains(element), (element) => element, undefined, undefined, true, false);
|
10627 | };
|
10628 | React__namespace.useEffect(() => {
|
10629 | window.addEventListener('keydown', handleKeys);
|
10630 | return () => {
|
10631 | window.removeEventListener('keydown', handleKeys);
|
10632 | };
|
10633 | }, [wrapperRef.current]);
|
10634 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$L.dualListSelectorControls, className), tabIndex: 0, ref: wrapperRef, "aria-label": ariaLabel }, props), children));
|
10635 | };
|
10636 | DualListSelectorControlsWrapperBase.displayName = 'DualListSelectorControlsWrapperBase';
|
10637 | const DualListSelectorControlsWrapper = React__namespace.forwardRef((props, ref) => (React__namespace.createElement(DualListSelectorControlsWrapperBase, Object.assign({ innerRef: ref }, props))));
|
10638 | DualListSelectorControlsWrapper.displayName = 'DualListSelectorControlsWrapper';
|
10639 |
|
10640 | const DualListSelectorControlBase = (_a) => {
|
10641 | var { innerRef, children = null, className, 'aria-label': ariaLabel, isDisabled = true, onClick = () => { }, tooltipContent, tooltipProps = {} } = _a, props = __rest$1(_a, ["innerRef", "children", "className", 'aria-label', "isDisabled", "onClick", "tooltipContent", "tooltipProps"]);
|
10642 | const ref = innerRef || React__namespace.useRef(null);
|
10643 | return (React__namespace.createElement("div", Object.assign({ className: css('pf-c-dual-list-selector__controls-item', className) }, props),
|
10644 | React__namespace.createElement(Button, { isDisabled: isDisabled, "aria-disabled": isDisabled, variant: exports.ButtonVariant.plain, onClick: onClick, "aria-label": ariaLabel, tabIndex: -1, ref: ref }, children),
|
10645 | tooltipContent && React__namespace.createElement(Tooltip, Object.assign({ content: tooltipContent, position: "left", reference: ref }, tooltipProps))));
|
10646 | };
|
10647 | DualListSelectorControlBase.displayName = 'DualListSelectorControlBase';
|
10648 | const DualListSelectorControl = React__namespace.forwardRef((props, ref) => (React__namespace.createElement(DualListSelectorControlBase, Object.assign({ innerRef: ref }, props))));
|
10649 | DualListSelectorControl.displayName = 'DualListSelectorControl';
|
10650 |
|
10651 | class DualListSelector extends React__namespace.Component {
|
10652 | constructor(props) {
|
10653 | super(props);
|
10654 | this.addAllButtonRef = React__namespace.createRef();
|
10655 | this.addSelectedButtonRef = React__namespace.createRef();
|
10656 | this.removeSelectedButtonRef = React__namespace.createRef();
|
10657 | this.removeAllButtonRef = React__namespace.createRef();
|
10658 | this.onFilterUpdate = (newFilteredOptions, paneType, isSearchReset) => {
|
10659 | const { isTree } = this.props;
|
10660 | if (paneType === 'available') {
|
10661 | if (isSearchReset) {
|
10662 | this.setState({
|
10663 | availableFilteredOptions: null,
|
10664 | availableTreeFilteredOptions: null
|
10665 | });
|
10666 | return;
|
10667 | }
|
10668 | if (isTree) {
|
10669 | this.setState({
|
10670 | availableTreeFilteredOptions: flattenTreeWithFolders(newFilteredOptions)
|
10671 | });
|
10672 | }
|
10673 | else {
|
10674 | this.setState({
|
10675 | availableFilteredOptions: newFilteredOptions
|
10676 | });
|
10677 | }
|
10678 | }
|
10679 | else if (paneType === 'chosen') {
|
10680 | if (isSearchReset) {
|
10681 | this.setState({
|
10682 | chosenFilteredOptions: null,
|
10683 | chosenTreeFilteredOptions: null
|
10684 | });
|
10685 | return;
|
10686 | }
|
10687 | if (isTree) {
|
10688 | this.setState({
|
10689 | chosenTreeFilteredOptions: flattenTreeWithFolders(newFilteredOptions)
|
10690 | });
|
10691 | }
|
10692 | else {
|
10693 | this.setState({
|
10694 | chosenFilteredOptions: newFilteredOptions
|
10695 | });
|
10696 | }
|
10697 | }
|
10698 | };
|
10699 | this.addAllVisible = () => {
|
10700 | this.setState(prevState => {
|
10701 | const itemsToRemove = [];
|
10702 | const newAvailable = [];
|
10703 | const movedOptions = prevState.availableFilteredOptions || prevState.availableOptions;
|
10704 | prevState.availableOptions.forEach(value => {
|
10705 | if (movedOptions.indexOf(value) !== -1) {
|
10706 | itemsToRemove.push(value);
|
10707 | }
|
10708 | else {
|
10709 | newAvailable.push(value);
|
10710 | }
|
10711 | });
|
10712 | const newChosen = [...prevState.chosenOptions, ...itemsToRemove];
|
10713 | this.props.addAll && this.props.addAll(newAvailable, newChosen);
|
10714 | this.props.onListChange && this.props.onListChange(newAvailable, newChosen);
|
10715 | return {
|
10716 | chosenOptions: newChosen,
|
10717 | availableOptions: newAvailable,
|
10718 | chosenOptionsSelected: [],
|
10719 | availableOptionsSelected: []
|
10720 | };
|
10721 | });
|
10722 | };
|
10723 | this.addAllTreeVisible = () => {
|
10724 | this.setState(prevState => {
|
10725 | const movedOptions = prevState.availableTreeFilteredOptions ||
|
10726 | flattenTreeWithFolders(prevState.availableOptions);
|
10727 | const newAvailable = prevState.availableOptions
|
10728 | .map(opt => Object.assign({}, opt))
|
10729 | .filter(item => filterRestTreeItems(item, movedOptions));
|
10730 | const currChosen = flattenTree(prevState.chosenOptions);
|
10731 | const nextChosenOptions = currChosen.concat(movedOptions);
|
10732 | const newChosen = this.createMergedCopy()
|
10733 | .map(opt => Object.assign({}, opt))
|
10734 | .filter(item => filterTreeItemsWithoutFolders(item, nextChosenOptions));
|
10735 | this.props.addAll && this.props.addAll(newAvailable, newChosen);
|
10736 | this.props.onListChange && this.props.onListChange(newAvailable, newChosen);
|
10737 | return {
|
10738 | chosenOptions: newChosen,
|
10739 | chosenFilteredOptions: newChosen,
|
10740 | availableOptions: newAvailable,
|
10741 | availableFilteredOptions: newAvailable,
|
10742 | availableTreeOptionsChecked: [],
|
10743 | chosenTreeOptionsChecked: []
|
10744 | };
|
10745 | });
|
10746 | };
|
10747 | this.addSelected = () => {
|
10748 | this.setState(prevState => {
|
10749 | const itemsToRemove = [];
|
10750 | const newAvailable = [];
|
10751 | prevState.availableOptions.forEach((value, index) => {
|
10752 | if (prevState.availableOptionsSelected.indexOf(index) !== -1) {
|
10753 | itemsToRemove.push(value);
|
10754 | }
|
10755 | else {
|
10756 | newAvailable.push(value);
|
10757 | }
|
10758 | });
|
10759 | const newChosen = [...prevState.chosenOptions, ...itemsToRemove];
|
10760 | this.props.addSelected && this.props.addSelected(newAvailable, newChosen);
|
10761 | this.props.onListChange && this.props.onListChange(newAvailable, newChosen);
|
10762 | return {
|
10763 | chosenOptionsSelected: [],
|
10764 | availableOptionsSelected: [],
|
10765 | chosenOptions: newChosen,
|
10766 | availableOptions: newAvailable
|
10767 | };
|
10768 | });
|
10769 | };
|
10770 | this.addTreeSelected = () => {
|
10771 | this.setState(prevState => {
|
10772 |
|
10773 | const newAvailable = prevState.availableOptions
|
10774 | .map(opt => Object.assign({}, opt))
|
10775 | .filter(item => filterRestTreeItems(item, prevState.availableTreeOptionsChecked));
|
10776 |
|
10777 | const currChosen = flattenTree(prevState.chosenOptions);
|
10778 | const nextChosenOptions = currChosen.concat(prevState.availableTreeOptionsChecked);
|
10779 | const newChosen = this.createMergedCopy()
|
10780 | .map(opt => Object.assign({}, opt))
|
10781 | .filter(item => filterTreeItemsWithoutFolders(item, nextChosenOptions));
|
10782 | this.props.addSelected && this.props.addSelected(newAvailable, newChosen);
|
10783 | this.props.onListChange && this.props.onListChange(newAvailable, newChosen);
|
10784 | return {
|
10785 | availableTreeOptionsChecked: [],
|
10786 | chosenTreeOptionsChecked: [],
|
10787 | availableOptions: newAvailable,
|
10788 | chosenOptions: newChosen
|
10789 | };
|
10790 | });
|
10791 | };
|
10792 | this.removeAllVisible = () => {
|
10793 | this.setState(prevState => {
|
10794 | const itemsToRemove = [];
|
10795 | const newChosen = [];
|
10796 | const movedOptions = prevState.chosenFilteredOptions || prevState.chosenOptions;
|
10797 | prevState.chosenOptions.forEach(value => {
|
10798 | if (movedOptions.indexOf(value) !== -1) {
|
10799 | itemsToRemove.push(value);
|
10800 | }
|
10801 | else {
|
10802 | newChosen.push(value);
|
10803 | }
|
10804 | });
|
10805 | const newAvailable = [...prevState.availableOptions, ...itemsToRemove];
|
10806 | this.props.removeAll && this.props.removeAll(newAvailable, newChosen);
|
10807 | this.props.onListChange && this.props.onListChange(newAvailable, newChosen);
|
10808 | return {
|
10809 | chosenOptions: newChosen,
|
10810 | availableOptions: newAvailable,
|
10811 | chosenOptionsSelected: [],
|
10812 | availableOptionsSelected: []
|
10813 | };
|
10814 | });
|
10815 | };
|
10816 | this.removeAllTreeVisible = () => {
|
10817 | this.setState(prevState => {
|
10818 | const movedOptions = prevState.chosenTreeFilteredOptions ||
|
10819 | flattenTreeWithFolders(prevState.chosenOptions);
|
10820 | const newChosen = prevState.chosenOptions
|
10821 | .map(opt => Object.assign({}, opt))
|
10822 | .filter(item => filterRestTreeItems(item, movedOptions));
|
10823 | const currAvailable = flattenTree(prevState.availableOptions);
|
10824 | const nextAvailableOptions = currAvailable.concat(movedOptions);
|
10825 | const newAvailable = this.createMergedCopy()
|
10826 | .map(opt => Object.assign({}, opt))
|
10827 | .filter(item => filterTreeItemsWithoutFolders(item, nextAvailableOptions));
|
10828 | this.props.removeAll && this.props.removeAll(newAvailable, newChosen);
|
10829 | this.props.onListChange && this.props.onListChange(newAvailable, newChosen);
|
10830 | return {
|
10831 | chosenOptions: newChosen,
|
10832 | availableOptions: newAvailable,
|
10833 | availableTreeOptionsChecked: [],
|
10834 | chosenTreeOptionsChecked: []
|
10835 | };
|
10836 | });
|
10837 | };
|
10838 | this.removeSelected = () => {
|
10839 | this.setState(prevState => {
|
10840 | const itemsToRemove = [];
|
10841 | const newChosen = [];
|
10842 | prevState.chosenOptions.forEach((value, index) => {
|
10843 | if (prevState.chosenOptionsSelected.indexOf(index) !== -1) {
|
10844 | itemsToRemove.push(value);
|
10845 | }
|
10846 | else {
|
10847 | newChosen.push(value);
|
10848 | }
|
10849 | });
|
10850 | const newAvailable = [...prevState.availableOptions, ...itemsToRemove];
|
10851 | this.props.removeSelected && this.props.removeSelected(newAvailable, newChosen);
|
10852 | this.props.onListChange && this.props.onListChange(newAvailable, newChosen);
|
10853 | return {
|
10854 | chosenOptionsSelected: [],
|
10855 | availableOptionsSelected: [],
|
10856 | chosenOptions: newChosen,
|
10857 | availableOptions: newAvailable
|
10858 | };
|
10859 | });
|
10860 | };
|
10861 | this.removeTreeSelected = () => {
|
10862 | this.setState(prevState => {
|
10863 |
|
10864 | const newChosen = prevState.chosenOptions
|
10865 | .map(opt => Object.assign({}, opt))
|
10866 | .filter(item => filterRestTreeItems(item, prevState.chosenTreeOptionsChecked));
|
10867 |
|
10868 | const currAvailable = flattenTree(prevState.availableOptions);
|
10869 | const nextAvailableOptions = currAvailable.concat(prevState.chosenTreeOptionsChecked);
|
10870 | const newAvailable = this.createMergedCopy()
|
10871 | .map(opt => Object.assign({}, opt))
|
10872 | .filter(item => filterTreeItemsWithoutFolders(item, nextAvailableOptions));
|
10873 | this.props.removeSelected && this.props.removeSelected(newAvailable, newChosen);
|
10874 | this.props.onListChange && this.props.onListChange(newAvailable, newChosen);
|
10875 | return {
|
10876 | availableTreeOptionsChecked: [],
|
10877 | chosenTreeOptionsChecked: [],
|
10878 | availableOptions: newAvailable,
|
10879 | chosenOptions: newChosen
|
10880 | };
|
10881 | });
|
10882 | };
|
10883 | this.onOptionSelect = (e, index, isChosen,
|
10884 |
|
10885 | id, itemData, parentData
|
10886 |
|
10887 | ) => {
|
10888 | this.setState(prevState => {
|
10889 | const originalArray = isChosen ? prevState.chosenOptionsSelected : prevState.availableOptionsSelected;
|
10890 | let updatedArray = null;
|
10891 | if (originalArray.indexOf(index) !== -1) {
|
10892 | updatedArray = originalArray.filter(value => value !== index);
|
10893 | }
|
10894 | else {
|
10895 | updatedArray = [...originalArray, index];
|
10896 | }
|
10897 | return {
|
10898 | chosenOptionsSelected: isChosen ? updatedArray : prevState.chosenOptionsSelected,
|
10899 | availableOptionsSelected: isChosen ? prevState.availableOptionsSelected : updatedArray
|
10900 | };
|
10901 | });
|
10902 | this.props.onOptionSelect && this.props.onOptionSelect(e, index, isChosen, id, itemData, parentData);
|
10903 | };
|
10904 | this.isChecked = (treeItem, isChosen) => isChosen
|
10905 | ? this.state.chosenTreeOptionsChecked.includes(treeItem.id)
|
10906 | : this.state.availableTreeOptionsChecked.includes(treeItem.id);
|
10907 | this.areAllDescendantsChecked = (treeItem, isChosen) => treeItem.children
|
10908 | ? treeItem.children.every(child => this.areAllDescendantsChecked(child, isChosen))
|
10909 | : this.isChecked(treeItem, isChosen);
|
10910 | this.areSomeDescendantsChecked = (treeItem, isChosen) => treeItem.children
|
10911 | ? treeItem.children.some(child => this.areSomeDescendantsChecked(child, isChosen))
|
10912 | : this.isChecked(treeItem, isChosen);
|
10913 | this.mapChecked = (item, isChosen) => {
|
10914 | const hasCheck = this.areAllDescendantsChecked(item, isChosen);
|
10915 | item.isChecked = false;
|
10916 | if (hasCheck) {
|
10917 | item.isChecked = true;
|
10918 | }
|
10919 | else {
|
10920 | const hasPartialCheck = this.areSomeDescendantsChecked(item, isChosen);
|
10921 | if (hasPartialCheck) {
|
10922 | item.isChecked = null;
|
10923 | }
|
10924 | }
|
10925 | if (item.children) {
|
10926 | return Object.assign(Object.assign({}, item), { children: item.children.map(child => this.mapChecked(child, isChosen)) });
|
10927 | }
|
10928 | return item;
|
10929 | };
|
10930 | this.onTreeOptionCheck = (evt, isChecked, itemData, isChosen) => {
|
10931 | const { availableOptions, availableTreeFilteredOptions, chosenOptions, chosenTreeFilteredOptions } = this.state;
|
10932 | let panelOptions;
|
10933 | if (isChosen) {
|
10934 | if (chosenTreeFilteredOptions) {
|
10935 | panelOptions = chosenOptions
|
10936 | .map(opt => Object.assign({}, opt))
|
10937 | .filter(item => filterTreeItemsWithoutFolders(item, chosenTreeFilteredOptions));
|
10938 | }
|
10939 | else {
|
10940 | panelOptions = chosenOptions;
|
10941 | }
|
10942 | }
|
10943 | else {
|
10944 | if (availableTreeFilteredOptions) {
|
10945 | panelOptions = availableOptions
|
10946 | .map(opt => Object.assign({}, opt))
|
10947 | .filter(item => filterTreeItemsWithoutFolders(item, availableTreeFilteredOptions));
|
10948 | }
|
10949 | else {
|
10950 | panelOptions = availableOptions;
|
10951 | }
|
10952 | }
|
10953 | const checkedOptionTree = panelOptions
|
10954 | .map(opt => Object.assign({}, opt))
|
10955 | .filter(item => filterTreeItems(item, [itemData.id]));
|
10956 | const flatTree = flattenTreeWithFolders(checkedOptionTree);
|
10957 | const prevChecked = isChosen ? this.state.chosenTreeOptionsChecked : this.state.availableTreeOptionsChecked;
|
10958 | let updatedChecked = [];
|
10959 | if (isChecked) {
|
10960 | updatedChecked = prevChecked.concat(flatTree.filter(id => !prevChecked.includes(id)));
|
10961 | }
|
10962 | else {
|
10963 | updatedChecked = prevChecked.filter(id => !flatTree.includes(id));
|
10964 | }
|
10965 | this.setState(prevState => ({
|
10966 | availableTreeOptionsChecked: isChosen ? prevState.availableTreeOptionsChecked : updatedChecked,
|
10967 | chosenTreeOptionsChecked: isChosen ? updatedChecked : prevState.chosenTreeOptionsChecked
|
10968 | }), () => {
|
10969 | this.props.onOptionCheck && this.props.onOptionCheck(evt, isChecked, itemData.id, updatedChecked);
|
10970 | });
|
10971 | };
|
10972 | this.state = {
|
10973 | availableOptions: [...this.props.availableOptions],
|
10974 | availableOptionsSelected: [],
|
10975 | availableFilteredOptions: null,
|
10976 | availableTreeFilteredOptions: null,
|
10977 | chosenOptions: [...this.props.chosenOptions],
|
10978 | chosenOptionsSelected: [],
|
10979 | chosenFilteredOptions: null,
|
10980 | chosenTreeFilteredOptions: null,
|
10981 | availableTreeOptionsChecked: [],
|
10982 | chosenTreeOptionsChecked: []
|
10983 | };
|
10984 | }
|
10985 |
|
10986 | createMergedCopy() {
|
10987 | const copyOfAvailable = JSON.parse(JSON.stringify(this.props.availableOptions));
|
10988 | const copyOfChosen = JSON.parse(JSON.stringify(this.props.chosenOptions));
|
10989 | return this.props.isTree
|
10990 | ? Object.values(copyOfAvailable
|
10991 | .concat(copyOfChosen)
|
10992 | .reduce((mapObj, item) => {
|
10993 | const key = item.id;
|
10994 | if (mapObj[key]) {
|
10995 |
|
10996 | mapObj[key].children.push(...item.children);
|
10997 | }
|
10998 | else {
|
10999 |
|
11000 | mapObj[key] = Object.assign({}, item);
|
11001 | }
|
11002 | return mapObj;
|
11003 | }, {}))
|
11004 | : null;
|
11005 | }
|
11006 | componentDidUpdate() {
|
11007 | if (JSON.stringify(this.props.availableOptions) !== JSON.stringify(this.state.availableOptions) ||
|
11008 | JSON.stringify(this.props.chosenOptions) !== JSON.stringify(this.state.chosenOptions)) {
|
11009 | this.setState({
|
11010 | availableOptions: [...this.props.availableOptions],
|
11011 | chosenOptions: [...this.props.chosenOptions]
|
11012 | });
|
11013 | }
|
11014 | }
|
11015 | render() {
|
11016 | const _a = this.props, { availableOptionsTitle, availableOptionsActions, availableOptionsSearchAriaLabel, className, children, chosenOptionsTitle, chosenOptionsActions, chosenOptionsSearchAriaLabel, filterOption, isSearchable, chosenOptionsStatus, availableOptionsStatus, controlsAriaLabel, addAllAriaLabel, addSelectedAriaLabel, removeSelectedAriaLabel, removeAllAriaLabel,
|
11017 |
|
11018 | availableOptions: consumerPassedAvailableOptions, chosenOptions: consumerPassedChosenOptions, removeSelected, addAll, removeAll, addSelected, onListChange, onAvailableOptionsSearchInputChanged, onChosenOptionsSearchInputChanged, onOptionSelect, onOptionCheck, id, isTree, isDisabled, addAllTooltip, addAllTooltipProps, addSelectedTooltip, addSelectedTooltipProps, removeAllTooltip, removeAllTooltipProps, removeSelectedTooltip, removeSelectedTooltipProps } = _a, props = __rest$1(_a, ["availableOptionsTitle", "availableOptionsActions", "availableOptionsSearchAriaLabel", "className", "children", "chosenOptionsTitle", "chosenOptionsActions", "chosenOptionsSearchAriaLabel", "filterOption", "isSearchable", "chosenOptionsStatus", "availableOptionsStatus", "controlsAriaLabel", "addAllAriaLabel", "addSelectedAriaLabel", "removeSelectedAriaLabel", "removeAllAriaLabel", "availableOptions", "chosenOptions", "removeSelected", "addAll", "removeAll", "addSelected", "onListChange", "onAvailableOptionsSearchInputChanged", "onChosenOptionsSearchInputChanged", "onOptionSelect", "onOptionCheck", "id", "isTree", "isDisabled", "addAllTooltip", "addAllTooltipProps", "addSelectedTooltip", "addSelectedTooltipProps", "removeAllTooltip", "removeAllTooltipProps", "removeSelectedTooltip", "removeSelectedTooltipProps"]);
|
11019 | const { availableOptions, chosenOptions, chosenOptionsSelected, availableOptionsSelected, chosenTreeOptionsChecked, availableTreeOptionsChecked } = this.state;
|
11020 | const availableOptionsStatusToDisplay = availableOptionsStatus ||
|
11021 | (isTree
|
11022 | ? `${filterFolders(availableOptions, availableTreeOptionsChecked).length} of ${flattenTree(availableOptions).length} items selected`
|
11023 | : `${availableOptionsSelected.length} of ${availableOptions.length} items selected`);
|
11024 | const chosenOptionsStatusToDisplay = chosenOptionsStatus ||
|
11025 | (isTree
|
11026 | ? `${filterFolders(chosenOptions, chosenTreeOptionsChecked).length} of ${flattenTree(chosenOptions).length} items selected`
|
11027 | : `${chosenOptionsSelected.length} of ${chosenOptions.length} items selected`);
|
11028 | const available = isTree
|
11029 | ? availableOptions.map(item => this.mapChecked(item, false))
|
11030 | : availableOptions;
|
11031 | const chosen = isTree
|
11032 | ? chosenOptions.map(item => this.mapChecked(item, true))
|
11033 | : chosenOptions;
|
11034 | return (React__namespace.createElement(DualListSelectorContext.Provider, { value: { isTree } },
|
11035 | React__namespace.createElement("div", Object.assign({ className: css(styles$L.dualListSelector, className), id: id }, props), children === '' ? (React__namespace.createElement(React__namespace.Fragment, null,
|
11036 | React__namespace.createElement(DualListSelectorPane, { isSearchable: isSearchable, onFilterUpdate: this.onFilterUpdate, searchInputAriaLabel: availableOptionsSearchAriaLabel, filterOption: filterOption, onSearchInputChanged: onAvailableOptionsSearchInputChanged, status: availableOptionsStatusToDisplay, title: availableOptionsTitle, options: available, selectedOptions: isTree ? availableTreeOptionsChecked : availableOptionsSelected, onOptionSelect: this.onOptionSelect, onOptionCheck: (e, isChecked, itemData) => this.onTreeOptionCheck(e, isChecked, itemData, false), actions: availableOptionsActions, id: `${id}-available-pane`, isDisabled: isDisabled }),
|
11037 | React__namespace.createElement(DualListSelectorControlsWrapper, { "aria-label": controlsAriaLabel },
|
11038 | React__namespace.createElement(DualListSelectorControl, { isDisabled: (isTree ? availableTreeOptionsChecked.length === 0 : availableOptionsSelected.length === 0) ||
|
11039 | isDisabled, onClick: isTree ? this.addTreeSelected : this.addSelected, ref: this.addSelectedButtonRef, "aria-label": addSelectedAriaLabel, tooltipContent: addSelectedTooltip, tooltipProps: addSelectedTooltipProps },
|
11040 | React__namespace.createElement(AngleRightIcon$1, null)),
|
11041 | React__namespace.createElement(DualListSelectorControl, { isDisabled: availableOptions.length === 0 || isDisabled, onClick: isTree ? this.addAllTreeVisible : this.addAllVisible, ref: this.addAllButtonRef, "aria-label": addAllAriaLabel, tooltipContent: addAllTooltip, tooltipProps: addAllTooltipProps },
|
11042 | React__namespace.createElement(AngleDoubleRightIcon$1, null)),
|
11043 | React__namespace.createElement(DualListSelectorControl, { isDisabled: chosenOptions.length === 0 || isDisabled, onClick: isTree ? this.removeAllTreeVisible : this.removeAllVisible, "aria-label": removeAllAriaLabel, ref: this.removeAllButtonRef, tooltipContent: removeAllTooltip, tooltipProps: removeAllTooltipProps },
|
11044 | React__namespace.createElement(AngleDoubleLeftIcon$1, null)),
|
11045 | React__namespace.createElement(DualListSelectorControl, { onClick: isTree ? this.removeTreeSelected : this.removeSelected, isDisabled: (isTree ? chosenTreeOptionsChecked.length === 0 : chosenOptionsSelected.length === 0) || isDisabled, ref: this.removeSelectedButtonRef, "aria-label": removeSelectedAriaLabel, tooltipContent: removeSelectedTooltip, tooltipProps: removeSelectedTooltipProps },
|
11046 | React__namespace.createElement(AngleLeftIcon$1, null))),
|
11047 | React__namespace.createElement(DualListSelectorPane, { isChosen: true, isSearchable: isSearchable, onFilterUpdate: this.onFilterUpdate, searchInputAriaLabel: chosenOptionsSearchAriaLabel, filterOption: filterOption, onSearchInputChanged: onChosenOptionsSearchInputChanged, title: chosenOptionsTitle, status: chosenOptionsStatusToDisplay, options: chosen, selectedOptions: isTree ? chosenTreeOptionsChecked : chosenOptionsSelected, onOptionSelect: this.onOptionSelect, onOptionCheck: (e, isChecked, itemData) => this.onTreeOptionCheck(e, isChecked, itemData, true), actions: chosenOptionsActions, id: `${id}-chosen-pane`, isDisabled: isDisabled }))) : (children))));
|
11048 | }
|
11049 | }
|
11050 | DualListSelector.displayName = 'DualListSelector';
|
11051 | DualListSelector.defaultProps = {
|
11052 | children: '',
|
11053 | availableOptions: [],
|
11054 | availableOptionsTitle: 'Available options',
|
11055 | availableOptionsSearchAriaLabel: 'Available search input',
|
11056 | chosenOptions: [],
|
11057 | chosenOptionsTitle: 'Chosen options',
|
11058 | chosenOptionsSearchAriaLabel: 'Chosen search input',
|
11059 | id: getUniqueId('dual-list-selector'),
|
11060 | controlsAriaLabel: 'Selector controls',
|
11061 | addAllAriaLabel: 'Add all',
|
11062 | addSelectedAriaLabel: 'Add selected',
|
11063 | removeSelectedAriaLabel: 'Remove selected',
|
11064 | removeAllAriaLabel: 'Remove all',
|
11065 | isTree: false,
|
11066 | isDisabled: false
|
11067 | };
|
11068 |
|
11069 | Promise.resolve().then(function () { return emptyState; });
|
11070 | var styles$K = {
|
11071 | "button": "pf-c-button",
|
11072 | "emptyState": "pf-c-empty-state",
|
11073 | "emptyStateBody": "pf-c-empty-state__body",
|
11074 | "emptyStateContent": "pf-c-empty-state__content",
|
11075 | "emptyStateIcon": "pf-c-empty-state__icon",
|
11076 | "emptyStatePrimary": "pf-c-empty-state__primary",
|
11077 | "emptyStateSecondary": "pf-c-empty-state__secondary",
|
11078 | "modifiers": {
|
11079 | "xs": "pf-m-xs",
|
11080 | "sm": "pf-m-sm",
|
11081 | "lg": "pf-m-lg",
|
11082 | "xl": "pf-m-xl",
|
11083 | "fullHeight": "pf-m-full-height",
|
11084 | "primary": "pf-m-primary",
|
11085 | "overpassFont": "pf-m-overpass-font"
|
11086 | },
|
11087 | "title": "pf-c-title"
|
11088 | };
|
11089 |
|
11090 | exports.EmptyStateVariant = void 0;
|
11091 | (function (EmptyStateVariant) {
|
11092 | EmptyStateVariant["xs"] = "xs";
|
11093 | EmptyStateVariant["small"] = "small";
|
11094 | EmptyStateVariant["large"] = "large";
|
11095 | EmptyStateVariant["xl"] = "xl";
|
11096 | EmptyStateVariant["full"] = "full";
|
11097 | })(exports.EmptyStateVariant || (exports.EmptyStateVariant = {}));
|
11098 | const EmptyState = (_a) => {
|
11099 | var { children, className = '', variant = exports.EmptyStateVariant.full, isFullHeight } = _a, props = __rest$1(_a, ["children", "className", "variant", "isFullHeight"]);
|
11100 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$K.emptyState, variant === 'xs' && styles$K.modifiers.xs, variant === 'small' && styles$K.modifiers.sm, variant === 'large' && styles$K.modifiers.lg, variant === 'xl' && styles$K.modifiers.xl, isFullHeight && styles$K.modifiers.fullHeight, className) }, props),
|
11101 | React__namespace.createElement("div", { className: css(styles$K.emptyStateContent) }, children)));
|
11102 | };
|
11103 | EmptyState.displayName = 'EmptyState';
|
11104 |
|
11105 | const EmptyStateBody = (_a) => {
|
11106 | var { children, className = '' } = _a, props = __rest$1(_a, ["children", "className"]);
|
11107 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$K.emptyStateBody, className) }, props), children));
|
11108 | };
|
11109 | EmptyStateBody.displayName = 'EmptyStateBody';
|
11110 |
|
11111 | const EmptyStateIcon = (_a) => {
|
11112 | var { className = '', icon: IconComponent, component: AnyComponent, variant = 'icon' } = _a, props = __rest$1(_a, ["className", "icon", "component", "variant"]);
|
11113 | const classNames = css(styles$K.emptyStateIcon, className);
|
11114 | return variant === 'icon' ? (React__namespace.createElement(IconComponent, Object.assign({ className: classNames }, props, { "aria-hidden": "true" }))) : (React__namespace.createElement("div", { className: classNames },
|
11115 | React__namespace.createElement(AnyComponent, null)));
|
11116 | };
|
11117 | EmptyStateIcon.displayName = 'EmptyStateIcon';
|
11118 |
|
11119 | const EmptyStateSecondaryActions = (_a) => {
|
11120 | var { children = null, className = '' } = _a, props = __rest$1(_a, ["children", "className"]);
|
11121 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$K.emptyStateSecondary, className) }, props), children));
|
11122 | };
|
11123 | EmptyStateSecondaryActions.displayName = 'EmptyStateSecondaryActions';
|
11124 |
|
11125 | const EmptyStatePrimary = (_a) => {
|
11126 | var { children, className = '' } = _a, props = __rest$1(_a, ["children", "className"]);
|
11127 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$K.emptyStatePrimary, className) }, props), children));
|
11128 | };
|
11129 | EmptyStatePrimary.displayName = 'EmptyStatePrimary';
|
11130 |
|
11131 | Promise.resolve().then(function () { return expandableSection; });
|
11132 | var styles$J = {
|
11133 | "expandableSection": "pf-c-expandable-section",
|
11134 | "expandableSectionContent": "pf-c-expandable-section__content",
|
11135 | "expandableSectionToggle": "pf-c-expandable-section__toggle",
|
11136 | "expandableSectionToggleIcon": "pf-c-expandable-section__toggle-icon",
|
11137 | "expandableSectionToggleText": "pf-c-expandable-section__toggle-text",
|
11138 | "modifiers": {
|
11139 | "expanded": "pf-m-expanded",
|
11140 | "detached": "pf-m-detached",
|
11141 | "limitWidth": "pf-m-limit-width",
|
11142 | "displayLg": "pf-m-display-lg",
|
11143 | "indented": "pf-m-indented",
|
11144 | "active": "pf-m-active",
|
11145 | "expandTop": "pf-m-expand-top",
|
11146 | "overpassFont": "pf-m-overpass-font"
|
11147 | }
|
11148 | };
|
11149 |
|
11150 | class ExpandableSection extends React__namespace.Component {
|
11151 | constructor(props) {
|
11152 | super(props);
|
11153 | this.state = {
|
11154 | isExpanded: props.isExpanded
|
11155 | };
|
11156 | }
|
11157 | calculateToggleText(toggleText, toggleTextExpanded, toggleTextCollapsed, propOrStateIsExpanded) {
|
11158 | if (propOrStateIsExpanded && toggleTextExpanded !== '') {
|
11159 | return toggleTextExpanded;
|
11160 | }
|
11161 | if (!propOrStateIsExpanded && toggleTextCollapsed !== '') {
|
11162 | return toggleTextCollapsed;
|
11163 | }
|
11164 | return toggleText;
|
11165 | }
|
11166 | render() {
|
11167 | const _a = this.props, { onToggle: onToggleProp,
|
11168 |
|
11169 | isActive, className, toggleText, toggleTextExpanded, toggleTextCollapsed, toggleContent, children, isExpanded, isDetached, displaySize, isWidthLimited, isIndented, contentId } = _a, props = __rest$1(_a, ["onToggle", "isActive", "className", "toggleText", "toggleTextExpanded", "toggleTextCollapsed", "toggleContent", "children", "isExpanded", "isDetached", "displaySize", "isWidthLimited", "isIndented", "contentId"]);
|
11170 | let onToggle = onToggleProp;
|
11171 | let propOrStateIsExpanded = isExpanded;
|
11172 |
|
11173 | if (isExpanded === undefined) {
|
11174 | propOrStateIsExpanded = this.state.isExpanded;
|
11175 | onToggle = isOpen => {
|
11176 | this.setState({ isExpanded: isOpen }, () => onToggleProp(this.state.isExpanded));
|
11177 | };
|
11178 | }
|
11179 | const computedToggleText = this.calculateToggleText(toggleText, toggleTextExpanded, toggleTextCollapsed, propOrStateIsExpanded);
|
11180 | return (React__namespace.createElement("div", Object.assign({}, props, { className: css(styles$J.expandableSection, propOrStateIsExpanded && styles$J.modifiers.expanded, isActive && styles$J.modifiers.active, isDetached && styles$J.modifiers.detached, displaySize === 'large' && styles$J.modifiers.displayLg, isWidthLimited && styles$J.modifiers.limitWidth, isIndented && styles$J.modifiers.indented, className) }),
|
11181 | !isDetached && (React__namespace.createElement("button", { className: css(styles$J.expandableSectionToggle), type: "button", "aria-expanded": propOrStateIsExpanded, onClick: () => onToggle(!propOrStateIsExpanded) },
|
11182 | React__namespace.createElement("span", { className: css(styles$J.expandableSectionToggleIcon) },
|
11183 | React__namespace.createElement(AngleRightIcon$1, { "aria-hidden": true })),
|
11184 | React__namespace.createElement("span", { className: css(styles$J.expandableSectionToggleText) }, toggleContent || computedToggleText))),
|
11185 | React__namespace.createElement("div", { className: css(styles$J.expandableSectionContent), hidden: !propOrStateIsExpanded, id: contentId }, children)));
|
11186 | }
|
11187 | }
|
11188 | ExpandableSection.displayName = 'ExpandableSection';
|
11189 | ExpandableSection.defaultProps = {
|
11190 | className: '',
|
11191 | toggleText: '',
|
11192 | toggleTextExpanded: '',
|
11193 | toggleTextCollapsed: '',
|
11194 |
|
11195 | onToggle: (isExpanded) => undefined,
|
11196 | isActive: false,
|
11197 | isDetached: false,
|
11198 | displaySize: 'default',
|
11199 | isWidthLimited: false,
|
11200 | isIndented: false,
|
11201 | contentId: ''
|
11202 | };
|
11203 |
|
11204 | const ExpandableSectionToggle = (_a) => {
|
11205 | var { children, className = '', isExpanded = false, onToggle, contentId, direction = 'down' } = _a, props = __rest$1(_a, ["children", "className", "isExpanded", "onToggle", "contentId", "direction"]);
|
11206 | return (React__namespace.createElement("div", Object.assign({}, props, { className: css(styles$J.expandableSection, isExpanded && styles$J.modifiers.expanded, styles$J.modifiers.detached, className) }),
|
11207 | React__namespace.createElement("button", { className: css(styles$J.expandableSectionToggle), type: "button", "aria-expanded": isExpanded, "aria-controls": contentId, onClick: () => onToggle(!isExpanded) },
|
11208 | React__namespace.createElement("span", { className: css(styles$J.expandableSectionToggleIcon, isExpanded && direction === 'up' && styles$J.modifiers.expandTop) },
|
11209 | React__namespace.createElement(AngleRightIcon$1, { "aria-hidden": true })),
|
11210 | React__namespace.createElement("span", { className: css(styles$J.expandableSectionToggleText) }, children))));
|
11211 | };
|
11212 | ExpandableSectionToggle.displayName = 'ExpandableSectionToggle';
|
11213 |
|
11214 | Promise.resolve().then(function () { return fileUpload; });
|
11215 | var styles$I = {
|
11216 | "button": "pf-c-button",
|
11217 | "fileUpload": "pf-c-file-upload",
|
11218 | "fileUploadFileDetails": "pf-c-file-upload__file-details",
|
11219 | "fileUploadFileDetailsSpinner": "pf-c-file-upload__file-details-spinner",
|
11220 | "fileUploadFileSelect": "pf-c-file-upload__file-select",
|
11221 | "formControl": "pf-c-form-control",
|
11222 | "modifiers": {
|
11223 | "dragHover": "pf-m-drag-hover",
|
11224 | "loading": "pf-m-loading",
|
11225 | "control": "pf-m-control"
|
11226 | }
|
11227 | };
|
11228 |
|
11229 | var fileReaderType;
|
11230 | (function (fileReaderType) {
|
11231 | fileReaderType["text"] = "text";
|
11232 | fileReaderType["dataURL"] = "dataURL";
|
11233 | })(fileReaderType || (fileReaderType = {}));
|
11234 | |
11235 |
|
11236 |
|
11237 |
|
11238 |
|
11239 |
|
11240 |
|
11241 | function readFile(fileHandle, type) {
|
11242 | return new Promise((resolve, reject) => {
|
11243 | const reader = new FileReader();
|
11244 | reader.onload = () => resolve(reader.result);
|
11245 | reader.onerror = () => reject(reader.error);
|
11246 | if (type === fileReaderType.text) {
|
11247 | reader.readAsText(fileHandle);
|
11248 | }
|
11249 | else if (type === fileReaderType.dataURL) {
|
11250 | reader.readAsDataURL(fileHandle);
|
11251 | }
|
11252 | else {
|
11253 | reject('unknown type');
|
11254 | }
|
11255 | });
|
11256 | }
|
11257 |
|
11258 | const FileUploadField = (_a) => {
|
11259 | var { id, type, value = '', filename = '', onChange = () => { }, onBrowseButtonClick = () => { }, onClearButtonClick = () => { }, onTextAreaClick, onTextChange, className = '', isDisabled = false, isReadOnly = false, isLoading = false, spinnerAriaValueText, isRequired = false, isDragActive = false, validated = 'default', 'aria-label': ariaLabel = 'File upload', filenamePlaceholder = 'Drag a file here or browse to upload', filenameAriaLabel = filename ? 'Read only filename' : filenamePlaceholder, browseButtonText = 'Browse...', clearButtonText = 'Clear', isClearButtonDisabled = !filename && !value, containerRef = null, allowEditingUploadedText = false, hideDefaultPreview = false, children = null } = _a, props = __rest$1(_a, ["id", "type", "value", "filename", "onChange", "onBrowseButtonClick", "onClearButtonClick", "onTextAreaClick", "onTextChange", "className", "isDisabled", "isReadOnly", "isLoading", "spinnerAriaValueText", "isRequired", "isDragActive", "validated", 'aria-label', "filenamePlaceholder", "filenameAriaLabel", "browseButtonText", "clearButtonText", "isClearButtonDisabled", "containerRef", "allowEditingUploadedText", "hideDefaultPreview", "children"]);
|
11260 | const onTextAreaChange = (newValue, event) => {
|
11261 | onChange(newValue, filename, event);
|
11262 | onTextChange === null || onTextChange === void 0 ? void 0 : onTextChange(newValue);
|
11263 | };
|
11264 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$I.fileUpload, isDragActive && styles$I.modifiers.dragHover, isLoading && styles$I.modifiers.loading, className), ref: containerRef }, props),
|
11265 | React__namespace.createElement("div", { className: styles$I.fileUploadFileSelect },
|
11266 | React__namespace.createElement(InputGroup, null,
|
11267 | React__namespace.createElement(TextInput, { isReadOnly
|
11268 | : true, isDisabled: isDisabled, id: `${id}-filename`, name: `${id}-filename`, "aria-label": filenameAriaLabel, placeholder: filenamePlaceholder, "aria-describedby": `${id}-browse-button`, value: filename }),
|
11269 | React__namespace.createElement(Button, { id: `${id}-browse-button`, variant: exports.ButtonVariant.control, onClick: onBrowseButtonClick, isDisabled: isDisabled }, browseButtonText),
|
11270 | React__namespace.createElement(Button, { variant: exports.ButtonVariant.control, isDisabled: isDisabled || isClearButtonDisabled, onClick: onClearButtonClick }, clearButtonText))),
|
11271 | React__namespace.createElement("div", { className: styles$I.fileUploadFileDetails },
|
11272 | !hideDefaultPreview && type === fileReaderType.text && (React__namespace.createElement(TextArea, { readOnly: isReadOnly || (!!filename && !allowEditingUploadedText), disabled: isDisabled, isRequired: isRequired, resizeOrientation: exports.TextAreResizeOrientation.vertical, validated: validated, id: id, name: id, "aria-label": ariaLabel, value: value, onChange: onTextAreaChange, onClick: onTextAreaClick })),
|
11273 | isLoading && (React__namespace.createElement("div", { className: styles$I.fileUploadFileDetailsSpinner },
|
11274 | React__namespace.createElement(Spinner, { size: exports.spinnerSize.lg, "aria-valuetext": spinnerAriaValueText })))),
|
11275 | children));
|
11276 | };
|
11277 | FileUploadField.displayName = 'FileUploadField';
|
11278 |
|
11279 | |
11280 |
|
11281 |
|
11282 |
|
11283 |
|
11284 |
|
11285 |
|
11286 |
|
11287 |
|
11288 |
|
11289 |
|
11290 |
|
11291 |
|
11292 |
|
11293 |
|
11294 | function __awaiter(thisArg, _arguments, P, generator) {
|
11295 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
11296 | return new (P || (P = Promise))(function (resolve, reject) {
|
11297 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
11298 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
11299 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
11300 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
11301 | });
|
11302 | }
|
11303 |
|
11304 | function __generator(thisArg, body) {
|
11305 | var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
11306 | return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
11307 | function verb(n) { return function (v) { return step([n, v]); }; }
|
11308 | function step(op) {
|
11309 | if (f) throw new TypeError("Generator is already executing.");
|
11310 | while (_) try {
|
11311 | if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
11312 | if (y = 0, t) op = [op[0] & 2, t.value];
|
11313 | switch (op[0]) {
|
11314 | case 0: case 1: t = op; break;
|
11315 | case 4: _.label++; return { value: op[1], done: false };
|
11316 | case 5: _.label++; y = op[1]; op = [0]; continue;
|
11317 | case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
11318 | default:
|
11319 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
11320 | if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
11321 | if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
11322 | if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
11323 | if (t[2]) _.ops.pop();
|
11324 | _.trys.pop(); continue;
|
11325 | }
|
11326 | op = body.call(thisArg, _);
|
11327 | } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
11328 | if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
11329 | }
|
11330 | }
|
11331 |
|
11332 | function __read(o, n) {
|
11333 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
11334 | if (!m) return o;
|
11335 | var i = m.call(o), r, ar = [], e;
|
11336 | try {
|
11337 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
11338 | }
|
11339 | catch (error) { e = { error: error }; }
|
11340 | finally {
|
11341 | try {
|
11342 | if (r && !r.done && (m = i["return"])) m.call(i);
|
11343 | }
|
11344 | finally { if (e) throw e.error; }
|
11345 | }
|
11346 | return ar;
|
11347 | }
|
11348 |
|
11349 | function __spread() {
|
11350 | for (var ar = [], i = 0; i < arguments.length; i++)
|
11351 | ar = ar.concat(__read(arguments[i]));
|
11352 | return ar;
|
11353 | }
|
11354 |
|
11355 | var COMMON_MIME_TYPES = new Map([
|
11356 | ['avi', 'video/avi'],
|
11357 | ['gif', 'image/gif'],
|
11358 | ['ico', 'image/x-icon'],
|
11359 | ['jpeg', 'image/jpeg'],
|
11360 | ['jpg', 'image/jpeg'],
|
11361 | ['mkv', 'video/x-matroska'],
|
11362 | ['mov', 'video/quicktime'],
|
11363 | ['mp4', 'video/mp4'],
|
11364 | ['pdf', 'application/pdf'],
|
11365 | ['png', 'image/png'],
|
11366 | ['zip', 'application/zip'],
|
11367 | ['doc', 'application/msword'],
|
11368 | ['docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document']
|
11369 | ]);
|
11370 | function toFileWithPath(file, path) {
|
11371 | var f = withMimeType(file);
|
11372 | if (typeof f.path !== 'string') {
|
11373 | var webkitRelativePath = file.webkitRelativePath;
|
11374 | Object.defineProperty(f, 'path', {
|
11375 | value: typeof path === 'string'
|
11376 | ? path
|
11377 |
|
11378 |
|
11379 |
|
11380 | : typeof webkitRelativePath === 'string' && webkitRelativePath.length > 0
|
11381 | ? webkitRelativePath
|
11382 | : file.name,
|
11383 | writable: false,
|
11384 | configurable: false,
|
11385 | enumerable: true
|
11386 | });
|
11387 | }
|
11388 | return f;
|
11389 | }
|
11390 | function withMimeType(file) {
|
11391 | var name = file.name;
|
11392 | var hasExtension = name && name.lastIndexOf('.') !== -1;
|
11393 | if (hasExtension && !file.type) {
|
11394 | var ext = name.split('.')
|
11395 | .pop().toLowerCase();
|
11396 | var type = COMMON_MIME_TYPES.get(ext);
|
11397 | if (type) {
|
11398 | Object.defineProperty(file, 'type', {
|
11399 | value: type,
|
11400 | writable: false,
|
11401 | configurable: false,
|
11402 | enumerable: true
|
11403 | });
|
11404 | }
|
11405 | }
|
11406 | return file;
|
11407 | }
|
11408 |
|
11409 | var FILES_TO_IGNORE = [
|
11410 |
|
11411 | '.DS_Store',
|
11412 | 'Thumbs.db'
|
11413 | ];
|
11414 | |
11415 |
|
11416 |
|
11417 |
|
11418 |
|
11419 |
|
11420 | function fromEvent(evt) {
|
11421 | return __awaiter(this, void 0, void 0, function () {
|
11422 | return __generator(this, function (_a) {
|
11423 | return [2 , isDragEvt(evt) && evt.dataTransfer
|
11424 | ? getDataTransferFiles(evt.dataTransfer, evt.type)
|
11425 | : getInputFiles(evt)];
|
11426 | });
|
11427 | });
|
11428 | }
|
11429 | function isDragEvt(value) {
|
11430 | return !!value.dataTransfer;
|
11431 | }
|
11432 | function getInputFiles(evt) {
|
11433 | var files = isInput(evt.target)
|
11434 | ? evt.target.files
|
11435 | ? fromList(evt.target.files)
|
11436 | : []
|
11437 | : [];
|
11438 | return files.map(function (file) { return toFileWithPath(file); });
|
11439 | }
|
11440 | function isInput(value) {
|
11441 | return value !== null;
|
11442 | }
|
11443 | function getDataTransferFiles(dt, type) {
|
11444 | return __awaiter(this, void 0, void 0, function () {
|
11445 | var items, files;
|
11446 | return __generator(this, function (_a) {
|
11447 | switch (_a.label) {
|
11448 | case 0:
|
11449 | if (!dt.items) return [3 , 2];
|
11450 | items = fromList(dt.items)
|
11451 | .filter(function (item) { return item.kind === 'file'; });
|
11452 |
|
11453 |
|
11454 | if (type !== 'drop') {
|
11455 | return [2 , items];
|
11456 | }
|
11457 | return [4 , Promise.all(items.map(toFilePromises))];
|
11458 | case 1:
|
11459 | files = _a.sent();
|
11460 | return [2 , noIgnoredFiles(flatten(files))];
|
11461 | case 2: return [2 , noIgnoredFiles(fromList(dt.files)
|
11462 | .map(function (file) { return toFileWithPath(file); }))];
|
11463 | }
|
11464 | });
|
11465 | });
|
11466 | }
|
11467 | function noIgnoredFiles(files) {
|
11468 | return files.filter(function (file) { return FILES_TO_IGNORE.indexOf(file.name) === -1; });
|
11469 | }
|
11470 |
|
11471 |
|
11472 |
|
11473 |
|
11474 | function fromList(items) {
|
11475 | var files = [];
|
11476 |
|
11477 | for (var i = 0; i < items.length; i++) {
|
11478 | var file = items[i];
|
11479 | files.push(file);
|
11480 | }
|
11481 | return files;
|
11482 | }
|
11483 |
|
11484 | function toFilePromises(item) {
|
11485 | if (typeof item.webkitGetAsEntry !== 'function') {
|
11486 | return fromDataTransferItem(item);
|
11487 | }
|
11488 | var entry = item.webkitGetAsEntry();
|
11489 |
|
11490 |
|
11491 |
|
11492 | if (entry && entry.isDirectory) {
|
11493 | return fromDirEntry(entry);
|
11494 | }
|
11495 | return fromDataTransferItem(item);
|
11496 | }
|
11497 | function flatten(items) {
|
11498 | return items.reduce(function (acc, files) { return __spread(acc, (Array.isArray(files) ? flatten(files) : [files])); }, []);
|
11499 | }
|
11500 | function fromDataTransferItem(item) {
|
11501 | var file = item.getAsFile();
|
11502 | if (!file) {
|
11503 | return Promise.reject(item + " is not a File");
|
11504 | }
|
11505 | var fwp = toFileWithPath(file);
|
11506 | return Promise.resolve(fwp);
|
11507 | }
|
11508 |
|
11509 | function fromEntry(entry) {
|
11510 | return __awaiter(this, void 0, void 0, function () {
|
11511 | return __generator(this, function (_a) {
|
11512 | return [2 , entry.isDirectory ? fromDirEntry(entry) : fromFileEntry(entry)];
|
11513 | });
|
11514 | });
|
11515 | }
|
11516 |
|
11517 | function fromDirEntry(entry) {
|
11518 | var reader = entry.createReader();
|
11519 | return new Promise(function (resolve, reject) {
|
11520 | var entries = [];
|
11521 | function readEntries() {
|
11522 | var _this = this;
|
11523 |
|
11524 |
|
11525 | reader.readEntries(function (batch) { return __awaiter(_this, void 0, void 0, function () {
|
11526 | var files, err_1, items;
|
11527 | return __generator(this, function (_a) {
|
11528 | switch (_a.label) {
|
11529 | case 0:
|
11530 | if (!!batch.length) return [3 , 5];
|
11531 | _a.label = 1;
|
11532 | case 1:
|
11533 | _a.trys.push([1, 3, , 4]);
|
11534 | return [4 , Promise.all(entries)];
|
11535 | case 2:
|
11536 | files = _a.sent();
|
11537 | resolve(files);
|
11538 | return [3 , 4];
|
11539 | case 3:
|
11540 | err_1 = _a.sent();
|
11541 | reject(err_1);
|
11542 | return [3 , 4];
|
11543 | case 4: return [3 , 6];
|
11544 | case 5:
|
11545 | items = Promise.all(batch.map(fromEntry));
|
11546 | entries.push(items);
|
11547 |
|
11548 | readEntries();
|
11549 | _a.label = 6;
|
11550 | case 6: return [2 ];
|
11551 | }
|
11552 | });
|
11553 | }); }, function (err) {
|
11554 | reject(err);
|
11555 | });
|
11556 | }
|
11557 | readEntries();
|
11558 | });
|
11559 | }
|
11560 |
|
11561 | function fromFileEntry(entry) {
|
11562 | return __awaiter(this, void 0, void 0, function () {
|
11563 | return __generator(this, function (_a) {
|
11564 | return [2 , new Promise(function (resolve, reject) {
|
11565 | entry.file(function (file) {
|
11566 | var fwp = toFileWithPath(file, entry.fullPath);
|
11567 | resolve(fwp);
|
11568 | }, function (err) {
|
11569 | reject(err);
|
11570 | });
|
11571 | })];
|
11572 | });
|
11573 | });
|
11574 | }
|
11575 |
|
11576 | var propTypes = {exports: {}};
|
11577 |
|
11578 | var reactIs = {exports: {}};
|
11579 |
|
11580 | var reactIs_development = {};
|
11581 |
|
11582 | |
11583 |
|
11584 |
|
11585 |
|
11586 |
|
11587 |
|
11588 |
|
11589 |
|
11590 |
|
11591 | (function (exports) {
|
11592 |
|
11593 |
|
11594 |
|
11595 | {
|
11596 | (function() {
|
11597 |
|
11598 | Object.defineProperty(exports, '__esModule', { value: true });
|
11599 |
|
11600 |
|
11601 |
|
11602 | var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
11603 | var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
11604 | var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
11605 | var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
11606 | var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
11607 | var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
11608 | var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
11609 | var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
11610 |
|
11611 |
|
11612 | var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
11613 | var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
11614 | var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
11615 | var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
11616 | var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
11617 | var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
11618 | var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
11619 | var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
11620 | var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
11621 | var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
11622 |
|
11623 | function isValidElementType(type) {
|
11624 | return typeof type === 'string' || typeof type === 'function' ||
|
11625 | type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE);
|
11626 | }
|
11627 |
|
11628 | |
11629 |
|
11630 |
|
11631 |
|
11632 |
|
11633 |
|
11634 |
|
11635 |
|
11636 |
|
11637 |
|
11638 |
|
11639 |
|
11640 |
|
11641 | var lowPriorityWarningWithoutStack = function () {};
|
11642 |
|
11643 | {
|
11644 | var printWarning = function (format) {
|
11645 | for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
11646 | args[_key - 1] = arguments[_key];
|
11647 | }
|
11648 |
|
11649 | var argIndex = 0;
|
11650 | var message = 'Warning: ' + format.replace(/%s/g, function () {
|
11651 | return args[argIndex++];
|
11652 | });
|
11653 |
|
11654 | if (typeof console !== 'undefined') {
|
11655 | console.warn(message);
|
11656 | }
|
11657 |
|
11658 | try {
|
11659 |
|
11660 |
|
11661 |
|
11662 | throw new Error(message);
|
11663 | } catch (x) {}
|
11664 | };
|
11665 |
|
11666 | lowPriorityWarningWithoutStack = function (condition, format) {
|
11667 | if (format === undefined) {
|
11668 | throw new Error('`lowPriorityWarningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
|
11669 | }
|
11670 |
|
11671 | if (!condition) {
|
11672 | for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
11673 | args[_key2 - 2] = arguments[_key2];
|
11674 | }
|
11675 |
|
11676 | printWarning.apply(void 0, [format].concat(args));
|
11677 | }
|
11678 | };
|
11679 | }
|
11680 |
|
11681 | var lowPriorityWarningWithoutStack$1 = lowPriorityWarningWithoutStack;
|
11682 |
|
11683 | function typeOf(object) {
|
11684 | if (typeof object === 'object' && object !== null) {
|
11685 | var $$typeof = object.$$typeof;
|
11686 |
|
11687 | switch ($$typeof) {
|
11688 | case REACT_ELEMENT_TYPE:
|
11689 | var type = object.type;
|
11690 |
|
11691 | switch (type) {
|
11692 | case REACT_ASYNC_MODE_TYPE:
|
11693 | case REACT_CONCURRENT_MODE_TYPE:
|
11694 | case REACT_FRAGMENT_TYPE:
|
11695 | case REACT_PROFILER_TYPE:
|
11696 | case REACT_STRICT_MODE_TYPE:
|
11697 | case REACT_SUSPENSE_TYPE:
|
11698 | return type;
|
11699 |
|
11700 | default:
|
11701 | var $$typeofType = type && type.$$typeof;
|
11702 |
|
11703 | switch ($$typeofType) {
|
11704 | case REACT_CONTEXT_TYPE:
|
11705 | case REACT_FORWARD_REF_TYPE:
|
11706 | case REACT_PROVIDER_TYPE:
|
11707 | return $$typeofType;
|
11708 |
|
11709 | default:
|
11710 | return $$typeof;
|
11711 | }
|
11712 |
|
11713 | }
|
11714 |
|
11715 | case REACT_LAZY_TYPE:
|
11716 | case REACT_MEMO_TYPE:
|
11717 | case REACT_PORTAL_TYPE:
|
11718 | return $$typeof;
|
11719 | }
|
11720 | }
|
11721 |
|
11722 | return undefined;
|
11723 | }
|
11724 |
|
11725 | var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
11726 | var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
11727 | var ContextConsumer = REACT_CONTEXT_TYPE;
|
11728 | var ContextProvider = REACT_PROVIDER_TYPE;
|
11729 | var Element = REACT_ELEMENT_TYPE;
|
11730 | var ForwardRef = REACT_FORWARD_REF_TYPE;
|
11731 | var Fragment = REACT_FRAGMENT_TYPE;
|
11732 | var Lazy = REACT_LAZY_TYPE;
|
11733 | var Memo = REACT_MEMO_TYPE;
|
11734 | var Portal = REACT_PORTAL_TYPE;
|
11735 | var Profiler = REACT_PROFILER_TYPE;
|
11736 | var StrictMode = REACT_STRICT_MODE_TYPE;
|
11737 | var Suspense = REACT_SUSPENSE_TYPE;
|
11738 | var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
11739 |
|
11740 | function isAsyncMode(object) {
|
11741 | {
|
11742 | if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
11743 | hasWarnedAboutDeprecatedIsAsyncMode = true;
|
11744 | lowPriorityWarningWithoutStack$1(false, 'The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
|
11745 | }
|
11746 | }
|
11747 |
|
11748 | return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
11749 | }
|
11750 | function isConcurrentMode(object) {
|
11751 | return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
11752 | }
|
11753 | function isContextConsumer(object) {
|
11754 | return typeOf(object) === REACT_CONTEXT_TYPE;
|
11755 | }
|
11756 | function isContextProvider(object) {
|
11757 | return typeOf(object) === REACT_PROVIDER_TYPE;
|
11758 | }
|
11759 | function isElement(object) {
|
11760 | return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
11761 | }
|
11762 | function isForwardRef(object) {
|
11763 | return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
11764 | }
|
11765 | function isFragment(object) {
|
11766 | return typeOf(object) === REACT_FRAGMENT_TYPE;
|
11767 | }
|
11768 | function isLazy(object) {
|
11769 | return typeOf(object) === REACT_LAZY_TYPE;
|
11770 | }
|
11771 | function isMemo(object) {
|
11772 | return typeOf(object) === REACT_MEMO_TYPE;
|
11773 | }
|
11774 | function isPortal(object) {
|
11775 | return typeOf(object) === REACT_PORTAL_TYPE;
|
11776 | }
|
11777 | function isProfiler(object) {
|
11778 | return typeOf(object) === REACT_PROFILER_TYPE;
|
11779 | }
|
11780 | function isStrictMode(object) {
|
11781 | return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
11782 | }
|
11783 | function isSuspense(object) {
|
11784 | return typeOf(object) === REACT_SUSPENSE_TYPE;
|
11785 | }
|
11786 |
|
11787 | exports.typeOf = typeOf;
|
11788 | exports.AsyncMode = AsyncMode;
|
11789 | exports.ConcurrentMode = ConcurrentMode;
|
11790 | exports.ContextConsumer = ContextConsumer;
|
11791 | exports.ContextProvider = ContextProvider;
|
11792 | exports.Element = Element;
|
11793 | exports.ForwardRef = ForwardRef;
|
11794 | exports.Fragment = Fragment;
|
11795 | exports.Lazy = Lazy;
|
11796 | exports.Memo = Memo;
|
11797 | exports.Portal = Portal;
|
11798 | exports.Profiler = Profiler;
|
11799 | exports.StrictMode = StrictMode;
|
11800 | exports.Suspense = Suspense;
|
11801 | exports.isValidElementType = isValidElementType;
|
11802 | exports.isAsyncMode = isAsyncMode;
|
11803 | exports.isConcurrentMode = isConcurrentMode;
|
11804 | exports.isContextConsumer = isContextConsumer;
|
11805 | exports.isContextProvider = isContextProvider;
|
11806 | exports.isElement = isElement;
|
11807 | exports.isForwardRef = isForwardRef;
|
11808 | exports.isFragment = isFragment;
|
11809 | exports.isLazy = isLazy;
|
11810 | exports.isMemo = isMemo;
|
11811 | exports.isPortal = isPortal;
|
11812 | exports.isProfiler = isProfiler;
|
11813 | exports.isStrictMode = isStrictMode;
|
11814 | exports.isSuspense = isSuspense;
|
11815 | })();
|
11816 | }
|
11817 | }(reactIs_development));
|
11818 |
|
11819 | {
|
11820 | reactIs.exports = reactIs_development;
|
11821 | }
|
11822 |
|
11823 | |
11824 |
|
11825 |
|
11826 |
|
11827 |
|
11828 |
|
11829 | var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
11830 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
11831 | var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
11832 |
|
11833 | function toObject(val) {
|
11834 | if (val === null || val === undefined) {
|
11835 | throw new TypeError('Object.assign cannot be called with null or undefined');
|
11836 | }
|
11837 |
|
11838 | return Object(val);
|
11839 | }
|
11840 |
|
11841 | function shouldUseNative() {
|
11842 | try {
|
11843 | if (!Object.assign) {
|
11844 | return false;
|
11845 | }
|
11846 |
|
11847 |
|
11848 |
|
11849 |
|
11850 | var test1 = new String('abc');
|
11851 | test1[5] = 'de';
|
11852 | if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
11853 | return false;
|
11854 | }
|
11855 |
|
11856 |
|
11857 | var test2 = {};
|
11858 | for (var i = 0; i < 10; i++) {
|
11859 | test2['_' + String.fromCharCode(i)] = i;
|
11860 | }
|
11861 | var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
11862 | return test2[n];
|
11863 | });
|
11864 | if (order2.join('') !== '0123456789') {
|
11865 | return false;
|
11866 | }
|
11867 |
|
11868 |
|
11869 | var test3 = {};
|
11870 | 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
11871 | test3[letter] = letter;
|
11872 | });
|
11873 | if (Object.keys(Object.assign({}, test3)).join('') !==
|
11874 | 'abcdefghijklmnopqrst') {
|
11875 | return false;
|
11876 | }
|
11877 |
|
11878 | return true;
|
11879 | } catch (err) {
|
11880 |
|
11881 | return false;
|
11882 | }
|
11883 | }
|
11884 |
|
11885 | var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
11886 | var from;
|
11887 | var to = toObject(target);
|
11888 | var symbols;
|
11889 |
|
11890 | for (var s = 1; s < arguments.length; s++) {
|
11891 | from = Object(arguments[s]);
|
11892 |
|
11893 | for (var key in from) {
|
11894 | if (hasOwnProperty.call(from, key)) {
|
11895 | to[key] = from[key];
|
11896 | }
|
11897 | }
|
11898 |
|
11899 | if (getOwnPropertySymbols) {
|
11900 | symbols = getOwnPropertySymbols(from);
|
11901 | for (var i = 0; i < symbols.length; i++) {
|
11902 | if (propIsEnumerable.call(from, symbols[i])) {
|
11903 | to[symbols[i]] = from[symbols[i]];
|
11904 | }
|
11905 | }
|
11906 | }
|
11907 | }
|
11908 |
|
11909 | return to;
|
11910 | };
|
11911 |
|
11912 | |
11913 |
|
11914 |
|
11915 |
|
11916 |
|
11917 |
|
11918 |
|
11919 | var ReactPropTypesSecret$2 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
11920 |
|
11921 | var ReactPropTypesSecret_1 = ReactPropTypesSecret$2;
|
11922 |
|
11923 | |
11924 |
|
11925 |
|
11926 |
|
11927 |
|
11928 |
|
11929 |
|
11930 | var printWarning$1 = function() {};
|
11931 |
|
11932 | {
|
11933 | var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
|
11934 | var loggedTypeFailures = {};
|
11935 | var has$1 = Function.call.bind(Object.prototype.hasOwnProperty);
|
11936 |
|
11937 | printWarning$1 = function(text) {
|
11938 | var message = 'Warning: ' + text;
|
11939 | if (typeof console !== 'undefined') {
|
11940 | console.error(message);
|
11941 | }
|
11942 | try {
|
11943 |
|
11944 |
|
11945 |
|
11946 | throw new Error(message);
|
11947 | } catch (x) {}
|
11948 | };
|
11949 | }
|
11950 |
|
11951 | |
11952 |
|
11953 |
|
11954 |
|
11955 |
|
11956 |
|
11957 |
|
11958 |
|
11959 |
|
11960 |
|
11961 |
|
11962 | function checkPropTypes$1(typeSpecs, values, location, componentName, getStack) {
|
11963 | {
|
11964 | for (var typeSpecName in typeSpecs) {
|
11965 | if (has$1(typeSpecs, typeSpecName)) {
|
11966 | var error;
|
11967 |
|
11968 |
|
11969 |
|
11970 | try {
|
11971 |
|
11972 |
|
11973 | if (typeof typeSpecs[typeSpecName] !== 'function') {
|
11974 | var err = Error(
|
11975 | (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
11976 | 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
|
11977 | );
|
11978 | err.name = 'Invariant Violation';
|
11979 | throw err;
|
11980 | }
|
11981 | error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1);
|
11982 | } catch (ex) {
|
11983 | error = ex;
|
11984 | }
|
11985 | if (error && !(error instanceof Error)) {
|
11986 | printWarning$1(
|
11987 | (componentName || 'React class') + ': type specification of ' +
|
11988 | location + ' `' + typeSpecName + '` is invalid; the type checker ' +
|
11989 | 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
|
11990 | 'You may have forgotten to pass an argument to the type checker ' +
|
11991 | 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
11992 | 'shape all require an argument).'
|
11993 | );
|
11994 | }
|
11995 | if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
11996 |
|
11997 |
|
11998 | loggedTypeFailures[error.message] = true;
|
11999 |
|
12000 | var stack = getStack ? getStack() : '';
|
12001 |
|
12002 | printWarning$1(
|
12003 | 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
|
12004 | );
|
12005 | }
|
12006 | }
|
12007 | }
|
12008 | }
|
12009 | }
|
12010 |
|
12011 | |
12012 |
|
12013 |
|
12014 |
|
12015 |
|
12016 | checkPropTypes$1.resetWarningCache = function() {
|
12017 | {
|
12018 | loggedTypeFailures = {};
|
12019 | }
|
12020 | };
|
12021 |
|
12022 | var checkPropTypes_1 = checkPropTypes$1;
|
12023 |
|
12024 | |
12025 |
|
12026 |
|
12027 |
|
12028 |
|
12029 |
|
12030 |
|
12031 | var ReactIs$1 = reactIs.exports;
|
12032 | var assign = objectAssign;
|
12033 |
|
12034 | var ReactPropTypesSecret = ReactPropTypesSecret_1;
|
12035 | var checkPropTypes = checkPropTypes_1;
|
12036 |
|
12037 | var has = Function.call.bind(Object.prototype.hasOwnProperty);
|
12038 | var printWarning = function() {};
|
12039 |
|
12040 | {
|
12041 | printWarning = function(text) {
|
12042 | var message = 'Warning: ' + text;
|
12043 | if (typeof console !== 'undefined') {
|
12044 | console.error(message);
|
12045 | }
|
12046 | try {
|
12047 |
|
12048 |
|
12049 |
|
12050 | throw new Error(message);
|
12051 | } catch (x) {}
|
12052 | };
|
12053 | }
|
12054 |
|
12055 | function emptyFunctionThatReturnsNull() {
|
12056 | return null;
|
12057 | }
|
12058 |
|
12059 | var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
12060 |
|
12061 | var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
12062 | var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
12063 |
|
12064 | |
12065 |
|
12066 |
|
12067 |
|
12068 |
|
12069 |
|
12070 |
|
12071 |
|
12072 |
|
12073 |
|
12074 |
|
12075 |
|
12076 |
|
12077 |
|
12078 | function getIteratorFn(maybeIterable) {
|
12079 | var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
12080 | if (typeof iteratorFn === 'function') {
|
12081 | return iteratorFn;
|
12082 | }
|
12083 | }
|
12084 |
|
12085 | |
12086 |
|
12087 |
|
12088 |
|
12089 |
|
12090 |
|
12091 |
|
12092 |
|
12093 |
|
12094 |
|
12095 |
|
12096 |
|
12097 |
|
12098 |
|
12099 |
|
12100 |
|
12101 |
|
12102 |
|
12103 |
|
12104 |
|
12105 |
|
12106 |
|
12107 |
|
12108 |
|
12109 |
|
12110 |
|
12111 |
|
12112 |
|
12113 |
|
12114 |
|
12115 |
|
12116 |
|
12117 |
|
12118 |
|
12119 |
|
12120 |
|
12121 |
|
12122 |
|
12123 |
|
12124 |
|
12125 |
|
12126 |
|
12127 |
|
12128 |
|
12129 |
|
12130 |
|
12131 |
|
12132 | var ANONYMOUS = '<<anonymous>>';
|
12133 |
|
12134 |
|
12135 |
|
12136 | var ReactPropTypes = {
|
12137 | array: createPrimitiveTypeChecker('array'),
|
12138 | bool: createPrimitiveTypeChecker('boolean'),
|
12139 | func: createPrimitiveTypeChecker('function'),
|
12140 | number: createPrimitiveTypeChecker('number'),
|
12141 | object: createPrimitiveTypeChecker('object'),
|
12142 | string: createPrimitiveTypeChecker('string'),
|
12143 | symbol: createPrimitiveTypeChecker('symbol'),
|
12144 |
|
12145 | any: createAnyTypeChecker(),
|
12146 | arrayOf: createArrayOfTypeChecker,
|
12147 | element: createElementTypeChecker(),
|
12148 | elementType: createElementTypeTypeChecker(),
|
12149 | instanceOf: createInstanceTypeChecker,
|
12150 | node: createNodeChecker(),
|
12151 | objectOf: createObjectOfTypeChecker,
|
12152 | oneOf: createEnumTypeChecker,
|
12153 | oneOfType: createUnionTypeChecker,
|
12154 | shape: createShapeTypeChecker,
|
12155 | exact: createStrictShapeTypeChecker,
|
12156 | };
|
12157 |
|
12158 | |
12159 |
|
12160 |
|
12161 |
|
12162 |
|
12163 | function is(x, y) {
|
12164 |
|
12165 | if (x === y) {
|
12166 |
|
12167 |
|
12168 | return x !== 0 || 1 / x === 1 / y;
|
12169 | } else {
|
12170 |
|
12171 | return x !== x && y !== y;
|
12172 | }
|
12173 | }
|
12174 |
|
12175 |
|
12176 | |
12177 |
|
12178 |
|
12179 |
|
12180 |
|
12181 |
|
12182 |
|
12183 | function PropTypeError(message) {
|
12184 | this.message = message;
|
12185 | this.stack = '';
|
12186 | }
|
12187 |
|
12188 | PropTypeError.prototype = Error.prototype;
|
12189 |
|
12190 | function createChainableTypeChecker(validate) {
|
12191 | {
|
12192 | var manualPropTypeCallCache = {};
|
12193 | var manualPropTypeWarningCount = 0;
|
12194 | }
|
12195 | function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
12196 | componentName = componentName || ANONYMOUS;
|
12197 | propFullName = propFullName || propName;
|
12198 |
|
12199 | if (secret !== ReactPropTypesSecret) {
|
12200 | if (throwOnDirectAccess) {
|
12201 |
|
12202 | var err = new Error(
|
12203 | 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
12204 | 'Use `PropTypes.checkPropTypes()` to call them. ' +
|
12205 | 'Read more at http://fb.me/use-check-prop-types'
|
12206 | );
|
12207 | err.name = 'Invariant Violation';
|
12208 | throw err;
|
12209 | } else if (typeof console !== 'undefined') {
|
12210 |
|
12211 | var cacheKey = componentName + ':' + propName;
|
12212 | if (
|
12213 | !manualPropTypeCallCache[cacheKey] &&
|
12214 |
|
12215 | manualPropTypeWarningCount < 3
|
12216 | ) {
|
12217 | printWarning(
|
12218 | 'You are manually calling a React.PropTypes validation ' +
|
12219 | 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
|
12220 | 'and will throw in the standalone `prop-types` package. ' +
|
12221 | 'You may be seeing this warning due to a third-party PropTypes ' +
|
12222 | 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
|
12223 | );
|
12224 | manualPropTypeCallCache[cacheKey] = true;
|
12225 | manualPropTypeWarningCount++;
|
12226 | }
|
12227 | }
|
12228 | }
|
12229 | if (props[propName] == null) {
|
12230 | if (isRequired) {
|
12231 | if (props[propName] === null) {
|
12232 | return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
12233 | }
|
12234 | return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
12235 | }
|
12236 | return null;
|
12237 | } else {
|
12238 | return validate(props, propName, componentName, location, propFullName);
|
12239 | }
|
12240 | }
|
12241 |
|
12242 | var chainedCheckType = checkType.bind(null, false);
|
12243 | chainedCheckType.isRequired = checkType.bind(null, true);
|
12244 |
|
12245 | return chainedCheckType;
|
12246 | }
|
12247 |
|
12248 | function createPrimitiveTypeChecker(expectedType) {
|
12249 | function validate(props, propName, componentName, location, propFullName, secret) {
|
12250 | var propValue = props[propName];
|
12251 | var propType = getPropType(propValue);
|
12252 | if (propType !== expectedType) {
|
12253 |
|
12254 |
|
12255 |
|
12256 | var preciseType = getPreciseType(propValue);
|
12257 |
|
12258 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
|
12259 | }
|
12260 | return null;
|
12261 | }
|
12262 | return createChainableTypeChecker(validate);
|
12263 | }
|
12264 |
|
12265 | function createAnyTypeChecker() {
|
12266 | return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
12267 | }
|
12268 |
|
12269 | function createArrayOfTypeChecker(typeChecker) {
|
12270 | function validate(props, propName, componentName, location, propFullName) {
|
12271 | if (typeof typeChecker !== 'function') {
|
12272 | return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
12273 | }
|
12274 | var propValue = props[propName];
|
12275 | if (!Array.isArray(propValue)) {
|
12276 | var propType = getPropType(propValue);
|
12277 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
12278 | }
|
12279 | for (var i = 0; i < propValue.length; i++) {
|
12280 | var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
|
12281 | if (error instanceof Error) {
|
12282 | return error;
|
12283 | }
|
12284 | }
|
12285 | return null;
|
12286 | }
|
12287 | return createChainableTypeChecker(validate);
|
12288 | }
|
12289 |
|
12290 | function createElementTypeChecker() {
|
12291 | function validate(props, propName, componentName, location, propFullName) {
|
12292 | var propValue = props[propName];
|
12293 | if (!isValidElement(propValue)) {
|
12294 | var propType = getPropType(propValue);
|
12295 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
12296 | }
|
12297 | return null;
|
12298 | }
|
12299 | return createChainableTypeChecker(validate);
|
12300 | }
|
12301 |
|
12302 | function createElementTypeTypeChecker() {
|
12303 | function validate(props, propName, componentName, location, propFullName) {
|
12304 | var propValue = props[propName];
|
12305 | if (!ReactIs$1.isValidElementType(propValue)) {
|
12306 | var propType = getPropType(propValue);
|
12307 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
|
12308 | }
|
12309 | return null;
|
12310 | }
|
12311 | return createChainableTypeChecker(validate);
|
12312 | }
|
12313 |
|
12314 | function createInstanceTypeChecker(expectedClass) {
|
12315 | function validate(props, propName, componentName, location, propFullName) {
|
12316 | if (!(props[propName] instanceof expectedClass)) {
|
12317 | var expectedClassName = expectedClass.name || ANONYMOUS;
|
12318 | var actualClassName = getClassName(props[propName]);
|
12319 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
12320 | }
|
12321 | return null;
|
12322 | }
|
12323 | return createChainableTypeChecker(validate);
|
12324 | }
|
12325 |
|
12326 | function createEnumTypeChecker(expectedValues) {
|
12327 | if (!Array.isArray(expectedValues)) {
|
12328 | {
|
12329 | if (arguments.length > 1) {
|
12330 | printWarning(
|
12331 | 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
|
12332 | 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
|
12333 | );
|
12334 | } else {
|
12335 | printWarning('Invalid argument supplied to oneOf, expected an array.');
|
12336 | }
|
12337 | }
|
12338 | return emptyFunctionThatReturnsNull;
|
12339 | }
|
12340 |
|
12341 | function validate(props, propName, componentName, location, propFullName) {
|
12342 | var propValue = props[propName];
|
12343 | for (var i = 0; i < expectedValues.length; i++) {
|
12344 | if (is(propValue, expectedValues[i])) {
|
12345 | return null;
|
12346 | }
|
12347 | }
|
12348 |
|
12349 | var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
12350 | var type = getPreciseType(value);
|
12351 | if (type === 'symbol') {
|
12352 | return String(value);
|
12353 | }
|
12354 | return value;
|
12355 | });
|
12356 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
12357 | }
|
12358 | return createChainableTypeChecker(validate);
|
12359 | }
|
12360 |
|
12361 | function createObjectOfTypeChecker(typeChecker) {
|
12362 | function validate(props, propName, componentName, location, propFullName) {
|
12363 | if (typeof typeChecker !== 'function') {
|
12364 | return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
12365 | }
|
12366 | var propValue = props[propName];
|
12367 | var propType = getPropType(propValue);
|
12368 | if (propType !== 'object') {
|
12369 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
12370 | }
|
12371 | for (var key in propValue) {
|
12372 | if (has(propValue, key)) {
|
12373 | var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
12374 | if (error instanceof Error) {
|
12375 | return error;
|
12376 | }
|
12377 | }
|
12378 | }
|
12379 | return null;
|
12380 | }
|
12381 | return createChainableTypeChecker(validate);
|
12382 | }
|
12383 |
|
12384 | function createUnionTypeChecker(arrayOfTypeCheckers) {
|
12385 | if (!Array.isArray(arrayOfTypeCheckers)) {
|
12386 | printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') ;
|
12387 | return emptyFunctionThatReturnsNull;
|
12388 | }
|
12389 |
|
12390 | for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
12391 | var checker = arrayOfTypeCheckers[i];
|
12392 | if (typeof checker !== 'function') {
|
12393 | printWarning(
|
12394 | 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
|
12395 | 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
|
12396 | );
|
12397 | return emptyFunctionThatReturnsNull;
|
12398 | }
|
12399 | }
|
12400 |
|
12401 | function validate(props, propName, componentName, location, propFullName) {
|
12402 | for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
12403 | var checker = arrayOfTypeCheckers[i];
|
12404 | if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
|
12405 | return null;
|
12406 | }
|
12407 | }
|
12408 |
|
12409 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
|
12410 | }
|
12411 | return createChainableTypeChecker(validate);
|
12412 | }
|
12413 |
|
12414 | function createNodeChecker() {
|
12415 | function validate(props, propName, componentName, location, propFullName) {
|
12416 | if (!isNode(props[propName])) {
|
12417 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
12418 | }
|
12419 | return null;
|
12420 | }
|
12421 | return createChainableTypeChecker(validate);
|
12422 | }
|
12423 |
|
12424 | function createShapeTypeChecker(shapeTypes) {
|
12425 | function validate(props, propName, componentName, location, propFullName) {
|
12426 | var propValue = props[propName];
|
12427 | var propType = getPropType(propValue);
|
12428 | if (propType !== 'object') {
|
12429 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
12430 | }
|
12431 | for (var key in shapeTypes) {
|
12432 | var checker = shapeTypes[key];
|
12433 | if (!checker) {
|
12434 | continue;
|
12435 | }
|
12436 | var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
12437 | if (error) {
|
12438 | return error;
|
12439 | }
|
12440 | }
|
12441 | return null;
|
12442 | }
|
12443 | return createChainableTypeChecker(validate);
|
12444 | }
|
12445 |
|
12446 | function createStrictShapeTypeChecker(shapeTypes) {
|
12447 | function validate(props, propName, componentName, location, propFullName) {
|
12448 | var propValue = props[propName];
|
12449 | var propType = getPropType(propValue);
|
12450 | if (propType !== 'object') {
|
12451 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
12452 | }
|
12453 |
|
12454 |
|
12455 | var allKeys = assign({}, props[propName], shapeTypes);
|
12456 | for (var key in allKeys) {
|
12457 | var checker = shapeTypes[key];
|
12458 | if (!checker) {
|
12459 | return new PropTypeError(
|
12460 | 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
|
12461 | '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
12462 | '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
12463 | );
|
12464 | }
|
12465 | var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
12466 | if (error) {
|
12467 | return error;
|
12468 | }
|
12469 | }
|
12470 | return null;
|
12471 | }
|
12472 |
|
12473 | return createChainableTypeChecker(validate);
|
12474 | }
|
12475 |
|
12476 | function isNode(propValue) {
|
12477 | switch (typeof propValue) {
|
12478 | case 'number':
|
12479 | case 'string':
|
12480 | case 'undefined':
|
12481 | return true;
|
12482 | case 'boolean':
|
12483 | return !propValue;
|
12484 | case 'object':
|
12485 | if (Array.isArray(propValue)) {
|
12486 | return propValue.every(isNode);
|
12487 | }
|
12488 | if (propValue === null || isValidElement(propValue)) {
|
12489 | return true;
|
12490 | }
|
12491 |
|
12492 | var iteratorFn = getIteratorFn(propValue);
|
12493 | if (iteratorFn) {
|
12494 | var iterator = iteratorFn.call(propValue);
|
12495 | var step;
|
12496 | if (iteratorFn !== propValue.entries) {
|
12497 | while (!(step = iterator.next()).done) {
|
12498 | if (!isNode(step.value)) {
|
12499 | return false;
|
12500 | }
|
12501 | }
|
12502 | } else {
|
12503 |
|
12504 | while (!(step = iterator.next()).done) {
|
12505 | var entry = step.value;
|
12506 | if (entry) {
|
12507 | if (!isNode(entry[1])) {
|
12508 | return false;
|
12509 | }
|
12510 | }
|
12511 | }
|
12512 | }
|
12513 | } else {
|
12514 | return false;
|
12515 | }
|
12516 |
|
12517 | return true;
|
12518 | default:
|
12519 | return false;
|
12520 | }
|
12521 | }
|
12522 |
|
12523 | function isSymbol(propType, propValue) {
|
12524 |
|
12525 | if (propType === 'symbol') {
|
12526 | return true;
|
12527 | }
|
12528 |
|
12529 |
|
12530 | if (!propValue) {
|
12531 | return false;
|
12532 | }
|
12533 |
|
12534 |
|
12535 | if (propValue['@@toStringTag'] === 'Symbol') {
|
12536 | return true;
|
12537 | }
|
12538 |
|
12539 |
|
12540 | if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
12541 | return true;
|
12542 | }
|
12543 |
|
12544 | return false;
|
12545 | }
|
12546 |
|
12547 |
|
12548 | function getPropType(propValue) {
|
12549 | var propType = typeof propValue;
|
12550 | if (Array.isArray(propValue)) {
|
12551 | return 'array';
|
12552 | }
|
12553 | if (propValue instanceof RegExp) {
|
12554 |
|
12555 |
|
12556 |
|
12557 | return 'object';
|
12558 | }
|
12559 | if (isSymbol(propType, propValue)) {
|
12560 | return 'symbol';
|
12561 | }
|
12562 | return propType;
|
12563 | }
|
12564 |
|
12565 |
|
12566 |
|
12567 | function getPreciseType(propValue) {
|
12568 | if (typeof propValue === 'undefined' || propValue === null) {
|
12569 | return '' + propValue;
|
12570 | }
|
12571 | var propType = getPropType(propValue);
|
12572 | if (propType === 'object') {
|
12573 | if (propValue instanceof Date) {
|
12574 | return 'date';
|
12575 | } else if (propValue instanceof RegExp) {
|
12576 | return 'regexp';
|
12577 | }
|
12578 | }
|
12579 | return propType;
|
12580 | }
|
12581 |
|
12582 |
|
12583 |
|
12584 | function getPostfixForTypeWarning(value) {
|
12585 | var type = getPreciseType(value);
|
12586 | switch (type) {
|
12587 | case 'array':
|
12588 | case 'object':
|
12589 | return 'an ' + type;
|
12590 | case 'boolean':
|
12591 | case 'date':
|
12592 | case 'regexp':
|
12593 | return 'a ' + type;
|
12594 | default:
|
12595 | return type;
|
12596 | }
|
12597 | }
|
12598 |
|
12599 |
|
12600 | function getClassName(propValue) {
|
12601 | if (!propValue.constructor || !propValue.constructor.name) {
|
12602 | return ANONYMOUS;
|
12603 | }
|
12604 | return propValue.constructor.name;
|
12605 | }
|
12606 |
|
12607 | ReactPropTypes.checkPropTypes = checkPropTypes;
|
12608 | ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
|
12609 | ReactPropTypes.PropTypes = ReactPropTypes;
|
12610 |
|
12611 | return ReactPropTypes;
|
12612 | };
|
12613 |
|
12614 | |
12615 |
|
12616 |
|
12617 |
|
12618 |
|
12619 |
|
12620 |
|
12621 | {
|
12622 | var ReactIs = reactIs.exports;
|
12623 |
|
12624 |
|
12625 |
|
12626 | var throwOnDirectAccess = true;
|
12627 | propTypes.exports = factoryWithTypeCheckers(ReactIs.isElement, throwOnDirectAccess);
|
12628 | }
|
12629 |
|
12630 | var PropTypes = propTypes.exports;
|
12631 |
|
12632 | var dist=function(t){function n(e){if(r[e])return r[e].exports;var o=r[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var r={};return n.m=t,n.c=r,n.d=function(t,r,e){n.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:e});},n.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(r,"a",r),r},n.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},n.p="",n(n.s=13)}([function(t,n){var r=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r);},function(t,n){t.exports=function(t){return "object"==typeof t?null!==t:"function"==typeof t};},function(t,n){var r=t.exports={version:"2.5.0"};"number"==typeof __e&&(__e=r);},function(t,n,r){t.exports=!r(4)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a});},function(t,n){t.exports=function(t){try{return !!t()}catch(t){return !0}};},function(t,n){var r={}.toString;t.exports=function(t){return r.call(t).slice(8,-1)};},function(t,n,r){var e=r(32)("wks"),o=r(9),i=r(0).Symbol,u="function"==typeof i;(t.exports=function(t){return e[t]||(e[t]=u&&i[t]||(u?i:o)("Symbol."+t))}).store=e;},function(t,n,r){var e=r(0),o=r(2),i=r(8),u=r(22),c=r(10),f=function(t,n,r){var a,s,p,l,v=t&f.F,y=t&f.G,h=t&f.S,d=t&f.P,x=t&f.B,g=y?e:h?e[n]||(e[n]={}):(e[n]||{}).prototype,m=y?o:o[n]||(o[n]={}),b=m.prototype||(m.prototype={});y&&(r=n);for(a in r)s=!v&&g&&void 0!==g[a],p=(s?g:r)[a],l=x&&s?c(p,e):d&&"function"==typeof p?c(Function.call,p):p,g&&u(g,a,p,t&f.U),m[a]!=p&&i(m,a,l),d&&b[a]!=p&&(b[a]=p);};e.core=o,f.F=1,f.G=2,f.S=4,f.P=8,f.B=16,f.W=32,f.U=64,f.R=128,t.exports=f;},function(t,n,r){var e=r(16),o=r(21);t.exports=r(3)?function(t,n,r){return e.f(t,n,o(1,r))}:function(t,n,r){return t[n]=r,t};},function(t,n){var r=0,e=Math.random();t.exports=function(t){return "Symbol(".concat(void 0===t?"":t,")_",(++r+e).toString(36))};},function(t,n,r){var e=r(24);t.exports=function(t,n,r){if(e(t),void 0===n)return t;switch(r){case 1:return function(r){return t.call(n,r)};case 2:return function(r,e){return t.call(n,r,e)};case 3:return function(r,e,o){return t.call(n,r,e,o)}}return function(){return t.apply(n,arguments)}};},function(t,n){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t};},function(t,n,r){var e=r(28),o=Math.min;t.exports=function(t){return t>0?o(e(t),9007199254740991):0};},function(t,n,r){n.__esModule=!0,n.default=function(t,n){if(t&&n){var r=Array.isArray(n)?n:n.split(","),e=t.name||"",o=t.type||"",i=o.replace(/\/.*$/,"");return r.some(function(t){var n=t.trim();return "."===n.charAt(0)?e.toLowerCase().endsWith(n.toLowerCase()):n.endsWith("/*")?i===n.replace(/\/.*$/,""):o===n})}return !0},r(14),r(34);},function(t,n,r){r(15),t.exports=r(2).Array.some;},function(t,n,r){var e=r(7),o=r(25)(3);e(e.P+e.F*!r(33)([].some,!0),"Array",{some:function(t){return o(this,t,arguments[1])}});},function(t,n,r){var e=r(17),o=r(18),i=r(20),u=Object.defineProperty;n.f=r(3)?Object.defineProperty:function(t,n,r){if(e(t),n=i(n,!0),e(r),o)try{return u(t,n,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return "value"in r&&(t[n]=r.value),t};},function(t,n,r){var e=r(1);t.exports=function(t){if(!e(t))throw TypeError(t+" is not an object!");return t};},function(t,n,r){t.exports=!r(3)&&!r(4)(function(){return 7!=Object.defineProperty(r(19)("div"),"a",{get:function(){return 7}}).a});},function(t,n,r){var e=r(1),o=r(0).document,i=e(o)&&e(o.createElement);t.exports=function(t){return i?o.createElement(t):{}};},function(t,n,r){var e=r(1);t.exports=function(t,n){if(!e(t))return t;var r,o;if(n&&"function"==typeof(r=t.toString)&&!e(o=r.call(t)))return o;if("function"==typeof(r=t.valueOf)&&!e(o=r.call(t)))return o;if(!n&&"function"==typeof(r=t.toString)&&!e(o=r.call(t)))return o;throw TypeError("Can't convert object to primitive value")};},function(t,n){t.exports=function(t,n){return {enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}};},function(t,n,r){var e=r(0),o=r(8),i=r(23),u=r(9)("src"),c=Function.toString,f=(""+c).split("toString");r(2).inspectSource=function(t){return c.call(t)},(t.exports=function(t,n,r,c){var a="function"==typeof r;a&&(i(r,"name")||o(r,"name",n)),t[n]!==r&&(a&&(i(r,u)||o(r,u,t[n]?""+t[n]:f.join(String(n)))),t===e?t[n]=r:c?t[n]?t[n]=r:o(t,n,r):(delete t[n],o(t,n,r)));})(Function.prototype,"toString",function(){return "function"==typeof this&&this[u]||c.call(this)});},function(t,n){var r={}.hasOwnProperty;t.exports=function(t,n){return r.call(t,n)};},function(t,n){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t};},function(t,n,r){var e=r(10),o=r(26),i=r(27),u=r(12),c=r(29);t.exports=function(t,n){var r=1==t,f=2==t,a=3==t,s=4==t,p=6==t,l=5==t||p,v=n||c;return function(n,c,y){for(var h,d,x=i(n),g=o(x),m=e(c,y,3),b=u(g.length),_=0,w=r?v(n,b):f?v(n,0):void 0;b>_;_++)if((l||_ in g)&&(h=g[_],d=m(h,_,x),t))if(r)w[_]=d;else if(d)switch(t){case 3:return !0;case 5:return h;case 6:return _;case 2:w.push(h);}else if(s)return !1;return p?-1:a||s?s:w}};},function(t,n,r){var e=r(5);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return "String"==e(t)?t.split(""):Object(t)};},function(t,n,r){var e=r(11);t.exports=function(t){return Object(e(t))};},function(t,n){var r=Math.ceil,e=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?e:r)(t)};},function(t,n,r){var e=r(30);t.exports=function(t,n){return new(e(t))(n)};},function(t,n,r){var e=r(1),o=r(31),i=r(6)("species");t.exports=function(t){var n;return o(t)&&(n=t.constructor,"function"!=typeof n||n!==Array&&!o(n.prototype)||(n=void 0),e(n)&&null===(n=n[i])&&(n=void 0)),void 0===n?Array:n};},function(t,n,r){var e=r(5);t.exports=Array.isArray||function(t){return "Array"==e(t)};},function(t,n,r){var e=r(0),o=e["__core-js_shared__"]||(e["__core-js_shared__"]={});t.exports=function(t){return o[t]||(o[t]={})};},function(t,n,r){var e=r(4);t.exports=function(t,n){return !!t&&e(function(){n?t.call(null,function(){},1):t.call(null);})};},function(t,n,r){r(35),t.exports=r(2).String.endsWith;},function(t,n,r){var e=r(7),o=r(12),i=r(36),u="".endsWith;e(e.P+e.F*r(38)("endsWith"),"String",{endsWith:function(t){var n=i(this,t,"endsWith"),r=arguments.length>1?arguments[1]:void 0,e=o(n.length),c=void 0===r?e:Math.min(o(r),e),f=String(t);return u?u.call(n,f,c):n.slice(c-f.length,c)===f}});},function(t,n,r){var e=r(37),o=r(11);t.exports=function(t,n,r){if(e(n))throw TypeError("String#"+r+" doesn't accept regex!");return String(o(t))};},function(t,n,r){var e=r(1),o=r(5),i=r(6)("match");t.exports=function(t){var n;return e(t)&&(void 0!==(n=t[i])?!!n:"RegExp"==o(t))};},function(t,n,r){var e=r(6)("match");t.exports=function(t){var n=/./;try{"/./"[t](n);}catch(r){try{return n[e]=!1,!"/./"[t](n)}catch(t){}}return !0};}]);
|
12633 |
|
12634 | var supportMultiple = typeof document !== 'undefined' && document && document.createElement ? 'multiple' in document.createElement('input') : true;
|
12635 |
|
12636 |
|
12637 |
|
12638 | function fileAccepted(file, accept) {
|
12639 | return file.type === 'application/x-moz-file' || dist(file, accept);
|
12640 | }
|
12641 |
|
12642 | function fileMatchSize(file, maxSize, minSize) {
|
12643 | return file.size <= maxSize && file.size >= minSize;
|
12644 | }
|
12645 |
|
12646 | function allFilesAccepted(files, accept) {
|
12647 | return files.every(function (file) {
|
12648 | return fileAccepted(file, accept);
|
12649 | });
|
12650 | }
|
12651 |
|
12652 |
|
12653 |
|
12654 |
|
12655 | function isPropagationStopped(evt) {
|
12656 | if (typeof evt.isPropagationStopped === 'function') {
|
12657 | return evt.isPropagationStopped();
|
12658 | } else if (typeof evt.cancelBubble !== 'undefined') {
|
12659 | return evt.cancelBubble;
|
12660 | }
|
12661 | return false;
|
12662 | }
|
12663 |
|
12664 |
|
12665 |
|
12666 |
|
12667 | function isDefaultPrevented(evt) {
|
12668 | if (typeof evt.defaultPrevented !== 'undefined') {
|
12669 | return evt.defaultPrevented;
|
12670 | } else if (typeof evt.isDefaultPrevented === 'function') {
|
12671 | return evt.isDefaultPrevented();
|
12672 | }
|
12673 | return false;
|
12674 | }
|
12675 |
|
12676 | function isDragDataWithFiles(evt) {
|
12677 | if (!evt.dataTransfer) {
|
12678 | return true;
|
12679 | }
|
12680 |
|
12681 |
|
12682 | return Array.prototype.some.call(evt.dataTransfer.types, function (type) {
|
12683 | return type === 'Files' || type === 'application/x-moz-file';
|
12684 | });
|
12685 | }
|
12686 |
|
12687 |
|
12688 | function onDocumentDragOver(evt) {
|
12689 | evt.preventDefault();
|
12690 | }
|
12691 |
|
12692 | function isIe(userAgent) {
|
12693 | return userAgent.indexOf('MSIE') !== -1 || userAgent.indexOf('Trident/') !== -1;
|
12694 | }
|
12695 |
|
12696 | function isEdge(userAgent) {
|
12697 | return userAgent.indexOf('Edge/') !== -1;
|
12698 | }
|
12699 |
|
12700 | function isIeOrEdge() {
|
12701 | var userAgent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.navigator.userAgent;
|
12702 |
|
12703 | return isIe(userAgent) || isEdge(userAgent);
|
12704 | }
|
12705 |
|
12706 | |
12707 |
|
12708 |
|
12709 |
|
12710 |
|
12711 |
|
12712 |
|
12713 | function composeEventHandlers() {
|
12714 | for (var _len = arguments.length, fns = Array(_len), _key = 0; _key < _len; _key++) {
|
12715 | fns[_key] = arguments[_key];
|
12716 | }
|
12717 |
|
12718 | return function (event) {
|
12719 | for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
12720 | args[_key2 - 1] = arguments[_key2];
|
12721 | }
|
12722 |
|
12723 | return fns.some(function (fn) {
|
12724 | fn && fn.apply(undefined, [event].concat(args));
|
12725 | return event.defaultPrevented;
|
12726 | });
|
12727 | };
|
12728 | }
|
12729 |
|
12730 | var _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; };
|
12731 |
|
12732 | var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
12733 |
|
12734 | 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; }
|
12735 |
|
12736 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
12737 |
|
12738 | function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
12739 |
|
12740 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
12741 |
|
12742 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
12743 |
|
12744 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
12745 |
|
12746 | var Dropzone = function (_React$Component) {
|
12747 | _inherits(Dropzone, _React$Component);
|
12748 |
|
12749 | function Dropzone() {
|
12750 | var _ref;
|
12751 |
|
12752 | var _temp, _this, _ret;
|
12753 |
|
12754 | _classCallCheck(this, Dropzone);
|
12755 |
|
12756 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
12757 | args[_key] = arguments[_key];
|
12758 | }
|
12759 |
|
12760 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Dropzone.__proto__ || Object.getPrototypeOf(Dropzone)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
|
12761 | draggedFiles: [],
|
12762 | acceptedFiles: [],
|
12763 | rejectedFiles: []
|
12764 | }, _this.isFileDialogActive = false, _this.onDocumentDrop = function (evt) {
|
12765 | if (_this.node && _this.node.contains(evt.target)) {
|
12766 |
|
12767 | return;
|
12768 | }
|
12769 | evt.preventDefault();
|
12770 | _this.dragTargets = [];
|
12771 | }, _this.onDragStart = function (evt) {
|
12772 | evt.persist();
|
12773 | if (_this.props.onDragStart && isDragDataWithFiles(evt)) {
|
12774 | _this.props.onDragStart.call(_this, evt);
|
12775 | }
|
12776 | }, _this.onDragEnter = function (evt) {
|
12777 | evt.preventDefault();
|
12778 |
|
12779 |
|
12780 | if (_this.dragTargets.indexOf(evt.target) === -1) {
|
12781 | _this.dragTargets.push(evt.target);
|
12782 | }
|
12783 |
|
12784 | evt.persist();
|
12785 |
|
12786 | if (isDragDataWithFiles(evt)) {
|
12787 | Promise.resolve(_this.props.getDataTransferItems(evt)).then(function (draggedFiles) {
|
12788 | if (isPropagationStopped(evt)) {
|
12789 | return;
|
12790 | }
|
12791 |
|
12792 | _this.setState({
|
12793 | draggedFiles: draggedFiles,
|
12794 |
|
12795 | isDragActive: true
|
12796 | });
|
12797 | });
|
12798 |
|
12799 | if (_this.props.onDragEnter) {
|
12800 | _this.props.onDragEnter.call(_this, evt);
|
12801 | }
|
12802 | }
|
12803 | }, _this.onDragOver = function (evt) {
|
12804 |
|
12805 | evt.preventDefault();
|
12806 | evt.persist();
|
12807 |
|
12808 | if (evt.dataTransfer) {
|
12809 | evt.dataTransfer.dropEffect = 'copy';
|
12810 | }
|
12811 |
|
12812 | if (_this.props.onDragOver && isDragDataWithFiles(evt)) {
|
12813 | _this.props.onDragOver.call(_this, evt);
|
12814 | }
|
12815 |
|
12816 | return false;
|
12817 | }, _this.onDragLeave = function (evt) {
|
12818 | evt.preventDefault();
|
12819 | evt.persist();
|
12820 |
|
12821 |
|
12822 | _this.dragTargets = _this.dragTargets.filter(function (el) {
|
12823 | return el !== evt.target && _this.node.contains(el);
|
12824 | });
|
12825 | if (_this.dragTargets.length > 0) {
|
12826 | return;
|
12827 | }
|
12828 |
|
12829 |
|
12830 | _this.setState({
|
12831 | isDragActive: false,
|
12832 | draggedFiles: []
|
12833 | });
|
12834 |
|
12835 | if (_this.props.onDragLeave && isDragDataWithFiles(evt)) {
|
12836 | _this.props.onDragLeave.call(_this, evt);
|
12837 | }
|
12838 | }, _this.onDrop = function (evt) {
|
12839 | var _this$props = _this.props,
|
12840 | onDrop = _this$props.onDrop,
|
12841 | onDropAccepted = _this$props.onDropAccepted,
|
12842 | onDropRejected = _this$props.onDropRejected,
|
12843 | multiple = _this$props.multiple,
|
12844 | accept = _this$props.accept,
|
12845 | getDataTransferItems = _this$props.getDataTransferItems;
|
12846 |
|
12847 |
|
12848 |
|
12849 | evt.preventDefault();
|
12850 |
|
12851 |
|
12852 | evt.persist();
|
12853 |
|
12854 |
|
12855 | _this.dragTargets = [];
|
12856 | _this.isFileDialogActive = false;
|
12857 |
|
12858 |
|
12859 | _this.draggedFiles = null;
|
12860 |
|
12861 |
|
12862 | _this.setState({
|
12863 | isDragActive: false,
|
12864 | draggedFiles: []
|
12865 | });
|
12866 |
|
12867 | if (isDragDataWithFiles(evt)) {
|
12868 | Promise.resolve(getDataTransferItems(evt)).then(function (fileList) {
|
12869 | var acceptedFiles = [];
|
12870 | var rejectedFiles = [];
|
12871 |
|
12872 | if (isPropagationStopped(evt)) {
|
12873 | return;
|
12874 | }
|
12875 |
|
12876 | fileList.forEach(function (file) {
|
12877 | if (fileAccepted(file, accept) && fileMatchSize(file, _this.props.maxSize, _this.props.minSize)) {
|
12878 | acceptedFiles.push(file);
|
12879 | } else {
|
12880 | rejectedFiles.push(file);
|
12881 | }
|
12882 | });
|
12883 |
|
12884 | if (!multiple && acceptedFiles.length > 1) {
|
12885 |
|
12886 |
|
12887 | rejectedFiles.push.apply(rejectedFiles, _toConsumableArray(acceptedFiles.splice(0)));
|
12888 | }
|
12889 |
|
12890 |
|
12891 |
|
12892 |
|
12893 | _this.setState({ acceptedFiles: acceptedFiles, rejectedFiles: rejectedFiles }, function () {
|
12894 | if (onDrop) {
|
12895 | onDrop.call(_this, acceptedFiles, rejectedFiles, evt);
|
12896 | }
|
12897 |
|
12898 | if (rejectedFiles.length > 0 && onDropRejected) {
|
12899 | onDropRejected.call(_this, rejectedFiles, evt);
|
12900 | }
|
12901 |
|
12902 | if (acceptedFiles.length > 0 && onDropAccepted) {
|
12903 | onDropAccepted.call(_this, acceptedFiles, evt);
|
12904 | }
|
12905 | });
|
12906 | });
|
12907 | }
|
12908 | }, _this.onClick = function (evt) {
|
12909 | var onClick = _this.props.onClick;
|
12910 |
|
12911 |
|
12912 |
|
12913 | if (onClick) {
|
12914 | onClick.call(_this, evt);
|
12915 | }
|
12916 |
|
12917 |
|
12918 |
|
12919 | if (!isDefaultPrevented(evt)) {
|
12920 | evt.stopPropagation();
|
12921 |
|
12922 |
|
12923 |
|
12924 |
|
12925 | if (isIeOrEdge()) {
|
12926 | setTimeout(_this.open, 0);
|
12927 | } else {
|
12928 | _this.open();
|
12929 | }
|
12930 | }
|
12931 | }, _this.onInputElementClick = function (evt) {
|
12932 | evt.stopPropagation();
|
12933 | }, _this.onFileDialogCancel = function () {
|
12934 |
|
12935 | var onFileDialogCancel = _this.props.onFileDialogCancel;
|
12936 |
|
12937 |
|
12938 | if (_this.isFileDialogActive) {
|
12939 | setTimeout(function () {
|
12940 | if (_this.input != null) {
|
12941 |
|
12942 | var files = _this.input.files;
|
12943 |
|
12944 |
|
12945 | if (!files.length) {
|
12946 | _this.isFileDialogActive = false;
|
12947 |
|
12948 | if (typeof onFileDialogCancel === 'function') {
|
12949 | onFileDialogCancel();
|
12950 | }
|
12951 | }
|
12952 | }
|
12953 | }, 300);
|
12954 | }
|
12955 | }, _this.onFocus = function (evt) {
|
12956 | var onFocus = _this.props.onFocus;
|
12957 |
|
12958 | if (onFocus) {
|
12959 | onFocus.call(_this, evt);
|
12960 | }
|
12961 | if (!isDefaultPrevented(evt)) {
|
12962 | _this.setState({ isFocused: true });
|
12963 | }
|
12964 | }, _this.onBlur = function (evt) {
|
12965 | var onBlur = _this.props.onBlur;
|
12966 |
|
12967 | if (onBlur) {
|
12968 | onBlur.call(_this, evt);
|
12969 | }
|
12970 | if (!isDefaultPrevented(evt)) {
|
12971 | _this.setState({ isFocused: false });
|
12972 | }
|
12973 | }, _this.onKeyDown = function (evt) {
|
12974 | var onKeyDown = _this.props.onKeyDown;
|
12975 |
|
12976 | if (!_this.node.isEqualNode(evt.target)) {
|
12977 | return;
|
12978 | }
|
12979 |
|
12980 | if (onKeyDown) {
|
12981 | onKeyDown.call(_this, evt);
|
12982 | }
|
12983 |
|
12984 | if (!isDefaultPrevented(evt) && (evt.keyCode === 32 || evt.keyCode === 13)) {
|
12985 | evt.preventDefault();
|
12986 | _this.open();
|
12987 | }
|
12988 | }, _this.composeHandler = function (handler) {
|
12989 | if (_this.props.disabled) {
|
12990 | return null;
|
12991 | }
|
12992 | return handler;
|
12993 | }, _this.getRootProps = function () {
|
12994 | var _extends2;
|
12995 |
|
12996 | var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
12997 |
|
12998 | var _ref2$refKey = _ref2.refKey,
|
12999 | refKey = _ref2$refKey === undefined ? 'ref' : _ref2$refKey,
|
13000 | onKeyDown = _ref2.onKeyDown,
|
13001 | onFocus = _ref2.onFocus,
|
13002 | onBlur = _ref2.onBlur,
|
13003 | onClick = _ref2.onClick,
|
13004 | onDragStart = _ref2.onDragStart,
|
13005 | onDragEnter = _ref2.onDragEnter,
|
13006 | onDragOver = _ref2.onDragOver,
|
13007 | onDragLeave = _ref2.onDragLeave,
|
13008 | onDrop = _ref2.onDrop,
|
13009 | rest = _objectWithoutProperties(_ref2, ['refKey', 'onKeyDown', 'onFocus', 'onBlur', 'onClick', 'onDragStart', 'onDragEnter', 'onDragOver', 'onDragLeave', 'onDrop']);
|
13010 |
|
13011 | return _extends((_extends2 = {
|
13012 | onKeyDown: _this.composeHandler(onKeyDown ? composeEventHandlers(onKeyDown, _this.onKeyDown) : _this.onKeyDown),
|
13013 | onFocus: _this.composeHandler(onFocus ? composeEventHandlers(onFocus, _this.onFocus) : _this.onFocus),
|
13014 | onBlur: _this.composeHandler(onBlur ? composeEventHandlers(onBlur, _this.onBlur) : _this.onBlur),
|
13015 | onClick: _this.composeHandler(onClick ? composeEventHandlers(onClick, _this.onClick) : _this.onClick),
|
13016 | onDragStart: _this.composeHandler(onDragStart ? composeEventHandlers(onDragStart, _this.onDragStart) : _this.onDragStart),
|
13017 | onDragEnter: _this.composeHandler(onDragEnter ? composeEventHandlers(onDragEnter, _this.onDragEnter) : _this.onDragEnter),
|
13018 | onDragOver: _this.composeHandler(onDragOver ? composeEventHandlers(onDragOver, _this.onDragOver) : _this.onDragOver),
|
13019 | onDragLeave: _this.composeHandler(onDragLeave ? composeEventHandlers(onDragLeave, _this.onDragLeave) : _this.onDragLeave),
|
13020 | onDrop: _this.composeHandler(onDrop ? composeEventHandlers(onDrop, _this.onDrop) : _this.onDrop)
|
13021 | }, _defineProperty(_extends2, refKey, _this.setNodeRef), _defineProperty(_extends2, 'tabIndex', _this.props.disabled ? -1 : 0), _extends2), rest);
|
13022 | }, _this.getInputProps = function () {
|
13023 | var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
13024 |
|
13025 | var _ref3$refKey = _ref3.refKey,
|
13026 | refKey = _ref3$refKey === undefined ? 'ref' : _ref3$refKey,
|
13027 | onChange = _ref3.onChange,
|
13028 | onClick = _ref3.onClick,
|
13029 | rest = _objectWithoutProperties(_ref3, ['refKey', 'onChange', 'onClick']);
|
13030 |
|
13031 | var _this$props2 = _this.props,
|
13032 | accept = _this$props2.accept,
|
13033 | multiple = _this$props2.multiple,
|
13034 | name = _this$props2.name;
|
13035 |
|
13036 | var inputProps = _defineProperty({
|
13037 | accept: accept,
|
13038 | type: 'file',
|
13039 | style: { display: 'none' },
|
13040 | multiple: supportMultiple && multiple,
|
13041 | onChange: composeEventHandlers(onChange, _this.onDrop),
|
13042 | onClick: composeEventHandlers(onClick, _this.onInputElementClick),
|
13043 | autoComplete: 'off',
|
13044 | tabIndex: -1
|
13045 | }, refKey, _this.setInputRef);
|
13046 | if (name && name.length) {
|
13047 | inputProps.name = name;
|
13048 | }
|
13049 | return _extends({}, inputProps, rest);
|
13050 | }, _this.setNodeRef = function (node) {
|
13051 | _this.node = node;
|
13052 | }, _this.setInputRef = function (input) {
|
13053 | _this.input = input;
|
13054 | }, _this.open = function () {
|
13055 | _this.isFileDialogActive = true;
|
13056 | if (_this.input) {
|
13057 | _this.input.value = null;
|
13058 | _this.input.click();
|
13059 | }
|
13060 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
13061 | }
|
13062 |
|
13063 | _createClass(Dropzone, [{
|
13064 | key: 'componentDidMount',
|
13065 | value: function componentDidMount() {
|
13066 | var preventDropOnDocument = this.props.preventDropOnDocument;
|
13067 |
|
13068 | this.dragTargets = [];
|
13069 |
|
13070 | if (preventDropOnDocument) {
|
13071 | document.addEventListener('dragover', onDocumentDragOver, false);
|
13072 | document.addEventListener('drop', this.onDocumentDrop, false);
|
13073 | }
|
13074 |
|
13075 | window.addEventListener('focus', this.onFileDialogCancel, false);
|
13076 | }
|
13077 | }, {
|
13078 | key: 'componentWillUnmount',
|
13079 | value: function componentWillUnmount() {
|
13080 | var preventDropOnDocument = this.props.preventDropOnDocument;
|
13081 |
|
13082 | if (preventDropOnDocument) {
|
13083 | document.removeEventListener('dragover', onDocumentDragOver);
|
13084 | document.removeEventListener('drop', this.onDocumentDrop);
|
13085 | }
|
13086 |
|
13087 | window.removeEventListener('focus', this.onFileDialogCancel, false);
|
13088 | }
|
13089 |
|
13090 | |
13091 |
|
13092 |
|
13093 |
|
13094 |
|
13095 |
|
13096 | }, {
|
13097 | key: 'render',
|
13098 | value: function render() {
|
13099 | var _props = this.props,
|
13100 | children = _props.children,
|
13101 | multiple = _props.multiple,
|
13102 | disabled = _props.disabled;
|
13103 | var _state = this.state,
|
13104 | isDragActive = _state.isDragActive,
|
13105 | isFocused = _state.isFocused,
|
13106 | draggedFiles = _state.draggedFiles,
|
13107 | acceptedFiles = _state.acceptedFiles,
|
13108 | rejectedFiles = _state.rejectedFiles;
|
13109 |
|
13110 |
|
13111 | var filesCount = draggedFiles.length;
|
13112 | var isMultipleAllowed = multiple || filesCount <= 1;
|
13113 | var isDragAccept = filesCount > 0 && allFilesAccepted(draggedFiles, this.props.accept);
|
13114 | var isDragReject = filesCount > 0 && (!isDragAccept || !isMultipleAllowed);
|
13115 |
|
13116 | return children({
|
13117 | isDragActive: isDragActive,
|
13118 | isDragAccept: isDragAccept,
|
13119 | isDragReject: isDragReject,
|
13120 | draggedFiles: draggedFiles,
|
13121 | acceptedFiles: acceptedFiles,
|
13122 | rejectedFiles: rejectedFiles,
|
13123 | isFocused: isFocused && !disabled,
|
13124 | getRootProps: this.getRootProps,
|
13125 | getInputProps: this.getInputProps,
|
13126 | open: this.open
|
13127 | });
|
13128 | }
|
13129 | }]);
|
13130 |
|
13131 | return Dropzone;
|
13132 | }(React__default["default"].Component);
|
13133 |
|
13134 | Dropzone.propTypes = {
|
13135 | |
13136 |
|
13137 |
|
13138 |
|
13139 |
|
13140 |
|
13141 |
|
13142 | accept: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
|
13143 |
|
13144 | |
13145 |
|
13146 |
|
13147 |
|
13148 |
|
13149 |
|
13150 |
|
13151 |
|
13152 |
|
13153 |
|
13154 |
|
13155 |
|
13156 |
|
13157 |
|
13158 |
|
13159 | children: PropTypes.func,
|
13160 |
|
13161 | |
13162 |
|
13163 |
|
13164 | disabled: PropTypes.bool,
|
13165 |
|
13166 | |
13167 |
|
13168 |
|
13169 | preventDropOnDocument: PropTypes.bool,
|
13170 |
|
13171 | |
13172 |
|
13173 |
|
13174 | multiple: PropTypes.bool,
|
13175 |
|
13176 | |
13177 |
|
13178 |
|
13179 | name: PropTypes.string,
|
13180 |
|
13181 | |
13182 |
|
13183 |
|
13184 | maxSize: PropTypes.number,
|
13185 |
|
13186 | |
13187 |
|
13188 |
|
13189 | minSize: PropTypes.number,
|
13190 |
|
13191 | |
13192 |
|
13193 |
|
13194 |
|
13195 |
|
13196 | getDataTransferItems: PropTypes.func,
|
13197 |
|
13198 | |
13199 |
|
13200 |
|
13201 |
|
13202 | onClick: PropTypes.func,
|
13203 |
|
13204 | |
13205 |
|
13206 |
|
13207 | onFocus: PropTypes.func,
|
13208 |
|
13209 | |
13210 |
|
13211 |
|
13212 | onBlur: PropTypes.func,
|
13213 |
|
13214 | |
13215 |
|
13216 |
|
13217 | onKeyDown: PropTypes.func,
|
13218 |
|
13219 | |
13220 |
|
13221 |
|
13222 |
|
13223 |
|
13224 |
|
13225 |
|
13226 |
|
13227 |
|
13228 |
|
13229 |
|
13230 |
|
13231 |
|
13232 |
|
13233 |
|
13234 |
|
13235 |
|
13236 |
|
13237 |
|
13238 |
|
13239 |
|
13240 |
|
13241 |
|
13242 |
|
13243 |
|
13244 |
|
13245 |
|
13246 |
|
13247 |
|
13248 | onDrop: PropTypes.func,
|
13249 |
|
13250 | |
13251 |
|
13252 |
|
13253 | onDropAccepted: PropTypes.func,
|
13254 |
|
13255 | |
13256 |
|
13257 |
|
13258 | onDropRejected: PropTypes.func,
|
13259 |
|
13260 | |
13261 |
|
13262 |
|
13263 | onDragStart: PropTypes.func,
|
13264 |
|
13265 | |
13266 |
|
13267 |
|
13268 | onDragEnter: PropTypes.func,
|
13269 |
|
13270 | |
13271 |
|
13272 |
|
13273 | onDragOver: PropTypes.func,
|
13274 |
|
13275 | |
13276 |
|
13277 |
|
13278 | onDragLeave: PropTypes.func,
|
13279 |
|
13280 | |
13281 |
|
13282 |
|
13283 | onFileDialogCancel: PropTypes.func
|
13284 | };
|
13285 |
|
13286 | Dropzone.defaultProps = {
|
13287 | preventDropOnDocument: true,
|
13288 | disabled: false,
|
13289 | multiple: true,
|
13290 | maxSize: Infinity,
|
13291 | minSize: 0,
|
13292 | getDataTransferItems: fromEvent
|
13293 | };
|
13294 |
|
13295 | const FileUpload = (_a) => {
|
13296 | var { id, type, value = type === fileReaderType.text || type === fileReaderType.dataURL ? '' : null, filename = '', children = null, onChange = () => { }, onFileInputChange = null, onReadStarted = () => { }, onReadFinished = () => { }, onReadFailed = () => { }, onClearClick, onClick = event => event.preventDefault(), onTextChange, onDataChange, dropzoneProps = {} } = _a, props = __rest$1(_a, ["id", "type", "value", "filename", "children", "onChange", "onFileInputChange", "onReadStarted", "onReadFinished", "onReadFailed", "onClearClick", "onClick", "onTextChange", "onDataChange", "dropzoneProps"]);
|
13297 | const onDropAccepted = (acceptedFiles, event) => {
|
13298 | if (acceptedFiles.length > 0) {
|
13299 | const fileHandle = acceptedFiles[0];
|
13300 | if (event.type === 'drop') {
|
13301 | onFileInputChange === null || onFileInputChange === void 0 ? void 0 : onFileInputChange(event, fileHandle);
|
13302 | }
|
13303 | if (type === fileReaderType.text || type === fileReaderType.dataURL) {
|
13304 | onChange('', fileHandle.name, event);
|
13305 | onReadStarted(fileHandle);
|
13306 | readFile(fileHandle, type)
|
13307 | .then(data => {
|
13308 | onReadFinished(fileHandle);
|
13309 | onChange(data, fileHandle.name, event);
|
13310 | onDataChange === null || onDataChange === void 0 ? void 0 : onDataChange(data);
|
13311 | })
|
13312 | .catch((error) => {
|
13313 | onReadFailed(error, fileHandle);
|
13314 | onReadFinished(fileHandle);
|
13315 | onChange('', '', event);
|
13316 | onDataChange === null || onDataChange === void 0 ? void 0 : onDataChange('');
|
13317 | });
|
13318 | }
|
13319 | else {
|
13320 | onChange(fileHandle, fileHandle.name, event);
|
13321 | }
|
13322 | }
|
13323 | dropzoneProps.onDropAccepted && dropzoneProps.onDropAccepted(acceptedFiles, event);
|
13324 | };
|
13325 | const onDropRejected = (rejectedFiles, event) => {
|
13326 | if (rejectedFiles.length > 0) {
|
13327 | onChange('', rejectedFiles[0].name, event);
|
13328 | }
|
13329 | dropzoneProps.onDropRejected && dropzoneProps.onDropRejected(rejectedFiles, event);
|
13330 | };
|
13331 | const fileInputRef = React__namespace.useRef();
|
13332 | const setFileValue = (filename) => {
|
13333 | fileInputRef.current.value = filename;
|
13334 | };
|
13335 | const onClearButtonClick = (event) => {
|
13336 | onChange('', '', event);
|
13337 | onClearClick === null || onClearClick === void 0 ? void 0 : onClearClick(event);
|
13338 | setFileValue(null);
|
13339 | };
|
13340 | return (React__namespace.createElement(Dropzone, Object.assign({ multiple: false }, dropzoneProps, { onDropAccepted: onDropAccepted, onDropRejected: onDropRejected }), ({ getRootProps, getInputProps, isDragActive, open }) => {
|
13341 | const oldInputProps = getInputProps();
|
13342 | const inputProps = Object.assign(Object.assign({}, oldInputProps), { onChange: (e) => __awaiter$1(void 0, void 0, void 0, function* () {
|
13343 | var _a;
|
13344 | (_a = oldInputProps.onChange) === null || _a === void 0 ? void 0 : _a.call(oldInputProps, e);
|
13345 | const files = yield fromEvent(e.nativeEvent);
|
13346 | if (files.length === 1) {
|
13347 | onFileInputChange === null || onFileInputChange === void 0 ? void 0 : onFileInputChange(e, files[0]);
|
13348 | }
|
13349 | }) });
|
13350 | return (React__namespace.createElement(FileUploadField, Object.assign({}, getRootProps(Object.assign(Object.assign({}, props), { refKey: 'containerRef', onClick: event => event.preventDefault() })), { tabIndex: null, id: id, type: type, filename: filename, value: value, onChange: onChange, isDragActive: isDragActive, onBrowseButtonClick: open, onClearButtonClick: onClearButtonClick, onTextAreaClick: onClick, onTextChange: onTextChange }),
|
13351 | React__namespace.createElement("input", Object.assign({}, inputProps, { ref: input => {
|
13352 | fileInputRef.current = input;
|
13353 | inputProps.ref(input);
|
13354 | } })),
|
13355 | children));
|
13356 | }));
|
13357 | };
|
13358 | FileUpload.displayName = 'FileUpload';
|
13359 |
|
13360 | const ActionGroup = (_a) => {
|
13361 | var { children = null, className = '' } = _a, props = __rest$1(_a, ["children", "className"]);
|
13362 | const customClassName = css(styles$Z.formGroup, styles$Z.modifiers.action, className);
|
13363 | const formActionsComponent = React__namespace.createElement("div", { className: css(styles$Z.formActions) }, children);
|
13364 | return (React__namespace.createElement("div", Object.assign({}, props, { className: customClassName }),
|
13365 | React__namespace.createElement("div", { className: css(styles$Z.formGroupControl) }, formActionsComponent)));
|
13366 | };
|
13367 | ActionGroup.displayName = 'ActionGroup';
|
13368 |
|
13369 | const Form = (_a) => {
|
13370 | var { children = null, className = '', isHorizontal = false, isWidthLimited = false, maxWidth = '' } = _a, props = __rest$1(_a, ["children", "className", "isHorizontal", "isWidthLimited", "maxWidth"]);
|
13371 | return (React__namespace.createElement("form", Object.assign({ noValidate: true }, (maxWidth && {
|
13372 | style: Object.assign({ '--pf-c-form--m-limit-width--MaxWidth': maxWidth }, props.style)
|
13373 | }), props, { className: css(styles$Z.form, isHorizontal && styles$Z.modifiers.horizontal, (isWidthLimited || maxWidth) && styles$Z.modifiers.limitWidth, className) }), children));
|
13374 | };
|
13375 | Form.displayName = 'Form';
|
13376 |
|
13377 | const FormAlert = (_a) => {
|
13378 | var { children = null, className = '' } = _a, props = __rest$1(_a, ["children", "className"]);
|
13379 | return (
|
13380 |
|
13381 |
|
13382 | React__namespace.createElement("div", Object.assign({}, props, { className: css('pf-c-form__alert', className) }), children));
|
13383 | };
|
13384 | FormAlert.displayName = 'FormAlert';
|
13385 |
|
13386 | const FormFieldGroupToggle = (_a) => {
|
13387 | var { className, onToggle, isExpanded, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, toggleId } = _a, props = __rest$1(_a, ["className", "onToggle", "isExpanded", 'aria-label', 'aria-labelledby', "toggleId"]);
|
13388 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$Z.formFieldGroupToggle, className) }, props),
|
13389 | React__namespace.createElement("div", { className: css(styles$Z.formFieldGroupToggleButton) },
|
13390 | React__namespace.createElement(Button, { variant: "plain", "aria-label": ariaLabel, onClick: onToggle, "aria-expanded": isExpanded, "aria-labelledby": ariaLabelledby, id: toggleId },
|
13391 | React__namespace.createElement("span", { className: css(styles$Z.formFieldGroupToggleIcon) },
|
13392 | React__namespace.createElement(AngleRightIcon$1, { "aria-hidden": "true" }))))));
|
13393 | };
|
13394 | FormFieldGroupToggle.displayName = 'FormFieldGroupToggle';
|
13395 |
|
13396 | const InternalFormFieldGroup = (_a) => {
|
13397 | var { children, className, header, isExpandable, isExpanded, onToggle, toggleAriaLabel } = _a, props = __rest$1(_a, ["children", "className", "header", "isExpandable", "isExpanded", "onToggle", "toggleAriaLabel"]);
|
13398 | const headerTitleText = header ? header.props.titleText : null;
|
13399 | if (isExpandable && !toggleAriaLabel && !headerTitleText) {
|
13400 |
|
13401 | console.error('FormFieldGroupExpandable:', 'toggleAriaLabel or the titleText prop of FormFieldGroupHeader is required to make the toggle button accessible');
|
13402 | }
|
13403 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$Z.formFieldGroup, isExpanded && isExpandable && styles$Z.modifiers.expanded, className) }, props),
|
13404 | isExpandable && (React__namespace.createElement(GenerateId, { prefix: "form-field-group-toggle" }, id => (React__namespace.createElement(FormFieldGroupToggle, Object.assign({ onToggle: onToggle, isExpanded: isExpanded, "aria-label": toggleAriaLabel, toggleId: id }, (headerTitleText && { 'aria-labelledby': `${header.props.titleText.id} ${id}` })))))),
|
13405 | header && header,
|
13406 | (!isExpandable || (isExpandable && isExpanded)) && (React__namespace.createElement("div", { className: css(styles$Z.formFieldGroupBody) }, children))));
|
13407 | };
|
13408 | InternalFormFieldGroup.displayName = 'InternalFormFieldGroup';
|
13409 |
|
13410 | const FormFieldGroup = (_a) => {
|
13411 | var { children, className, header } = _a, props = __rest$1(_a, ["children", "className", "header"]);
|
13412 | return (React__namespace.createElement(InternalFormFieldGroup, Object.assign({ className: className, header: header }, props), children));
|
13413 | };
|
13414 | FormFieldGroup.displayName = 'FormFieldGroup';
|
13415 |
|
13416 | const FormFieldGroupExpandable = (_a) => {
|
13417 | var { children, className, header, isExpanded = false, toggleAriaLabel } = _a, props = __rest$1(_a, ["children", "className", "header", "isExpanded", "toggleAriaLabel"]);
|
13418 | const [localIsExpanded, setIsExpanded] = React.useState(isExpanded);
|
13419 | return (React__namespace.createElement(InternalFormFieldGroup, Object.assign({ className: className, header: header, isExpandable: true, isExpanded: localIsExpanded, toggleAriaLabel: toggleAriaLabel, onToggle: () => setIsExpanded(!localIsExpanded) }, props), children));
|
13420 | };
|
13421 | FormFieldGroupExpandable.displayName = 'FormFieldGroupExpandable';
|
13422 |
|
13423 | const FormFieldGroupHeader = (_a) => {
|
13424 | var { className, titleText, titleDescription, actions } = _a, props = __rest$1(_a, ["className", "titleText", "titleDescription", "actions"]);
|
13425 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$Z.formFieldGroupHeader, className) }, props),
|
13426 | React__namespace.createElement("div", { className: css(styles$Z.formFieldGroupHeaderMain) },
|
13427 | titleText && (React__namespace.createElement("div", { className: css(styles$Z.formFieldGroupHeaderTitle) },
|
13428 | React__namespace.createElement("div", { className: css(styles$Z.formFieldGroupHeaderTitleText), id: titleText.id }, titleText.text))),
|
13429 | titleDescription && React__namespace.createElement("div", { className: css(styles$Z.formFieldGroupHeaderDescription) }, titleDescription)),
|
13430 | React__namespace.createElement("div", { className: css(styles$Z.formFieldGroupHeaderActions) }, actions && actions)));
|
13431 | };
|
13432 | FormFieldGroupHeader.displayName = 'FormFieldGroupHeader';
|
13433 |
|
13434 | const FormGroup = (_a) => {
|
13435 | var { children = null, className = '', label, labelInfo, labelIcon, isRequired = false, validated = 'default', isInline = false, hasNoPaddingTop = false, isStack = false, helperText, isHelperTextBeforeField = false, helperTextInvalid, helperTextIcon, helperTextInvalidIcon, fieldId } = _a, props = __rest$1(_a, ["children", "className", "label", "labelInfo", "labelIcon", "isRequired", "validated", "isInline", "hasNoPaddingTop", "isStack", "helperText", "isHelperTextBeforeField", "helperTextInvalid", "helperTextIcon", "helperTextInvalidIcon", "fieldId"]);
|
13436 | const validHelperText = typeof helperText !== 'string' ? (helperText) : (React__namespace.createElement("div", { className: css(styles$Z.formHelperText, validated === exports.ValidatedOptions.success && styles$Z.modifiers.success, validated === exports.ValidatedOptions.warning && styles$Z.modifiers.warning), id: `${fieldId}-helper`, "aria-live": "polite" },
|
13437 | helperTextIcon && React__namespace.createElement("span", { className: css(styles$Z.formHelperTextIcon) }, helperTextIcon),
|
13438 | helperText));
|
13439 | const inValidHelperText = typeof helperTextInvalid !== 'string' ? (helperTextInvalid) : (React__namespace.createElement("div", { className: css(styles$Z.formHelperText, styles$Z.modifiers.error), id: `${fieldId}-helper`, "aria-live": "polite" },
|
13440 | helperTextInvalidIcon && React__namespace.createElement("span", { className: css(styles$Z.formHelperTextIcon) }, helperTextInvalidIcon),
|
13441 | helperTextInvalid));
|
13442 | const showValidHelperTxt = (validationType) => validationType !== exports.ValidatedOptions.error && helperText ? validHelperText : '';
|
13443 | const helperTextToDisplay = validated === exports.ValidatedOptions.error && helperTextInvalid ? inValidHelperText : showValidHelperTxt(validated);
|
13444 | const labelContent = (React__namespace.createElement(React__namespace.Fragment, null,
|
13445 | React__namespace.createElement("label", { className: css(styles$Z.formLabel), htmlFor: fieldId },
|
13446 | React__namespace.createElement("span", { className: css(styles$Z.formLabelText) }, label),
|
13447 | isRequired && (React__namespace.createElement("span", { className: css(styles$Z.formLabelRequired), "aria-hidden": "true" },
|
13448 | ' ',
|
13449 | ASTERISK))),
|
13450 | ' ',
|
13451 | React__namespace.isValidElement(labelIcon) && labelIcon));
|
13452 | return (React__namespace.createElement("div", Object.assign({}, props, { className: css(styles$Z.formGroup, className) }),
|
13453 | label && (React__namespace.createElement("div", { className: css(styles$Z.formGroupLabel, labelInfo && styles$Z.modifiers.info, hasNoPaddingTop && styles$Z.modifiers.noPaddingTop) },
|
13454 | labelInfo && (React__namespace.createElement(React__namespace.Fragment, null,
|
13455 | React__namespace.createElement("div", { className: css(styles$Z.formGroupLabelMain) }, labelContent),
|
13456 | React__namespace.createElement("div", { className: css(styles$Z.formGroupLabelInfo) }, labelInfo))),
|
13457 | !labelInfo && labelContent)),
|
13458 | React__namespace.createElement("div", { className: css(styles$Z.formGroupControl, isInline && styles$Z.modifiers.inline, isStack && styles$Z.modifiers.stack) },
|
13459 | isHelperTextBeforeField && helperTextToDisplay,
|
13460 | children,
|
13461 | !isHelperTextBeforeField && helperTextToDisplay)));
|
13462 | };
|
13463 | FormGroup.displayName = 'FormGroup';
|
13464 |
|
13465 | const FormHelperText = (_a) => {
|
13466 | var { children = null, isError = false, isHidden = true, className = '', icon = null, component = 'p' } = _a, props = __rest$1(_a, ["children", "isError", "isHidden", "className", "icon", "component"]);
|
13467 | const Component = component;
|
13468 | return (React__namespace.createElement(Component, Object.assign({ className: css(styles$Z.formHelperText, isError && styles$Z.modifiers.error, isHidden && styles$Z.modifiers.hidden, className) }, props),
|
13469 | icon && React__namespace.createElement("span", { className: css(styles$Z.formHelperTextIcon) }, icon),
|
13470 | children));
|
13471 | };
|
13472 | FormHelperText.displayName = 'FormHelperText';
|
13473 |
|
13474 | const FormSection = (_a) => {
|
13475 | var { className = '', children, title = '', titleElement: TitleElement = 'div' } = _a, props = __rest$1(_a, ["className", "children", "title", "titleElement"]);
|
13476 | return (React__namespace.createElement("section", Object.assign({}, props, { className: css(styles$Z.formSection, className) }),
|
13477 | title && React__namespace.createElement(TitleElement, { className: css(styles$Z.formSectionTitle, className) }, title),
|
13478 | children));
|
13479 | };
|
13480 | FormSection.displayName = 'FormSection';
|
13481 |
|
13482 | Promise.resolve().then(function () { return helperText; });
|
13483 | var styles$H = {
|
13484 | "helperText": "pf-c-helper-text",
|
13485 | "helperTextItem": "pf-c-helper-text__item",
|
13486 | "helperTextItemIcon": "pf-c-helper-text__item-icon",
|
13487 | "helperTextItemText": "pf-c-helper-text__item-text",
|
13488 | "modifiers": {
|
13489 | "indeterminate": "pf-m-indeterminate",
|
13490 | "warning": "pf-m-warning",
|
13491 | "success": "pf-m-success",
|
13492 | "error": "pf-m-error",
|
13493 | "dynamic": "pf-m-dynamic"
|
13494 | }
|
13495 | };
|
13496 |
|
13497 | const HelperText = (_a) => {
|
13498 | var { children, className, component = 'div', id, isLiveRegion = false } = _a, props = __rest$1(_a, ["children", "className", "component", "id", "isLiveRegion"]);
|
13499 | const Component = component;
|
13500 | return (React__namespace.createElement(Component, Object.assign({ id: id, className: css(styles$H.helperText, className) }, (isLiveRegion && { 'aria-live': 'polite' }), props), children));
|
13501 | };
|
13502 | HelperText.displayName = 'HelperText';
|
13503 |
|
13504 | const MinusIconConfig = {
|
13505 | name: 'MinusIcon',
|
13506 | height: 512,
|
13507 | width: 448,
|
13508 | svgPath: 'M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z',
|
13509 | yOffset: 0,
|
13510 | xOffset: 0,
|
13511 | };
|
13512 |
|
13513 | const MinusIcon = createIcon(MinusIconConfig);
|
13514 |
|
13515 | var MinusIcon$1 = MinusIcon;
|
13516 |
|
13517 | const variantStyle$4 = {
|
13518 | default: '',
|
13519 | indeterminate: styles$H.modifiers.indeterminate,
|
13520 | warning: styles$H.modifiers.warning,
|
13521 | success: styles$H.modifiers.success,
|
13522 | error: styles$H.modifiers.error
|
13523 | };
|
13524 | const HelperTextItem = (_a) => {
|
13525 | var { children, className, component = 'div', variant = 'default', icon, isDynamic = false, hasIcon = isDynamic, id } = _a, props = __rest$1(_a, ["children", "className", "component", "variant", "icon", "isDynamic", "hasIcon", "id"]);
|
13526 | const Component = component;
|
13527 | return (React__namespace.createElement(Component, Object.assign({ className: css(styles$H.helperTextItem, variantStyle$4[variant], isDynamic && styles$H.modifiers.dynamic, className), id: id }, props),
|
13528 | icon && (React__namespace.createElement("span", { className: css(styles$H.helperTextItemIcon), "aria-hidden": true }, icon)),
|
13529 | hasIcon && !icon && (React__namespace.createElement("span", { className: css(styles$H.helperTextItemIcon), "aria-hidden": true },
|
13530 | (variant === 'default' || variant === 'indeterminate') && React__namespace.createElement(MinusIcon$1, null),
|
13531 | variant === 'warning' && React__namespace.createElement(ExclamationTriangleIcon$1, null),
|
13532 | variant === 'success' && React__namespace.createElement(CheckCircleIcon$1, null),
|
13533 | variant === 'error' && React__namespace.createElement(ExclamationCircleIcon$1, null))),
|
13534 | React__namespace.createElement("span", { className: css(styles$H.helperTextItemText) }, children)));
|
13535 | };
|
13536 | HelperTextItem.displayName = 'HelperTextItem';
|
13537 |
|
13538 | Promise.resolve().then(function () { return hint; });
|
13539 | var styles$G = {
|
13540 | "button": "pf-c-button",
|
13541 | "dropdown": "pf-c-dropdown",
|
13542 | "dropdownToggle": "pf-c-dropdown__toggle",
|
13543 | "hint": "pf-c-hint",
|
13544 | "hintActions": "pf-c-hint__actions",
|
13545 | "hintBody": "pf-c-hint__body",
|
13546 | "hintFooter": "pf-c-hint__footer",
|
13547 | "hintTitle": "pf-c-hint__title",
|
13548 | "modifiers": {
|
13549 | "link": "pf-m-link",
|
13550 | "inline": "pf-m-inline",
|
13551 | "plain": "pf-m-plain"
|
13552 | }
|
13553 | };
|
13554 |
|
13555 | const Hint = (_a) => {
|
13556 | var { children, className, actions } = _a, props = __rest$1(_a, ["children", "className", "actions"]);
|
13557 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$G.hint, className) }, props),
|
13558 | React__namespace.createElement("div", { className: css(styles$G.hintActions) }, actions),
|
13559 | children));
|
13560 | };
|
13561 | Hint.displayName = 'Hint';
|
13562 |
|
13563 | const HintBody = (_a) => {
|
13564 | var { children, className } = _a, props = __rest$1(_a, ["children", "className"]);
|
13565 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$G.hintBody, className) }, props), children));
|
13566 | };
|
13567 | HintBody.displayName = 'HintBody';
|
13568 |
|
13569 | const HintFooter = (_a) => {
|
13570 | var { children, className } = _a, props = __rest$1(_a, ["children", "className"]);
|
13571 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$G.hintFooter, className) }, props), children));
|
13572 | };
|
13573 | HintFooter.displayName = 'HintFooter';
|
13574 |
|
13575 | const HintTitle = (_a) => {
|
13576 | var { children, className } = _a, props = __rest$1(_a, ["children", "className"]);
|
13577 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$G.hintTitle, className) }, props), children));
|
13578 | };
|
13579 | HintTitle.displayName = 'HintTitle';
|
13580 |
|
13581 | Promise.resolve().then(function () { return jumpLinks; });
|
13582 | var styles$F = {
|
13583 | "button": "pf-c-button",
|
13584 | "jumpLinks": "pf-c-jump-links",
|
13585 | "jumpLinksItem": "pf-c-jump-links__item",
|
13586 | "jumpLinksLabel": "pf-c-jump-links__label",
|
13587 | "jumpLinksLink": "pf-c-jump-links__link",
|
13588 | "jumpLinksLinkText": "pf-c-jump-links__link-text",
|
13589 | "jumpLinksList": "pf-c-jump-links__list",
|
13590 | "jumpLinksMain": "pf-c-jump-links__main",
|
13591 | "jumpLinksToggle": "pf-c-jump-links__toggle",
|
13592 | "jumpLinksToggleIcon": "pf-c-jump-links__toggle-icon",
|
13593 | "jumpLinksToggleText": "pf-c-jump-links__toggle-text",
|
13594 | "modifiers": {
|
13595 | "center": "pf-m-center",
|
13596 | "vertical": "pf-m-vertical",
|
13597 | "expandable": "pf-m-expandable",
|
13598 | "nonExpandable": "pf-m-non-expandable",
|
13599 | "expandableOnSm": "pf-m-expandable-on-sm",
|
13600 | "nonExpandableOnSm": "pf-m-non-expandable-on-sm",
|
13601 | "expandableOnMd": "pf-m-expandable-on-md",
|
13602 | "nonExpandableOnMd": "pf-m-non-expandable-on-md",
|
13603 | "expandableOnLg": "pf-m-expandable-on-lg",
|
13604 | "nonExpandableOnLg": "pf-m-non-expandable-on-lg",
|
13605 | "expandableOnXl": "pf-m-expandable-on-xl",
|
13606 | "nonExpandableOnXl": "pf-m-non-expandable-on-xl",
|
13607 | "expandableOn_2xl": "pf-m-expandable-on-2xl",
|
13608 | "nonExpandableOn_2xl": "pf-m-non-expandable-on-2xl",
|
13609 | "expanded": "pf-m-expanded",
|
13610 | "current": "pf-m-current"
|
13611 | }
|
13612 | };
|
13613 |
|
13614 | Promise.resolve().then(function () { return sidebar; });
|
13615 | var styles$E = {
|
13616 | "modifiers": {
|
13617 | "gutter": "pf-m-gutter",
|
13618 | "panelRight": "pf-m-panel-right",
|
13619 | "stack": "pf-m-stack",
|
13620 | "split": "pf-m-split",
|
13621 | "sticky": "pf-m-sticky",
|
13622 | "static": "pf-m-static",
|
13623 | "noBackground": "pf-m-no-background",
|
13624 | "widthDefault": "pf-m-width-default",
|
13625 | "width_25": "pf-m-width-25",
|
13626 | "width_33": "pf-m-width-33",
|
13627 | "width_50": "pf-m-width-50",
|
13628 | "width_66": "pf-m-width-66",
|
13629 | "width_75": "pf-m-width-75",
|
13630 | "width_100": "pf-m-width-100",
|
13631 | "widthDefaultOnSm": "pf-m-width-default-on-sm",
|
13632 | "width_25OnSm": "pf-m-width-25-on-sm",
|
13633 | "width_33OnSm": "pf-m-width-33-on-sm",
|
13634 | "width_50OnSm": "pf-m-width-50-on-sm",
|
13635 | "width_66OnSm": "pf-m-width-66-on-sm",
|
13636 | "width_75OnSm": "pf-m-width-75-on-sm",
|
13637 | "width_100OnSm": "pf-m-width-100-on-sm",
|
13638 | "widthDefaultOnMd": "pf-m-width-default-on-md",
|
13639 | "width_25OnMd": "pf-m-width-25-on-md",
|
13640 | "width_33OnMd": "pf-m-width-33-on-md",
|
13641 | "width_50OnMd": "pf-m-width-50-on-md",
|
13642 | "width_66OnMd": "pf-m-width-66-on-md",
|
13643 | "width_75OnMd": "pf-m-width-75-on-md",
|
13644 | "width_100OnMd": "pf-m-width-100-on-md",
|
13645 | "widthDefaultOnLg": "pf-m-width-default-on-lg",
|
13646 | "width_25OnLg": "pf-m-width-25-on-lg",
|
13647 | "width_33OnLg": "pf-m-width-33-on-lg",
|
13648 | "width_50OnLg": "pf-m-width-50-on-lg",
|
13649 | "width_66OnLg": "pf-m-width-66-on-lg",
|
13650 | "width_75OnLg": "pf-m-width-75-on-lg",
|
13651 | "width_100OnLg": "pf-m-width-100-on-lg",
|
13652 | "widthDefaultOnXl": "pf-m-width-default-on-xl",
|
13653 | "width_25OnXl": "pf-m-width-25-on-xl",
|
13654 | "width_33OnXl": "pf-m-width-33-on-xl",
|
13655 | "width_50OnXl": "pf-m-width-50-on-xl",
|
13656 | "width_66OnXl": "pf-m-width-66-on-xl",
|
13657 | "width_75OnXl": "pf-m-width-75-on-xl",
|
13658 | "width_100OnXl": "pf-m-width-100-on-xl",
|
13659 | "widthDefaultOn_2xl": "pf-m-width-default-on-2xl",
|
13660 | "width_25On_2xl": "pf-m-width-25-on-2xl",
|
13661 | "width_33On_2xl": "pf-m-width-33-on-2xl",
|
13662 | "width_50On_2xl": "pf-m-width-50-on-2xl",
|
13663 | "width_66On_2xl": "pf-m-width-66-on-2xl",
|
13664 | "width_75On_2xl": "pf-m-width-75-on-2xl",
|
13665 | "width_100On_2xl": "pf-m-width-100-on-2xl"
|
13666 | },
|
13667 | "sidebar": "pf-c-sidebar",
|
13668 | "sidebarContent": "pf-c-sidebar__content",
|
13669 | "sidebarMain": "pf-c-sidebar__main",
|
13670 | "sidebarPanel": "pf-c-sidebar__panel"
|
13671 | };
|
13672 |
|
13673 | const JumpLinksList = (_a) => {
|
13674 | var { children, className } = _a, props = __rest$1(_a, ["children", "className"]);
|
13675 | return (React__namespace.createElement("ul", Object.assign({ className: css(styles$F.jumpLinksList, className) }, props), children));
|
13676 | };
|
13677 | JumpLinksList.displayName = 'JumpLinksList';
|
13678 |
|
13679 | const JumpLinksItem = (_a) => {
|
13680 | var { isActive, href,
|
13681 |
|
13682 | node, children, onClick, className } = _a, props = __rest$1(_a, ["isActive", "href", "node", "children", "onClick", "className"]);
|
13683 | const childrenArr = React__namespace.Children.toArray(children);
|
13684 | const sublists = childrenArr.filter(child => child.type === JumpLinksList);
|
13685 | children = childrenArr.filter(child => child.type !== JumpLinksList);
|
13686 | return (React__namespace.createElement("li", Object.assign({ className: css(styles$F.jumpLinksItem, isActive && styles$F.modifiers.current, className) }, (isActive && { 'aria-current': 'location' }), props),
|
13687 | React__namespace.createElement("a", { className: styles$F.jumpLinksLink, href: href, onClick: onClick },
|
13688 | React__namespace.createElement("span", { className: styles$F.jumpLinksLinkText }, children)),
|
13689 | sublists));
|
13690 | };
|
13691 | JumpLinksItem.displayName = 'JumpLinksItem';
|
13692 |
|
13693 | const c_jump_links__toggle_Display = {
|
13694 | "name": "--pf-c-jump-links__toggle--Display",
|
13695 | "value": "none",
|
13696 | "var": "var(--pf-c-jump-links__toggle--Display)"
|
13697 | };
|
13698 | var cssToggleDisplayVar = c_jump_links__toggle_Display;
|
13699 |
|
13700 |
|
13701 | const getScrollItems = (children, res) => {
|
13702 | React__namespace.Children.forEach(children, (child) => {
|
13703 | if (canUseDOM && document.getElementById && document.querySelector && child.type === JumpLinksItem) {
|
13704 | const scrollNode = child.props.node || child.props.href;
|
13705 | if (typeof scrollNode === 'string') {
|
13706 | if (scrollNode.startsWith('#')) {
|
13707 |
|
13708 |
|
13709 | res.push(document.getElementById(scrollNode.substr(1)));
|
13710 | }
|
13711 | else {
|
13712 | res.push(document.querySelector(scrollNode));
|
13713 | }
|
13714 | }
|
13715 | else if (scrollNode instanceof HTMLElement) {
|
13716 | res.push(scrollNode);
|
13717 | }
|
13718 | }
|
13719 | if ([React__namespace.Fragment, JumpLinksList, JumpLinksItem].includes(child.type)) {
|
13720 | getScrollItems(child.props.children, res);
|
13721 | }
|
13722 | });
|
13723 | return res;
|
13724 | };
|
13725 | function isResponsive(jumpLinks) {
|
13726 |
|
13727 | return (jumpLinks &&
|
13728 | getComputedStyle(jumpLinks)
|
13729 | .getPropertyValue(cssToggleDisplayVar.name)
|
13730 | .includes('block'));
|
13731 | }
|
13732 | const JumpLinks = (_a) => {
|
13733 | var { isCentered, isVertical, children, label, 'aria-label': ariaLabel = typeof label === 'string' ? label : null, scrollableSelector, activeIndex: activeIndexProp = 0, offset = 0, expandable, isExpanded: isExpandedProp = false, alwaysShowLabel = true, toggleAriaLabel = 'Toggle jump links', className } = _a, props = __rest$1(_a, ["isCentered", "isVertical", "children", "label", 'aria-label', "scrollableSelector", "activeIndex", "offset", "expandable", "isExpanded", "alwaysShowLabel", "toggleAriaLabel", "className"]);
|
13734 | const hasScrollSpy = Boolean(scrollableSelector);
|
13735 | const [scrollItems, setScrollItems] = React__namespace.useState(hasScrollSpy ? getScrollItems(children, []) : []);
|
13736 | const [activeIndex, setActiveIndex] = React__namespace.useState(activeIndexProp);
|
13737 | const [isExpanded, setIsExpanded] = React__namespace.useState(isExpandedProp);
|
13738 |
|
13739 | const isLinkClicked = React__namespace.useRef(false);
|
13740 |
|
13741 | React__namespace.useEffect(() => setIsExpanded(isExpandedProp), [isExpandedProp]);
|
13742 | const navRef = React__namespace.useRef();
|
13743 | let scrollableElement;
|
13744 | const scrollSpy = React__namespace.useCallback(() => {
|
13745 | if (!canUseDOM || !hasScrollSpy || !(scrollableElement instanceof HTMLElement)) {
|
13746 | return;
|
13747 | }
|
13748 | if (isLinkClicked.current) {
|
13749 | isLinkClicked.current = false;
|
13750 | return;
|
13751 | }
|
13752 | const scrollPosition = Math.ceil(scrollableElement.scrollTop + offset);
|
13753 | window.requestAnimationFrame(() => {
|
13754 | let newScrollItems = scrollItems;
|
13755 |
|
13756 | if (!newScrollItems[0] || newScrollItems.includes(null)) {
|
13757 | newScrollItems = getScrollItems(children, []);
|
13758 | setScrollItems(newScrollItems);
|
13759 | }
|
13760 | const scrollElements = newScrollItems
|
13761 | .map((e, index) => ({
|
13762 | y: e ? e.offsetTop : null,
|
13763 | index
|
13764 | }))
|
13765 | .filter(({ y }) => y !== null)
|
13766 | .sort((e1, e2) => e2.y - e1.y);
|
13767 | for (const { y, index } of scrollElements) {
|
13768 | if (scrollPosition >= y) {
|
13769 | return setActiveIndex(index);
|
13770 | }
|
13771 | }
|
13772 | });
|
13773 | }, [scrollItems, hasScrollSpy, scrollableElement, offset]);
|
13774 | React__namespace.useEffect(() => {
|
13775 | scrollableElement = document.querySelector(scrollableSelector);
|
13776 | if (!(scrollableElement instanceof HTMLElement)) {
|
13777 | return;
|
13778 | }
|
13779 | scrollableElement.addEventListener('scroll', scrollSpy);
|
13780 | return () => scrollableElement.removeEventListener('scroll', scrollSpy);
|
13781 | }, [scrollableSelector, scrollSpy]);
|
13782 | React__namespace.useEffect(() => {
|
13783 | scrollSpy();
|
13784 | }, []);
|
13785 | let jumpLinkIndex = 0;
|
13786 | const cloneChildren = (children) => !hasScrollSpy
|
13787 | ? children
|
13788 | : React__namespace.Children.map(children, (child) => {
|
13789 | if (child.type === JumpLinksItem) {
|
13790 | const { onClick: onClickProp, isActive: isActiveProp } = child.props;
|
13791 | const itemIndex = jumpLinkIndex++;
|
13792 | const scrollItem = scrollItems[itemIndex];
|
13793 | return React__namespace.cloneElement(child, {
|
13794 | onClick(ev) {
|
13795 | isLinkClicked.current = true;
|
13796 |
|
13797 | let newScrollItems;
|
13798 | if (!scrollItem) {
|
13799 | newScrollItems = getScrollItems(children, []);
|
13800 | setScrollItems(newScrollItems);
|
13801 | }
|
13802 | const newScrollItem = scrollItem || newScrollItems[itemIndex];
|
13803 | if (newScrollItem) {
|
13804 |
|
13805 | const scrollableElement = document.querySelector(scrollableSelector);
|
13806 | if (scrollableElement instanceof HTMLElement) {
|
13807 | if (isResponsive(navRef.current)) {
|
13808 |
|
13809 | if (navRef.current) {
|
13810 | navRef.current.classList.remove(styles$F.modifiers.expanded);
|
13811 | }
|
13812 | let stickyParent = navRef.current && navRef.current.parentElement;
|
13813 | while (stickyParent && !stickyParent.classList.contains(styles$E.modifiers.sticky)) {
|
13814 | stickyParent = stickyParent.parentElement;
|
13815 | }
|
13816 | setIsExpanded(false);
|
13817 | if (stickyParent) {
|
13818 | offset += stickyParent.scrollHeight;
|
13819 | }
|
13820 | }
|
13821 | scrollableElement.scrollTo(0, newScrollItem.offsetTop - offset);
|
13822 | }
|
13823 | newScrollItem.focus();
|
13824 | ev.preventDefault();
|
13825 | setActiveIndex(itemIndex);
|
13826 | }
|
13827 | if (onClickProp) {
|
13828 | onClickProp(ev);
|
13829 | }
|
13830 | },
|
13831 | isActive: isActiveProp || activeIndex === itemIndex,
|
13832 | children: cloneChildren(child.props.children)
|
13833 | });
|
13834 | }
|
13835 | else if (child.type === React__namespace.Fragment) {
|
13836 | return cloneChildren(child.props.children);
|
13837 | }
|
13838 | else if (child.type === JumpLinksList) {
|
13839 | return React__namespace.cloneElement(child, { children: cloneChildren(child.props.children) });
|
13840 | }
|
13841 | return child;
|
13842 | });
|
13843 | return (React__namespace.createElement("nav", Object.assign({ className: css(styles$F.jumpLinks, isCentered && styles$F.modifiers.center, isVertical && styles$F.modifiers.vertical, formatBreakpointMods(expandable, styles$F), isExpanded && styles$F.modifiers.expanded, className), "aria-label": ariaLabel, ref: navRef }, props),
|
13844 | React__namespace.createElement("div", { className: styles$F.jumpLinksMain },
|
13845 | React__namespace.createElement("div", { className: css('pf-c-jump-links__header') },
|
13846 | expandable && (React__namespace.createElement("div", { className: styles$F.jumpLinksToggle },
|
13847 | React__namespace.createElement(Button, { variant: "plain", onClick: () => setIsExpanded(!isExpanded), "aria-label": toggleAriaLabel, "aria-expanded": isExpanded },
|
13848 | React__namespace.createElement("span", { className: styles$F.jumpLinksToggleIcon },
|
13849 | React__namespace.createElement(AngleRightIcon$1, null)),
|
13850 | label && React__namespace.createElement("span", { className: css(styles$F.jumpLinksToggleText) },
|
13851 | " ",
|
13852 | label,
|
13853 | " ")))),
|
13854 | label && alwaysShowLabel && React__namespace.createElement("div", { className: css(styles$F.jumpLinksLabel) }, label)),
|
13855 | React__namespace.createElement("ul", { className: styles$F.jumpLinksList }, cloneChildren(children)))));
|
13856 | };
|
13857 | JumpLinks.displayName = 'JumpLinks';
|
13858 |
|
13859 | Promise.resolve().then(function () { return label; });
|
13860 | var labelStyles = {
|
13861 | "button": "pf-c-button",
|
13862 | "label": "pf-c-label",
|
13863 | "labelContent": "pf-c-label__content",
|
13864 | "labelIcon": "pf-c-label__icon",
|
13865 | "labelText": "pf-c-label__text",
|
13866 | "modifiers": {
|
13867 | "compact": "pf-m-compact",
|
13868 | "blue": "pf-m-blue",
|
13869 | "green": "pf-m-green",
|
13870 | "orange": "pf-m-orange",
|
13871 | "red": "pf-m-red",
|
13872 | "purple": "pf-m-purple",
|
13873 | "cyan": "pf-m-cyan",
|
13874 | "outline": "pf-m-outline",
|
13875 | "overflow": "pf-m-overflow",
|
13876 | "add": "pf-m-add",
|
13877 | "editable": "pf-m-editable",
|
13878 | "editableActive": "pf-m-editable-active"
|
13879 | }
|
13880 | };
|
13881 |
|
13882 | Promise.resolve().then(function () { return labelGroup; });
|
13883 | var styles$D = {
|
13884 | "button": "pf-c-button",
|
13885 | "labelGroup": "pf-c-label-group",
|
13886 | "labelGroupClose": "pf-c-label-group__close",
|
13887 | "labelGroupLabel": "pf-c-label-group__label",
|
13888 | "labelGroupList": "pf-c-label-group__list",
|
13889 | "labelGroupListItem": "pf-c-label-group__list-item",
|
13890 | "labelGroupMain": "pf-c-label-group__main",
|
13891 | "labelGroupTextarea": "pf-c-label-group__textarea",
|
13892 | "modifiers": {
|
13893 | "category": "pf-m-category",
|
13894 | "vertical": "pf-m-vertical",
|
13895 | "editable": "pf-m-editable",
|
13896 | "textarea": "pf-m-textarea"
|
13897 | }
|
13898 | };
|
13899 |
|
13900 | const colorStyles = {
|
13901 | blue: labelStyles.modifiers.blue,
|
13902 | cyan: labelStyles.modifiers.cyan,
|
13903 | green: labelStyles.modifiers.green,
|
13904 | orange: labelStyles.modifiers.orange,
|
13905 | purple: labelStyles.modifiers.purple,
|
13906 | red: labelStyles.modifiers.red,
|
13907 | grey: ''
|
13908 | };
|
13909 | const Label = (_a) => {
|
13910 | var { children, className = '', color = 'grey', variant = 'filled', isCompact = false, isEditable = false, editableProps, isTruncated = false, tooltipPosition, icon, onClose, onEditCancel, onEditComplete, closeBtn, closeBtnAriaLabel, closeBtnProps, href, isOverflowLabel, render } = _a, props = __rest$1(_a, ["children", "className", "color", "variant", "isCompact", "isEditable", "editableProps", "isTruncated", "tooltipPosition", "icon", "onClose", "onEditCancel", "onEditComplete", "closeBtn", "closeBtnAriaLabel", "closeBtnProps", "href", "isOverflowLabel", "render"]);
|
13911 | const [isEditableActive, setIsEditableActive] = React.useState(false);
|
13912 | const [currValue, setCurrValue] = React.useState(children);
|
13913 | const editableButtonRef = React__namespace.useRef();
|
13914 | const editableInputRef = React__namespace.useRef();
|
13915 | React__namespace.useEffect(() => {
|
13916 | document.addEventListener('click', onDocClick);
|
13917 | document.addEventListener('keydown', onKeyDown);
|
13918 | return () => {
|
13919 | document.removeEventListener('click', onDocClick);
|
13920 | document.removeEventListener('keydown', onKeyDown);
|
13921 | };
|
13922 | });
|
13923 | const onDocClick = (event) => {
|
13924 | if (isEditableActive &&
|
13925 | editableInputRef &&
|
13926 | editableInputRef.current &&
|
13927 | !editableInputRef.current.contains(event.target)) {
|
13928 | if (editableInputRef.current.value) {
|
13929 | onEditComplete && onEditComplete(editableInputRef.current.value);
|
13930 | }
|
13931 | setIsEditableActive(false);
|
13932 | }
|
13933 | };
|
13934 | const onKeyDown = (event) => {
|
13935 | const key = event.key;
|
13936 | if ((!isEditableActive &&
|
13937 | (!editableButtonRef ||
|
13938 | !editableButtonRef.current ||
|
13939 | !editableButtonRef.current.contains(event.target))) ||
|
13940 | (isEditableActive &&
|
13941 | (!editableInputRef || !editableInputRef.current || !editableInputRef.current.contains(event.target)))) {
|
13942 | return;
|
13943 | }
|
13944 | if (isEditableActive && (key === 'Enter' || key === 'Tab')) {
|
13945 | event.preventDefault();
|
13946 | event.stopImmediatePropagation();
|
13947 | if (editableInputRef.current.value) {
|
13948 | onEditComplete && onEditComplete(editableInputRef.current.value);
|
13949 | }
|
13950 | setIsEditableActive(false);
|
13951 | }
|
13952 | if (isEditableActive && key === 'Escape') {
|
13953 | event.preventDefault();
|
13954 | event.stopImmediatePropagation();
|
13955 |
|
13956 | if (editableInputRef.current.value) {
|
13957 | editableInputRef.current.value = children;
|
13958 | onEditCancel && onEditCancel(children);
|
13959 | }
|
13960 | setIsEditableActive(false);
|
13961 | }
|
13962 | if (!isEditableActive && key === 'Enter') {
|
13963 | event.preventDefault();
|
13964 | event.stopImmediatePropagation();
|
13965 | setIsEditableActive(true);
|
13966 |
|
13967 | const el = event.target;
|
13968 | const range = document.createRange();
|
13969 | const sel = window.getSelection();
|
13970 | range.selectNodeContents(el);
|
13971 | range.collapse(false);
|
13972 | sel.removeAllRanges();
|
13973 | sel.addRange(range);
|
13974 | }
|
13975 | };
|
13976 | const LabelComponent = (isOverflowLabel ? 'button' : 'span');
|
13977 | const button = closeBtn ? (closeBtn) : (React__namespace.createElement(Button, Object.assign({ type: "button", variant: "plain", onClick: onClose, "aria-label": closeBtnAriaLabel || `Close ${children}` }, closeBtnProps),
|
13978 | React__namespace.createElement(TimesIcon$1, null)));
|
13979 | const textRef = React__namespace.createRef();
|
13980 |
|
13981 | const componentRef = React__namespace.useRef();
|
13982 | const [isTooltipVisible, setIsTooltipVisible] = React__namespace.useState(false);
|
13983 | useIsomorphicLayoutEffect(() => {
|
13984 | const currTextRef = isEditable ? editableButtonRef : textRef;
|
13985 | if (!isEditableActive) {
|
13986 | setIsTooltipVisible(currTextRef.current && currTextRef.current.offsetWidth < currTextRef.current.scrollWidth);
|
13987 | }
|
13988 | }, [isEditableActive]);
|
13989 | const content = (React__namespace.createElement(React__namespace.Fragment, null,
|
13990 | icon && React__namespace.createElement("span", { className: css(labelStyles.labelIcon) }, icon),
|
13991 | isTruncated && (React__namespace.createElement("span", { ref: textRef, className: css(labelStyles.labelText) }, children)),
|
13992 | !isTruncated && children));
|
13993 | React__namespace.useEffect(() => {
|
13994 | if (isEditableActive && editableInputRef) {
|
13995 | editableInputRef.current && editableInputRef.current.focus();
|
13996 | }
|
13997 | }, [editableInputRef, isEditableActive]);
|
13998 | const updateVal = () => {
|
13999 | setCurrValue(editableInputRef.current.value);
|
14000 | };
|
14001 | let labelComponentChild = React__namespace.createElement("span", { className: css(labelStyles.labelContent) }, content);
|
14002 | if (href) {
|
14003 | labelComponentChild = (React__namespace.createElement("a", { className: css(labelStyles.labelContent), href: href }, content));
|
14004 | }
|
14005 | else if (isEditable) {
|
14006 | labelComponentChild = (React__namespace.createElement("button", Object.assign({ ref: editableButtonRef, className: css(labelStyles.labelContent), onClick: (e) => {
|
14007 | setIsEditableActive(true);
|
14008 | e.stopPropagation();
|
14009 | } }, editableProps), content));
|
14010 | }
|
14011 | if (render) {
|
14012 | labelComponentChild = (React__namespace.createElement(React__namespace.Fragment, null,
|
14013 | isTooltipVisible && React__namespace.createElement(Tooltip, { reference: componentRef, content: children, position: tooltipPosition }),
|
14014 | render({
|
14015 | className: labelStyles.labelContent,
|
14016 | content,
|
14017 | componentRef
|
14018 | })));
|
14019 | }
|
14020 | else if (isTooltipVisible) {
|
14021 | labelComponentChild = (React__namespace.createElement(Tooltip, { content: children, position: tooltipPosition }, labelComponentChild));
|
14022 | }
|
14023 | return (React__namespace.createElement(LabelComponent, Object.assign({}, props, { className: css(labelStyles.label, colorStyles[color], variant === 'outline' && labelStyles.modifiers.outline, isOverflowLabel && labelStyles.modifiers.overflow, isCompact && labelStyles.modifiers.compact, isEditable && styles$D.modifiers.editable, isEditableActive && labelStyles.modifiers.editableActive, className) }),
|
14024 | !isEditableActive && labelComponentChild,
|
14025 | !isEditableActive && onClose && button,
|
14026 | isEditableActive && (React__namespace.createElement("input", Object.assign({ className: css(labelStyles.labelContent), type: "text", id: "editable-input", ref: editableInputRef, value: currValue, onChange: updateVal }, editableProps)))));
|
14027 | };
|
14028 | Label.displayName = 'Label';
|
14029 |
|
14030 | class LabelGroup extends React__namespace.Component {
|
14031 | constructor(props) {
|
14032 | super(props);
|
14033 | this.headingRef = React__namespace.createRef();
|
14034 | this.toggleCollapse = () => {
|
14035 | this.setState(prevState => ({
|
14036 | isOpen: !prevState.isOpen,
|
14037 | isTooltipVisible: Boolean(this.headingRef.current && this.headingRef.current.offsetWidth < this.headingRef.current.scrollWidth)
|
14038 | }));
|
14039 | };
|
14040 | this.state = {
|
14041 | isOpen: this.props.defaultIsOpen,
|
14042 | isTooltipVisible: false
|
14043 | };
|
14044 | }
|
14045 | componentDidMount() {
|
14046 | this.setState({
|
14047 | isTooltipVisible: Boolean(this.headingRef.current && this.headingRef.current.offsetWidth < this.headingRef.current.scrollWidth)
|
14048 | });
|
14049 | }
|
14050 | renderLabel(id) {
|
14051 | const { categoryName, tooltipPosition } = this.props;
|
14052 | const { isTooltipVisible } = this.state;
|
14053 | return isTooltipVisible ? (React__namespace.createElement(Tooltip, { position: tooltipPosition, content: categoryName },
|
14054 | React__namespace.createElement("span", { tabIndex: 0, ref: this.headingRef, className: css(styles$D.labelGroupLabel) },
|
14055 | React__namespace.createElement("span", { "aria-hidden": "true", id: id }, categoryName)))) : (React__namespace.createElement("span", { ref: this.headingRef, className: css(styles$D.labelGroupLabel), "aria-hidden": "true", id: id }, categoryName));
|
14056 | }
|
14057 | render() {
|
14058 | const _a = this.props, { categoryName, children, className, isClosable, isCompact, closeBtnAriaLabel, 'aria-label': ariaLabel, onClick, numLabels, expandedText, collapsedText,
|
14059 |
|
14060 | defaultIsOpen, tooltipPosition, isVertical, isEditable, hasEditableTextArea, editableTextAreaProps } = _a,
|
14061 |
|
14062 | rest = __rest$1(_a, ["categoryName", "children", "className", "isClosable", "isCompact", "closeBtnAriaLabel", 'aria-label', "onClick", "numLabels", "expandedText", "collapsedText", "defaultIsOpen", "tooltipPosition", "isVertical", "isEditable", "hasEditableTextArea", "editableTextAreaProps"]);
|
14063 | const { isOpen } = this.state;
|
14064 | const numChildren = React__namespace.Children.count(children);
|
14065 | const collapsedTextResult = fillTemplate(collapsedText, {
|
14066 | remaining: React__namespace.Children.count(children) - numLabels
|
14067 | });
|
14068 | const renderLabelGroup = (id) => {
|
14069 | const labelArray = !isOpen
|
14070 | ? React__namespace.Children.toArray(children).slice(0, numLabels)
|
14071 | : React__namespace.Children.toArray(children);
|
14072 | const content = (React__namespace.createElement(React__namespace.Fragment, null,
|
14073 | categoryName && this.renderLabel(id),
|
14074 | React__namespace.createElement("ul", Object.assign({ className: css(styles$D.labelGroupList) }, (categoryName && { 'aria-labelledby': id }), (!categoryName && { 'aria-label': ariaLabel }), { role: "list" }, rest),
|
14075 | labelArray.map((child, i) => (React__namespace.createElement("li", { className: css(styles$D.labelGroupListItem), key: i }, child))),
|
14076 | numChildren > numLabels && (React__namespace.createElement("li", { className: css(styles$D.labelGroupListItem) },
|
14077 | React__namespace.createElement(Label, { isOverflowLabel: true, onClick: this.toggleCollapse, className: css(isCompact && labelStyles.modifiers.compact) }, isOpen ? expandedText : collapsedTextResult))),
|
14078 | isEditable && hasEditableTextArea && (React__namespace.createElement("li", { className: css(styles$D.labelGroupListItem, styles$D.modifiers.textarea) },
|
14079 | React__namespace.createElement("textarea", Object.assign({ className: css(styles$D.labelGroupTextarea), rows: 1, tabIndex: 0 }, editableTextAreaProps)))))));
|
14080 | const close = (React__namespace.createElement("div", { className: css(styles$D.labelGroupClose) },
|
14081 | React__namespace.createElement(Button, { variant: "plain", "aria-label": closeBtnAriaLabel, onClick: onClick, id: `remove_group_${id}`, "aria-labelledby": `remove_group_${id} ${id}` },
|
14082 | React__namespace.createElement(TimesCircleIcon$1, { "aria-hidden": "true" }))));
|
14083 | return (React__namespace.createElement("div", { className: css(styles$D.labelGroup, className, categoryName && styles$D.modifiers.category, isVertical && styles$D.modifiers.vertical, isEditable && styles$D.modifiers.editable) },
|
14084 | React__namespace.createElement("div", { className: css(styles$D.labelGroupMain) }, content),
|
14085 | isClosable && close));
|
14086 | };
|
14087 | return numChildren === 0 ? null : (React__namespace.createElement(GenerateId, null, randomId => renderLabelGroup(this.props.id || randomId)));
|
14088 | }
|
14089 | }
|
14090 | LabelGroup.displayName = 'LabelGroup';
|
14091 | LabelGroup.defaultProps = {
|
14092 | expandedText: 'Show Less',
|
14093 | collapsedText: '${remaining} more',
|
14094 | categoryName: '',
|
14095 | defaultIsOpen: false,
|
14096 | numLabels: 3,
|
14097 | isClosable: false,
|
14098 | isCompact: false,
|
14099 |
|
14100 | onClick: (_e) => undefined,
|
14101 | closeBtnAriaLabel: 'Close label group',
|
14102 | tooltipPosition: 'top',
|
14103 | 'aria-label': 'Label group category',
|
14104 | isVertical: false,
|
14105 | isEditable: false,
|
14106 | hasEditableTextArea: false
|
14107 | };
|
14108 |
|
14109 | Promise.resolve().then(function () { return list; });
|
14110 | var styles$C = {
|
14111 | "list": "pf-c-list",
|
14112 | "listItem": "pf-c-list__item",
|
14113 | "listItemIcon": "pf-c-list__item-icon",
|
14114 | "modifiers": {
|
14115 | "iconLg": "pf-m-icon-lg",
|
14116 | "plain": "pf-m-plain",
|
14117 | "inline": "pf-m-inline",
|
14118 | "bordered": "pf-m-bordered"
|
14119 | }
|
14120 | };
|
14121 |
|
14122 | exports.OrderType = void 0;
|
14123 | (function (OrderType) {
|
14124 | OrderType["number"] = "1";
|
14125 | OrderType["lowercaseLetter"] = "a";
|
14126 | OrderType["uppercaseLetter"] = "A";
|
14127 | OrderType["lowercaseRomanNumber"] = "i";
|
14128 | OrderType["uppercaseRomanNumber"] = "I";
|
14129 | })(exports.OrderType || (exports.OrderType = {}));
|
14130 | exports.ListVariant = void 0;
|
14131 | (function (ListVariant) {
|
14132 | ListVariant["inline"] = "inline";
|
14133 | })(exports.ListVariant || (exports.ListVariant = {}));
|
14134 | exports.ListComponent = void 0;
|
14135 | (function (ListComponent) {
|
14136 | ListComponent["ol"] = "ol";
|
14137 | ListComponent["ul"] = "ul";
|
14138 | })(exports.ListComponent || (exports.ListComponent = {}));
|
14139 | const List = (_a) => {
|
14140 | var { className = '', children = null, variant = null, isBordered = false, isPlain = false, iconSize = 'default', type = exports.OrderType.number, ref = null, component = exports.ListComponent.ul } = _a, props = __rest$1(_a, ["className", "children", "variant", "isBordered", "isPlain", "iconSize", "type", "ref", "component"]);
|
14141 | return component === exports.ListComponent.ol ? (React__namespace.createElement("ol", Object.assign({ ref: ref, type: type }, props, { className: css(styles$C.list, variant && styles$C.modifiers[variant], isBordered && styles$C.modifiers.bordered, isPlain && styles$C.modifiers.plain, iconSize && iconSize === 'large' && styles$C.modifiers.iconLg, className) }), children)) : (React__namespace.createElement("ul", Object.assign({ ref: ref }, props, { className: css(styles$C.list, variant && styles$C.modifiers[variant], isBordered && styles$C.modifiers.bordered, isPlain && styles$C.modifiers.plain, iconSize && iconSize === 'large' && styles$C.modifiers.iconLg, className) }), children));
|
14142 | };
|
14143 | List.displayName = 'List';
|
14144 |
|
14145 | const ListItem = (_a) => {
|
14146 | var { icon = null, children = null } = _a, props = __rest$1(_a, ["icon", "children"]);
|
14147 | return (React__namespace.createElement("li", Object.assign({ className: css(icon && styles$C.listItem) }, props),
|
14148 | icon && React__namespace.createElement("span", { className: css(styles$C.listItemIcon) }, icon),
|
14149 | children));
|
14150 | };
|
14151 | ListItem.displayName = 'ListItem';
|
14152 |
|
14153 | Promise.resolve().then(function () { return login; });
|
14154 | var styles$B = {
|
14155 | "brand": "pf-c-brand",
|
14156 | "button": "pf-c-button",
|
14157 | "card": "pf-c-card",
|
14158 | "dropdown": "pf-c-dropdown",
|
14159 | "list": "pf-c-list",
|
14160 | "login": "pf-c-login",
|
14161 | "loginContainer": "pf-c-login__container",
|
14162 | "loginFooter": "pf-c-login__footer",
|
14163 | "loginHeader": "pf-c-login__header",
|
14164 | "loginMain": "pf-c-login__main",
|
14165 | "loginMainBody": "pf-c-login__main-body",
|
14166 | "loginMainFooter": "pf-c-login__main-footer",
|
14167 | "loginMainFooterBand": "pf-c-login__main-footer-band",
|
14168 | "loginMainFooterLinks": "pf-c-login__main-footer-links",
|
14169 | "loginMainFooterLinksItem": "pf-c-login__main-footer-links-item",
|
14170 | "loginMainFooterLinksItemLink": "pf-c-login__main-footer-links-item-link",
|
14171 | "loginMainHeader": "pf-c-login__main-header",
|
14172 | "loginMainHeaderDesc": "pf-c-login__main-header-desc",
|
14173 | "loginMainHeaderUtilities": "pf-c-login__main-header-utilities",
|
14174 | "title": "pf-c-title"
|
14175 | };
|
14176 |
|
14177 | const Login = (_a) => {
|
14178 | var { className = '', children = null, footer = null, header = null } = _a, props = __rest$1(_a, ["className", "children", "footer", "header"]);
|
14179 | return (React__namespace.createElement("div", Object.assign({}, props, { className: css(styles$B.login, className) }),
|
14180 | React__namespace.createElement("div", { className: css(styles$B.loginContainer) },
|
14181 | header,
|
14182 | React__namespace.createElement("main", { className: css(styles$B.loginMain) }, children),
|
14183 | footer)));
|
14184 | };
|
14185 | Login.displayName = 'Login';
|
14186 |
|
14187 | const LoginHeader = (_a) => {
|
14188 | var { className = '', children = null, headerBrand = null } = _a, props = __rest$1(_a, ["className", "children", "headerBrand"]);
|
14189 | return (React__namespace.createElement("header", Object.assign({ className: css(styles$B.loginHeader, className) }, props),
|
14190 | headerBrand,
|
14191 | children));
|
14192 | };
|
14193 | LoginHeader.displayName = 'LoginHeader';
|
14194 |
|
14195 | const LoginFooter = (_a) => {
|
14196 | var { className = '', children = null } = _a, props = __rest$1(_a, ["className", "children"]);
|
14197 | return (React__namespace.createElement("footer", Object.assign({ className: css(styles$B.loginFooter, className) }, props), children));
|
14198 | };
|
14199 | LoginFooter.displayName = 'LoginFooter';
|
14200 |
|
14201 | const LoginMainHeader = (_a) => {
|
14202 | var { children = null, className = '', title = '', subtitle = '' } = _a, props = __rest$1(_a, ["children", "className", "title", "subtitle"]);
|
14203 | return (React__namespace.createElement("header", Object.assign({ className: css(styles$B.loginMainHeader, className) }, props),
|
14204 | title && (React__namespace.createElement(Title, { headingLevel: "h2", size: exports.TitleSizes['3xl'] }, title)),
|
14205 | subtitle && React__namespace.createElement("p", { className: css(styles$B.loginMainHeaderDesc) }, subtitle),
|
14206 | children));
|
14207 | };
|
14208 | LoginMainHeader.displayName = 'LoginMainHeader';
|
14209 |
|
14210 | const LoginMainBody = (_a) => {
|
14211 | var { children = null, className = '' } = _a, props = __rest$1(_a, ["children", "className"]);
|
14212 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$B.loginMainBody, className) }, props), children));
|
14213 | };
|
14214 | LoginMainBody.displayName = 'LoginMainBody';
|
14215 |
|
14216 | const LoginMainFooter = (_a) => {
|
14217 | var { children = null, socialMediaLoginContent = null, signUpForAccountMessage = null, forgotCredentials = null, className = '' } = _a, props = __rest$1(_a, ["children", "socialMediaLoginContent", "signUpForAccountMessage", "forgotCredentials", "className"]);
|
14218 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$B.loginMainFooter, className) }, props),
|
14219 | children,
|
14220 | socialMediaLoginContent && React__namespace.createElement("ul", { className: css(styles$B.loginMainFooterLinks) }, socialMediaLoginContent),
|
14221 | (signUpForAccountMessage || forgotCredentials) && (React__namespace.createElement("div", { className: css(styles$B.loginMainFooterBand) },
|
14222 | signUpForAccountMessage,
|
14223 | forgotCredentials))));
|
14224 | };
|
14225 | LoginMainFooter.displayName = 'LoginMainFooter';
|
14226 |
|
14227 | const LoginPage = (_a) => {
|
14228 | var { children = null, className = '', brandImgSrc = '', brandImgAlt = '', backgroundImgSrc = '', backgroundImgAlt = '', footerListItems = null, textContent = '', footerListVariants, loginTitle, loginSubtitle, signUpForAccountMessage = null, forgotCredentials = null, socialMediaLoginContent = null } = _a, props = __rest$1(_a, ["children", "className", "brandImgSrc", "brandImgAlt", "backgroundImgSrc", "backgroundImgAlt", "footerListItems", "textContent", "footerListVariants", "loginTitle", "loginSubtitle", "signUpForAccountMessage", "forgotCredentials", "socialMediaLoginContent"]);
|
14229 | const HeaderBrand = (React__namespace.createElement(React__namespace.Fragment, null,
|
14230 | React__namespace.createElement(Brand, { src: brandImgSrc, alt: brandImgAlt })));
|
14231 | const Header = React__namespace.createElement(LoginHeader, { headerBrand: HeaderBrand });
|
14232 | const Footer = (React__namespace.createElement(LoginFooter, null,
|
14233 | React__namespace.createElement("p", null, textContent),
|
14234 | React__namespace.createElement(List, { variant: footerListVariants }, footerListItems)));
|
14235 | return (React__namespace.createElement(React__namespace.Fragment, null,
|
14236 | backgroundImgSrc && React__namespace.createElement(BackgroundImage, { src: backgroundImgSrc, alt: backgroundImgAlt }),
|
14237 | React__namespace.createElement(Login, Object.assign({ header: Header, footer: Footer, className: css(className) }, props),
|
14238 | React__namespace.createElement(LoginMainHeader, { title: loginTitle, subtitle: loginSubtitle }),
|
14239 | React__namespace.createElement(LoginMainBody, null, children),
|
14240 | (socialMediaLoginContent || forgotCredentials || signUpForAccountMessage) && (React__namespace.createElement(LoginMainFooter, { socialMediaLoginContent: socialMediaLoginContent, forgotCredentials: forgotCredentials, signUpForAccountMessage: signUpForAccountMessage })))));
|
14241 | };
|
14242 | LoginPage.displayName = 'LoginPage';
|
14243 |
|
14244 | const EyeSlashIconConfig = {
|
14245 | name: 'EyeSlashIcon',
|
14246 | height: 512,
|
14247 | width: 640,
|
14248 | svgPath: 'M320 400c-75.85 0-137.25-58.71-142.9-133.11L72.2 185.82c-13.79 17.3-26.48 35.59-36.72 55.59a32.35 32.35 0 0 0 0 29.19C89.71 376.41 197.07 448 320 448c26.91 0 52.87-4 77.89-10.46L346 397.39a144.13 144.13 0 0 1-26 2.61zm313.82 58.1l-110.55-85.44a331.25 331.25 0 0 0 81.25-102.07 32.35 32.35 0 0 0 0-29.19C550.29 135.59 442.93 64 320 64a308.15 308.15 0 0 0-147.32 37.7L45.46 3.37A16 16 0 0 0 23 6.18L3.37 31.45A16 16 0 0 0 6.18 53.9l588.36 454.73a16 16 0 0 0 22.46-2.81l19.64-25.27a16 16 0 0 0-2.82-22.45zm-183.72-142l-39.3-30.38A94.75 94.75 0 0 0 416 256a94.76 94.76 0 0 0-121.31-92.21A47.65 47.65 0 0 1 304 192a46.64 46.64 0 0 1-1.54 10l-73.61-56.89A142.31 142.31 0 0 1 320 112a143.92 143.92 0 0 1 144 144c0 21.63-5.29 41.79-13.9 60.11z',
|
14249 | yOffset: 0,
|
14250 | xOffset: 0,
|
14251 | };
|
14252 |
|
14253 | const EyeSlashIcon = createIcon(EyeSlashIconConfig);
|
14254 |
|
14255 | var EyeSlashIcon$1 = EyeSlashIcon;
|
14256 |
|
14257 | const EyeIconConfig = {
|
14258 | name: 'EyeIcon',
|
14259 | height: 512,
|
14260 | width: 576,
|
14261 | svgPath: 'M572.52 241.4C518.29 135.59 410.93 64 288 64S57.68 135.64 3.48 241.41a32.35 32.35 0 0 0 0 29.19C57.71 376.41 165.07 448 288 448s230.32-71.64 284.52-177.41a32.35 32.35 0 0 0 0-29.19zM288 400a144 144 0 1 1 144-144 143.93 143.93 0 0 1-144 144zm0-240a95.31 95.31 0 0 0-25.31 3.79 47.85 47.85 0 0 1-66.9 66.9A95.78 95.78 0 1 0 288 160z',
|
14262 | yOffset: 0,
|
14263 | xOffset: 0,
|
14264 | };
|
14265 |
|
14266 | const EyeIcon = createIcon(EyeIconConfig);
|
14267 |
|
14268 | var EyeIcon$1 = EyeIcon;
|
14269 |
|
14270 | const LoginForm = (_a) => {
|
14271 | var { noAutoFocus = false, className = '', showHelperText = false, helperText = null, helperTextIcon = null, usernameLabel = 'Username', usernameValue = '', onChangeUsername = () => undefined, isValidUsername = true, passwordLabel = 'Password', passwordValue = '', onChangePassword = () => undefined, isShowPasswordEnabled = false, hidePasswordAriaLabel = 'Hide password', showPasswordAriaLabel = 'Show password', isValidPassword = true, loginButtonLabel = 'Log In', isLoginButtonDisabled = false, onLoginButtonClick = () => undefined, rememberMeLabel = '', isRememberMeChecked = false, onChangeRememberMe = () => undefined } = _a, props = __rest$1(_a, ["noAutoFocus", "className", "showHelperText", "helperText", "helperTextIcon", "usernameLabel", "usernameValue", "onChangeUsername", "isValidUsername", "passwordLabel", "passwordValue", "onChangePassword", "isShowPasswordEnabled", "hidePasswordAriaLabel", "showPasswordAriaLabel", "isValidPassword", "loginButtonLabel", "isLoginButtonDisabled", "onLoginButtonClick", "rememberMeLabel", "isRememberMeChecked", "onChangeRememberMe"]);
|
14272 | const [passwordHidden, setPasswordHidden] = React__namespace.useState(true);
|
14273 | const passwordInput = (React__namespace.createElement(TextInput, { isRequired: true, type: passwordHidden ? 'password' : 'text', id: "pf-login-password-id", name: "pf-login-password-id", validated: isValidPassword ? exports.ValidatedOptions.default : exports.ValidatedOptions.error, value: passwordValue, onChange: onChangePassword }));
|
14274 | return (React__namespace.createElement(Form, Object.assign({ className: className }, props),
|
14275 | React__namespace.createElement(FormHelperText, { isError: !isValidUsername || !isValidPassword, isHidden: !showHelperText, icon: helperTextIcon }, helperText),
|
14276 | React__namespace.createElement(FormGroup, { label: usernameLabel, isRequired: true, validated: isValidUsername ? exports.ValidatedOptions.default : exports.ValidatedOptions.error, fieldId: "pf-login-username-id" },
|
14277 | React__namespace.createElement(TextInput, { autoFocus: !noAutoFocus, id: "pf-login-username-id", isRequired: true, validated: isValidUsername ? exports.ValidatedOptions.default : exports.ValidatedOptions.error, type: "text", name: "pf-login-username-id", value: usernameValue, onChange: onChangeUsername })),
|
14278 | React__namespace.createElement(FormGroup, { label: passwordLabel, isRequired: true, validated: isValidPassword ? exports.ValidatedOptions.default : exports.ValidatedOptions.error, fieldId: "pf-login-password-id" },
|
14279 | isShowPasswordEnabled && (React__namespace.createElement(InputGroup, null,
|
14280 | passwordInput,
|
14281 | React__namespace.createElement(Button, { variant: "control", onClick: () => setPasswordHidden(!passwordHidden), "aria-label": passwordHidden ? showPasswordAriaLabel : hidePasswordAriaLabel }, passwordHidden ? React__namespace.createElement(EyeIcon$1, null) : React__namespace.createElement(EyeSlashIcon$1, null)))),
|
14282 | !isShowPasswordEnabled && passwordInput),
|
14283 | rememberMeLabel.length > 0 && (React__namespace.createElement(FormGroup, { fieldId: "pf-login-remember-me-id" },
|
14284 | React__namespace.createElement(Checkbox, { id: "pf-login-remember-me-id", label: rememberMeLabel, isChecked: isRememberMeChecked, onChange: onChangeRememberMe }))),
|
14285 | React__namespace.createElement(ActionGroup, null,
|
14286 | React__namespace.createElement(Button, { variant: "primary", type: "submit", onClick: onLoginButtonClick, isBlock: true, isDisabled: isLoginButtonDisabled }, loginButtonLabel))));
|
14287 | };
|
14288 | LoginForm.displayName = 'LoginForm';
|
14289 |
|
14290 | const LoginFooterItem = (_a) => {
|
14291 | var { children = null, href = '#', target = '_blank' } = _a, props = __rest$1(_a, ["children", "href", "target"]);
|
14292 | return React__namespace.isValidElement(children) ? (children) : (React__namespace.createElement("a", Object.assign({ target: target, href: href }, props), children));
|
14293 | };
|
14294 | LoginFooterItem.displayName = 'LoginFooterItem';
|
14295 |
|
14296 | const LoginMainFooterBandItem = (_a) => {
|
14297 | var { children = null, className = '' } = _a, props = __rest$1(_a, ["children", "className"]);
|
14298 | return (React__namespace.createElement("p", Object.assign({ className: css(`${styles$B.loginMainFooterBand}-item`, className) }, props), children));
|
14299 | };
|
14300 | LoginMainFooterBandItem.displayName = 'LoginMainFooterBandItem';
|
14301 |
|
14302 | const LoginMainFooterLinksItem = (_a) => {
|
14303 | var { children = null, href = '', target = '', className = '', linkComponent = 'a', linkComponentProps } = _a, props = __rest$1(_a, ["children", "href", "target", "className", "linkComponent", "linkComponentProps"]);
|
14304 | const LinkComponent = linkComponent;
|
14305 | return (React__namespace.createElement("li", Object.assign({ className: css(styles$B.loginMainFooterLinksItem, className) }, props),
|
14306 | React__namespace.createElement(LinkComponent, Object.assign({ className: css(styles$B.loginMainFooterLinksItemLink), href: href, target: target }, linkComponentProps), children)));
|
14307 | };
|
14308 | LoginMainFooterLinksItem.displayName = 'LoginMainFooterLinksItem';
|
14309 |
|
14310 | Promise.resolve().then(function () { return masthead; });
|
14311 | var styles$A = {
|
14312 | "button": "pf-c-button",
|
14313 | "card": "pf-c-card",
|
14314 | "contextSelector": "pf-c-context-selector",
|
14315 | "dropdown": "pf-c-dropdown",
|
14316 | "masthead": "pf-c-masthead",
|
14317 | "mastheadBrand": "pf-c-masthead__brand",
|
14318 | "mastheadContent": "pf-c-masthead__content",
|
14319 | "mastheadMain": "pf-c-masthead__main",
|
14320 | "mastheadToggle": "pf-c-masthead__toggle",
|
14321 | "menuToggle": "pf-c-menu-toggle",
|
14322 | "modifiers": {
|
14323 | "light_200": "pf-m-light-200",
|
14324 | "light": "pf-m-light",
|
14325 | "resizeObserver": "pf-m-resize-observer",
|
14326 | "breakpointXl": "pf-m-breakpoint-xl",
|
14327 | "fullHeight": "pf-m-full-height",
|
14328 | "horizontal": "pf-m-horizontal",
|
14329 | "displayStack": "pf-m-display-stack",
|
14330 | "displayInline": "pf-m-display-inline",
|
14331 | "insetNone": "pf-m-inset-none",
|
14332 | "insetSm": "pf-m-inset-sm",
|
14333 | "insetMd": "pf-m-inset-md",
|
14334 | "insetLg": "pf-m-inset-lg",
|
14335 | "insetXl": "pf-m-inset-xl",
|
14336 | "inset_2xl": "pf-m-inset-2xl",
|
14337 | "displayStackOnSm": "pf-m-display-stack-on-sm",
|
14338 | "displayInlineOnSm": "pf-m-display-inline-on-sm",
|
14339 | "insetNoneOnSm": "pf-m-inset-none-on-sm",
|
14340 | "insetSmOnSm": "pf-m-inset-sm-on-sm",
|
14341 | "insetMdOnSm": "pf-m-inset-md-on-sm",
|
14342 | "insetLgOnSm": "pf-m-inset-lg-on-sm",
|
14343 | "insetXlOnSm": "pf-m-inset-xl-on-sm",
|
14344 | "inset_2xlOnSm": "pf-m-inset-2xl-on-sm",
|
14345 | "displayStackOnMd": "pf-m-display-stack-on-md",
|
14346 | "displayInlineOnMd": "pf-m-display-inline-on-md",
|
14347 | "insetNoneOnMd": "pf-m-inset-none-on-md",
|
14348 | "insetSmOnMd": "pf-m-inset-sm-on-md",
|
14349 | "insetMdOnMd": "pf-m-inset-md-on-md",
|
14350 | "insetLgOnMd": "pf-m-inset-lg-on-md",
|
14351 | "insetXlOnMd": "pf-m-inset-xl-on-md",
|
14352 | "inset_2xlOnMd": "pf-m-inset-2xl-on-md",
|
14353 | "displayStackOnLg": "pf-m-display-stack-on-lg",
|
14354 | "displayInlineOnLg": "pf-m-display-inline-on-lg",
|
14355 | "insetNoneOnLg": "pf-m-inset-none-on-lg",
|
14356 | "insetSmOnLg": "pf-m-inset-sm-on-lg",
|
14357 | "insetMdOnLg": "pf-m-inset-md-on-lg",
|
14358 | "insetLgOnLg": "pf-m-inset-lg-on-lg",
|
14359 | "insetXlOnLg": "pf-m-inset-xl-on-lg",
|
14360 | "inset_2xlOnLg": "pf-m-inset-2xl-on-lg",
|
14361 | "displayStackOnXl": "pf-m-display-stack-on-xl",
|
14362 | "displayInlineOnXl": "pf-m-display-inline-on-xl",
|
14363 | "insetNoneOnXl": "pf-m-inset-none-on-xl",
|
14364 | "insetSmOnXl": "pf-m-inset-sm-on-xl",
|
14365 | "insetMdOnXl": "pf-m-inset-md-on-xl",
|
14366 | "insetLgOnXl": "pf-m-inset-lg-on-xl",
|
14367 | "insetXlOnXl": "pf-m-inset-xl-on-xl",
|
14368 | "inset_2xlOnXl": "pf-m-inset-2xl-on-xl",
|
14369 | "displayStackOn_2xl": "pf-m-display-stack-on-2xl",
|
14370 | "displayInlineOn_2xl": "pf-m-display-inline-on-2xl",
|
14371 | "insetNoneOn_2xl": "pf-m-inset-none-on-2xl",
|
14372 | "insetSmOn_2xl": "pf-m-inset-sm-on-2xl",
|
14373 | "insetMdOn_2xl": "pf-m-inset-md-on-2xl",
|
14374 | "insetLgOn_2xl": "pf-m-inset-lg-on-2xl",
|
14375 | "insetXlOn_2xl": "pf-m-inset-xl-on-2xl",
|
14376 | "inset_2xlOn_2xl": "pf-m-inset-2xl-on-2xl"
|
14377 | },
|
14378 | "nav": "pf-c-nav",
|
14379 | "page": "pf-c-page",
|
14380 | "toolbar": "pf-c-toolbar",
|
14381 | "toolbarContentSection": "pf-c-toolbar__content-section",
|
14382 | "toolbarExpandableContent": "pf-c-toolbar__expandable-content"
|
14383 | };
|
14384 |
|
14385 | Promise.resolve().then(function () { return page; });
|
14386 | var styles$z = {
|
14387 | "avatar": "pf-c-avatar",
|
14388 | "brand": "pf-c-brand",
|
14389 | "button": "pf-c-button",
|
14390 | "card": "pf-c-card",
|
14391 | "contextSelector": "pf-c-context-selector",
|
14392 | "drawer": "pf-c-drawer",
|
14393 | "masthead": "pf-c-masthead",
|
14394 | "modifiers": {
|
14395 | "light": "pf-m-light",
|
14396 | "menu": "pf-m-menu",
|
14397 | "hidden": "pf-m-hidden",
|
14398 | "hiddenOnSm": "pf-m-hidden-on-sm",
|
14399 | "visibleOnSm": "pf-m-visible-on-sm",
|
14400 | "hiddenOnMd": "pf-m-hidden-on-md",
|
14401 | "visibleOnMd": "pf-m-visible-on-md",
|
14402 | "hiddenOnLg": "pf-m-hidden-on-lg",
|
14403 | "visibleOnLg": "pf-m-visible-on-lg",
|
14404 | "hiddenOnXl": "pf-m-hidden-on-xl",
|
14405 | "visibleOnXl": "pf-m-visible-on-xl",
|
14406 | "hiddenOn_2xl": "pf-m-hidden-on-2xl",
|
14407 | "visibleOn_2xl": "pf-m-visible-on-2xl",
|
14408 | "read": "pf-m-read",
|
14409 | "selected": "pf-m-selected",
|
14410 | "unread": "pf-m-unread",
|
14411 | "attention": "pf-m-attention",
|
14412 | "expanded": "pf-m-expanded",
|
14413 | "collapsed": "pf-m-collapsed",
|
14414 | "limitWidth": "pf-m-limit-width",
|
14415 | "alignCenter": "pf-m-align-center",
|
14416 | "stickyTop": "pf-m-sticky-top",
|
14417 | "stickyBottom": "pf-m-sticky-bottom",
|
14418 | "overflowScroll": "pf-m-overflow-scroll",
|
14419 | "shadowBottom": "pf-m-shadow-bottom",
|
14420 | "shadowTop": "pf-m-shadow-top",
|
14421 | "fill": "pf-m-fill",
|
14422 | "noFill": "pf-m-no-fill",
|
14423 | "dark_100": "pf-m-dark-100",
|
14424 | "dark_200": "pf-m-dark-200",
|
14425 | "padding": "pf-m-padding",
|
14426 | "noPadding": "pf-m-no-padding",
|
14427 | "paddingOnSm": "pf-m-padding-on-sm",
|
14428 | "noPaddingOnSm": "pf-m-no-padding-on-sm",
|
14429 | "paddingOnMd": "pf-m-padding-on-md",
|
14430 | "noPaddingOnMd": "pf-m-no-padding-on-md",
|
14431 | "paddingOnLg": "pf-m-padding-on-lg",
|
14432 | "noPaddingOnLg": "pf-m-no-padding-on-lg",
|
14433 | "paddingOnXl": "pf-m-padding-on-xl",
|
14434 | "noPaddingOnXl": "pf-m-no-padding-on-xl",
|
14435 | "paddingOn_2xl": "pf-m-padding-on-2xl",
|
14436 | "noPaddingOn_2xl": "pf-m-no-padding-on-2xl",
|
14437 | "light_200": "pf-m-light-200"
|
14438 | },
|
14439 | "nav": "pf-c-nav",
|
14440 | "notificationBadge": "pf-c-notification-badge",
|
14441 | "page": "pf-c-page",
|
14442 | "pageDrawer": "pf-c-page__drawer",
|
14443 | "pageHeader": "pf-c-page__header",
|
14444 | "pageHeaderBrand": "pf-c-page__header-brand",
|
14445 | "pageHeaderBrandLink": "pf-c-page__header-brand-link",
|
14446 | "pageHeaderBrandToggle": "pf-c-page__header-brand-toggle",
|
14447 | "pageHeaderNav": "pf-c-page__header-nav",
|
14448 | "pageHeaderTools": "pf-c-page__header-tools",
|
14449 | "pageHeaderToolsGroup": "pf-c-page__header-tools-group",
|
14450 | "pageHeaderToolsItem": "pf-c-page__header-tools-item",
|
14451 | "pageMain": "pf-c-page__main",
|
14452 | "pageMainBody": "pf-c-page__main-body",
|
14453 | "pageMainBreadcrumb": "pf-c-page__main-breadcrumb",
|
14454 | "pageMainDrawer": "pf-c-page__main-drawer",
|
14455 | "pageMainGroup": "pf-c-page__main-group",
|
14456 | "pageMainNav": "pf-c-page__main-nav",
|
14457 | "pageMainSection": "pf-c-page__main-section",
|
14458 | "pageMainSubnav": "pf-c-page__main-subnav",
|
14459 | "pageMainTabs": "pf-c-page__main-tabs",
|
14460 | "pageMainWizard": "pf-c-page__main-wizard",
|
14461 | "pageSidebar": "pf-c-page__sidebar",
|
14462 | "pageSidebarBody": "pf-c-page__sidebar-body"
|
14463 | };
|
14464 |
|
14465 | const global_breakpoint_xl = {
|
14466 | "name": "--pf-global--breakpoint--xl",
|
14467 | "value": "1200px",
|
14468 | "var": "var(--pf-global--breakpoint--xl)"
|
14469 | };
|
14470 | var globalBreakpointXl = global_breakpoint_xl;
|
14471 |
|
14472 | const PageGroup = (_a) => {
|
14473 | var { className = '', children, sticky, hasShadowTop = false, hasShadowBottom = false, hasOverflowScroll = false } = _a, props = __rest$1(_a, ["className", "children", "sticky", "hasShadowTop", "hasShadowBottom", "hasOverflowScroll"]);
|
14474 | return (React__namespace.createElement("div", Object.assign({}, props, { className: css(styles$z.pageMainGroup, sticky === 'top' && styles$z.modifiers.stickyTop, sticky === 'bottom' && styles$z.modifiers.stickyBottom, hasShadowTop && styles$z.modifiers.shadowTop, hasShadowBottom && styles$z.modifiers.shadowBottom, hasOverflowScroll && styles$z.modifiers.overflowScroll, className) }, (hasOverflowScroll && { tabIndex: 0 })), children));
|
14475 | };
|
14476 | PageGroup.displayName = 'PageGroup';
|
14477 |
|
14478 | exports.PageLayouts = void 0;
|
14479 | (function (PageLayouts) {
|
14480 | PageLayouts["vertical"] = "vertical";
|
14481 | PageLayouts["horizontal"] = "horizontal";
|
14482 | })(exports.PageLayouts || (exports.PageLayouts = {}));
|
14483 | const pageContextDefaults = {
|
14484 | isManagedSidebar: false,
|
14485 | isNavOpen: false,
|
14486 | onNavToggle: () => null,
|
14487 | width: null,
|
14488 | getBreakpoint
|
14489 | };
|
14490 | const PageContext = React__namespace.createContext(pageContextDefaults);
|
14491 | const PageContextProvider = PageContext.Provider;
|
14492 | const PageContextConsumer = PageContext.Consumer;
|
14493 | class Page extends React__namespace.Component {
|
14494 | constructor(props) {
|
14495 | super(props);
|
14496 | this.mainRef = React__namespace.createRef();
|
14497 | this.pageRef = React__namespace.createRef();
|
14498 | this.observer = () => { };
|
14499 | this.getWindowWidth = () => {
|
14500 | if (canUseDOM) {
|
14501 | return this.pageRef.current ? this.pageRef.current.clientWidth : window.innerWidth;
|
14502 | }
|
14503 | else {
|
14504 | return 1200;
|
14505 | }
|
14506 | };
|
14507 | this.isMobile = () =>
|
14508 |
|
14509 | this.getWindowWidth() < Number.parseInt(globalBreakpointXl.value, 10);
|
14510 | this.resize = () => {
|
14511 | const { onPageResize } = this.props;
|
14512 | const mobileView = this.isMobile();
|
14513 | if (onPageResize) {
|
14514 | onPageResize({ mobileView, windowSize: this.getWindowWidth() });
|
14515 | }
|
14516 | if (mobileView !== this.state.mobileView) {
|
14517 | this.setState({ mobileView });
|
14518 | }
|
14519 | this.pageRef.current && this.setState({ width: this.pageRef.current.clientWidth });
|
14520 | };
|
14521 | this.handleResize = debounce$1(this.resize, 250);
|
14522 | this.handleMainClick = () => {
|
14523 | if (this.isMobile() && this.state.mobileIsNavOpen && this.mainRef.current) {
|
14524 | this.setState({ mobileIsNavOpen: false });
|
14525 | }
|
14526 | };
|
14527 | this.onNavToggleMobile = () => {
|
14528 | this.setState(prevState => ({
|
14529 | mobileIsNavOpen: !prevState.mobileIsNavOpen
|
14530 | }));
|
14531 | };
|
14532 | this.onNavToggleDesktop = () => {
|
14533 | this.setState(prevState => ({
|
14534 | desktopIsNavOpen: !prevState.desktopIsNavOpen
|
14535 | }));
|
14536 | };
|
14537 | const { isManagedSidebar, defaultManagedSidebarIsOpen } = props;
|
14538 | const managedSidebarOpen = !isManagedSidebar ? true : defaultManagedSidebarIsOpen;
|
14539 | this.state = {
|
14540 | desktopIsNavOpen: managedSidebarOpen,
|
14541 | mobileIsNavOpen: false,
|
14542 | mobileView: false,
|
14543 | width: null
|
14544 | };
|
14545 | }
|
14546 | componentDidMount() {
|
14547 | const { isManagedSidebar, onPageResize } = this.props;
|
14548 | if (isManagedSidebar || onPageResize) {
|
14549 | this.observer = getResizeObserver(this.pageRef.current, this.handleResize);
|
14550 | const currentRef = this.mainRef.current;
|
14551 | if (currentRef) {
|
14552 | currentRef.addEventListener('mousedown', this.handleMainClick);
|
14553 | currentRef.addEventListener('touchstart', this.handleMainClick);
|
14554 | }
|
14555 |
|
14556 | this.resize();
|
14557 | }
|
14558 | }
|
14559 | componentWillUnmount() {
|
14560 | const { isManagedSidebar, onPageResize } = this.props;
|
14561 | if (isManagedSidebar || onPageResize) {
|
14562 | this.observer();
|
14563 | const currentRef = this.mainRef.current;
|
14564 | if (currentRef) {
|
14565 | currentRef.removeEventListener('mousedown', this.handleMainClick);
|
14566 | currentRef.removeEventListener('touchstart', this.handleMainClick);
|
14567 | }
|
14568 | }
|
14569 | }
|
14570 | render() {
|
14571 | const _a = this.props, { breadcrumb, isBreadcrumbWidthLimited, className, children, header, sidebar, notificationDrawer, isNotificationDrawerExpanded, onNotificationDrawerExpand, isTertiaryNavWidthLimited, skipToContent, role, mainContainerId, isManagedSidebar,
|
14572 |
|
14573 | defaultManagedSidebarIsOpen,
|
14574 |
|
14575 | onPageResize, getBreakpoint, mainAriaLabel, mainTabIndex, tertiaryNav, isTertiaryNavGrouped, isBreadcrumbGrouped, additionalGroupedContent, groupProps } = _a, rest = __rest$1(_a, ["breadcrumb", "isBreadcrumbWidthLimited", "className", "children", "header", "sidebar", "notificationDrawer", "isNotificationDrawerExpanded", "onNotificationDrawerExpand", "isTertiaryNavWidthLimited", "skipToContent", "role", "mainContainerId", "isManagedSidebar", "defaultManagedSidebarIsOpen", "onPageResize", "getBreakpoint", "mainAriaLabel", "mainTabIndex", "tertiaryNav", "isTertiaryNavGrouped", "isBreadcrumbGrouped", "additionalGroupedContent", "groupProps"]);
|
14576 | const { mobileView, mobileIsNavOpen, desktopIsNavOpen, width } = this.state;
|
14577 | const context = {
|
14578 | isManagedSidebar,
|
14579 | onNavToggle: mobileView ? this.onNavToggleMobile : this.onNavToggleDesktop,
|
14580 | isNavOpen: mobileView ? mobileIsNavOpen : desktopIsNavOpen,
|
14581 | width,
|
14582 | getBreakpoint
|
14583 | };
|
14584 | let nav = null;
|
14585 | if (tertiaryNav && isTertiaryNavWidthLimited) {
|
14586 | nav = (React__namespace.createElement("div", { className: css(styles$z.pageMainNav, styles$z.modifiers.limitWidth) },
|
14587 | React__namespace.createElement("div", { className: css(styles$z.pageMainBody) }, tertiaryNav)));
|
14588 | }
|
14589 | else if (tertiaryNav) {
|
14590 | nav = React__namespace.createElement("div", { className: css(styles$z.pageMainNav) }, tertiaryNav);
|
14591 | }
|
14592 | let crumb = null;
|
14593 | if (breadcrumb && isBreadcrumbWidthLimited) {
|
14594 | crumb = (React__namespace.createElement("section", { className: css(styles$z.pageMainBreadcrumb, styles$z.modifiers.limitWidth) },
|
14595 | React__namespace.createElement("div", { className: css(styles$z.pageMainBody) }, breadcrumb)));
|
14596 | }
|
14597 | else if (breadcrumb) {
|
14598 | crumb = React__namespace.createElement("section", { className: css(styles$z.pageMainBreadcrumb) }, breadcrumb);
|
14599 | }
|
14600 | const isGrouped = isTertiaryNavGrouped || isBreadcrumbGrouped || additionalGroupedContent;
|
14601 | const group = isGrouped ? (React__namespace.createElement(PageGroup, Object.assign({}, groupProps),
|
14602 | isTertiaryNavGrouped && nav,
|
14603 | isBreadcrumbGrouped && crumb,
|
14604 | additionalGroupedContent)) : null;
|
14605 | const main = (React__namespace.createElement("main", { ref: this.mainRef, role: role, id: mainContainerId, className: css(styles$z.pageMain), tabIndex: mainTabIndex, "aria-label": mainAriaLabel },
|
14606 | group,
|
14607 | !isTertiaryNavGrouped && nav,
|
14608 | !isBreadcrumbGrouped && crumb,
|
14609 | children));
|
14610 | const panelContent = React__namespace.createElement(DrawerPanelContent, null, notificationDrawer);
|
14611 | return (React__namespace.createElement(PageContextProvider, { value: context },
|
14612 | React__namespace.createElement("div", Object.assign({ ref: this.pageRef }, rest, { className: css(styles$z.page, width !== null && 'pf-m-resize-observer', width !== null && `pf-m-breakpoint-${getBreakpoint(width)}`, className) }),
|
14613 | skipToContent,
|
14614 | header,
|
14615 | sidebar,
|
14616 | notificationDrawer && (React__namespace.createElement("div", { className: css(styles$z.pageDrawer) },
|
14617 | React__namespace.createElement(Drawer, { isExpanded: isNotificationDrawerExpanded, onExpand: onNotificationDrawerExpand },
|
14618 | React__namespace.createElement(DrawerContent, { panelContent: panelContent },
|
14619 | React__namespace.createElement(DrawerContentBody, null, main))))),
|
14620 | !notificationDrawer && main)));
|
14621 | }
|
14622 | }
|
14623 | Page.displayName = 'Page';
|
14624 | Page.defaultProps = {
|
14625 | isManagedSidebar: false,
|
14626 | isBreadcrumbWidthLimited: false,
|
14627 | defaultManagedSidebarIsOpen: true,
|
14628 | onPageResize: () => null,
|
14629 | mainTabIndex: -1,
|
14630 | isNotificationDrawerExpanded: false,
|
14631 | onNotificationDrawerExpand: () => null,
|
14632 | getBreakpoint
|
14633 | };
|
14634 |
|
14635 | const Masthead = (_a) => {
|
14636 | var { children, className, backgroundColor = 'dark', display = {
|
14637 | md: 'inline'
|
14638 | }, inset } = _a, props = __rest$1(_a, ["children", "className", "backgroundColor", "display", "inset"]);
|
14639 | const { width, getBreakpoint } = React__namespace.useContext(PageContext);
|
14640 | return (React__namespace.createElement("header", Object.assign({ className: css(styles$A.masthead, formatBreakpointMods(display, styles$A, 'display-', getBreakpoint(width)), formatBreakpointMods(inset, styles$A, '', getBreakpoint(width)), backgroundColor === 'light' && styles$A.modifiers.light, backgroundColor === 'light200' && styles$A.modifiers.light_200, className) }, props), children));
|
14641 | };
|
14642 | Masthead.displayName = 'Masthead';
|
14643 |
|
14644 | const MastheadBrand = (_a) => {
|
14645 | var { children, className, component = 'a' } = _a, props = __rest$1(_a, ["children", "className", "component"]);
|
14646 | const Component = component;
|
14647 | return (React__namespace.createElement(Component, Object.assign({ className: css(styles$A.mastheadBrand, className), tabIndex: 0 }, props), children));
|
14648 | };
|
14649 | MastheadBrand.displayName = 'MastheadBrand';
|
14650 |
|
14651 | const MastheadContent = (_a) => {
|
14652 | var { children, className } = _a, props = __rest$1(_a, ["children", "className"]);
|
14653 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$A.mastheadContent, className) }, props), children));
|
14654 | };
|
14655 | MastheadContent.displayName = 'MastheadContent';
|
14656 |
|
14657 | const MastheadMain = (_a) => {
|
14658 | var { children, className } = _a, props = __rest$1(_a, ["children", "className"]);
|
14659 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$A.mastheadMain, className) }, props), children));
|
14660 | };
|
14661 | MastheadMain.displayName = 'MastheadMain';
|
14662 |
|
14663 | const MastheadToggle = (_a) => {
|
14664 | var { children, className } = _a, props = __rest$1(_a, ["children", "className"]);
|
14665 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$A.mastheadToggle, className) }, props), children));
|
14666 | };
|
14667 | MastheadToggle.displayName = 'MastheadToggle';
|
14668 |
|
14669 | Promise.resolve().then(function () { return menu; });
|
14670 | var menuStyles = {
|
14671 | "breadcrumb": "pf-c-breadcrumb",
|
14672 | "divider": "pf-c-divider",
|
14673 | "menu": "pf-c-menu",
|
14674 | "menuBreadcrumb": "pf-c-menu__breadcrumb",
|
14675 | "menuContent": "pf-c-menu__content",
|
14676 | "menuFooter": "pf-c-menu__footer",
|
14677 | "menuGroup": "pf-c-menu__group",
|
14678 | "menuGroupTitle": "pf-c-menu__group-title",
|
14679 | "menuHeader": "pf-c-menu__header",
|
14680 | "menuItem": "pf-c-menu__item",
|
14681 | "menuItemAction": "pf-c-menu__item-action",
|
14682 | "menuItemActionIcon": "pf-c-menu__item-action-icon",
|
14683 | "menuItemCheck": "pf-c-menu__item-check",
|
14684 | "menuItemDescription": "pf-c-menu__item-description",
|
14685 | "menuItemExternalIcon": "pf-c-menu__item-external-icon",
|
14686 | "menuItemIcon": "pf-c-menu__item-icon",
|
14687 | "menuItemMain": "pf-c-menu__item-main",
|
14688 | "menuItemSelectIcon": "pf-c-menu__item-select-icon",
|
14689 | "menuItemText": "pf-c-menu__item-text",
|
14690 | "menuItemToggleIcon": "pf-c-menu__item-toggle-icon",
|
14691 | "menuList": "pf-c-menu__list",
|
14692 | "menuListItem": "pf-c-menu__list-item",
|
14693 | "menuSearch": "pf-c-menu__search",
|
14694 | "modifiers": {
|
14695 | "hidden": "pf-m-hidden",
|
14696 | "hiddenOnSm": "pf-m-hidden-on-sm",
|
14697 | "visibleOnSm": "pf-m-visible-on-sm",
|
14698 | "hiddenOnMd": "pf-m-hidden-on-md",
|
14699 | "visibleOnMd": "pf-m-visible-on-md",
|
14700 | "hiddenOnLg": "pf-m-hidden-on-lg",
|
14701 | "visibleOnLg": "pf-m-visible-on-lg",
|
14702 | "hiddenOnXl": "pf-m-hidden-on-xl",
|
14703 | "visibleOnXl": "pf-m-visible-on-xl",
|
14704 | "hiddenOn_2xl": "pf-m-hidden-on-2xl",
|
14705 | "visibleOn_2xl": "pf-m-visible-on-2xl",
|
14706 | "flyout": "pf-m-flyout",
|
14707 | "top": "pf-m-top",
|
14708 | "left": "pf-m-left",
|
14709 | "drilldown": "pf-m-drilldown",
|
14710 | "drilledIn": "pf-m-drilled-in",
|
14711 | "currentPath": "pf-m-current-path",
|
14712 | "static": "pf-m-static",
|
14713 | "plain": "pf-m-plain",
|
14714 | "scrollable": "pf-m-scrollable",
|
14715 | "nav": "pf-m-nav",
|
14716 | "focus": "pf-m-focus",
|
14717 | "disabled": "pf-m-disabled",
|
14718 | "load": "pf-m-load",
|
14719 | "loading": "pf-m-loading",
|
14720 | "selected": "pf-m-selected",
|
14721 | "favorite": "pf-m-favorite",
|
14722 | "favorited": "pf-m-favorited"
|
14723 | }
|
14724 | };
|
14725 |
|
14726 | const MenuContext = React__namespace.createContext({
|
14727 | menuId: null,
|
14728 | parentMenu: null,
|
14729 | onActionClick: () => null,
|
14730 | onSelect: () => null,
|
14731 | activeItemId: null,
|
14732 | selected: null,
|
14733 | drilledInMenus: [],
|
14734 | drilldownItemPath: [],
|
14735 | onDrillIn: null,
|
14736 | onDrillOut: null,
|
14737 | onGetMenuHeight: () => null,
|
14738 | flyoutRef: null,
|
14739 | setFlyoutRef: () => null,
|
14740 | disableHover: false
|
14741 | });
|
14742 | const MenuItemContext = React__namespace.createContext({
|
14743 | itemId: null,
|
14744 | isDisabled: false
|
14745 | });
|
14746 |
|
14747 | class MenuBase extends React__namespace.Component {
|
14748 | constructor(props) {
|
14749 | super(props);
|
14750 | this.menuRef = React__namespace.createRef();
|
14751 | this.activeMenu = null;
|
14752 | this.state = {
|
14753 | ouiaStateId: getDefaultOUIAId(Menu.displayName),
|
14754 | searchInputValue: '',
|
14755 | transitionMoveTarget: null,
|
14756 | flyoutRef: null,
|
14757 | disableHover: false
|
14758 | };
|
14759 | this.handleDrilldownTransition = (event) => {
|
14760 | const current = this.menuRef.current;
|
14761 | if (!current ||
|
14762 | (current !== event.target.closest('.pf-c-menu') &&
|
14763 | !Array.from(current.getElementsByClassName('pf-c-menu')).includes(event.target.closest('.pf-c-menu')))) {
|
14764 | return;
|
14765 | }
|
14766 | if (this.state.transitionMoveTarget) {
|
14767 | this.state.transitionMoveTarget.focus();
|
14768 | this.setState({ transitionMoveTarget: null });
|
14769 | }
|
14770 | else {
|
14771 | const nextMenu = current.querySelector('#' + this.props.activeMenu) || current || null;
|
14772 | const nextTarget = Array.from(nextMenu.getElementsByTagName('UL')[0].children).filter(el => !(el.classList.contains('pf-m-disabled') || el.classList.contains('pf-c-divider')))[0].firstChild;
|
14773 | nextTarget.focus();
|
14774 | nextTarget.tabIndex = 0;
|
14775 | }
|
14776 | };
|
14777 | this.handleExtraKeys = (event) => {
|
14778 | const isDrilldown = this.props.containsDrilldown;
|
14779 | const activeElement = document.activeElement;
|
14780 | if (event.target.closest('.pf-c-menu') !== this.activeMenu &&
|
14781 | !event.target.classList.contains('pf-c-breadcrumb__link')) {
|
14782 | this.activeMenu = event.target.closest('.pf-c-menu');
|
14783 | this.setState({ disableHover: true });
|
14784 | }
|
14785 | if (event.target.tagName === 'INPUT') {
|
14786 | return;
|
14787 | }
|
14788 | const parentMenu = this.activeMenu;
|
14789 | const key = event.key;
|
14790 | const isFromBreadcrumb = activeElement.classList.contains('pf-c-breadcrumb__link') ||
|
14791 | activeElement.classList.contains('pf-c-dropdown__toggle');
|
14792 | if (key === ' ' || key === 'Enter') {
|
14793 | event.preventDefault();
|
14794 | if (isDrilldown && !isFromBreadcrumb) {
|
14795 | const isDrillingOut = activeElement.closest('li').classList.contains('pf-m-current-path');
|
14796 | if (isDrillingOut && parentMenu.parentElement.tagName === 'LI') {
|
14797 | activeElement.tabIndex = -1;
|
14798 | parentMenu.parentElement.firstChild.tabIndex = 0;
|
14799 | this.setState({ transitionMoveTarget: parentMenu.parentElement.firstChild });
|
14800 | }
|
14801 | else {
|
14802 | if (activeElement.nextElementSibling && activeElement.nextElementSibling.classList.contains('pf-c-menu')) {
|
14803 | const childItems = Array.from(activeElement.nextElementSibling.getElementsByTagName('UL')[0].children).filter(el => !(el.classList.contains('pf-m-disabled') || el.classList.contains('pf-c-divider')));
|
14804 | activeElement.tabIndex = -1;
|
14805 | childItems[0].firstChild.tabIndex = 0;
|
14806 | this.setState({ transitionMoveTarget: childItems[0].firstChild });
|
14807 | }
|
14808 | }
|
14809 | }
|
14810 | document.activeElement.click();
|
14811 | }
|
14812 | };
|
14813 | this.createNavigableElements = () => {
|
14814 | const isDrilldown = this.props.containsDrilldown;
|
14815 | return isDrilldown
|
14816 | ? Array.from(this.activeMenu.getElementsByTagName('UL')[0].children).filter(el => !(el.classList.contains('pf-m-disabled') || el.classList.contains('pf-c-divider')))
|
14817 | : Array.from(this.menuRef.current.getElementsByTagName('LI')).filter(el => !(el.classList.contains('pf-m-disabled') || el.classList.contains('pf-c-divider')));
|
14818 | };
|
14819 | if (props.innerRef) {
|
14820 | this.menuRef = props.innerRef;
|
14821 | }
|
14822 | }
|
14823 | allowTabFirstItem() {
|
14824 |
|
14825 | const current = this.menuRef.current;
|
14826 | if (current) {
|
14827 | const first = current.querySelector('ul button, ul a');
|
14828 | if (first) {
|
14829 | first.tabIndex = 0;
|
14830 | }
|
14831 | }
|
14832 | }
|
14833 | componentDidMount() {
|
14834 | if (this.context) {
|
14835 | this.setState({ disableHover: this.context.disableHover });
|
14836 | }
|
14837 | if (canUseDOM) {
|
14838 | window.addEventListener('transitionend', this.props.isRootMenu ? this.handleDrilldownTransition : null);
|
14839 | }
|
14840 | this.allowTabFirstItem();
|
14841 | }
|
14842 | componentWillUnmount() {
|
14843 | if (canUseDOM) {
|
14844 | window.removeEventListener('transitionend', this.handleDrilldownTransition);
|
14845 | }
|
14846 | }
|
14847 | componentDidUpdate(prevProps) {
|
14848 | if (prevProps.children !== this.props.children) {
|
14849 | this.allowTabFirstItem();
|
14850 | }
|
14851 | }
|
14852 | render() {
|
14853 | const _a = this.props, { 'aria-label': ariaLabel, id, children, className, onSelect, selected = null, onActionClick, ouiaId, ouiaSafe, containsFlyout, isNavFlyout, containsDrilldown, isMenuDrilledIn, isPlain, isScrollable, drilldownItemPath, drilledInMenus, onDrillIn, onDrillOut, onGetMenuHeight, parentMenu = null, activeItemId = null,
|
14854 |
|
14855 | innerRef, isRootMenu, activeMenu } = _a,
|
14856 |
|
14857 | props = __rest$1(_a, ['aria-label', "id", "children", "className", "onSelect", "selected", "onActionClick", "ouiaId", "ouiaSafe", "containsFlyout", "isNavFlyout", "containsDrilldown", "isMenuDrilledIn", "isPlain", "isScrollable", "drilldownItemPath", "drilledInMenus", "onDrillIn", "onDrillOut", "onGetMenuHeight", "parentMenu", "activeItemId", "innerRef", "isRootMenu", "activeMenu"]);
|
14858 | const _isMenuDrilledIn = isMenuDrilledIn || (drilledInMenus && drilledInMenus.includes(id)) || false;
|
14859 | return (React__namespace.createElement(MenuContext.Provider, { value: {
|
14860 | menuId: id,
|
14861 | parentMenu: parentMenu || id,
|
14862 | onSelect,
|
14863 | onActionClick,
|
14864 | activeItemId,
|
14865 | selected,
|
14866 | drilledInMenus,
|
14867 | drilldownItemPath,
|
14868 | onDrillIn,
|
14869 | onDrillOut,
|
14870 | onGetMenuHeight,
|
14871 | flyoutRef: this.state.flyoutRef,
|
14872 | setFlyoutRef: flyoutRef => this.setState({ flyoutRef }),
|
14873 | disableHover: this.state.disableHover
|
14874 | } },
|
14875 | isRootMenu && (React__namespace.createElement(KeyboardHandler, { containerRef: this.menuRef || null, additionalKeyHandler: this.handleExtraKeys, createNavigableElements: this.createNavigableElements, isActiveElement: (element) => document.activeElement.parentElement === element ||
|
14876 | (document.activeElement.closest('ol') && document.activeElement.closest('ol').firstChild === element), getFocusableElement: (navigableElement) => navigableElement.firstChild, noHorizontalArrowHandling: document.activeElement &&
|
14877 | (document.activeElement.classList.contains('pf-c-breadcrumb__link') ||
|
14878 | document.activeElement.classList.contains('pf-c-dropdown__toggle')), noEnterHandling: true, noSpaceHandling: true })),
|
14879 | React__namespace.createElement("div", Object.assign({ id: id, className: css(menuStyles.menu, isPlain && menuStyles.modifiers.plain, isScrollable && menuStyles.modifiers.scrollable, containsFlyout && menuStyles.modifiers.flyout, isNavFlyout && menuStyles.modifiers.nav, containsDrilldown && menuStyles.modifiers.drilldown, _isMenuDrilledIn && menuStyles.modifiers.drilledIn, className), "aria-label": ariaLabel, ref: this.menuRef }, getOUIAProps(Menu.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId, ouiaSafe), props), children)));
|
14880 | }
|
14881 | }
|
14882 | MenuBase.displayName = 'Menu';
|
14883 | MenuBase.contextType = MenuContext;
|
14884 | MenuBase.defaultProps = {
|
14885 | ouiaSafe: true,
|
14886 | isRootMenu: true,
|
14887 | isPlain: false,
|
14888 | isScrollable: false
|
14889 | };
|
14890 | const Menu = React__namespace.forwardRef((props, ref) => (React__namespace.createElement(MenuBase, Object.assign({}, props, { innerRef: ref }))));
|
14891 | Menu.displayName = 'Menu';
|
14892 |
|
14893 | const MenuContent = React__namespace.forwardRef((props, ref) => {
|
14894 | const { getHeight, children, menuHeight, maxMenuHeight } = props, rest = __rest$1(props, ["getHeight", "children", "menuHeight", "maxMenuHeight"]);
|
14895 | const menuContentRef = React__namespace.createRef();
|
14896 | const refCallback = (el, menuId, onGetMenuHeight) => {
|
14897 | if (el) {
|
14898 | let clientHeight = el.clientHeight;
|
14899 |
|
14900 | let rootMenuList = null;
|
14901 | let parentEl = el.closest(`.${menuStyles.menuList}`);
|
14902 | while (parentEl !== null && parentEl.nodeType === 1) {
|
14903 | if (parentEl.classList.contains(menuStyles.menuList)) {
|
14904 | rootMenuList = parentEl;
|
14905 | }
|
14906 | parentEl = parentEl.parentElement;
|
14907 | }
|
14908 | if (rootMenuList) {
|
14909 | const rootMenuListStyles = getComputedStyle(rootMenuList);
|
14910 | const rootMenuListPaddingOffset = parseFloat(rootMenuListStyles.getPropertyValue('padding-top').replace(/px/g, '')) +
|
14911 | parseFloat(rootMenuListStyles.getPropertyValue('padding-bottom').replace(/px/g, '')) +
|
14912 | parseFloat(getComputedStyle(rootMenuList.parentElement)
|
14913 | .getPropertyValue('border-bottom-width')
|
14914 | .replace(/px/g, ''));
|
14915 | clientHeight = clientHeight + rootMenuListPaddingOffset;
|
14916 | }
|
14917 | onGetMenuHeight && onGetMenuHeight(menuId, clientHeight);
|
14918 | getHeight && getHeight(clientHeight.toString());
|
14919 | }
|
14920 | return ref || menuContentRef;
|
14921 | };
|
14922 | return (React__namespace.createElement(MenuContext.Consumer, null, ({ menuId, onGetMenuHeight }) => (React__namespace.createElement("div", Object.assign({}, rest, { className: css(menuStyles.menuContent, props.className), ref: el => refCallback(el, menuId, onGetMenuHeight), style: Object.assign(Object.assign({}, (menuHeight && { '--pf-c-menu__content--Height': menuHeight })), (maxMenuHeight && { '--pf-c-menu__content--MaxHeight': maxMenuHeight })) }), children))));
|
14923 | });
|
14924 | MenuContent.displayName = 'MenuContent';
|
14925 |
|
14926 | const MenuFooter = (_a) => {
|
14927 | var { children, className = '' } = _a, props = __rest$1(_a, ["children", "className"]);
|
14928 | return (React__namespace.createElement("div", Object.assign({}, props, { className: css(menuStyles.menuFooter, className) }), children));
|
14929 | };
|
14930 | MenuFooter.displayName = 'MenuFooter';
|
14931 |
|
14932 | const MenuInput = React__namespace.forwardRef((props, ref) => (React__namespace.createElement("div", Object.assign({}, props, { className: css(menuStyles.menuSearch, props.className), ref: ref }))));
|
14933 | MenuInput.displayName = 'MenuInput';
|
14934 |
|
14935 | const MenuGroupBase = (_a) => {
|
14936 | var { children, className = '', label = '', titleId = '', innerRef } = _a, props = __rest$1(_a, ["children", "className", "label", "titleId", "innerRef"]);
|
14937 | return (React__namespace.createElement("section", Object.assign({}, props, { className: css('pf-c-menu__group', className), ref: innerRef }),
|
14938 | label && (React__namespace.createElement("h1", { className: css(menuStyles.menuGroupTitle), id: titleId }, label)),
|
14939 | children));
|
14940 | };
|
14941 | const MenuGroup = React__namespace.forwardRef((props, ref) => (React__namespace.createElement(MenuGroupBase, Object.assign({}, props, { innerRef: ref }))));
|
14942 | MenuGroup.displayName = 'MenuGroup';
|
14943 |
|
14944 | const c_menu_m_flyout__menu_top_offset = {
|
14945 | "name": "--pf-c-menu--m-flyout__menu--top-offset",
|
14946 | "value": "0px",
|
14947 | "var": "var(--pf-c-menu--m-flyout__menu--top-offset)"
|
14948 | };
|
14949 | var topOffset = c_menu_m_flyout__menu_top_offset;
|
14950 |
|
14951 | const c_menu_m_flyout__menu_m_left_right_offset = {
|
14952 | "name": "--pf-c-menu--m-flyout__menu--m-left--right-offset",
|
14953 | "value": "0px",
|
14954 | "var": "var(--pf-c-menu--m-flyout__menu--m-left--right-offset)"
|
14955 | };
|
14956 | var rightOffset = c_menu_m_flyout__menu_m_left_right_offset;
|
14957 |
|
14958 | const c_menu_m_flyout__menu_left_offset = {
|
14959 | "name": "--pf-c-menu--m-flyout__menu--left-offset",
|
14960 | "value": "0px",
|
14961 | "var": "var(--pf-c-menu--m-flyout__menu--left-offset)"
|
14962 | };
|
14963 | var leftOffset = c_menu_m_flyout__menu_left_offset;
|
14964 |
|
14965 | const MenuItemActionBase = (_a) => {
|
14966 | var { className = '', icon, onClick, 'aria-label': ariaLabel, isFavorited = null, isDisabled, actionId, innerRef } = _a, props = __rest$1(_a, ["className", "icon", "onClick", 'aria-label', "isFavorited", "isDisabled", "actionId", "innerRef"]);
|
14967 | return (React__namespace.createElement(MenuContext.Consumer, null, ({ onActionClick }) => (React__namespace.createElement(MenuItemContext.Consumer, null, ({ itemId, isDisabled: isDisabledContext }) => {
|
14968 | const onClickButton = (event) => {
|
14969 |
|
14970 | onClick && onClick(event);
|
14971 |
|
14972 | onActionClick && onActionClick(event, itemId, actionId);
|
14973 | };
|
14974 | return (React__namespace.createElement("button", Object.assign({ className: css(menuStyles.menuItemAction, isFavorited !== null && menuStyles.modifiers.favorite, isFavorited && menuStyles.modifiers.favorited, className), "aria-label": ariaLabel, onClick: onClickButton }, ((isDisabled === true || isDisabledContext === true) && { disabled: true }), { ref: innerRef, tabIndex: -1 }, props),
|
14975 | React__namespace.createElement("span", { className: css(menuStyles.menuItemActionIcon) }, icon === 'favorites' || isFavorited !== null ? React__namespace.createElement(StarIcon$1, { "aria-hidden": true }) : icon)));
|
14976 | }))));
|
14977 | };
|
14978 | const MenuItemAction = React__namespace.forwardRef((props, ref) => (React__namespace.createElement(MenuItemActionBase, Object.assign({}, props, { innerRef: ref }))));
|
14979 | MenuItemAction.displayName = 'MenuItemAction';
|
14980 |
|
14981 | const FlyoutContext = React__namespace.createContext({
|
14982 | direction: 'right'
|
14983 | });
|
14984 | const MenuItemBase = (_a) => {
|
14985 | var { children, className, itemId = null, to, isActive = null, isFavorited = null, isLoadButton = false, isLoading = false, flyoutMenu, direction, description = null, onClick = () => { }, component = 'button', isDisabled = false, isExternalLink = false, isSelected = null, icon, actions, onShowFlyout, drilldownMenu, isOnPath, innerRef } = _a, props = __rest$1(_a, ["children", "className", "itemId", "to", "isActive", "isFavorited", "isLoadButton", "isLoading", "flyoutMenu", "direction", "description", "onClick", "component", "isDisabled", "isExternalLink", "isSelected", "icon", "actions", "onShowFlyout", "drilldownMenu", "isOnPath", "innerRef"]);
|
14986 | const { menuId, parentMenu, onSelect, onActionClick, activeItemId, selected, drilldownItemPath, onDrillIn, onDrillOut, flyoutRef, setFlyoutRef, disableHover } = React__namespace.useContext(MenuContext);
|
14987 | const Component = (to ? 'a' : component);
|
14988 | const [flyoutTarget, setFlyoutTarget] = React__namespace.useState(null);
|
14989 | const flyoutContext = React__namespace.useContext(FlyoutContext);
|
14990 | const [flyoutXDirection, setFlyoutXDirection] = React__namespace.useState(flyoutContext.direction);
|
14991 | const ref = React__namespace.useRef();
|
14992 | const flyoutVisible = ref === flyoutRef;
|
14993 | const hasFlyout = flyoutMenu !== undefined;
|
14994 | const showFlyout = (show) => {
|
14995 | if (!flyoutVisible && show) {
|
14996 | setFlyoutRef(ref);
|
14997 | }
|
14998 | else if (flyoutVisible && !show) {
|
14999 | setFlyoutRef(null);
|
15000 | }
|
15001 | onShowFlyout && show && onShowFlyout();
|
15002 | };
|
15003 | useIsomorphicLayoutEffect(() => {
|
15004 | if (hasFlyout && ref.current && canUseDOM) {
|
15005 | const flyoutMenu = ref.current.lastElementChild;
|
15006 | if (flyoutMenu && flyoutMenu.classList.contains(menuStyles.menu)) {
|
15007 | const origin = ref.current.getClientRects()[0];
|
15008 | const rect = flyoutMenu.getClientRects()[0];
|
15009 | if (origin && rect) {
|
15010 | const spaceLeftLeft = origin.x - rect.width;
|
15011 | const spaceLeftRight = window.innerWidth - origin.x - origin.width - rect.width;
|
15012 | let xDir = flyoutXDirection;
|
15013 | if (spaceLeftRight < 0 && xDir !== 'left') {
|
15014 | setFlyoutXDirection('left');
|
15015 | xDir = 'left';
|
15016 | }
|
15017 | else if (spaceLeftLeft < 0 && xDir !== 'right') {
|
15018 | setFlyoutXDirection('right');
|
15019 | xDir = 'right';
|
15020 | }
|
15021 | let xOffset = 0;
|
15022 | if (spaceLeftLeft < 0 && spaceLeftRight < 0) {
|
15023 | xOffset = xDir === 'right' ? -spaceLeftRight : -spaceLeftLeft;
|
15024 | }
|
15025 | if (xDir === 'left') {
|
15026 | flyoutMenu.classList.add(menuStyles.modifiers.left);
|
15027 | flyoutMenu.style.setProperty(rightOffset.name, `-${xOffset}px`);
|
15028 | }
|
15029 | else {
|
15030 | flyoutMenu.style.setProperty(leftOffset.name, `-${xOffset}px`);
|
15031 | }
|
15032 | const spaceLeftBot = window.innerHeight - origin.y - rect.height;
|
15033 | const spaceLeftTop = window.innerHeight - rect.height;
|
15034 | if (spaceLeftTop < 0 && spaceLeftBot < 0) ;
|
15035 | else if (spaceLeftBot < 0) {
|
15036 | flyoutMenu.style.setProperty(topOffset.name, `${spaceLeftBot}px`);
|
15037 | }
|
15038 | }
|
15039 | }
|
15040 | }
|
15041 | }, [flyoutVisible, flyoutMenu]);
|
15042 | React__namespace.useEffect(() => {
|
15043 | setFlyoutXDirection(flyoutContext.direction);
|
15044 | }, [flyoutContext]);
|
15045 | React__namespace.useEffect(() => {
|
15046 | if (flyoutTarget) {
|
15047 | if (flyoutVisible) {
|
15048 | const flyoutMenu = flyoutTarget.nextElementSibling;
|
15049 | const flyoutItems = Array.from(flyoutMenu.getElementsByTagName('UL')[0].children).filter(el => !(el.classList.contains('pf-m-disabled') || el.classList.contains('pf-c-divider')));
|
15050 | flyoutItems[0].firstChild.focus();
|
15051 | }
|
15052 | else {
|
15053 | flyoutTarget.focus();
|
15054 | }
|
15055 | }
|
15056 | }, [flyoutVisible, flyoutTarget]);
|
15057 | const handleFlyout = (event) => {
|
15058 | const key = event.key;
|
15059 | const target = event.target;
|
15060 | if (key === ' ' || key === 'Enter' || key === 'ArrowRight') {
|
15061 | event.stopPropagation();
|
15062 | if (!flyoutVisible) {
|
15063 | showFlyout(true);
|
15064 | setFlyoutTarget(target);
|
15065 | }
|
15066 | }
|
15067 | if (key === 'Escape' || key === 'ArrowLeft') {
|
15068 | if (flyoutVisible) {
|
15069 | event.stopPropagation();
|
15070 | showFlyout(false);
|
15071 | }
|
15072 | }
|
15073 | };
|
15074 | const onItemSelect = (event, onSelect) => {
|
15075 |
|
15076 | onSelect && onSelect(event, itemId);
|
15077 |
|
15078 | onClick && onClick(event);
|
15079 | };
|
15080 | const _isOnPath = (isOnPath && isOnPath) || (drilldownItemPath && drilldownItemPath.includes(itemId)) || false;
|
15081 | let _drill;
|
15082 | if (direction) {
|
15083 | if (direction === 'down') {
|
15084 | _drill = () => onDrillIn &&
|
15085 | onDrillIn(menuId, typeof drilldownMenu === 'function'
|
15086 | ? drilldownMenu().props.id
|
15087 | : drilldownMenu.props.id, itemId);
|
15088 | }
|
15089 | else {
|
15090 | _drill = () => onDrillOut && onDrillOut(parentMenu, itemId);
|
15091 | }
|
15092 | }
|
15093 | let additionalProps = {};
|
15094 | if (Component === 'a') {
|
15095 | additionalProps = {
|
15096 | href: to,
|
15097 | 'aria-disabled': isDisabled ? true : null,
|
15098 |
|
15099 | disabled: null
|
15100 | };
|
15101 | }
|
15102 | else if (Component === 'button') {
|
15103 | additionalProps = {
|
15104 | type: 'button'
|
15105 | };
|
15106 | }
|
15107 | if (isOnPath) {
|
15108 | additionalProps['aria-expanded'] = true;
|
15109 | }
|
15110 | else if (hasFlyout) {
|
15111 | additionalProps['aria-haspopup'] = true;
|
15112 | additionalProps['aria-expanded'] = flyoutVisible;
|
15113 | }
|
15114 | const getAriaCurrent = () => {
|
15115 | if (isActive !== null) {
|
15116 | if (isActive) {
|
15117 | return 'page';
|
15118 | }
|
15119 | else {
|
15120 | return null;
|
15121 | }
|
15122 | }
|
15123 | else if (itemId !== null && activeItemId !== null) {
|
15124 | return itemId === activeItemId;
|
15125 | }
|
15126 | return null;
|
15127 | };
|
15128 | const getIsSelected = () => {
|
15129 | if (isSelected !== null) {
|
15130 | return isSelected;
|
15131 | }
|
15132 | else if (selected !== null && itemId !== null) {
|
15133 | return (Array.isArray(selected) && selected.includes(itemId)) || itemId === selected;
|
15134 | }
|
15135 | return false;
|
15136 | };
|
15137 | const onMouseOver = () => {
|
15138 | if (disableHover) {
|
15139 | return;
|
15140 | }
|
15141 | if (hasFlyout) {
|
15142 | showFlyout(true);
|
15143 | }
|
15144 | else {
|
15145 | setFlyoutRef(null);
|
15146 | }
|
15147 | };
|
15148 | return (React__namespace.createElement("li", Object.assign({ className: css(menuStyles.menuListItem, isDisabled && menuStyles.modifiers.disabled, _isOnPath && menuStyles.modifiers.currentPath, isLoadButton && menuStyles.modifiers.load, isLoading && menuStyles.modifiers.loading, className), onMouseOver: onMouseOver }, (flyoutMenu && { onKeyDown: handleFlyout }), { ref: ref, role: "none" }, props),
|
15149 | React__namespace.createElement(Component, Object.assign({ tabIndex: -1, className: css(menuStyles.menuItem, getIsSelected() && menuStyles.modifiers.selected, className), "aria-current": getAriaCurrent(), disabled: isDisabled, role: "menuitem", ref: innerRef, onClick: (event) => {
|
15150 | onItemSelect(event, onSelect);
|
15151 | _drill && _drill();
|
15152 | } }, additionalProps),
|
15153 | React__namespace.createElement("span", { className: css(menuStyles.menuItemMain) },
|
15154 | direction === 'up' && (React__namespace.createElement("span", { className: css(menuStyles.menuItemToggleIcon) },
|
15155 | React__namespace.createElement(AngleLeftIcon$1, { "aria-hidden": true }))),
|
15156 | icon && React__namespace.createElement("span", { className: css(menuStyles.menuItemIcon) }, icon),
|
15157 | React__namespace.createElement("span", { className: css(menuStyles.menuItemText) }, children),
|
15158 | isExternalLink && (React__namespace.createElement("span", { className: css(menuStyles.menuItemExternalIcon) },
|
15159 | React__namespace.createElement(ExternalLinkAltIcon$1, { "aria-hidden": true }))),
|
15160 | (flyoutMenu || direction === 'down') && (React__namespace.createElement("span", { className: css(menuStyles.menuItemToggleIcon) },
|
15161 | React__namespace.createElement(AngleRightIcon$1, { "aria-hidden": true }))),
|
15162 | getIsSelected() && (React__namespace.createElement("span", { className: css(menuStyles.menuItemSelectIcon) },
|
15163 | React__namespace.createElement(CheckIcon$1, { "aria-hidden": true })))),
|
15164 | description && direction !== 'up' && (React__namespace.createElement("span", { className: css(menuStyles.menuItemDescription) },
|
15165 | React__namespace.createElement("span", null, description)))),
|
15166 | flyoutVisible && (React__namespace.createElement(MenuContext.Provider, { value: { disableHover } },
|
15167 | React__namespace.createElement(FlyoutContext.Provider, { value: { direction: flyoutXDirection } }, flyoutMenu))),
|
15168 | typeof drilldownMenu === 'function' ? drilldownMenu() : drilldownMenu,
|
15169 | React__namespace.createElement(MenuItemContext.Provider, { value: { itemId, isDisabled } },
|
15170 | actions,
|
15171 | isFavorited !== null && (React__namespace.createElement(MenuItemAction, { icon: "favorites", isFavorited: isFavorited, "aria-label": isFavorited ? 'starred' : 'not starred', onClick: event => onActionClick(event, itemId), tabIndex: -1, actionId: "fav" })))));
|
15172 | };
|
15173 | const MenuItem = React__namespace.forwardRef((props, ref) => (React__namespace.createElement(MenuItemBase, Object.assign({}, props, { innerRef: ref }))));
|
15174 | MenuItem.displayName = 'MenuItem';
|
15175 |
|
15176 | const MenuList = (_a) => {
|
15177 | var { children = null, className } = _a, props = __rest$1(_a, ["children", "className"]);
|
15178 | return (React__namespace.createElement("ul", Object.assign({ role: "menu", className: css(menuStyles.menuList, className) }, props), children));
|
15179 | };
|
15180 | MenuList.displayName = 'MenuList';
|
15181 |
|
15182 | const DrilldownMenu = (_a) => {
|
15183 | var { children, id, isMenuDrilledIn = false, getHeight } = _a, props = __rest$1(_a, ["children", "id", "isMenuDrilledIn", "getHeight"]);
|
15184 | return (
|
15185 |
|
15186 | React__default["default"].createElement(MenuContext.Consumer, null, (_a) => {
|
15187 | var { menuId, parentMenu, flyoutRef, setFlyoutRef, disableHover } = _a, context = __rest$1(_a, ["menuId", "parentMenu", "flyoutRef", "setFlyoutRef", "disableHover"]);
|
15188 | return (React__default["default"].createElement(Menu, Object.assign({ id: id, parentMenu: menuId, isMenuDrilledIn: isMenuDrilledIn, isRootMenu: false, ref: React__default["default"].createRef() }, context, props),
|
15189 | React__default["default"].createElement(MenuContent, { getHeight: getHeight },
|
15190 | React__default["default"].createElement(MenuList, null, children))));
|
15191 | })
|
15192 |
|
15193 | );
|
15194 | };
|
15195 | DrilldownMenu.displayName = 'DrilldownMenu';
|
15196 |
|
15197 | const MenuBreadcrumb = (_a) => {
|
15198 | var { children } = _a, props = __rest$1(_a, ["children"]);
|
15199 | return (React__default["default"].createElement("div", Object.assign({ className: css(menuStyles.menuBreadcrumb) }, props), children));
|
15200 | };
|
15201 | MenuBreadcrumb.displayName = 'MenuBreadcrumb';
|
15202 |
|
15203 | Promise.resolve().then(function () { return menuToggle; });
|
15204 | var styles$y = {
|
15205 | "check": "pf-c-check",
|
15206 | "menuToggle": "pf-c-menu-toggle",
|
15207 | "menuToggleButton": "pf-c-menu-toggle__button",
|
15208 | "menuToggleControls": "pf-c-menu-toggle__controls",
|
15209 | "menuToggleCount": "pf-c-menu-toggle__count",
|
15210 | "menuToggleIcon": "pf-c-menu-toggle__icon",
|
15211 | "menuToggleText": "pf-c-menu-toggle__text",
|
15212 | "menuToggleToggleIcon": "pf-c-menu-toggle__toggle-icon",
|
15213 | "modifiers": {
|
15214 | "primary": "pf-m-primary",
|
15215 | "secondary": "pf-m-secondary",
|
15216 | "expanded": "pf-m-expanded",
|
15217 | "plain": "pf-m-plain",
|
15218 | "text": "pf-m-text",
|
15219 | "disabled": "pf-m-disabled",
|
15220 | "fullHeight": "pf-m-full-height",
|
15221 | "typeahead": "pf-m-typeahead",
|
15222 | "splitButton": "pf-m-split-button",
|
15223 | "action": "pf-m-action",
|
15224 | "active": "pf-m-active",
|
15225 | "fullWidth": "pf-m-full-width"
|
15226 | },
|
15227 | "textInputGroup": "pf-c-text-input-group"
|
15228 | };
|
15229 |
|
15230 | class MenuToggleBase extends React__namespace.Component {
|
15231 | constructor() {
|
15232 | super(...arguments);
|
15233 | this.displayName = 'MenuToggleBase';
|
15234 | }
|
15235 | render() {
|
15236 | const _a = this.props, { children, className, icon, badge, isExpanded, isDisabled, isFullHeight, isFullWidth, variant, innerRef } = _a, props = __rest$1(_a, ["children", "className", "icon", "badge", "isExpanded", "isDisabled", "isFullHeight", "isFullWidth", "variant", "innerRef"]);
|
15237 | const isPlain = variant === 'plain';
|
15238 | const isPlainText = variant === 'plainText';
|
15239 | const content = (React__namespace.createElement(React__namespace.Fragment, null,
|
15240 | icon && React__namespace.createElement("span", { className: css(styles$y.menuToggleIcon) }, icon),
|
15241 | React__namespace.createElement("span", { className: "pf-c-menu-toggle__text" }, children),
|
15242 | badge && React__namespace.createElement("span", { className: css(styles$y.menuToggleCount) }, badge),
|
15243 | React__namespace.createElement("span", { className: css(styles$y.menuToggleControls) },
|
15244 | React__namespace.createElement("span", { className: css(styles$y.menuToggleToggleIcon) },
|
15245 | React__namespace.createElement(CaretDownIcon$1, { "aria-hidden": true })))));
|
15246 | return (React__namespace.createElement("button", Object.assign({ className: css(styles$y.menuToggle, isExpanded && styles$y.modifiers.expanded, variant === 'primary' && styles$y.modifiers.primary, variant === 'secondary' && styles$y.modifiers.secondary, (isPlain || isPlainText) && styles$y.modifiers.plain, isPlainText && styles$y.modifiers.text, isFullHeight && styles$y.modifiers.fullHeight, isFullWidth && styles$y.modifiers.fullWidth, className), type: "button", "aria-expanded": false, ref: innerRef }, (isExpanded && { 'aria-expanded': true }), (isDisabled && { disabled: true }), props),
|
15247 | isPlain && children,
|
15248 | !isPlain && content));
|
15249 | }
|
15250 | }
|
15251 | MenuToggleBase.defaultProps = {
|
15252 | className: '',
|
15253 | isExpanded: false,
|
15254 | isDisabled: false,
|
15255 | isFullWidth: false,
|
15256 | isFullHeight: false,
|
15257 | variant: 'default'
|
15258 | };
|
15259 | const MenuToggle = React__namespace.forwardRef((props, ref) => (React__namespace.createElement(MenuToggleBase, Object.assign({ innerRef: ref }, props))));
|
15260 | MenuToggle.displayName = 'MenuToggle';
|
15261 |
|
15262 | Promise.resolve().then(function () { return modalBox; });
|
15263 | var modalStyles = {
|
15264 | "button": "pf-c-button",
|
15265 | "modalBox": "pf-c-modal-box",
|
15266 | "modalBoxBody": "pf-c-modal-box__body",
|
15267 | "modalBoxDescription": "pf-c-modal-box__description",
|
15268 | "modalBoxFooter": "pf-c-modal-box__footer",
|
15269 | "modalBoxHeader": "pf-c-modal-box__header",
|
15270 | "modalBoxHeaderMain": "pf-c-modal-box__header-main",
|
15271 | "modalBoxTitle": "pf-c-modal-box__title",
|
15272 | "modalBoxTitleIcon": "pf-c-modal-box__title-icon",
|
15273 | "modalBoxTitleText": "pf-c-modal-box__title-text",
|
15274 | "modifiers": {
|
15275 | "sm": "pf-m-sm",
|
15276 | "md": "pf-m-md",
|
15277 | "lg": "pf-m-lg",
|
15278 | "alignTop": "pf-m-align-top",
|
15279 | "danger": "pf-m-danger",
|
15280 | "warning": "pf-m-warning",
|
15281 | "success": "pf-m-success",
|
15282 | "default": "pf-m-default",
|
15283 | "info": "pf-m-info",
|
15284 | "help": "pf-m-help",
|
15285 | "icon": "pf-m-icon"
|
15286 | }
|
15287 | };
|
15288 |
|
15289 | const ModalBoxBody = (_a) => {
|
15290 | var { children = null, className = '' } = _a, props = __rest$1(_a, ["children", "className"]);
|
15291 | return (React__namespace.createElement("div", Object.assign({}, props, { className: css(modalStyles.modalBoxBody, className) }), children));
|
15292 | };
|
15293 | ModalBoxBody.displayName = 'ModalBoxBody';
|
15294 |
|
15295 | const ModalBoxCloseButton = (_a) => {
|
15296 | var { className = '', onClose = () => undefined, ouiaId } = _a, props = __rest$1(_a, ["className", "onClose", "ouiaId"]);
|
15297 | return (React__namespace.createElement(Button, Object.assign({ className: className, variant: "plain", onClick: onClose, "aria-label": "Close" }, (ouiaId && { ouiaId: `${ouiaId}-${ModalBoxCloseButton.displayName}` }), props),
|
15298 | React__namespace.createElement(TimesIcon$1, null)));
|
15299 | };
|
15300 | ModalBoxCloseButton.displayName = 'ModalBoxCloseButton';
|
15301 |
|
15302 | const c_modal_box_m_align_top_spacer = {
|
15303 | "name": "--pf-c-modal-box--m-align-top--spacer",
|
15304 | "value": "0.5rem",
|
15305 | "var": "var(--pf-c-modal-box--m-align-top--spacer)"
|
15306 | };
|
15307 | var topSpacer = c_modal_box_m_align_top_spacer;
|
15308 |
|
15309 | const ModalBox = (_a) => {
|
15310 | var { children, className = '', variant = 'default', position, positionOffset, 'aria-labelledby': ariaLabelledby, 'aria-label': ariaLabel = '', 'aria-describedby': ariaDescribedby, style } = _a, props = __rest$1(_a, ["children", "className", "variant", "position", "positionOffset", 'aria-labelledby', 'aria-label', 'aria-describedby', "style"]);
|
15311 | if (positionOffset) {
|
15312 | style = style || {};
|
15313 | style[topSpacer.name] = positionOffset;
|
15314 | }
|
15315 | return (React__namespace.createElement("div", Object.assign({}, props, { role: "dialog", "aria-label": ariaLabel || null, "aria-labelledby": ariaLabelledby || null, "aria-describedby": ariaDescribedby, "aria-modal": "true", className: css(modalStyles.modalBox, className, position === 'top' && modalStyles.modifiers.alignTop, variant === 'large' && modalStyles.modifiers.lg, variant === 'small' && modalStyles.modifiers.sm, variant === 'medium' && modalStyles.modifiers.md), style: style }), children));
|
15316 | };
|
15317 | ModalBox.displayName = 'ModalBox';
|
15318 |
|
15319 | const ModalBoxFooter = (_a) => {
|
15320 | var { children = null, className = '' } = _a, props = __rest$1(_a, ["children", "className"]);
|
15321 | return (React__namespace.createElement("footer", Object.assign({}, props, { className: css(modalStyles.modalBoxFooter, className) }), children));
|
15322 | };
|
15323 | ModalBoxFooter.displayName = 'ModalBoxFooter';
|
15324 |
|
15325 | const ModalBoxDescription = (_a) => {
|
15326 | var { children = null, className = '', id = '' } = _a, props = __rest$1(_a, ["children", "className", "id"]);
|
15327 | return (React__namespace.createElement("div", Object.assign({}, props, { id: id, className: css(modalStyles.modalBoxDescription, className) }), children));
|
15328 | };
|
15329 | ModalBoxDescription.displayName = 'ModalBoxDescription';
|
15330 |
|
15331 | const ModalBoxHeader = (_a) => {
|
15332 | var { children = null, className = '', help = null } = _a, props = __rest$1(_a, ["children", "className", "help"]);
|
15333 | return (React__namespace.createElement("header", Object.assign({ className: css(modalStyles.modalBoxHeader, help && modalStyles.modifiers.help, className) }, props),
|
15334 | help && (React__namespace.createElement(React__namespace.Fragment, null,
|
15335 | React__namespace.createElement("div", { className: css(modalStyles.modalBoxHeaderMain) }, children),
|
15336 | React__namespace.createElement("div", { className: "pf-c-modal-box__header-help" }, help))),
|
15337 | !help && children));
|
15338 | };
|
15339 | ModalBoxHeader.displayName = 'ModalBoxHeader';
|
15340 |
|
15341 | const isVariantIcon = (icon) => ['success', 'danger', 'warning', 'info', 'default'].includes(icon);
|
15342 | const ModalBoxTitle = (_a) => {
|
15343 | var { className = '', id, title, titleIconVariant, titleLabel = '' } = _a, props = __rest$1(_a, ["className", "id", "title", "titleIconVariant", "titleLabel"]);
|
15344 | const [isTooltipVisible, setIsTooltipVisible] = React__namespace.useState(false);
|
15345 | const h1 = React__namespace.useRef();
|
15346 | const label = titleLabel || (isVariantIcon(titleIconVariant) ? `${capitalize(titleIconVariant)} alert:` : titleLabel);
|
15347 | const variantIcons = {
|
15348 | success: React__namespace.createElement(CheckCircleIcon$1, null),
|
15349 | danger: React__namespace.createElement(ExclamationCircleIcon$1, null),
|
15350 | warning: React__namespace.createElement(ExclamationTriangleIcon$1, null),
|
15351 | info: React__namespace.createElement(InfoCircleIcon$1, null),
|
15352 | default: React__namespace.createElement(BellIcon$1, null)
|
15353 | };
|
15354 | const CustomIcon = !isVariantIcon(titleIconVariant) && titleIconVariant;
|
15355 | useIsomorphicLayoutEffect(() => {
|
15356 | setIsTooltipVisible(h1.current && h1.current.offsetWidth < h1.current.scrollWidth);
|
15357 | }, []);
|
15358 | const content = (React__namespace.createElement("h1", Object.assign({ id: id, ref: h1, className: css(modalStyles.modalBoxTitle, titleIconVariant && modalStyles.modifiers.icon, className) }, props),
|
15359 | titleIconVariant && (React__namespace.createElement("span", { className: css(modalStyles.modalBoxTitleIcon) }, isVariantIcon(titleIconVariant) ? variantIcons[titleIconVariant] : React__namespace.createElement(CustomIcon, null))),
|
15360 | label && React__namespace.createElement("span", { className: css(a11yStyles.screenReader) }, label),
|
15361 | React__namespace.createElement("span", { className: css(modalStyles.modalBoxTitleText) }, title)));
|
15362 | return isTooltipVisible ? (React__namespace.createElement(Tooltip, { content: title, isVisible: true }, content)) : (content);
|
15363 | };
|
15364 | ModalBoxTitle.displayName = 'ModalBoxTitle';
|
15365 |
|
15366 | const ModalContent = (_a) => {
|
15367 | var { children, className = '', isOpen = false, header = null, help = null, description = null, title = '', titleIconVariant = null, titleLabel = '', 'aria-label': ariaLabel = '', 'aria-describedby': ariaDescribedby, 'aria-labelledby': ariaLabelledby, bodyAriaLabel, bodyAriaRole, showClose = true, footer = null, actions = [], onClose = () => undefined, variant = 'default', position, positionOffset, width = -1, boxId, labelId, descriptorId, disableFocusTrap = false, hasNoBodyWrapper = false, ouiaId, ouiaSafe = true } = _a, props = __rest$1(_a, ["children", "className", "isOpen", "header", "help", "description", "title", "titleIconVariant", "titleLabel", 'aria-label', 'aria-describedby', 'aria-labelledby', "bodyAriaLabel", "bodyAriaRole", "showClose", "footer", "actions", "onClose", "variant", "position", "positionOffset", "width", "boxId", "labelId", "descriptorId", "disableFocusTrap", "hasNoBodyWrapper", "ouiaId", "ouiaSafe"]);
|
15368 | if (!isOpen) {
|
15369 | return null;
|
15370 | }
|
15371 | const modalBoxHeader = header ? (React__namespace.createElement(ModalBoxHeader, { help: help }, header)) : (title && (React__namespace.createElement(ModalBoxHeader, { help: help },
|
15372 | React__namespace.createElement(ModalBoxTitle, { title: title, titleIconVariant: titleIconVariant, titleLabel: titleLabel, id: labelId }),
|
15373 | description && React__namespace.createElement(ModalBoxDescription, { id: descriptorId }, description))));
|
15374 | const modalBoxFooter = footer ? (React__namespace.createElement(ModalBoxFooter, null, footer)) : (actions.length > 0 && React__namespace.createElement(ModalBoxFooter, null, actions));
|
15375 | const defaultModalBodyAriaRole = bodyAriaLabel ? 'region' : undefined;
|
15376 | const modalBody = hasNoBodyWrapper ? (children) : (React__namespace.createElement(ModalBoxBody, Object.assign({ "aria-label": bodyAriaLabel, role: bodyAriaRole || defaultModalBodyAriaRole }, props, (!description && !ariaDescribedby && { id: descriptorId })), children));
|
15377 | const boxStyle = width === -1 ? {} : { width };
|
15378 | const ariaLabelledbyFormatted = () => {
|
15379 | if (ariaLabelledby === null) {
|
15380 | return null;
|
15381 | }
|
15382 | const idRefList = [];
|
15383 | if ((ariaLabel && boxId) !== '') {
|
15384 | idRefList.push(ariaLabel && boxId);
|
15385 | }
|
15386 | if (ariaLabelledby) {
|
15387 | idRefList.push(ariaLabelledby);
|
15388 | }
|
15389 | if (title) {
|
15390 | idRefList.push(labelId);
|
15391 | }
|
15392 | return idRefList.join(' ');
|
15393 | };
|
15394 | const modalBox = (React__namespace.createElement(ModalBox, Object.assign({ id: boxId, style: boxStyle, className: css(className, isVariantIcon(titleIconVariant) &&
|
15395 | modalStyles.modifiers[titleIconVariant]), variant: variant, position: position, positionOffset: positionOffset, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledbyFormatted(), "aria-describedby": ariaDescribedby || (hasNoBodyWrapper ? null : descriptorId) }, getOUIAProps(ModalContent.displayName, ouiaId, ouiaSafe)),
|
15396 | showClose && React__namespace.createElement(ModalBoxCloseButton, { onClose: onClose, ouiaId: ouiaId }),
|
15397 | modalBoxHeader,
|
15398 | modalBody,
|
15399 | modalBoxFooter));
|
15400 | return (React__namespace.createElement(Backdrop, null,
|
15401 | React__namespace.createElement(FocusTrap, { active: !disableFocusTrap, focusTrapOptions: { clickOutsideDeactivates: true }, className: css(styles$1h.bullseye) }, modalBox)));
|
15402 | };
|
15403 | ModalContent.displayName = 'ModalContent';
|
15404 |
|
15405 | exports.ModalVariant = void 0;
|
15406 | (function (ModalVariant) {
|
15407 | ModalVariant["small"] = "small";
|
15408 | ModalVariant["medium"] = "medium";
|
15409 | ModalVariant["large"] = "large";
|
15410 | ModalVariant["default"] = "default";
|
15411 | })(exports.ModalVariant || (exports.ModalVariant = {}));
|
15412 | class Modal extends React__namespace.Component {
|
15413 | constructor(props) {
|
15414 | super(props);
|
15415 | this.boxId = '';
|
15416 | this.labelId = '';
|
15417 | this.descriptorId = '';
|
15418 | this.handleEscKeyClick = (event) => {
|
15419 | const { onEscapePress } = this.props;
|
15420 | if (event.keyCode === KEY_CODES.ESCAPE_KEY && this.props.isOpen) {
|
15421 | onEscapePress ? onEscapePress(event) : this.props.onClose();
|
15422 | }
|
15423 | };
|
15424 | this.getElement = (appendTo) => {
|
15425 | if (typeof appendTo === 'function') {
|
15426 | return appendTo();
|
15427 | }
|
15428 | return appendTo || document.body;
|
15429 | };
|
15430 | this.toggleSiblingsFromScreenReaders = (hide) => {
|
15431 | const { appendTo } = this.props;
|
15432 | const target = this.getElement(appendTo);
|
15433 | const bodyChildren = target.children;
|
15434 | for (const child of Array.from(bodyChildren)) {
|
15435 | if (child !== this.state.container) {
|
15436 | hide ? child.setAttribute('aria-hidden', '' + hide) : child.removeAttribute('aria-hidden');
|
15437 | }
|
15438 | }
|
15439 | };
|
15440 | this.isEmpty = (value) => value === null || value === undefined || value === '';
|
15441 | const boxIdNum = Modal.currentId++;
|
15442 | const labelIdNum = boxIdNum + 1;
|
15443 | const descriptorIdNum = boxIdNum + 2;
|
15444 | this.boxId = props.id || `pf-modal-part-${boxIdNum}`;
|
15445 | this.labelId = `pf-modal-part-${labelIdNum}`;
|
15446 | this.descriptorId = `pf-modal-part-${descriptorIdNum}`;
|
15447 | this.state = {
|
15448 | container: undefined,
|
15449 | ouiaStateId: getDefaultOUIAId(Modal.displayName, props.variant)
|
15450 | };
|
15451 | }
|
15452 | componentDidMount() {
|
15453 | const { appendTo, title, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, hasNoBodyWrapper, header } = this.props;
|
15454 | const target = this.getElement(appendTo);
|
15455 | const container = document.createElement('div');
|
15456 | this.setState({ container });
|
15457 | target.appendChild(container);
|
15458 | target.addEventListener('keydown', this.handleEscKeyClick, false);
|
15459 | if (this.props.isOpen) {
|
15460 | target.classList.add(css(styles$1i.backdropOpen));
|
15461 | }
|
15462 | else {
|
15463 | target.classList.remove(css(styles$1i.backdropOpen));
|
15464 | }
|
15465 | if (this.isEmpty(title) && this.isEmpty(ariaLabel) && this.isEmpty(ariaLabelledby)) {
|
15466 |
|
15467 | console.error('Modal: Specify at least one of: title, aria-label, aria-labelledby.');
|
15468 | }
|
15469 | if (this.isEmpty(ariaLabel) && this.isEmpty(ariaLabelledby) && (hasNoBodyWrapper || header)) {
|
15470 |
|
15471 | console.error('Modal: When using hasNoBodyWrapper or setting a custom header, ensure you assign an accessible name to the the modal container with aria-label or aria-labelledby.');
|
15472 | }
|
15473 | }
|
15474 | componentDidUpdate() {
|
15475 | const { appendTo } = this.props;
|
15476 | const target = this.getElement(appendTo);
|
15477 | if (this.props.isOpen) {
|
15478 | target.classList.add(css(styles$1i.backdropOpen));
|
15479 | this.toggleSiblingsFromScreenReaders(true);
|
15480 | }
|
15481 | else {
|
15482 | target.classList.remove(css(styles$1i.backdropOpen));
|
15483 | this.toggleSiblingsFromScreenReaders(false);
|
15484 | }
|
15485 | }
|
15486 | componentWillUnmount() {
|
15487 | const { appendTo } = this.props;
|
15488 | const target = this.getElement(appendTo);
|
15489 | if (this.state.container) {
|
15490 | target.removeChild(this.state.container);
|
15491 | }
|
15492 | target.removeEventListener('keydown', this.handleEscKeyClick, false);
|
15493 | target.classList.remove(css(styles$1i.backdropOpen));
|
15494 | }
|
15495 | render() {
|
15496 | const _a = this.props, {
|
15497 |
|
15498 | appendTo,
|
15499 |
|
15500 | onEscapePress, 'aria-labelledby': ariaLabelledby, 'aria-label': ariaLabel, 'aria-describedby': ariaDescribedby, bodyAriaLabel, bodyAriaRole, title, titleIconVariant, titleLabel, ouiaId, ouiaSafe } = _a, props = __rest$1(_a, ["appendTo", "onEscapePress", 'aria-labelledby', 'aria-label', 'aria-describedby', "bodyAriaLabel", "bodyAriaRole", "title", "titleIconVariant", "titleLabel", "ouiaId", "ouiaSafe"]);
|
15501 | const { container } = this.state;
|
15502 | if (!canUseDOM || !container) {
|
15503 | return null;
|
15504 | }
|
15505 | return ReactDOM__namespace.createPortal(React__namespace.createElement(ModalContent, Object.assign({}, props, { boxId: this.boxId, labelId: this.labelId, descriptorId: this.descriptorId, title: title, titleIconVariant: titleIconVariant, titleLabel: titleLabel, "aria-label": ariaLabel, "aria-describedby": ariaDescribedby, "aria-labelledby": ariaLabelledby, bodyAriaLabel: bodyAriaLabel, bodyAriaRole: bodyAriaRole, ouiaId: ouiaId !== undefined ? ouiaId : this.state.ouiaStateId, ouiaSafe: ouiaSafe })), container);
|
15506 | }
|
15507 | }
|
15508 | Modal.displayName = 'Modal';
|
15509 | Modal.currentId = 0;
|
15510 | Modal.defaultProps = {
|
15511 | className: '',
|
15512 | isOpen: false,
|
15513 | title: '',
|
15514 | titleIconVariant: null,
|
15515 | titleLabel: '',
|
15516 | 'aria-label': '',
|
15517 | showClose: true,
|
15518 | 'aria-describedby': '',
|
15519 | 'aria-labelledby': '',
|
15520 | id: undefined,
|
15521 | actions: [],
|
15522 | onClose: () => undefined,
|
15523 | variant: 'default',
|
15524 | hasNoBodyWrapper: false,
|
15525 | appendTo: () => document.body,
|
15526 | ouiaSafe: true
|
15527 | };
|
15528 |
|
15529 | Promise.resolve().then(function () { return multipleFileUpload; });
|
15530 | var styles$x = {
|
15531 | "modifiers": {
|
15532 | "horizontal": "pf-m-horizontal",
|
15533 | "dragOver": "pf-m-drag-over"
|
15534 | },
|
15535 | "multipleFileUpload": "pf-c-multiple-file-upload",
|
15536 | "multipleFileUploadInfo": "pf-c-multiple-file-upload__info",
|
15537 | "multipleFileUploadMain": "pf-c-multiple-file-upload__main",
|
15538 | "multipleFileUploadStatus": "pf-c-multiple-file-upload__status",
|
15539 | "multipleFileUploadStatusItem": "pf-c-multiple-file-upload__status-item",
|
15540 | "multipleFileUploadStatusItemClose": "pf-c-multiple-file-upload__status-item-close",
|
15541 | "multipleFileUploadStatusItemIcon": "pf-c-multiple-file-upload__status-item-icon",
|
15542 | "multipleFileUploadStatusItemMain": "pf-c-multiple-file-upload__status-item-main",
|
15543 | "multipleFileUploadStatusItemProgress": "pf-c-multiple-file-upload__status-item-progress",
|
15544 | "multipleFileUploadStatusItemProgressSize": "pf-c-multiple-file-upload__status-item-progress-size",
|
15545 | "multipleFileUploadStatusItemProgressText": "pf-c-multiple-file-upload__status-item-progress-text",
|
15546 | "multipleFileUploadStatusProgress": "pf-c-multiple-file-upload__status-progress",
|
15547 | "multipleFileUploadStatusProgressIcon": "pf-c-multiple-file-upload__status-progress-icon",
|
15548 | "multipleFileUploadTitle": "pf-c-multiple-file-upload__title",
|
15549 | "multipleFileUploadTitleIcon": "pf-c-multiple-file-upload__title-icon",
|
15550 | "multipleFileUploadTitleText": "pf-c-multiple-file-upload__title-text",
|
15551 | "multipleFileUploadTitleTextSeparator": "pf-c-multiple-file-upload__title-text-separator",
|
15552 | "multipleFileUploadUpload": "pf-c-multiple-file-upload__upload"
|
15553 | };
|
15554 |
|
15555 | const MultipleFileUploadContext = React__namespace.createContext({
|
15556 | open: () => { }
|
15557 | });
|
15558 | const MultipleFileUpload = (_a) => {
|
15559 | var { className, children, dropzoneProps = {}, isHorizontal, onFileDrop = () => { } } = _a, props = __rest$1(_a, ["className", "children", "dropzoneProps", "isHorizontal", "onFileDrop"]);
|
15560 | const onDropAccepted = (acceptedFiles, event) => {
|
15561 | onFileDrop(acceptedFiles);
|
15562 |
|
15563 | dropzoneProps.onDropAccepted && dropzoneProps.onDropAccepted(acceptedFiles, event);
|
15564 | };
|
15565 | const onDropRejected = (rejectedFiles, event) => {
|
15566 | dropzoneProps.onDropRejected && (dropzoneProps === null || dropzoneProps === void 0 ? void 0 : dropzoneProps.onDropRejected(rejectedFiles, event));
|
15567 | };
|
15568 | return (React__namespace.createElement(Dropzone, Object.assign({ multiple: true }, dropzoneProps, { onDropAccepted: onDropAccepted, onDropRejected: onDropRejected }), ({ getRootProps, getInputProps, isDragActive, open }) => {
|
15569 | const rootProps = getRootProps(Object.assign(Object.assign({}, props), { onClick: event => event.preventDefault()
|
15570 | }));
|
15571 | const inputProps = getInputProps();
|
15572 | return (React__namespace.createElement(MultipleFileUploadContext.Provider, { value: { open } },
|
15573 | React__namespace.createElement("div", Object.assign({ className: css(styles$x.multipleFileUpload, isDragActive && styles$x.modifiers.dragOver, isHorizontal && styles$x.modifiers.horizontal, className) }, rootProps, props),
|
15574 | React__namespace.createElement("input", Object.assign({}, inputProps)),
|
15575 | children)));
|
15576 | }));
|
15577 | };
|
15578 | MultipleFileUpload.displayName = 'MultipleFileUpload';
|
15579 |
|
15580 | const MultipleFileUploadTitleIcon = (_a) => {
|
15581 | var { children, className } = _a, props = __rest$1(_a, ["children", "className"]);
|
15582 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$x.multipleFileUploadTitleIcon, className) }, props), children));
|
15583 | };
|
15584 | MultipleFileUploadTitleIcon.displayName = 'MultipleFileUploadTitleIcon';
|
15585 |
|
15586 | const MultipleFileUploadTitleText = (_a) => {
|
15587 | var { className, children } = _a, props = __rest$1(_a, ["className", "children"]);
|
15588 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$x.multipleFileUploadTitleText, className) }, props), children));
|
15589 | };
|
15590 | MultipleFileUploadTitleText.displayName = 'MultipleFileUploadTitleText';
|
15591 |
|
15592 | const MultipleFileUploadTitleTextSeparator = (_a) => {
|
15593 | var { className, children } = _a, props = __rest$1(_a, ["className", "children"]);
|
15594 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$x.multipleFileUploadTitleTextSeparator, className) }, props), children));
|
15595 | };
|
15596 | MultipleFileUploadTitleTextSeparator.displayName = 'MultipleFileUploadTitleTextSeparator';
|
15597 |
|
15598 | const MultipleFileUploadTitle = (_a) => {
|
15599 | var { className, icon, text = '', textSeparator = '' } = _a, props = __rest$1(_a, ["className", "icon", "text", "textSeparator"]);
|
15600 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$x.multipleFileUploadTitle, className) }, props),
|
15601 | icon && React__namespace.createElement(MultipleFileUploadTitleIcon, null, icon),
|
15602 | text && (React__namespace.createElement(MultipleFileUploadTitleText, null,
|
15603 | `${text} `,
|
15604 | textSeparator && React__namespace.createElement(MultipleFileUploadTitleTextSeparator, null, textSeparator)))));
|
15605 | };
|
15606 | MultipleFileUploadTitle.displayName = 'MultipleFileUploadTitle';
|
15607 |
|
15608 | const MultipleFileUploadButton = (_a) => {
|
15609 | var { className, 'aria-label': ariaLabel } = _a, props = __rest$1(_a, ["className", 'aria-label']);
|
15610 | const { open } = React__namespace.useContext(MultipleFileUploadContext);
|
15611 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$x.multipleFileUploadUpload, className) }, props),
|
15612 | React__namespace.createElement(Button, { variant: "secondary", "aria-label": ariaLabel, onClick: open }, "Upload")));
|
15613 | };
|
15614 | MultipleFileUploadButton.displayName = 'MultipleFileUploadButton';
|
15615 |
|
15616 | const MultipleFileUploadInfo = (_a) => {
|
15617 | var { className, children } = _a, props = __rest$1(_a, ["className", "children"]);
|
15618 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$x.multipleFileUploadInfo, className) }, props), children));
|
15619 | };
|
15620 | MultipleFileUploadInfo.displayName = 'MultipleFileUploadInfo';
|
15621 |
|
15622 | const MultipleFileUploadMain = (_a) => {
|
15623 | var { className, titleIcon, titleText, titleTextSeparator, infoText, isUploadButtonHidden } = _a, props = __rest$1(_a, ["className", "titleIcon", "titleText", "titleTextSeparator", "infoText", "isUploadButtonHidden"]);
|
15624 | const showTitle = !!titleIcon || !!titleText || !!titleTextSeparator;
|
15625 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$x.multipleFileUploadMain, className) }, props),
|
15626 | showTitle && React__namespace.createElement(MultipleFileUploadTitle, { icon: titleIcon, text: titleText, textSeparator: titleTextSeparator }),
|
15627 | isUploadButtonHidden || React__namespace.createElement(MultipleFileUploadButton, null),
|
15628 | !!infoText && React__namespace.createElement(MultipleFileUploadInfo, null, infoText)));
|
15629 | };
|
15630 | MultipleFileUploadMain.displayName = 'MultipleFileUploadMain';
|
15631 |
|
15632 | const InProgressIconConfig = {
|
15633 | name: 'InProgressIcon',
|
15634 | height: 1024,
|
15635 | width: 1024,
|
15636 | svgPath: 'M513.417211,16.013668 L513.417211,112.013668 C513.406007,120.539653 520.082422,127.576718 528.597211,128.013668 C732.697211,136.513668 896.147211,305.013668 896.147211,511.343668 C896.147211,723.013668 724.007211,895.163668 512.417211,895.163668 C437.186239,895.277345 363.602574,873.135095 300.927211,831.523668 C294.58293,827.2982 286.138663,828.135095 280.747211,833.523668 L211.807211,902.353668 C208.502935,905.676185 206.82123,910.280199 207.20607,914.950237 C207.590911,919.620275 210.00361,923.886884 213.807211,926.623668 C300.709573,989.398037 405.213535,1023.13146 512.417211,1023.01398 C794.537211,1023.01398 1023.91724,793.433668 1023.91724,511.413668 C1024.00721,235.103668 804.007211,9.22366802 529.897211,0.00645736761 C525.571205,-0.116171039 521.377128,1.51204372 518.271915,4.52681369 C515.166702,7.54158367 513.415263,11.6857144 513.417211,16.013668 M97.1272107,212.923668 C64.2190689,258.479443 39.0698895,309.162997 22.6972107,362.923668 C21.2705092,367.756559 22.2039184,372.979173 25.2163356,377.018685 C28.2287528,381.058197 32.9681443,383.442545 38.0072107,383.453683 L139.407211,383.453683 C145.970195,383.46249 151.873012,379.462528 154.297211,373.363668 C164.307669,347.593304 177.068112,322.977652 192.357211,299.943668 C196.579666,293.633658 195.741339,285.216847 190.357211,279.863668 L121.497211,211.013668 C118.186635,207.662531 113.567544,205.940538 108.871166,206.30669 C104.174788,206.672841 99.8783994,209.089927 97.1272107,212.913668 M112.907211,511.433663 L17.0072107,511.433663 C12.679257,511.433663 8.5351263,513.183159 5.52035633,516.288373 C2.50558635,519.393586 0.877371594,523.587662 1.00721065,527.913668 C4.13104542,629.408217 37.6085847,727.635936 97.1172107,809.913668 C99.8539943,813.717268 104.120603,816.129968 108.790642,816.514809 C113.46068,816.899649 118.064693,815.217944 121.387211,811.913668 L190.217211,743.073668 C195.605784,737.682216 196.442679,729.237949 192.217211,722.893668 C153.520825,664.580171 131.611534,596.745437 128.887211,526.813668 C128.553964,518.220138 121.487197,511.427209 112.887211,511.433663',
|
15637 | yOffset: 0,
|
15638 | xOffset: 0,
|
15639 | };
|
15640 |
|
15641 | const InProgressIcon = createIcon(InProgressIconConfig);
|
15642 |
|
15643 | var InProgressIcon$1 = InProgressIcon;
|
15644 |
|
15645 | const MultipleFileUploadStatus = (_a) => {
|
15646 | var { children, className, statusToggleText, statusToggleIcon } = _a, props = __rest$1(_a, ["children", "className", "statusToggleText", "statusToggleIcon"]);
|
15647 | const [icon, setIcon] = React__namespace.useState();
|
15648 | const [isOpen, setIsOpen] = React__namespace.useState(true);
|
15649 | React__namespace.useEffect(() => {
|
15650 | switch (statusToggleIcon) {
|
15651 | case 'danger':
|
15652 | setIcon(React__namespace.createElement(TimesCircleIcon$1, null));
|
15653 | break;
|
15654 | case 'success':
|
15655 | setIcon(React__namespace.createElement(CheckCircleIcon$1, null));
|
15656 | break;
|
15657 | case 'inProgress':
|
15658 | setIcon(React__namespace.createElement(InProgressIcon$1, null));
|
15659 | break;
|
15660 | default:
|
15661 | setIcon(statusToggleIcon);
|
15662 | }
|
15663 | }, [statusToggleIcon]);
|
15664 | const toggle = (React__namespace.createElement("div", { className: styles$x.multipleFileUploadStatusProgress },
|
15665 | React__namespace.createElement("div", { className: styles$x.multipleFileUploadStatusProgressIcon }, icon),
|
15666 | React__namespace.createElement("div", { className: styles$x.multipleFileUploadStatusItemProgressText }, statusToggleText)));
|
15667 | const toggleExpandableSection = () => {
|
15668 | setIsOpen(!isOpen);
|
15669 | };
|
15670 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$x.multipleFileUploadStatus, className) }, props),
|
15671 | React__namespace.createElement(ExpandableSection, { toggleContent: toggle, isExpanded: isOpen, onToggle: toggleExpandableSection },
|
15672 | React__namespace.createElement("ul", { className: "pf-c-multiple-file-upload__status-list" }, children))));
|
15673 | };
|
15674 | MultipleFileUploadStatus.displayName = 'MultipleFileUploadStatus';
|
15675 |
|
15676 | Promise.resolve().then(function () { return progress; });
|
15677 | var styles$w = {
|
15678 | "modifiers": {
|
15679 | "sm": "pf-m-sm",
|
15680 | "lg": "pf-m-lg",
|
15681 | "inside": "pf-m-inside",
|
15682 | "outside": "pf-m-outside",
|
15683 | "staticWidth": "pf-m-static-width",
|
15684 | "singleline": "pf-m-singleline",
|
15685 | "success": "pf-m-success",
|
15686 | "warning": "pf-m-warning",
|
15687 | "danger": "pf-m-danger",
|
15688 | "truncate": "pf-m-truncate"
|
15689 | },
|
15690 | "progress": "pf-c-progress",
|
15691 | "progressBar": "pf-c-progress__bar",
|
15692 | "progressDescription": "pf-c-progress__description",
|
15693 | "progressIndicator": "pf-c-progress__indicator",
|
15694 | "progressMeasure": "pf-c-progress__measure",
|
15695 | "progressStatus": "pf-c-progress__status",
|
15696 | "progressStatusIcon": "pf-c-progress__status-icon"
|
15697 | };
|
15698 |
|
15699 | const ProgressBar = (_a) => {
|
15700 | var { progressBarAriaProps, className = '', children = null, value } = _a, props = __rest$1(_a, ["progressBarAriaProps", "className", "children", "value"]);
|
15701 | return (React__namespace.createElement("div", Object.assign({}, props, { className: css(styles$w.progressBar, className) }, progressBarAriaProps),
|
15702 | React__namespace.createElement("div", { className: css(styles$w.progressIndicator), style: { width: `${value}%` } },
|
15703 | React__namespace.createElement("span", { className: css(styles$w.progressMeasure) }, children))));
|
15704 | };
|
15705 | ProgressBar.displayName = 'ProgressBar';
|
15706 |
|
15707 | exports.ProgressMeasureLocation = void 0;
|
15708 | (function (ProgressMeasureLocation) {
|
15709 | ProgressMeasureLocation["outside"] = "outside";
|
15710 | ProgressMeasureLocation["inside"] = "inside";
|
15711 | ProgressMeasureLocation["top"] = "top";
|
15712 | ProgressMeasureLocation["none"] = "none";
|
15713 | })(exports.ProgressMeasureLocation || (exports.ProgressMeasureLocation = {}));
|
15714 | exports.ProgressVariant = void 0;
|
15715 | (function (ProgressVariant) {
|
15716 | ProgressVariant["danger"] = "danger";
|
15717 | ProgressVariant["success"] = "success";
|
15718 | ProgressVariant["warning"] = "warning";
|
15719 | })(exports.ProgressVariant || (exports.ProgressVariant = {}));
|
15720 | const variantToIcon = {
|
15721 | danger: TimesCircleIcon$1,
|
15722 | success: CheckCircleIcon$1,
|
15723 | warning: ExclamationTriangleIcon$1
|
15724 | };
|
15725 | const ProgressContainer = ({ progressBarAriaProps, value, title = '', parentId, label = null, variant = null, measureLocation = exports.ProgressMeasureLocation.top, isTitleTruncated = false, tooltipPosition }) => {
|
15726 | const StatusIcon = variantToIcon.hasOwnProperty(variant) && variantToIcon[variant];
|
15727 | const [tooltip, setTooltip] = React__namespace.useState('');
|
15728 | const onMouseEnter = (event) => {
|
15729 | if (event.target.offsetWidth < event.target.scrollWidth) {
|
15730 | setTooltip(title || event.target.innerHTML);
|
15731 | }
|
15732 | else {
|
15733 | setTooltip('');
|
15734 | }
|
15735 | };
|
15736 | const Title = (React__namespace.createElement("div", { className: css(styles$w.progressDescription, isTitleTruncated && typeof title === 'string' && styles$w.modifiers.truncate), id: `${parentId}-description`, "aria-hidden": "true", onMouseEnter: isTitleTruncated && typeof title === 'string' ? onMouseEnter : null }, title));
|
15737 | return (React__namespace.createElement(React__namespace.Fragment, null,
|
15738 | tooltip ? (React__namespace.createElement(Tooltip, { position: tooltipPosition, content: tooltip, isVisible: true }, Title)) : (Title),
|
15739 | React__namespace.createElement("div", { className: css(styles$w.progressStatus), "aria-hidden": "true" },
|
15740 | (measureLocation === exports.ProgressMeasureLocation.top || measureLocation === exports.ProgressMeasureLocation.outside) && (React__namespace.createElement("span", { className: css(styles$w.progressMeasure) }, label || `${value}%`)),
|
15741 | variantToIcon.hasOwnProperty(variant) && (React__namespace.createElement("span", { className: css(styles$w.progressStatusIcon) },
|
15742 | React__namespace.createElement(StatusIcon, null)))),
|
15743 | React__namespace.createElement(ProgressBar, { role: "progressbar", progressBarAriaProps: progressBarAriaProps, value: value }, measureLocation === exports.ProgressMeasureLocation.inside && `${value}%`)));
|
15744 | };
|
15745 | ProgressContainer.displayName = 'ProgressContainer';
|
15746 |
|
15747 | exports.ProgressSize = void 0;
|
15748 | (function (ProgressSize) {
|
15749 | ProgressSize["sm"] = "sm";
|
15750 | ProgressSize["md"] = "md";
|
15751 | ProgressSize["lg"] = "lg";
|
15752 | })(exports.ProgressSize || (exports.ProgressSize = {}));
|
15753 | class Progress extends React__namespace.Component {
|
15754 | constructor() {
|
15755 | super(...arguments);
|
15756 | this.id = this.props.id || getUniqueId();
|
15757 | }
|
15758 | render() {
|
15759 | const _a = this.props, {
|
15760 |
|
15761 | id, size,
|
15762 |
|
15763 | className, value, title, label, variant, measureLocation, min, max, valueText, isTitleTruncated, tooltipPosition, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = _a, props = __rest$1(_a, ["id", "size", "className", "value", "title", "label", "variant", "measureLocation", "min", "max", "valueText", "isTitleTruncated", "tooltipPosition", 'aria-label', 'aria-labelledby']);
|
15764 | const progressBarAriaProps = {
|
15765 | 'aria-valuemin': min,
|
15766 | 'aria-valuenow': value,
|
15767 | 'aria-valuemax': max
|
15768 | };
|
15769 | if (title || ariaLabelledBy) {
|
15770 | progressBarAriaProps['aria-labelledby'] = title ? `${this.id}-description` : ariaLabelledBy;
|
15771 | }
|
15772 | if (ariaLabel) {
|
15773 | progressBarAriaProps['aria-label'] = ariaLabel;
|
15774 | }
|
15775 | if (valueText) {
|
15776 | progressBarAriaProps['aria-valuetext'] = valueText;
|
15777 | }
|
15778 | if (!title && !ariaLabelledBy && !ariaLabel) {
|
15779 |
|
15780 | console.warn('One of aria-label or aria-labelledby properties should be passed when using the progress component without a title.');
|
15781 | }
|
15782 | const scaledValue = Math.min(100, Math.max(0, Math.floor(((value - min) / (max - min)) * 100))) || 0;
|
15783 | return (React__namespace.createElement("div", Object.assign({}, props, { className: css(styles$w.progress, styles$w.modifiers[variant], ['inside', 'outside'].includes(measureLocation) && styles$w.modifiers[measureLocation], measureLocation === 'inside' ? styles$w.modifiers[exports.ProgressSize.lg] : styles$w.modifiers[size], !title && styles$w.modifiers.singleline, className), id: this.id }),
|
15784 | React__namespace.createElement(ProgressContainer, { parentId: this.id, value: scaledValue, title: title, label: label, variant: variant, measureLocation: measureLocation, progressBarAriaProps: progressBarAriaProps, isTitleTruncated: isTitleTruncated, tooltipPosition: tooltipPosition })));
|
15785 | }
|
15786 | }
|
15787 | Progress.displayName = 'Progress';
|
15788 | Progress.defaultProps = {
|
15789 | className: '',
|
15790 | measureLocation: exports.ProgressMeasureLocation.top,
|
15791 | variant: null,
|
15792 | id: '',
|
15793 | title: '',
|
15794 | min: 0,
|
15795 | max: 100,
|
15796 | size: null,
|
15797 | label: null,
|
15798 | value: 0,
|
15799 | valueText: null,
|
15800 | isTitleTruncated: false,
|
15801 | tooltipPosition: 'top',
|
15802 | 'aria-label': null,
|
15803 | 'aria-labelledby': null
|
15804 | };
|
15805 |
|
15806 | const FileIconConfig = {
|
15807 | name: 'FileIcon',
|
15808 | height: 512,
|
15809 | width: 384,
|
15810 | svgPath: 'M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm160-14.1v6.1H256V0h6.1c6.4 0 12.5 2.5 17 7l97.9 98c4.5 4.5 7 10.6 7 16.9z',
|
15811 | yOffset: 0,
|
15812 | xOffset: 0,
|
15813 | };
|
15814 |
|
15815 | const FileIcon = createIcon(FileIconConfig);
|
15816 |
|
15817 | var FileIcon$1 = FileIcon;
|
15818 |
|
15819 | const MultipleFileUploadStatusItem = (_a) => {
|
15820 | var { className, file, fileIcon, onReadStarted = () => { }, onReadFinished = () => { }, onReadSuccess = () => { }, onReadFail = () => { }, onClearClick = () => { }, customFileHandler, fileName, fileSize, progressValue, progressVariant, progressAriaLabel, progressAriaLabelledBy, progressId, buttonAriaLabel = 'Remove from list' } = _a, props = __rest$1(_a, ["className", "file", "fileIcon", "onReadStarted", "onReadFinished", "onReadSuccess", "onReadFail", "onClearClick", "customFileHandler", "fileName", "fileSize", "progressValue", "progressVariant", "progressAriaLabel", "progressAriaLabelledBy", "progressId", "buttonAriaLabel"]);
|
15821 | const [loadPercentage, setLoadPercentage] = React__namespace.useState(0);
|
15822 | const [loadResult, setLoadResult] = React__namespace.useState();
|
15823 | function readFile(file) {
|
15824 | return new Promise((resolve, reject) => {
|
15825 | const reader = new FileReader();
|
15826 | reader.onload = () => resolve(reader.result);
|
15827 | reader.onerror = () => reject(reader.error);
|
15828 | reader.onprogress = data => {
|
15829 | if (data.lengthComputable) {
|
15830 | setLoadPercentage((data.loaded / data.total) * 100);
|
15831 | }
|
15832 | };
|
15833 | reader.readAsDataURL(file);
|
15834 | });
|
15835 | }
|
15836 | React__namespace.useEffect(() => {
|
15837 | if (customFileHandler) {
|
15838 | customFileHandler(file);
|
15839 | }
|
15840 | else {
|
15841 | onReadStarted(file);
|
15842 | readFile(file)
|
15843 | .then(data => {
|
15844 | setLoadResult('success');
|
15845 | setLoadPercentage(100);
|
15846 | onReadFinished(file);
|
15847 | onReadSuccess(data, file);
|
15848 | })
|
15849 | .catch((error) => {
|
15850 | onReadFinished(file);
|
15851 | onReadFail(error, file);
|
15852 | setLoadResult('danger');
|
15853 | });
|
15854 | }
|
15855 | }, []);
|
15856 | const getHumanReadableFileSize = (size) => {
|
15857 | const prefixes = ['', 'K', 'M', 'G', 'T'];
|
15858 | let prefixUnit = 0;
|
15859 | while (size >= 1000) {
|
15860 | prefixUnit += 1;
|
15861 | size = size / 1000;
|
15862 | }
|
15863 | if (prefixUnit >= prefixes.length) {
|
15864 | return 'File size too large';
|
15865 | }
|
15866 | return `${Math.round(size)}${prefixes[prefixUnit]}B`;
|
15867 | };
|
15868 | const title = (React__namespace.createElement("span", { className: styles$x.multipleFileUploadStatusItemProgress },
|
15869 | React__namespace.createElement("span", { className: styles$x.multipleFileUploadStatusItemProgressText }, fileName || (file === null || file === void 0 ? void 0 : file.name) || ''),
|
15870 | React__namespace.createElement("span", { className: styles$x.multipleFileUploadStatusItemProgressSize }, fileSize || getHumanReadableFileSize((file === null || file === void 0 ? void 0 : file.size) || 0))));
|
15871 | return (React__namespace.createElement("li", Object.assign({ className: css(styles$x.multipleFileUploadStatusItem, className) }, props),
|
15872 | React__namespace.createElement("div", { className: styles$x.multipleFileUploadStatusItemIcon }, fileIcon || React__namespace.createElement(FileIcon$1, null)),
|
15873 | React__namespace.createElement("div", { className: styles$x.multipleFileUploadStatusItemMain },
|
15874 | React__namespace.createElement(Progress, { title: title, value: progressValue || loadPercentage, variant: progressVariant || loadResult, "aria-label": progressAriaLabel, "aria-labelledby": progressAriaLabelledBy, id: progressId })),
|
15875 | React__namespace.createElement("div", { className: styles$x.multipleFileUploadStatusItemClose },
|
15876 | React__namespace.createElement(Button, { variant: "plain", "aria-label": buttonAriaLabel, onClick: onClearClick },
|
15877 | React__namespace.createElement(TimesCircleIcon$1, null)))));
|
15878 | };
|
15879 | MultipleFileUploadStatusItem.displayName = 'MultipleFileUploadStatusItem';
|
15880 |
|
15881 | Promise.resolve().then(function () { return nav; });
|
15882 | var styles$v = {
|
15883 | "divider": "pf-c-divider",
|
15884 | "menu": "pf-c-menu",
|
15885 | "menuContent": "pf-c-menu__content",
|
15886 | "menuItem": "pf-c-menu__item",
|
15887 | "menuItemToggleIcon": "pf-c-menu__item-toggle-icon",
|
15888 | "menuListItem": "pf-c-menu__list-item",
|
15889 | "modifiers": {
|
15890 | "flyout": "pf-m-flyout",
|
15891 | "top": "pf-m-top",
|
15892 | "left": "pf-m-left",
|
15893 | "current": "pf-m-current",
|
15894 | "drillUp": "pf-m-drill-up",
|
15895 | "horizontal": "pf-m-horizontal",
|
15896 | "tertiary": "pf-m-tertiary",
|
15897 | "horizontalSubnav": "pf-m-horizontal-subnav",
|
15898 | "light": "pf-m-light",
|
15899 | "scrollable": "pf-m-scrollable",
|
15900 | "overflowHidden": "pf-m-overflow-hidden",
|
15901 | "expandable": "pf-m-expandable",
|
15902 | "expanded": "pf-m-expanded",
|
15903 | "drilldown": "pf-m-drilldown",
|
15904 | "hover": "pf-m-hover",
|
15905 | "start": "pf-m-start",
|
15906 | "noTitle": "pf-m-no-title"
|
15907 | },
|
15908 | "nav": "pf-c-nav",
|
15909 | "navItem": "pf-c-nav__item",
|
15910 | "navLink": "pf-c-nav__link",
|
15911 | "navList": "pf-c-nav__list",
|
15912 | "navScrollButton": "pf-c-nav__scroll-button",
|
15913 | "navSection": "pf-c-nav__section",
|
15914 | "navSectionTitle": "pf-c-nav__section-title",
|
15915 | "navSubnav": "pf-c-nav__subnav",
|
15916 | "navToggle": "pf-c-nav__toggle",
|
15917 | "navToggleIcon": "pf-c-nav__toggle-icon"
|
15918 | };
|
15919 |
|
15920 | const navContextDefaults = {};
|
15921 | const NavContext = React__namespace.createContext(navContextDefaults);
|
15922 | class Nav extends React__namespace.Component {
|
15923 | constructor() {
|
15924 | super(...arguments);
|
15925 | this.state = {
|
15926 | isScrollable: false,
|
15927 | ouiaStateId: getDefaultOUIAId(Nav.displayName, this.props.variant),
|
15928 | flyoutRef: null
|
15929 | };
|
15930 | }
|
15931 |
|
15932 | onSelect(event, groupId, itemId, to, preventDefault, onClick) {
|
15933 | if (preventDefault) {
|
15934 | event.preventDefault();
|
15935 | }
|
15936 | this.props.onSelect({ groupId, itemId, event, to });
|
15937 | if (onClick) {
|
15938 | onClick(event, itemId, groupId, to);
|
15939 | }
|
15940 | }
|
15941 |
|
15942 | onToggle(event, groupId, toggleValue) {
|
15943 | this.props.onToggle({
|
15944 | event,
|
15945 | groupId,
|
15946 | isExpanded: toggleValue
|
15947 | });
|
15948 | }
|
15949 | render() {
|
15950 | const _a = this.props, { 'aria-label': ariaLabel, children, className,
|
15951 |
|
15952 | onSelect,
|
15953 |
|
15954 | onToggle, theme, ouiaId, ouiaSafe, variant } = _a, props = __rest$1(_a, ['aria-label', "children", "className", "onSelect", "onToggle", "theme", "ouiaId", "ouiaSafe", "variant"]);
|
15955 | const isHorizontal = ['horizontal', 'tertiary'].includes(variant);
|
15956 | return (React__namespace.createElement(NavContext.Provider, { value: {
|
15957 | onSelect: (event, groupId, itemId, to, preventDefault, onClick) => this.onSelect(event, groupId, itemId, to, preventDefault, onClick),
|
15958 | onToggle: (event, groupId, expanded) => this.onToggle(event, groupId, expanded),
|
15959 | updateIsScrollable: (isScrollable) => this.setState({ isScrollable }),
|
15960 | isHorizontal: ['horizontal', 'tertiary', 'horizontal-subnav'].includes(variant),
|
15961 | flyoutRef: this.state.flyoutRef,
|
15962 | setFlyoutRef: flyoutRef => this.setState({ flyoutRef })
|
15963 | } },
|
15964 | React__namespace.createElement("nav", Object.assign({ className: css(styles$v.nav, theme === 'light' && styles$v.modifiers.light, isHorizontal && styles$v.modifiers.horizontal, variant === 'tertiary' && styles$v.modifiers.tertiary, variant === 'horizontal-subnav' && styles$v.modifiers.horizontalSubnav, this.state.isScrollable && styles$v.modifiers.scrollable, className), "aria-label": ariaLabel || (variant === 'tertiary' ? 'Local' : 'Global') }, getOUIAProps(Nav.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId, ouiaSafe), props), children)));
|
15965 | }
|
15966 | }
|
15967 | Nav.displayName = 'Nav';
|
15968 | Nav.defaultProps = {
|
15969 | onSelect: () => undefined,
|
15970 | onToggle: () => undefined,
|
15971 | theme: 'dark',
|
15972 | ouiaSafe: true
|
15973 | };
|
15974 |
|
15975 | const pageSidebarContextDefaults = {
|
15976 | isNavOpen: true
|
15977 | };
|
15978 | const PageSidebarContext = React__namespace.createContext(pageSidebarContextDefaults);
|
15979 | const PageSidebar = (_a) => {
|
15980 | var { className = '', nav, isNavOpen = true, theme = 'dark' } = _a, props = __rest$1(_a, ["className", "nav", "isNavOpen", "theme"]);
|
15981 | return (React__namespace.createElement(PageContextConsumer, null, ({ isManagedSidebar, isNavOpen: managedIsNavOpen }) => {
|
15982 | const navOpen = isManagedSidebar ? managedIsNavOpen : isNavOpen;
|
15983 | return (React__namespace.createElement("div", Object.assign({ id: "page-sidebar", className: css(styles$z.pageSidebar, theme === 'light' && styles$z.modifiers.light, navOpen && styles$z.modifiers.expanded, !navOpen && styles$z.modifiers.collapsed, className), "aria-hidden": !navOpen }, props),
|
15984 | React__namespace.createElement("div", { className: "pf-topology-side-bar__body" },
|
15985 | React__namespace.createElement(PageSidebarContext.Provider, { value: { isNavOpen: navOpen } }, nav))));
|
15986 | }));
|
15987 | };
|
15988 | PageSidebar.displayName = 'PageSidebar';
|
15989 |
|
15990 | class NavList extends React__namespace.Component {
|
15991 | constructor() {
|
15992 | super(...arguments);
|
15993 | this.state = {
|
15994 | scrollViewAtStart: false,
|
15995 | scrollViewAtEnd: false
|
15996 | };
|
15997 | this.navList = React__namespace.createRef();
|
15998 | this.observer = () => { };
|
15999 | this.handleScrollButtons = () => {
|
16000 | const container = this.navList.current;
|
16001 | if (container) {
|
16002 |
|
16003 | const scrollViewAtStart = isElementInView(container, container.firstChild, false);
|
16004 | const scrollViewAtEnd = isElementInView(container, container.lastChild, false);
|
16005 | this.setState({
|
16006 | scrollViewAtStart,
|
16007 | scrollViewAtEnd
|
16008 | });
|
16009 | this.context.updateIsScrollable(!scrollViewAtStart || !scrollViewAtEnd);
|
16010 | }
|
16011 | };
|
16012 | this.scrollLeft = () => {
|
16013 |
|
16014 | const container = this.navList.current;
|
16015 | if (container) {
|
16016 | const childrenArr = Array.from(container.children);
|
16017 | let firstElementInView;
|
16018 | let lastElementOutOfView;
|
16019 | for (let i = 0; i < childrenArr.length && !firstElementInView; i++) {
|
16020 | if (isElementInView(container, childrenArr[i], false)) {
|
16021 | firstElementInView = childrenArr[i];
|
16022 | lastElementOutOfView = childrenArr[i - 1];
|
16023 | }
|
16024 | }
|
16025 | if (lastElementOutOfView) {
|
16026 | container.scrollLeft -= lastElementOutOfView.scrollWidth;
|
16027 | }
|
16028 | this.handleScrollButtons();
|
16029 | }
|
16030 | };
|
16031 | this.scrollRight = () => {
|
16032 |
|
16033 | const container = this.navList.current;
|
16034 | if (container) {
|
16035 | const childrenArr = Array.from(container.children);
|
16036 | let lastElementInView;
|
16037 | let firstElementOutOfView;
|
16038 | for (let i = childrenArr.length - 1; i >= 0 && !lastElementInView; i--) {
|
16039 | if (isElementInView(container, childrenArr[i], false)) {
|
16040 | lastElementInView = childrenArr[i];
|
16041 | firstElementOutOfView = childrenArr[i + 1];
|
16042 | }
|
16043 | }
|
16044 | if (firstElementOutOfView) {
|
16045 | container.scrollLeft += firstElementOutOfView.scrollWidth;
|
16046 | }
|
16047 | this.handleScrollButtons();
|
16048 | }
|
16049 | };
|
16050 | }
|
16051 | componentDidMount() {
|
16052 | this.observer = getResizeObserver(this.navList.current, this.handleScrollButtons);
|
16053 | this.handleScrollButtons();
|
16054 | }
|
16055 | componentWillUnmount() {
|
16056 | this.observer();
|
16057 | }
|
16058 | render() {
|
16059 | const _a = this.props, { children, className, ariaLeftScroll, ariaRightScroll } = _a, props = __rest$1(_a, ["children", "className", "ariaLeftScroll", "ariaRightScroll"]);
|
16060 | const { scrollViewAtStart, scrollViewAtEnd } = this.state;
|
16061 | return (React__namespace.createElement(NavContext.Consumer, null, ({ isHorizontal }) => (React__namespace.createElement(PageSidebarContext.Consumer, null, ({ isNavOpen }) => (React__namespace.createElement(React__namespace.Fragment, null,
|
16062 | isHorizontal && (React__namespace.createElement("button", { className: css(styles$v.navScrollButton), "aria-label": ariaLeftScroll, onClick: this.scrollLeft, disabled: scrollViewAtStart, tabIndex: isNavOpen ? null : -1 },
|
16063 | React__namespace.createElement(AngleLeftIcon$1, null))),
|
16064 | React__namespace.createElement("ul", Object.assign({ ref: this.navList, className: css(styles$v.navList, className), onScroll: this.handleScrollButtons }, props), children),
|
16065 | isHorizontal && (React__namespace.createElement("button", { className: css(styles$v.navScrollButton), "aria-label": ariaRightScroll, onClick: this.scrollRight, disabled: scrollViewAtEnd, tabIndex: isNavOpen ? null : -1 },
|
16066 | React__namespace.createElement(AngleRightIcon$1, null)))))))));
|
16067 | }
|
16068 | }
|
16069 | NavList.displayName = 'NavList';
|
16070 | NavList.contextType = NavContext;
|
16071 | NavList.defaultProps = {
|
16072 | ariaLeftScroll: 'Scroll left',
|
16073 | ariaRightScroll: 'Scroll right'
|
16074 | };
|
16075 |
|
16076 | const NavGroup = (_a) => {
|
16077 | var { title, children = null, className = '', id = getUniqueId() } = _a, props = __rest$1(_a, ["title", "children", "className", "id"]);
|
16078 | if (!title && !props['aria-label']) {
|
16079 |
|
16080 | console.warn("For accessibility reasons an aria-label should be specified on nav groups if a title isn't");
|
16081 | }
|
16082 | const labelledBy = title ? id : undefined;
|
16083 | return (React__namespace.createElement("section", Object.assign({ className: css(styles$v.navSection, className), "aria-labelledby": labelledBy }, props),
|
16084 | title && (React__namespace.createElement("h2", { className: css(styles$v.navSectionTitle), id: id }, title)),
|
16085 | React__namespace.createElement("ul", { className: css(styles$v.navList, className) }, children)));
|
16086 | };
|
16087 | NavGroup.displayName = 'NavGroup';
|
16088 |
|
16089 | const NavItem = (_a) => {
|
16090 | var { children, styleChildren = true, className, to, isActive = false, groupId = null, itemId = null, preventDefault = false, onClick = null, component = 'a', flyout, onShowFlyout, ouiaId, ouiaSafe } = _a, props = __rest$1(_a, ["children", "styleChildren", "className", "to", "isActive", "groupId", "itemId", "preventDefault", "onClick", "component", "flyout", "onShowFlyout", "ouiaId", "ouiaSafe"]);
|
16091 | const { flyoutRef, setFlyoutRef } = React__namespace.useContext(NavContext);
|
16092 | const { isNavOpen } = React__namespace.useContext(PageSidebarContext);
|
16093 | const [flyoutTarget, setFlyoutTarget] = React__namespace.useState(null);
|
16094 | const [isHovered, setIsHovered] = React__namespace.useState(false);
|
16095 | const ref = React__namespace.useRef();
|
16096 | const flyoutVisible = ref === flyoutRef;
|
16097 | const popperRef = React__namespace.useRef();
|
16098 | const Component = component;
|
16099 | const hasFlyout = flyout !== undefined;
|
16100 | const showFlyout = (show, override) => {
|
16101 | if ((!flyoutVisible || override) && show) {
|
16102 | setFlyoutRef(ref);
|
16103 | }
|
16104 | else if ((flyoutVisible || override) && !show) {
|
16105 | setFlyoutRef(null);
|
16106 | }
|
16107 | onShowFlyout && show && onShowFlyout();
|
16108 | };
|
16109 | const onMouseOver = (event) => {
|
16110 | const evtContainedInFlyout = event.target.closest('.pf-c-nav__item.pf-m-flyout');
|
16111 | if (hasFlyout && !flyoutVisible) {
|
16112 | showFlyout(true);
|
16113 | }
|
16114 | else if (flyoutRef !== null && !evtContainedInFlyout) {
|
16115 | setFlyoutRef(null);
|
16116 | }
|
16117 | };
|
16118 | const onFlyoutClick = (event) => {
|
16119 | const target = event.target;
|
16120 | const closestItem = target.closest('.pf-m-flyout');
|
16121 | if (!closestItem) {
|
16122 | if (hasFlyout) {
|
16123 | showFlyout(false, true);
|
16124 | }
|
16125 | else if (flyoutRef !== null) {
|
16126 | setFlyoutRef(null);
|
16127 | }
|
16128 | }
|
16129 | };
|
16130 | const handleFlyout = (event) => {
|
16131 | var _a, _b;
|
16132 | const key = event.key;
|
16133 | const target = event.target;
|
16134 | if (!(((_a = popperRef === null || popperRef === void 0 ? void 0 : popperRef.current) === null || _a === void 0 ? void 0 : _a.contains(target)) || (hasFlyout && ((_b = ref === null || ref === void 0 ? void 0 : ref.current) === null || _b === void 0 ? void 0 : _b.contains(target))))) {
|
16135 | return;
|
16136 | }
|
16137 | if (key === ' ' || key === 'ArrowRight') {
|
16138 | event.stopPropagation();
|
16139 | event.preventDefault();
|
16140 | if (!flyoutVisible) {
|
16141 | showFlyout(true);
|
16142 | setFlyoutTarget(target);
|
16143 | }
|
16144 | }
|
16145 | if (key === 'Escape' || key === 'ArrowLeft') {
|
16146 | if (flyoutVisible) {
|
16147 | event.stopPropagation();
|
16148 | event.preventDefault();
|
16149 | showFlyout(false);
|
16150 | }
|
16151 | }
|
16152 | };
|
16153 | React__namespace.useEffect(() => {
|
16154 | if (hasFlyout) {
|
16155 | window.addEventListener('click', onFlyoutClick);
|
16156 | }
|
16157 | return () => {
|
16158 | if (hasFlyout) {
|
16159 | window.removeEventListener('click', onFlyoutClick);
|
16160 | }
|
16161 | };
|
16162 | }, []);
|
16163 | React__namespace.useEffect(() => {
|
16164 | if (flyoutTarget) {
|
16165 | if (flyoutVisible) {
|
16166 | const flyoutItems = Array.from(popperRef.current.getElementsByTagName('UL')[0].children).filter(el => !(el.classList.contains('pf-m-disabled') || el.classList.contains('pf-c-divider')));
|
16167 | flyoutItems[0].firstChild.focus();
|
16168 | }
|
16169 | else {
|
16170 | flyoutTarget.focus();
|
16171 | }
|
16172 | }
|
16173 | }, [flyoutVisible, flyoutTarget]);
|
16174 | const flyoutButton = (React__namespace.createElement("span", { className: css(styles$v.navToggle) },
|
16175 | React__namespace.createElement("span", { className: css(styles$v.navToggleIcon) },
|
16176 | React__namespace.createElement(AngleRightIcon$1, { "aria-hidden": true }))));
|
16177 | const renderDefaultLink = (context) => {
|
16178 | const preventLinkDefault = preventDefault || !to;
|
16179 | return (React__namespace.createElement(Component, Object.assign({ href: to, onClick: (e) => context.onSelect(e, groupId, itemId, to, preventLinkDefault, onClick), className: css(styles$v.navLink, isActive && styles$v.modifiers.current, isHovered && styles$v.modifiers.hover, className), "aria-current": isActive ? 'page' : null, tabIndex: isNavOpen ? null : '-1' }, props),
|
16180 | children,
|
16181 | flyout && flyoutButton));
|
16182 | };
|
16183 | const renderClonedChild = (context, child) => React__namespace.cloneElement(child, Object.assign(Object.assign({ onClick: (e) => context.onSelect(e, groupId, itemId, to, preventDefault, onClick), 'aria-current': isActive ? 'page' : null }, (styleChildren && {
|
16184 | className: css(styles$v.navLink, isActive && styles$v.modifiers.current, child.props && child.props.className)
|
16185 | })), { tabIndex: child.props.tabIndex || isNavOpen ? null : -1, children: hasFlyout ? (React__namespace.createElement(React__namespace.Fragment, null,
|
16186 | child.props.children,
|
16187 | flyoutButton)) : (child.props.children) }));
|
16188 | const ouiaProps = useOUIAProps(NavItem.displayName, ouiaId, ouiaSafe);
|
16189 | const handleMouseEnter = () => {
|
16190 | setIsHovered(true);
|
16191 | };
|
16192 | const handleMouseLeave = () => {
|
16193 | setIsHovered(false);
|
16194 | };
|
16195 | const flyoutPopper = (React__namespace.createElement(Popper, { reference: ref, popper: React__namespace.createElement("div", { ref: popperRef, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave }, flyout), placement: "right-start", isVisible: flyoutVisible, onDocumentKeyDown: handleFlyout }));
|
16196 | const navItem = (React__namespace.createElement(React__namespace.Fragment, null,
|
16197 | React__namespace.createElement("li", Object.assign({ onMouseOver: onMouseOver, className: css(styles$v.navItem, hasFlyout && styles$v.modifiers.flyout, className), ref: ref }, ouiaProps),
|
16198 | React__namespace.createElement(NavContext.Consumer, null, context => React__namespace.isValidElement(children)
|
16199 | ? renderClonedChild(context, children)
|
16200 | : renderDefaultLink(context))),
|
16201 | flyout && flyoutPopper));
|
16202 | return navItem;
|
16203 | };
|
16204 | NavItem.displayName = 'NavItem';
|
16205 |
|
16206 | const NavItemSeparator = (_a) => {
|
16207 | var { component = 'li' } = _a, props = __rest$1(_a, ["component"]);
|
16208 | return React__namespace.createElement(Divider, Object.assign({ component: component }, props));
|
16209 | };
|
16210 | NavItemSeparator.displayName = 'NavItemSeparator';
|
16211 |
|
16212 | class NavExpandable extends React__namespace.Component {
|
16213 | constructor() {
|
16214 | super(...arguments);
|
16215 | this.id = this.props.id || getUniqueId();
|
16216 | this.state = {
|
16217 | expandedState: this.props.isExpanded,
|
16218 | ouiaStateId: getDefaultOUIAId(NavExpandable.displayName)
|
16219 | };
|
16220 | this.onExpand = (e, onToggle) => {
|
16221 | const { expandedState } = this.state;
|
16222 | if (this.props.onExpand) {
|
16223 | this.props.onExpand(e, !expandedState);
|
16224 | }
|
16225 | else {
|
16226 | this.setState(prevState => ({ expandedState: !prevState.expandedState }));
|
16227 | const { groupId } = this.props;
|
16228 | onToggle(e, groupId, !expandedState);
|
16229 | }
|
16230 | };
|
16231 | }
|
16232 | componentDidMount() {
|
16233 | this.setState({ expandedState: this.props.isExpanded });
|
16234 | }
|
16235 | componentDidUpdate(prevProps) {
|
16236 | if (this.props.isExpanded !== prevProps.isExpanded) {
|
16237 | this.setState({ expandedState: this.props.isExpanded });
|
16238 | }
|
16239 | }
|
16240 | render() {
|
16241 | const _a = this.props, { title, srText, children, className, isActive, ouiaId,
|
16242 |
|
16243 | groupId,
|
16244 |
|
16245 | id,
|
16246 |
|
16247 | isExpanded, buttonProps,
|
16248 |
|
16249 | onExpand } = _a, props = __rest$1(_a, ["title", "srText", "children", "className", "isActive", "ouiaId", "groupId", "id", "isExpanded", "buttonProps", "onExpand"]);
|
16250 | const { expandedState, ouiaStateId } = this.state;
|
16251 | return (React__namespace.createElement(NavContext.Consumer, null, context => (React__namespace.createElement("li", Object.assign({ className: css(styles$v.navItem, styles$v.modifiers.expandable, expandedState && styles$v.modifiers.expanded, isActive && styles$v.modifiers.current, className) }, getOUIAProps(NavExpandable.displayName, ouiaId !== undefined ? ouiaId : ouiaStateId), props),
|
16252 | React__namespace.createElement(PageSidebarContext.Consumer, null, ({ isNavOpen }) => (React__namespace.createElement("button", Object.assign({ className: styles$v.navLink, id: srText ? null : this.id, onClick: e => this.onExpand(e, context.onToggle), "aria-expanded": expandedState, tabIndex: isNavOpen ? null : -1 }, buttonProps),
|
16253 | title,
|
16254 | React__namespace.createElement("span", { className: css(styles$v.navToggle) },
|
16255 | React__namespace.createElement("span", { className: css(styles$v.navToggleIcon) },
|
16256 | React__namespace.createElement(AngleRightIcon$1, { "aria-hidden": "true" })))))),
|
16257 | React__namespace.createElement("section", { className: css(styles$v.navSubnav), "aria-labelledby": this.id, hidden: expandedState ? null : true },
|
16258 | srText && (React__namespace.createElement("h2", { className: css(a11yStyles.screenReader), id: this.id }, srText)),
|
16259 | React__namespace.createElement("ul", { className: css(styles$v.navList) }, children))))));
|
16260 | }
|
16261 | }
|
16262 | NavExpandable.displayName = 'NavExpandable';
|
16263 | NavExpandable.defaultProps = {
|
16264 | srText: '',
|
16265 | isExpanded: false,
|
16266 | children: '',
|
16267 | className: '',
|
16268 | groupId: null,
|
16269 | isActive: false,
|
16270 | id: ''
|
16271 | };
|
16272 |
|
16273 | Promise.resolve().then(function () { return notificationBadge; });
|
16274 | var styles$u = {
|
16275 | "iconAttentionBell": "pf-icon-attention-bell",
|
16276 | "iconBell": "pf-icon-bell",
|
16277 | "modifiers": {
|
16278 | "read": "pf-m-read",
|
16279 | "unread": "pf-m-unread",
|
16280 | "attention": "pf-m-attention"
|
16281 | },
|
16282 | "notificationBadge": "pf-c-notification-badge",
|
16283 | "notificationBadgeCount": "pf-c-notification-badge__count"
|
16284 | };
|
16285 |
|
16286 | const AttentionBellIconConfig = {
|
16287 | name: 'AttentionBellIcon',
|
16288 | height: 1024,
|
16289 | width: 896,
|
16290 | svgPath: 'M448,0 C465.333333,0 480.333333,6.33333333 493,19 C505.666667,31.6666667 512,46.6666667 512,64 L512,106 L514.23,106.45 C587.89,121.39 648.48,157.24 696,214 C744,271.333333 768,338.666667 768,416 C768,500 780,568.666667 804,622 C818.666667,652.666667 841.333333,684 872,716 C873.773676,718.829136 875.780658,721.505113 878,724 C890,737.333333 896,752.333333 896,769 C896,785.666667 890,800.333333 878,813 C866,825.666667 850.666667,832 832,832 L63.3,832 C44.9533333,831.84 29.8533333,825.506667 18,813 C6,800.333333 0,785.666667 0,769 C0,752.333333 6,737.333333 18,724 L24,716 L25.06,714.9 C55.1933333,683.28 77.5066667,652.313333 92,622 C116,568.666667 128,500 128,416 C128,338.666667 152,271.333333 200,214 C248,156.666667 309.333333,120.666667 384,106 L384,63.31 C384.166667,46.27 390.5,31.5 403,19 C415.666667,6.33333333 430.666667,0 448,0 Z M576,896 L576,897.08 C575.74,932.6 563.073333,962.573333 538,987 C512.666667,1011.66667 482.666667,1024 448,1024 C413.333333,1024 383.333333,1011.66667 358,987 C332.666667,962.333333 320,932 320,896 L576,896 Z M475,192 L421,192 C400.565464,192 384,208.565464 384,229 L384,539 C384,559.434536 400.565464,576 421,576 L475,576 C495.434536,576 512,559.434536 512,539 L512,229 C512,208.565464 495.434536,192 475,192 Z M448,640 C412.653776,640 384,668.653776 384,704 C384,739.346224 412.653776,768 448,768 C483.346224,768 512,739.346224 512,704 C512,668.653776 483.346224,640 448,640 Z',
|
16291 | yOffset: 0,
|
16292 | xOffset: 0,
|
16293 | };
|
16294 |
|
16295 | const AttentionBellIcon = createIcon(AttentionBellIconConfig);
|
16296 |
|
16297 | var AttentionBellIcon$1 = AttentionBellIcon;
|
16298 |
|
16299 | exports.NotificationBadgeVariant = void 0;
|
16300 | (function (NotificationBadgeVariant) {
|
16301 | NotificationBadgeVariant["read"] = "read";
|
16302 | NotificationBadgeVariant["unread"] = "unread";
|
16303 | NotificationBadgeVariant["attention"] = "attention";
|
16304 | })(exports.NotificationBadgeVariant || (exports.NotificationBadgeVariant = {}));
|
16305 | const NotificationBadge = (_a) => {
|
16306 | var { isRead, children, variant = isRead ? 'read' : 'unread', count = 0, attentionIcon = React__namespace.createElement(AttentionBellIcon$1, null), icon = React__namespace.createElement(BellIcon$1, null), className } = _a, props = __rest$1(_a, ["isRead", "children", "variant", "count", "attentionIcon", "icon", "className"]);
|
16307 | let notificationChild = icon;
|
16308 | if (children !== undefined) {
|
16309 | notificationChild = children;
|
16310 | }
|
16311 | else if (variant === exports.NotificationBadgeVariant.attention) {
|
16312 | notificationChild = attentionIcon;
|
16313 | }
|
16314 | return (React__namespace.createElement(Button, Object.assign({ variant: exports.ButtonVariant.plain, className: className }, props),
|
16315 | React__namespace.createElement("span", { className: css(styles$u.notificationBadge, styles$u.modifiers[variant]) },
|
16316 | notificationChild,
|
16317 | count > 0 && React__namespace.createElement("span", { className: css(styles$u.notificationBadgeCount) }, count))));
|
16318 | };
|
16319 | NotificationBadge.displayName = 'NotificationBadge';
|
16320 |
|
16321 | Promise.resolve().then(function () { return notificationDrawer; });
|
16322 | var styles$t = {
|
16323 | "modifiers": {
|
16324 | "read": "pf-m-read",
|
16325 | "info": "pf-m-info",
|
16326 | "warning": "pf-m-warning",
|
16327 | "danger": "pf-m-danger",
|
16328 | "success": "pf-m-success",
|
16329 | "default": "pf-m-default",
|
16330 | "hoverable": "pf-m-hoverable",
|
16331 | "truncate": "pf-m-truncate",
|
16332 | "expanded": "pf-m-expanded"
|
16333 | },
|
16334 | "notificationDrawer": "pf-c-notification-drawer",
|
16335 | "notificationDrawerBody": "pf-c-notification-drawer__body",
|
16336 | "notificationDrawerGroup": "pf-c-notification-drawer__group",
|
16337 | "notificationDrawerGroupList": "pf-c-notification-drawer__group-list",
|
16338 | "notificationDrawerGroupToggle": "pf-c-notification-drawer__group-toggle",
|
16339 | "notificationDrawerGroupToggleCount": "pf-c-notification-drawer__group-toggle-count",
|
16340 | "notificationDrawerGroupToggleIcon": "pf-c-notification-drawer__group-toggle-icon",
|
16341 | "notificationDrawerGroupToggleTitle": "pf-c-notification-drawer__group-toggle-title",
|
16342 | "notificationDrawerHeader": "pf-c-notification-drawer__header",
|
16343 | "notificationDrawerHeaderAction": "pf-c-notification-drawer__header-action",
|
16344 | "notificationDrawerHeaderStatus": "pf-c-notification-drawer__header-status",
|
16345 | "notificationDrawerHeaderTitle": "pf-c-notification-drawer__header-title",
|
16346 | "notificationDrawerListItem": "pf-c-notification-drawer__list-item",
|
16347 | "notificationDrawerListItemAction": "pf-c-notification-drawer__list-item-action",
|
16348 | "notificationDrawerListItemDescription": "pf-c-notification-drawer__list-item-description",
|
16349 | "notificationDrawerListItemHeader": "pf-c-notification-drawer__list-item-header",
|
16350 | "notificationDrawerListItemHeaderIcon": "pf-c-notification-drawer__list-item-header-icon",
|
16351 | "notificationDrawerListItemHeaderTitle": "pf-c-notification-drawer__list-item-header-title",
|
16352 | "notificationDrawerListItemTimestamp": "pf-c-notification-drawer__list-item-timestamp"
|
16353 | };
|
16354 |
|
16355 | const NotificationDrawerBase = (_a) => {
|
16356 | var { children, className = '', innerRef } = _a, props = __rest$1(_a, ["children", "className", "innerRef"]);
|
16357 | return (React__namespace.createElement("div", Object.assign({ ref: innerRef }, props, { className: css(styles$t.notificationDrawer, className) }), children));
|
16358 | };
|
16359 | const NotificationDrawer = React__namespace.forwardRef((props, ref) => (React__namespace.createElement(NotificationDrawerBase, Object.assign({ innerRef: ref }, props))));
|
16360 | NotificationDrawer.displayName = 'NotificationDrawer';
|
16361 |
|
16362 | const NotificationDrawerBody = (_a) => {
|
16363 | var { children, className = '' } = _a, props = __rest$1(_a, ["children", "className"]);
|
16364 | return (React__namespace.createElement("div", Object.assign({}, props, { className: css(styles$t.notificationDrawerBody, className) }), children));
|
16365 | };
|
16366 | NotificationDrawerBody.displayName = 'NotificationDrawerBody';
|
16367 |
|
16368 | const c_notification_drawer__group_toggle_title_max_lines = {
|
16369 | "name": "--pf-c-notification-drawer__group-toggle-title--max-lines",
|
16370 | "value": "1",
|
16371 | "var": "var(--pf-c-notification-drawer__group-toggle-title--max-lines)"
|
16372 | };
|
16373 | var maxLines$1 = c_notification_drawer__group_toggle_title_max_lines;
|
16374 |
|
16375 | const NotificationDrawerGroup = (_a) => {
|
16376 | var { children, className = '', count, isExpanded, isRead = false,
|
16377 |
|
16378 | onExpand = (event, expanded) => undefined, title, truncateTitle = 0, tooltipPosition } = _a, props = __rest$1(_a, ["children", "className", "count", "isExpanded", "isRead", "onExpand", "title", "truncateTitle", "tooltipPosition"]);
|
16379 | const titleRef = React__namespace.useRef(null);
|
16380 | const [isTooltipVisible, setIsTooltipVisible] = React__namespace.useState(false);
|
16381 | React__namespace.useEffect(() => {
|
16382 |
|
16383 | const showTooltip = titleRef.current && titleRef.current.offsetHeight < titleRef.current.scrollHeight;
|
16384 | if (isTooltipVisible !== showTooltip) {
|
16385 | setIsTooltipVisible(showTooltip);
|
16386 | }
|
16387 | if (!titleRef.current || !truncateTitle) {
|
16388 | return;
|
16389 | }
|
16390 | titleRef.current.style.setProperty(maxLines$1.name, truncateTitle.toString());
|
16391 | }, [titleRef, truncateTitle, isTooltipVisible]);
|
16392 | const Title = (React__namespace.createElement("div", Object.assign({}, (isTooltipVisible && { tabIndex: 0 }), { ref: titleRef, className: css(styles$t.notificationDrawerGroupToggleTitle) }), title));
|
16393 | return (React__namespace.createElement("section", Object.assign({}, props, { className: css(styles$t.notificationDrawerGroup, isExpanded && styles$t.modifiers.expanded, className) }),
|
16394 | React__namespace.createElement("h1", null,
|
16395 | React__namespace.createElement("button", { className: css(styles$t.notificationDrawerGroupToggle), "aria-expanded": isExpanded, onClick: e => onExpand(e, !isExpanded), onKeyDown: e => {
|
16396 | if (e.key === 'Enter' || e.key === ' ') {
|
16397 | e.preventDefault();
|
16398 | onExpand(e, !isExpanded);
|
16399 | }
|
16400 | } },
|
16401 | isTooltipVisible ? (React__namespace.createElement(Tooltip, { content: title, position: tooltipPosition }, Title)) : (Title),
|
16402 | React__namespace.createElement("div", { className: css(styles$t.notificationDrawerGroupToggleCount) },
|
16403 | React__namespace.createElement(Badge, { isRead: isRead }, count)),
|
16404 | React__namespace.createElement("span", { className: "pf-c-notification-drawer__group-toggle-icon" },
|
16405 | React__namespace.createElement(AngleRightIcon$1, null)))),
|
16406 | children));
|
16407 | };
|
16408 | NotificationDrawerGroup.displayName = 'NotificationDrawerGroup';
|
16409 |
|
16410 | const NotificationDrawerGroupList = (_a) => {
|
16411 | var { children, className = '' } = _a, props = __rest$1(_a, ["children", "className"]);
|
16412 | return (React__namespace.createElement("div", Object.assign({}, props, { className: css(styles$t.notificationDrawerGroupList, className) }), children));
|
16413 | };
|
16414 | NotificationDrawerGroupList.displayName = 'NotificationDrawerGroupList';
|
16415 |
|
16416 | const TextContent = (_a) => {
|
16417 | var { children = null, className = '', isVisited = false } = _a, props = __rest$1(_a, ["children", "className", "isVisited"]);
|
16418 | return (React__namespace.createElement("div", Object.assign({}, props, { className: css(styles$1f.content, isVisited && styles$1f.modifiers.visited, className) }), children));
|
16419 | };
|
16420 | TextContent.displayName = 'TextContent';
|
16421 |
|
16422 | exports.TextVariants = void 0;
|
16423 | (function (TextVariants) {
|
16424 | TextVariants["h1"] = "h1";
|
16425 | TextVariants["h2"] = "h2";
|
16426 | TextVariants["h3"] = "h3";
|
16427 | TextVariants["h4"] = "h4";
|
16428 | TextVariants["h5"] = "h5";
|
16429 | TextVariants["h6"] = "h6";
|
16430 | TextVariants["p"] = "p";
|
16431 | TextVariants["a"] = "a";
|
16432 | TextVariants["small"] = "small";
|
16433 | TextVariants["blockquote"] = "blockquote";
|
16434 | TextVariants["pre"] = "pre";
|
16435 | })(exports.TextVariants || (exports.TextVariants = {}));
|
16436 | const Text = (_a) => {
|
16437 | var { children = null, className = '', component = exports.TextVariants.p, isVisitedLink = false, ouiaId, ouiaSafe = true } = _a, props = __rest$1(_a, ["children", "className", "component", "isVisitedLink", "ouiaId", "ouiaSafe"]);
|
16438 | const Component = component;
|
16439 | const ouiaProps = useOUIAProps(Text.displayName, ouiaId, ouiaSafe);
|
16440 | return (React__namespace.createElement(Component, Object.assign({}, ouiaProps, props, { "data-pf-content": true, className: css(isVisitedLink && component === exports.TextVariants.a && styles$1f.modifiers.visited, className) }), children));
|
16441 | };
|
16442 | Text.displayName = 'Text';
|
16443 |
|
16444 | exports.TextListVariants = void 0;
|
16445 | (function (TextListVariants) {
|
16446 | TextListVariants["ul"] = "ul";
|
16447 | TextListVariants["ol"] = "ol";
|
16448 | TextListVariants["dl"] = "dl";
|
16449 | })(exports.TextListVariants || (exports.TextListVariants = {}));
|
16450 | const TextList = (_a) => {
|
16451 | var { children = null, className = '', component = exports.TextListVariants.ul } = _a, props = __rest$1(_a, ["children", "className", "component"]);
|
16452 | const Component = component;
|
16453 | return (React__namespace.createElement(Component, Object.assign({}, props, { "data-pf-content": true, className: css(className) }), children));
|
16454 | };
|
16455 | TextList.displayName = 'TextList';
|
16456 |
|
16457 | exports.TextListItemVariants = void 0;
|
16458 | (function (TextListItemVariants) {
|
16459 | TextListItemVariants["li"] = "li";
|
16460 | TextListItemVariants["dt"] = "dt";
|
16461 | TextListItemVariants["dd"] = "dd";
|
16462 | })(exports.TextListItemVariants || (exports.TextListItemVariants = {}));
|
16463 | const TextListItem = (_a) => {
|
16464 | var { children = null, className = '', component = exports.TextListItemVariants.li } = _a, props = __rest$1(_a, ["children", "className", "component"]);
|
16465 | const Component = component;
|
16466 | return (React__namespace.createElement(Component, Object.assign({}, props, { "data-pf-content": true, className: css(className) }), children));
|
16467 | };
|
16468 | TextListItem.displayName = 'TextListItem';
|
16469 |
|
16470 | const NotificationDrawerHeader = (_a) => {
|
16471 | var { children, className = '', count, closeButtonAriaLabel = 'Close', customText, onClose, title = 'Notifications', unreadText = 'unread' } = _a, props = __rest$1(_a, ["children", "className", "count", "closeButtonAriaLabel", "customText", "onClose", "title", "unreadText"]);
|
16472 | return (React__namespace.createElement("div", Object.assign({}, props, { className: css(styles$t.notificationDrawerHeader, className) }),
|
16473 | React__namespace.createElement(Text, { component: exports.TextVariants.h1, className: css(styles$t.notificationDrawerHeaderTitle) }, title),
|
16474 | (customText !== undefined || count !== undefined) && (React__namespace.createElement("span", { className: css(styles$t.notificationDrawerHeaderStatus) }, customText || `${count} ${unreadText}`)),
|
16475 | (children || onClose) && (React__namespace.createElement("div", { className: css(styles$t.notificationDrawerHeaderAction) },
|
16476 | children,
|
16477 | onClose && (React__namespace.createElement("div", null,
|
16478 | React__namespace.createElement(Button, { variant: exports.ButtonVariant.plain, "aria-label": closeButtonAriaLabel, onClick: onClose },
|
16479 | React__namespace.createElement(TimesIcon$1, { "aria-hidden": "true" }))))))));
|
16480 | };
|
16481 | NotificationDrawerHeader.displayName = 'NotificationDrawerHeader';
|
16482 |
|
16483 | const NotificationDrawerList = (_a) => {
|
16484 | var { children, className = '', isHidden = false } = _a, props = __rest$1(_a, ["children", "className", "isHidden"]);
|
16485 | return (React__namespace.createElement("ul", Object.assign({}, props, { className: css('pf-c-notification-drawer__list', className), hidden: isHidden }), children));
|
16486 | };
|
16487 | NotificationDrawerList.displayName = 'NotificationDrawerList';
|
16488 |
|
16489 | const NotificationDrawerListItem = (_a) => {
|
16490 | var { children = null, className = '', isHoverable = true, isRead = false,
|
16491 |
|
16492 | onClick = (event) => undefined, tabIndex = 0, variant = 'default' } = _a, props = __rest$1(_a, ["children", "className", "isHoverable", "isRead", "onClick", "tabIndex", "variant"]);
|
16493 | const onKeyDown = (event) => {
|
16494 |
|
16495 | if (event.key === 'Enter' || event.key === ' ') {
|
16496 | event.target.click();
|
16497 | }
|
16498 | };
|
16499 | return (React__namespace.createElement("li", Object.assign({}, props, { className: css(styles$t.notificationDrawerListItem, isHoverable && styles$t.modifiers.hoverable, styles$t.modifiers[variant], isRead && styles$t.modifiers.read, className), tabIndex: tabIndex, onClick: e => onClick(e), onKeyDown: onKeyDown }), children));
|
16500 | };
|
16501 | NotificationDrawerListItem.displayName = 'NotificationDrawerListItem';
|
16502 |
|
16503 | const NotificationDrawerListItemBody = (_a) => {
|
16504 | var { children, className = '', timestamp } = _a, props = __rest$1(_a, ["children", "className", "timestamp"]);
|
16505 | return (React__namespace.createElement(React__namespace.Fragment, null,
|
16506 | React__namespace.createElement("div", Object.assign({}, props, { className: css(styles$t.notificationDrawerListItemDescription, className) }), children),
|
16507 | timestamp && React__namespace.createElement("div", { className: css(styles$t.notificationDrawerListItemTimestamp, className) }, timestamp)));
|
16508 | };
|
16509 | NotificationDrawerListItemBody.displayName = 'NotificationDrawerListItemBody';
|
16510 |
|
16511 | const c_notification_drawer__list_item_header_title_max_lines = {
|
16512 | "name": "--pf-c-notification-drawer__list-item-header-title--max-lines",
|
16513 | "value": "1",
|
16514 | "var": "var(--pf-c-notification-drawer__list-item-header-title--max-lines)"
|
16515 | };
|
16516 | var maxLines = c_notification_drawer__list_item_header_title_max_lines;
|
16517 |
|
16518 | const variantIcons$1 = {
|
16519 | success: CheckCircleIcon$1,
|
16520 | danger: ExclamationCircleIcon$1,
|
16521 | warning: ExclamationTriangleIcon$1,
|
16522 | info: InfoCircleIcon$1,
|
16523 | default: BellIcon$1
|
16524 | };
|
16525 | const NotificationDrawerListItemHeader = (_a) => {
|
16526 | var { children, className = '', icon = null, srTitle, title, variant = 'default', truncateTitle = 0, tooltipPosition } = _a, props = __rest$1(_a, ["children", "className", "icon", "srTitle", "title", "variant", "truncateTitle", "tooltipPosition"]);
|
16527 | const titleRef = React__namespace.useRef(null);
|
16528 | const [isTooltipVisible, setIsTooltipVisible] = React__namespace.useState(false);
|
16529 | React__namespace.useEffect(() => {
|
16530 | if (!titleRef.current || !truncateTitle) {
|
16531 | return;
|
16532 | }
|
16533 | titleRef.current.style.setProperty(maxLines.name, truncateTitle.toString());
|
16534 | const showTooltip = titleRef.current && titleRef.current.offsetHeight < titleRef.current.scrollHeight;
|
16535 | if (isTooltipVisible !== showTooltip) {
|
16536 | setIsTooltipVisible(showTooltip);
|
16537 | }
|
16538 | }, [titleRef, truncateTitle, isTooltipVisible]);
|
16539 | const Icon = variantIcons$1[variant];
|
16540 | const Title = (React__namespace.createElement("h2", Object.assign({}, (isTooltipVisible && { tabIndex: 0 }), { ref: titleRef, className: css(styles$t.notificationDrawerListItemHeaderTitle, truncateTitle && styles$t.modifiers.truncate) }),
|
16541 | srTitle && React__namespace.createElement("span", { className: css(a11yStyles.screenReader) }, srTitle),
|
16542 | title));
|
16543 | return (React__namespace.createElement(React__namespace.Fragment, null,
|
16544 | React__namespace.createElement("div", Object.assign({}, props, { className: css(styles$t.notificationDrawerListItemHeader, className) }),
|
16545 | React__namespace.createElement("span", { className: css(styles$t.notificationDrawerListItemHeaderIcon) }, icon ? icon : React__namespace.createElement(Icon, null)),
|
16546 | isTooltipVisible ? (React__namespace.createElement(Tooltip, { content: title, position: tooltipPosition }, Title)) : (Title)),
|
16547 | children && React__namespace.createElement("div", { className: css(styles$t.notificationDrawerListItemAction) }, children)));
|
16548 | };
|
16549 | NotificationDrawerListItemHeader.displayName = 'NotificationDrawerListItemHeader';
|
16550 |
|
16551 | Promise.resolve().then(function () { return optionsMenu; });
|
16552 | var styles$s = {
|
16553 | "divider": "pf-c-divider",
|
16554 | "modifiers": {
|
16555 | "plain": "pf-m-plain",
|
16556 | "text": "pf-m-text",
|
16557 | "active": "pf-m-active",
|
16558 | "expanded": "pf-m-expanded",
|
16559 | "disabled": "pf-m-disabled",
|
16560 | "top": "pf-m-top",
|
16561 | "alignRight": "pf-m-align-right"
|
16562 | },
|
16563 | "optionsMenu": "pf-c-options-menu",
|
16564 | "optionsMenuGroup": "pf-c-options-menu__group",
|
16565 | "optionsMenuGroupTitle": "pf-c-options-menu__group-title",
|
16566 | "optionsMenuMenu": "pf-c-options-menu__menu",
|
16567 | "optionsMenuMenuItem": "pf-c-options-menu__menu-item",
|
16568 | "optionsMenuMenuItemIcon": "pf-c-options-menu__menu-item-icon",
|
16569 | "optionsMenuToggle": "pf-c-options-menu__toggle",
|
16570 | "optionsMenuToggleButton": "pf-c-options-menu__toggle-button",
|
16571 | "optionsMenuToggleButtonIcon": "pf-c-options-menu__toggle-button-icon",
|
16572 | "optionsMenuToggleIcon": "pf-c-options-menu__toggle-icon",
|
16573 | "optionsMenuToggleText": "pf-c-options-menu__toggle-text"
|
16574 | };
|
16575 |
|
16576 | exports.OptionsMenuPosition = void 0;
|
16577 | (function (OptionsMenuPosition) {
|
16578 | OptionsMenuPosition["right"] = "right";
|
16579 | OptionsMenuPosition["left"] = "left";
|
16580 | })(exports.OptionsMenuPosition || (exports.OptionsMenuPosition = {}));
|
16581 | exports.OptionsMenuDirection = void 0;
|
16582 | (function (OptionsMenuDirection) {
|
16583 | OptionsMenuDirection["up"] = "up";
|
16584 | OptionsMenuDirection["down"] = "down";
|
16585 | })(exports.OptionsMenuDirection || (exports.OptionsMenuDirection = {}));
|
16586 | const OptionsMenu = (_a) => {
|
16587 | var { className = '', menuItems, toggle, isText = false, isGrouped = false, id,
|
16588 |
|
16589 | ref, menuAppendTo = 'inline', ouiaId, ouiaSafe = true } = _a, props = __rest$1(_a, ["className", "menuItems", "toggle", "isText", "isGrouped", "id", "ref", "menuAppendTo", "ouiaId", "ouiaSafe"]);
|
16590 | return (React__namespace.createElement(DropdownContext.Provider, { value: {
|
16591 | id,
|
16592 | onSelect: () => undefined,
|
16593 | toggleIndicatorClass: styles$s.optionsMenuToggleIcon,
|
16594 | toggleTextClass: styles$s.optionsMenuToggleText,
|
16595 | menuClass: styles$s.optionsMenuMenu,
|
16596 | itemClass: styles$s.optionsMenuMenuItem,
|
16597 | toggleClass: isText ? styles$s.optionsMenuToggleButton : styles$s.optionsMenuToggle,
|
16598 | baseClass: styles$s.optionsMenu,
|
16599 | disabledClass: styles$s.modifiers.disabled,
|
16600 | menuComponent: isGrouped ? 'div' : 'ul',
|
16601 | baseComponent: 'div',
|
16602 | ouiaId: useOUIAId(OptionsMenu.displayName, ouiaId),
|
16603 | ouiaSafe,
|
16604 | ouiaComponentType: OptionsMenu.displayName
|
16605 | } },
|
16606 | React__namespace.createElement(DropdownWithContext, Object.assign({ id: id, dropdownItems: menuItems, className: className, isGrouped: isGrouped, toggle: toggle, menuAppendTo: menuAppendTo }, props))));
|
16607 | };
|
16608 | OptionsMenu.displayName = 'OptionsMenu';
|
16609 |
|
16610 | const OptionsMenuToggle = (_a) => {
|
16611 | var { isPlain = false, isDisabled = false, isOpen = false, parentId = '', toggleTemplate = React__namespace.createElement(React__namespace.Fragment, null), hideCaret = false,
|
16612 |
|
16613 | isActive = false,
|
16614 |
|
16615 | isSplitButton = false,
|
16616 |
|
16617 | type, 'aria-label': ariaLabel = 'Options menu' } = _a, props = __rest$1(_a, ["isPlain", "isDisabled", "isOpen", "parentId", "toggleTemplate", "hideCaret", "isActive", "isSplitButton", "type", 'aria-label']);
|
16618 | return (React__namespace.createElement(DropdownContext.Consumer, null, ({ id: contextId }) => (React__namespace.createElement(DropdownToggle, Object.assign({}, ((isPlain || hideCaret) && { toggleIndicator: null }), props, { isPlain: isPlain, isOpen: isOpen, isDisabled: isDisabled, isActive: isActive, id: parentId ? `${parentId}-toggle` : `${contextId}-toggle`, "aria-haspopup": "listbox", "aria-label": ariaLabel, "aria-expanded": isOpen }, (toggleTemplate ? { children: toggleTemplate } : {}))))));
|
16619 | };
|
16620 | OptionsMenuToggle.displayName = 'OptionsMenuToggle';
|
16621 |
|
16622 | const OptionsMenuItemGroup = (_a) => {
|
16623 | var { className = '', 'aria-label': ariaLabel = '', groupTitle = '', children = null, hasSeparator = false } = _a, props = __rest$1(_a, ["className", 'aria-label', "groupTitle", "children", "hasSeparator"]);
|
16624 | return (React__namespace.createElement("section", Object.assign({}, props, { className: css(styles$s.optionsMenuGroup) }),
|
16625 | groupTitle && React__namespace.createElement("h1", { className: css(styles$s.optionsMenuGroupTitle) }, groupTitle),
|
16626 | React__namespace.createElement("ul", { className: className, "aria-label": ariaLabel },
|
16627 | children,
|
16628 | hasSeparator && React__namespace.createElement(Divider, { component: "li", role: "separator" }))));
|
16629 | };
|
16630 | OptionsMenuItemGroup.displayName = 'OptionsMenuItemGroup';
|
16631 |
|
16632 | const OptionsMenuItem = (_a) => {
|
16633 | var { children = null, isSelected = false, onSelect = () => null, id = '', isDisabled } = _a, props = __rest$1(_a, ["children", "isSelected", "onSelect", "id", "isDisabled"]);
|
16634 | return (React__namespace.createElement(DropdownItem, Object.assign({ id: id, component: "button", isDisabled: isDisabled, onClick: (event) => onSelect(event) }, (isDisabled && { 'aria-disabled': true }), props),
|
16635 | children,
|
16636 | isSelected && (React__namespace.createElement("span", { className: css(styles$s.optionsMenuMenuItemIcon) },
|
16637 | React__namespace.createElement(CheckIcon$1, { "aria-hidden": isSelected })))));
|
16638 | };
|
16639 | OptionsMenuItem.displayName = 'OptionsMenuItem';
|
16640 |
|
16641 | const OptionsMenuSeparator = (_a) => {
|
16642 | var { component = 'li' } = _a, props = __rest$1(_a, ["component"]);
|
16643 | return React__namespace.createElement(Divider, Object.assign({ component: component }, props));
|
16644 | };
|
16645 | OptionsMenuSeparator.displayName = 'OptionsMenuSeparator';
|
16646 |
|
16647 | const OptionsMenuToggleWithText = (_a) => {
|
16648 | var { parentId = '', toggleText, toggleTextClassName = '', toggleButtonContents, toggleButtonContentsClassName = '', onToggle = () => null, isOpen = false, isPlain = false,
|
16649 |
|
16650 | isText = true, isDisabled = false,
|
16651 |
|
16652 | isActive = false, 'aria-haspopup': ariaHasPopup, parentRef,
|
16653 |
|
16654 | getMenuRef, onEnter,
|
16655 |
|
16656 | 'aria-label': ariaLabel = 'Options menu' } = _a, props = __rest$1(_a, ["parentId", "toggleText", "toggleTextClassName", "toggleButtonContents", "toggleButtonContentsClassName", "onToggle", "isOpen", "isPlain", "isText", "isDisabled", "isActive", 'aria-haspopup', "parentRef", "getMenuRef", "onEnter", 'aria-label']);
|
16657 | const buttonRef = React__namespace.useRef();
|
16658 | React__namespace.useEffect(() => {
|
16659 | document.addEventListener('mousedown', onDocClick);
|
16660 | document.addEventListener('touchstart', onDocClick);
|
16661 | document.addEventListener('keydown', onEscPress);
|
16662 | return () => {
|
16663 | document.removeEventListener('mousedown', onDocClick);
|
16664 | document.removeEventListener('touchstart', onDocClick);
|
16665 | document.removeEventListener('keydown', onEscPress);
|
16666 | };
|
16667 | });
|
16668 | const onDocClick = (event) => {
|
16669 | if (isOpen && parentRef && parentRef.current && !parentRef.current.contains(event.target)) {
|
16670 | onToggle(false);
|
16671 | buttonRef.current.focus();
|
16672 | }
|
16673 | };
|
16674 | const onKeyDown = (event) => {
|
16675 | if (event.key === 'Tab' && !isOpen) {
|
16676 | return;
|
16677 | }
|
16678 | event.preventDefault();
|
16679 | if ((event.key === 'Enter' || event.key === ' ') && isOpen) {
|
16680 | onToggle(!isOpen);
|
16681 | }
|
16682 | else if ((event.key === 'Enter' || event.key === ' ') && !isOpen) {
|
16683 | onToggle(!isOpen);
|
16684 | onEnter(event);
|
16685 | }
|
16686 | };
|
16687 | const onEscPress = (event) => {
|
16688 | const keyCode = event.keyCode || event.which;
|
16689 | if (isOpen &&
|
16690 | (keyCode === KEY_CODES.ESCAPE_KEY || event.key === 'Tab') &&
|
16691 | parentRef &&
|
16692 | parentRef.current &&
|
16693 | parentRef.current.contains(event.target)) {
|
16694 | onToggle(false);
|
16695 | buttonRef.current.focus();
|
16696 | }
|
16697 | };
|
16698 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$s.optionsMenuToggle, styles$s.modifiers.text, isPlain && styles$s.modifiers.plain, isDisabled && styles$s.modifiers.disabled, isActive && styles$s.modifiers.active) }, props),
|
16699 | React__namespace.createElement("span", { className: css(styles$s.optionsMenuToggleText, toggleTextClassName) }, toggleText),
|
16700 | React__namespace.createElement("button", { className: css(styles$s.optionsMenuToggleButton, toggleButtonContentsClassName), id: `${parentId}-toggle`, "aria-haspopup": "listbox", "aria-label": ariaLabel, "aria-expanded": isOpen, ref: buttonRef, disabled: isDisabled, onClick: () => onToggle(!isOpen), onKeyDown: onKeyDown },
|
16701 | React__namespace.createElement("span", { className: css(styles$s.optionsMenuToggleButtonIcon) }, toggleButtonContents))));
|
16702 | };
|
16703 | OptionsMenuToggleWithText.displayName = 'OptionsMenuToggleWithText';
|
16704 |
|
16705 | Promise.resolve().then(function () { return overflowMenu; });
|
16706 | var styles$r = {
|
16707 | "divider": "pf-c-divider",
|
16708 | "modifiers": {
|
16709 | "buttonGroup": "pf-m-button-group",
|
16710 | "iconButtonGroup": "pf-m-icon-button-group",
|
16711 | "vertical": "pf-m-vertical"
|
16712 | },
|
16713 | "overflowMenu": "pf-c-overflow-menu",
|
16714 | "overflowMenuContent": "pf-c-overflow-menu__content",
|
16715 | "overflowMenuControl": "pf-c-overflow-menu__control",
|
16716 | "overflowMenuGroup": "pf-c-overflow-menu__group",
|
16717 | "overflowMenuItem": "pf-c-overflow-menu__item"
|
16718 | };
|
16719 |
|
16720 | const OverflowMenuContext = React__namespace.createContext({
|
16721 | isBelowBreakpoint: false
|
16722 | });
|
16723 |
|
16724 | const global_breakpoint_md = {
|
16725 | "name": "--pf-global--breakpoint--md",
|
16726 | "value": "768px",
|
16727 | "var": "var(--pf-global--breakpoint--md)"
|
16728 | };
|
16729 | var globalBreakpointMd = global_breakpoint_md;
|
16730 |
|
16731 | const global_breakpoint_lg = {
|
16732 | "name": "--pf-global--breakpoint--lg",
|
16733 | "value": "992px",
|
16734 | "var": "var(--pf-global--breakpoint--lg)"
|
16735 | };
|
16736 | var globalBreakpointLg = global_breakpoint_lg;
|
16737 |
|
16738 | const global_breakpoint_2xl = {
|
16739 | "name": "--pf-global--breakpoint--2xl",
|
16740 | "value": "1450px",
|
16741 | "var": "var(--pf-global--breakpoint--2xl)"
|
16742 | };
|
16743 | var globalBreakpoint2xl = global_breakpoint_2xl;
|
16744 |
|
16745 | const breakpoints = {
|
16746 | md: globalBreakpointMd,
|
16747 | lg: globalBreakpointLg,
|
16748 | xl: globalBreakpointXl,
|
16749 | '2xl': globalBreakpoint2xl
|
16750 | };
|
16751 | class OverflowMenu extends React__namespace.Component {
|
16752 | constructor(props) {
|
16753 | super(props);
|
16754 | this.handleResize = () => {
|
16755 | const breakpointPx = breakpoints[this.props.breakpoint];
|
16756 | if (!breakpointPx) {
|
16757 |
|
16758 | console.error('OverflowMenu will not be visible without a valid breakpoint.');
|
16759 | return;
|
16760 | }
|
16761 | const breakpointWidth = Number(breakpointPx.value.replace('px', ''));
|
16762 | const isBelowBreakpoint = window.innerWidth < breakpointWidth;
|
16763 | this.setState({ isBelowBreakpoint });
|
16764 | };
|
16765 | this.state = {
|
16766 | isBelowBreakpoint: false
|
16767 | };
|
16768 | }
|
16769 | componentDidMount() {
|
16770 | this.handleResize();
|
16771 | if (canUseDOM) {
|
16772 | window.addEventListener('resize', debounce$1(this.handleResize, 250));
|
16773 | }
|
16774 | }
|
16775 | componentWillUnmount() {
|
16776 | if (canUseDOM) {
|
16777 | window.removeEventListener('resize', debounce$1(this.handleResize, 250));
|
16778 | }
|
16779 | }
|
16780 | render() {
|
16781 |
|
16782 | const _a = this.props, { className, breakpoint, children } = _a, props = __rest$1(_a, ["className", "breakpoint", "children"]);
|
16783 | return (React__namespace.createElement("div", Object.assign({}, props, { className: css(styles$r.overflowMenu, className) }),
|
16784 | React__namespace.createElement(OverflowMenuContext.Provider, { value: { isBelowBreakpoint: this.state.isBelowBreakpoint } }, children)));
|
16785 | }
|
16786 | }
|
16787 | OverflowMenu.displayName = 'OverflowMenu';
|
16788 | OverflowMenu.contextType = OverflowMenuContext;
|
16789 |
|
16790 | const OverflowMenuControl = (_a) => {
|
16791 | var { className, children, hasAdditionalOptions } = _a, props = __rest$1(_a, ["className", "children", "hasAdditionalOptions"]);
|
16792 | return (React__namespace.createElement(OverflowMenuContext.Consumer, null, value => (value.isBelowBreakpoint || hasAdditionalOptions) && (React__namespace.createElement("div", Object.assign({ className: css(styles$r.overflowMenuControl, className) }, props),
|
16793 | ' ',
|
16794 | children,
|
16795 | ' '))));
|
16796 | };
|
16797 | OverflowMenuControl.displayName = 'OverflowMenuControl';
|
16798 |
|
16799 | const OverflowMenuContent = ({ className, children, isPersistent }) => (React__namespace.createElement(OverflowMenuContext.Consumer, null, value => (!value.isBelowBreakpoint || isPersistent) && (React__namespace.createElement("div", { className: css(styles$r.overflowMenuContent, className) }, children))));
|
16800 | OverflowMenuContent.displayName = 'OverflowMenuContent';
|
16801 |
|
16802 | const OverflowMenuGroup = (_a) => {
|
16803 | var { className, children, isPersistent = false, groupType } = _a, props = __rest$1(_a, ["className", "children", "isPersistent", "groupType"]);
|
16804 | return (React__namespace.createElement(OverflowMenuContext.Consumer, null, value => (isPersistent || !value.isBelowBreakpoint) && (React__namespace.createElement("div", Object.assign({ className: css(styles$r.overflowMenuGroup, groupType === 'button' && styles$r.modifiers.buttonGroup, groupType === 'icon' && styles$r.modifiers.iconButtonGroup, className) }, props), children))));
|
16805 | };
|
16806 | OverflowMenuGroup.displayName = 'OverflowMenuGroup';
|
16807 |
|
16808 | const OverflowMenuItem = ({ className, children, isPersistent = false }) => (React__namespace.createElement(OverflowMenuContext.Consumer, null, value => (isPersistent || !value.isBelowBreakpoint) && (React__namespace.createElement("div", { className: css(styles$r.overflowMenuItem, className) },
|
16809 | " ",
|
16810 | children,
|
16811 | " "))));
|
16812 | OverflowMenuItem.displayName = 'OverflowMenuItem';
|
16813 |
|
16814 | const OverflowMenuDropdownItem = (_a) => {
|
16815 | var { children, isShared = false, index } = _a, additionalProps = __rest$1(_a, ["children", "isShared", "index"]);
|
16816 | return (React__namespace.createElement(OverflowMenuContext.Consumer, null, value => (!isShared || value.isBelowBreakpoint) && (React__namespace.createElement(DropdownItem, Object.assign({ component: "button", index: index }, additionalProps), children))));
|
16817 | };
|
16818 | OverflowMenuDropdownItem.displayName = 'OverflowMenuDropdownItem';
|
16819 |
|
16820 | const PageBreadcrumb = (_a) => {
|
16821 | var { className = '', children, isWidthLimited, sticky, hasShadowTop = false, hasShadowBottom = false, hasOverflowScroll = false } = _a, props = __rest$1(_a, ["className", "children", "isWidthLimited", "sticky", "hasShadowTop", "hasShadowBottom", "hasOverflowScroll"]);
|
16822 | return (React__namespace.createElement("section", Object.assign({ className: css(styles$z.pageMainBreadcrumb, isWidthLimited && styles$z.modifiers.limitWidth, sticky === 'top' && styles$z.modifiers.stickyTop, sticky === 'bottom' && styles$z.modifiers.stickyBottom, hasShadowTop && styles$z.modifiers.shadowTop, hasShadowBottom && styles$z.modifiers.shadowBottom, hasOverflowScroll && styles$z.modifiers.overflowScroll, className) }, (hasOverflowScroll && { tabIndex: 0 }), props),
|
16823 | isWidthLimited && React__namespace.createElement("div", { className: css(styles$z.pageMainBody) }, children),
|
16824 | !isWidthLimited && children));
|
16825 | };
|
16826 | PageBreadcrumb.displayName = 'PageBreadcrumb';
|
16827 |
|
16828 | const BarsIconConfig = {
|
16829 | name: 'BarsIcon',
|
16830 | height: 512,
|
16831 | width: 448,
|
16832 | svgPath: 'M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z',
|
16833 | yOffset: 0,
|
16834 | xOffset: 0,
|
16835 | };
|
16836 |
|
16837 | const BarsIcon = createIcon(BarsIconConfig);
|
16838 |
|
16839 | var BarsIcon$1 = BarsIcon;
|
16840 |
|
16841 | const PageHeader = (_a) => {
|
16842 | var { className = '', logo = null, logoProps = null, logoComponent = 'a', headerTools = null, topNav = null, isNavOpen = true, isManagedSidebar: deprecatedIsManagedSidebar = undefined, role = undefined, showNavToggle = false, onNavToggle = () => undefined, 'aria-label': ariaLabel = 'Global navigation', 'aria-controls': ariaControls = null } = _a, props = __rest$1(_a, ["className", "logo", "logoProps", "logoComponent", "headerTools", "topNav", "isNavOpen", "isManagedSidebar", "role", "showNavToggle", "onNavToggle", 'aria-label', 'aria-controls']);
|
16843 | const LogoComponent = logoComponent;
|
16844 | if ([false, true].includes(deprecatedIsManagedSidebar)) {
|
16845 | console.warn('isManagedSidebar is deprecated in the PageHeader component. To make the sidebar toggle uncontrolled, pass this prop in the Page component');
|
16846 | }
|
16847 | return (React__namespace.createElement(PageContextConsumer, null, ({ isManagedSidebar, onNavToggle: managedOnNavToggle, isNavOpen: managedIsNavOpen }) => {
|
16848 | const navToggle = isManagedSidebar ? managedOnNavToggle : onNavToggle;
|
16849 | const navOpen = isManagedSidebar ? managedIsNavOpen : isNavOpen;
|
16850 | return (React__namespace.createElement("header", Object.assign({ role: role, className: css(styles$z.pageHeader, className) }, props),
|
16851 | (showNavToggle || logo) && (React__namespace.createElement("div", { className: css(styles$z.pageHeaderBrand) },
|
16852 | showNavToggle && (React__namespace.createElement("div", { className: css(styles$z.pageHeaderBrandToggle) },
|
16853 | React__namespace.createElement(Button, { id: "nav-toggle", onClick: navToggle, "aria-label": ariaLabel, "aria-controls": ariaControls, "aria-expanded": navOpen ? 'true' : 'false', variant: exports.ButtonVariant.plain },
|
16854 | React__namespace.createElement(BarsIcon$1, null)))),
|
16855 | logo && (React__namespace.createElement(LogoComponent, Object.assign({ className: css(styles$z.pageHeaderBrandLink) }, logoProps), logo)))),
|
16856 | topNav && React__namespace.createElement("div", { className: css(styles$z.pageHeaderNav) }, topNav),
|
16857 | headerTools));
|
16858 | }));
|
16859 | };
|
16860 | PageHeader.displayName = 'PageHeader';
|
16861 |
|
16862 | exports.PageSectionVariants = void 0;
|
16863 | (function (PageSectionVariants) {
|
16864 | PageSectionVariants["default"] = "default";
|
16865 | PageSectionVariants["light"] = "light";
|
16866 | PageSectionVariants["dark"] = "dark";
|
16867 | PageSectionVariants["darker"] = "darker";
|
16868 | })(exports.PageSectionVariants || (exports.PageSectionVariants = {}));
|
16869 | exports.PageSectionTypes = void 0;
|
16870 | (function (PageSectionTypes) {
|
16871 | PageSectionTypes["default"] = "default";
|
16872 | PageSectionTypes["nav"] = "nav";
|
16873 | PageSectionTypes["subNav"] = "subnav";
|
16874 | PageSectionTypes["breadcrumb"] = "breadcrumb";
|
16875 | PageSectionTypes["tabs"] = "tabs";
|
16876 | PageSectionTypes["wizard"] = "wizard";
|
16877 | })(exports.PageSectionTypes || (exports.PageSectionTypes = {}));
|
16878 | const variantType = {
|
16879 | [exports.PageSectionTypes.default]: styles$z.pageMainSection,
|
16880 | [exports.PageSectionTypes.nav]: styles$z.pageMainNav,
|
16881 | [exports.PageSectionTypes.subNav]: styles$z.pageMainSubnav,
|
16882 | [exports.PageSectionTypes.breadcrumb]: styles$z.pageMainBreadcrumb,
|
16883 | [exports.PageSectionTypes.tabs]: styles$z.pageMainTabs,
|
16884 | [exports.PageSectionTypes.wizard]: styles$z.pageMainWizard
|
16885 | };
|
16886 | const variantStyle$3 = {
|
16887 | [exports.PageSectionVariants.default]: '',
|
16888 | [exports.PageSectionVariants.light]: styles$z.modifiers.light,
|
16889 | [exports.PageSectionVariants.dark]: styles$z.modifiers.dark_200,
|
16890 | [exports.PageSectionVariants.darker]: styles$z.modifiers.dark_100
|
16891 | };
|
16892 | const PageSection = (_a) => {
|
16893 | var { className = '', children, variant = 'default', type = 'default', padding, isFilled, isWidthLimited = false, isCenterAligned = false, sticky, hasShadowTop = false, hasShadowBottom = false, hasOverflowScroll = false } = _a, props = __rest$1(_a, ["className", "children", "variant", "type", "padding", "isFilled", "isWidthLimited", "isCenterAligned", "sticky", "hasShadowTop", "hasShadowBottom", "hasOverflowScroll"]);
|
16894 | return (React__namespace.createElement("section", Object.assign({}, props, { className: css(variantType[type], formatBreakpointMods(padding, styles$z), variantStyle$3[variant], isFilled === false && styles$z.modifiers.noFill, isFilled === true && styles$z.modifiers.fill, isWidthLimited && styles$z.modifiers.limitWidth, isWidthLimited && isCenterAligned && type !== exports.PageSectionTypes.subNav && styles$z.modifiers.alignCenter, sticky === 'top' && styles$z.modifiers.stickyTop, sticky === 'bottom' && styles$z.modifiers.stickyBottom, hasShadowTop && styles$z.modifiers.shadowTop, hasShadowBottom && styles$z.modifiers.shadowBottom, hasOverflowScroll && styles$z.modifiers.overflowScroll, className) }, (hasOverflowScroll && { tabIndex: 0 })),
|
16895 | isWidthLimited && React__namespace.createElement("div", { className: css(styles$z.pageMainBody) }, children),
|
16896 | !isWidthLimited && children));
|
16897 | };
|
16898 | PageSection.displayName = 'PageSection';
|
16899 |
|
16900 | const PageHeaderTools = (_a) => {
|
16901 | var { children, className } = _a, props = __rest$1(_a, ["children", "className"]);
|
16902 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$z.pageHeaderTools, className) }, props), children));
|
16903 | };
|
16904 | PageHeaderTools.displayName = 'PageHeaderTools';
|
16905 |
|
16906 | const PageHeaderToolsGroup = (_a) => {
|
16907 | var { children, className, visibility } = _a, props = __rest$1(_a, ["children", "className", "visibility"]);
|
16908 | const { width, getBreakpoint } = React__namespace.useContext(PageContext);
|
16909 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$z.pageHeaderToolsGroup, formatBreakpointMods(visibility, styles$z, '', getBreakpoint(width)), className) }, props), children));
|
16910 | };
|
16911 | PageHeaderToolsGroup.displayName = 'PageHeaderToolsGroup';
|
16912 |
|
16913 | const PageHeaderToolsItem = (_a) => {
|
16914 | var { children, id, className, visibility, isSelected } = _a, props = __rest$1(_a, ["children", "id", "className", "visibility", "isSelected"]);
|
16915 | const { width, getBreakpoint } = React__namespace.useContext(PageContext);
|
16916 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$z.pageHeaderToolsItem, isSelected && styles$z.modifiers.selected, formatBreakpointMods(visibility, styles$z, '', getBreakpoint(width)), className), id: id }, props), children));
|
16917 | };
|
16918 | PageHeaderToolsItem.displayName = 'PageHeaderToolsItem';
|
16919 |
|
16920 | const PageNavigation = (_a) => {
|
16921 | var { className = '', children, isWidthLimited, sticky, hasShadowTop = false, hasShadowBottom = false, hasOverflowScroll = false } = _a, props = __rest$1(_a, ["className", "children", "isWidthLimited", "sticky", "hasShadowTop", "hasShadowBottom", "hasOverflowScroll"]);
|
16922 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$z.pageMainNav, isWidthLimited && styles$z.modifiers.limitWidth, sticky === 'top' && styles$z.modifiers.stickyTop, sticky === 'bottom' && styles$z.modifiers.stickyBottom, hasShadowTop && styles$z.modifiers.shadowTop, hasShadowBottom && styles$z.modifiers.shadowBottom, hasOverflowScroll && styles$z.modifiers.overflowScroll, className) }, (hasOverflowScroll && { tabIndex: 0 }), props),
|
16923 | isWidthLimited && React__namespace.createElement("div", { className: css(styles$z.pageMainBody) }, children),
|
16924 | !isWidthLimited && children));
|
16925 | };
|
16926 | PageNavigation.displayName = 'PageNavigation';
|
16927 |
|
16928 | const PageToggleButton = (_a) => {
|
16929 | var { children, isNavOpen = true, onNavToggle = () => undefined } = _a, props = __rest$1(_a, ["children", "isNavOpen", "onNavToggle"]);
|
16930 | return (React__namespace.createElement(PageContextConsumer, null, ({ isManagedSidebar, onNavToggle: managedOnNavToggle, isNavOpen: managedIsNavOpen }) => {
|
16931 | const navToggle = isManagedSidebar ? managedOnNavToggle : onNavToggle;
|
16932 | const navOpen = isManagedSidebar ? managedIsNavOpen : isNavOpen;
|
16933 | return (React__namespace.createElement(Button, Object.assign({ id: "nav-toggle", onClick: navToggle, "aria-label": "Side navigation toggle", "aria-expanded": navOpen ? 'true' : 'false', variant: exports.ButtonVariant.plain }, props), children));
|
16934 | }));
|
16935 | };
|
16936 | PageToggleButton.displayName = 'PageToggleButton';
|
16937 |
|
16938 | const ToggleTemplate = ({ firstIndex = 0, lastIndex = 0, itemCount = 0, itemsTitle = 'items', ofWord = 'of' }) => (React__namespace.createElement(React__namespace.Fragment, null,
|
16939 | React__namespace.createElement("b", null,
|
16940 | firstIndex,
|
16941 | " - ",
|
16942 | lastIndex),
|
16943 | ' ',
|
16944 | ofWord,
|
16945 | " ",
|
16946 | React__namespace.createElement("b", null, itemCount),
|
16947 | " ",
|
16948 | itemsTitle));
|
16949 | ToggleTemplate.displayName = 'ToggleTemplate';
|
16950 |
|
16951 | Promise.resolve().then(function () { return pagination; });
|
16952 | var styles$q = {
|
16953 | "button": "pf-c-button",
|
16954 | "formControl": "pf-c-form-control",
|
16955 | "modifiers": {
|
16956 | "bottom": "pf-m-bottom",
|
16957 | "static": "pf-m-static",
|
16958 | "first": "pf-m-first",
|
16959 | "last": "pf-m-last",
|
16960 | "sticky": "pf-m-sticky",
|
16961 | "compact": "pf-m-compact",
|
16962 | "displaySummary": "pf-m-display-summary",
|
16963 | "displayFull": "pf-m-display-full",
|
16964 | "displaySummaryOnSm": "pf-m-display-summary-on-sm",
|
16965 | "displayFullOnSm": "pf-m-display-full-on-sm",
|
16966 | "displaySummaryOnMd": "pf-m-display-summary-on-md",
|
16967 | "displayFullOnMd": "pf-m-display-full-on-md",
|
16968 | "displaySummaryOnLg": "pf-m-display-summary-on-lg",
|
16969 | "displayFullOnLg": "pf-m-display-full-on-lg",
|
16970 | "displaySummaryOnXl": "pf-m-display-summary-on-xl",
|
16971 | "displayFullOnXl": "pf-m-display-full-on-xl",
|
16972 | "displaySummaryOn_2xl": "pf-m-display-summary-on-2xl",
|
16973 | "displayFullOn_2xl": "pf-m-display-full-on-2xl"
|
16974 | },
|
16975 | "optionsMenu": "pf-c-options-menu",
|
16976 | "optionsMenuToggle": "pf-c-options-menu__toggle",
|
16977 | "pagination": "pf-c-pagination",
|
16978 | "paginationNav": "pf-c-pagination__nav",
|
16979 | "paginationNavControl": "pf-c-pagination__nav-control",
|
16980 | "paginationNavPageSelect": "pf-c-pagination__nav-page-select",
|
16981 | "paginationTotalItems": "pf-c-pagination__total-items"
|
16982 | };
|
16983 |
|
16984 | class Navigation extends React__namespace.Component {
|
16985 | constructor(props) {
|
16986 | super(props);
|
16987 | this.handleNewPage = (_evt, newPage) => {
|
16988 | const { perPage, onSetPage } = this.props;
|
16989 | const startIdx = (newPage - 1) * perPage;
|
16990 | const endIdx = newPage * perPage;
|
16991 | return onSetPage(_evt, newPage, perPage, startIdx, endIdx);
|
16992 | };
|
16993 | this.state = { userInputPage: this.props.page };
|
16994 | }
|
16995 | static parseInteger(input, lastPage) {
|
16996 |
|
16997 | let inputPage = Number.parseInt(input, 10);
|
16998 | if (!Number.isNaN(inputPage)) {
|
16999 | inputPage = inputPage > lastPage ? lastPage : inputPage;
|
17000 | inputPage = inputPage < 1 ? 1 : inputPage;
|
17001 | }
|
17002 | return inputPage;
|
17003 | }
|
17004 | onChange(event, lastPage) {
|
17005 | const inputPage = Navigation.parseInteger(event.target.value, lastPage);
|
17006 | this.setState({ userInputPage: Number.isNaN(inputPage) ? event.target.value : inputPage });
|
17007 | }
|
17008 | onKeyDown(event, page, lastPage, onPageInput) {
|
17009 | if (event.keyCode === KEY_CODES.ENTER) {
|
17010 | const inputPage = Navigation.parseInteger(this.state.userInputPage, lastPage);
|
17011 | onPageInput(event, Number.isNaN(inputPage) ? page : inputPage);
|
17012 | this.handleNewPage(event, Number.isNaN(inputPage) ? page : inputPage);
|
17013 | }
|
17014 | }
|
17015 | componentDidUpdate(lastState) {
|
17016 | if (this.props.page !== lastState.page &&
|
17017 | this.props.page <= this.props.lastPage &&
|
17018 | this.state.userInputPage !== this.props.page) {
|
17019 | this.setState({ userInputPage: this.props.page });
|
17020 | }
|
17021 | }
|
17022 | render() {
|
17023 | const _a = this.props, { page,
|
17024 |
|
17025 | perPage,
|
17026 |
|
17027 | onSetPage, isDisabled, itemCount, lastPage, firstPage, pagesTitle, pagesTitlePlural, toLastPage, toNextPage, toFirstPage, toPreviousPage, currPage, paginationTitle, ofWord, onNextClick, onPreviousClick, onFirstClick, onLastClick, onPageInput, className, isCompact } = _a, props = __rest$1(_a, ["page", "perPage", "onSetPage", "isDisabled", "itemCount", "lastPage", "firstPage", "pagesTitle", "pagesTitlePlural", "toLastPage", "toNextPage", "toFirstPage", "toPreviousPage", "currPage", "paginationTitle", "ofWord", "onNextClick", "onPreviousClick", "onFirstClick", "onLastClick", "onPageInput", "className", "isCompact"]);
|
17028 | const { userInputPage } = this.state;
|
17029 | return (React__namespace.createElement("nav", Object.assign({ className: css(styles$q.paginationNav, className), "aria-label": paginationTitle }, props),
|
17030 | !isCompact && (React__namespace.createElement("div", { className: css(styles$q.paginationNavControl, styles$q.modifiers.first) },
|
17031 | React__namespace.createElement(Button, { variant: exports.ButtonVariant.plain, isDisabled: isDisabled || page === firstPage || page === 0, "aria-label": toFirstPage, "data-action": "first", onClick: event => {
|
17032 | onFirstClick(event, 1);
|
17033 | this.handleNewPage(event, 1);
|
17034 | this.setState({ userInputPage: 1 });
|
17035 | } },
|
17036 | React__namespace.createElement(AngleDoubleLeftIcon$1, null)))),
|
17037 | React__namespace.createElement("div", { className: styles$q.paginationNavControl },
|
17038 | React__namespace.createElement(Button, { variant: exports.ButtonVariant.plain, isDisabled: isDisabled || page === firstPage || page === 0, "data-action": "previous", onClick: event => {
|
17039 | const newPage = page - 1 >= 1 ? page - 1 : 1;
|
17040 | onPreviousClick(event, newPage);
|
17041 | this.handleNewPage(event, newPage);
|
17042 | this.setState({ userInputPage: newPage });
|
17043 | }, "aria-label": toPreviousPage },
|
17044 | React__namespace.createElement(AngleLeftIcon$1, null))),
|
17045 | !isCompact && (React__namespace.createElement("div", { className: styles$q.paginationNavPageSelect },
|
17046 | React__namespace.createElement("input", { className: css(styles$q.formControl), "aria-label": currPage, type: "number", disabled: isDisabled || (itemCount && page === firstPage && page === lastPage && itemCount >= 0) || page === 0, min: lastPage <= 0 && firstPage <= 0 ? 0 : 1, max: lastPage, value: userInputPage, onKeyDown: event => this.onKeyDown(event, page, lastPage, onPageInput), onChange: event => this.onChange(event, lastPage) }),
|
17047 | (itemCount || itemCount === 0) && (React__namespace.createElement("span", { "aria-hidden": "true" },
|
17048 | ofWord,
|
17049 | " ",
|
17050 | pagesTitle ? pluralize(lastPage, pagesTitle, pagesTitlePlural) : lastPage)))),
|
17051 | React__namespace.createElement("div", { className: styles$q.paginationNavControl },
|
17052 | React__namespace.createElement(Button, { variant: exports.ButtonVariant.plain, isDisabled: isDisabled || page === lastPage, "aria-label": toNextPage, "data-action": "next", onClick: event => {
|
17053 | const newPage = page + 1 <= lastPage ? page + 1 : lastPage;
|
17054 | onNextClick(event, newPage);
|
17055 | this.handleNewPage(event, newPage);
|
17056 | this.setState({ userInputPage: newPage });
|
17057 | } },
|
17058 | React__namespace.createElement(AngleRightIcon$1, null))),
|
17059 | !isCompact && (React__namespace.createElement("div", { className: css(styles$q.paginationNavControl, styles$q.modifiers.last) },
|
17060 | React__namespace.createElement(Button, { variant: exports.ButtonVariant.plain, isDisabled: isDisabled || page === lastPage, "aria-label": toLastPage, "data-action": "last", onClick: event => {
|
17061 | onLastClick(event, lastPage);
|
17062 | this.handleNewPage(event, lastPage);
|
17063 | this.setState({ userInputPage: lastPage });
|
17064 | } },
|
17065 | React__namespace.createElement(AngleDoubleRightIcon$1, null))))));
|
17066 | }
|
17067 | }
|
17068 | Navigation.displayName = 'Navigation';
|
17069 | Navigation.defaultProps = {
|
17070 | className: '',
|
17071 | isDisabled: false,
|
17072 | isCompact: false,
|
17073 | lastPage: 0,
|
17074 | firstPage: 0,
|
17075 | pagesTitle: '',
|
17076 | pagesTitlePlural: '',
|
17077 | toLastPage: 'Go to last page',
|
17078 | toNextPage: 'Go to next page',
|
17079 | toFirstPage: 'Go to first page',
|
17080 | toPreviousPage: 'Go to previous page',
|
17081 | currPage: 'Current page',
|
17082 | paginationTitle: 'Pagination',
|
17083 | ofWord: 'of',
|
17084 | onNextClick: () => undefined,
|
17085 | onPreviousClick: () => undefined,
|
17086 | onFirstClick: () => undefined,
|
17087 | onLastClick: () => undefined,
|
17088 | onPageInput: () => undefined
|
17089 | };
|
17090 |
|
17091 | let toggleId = 0;
|
17092 | const OptionsToggle = ({ itemsTitle = 'items', optionsToggle,
|
17093 |
|
17094 | itemsPerPageTitle = 'Items per page', ofWord = 'of', firstIndex = 0, lastIndex = 0, itemCount, widgetId = '', showToggle = true,
|
17095 |
|
17096 | onToggle = (_isOpen) => undefined, isOpen = false, isDisabled = false, parentRef = null, toggleTemplate: ToggleTemplate, onEnter = null, perPageComponent = 'div' }) => {
|
17097 | const isDiv = perPageComponent === 'div';
|
17098 | const toggleClasses = css(styles$s.optionsMenuToggle, isDisabled && styles$s.modifiers.disabled, styles$s.modifiers.plain, styles$s.modifiers.text);
|
17099 | const template = typeof ToggleTemplate === 'string' ? (fillTemplate(ToggleTemplate, { firstIndex, lastIndex, ofWord, itemCount, itemsTitle })) : (React__namespace.createElement(ToggleTemplate, { firstIndex: firstIndex, lastIndex: lastIndex, ofWord: ofWord, itemCount: itemCount, itemsTitle: itemsTitle }));
|
17100 | const dropdown = showToggle && (React__namespace.createElement(React__namespace.Fragment, null,
|
17101 | isDiv && React__namespace.createElement("span", { className: css(styles$s.optionsMenuToggleText) }, template),
|
17102 | React__namespace.createElement(DropdownToggle, { onEnter: onEnter, "aria-label": isDiv ? optionsToggle || 'Items per page' : optionsToggle, onToggle: onToggle, isDisabled: isDisabled || (itemCount && itemCount <= 0), isOpen: isOpen, id: `${widgetId}-toggle-${toggleId++}`, className: isDiv ? styles$s.optionsMenuToggleButton : toggleClasses, parentRef: parentRef, "aria-haspopup": "listbox" }, !isDiv && template)));
|
17103 | return isDiv ? React__namespace.createElement("div", { className: toggleClasses }, dropdown) : dropdown;
|
17104 | };
|
17105 | OptionsToggle.displayName = 'OptionsToggle';
|
17106 |
|
17107 | class PaginationOptionsMenu extends React__namespace.Component {
|
17108 | constructor(props) {
|
17109 | super(props);
|
17110 | this.parentRef = React__namespace.createRef();
|
17111 | this.onToggle = (isOpen) => {
|
17112 | this.setState({ isOpen });
|
17113 | };
|
17114 | this.onSelect = () => {
|
17115 | this.setState((prevState) => ({ isOpen: !prevState.isOpen }));
|
17116 | };
|
17117 | this.handleNewPerPage = (_evt, newPerPage) => {
|
17118 | const { page, onPerPageSelect, itemCount, defaultToFullPage } = this.props;
|
17119 | let newPage = page;
|
17120 | while (Math.ceil(itemCount / newPerPage) < newPage) {
|
17121 | newPage--;
|
17122 | }
|
17123 | if (defaultToFullPage) {
|
17124 | if (itemCount / newPerPage !== newPage) {
|
17125 | while (newPage > 1 && itemCount - newPerPage * newPage < 0) {
|
17126 | newPage--;
|
17127 | }
|
17128 | }
|
17129 | }
|
17130 | const startIdx = (newPage - 1) * newPerPage;
|
17131 | const endIdx = newPage * newPerPage;
|
17132 | return onPerPageSelect(_evt, newPerPage, newPage, startIdx, endIdx);
|
17133 | };
|
17134 | this.renderItems = () => {
|
17135 | const { perPageOptions, perPage, perPageSuffix } = this.props;
|
17136 | return perPageOptions.map(({ value, title }) => (React__namespace.createElement(DropdownItem, { key: value, component: "button", "data-action": `per-page-${value}`, className: css(perPage === value && 'pf-m-selected'), onClick: event => this.handleNewPerPage(event, value) },
|
17137 | title,
|
17138 | ` ${perPageSuffix}`,
|
17139 | perPage === value && (React__namespace.createElement("div", { className: css(styles$s.optionsMenuMenuItemIcon) },
|
17140 | React__namespace.createElement(CheckIcon$1, null))))));
|
17141 | };
|
17142 | this.state = {
|
17143 | isOpen: false
|
17144 | };
|
17145 | }
|
17146 | render() {
|
17147 | const { widgetId, isDisabled, itemsPerPageTitle, dropDirection, optionsToggle, perPageOptions, toggleTemplate, firstIndex, lastIndex, itemCount, itemsTitle, ofWord, perPageComponent } = this.props;
|
17148 | const { isOpen } = this.state;
|
17149 | return (React__namespace.createElement(DropdownContext.Provider, { value: {
|
17150 | id: widgetId,
|
17151 | onSelect: this.onSelect,
|
17152 | toggleIndicatorClass: perPageComponent === 'div' ? styles$s.optionsMenuToggleButtonIcon : styles$s.optionsMenuToggleIcon,
|
17153 | toggleTextClass: styles$s.optionsMenuToggleText,
|
17154 | menuClass: styles$s.optionsMenuMenu,
|
17155 | itemClass: styles$s.optionsMenuMenuItem,
|
17156 | toggleClass: ' ',
|
17157 | baseClass: styles$s.optionsMenu,
|
17158 | disabledClass: styles$s.modifiers.disabled,
|
17159 | menuComponent: 'ul',
|
17160 | baseComponent: 'div',
|
17161 | ouiaComponentType: PaginationOptionsMenu.displayName
|
17162 | } },
|
17163 | React__namespace.createElement(DropdownWithContext, { direction: dropDirection, isOpen: isOpen, toggle: React__namespace.createElement(OptionsToggle, { optionsToggle: optionsToggle, itemsPerPageTitle: itemsPerPageTitle, showToggle: perPageOptions && perPageOptions.length > 0, onToggle: this.onToggle, isOpen: isOpen, widgetId: widgetId, firstIndex: firstIndex, lastIndex: lastIndex, itemCount: itemCount, itemsTitle: itemsTitle, ofWord: ofWord, toggleTemplate: toggleTemplate, parentRef: this.parentRef.current, isDisabled: isDisabled, perPageComponent: perPageComponent }), dropdownItems: this.renderItems(), isPlain: true })));
|
17164 | }
|
17165 | }
|
17166 | PaginationOptionsMenu.displayName = 'PaginationOptionsMenu';
|
17167 | PaginationOptionsMenu.defaultProps = {
|
17168 | className: '',
|
17169 | widgetId: '',
|
17170 | isDisabled: false,
|
17171 | dropDirection: exports.DropdownDirection.down,
|
17172 | perPageOptions: [],
|
17173 | itemsPerPageTitle: 'Items per page',
|
17174 | perPageSuffix: 'per page',
|
17175 | optionsToggle: '',
|
17176 | ofWord: 'of',
|
17177 | perPage: 0,
|
17178 | firstIndex: 0,
|
17179 | lastIndex: 0,
|
17180 | defaultToFullPage: false,
|
17181 | itemsTitle: 'items',
|
17182 | toggleTemplate: ToggleTemplate,
|
17183 | onPerPageSelect: () => null,
|
17184 | perPageComponent: 'div'
|
17185 | };
|
17186 |
|
17187 | const c_pagination__nav_page_select_c_form_control_width_chars = {
|
17188 | "name": "--pf-c-pagination__nav-page-select--c-form-control--width-chars",
|
17189 | "value": "2",
|
17190 | "var": "var(--pf-c-pagination__nav-page-select--c-form-control--width-chars)"
|
17191 | };
|
17192 | var widthChars = c_pagination__nav_page_select_c_form_control_width_chars;
|
17193 |
|
17194 | exports.PaginationVariant = void 0;
|
17195 | (function (PaginationVariant) {
|
17196 | PaginationVariant["top"] = "top";
|
17197 | PaginationVariant["bottom"] = "bottom";
|
17198 | })(exports.PaginationVariant || (exports.PaginationVariant = {}));
|
17199 | const defaultPerPageOptions = [
|
17200 | {
|
17201 | title: '10',
|
17202 | value: 10
|
17203 | },
|
17204 | {
|
17205 | title: '20',
|
17206 | value: 20
|
17207 | },
|
17208 | {
|
17209 | title: '50',
|
17210 | value: 50
|
17211 | },
|
17212 | {
|
17213 | title: '100',
|
17214 | value: 100
|
17215 | }
|
17216 | ];
|
17217 | const handleInputWidth = (lastPage, node) => {
|
17218 | if (!node) {
|
17219 | return;
|
17220 | }
|
17221 | const len = String(lastPage).length;
|
17222 | if (len >= 3) {
|
17223 | node.style.setProperty(widthChars.name, `${len}`);
|
17224 | }
|
17225 | else {
|
17226 | node.style.setProperty(widthChars.name, '2');
|
17227 | }
|
17228 | };
|
17229 | let paginationId = 0;
|
17230 | class Pagination extends React__namespace.Component {
|
17231 | constructor() {
|
17232 | super(...arguments);
|
17233 | this.paginationRef = React__namespace.createRef();
|
17234 | this.state = {
|
17235 | ouiaStateId: getDefaultOUIAId(Pagination.displayName, this.props.variant)
|
17236 | };
|
17237 | }
|
17238 | getLastPage() {
|
17239 | const { itemCount, perPage, page } = this.props;
|
17240 |
|
17241 | return itemCount || itemCount === 0 ? Math.ceil(itemCount / perPage) || 0 : page + 1;
|
17242 | }
|
17243 | componentDidMount() {
|
17244 | const node = this.paginationRef.current;
|
17245 | handleInputWidth(this.getLastPage(), node);
|
17246 | }
|
17247 | componentDidUpdate(prevProps) {
|
17248 | const node = this.paginationRef.current;
|
17249 | if (prevProps.perPage !== this.props.perPage || prevProps.itemCount !== this.props.itemCount) {
|
17250 | handleInputWidth(this.getLastPage(), node);
|
17251 | }
|
17252 | }
|
17253 | render() {
|
17254 | const _a = this.props, { children, className, variant, isDisabled, isCompact, isStatic, isSticky, perPage, titles, firstPage, page: propPage, offset, defaultToFullPage, itemCount, itemsStart, itemsEnd, perPageOptions, dropDirection: dropDirectionProp, widgetId, toggleTemplate, onSetPage, onPerPageSelect, onFirstClick, onPreviousClick, onNextClick, onPageInput, onLastClick, ouiaId, ouiaSafe, perPageComponent } = _a, props = __rest$1(_a, ["children", "className", "variant", "isDisabled", "isCompact", "isStatic", "isSticky", "perPage", "titles", "firstPage", "page", "offset", "defaultToFullPage", "itemCount", "itemsStart", "itemsEnd", "perPageOptions", "dropDirection", "widgetId", "toggleTemplate", "onSetPage", "onPerPageSelect", "onFirstClick", "onPreviousClick", "onNextClick", "onPageInput", "onLastClick", "ouiaId", "ouiaSafe", "perPageComponent"]);
|
17255 | const dropDirection = dropDirectionProp || (variant === 'bottom' && !isStatic ? 'up' : 'down');
|
17256 | let page = propPage;
|
17257 | if (!page && offset) {
|
17258 | page = Math.ceil(offset / perPage);
|
17259 | }
|
17260 | if (page === 0 && !itemCount) {
|
17261 | page = 1;
|
17262 | }
|
17263 | const lastPage = this.getLastPage();
|
17264 | let firstIndex = (page - 1) * perPage + 1;
|
17265 | let lastIndex = page * perPage;
|
17266 | if (itemCount || itemCount === 0) {
|
17267 | firstIndex = itemCount <= 0 ? 0 : (page - 1) * perPage + 1;
|
17268 | if (page < firstPage && itemCount > 0) {
|
17269 | page = firstPage;
|
17270 | }
|
17271 | else if (page > lastPage) {
|
17272 | page = lastPage;
|
17273 | }
|
17274 | if (itemCount >= 0) {
|
17275 | lastIndex = page === lastPage || itemCount === 0 ? itemCount : page * perPage;
|
17276 | }
|
17277 | }
|
17278 | const toggleTemplateProps = { firstIndex, lastIndex, itemCount, itemsTitle: titles.items, ofWord: titles.ofWord };
|
17279 | return (React__namespace.createElement("div", Object.assign({ ref: this.paginationRef, className: css(styles$q.pagination, variant === exports.PaginationVariant.bottom && styles$q.modifiers.bottom, isCompact && styles$q.modifiers.compact, isStatic && styles$q.modifiers.static, isSticky && styles$q.modifiers.sticky, className), id: `${widgetId}-${paginationId++}` }, getOUIAProps(Pagination.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId, ouiaSafe), props),
|
17280 | variant === exports.PaginationVariant.top && (React__namespace.createElement("div", { className: css(styles$q.paginationTotalItems) },
|
17281 | toggleTemplate && typeof toggleTemplate === 'string' && fillTemplate(toggleTemplate, toggleTemplateProps),
|
17282 | toggleTemplate &&
|
17283 | typeof toggleTemplate !== 'string' &&
|
17284 | toggleTemplate(toggleTemplateProps),
|
17285 | !toggleTemplate && (React__namespace.createElement(ToggleTemplate, { firstIndex: firstIndex, lastIndex: lastIndex, itemCount: itemCount, itemsTitle: titles.items, ofWord: titles.ofWord })))),
|
17286 | React__namespace.createElement(PaginationOptionsMenu, { itemsPerPageTitle: titles.itemsPerPage, perPageSuffix: titles.perPageSuffix, itemsTitle: isCompact ? '' : titles.items, optionsToggle: titles.optionsToggle, perPageOptions: perPageOptions, firstIndex: itemsStart !== null ? itemsStart : firstIndex, lastIndex: itemsEnd !== null ? itemsEnd : lastIndex, ofWord: titles.ofWord, defaultToFullPage: defaultToFullPage, itemCount: itemCount, page: page, perPage: perPage, lastPage: lastPage, onPerPageSelect: onPerPageSelect, dropDirection: dropDirection, widgetId: widgetId, toggleTemplate: toggleTemplate, isDisabled: isDisabled, perPageComponent: perPageComponent }),
|
17287 | React__namespace.createElement(Navigation, { pagesTitle: titles.page, pagesTitlePlural: titles.pages, toLastPage: titles.toLastPage, toPreviousPage: titles.toPreviousPage, toNextPage: titles.toNextPage, toFirstPage: titles.toFirstPage, currPage: titles.currPage, paginationTitle: titles.paginationTitle, ofWord: titles.ofWord, page: itemCount && itemCount <= 0 ? 0 : page, perPage: perPage, itemCount: itemCount, firstPage: itemsStart !== null ? itemsStart : 1, lastPage: lastPage, onSetPage: onSetPage, onFirstClick: onFirstClick, onPreviousClick: onPreviousClick, onNextClick: onNextClick, onLastClick: onLastClick, onPageInput: onPageInput, isDisabled: isDisabled, isCompact: isCompact }),
|
17288 | children));
|
17289 | }
|
17290 | }
|
17291 | Pagination.displayName = 'Pagination';
|
17292 | Pagination.defaultProps = {
|
17293 | children: null,
|
17294 | className: '',
|
17295 | variant: exports.PaginationVariant.top,
|
17296 | isDisabled: false,
|
17297 | isCompact: false,
|
17298 | isSticky: false,
|
17299 | perPage: defaultPerPageOptions[0].value,
|
17300 | titles: {
|
17301 | items: '',
|
17302 | page: '',
|
17303 | pages: '',
|
17304 | itemsPerPage: 'Items per page',
|
17305 | perPageSuffix: 'per page',
|
17306 | toFirstPage: 'Go to first page',
|
17307 | toPreviousPage: 'Go to previous page',
|
17308 | toLastPage: 'Go to last page',
|
17309 | toNextPage: 'Go to next page',
|
17310 | optionsToggle: '',
|
17311 | currPage: 'Current page',
|
17312 | paginationTitle: 'Pagination',
|
17313 | ofWord: 'of'
|
17314 | },
|
17315 | firstPage: 1,
|
17316 | page: 0,
|
17317 | offset: 0,
|
17318 | defaultToFullPage: false,
|
17319 | itemsStart: null,
|
17320 | itemsEnd: null,
|
17321 | perPageOptions: defaultPerPageOptions,
|
17322 | widgetId: 'pagination-options-menu',
|
17323 | onSetPage: () => undefined,
|
17324 | onPerPageSelect: () => undefined,
|
17325 | onFirstClick: () => undefined,
|
17326 | onPreviousClick: () => undefined,
|
17327 | onNextClick: () => undefined,
|
17328 | onPageInput: () => undefined,
|
17329 | onLastClick: () => undefined,
|
17330 | ouiaSafe: true,
|
17331 | perPageComponent: 'div'
|
17332 | };
|
17333 |
|
17334 | Promise.resolve().then(function () { return progressStepper; });
|
17335 | var styles$p = {
|
17336 | "faExclamationTriangle": "fa-exclamation-triangle",
|
17337 | "modifiers": {
|
17338 | "center": "pf-m-center",
|
17339 | "vertical": "pf-m-vertical",
|
17340 | "compact": "pf-m-compact",
|
17341 | "current": "pf-m-current",
|
17342 | "pending": "pf-m-pending",
|
17343 | "success": "pf-m-success",
|
17344 | "danger": "pf-m-danger",
|
17345 | "warning": "pf-m-warning",
|
17346 | "info": "pf-m-info",
|
17347 | "helpText": "pf-m-help-text"
|
17348 | },
|
17349 | "pficon": "pficon",
|
17350 | "progressStepper": "pf-c-progress-stepper",
|
17351 | "progressStepperStep": "pf-c-progress-stepper__step",
|
17352 | "progressStepperStepConnector": "pf-c-progress-stepper__step-connector",
|
17353 | "progressStepperStepDescription": "pf-c-progress-stepper__step-description",
|
17354 | "progressStepperStepIcon": "pf-c-progress-stepper__step-icon",
|
17355 | "progressStepperStepMain": "pf-c-progress-stepper__step-main",
|
17356 | "progressStepperStepTitle": "pf-c-progress-stepper__step-title"
|
17357 | };
|
17358 |
|
17359 | const ProgressStepper = (_a) => {
|
17360 | var { children, className, isCenterAligned, isVertical, isCompact } = _a, props = __rest$1(_a, ["children", "className", "isCenterAligned", "isVertical", "isCompact"]);
|
17361 | return (React__namespace.createElement("ol", Object.assign({ className: css(styles$p.progressStepper, isCenterAligned && styles$p.modifiers.center, isVertical && styles$p.modifiers.vertical, isCompact && styles$p.modifiers.compact, className) }, props), children));
|
17362 | };
|
17363 | ProgressStepper.displayName = 'ProgressStepper';
|
17364 |
|
17365 | const ResourcesFullIconConfig = {
|
17366 | name: 'ResourcesFullIcon',
|
17367 | height: 1024,
|
17368 | width: 1024,
|
17369 | svgPath: 'M512.1,0 C229.7,0 0,229.8 0,512 C0,794.3 229.8,1024 512.1,1024 C794.4,1024 1024,794.3 1024,512 C1024,229.7 794.4,0 512.1,0 Z M512,896 C300.2,896 128,723.9 128,512 C128,300.3 300.2,128 512,128 C723.7,128 896,300.2 896,512 C896,723.8 723.7,896 512,896 Z M512,224 C671.1,224 800,352.9 800,512 C800,671.1 671.1,800 512,800 C352.9,800 224,671.1 224,512 C224,352.9 352.9,224 512,224',
|
17370 | yOffset: 0,
|
17371 | xOffset: 0,
|
17372 | };
|
17373 |
|
17374 | const ResourcesFullIcon = createIcon(ResourcesFullIconConfig);
|
17375 |
|
17376 | var ResourcesFullIcon$1 = ResourcesFullIcon;
|
17377 |
|
17378 | const variantIcons = {
|
17379 | default: undefined,
|
17380 | pending: undefined,
|
17381 | success: React__namespace.createElement(CheckCircleIcon$1, null),
|
17382 | info: React__namespace.createElement(ResourcesFullIcon$1, null),
|
17383 | warning: React__namespace.createElement(ExclamationTriangleIcon$1, null),
|
17384 | danger: React__namespace.createElement(ExclamationCircleIcon$1, null)
|
17385 | };
|
17386 | const variantStyle$2 = {
|
17387 | default: '',
|
17388 | info: styles$p.modifiers.info,
|
17389 | success: styles$p.modifiers.success,
|
17390 | pending: styles$p.modifiers.pending,
|
17391 | warning: styles$p.modifiers.warning,
|
17392 | danger: styles$p.modifiers.danger
|
17393 | };
|
17394 | const ProgressStep = (_a) => {
|
17395 | var { children, className, variant, isCurrent, description, icon, titleId, 'aria-label': ariaLabel, popoverRender } = _a, props = __rest$1(_a, ["children", "className", "variant", "isCurrent", "description", "icon", "titleId", 'aria-label', "popoverRender"]);
|
17396 | const _icon = icon !== undefined ? icon : variantIcons[variant];
|
17397 | const Component = popoverRender !== undefined ? 'span' : 'div';
|
17398 | const stepRef = React__namespace.useRef();
|
17399 | if (props.id === undefined || titleId === undefined) {
|
17400 |
|
17401 | console.warn('ProgressStep: The titleId and id properties are required to make this component accessible, and one or both of these properties are missing.');
|
17402 | }
|
17403 | return (React__namespace.createElement("li", Object.assign({ className: css(styles$p.progressStepperStep, variantStyle$2[variant], isCurrent && styles$p.modifiers.current, className), "aria-label": ariaLabel }, (isCurrent && { 'aria-current': 'step' }), props),
|
17404 | React__namespace.createElement("div", { className: css(styles$p.progressStepperStepConnector) },
|
17405 | React__namespace.createElement("span", { className: css(styles$p.progressStepperStepIcon) }, _icon && _icon)),
|
17406 | React__namespace.createElement("div", { className: css(styles$p.progressStepperStepMain) },
|
17407 | React__namespace.createElement(Component, Object.assign({ className: css(styles$p.progressStepperStepTitle, popoverRender && styles$p.modifiers.helpText), id: titleId, ref: stepRef }, (popoverRender && { tabIndex: 0, role: 'button', type: 'button' }), (props.id !== undefined && titleId !== undefined && { 'aria-labelledby': `${props.id} ${titleId}` })),
|
17408 | children,
|
17409 | popoverRender && popoverRender(stepRef)),
|
17410 | description && React__namespace.createElement("div", { className: css(styles$p.progressStepperStepDescription) }, description))));
|
17411 | };
|
17412 | ProgressStep.displayName = 'ProgressStep';
|
17413 |
|
17414 | Promise.resolve().then(function () { return radio; });
|
17415 | var styles$o = {
|
17416 | "modifiers": {
|
17417 | "standalone": "pf-m-standalone",
|
17418 | "disabled": "pf-m-disabled"
|
17419 | },
|
17420 | "radio": "pf-c-radio",
|
17421 | "radioBody": "pf-c-radio__body",
|
17422 | "radioDescription": "pf-c-radio__description",
|
17423 | "radioInput": "pf-c-radio__input",
|
17424 | "radioLabel": "pf-c-radio__label"
|
17425 | };
|
17426 |
|
17427 | class Radio extends React__namespace.Component {
|
17428 | constructor(props) {
|
17429 | super(props);
|
17430 | this.handleChange = (event) => {
|
17431 | this.props.onChange(event.currentTarget.checked, event);
|
17432 | };
|
17433 | if (!props.label && !props['aria-label']) {
|
17434 |
|
17435 | console.error('Radio:', 'Radio requires an aria-label to be specified');
|
17436 | }
|
17437 | this.state = {
|
17438 | ouiaStateId: getDefaultOUIAId(Radio.displayName)
|
17439 | };
|
17440 | }
|
17441 | render() {
|
17442 | const _a = this.props, { 'aria-label': ariaLabel, checked, className, defaultChecked, isLabelWrapped, isLabelBeforeButton, isChecked, isDisabled, isValid, label,
|
17443 |
|
17444 | onChange, description, body, ouiaId, ouiaSafe = true } = _a, props = __rest$1(_a, ['aria-label', "checked", "className", "defaultChecked", "isLabelWrapped", "isLabelBeforeButton", "isChecked", "isDisabled", "isValid", "label", "onChange", "description", "body", "ouiaId", "ouiaSafe"]);
|
17445 | if (!props.id) {
|
17446 |
|
17447 | console.error('Radio:', 'id is required to make input accessible');
|
17448 | }
|
17449 | const inputRendered = (React__namespace.createElement("input", Object.assign({}, props, { className: css(styles$o.radioInput), type: "radio", onChange: this.handleChange, "aria-invalid": !isValid, disabled: isDisabled, checked: checked || isChecked }, (checked === undefined && { defaultChecked }), (!label && { 'aria-label': ariaLabel }), getOUIAProps(Radio.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId, ouiaSafe))));
|
17450 | let labelRendered = null;
|
17451 | if (label && isLabelWrapped) {
|
17452 | labelRendered = React__namespace.createElement("span", { className: css(styles$o.radioLabel, isDisabled && styles$o.modifiers.disabled) }, label);
|
17453 | }
|
17454 | else if (label) {
|
17455 | labelRendered = (React__namespace.createElement("label", { className: css(styles$o.radioLabel, isDisabled && styles$o.modifiers.disabled), htmlFor: props.id }, label));
|
17456 | }
|
17457 | const descRender = description ? React__namespace.createElement("span", { className: css(styles$o.radioDescription) }, description) : null;
|
17458 | const bodyRender = body ? React__namespace.createElement("span", { className: css(styles$o.radioBody) }, body) : null;
|
17459 | const childrenRendered = isLabelBeforeButton ? (React__namespace.createElement(React__namespace.Fragment, null,
|
17460 | labelRendered,
|
17461 | inputRendered,
|
17462 | descRender,
|
17463 | bodyRender)) : (React__namespace.createElement(React__namespace.Fragment, null,
|
17464 | inputRendered,
|
17465 | labelRendered,
|
17466 | descRender,
|
17467 | bodyRender));
|
17468 | return isLabelWrapped ? (React__namespace.createElement("label", { className: css(styles$o.radio, className), htmlFor: props.id }, childrenRendered)) : (React__namespace.createElement("div", { className: css(styles$o.radio, !label && styles$o.modifiers.standalone, className) }, childrenRendered));
|
17469 | }
|
17470 | }
|
17471 | Radio.displayName = 'Radio';
|
17472 | Radio.defaultProps = {
|
17473 | className: '',
|
17474 | isDisabled: false,
|
17475 | isValid: true,
|
17476 | onChange: () => { }
|
17477 | };
|
17478 |
|
17479 | Promise.resolve().then(function () { return searchInput; });
|
17480 | var styles$n = {
|
17481 | "button": "pf-c-button",
|
17482 | "modifiers": {
|
17483 | "hint": "pf-m-hint",
|
17484 | "top": "pf-m-top"
|
17485 | },
|
17486 | "searchInput": "pf-c-search-input",
|
17487 | "searchInputBar": "pf-c-search-input__bar",
|
17488 | "searchInputCount": "pf-c-search-input__count",
|
17489 | "searchInputIcon": "pf-c-search-input__icon",
|
17490 | "searchInputMenu": "pf-c-search-input__menu",
|
17491 | "searchInputMenuBody": "pf-c-search-input__menu-body",
|
17492 | "searchInputMenuItem": "pf-c-search-input__menu-item",
|
17493 | "searchInputMenuItemText": "pf-c-search-input__menu-item-text",
|
17494 | "searchInputMenuList": "pf-c-search-input__menu-list",
|
17495 | "searchInputNav": "pf-c-search-input__nav",
|
17496 | "searchInputText": "pf-c-search-input__text",
|
17497 | "searchInputTextInput": "pf-c-search-input__text-input",
|
17498 | "searchInputUtilities": "pf-c-search-input__utilities"
|
17499 | };
|
17500 |
|
17501 | const AdvancedSearchMenu = ({ parentRef, parentInputRef, value = '', attributes = [], formAdditionalItems, hasWordsAttrLabel = 'Has words', advancedSearchDelimiter, getAttrValueMap, onChange, onSearch, onClear, resetButtonLabel = 'Reset', submitSearchButtonLabel = 'Search', isSearchMenuOpen, onToggleAdvancedMenu }) => {
|
17502 | const firstAttrRef = React__namespace.useRef(null);
|
17503 | const [putFocusBackOnInput, setPutFocusBackOnInput] = React__namespace.useState(false);
|
17504 | React__namespace.useEffect(() => {
|
17505 | if (attributes.length > 0 && !advancedSearchDelimiter) {
|
17506 |
|
17507 | console.error('AdvancedSearchMenu: An advancedSearchDelimiter prop is required when advanced search attributes are provided using the attributes prop');
|
17508 | }
|
17509 | });
|
17510 | React__namespace.useEffect(() => {
|
17511 | if (isSearchMenuOpen && firstAttrRef && firstAttrRef.current) {
|
17512 | firstAttrRef.current.focus();
|
17513 | setPutFocusBackOnInput(true);
|
17514 | }
|
17515 | else if (!isSearchMenuOpen && putFocusBackOnInput && parentInputRef && parentInputRef.current) {
|
17516 | parentInputRef.current.focus();
|
17517 | }
|
17518 | }, [isSearchMenuOpen]);
|
17519 | React__namespace.useEffect(() => {
|
17520 | document.addEventListener('mousedown', onDocClick);
|
17521 | document.addEventListener('touchstart', onDocClick);
|
17522 | document.addEventListener('keydown', onEscPress);
|
17523 | return function cleanup() {
|
17524 | document.removeEventListener('mousedown', onDocClick);
|
17525 | document.removeEventListener('touchstart', onDocClick);
|
17526 | document.removeEventListener('keydown', onEscPress);
|
17527 | };
|
17528 | });
|
17529 | const onDocClick = (event) => {
|
17530 | const clickedWithinSearchInput = parentRef && parentRef.current.contains(event.target);
|
17531 | if (isSearchMenuOpen && !clickedWithinSearchInput) {
|
17532 | onToggleAdvancedMenu(event);
|
17533 | }
|
17534 | };
|
17535 | const onEscPress = (event) => {
|
17536 | const keyCode = event.keyCode || event.which;
|
17537 | if (isSearchMenuOpen &&
|
17538 | keyCode === KEY_CODES.ESCAPE_KEY &&
|
17539 | parentRef &&
|
17540 | parentRef.current.contains(event.target)) {
|
17541 | onToggleAdvancedMenu(event);
|
17542 | if (parentInputRef) {
|
17543 | parentInputRef.current.focus();
|
17544 | }
|
17545 | }
|
17546 | };
|
17547 | const onSearchHandler = (event) => {
|
17548 | event.preventDefault();
|
17549 | if (onSearch) {
|
17550 | onSearch(value, event, getAttrValueMap());
|
17551 | }
|
17552 | if (isSearchMenuOpen) {
|
17553 | onToggleAdvancedMenu(event);
|
17554 | }
|
17555 | };
|
17556 | const handleValueChange = (attribute, newValue, event) => {
|
17557 | const newMap = getAttrValueMap();
|
17558 | newMap[attribute] = newValue;
|
17559 | let updatedValue = '';
|
17560 | Object.entries(newMap).forEach(([k, v]) => {
|
17561 | if (v.trim() !== '') {
|
17562 | if (k !== 'haswords') {
|
17563 | updatedValue = `${updatedValue} ${k}${advancedSearchDelimiter}${v}`;
|
17564 | }
|
17565 | else {
|
17566 | updatedValue = `${updatedValue} ${v}`;
|
17567 | }
|
17568 | }
|
17569 | });
|
17570 | updatedValue = updatedValue.replace(/^\s+/g, '');
|
17571 | if (onChange) {
|
17572 | onChange(updatedValue, event);
|
17573 | }
|
17574 | };
|
17575 | const getValue = (attribute) => {
|
17576 | const map = getAttrValueMap();
|
17577 | return map.hasOwnProperty(attribute) ? map[attribute] : '';
|
17578 | };
|
17579 | const buildFormGroups = () => {
|
17580 | const formGroups = [];
|
17581 | attributes.forEach((attribute, index) => {
|
17582 | const display = typeof attribute === 'string' ? attribute : attribute.display;
|
17583 | const queryAttr = typeof attribute === 'string' ? attribute : attribute.attr;
|
17584 | if (index === 0) {
|
17585 | formGroups.push(React__namespace.createElement(FormGroup, { label: display, fieldId: `${queryAttr}_${index}`, key: `${attribute}_${index}` },
|
17586 | React__namespace.createElement(TextInput, { ref: firstAttrRef, type: "text", id: `${queryAttr}_${index}`, value: getValue(queryAttr), onChange: (value, evt) => handleValueChange(queryAttr, value, evt) })));
|
17587 | }
|
17588 | else {
|
17589 | formGroups.push(React__namespace.createElement(FormGroup, { label: display, fieldId: `${queryAttr}_${index}`, key: `${attribute}_${index}` },
|
17590 | React__namespace.createElement(TextInput, { type: "text", id: `${queryAttr}_${index}`, value: getValue(queryAttr), onChange: (value, evt) => handleValueChange(queryAttr, value, evt) })));
|
17591 | }
|
17592 | });
|
17593 | formGroups.push(React__namespace.createElement(GenerateId, { key: 'hasWords' }, randomId => (React__namespace.createElement(FormGroup, { label: hasWordsAttrLabel, fieldId: randomId },
|
17594 | React__namespace.createElement(TextInput, { type: "text", id: randomId, value: getValue('haswords'), onChange: (value, evt) => handleValueChange('haswords', value, evt) })))));
|
17595 | return formGroups;
|
17596 | };
|
17597 | return isSearchMenuOpen ? (React__namespace.createElement("div", { className: styles$n.searchInputMenu },
|
17598 | React__namespace.createElement("div", { className: styles$n.searchInputMenuBody },
|
17599 | React__namespace.createElement(Form, null,
|
17600 | buildFormGroups(),
|
17601 | formAdditionalItems ? formAdditionalItems : null,
|
17602 | React__namespace.createElement(ActionGroup, null,
|
17603 | React__namespace.createElement(Button, { variant: "primary", type: "submit", onClick: onSearchHandler }, submitSearchButtonLabel),
|
17604 | !!onClear && (React__namespace.createElement(Button, { variant: "link", type: "reset", onClick: onClear }, resetButtonLabel))))))) : null;
|
17605 | };
|
17606 | AdvancedSearchMenu.displayName = 'SearchInput';
|
17607 |
|
17608 | const SearchInputBase = (_a) => {
|
17609 | var { className, value = '', attributes = [], formAdditionalItems, hasWordsAttrLabel = 'Has words', advancedSearchDelimiter, placeholder, hint, onChange, onSearch, onClear, onToggleAdvancedSearch, isAdvancedSearchOpen, resultsCount, onNextClick, onPreviousClick, innerRef, 'aria-label': ariaLabel = 'Search input', resetButtonLabel = 'Reset', openMenuButtonAriaLabel = 'Open advanced search', submitSearchButtonLabel = 'Search', isDisabled = false } = _a, props = __rest$1(_a, ["className", "value", "attributes", "formAdditionalItems", "hasWordsAttrLabel", "advancedSearchDelimiter", "placeholder", "hint", "onChange", "onSearch", "onClear", "onToggleAdvancedSearch", "isAdvancedSearchOpen", "resultsCount", "onNextClick", "onPreviousClick", "innerRef", 'aria-label', "resetButtonLabel", "openMenuButtonAriaLabel", "submitSearchButtonLabel", "isDisabled"]);
|
17610 | const [isSearchMenuOpen, setIsSearchMenuOpen] = React__namespace.useState(false);
|
17611 | const [searchValue, setSearchValue] = React__namespace.useState(value);
|
17612 | const searchInputRef = React__namespace.useRef(null);
|
17613 | const searchInputInputRef = innerRef || React__namespace.useRef(null);
|
17614 | React__namespace.useEffect(() => {
|
17615 | setSearchValue(value);
|
17616 | }, [value]);
|
17617 | React__namespace.useEffect(() => {
|
17618 | if (attributes.length > 0 && !advancedSearchDelimiter) {
|
17619 |
|
17620 | console.error('An advancedSearchDelimiter prop is required when advanced search attributes are provided using the attributes prop');
|
17621 | }
|
17622 | });
|
17623 | React__namespace.useEffect(() => {
|
17624 | setIsSearchMenuOpen(isAdvancedSearchOpen);
|
17625 | }, [isAdvancedSearchOpen]);
|
17626 | const onChangeHandler = (event) => {
|
17627 | if (onChange) {
|
17628 | onChange(event.currentTarget.value, event);
|
17629 | }
|
17630 | setSearchValue(event.currentTarget.value);
|
17631 | };
|
17632 | const onToggle = (e) => {
|
17633 | const isOpen = !isSearchMenuOpen;
|
17634 | setIsSearchMenuOpen(isOpen);
|
17635 | if (onToggleAdvancedSearch) {
|
17636 | onToggleAdvancedSearch(e, isOpen);
|
17637 | }
|
17638 | };
|
17639 | const onSearchHandler = (event) => {
|
17640 | event.preventDefault();
|
17641 | if (onSearch) {
|
17642 | onSearch(value, event, getAttrValueMap());
|
17643 | }
|
17644 | setIsSearchMenuOpen(false);
|
17645 | };
|
17646 | const getAttrValueMap = () => {
|
17647 | const attrValue = {};
|
17648 | const pairs = searchValue.split(' ');
|
17649 | pairs.map(pair => {
|
17650 | const splitPair = pair.split(advancedSearchDelimiter);
|
17651 | if (splitPair.length === 2) {
|
17652 | attrValue[splitPair[0]] = splitPair[1];
|
17653 | }
|
17654 | else if (splitPair.length === 1) {
|
17655 | attrValue.haswords = attrValue.hasOwnProperty('haswords')
|
17656 | ? `${attrValue.haswords} ${splitPair[0]}`
|
17657 | : splitPair[0];
|
17658 | }
|
17659 | });
|
17660 | return attrValue;
|
17661 | };
|
17662 | const onEnter = (event) => {
|
17663 | if (event.key === 'Enter') {
|
17664 | onSearchHandler(event);
|
17665 | }
|
17666 | };
|
17667 | const onClearInput = (e) => {
|
17668 | if (onClear) {
|
17669 | onClear(e);
|
17670 | }
|
17671 | if (searchInputInputRef && searchInputInputRef.current) {
|
17672 | searchInputInputRef.current.focus();
|
17673 | }
|
17674 | };
|
17675 | return (React__namespace.createElement("div", Object.assign({ className: css(className, styles$n.searchInput), ref: searchInputRef }, props),
|
17676 | React__namespace.createElement(InputGroup, null,
|
17677 | React__namespace.createElement("div", { className: css(styles$n.searchInputBar) },
|
17678 | React__namespace.createElement("span", { className: css(styles$n.searchInputText) },
|
17679 | React__namespace.createElement("span", { className: css(styles$n.searchInputIcon) },
|
17680 | React__namespace.createElement(SearchIcon$1, null)),
|
17681 | hint && (React__namespace.createElement("input", { className: css(styles$n.searchInputTextInput, styles$n.modifiers.hint), type: "text", disabled: true, "aria-hidden": "true", value: hint })),
|
17682 | React__namespace.createElement("input", { ref: searchInputInputRef, className: css(styles$n.searchInputTextInput), value: searchValue, placeholder: placeholder, "aria-label": ariaLabel, onKeyDown: onEnter, onChange: onChangeHandler, disabled: isDisabled })),
|
17683 | value && (React__namespace.createElement("span", { className: css(styles$n.searchInputUtilities) },
|
17684 | resultsCount && (React__namespace.createElement("span", { className: css(styles$n.searchInputCount) },
|
17685 | React__namespace.createElement(Badge, { isRead: true }, resultsCount))),
|
17686 | !!onNextClick && !!onPreviousClick && (React__namespace.createElement("span", { className: css(styles$n.searchInputNav) },
|
17687 | React__namespace.createElement(Button, { variant: exports.ButtonVariant.plain, "aria-label": "Previous", isDisabled: isDisabled, onClick: onPreviousClick },
|
17688 | React__namespace.createElement(AngleUpIcon$1, null)),
|
17689 | React__namespace.createElement(Button, { variant: exports.ButtonVariant.plain, "aria-label": "Next", isDisabled: isDisabled, onClick: onNextClick },
|
17690 | React__namespace.createElement(AngleDownIcon$1, null)))),
|
17691 | !!onClear && (React__namespace.createElement("span", { className: "pf-c-search-input__clear" },
|
17692 | React__namespace.createElement(Button, { variant: exports.ButtonVariant.plain, isDisabled: isDisabled, "aria-label": resetButtonLabel, onClick: onClearInput },
|
17693 | React__namespace.createElement(TimesIcon$1, null))))))),
|
17694 | (attributes.length > 0 || onToggleAdvancedSearch) && (React__namespace.createElement(Button, { className: isSearchMenuOpen && 'pf-m-expanded', variant: exports.ButtonVariant.control, "aria-label": openMenuButtonAriaLabel, onClick: onToggle, isDisabled: isDisabled, "aria-expanded": isSearchMenuOpen },
|
17695 | React__namespace.createElement(CaretDownIcon$1, null))),
|
17696 | !!onSearch && (React__namespace.createElement(Button, { type: "submit", variant: exports.ButtonVariant.control, "aria-label": submitSearchButtonLabel, onClick: onSearchHandler, isDisabled: isDisabled },
|
17697 | React__namespace.createElement(ArrowRightIcon$1, null)))),
|
17698 | attributes.length > 0 && (React__namespace.createElement(AdvancedSearchMenu, { value: value, parentRef: searchInputRef, parentInputRef: searchInputInputRef, onSearch: onSearch, onClear: onClear, onChange: onChange, onToggleAdvancedMenu: onToggle, resetButtonLabel: resetButtonLabel, submitSearchButtonLabel: submitSearchButtonLabel, attributes: attributes, formAdditionalItems: formAdditionalItems, hasWordsAttrLabel: hasWordsAttrLabel, advancedSearchDelimiter: advancedSearchDelimiter, getAttrValueMap: getAttrValueMap, isSearchMenuOpen: isSearchMenuOpen }))));
|
17699 | };
|
17700 | SearchInputBase.displayName = 'SearchInputBase';
|
17701 | const SearchInput = React__namespace.forwardRef((props, ref) => (React__namespace.createElement(SearchInputBase, Object.assign({}, props, { innerRef: ref }))));
|
17702 | SearchInput.displayName = 'SearchInput';
|
17703 |
|
17704 | const Sidebar = (_a) => {
|
17705 | var { className, children, orientation, isPanelRight = false, hasGutter, hasNoBackground } = _a, props = __rest$1(_a, ["className", "children", "orientation", "isPanelRight", "hasGutter", "hasNoBackground"]);
|
17706 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$E.sidebar, hasGutter && styles$E.modifiers.gutter, hasNoBackground && styles$E.modifiers.noBackground, isPanelRight && styles$E.modifiers.panelRight, styles$E.modifiers[orientation], className) }, props),
|
17707 | React__namespace.createElement("div", { className: styles$E.sidebarMain }, children)));
|
17708 | };
|
17709 | Sidebar.displayName = 'Sidebar';
|
17710 |
|
17711 | const SidebarContent = (_a) => {
|
17712 | var { className, children, hasNoBackground } = _a, props = __rest$1(_a, ["className", "children", "hasNoBackground"]);
|
17713 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$E.sidebarContent, hasNoBackground && styles$E.modifiers.noBackground, className) }, props), children));
|
17714 | };
|
17715 | SidebarContent.displayName = 'SidebarContent';
|
17716 |
|
17717 | const SidebarPanel = (_a) => {
|
17718 | var { className, children, variant = 'default', hasNoBackground, width } = _a, props = __rest$1(_a, ["className", "children", "variant", "hasNoBackground", "width"]);
|
17719 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$E.sidebarPanel, variant !== 'default' && styles$E.modifiers[variant], hasNoBackground && styles$E.modifiers.noBackground, formatBreakpointMods(width, styles$E), className) }, props), children));
|
17720 | };
|
17721 | SidebarPanel.displayName = 'SidebarPanel';
|
17722 |
|
17723 | Promise.resolve().then(function () { return simpleList; });
|
17724 | var styles$m = {
|
17725 | "modifiers": {
|
17726 | "current": "pf-m-current"
|
17727 | },
|
17728 | "simpleList": "pf-c-simple-list",
|
17729 | "simpleListItemLink": "pf-c-simple-list__item-link",
|
17730 | "simpleListSection": "pf-c-simple-list__section",
|
17731 | "simpleListTitle": "pf-c-simple-list__title"
|
17732 | };
|
17733 |
|
17734 | const SimpleListGroup = (_a) => {
|
17735 | var { children = null, className = '', title = '', titleClassName = '', id = '' } = _a, props = __rest$1(_a, ["children", "className", "title", "titleClassName", "id"]);
|
17736 | return (React__namespace.createElement("section", Object.assign({ className: css(styles$m.simpleListSection) }, props),
|
17737 | React__namespace.createElement("h2", { id: id, className: css(styles$m.simpleListTitle, titleClassName), "aria-hidden": "true" }, title),
|
17738 | React__namespace.createElement("ul", { className: css(className), "aria-labelledby": id }, children)));
|
17739 | };
|
17740 | SimpleListGroup.displayName = 'SimpleListGroup';
|
17741 |
|
17742 | const SimpleListContext = React__namespace.createContext({});
|
17743 | class SimpleList extends React__namespace.Component {
|
17744 | constructor() {
|
17745 | super(...arguments);
|
17746 | this.state = {
|
17747 | currentRef: null
|
17748 | };
|
17749 | this.handleCurrentUpdate = (newCurrentRef, itemProps) => {
|
17750 | this.setState({ currentRef: newCurrentRef });
|
17751 | const { onSelect } = this.props;
|
17752 | onSelect && onSelect(newCurrentRef, itemProps);
|
17753 | };
|
17754 | }
|
17755 | render() {
|
17756 |
|
17757 | const _a = this.props, { children, className, onSelect, isControlled } = _a, props = __rest$1(_a, ["children", "className", "onSelect", "isControlled"]);
|
17758 | let isGrouped = false;
|
17759 | if (children) {
|
17760 | isGrouped = React__namespace.Children.toArray(children)[0].type === SimpleListGroup;
|
17761 | }
|
17762 | return (React__namespace.createElement(SimpleListContext.Provider, { value: {
|
17763 | currentRef: this.state.currentRef,
|
17764 | updateCurrentRef: this.handleCurrentUpdate,
|
17765 | isControlled
|
17766 | } },
|
17767 | React__namespace.createElement("div", Object.assign({ className: css(styles$m.simpleList, className) }, props),
|
17768 | isGrouped && children,
|
17769 | !isGrouped && React__namespace.createElement("ul", null, children))));
|
17770 | }
|
17771 | }
|
17772 | SimpleList.displayName = 'SimpleList';
|
17773 | SimpleList.defaultProps = {
|
17774 | children: null,
|
17775 | className: '',
|
17776 | isControlled: true
|
17777 | };
|
17778 |
|
17779 | class SimpleListItem extends React__namespace.Component {
|
17780 | constructor() {
|
17781 | super(...arguments);
|
17782 | this.ref = React__namespace.createRef();
|
17783 | }
|
17784 | render() {
|
17785 | const _a = this.props, { children, isCurrent, isActive, className, component: Component, componentClassName, componentProps, onClick, type, href,
|
17786 |
|
17787 | itemId } = _a, props = __rest$1(_a, ["children", "isCurrent", "isActive", "className", "component", "componentClassName", "componentProps", "onClick", "type", "href", "itemId"]);
|
17788 | return (React__namespace.createElement(SimpleListContext.Consumer, null, ({ currentRef, updateCurrentRef, isControlled }) => {
|
17789 | const isButton = Component === 'button';
|
17790 | const isCurrentItem = this.ref && currentRef && isControlled ? currentRef.current === this.ref.current : isActive || isCurrent;
|
17791 | const additionalComponentProps = isButton
|
17792 | ? {
|
17793 | type
|
17794 | }
|
17795 | : {
|
17796 | tabIndex: 0,
|
17797 | href
|
17798 | };
|
17799 | return (React__namespace.createElement("li", Object.assign({ className: css(className) }, props),
|
17800 | React__namespace.createElement(Component, Object.assign({ className: css(styles$m.simpleListItemLink, isCurrentItem && styles$m.modifiers.current, componentClassName), onClick: (evt) => {
|
17801 | onClick(evt);
|
17802 | updateCurrentRef(this.ref, this.props);
|
17803 | }, ref: this.ref }, componentProps, additionalComponentProps), children)));
|
17804 | }));
|
17805 | }
|
17806 | }
|
17807 | SimpleListItem.displayName = 'SimpleListItem';
|
17808 | SimpleListItem.defaultProps = {
|
17809 | children: null,
|
17810 | className: '',
|
17811 | isActive: false,
|
17812 | isCurrent: false,
|
17813 | component: 'button',
|
17814 | componentClassName: '',
|
17815 | type: 'button',
|
17816 | href: '',
|
17817 | onClick: () => { }
|
17818 | };
|
17819 |
|
17820 | Promise.resolve().then(function () { return skeleton; });
|
17821 | var styles$l = {
|
17822 | "modifiers": {
|
17823 | "circle": "pf-m-circle",
|
17824 | "square": "pf-m-square",
|
17825 | "widthSm": "pf-m-width-sm",
|
17826 | "widthMd": "pf-m-width-md",
|
17827 | "widthLg": "pf-m-width-lg",
|
17828 | "width_25": "pf-m-width-25",
|
17829 | "width_33": "pf-m-width-33",
|
17830 | "width_50": "pf-m-width-50",
|
17831 | "width_66": "pf-m-width-66",
|
17832 | "width_75": "pf-m-width-75",
|
17833 | "heightSm": "pf-m-height-sm",
|
17834 | "heightMd": "pf-m-height-md",
|
17835 | "heightLg": "pf-m-height-lg",
|
17836 | "height_25": "pf-m-height-25",
|
17837 | "height_33": "pf-m-height-33",
|
17838 | "height_50": "pf-m-height-50",
|
17839 | "height_66": "pf-m-height-66",
|
17840 | "height_75": "pf-m-height-75",
|
17841 | "height_100": "pf-m-height-100",
|
17842 | "text_4xl": "pf-m-text-4xl",
|
17843 | "text_3xl": "pf-m-text-3xl",
|
17844 | "text_2xl": "pf-m-text-2xl",
|
17845 | "textXl": "pf-m-text-xl",
|
17846 | "textLg": "pf-m-text-lg",
|
17847 | "textMd": "pf-m-text-md",
|
17848 | "textSm": "pf-m-text-sm"
|
17849 | },
|
17850 | "skeleton": "pf-c-skeleton"
|
17851 | };
|
17852 |
|
17853 | const Skeleton = (_a) => {
|
17854 | var { className, width, height, fontSize, shape, screenreaderText } = _a, props = __rest$1(_a, ["className", "width", "height", "fontSize", "shape", "screenreaderText"]);
|
17855 | const fontHeightClassName = fontSize
|
17856 | ? Object.values(styles$l.modifiers).find(key => key === `pf-m-text-${fontSize}`)
|
17857 | : undefined;
|
17858 | return (React__namespace.createElement("div", Object.assign({}, props, { className: css(styles$l.skeleton, fontSize && fontHeightClassName, shape === 'circle' && styles$l.modifiers.circle, shape === 'square' && styles$l.modifiers.square, className) }, ((width || height) && {
|
17859 | style: Object.assign({ '--pf-c-skeleton--Width': width ? width : undefined, '--pf-c-skeleton--Height': height ? height : undefined }, props.style)
|
17860 | })),
|
17861 | React__namespace.createElement("span", { className: "pf-u-screen-reader" }, screenreaderText)));
|
17862 | };
|
17863 | Skeleton.displayName = 'Skeleton';
|
17864 |
|
17865 | Promise.resolve().then(function () { return skipToContent; });
|
17866 | var styles$k = {
|
17867 | "skipToContent": "pf-c-skip-to-content"
|
17868 | };
|
17869 |
|
17870 | class SkipToContent extends React__namespace.Component {
|
17871 | constructor() {
|
17872 | super(...arguments);
|
17873 | this.componentRef = React__namespace.createRef();
|
17874 | }
|
17875 | componentDidMount() {
|
17876 | if (this.props.show && this.componentRef.current) {
|
17877 | this.componentRef.current.focus();
|
17878 | }
|
17879 | }
|
17880 | render() {
|
17881 |
|
17882 | const _a = this.props, { children, className, href, show, type } = _a, rest = __rest$1(_a, ["children", "className", "href", "show", "type"]);
|
17883 | return (React__namespace.createElement("a", Object.assign({}, rest, { className: css(buttonStyles.button, buttonStyles.modifiers.primary, styles$k.skipToContent, className), ref: this.componentRef, href: href }), children));
|
17884 | }
|
17885 | }
|
17886 | SkipToContent.displayName = 'SkipToContent';
|
17887 | SkipToContent.defaultProps = {
|
17888 | show: false
|
17889 | };
|
17890 |
|
17891 | Promise.resolve().then(function () { return slider; });
|
17892 | var styles$j = {
|
17893 | "formControl": "pf-c-form-control",
|
17894 | "inputGroup": "pf-c-input-group",
|
17895 | "inputGroupText": "pf-c-input-group__text",
|
17896 | "modifiers": {
|
17897 | "disabled": "pf-m-disabled",
|
17898 | "active": "pf-m-active",
|
17899 | "floating": "pf-m-floating"
|
17900 | },
|
17901 | "slider": "pf-c-slider",
|
17902 | "sliderActions": "pf-c-slider__actions",
|
17903 | "sliderMain": "pf-c-slider__main",
|
17904 | "sliderRail": "pf-c-slider__rail",
|
17905 | "sliderRailTrack": "pf-c-slider__rail-track",
|
17906 | "sliderStep": "pf-c-slider__step",
|
17907 | "sliderStepLabel": "pf-c-slider__step-label",
|
17908 | "sliderStepTick": "pf-c-slider__step-tick",
|
17909 | "sliderSteps": "pf-c-slider__steps",
|
17910 | "sliderThumb": "pf-c-slider__thumb",
|
17911 | "sliderValue": "pf-c-slider__value"
|
17912 | };
|
17913 |
|
17914 | const SliderStep = (_a) => {
|
17915 | var { className, label, value, isTickHidden = false, isLabelHidden = false, isActive = false } = _a, props = __rest$1(_a, ["className", "label", "value", "isTickHidden", "isLabelHidden", "isActive"]);
|
17916 | const style = { '--pf-c-slider__step--Left': `${value}%` };
|
17917 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$j.sliderStep, isActive && styles$j.modifiers.active, className), style: style }, props),
|
17918 | !isTickHidden && React__namespace.createElement("div", { className: css(styles$j.sliderStepTick) }),
|
17919 | !isLabelHidden && label && React__namespace.createElement("div", { className: css(styles$j.sliderStepLabel) }, label)));
|
17920 | };
|
17921 | SliderStep.displayName = 'SliderStep';
|
17922 |
|
17923 | const getPercentage = (current, max) => (100 * current) / max;
|
17924 | const Slider = (_a) => {
|
17925 | var { className, value = 0, customSteps, areCustomStepsContinuous = false, isDisabled = false, isInputVisible = false, inputValue = 0, inputLabel, inputAriaLabel = 'Slider value input', thumbAriaLabel = 'Value', hasTooltipOverThumb = false, inputPosition = 'right', onChange, leftActions, rightActions, step = 1, min = 0, max = 100, showTicks = false, showBoundaries = true } = _a, props = __rest$1(_a, ["className", "value", "customSteps", "areCustomStepsContinuous", "isDisabled", "isInputVisible", "inputValue", "inputLabel", "inputAriaLabel", "thumbAriaLabel", "hasTooltipOverThumb", "inputPosition", "onChange", "leftActions", "rightActions", "step", "min", "max", "showTicks", "showBoundaries"]);
|
17926 | const sliderRailRef = React__namespace.useRef();
|
17927 | const thumbRef = React__namespace.useRef();
|
17928 | const [localValue, setValue] = React.useState(value);
|
17929 | const [localInputValue, setLocalInputValue] = React.useState(inputValue);
|
17930 | React__namespace.useEffect(() => {
|
17931 | setValue(value);
|
17932 | }, [value]);
|
17933 | React__namespace.useEffect(() => {
|
17934 | setLocalInputValue(inputValue);
|
17935 | }, [inputValue]);
|
17936 | let diff = 0;
|
17937 | let snapValue;
|
17938 |
|
17939 | const stylePercent = ((localValue - min) * 100) / (max - min);
|
17940 | const style = { '--pf-c-slider--value': `${stylePercent}%` };
|
17941 | const widthChars = React__namespace.useMemo(() => localInputValue.toString().length, [localInputValue]);
|
17942 | const inputStyle = { '--pf-c-slider__value--c-form-control--width-chars': widthChars };
|
17943 | const onChangeHandler = (value) => {
|
17944 | setLocalInputValue(Number(value));
|
17945 | };
|
17946 | const handleKeyPressOnInput = (event) => {
|
17947 | if (event.key === 'Enter') {
|
17948 | event.preventDefault();
|
17949 | if (onChange) {
|
17950 | onChange(localValue, localInputValue, setLocalInputValue);
|
17951 | }
|
17952 | }
|
17953 | };
|
17954 | const onInputFocus = (e) => {
|
17955 | e.stopPropagation();
|
17956 | };
|
17957 | const onThumbClick = () => {
|
17958 | thumbRef.current.focus();
|
17959 | };
|
17960 | const onBlur = () => {
|
17961 | if (onChange) {
|
17962 | onChange(localValue, localInputValue, setLocalInputValue);
|
17963 | }
|
17964 | };
|
17965 | const findAriaTextValue = () => {
|
17966 | if (!areCustomStepsContinuous && customSteps) {
|
17967 | const matchingStep = customSteps.find(stepObj => stepObj.value === localValue);
|
17968 | if (matchingStep) {
|
17969 | return matchingStep.label;
|
17970 | }
|
17971 | }
|
17972 |
|
17973 |
|
17974 | return Number(Number(localValue).toFixed(2)).toString();
|
17975 | };
|
17976 | const handleThumbDragEnd = () => {
|
17977 | document.removeEventListener('mousemove', callbackThumbMove);
|
17978 | document.removeEventListener('mouseup', callbackThumbUp);
|
17979 | document.removeEventListener('touchmove', callbackThumbMove);
|
17980 | document.removeEventListener('touchend', callbackThumbUp);
|
17981 | document.removeEventListener('touchcancel', callbackThumbUp);
|
17982 | };
|
17983 | const handleMouseDown = (e) => {
|
17984 | e.stopPropagation();
|
17985 | e.preventDefault();
|
17986 | diff = e.clientX - thumbRef.current.getBoundingClientRect().left;
|
17987 | document.addEventListener('mousemove', callbackThumbMove);
|
17988 | document.addEventListener('mouseup', callbackThumbUp);
|
17989 | };
|
17990 | const handleTouchStart = (e) => {
|
17991 | e.stopPropagation();
|
17992 | diff = e.touches[0].clientX - thumbRef.current.getBoundingClientRect().left;
|
17993 | document.addEventListener('touchmove', callbackThumbMove, { passive: false });
|
17994 | document.addEventListener('touchend', callbackThumbUp);
|
17995 | document.addEventListener('touchcancel', callbackThumbUp);
|
17996 | };
|
17997 | const onSliderRailClick = (e) => {
|
17998 | handleThumbMove(e);
|
17999 | if (snapValue && !areCustomStepsContinuous) {
|
18000 | thumbRef.current.style.setProperty('--pf-c-slider--value', `${snapValue}%`);
|
18001 | setValue(snapValue);
|
18002 | if (onChange) {
|
18003 | onChange(snapValue);
|
18004 | }
|
18005 | }
|
18006 | };
|
18007 | const handleThumbMove = (e) => {
|
18008 | if (e.type === 'touchmove') {
|
18009 | e.preventDefault();
|
18010 | e.stopImmediatePropagation();
|
18011 | }
|
18012 | const clientPosition = e.touches && e.touches.length ? e.touches[0].clientX : e.clientX;
|
18013 | let newPosition = clientPosition - diff - sliderRailRef.current.getBoundingClientRect().left;
|
18014 | const end = sliderRailRef.current.offsetWidth - thumbRef.current.offsetWidth;
|
18015 | const start = 0;
|
18016 | if (newPosition < start) {
|
18017 | newPosition = 0;
|
18018 | }
|
18019 | if (newPosition > end) {
|
18020 | newPosition = end;
|
18021 | }
|
18022 | const newPercentage = getPercentage(newPosition, end);
|
18023 | thumbRef.current.style.setProperty('--pf-c-slider--value', `${newPercentage}%`);
|
18024 |
|
18025 | const newValue = Math.round(((newPercentage * (max - min)) / 100 + min) * 100) / 100;
|
18026 | setValue(newValue);
|
18027 | if (!customSteps) {
|
18028 |
|
18029 | snapValue = Math.round((Math.round((newValue - min) / step) * step + min) * 100) / 100;
|
18030 | thumbRef.current.style.setProperty('--pf-c-slider--value', `${snapValue}%`);
|
18031 | setValue(snapValue);
|
18032 | }
|
18033 |
|
18034 | if (!areCustomStepsContinuous && customSteps) {
|
18035 | let percentage = newPercentage;
|
18036 | if (customSteps[customSteps.length - 1].value !== 100) {
|
18037 | const numSteps = customSteps.length - 1;
|
18038 | const percentagePerStep = 100 / numSteps;
|
18039 | percentage = newPercentage / percentagePerStep;
|
18040 | }
|
18041 | const stepIndex = customSteps.findIndex(stepObj => stepObj.value >= percentage);
|
18042 | if (customSteps[stepIndex].value === percentage) {
|
18043 | snapValue = customSteps[stepIndex].value;
|
18044 | }
|
18045 | else {
|
18046 | const midpoint = (customSteps[stepIndex].value + customSteps[stepIndex - 1].value) / 2;
|
18047 | if (midpoint > percentage) {
|
18048 | snapValue = customSteps[stepIndex - 1].value;
|
18049 | }
|
18050 | else {
|
18051 | snapValue = customSteps[stepIndex].value;
|
18052 | }
|
18053 | }
|
18054 | setValue(snapValue);
|
18055 | }
|
18056 |
|
18057 | if (onChange) {
|
18058 | if (snapValue !== undefined) {
|
18059 | onChange(snapValue);
|
18060 | }
|
18061 | else {
|
18062 | onChange(newValue);
|
18063 | }
|
18064 | }
|
18065 | };
|
18066 | const callbackThumbMove = React__namespace.useCallback(handleThumbMove, [min, max, customSteps, onChange]);
|
18067 | const callbackThumbUp = React__namespace.useCallback(handleThumbDragEnd, [min, max, customSteps, onChange]);
|
18068 | const handleThumbKeys = (e) => {
|
18069 | const key = e.key;
|
18070 | if (key !== 'ArrowLeft' && key !== 'ArrowRight') {
|
18071 | return;
|
18072 | }
|
18073 | e.preventDefault();
|
18074 | let newValue = localValue;
|
18075 | if (!areCustomStepsContinuous && customSteps) {
|
18076 | const stepIndex = customSteps.findIndex(stepObj => stepObj.value === localValue);
|
18077 | if (key === 'ArrowRight') {
|
18078 | if (stepIndex + 1 < customSteps.length) {
|
18079 | {
|
18080 | newValue = customSteps[stepIndex + 1].value;
|
18081 | }
|
18082 | }
|
18083 | }
|
18084 | else if (key === 'ArrowLeft') {
|
18085 | if (stepIndex - 1 >= 0) {
|
18086 | newValue = customSteps[stepIndex - 1].value;
|
18087 | }
|
18088 | }
|
18089 | }
|
18090 | else {
|
18091 | if (key === 'ArrowRight') {
|
18092 | newValue = localValue + step <= max ? localValue + step : max;
|
18093 | }
|
18094 | else if (key === 'ArrowLeft') {
|
18095 | newValue = localValue - step >= min ? localValue - step : min;
|
18096 | }
|
18097 | }
|
18098 | if (newValue !== localValue) {
|
18099 | thumbRef.current.style.setProperty('--pf-c-slider--value', `${newValue}%`);
|
18100 | setValue(newValue);
|
18101 | if (onChange) {
|
18102 | onChange(newValue);
|
18103 | }
|
18104 | }
|
18105 | };
|
18106 | const displayInput = () => {
|
18107 | const textInput = (React__namespace.createElement(TextInput, { className: css(styles$j.formControl), isDisabled: isDisabled, type: "number", value: localInputValue, "aria-label": inputAriaLabel, onKeyDown: handleKeyPressOnInput, onChange: onChangeHandler, onClick: onInputFocus, onFocus: onInputFocus, onBlur: onBlur }));
|
18108 | if (inputLabel) {
|
18109 | return (React__namespace.createElement(InputGroup, null,
|
18110 | textInput,
|
18111 | React__namespace.createElement(InputGroupText, { variant: "plain" },
|
18112 | " ",
|
18113 | inputLabel)));
|
18114 | }
|
18115 | else {
|
18116 | return textInput;
|
18117 | }
|
18118 | };
|
18119 | const getStepValue = (val, min, max) => ((val - min) * 100) / (max - min);
|
18120 | const buildSteps = () => {
|
18121 | const builtSteps = [];
|
18122 | for (let i = min; i <= max; i = i + step) {
|
18123 | const stepValue = getStepValue(i, min, max);
|
18124 |
|
18125 |
|
18126 | if (!showTicks && showBoundaries && i !== min && i !== max) {
|
18127 | continue;
|
18128 | }
|
18129 | builtSteps.push(React__namespace.createElement(SliderStep, { key: i, value: stepValue, label: i.toString(), isTickHidden: !showTicks, isLabelHidden: (i === min || i === max) && showBoundaries ? false : true, isActive: i <= localValue }));
|
18130 | }
|
18131 | return builtSteps;
|
18132 | };
|
18133 | const thumbComponent = (React__namespace.createElement("div", { className: css(styles$j.sliderThumb), ref: thumbRef, tabIndex: isDisabled ? -1 : 0, role: "slider", "aria-valuemin": customSteps ? customSteps[0].value : min, "aria-valuemax": customSteps ? customSteps[customSteps.length - 1].value : max, "aria-valuenow": localValue, "aria-valuetext": findAriaTextValue(), "aria-label": thumbAriaLabel, "aria-disabled": isDisabled, onMouseDown: !isDisabled ? handleMouseDown : null, onTouchStart: !isDisabled ? handleTouchStart : null, onKeyDown: !isDisabled ? handleThumbKeys : null, onClick: !isDisabled ? onThumbClick : null }));
|
18134 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$j.slider, className, isDisabled && styles$j.modifiers.disabled), style: Object.assign(Object.assign({}, style), inputStyle) }, props),
|
18135 | leftActions && React__namespace.createElement("div", { className: css(styles$j.sliderActions) }, leftActions),
|
18136 | React__namespace.createElement("div", { className: css(styles$j.sliderMain) },
|
18137 | React__namespace.createElement("div", { className: css(styles$j.sliderRail), ref: sliderRailRef, onClick: !isDisabled ? onSliderRailClick : null },
|
18138 | React__namespace.createElement("div", { className: css(styles$j.sliderRailTrack) })),
|
18139 | customSteps && (React__namespace.createElement("div", { className: css(styles$j.sliderSteps), "aria-hidden": "true" }, customSteps.map(stepObj => {
|
18140 | const minValue = customSteps[0].value;
|
18141 | const maxValue = customSteps[customSteps.length - 1].value;
|
18142 | const stepValue = getStepValue(stepObj.value, minValue, maxValue);
|
18143 | return (React__namespace.createElement(SliderStep, { key: stepObj.value, value: stepValue, label: stepObj.label, isLabelHidden: stepObj.isLabelHidden, isActive: stepObj.value <= localValue }));
|
18144 | }))),
|
18145 | !customSteps && (showTicks || showBoundaries) && (React__namespace.createElement("div", { className: css(styles$j.sliderSteps), "aria-hidden": "true" }, buildSteps())),
|
18146 | hasTooltipOverThumb ? (React__namespace.createElement(Tooltip, { entryDelay: 0, content: findAriaTextValue() }, thumbComponent)) : (thumbComponent),
|
18147 | isInputVisible && inputPosition === 'aboveThumb' && (React__namespace.createElement("div", { className: css(styles$j.sliderValue, styles$j.modifiers.floating) }, displayInput()))),
|
18148 | isInputVisible && inputPosition === 'right' && React__namespace.createElement("div", { className: css(styles$j.sliderValue) }, displayInput()),
|
18149 | rightActions && React__namespace.createElement("div", { className: css(styles$j.sliderActions) }, rightActions)));
|
18150 | };
|
18151 | Slider.displayName = 'Slider';
|
18152 |
|
18153 | Promise.resolve().then(function () { return _switch; });
|
18154 | var styles$i = {
|
18155 | "modifiers": {
|
18156 | "reverse": "pf-m-reverse",
|
18157 | "off": "pf-m-off",
|
18158 | "on": "pf-m-on"
|
18159 | },
|
18160 | "switch": "pf-c-switch",
|
18161 | "switchInput": "pf-c-switch__input",
|
18162 | "switchLabel": "pf-c-switch__label",
|
18163 | "switchToggle": "pf-c-switch__toggle",
|
18164 | "switchToggleIcon": "pf-c-switch__toggle-icon"
|
18165 | };
|
18166 |
|
18167 | class Switch extends React__namespace.Component {
|
18168 | constructor(props) {
|
18169 | super(props);
|
18170 | if (!props.label && !props['aria-label']) {
|
18171 |
|
18172 | console.error('Switch: Switch requires either a label or an aria-label to be specified');
|
18173 | }
|
18174 | this.id = props.id || getUniqueId();
|
18175 | this.state = {
|
18176 | ouiaStateId: getDefaultOUIAId(Switch.displayName)
|
18177 | };
|
18178 | }
|
18179 | render() {
|
18180 | const _a = this.props, {
|
18181 |
|
18182 | id, className, label, labelOff, isChecked, hasCheckIcon, isDisabled, onChange, isReversed, ouiaId, ouiaSafe } = _a, props = __rest$1(_a, ["id", "className", "label", "labelOff", "isChecked", "hasCheckIcon", "isDisabled", "onChange", "isReversed", "ouiaId", "ouiaSafe"]);
|
18183 | const isAriaLabelledBy = props['aria-label'] === '';
|
18184 | return (React__namespace.createElement("label", Object.assign({ className: css(styles$i.switch, isReversed && styles$i.modifiers.reverse, className), htmlFor: this.id }, getOUIAProps(Switch.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId, ouiaSafe)),
|
18185 | React__namespace.createElement("input", Object.assign({ id: this.id, className: css(styles$i.switchInput), type: "checkbox", onChange: event => onChange(event.target.checked, event), checked: isChecked, disabled: isDisabled, "aria-labelledby": isAriaLabelledBy ? `${this.id}-on` : null }, props)),
|
18186 | label !== undefined ? (React__namespace.createElement(React__namespace.Fragment, null,
|
18187 | React__namespace.createElement("span", { className: css(styles$i.switchToggle) }),
|
18188 | React__namespace.createElement("span", { className: css(styles$i.switchLabel, styles$i.modifiers.on), id: isAriaLabelledBy ? `${this.id}-on` : null, "aria-hidden": "true" }, label),
|
18189 | hasCheckIcon && (React__namespace.createElement("div", { className: css(styles$i.switchToggleIcon), "aria-hidden": "true" },
|
18190 | React__namespace.createElement(CheckIcon$1, { noVerticalAlign: true }))),
|
18191 | React__namespace.createElement("span", { className: css(styles$i.switchLabel, styles$i.modifiers.off), id: isAriaLabelledBy ? `${this.id}-off` : null, "aria-hidden": "true" }, labelOff !== undefined ? labelOff : label))) : (React__namespace.createElement("span", { className: css(styles$i.switchToggle) },
|
18192 | React__namespace.createElement("div", { className: css(styles$i.switchToggleIcon), "aria-hidden": "true" },
|
18193 | React__namespace.createElement(CheckIcon$1, { noVerticalAlign: true }))))));
|
18194 | }
|
18195 | }
|
18196 | Switch.displayName = 'Switch';
|
18197 | Switch.defaultProps = {
|
18198 | isChecked: true,
|
18199 | isDisabled: false,
|
18200 | isReversed: false,
|
18201 | 'aria-label': '',
|
18202 | onChange: () => undefined
|
18203 | };
|
18204 |
|
18205 | Promise.resolve().then(function () { return tabs; });
|
18206 | var styles$h = {
|
18207 | "button": "pf-c-button",
|
18208 | "modifiers": {
|
18209 | "fill": "pf-m-fill",
|
18210 | "scrollable": "pf-m-scrollable",
|
18211 | "secondary": "pf-m-secondary",
|
18212 | "noBorderBottom": "pf-m-no-border-bottom",
|
18213 | "borderBottom": "pf-m-border-bottom",
|
18214 | "box": "pf-m-box",
|
18215 | "vertical": "pf-m-vertical",
|
18216 | "current": "pf-m-current",
|
18217 | "colorSchemeLight_300": "pf-m-color-scheme--light-300",
|
18218 | "expandable": "pf-m-expandable",
|
18219 | "nonExpandable": "pf-m-non-expandable",
|
18220 | "expandableOnSm": "pf-m-expandable-on-sm",
|
18221 | "nonExpandableOnSm": "pf-m-non-expandable-on-sm",
|
18222 | "expandableOnMd": "pf-m-expandable-on-md",
|
18223 | "nonExpandableOnMd": "pf-m-non-expandable-on-md",
|
18224 | "expandableOnLg": "pf-m-expandable-on-lg",
|
18225 | "nonExpandableOnLg": "pf-m-non-expandable-on-lg",
|
18226 | "expandableOnXl": "pf-m-expandable-on-xl",
|
18227 | "nonExpandableOnXl": "pf-m-non-expandable-on-xl",
|
18228 | "expandableOn_2xl": "pf-m-expandable-on-2xl",
|
18229 | "nonExpandableOn_2xl": "pf-m-non-expandable-on-2xl",
|
18230 | "expanded": "pf-m-expanded",
|
18231 | "pageInsets": "pf-m-page-insets",
|
18232 | "action": "pf-m-action",
|
18233 | "disabled": "pf-m-disabled",
|
18234 | "ariaDisabled": "pf-m-aria-disabled",
|
18235 | "insetNone": "pf-m-inset-none",
|
18236 | "insetSm": "pf-m-inset-sm",
|
18237 | "insetMd": "pf-m-inset-md",
|
18238 | "insetLg": "pf-m-inset-lg",
|
18239 | "insetXl": "pf-m-inset-xl",
|
18240 | "inset_2xl": "pf-m-inset-2xl",
|
18241 | "insetNoneOnSm": "pf-m-inset-none-on-sm",
|
18242 | "insetSmOnSm": "pf-m-inset-sm-on-sm",
|
18243 | "insetMdOnSm": "pf-m-inset-md-on-sm",
|
18244 | "insetLgOnSm": "pf-m-inset-lg-on-sm",
|
18245 | "insetXlOnSm": "pf-m-inset-xl-on-sm",
|
18246 | "inset_2xlOnSm": "pf-m-inset-2xl-on-sm",
|
18247 | "insetNoneOnMd": "pf-m-inset-none-on-md",
|
18248 | "insetSmOnMd": "pf-m-inset-sm-on-md",
|
18249 | "insetMdOnMd": "pf-m-inset-md-on-md",
|
18250 | "insetLgOnMd": "pf-m-inset-lg-on-md",
|
18251 | "insetXlOnMd": "pf-m-inset-xl-on-md",
|
18252 | "inset_2xlOnMd": "pf-m-inset-2xl-on-md",
|
18253 | "insetNoneOnLg": "pf-m-inset-none-on-lg",
|
18254 | "insetSmOnLg": "pf-m-inset-sm-on-lg",
|
18255 | "insetMdOnLg": "pf-m-inset-md-on-lg",
|
18256 | "insetLgOnLg": "pf-m-inset-lg-on-lg",
|
18257 | "insetXlOnLg": "pf-m-inset-xl-on-lg",
|
18258 | "inset_2xlOnLg": "pf-m-inset-2xl-on-lg",
|
18259 | "insetNoneOnXl": "pf-m-inset-none-on-xl",
|
18260 | "insetSmOnXl": "pf-m-inset-sm-on-xl",
|
18261 | "insetMdOnXl": "pf-m-inset-md-on-xl",
|
18262 | "insetLgOnXl": "pf-m-inset-lg-on-xl",
|
18263 | "insetXlOnXl": "pf-m-inset-xl-on-xl",
|
18264 | "inset_2xlOnXl": "pf-m-inset-2xl-on-xl",
|
18265 | "insetNoneOn_2xl": "pf-m-inset-none-on-2xl",
|
18266 | "insetSmOn_2xl": "pf-m-inset-sm-on-2xl",
|
18267 | "insetMdOn_2xl": "pf-m-inset-md-on-2xl",
|
18268 | "insetLgOn_2xl": "pf-m-inset-lg-on-2xl",
|
18269 | "insetXlOn_2xl": "pf-m-inset-xl-on-2xl",
|
18270 | "inset_2xlOn_2xl": "pf-m-inset-2xl-on-2xl"
|
18271 | },
|
18272 | "tabs": "pf-c-tabs",
|
18273 | "tabsAdd": "pf-c-tabs__add",
|
18274 | "tabsItem": "pf-c-tabs__item",
|
18275 | "tabsItemClose": "pf-c-tabs__item-close",
|
18276 | "tabsItemCloseIcon": "pf-c-tabs__item-close-icon",
|
18277 | "tabsItemIcon": "pf-c-tabs__item-icon",
|
18278 | "tabsItemText": "pf-c-tabs__item-text",
|
18279 | "tabsLink": "pf-c-tabs__link",
|
18280 | "tabsList": "pf-c-tabs__list",
|
18281 | "tabsScrollButton": "pf-c-tabs__scroll-button",
|
18282 | "tabsToggle": "pf-c-tabs__toggle",
|
18283 | "tabsToggleButton": "pf-c-tabs__toggle-button",
|
18284 | "tabsToggleIcon": "pf-c-tabs__toggle-icon",
|
18285 | "tabsToggleText": "pf-c-tabs__toggle-text"
|
18286 | };
|
18287 |
|
18288 | const TabButton = (_a) => {
|
18289 | var { children,
|
18290 |
|
18291 | tabContentRef, ouiaId, parentInnerRef, ouiaSafe } = _a, props = __rest$1(_a, ["children", "tabContentRef", "ouiaId", "parentInnerRef", "ouiaSafe"]);
|
18292 | const Component = (props.href ? 'a' : 'button');
|
18293 | return (React__namespace.createElement(Component, Object.assign({ ref: parentInnerRef }, getOUIAProps(TabButton.displayName, ouiaId, ouiaSafe), props), children));
|
18294 | };
|
18295 | TabButton.displayName = 'TabButton';
|
18296 |
|
18297 | const TabsContext = React__namespace.createContext({
|
18298 | variant: 'default',
|
18299 | mountOnEnter: false,
|
18300 | unmountOnExit: false,
|
18301 | localActiveKey: '',
|
18302 | uniqueId: '',
|
18303 | handleTabClick: () => null,
|
18304 | handleTabClose: undefined
|
18305 | });
|
18306 | const TabsContextProvider = TabsContext.Provider;
|
18307 | const TabsContextConsumer = TabsContext.Consumer;
|
18308 |
|
18309 | const TabBase = (_a) => {
|
18310 | var { title, eventKey, tabContentRef, id: childId, tabContentId, className: childClassName = '', ouiaId: childOuiaId, isDisabled, isAriaDisabled, inoperableEvents = ['onClick', 'onKeyPress'], href, innerRef, tooltip, closeButtonAriaLabel, isCloseDisabled = false } = _a, props = __rest$1(_a, ["title", "eventKey", "tabContentRef", "id", "tabContentId", "className", "ouiaId", "isDisabled", "isAriaDisabled", "inoperableEvents", "href", "innerRef", "tooltip", "closeButtonAriaLabel", "isCloseDisabled"]);
|
18311 | const preventedEvents = inoperableEvents.reduce((handlers, eventToPrevent) => (Object.assign(Object.assign({}, handlers), { [eventToPrevent]: (event) => {
|
18312 | event.preventDefault();
|
18313 | } })), {});
|
18314 | const { mountOnEnter, localActiveKey, unmountOnExit, uniqueId, handleTabClick, handleTabClose } = React__namespace.useContext(TabsContext);
|
18315 | let ariaControls = tabContentId ? `${tabContentId}` : `pf-tab-section-${eventKey}-${childId || uniqueId}`;
|
18316 | if ((mountOnEnter || unmountOnExit) && eventKey !== localActiveKey) {
|
18317 | ariaControls = undefined;
|
18318 | }
|
18319 | const isButtonElement = Boolean(!href);
|
18320 | const getDefaultTabIdx = () => {
|
18321 | if (isDisabled) {
|
18322 | return isButtonElement ? null : -1;
|
18323 | }
|
18324 | else if (isAriaDisabled) {
|
18325 | return null;
|
18326 | }
|
18327 | };
|
18328 | const tabButton = (React__namespace.createElement(TabButton, Object.assign({ parentInnerRef: innerRef, className: css(styles$h.tabsLink, isDisabled && href && styles$h.modifiers.disabled, isAriaDisabled && styles$h.modifiers.ariaDisabled), disabled: isButtonElement ? isDisabled : null, "aria-disabled": isDisabled || isAriaDisabled, tabIndex: getDefaultTabIdx(), onClick: (event) => handleTabClick(event, eventKey, tabContentRef) }, (isAriaDisabled ? preventedEvents : null), { id: `pf-tab-${eventKey}-${childId || uniqueId}`, "aria-controls": ariaControls, tabContentRef: tabContentRef, ouiaId: childOuiaId, href: href, role: "tab", "aria-selected": eventKey === localActiveKey }, props), title));
|
18329 | return (React__namespace.createElement("li", { className: css(styles$h.tabsItem, eventKey === localActiveKey && styles$h.modifiers.current, handleTabClose && styles$h.modifiers.action, handleTabClose && (isDisabled || isAriaDisabled) && styles$h.modifiers.disabled, childClassName), role: "presentation" },
|
18330 | tooltip ? React__namespace.createElement(Tooltip, Object.assign({}, tooltip.props), tabButton) : tabButton,
|
18331 | handleTabClose !== undefined && (React__namespace.createElement("span", { className: css(styles$h.tabsItemClose) },
|
18332 | React__namespace.createElement(Button, { variant: "plain", "aria-label": closeButtonAriaLabel || 'Close tab', onClick: (event) => handleTabClose(event, eventKey, tabContentRef), isDisabled: isCloseDisabled },
|
18333 | React__namespace.createElement("span", { className: css(styles$h.tabsItemCloseIcon) },
|
18334 | React__namespace.createElement(TimesIcon$1, null)))))));
|
18335 | };
|
18336 | const Tab = React__namespace.forwardRef((props, ref) => React__namespace.createElement(TabBase, Object.assign({ innerRef: ref }, props)));
|
18337 | Tab.displayName = 'Tab';
|
18338 |
|
18339 | const PlusIconConfig = {
|
18340 | name: 'PlusIcon',
|
18341 | height: 512,
|
18342 | width: 448,
|
18343 | svgPath: 'M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z',
|
18344 | yOffset: 0,
|
18345 | xOffset: 0,
|
18346 | };
|
18347 |
|
18348 | const PlusIcon = createIcon(PlusIconConfig);
|
18349 |
|
18350 | var PlusIcon$1 = PlusIcon;
|
18351 |
|
18352 | Promise.resolve().then(function () { return tabContent; });
|
18353 | var styles$g = {
|
18354 | "modifiers": {
|
18355 | "light_300": "pf-m-light-300",
|
18356 | "padding": "pf-m-padding"
|
18357 | },
|
18358 | "tabContent": "pf-c-tab-content",
|
18359 | "tabContentBody": "pf-c-tab-content__body"
|
18360 | };
|
18361 |
|
18362 | const variantStyle$1 = {
|
18363 | default: '',
|
18364 | light300: styles$g.modifiers.light_300
|
18365 | };
|
18366 | const TabContentBase = (_a) => {
|
18367 | var { id, activeKey, 'aria-label': ariaLabel, child, children, className, eventKey, innerRef, ouiaId, ouiaSafe } = _a, props = __rest$1(_a, ["id", "activeKey", 'aria-label', "child", "children", "className", "eventKey", "innerRef", "ouiaId", "ouiaSafe"]);
|
18368 | if (children || child) {
|
18369 | let labelledBy;
|
18370 | if (ariaLabel) {
|
18371 | labelledBy = null;
|
18372 | }
|
18373 | else {
|
18374 | labelledBy = children ? `pf-tab-${eventKey}-${id}` : `pf-tab-${child.props.eventKey}-${id}`;
|
18375 | }
|
18376 | return (React__namespace.createElement(TabsContextConsumer, null, ({ variant }) => (React__namespace.createElement("section", Object.assign({ ref: innerRef, hidden: children ? null : child.props.eventKey !== activeKey, className: children
|
18377 | ? css('pf-c-tab-content', className, variantStyle$1[variant])
|
18378 | : css('pf-c-tab-content', child.props.className, variantStyle$1[variant]), id: children ? id : `pf-tab-section-${child.props.eventKey}-${id}`, "aria-label": ariaLabel, "aria-labelledby": labelledBy, role: "tabpanel", tabIndex: 0 }, getOUIAProps('TabContent', ouiaId, ouiaSafe), props), children || child.props.children))));
|
18379 | }
|
18380 | return null;
|
18381 | };
|
18382 | const TabContent = React__namespace.forwardRef((props, ref) => (React__namespace.createElement(TabContentBase, Object.assign({}, props, { innerRef: ref }))));
|
18383 |
|
18384 | exports.TabsComponent = void 0;
|
18385 | (function (TabsComponent) {
|
18386 | TabsComponent["div"] = "div";
|
18387 | TabsComponent["nav"] = "nav";
|
18388 | })(exports.TabsComponent || (exports.TabsComponent = {}));
|
18389 | const variantStyle = {
|
18390 | default: '',
|
18391 | light300: styles$h.modifiers.colorSchemeLight_300
|
18392 | };
|
18393 | class Tabs extends React__namespace.Component {
|
18394 | constructor(props) {
|
18395 | super(props);
|
18396 | this.tabList = React__namespace.createRef();
|
18397 | this.scrollTimeout = null;
|
18398 | this.handleScrollButtons = () => {
|
18399 |
|
18400 | clearTimeout(this.scrollTimeout);
|
18401 | this.scrollTimeout = setTimeout(() => {
|
18402 | const container = this.tabList.current;
|
18403 | let disableLeftScrollButton = true;
|
18404 | let disableRightScrollButton = true;
|
18405 | let showScrollButtons = false;
|
18406 | if (container && !this.props.isVertical) {
|
18407 |
|
18408 | const overflowOnLeft = !isElementInView(container, container.firstChild, false);
|
18409 |
|
18410 | const overflowOnRight = !isElementInView(container, container.lastChild, false);
|
18411 | showScrollButtons = overflowOnLeft || overflowOnRight;
|
18412 | disableLeftScrollButton = !overflowOnLeft;
|
18413 | disableRightScrollButton = !overflowOnRight;
|
18414 | }
|
18415 | this.setState({
|
18416 | showScrollButtons,
|
18417 | disableLeftScrollButton,
|
18418 | disableRightScrollButton
|
18419 | });
|
18420 | }, 100);
|
18421 | };
|
18422 | this.scrollLeft = () => {
|
18423 |
|
18424 | if (this.tabList.current) {
|
18425 | const container = this.tabList.current;
|
18426 | const childrenArr = Array.from(container.children);
|
18427 | let firstElementInView;
|
18428 | let lastElementOutOfView;
|
18429 | let i;
|
18430 | for (i = 0; i < childrenArr.length && !firstElementInView; i++) {
|
18431 | if (isElementInView(container, childrenArr[i], false)) {
|
18432 | firstElementInView = childrenArr[i];
|
18433 | lastElementOutOfView = childrenArr[i - 1];
|
18434 | }
|
18435 | }
|
18436 | if (lastElementOutOfView) {
|
18437 | container.scrollLeft -= lastElementOutOfView.scrollWidth;
|
18438 | }
|
18439 | }
|
18440 | };
|
18441 | this.scrollRight = () => {
|
18442 |
|
18443 | if (this.tabList.current) {
|
18444 | const container = this.tabList.current;
|
18445 | const childrenArr = Array.from(container.children);
|
18446 | let lastElementInView;
|
18447 | let firstElementOutOfView;
|
18448 | for (let i = childrenArr.length - 1; i >= 0 && !lastElementInView; i--) {
|
18449 | if (isElementInView(container, childrenArr[i], false)) {
|
18450 | lastElementInView = childrenArr[i];
|
18451 | firstElementOutOfView = childrenArr[i + 1];
|
18452 | }
|
18453 | }
|
18454 | if (firstElementOutOfView) {
|
18455 | container.scrollLeft += firstElementOutOfView.scrollWidth;
|
18456 | }
|
18457 | }
|
18458 | };
|
18459 | this.state = {
|
18460 | showScrollButtons: false,
|
18461 | disableLeftScrollButton: true,
|
18462 | disableRightScrollButton: true,
|
18463 | shownKeys: this.props.defaultActiveKey !== undefined ? [this.props.defaultActiveKey] : [this.props.activeKey],
|
18464 | uncontrolledActiveKey: this.props.defaultActiveKey,
|
18465 | uncontrolledIsExpandedLocal: this.props.defaultIsExpanded,
|
18466 | ouiaStateId: getDefaultOUIAId(Tabs.displayName)
|
18467 | };
|
18468 | if (this.props.isVertical && this.props.expandable !== undefined) {
|
18469 | if (!this.props.toggleAriaLabel && !this.props.toggleText) {
|
18470 |
|
18471 | console.error('Tabs:', 'toggleAriaLabel or the toggleText prop is required to make the toggle button accessible');
|
18472 | }
|
18473 | }
|
18474 | }
|
18475 | handleTabClick(event, eventKey, tabContentRef) {
|
18476 | const { shownKeys } = this.state;
|
18477 | const { onSelect, defaultActiveKey } = this.props;
|
18478 |
|
18479 | if (defaultActiveKey !== undefined) {
|
18480 | this.setState({
|
18481 | uncontrolledActiveKey: eventKey
|
18482 | });
|
18483 | }
|
18484 | else {
|
18485 | onSelect(event, eventKey);
|
18486 | }
|
18487 |
|
18488 | if (tabContentRef) {
|
18489 | React__namespace.Children.toArray(this.props.children)
|
18490 | .map(child => child)
|
18491 | .filter(child => child.props && child.props.tabContentRef && child.props.tabContentRef.current)
|
18492 | .forEach(child => (child.props.tabContentRef.current.hidden = true));
|
18493 |
|
18494 | if (tabContentRef.current) {
|
18495 | tabContentRef.current.hidden = false;
|
18496 | }
|
18497 | }
|
18498 | if (this.props.mountOnEnter) {
|
18499 | this.setState({
|
18500 | shownKeys: shownKeys.concat(eventKey)
|
18501 | });
|
18502 | }
|
18503 | }
|
18504 | componentDidMount() {
|
18505 | if (!this.props.isVertical) {
|
18506 | if (canUseDOM) {
|
18507 | window.addEventListener('resize', this.handleScrollButtons, false);
|
18508 | }
|
18509 |
|
18510 | this.handleScrollButtons();
|
18511 | }
|
18512 | }
|
18513 | componentWillUnmount() {
|
18514 | if (!this.props.isVertical) {
|
18515 | if (canUseDOM) {
|
18516 | window.removeEventListener('resize', this.handleScrollButtons, false);
|
18517 | }
|
18518 | }
|
18519 | clearTimeout(this.scrollTimeout);
|
18520 | }
|
18521 | componentDidUpdate(prevProps) {
|
18522 | const { activeKey, mountOnEnter, children } = this.props;
|
18523 | const { shownKeys } = this.state;
|
18524 | if (prevProps.activeKey !== activeKey && mountOnEnter && shownKeys.indexOf(activeKey) < 0) {
|
18525 | this.setState({
|
18526 | shownKeys: shownKeys.concat(activeKey)
|
18527 | });
|
18528 | }
|
18529 | if (prevProps.children &&
|
18530 | children &&
|
18531 | React__namespace.Children.toArray(prevProps.children).length !== React__namespace.Children.toArray(children).length) {
|
18532 | this.handleScrollButtons();
|
18533 | }
|
18534 | }
|
18535 | render() {
|
18536 | const _a = this.props, { className, children, activeKey, defaultActiveKey, id, isFilled, isSecondary, isVertical, isBox, hasBorderBottom, hasSecondaryBorderBottom, leftScrollAriaLabel, rightScrollAriaLabel, 'aria-label': ariaLabel, component, ouiaId, ouiaSafe, mountOnEnter, unmountOnExit, usePageInsets, inset, variant, expandable, isExpanded, defaultIsExpanded, toggleText, toggleAriaLabel, addButtonAriaLabel, onToggle, onClose, onAdd } = _a, props = __rest$1(_a, ["className", "children", "activeKey", "defaultActiveKey", "id", "isFilled", "isSecondary", "isVertical", "isBox", "hasBorderBottom", "hasSecondaryBorderBottom", "leftScrollAriaLabel", "rightScrollAriaLabel", 'aria-label', "component", "ouiaId", "ouiaSafe", "mountOnEnter", "unmountOnExit", "usePageInsets", "inset", "variant", "expandable", "isExpanded", "defaultIsExpanded", "toggleText", "toggleAriaLabel", "addButtonAriaLabel", "onToggle", "onClose", "onAdd"]);
|
18537 | const { showScrollButtons, disableLeftScrollButton, disableRightScrollButton, shownKeys, uncontrolledActiveKey, uncontrolledIsExpandedLocal } = this.state;
|
18538 | const filteredChildren = React__namespace.Children.toArray(children)
|
18539 | .filter(Boolean)
|
18540 | .filter(child => !child.props.isHidden);
|
18541 | const uniqueId = id || getUniqueId();
|
18542 | const Component = component === exports.TabsComponent.nav ? 'nav' : 'div';
|
18543 | const localActiveKey = defaultActiveKey !== undefined ? uncontrolledActiveKey : activeKey;
|
18544 | const isExpandedLocal = defaultIsExpanded !== undefined ? uncontrolledIsExpandedLocal : isExpanded;
|
18545 |
|
18546 | const toggleTabs = (newValue) => {
|
18547 | if (isExpanded === undefined) {
|
18548 | this.setState({ uncontrolledIsExpandedLocal: newValue });
|
18549 | }
|
18550 | else {
|
18551 | onToggle(newValue);
|
18552 | }
|
18553 | };
|
18554 | return (React__namespace.createElement(TabsContextProvider, { value: {
|
18555 | variant,
|
18556 | mountOnEnter,
|
18557 | unmountOnExit,
|
18558 | localActiveKey,
|
18559 | uniqueId,
|
18560 | handleTabClick: (...args) => this.handleTabClick(...args),
|
18561 | handleTabClose: onClose
|
18562 | } },
|
18563 | React__namespace.createElement(Component, Object.assign({ "aria-label": ariaLabel, className: css(styles$h.tabs, isFilled && styles$h.modifiers.fill, isSecondary && styles$h.modifiers.secondary, isVertical && styles$h.modifiers.vertical, isVertical && expandable && formatBreakpointMods(expandable, styles$h), isVertical && expandable && isExpandedLocal && styles$h.modifiers.expanded, isBox && styles$h.modifiers.box, showScrollButtons && !isVertical && styles$h.modifiers.scrollable, usePageInsets && styles$h.modifiers.pageInsets, !hasBorderBottom && styles$h.modifiers.noBorderBottom, hasSecondaryBorderBottom && styles$h.modifiers.borderBottom, formatBreakpointMods(inset, styles$h), variantStyle[variant], className) }, getOUIAProps(Tabs.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId, ouiaSafe), { id: id && id }, props),
|
18564 | expandable && isVertical && (React__namespace.createElement(GenerateId, null, randomId => (React__namespace.createElement("div", { className: css(styles$h.tabsToggle) },
|
18565 | React__namespace.createElement("div", { className: css(styles$h.tabsToggleButton) },
|
18566 | React__namespace.createElement(Button, { onClick: () => toggleTabs(!isExpandedLocal), variant: "plain", "aria-label": toggleAriaLabel, "aria-expanded": isExpandedLocal, id: `${randomId}-button`, "aria-labelledby": `${randomId}-text ${randomId}-button` },
|
18567 | React__namespace.createElement("span", { className: css(styles$h.tabsToggleIcon) },
|
18568 | React__namespace.createElement(AngleRightIcon$1, { "arian-hidden": "true" })),
|
18569 | toggleText && (React__namespace.createElement("span", { className: css('pf-c-tabs__toggle-text'), id: `${randomId}-text` }, toggleText)))))))),
|
18570 | React__namespace.createElement("button", { className: css(styles$h.tabsScrollButton, isSecondary && buttonStyles.modifiers.secondary), "aria-label": leftScrollAriaLabel, onClick: this.scrollLeft, disabled: disableLeftScrollButton, "aria-hidden": disableLeftScrollButton },
|
18571 | React__namespace.createElement(AngleLeftIcon$1, null)),
|
18572 | React__namespace.createElement("ul", { className: css(styles$h.tabsList), ref: this.tabList, onScroll: this.handleScrollButtons, role: "tablist" }, filteredChildren),
|
18573 | React__namespace.createElement("button", { className: css(styles$h.tabsScrollButton, isSecondary && buttonStyles.modifiers.secondary), "aria-label": rightScrollAriaLabel, onClick: this.scrollRight, disabled: disableRightScrollButton, "aria-hidden": disableRightScrollButton },
|
18574 | React__namespace.createElement(AngleRightIcon$1, null)),
|
18575 | onAdd !== undefined && (React__namespace.createElement("span", { className: css(styles$h.tabsAdd) },
|
18576 | React__namespace.createElement(Button, { variant: "plain", "aria-label": addButtonAriaLabel || 'Add tab', onClick: onAdd },
|
18577 | React__namespace.createElement(PlusIcon$1, null))))),
|
18578 | filteredChildren
|
18579 | .filter(child => child.props.children &&
|
18580 | !(unmountOnExit && child.props.eventKey !== localActiveKey) &&
|
18581 | !(mountOnEnter && shownKeys.indexOf(child.props.eventKey) === -1))
|
18582 | .map(child => (React__namespace.createElement(TabContent, { key: child.props.eventKey, activeKey: localActiveKey, child: child, id: child.props.id || uniqueId, ouiaId: child.props.ouiaId })))));
|
18583 | }
|
18584 | }
|
18585 | Tabs.displayName = 'Tabs';
|
18586 | Tabs.defaultProps = {
|
18587 | activeKey: 0,
|
18588 | onSelect: () => undefined,
|
18589 | isFilled: false,
|
18590 | isSecondary: false,
|
18591 | isVertical: false,
|
18592 | isBox: false,
|
18593 | hasBorderBottom: true,
|
18594 | leftScrollAriaLabel: 'Scroll left',
|
18595 | rightScrollAriaLabel: 'Scroll right',
|
18596 | component: exports.TabsComponent.div,
|
18597 | mountOnEnter: false,
|
18598 | unmountOnExit: false,
|
18599 | ouiaSafe: true,
|
18600 | variant: 'default',
|
18601 |
|
18602 | onToggle: (isExpanded) => undefined
|
18603 | };
|
18604 |
|
18605 | const TabContentBody = (_a) => {
|
18606 | var { children, className, hasPadding } = _a, props = __rest$1(_a, ["children", "className", "hasPadding"]);
|
18607 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$g.tabContentBody, hasPadding && styles$g.modifiers.padding, className) }, props), children));
|
18608 | };
|
18609 | TabContentBody.displayName = 'TabContentBody';
|
18610 |
|
18611 | const TabTitleText = (_a) => {
|
18612 | var { children, className = '' } = _a, props = __rest$1(_a, ["children", "className"]);
|
18613 | return (React__namespace.createElement("span", Object.assign({ className: css(styles$h.tabsItemText, className) }, props), children));
|
18614 | };
|
18615 | TabTitleText.displayName = 'TabTitleText';
|
18616 |
|
18617 | const TabTitleIcon = (_a) => {
|
18618 | var { children, className = '' } = _a, props = __rest$1(_a, ["children", "className"]);
|
18619 | return (React__namespace.createElement("span", Object.assign({ className: css(styles$h.tabsItemIcon, className) }, props), children));
|
18620 | };
|
18621 | TabTitleIcon.displayName = 'TabTitleIcon';
|
18622 |
|
18623 | Promise.resolve().then(function () { return tile; });
|
18624 | var styles$f = {
|
18625 | "modifiers": {
|
18626 | "selected": "pf-m-selected",
|
18627 | "disabled": "pf-m-disabled",
|
18628 | "displayLg": "pf-m-display-lg",
|
18629 | "stacked": "pf-m-stacked"
|
18630 | },
|
18631 | "tile": "pf-c-tile",
|
18632 | "tileBody": "pf-c-tile__body",
|
18633 | "tileHeader": "pf-c-tile__header",
|
18634 | "tileIcon": "pf-c-tile__icon",
|
18635 | "tileTitle": "pf-c-tile__title"
|
18636 | };
|
18637 |
|
18638 | const Tile = (_a) => {
|
18639 | var { children, title, icon, isStacked, isSelected, isDisabled, isDisplayLarge, className } = _a, props = __rest$1(_a, ["children", "title", "icon", "isStacked", "isSelected", "isDisabled", "isDisplayLarge", "className"]);
|
18640 | return (React__namespace.createElement("div", Object.assign({ role: "option", "aria-selected": isSelected }, (isDisabled && { 'aria-disabled': isDisabled }), { className: css(styles$f.tile, isSelected && styles$f.modifiers.selected, isDisabled && styles$f.modifiers.disabled, isDisplayLarge && styles$f.modifiers.displayLg, className), tabIndex: 0 }, props),
|
18641 | React__namespace.createElement("div", { className: css(styles$f.tileHeader, isStacked && styles$f.modifiers.stacked) },
|
18642 | icon && React__namespace.createElement("div", { className: css(styles$f.tileIcon) }, icon),
|
18643 | React__namespace.createElement("div", { className: css(styles$f.tileTitle) }, title)),
|
18644 | children && React__namespace.createElement("div", { className: css(styles$f.tileBody) }, children)));
|
18645 | };
|
18646 | Tile.displayName = 'Tile';
|
18647 |
|
18648 | const amSuffix = ' AM';
|
18649 | const pmSuffix = ' PM';
|
18650 | const makeTimeOptions = (stepMinutes, hour12, delimiter, minTime, maxTime, includeSeconds) => {
|
18651 | const res = [];
|
18652 | const iter = new Date(new Date().setHours(0, 0, 0, 0));
|
18653 | const iterDay = iter.getDay();
|
18654 | while (iter.getDay() === iterDay) {
|
18655 | let hour = iter.getHours();
|
18656 | let suffix = amSuffix;
|
18657 | if (hour12) {
|
18658 | if (hour === 0) {
|
18659 | hour = 12;
|
18660 | }
|
18661 | else if (hour >= 12) {
|
18662 | suffix = pmSuffix;
|
18663 | }
|
18664 | if (hour > 12) {
|
18665 | hour %= 12;
|
18666 | }
|
18667 | }
|
18668 | hour = hour12 ? hour.toString() : hour.toString().padStart(2, '0');
|
18669 | const minutes = iter
|
18670 | .getMinutes()
|
18671 | .toString()
|
18672 | .padStart(2, '0');
|
18673 | const timeOption = `${hour}${delimiter}${minutes}${hour12 ? suffix : ''}`;
|
18674 |
|
18675 | if (isWithinMinMax(minTime, maxTime, timeOption, delimiter, includeSeconds)) {
|
18676 | res.push(timeOption);
|
18677 | }
|
18678 | iter.setMinutes(iter.getMinutes() + stepMinutes);
|
18679 | }
|
18680 | return res;
|
18681 | };
|
18682 | const parseTime = (time, timeRegex, delimiter, is12Hour, includeSeconds) => {
|
18683 | const date = new Date(time);
|
18684 |
|
18685 | if (!isNaN(date.getDate()) && (time instanceof Date || time.includes('T'))) {
|
18686 | const hours = is12Hour
|
18687 | ? `${date.getHours() > 12 ? date.getHours() - 12 : date.getHours()}`
|
18688 | : `${date.getHours()}`.padStart(2, '0');
|
18689 | const minutes = `${date.getMinutes()}`.padStart(2, '0');
|
18690 | const seconds = includeSeconds ? `${date.getSeconds()}`.padStart(2, '0') : '';
|
18691 | const secondsWithDelimiter = seconds ? `${delimiter}${seconds}` : '';
|
18692 | let ampm = '';
|
18693 | if (is12Hour && date.getHours() > 11) {
|
18694 | ampm = pmSuffix;
|
18695 | }
|
18696 | else if (is12Hour) {
|
18697 | ampm = amSuffix;
|
18698 | }
|
18699 | return `${hours}${delimiter}${minutes}${secondsWithDelimiter}${ampm}`;
|
18700 | }
|
18701 | else if (typeof time === 'string') {
|
18702 | time = time.trim();
|
18703 | if (time !== '' && validateTime(time, timeRegex, delimiter, is12Hour)) {
|
18704 | const [, hours, minutes, seconds, suffix = ''] = timeRegex.exec(time);
|
18705 | const secondsWithDelimiter = includeSeconds ? `${delimiter}${seconds !== null && seconds !== void 0 ? seconds : '00'}` : '';
|
18706 | let ampm = '';
|
18707 |
|
18708 | if (is12Hour) {
|
18709 | const uppercaseSuffix = suffix.toUpperCase();
|
18710 | if (uppercaseSuffix === amSuffix.toUpperCase().trim()) {
|
18711 | ampm = amSuffix;
|
18712 | }
|
18713 | else if (uppercaseSuffix === pmSuffix.toUpperCase().trim()) {
|
18714 | ampm = pmSuffix;
|
18715 | }
|
18716 | else {
|
18717 |
|
18718 |
|
18719 | ampm = new Date().getHours() > 11 ? pmSuffix : amSuffix;
|
18720 | }
|
18721 | }
|
18722 | return `${hours}${delimiter}${minutes}${secondsWithDelimiter}${ampm}`;
|
18723 | }
|
18724 | }
|
18725 | return time.toString();
|
18726 | };
|
18727 | const validateTime = (time, timeRegex, delimiter, is12Hour) => {
|
18728 |
|
18729 | const date = new Date(time);
|
18730 | if (!isNaN(date.getDate()) && time.includes('T')) {
|
18731 | return true;
|
18732 | }
|
18733 |
|
18734 | const hours = parseInt(time.split(delimiter)[0]);
|
18735 | const validHours = hours >= (is12Hour ? 1 : 0) && hours <= (is12Hour ? 12 : 23);
|
18736 |
|
18737 |
|
18738 | return time === '' || (timeRegex.test(time) && validHours);
|
18739 | };
|
18740 | const getHours = (time, timeRegex) => {
|
18741 | const parts = time.match(timeRegex);
|
18742 | if (parts && parts.length) {
|
18743 | if (/pm/i.test(parts[4])) {
|
18744 | return parseInt(parts[1]) === 12 ? parseInt(parts[1]) : parseInt(parts[1]) + 12;
|
18745 | }
|
18746 | if (/am/i.test(parts[4])) {
|
18747 | return parseInt(parts[1]) === 12 ? 0 : parseInt(parts[1]);
|
18748 | }
|
18749 | return parseInt(parts[1]);
|
18750 | }
|
18751 | return null;
|
18752 | };
|
18753 | const getMinutes = (time, timeRegex) => {
|
18754 | const parts = time.match(timeRegex);
|
18755 | return parts && parts.length ? parseInt(parts[2]) : null;
|
18756 | };
|
18757 | const getSeconds = (time, timeRegex) => {
|
18758 | var _a;
|
18759 | const seconds = (_a = time.match(timeRegex)) === null || _a === void 0 ? void 0 : _a[3];
|
18760 | return seconds ? parseInt(seconds) : null;
|
18761 | };
|
18762 | const isWithinMinMax = (minTime, maxTime, time, delimiter, includeSeconds) => {
|
18763 |
|
18764 | if (time.trim() === '') {
|
18765 | return true;
|
18766 | }
|
18767 |
|
18768 | const min24HourTime = convertTo24Hour(minTime, delimiter, includeSeconds);
|
18769 | const selected24HourTime = convertTo24Hour(time, delimiter, includeSeconds);
|
18770 | const max24HourTime = convertTo24Hour(maxTime, delimiter, includeSeconds);
|
18771 |
|
18772 | return min24HourTime <= selected24HourTime && selected24HourTime <= max24HourTime;
|
18773 | };
|
18774 | const convertTo24Hour = (time, delimiter, includeSeconds) => {
|
18775 | const timeReg = new RegExp(`^\\s*(\\d\\d?)${delimiter}([0-5]\\d)${delimiter}?([0-5]\\d)?\\s*([AaPp][Mm])?\\s*$`);
|
18776 | const regMatches = timeReg.exec(time);
|
18777 | if (!regMatches || !regMatches.length) {
|
18778 | return;
|
18779 | }
|
18780 | let hours = regMatches[1].padStart(2, '0');
|
18781 | const minutes = regMatches[2];
|
18782 | let seconds = regMatches[3] ? `${delimiter}${regMatches[3]}` : '';
|
18783 |
|
18784 | if (!seconds && includeSeconds) {
|
18785 | seconds = `${delimiter}00`;
|
18786 | }
|
18787 | const suffix = regMatches[4] || '';
|
18788 | if (suffix.toUpperCase() === 'PM' && hours !== '12') {
|
18789 | hours = `${parseInt(hours) + 12}`;
|
18790 | }
|
18791 | else if (suffix.toUpperCase() === 'AM' && hours === '12') {
|
18792 | hours = '00';
|
18793 | }
|
18794 | return `${hours}${delimiter}${minutes}${seconds}`;
|
18795 | };
|
18796 |
|
18797 | class TimePicker extends React__namespace.Component {
|
18798 | constructor(props) {
|
18799 | super(props);
|
18800 | this.baseComponentRef = React__namespace.createRef();
|
18801 | this.toggleRef = React__namespace.createRef();
|
18802 | this.inputRef = React__namespace.createRef();
|
18803 | this.menuRef = React__namespace.createRef();
|
18804 | this.onDocClick = (event) => {
|
18805 | var _a, _b, _c, _d;
|
18806 | const clickedOnToggle = (_b = (_a = this.toggleRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.contains(event.target);
|
18807 | const clickedWithinMenu = (_d = (_c = this.menuRef) === null || _c === void 0 ? void 0 : _c.current) === null || _d === void 0 ? void 0 : _d.contains(event.target);
|
18808 | if (this.state.isOpen && !(clickedOnToggle || clickedWithinMenu)) {
|
18809 | this.onToggle(false);
|
18810 | }
|
18811 | };
|
18812 | this.handleGlobalKeys = (event) => {
|
18813 | var _a, _b, _c, _d;
|
18814 | const { isOpen, focusedIndex, scrollIndex } = this.state;
|
18815 |
|
18816 | if ((_b = (_a = this.inputRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.contains(event.target)) {
|
18817 | if (!isOpen && event.key !== KeyTypes.Tab) {
|
18818 | this.onToggle(true);
|
18819 | }
|
18820 | else if (isOpen) {
|
18821 | if (event.key === KeyTypes.Escape || event.key === KeyTypes.Tab) {
|
18822 | this.onToggle(false);
|
18823 | }
|
18824 | else if (event.key === KeyTypes.Enter) {
|
18825 | if (focusedIndex !== null) {
|
18826 | this.focusSelection(focusedIndex);
|
18827 | event.stopPropagation();
|
18828 | }
|
18829 | else {
|
18830 | this.onToggle(false);
|
18831 | }
|
18832 | }
|
18833 | else if (event.key === KeyTypes.ArrowDown || event.key === KeyTypes.ArrowUp) {
|
18834 | this.focusSelection(scrollIndex);
|
18835 | this.updateFocusedIndex(0);
|
18836 | event.preventDefault();
|
18837 | }
|
18838 | }
|
18839 |
|
18840 | }
|
18841 | else if ((_d = (_c = this.menuRef) === null || _c === void 0 ? void 0 : _c.current) === null || _d === void 0 ? void 0 : _d.contains(event.target)) {
|
18842 | if (event.key === KeyTypes.ArrowDown) {
|
18843 | this.updateFocusedIndex(1);
|
18844 | event.preventDefault();
|
18845 | }
|
18846 | else if (event.key === KeyTypes.ArrowUp) {
|
18847 | this.updateFocusedIndex(-1);
|
18848 | event.preventDefault();
|
18849 | }
|
18850 | else if (event.key === KeyTypes.Escape || event.key === KeyTypes.Tab) {
|
18851 | this.inputRef.current.focus();
|
18852 | this.onToggle(false);
|
18853 | }
|
18854 | }
|
18855 | };
|
18856 | this.updateFocusedIndex = (increment) => {
|
18857 | this.setState(prevState => {
|
18858 | const maxIndex = this.getOptions().length - 1;
|
18859 | let nextIndex = prevState.focusedIndex !== null ? prevState.focusedIndex + increment : prevState.scrollIndex + increment;
|
18860 | if (nextIndex < 0) {
|
18861 | nextIndex = maxIndex;
|
18862 | }
|
18863 | else if (nextIndex > maxIndex) {
|
18864 | nextIndex = 0;
|
18865 | }
|
18866 | this.scrollToIndex(nextIndex);
|
18867 | return {
|
18868 | focusedIndex: nextIndex
|
18869 | };
|
18870 | });
|
18871 | };
|
18872 |
|
18873 | this.getIndexToScroll = (index) => {
|
18874 | if (this.props.menuAppendTo === 'inline') {
|
18875 | return index > 0 ? index - 1 : 0;
|
18876 | }
|
18877 | return index;
|
18878 | };
|
18879 | this.scrollToIndex = (index) => {
|
18880 | this.getOptions()[index].closest(`.${menuStyles.menuContent}`).scrollTop = this.getOptions()[this.getIndexToScroll(index)].offsetTop;
|
18881 | };
|
18882 | this.focusSelection = (index) => {
|
18883 | var _a;
|
18884 | const indexToFocus = index !== -1 ? index : 0;
|
18885 | if ((_a = this.menuRef) === null || _a === void 0 ? void 0 : _a.current) {
|
18886 | this.getOptions()[indexToFocus].querySelector(`.${menuStyles.menuItem}`).focus();
|
18887 | }
|
18888 | };
|
18889 | this.scrollToSelection = (time) => {
|
18890 | const { delimiter, is24Hour } = this.props;
|
18891 | let splitTime = time.split(this.props.delimiter);
|
18892 | let focusedIndex = null;
|
18893 |
|
18894 | if (splitTime.length < 2) {
|
18895 | time = `${time}${delimiter}00`;
|
18896 | splitTime = time.split(delimiter);
|
18897 |
|
18898 | }
|
18899 | else if (splitTime.length > 2) {
|
18900 | time = parseTime(time, this.state.timeRegex, delimiter, !is24Hour, false);
|
18901 | splitTime = time.split(delimiter);
|
18902 | }
|
18903 |
|
18904 | if (!is24Hour && splitTime.length > 1 && splitTime[1].length < 2) {
|
18905 | const minutes = splitTime[1].length === 0 ? '00' : splitTime[1] + '0';
|
18906 | time = `${splitTime[0]}${delimiter}${minutes}${new Date().getHours() > 11 ? pmSuffix : amSuffix}`;
|
18907 | }
|
18908 | else if (!is24Hour &&
|
18909 | splitTime.length > 1 &&
|
18910 | splitTime[1].length === 2 &&
|
18911 | !time.toUpperCase().includes(amSuffix.toUpperCase().trim()) &&
|
18912 | !time.toUpperCase().includes(pmSuffix.toUpperCase().trim())) {
|
18913 | time = `${time}${new Date().getHours() > 11 ? pmSuffix : amSuffix}`;
|
18914 | }
|
18915 | let scrollIndex = this.getOptions().findIndex(option => option.innerText === time);
|
18916 |
|
18917 | if (scrollIndex !== -1) {
|
18918 | this.scrollToIndex(scrollIndex);
|
18919 | focusedIndex = scrollIndex;
|
18920 | }
|
18921 | else if (splitTime.length === 2) {
|
18922 |
|
18923 | let amPm = '';
|
18924 | if (!is24Hour) {
|
18925 | if (splitTime[1].toUpperCase().includes('P')) {
|
18926 | amPm = pmSuffix;
|
18927 | }
|
18928 | else if (splitTime[1].toUpperCase().includes('A')) {
|
18929 | amPm = amSuffix;
|
18930 | }
|
18931 | }
|
18932 | time = `${splitTime[0]}${delimiter}00${amPm}`;
|
18933 | scrollIndex = this.getOptions().findIndex(option => option.innerText === time);
|
18934 | if (scrollIndex !== -1) {
|
18935 | this.scrollToIndex(scrollIndex);
|
18936 | }
|
18937 | }
|
18938 | this.setState({
|
18939 | focusedIndex,
|
18940 | scrollIndex
|
18941 | });
|
18942 | };
|
18943 | this.getRegExp = (includeSeconds = true) => {
|
18944 | const { is24Hour, delimiter } = this.props;
|
18945 | let baseRegex = `\\s*(\\d\\d?)${delimiter}([0-5]\\d)`;
|
18946 | if (includeSeconds) {
|
18947 | baseRegex += `${delimiter}?([0-5]\\d)?`;
|
18948 | }
|
18949 | return new RegExp(`^${baseRegex}${is24Hour ? '' : '\\s*([AaPp][Mm])?'}\\s*$`);
|
18950 | };
|
18951 | this.getOptions = () => {
|
18952 | var _a;
|
18953 | return (((_a = this.menuRef) === null || _a === void 0 ? void 0 : _a.current)
|
18954 | ? Array.from(this.menuRef.current.querySelectorAll(`.${menuStyles.menuListItem}`))
|
18955 | : []);
|
18956 | };
|
18957 | this.isValidFormat = (time) => {
|
18958 | if (this.props.validateTime) {
|
18959 | return this.props.validateTime(time);
|
18960 | }
|
18961 | const { delimiter, is24Hour, includeSeconds } = this.props;
|
18962 | return validateTime(time, this.getRegExp(includeSeconds), delimiter, !is24Hour);
|
18963 | };
|
18964 | this.isValidTime = (time) => {
|
18965 | const { delimiter, includeSeconds } = this.props;
|
18966 | const { minTimeState, maxTimeState } = this.state;
|
18967 | return isWithinMinMax(minTimeState, maxTimeState, time, delimiter, includeSeconds);
|
18968 | };
|
18969 | this.isValid = (time) => this.isValidFormat(time) && this.isValidTime(time);
|
18970 | this.onToggle = (isOpen) => {
|
18971 |
|
18972 | this.setState(prevState => {
|
18973 | const { timeRegex, isInvalid } = prevState;
|
18974 | const { delimiter, is24Hour, includeSeconds } = this.props;
|
18975 | const time = parseTime(prevState.timeState, timeRegex, delimiter, !is24Hour, includeSeconds);
|
18976 | return {
|
18977 | isOpen,
|
18978 | timeState: time,
|
18979 | isInvalid: isOpen ? isInvalid : !this.isValid(time)
|
18980 | };
|
18981 | });
|
18982 | };
|
18983 | this.onSelect = (e) => {
|
18984 | const { timeRegex, timeState } = this.state;
|
18985 | const { delimiter, is24Hour, includeSeconds } = this.props;
|
18986 | const time = parseTime(e.target.textContent, timeRegex, delimiter, !is24Hour, includeSeconds);
|
18987 | if (time !== timeState) {
|
18988 | this.onInputChange(time);
|
18989 | }
|
18990 | this.inputRef.current.focus();
|
18991 | this.setState({
|
18992 | isOpen: false,
|
18993 | isInvalid: false
|
18994 | });
|
18995 | };
|
18996 | this.onInputClick = (e) => {
|
18997 | if (!this.state.isOpen) {
|
18998 | this.onToggle(true);
|
18999 | }
|
19000 | e.stopPropagation();
|
19001 | };
|
19002 | this.onInputChange = (newTime) => {
|
19003 | const { onChange } = this.props;
|
19004 | const { timeRegex } = this.state;
|
19005 | if (onChange) {
|
19006 | onChange(newTime, getHours(newTime, timeRegex), getMinutes(newTime, timeRegex), getSeconds(newTime, timeRegex), this.isValid(newTime));
|
19007 | }
|
19008 | this.scrollToSelection(newTime);
|
19009 | this.setState({
|
19010 | timeState: newTime
|
19011 | });
|
19012 | };
|
19013 | this.onBlur = (event) => {
|
19014 | const { timeRegex } = this.state;
|
19015 | const { delimiter, is24Hour, includeSeconds } = this.props;
|
19016 | const time = parseTime(event.currentTarget.value, timeRegex, delimiter, !is24Hour, includeSeconds);
|
19017 | this.setState({
|
19018 | isInvalid: !this.isValid(time)
|
19019 | });
|
19020 | };
|
19021 | const { is24Hour, delimiter, time, includeSeconds } = this.props;
|
19022 | let { minTime, maxTime } = this.props;
|
19023 | if (minTime === '') {
|
19024 | const minSeconds = includeSeconds ? `${delimiter}00` : '';
|
19025 | minTime = is24Hour ? `00${delimiter}00${minSeconds}` : `12${delimiter}00${minSeconds} AM`;
|
19026 | }
|
19027 | if (maxTime === '') {
|
19028 | const maxSeconds = includeSeconds ? `${delimiter}59` : '';
|
19029 | maxTime = is24Hour ? `23${delimiter}59${maxSeconds}` : `11${delimiter}59${maxSeconds} PM`;
|
19030 | }
|
19031 | const timeRegex = this.getRegExp();
|
19032 | this.state = {
|
19033 | isInvalid: false,
|
19034 | isOpen: false,
|
19035 | timeState: parseTime(time, timeRegex, delimiter, !is24Hour, includeSeconds),
|
19036 | focusedIndex: null,
|
19037 | scrollIndex: 0,
|
19038 | timeRegex,
|
19039 | minTimeState: parseTime(minTime, timeRegex, delimiter, !is24Hour, includeSeconds),
|
19040 | maxTimeState: parseTime(maxTime, timeRegex, delimiter, !is24Hour, includeSeconds)
|
19041 | };
|
19042 | }
|
19043 | componentDidMount() {
|
19044 | document.addEventListener('mousedown', this.onDocClick);
|
19045 | document.addEventListener('touchstart', this.onDocClick);
|
19046 | document.addEventListener('keydown', this.handleGlobalKeys);
|
19047 | }
|
19048 | componentWillUnmount() {
|
19049 | document.removeEventListener('mousedown', this.onDocClick);
|
19050 | document.removeEventListener('touchstart', this.onDocClick);
|
19051 | document.removeEventListener('keydown', this.handleGlobalKeys);
|
19052 | }
|
19053 | componentDidUpdate(prevProps, prevState) {
|
19054 | const { timeState, isOpen, isInvalid, timeRegex } = this.state;
|
19055 | const { time, is24Hour, delimiter, includeSeconds } = this.props;
|
19056 | if (isOpen && !prevState.isOpen && timeState && !isInvalid) {
|
19057 | this.scrollToSelection(timeState);
|
19058 | }
|
19059 | if (delimiter !== prevProps.delimiter) {
|
19060 | this.setState({
|
19061 | timeRegex: this.getRegExp()
|
19062 | });
|
19063 | }
|
19064 | if (time !== '' && time !== prevProps.time) {
|
19065 | this.setState({
|
19066 | timeState: parseTime(time, timeRegex, delimiter, !is24Hour, includeSeconds)
|
19067 | });
|
19068 | }
|
19069 | }
|
19070 | render() {
|
19071 | const _a = this.props, { 'aria-label': ariaLabel, isDisabled, className, placeholder, id, menuAppendTo, is24Hour, invalidFormatErrorMessage, invalidMinMaxErrorMessage, stepMinutes, width, delimiter, inputProps,
|
19072 |
|
19073 | onChange, time, validateTime, minTime, maxTime, includeSeconds } = _a,
|
19074 |
|
19075 | props = __rest$1(_a, ['aria-label', "isDisabled", "className", "placeholder", "id", "menuAppendTo", "is24Hour", "invalidFormatErrorMessage", "invalidMinMaxErrorMessage", "stepMinutes", "width", "delimiter", "inputProps", "onChange", "time", "validateTime", "minTime", "maxTime", "includeSeconds"]);
|
19076 | const { timeState, isOpen, isInvalid, minTimeState, maxTimeState } = this.state;
|
19077 | const style = { '--pf-c-date-picker__input--c-form-control--Width': width };
|
19078 | const options = makeTimeOptions(stepMinutes, !is24Hour, delimiter, minTimeState, maxTimeState, includeSeconds);
|
19079 | const isValidFormat = this.isValidFormat(timeState);
|
19080 | const randomId = id || getUniqueId('time-picker');
|
19081 | const getParentElement = () => {
|
19082 | if (this.baseComponentRef && this.baseComponentRef.current) {
|
19083 | return this.baseComponentRef.current.parentElement;
|
19084 | }
|
19085 | return null;
|
19086 | };
|
19087 | const menuContainer = (React__namespace.createElement(Menu, { ref: this.menuRef, isScrollable: true },
|
19088 | React__namespace.createElement(MenuContent, { maxMenuHeight: "200px" },
|
19089 | React__namespace.createElement(MenuList, { "aria-label": ariaLabel }, options.map((option, index) => (React__namespace.createElement(MenuItem, { onClick: this.onSelect, key: option, id: `${randomId}-option-${index}` }, option)))))));
|
19090 | const textInput = (React__namespace.createElement(TextInput, Object.assign({ "aria-haspopup": "menu", className: css(formStyles.formControl), id: `${randomId}-input`, "aria-label": ariaLabel, validated: isInvalid ? 'error' : 'default', placeholder: placeholder, value: timeState || '', type: "text", iconVariant: "clock", onClick: this.onInputClick, onChange: this.onInputChange, onBlur: this.onBlur, autoComplete: "off", isDisabled: isDisabled, ref: this.inputRef }, inputProps)));
|
19091 | return (React__namespace.createElement("div", { ref: this.baseComponentRef, className: css(datePickerStyles.datePicker, className) },
|
19092 | React__namespace.createElement("div", Object.assign({ className: css(datePickerStyles.datePickerInput), style: style }, props),
|
19093 | React__namespace.createElement(InputGroup, null,
|
19094 | React__namespace.createElement("div", { id: randomId },
|
19095 | React__namespace.createElement("div", { ref: this.toggleRef, style: { paddingLeft: '0' } }, menuAppendTo !== 'inline' ? (React__namespace.createElement(Popper, { appendTo: menuAppendTo === 'parent' ? getParentElement() : menuAppendTo, trigger: textInput, popper: menuContainer, isVisible: isOpen })) : (textInput)),
|
19096 | isOpen && menuAppendTo === 'inline' && menuContainer)),
|
19097 | isInvalid && (React__namespace.createElement("div", { className: css(datePickerStyles.datePickerHelperText, datePickerStyles.modifiers.error) }, !isValidFormat ? invalidFormatErrorMessage : invalidMinMaxErrorMessage)))));
|
19098 | }
|
19099 | }
|
19100 | TimePicker.displayName = 'TimePicker';
|
19101 | TimePicker.defaultProps = {
|
19102 | className: '',
|
19103 | isDisabled: false,
|
19104 | time: '',
|
19105 | is24Hour: false,
|
19106 | invalidFormatErrorMessage: 'Invalid time format',
|
19107 | invalidMinMaxErrorMessage: 'Invalid time entered',
|
19108 | placeholder: 'hh:mm',
|
19109 | delimiter: ':',
|
19110 | 'aria-label': 'Time picker',
|
19111 | width: '150px',
|
19112 | menuAppendTo: 'inline',
|
19113 | stepMinutes: 30,
|
19114 | inputProps: {},
|
19115 | minTime: '',
|
19116 | maxTime: ''
|
19117 | };
|
19118 |
|
19119 | Promise.resolve().then(function () { return toggleGroup; });
|
19120 | var styles$e = {
|
19121 | "modifiers": {
|
19122 | "compact": "pf-m-compact",
|
19123 | "selected": "pf-m-selected",
|
19124 | "disabled": "pf-m-disabled"
|
19125 | },
|
19126 | "toggleGroup": "pf-c-toggle-group",
|
19127 | "toggleGroupButton": "pf-c-toggle-group__button",
|
19128 | "toggleGroupIcon": "pf-c-toggle-group__icon",
|
19129 | "toggleGroupItem": "pf-c-toggle-group__item",
|
19130 | "toggleGroupText": "pf-c-toggle-group__text"
|
19131 | };
|
19132 |
|
19133 | var ToggleGroupItemVariant;
|
19134 | (function (ToggleGroupItemVariant) {
|
19135 | ToggleGroupItemVariant["icon"] = "icon";
|
19136 | ToggleGroupItemVariant["text"] = "text";
|
19137 | })(ToggleGroupItemVariant || (ToggleGroupItemVariant = {}));
|
19138 | const ToggleGroupItemElement = ({ variant, children }) => (React__namespace.createElement("span", { className: css(variant === 'icon' && styles$e.toggleGroupIcon, variant === 'text' && styles$e.toggleGroupText) }, children));
|
19139 | ToggleGroupItemElement.displayName = 'ToggleGroupItemElement';
|
19140 |
|
19141 | const ToggleGroupItem = (_a) => {
|
19142 | var { text, icon, className, isDisabled = false, isSelected = false, 'aria-label': ariaLabel = '', onChange = () => { }, buttonId = '' } = _a, props = __rest$1(_a, ["text", "icon", "className", "isDisabled", "isSelected", 'aria-label', "onChange", "buttonId"]);
|
19143 | const handleChange = (event) => {
|
19144 | onChange(!isSelected, event);
|
19145 | };
|
19146 | if (!ariaLabel && icon && !text) {
|
19147 |
|
19148 | console.warn('An accessible aria-label is required when using the toggle group item icon variant.');
|
19149 | }
|
19150 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$e.toggleGroupItem, className) }, props),
|
19151 | React__namespace.createElement("button", Object.assign({ type: "button", className: css(styles$e.toggleGroupButton, isSelected && styles$e.modifiers.selected), "aria-pressed": isSelected, onClick: handleChange }, (ariaLabel && { 'aria-label': ariaLabel }), (isDisabled && { disabled: true }), (buttonId && { id: buttonId })),
|
19152 | icon ? React__namespace.createElement(ToggleGroupItemElement, { variant: ToggleGroupItemVariant.icon }, icon) : null,
|
19153 | text ? React__namespace.createElement(ToggleGroupItemElement, { variant: ToggleGroupItemVariant.text }, text) : null)));
|
19154 | };
|
19155 | ToggleGroupItem.displayName = 'ToggleGroupItem';
|
19156 |
|
19157 | const ToggleGroup = (_a) => {
|
19158 | var { className, children, isCompact = false, areAllGroupsDisabled = false, 'aria-label': ariaLabel } = _a, props = __rest$1(_a, ["className", "children", "isCompact", "areAllGroupsDisabled", 'aria-label']);
|
19159 | const toggleGroupItemList = React__namespace.Children.map(children, child => {
|
19160 | const childCompName = child.type.name;
|
19161 | return childCompName !== ToggleGroupItem.name
|
19162 | ? child
|
19163 | : React__namespace.cloneElement(child, areAllGroupsDisabled ? { isDisabled: true } : {});
|
19164 | });
|
19165 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$e.toggleGroup, isCompact && styles$e.modifiers.compact, className), role: "group", "aria-label": ariaLabel }, props), toggleGroupItemList));
|
19166 | };
|
19167 | ToggleGroup.displayName = 'ToggleGroup';
|
19168 |
|
19169 | Promise.resolve().then(function () { return toolbar; });
|
19170 | var styles$d = {
|
19171 | "button": "pf-c-button",
|
19172 | "chipGroup": "pf-c-chip-group",
|
19173 | "divider": "pf-c-divider",
|
19174 | "modifiers": {
|
19175 | "hidden": "pf-m-hidden",
|
19176 | "hiddenOnSm": "pf-m-hidden-on-sm",
|
19177 | "visibleOnSm": "pf-m-visible-on-sm",
|
19178 | "hiddenOnMd": "pf-m-hidden-on-md",
|
19179 | "visibleOnMd": "pf-m-visible-on-md",
|
19180 | "hiddenOnLg": "pf-m-hidden-on-lg",
|
19181 | "visibleOnLg": "pf-m-visible-on-lg",
|
19182 | "hiddenOnXl": "pf-m-hidden-on-xl",
|
19183 | "visibleOnXl": "pf-m-visible-on-xl",
|
19184 | "hiddenOn_2xl": "pf-m-hidden-on-2xl",
|
19185 | "visibleOn_2xl": "pf-m-visible-on-2xl",
|
19186 | "pageInsets": "pf-m-page-insets",
|
19187 | "sticky": "pf-m-sticky",
|
19188 | "fullHeight": "pf-m-full-height",
|
19189 | "static": "pf-m-static",
|
19190 | "vertical": "pf-m-vertical",
|
19191 | "buttonGroup": "pf-m-button-group",
|
19192 | "iconButtonGroup": "pf-m-icon-button-group",
|
19193 | "filterGroup": "pf-m-filter-group",
|
19194 | "toggleGroup": "pf-m-toggle-group",
|
19195 | "overflowMenu": "pf-m-overflow-menu",
|
19196 | "bulkSelect": "pf-m-bulk-select",
|
19197 | "expandAll": "pf-m-expand-all",
|
19198 | "expanded": "pf-m-expanded",
|
19199 | "searchFilter": "pf-m-search-filter",
|
19200 | "chipGroup": "pf-m-chip-group",
|
19201 | "label": "pf-m-label",
|
19202 | "pagination": "pf-m-pagination",
|
19203 | "overflowContainer": "pf-m-overflow-container",
|
19204 | "chipContainer": "pf-m-chip-container",
|
19205 | "plain": "pf-m-plain",
|
19206 | "show": "pf-m-show",
|
19207 | "showOnSm": "pf-m-show-on-sm",
|
19208 | "showOnMd": "pf-m-show-on-md",
|
19209 | "showOnLg": "pf-m-show-on-lg",
|
19210 | "showOnXl": "pf-m-show-on-xl",
|
19211 | "showOn_2xl": "pf-m-show-on-2xl",
|
19212 | "alignRight": "pf-m-align-right",
|
19213 | "alignLeft": "pf-m-align-left",
|
19214 | "nowrap": "pf-m-nowrap",
|
19215 | "wrap": "pf-m-wrap",
|
19216 | "alignRightOnSm": "pf-m-align-right-on-sm",
|
19217 | "alignLeftOnSm": "pf-m-align-left-on-sm",
|
19218 | "nowrapOnSm": "pf-m-nowrap-on-sm",
|
19219 | "wrapOnSm": "pf-m-wrap-on-sm",
|
19220 | "alignRightOnMd": "pf-m-align-right-on-md",
|
19221 | "alignLeftOnMd": "pf-m-align-left-on-md",
|
19222 | "nowrapOnMd": "pf-m-nowrap-on-md",
|
19223 | "wrapOnMd": "pf-m-wrap-on-md",
|
19224 | "alignRightOnLg": "pf-m-align-right-on-lg",
|
19225 | "alignLeftOnLg": "pf-m-align-left-on-lg",
|
19226 | "nowrapOnLg": "pf-m-nowrap-on-lg",
|
19227 | "wrapOnLg": "pf-m-wrap-on-lg",
|
19228 | "alignRightOnXl": "pf-m-align-right-on-xl",
|
19229 | "alignLeftOnXl": "pf-m-align-left-on-xl",
|
19230 | "nowrapOnXl": "pf-m-nowrap-on-xl",
|
19231 | "wrapOnXl": "pf-m-wrap-on-xl",
|
19232 | "alignRightOn_2xl": "pf-m-align-right-on-2xl",
|
19233 | "alignLeftOn_2xl": "pf-m-align-left-on-2xl",
|
19234 | "nowrapOn_2xl": "pf-m-nowrap-on-2xl",
|
19235 | "wrapOn_2xl": "pf-m-wrap-on-2xl",
|
19236 | "spaceItemsNone": "pf-m-space-items-none",
|
19237 | "spaceItemsSm": "pf-m-space-items-sm",
|
19238 | "spaceItemsMd": "pf-m-space-items-md",
|
19239 | "spaceItemsLg": "pf-m-space-items-lg",
|
19240 | "spaceItemsNoneOnSm": "pf-m-space-items-none-on-sm",
|
19241 | "spaceItemsSmOnSm": "pf-m-space-items-sm-on-sm",
|
19242 | "spaceItemsMdOnSm": "pf-m-space-items-md-on-sm",
|
19243 | "spaceItemsLgOnSm": "pf-m-space-items-lg-on-sm",
|
19244 | "spaceItemsNoneOnMd": "pf-m-space-items-none-on-md",
|
19245 | "spaceItemsSmOnMd": "pf-m-space-items-sm-on-md",
|
19246 | "spaceItemsMdOnMd": "pf-m-space-items-md-on-md",
|
19247 | "spaceItemsLgOnMd": "pf-m-space-items-lg-on-md",
|
19248 | "spaceItemsNoneOnLg": "pf-m-space-items-none-on-lg",
|
19249 | "spaceItemsSmOnLg": "pf-m-space-items-sm-on-lg",
|
19250 | "spaceItemsMdOnLg": "pf-m-space-items-md-on-lg",
|
19251 | "spaceItemsLgOnLg": "pf-m-space-items-lg-on-lg",
|
19252 | "spaceItemsNoneOnXl": "pf-m-space-items-none-on-xl",
|
19253 | "spaceItemsSmOnXl": "pf-m-space-items-sm-on-xl",
|
19254 | "spaceItemsMdOnXl": "pf-m-space-items-md-on-xl",
|
19255 | "spaceItemsLgOnXl": "pf-m-space-items-lg-on-xl",
|
19256 | "spaceItemsNoneOn_2xl": "pf-m-space-items-none-on-2xl",
|
19257 | "spaceItemsSmOn_2xl": "pf-m-space-items-sm-on-2xl",
|
19258 | "spaceItemsMdOn_2xl": "pf-m-space-items-md-on-2xl",
|
19259 | "spaceItemsLgOn_2xl": "pf-m-space-items-lg-on-2xl",
|
19260 | "spacerNone": "pf-m-spacer-none",
|
19261 | "spacerSm": "pf-m-spacer-sm",
|
19262 | "spacerMd": "pf-m-spacer-md",
|
19263 | "spacerLg": "pf-m-spacer-lg",
|
19264 | "spacerNoneOnSm": "pf-m-spacer-none-on-sm",
|
19265 | "spacerSmOnSm": "pf-m-spacer-sm-on-sm",
|
19266 | "spacerMdOnSm": "pf-m-spacer-md-on-sm",
|
19267 | "spacerLgOnSm": "pf-m-spacer-lg-on-sm",
|
19268 | "spacerNoneOnMd": "pf-m-spacer-none-on-md",
|
19269 | "spacerSmOnMd": "pf-m-spacer-sm-on-md",
|
19270 | "spacerMdOnMd": "pf-m-spacer-md-on-md",
|
19271 | "spacerLgOnMd": "pf-m-spacer-lg-on-md",
|
19272 | "spacerNoneOnLg": "pf-m-spacer-none-on-lg",
|
19273 | "spacerSmOnLg": "pf-m-spacer-sm-on-lg",
|
19274 | "spacerMdOnLg": "pf-m-spacer-md-on-lg",
|
19275 | "spacerLgOnLg": "pf-m-spacer-lg-on-lg",
|
19276 | "spacerNoneOnXl": "pf-m-spacer-none-on-xl",
|
19277 | "spacerSmOnXl": "pf-m-spacer-sm-on-xl",
|
19278 | "spacerMdOnXl": "pf-m-spacer-md-on-xl",
|
19279 | "spacerLgOnXl": "pf-m-spacer-lg-on-xl",
|
19280 | "spacerNoneOn_2xl": "pf-m-spacer-none-on-2xl",
|
19281 | "spacerSmOn_2xl": "pf-m-spacer-sm-on-2xl",
|
19282 | "spacerMdOn_2xl": "pf-m-spacer-md-on-2xl",
|
19283 | "spacerLgOn_2xl": "pf-m-spacer-lg-on-2xl",
|
19284 | "insetNone": "pf-m-inset-none",
|
19285 | "insetSm": "pf-m-inset-sm",
|
19286 | "insetMd": "pf-m-inset-md",
|
19287 | "insetLg": "pf-m-inset-lg",
|
19288 | "insetXl": "pf-m-inset-xl",
|
19289 | "inset_2xl": "pf-m-inset-2xl",
|
19290 | "insetNoneOnSm": "pf-m-inset-none-on-sm",
|
19291 | "insetSmOnSm": "pf-m-inset-sm-on-sm",
|
19292 | "insetMdOnSm": "pf-m-inset-md-on-sm",
|
19293 | "insetLgOnSm": "pf-m-inset-lg-on-sm",
|
19294 | "insetXlOnSm": "pf-m-inset-xl-on-sm",
|
19295 | "inset_2xlOnSm": "pf-m-inset-2xl-on-sm",
|
19296 | "insetNoneOnMd": "pf-m-inset-none-on-md",
|
19297 | "insetSmOnMd": "pf-m-inset-sm-on-md",
|
19298 | "insetMdOnMd": "pf-m-inset-md-on-md",
|
19299 | "insetLgOnMd": "pf-m-inset-lg-on-md",
|
19300 | "insetXlOnMd": "pf-m-inset-xl-on-md",
|
19301 | "inset_2xlOnMd": "pf-m-inset-2xl-on-md",
|
19302 | "insetNoneOnLg": "pf-m-inset-none-on-lg",
|
19303 | "insetSmOnLg": "pf-m-inset-sm-on-lg",
|
19304 | "insetMdOnLg": "pf-m-inset-md-on-lg",
|
19305 | "insetLgOnLg": "pf-m-inset-lg-on-lg",
|
19306 | "insetXlOnLg": "pf-m-inset-xl-on-lg",
|
19307 | "inset_2xlOnLg": "pf-m-inset-2xl-on-lg",
|
19308 | "insetNoneOnXl": "pf-m-inset-none-on-xl",
|
19309 | "insetSmOnXl": "pf-m-inset-sm-on-xl",
|
19310 | "insetMdOnXl": "pf-m-inset-md-on-xl",
|
19311 | "insetLgOnXl": "pf-m-inset-lg-on-xl",
|
19312 | "insetXlOnXl": "pf-m-inset-xl-on-xl",
|
19313 | "inset_2xlOnXl": "pf-m-inset-2xl-on-xl",
|
19314 | "insetNoneOn_2xl": "pf-m-inset-none-on-2xl",
|
19315 | "insetSmOn_2xl": "pf-m-inset-sm-on-2xl",
|
19316 | "insetMdOn_2xl": "pf-m-inset-md-on-2xl",
|
19317 | "insetLgOn_2xl": "pf-m-inset-lg-on-2xl",
|
19318 | "insetXlOn_2xl": "pf-m-inset-xl-on-2xl",
|
19319 | "inset_2xlOn_2xl": "pf-m-inset-2xl-on-2xl"
|
19320 | },
|
19321 | "pagination": "pf-c-pagination",
|
19322 | "toolbar": "pf-c-toolbar",
|
19323 | "toolbarContent": "pf-c-toolbar__content",
|
19324 | "toolbarContentSection": "pf-c-toolbar__content-section",
|
19325 | "toolbarExpandAllIcon": "pf-c-toolbar__expand-all-icon",
|
19326 | "toolbarExpandableContent": "pf-c-toolbar__expandable-content",
|
19327 | "toolbarGroup": "pf-c-toolbar__group",
|
19328 | "toolbarItem": "pf-c-toolbar__item",
|
19329 | "toolbarToggle": "pf-c-toolbar__toggle"
|
19330 | };
|
19331 |
|
19332 | const ToolbarContext = React__namespace.createContext({
|
19333 | isExpanded: false,
|
19334 | toggleIsExpanded: () => { },
|
19335 | chipGroupContentRef: null,
|
19336 | updateNumberFilters: () => { },
|
19337 | numberOfFilters: 0,
|
19338 | clearAllFilters: () => { }
|
19339 | });
|
19340 | const ToolbarContentContext = React__namespace.createContext({
|
19341 | expandableContentRef: null,
|
19342 | expandableContentId: '',
|
19343 | chipContainerRef: null
|
19344 | });
|
19345 | const globalBreakpoints = {
|
19346 | md: parseInt(globalBreakpointMd.value),
|
19347 | lg: parseInt(globalBreakpointLg.value),
|
19348 | xl: parseInt(globalBreakpointXl.value),
|
19349 | '2xl': parseInt(globalBreakpoint2xl.value)
|
19350 | };
|
19351 |
|
19352 | exports.ToolbarItemVariant = void 0;
|
19353 | (function (ToolbarItemVariant) {
|
19354 | ToolbarItemVariant["separator"] = "separator";
|
19355 | ToolbarItemVariant["bulk-select"] = "bulk-select";
|
19356 | ToolbarItemVariant["overflow-menu"] = "overflow-menu";
|
19357 | ToolbarItemVariant["pagination"] = "pagination";
|
19358 | ToolbarItemVariant["search-filter"] = "search-filter";
|
19359 | ToolbarItemVariant["label"] = "label";
|
19360 | ToolbarItemVariant["chip-group"] = "chip-group";
|
19361 | ToolbarItemVariant["expand-all"] = "expand-all";
|
19362 | })(exports.ToolbarItemVariant || (exports.ToolbarItemVariant = {}));
|
19363 | const ToolbarItem = (_a) => {
|
19364 | var { className, variant, visibility, visiblity, alignment, spacer, widths, id, children, isAllExpanded } = _a, props = __rest$1(_a, ["className", "variant", "visibility", "visiblity", "alignment", "spacer", "widths", "id", "children", "isAllExpanded"]);
|
19365 | if (variant === exports.ToolbarItemVariant.separator) {
|
19366 | return React__namespace.createElement(Divider, Object.assign({ className: css(styles$d.modifiers.vertical, className) }, props));
|
19367 | }
|
19368 | if (visiblity !== undefined) {
|
19369 |
|
19370 | console.warn('The ToolbarItem visiblity prop has been deprecated. ' +
|
19371 | 'Please use the correctly spelled visibility prop instead.');
|
19372 | }
|
19373 | const widthStyles = {};
|
19374 | if (widths) {
|
19375 | Object.entries(widths || {}).map(([breakpoint, value]) => (widthStyles[`--pf-c-toolbar__item--Width${breakpoint !== 'default' ? `-on-${breakpoint}` : ''}`] = value));
|
19376 | }
|
19377 | return (React__namespace.createElement(PageContext.Consumer, null, ({ width, getBreakpoint }) => (React__namespace.createElement("div", Object.assign({ className: css(styles$d.toolbarItem, variant &&
|
19378 | styles$d.modifiers[toCamel(variant)], isAllExpanded && styles$d.modifiers.expanded, formatBreakpointMods(visibility || visiblity, styles$d, '', getBreakpoint(width)), formatBreakpointMods(alignment, styles$d, '', getBreakpoint(width)), formatBreakpointMods(spacer, styles$d, '', getBreakpoint(width)), className) }, (variant === 'label' && { 'aria-hidden': true }), { id: id }, props, (widths && { style: Object.assign(Object.assign({}, widthStyles), props.style) })), children))));
|
19379 | };
|
19380 | ToolbarItem.displayName = 'ToolbarItem';
|
19381 |
|
19382 | exports.ToolbarGroupVariant = void 0;
|
19383 | (function (ToolbarGroupVariant) {
|
19384 | ToolbarGroupVariant["filter-group"] = "filter-group";
|
19385 | ToolbarGroupVariant["icon-button-group"] = "icon-button-group";
|
19386 | ToolbarGroupVariant["button-group"] = "button-group";
|
19387 | })(exports.ToolbarGroupVariant || (exports.ToolbarGroupVariant = {}));
|
19388 | class ToolbarGroupWithRef extends React__namespace.Component {
|
19389 | render() {
|
19390 | const _a = this.props, { visibility, visiblity, alignment, spacer, spaceItems, className, variant, children, innerRef } = _a, props = __rest$1(_a, ["visibility", "visiblity", "alignment", "spacer", "spaceItems", "className", "variant", "children", "innerRef"]);
|
19391 | if (visiblity !== undefined) {
|
19392 |
|
19393 | console.warn('The ToolbarGroup visiblity prop has been deprecated. ' +
|
19394 | 'Please use the correctly spelled visibility prop instead.');
|
19395 | }
|
19396 | return (React__namespace.createElement(PageContext.Consumer, null, ({ width, getBreakpoint }) => (React__namespace.createElement("div", Object.assign({ className: css(styles$d.toolbarGroup, variant && styles$d.modifiers[toCamel(variant)], formatBreakpointMods(visibility || visiblity, styles$d, '', getBreakpoint(width)), formatBreakpointMods(alignment, styles$d, '', getBreakpoint(width)), formatBreakpointMods(spacer, styles$d, '', getBreakpoint(width)), formatBreakpointMods(spaceItems, styles$d, '', getBreakpoint(width)), className) }, props, { ref: innerRef }), children))));
|
19397 | }
|
19398 | }
|
19399 | const ToolbarGroup = React__namespace.forwardRef((props, ref) => (React__namespace.createElement(ToolbarGroupWithRef, Object.assign({}, props, { innerRef: ref }))));
|
19400 |
|
19401 | class ToolbarChipGroupContent extends React__namespace.Component {
|
19402 | render() {
|
19403 | const _a = this.props, { className, isExpanded, chipGroupContentRef, clearAllFilters, showClearFiltersButton, clearFiltersButtonText, collapseListedFiltersBreakpoint, numberOfFilters, numberOfFiltersText, customChipGroupContent } = _a, props = __rest$1(_a, ["className", "isExpanded", "chipGroupContentRef", "clearAllFilters", "showClearFiltersButton", "clearFiltersButtonText", "collapseListedFiltersBreakpoint", "numberOfFilters", "numberOfFiltersText", "customChipGroupContent"]);
|
19404 | const clearChipGroups = () => {
|
19405 | clearAllFilters();
|
19406 | };
|
19407 | let collapseListedFilters = false;
|
19408 | if (collapseListedFiltersBreakpoint === 'all') {
|
19409 | collapseListedFilters = true;
|
19410 | }
|
19411 | else if (canUseDOM) {
|
19412 | collapseListedFilters =
|
19413 | (canUseDOM ? window.innerWidth : 1200) < globalBreakpoints[collapseListedFiltersBreakpoint];
|
19414 | }
|
19415 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$d.toolbarContent, (numberOfFilters === 0 || isExpanded) && styles$d.modifiers.hidden, className) }, ((numberOfFilters === 0 || isExpanded) && { hidden: true }), { ref: chipGroupContentRef }, props),
|
19416 | React__namespace.createElement(ToolbarGroup, Object.assign({ className: css(collapseListedFilters && styles$d.modifiers.hidden) }, (collapseListedFilters && { hidden: true }), (collapseListedFilters && { 'aria-hidden': true }))),
|
19417 | collapseListedFilters && numberOfFilters > 0 && !isExpanded && (React__namespace.createElement(ToolbarGroup, null,
|
19418 | React__namespace.createElement(ToolbarItem, null, numberOfFiltersText(numberOfFilters)))),
|
19419 | showClearFiltersButton && !isExpanded && !customChipGroupContent && (React__namespace.createElement(ToolbarItem, null,
|
19420 | React__namespace.createElement(Button, { variant: "link", onClick: clearChipGroups, isInline: true }, clearFiltersButtonText))),
|
19421 | customChipGroupContent && customChipGroupContent));
|
19422 | }
|
19423 | }
|
19424 | ToolbarChipGroupContent.displayName = 'ToolbarChipGroupContent';
|
19425 | ToolbarChipGroupContent.defaultProps = {
|
19426 | clearFiltersButtonText: 'Clear all filters',
|
19427 | collapseListedFiltersBreakpoint: 'lg',
|
19428 | numberOfFiltersText: (numberOfFilters) => `${numberOfFilters} filters applied`
|
19429 | };
|
19430 |
|
19431 | class Toolbar extends React__namespace.Component {
|
19432 | constructor() {
|
19433 | super(...arguments);
|
19434 | this.chipGroupContentRef = React__namespace.createRef();
|
19435 | this.staticFilterInfo = {};
|
19436 | this.state = {
|
19437 | isManagedToggleExpanded: false,
|
19438 | filterInfo: {},
|
19439 | windowWidth: canUseDOM ? window.innerWidth : 1200,
|
19440 | ouiaStateId: getDefaultOUIAId(Toolbar.displayName)
|
19441 | };
|
19442 | this.isToggleManaged = () => !(this.props.isExpanded || !!this.props.toggleIsExpanded);
|
19443 | this.toggleIsExpanded = () => {
|
19444 | this.setState(prevState => ({
|
19445 | isManagedToggleExpanded: !prevState.isManagedToggleExpanded
|
19446 | }));
|
19447 | };
|
19448 | this.closeExpandableContent = (e) => {
|
19449 | if (e.target.innerWidth !== this.state.windowWidth) {
|
19450 | this.setState(() => ({
|
19451 | isManagedToggleExpanded: false,
|
19452 | windowWidth: e.target.innerWidth
|
19453 | }));
|
19454 | }
|
19455 | };
|
19456 | this.updateNumberFilters = (categoryName, numberOfFilters) => {
|
19457 | const filterInfoToUpdate = Object.assign({}, this.staticFilterInfo);
|
19458 | if (!filterInfoToUpdate.hasOwnProperty(categoryName) || filterInfoToUpdate[categoryName] !== numberOfFilters) {
|
19459 | filterInfoToUpdate[categoryName] = numberOfFilters;
|
19460 | this.staticFilterInfo = filterInfoToUpdate;
|
19461 | this.setState({ filterInfo: filterInfoToUpdate });
|
19462 | }
|
19463 | };
|
19464 | this.getNumberOfFilters = () => Object.values(this.state.filterInfo).reduce((acc, cur) => acc + cur, 0);
|
19465 | this.renderToolbar = (randomId) => {
|
19466 | const _a = this.props, { clearAllFilters, clearFiltersButtonText, collapseListedFiltersBreakpoint, isExpanded: isExpandedProp, toggleIsExpanded, className, children, isFullHeight, isStatic, inset, usePageInsets, isSticky, ouiaId, numberOfFiltersText, customChipGroupContent } = _a, props = __rest$1(_a, ["clearAllFilters", "clearFiltersButtonText", "collapseListedFiltersBreakpoint", "isExpanded", "toggleIsExpanded", "className", "children", "isFullHeight", "isStatic", "inset", "usePageInsets", "isSticky", "ouiaId", "numberOfFiltersText", "customChipGroupContent"]);
|
19467 | const { isManagedToggleExpanded } = this.state;
|
19468 | const isToggleManaged = this.isToggleManaged();
|
19469 | const isExpanded = isToggleManaged ? isManagedToggleExpanded : isExpandedProp;
|
19470 | const numberOfFilters = this.getNumberOfFilters();
|
19471 | const showClearFiltersButton = numberOfFilters > 0;
|
19472 | return (React__namespace.createElement(PageContext.Consumer, null, ({ width, getBreakpoint }) => (React__namespace.createElement("div", Object.assign({ className: css(styles$d.toolbar, isFullHeight && styles$d.modifiers.fullHeight, isStatic && styles$d.modifiers.static, usePageInsets && styles$d.modifiers.pageInsets, isSticky && styles$d.modifiers.sticky, formatBreakpointMods(inset, styles$d, '', getBreakpoint(width)), className), id: randomId }, getOUIAProps(Toolbar.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId), props),
|
19473 | React__namespace.createElement(ToolbarContext.Provider, { value: {
|
19474 | isExpanded,
|
19475 | toggleIsExpanded: isToggleManaged ? this.toggleIsExpanded : toggleIsExpanded,
|
19476 | chipGroupContentRef: this.chipGroupContentRef,
|
19477 | updateNumberFilters: this.updateNumberFilters,
|
19478 | numberOfFilters,
|
19479 | clearAllFilters,
|
19480 | clearFiltersButtonText,
|
19481 | showClearFiltersButton,
|
19482 | toolbarId: randomId,
|
19483 | customChipGroupContent
|
19484 | } },
|
19485 | children,
|
19486 | React__namespace.createElement(ToolbarChipGroupContent, { isExpanded: isExpanded, chipGroupContentRef: this.chipGroupContentRef, clearAllFilters: clearAllFilters, showClearFiltersButton: showClearFiltersButton, clearFiltersButtonText: clearFiltersButtonText, numberOfFilters: numberOfFilters, numberOfFiltersText: numberOfFiltersText, collapseListedFiltersBreakpoint: collapseListedFiltersBreakpoint, customChipGroupContent: customChipGroupContent }))))));
|
19487 | };
|
19488 | }
|
19489 | componentDidMount() {
|
19490 | if (this.isToggleManaged() && canUseDOM) {
|
19491 | window.addEventListener('resize', this.closeExpandableContent);
|
19492 | }
|
19493 | }
|
19494 | componentWillUnmount() {
|
19495 | if (this.isToggleManaged() && canUseDOM) {
|
19496 | window.removeEventListener('resize', this.closeExpandableContent);
|
19497 | }
|
19498 | }
|
19499 | render() {
|
19500 | return this.props.id ? (this.renderToolbar(this.props.id)) : (React__namespace.createElement(GenerateId, null, randomId => this.renderToolbar(randomId)));
|
19501 | }
|
19502 | }
|
19503 | Toolbar.displayName = 'Toolbar';
|
19504 |
|
19505 | class ToolbarExpandableContent extends React__namespace.Component {
|
19506 | render() {
|
19507 | const _a = this.props, { className, expandableContentRef, chipContainerRef,
|
19508 |
|
19509 | isExpanded, clearAllFilters, clearFiltersButtonText, showClearFiltersButton } = _a, props = __rest$1(_a, ["className", "expandableContentRef", "chipContainerRef", "isExpanded", "clearAllFilters", "clearFiltersButtonText", "showClearFiltersButton"]);
|
19510 | const { numberOfFilters, customChipGroupContent } = this.context;
|
19511 | const clearChipGroups = () => {
|
19512 | clearAllFilters();
|
19513 | };
|
19514 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$d.toolbarExpandableContent, className), ref: expandableContentRef }, props),
|
19515 | React__namespace.createElement(ToolbarGroup, null),
|
19516 | numberOfFilters > 0 && (React__namespace.createElement(ToolbarGroup, { className: styles$d.modifiers.chipContainer },
|
19517 | React__namespace.createElement(ToolbarGroup, { ref: chipContainerRef }),
|
19518 | showClearFiltersButton && !customChipGroupContent && (React__namespace.createElement(ToolbarItem, null,
|
19519 | React__namespace.createElement(Button, { variant: "link", onClick: clearChipGroups, isInline: true }, clearFiltersButtonText))),
|
19520 | customChipGroupContent && customChipGroupContent))));
|
19521 | }
|
19522 | }
|
19523 | ToolbarExpandableContent.displayName = 'ToolbarExpandableContent';
|
19524 | ToolbarExpandableContent.contextType = ToolbarContext;
|
19525 | ToolbarExpandableContent.defaultProps = {
|
19526 | isExpanded: false,
|
19527 | clearFiltersButtonText: 'Clear all filters'
|
19528 | };
|
19529 |
|
19530 | class ToolbarContent extends React__namespace.Component {
|
19531 | constructor() {
|
19532 | super(...arguments);
|
19533 | this.expandableContentRef = React__namespace.createRef();
|
19534 | this.chipContainerRef = React__namespace.createRef();
|
19535 | }
|
19536 | render() {
|
19537 | const _a = this.props, { className, children, isExpanded, toolbarId, visibility, visiblity, alignment, clearAllFilters, showClearFiltersButton, clearFiltersButtonText } = _a, props = __rest$1(_a, ["className", "children", "isExpanded", "toolbarId", "visibility", "visiblity", "alignment", "clearAllFilters", "showClearFiltersButton", "clearFiltersButtonText"]);
|
19538 | if (visiblity !== undefined) {
|
19539 |
|
19540 | console.warn('The ToolbarContent visiblity prop has been deprecated. ' +
|
19541 | 'Please use the correctly spelled visibility prop instead.');
|
19542 | }
|
19543 | return (React__namespace.createElement(PageContext.Consumer, null, ({ width, getBreakpoint }) => (React__namespace.createElement("div", Object.assign({ className: css(styles$d.toolbarContent, formatBreakpointMods(visibility || visiblity, styles$d, '', getBreakpoint(width)), formatBreakpointMods(alignment, styles$d, '', getBreakpoint(width)), className) }, props),
|
19544 | React__namespace.createElement(ToolbarContext.Consumer, null, ({ clearAllFilters: clearAllFiltersContext, clearFiltersButtonText: clearFiltersButtonContext, showClearFiltersButton: showClearFiltersButtonContext, toolbarId: toolbarIdContext }) => {
|
19545 | const expandableContentId = `${toolbarId ||
|
19546 | toolbarIdContext}-expandable-content-${ToolbarContent.currentId++}`;
|
19547 | return (React__namespace.createElement(ToolbarContentContext.Provider, { value: {
|
19548 | expandableContentRef: this.expandableContentRef,
|
19549 | expandableContentId,
|
19550 | chipContainerRef: this.chipContainerRef
|
19551 | } },
|
19552 | React__namespace.createElement("div", { className: css(styles$d.toolbarContentSection) }, children),
|
19553 | React__namespace.createElement(ToolbarExpandableContent, { id: expandableContentId, isExpanded: isExpanded, expandableContentRef: this.expandableContentRef, chipContainerRef: this.chipContainerRef, clearAllFilters: clearAllFilters || clearAllFiltersContext, showClearFiltersButton: showClearFiltersButton || showClearFiltersButtonContext, clearFiltersButtonText: clearFiltersButtonText || clearFiltersButtonContext })));
|
19554 | })))));
|
19555 | }
|
19556 | }
|
19557 | ToolbarContent.displayName = 'ToolbarContent';
|
19558 | ToolbarContent.currentId = 0;
|
19559 | ToolbarContent.defaultProps = {
|
19560 | isExpanded: false,
|
19561 | showClearFiltersButton: false
|
19562 | };
|
19563 |
|
19564 | const ToolbarExpandIconWrapper = (_a) => {
|
19565 | var { children, className } = _a, props = __rest$1(_a, ["children", "className"]);
|
19566 | return (React__namespace.createElement("span", Object.assign({}, props, { className: css(styles$d.toolbarExpandAllIcon, className) }), children));
|
19567 | };
|
19568 | ToolbarExpandIconWrapper.displayName = 'ToolbarExpandIconWrapper';
|
19569 |
|
19570 | class ToolbarFilter extends React__namespace.Component {
|
19571 | constructor(props) {
|
19572 | super(props);
|
19573 | this.state = {
|
19574 | isMounted: false
|
19575 | };
|
19576 | }
|
19577 | componentDidMount() {
|
19578 | const { categoryName, chips } = this.props;
|
19579 | this.context.updateNumberFilters(typeof categoryName !== 'string' && categoryName.hasOwnProperty('key')
|
19580 | ? categoryName.key
|
19581 | : categoryName.toString(), chips.length);
|
19582 | this.setState({ isMounted: true });
|
19583 | }
|
19584 | componentDidUpdate() {
|
19585 | const { categoryName, chips } = this.props;
|
19586 | this.context.updateNumberFilters(typeof categoryName !== 'string' && categoryName.hasOwnProperty('key')
|
19587 | ? categoryName.key
|
19588 | : categoryName.toString(), chips.length);
|
19589 | }
|
19590 | render() {
|
19591 | const _a = this.props, { children, chips, deleteChipGroup, deleteChip, chipGroupExpandedText, chipGroupCollapsedText, categoryName, showToolbarItem } = _a, props = __rest$1(_a, ["children", "chips", "deleteChipGroup", "deleteChip", "chipGroupExpandedText", "chipGroupCollapsedText", "categoryName", "showToolbarItem"]);
|
19592 | const { isExpanded, chipGroupContentRef } = this.context;
|
19593 | const categoryKey = typeof categoryName !== 'string' && categoryName.hasOwnProperty('key')
|
19594 | ? categoryName.key
|
19595 | : categoryName.toString();
|
19596 | const chipGroup = chips.length ? (React__namespace.createElement(ToolbarItem, { variant: "chip-group" },
|
19597 | React__namespace.createElement(ChipGroup, { key: categoryKey, categoryName: typeof categoryName === 'string' ? categoryName : categoryName.name, isClosable: deleteChipGroup !== undefined, onClick: () => deleteChipGroup(categoryName), collapsedText: chipGroupCollapsedText, expandedText: chipGroupExpandedText }, chips.map(chip => typeof chip === 'string' ? (React__namespace.createElement(Chip, { key: chip, onClick: () => deleteChip(categoryKey, chip) }, chip)) : (React__namespace.createElement(Chip, { key: chip.key, onClick: () => deleteChip(categoryKey, chip) }, chip.node)))))) : null;
|
19598 | if (!isExpanded && this.state.isMounted) {
|
19599 | return (React__namespace.createElement(React__namespace.Fragment, null,
|
19600 | showToolbarItem && React__namespace.createElement(ToolbarItem, Object.assign({}, props), children),
|
19601 | ReactDOM__namespace.createPortal(chipGroup, chipGroupContentRef.current.firstElementChild)));
|
19602 | }
|
19603 | return (React__namespace.createElement(ToolbarContentContext.Consumer, null, ({ chipContainerRef }) => (React__namespace.createElement(React__namespace.Fragment, null,
|
19604 | showToolbarItem && React__namespace.createElement(ToolbarItem, Object.assign({}, props), children),
|
19605 | chipContainerRef.current && ReactDOM__namespace.createPortal(chipGroup, chipContainerRef.current)))));
|
19606 | }
|
19607 | }
|
19608 | ToolbarFilter.displayName = 'ToolbarFilter';
|
19609 | ToolbarFilter.contextType = ToolbarContext;
|
19610 | ToolbarFilter.defaultProps = {
|
19611 | chips: [],
|
19612 | showToolbarItem: true
|
19613 | };
|
19614 |
|
19615 | class ToolbarToggleGroup extends React__namespace.Component {
|
19616 | constructor() {
|
19617 | super(...arguments);
|
19618 | this.isContentPopup = () => {
|
19619 | const viewportSize = canUseDOM ? window.innerWidth : 1200;
|
19620 | const lgBreakpointValue = parseInt(globalBreakpointLg.value);
|
19621 | return viewportSize < lgBreakpointValue;
|
19622 | };
|
19623 | }
|
19624 | render() {
|
19625 | const _a = this.props, { toggleIcon, variant, visibility, visiblity, breakpoint, alignment, spacer, spaceItems, className, children } = _a, props = __rest$1(_a, ["toggleIcon", "variant", "visibility", "visiblity", "breakpoint", "alignment", "spacer", "spaceItems", "className", "children"]);
|
19626 | if (!breakpoint && !toggleIcon) {
|
19627 |
|
19628 | console.error('ToolbarToggleGroup will not be visible without a breakpoint or toggleIcon.');
|
19629 | }
|
19630 | if (visiblity !== undefined) {
|
19631 |
|
19632 | console.warn('The ToolbarToggleGroup visiblity prop has been deprecated. ' +
|
19633 | 'Please use the correctly spelled visibility prop instead.');
|
19634 | }
|
19635 | return (React__namespace.createElement(PageContext.Consumer, null, ({ width, getBreakpoint }) => (React__namespace.createElement(ToolbarContext.Consumer, null, ({ isExpanded, toggleIsExpanded }) => (React__namespace.createElement(ToolbarContentContext.Consumer, null, ({ expandableContentRef, expandableContentId }) => {
|
19636 | if (expandableContentRef.current && expandableContentRef.current.classList) {
|
19637 | if (isExpanded) {
|
19638 | expandableContentRef.current.classList.add(styles$d.modifiers.expanded);
|
19639 | }
|
19640 | else {
|
19641 | expandableContentRef.current.classList.remove(styles$d.modifiers.expanded);
|
19642 | }
|
19643 | }
|
19644 | const breakpointMod = {};
|
19645 | breakpointMod[breakpoint] = 'show';
|
19646 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$d.toolbarGroup, styles$d.modifiers.toggleGroup, variant &&
|
19647 | styles$d.modifiers[toCamel(variant)], formatBreakpointMods(breakpointMod, styles$d, '', getBreakpoint(width)), formatBreakpointMods(visibility || visiblity, styles$d, '', getBreakpoint(width)), formatBreakpointMods(alignment, styles$d, '', getBreakpoint(width)), formatBreakpointMods(spacer, styles$d, '', getBreakpoint(width)), formatBreakpointMods(spaceItems, styles$d, '', getBreakpoint(width)), className) }, props),
|
19648 | React__namespace.createElement("div", { className: css(styles$d.toolbarToggle) },
|
19649 | React__namespace.createElement(Button, Object.assign({ variant: "plain", onClick: toggleIsExpanded, "aria-label": "Show Filters" }, (isExpanded && { 'aria-expanded': true }), { "aria-haspopup": isExpanded && this.isContentPopup(), "aria-controls": expandableContentId }), toggleIcon)),
|
19650 | isExpanded
|
19651 | ? ReactDOM__namespace.createPortal(children, expandableContentRef.current.firstElementChild)
|
19652 | : children));
|
19653 | }))))));
|
19654 | }
|
19655 | }
|
19656 | ToolbarToggleGroup.displayName = 'ToolbarToggleGroup';
|
19657 |
|
19658 | Promise.resolve().then(function () { return numberInput; });
|
19659 | var styles$c = {
|
19660 | "formControl": "pf-c-form-control",
|
19661 | "inputGroup": "pf-c-input-group",
|
19662 | "numberInput": "pf-c-number-input",
|
19663 | "numberInputIcon": "pf-c-number-input__icon",
|
19664 | "numberInputUnit": "pf-c-number-input__unit"
|
19665 | };
|
19666 |
|
19667 | const defaultKeyDownHandler = (args) => (event) => {
|
19668 | if (KEY_CODES.ARROW_UP === event.keyCode && args.onPlus) {
|
19669 | event.preventDefault();
|
19670 | args.onPlus(null, args.inputName);
|
19671 | }
|
19672 | if (KEY_CODES.ARROW_DOWN === event.keyCode && args.onMinus) {
|
19673 | event.preventDefault();
|
19674 | args.onMinus(null, args.inputName);
|
19675 | }
|
19676 | };
|
19677 | const NumberInput = (_a) => {
|
19678 | var { value = 0, className, widthChars, isDisabled = false, onMinus = () => { }, onChange, onBlur, onPlus = () => { }, unit, unitPosition = 'after', min, max, inputName, inputAriaLabel = 'Input', minusBtnAriaLabel = 'Minus', plusBtnAriaLabel = 'Plus', inputProps, minusBtnProps, plusBtnProps } = _a, props = __rest$1(_a, ["value", "className", "widthChars", "isDisabled", "onMinus", "onChange", "onBlur", "onPlus", "unit", "unitPosition", "min", "max", "inputName", "inputAriaLabel", "minusBtnAriaLabel", "plusBtnAriaLabel", "inputProps", "minusBtnProps", "plusBtnProps"]);
|
19679 | const numberInputUnit = React__namespace.createElement("div", { className: css(styles$c.numberInputUnit) }, unit);
|
19680 | const keyDownHandler = inputProps && inputProps.onKeyDown ? inputProps.onKeyDown : defaultKeyDownHandler({ inputName, onMinus, onPlus });
|
19681 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$c.numberInput, className) }, (widthChars && {
|
19682 | style: Object.assign({ '--pf-c-number-input--c-form-control--width-chars': widthChars }, props.style)
|
19683 | }), props),
|
19684 | unit && unitPosition === 'before' && numberInputUnit,
|
19685 | React__namespace.createElement(InputGroup, null,
|
19686 | React__namespace.createElement(Button, Object.assign({ variant: "control", "aria-label": minusBtnAriaLabel, isDisabled: isDisabled || value <= min, onClick: evt => onMinus(evt, inputName) }, minusBtnProps),
|
19687 | React__namespace.createElement("span", { className: css(styles$c.numberInputIcon) },
|
19688 | React__namespace.createElement(MinusIcon$1, { "aria-hidden": "true" }))),
|
19689 | React__namespace.createElement("input", Object.assign({ className: css(styles$c.formControl), type: "number", value: value, name: inputName, "aria-label": inputAriaLabel }, (isDisabled && { disabled: isDisabled }), (onChange && { onChange }), (onBlur && { onBlur }), (!onChange && { readOnly: true }), inputProps, { onKeyDown: keyDownHandler })),
|
19690 | React__namespace.createElement(Button, Object.assign({ variant: "control", "aria-label": plusBtnAriaLabel, isDisabled: isDisabled || value >= max, onClick: evt => onPlus(evt, inputName) }, plusBtnProps),
|
19691 | React__namespace.createElement("span", { className: css(styles$c.numberInputIcon) },
|
19692 | React__namespace.createElement(PlusIcon$1, { "aria-hidden": "true" })))),
|
19693 | unit && unitPosition === 'after' && numberInputUnit));
|
19694 | };
|
19695 | NumberInput.displayName = 'NumberInput';
|
19696 |
|
19697 | const TreeViewList = (_a) => {
|
19698 | var { isNested = false, toolbar, children } = _a, props = __rest$1(_a, ["isNested", "toolbar", "children"]);
|
19699 | return (React__namespace.createElement(React__namespace.Fragment, null,
|
19700 | toolbar && (React__namespace.createElement(React__namespace.Fragment, null,
|
19701 | toolbar,
|
19702 | React__namespace.createElement(Divider, null))),
|
19703 | React__namespace.createElement("ul", Object.assign({ className: css('pf-c-tree-view__list'), role: isNested ? 'group' : 'tree' }, props), children)));
|
19704 | };
|
19705 | TreeViewList.displayName = 'TreeViewList';
|
19706 |
|
19707 | Promise.resolve().then(function () { return treeView; });
|
19708 | var styles$b = {
|
19709 | "badge": "pf-c-badge",
|
19710 | "modifiers": {
|
19711 | "compact": "pf-m-compact",
|
19712 | "guides": "pf-m-guides",
|
19713 | "expanded": "pf-m-expanded",
|
19714 | "noBackground": "pf-m-no-background",
|
19715 | "current": "pf-m-current",
|
19716 | "read": "pf-m-read",
|
19717 | "truncate": "pf-m-truncate"
|
19718 | },
|
19719 | "treeView": "pf-c-tree-view",
|
19720 | "treeViewAction": "pf-c-tree-view__action",
|
19721 | "treeViewContent": "pf-c-tree-view__content",
|
19722 | "treeViewListItem": "pf-c-tree-view__list-item",
|
19723 | "treeViewNode": "pf-c-tree-view__node",
|
19724 | "treeViewNodeCheck": "pf-c-tree-view__node-check",
|
19725 | "treeViewNodeContainer": "pf-c-tree-view__node-container",
|
19726 | "treeViewNodeContent": "pf-c-tree-view__node-content",
|
19727 | "treeViewNodeCount": "pf-c-tree-view__node-count",
|
19728 | "treeViewNodeIcon": "pf-c-tree-view__node-icon",
|
19729 | "treeViewNodeText": "pf-c-tree-view__node-text",
|
19730 | "treeViewNodeTitle": "pf-c-tree-view__node-title",
|
19731 | "treeViewNodeToggle": "pf-c-tree-view__node-toggle",
|
19732 | "treeViewNodeToggleIcon": "pf-c-tree-view__node-toggle-icon",
|
19733 | "treeViewSearch": "pf-c-tree-view__search"
|
19734 | };
|
19735 |
|
19736 | const TreeViewListItemBase = ({ name, title, id, isExpanded, defaultExpanded = false, children = null, onSelect, onCheck, hasCheck = false, checkProps = {
|
19737 | checked: false
|
19738 | }, hasBadge = false, customBadgeContent, badgeProps = { isRead: true }, isCompact, activeItems = [], itemData, parentItem, icon, expandedIcon, action, compareItems,
|
19739 |
|
19740 | useMemo }) => {
|
19741 | const [internalIsExpanded, setIsExpanded] = React.useState(defaultExpanded);
|
19742 | React.useEffect(() => {
|
19743 | if (isExpanded !== undefined && isExpanded !== null) {
|
19744 | setIsExpanded(isExpanded);
|
19745 | }
|
19746 | else if (defaultExpanded !== undefined && defaultExpanded !== null) {
|
19747 | setIsExpanded(internalIsExpanded || defaultExpanded);
|
19748 | }
|
19749 | }, [isExpanded, defaultExpanded]);
|
19750 | const Component = hasCheck ? 'div' : 'button';
|
19751 | const ToggleComponent = hasCheck ? 'button' : 'div';
|
19752 | const renderToggle = (randomId) => (React__default["default"].createElement(ToggleComponent, Object.assign({ className: css(styles$b.treeViewNodeToggle), onClick: () => {
|
19753 | if (hasCheck) {
|
19754 | setIsExpanded(!internalIsExpanded);
|
19755 | }
|
19756 | } }, (hasCheck && { 'aria-labelledby': `label-${randomId}` }), { tabIndex: -1 }),
|
19757 | React__default["default"].createElement("span", { className: css(styles$b.treeViewNodeToggleIcon) },
|
19758 | React__default["default"].createElement(AngleRightIcon$1, { "aria-hidden": "true" }))));
|
19759 | const renderCheck = (randomId) => (React__default["default"].createElement("span", { className: css(styles$b.treeViewNodeCheck) },
|
19760 | React__default["default"].createElement("input", Object.assign({ type: "checkbox", onChange: (evt) => onCheck && onCheck(evt, itemData, parentItem), onClick: (evt) => evt.stopPropagation(), ref: elem => elem && (elem.indeterminate = checkProps.checked === null) }, checkProps, { checked: checkProps.checked === null ? false : checkProps.checked, id: randomId, tabIndex: -1 }))));
|
19761 | const iconRendered = (React__default["default"].createElement("span", { className: css(styles$b.treeViewNodeIcon) },
|
19762 | !internalIsExpanded && icon,
|
19763 | internalIsExpanded && (expandedIcon || icon)));
|
19764 | const renderNodeContent = (randomId) => {
|
19765 | const content = (React__default["default"].createElement(React__default["default"].Fragment, null,
|
19766 | isCompact && title && React__default["default"].createElement("span", { className: css(styles$b.treeViewNodeTitle) }, title),
|
19767 | hasCheck ? (React__default["default"].createElement("label", { className: css(styles$b.treeViewNodeText), htmlFor: randomId, id: `label-${randomId}` }, name)) : (React__default["default"].createElement("span", { className: css(styles$b.treeViewNodeText) }, name))));
|
19768 | return isCompact ? React__default["default"].createElement("div", { className: css(styles$b.treeViewNodeContent) }, content) : content;
|
19769 | };
|
19770 | const badgeRendered = (React__default["default"].createElement(React__default["default"].Fragment, null,
|
19771 | hasBadge && children && (React__default["default"].createElement("span", { className: css(styles$b.treeViewNodeCount) },
|
19772 | React__default["default"].createElement(Badge, Object.assign({}, badgeProps), customBadgeContent ? customBadgeContent : children.props.data.length))),
|
19773 | hasBadge && !children && customBadgeContent !== undefined && (React__default["default"].createElement("span", { className: css(styles$b.treeViewNodeCount) },
|
19774 | React__default["default"].createElement(Badge, Object.assign({}, badgeProps), customBadgeContent)))));
|
19775 | return (React__default["default"].createElement("li", Object.assign({ id: id, className: css(styles$b.treeViewListItem, internalIsExpanded && styles$b.modifiers.expanded) }, (internalIsExpanded && { 'aria-expanded': 'true' }), { role: "treeitem", tabIndex: -1 }),
|
19776 | React__default["default"].createElement("div", { className: css(styles$b.treeViewContent) },
|
19777 | React__default["default"].createElement(GenerateId, { prefix: "checkbox-id" }, randomId => (React__default["default"].createElement(Component, { className: css(styles$b.treeViewNode, !children &&
|
19778 | activeItems &&
|
19779 | activeItems.length > 0 &&
|
19780 | activeItems.some(item => compareItems && item && compareItems(item, itemData))
|
19781 | ? styles$b.modifiers.current
|
19782 | : ''), onClick: (evt) => {
|
19783 | if (!hasCheck) {
|
19784 | onSelect && onSelect(evt, itemData, parentItem);
|
19785 | if (children && evt.isDefaultPrevented() !== true) {
|
19786 | setIsExpanded(!internalIsExpanded);
|
19787 | }
|
19788 | }
|
19789 | }, tabIndex: -1 },
|
19790 | React__default["default"].createElement("div", { className: css(styles$b.treeViewNodeContainer) },
|
19791 | children && renderToggle(randomId),
|
19792 | hasCheck && renderCheck(randomId),
|
19793 | icon && iconRendered,
|
19794 | renderNodeContent(randomId),
|
19795 | badgeRendered)))),
|
19796 | action && React__default["default"].createElement("div", { className: css(styles$b.treeViewAction) }, action)),
|
19797 | internalIsExpanded && children));
|
19798 | };
|
19799 | const TreeViewListItem = React__default["default"].memo(TreeViewListItemBase, (prevProps, nextProps) => {
|
19800 | if (!nextProps.useMemo) {
|
19801 | return false;
|
19802 | }
|
19803 | const prevIncludes = prevProps.activeItems &&
|
19804 | prevProps.activeItems.length > 0 &&
|
19805 | prevProps.activeItems.some(item => prevProps.compareItems && item && prevProps.compareItems(item, prevProps.itemData));
|
19806 | const nextIncludes = nextProps.activeItems &&
|
19807 | nextProps.activeItems.length > 0 &&
|
19808 | nextProps.activeItems.some(item => nextProps.compareItems && item && nextProps.compareItems(item, nextProps.itemData));
|
19809 | if (prevIncludes || nextIncludes) {
|
19810 | return false;
|
19811 | }
|
19812 | if (prevProps.name !== nextProps.name ||
|
19813 | prevProps.title !== nextProps.title ||
|
19814 | prevProps.id !== nextProps.id ||
|
19815 | prevProps.isExpanded !== nextProps.isExpanded ||
|
19816 | prevProps.defaultExpanded !== nextProps.defaultExpanded ||
|
19817 | prevProps.onSelect !== nextProps.onSelect ||
|
19818 | prevProps.onCheck !== nextProps.onCheck ||
|
19819 | prevProps.hasCheck !== nextProps.hasCheck ||
|
19820 | prevProps.checkProps !== nextProps.checkProps ||
|
19821 | prevProps.hasBadge !== nextProps.hasBadge ||
|
19822 | prevProps.customBadgeContent !== nextProps.customBadgeContent ||
|
19823 | prevProps.badgeProps !== nextProps.badgeProps ||
|
19824 | prevProps.isCompact !== nextProps.isCompact ||
|
19825 | prevProps.icon !== nextProps.icon ||
|
19826 | prevProps.expandedIcon !== nextProps.expandedIcon ||
|
19827 | prevProps.action !== nextProps.action ||
|
19828 | prevProps.parentItem !== nextProps.parentItem ||
|
19829 | prevProps.itemData !== nextProps.itemData) {
|
19830 | return false;
|
19831 | }
|
19832 | return true;
|
19833 | });
|
19834 | TreeViewListItem.displayName = 'TreeViewListItem';
|
19835 |
|
19836 | class TreeViewRoot extends React__namespace.Component {
|
19837 | constructor() {
|
19838 | super(...arguments);
|
19839 | this.displayName = 'TreeViewRoot';
|
19840 | this.treeRef = React__namespace.createRef();
|
19841 | this.handleKeys = (event) => {
|
19842 | if (this.treeRef.current !== event.target.closest('.pf-c-tree-view')) {
|
19843 | return;
|
19844 | }
|
19845 | const activeElement = document.activeElement;
|
19846 | const key = event.key;
|
19847 | const treeItems = Array.from(this.treeRef.current.getElementsByClassName('pf-c-tree-view__node')).filter(el => !el.classList.contains('pf-m-disabled'));
|
19848 | if (key === 'Space') {
|
19849 | document.activeElement.click();
|
19850 | event.preventDefault();
|
19851 | }
|
19852 | handleArrows(event, treeItems, (element) => activeElement === element, undefined, [], undefined, true, true);
|
19853 | if (['ArrowLeft', 'ArrowRight'].includes(key)) {
|
19854 | const isExpandable = activeElement.firstElementChild.firstElementChild.classList.contains('pf-c-tree-view__node-toggle');
|
19855 | const isExpanded = activeElement.closest('li').classList.contains('pf-m-expanded');
|
19856 | if (key === 'ArrowLeft') {
|
19857 | if (isExpandable && isExpanded) {
|
19858 | activeElement.click();
|
19859 | }
|
19860 | else {
|
19861 | const parentList = activeElement.closest('ul').parentElement;
|
19862 | if (parentList.tagName !== 'DIV') {
|
19863 | const parentButton = parentList.querySelector('button');
|
19864 | activeElement.tabIndex = -1;
|
19865 | parentButton.tabIndex = 0;
|
19866 | parentButton.focus();
|
19867 | }
|
19868 | }
|
19869 | }
|
19870 | else {
|
19871 | if (isExpandable && !isExpanded) {
|
19872 | activeElement.tabIndex = -1;
|
19873 | activeElement.click();
|
19874 | const childElement = activeElement
|
19875 | .closest('li')
|
19876 | .querySelector('ul > li')
|
19877 | .querySelector('button');
|
19878 | childElement.tabIndex = 0;
|
19879 | childElement.focus();
|
19880 | }
|
19881 | }
|
19882 | event.preventDefault();
|
19883 | }
|
19884 | };
|
19885 | this.handleKeysCheckbox = (event) => {
|
19886 | if (this.treeRef.current !== event.target.closest('.pf-c-tree-view')) {
|
19887 | return;
|
19888 | }
|
19889 | const activeElement = document.activeElement;
|
19890 | const key = event.key;
|
19891 | if (key === 'Space') {
|
19892 | document.activeElement.click();
|
19893 | event.preventDefault();
|
19894 | }
|
19895 | const treeNodes = Array.from(this.treeRef.current.getElementsByClassName('pf-c-tree-view__node'));
|
19896 | handleArrows(event, treeNodes, (element) => element.contains(activeElement), (element) => element.querySelector('BUTTON,INPUT'), [], undefined, true, true);
|
19897 | if (['ArrowLeft', 'ArrowRight'].includes(key)) {
|
19898 | if (key === 'ArrowLeft') {
|
19899 | if (activeElement.tagName === 'INPUT') {
|
19900 | activeElement.parentElement.previousSibling &&
|
19901 | activeElement.parentElement.previousSibling.focus();
|
19902 | }
|
19903 | else if (activeElement.previousSibling) {
|
19904 | if (activeElement.previousElementSibling.tagName === 'SPAN') {
|
19905 | activeElement.previousSibling.firstChild.focus();
|
19906 | }
|
19907 | else {
|
19908 | activeElement.previousSibling.focus();
|
19909 | }
|
19910 | }
|
19911 | }
|
19912 | else {
|
19913 | if (activeElement.tagName === 'INPUT') {
|
19914 | activeElement.parentElement.nextSibling && activeElement.parentElement.nextSibling.focus();
|
19915 | }
|
19916 | else if (activeElement.nextSibling) {
|
19917 | if (activeElement.nextElementSibling.tagName === 'SPAN') {
|
19918 | activeElement.nextSibling.firstChild.focus();
|
19919 | }
|
19920 | else {
|
19921 | activeElement.nextSibling.focus();
|
19922 | }
|
19923 | }
|
19924 | }
|
19925 | event.preventDefault();
|
19926 | }
|
19927 | };
|
19928 | this.variantStyleModifiers = {
|
19929 | default: '',
|
19930 | compact: styles$b.modifiers.compact,
|
19931 | compactNoBackground: [styles$b.modifiers.compact, styles$b.modifiers.noBackground]
|
19932 | };
|
19933 | }
|
19934 | componentDidMount() {
|
19935 | if (canUseDOM) {
|
19936 | window.addEventListener('keydown', this.props.hasChecks ? this.handleKeysCheckbox : this.handleKeys);
|
19937 | }
|
19938 | if (this.props.hasChecks) {
|
19939 | const firstToggle = this.treeRef.current.getElementsByClassName('pf-c-tree-view__node-toggle')[0];
|
19940 | if (firstToggle) {
|
19941 | firstToggle.tabIndex = 0;
|
19942 | }
|
19943 | const firstInput = this.treeRef.current.getElementsByTagName('INPUT')[0];
|
19944 | if (firstInput) {
|
19945 | firstInput.tabIndex = 0;
|
19946 | }
|
19947 | }
|
19948 | else {
|
19949 | this.treeRef.current.getElementsByClassName('pf-c-tree-view__node')[0].tabIndex = 0;
|
19950 | }
|
19951 | }
|
19952 | componentWillUnmount() {
|
19953 | if (canUseDOM) {
|
19954 | window.removeEventListener('keydown', this.props.hasChecks ? this.handleKeysCheckbox : this.handleKeys);
|
19955 | }
|
19956 | }
|
19957 | render() {
|
19958 |
|
19959 | const _a = this.props, { children, hasChecks, hasGuides, variant, className } = _a, props = __rest$1(_a, ["children", "hasChecks", "hasGuides", "variant", "className"]);
|
19960 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$b.treeView, hasGuides && styles$b.modifiers.guides, this.variantStyleModifiers[variant], className), ref: this.treeRef }, props), children));
|
19961 | }
|
19962 | }
|
19963 |
|
19964 | const TreeView = (_a) => {
|
19965 | var { data, isNested = false, hasChecks = false, hasBadges = false, hasGuides = false, variant = 'default', defaultAllExpanded = false, allExpanded, icon, expandedIcon, parentItem, onSelect, onCheck, toolbar, activeItems, compareItems = (item, itemToCheck) => item.id === itemToCheck.id, className, useMemo } = _a, props = __rest$1(_a, ["data", "isNested", "hasChecks", "hasBadges", "hasGuides", "variant", "defaultAllExpanded", "allExpanded", "icon", "expandedIcon", "parentItem", "onSelect", "onCheck", "toolbar", "activeItems", "compareItems", "className", "useMemo"]);
|
19966 | const treeViewList = (React__namespace.createElement(TreeViewList, { isNested: isNested, toolbar: toolbar }, data.map(item => {
|
19967 | var _a;
|
19968 | return (React__namespace.createElement(TreeViewListItem, Object.assign({ key: ((_a = item.id) === null || _a === void 0 ? void 0 : _a.toString()) || item.name.toString(), name: item.name, title: item.title, id: item.id, isExpanded: allExpanded, defaultExpanded: item.defaultExpanded !== undefined ? item.defaultExpanded : defaultAllExpanded, onSelect: onSelect, onCheck: onCheck, hasCheck: item.hasCheck !== undefined ? item.hasCheck : hasChecks, checkProps: item.checkProps, hasBadge: item.hasBadge !== undefined ? item.hasBadge : hasBadges, customBadgeContent: item.customBadgeContent, badgeProps: item.badgeProps, activeItems: activeItems, parentItem: parentItem, itemData: item, icon: item.icon !== undefined ? item.icon : icon, expandedIcon: item.expandedIcon !== undefined ? item.expandedIcon : expandedIcon, action: item.action, compareItems: compareItems, isCompact: variant === 'compact' || variant === 'compactNoBackground', useMemo: useMemo }, (item.children && {
|
19969 | children: (React__namespace.createElement(TreeView, { data: item.children, isNested: true, parentItem: item, hasChecks: hasChecks, hasBadges: hasBadges, hasGuides: hasGuides, variant: variant, allExpanded: allExpanded, defaultAllExpanded: defaultAllExpanded, onSelect: onSelect, onCheck: onCheck, activeItems: activeItems, icon: icon, expandedIcon: expandedIcon }))
|
19970 | }))));
|
19971 | })));
|
19972 | return (React__namespace.createElement(React__namespace.Fragment, null, parentItem ? (treeViewList) : (React__namespace.createElement(TreeViewRoot, Object.assign({ hasChecks: hasChecks, hasGuides: hasGuides, variant: variant, className: className }, props), treeViewList))));
|
19973 | };
|
19974 | TreeView.displayName = 'TreeView';
|
19975 |
|
19976 | const TreeViewSearch = (_a) => {
|
19977 | var { className, onSearch, id, name, 'aria-label': ariaLabel } = _a, props = __rest$1(_a, ["className", "onSearch", "id", "name", 'aria-label']);
|
19978 | return (React__namespace.createElement("div", { className: css(styles$b.treeViewSearch, className) },
|
19979 | React__namespace.createElement("input", Object.assign({ className: css(formStyles.formControl, formStyles.modifiers.search), onChange: onSearch, id: id, name: name, "aria-label": ariaLabel, type: "search" }, props))));
|
19980 | };
|
19981 | TreeViewSearch.displayName = 'TreeViewSearch';
|
19982 |
|
19983 | Promise.resolve().then(function () { return wizard; });
|
19984 | var styles$a = {
|
19985 | "button": "pf-c-button",
|
19986 | "card": "pf-c-card",
|
19987 | "drawer": "pf-c-drawer",
|
19988 | "modalBox": "pf-c-modal-box",
|
19989 | "modifiers": {
|
19990 | "finished": "pf-m-finished",
|
19991 | "expanded": "pf-m-expanded",
|
19992 | "current": "pf-m-current",
|
19993 | "expandable": "pf-m-expandable",
|
19994 | "disabled": "pf-m-disabled",
|
19995 | "noPadding": "pf-m-no-padding"
|
19996 | },
|
19997 | "pageMainWizard": "pf-c-page__main-wizard",
|
19998 | "wizard": "pf-c-wizard",
|
19999 | "wizardClose": "pf-c-wizard__close",
|
20000 | "wizardDescription": "pf-c-wizard__description",
|
20001 | "wizardFooter": "pf-c-wizard__footer",
|
20002 | "wizardFooterCancel": "pf-c-wizard__footer-cancel",
|
20003 | "wizardHeader": "pf-c-wizard__header",
|
20004 | "wizardInnerWrap": "pf-c-wizard__inner-wrap",
|
20005 | "wizardMain": "pf-c-wizard__main",
|
20006 | "wizardMainBody": "pf-c-wizard__main-body",
|
20007 | "wizardNav": "pf-c-wizard__nav",
|
20008 | "wizardNavItem": "pf-c-wizard__nav-item",
|
20009 | "wizardNavLink": "pf-c-wizard__nav-link",
|
20010 | "wizardNavLinkText": "pf-c-wizard__nav-link-text",
|
20011 | "wizardNavLinkToggle": "pf-c-wizard__nav-link-toggle",
|
20012 | "wizardNavLinkToggleIcon": "pf-c-wizard__nav-link-toggle-icon",
|
20013 | "wizardNavList": "pf-c-wizard__nav-list",
|
20014 | "wizardOuterWrap": "pf-c-wizard__outer-wrap",
|
20015 | "wizardTitle": "pf-c-wizard__title",
|
20016 | "wizardToggle": "pf-c-wizard__toggle",
|
20017 | "wizardToggleIcon": "pf-c-wizard__toggle-icon",
|
20018 | "wizardToggleList": "pf-c-wizard__toggle-list",
|
20019 | "wizardToggleListItem": "pf-c-wizard__toggle-list-item",
|
20020 | "wizardToggleNum": "pf-c-wizard__toggle-num",
|
20021 | "wizardToggleSeparator": "pf-c-wizard__toggle-separator"
|
20022 | };
|
20023 |
|
20024 | const WizardFooterInternal = ({ onNext, onBack, onClose, isValid, firstStep, activeStep, nextButtonText, backButtonText, cancelButtonText }) => (React__namespace.createElement("footer", { className: css(styles$a.wizardFooter) },
|
20025 | React__namespace.createElement(Button, { variant: exports.ButtonVariant.primary, type: "submit", onClick: onNext, isDisabled: !isValid }, nextButtonText),
|
20026 | !activeStep.hideBackButton && (React__namespace.createElement(Button, { variant: exports.ButtonVariant.secondary, onClick: onBack, isDisabled: firstStep }, backButtonText)),
|
20027 | !activeStep.hideCancelButton && (React__namespace.createElement("div", { className: styles$a.wizardFooterCancel },
|
20028 | React__namespace.createElement(Button, { variant: exports.ButtonVariant.link, onClick: onClose }, cancelButtonText)))));
|
20029 | WizardFooterInternal.displayName = 'WizardFooterInternal';
|
20030 |
|
20031 | const WizardBody = ({ children, hasNoBodyPadding = false, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, mainComponent = 'div' }) => {
|
20032 | const MainComponent = mainComponent;
|
20033 | return (React__namespace.createElement(MainComponent, { "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, className: css(styles$a.wizardMain) },
|
20034 | React__namespace.createElement("div", { className: css(styles$a.wizardMainBody, hasNoBodyPadding && styles$a.modifiers.noPadding) }, children)));
|
20035 | };
|
20036 | WizardBody.displayName = 'WizardBody';
|
20037 |
|
20038 | const WizardToggle = ({ isNavOpen, onNavToggle, nav, steps, activeStep, children, hasNoBodyPadding = false, 'aria-label': ariaLabel = 'Wizard Toggle', mainAriaLabelledBy = null, mainAriaLabel = null, isInPage = true }) => {
|
20039 | let activeStepIndex;
|
20040 | let activeStepName;
|
20041 | let activeStepSubName;
|
20042 | for (let i = 0; i < steps.length; i++) {
|
20043 | if ((activeStep.id && steps[i].id === activeStep.id) || steps[i].name === activeStep.name) {
|
20044 | activeStepIndex = i + 1;
|
20045 | activeStepName = steps[i].name;
|
20046 | break;
|
20047 | }
|
20048 | else if (steps[i].steps) {
|
20049 | for (const step of steps[i].steps) {
|
20050 | if ((activeStep.id && step.id === activeStep.id) || step.name === activeStep.name) {
|
20051 | activeStepIndex = i + 1;
|
20052 | activeStepName = steps[i].name;
|
20053 | activeStepSubName = step.name;
|
20054 | break;
|
20055 | }
|
20056 | }
|
20057 | }
|
20058 | }
|
20059 | return (React__namespace.createElement(React__namespace.Fragment, null,
|
20060 | React__namespace.createElement("button", { onClick: () => onNavToggle(!isNavOpen), className: css(styles$a.wizardToggle, isNavOpen && 'pf-m-expanded'), "aria-label": ariaLabel, "aria-expanded": isNavOpen },
|
20061 | React__namespace.createElement("span", { className: css(styles$a.wizardToggleList) },
|
20062 | React__namespace.createElement("span", { className: css(styles$a.wizardToggleListItem) },
|
20063 | React__namespace.createElement("span", { className: css(styles$a.wizardToggleNum) }, activeStepIndex),
|
20064 | " ",
|
20065 | activeStepName,
|
20066 | activeStepSubName && React__namespace.createElement(AngleRightIcon$1, { className: css(styles$a.wizardToggleSeparator), "aria-hidden": "true" })),
|
20067 | activeStepSubName && React__namespace.createElement("span", { className: css(styles$a.wizardToggleListItem) }, activeStepSubName)),
|
20068 | React__namespace.createElement("span", { className: css(styles$a.wizardToggleIcon) },
|
20069 | React__namespace.createElement(CaretDownIcon$1, { "aria-hidden": "true" }))),
|
20070 | React__namespace.createElement("div", { className: css(styles$a.wizardOuterWrap) },
|
20071 | React__namespace.createElement("div", { className: css(styles$a.wizardInnerWrap) },
|
20072 | nav(isNavOpen),
|
20073 | React__namespace.createElement(WizardBody, { mainComponent: isInPage ? 'div' : 'main', "aria-label": mainAriaLabel, "aria-labelledby": mainAriaLabelledBy, hasNoBodyPadding: hasNoBodyPadding }, activeStep.component)),
|
20074 | children)));
|
20075 | };
|
20076 | WizardToggle.displayName = 'WizardToggle';
|
20077 |
|
20078 | const WizardNav = ({ children, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, isOpen = false, returnList = false }) => {
|
20079 | const innerList = React__namespace.createElement("ol", { className: css(styles$a.wizardNavList) }, children);
|
20080 | if (returnList) {
|
20081 | return innerList;
|
20082 | }
|
20083 | return (React__namespace.createElement("nav", { className: css(styles$a.wizardNav, isOpen && styles$a.modifiers.expanded), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy },
|
20084 | React__namespace.createElement("ol", { className: css(styles$a.wizardNavList) }, children)));
|
20085 | };
|
20086 | WizardNav.displayName = 'WizardNav';
|
20087 |
|
20088 | const WizardNavItem = (_a) => {
|
20089 | var { children = null, content = '', isCurrent = false, isDisabled = false, step, onNavItemClick = () => undefined, navItemComponent = 'button', href = null, isExpandable = false, id } = _a, rest = __rest$1(_a, ["children", "content", "isCurrent", "isDisabled", "step", "onNavItemClick", "navItemComponent", "href", "isExpandable", "id"]);
|
20090 | const NavItemComponent = navItemComponent;
|
20091 | const [isExpanded, setIsExpanded] = React__namespace.useState(false);
|
20092 | React__namespace.useEffect(() => {
|
20093 | setIsExpanded(isCurrent);
|
20094 | }, [isCurrent]);
|
20095 | if (navItemComponent === 'a' && !href && 'development' !== 'production') {
|
20096 |
|
20097 | console.error('WizardNavItem: When using an anchor, please provide an href');
|
20098 | }
|
20099 | const btnProps = {
|
20100 | disabled: isDisabled
|
20101 | };
|
20102 | const linkProps = {
|
20103 | tabIndex: isDisabled ? -1 : undefined,
|
20104 | href
|
20105 | };
|
20106 | return (React__namespace.createElement("li", { className: css(styles$a.wizardNavItem, isExpandable && styles$a.modifiers.expandable, isExpandable && isExpanded && styles$a.modifiers.expanded) },
|
20107 | React__namespace.createElement(NavItemComponent, Object.assign({}, rest, (navItemComponent === 'a' ? Object.assign({}, linkProps) : Object.assign({}, btnProps)), (id && { id: id.toString() }), { onClick: () => (isExpandable ? setIsExpanded(!isExpanded || isCurrent) : onNavItemClick(step)), className: css(styles$a.wizardNavLink, isCurrent && styles$a.modifiers.current, isDisabled && styles$a.modifiers.disabled), "aria-disabled": isDisabled ? true : null, "aria-current": isCurrent && !children ? 'step' : false }, (isExpandable && { 'aria-expanded': isExpanded })), isExpandable ? (React__namespace.createElement(React__namespace.Fragment, null,
|
20108 | React__namespace.createElement("span", { className: css(styles$a.wizardNavLinkText) }, content),
|
20109 | React__namespace.createElement("span", { className: css(styles$a.wizardNavLinkToggle) },
|
20110 | React__namespace.createElement("span", { className: css(styles$a.wizardNavLinkToggleIcon) },
|
20111 | React__namespace.createElement(AngleRightIcon$1, null))))) : (content)),
|
20112 | children));
|
20113 | };
|
20114 | WizardNavItem.displayName = 'WizardNavItem';
|
20115 |
|
20116 | const WizardContext = React__namespace.createContext({
|
20117 | goToStepById: () => null,
|
20118 | goToStepByName: () => null,
|
20119 | onNext: () => null,
|
20120 | onBack: () => null,
|
20121 | onClose: () => null,
|
20122 | activeStep: { name: null }
|
20123 | });
|
20124 | const WizardContextProvider = WizardContext.Provider;
|
20125 | const WizardContextConsumer = WizardContext.Consumer;
|
20126 |
|
20127 | const WizardHeader = ({ onClose = () => undefined, title, description, hideClose, closeButtonAriaLabel, titleId, descriptionComponent: Component = 'p', descriptionId }) => (React__namespace.createElement("div", { className: css(styles$a.wizardHeader) },
|
20128 | !hideClose && (React__namespace.createElement(Button, { variant: "plain", className: css(styles$a.wizardClose), "aria-label": closeButtonAriaLabel, onClick: onClose },
|
20129 | React__namespace.createElement(TimesIcon$1, { "aria-hidden": "true" }))),
|
20130 | React__namespace.createElement(Title, { headingLevel: "h2", size: "3xl", className: css(styles$a.wizardTitle), "aria-label": title, id: titleId }, title || React__namespace.createElement(React__namespace.Fragment, null, "\u00A0")),
|
20131 | description && (React__namespace.createElement(Component, { className: css(styles$a.wizardDescription), id: descriptionId }, description))));
|
20132 | WizardHeader.displayName = 'WizardHeader';
|
20133 |
|
20134 | class Wizard extends React__namespace.Component {
|
20135 | constructor(props) {
|
20136 | super(props);
|
20137 | this.handleKeyClicks = (event) => {
|
20138 | if (event.keyCode === KEY_CODES.ESCAPE_KEY) {
|
20139 | if (this.state.isNavOpen) {
|
20140 | this.setState({ isNavOpen: !this.state.isNavOpen });
|
20141 | }
|
20142 | else if (this.props.isOpen) {
|
20143 | this.props.onClose();
|
20144 | }
|
20145 | }
|
20146 | };
|
20147 | this.onNext = () => {
|
20148 | const { onNext, onClose, onSave } = this.props;
|
20149 | const { currentStep } = this.state;
|
20150 | const flattenedSteps = this.getFlattenedSteps();
|
20151 | const maxSteps = flattenedSteps.length;
|
20152 | if (currentStep >= maxSteps) {
|
20153 |
|
20154 | if (onSave) {
|
20155 | return onSave();
|
20156 | }
|
20157 | return onClose();
|
20158 | }
|
20159 | else {
|
20160 | const newStep = currentStep + 1;
|
20161 | this.setState({
|
20162 | currentStep: newStep
|
20163 | });
|
20164 | const { id: prevId, name: prevName } = flattenedSteps[currentStep - 1];
|
20165 | const { id, name } = flattenedSteps[newStep - 1];
|
20166 | return onNext && onNext({ id, name }, { prevId, prevName });
|
20167 | }
|
20168 | };
|
20169 | this.onBack = () => {
|
20170 | const { onBack } = this.props;
|
20171 | const { currentStep } = this.state;
|
20172 | const flattenedSteps = this.getFlattenedSteps();
|
20173 | if (flattenedSteps.length < currentStep) {
|
20174 |
|
20175 | const adjustedStep = flattenedSteps.length;
|
20176 | this.setState({
|
20177 | currentStep: adjustedStep
|
20178 | });
|
20179 | }
|
20180 | else {
|
20181 | const newStep = currentStep - 1 <= 0 ? 0 : currentStep - 1;
|
20182 | this.setState({
|
20183 | currentStep: newStep
|
20184 | });
|
20185 | const { id: prevId, name: prevName } = flattenedSteps[newStep];
|
20186 | const { id, name } = flattenedSteps[newStep - 1];
|
20187 | return onBack && onBack({ id, name }, { prevId, prevName });
|
20188 | }
|
20189 | };
|
20190 | this.goToStep = (step) => {
|
20191 | const { onGoToStep } = this.props;
|
20192 | const { currentStep } = this.state;
|
20193 | const flattenedSteps = this.getFlattenedSteps();
|
20194 | const maxSteps = flattenedSteps.length;
|
20195 | if (step < 1) {
|
20196 | step = 1;
|
20197 | }
|
20198 | else if (step > maxSteps) {
|
20199 | step = maxSteps;
|
20200 | }
|
20201 | this.setState({ currentStep: step, isNavOpen: false });
|
20202 | const { id: prevId, name: prevName } = flattenedSteps[currentStep - 1];
|
20203 | const { id, name } = flattenedSteps[step - 1];
|
20204 | return onGoToStep && onGoToStep({ id, name }, { prevId, prevName });
|
20205 | };
|
20206 | this.goToStepById = (stepId) => {
|
20207 | const flattenedSteps = this.getFlattenedSteps();
|
20208 | let step;
|
20209 | for (let i = 0; i < flattenedSteps.length; i++) {
|
20210 | if (flattenedSteps[i].id === stepId) {
|
20211 | step = i + 1;
|
20212 | break;
|
20213 | }
|
20214 | }
|
20215 | if (step) {
|
20216 | this.setState({ currentStep: step });
|
20217 | }
|
20218 | };
|
20219 | this.goToStepByName = (stepName) => {
|
20220 | const flattenedSteps = this.getFlattenedSteps();
|
20221 | let step;
|
20222 | for (let i = 0; i < flattenedSteps.length; i++) {
|
20223 | if (flattenedSteps[i].name === stepName) {
|
20224 | step = i + 1;
|
20225 | break;
|
20226 | }
|
20227 | }
|
20228 | if (step) {
|
20229 | this.setState({ currentStep: step });
|
20230 | }
|
20231 | };
|
20232 | this.getFlattenedSteps = () => {
|
20233 | const { steps } = this.props;
|
20234 | const flattenedSteps = [];
|
20235 | for (const step of steps) {
|
20236 | if (step.steps) {
|
20237 | for (const childStep of step.steps) {
|
20238 | flattenedSteps.push(childStep);
|
20239 | }
|
20240 | }
|
20241 | else {
|
20242 | flattenedSteps.push(step);
|
20243 | }
|
20244 | }
|
20245 | return flattenedSteps;
|
20246 | };
|
20247 | this.getFlattenedStepsIndex = (flattenedSteps, stepName) => {
|
20248 | for (let i = 0; i < flattenedSteps.length; i++) {
|
20249 | if (flattenedSteps[i].name === stepName) {
|
20250 | return i + 1;
|
20251 | }
|
20252 | }
|
20253 | return 0;
|
20254 | };
|
20255 | this.initSteps = (steps) => {
|
20256 |
|
20257 | for (let i = 0; i < steps.length; i++) {
|
20258 | if (steps[i].steps) {
|
20259 | for (let j = 0; j < steps[i].steps.length; j++) {
|
20260 | steps[i].steps[j] = Object.assign({ canJumpTo: true }, steps[i].steps[j]);
|
20261 | }
|
20262 | }
|
20263 | steps[i] = Object.assign({ canJumpTo: true }, steps[i]);
|
20264 | }
|
20265 | return steps;
|
20266 | };
|
20267 | this.getElement = (appendTo) => {
|
20268 | if (typeof appendTo === 'function') {
|
20269 | return appendTo();
|
20270 | }
|
20271 | return appendTo || document.body;
|
20272 | };
|
20273 | const newId = Wizard.currentId++;
|
20274 | this.titleId = props.titleId || `pf-wizard-title-${newId}`;
|
20275 | this.descriptionId = props.descriptionId || `pf-wizard-description-${newId}`;
|
20276 | this.state = {
|
20277 | currentStep: this.props.startAtStep && Number.isInteger(this.props.startAtStep) ? this.props.startAtStep : 1,
|
20278 | isNavOpen: false
|
20279 | };
|
20280 | }
|
20281 | componentDidMount() {
|
20282 | const target = typeof document !== 'undefined' ? document.body : null;
|
20283 | if (target) {
|
20284 | target.addEventListener('keydown', this.handleKeyClicks, false);
|
20285 | }
|
20286 | }
|
20287 | componentWillUnmount() {
|
20288 | const target = (typeof document !== 'undefined' && document.body) || null;
|
20289 | if (target) {
|
20290 | target.removeEventListener('keydown', this.handleKeyClicks, false);
|
20291 | }
|
20292 | }
|
20293 | render() {
|
20294 | const _a = this.props, {
|
20295 |
|
20296 | width, height, title, description, descriptionComponent, onClose, onSave, onBack, onNext, onGoToStep, className, steps, startAtStep, nextButtonText = 'Next', backButtonText = 'Back', cancelButtonText = 'Cancel', hideClose, closeButtonAriaLabel = 'Close', navAriaLabel, navAriaLabelledBy, mainAriaLabel, mainAriaLabelledBy, hasNoBodyPadding, footer, appendTo, isOpen, titleId, descriptionId, isNavExpandable } = _a, rest = __rest$1(_a, ["width", "height", "title", "description", "descriptionComponent", "onClose", "onSave", "onBack", "onNext", "onGoToStep", "className", "steps", "startAtStep", "nextButtonText", "backButtonText", "cancelButtonText", "hideClose", "closeButtonAriaLabel", "navAriaLabel", "navAriaLabelledBy", "mainAriaLabel", "mainAriaLabelledBy", "hasNoBodyPadding", "footer", "appendTo", "isOpen", "titleId", "descriptionId", "isNavExpandable"])
|
20297 |
|
20298 | ;
|
20299 | const { currentStep } = this.state;
|
20300 | const flattenedSteps = this.getFlattenedSteps();
|
20301 | const adjustedStep = flattenedSteps.length < currentStep ? flattenedSteps.length : currentStep;
|
20302 | const activeStep = flattenedSteps[adjustedStep - 1];
|
20303 | const computedSteps = this.initSteps(steps);
|
20304 | const firstStep = activeStep === flattenedSteps[0];
|
20305 | const isValid = activeStep && activeStep.enableNext !== undefined ? activeStep.enableNext : true;
|
20306 | const nav = (isWizardNavOpen) => {
|
20307 | const wizNavAProps = {
|
20308 | isOpen: isWizardNavOpen,
|
20309 | 'aria-label': navAriaLabel,
|
20310 | 'aria-labelledby': (title || navAriaLabelledBy) && (navAriaLabelledBy || this.titleId)
|
20311 | };
|
20312 | return (React__namespace.createElement(WizardNav, Object.assign({}, wizNavAProps), computedSteps.map((step, index) => {
|
20313 | if (step.isFinishedStep) {
|
20314 |
|
20315 | return;
|
20316 | }
|
20317 | let enabled;
|
20318 | let navItemStep;
|
20319 | if (step.steps) {
|
20320 | let hasActiveChild = false;
|
20321 | let canJumpToParent = false;
|
20322 | for (const subStep of step.steps) {
|
20323 | if (activeStep.name === subStep.name) {
|
20324 |
|
20325 | hasActiveChild = true;
|
20326 | }
|
20327 | if (subStep.canJumpTo) {
|
20328 | canJumpToParent = true;
|
20329 | }
|
20330 | }
|
20331 | navItemStep = this.getFlattenedStepsIndex(flattenedSteps, step.steps[0].name);
|
20332 | return (React__namespace.createElement(WizardNavItem, { key: index, id: step.id, content: step.name, isExpandable: isNavExpandable, isCurrent: hasActiveChild, isDisabled: !canJumpToParent, step: navItemStep, onNavItemClick: this.goToStep },
|
20333 | React__namespace.createElement(WizardNav, Object.assign({}, wizNavAProps, { returnList: true }), step.steps.map((childStep, indexChild) => {
|
20334 | if (childStep.isFinishedStep) {
|
20335 |
|
20336 | return;
|
20337 | }
|
20338 | navItemStep = this.getFlattenedStepsIndex(flattenedSteps, childStep.name);
|
20339 | enabled = childStep.canJumpTo;
|
20340 | return (React__namespace.createElement(WizardNavItem, { key: `child_${indexChild}`, id: childStep.id, content: childStep.name, isCurrent: activeStep.name === childStep.name, isDisabled: !enabled, step: navItemStep, onNavItemClick: this.goToStep }));
|
20341 | }))));
|
20342 | }
|
20343 | navItemStep = this.getFlattenedStepsIndex(flattenedSteps, step.name);
|
20344 | enabled = step.canJumpTo;
|
20345 | return (React__namespace.createElement(WizardNavItem, Object.assign({}, step.stepNavItemProps, { key: index, id: step.id, content: step.name, isCurrent: activeStep.name === step.name, isDisabled: !enabled, step: navItemStep, onNavItemClick: this.goToStep })));
|
20346 | })));
|
20347 | };
|
20348 | const context = {
|
20349 | goToStepById: this.goToStepById,
|
20350 | goToStepByName: this.goToStepByName,
|
20351 | onNext: this.onNext,
|
20352 | onBack: this.onBack,
|
20353 | onClose,
|
20354 | activeStep
|
20355 | };
|
20356 | const divStyles = Object.assign(Object.assign({}, (height ? { height } : {})), (width ? { width } : {}));
|
20357 | const wizard = (React__namespace.createElement(WizardContextProvider, { value: context },
|
20358 | React__namespace.createElement("div", Object.assign({}, rest, { className: css(styles$a.wizard, activeStep && activeStep.isFinishedStep && 'pf-m-finished', className), style: Object.keys(divStyles).length ? divStyles : undefined }),
|
20359 | title && (React__namespace.createElement(WizardHeader, { titleId: this.titleId, descriptionId: this.descriptionId, onClose: onClose, title: title, description: description, descriptionComponent: descriptionComponent, closeButtonAriaLabel: closeButtonAriaLabel, hideClose: hideClose })),
|
20360 | React__namespace.createElement(WizardToggle, { mainAriaLabel: mainAriaLabel, isInPage: isOpen === undefined, mainAriaLabelledBy: (title || mainAriaLabelledBy) && (mainAriaLabelledBy || this.titleId), isNavOpen: this.state.isNavOpen, onNavToggle: isNavOpen => this.setState({ isNavOpen }), nav: nav, steps: steps, activeStep: activeStep, hasNoBodyPadding: hasNoBodyPadding }, footer || (React__namespace.createElement(WizardFooterInternal, { onNext: this.onNext, onBack: this.onBack, onClose: onClose, isValid: isValid, firstStep: firstStep, activeStep: activeStep, nextButtonText: (activeStep && activeStep.nextButtonText) || nextButtonText, backButtonText: backButtonText, cancelButtonText: cancelButtonText }))))));
|
20361 | if (isOpen !== undefined) {
|
20362 | return (React__namespace.createElement(Modal, { width: width !== null ? width : undefined, isOpen: isOpen, variant: exports.ModalVariant.large, "aria-labelledby": this.titleId, "aria-describedby": this.descriptionId, showClose: false, hasNoBodyWrapper: true }, wizard));
|
20363 | }
|
20364 | return wizard;
|
20365 | }
|
20366 | }
|
20367 | Wizard.displayName = 'Wizard';
|
20368 | Wizard.currentId = 0;
|
20369 | Wizard.defaultProps = {
|
20370 | title: null,
|
20371 | description: '',
|
20372 | descriptionComponent: 'p',
|
20373 | className: '',
|
20374 | startAtStep: 1,
|
20375 | nextButtonText: 'Next',
|
20376 | backButtonText: 'Back',
|
20377 | cancelButtonText: 'Cancel',
|
20378 | hideClose: false,
|
20379 | closeButtonAriaLabel: 'Close',
|
20380 | navAriaLabel: null,
|
20381 | navAriaLabelledBy: null,
|
20382 | mainAriaLabel: null,
|
20383 | mainAriaLabelledBy: null,
|
20384 | hasNoBodyPadding: false,
|
20385 | onBack: null,
|
20386 | onNext: null,
|
20387 | onGoToStep: null,
|
20388 | width: null,
|
20389 | height: null,
|
20390 | footer: null,
|
20391 | onClose: () => undefined,
|
20392 | appendTo: null,
|
20393 | isOpen: undefined,
|
20394 | isNavExpandable: false
|
20395 | };
|
20396 |
|
20397 | const WizardFooter = ({ children }) => (React__namespace.createElement("footer", { className: css(styles$a.wizardFooter) }, children));
|
20398 | WizardFooter.displayName = 'WizardFooter';
|
20399 |
|
20400 | const DragDropContext = React__namespace.createContext({
|
20401 | onDrag: (_source) => true,
|
20402 | onDragMove: (_source, _dest) => { },
|
20403 | onDrop: (_source, _dest) => false
|
20404 | });
|
20405 | const DragDrop = ({ children, onDrag = () => true, onDragMove = () => { }, onDrop = () => false }) => (React__namespace.createElement(DragDropContext.Provider, { value: { onDrag, onDragMove, onDrop } }, children));
|
20406 | DragDrop.displayName = 'DragDrop';
|
20407 |
|
20408 | Promise.resolve().then(function () { return dragDrop; });
|
20409 | var styles$9 = {
|
20410 | "draggable": "pf-c-draggable",
|
20411 | "droppable": "pf-c-droppable",
|
20412 | "modifiers": {
|
20413 | "dragging": "pf-m-dragging",
|
20414 | "dragOutside": "pf-m-drag-outside"
|
20415 | }
|
20416 | };
|
20417 |
|
20418 | const DroppableContext = React__namespace.createContext({
|
20419 | zone: 'defaultDroppableZone',
|
20420 | droppableId: 'defaultDroppableId'
|
20421 | });
|
20422 |
|
20423 |
|
20424 | function getDefaultBackground() {
|
20425 | const div = document.createElement('div');
|
20426 | document.head.appendChild(div);
|
20427 | const bg = window.getComputedStyle(div).backgroundColor;
|
20428 | document.head.removeChild(div);
|
20429 | return bg;
|
20430 | }
|
20431 | function getInheritedBackgroundColor(el) {
|
20432 | const defaultStyle = getDefaultBackground();
|
20433 | const backgroundColor = window.getComputedStyle(el).backgroundColor;
|
20434 | if (backgroundColor !== defaultStyle) {
|
20435 | return backgroundColor;
|
20436 | }
|
20437 | else if (!el.parentElement) {
|
20438 | return defaultStyle;
|
20439 | }
|
20440 | return getInheritedBackgroundColor(el.parentElement);
|
20441 | }
|
20442 | function removeBlankDiv(node) {
|
20443 | if (node.getAttribute('blankDiv') === 'true') {
|
20444 |
|
20445 | for (let i = 0; i < node.children.length; i++) {
|
20446 | const child = node.children[i];
|
20447 | if (child.getAttribute('blankDiv') === 'true') {
|
20448 | node.removeChild(child);
|
20449 | node.setAttribute('blankDiv', 'false');
|
20450 | break;
|
20451 | }
|
20452 | }
|
20453 | }
|
20454 | }
|
20455 |
|
20456 | function resetDroppableItem(droppableItem) {
|
20457 | removeBlankDiv(droppableItem.node);
|
20458 | droppableItem.node.classList.remove(styles$9.modifiers.dragging);
|
20459 | droppableItem.node.classList.remove(styles$9.modifiers.dragOutside);
|
20460 | droppableItem.draggableNodes.forEach((n, i) => {
|
20461 | n.style.transform = '';
|
20462 | n.style.transition = '';
|
20463 | droppableItem.draggableNodesRects[i] = n.getBoundingClientRect();
|
20464 | });
|
20465 | }
|
20466 | function overlaps(ev, rect) {
|
20467 | return (ev.clientX > rect.x && ev.clientX < rect.x + rect.width && ev.clientY > rect.y && ev.clientY < rect.y + rect.height);
|
20468 | }
|
20469 | const Draggable = (_a) => {
|
20470 | var { className, children, style: styleProp = {}, hasNoWrapper = false } = _a, props = __rest$1(_a, ["className", "children", "style", "hasNoWrapper"]);
|
20471 |
|
20472 | let [style, setStyle] = React__namespace.useState(styleProp);
|
20473 |
|
20474 | const [isDragging, setIsDragging] = React__namespace.useState(false);
|
20475 | const [isValidDrag, setIsValidDrag] = React__namespace.useState(true);
|
20476 | const { zone, droppableId } = React__namespace.useContext(DroppableContext);
|
20477 | const { onDrag, onDragMove, onDrop } = React__namespace.useContext(DragDropContext);
|
20478 |
|
20479 |
|
20480 | let startX = 0;
|
20481 | let startY = 0;
|
20482 | let index = null;
|
20483 | let hoveringDroppable;
|
20484 | let hoveringIndex = null;
|
20485 | let mouseMoveListener;
|
20486 | let mouseUpListener;
|
20487 |
|
20488 | let startYOffset = 0;
|
20489 |
|
20490 | const onTransitionEnd = (_ev) => {
|
20491 | if (isDragging) {
|
20492 | setIsDragging(false);
|
20493 | setStyle(styleProp);
|
20494 | }
|
20495 | };
|
20496 | function getSourceAndDest() {
|
20497 | const hoveringDroppableId = hoveringDroppable ? hoveringDroppable.getAttribute('data-pf-droppableid') : null;
|
20498 | const source = {
|
20499 | droppableId,
|
20500 | index
|
20501 | };
|
20502 | const dest = hoveringDroppableId !== null && hoveringIndex !== null
|
20503 | ? {
|
20504 | droppableId: hoveringDroppableId,
|
20505 | index: hoveringIndex
|
20506 | }
|
20507 | : undefined;
|
20508 | return { source, dest, hoveringDroppableId };
|
20509 | }
|
20510 | const onMouseUpWhileDragging = (droppableItems) => {
|
20511 | droppableItems.forEach(resetDroppableItem);
|
20512 | document.removeEventListener('mousemove', mouseMoveListener);
|
20513 | document.removeEventListener('mouseup', mouseUpListener);
|
20514 | document.removeEventListener('contextmenu', mouseUpListener);
|
20515 | const { source, dest, hoveringDroppableId } = getSourceAndDest();
|
20516 | const consumerReordered = onDrop(source, dest);
|
20517 | if (consumerReordered && droppableId === hoveringDroppableId) {
|
20518 | setIsDragging(false);
|
20519 | setStyle(styleProp);
|
20520 | }
|
20521 | else if (!consumerReordered) {
|
20522 |
|
20523 | setStyle(Object.assign(Object.assign({}, style), { transition: 'transform 0.5s cubic-bezier(0.2, 1, 0.1, 1) 0s', transform: '', background: styleProp.background, boxShadow: styleProp.boxShadow }));
|
20524 | }
|
20525 | };
|
20526 |
|
20527 | const onMouseMoveWhileDragging = (ev, droppableItems, blankDivRect) => {
|
20528 |
|
20529 | hoveringDroppable = null;
|
20530 | droppableItems.forEach(droppableItem => {
|
20531 | const { node, rect, isDraggingHost, draggableNodes, draggableNodesRects } = droppableItem;
|
20532 | if (overlaps(ev, rect)) {
|
20533 |
|
20534 | node.classList.remove(styles$9.modifiers.dragOutside);
|
20535 | hoveringDroppable = node;
|
20536 |
|
20537 | if (node.getAttribute('blankDiv') !== 'true' && !isDraggingHost) {
|
20538 | const blankDiv = document.createElement('div');
|
20539 | blankDiv.setAttribute('blankDiv', 'true');
|
20540 | let blankDivPos = -1;
|
20541 | for (let i = 0; i < draggableNodes.length; i++) {
|
20542 | const childRect = draggableNodesRects[i];
|
20543 | const isLast = i === draggableNodes.length - 1;
|
20544 | const startOverlaps = childRect.y >= startY - startYOffset;
|
20545 | if ((startOverlaps || isLast) && blankDivPos === -1) {
|
20546 | if (isLast && !startOverlaps) {
|
20547 | draggableNodes[i].after(blankDiv);
|
20548 | }
|
20549 | else {
|
20550 | draggableNodes[i].before(blankDiv);
|
20551 | }
|
20552 | blankDiv.style.height = `${blankDivRect.height}px`;
|
20553 | blankDiv.style.width = `${blankDivRect.width}px`;
|
20554 | node.setAttribute('blankDiv', 'true');
|
20555 | blankDivPos = i;
|
20556 | }
|
20557 | if (blankDivPos !== -1) {
|
20558 | childRect.y += blankDivRect.height;
|
20559 | }
|
20560 | }
|
20561 |
|
20562 | draggableNodes.splice(blankDivPos, 0, blankDiv);
|
20563 | draggableNodesRects.splice(blankDivPos, 0, blankDivRect);
|
20564 |
|
20565 | rect.height += blankDivRect.height;
|
20566 | }
|
20567 | }
|
20568 | else {
|
20569 | resetDroppableItem(droppableItem);
|
20570 | node.classList.add(styles$9.modifiers.dragging);
|
20571 | node.classList.add(styles$9.modifiers.dragOutside);
|
20572 | }
|
20573 | });
|
20574 |
|
20575 | setStyle(Object.assign(Object.assign({}, style), { transform: `translate(${ev.pageX - startX}px, ${ev.pageY - startY}px)` }));
|
20576 | setIsValidDrag(Boolean(hoveringDroppable));
|
20577 |
|
20578 | hoveringIndex = null;
|
20579 | if (hoveringDroppable) {
|
20580 | const { draggableNodes, draggableNodesRects } = droppableItems.find(item => item.node === hoveringDroppable);
|
20581 | let lastTranslate = 0;
|
20582 | draggableNodes.forEach((n, i) => {
|
20583 | n.style.transition = 'transform 0.5s cubic-bezier(0.2, 1, 0.1, 1) 0s';
|
20584 | const rect = draggableNodesRects[i];
|
20585 | const halfway = rect.y + rect.height / 2;
|
20586 | let translateY = 0;
|
20587 |
|
20588 | if (startY < halfway && ev.pageY + (blankDivRect.height - startYOffset) > halfway) {
|
20589 | translateY -= blankDivRect.height;
|
20590 | }
|
20591 | else if (startY >= halfway && ev.pageY - startYOffset <= halfway) {
|
20592 | translateY += blankDivRect.height;
|
20593 | }
|
20594 |
|
20595 | if ((translateY <= lastTranslate && translateY < 0) || (translateY > lastTranslate && translateY > 0)) {
|
20596 | hoveringIndex = i;
|
20597 | }
|
20598 | n.style.transform = `translate(0, ${translateY}px`;
|
20599 | lastTranslate = translateY;
|
20600 | });
|
20601 | }
|
20602 | const { source, dest } = getSourceAndDest();
|
20603 | onDragMove(source, dest);
|
20604 | };
|
20605 | const onDragStart = (ev) => {
|
20606 |
|
20607 |
|
20608 |
|
20609 | ev.preventDefault();
|
20610 | if (isDragging) {
|
20611 |
|
20612 | return;
|
20613 | }
|
20614 |
|
20615 | const dragging = ev.target;
|
20616 | const rect = dragging.getBoundingClientRect();
|
20617 | const droppableNodes = Array.from(document.querySelectorAll(`[data-pf-droppable="${zone}"]`));
|
20618 | const droppableItems = droppableNodes.reduce((acc, cur) => {
|
20619 | cur.classList.add(styles$9.modifiers.dragging);
|
20620 | const draggableNodes = Array.from(cur.querySelectorAll(`[data-pf-draggable-zone="${zone}"]`));
|
20621 | const isDraggingHost = cur.contains(dragging);
|
20622 | if (isDraggingHost) {
|
20623 | index = draggableNodes.indexOf(dragging);
|
20624 | }
|
20625 | const droppableItem = {
|
20626 | node: cur,
|
20627 | rect: cur.getBoundingClientRect(),
|
20628 | isDraggingHost,
|
20629 |
|
20630 | draggableNodes: draggableNodes.map(node => (node === dragging ? node.cloneNode(false) : node)),
|
20631 | draggableNodesRects: draggableNodes.map(node => node.getBoundingClientRect())
|
20632 | };
|
20633 | acc.push(droppableItem);
|
20634 | return acc;
|
20635 | }, []);
|
20636 | if (!onDrag({ droppableId, index })) {
|
20637 |
|
20638 | return;
|
20639 | }
|
20640 |
|
20641 | style = Object.assign(Object.assign({}, style), { top: rect.y, left: rect.x, width: rect.width, height: rect.height, '--pf-c-draggable--m-dragging--BackgroundColor': getInheritedBackgroundColor(dragging), position: 'fixed', zIndex: 5000 });
|
20642 | setStyle(style);
|
20643 |
|
20644 | startX = ev.pageX;
|
20645 | startY = ev.pageY;
|
20646 | startYOffset = startY - rect.y;
|
20647 | setIsDragging(true);
|
20648 | mouseMoveListener = ev => onMouseMoveWhileDragging(ev, droppableItems, rect);
|
20649 | mouseUpListener = () => onMouseUpWhileDragging(droppableItems);
|
20650 | document.addEventListener('mousemove', mouseMoveListener);
|
20651 | document.addEventListener('mouseup', mouseUpListener);
|
20652 |
|
20653 |
|
20654 | };
|
20655 | const childProps = Object.assign({ 'data-pf-draggable-zone': isDragging ? null : zone, draggable: true, className: css(styles$9.draggable, isDragging && styles$9.modifiers.dragging, !isValidDrag && styles$9.modifiers.dragOutside, className), onDragStart,
|
20656 | onTransitionEnd,
|
20657 | style }, props);
|
20658 | return (React__namespace.createElement(React__namespace.Fragment, null,
|
20659 | isDragging && (React__namespace.createElement("div", Object.assign({ draggable: true }, props, { style: Object.assign(Object.assign({}, styleProp), { visibility: 'hidden' }) }), children)),
|
20660 | hasNoWrapper ? (React__namespace.cloneElement(children, childProps)) : (React__namespace.createElement("div", Object.assign({}, childProps), children))));
|
20661 | };
|
20662 | Draggable.displayName = 'Draggable';
|
20663 |
|
20664 | const Droppable = (_a) => {
|
20665 | var { className, children, zone = 'defaultZone', droppableId = 'defaultId', hasNoWrapper = false } = _a, props = __rest$1(_a, ["className", "children", "zone", "droppableId", "hasNoWrapper"]);
|
20666 | const childProps = Object.assign({ 'data-pf-droppable': zone, 'data-pf-droppableid': droppableId,
|
20667 |
|
20668 | className: hasNoWrapper && React__namespace.Children.count(children) === 1
|
20669 | ? css(styles$9.droppable, className, children.props.className)
|
20670 | : css(styles$9.droppable, className) }, props);
|
20671 | return (React__namespace.createElement(DroppableContext.Provider, { value: { zone, droppableId } }, hasNoWrapper ? (React__namespace.cloneElement(children, childProps)) : (React__namespace.createElement("div", Object.assign({}, childProps), children))));
|
20672 | };
|
20673 | Droppable.displayName = 'Droppable';
|
20674 |
|
20675 | Promise.resolve().then(function () { return textInputGroup; });
|
20676 | var styles$8 = {
|
20677 | "button": "pf-c-button",
|
20678 | "chipGroup": "pf-c-chip-group",
|
20679 | "chipGroupList": "pf-c-chip-group__list",
|
20680 | "modifiers": {
|
20681 | "disabled": "pf-m-disabled",
|
20682 | "plain": "pf-m-plain",
|
20683 | "icon": "pf-m-icon",
|
20684 | "hint": "pf-m-hint"
|
20685 | },
|
20686 | "textInputGroup": "pf-c-text-input-group",
|
20687 | "textInputGroupGroup": "pf-c-text-input-group__group",
|
20688 | "textInputGroupIcon": "pf-c-text-input-group__icon",
|
20689 | "textInputGroupMain": "pf-c-text-input-group__main",
|
20690 | "textInputGroupText": "pf-c-text-input-group__text",
|
20691 | "textInputGroupTextInput": "pf-c-text-input-group__text-input",
|
20692 | "textInputGroupUtilities": "pf-c-text-input-group__utilities"
|
20693 | };
|
20694 |
|
20695 | const TextInputGroupContext = React__namespace.createContext({
|
20696 | isDisabled: false
|
20697 | });
|
20698 | const TextInputGroup = (_a) => {
|
20699 | var { children, className, isDisabled } = _a, props = __rest$1(_a, ["children", "className", "isDisabled"]);
|
20700 | return (React__namespace.createElement(TextInputGroupContext.Provider, { value: { isDisabled } },
|
20701 | React__namespace.createElement("div", Object.assign({ className: css(styles$8.textInputGroup, isDisabled && styles$8.modifiers.disabled, className) }, props), children)));
|
20702 | };
|
20703 | TextInputGroup.displayName = 'TextInputGroup';
|
20704 |
|
20705 | const TextInputGroupMain = (_a) => {
|
20706 | var { children, className, icon, type = 'text', hint, onChange = () => undefined, onFocus, onBlur, 'aria-label': ariaLabel = 'Type to filter', value: inputValue, placeholder: inputPlaceHolder } = _a, props = __rest$1(_a, ["children", "className", "icon", "type", "hint", "onChange", "onFocus", "onBlur", 'aria-label', "value", "placeholder"]);
|
20707 | const { isDisabled } = React__namespace.useContext(TextInputGroupContext);
|
20708 | const handleChange = (event) => {
|
20709 | onChange(event.currentTarget.value, event);
|
20710 | };
|
20711 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$8.textInputGroupMain, icon && styles$8.modifiers.icon, className) }, props),
|
20712 | children,
|
20713 | React__namespace.createElement("span", { className: css(styles$8.textInputGroupText) },
|
20714 | hint && (React__namespace.createElement("input", { className: css(styles$8.textInputGroupTextInput, styles$8.modifiers.hint), type: "text", disabled: true, "aria-hidden": "true", value: hint })),
|
20715 | icon && React__namespace.createElement("span", { className: css(styles$8.textInputGroupIcon) }, icon),
|
20716 | React__namespace.createElement("input", { type: type, className: css(styles$8.textInputGroupTextInput), "aria-label": ariaLabel, disabled: isDisabled, onChange: handleChange, onFocus: onFocus, onBlur: onBlur, value: inputValue || '', placeholder: inputPlaceHolder }))));
|
20717 | };
|
20718 | TextInputGroupMain.displayName = 'TextInputGroupMain';
|
20719 |
|
20720 | const TextInputGroupUtilities = (_a) => {
|
20721 | var { children, className } = _a, props = __rest$1(_a, ["children", "className"]);
|
20722 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$8.textInputGroupUtilities, className) }, props), children));
|
20723 | };
|
20724 | TextInputGroupUtilities.displayName = 'TextInputGroupUtilities';
|
20725 |
|
20726 | Promise.resolve().then(function () { return panel; });
|
20727 | var styles$7 = {
|
20728 | "modifiers": {
|
20729 | "bordered": "pf-m-bordered",
|
20730 | "raised": "pf-m-raised",
|
20731 | "scrollable": "pf-m-scrollable"
|
20732 | },
|
20733 | "panel": "pf-c-panel",
|
20734 | "panelFooter": "pf-c-panel__footer",
|
20735 | "panelHeader": "pf-c-panel__header",
|
20736 | "panelMain": "pf-c-panel__main",
|
20737 | "panelMainBody": "pf-c-panel__main-body"
|
20738 | };
|
20739 |
|
20740 | const PanelBase = (_a) => {
|
20741 | var { className, children, variant, isScrollable, innerRef } = _a, props = __rest$1(_a, ["className", "children", "variant", "isScrollable", "innerRef"]);
|
20742 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$7.panel, variant === 'raised' && styles$7.modifiers.raised, variant === 'bordered' && styles$7.modifiers.bordered, isScrollable && styles$7.modifiers.scrollable, className), ref: innerRef }, props), children));
|
20743 | };
|
20744 | const Panel = React__namespace.forwardRef((props, ref) => (React__namespace.createElement(PanelBase, Object.assign({ innerRef: ref }, props))));
|
20745 | Panel.displayName = 'Panel';
|
20746 |
|
20747 | const PanelMain = (_a) => {
|
20748 | var { className, children, maxHeight } = _a, props = __rest$1(_a, ["className", "children", "maxHeight"]);
|
20749 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$7.panelMain, className), style: { '--pf-c-panel__main--MaxHeight': maxHeight } }, props), children));
|
20750 | };
|
20751 | PanelMain.displayName = 'PanelMain';
|
20752 |
|
20753 | const PanelMainBody = (_a) => {
|
20754 | var { className, children } = _a, props = __rest$1(_a, ["className", "children"]);
|
20755 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$7.panelMainBody, className) }, props), children));
|
20756 | };
|
20757 | PanelMainBody.displayName = 'PanelMainBody';
|
20758 |
|
20759 | const PanelHeader = (_a) => {
|
20760 | var { className, children } = _a, props = __rest$1(_a, ["className", "children"]);
|
20761 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$7.panelHeader, className) }, props), children));
|
20762 | };
|
20763 | PanelHeader.displayName = 'PanelHeader';
|
20764 |
|
20765 | const PanelFooter = (_a) => {
|
20766 | var { className, children } = _a, props = __rest$1(_a, ["className", "children"]);
|
20767 | return (React__namespace.createElement("div", Object.assign({ className: css(styles$7.panelFooter, className) }, props), children));
|
20768 | };
|
20769 | PanelFooter.displayName = 'PanelFooter';
|
20770 |
|
20771 | Promise.resolve().then(function () { return truncate; });
|
20772 | var styles$6 = {
|
20773 | "truncate": "pf-c-truncate",
|
20774 | "truncateEnd": "pf-c-truncate__end",
|
20775 | "truncateStart": "pf-c-truncate__start"
|
20776 | };
|
20777 |
|
20778 | exports.TruncatePosition = void 0;
|
20779 | (function (TruncatePosition) {
|
20780 | TruncatePosition["start"] = "start";
|
20781 | TruncatePosition["end"] = "end";
|
20782 | TruncatePosition["middle"] = "middle";
|
20783 | })(exports.TruncatePosition || (exports.TruncatePosition = {}));
|
20784 | const truncateStyles = {
|
20785 | start: styles$6.truncateEnd,
|
20786 | end: styles$6.truncateStart
|
20787 | };
|
20788 | const minWidthCharacters = 12;
|
20789 | const sliceContent = (str, slice) => [str.slice(0, str.length - slice), str.slice(-slice)];
|
20790 | const Truncate = (_a) => {
|
20791 | var { className, position = 'end', tooltipPosition = 'top', trailingNumChars = 7, content } = _a, props = __rest$1(_a, ["className", "position", "tooltipPosition", "trailingNumChars", "content"]);
|
20792 | return (React__namespace.createElement(Tooltip, { position: tooltipPosition, content: content },
|
20793 | React__namespace.createElement("span", Object.assign({ className: css(styles$6.truncate, className) }, props),
|
20794 | (position === exports.TruncatePosition.end || position === exports.TruncatePosition.start) && (React__namespace.createElement("span", { className: truncateStyles[position] },
|
20795 | content,
|
20796 | position === exports.TruncatePosition.start && React__namespace.createElement(React__namespace.Fragment, null, "\u200E"))),
|
20797 | position === exports.TruncatePosition.middle &&
|
20798 | content.slice(0, content.length - trailingNumChars).length > minWidthCharacters && (React__namespace.createElement(React__namespace.Fragment, null,
|
20799 | React__namespace.createElement("span", { className: styles$6.truncateStart }, sliceContent(content, trailingNumChars)[0]),
|
20800 | React__namespace.createElement("span", { className: styles$6.truncateEnd }, sliceContent(content, trailingNumChars)[1]))),
|
20801 | position === exports.TruncatePosition.middle &&
|
20802 | content.slice(0, content.length - trailingNumChars).length <= minWidthCharacters &&
|
20803 | content)));
|
20804 | };
|
20805 | Truncate.displayName = 'Truncate';
|
20806 |
|
20807 | const Bullseye = (_a) => {
|
20808 | var { children = null, className = '', component = 'div' } = _a, props = __rest$1(_a, ["children", "className", "component"]);
|
20809 | const Component = component;
|
20810 | return (React__namespace.createElement(Component, Object.assign({ className: css(styles$1h.bullseye, className) }, props), children));
|
20811 | };
|
20812 | Bullseye.displayName = 'Bullseye';
|
20813 |
|
20814 | Promise.resolve().then(function () { return flex; });
|
20815 | var styles$5 = {
|
20816 | "flex": "pf-l-flex",
|
20817 | "modifiers": {
|
20818 | "flex": "pf-m-flex",
|
20819 | "inlineFlex": "pf-m-inline-flex",
|
20820 | "column": "pf-m-column",
|
20821 | "columnReverse": "pf-m-column-reverse",
|
20822 | "row": "pf-m-row",
|
20823 | "rowReverse": "pf-m-row-reverse",
|
20824 | "wrap": "pf-m-wrap",
|
20825 | "wrapReverse": "pf-m-wrap-reverse",
|
20826 | "nowrap": "pf-m-nowrap",
|
20827 | "justifyContentFlexStart": "pf-m-justify-content-flex-start",
|
20828 | "justifyContentFlexEnd": "pf-m-justify-content-flex-end",
|
20829 | "justifyContentCenter": "pf-m-justify-content-center",
|
20830 | "justifyContentSpaceBetween": "pf-m-justify-content-space-between",
|
20831 | "justifyContentSpaceAround": "pf-m-justify-content-space-around",
|
20832 | "justifyContentSpaceEvenly": "pf-m-justify-content-space-evenly",
|
20833 | "alignItemsFlexStart": "pf-m-align-items-flex-start",
|
20834 | "alignItemsFlexEnd": "pf-m-align-items-flex-end",
|
20835 | "alignItemsCenter": "pf-m-align-items-center",
|
20836 | "alignItemsStretch": "pf-m-align-items-stretch",
|
20837 | "alignItemsBaseline": "pf-m-align-items-baseline",
|
20838 | "alignContentFlexStart": "pf-m-align-content-flex-start",
|
20839 | "alignContentFlexEnd": "pf-m-align-content-flex-end",
|
20840 | "alignContentCenter": "pf-m-align-content-center",
|
20841 | "alignContentStretch": "pf-m-align-content-stretch",
|
20842 | "alignContentSpaceBetween": "pf-m-align-content-space-between",
|
20843 | "alignContentSpaceAround": "pf-m-align-content-space-around",
|
20844 | "alignRight": "pf-m-align-right",
|
20845 | "alignLeft": "pf-m-align-left",
|
20846 | "grow": "pf-m-grow",
|
20847 | "shrink": "pf-m-shrink",
|
20848 | "fullWidth": "pf-m-full-width",
|
20849 | "flex_1": "pf-m-flex-1",
|
20850 | "flex_2": "pf-m-flex-2",
|
20851 | "flex_3": "pf-m-flex-3",
|
20852 | "flex_4": "pf-m-flex-4",
|
20853 | "flexDefault": "pf-m-flex-default",
|
20854 | "flexNone": "pf-m-flex-none",
|
20855 | "alignSelfFlexStart": "pf-m-align-self-flex-start",
|
20856 | "alignSelfFlexEnd": "pf-m-align-self-flex-end",
|
20857 | "alignSelfCenter": "pf-m-align-self-center",
|
20858 | "alignSelfBaseline": "pf-m-align-self-baseline",
|
20859 | "alignSelfStretch": "pf-m-align-self-stretch",
|
20860 | "flexOnSm": "pf-m-flex-on-sm",
|
20861 | "inlineFlexOnSm": "pf-m-inline-flex-on-sm",
|
20862 | "columnOnSm": "pf-m-column-on-sm",
|
20863 | "columnReverseOnSm": "pf-m-column-reverse-on-sm",
|
20864 | "rowOnSm": "pf-m-row-on-sm",
|
20865 | "rowReverseOnSm": "pf-m-row-reverse-on-sm",
|
20866 | "wrapOnSm": "pf-m-wrap-on-sm",
|
20867 | "wrapReverseOnSm": "pf-m-wrap-reverse-on-sm",
|
20868 | "nowrapOnSm": "pf-m-nowrap-on-sm",
|
20869 | "justifyContentFlexStartOnSm": "pf-m-justify-content-flex-start-on-sm",
|
20870 | "justifyContentFlexEndOnSm": "pf-m-justify-content-flex-end-on-sm",
|
20871 | "justifyContentCenterOnSm": "pf-m-justify-content-center-on-sm",
|
20872 | "justifyContentSpaceBetweenOnSm": "pf-m-justify-content-space-between-on-sm",
|
20873 | "justifyContentSpaceAroundOnSm": "pf-m-justify-content-space-around-on-sm",
|
20874 | "justifyContentSpaceEvenlyOnSm": "pf-m-justify-content-space-evenly-on-sm",
|
20875 | "alignItemsFlexStartOnSm": "pf-m-align-items-flex-start-on-sm",
|
20876 | "alignItemsFlexEndOnSm": "pf-m-align-items-flex-end-on-sm",
|
20877 | "alignItemsCenterOnSm": "pf-m-align-items-center-on-sm",
|
20878 | "alignItemsStretchOnSm": "pf-m-align-items-stretch-on-sm",
|
20879 | "alignItemsBaselineOnSm": "pf-m-align-items-baseline-on-sm",
|
20880 | "alignContentFlexStartOnSm": "pf-m-align-content-flex-start-on-sm",
|
20881 | "alignContentFlexEndOnSm": "pf-m-align-content-flex-end-on-sm",
|
20882 | "alignContentCenterOnSm": "pf-m-align-content-center-on-sm",
|
20883 | "alignContentStretchOnSm": "pf-m-align-content-stretch-on-sm",
|
20884 | "alignContentSpaceBetweenOnSm": "pf-m-align-content-space-between-on-sm",
|
20885 | "alignContentSpaceAroundOnSm": "pf-m-align-content-space-around-on-sm",
|
20886 | "alignRightOnSm": "pf-m-align-right-on-sm",
|
20887 | "alignLeftOnSm": "pf-m-align-left-on-sm",
|
20888 | "growOnSm": "pf-m-grow-on-sm",
|
20889 | "shrinkOnSm": "pf-m-shrink-on-sm",
|
20890 | "fullWidthOnSm": "pf-m-full-width-on-sm",
|
20891 | "flex_1OnSm": "pf-m-flex-1-on-sm",
|
20892 | "flex_2OnSm": "pf-m-flex-2-on-sm",
|
20893 | "flex_3OnSm": "pf-m-flex-3-on-sm",
|
20894 | "flex_4OnSm": "pf-m-flex-4-on-sm",
|
20895 | "flexDefaultOnSm": "pf-m-flex-default-on-sm",
|
20896 | "flexNoneOnSm": "pf-m-flex-none-on-sm",
|
20897 | "alignSelfFlexStartOnSm": "pf-m-align-self-flex-start-on-sm",
|
20898 | "alignSelfFlexEndOnSm": "pf-m-align-self-flex-end-on-sm",
|
20899 | "alignSelfCenterOnSm": "pf-m-align-self-center-on-sm",
|
20900 | "alignSelfBaselineOnSm": "pf-m-align-self-baseline-on-sm",
|
20901 | "alignSelfStretchOnSm": "pf-m-align-self-stretch-on-sm",
|
20902 | "flexOnMd": "pf-m-flex-on-md",
|
20903 | "inlineFlexOnMd": "pf-m-inline-flex-on-md",
|
20904 | "columnOnMd": "pf-m-column-on-md",
|
20905 | "columnReverseOnMd": "pf-m-column-reverse-on-md",
|
20906 | "rowOnMd": "pf-m-row-on-md",
|
20907 | "rowReverseOnMd": "pf-m-row-reverse-on-md",
|
20908 | "wrapOnMd": "pf-m-wrap-on-md",
|
20909 | "wrapReverseOnMd": "pf-m-wrap-reverse-on-md",
|
20910 | "nowrapOnMd": "pf-m-nowrap-on-md",
|
20911 | "justifyContentFlexStartOnMd": "pf-m-justify-content-flex-start-on-md",
|
20912 | "justifyContentFlexEndOnMd": "pf-m-justify-content-flex-end-on-md",
|
20913 | "justifyContentCenterOnMd": "pf-m-justify-content-center-on-md",
|
20914 | "justifyContentSpaceBetweenOnMd": "pf-m-justify-content-space-between-on-md",
|
20915 | "justifyContentSpaceAroundOnMd": "pf-m-justify-content-space-around-on-md",
|
20916 | "justifyContentSpaceEvenlyOnMd": "pf-m-justify-content-space-evenly-on-md",
|
20917 | "alignItemsFlexStartOnMd": "pf-m-align-items-flex-start-on-md",
|
20918 | "alignItemsFlexEndOnMd": "pf-m-align-items-flex-end-on-md",
|
20919 | "alignItemsCenterOnMd": "pf-m-align-items-center-on-md",
|
20920 | "alignItemsStretchOnMd": "pf-m-align-items-stretch-on-md",
|
20921 | "alignItemsBaselineOnMd": "pf-m-align-items-baseline-on-md",
|
20922 | "alignContentFlexStartOnMd": "pf-m-align-content-flex-start-on-md",
|
20923 | "alignContentFlexEndOnMd": "pf-m-align-content-flex-end-on-md",
|
20924 | "alignContentCenterOnMd": "pf-m-align-content-center-on-md",
|
20925 | "alignContentStretchOnMd": "pf-m-align-content-stretch-on-md",
|
20926 | "alignContentSpaceBetweenOnMd": "pf-m-align-content-space-between-on-md",
|
20927 | "alignContentSpaceAroundOnMd": "pf-m-align-content-space-around-on-md",
|
20928 | "alignRightOnMd": "pf-m-align-right-on-md",
|
20929 | "alignLeftOnMd": "pf-m-align-left-on-md",
|
20930 | "growOnMd": "pf-m-grow-on-md",
|
20931 | "shrinkOnMd": "pf-m-shrink-on-md",
|
20932 | "fullWidthOnMd": "pf-m-full-width-on-md",
|
20933 | "flex_1OnMd": "pf-m-flex-1-on-md",
|
20934 | "flex_2OnMd": "pf-m-flex-2-on-md",
|
20935 | "flex_3OnMd": "pf-m-flex-3-on-md",
|
20936 | "flex_4OnMd": "pf-m-flex-4-on-md",
|
20937 | "flexDefaultOnMd": "pf-m-flex-default-on-md",
|
20938 | "flexNoneOnMd": "pf-m-flex-none-on-md",
|
20939 | "alignSelfFlexStartOnMd": "pf-m-align-self-flex-start-on-md",
|
20940 | "alignSelfFlexEndOnMd": "pf-m-align-self-flex-end-on-md",
|
20941 | "alignSelfCenterOnMd": "pf-m-align-self-center-on-md",
|
20942 | "alignSelfBaselineOnMd": "pf-m-align-self-baseline-on-md",
|
20943 | "alignSelfStretchOnMd": "pf-m-align-self-stretch-on-md",
|
20944 | "flexOnLg": "pf-m-flex-on-lg",
|
20945 | "inlineFlexOnLg": "pf-m-inline-flex-on-lg",
|
20946 | "columnOnLg": "pf-m-column-on-lg",
|
20947 | "columnReverseOnLg": "pf-m-column-reverse-on-lg",
|
20948 | "rowOnLg": "pf-m-row-on-lg",
|
20949 | "rowReverseOnLg": "pf-m-row-reverse-on-lg",
|
20950 | "wrapOnLg": "pf-m-wrap-on-lg",
|
20951 | "wrapReverseOnLg": "pf-m-wrap-reverse-on-lg",
|
20952 | "nowrapOnLg": "pf-m-nowrap-on-lg",
|
20953 | "justifyContentFlexStartOnLg": "pf-m-justify-content-flex-start-on-lg",
|
20954 | "justifyContentFlexEndOnLg": "pf-m-justify-content-flex-end-on-lg",
|
20955 | "justifyContentCenterOnLg": "pf-m-justify-content-center-on-lg",
|
20956 | "justifyContentSpaceBetweenOnLg": "pf-m-justify-content-space-between-on-lg",
|
20957 | "justifyContentSpaceAroundOnLg": "pf-m-justify-content-space-around-on-lg",
|
20958 | "justifyContentSpaceEvenlyOnLg": "pf-m-justify-content-space-evenly-on-lg",
|
20959 | "alignItemsFlexStartOnLg": "pf-m-align-items-flex-start-on-lg",
|
20960 | "alignItemsFlexEndOnLg": "pf-m-align-items-flex-end-on-lg",
|
20961 | "alignItemsCenterOnLg": "pf-m-align-items-center-on-lg",
|
20962 | "alignItemsStretchOnLg": "pf-m-align-items-stretch-on-lg",
|
20963 | "alignItemsBaselineOnLg": "pf-m-align-items-baseline-on-lg",
|
20964 | "alignContentFlexStartOnLg": "pf-m-align-content-flex-start-on-lg",
|
20965 | "alignContentFlexEndOnLg": "pf-m-align-content-flex-end-on-lg",
|
20966 | "alignContentCenterOnLg": "pf-m-align-content-center-on-lg",
|
20967 | "alignContentStretchOnLg": "pf-m-align-content-stretch-on-lg",
|
20968 | "alignContentSpaceBetweenOnLg": "pf-m-align-content-space-between-on-lg",
|
20969 | "alignContentSpaceAroundOnLg": "pf-m-align-content-space-around-on-lg",
|
20970 | "alignRightOnLg": "pf-m-align-right-on-lg",
|
20971 | "alignLeftOnLg": "pf-m-align-left-on-lg",
|
20972 | "growOnLg": "pf-m-grow-on-lg",
|
20973 | "shrinkOnLg": "pf-m-shrink-on-lg",
|
20974 | "fullWidthOnLg": "pf-m-full-width-on-lg",
|
20975 | "flex_1OnLg": "pf-m-flex-1-on-lg",
|
20976 | "flex_2OnLg": "pf-m-flex-2-on-lg",
|
20977 | "flex_3OnLg": "pf-m-flex-3-on-lg",
|
20978 | "flex_4OnLg": "pf-m-flex-4-on-lg",
|
20979 | "flexDefaultOnLg": "pf-m-flex-default-on-lg",
|
20980 | "flexNoneOnLg": "pf-m-flex-none-on-lg",
|
20981 | "alignSelfFlexStartOnLg": "pf-m-align-self-flex-start-on-lg",
|
20982 | "alignSelfFlexEndOnLg": "pf-m-align-self-flex-end-on-lg",
|
20983 | "alignSelfCenterOnLg": "pf-m-align-self-center-on-lg",
|
20984 | "alignSelfBaselineOnLg": "pf-m-align-self-baseline-on-lg",
|
20985 | "alignSelfStretchOnLg": "pf-m-align-self-stretch-on-lg",
|
20986 | "flexOnXl": "pf-m-flex-on-xl",
|
20987 | "inlineFlexOnXl": "pf-m-inline-flex-on-xl",
|
20988 | "columnOnXl": "pf-m-column-on-xl",
|
20989 | "columnReverseOnXl": "pf-m-column-reverse-on-xl",
|
20990 | "rowOnXl": "pf-m-row-on-xl",
|
20991 | "rowReverseOnXl": "pf-m-row-reverse-on-xl",
|
20992 | "wrapOnXl": "pf-m-wrap-on-xl",
|
20993 | "wrapReverseOnXl": "pf-m-wrap-reverse-on-xl",
|
20994 | "nowrapOnXl": "pf-m-nowrap-on-xl",
|
20995 | "justifyContentFlexStartOnXl": "pf-m-justify-content-flex-start-on-xl",
|
20996 | "justifyContentFlexEndOnXl": "pf-m-justify-content-flex-end-on-xl",
|
20997 | "justifyContentCenterOnXl": "pf-m-justify-content-center-on-xl",
|
20998 | "justifyContentSpaceBetweenOnXl": "pf-m-justify-content-space-between-on-xl",
|
20999 | "justifyContentSpaceAroundOnXl": "pf-m-justify-content-space-around-on-xl",
|
21000 | "justifyContentSpaceEvenlyOnXl": "pf-m-justify-content-space-evenly-on-xl",
|
21001 | "alignItemsFlexStartOnXl": "pf-m-align-items-flex-start-on-xl",
|
21002 | "alignItemsFlexEndOnXl": "pf-m-align-items-flex-end-on-xl",
|
21003 | "alignItemsCenterOnXl": "pf-m-align-items-center-on-xl",
|
21004 | "alignItemsStretchOnXl": "pf-m-align-items-stretch-on-xl",
|
21005 | "alignItemsBaselineOnXl": "pf-m-align-items-baseline-on-xl",
|
21006 | "alignContentFlexStartOnXl": "pf-m-align-content-flex-start-on-xl",
|
21007 | "alignContentFlexEndOnXl": "pf-m-align-content-flex-end-on-xl",
|
21008 | "alignContentCenterOnXl": "pf-m-align-content-center-on-xl",
|
21009 | "alignContentStretchOnXl": "pf-m-align-content-stretch-on-xl",
|
21010 | "alignContentSpaceBetweenOnXl": "pf-m-align-content-space-between-on-xl",
|
21011 | "alignContentSpaceAroundOnXl": "pf-m-align-content-space-around-on-xl",
|
21012 | "alignRightOnXl": "pf-m-align-right-on-xl",
|
21013 | "alignLeftOnXl": "pf-m-align-left-on-xl",
|
21014 | "growOnXl": "pf-m-grow-on-xl",
|
21015 | "shrinkOnXl": "pf-m-shrink-on-xl",
|
21016 | "fullWidthOnXl": "pf-m-full-width-on-xl",
|
21017 | "flex_1OnXl": "pf-m-flex-1-on-xl",
|
21018 | "flex_2OnXl": "pf-m-flex-2-on-xl",
|
21019 | "flex_3OnXl": "pf-m-flex-3-on-xl",
|
21020 | "flex_4OnXl": "pf-m-flex-4-on-xl",
|
21021 | "flexDefaultOnXl": "pf-m-flex-default-on-xl",
|
21022 | "flexNoneOnXl": "pf-m-flex-none-on-xl",
|
21023 | "alignSelfFlexStartOnXl": "pf-m-align-self-flex-start-on-xl",
|
21024 | "alignSelfFlexEndOnXl": "pf-m-align-self-flex-end-on-xl",
|
21025 | "alignSelfCenterOnXl": "pf-m-align-self-center-on-xl",
|
21026 | "alignSelfBaselineOnXl": "pf-m-align-self-baseline-on-xl",
|
21027 | "alignSelfStretchOnXl": "pf-m-align-self-stretch-on-xl",
|
21028 | "flexOn_2xl": "pf-m-flex-on-2xl",
|
21029 | "inlineFlexOn_2xl": "pf-m-inline-flex-on-2xl",
|
21030 | "columnOn_2xl": "pf-m-column-on-2xl",
|
21031 | "columnReverseOn_2xl": "pf-m-column-reverse-on-2xl",
|
21032 | "rowOn_2xl": "pf-m-row-on-2xl",
|
21033 | "rowReverseOn_2xl": "pf-m-row-reverse-on-2xl",
|
21034 | "wrapOn_2xl": "pf-m-wrap-on-2xl",
|
21035 | "wrapReverseOn_2xl": "pf-m-wrap-reverse-on-2xl",
|
21036 | "nowrapOn_2xl": "pf-m-nowrap-on-2xl",
|
21037 | "justifyContentFlexStartOn_2xl": "pf-m-justify-content-flex-start-on-2xl",
|
21038 | "justifyContentFlexEndOn_2xl": "pf-m-justify-content-flex-end-on-2xl",
|
21039 | "justifyContentCenterOn_2xl": "pf-m-justify-content-center-on-2xl",
|
21040 | "justifyContentSpaceBetweenOn_2xl": "pf-m-justify-content-space-between-on-2xl",
|
21041 | "justifyContentSpaceAroundOn_2xl": "pf-m-justify-content-space-around-on-2xl",
|
21042 | "justifyContentSpaceEvenlyOn_2xl": "pf-m-justify-content-space-evenly-on-2xl",
|
21043 | "alignItemsFlexStartOn_2xl": "pf-m-align-items-flex-start-on-2xl",
|
21044 | "alignItemsFlexEndOn_2xl": "pf-m-align-items-flex-end-on-2xl",
|
21045 | "alignItemsCenterOn_2xl": "pf-m-align-items-center-on-2xl",
|
21046 | "alignItemsStretchOn_2xl": "pf-m-align-items-stretch-on-2xl",
|
21047 | "alignItemsBaselineOn_2xl": "pf-m-align-items-baseline-on-2xl",
|
21048 | "alignContentFlexStartOn_2xl": "pf-m-align-content-flex-start-on-2xl",
|
21049 | "alignContentFlexEndOn_2xl": "pf-m-align-content-flex-end-on-2xl",
|
21050 | "alignContentCenterOn_2xl": "pf-m-align-content-center-on-2xl",
|
21051 | "alignContentStretchOn_2xl": "pf-m-align-content-stretch-on-2xl",
|
21052 | "alignContentSpaceBetweenOn_2xl": "pf-m-align-content-space-between-on-2xl",
|
21053 | "alignContentSpaceAroundOn_2xl": "pf-m-align-content-space-around-on-2xl",
|
21054 | "alignRightOn_2xl": "pf-m-align-right-on-2xl",
|
21055 | "alignLeftOn_2xl": "pf-m-align-left-on-2xl",
|
21056 | "growOn_2xl": "pf-m-grow-on-2xl",
|
21057 | "shrinkOn_2xl": "pf-m-shrink-on-2xl",
|
21058 | "fullWidthOn_2xl": "pf-m-full-width-on-2xl",
|
21059 | "flex_1On_2xl": "pf-m-flex-1-on-2xl",
|
21060 | "flex_2On_2xl": "pf-m-flex-2-on-2xl",
|
21061 | "flex_3On_2xl": "pf-m-flex-3-on-2xl",
|
21062 | "flex_4On_2xl": "pf-m-flex-4-on-2xl",
|
21063 | "flexDefaultOn_2xl": "pf-m-flex-default-on-2xl",
|
21064 | "flexNoneOn_2xl": "pf-m-flex-none-on-2xl",
|
21065 | "alignSelfFlexStartOn_2xl": "pf-m-align-self-flex-start-on-2xl",
|
21066 | "alignSelfFlexEndOn_2xl": "pf-m-align-self-flex-end-on-2xl",
|
21067 | "alignSelfCenterOn_2xl": "pf-m-align-self-center-on-2xl",
|
21068 | "alignSelfBaselineOn_2xl": "pf-m-align-self-baseline-on-2xl",
|
21069 | "alignSelfStretchOn_2xl": "pf-m-align-self-stretch-on-2xl",
|
21070 | "spaceItemsNone": "pf-m-space-items-none",
|
21071 | "spaceItemsXs": "pf-m-space-items-xs",
|
21072 | "spaceItemsSm": "pf-m-space-items-sm",
|
21073 | "spaceItemsMd": "pf-m-space-items-md",
|
21074 | "spaceItemsLg": "pf-m-space-items-lg",
|
21075 | "spaceItemsXl": "pf-m-space-items-xl",
|
21076 | "spaceItems_2xl": "pf-m-space-items-2xl",
|
21077 | "spaceItems_3xl": "pf-m-space-items-3xl",
|
21078 | "spaceItems_4xl": "pf-m-space-items-4xl",
|
21079 | "spaceItemsNoneOnSm": "pf-m-space-items-none-on-sm",
|
21080 | "spaceItemsXsOnSm": "pf-m-space-items-xs-on-sm",
|
21081 | "spaceItemsSmOnSm": "pf-m-space-items-sm-on-sm",
|
21082 | "spaceItemsMdOnSm": "pf-m-space-items-md-on-sm",
|
21083 | "spaceItemsLgOnSm": "pf-m-space-items-lg-on-sm",
|
21084 | "spaceItemsXlOnSm": "pf-m-space-items-xl-on-sm",
|
21085 | "spaceItems_2xlOnSm": "pf-m-space-items-2xl-on-sm",
|
21086 | "spaceItems_3xlOnSm": "pf-m-space-items-3xl-on-sm",
|
21087 | "spaceItems_4xlOnSm": "pf-m-space-items-4xl-on-sm",
|
21088 | "spaceItemsNoneOnMd": "pf-m-space-items-none-on-md",
|
21089 | "spaceItemsXsOnMd": "pf-m-space-items-xs-on-md",
|
21090 | "spaceItemsSmOnMd": "pf-m-space-items-sm-on-md",
|
21091 | "spaceItemsMdOnMd": "pf-m-space-items-md-on-md",
|
21092 | "spaceItemsLgOnMd": "pf-m-space-items-lg-on-md",
|
21093 | "spaceItemsXlOnMd": "pf-m-space-items-xl-on-md",
|
21094 | "spaceItems_2xlOnMd": "pf-m-space-items-2xl-on-md",
|
21095 | "spaceItems_3xlOnMd": "pf-m-space-items-3xl-on-md",
|
21096 | "spaceItems_4xlOnMd": "pf-m-space-items-4xl-on-md",
|
21097 | "spaceItemsNoneOnLg": "pf-m-space-items-none-on-lg",
|
21098 | "spaceItemsXsOnLg": "pf-m-space-items-xs-on-lg",
|
21099 | "spaceItemsSmOnLg": "pf-m-space-items-sm-on-lg",
|
21100 | "spaceItemsMdOnLg": "pf-m-space-items-md-on-lg",
|
21101 | "spaceItemsLgOnLg": "pf-m-space-items-lg-on-lg",
|
21102 | "spaceItemsXlOnLg": "pf-m-space-items-xl-on-lg",
|
21103 | "spaceItems_2xlOnLg": "pf-m-space-items-2xl-on-lg",
|
21104 | "spaceItems_3xlOnLg": "pf-m-space-items-3xl-on-lg",
|
21105 | "spaceItems_4xlOnLg": "pf-m-space-items-4xl-on-lg",
|
21106 | "spaceItemsNoneOnXl": "pf-m-space-items-none-on-xl",
|
21107 | "spaceItemsXsOnXl": "pf-m-space-items-xs-on-xl",
|
21108 | "spaceItemsSmOnXl": "pf-m-space-items-sm-on-xl",
|
21109 | "spaceItemsMdOnXl": "pf-m-space-items-md-on-xl",
|
21110 | "spaceItemsLgOnXl": "pf-m-space-items-lg-on-xl",
|
21111 | "spaceItemsXlOnXl": "pf-m-space-items-xl-on-xl",
|
21112 | "spaceItems_2xlOnXl": "pf-m-space-items-2xl-on-xl",
|
21113 | "spaceItems_3xlOnXl": "pf-m-space-items-3xl-on-xl",
|
21114 | "spaceItems_4xlOnXl": "pf-m-space-items-4xl-on-xl",
|
21115 | "spaceItemsNoneOn_2xl": "pf-m-space-items-none-on-2xl",
|
21116 | "spaceItemsXsOn_2xl": "pf-m-space-items-xs-on-2xl",
|
21117 | "spaceItemsSmOn_2xl": "pf-m-space-items-sm-on-2xl",
|
21118 | "spaceItemsMdOn_2xl": "pf-m-space-items-md-on-2xl",
|
21119 | "spaceItemsLgOn_2xl": "pf-m-space-items-lg-on-2xl",
|
21120 | "spaceItemsXlOn_2xl": "pf-m-space-items-xl-on-2xl",
|
21121 | "spaceItems_2xlOn_2xl": "pf-m-space-items-2xl-on-2xl",
|
21122 | "spaceItems_3xlOn_2xl": "pf-m-space-items-3xl-on-2xl",
|
21123 | "spaceItems_4xlOn_2xl": "pf-m-space-items-4xl-on-2xl",
|
21124 | "spacerNone": "pf-m-spacer-none",
|
21125 | "spacerXs": "pf-m-spacer-xs",
|
21126 | "spacerSm": "pf-m-spacer-sm",
|
21127 | "spacerMd": "pf-m-spacer-md",
|
21128 | "spacerLg": "pf-m-spacer-lg",
|
21129 | "spacerXl": "pf-m-spacer-xl",
|
21130 | "spacer_2xl": "pf-m-spacer-2xl",
|
21131 | "spacer_3xl": "pf-m-spacer-3xl",
|
21132 | "spacer_4xl": "pf-m-spacer-4xl",
|
21133 | "spacerNoneOnSm": "pf-m-spacer-none-on-sm",
|
21134 | "spacerXsOnSm": "pf-m-spacer-xs-on-sm",
|
21135 | "spacerSmOnSm": "pf-m-spacer-sm-on-sm",
|
21136 | "spacerMdOnSm": "pf-m-spacer-md-on-sm",
|
21137 | "spacerLgOnSm": "pf-m-spacer-lg-on-sm",
|
21138 | "spacerXlOnSm": "pf-m-spacer-xl-on-sm",
|
21139 | "spacer_2xlOnSm": "pf-m-spacer-2xl-on-sm",
|
21140 | "spacer_3xlOnSm": "pf-m-spacer-3xl-on-sm",
|
21141 | "spacer_4xlOnSm": "pf-m-spacer-4xl-on-sm",
|
21142 | "spacerNoneOnMd": "pf-m-spacer-none-on-md",
|
21143 | "spacerXsOnMd": "pf-m-spacer-xs-on-md",
|
21144 | "spacerSmOnMd": "pf-m-spacer-sm-on-md",
|
21145 | "spacerMdOnMd": "pf-m-spacer-md-on-md",
|
21146 | "spacerLgOnMd": "pf-m-spacer-lg-on-md",
|
21147 | "spacerXlOnMd": "pf-m-spacer-xl-on-md",
|
21148 | "spacer_2xlOnMd": "pf-m-spacer-2xl-on-md",
|
21149 | "spacer_3xlOnMd": "pf-m-spacer-3xl-on-md",
|
21150 | "spacer_4xlOnMd": "pf-m-spacer-4xl-on-md",
|
21151 | "spacerNoneOnLg": "pf-m-spacer-none-on-lg",
|
21152 | "spacerXsOnLg": "pf-m-spacer-xs-on-lg",
|
21153 | "spacerSmOnLg": "pf-m-spacer-sm-on-lg",
|
21154 | "spacerMdOnLg": "pf-m-spacer-md-on-lg",
|
21155 | "spacerLgOnLg": "pf-m-spacer-lg-on-lg",
|
21156 | "spacerXlOnLg": "pf-m-spacer-xl-on-lg",
|
21157 | "spacer_2xlOnLg": "pf-m-spacer-2xl-on-lg",
|
21158 | "spacer_3xlOnLg": "pf-m-spacer-3xl-on-lg",
|
21159 | "spacer_4xlOnLg": "pf-m-spacer-4xl-on-lg",
|
21160 | "spacerNoneOnXl": "pf-m-spacer-none-on-xl",
|
21161 | "spacerXsOnXl": "pf-m-spacer-xs-on-xl",
|
21162 | "spacerSmOnXl": "pf-m-spacer-sm-on-xl",
|
21163 | "spacerMdOnXl": "pf-m-spacer-md-on-xl",
|
21164 | "spacerLgOnXl": "pf-m-spacer-lg-on-xl",
|
21165 | "spacerXlOnXl": "pf-m-spacer-xl-on-xl",
|
21166 | "spacer_2xlOnXl": "pf-m-spacer-2xl-on-xl",
|
21167 | "spacer_3xlOnXl": "pf-m-spacer-3xl-on-xl",
|
21168 | "spacer_4xlOnXl": "pf-m-spacer-4xl-on-xl",
|
21169 | "spacerNoneOn_2xl": "pf-m-spacer-none-on-2xl",
|
21170 | "spacerXsOn_2xl": "pf-m-spacer-xs-on-2xl",
|
21171 | "spacerSmOn_2xl": "pf-m-spacer-sm-on-2xl",
|
21172 | "spacerMdOn_2xl": "pf-m-spacer-md-on-2xl",
|
21173 | "spacerLgOn_2xl": "pf-m-spacer-lg-on-2xl",
|
21174 | "spacerXlOn_2xl": "pf-m-spacer-xl-on-2xl",
|
21175 | "spacer_2xlOn_2xl": "pf-m-spacer-2xl-on-2xl",
|
21176 | "spacer_3xlOn_2xl": "pf-m-spacer-3xl-on-2xl",
|
21177 | "spacer_4xlOn_2xl": "pf-m-spacer-4xl-on-2xl"
|
21178 | }
|
21179 | };
|
21180 |
|
21181 | const l_flex_item_Order = {
|
21182 | "name": "--pf-l-flex--item--Order",
|
21183 | "value": "0",
|
21184 | "var": "var(--pf-l-flex--item--Order)"
|
21185 | };
|
21186 |
|
21187 | const Flex = (_a) => {
|
21188 | var { children = null, className = '', component = 'div', spacer, spaceItems, grow, shrink, flex, direction, alignItems, alignContent, alignSelf, align, justifyContent, display, fullWidth, flexWrap, order, style } = _a, props = __rest$1(_a, ["children", "className", "component", "spacer", "spaceItems", "grow", "shrink", "flex", "direction", "alignItems", "alignContent", "alignSelf", "align", "justifyContent", "display", "fullWidth", "flexWrap", "order", "style"]);
|
21189 | const Component = component;
|
21190 | return (React__namespace.createElement(Component, Object.assign({ className: css(styles$5.flex, formatBreakpointMods(spacer, styles$5), formatBreakpointMods(spaceItems, styles$5), formatBreakpointMods(grow, styles$5), formatBreakpointMods(shrink, styles$5), formatBreakpointMods(flex, styles$5), formatBreakpointMods(direction, styles$5), formatBreakpointMods(alignItems, styles$5), formatBreakpointMods(alignContent, styles$5), formatBreakpointMods(alignSelf, styles$5), formatBreakpointMods(align, styles$5), formatBreakpointMods(justifyContent, styles$5), formatBreakpointMods(display, styles$5), formatBreakpointMods(fullWidth, styles$5), formatBreakpointMods(flexWrap, styles$5), className), style: style || order ? Object.assign(Object.assign({}, style), setBreakpointCssVars(order, l_flex_item_Order.name)) : undefined }, props), children));
|
21191 | };
|
21192 | Flex.displayName = 'Flex';
|
21193 |
|
21194 | const FlexItem = (_a) => {
|
21195 | var { children = null, className = '', component = 'div', spacer, grow, shrink, flex, alignSelf, align, fullWidth, order, style } = _a, props = __rest$1(_a, ["children", "className", "component", "spacer", "grow", "shrink", "flex", "alignSelf", "align", "fullWidth", "order", "style"]);
|
21196 | const Component = component;
|
21197 | return (React__namespace.createElement(Component, Object.assign({}, props, { className: css(formatBreakpointMods(spacer, styles$5), formatBreakpointMods(grow, styles$5), formatBreakpointMods(shrink, styles$5), formatBreakpointMods(flex, styles$5), formatBreakpointMods(alignSelf, styles$5), formatBreakpointMods(align, styles$5), formatBreakpointMods(fullWidth, styles$5), className), style: style || order ? Object.assign(Object.assign({}, style), setBreakpointCssVars(order, l_flex_item_Order.name)) : undefined }), children));
|
21198 | };
|
21199 | FlexItem.displayName = 'FlexItem';
|
21200 |
|
21201 | Promise.resolve().then(function () { return gallery; });
|
21202 | var styles$4 = {
|
21203 | "gallery": "pf-l-gallery",
|
21204 | "modifiers": {
|
21205 | "gutter": "pf-m-gutter"
|
21206 | }
|
21207 | };
|
21208 |
|
21209 | const Gallery = (_a) => {
|
21210 | var { children = null, className = '', component = 'div', hasGutter = false, minWidths, maxWidths } = _a, props = __rest$1(_a, ["children", "className", "component", "hasGutter", "minWidths", "maxWidths"]);
|
21211 | const minWidthStyles = {};
|
21212 | const Component = component;
|
21213 | if (minWidths) {
|
21214 | Object.entries(minWidths || {}).map(([breakpoint, value]) => (minWidthStyles[`--pf-l-gallery--GridTemplateColumns--min${breakpoint !== 'default' ? `-on-${breakpoint}` : ''}`] = value));
|
21215 | }
|
21216 | const maxWidthStyles = {};
|
21217 | if (maxWidths) {
|
21218 | Object.entries(maxWidths || {}).map(([breakpoint, value]) => (maxWidthStyles[`--pf-l-gallery--GridTemplateColumns--max${breakpoint !== 'default' ? `-on-${breakpoint}` : ''}`] = value));
|
21219 | }
|
21220 | const widthStyles = Object.assign(Object.assign({}, minWidthStyles), maxWidthStyles);
|
21221 | return (React__namespace.createElement(Component, Object.assign({ className: css(styles$4.gallery, hasGutter && styles$4.modifiers.gutter, className) }, props, ((minWidths || maxWidths) && { style: Object.assign(Object.assign({}, widthStyles), props.style) })), children));
|
21222 | };
|
21223 | Gallery.displayName = 'Gallery';
|
21224 |
|
21225 | const GalleryItem = (_a) => {
|
21226 | var { children = null, component = 'div' } = _a, props = __rest$1(_a, ["children", "component"]);
|
21227 | const Component = component;
|
21228 | return React__namespace.createElement(Component, Object.assign({}, props), children);
|
21229 | };
|
21230 | GalleryItem.displayName = 'GalleryItem';
|
21231 |
|
21232 | Promise.resolve().then(function () { return grid; });
|
21233 | var styles$3 = {
|
21234 | "grid": "pf-l-grid",
|
21235 | "gridItem": "pf-l-grid__item",
|
21236 | "modifiers": {
|
21237 | "all_1Col": "pf-m-all-1-col",
|
21238 | "all_2Col": "pf-m-all-2-col",
|
21239 | "all_3Col": "pf-m-all-3-col",
|
21240 | "all_4Col": "pf-m-all-4-col",
|
21241 | "all_5Col": "pf-m-all-5-col",
|
21242 | "all_6Col": "pf-m-all-6-col",
|
21243 | "all_7Col": "pf-m-all-7-col",
|
21244 | "all_8Col": "pf-m-all-8-col",
|
21245 | "all_9Col": "pf-m-all-9-col",
|
21246 | "all_10Col": "pf-m-all-10-col",
|
21247 | "all_11Col": "pf-m-all-11-col",
|
21248 | "all_12Col": "pf-m-all-12-col",
|
21249 | "all_1ColOnSm": "pf-m-all-1-col-on-sm",
|
21250 | "all_2ColOnSm": "pf-m-all-2-col-on-sm",
|
21251 | "all_3ColOnSm": "pf-m-all-3-col-on-sm",
|
21252 | "all_4ColOnSm": "pf-m-all-4-col-on-sm",
|
21253 | "all_5ColOnSm": "pf-m-all-5-col-on-sm",
|
21254 | "all_6ColOnSm": "pf-m-all-6-col-on-sm",
|
21255 | "all_7ColOnSm": "pf-m-all-7-col-on-sm",
|
21256 | "all_8ColOnSm": "pf-m-all-8-col-on-sm",
|
21257 | "all_9ColOnSm": "pf-m-all-9-col-on-sm",
|
21258 | "all_10ColOnSm": "pf-m-all-10-col-on-sm",
|
21259 | "all_11ColOnSm": "pf-m-all-11-col-on-sm",
|
21260 | "all_12ColOnSm": "pf-m-all-12-col-on-sm",
|
21261 | "all_1ColOnMd": "pf-m-all-1-col-on-md",
|
21262 | "all_2ColOnMd": "pf-m-all-2-col-on-md",
|
21263 | "all_3ColOnMd": "pf-m-all-3-col-on-md",
|
21264 | "all_4ColOnMd": "pf-m-all-4-col-on-md",
|
21265 | "all_5ColOnMd": "pf-m-all-5-col-on-md",
|
21266 | "all_6ColOnMd": "pf-m-all-6-col-on-md",
|
21267 | "all_7ColOnMd": "pf-m-all-7-col-on-md",
|
21268 | "all_8ColOnMd": "pf-m-all-8-col-on-md",
|
21269 | "all_9ColOnMd": "pf-m-all-9-col-on-md",
|
21270 | "all_10ColOnMd": "pf-m-all-10-col-on-md",
|
21271 | "all_11ColOnMd": "pf-m-all-11-col-on-md",
|
21272 | "all_12ColOnMd": "pf-m-all-12-col-on-md",
|
21273 | "all_1ColOnLg": "pf-m-all-1-col-on-lg",
|
21274 | "all_2ColOnLg": "pf-m-all-2-col-on-lg",
|
21275 | "all_3ColOnLg": "pf-m-all-3-col-on-lg",
|
21276 | "all_4ColOnLg": "pf-m-all-4-col-on-lg",
|
21277 | "all_5ColOnLg": "pf-m-all-5-col-on-lg",
|
21278 | "all_6ColOnLg": "pf-m-all-6-col-on-lg",
|
21279 | "all_7ColOnLg": "pf-m-all-7-col-on-lg",
|
21280 | "all_8ColOnLg": "pf-m-all-8-col-on-lg",
|
21281 | "all_9ColOnLg": "pf-m-all-9-col-on-lg",
|
21282 | "all_10ColOnLg": "pf-m-all-10-col-on-lg",
|
21283 | "all_11ColOnLg": "pf-m-all-11-col-on-lg",
|
21284 | "all_12ColOnLg": "pf-m-all-12-col-on-lg",
|
21285 | "all_1ColOnXl": "pf-m-all-1-col-on-xl",
|
21286 | "all_2ColOnXl": "pf-m-all-2-col-on-xl",
|
21287 | "all_3ColOnXl": "pf-m-all-3-col-on-xl",
|
21288 | "all_4ColOnXl": "pf-m-all-4-col-on-xl",
|
21289 | "all_5ColOnXl": "pf-m-all-5-col-on-xl",
|
21290 | "all_6ColOnXl": "pf-m-all-6-col-on-xl",
|
21291 | "all_7ColOnXl": "pf-m-all-7-col-on-xl",
|
21292 | "all_8ColOnXl": "pf-m-all-8-col-on-xl",
|
21293 | "all_9ColOnXl": "pf-m-all-9-col-on-xl",
|
21294 | "all_10ColOnXl": "pf-m-all-10-col-on-xl",
|
21295 | "all_11ColOnXl": "pf-m-all-11-col-on-xl",
|
21296 | "all_12ColOnXl": "pf-m-all-12-col-on-xl",
|
21297 | "all_1ColOn_2xl": "pf-m-all-1-col-on-2xl",
|
21298 | "all_2ColOn_2xl": "pf-m-all-2-col-on-2xl",
|
21299 | "all_3ColOn_2xl": "pf-m-all-3-col-on-2xl",
|
21300 | "all_4ColOn_2xl": "pf-m-all-4-col-on-2xl",
|
21301 | "all_5ColOn_2xl": "pf-m-all-5-col-on-2xl",
|
21302 | "all_6ColOn_2xl": "pf-m-all-6-col-on-2xl",
|
21303 | "all_7ColOn_2xl": "pf-m-all-7-col-on-2xl",
|
21304 | "all_8ColOn_2xl": "pf-m-all-8-col-on-2xl",
|
21305 | "all_9ColOn_2xl": "pf-m-all-9-col-on-2xl",
|
21306 | "all_10ColOn_2xl": "pf-m-all-10-col-on-2xl",
|
21307 | "all_11ColOn_2xl": "pf-m-all-11-col-on-2xl",
|
21308 | "all_12ColOn_2xl": "pf-m-all-12-col-on-2xl",
|
21309 | "1Col": "pf-m-1-col",
|
21310 | "2Col": "pf-m-2-col",
|
21311 | "3Col": "pf-m-3-col",
|
21312 | "4Col": "pf-m-4-col",
|
21313 | "5Col": "pf-m-5-col",
|
21314 | "6Col": "pf-m-6-col",
|
21315 | "7Col": "pf-m-7-col",
|
21316 | "8Col": "pf-m-8-col",
|
21317 | "9Col": "pf-m-9-col",
|
21318 | "10Col": "pf-m-10-col",
|
21319 | "11Col": "pf-m-11-col",
|
21320 | "12Col": "pf-m-12-col",
|
21321 | "offset_1Col": "pf-m-offset-1-col",
|
21322 | "offset_2Col": "pf-m-offset-2-col",
|
21323 | "offset_3Col": "pf-m-offset-3-col",
|
21324 | "offset_4Col": "pf-m-offset-4-col",
|
21325 | "offset_5Col": "pf-m-offset-5-col",
|
21326 | "offset_6Col": "pf-m-offset-6-col",
|
21327 | "offset_7Col": "pf-m-offset-7-col",
|
21328 | "offset_8Col": "pf-m-offset-8-col",
|
21329 | "offset_9Col": "pf-m-offset-9-col",
|
21330 | "offset_10Col": "pf-m-offset-10-col",
|
21331 | "offset_11Col": "pf-m-offset-11-col",
|
21332 | "offset_12Col": "pf-m-offset-12-col",
|
21333 | "1Row": "pf-m-1-row",
|
21334 | "2Row": "pf-m-2-row",
|
21335 | "3Row": "pf-m-3-row",
|
21336 | "4Row": "pf-m-4-row",
|
21337 | "5Row": "pf-m-5-row",
|
21338 | "6Row": "pf-m-6-row",
|
21339 | "7Row": "pf-m-7-row",
|
21340 | "8Row": "pf-m-8-row",
|
21341 | "9Row": "pf-m-9-row",
|
21342 | "10Row": "pf-m-10-row",
|
21343 | "11Row": "pf-m-11-row",
|
21344 | "12Row": "pf-m-12-row",
|
21345 | "1ColOnSm": "pf-m-1-col-on-sm",
|
21346 | "2ColOnSm": "pf-m-2-col-on-sm",
|
21347 | "3ColOnSm": "pf-m-3-col-on-sm",
|
21348 | "4ColOnSm": "pf-m-4-col-on-sm",
|
21349 | "5ColOnSm": "pf-m-5-col-on-sm",
|
21350 | "6ColOnSm": "pf-m-6-col-on-sm",
|
21351 | "7ColOnSm": "pf-m-7-col-on-sm",
|
21352 | "8ColOnSm": "pf-m-8-col-on-sm",
|
21353 | "9ColOnSm": "pf-m-9-col-on-sm",
|
21354 | "10ColOnSm": "pf-m-10-col-on-sm",
|
21355 | "11ColOnSm": "pf-m-11-col-on-sm",
|
21356 | "12ColOnSm": "pf-m-12-col-on-sm",
|
21357 | "offset_1ColOnSm": "pf-m-offset-1-col-on-sm",
|
21358 | "offset_2ColOnSm": "pf-m-offset-2-col-on-sm",
|
21359 | "offset_3ColOnSm": "pf-m-offset-3-col-on-sm",
|
21360 | "offset_4ColOnSm": "pf-m-offset-4-col-on-sm",
|
21361 | "offset_5ColOnSm": "pf-m-offset-5-col-on-sm",
|
21362 | "offset_6ColOnSm": "pf-m-offset-6-col-on-sm",
|
21363 | "offset_7ColOnSm": "pf-m-offset-7-col-on-sm",
|
21364 | "offset_8ColOnSm": "pf-m-offset-8-col-on-sm",
|
21365 | "offset_9ColOnSm": "pf-m-offset-9-col-on-sm",
|
21366 | "offset_10ColOnSm": "pf-m-offset-10-col-on-sm",
|
21367 | "offset_11ColOnSm": "pf-m-offset-11-col-on-sm",
|
21368 | "offset_12ColOnSm": "pf-m-offset-12-col-on-sm",
|
21369 | "1RowOnSm": "pf-m-1-row-on-sm",
|
21370 | "2RowOnSm": "pf-m-2-row-on-sm",
|
21371 | "3RowOnSm": "pf-m-3-row-on-sm",
|
21372 | "4RowOnSm": "pf-m-4-row-on-sm",
|
21373 | "5RowOnSm": "pf-m-5-row-on-sm",
|
21374 | "6RowOnSm": "pf-m-6-row-on-sm",
|
21375 | "7RowOnSm": "pf-m-7-row-on-sm",
|
21376 | "8RowOnSm": "pf-m-8-row-on-sm",
|
21377 | "9RowOnSm": "pf-m-9-row-on-sm",
|
21378 | "10RowOnSm": "pf-m-10-row-on-sm",
|
21379 | "11RowOnSm": "pf-m-11-row-on-sm",
|
21380 | "12RowOnSm": "pf-m-12-row-on-sm",
|
21381 | "1ColOnMd": "pf-m-1-col-on-md",
|
21382 | "2ColOnMd": "pf-m-2-col-on-md",
|
21383 | "3ColOnMd": "pf-m-3-col-on-md",
|
21384 | "4ColOnMd": "pf-m-4-col-on-md",
|
21385 | "5ColOnMd": "pf-m-5-col-on-md",
|
21386 | "6ColOnMd": "pf-m-6-col-on-md",
|
21387 | "7ColOnMd": "pf-m-7-col-on-md",
|
21388 | "8ColOnMd": "pf-m-8-col-on-md",
|
21389 | "9ColOnMd": "pf-m-9-col-on-md",
|
21390 | "10ColOnMd": "pf-m-10-col-on-md",
|
21391 | "11ColOnMd": "pf-m-11-col-on-md",
|
21392 | "12ColOnMd": "pf-m-12-col-on-md",
|
21393 | "offset_1ColOnMd": "pf-m-offset-1-col-on-md",
|
21394 | "offset_2ColOnMd": "pf-m-offset-2-col-on-md",
|
21395 | "offset_3ColOnMd": "pf-m-offset-3-col-on-md",
|
21396 | "offset_4ColOnMd": "pf-m-offset-4-col-on-md",
|
21397 | "offset_5ColOnMd": "pf-m-offset-5-col-on-md",
|
21398 | "offset_6ColOnMd": "pf-m-offset-6-col-on-md",
|
21399 | "offset_7ColOnMd": "pf-m-offset-7-col-on-md",
|
21400 | "offset_8ColOnMd": "pf-m-offset-8-col-on-md",
|
21401 | "offset_9ColOnMd": "pf-m-offset-9-col-on-md",
|
21402 | "offset_10ColOnMd": "pf-m-offset-10-col-on-md",
|
21403 | "offset_11ColOnMd": "pf-m-offset-11-col-on-md",
|
21404 | "offset_12ColOnMd": "pf-m-offset-12-col-on-md",
|
21405 | "1RowOnMd": "pf-m-1-row-on-md",
|
21406 | "2RowOnMd": "pf-m-2-row-on-md",
|
21407 | "3RowOnMd": "pf-m-3-row-on-md",
|
21408 | "4RowOnMd": "pf-m-4-row-on-md",
|
21409 | "5RowOnMd": "pf-m-5-row-on-md",
|
21410 | "6RowOnMd": "pf-m-6-row-on-md",
|
21411 | "7RowOnMd": "pf-m-7-row-on-md",
|
21412 | "8RowOnMd": "pf-m-8-row-on-md",
|
21413 | "9RowOnMd": "pf-m-9-row-on-md",
|
21414 | "10RowOnMd": "pf-m-10-row-on-md",
|
21415 | "11RowOnMd": "pf-m-11-row-on-md",
|
21416 | "12RowOnMd": "pf-m-12-row-on-md",
|
21417 | "1ColOnLg": "pf-m-1-col-on-lg",
|
21418 | "2ColOnLg": "pf-m-2-col-on-lg",
|
21419 | "3ColOnLg": "pf-m-3-col-on-lg",
|
21420 | "4ColOnLg": "pf-m-4-col-on-lg",
|
21421 | "5ColOnLg": "pf-m-5-col-on-lg",
|
21422 | "6ColOnLg": "pf-m-6-col-on-lg",
|
21423 | "7ColOnLg": "pf-m-7-col-on-lg",
|
21424 | "8ColOnLg": "pf-m-8-col-on-lg",
|
21425 | "9ColOnLg": "pf-m-9-col-on-lg",
|
21426 | "10ColOnLg": "pf-m-10-col-on-lg",
|
21427 | "11ColOnLg": "pf-m-11-col-on-lg",
|
21428 | "12ColOnLg": "pf-m-12-col-on-lg",
|
21429 | "offset_1ColOnLg": "pf-m-offset-1-col-on-lg",
|
21430 | "offset_2ColOnLg": "pf-m-offset-2-col-on-lg",
|
21431 | "offset_3ColOnLg": "pf-m-offset-3-col-on-lg",
|
21432 | "offset_4ColOnLg": "pf-m-offset-4-col-on-lg",
|
21433 | "offset_5ColOnLg": "pf-m-offset-5-col-on-lg",
|
21434 | "offset_6ColOnLg": "pf-m-offset-6-col-on-lg",
|
21435 | "offset_7ColOnLg": "pf-m-offset-7-col-on-lg",
|
21436 | "offset_8ColOnLg": "pf-m-offset-8-col-on-lg",
|
21437 | "offset_9ColOnLg": "pf-m-offset-9-col-on-lg",
|
21438 | "offset_10ColOnLg": "pf-m-offset-10-col-on-lg",
|
21439 | "offset_11ColOnLg": "pf-m-offset-11-col-on-lg",
|
21440 | "offset_12ColOnLg": "pf-m-offset-12-col-on-lg",
|
21441 | "1RowOnLg": "pf-m-1-row-on-lg",
|
21442 | "2RowOnLg": "pf-m-2-row-on-lg",
|
21443 | "3RowOnLg": "pf-m-3-row-on-lg",
|
21444 | "4RowOnLg": "pf-m-4-row-on-lg",
|
21445 | "5RowOnLg": "pf-m-5-row-on-lg",
|
21446 | "6RowOnLg": "pf-m-6-row-on-lg",
|
21447 | "7RowOnLg": "pf-m-7-row-on-lg",
|
21448 | "8RowOnLg": "pf-m-8-row-on-lg",
|
21449 | "9RowOnLg": "pf-m-9-row-on-lg",
|
21450 | "10RowOnLg": "pf-m-10-row-on-lg",
|
21451 | "11RowOnLg": "pf-m-11-row-on-lg",
|
21452 | "12RowOnLg": "pf-m-12-row-on-lg",
|
21453 | "1ColOnXl": "pf-m-1-col-on-xl",
|
21454 | "2ColOnXl": "pf-m-2-col-on-xl",
|
21455 | "3ColOnXl": "pf-m-3-col-on-xl",
|
21456 | "4ColOnXl": "pf-m-4-col-on-xl",
|
21457 | "5ColOnXl": "pf-m-5-col-on-xl",
|
21458 | "6ColOnXl": "pf-m-6-col-on-xl",
|
21459 | "7ColOnXl": "pf-m-7-col-on-xl",
|
21460 | "8ColOnXl": "pf-m-8-col-on-xl",
|
21461 | "9ColOnXl": "pf-m-9-col-on-xl",
|
21462 | "10ColOnXl": "pf-m-10-col-on-xl",
|
21463 | "11ColOnXl": "pf-m-11-col-on-xl",
|
21464 | "12ColOnXl": "pf-m-12-col-on-xl",
|
21465 | "offset_1ColOnXl": "pf-m-offset-1-col-on-xl",
|
21466 | "offset_2ColOnXl": "pf-m-offset-2-col-on-xl",
|
21467 | "offset_3ColOnXl": "pf-m-offset-3-col-on-xl",
|
21468 | "offset_4ColOnXl": "pf-m-offset-4-col-on-xl",
|
21469 | "offset_5ColOnXl": "pf-m-offset-5-col-on-xl",
|
21470 | "offset_6ColOnXl": "pf-m-offset-6-col-on-xl",
|
21471 | "offset_7ColOnXl": "pf-m-offset-7-col-on-xl",
|
21472 | "offset_8ColOnXl": "pf-m-offset-8-col-on-xl",
|
21473 | "offset_9ColOnXl": "pf-m-offset-9-col-on-xl",
|
21474 | "offset_10ColOnXl": "pf-m-offset-10-col-on-xl",
|
21475 | "offset_11ColOnXl": "pf-m-offset-11-col-on-xl",
|
21476 | "offset_12ColOnXl": "pf-m-offset-12-col-on-xl",
|
21477 | "1RowOnXl": "pf-m-1-row-on-xl",
|
21478 | "2RowOnXl": "pf-m-2-row-on-xl",
|
21479 | "3RowOnXl": "pf-m-3-row-on-xl",
|
21480 | "4RowOnXl": "pf-m-4-row-on-xl",
|
21481 | "5RowOnXl": "pf-m-5-row-on-xl",
|
21482 | "6RowOnXl": "pf-m-6-row-on-xl",
|
21483 | "7RowOnXl": "pf-m-7-row-on-xl",
|
21484 | "8RowOnXl": "pf-m-8-row-on-xl",
|
21485 | "9RowOnXl": "pf-m-9-row-on-xl",
|
21486 | "10RowOnXl": "pf-m-10-row-on-xl",
|
21487 | "11RowOnXl": "pf-m-11-row-on-xl",
|
21488 | "12RowOnXl": "pf-m-12-row-on-xl",
|
21489 | "1ColOn_2xl": "pf-m-1-col-on-2xl",
|
21490 | "2ColOn_2xl": "pf-m-2-col-on-2xl",
|
21491 | "3ColOn_2xl": "pf-m-3-col-on-2xl",
|
21492 | "4ColOn_2xl": "pf-m-4-col-on-2xl",
|
21493 | "5ColOn_2xl": "pf-m-5-col-on-2xl",
|
21494 | "6ColOn_2xl": "pf-m-6-col-on-2xl",
|
21495 | "7ColOn_2xl": "pf-m-7-col-on-2xl",
|
21496 | "8ColOn_2xl": "pf-m-8-col-on-2xl",
|
21497 | "9ColOn_2xl": "pf-m-9-col-on-2xl",
|
21498 | "10ColOn_2xl": "pf-m-10-col-on-2xl",
|
21499 | "11ColOn_2xl": "pf-m-11-col-on-2xl",
|
21500 | "12ColOn_2xl": "pf-m-12-col-on-2xl",
|
21501 | "offset_1ColOn_2xl": "pf-m-offset-1-col-on-2xl",
|
21502 | "offset_2ColOn_2xl": "pf-m-offset-2-col-on-2xl",
|
21503 | "offset_3ColOn_2xl": "pf-m-offset-3-col-on-2xl",
|
21504 | "offset_4ColOn_2xl": "pf-m-offset-4-col-on-2xl",
|
21505 | "offset_5ColOn_2xl": "pf-m-offset-5-col-on-2xl",
|
21506 | "offset_6ColOn_2xl": "pf-m-offset-6-col-on-2xl",
|
21507 | "offset_7ColOn_2xl": "pf-m-offset-7-col-on-2xl",
|
21508 | "offset_8ColOn_2xl": "pf-m-offset-8-col-on-2xl",
|
21509 | "offset_9ColOn_2xl": "pf-m-offset-9-col-on-2xl",
|
21510 | "offset_10ColOn_2xl": "pf-m-offset-10-col-on-2xl",
|
21511 | "offset_11ColOn_2xl": "pf-m-offset-11-col-on-2xl",
|
21512 | "offset_12ColOn_2xl": "pf-m-offset-12-col-on-2xl",
|
21513 | "1RowOn_2xl": "pf-m-1-row-on-2xl",
|
21514 | "2RowOn_2xl": "pf-m-2-row-on-2xl",
|
21515 | "3RowOn_2xl": "pf-m-3-row-on-2xl",
|
21516 | "4RowOn_2xl": "pf-m-4-row-on-2xl",
|
21517 | "5RowOn_2xl": "pf-m-5-row-on-2xl",
|
21518 | "6RowOn_2xl": "pf-m-6-row-on-2xl",
|
21519 | "7RowOn_2xl": "pf-m-7-row-on-2xl",
|
21520 | "8RowOn_2xl": "pf-m-8-row-on-2xl",
|
21521 | "9RowOn_2xl": "pf-m-9-row-on-2xl",
|
21522 | "10RowOn_2xl": "pf-m-10-row-on-2xl",
|
21523 | "11RowOn_2xl": "pf-m-11-row-on-2xl",
|
21524 | "12RowOn_2xl": "pf-m-12-row-on-2xl",
|
21525 | "gutter": "pf-m-gutter"
|
21526 | }
|
21527 | };
|
21528 |
|
21529 | exports.BaseSizes = void 0;
|
21530 | (function (BaseSizes) {
|
21531 | BaseSizes["xs"] = "xs";
|
21532 | BaseSizes["sm"] = "sm";
|
21533 | BaseSizes["md"] = "md";
|
21534 | BaseSizes["lg"] = "lg";
|
21535 | BaseSizes["xl"] = "xl";
|
21536 | BaseSizes["2xl"] = "2xl";
|
21537 | BaseSizes["3xl"] = "3xl";
|
21538 | BaseSizes["4xl"] = "4xl";
|
21539 | })(exports.BaseSizes || (exports.BaseSizes = {}));
|
21540 | exports.DeviceSizes = void 0;
|
21541 | (function (DeviceSizes) {
|
21542 | DeviceSizes["sm"] = "Sm";
|
21543 | DeviceSizes["md"] = "Md";
|
21544 | DeviceSizes["lg"] = "Lg";
|
21545 | DeviceSizes["xl"] = "Xl";
|
21546 | DeviceSizes["xl2"] = "_2xl";
|
21547 | })(exports.DeviceSizes || (exports.DeviceSizes = {}));
|
21548 |
|
21549 | const l_grid_item_Order = {
|
21550 | "name": "--pf-l-grid--item--Order",
|
21551 | "value": "0",
|
21552 | "var": "var(--pf-l-grid--item--Order)"
|
21553 | };
|
21554 |
|
21555 | const Grid = (_a) => {
|
21556 | var { children = null, className = '', component = 'div', hasGutter, span = null, order, style } = _a, props = __rest$1(_a, ["children", "className", "component", "hasGutter", "span", "order", "style"]);
|
21557 | const classes = [styles$3.grid, span && styles$3.modifiers[`all_${span}Col`]];
|
21558 | const Component = component;
|
21559 | Object.entries(exports.DeviceSizes).forEach(([propKey, gridSpanModifier]) => {
|
21560 | const key = propKey;
|
21561 | const propValue = props[key];
|
21562 | if (propValue) {
|
21563 | classes.push(styles$3.modifiers[`all_${propValue}ColOn${gridSpanModifier}`]);
|
21564 | }
|
21565 | delete props[key];
|
21566 | });
|
21567 | return (React__namespace.createElement(Component, Object.assign({ className: css(...classes, hasGutter && styles$3.modifiers.gutter, className), style: style || order ? Object.assign(Object.assign({}, style), setBreakpointCssVars(order, l_grid_item_Order.name)) : undefined }, props), children));
|
21568 | };
|
21569 | Grid.displayName = 'Grid';
|
21570 |
|
21571 | const GridItem = (_a) => {
|
21572 | var { children = null, className = '', component = 'div', span = null, rowSpan = null, offset = null, order, style } = _a, props = __rest$1(_a, ["children", "className", "component", "span", "rowSpan", "offset", "order", "style"]);
|
21573 | const classes = [
|
21574 | styles$3.gridItem,
|
21575 | span && styles$3.modifiers[`${span}Col`],
|
21576 | rowSpan && styles$3.modifiers[`${rowSpan}Row`],
|
21577 | offset && styles$3.modifiers[`offset_${offset}Col`]
|
21578 | ];
|
21579 | const Component = component;
|
21580 | Object.entries(exports.DeviceSizes).forEach(([propKey, classModifier]) => {
|
21581 | const key = propKey;
|
21582 | const rowSpanKey = `${key}RowSpan`;
|
21583 | const offsetKey = `${key}Offset`;
|
21584 | const spanValue = props[key];
|
21585 | const rowSpanValue = props[rowSpanKey];
|
21586 | const offsetValue = props[offsetKey];
|
21587 | if (spanValue) {
|
21588 | classes.push(styles$3.modifiers[`${spanValue}ColOn${classModifier}`]);
|
21589 | }
|
21590 | if (rowSpanValue) {
|
21591 | classes.push(styles$3.modifiers[`${rowSpanValue}RowOn${classModifier}`]);
|
21592 | }
|
21593 | if (offsetValue) {
|
21594 | classes.push(styles$3.modifiers[`offset_${offsetValue}ColOn${classModifier}`]);
|
21595 | }
|
21596 | delete props[key];
|
21597 | delete props[rowSpanKey];
|
21598 | delete props[offsetKey];
|
21599 | });
|
21600 | return (React__namespace.createElement(Component, Object.assign({ className: css(...classes, className), style: style || order ? Object.assign(Object.assign({}, style), setBreakpointCssVars(order, l_grid_item_Order.name)) : undefined }, props), children));
|
21601 | };
|
21602 | GridItem.displayName = 'GridItem';
|
21603 |
|
21604 | Promise.resolve().then(function () { return level; });
|
21605 | var styles$2 = {
|
21606 | "level": "pf-l-level",
|
21607 | "modifiers": {
|
21608 | "gutter": "pf-m-gutter"
|
21609 | }
|
21610 | };
|
21611 |
|
21612 | const Level = (_a) => {
|
21613 | var { hasGutter, className = '', children = null } = _a, props = __rest$1(_a, ["hasGutter", "className", "children"]);
|
21614 | return (React__namespace.createElement("div", Object.assign({}, props, { className: css(styles$2.level, hasGutter && styles$2.modifiers.gutter, className) }), children));
|
21615 | };
|
21616 | Level.displayName = 'Level';
|
21617 |
|
21618 | const LevelItem = (_a) => {
|
21619 | var { children = null } = _a, props = __rest$1(_a, ["children"]);
|
21620 | return (React__namespace.createElement("div", Object.assign({}, props), children));
|
21621 | };
|
21622 | LevelItem.displayName = 'LevelItem';
|
21623 |
|
21624 | Promise.resolve().then(function () { return split; });
|
21625 | var styles$1 = {
|
21626 | "modifiers": {
|
21627 | "wrap": "pf-m-wrap",
|
21628 | "fill": "pf-m-fill",
|
21629 | "gutter": "pf-m-gutter"
|
21630 | },
|
21631 | "split": "pf-l-split",
|
21632 | "splitItem": "pf-l-split__item"
|
21633 | };
|
21634 |
|
21635 | const Split = (_a) => {
|
21636 | var { hasGutter = false, isWrappable = false, className = '', children = null, component = 'div' } = _a, props = __rest$1(_a, ["hasGutter", "isWrappable", "className", "children", "component"]);
|
21637 | const Component = component;
|
21638 | return (React__namespace.createElement(Component, Object.assign({}, props, { className: css(styles$1.split, hasGutter && styles$1.modifiers.gutter, isWrappable && styles$1.modifiers.wrap, className) }), children));
|
21639 | };
|
21640 | Split.displayName = 'Split';
|
21641 |
|
21642 | const SplitItem = (_a) => {
|
21643 | var { isFilled = false, className = '', children = null } = _a, props = __rest$1(_a, ["isFilled", "className", "children"]);
|
21644 | return (React__namespace.createElement("div", Object.assign({}, props, { className: css(styles$1.splitItem, isFilled && styles$1.modifiers.fill, className) }), children));
|
21645 | };
|
21646 | SplitItem.displayName = 'SplitItem';
|
21647 |
|
21648 | Promise.resolve().then(function () { return stack; });
|
21649 | var styles = {
|
21650 | "modifiers": {
|
21651 | "fill": "pf-m-fill",
|
21652 | "gutter": "pf-m-gutter"
|
21653 | },
|
21654 | "stack": "pf-l-stack",
|
21655 | "stackItem": "pf-l-stack__item"
|
21656 | };
|
21657 |
|
21658 | const Stack = (_a) => {
|
21659 | var { hasGutter = false, className = '', children = null, component = 'div' } = _a, props = __rest$1(_a, ["hasGutter", "className", "children", "component"]);
|
21660 | const Component = component;
|
21661 | return (React__namespace.createElement(Component, Object.assign({}, props, { className: css(styles.stack, hasGutter && styles.modifiers.gutter, className) }), children));
|
21662 | };
|
21663 | Stack.displayName = 'Stack';
|
21664 |
|
21665 | const StackItem = (_a) => {
|
21666 | var { isFilled = false, className = '', children = null } = _a, props = __rest$1(_a, ["isFilled", "className", "children"]);
|
21667 | return (React__namespace.createElement("div", Object.assign({}, props, { className: css(styles.stackItem, isFilled && styles.modifiers.fill, className) }), children));
|
21668 | };
|
21669 | StackItem.displayName = 'StackItem';
|
21670 |
|
21671 | var backdrop = Object.freeze({
|
21672 | __proto__: null
|
21673 | });
|
21674 |
|
21675 | var bullseye = Object.freeze({
|
21676 | __proto__: null
|
21677 | });
|
21678 |
|
21679 | var aboutModalBox = Object.freeze({
|
21680 | __proto__: null
|
21681 | });
|
21682 |
|
21683 | var content = Object.freeze({
|
21684 | __proto__: null
|
21685 | });
|
21686 |
|
21687 | var title = Object.freeze({
|
21688 | __proto__: null
|
21689 | });
|
21690 |
|
21691 | var button = Object.freeze({
|
21692 | __proto__: null
|
21693 | });
|
21694 |
|
21695 | var spinner = Object.freeze({
|
21696 | __proto__: null
|
21697 | });
|
21698 |
|
21699 | var accordion = Object.freeze({
|
21700 | __proto__: null
|
21701 | });
|
21702 |
|
21703 | var actionList = Object.freeze({
|
21704 | __proto__: null
|
21705 | });
|
21706 |
|
21707 | var alert = Object.freeze({
|
21708 | __proto__: null
|
21709 | });
|
21710 |
|
21711 | var accessibility = Object.freeze({
|
21712 | __proto__: null
|
21713 | });
|
21714 |
|
21715 | var tooltip = Object.freeze({
|
21716 | __proto__: null
|
21717 | });
|
21718 |
|
21719 | var alertGroup = Object.freeze({
|
21720 | __proto__: null
|
21721 | });
|
21722 |
|
21723 | var appLauncher = Object.freeze({
|
21724 | __proto__: null
|
21725 | });
|
21726 |
|
21727 | var formControl = Object.freeze({
|
21728 | __proto__: null
|
21729 | });
|
21730 |
|
21731 | var dropdown = Object.freeze({
|
21732 | __proto__: null
|
21733 | });
|
21734 |
|
21735 | var divider = Object.freeze({
|
21736 | __proto__: null
|
21737 | });
|
21738 |
|
21739 | var badge = Object.freeze({
|
21740 | __proto__: null
|
21741 | });
|
21742 |
|
21743 | var avatar = Object.freeze({
|
21744 | __proto__: null
|
21745 | });
|
21746 |
|
21747 | var backToTop = Object.freeze({
|
21748 | __proto__: null
|
21749 | });
|
21750 |
|
21751 | var backgroundImage = Object.freeze({
|
21752 | __proto__: null
|
21753 | });
|
21754 |
|
21755 | var banner = Object.freeze({
|
21756 | __proto__: null
|
21757 | });
|
21758 |
|
21759 | var brand = Object.freeze({
|
21760 | __proto__: null
|
21761 | });
|
21762 |
|
21763 | var breadcrumb = Object.freeze({
|
21764 | __proto__: null
|
21765 | });
|
21766 |
|
21767 | var select = Object.freeze({
|
21768 | __proto__: null
|
21769 | });
|
21770 |
|
21771 | var form = Object.freeze({
|
21772 | __proto__: null
|
21773 | });
|
21774 |
|
21775 | var check = Object.freeze({
|
21776 | __proto__: null
|
21777 | });
|
21778 |
|
21779 | var chipGroup = Object.freeze({
|
21780 | __proto__: null
|
21781 | });
|
21782 |
|
21783 | var chip = Object.freeze({
|
21784 | __proto__: null
|
21785 | });
|
21786 |
|
21787 | var calendarMonth = Object.freeze({
|
21788 | __proto__: null
|
21789 | });
|
21790 |
|
21791 | var card = Object.freeze({
|
21792 | __proto__: null
|
21793 | });
|
21794 |
|
21795 | var clipboardCopy = Object.freeze({
|
21796 | __proto__: null
|
21797 | });
|
21798 |
|
21799 | var popover = Object.freeze({
|
21800 | __proto__: null
|
21801 | });
|
21802 |
|
21803 | var codeBlock = Object.freeze({
|
21804 | __proto__: null
|
21805 | });
|
21806 |
|
21807 | var contextSelector = Object.freeze({
|
21808 | __proto__: null
|
21809 | });
|
21810 |
|
21811 | var inputGroup = Object.freeze({
|
21812 | __proto__: null
|
21813 | });
|
21814 |
|
21815 | var dataList = Object.freeze({
|
21816 | __proto__: null
|
21817 | });
|
21818 |
|
21819 | var dataListGrid = Object.freeze({
|
21820 | __proto__: null
|
21821 | });
|
21822 |
|
21823 | var datePicker = Object.freeze({
|
21824 | __proto__: null
|
21825 | });
|
21826 |
|
21827 | var descriptionList = Object.freeze({
|
21828 | __proto__: null
|
21829 | });
|
21830 |
|
21831 | var drawer = Object.freeze({
|
21832 | __proto__: null
|
21833 | });
|
21834 |
|
21835 | var dualListSelector = Object.freeze({
|
21836 | __proto__: null
|
21837 | });
|
21838 |
|
21839 | var emptyState = Object.freeze({
|
21840 | __proto__: null
|
21841 | });
|
21842 |
|
21843 | var expandableSection = Object.freeze({
|
21844 | __proto__: null
|
21845 | });
|
21846 |
|
21847 | var fileUpload = Object.freeze({
|
21848 | __proto__: null
|
21849 | });
|
21850 |
|
21851 | var helperText = Object.freeze({
|
21852 | __proto__: null
|
21853 | });
|
21854 |
|
21855 | var hint = Object.freeze({
|
21856 | __proto__: null
|
21857 | });
|
21858 |
|
21859 | var jumpLinks = Object.freeze({
|
21860 | __proto__: null
|
21861 | });
|
21862 |
|
21863 | var sidebar = Object.freeze({
|
21864 | __proto__: null
|
21865 | });
|
21866 |
|
21867 | var label = Object.freeze({
|
21868 | __proto__: null
|
21869 | });
|
21870 |
|
21871 | var labelGroup = Object.freeze({
|
21872 | __proto__: null
|
21873 | });
|
21874 |
|
21875 | var list = Object.freeze({
|
21876 | __proto__: null
|
21877 | });
|
21878 |
|
21879 | var login = Object.freeze({
|
21880 | __proto__: null
|
21881 | });
|
21882 |
|
21883 | var masthead = Object.freeze({
|
21884 | __proto__: null
|
21885 | });
|
21886 |
|
21887 | var page = Object.freeze({
|
21888 | __proto__: null
|
21889 | });
|
21890 |
|
21891 | var menu = Object.freeze({
|
21892 | __proto__: null
|
21893 | });
|
21894 |
|
21895 | var menuToggle = Object.freeze({
|
21896 | __proto__: null
|
21897 | });
|
21898 |
|
21899 | var modalBox = Object.freeze({
|
21900 | __proto__: null
|
21901 | });
|
21902 |
|
21903 | var multipleFileUpload = Object.freeze({
|
21904 | __proto__: null
|
21905 | });
|
21906 |
|
21907 | var progress = Object.freeze({
|
21908 | __proto__: null
|
21909 | });
|
21910 |
|
21911 | var nav = Object.freeze({
|
21912 | __proto__: null
|
21913 | });
|
21914 |
|
21915 | var notificationBadge = Object.freeze({
|
21916 | __proto__: null
|
21917 | });
|
21918 |
|
21919 | var notificationDrawer = Object.freeze({
|
21920 | __proto__: null
|
21921 | });
|
21922 |
|
21923 | var optionsMenu = Object.freeze({
|
21924 | __proto__: null
|
21925 | });
|
21926 |
|
21927 | var overflowMenu = Object.freeze({
|
21928 | __proto__: null
|
21929 | });
|
21930 |
|
21931 | var pagination = Object.freeze({
|
21932 | __proto__: null
|
21933 | });
|
21934 |
|
21935 | var progressStepper = Object.freeze({
|
21936 | __proto__: null
|
21937 | });
|
21938 |
|
21939 | var radio = Object.freeze({
|
21940 | __proto__: null
|
21941 | });
|
21942 |
|
21943 | var searchInput = Object.freeze({
|
21944 | __proto__: null
|
21945 | });
|
21946 |
|
21947 | var simpleList = Object.freeze({
|
21948 | __proto__: null
|
21949 | });
|
21950 |
|
21951 | var skeleton = Object.freeze({
|
21952 | __proto__: null
|
21953 | });
|
21954 |
|
21955 | var skipToContent = Object.freeze({
|
21956 | __proto__: null
|
21957 | });
|
21958 |
|
21959 | var slider = Object.freeze({
|
21960 | __proto__: null
|
21961 | });
|
21962 |
|
21963 | var _switch = Object.freeze({
|
21964 | __proto__: null
|
21965 | });
|
21966 |
|
21967 | var tabs = Object.freeze({
|
21968 | __proto__: null
|
21969 | });
|
21970 |
|
21971 | var tabContent = Object.freeze({
|
21972 | __proto__: null
|
21973 | });
|
21974 |
|
21975 | var tile = Object.freeze({
|
21976 | __proto__: null
|
21977 | });
|
21978 |
|
21979 | var toggleGroup = Object.freeze({
|
21980 | __proto__: null
|
21981 | });
|
21982 |
|
21983 | var toolbar = Object.freeze({
|
21984 | __proto__: null
|
21985 | });
|
21986 |
|
21987 | var numberInput = Object.freeze({
|
21988 | __proto__: null
|
21989 | });
|
21990 |
|
21991 | var treeView = Object.freeze({
|
21992 | __proto__: null
|
21993 | });
|
21994 |
|
21995 | var wizard = Object.freeze({
|
21996 | __proto__: null
|
21997 | });
|
21998 |
|
21999 | var dragDrop = Object.freeze({
|
22000 | __proto__: null
|
22001 | });
|
22002 |
|
22003 | var textInputGroup = Object.freeze({
|
22004 | __proto__: null
|
22005 | });
|
22006 |
|
22007 | var panel = Object.freeze({
|
22008 | __proto__: null
|
22009 | });
|
22010 |
|
22011 | var truncate = Object.freeze({
|
22012 | __proto__: null
|
22013 | });
|
22014 |
|
22015 | var flex = Object.freeze({
|
22016 | __proto__: null
|
22017 | });
|
22018 |
|
22019 | var gallery = Object.freeze({
|
22020 | __proto__: null
|
22021 | });
|
22022 |
|
22023 | var grid = Object.freeze({
|
22024 | __proto__: null
|
22025 | });
|
22026 |
|
22027 | var level = Object.freeze({
|
22028 | __proto__: null
|
22029 | });
|
22030 |
|
22031 | var split = Object.freeze({
|
22032 | __proto__: null
|
22033 | });
|
22034 |
|
22035 | var stack = Object.freeze({
|
22036 | __proto__: null
|
22037 | });
|
22038 |
|
22039 | exports.ASTERISK = ASTERISK;
|
22040 | exports.AboutModal = AboutModal;
|
22041 | exports.Accordion = Accordion;
|
22042 | exports.AccordionContent = AccordionContent;
|
22043 | exports.AccordionExpandedContentBody = AccordionExpandedContentBody;
|
22044 | exports.AccordionItem = AccordionItem;
|
22045 | exports.AccordionToggle = AccordionToggle;
|
22046 | exports.ActionGroup = ActionGroup;
|
22047 | exports.ActionList = ActionList;
|
22048 | exports.ActionListGroup = ActionListGroup;
|
22049 | exports.ActionListItem = ActionListItem;
|
22050 | exports.Alert = Alert;
|
22051 | exports.AlertActionCloseButton = AlertActionCloseButton;
|
22052 | exports.AlertActionLink = AlertActionLink;
|
22053 | exports.AlertContext = AlertContext;
|
22054 | exports.AlertGroup = AlertGroup;
|
22055 | exports.ApplicationLauncher = ApplicationLauncher;
|
22056 | exports.ApplicationLauncherContent = ApplicationLauncherContent;
|
22057 | exports.ApplicationLauncherContext = ApplicationLauncherContext;
|
22058 | exports.ApplicationLauncherGroup = ApplicationLauncherGroup;
|
22059 | exports.ApplicationLauncherIcon = ApplicationLauncherIcon;
|
22060 | exports.ApplicationLauncherItem = ApplicationLauncherItem;
|
22061 | exports.ApplicationLauncherItemContext = ApplicationLauncherItemContext;
|
22062 | exports.ApplicationLauncherSeparator = ApplicationLauncherSeparator;
|
22063 | exports.ApplicationLauncherText = ApplicationLauncherText;
|
22064 | exports.Avatar = Avatar;
|
22065 | exports.BackToTop = BackToTop;
|
22066 | exports.Backdrop = Backdrop;
|
22067 | exports.BackgroundImage = BackgroundImage;
|
22068 | exports.Badge = Badge;
|
22069 | exports.BadgeToggle = BadgeToggle;
|
22070 | exports.Banner = Banner;
|
22071 | exports.Brand = Brand;
|
22072 | exports.Breadcrumb = Breadcrumb;
|
22073 | exports.BreadcrumbHeading = BreadcrumbHeading;
|
22074 | exports.BreadcrumbItem = BreadcrumbItem;
|
22075 | exports.Bullseye = Bullseye;
|
22076 | exports.Button = Button;
|
22077 | exports.CalendarMonth = CalendarMonth;
|
22078 | exports.Card = Card;
|
22079 | exports.CardActions = CardActions;
|
22080 | exports.CardBody = CardBody;
|
22081 | exports.CardContext = CardContext;
|
22082 | exports.CardExpandableContent = CardExpandableContent;
|
22083 | exports.CardFooter = CardFooter;
|
22084 | exports.CardHeader = CardHeader;
|
22085 | exports.CardHeaderMain = CardHeaderMain;
|
22086 | exports.CardTitle = CardTitle;
|
22087 | exports.Checkbox = Checkbox;
|
22088 | exports.Chip = Chip;
|
22089 | exports.ChipGroup = ChipGroup;
|
22090 | exports.ClipboardCopy = ClipboardCopy;
|
22091 | exports.ClipboardCopyAction = ClipboardCopyAction;
|
22092 | exports.ClipboardCopyButton = ClipboardCopyButton;
|
22093 | exports.CodeBlock = CodeBlock;
|
22094 | exports.CodeBlockAction = CodeBlockAction;
|
22095 | exports.CodeBlockCode = CodeBlockCode;
|
22096 | exports.ContextSelector = ContextSelector;
|
22097 | exports.ContextSelectorFooter = ContextSelectorFooter;
|
22098 | exports.ContextSelectorItem = ContextSelectorItem;
|
22099 | exports.DataList = DataList;
|
22100 | exports.DataListAction = DataListAction;
|
22101 | exports.DataListCell = DataListCell;
|
22102 | exports.DataListCheck = DataListCheck;
|
22103 | exports.DataListContent = DataListContent;
|
22104 | exports.DataListContext = DataListContext;
|
22105 | exports.DataListControl = DataListControl;
|
22106 | exports.DataListDragButton = DataListDragButton;
|
22107 | exports.DataListItem = DataListItem;
|
22108 | exports.DataListItemCells = DataListItemCells;
|
22109 | exports.DataListItemRow = DataListItemRow;
|
22110 | exports.DataListText = DataListText;
|
22111 | exports.DataListToggle = DataListToggle;
|
22112 | exports.DatePicker = DatePicker;
|
22113 | exports.DescriptionList = DescriptionList;
|
22114 | exports.DescriptionListDescription = DescriptionListDescription;
|
22115 | exports.DescriptionListGroup = DescriptionListGroup;
|
22116 | exports.DescriptionListTerm = DescriptionListTerm;
|
22117 | exports.DescriptionListTermHelpText = DescriptionListTermHelpText;
|
22118 | exports.DescriptionListTermHelpTextButton = DescriptionListTermHelpTextButton;
|
22119 | exports.Divider = Divider;
|
22120 | exports.DragDrop = DragDrop;
|
22121 | exports.DragDropContext = DragDropContext;
|
22122 | exports.Draggable = Draggable;
|
22123 | exports.Drawer = Drawer;
|
22124 | exports.DrawerActions = DrawerActions;
|
22125 | exports.DrawerCloseButton = DrawerCloseButton;
|
22126 | exports.DrawerContent = DrawerContent;
|
22127 | exports.DrawerContentBody = DrawerContentBody;
|
22128 | exports.DrawerContext = DrawerContext;
|
22129 | exports.DrawerHead = DrawerHead;
|
22130 | exports.DrawerPanelBody = DrawerPanelBody;
|
22131 | exports.DrawerPanelContent = DrawerPanelContent;
|
22132 | exports.DrawerSection = DrawerSection;
|
22133 | exports.DrilldownMenu = DrilldownMenu;
|
22134 | exports.Dropdown = Dropdown;
|
22135 | exports.DropdownArrowContext = DropdownArrowContext;
|
22136 | exports.DropdownContext = DropdownContext;
|
22137 | exports.DropdownGroup = DropdownGroup;
|
22138 | exports.DropdownItem = DropdownItem;
|
22139 | exports.DropdownMenu = DropdownMenu;
|
22140 | exports.DropdownSeparator = DropdownSeparator;
|
22141 | exports.DropdownToggle = DropdownToggle;
|
22142 | exports.DropdownToggleAction = DropdownToggleAction;
|
22143 | exports.DropdownToggleCheckbox = DropdownToggleCheckbox;
|
22144 | exports.DropdownWithContext = DropdownWithContext;
|
22145 | exports.Droppable = Droppable;
|
22146 | exports.DualListSelector = DualListSelector;
|
22147 | exports.DualListSelectorControl = DualListSelectorControl;
|
22148 | exports.DualListSelectorControlBase = DualListSelectorControlBase;
|
22149 | exports.DualListSelectorControlsWrapper = DualListSelectorControlsWrapper;
|
22150 | exports.DualListSelectorControlsWrapperBase = DualListSelectorControlsWrapperBase;
|
22151 | exports.DualListSelectorList = DualListSelectorList;
|
22152 | exports.DualListSelectorListItem = DualListSelectorListItem;
|
22153 | exports.DualListSelectorListItemBase = DualListSelectorListItemBase;
|
22154 | exports.DualListSelectorPane = DualListSelectorPane;
|
22155 | exports.DualListSelectorTree = DualListSelectorTree;
|
22156 | exports.EmptyState = EmptyState;
|
22157 | exports.EmptyStateBody = EmptyStateBody;
|
22158 | exports.EmptyStateIcon = EmptyStateIcon;
|
22159 | exports.EmptyStatePrimary = EmptyStatePrimary;
|
22160 | exports.EmptyStateSecondaryActions = EmptyStateSecondaryActions;
|
22161 | exports.ExpandableSection = ExpandableSection;
|
22162 | exports.ExpandableSectionToggle = ExpandableSectionToggle;
|
22163 | exports.FileUpload = FileUpload;
|
22164 | exports.FileUploadField = FileUploadField;
|
22165 | exports.Flex = Flex;
|
22166 | exports.FlexItem = FlexItem;
|
22167 | exports.FocusTrap = FocusTrap;
|
22168 | exports.Form = Form;
|
22169 | exports.FormAlert = FormAlert;
|
22170 | exports.FormFieldGroup = FormFieldGroup;
|
22171 | exports.FormFieldGroupExpandable = FormFieldGroupExpandable;
|
22172 | exports.FormFieldGroupHeader = FormFieldGroupHeader;
|
22173 | exports.FormGroup = FormGroup;
|
22174 | exports.FormHelperText = FormHelperText;
|
22175 | exports.FormSection = FormSection;
|
22176 | exports.FormSelect = FormSelect;
|
22177 | exports.FormSelectOption = FormSelectOption;
|
22178 | exports.FormSelectOptionGroup = FormSelectOptionGroup;
|
22179 | exports.Gallery = Gallery;
|
22180 | exports.GalleryItem = GalleryItem;
|
22181 | exports.GenerateId = GenerateId;
|
22182 | exports.Grid = Grid;
|
22183 | exports.GridItem = GridItem;
|
22184 | exports.HelperText = HelperText;
|
22185 | exports.HelperTextItem = HelperTextItem;
|
22186 | exports.Hint = Hint;
|
22187 | exports.HintBody = HintBody;
|
22188 | exports.HintFooter = HintFooter;
|
22189 | exports.HintTitle = HintTitle;
|
22190 | exports.InputGroup = InputGroup;
|
22191 | exports.InputGroupText = InputGroupText;
|
22192 | exports.JumpLinks = JumpLinks;
|
22193 | exports.JumpLinksItem = JumpLinksItem;
|
22194 | exports.JumpLinksList = JumpLinksList;
|
22195 | exports.KEYHANDLER_DIRECTION = KEYHANDLER_DIRECTION;
|
22196 | exports.KEY_CODES = KEY_CODES;
|
22197 | exports.KebabToggle = KebabToggle;
|
22198 | exports.KeyTypes = KeyTypes;
|
22199 | exports.KeyboardHandler = KeyboardHandler;
|
22200 | exports.Label = Label;
|
22201 | exports.LabelGroup = LabelGroup;
|
22202 | exports.Level = Level;
|
22203 | exports.LevelItem = LevelItem;
|
22204 | exports.List = List;
|
22205 | exports.ListItem = ListItem;
|
22206 | exports.Login = Login;
|
22207 | exports.LoginFooter = LoginFooter;
|
22208 | exports.LoginFooterItem = LoginFooterItem;
|
22209 | exports.LoginForm = LoginForm;
|
22210 | exports.LoginHeader = LoginHeader;
|
22211 | exports.LoginMainBody = LoginMainBody;
|
22212 | exports.LoginMainFooter = LoginMainFooter;
|
22213 | exports.LoginMainFooterBandItem = LoginMainFooterBandItem;
|
22214 | exports.LoginMainFooterLinksItem = LoginMainFooterLinksItem;
|
22215 | exports.LoginMainHeader = LoginMainHeader;
|
22216 | exports.LoginPage = LoginPage;
|
22217 | exports.Masthead = Masthead;
|
22218 | exports.MastheadBrand = MastheadBrand;
|
22219 | exports.MastheadContent = MastheadContent;
|
22220 | exports.MastheadMain = MastheadMain;
|
22221 | exports.MastheadToggle = MastheadToggle;
|
22222 | exports.Menu = Menu;
|
22223 | exports.MenuBreadcrumb = MenuBreadcrumb;
|
22224 | exports.MenuContent = MenuContent;
|
22225 | exports.MenuFooter = MenuFooter;
|
22226 | exports.MenuGroup = MenuGroup;
|
22227 | exports.MenuInput = MenuInput;
|
22228 | exports.MenuItem = MenuItem;
|
22229 | exports.MenuItemAction = MenuItemAction;
|
22230 | exports.MenuList = MenuList;
|
22231 | exports.MenuToggle = MenuToggle;
|
22232 | exports.MenuToggleBase = MenuToggleBase;
|
22233 | exports.Modal = Modal;
|
22234 | exports.ModalBox = ModalBox;
|
22235 | exports.ModalBoxBody = ModalBoxBody;
|
22236 | exports.ModalBoxCloseButton = ModalBoxCloseButton;
|
22237 | exports.ModalBoxFooter = ModalBoxFooter;
|
22238 | exports.ModalBoxHeader = ModalBoxHeader;
|
22239 | exports.ModalContent = ModalContent;
|
22240 | exports.MultipleFileUpload = MultipleFileUpload;
|
22241 | exports.MultipleFileUploadContext = MultipleFileUploadContext;
|
22242 | exports.MultipleFileUploadMain = MultipleFileUploadMain;
|
22243 | exports.MultipleFileUploadStatus = MultipleFileUploadStatus;
|
22244 | exports.MultipleFileUploadStatusItem = MultipleFileUploadStatusItem;
|
22245 | exports.Nav = Nav;
|
22246 | exports.NavContext = NavContext;
|
22247 | exports.NavExpandable = NavExpandable;
|
22248 | exports.NavGroup = NavGroup;
|
22249 | exports.NavItem = NavItem;
|
22250 | exports.NavItemSeparator = NavItemSeparator;
|
22251 | exports.NavList = NavList;
|
22252 | exports.NotificationBadge = NotificationBadge;
|
22253 | exports.NotificationDrawer = NotificationDrawer;
|
22254 | exports.NotificationDrawerBody = NotificationDrawerBody;
|
22255 | exports.NotificationDrawerGroup = NotificationDrawerGroup;
|
22256 | exports.NotificationDrawerGroupList = NotificationDrawerGroupList;
|
22257 | exports.NotificationDrawerHeader = NotificationDrawerHeader;
|
22258 | exports.NotificationDrawerList = NotificationDrawerList;
|
22259 | exports.NotificationDrawerListItem = NotificationDrawerListItem;
|
22260 | exports.NotificationDrawerListItemBody = NotificationDrawerListItemBody;
|
22261 | exports.NotificationDrawerListItemHeader = NotificationDrawerListItemHeader;
|
22262 | exports.NumberInput = NumberInput;
|
22263 | exports.OptionsMenu = OptionsMenu;
|
22264 | exports.OptionsMenuItem = OptionsMenuItem;
|
22265 | exports.OptionsMenuItemGroup = OptionsMenuItemGroup;
|
22266 | exports.OptionsMenuSeparator = OptionsMenuSeparator;
|
22267 | exports.OptionsMenuToggle = OptionsMenuToggle;
|
22268 | exports.OptionsMenuToggleWithText = OptionsMenuToggleWithText;
|
22269 | exports.OverflowMenu = OverflowMenu;
|
22270 | exports.OverflowMenuContent = OverflowMenuContent;
|
22271 | exports.OverflowMenuControl = OverflowMenuControl;
|
22272 | exports.OverflowMenuDropdownItem = OverflowMenuDropdownItem;
|
22273 | exports.OverflowMenuGroup = OverflowMenuGroup;
|
22274 | exports.OverflowMenuItem = OverflowMenuItem;
|
22275 | exports.Page = Page;
|
22276 | exports.PageBreadcrumb = PageBreadcrumb;
|
22277 | exports.PageContext = PageContext;
|
22278 | exports.PageContextConsumer = PageContextConsumer;
|
22279 | exports.PageContextProvider = PageContextProvider;
|
22280 | exports.PageGroup = PageGroup;
|
22281 | exports.PageHeader = PageHeader;
|
22282 | exports.PageHeaderTools = PageHeaderTools;
|
22283 | exports.PageHeaderToolsGroup = PageHeaderToolsGroup;
|
22284 | exports.PageHeaderToolsItem = PageHeaderToolsItem;
|
22285 | exports.PageNavigation = PageNavigation;
|
22286 | exports.PageSection = PageSection;
|
22287 | exports.PageSidebar = PageSidebar;
|
22288 | exports.PageSidebarContext = PageSidebarContext;
|
22289 | exports.PageToggleButton = PageToggleButton;
|
22290 | exports.Pagination = Pagination;
|
22291 | exports.Panel = Panel;
|
22292 | exports.PanelFooter = PanelFooter;
|
22293 | exports.PanelHeader = PanelHeader;
|
22294 | exports.PanelMain = PanelMain;
|
22295 | exports.PanelMainBody = PanelMainBody;
|
22296 | exports.Popover = Popover;
|
22297 | exports.Popper = Popper;
|
22298 | exports.Progress = Progress;
|
22299 | exports.ProgressBar = ProgressBar;
|
22300 | exports.ProgressContainer = ProgressContainer;
|
22301 | exports.ProgressStep = ProgressStep;
|
22302 | exports.ProgressStepper = ProgressStepper;
|
22303 | exports.Radio = Radio;
|
22304 | exports.SIDE = SIDE;
|
22305 | exports.SearchInput = SearchInput;
|
22306 | exports.Select = Select;
|
22307 | exports.SelectConsumer = SelectConsumer;
|
22308 | exports.SelectContext = SelectContext;
|
22309 | exports.SelectFooterTabbableItems = SelectFooterTabbableItems;
|
22310 | exports.SelectGroup = SelectGroup;
|
22311 | exports.SelectOption = SelectOption;
|
22312 | exports.SelectProvider = SelectProvider;
|
22313 | exports.Sidebar = Sidebar;
|
22314 | exports.SidebarContent = SidebarContent;
|
22315 | exports.SidebarPanel = SidebarPanel;
|
22316 | exports.SimpleList = SimpleList;
|
22317 | exports.SimpleListContext = SimpleListContext;
|
22318 | exports.SimpleListGroup = SimpleListGroup;
|
22319 | exports.SimpleListItem = SimpleListItem;
|
22320 | exports.Skeleton = Skeleton;
|
22321 | exports.SkipToContent = SkipToContent;
|
22322 | exports.Slider = Slider;
|
22323 | exports.Spinner = Spinner;
|
22324 | exports.Split = Split;
|
22325 | exports.SplitItem = SplitItem;
|
22326 | exports.Stack = Stack;
|
22327 | exports.StackItem = StackItem;
|
22328 | exports.Switch = Switch;
|
22329 | exports.Tab = Tab;
|
22330 | exports.TabContent = TabContent;
|
22331 | exports.TabContentBody = TabContentBody;
|
22332 | exports.TabTitleIcon = TabTitleIcon;
|
22333 | exports.TabTitleText = TabTitleText;
|
22334 | exports.Tabs = Tabs;
|
22335 | exports.TabsContext = TabsContext;
|
22336 | exports.TabsContextConsumer = TabsContextConsumer;
|
22337 | exports.TabsContextProvider = TabsContextProvider;
|
22338 | exports.Text = Text;
|
22339 | exports.TextArea = TextArea;
|
22340 | exports.TextAreaBase = TextAreaBase;
|
22341 | exports.TextContent = TextContent;
|
22342 | exports.TextInput = TextInput;
|
22343 | exports.TextInputBase = TextInputBase;
|
22344 | exports.TextInputGroup = TextInputGroup;
|
22345 | exports.TextInputGroupContext = TextInputGroupContext;
|
22346 | exports.TextInputGroupMain = TextInputGroupMain;
|
22347 | exports.TextInputGroupUtilities = TextInputGroupUtilities;
|
22348 | exports.TextList = TextList;
|
22349 | exports.TextListItem = TextListItem;
|
22350 | exports.Tile = Tile;
|
22351 | exports.TimePicker = TimePicker;
|
22352 | exports.Title = Title;
|
22353 | exports.ToggleGroup = ToggleGroup;
|
22354 | exports.ToggleGroupItem = ToggleGroupItem;
|
22355 | exports.ToggleTemplate = ToggleTemplate;
|
22356 | exports.Toolbar = Toolbar;
|
22357 | exports.ToolbarContent = ToolbarContent;
|
22358 | exports.ToolbarContentContext = ToolbarContentContext;
|
22359 | exports.ToolbarContext = ToolbarContext;
|
22360 | exports.ToolbarExpandIconWrapper = ToolbarExpandIconWrapper;
|
22361 | exports.ToolbarFilter = ToolbarFilter;
|
22362 | exports.ToolbarGroup = ToolbarGroup;
|
22363 | exports.ToolbarItem = ToolbarItem;
|
22364 | exports.ToolbarToggleGroup = ToolbarToggleGroup;
|
22365 | exports.Tooltip = Tooltip;
|
22366 | exports.TreeView = TreeView;
|
22367 | exports.TreeViewSearch = TreeViewSearch;
|
22368 | exports.Truncate = Truncate;
|
22369 | exports.Wizard = Wizard;
|
22370 | exports.WizardBody = WizardBody;
|
22371 | exports.WizardContext = WizardContext;
|
22372 | exports.WizardContextConsumer = WizardContextConsumer;
|
22373 | exports.WizardContextProvider = WizardContextProvider;
|
22374 | exports.WizardFooter = WizardFooter;
|
22375 | exports.WizardHeader = WizardHeader;
|
22376 | exports.WizardNav = WizardNav;
|
22377 | exports.WizardNavItem = WizardNavItem;
|
22378 | exports.WizardToggle = WizardToggle;
|
22379 | exports.canUseDOM = canUseDOM;
|
22380 | exports.capitalize = capitalize;
|
22381 | exports.clipboardCopyFunc = clipboardCopyFunc;
|
22382 | exports.debounce = debounce$1;
|
22383 | exports.fillTemplate = fillTemplate;
|
22384 | exports.findTabbableElements = findTabbableElements;
|
22385 | exports.formatBreakpointMods = formatBreakpointMods;
|
22386 | exports.getBreakpoint = getBreakpoint;
|
22387 | exports.getDefaultOUIAId = getDefaultOUIAId;
|
22388 | exports.getNextIndex = getNextIndex;
|
22389 | exports.getOUIAProps = getOUIAProps;
|
22390 | exports.getOpacityTransition = getOpacityTransition;
|
22391 | exports.getResizeObserver = getResizeObserver;
|
22392 | exports.getTextWidth = getTextWidth;
|
22393 | exports.getUniqueId = getUniqueId;
|
22394 | exports.globalBreakpoints = globalBreakpoints;
|
22395 | exports.handleArrows = handleArrows;
|
22396 | exports.innerDimensions = innerDimensions;
|
22397 | exports.isElementInView = isElementInView;
|
22398 | exports.isValidDate = isValidDate;
|
22399 | exports.keyHandler = keyHandler;
|
22400 | exports.navContextDefaults = navContextDefaults;
|
22401 | exports.pageContextDefaults = pageContextDefaults;
|
22402 | exports.pageSidebarContextDefaults = pageSidebarContextDefaults;
|
22403 | exports.pluralize = pluralize;
|
22404 | exports.preventedEvents = preventedEvents;
|
22405 | exports.setBreakpointCssVars = setBreakpointCssVars;
|
22406 | exports.setTabIndex = setTabIndex;
|
22407 | exports.sideElementIsOutOfView = sideElementIsOutOfView;
|
22408 | exports.toCamel = toCamel;
|
22409 | exports.trimLeft = trimLeft;
|
22410 | exports.useInterval = useInterval;
|
22411 | exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect;
|
22412 | exports.useOUIAId = useOUIAId;
|
22413 | exports.useOUIAProps = useOUIAProps;
|
22414 | exports.variantIcons = variantIcons$1;
|
22415 | exports.yyyyMMddFormat = yyyyMMddFormat;
|
22416 |
|
22417 | Object.defineProperty(exports, '__esModule', { value: true });
|
22418 |
|
22419 | }));
|