-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
unknown
committed
Aug 31, 2021
1 parent
3b2a1d5
commit 993abd3
Showing
61 changed files
with
1,256 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import clsx from 'clsx'; | ||
import React, { useRef } from 'react'; | ||
import type { FileProps } from './types'; | ||
|
||
const MDBFile: React.FC<FileProps> = ({ | ||
className, | ||
labelId, | ||
labelClass, | ||
labelRef, | ||
inputRef, | ||
size, | ||
label, | ||
id, | ||
...props | ||
}) => { | ||
const inputClasses = clsx('form-control', `form-control-${size}`, className); | ||
const labelClasses = clsx('form-label', labelClass); | ||
|
||
const labelEl = useRef<HTMLLabelElement>(null); | ||
const inputEl = useRef<HTMLInputElement>(null); | ||
|
||
const labelReference = labelRef ? labelRef : labelEl; | ||
const inputReference = inputRef ? inputRef : inputEl; | ||
|
||
return ( | ||
<> | ||
{label && ( | ||
<label className={labelClasses} id={labelId} ref={labelReference} htmlFor={id}> | ||
{label} | ||
</label> | ||
)} | ||
<input className={inputClasses} type='file' id={id} ref={inputReference} {...props} /> | ||
</> | ||
); | ||
}; | ||
|
||
export default MDBFile; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import * as React from 'react'; | ||
|
||
declare const MDBFile: React.FunctionComponent<{ | ||
className?: string; | ||
id?: string; | ||
label?: string; | ||
disabled?: boolean; | ||
labelId?: string; | ||
labelClass?: string; | ||
size?: string; | ||
name?: string; | ||
[rest: string]: any; | ||
}>; | ||
|
||
export default MDBFile; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react'; | ||
|
||
type FileProps = { | ||
className?: string; | ||
id?: string; | ||
label?: string; | ||
disabled?: boolean; | ||
labelId?: string; | ||
labelClass?: string; | ||
size?: string; | ||
name?: string; | ||
[rest: string]: any; | ||
}; | ||
|
||
export { FileProps }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from 'react'; | ||
import clsx from 'clsx'; | ||
import type { InputGroupProps } from './types'; | ||
|
||
const MDBInputGroup: React.FC<InputGroupProps> = React.forwardRef<HTMLAllCollection, InputGroupProps>( | ||
({ className, children, noWrap, tag: Tag, size, ...props }, ref) => { | ||
const classes = clsx('input-group', noWrap && 'flex-nowrap', size && `input-group-${size}`, className); | ||
|
||
return ( | ||
<Tag className={classes} ref={ref} {...props}> | ||
{children} | ||
</Tag> | ||
); | ||
} | ||
); | ||
|
||
MDBInputGroup.defaultProps = { tag: 'div', noWrap: false }; | ||
|
||
export default MDBInputGroup; |
23 changes: 23 additions & 0 deletions
23
app/src/forms/InputGroup/InputGroupElement/InputGroupElement.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React, { useRef } from 'react'; | ||
import clsx from 'clsx'; | ||
import type { InputGroupElementProps } from './types'; | ||
|
||
const MDBInputGroupElement: React.FC<InputGroupElementProps> = ({ className, textarea, inputRef, ...props }) => { | ||
const classes = clsx('form-control', className); | ||
|
||
const inputEl = useRef<HTMLInputElement>(null); | ||
|
||
const inputReference = inputRef ? inputRef : inputEl; | ||
|
||
return ( | ||
<> | ||
{textarea ? ( | ||
<textarea className={classes} ref={inputReference} {...props} /> | ||
) : ( | ||
<input className={classes} ref={inputReference} {...props} /> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
export default MDBInputGroupElement; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import * as React from 'react'; | ||
|
||
declare const MDBInputGroupElement: React.FunctionComponent<{ | ||
className?: string; | ||
textarea?: boolean; | ||
[rest: string]: any; | ||
}>; | ||
|
||
export default MDBInputGroupElement; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React from 'react'; | ||
|
||
type InputGroupElementProps = { | ||
className?: string; | ||
textarea?: boolean; | ||
[rest: string]: any; | ||
}; | ||
|
||
export { InputGroupElementProps }; |
19 changes: 19 additions & 0 deletions
19
app/src/forms/InputGroup/InputGroupText/InputGroupText.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from 'react'; | ||
import clsx from 'clsx'; | ||
import type { InputGroupTextProps } from './types'; | ||
|
||
const MDBInputGroupText: React.FC<InputGroupTextProps> = React.forwardRef<HTMLAllCollection, InputGroupTextProps>( | ||
({ className, children, noBorder, tag: Tag, ...props }, ref) => { | ||
const classes = clsx('input-group-text', noBorder && 'border-0', className); | ||
|
||
return ( | ||
<Tag className={classes} ref={ref} {...props}> | ||
{children} | ||
</Tag> | ||
); | ||
} | ||
); | ||
|
||
MDBInputGroupText.defaultProps = { tag: 'span', noBorder: false }; | ||
|
||
export default MDBInputGroupText; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import * as React from 'react'; | ||
|
||
declare const MDBInputGroupText: React.FunctionComponent<{ | ||
className?: string; | ||
noBorder?: boolean; | ||
tag?: React.ComponentProps<any>; | ||
[rest: string]: any; | ||
}>; | ||
|
||
export default MDBInputGroupText; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React from 'react'; | ||
|
||
type InputGroupTextProps = { | ||
className?: string; | ||
noBorder?: boolean; | ||
tag?: React.ComponentProps<any>; | ||
[rest: string]: any; | ||
}; | ||
|
||
export { InputGroupTextProps }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import * as React from 'react'; | ||
|
||
declare const MDBInputGroup: React.FunctionComponent<{ | ||
className?: string; | ||
noWrap?: boolean; | ||
tag?: React.ComponentProps<any>; | ||
size?: string; | ||
[rest: string]: any; | ||
}>; | ||
|
||
export default MDBInputGroup; |
Oops, something went wrong.