inital commit

This commit is contained in:
2026-01-01 15:25:19 +05:30
commit f0ae49465a
36361 changed files with 4894111 additions and 0 deletions

60
node_modules/reactstrap/src/Accordion.js generated vendored Normal file
View File

@@ -0,0 +1,60 @@
import React, { useMemo } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
import { AccordionContext } from './AccordionContext';
const propTypes = {
children: PropTypes.node,
/** Add custom class */
className: PropTypes.string,
/** Change existing className with a new className */
cssModule: PropTypes.object,
/** Render accordions edge-to-edge with their parent container */
flush: PropTypes.bool,
innerRef: PropTypes.oneOfType([
PropTypes.object,
PropTypes.string,
PropTypes.func,
]),
/** The current active key that corresponds to the currently expanded card */
open: PropTypes.oneOfType([PropTypes.array, PropTypes.string]).isRequired,
/** Set a custom element for this component */
tag: tagPropType,
/** Function that's triggered on clicking `AccordionHeader` */
toggle: PropTypes.func.isRequired,
};
function Accordion(props) {
const {
flush,
open,
toggle,
className,
cssModule,
tag: Tag = 'div',
innerRef,
...attributes
} = props;
const classes = mapToCssModules(
classNames(className, 'accordion', {
'accordion-flush': flush,
}),
cssModule,
);
const accordionContext = useMemo(() => ({
open,
toggle,
}));
return (
<AccordionContext.Provider value={accordionContext}>
<Tag {...attributes} className={classes} ref={innerRef} />
</AccordionContext.Provider>
);
}
Accordion.propTypes = propTypes;
export default Accordion;

60
node_modules/reactstrap/src/AccordionBody.js generated vendored Normal file
View File

@@ -0,0 +1,60 @@
import React, { useContext } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
import Collapse from './Collapse';
import { AccordionContext } from './AccordionContext';
const propTypes = {
/** Unique key used to control item's collapse/expand */
accordionId: PropTypes.string.isRequired,
/** To add custom class */
className: PropTypes.string,
children: PropTypes.node,
/** Change existing base class name with a new class name */
cssModule: PropTypes.object,
/** Pass ref to the component */
innerRef: PropTypes.oneOfType([
PropTypes.object,
PropTypes.string,
PropTypes.func,
]),
/** Set a custom element for this component */
tag: tagPropType,
};
function AccordionBody(props) {
const {
className,
cssModule,
tag: Tag = 'div',
innerRef,
children,
accordionId,
...attributes
} = props;
const { open } = useContext(AccordionContext);
const classes = mapToCssModules(
classNames(className, 'accordion-collapse'),
cssModule,
);
return (
<Collapse
{...attributes}
className={classes}
ref={innerRef}
isOpen={
Array.isArray(open) ? open.includes(accordionId) : open === accordionId
}
>
<Tag className="accordion-body">{children}</Tag>
</Collapse>
);
}
AccordionBody.propTypes = propTypes;
export default AccordionBody;

10
node_modules/reactstrap/src/AccordionContext.js generated vendored Normal file
View File

@@ -0,0 +1,10 @@
import React from 'react';
/**
* AccordionContext
* {
* toggle: PropTypes.func.isRequired,
* openId: PropTypes.string,
* }
*/
export const AccordionContext = React.createContext({});

65
node_modules/reactstrap/src/AccordionHeader.js generated vendored Normal file
View File

@@ -0,0 +1,65 @@
import React, { useContext } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
import { AccordionContext } from './AccordionContext';
const propTypes = {
children: PropTypes.node,
/** Add custom class */
className: PropTypes.string,
/** Change existing base class name with a new class name */
cssModule: PropTypes.object,
innerRef: PropTypes.oneOfType([
PropTypes.object,
PropTypes.string,
PropTypes.func,
]),
/** Set a custom element for this component */
tag: tagPropType,
/** Unique key used to control item's collapse/expand */
targetId: PropTypes.string.isRequired,
};
function AccordionHeader(props) {
const {
className,
cssModule,
tag: Tag = 'h2',
innerRef,
children,
targetId,
...attributes
} = props;
const { open, toggle } = useContext(AccordionContext);
const classes = mapToCssModules(
classNames(className, 'accordion-header'),
cssModule,
);
const buttonClasses = mapToCssModules(
classNames('accordion-button', {
collapsed: !(Array.isArray(open)
? open.includes(targetId)
: open === targetId),
}),
cssModule,
);
return (
<Tag {...attributes} className={classes} ref={innerRef}>
<button
type="button"
className={buttonClasses}
onClick={() => toggle(targetId)}
>
{children}
</button>
</Tag>
);
}
AccordionHeader.propTypes = propTypes;
export default AccordionHeader;

39
node_modules/reactstrap/src/AccordionItem.js generated vendored Normal file
View File

@@ -0,0 +1,39 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
children: PropTypes.node,
/** To add custom class */
className: PropTypes.string,
/** Change existing base class name with a new class name */
cssModule: PropTypes.object,
innerRef: PropTypes.oneOfType([
PropTypes.object,
PropTypes.string,
PropTypes.func,
]),
/** Set a custom element for this component */
tag: tagPropType,
};
function AccordionItem(props) {
const {
className,
cssModule,
tag: Tag = 'div',
innerRef,
...attributes
} = props;
const classes = mapToCssModules(
classNames(className, 'accordion-item'),
cssModule,
);
return <Tag {...attributes} className={classes} ref={innerRef} />;
}
AccordionItem.propTypes = propTypes;
export default AccordionItem;

101
node_modules/reactstrap/src/Alert.js generated vendored Normal file
View File

@@ -0,0 +1,101 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
import Fade from './Fade';
const propTypes = {
/** Pass children so this component can wrap the child elements */
children: PropTypes.node,
/** Add custom class */
className: PropTypes.string,
/** Add custom class for close button */
closeClassName: PropTypes.string,
/** Aria label for close button */
closeAriaLabel: PropTypes.string,
/** Change color of alert */
color: PropTypes.string,
/** Change existing className with a new className */
cssModule: PropTypes.object,
/** Toggle fade animation */
fade: PropTypes.bool,
innerRef: PropTypes.oneOfType([
PropTypes.object,
PropTypes.string,
PropTypes.func,
]),
/** Control visibility state of Alert */
isOpen: PropTypes.bool,
/** Set a custom element for this component */
tag: tagPropType,
/** Function to toggle visibility */
toggle: PropTypes.func,
/** Props to be passed to `Fade` to modify transition */
transition: PropTypes.shape(Fade.propTypes),
};
function Alert(props) {
const {
className,
closeClassName,
closeAriaLabel = 'Close',
cssModule,
tag: Tag = 'div',
color = 'success',
isOpen = true,
toggle,
children,
transition = {
...Fade.defaultProps,
unmountOnExit: true,
},
fade = true,
innerRef,
...attributes
} = props;
const classes = mapToCssModules(
classNames(className, 'alert', `alert-${color}`, {
'alert-dismissible': toggle,
}),
cssModule,
);
const closeClasses = mapToCssModules(
classNames('btn-close', closeClassName),
cssModule,
);
const alertTransition = {
...Fade.defaultProps,
...transition,
baseClass: fade ? transition.baseClass : '',
timeout: fade ? transition.timeout : 0,
};
return (
<Fade
{...attributes}
{...alertTransition}
tag={Tag}
className={classes}
in={isOpen}
role="alert"
innerRef={innerRef}
>
{toggle ? (
<button
type="button"
className={closeClasses}
aria-label={closeAriaLabel}
onClick={toggle}
/>
) : null}
{children}
</Fade>
);
}
Alert.propTypes = propTypes;
export default Alert;

56
node_modules/reactstrap/src/Badge.js generated vendored Normal file
View File

@@ -0,0 +1,56 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
/** Pass children so this component can wrap the child elements */
children: PropTypes.node,
/** Add custom class */
className: PropTypes.string,
/** Change background color of Badge */
color: PropTypes.string,
/** Change existing className with a new className */
cssModule: PropTypes.object,
innerRef: PropTypes.oneOfType([
PropTypes.object,
PropTypes.func,
PropTypes.string,
]),
/** Add rounded corners to the Badge */
pill: PropTypes.bool,
/** Set a custom element for this component */
tag: tagPropType,
};
function Badge(props) {
let {
className,
cssModule,
color = 'secondary',
innerRef,
pill = false,
tag: Tag = 'span',
...attributes
} = props;
const classes = mapToCssModules(
classNames(
className,
'badge',
'bg-' + color,
pill ? 'rounded-pill' : false,
),
cssModule,
);
if (attributes.href && Tag === 'span') {
Tag = 'a';
}
return <Tag {...attributes} className={classes} ref={innerRef} />;
}
Badge.propTypes = propTypes;
export default Badge;

51
node_modules/reactstrap/src/Breadcrumb.js generated vendored Normal file
View File

@@ -0,0 +1,51 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
/** Aria label */
'aria-label': PropTypes.string,
/** Pass children so this component can wrap them */
children: PropTypes.node,
/** Add custom class */
className: PropTypes.string,
/** Change existing className with a new className */
cssModule: PropTypes.object,
/** Add custom class to list tag */
listClassName: PropTypes.string,
/** Set a custom element for list tag */
listTag: tagPropType,
/** Set a custom element for this component */
tag: tagPropType,
};
function Breadcrumb(props) {
const {
className,
listClassName,
cssModule,
children,
tag: Tag = 'nav',
listTag: ListTag = 'ol',
'aria-label': label = 'breadcrumb',
...attributes
} = props;
const classes = mapToCssModules(classNames(className), cssModule);
const listClasses = mapToCssModules(
classNames('breadcrumb', listClassName),
cssModule,
);
return (
<Tag {...attributes} className={classes} aria-label={label}>
<ListTag className={listClasses}>{children}</ListTag>
</Tag>
);
}
Breadcrumb.propTypes = propTypes;
export default Breadcrumb;

41
node_modules/reactstrap/src/BreadcrumbItem.js generated vendored Normal file
View File

@@ -0,0 +1,41 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
/** Adds a visual "active" state to a Breadcrumb Item */
active: PropTypes.bool,
/** Add custom class to the element */
className: PropTypes.string,
/** Change existing className with a new className */
cssModule: PropTypes.object,
/** Set a custom element for this component */
tag: tagPropType,
};
function BreadcrumbItem(props) {
const {
className,
cssModule,
active,
tag: Tag = 'li',
...attributes
} = props;
const classes = mapToCssModules(
classNames(className, active ? 'active' : false, 'breadcrumb-item'),
cssModule,
);
return (
<Tag
{...attributes}
className={classes}
aria-current={active ? 'page' : undefined}
/>
);
}
BreadcrumbItem.propTypes = propTypes;
export default BreadcrumbItem;

106
node_modules/reactstrap/src/Button.js generated vendored Normal file
View File

@@ -0,0 +1,106 @@
import React, { useCallback } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
import CloseButton from './CloseButton';
const propTypes = {
/** Manually set the visual state of the button to active */
active: PropTypes.bool,
/** Aria label */
'aria-label': PropTypes.string,
block: PropTypes.bool,
/** Pass children so this component can wrap them */
children: PropTypes.node,
/** Add custom class */
className: PropTypes.string,
/** Change existing className with a new className */
cssModule: PropTypes.object,
/** Use the button as a close button */
close: PropTypes.bool,
/** Change color of Button to one of the available colors */
color: PropTypes.string,
/** Disables the button */
disabled: PropTypes.bool,
innerRef: PropTypes.oneOfType([
PropTypes.object,
PropTypes.func,
PropTypes.string,
]),
/** Function to be triggered on click */
onClick: PropTypes.func,
/** Adds outline to the button */
outline: PropTypes.bool,
/** Make the button bigger or smaller */
size: PropTypes.string,
/** Set a custom element for this component */
tag: tagPropType,
};
function Button(props) {
const onClick = useCallback(
(e) => {
if (props.disabled) {
e.preventDefault();
return;
}
if (props.onClick) {
return props.onClick(e);
}
},
[props.onClick, props.disabled],
);
let {
active,
'aria-label': ariaLabel,
block,
className,
close,
cssModule,
color = 'secondary',
outline,
size,
tag: Tag = 'button',
innerRef,
...attributes
} = props;
if (close) {
return <CloseButton {...attributes} />;
}
const btnOutlineColor = `btn${outline ? '-outline' : ''}-${color}`;
const classes = mapToCssModules(
classNames(
className,
'btn',
btnOutlineColor,
size ? `btn-${size}` : false,
block ? 'd-block w-100' : false,
{ active, disabled: props.disabled },
),
cssModule,
);
if (attributes.href && Tag === 'button') {
Tag = 'a';
}
return (
<Tag
type={Tag === 'button' && attributes.onClick ? 'button' : undefined}
{...attributes}
className={classes}
ref={innerRef}
onClick={onClick}
aria-label={ariaLabel}
/>
);
}
Button.propTypes = propTypes;
export default Button;

15
node_modules/reactstrap/src/ButtonDropdown.js generated vendored Normal file
View File

@@ -0,0 +1,15 @@
import React from 'react';
import PropTypes from 'prop-types';
import Dropdown from './Dropdown';
const propTypes = {
children: PropTypes.node,
};
function ButtonDropdown(props) {
return <Dropdown group {...props} />;
}
ButtonDropdown.propTypes = propTypes;
export default ButtonDropdown;

47
node_modules/reactstrap/src/ButtonGroup.js generated vendored Normal file
View File

@@ -0,0 +1,47 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
/** Aria label */
'aria-label': PropTypes.string,
/** Add custom class */
className: PropTypes.string,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
/** In order for assistive technologies (such as screen readers) to convey that a series of buttons is grouped, an appropriate role attribute needs to be provided. For button groups, this would be role="group", while toolbars should have a role="toolbar". */
role: PropTypes.string,
/** Make the button bigger or smaller */
size: PropTypes.string,
/** Set a custom element for this component */
tag: tagPropType,
/** Make button group vertical */
vertical: PropTypes.bool,
};
function ButtonGroup(props) {
const {
className,
cssModule,
size,
vertical,
tag: Tag = 'div',
...attributes
} = props;
const classes = mapToCssModules(
classNames(
className,
size ? 'btn-group-' + size : false,
vertical ? 'btn-group-vertical' : 'btn-group',
),
cssModule,
);
return <Tag {...{ role: 'group', ...attributes }} className={classes} />;
}
ButtonGroup.propTypes = propTypes;
export default ButtonGroup;

73
node_modules/reactstrap/src/ButtonToggle.js generated vendored Normal file
View File

@@ -0,0 +1,73 @@
import React, { useCallback, useState } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import Button from './Button';
import { mapToCssModules } from './utils';
const propTypes = {
onClick: PropTypes.func,
onBlur: PropTypes.func,
onFocus: PropTypes.func,
defaultValue: PropTypes.bool,
className: PropTypes.string,
cssModule: PropTypes.object,
};
function ButtonToggle(props) {
const [toggled, setToggled] = useState(props.defaultValue ?? false);
const [focus, setFocus] = useState(false);
const onBlur = useCallback(
(e) => {
if (props.onBlur) {
props.onBlur(e);
}
setFocus(false);
},
[props.onBlur],
);
const onFocus = useCallback(
(e) => {
if (props.onFocus) {
props.onFocus(e);
}
setFocus(true);
},
[props.onFocus],
);
const onClick = useCallback(
(e) => {
if (props.onClick) {
props.onClick(e);
}
setToggled(!toggled);
},
[props.onClick],
);
const { className, ...attributes } = props;
const classes = mapToCssModules(
classNames(className, {
focus: focus,
}),
props.cssModule,
);
return (
<Button
active={toggled}
onBlur={onBlur}
onFocus={onFocus}
onClick={onClick}
className={classes}
{...attributes}
/>
);
}
ButtonToggle.propTypes = propTypes;
export default ButtonToggle;

32
node_modules/reactstrap/src/ButtonToolbar.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
/** Aria label */
'aria-label': PropTypes.string,
/** Add custom class */
className: PropTypes.string,
/** Change existing className with a new className */
cssModule: PropTypes.object,
/** In order for assistive technologies (such as screen readers) to convey that a series of buttons is grouped, an appropriate role attribute needs to be provided. For button groups, this would be role="group", while toolbars should have a role="toolbar". */
role: PropTypes.string,
/** Set a custom element for this component */
tag: tagPropType,
};
function ButtonToolbar(props) {
const { className, cssModule, tag: Tag = 'div', ...attributes } = props;
const classes = mapToCssModules(
classNames(className, 'btn-toolbar'),
cssModule,
);
return <Tag {...{ role: 'toolbar', ...attributes }} className={classes} />;
}
ButtonToolbar.propTypes = propTypes;
export default ButtonToolbar;

56
node_modules/reactstrap/src/Card.js generated vendored Normal file
View File

@@ -0,0 +1,56 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
/** Toggles card padding using `.card-body` */
body: PropTypes.bool,
/** Add custom class */
className: PropTypes.string,
/** Change background color of component */
color: PropTypes.string,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
innerRef: PropTypes.oneOfType([
PropTypes.object,
PropTypes.string,
PropTypes.func,
]),
/** Inverts the color */
inverse: PropTypes.bool,
/** Changes the card to have only outline */
outline: PropTypes.bool,
/** Set a custom element for this component */
tag: tagPropType,
};
function Card(props) {
const {
className,
cssModule,
color,
body,
inverse,
outline,
tag: Tag = 'div',
innerRef,
...attributes
} = props;
const classes = mapToCssModules(
classNames(
className,
'card',
inverse ? 'text-white' : false,
body ? 'card-body' : false,
color ? `${outline ? 'border' : 'bg'}-${color}` : false,
),
cssModule,
);
return <Tag {...attributes} className={classes} ref={innerRef} />;
}
Card.propTypes = propTypes;
export default Card;

38
node_modules/reactstrap/src/CardBody.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
/** Add custom class */
className: PropTypes.string,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
innerRef: PropTypes.oneOfType([
PropTypes.object,
PropTypes.string,
PropTypes.func,
]),
/** Set a custom element for this component */
tag: tagPropType,
};
function CardBody(props) {
const {
className,
cssModule,
innerRef,
tag: Tag = 'div',
...attributes
} = props;
const classes = mapToCssModules(
classNames(className, 'card-body'),
cssModule,
);
return <Tag {...attributes} className={classes} ref={innerRef} />;
}
CardBody.propTypes = propTypes;
export default CardBody;

24
node_modules/reactstrap/src/CardColumns.js generated vendored Normal file
View File

@@ -0,0 +1,24 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
tag: tagPropType,
className: PropTypes.string,
cssModule: PropTypes.object,
};
function CardColumns(props) {
const { className, cssModule, tag: Tag = 'div', ...attributes } = props;
const classes = mapToCssModules(
classNames(className, 'card-columns'),
cssModule,
);
return <Tag {...attributes} className={classes} />;
}
CardColumns.propTypes = propTypes;
export default CardColumns;

24
node_modules/reactstrap/src/CardDeck.js generated vendored Normal file
View File

@@ -0,0 +1,24 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
tag: tagPropType,
className: PropTypes.string,
cssModule: PropTypes.object,
};
function CardDeck(props) {
const { className, cssModule, tag: Tag = 'div', ...attributes } = props;
const classes = mapToCssModules(
classNames(className, 'card-deck'),
cssModule,
);
return <Tag {...attributes} className={classes} />;
}
CardDeck.propTypes = propTypes;
export default CardDeck;

27
node_modules/reactstrap/src/CardFooter.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
/** Add custom class */
className: PropTypes.string,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
/** Set a custom element for this component */
tag: tagPropType,
};
function CardFooter(props) {
const { className, cssModule, tag: Tag = 'div', ...attributes } = props;
const classes = mapToCssModules(
classNames(className, 'card-footer'),
cssModule,
);
return <Tag {...attributes} className={classes} />;
}
CardFooter.propTypes = propTypes;
export default CardFooter;

24
node_modules/reactstrap/src/CardGroup.js generated vendored Normal file
View File

@@ -0,0 +1,24 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
tag: tagPropType,
className: PropTypes.string,
cssModule: PropTypes.object,
};
function CardGroup(props) {
const { className, cssModule, tag: Tag = 'div', ...attributes } = props;
const classes = mapToCssModules(
classNames(className, 'card-group'),
cssModule,
);
return <Tag {...attributes} className={classes} />;
}
CardGroup.propTypes = propTypes;
export default CardGroup;

27
node_modules/reactstrap/src/CardHeader.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
/** Add custom class */
className: PropTypes.string,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
/** Set a custom element for this component */
tag: tagPropType,
};
function CardHeader(props) {
const { className, cssModule, tag: Tag = 'div', ...attributes } = props;
const classes = mapToCssModules(
classNames(className, 'card-header'),
cssModule,
);
return <Tag {...attributes} className={classes} />;
}
CardHeader.propTypes = propTypes;
export default CardHeader;

