@synerise/ds-file-uploader 1.3.9 → 1.3.11

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 (67) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/AvatarUploader/AvatarUploader.d.ts +7 -8
  3. package/dist/AvatarUploader/AvatarUploader.js +78 -124
  4. package/dist/AvatarUploader/AvatarUploader.styles.d.ts +26 -27
  5. package/dist/AvatarUploader/AvatarUploader.styles.js +54 -70
  6. package/dist/AvatarUploader/FileViewAvatar/FileViewAvatar.const.d.ts +1 -2
  7. package/dist/AvatarUploader/FileViewAvatar/FileViewAvatar.const.js +14 -10
  8. package/dist/AvatarUploader/FileViewAvatar/FileViewAvatar.d.ts +2 -3
  9. package/dist/AvatarUploader/FileViewAvatar/FileViewAvatar.js +49 -90
  10. package/dist/AvatarUploader/FileViewAvatar/FileViewAvatar.styles.d.ts +16 -17
  11. package/dist/AvatarUploader/FileViewAvatar/FileViewAvatar.styles.js +69 -91
  12. package/dist/AvatarUploader/FileViewAvatar/FileViewAvatar.types.d.ts +2 -3
  13. package/dist/AvatarUploader/FileViewAvatar/FileViewAvatar.types.js +1 -1
  14. package/dist/AvatarUploader/FileViewAvatar/FileViewAvatar.util.d.ts +1 -2
  15. package/dist/AvatarUploader/FileViewAvatar/FileViewAvatar.util.js +6 -3
  16. package/dist/FileUploader.d.ts +6 -7
  17. package/dist/FileUploader.js +91 -146
  18. package/dist/FileUploader.styles.d.ts +26 -27
  19. package/dist/FileUploader.styles.js +58 -78
  20. package/dist/FileUploader.types.d.ts +2 -3
  21. package/dist/FileUploader.types.js +1 -1
  22. package/dist/FileView/FileView.const.d.ts +1 -2
  23. package/dist/FileView/FileView.const.js +24 -19
  24. package/dist/FileView/FileView.d.ts +2 -3
  25. package/dist/FileView/FileView.js +72 -138
  26. package/dist/FileView/FileView.styles.d.ts +17 -18
  27. package/dist/FileView/FileView.styles.js +65 -83
  28. package/dist/FileView/FileView.types.d.ts +2 -3
  29. package/dist/FileView/FileView.types.js +1 -1
  30. package/dist/ItemUploader/ItemUploader.d.ts +3 -4
  31. package/dist/ItemUploader/ItemUploader.js +73 -104
  32. package/dist/ItemUploader/ItemUploader.styles.d.ts +26 -27
  33. package/dist/ItemUploader/ItemUploader.styles.js +53 -71
  34. package/dist/ItemUploader/ItemUploader.types.d.ts +0 -1
  35. package/dist/ItemUploader/ItemUploader.types.js +1 -1
  36. package/dist/ItemUploader/UploaderButton/FileViewItem.const.d.ts +0 -1
  37. package/dist/ItemUploader/UploaderButton/FileViewItem.const.js +16 -11
  38. package/dist/ItemUploader/UploaderButton/FileViewItem.d.ts +2 -3
  39. package/dist/ItemUploader/UploaderButton/FileViewItem.js +38 -67
  40. package/dist/ItemUploader/UploaderButton/FileViewItem.styles.d.ts +12 -13
  41. package/dist/ItemUploader/UploaderButton/FileViewItem.styles.js +55 -74
  42. package/dist/index.d.ts +0 -1
  43. package/dist/index.js +19 -13
  44. package/dist/modules.d.js +1 -1
  45. package/dist/modules.d.ts +0 -0
  46. package/package.json +12 -12
  47. package/dist/AvatarUploader/AvatarUploader.d.ts.map +0 -1
  48. package/dist/AvatarUploader/AvatarUploader.styles.d.ts.map +0 -1
  49. package/dist/AvatarUploader/FileViewAvatar/FileViewAvatar.const.d.ts.map +0 -1
  50. package/dist/AvatarUploader/FileViewAvatar/FileViewAvatar.d.ts.map +0 -1
  51. package/dist/AvatarUploader/FileViewAvatar/FileViewAvatar.styles.d.ts.map +0 -1
  52. package/dist/AvatarUploader/FileViewAvatar/FileViewAvatar.types.d.ts.map +0 -1
  53. package/dist/AvatarUploader/FileViewAvatar/FileViewAvatar.util.d.ts.map +0 -1
  54. package/dist/FileUploader.d.ts.map +0 -1
  55. package/dist/FileUploader.styles.d.ts.map +0 -1
  56. package/dist/FileUploader.types.d.ts.map +0 -1
  57. package/dist/FileView/FileView.const.d.ts.map +0 -1
  58. package/dist/FileView/FileView.d.ts.map +0 -1
  59. package/dist/FileView/FileView.styles.d.ts.map +0 -1
  60. package/dist/FileView/FileView.types.d.ts.map +0 -1
  61. package/dist/ItemUploader/ItemUploader.d.ts.map +0 -1
  62. package/dist/ItemUploader/ItemUploader.styles.d.ts.map +0 -1
  63. package/dist/ItemUploader/ItemUploader.types.d.ts.map +0 -1
  64. package/dist/ItemUploader/UploaderButton/FileViewItem.const.d.ts.map +0 -1
  65. package/dist/ItemUploader/UploaderButton/FileViewItem.d.ts.map +0 -1
  66. package/dist/ItemUploader/UploaderButton/FileViewItem.styles.d.ts.map +0 -1
  67. package/dist/index.d.ts.map +0 -1
