new changes

This commit is contained in:
Niranjan
2026-04-07 05:05:28 +05:30
parent 7c070224bd
commit a18bba15f2
29975 changed files with 3247495 additions and 2761 deletions

View File

@@ -0,0 +1,10 @@
import * as React from 'react';
import { CloseButtonVariant } from './CloseButton';
export interface AbstractModalHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
closeLabel?: string;
closeVariant?: CloseButtonVariant;
closeButton?: boolean;
onHide?: () => void;
}
declare const AbstractModalHeader: React.ForwardRefExoticComponent<AbstractModalHeaderProps & React.RefAttributes<HTMLDivElement>>;
export default AbstractModalHeader;

View File

@@ -0,0 +1,34 @@
"use client";
import * as React from 'react';
import { useContext } from 'react';
import useEventCallback from '@restart/hooks/useEventCallback';
import CloseButton from './CloseButton';
import ModalContext from './ModalContext';
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
const AbstractModalHeader = /*#__PURE__*/React.forwardRef(({
closeLabel = 'Close',
closeVariant,
closeButton = false,
onHide,
children,
...props
}, ref) => {
const context = useContext(ModalContext);
const handleClick = useEventCallback(() => {
context == null || context.onHide();
onHide == null || onHide();
});
return /*#__PURE__*/_jsxs("div", {
ref: ref,
...props,
children: [children, closeButton && /*#__PURE__*/_jsx(CloseButton, {
"aria-label": closeLabel,
variant: closeVariant,
onClick: handleClick
})]
});
});
AbstractModalHeader.displayName = 'AbstractModalHeader';
export default AbstractModalHeader;

View File

@@ -0,0 +1,18 @@
import * as React from 'react';
import { AccordionSelectCallback, AccordionEventKey } from './AccordionContext';
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
export interface AccordionProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onSelect'>, BsPrefixProps {
activeKey?: AccordionEventKey;
defaultActiveKey?: AccordionEventKey;
onSelect?: AccordionSelectCallback;
flush?: boolean;
alwaysOpen?: boolean;
}
declare const _default: BsPrefixRefForwardingComponent<"div", AccordionProps> & {
Button: BsPrefixRefForwardingComponent<"div", import("./AccordionButton").AccordionButtonProps>;
Collapse: BsPrefixRefForwardingComponent<"div", import("./AccordionCollapse").AccordionCollapseProps>;
Item: BsPrefixRefForwardingComponent<"div", import("./AccordionItem").AccordionItemProps>;
Header: BsPrefixRefForwardingComponent<"h2", import("./AccordionHeader").AccordionHeaderProps>;
Body: BsPrefixRefForwardingComponent<"div", import("./AccordionBody").AccordionBodyProps>;
};
export default _default;

View File

@@ -0,0 +1,51 @@
"use client";
import classNames from 'classnames';
import * as React from 'react';
import { useMemo } from 'react';
import { useUncontrolled } from 'uncontrollable';
import { useBootstrapPrefix } from './ThemeProvider';
import AccordionBody from './AccordionBody';
import AccordionButton from './AccordionButton';
import AccordionCollapse from './AccordionCollapse';
import AccordionContext from './AccordionContext';
import AccordionHeader from './AccordionHeader';
import AccordionItem from './AccordionItem';
import { jsx as _jsx } from "react/jsx-runtime";
const Accordion = /*#__PURE__*/React.forwardRef((props, ref) => {
const {
// Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
as: Component = 'div',
activeKey,
bsPrefix,
className,
onSelect,
flush,
alwaysOpen,
...controlledProps
} = useUncontrolled(props, {
activeKey: 'onSelect'
});
const prefix = useBootstrapPrefix(bsPrefix, 'accordion');
const contextValue = useMemo(() => ({
activeEventKey: activeKey,
onSelect,
alwaysOpen
}), [activeKey, onSelect, alwaysOpen]);
return /*#__PURE__*/_jsx(AccordionContext.Provider, {
value: contextValue,
children: /*#__PURE__*/_jsx(Component, {
ref: ref,
...controlledProps,
className: classNames(className, prefix, flush && `${prefix}-flush`)
})
});
});
Accordion.displayName = 'Accordion';
export default Object.assign(Accordion, {
Button: AccordionButton,
Collapse: AccordionCollapse,
Item: AccordionItem,
Header: AccordionHeader,
Body: AccordionBody
});

View File

@@ -0,0 +1,7 @@
import * as React from 'react';
import { TransitionCallbacks } from '@restart/ui/types';
import { BsPrefixRefForwardingComponent, BsPrefixProps } from './helpers';
export interface AccordionBodyProps extends BsPrefixProps, TransitionCallbacks, React.HTMLAttributes<HTMLElement> {
}
declare const AccordionBody: BsPrefixRefForwardingComponent<'div', AccordionBodyProps>;
export default AccordionBody;

View File

@@ -0,0 +1,43 @@
"use client";
import classNames from 'classnames';
import * as React from 'react';
import { useContext } from 'react';
import { useBootstrapPrefix } from './ThemeProvider';
import AccordionCollapse from './AccordionCollapse';
import AccordionItemContext from './AccordionItemContext';
import { jsx as _jsx } from "react/jsx-runtime";
const AccordionBody = /*#__PURE__*/React.forwardRef(({
// Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
as: Component = 'div',
bsPrefix,
className,
onEnter,
onEntering,
onEntered,
onExit,
onExiting,
onExited,
...props
}, ref) => {
bsPrefix = useBootstrapPrefix(bsPrefix, 'accordion-body');
const {
eventKey
} = useContext(AccordionItemContext);
return /*#__PURE__*/_jsx(AccordionCollapse, {
eventKey: eventKey,
onEnter: onEnter,
onEntering: onEntering,
onEntered: onEntered,
onExit: onExit,
onExiting: onExiting,
onExited: onExited,
children: /*#__PURE__*/_jsx(Component, {
ref: ref,
...props,
className: classNames(className, bsPrefix)
})
});
});
AccordionBody.displayName = 'AccordionBody';
export default AccordionBody;

View File

@@ -0,0 +1,8 @@
import * as React from 'react';
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
type EventHandler = React.EventHandler<React.SyntheticEvent>;
export interface AccordionButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, BsPrefixProps {
}
export declare function useAccordionButton(eventKey: string, onClick?: EventHandler): EventHandler;
declare const AccordionButton: BsPrefixRefForwardingComponent<'div', AccordionButtonProps>;
export default AccordionButton;

View File

@@ -0,0 +1,66 @@
"use client";
import * as React from 'react';
import { useContext } from 'react';
import classNames from 'classnames';
import AccordionContext, { isAccordionItemSelected } from './AccordionContext';
import AccordionItemContext from './AccordionItemContext';
import { useBootstrapPrefix } from './ThemeProvider';
import { jsx as _jsx } from "react/jsx-runtime";
export function useAccordionButton(eventKey, onClick) {
const {
activeEventKey,
onSelect,
alwaysOpen
} = useContext(AccordionContext);
return e => {
/*
Compare the event key in context with the given event key.
If they are the same, then collapse the component.
*/
let eventKeyPassed = eventKey === activeEventKey ? null : eventKey;
if (alwaysOpen) {
if (Array.isArray(activeEventKey)) {
if (activeEventKey.includes(eventKey)) {
eventKeyPassed = activeEventKey.filter(k => k !== eventKey);
} else {
eventKeyPassed = [...activeEventKey, eventKey];
}
} else {
// activeEventKey is undefined.
eventKeyPassed = [eventKey];
}
}
onSelect == null || onSelect(eventKeyPassed, e);
onClick == null || onClick(e);
};
}
const AccordionButton = /*#__PURE__*/React.forwardRef(({
// Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
as: Component = 'button',
bsPrefix,
className,
onClick,
...props
}, ref) => {
bsPrefix = useBootstrapPrefix(bsPrefix, 'accordion-button');
const {
eventKey
} = useContext(AccordionItemContext);
const accordionOnClick = useAccordionButton(eventKey, onClick);
const {
activeEventKey
} = useContext(AccordionContext);
if (Component === 'button') {
props.type = 'button';
}
return /*#__PURE__*/_jsx(Component, {
ref: ref,
onClick: accordionOnClick,
...props,
"aria-expanded": Array.isArray(activeEventKey) ? activeEventKey.includes(eventKey) : eventKey === activeEventKey,
className: classNames(className, bsPrefix, !isAccordionItemSelected(activeEventKey, eventKey) && 'collapsed')
});
});
AccordionButton.displayName = 'AccordionButton';
export default AccordionButton;

View File

@@ -0,0 +1,12 @@
import { CollapseProps } from './Collapse';
import { BsPrefixRefForwardingComponent, BsPrefixProps } from './helpers';
export interface AccordionCollapseProps extends BsPrefixProps, CollapseProps {
eventKey: string;
/** @default 'accordion-collapse' */
bsPrefix?: string;
}
/**
* This component accepts all of [`Collapse`'s props](/docs/utilities/transitions#collapse-1).
*/
declare const AccordionCollapse: BsPrefixRefForwardingComponent<'div', AccordionCollapseProps>;
export default AccordionCollapse;

View File

@@ -0,0 +1,36 @@
"use client";
import classNames from 'classnames';
import * as React from 'react';
import { useContext } from 'react';
import { useBootstrapPrefix } from './ThemeProvider';
import Collapse from './Collapse';
import AccordionContext, { isAccordionItemSelected } from './AccordionContext';
import { jsx as _jsx } from "react/jsx-runtime";
/**
* This component accepts all of [`Collapse`'s props](/docs/utilities/transitions#collapse-1).
*/
const AccordionCollapse = /*#__PURE__*/React.forwardRef(({
as: Component = 'div',
bsPrefix,
className,
children,
eventKey,
...props
}, ref) => {
const {
activeEventKey
} = useContext(AccordionContext);
bsPrefix = useBootstrapPrefix(bsPrefix, 'accordion-collapse');
return /*#__PURE__*/_jsx(Collapse, {
ref: ref,
in: isAccordionItemSelected(activeEventKey, eventKey),
...props,
className: classNames(className, bsPrefix),
children: /*#__PURE__*/_jsx(Component, {
children: React.Children.only(children)
})
});
});
AccordionCollapse.displayName = 'AccordionCollapse';
export default AccordionCollapse;

View File

@@ -0,0 +1,11 @@
import * as React from 'react';
export type AccordionEventKey = string | string[] | null | undefined;
export declare type AccordionSelectCallback = (eventKey: AccordionEventKey, e: React.SyntheticEvent<unknown>) => void;
export interface AccordionContextValue {
activeEventKey?: AccordionEventKey;
onSelect?: AccordionSelectCallback;
alwaysOpen?: boolean;
}
export declare function isAccordionItemSelected(activeEventKey: AccordionEventKey, eventKey: string): boolean;
declare const context: React.Context<AccordionContextValue>;
export default context;

View File

@@ -0,0 +1,9 @@
"use client";
import * as React from 'react';
export function isAccordionItemSelected(activeEventKey, eventKey) {
return Array.isArray(activeEventKey) ? activeEventKey.includes(eventKey) : activeEventKey === eventKey;
}
const context = /*#__PURE__*/React.createContext({});
context.displayName = 'AccordionContext';
export default context;

View File

@@ -0,0 +1,6 @@
import * as React from 'react';
import { BsPrefixRefForwardingComponent, BsPrefixProps } from './helpers';
export interface AccordionHeaderProps extends BsPrefixProps, React.HTMLAttributes<HTMLElement> {
}
declare const AccordionHeader: BsPrefixRefForwardingComponent<'h2', AccordionHeaderProps>;
export default AccordionHeader;

View File

