Skip to content

Commit 993abd3

Browse files
author
unknown
committed
1.0.0-beta1
1 parent 3b2a1d5 commit 993abd3

Some content is hidden

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

61 files changed

+1256
-194
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 1.0.0-alpha4
3+
Version: FREE 1.0.0-beta1
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": "1.0.0-alpha4",
3+
"version": "1.0.0-beta1",
44
"main": "index.js",
55
"repository": {
66
"type": "git",

app/src/components/Dropdown/Dropdown.tsx

-5
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,6 @@ const MDBDropdown: React.FC<DropdownProps> = ({
7070
[isOpenState, popperElement, referenceElement]
7171
);
7272

73-
useEffect(() => {
74-
const wo = document.body.scrollTop;
75-
console.log(wo);
76-
});
77-
7873
useEffect(() => {
7974
document.addEventListener('mousedown', handleClickOutside);
8075
return () => {

app/src/components/Dropdown/DropdownMenu/DropdownMenu.tsx

+18-20
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const MDBDropdownMenu: React.FC<DropdownMenuProps> = ({
1010
tag: Tag,
1111
children,
1212
style,
13-
wrapperStyle,
1413
dark,
1514
responsive,
1615
...props
@@ -105,28 +104,27 @@ const MDBDropdownMenu: React.FC<DropdownMenuProps> = ({
105104
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
106105
//@ts-ignore
107106
return attachELements ? (
108-
<div
109-
className='position-absolute'
110-
ref={setPopperElement}
107+
<Tag
108+
className={classes}
109+
style={{ position: 'absolute', zIndex: 1000, ...styles.popper, ...style }}
110+
{...props}
111111
{...attributes.popper}
112-
style={{ display: 'block', zIndex: 1000, ...styles.popper, ...wrapperStyle }}
112+
ref={setPopperElement}
113113
tabIndex={-1}
114114
>
115-
<Tag className={classes} style={{ ...style }} {...props} tabIndex={-1}>
116-
{React.Children.map(children, (child: any, index) => {
117-
if (child?.type === MDBDropdownItem) {
118-
return React.cloneElement(child, {
119-
tabIndex: 0,
120-
'data-active': activeIndex === index && true,
121-
'data-index': index,
122-
className: activeIndex === index ? 'active' : '',
123-
});
124-
} else {
125-
return child;
126-
}
127-
})}
128-
</Tag>
129-
</div>
115+
{React.Children.map(children, (child: any, index) => {
116+
if (child?.type === MDBDropdownItem) {
117+
return React.cloneElement(child, {
118+
tabIndex: 0,
119+
'data-active': activeIndex === index && true,
120+
'data-index': index,
121+
className: activeIndex === index ? 'active' : '',
122+
});
123+
} else {
124+
return child;
125+
}
126+
})}
127+
</Tag>
130128
) : (
131129
''
132130
);

app/src/components/Dropdown/DropdownMenu/index.d.ts

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import * as React from 'react';
33
declare const MDBDropdownMenu: React.FunctionComponent<{
44
className?: string;
55
style?: Record<string, any>;
6-
wrapperStyle?: Record<string, any>;
76
dark?: boolean;
87
responsive?: string;
98
tag?: React.ComponentProps<any>;

app/src/components/Dropdown/DropdownMenu/types.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
type DropdownMenuProps = {
22
className?: string;
33
style?: Record<string, any>;
4-
wrapperStyle?: Record<string, any>;
54
dark?: boolean;
65
responsive?: string;
76
tag?: React.ComponentProps<any>;

app/src/forms/Checkbox/Checkbox.tsx

+11-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ const MDBCheckbox: React.FC<CheckboxProps> = React.forwardRef<HTMLAllCollection,
1717
id,
1818
defaultChecked,
1919
checked,
20+
validation,
21+
invalid,
2022
btnColor,
23+
toggleSwitch,
2124
...props
2225
},
2326
ref
@@ -35,9 +38,15 @@ const MDBCheckbox: React.FC<CheckboxProps> = React.forwardRef<HTMLAllCollection,
3538
}
3639
}
3740

38-
const wrapperClasses = clsx(label && !btn && 'form-check', inline && !btn && 'form-check-inline', wrapperClass);
41+
const wrapperClasses = clsx(
42+
label && !btn && 'form-check',
43+
inline && !btn && 'form-check-inline',
44+
toggleSwitch && 'form-switch',
45+
wrapperClass
46+
);
3947
const inputClasses = clsx(inputStyle, className);
4048
const labelClasses = clsx(labelStyle, labelClass);
49+
const validationClasses = clsx(validation && (invalid ? 'invalid-feedback' : 'valid-feedback'));
4150

4251
return (
4352
<WrapperTag className={wrapperClasses}>
@@ -55,6 +64,7 @@ const MDBCheckbox: React.FC<CheckboxProps> = React.forwardRef<HTMLAllCollection,
5564
{label}
5665
</label>
5766
)}
67+
{validation && <div className={validationClasses}>{validation}</div>}
5868
</WrapperTag>
5969
);
6070
}

app/src/forms/Checkbox/index.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ declare const MDBCheckbox: React.FunctionComponent<{
1313
name?: string;
1414
inline?: boolean;
1515
checked?: boolean;
16+
validation?: string;
17+
invalid?: boolean;
1618
btn?: boolean;
1719
btnColor?: string;
1820
[rest: string]: any;

app/src/forms/Checkbox/types.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ type CheckboxProps = {
1212
value?: string | boolean;
1313
name?: string;
1414
inline?: boolean;
15+
validation?: string;
16+
invalid?: boolean;
1517
checked?: boolean;
1618
btn?: boolean;
1719
btnColor?: string;

app/src/forms/File/File.tsx

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import clsx from 'clsx';
2+
import React, { useRef } from 'react';
3+
import type { FileProps } from './types';
4+
5+
const MDBFile: React.FC<FileProps> = ({
6+
className,
7+
labelId,
8+
labelClass,
9+
labelRef,
10+
inputRef,
11+
size,
12+
label,
13+
id,
14+
...props
15+
}) => {
16+
const inputClasses = clsx('form-control', `form-control-${size}`, className);
17+
const labelClasses = clsx('form-label', labelClass);
18+
19+
const labelEl = useRef<HTMLLabelElement>(null);
20+
const inputEl = useRef<HTMLInputElement>(null);
21+
22+
const labelReference = labelRef ? labelRef : labelEl;
23+
const inputReference = inputRef ? inputRef : inputEl;
24+
25+
return (
26+
<>
27+
{label && (
28+
<label className={labelClasses} id={labelId} ref={labelReference} htmlFor={id}>
29+
{label}
30+
</label>
31+
)}
32+
<input className={inputClasses} type='file' id={id} ref={inputReference} {...props} />
33+
</>
34+
);
35+
};
36+
37+
export default MDBFile;

app/src/forms/File/index.d.ts

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import * as React from 'react';
2+
3+
declare const MDBFile: React.FunctionComponent<{
4+
className?: string;
5+
id?: string;
6+
label?: string;
7+
disabled?: boolean;
8+
labelId?: string;
9+
labelClass?: string;
10+
size?: string;
11+
name?: string;
12+
[rest: string]: any;
13+
}>;
14+
15+
export default MDBFile;

app/src/forms/File/types.tsx

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import React from 'react';
2+
3+
type FileProps = {
4+
className?: string;
5+
id?: string;
6+
label?: string;
7+
disabled?: boolean;
8+
labelId?: string;
9+
labelClass?: string;
10+
size?: string;
11+
name?: string;
12+
[rest: string]: any;
13+
};
14+
15+
export { FileProps };

app/src/forms/Input/Input.tsx

+10
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ const MDBInput: React.FC<InputProps> = ({
2020
labelStyle,
2121
inputRef,
2222
textarea,
23+
validation,
24+
invalid,
25+
validationTooltip,
2326
...props
2427
}) => {
2528
const labelEl = useRef<HTMLLabelElement>(null);
@@ -36,6 +39,12 @@ const MDBInput: React.FC<InputProps> = ({
3639
const wrapperClasses = clsx('form-outline', contrast && 'form-white', wrapperClass);
3740
const inputClasses = clsx('form-control', active && 'active', size && `form-control-${size}`, className);
3841
const labelClasses = clsx('form-label', labelClass);
42+
const validationClasses = clsx(
43+
validation &&
44+
(invalid
45+
? `invalid-${validationTooltip ? `tooltip` : `feedback`}`
46+
: `valid-${validationTooltip ? `tooltip` : `feedback`}`)
47+
);
3948

4049
useEffect(() => {
4150
if (labelReference.current) {
@@ -91,6 +100,7 @@ const MDBInput: React.FC<InputProps> = ({
91100
{label}
92101
</label>
93102
)}
103+
{validation && <div className={validationClasses}>{validation}</div>}
94104
<div className='form-notch'>
95105
<div className='form-notch-leading'></div>
96106
<div className='form-notch-middle' style={{ width: labelWidth }}></div>

app/src/forms/Input/index.d.ts

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ declare const MDBInput: React.FunctionComponent<{
1717
contrast?: boolean;
1818
value?: string;
1919
name?: string;
20+
validation?: string;
21+
invalid?: boolean;
22+
validationTooltip?: boolean;
2023
labelRef?: React.RefObject<HTMLLabelElement>;
2124
textarea?: boolean;
2225
[rest: string]: any;

app/src/forms/Input/types.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ type InputProps = {
1717
contrast?: boolean;
1818
value?: string;
1919
name?: string;
20+
validation?: string;
21+
invalid?: boolean;
22+
validationTooltip?: boolean;
2023
labelRef?: React.RefObject<HTMLLabelElement>;
2124
textarea?: boolean;
2225
[rest: string]: any;
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React from 'react';
2+
import clsx from 'clsx';
3+
import type { InputGroupProps } from './types';
4+
5+
const MDBInputGroup: React.FC<InputGroupProps> = React.forwardRef<HTMLAllCollection, InputGroupProps>(
6+
({ className, children, noWrap, tag: Tag, size, ...props }, ref) => {
7+
const classes = clsx('input-group', noWrap && 'flex-nowrap', size && `input-group-${size}`, className);
8+
9+
return (
10+
<Tag className={classes} ref={ref} {...props}>
11+
{children}
12+
</Tag>
13+
);
14+
}
15+
);
16+
17+
MDBInputGroup.defaultProps = { tag: 'div', noWrap: false };
18+
19+
export default MDBInputGroup;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import React, { useRef } from 'react';
2+
import clsx from 'clsx';
3+
import type { InputGroupElementProps } from './types';
4+
5+
const MDBInputGroupElement: React.FC<InputGroupElementProps> = ({ className, textarea, inputRef, ...props }) => {
6+
const classes = clsx('form-control', className);
7+
8+
const inputEl = useRef<HTMLInputElement>(null);
9+
10+
const inputReference = inputRef ? inputRef : inputEl;
11+
12+
return (
13+
<>
14+
{textarea ? (
15+
<textarea className={classes} ref={inputReference} {...props} />
16+
) : (
17+
<input className={classes} ref={inputReference} {...props} />
18+
)}
19+
</>
20+
);
21+
};
22+
23+
export default MDBInputGroupElement;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import * as React from 'react';
2+
3+
declare const MDBInputGroupElement: React.FunctionComponent<{
4+
className?: string;
5+
textarea?: boolean;
6+
[rest: string]: any;
7+
}>;
8+
9+
export default MDBInputGroupElement;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react';
2+
3+
type InputGroupElementProps = {
4+
className?: string;
5+
textarea?: boolean;
6+
[rest: string]: any;
7+
};
8+
9+
export { InputGroupElementProps };
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React from 'react';
2+
import clsx from 'clsx';
3+
import type { InputGroupTextProps } from './types';
4+
5+
const MDBInputGroupText: React.FC<InputGroupTextProps> = React.forwardRef<HTMLAllCollection, InputGroupTextProps>(
6+
({ className, children, noBorder, tag: Tag, ...props }, ref) => {
7+
const classes = clsx('input-group-text', noBorder && 'border-0', className);
8+
9+
return (
10+
<Tag className={classes} ref={ref} {...props}>
11+
{children}
12+
</Tag>
13+
);
14+
}
15+
);
16+
17+
MDBInputGroupText.defaultProps = { tag: 'span', noBorder: false };
18+
19+
export default MDBInputGroupText;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import * as React from 'react';
2+
3+
declare const MDBInputGroupText: React.FunctionComponent<{
4+
className?: string;
5+
noBorder?: boolean;
6+
tag?: React.ComponentProps<any>;
7+
[rest: string]: any;
8+
}>;
9+
10+
export default MDBInputGroupText;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from 'react';
2+
3+
type InputGroupTextProps = {
4+
className?: string;
5+
noBorder?: boolean;
6+
tag?: React.ComponentProps<any>;
7+
[rest: string]: any;
8+
};
9+
10+
export { InputGroupTextProps };

app/src/forms/InputGroup/index.d.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import * as React from 'react';
2+
3+
declare const MDBInputGroup: React.FunctionComponent<{
4+
className?: string;
5+
noWrap?: boolean;
6+
tag?: React.ComponentProps<any>;
7+
size?: string;
8+
[rest: string]: any;
9+
}>;
10+
11+
export default MDBInputGroup;

0 commit comments

Comments
 (0)