pallote-react 0.14.6 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +2095 -363
- package/package.json +9 -9
package/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default, { useState, useEffect, useRef, createContext, useContext } from 'react';
|
|
2
3
|
import classnames from 'classnames';
|
|
3
4
|
import PropTypes from 'prop-types';
|
|
4
5
|
import { createPortal } from 'react-dom';
|
|
@@ -26,7 +27,7 @@ const Color = ({
|
|
|
26
27
|
[`fill-${fill}`]: fill,
|
|
27
28
|
[`stroke-${stroke}`]: stroke
|
|
28
29
|
});
|
|
29
|
-
return /*#__PURE__*/
|
|
30
|
+
return /*#__PURE__*/React__default.cloneElement(children, {
|
|
30
31
|
className: childClassName,
|
|
31
32
|
style: {
|
|
32
33
|
...children.props.style,
|
|
@@ -44,11 +45,6 @@ Color.propTypes = {
|
|
|
44
45
|
children: PropTypes.node
|
|
45
46
|
};
|
|
46
47
|
|
|
47
|
-
var Color$1 = /*#__PURE__*/Object.freeze({
|
|
48
|
-
__proto__: null,
|
|
49
|
-
Color: Color
|
|
50
|
-
});
|
|
51
|
-
|
|
52
48
|
const viewportSizes = {
|
|
53
49
|
'mobile-sm': 375,
|
|
54
50
|
'mobile': 576,
|
|
@@ -81,7 +77,7 @@ const Display = ({
|
|
|
81
77
|
window.addEventListener('resize', updateMedia);
|
|
82
78
|
return () => window.removeEventListener('resize', updateMedia);
|
|
83
79
|
}, [show, hide]);
|
|
84
|
-
return /*#__PURE__*/
|
|
80
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, isDisplayed ? children : null);
|
|
85
81
|
};
|
|
86
82
|
Display.propTypes = {
|
|
87
83
|
show: PropTypes.oneOf(['mobile-sm', 'mobile', 'tablet', 'laptop', 'desktop', 'touch']),
|
|
@@ -89,11 +85,6 @@ Display.propTypes = {
|
|
|
89
85
|
children: PropTypes.node
|
|
90
86
|
};
|
|
91
87
|
|
|
92
|
-
var Display$1 = /*#__PURE__*/Object.freeze({
|
|
93
|
-
__proto__: null,
|
|
94
|
-
Display: Display
|
|
95
|
-
});
|
|
96
|
-
|
|
97
88
|
function _extends() {
|
|
98
89
|
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
99
90
|
for (var e = 1; e < arguments.length; e++) {
|
|
@@ -122,7 +113,7 @@ const Grid = ({
|
|
|
122
113
|
children,
|
|
123
114
|
...props
|
|
124
115
|
}) => {
|
|
125
|
-
return /*#__PURE__*/
|
|
116
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
126
117
|
className: classnames('flex', {
|
|
127
118
|
'flex-wrap': wrap,
|
|
128
119
|
[`direction-${direction}`]: direction,
|
|
@@ -157,11 +148,6 @@ Grid.propTypes = {
|
|
|
157
148
|
children: PropTypes.node
|
|
158
149
|
};
|
|
159
150
|
|
|
160
|
-
var Grid$1 = /*#__PURE__*/Object.freeze({
|
|
161
|
-
__proto__: null,
|
|
162
|
-
Grid: Grid
|
|
163
|
-
});
|
|
164
|
-
|
|
165
151
|
const Text = ({
|
|
166
152
|
variant,
|
|
167
153
|
align,
|
|
@@ -178,7 +164,7 @@ const Text = ({
|
|
|
178
164
|
...props
|
|
179
165
|
}) => {
|
|
180
166
|
const Component = component || 'p';
|
|
181
|
-
return /*#__PURE__*/
|
|
167
|
+
return /*#__PURE__*/React__default.createElement(Component, _extends({
|
|
182
168
|
className: classnames([{
|
|
183
169
|
[`${variant}`]: variant,
|
|
184
170
|
[`text-${align}`]: align,
|
|
@@ -207,11 +193,6 @@ Text.propTypes = {
|
|
|
207
193
|
children: PropTypes.node
|
|
208
194
|
};
|
|
209
195
|
|
|
210
|
-
var Text$1 = /*#__PURE__*/Object.freeze({
|
|
211
|
-
__proto__: null,
|
|
212
|
-
Text: Text
|
|
213
|
-
});
|
|
214
|
-
|
|
215
196
|
const Alert = ({
|
|
216
197
|
color = 'success',
|
|
217
198
|
variant = 'toast',
|
|
@@ -240,7 +221,7 @@ const Alert = ({
|
|
|
240
221
|
const onAnimationEnd = () => {
|
|
241
222
|
if (!show) setRender(false);
|
|
242
223
|
};
|
|
243
|
-
let alert = /*#__PURE__*/
|
|
224
|
+
let alert = /*#__PURE__*/React__default.createElement("div", _extends({
|
|
244
225
|
className: classnames(['alert', {
|
|
245
226
|
[`alert-${color}`]: color,
|
|
246
227
|
[`alert-${variant}`]: variant,
|
|
@@ -250,22 +231,22 @@ const Alert = ({
|
|
|
250
231
|
'alert-noIcon': noIcon
|
|
251
232
|
}, className]),
|
|
252
233
|
onAnimationEnd: onAnimationEnd
|
|
253
|
-
}, props), /*#__PURE__*/
|
|
234
|
+
}, props), /*#__PURE__*/React__default.createElement("div", {
|
|
254
235
|
className: classnames('alert_content')
|
|
255
|
-
}, title ? /*#__PURE__*/
|
|
236
|
+
}, title ? /*#__PURE__*/React__default.createElement(Text, {
|
|
256
237
|
className: classnames('alert_title'),
|
|
257
238
|
variant: dense ? 'caption' : 'body',
|
|
258
239
|
weight: "bold"
|
|
259
|
-
}, title) : null, subtitle ? /*#__PURE__*/
|
|
240
|
+
}, title) : null, subtitle ? /*#__PURE__*/React__default.createElement(Text, {
|
|
260
241
|
variant: dense ? 'overline' : 'caption',
|
|
261
242
|
className: classnames('alert_subtitle')
|
|
262
|
-
}, subtitle) : null), onClose ? /*#__PURE__*/
|
|
243
|
+
}, subtitle) : null), onClose ? /*#__PURE__*/React__default.createElement(X, {
|
|
263
244
|
className: classnames('alert_close'),
|
|
264
245
|
onClick: onClose,
|
|
265
246
|
size: dense ? 14 : 16
|
|
266
247
|
}) : null);
|
|
267
248
|
if (variant === 'notice') {
|
|
268
|
-
return /*#__PURE__*/
|
|
249
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, alert);
|
|
269
250
|
} else {
|
|
270
251
|
return /*#__PURE__*/createPortal(shouldRender && alert, container);
|
|
271
252
|
}
|
|
@@ -282,26 +263,21 @@ Alert.propTypes = {
|
|
|
282
263
|
className: PropTypes.node
|
|
283
264
|
};
|
|
284
265
|
|
|
285
|
-
var Alert$1 = /*#__PURE__*/Object.freeze({
|
|
286
|
-
__proto__: null,
|
|
287
|
-
Alert: Alert
|
|
288
|
-
});
|
|
289
|
-
|
|
290
266
|
const Breadcrumbs = ({
|
|
291
267
|
items,
|
|
292
268
|
separator = "slash",
|
|
293
269
|
className
|
|
294
|
-
}) => /*#__PURE__*/
|
|
270
|
+
}) => /*#__PURE__*/React__default.createElement("nav", {
|
|
295
271
|
"aria-label": "breadcrumbs",
|
|
296
272
|
className: classnames(['breadcrumbs', {
|
|
297
273
|
[`breadcrumbs-${separator}`]: separator
|
|
298
274
|
}, className])
|
|
299
|
-
}, /*#__PURE__*/
|
|
275
|
+
}, /*#__PURE__*/React__default.createElement("ol", null, items.map((item, index) => /*#__PURE__*/React__default.createElement("li", {
|
|
300
276
|
key: index,
|
|
301
277
|
className: "breadcrumbs_item"
|
|
302
|
-
}, index === items.length - 1 ? /*#__PURE__*/
|
|
278
|
+
}, index === items.length - 1 ? /*#__PURE__*/React__default.createElement("p", {
|
|
303
279
|
"aria-current": "page"
|
|
304
|
-
}, item.label) : /*#__PURE__*/
|
|
280
|
+
}, item.label) : /*#__PURE__*/React__default.createElement("a", {
|
|
305
281
|
href: item.href
|
|
306
282
|
}, item.label)))));
|
|
307
283
|
Breadcrumbs.propTypes = {
|
|
@@ -310,12 +286,7 @@ Breadcrumbs.propTypes = {
|
|
|
310
286
|
className: PropTypes.node
|
|
311
287
|
};
|
|
312
288
|
|
|
313
|
-
|
|
314
|
-
__proto__: null,
|
|
315
|
-
Breadcrumbs: Breadcrumbs
|
|
316
|
-
});
|
|
317
|
-
|
|
318
|
-
const Button = /*#__PURE__*/React.forwardRef(({
|
|
289
|
+
const Button = /*#__PURE__*/React__default.forwardRef(({
|
|
319
290
|
component = 'button',
|
|
320
291
|
kind,
|
|
321
292
|
variant = 'fill',
|
|
@@ -334,9 +305,9 @@ const Button = /*#__PURE__*/React.forwardRef(({
|
|
|
334
305
|
if (kind === 'icon') {
|
|
335
306
|
content = children;
|
|
336
307
|
} else {
|
|
337
|
-
content = /*#__PURE__*/
|
|
308
|
+
content = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, iconLeft && iconLeft, children, iconRight && iconRight);
|
|
338
309
|
}
|
|
339
|
-
return /*#__PURE__*/
|
|
310
|
+
return /*#__PURE__*/React__default.createElement(Component, _extends({
|
|
340
311
|
className: classnames(['button', {
|
|
341
312
|
[`button-${size}`]: size,
|
|
342
313
|
[`button-${color}`]: color,
|
|
@@ -364,11 +335,6 @@ Button.propTypes = {
|
|
|
364
335
|
children: PropTypes.node.isRequired
|
|
365
336
|
};
|
|
366
337
|
|
|
367
|
-
var Button$1 = /*#__PURE__*/Object.freeze({
|
|
368
|
-
__proto__: null,
|
|
369
|
-
Button: Button
|
|
370
|
-
});
|
|
371
|
-
|
|
372
338
|
const Buttons = ({
|
|
373
339
|
direction = 'landscape',
|
|
374
340
|
fullWidth,
|
|
@@ -377,7 +343,7 @@ const Buttons = ({
|
|
|
377
343
|
children,
|
|
378
344
|
...props
|
|
379
345
|
}) => {
|
|
380
|
-
return /*#__PURE__*/
|
|
346
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
381
347
|
className: classnames(['buttons', {
|
|
382
348
|
[`buttons-${direction}`]: direction,
|
|
383
349
|
'buttons-fullWidth': fullWidth,
|
|
@@ -393,11 +359,6 @@ Buttons.propTypes = {
|
|
|
393
359
|
children: PropTypes.node.isRequired
|
|
394
360
|
};
|
|
395
361
|
|
|
396
|
-
var Buttons$1 = /*#__PURE__*/Object.freeze({
|
|
397
|
-
__proto__: null,
|
|
398
|
-
Buttons: Buttons
|
|
399
|
-
});
|
|
400
|
-
|
|
401
362
|
const Card = ({
|
|
402
363
|
size = 'md',
|
|
403
364
|
fill = 'paper',
|
|
@@ -409,9 +370,9 @@ const Card = ({
|
|
|
409
370
|
children,
|
|
410
371
|
...props
|
|
411
372
|
}) => {
|
|
412
|
-
return /*#__PURE__*/
|
|
373
|
+
return /*#__PURE__*/React__default.createElement(Color, {
|
|
413
374
|
fill: transparent ? null : fill
|
|
414
|
-
}, /*#__PURE__*/
|
|
375
|
+
}, /*#__PURE__*/React__default.createElement("div", _extends({
|
|
415
376
|
className: classnames(['card', {
|
|
416
377
|
[`card-${size}`]: size,
|
|
417
378
|
[`card-${direction}`]: direction,
|
|
@@ -432,18 +393,13 @@ Card.propTypes = {
|
|
|
432
393
|
children: PropTypes.node.isRequired
|
|
433
394
|
};
|
|
434
395
|
|
|
435
|
-
var Card$1 = /*#__PURE__*/Object.freeze({
|
|
436
|
-
__proto__: null,
|
|
437
|
-
Card: Card
|
|
438
|
-
});
|
|
439
|
-
|
|
440
396
|
const CardActions = ({
|
|
441
397
|
direction,
|
|
442
398
|
className,
|
|
443
399
|
children,
|
|
444
400
|
...props
|
|
445
401
|
}) => {
|
|
446
|
-
return /*#__PURE__*/
|
|
402
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
447
403
|
className: classnames(['card_actions', {
|
|
448
404
|
[`card_actions-${direction}`]: direction
|
|
449
405
|
}, className])
|
|
@@ -455,18 +411,13 @@ CardActions.propTypes = {
|
|
|
455
411
|
children: PropTypes.node.isRequired
|
|
456
412
|
};
|
|
457
413
|
|
|
458
|
-
var CardActions$1 = /*#__PURE__*/Object.freeze({
|
|
459
|
-
__proto__: null,
|
|
460
|
-
CardActions: CardActions
|
|
461
|
-
});
|
|
462
|
-
|
|
463
414
|
const CardContent = ({
|
|
464
415
|
fullWidth,
|
|
465
416
|
className,
|
|
466
417
|
children,
|
|
467
418
|
...props
|
|
468
419
|
}) => {
|
|
469
|
-
return /*#__PURE__*/
|
|
420
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
470
421
|
className: classnames(['card_content', {
|
|
471
422
|
'card_content-fullWidth': fullWidth
|
|
472
423
|
}, className])
|
|
@@ -478,11 +429,6 @@ CardContent.propTypes = {
|
|
|
478
429
|
children: PropTypes.node.isRequired
|
|
479
430
|
};
|
|
480
431
|
|
|
481
|
-
var CardContent$1 = /*#__PURE__*/Object.freeze({
|
|
482
|
-
__proto__: null,
|
|
483
|
-
CardContent: CardContent
|
|
484
|
-
});
|
|
485
|
-
|
|
486
432
|
const CardHeader = ({
|
|
487
433
|
label,
|
|
488
434
|
title,
|
|
@@ -491,15 +437,15 @@ const CardHeader = ({
|
|
|
491
437
|
className,
|
|
492
438
|
...props
|
|
493
439
|
}) => {
|
|
494
|
-
return /*#__PURE__*/
|
|
440
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
495
441
|
className: classnames(['card_header', className])
|
|
496
|
-
}, props), actions && /*#__PURE__*/
|
|
442
|
+
}, props), actions && /*#__PURE__*/React__default.createElement("div", {
|
|
497
443
|
className: "card_headerActions"
|
|
498
|
-
}, actions), label ? /*#__PURE__*/
|
|
444
|
+
}, actions), label ? /*#__PURE__*/React__default.createElement(Text, {
|
|
499
445
|
className: classnames('card_label')
|
|
500
|
-
}, label) : null, /*#__PURE__*/
|
|
446
|
+
}, label) : null, /*#__PURE__*/React__default.createElement(Text, {
|
|
501
447
|
className: classnames('card_title')
|
|
502
|
-
}, title), subtitle ? /*#__PURE__*/
|
|
448
|
+
}, title), subtitle ? /*#__PURE__*/React__default.createElement(Text, {
|
|
503
449
|
className: classnames('card_subtitle')
|
|
504
450
|
}, subtitle) : null);
|
|
505
451
|
};
|
|
@@ -512,11 +458,6 @@ CardHeader.propTypes = {
|
|
|
512
458
|
children: PropTypes.node
|
|
513
459
|
};
|
|
514
460
|
|
|
515
|
-
var CardHeader$1 = /*#__PURE__*/Object.freeze({
|
|
516
|
-
__proto__: null,
|
|
517
|
-
CardHeader: CardHeader
|
|
518
|
-
});
|
|
519
|
-
|
|
520
461
|
const CardMedia = ({
|
|
521
462
|
width,
|
|
522
463
|
height,
|
|
@@ -525,11 +466,11 @@ const CardMedia = ({
|
|
|
525
466
|
className,
|
|
526
467
|
...props
|
|
527
468
|
}) => {
|
|
528
|
-
return /*#__PURE__*/
|
|
469
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
529
470
|
className: classnames(['card_media', {
|
|
530
471
|
'card_media-fullWidth': fullWidth
|
|
531
472
|
}, className])
|
|
532
|
-
}, props), /*#__PURE__*/
|
|
473
|
+
}, props), /*#__PURE__*/React__default.createElement("div", {
|
|
533
474
|
className: 'card_mediaInner',
|
|
534
475
|
style: {
|
|
535
476
|
width: width + 'px',
|
|
@@ -546,11 +487,6 @@ CardMedia.propTypes = {
|
|
|
546
487
|
className: PropTypes.node
|
|
547
488
|
};
|
|
548
489
|
|
|
549
|
-
var CardMedia$1 = /*#__PURE__*/Object.freeze({
|
|
550
|
-
__proto__: null,
|
|
551
|
-
CardMedia: CardMedia
|
|
552
|
-
});
|
|
553
|
-
|
|
554
490
|
const Checkbox = ({
|
|
555
491
|
id,
|
|
556
492
|
value,
|
|
@@ -561,11 +497,11 @@ const Checkbox = ({
|
|
|
561
497
|
className,
|
|
562
498
|
...props
|
|
563
499
|
}) => {
|
|
564
|
-
return /*#__PURE__*/
|
|
500
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
565
501
|
className: classnames(['checkbox', {
|
|
566
502
|
'checkbox-disabled': disabled
|
|
567
503
|
}, className])
|
|
568
|
-
}, /*#__PURE__*/
|
|
504
|
+
}, /*#__PURE__*/React__default.createElement("input", _extends({
|
|
569
505
|
className: classnames('checkbox_control'),
|
|
570
506
|
type: "checkbox",
|
|
571
507
|
name: id,
|
|
@@ -575,7 +511,7 @@ const Checkbox = ({
|
|
|
575
511
|
"aria-checked": checked,
|
|
576
512
|
disabled: disabled,
|
|
577
513
|
required: !(disabled || optional)
|
|
578
|
-
}, props)), /*#__PURE__*/
|
|
514
|
+
}, props)), /*#__PURE__*/React__default.createElement("label", {
|
|
579
515
|
className: classnames('checkbox_label'),
|
|
580
516
|
htmlFor: id
|
|
581
517
|
}, label));
|
|
@@ -590,11 +526,6 @@ Checkbox.propTypes = {
|
|
|
590
526
|
className: PropTypes.node
|
|
591
527
|
};
|
|
592
528
|
|
|
593
|
-
var Checkbox$1 = /*#__PURE__*/Object.freeze({
|
|
594
|
-
__proto__: null,
|
|
595
|
-
Checkbox: Checkbox
|
|
596
|
-
});
|
|
597
|
-
|
|
598
529
|
const InputLabel = ({
|
|
599
530
|
isLegend = false,
|
|
600
531
|
htmlFor,
|
|
@@ -603,14 +534,14 @@ const InputLabel = ({
|
|
|
603
534
|
error
|
|
604
535
|
}) => {
|
|
605
536
|
const LabelTag = isLegend ? 'legend' : 'label';
|
|
606
|
-
return /*#__PURE__*/
|
|
537
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, label && /*#__PURE__*/React__default.createElement(LabelTag, _extends({
|
|
607
538
|
className: 'input_label'
|
|
608
539
|
}, !isLegend && {
|
|
609
540
|
htmlFor
|
|
610
|
-
}), label), hint && /*#__PURE__*/
|
|
541
|
+
}), label), hint && /*#__PURE__*/React__default.createElement("p", {
|
|
611
542
|
id: htmlFor + '-hint',
|
|
612
543
|
className: 'input_hint'
|
|
613
|
-
}, hint), error && /*#__PURE__*/
|
|
544
|
+
}, hint), error && /*#__PURE__*/React__default.createElement("p", {
|
|
614
545
|
id: htmlFor + '-error',
|
|
615
546
|
className: 'input_error'
|
|
616
547
|
}, error));
|
|
@@ -627,11 +558,6 @@ InputLabel.propTypes = {
|
|
|
627
558
|
error: PropTypes.string
|
|
628
559
|
};
|
|
629
560
|
|
|
630
|
-
var InputLabel$1 = /*#__PURE__*/Object.freeze({
|
|
631
|
-
__proto__: null,
|
|
632
|
-
InputLabel: InputLabel
|
|
633
|
-
});
|
|
634
|
-
|
|
635
561
|
const Checkboxes = ({
|
|
636
562
|
onChange,
|
|
637
563
|
id,
|
|
@@ -644,7 +570,7 @@ const Checkboxes = ({
|
|
|
644
570
|
children,
|
|
645
571
|
className
|
|
646
572
|
}) => {
|
|
647
|
-
return /*#__PURE__*/
|
|
573
|
+
return /*#__PURE__*/React__default.createElement("fieldset", _extends({
|
|
648
574
|
className: classnames(['input', {
|
|
649
575
|
'js-error': error,
|
|
650
576
|
'input-disabled': disabled,
|
|
@@ -653,16 +579,16 @@ const Checkboxes = ({
|
|
|
653
579
|
onChange: onChange
|
|
654
580
|
}, hint || error ? {
|
|
655
581
|
'aria-describedby': [hint ? `${id}-hint` : null, error ? `${id}-error` : null].filter(Boolean).join(' ')
|
|
656
|
-
} : null), /*#__PURE__*/
|
|
582
|
+
} : null), /*#__PURE__*/React__default.createElement(InputLabel, {
|
|
657
583
|
isLegend: true,
|
|
658
584
|
label: label,
|
|
659
585
|
hint: hint,
|
|
660
586
|
error: error
|
|
661
|
-
}), /*#__PURE__*/
|
|
587
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
662
588
|
className: classnames(['input_control', 'radios', {
|
|
663
589
|
[`radios-${direction}`]: direction
|
|
664
590
|
}])
|
|
665
|
-
},
|
|
591
|
+
}, React__default.Children.map(children, child => /*#__PURE__*/React__default.isValidElement(child) ? /*#__PURE__*/React__default.cloneElement(child, {
|
|
666
592
|
optional,
|
|
667
593
|
disabled
|
|
668
594
|
}) : child)));
|
|
@@ -680,18 +606,13 @@ Checkboxes.propTypes = {
|
|
|
680
606
|
className: PropTypes.node
|
|
681
607
|
};
|
|
682
608
|
|
|
683
|
-
var Checkboxes$1 = /*#__PURE__*/Object.freeze({
|
|
684
|
-
__proto__: null,
|
|
685
|
-
Checkboxes: Checkboxes
|
|
686
|
-
});
|
|
687
|
-
|
|
688
609
|
const Divider = ({
|
|
689
610
|
direction = 'landscape',
|
|
690
611
|
padding = 'md',
|
|
691
612
|
className,
|
|
692
613
|
...props
|
|
693
614
|
}) => {
|
|
694
|
-
return /*#__PURE__*/
|
|
615
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
695
616
|
className: classnames(['divider', {
|
|
696
617
|
[`divider-${direction}`]: direction,
|
|
697
618
|
[`divider-${padding}`]: padding
|
|
@@ -704,11 +625,6 @@ Divider.propTypes = {
|
|
|
704
625
|
className: PropTypes.node
|
|
705
626
|
};
|
|
706
627
|
|
|
707
|
-
var Divider$1 = /*#__PURE__*/Object.freeze({
|
|
708
|
-
__proto__: null,
|
|
709
|
-
Divider: Divider
|
|
710
|
-
});
|
|
711
|
-
|
|
712
628
|
const Input = ({
|
|
713
629
|
onChange,
|
|
714
630
|
type = 'text',
|
|
@@ -730,8 +646,8 @@ const Input = ({
|
|
|
730
646
|
inputRef.current.focus();
|
|
731
647
|
}
|
|
732
648
|
}, [isFocused]);
|
|
733
|
-
const customIcon = icon || type === 'date' && /*#__PURE__*/
|
|
734
|
-
return /*#__PURE__*/
|
|
649
|
+
const customIcon = icon || type === 'date' && /*#__PURE__*/React__default.createElement(CalendarBlank, null) || type === 'time' && /*#__PURE__*/React__default.createElement(Clock, null) || type === 'number' && /*#__PURE__*/React__default.createElement(CaretUpDown, null);
|
|
650
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
735
651
|
className: classnames(['input', {
|
|
736
652
|
'js-error': error,
|
|
737
653
|
'input-disabled': disabled,
|
|
@@ -739,14 +655,14 @@ const Input = ({
|
|
|
739
655
|
'input-withIcon': icon
|
|
740
656
|
}, className]),
|
|
741
657
|
onChange: onChange
|
|
742
|
-
}, /*#__PURE__*/
|
|
658
|
+
}, /*#__PURE__*/React__default.createElement(InputLabel, {
|
|
743
659
|
htmlFor: id,
|
|
744
660
|
label: label,
|
|
745
661
|
hint: hint,
|
|
746
662
|
error: error
|
|
747
|
-
}), customIcon && /*#__PURE__*/
|
|
663
|
+
}), customIcon && /*#__PURE__*/React__default.createElement("div", {
|
|
748
664
|
className: 'input_icon'
|
|
749
|
-
}, customIcon), /*#__PURE__*/
|
|
665
|
+
}, customIcon), /*#__PURE__*/React__default.createElement("input", _extends({
|
|
750
666
|
ref: inputRef,
|
|
751
667
|
type: type,
|
|
752
668
|
className: 'input_control',
|
|
@@ -774,12 +690,7 @@ Input.propTypes = {
|
|
|
774
690
|
className: PropTypes.node
|
|
775
691
|
};
|
|
776
692
|
|
|
777
|
-
|
|
778
|
-
__proto__: null,
|
|
779
|
-
Input: Input
|
|
780
|
-
});
|
|
781
|
-
|
|
782
|
-
const Link = ({
|
|
693
|
+
const Link$1 = ({
|
|
783
694
|
component = 'a',
|
|
784
695
|
icon,
|
|
785
696
|
color,
|
|
@@ -790,20 +701,20 @@ const Link = ({
|
|
|
790
701
|
...props
|
|
791
702
|
}) => {
|
|
792
703
|
const Component = component || 'a';
|
|
793
|
-
return /*#__PURE__*/
|
|
704
|
+
return /*#__PURE__*/React__default.createElement(Component, _extends({
|
|
794
705
|
className: classnames(['link', {
|
|
795
706
|
[`text-${color}`]: color
|
|
796
707
|
}, className]),
|
|
797
708
|
href: isExternal ? href : undefined,
|
|
798
709
|
target: isExternal ? '_blank' : undefined,
|
|
799
710
|
rel: isExternal ? 'noopener noreferrer' : undefined
|
|
800
|
-
}, props), children, icon && !isExternal && /*#__PURE__*/
|
|
711
|
+
}, props), children, icon && !isExternal && /*#__PURE__*/React__default.createElement("span", {
|
|
801
712
|
className: 'link_icon'
|
|
802
|
-
}, icon), isExternal && /*#__PURE__*/
|
|
713
|
+
}, icon), isExternal && /*#__PURE__*/React__default.createElement("span", {
|
|
803
714
|
className: 'link_icon'
|
|
804
|
-
}, /*#__PURE__*/
|
|
715
|
+
}, /*#__PURE__*/React__default.createElement(ArrowSquareOut, null)));
|
|
805
716
|
};
|
|
806
|
-
Link.propTypes = {
|
|
717
|
+
Link$1.propTypes = {
|
|
807
718
|
component: PropTypes.oneOfType(['a', PropTypes.elementType]),
|
|
808
719
|
icon: PropTypes.node,
|
|
809
720
|
color: PropTypes.oneOf(['default', 'alt', 'disabled', 'contrast', 'contrastAlt', 'contrastDisabled', 'primary', 'secondary', 'inherit']),
|
|
@@ -812,18 +723,13 @@ Link.propTypes = {
|
|
|
812
723
|
children: PropTypes.node.isRequired
|
|
813
724
|
};
|
|
814
725
|
|
|
815
|
-
var Link$1 = /*#__PURE__*/Object.freeze({
|
|
816
|
-
__proto__: null,
|
|
817
|
-
Link: Link
|
|
818
|
-
});
|
|
819
|
-
|
|
820
726
|
const List = ({
|
|
821
727
|
dense,
|
|
822
728
|
className,
|
|
823
729
|
children,
|
|
824
730
|
...props
|
|
825
731
|
}) => {
|
|
826
|
-
return /*#__PURE__*/
|
|
732
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
827
733
|
className: classnames(['list', {
|
|
828
734
|
'list-dense': dense
|
|
829
735
|
}, className])
|
|
@@ -835,11 +741,6 @@ List.propTypes = {
|
|
|
835
741
|
children: PropTypes.node.isRequired
|
|
836
742
|
};
|
|
837
743
|
|
|
838
|
-
var List$1 = /*#__PURE__*/Object.freeze({
|
|
839
|
-
__proto__: null,
|
|
840
|
-
List: List
|
|
841
|
-
});
|
|
842
|
-
|
|
843
744
|
const ListItem = ({
|
|
844
745
|
icon,
|
|
845
746
|
bold,
|
|
@@ -847,11 +748,11 @@ const ListItem = ({
|
|
|
847
748
|
children = 'List item',
|
|
848
749
|
...props
|
|
849
750
|
}) => {
|
|
850
|
-
return /*#__PURE__*/
|
|
751
|
+
return /*#__PURE__*/React__default.createElement(Text, _extends({
|
|
851
752
|
className: classnames(['list_item', {
|
|
852
753
|
'list_item-bold': bold
|
|
853
754
|
}, className])
|
|
854
|
-
}, props), icon ? /*#__PURE__*/
|
|
755
|
+
}, props), icon ? /*#__PURE__*/React__default.cloneElement(icon, {
|
|
855
756
|
className: `${icon.props.className ?? ''} list_itemIcon`
|
|
856
757
|
}) : null, children);
|
|
857
758
|
};
|
|
@@ -862,11 +763,6 @@ ListItem.propTypes = {
|
|
|
862
763
|
children: PropTypes.node.isRequired
|
|
863
764
|
};
|
|
864
765
|
|
|
865
|
-
var ListItem$1 = /*#__PURE__*/Object.freeze({
|
|
866
|
-
__proto__: null,
|
|
867
|
-
ListItem: ListItem
|
|
868
|
-
});
|
|
869
|
-
|
|
870
766
|
const Nav = ({
|
|
871
767
|
direction,
|
|
872
768
|
dense,
|
|
@@ -874,12 +770,12 @@ const Nav = ({
|
|
|
874
770
|
children,
|
|
875
771
|
...props
|
|
876
772
|
}) => {
|
|
877
|
-
return /*#__PURE__*/
|
|
773
|
+
return /*#__PURE__*/React__default.createElement("nav", _extends({
|
|
878
774
|
className: classnames(['nav', {
|
|
879
775
|
[`nav-${direction}`]: direction,
|
|
880
776
|
'nav-dense': dense
|
|
881
777
|
}, className])
|
|
882
|
-
}, props), /*#__PURE__*/
|
|
778
|
+
}, props), /*#__PURE__*/React__default.createElement("div", {
|
|
883
779
|
className: "nav_container"
|
|
884
780
|
}, children));
|
|
885
781
|
};
|
|
@@ -890,10 +786,1959 @@ Nav.propTypes = {
|
|
|
890
786
|
children: PropTypes.node.isRequired
|
|
891
787
|
};
|
|
892
788
|
|
|
893
|
-
var
|
|
894
|
-
|
|
895
|
-
|
|
789
|
+
var dist = {};
|
|
790
|
+
|
|
791
|
+
var hasRequiredDist;
|
|
792
|
+
function requireDist() {
|
|
793
|
+
if (hasRequiredDist) return dist;
|
|
794
|
+
hasRequiredDist = 1;
|
|
795
|
+
Object.defineProperty(dist, "__esModule", {
|
|
796
|
+
value: true
|
|
797
|
+
});
|
|
798
|
+
dist.parse = parse;
|
|
799
|
+
dist.serialize = serialize;
|
|
800
|
+
/**
|
|
801
|
+
* RegExp to match cookie-name in RFC 6265 sec 4.1.1
|
|
802
|
+
* This refers out to the obsoleted definition of token in RFC 2616 sec 2.2
|
|
803
|
+
* which has been replaced by the token definition in RFC 7230 appendix B.
|
|
804
|
+
*
|
|
805
|
+
* cookie-name = token
|
|
806
|
+
* token = 1*tchar
|
|
807
|
+
* tchar = "!" / "#" / "$" / "%" / "&" / "'" /
|
|
808
|
+
* "*" / "+" / "-" / "." / "^" / "_" /
|
|
809
|
+
* "`" / "|" / "~" / DIGIT / ALPHA
|
|
810
|
+
*
|
|
811
|
+
* Note: Allowing more characters - https://github.com/jshttp/cookie/issues/191
|
|
812
|
+
* Allow same range as cookie value, except `=`, which delimits end of name.
|
|
813
|
+
*/
|
|
814
|
+
const cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
|
|
815
|
+
/**
|
|
816
|
+
* RegExp to match cookie-value in RFC 6265 sec 4.1.1
|
|
817
|
+
*
|
|
818
|
+
* cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
|
|
819
|
+
* cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
|
|
820
|
+
* ; US-ASCII characters excluding CTLs,
|
|
821
|
+
* ; whitespace DQUOTE, comma, semicolon,
|
|
822
|
+
* ; and backslash
|
|
823
|
+
*
|
|
824
|
+
* Allowing more characters: https://github.com/jshttp/cookie/issues/191
|
|
825
|
+
* Comma, backslash, and DQUOTE are not part of the parsing algorithm.
|
|
826
|
+
*/
|
|
827
|
+
const cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
|
|
828
|
+
/**
|
|
829
|
+
* RegExp to match domain-value in RFC 6265 sec 4.1.1
|
|
830
|
+
*
|
|
831
|
+
* domain-value = <subdomain>
|
|
832
|
+
* ; defined in [RFC1034], Section 3.5, as
|
|
833
|
+
* ; enhanced by [RFC1123], Section 2.1
|
|
834
|
+
* <subdomain> = <label> | <subdomain> "." <label>
|
|
835
|
+
* <label> = <let-dig> [ [ <ldh-str> ] <let-dig> ]
|
|
836
|
+
* Labels must be 63 characters or less.
|
|
837
|
+
* 'let-dig' not 'letter' in the first char, per RFC1123
|
|
838
|
+
* <ldh-str> = <let-dig-hyp> | <let-dig-hyp> <ldh-str>
|
|
839
|
+
* <let-dig-hyp> = <let-dig> | "-"
|
|
840
|
+
* <let-dig> = <letter> | <digit>
|
|
841
|
+
* <letter> = any one of the 52 alphabetic characters A through Z in
|
|
842
|
+
* upper case and a through z in lower case
|
|
843
|
+
* <digit> = any one of the ten digits 0 through 9
|
|
844
|
+
*
|
|
845
|
+
* Keep support for leading dot: https://github.com/jshttp/cookie/issues/173
|
|
846
|
+
*
|
|
847
|
+
* > (Note that a leading %x2E ("."), if present, is ignored even though that
|
|
848
|
+
* character is not permitted, but a trailing %x2E ("."), if present, will
|
|
849
|
+
* cause the user agent to ignore the attribute.)
|
|
850
|
+
*/
|
|
851
|
+
const domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
|
|
852
|
+
/**
|
|
853
|
+
* RegExp to match path-value in RFC 6265 sec 4.1.1
|
|
854
|
+
*
|
|
855
|
+
* path-value = <any CHAR except CTLs or ";">
|
|
856
|
+
* CHAR = %x01-7F
|
|
857
|
+
* ; defined in RFC 5234 appendix B.1
|
|
858
|
+
*/
|
|
859
|
+
const pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
|
|
860
|
+
const __toString = Object.prototype.toString;
|
|
861
|
+
const NullObject = /* @__PURE__ */(() => {
|
|
862
|
+
const C = function () {};
|
|
863
|
+
C.prototype = Object.create(null);
|
|
864
|
+
return C;
|
|
865
|
+
})();
|
|
866
|
+
/**
|
|
867
|
+
* Parse a cookie header.
|
|
868
|
+
*
|
|
869
|
+
* Parse the given cookie header string into an object
|
|
870
|
+
* The object has the various cookies as keys(names) => values
|
|
871
|
+
*/
|
|
872
|
+
function parse(str, options) {
|
|
873
|
+
const obj = new NullObject();
|
|
874
|
+
const len = str.length;
|
|
875
|
+
// RFC 6265 sec 4.1.1, RFC 2616 2.2 defines a cookie name consists of one char minimum, plus '='.
|
|
876
|
+
if (len < 2) return obj;
|
|
877
|
+
const dec = options?.decode || decode;
|
|
878
|
+
let index = 0;
|
|
879
|
+
do {
|
|
880
|
+
const eqIdx = str.indexOf("=", index);
|
|
881
|
+
if (eqIdx === -1) break; // No more cookie pairs.
|
|
882
|
+
const colonIdx = str.indexOf(";", index);
|
|
883
|
+
const endIdx = colonIdx === -1 ? len : colonIdx;
|
|
884
|
+
if (eqIdx > endIdx) {
|
|
885
|
+
// backtrack on prior semicolon
|
|
886
|
+
index = str.lastIndexOf(";", eqIdx - 1) + 1;
|
|
887
|
+
continue;
|
|
888
|
+
}
|
|
889
|
+
const keyStartIdx = startIndex(str, index, eqIdx);
|
|
890
|
+
const keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
|
|
891
|
+
const key = str.slice(keyStartIdx, keyEndIdx);
|
|
892
|
+
// only assign once
|
|
893
|
+
if (obj[key] === undefined) {
|
|
894
|
+
let valStartIdx = startIndex(str, eqIdx + 1, endIdx);
|
|
895
|
+
let valEndIdx = endIndex(str, endIdx, valStartIdx);
|
|
896
|
+
const value = dec(str.slice(valStartIdx, valEndIdx));
|
|
897
|
+
obj[key] = value;
|
|
898
|
+
}
|
|
899
|
+
index = endIdx + 1;
|
|
900
|
+
} while (index < len);
|
|
901
|
+
return obj;
|
|
902
|
+
}
|
|
903
|
+
function startIndex(str, index, max) {
|
|
904
|
+
do {
|
|
905
|
+
const code = str.charCodeAt(index);
|
|
906
|
+
if (code !== 0x20 /* */ && code !== 0x09 /* \t */) return index;
|
|
907
|
+
} while (++index < max);
|
|
908
|
+
return max;
|
|
909
|
+
}
|
|
910
|
+
function endIndex(str, index, min) {
|
|
911
|
+
while (index > min) {
|
|
912
|
+
const code = str.charCodeAt(--index);
|
|
913
|
+
if (code !== 0x20 /* */ && code !== 0x09 /* \t */) return index + 1;
|
|
914
|
+
}
|
|
915
|
+
return min;
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* Serialize data into a cookie header.
|
|
919
|
+
*
|
|
920
|
+
* Serialize a name value pair into a cookie string suitable for
|
|
921
|
+
* http headers. An optional options object specifies cookie parameters.
|
|
922
|
+
*
|
|
923
|
+
* serialize('foo', 'bar', { httpOnly: true })
|
|
924
|
+
* => "foo=bar; httpOnly"
|
|
925
|
+
*/
|
|
926
|
+
function serialize(name, val, options) {
|
|
927
|
+
const enc = options?.encode || encodeURIComponent;
|
|
928
|
+
if (!cookieNameRegExp.test(name)) {
|
|
929
|
+
throw new TypeError(`argument name is invalid: ${name}`);
|
|
930
|
+
}
|
|
931
|
+
const value = enc(val);
|
|
932
|
+
if (!cookieValueRegExp.test(value)) {
|
|
933
|
+
throw new TypeError(`argument val is invalid: ${val}`);
|
|
934
|
+
}
|
|
935
|
+
let str = name + "=" + value;
|
|
936
|
+
if (!options) return str;
|
|
937
|
+
if (options.maxAge !== undefined) {
|
|
938
|
+
if (!Number.isInteger(options.maxAge)) {
|
|
939
|
+
throw new TypeError(`option maxAge is invalid: ${options.maxAge}`);
|
|
940
|
+
}
|
|
941
|
+
str += "; Max-Age=" + options.maxAge;
|
|
942
|
+
}
|
|
943
|
+
if (options.domain) {
|
|
944
|
+
if (!domainValueRegExp.test(options.domain)) {
|
|
945
|
+
throw new TypeError(`option domain is invalid: ${options.domain}`);
|
|
946
|
+
}
|
|
947
|
+
str += "; Domain=" + options.domain;
|
|
948
|
+
}
|
|
949
|
+
if (options.path) {
|
|
950
|
+
if (!pathValueRegExp.test(options.path)) {
|
|
951
|
+
throw new TypeError(`option path is invalid: ${options.path}`);
|
|
952
|
+
}
|
|
953
|
+
str += "; Path=" + options.path;
|
|
954
|
+
}
|
|
955
|
+
if (options.expires) {
|
|
956
|
+
if (!isDate(options.expires) || !Number.isFinite(options.expires.valueOf())) {
|
|
957
|
+
throw new TypeError(`option expires is invalid: ${options.expires}`);
|
|
958
|
+
}
|
|
959
|
+
str += "; Expires=" + options.expires.toUTCString();
|
|
960
|
+
}
|
|
961
|
+
if (options.httpOnly) {
|
|
962
|
+
str += "; HttpOnly";
|
|
963
|
+
}
|
|
964
|
+
if (options.secure) {
|
|
965
|
+
str += "; Secure";
|
|
966
|
+
}
|
|
967
|
+
if (options.partitioned) {
|
|
968
|
+
str += "; Partitioned";
|
|
969
|
+
}
|
|
970
|
+
if (options.priority) {
|
|
971
|
+
const priority = typeof options.priority === "string" ? options.priority.toLowerCase() : undefined;
|
|
972
|
+
switch (priority) {
|
|
973
|
+
case "low":
|
|
974
|
+
str += "; Priority=Low";
|
|
975
|
+
break;
|
|
976
|
+
case "medium":
|
|
977
|
+
str += "; Priority=Medium";
|
|
978
|
+
break;
|
|
979
|
+
case "high":
|
|
980
|
+
str += "; Priority=High";
|
|
981
|
+
break;
|
|
982
|
+
default:
|
|
983
|
+
throw new TypeError(`option priority is invalid: ${options.priority}`);
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
if (options.sameSite) {
|
|
987
|
+
const sameSite = typeof options.sameSite === "string" ? options.sameSite.toLowerCase() : options.sameSite;
|
|
988
|
+
switch (sameSite) {
|
|
989
|
+
case true:
|
|
990
|
+
case "strict":
|
|
991
|
+
str += "; SameSite=Strict";
|
|
992
|
+
break;
|
|
993
|
+
case "lax":
|
|
994
|
+
str += "; SameSite=Lax";
|
|
995
|
+
break;
|
|
996
|
+
case "none":
|
|
997
|
+
str += "; SameSite=None";
|
|
998
|
+
break;
|
|
999
|
+
default:
|
|
1000
|
+
throw new TypeError(`option sameSite is invalid: ${options.sameSite}`);
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
return str;
|
|
1004
|
+
}
|
|
1005
|
+
/**
|
|
1006
|
+
* URL-decode string value. Optimized to skip native call when no %.
|
|
1007
|
+
*/
|
|
1008
|
+
function decode(str) {
|
|
1009
|
+
if (str.indexOf("%") === -1) return str;
|
|
1010
|
+
try {
|
|
1011
|
+
return decodeURIComponent(str);
|
|
1012
|
+
} catch (e) {
|
|
1013
|
+
return str;
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
/**
|
|
1017
|
+
* Determine if value is a Date.
|
|
1018
|
+
*/
|
|
1019
|
+
function isDate(val) {
|
|
1020
|
+
return __toString.call(val) === "[object Date]";
|
|
1021
|
+
}
|
|
1022
|
+
return dist;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
requireDist();
|
|
1026
|
+
|
|
1027
|
+
/**
|
|
1028
|
+
* react-router v7.3.0
|
|
1029
|
+
*
|
|
1030
|
+
* Copyright (c) Remix Software Inc.
|
|
1031
|
+
*
|
|
1032
|
+
* This source code is licensed under the MIT license found in the
|
|
1033
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
1034
|
+
*
|
|
1035
|
+
* @license MIT
|
|
1036
|
+
*/
|
|
1037
|
+
function invariant(value, message) {
|
|
1038
|
+
if (value === false || value === null || typeof value === "undefined") {
|
|
1039
|
+
throw new Error(message);
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
function warning(cond, message) {
|
|
1043
|
+
if (!cond) {
|
|
1044
|
+
if (typeof console !== "undefined") console.warn(message);
|
|
1045
|
+
try {
|
|
1046
|
+
throw new Error(message);
|
|
1047
|
+
} catch (e) {
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
function createPath({
|
|
1052
|
+
pathname = "/",
|
|
1053
|
+
search = "",
|
|
1054
|
+
hash = ""
|
|
1055
|
+
}) {
|
|
1056
|
+
if (search && search !== "?")
|
|
1057
|
+
pathname += search.charAt(0) === "?" ? search : "?" + search;
|
|
1058
|
+
if (hash && hash !== "#")
|
|
1059
|
+
pathname += hash.charAt(0) === "#" ? hash : "#" + hash;
|
|
1060
|
+
return pathname;
|
|
1061
|
+
}
|
|
1062
|
+
function parsePath(path) {
|
|
1063
|
+
let parsedPath = {};
|
|
1064
|
+
if (path) {
|
|
1065
|
+
let hashIndex = path.indexOf("#");
|
|
1066
|
+
if (hashIndex >= 0) {
|
|
1067
|
+
parsedPath.hash = path.substring(hashIndex);
|
|
1068
|
+
path = path.substring(0, hashIndex);
|
|
1069
|
+
}
|
|
1070
|
+
let searchIndex = path.indexOf("?");
|
|
1071
|
+
if (searchIndex >= 0) {
|
|
1072
|
+
parsedPath.search = path.substring(searchIndex);
|
|
1073
|
+
path = path.substring(0, searchIndex);
|
|
1074
|
+
}
|
|
1075
|
+
if (path) {
|
|
1076
|
+
parsedPath.pathname = path;
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
return parsedPath;
|
|
1080
|
+
}
|
|
1081
|
+
function matchRoutes(routes, locationArg, basename = "/") {
|
|
1082
|
+
return matchRoutesImpl(routes, locationArg, basename, false);
|
|
1083
|
+
}
|
|
1084
|
+
function matchRoutesImpl(routes, locationArg, basename, allowPartial) {
|
|
1085
|
+
let location = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
|
|
1086
|
+
let pathname = stripBasename(location.pathname || "/", basename);
|
|
1087
|
+
if (pathname == null) {
|
|
1088
|
+
return null;
|
|
1089
|
+
}
|
|
1090
|
+
let branches = flattenRoutes(routes);
|
|
1091
|
+
rankRouteBranches(branches);
|
|
1092
|
+
let matches = null;
|
|
1093
|
+
for (let i = 0; matches == null && i < branches.length; ++i) {
|
|
1094
|
+
let decoded = decodePath(pathname);
|
|
1095
|
+
matches = matchRouteBranch(
|
|
1096
|
+
branches[i],
|
|
1097
|
+
decoded,
|
|
1098
|
+
allowPartial
|
|
1099
|
+
);
|
|
1100
|
+
}
|
|
1101
|
+
return matches;
|
|
1102
|
+
}
|
|
1103
|
+
function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "") {
|
|
1104
|
+
let flattenRoute = (route, index, relativePath) => {
|
|
1105
|
+
let meta = {
|
|
1106
|
+
relativePath: relativePath === void 0 ? route.path || "" : relativePath,
|
|
1107
|
+
caseSensitive: route.caseSensitive === true,
|
|
1108
|
+
childrenIndex: index,
|
|
1109
|
+
route
|
|
1110
|
+
};
|
|
1111
|
+
if (meta.relativePath.startsWith("/")) {
|
|
1112
|
+
invariant(
|
|
1113
|
+
meta.relativePath.startsWith(parentPath),
|
|
1114
|
+
`Absolute route path "${meta.relativePath}" nested under path "${parentPath}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`
|
|
1115
|
+
);
|
|
1116
|
+
meta.relativePath = meta.relativePath.slice(parentPath.length);
|
|
1117
|
+
}
|
|
1118
|
+
let path = joinPaths([parentPath, meta.relativePath]);
|
|
1119
|
+
let routesMeta = parentsMeta.concat(meta);
|
|
1120
|
+
if (route.children && route.children.length > 0) {
|
|
1121
|
+
invariant(
|
|
1122
|
+
// Our types know better, but runtime JS may not!
|
|
1123
|
+
// @ts-expect-error
|
|
1124
|
+
route.index !== true,
|
|
1125
|
+
`Index routes must not have child routes. Please remove all child routes from route path "${path}".`
|
|
1126
|
+
);
|
|
1127
|
+
flattenRoutes(route.children, branches, routesMeta, path);
|
|
1128
|
+
}
|
|
1129
|
+
if (route.path == null && !route.index) {
|
|
1130
|
+
return;
|
|
1131
|
+
}
|
|
1132
|
+
branches.push({
|
|
1133
|
+
path,
|
|
1134
|
+
score: computeScore(path, route.index),
|
|
1135
|
+
routesMeta
|
|
1136
|
+
});
|
|
1137
|
+
};
|
|
1138
|
+
routes.forEach((route, index) => {
|
|
1139
|
+
if (route.path === "" || !route.path?.includes("?")) {
|
|
1140
|
+
flattenRoute(route, index);
|
|
1141
|
+
} else {
|
|
1142
|
+
for (let exploded of explodeOptionalSegments(route.path)) {
|
|
1143
|
+
flattenRoute(route, index, exploded);
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
});
|
|
1147
|
+
return branches;
|
|
1148
|
+
}
|
|
1149
|
+
function explodeOptionalSegments(path) {
|
|
1150
|
+
let segments = path.split("/");
|
|
1151
|
+
if (segments.length === 0) return [];
|
|
1152
|
+
let [first, ...rest] = segments;
|
|
1153
|
+
let isOptional = first.endsWith("?");
|
|
1154
|
+
let required = first.replace(/\?$/, "");
|
|
1155
|
+
if (rest.length === 0) {
|
|
1156
|
+
return isOptional ? [required, ""] : [required];
|
|
1157
|
+
}
|
|
1158
|
+
let restExploded = explodeOptionalSegments(rest.join("/"));
|
|
1159
|
+
let result = [];
|
|
1160
|
+
result.push(
|
|
1161
|
+
...restExploded.map(
|
|
1162
|
+
(subpath) => subpath === "" ? required : [required, subpath].join("/")
|
|
1163
|
+
)
|
|
1164
|
+
);
|
|
1165
|
+
if (isOptional) {
|
|
1166
|
+
result.push(...restExploded);
|
|
1167
|
+
}
|
|
1168
|
+
return result.map(
|
|
1169
|
+
(exploded) => path.startsWith("/") && exploded === "" ? "/" : exploded
|
|
1170
|
+
);
|
|
1171
|
+
}
|
|
1172
|
+
function rankRouteBranches(branches) {
|
|
1173
|
+
branches.sort(
|
|
1174
|
+
(a, b) => a.score !== b.score ? b.score - a.score : compareIndexes(
|
|
1175
|
+
a.routesMeta.map((meta) => meta.childrenIndex),
|
|
1176
|
+
b.routesMeta.map((meta) => meta.childrenIndex)
|
|
1177
|
+
)
|
|
1178
|
+
);
|
|
1179
|
+
}
|
|
1180
|
+
var paramRe = /^:[\w-]+$/;
|
|
1181
|
+
var dynamicSegmentValue = 3;
|
|
1182
|
+
var indexRouteValue = 2;
|
|
1183
|
+
var emptySegmentValue = 1;
|
|
1184
|
+
var staticSegmentValue = 10;
|
|
1185
|
+
var splatPenalty = -2;
|
|
1186
|
+
var isSplat = (s) => s === "*";
|
|
1187
|
+
function computeScore(path, index) {
|
|
1188
|
+
let segments = path.split("/");
|
|
1189
|
+
let initialScore = segments.length;
|
|
1190
|
+
if (segments.some(isSplat)) {
|
|
1191
|
+
initialScore += splatPenalty;
|
|
1192
|
+
}
|
|
1193
|
+
if (index) {
|
|
1194
|
+
initialScore += indexRouteValue;
|
|
1195
|
+
}
|
|
1196
|
+
return segments.filter((s) => !isSplat(s)).reduce(
|
|
1197
|
+
(score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === "" ? emptySegmentValue : staticSegmentValue),
|
|
1198
|
+
initialScore
|
|
1199
|
+
);
|
|
1200
|
+
}
|
|
1201
|
+
function compareIndexes(a, b) {
|
|
1202
|
+
let siblings = a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]);
|
|
1203
|
+
return siblings ? (
|
|
1204
|
+
// If two routes are siblings, we should try to match the earlier sibling
|
|
1205
|
+
// first. This allows people to have fine-grained control over the matching
|
|
1206
|
+
// behavior by simply putting routes with identical paths in the order they
|
|
1207
|
+
// want them tried.
|
|
1208
|
+
a[a.length - 1] - b[b.length - 1]
|
|
1209
|
+
) : (
|
|
1210
|
+
// Otherwise, it doesn't really make sense to rank non-siblings by index,
|
|
1211
|
+
// so they sort equally.
|
|
1212
|
+
0
|
|
1213
|
+
);
|
|
1214
|
+
}
|
|
1215
|
+
function matchRouteBranch(branch, pathname, allowPartial = false) {
|
|
1216
|
+
let { routesMeta } = branch;
|
|
1217
|
+
let matchedParams = {};
|
|
1218
|
+
let matchedPathname = "/";
|
|
1219
|
+
let matches = [];
|
|
1220
|
+
for (let i = 0; i < routesMeta.length; ++i) {
|
|
1221
|
+
let meta = routesMeta[i];
|
|
1222
|
+
let end = i === routesMeta.length - 1;
|
|
1223
|
+
let remainingPathname = matchedPathname === "/" ? pathname : pathname.slice(matchedPathname.length) || "/";
|
|
1224
|
+
let match = matchPath(
|
|
1225
|
+
{ path: meta.relativePath, caseSensitive: meta.caseSensitive, end },
|
|
1226
|
+
remainingPathname
|
|
1227
|
+
);
|
|
1228
|
+
let route = meta.route;
|
|
1229
|
+
if (!match && end && allowPartial && !routesMeta[routesMeta.length - 1].route.index) {
|
|
1230
|
+
match = matchPath(
|
|
1231
|
+
{
|
|
1232
|
+
path: meta.relativePath,
|
|
1233
|
+
caseSensitive: meta.caseSensitive,
|
|
1234
|
+
end: false
|
|
1235
|
+
},
|
|
1236
|
+
remainingPathname
|
|
1237
|
+
);
|
|
1238
|
+
}
|
|
1239
|
+
if (!match) {
|
|
1240
|
+
return null;
|
|
1241
|
+
}
|
|
1242
|
+
Object.assign(matchedParams, match.params);
|
|
1243
|
+
matches.push({
|
|
1244
|
+
// TODO: Can this as be avoided?
|
|
1245
|
+
params: matchedParams,
|
|
1246
|
+
pathname: joinPaths([matchedPathname, match.pathname]),
|
|
1247
|
+
pathnameBase: normalizePathname(
|
|
1248
|
+
joinPaths([matchedPathname, match.pathnameBase])
|
|
1249
|
+
),
|
|
1250
|
+
route
|
|
1251
|
+
});
|
|
1252
|
+
if (match.pathnameBase !== "/") {
|
|
1253
|
+
matchedPathname = joinPaths([matchedPathname, match.pathnameBase]);
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
return matches;
|
|
1257
|
+
}
|
|
1258
|
+
function matchPath(pattern, pathname) {
|
|
1259
|
+
if (typeof pattern === "string") {
|
|
1260
|
+
pattern = { path: pattern, caseSensitive: false, end: true };
|
|
1261
|
+
}
|
|
1262
|
+
let [matcher, compiledParams] = compilePath(
|
|
1263
|
+
pattern.path,
|
|
1264
|
+
pattern.caseSensitive,
|
|
1265
|
+
pattern.end
|
|
1266
|
+
);
|
|
1267
|
+
let match = pathname.match(matcher);
|
|
1268
|
+
if (!match) return null;
|
|
1269
|
+
let matchedPathname = match[0];
|
|
1270
|
+
let pathnameBase = matchedPathname.replace(/(.)\/+$/, "$1");
|
|
1271
|
+
let captureGroups = match.slice(1);
|
|
1272
|
+
let params = compiledParams.reduce(
|
|
1273
|
+
(memo2, { paramName, isOptional }, index) => {
|
|
1274
|
+
if (paramName === "*") {
|
|
1275
|
+
let splatValue = captureGroups[index] || "";
|
|
1276
|
+
pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\/+$/, "$1");
|
|
1277
|
+
}
|
|
1278
|
+
const value = captureGroups[index];
|
|
1279
|
+
if (isOptional && !value) {
|
|
1280
|
+
memo2[paramName] = void 0;
|
|
1281
|
+
} else {
|
|
1282
|
+
memo2[paramName] = (value || "").replace(/%2F/g, "/");
|
|
1283
|
+
}
|
|
1284
|
+
return memo2;
|
|
1285
|
+
},
|
|
1286
|
+
{}
|
|
1287
|
+
);
|
|
1288
|
+
return {
|
|
1289
|
+
params,
|
|
1290
|
+
pathname: matchedPathname,
|
|
1291
|
+
pathnameBase,
|
|
1292
|
+
pattern
|
|
1293
|
+
};
|
|
1294
|
+
}
|
|
1295
|
+
function compilePath(path, caseSensitive = false, end = true) {
|
|
1296
|
+
warning(
|
|
1297
|
+
path === "*" || !path.endsWith("*") || path.endsWith("/*"),
|
|
1298
|
+
`Route path "${path}" will be treated as if it were "${path.replace(/\*$/, "/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${path.replace(/\*$/, "/*")}".`
|
|
1299
|
+
);
|
|
1300
|
+
let params = [];
|
|
1301
|
+
let regexpSource = "^" + path.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(
|
|
1302
|
+
/\/:([\w-]+)(\?)?/g,
|
|
1303
|
+
(_, paramName, isOptional) => {
|
|
1304
|
+
params.push({ paramName, isOptional: isOptional != null });
|
|
1305
|
+
return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)";
|
|
1306
|
+
}
|
|
1307
|
+
);
|
|
1308
|
+
if (path.endsWith("*")) {
|
|
1309
|
+
params.push({ paramName: "*" });
|
|
1310
|
+
regexpSource += path === "*" || path === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$";
|
|
1311
|
+
} else if (end) {
|
|
1312
|
+
regexpSource += "\\/*$";
|
|
1313
|
+
} else if (path !== "" && path !== "/") {
|
|
1314
|
+
regexpSource += "(?:(?=\\/|$))";
|
|
1315
|
+
} else ;
|
|
1316
|
+
let matcher = new RegExp(regexpSource, caseSensitive ? void 0 : "i");
|
|
1317
|
+
return [matcher, params];
|
|
1318
|
+
}
|
|
1319
|
+
function decodePath(value) {
|
|
1320
|
+
try {
|
|
1321
|
+
return value.split("/").map((v) => decodeURIComponent(v).replace(/\//g, "%2F")).join("/");
|
|
1322
|
+
} catch (error) {
|
|
1323
|
+
warning(
|
|
1324
|
+
false,
|
|
1325
|
+
`The URL path "${value}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${error}).`
|
|
1326
|
+
);
|
|
1327
|
+
return value;
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
function stripBasename(pathname, basename) {
|
|
1331
|
+
if (basename === "/") return pathname;
|
|
1332
|
+
if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {
|
|
1333
|
+
return null;
|
|
1334
|
+
}
|
|
1335
|
+
let startIndex = basename.endsWith("/") ? basename.length - 1 : basename.length;
|
|
1336
|
+
let nextChar = pathname.charAt(startIndex);
|
|
1337
|
+
if (nextChar && nextChar !== "/") {
|
|
1338
|
+
return null;
|
|
1339
|
+
}
|
|
1340
|
+
return pathname.slice(startIndex) || "/";
|
|
1341
|
+
}
|
|
1342
|
+
function resolvePath(to, fromPathname = "/") {
|
|
1343
|
+
let {
|
|
1344
|
+
pathname: toPathname,
|
|
1345
|
+
search = "",
|
|
1346
|
+
hash = ""
|
|
1347
|
+
} = typeof to === "string" ? parsePath(to) : to;
|
|
1348
|
+
let pathname = toPathname ? toPathname.startsWith("/") ? toPathname : resolvePathname(toPathname, fromPathname) : fromPathname;
|
|
1349
|
+
return {
|
|
1350
|
+
pathname,
|
|
1351
|
+
search: normalizeSearch(search),
|
|
1352
|
+
hash: normalizeHash(hash)
|
|
1353
|
+
};
|
|
1354
|
+
}
|
|
1355
|
+
function resolvePathname(relativePath, fromPathname) {
|
|
1356
|
+
let segments = fromPathname.replace(/\/+$/, "").split("/");
|
|
1357
|
+
let relativeSegments = relativePath.split("/");
|
|
1358
|
+
relativeSegments.forEach((segment) => {
|
|
1359
|
+
if (segment === "..") {
|
|
1360
|
+
if (segments.length > 1) segments.pop();
|
|
1361
|
+
} else if (segment !== ".") {
|
|
1362
|
+
segments.push(segment);
|
|
1363
|
+
}
|
|
1364
|
+
});
|
|
1365
|
+
return segments.length > 1 ? segments.join("/") : "/";
|
|
1366
|
+
}
|
|
1367
|
+
function getInvalidPathError(char, field, dest, path) {
|
|
1368
|
+
return `Cannot include a '${char}' character in a manually specified \`to.${field}\` field [${JSON.stringify(
|
|
1369
|
+
path
|
|
1370
|
+
)}]. Please separate it out to the \`to.${dest}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`;
|
|
1371
|
+
}
|
|
1372
|
+
function getPathContributingMatches(matches) {
|
|
1373
|
+
return matches.filter(
|
|
1374
|
+
(match, index) => index === 0 || match.route.path && match.route.path.length > 0
|
|
1375
|
+
);
|
|
1376
|
+
}
|
|
1377
|
+
function getResolveToMatches(matches) {
|
|
1378
|
+
let pathMatches = getPathContributingMatches(matches);
|
|
1379
|
+
return pathMatches.map(
|
|
1380
|
+
(match, idx) => idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase
|
|
1381
|
+
);
|
|
1382
|
+
}
|
|
1383
|
+
function resolveTo(toArg, routePathnames, locationPathname, isPathRelative = false) {
|
|
1384
|
+
let to;
|
|
1385
|
+
if (typeof toArg === "string") {
|
|
1386
|
+
to = parsePath(toArg);
|
|
1387
|
+
} else {
|
|
1388
|
+
to = { ...toArg };
|
|
1389
|
+
invariant(
|
|
1390
|
+
!to.pathname || !to.pathname.includes("?"),
|
|
1391
|
+
getInvalidPathError("?", "pathname", "search", to)
|
|
1392
|
+
);
|
|
1393
|
+
invariant(
|
|
1394
|
+
!to.pathname || !to.pathname.includes("#"),
|
|
1395
|
+
getInvalidPathError("#", "pathname", "hash", to)
|
|
1396
|
+
);
|
|
1397
|
+
invariant(
|
|
1398
|
+
!to.search || !to.search.includes("#"),
|
|
1399
|
+
getInvalidPathError("#", "search", "hash", to)
|
|
1400
|
+
);
|
|
1401
|
+
}
|
|
1402
|
+
let isEmptyPath = toArg === "" || to.pathname === "";
|
|
1403
|
+
let toPathname = isEmptyPath ? "/" : to.pathname;
|
|
1404
|
+
let from;
|
|
1405
|
+
if (toPathname == null) {
|
|
1406
|
+
from = locationPathname;
|
|
1407
|
+
} else {
|
|
1408
|
+
let routePathnameIndex = routePathnames.length - 1;
|
|
1409
|
+
if (!isPathRelative && toPathname.startsWith("..")) {
|
|
1410
|
+
let toSegments = toPathname.split("/");
|
|
1411
|
+
while (toSegments[0] === "..") {
|
|
1412
|
+
toSegments.shift();
|
|
1413
|
+
routePathnameIndex -= 1;
|
|
1414
|
+
}
|
|
1415
|
+
to.pathname = toSegments.join("/");
|
|
1416
|
+
}
|
|
1417
|
+
from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/";
|
|
1418
|
+
}
|
|
1419
|
+
let path = resolvePath(to, from);
|
|
1420
|
+
let hasExplicitTrailingSlash = toPathname && toPathname !== "/" && toPathname.endsWith("/");
|
|
1421
|
+
let hasCurrentTrailingSlash = (isEmptyPath || toPathname === ".") && locationPathname.endsWith("/");
|
|
1422
|
+
if (!path.pathname.endsWith("/") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {
|
|
1423
|
+
path.pathname += "/";
|
|
1424
|
+
}
|
|
1425
|
+
return path;
|
|
1426
|
+
}
|
|
1427
|
+
var joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/");
|
|
1428
|
+
var normalizePathname = (pathname) => pathname.replace(/\/+$/, "").replace(/^\/*/, "/");
|
|
1429
|
+
var normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
|
|
1430
|
+
var normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
|
|
1431
|
+
function isRouteErrorResponse(error) {
|
|
1432
|
+
return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
// lib/router/router.ts
|
|
1436
|
+
var validMutationMethodsArr = [
|
|
1437
|
+
"POST",
|
|
1438
|
+
"PUT",
|
|
1439
|
+
"PATCH",
|
|
1440
|
+
"DELETE"
|
|
1441
|
+
];
|
|
1442
|
+
new Set(
|
|
1443
|
+
validMutationMethodsArr
|
|
1444
|
+
);
|
|
1445
|
+
var validRequestMethodsArr = [
|
|
1446
|
+
"GET",
|
|
1447
|
+
...validMutationMethodsArr
|
|
1448
|
+
];
|
|
1449
|
+
new Set(validRequestMethodsArr);
|
|
1450
|
+
var DataRouterContext = React.createContext(null);
|
|
1451
|
+
DataRouterContext.displayName = "DataRouter";
|
|
1452
|
+
var DataRouterStateContext = React.createContext(null);
|
|
1453
|
+
DataRouterStateContext.displayName = "DataRouterState";
|
|
1454
|
+
var ViewTransitionContext = React.createContext({
|
|
1455
|
+
isTransitioning: false
|
|
1456
|
+
});
|
|
1457
|
+
ViewTransitionContext.displayName = "ViewTransition";
|
|
1458
|
+
var FetchersContext = React.createContext(
|
|
1459
|
+
/* @__PURE__ */ new Map()
|
|
1460
|
+
);
|
|
1461
|
+
FetchersContext.displayName = "Fetchers";
|
|
1462
|
+
var AwaitContext = React.createContext(null);
|
|
1463
|
+
AwaitContext.displayName = "Await";
|
|
1464
|
+
var NavigationContext = React.createContext(
|
|
1465
|
+
null
|
|
1466
|
+
);
|
|
1467
|
+
NavigationContext.displayName = "Navigation";
|
|
1468
|
+
var LocationContext = React.createContext(
|
|
1469
|
+
null
|
|
1470
|
+
);
|
|
1471
|
+
LocationContext.displayName = "Location";
|
|
1472
|
+
var RouteContext = React.createContext({
|
|
1473
|
+
outlet: null,
|
|
1474
|
+
matches: [],
|
|
1475
|
+
isDataRoute: false
|
|
896
1476
|
});
|
|
1477
|
+
RouteContext.displayName = "Route";
|
|
1478
|
+
var RouteErrorContext = React.createContext(null);
|
|
1479
|
+
RouteErrorContext.displayName = "RouteError";
|
|
1480
|
+
function useHref(to, { relative } = {}) {
|
|
1481
|
+
invariant(
|
|
1482
|
+
useInRouterContext(),
|
|
1483
|
+
// TODO: This error is probably because they somehow have 2 versions of the
|
|
1484
|
+
// router loaded. We can help them understand how to avoid that.
|
|
1485
|
+
`useHref() may be used only in the context of a <Router> component.`
|
|
1486
|
+
);
|
|
1487
|
+
let { basename, navigator: navigator2 } = React.useContext(NavigationContext);
|
|
1488
|
+
let { hash, pathname, search } = useResolvedPath(to, { relative });
|
|
1489
|
+
let joinedPathname = pathname;
|
|
1490
|
+
if (basename !== "/") {
|
|
1491
|
+
joinedPathname = pathname === "/" ? basename : joinPaths([basename, pathname]);
|
|
1492
|
+
}
|
|
1493
|
+
return navigator2.createHref({ pathname: joinedPathname, search, hash });
|
|
1494
|
+
}
|
|
1495
|
+
function useInRouterContext() {
|
|
1496
|
+
return React.useContext(LocationContext) != null;
|
|
1497
|
+
}
|
|
1498
|
+
function useLocation() {
|
|
1499
|
+
invariant(
|
|
1500
|
+
useInRouterContext(),
|
|
1501
|
+
// TODO: This error is probably because they somehow have 2 versions of the
|
|
1502
|
+
// router loaded. We can help them understand how to avoid that.
|
|
1503
|
+
`useLocation() may be used only in the context of a <Router> component.`
|
|
1504
|
+
);
|
|
1505
|
+
return React.useContext(LocationContext).location;
|
|
1506
|
+
}
|
|
1507
|
+
var navigateEffectWarning = `You should call navigate() in a React.useEffect(), not when your component is first rendered.`;
|
|
1508
|
+
function useIsomorphicLayoutEffect(cb) {
|
|
1509
|
+
let isStatic = React.useContext(NavigationContext).static;
|
|
1510
|
+
if (!isStatic) {
|
|
1511
|
+
React.useLayoutEffect(cb);
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
function useNavigate() {
|
|
1515
|
+
let { isDataRoute } = React.useContext(RouteContext);
|
|
1516
|
+
return isDataRoute ? useNavigateStable() : useNavigateUnstable();
|
|
1517
|
+
}
|
|
1518
|
+
function useNavigateUnstable() {
|
|
1519
|
+
invariant(
|
|
1520
|
+
useInRouterContext(),
|
|
1521
|
+
// TODO: This error is probably because they somehow have 2 versions of the
|
|
1522
|
+
// router loaded. We can help them understand how to avoid that.
|
|
1523
|
+
`useNavigate() may be used only in the context of a <Router> component.`
|
|
1524
|
+
);
|
|
1525
|
+
let dataRouterContext = React.useContext(DataRouterContext);
|
|
1526
|
+
let { basename, navigator: navigator2 } = React.useContext(NavigationContext);
|
|
1527
|
+
let { matches } = React.useContext(RouteContext);
|
|
1528
|
+
let { pathname: locationPathname } = useLocation();
|
|
1529
|
+
let routePathnamesJson = JSON.stringify(getResolveToMatches(matches));
|
|
1530
|
+
let activeRef = React.useRef(false);
|
|
1531
|
+
useIsomorphicLayoutEffect(() => {
|
|
1532
|
+
activeRef.current = true;
|
|
1533
|
+
});
|
|
1534
|
+
let navigate = React.useCallback(
|
|
1535
|
+
(to, options = {}) => {
|
|
1536
|
+
warning(activeRef.current, navigateEffectWarning);
|
|
1537
|
+
if (!activeRef.current) return;
|
|
1538
|
+
if (typeof to === "number") {
|
|
1539
|
+
navigator2.go(to);
|
|
1540
|
+
return;
|
|
1541
|
+
}
|
|
1542
|
+
let path = resolveTo(
|
|
1543
|
+
to,
|
|
1544
|
+
JSON.parse(routePathnamesJson),
|
|
1545
|
+
locationPathname,
|
|
1546
|
+
options.relative === "path"
|
|
1547
|
+
);
|
|
1548
|
+
if (dataRouterContext == null && basename !== "/") {
|
|
1549
|
+
path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
|
|
1550
|
+
}
|
|
1551
|
+
(!!options.replace ? navigator2.replace : navigator2.push)(
|
|
1552
|
+
path,
|
|
1553
|
+
options.state,
|
|
1554
|
+
options
|
|
1555
|
+
);
|
|
1556
|
+
},
|
|
1557
|
+
[
|
|
1558
|
+
basename,
|
|
1559
|
+
navigator2,
|
|
1560
|
+
routePathnamesJson,
|
|
1561
|
+
locationPathname,
|
|
1562
|
+
dataRouterContext
|
|
1563
|
+
]
|
|
1564
|
+
);
|
|
1565
|
+
return navigate;
|
|
1566
|
+
}
|
|
1567
|
+
React.createContext(null);
|
|
1568
|
+
function useResolvedPath(to, { relative } = {}) {
|
|
1569
|
+
let { matches } = React.useContext(RouteContext);
|
|
1570
|
+
let { pathname: locationPathname } = useLocation();
|
|
1571
|
+
let routePathnamesJson = JSON.stringify(getResolveToMatches(matches));
|
|
1572
|
+
return React.useMemo(
|
|
1573
|
+
() => resolveTo(
|
|
1574
|
+
to,
|
|
1575
|
+
JSON.parse(routePathnamesJson),
|
|
1576
|
+
locationPathname,
|
|
1577
|
+
relative === "path"
|
|
1578
|
+
),
|
|
1579
|
+
[to, routePathnamesJson, locationPathname, relative]
|
|
1580
|
+
);
|
|
1581
|
+
}
|
|
1582
|
+
function useRoutesImpl(routes, locationArg, dataRouterState, future) {
|
|
1583
|
+
invariant(
|
|
1584
|
+
useInRouterContext(),
|
|
1585
|
+
// TODO: This error is probably because they somehow have 2 versions of the
|
|
1586
|
+
// router loaded. We can help them understand how to avoid that.
|
|
1587
|
+
`useRoutes() may be used only in the context of a <Router> component.`
|
|
1588
|
+
);
|
|
1589
|
+
let { navigator: navigator2, static: isStatic } = React.useContext(NavigationContext);
|
|
1590
|
+
let { matches: parentMatches } = React.useContext(RouteContext);
|
|
1591
|
+
let routeMatch = parentMatches[parentMatches.length - 1];
|
|
1592
|
+
let parentParams = routeMatch ? routeMatch.params : {};
|
|
1593
|
+
let parentPathname = routeMatch ? routeMatch.pathname : "/";
|
|
1594
|
+
let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : "/";
|
|
1595
|
+
let parentRoute = routeMatch && routeMatch.route;
|
|
1596
|
+
{
|
|
1597
|
+
let parentPath = parentRoute && parentRoute.path || "";
|
|
1598
|
+
warningOnce(
|
|
1599
|
+
parentPathname,
|
|
1600
|
+
!parentRoute || parentPath.endsWith("*") || parentPath.endsWith("*?"),
|
|
1601
|
+
`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${parentPathname}" (under <Route path="${parentPath}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
1602
|
+
|
|
1603
|
+
Please change the parent <Route path="${parentPath}"> to <Route path="${parentPath === "/" ? "*" : `${parentPath}/*`}">.`
|
|
1604
|
+
);
|
|
1605
|
+
}
|
|
1606
|
+
let locationFromContext = useLocation();
|
|
1607
|
+
let location;
|
|
1608
|
+
{
|
|
1609
|
+
location = locationFromContext;
|
|
1610
|
+
}
|
|
1611
|
+
let pathname = location.pathname || "/";
|
|
1612
|
+
let remainingPathname = pathname;
|
|
1613
|
+
if (parentPathnameBase !== "/") {
|
|
1614
|
+
let parentSegments = parentPathnameBase.replace(/^\//, "").split("/");
|
|
1615
|
+
let segments = pathname.replace(/^\//, "").split("/");
|
|
1616
|
+
remainingPathname = "/" + segments.slice(parentSegments.length).join("/");
|
|
1617
|
+
}
|
|
1618
|
+
let matches = !isStatic && dataRouterState && dataRouterState.matches && dataRouterState.matches.length > 0 ? dataRouterState.matches : matchRoutes(routes, { pathname: remainingPathname });
|
|
1619
|
+
{
|
|
1620
|
+
warning(
|
|
1621
|
+
parentRoute || matches != null,
|
|
1622
|
+
`No routes matched location "${location.pathname}${location.search}${location.hash}" `
|
|
1623
|
+
);
|
|
1624
|
+
warning(
|
|
1625
|
+
matches == null || matches[matches.length - 1].route.element !== void 0 || matches[matches.length - 1].route.Component !== void 0 || matches[matches.length - 1].route.lazy !== void 0,
|
|
1626
|
+
`Matched leaf route at location "${location.pathname}${location.search}${location.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`
|
|
1627
|
+
);
|
|
1628
|
+
}
|
|
1629
|
+
let renderedMatches = _renderMatches(
|
|
1630
|
+
matches && matches.map(
|
|
1631
|
+
(match) => Object.assign({}, match, {
|
|
1632
|
+
params: Object.assign({}, parentParams, match.params),
|
|
1633
|
+
pathname: joinPaths([
|
|
1634
|
+
parentPathnameBase,
|
|
1635
|
+
// Re-encode pathnames that were decoded inside matchRoutes
|
|
1636
|
+
navigator2.encodeLocation ? navigator2.encodeLocation(match.pathname).pathname : match.pathname
|
|
1637
|
+
]),
|
|
1638
|
+
pathnameBase: match.pathnameBase === "/" ? parentPathnameBase : joinPaths([
|
|
1639
|
+
parentPathnameBase,
|
|
1640
|
+
// Re-encode pathnames that were decoded inside matchRoutes
|
|
1641
|
+
navigator2.encodeLocation ? navigator2.encodeLocation(match.pathnameBase).pathname : match.pathnameBase
|
|
1642
|
+
])
|
|
1643
|
+
})
|
|
1644
|
+
),
|
|
1645
|
+
parentMatches,
|
|
1646
|
+
dataRouterState,
|
|
1647
|
+
future
|
|
1648
|
+
);
|
|
1649
|
+
return renderedMatches;
|
|
1650
|
+
}
|
|
1651
|
+
function DefaultErrorComponent() {
|
|
1652
|
+
let error = useRouteError();
|
|
1653
|
+
let message = isRouteErrorResponse(error) ? `${error.status} ${error.statusText}` : error instanceof Error ? error.message : JSON.stringify(error);
|
|
1654
|
+
let stack = error instanceof Error ? error.stack : null;
|
|
1655
|
+
let lightgrey = "rgba(200,200,200, 0.5)";
|
|
1656
|
+
let preStyles = { padding: "0.5rem", backgroundColor: lightgrey };
|
|
1657
|
+
let codeStyles = { padding: "2px 4px", backgroundColor: lightgrey };
|
|
1658
|
+
let devInfo = null;
|
|
1659
|
+
{
|
|
1660
|
+
console.error(
|
|
1661
|
+
"Error handled by React Router default ErrorBoundary:",
|
|
1662
|
+
error
|
|
1663
|
+
);
|
|
1664
|
+
devInfo = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("p", null, "\u{1F4BF} Hey developer \u{1F44B}"), /* @__PURE__ */ React.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", /* @__PURE__ */ React.createElement("code", { style: codeStyles }, "ErrorBoundary"), " or", " ", /* @__PURE__ */ React.createElement("code", { style: codeStyles }, "errorElement"), " prop on your route."));
|
|
1665
|
+
}
|
|
1666
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ React.createElement("h3", { style: { fontStyle: "italic" } }, message), stack ? /* @__PURE__ */ React.createElement("pre", { style: preStyles }, stack) : null, devInfo);
|
|
1667
|
+
}
|
|
1668
|
+
var defaultErrorElement = /* @__PURE__ */ React.createElement(DefaultErrorComponent, null);
|
|
1669
|
+
var RenderErrorBoundary = class extends React.Component {
|
|
1670
|
+
constructor(props) {
|
|
1671
|
+
super(props);
|
|
1672
|
+
this.state = {
|
|
1673
|
+
location: props.location,
|
|
1674
|
+
revalidation: props.revalidation,
|
|
1675
|
+
error: props.error
|
|
1676
|
+
};
|
|
1677
|
+
}
|
|
1678
|
+
static getDerivedStateFromError(error) {
|
|
1679
|
+
return { error };
|
|
1680
|
+
}
|
|
1681
|
+
static getDerivedStateFromProps(props, state) {
|
|
1682
|
+
if (state.location !== props.location || state.revalidation !== "idle" && props.revalidation === "idle") {
|
|
1683
|
+
return {
|
|
1684
|
+
error: props.error,
|
|
1685
|
+
location: props.location,
|
|
1686
|
+
revalidation: props.revalidation
|
|
1687
|
+
};
|
|
1688
|
+
}
|
|
1689
|
+
return {
|
|
1690
|
+
error: props.error !== void 0 ? props.error : state.error,
|
|
1691
|
+
location: state.location,
|
|
1692
|
+
revalidation: props.revalidation || state.revalidation
|
|
1693
|
+
};
|
|
1694
|
+
}
|
|
1695
|
+
componentDidCatch(error, errorInfo) {
|
|
1696
|
+
console.error(
|
|
1697
|
+
"React Router caught the following error during render",
|
|
1698
|
+
error,
|
|
1699
|
+
errorInfo
|
|
1700
|
+
);
|
|
1701
|
+
}
|
|
1702
|
+
render() {
|
|
1703
|
+
return this.state.error !== void 0 ? /* @__PURE__ */ React.createElement(RouteContext.Provider, { value: this.props.routeContext }, /* @__PURE__ */ React.createElement(
|
|
1704
|
+
RouteErrorContext.Provider,
|
|
1705
|
+
{
|
|
1706
|
+
value: this.state.error,
|
|
1707
|
+
children: this.props.component
|
|
1708
|
+
}
|
|
1709
|
+
)) : this.props.children;
|
|
1710
|
+
}
|
|
1711
|
+
};
|
|
1712
|
+
function RenderedRoute({ routeContext, match, children }) {
|
|
1713
|
+
let dataRouterContext = React.useContext(DataRouterContext);
|
|
1714
|
+
if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && (match.route.errorElement || match.route.ErrorBoundary)) {
|
|
1715
|
+
dataRouterContext.staticContext._deepestRenderedBoundaryId = match.route.id;
|
|
1716
|
+
}
|
|
1717
|
+
return /* @__PURE__ */ React.createElement(RouteContext.Provider, { value: routeContext }, children);
|
|
1718
|
+
}
|
|
1719
|
+
function _renderMatches(matches, parentMatches = [], dataRouterState = null, future = null) {
|
|
1720
|
+
if (matches == null) {
|
|
1721
|
+
if (!dataRouterState) {
|
|
1722
|
+
return null;
|
|
1723
|
+
}
|
|
1724
|
+
if (dataRouterState.errors) {
|
|
1725
|
+
matches = dataRouterState.matches;
|
|
1726
|
+
} else if (parentMatches.length === 0 && !dataRouterState.initialized && dataRouterState.matches.length > 0) {
|
|
1727
|
+
matches = dataRouterState.matches;
|
|
1728
|
+
} else {
|
|
1729
|
+
return null;
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1732
|
+
let renderedMatches = matches;
|
|
1733
|
+
let errors = dataRouterState?.errors;
|
|
1734
|
+
if (errors != null) {
|
|
1735
|
+
let errorIndex = renderedMatches.findIndex(
|
|
1736
|
+
(m) => m.route.id && errors?.[m.route.id] !== void 0
|
|
1737
|
+
);
|
|
1738
|
+
invariant(
|
|
1739
|
+
errorIndex >= 0,
|
|
1740
|
+
`Could not find a matching route for errors on route IDs: ${Object.keys(
|
|
1741
|
+
errors
|
|
1742
|
+
).join(",")}`
|
|
1743
|
+
);
|
|
1744
|
+
renderedMatches = renderedMatches.slice(
|
|
1745
|
+
0,
|
|
1746
|
+
Math.min(renderedMatches.length, errorIndex + 1)
|
|
1747
|
+
);
|
|
1748
|
+
}
|
|
1749
|
+
let renderFallback = false;
|
|
1750
|
+
let fallbackIndex = -1;
|
|
1751
|
+
if (dataRouterState) {
|
|
1752
|
+
for (let i = 0; i < renderedMatches.length; i++) {
|
|
1753
|
+
let match = renderedMatches[i];
|
|
1754
|
+
if (match.route.HydrateFallback || match.route.hydrateFallbackElement) {
|
|
1755
|
+
fallbackIndex = i;
|
|
1756
|
+
}
|
|
1757
|
+
if (match.route.id) {
|
|
1758
|
+
let { loaderData, errors: errors2 } = dataRouterState;
|
|
1759
|
+
let needsToRunLoader = match.route.loader && !loaderData.hasOwnProperty(match.route.id) && (!errors2 || errors2[match.route.id] === void 0);
|
|
1760
|
+
if (match.route.lazy || needsToRunLoader) {
|
|
1761
|
+
renderFallback = true;
|
|
1762
|
+
if (fallbackIndex >= 0) {
|
|
1763
|
+
renderedMatches = renderedMatches.slice(0, fallbackIndex + 1);
|
|
1764
|
+
} else {
|
|
1765
|
+
renderedMatches = [renderedMatches[0]];
|
|
1766
|
+
}
|
|
1767
|
+
break;
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
return renderedMatches.reduceRight((outlet, match, index) => {
|
|
1773
|
+
let error;
|
|
1774
|
+
let shouldRenderHydrateFallback = false;
|
|
1775
|
+
let errorElement = null;
|
|
1776
|
+
let hydrateFallbackElement = null;
|
|
1777
|
+
if (dataRouterState) {
|
|
1778
|
+
error = errors && match.route.id ? errors[match.route.id] : void 0;
|
|
1779
|
+
errorElement = match.route.errorElement || defaultErrorElement;
|
|
1780
|
+
if (renderFallback) {
|
|
1781
|
+
if (fallbackIndex < 0 && index === 0) {
|
|
1782
|
+
warningOnce(
|
|
1783
|
+
"route-fallback",
|
|
1784
|
+
false,
|
|
1785
|
+
"No `HydrateFallback` element provided to render during initial hydration"
|
|
1786
|
+
);
|
|
1787
|
+
shouldRenderHydrateFallback = true;
|
|
1788
|
+
hydrateFallbackElement = null;
|
|
1789
|
+
} else if (fallbackIndex === index) {
|
|
1790
|
+
shouldRenderHydrateFallback = true;
|
|
1791
|
+
hydrateFallbackElement = match.route.hydrateFallbackElement || null;
|
|
1792
|
+
}
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
let matches2 = parentMatches.concat(renderedMatches.slice(0, index + 1));
|
|
1796
|
+
let getChildren = () => {
|
|
1797
|
+
let children;
|
|
1798
|
+
if (error) {
|
|
1799
|
+
children = errorElement;
|
|
1800
|
+
} else if (shouldRenderHydrateFallback) {
|
|
1801
|
+
children = hydrateFallbackElement;
|
|
1802
|
+
} else if (match.route.Component) {
|
|
1803
|
+
children = /* @__PURE__ */ React.createElement(match.route.Component, null);
|
|
1804
|
+
} else if (match.route.element) {
|
|
1805
|
+
children = match.route.element;
|
|
1806
|
+
} else {
|
|
1807
|
+
children = outlet;
|
|
1808
|
+
}
|
|
1809
|
+
return /* @__PURE__ */ React.createElement(
|
|
1810
|
+
RenderedRoute,
|
|
1811
|
+
{
|
|
1812
|
+
match,
|
|
1813
|
+
routeContext: {
|
|
1814
|
+
outlet,
|
|
1815
|
+
matches: matches2,
|
|
1816
|
+
isDataRoute: dataRouterState != null
|
|
1817
|
+
},
|
|
1818
|
+
children
|
|
1819
|
+
}
|
|
1820
|
+
);
|
|
1821
|
+
};
|
|
1822
|
+
return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /* @__PURE__ */ React.createElement(
|
|
1823
|
+
RenderErrorBoundary,
|
|
1824
|
+
{
|
|
1825
|
+
location: dataRouterState.location,
|
|
1826
|
+
revalidation: dataRouterState.revalidation,
|
|
1827
|
+
component: errorElement,
|
|
1828
|
+
error,
|
|
1829
|
+
children: getChildren(),
|
|
1830
|
+
routeContext: { outlet: null, matches: matches2, isDataRoute: true }
|
|
1831
|
+
}
|
|
1832
|
+
) : getChildren();
|
|
1833
|
+
}, null);
|
|
1834
|
+
}
|
|
1835
|
+
function getDataRouterConsoleError(hookName) {
|
|
1836
|
+
return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
1837
|
+
}
|
|
1838
|
+
function useDataRouterContext(hookName) {
|
|
1839
|
+
let ctx = React.useContext(DataRouterContext);
|
|
1840
|
+
invariant(ctx, getDataRouterConsoleError(hookName));
|
|
1841
|
+
return ctx;
|
|
1842
|
+
}
|
|
1843
|
+
function useDataRouterState(hookName) {
|
|
1844
|
+
let state = React.useContext(DataRouterStateContext);
|
|
1845
|
+
invariant(state, getDataRouterConsoleError(hookName));
|
|
1846
|
+
return state;
|
|
1847
|
+
}
|
|
1848
|
+
function useRouteContext(hookName) {
|
|
1849
|
+
let route = React.useContext(RouteContext);
|
|
1850
|
+
invariant(route, getDataRouterConsoleError(hookName));
|
|
1851
|
+
return route;
|
|
1852
|
+
}
|
|
1853
|
+
function useCurrentRouteId(hookName) {
|
|
1854
|
+
let route = useRouteContext(hookName);
|
|
1855
|
+
let thisRoute = route.matches[route.matches.length - 1];
|
|
1856
|
+
invariant(
|
|
1857
|
+
thisRoute.route.id,
|
|
1858
|
+
`${hookName} can only be used on routes that contain a unique "id"`
|
|
1859
|
+
);
|
|
1860
|
+
return thisRoute.route.id;
|
|
1861
|
+
}
|
|
1862
|
+
function useRouteId() {
|
|
1863
|
+
return useCurrentRouteId("useRouteId" /* UseRouteId */);
|
|
1864
|
+
}
|
|
1865
|
+
function useRouteError() {
|
|
1866
|
+
let error = React.useContext(RouteErrorContext);
|
|
1867
|
+
let state = useDataRouterState("useRouteError" /* UseRouteError */);
|
|
1868
|
+
let routeId = useCurrentRouteId("useRouteError" /* UseRouteError */);
|
|
1869
|
+
if (error !== void 0) {
|
|
1870
|
+
return error;
|
|
1871
|
+
}
|
|
1872
|
+
return state.errors?.[routeId];
|
|
1873
|
+
}
|
|
1874
|
+
function useNavigateStable() {
|
|
1875
|
+
let { router } = useDataRouterContext("useNavigate" /* UseNavigateStable */);
|
|
1876
|
+
let id = useCurrentRouteId("useNavigate" /* UseNavigateStable */);
|
|
1877
|
+
let activeRef = React.useRef(false);
|
|
1878
|
+
useIsomorphicLayoutEffect(() => {
|
|
1879
|
+
activeRef.current = true;
|
|
1880
|
+
});
|
|
1881
|
+
let navigate = React.useCallback(
|
|
1882
|
+
async (to, options = {}) => {
|
|
1883
|
+
warning(activeRef.current, navigateEffectWarning);
|
|
1884
|
+
if (!activeRef.current) return;
|
|
1885
|
+
if (typeof to === "number") {
|
|
1886
|
+
router.navigate(to);
|
|
1887
|
+
} else {
|
|
1888
|
+
await router.navigate(to, { fromRouteId: id, ...options });
|
|
1889
|
+
}
|
|
1890
|
+
},
|
|
1891
|
+
[router, id]
|
|
1892
|
+
);
|
|
1893
|
+
return navigate;
|
|
1894
|
+
}
|
|
1895
|
+
var alreadyWarned = {};
|
|
1896
|
+
function warningOnce(key, cond, message) {
|
|
1897
|
+
if (!cond && !alreadyWarned[key]) {
|
|
1898
|
+
alreadyWarned[key] = true;
|
|
1899
|
+
warning(false, message);
|
|
1900
|
+
}
|
|
1901
|
+
}
|
|
1902
|
+
React.memo(DataRoutes);
|
|
1903
|
+
function DataRoutes({
|
|
1904
|
+
routes,
|
|
1905
|
+
future,
|
|
1906
|
+
state
|
|
1907
|
+
}) {
|
|
1908
|
+
return useRoutesImpl(routes, void 0, state, future);
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
// lib/dom/dom.ts
|
|
1912
|
+
var defaultMethod = "get";
|
|
1913
|
+
var defaultEncType = "application/x-www-form-urlencoded";
|
|
1914
|
+
function isHtmlElement(object) {
|
|
1915
|
+
return object != null && typeof object.tagName === "string";
|
|
1916
|
+
}
|
|
1917
|
+
function isButtonElement(object) {
|
|
1918
|
+
return isHtmlElement(object) && object.tagName.toLowerCase() === "button";
|
|
1919
|
+
}
|
|
1920
|
+
function isFormElement(object) {
|
|
1921
|
+
return isHtmlElement(object) && object.tagName.toLowerCase() === "form";
|
|
1922
|
+
}
|
|
1923
|
+
function isInputElement(object) {
|
|
1924
|
+
return isHtmlElement(object) && object.tagName.toLowerCase() === "input";
|
|
1925
|
+
}
|
|
1926
|
+
function isModifiedEvent(event) {
|
|
1927
|
+
return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
|
|
1928
|
+
}
|
|
1929
|
+
function shouldProcessLinkClick(event, target) {
|
|
1930
|
+
return event.button === 0 && // Ignore everything but left clicks
|
|
1931
|
+
(!target || target === "_self") && // Let browser handle "target=_blank" etc.
|
|
1932
|
+
!isModifiedEvent(event);
|
|
1933
|
+
}
|
|
1934
|
+
var _formDataSupportsSubmitter = null;
|
|
1935
|
+
function isFormDataSubmitterSupported() {
|
|
1936
|
+
if (_formDataSupportsSubmitter === null) {
|
|
1937
|
+
try {
|
|
1938
|
+
new FormData(
|
|
1939
|
+
document.createElement("form"),
|
|
1940
|
+
// @ts-expect-error if FormData supports the submitter parameter, this will throw
|
|
1941
|
+
0
|
|
1942
|
+
);
|
|
1943
|
+
_formDataSupportsSubmitter = false;
|
|
1944
|
+
} catch (e) {
|
|
1945
|
+
_formDataSupportsSubmitter = true;
|
|
1946
|
+
}
|
|
1947
|
+
}
|
|
1948
|
+
return _formDataSupportsSubmitter;
|
|
1949
|
+
}
|
|
1950
|
+
var supportedFormEncTypes = /* @__PURE__ */ new Set([
|
|
1951
|
+
"application/x-www-form-urlencoded",
|
|
1952
|
+
"multipart/form-data",
|
|
1953
|
+
"text/plain"
|
|
1954
|
+
]);
|
|
1955
|
+
function getFormEncType(encType) {
|
|
1956
|
+
if (encType != null && !supportedFormEncTypes.has(encType)) {
|
|
1957
|
+
warning(
|
|
1958
|
+
false,
|
|
1959
|
+
`"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"`
|
|
1960
|
+
);
|
|
1961
|
+
return null;
|
|
1962
|
+
}
|
|
1963
|
+
return encType;
|
|
1964
|
+
}
|
|
1965
|
+
function getFormSubmissionInfo(target, basename) {
|
|
1966
|
+
let method;
|
|
1967
|
+
let action;
|
|
1968
|
+
let encType;
|
|
1969
|
+
let formData;
|
|
1970
|
+
let body;
|
|
1971
|
+
if (isFormElement(target)) {
|
|
1972
|
+
let attr = target.getAttribute("action");
|
|
1973
|
+
action = attr ? stripBasename(attr, basename) : null;
|
|
1974
|
+
method = target.getAttribute("method") || defaultMethod;
|
|
1975
|
+
encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
|
|
1976
|
+
formData = new FormData(target);
|
|
1977
|
+
} else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) {
|
|
1978
|
+
let form = target.form;
|
|
1979
|
+
if (form == null) {
|
|
1980
|
+
throw new Error(
|
|
1981
|
+
`Cannot submit a <button> or <input type="submit"> without a <form>`
|
|
1982
|
+
);
|
|
1983
|
+
}
|
|
1984
|
+
let attr = target.getAttribute("formaction") || form.getAttribute("action");
|
|
1985
|
+
action = attr ? stripBasename(attr, basename) : null;
|
|
1986
|
+
method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod;
|
|
1987
|
+
encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
|
|
1988
|
+
formData = new FormData(form, target);
|
|
1989
|
+
if (!isFormDataSubmitterSupported()) {
|
|
1990
|
+
let { name, type, value } = target;
|
|
1991
|
+
if (type === "image") {
|
|
1992
|
+
let prefix = name ? `${name}.` : "";
|
|
1993
|
+
formData.append(`${prefix}x`, "0");
|
|
1994
|
+
formData.append(`${prefix}y`, "0");
|
|
1995
|
+
} else if (name) {
|
|
1996
|
+
formData.append(name, value);
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
} else if (isHtmlElement(target)) {
|
|
2000
|
+
throw new Error(
|
|
2001
|
+
`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`
|
|
2002
|
+
);
|
|
2003
|
+
} else {
|
|
2004
|
+
method = defaultMethod;
|
|
2005
|
+
action = null;
|
|
2006
|
+
encType = defaultEncType;
|
|
2007
|
+
body = target;
|
|
2008
|
+
}
|
|
2009
|
+
if (formData && encType === "text/plain") {
|
|
2010
|
+
body = formData;
|
|
2011
|
+
formData = void 0;
|
|
2012
|
+
}
|
|
2013
|
+
return { action, method: method.toLowerCase(), encType, formData, body };
|
|
2014
|
+
}
|
|
2015
|
+
|
|
2016
|
+
// lib/dom/ssr/invariant.ts
|
|
2017
|
+
function invariant2(value, message) {
|
|
2018
|
+
if (value === false || value === null || typeof value === "undefined") {
|
|
2019
|
+
throw new Error(message);
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
|
|
2023
|
+
// lib/dom/ssr/routeModules.ts
|
|
2024
|
+
async function loadRouteModule(route, routeModulesCache) {
|
|
2025
|
+
if (route.id in routeModulesCache) {
|
|
2026
|
+
return routeModulesCache[route.id];
|
|
2027
|
+
}
|
|
2028
|
+
try {
|
|
2029
|
+
let routeModule = await import(
|
|
2030
|
+
/* @vite-ignore */
|
|
2031
|
+
/* webpackIgnore: true */
|
|
2032
|
+
route.module
|
|
2033
|
+
);
|
|
2034
|
+
routeModulesCache[route.id] = routeModule;
|
|
2035
|
+
return routeModule;
|
|
2036
|
+
} catch (error) {
|
|
2037
|
+
console.error(
|
|
2038
|
+
`Error loading route module \`${route.module}\`, reloading page...`
|
|
2039
|
+
);
|
|
2040
|
+
console.error(error);
|
|
2041
|
+
if (window.__reactRouterContext && window.__reactRouterContext.isSpaMode && // @ts-expect-error
|
|
2042
|
+
import.meta.hot) {
|
|
2043
|
+
throw error;
|
|
2044
|
+
}
|
|
2045
|
+
window.location.reload();
|
|
2046
|
+
return new Promise(() => {
|
|
2047
|
+
});
|
|
2048
|
+
}
|
|
2049
|
+
}
|
|
2050
|
+
function isHtmlLinkDescriptor(object) {
|
|
2051
|
+
if (object == null) {
|
|
2052
|
+
return false;
|
|
2053
|
+
}
|
|
2054
|
+
if (object.href == null) {
|
|
2055
|
+
return object.rel === "preload" && typeof object.imageSrcSet === "string" && typeof object.imageSizes === "string";
|
|
2056
|
+
}
|
|
2057
|
+
return typeof object.rel === "string" && typeof object.href === "string";
|
|
2058
|
+
}
|
|
2059
|
+
async function getKeyedPrefetchLinks(matches, manifest, routeModules) {
|
|
2060
|
+
let links = await Promise.all(
|
|
2061
|
+
matches.map(async (match) => {
|
|
2062
|
+
let route = manifest.routes[match.route.id];
|
|
2063
|
+
if (route) {
|
|
2064
|
+
let mod = await loadRouteModule(route, routeModules);
|
|
2065
|
+
return mod.links ? mod.links() : [];
|
|
2066
|
+
}
|
|
2067
|
+
return [];
|
|
2068
|
+
})
|
|
2069
|
+
);
|
|
2070
|
+
return dedupeLinkDescriptors(
|
|
2071
|
+
links.flat(1).filter(isHtmlLinkDescriptor).filter((link) => link.rel === "stylesheet" || link.rel === "preload").map(
|
|
2072
|
+
(link) => link.rel === "stylesheet" ? { ...link, rel: "prefetch", as: "style" } : { ...link, rel: "prefetch" }
|
|
2073
|
+
)
|
|
2074
|
+
);
|
|
2075
|
+
}
|
|
2076
|
+
function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, location, mode) {
|
|
2077
|
+
let isNew = (match, index) => {
|
|
2078
|
+
if (!currentMatches[index]) return true;
|
|
2079
|
+
return match.route.id !== currentMatches[index].route.id;
|
|
2080
|
+
};
|
|
2081
|
+
let matchPathChanged = (match, index) => {
|
|
2082
|
+
return (
|
|
2083
|
+
// param change, /users/123 -> /users/456
|
|
2084
|
+
currentMatches[index].pathname !== match.pathname || // splat param changed, which is not present in match.path
|
|
2085
|
+
// e.g. /files/images/avatar.jpg -> files/finances.xls
|
|
2086
|
+
currentMatches[index].route.path?.endsWith("*") && currentMatches[index].params["*"] !== match.params["*"]
|
|
2087
|
+
);
|
|
2088
|
+
};
|
|
2089
|
+
if (mode === "assets") {
|
|
2090
|
+
return nextMatches.filter(
|
|
2091
|
+
(match, index) => isNew(match, index) || matchPathChanged(match, index)
|
|
2092
|
+
);
|
|
2093
|
+
}
|
|
2094
|
+
if (mode === "data") {
|
|
2095
|
+
return nextMatches.filter((match, index) => {
|
|
2096
|
+
let manifestRoute = manifest.routes[match.route.id];
|
|
2097
|
+
if (!manifestRoute || !manifestRoute.hasLoader) {
|
|
2098
|
+
return false;
|
|
2099
|
+
}
|
|
2100
|
+
if (isNew(match, index) || matchPathChanged(match, index)) {
|
|
2101
|
+
return true;
|
|
2102
|
+
}
|
|
2103
|
+
if (match.route.shouldRevalidate) {
|
|
2104
|
+
let routeChoice = match.route.shouldRevalidate({
|
|
2105
|
+
currentUrl: new URL(
|
|
2106
|
+
location.pathname + location.search + location.hash,
|
|
2107
|
+
window.origin
|
|
2108
|
+
),
|
|
2109
|
+
currentParams: currentMatches[0]?.params || {},
|
|
2110
|
+
nextUrl: new URL(page, window.origin),
|
|
2111
|
+
nextParams: match.params,
|
|
2112
|
+
defaultShouldRevalidate: true
|
|
2113
|
+
});
|
|
2114
|
+
if (typeof routeChoice === "boolean") {
|
|
2115
|
+
return routeChoice;
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
return true;
|
|
2119
|
+
});
|
|
2120
|
+
}
|
|
2121
|
+
return [];
|
|
2122
|
+
}
|
|
2123
|
+
function getModuleLinkHrefs(matches, manifest, { includeHydrateFallback } = {}) {
|
|
2124
|
+
return dedupeHrefs(
|
|
2125
|
+
matches.map((match) => {
|
|
2126
|
+
let route = manifest.routes[match.route.id];
|
|
2127
|
+
if (!route) return [];
|
|
2128
|
+
let hrefs = [route.module];
|
|
2129
|
+
if (route.clientActionModule) {
|
|
2130
|
+
hrefs = hrefs.concat(route.clientActionModule);
|
|
2131
|
+
}
|
|
2132
|
+
if (route.clientLoaderModule) {
|
|
2133
|
+
hrefs = hrefs.concat(route.clientLoaderModule);
|
|
2134
|
+
}
|
|
2135
|
+
if (includeHydrateFallback && route.hydrateFallbackModule) {
|
|
2136
|
+
hrefs = hrefs.concat(route.hydrateFallbackModule);
|
|
2137
|
+
}
|
|
2138
|
+
if (route.imports) {
|
|
2139
|
+
hrefs = hrefs.concat(route.imports);
|
|
2140
|
+
}
|
|
2141
|
+
return hrefs;
|
|
2142
|
+
}).flat(1)
|
|
2143
|
+
);
|
|
2144
|
+
}
|
|
2145
|
+
function dedupeHrefs(hrefs) {
|
|
2146
|
+
return [...new Set(hrefs)];
|
|
2147
|
+
}
|
|
2148
|
+
function sortKeys(obj) {
|
|
2149
|
+
let sorted = {};
|
|
2150
|
+
let keys = Object.keys(obj).sort();
|
|
2151
|
+
for (let key of keys) {
|
|
2152
|
+
sorted[key] = obj[key];
|
|
2153
|
+
}
|
|
2154
|
+
return sorted;
|
|
2155
|
+
}
|
|
2156
|
+
function dedupeLinkDescriptors(descriptors, preloads) {
|
|
2157
|
+
let set = /* @__PURE__ */ new Set();
|
|
2158
|
+
new Set(preloads);
|
|
2159
|
+
return descriptors.reduce((deduped, descriptor) => {
|
|
2160
|
+
let key = JSON.stringify(sortKeys(descriptor));
|
|
2161
|
+
if (!set.has(key)) {
|
|
2162
|
+
set.add(key);
|
|
2163
|
+
deduped.push({ key, link: descriptor });
|
|
2164
|
+
}
|
|
2165
|
+
return deduped;
|
|
2166
|
+
}, []);
|
|
2167
|
+
}
|
|
2168
|
+
function singleFetchUrl(reqUrl, basename) {
|
|
2169
|
+
let url = typeof reqUrl === "string" ? new URL(
|
|
2170
|
+
reqUrl,
|
|
2171
|
+
// This can be called during the SSR flow via PrefetchPageLinksImpl so
|
|
2172
|
+
// don't assume window is available
|
|
2173
|
+
typeof window === "undefined" ? "server://singlefetch/" : window.location.origin
|
|
2174
|
+
) : reqUrl;
|
|
2175
|
+
if (url.pathname === "/") {
|
|
2176
|
+
url.pathname = "_root.data";
|
|
2177
|
+
} else if (basename && stripBasename(url.pathname, basename) === "/") {
|
|
2178
|
+
url.pathname = `${basename.replace(/\/$/, "")}/_root.data`;
|
|
2179
|
+
} else {
|
|
2180
|
+
url.pathname = `${url.pathname.replace(/\/$/, "")}.data`;
|
|
2181
|
+
}
|
|
2182
|
+
return url;
|
|
2183
|
+
}
|
|
2184
|
+
|
|
2185
|
+
// lib/dom/ssr/components.tsx
|
|
2186
|
+
function useDataRouterContext2() {
|
|
2187
|
+
let context = React.useContext(DataRouterContext);
|
|
2188
|
+
invariant2(
|
|
2189
|
+
context,
|
|
2190
|
+
"You must render this element inside a <DataRouterContext.Provider> element"
|
|
2191
|
+
);
|
|
2192
|
+
return context;
|
|
2193
|
+
}
|
|
2194
|
+
function useDataRouterStateContext() {
|
|
2195
|
+
let context = React.useContext(DataRouterStateContext);
|
|
2196
|
+
invariant2(
|
|
2197
|
+
context,
|
|
2198
|
+
"You must render this element inside a <DataRouterStateContext.Provider> element"
|
|
2199
|
+
);
|
|
2200
|
+
return context;
|
|
2201
|
+
}
|
|
2202
|
+
var FrameworkContext = React.createContext(void 0);
|
|
2203
|
+
FrameworkContext.displayName = "FrameworkContext";
|
|
2204
|
+
function useFrameworkContext() {
|
|
2205
|
+
let context = React.useContext(FrameworkContext);
|
|
2206
|
+
invariant2(
|
|
2207
|
+
context,
|
|
2208
|
+
"You must render this element inside a <HydratedRouter> element"
|
|
2209
|
+
);
|
|
2210
|
+
return context;
|
|
2211
|
+
}
|
|
2212
|
+
function usePrefetchBehavior(prefetch, theirElementProps) {
|
|
2213
|
+
let frameworkContext = React.useContext(FrameworkContext);
|
|
2214
|
+
let [maybePrefetch, setMaybePrefetch] = React.useState(false);
|
|
2215
|
+
let [shouldPrefetch, setShouldPrefetch] = React.useState(false);
|
|
2216
|
+
let { onFocus, onBlur, onMouseEnter, onMouseLeave, onTouchStart } = theirElementProps;
|
|
2217
|
+
let ref = React.useRef(null);
|
|
2218
|
+
React.useEffect(() => {
|
|
2219
|
+
if (prefetch === "render") {
|
|
2220
|
+
setShouldPrefetch(true);
|
|
2221
|
+
}
|
|
2222
|
+
if (prefetch === "viewport") {
|
|
2223
|
+
let callback = (entries) => {
|
|
2224
|
+
entries.forEach((entry) => {
|
|
2225
|
+
setShouldPrefetch(entry.isIntersecting);
|
|
2226
|
+
});
|
|
2227
|
+
};
|
|
2228
|
+
let observer = new IntersectionObserver(callback, { threshold: 0.5 });
|
|
2229
|
+
if (ref.current) observer.observe(ref.current);
|
|
2230
|
+
return () => {
|
|
2231
|
+
observer.disconnect();
|
|
2232
|
+
};
|
|
2233
|
+
}
|
|
2234
|
+
}, [prefetch]);
|
|
2235
|
+
React.useEffect(() => {
|
|
2236
|
+
if (maybePrefetch) {
|
|
2237
|
+
let id = setTimeout(() => {
|
|
2238
|
+
setShouldPrefetch(true);
|
|
2239
|
+
}, 100);
|
|
2240
|
+
return () => {
|
|
2241
|
+
clearTimeout(id);
|
|
2242
|
+
};
|
|
2243
|
+
}
|
|
2244
|
+
}, [maybePrefetch]);
|
|
2245
|
+
let setIntent = () => {
|
|
2246
|
+
setMaybePrefetch(true);
|
|
2247
|
+
};
|
|
2248
|
+
let cancelIntent = () => {
|
|
2249
|
+
setMaybePrefetch(false);
|
|
2250
|
+
setShouldPrefetch(false);
|
|
2251
|
+
};
|
|
2252
|
+
if (!frameworkContext) {
|
|
2253
|
+
return [false, ref, {}];
|
|
2254
|
+
}
|
|
2255
|
+
if (prefetch !== "intent") {
|
|
2256
|
+
return [shouldPrefetch, ref, {}];
|
|
2257
|
+
}
|
|
2258
|
+
return [
|
|
2259
|
+
shouldPrefetch,
|
|
2260
|
+
ref,
|
|
2261
|
+
{
|
|
2262
|
+
onFocus: composeEventHandlers(onFocus, setIntent),
|
|
2263
|
+
onBlur: composeEventHandlers(onBlur, cancelIntent),
|
|
2264
|
+
onMouseEnter: composeEventHandlers(onMouseEnter, setIntent),
|
|
2265
|
+
onMouseLeave: composeEventHandlers(onMouseLeave, cancelIntent),
|
|
2266
|
+
onTouchStart: composeEventHandlers(onTouchStart, setIntent)
|
|
2267
|
+
}
|
|
2268
|
+
];
|
|
2269
|
+
}
|
|
2270
|
+
function composeEventHandlers(theirHandler, ourHandler) {
|
|
2271
|
+
return (event) => {
|
|
2272
|
+
theirHandler && theirHandler(event);
|
|
2273
|
+
if (!event.defaultPrevented) {
|
|
2274
|
+
ourHandler(event);
|
|
2275
|
+
}
|
|
2276
|
+
};
|
|
2277
|
+
}
|
|
2278
|
+
function PrefetchPageLinks({
|
|
2279
|
+
page,
|
|
2280
|
+
...dataLinkProps
|
|
2281
|
+
}) {
|
|
2282
|
+
let { router } = useDataRouterContext2();
|
|
2283
|
+
let matches = React.useMemo(
|
|
2284
|
+
() => matchRoutes(router.routes, page, router.basename),
|
|
2285
|
+
[router.routes, page, router.basename]
|
|
2286
|
+
);
|
|
2287
|
+
if (!matches) {
|
|
2288
|
+
return null;
|
|
2289
|
+
}
|
|
2290
|
+
return /* @__PURE__ */ React.createElement(PrefetchPageLinksImpl, { page, matches, ...dataLinkProps });
|
|
2291
|
+
}
|
|
2292
|
+
function useKeyedPrefetchLinks(matches) {
|
|
2293
|
+
let { manifest, routeModules } = useFrameworkContext();
|
|
2294
|
+
let [keyedPrefetchLinks, setKeyedPrefetchLinks] = React.useState([]);
|
|
2295
|
+
React.useEffect(() => {
|
|
2296
|
+
let interrupted = false;
|
|
2297
|
+
void getKeyedPrefetchLinks(matches, manifest, routeModules).then(
|
|
2298
|
+
(links) => {
|
|
2299
|
+
if (!interrupted) {
|
|
2300
|
+
setKeyedPrefetchLinks(links);
|
|
2301
|
+
}
|
|
2302
|
+
}
|
|
2303
|
+
);
|
|
2304
|
+
return () => {
|
|
2305
|
+
interrupted = true;
|
|
2306
|
+
};
|
|
2307
|
+
}, [matches, manifest, routeModules]);
|
|
2308
|
+
return keyedPrefetchLinks;
|
|
2309
|
+
}
|
|
2310
|
+
function PrefetchPageLinksImpl({
|
|
2311
|
+
page,
|
|
2312
|
+
matches: nextMatches,
|
|
2313
|
+
...linkProps
|
|
2314
|
+
}) {
|
|
2315
|
+
let location = useLocation();
|
|
2316
|
+
let { manifest, routeModules } = useFrameworkContext();
|
|
2317
|
+
let { basename } = useDataRouterContext2();
|
|
2318
|
+
let { loaderData, matches } = useDataRouterStateContext();
|
|
2319
|
+
let newMatchesForData = React.useMemo(
|
|
2320
|
+
() => getNewMatchesForLinks(
|
|
2321
|
+
page,
|
|
2322
|
+
nextMatches,
|
|
2323
|
+
matches,
|
|
2324
|
+
manifest,
|
|
2325
|
+
location,
|
|
2326
|
+
"data"
|
|
2327
|
+
),
|
|
2328
|
+
[page, nextMatches, matches, manifest, location]
|
|
2329
|
+
);
|
|
2330
|
+
let newMatchesForAssets = React.useMemo(
|
|
2331
|
+
() => getNewMatchesForLinks(
|
|
2332
|
+
page,
|
|
2333
|
+
nextMatches,
|
|
2334
|
+
matches,
|
|
2335
|
+
manifest,
|
|
2336
|
+
location,
|
|
2337
|
+
"assets"
|
|
2338
|
+
),
|
|
2339
|
+
[page, nextMatches, matches, manifest, location]
|
|
2340
|
+
);
|
|
2341
|
+
let dataHrefs = React.useMemo(() => {
|
|
2342
|
+
if (page === location.pathname + location.search + location.hash) {
|
|
2343
|
+
return [];
|
|
2344
|
+
}
|
|
2345
|
+
let routesParams = /* @__PURE__ */ new Set();
|
|
2346
|
+
let foundOptOutRoute = false;
|
|
2347
|
+
nextMatches.forEach((m) => {
|
|
2348
|
+
let manifestRoute = manifest.routes[m.route.id];
|
|
2349
|
+
if (!manifestRoute || !manifestRoute.hasLoader) {
|
|
2350
|
+
return;
|
|
2351
|
+
}
|
|
2352
|
+
if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && routeModules[m.route.id]?.shouldRevalidate) {
|
|
2353
|
+
foundOptOutRoute = true;
|
|
2354
|
+
} else if (manifestRoute.hasClientLoader) {
|
|
2355
|
+
foundOptOutRoute = true;
|
|
2356
|
+
} else {
|
|
2357
|
+
routesParams.add(m.route.id);
|
|
2358
|
+
}
|
|
2359
|
+
});
|
|
2360
|
+
if (routesParams.size === 0) {
|
|
2361
|
+
return [];
|
|
2362
|
+
}
|
|
2363
|
+
let url = singleFetchUrl(page, basename);
|
|
2364
|
+
if (foundOptOutRoute && routesParams.size > 0) {
|
|
2365
|
+
url.searchParams.set(
|
|
2366
|
+
"_routes",
|
|
2367
|
+
nextMatches.filter((m) => routesParams.has(m.route.id)).map((m) => m.route.id).join(",")
|
|
2368
|
+
);
|
|
2369
|
+
}
|
|
2370
|
+
return [url.pathname + url.search];
|
|
2371
|
+
}, [
|
|
2372
|
+
basename,
|
|
2373
|
+
loaderData,
|
|
2374
|
+
location,
|
|
2375
|
+
manifest,
|
|
2376
|
+
newMatchesForData,
|
|
2377
|
+
nextMatches,
|
|
2378
|
+
page,
|
|
2379
|
+
routeModules
|
|
2380
|
+
]);
|
|
2381
|
+
let moduleHrefs = React.useMemo(
|
|
2382
|
+
() => getModuleLinkHrefs(newMatchesForAssets, manifest),
|
|
2383
|
+
[newMatchesForAssets, manifest]
|
|
2384
|
+
);
|
|
2385
|
+
let keyedPrefetchLinks = useKeyedPrefetchLinks(newMatchesForAssets);
|
|
2386
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, dataHrefs.map((href2) => /* @__PURE__ */ React.createElement("link", { key: href2, rel: "prefetch", as: "fetch", href: href2, ...linkProps })), moduleHrefs.map((href2) => /* @__PURE__ */ React.createElement("link", { key: href2, rel: "modulepreload", href: href2, ...linkProps })), keyedPrefetchLinks.map(({ key, link }) => (
|
|
2387
|
+
// these don't spread `linkProps` because they are full link descriptors
|
|
2388
|
+
// already with their own props
|
|
2389
|
+
/* @__PURE__ */ React.createElement("link", { key, ...link })
|
|
2390
|
+
)));
|
|
2391
|
+
}
|
|
2392
|
+
function mergeRefs(...refs) {
|
|
2393
|
+
return (value) => {
|
|
2394
|
+
refs.forEach((ref) => {
|
|
2395
|
+
if (typeof ref === "function") {
|
|
2396
|
+
ref(value);
|
|
2397
|
+
} else if (ref != null) {
|
|
2398
|
+
ref.current = value;
|
|
2399
|
+
}
|
|
2400
|
+
});
|
|
2401
|
+
};
|
|
2402
|
+
}
|
|
2403
|
+
|
|
2404
|
+
// lib/dom/lib.tsx
|
|
2405
|
+
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
2406
|
+
try {
|
|
2407
|
+
if (isBrowser) {
|
|
2408
|
+
window.__reactRouterVersion = "7.3.0";
|
|
2409
|
+
}
|
|
2410
|
+
} catch (e) {
|
|
2411
|
+
}
|
|
2412
|
+
var ABSOLUTE_URL_REGEX2 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
2413
|
+
var Link = React.forwardRef(
|
|
2414
|
+
function LinkWithRef({
|
|
2415
|
+
onClick,
|
|
2416
|
+
discover = "render",
|
|
2417
|
+
prefetch = "none",
|
|
2418
|
+
relative,
|
|
2419
|
+
reloadDocument,
|
|
2420
|
+
replace: replace2,
|
|
2421
|
+
state,
|
|
2422
|
+
target,
|
|
2423
|
+
to,
|
|
2424
|
+
preventScrollReset,
|
|
2425
|
+
viewTransition,
|
|
2426
|
+
...rest
|
|
2427
|
+
}, forwardedRef) {
|
|
2428
|
+
let { basename } = React.useContext(NavigationContext);
|
|
2429
|
+
let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX2.test(to);
|
|
2430
|
+
let absoluteHref;
|
|
2431
|
+
let isExternal = false;
|
|
2432
|
+
if (typeof to === "string" && isAbsolute) {
|
|
2433
|
+
absoluteHref = to;
|
|
2434
|
+
if (isBrowser) {
|
|
2435
|
+
try {
|
|
2436
|
+
let currentUrl = new URL(window.location.href);
|
|
2437
|
+
let targetUrl = to.startsWith("//") ? new URL(currentUrl.protocol + to) : new URL(to);
|
|
2438
|
+
let path = stripBasename(targetUrl.pathname, basename);
|
|
2439
|
+
if (targetUrl.origin === currentUrl.origin && path != null) {
|
|
2440
|
+
to = path + targetUrl.search + targetUrl.hash;
|
|
2441
|
+
} else {
|
|
2442
|
+
isExternal = true;
|
|
2443
|
+
}
|
|
2444
|
+
} catch (e) {
|
|
2445
|
+
warning(
|
|
2446
|
+
false,
|
|
2447
|
+
`<Link to="${to}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
|
|
2448
|
+
);
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2451
|
+
}
|
|
2452
|
+
let href2 = useHref(to, { relative });
|
|
2453
|
+
let [shouldPrefetch, prefetchRef, prefetchHandlers] = usePrefetchBehavior(
|
|
2454
|
+
prefetch,
|
|
2455
|
+
rest
|
|
2456
|
+
);
|
|
2457
|
+
let internalOnClick = useLinkClickHandler(to, {
|
|
2458
|
+
replace: replace2,
|
|
2459
|
+
state,
|
|
2460
|
+
target,
|
|
2461
|
+
preventScrollReset,
|
|
2462
|
+
relative,
|
|
2463
|
+
viewTransition
|
|
2464
|
+
});
|
|
2465
|
+
function handleClick(event) {
|
|
2466
|
+
if (onClick) onClick(event);
|
|
2467
|
+
if (!event.defaultPrevented) {
|
|
2468
|
+
internalOnClick(event);
|
|
2469
|
+
}
|
|
2470
|
+
}
|
|
2471
|
+
let link = (
|
|
2472
|
+
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
2473
|
+
/* @__PURE__ */ React.createElement(
|
|
2474
|
+
"a",
|
|
2475
|
+
{
|
|
2476
|
+
...rest,
|
|
2477
|
+
...prefetchHandlers,
|
|
2478
|
+
href: absoluteHref || href2,
|
|
2479
|
+
onClick: isExternal || reloadDocument ? onClick : handleClick,
|
|
2480
|
+
ref: mergeRefs(forwardedRef, prefetchRef),
|
|
2481
|
+
target,
|
|
2482
|
+
"data-discover": !isAbsolute && discover === "render" ? "true" : void 0
|
|
2483
|
+
}
|
|
2484
|
+
)
|
|
2485
|
+
);
|
|
2486
|
+
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link, /* @__PURE__ */ React.createElement(PrefetchPageLinks, { page: href2 })) : link;
|
|
2487
|
+
}
|
|
2488
|
+
);
|
|
2489
|
+
Link.displayName = "Link";
|
|
2490
|
+
var NavLink = React.forwardRef(
|
|
2491
|
+
function NavLinkWithRef({
|
|
2492
|
+
"aria-current": ariaCurrentProp = "page",
|
|
2493
|
+
caseSensitive = false,
|
|
2494
|
+
className: classNameProp = "",
|
|
2495
|
+
end = false,
|
|
2496
|
+
style: styleProp,
|
|
2497
|
+
to,
|
|
2498
|
+
viewTransition,
|
|
2499
|
+
children,
|
|
2500
|
+
...rest
|
|
2501
|
+
}, ref) {
|
|
2502
|
+
let path = useResolvedPath(to, { relative: rest.relative });
|
|
2503
|
+
let location = useLocation();
|
|
2504
|
+
let routerState = React.useContext(DataRouterStateContext);
|
|
2505
|
+
let { navigator: navigator2, basename } = React.useContext(NavigationContext);
|
|
2506
|
+
let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
|
|
2507
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
2508
|
+
useViewTransitionState(path) && viewTransition === true;
|
|
2509
|
+
let toPathname = navigator2.encodeLocation ? navigator2.encodeLocation(path).pathname : path.pathname;
|
|
2510
|
+
let locationPathname = location.pathname;
|
|
2511
|
+
let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null;
|
|
2512
|
+
if (!caseSensitive) {
|
|
2513
|
+
locationPathname = locationPathname.toLowerCase();
|
|
2514
|
+
nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null;
|
|
2515
|
+
toPathname = toPathname.toLowerCase();
|
|
2516
|
+
}
|
|
2517
|
+
if (nextLocationPathname && basename) {
|
|
2518
|
+
nextLocationPathname = stripBasename(nextLocationPathname, basename) || nextLocationPathname;
|
|
2519
|
+
}
|
|
2520
|
+
const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
|
|
2521
|
+
let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
|
|
2522
|
+
let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/");
|
|
2523
|
+
let renderProps = {
|
|
2524
|
+
isActive,
|
|
2525
|
+
isPending,
|
|
2526
|
+
isTransitioning
|
|
2527
|
+
};
|
|
2528
|
+
let ariaCurrent = isActive ? ariaCurrentProp : void 0;
|
|
2529
|
+
let className;
|
|
2530
|
+
if (typeof classNameProp === "function") {
|
|
2531
|
+
className = classNameProp(renderProps);
|
|
2532
|
+
} else {
|
|
2533
|
+
className = [
|
|
2534
|
+
classNameProp,
|
|
2535
|
+
isActive ? "active" : null,
|
|
2536
|
+
isPending ? "pending" : null,
|
|
2537
|
+
isTransitioning ? "transitioning" : null
|
|
2538
|
+
].filter(Boolean).join(" ");
|
|
2539
|
+
}
|
|
2540
|
+
let style = typeof styleProp === "function" ? styleProp(renderProps) : styleProp;
|
|
2541
|
+
return /* @__PURE__ */ React.createElement(
|
|
2542
|
+
Link,
|
|
2543
|
+
{
|
|
2544
|
+
...rest,
|
|
2545
|
+
"aria-current": ariaCurrent,
|
|
2546
|
+
className,
|
|
2547
|
+
ref,
|
|
2548
|
+
style,
|
|
2549
|
+
to,
|
|
2550
|
+
viewTransition
|
|
2551
|
+
},
|
|
2552
|
+
typeof children === "function" ? children(renderProps) : children
|
|
2553
|
+
);
|
|
2554
|
+
}
|
|
2555
|
+
);
|
|
2556
|
+
NavLink.displayName = "NavLink";
|
|
2557
|
+
var Form = React.forwardRef(
|
|
2558
|
+
({
|
|
2559
|
+
discover = "render",
|
|
2560
|
+
fetcherKey,
|
|
2561
|
+
navigate,
|
|
2562
|
+
reloadDocument,
|
|
2563
|
+
replace: replace2,
|
|
2564
|
+
state,
|
|
2565
|
+
method = defaultMethod,
|
|
2566
|
+
action,
|
|
2567
|
+
onSubmit,
|
|
2568
|
+
relative,
|
|
2569
|
+
preventScrollReset,
|
|
2570
|
+
viewTransition,
|
|
2571
|
+
...props
|
|
2572
|
+
}, forwardedRef) => {
|
|
2573
|
+
let submit = useSubmit();
|
|
2574
|
+
let formAction = useFormAction(action, { relative });
|
|
2575
|
+
let formMethod = method.toLowerCase() === "get" ? "get" : "post";
|
|
2576
|
+
let isAbsolute = typeof action === "string" && ABSOLUTE_URL_REGEX2.test(action);
|
|
2577
|
+
let submitHandler = (event) => {
|
|
2578
|
+
onSubmit && onSubmit(event);
|
|
2579
|
+
if (event.defaultPrevented) return;
|
|
2580
|
+
event.preventDefault();
|
|
2581
|
+
let submitter = event.nativeEvent.submitter;
|
|
2582
|
+
let submitMethod = submitter?.getAttribute("formmethod") || method;
|
|
2583
|
+
submit(submitter || event.currentTarget, {
|
|
2584
|
+
fetcherKey,
|
|
2585
|
+
method: submitMethod,
|
|
2586
|
+
navigate,
|
|
2587
|
+
replace: replace2,
|
|
2588
|
+
state,
|
|
2589
|
+
relative,
|
|
2590
|
+
preventScrollReset,
|
|
2591
|
+
viewTransition
|
|
2592
|
+
});
|
|
2593
|
+
};
|
|
2594
|
+
return /* @__PURE__ */ React.createElement(
|
|
2595
|
+
"form",
|
|
2596
|
+
{
|
|
2597
|
+
ref: forwardedRef,
|
|
2598
|
+
method: formMethod,
|
|
2599
|
+
action: formAction,
|
|
2600
|
+
onSubmit: reloadDocument ? onSubmit : submitHandler,
|
|
2601
|
+
...props,
|
|
2602
|
+
"data-discover": !isAbsolute && discover === "render" ? "true" : void 0
|
|
2603
|
+
}
|
|
2604
|
+
);
|
|
2605
|
+
}
|
|
2606
|
+
);
|
|
2607
|
+
Form.displayName = "Form";
|
|
2608
|
+
function getDataRouterConsoleError2(hookName) {
|
|
2609
|
+
return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
2610
|
+
}
|
|
2611
|
+
function useDataRouterContext3(hookName) {
|
|
2612
|
+
let ctx = React.useContext(DataRouterContext);
|
|
2613
|
+
invariant(ctx, getDataRouterConsoleError2(hookName));
|
|
2614
|
+
return ctx;
|
|
2615
|
+
}
|
|
2616
|
+
function useLinkClickHandler(to, {
|
|
2617
|
+
target,
|
|
2618
|
+
replace: replaceProp,
|
|
2619
|
+
state,
|
|
2620
|
+
preventScrollReset,
|
|
2621
|
+
relative,
|
|
2622
|
+
viewTransition
|
|
2623
|
+
} = {}) {
|
|
2624
|
+
let navigate = useNavigate();
|
|
2625
|
+
let location = useLocation();
|
|
2626
|
+
let path = useResolvedPath(to, { relative });
|
|
2627
|
+
return React.useCallback(
|
|
2628
|
+
(event) => {
|
|
2629
|
+
if (shouldProcessLinkClick(event, target)) {
|
|
2630
|
+
event.preventDefault();
|
|
2631
|
+
let replace2 = replaceProp !== void 0 ? replaceProp : createPath(location) === createPath(path);
|
|
2632
|
+
navigate(to, {
|
|
2633
|
+
replace: replace2,
|
|
2634
|
+
state,
|
|
2635
|
+
preventScrollReset,
|
|
2636
|
+
relative,
|
|
2637
|
+
viewTransition
|
|
2638
|
+
});
|
|
2639
|
+
}
|
|
2640
|
+
},
|
|
2641
|
+
[
|
|
2642
|
+
location,
|
|
2643
|
+
navigate,
|
|
2644
|
+
path,
|
|
2645
|
+
replaceProp,
|
|
2646
|
+
state,
|
|
2647
|
+
target,
|
|
2648
|
+
to,
|
|
2649
|
+
preventScrollReset,
|
|
2650
|
+
relative,
|
|
2651
|
+
viewTransition
|
|
2652
|
+
]
|
|
2653
|
+
);
|
|
2654
|
+
}
|
|
2655
|
+
var fetcherId = 0;
|
|
2656
|
+
var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
|
|
2657
|
+
function useSubmit() {
|
|
2658
|
+
let { router } = useDataRouterContext3("useSubmit" /* UseSubmit */);
|
|
2659
|
+
let { basename } = React.useContext(NavigationContext);
|
|
2660
|
+
let currentRouteId = useRouteId();
|
|
2661
|
+
return React.useCallback(
|
|
2662
|
+
async (target, options = {}) => {
|
|
2663
|
+
let { action, method, encType, formData, body } = getFormSubmissionInfo(
|
|
2664
|
+
target,
|
|
2665
|
+
basename
|
|
2666
|
+
);
|
|
2667
|
+
if (options.navigate === false) {
|
|
2668
|
+
let key = options.fetcherKey || getUniqueFetcherId();
|
|
2669
|
+
await router.fetch(key, currentRouteId, options.action || action, {
|
|
2670
|
+
preventScrollReset: options.preventScrollReset,
|
|
2671
|
+
formData,
|
|
2672
|
+
body,
|
|
2673
|
+
formMethod: options.method || method,
|
|
2674
|
+
formEncType: options.encType || encType,
|
|
2675
|
+
flushSync: options.flushSync
|
|
2676
|
+
});
|
|
2677
|
+
} else {
|
|
2678
|
+
await router.navigate(options.action || action, {
|
|
2679
|
+
preventScrollReset: options.preventScrollReset,
|
|
2680
|
+
formData,
|
|
2681
|
+
body,
|
|
2682
|
+
formMethod: options.method || method,
|
|
2683
|
+
formEncType: options.encType || encType,
|
|
2684
|
+
replace: options.replace,
|
|
2685
|
+
state: options.state,
|
|
2686
|
+
fromRouteId: currentRouteId,
|
|
2687
|
+
flushSync: options.flushSync,
|
|
2688
|
+
viewTransition: options.viewTransition
|
|
2689
|
+
});
|
|
2690
|
+
}
|
|
2691
|
+
},
|
|
2692
|
+
[router, basename, currentRouteId]
|
|
2693
|
+
);
|
|
2694
|
+
}
|
|
2695
|
+
function useFormAction(action, { relative } = {}) {
|
|
2696
|
+
let { basename } = React.useContext(NavigationContext);
|
|
2697
|
+
let routeContext = React.useContext(RouteContext);
|
|
2698
|
+
invariant(routeContext, "useFormAction must be used inside a RouteContext");
|
|
2699
|
+
let [match] = routeContext.matches.slice(-1);
|
|
2700
|
+
let path = { ...useResolvedPath(action ? action : ".", { relative }) };
|
|
2701
|
+
let location = useLocation();
|
|
2702
|
+
if (action == null) {
|
|
2703
|
+
path.search = location.search;
|
|
2704
|
+
let params = new URLSearchParams(path.search);
|
|
2705
|
+
let indexValues = params.getAll("index");
|
|
2706
|
+
let hasNakedIndexParam = indexValues.some((v) => v === "");
|
|
2707
|
+
if (hasNakedIndexParam) {
|
|
2708
|
+
params.delete("index");
|
|
2709
|
+
indexValues.filter((v) => v).forEach((v) => params.append("index", v));
|
|
2710
|
+
let qs = params.toString();
|
|
2711
|
+
path.search = qs ? `?${qs}` : "";
|
|
2712
|
+
}
|
|
2713
|
+
}
|
|
2714
|
+
if ((!action || action === ".") && match.route.index) {
|
|
2715
|
+
path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
|
|
2716
|
+
}
|
|
2717
|
+
if (basename !== "/") {
|
|
2718
|
+
path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
|
|
2719
|
+
}
|
|
2720
|
+
return createPath(path);
|
|
2721
|
+
}
|
|
2722
|
+
function useViewTransitionState(to, opts = {}) {
|
|
2723
|
+
let vtContext = React.useContext(ViewTransitionContext);
|
|
2724
|
+
invariant(
|
|
2725
|
+
vtContext != null,
|
|
2726
|
+
"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
|
|
2727
|
+
);
|
|
2728
|
+
let { basename } = useDataRouterContext3(
|
|
2729
|
+
"useViewTransitionState" /* useViewTransitionState */
|
|
2730
|
+
);
|
|
2731
|
+
let path = useResolvedPath(to, { relative: opts.relative });
|
|
2732
|
+
if (!vtContext.isTransitioning) {
|
|
2733
|
+
return false;
|
|
2734
|
+
}
|
|
2735
|
+
let currentPath = stripBasename(vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
|
|
2736
|
+
let nextPath = stripBasename(vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
|
|
2737
|
+
return matchPath(path.pathname, nextPath) != null || matchPath(path.pathname, currentPath) != null;
|
|
2738
|
+
}
|
|
2739
|
+
|
|
2740
|
+
// lib/server-runtime/crypto.ts
|
|
2741
|
+
new TextEncoder();
|
|
897
2742
|
|
|
898
2743
|
const SectionHeader = ({
|
|
899
2744
|
label,
|
|
@@ -905,16 +2750,16 @@ const SectionHeader = ({
|
|
|
905
2750
|
className,
|
|
906
2751
|
...props
|
|
907
2752
|
}) => {
|
|
908
|
-
return /*#__PURE__*/
|
|
2753
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
909
2754
|
className: classnames(['section_header', className])
|
|
910
|
-
}, props), label ? /*#__PURE__*/
|
|
2755
|
+
}, props), label ? /*#__PURE__*/React__default.createElement(Text, {
|
|
911
2756
|
className: classnames('section_label')
|
|
912
|
-
}, label) : null, /*#__PURE__*/
|
|
2757
|
+
}, label) : null, /*#__PURE__*/React__default.createElement(Text, {
|
|
913
2758
|
className: "section_title",
|
|
914
2759
|
component: titleComponent || (promoteTitle ? 'h1' : 'h2')
|
|
915
|
-
}, title), subtitle ? /*#__PURE__*/
|
|
2760
|
+
}, title), subtitle ? /*#__PURE__*/React__default.createElement(Text, {
|
|
916
2761
|
className: classnames('section_subtitle')
|
|
917
|
-
}, subtitle) : null, actions ? /*#__PURE__*/
|
|
2762
|
+
}, subtitle) : null, actions ? /*#__PURE__*/React__default.createElement("div", {
|
|
918
2763
|
className: "section_actions"
|
|
919
2764
|
}, actions) : null);
|
|
920
2765
|
};
|
|
@@ -928,11 +2773,6 @@ SectionHeader.propTypes = {
|
|
|
928
2773
|
className: PropTypes.node
|
|
929
2774
|
};
|
|
930
2775
|
|
|
931
|
-
var SectionHeader$1 = /*#__PURE__*/Object.freeze({
|
|
932
|
-
__proto__: null,
|
|
933
|
-
SectionHeader: SectionHeader
|
|
934
|
-
});
|
|
935
|
-
|
|
936
2776
|
const Section = ({
|
|
937
2777
|
align = 'left',
|
|
938
2778
|
color = 'default',
|
|
@@ -942,18 +2782,18 @@ const Section = ({
|
|
|
942
2782
|
children,
|
|
943
2783
|
...props
|
|
944
2784
|
}) => {
|
|
945
|
-
return /*#__PURE__*/
|
|
2785
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
946
2786
|
className: classnames(['section', {
|
|
947
2787
|
[`section-${align}`]: align,
|
|
948
2788
|
[`section-${color}`]: color,
|
|
949
2789
|
'section-landing': landing,
|
|
950
2790
|
'section-header': header
|
|
951
2791
|
}, className])
|
|
952
|
-
}, props), /*#__PURE__*/
|
|
2792
|
+
}, props), /*#__PURE__*/React__default.createElement("div", {
|
|
953
2793
|
className: 'section_container'
|
|
954
|
-
},
|
|
955
|
-
if (/*#__PURE__*/
|
|
956
|
-
return /*#__PURE__*/
|
|
2794
|
+
}, React__default.Children.map(children, child => {
|
|
2795
|
+
if (/*#__PURE__*/React__default.isValidElement(child) && child.type === SectionHeader) {
|
|
2796
|
+
return /*#__PURE__*/React__default.cloneElement(child, {
|
|
957
2797
|
promoteTitle: landing || header
|
|
958
2798
|
});
|
|
959
2799
|
}
|
|
@@ -969,13 +2809,8 @@ Section.propTypes = {
|
|
|
969
2809
|
children: PropTypes.node.isRequired
|
|
970
2810
|
};
|
|
971
2811
|
|
|
972
|
-
var Section$1 = /*#__PURE__*/Object.freeze({
|
|
973
|
-
__proto__: null,
|
|
974
|
-
Section: Section
|
|
975
|
-
});
|
|
976
|
-
|
|
977
2812
|
const NavBar = ({
|
|
978
|
-
|
|
2813
|
+
homeLinkComponent,
|
|
979
2814
|
align,
|
|
980
2815
|
className,
|
|
981
2816
|
children,
|
|
@@ -986,42 +2821,42 @@ const NavBar = ({
|
|
|
986
2821
|
setIsOpen(!isOpen);
|
|
987
2822
|
document.body.classList.toggle('js-navbar', !isOpen);
|
|
988
2823
|
};
|
|
989
|
-
|
|
2824
|
+
const HomeLinkComponent = homeLinkComponent || Link;
|
|
2825
|
+
return /*#__PURE__*/React__default.createElement("header", null, /*#__PURE__*/React__default.createElement(Section, _extends({
|
|
990
2826
|
className: classnames(['navbar', {
|
|
991
2827
|
[`navbar-${align}`]: align,
|
|
992
2828
|
'js-opened': isOpen
|
|
993
2829
|
}, className])
|
|
994
|
-
}, props), /*#__PURE__*/
|
|
2830
|
+
}, props), /*#__PURE__*/React__default.createElement("div", {
|
|
995
2831
|
className: "navbar_main"
|
|
996
|
-
}, /*#__PURE__*/
|
|
2832
|
+
}, /*#__PURE__*/React__default.createElement(HomeLinkComponent, {
|
|
2833
|
+
to: "/",
|
|
2834
|
+
exact: true,
|
|
997
2835
|
className: "navbar_logo"
|
|
998
|
-
},
|
|
2836
|
+
}, /*#__PURE__*/React__default.createElement("img", {
|
|
2837
|
+
src: "https://pallote.com/logos/pallote-logo.svg",
|
|
2838
|
+
alt: "Logo for Pallote"
|
|
2839
|
+
})), /*#__PURE__*/React__default.createElement("button", {
|
|
999
2840
|
"aria-label": "Open mobile menu",
|
|
1000
2841
|
className: classnames('navbar_button', {
|
|
1001
2842
|
'js-opened': isOpen
|
|
1002
2843
|
}),
|
|
1003
2844
|
onClick: toggleNav
|
|
1004
|
-
}, /*#__PURE__*/
|
|
2845
|
+
}, /*#__PURE__*/React__default.createElement("span", null))), /*#__PURE__*/React__default.createElement("nav", {
|
|
1005
2846
|
"aria-label": "main-nav",
|
|
1006
2847
|
className: classnames('navbar_nav nav', {
|
|
1007
2848
|
'js-opened': isOpen
|
|
1008
2849
|
})
|
|
1009
|
-
}, /*#__PURE__*/
|
|
2850
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
1010
2851
|
className: "nav_container"
|
|
1011
2852
|
}, children))));
|
|
1012
2853
|
};
|
|
1013
2854
|
NavBar.propTypes = {
|
|
1014
|
-
logo: PropTypes.node,
|
|
1015
2855
|
align: PropTypes.oneOf(['left', 'right']),
|
|
1016
2856
|
className: PropTypes.node,
|
|
1017
2857
|
children: PropTypes.node.isRequired
|
|
1018
2858
|
};
|
|
1019
2859
|
|
|
1020
|
-
var NavBar$1 = /*#__PURE__*/Object.freeze({
|
|
1021
|
-
__proto__: null,
|
|
1022
|
-
NavBar: NavBar
|
|
1023
|
-
});
|
|
1024
|
-
|
|
1025
2860
|
const NavItem = ({
|
|
1026
2861
|
component,
|
|
1027
2862
|
label,
|
|
@@ -1040,23 +2875,23 @@ const NavItem = ({
|
|
|
1040
2875
|
if (dropdown) {
|
|
1041
2876
|
Component = 'button';
|
|
1042
2877
|
} else {
|
|
1043
|
-
Component = component ||
|
|
2878
|
+
Component = component || Link;
|
|
1044
2879
|
}
|
|
1045
|
-
return /*#__PURE__*/
|
|
2880
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
1046
2881
|
className: classnames(['nav_item', {
|
|
1047
2882
|
'nav_item-dropdown': dropdown,
|
|
1048
2883
|
'js-show': isExpanded
|
|
1049
2884
|
}, className])
|
|
1050
|
-
}, /*#__PURE__*/
|
|
2885
|
+
}, /*#__PURE__*/React__default.createElement(Component, _extends({
|
|
1051
2886
|
end: end,
|
|
1052
2887
|
to: to,
|
|
1053
2888
|
className: classnames(['nav_trigger', {
|
|
1054
2889
|
'nav_trigger-active': active
|
|
1055
2890
|
}]),
|
|
1056
2891
|
onClick: onClick
|
|
1057
|
-
}, props), icon ? /*#__PURE__*/
|
|
2892
|
+
}, props), icon ? /*#__PURE__*/React__default.createElement("span", {
|
|
1058
2893
|
className: classnames('nav_icon')
|
|
1059
|
-
}, icon) : null, label), dropdown ? /*#__PURE__*/
|
|
2894
|
+
}, icon) : null, label), dropdown ? /*#__PURE__*/React__default.createElement("div", {
|
|
1060
2895
|
ref: dropdownRef,
|
|
1061
2896
|
className: "nav_target"
|
|
1062
2897
|
}, dropdown) : null);
|
|
@@ -1071,11 +2906,6 @@ NavItem.propTypes = {
|
|
|
1071
2906
|
className: PropTypes.node
|
|
1072
2907
|
};
|
|
1073
2908
|
|
|
1074
|
-
var NavItem$1 = /*#__PURE__*/Object.freeze({
|
|
1075
|
-
__proto__: null,
|
|
1076
|
-
NavItem: NavItem
|
|
1077
|
-
});
|
|
1078
|
-
|
|
1079
2909
|
const Radio = ({
|
|
1080
2910
|
id,
|
|
1081
2911
|
name,
|
|
@@ -1087,11 +2917,11 @@ const Radio = ({
|
|
|
1087
2917
|
className,
|
|
1088
2918
|
...props
|
|
1089
2919
|
}) => {
|
|
1090
|
-
return /*#__PURE__*/
|
|
2920
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
1091
2921
|
className: classnames(['radio', {
|
|
1092
2922
|
'radio-disabled': disabled
|
|
1093
2923
|
}, className])
|
|
1094
|
-
}, /*#__PURE__*/
|
|
2924
|
+
}, /*#__PURE__*/React__default.createElement("input", _extends({
|
|
1095
2925
|
className: classnames('radio_control'),
|
|
1096
2926
|
type: "radio",
|
|
1097
2927
|
id: id,
|
|
@@ -1101,7 +2931,7 @@ const Radio = ({
|
|
|
1101
2931
|
"aria-checked": checked,
|
|
1102
2932
|
disabled: disabled,
|
|
1103
2933
|
required: !(disabled || optional)
|
|
1104
|
-
}, props)), /*#__PURE__*/
|
|
2934
|
+
}, props)), /*#__PURE__*/React__default.createElement("label", {
|
|
1105
2935
|
className: classnames('radio_label'),
|
|
1106
2936
|
htmlFor: id
|
|
1107
2937
|
}, label));
|
|
@@ -1117,11 +2947,6 @@ Radio.propTypes = {
|
|
|
1117
2947
|
className: PropTypes.node
|
|
1118
2948
|
};
|
|
1119
2949
|
|
|
1120
|
-
var Radio$1 = /*#__PURE__*/Object.freeze({
|
|
1121
|
-
__proto__: null,
|
|
1122
|
-
Radio: Radio
|
|
1123
|
-
});
|
|
1124
|
-
|
|
1125
2950
|
const RadioButtons = ({
|
|
1126
2951
|
onChange,
|
|
1127
2952
|
id,
|
|
@@ -1134,7 +2959,7 @@ const RadioButtons = ({
|
|
|
1134
2959
|
children,
|
|
1135
2960
|
className
|
|
1136
2961
|
}) => {
|
|
1137
|
-
return /*#__PURE__*/
|
|
2962
|
+
return /*#__PURE__*/React__default.createElement("fieldset", _extends({
|
|
1138
2963
|
className: classnames(['input', {
|
|
1139
2964
|
'js-error': error,
|
|
1140
2965
|
'input-disabled': disabled,
|
|
@@ -1143,16 +2968,16 @@ const RadioButtons = ({
|
|
|
1143
2968
|
onChange: onChange
|
|
1144
2969
|
}, hint || error ? {
|
|
1145
2970
|
'aria-describedby': [hint ? `${id}-hint` : null, error ? `${id}-error` : null].filter(Boolean).join(' ')
|
|
1146
|
-
} : null), /*#__PURE__*/
|
|
2971
|
+
} : null), /*#__PURE__*/React__default.createElement(InputLabel, {
|
|
1147
2972
|
isLegend: true,
|
|
1148
2973
|
label: label,
|
|
1149
2974
|
hint: hint,
|
|
1150
2975
|
error: error
|
|
1151
|
-
}), /*#__PURE__*/
|
|
2976
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
1152
2977
|
className: classnames(['input_control', 'radios', {
|
|
1153
2978
|
[`radios-${direction}`]: direction
|
|
1154
2979
|
}])
|
|
1155
|
-
},
|
|
2980
|
+
}, React__default.Children.map(children, child => /*#__PURE__*/React__default.isValidElement(child) ? /*#__PURE__*/React__default.cloneElement(child, {
|
|
1156
2981
|
optional,
|
|
1157
2982
|
disabled
|
|
1158
2983
|
}) : child)));
|
|
@@ -1170,18 +2995,13 @@ RadioButtons.propTypes = {
|
|
|
1170
2995
|
className: PropTypes.node
|
|
1171
2996
|
};
|
|
1172
2997
|
|
|
1173
|
-
var RadioButtons$1 = /*#__PURE__*/Object.freeze({
|
|
1174
|
-
__proto__: null,
|
|
1175
|
-
RadioButtons: RadioButtons
|
|
1176
|
-
});
|
|
1177
|
-
|
|
1178
2998
|
const SectionContent = ({
|
|
1179
2999
|
align = 'left',
|
|
1180
3000
|
className,
|
|
1181
3001
|
children,
|
|
1182
3002
|
...props
|
|
1183
3003
|
}) => {
|
|
1184
|
-
return /*#__PURE__*/
|
|
3004
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
1185
3005
|
className: classnames(['section_content', {
|
|
1186
3006
|
[`section_content-${align}`]: align
|
|
1187
3007
|
}, className])
|
|
@@ -1193,11 +3013,6 @@ SectionContent.propTypes = {
|
|
|
1193
3013
|
children: PropTypes.node.isRequired
|
|
1194
3014
|
};
|
|
1195
3015
|
|
|
1196
|
-
var SectionContent$1 = /*#__PURE__*/Object.freeze({
|
|
1197
|
-
__proto__: null,
|
|
1198
|
-
SectionContent: SectionContent
|
|
1199
|
-
});
|
|
1200
|
-
|
|
1201
3016
|
const Select = ({
|
|
1202
3017
|
onChange,
|
|
1203
3018
|
id,
|
|
@@ -1218,7 +3033,7 @@ const Select = ({
|
|
|
1218
3033
|
inputRef.current.focus();
|
|
1219
3034
|
}
|
|
1220
3035
|
}, [isFocused]);
|
|
1221
|
-
return /*#__PURE__*/
|
|
3036
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
1222
3037
|
className: classnames(['input', 'select', {
|
|
1223
3038
|
'input-focused': isFocused,
|
|
1224
3039
|
'js-error': error,
|
|
@@ -1227,12 +3042,12 @@ const Select = ({
|
|
|
1227
3042
|
'input-dense': dense
|
|
1228
3043
|
}, className]),
|
|
1229
3044
|
onChange: onChange
|
|
1230
|
-
}, /*#__PURE__*/
|
|
3045
|
+
}, /*#__PURE__*/React__default.createElement(InputLabel, {
|
|
1231
3046
|
htmlFor: id,
|
|
1232
3047
|
label: label,
|
|
1233
3048
|
hint: hint,
|
|
1234
3049
|
error: error
|
|
1235
|
-
}), /*#__PURE__*/
|
|
3050
|
+
}), /*#__PURE__*/React__default.createElement("select", _extends({
|
|
1236
3051
|
ref: inputRef,
|
|
1237
3052
|
className: 'input_control',
|
|
1238
3053
|
name: id,
|
|
@@ -1257,11 +3072,6 @@ Select.propTypes = {
|
|
|
1257
3072
|
className: PropTypes.node
|
|
1258
3073
|
};
|
|
1259
3074
|
|
|
1260
|
-
var Select$1 = /*#__PURE__*/Object.freeze({
|
|
1261
|
-
__proto__: null,
|
|
1262
|
-
Select: Select
|
|
1263
|
-
});
|
|
1264
|
-
|
|
1265
3075
|
var nnfxDark = {
|
|
1266
3076
|
"hljs": {
|
|
1267
3077
|
"display": "block",
|
|
@@ -1386,9 +3196,9 @@ const Snippet = ({
|
|
|
1386
3196
|
className,
|
|
1387
3197
|
...props
|
|
1388
3198
|
}) => {
|
|
1389
|
-
return /*#__PURE__*/
|
|
3199
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
1390
3200
|
className: classnames('snippet_wrapper')
|
|
1391
|
-
}, /*#__PURE__*/
|
|
3201
|
+
}, /*#__PURE__*/React__default.createElement(SyntaxHighlighter, _extends({
|
|
1392
3202
|
language: "javascript",
|
|
1393
3203
|
style: nnfxDark,
|
|
1394
3204
|
className: classnames(['snippet', {
|
|
@@ -1405,11 +3215,6 @@ Snippet.propTypes = {
|
|
|
1405
3215
|
className: PropTypes.node
|
|
1406
3216
|
};
|
|
1407
3217
|
|
|
1408
|
-
var Snippet$1 = /*#__PURE__*/Object.freeze({
|
|
1409
|
-
__proto__: null,
|
|
1410
|
-
Snippet: Snippet
|
|
1411
|
-
});
|
|
1412
|
-
|
|
1413
3218
|
const Status = ({
|
|
1414
3219
|
color = 'inactive',
|
|
1415
3220
|
dense,
|
|
@@ -1417,7 +3222,7 @@ const Status = ({
|
|
|
1417
3222
|
children = 'Status',
|
|
1418
3223
|
...props
|
|
1419
3224
|
}) => {
|
|
1420
|
-
return /*#__PURE__*/
|
|
3225
|
+
return /*#__PURE__*/React__default.createElement(Text, _extends({
|
|
1421
3226
|
className: classnames(['status', {
|
|
1422
3227
|
[`status-${color}`]: color,
|
|
1423
3228
|
'status-dense': dense
|
|
@@ -1431,11 +3236,6 @@ Status.propTypes = {
|
|
|
1431
3236
|
children: PropTypes.node.isRequired
|
|
1432
3237
|
};
|
|
1433
3238
|
|
|
1434
|
-
var Status$1 = /*#__PURE__*/Object.freeze({
|
|
1435
|
-
__proto__: null,
|
|
1436
|
-
Status: Status
|
|
1437
|
-
});
|
|
1438
|
-
|
|
1439
3239
|
const Switch = ({
|
|
1440
3240
|
id,
|
|
1441
3241
|
startLabel,
|
|
@@ -1444,25 +3244,25 @@ const Switch = ({
|
|
|
1444
3244
|
className,
|
|
1445
3245
|
...props
|
|
1446
3246
|
}) => {
|
|
1447
|
-
return /*#__PURE__*/
|
|
3247
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
1448
3248
|
className: classnames(['switch', {
|
|
1449
3249
|
'switch-disabled': disabled
|
|
1450
3250
|
}, className])
|
|
1451
|
-
}, startLabel ? /*#__PURE__*/
|
|
3251
|
+
}, startLabel ? /*#__PURE__*/React__default.createElement(Text, {
|
|
1452
3252
|
className: classnames('switch_label'),
|
|
1453
3253
|
variant: "body"
|
|
1454
|
-
}, startLabel) : null, /*#__PURE__*/
|
|
3254
|
+
}, startLabel) : null, /*#__PURE__*/React__default.createElement("input", _extends({
|
|
1455
3255
|
className: classnames('switch_input'),
|
|
1456
3256
|
type: "checkbox",
|
|
1457
3257
|
name: id,
|
|
1458
3258
|
id: id,
|
|
1459
3259
|
disabled: disabled
|
|
1460
|
-
}, props)), /*#__PURE__*/
|
|
3260
|
+
}, props)), /*#__PURE__*/React__default.createElement("label", {
|
|
1461
3261
|
className: classnames('switch_switch'),
|
|
1462
3262
|
htmlFor: id
|
|
1463
|
-
}, /*#__PURE__*/
|
|
3263
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
1464
3264
|
className: classnames('switch_toggle')
|
|
1465
|
-
})), endLabel ? /*#__PURE__*/
|
|
3265
|
+
})), endLabel ? /*#__PURE__*/React__default.createElement(Text, {
|
|
1466
3266
|
className: classnames('switch_label'),
|
|
1467
3267
|
variant: "body"
|
|
1468
3268
|
}, endLabel) : null);
|
|
@@ -1475,11 +3275,6 @@ Switch.propTypes = {
|
|
|
1475
3275
|
className: PropTypes.node
|
|
1476
3276
|
};
|
|
1477
3277
|
|
|
1478
|
-
var Switch$1 = /*#__PURE__*/Object.freeze({
|
|
1479
|
-
__proto__: null,
|
|
1480
|
-
Switch: Switch
|
|
1481
|
-
});
|
|
1482
|
-
|
|
1483
3278
|
const TabsContext = /*#__PURE__*/createContext();
|
|
1484
3279
|
const Tabs = ({
|
|
1485
3280
|
direction,
|
|
@@ -1489,12 +3284,12 @@ const Tabs = ({
|
|
|
1489
3284
|
children
|
|
1490
3285
|
}) => {
|
|
1491
3286
|
const [activeIndex, setActiveIndex] = useState(0);
|
|
1492
|
-
return /*#__PURE__*/
|
|
3287
|
+
return /*#__PURE__*/React__default.createElement(TabsContext.Provider, {
|
|
1493
3288
|
value: {
|
|
1494
3289
|
activeIndex,
|
|
1495
3290
|
setActiveIndex
|
|
1496
3291
|
}
|
|
1497
|
-
}, /*#__PURE__*/
|
|
3292
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
1498
3293
|
className: classnames(['tabs', {
|
|
1499
3294
|
[`tabs-${direction}`]: direction,
|
|
1500
3295
|
'tabs-dense': dense,
|
|
@@ -1510,12 +3305,6 @@ Tabs.propTypes = {
|
|
|
1510
3305
|
children: PropTypes.node.isRequired
|
|
1511
3306
|
};
|
|
1512
3307
|
|
|
1513
|
-
var Tabs$1 = /*#__PURE__*/Object.freeze({
|
|
1514
|
-
__proto__: null,
|
|
1515
|
-
Tabs: Tabs,
|
|
1516
|
-
TabsContext: TabsContext
|
|
1517
|
-
});
|
|
1518
|
-
|
|
1519
3308
|
const Tab = ({
|
|
1520
3309
|
index,
|
|
1521
3310
|
label,
|
|
@@ -1526,7 +3315,7 @@ const Tab = ({
|
|
|
1526
3315
|
setActiveIndex
|
|
1527
3316
|
} = useContext(TabsContext);
|
|
1528
3317
|
const isSelected = activeIndex === index;
|
|
1529
|
-
return /*#__PURE__*/
|
|
3318
|
+
return /*#__PURE__*/React__default.createElement("button", {
|
|
1530
3319
|
className: classnames(['tab', {
|
|
1531
3320
|
'tab-active': isSelected
|
|
1532
3321
|
}, className]),
|
|
@@ -1543,79 +3332,69 @@ Tab.propTypes = {
|
|
|
1543
3332
|
className: PropTypes.node.isRequired
|
|
1544
3333
|
};
|
|
1545
3334
|
|
|
1546
|
-
var Tab$1 = /*#__PURE__*/Object.freeze({
|
|
1547
|
-
__proto__: null,
|
|
1548
|
-
Tab: Tab
|
|
1549
|
-
});
|
|
1550
|
-
|
|
1551
3335
|
const TableFooter = ({
|
|
1552
3336
|
className,
|
|
1553
3337
|
...props
|
|
1554
3338
|
}) => {
|
|
1555
|
-
return /*#__PURE__*/
|
|
3339
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
1556
3340
|
className: classnames(['table_footer', className])
|
|
1557
|
-
}, props), /*#__PURE__*/
|
|
3341
|
+
}, props), /*#__PURE__*/React__default.createElement(Select, {
|
|
1558
3342
|
dense: true,
|
|
1559
3343
|
id: "rows",
|
|
1560
3344
|
className: "table_rowSelect"
|
|
1561
|
-
}, /*#__PURE__*/
|
|
3345
|
+
}, /*#__PURE__*/React__default.createElement("option", {
|
|
1562
3346
|
value: "1"
|
|
1563
|
-
}, "10"), /*#__PURE__*/
|
|
3347
|
+
}, "10"), /*#__PURE__*/React__default.createElement("option", {
|
|
1564
3348
|
value: "2"
|
|
1565
|
-
}, "25"), /*#__PURE__*/
|
|
3349
|
+
}, "25"), /*#__PURE__*/React__default.createElement("option", {
|
|
1566
3350
|
value: "2"
|
|
1567
|
-
}, "50"), /*#__PURE__*/
|
|
3351
|
+
}, "50"), /*#__PURE__*/React__default.createElement("option", {
|
|
1568
3352
|
value: "2"
|
|
1569
|
-
}, "100"), /*#__PURE__*/
|
|
3353
|
+
}, "100"), /*#__PURE__*/React__default.createElement("option", {
|
|
1570
3354
|
value: "2"
|
|
1571
|
-
}, "All")), /*#__PURE__*/
|
|
3355
|
+
}, "All")), /*#__PURE__*/React__default.createElement(Buttons, {
|
|
1572
3356
|
className: "table_pagination"
|
|
1573
|
-
}, /*#__PURE__*/
|
|
3357
|
+
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
1574
3358
|
kind: "icon",
|
|
1575
3359
|
variant: "transparent",
|
|
1576
3360
|
size: "sm"
|
|
1577
|
-
}, /*#__PURE__*/
|
|
3361
|
+
}, /*#__PURE__*/React__default.createElement(CaretDoubleLeft, null)), /*#__PURE__*/React__default.createElement(Button, {
|
|
1578
3362
|
kind: "icon",
|
|
1579
3363
|
variant: "transparent",
|
|
1580
3364
|
size: "sm"
|
|
1581
|
-
}, /*#__PURE__*/
|
|
3365
|
+
}, /*#__PURE__*/React__default.createElement(CaretLeft, null)), /*#__PURE__*/React__default.createElement(Button, {
|
|
1582
3366
|
kind: "icon",
|
|
1583
3367
|
size: "sm"
|
|
1584
|
-
}, "1"), /*#__PURE__*/
|
|
3368
|
+
}, "1"), /*#__PURE__*/React__default.createElement(Button, {
|
|
1585
3369
|
kind: "icon",
|
|
1586
3370
|
variant: "transparent",
|
|
1587
3371
|
size: "sm"
|
|
1588
|
-
}, "2"), /*#__PURE__*/
|
|
3372
|
+
}, "2"), /*#__PURE__*/React__default.createElement(Button, {
|
|
1589
3373
|
kind: "icon",
|
|
1590
3374
|
variant: "transparent",
|
|
1591
3375
|
size: "sm"
|
|
1592
|
-
}, "3"), /*#__PURE__*/
|
|
3376
|
+
}, "3"), /*#__PURE__*/React__default.createElement(Button, {
|
|
1593
3377
|
kind: "icon",
|
|
1594
3378
|
variant: "transparent",
|
|
1595
3379
|
size: "sm"
|
|
1596
|
-
}, "\u2026"), /*#__PURE__*/
|
|
3380
|
+
}, "\u2026"), /*#__PURE__*/React__default.createElement(Button, {
|
|
1597
3381
|
kind: "icon",
|
|
1598
3382
|
variant: "transparent",
|
|
1599
3383
|
size: "sm"
|
|
1600
|
-
}, "8"), /*#__PURE__*/
|
|
3384
|
+
}, "8"), /*#__PURE__*/React__default.createElement(Button, {
|
|
1601
3385
|
kind: "icon",
|
|
1602
3386
|
variant: "transparent",
|
|
1603
3387
|
size: "sm"
|
|
1604
|
-
}, /*#__PURE__*/
|
|
3388
|
+
}, /*#__PURE__*/React__default.createElement(CaretRight, null)), /*#__PURE__*/React__default.createElement(Button, {
|
|
1605
3389
|
kind: "icon",
|
|
1606
3390
|
variant: "transparent",
|
|
1607
3391
|
size: "sm"
|
|
1608
|
-
}, /*#__PURE__*/
|
|
3392
|
+
}, /*#__PURE__*/React__default.createElement(CaretDoubleRight, null))));
|
|
1609
3393
|
};
|
|
1610
3394
|
TableFooter.propTypes = {
|
|
1611
3395
|
className: PropTypes.node
|
|
1612
3396
|
};
|
|
1613
3397
|
|
|
1614
|
-
var TableFooter$1 = /*#__PURE__*/Object.freeze({
|
|
1615
|
-
__proto__: null,
|
|
1616
|
-
TableFooter: TableFooter
|
|
1617
|
-
});
|
|
1618
|
-
|
|
1619
3398
|
const DenseContext = /*#__PURE__*/createContext(false);
|
|
1620
3399
|
const Table = ({
|
|
1621
3400
|
striped,
|
|
@@ -1627,20 +3406,20 @@ const Table = ({
|
|
|
1627
3406
|
children,
|
|
1628
3407
|
...props
|
|
1629
3408
|
}) => {
|
|
1630
|
-
return /*#__PURE__*/
|
|
3409
|
+
return /*#__PURE__*/React__default.createElement(DenseContext.Provider, {
|
|
1631
3410
|
value: dense
|
|
1632
|
-
}, /*#__PURE__*/
|
|
3411
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
1633
3412
|
className: classnames(['table', {
|
|
1634
3413
|
'table-striped': striped,
|
|
1635
3414
|
'table-hasHover': hasHover,
|
|
1636
3415
|
'table-dense': dense,
|
|
1637
3416
|
'table-border': border
|
|
1638
3417
|
}, className])
|
|
1639
|
-
}, /*#__PURE__*/
|
|
3418
|
+
}, /*#__PURE__*/React__default.createElement("table", _extends({
|
|
1640
3419
|
cellPadding: 0,
|
|
1641
3420
|
cellSpacing: 0,
|
|
1642
3421
|
className: classnames('table_content')
|
|
1643
|
-
}, props), children), withFooter ? /*#__PURE__*/
|
|
3422
|
+
}, props), children), withFooter ? /*#__PURE__*/React__default.createElement(TableFooter, {
|
|
1644
3423
|
dense: dense ? dense : null
|
|
1645
3424
|
}) : null));
|
|
1646
3425
|
};
|
|
@@ -1654,18 +3433,12 @@ Table.propTypes = {
|
|
|
1654
3433
|
children: PropTypes.node.isRequired
|
|
1655
3434
|
};
|
|
1656
3435
|
|
|
1657
|
-
var Table$1 = /*#__PURE__*/Object.freeze({
|
|
1658
|
-
__proto__: null,
|
|
1659
|
-
DenseContext: DenseContext,
|
|
1660
|
-
Table: Table
|
|
1661
|
-
});
|
|
1662
|
-
|
|
1663
3436
|
const TableBody = ({
|
|
1664
3437
|
className,
|
|
1665
3438
|
children,
|
|
1666
3439
|
...props
|
|
1667
3440
|
}) => {
|
|
1668
|
-
return /*#__PURE__*/
|
|
3441
|
+
return /*#__PURE__*/React__default.createElement("tbody", _extends({
|
|
1669
3442
|
className: classnames(['table_body', className])
|
|
1670
3443
|
}, props), children);
|
|
1671
3444
|
};
|
|
@@ -1674,20 +3447,15 @@ TableBody.propTypes = {
|
|
|
1674
3447
|
children: PropTypes.node.isRequired
|
|
1675
3448
|
};
|
|
1676
3449
|
|
|
1677
|
-
var TableBody$1 = /*#__PURE__*/Object.freeze({
|
|
1678
|
-
__proto__: null,
|
|
1679
|
-
TableBody: TableBody
|
|
1680
|
-
});
|
|
1681
|
-
|
|
1682
3450
|
const TableCellComponentContext = /*#__PURE__*/createContext('td');
|
|
1683
3451
|
const TableHead = ({
|
|
1684
3452
|
className,
|
|
1685
3453
|
children,
|
|
1686
3454
|
...props
|
|
1687
3455
|
}) => {
|
|
1688
|
-
return /*#__PURE__*/
|
|
3456
|
+
return /*#__PURE__*/React__default.createElement(TableCellComponentContext.Provider, {
|
|
1689
3457
|
value: "th"
|
|
1690
|
-
}, /*#__PURE__*/
|
|
3458
|
+
}, /*#__PURE__*/React__default.createElement("thead", _extends({
|
|
1691
3459
|
className: classnames(['table_head', className])
|
|
1692
3460
|
}, props), children));
|
|
1693
3461
|
};
|
|
@@ -1696,12 +3464,6 @@ TableHead.propTypes = {
|
|
|
1696
3464
|
children: PropTypes.node.isRequired
|
|
1697
3465
|
};
|
|
1698
3466
|
|
|
1699
|
-
var TableHead$1 = /*#__PURE__*/Object.freeze({
|
|
1700
|
-
__proto__: null,
|
|
1701
|
-
TableCellComponentContext: TableCellComponentContext,
|
|
1702
|
-
TableHead: TableHead
|
|
1703
|
-
});
|
|
1704
|
-
|
|
1705
3467
|
const TableCell = ({
|
|
1706
3468
|
kind = 'default',
|
|
1707
3469
|
className,
|
|
@@ -1710,7 +3472,7 @@ const TableCell = ({
|
|
|
1710
3472
|
}) => {
|
|
1711
3473
|
const useTableCellComponent = () => useContext(TableCellComponentContext);
|
|
1712
3474
|
const Component = useTableCellComponent();
|
|
1713
|
-
return /*#__PURE__*/
|
|
3475
|
+
return /*#__PURE__*/React__default.createElement(Component, _extends({
|
|
1714
3476
|
className: classnames(['table_cell', {
|
|
1715
3477
|
[`table_cell-${kind}`]: kind
|
|
1716
3478
|
}, className])
|
|
@@ -1722,17 +3484,12 @@ TableCell.propTypes = {
|
|
|
1722
3484
|
children: PropTypes.node.isRequired
|
|
1723
3485
|
};
|
|
1724
3486
|
|
|
1725
|
-
var TableCell$1 = /*#__PURE__*/Object.freeze({
|
|
1726
|
-
__proto__: null,
|
|
1727
|
-
TableCell: TableCell
|
|
1728
|
-
});
|
|
1729
|
-
|
|
1730
3487
|
const TableRow = ({
|
|
1731
3488
|
className,
|
|
1732
3489
|
children,
|
|
1733
3490
|
...props
|
|
1734
3491
|
}) => {
|
|
1735
|
-
return /*#__PURE__*/
|
|
3492
|
+
return /*#__PURE__*/React__default.createElement("tr", _extends({
|
|
1736
3493
|
className: classnames(['table_row', className])
|
|
1737
3494
|
}, props), children);
|
|
1738
3495
|
};
|
|
@@ -1741,16 +3498,11 @@ TableRow.propTypes = {
|
|
|
1741
3498
|
children: PropTypes.node.isRequired
|
|
1742
3499
|
};
|
|
1743
3500
|
|
|
1744
|
-
var TableRow$1 = /*#__PURE__*/Object.freeze({
|
|
1745
|
-
__proto__: null,
|
|
1746
|
-
TableRow: TableRow
|
|
1747
|
-
});
|
|
1748
|
-
|
|
1749
3501
|
const TabsControl = ({
|
|
1750
3502
|
className,
|
|
1751
3503
|
children
|
|
1752
3504
|
}) => {
|
|
1753
|
-
return /*#__PURE__*/
|
|
3505
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
1754
3506
|
role: "tablist",
|
|
1755
3507
|
className: classnames(['tabs_controls', className])
|
|
1756
3508
|
}, children);
|
|
@@ -1760,11 +3512,6 @@ TabsControl.propTypes = {
|
|
|
1760
3512
|
children: PropTypes.node.isRequired
|
|
1761
3513
|
};
|
|
1762
3514
|
|
|
1763
|
-
var TabsControl$1 = /*#__PURE__*/Object.freeze({
|
|
1764
|
-
__proto__: null,
|
|
1765
|
-
TabsControl: TabsControl
|
|
1766
|
-
});
|
|
1767
|
-
|
|
1768
3515
|
const TabsPanel = ({
|
|
1769
3516
|
index,
|
|
1770
3517
|
className,
|
|
@@ -1774,7 +3521,7 @@ const TabsPanel = ({
|
|
|
1774
3521
|
activeIndex
|
|
1775
3522
|
} = useContext(TabsContext);
|
|
1776
3523
|
const isActive = activeIndex === index;
|
|
1777
|
-
return isActive ? /*#__PURE__*/
|
|
3524
|
+
return isActive ? /*#__PURE__*/React__default.createElement("div", {
|
|
1778
3525
|
className: classnames(['tabs_panel', className]),
|
|
1779
3526
|
role: "tabpanel",
|
|
1780
3527
|
id: `tabpanel-${index}`,
|
|
@@ -1787,11 +3534,6 @@ TabsPanel.propTypes = {
|
|
|
1787
3534
|
children: PropTypes.node.isRequired
|
|
1788
3535
|
};
|
|
1789
3536
|
|
|
1790
|
-
var TabsPanel$1 = /*#__PURE__*/Object.freeze({
|
|
1791
|
-
__proto__: null,
|
|
1792
|
-
TabsPanel: TabsPanel
|
|
1793
|
-
});
|
|
1794
|
-
|
|
1795
3537
|
const Tag = ({
|
|
1796
3538
|
color = 'primary',
|
|
1797
3539
|
dense,
|
|
@@ -1799,7 +3541,7 @@ const Tag = ({
|
|
|
1799
3541
|
children = 'Tag',
|
|
1800
3542
|
...props
|
|
1801
3543
|
}) => {
|
|
1802
|
-
return /*#__PURE__*/
|
|
3544
|
+
return /*#__PURE__*/React__default.createElement(Text, _extends({
|
|
1803
3545
|
className: classnames(['tag', {
|
|
1804
3546
|
[`tag-${color}`]: color,
|
|
1805
3547
|
'tag-dense': dense
|
|
@@ -1813,11 +3555,6 @@ Tag.propTypes = {
|
|
|
1813
3555
|
children: PropTypes.node.isRequired
|
|
1814
3556
|
};
|
|
1815
3557
|
|
|
1816
|
-
var Tag$1 = /*#__PURE__*/Object.freeze({
|
|
1817
|
-
__proto__: null,
|
|
1818
|
-
Tag: Tag
|
|
1819
|
-
});
|
|
1820
|
-
|
|
1821
3558
|
const Textarea = ({
|
|
1822
3559
|
onChange,
|
|
1823
3560
|
id,
|
|
@@ -1837,19 +3574,19 @@ const Textarea = ({
|
|
|
1837
3574
|
inputRef.current.focus();
|
|
1838
3575
|
}
|
|
1839
3576
|
}, [isFocused]);
|
|
1840
|
-
return /*#__PURE__*/
|
|
3577
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
1841
3578
|
className: classnames(['input', {
|
|
1842
3579
|
'js-error': error,
|
|
1843
3580
|
'input-disabled': disabled,
|
|
1844
3581
|
'input-optional': optional
|
|
1845
3582
|
}, className]),
|
|
1846
3583
|
onChange: onChange
|
|
1847
|
-
}, /*#__PURE__*/
|
|
3584
|
+
}, /*#__PURE__*/React__default.createElement(InputLabel, {
|
|
1848
3585
|
htmlFor: id,
|
|
1849
3586
|
label: label,
|
|
1850
3587
|
hint: hint,
|
|
1851
3588
|
error: error
|
|
1852
|
-
}), /*#__PURE__*/
|
|
3589
|
+
}), /*#__PURE__*/React__default.createElement("textarea", _extends({
|
|
1853
3590
|
ref: inputRef,
|
|
1854
3591
|
className: 'input_control',
|
|
1855
3592
|
name: id,
|
|
@@ -1875,9 +3612,4 @@ Textarea.propTypes = {
|
|
|
1875
3612
|
className: PropTypes.node
|
|
1876
3613
|
};
|
|
1877
3614
|
|
|
1878
|
-
|
|
1879
|
-
__proto__: null,
|
|
1880
|
-
Textarea: Textarea
|
|
1881
|
-
});
|
|
1882
|
-
|
|
1883
|
-
export { Alert$1 as Alert, Breadcrumbs$1 as Breadcrumbs, Button$1 as Button, Buttons$1 as Buttons, Card$1 as Card, CardActions$1 as CardActions, CardContent$1 as CardContent, CardHeader$1 as CardHeader, CardMedia$1 as CardMedia, Checkbox$1 as Checkbox, Checkboxes$1 as Checkboxes, Color$1 as Color, Display$1 as Display, Divider$1 as Divider, Grid$1 as Grid, Input$1 as Input, InputLabel$1 as InputLabel, Link$1 as Link, List$1 as List, ListItem$1 as ListItem, Nav$1 as Nav, NavBar$1 as NavBar, NavItem$1 as NavItem, Radio$1 as Radio, RadioButtons$1 as RadioButtons, Section$1 as Section, SectionContent$1 as SectionContent, SectionHeader$1 as SectionHeader, Select$1 as Select, Snippet$1 as Snippet, Status$1 as Status, Switch$1 as Switch, Tab$1 as Tab, Table$1 as Table, TableBody$1 as TableBody, TableCell$1 as TableCell, TableFooter$1 as TableFooter, TableHead$1 as TableHead, TableRow$1 as TableRow, Tabs$1 as Tabs, TabsControl$1 as TabsControl, TabsPanel$1 as TabsPanel, Tag$1 as Tag, Text$1 as Text, Textarea$1 as Textarea };
|
|
3615
|
+
export { Alert, Breadcrumbs, Button, Buttons, Card, CardActions, CardContent, CardHeader, CardMedia, Checkbox, Checkboxes, Color, Display, Divider, Grid, Input, InputLabel, Link$1 as Link, List, ListItem, Nav, NavBar, NavItem, Radio, RadioButtons, Section, SectionContent, SectionHeader, Select, Snippet, Status, Switch, Tab, Table, TableBody, TableCell, TableFooter, TableHead, TableRow, Tabs, TabsControl, TabsPanel, Tag, Text, Textarea };
|