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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 0 additions & 5 deletions
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

Lines changed: 18 additions & 20 deletions
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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 11 additions & 1 deletion
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 37 additions & 0 deletions
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;

0 commit comments

Comments
 (0)