@arbor-education/design-system.components 4.7.1 → 4.8.0
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/CHANGELOG.md +10 -0
- package/dist/components/fileUpload/FileList.d.ts +7 -0
- package/dist/components/fileUpload/FileList.d.ts.map +1 -0
- package/dist/components/fileUpload/FileList.js +29 -0
- package/dist/components/fileUpload/FileList.js.map +1 -0
- package/dist/components/fileUpload/FileList.stories.d.ts +45 -0
- package/dist/components/fileUpload/FileList.stories.d.ts.map +1 -0
- package/dist/components/fileUpload/FileList.stories.js +102 -0
- package/dist/components/fileUpload/FileList.stories.js.map +1 -0
- package/dist/components/fileUpload/FileList.test.d.ts +2 -0
- package/dist/components/fileUpload/FileList.test.d.ts.map +1 -0
- package/dist/components/fileUpload/FileList.test.js +125 -0
- package/dist/components/fileUpload/FileList.test.js.map +1 -0
- package/dist/components/fileUpload/FileUpload.d.ts +12 -3
- package/dist/components/fileUpload/FileUpload.d.ts.map +1 -1
- package/dist/components/fileUpload/FileUpload.js +6 -23
- package/dist/components/fileUpload/FileUpload.js.map +1 -1
- package/dist/components/fileUpload/FileUpload.stories.d.ts +4 -1
- package/dist/components/fileUpload/FileUpload.stories.d.ts.map +1 -1
- package/dist/components/heading/Heading.d.ts +2 -387
- package/dist/components/heading/Heading.d.ts.map +1 -1
- package/dist/components/heading/Heading.js +12 -4
- package/dist/components/heading/Heading.js.map +1 -1
- package/dist/components/heading/Heading.stories.d.ts +12 -387
- package/dist/components/heading/Heading.stories.d.ts.map +1 -1
- package/dist/components/heading/Heading.stories.js +19 -0
- package/dist/components/heading/Heading.stories.js.map +1 -1
- package/dist/components/heading/Heading.test.js +24 -0
- package/dist/components/heading/Heading.test.js.map +1 -1
- package/dist/components/table/Table.d.ts +2 -0
- package/dist/components/table/Table.d.ts.map +1 -1
- package/dist/components/table/cellRenderers/CheckboxCellRenderer.stories.d.ts +1 -0
- package/dist/components/table/cellRenderers/CheckboxCellRenderer.stories.d.ts.map +1 -1
- package/dist/components/table/cellRenderers/CheckboxCellRenderer.stories.js +4 -0
- package/dist/components/table/cellRenderers/CheckboxCellRenderer.stories.js.map +1 -1
- package/dist/components/table/cellRenderers/CheckboxCellRenderer.test.js +7 -0
- package/dist/components/table/cellRenderers/CheckboxCellRenderer.test.js.map +1 -1
- package/dist/components/table/cellRenderers/InlineTextCellRenderer.d.ts +1 -0
- package/dist/components/table/cellRenderers/InlineTextCellRenderer.d.ts.map +1 -1
- package/dist/components/table/cellRenderers/InlineTextCellRenderer.js +2 -2
- package/dist/components/table/cellRenderers/InlineTextCellRenderer.js.map +1 -1
- package/dist/components/table/cellRenderers/InlineTextCellRenderer.stories.d.ts +14 -0
- package/dist/components/table/cellRenderers/InlineTextCellRenderer.stories.d.ts.map +1 -1
- package/dist/components/table/cellRenderers/InlineTextCellRenderer.stories.js +12 -0
- package/dist/components/table/cellRenderers/InlineTextCellRenderer.stories.js.map +1 -1
- package/dist/components/table/cellRenderers/InlineTextCellRenderer.test.d.ts +2 -0
- package/dist/components/table/cellRenderers/InlineTextCellRenderer.test.d.ts.map +1 -0
- package/dist/components/table/cellRenderers/InlineTextCellRenderer.test.js +28 -0
- package/dist/components/table/cellRenderers/InlineTextCellRenderer.test.js.map +1 -0
- package/dist/components/table/cellRenderers/NumberInputCellRenderer.d.ts +1 -0
- package/dist/components/table/cellRenderers/NumberInputCellRenderer.d.ts.map +1 -1
- package/dist/components/table/cellRenderers/NumberInputCellRenderer.js +2 -2
- package/dist/components/table/cellRenderers/NumberInputCellRenderer.js.map +1 -1
- package/dist/components/table/cellRenderers/NumberInputCellRenderer.stories.d.ts +14 -0
- package/dist/components/table/cellRenderers/NumberInputCellRenderer.stories.d.ts.map +1 -1
- package/dist/components/table/cellRenderers/NumberInputCellRenderer.stories.js +12 -0
- package/dist/components/table/cellRenderers/NumberInputCellRenderer.stories.js.map +1 -1
- package/dist/components/table/cellRenderers/NumberInputCellRenderer.test.js +10 -0
- package/dist/components/table/cellRenderers/NumberInputCellRenderer.test.js.map +1 -1
- package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.js +1 -1
- package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.js.map +1 -1
- package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.stories.d.ts +1 -0
- package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.stories.d.ts.map +1 -1
- package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.stories.js +4 -0
- package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.stories.js.map +1 -1
- package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.test.js +9 -0
- package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.test.js.map +1 -1
- package/dist/index.css +17 -0
- package/dist/index.css.map +1 -1
- package/package.json +1 -1
- package/src/components/fileUpload/FileList.stories.tsx +109 -0
- package/src/components/fileUpload/FileList.test.tsx +158 -0
- package/src/components/fileUpload/FileList.tsx +124 -0
- package/src/components/fileUpload/FileUpload.tsx +19 -108
- package/src/components/heading/Heading.stories.tsx +23 -0
- package/src/components/heading/Heading.test.tsx +38 -0
- package/src/components/heading/Heading.tsx +27 -3
- package/src/components/heading/heading.scss +18 -0
- package/src/components/table/cellRenderers/CheckboxCellRenderer.stories.tsx +16 -0
- package/src/components/table/cellRenderers/CheckboxCellRenderer.test.tsx +8 -0
- package/src/components/table/cellRenderers/InlineTextCellRenderer.stories.tsx +22 -0
- package/src/components/table/cellRenderers/InlineTextCellRenderer.test.tsx +31 -0
- package/src/components/table/cellRenderers/InlineTextCellRenderer.tsx +4 -1
- package/src/components/table/cellRenderers/NumberInputCellRenderer.stories.tsx +24 -0
- package/src/components/table/cellRenderers/NumberInputCellRenderer.test.tsx +13 -1
- package/src/components/table/cellRenderers/NumberInputCellRenderer.tsx +4 -1
- package/src/components/table/cellRenderers/SelectDropdownCellRenderer.stories.tsx +19 -0
- package/src/components/table/cellRenderers/SelectDropdownCellRenderer.test.tsx +11 -0
- package/src/components/table/cellRenderers/SelectDropdownCellRenderer.tsx +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#293](https://github.com/arbor-education/design-system.components/pull/293) [`11a1f4d`](https://github.com/arbor-education/design-system.components/commit/11a1f4dfbc498cecdf26aa56c83d8007a2b6ff52) Thanks [@MarkFrancisArbor](https://github.com/MarkFrancisArbor)! - MIS-76030 Added error message prop to Heading component
|
|
8
|
+
|
|
9
|
+
- [#292](https://github.com/arbor-education/design-system.components/pull/292) [`1b09078`](https://github.com/arbor-education/design-system.components/commit/1b09078a1d9e4ce5740e8a8ba4dae92fa9d8a3bd) Thanks [@MarkFrancisArbor](https://github.com/MarkFrancisArbor)! - MIS-76022 Added hasError states to cell renderers
|
|
10
|
+
|
|
11
|
+
- [#302](https://github.com/arbor-education/design-system.components/pull/302) [`e82e4ac`](https://github.com/arbor-education/design-system.components/commit/e82e4ac54374c3d9a4f2ec9294dbed55056ee01d) Thanks [@angusmglfraser](https://github.com/angusmglfraser)! - MIS-73774 ✨ FileList extracted from FileUpload for use as a standalone component
|
|
12
|
+
|
|
3
13
|
## 4.7.1
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { UploadedFile } from '../fileUpload/FileUpload.js';
|
|
2
|
+
export type FileListProps = {
|
|
3
|
+
uploadedFiles: UploadedFile[];
|
|
4
|
+
onEditFile?: (index: number) => void;
|
|
5
|
+
};
|
|
6
|
+
export declare const FileList: (props: FileListProps) => import("react").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=FileList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileList.d.ts","sourceRoot":"","sources":["../../../src/components/fileUpload/FileList.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAGrE,MAAM,MAAM,aAAa,GAAG;IAC1B,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC,CAAC;AAcF,eAAO,MAAM,QAAQ,GAAI,OAAO,aAAa,gCAiG5C,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { Button } from '../button/Button.js';
|
|
4
|
+
import { Card } from '../card/Card.js';
|
|
5
|
+
import { Icon } from '../icon/Icon.js';
|
|
6
|
+
import { Progress } from '../progress/Progress.js';
|
|
7
|
+
import { Separator } from '../separator/Separator.js';
|
|
8
|
+
const renderFileLink = ({ href = '', linkProps, renderLink }, children) => {
|
|
9
|
+
const className = 'ds-file-upload__file-link';
|
|
10
|
+
if (renderLink) {
|
|
11
|
+
return renderLink({ href, className, children, linkProps });
|
|
12
|
+
}
|
|
13
|
+
return (_jsx("a", { href: href, target: "_blank", rel: "noopener noreferrer", className: className, ...linkProps, children: children }));
|
|
14
|
+
};
|
|
15
|
+
export const FileList = (props) => {
|
|
16
|
+
const { uploadedFiles, onEditFile, } = props;
|
|
17
|
+
return (_jsx(Card, { className: "ds-file-upload__file-list", children: uploadedFiles.map((file, index) => {
|
|
18
|
+
const { fileName, fileSize, fileType, href, onEdit, onDelete, onDownload, hasUploadFailed, progressPercentage, } = file;
|
|
19
|
+
const icon = file.icon ?? (href ? 'link' : 'file');
|
|
20
|
+
const nameNode = _jsx("span", { className: "ds-file-upload__file-name", children: fileName });
|
|
21
|
+
return (_jsxs("div", { className: "ds-file-upload__file-outer", children: [_jsxs("span", { className: "ds-file-upload__file", children: [_jsx("span", { className: "ds-file-upload__icon-wrapper", children: _jsx(Icon, { size: 24, name: icon, color: "var(--color-brand-600)" }) }), _jsxs("span", { className: "ds-file-upload__file-details", children: [href ? renderFileLink(file, nameNode) : nameNode, hasUploadFailed
|
|
22
|
+
? (_jsxs("span", { className: "ds-file-upload__upload-failed", children: [_jsx(Icon, { name: "circle-alert" }), ' ', "Upload failed"] }))
|
|
23
|
+
: _jsx("span", { className: "ds-file-upload__file-meta", children: href ?? `${fileType}, ${fileSize}` })] }), href && (_jsx(Button, { variant: "secondary", isRound: true, onClick: () => navigator.clipboard.writeText(href), children: _jsx(Icon, { name: "copy", screenReaderText: "Copy link" }) })), href && onEditFile && onEdit && (_jsx(Button, { variant: "secondary", isRound: true, onClick: () => onEditFile(index), children: _jsx(Icon, { name: "pencil", screenReaderText: "Edit link" }) })), onDownload && (_jsx(Button, { variant: "secondary", isRound: true, onClick: onDownload, children: _jsx(Icon, { name: "download", screenReaderText: "Download file" }) })), onDelete && (_jsx(Button, { variant: "secondary", isRound: true, onClick: onDelete, children: _jsx(Icon, { name: "trash", screenReaderText: href ? 'Delete link' : 'Delete file' }) }))] }), typeof progressPercentage === 'number' && progressPercentage < 100
|
|
24
|
+
&& (_jsx(Progress, { value: progressPercentage, className: "ds-file-upload__progress-bar", "aria-label": "Upload progress bar", indicatorClassName: classNames('ds-file-upload__progress-bar-indicator', {
|
|
25
|
+
'ds-file-upload__progress-bar-indicator--failed': hasUploadFailed,
|
|
26
|
+
}) })), index < uploadedFiles.length - 1 && _jsx(Separator, {})] }, fileName));
|
|
27
|
+
}) }));
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=FileList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileList.js","sourceRoot":"","sources":["../../../src/components/fileUpload/FileList.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,sB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W,EACnB,OAAO,QACP,OAAO,EAAE,QAAQ,YAEjB,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,EAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,aAAa,GAAI,GACtE,CACV,IACI,EACN,OAAO,kBAAkB,KAAK,QAAQ,IAAI,kBAAkB,GAAG,GAAG;2BAC9D,CACD,KAAC,QAAQ,IACP,KAAK,EAAE,kBAAkB,EACzB,SAAS,EAAC,8BAA8B,gBAC7B,qBAAqB,EAChC,kBAAkB,EAAE,UAAU,CAAC,wCAAwC,EAAE;gCACvE,gDAAgD,EAAE,eAAe;6BAClE,CAAC,GACF,CACH,EACF,KAAK,GAAG,aAAa,CAAC,MAAM,GAAG,CAAC,IAAI,KAAC,SAAS,KAAG,KAnE1C,QAAQ,CAoEZ,CACP,CAAC;QACJ,CAAC,CAAC,GACG,CACR,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: (props: import("./FileList.js").FileListProps) => import("react").JSX.Element;
|
|
5
|
+
tags: string[];
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: string;
|
|
8
|
+
docs: {
|
|
9
|
+
description: {
|
|
10
|
+
component: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
argTypes: {
|
|
15
|
+
uploadedFiles: {
|
|
16
|
+
description: string;
|
|
17
|
+
control: false;
|
|
18
|
+
table: {
|
|
19
|
+
type: {
|
|
20
|
+
summary: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
onEditFile: {
|
|
25
|
+
description: string;
|
|
26
|
+
control: false;
|
|
27
|
+
table: {
|
|
28
|
+
type: {
|
|
29
|
+
summary: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
args: {
|
|
35
|
+
uploadedFiles: never[];
|
|
36
|
+
onEditFile: import("vitest").Mock<(...args: any[]) => any>;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export default meta;
|
|
40
|
+
type Story = StoryObj<typeof meta>;
|
|
41
|
+
export declare const Default: Story;
|
|
42
|
+
export declare const WithLinks: Story;
|
|
43
|
+
export declare const UploadInProgress: Story;
|
|
44
|
+
export declare const FailedUpload: Story;
|
|
45
|
+
//# sourceMappingURL=FileList.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileList.stories.d.ts","sourceRoot":"","sources":["../../../src/components/fileUpload/FileList.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAI5D,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCuB,CAAC;AAElC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAmBrB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAiBvB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAY9B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAa1B,CAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { fn } from 'storybook/test';
|
|
2
|
+
import { FileList } from './FileList.js';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Components/FileUpload/FileList',
|
|
5
|
+
component: FileList,
|
|
6
|
+
tags: ['autodocs'],
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'padded',
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component: 'Renders the list of files and links attached to a `FileUpload`. Use it on its own when the list is shown without the dropzone.',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
argTypes: {
|
|
16
|
+
uploadedFiles: {
|
|
17
|
+
description: 'Files and links to display. Each entry is an `UploadedFile`. Rows with an `href` render as links.',
|
|
18
|
+
control: false,
|
|
19
|
+
table: {
|
|
20
|
+
type: { summary: 'UploadedFile[]' },
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
onEditFile: {
|
|
24
|
+
description: 'Called with the row index when the Edit link button is clicked. The button only renders for link rows that also provide `onEdit`.',
|
|
25
|
+
control: false,
|
|
26
|
+
table: {
|
|
27
|
+
type: { summary: '(index: number) => void' },
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
args: {
|
|
32
|
+
uploadedFiles: [],
|
|
33
|
+
onEditFile: fn(),
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
export default meta;
|
|
37
|
+
export const Default = {
|
|
38
|
+
args: {
|
|
39
|
+
uploadedFiles: [
|
|
40
|
+
{
|
|
41
|
+
fileName: 'spring-term-report-2024.pdf',
|
|
42
|
+
fileType: 'PDF',
|
|
43
|
+
fileSize: '1.2 MB',
|
|
44
|
+
onDownload: fn(),
|
|
45
|
+
onDelete: fn(),
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
fileName: 'attendance-summary-jan.xlsx',
|
|
49
|
+
fileType: 'XLSX',
|
|
50
|
+
fileSize: '348 KB',
|
|
51
|
+
onDownload: fn(),
|
|
52
|
+
onDelete: fn(),
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
export const WithLinks = {
|
|
58
|
+
args: {
|
|
59
|
+
uploadedFiles: [
|
|
60
|
+
{
|
|
61
|
+
fileName: 'Behaviour policy',
|
|
62
|
+
href: 'https://example.com/behaviour-policy',
|
|
63
|
+
onEdit: fn(),
|
|
64
|
+
onDelete: fn(),
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
fileName: 'Pastoral handbook',
|
|
68
|
+
href: 'https://example.com/pastoral-handbook',
|
|
69
|
+
onEdit: fn(),
|
|
70
|
+
onDelete: fn(),
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
export const UploadInProgress = {
|
|
76
|
+
args: {
|
|
77
|
+
uploadedFiles: [
|
|
78
|
+
{
|
|
79
|
+
fileName: 'year-7-photo-day.zip',
|
|
80
|
+
fileType: 'ZIP',
|
|
81
|
+
fileSize: '48 MB',
|
|
82
|
+
progressPercentage: 45,
|
|
83
|
+
onDelete: fn(),
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
export const FailedUpload = {
|
|
89
|
+
args: {
|
|
90
|
+
uploadedFiles: [
|
|
91
|
+
{
|
|
92
|
+
fileName: 'year-7-photo-day.zip',
|
|
93
|
+
fileType: 'ZIP',
|
|
94
|
+
fileSize: '48 MB',
|
|
95
|
+
progressPercentage: 45,
|
|
96
|
+
hasUploadFailed: true,
|
|
97
|
+
onDelete: fn(),
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=FileList.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileList.stories.js","sourceRoot":"","sources":["../../../src/components/fileUpload/FileList.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,IAAI,GAAG;IACX,KAAK,EAAE,gCAAgC;IACvC,SAAS,EAAE,QAAQ;IACnB,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,UAAU,EAAE;QACV,MAAM,EAAE,QAAQ;QAChB,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX,SAAS,EAAE,gIAAgI;aAC5I;SACF;KACF;IACD,QAAQ,EAAE;QACR,aAAa,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E;YACb;gBACE,QAAQ,EAAE,sBAAsB;gBAChC,QAAQ,EAAE,KAAK;gBACf,QAAQ,EAAE,OAAO;gBACjB,kBAAkB,EAAE,EAAE;gBACtB,QAAQ,EAAE,EAAE,EAAE;aACf;SACF;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAU;IACjC,IAAI,EAAE;QACJ,aAAa,EAAE;YACb;gBACE,QAAQ,EAAE,sBAAsB;gBAChC,QAAQ,EAAE,KAAK;gBACf,QAAQ,EAAE,OAAO;gBACjB,kBAAkB,EAAE,EAAE;gBACtB,eAAe,EAAE,IAAI;gBACrB,QAAQ,EAAE,EAAE,EAAE;aACf;SACF;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileList.test.d.ts","sourceRoot":"","sources":["../../../src/components/fileUpload/FileList.test.tsx"],"names":[],"mappings":"AAGA,OAAO,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { describe, expect, test, vi } from 'vitest';
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import userEvent from '@testing-library/user-event';
|
|
5
|
+
import '@testing-library/jest-dom/vitest';
|
|
6
|
+
import { FileList } from './FileList.js';
|
|
7
|
+
const baseFile = {
|
|
8
|
+
fileName: 'report.pdf',
|
|
9
|
+
fileType: 'PDF',
|
|
10
|
+
fileSize: '1.2 MB',
|
|
11
|
+
};
|
|
12
|
+
const linkFile = {
|
|
13
|
+
fileName: 'Pastoral policy',
|
|
14
|
+
href: 'https://example.com/policy',
|
|
15
|
+
};
|
|
16
|
+
describe('FileList', () => {
|
|
17
|
+
describe('file rows', () => {
|
|
18
|
+
test('renders file name with type and size', () => {
|
|
19
|
+
render(_jsx(FileList, { uploadedFiles: [baseFile] }));
|
|
20
|
+
expect(screen.getByText('report.pdf')).toBeInTheDocument();
|
|
21
|
+
expect(screen.getByText('PDF, 1.2 MB')).toBeInTheDocument();
|
|
22
|
+
});
|
|
23
|
+
test('renders every file in the list', () => {
|
|
24
|
+
render(_jsx(FileList, { uploadedFiles: [
|
|
25
|
+
baseFile,
|
|
26
|
+
{ fileName: 'photo.jpg', fileType: 'JPEG', fileSize: '3.7 MB' },
|
|
27
|
+
] }));
|
|
28
|
+
expect(screen.getByText('report.pdf')).toBeInTheDocument();
|
|
29
|
+
expect(screen.getByText('photo.jpg')).toBeInTheDocument();
|
|
30
|
+
});
|
|
31
|
+
test('does not render a link for file rows', () => {
|
|
32
|
+
render(_jsx(FileList, { uploadedFiles: [baseFile] }));
|
|
33
|
+
expect(screen.queryByRole('link')).not.toBeInTheDocument();
|
|
34
|
+
});
|
|
35
|
+
test('shows Upload failed in place of the file meta', () => {
|
|
36
|
+
render(_jsx(FileList, { uploadedFiles: [{ ...baseFile, hasUploadFailed: true }] }));
|
|
37
|
+
expect(screen.getByText('Upload failed')).toBeInTheDocument();
|
|
38
|
+
expect(screen.queryByText('PDF, 1.2 MB')).not.toBeInTheDocument();
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
describe('link rows', () => {
|
|
42
|
+
test('renders the name as an anchor opening in a new tab with the href as meta', () => {
|
|
43
|
+
render(_jsx(FileList, { uploadedFiles: [linkFile] }));
|
|
44
|
+
const anchor = screen.getByRole('link', { name: 'Pastoral policy' });
|
|
45
|
+
expect(anchor).toHaveAttribute('href', 'https://example.com/policy');
|
|
46
|
+
expect(anchor).toHaveAttribute('target', '_blank');
|
|
47
|
+
expect(anchor).toHaveAttribute('rel', 'noopener noreferrer');
|
|
48
|
+
expect(screen.getByText('https://example.com/policy')).toBeInTheDocument();
|
|
49
|
+
});
|
|
50
|
+
test('merges linkProps onto the anchor', () => {
|
|
51
|
+
render(_jsx(FileList, { uploadedFiles: [{ ...linkFile, linkProps: { target: '_self' } }] }));
|
|
52
|
+
expect(screen.getByRole('link', { name: 'Pastoral policy' })).toHaveAttribute('target', '_self');
|
|
53
|
+
});
|
|
54
|
+
test('passes href, className and children to renderLink', () => {
|
|
55
|
+
const renderLink = vi.fn(({ href, className, children }) => (_jsx("a", { href: href, className: className, children: children })));
|
|
56
|
+
render(_jsx(FileList, { uploadedFiles: [{ ...linkFile, renderLink }] }));
|
|
57
|
+
expect(renderLink).toHaveBeenCalledWith(expect.objectContaining({
|
|
58
|
+
href: 'https://example.com/policy',
|
|
59
|
+
className: 'ds-file-upload__file-link',
|
|
60
|
+
}));
|
|
61
|
+
expect(screen.getByRole('link', { name: 'Pastoral policy' })).toBeInTheDocument();
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
describe('progress', () => {
|
|
65
|
+
test('shows an accessible progress bar while the upload is in progress', () => {
|
|
66
|
+
render(_jsx(FileList, { uploadedFiles: [{ ...baseFile, progressPercentage: 40 }] }));
|
|
67
|
+
expect(screen.getByRole('progressbar', { name: 'Upload progress bar' })).toBeInTheDocument();
|
|
68
|
+
});
|
|
69
|
+
test('hides the progress bar once progressPercentage reaches 100', () => {
|
|
70
|
+
render(_jsx(FileList, { uploadedFiles: [{ ...baseFile, progressPercentage: 100 }] }));
|
|
71
|
+
expect(screen.queryByRole('progressbar')).not.toBeInTheDocument();
|
|
72
|
+
});
|
|
73
|
+
test('hides the progress bar when progressPercentage is not set', () => {
|
|
74
|
+
render(_jsx(FileList, { uploadedFiles: [baseFile] }));
|
|
75
|
+
expect(screen.queryByRole('progressbar')).not.toBeInTheDocument();
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
describe('actions', () => {
|
|
79
|
+
test('calls onDelete from the Delete file button', async () => {
|
|
80
|
+
const onDelete = vi.fn();
|
|
81
|
+
render(_jsx(FileList, { uploadedFiles: [{ ...baseFile, onDelete }] }));
|
|
82
|
+
await userEvent.click(screen.getByRole('button', { name: 'Delete file' }));
|
|
83
|
+
expect(onDelete).toHaveBeenCalledOnce();
|
|
84
|
+
});
|
|
85
|
+
test('labels the delete button Delete link for link rows', () => {
|
|
86
|
+
render(_jsx(FileList, { uploadedFiles: [{ ...linkFile, onDelete: vi.fn() }] }));
|
|
87
|
+
expect(screen.getByRole('button', { name: 'Delete link' })).toBeInTheDocument();
|
|
88
|
+
});
|
|
89
|
+
test('calls onDownload from the Download file button', async () => {
|
|
90
|
+
const onDownload = vi.fn();
|
|
91
|
+
render(_jsx(FileList, { uploadedFiles: [{ ...baseFile, onDownload }] }));
|
|
92
|
+
await userEvent.click(screen.getByRole('button', { name: 'Download file' }));
|
|
93
|
+
expect(onDownload).toHaveBeenCalledOnce();
|
|
94
|
+
});
|
|
95
|
+
test('does not render a Download file button without onDownload', () => {
|
|
96
|
+
render(_jsx(FileList, { uploadedFiles: [baseFile] }));
|
|
97
|
+
expect(screen.queryByRole('button', { name: 'Download file' })).not.toBeInTheDocument();
|
|
98
|
+
});
|
|
99
|
+
test('copies the href to the clipboard for link rows', async () => {
|
|
100
|
+
const user = userEvent.setup();
|
|
101
|
+
render(_jsx(FileList, { uploadedFiles: [linkFile] }));
|
|
102
|
+
await user.click(screen.getByRole('button', { name: 'Copy link' }));
|
|
103
|
+
expect(await navigator.clipboard.readText()).toBe('https://example.com/policy');
|
|
104
|
+
});
|
|
105
|
+
test('does not render a Copy link button for file rows', () => {
|
|
106
|
+
render(_jsx(FileList, { uploadedFiles: [baseFile] }));
|
|
107
|
+
expect(screen.queryByRole('button', { name: 'Copy link' })).not.toBeInTheDocument();
|
|
108
|
+
});
|
|
109
|
+
test('calls onEditFile with the index of the edited link row', async () => {
|
|
110
|
+
const onEditFile = vi.fn();
|
|
111
|
+
render(_jsx(FileList, { uploadedFiles: [baseFile, { ...linkFile, onEdit: vi.fn() }], onEditFile: onEditFile }));
|
|
112
|
+
await userEvent.click(screen.getByRole('button', { name: 'Edit link' }));
|
|
113
|
+
expect(onEditFile).toHaveBeenCalledWith(1);
|
|
114
|
+
});
|
|
115
|
+
test('does not render an Edit link button without onEditFile', () => {
|
|
116
|
+
render(_jsx(FileList, { uploadedFiles: [{ ...linkFile, onEdit: vi.fn() }] }));
|
|
117
|
+
expect(screen.queryByRole('button', { name: 'Edit link' })).not.toBeInTheDocument();
|
|
118
|
+
});
|
|
119
|
+
test('does not render an Edit link button when the link has no onEdit', () => {
|
|
120
|
+
render(_jsx(FileList, { uploadedFiles: [linkFile], onEditFile: vi.fn() }));
|
|
121
|
+
expect(screen.queryByRole('button', { name: 'Edit link' })).not.toBeInTheDocument();
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
//# sourceMappingURL=FileList.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileList.test.js","sourceRoot":"","sources":["../../../src/components/fileUpload/FileList.test.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,SAAS,MAAM,6BAA6B,CAAC;AACpD,OAAO,kCAAkC,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAIzC,MAAM,QAAQ,GAAiB;IAC7B,QAAQ,EAAE,YAAY;IACtB,QAAQ,EAAE,KAAK;IACf,QAAQ,EAAE,QAAQ;CACnB,CAAC;AAEF,MAAM,QAAQ,GAAiB;IAC7B,QAAQ,EAAE,iBAAiB;IAC3B,IAAI,EAAE,4BAA4B;CACnC,CAAC;AAEF,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;QACzB,IAAI,CAAC,sCAAsC,EAAE,GAAG,EAAE;YAChD,MAAM,CAAC,KAAC,QAAQ,IAAC,aAAa,EAAE,CAAC,QAAQ,CAAC,GAAI,CAAC,CAAC;YAChD,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,EAAE,C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Name } from '../icon/allowedIcons.js';
|
|
|
2
2
|
import { type AnchorHTMLAttributes, type ReactElement, type ReactNode } from 'react';
|
|
3
3
|
import type { WidgetRenderLinkArgs } from '../widget/types.js';
|
|
4
4
|
import { type FileUploadLink } from './FileUploadLinkModal.js';
|
|
5
|
+
import { type FileListProps as ListProps } from './FileList.js';
|
|
5
6
|
export type { FileUploadLink };
|
|
6
7
|
type LinkAnchorProps = Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href' | 'className' | 'children'>;
|
|
7
|
-
type UploadedFile = {
|
|
8
|
+
export type UploadedFile = {
|
|
8
9
|
fileName: string;
|
|
9
10
|
icon?: IconName;
|
|
10
11
|
fileType?: string;
|
|
@@ -14,7 +15,7 @@ type UploadedFile = {
|
|
|
14
15
|
renderLink?: (args: WidgetRenderLinkArgs) => ReactElement;
|
|
15
16
|
onEdit?: (link: FileUploadLink) => void;
|
|
16
17
|
onDownload?: () => void;
|
|
17
|
-
onDelete
|
|
18
|
+
onDelete?: () => void;
|
|
18
19
|
progressPercentage?: number;
|
|
19
20
|
hasUploadFailed?: boolean;
|
|
20
21
|
};
|
|
@@ -25,5 +26,13 @@ export type FileUploadProps = {
|
|
|
25
26
|
dropzoneContent?: ReactNode;
|
|
26
27
|
onAddLink?: (link: FileUploadLink) => void;
|
|
27
28
|
};
|
|
28
|
-
export declare const FileUpload:
|
|
29
|
+
export declare const FileUpload: {
|
|
30
|
+
(props: FileUploadProps): import("react").JSX.Element;
|
|
31
|
+
FileList: (props: ListProps) => import("react").JSX.Element;
|
|
32
|
+
};
|
|
33
|
+
export declare namespace FileUpload {
|
|
34
|
+
type Props = FileUploadProps;
|
|
35
|
+
type FileListProps = ListProps;
|
|
36
|
+
type File = UploadedFile;
|
|
37
|
+
}
|
|
29
38
|
//# sourceMappingURL=FileUpload.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileUpload.d.ts","sourceRoot":"","sources":["../../../src/components/fileUpload/FileUpload.tsx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AAe,GAAG;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,WAAW,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;IACrC,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC;CAC5C,CAAC;AAIF,eAAO,MAAM,UAAU;YAAW,eAAe;;CAyGhD,CAAC;AAIF,yBAAiB,UAAU,CAAC;IAC1B,KAAY,KAAK,GAAG,eAAe,CAAC;IACpC,KAAY,aAAa,GAAG,SAAS,CAAC;IACtC,KAAY,IAAI,GAAG,YAAY,CAAC;CACjC"}
|
|
@@ -3,18 +3,10 @@ import classNames from 'classnames';
|
|
|
3
3
|
import { Button } from '../button/Button.js';
|
|
4
4
|
import { Card } from '../card/Card.js';
|
|
5
5
|
import { Icon } from '../icon/Icon.js';
|
|
6
|
-
import { Separator } from '../separator/Separator.js';
|
|
7
6
|
import { useState } from 'react';
|
|
8
7
|
import Dropzone from 'react-dropzone';
|
|
9
|
-
import { Progress } from '../progress/Progress.js';
|
|
10
8
|
import { FileUploadLinkModal } from './FileUploadLinkModal.js';
|
|
11
|
-
|
|
12
|
-
const className = 'ds-file-upload__file-link';
|
|
13
|
-
if (renderLink) {
|
|
14
|
-
return renderLink({ href, className, children, linkProps });
|
|
15
|
-
}
|
|
16
|
-
return (_jsx("a", { href: href, target: "_blank", rel: "noopener noreferrer", className: className, ...linkProps, children: children }));
|
|
17
|
-
};
|
|
9
|
+
import { FileList } from './FileList.js';
|
|
18
10
|
export const FileUpload = (props) => {
|
|
19
11
|
const { className, uploadedFiles, uploadFiles, onAddLink, } = props;
|
|
20
12
|
const [linkPopup, setLinkPopup] = useState(null);
|
|
@@ -24,25 +16,16 @@ export const FileUpload = (props) => {
|
|
|
24
16
|
setLinkPopup({ mode: 'add' });
|
|
25
17
|
}, children: "add a link" }), ' ', "or"] }))
|
|
26
18
|
: 'Drag and drop or' }), _jsx(Button, { variant: "secondary", children: "Browse files" })] }));
|
|
27
|
-
const
|
|
19
|
+
const fileToEdit = linkPopup?.mode === 'edit' ? uploadedFiles[linkPopup.index] : undefined;
|
|
28
20
|
return (_jsxs("div", { className: classNames('ds-file-upload', className), children: [_jsx(Dropzone, { onDrop: (acceptedFiles) => {
|
|
29
21
|
uploadFiles(acceptedFiles);
|
|
30
22
|
}, children: ({ getRootProps, getInputProps }) => (_jsx(Card, { children: _jsxs("div", { ...getRootProps(), className: "ds-file-upload__dropzone-input", children: [_jsx("input", { ...getInputProps({ 'aria-label': 'Upload files' }) }), _jsxs("div", { className: "ds-file-upload__dropzone-content", children: [_jsx("span", { className: "ds-file-upload__icon-wrapper", children: _jsx(Icon, { name: "cloud-upload", size: 24, color: "var(--color-brand-600)" }) }), _jsx("div", { className: "ds-file-upload__dropzone-text-wrapper", children: dropzoneContent })] })] }) })) }), linkPopup?.mode === 'add' && onAddLink && (_jsx(FileUploadLinkModal, { title: "Add URL attachment", submitLabel: "Add", onSubmit: (link) => {
|
|
31
23
|
onAddLink(link);
|
|
32
24
|
setLinkPopup(null);
|
|
33
|
-
}, onCancel: () => setLinkPopup(null) })),
|
|
34
|
-
|
|
25
|
+
}, onCancel: () => setLinkPopup(null) })), fileToEdit?.href && fileToEdit.onEdit && (_jsx(FileUploadLinkModal, { title: "Update URL attachment", submitLabel: "Update", initialLink: { url: fileToEdit.href, name: fileToEdit.fileName }, onSubmit: (link) => {
|
|
26
|
+
fileToEdit.onEdit?.(link);
|
|
35
27
|
setLinkPopup(null);
|
|
36
|
-
}, onCancel: () => setLinkPopup(null) })), uploadedFiles.length > 0 && (_jsx(
|
|
37
|
-
const { fileName, fileSize, fileType, href, onEdit, onDelete, onDownload, hasUploadFailed, progressPercentage, } = file;
|
|
38
|
-
const icon = file.icon ?? (href ? 'link' : 'file');
|
|
39
|
-
const nameNode = _jsx("span", { className: "ds-file-upload__file-name", children: fileName });
|
|
40
|
-
return (_jsxs("div", { className: "ds-file-upload__file-outer", children: [_jsxs("span", { className: "ds-file-upload__file", children: [_jsx("span", { className: "ds-file-upload__icon-wrapper", children: _jsx(Icon, { size: 24, name: icon, color: "var(--color-brand-600)" }) }), _jsxs("span", { className: "ds-file-upload__file-details", children: [href ? renderFileLink(file, nameNode) : nameNode, hasUploadFailed
|
|
41
|
-
? (_jsxs("span", { className: "ds-file-upload__upload-failed", children: [_jsx(Icon, { name: "circle-alert" }), ' ', "Upload failed"] }))
|
|
42
|
-
: _jsx("span", { className: "ds-file-upload__file-meta", children: href ?? `${fileType}, ${fileSize}` })] }), href && (_jsx(Button, { variant: "secondary", isRound: true, onClick: () => navigator.clipboard.writeText(href), children: _jsx(Icon, { name: "copy", screenReaderText: "Copy link" }) })), href && onEdit && (_jsx(Button, { variant: "secondary", isRound: true, onClick: () => setLinkPopup({ mode: 'edit', index }), children: _jsx(Icon, { name: "pencil", screenReaderText: "Edit link" }) })), onDownload && (_jsx(Button, { variant: "secondary", isRound: true, onClick: onDownload, children: _jsx(Icon, { name: "download", screenReaderText: "Download file" }) })), onDelete && (_jsx(Button, { variant: "secondary", isRound: true, onClick: onDelete, children: _jsx(Icon, { name: "trash", screenReaderText: href ? 'Delete link' : 'Delete file' }) }))] }), typeof progressPercentage === 'number' && progressPercentage < 100
|
|
43
|
-
&& (_jsx(Progress, { value: progressPercentage, className: "ds-file-upload__progress-bar", "aria-label": "Upload progress bar", indicatorClassName: classNames('ds-file-upload__progress-bar-indicator', {
|
|
44
|
-
'ds-file-upload__progress-bar-indicator--failed': hasUploadFailed,
|
|
45
|
-
}) })), index < uploadedFiles.length - 1 && _jsx(Separator, {})] }, fileName));
|
|
46
|
-
}) }))] }));
|
|
28
|
+
}, onCancel: () => setLinkPopup(null) })), uploadedFiles.length > 0 && (_jsx(FileList, { uploadedFiles: uploadedFiles, onEditFile: index => setLinkPopup({ mode: 'edit', index }) }))] }));
|
|
47
29
|
};
|
|
30
|
+
FileUpload.FileList = FileList;
|
|
48
31
|
//# sourceMappingURL=FileUpload.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileUpload.js","sourceRoot":"","sources":["../../../src/components/fileUpload/FileUpload.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"FileUpload.js","sourceRoot":"","sources":["../../../src/components/fileUpload/FileUpload.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAgE,MAAM,OAAO,CAAC;AAC/F,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,mBAAmB,EAAuB,MAAM,0BAA0B,CAAC;AACpF,OAAO,EAAE,QAAQ,EAAmC,MAAM,eAAe,CAAC;AA+B1E,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAsB,EAAE,EAAE;IACnD,MAAM,EACJ,SAAS,EACT,aAAa,EACb,WAAW,EACX,SAAS,GACV,GAAG,KAAK,CAAC;IAEV,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAiB,IAAI,CAAC,CAAC;IAEjE,MAAM,eAAe,GAAG,KAAK,CAAC,eAAe,IAAI,CAC/C,8BACE,sBACG,SAAS;oBACR,CAAC,CAAC,CACE,gDAEG,GAAG,EACJ,KAAC,MAAM,IACL,OAAO,EAAC,WAA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CAAC,IAAI,CAAC,CAAC;oBAChB,YAAY,CAAC,IAAI,CAAC,CAAC;gBACrB,CAAC,EACD,QAAQ,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,GAClC,CACH,EACA,UAAU,EAAE,IAAI,IAAI,UAAU,CAAC,MAAM,IAAI,CACxC,KAAC,mBAAmB,IAClB,KAAK,EAAC,uBAAuB,EAC7B,WAAW,EAAC,QAAQ,EACpB,WAAW,EAAE,EAAE,GAAG,EAAE,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,CAAC,QAAQ,EAAE,EAChE,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;oBACjB,UAAU,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC;oBAC1B,YAAY,CAAC,IAAI,CAAC,CAAC;gBACrB,CAAC,EACD,QAAQ,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,GAClC,CACH,EACA,aAAa,CAAC,MAAM,GAAG,CAAC,IAAI,CAC3B,KAAC,QAAQ,IACP,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAC1D,CACH,IACG,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,UAAU,CAAC,QAAQ,GAAG,QAAQ,CAAC"}
|
|
@@ -3,7 +3,10 @@ import type { FileUploadProps } from './FileUpload.js';
|
|
|
3
3
|
declare function FileUploadDocsPage(): import("react").JSX.Element;
|
|
4
4
|
declare const meta: {
|
|
5
5
|
title: string;
|
|
6
|
-
component:
|
|
6
|
+
component: {
|
|
7
|
+
(props: FileUploadProps): import("react").JSX.Element;
|
|
8
|
+
FileList: (props: import("./FileList.js").FileListProps) => import("react").JSX.Element;
|
|
9
|
+
};
|
|
7
10
|
tags: string[];
|
|
8
11
|
parameters: {
|
|
9
12
|
layout: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileUpload.stories.d.ts","sourceRoot":"","sources":["../../../src/components/fileUpload/FileUpload.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAe5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AA6GvD,iBAAS,kBAAkB,gCAmB1B;AAID,QAAA,MAAM,IAAI
|
|
1
|
+
{"version":3,"file":"FileUpload.stories.d.ts","sourceRoot":"","sources":["../../../src/components/fileUpload/FileUpload.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAe5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AA6GvD,iBAAS,kBAAkB,gCAmB1B;AAID,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwDyB,CAAC;AAEpC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAkDnC,eAAO,MAAM,OAAO,EAAE,KAcrB,CAAC;AAIF,eAAO,MAAM,iBAAiB,EAAE,KAsD/B,CAAC;AAIF,eAAO,MAAM,SAAS,EAAE,KA2DvB,CAAC;AAIF,eAAO,MAAM,UAAU,EAAE,KAgDxB,CAAC;AAIF,eAAO,MAAM,qBAAqB,EAAE,KA8DnC,CAAC;AAIF,eAAO,MAAM,gBAAgB,EAAE,KAmF9B,CAAC;AAIF,eAAO,MAAM,YAAY,EAAE,KAiE1B,CAAC;AAIF,eAAO,MAAM,kBAAkB,EAAE,KAuEhC,CAAC;AAIF,eAAO,MAAM,qBAAqB,EAAE,KAiDnC,CAAC;AA2FF,eAAO,MAAM,wBAAwB,EAAE,KAuGtC,CAAC"}
|