@arbor-education/design-system.components 0.25.4 → 0.25.5

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/components/fileUpload/FileUpload.d.ts +21 -0
  3. package/dist/components/fileUpload/FileUpload.d.ts.map +1 -0
  4. package/dist/components/fileUpload/FileUpload.js +23 -0
  5. package/dist/components/fileUpload/FileUpload.js.map +1 -0
  6. package/dist/components/fileUpload/FileUpload.stories.d.ts +71 -0
  7. package/dist/components/fileUpload/FileUpload.stories.d.ts.map +1 -0
  8. package/dist/components/fileUpload/FileUpload.stories.js +736 -0
  9. package/dist/components/fileUpload/FileUpload.stories.js.map +1 -0
  10. package/dist/components/fileUpload/FileUpload.test.d.ts +2 -0
  11. package/dist/components/fileUpload/FileUpload.test.d.ts.map +1 -0
  12. package/dist/components/fileUpload/FileUpload.test.js +99 -0
  13. package/dist/components/fileUpload/FileUpload.test.js.map +1 -0
  14. package/dist/components/formField/inputs/selectDropdown/SelectDropdown.js +1 -1
  15. package/dist/components/formField/inputs/selectDropdown/SelectDropdown.js.map +1 -1
  16. package/dist/components/formField/inputs/selectDropdown/SelectDropdown.stories.d.ts.map +1 -1
  17. package/dist/components/formField/inputs/selectDropdown/SelectDropdown.stories.js +14 -15
  18. package/dist/components/formField/inputs/selectDropdown/SelectDropdown.stories.js.map +1 -1
  19. package/dist/components/formField/inputs/selectDropdown/SelectDropdown.test.js +11 -0
  20. package/dist/components/formField/inputs/selectDropdown/SelectDropdown.test.js.map +1 -1
  21. package/dist/components/icon/allowedIcons.d.ts +1 -0
  22. package/dist/components/icon/allowedIcons.d.ts.map +1 -1
  23. package/dist/components/icon/allowedIcons.js +2 -1
  24. package/dist/components/icon/allowedIcons.js.map +1 -1
  25. package/dist/index.css +66 -0
  26. package/dist/index.css.map +1 -1
  27. package/dist/index.d.ts +1 -0
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +1 -0
  30. package/dist/index.js.map +1 -1
  31. package/package.json +2 -1
  32. package/src/components/button/button.scss +2 -0
  33. package/src/components/fileUpload/FileUpload.stories.tsx +920 -0
  34. package/src/components/fileUpload/FileUpload.test.tsx +172 -0
  35. package/src/components/fileUpload/FileUpload.tsx +144 -0
  36. package/src/components/fileUpload/fileUpload.scss +74 -0
  37. package/src/components/formField/inputs/selectDropdown/SelectDropdown.stories.tsx +15 -16
  38. package/src/components/formField/inputs/selectDropdown/SelectDropdown.test.tsx +19 -0
  39. package/src/components/formField/inputs/selectDropdown/SelectDropdown.tsx +1 -1
  40. package/src/components/icon/allowedIcons.tsx +2 -0
  41. package/src/components/progress/progress.scss +1 -0
  42. package/src/index.scss +1 -0
  43. package/src/index.ts +1 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.25.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#204](https://github.com/arbor-education/design-system.components/pull/204) [`f60819c`](https://github.com/arbor-education/design-system.components/commit/f60819c0ede5eb7cbd10b5fc2ab29d8023b23c3c) Thanks [@angusmglfraser](https://github.com/angusmglfraser)! - MIS-70686 ✨ file upload component