47
node_modules/reactstrap/src/CardImg.js generated vendored Normal file
View File

@@ -0,0 +1,47 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
/** Add `bottom` prop if image is at bottom of card */
bottom: PropTypes.bool,
/** Add custom class */
className: PropTypes.string,
/** Change existing className with a new className */
cssModule: PropTypes.object,
/** Set a custom element for this component */
tag: tagPropType,
/** Add `top` prop if image is at top of card */
top: PropTypes.bool,
};
function CardImg(props) {
const {
className,
cssModule,
top,
bottom,
tag: Tag = 'img',
...attributes
} = props;
let cardImgClassName = 'card-img';
if (top) {
cardImgClassName = 'card-img-top';
}
if (bottom) {
cardImgClassName = 'card-img-bottom';
}
const classes = mapToCssModules(
classNames(className, cardImgClassName),
cssModule,
);
return <Tag {...attributes} className={classes} />;
}
CardImg.propTypes = propTypes;
export default CardImg;

24
node_modules/reactstrap/src/CardImgOverlay.js generated vendored Normal file
View File

@@ -0,0 +1,24 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
tag: tagPropType,
className: PropTypes.string,
cssModule: PropTypes.object,
};
function CardImgOverlay(props) {
const { className, cssModule, tag: Tag = 'div', ...attributes } = props;
const classes = mapToCssModules(
classNames(className, 'card-img-overlay'),
cssModule,
);
return <Tag {...attributes} className={classes} />;
}
CardImgOverlay.propTypes = propTypes;
export default CardImgOverlay;

35
node_modules/reactstrap/src/CardLink.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
tag: tagPropType,
innerRef: PropTypes.oneOfType([
PropTypes.object,
PropTypes.func,
PropTypes.string,
]),
className: PropTypes.string,
cssModule: PropTypes.object,
};
function CardLink(props) {
const {
className,
cssModule,
tag: Tag = 'a',
innerRef,
...attributes
} = props;
const classes = mapToCssModules(
classNames(className, 'card-link'),
cssModule,
);
return <Tag {...attributes} ref={innerRef} className={classes} />;
}
CardLink.propTypes = propTypes;
export default CardLink;

27
node_modules/reactstrap/src/CardSubtitle.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
/** Add custom class */
className: PropTypes.string,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
/** Set a custom element for this component */
tag: tagPropType,
};
function CardSubtitle(props) {
const { className, cssModule, tag: Tag = 'div', ...attributes } = props;
const classes = mapToCssModules(
classNames(className, 'card-subtitle'),
cssModule,
);
return <Tag {...attributes} className={classes} />;
}
CardSubtitle.propTypes = propTypes;
export default CardSubtitle;

27
node_modules/reactstrap/src/CardText.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
/** Add custom class */
className: PropTypes.string,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
/** Set a custom element for this component */
tag: tagPropType,
};
function CardText(props) {
const { className, cssModule, tag: Tag = 'p', ...attributes } = props;
const classes = mapToCssModules(
classNames(className, 'card-text'),
cssModule,
);
return <Tag {...attributes} className={classes} />;
}
CardText.propTypes = propTypes;
export default CardText;

27
node_modules/reactstrap/src/CardTitle.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
/** Add custom class */
className: PropTypes.string,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
/** Set a custom element for this component */
tag: tagPropType,
};
function CardTitle(props) {
const { className, cssModule, tag: Tag = 'div', ...attributes } = props;
const classes = mapToCssModules(
classNames(className, 'card-title'),
cssModule,
);
return <Tag {...attributes} className={classes} />;
}
CardTitle.propTypes = propTypes;
export default CardTitle;

323
node_modules/reactstrap/src/Carousel.js generated vendored Normal file
View File

@@ -0,0 +1,323 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import CarouselItem from './CarouselItem';
import { CarouselContext } from './CarouselContext';
import { mapToCssModules, omit } from './utils';
const SWIPE_THRESHOLD = 40;
const propTypes = {
/** the current active slide of the carousel */
activeIndex: PropTypes.number,
/** a function which should advance the carousel to the next slide (via activeIndex) */
next: PropTypes.func.isRequired,
/** a function which should advance the carousel to the previous slide (via activeIndex) */
previous: PropTypes.func.isRequired,
/** controls if the left and right arrow keys should control the carousel */
keyboard: PropTypes.bool,
/** If set to "hover", pauses the cycling of the carousel on mouseenter and resumes the cycling of the carousel on
* mouseleave. If set to false, hovering over the carousel won't pause it.
*/
pause: PropTypes.oneOf(['hover', false]),
/** Autoplays the carousel after the user manually cycles the first item. If "carousel", autoplays the carousel on load. */
ride: PropTypes.oneOf(['carousel']),
/** the interval at which the carousel automatically cycles */
interval: PropTypes.oneOfType([
PropTypes.number,
PropTypes.string,
PropTypes.bool,
]),
children: PropTypes.array,
/** called when the mouse enters the Carousel */
mouseEnter: PropTypes.func,
/** called when the mouse exits the Carousel */
mouseLeave: PropTypes.func,
/** controls whether the slide animation on the Carousel works or not */
slide: PropTypes.bool,
/** make the controls, indicators and captions dark on the Carousel */
dark: PropTypes.bool,
fade: PropTypes.bool,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
/** Add custom class */
className: PropTypes.string,
/** Enable touch support */
enableTouch: PropTypes.bool,
};
const propsToOmit = Object.keys(propTypes);
const defaultProps = {
interval: 5000,
pause: 'hover',
keyboard: true,
slide: true,
enableTouch: true,
fade: false,
};
class Carousel extends React.Component {
constructor(props) {
super(props);
this.handleKeyPress = this.handleKeyPress.bind(this);
this.renderItems = this.renderItems.bind(this);
this.hoverStart = this.hoverStart.bind(this);
this.hoverEnd = this.hoverEnd.bind(this);
this.handleTouchStart = this.handleTouchStart.bind(this);
this.handleTouchEnd = this.handleTouchEnd.bind(this);
this.touchStartX = 0;
this.touchStartY = 0;
this.state = {
activeIndex: this.props.activeIndex,
direction: 'end',
indicatorClicked: false,
};
}
componentDidMount() {
// Set up the cycle
if (this.props.ride === 'carousel') {
this.setInterval();
}
// TODO: move this to the specific carousel like bootstrap. Currently it will trigger ALL carousels on the page.
document.addEventListener('keyup', this.handleKeyPress);
}
static getDerivedStateFromProps(nextProps, prevState) {
let newState = null;
let { activeIndex, direction, indicatorClicked } = prevState;
if (nextProps.activeIndex !== activeIndex) {
// Calculate the direction to turn
if (nextProps.activeIndex === activeIndex + 1) {
direction = 'end';
} else if (nextProps.activeIndex === activeIndex - 1) {
direction = 'start';
} else if (nextProps.activeIndex < activeIndex) {
direction = indicatorClicked ? 'start' : 'end';
} else if (nextProps.activeIndex !== activeIndex) {
direction = indicatorClicked ? 'end' : 'start';
}
newState = {
activeIndex: nextProps.activeIndex,
direction,
indicatorClicked: false,
};
}
return newState;
}
componentDidUpdate(prevProps, prevState) {
if (prevState.activeIndex === this.state.activeIndex) return;
this.setInterval();
}
componentWillUnmount() {
this.clearInterval();
document.removeEventListener('keyup', this.handleKeyPress);
}
handleKeyPress(evt) {
if (this.props.keyboard) {
if (evt.keyCode === 37) {
this.props.previous();
} else if (evt.keyCode === 39) {
this.props.next();
}
}
}
handleTouchStart(e) {
if (!this.props.enableTouch) {
return;
}
this.touchStartX = e.changedTouches[0].screenX;
this.touchStartY = e.changedTouches[0].screenY;
}
handleTouchEnd(e) {
if (!this.props.enableTouch) {
return;
}
const currentX = e.changedTouches[0].screenX;
const currentY = e.changedTouches[0].screenY;
const diffX = Math.abs(this.touchStartX - currentX);
const diffY = Math.abs(this.touchStartY - currentY);
// Don't swipe if Y-movement is bigger than X-movement
if (diffX < diffY) {
return;
}
if (diffX < SWIPE_THRESHOLD) {
return;
}
if (currentX < this.touchStartX) {
this.props.next();
} else {
this.props.previous();
}
}
getContextValue() {
return { direction: this.state.direction };
}
setInterval() {
// make sure not to have multiple intervals going...
this.clearInterval();
if (this.props.interval) {
this.cycleInterval = setInterval(() => {
this.props.next();
}, parseInt(this.props.interval, 10));
}
}
clearInterval() {
clearInterval(this.cycleInterval);
}
hoverStart(...args) {
if (this.props.pause === 'hover') {
this.clearInterval();
}
if (this.props.mouseEnter) {
this.props.mouseEnter(...args);
}
}
hoverEnd(...args) {
if (this.props.pause === 'hover') {
this.setInterval();
}
if (this.props.mouseLeave) {
this.props.mouseLeave(...args);
}
}
renderItems(carouselItems, className) {
const { slide } = this.props;
return (
<div className={className}>
{carouselItems.map((item, index) => {
const isIn = index === this.state.activeIndex;
return React.cloneElement(item, {
in: isIn,
slide: slide,
});
})}
</div>
);
}
render() {
const { cssModule, slide, className, dark, fade } = this.props;
const attributes = omit(this.props, propsToOmit);
const outerClasses = mapToCssModules(
classNames(
className,
'carousel',
fade && 'carousel-fade',
slide && 'slide',
dark && 'carousel-dark',
),
cssModule,
);
const innerClasses = mapToCssModules(
classNames('carousel-inner'),
cssModule,
);
// filter out booleans, null, or undefined
const children = this.props.children.filter(
(child) =>
child !== null && child !== undefined && typeof child !== 'boolean',
);
const slidesOnly = children.every((child) => child.type === CarouselItem);
// Rendering only slides
if (slidesOnly) {
return (
<div
{...attributes}
className={outerClasses}
onMouseEnter={this.hoverStart}
onMouseLeave={this.hoverEnd}
>
<CarouselContext.Provider value={this.getContextValue()}>
{this.renderItems(children, innerClasses)}
</CarouselContext.Provider>
</div>
);
}
// Rendering slides and controls
if (children[0] instanceof Array) {
const carouselItems = children[0];
const controlLeft = children[1];
const controlRight = children[2];
return (
<div
{...attributes}
className={outerClasses}
onMouseEnter={this.hoverStart}
onMouseLeave={this.hoverEnd}
>
<CarouselContext.Provider value={this.getContextValue()}>
{this.renderItems(carouselItems, innerClasses)}
{controlLeft}
{controlRight}
</CarouselContext.Provider>
</div>
);
}
// Rendering indicators, slides and controls
const indicators = children[0];
const wrappedOnClick = (e) => {
if (typeof indicators.props.onClickHandler === 'function') {
this.setState({ indicatorClicked: true }, () =>
indicators.props.onClickHandler(e),
);
}
};
const wrappedIndicators = React.cloneElement(indicators, {
onClickHandler: wrappedOnClick,
});
const carouselItems = children[1];
const controlLeft = children[2];
const controlRight = children[3];
return (
<div
{...attributes}
className={outerClasses}
onMouseEnter={this.hoverStart}
onMouseLeave={this.hoverEnd}
onTouchStart={this.handleTouchStart}
onTouchEnd={this.handleTouchEnd}
>
<CarouselContext.Provider value={this.getContextValue()}>
{wrappedIndicators}
{this.renderItems(carouselItems, innerClasses)}
{controlLeft}
{controlRight}
</CarouselContext.Provider>
</div>
);
}
}
Carousel.propTypes = propTypes;
Carousel.defaultProps = defaultProps;
export default Carousel;

32
node_modules/reactstrap/src/CarouselCaption.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules } from './utils';
function CarouselCaption(props) {
const { captionHeader, captionText, cssModule, className } = props;
const classes = mapToCssModules(
classNames(className, 'carousel-caption', 'd-none', 'd-md-block'),
cssModule,
);
return (
<div className={classes}>
<h3>{captionHeader}</h3>
<p>{captionText}</p>
</div>
);
}
CarouselCaption.propTypes = {
/** Heading for the caption */
captionHeader: PropTypes.node,
/** Text for caption */
captionText: PropTypes.node.isRequired,
/** Add custom class */
className: PropTypes.string,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
};
export default CarouselCaption;

9
node_modules/reactstrap/src/CarouselContext.js generated vendored Normal file
View File

@@ -0,0 +1,9 @@
import React from 'react';
/**
* CarouselContext
* {
* direction: PropTypes.oneOf(['start', 'end']).isRequired,
* }
*/
export const CarouselContext = React.createContext({});

66
node_modules/reactstrap/src/CarouselControl.js generated vendored Normal file
View File

@@ -0,0 +1,66 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules } from './utils';
function CarouselControl(props) {
const {
direction,
onClickHandler,
cssModule,
directionText,
className,
...attributes
} = props;
const anchorClasses = mapToCssModules(
classNames(className, `carousel-control-${direction}`),
cssModule,
);
const iconClasses = mapToCssModules(
classNames(`carousel-control-${direction}-icon`),
cssModule,
);
const screenReaderClasses = mapToCssModules(
classNames('visually-hidden'),
cssModule,
);
return (
// We need to disable this linting rule to use an `<a>` instead of
// `<button>` because that's what the Bootstrap examples require:
// https://getbootstrap.com/docs/4.5/components/carousel/#with-controls
// eslint-disable-next-line jsx-a11y/anchor-is-valid
<a
{...attributes}
className={anchorClasses}
style={{ cursor: 'pointer' }}
role="button"
tabIndex="0"
onClick={(e) => {
e.preventDefault();
onClickHandler();
}}
>
<span className={iconClasses} aria-hidden="true" />
<span className={screenReaderClasses}>{directionText || direction}</span>
</a>
);
}
CarouselControl.propTypes = {
/** Set the direction of control button */
direction: PropTypes.oneOf(['prev', 'next']).isRequired,
/** Function to be triggered on click */
onClickHandler: PropTypes.func.isRequired,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
/** Screen reader text */
directionText: PropTypes.string,
/** Add custom class */
className: PropTypes.string,
};
export default CarouselControl;

60
node_modules/reactstrap/src/CarouselIndicators.js generated vendored Normal file
View File

@@ -0,0 +1,60 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules } from './utils';
function CarouselIndicators(props) {
const {
items,
activeIndex,
cssModule,
onClickHandler,
className,
...attributes
} = props;
const listClasses = mapToCssModules(
classNames(className, 'carousel-indicators'),
cssModule,
);
const indicators = items.map((item, idx) => {
const indicatorClasses = mapToCssModules(
classNames({ active: activeIndex === idx }),
cssModule,
);
return (
<button
aria-label={item.caption}
data-bs-target
type="button"
key={`${item.key || Object.values(item).join('')}`}
onClick={(e) => {
e.preventDefault();
onClickHandler(idx);
}}
className={indicatorClasses}
/>
);
});
return (
<div className={listClasses} {...attributes}>
{indicators}
</div>
);
}
CarouselIndicators.propTypes = {
/** The current active index */
activeIndex: PropTypes.number.isRequired,
/** Add custom class */
className: PropTypes.string,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
/** Array of items to show */
items: PropTypes.array.isRequired,
/** Function to be triggered on click */
onClickHandler: PropTypes.func.isRequired,
};
export default CarouselIndicators;

132
node_modules/reactstrap/src/CarouselItem.js generated vendored Normal file
View File

@@ -0,0 +1,132 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { Transition } from 'react-transition-group';
import { CarouselContext } from './CarouselContext';
import {
mapToCssModules,
TransitionTimeouts,
TransitionStatuses,
tagPropType,
} from './utils';
class CarouselItem extends React.Component {
constructor(props) {
super(props);
this.state = {
startAnimation: false,
};
this.onEnter = this.onEnter.bind(this);
this.onEntering = this.onEntering.bind(this);
this.onExit = this.onExit.bind(this);
this.onExiting = this.onExiting.bind(this);
this.onExited = this.onExited.bind(this);
}
onEnter(node, isAppearing) {
this.setState({ startAnimation: false });
this.props.onEnter(node, isAppearing);
}
onEntering(node, isAppearing) {
// getting this variable triggers a reflow
const { offsetHeight } = node;
this.setState({ startAnimation: true });
this.props.onEntering(node, isAppearing);
return offsetHeight;
}
onExit(node) {
this.setState({ startAnimation: false });
this.props.onExit(node);
}
onExiting(node) {
this.setState({ startAnimation: true });
node.dispatchEvent(new CustomEvent('slide.bs.carousel'));
this.props.onExiting(node);
}
onExited(node) {
node.dispatchEvent(new CustomEvent('slid.bs.carousel'));
this.props.onExited(node);
}
render() {
const {
in: isIn,
children,
cssModule,
slide = true,
tag: Tag = 'div',
className,
...transitionProps
} = this.props;
return (
<Transition
{...transitionProps}
enter={slide}
exit={slide}
in={isIn}
onEnter={this.onEnter}
onEntering={this.onEntering}
onExit={this.onExit}
onExiting={this.onExiting}
onExited={this.onExited}
>
{(status) => {
const { direction } = this.context;
const isActive =
status === TransitionStatuses.ENTERED ||
status === TransitionStatuses.EXITING;
const directionClassName =
(status === TransitionStatuses.ENTERING ||
status === TransitionStatuses.EXITING) &&
this.state.startAnimation &&
(direction === 'end' ? 'carousel-item-start' : 'carousel-item-end');
const orderClassName =
status === TransitionStatuses.ENTERING &&
(direction === 'end' ? 'carousel-item-next' : 'carousel-item-prev');
const itemClasses = mapToCssModules(
classNames(
className,
'carousel-item',
isActive && 'active',
directionClassName,
orderClassName,
),
cssModule,
);
return <Tag className={itemClasses}>{children}</Tag>;
}}
</Transition>
);
}
}
CarouselItem.propTypes = {
...Transition.propTypes,
/** Set a custom element for this component */
tag: tagPropType,
in: PropTypes.bool,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
children: PropTypes.node,
/** Enable/disable animation */
slide: PropTypes.bool,
/** Add custom class */
className: PropTypes.string,
};
CarouselItem.defaultProps = {
...Transition.defaultProps,
timeout: TransitionTimeouts.Carousel,
};
CarouselItem.contextType = CarouselContext;
export default CarouselItem;

43
node_modules/reactstrap/src/CloseButton.js generated vendored Normal file
View File

@@ -0,0 +1,43 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules } from './utils';
const propTypes = {
/** Disable the button if needed */
active: PropTypes.bool,
/** Aria label */
'aria-label': PropTypes.string,
/** Function to be triggered on click */
onClick: PropTypes.func,
/** Change the variant to white */
variant: PropTypes.oneOf(['white']),
className: PropTypes.string,
cssModule: PropTypes.object,
innerRef: PropTypes.oneOfType([
PropTypes.object,
PropTypes.string,
PropTypes.func,
]),
};
function CloseButton(props) {
const { className, cssModule, variant, innerRef, ...attributes } = props;
const classes = mapToCssModules(
classNames(className, 'btn-close', variant && `btn-close-${variant}`),
);
return (
<button
ref={innerRef}
type="button"
className={classes}
{...{ 'aria-label': 'close', ...attributes }}
/>
);
}
CloseButton.propTypes = propTypes;
export default CloseButton;

120
node_modules/reactstrap/src/Col.js generated vendored Normal file
View File

