Skip to content

Commit 0508ac6

Browse files
author
Krzysztof Wilk
committed
Generate v. 3.0.0
1 parent 68e22c8 commit 0508ac6

File tree

204 files changed

+1981
-2347
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

204 files changed

+1981
-2347
lines changed

README.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MDB 5 React
22

3-
Version: FREE 2.4.0
3+
Version: FREE 3.0.0
44

55
Documentation:
66
https://mdbootstrap.com/docs/b5/react/

app/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mdb-react-ui-kit-demo",
3-
"version": "2.4.0",
3+
"version": "3.0.0",
44
"main": "index.js",
55
"repository": {
66
"type": "git",

app/src/components/Accordion/Accordion.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ const MDBAccordion: React.FC<AccordionProps> = React.forwardRef<HTMLAllCollectio
1919
}
2020
);
2121

22-
MDBAccordion.defaultProps = { tag: 'div', initialActive: '' };
22+
MDBAccordion.defaultProps = { tag: 'div', initialActive: 0 };
2323

2424
export default MDBAccordion;
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import React from 'react';
22

33
interface AccordionProps {
4-
activeItem: string | undefined;
4+
activeItem?: number;
55
setActiveItem: React.SetStateAction<any>;
6-
alwaysOpen: boolean | undefined;
7-
initialActive: string | undefined;
6+
alwaysOpen?: boolean;
7+
initialActive?: number;
88
}
99

1010
const AccordionContext = React.createContext<AccordionProps>({
11-
activeItem: '',
11+
activeItem: 0,
1212
setActiveItem: null,
1313
alwaysOpen: false,
14-
initialActive: '',
14+
initialActive: 0,
1515
});
1616

1717
export { AccordionContext };

app/src/components/Accordion/AccordionItem/AccordionItem.tsx

+26-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,21 @@ import type { AccordionItemProps } from './types';
55
import MDBCollapse from '../../Collapse/Collapse';
66