@@ -0,0 +1,31 @@
"use client";
import classNames from 'classnames';
import * as React from 'react';
import { useBootstrapPrefix } from './ThemeProvider';
import AccordionButton from './AccordionButton';
import { jsx as _jsx } from "react/jsx-runtime";
const AccordionHeader = /*#__PURE__*/React.forwardRef(({
// Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
as: Component = 'h2',
'aria-controls': ariaControls,
bsPrefix,
className,
children,
onClick,
...props
}, ref) => {
bsPrefix = useBootstrapPrefix(bsPrefix, 'accordion-header');
return /*#__PURE__*/_jsx(Component, {
ref: ref,
...props,
className: classNames(className, bsPrefix),
children: /*#__PURE__*/_jsx(AccordionButton, {
onClick: onClick,
"aria-controls": ariaControls,
children: children
})
});
});
AccordionHeader.displayName = 'AccordionHeader';
export default AccordionHeader;

View File

@@ -0,0 +1,7 @@
import * as React from 'react';
import { BsPrefixRefForwardingComponent, BsPrefixProps } from './helpers';
export interface AccordionItemProps extends BsPrefixProps, React.HTMLAttributes<HTMLElement> {
eventKey: string;
}
declare const AccordionItem: BsPrefixRefForwardingComponent<'div', AccordionItemProps>;
export default AccordionItem;

View File

@@ -0,0 +1,31 @@
"use client";
import classNames from 'classnames';
import * as React from 'react';
import { useMemo } from 'react';
import { useBootstrapPrefix } from './ThemeProvider';
import AccordionItemContext from './AccordionItemContext';
import { jsx as _jsx } from "react/jsx-runtime";
const AccordionItem = /*#__PURE__*/React.forwardRef(({
// Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
as: Component = 'div',
bsPrefix,
className,
eventKey,
...props
}, ref) => {
bsPrefix = useBootstrapPrefix(bsPrefix, 'accordion-item');
const contextValue = useMemo(() => ({
eventKey
}), [eventKey]);
return /*#__PURE__*/_jsx(AccordionItemContext.Provider, {
value: contextValue,
children: /*#__PURE__*/_jsx(Component, {
ref: ref,
...props,
className: classNames(className, bsPrefix)
})
});
});
AccordionItem.displayName = 'AccordionItem';
export default AccordionItem;

View File

@@ -0,0 +1,6 @@
import * as React from 'react';
export interface AccordionItemContextValue {
eventKey: string;
}
declare const context: React.Context<AccordionItemContextValue>;
export default context;

View File

@@ -0,0 +1,8 @@
"use client";
import * as React from 'react';
const context = /*#__PURE__*/React.createContext({
eventKey: ''
});
context.displayName = 'AccordionItemContext';
export default context;

View File

@@ -0,0 +1,19 @@
import * as React from 'react';
import { CloseButtonVariant } from './CloseButton';
import { Variant } from './types';
import { TransitionType } from './helpers';
export interface AlertProps extends React.HTMLAttributes<HTMLDivElement> {
bsPrefix?: string;
variant?: Variant;
dismissible?: boolean;
show?: boolean;
onClose?: (a: any, b: any) => void;
closeLabel?: string;
closeVariant?: CloseButtonVariant;
transition?: TransitionType;
}
declare const _default: React.ForwardRefExoticComponent<AlertProps & React.RefAttributes<HTMLDivElement>> & {
Link: import("./helpers").BsPrefixRefForwardingComponent<"a", import("./AlertLink").AlertLinkProps>;
Heading: import("./helpers").BsPrefixRefForwardingComponent<"div", import("./AlertHeading").AlertHeadingProps>;
};
export default _default;

View File

@@ -0,0 +1,61 @@
"use client";
import classNames from 'classnames';
import * as React from 'react';
import { useUncontrolled } from 'uncontrollable';
import useEventCallback from '@restart/hooks/useEventCallback';
import { useBootstrapPrefix } from './ThemeProvider';
import AlertHeading from './AlertHeading';
import AlertLink from './AlertLink';
import Fade from './Fade';
import CloseButton from './CloseButton';
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
const Alert = /*#__PURE__*/React.forwardRef((uncontrolledProps, ref) => {
const {
bsPrefix,
show = true,
closeLabel = 'Close alert',
closeVariant,
className,
children,
variant = 'primary',
onClose,
dismissible,
transition = Fade,
...props
} = useUncontrolled(uncontrolledProps, {
show: 'onClose'
});
const prefix = useBootstrapPrefix(bsPrefix, 'alert');
const handleClose = useEventCallback(e => {
if (onClose) {
onClose(false, e);
}
});
const Transition = transition === true ? Fade : transition;
const alert = /*#__PURE__*/_jsxs("div", {
role: "alert",
...(!Transition ? props : undefined),
ref: ref,
className: classNames(className, prefix, variant && `${prefix}-${variant}`, dismissible && `${prefix}-dismissible`),
children: [dismissible && /*#__PURE__*/_jsx(CloseButton, {
onClick: handleClose,
"aria-label": closeLabel,
variant: closeVariant
}), children]
});
if (!Transition) return show ? alert : null;
return /*#__PURE__*/_jsx(Transition, {
unmountOnExit: true,
...props,
ref: undefined,
in: show,
children: alert
});
});
Alert.displayName = 'Alert';
export default Object.assign(Alert, {
Link: AlertLink,
Heading: AlertHeading
});

View File