@@ -0,0 +1,120 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType, isObject } from './utils';
const colWidths = ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
const stringOrNumberProp = PropTypes.oneOfType([
PropTypes.number,
PropTypes.string,
]);
const columnProps = PropTypes.oneOfType([
PropTypes.bool,
PropTypes.number,
PropTypes.string,
PropTypes.shape({
size: PropTypes.oneOfType([
PropTypes.bool,
PropTypes.number,
PropTypes.string,
]),
order: stringOrNumberProp,
offset: stringOrNumberProp,
}),
]);
const propTypes = {
tag: tagPropType,
xs: columnProps,
sm: columnProps,
md: columnProps,
lg: columnProps,
xl: columnProps,
xxl: columnProps,
className: PropTypes.string,
cssModule: PropTypes.object,
widths: PropTypes.array,
};
const getColumnSizeClass = (isXs, colWidth, colSize) => {
if (colSize === true || colSize === '') {
return isXs ? 'col' : `col-${colWidth}`;
}
if (colSize === 'auto') {
return isXs ? 'col-auto' : `col-${colWidth}-auto`;
}
return isXs ? `col-${colSize}` : `col-${colWidth}-${colSize}`;
};
export const getColumnClasses = (attributes, cssModule, widths = colWidths) => {
const modifiedAttributes = attributes;
const colClasses = [];
widths.forEach((colWidth, i) => {
let columnProp = modifiedAttributes[colWidth];
delete modifiedAttributes[colWidth];
if (!columnProp && columnProp !== '') {
return;
}
const isXs = !i;
if (isObject(columnProp)) {
const colSizeInterfix = isXs ? '-' : `-${colWidth}-`;
const colClass = getColumnSizeClass(isXs, colWidth, columnProp.size);
colClasses.push(
mapToCssModules(
classNames({
[colClass]: columnProp.size || columnProp.size === '',
[`order${colSizeInterfix}${columnProp.order}`]:
columnProp.order || columnProp.order === 0,
[`offset${colSizeInterfix}${columnProp.offset}`]:
columnProp.offset || columnProp.offset === 0,
}),
cssModule,
),
);
} else {
const colClass = getColumnSizeClass(isXs, colWidth, columnProp);
colClasses.push(colClass);
}
});
return {
colClasses,
modifiedAttributes,
};
};
function Col(props) {
const {
className,
cssModule,
widths = colWidths,
tag: Tag = 'div',
...attributes
} = props;
let { modifiedAttributes, colClasses } = getColumnClasses(
attributes,
cssModule,
widths,
);
if (!colClasses.length) {
colClasses.push('col');
}
const classes = mapToCssModules(classNames(className, colClasses), cssModule);
return <Tag {...modifiedAttributes} className={classes} />;
}
Col.propTypes = propTypes;
export default Col;

175
node_modules/reactstrap/src/Collapse.js generated vendored Normal file
View File

@@ -0,0 +1,175 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { Transition } from 'react-transition-group';
import {
mapToCssModules,
omit,
pick,
TransitionTimeouts,
TransitionPropTypeKeys,
TransitionStatuses,
tagPropType,
} from './utils';
const propTypes = {
...Transition.propTypes,
/** Make content animation appear horizontally */
horizontal: PropTypes.bool,
/** Set if Collapse is open or closed */
isOpen: PropTypes.bool,
children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
PropTypes.node,
]),
/** Set a custom element for this component */
tag: tagPropType,
/** Add custom class */
className: PropTypes.node,
navbar: PropTypes.bool,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
innerRef: PropTypes.shape({ current: PropTypes.object }),
};
const defaultProps = {
...Transition.defaultProps,
horizontal: false,
isOpen: false,
appear: false,
enter: true,
exit: true,
tag: 'div',
timeout: TransitionTimeouts.Collapse,
};
const transitionStatusToClassHash = {
[TransitionStatuses.ENTERING]: 'collapsing',
[TransitionStatuses.ENTERED]: 'collapse show',
[TransitionStatuses.EXITING]: 'collapsing',
[TransitionStatuses.EXITED]: 'collapse',
};
function getTransitionClass(status) {
return transitionStatusToClassHash[status] || 'collapse';
}
class Collapse extends Component {
constructor(props) {
super(props);
this.state = {
dimension: null,
};
this.nodeRef = props.innerRef || React.createRef();
['onEntering', 'onEntered', 'onExit', 'onExiting', 'onExited'].forEach(
(name) => {
this[name] = this[name].bind(this);
},
);
}
onEntering(_, isAppearing) {
const node = this.getNode();
this.setState({ dimension: this.getDimension(node) });
this.props.onEntering(node, isAppearing);
}
onEntered(_, isAppearing) {
const node = this.getNode();
this.setState({ dimension: null });
this.props.onEntered(node, isAppearing);
}
onExit() {
const node = this.getNode();
this.setState({ dimension: this.getDimension(node) });
this.props.onExit(node);
}
onExiting() {
const node = this.getNode();
// getting this variable triggers a reflow
const _unused = this.getDimension(node); // eslint-disable-line no-unused-vars
this.setState({ dimension: 0 });
this.props.onExiting(node);
}
onExited() {
const node = this.getNode();
this.setState({ dimension: null });
this.props.onExited(node);
}
getNode() {
return this.nodeRef.current;
}
getDimension(node) {
return this.props.horizontal ? node.scrollWidth : node.scrollHeight;
}
render() {
const {
tag: Tag,
horizontal,
isOpen,
className,
navbar,
cssModule,
children,
innerRef,
...otherProps
} = this.props;
const { dimension } = this.state;
const transitionProps = pick(otherProps, TransitionPropTypeKeys);
const childProps = omit(otherProps, TransitionPropTypeKeys);
return (
<Transition
{...transitionProps}
in={isOpen}
nodeRef={this.nodeRef}
onEntering={this.onEntering}
onEntered={this.onEntered}
onExit={this.onExit}
onExiting={this.onExiting}
onExited={this.onExited}
>
{(status) => {
let collapseClass = getTransitionClass(status);
const classes = mapToCssModules(
classNames(
className,
horizontal && 'collapse-horizontal',
collapseClass,
navbar && 'navbar-collapse',
),
cssModule,
);
const style =
dimension === null
? null
: { [horizontal ? 'width' : 'height']: dimension };
return (
<Tag
{...childProps}
style={{ ...childProps.style, ...style }}
className={classes}
ref={this.nodeRef}
>
{children}
</Tag>
);
}}
</Transition>
);
}
}
Collapse.propTypes = propTypes;
Collapse.defaultProps = defaultProps;
export default Collapse;

39
node_modules/reactstrap/src/Container.js generated vendored Normal file
View File

@@ -0,0 +1,39 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
tag: tagPropType,
fluid: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
className: PropTypes.string,
cssModule: PropTypes.object,
};
function Container(props) {
const {
className,
cssModule,
fluid,
tag: Tag = 'div',
...attributes
} = props;
let containerClass = 'container';
if (fluid === true) {
containerClass = 'container-fluid';
} else if (fluid) {
containerClass = `container-${fluid}`;
}
const classes = mapToCssModules(
classNames(className, containerClass),
cssModule,
);
return <Tag {...attributes} className={classes} />;
}
Container.propTypes = propTypes;
export default Container;

381
node_modules/reactstrap/src/Dropdown.js generated vendored Normal file
View File

@@ -0,0 +1,381 @@
/* eslint react/no-find-dom-node: 0 */
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-find-dom-node.md
import React from 'react';
import PropTypes from 'prop-types';
import { Manager } from 'react-popper';
import classNames from 'classnames';
import { DropdownContext } from './DropdownContext';
import { mapToCssModules, omit, keyCodes, tagPropType } from './utils';
import { InputGroupContext } from './InputGroupContext';
const propTypes = {
a11y: PropTypes.bool,
disabled: PropTypes.bool,
direction: PropTypes.oneOf(['up', 'down', 'start', 'end', 'left', 'right']),
group: PropTypes.bool,
isOpen: PropTypes.bool,
nav: PropTypes.bool,
active: PropTypes.bool,
size: PropTypes.string,
tag: tagPropType,
toggle: PropTypes.func,
children: PropTypes.node,
className: PropTypes.string,
cssModule: PropTypes.object,
dropup: PropTypes.bool,
inNavbar: PropTypes.bool,
setActiveFromChild: PropTypes.bool,
menuRole: PropTypes.oneOf(['listbox', 'menu']),
};
const defaultProps = {
a11y: true,
isOpen: false,
direction: 'down',
nav: false,
active: false,
inNavbar: false,
setActiveFromChild: false,
};
const preventDefaultKeys = [
keyCodes.space,
keyCodes.enter,
keyCodes.up,
keyCodes.down,
keyCodes.end,
keyCodes.home,
];
class Dropdown extends React.Component {
constructor(props) {
super(props);
this.addEvents = this.addEvents.bind(this);
this.handleDocumentClick = this.handleDocumentClick.bind(this);
this.handleKeyDown = this.handleKeyDown.bind(this);
this.removeEvents = this.removeEvents.bind(this);
this.toggle = this.toggle.bind(this);
this.handleMenuRef = this.handleMenuRef.bind(this);
this.handleToggleRef = this.handleToggleRef.bind(this);
this.containerRef = React.createRef();
this.menuRef = React.createRef();
this.toggleRef = React.createRef();
// ref for DropdownToggle
}
componentDidMount() {
this.handleProps();
}
componentDidUpdate(prevProps) {
if (this.props.isOpen !== prevProps.isOpen) {
this.handleProps();
}
}
componentWillUnmount() {
this.removeEvents();
}
handleMenuRef(menuRef) {
this.menuRef.current = menuRef;
}
handleToggleRef(toggleRef) {
this.toggleRef.current = toggleRef;
}
handleDocumentClick(e) {
if (
e &&
(e.which === 3 || (e.type === 'keyup' && e.which !== keyCodes.tab))
)
return;
const container = this.getContainer();
const menu = this.getMenu();
const toggle = this.getToggle();
// Add a conditional check to avoid using toggle
// if there is no toggle component in the dropdown
if (!toggle) {
return;
}
const targetIsToggle = toggle.contains(e.target);
const clickIsInMenu = menu && menu.contains(e.target) && menu !== e.target;
let clickIsInInput = false;
if (container) {
// This is only for InputGroup with type dropdown
clickIsInInput =
container.classList.contains('input-group') &&
container.classList.contains('dropdown') &&
e.target.tagName === 'INPUT';
}
if (
((targetIsToggle && !clickIsInInput) || clickIsInMenu) &&
(e.type !== 'keyup' || e.which === keyCodes.tab)
) {
return;
}
this.toggle(e);
}
handleKeyDown(e) {
const isTargetMenuItem =
e.target.getAttribute('role') === 'menuitem' ||
e.target.getAttribute('role') === 'option';
const isTargetMenuCtrl = this.getMenuCtrl() === e.target;
const isTab = keyCodes.tab === e.which;
if (
/input|textarea/i.test(e.target.tagName) ||
(isTab && !this.props.a11y) ||
(isTab && !(isTargetMenuItem || isTargetMenuCtrl))
) {
return;
}
if (
preventDefaultKeys.indexOf(e.which) !== -1 ||
(e.which >= 48 && e.which <= 90)
) {
e.preventDefault();
}
if (this.props.disabled) return;
if (isTargetMenuCtrl) {
if (
[keyCodes.space, keyCodes.enter, keyCodes.up, keyCodes.down].indexOf(
e.which,
) > -1
) {
// Open the menu (if not open) and focus the first menu item
if (!this.props.isOpen) {
this.toggle(e);
}
setTimeout(() => this.getMenuItems()[0]?.focus());
} else if (this.props.isOpen && isTab) {
// Focus the first menu item if tabbing from an open menu. We need this
// for cases where the DropdownMenu sets a custom container, which may
// not be the natural next item to tab to from the DropdownToggle.
e.preventDefault();
this.getMenuItems()[0]?.focus();
} else if (this.props.isOpen && e.which === keyCodes.esc) {
this.toggle(e);
}
}
if (this.props.isOpen && isTargetMenuItem) {
if ([keyCodes.tab, keyCodes.esc].indexOf(e.which) > -1) {
this.toggle(e);
this.getMenuCtrl().focus();
} else if ([keyCodes.space, keyCodes.enter].indexOf(e.which) > -1) {
e.target.click();
this.getMenuCtrl().focus();
} else if (
[keyCodes.down, keyCodes.up].indexOf(e.which) > -1 ||
([keyCodes.n, keyCodes.p].indexOf(e.which) > -1 && e.ctrlKey)
) {
const $menuitems = this.getMenuItems();
let index = $menuitems.indexOf(e.target);
if (keyCodes.up === e.which || (keyCodes.p === e.which && e.ctrlKey)) {
index = index !== 0 ? index - 1 : $menuitems.length - 1;
} else if (
keyCodes.down === e.which ||
(keyCodes.n === e.which && e.ctrlKey)
) {
index = index === $menuitems.length - 1 ? 0 : index + 1;
}
$menuitems[index].focus();
} else if (keyCodes.end === e.which) {
const $menuitems = this.getMenuItems();
$menuitems[$menuitems.length - 1].focus();
} else if (keyCodes.home === e.which) {
const $menuitems = this.getMenuItems();
$menuitems[0].focus();
} else if (e.which >= 48 && e.which <= 90) {
const $menuitems = this.getMenuItems();
const charPressed = String.fromCharCode(e.which).toLowerCase();
for (let i = 0; i < $menuitems.length; i += 1) {
const firstLetter =
$menuitems[i].textContent &&
$menuitems[i].textContent[0].toLowerCase();
if (firstLetter === charPressed) {
$menuitems[i].focus();
break;
}
}
}
}
}
handleProps() {
if (this.props.isOpen) {
this.addEvents();
} else {
this.removeEvents();
}
}
getContextValue() {
return {
toggle: this.toggle,
isOpen: this.props.isOpen,
direction:
this.props.direction === 'down' && this.props.dropup
? 'up'
: this.props.direction,
inNavbar: this.props.inNavbar,
disabled: this.props.disabled,
// Callback that should be called by DropdownMenu to provide a ref to
// a HTML tag that's used for the DropdownMenu
onMenuRef: this.handleMenuRef,
onToggleRef: this.handleToggleRef,
menuRole: this.props.menuRole,
};
}
getContainer() {
return this.containerRef.current;
}
getMenu() {
return this.menuRef.current;
}
getToggle() {
return this.toggleRef.current;
}
getMenuCtrl() {
if (this._$menuCtrl) return this._$menuCtrl;
this._$menuCtrl = this.getToggle();
return this._$menuCtrl;
}
getItemType() {
if (this.props.menuRole === 'listbox') {
return 'option';
}
return 'menuitem';
}
getMenuItems() {
// In a real menu with a child DropdownMenu, `this.getMenu()` should never
// be null, but it is sometimes null in tests. To mitigate that, we just
// use `this.getContainer()` as the fallback `menuContainer`.
const menuContainer = this.getMenu() || this.getContainer();
return [].slice.call(
menuContainer.querySelectorAll(`[role="${this.getItemType()}"]`),
);
}
addEvents() {
['click', 'touchstart', 'keyup'].forEach((event) =>
document.addEventListener(event, this.handleDocumentClick, true),
);
}
removeEvents() {
['click', 'touchstart', 'keyup'].forEach((event) =>
document.removeEventListener(event, this.handleDocumentClick, true),
);
}
toggle(e) {
if (this.props.disabled) {
return e && e.preventDefault();
}
return this.props.toggle(e);
}
render() {
const {
className,
cssModule,
direction,
isOpen,
group,
size,
nav,
setActiveFromChild,
active,
tag,
menuRole,
...attrs
} = omit(this.props, ['toggle', 'disabled', 'inNavbar', 'a11y']);
const Tag = tag || (nav ? 'li' : 'div');
let subItemIsActive = false;
if (setActiveFromChild) {
React.Children.map(
this.props.children[1].props.children,
(dropdownItem) => {
if (dropdownItem && dropdownItem.props.active) subItemIsActive = true;
},
);
}
const classes = mapToCssModules(
classNames(
className,
nav && active ? 'active' : false,
setActiveFromChild && subItemIsActive ? 'active' : false,
{
'btn-group': group,
[`btn-group-${size}`]: !!size,
dropdown: !group,
dropup: direction === 'up',
dropstart: direction === 'start' || direction === 'left',
dropend: direction === 'end' || direction === 'right',
show: isOpen,
'nav-item': nav,
},
),
cssModule,
);
if (this.context.insideInputGroup) {
return (
<DropdownContext.Provider value={this.getContextValue()}>
<Manager>
{React.Children.map(this.props.children, (child) =>
React.cloneElement(child, { onKeyDown: this.handleKeyDown }),
)}
</Manager>
</DropdownContext.Provider>
);
}
return (
<DropdownContext.Provider value={this.getContextValue()}>
<Manager>
<Tag
{...attrs}
{...{
[typeof Tag === 'string' ? 'ref' : 'innerRef']: this.containerRef,
}}
onKeyDown={this.handleKeyDown}
className={classes}
/>
</Manager>
</DropdownContext.Provider>
);
}
}
Dropdown.propTypes = propTypes;
Dropdown.defaultProps = defaultProps;
Dropdown.contextType = InputGroupContext;
export default Dropdown;

13
node_modules/reactstrap/src/DropdownContext.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
import React from 'react';
/**
* DropdownContext
* {
* toggle: PropTypes.func.isRequired,
* isOpen: PropTypes.bool.isRequired,
* direction: PropTypes.oneOf(['up', 'down', 'start', 'end']).isRequired,
* inNavbar: PropTypes.bool.isRequired,
* disabled: PropTypes.bool
* }
*/
export const DropdownContext = React.createContext({});

119
node_modules/reactstrap/src/DropdownItem.js generated vendored Normal file
View File

@@ -0,0 +1,119 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { DropdownContext } from './DropdownContext';
import { mapToCssModules, omit, tagPropType } from './utils';
const propTypes = {
children: PropTypes.node,
active: PropTypes.bool,
disabled: PropTypes.bool,
divider: PropTypes.bool,
tag: tagPropType,
header: PropTypes.bool,
onClick: PropTypes.func,
className: PropTypes.string,
cssModule: PropTypes.object,
toggle: PropTypes.bool,
text: PropTypes.bool,
};
class DropdownItem extends React.Component {
constructor(props) {
super(props);
this.onClick = this.onClick.bind(this);
this.getTabIndex = this.getTabIndex.bind(this);
}
onClick(e) {
const { disabled, header, divider, text } = this.props;
if (disabled || header || divider || text) {
e.preventDefault();
return;
}
if (this.props.onClick) {
this.props.onClick(e);
}
if (this.props.toggle ?? true) {
this.context.toggle(e);
}
}
getRole() {
if (this.context.menuRole === 'listbox') {
return 'option';
}
return 'menuitem';
}
getTabIndex() {
const { disabled, header, divider, text } = this.props;
if (disabled || header || divider || text) {
return '-1';
}
return '0';
}
render() {
const tabIndex = this.getTabIndex();
const role = tabIndex > -1 ? this.getRole() : undefined;
let {
className,
cssModule,
divider,
tag: Tag = 'button',
header,
active,
text,
...props
} = omit(this.props, ['toggle']);
const classes = mapToCssModules(
classNames(className, {
disabled: props.disabled,
'dropdown-item': !divider && !header && !text,
active: active,
'dropdown-header': header,
'dropdown-divider': divider,
'dropdown-item-text': text,
}),
cssModule,
);
if (Tag === 'button') {
if (header) {
Tag = 'h6';
} else if (divider) {
Tag = 'div';
} else if (props.href) {
Tag = 'a';
} else if (text) {
Tag = 'span';
}
}
return (
<Tag
type={
Tag === 'button' && (props.onClick || this.props.toggle)
? 'button'
: undefined
}
{...props}
tabIndex={tabIndex}
role={role}
className={classes}
onClick={this.onClick}
/>
);
}
}
DropdownItem.propTypes = propTypes;
DropdownItem.contextType = DropdownContext;
export default DropdownItem;

162
node_modules/reactstrap/src/DropdownMenu.js generated vendored Normal file
View File

@@ -0,0 +1,162 @@
import React from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import classNames from 'classnames';
import { Popper } from 'react-popper';
import { DropdownContext } from './DropdownContext';
import {
mapToCssModules,
tagPropType,
targetPropType,
getTarget,
deprecated,
} from './utils';
const propTypes = {
tag: tagPropType,
children: PropTypes.node.isRequired,
dark: PropTypes.bool,
end: PropTypes.bool,
/** Flips the menu to the opposite side if there is not enough space to fit */
flip: PropTypes.bool,
modifiers: PropTypes.array,
className: PropTypes.string,
cssModule: PropTypes.object,
style: PropTypes.object,
persist: PropTypes.bool,
strategy: PropTypes.string,
container: targetPropType,
/** Update popper layout when a click event comes up. This leverages event bubbling. */
updateOnSelect: PropTypes.bool,
right: deprecated(PropTypes.bool, 'Please use "end" instead.'),
};
const directionPositionMap = {
up: 'top',
left: 'left',
right: 'right',
start: 'left',
end: 'right',
down: 'bottom',
};
class DropdownMenu extends React.Component {
getRole() {
if (this.context.menuRole === 'listbox') {
return 'listbox';
}
return 'menu';
}
render() {
const {
className,
cssModule,
dark,
end,
right,
tag = 'div',
flip = true,
modifiers = [],
persist,
strategy,
container,
updateOnSelect,
...attrs
} = this.props;
const classes = mapToCssModules(
classNames(className, 'dropdown-menu', {
'dropdown-menu-dark': dark,
'dropdown-menu-end': end || right,
show: this.context.isOpen,
}),
cssModule,
);
const Tag = tag;
if (persist || (this.context.isOpen && !this.context.inNavbar)) {
const position1 =
directionPositionMap[this.context.direction] || 'bottom';
const position2 = end || right ? 'end' : 'start';
const poperPlacement = `${position1}-${position2}`;
const poperModifiers = [
...modifiers,
{
name: 'flip',
enabled: !!flip,
},
];
const persistStyles = {};
if (persist) {
persistStyles.display = 'block';
persistStyles.visibility = this.context.isOpen ? 'visible' : 'hidden';
}
const popper = (
<Popper
placement={poperPlacement}
modifiers={poperModifiers}
strategy={strategy}
>
{({ ref, style, placement, update }) => {
let combinedStyle = {
...this.props.style,
...persistStyles,
...style,
};
const handleRef = (tagRef) => {
// Send the ref to `react-popper`
ref(tagRef);
// Send the ref to the parent Dropdown so that clicks outside
// it will cause it to close
const { onMenuRef } = this.context;
if (onMenuRef) onMenuRef(tagRef);
};
return (
<Tag
tabIndex="-1"
role={this.getRole()}
ref={handleRef}
{...attrs}
style={combinedStyle}
aria-hidden={!this.context.isOpen}
className={classes}
data-popper-placement={placement}
onClick={() => updateOnSelect && update()}
/>
);
}}
</Popper>
);
if (container) {
return ReactDOM.createPortal(popper, getTarget(container));
}
return popper;
}
const { onMenuRef } = this.context;
return (
<Tag
tabIndex="-1"
role={this.getRole()}
{...attrs}
ref={onMenuRef}
aria-hidden={!this.context.isOpen}
className={classes}
data-popper-placement={attrs.placement}
data-bs-popper="static"
/>
);
}
}
DropdownMenu.propTypes = propTypes;
DropdownMenu.contextType = DropdownContext;
export default DropdownMenu;

