@platformatic/ui-components 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -18,7 +18,8 @@ function ModalDirectional ({
|
|
|
18
18
|
titleClassName = '',
|
|
19
19
|
smallLayout = false,
|
|
20
20
|
classNameModalLefty = '',
|
|
21
|
-
permanent = false
|
|
21
|
+
permanent = false,
|
|
22
|
+
blurClassName = ''
|
|
22
23
|
}) {
|
|
23
24
|
const className = `${styles.container} ${styles.modalLeftCover} ${smallLayout ? styles.smallLayout : styles.normalLayout}`
|
|
24
25
|
const [modalClassName] = useState(className)
|
|
@@ -40,7 +41,7 @@ function ModalDirectional ({
|
|
|
40
41
|
|
|
41
42
|
return (
|
|
42
43
|
<>
|
|
43
|
-
<div className={styles.blur} onClick={() => permanent ? {} : closeModal()} />
|
|
44
|
+
<div className={blurClassName || styles.blur} onClick={() => permanent ? {} : closeModal()} />
|
|
44
45
|
<div className={variantModalClassName}>
|
|
45
46
|
<div className={classNameLefty}>
|
|
46
47
|
<div className={styles.headerClassName}>
|
|
@@ -94,7 +95,11 @@ ModalDirectional.propTypes = {
|
|
|
94
95
|
/**
|
|
95
96
|
* permanent: modal could be closed only with Esc, X or Cancel
|
|
96
97
|
*/
|
|
97
|
-
permanent: PropTypes.bool
|
|
98
|
+
permanent: PropTypes.bool,
|
|
99
|
+
/**
|
|
100
|
+
* blurClassName: override
|
|
101
|
+
*/
|
|
102
|
+
blurClassName: PropTypes.string
|
|
98
103
|
}
|
|
99
104
|
|
|
100
105
|
export default ModalDirectional
|
|
@@ -8,6 +8,7 @@ import Button from '../Button'
|
|
|
8
8
|
import { ERROR_RED, MAIN_DARK_BLUE, MAIN_GREEN, RICH_BLACK, TRANSPARENT, WHITE } from '../constants'
|
|
9
9
|
|
|
10
10
|
function InputFileUpload ({
|
|
11
|
+
idInputFile = 'fileUpload',
|
|
11
12
|
placeholder = '',
|
|
12
13
|
borderColor = MAIN_GREEN,
|
|
13
14
|
errorMessage = '',
|
|
@@ -18,12 +19,14 @@ function InputFileUpload ({
|
|
|
18
19
|
afterIcon = null,
|
|
19
20
|
backgroundColor = WHITE,
|
|
20
21
|
inputTextClassName = '',
|
|
22
|
+
detailTextClassName = '',
|
|
21
23
|
verticalPaddingClassName = '',
|
|
22
24
|
dataAttrName = '',
|
|
23
25
|
dataAttrValue = '',
|
|
24
26
|
readOnly = false,
|
|
25
27
|
removeFileButton = {},
|
|
26
|
-
onClickDetail = () => {}
|
|
28
|
+
onClickDetail = () => {},
|
|
29
|
+
acceptFiles = '*'
|
|
27
30
|
}) {
|
|
28
31
|
let baseInputClassName = `${commonStyles.fullWidth} ${styles.input} ${inputTextClassName} `
|
|
29
32
|
baseInputClassName += verticalPaddingClassName || ` ${styles.inputDefaultVerticalPadding} `
|
|
@@ -68,26 +71,31 @@ function InputFileUpload ({
|
|
|
68
71
|
}
|
|
69
72
|
|
|
70
73
|
function clearFile () {
|
|
74
|
+
document.getElementById(idInputFile).value = ''
|
|
71
75
|
setFile(null)
|
|
72
76
|
onFileSelect(null)
|
|
73
77
|
}
|
|
74
78
|
|
|
75
79
|
return (
|
|
76
80
|
<div className={styles.container} {...dataProps}>
|
|
77
|
-
<div className={styles.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
81
|
+
<div className={styles.content}>
|
|
82
|
+
<div className={styles.inputContainer}>
|
|
83
|
+
{beforeIcon && <div className={styles.beforeInputIcon}><PlatformaticIcon iconName={beforeIcon.iconName} size='small' data-testid='before-icon' color={beforeIcon.color} onClick={() => beforeIcon.onClick()} /></div>}
|
|
84
|
+
<input
|
|
85
|
+
id={idInputFile}
|
|
86
|
+
type='file'
|
|
87
|
+
className={focus ? focusedClassName() : normalClassName()}
|
|
88
|
+
onChange={handleFileInput}
|
|
89
|
+
disabled={disabled}
|
|
90
|
+
placeholder={inputPlaceholder}
|
|
91
|
+
readOnly={readOnly}
|
|
92
|
+
aria-readonly={readOnly}
|
|
93
|
+
onFocus={() => handleFocus()}
|
|
94
|
+
onBlur={() => handleBlur()}
|
|
95
|
+
accept={acceptFiles}
|
|
96
|
+
/>
|
|
97
|
+
{file !== null && <span className={`${styles.afterInputDetail} ${detailTextClassName}`} onClick={() => onClickDetail()}>Detail</span>}
|
|
98
|
+
</div>
|
|
91
99
|
{file !== null && (
|
|
92
100
|
<Button
|
|
93
101
|
textClass={removeFileButton?.textClass ?? ''}
|
|
@@ -105,6 +113,10 @@ function InputFileUpload ({
|
|
|
105
113
|
}
|
|
106
114
|
|
|
107
115
|
InputFileUpload.propTypes = {
|
|
116
|
+
/**
|
|
117
|
+
* idInputFile
|
|
118
|
+
*/
|
|
119
|
+
idInputFile: PropTypes.string,
|
|
108
120
|
/**
|
|
109
121
|
* placeholder
|
|
110
122
|
*/
|
|
@@ -149,6 +161,14 @@ InputFileUpload.propTypes = {
|
|
|
149
161
|
* inputTextClassName
|
|
150
162
|
*/
|
|
151
163
|
inputTextClassName: PropTypes.string,
|
|
164
|
+
/**
|
|
165
|
+
* detailTextClassName
|
|
166
|
+
*/
|
|
167
|
+
detailTextClassName: PropTypes.string,
|
|
168
|
+
/**
|
|
169
|
+
* accept
|
|
170
|
+
*/
|
|
171
|
+
accept: PropTypes.string,
|
|
152
172
|
/**
|
|
153
173
|
* verticalPaddingClassName
|
|
154
174
|
*/
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
.container {
|
|
2
2
|
@apply flex flex-col w-full relative;
|
|
3
3
|
}
|
|
4
|
+
.content,
|
|
4
5
|
.inputContainer {
|
|
5
|
-
@apply flex
|
|
6
|
+
@apply flex w-full relative z-20 gap-x-2 items-center;
|
|
6
7
|
}
|
|
7
8
|
.input {
|
|
8
9
|
padding-block: 0px;
|
|
@@ -12,7 +13,7 @@
|
|
|
12
13
|
.inputDefaultVerticalPadding {
|
|
13
14
|
@apply py-2.5;
|
|
14
15
|
}
|
|
15
|
-
.
|
|
16
|
+
.afterInputDetail,
|
|
16
17
|
.beforeInputIcon {
|
|
17
18
|
@apply absolute top-[50%] z-20;
|
|
18
19
|
transform: translateY(-50%);
|
|
@@ -20,8 +21,8 @@
|
|
|
20
21
|
.beforeInputIcon {
|
|
21
22
|
@apply left-0 ml-2
|
|
22
23
|
}
|
|
23
|
-
.
|
|
24
|
-
@apply right-0 mr-2
|
|
24
|
+
.afterInputDetail {
|
|
25
|
+
@apply right-0 mr-2 cursor-pointer
|
|
25
26
|
}
|
|
26
27
|
.beforeIconPadding {
|
|
27
28
|
@apply pl-8
|