8000 wip · react-bootstrap/react-bootstrap@3b2fcf0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3b2fcf0

Browse files
committed
wip
1 parent e7c9e75 commit 3b2fcf0

32 files changed

+747
-283
lines changed

src/AccordionBody.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import classNames from 'classnames';
22
import * as React from 'react';
33
import { useContext } from 'react';
4-
import type {
5-
DynamicRefForwardingComponent,
6-
TransitionCallbacks,
7-
} from '@restart/ui/types';
4+
import type { DynamicRefForwardingComponent } from '@restart/ui/types';
85
import { useBootstrapPrefix } from './ThemeProvider';
96
import AccordionCollapse from './AccordionCollapse';
107
import AccordionItemContext from './AccordionItemContext';
8+
import type { TransitionCallbacks } from './types';
119

1210
export interface AccordionBodyProps
1311
extends TransitionCallbacks,

src/Alert.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,15 @@ export interface AlertProps extends React.HTMLAttributes<HTMLDivElement> {
3636
*/
3737
show?: boolean | undefined;
3838

39+
/**
40+
* Default show state of the Alert.
41+
*/
42+
defaultShow?: boolean | undefined;
43+
3944
/**
4045
* Callback fired when alert is closed.
4146
*
47+
* @type {((show: boolean, event: any) => void) | undefined}
4248
* @controllable show
4349
*/
4450
onClose?: ((show: boolean, event: any) => void) | undefined;

src/Button.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export interface ButtonProps extends BaseButtonProps {
1717
/**
1818
* Manually set the visual state of the button to `:active`
1919
*/
20-
active?: boolean;
20+
active?: boolean | undefined;
2121

2222
/**
2323
* One or more button variant combinations
@@ -29,15 +29,17 @@ export interface ButtonProps extends BaseButtonProps {
2929
* as well as "outline" versions (prefixed by 'outline-*')
3030
*
3131
* `'outline-primary', 'outline-secondary', 'outline-success', 'outline-danger', 'outline-warning', 'outline-info', 'outline-dark', 'outline-light'`
32+
*
33+
* @type {'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light' | 'link' | 'outline-primary' | 'outline-secondary' | 'outline-success' | 'outline-danger' | 'outline-warning' | 'outline-info' | 'outline-dark' | 'outline-light'}
3234
*/
33-
variant?: ButtonVariant;
35+
variant?: ButtonVariant | undefined;
3436

3537
/**
3638
* Specifies a large or small button.
3739
*
3840
* @type {'sm' | 'lg'}
3941
*/
40-
size?: 'sm' | 'lg';
42+
size?: 'sm' | 'lg' | undefined;
4143

4244
/**
4345
* Disables the Button, preventing mouse events,

src/ButtonGroup.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ export interface ButtonGroupProps extends React.HTMLAttributes<HTMLElement> {
1616

1717
/**
1818
* Sets the size for all Buttons in the group.
19-
*
20-
* @type ('sm'|'lg')
2119
*/
2220
size?: 'sm' | 'lg' | undefined;
2321

@@ -35,7 +33,7 @@ export interface ButtonGroupProps extends React.HTMLAttributes<HTMLElement> {
3533
}
3634

3735
const ButtonGroup: DynamicRefForwardingComponent<'div', ButtonGroupProps> =
38-
React.forwardRef(
36+
React.forwardRef<HTMLElement, ButtonGroupProps>(
3937
(
4038
{
4139
bsPrefix,

src/CloseButton.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ export type CloseButtonVariant = 'white' | string;
55

66
export interface CloseButtonProps
77
extends React.ButtonHTMLAttributes<HTMLButtonElement> {
8+
/**
9+
* An accessible label indicating the relevant information about the Close Button.
10+
*/
11+
'aria-label'?: string | undefined;
12+
813
/**
914
* Render different color variant for the button.
1015
*

src/Collapse.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ import Transition, {
88
EXITED,
99
EXITING,
1010
} from 'react-transition-group/Transition';
11-
import type { TransitionCallbacks } from '@restart/ui/types';
1211
import { getChildRef } from '@restart/ui/utils';
1312
import transitionEndListener from './transitionEndListener';
1413
import createChainedFunction from './createChainedFunction';
1514
import triggerBrowserReflow from './triggerBrowserReflow';
1615
import TransitionWrapper from './TransitionWrapper';
16+
import type { TransitionCallbacks } from './types';
1717

1818
type Dimension = 'height' | 'width';
1919

src/Dropdown.tsx

Lines changed: 5 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
import classNames from 'classnames';
22
import * as React from 'react';
33
import { useContext, useMemo } from 'react';
4-
import BaseDropdown, {
5-
DropdownProps as BaseDropdownProps,
6-
ToggleMetadata,
7-
} from '@restart/ui/Dropdown';
4+
import BaseDropdown, { ToggleMetadata } from '@restart/ui/Dropdown';
85
import { useUncontrolled } from 'uncontrollable';
96
import useEventCallback from '@restart/hooks/useEventCallback';
107
import type { DynamicRefForwardingComponent } from '@restart/ui/types';
11-
import DropdownContext, { type DropDirection } from './DropdownContext';
8+
import DropdownContext from './DropdownContext';
129
import DropdownDivider from './DropdownDivider';
1310
import DropdownHeader from './DropdownHeader';
1411
import DropdownItem from './DropdownItem';
@@ -17,60 +14,14 @@ import DropdownMenu, { getDropdownMenuPlacement } from './DropdownMenu';
1714
import DropdownToggle from './DropdownToggle';
1815
import InputGroupContext from './InputGroupContext';
1916
import { useBootstrapPrefix, useIsRTL } from './ThemeProvider';
20-
import type { AlignType } from './types';
17+
import type { BsDropdownProps } from './types';
2118

2219
export interface DropdownProps
23-
extends BaseDropdownProps,
20+
extends BsDropdownProps,
2421
Omit<
2522
React.HTMLAttributes<HTMLElement>,
2623
'onSelect' | 'children' | 'onToggle'
27-
> {
28-
/**
29-
* Element used to render the component.
30-
*/
31-
as?: React.ElementType | undefined;
32-
33-
/**
34-
* @default 'dropdown'
35-
*/
36-
bsPrefix?: string | undefined;
37-
38-
/**
39-
* Determines the direction and location of the Menu in relation to it's Toggle.
40-
*/
41-
drop?: DropDirection | undefined;
42-
43-
/**
44-
* Aligns the dropdown menu to the specified side of the Dropdown toggle. You can
45-
* also align the menu responsively for breakpoints starting at `sm` and up.
46-
* The alignment direction will affect the specified breakpoint or larger.
47-
*
48-
* *Note: Using responsive alignment will disable Popper usage for positioning.*
49-
*/
50-
align?: AlignType | undefined;
51-
52-
/**
53-
* Controls the focus behavior for when the Dropdown is opened. Set to
54-
* `true` to always focus the first menu item, `keyboard` to focus only when
55-
* navigating via the keyboard, or `false` to disable completely
56-
*
57-
* The Default behavior is `false` **unless** the Menu has a `role="menu"`
58-
* where it will default to `keyboard` to match the recommended
59-
* [ARIA Authoring practices](https://www.w3.org/TR/wai-aria-practices-1.1/#menubutton).
60-
*/
61-
focusFirstItemOnShow?: boolean | 'keyboard' | undefined;
62-
63-
/**
64-
* @private
65-
*/
66-
navbar?: boolean | undefined;
67-
68-
/**
69-
* Controls the auto close behaviour of the dropdown when clicking outside of
70-
* the button or the list.
71-
*/
72-
autoClose?: boolean | 'outside' | 'inside' | undefined;
73-
}
24+
> {}
7425

7526
const Dropdown: DynamicRefForwardingComponent<'div', DropdownProps> =
7627
React.forwardRef<HTMLElement, DropdownProps>((pProps, ref) => {

src/DropdownButton.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
import * as React from 'react';
22
import type { DynamicRefForwardingComponent } from '@restart/ui/types';
3-
import Dropdown, { type DropdownProps } from './Dropdown';
3+
import Dropdown from './Dropdown';
44
import DropdownToggle, { type PropsFromToggle } from './DropdownToggle';
55
import DropdownMenu, { type DropdownMenuVariant } from './DropdownMenu';
6+
import type { BsDropdownProps } from './types';
67

78
export interface DropdownButtonProps
8-
extends Omit<DropdownProps, 'title'>,
9-
PropsFromToggle {
9+
extends BsDropdownProps,
10+
PropsFromToggle,
11+
Omit<
12+
React.HTMLAttributes<HTMLElement>,
13+
'onSelect' | 'children' | 'onToggle' | 'title'
14+
> {
1015
/**
1116
* An html id attribute for the Toggle button, necessary for assistive technologies, such as screen readers.
1217
*/

src/DropdownToggle.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export interface DropdownToggleProps extends Omit<ButtonProps, 'as'> {
1313
/**
1414
* Element used to render the component.
1515
*
16-
* @type {Button}
16+
* @default {Button}
1717
*/
1818
as?: React.ElementType | undefined;
1919

src/Fade.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import Transition, {
66
ENTERED,
77
ENTERING,
88
} from 'react-transition-group/Transition';
9-
import { TransitionCallbacks } from '@restart/ui/types';
109
import { getChildRef } from '@restart/ui/utils';
1110
import transitionEndListener from './transitionEndListener';
1211
import triggerBrowserReflow from './triggerBrowserReflow';
1312
import TransitionWrapper from './TransitionWrapper';
13+
import type { TransitionCallbacks } from './types';
1414

1515
export interface FadeProps extends TransitionCallbacks {
1616
className?: string;

0 commit comments

Comments
 (0)
0