137
node_modules/reactstrap/src/DropdownToggle.js generated vendored Normal file
View File

@@ -0,0 +1,137 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { Reference } from 'react-popper';
import { DropdownContext } from './DropdownContext';
import { mapToCssModules, tagPropType } from './utils';
import Button from './Button';
const propTypes = {
caret: PropTypes.bool,
color: PropTypes.string,
children: PropTypes.node,
className: PropTypes.string,
cssModule: PropTypes.object,
disabled: PropTypes.bool,
onClick: PropTypes.func,
'aria-haspopup': PropTypes.bool,
split: PropTypes.bool,
tag: tagPropType,
nav: PropTypes.bool,
innerRef: PropTypes.oneOfType([
PropTypes.object,
PropTypes.string,
PropTypes.func,
]),
};
const defaultProps = {
color: 'secondary',
'aria-haspopup': true,
};
class DropdownToggle extends React.Component {
constructor(props) {
super(props);
this.onClick = this.onClick.bind(this);
}
onClick(e) {
if (this.props.disabled || this.context.disabled) {
e.preventDefault();
return;
}
if (this.props.nav && !this.props.tag) {
e.preventDefault();
}
if (this.props.onClick) {
this.props.onClick(e);
}
this.context.toggle(e);
}
getRole() {
return this.context.menuRole || this.props['aria-haspopup'];
}
render() {
const {
className,
color,
cssModule,
caret,
split,
nav,
tag,
innerRef,
...props
} = this.props;
const ariaLabel = props['aria-label'] || 'Toggle Dropdown';
const classes = mapToCssModules(
classNames(className, {
'dropdown-toggle': caret || split,
'dropdown-toggle-split': split,
'nav-link': nav,
}),
cssModule,
);
const children =
typeof props.children !== 'undefined' ? (
props.children
) : (
<span className="visually-hidden">{ariaLabel}</span>
);
let Tag;
if (nav && !tag) {
Tag = 'a';
props.href = '#';
} else if (!tag) {
Tag = Button;
props.color = color;
props.cssModule = cssModule;
} else {
Tag = tag;
}
// extracted the rendering of the Tag component
const returnFunction = ({ ref }) => {
const handleRef = (tagRef) => {
ref(tagRef);
const { onToggleRef } = this.context;
if (onToggleRef) onToggleRef(tagRef);
};
return (
<Tag
{...props}
{...{ [typeof Tag === 'string' ? 'ref' : 'innerRef']: handleRef }}
className={classes}
onClick={this.onClick}
aria-expanded={this.context.isOpen}
aria-haspopup={this.getRole()}
children={children}
/>
);
};
// No Reference component if the component is in Navbar
if (this.context.inNavbar) {
return <>{returnFunction({ ref: this.context.onToggleRef })}</>;
}
// Normal rendering if component not in NavBar
return <Reference innerRef={innerRef}>{returnFunction}</Reference>;
}
}
DropdownToggle.propTypes = propTypes;
DropdownToggle.defaultProps = defaultProps;
DropdownToggle.contextType = DropdownContext;
export default DropdownToggle;

83
node_modules/reactstrap/src/Fade.js generated vendored Normal file
View File

@@ -0,0 +1,83 @@
import React, { useRef } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { Transition } from 'react-transition-group';
import {
addDefaultProps,
mapToCssModules,
omit,
pick,
tagPropType,
TransitionPropTypeKeys,
TransitionTimeouts,
} from './utils';
const propTypes = {
...Transition.propTypes,
children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
PropTypes.node,
]),
tag: tagPropType,
baseClass: PropTypes.string,
baseClassActive: PropTypes.string,
className: PropTypes.string,
cssModule: PropTypes.object,
innerRef: PropTypes.oneOfType([
PropTypes.object,
PropTypes.string,
PropTypes.func,
]),
};
const defaultProps = {
...Transition.defaultProps,
timeout: TransitionTimeouts.Fade,
appear: true,
enter: true,
exit: true,
in: true,
};
function Fade(props) {
const ref = useRef(null);
const {
tag: Tag = 'div',
baseClass = 'fade',
baseClassActive = 'show',
className,
cssModule,
children,
innerRef = ref,
...otherProps
} = addDefaultProps(defaultProps, props);
const transitionProps = pick(
{ defaultProps, ...otherProps },
TransitionPropTypeKeys,
);
const childProps = omit(otherProps, TransitionPropTypeKeys);
return (
<Transition nodeRef={innerRef} {...transitionProps}>
{(status) => {
const isActive = status === 'entered';
const classes = mapToCssModules(
classNames(className, baseClass, isActive && baseClassActive),
cssModule,
);
return (
<Tag className={classes} {...childProps} ref={innerRef}>
{children}
</Tag>
);
}}
</Transition>
);
}
Fade.propTypes = propTypes;
export default Fade;

53
node_modules/reactstrap/src/Form.js generated vendored Normal file
View File

@@ -0,0 +1,53 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
children: PropTypes.node,
tag: tagPropType,
innerRef: PropTypes.oneOfType([
PropTypes.object,
PropTypes.func,
PropTypes.string,
]),
className: PropTypes.string,
cssModule: PropTypes.object,
};
class Form extends Component {
constructor(props) {
super(props);
this.getRef = this.getRef.bind(this);
this.submit = this.submit.bind(this);
}
getRef(ref) {
if (this.props.innerRef) {
this.props.innerRef(ref);
}
this.ref = ref;
}
submit() {
if (this.ref) {
this.ref.submit();
}
}
render() {
const {
className,
cssModule,
tag: Tag = 'form',
innerRef,
...attributes
} = this.props;
const classes = mapToCssModules(className, cssModule);
return <Tag {...attributes} ref={innerRef} className={classes} />;
}
}
Form.propTypes = propTypes;
export default Form;

40
node_modules/reactstrap/src/FormFeedback.js generated vendored Normal file
View File

@@ -0,0 +1,40 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
children: PropTypes.node,
tag: tagPropType,
className: PropTypes.string,
cssModule: PropTypes.object,
valid: PropTypes.bool,
tooltip: PropTypes.bool,
};
function FormFeedback(props) {
const {
className,
cssModule,
valid = undefined,
tooltip,
tag: Tag = 'div',
...attributes
} = props;
const validMode = tooltip ? 'tooltip' : 'feedback';
const classes = mapToCssModules(
classNames(
className,
valid ? `valid-${validMode}` : `invalid-${validMode}`,
),
cssModule,
);
return <Tag {...attributes} className={classes} />;
}
FormFeedback.propTypes = propTypes;
export default FormFeedback;

60
node_modules/reactstrap/src/FormGroup.js generated vendored Normal file
View File

@@ -0,0 +1,60 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
children: PropTypes.node,
row: PropTypes.bool,
check: PropTypes.bool,
switch: PropTypes.bool,
inline: PropTypes.bool,
floating: PropTypes.bool,
noMargin: PropTypes.bool,
disabled: PropTypes.bool,
tag: tagPropType,
className: PropTypes.string,
cssModule: PropTypes.object,
};
function FormGroup(props) {
const {
className,
cssModule,
row,
disabled,
check,
inline,
floating,
noMargin,
tag: Tag = 'div',
switch: switchProp,
...attributes
} = props;
const formCheck = check || switchProp;
const classes = mapToCssModules(
classNames(
className,
row ? 'row' : false,
formCheck ? 'form-check' : false,
switchProp ? 'form-switch' : false,
formCheck || noMargin ? false : 'mb-3',
formCheck && inline ? 'form-check-inline' : false,
formCheck && disabled ? 'disabled' : false,
floating && 'form-floating',
),
cssModule,
);
if (Tag === 'fieldset') {
attributes.disabled = disabled;
}
return <Tag {...attributes} className={classes} />;
}
FormGroup.propTypes = propTypes;
export default FormGroup;

39
node_modules/reactstrap/src/FormText.js generated vendored Normal file
View File

@@ -0,0 +1,39 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
children: PropTypes.node,
inline: PropTypes.bool,
tag: tagPropType,
color: PropTypes.string,
className: PropTypes.string,
cssModule: PropTypes.object,
};
function FormText(props) {
const {
className,
cssModule,
inline,
color = 'muted',
tag: Tag = 'small',
...attributes
} = props;
const classes = mapToCssModules(
classNames(
className,
!inline ? 'form-text' : false,
color ? `text-${color}` : false,
),
cssModule,
);
return <Tag {...attributes} className={classes} />;
}
FormText.propTypes = propTypes;
export default FormText;

142
node_modules/reactstrap/src/Input.js generated vendored Normal file
View File

@@ -0,0 +1,142 @@
/* eslint react/prefer-stateless-function: 0 */
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, warnOnce, tagPropType } from './utils';
const propTypes = {
children: PropTypes.node,
type: PropTypes.string,
size: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
bsSize: PropTypes.string,
valid: PropTypes.bool,
invalid: PropTypes.bool,
tag: tagPropType,
innerRef: PropTypes.oneOfType([
PropTypes.object,
PropTypes.func,
PropTypes.string,
]),
plaintext: PropTypes.bool,
addon: PropTypes.bool,
className: PropTypes.string,
cssModule: PropTypes.object,
};
class Input extends React.Component {
constructor(props) {
super(props);
this.getRef = this.getRef.bind(this);
this.focus = this.focus.bind(this);
}
getRef(ref) {
if (this.props.innerRef) {
this.props.innerRef(ref);
}
this.ref = ref;
}
focus() {
if (this.ref) {
this.ref.focus();
}
}
render() {
let {
className,
cssModule,
type = 'text',
bsSize,
valid,
invalid,
tag,
addon,
plaintext,
innerRef,
...attributes
} = this.props;
const checkInput = ['switch', 'radio', 'checkbox'].indexOf(type) > -1;
const isNotaNumber = /\D/g;
const textareaInput = type === 'textarea';
const selectInput = type === 'select';
const rangeInput = type === 'range';
let Tag = tag || (selectInput || textareaInput ? type : 'input');
let formControlClass = 'form-control';
if (plaintext) {
formControlClass = `${formControlClass}-plaintext`;
Tag = tag || 'input';
} else if (rangeInput) {
formControlClass = 'form-range';
} else if (selectInput) {
formControlClass = 'form-select';
} else if (checkInput) {
if (addon) {
formControlClass = null;
} else {
formControlClass = 'form-check-input';
}
}
if (attributes.size && isNotaNumber.test(attributes.size)) {
warnOnce(
'Please use the prop "bsSize" instead of the "size" to bootstrap\'s input sizing.',
);
bsSize = attributes.size;
delete attributes.size;
}
const classes = mapToCssModules(
classNames(
className,
invalid && 'is-invalid',
valid && 'is-valid',
bsSize
? selectInput
? `form-select-${bsSize}`
: `form-control-${bsSize}`
: false,
formControlClass,
),
cssModule,
);
if (Tag === 'input' || (tag && typeof tag === 'function')) {
attributes.type = type === 'switch' ? 'checkbox' : type;
}
if (
attributes.children &&
!(
plaintext ||
type === 'select' ||
typeof Tag !== 'string' ||
Tag === 'select'
)
) {
warnOnce(
`Input with a type of "${type}" cannot have children. Please use "value"/"defaultValue" instead.`,
);
delete attributes.children;
}
return (
<Tag
{...attributes}
ref={innerRef}
className={classes}
aria-invalid={invalid}
/>
);
}
}
Input.propTypes = propTypes;
export default Input;

47
node_modules/reactstrap/src/InputGroup.js generated vendored Normal file
View File

@@ -0,0 +1,47 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
import Dropdown from './Dropdown';
import { InputGroupContext } from './InputGroupContext';
const propTypes = {
/** Add custom class */
className: PropTypes.string,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
/** Sets size of InputGroup */
size: PropTypes.string,
/** Set a custom element for this component */
tag: tagPropType,
type: PropTypes.string,
};
function InputGroup(props) {
const {
className,
cssModule,
tag: Tag = 'div',
type,
size,
...attributes
} = props;
const classes = mapToCssModules(
classNames(className, 'input-group', size ? `input-group-${size}` : null),
cssModule,
);
if (props.type === 'dropdown') {
return <Dropdown {...attributes} className={classes} />;
}
return (
<InputGroupContext.Provider value={{ insideInputGroup: true }}>
<Tag {...attributes} className={classes} />
</InputGroupContext.Provider>
);
}
InputGroup.propTypes = propTypes;
export default InputGroup;

3
node_modules/reactstrap/src/InputGroupContext.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import React from 'react';
export const InputGroupContext = React.createContext({});

28
node_modules/reactstrap/src/InputGroupText.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
/** Add custom class */
className: PropTypes.string,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
/** Set a custom element for this component */
tag: tagPropType,
};
function InputGroupText(props) {
const { className, cssModule, tag: Tag = 'span', ...attributes } = props;
const classes = mapToCssModules(
classNames(className, 'input-group-text'),
cssModule,
);
return <Tag {...attributes} className={classes} />;
}
InputGroupText.propTypes = propTypes;
export default InputGroupText;

123
node_modules/reactstrap/src/Label.js generated vendored Normal file
View File

@@ -0,0 +1,123 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType, isObject } from './utils';
const colWidths = ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
const stringOrNumberProp = PropTypes.oneOfType([
PropTypes.number,
PropTypes.string,
]);
const columnProps = PropTypes.oneOfType([
PropTypes.bool,
PropTypes.string,
PropTypes.number,
PropTypes.shape({
size: stringOrNumberProp,
order: stringOrNumberProp,
offset: stringOrNumberProp,
}),
]);
const propTypes = {
children: PropTypes.node,
hidden: PropTypes.bool,
check: PropTypes.bool,
size: PropTypes.string,
for: PropTypes.string,
tag: tagPropType,
className: PropTypes.string,
cssModule: PropTypes.object,
xs: columnProps,
sm: columnProps,
md: columnProps,
lg: columnProps,
xl: columnProps,
xxl: columnProps,
widths: PropTypes.array,
};
const getColumnSizeClass = (isXs, colWidth, colSize) => {
if (colSize === true || colSize === '') {
return isXs ? 'col' : `col-${colWidth}`;
}
if (colSize === 'auto') {
return isXs ? 'col-auto' : `col-${colWidth}-auto`;
}
return isXs ? `col-${colSize}` : `col-${colWidth}-${colSize}`;
};
function Label(props) {
const {
className,
cssModule,
hidden,
widths = colWidths,
tag: Tag = 'label',
check,
size,
for: htmlFor,
...attributes
} = props;
const colClasses = [];
widths.forEach((colWidth, i) => {
let columnProp = props[colWidth];
delete attributes[colWidth];
if (!columnProp && columnProp !== '') {
return;
}
const isXs = !i;
let colClass;
if (isObject(columnProp)) {
const colSizeInterfix = isXs ? '-' : `-${colWidth}-`;
colClass = getColumnSizeClass(isXs, colWidth, columnProp.size);
colClasses.push(
mapToCssModules(
classNames({
[colClass]: columnProp.size || columnProp.size === '',
[`order${colSizeInterfix}${columnProp.order}`]:
columnProp.order || columnProp.order === 0,
[`offset${colSizeInterfix}${columnProp.offset}`]:
columnProp.offset || columnProp.offset === 0,
}),
),
cssModule,
);
} else {
colClass = getColumnSizeClass(isXs, colWidth, columnProp);
colClasses.push(colClass);
}
});
const colFormLabel = size || colClasses.length;
const formLabel = !(check || colFormLabel);
const classes = mapToCssModules(
classNames(
className,
hidden ? 'visually-hidden' : false,
check ? 'form-check-label' : false,
size ? `col-form-label-${size}` : false,
colClasses,
colFormLabel ? 'col-form-label' : false,
formLabel ? 'form-label' : false,
),
cssModule,
);
return <Tag htmlFor={htmlFor} {...attributes} className={classes} />;
}
Label.propTypes = propTypes;
export default Label;

30
node_modules/reactstrap/src/List.js generated vendored Normal file
View File

@@ -0,0 +1,30 @@
import React, { forwardRef } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
/** Add custom class */
className: PropTypes.string,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
/** Set a custom element for this component */
tag: tagPropType,
/** Type of list `unstyled` or `inline` */
type: PropTypes.string,
};
const List = forwardRef((props, ref) => {
const { className, cssModule, tag: Tag = 'ul', type, ...attributes } = props;
const classes = mapToCssModules(
classNames(className, type ? `list-${type}` : false),
cssModule,
);
return <Tag {...attributes} className={classes} ref={ref} />;
});
List.name = 'List';
List.propTypes = propTypes;
export default List;

60
node_modules/reactstrap/src/ListGroup.js generated vendored Normal file
View File

@@ -0,0 +1,60 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
/** Add custom class */
className: PropTypes.string,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
/** Remove borders to make the list appear flush */
flush: PropTypes.bool,
/** Make the list horizontal instead of vertical */
horizontal: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
/** Add number to the ListItems */
numbered: PropTypes.bool,
/** Set a custom element for this component */
tag: tagPropType,
};
const getHorizontalClass = (horizontal) => {
if (horizontal === false) {
return false;
}
if (horizontal === true || horizontal === 'xs') {
return 'list-group-horizontal';
}
return `list-group-horizontal-${horizontal}`;
};
function ListGroup(props) {
const {
className,
cssModule,
tag: Tag = 'ul',
flush,
horizontal = false,
numbered = false,
...attributes
} = props;
const classes = mapToCssModules(
classNames(
className,
'list-group',
// list-group-horizontal cannot currently be mixed with list-group-flush
// we only try to apply horizontal classes if flush is false
flush ? 'list-group-flush' : getHorizontalClass(horizontal),
{
'list-group-numbered': numbered,
},
),
cssModule,
);
return <Tag {...attributes} className={classes} />;
}
ListGroup.propTypes = propTypes;
export default ListGroup;

59
node_modules/reactstrap/src/ListGroupItem.js generated vendored Normal file
View File

@@ -0,0 +1,59 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
/** Add action prop to give effects while hovering over element */
action: PropTypes.bool,
/** Add active prop to make the current selection active */
active: PropTypes.bool,
/** Add custom class */
className: PropTypes.string,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
/** Add background colour to the list item */
color: PropTypes.string,
/** Make the list item appear disabled */
disabled: PropTypes.bool,
/** Set a custom element for this component */
tag: tagPropType,
};
const handleDisabledOnClick = (e) => {
e.preventDefault();
};
function ListGroupItem(props) {
const {
className,
cssModule,
tag: Tag = 'li',
active,
disabled,
action,
color,
...attributes
} = props;
const classes = mapToCssModules(
classNames(
className,
active ? 'active' : false,
disabled ? 'disabled' : false,
action ? 'list-group-item-action' : false,
color ? `list-group-item-${color}` : false,
'list-group-item',
),
cssModule,
);
// Prevent click event when disabled.
if (disabled) {
attributes.onClick = handleDisabledOnClick;
}
return <Tag {...attributes} className={classes} />;
}
ListGroupItem.propTypes = propTypes;
export default ListGroupItem;

27
node_modules/reactstrap/src/ListGroupItemHeading.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
/** Add custom class */
className: PropTypes.string,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
/** Set a custom element for this component */
tag: tagPropType,
};
function ListGroupItemHeading(props) {
const { className, cssModule, tag: Tag = 'h5', ...attributes } = props;
const classes = mapToCssModules(
classNames(className, 'list-group-item-heading'),
cssModule,
);
return <Tag {...attributes} className={classes} />;
}
ListGroupItemHeading.propTypes = propTypes;
export default ListGroupItemHeading;