77
const MDBAccordionItem: React.FC<AccordionItemProps> = React.forwardRef<HTMLAllCollection, AccordionItemProps>(
8-
({ className, bodyClassName, headerClassName, collapseId, headerTitle, tag: Tag, children, ...props }, ref) => {
8+
(
9+
{
10+
className,
11+
bodyClassName,
12+
bodyStyle,
13+
headerClassName,
14+
collapseId,
15+
headerTitle,
16+
headerStyle,
17+
tag: Tag,
18+
children,
19+
...props
20+
},
21+
ref
22+
) => {
923
const { activeItem, setActiveItem, alwaysOpen, initialActive } = useContext(AccordionContext);
1024

1125
const [openState, setOpenState] = useState(initialActive);
@@ -18,23 +32,28 @@ const MDBAccordionItem: React.FC<AccordionItemProps> = React.forwardRef<HTMLAllC
1832
alwaysOpen ? collapseId !== openState && 'collapsed' : collapseId !== activeItem && 'collapsed'
1933
);
2034

21-
const toggleAccordion = (value: string) => {
35+
const toggleAccordion = (value: number) => {
2236
if (alwaysOpen) {
23-
value !== openState ? setOpenState(value) : setOpenState('');
37+
value !== openState ? setOpenState(value) : setOpenState(0);
2438
} else {
25-
value !== activeItem ? setActiveItem(value) : setActiveItem('');
39+
value !== activeItem ? setActiveItem(value) : setActiveItem(0);
2640
}
2741
};
2842

2943
return (
3044
<Tag className={classes} ref={ref} {...props}>
31-
<h2 className={headerClasses}>
45+
<h2 className={headerClasses} style={headerStyle}>
3246
<button onClick={() => toggleAccordion(collapseId)} className={buttonClasses} type='button'>
3347
{headerTitle}
3448
</button>
3549
</h2>
36-
<MDBCollapse id={collapseId} show={alwaysOpen ? openState : activeItem}>
37-
<div className={bodyClasses}>{children}</div>
50+
<MDBCollapse
51+
id={collapseId.toString()}
52+
show={alwaysOpen ? openState === collapseId : activeItem === collapseId}
53+
>
54+
<div className={bodyClasses} style={bodyStyle}>
55+
{children}
56+
</div>
3857
</MDBCollapse>
3958
</Tag>
4059
);
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
import * as React from 'react';
2+
import { AccordionItemProps } from './types';
23

3-
declare const MDBAccordionItem: React.FunctionComponent<{
4-
className?: string;
5-
bodyClassName?: string;
6-
headerClassName?: string;
7-
collapseId: string;
8-
headerTitle?: string;
9-
tag?: React.ComponentProps<any>;
10-
[rest: string]: any;
11-
}>;
4+
declare const MDBAccordionItem: React.FunctionComponent<AccordionItemProps>;
125

136
export default MDBAccordionItem;
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import React from 'react';
22

3-
type AccordionItemProps = {
4-
className?: string;
3+
interface AccordionItemProps extends React.HTMLAttributes<HTMLElement> {
54
bodyClassName?: string;
5+
bodyStyle?: React.CSSProperties;
6+
collapseId: number;
67
headerClassName?: string;
7-
collapseId: string;
8-
headerTitle?: string;
8+
headerStyle?: React.CSSProperties;
9+
headerTitle?: React.ReactNode;
10+
ref?: React.ForwardedRef<HTMLAllCollection>;
911
tag?: React.ComponentProps<any>;
10-
[rest: string]: any;
11-
};
12+
}
1213

1314
export { AccordionItemProps };
+2-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
import * as React from 'react';
2+
import { AccordionProps } from './types';
23

3-
declare const MDBAccordion: React.FunctionComponent<{
4-
alwaysOpen?: boolean;
5-
className?: string;
6-
flush?: boolean;
7-
initialActive?: string;
8-
tag?: React.ComponentProps<any>;
9-
[rest: string]: any;
10-
}>;
4+
declare const MDBAccordion: React.FunctionComponent<AccordionProps>;
115

126
export default MDBAccordion;
+4-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import React from 'react';
22

3-
type AccordionProps = {
3+
interface AccordionProps extends React.HTMLAttributes<HTMLElement> {
44
alwaysOpen?: boolean;
5-
className?: string;
65
flush?: boolean;
7-
initialActive?: string;
6+
initialActive?: number;
7+
ref?: React.ForwardedRef<HTMLAllCollection>;
88
tag?: React.ComponentProps<any>;
9-
[rest: string]: any;
10-
};
9+
}
1110

1211
export { AccordionProps };

app/src/components/Badge/index.d.ts

+2-9
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
import * as React from 'react';
2+
import { BadgeProps } from './types';
23

3-
declare const MDBBadge: React.FunctionComponent<{
4-
className?: string;
5-
pill?: boolean;
6-
dot?: boolean;
7-
notification?: boolean;
8-
color?: string;
9-
tag?: React.ComponentProps<any>;
10-
[rest: string]: any;
11-
}>;
4+
declare const MDBBadge: React.FunctionComponent<BadgeProps>;
125

136
export default MDBBadge;

app/src/components/Badge/types.tsx

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import React from 'react';
22

3-
type BadgeProps = {
4-
className?: string;
5-
pill?: boolean;
3+
interface BadgeProps extends Omit<React.AllHTMLAttributes<HTMLElement>, 'color'> {
4+
color?: 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'light' | 'dark' | 'muted' | 'white' | 'info';
65
dot?: boolean;
76
notification?: boolean;
8-
color?: string;
7+
pill?: boolean;
8+
ref?: React.ForwardedRef<HTMLAllCollection>;
99
tag?: React.ComponentProps<any>;
10-
[rest: string]: any;
11-
};
10+
}
1211

1312
export { BadgeProps };

app/src/components/Button/index.d.ts

+2-20
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,6 @@
11
import * as React from 'react';
2+
import { ButtonProps } from './types';
23

3-
declare const MDBBtn: React.FunctionComponent<{
4-
className?: string;
5-
color?: string;
6-
outline?: boolean;
7-
rounded?: boolean;
8-
floating?: boolean;
9-
disabled?: boolean;
10-
size?: string;
11-
href?: string;
12-
role?: string;
13-
block?: boolean;
14-
type?: 'reset' | 'submit' | 'button';
15-
active?: boolean;
16-
toggle?: boolean;
17-
target?: string;
18-
value?: string | number;
19-
noRipple?: boolean;
20-
tag?: React.ComponentProps<any>;
21-
[rest: string]: any;
22-
}>;
4+
declare const MDBBtn: React.FunctionComponent<ButtonProps>;
235

246
export default MDBBtn;

app/src/components/Button/types.tsx

+33-15
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,40 @@
1-
type ButtonProps = {
2-
className?: string;
3-
color?: string;
1+
type btnProps = React.ButtonHTMLAttributes<HTMLButtonElement>;
2+
type anchorProps = React.AnchorHTMLAttributes<HTMLAnchorElement>;
3+
4+
type joinedTypes = btnProps & anchorProps;
5+
6+
interface ButtonProps extends Omit<joinedTypes, 'size' | 'color'> {
7+
active?: boolean;
8+
block?: boolean;
9+
color?:
10+
| 'primary'
11+
| 'secondary'
12+
| 'success'
13+
| 'danger'
14+
| 'warning'
15+
| 'light'
16+
| 'dark'
17+
| 'muted'
18+
| 'white'
19+
| 'info'
20+
| 'none'
21+
| 'link';
22+
23+
floating?: boolean;
24+
noRipple?: boolean;
425
outline?: boolean;
26+
rippleUnbound?: boolean;
27+
rippleColor?: string;
28+
rippleRadius?: number;
29+
rippleDuration?: number;
30+
rippleCentered?: boolean;
31+
ref?: React.ForwardedRef<HTMLAllCollection>;
532
rounded?: boolean;
6-
floating?: boolean;
7-
disabled?: boolean;
8-
size?: string;
9-
href?: string;
10-
role?: string;
11-
block?: boolean;
12-
type?: 'reset' | 'submit' | 'button';
13-
active?: boolean;
33+
size?: 'sm' | 'lg';
1434
toggle?: boolean;
1535
target?: string;
16-
value?: string | number;
17-
noRipple?: boolean;
1836
tag?: React.ComponentProps<any>;
19-
[rest: string]: any;
20-
};
37+
to?: string;
38+
}
2139

2240
export { ButtonProps };

app/src/components/ButtonGroup/ButtonGroup.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState } from 'react';
1+
import React from 'react';
22
import clsx from 'clsx';
33
import type { ButtonGroupProps } from './types';
44

+2-10
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
import * as React from 'react';
2+
import { ButtonGroupProps } from './types';
23

3-
declare const MDBBtnGroup: React.FunctionComponent<{
4-
className?: string;
5-
role?: string;
6-
shadow?: string;
7-
toolbar?: boolean;
8-
size?: string;
9-
vertical?: boolean;
10-
tag?: React.ComponentProps<any>;
11-
[rest: string]: any;
12-
}>;
4+
declare const MDBBtnGroup: React.FunctionComponent<ButtonGroupProps>;
135

146
export default MDBBtnGroup;
+5-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
type ButtonGroupProps = {
2-
className?: string;
3-
role?: string;
4-
shadow?: string;
1+
interface ButtonGroupProps extends Omit<React.HTMLAttributes<HTMLElement>, 'size'> {
2+
ref?: React.ForwardedRef<HTMLAllCollection>;
3+
size?: 'sm' | 'lg';
4+
shadow?: '0' | '1' | '2' | '3' | '4' | '5';
55
toolbar?: boolean;
6-
size?: string;
76
vertical?: boolean;
87
tag?: React.ComponentProps<any>;
9-
[rest: string]: any;
10-
};
8+
}
119

1210
export { ButtonGroupProps };
+2-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import * as React from 'react';
2+
import { CardBodyProps } from './types';
23

3-
declare const MDBCardBody: React.FunctionComponent<{
4-
className?: string;
5-
tag?: React.ComponentProps<any>;
6-
[rest: string]: any;
7-
}>;
4+
declare const MDBCardBody: React.FunctionComponent<CardBodyProps>;
85

96
export default MDBCardBody;
+3-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
type CardBodyProps = {
2-
className?: string;
1+
interface CardBodyProps extends React.HTMLAttributes<HTMLElement> {
32
tag?: React.ComponentProps<any>;
4-
[rest: string]: any;
5-
};
3+
ref?: React.ForwardedRef<HTMLAllCollection>;
4+
}
65

76
export { CardBodyProps };
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
import * as React from 'react';
2+
import { CardFooterProps } from './types';
23

3-
declare const MDBCardFooter: React.FunctionComponent<{
4-
className?: string;
5-
tag?: React.ComponentProps<any>;
6-
border?: string;
7-
background?: string;
8-
[rest: string]: any;
9-
}>;
4+
declare const MDBCardFooter: React.FunctionComponent<CardFooterProps>;
105

116
export default MDBCardFooter;
+15-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
type CardFooterProps = {
2-
className?: string;
3-
tag?: React.ComponentProps<any>;
1+
interface CardFooterProps extends React.HTMLAttributes<HTMLElement> {
42
border?: string;
5-
background?: string;
6-
[rest: string]: any;
7-
};
3+
background?:
4+
| 'primary'
5+
| 'secondary'
6+
| 'success'
7+
| 'danger'
8+
| 'warning'
9+
| 'light'
10+
| 'dark'
11+
| 'white'
12+
| 'info'
13+
| 'transparent';
14+
ref?: React.ForwardedRef<HTMLAllCollection>;
15+
tag?: React.ComponentProps<any>;
16+
}
817

918
export { CardFooterProps };

0 commit comments

Comments
 (0)