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