27
node_modules/reactstrap/src/ListGroupItemText.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
/** Add custom class */
className: PropTypes.string,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
/** Set a custom element for this component */
tag: tagPropType,
};
function ListGroupItemText(props) {
const { className, cssModule, tag: Tag = 'p', ...attributes } = props;
const classes = mapToCssModules(
classNames(className, 'list-group-item-text'),
cssModule,
);
return <Tag {...attributes} className={classes} />;
}
ListGroupItemText.propTypes = propTypes;
export default ListGroupItemText;

28
node_modules/reactstrap/src/ListInlineItem.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
import React, { forwardRef } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
/** Add custom class */
className: PropTypes.string,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
/** Set a custom element for this component */
tag: tagPropType,
};
const ListInlineItem = forwardRef((props, ref) => {
const { className, cssModule, tag: Tag = 'li', ...attributes } = props;
const classes = mapToCssModules(
classNames(className, 'list-inline-item'),
cssModule,
);
return <Tag {...attributes} className={classes} ref={ref} />;
});
ListInlineItem.name = 'ListInlineItem';
ListInlineItem.propTypes = propTypes;
export default ListInlineItem;

83
node_modules/reactstrap/src/Media.js generated vendored Normal file
View File

@@ -0,0 +1,83 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
body: PropTypes.bool,
bottom: PropTypes.bool,
children: PropTypes.node,
className: PropTypes.string,
cssModule: PropTypes.object,
heading: PropTypes.bool,
left: PropTypes.bool,
list: PropTypes.bool,
middle: PropTypes.bool,
object: PropTypes.bool,
right: PropTypes.bool,
tag: tagPropType,
top: PropTypes.bool,
};
function Media(props) {
const {
body,
bottom,
className,
cssModule,
heading,
left,
list,
middle,
object,
right,
tag,
top,
...attributes
} = props;
let defaultTag;
if (heading) {
defaultTag = 'h4';
} else if (attributes.href) {
defaultTag = 'a';
} else if (attributes.src || object) {
defaultTag = 'img';
} else if (list) {
defaultTag = 'ul';
} else {
defaultTag = 'div';
}
const Tag = tag || defaultTag;
const classes = mapToCssModules(
classNames(className, {
'media-body': body,
'media-heading': heading,
'media-left': left,
'media-right': right,
'media-top': top,
'media-bottom': bottom,
'media-middle': middle,
'media-object': object,
'media-list': list,
media:
!body &&
!heading &&
!left &&
!right &&
!top &&
!bottom &&
!middle &&
!object &&
!list,
}),
cssModule,
);
return <Tag {...attributes} className={classes} />;
}
Media.propTypes = propTypes;
export default Media;

578
node_modules/reactstrap/src/Modal.js generated vendored Normal file
View File

@@ -0,0 +1,578 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import Portal from './Portal';
import Fade from './Fade';
import {
getOriginalBodyPadding,
conditionallyUpdateScrollbar,
setScrollbarWidth,
mapToCssModules,
omit,
focusableElements,
TransitionTimeouts,
keyCodes,
targetPropType,
getTarget,
} from './utils';
function noop() {}
const FadePropTypes = PropTypes.shape(Fade.propTypes);
const propTypes = {
/** */
autoFocus: PropTypes.bool,
/** Add backdrop to modal */
backdrop: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['static'])]),
/** add custom classname to backdrop */
backdropClassName: PropTypes.string,
backdropTransition: FadePropTypes,
/** Vertically center the modal */
centered: PropTypes.bool,
/** Add children for the modal to wrap */
children: PropTypes.node,
/** Add custom className for modal content */
contentClassName: PropTypes.string,
className: PropTypes.string,
container: targetPropType,
cssModule: PropTypes.object,
external: PropTypes.node,
/** Enable/Disable animation */
fade: PropTypes.bool,
/** Make the modal fullscreen */
fullscreen: PropTypes.oneOfType([
PropTypes.bool,
PropTypes.oneOf(['sm', 'md', 'lg', 'xl']),
]),
innerRef: PropTypes.oneOfType([
PropTypes.object,
PropTypes.string,
PropTypes.func,
]),
/** The status of the modal, either open or close */
isOpen: PropTypes.bool,
/** Allow modal to be closed with escape key. */
keyboard: PropTypes.bool,
/** Identifies the element (or elements) that labels the current element. */
labelledBy: PropTypes.string,
modalClassName: PropTypes.string,
modalTransition: FadePropTypes,
/** Function to be triggered on close */
onClosed: PropTypes.func,
/** Function to be triggered on enter */
onEnter: PropTypes.func,
/** Function to be triggered on exit */
onExit: PropTypes.func,
/** Function to be triggered on open */
onOpened: PropTypes.func,
/** Returns focus to the element that triggered opening of the modal */
returnFocusAfterClose: PropTypes.bool,
/** Accessibility role */
role: PropTypes.string,
/** Make the modal scrollable */
scrollable: PropTypes.bool,
/** Two optional sizes `lg` and `sm` */
size: PropTypes.string,
/** Function to toggle modal visibility */
toggle: PropTypes.func,
trapFocus: PropTypes.bool,
/** Unmounts the modal when modal is closed */
unmountOnClose: PropTypes.bool,
wrapClassName: PropTypes.string,
zIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
};
const propsToOmit = Object.keys(propTypes);
const defaultProps = {
isOpen: false,
autoFocus: true,
centered: false,
scrollable: false,
role: 'dialog',
backdrop: true,
keyboard: true,
zIndex: 1050,
fade: true,
onOpened: noop,
onClosed: noop,
modalTransition: {
timeout: TransitionTimeouts.Modal,
},
backdropTransition: {
mountOnEnter: true,
timeout: TransitionTimeouts.Fade, // uses standard fade transition
},
unmountOnClose: true,
returnFocusAfterClose: true,
container: 'body',
trapFocus: false,
};
class Modal extends React.Component {
constructor(props) {
super(props);
this._element = null;
this._originalBodyPadding = null;
this.getFocusableChildren = this.getFocusableChildren.bind(this);
this.handleBackdropClick = this.handleBackdropClick.bind(this);
this.handleBackdropMouseDown = this.handleBackdropMouseDown.bind(this);
this.handleEscape = this.handleEscape.bind(this);
this.handleStaticBackdropAnimation =
this.handleStaticBackdropAnimation.bind(this);
this.handleTab = this.handleTab.bind(this);
this.onOpened = this.onOpened.bind(this);
this.onClosed = this.onClosed.bind(this);
this.manageFocusAfterClose = this.manageFocusAfterClose.bind(this);
this.clearBackdropAnimationTimeout =
this.clearBackdropAnimationTimeout.bind(this);
this.trapFocus = this.trapFocus.bind(this);
this.state = {
isOpen: false,
showStaticBackdropAnimation: false,
};
}
componentDidMount() {
const { isOpen, autoFocus, onEnter } = this.props;
if (isOpen) {
this.init();
this.setState({ isOpen: true });
if (autoFocus) {
this.setFocus();
}
}
if (onEnter) {
onEnter();
}
// traps focus inside the Modal, even if the browser address bar is focused
document.addEventListener('focus', this.trapFocus, true);
this._isMounted = true;
}
componentDidUpdate(prevProps, prevState) {
if (this.props.isOpen && !prevProps.isOpen) {
this.init();
this.setState({ isOpen: true });
// let render() renders Modal Dialog first
return;
}
// now Modal Dialog is rendered and we can refer this._element and this._dialog
if (this.props.autoFocus && this.state.isOpen && !prevState.isOpen) {
this.setFocus();
}
if (this._element && prevProps.zIndex !== this.props.zIndex) {
this._element.style.zIndex = this.props.zIndex;
}
}
componentWillUnmount() {
this.clearBackdropAnimationTimeout();
if (this.props.onExit) {
this.props.onExit();
}
if (this._element) {
this.destroy();
if (this.props.isOpen || this.state.isOpen) {
this.close();
}
}
document.removeEventListener('focus', this.trapFocus, true);
this._isMounted = false;
}
// not mouseUp because scrollbar fires it, shouldn't close when user scrolls
handleBackdropClick(e) {
if (e.target === this._mouseDownElement) {
e.stopPropagation();
const backdrop = this._dialog ? this._dialog.parentNode : null;
if (
backdrop &&
e.target === backdrop &&
this.props.backdrop === 'static'
) {
this.handleStaticBackdropAnimation();
}
if (!this.props.isOpen || this.props.backdrop !== true) return;
if (backdrop && e.target === backdrop && this.props.toggle) {
this.props.toggle(e);
}
}
}
handleTab(e) {
if (e.which !== 9) return;
if (this.modalIndex < Modal.openCount - 1) return; // last opened modal
const focusableChildren = this.getFocusableChildren();
const totalFocusable = focusableChildren.length;
if (totalFocusable === 0) return;
const currentFocus = this.getFocusedChild();
let focusedIndex = 0;
for (let i = 0; i < totalFocusable; i += 1) {
if (focusableChildren[i] === currentFocus) {
focusedIndex = i;
break;
}
}
if (e.shiftKey && focusedIndex === 0) {
e.preventDefault();
focusableChildren[totalFocusable - 1].focus();
} else if (!e.shiftKey && focusedIndex === totalFocusable - 1) {
e.preventDefault();
focusableChildren[0].focus();
}
}
handleBackdropMouseDown(e) {
this._mouseDownElement = e.target;
}
handleEscape(e) {
if (this.props.isOpen && e.keyCode === keyCodes.esc && this.props.toggle) {
if (this.props.keyboard) {
e.preventDefault();
e.stopPropagation();
this.props.toggle(e);
} else if (this.props.backdrop === 'static') {
e.preventDefault();
e.stopPropagation();
this.handleStaticBackdropAnimation();
}
}
}
handleStaticBackdropAnimation() {
this.clearBackdropAnimationTimeout();
this.setState({ showStaticBackdropAnimation: true });
this._backdropAnimationTimeout = setTimeout(() => {
this.setState({ showStaticBackdropAnimation: false });
}, 100);
}
onOpened(node, isAppearing) {
this.props.onOpened();
(this.props.modalTransition.onEntered || noop)(node, isAppearing);
}
onClosed(node) {
const { unmountOnClose } = this.props;
// so all methods get called before it is unmounted
this.props.onClosed();
(this.props.modalTransition.onExited || noop)(node);
if (unmountOnClose) {
this.destroy();
}
this.close();
if (this._isMounted) {
this.setState({ isOpen: false });
}
}
setFocus() {
if (
this._dialog &&
this._dialog.parentNode &&
typeof this._dialog.parentNode.focus === 'function'
) {
this._dialog.parentNode.focus();
}
}
getFocusableChildren() {
return this._element.querySelectorAll(focusableElements.join(', '));
}
getFocusedChild() {
let currentFocus;
const focusableChildren = this.getFocusableChildren();
try {
currentFocus = document.activeElement;
} catch (err) {
currentFocus = focusableChildren[0];
}
return currentFocus;
}
trapFocus(ev) {
if (!this.props.trapFocus) {
return;
}
if (!this._element) {
// element is not attached
return;
}
if (this._dialog && this._dialog.parentNode === ev.target) {
// initial focus when the Modal is opened
return;
}
if (this.modalIndex < Modal.openCount - 1) {
// last opened modal
return;
}
const children = this.getFocusableChildren();
for (let i = 0; i < children.length; i += 1) {
// focus is already inside the Modal
if (children[i] === ev.target) return;
}
if (children.length > 0) {
// otherwise focus the first focusable element in the Modal
ev.preventDefault();
ev.stopPropagation();
children[0].focus();
}
}
init() {
try {
this._triggeringElement = document.activeElement;
} catch (err) {
this._triggeringElement = null;
}
if (!this._element) {
this._element = document.createElement('div');
this._element.setAttribute('tabindex', '-1');
this._element.style.position = 'relative';
this._element.style.zIndex = this.props.zIndex;
this._mountContainer = getTarget(this.props.container);
this._mountContainer.appendChild(this._element);
}
this._originalBodyPadding = getOriginalBodyPadding();
if (Modal.openCount < 1) {
Modal.originalBodyOverflow = window.getComputedStyle(
document.body,
).overflow;
}
conditionallyUpdateScrollbar();
if (Modal.openCount === 0) {
document.body.className = classNames(
document.body.className,
mapToCssModules('modal-open', this.props.cssModule),
);
document.body.style.overflow = 'hidden';
}
this.modalIndex = Modal.openCount;
Modal.openCount += 1;
}
destroy() {
if (this._element) {
this._mountContainer.removeChild(this._element);
this._element = null;
}
this.manageFocusAfterClose();
}
manageFocusAfterClose() {
if (this._triggeringElement) {
const { returnFocusAfterClose } = this.props;
if (this._triggeringElement.focus && returnFocusAfterClose)
this._triggeringElement.focus();
this._triggeringElement = null;
}
}
close() {
if (Modal.openCount <= 1) {
const modalOpenClassName = mapToCssModules(
'modal-open',
this.props.cssModule,
);
// Use regex to prevent matching `modal-open` as part of a different class, e.g. `my-modal-opened`
const modalOpenClassNameRegex = new RegExp(
`(^| )${modalOpenClassName}( |$)`,
);
document.body.className = document.body.className
.replace(modalOpenClassNameRegex, ' ')
.trim();
document.body.style.overflow = Modal.originalBodyOverflow;
}
this.manageFocusAfterClose();
Modal.openCount = Math.max(0, Modal.openCount - 1);
setScrollbarWidth(this._originalBodyPadding);
}
clearBackdropAnimationTimeout() {
if (this._backdropAnimationTimeout) {
clearTimeout(this._backdropAnimationTimeout);
this._backdropAnimationTimeout = undefined;
}
}
renderModalDialog() {
const attributes = omit(this.props, propsToOmit);
const dialogBaseClass = 'modal-dialog';
return (
<div
{...attributes}
className={mapToCssModules(
classNames(dialogBaseClass, this.props.className, {
[`modal-${this.props.size}`]: this.props.size,
[`${dialogBaseClass}-centered`]: this.props.centered,
[`${dialogBaseClass}-scrollable`]: this.props.scrollable,
'modal-fullscreen': this.props.fullscreen === true,
[`modal-fullscreen-${this.props.fullscreen}-down`]:
typeof this.props.fullscreen === 'string',
}),
this.props.cssModule,
)}
role="document"
ref={(c) => {
this._dialog = c;
}}
>
<div
className={mapToCssModules(
classNames('modal-content', this.props.contentClassName),
this.props.cssModule,
)}
>
{this.props.children}
</div>
</div>
);
}
render() {
const { unmountOnClose } = this.props;
if (!!this._element && (this.state.isOpen || !unmountOnClose)) {
const isModalHidden =
!!this._element && !this.state.isOpen && !unmountOnClose;
this._element.style.display = isModalHidden ? 'none' : 'block';
const {
wrapClassName,
modalClassName,
backdropClassName,
cssModule,
isOpen,
backdrop,
role,
labelledBy,
external,
innerRef,
} = this.props;
const modalAttributes = {
onClick: this.handleBackdropClick,
onMouseDown: this.handleBackdropMouseDown,
onKeyUp: this.handleEscape,
onKeyDown: this.handleTab,
style: { display: 'block' },
'aria-labelledby': labelledBy,
'aria-modal': true,
role,
tabIndex: '-1',
};
const hasTransition = this.props.fade;
const modalTransition = {
...Fade.defaultProps,
...this.props.modalTransition,
baseClass: hasTransition ? this.props.modalTransition.baseClass : '',
timeout: hasTransition ? this.props.modalTransition.timeout : 0,
};
const backdropTransition = {
...Fade.defaultProps,
...this.props.backdropTransition,
baseClass: hasTransition ? this.props.backdropTransition.baseClass : '',
timeout: hasTransition ? this.props.backdropTransition.timeout : 0,
};
const Backdrop =
backdrop &&
(hasTransition ? (
<Fade
{...backdropTransition}
in={isOpen && !!backdrop}
cssModule={cssModule}
className={mapToCssModules(
classNames('modal-backdrop', backdropClassName),
cssModule,
)}
/>
) : (
<div
className={mapToCssModules(
classNames('modal-backdrop', 'show', backdropClassName),
cssModule,
)}
/>
));
return (
<Portal node={this._element}>
<div className={mapToCssModules(wrapClassName)}>
<Fade
{...modalAttributes}
{...modalTransition}
in={isOpen}
onEntered={this.onOpened}
onExited={this.onClosed}
cssModule={cssModule}
className={mapToCssModules(
classNames(
'modal',
modalClassName,
this.state.showStaticBackdropAnimation && 'modal-static',
),
cssModule,
)}
innerRef={innerRef}
>
{external}
{this.renderModalDialog()}
</Fade>
{Backdrop}
</div>
</Portal>
);
}
return null;
}
}
Modal.propTypes = propTypes;
Modal.defaultProps = defaultProps;
Modal.openCount = 0;
Modal.originalBodyOverflow = null;
export default Modal;

27
node_modules/reactstrap/src/ModalBody.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
/** Add custom class */
className: PropTypes.string,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
/** Set a custom element for this component */
tag: tagPropType,
};
function ModalBody(props) {
const { className, cssModule, tag: Tag = 'div', ...attributes } = props;
const classes = mapToCssModules(
classNames(className, 'modal-body'),
cssModule,
);
return <Tag {...attributes} className={classes} />;
}
ModalBody.propTypes = propTypes;
export default ModalBody;

27
node_modules/reactstrap/src/ModalFooter.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
/** Add custom class */
className: PropTypes.string,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
/** Set a custom element for this component */
tag: tagPropType,
};
function ModalFooter(props) {
const { className, cssModule, tag: Tag = 'div', ...attributes } = props;
const classes = mapToCssModules(
classNames(className, 'modal-footer'),
cssModule,
);
return <Tag {...attributes} className={classes} />;
}
ModalFooter.propTypes = propTypes;
export default ModalFooter;

64
node_modules/reactstrap/src/ModalHeader.js generated vendored Normal file
View File

@@ -0,0 +1,64 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
children: PropTypes.node,
/** Add custom class */
className: PropTypes.string,
/** Custom close button */
close: PropTypes.object,
closeAriaLabel: PropTypes.string,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
/** Set a custom element for this component */
tag: tagPropType,
/** Function to be triggered when close button is clicked */
toggle: PropTypes.func,
wrapTag: tagPropType,
};
function ModalHeader(props) {
let closeButton;
const {
className,
cssModule,
children,
toggle,
tag: Tag = 'h5',
wrapTag: WrapTag = 'div',
closeAriaLabel = 'Close',
close,
...attributes
} = props;
const classes = mapToCssModules(
classNames(className, 'modal-header'),
cssModule,
);
if (!close && toggle) {
closeButton = (
<button
type="button"
onClick={toggle}
className={mapToCssModules('btn-close', cssModule)}
aria-label={closeAriaLabel}
/>
);
}
return (
<WrapTag {...attributes} className={classes}>
<Tag className={mapToCssModules('modal-title', cssModule)}>
{children}
</Tag>
{close || closeButton}
</WrapTag>
);
}
ModalHeader.propTypes = propTypes;
export default ModalHeader;

81
node_modules/reactstrap/src/Nav.js generated vendored Normal file
View File

@@ -0,0 +1,81 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
/** Adding card prop adds `.card-header-tabs` or `.card-header-pills` class */
card: PropTypes.bool,
/** Add custom class */
className: PropTypes.string,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
/** fills the nav to extend to full available width */
fill: PropTypes.bool,
/** Change the horizontal alignment of your nav */
horizontal: PropTypes.oneOf(['center', 'end']),
/** All horizontal space will be occupied by nav links, but unlike the `fill` above, every nav item will be the same width. */
justified: PropTypes.bool,
/** Add navbar for a full-height and lightweight navigation */
navbar: PropTypes.bool,
/** Make NavItems look like pills */
pills: PropTypes.bool,
/** Make NavItems look like tabs */
tabs: PropTypes.bool,
/** Set a custom element for this component */
tag: tagPropType,
/** Stack your navigation by changing the flex item direction */
vertical: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
};
const getVerticalClass = (vertical) => {
if (vertical === false) {
return false;
}
if (vertical === true || vertical === 'xs') {
return 'flex-column';
}
return `flex-${vertical}-column`;
};
function Nav(props) {
const {
className,
cssModule,
tabs,
pills,
vertical = false,
horizontal,
justified,
fill,
navbar,
card,
tag: Tag = 'ul',
...attributes
} = props;
const classes = mapToCssModules(
classNames(
className,
navbar ? 'navbar-nav' : 'nav',
horizontal ? `justify-content-${horizontal}` : false,
getVerticalClass(vertical),
{
'nav-tabs': tabs,
'card-header-tabs': card && tabs,
'nav-pills': pills,
'card-header-pills': card && pills,
'nav-justified': justified,
'nav-fill': fill,
},
),
cssModule,
);
return <Tag {...attributes} className={classes} />;
}
Nav.propTypes = propTypes;
export default Nav;

