@spaced-out/ui-design-system 0.1.29 → 0.1.31
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/.cspell/custom-words.txt +5 -0
- package/.github/workflows/pages.yml +3 -0
- package/.github/workflows/publish_to_npm.yml +1 -1
- package/.github/workflows/pull_request_checks.yml +44 -0
- package/.github/workflows/pull_request_semantics_checker.yml +1 -0
- package/.storybook/main.js +1 -1
- package/.storybook/preview-head.html +8 -3
- package/CHANGELOG.md +33 -0
- package/design-tokens/color/app-color.json +3 -0
- package/design-tokens/color/base-color.json +3 -0
- package/design-tokens/index.js +5 -3
- package/design-tokens/size/base-size.json +15 -0
- package/lib/components/Dialog/Dialog.module.css +1 -1
- package/lib/components/FileUpload/FileUpload.js +195 -0
- package/lib/components/FileUpload/FileUpload.js.flow +301 -0
- package/lib/components/FileUpload/FileUpload.module.css +185 -0
- package/lib/components/FileUpload/index.js +16 -0
- package/lib/components/FileUpload/index.js.flow +3 -0
- package/lib/components/Input/Input.js +2 -2
- package/lib/components/Input/Input.js.flow +11 -7
- package/lib/components/Input/Input.module.css +16 -5
- package/lib/components/LinearLoader/LinearLoader.js +10 -3
- package/lib/components/LinearLoader/LinearLoader.js.flow +15 -2
- package/lib/components/LinearLoader/LinearLoader.module.css +34 -1
- package/lib/components/Modal/Modal.js +3 -2
- package/lib/components/Modal/Modal.js.flow +10 -4
- package/lib/components/Modal/Modal.module.css +13 -1
- package/lib/components/Modal/index.js.flow +1 -0
- package/lib/components/Textarea/Textarea.js +2 -2
- package/lib/components/Textarea/Textarea.js.flow +10 -6
- package/lib/components/Textarea/Textarea.module.css +19 -5
- package/lib/components/index.js +11 -0
- package/lib/components/index.js.flow +1 -0
- package/lib/hooks/index.js +11 -0
- package/lib/hooks/index.js.flow +1 -0
- package/lib/hooks/useFileUpload/index.js +16 -0
- package/lib/hooks/useFileUpload/index.js.flow +3 -0
- package/lib/hooks/useFileUpload/useFileUpload.js +279 -0
- package/lib/hooks/useFileUpload/useFileUpload.js.flow +304 -0
- package/lib/styles/index.css +12 -0
- package/lib/styles/index.js +15 -3
- package/lib/styles/index.js.flow +12 -0
- package/lib/styles/variables/_color.css +2 -0
- package/lib/styles/variables/_color.js +3 -1
- package/lib/styles/variables/_color.js.flow +2 -0
- package/lib/styles/variables/_size.css +10 -0
- package/lib/styles/variables/_size.js +11 -1
- package/lib/styles/variables/_size.js.flow +10 -0
- package/lib/utils/helpers/helpers.js +39 -2
- package/lib/utils/helpers/helpers.js.flow +37 -0
- package/lib/utils/makeClassNameComponent/makeClassNameComponent.js.flow +0 -1
- package/lib/utils/tokens/tokens.js +15 -2
- package/lib/utils/tokens/tokens.js.flow +16 -0
- package/package.json +3 -2
- /package/design-tokens/motion/{app.motion.json → app-motion.json} +0 -0
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
// $FlowFixMe[untyped-import] -- this should be fixed soon
|
|
5
|
+
import {
|
|
6
|
+
type UseFileUploadReturnProps,
|
|
7
|
+
useFileUpload,
|
|
8
|
+
} from '../../hooks/useFileUpload';
|
|
9
|
+
import classify from '../../utils/classify';
|
|
10
|
+
import {UnstyledButton} from '../Button';
|
|
11
|
+
import {ClickableIcon, CloseIcon, Icon} from '../Icon';
|
|
12
|
+
import {LinearLoader} from '../LinearLoader';
|
|
13
|
+
import {Truncate} from '../Truncate';
|
|
14
|
+
|
|
15
|
+
import css from './FileUpload.module.css';
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
type ClassNames = $ReadOnly<{
|
|
19
|
+
wrapper?: string,
|
|
20
|
+
instruction?: string,
|
|
21
|
+
secondaryInstruction?: string,
|
|
22
|
+
}>;
|
|
23
|
+
|
|
24
|
+
export type FileProgress = number | 'indeterminate';
|
|
25
|
+
|
|
26
|
+
export type FileObject = {
|
|
27
|
+
file: File,
|
|
28
|
+
id: string,
|
|
29
|
+
reject?: boolean,
|
|
30
|
+
rejectReason?: string,
|
|
31
|
+
progress?: FileProgress,
|
|
32
|
+
success?: boolean,
|
|
33
|
+
successMessage?: string,
|
|
34
|
+
// This is a flag that is used to show/hide re-upload button
|
|
35
|
+
showReUpload?: boolean,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// This is a file error object that is passed to onRejectedFilesDrop callback in useFileUpload hook
|
|
39
|
+
export type FileError = {
|
|
40
|
+
code: string,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// This is a file rejection object that is passed to handleDropRejected function in useFileUpload hook
|
|
44
|
+
export type FileRejection = {
|
|
45
|
+
errors: Array<FileError>,
|
|
46
|
+
file: File,
|
|
47
|
+
...
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// This is a ref object that is passed to FileUpload component for managing state of a single file
|
|
51
|
+
export type FileUploadRef = {
|
|
52
|
+
moveFileToProgress: (id: string, progress: FileProgress) => mixed,
|
|
53
|
+
moveFileToSuccess: (id: string, successMessage?: string) => mixed,
|
|
54
|
+
moveFileToReject: (id: string, rejectReason?: string) => mixed,
|
|
55
|
+
setShowReUpload: (id: string, showReUpload?: boolean) => mixed,
|
|
56
|
+
validFiles: Array<FileObject>,
|
|
57
|
+
rejectedFiles: Array<FileObject>,
|
|
58
|
+
files: Array<FileObject>,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// These props are shared between FileUpload component and useFileUpload hook
|
|
62
|
+
export type FileUploadBaseProps = {
|
|
63
|
+
maxFiles?: number,
|
|
64
|
+
maxSize?: number,
|
|
65
|
+
accept?: {[string]: string[]},
|
|
66
|
+
disabled?: boolean,
|
|
67
|
+
|
|
68
|
+
// File drop callbacks
|
|
69
|
+
onValidFilesDrop?: (acceptedFiles: Array<FileObject>) => void,
|
|
70
|
+
onRejectedFilesDrop?: (fileRejections: Array<FileObject>) => void,
|
|
71
|
+
|
|
72
|
+
// File clear callbacks
|
|
73
|
+
onFileClear?: (id: string) => void,
|
|
74
|
+
onClear?: () => void,
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export type FileUploadProps = {
|
|
78
|
+
...FileUploadBaseProps,
|
|
79
|
+
|
|
80
|
+
classNames?: ClassNames,
|
|
81
|
+
label?: React.Node,
|
|
82
|
+
instruction?: React.Node,
|
|
83
|
+
draggingInstruction?: React.Node,
|
|
84
|
+
secondaryInstruction?: React.Node,
|
|
85
|
+
required?: boolean,
|
|
86
|
+
|
|
87
|
+
// File refresh callback
|
|
88
|
+
onFileRefreshClick?: (file: FileObject) => void,
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export type FileBlockProps = {
|
|
92
|
+
file: FileObject,
|
|
93
|
+
onFileRefreshClick?: (file: FileObject) => void,
|
|
94
|
+
handleFileClear?: (id: string) => mixed,
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const FileUploadBase = (props: FileUploadProps, ref) => {
|
|
98
|
+
const {
|
|
99
|
+
classNames,
|
|
100
|
+
label = 'Upload File',
|
|
101
|
+
disabled = false,
|
|
102
|
+
instruction = 'Drag and drop or click to upload',
|
|
103
|
+
draggingInstruction = 'Drop here to start uploading..',
|
|
104
|
+
error = false,
|
|
105
|
+
required = false,
|
|
106
|
+
secondaryInstruction = '',
|
|
107
|
+
maxSize,
|
|
108
|
+
accept,
|
|
109
|
+
onValidFilesDrop,
|
|
110
|
+
onRejectedFilesDrop,
|
|
111
|
+
onFileClear,
|
|
112
|
+
onFileRefreshClick,
|
|
113
|
+
maxFiles = 1,
|
|
114
|
+
} = props;
|
|
115
|
+
|
|
116
|
+
// Get file upload state from useFileUpload hook
|
|
117
|
+
const {
|
|
118
|
+
validFiles,
|
|
119
|
+
rejectedFiles,
|
|
120
|
+
isDragActive,
|
|
121
|
+
getRootProps,
|
|
122
|
+
shouldAcceptFiles,
|
|
123
|
+
getInputProps,
|
|
124
|
+
handleFileClear,
|
|
125
|
+
moveFileToProgress,
|
|
126
|
+
moveFileToSuccess,
|
|
127
|
+
moveFileToReject,
|
|
128
|
+
setShowReUpload,
|
|
129
|
+
}: UseFileUploadReturnProps = useFileUpload({
|
|
130
|
+
maxFiles,
|
|
131
|
+
maxSize,
|
|
132
|
+
accept,
|
|
133
|
+
disabled,
|
|
134
|
+
onValidFilesDrop,
|
|
135
|
+
onRejectedFilesDrop,
|
|
136
|
+
onFileClear,
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
// Expose file upload actions to parent component
|
|
140
|
+
React.useImperativeHandle(ref, () => ({
|
|
141
|
+
moveFileToProgress,
|
|
142
|
+
moveFileToSuccess,
|
|
143
|
+
moveFileToReject,
|
|
144
|
+
setShowReUpload,
|
|
145
|
+
validFiles,
|
|
146
|
+
rejectedFiles,
|
|
147
|
+
files: [...validFiles, ...rejectedFiles],
|
|
148
|
+
}));
|
|
149
|
+
|
|
150
|
+
// Merge valid and rejected files
|
|
151
|
+
const files = [...validFiles, ...rejectedFiles];
|
|
152
|
+
|
|
153
|
+
return (
|
|
154
|
+
<div className={classify(css.wrapper, classNames?.wrapper)}>
|
|
155
|
+
{Boolean(label) && (
|
|
156
|
+
<div className={css.label}>
|
|
157
|
+
<Truncate>{label}</Truncate>
|
|
158
|
+
{required && <span className={css.required}>{'*'}</span>}
|
|
159
|
+
</div>
|
|
160
|
+
)}
|
|
161
|
+
|
|
162
|
+
<UnstyledButton
|
|
163
|
+
disabled={disabled || !shouldAcceptFiles}
|
|
164
|
+
{...getRootProps()}
|
|
165
|
+
className={classify(css.dropzone, {
|
|
166
|
+
[css.disabled]: disabled || !shouldAcceptFiles,
|
|
167
|
+
[css.dragActive]: isDragActive,
|
|
168
|
+
[css.error]: error,
|
|
169
|
+
})}
|
|
170
|
+
>
|
|
171
|
+
<input {...getInputProps()} />
|
|
172
|
+
<div className={classify(css.instruction, classNames?.instruction)}>
|
|
173
|
+
{isDragActive ? draggingInstruction : instruction}
|
|
174
|
+
</div>
|
|
175
|
+
<div
|
|
176
|
+
className={classify(
|
|
177
|
+
css.secondaryInstruction,
|
|
178
|
+
classNames?.secondaryInstruction,
|
|
179
|
+
)}
|
|
180
|
+
>
|
|
181
|
+
{secondaryInstruction}
|
|
182
|
+
</div>
|
|
183
|
+
</UnstyledButton>
|
|
184
|
+
|
|
185
|
+
{files.length > 0 && (
|
|
186
|
+
<div className={css.files}>
|
|
187
|
+
{files.map((file: FileObject) => (
|
|
188
|
+
<React.Fragment key={file.id}>
|
|
189
|
+
<FileBlock
|
|
190
|
+
file={file}
|
|
191
|
+
onFileRefreshClick={onFileRefreshClick}
|
|
192
|
+
handleFileClear={handleFileClear}
|
|
193
|
+
/>
|
|
194
|
+
</React.Fragment>
|
|
195
|
+
))}
|
|
196
|
+
</div>
|
|
197
|
+
)}
|
|
198
|
+
</div>
|
|
199
|
+
);
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
const FileBlock = ({
|
|
203
|
+
file,
|
|
204
|
+
onFileRefreshClick,
|
|
205
|
+
handleFileClear,
|
|
206
|
+
}: FileBlockProps): React.Node => (
|
|
207
|
+
<>
|
|
208
|
+
<div className={css.file}>
|
|
209
|
+
<div className={css.fileInfo}>
|
|
210
|
+
<div className={css.fileNameBlock}>
|
|
211
|
+
<div className={css.icon}>
|
|
212
|
+
<FileStatusIcon file={file} />
|
|
213
|
+
</div>
|
|
214
|
+
<div className={css.fileName}>
|
|
215
|
+
<Truncate>{file.file.name}</Truncate>
|
|
216
|
+
</div>
|
|
217
|
+
</div>
|
|
218
|
+
|
|
219
|
+
{file.success && !!file.successMessage && (
|
|
220
|
+
<div className={css.fileSuccess}>
|
|
221
|
+
<Truncate>{file.successMessage}</Truncate>
|
|
222
|
+
</div>
|
|
223
|
+
)}
|
|
224
|
+
|
|
225
|
+
{file.reject && !!file.rejectReason && (
|
|
226
|
+
<div className={css.fileError}>
|
|
227
|
+
<Truncate>{file.rejectReason}</Truncate>
|
|
228
|
+
</div>
|
|
229
|
+
)}
|
|
230
|
+
|
|
231
|
+
{!!file.progress && (
|
|
232
|
+
<div className={css.progress}>
|
|
233
|
+
<LinearLoader
|
|
234
|
+
size="small"
|
|
235
|
+
value={file.progress === 'indeterminate' ? 0 : file.progress}
|
|
236
|
+
indeterminate={file.progress === 'indeterminate'}
|
|
237
|
+
></LinearLoader>
|
|
238
|
+
</div>
|
|
239
|
+
)}
|
|
240
|
+
</div>
|
|
241
|
+
<div className={css.rightSection}>
|
|
242
|
+
{file.showReUpload && (
|
|
243
|
+
<div className={css.rightBlock}>
|
|
244
|
+
<ClickableIcon
|
|
245
|
+
name="refresh"
|
|
246
|
+
size="small"
|
|
247
|
+
onClick={() => onFileRefreshClick?.(file)}
|
|
248
|
+
/>
|
|
249
|
+
</div>
|
|
250
|
+
)}
|
|
251
|
+
|
|
252
|
+
<div className={css.rightBlock}>
|
|
253
|
+
<CloseIcon size="small" onClick={() => handleFileClear?.(file.id)} />
|
|
254
|
+
</div>
|
|
255
|
+
</div>
|
|
256
|
+
</div>
|
|
257
|
+
</>
|
|
258
|
+
);
|
|
259
|
+
|
|
260
|
+
// This function returns the status of a file
|
|
261
|
+
const getFileStatus = (file: FileObject) => {
|
|
262
|
+
if (file.progress) {
|
|
263
|
+
return 'progress';
|
|
264
|
+
}
|
|
265
|
+
if (file.success) {
|
|
266
|
+
return 'success';
|
|
267
|
+
}
|
|
268
|
+
if (file.reject) {
|
|
269
|
+
return 'error';
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
return 'default';
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
// This component renders the status icon for a file
|
|
276
|
+
const FileStatusIcon = ({file}: {file: FileObject}) => {
|
|
277
|
+
const status = getFileStatus(file);
|
|
278
|
+
switch (status) {
|
|
279
|
+
case 'progress':
|
|
280
|
+
return <Icon size="small" name="loader" color="tertiary" />;
|
|
281
|
+
case 'success':
|
|
282
|
+
return <Icon size="small" name="check" color="success" />;
|
|
283
|
+
case 'error':
|
|
284
|
+
return (
|
|
285
|
+
<Icon
|
|
286
|
+
size="small"
|
|
287
|
+
name="circle-exclamation"
|
|
288
|
+
color="danger"
|
|
289
|
+
type="solid"
|
|
290
|
+
/>
|
|
291
|
+
);
|
|
292
|
+
|
|
293
|
+
default:
|
|
294
|
+
return <Icon size="small" name="check" color="success" />;
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
export const FileUpload: React.AbstractComponent<
|
|
299
|
+
FileUploadProps,
|
|
300
|
+
FileUploadRef,
|
|
301
|
+
> = React.forwardRef<FileUploadProps, FileUploadRef>(FileUploadBase);
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
@value (
|
|
2
|
+
colorTextSecondary,
|
|
3
|
+
colorBackgroundPrimary,
|
|
4
|
+
colorBackgroundTertiary,
|
|
5
|
+
colorBorderTertiary,
|
|
6
|
+
colorTextPrimary,
|
|
7
|
+
colorTextTertiary,
|
|
8
|
+
colorTextSuccess,
|
|
9
|
+
colorTextDisabled,
|
|
10
|
+
colorBorderPrimary,
|
|
11
|
+
colorBorderSecondary,
|
|
12
|
+
colorTextClickable,
|
|
13
|
+
colorTextDanger,
|
|
14
|
+
colorDangerLightest,
|
|
15
|
+
colorInformationLightest,
|
|
16
|
+
colorFocusPrimary
|
|
17
|
+
) from '../../styles/variables/_color.css';
|
|
18
|
+
|
|
19
|
+
@value (
|
|
20
|
+
borderWidthNone,
|
|
21
|
+
borderWidthPrimary,
|
|
22
|
+
borderRadiusMedium
|
|
23
|
+
) from '../../styles/variables/_border.css';
|
|
24
|
+
|
|
25
|
+
@value (
|
|
26
|
+
spaceXXSmall,
|
|
27
|
+
spaceXSmall,
|
|
28
|
+
spaceMedium,
|
|
29
|
+
spaceLarge
|
|
30
|
+
) from '../../styles/variables/_space.css';
|
|
31
|
+
|
|
32
|
+
@value (
|
|
33
|
+
size2,
|
|
34
|
+
size18,
|
|
35
|
+
size34
|
|
36
|
+
size48,
|
|
37
|
+
size50,
|
|
38
|
+
size70,
|
|
39
|
+
size125,
|
|
40
|
+
size240,
|
|
41
|
+
sizeFluid
|
|
42
|
+
) from '../../styles/variables/_size.css';
|
|
43
|
+
|
|
44
|
+
.wrapper {
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
width: sizeFluid;
|
|
48
|
+
gap: spaceXSmall;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.dropzone {
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
display: flex;
|
|
54
|
+
flex-flow: column;
|
|
55
|
+
gap: spaceXSmall;
|
|
56
|
+
width: sizeFluid;
|
|
57
|
+
padding: spaceLarge;
|
|
58
|
+
justify-content: center;
|
|
59
|
+
align-items: center;
|
|
60
|
+
min-height: size125;
|
|
61
|
+
border: borderWidthPrimary solid colorBorderPrimary;
|
|
62
|
+
border-radius: borderRadiusMedium;
|
|
63
|
+
outline: none;
|
|
64
|
+
color: colorTextSecondary;
|
|
65
|
+
background-color: colorBackgroundTertiary;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.dropzone:hover,
|
|
69
|
+
.dragActive {
|
|
70
|
+
border-color: colorBorderTertiary;
|
|
71
|
+
background-color: colorBackgroundPrimary;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.dropzone:focus {
|
|
75
|
+
background-color: colorBackgroundPrimary;
|
|
76
|
+
border-color: colorTextClickable;
|
|
77
|
+
box-shadow: borderWidthNone borderWidthNone borderWidthNone borderWidthPrimary
|
|
78
|
+
colorFocusPrimary;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.dropzone.disabled {
|
|
82
|
+
pointer-events: none;
|
|
83
|
+
cursor: not-allowed;
|
|
84
|
+
color: colorTextDisabled;
|
|
85
|
+
border: borderWidthPrimary solid colorBorderPrimary;
|
|
86
|
+
background-color: colorBackgroundPrimary;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.instruction {
|
|
90
|
+
composes: buttonTextSmall from '../../styles/typography.module.css';
|
|
91
|
+
color: inherit;
|
|
92
|
+
text-decoration: underline;
|
|
93
|
+
max-width: size125;
|
|
94
|
+
text-align: center;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.secondaryInstruction {
|
|
98
|
+
composes: bodySmall from '../../styles/typography.module.css';
|
|
99
|
+
color: inherit;
|
|
100
|
+
max-width: size240;
|
|
101
|
+
text-align: center;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.files {
|
|
105
|
+
display: flex;
|
|
106
|
+
flex-flow: column;
|
|
107
|
+
gap: spaceXSmall;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.file {
|
|
111
|
+
display: flex;
|
|
112
|
+
height: size50;
|
|
113
|
+
padding: spaceXSmall;
|
|
114
|
+
align-items: center;
|
|
115
|
+
justify-content: space-between;
|
|
116
|
+
gap: spaceXSmall;
|
|
117
|
+
background-color: colorBackgroundPrimary;
|
|
118
|
+
border-bottom: borderWidthPrimary solid colorBorderSecondary;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.fileInfo {
|
|
122
|
+
display: flex;
|
|
123
|
+
flex-flow: column;
|
|
124
|
+
gap: spaceXSmall;
|
|
125
|
+
width: sizeFluid;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.fileNameBlock {
|
|
129
|
+
display: flex;
|
|
130
|
+
composes: formLabelMedium from '../../styles/typography.module.css';
|
|
131
|
+
color: colorTextPrimary;
|
|
132
|
+
gap: spaceXXSmall;
|
|
133
|
+
align-items: flex-start;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.fileName {
|
|
137
|
+
display: flex;
|
|
138
|
+
color: inherit;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.fileError,
|
|
142
|
+
.fileSuccess {
|
|
143
|
+
composes: bodySmall from '../../styles/typography.module.css';
|
|
144
|
+
margin-left: calc(size18 + spaceXXSmall);
|
|
145
|
+
margin-top: calc(spaceXSmall * -1);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.fileError {
|
|
149
|
+
color: colorTextDanger;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.fileSuccess {
|
|
153
|
+
color: colorTextSuccess;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.icon {
|
|
157
|
+
display: flex;
|
|
158
|
+
justify-content: center;
|
|
159
|
+
align-items: center;
|
|
160
|
+
min-width: size18;
|
|
161
|
+
min-height: size18;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.rightSection {
|
|
165
|
+
display: flex;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.rightBlock {
|
|
169
|
+
min-width: size34;
|
|
170
|
+
min-height: size34;
|
|
171
|
+
display: flex;
|
|
172
|
+
align-items: center;
|
|
173
|
+
justify-content: center;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.label {
|
|
177
|
+
display: flex;
|
|
178
|
+
gap: spaceXXSmall;
|
|
179
|
+
composes: formLabelSmall from '../../styles/typography.module.css';
|
|
180
|
+
color: colorTextSecondary;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.required {
|
|
184
|
+
color: colorTextDanger;
|
|
185
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _FileUpload = require("./FileUpload");
|
|
7
|
+
Object.keys(_FileUpload).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _FileUpload[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _FileUpload[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -82,13 +82,13 @@ const Input_ = (props, ref) => {
|
|
|
82
82
|
}, label ?? ''), "\xA0", required && /*#__PURE__*/React.createElement(_Text.FormLabelSmall, {
|
|
83
83
|
color: "danger"
|
|
84
84
|
}, '*'))), /*#__PURE__*/React.createElement("div", {
|
|
85
|
-
className: (0, _classify.classify)(_InputModule.default.box,
|
|
85
|
+
className: (0, _classify.classify)(_InputModule.default.box, {
|
|
86
86
|
[_InputModule.default.inputDisabled]: disabled ?? false,
|
|
87
87
|
[_InputModule.default.medium]: size === 'medium',
|
|
88
88
|
[_InputModule.default.small]: size === 'small',
|
|
89
89
|
[_InputModule.default.locked]: locked,
|
|
90
90
|
[_InputModule.default.color]: type === 'color'
|
|
91
|
-
}),
|
|
91
|
+
}, classNames?.box),
|
|
92
92
|
onClick: !(disabled || locked) ? onContainerClick : null,
|
|
93
93
|
ref: boxRef
|
|
94
94
|
}, iconLeftName && /*#__PURE__*/React.createElement(_Icon.Icon, {
|
|
@@ -137,13 +137,17 @@ const Input_ = (props: InputProps, ref): React.Node => {
|
|
|
137
137
|
</div>
|
|
138
138
|
)}
|
|
139
139
|
<div
|
|
140
|
-
className={classify(
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
140
|
+
className={classify(
|
|
141
|
+
css.box,
|
|
142
|
+
{
|
|
143
|
+
[css.inputDisabled]: disabled ?? false,
|
|
144
|
+
[css.medium]: size === 'medium',
|
|
145
|
+
[css.small]: size === 'small',
|
|
146
|
+
[css.locked]: locked,
|
|
147
|
+
[css.color]: type === 'color',
|
|
148
|
+
},
|
|
149
|
+
classNames?.box,
|
|
150
|
+
)}
|
|
147
151
|
onClick={!(disabled || locked) ? onContainerClick : null}
|
|
148
152
|
ref={boxRef}
|
|
149
153
|
>
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
@value (
|
|
18
18
|
borderRadiusMedium,
|
|
19
19
|
borderRadiusSmall,
|
|
20
|
-
|
|
20
|
+
borderWidthPrimary,
|
|
21
21
|
borderWidthTertiary,
|
|
22
22
|
borderWidthNone,
|
|
23
23
|
borderRadiusXSmall
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
@value (
|
|
27
27
|
colorTextPrimary,
|
|
28
28
|
colorTextSecondary,
|
|
29
|
+
colorTextTertiary,
|
|
29
30
|
colorBorderPrimary,
|
|
30
31
|
colorFillPrimary,
|
|
31
32
|
colorFocusPrimary,
|
|
@@ -33,7 +34,8 @@
|
|
|
33
34
|
colorTextDisabled,
|
|
34
35
|
colorFillDisabled,
|
|
35
36
|
colorTextDanger,
|
|
36
|
-
colorBackgroundTertiary
|
|
37
|
+
colorBackgroundTertiary,
|
|
38
|
+
colorBorderTertiary
|
|
37
39
|
) from '../../styles/variables/_color.css';
|
|
38
40
|
|
|
39
41
|
.container {
|
|
@@ -48,10 +50,19 @@
|
|
|
48
50
|
gap: spaceXSmall;
|
|
49
51
|
height: size42;
|
|
50
52
|
padding: spaceNone spaceSmall;
|
|
51
|
-
border:
|
|
53
|
+
border: borderWidthPrimary solid colorBorderPrimary;
|
|
52
54
|
background-color: colorBackgroundTertiary;
|
|
53
55
|
}
|
|
54
56
|
|
|
57
|
+
.wrapper:not(.withError) .box:not(.inputDisabled):not(.locked):hover {
|
|
58
|
+
border-color: colorBorderTertiary;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.wrapper:not(.withError):focus-within
|
|
62
|
+
.box:not(.inputDisabled):not(.locked):hover {
|
|
63
|
+
border-color: colorFillPrimary;
|
|
64
|
+
}
|
|
65
|
+
|
|
55
66
|
.locked {
|
|
56
67
|
border-style: dashed;
|
|
57
68
|
}
|
|
@@ -92,7 +103,7 @@
|
|
|
92
103
|
cursor: inherit;
|
|
93
104
|
}
|
|
94
105
|
|
|
95
|
-
.wrapper:not(.
|
|
106
|
+
.wrapper:not(.withError):focus-within .box:not(.inputDisabled) {
|
|
96
107
|
border-color: colorFillPrimary;
|
|
97
108
|
box-shadow: borderWidthNone borderWidthNone borderWidthNone
|
|
98
109
|
borderWidthTertiary colorFocusPrimary;
|
|
@@ -105,7 +116,7 @@
|
|
|
105
116
|
}
|
|
106
117
|
|
|
107
118
|
input::placeholder {
|
|
108
|
-
color:
|
|
119
|
+
color: colorTextTertiary;
|
|
109
120
|
}
|
|
110
121
|
|
|
111
122
|
.inputDisabled input::placeholder {
|
|
@@ -15,7 +15,8 @@ const LinearLoader = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
15
15
|
let {
|
|
16
16
|
value,
|
|
17
17
|
size = 'medium',
|
|
18
|
-
className
|
|
18
|
+
className,
|
|
19
|
+
indeterminate
|
|
19
20
|
} = _ref;
|
|
20
21
|
return /*#__PURE__*/React.createElement("div", {
|
|
21
22
|
className: (0, _classify.classify)(_LinearLoaderModule.default.lineContainer, {
|
|
@@ -25,10 +26,16 @@ const LinearLoader = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
25
26
|
}, className),
|
|
26
27
|
ref: ref
|
|
27
28
|
}, /*#__PURE__*/React.createElement("div", {
|
|
28
|
-
className: _LinearLoaderModule.default.progressBar,
|
|
29
|
+
className: (0, _classify.classify)(_LinearLoaderModule.default.progressBar, {
|
|
30
|
+
[_LinearLoaderModule.default.indeterminate]: indeterminate
|
|
31
|
+
}),
|
|
29
32
|
style: {
|
|
30
33
|
width: `${value + '%'}`
|
|
31
|
-
}
|
|
34
|
+
},
|
|
35
|
+
role: "progressbar",
|
|
36
|
+
"aria-valuenow": indeterminate ? undefined : value,
|
|
37
|
+
"aria-valuemin": "0",
|
|
38
|
+
"aria-valuemax": "100"
|
|
32
39
|
}));
|
|
33
40
|
});
|
|
34
41
|
exports.LinearLoader = LinearLoader;
|
|
@@ -11,13 +11,17 @@ export type LinearLoaderProps = {
|
|
|
11
11
|
value: number,
|
|
12
12
|
size?: 'large' | 'medium' | 'small',
|
|
13
13
|
className?: string,
|
|
14
|
+
indeterminate?: boolean,
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
export const LinearLoader: React$AbstractComponent<
|
|
17
18
|
LinearLoaderProps,
|
|
18
19
|
HTMLDivElement,
|
|
19
20
|
> = React.forwardRef<LinearLoaderProps, HTMLDivElement>(
|
|
20
|
-
(
|
|
21
|
+
(
|
|
22
|
+
{value, size = 'medium', className, indeterminate}: LinearLoaderProps,
|
|
23
|
+
ref,
|
|
24
|
+
): React.Node => (
|
|
21
25
|
<div
|
|
22
26
|
className={classify(
|
|
23
27
|
css.lineContainer,
|
|
@@ -30,7 +34,16 @@ export const LinearLoader: React$AbstractComponent<
|
|
|
30
34
|
)}
|
|
31
35
|
ref={ref}
|
|
32
36
|
>
|
|
33
|
-
<div
|
|
37
|
+
<div
|
|
38
|
+
className={classify(css.progressBar, {
|
|
39
|
+
[css.indeterminate]: indeterminate,
|
|
40
|
+
})}
|
|
41
|
+
style={{width: `${value + '%'}`}}
|
|
42
|
+
role="progressbar"
|
|
43
|
+
aria-valuenow={indeterminate ? undefined : value}
|
|
44
|
+
aria-valuemin="0"
|
|
45
|
+
aria-valuemax="100"
|
|
46
|
+
></div>
|
|
34
47
|
</div>
|
|
35
48
|
),
|
|
36
49
|
);
|