@@ -0,0 +1,6 @@
import * as React from 'react';
import type { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
export interface AlertHeadingProps extends BsPrefixProps, React.HTMLAttributes<HTMLElement> {
}
declare const AlertHeading: BsPrefixRefForwardingComponent<'div', AlertHeadingProps>;
export default AlertHeading;

View File

@@ -0,0 +1,24 @@
"use client";
import * as React from 'react';
import classNames from 'classnames';
import { useBootstrapPrefix } from './ThemeProvider';
import divWithClassName from './divWithClassName';
import { jsx as _jsx } from "react/jsx-runtime";
const DivStyledAsH4 = divWithClassName('h4');
DivStyledAsH4.displayName = 'DivStyledAsH4';
const AlertHeading = /*#__PURE__*/React.forwardRef(({
className,
bsPrefix,
as: Component = DivStyledAsH4,
...props
}, ref) => {
bsPrefix = useBootstrapPrefix(bsPrefix, 'alert-heading');
return /*#__PURE__*/_jsx(Component, {
ref: ref,
className: classNames(className, bsPrefix),
...props
});
});
AlertHeading.displayName = 'AlertHeading';
export default AlertHeading;

View File

@@ -0,0 +1,6 @@
import * as React from 'react';
import type { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
export interface AlertLinkProps extends BsPrefixProps, React.AnchorHTMLAttributes<HTMLElement> {
}
declare const AlertLink: BsPrefixRefForwardingComponent<'a', AlertLinkProps>;
export default AlertLink;

View File

@@ -0,0 +1,22 @@
"use client";
import * as React from 'react';
import classNames from 'classnames';
import Anchor from '@restart/ui/Anchor';
import { useBootstrapPrefix } from './ThemeProvider';
import { jsx as _jsx } from "react/jsx-runtime";
const AlertLink = /*#__PURE__*/React.forwardRef(({
className,
bsPrefix,
as: Component = Anchor,
...props
}, ref) => {
bsPrefix = useBootstrapPrefix(bsPrefix, 'alert-link');
return /*#__PURE__*/_jsx(Component, {
ref: ref,
className: classNames(className, bsPrefix),
...props
});
});
AlertLink.displayName = 'AlertLink';
export default AlertLink;

View File

@@ -0,0 +1,3 @@
import Anchor, { AnchorProps } from '@restart/ui/Anchor';
export type { AnchorProps };
export default Anchor;

View File

@@ -0,0 +1,2 @@
import Anchor from '@restart/ui/Anchor';
export default Anchor;

View File

@@ -0,0 +1,10 @@
import * as React from 'react';
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
import { Color, Variant } from './types';
export interface BadgeProps extends BsPrefixProps, React.HTMLAttributes<HTMLElement> {
bg?: Variant;
pill?: boolean;
text?: Color;
}
declare const Badge: BsPrefixRefForwardingComponent<'span', BadgeProps>;
export default Badge;

View File

@@ -0,0 +1,24 @@
"use client";
import classNames from 'classnames';
import * as React from 'react';
import { useBootstrapPrefix } from './ThemeProvider';
import { jsx as _jsx } from "react/jsx-runtime";
const Badge = /*#__PURE__*/React.forwardRef(({
bsPrefix,
bg = 'primary',
pill = false,
text,
className,
as: Component = 'span',
...props
}, ref) => {
const prefix = useBootstrapPrefix(bsPrefix, 'badge');
return /*#__PURE__*/_jsx(Component, {
ref: ref,
...props,
className: classNames(className, prefix, pill && `rounded-pill`, text && `text-${text}`, bg && `bg-${bg}`)
});
});
Badge.displayName = 'Badge';
export default Badge;

View File

@@ -0,0 +1,9 @@
import ModalManager, { ContainerState, ModalManagerOptions } from '@restart/ui/ModalManager';
declare class BootstrapModalManager extends ModalManager {
private adjustAndStore;
private restore;
setContainerStyle(containerState: ContainerState): void;
removeContainerStyle(containerState: ContainerState): void;
}
export declare function getSharedManager(options?: ModalManagerOptions): BootstrapModalManager;
export default BootstrapModalManager;

View File

@@ -0,0 +1,56 @@
import addClass from 'dom-helpers/addClass';
import css from 'dom-helpers/css';
import qsa from 'dom-helpers/querySelectorAll';
import removeClass from 'dom-helpers/removeClass';
import ModalManager from '@restart/ui/ModalManager';
const Selector = {
FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
STICKY_CONTENT: '.sticky-top',
NAVBAR_TOGGLER: '.navbar-toggler'
};
class BootstrapModalManager extends ModalManager {
adjustAndStore(prop, element, adjust) {
const actual = element.style[prop];
// @ts-expect-error TODO: DOMStringMap and CSSStyleDeclaration aren't strictly compatible
element.dataset[prop] = actual;
css(element, {
[prop]: `${parseFloat(css(element, prop)) + adjust}px`
});
}
restore(prop, element) {
const value = element.dataset[prop];
if (value !== undefined) {
delete element.dataset[prop];
css(element, {
[prop]: value
});
}
}
setContainerStyle(containerState) {
super.setContainerStyle(containerState);
const container = this.getElement();
addClass(container, 'modal-open');
if (!containerState.scrollBarWidth) return;
const paddingProp = this.isRTL ? 'paddingLeft' : 'paddingRight';
const marginProp = this.isRTL ? 'marginLeft' : 'marginRight';
qsa(container, Selector.FIXED_CONTENT).forEach(el => this.adjustAndStore(paddingProp, el, containerState.scrollBarWidth));
qsa(container, Selector.STICKY_CONTENT).forEach(el => this.adjustAndStore(marginProp, el, -containerState.scrollBarWidth));
qsa(container, Selector.NAVBAR_TOGGLER).forEach(el => this.adjustAndStore(marginProp, el, containerState.scrollBarWidth));
}
removeContainerStyle(containerState) {
super.removeContainerStyle(containerState);
const container = this.getElement();
removeClass(container, 'modal-open');
const paddingProp = this.isRTL ? 'paddingLeft' : 'paddingRight';
const marginProp = this.isRTL ? 'marginLeft' : 'marginRight';
qsa(container, Selector.FIXED_CONTENT).forEach(el => this.restore(paddingProp, el));
qsa(container, Selector.STICKY_CONTENT).forEach(el => this.restore(marginProp, el));
qsa(container, Selector.NAVBAR_TOGGLER).forEach(el => this.restore(marginProp, el));
}
}
let sharedManager;
export function getSharedManager(options) {
if (!sharedManager) sharedManager = new BootstrapModalManager(options);
return sharedManager;
}
export default BootstrapModalManager;

View File

@@ -0,0 +1,10 @@
import * as React from 'react';
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
export interface BreadcrumbProps extends BsPrefixProps, React.HTMLAttributes<HTMLElement> {
label?: string;
listProps?: React.OlHTMLAttributes<HTMLOListElement>;
}
declare const _default: BsPrefixRefForwardingComponent<"nav", BreadcrumbProps> & {
Item: BsPrefixRefForwardingComponent<"li", import("./BreadcrumbItem").BreadcrumbItemProps>;
};
export default _default;

View File

@@ -0,0 +1,34 @@
"use client";
import classNames from 'classnames';
import * as React from 'react';
import { useBootstrapPrefix } from './ThemeProvider';
import BreadcrumbItem from './BreadcrumbItem';
import { jsx as _jsx } from "react/jsx-runtime";
const Breadcrumb = /*#__PURE__*/React.forwardRef(({
bsPrefix,
className,
listProps = {},
children,
label = 'breadcrumb',
// Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
as: Component = 'nav',
...props
}, ref) => {
const prefix = useBootstrapPrefix(bsPrefix, 'breadcrumb');
return /*#__PURE__*/_jsx(Component, {
"aria-label": label,
className: className,
ref: ref,
...props,
children: /*#__PURE__*/_jsx("ol", {
...listProps,
className: classNames(prefix, listProps == null ? void 0 : listProps.className),
children: children
})
});
});
Breadcrumb.displayName = 'Breadcrumb';
export default Object.assign(Breadcrumb, {
Item: BreadcrumbItem
});

View File

@@ -0,0 +1,12 @@
import * as React from 'react';
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
export interface BreadcrumbItemProps extends BsPrefixProps, Omit<React.HTMLAttributes<HTMLElement>, 'title'> {
active?: boolean;
href?: string;
linkAs?: React.ElementType;
target?: string;
title?: React.ReactNode;
linkProps?: Record<string, any>;
}
declare const BreadcrumbItem: BsPrefixRefForwardingComponent<'li', BreadcrumbItemProps>;
export default BreadcrumbItem;

View File

@@ -0,0 +1,40 @@
"use client";
import classNames from 'classnames';
import * as React from 'react';
import Anchor from '@restart/ui/Anchor';
import { useBootstrapPrefix } from './ThemeProvider';
import { jsx as _jsx } from "react/jsx-runtime";
const BreadcrumbItem = /*#__PURE__*/React.forwardRef(({
bsPrefix,
active = false,
children,
className,
// Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
as: Component = 'li',
linkAs: LinkComponent = Anchor,
linkProps = {},
href,
title,
target,
...props
}, ref) => {
const prefix = useBootstrapPrefix(bsPrefix, 'breadcrumb-item');
return /*#__PURE__*/_jsx(Component, {
ref: ref,
...props,
className: classNames(prefix, className, {
active
}),
"aria-current": active ? 'page' : undefined,
children: active ? children : /*#__PURE__*/_jsx(LinkComponent, {
...linkProps,
href: href,
title: title,
target: target,
children: children
})
});
});
BreadcrumbItem.displayName = 'BreadcrumbItem';
export default BreadcrumbItem;

View File

@@ -0,0 +1,11 @@
import { ButtonProps as BaseButtonProps } from '@restart/ui/Button';
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
import { ButtonVariant } from './types';
export interface ButtonProps extends BaseButtonProps, Omit<BsPrefixProps, 'as'> {
active?: boolean;
variant?: ButtonVariant;
size?: 'sm' | 'lg';
}
export type CommonButtonProps = 'href' | 'size' | 'variant' | 'disabled';
declare const Button: BsPrefixRefForwardingComponent<'button', ButtonProps>;
export default Button;

View File

@@ -0,0 +1,36 @@
"use client";
import classNames from 'classnames';
import * as React from 'react';
import { useButtonProps } from '@restart/ui/Button';
import { useBootstrapPrefix } from './ThemeProvider';
import { jsx as _jsx } from "react/jsx-runtime";
const Button = /*#__PURE__*/React.forwardRef(({
as,
bsPrefix,
variant = 'primary',
size,
active = false,
disabled = false,
className,
...props
}, ref) => {
const prefix = useBootstrapPrefix(bsPrefix, 'btn');
const [buttonProps, {
tagName
}] = useButtonProps({
tagName: as,
disabled,
...props
});
const Component = tagName;
return /*#__PURE__*/_jsx(Component, {
...buttonProps,
...props,
ref: ref,
disabled: disabled,
className: classNames(className, prefix, active && 'active', variant && `${prefix}-${variant}`, size && `${prefix}-${size}`, props.href && disabled && 'disabled')
});
});
Button.displayName = 'Button';
export default Button;

View File

@@ -0,0 +1,8 @@
import * as React from 'react';
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
export interface ButtonGroupProps extends BsPrefixProps, React.HTMLAttributes<HTMLElement> {
size?: 'sm' | 'lg';
vertical?: boolean;
}
declare const ButtonGroup: BsPrefixRefForwardingComponent<'div', ButtonGroupProps>;
export default ButtonGroup;

View File

@@ -0,0 +1,28 @@
"use client";
import classNames from 'classnames';
import * as React from 'react';
import { useBootstrapPrefix } from './ThemeProvider';
import { jsx as _jsx } from "react/jsx-runtime";
const ButtonGroup = /*#__PURE__*/React.forwardRef(({
bsPrefix,
size,
vertical = false,
className,
role = 'group',
// Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
as: Component = 'div',
...rest
}, ref) => {
const prefix = useBootstrapPrefix(bsPrefix, 'btn-group');
let baseClass = prefix;
if (vertical) baseClass = `${prefix}-vertical`;
return /*#__PURE__*/_jsx(Component, {
...rest,
ref: ref,
role: role,
className: classNames(className, baseClass, size && `${prefix}-${size}`)
});
});
ButtonGroup.displayName = 'ButtonGroup';
export default ButtonGroup;

View File

@@ -0,0 +1,6 @@
import * as React from 'react';
import { BsPrefixProps } from './helpers';
export interface ButtonToolbarProps extends BsPrefixProps, React.HTMLAttributes<HTMLElement> {
}
declare const ButtonToolbar: React.ForwardRefExoticComponent<ButtonToolbarProps & React.RefAttributes<HTMLDivElement>>;
export default ButtonToolbar;

View File

@@ -0,0 +1,22 @@
"use client";
import classNames from 'classnames';
import * as React from 'react';
import { useBootstrapPrefix } from './ThemeProvider';
import { jsx as _jsx } from "react/jsx-runtime";
const ButtonToolbar = /*#__PURE__*/React.forwardRef(({
bsPrefix,
className,
role = 'toolbar',
...props
}, ref) => {
const prefix = useBootstrapPrefix(bsPrefix, 'btn-toolbar');
return /*#__PURE__*/_jsx("div", {
...props,
ref: ref,
className: classNames(className, prefix),
role: role
});
});
ButtonToolbar.displayName = 'ButtonToolbar';
export default ButtonToolbar;

View File

@@ -0,0 +1,21 @@
import * as React from 'react';
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
import { Color, Variant } from './types';
export interface CardProps extends BsPrefixProps, React.HTMLAttributes<HTMLElement> {
bg?: Variant;
text?: Color;
border?: Variant;
body?: boolean;
}
declare const _default: BsPrefixRefForwardingComponent<"div", CardProps> & {
Img: BsPrefixRefForwardingComponent<"img", import("./CardImg").CardImgProps>;
Title: BsPrefixRefForwardingComponent<"div", import("./CardTitle").CardTitleProps>;
Subtitle: BsPrefixRefForwardingComponent<"div", import("./CardSubtitle").CardSubtitleProps>;
Body: BsPrefixRefForwardingComponent<"div", import("./CardBody").CardBodyProps>;
Link: BsPrefixRefForwardingComponent<"a", import("./CardLink").CardLinkProps>;
Text: BsPrefixRefForwardingComponent<"p", import("./CardText").CardTextProps>;
Header: BsPrefixRefForwardingComponent<"div", import("./CardHeader").CardHeaderProps>;
Footer: BsPrefixRefForwardingComponent<"div", import("./CardFooter").CardFooterProps>;
ImgOverlay: BsPrefixRefForwardingComponent<"div", import("./CardImgOverlay").CardImgOverlayProps>;
};
export default _default;

View File

@@ -0,0 +1,49 @@
"use client";
import classNames from 'classnames';
import * as React from 'react';
import { useBootstrapPrefix } from './ThemeProvider';
import CardBody from './CardBody';
import CardFooter from './CardFooter';
import CardHeader from './CardHeader';
import CardImg from './CardImg';
import CardImgOverlay from './CardImgOverlay';
import CardLink from './CardLink';
import CardSubtitle from './CardSubtitle';
import CardText from './CardText';
import CardTitle from './CardTitle';
import { jsx as _jsx } from "react/jsx-runtime";
const Card = /*#__PURE__*/React.forwardRef(({
bsPrefix,
className,
bg,
text,
border,
body = false,
children,
// Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
as: Component = 'div',
...props
}, ref) => {
const prefix = useBootstrapPrefix(bsPrefix, 'card');
return /*#__PURE__*/_jsx(Component, {
ref: ref,
...props,
className: classNames(className, prefix, bg && `bg-${bg}`, text && `text-${text}`, border && `border-${border}`),
children: body ? /*#__PURE__*/_jsx(CardBody, {
children: children
}) : children
});
});
Card.displayName = 'Card';
export default Object.assign(Card, {
Img: CardImg,
Title: CardTitle,
Subtitle: CardSubtitle,
Body: CardBody,
Link: CardLink,
Text: CardText,
Header: CardHeader,
Footer: CardFooter,
ImgOverlay: CardImgOverlay
});

View File

@@ -0,0 +1,6 @@
import * as React from 'react';
import type { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
export interface CardBodyProps extends BsPrefixProps, React.HTMLAttributes<HTMLElement> {
}
declare const CardBody: BsPrefixRefForwardingComponent<'div', CardBodyProps>;
export default CardBody;

View File

@@ -0,0 +1,21 @@
"use client";
import * as React from 'react';
import classNames from 'classnames';
import { useBootstrapPrefix } from './ThemeProvider';
import { jsx as _jsx } from "react/jsx-runtime";
const CardBody = /*#__PURE__*/React.forwardRef(({
className,
bsPrefix,
as: Component = 'div',
...props
}, ref) => {
bsPrefix = useBootstrapPrefix(bsPrefix, 'card-body');
return /*#__PURE__*/_jsx(Component, {
ref: ref,
className: classNames(className, bsPrefix),
...props
});
});
CardBody.displayName = 'CardBody';
export default CardBody;

View File

@@ -0,0 +1,6 @@
import * as React from 'react';
import type { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
export interface CardFooterProps extends BsPrefixProps, React.HTMLAttributes<HTMLElement> {
}
declare const CardFooter: BsPrefixRefForwardingComponent<'div', CardFooterProps>;
export default CardFooter;

View File

@@ -0,0 +1,21 @@
"use client";
import * as React from 'react';
import classNames from 'classnames';
import { useBootstrapPrefix } from './ThemeProvider';
import { jsx as _jsx } from "react/jsx-runtime";
const CardFooter = /*#__PURE__*/React.forwardRef(({
className,
bsPrefix,
as: Component = 'div',
...props
}, ref) => {
bsPrefix = useBootstrapPrefix(bsPrefix, 'card-footer');
return /*#__PURE__*/_jsx(Component, {
ref: ref,
className: classNames(className, bsPrefix),
...props
});
});
CardFooter.displayName = 'CardFooter';
export default CardFooter;

View File

@@ -0,0 +1,6 @@
import * as React from 'react';
import type { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
export interface CardGroupProps extends BsPrefixProps, React.HTMLAttributes<HTMLElement> {
}
declare const CardGroup: BsPrefixRefForwardingComponent<'div', CardGroupProps>;
export default CardGroup;

View File

@@ -0,0 +1,21 @@
"use client";
import * as React from 'react';
import classNames from 'classnames';
import { useBootstrapPrefix } from './ThemeProvider';
import { jsx as _jsx } from "react/jsx-runtime";
const CardGroup = /*#__PURE__*/React.forwardRef(({
className,
bsPrefix,
as: Component = 'div',
...props
}, ref) => {
bsPrefix = useBootstrapPrefix(bsPrefix, 'card-group');
return /*#__PURE__*/_jsx(Component, {
ref: ref,
className: classNames(className, bsPrefix),
...props
});
});
CardGroup.displayName = 'CardGroup';
export default CardGroup;

View File

@@ -0,0 +1,6 @@
import * as React from 'react';
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
export interface CardHeaderProps extends BsPrefixProps, React.HTMLAttributes<HTMLElement> {
}
declare const CardHeader: BsPrefixRefForwardingComponent<'div', CardHeaderProps>;
export default CardHeader;

View File

@@ -0,0 +1,30 @@
"use client";
import classNames from 'classnames';
import * as React from 'react';
import { useMemo } from 'react';
import { useBootstrapPrefix } from './ThemeProvider';
import CardHeaderContext from './CardHeaderContext';
import { jsx as _jsx } from "react/jsx-runtime";
const CardHeader = /*#__PURE__*/React.forwardRef(({
bsPrefix,
className,
// Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
as: Component = 'div',
...props
}, ref) => {
const prefix = useBootstrapPrefix(bsPrefix, 'card-header');
const contextValue = useMemo(() => ({
cardHeaderBsPrefix: prefix
}), [prefix]);
return /*#__PURE__*/_jsx(CardHeaderContext.Provider, {
value: contextValue,
children: /*#__PURE__*/_jsx(Component, {
ref: ref,
...props,
className: classNames(className, prefix)
})
});
});
CardHeader.displayName = 'CardHeader';
export default CardHeader;

View File

@@ -0,0 +1,6 @@
import * as React from 'react';
interface CardHeaderContextValue {
cardHeaderBsPrefix: string;
}
declare const context: React.Context<CardHeaderContextValue | null>;
export default context;

View File

@@ -0,0 +1,6 @@
"use client";
import * as React from 'react';
const context = /*#__PURE__*/React.createContext(null);
context.displayName = 'CardHeaderContext';
export default context;

View File

@@ -0,0 +1,7 @@
import * as React from 'react';
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
export interface CardImgProps extends BsPrefixProps, React.ImgHTMLAttributes<HTMLImageElement> {
variant?: 'top' | 'bottom' | string;
}
declare const CardImg: BsPrefixRefForwardingComponent<'img', CardImgProps>;
export default CardImg;

View File

@@ -0,0 +1,24 @@
"use client";
import classNames from 'classnames';
import * as React from 'react';
import { useBootstrapPrefix } from './ThemeProvider';
import { jsx as _jsx } from "react/jsx-runtime";
const CardImg = /*#__PURE__*/React.forwardRef(
// Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
({
bsPrefix,
className,
variant,
as: Component = 'img',
...props
}, ref) => {
const prefix = useBootstrapPrefix(bsPrefix, 'card-img');
return /*#__PURE__*/_jsx(Component, {
ref: ref,
className: classNames(variant ? `${prefix}-${variant}` : prefix, className),
...props
});
});
CardImg.displayName = 'CardImg';
export default CardImg;

View File

@@ -0,0 +1,6 @@
import * as React from 'react';
import type { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
export interface CardImgOverlayProps extends BsPrefixProps, React.HTMLAttributes<HTMLElement> {
}
declare const CardImgOverlay: BsPrefixRefForwardingComponent<'div', CardImgOverlayProps>;
export default CardImgOverlay;

View File

@@ -0,0 +1,21 @@
"use client";
import * as React from 'react';
import classNames from 'classnames';
import { useBootstrapPrefix } from './ThemeProvider';
import { jsx as _jsx } from "react/jsx-runtime";
const CardImgOverlay = /*#__PURE__*/React.forwardRef(({
className,
bsPrefix,
as: Component = 'div',
...props
}, ref) => {
bsPrefix = useBootstrapPrefix(bsPrefix, 'card-img-overlay');
return /*#__PURE__*/_jsx(Component, {
ref: ref,
className: classNames(className, bsPrefix),
...props
});
});
CardImgOverlay.displayName = 'CardImgOverlay';
export default CardImgOverlay;

View File

@@ -0,0 +1,6 @@
import * as React from 'react';
import type { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
export interface CardLinkProps extends BsPrefixProps, React.AnchorHTMLAttributes<HTMLElement> {
}
declare const CardLink: BsPrefixRefForwardingComponent<'a', CardLinkProps>;
export default CardLink;

View File

@@ -0,0 +1,21 @@
"use client";
import * as React from 'react';
import classNames from 'classnames';
import { useBootstrapPrefix } from './ThemeProvider';
import { jsx as _jsx } from "react/jsx-runtime";
const CardLink = /*#__PURE__*/React.forwardRef(({
className,
bsPrefix,
as: Component = 'a',
...props
}, ref) => {
bsPrefix = useBootstrapPrefix(bsPrefix, 'card-link');
return /*#__PURE__*/_jsx(Component, {
ref: ref,
className: classNames(className, bsPrefix),
...props
});
});
CardLink.displayName = 'CardLink';
export default CardLink;

View File

@@ -0,0 +1,6 @@
import * as React from 'react';
import type { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
export interface CardSubtitleProps extends BsPrefixProps, React.HTMLAttributes<HTMLElement> {
}
declare const CardSubtitle: BsPrefixRefForwardingComponent<'div', CardSubtitleProps>;
export default CardSubtitle;

View File

@@ -0,0 +1,23 @@
"use client";
import * as React from 'react';
import classNames from 'classnames';
import { useBootstrapPrefix } from './ThemeProvider';
import divWithClassName from './divWithClassName';
import { jsx as _jsx } from "react/jsx-runtime";
const DivStyledAsH6 = divWithClassName('h6');
const CardSubtitle = /*#__PURE__*/React.forwardRef(({
className,
bsPrefix,
as: Component = DivStyledAsH6,
...props
}, ref) => {
bsPrefix = useBootstrapPrefix(bsPrefix, 'card-subtitle');
return /*#__PURE__*/_jsx(Component, {
ref: ref,
className: classNames(className, bsPrefix),
...props
});
});
CardSubtitle.displayName = 'CardSubtitle';
export default CardSubtitle;

View File

@@ -0,0 +1,6 @@
import * as React from 'react';
import type { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
export interface CardTextProps extends BsPrefixProps, React.HTMLAttributes<HTMLElement> {
}
declare const CardText: BsPrefixRefForwardingComponent<'p', CardTextProps>;
export default CardText;

View File

@@ -0,0 +1,21 @@
"use client";
import * as React from 'react';
import classNames from 'classnames';
import { useBootstrapPrefix } from './ThemeProvider';
import { jsx as _jsx } from "react/jsx-runtime";
const CardText = /*#__PURE__*/React.forwardRef(({
className,
bsPrefix,
as: Component = 'p',
...props
}, ref) => {
bsPrefix = useBootstrapPrefix(bsPrefix, 'card-text');
return /*#__PURE__*/_jsx(Component, {
ref: ref,
className: classNames(className, bsPrefix),
...props
});
});
CardText.displayName = 'CardText';
export default CardText;

View File

@@ -0,0 +1,6 @@
import * as React from 'react';
import type { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
export interface CardTitleProps extends BsPrefixProps, React.HTMLAttributes<HTMLElement> {
}
declare const CardTitle: BsPrefixRefForwardingComponent<'div', CardTitleProps>;
export default CardTitle;

View File

@@ -0,0 +1,23 @@
"use client";
import * as React from 'react';
import classNames from 'classnames';
import { useBootstrapPrefix } from './ThemeProvider';
import divWithClassName from './divWithClassName';
import { jsx as _jsx } from "react/jsx-runtime";
const DivStyledAsH5 = divWithClassName('h5');
const CardTitle = /*#__PURE__*/React.forwardRef(({
className,
bsPrefix,
as: Component = DivStyledAsH5,
...props
}, ref) => {
bsPrefix = useBootstrapPrefix(bsPrefix, 'card-title');
return /*#__PURE__*/_jsx(Component, {
ref: ref,
className: classNames(className, bsPrefix),
...props
});
});
CardTitle.displayName = 'CardTitle';
export default CardTitle;

View File

@@ -0,0 +1,36 @@
import * as React from 'react';
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
export type CarouselVariant = 'dark' | string;
export interface CarouselRef {
element?: HTMLElement;
prev: (e?: React.SyntheticEvent) => void;
next: (e?: React.SyntheticEvent) => void;
}
export interface CarouselProps extends BsPrefixProps, Omit<React.HTMLAttributes<HTMLElement>, 'onSelect'> {
slide?: boolean;
fade?: boolean;
controls?: boolean;
indicators?: boolean;
indicatorLabels?: string[];
activeIndex?: number;
onSelect?: (eventKey: number, event: Record<string, unknown> | null) => void;
defaultActiveIndex?: number;
onSlide?: (eventKey: number, direction: 'start' | 'end') => void;
onSlid?: (eventKey: number, direction: 'start' | 'end') => void;
interval?: number | null;
keyboard?: boolean;
pause?: 'hover' | false;
wrap?: boolean;
touch?: boolean;
prevIcon?: React.ReactNode;
prevLabel?: React.ReactNode;
nextIcon?: React.ReactNode;
nextLabel?: React.ReactNode;
variant?: CarouselVariant;
ref?: React.Ref<CarouselRef> | React.MutableRefObject<CarouselRef | undefined>;
}
declare const _default: BsPrefixRefForwardingComponent<"div", CarouselProps> & {
Caption: BsPrefixRefForwardingComponent<"div", import("./CarouselCaption").CarouselCaptionProps>;
Item: BsPrefixRefForwardingComponent<"div", import("./CarouselItem").CarouselItemProps>;
};
export default _default;

View File

@@ -0,0 +1,336 @@
"use client";
import useEventCallback from '@restart/hooks/useEventCallback';
import useUpdateEffect from '@restart/hooks/useUpdateEffect';
import useCommittedRef from '@restart/hooks/useCommittedRef';
import useTimeout from '@restart/hooks/useTimeout';
import Anchor from '@restart/ui/Anchor';
import classNames from 'classnames';
import * as React from 'react';
import { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
import { useUncontrolled } from 'uncontrollable';
import CarouselCaption from './CarouselCaption';
import CarouselItem from './CarouselItem';
import { map, forEach } from './ElementChildren';
import { useBootstrapPrefix, useIsRTL } from './ThemeProvider';
import transitionEndListener from './transitionEndListener';
import triggerBrowserReflow from './triggerBrowserReflow';
import TransitionWrapper from './TransitionWrapper';
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
import { Fragment as _Fragment } from "react/jsx-runtime";
const SWIPE_THRESHOLD = 40;
function isVisible(element) {
if (!element || !element.style || !element.parentNode || !element.parentNode.style) {
return false;
}
const elementStyle = getComputedStyle(element);
return elementStyle.display !== 'none' && elementStyle.visibility !== 'hidden' && getComputedStyle(element.parentNode).display !== 'none';
}
const Carousel =
/*#__PURE__*/
// eslint-disable-next-line react/display-name
React.forwardRef(({
defaultActiveIndex = 0,
...uncontrolledProps
}, ref) => {
const {
// Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
as: Component = 'div',
bsPrefix,
slide = true,
fade = false,
controls = true,
indicators = true,
indicatorLabels = [],
activeIndex,
onSelect,
onSlide,
onSlid,
interval = 5000,
keyboard = true,
onKeyDown,
pause = 'hover',
onMouseOver,
onMouseOut,
wrap = true,
touch = true,
onTouchStart,
onTouchMove,
onTouchEnd,
prevIcon = /*#__PURE__*/_jsx("span", {
"aria-hidden": "true",
className: "carousel-control-prev-icon"
}),
prevLabel = 'Previous',
nextIcon = /*#__PURE__*/_jsx("span", {
"aria-hidden": "true",
className: "carousel-control-next-icon"
}),
nextLabel = 'Next',
variant,
className,
children,
...props
} = useUncontrolled({
defaultActiveIndex,
...uncontrolledProps
}, {
activeIndex: 'onSelect'
});
const prefix = useBootstrapPrefix(bsPrefix, 'carousel');
const isRTL = useIsRTL();
const nextDirectionRef = useRef(null);
const [direction, setDirection] = useState('next');
const [paused, setPaused] = useState(false);
const [isSliding, setIsSliding] = useState(false);
const [renderedActiveIndex, setRenderedActiveIndex] = useState(activeIndex || 0);
useEffect(() => {
if (!isSliding && activeIndex !== renderedActiveIndex) {
if (nextDirectionRef.current) {
setDirection(nextDirectionRef.current);
} else {
setDirection((activeIndex || 0) > renderedActiveIndex ? 'next' : 'prev');
}
if (slide) {
setIsSliding(true);
}
setRenderedActiveIndex(activeIndex || 0);
}
}, [activeIndex, isSliding, renderedActiveIndex, slide]);
useEffect(() => {
if (nextDirectionRef.current) {
nextDirectionRef.current = null;
}
});
let numChildren = 0;
let activeChildInterval;
// Iterate to grab all of the children's interval values
// (and count them, too)
forEach(children, (child, index) => {
++numChildren;
if (index === activeIndex) {
activeChildInterval = child.props.interval;
}
});
const activeChildIntervalRef = useCommittedRef(activeChildInterval);
const prev = useCallback(event => {
if (isSliding) {
return;
}
let nextActiveIndex = renderedActiveIndex - 1;
if (nextActiveIndex < 0) {
if (!wrap) {
return;
}
nextActiveIndex = numChildren - 1;
}
nextDirectionRef.current = 'prev';
onSelect == null || onSelect(nextActiveIndex, event);
}, [isSliding, renderedActiveIndex, onSelect, wrap, numChildren]);
// This is used in the setInterval, so it should not invalidate.
const next = useEventCallback(event => {
if (isSliding) {
return;
}
let nextActiveIndex = renderedActiveIndex + 1;
if (nextActiveIndex >= numChildren) {
if (!wrap) {
return;
}
nextActiveIndex = 0;
}
nextDirectionRef.current = 'next';
onSelect == null || onSelect(nextActiveIndex, event);
});
const elementRef = useRef();
useImperativeHandle(ref, () => ({
element: elementRef.current,
prev,
next
}));
// This is used in the setInterval, so it should not invalidate.
const nextWhenVisible = useEventCallback(() => {
if (!document.hidden && isVisible(elementRef.current)) {
if (isRTL) {
prev();
} else {
next();
}
}
});
const slideDirection = direction === 'next' ? 'start' : 'end';
useUpdateEffect(() => {
if (slide) {
// These callbacks will be handled by the <Transition> callbacks.
return;
}
onSlide == null || onSlide(renderedActiveIndex, slideDirection);
onSlid == null || onSlid(renderedActiveIndex, slideDirection);
}, [renderedActiveIndex]);
const orderClassName = `${prefix}-item-${direction}`;
const directionalClassName = `${prefix}-item-${slideDirection}`;
const handleEnter = useCallback(node => {
triggerBrowserReflow(node);
onSlide == null || onSlide(renderedActiveIndex, slideDirection);
}, [onSlide, renderedActiveIndex, slideDirection]);
const handleEntered = useCallback(() => {
setIsSliding(false);
onSlid == null || onSlid(renderedActiveIndex, slideDirection);
}, [onSlid, renderedActiveIndex, slideDirection]);
const handleKeyDown = useCallback(event => {
if (keyboard && !/input|textarea/i.test(event.target.tagName)) {
switch (event.key) {
case 'ArrowLeft':
event.preventDefault();
if (isRTL) {
next(event);
} else {
prev(event);
}
return;
case 'ArrowRight':
event.preventDefault();
if (isRTL) {
prev(event);
} else {
next(event);
}
return;
default:
}
}
onKeyDown == null || onKeyDown(event);
}, [keyboard, onKeyDown, prev, next, isRTL]);
const handleMouseOver = useCallback(event => {
if (pause === 'hover') {
setPaused(true);
}
onMouseOver == null || onMouseOver(event);
}, [pause, onMouseOver]);
const handleMouseOut = useCallback(event => {
setPaused(false);
onMouseOut == null || onMouseOut(event);
}, [onMouseOut]);
const touchStartXRef = useRef(0);
const touchDeltaXRef = useRef(0);
const touchUnpauseTimeout = useTimeout();
const handleTouchStart = useCallback(event => {
touchStartXRef.current = event.touches[0].clientX;
touchDeltaXRef.current = 0;
if (pause === 'hover') {
setPaused(true);
}
onTouchStart == null || onTouchStart(event);
}, [pause, onTouchStart]);
const handleTouchMove = useCallback(event => {
if (event.touches && event.touches.length > 1) {
touchDeltaXRef.current = 0;
} else {
touchDeltaXRef.current = event.touches[0].clientX - touchStartXRef.current;
}
onTouchMove == null || onTouchMove(event);
}, [onTouchMove]);
const handleTouchEnd = useCallback(event => {
if (touch) {
const touchDeltaX = touchDeltaXRef.current;
if (Math.abs(touchDeltaX) > SWIPE_THRESHOLD) {
if (touchDeltaX > 0) {
prev(event);
} else {
next(event);
}
}
}
if (pause === 'hover') {
touchUnpauseTimeout.set(() => {
setPaused(false);
}, interval || undefined);
}
onTouchEnd == null || onTouchEnd(event);
}, [touch, pause, prev, next, touchUnpauseTimeout, interval, onTouchEnd]);
const shouldPlay = interval != null && !paused && !isSliding;
const intervalHandleRef = useRef();
useEffect(() => {
var _ref, _activeChildIntervalR;
if (!shouldPlay) {
return undefined;
}
const nextFunc = isRTL ? prev : next;
intervalHandleRef.current = window.setInterval(document.visibilityState ? nextWhenVisible : nextFunc, (_ref = (_activeChildIntervalR = activeChildIntervalRef.current) != null ? _activeChildIntervalR : interval) != null ? _ref : undefined);
return () => {
if (intervalHandleRef.current !== null) {
clearInterval(intervalHandleRef.current);
}
};
}, [shouldPlay, prev, next, activeChildIntervalRef, interval, nextWhenVisible, isRTL]);
const indicatorOnClicks = useMemo(() => indicators && Array.from({
length: numChildren
}, (_, index) => event => {
onSelect == null || onSelect(index, event);
}), [indicators, numChildren, onSelect]);
return /*#__PURE__*/_jsxs(Component, {
ref: elementRef,
...props,
onKeyDown: handleKeyDown,
onMouseOver: handleMouseOver,
onMouseOut: handleMouseOut,
onTouchStart: handleTouchStart,
onTouchMove: handleTouchMove,
onTouchEnd: handleTouchEnd,
className: classNames(className, prefix, slide && 'slide', fade && `${prefix}-fade`, variant && `${prefix}-${variant}`),
children: [indicators && /*#__PURE__*/_jsx("div", {
className: `${prefix}-indicators`,
children: map(children, (_, index) => /*#__PURE__*/_jsx("button", {
type: "button",
"data-bs-target": "" // Bootstrap requires this in their css.
,
"aria-label": indicatorLabels != null && indicatorLabels.length ? indicatorLabels[index] : `Slide ${index + 1}`,
className: index === renderedActiveIndex ? 'active' : undefined,
onClick: indicatorOnClicks ? indicatorOnClicks[index] : undefined,
"aria-current": index === renderedActiveIndex
}, index))
}), /*#__PURE__*/_jsx("div", {
className: `${prefix}-inner`,
children: map(children, (child, index) => {
const isActive = index === renderedActiveIndex;
return slide ? /*#__PURE__*/_jsx(TransitionWrapper, {
in: isActive,
onEnter: isActive ? handleEnter : undefined,
onEntered: isActive ? handleEntered : undefined,
addEndListener: transitionEndListener,
children: (status, innerProps) => /*#__PURE__*/React.cloneElement(child, {
...innerProps,
className: classNames(child.props.className, isActive && status !== 'entered' && orderClassName, (status === 'entered' || status === 'exiting') && 'active', (status === 'entering' || status === 'exiting') && directionalClassName)
})
}) : ( /*#__PURE__*/React.cloneElement(child, {
className: classNames(child.props.className, isActive && 'active')
}));
})
}), controls && /*#__PURE__*/_jsxs(_Fragment, {
children: [(wrap || activeIndex !== 0) && /*#__PURE__*/_jsxs(Anchor, {
className: `${prefix}-control-prev`,
onClick: prev,
children: [prevIcon, prevLabel && /*#__PURE__*/_jsx("span", {
className: "visually-hidden",
children: prevLabel
})]
}), (wrap || activeIndex !== numChildren - 1) && /*#__PURE__*/_jsxs(Anchor, {
className: `${prefix}-control-next`,
onClick: next,
children: [nextIcon, nextLabel && /*#__PURE__*/_jsx("span", {
className: "visually-hidden",
children: nextLabel
})]
})]
})]
});
});
Carousel.displayName = 'Carousel';
export default Object.assign(Carousel, {
Caption: CarouselCaption,
Item: CarouselItem
});

View File

@@ -0,0 +1,6 @@
import * as React from 'react';
import type { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
export interface CarouselCaptionProps extends BsPrefixProps, React.HTMLAttributes<HTMLElement> {
}
declare const CarouselCaption: BsPrefixRefForwardingComponent<'div', CarouselCaptionProps>;
export default CarouselCaption;

View File

@@ -0,0 +1,21 @@
"use client";
import * as React from 'react';
import classNames from 'classnames';
import { useBootstrapPrefix } from './ThemeProvider';
import { jsx as _jsx } from "react/jsx-runtime";
const CarouselCaption = /*#__PURE__*/React.forwardRef(({
className,
bsPrefix,
as: Component = 'div',
...props
}, ref) => {
bsPrefix = useBootstrapPrefix(bsPrefix, 'carousel-caption');
return /*#__PURE__*/_jsx(Component, {
ref: ref,
className: classNames(className, bsPrefix),
...props
});
});
CarouselCaption.displayName = 'CarouselCaption';
export default CarouselCaption;

View File

@@ -0,0 +1,7 @@
import * as React from 'react';
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
export interface CarouselItemProps extends BsPrefixProps, React.HTMLAttributes<HTMLElement> {
interval?: number;
}
declare const CarouselItem: BsPrefixRefForwardingComponent<'div', CarouselItemProps>;
export default CarouselItem;

View File

@@ -0,0 +1,22 @@
"use client";
import classNames from 'classnames';
import * as React from 'react';
import { useBootstrapPrefix } from './ThemeProvider';
import { jsx as _jsx } from "react/jsx-runtime";
const CarouselItem = /*#__PURE__*/React.forwardRef(({
// Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
as: Component = 'div',
bsPrefix,
className,
...props
}, ref) => {
const finalClassName = classNames(className, useBootstrapPrefix(bsPrefix, 'carousel-item'));
return /*#__PURE__*/_jsx(Component, {
ref: ref,
...props,
className: finalClassName
});
});
CarouselItem.displayName = 'CarouselItem';
export default CarouselItem;

View File

@@ -0,0 +1,7 @@
import * as React from 'react';
export type CloseButtonVariant = 'white' | string;
export interface CloseButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
variant?: CloseButtonVariant;
}
declare const CloseButton: React.ForwardRefExoticComponent<CloseButtonProps & React.RefAttributes<HTMLButtonElement>>;
export default CloseButton;

View File

@@ -0,0 +1,31 @@
import PropTypes from 'prop-types';
import * as React from 'react';
import classNames from 'classnames';
import { jsx as _jsx } from "react/jsx-runtime";
const propTypes = {
/** An accessible label indicating the relevant information about the Close Button. */
'aria-label': PropTypes.string,
/** A callback fired after the Close Button is clicked. */
onClick: PropTypes.func,
/**
* Render different color variant for the button.
*
* Omitting this will render the default dark color.
*/
variant: PropTypes.oneOf(['white'])
};
const CloseButton = /*#__PURE__*/React.forwardRef(({
className,
variant,
'aria-label': ariaLabel = 'Close',
...props
}, ref) => /*#__PURE__*/_jsx("button", {
ref: ref,
type: "button",
className: classNames('btn-close', variant && `btn-close-${variant}`, className),
"aria-label": ariaLabel,
...props
}));
CloseButton.displayName = 'CloseButton';
CloseButton.propTypes = propTypes;
export default CloseButton;

View File

@@ -0,0 +1,28 @@
import * as React from 'react';
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
type NumberAttr = number | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12';
type ColOrderNumber = number | '1' | '2' | '3' | '4' | '5';
type ColOrder = ColOrderNumber | 'first' | 'last';
type ColSize = boolean | 'auto' | NumberAttr;
type ColSpec = ColSize | {
span?: ColSize | null;
offset?: NumberAttr;
order?: ColOrder;
};
export interface ColProps extends BsPrefixProps, React.HTMLAttributes<HTMLElement> {
xs?: ColSpec;
sm?: ColSpec;
md?: ColSpec;
lg?: ColSpec;
xl?: ColSpec;
xxl?: ColSpec;
[key: string]: any;
}
export interface UseColMetadata {
as?: React.ElementType;
bsPrefix: string;
spans: string[];
}
export declare function useCol({ as, bsPrefix, className, ...props }: ColProps): [any, UseColMetadata];
declare const Col: BsPrefixRefForwardingComponent<'div', ColProps>;
export default Col;

View File

@@ -0,0 +1,65 @@
"use client";
import classNames from 'classnames';
import * as React from 'react';
import { useBootstrapPrefix, useBootstrapBreakpoints, useBootstrapMinBreakpoint } from './ThemeProvider';
import { jsx as _jsx } from "react/jsx-runtime";
export function useCol({
as,
bsPrefix,
className,
...props
}) {
bsPrefix = useBootstrapPrefix(bsPrefix, 'col');
const breakpoints = useBootstrapBreakpoints();
const minBreakpoint = useBootstrapMinBreakpoint();
const spans = [];
const classes = [];
breakpoints.forEach(brkPoint => {
const propValue = props[brkPoint];
delete props[brkPoint];
let span;
let offset;
let order;
if (typeof propValue === 'object' && propValue != null) {
({
span,
offset,
order
} = propValue);
} else {
span = propValue;
}
const infix = brkPoint !== minBreakpoint ? `-${brkPoint}` : '';
if (span) spans.push(span === true ? `${bsPrefix}${infix}` : `${bsPrefix}${infix}-${span}`);
if (order != null) classes.push(`order${infix}-${order}`);
if (offset != null) classes.push(`offset${infix}-${offset}`);
});
return [{
...props,
className: classNames(className, ...spans, ...classes)
}, {
as,
bsPrefix,
spans
}];
}
const Col = /*#__PURE__*/React.forwardRef(
// Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
(props, ref) => {
const [{
className,
...colProps
}, {
as: Component = 'div',
bsPrefix,
spans
}] = useCol(props);
return /*#__PURE__*/_jsx(Component, {
...colProps,
ref: ref,
className: classNames(className, !spans.length && bsPrefix)
});
});
Col.displayName = 'Col';
export default Col;

View File

@@ -0,0 +1,17 @@
import React from 'react';
import Transition from 'react-transition-group/Transition';
import { TransitionCallbacks } from '@restart/ui/types';
type Dimension = 'height' | 'width';
export interface CollapseProps extends TransitionCallbacks, Pick<React.HTMLAttributes<HTMLElement>, 'role'> {
className?: string;
in?: boolean;
mountOnEnter?: boolean;
unmountOnExit?: boolean;
appear?: boolean;
timeout?: number;
dimension?: Dimension | (() => Dimension);
getDimensionValue?: (dimension: Dimension, element: HTMLElement) => number;
children: React.ReactElement;
}
declare const Collapse: React.ForwardRefExoticComponent<CollapseProps & React.RefAttributes<Transition<any>>>;
export default Collapse;

View File

@@ -0,0 +1,94 @@
import classNames from 'classnames';
import css from 'dom-helpers/css';
import React, { useMemo } from 'react';
import { ENTERED, ENTERING, EXITED, EXITING } from 'react-transition-group/Transition';
import { getChildRef } from '@restart/ui/utils';
import transitionEndListener from './transitionEndListener';
import createChainedFunction from './createChainedFunction';
import triggerBrowserReflow from './triggerBrowserReflow';
import TransitionWrapper from './TransitionWrapper';
import { jsx as _jsx } from "react/jsx-runtime";
const MARGINS = {
height: ['marginTop', 'marginBottom'],
width: ['marginLeft', 'marginRight']
};
function getDefaultDimensionValue(dimension, elem) {
const offset = `offset${dimension[0].toUpperCase()}${dimension.slice(1)}`;
const value = elem[offset];
const margins = MARGINS[dimension];
return value +
// @ts-expect-error TODO
parseInt(css(elem, margins[0]), 10) +
// @ts-expect-error TODO
parseInt(css(elem, margins[1]), 10);
}
const collapseStyles = {
[EXITED]: 'collapse',
[EXITING]: 'collapsing',
[ENTERING]: 'collapsing',
[ENTERED]: 'collapse show'
};
const Collapse = /*#__PURE__*/React.forwardRef(({
onEnter,
onEntering,
onEntered,
onExit,
onExiting,
className,
children,
dimension = 'height',
in: inProp = false,
timeout = 300,
mountOnEnter = false,
unmountOnExit = false,
appear = false,
getDimensionValue = getDefaultDimensionValue,
...props
}, ref) => {
/* Compute dimension */
const computedDimension = typeof dimension === 'function' ? dimension() : dimension;
/* -- Expanding -- */
const handleEnter = useMemo(() => createChainedFunction(elem => {
elem.style[computedDimension] = '0';
}, onEnter), [computedDimension, onEnter]);
const handleEntering = useMemo(() => createChainedFunction(elem => {
const scroll = `scroll${computedDimension[0].toUpperCase()}${computedDimension.slice(1)}`;
elem.style[computedDimension] = `${elem[scroll]}px`;
}, onEntering), [computedDimension, onEntering]);
const handleEntered = useMemo(() => createChainedFunction(elem => {
elem.style[computedDimension] = null;
}, onEntered), [computedDimension, onEntered]);
/* -- Collapsing -- */
const handleExit = useMemo(() => createChainedFunction(elem => {
elem.style[computedDimension] = `${getDimensionValue(computedDimension, elem)}px`;
triggerBrowserReflow(elem);
}, onExit), [onExit, getDimensionValue, computedDimension]);
const handleExiting = useMemo(() => createChainedFunction(elem => {
elem.style[computedDimension] = null;
}, onExiting), [computedDimension, onExiting]);
return /*#__PURE__*/_jsx(TransitionWrapper, {
ref: ref,
addEndListener: transitionEndListener,
...props,
"aria-expanded": props.role ? inProp : null,
onEnter: handleEnter,
onEntering: handleEntering,
onEntered: handleEntered,
onExit: handleExit,
onExiting: handleExiting,
childRef: getChildRef(children),
in: inProp,
timeout: timeout,
mountOnEnter: mountOnEnter,
unmountOnExit: unmountOnExit,
appear: appear,
children: (state, innerProps) => /*#__PURE__*/React.cloneElement(children, {
...innerProps,
className: classNames(className, children.props.className, collapseStyles[state], computedDimension === 'width' && 'collapse-horizontal')
})
});
});
Collapse.displayName = 'Collapse';
export default Collapse;

View File

@@ -0,0 +1,7 @@
import * as React from 'react';
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
export interface ContainerProps extends BsPrefixProps, React.HTMLAttributes<HTMLElement> {
fluid?: boolean | string | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
}
declare const Container: BsPrefixRefForwardingComponent<'div', ContainerProps>;
export default Container;

View File

@@ -0,0 +1,24 @@
"use client";
import classNames from 'classnames';
import * as React from 'react';
import { useBootstrapPrefix } from './ThemeProvider';
import { jsx as _jsx } from "react/jsx-runtime";
const Container = /*#__PURE__*/React.forwardRef(({
bsPrefix,
fluid = false,
// Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
as: Component = 'div',
className,
...props
}, ref) => {
const prefix = useBootstrapPrefix(bsPrefix, 'container');
const suffix = typeof fluid === 'string' ? `-${fluid}` : '-fluid';
return /*#__PURE__*/_jsx(Component, {
ref: ref,
...props,
className: classNames(className, fluid ? `${prefix}${suffix}` : prefix)
});
});
Container.displayName = 'Container';
export default Container;

View File

@@ -0,0 +1,21 @@
import * as React from 'react';
import { DropdownProps as BaseDropdownProps } from '@restart/ui/Dropdown';
import { DropDirection } from './DropdownContext';
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
import { AlignType } from './types';
export interface DropdownProps extends BaseDropdownProps, BsPrefixProps, Omit<React.HTMLAttributes<HTMLElement>, 'onSelect' | 'children' | 'onToggle'> {
drop?: DropDirection;
align?: AlignType;
focusFirstItemOnShow?: boolean | 'keyboard';
navbar?: boolean;
autoClose?: boolean | 'outside' | 'inside';
}
declare const _default: BsPrefixRefForwardingComponent<"div", DropdownProps> & {
Toggle: BsPrefixRefForwardingComponent<"button", import("./DropdownToggle").DropdownToggleProps>;
Menu: BsPrefixRefForwardingComponent<"div", import("./DropdownMenu").DropdownMenuProps>;
Item: BsPrefixRefForwardingComponent<"a", import("./DropdownItem").DropdownItemProps>;
ItemText: BsPrefixRefForwardingComponent<"span", import("./DropdownItemText").DropdownItemTextProps>;
Divider: BsPrefixRefForwardingComponent<"hr", import("./DropdownDivider").DropdownDividerProps>;
Header: BsPrefixRefForwardingComponent<"div", import("./DropdownHeader").DropdownHeaderProps>;
};
export default _default;

View File

@@ -0,0 +1,104 @@
"use client";
import classNames from 'classnames';
import * as React from 'react';
import { useContext, useMemo } from 'react';
import BaseDropdown from '@restart/ui/Dropdown';
import { useUncontrolled } from 'uncontrollable';
import useEventCallback from '@restart/hooks/useEventCallback';
import DropdownContext from './DropdownContext';
import DropdownDivider from './DropdownDivider';
import DropdownHeader from './DropdownHeader';
import DropdownItem from './DropdownItem';
import DropdownItemText from './DropdownItemText';
import DropdownMenu, { getDropdownMenuPlacement } from './DropdownMenu';
import DropdownToggle from './DropdownToggle';
import InputGroupContext from './InputGroupContext';
import { useBootstrapPrefix, useIsRTL } from './ThemeProvider';
import { alignPropType } from './types';
import { jsx as _jsx } from "react/jsx-runtime";
const Dropdown = /*#__PURE__*/React.forwardRef((pProps, ref) => {
const {
bsPrefix,
drop = 'down',
show,
className,
align = 'start',
onSelect,
onToggle,
focusFirstItemOnShow,
// Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
as: Component = 'div',
navbar: _4,
autoClose = true,
...props
} = useUncontrolled(pProps, {
show: 'onToggle'
});
const isInputGroup = useContext(InputGroupContext);
const prefix = useBootstrapPrefix(bsPrefix, 'dropdown');
const isRTL = useIsRTL();
const isClosingPermitted = source => {
// autoClose=false only permits close on button click
if (autoClose === false) return source === 'click';
// autoClose=inside doesn't permit close on rootClose
if (autoClose === 'inside') return source !== 'rootClose';
// autoClose=outside doesn't permit close on select
if (autoClose === 'outside') return source !== 'select';
return true;
};
const handleToggle = useEventCallback((nextShow, meta) => {
var _meta$originalEvent;
/** Checking if target of event is ToggleButton,
* if it is then nullify mousedown event
*/
const isToggleButton = (_meta$originalEvent = meta.originalEvent) == null || (_meta$originalEvent = _meta$originalEvent.target) == null ? void 0 : _meta$originalEvent.classList.contains('dropdown-toggle');
if (isToggleButton && meta.source === 'mousedown') {
return;
}
if (meta.originalEvent.currentTarget === document && (meta.source !== 'keydown' || meta.originalEvent.key === 'Escape')) meta.source = 'rootClose';
if (isClosingPermitted(meta.source)) onToggle == null || onToggle(nextShow, meta);
});
const alignEnd = align === 'end';
const placement = getDropdownMenuPlacement(alignEnd, drop, isRTL);
const contextValue = useMemo(() => ({
align,
drop,
isRTL
}), [align, drop, isRTL]);
const directionClasses = {
down: prefix,
'down-centered': `${prefix}-center`,
up: 'dropup',
'up-centered': 'dropup-center dropup',
end: 'dropend',
start: 'dropstart'
};
return /*#__PURE__*/_jsx(DropdownContext.Provider, {
value: contextValue,
children: /*#__PURE__*/_jsx(BaseDropdown, {
placement: placement,
show: show,
onSelect: onSelect,
onToggle: handleToggle,
focusFirstItemOnShow: focusFirstItemOnShow,
itemSelector: `.${prefix}-item:not(.disabled):not(:disabled)`,
children: isInputGroup ? props.children : /*#__PURE__*/_jsx(Component, {
...props,
ref: ref,
className: classNames(className, show && 'show', directionClasses[drop])
})
})
});
});
Dropdown.displayName = 'Dropdown';
export default Object.assign(Dropdown, {
Toggle: DropdownToggle,
Menu: DropdownMenu,
Item: DropdownItem,
ItemText: DropdownItemText,
Divider: DropdownDivider,
Header: DropdownHeader
});

View File

@@ -0,0 +1,24 @@
import * as React from 'react';
import { DropdownProps } from './Dropdown';
import { PropsFromToggle } from './DropdownToggle';
import { DropdownMenuVariant } from './DropdownMenu';
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
export interface DropdownButtonProps extends Omit<DropdownProps, 'title'>, PropsFromToggle, BsPrefixProps {
title: React.ReactNode;
menuRole?: string;
renderMenuOnMount?: boolean;
rootCloseEvent?: 'click' | 'mousedown';
menuVariant?: DropdownMenuVariant;
flip?: boolean;
}
/**
* A convenience component for simple or general use dropdowns. Renders a `Button` toggle and all `children`
* are passed directly to the default `Dropdown.Menu`. This component accepts all of
* [`Dropdown`'s props](#dropdown-props).
*
* _All unknown props are passed through to the `Dropdown` component._ Only
* the Button `variant`, `size` and `bsPrefix` props are passed to the toggle,
* along with menu-related props are passed to the `Dropdown.Menu`
*/
declare const DropdownButton: BsPrefixRefForwardingComponent<'div', DropdownButtonProps>;
export default DropdownButton;

View File

@@ -0,0 +1,107 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import Dropdown from './Dropdown';
import DropdownToggle from './DropdownToggle';
import DropdownMenu from './DropdownMenu';
import { alignPropType } from './types';
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
const propTypes = {
/**
* An html id attribute for the Toggle button, necessary for assistive technologies, such as screen readers.
* @type {string}
*/
id: PropTypes.string,
/** An `href` passed to the Toggle component */
href: PropTypes.string,
/** An `onClick` handler passed to the Toggle component */
onClick: PropTypes.func,
/** The content of the non-toggle Button. */
title: PropTypes.node.isRequired,
/** Disables both Buttons */
disabled: PropTypes.bool,
/**
* Aligns the dropdown menu.
*
* _see [DropdownMenu](#dropdown-menu-props) for more details_
*
* @type {"start"|"end"|{ sm: "start"|"end" }|{ md: "start"|"end" }|{ lg: "start"|"end" }|{ xl: "start"|"end"}|{ xxl: "start"|"end"} }
*/
align: alignPropType,
/** An ARIA accessible role applied to the Menu component. When set to 'menu', The dropdown */
menuRole: PropTypes.string,
/** Whether to render the dropdown menu in the DOM before the first time it is shown */
renderMenuOnMount: PropTypes.bool,
/**
* Which event when fired outside the component will cause it to be closed.
*
* _see [DropdownMenu](#dropdown-menu-props) for more details_
*/
rootCloseEvent: PropTypes.string,
/**
* Menu color variant.
*
* Omitting this will use the default light color.
*/
menuVariant: PropTypes.oneOf(['dark']),
/**
* Allow Dropdown to flip in case of an overlapping on the reference element. For more information refer to
* Popper.js's flip [docs](https://popper.js.org/docs/v2/modifiers/flip/).
*
*/
flip: PropTypes.bool,
/** @ignore */
bsPrefix: PropTypes.string,
/** @ignore */
variant: PropTypes.string,
/** @ignore */
size: PropTypes.string
};
/**
* A convenience component for simple or general use dropdowns. Renders a `Button` toggle and all `children`
* are passed directly to the default `Dropdown.Menu`. This component accepts all of
* [`Dropdown`'s props](#dropdown-props).
*
* _All unknown props are passed through to the `Dropdown` component._ Only
* the Button `variant`, `size` and `bsPrefix` props are passed to the toggle,
* along with menu-related props are passed to the `Dropdown.Menu`
*/
const DropdownButton = /*#__PURE__*/React.forwardRef(({
title,
children,
bsPrefix,
rootCloseEvent,
variant,
size,
menuRole,
renderMenuOnMount,
disabled,
href,
id,
menuVariant,
flip,
...props
}, ref) => /*#__PURE__*/_jsxs(Dropdown, {
ref: ref,
...props,
children: [/*#__PURE__*/_jsx(DropdownToggle, {
id: id,
href: href,
size: size,
variant: variant,
disabled: disabled,
childBsPrefix: bsPrefix,
children: title
}), /*#__PURE__*/_jsx(DropdownMenu, {
role: menuRole,
renderOnMount: renderMenuOnMount,
rootCloseEvent: rootCloseEvent,
variant: menuVariant,
flip: flip,
children: children
})]
}));
DropdownButton.displayName = 'DropdownButton';
DropdownButton.propTypes = propTypes;
export default DropdownButton;

View File

@@ -0,0 +1,10 @@
import * as React from 'react';
import { AlignType } from './types';
export type DropDirection = 'up' | 'up-centered' | 'start' | 'end' | 'down' | 'down-centered';
export type DropdownContextValue = {
align?: AlignType;
drop?: DropDirection;
isRTL?: boolean;
};
declare const DropdownContext: React.Context<DropdownContextValue>;
export default DropdownContext;

View File

@@ -0,0 +1,6 @@
"use client";
import * as React from 'react';
const DropdownContext = /*#__PURE__*/React.createContext({});
DropdownContext.displayName = 'DropdownContext';
export default DropdownContext;

View File

@@ -0,0 +1,6 @@
import * as React from 'react';
import type { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
export interface DropdownDividerProps extends BsPrefixProps, React.HTMLAttributes<HTMLElement> {
}
declare const DropdownDivider: BsPrefixRefForwardingComponent<'hr', DropdownDividerProps>;
export default DropdownDivider;

View File

@@ -0,0 +1,23 @@
"use client";
import * as React from 'react';
import classNames from 'classnames';
import { useBootstrapPrefix } from './ThemeProvider';
import { jsx as _jsx } from "react/jsx-runtime";
const DropdownDivider = /*#__PURE__*/React.forwardRef(({
className,
bsPrefix,
as: Component = 'hr',
role = 'separator',
...props
}, ref) => {
bsPrefix = useBootstrapPrefix(bsPrefix, 'dropdown-divider');
return /*#__PURE__*/_jsx(Component, {
ref: ref,
className: classNames(className, bsPrefix),
role: role,
...props
});
});
DropdownDivider.displayName = 'DropdownDivider';
export default DropdownDivider;

View File

@@ -0,0 +1,6 @@
import * as React from 'react';
import type { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
export interface DropdownHeaderProps extends BsPrefixProps, React.HTMLAttributes<HTMLElement> {
}
declare const DropdownHeader: BsPrefixRefForwardingComponent<'div', DropdownHeaderProps>;
export default DropdownHeader;

View File

@@ -0,0 +1,23 @@
"use client";
import * as React from 'react';
import classNames from 'classnames';
import { useBootstrapPrefix } from './ThemeProvider';
import { jsx as _jsx } from "react/jsx-runtime";
const DropdownHeader = /*#__PURE__*/React.forwardRef(({
className,
bsPrefix,
as: Component = 'div',
role = 'heading',
...props
}, ref) => {
bsPrefix = useBootstrapPrefix(bsPrefix, 'dropdown-header');
return /*#__PURE__*/_jsx(Component, {
ref: ref,
className: classNames(className, bsPrefix),
role: role,
...props
});
});
DropdownHeader.displayName = 'DropdownHeader';
export default DropdownHeader;

View File

@@ -0,0 +1,6 @@
import { DropdownItemProps as BaseDropdownItemProps } from '@restart/ui/DropdownItem';
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
export interface DropdownItemProps extends BaseDropdownItemProps, BsPrefixProps {
}
declare const DropdownItem: BsPrefixRefForwardingComponent<'a', DropdownItemProps>;
export default DropdownItem;

View File

@@ -0,0 +1,35 @@
"use client";
import classNames from 'classnames';
import * as React from 'react';
import { useDropdownItem } from '@restart/ui/DropdownItem';
import Anchor from '@restart/ui/Anchor';
import { useBootstrapPrefix } from './ThemeProvider';
import { jsx as _jsx } from "react/jsx-runtime";
const DropdownItem = /*#__PURE__*/React.forwardRef(({
bsPrefix,
className,
eventKey,
disabled = false,
onClick,
active,
as: Component = Anchor,
...props
}, ref) => {
const prefix = useBootstrapPrefix(bsPrefix, 'dropdown-item');
const [dropdownItemProps, meta] = useDropdownItem({
key: eventKey,
href: props.href,
disabled,
onClick,
active
});
return /*#__PURE__*/_jsx(Component, {
...props,
...dropdownItemProps,
ref: ref,
className: classNames(className, prefix, meta.isActive && 'active', disabled && 'disabled')
});
});
DropdownItem.displayName = 'DropdownItem';
export default DropdownItem;

View File

@@ -0,0 +1,6 @@
import * as React from 'react';
import type { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
export interface DropdownItemTextProps extends BsPrefixProps, React.HTMLAttributes<HTMLElement> {
}
declare const DropdownItemText: BsPrefixRefForwardingComponent<'span', DropdownItemTextProps>;
export default DropdownItemText;

View File

@@ -0,0 +1,21 @@
"use client";
import * as React from 'react';
import classNames from 'classnames';
import { useBootstrapPrefix } from './ThemeProvider';
import { jsx as _jsx } from "react/jsx-runtime";
const DropdownItemText = /*#__PURE__*/React.forwardRef(({
className,
bsPrefix,
as: Component = 'span',
...props
}, ref) => {
bsPrefix = useBootstrapPrefix(bsPrefix, 'dropdown-item-text');
return /*#__PURE__*/_jsx(Component, {
ref: ref,
className: classNames(className, bsPrefix),
...props
});
});
DropdownItemText.displayName = 'DropdownItemText';
export default DropdownItemText;

View File

@@ -0,0 +1,18 @@
import * as React from 'react';
import { UseDropdownMenuOptions } from '@restart/ui/DropdownMenu';
import { DropDirection } from './DropdownContext';
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
import { AlignType } from './types';
export type DropdownMenuVariant = 'dark' | string;
export interface DropdownMenuProps extends BsPrefixProps, React.HTMLAttributes<HTMLElement> {
show?: boolean;
renderOnMount?: boolean;
flip?: boolean;
align?: AlignType;
rootCloseEvent?: 'click' | 'mousedown';
popperConfig?: UseDropdownMenuOptions['popperConfig'];
variant?: DropdownMenuVariant;
}
export declare function getDropdownMenuPlacement(alignEnd: boolean, dropDirection?: DropDirection, isRTL?: boolean): "bottom" | "top" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end";
declare const DropdownMenu: BsPrefixRefForwardingComponent<'div', DropdownMenuProps>;
export default DropdownMenu;

View File

@@ -0,0 +1,124 @@
"use client";
import classNames from 'classnames';
import * as React from 'react';
import { useContext } from 'react';
import { useDropdownMenu } from '@restart/ui/DropdownMenu';
import useIsomorphicEffect from '@restart/hooks/useIsomorphicEffect';
import useMergedRefs from '@restart/hooks/useMergedRefs';
import warning from 'warning';
import DropdownContext from './DropdownContext';
import InputGroupContext from './InputGroupContext';
import NavbarContext from './NavbarContext';
import { useBootstrapPrefix } from './ThemeProvider';
import useWrappedRefWithWarning from './useWrappedRefWithWarning';
import { alignPropType } from './types';
import { jsx as _jsx } from "react/jsx-runtime";
export function getDropdownMenuPlacement(alignEnd, dropDirection, isRTL) {
const topStart = isRTL ? 'top-end' : 'top-start';
const topEnd = isRTL ? 'top-start' : 'top-end';
const bottomStart = isRTL ? 'bottom-end' : 'bottom-start';
const bottomEnd = isRTL ? 'bottom-start' : 'bottom-end';
const leftStart = isRTL ? 'right-start' : 'left-start';
const leftEnd = isRTL ? 'right-end' : 'left-end';
const rightStart = isRTL ? 'left-start' : 'right-start';
const rightEnd = isRTL ? 'left-end' : 'right-end';
let placement = alignEnd ? bottomEnd : bottomStart;
if (dropDirection === 'up') placement = alignEnd ? topEnd : topStart;else if (dropDirection === 'end') placement = alignEnd ? rightEnd : rightStart;else if (dropDirection === 'start') placement = alignEnd ? leftEnd : leftStart;else if (dropDirection === 'down-centered') placement = 'bottom';else if (dropDirection === 'up-centered') placement = 'top';
return placement;
}
const DropdownMenu = /*#__PURE__*/React.forwardRef(({
bsPrefix,
className,
align,
rootCloseEvent,
flip = true,
show: showProps,
renderOnMount,
// Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
as: Component = 'div',
popperConfig,
variant,
...props
}, ref) => {
let alignEnd = false;
const isNavbar = useContext(NavbarContext);
const prefix = useBootstrapPrefix(bsPrefix, 'dropdown-menu');
const {
align: contextAlign,
drop,
isRTL
} = useContext(DropdownContext);
align = align || contextAlign;
const isInputGroup = useContext(InputGroupContext);
const alignClasses = [];
if (align) {
if (typeof align === 'object') {
const keys = Object.keys(align);
process.env.NODE_ENV !== "production" ? warning(keys.length === 1, 'There should only be 1 breakpoint when passing an object to `align`') : void 0;
if (keys.length) {
const brkPoint = keys[0];
const direction = align[brkPoint];
// .dropdown-menu-end is required for responsively aligning
// left in addition to align left classes.
alignEnd = direction === 'start';
alignClasses.push(`${prefix}-${brkPoint}-${direction}`);
}
} else if (align === 'end') {
alignEnd = true;
}
}
const placement = getDropdownMenuPlacement(alignEnd, drop, isRTL);
const [menuProps, {
hasShown,
popper,
show,
toggle
}] = useDropdownMenu({
flip,
rootCloseEvent,
show: showProps,
usePopper: !isNavbar && alignClasses.length === 0,
offset: [0, 2],
popperConfig,
placement
});
menuProps.ref = useMergedRefs(useWrappedRefWithWarning(ref, 'DropdownMenu'), menuProps.ref);
useIsomorphicEffect(() => {
// Popper's initial position for the menu is incorrect when
// renderOnMount=true. Need to call update() to correct it.
if (show) popper == null || popper.update();
}, [show]);
if (!hasShown && !renderOnMount && !isInputGroup) return null;
// For custom components provide additional, non-DOM, props;
if (typeof Component !== 'string') {
menuProps.show = show;
menuProps.close = () => toggle == null ? void 0 : toggle(false);
menuProps.align = align;
}
let style = props.style;
if (popper != null && popper.placement) {
// we don't need the default popper style,
// menus are display: none when not shown.
style = {
...props.style,
...menuProps.style
};
props['x-placement'] = popper.placement;
}
return /*#__PURE__*/_jsx(Component, {
...props,
...menuProps,
style: style
// Bootstrap css requires this data attrib to style responsive menus.
,
...((alignClasses.length || isNavbar) && {
'data-bs-popper': 'static'
}),
className: classNames(className, prefix, show && 'show', alignEnd && `${prefix}-end`, variant && `${prefix}-${variant}`, ...alignClasses)
});
});
DropdownMenu.displayName = 'DropdownMenu';
export default DropdownMenu;

View File

@@ -0,0 +1,12 @@
import * as React from 'react';
import { ButtonProps, CommonButtonProps } from './Button';
import { BsPrefixRefForwardingComponent } from './helpers';
export interface DropdownToggleProps extends Omit<ButtonProps, 'as'> {
as?: React.ElementType;
split?: boolean;
childBsPrefix?: string;
}
type DropdownToggleComponent = BsPrefixRefForwardingComponent<'button', DropdownToggleProps>;
export type PropsFromToggle = Partial<Pick<React.ComponentPropsWithRef<DropdownToggleComponent>, CommonButtonProps>>;
declare const DropdownToggle: DropdownToggleComponent;
export default DropdownToggle;

View File

@@ -0,0 +1,39 @@
"use client";
import useMergedRefs from '@restart/hooks/useMergedRefs';
import DropdownContext from '@restart/ui/DropdownContext';
import { useDropdownToggle } from '@restart/ui/DropdownToggle';
import classNames from 'classnames';
import * as React from 'react';
import { useContext } from 'react';
import Button from './Button';
import { useBootstrapPrefix } from './ThemeProvider';
import useWrappedRefWithWarning from './useWrappedRefWithWarning';
import { jsx as _jsx } from "react/jsx-runtime";
const DropdownToggle = /*#__PURE__*/React.forwardRef(({
bsPrefix,
split,
className,
childBsPrefix,
// Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
as: Component = Button,
...props
}, ref) => {
const prefix = useBootstrapPrefix(bsPrefix, 'dropdown-toggle');
const dropdownContext = useContext(DropdownContext);
if (childBsPrefix !== undefined) {
props.bsPrefix = childBsPrefix;
}
const [toggleProps] = useDropdownToggle();
toggleProps.ref = useMergedRefs(toggleProps.ref, useWrappedRefWithWarning(ref, 'DropdownToggle'));
// This intentionally forwards size and variant (if set) to the
// underlying component, to allow it to render size and style variants.
return /*#__PURE__*/_jsx(Component, {
className: classNames(className, prefix, split && `${prefix}-split`, (dropdownContext == null ? void 0 : dropdownContext.show) && 'show'),
...toggleProps,
...props
});
});
DropdownToggle.displayName = 'DropdownToggle';
export default DropdownToggle;

View File

@@ -0,0 +1,23 @@
import * as React from 'react';
/**
* Iterates through children that are typically specified as `props.children`,
* but only maps over children that are "valid elements".
*
* The mapFunction provided index will be normalised to the components mapped,
* so an invalid component would not increase the index.
*
*/
declare function map<P = any>(children: any, func: (el: React.ReactElement<P>, index: number) => any): any;
/**
* Iterates through children that are "valid elements".
*
* The provided forEachFunc(child, index) will be called for each
* leaf child with the index reflecting the position relative to "valid components".
*/
declare function forEach<P = any>(children: any, func: (el: React.ReactElement<P>, index: number) => void): void;
/**
* Finds whether a component's `children` prop includes a React element of the
* specified type.
*/
declare function hasChildOfType<P = any>(children: React.ReactNode, type: string | React.JSXElementConstructor<P>): boolean;
export { map, forEach, hasChildOfType };

View File

@@ -0,0 +1,36 @@
import * as React from 'react';
/**
* Iterates through children that are typically specified as `props.children`,
* but only maps over children that are "valid elements".
*
* The mapFunction provided index will be normalised to the components mapped,
* so an invalid component would not increase the index.
*
*/
function map(children, func) {
let index = 0;
return React.Children.map(children, child => /*#__PURE__*/React.isValidElement(child) ? func(child, index++) : child);
}
/**
* Iterates through children that are "valid elements".
*
* The provided forEachFunc(child, index) will be called for each
* leaf child with the index reflecting the position relative to "valid components".
*/
function forEach(children, func) {
let index = 0;
React.Children.forEach(children, child => {
if ( /*#__PURE__*/React.isValidElement(child)) func(child, index++);
});
}
/**
* Finds whether a component's `children` prop includes a React element of the
* specified type.
*/
function hasChildOfType(children, type) {
return React.Children.toArray(children).some(child => /*#__PURE__*/React.isValidElement(child) && child.type === type);
}
export { map, forEach, hasChildOfType };

View File

@@ -0,0 +1,15 @@
import * as React from 'react';
import Transition from 'react-transition-group/Transition';
import { TransitionCallbacks } from '@restart/ui/types';
export interface FadeProps extends TransitionCallbacks {
className?: string;
in?: boolean;
mountOnEnter?: boolean;
unmountOnExit?: boolean;
appear?: boolean;
timeout?: number;
children: React.ReactElement;
transitionClasses?: Record<string, string>;
}
declare const Fade: React.ForwardRefExoticComponent<FadeProps & React.RefAttributes<Transition<any>>>;
export default Fade;

View File

@@ -0,0 +1,46 @@
import classNames from 'classnames';
import * as React from 'react';
import { useCallback } from 'react';
import { ENTERED, ENTERING } from 'react-transition-group/Transition';
import { getChildRef } from '@restart/ui/utils';
import transitionEndListener from './transitionEndListener';
import triggerBrowserReflow from './triggerBrowserReflow';
import TransitionWrapper from './TransitionWrapper';
import { jsx as _jsx } from "react/jsx-runtime";
const fadeStyles = {
[ENTERING]: 'show',
[ENTERED]: 'show'
};
const Fade = /*#__PURE__*/React.forwardRef(({
className,
children,
transitionClasses = {},
onEnter,
...rest
}, ref) => {
const props = {
in: false,
timeout: 300,
mountOnEnter: false,
unmountOnExit: false,
appear: false,
...rest
};
const handleEnter = useCallback((node, isAppearing) => {
triggerBrowserReflow(node);
onEnter == null || onEnter(node, isAppearing);
}, [onEnter]);
return /*#__PURE__*/_jsx(TransitionWrapper, {
ref: ref,
addEndListener: transitionEndListener,
...props,
onEnter: handleEnter,
childRef: getChildRef(children),
children: (status, innerProps) => /*#__PURE__*/React.cloneElement(children, {
...innerProps,
className: classNames('fade', className, children.props.className, fadeStyles[status], transitionClasses[status])
})
});
});
Fade.displayName = 'Fade';
export default Fade;

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