36
node_modules/reactstrap/src/NavItem.js generated vendored Normal file
View File

@@ -0,0 +1,36 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
/** Add active class to element */
active: PropTypes.bool,
/** Add custom class */
className: PropTypes.string,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
/** Set a custom element for this component */
tag: tagPropType,
};
function NavItem(props) {
const {
className,
cssModule,
active,
tag: Tag = 'li',
...attributes
} = props;
const classes = mapToCssModules(
classNames(className, 'nav-item', active ? 'active' : false),
cssModule,
);
return <Tag {...attributes} className={classes} />;
}
NavItem.propTypes = propTypes;
export default NavItem;

80
node_modules/reactstrap/src/NavLink.js generated vendored Normal file
View File

@@ -0,0 +1,80 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
/** Add active class to NavLink */
active: PropTypes.bool,
/** Add custom class */
className: PropTypes.string,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
/** Disable the link */
disabled: PropTypes.bool,
href: PropTypes.any,
innerRef: PropTypes.oneOfType([
PropTypes.object,
PropTypes.func,
PropTypes.string,
]),
/** Function to be triggered on click */
onClick: PropTypes.func,
/** Set a custom element for this component */
tag: tagPropType,
};
class NavLink extends React.Component {
constructor(props) {
super(props);
this.onClick = this.onClick.bind(this);
}
onClick(e) {
if (this.props.disabled) {
e.preventDefault();
return;
}
if (this.props.href === '#') {
e.preventDefault();
}
if (this.props.onClick) {
this.props.onClick(e);
}
}
render() {
let {
className,
cssModule,
active,
tag: Tag = 'a',
innerRef,
...attributes
} = this.props;
const classes = mapToCssModules(
classNames(className, 'nav-link', {
disabled: attributes.disabled,
active: active,
}),
cssModule,
);
return (
<Tag
{...attributes}
ref={innerRef}
onClick={this.onClick}
className={classes}
/>
);
}
}
NavLink.propTypes = propTypes;
export default NavLink;

81
node_modules/reactstrap/src/Navbar.js generated vendored Normal file
View File

@@ -0,0 +1,81 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
children: PropTypes.node,
/** Add custom class */
className: PropTypes.string,
/** Theme the navbar by adding a background color */
color: PropTypes.string,
/** Use any of the responsive containers to change how wide the content in your navbar is presented. */
container: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
/** This prop is passed if the background is dark, to make the text lighter */
dark: PropTypes.bool,
/** Determine if to show toggler button */
expand: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
/** Make the navbar fixed at the top */
fixed: PropTypes.string,
/** Add `.navbar-light` class */
light: PropTypes.bool,
role: PropTypes.string,
/** Use `position: sticky` which isn't fully supported in every browser */
sticky: PropTypes.string,
/** Set a custom element for this component */
tag: tagPropType,
};
const getExpandClass = (expand) => {
if (expand === false) {
return false;
}
if (expand === true || expand === 'xs') {
return 'navbar-expand';
}
return `navbar-expand-${expand}`;
};
function Navbar(props) {
const {
expand = false,
className,
cssModule,
light,
dark,
fixed,
sticky,
color,
container = 'fluid',
tag: Tag = 'nav',
children,
...attributes
} = props;
const classes = mapToCssModules(
classNames(className, 'navbar', getExpandClass(expand), {
'navbar-light': light,
'navbar-dark': dark,
[`bg-${color}`]: color,
[`fixed-${fixed}`]: fixed,
[`sticky-${sticky}`]: sticky,
}),
cssModule,
);
const containerClass =
container && container === true ? 'container' : `container-${container}`;
return (
<Tag {...attributes} className={classes}>
{container ? <div className={containerClass}>{children}</div> : children}
</Tag>
);
}
Navbar.propTypes = propTypes;
export default Navbar;

28
node_modules/reactstrap/src/NavbarBrand.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
/** Add custom class */
className: PropTypes.string,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
/** Set a custom element for this component */
tag: tagPropType,
};
function NavbarBrand(props) {
const { className, cssModule, tag: Tag = 'a', ...attributes } = props;
const classes = mapToCssModules(
classNames(className, 'navbar-brand'),
cssModule,
);
return <Tag {...attributes} className={classes} />;
}
NavbarBrand.propTypes = propTypes;
export default NavbarBrand;

35
node_modules/reactstrap/src/NavbarText.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
/** Add custom class */
className: PropTypes.string,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
/** Set a custom element for this component */
tag: tagPropType,
active: PropTypes.bool,
};
function NavbarText(props) {
const {
className,
cssModule,
active,
tag: Tag = 'span',
...attributes
} = props;
const classes = mapToCssModules(
classNames(className, 'navbar-text'),
cssModule,
);
return <Tag {...attributes} className={classes} />;
}
NavbarText.propTypes = propTypes;
export default NavbarText;

47
node_modules/reactstrap/src/NavbarToggler.js generated vendored Normal file
View File

@@ -0,0 +1,47 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
/** Add custom class */
className: PropTypes.string,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
/** Set a custom element for this component */
tag: tagPropType,
type: PropTypes.string,
/** Pass children so this component can wrap the child elements */
children: PropTypes.node,
};
function NavbarToggler(props) {
const {
className,
cssModule,
children,
tag: Tag = 'button',
...attributes
} = props;
const classes = mapToCssModules(
classNames(className, 'navbar-toggler'),
cssModule,
);
return (
<Tag
aria-label="Toggle navigation"
{...{ type: 'button', ...attributes }}
className={classes}
>
{children || (
<span className={mapToCssModules('navbar-toggler-icon', cssModule)} />
)}
</Tag>
);
}
NavbarToggler.propTypes = propTypes;
export default NavbarToggler;

473
node_modules/reactstrap/src/Offcanvas.js generated vendored Normal file
View File

@@ -0,0 +1,473 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import Portal from './Portal';
import Fade from './Fade';
import {
TransitionTimeouts,
conditionallyUpdateScrollbar,
focusableElements,
getOriginalBodyPadding,
getTarget,
keyCodes,
mapToCssModules,
omit,
setScrollbarWidth,
targetPropType,
} from './utils';
function noop() {}
const FadePropTypes = PropTypes.shape(Fade.propTypes);
const propTypes = {
autoFocus: PropTypes.bool,
backdrop: PropTypes.bool,
backdropClassName: PropTypes.string,
backdropTransition: FadePropTypes,
children: PropTypes.node,
className: PropTypes.string,
container: targetPropType,
cssModule: PropTypes.object,
direction: PropTypes.oneOf(['start', 'end', 'bottom', 'top']),
fade: PropTypes.bool,
innerRef: PropTypes.oneOfType([
PropTypes.object,
PropTypes.string,
PropTypes.func,
]),
isOpen: PropTypes.bool,
keyboard: PropTypes.bool,
labelledBy: PropTypes.string,
offcanvasTransition: FadePropTypes,
onClosed: PropTypes.func,
onEnter: PropTypes.func,
onExit: PropTypes.func,
style: PropTypes.object,
onOpened: PropTypes.func,
returnFocusAfterClose: PropTypes.bool,
role: PropTypes.string,
scrollable: PropTypes.bool,
toggle: PropTypes.func,
trapFocus: PropTypes.bool,
unmountOnClose: PropTypes.bool,
zIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
};
const propsToOmit = Object.keys(propTypes);
const defaultProps = {
isOpen: false,
autoFocus: true,
direction: 'start',
scrollable: false,
role: 'dialog',
backdrop: true,
keyboard: true,
zIndex: 1050,
fade: true,
onOpened: noop,
onClosed: noop,
offcanvasTransition: {
timeout: TransitionTimeouts.Offcanvas,
},
backdropTransition: {
mountOnEnter: true,
timeout: TransitionTimeouts.Fade, // uses standard fade transition
},
unmountOnClose: true,
returnFocusAfterClose: true,
container: 'body',
trapFocus: false,
};
class Offcanvas extends React.Component {
constructor(props) {
super(props);
this._element = null;
this._originalBodyPadding = null;
this.getFocusableChildren = this.getFocusableChildren.bind(this);
this.handleBackdropClick = this.handleBackdropClick.bind(this);
this.handleBackdropMouseDown = this.handleBackdropMouseDown.bind(this);
this.handleEscape = this.handleEscape.bind(this);
this.handleTab = this.handleTab.bind(this);
this.onOpened = this.onOpened.bind(this);
this.onClosed = this.onClosed.bind(this);
this.manageFocusAfterClose = this.manageFocusAfterClose.bind(this);
this.clearBackdropAnimationTimeout =
this.clearBackdropAnimationTimeout.bind(this);
this.trapFocus = this.trapFocus.bind(this);
this._backdrop = React.createRef();
this._dialog = React.createRef();
this.state = {
isOpen: false,
};
}
componentDidMount() {
const { isOpen, autoFocus, onEnter } = this.props;
if (isOpen) {
this.init();
this.setState({ isOpen: true });
if (autoFocus) {
this.setFocus();
}
}
if (onEnter) {
onEnter();
}
// traps focus inside the Offcanvas, even if the browser address bar is focused
document.addEventListener('focus', this.trapFocus, true);
this._isMounted = true;
}
componentDidUpdate(prevProps, prevState) {
if (this.props.isOpen && !prevProps.isOpen) {
this.init();
this.setState({ isOpen: true });
return;
}
// now Offcanvas Dialog is rendered and we can refer this._element and this._dialog
if (this.props.autoFocus && this.state.isOpen && !prevState.isOpen) {
this.setFocus();
}
if (this._element && prevProps.zIndex !== this.props.zIndex) {
this._element.style.zIndex = this.props.zIndex;
}
}
componentWillUnmount() {
this.clearBackdropAnimationTimeout();
if (this.props.onExit) {
this.props.onExit();
}
if (this._element) {
this.destroy();
if (this.props.isOpen || this.state.isOpen) {
this.close();
}
}
document.removeEventListener('focus', this.trapFocus, true);
this._isMounted = false;
}
// not mouseUp because scrollbar fires it, shouldn't close when user scrolls
handleBackdropClick(e) {
if (e.target === this._mouseDownElement) {
e.stopPropagation();
const backdrop = this._backdrop.current;
if (!this.props.isOpen || this.props.backdrop !== true) return;
if (backdrop && e.target === backdrop && this.props.toggle) {
this.props.toggle(e);
}
}
}
handleTab(e) {
if (e.which !== 9) return;
if (this.offcanvasIndex < Offcanvas.openCount - 1) return; // last opened offcanvas
const focusableChildren = this.getFocusableChildren();
const totalFocusable = focusableChildren.length;
if (totalFocusable === 0) return;
const currentFocus = this.getFocusedChild();
let focusedIndex = 0;
for (let i = 0; i < totalFocusable; i += 1) {
if (focusableChildren[i] === currentFocus) {
focusedIndex = i;
break;
}
}
if (e.shiftKey && focusedIndex === 0) {
e.preventDefault();
focusableChildren[totalFocusable - 1].focus();
} else if (!e.shiftKey && focusedIndex === totalFocusable - 1) {
e.preventDefault();
focusableChildren[0].focus();
}
}
handleBackdropMouseDown(e) {
this._mouseDownElement = e.target;
}
handleEscape(e) {
if (this.props.isOpen && e.keyCode === keyCodes.esc && this.props.toggle) {
if (this.props.keyboard) {
e.preventDefault();
e.stopPropagation();
this.props.toggle(e);
}
}
}
onOpened(node, isAppearing) {
this.props.onOpened();
(this.props.offcanvasTransition.onEntered || noop)(node, isAppearing);
}
onClosed(node) {
const { unmountOnClose } = this.props;
// so all methods get called before it is unmounted
this.props.onClosed();
(this.props.offcanvasTransition.onExited || noop)(node);
if (unmountOnClose) {
this.destroy();
}
this.close();
if (this._isMounted) {
this.setState({ isOpen: false });
}
}
setFocus() {
if (
this._dialog.current &&
typeof this._dialog.current.focus === 'function'
) {
this._dialog.current.focus();
}
}
getFocusableChildren() {
return this._element.querySelectorAll(focusableElements.join(', '));
}
getFocusedChild() {
let currentFocus;
const focusableChildren = this.getFocusableChildren();
try {
currentFocus = document.activeElement;
} catch (err) {
currentFocus = focusableChildren[0];
}
return currentFocus;
}
trapFocus(ev) {
if (!this.props.trapFocus) {
return;
}
if (!this._element) {
// element is not attached
return;
}
if (this._dialog.current === ev.target) {
// initial focus when the Offcanvas is opened
return;
}
if (this.offcanvasIndex < Offcanvas.openCount - 1) {
// last opened offcanvas
return;
}
const children = this.getFocusableChildren();
for (let i = 0; i < children.length; i += 1) {
// focus is already inside the Offcanvas
if (children[i] === ev.target) return;
}
if (children.length > 0) {
// otherwise focus the first focusable element in the Offcanvas
ev.preventDefault();
ev.stopPropagation();
children[0].focus();
}
}
init() {
try {
this._triggeringElement = document.activeElement;
} catch (err) {
this._triggeringElement = null;
}
if (!this._element) {
this._element = document.createElement('div');
this._element.setAttribute('tabindex', '-1');
this._element.style.position = 'relative';
this._element.style.zIndex = this.props.zIndex;
this._mountContainer = getTarget(this.props.container);
this._mountContainer.appendChild(this._element);
}
this._originalBodyPadding = getOriginalBodyPadding();
conditionallyUpdateScrollbar();
if (
Offcanvas.openCount === 0 &&
this.props.backdrop &&
!this.props.scrollable
) {
document.body.style.overflow = 'hidden';
}
this.offcanvasIndex = Offcanvas.openCount;
Offcanvas.openCount += 1;
}
destroy() {
if (this._element) {
this._mountContainer.removeChild(this._element);
this._element = null;
}
this.manageFocusAfterClose();
}
manageFocusAfterClose() {
if (this._triggeringElement) {
const { returnFocusAfterClose } = this.props;
if (this._triggeringElement.focus && returnFocusAfterClose)
this._triggeringElement.focus();
this._triggeringElement = null;
}
}
close() {
this.manageFocusAfterClose();
Offcanvas.openCount = Math.max(0, Offcanvas.openCount - 1);
document.body.style.overflow = null;
setScrollbarWidth(this._originalBodyPadding);
}
clearBackdropAnimationTimeout() {
if (this._backdropAnimationTimeout) {
clearTimeout(this._backdropAnimationTimeout);
this._backdropAnimationTimeout = undefined;
}
}
render() {
const { direction, unmountOnClose } = this.props;
if (!!this._element && (this.state.isOpen || !unmountOnClose)) {
const isOffcanvasHidden =
!!this._element && !this.state.isOpen && !unmountOnClose;
this._element.style.display = isOffcanvasHidden ? 'none' : 'block';
const {
className,
backdropClassName,
cssModule,
isOpen,
backdrop,
role,
labelledBy,
style,
} = this.props;
const offcanvasAttributes = {
onKeyUp: this.handleEscape,
onKeyDown: this.handleTab,
'aria-labelledby': labelledBy,
role,
tabIndex: '-1',
};
const hasTransition = this.props.fade;
const offcanvasTransition = {
...Fade.defaultProps,
...this.props.offcanvasTransition,
baseClass: hasTransition
? this.props.offcanvasTransition.baseClass
: '',
timeout: hasTransition ? this.props.offcanvasTransition.timeout : 0,
};
const backdropTransition = {
...Fade.defaultProps,
...this.props.backdropTransition,
baseClass: hasTransition ? this.props.backdropTransition.baseClass : '',
timeout: hasTransition ? this.props.backdropTransition.timeout : 0,
};
const Backdrop =
backdrop &&
(hasTransition ? (
<Fade
{...backdropTransition}
in={isOpen && !!backdrop}
innerRef={this._backdrop}
cssModule={cssModule}
className={mapToCssModules(
classNames('offcanvas-backdrop', backdropClassName),
cssModule,
)}
onClick={this.handleBackdropClick}
onMouseDown={this.handleBackdropMouseDown}
/>
) : (
<div
className={mapToCssModules(
classNames('offcanvas-backdrop', 'show', backdropClassName),
cssModule,
)}
ref={this._backdrop}
onClick={this.handleBackdropClick}
onMouseDown={this.handleBackdropMouseDown}
/>
));
const attributes = omit(this.props, propsToOmit);
return (
<Portal node={this._element}>
<Fade
{...attributes}
{...offcanvasAttributes}
{...offcanvasTransition}
in={isOpen}
onEntered={this.onOpened}
onExited={this.onClosed}
cssModule={cssModule}
className={mapToCssModules(
classNames('offcanvas', className, `offcanvas-${direction}`),
cssModule,
)}
innerRef={this._dialog}
style={{
...style,
visibility: isOpen ? 'visible' : 'hidden',
}}
>
{this.props.children}
</Fade>
{Backdrop}
</Portal>
);
}
return null;
}
}
Offcanvas.propTypes = propTypes;
Offcanvas.defaultProps = defaultProps;
Offcanvas.openCount = 0;
export default Offcanvas;

24
node_modules/reactstrap/src/OffcanvasBody.js generated vendored Normal file
View File

@@ -0,0 +1,24 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
tag: tagPropType,
className: PropTypes.string,
cssModule: PropTypes.object,
};
function OffcanvasBody(props) {
const { className, cssModule, tag: Tag = 'div', ...attributes } = props;
const classes = mapToCssModules(
classNames(className, 'offcanvas-body'),
cssModule,
);
return <Tag {...attributes} className={classes} />;
}
OffcanvasBody.propTypes = propTypes;
export default OffcanvasBody;

59
node_modules/reactstrap/src/OffcanvasHeader.js generated vendored Normal file
View File

@@ -0,0 +1,59 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
children: PropTypes.node,
className: PropTypes.string,
close: PropTypes.object,
closeAriaLabel: PropTypes.string,
cssModule: PropTypes.object,
tag: tagPropType,
toggle: PropTypes.func,
wrapTag: tagPropType,
};
function OffcanvasHeader(props) {
let closeButton;
const {
children,
className,
close,
closeAriaLabel = 'Close',
cssModule,
tag: Tag = 'h5',
toggle,
wrapTag: WrapTag = 'div',
...attributes
} = props;
const classes = mapToCssModules(
classNames(className, 'offcanvas-header'),
cssModule,
);
if (!close && toggle) {
closeButton = (
<button
type="button"
onClick={toggle}
className={mapToCssModules('btn-close', cssModule)}
aria-label={closeAriaLabel}
/>
);
}
return (
<WrapTag {...attributes} className={classes}>
<Tag className={mapToCssModules('offcanvas-title', cssModule)}>
{children}
</Tag>
{close || closeButton}
</WrapTag>
);
}
OffcanvasHeader.propTypes = propTypes;
export default OffcanvasHeader;

53
node_modules/reactstrap/src/Pagination.js generated vendored Normal file
View File

@@ -0,0 +1,53 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
children: PropTypes.node,
/** Add custom class */
className: PropTypes.string,
/** Add custom class for list */
listClassName: PropTypes.string,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
/** Make the Pagination bigger or smaller */
size: PropTypes.string,
/** Set a custom element for this component */
tag: tagPropType,
/** Set a custom element for list component */
listTag: tagPropType,
'aria-label': PropTypes.string,
};
function Pagination(props) {
const {
className,
listClassName,
cssModule,
size,
tag: Tag = 'nav',
listTag: ListTag = 'ul',
'aria-label': label = 'pagination',
...attributes
} = props;
const classes = mapToCssModules(classNames(className), cssModule);
const listClasses = mapToCssModules(
classNames(listClassName, 'pagination', {
[`pagination-${size}`]: !!size,
}),
cssModule,
);
return (
<Tag className={classes} aria-label={label}>
<ListTag {...attributes} className={listClasses} />
</Tag>
);
}
Pagination.propTypes = propTypes;
export default Pagination;

43
node_modules/reactstrap/src/PaginationItem.js generated vendored Normal file
View File

@@ -0,0 +1,43 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
/** Set item as active */
active: PropTypes.bool,
children: PropTypes.node,
/** Add custom class */
className: PropTypes.string,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
/** Set item as disabled */
disabled: PropTypes.bool,
/** Set a custom element for this component */
tag: tagPropType,
};
function PaginationItem(props) {
const {
active,
className,
cssModule,
disabled,
tag: Tag = 'li',
...attributes
} = props;
const classes = mapToCssModules(
classNames(className, 'page-item', {
active,
disabled,
}),
cssModule,
);
return <Tag {...attributes} className={classes} />;
}
PaginationItem.propTypes = propTypes;
export default PaginationItem;