8
+
9
+ - [#225](https://github.com/arbor-education/design-system.components/pull/225) [`422167d`](https://github.com/arbor-education/design-system.components/commit/422167d8322f720a01c3c74e8a98f1a5189a0ed6) Thanks [@MarkFrancisArbor](https://github.com/MarkFrancisArbor)! - MIS-72151 display header value in the selectDropdown trigger
10
+
3
11
  ## 0.25.4
4
12
 
5
13
  ### Patch Changes
@@ -0,0 +1,21 @@
1
+ import type { IconName } from '../icon/allowedIcons.js';
2
+ import type { ReactNode } from 'react';
3
+ type UploadedFile = {
4
+ fileName: string;
5
+ icon?: IconName;
6
+ fileType: string;
7
+ fileSize: string;
8
+ onDownload?: () => void;
9
+ onDelete: () => void;
10
+ progressPercentage?: number;
11
+ hasUploadFailed?: boolean;
12
+ };
13
+ export type FileUploadProps = {
14
+ className?: string;
15
+ uploadedFiles: UploadedFile[];
16
+ uploadFiles: (files: File[]) => void;
17
+ dropzoneContent?: ReactNode;
18
+ };
19
+ export declare const FileUpload: (props: FileUploadProps) => import("react/jsx-runtime").JSX.Element;
20
+ export {};
21
+ //# sourceMappingURL=FileUpload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileUpload.d.ts","sourceRoot":"","sources":["../../../src/components/fileUpload/FileUpload.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAG7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,KAAK,YAAY,GAAG;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,eAAe,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;CAC7B,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,OAAO,eAAe,4CAmHhD,CAAC"}
@@ -0,0 +1,23 @@
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 { Separator } from '../separator/Separator.js';
7
+ import Dropzone from 'react-dropzone';
8
+ import { Progress } from '../progress/Progress.js';
9
+ export const FileUpload = (props) => {
10
+ const { className, uploadedFiles, uploadFiles, dropzoneContent = (_jsxs("p", { children: ["Drag and drop, or", ' ', _jsx(Button, { variant: "text-link", children: "click to upload" })] })), } = props;
11
+ return (_jsxs("div", { className: classNames('ds-file-upload', className), children: [_jsx(Dropzone, { onDrop: (acceptedFiles) => {
12
+ uploadFiles(acceptedFiles);
13
+ }, children: ({ getRootProps, getInputProps }) => (_jsx(Card, { children: _jsxs("div", { ...getRootProps(), className: "ds-file-upload__dropzone-input", children: [_jsx("input", { ...getInputProps() }), _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 })] })] }) })) }), uploadedFiles.length > 0 && (_jsx(Card, { className: "ds-file-upload__file-list", children: uploadedFiles.map((file, index) => {
14
+ const { fileName, icon = 'file', fileSize, fileType, onDelete, onDownload, hasUploadFailed, progressPercentage, } = file;
15
+ 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: [_jsx("span", { className: "ds-file-upload__file-name", children: fileName }), hasUploadFailed
16
+ ? (_jsxs("span", { className: "ds-file-upload__upload-failed", children: [_jsx(Icon, { name: "circle-alert" }), ' ', "Upload failed"] }))
17
+ : _jsx("span", { className: "ds-file-upload__file-meta", children: `${fileType}, ${fileSize}` })] }), onDownload && (_jsx(Button, { variant: "secondary", iconLeftName: "download", onClick: onDownload })), onDelete && (_jsx(Button, { variant: "secondary", iconLeftName: "trash", onClick: onDelete }))] }), typeof progressPercentage === 'number' && progressPercentage < 100
18
+ && (_jsx(Progress, { value: progressPercentage, className: "ds-file-upload__progress-bar", indicatorClassName: classNames('ds-file-upload__progress-bar-indicator', {
19
+ 'ds-file-upload__progress-bar-indicator--failed': hasUploadFailed,
20
+ }) })), index < uploadedFiles.length - 1 && _jsx(Separator, {})] }, fileName));
21
+ }) }))] }));
22
+ };
23
+ //# sourceMappingURL=FileUpload.js.map
@@ -0,0 +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,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAE3D,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAoBxD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAsB,EAAE,EAAE;IACnD,MAAM,EACJ,SAAS,EACT,aAAa,EACb,WAAW,EACX,eAAe,GAAG,CAChB,6CAEG,GAAG,EACJ,KAAC,MAAM,IAAC,OAAO,EAAC,WAAW,gCAAyB,IAClD,CACL,GACF,GAAG,KAAK,CAAC;IAEV,OAAO,CACL,eACE,SAAS,EAAE,UAAU,CACnB,gBAAgB,EAChB,SAAS,CACV,aAED,KAAC,QAAQ,IACP,MAAM,EAAE,CAAC,aAAa,EAAE,EAAE;oBACxB,WAAW,CAAC,aAAa,CAAC,CAAC;gBAC7B,CAAC,YAEA,CAAC,EAAE,YAAY,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,CACpC,KAAC,IAAI,cACH,kBACM,YAAY,EAAE,EAClB,SAAS,EAAC,gCAAgC,aAE1C,mBAAW,aAAa,EAAE,GAAI,EAC9B,eAAK,SAAS,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AW,EACnB,YAAY,EAAC,OAAO,EACpB,OAAO,EAAE,QAAQ,GACjB,CACH,IACI,EACN,OAAO,kBAAkB,KAAK,QAAQ,IAAI,kBAAkB,GAAG,GAAG;mCAC9D,CACD,KAAC,QAAQ,IACP,KAAK,EAAE,kBAAkB,EACzB,SAAS,EAAC,8BAA8B,EACxC,kBAAkB,EAAE,UAAU,CAAC,wCAAwC,EAAE;wCACvE,gDAAgD,EAAE,eAAe;qCAClE,CAAC,GACF,CACH,EACF,KAAK,GAAG,aAAa,CAAC,MAAM,GAAG,CAAC,IAAI,KAAC,SAAS,KAAG,KA5C1C,QAAQ,CA6CZ,CACP,CAAC;gBACJ,CAAC,CAAC,GACG,CACR,IACG,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,71 @@
1
+ import type { StoryObj } from '@storybook/react-vite';
2
+ import type { FileUploadProps } from './FileUpload.js';
3
+ declare function FileUploadDocsPage(): import("react/jsx-runtime").JSX.Element;
4
+ declare const meta: {
5
+ title: string;
6
+ component: (props: FileUploadProps) => import("react/jsx-runtime").JSX.Element;
7
+ tags: string[];
8
+ parameters: {
9
+ layout: string;
10
+ docs: {
11
+ page: typeof FileUploadDocsPage;
12
+ };
13
+ };
14
+ argTypes: {
15
+ uploadedFiles: {
16
+ description: string;
17
+ control: false;
18
+ table: {
19
+ type: {
20
+ summary: string;
21
+ };
22
+ };
23
+ };
24
+ uploadFiles: {
25
+ description: string;
26
+ control: false;
27
+ table: {
28
+ type: {
29
+ summary: string;
30
+ };
31
+ };
32
+ };
33
+ dropzoneContent: {
34
+ description: string;
35
+ control: false;
36
+ table: {
37
+ type: {
38
+ summary: string;
39
+ };
40
+ defaultValue: {
41
+ summary: string;
42
+ };
43
+ };
44
+ };
45
+ className: {
46
+ description: string;
47
+ control: "text";
48
+ table: {
49
+ type: {
50
+ summary: string;
51
+ };
52
+ };
53
+ };
54
+ };
55
+ args: {
56
+ uploadedFiles: never[];
57
+ uploadFiles: import("vitest").Mock<(...args: any[]) => any>;
58
+ };
59
+ };
60
+ export default meta;
61
+ type Story = StoryObj<typeof meta>;
62
+ export declare const Default: Story;
63
+ export declare const WithUploadedFiles: Story;
64
+ export declare const SingleFile: Story;
65
+ export declare const WithoutDownloadButton: Story;
66
+ export declare const UploadInProgress: Story;
67
+ export declare const FailedUpload: Story;
68
+ export declare const FailedDuringUpload: Story;
69
+ export declare const CustomDropzoneContent: Story;
70
+ export declare const SimulatedUploadLifecycle: Story;
71
+ //# sourceMappingURL=FileUpload.stories.d.ts.map
@@ -0,0 +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;AAc5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAyGvD,iBAAS,kBAAkB,4CAmB1B;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,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"}