@@ -1,71 +1,53 @@
1
- var _excluded = ["className", "onUpload", "disabled", "accept", "error", "label", "onRemove", "description", "tooltip", "filesAmount", "mode", "removable", "files", "retry", "texts"];
2
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
4
- import React, { forwardRef, useCallback, useImperativeHandle, useState } from 'react';
5
- import { useDropzone } from 'react-dropzone';
6
- import { FormattedMessage } from 'react-intl';
7
- import { useTheme } from '@synerise/ds-core';
8
- import Icon, { AddM, FileUploadL, InfoFillS } from '@synerise/ds-icon';
9
- import Tooltip from '@synerise/ds-tooltip';
10
- import * as S from './FileUploader.styles';
11
- import FileView from './FileView/FileView';
1
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
+ import { forwardRef, useState, useCallback, useImperativeHandle } from "react";
3
+ import { useDropzone } from "react-dropzone";
4
+ import { FormattedMessage } from "react-intl";
5
+ import { useTheme } from "@synerise/ds-core";
6
+ import Icon, { InfoFillS, FileUploadL, AddM } from "@synerise/ds-icon";
7
+ import Tooltip from "@synerise/ds-tooltip";
8
+ import { Container, Label, DropAreaContainer, DropAreaButton, LargeDropAreaLabel, LargeDropAreaDescription, DropAreaLabel, ErrorMessage, Description } from "./FileUploader.styles.js";
9
+ import FileView from "./FileView/FileView.js";
12
10
  function readAsText(file) {
13
- return new Promise(function (resolve) {
14
- var reader = new FileReader();
15
- file.type !== 'text/plain' && resolve(null);
16
- reader.onerror = function () {
17
- return resolve(null);
18
- };
19
- reader.onload = function () {
20
- return resolve(reader.result);
21
- };
11
+ return new Promise((resolve) => {
12
+ const reader = new FileReader();
13
+ file.type !== "text/plain" && resolve(null);
14
+ reader.onerror = () => resolve(null);
15
+ reader.onload = () => resolve(reader.result);
22
16
  reader.readAsText(file);
23
17
  });
24
18
  }
25
- var FileUploader = /*#__PURE__*/forwardRef(function (_ref, ref) {
26
- var className = _ref.className,
27
- onUpload = _ref.onUpload,
28
- disabled = _ref.disabled,
29
- accept = _ref.accept,
30
- error = _ref.error,
31
- label = _ref.label,
32
- _onRemove = _ref.onRemove,
33
- description = _ref.description,
34
- tooltip = _ref.tooltip,
35
- filesAmount = _ref.filesAmount,
36
- _ref$mode = _ref.mode,
37
- mode = _ref$mode === void 0 ? 'single' : _ref$mode,
38
- _ref$removable = _ref.removable,
39
- removable = _ref$removable === void 0 ? true : _ref$removable,
40
- _ref$files = _ref.files,
41
- files = _ref$files === void 0 ? [] : _ref$files,
42
- retry = _ref.retry,
43
- texts = _ref.texts,
44
- rest = _objectWithoutPropertiesLoose(_ref, _excluded);
45
- var _useState = useState(true),
46
- uploadSuccess = _useState[0],
47
- setUploadSuccess = _useState[1];
48
- var theme = useTheme();
49
- var finalTexts = _extends({
50
- buttonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
51
- id: "DS.FILE-UPLOADER.BUTTON-LABEL",
52
- defaultMessage: "Upload file"
53
- }),
54
- buttonLabelLarge: /*#__PURE__*/React.createElement(FormattedMessage, {
55
- id: "DS.FILE-UPLOADER.BUTTON-LABEL-LARGE",
56
- defaultMessage: "Upload file"
57
- }),
58
- buttonDescription: /*#__PURE__*/React.createElement(FormattedMessage, {
59
- id: "DS.FILE-UPLOADER.BUTTON-DESC",
60
- defaultMessage: "Description"
61
- })
62
- }, texts);
63
- var readFilesContent = useCallback(function (addedFiles) {
64
- var readerPromises = addedFiles.map(function (file) {
19
+ const FileUploader = forwardRef(({
20
+ className,
21
+ onUpload,
22
+ disabled,
23
+ accept,
24
+ error,
25
+ label,
26
+ onRemove,
27
+ description,
28
+ tooltip,
29
+ filesAmount,
30
+ mode = "single",
31
+ removable = true,
32
+ files = [],
33
+ retry,
34
+ texts,
35
+ ...rest
36
+ }, ref) => {
37
+ const [uploadSuccess, setUploadSuccess] = useState(true);
38
+ const theme = useTheme();
39
+ const finalTexts = {
40
+ buttonLabel: /* @__PURE__ */ jsx(FormattedMessage, { id: "DS.FILE-UPLOADER.BUTTON-LABEL", defaultMessage: "Upload file" }),
41
+ buttonLabelLarge: /* @__PURE__ */ jsx(FormattedMessage, { id: "DS.FILE-UPLOADER.BUTTON-LABEL-LARGE", defaultMessage: "Upload file" }),
42
+ buttonDescription: /* @__PURE__ */ jsx(FormattedMessage, { id: "DS.FILE-UPLOADER.BUTTON-DESC", defaultMessage: "Description" }),
43
+ ...texts
44
+ };
45
+ const readFilesContent = useCallback((addedFiles) => {
46
+ const readerPromises = addedFiles.map((file) => {
65
47
  return readAsText(file);
66
48
  });
67
- Promise.all(readerPromises).then(function (filesContent) {
68
- var filesWithContent = addedFiles.map(function (file, index) {
49
+ Promise.all(readerPromises).then((filesContent) => {
50
+ const filesWithContent = addedFiles.map((file, index) => {
69
51
  return Object.assign(file, {
70
52
  content: filesContent[index]
71
53
  });
@@ -73,8 +55,8 @@ var FileUploader = /*#__PURE__*/forwardRef(function (_ref, ref) {
73
55
  onUpload && onUpload(filesWithContent);
74
56
  });
75
57
  }, [onUpload]);
76
- var onDrop = useCallback(function (acceptedFiles) {
77
- var possibleUpload = 0;
58
+ const onDrop = useCallback((acceptedFiles) => {
59
+ let possibleUpload = 0;
78
60
  if (filesAmount) {
79
61
  possibleUpload = filesAmount - files.length;
80
62
  }
@@ -85,91 +67,54 @@ var FileUploader = /*#__PURE__*/forwardRef(function (_ref, ref) {
85
67
  readFilesContent(acceptedFiles);
86
68
  }
87
69
  }, [filesAmount, files, setUploadSuccess, readFilesContent]);
88
- var _useDropzone = useDropzone({
89
- accept: accept ? accept.join(',') : undefined,
90
- multiple: mode !== 'single',
91
- onDrop: onDrop,
92
- disabled: disabled
93
- }),
94
- getRootProps = _useDropzone.getRootProps,
95
- getInputProps = _useDropzone.getInputProps,
96
- isDragActive = _useDropzone.isDragActive,
97
- open = _useDropzone.open,
98
- inputRef = _useDropzone.inputRef,
99
- rootRef = _useDropzone.rootRef;
100
- useImperativeHandle(ref, function () {
101
- return {
102
- open: open,
103
- inputRef: inputRef,
104
- rootRef: rootRef
105
- };
70
+ const {
71
+ getRootProps,
72
+ getInputProps,
73
+ isDragActive,
74
+ open,
75
+ inputRef,
76
+ rootRef
77
+ } = useDropzone({
78
+ accept: accept ? accept.join(",") : void 0,
79
+ multiple: mode !== "single",
80
+ onDrop,
81
+ disabled
106
82
  });
83
+ useImperativeHandle(ref, () => ({
84
+ open,
85
+ inputRef,
86
+ rootRef
87
+ }));
107
88
  if (filesAmount && filesAmount < 1) {
108
89
  filesAmount = 1;
109
90
  throw new Error('Invalid value of property "filesAmount" ');
110
91
  }
111
- var hasError = Boolean(error) || !uploadSuccess;
112
- var _useState2 = useState(false),
113
- pressed = _useState2[0],
114
- setPressed = _useState2[1];
115
- var errors = hasError && !uploadSuccess ? [error].concat('To many files uploaded') : [error];
116
- return /*#__PURE__*/React.createElement(S.Container, _extends({
117
- className: "ds-file-uploader " + (className || '')
118
- }, rest), label && /*#__PURE__*/React.createElement(S.Label, null, /*#__PURE__*/React.createElement("span", null, label), tooltip && /*#__PURE__*/React.createElement(Tooltip, {
119
- trigger: "hover",
120
- placement: "top",
121
- title: tooltip
122
- }, /*#__PURE__*/React.createElement("span", {
123
- "data-testid": "tooltip-info"
124
- }, /*#__PURE__*/React.createElement(Icon, {
125
- component: /*#__PURE__*/React.createElement(InfoFillS, null),
126
- size: 24
127
- })))), /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(S.DropAreaContainer, _extends({}, getRootProps(), {
128
- canUploadMore: mode !== 'single' && files.length > 0
129
- }), /*#__PURE__*/React.createElement("input", _extends({}, getInputProps(), {
130
- "data-testid": "droparea-input"
131
- })), /*#__PURE__*/React.createElement(S.DropAreaButton, {
132
- type: "button",
133
- hidden: !(mode !== 'single' && (filesAmount ? files.length < filesAmount : true) || files.length === 0),
134
- mode: mode,
135
- disabled: disabled,
136
- isDropping: isDragActive,
137
- hasError: hasError,
138
- onMouseDown: function onMouseDown() {
139
- return setPressed(true);
140
- },
141
- onMouseUp: function onMouseUp() {
142
- return setPressed(false);
143
- },
144
- pressed: pressed,
145
- "data-testid": "droparea",
146
- filesLength: files.length
147
- }, mode === 'multi-large' && files.length === 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Icon, {
148
- color: theme.palette['grey-800'],
149
- component: /*#__PURE__*/React.createElement(FileUploadL, null),
150
- size: 48
151
- }), /*#__PURE__*/React.createElement(S.LargeDropAreaLabel, null, finalTexts.buttonLabelLarge), /*#__PURE__*/React.createElement(S.LargeDropAreaDescription, null, finalTexts.buttonDescription)) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Icon, {
152
- color: theme.palette['grey-600'],
153
- component: /*#__PURE__*/React.createElement(AddM, null),
154
- size: 24
155
- }), /*#__PURE__*/React.createElement(S.DropAreaLabel, null, finalTexts.buttonLabel))))), files.length > 0 && files.map(function (file, index) {
156
- return /*#__PURE__*/React.createElement(FileView, {
157
- key: index,
158
- texts: texts,
159
- removable: removable,
160
- onRemove: function onRemove() {
161
- return _onRemove && _onRemove(file.file, index);
162
- },
163
- data: file,
164
- retry: retry,
165
- retryButtonProps: _extends({}, getRootProps())
166
- });
167
- }), hasError && errors && errors.map(function (errorText, index) {
168
- return /*#__PURE__*/React.createElement(S.ErrorMessage, {
169
- key: index
170
- }, errorText);
171
- }), description && /*#__PURE__*/React.createElement(S.Description, {
172
- hasError: hasError
173
- }, description));
92
+ const hasError = Boolean(error) || !uploadSuccess;
93
+ const [pressed, setPressed] = useState(false);
94
+ const errors = hasError && !uploadSuccess ? [error].concat("To many files uploaded") : [error];
95
+ return /* @__PURE__ */ jsxs(Container, { className: `ds-file-uploader ${className || ""}`, ...rest, children: [
96
+ label && /* @__PURE__ */ jsxs(Label, { children: [
97
+ /* @__PURE__ */ jsx("span", { children: label }),
98
+ tooltip && /* @__PURE__ */ jsx(Tooltip, { trigger: "hover", placement: "top", title: tooltip, children: /* @__PURE__ */ jsx("span", { "data-testid": "tooltip-info", children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(InfoFillS, {}), size: 24 }) }) })
99
+ ] }),
100
+ /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(DropAreaContainer, { ...getRootProps(), canUploadMore: mode !== "single" && files.length > 0, children: [
101
+ /* @__PURE__ */ jsx("input", { ...getInputProps(), "data-testid": "droparea-input" }),
102
+ /* @__PURE__ */ jsx(DropAreaButton, { type: "button", hidden: !(mode !== "single" && (filesAmount ? files.length < filesAmount : true) || files.length === 0), mode, disabled, isDropping: isDragActive, hasError, onMouseDown: () => setPressed(true), onMouseUp: () => setPressed(false), pressed, "data-testid": "droparea", filesLength: files.length, children: mode === "multi-large" && files.length === 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
103
+ /* @__PURE__ */ jsx(Icon, { color: theme.palette["grey-800"], component: /* @__PURE__ */ jsx(FileUploadL, {}), size: 48 }),
104
+ /* @__PURE__ */ jsx(LargeDropAreaLabel, { children: finalTexts.buttonLabelLarge }),
105
+ /* @__PURE__ */ jsx(LargeDropAreaDescription, { children: finalTexts.buttonDescription })
106
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
107
+ /* @__PURE__ */ jsx(Icon, { color: theme.palette["grey-600"], component: /* @__PURE__ */ jsx(AddM, {}), size: 24 }),
108
+ /* @__PURE__ */ jsx(DropAreaLabel, { children: finalTexts.buttonLabel })
109
+ ] }) })
110
+ ] }) }),
111
+ files.length > 0 && files.map((file, index) => /* @__PURE__ */ jsx(FileView, { texts, removable, onRemove: () => onRemove && onRemove(file.file, index), data: file, retry, retryButtonProps: {
112
+ ...getRootProps()
113
+ } }, index)),
114
+ hasError && errors && errors.map((errorText, index) => /* @__PURE__ */ jsx(ErrorMessage, { children: errorText }, index)),
115
+ description && /* @__PURE__ */ jsx(Description, { hasError, children: description })
116
+ ] });
174
117
  });
175
- export default FileUploader;
118
+ export {
119
+ FileUploader as default
120
+ };
@@ -1,33 +1,33 @@
1
- import { type StyledButton } from '@synerise/ds-button';
2
- export declare const Container: import("styled-components").StyledComponent<"div", any, {}, never>;
3
- export declare const Description: import("styled-components").StyledComponent<({ size, className, children, ellipsis, style, }: {
4
- size?: import("@synerise/ds-typography").TextSize;
5
- ellipsis?: import("@synerise/ds-typography/dist/Ellipsis").EllipsisProps;
6
- children?: import("react").ReactNode;
1
+ import { StyledButton } from '@synerise/ds-button';
2
+ export declare const Container: import('styled-components').StyledComponent<"div", any, {}, never>;
3
+ export declare const Description: import('styled-components').StyledComponent<({ size, className, children, ellipsis, style, }: {
4
+ size?: import('@synerise/ds-typography').TextSize;
5
+ ellipsis?: import('@synerise/ds-typography/dist/Ellipsis').EllipsisProps;
6
+ children?: import('react').ReactNode;
7
7
  className?: string;
8
- style?: import("react").CSSProperties;
8
+ style?: import('react').CSSProperties;
9
9
  }) => React.JSX.Element, any, {
10
10
  hasError?: boolean;
11
11
  }, never>;
12
- export declare const DropAreaContainer: import("styled-components").StyledComponent<"div", any, {
12
+ export declare const DropAreaContainer: import('styled-components').StyledComponent<"div", any, {
13
13
  canUploadMore: boolean;
14
14
  }, never>;
15
- export declare const DropAreaLabel: import("styled-components").StyledComponent<({ size, className, children, ellipsis, style, }: {
16
- size?: import("@synerise/ds-typography").TextSize;
17
- ellipsis?: import("@synerise/ds-typography/dist/Ellipsis").EllipsisProps;
18
- children?: import("react").ReactNode;
15
+ export declare const DropAreaLabel: import('styled-components').StyledComponent<({ size, className, children, ellipsis, style, }: {
16
+ size?: import('@synerise/ds-typography').TextSize;
17
+ ellipsis?: import('@synerise/ds-typography/dist/Ellipsis').EllipsisProps;
18
+ children?: import('react').ReactNode;
19
19
  className?: string;
20
- style?: import("react").CSSProperties;
20
+ style?: import('react').CSSProperties;
21
21
  }) => React.JSX.Element, any, {}, never>;
22
- export declare const LargeDropAreaLabel: import("styled-components").StyledComponent<"label", any, {}, never>;
23
- export declare const LargeDropAreaDescription: import("styled-components").StyledComponent<({ size, className, children, ellipsis, style, }: {
24
- size?: import("@synerise/ds-typography").TextSize;
25
- ellipsis?: import("@synerise/ds-typography/dist/Ellipsis").EllipsisProps;
26
- children?: import("react").ReactNode;
22
+ export declare const LargeDropAreaLabel: import('styled-components').StyledComponent<"label", any, {}, never>;
23
+ export declare const LargeDropAreaDescription: import('styled-components').StyledComponent<({ size, className, children, ellipsis, style, }: {
24
+ size?: import('@synerise/ds-typography').TextSize;
25
+ ellipsis?: import('@synerise/ds-typography/dist/Ellipsis').EllipsisProps;
26
+ children?: import('react').ReactNode;
27
27
  className?: string;
28
- style?: import("react").CSSProperties;
28
+ style?: import('react').CSSProperties;
29
29
  }) => React.JSX.Element, any, {}, never>;
30
- export declare const DropAreaButton: import("styled-components").StyledComponent<"button", any, {
30
+ export declare const DropAreaButton: import('styled-components').StyledComponent<"button", any, {
31
31
  isDropping?: boolean;
32
32
  hasError?: boolean;
33
33
  mode: string;
@@ -35,13 +35,12 @@ export declare const DropAreaButton: import("styled-components").StyledComponent
35
35
  filesLength: number;
36
36
  hidden: boolean;
37
37
  }, never>;
38
- export declare const ErrorMessage: import("styled-components").StyledComponent<({ size, className, children, ellipsis, style, }: {
39
- size?: import("@synerise/ds-typography").TextSize;
40
- ellipsis?: import("@synerise/ds-typography/dist/Ellipsis").EllipsisProps;
41
- children?: import("react").ReactNode;
38
+ export declare const ErrorMessage: import('styled-components').StyledComponent<({ size, className, children, ellipsis, style, }: {
39
+ size?: import('@synerise/ds-typography').TextSize;
40
+ ellipsis?: import('@synerise/ds-typography/dist/Ellipsis').EllipsisProps;
41
+ children?: import('react').ReactNode;
42
42
  className?: string;
43
- style?: import("react").CSSProperties;
43
+ style?: import('react').CSSProperties;
44
44
  }) => React.JSX.Element, any, {}, never>;
45
- export declare const Label: import("styled-components").StyledComponent<"label", any, {}, never>;
45
+ export declare const Label: import('styled-components').StyledComponent<"label", any, {}, never>;
46
46
  export declare const UploadButton: StyledButton;
47
- //# sourceMappingURL=FileUploader.styles.d.ts.map
@@ -1,99 +1,79 @@
1
- import styled, { css } from 'styled-components';
2
- import Button from '@synerise/ds-button';
3
- import { IconContainer } from '@synerise/ds-icon';
4
- import { Text, Label as TypographyLabel } from '@synerise/ds-typography';
5
- import { hexToRgba } from '@synerise/ds-utils';
6
- export var Container = styled.div.withConfig({
1
+ import styled, { css } from "styled-components";
2
+ import Button from "@synerise/ds-button";
3
+ import { IconContainer } from "@synerise/ds-icon";
4
+ import { Label as Label$1, Text } from "@synerise/ds-typography";
5
+ import { hexToRgba } from "@synerise/ds-utils";
6
+ const Container = /* @__PURE__ */ styled.div.withConfig({
7
7
  displayName: "FileUploaderstyles__Container",
8
8
  componentId: "sc-62r2x6-0"
9
9
  })(["width:100%;"]);
10
- export var Description = styled(Text).withConfig({
10
+ const Description = /* @__PURE__ */ styled(Text).withConfig({
11
11
  displayName: "FileUploaderstyles__Description",
12
12
  componentId: "sc-62r2x6-1"
13
- })(["&&{margin:", ";display:block;color:", ";}"], function (props) {
14
- return props.hasError ? '4px 0 8px' : '8px 0 8px';
15
- }, function (props) {
16
- return props.theme.palette['grey-500'];
17
- });
18
- export var DropAreaContainer = styled.div.withConfig({
13
+ })(["&&{margin:", ";display:block;color:", ";}"], (props) => props.hasError ? "4px 0 8px" : "8px 0 8px", (props) => props.theme.palette["grey-500"]);
14
+ const DropAreaContainer = /* @__PURE__ */ styled.div.withConfig({
19
15
  displayName: "FileUploaderstyles__DropAreaContainer",
20
16
  componentId: "sc-62r2x6-2"
21
- })(["width:100%;margin:", ";"], function (props) {
22
- return props.canUploadMore ? '12px 0 8px' : '0';
23
- });
24
- export var DropAreaLabel = styled(Text).withConfig({
17
+ })(["width:100%;margin:", ";"], (props) => props.canUploadMore ? "12px 0 8px" : "0");
18
+ const DropAreaLabel = /* @__PURE__ */ styled(Text).withConfig({
25
19
  displayName: "FileUploaderstyles__DropAreaLabel",
26
20
  componentId: "sc-62r2x6-3"
27
- })(["&&{color:", ";font-weight:500;}"], function (props) {
28
- return props.theme.palette['grey-600'];
29
- });
30
- export var LargeDropAreaLabel = styled(TypographyLabel).withConfig({
21
+ })(["&&{color:", ";font-weight:500;}"], (props) => props.theme.palette["grey-600"]);
22
+ const LargeDropAreaLabel = /* @__PURE__ */ styled(Label$1).withConfig({
31
23
  displayName: "FileUploaderstyles__LargeDropAreaLabel",
32
24
  componentId: "sc-62r2x6-4"
33
- })(["&&{font-size:14px;margin:4px 0 0;display:block;color:", ";}"], function (props) {
34
- return props.theme.palette['grey-800'];
35
- });
36
- export var LargeDropAreaDescription = styled(Text).withConfig({
25
+ })(["&&{font-size:14px;margin:4px 0 0;display:block;color:", ";}"], (props) => props.theme.palette["grey-800"]);
26
+ const LargeDropAreaDescription = /* @__PURE__ */ styled(Text).withConfig({
37
27
  displayName: "FileUploaderstyles__LargeDropAreaDescription",
38
28
  componentId: "sc-62r2x6-5"
39
- })(["&&{margin:4px 0 0;display:block;color:", ";}"], function (props) {
40
- return props.theme.palette['grey-600'];
41
- });
42
- export var DropAreaButton = styled.button.withConfig({
29
+ })(["&&{margin:4px 0 0;display:block;color:", ";}"], (props) => props.theme.palette["grey-600"]);
30
+ const DropAreaButton = /* @__PURE__ */ styled.button.withConfig({
43
31
  displayName: "FileUploaderstyles__DropAreaButton",
44
32
  componentId: "sc-62r2x6-6"
45
- })(["display:", ";align-items:center;border:1px dashed ", ";padding:11px 12px;border-radius:3px;cursor:pointer;background-color:transparent;width:100%;height:48px;transition:height 0.03s;", ";", ";", "{color:", ";}", " ", " &:hover:not(:disabled){background-color:", ";border-color:", ";", ",", "{color:", ";}", "{color:", ";}}&:disabled{background-color:", ";", "{color:", ";}}&&:active{color:", ";border-color:", ";background-color:", ";}&:focus:not(:active):not(:disabled){border-color:", ";background-color:", ";}&:disabled{span,", "{opacity:0.4;}}", ""], function (props) {
46
- return props.hidden ? 'none' : 'flex';
47
- }, function (props) {
48
- return props.theme.palette['grey-400'];
49
- }, function (props) {
50
- return props.mode === 'multi-large' && props.filesLength === 0 && "\n height: 160px;\n flex-direction: column;\n text-align: center;\n justify-content: center;\n ";
51
- }, function (props) {
52
- return props.mode !== 'multi-large' && "\n gap: 12px;\n ";
53
- }, IconContainer, function (props) {
54
- return props.theme.palette['grey-700'];
55
- }, function (props) {
56
- return props.hasError && "\n background-color: " + props.theme.palette['red-050'] + ";\n border-color: " + props.theme.palette['red-600'] + ";\n ";
57
- }, function (props) {
58
- return props.pressed && !props.disabled && css(["&&&:active,&&&{background-color:", ";}"], hexToRgba(props.theme.palette['grey-200'], 0.4));
59
- }, function (props) {
60
- return hexToRgba(props.theme.palette['grey-200'], 0.2);
61
- }, function (props) {
62
- return props.theme.palette['grey-400'];
63
- }, DropAreaLabel, LargeDropAreaLabel, function (props) {
64
- return props.theme.palette['grey-700'];
65
- }, IconContainer, function (props) {
66
- return props.theme.palette['grey-700'];
67
- }, function (props) {
68
- return props.theme.palette['grey-050'];
69
- }, LargeDropAreaLabel, function (props) {
70
- return props.theme.palette['grey-400'];
71
- }, function (props) {
72
- return props.theme.palette['red-400'];
73
- }, function (props) {
74
- return props.theme.palette['grey-400'];
75
- }, function (props) {
76
- return props.theme.palette['grey-050'];
77
- }, function (props) {
78
- return props.theme.palette['blue-600'];
79
- }, function (props) {
80
- return props.theme.palette['blue-050'];
81
- }, IconContainer, function (props) {
82
- return props.isDropping && !props.disabled && "\n height: " + (props.mode === 'multi-large' && props.filesLength === 0 ? '160px' : 'auto') + ";\n background-color: " + props.theme.palette['blue-050'] + " !important;\n border-color: " + props.theme.palette['blue-300'] + " !important;\n\n span, " + DropAreaLabel + ", " + LargeDropAreaLabel + ", " + LargeDropAreaDescription + " {\n color: " + props.theme.palette['blue-500'] + " !important;\n }\n\n " + IconContainer + " {\n color: " + props.theme.palette['blue-500'] + " !important;\n }\n ";
83
- });
84
- export var ErrorMessage = styled(Text).withConfig({
33
+ })(["display:", ";align-items:center;border:1px dashed ", ";padding:11px 12px;border-radius:3px;cursor:pointer;background-color:transparent;width:100%;height:48px;transition:height 0.03s;", ";", ";", "{color:", ";}", " ", " &:hover:not(:disabled){background-color:", ";border-color:", ";", ",", "{color:", ";}", "{color:", ";}}&:disabled{background-color:", ";", "{color:", ";}}&&:active{color:", ";border-color:", ";background-color:", ";}&:focus:not(:active):not(:disabled){border-color:", ";background-color:", ";}&:disabled{span,", "{opacity:0.4;}}", ""], (props) => props.hidden ? "none" : "flex", (props) => props.theme.palette["grey-400"], (props) => props.mode === "multi-large" && props.filesLength === 0 && `
34
+ height: 160px;
35
+ flex-direction: column;
36
+ text-align: center;
37
+ justify-content: center;
38
+ `, (props) => props.mode !== "multi-large" && `
39
+ gap: 12px;
40
+ `, IconContainer, (props) => props.theme.palette["grey-700"], (props) => props.hasError && `
41
+ background-color: ${props.theme.palette["red-050"]};
42
+ border-color: ${props.theme.palette["red-600"]};
43
+ `, (props) => props.pressed && !props.disabled && css(["&&&:active,&&&{background-color:", ";}"], hexToRgba(props.theme.palette["grey-200"], 0.4)), (props) => hexToRgba(props.theme.palette["grey-200"], 0.2), (props) => props.theme.palette["grey-400"], DropAreaLabel, LargeDropAreaLabel, (props) => props.theme.palette["grey-700"], IconContainer, (props) => props.theme.palette["grey-700"], (props) => props.theme.palette["grey-050"], LargeDropAreaLabel, (props) => props.theme.palette["grey-400"], (props) => props.theme.palette["red-400"], (props) => props.theme.palette["grey-400"], (props) => props.theme.palette["grey-050"], (props) => props.theme.palette["blue-600"], (props) => props.theme.palette["blue-050"], IconContainer, (props) => props.isDropping && !props.disabled && `
44
+ height: ${props.mode === "multi-large" && props.filesLength === 0 ? "160px" : "auto"};
45
+ background-color: ${props.theme.palette["blue-050"]} !important;
46
+ border-color: ${props.theme.palette["blue-300"]} !important;
47
+
48
+ span, ${DropAreaLabel}, ${LargeDropAreaLabel}, ${LargeDropAreaDescription} {
49
+ color: ${props.theme.palette["blue-500"]} !important;
50
+ }
51
+
52
+ ${IconContainer} {
53
+ color: ${props.theme.palette["blue-500"]} !important;
54
+ }
55
+ `);
56
+ const ErrorMessage = /* @__PURE__ */ styled(Text).withConfig({
85
57
  displayName: "FileUploaderstyles__ErrorMessage",
86
58
  componentId: "sc-62r2x6-7"
87
- })(["&&{margin:8px 0 0;display:block;color:", ";}"], function (props) {
88
- return props.theme.palette['red-600'];
89
- });
90
- export var Label = styled(TypographyLabel).withConfig({
59
+ })(["&&{margin:8px 0 0;display:block;color:", ";}"], (props) => props.theme.palette["red-600"]);
60
+ const Label = /* @__PURE__ */ styled(Label$1).withConfig({
91
61
  displayName: "FileUploaderstyles__Label",
92
62
  componentId: "sc-62r2x6-8"
93
- })(["&&{cursor:initial;margin:0 0 8px;display:flex;align-items:center;", "{color:", ";}}"], IconContainer, function (props) {
94
- return props.theme.palette['grey-400'];
95
- });
96
- export var UploadButton = styled(Button).withConfig({
63
+ })(["&&{cursor:initial;margin:0 0 8px;display:flex;align-items:center;", "{color:", ";}}"], IconContainer, (props) => props.theme.palette["grey-400"]);
64
+ const UploadButton = /* @__PURE__ */ styled(Button).withConfig({
97
65
  displayName: "FileUploaderstyles__UploadButton",
98
66
  componentId: "sc-62r2x6-9"
99
- })([""]);
67
+ })([""]);
68
+ export {
69
+ Container,
70
+ Description,
71
+ DropAreaButton,
72
+ DropAreaContainer,
73
+ DropAreaLabel,
74
+ ErrorMessage,
75
+ Label,
76
+ LargeDropAreaDescription,
77
+ LargeDropAreaLabel,
78
+ UploadButton
79
+ };
@@ -1,5 +1,5 @@
1
- import { type ReactNode, type RefObject } from 'react';
2
- import { type WithHTMLAttributes } from '@synerise/ds-utils';
1
+ import { ReactNode, RefObject } from 'react';
2
+ import { WithHTMLAttributes } from '@synerise/ds-utils';
3
3
  export type FileViewTexts = {
4
4
  size?: ReactNode;
5
5
  cancelText?: ReactNode;
@@ -55,4 +55,3 @@ export type FileUploaderRef = {
55
55
  rootRef: RefObject<HTMLElement>;
56
56
  };
57
57
  export {};
58
- //# sourceMappingURL=FileUploader.types.d.ts.map
@@ -1 +1 @@
1
- export {};
1
+
@@ -1,7 +1,6 @@
1
- import React from 'react';
1
+ import { default as React } from 'react';
2
2
  export declare const isPreviewableMimeType: (type: string) => type is FileType;
3
3
  type FileType = 'image/png' | 'image/gif' | 'image/jpeg' | 'image/svg+xml' | 'text/plain' | 'text/html' | 'video/quicktime' | 'application/pdf' | 'application/zip' | 'audio/mpeg' | 'application/vnd.ms-excel' | 'application/vnd.openxmlformats-officedocument.presentationml.presentation' | 'text/csv';
4
4
  export declare const previewableMimeTypes: FileType[];
5
5
  export declare const ICON_MAP: Record<FileType, React.ReactNode>;
6
6
  export {};
7
- //# sourceMappingURL=FileView.const.d.ts.map
@@ -1,21 +1,26 @@
1
- import React from 'react';
2
- import { FileTypeHtml, FileTypeImage, FileTypeMp3, FileTypePdf, FileTypePptx, FileTypeSvg, FileTypeTxt, FileTypeVideo, FileTypeXls, FileTypeZip } from '@synerise/ds-icon';
3
- export var isPreviewableMimeType = function isPreviewableMimeType(type) {
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { FileTypeTxt, FileTypePptx, FileTypeXls, FileTypeMp3, FileTypeVideo, FileTypeHtml, FileTypeZip, FileTypePdf, FileTypeSvg, FileTypeImage } from "@synerise/ds-icon";
3
+ const isPreviewableMimeType = (type) => {
4
4
  return previewableMimeTypes.includes(type);
5
5
  };
6
- export var previewableMimeTypes = ['image/png', 'image/gif', 'image/jpeg', 'image/svg+xml', 'text/plain', 'text/html', 'video/quicktime', 'application/pdf', 'application/zip', 'audio/mpeg', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'text/csv'];
7
- export var ICON_MAP = {
8
- 'image/png': /*#__PURE__*/React.createElement(FileTypeImage, null),
9
- 'image/gif': /*#__PURE__*/React.createElement(FileTypePdf, null),
10
- 'image/jpeg': /*#__PURE__*/React.createElement(FileTypeImage, null),
11
- 'image/svg+xml': /*#__PURE__*/React.createElement(FileTypeSvg, null),
12
- 'application/pdf': /*#__PURE__*/React.createElement(FileTypePdf, null),
13
- 'application/zip': /*#__PURE__*/React.createElement(FileTypeZip, null),
14
- 'text/plain': /*#__PURE__*/React.createElement(FileTypeTxt, null),
15
- 'text/html': /*#__PURE__*/React.createElement(FileTypeHtml, null),
16
- 'video/quicktime': /*#__PURE__*/React.createElement(FileTypeVideo, null),
17
- 'audio/mpeg': /*#__PURE__*/React.createElement(FileTypeMp3, null),
18
- 'application/vnd.ms-excel': /*#__PURE__*/React.createElement(FileTypeXls, null),
19
- 'application/vnd.openxmlformats-officedocument.presentationml.presentation': /*#__PURE__*/React.createElement(FileTypePptx, null),
20
- 'text/csv': /*#__PURE__*/React.createElement(FileTypeTxt, null)
21
- };
6
+ const previewableMimeTypes = ["image/png", "image/gif", "image/jpeg", "image/svg+xml", "text/plain", "text/html", "video/quicktime", "application/pdf", "application/zip", "audio/mpeg", "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.presentationml.presentation", "text/csv"];
7
+ const ICON_MAP = {
8
+ "image/png": /* @__PURE__ */ jsx(FileTypeImage, {}),
9
+ "image/gif": /* @__PURE__ */ jsx(FileTypePdf, {}),
10
+ "image/jpeg": /* @__PURE__ */ jsx(FileTypeImage, {}),
11
+ "image/svg+xml": /* @__PURE__ */ jsx(FileTypeSvg, {}),
12
+ "application/pdf": /* @__PURE__ */ jsx(FileTypePdf, {}),
13
+ "application/zip": /* @__PURE__ */ jsx(FileTypeZip, {}),
14
+ "text/plain": /* @__PURE__ */ jsx(FileTypeTxt, {}),
15
+ "text/html": /* @__PURE__ */ jsx(FileTypeHtml, {}),
16
+ "video/quicktime": /* @__PURE__ */ jsx(FileTypeVideo, {}),
17
+ "audio/mpeg": /* @__PURE__ */ jsx(FileTypeMp3, {}),
18
+ "application/vnd.ms-excel": /* @__PURE__ */ jsx(FileTypeXls, {}),
19
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation": /* @__PURE__ */ jsx(FileTypePptx, {}),
20
+ "text/csv": /* @__PURE__ */ jsx(FileTypeTxt, {})
21
+ };
22
+ export {
23
+ ICON_MAP,
24
+ isPreviewableMimeType,
25
+ previewableMimeTypes
26
+ };
@@ -1,5 +1,4 @@
1
- import React from 'react';
2
- import { type FileViewProps } from './FileView.types';
1
+ import { default as React } from 'react';
2
+ import { FileViewProps } from './FileView.types';
3
3
  declare const FileView: ({ data, texts, onRemove, removable, retry, retryButtonProps, }: FileViewProps) => React.JSX.Element;
4
4
  export default FileView;
5
- //# sourceMappingURL=FileView.d.ts.map