95
node_modules/reactstrap/src/PaginationLink.js generated vendored Normal file
View File

@@ -0,0 +1,95 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
'aria-label': PropTypes.string,
children: PropTypes.node,
/** Add custom class */
className: PropTypes.string,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
/** Add to next button to add default aria label and icon */
next: PropTypes.bool,
/** Add to previous button to add default aria label and icon */
previous: PropTypes.bool,
/** Add to first button to add default aria label and icon */
first: PropTypes.bool,
/** Add to last button to add default aria label and icon */
last: PropTypes.bool,
/** Set a custom element for this component */
tag: tagPropType,
};
function PaginationLink(props) {
let {
className,
cssModule,
next,
previous,
first,
last,
tag: Tag = 'a',
...attributes
} = props;
const classes = mapToCssModules(
classNames(className, 'page-link'),
cssModule,
);
let defaultAriaLabel;
if (previous) {
defaultAriaLabel = 'Previous';
} else if (next) {
defaultAriaLabel = 'Next';
} else if (first) {
defaultAriaLabel = 'First';
} else if (last) {
defaultAriaLabel = 'Last';
}
const ariaLabel = props['aria-label'] || defaultAriaLabel;
let defaultCaret;
if (previous) {
defaultCaret = '\u2039';
} else if (next) {
defaultCaret = '\u203A';
} else if (first) {
defaultCaret = '\u00ab';
} else if (last) {
defaultCaret = '\u00bb';
}
let { children } = props;
if (children && Array.isArray(children) && children.length === 0) {
children = null;
}
if (!attributes.href && Tag === 'a') {
Tag = 'button';
}
if (previous || next || first || last) {
children = [
<span aria-hidden="true" key="caret">
{children || defaultCaret}
</span>,
<span className="visually-hidden" key="ariaLabel">
{ariaLabel}
</span>,
];
}
return (
<Tag {...attributes} className={classes} aria-label={ariaLabel}>
{children}
</Tag>
);
}
PaginationLink.propTypes = propTypes;
export default PaginationLink;

59
node_modules/reactstrap/src/Placeholder.js generated vendored Normal file
View File

@@ -0,0 +1,59 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
import Col, { getColumnClasses } from './Col';
const propTypes = {
...Col.propTypes,
/** Add custom color to the placeholder */
color: PropTypes.string,
/** Add custom tag. */
tag: tagPropType,
/** Apply either `glow` or `wave` animation. */
animation: PropTypes.oneOf(['glow', 'wave']),
innerRef: PropTypes.oneOfType([
PropTypes.object,
PropTypes.func,
PropTypes.string,
]),
/** Make the size larger */
size: PropTypes.oneOf(['lg', 'sm', 'xs']),
};
function Placeholder(props) {
let {
className,
cssModule,
color,
innerRef,
tag: Tag = 'span',
animation,
size,
widths,
...attributes
} = props;
let { modifiedAttributes, colClasses } = getColumnClasses(
attributes,
cssModule,
widths,
);
const classes = mapToCssModules(
classNames(
className,
colClasses,
'placeholder' + (animation ? '-' + animation : ''),
size ? 'placeholder-' + size : false,
color ? 'bg-' + color : false,
),
cssModule,
);
return <Tag {...modifiedAttributes} className={classes} ref={innerRef} />;
}
Placeholder.propTypes = propTypes;
export default Placeholder;

35
node_modules/reactstrap/src/PlaceholderButton.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
import Button from './Button';
import { getColumnClasses } from './Col';
const propTypes = {
size: PropTypes.string,
color: PropTypes.string,
outline: PropTypes.bool,
className: PropTypes.string,
tag: tagPropType,
cssModule: PropTypes.object,
};
function PlaceholderButton(props) {
let { cssModule, className, tag: Tag = Button, ...attributes } = props;
let { modifiedAttributes, colClasses } = getColumnClasses(
{ color: 'primary', ...attributes },
cssModule,
);
const classes = mapToCssModules(
classNames('placeholder', className, colClasses),
cssModule,
);
return <Tag {...modifiedAttributes} className={classes} disabled />;
}
PlaceholderButton.propTypes = propTypes;
export default PlaceholderButton;

30
node_modules/reactstrap/src/Popover.js generated vendored Normal file
View File

@@ -0,0 +1,30 @@
import React from 'react';
import classNames from 'classnames';
import TooltipPopoverWrapper, { propTypes } from './TooltipPopoverWrapper';
const defaultProps = {
placement: 'right',
placementPrefix: 'bs-popover',
trigger: 'click',
offset: [0, 8],
};
function Popover(props) {
const arrowClasses = classNames('popover-arrow', props.arrowClassName);
const popperClasses = classNames('popover', 'show', props.popperClassName);
const classes = classNames('popover-inner', props.innerClassName);
return (
<TooltipPopoverWrapper
{...props}
arrowClassName={arrowClasses}
popperClassName={popperClasses}
innerClassName={classes}
/>
);
}
Popover.propTypes = propTypes;
Popover.defaultProps = defaultProps;
export default Popover;

25
node_modules/reactstrap/src/PopoverBody.js generated vendored Normal file
View File

@@ -0,0 +1,25 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
tag: tagPropType,
className: PropTypes.string,
cssModule: PropTypes.object,
};
function PopoverBody(props) {
const { className, cssModule, tag: Tag = 'div', ...attributes } = props;
const classes = mapToCssModules(
classNames(className, 'popover-body'),
cssModule,
);
return <Tag {...attributes} className={classes} />;
}
PopoverBody.propTypes = propTypes;
export default PopoverBody;

25
node_modules/reactstrap/src/PopoverHeader.js generated vendored Normal file
View File

@@ -0,0 +1,25 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
tag: tagPropType,
className: PropTypes.string,
cssModule: PropTypes.object,
};
function PopoverHeader(props) {
const { className, cssModule, tag: Tag = 'h3', ...attributes } = props;
const classes = mapToCssModules(
classNames(className, 'popover-header'),
cssModule,
);
return <Tag {...attributes} className={classes} />;
}
PopoverHeader.propTypes = propTypes;
export default PopoverHeader;

238
node_modules/reactstrap/src/PopperContent.js generated vendored Normal file
View File

@@ -0,0 +1,238 @@
import React from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import classNames from 'classnames';
import { Popper as ReactPopper } from 'react-popper';
import {
getTarget,
targetPropType,
mapToCssModules,
DOMElement,
tagPropType,
} from './utils';
import Fade from './Fade';
function noop() {}
const propTypes = {
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
popperClassName: PropTypes.string,
placement: PropTypes.string,
placementPrefix: PropTypes.string,
arrowClassName: PropTypes.string,
hideArrow: PropTypes.bool,
tag: tagPropType,
isOpen: PropTypes.bool,
cssModule: PropTypes.object,
offset: PropTypes.arrayOf(PropTypes.number),
fallbackPlacements: PropTypes.array,
flip: PropTypes.bool,
container: targetPropType,
target: targetPropType.isRequired,
modifiers: PropTypes.array,
strategy: PropTypes.string,
boundariesElement: PropTypes.oneOfType([PropTypes.string, DOMElement]),
onClosed: PropTypes.func,
fade: PropTypes.bool,
transition: PropTypes.shape(Fade.propTypes),
};
const defaultProps = {
boundariesElement: 'scrollParent',
placement: 'auto',
hideArrow: false,
isOpen: false,
offset: [0, 0],
flip: true,
container: 'body',
modifiers: [],
onClosed: noop,
fade: true,
transition: {
...Fade.defaultProps,
},
};
class PopperContent extends React.Component {
constructor(props) {
super(props);
this.setTargetNode = this.setTargetNode.bind(this);
this.getTargetNode = this.getTargetNode.bind(this);
this.getRef = this.getRef.bind(this);
this.onClosed = this.onClosed.bind(this);
this.state = { isOpen: props.isOpen };
}
static getDerivedStateFromProps(props, state) {
if (props.isOpen && !state.isOpen) {
return { isOpen: props.isOpen };
}
return null;
}
componentDidUpdate() {
if (
this._element &&
this._element.childNodes &&
this._element.childNodes[0] &&
this._element.childNodes[0].focus
) {
this._element.childNodes[0].focus();
}
}
onClosed() {
this.props.onClosed();
this.setState({ isOpen: false });
}
getTargetNode() {
return this.targetNode;
}
getContainerNode() {
return getTarget(this.props.container);
}
getRef(ref) {
this._element = ref;
}
setTargetNode(node) {
this.targetNode = typeof node === 'string' ? getTarget(node) : node;
}
renderChildren() {
const {
cssModule,
children,
isOpen,
flip,
target,
offset,
fallbackPlacements,
placementPrefix,
arrowClassName: _arrowClassName,
hideArrow,
popperClassName: _popperClassName,
tag,
container,
modifiers,
strategy,
boundariesElement,
onClosed,
fade,
transition,
placement,
...attrs
} = this.props;
const arrowClassName = mapToCssModules(
classNames('arrow', _arrowClassName),
cssModule,
);
const popperClassName = mapToCssModules(
classNames(
_popperClassName,
placementPrefix ? `${placementPrefix}-auto` : '',
),
this.props.cssModule,
);
const modifierNames = modifiers.map((m) => m.name);
const baseModifiers = [
{
name: 'offset',
options: {
offset,
},
},
{
name: 'flip',
enabled: flip,
options: {
fallbackPlacements,
},
},
{
name: 'preventOverflow',
options: {
boundary: boundariesElement,
},
},
].filter((m) => !modifierNames.includes(m.name));
const extendedModifiers = [...baseModifiers, ...modifiers];
const popperTransition = {
...Fade.defaultProps,
...transition,
baseClass: fade ? transition.baseClass : '',
timeout: fade ? transition.timeout : 0,
};
return (
<Fade
{...popperTransition}
{...attrs}
in={isOpen}
onExited={this.onClosed}
tag={tag}
>
<ReactPopper
referenceElement={this.targetNode}
modifiers={extendedModifiers}
placement={placement}
strategy={strategy}
>
{({
ref,
style,
placement: popperPlacement,
isReferenceHidden,
arrowProps,
update,
}) => (
<div
ref={ref}
style={style}
className={popperClassName}
data-popper-placement={popperPlacement}
data-popper-reference-hidden={
isReferenceHidden ? 'true' : undefined
}
>
{typeof children === 'function' ? children({ update }) : children}
{!hideArrow && (
<span
ref={arrowProps.ref}
className={arrowClassName}
style={arrowProps.style}
/>
)}
</div>
)}
</ReactPopper>
</Fade>
);
}
render() {
this.setTargetNode(this.props.target);
if (this.state.isOpen) {
return this.props.container === 'inline'
? this.renderChildren()
: ReactDOM.createPortal(
<div ref={this.getRef}>{this.renderChildren()}</div>,
this.getContainerNode(),
);
}
return null;
}
}
PopperContent.propTypes = propTypes;
PopperContent.defaultProps = defaultProps;
export default PopperContent;

17
node_modules/reactstrap/src/PopperTargetHelper.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
import PropTypes from 'prop-types';
import { getTarget, targetPropType } from './utils';
function PopperTargetHelper(props, context) {
context.popperManager.setTargetNode(getTarget(props.target));
return null;
}
PopperTargetHelper.contextTypes = {
popperManager: PropTypes.object.isRequired,
};
PopperTargetHelper.propTypes = {
target: targetPropType.isRequired,
};
export default PopperTargetHelper;

38
node_modules/reactstrap/src/Portal.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
import React from 'react';
import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import { canUseDOM } from './utils';
const propTypes = {
children: PropTypes.node.isRequired,
node: PropTypes.any,
};
class Portal extends React.Component {
componentWillUnmount() {
if (this.defaultNode) {
document.body.removeChild(this.defaultNode);
}
this.defaultNode = null;
}
render() {
if (!canUseDOM) {
return null;
}
if (!this.props.node && !this.defaultNode) {
this.defaultNode = document.createElement('div');
document.body.appendChild(this.defaultNode);
}
return ReactDOM.createPortal(
this.props.children,
this.props.node || this.defaultNode,
);
}
}
Portal.propTypes = propTypes;
export default Portal;

104
node_modules/reactstrap/src/Progress.js generated vendored Normal file
View File

@@ -0,0 +1,104 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType, toNumber } from './utils';
const propTypes = {
/** Enable animation to bar */
animated: PropTypes.bool,
bar: PropTypes.bool,
barAriaLabelledBy: PropTypes.string,
barAriaValueText: PropTypes.string,
barClassName: PropTypes.string,
barStyle: PropTypes.object,
children: PropTypes.node,
/** Add custom class */
className: PropTypes.string,
/** Change underlying component's CSS base class name */
cssModule: PropTypes.object,
/** Add custom color to the placeholder */
color: PropTypes.string,
/** Maximum value of progress */
max: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
/** Minimum value of progress, defaults to zero */
min: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
multi: PropTypes.bool,
/** Add stripes to progress bar */
striped: PropTypes.bool,
style: PropTypes.object,
/** Set a custom element for this component */
tag: tagPropType,
/** Current value of progress */
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
};
function Progress(props) {
const {
children,
className,
barClassName,
cssModule,
value = 0,
min = 0,
max = 100,
animated,
striped,
color,
bar,
multi,
tag: Tag = 'div',
style = {},
barStyle = {},
barAriaValueText,
barAriaLabelledBy,
...attributes
} = props;
const percent = (toNumber(value) / toNumber(max)) * 100;
const progressClasses = mapToCssModules(
classNames(className, 'progress'),
cssModule,
);
const progressBarClasses = mapToCssModules(
classNames(
'progress-bar',
bar ? className || barClassName : barClassName,
animated ? 'progress-bar-animated' : null,
color ? `bg-${color}` : null,
striped || animated ? 'progress-bar-striped' : null,
),
cssModule,
);
const progressBarProps = {
className: progressBarClasses,
style: {
...(bar ? style : {}),
...barStyle,
width: `${percent}%`,
},
role: 'progressbar',
'aria-valuenow': value,
'aria-valuemin': min,
'aria-valuemax': max,
'aria-valuetext': barAriaValueText,
'aria-labelledby': barAriaLabelledBy,
children: children,
};
if (bar) {
return <Tag {...attributes} {...progressBarProps} />;
}
return (
<Tag {...attributes} style={style} className={progressClasses}>
{multi ? children : <div {...progressBarProps} />}
</Tag>
);
}
Progress.propTypes = propTypes;
export default Progress;

66
node_modules/reactstrap/src/Row.js generated vendored Normal file
View File

@@ -0,0 +1,66 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType, deprecated } from './utils';
const rowColWidths = ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
const rowColsPropType = PropTypes.oneOfType([
PropTypes.number,
PropTypes.string,
]);
const propTypes = {
tag: tagPropType,
noGutters: deprecated(
PropTypes.bool,
'Please use Bootstrap 5 gutter utility classes. https://getbootstrap.com/docs/5.0/layout/gutters/',
),
className: PropTypes.string,
cssModule: PropTypes.object,
xs: rowColsPropType,
sm: rowColsPropType,
md: rowColsPropType,
lg: rowColsPropType,
xl: rowColsPropType,
xxl: rowColsPropType,
widths: PropTypes.array,
};
function Row(props) {
const {
className,
cssModule,
noGutters,
tag: Tag = 'div',
widths = rowColWidths,
...attributes
} = props;
const colClasses = [];
widths.forEach((colWidth, i) => {
let colSize = props[colWidth];
delete attributes[colWidth];
if (!colSize) {
return;
}
const isXs = !i;
colClasses.push(
isXs ? `row-cols-${colSize}` : `row-cols-${colWidth}-${colSize}`,
);
});
const classes = mapToCssModules(
classNames(className, noGutters ? 'gx-0' : null, 'row', colClasses),
cssModule,
);
return <Tag {...attributes} className={classes} />;
}
Row.propTypes = propTypes;
export default Row;

67
node_modules/reactstrap/src/Spinner.js generated vendored Normal file
View File

@@ -0,0 +1,67 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
/** Set a custom element for this component */
tag: tagPropType,
/** Change animation of spinner */
type: PropTypes.oneOf(['border', 'grow']),
/** Change size of spinner */
size: PropTypes.oneOf(['sm']),
/** Change color of spinner */
color: PropTypes.oneOf([
'primary',
'secondary',
'success',
'danger',
'warning',
'info',
'light',
'dark',
]),
/** Add custom class */
className: PropTypes.string,
/** Change existing className with a new className */
cssModule: PropTypes.object,
/** Pass children so this component can wrap the child elements */
children: PropTypes.string,
};
function Spinner(props) {
const {
className,
cssModule,
type = 'border',
size,
color,
children = 'Loading...',
tag: Tag = 'div',
...attributes
} = props;
const classes = mapToCssModules(
classNames(
className,
size ? `spinner-${type}-${size}` : false,
`spinner-${type}`,
color ? `text-${color}` : false,
),
cssModule,
);
return (
<Tag role="status" {...attributes} className={classes}>
{children && (
<span className={mapToCssModules('visually-hidden', cssModule)}>
{children}
</span>
)}
</Tag>
);
}
Spinner.propTypes = propTypes;
export default Spinner;

51
node_modules/reactstrap/src/TabContent.js generated vendored Normal file
View File

@@ -0,0 +1,51 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { TabContext } from './TabContext';
import { mapToCssModules, omit, tagPropType } from './utils';
const propTypes = {
tag: tagPropType,
activeTab: PropTypes.any,
className: PropTypes.string,
cssModule: PropTypes.object,
};
class TabContent extends Component {
static getDerivedStateFromProps(nextProps, prevState) {
if (prevState.activeTab !== nextProps.activeTab) {
return {
activeTab: nextProps.activeTab,
};
}
return null;
}
constructor(props) {
super(props);
this.state = {
activeTab: this.props.activeTab,
};
}
render() {
const { className, cssModule, tag: Tag = 'div' } = this.props;
const attributes = omit(this.props, Object.keys(propTypes));
const classes = mapToCssModules(
classNames('tab-content', className),
cssModule,
);
return (
<TabContext.Provider value={{ activeTabId: this.state.activeTab }}>
<Tag {...attributes} className={classes} />
</TabContext.Provider>
);
}
}
export default TabContent;
TabContent.propTypes = propTypes;

9
node_modules/reactstrap/src/TabContext.js generated vendored Normal file
View File

@@ -0,0 +1,9 @@
import React from 'react';
/**
* TabContext
* {
* activeTabId: PropTypes.any
* }
*/
export const TabContext = React.createContext({});

35
node_modules/reactstrap/src/TabPane.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { TabContext } from './TabContext';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
tag: tagPropType,
className: PropTypes.string,
cssModule: PropTypes.object,
tabId: PropTypes.any,
};
export default function TabPane(props) {
const {
className,
cssModule,
tabId,
tag: Tag = 'div',
...attributes
} = props;
const getClasses = (activeTabId) =>
mapToCssModules(
classNames('tab-pane', className, { active: tabId === activeTabId }),
cssModule,
);
return (
<TabContext.Consumer>
{({ activeTabId }) => (
<Tag {...attributes} className={getClasses(activeTabId)} />
)}
</TabContext.Consumer>
);
}
TabPane.propTypes = propTypes;

86
node_modules/reactstrap/src/Table.js generated vendored Normal file
View File

@@ -0,0 +1,86 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
/** Adds border to all sides of table */
bordered: PropTypes.bool,
/** Removes all borders */
borderless: PropTypes.bool,
/** Adds custom class name to component */
className: PropTypes.string,
/** */
cssModule: PropTypes.object,
/** Makes the table dark */
dark: PropTypes.bool,
/** Enables a hover state on the rows within `<tbody>` */
hover: PropTypes.bool,
innerRef: PropTypes.oneOfType([
PropTypes.func,
PropTypes.string,
PropTypes.object,
]),
/** Responsive tables allow tables to be scrolled horizontally with ease */
responsive: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
responsiveTag: tagPropType,
/** Make tables more compact by cutting cell padding in half when setting size as sm. */
size: PropTypes.string,
/** Adds zebra-striping to any table row within the `<tbody>` */
striped: PropTypes.bool,
/** Add custom tag to the component */
tag: tagPropType,
};
function Table(props) {
const {
className,
cssModule,
size,
bordered,
borderless,
striped,
dark,
hover,
responsive,
tag: Tag = 'table',
responsiveTag: ResponsiveTag = 'div',
innerRef,
...attributes
} = props;
const classes = mapToCssModules(
classNames(
className,
'table',
size ? 'table-' + size : false,
bordered ? 'table-bordered' : false,
borderless ? 'table-borderless' : false,
striped ? 'table-striped' : false,
dark ? 'table-dark' : false,
hover ? 'table-hover' : false,
),
cssModule,
);
const table = <Tag {...attributes} ref={innerRef} className={classes} />;
if (responsive) {
const responsiveClassName = mapToCssModules(
responsive === true
? 'table-responsive'
: `table-responsive-${responsive}`,
cssModule,
);
return (
<ResponsiveTag className={responsiveClassName}>{table}</ResponsiveTag>
);
}
return table;
}
Table.propTypes = propTypes;
export default Table;

64
node_modules/reactstrap/src/Toast.js generated vendored Normal file
View File

@@ -0,0 +1,64 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
import Fade from './Fade';
const propTypes = {
children: PropTypes.node,
className: PropTypes.string,
cssModule: PropTypes.object,
fade: PropTypes.bool,
isOpen: PropTypes.bool,
tag: tagPropType,
transition: PropTypes.shape(Fade.propTypes),
innerRef: PropTypes.oneOfType([
PropTypes.object,
PropTypes.string,
PropTypes.func,
]),
};
function Toast(props) {
const {
className,
cssModule,
tag: Tag = 'div',
isOpen = true,
children,
transition = {
...Fade.defaultProps,
unmountOnExit: true,
},
fade = true,
innerRef,
...attributes
} = props;
const classes = mapToCssModules(classNames(className, 'toast'), cssModule);
const toastTransition = {
...Fade.defaultProps,
...transition,
baseClass: fade ? transition.baseClass : '',
timeout: fade ? transition.timeout : 0,
};
return (
<Fade
{...attributes}
{...toastTransition}
tag={Tag}
className={classes}
in={isOpen}
role="alert"
innerRef={innerRef}
>
{children}
</Fade>
);
}
Toast.propTypes = propTypes;
export default Toast;

35
node_modules/reactstrap/src/ToastBody.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
tag: tagPropType,
className: PropTypes.string,
cssModule: PropTypes.object,
innerRef: PropTypes.oneOfType([
PropTypes.object,
PropTypes.string,
PropTypes.func,
]),
};
function ToastBody(props) {
const {
className,
cssModule,
innerRef,
tag: Tag = 'div',
...attributes
} = props;
const classes = mapToCssModules(
classNames(className, 'toast-body'),
cssModule,
);
return <Tag {...attributes} className={classes} ref={innerRef} />;
}
ToastBody.propTypes = propTypes;
export default ToastBody;

89
node_modules/reactstrap/src/ToastHeader.js generated vendored Normal file
View File

@@ -0,0 +1,89 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
const propTypes = {
tag: tagPropType,
icon: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
wrapTag: tagPropType,
toggle: PropTypes.func,
className: PropTypes.string,
cssModule: PropTypes.object,
children: PropTypes.node,
closeAriaLabel: PropTypes.string,
charCode: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
close: PropTypes.object,
tagClassName: PropTypes.string,
};
function ToastHeader(props) {
let closeButton;
let icon;
const {
className,
cssModule,
children,
toggle,
tag: Tag = 'strong',
wrapTag: WrapTag = 'div',
closeAriaLabel = 'Close',
close,
tagClassName = 'me-auto',
icon: iconProp,
...attributes
} = props;
const classes = mapToCssModules(
classNames(className, 'toast-header'),
cssModule,
);
if (!close && toggle) {
closeButton = (
<button
type="button"
onClick={toggle}
className={mapToCssModules('btn-close', cssModule)}
aria-label={closeAriaLabel}
/>
);
}
if (typeof iconProp === 'string') {
icon = (
<svg
className={mapToCssModules(`rounded text-${iconProp}`)}
width="20"
height="20"
xmlns="http://www.w3.org/2000/svg"
preserveAspectRatio="xMidYMid slice"
focusable="false"
role="img"
>
<rect fill="currentColor" width="100%" height="100%" />
</svg>
);
} else if (iconProp) {
icon = iconProp;
}
return (
<WrapTag {...attributes} className={classes}>
{icon}
<Tag
className={mapToCssModules(
classNames(tagClassName, { 'ms-2': icon != null }),
cssModule,
)}
>
{children}
</Tag>
{close || closeButton}
</WrapTag>
);
}
ToastHeader.propTypes = propTypes;
export default ToastHeader;

32
node_modules/reactstrap/src/Tooltip.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
import React from 'react';
import classNames from 'classnames';
import TooltipPopoverWrapper, { propTypes } from './TooltipPopoverWrapper';
import { addDefaultProps } from './utils';
const defaultProps = {
placement: 'top',
autohide: true,
placementPrefix: 'bs-tooltip',
trigger: 'hover focus',
};
function Tooltip(props) {
const arrowClasses = classNames('tooltip-arrow', props.arrowClassName);
const popperClasses = classNames('tooltip', 'show', props.popperClassName);
const classes = classNames('tooltip-inner', props.innerClassName);
const _props = addDefaultProps(defaultProps, props);
return (
<TooltipPopoverWrapper
{..._props}
arrowClassName={arrowClasses}
popperClassName={popperClasses}
innerClassName={classes}
/>
);
}
Tooltip.propTypes = propTypes;
export default Tooltip;

403
node_modules/reactstrap/src/TooltipPopoverWrapper.js generated vendored Normal file
View File

@@ -0,0 +1,403 @@
import React from 'react';
import PropTypes from 'prop-types';
import PopperContent from './PopperContent';
import {
getTarget,
targetPropType,
omit,
PopperPlacements,
mapToCssModules,
DOMElement,
} from './utils';
export const propTypes = {
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
placement: PropTypes.oneOf(PopperPlacements),
target: targetPropType.isRequired,
container: targetPropType,
isOpen: PropTypes.bool,
disabled: PropTypes.bool,
hideArrow: PropTypes.bool,
boundariesElement: PropTypes.oneOfType([PropTypes.string, DOMElement]),
className: PropTypes.string,
innerClassName: PropTypes.string,
arrowClassName: PropTypes.string,
popperClassName: PropTypes.string,
cssModule: PropTypes.object,
toggle: PropTypes.func,
autohide: PropTypes.bool,
placementPrefix: PropTypes.string,
delay: PropTypes.oneOfType([
PropTypes.shape({ show: PropTypes.number, hide: PropTypes.number }),
PropTypes.number,
]),
modifiers: PropTypes.array,
strategy: PropTypes.string,
offset: PropTypes.arrayOf(PropTypes.number),
innerRef: PropTypes.oneOfType([
PropTypes.func,
PropTypes.string,
PropTypes.object,
]),
trigger: PropTypes.string,
fade: PropTypes.bool,
flip: PropTypes.bool,
};
const DEFAULT_DELAYS = {
show: 0,
hide: 50,
};
const defaultProps = {
isOpen: false,
hideArrow: false,
autohide: false,
delay: DEFAULT_DELAYS,
toggle: function () {},
trigger: 'click',
fade: true,
};
function isInDOMSubtree(element, subtreeRoot) {
return (
subtreeRoot && (element === subtreeRoot || subtreeRoot.contains(element))
);
}
function isInDOMSubtrees(element, subtreeRoots = []) {
return (
subtreeRoots &&
subtreeRoots.length &&
subtreeRoots.filter((subTreeRoot) =>
isInDOMSubtree(element, subTreeRoot),
)[0]
);
}
class TooltipPopoverWrapper extends React.Component {
constructor(props) {
super(props);
this._targets = [];
this.currentTargetElement = null;
this.addTargetEvents = this.addTargetEvents.bind(this);
this.handleDocumentClick = this.handleDocumentClick.bind(this);
this.removeTargetEvents = this.removeTargetEvents.bind(this);
this.toggle = this.toggle.bind(this);
this.showWithDelay = this.showWithDelay.bind(this);
this.hideWithDelay = this.hideWithDelay.bind(this);
this.onMouseOverTooltipContent = this.onMouseOverTooltipContent.bind(this);
this.onMouseLeaveTooltipContent =
this.onMouseLeaveTooltipContent.bind(this);
this.show = this.show.bind(this);
this.hide = this.hide.bind(this);
this.onEscKeyDown = this.onEscKeyDown.bind(this);
this.getRef = this.getRef.bind(this);
this.state = { isOpen: props.isOpen };
this._isMounted = false;
}
componentDidMount() {
this._isMounted = true;
this.updateTarget();
}
componentWillUnmount() {
this._isMounted = false;
this.removeTargetEvents();
this._targets = null;
this.clearShowTimeout();
this.clearHideTimeout();
}
static getDerivedStateFromProps(props, state) {
if (props.isOpen && !state.isOpen) {
return { isOpen: props.isOpen };
}
return null;
}
handleDocumentClick(e) {
const triggers = this.props.trigger.split(' ');
if (
triggers.indexOf('legacy') > -1 &&
(this.props.isOpen || isInDOMSubtrees(e.target, this._targets))
) {
if (this._hideTimeout) {
this.clearHideTimeout();
}
if (this.props.isOpen && !isInDOMSubtree(e.target, this._popover)) {
this.hideWithDelay(e);
} else if (!this.props.isOpen) {
this.showWithDelay(e);
}
} else if (
triggers.indexOf('click') > -1 &&
isInDOMSubtrees(e.target, this._targets)
) {
if (this._hideTimeout) {
this.clearHideTimeout();
}
if (!this.props.isOpen) {
this.showWithDelay(e);
} else {
this.hideWithDelay(e);
}
}
}
onMouseOverTooltipContent() {
if (this.props.trigger.indexOf('hover') > -1 && !this.props.autohide) {
if (this._hideTimeout) {
this.clearHideTimeout();
}
if (this.state.isOpen && !this.props.isOpen) {
this.toggle();
}
}
}
onMouseLeaveTooltipContent(e) {
if (this.props.trigger.indexOf('hover') > -1 && !this.props.autohide) {
if (this._showTimeout) {
this.clearShowTimeout();
}
e.persist();
this._hideTimeout = setTimeout(
this.hide.bind(this, e),
this.getDelay('hide'),
);
}
}
onEscKeyDown(e) {
if (e.key === 'Escape') {
this.hide(e);
}
}
getRef(ref) {
const { innerRef } = this.props;
if (innerRef) {
if (typeof innerRef === 'function') {
innerRef(ref);
} else if (typeof innerRef === 'object') {
innerRef.current = ref;
}
}
this._popover = ref;
}
getDelay(key) {
const { delay } = this.props;
if (typeof delay === 'object') {
return isNaN(delay[key]) ? DEFAULT_DELAYS[key] : delay[key];
}
return delay;
}
getCurrentTarget(target) {
if (!target) return null;
const index = this._targets.indexOf(target);
if (index >= 0) return this._targets[index];
return this.getCurrentTarget(target.parentElement);
}
show(e) {
if (!this.props.isOpen) {
this.clearShowTimeout();
this.currentTargetElement = e
? e.currentTarget || this.getCurrentTarget(e.target)
: null;
if (e && e.composedPath && typeof e.composedPath === 'function') {
const path = e.composedPath();
this.currentTargetElement =
(path && path[0]) || this.currentTargetElement;
}
this.toggle(e);
}
}
showWithDelay(e) {
if (this._hideTimeout) {
this.clearHideTimeout();
}
this._showTimeout = setTimeout(
this.show.bind(this, e),
this.getDelay('show'),
);
}
hide(e) {
if (this.props.isOpen) {
this.clearHideTimeout();
this.currentTargetElement = null;
this.toggle(e);
}
}
hideWithDelay(e) {
if (this._showTimeout) {
this.clearShowTimeout();
}
this._hideTimeout = setTimeout(
this.hide.bind(this, e),
this.getDelay('hide'),
);
}
clearShowTimeout() {
clearTimeout(this._showTimeout);
this._showTimeout = undefined;
}
clearHideTimeout() {
clearTimeout(this._hideTimeout);
this._hideTimeout = undefined;
}
addEventOnTargets(type, handler, isBubble) {
this._targets.forEach((target) => {
target.addEventListener(type, handler, isBubble);
});
}
removeEventOnTargets(type, handler, isBubble) {
this._targets.forEach((target) => {
target.removeEventListener(type, handler, isBubble);
});
}
addTargetEvents() {
if (this.props.trigger) {
let triggers = this.props.trigger.split(' ');
if (triggers.indexOf('manual') === -1) {
if (triggers.indexOf('click') > -1 || triggers.indexOf('legacy') > -1) {
document.addEventListener('click', this.handleDocumentClick, true);
}
if (this._targets && this._targets.length) {
if (triggers.indexOf('hover') > -1) {
this.addEventOnTargets('mouseover', this.showWithDelay, true);
this.addEventOnTargets('mouseout', this.hideWithDelay, true);
}
if (triggers.indexOf('focus') > -1) {
this.addEventOnTargets('focusin', this.show, true);
this.addEventOnTargets('focusout', this.hide, true);
}
this.addEventOnTargets('keydown', this.onEscKeyDown, true);
}
}
}
}
removeTargetEvents() {
if (this._targets) {
this.removeEventOnTargets('mouseover', this.showWithDelay, true);
this.removeEventOnTargets('mouseout', this.hideWithDelay, true);
this.removeEventOnTargets('keydown', this.onEscKeyDown, true);
this.removeEventOnTargets('focusin', this.show, true);
this.removeEventOnTargets('focusout', this.hide, true);
}
document.removeEventListener('click', this.handleDocumentClick, true);
}
updateTarget() {
const newTarget = getTarget(this.props.target, true);
if (newTarget !== this._targets) {
this.removeTargetEvents();
this._targets = newTarget ? Array.from(newTarget) : [];
this.currentTargetElement = this.currentTargetElement || this._targets[0];
this.addTargetEvents();
}
}
toggle(e) {
if (this.props.disabled || !this._isMounted) {
return e && e.preventDefault();
}
return this.props.toggle(e);
}
render() {
if (this.props.isOpen) {
this.updateTarget();
}
const target = this.currentTargetElement || this._targets[0];
if (!target) {
return null;
}
const {
className,
cssModule,
innerClassName,
isOpen,
hideArrow,
boundariesElement,
placement,
placementPrefix,
arrowClassName,
popperClassName,
container,
modifiers,
strategy,
offset,
fade,
flip,
children,
} = this.props;
const attributes = omit(this.props, Object.keys(propTypes));
const popperClasses = mapToCssModules(popperClassName, cssModule);
const classes = mapToCssModules(innerClassName, cssModule);
return (
<PopperContent
className={className}
target={target}
isOpen={isOpen}
hideArrow={hideArrow}
boundariesElement={boundariesElement}
placement={placement}
placementPrefix={placementPrefix}
arrowClassName={arrowClassName}
popperClassName={popperClasses}
container={container}
modifiers={modifiers}
strategy={strategy}
offset={offset}
cssModule={cssModule}
fade={fade}
flip={flip}
>
{({ update }) => (
<div
{...attributes}
ref={this.getRef}
className={classes}
role="tooltip"
onMouseOver={this.onMouseOverTooltipContent}
onMouseLeave={this.onMouseLeaveTooltipContent}
onKeyDown={this.onEscKeyDown}
>
{typeof children === 'function' ? children({ update }) : children}
</div>
)}
</PopperContent>
);
}
}
TooltipPopoverWrapper.propTypes = propTypes;
TooltipPopoverWrapper.defaultProps = defaultProps;
export default TooltipPopoverWrapper;

43
node_modules/reactstrap/src/UncontrolledAccordion.js generated vendored Normal file
View File

@@ -0,0 +1,43 @@
import React, { useState } from 'react';
import PropTypes from 'prop-types';
import { tagPropType } from './utils';
import Accordion from './Accordion';
const propTypes = {
tag: tagPropType,
className: PropTypes.string,
cssModule: PropTypes.object,
innerRef: PropTypes.oneOfType([
PropTypes.object,
PropTypes.string,
PropTypes.func,
]),
children: PropTypes.node,
defaultOpen: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
stayOpen: PropTypes.bool,
};
function UncontrolledAccordion({ defaultOpen, stayOpen, ...props }) {
const [open, setOpen] = useState(defaultOpen || (stayOpen ? [] : undefined));
const toggle = (id) => {
if (stayOpen) {
if (open.includes(id)) {
setOpen(open.filter((accordionId) => accordionId !== id));
} else {
setOpen([...open, id]);
}
} else if (open === id) {
setOpen('');
} else {
setOpen(id);
}
};
return (
<Accordion {...{ tag: 'div', ...props }} open={open} toggle={toggle} />
);
}
UncontrolledAccordion.propTypes = propTypes;
export default UncontrolledAccordion;

23
node_modules/reactstrap/src/UncontrolledAlert.js generated vendored Normal file
View File

@@ -0,0 +1,23 @@
import React, { Component } from 'react';
import Alert from './Alert';
class UncontrolledAlert extends Component {
constructor(props) {
super(props);
this.state = { isOpen: true };
this.toggle = this.toggle.bind(this);
}
toggle() {
this.setState((prevState) => ({ isOpen: !prevState.isOpen }));
}
render() {
return (
<Alert isOpen={this.state.isOpen} toggle={this.toggle} {...this.props} />
);
}
}
export default UncontrolledAlert;

View File

@@ -0,0 +1,34 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import ButtonDropdown from './ButtonDropdown';
import { omit } from './utils';
const omitKeys = ['defaultOpen'];
export default class UncontrolledButtonDropdown extends Component {
constructor(props) {
super(props);
this.state = { isOpen: props.defaultOpen || false };
this.toggle = this.toggle.bind(this);
}
toggle() {
this.setState((prevState) => ({ isOpen: !prevState.isOpen }));
}
render() {
return (
<ButtonDropdown
isOpen={this.state.isOpen}
toggle={this.toggle}
{...omit(this.props, omitKeys)}
/>
);
}
}
UncontrolledButtonDropdown.propTypes = {
defaultOpen: PropTypes.bool,
...ButtonDropdown.propTypes,
};

134
node_modules/reactstrap/src/UncontrolledCarousel.js generated vendored Normal file
View File

@@ -0,0 +1,134 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Carousel from './Carousel';
import CarouselItem from './CarouselItem';
import CarouselControl from './CarouselControl';
import CarouselIndicators from './CarouselIndicators';
import CarouselCaption from './CarouselCaption';
const propTypes = {
items: PropTypes.array.isRequired,
indicators: PropTypes.bool,
controls: PropTypes.bool,
autoPlay: PropTypes.bool,
defaultActiveIndex: PropTypes.number,
activeIndex: PropTypes.number,
next: PropTypes.func,
previous: PropTypes.func,
goToIndex: PropTypes.func,
};
class UncontrolledCarousel extends Component {
constructor(props) {
super(props);
this.animating = false;
this.state = { activeIndex: props.defaultActiveIndex || 0 };
this.next = this.next.bind(this);
this.previous = this.previous.bind(this);
this.goToIndex = this.goToIndex.bind(this);
this.onExiting = this.onExiting.bind(this);
this.onExited = this.onExited.bind(this);
}
onExiting() {
this.animating = true;
}
onExited() {
this.animating = false;
}
next() {
if (this.animating) return;
this.setState((prevState) => {
const nextIndex =
prevState.activeIndex === this.props.items.length - 1
? 0
: prevState.activeIndex + 1;
return { activeIndex: nextIndex };
});
}
previous() {
if (this.animating) return;
this.setState((prevState) => {
const nextIndex =
prevState.activeIndex === 0
? this.props.items.length - 1
: prevState.activeIndex - 1;
return { activeIndex: nextIndex };
});
}
goToIndex(newIndex) {
if (this.animating) return;
this.setState({ activeIndex: newIndex });
}
render() {
const {
defaultActiveIndex,
autoPlay = true,
indicators = true,
controls = true,
items,
goToIndex,
...props
} = this.props;
const { activeIndex } = this.state;
const slides = items.map((item) => {
const key = item.key || item.src;
return (
<CarouselItem
onExiting={this.onExiting}
onExited={this.onExited}
key={key}
>
<img className="d-block w-100" src={item.src} alt={item.altText} />
<CarouselCaption
captionText={item.caption}
captionHeader={item.header || item.caption}
/>
</CarouselItem>
);
});
return (
<Carousel
activeIndex={activeIndex}
next={this.next}
previous={this.previous}
ride={autoPlay ? 'carousel' : undefined}
{...props}
>
{indicators && (
<CarouselIndicators
items={items}
activeIndex={props.activeIndex || activeIndex}
onClickHandler={goToIndex || this.goToIndex}
/>
)}
{slides}
{controls && (
<CarouselControl
direction="prev"
directionText="Previous"
onClickHandler={props.previous || this.previous}
/>
)}
{controls && (
<CarouselControl
direction="next"
directionText="Next"
onClickHandler={props.next || this.next}
/>
)}
</Carousel>
);
}
}
UncontrolledCarousel.propTypes = propTypes;
export default UncontrolledCarousel;

Some files were not shown because too many files have changed in this diff Show More