@snack-uikit/attachment 0.1.28 → 0.1.29-preview-ba12ca94.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/dist/cjs/components/Attachment/Attachment.js +94 -0
- package/dist/cjs/components/Attachment/components/Emblem/Emblem.js +63 -0
- package/dist/cjs/components/Attachment/components/Emblem/index.js +25 -0
- package/dist/cjs/components/Attachment/components/index.js +25 -0
- package/dist/cjs/components/Attachment/index.js +25 -0
- package/dist/cjs/components/AttachmentSquare/AttachmentSquare.js +98 -0
- package/dist/cjs/components/AttachmentSquare/components/HoverContent/HoverContent.js +43 -0
- package/dist/cjs/components/AttachmentSquare/components/HoverContent/index.js +25 -0
- package/dist/cjs/components/AttachmentSquare/components/LoadingContent/LoadingContent.js +40 -0
- package/dist/cjs/components/AttachmentSquare/components/LoadingContent/index.js +25 -0
- package/dist/cjs/components/AttachmentSquare/components/MainContent/MainContent.js +60 -0
- package/dist/cjs/components/AttachmentSquare/components/MainContent/index.js +25 -0
- package/dist/cjs/components/AttachmentSquare/components/index.js +27 -0
- package/dist/cjs/components/AttachmentSquare/index.js +25 -0
- package/dist/cjs/components/index.js +26 -0
- package/dist/cjs/contexts.js +20 -0
- package/dist/cjs/helperComponents/Actions/Actions.js +88 -0
- package/dist/cjs/helperComponents/Actions/index.js +25 -0
- package/dist/cjs/helperComponents/Text/Text.js +40 -0
- package/dist/cjs/helperComponents/Text/index.js +25 -0
- package/dist/cjs/helperComponents/TextBlock/TextBlock.js +51 -0
- package/dist/cjs/helperComponents/TextBlock/index.js +25 -0
- package/dist/cjs/helperComponents/index.js +26 -0
- package/dist/cjs/helpers.js +25 -0
- package/dist/cjs/hooks.js +36 -0
- package/dist/cjs/index.js +25 -0
- package/dist/cjs/testIds.js +18 -0
- package/dist/cjs/types.js +5 -0
- package/dist/esm/components/Attachment/Attachment.d.ts +2 -0
- package/dist/esm/components/Attachment/components/Emblem/Emblem.d.ts +5 -0
- package/dist/esm/components/Attachment/components/Emblem/styled.module.css +15 -0
- package/dist/esm/components/Attachment/components/index.d.ts +1 -0
- package/dist/esm/components/Attachment/components/index.js +1 -0
- package/dist/esm/components/Attachment/index.js +1 -0
- package/dist/esm/components/Attachment/styles.module.css +15 -0
- package/dist/esm/components/AttachmentSquare/AttachmentSquare.d.ts +2 -0
- package/dist/esm/components/AttachmentSquare/components/HoverContent/HoverContent.d.ts +4 -0
- package/dist/esm/components/AttachmentSquare/components/HoverContent/index.js +1 -0
- package/dist/esm/components/AttachmentSquare/components/LoadingContent/LoadingContent.d.ts +1 -0
- package/dist/esm/components/AttachmentSquare/components/LoadingContent/index.js +1 -0
- package/dist/esm/components/AttachmentSquare/components/MainContent/MainContent.d.ts +6 -0
- package/dist/esm/components/AttachmentSquare/components/MainContent/index.js +1 -0
- package/dist/esm/components/AttachmentSquare/components/index.js +3 -0
- package/dist/esm/components/AttachmentSquare/components/styles.module.css +19 -0
- package/dist/esm/components/AttachmentSquare/index.js +1 -0
- package/dist/esm/components/AttachmentSquare/styles.module.css +28 -0
- package/dist/esm/components/index.js +2 -0
- package/dist/esm/contexts.d.ts +10 -0
- package/dist/esm/helperComponents/Actions/Actions.d.ts +7 -0
- package/dist/esm/helperComponents/Actions/index.js +1 -0
- package/dist/esm/helperComponents/Actions/styles.module.css +13 -0
- package/dist/esm/helperComponents/Text/Text.d.ts +7 -0
- package/dist/esm/helperComponents/Text/index.js +1 -0
- package/dist/esm/helperComponents/TextBlock/TextBlock.d.ts +5 -0
- package/dist/esm/helperComponents/TextBlock/index.js +1 -0
- package/dist/esm/helperComponents/TextBlock/styles.module.css +68 -0
- package/dist/esm/helperComponents/index.js +2 -0
- package/dist/esm/helpers.d.ts +3 -0
- package/dist/esm/hooks.d.ts +4 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/testIds.d.ts +11 -0
- package/dist/esm/types.d.ts +61 -0
- package/package.json +16 -12
- /package/dist/{components → cjs/components}/Attachment/Attachment.d.ts +0 -0
- /package/dist/{components → cjs/components}/Attachment/components/Emblem/Emblem.d.ts +0 -0
- /package/dist/{components → cjs/components}/Attachment/components/Emblem/index.d.ts +0 -0
- /package/dist/{components → cjs/components}/Attachment/components/Emblem/styled.module.css +0 -0
- /package/dist/{components → cjs/components}/Attachment/components/index.d.ts +0 -0
- /package/dist/{components → cjs/components}/Attachment/index.d.ts +0 -0
- /package/dist/{components → cjs/components}/Attachment/styles.module.css +0 -0
- /package/dist/{components → cjs/components}/AttachmentSquare/AttachmentSquare.d.ts +0 -0
- /package/dist/{components → cjs/components}/AttachmentSquare/components/HoverContent/HoverContent.d.ts +0 -0
- /package/dist/{components → cjs/components}/AttachmentSquare/components/HoverContent/index.d.ts +0 -0
- /package/dist/{components → cjs/components}/AttachmentSquare/components/LoadingContent/LoadingContent.d.ts +0 -0
- /package/dist/{components → cjs/components}/AttachmentSquare/components/LoadingContent/index.d.ts +0 -0
- /package/dist/{components → cjs/components}/AttachmentSquare/components/MainContent/MainContent.d.ts +0 -0
- /package/dist/{components → cjs/components}/AttachmentSquare/components/MainContent/index.d.ts +0 -0
- /package/dist/{components → cjs/components}/AttachmentSquare/components/index.d.ts +0 -0
- /package/dist/{components → cjs/components}/AttachmentSquare/components/styles.module.css +0 -0
- /package/dist/{components → cjs/components}/AttachmentSquare/index.d.ts +0 -0
- /package/dist/{components → cjs/components}/AttachmentSquare/styles.module.css +0 -0
- /package/dist/{components → cjs/components}/index.d.ts +0 -0
- /package/dist/{contexts.d.ts → cjs/contexts.d.ts} +0 -0
- /package/dist/{helperComponents → cjs/helperComponents}/Actions/Actions.d.ts +0 -0
- /package/dist/{helperComponents → cjs/helperComponents}/Actions/index.d.ts +0 -0
- /package/dist/{helperComponents → cjs/helperComponents}/Actions/styles.module.css +0 -0
- /package/dist/{helperComponents → cjs/helperComponents}/Text/Text.d.ts +0 -0
- /package/dist/{helperComponents → cjs/helperComponents}/Text/index.d.ts +0 -0
- /package/dist/{helperComponents → cjs/helperComponents}/TextBlock/TextBlock.d.ts +0 -0
- /package/dist/{helperComponents → cjs/helperComponents}/TextBlock/index.d.ts +0 -0
- /package/dist/{helperComponents → cjs/helperComponents}/TextBlock/styles.module.css +0 -0
- /package/dist/{helperComponents → cjs/helperComponents}/index.d.ts +0 -0
- /package/dist/{helpers.d.ts → cjs/helpers.d.ts} +0 -0
- /package/dist/{hooks.d.ts → cjs/hooks.d.ts} +0 -0
- /package/dist/{index.d.ts → cjs/index.d.ts} +0 -0
- /package/dist/{testIds.d.ts → cjs/testIds.d.ts} +0 -0
- /package/dist/{types.d.ts → cjs/types.d.ts} +0 -0
- /package/dist/{components → esm/components}/Attachment/Attachment.js +0 -0
- /package/dist/{components → esm/components}/Attachment/components/Emblem/Emblem.js +0 -0
- /package/dist/{components/Attachment/components/Emblem/index.js → esm/components/Attachment/components/Emblem/index.d.ts} +0 -0
- /package/dist/{components/Attachment/components → esm/components/Attachment/components/Emblem}/index.js +0 -0
- /package/dist/{components/Attachment/index.js → esm/components/Attachment/index.d.ts} +0 -0
- /package/dist/{components → esm/components}/AttachmentSquare/AttachmentSquare.js +0 -0
- /package/dist/{components → esm/components}/AttachmentSquare/components/HoverContent/HoverContent.js +0 -0
- /package/dist/{components/AttachmentSquare/components/HoverContent/index.js → esm/components/AttachmentSquare/components/HoverContent/index.d.ts} +0 -0
- /package/dist/{components → esm/components}/AttachmentSquare/components/LoadingContent/LoadingContent.js +0 -0
- /package/dist/{components/AttachmentSquare/components/LoadingContent/index.js → esm/components/AttachmentSquare/components/LoadingContent/index.d.ts} +0 -0
- /package/dist/{components → esm/components}/AttachmentSquare/components/MainContent/MainContent.js +0 -0
- /package/dist/{components/AttachmentSquare/components/MainContent/index.js → esm/components/AttachmentSquare/components/MainContent/index.d.ts} +0 -0
- /package/dist/{components/AttachmentSquare/components/index.js → esm/components/AttachmentSquare/components/index.d.ts} +0 -0
- /package/dist/{components/AttachmentSquare/index.js → esm/components/AttachmentSquare/index.d.ts} +0 -0
- /package/dist/{components/index.js → esm/components/index.d.ts} +0 -0
- /package/dist/{contexts.js → esm/contexts.js} +0 -0
- /package/dist/{helperComponents → esm/helperComponents}/Actions/Actions.js +0 -0
- /package/dist/{helperComponents/Actions/index.js → esm/helperComponents/Actions/index.d.ts} +0 -0
- /package/dist/{helperComponents → esm/helperComponents}/Text/Text.js +0 -0
- /package/dist/{helperComponents/Text/index.js → esm/helperComponents/Text/index.d.ts} +0 -0
- /package/dist/{helperComponents → esm/helperComponents}/TextBlock/TextBlock.js +0 -0
- /package/dist/{helperComponents/TextBlock/index.js → esm/helperComponents/TextBlock/index.d.ts} +0 -0
- /package/dist/{helperComponents/index.js → esm/helperComponents/index.d.ts} +0 -0
- /package/dist/{helpers.js → esm/helpers.js} +0 -0
- /package/dist/{hooks.js → esm/hooks.js} +0 -0
- /package/dist/{index.js → esm/index.js} +0 -0
- /package/dist/{testIds.js → esm/testIds.js} +0 -0
- /package/dist/{types.js → esm/types.js} +0 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
4
|
+
return mod && mod.__esModule ? mod : {
|
|
5
|
+
"default": mod
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
exports.Actions = Actions;
|
|
12
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
13
|
+
const button_1 = require("@snack-uikit/button");
|
|
14
|
+
const icons_1 = require("@snack-uikit/icons");
|
|
15
|
+
const contexts_1 = require("../../contexts");
|
|
16
|
+
const testIds_1 = require("../../testIds");
|
|
17
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
18
|
+
const noop = () => {};
|
|
19
|
+
function Actions(_ref) {
|
|
20
|
+
let {
|
|
21
|
+
hideDelete,
|
|
22
|
+
hideDownload,
|
|
23
|
+
hideRetry
|
|
24
|
+
} = _ref;
|
|
25
|
+
const {
|
|
26
|
+
onDelete,
|
|
27
|
+
onDownload,
|
|
28
|
+
file,
|
|
29
|
+
disabled,
|
|
30
|
+
onRetry
|
|
31
|
+
} = (0, contexts_1.useAttachmentContext)();
|
|
32
|
+
const {
|
|
33
|
+
setFocused = noop
|
|
34
|
+
} = (0, contexts_1.useAttachmentFocusActionsContext)();
|
|
35
|
+
const showDownload = onDownload && !hideDownload;
|
|
36
|
+
const showDelete = onDelete && !hideDelete;
|
|
37
|
+
const showRetry = onRetry && !hideRetry;
|
|
38
|
+
const handleFocus = () => {
|
|
39
|
+
setFocused(true);
|
|
40
|
+
};
|
|
41
|
+
const handleBlur = () => {
|
|
42
|
+
setFocused(false);
|
|
43
|
+
};
|
|
44
|
+
const handleRetry = e => {
|
|
45
|
+
onRetry === null || onRetry === void 0 ? void 0 : onRetry();
|
|
46
|
+
e.stopPropagation();
|
|
47
|
+
};
|
|
48
|
+
const handleDownload = e => {
|
|
49
|
+
onDownload === null || onDownload === void 0 ? void 0 : onDownload(file);
|
|
50
|
+
e.stopPropagation();
|
|
51
|
+
};
|
|
52
|
+
const handleDelete = e => {
|
|
53
|
+
onDelete === null || onDelete === void 0 ? void 0 : onDelete(file);
|
|
54
|
+
e.stopPropagation();
|
|
55
|
+
};
|
|
56
|
+
if (!showDownload && !showDelete) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
return (0, jsx_runtime_1.jsxs)("div", {
|
|
60
|
+
className: styles_module_scss_1.default.actions,
|
|
61
|
+
children: [showDownload && (0, jsx_runtime_1.jsx)(button_1.ButtonFunction, {
|
|
62
|
+
disabled: disabled,
|
|
63
|
+
size: 'xs',
|
|
64
|
+
icon: (0, jsx_runtime_1.jsx)(icons_1.DownloadSVG, {}),
|
|
65
|
+
onClick: handleDownload,
|
|
66
|
+
onFocus: handleFocus,
|
|
67
|
+
onBlur: handleBlur,
|
|
68
|
+
"data-test-id": testIds_1.TEST_IDS.downloadAction
|
|
69
|
+
}), showRetry && (0, jsx_runtime_1.jsx)(button_1.ButtonFunction, {
|
|
70
|
+
disabled: disabled,
|
|
71
|
+
size: 'xs',
|
|
72
|
+
icon: (0, jsx_runtime_1.jsx)(icons_1.UpdateSVG, {}),
|
|
73
|
+
onClick: handleRetry,
|
|
74
|
+
onFocus: handleFocus,
|
|
75
|
+
onBlur: handleBlur,
|
|
76
|
+
className: styles_module_scss_1.default.retryAction,
|
|
77
|
+
"data-test-id": testIds_1.TEST_IDS.retryAction
|
|
78
|
+
}), showDelete && (0, jsx_runtime_1.jsx)(button_1.ButtonFunction, {
|
|
79
|
+
disabled: disabled,
|
|
80
|
+
size: 'xs',
|
|
81
|
+
icon: (0, jsx_runtime_1.jsx)(icons_1.TrashSVG, {}),
|
|
82
|
+
onClick: handleDelete,
|
|
83
|
+
onFocus: handleFocus,
|
|
84
|
+
onBlur: handleBlur,
|
|
85
|
+
"data-test-id": testIds_1.TEST_IDS.deleteAction
|
|
86
|
+
})]
|
|
87
|
+
});
|
|
88
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return m[k];
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
} : function (o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
});
|
|
19
|
+
var __exportStar = void 0 && (void 0).__exportStar || function (m, exports) {
|
|
20
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
});
|
|
25
|
+
__exportStar(require("./Actions"), exports);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
4
|
+
var t = {};
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", {
|
|
12
|
+
value: true
|
|
13
|
+
});
|
|
14
|
+
exports.Text = Text;
|
|
15
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
const truncate_string_1 = require("@snack-uikit/truncate-string");
|
|
17
|
+
const utils_1 = require("@snack-uikit/utils");
|
|
18
|
+
const contexts_1 = require("../../contexts");
|
|
19
|
+
function Text(_a) {
|
|
20
|
+
var {
|
|
21
|
+
text,
|
|
22
|
+
className,
|
|
23
|
+
maxLines = 1
|
|
24
|
+
} = _a,
|
|
25
|
+
rest = __rest(_a, ["text", "className", "maxLines"]);
|
|
26
|
+
const {
|
|
27
|
+
truncateVariant
|
|
28
|
+
} = (0, contexts_1.useAttachmentContext)();
|
|
29
|
+
if (!text) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
return (0, jsx_runtime_1.jsx)("div", {
|
|
33
|
+
className: className,
|
|
34
|
+
children: (0, jsx_runtime_1.jsx)(truncate_string_1.TruncateString, Object.assign({
|
|
35
|
+
text: text,
|
|
36
|
+
maxLines: maxLines,
|
|
37
|
+
variant: truncateVariant
|
|
38
|
+
}, (0, utils_1.extractSupportProps)(rest)))
|
|
39
|
+
});
|
|
40
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return m[k];
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
} : function (o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
});
|
|
19
|
+
var __exportStar = void 0 && (void 0).__exportStar || function (m, exports) {
|
|
20
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
});
|
|
25
|
+
__exportStar(require("./Text"), exports);
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
4
|
+
return mod && mod.__esModule ? mod : {
|
|
5
|
+
"default": mod
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
exports.TextBlock = TextBlock;
|
|
12
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
13
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
14
|
+
const contexts_1 = require("../../contexts");
|
|
15
|
+
const testIds_1 = require("../../testIds");
|
|
16
|
+
const Text_1 = require("../Text");
|
|
17
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
18
|
+
function TextBlock(_ref) {
|
|
19
|
+
let {
|
|
20
|
+
title,
|
|
21
|
+
description,
|
|
22
|
+
error,
|
|
23
|
+
className,
|
|
24
|
+
align = 'left'
|
|
25
|
+
} = _ref;
|
|
26
|
+
const {
|
|
27
|
+
size,
|
|
28
|
+
truncate = {}
|
|
29
|
+
} = (0, contexts_1.useAttachmentContext)();
|
|
30
|
+
return (0, jsx_runtime_1.jsxs)("div", {
|
|
31
|
+
className: (0, classnames_1.default)(styles_module_scss_1.default.content, className),
|
|
32
|
+
"data-size": size,
|
|
33
|
+
"data-align": align,
|
|
34
|
+
children: [(0, jsx_runtime_1.jsx)(Text_1.Text, {
|
|
35
|
+
className: styles_module_scss_1.default.title,
|
|
36
|
+
text: title,
|
|
37
|
+
"data-test-id": testIds_1.TEST_IDS.title,
|
|
38
|
+
maxLines: truncate === null || truncate === void 0 ? void 0 : truncate.title
|
|
39
|
+
}), (0, jsx_runtime_1.jsx)(Text_1.Text, {
|
|
40
|
+
className: styles_module_scss_1.default.description,
|
|
41
|
+
text: description,
|
|
42
|
+
"data-test-id": testIds_1.TEST_IDS.description,
|
|
43
|
+
maxLines: truncate === null || truncate === void 0 ? void 0 : truncate.description
|
|
44
|
+
}), (0, jsx_runtime_1.jsx)(Text_1.Text, {
|
|
45
|
+
className: styles_module_scss_1.default.error,
|
|
46
|
+
text: error,
|
|
47
|
+
"data-test-id": testIds_1.TEST_IDS.error,
|
|
48
|
+
maxLines: truncate === null || truncate === void 0 ? void 0 : truncate.error
|
|
49
|
+
})]
|
|
50
|
+
});
|
|
51
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return m[k];
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
} : function (o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
});
|
|
19
|
+
var __exportStar = void 0 && (void 0).__exportStar || function (m, exports) {
|
|
20
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
});
|
|
25
|
+
__exportStar(require("./TextBlock"), exports);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return m[k];
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
} : function (o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
});
|
|
19
|
+
var __exportStar = void 0 && (void 0).__exportStar || function (m, exports) {
|
|
20
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
});
|
|
25
|
+
__exportStar(require("./Actions"), exports);
|
|
26
|
+
__exportStar(require("./TextBlock"), exports);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getBaseFileName = getBaseFileName;
|
|
7
|
+
exports.getFileExtension = getFileExtension;
|
|
8
|
+
exports.isFileImage = isFileImage;
|
|
9
|
+
function getBaseFileName(fileName) {
|
|
10
|
+
if (!fileName) {
|
|
11
|
+
return fileName;
|
|
12
|
+
}
|
|
13
|
+
const parts = fileName.split('.');
|
|
14
|
+
parts.pop();
|
|
15
|
+
// Для отображения названия файлов без имени (например, .bashrc, .gitignore)
|
|
16
|
+
if (parts.length === 1 && parts[0] === '') return fileName;
|
|
17
|
+
return parts.join('.');
|
|
18
|
+
}
|
|
19
|
+
function getFileExtension(fileName) {
|
|
20
|
+
var _a;
|
|
21
|
+
return (_a = fileName === null || fileName === void 0 ? void 0 : fileName.split('.').pop()) === null || _a === void 0 ? void 0 : _a.toLocaleUpperCase();
|
|
22
|
+
}
|
|
23
|
+
function isFileImage(file) {
|
|
24
|
+
return file.type.match(/image\/(png|jpg|jpeg|gif|webp|bmp|svg)/i);
|
|
25
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useImage = useImage;
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const helpers_1 = require("./helpers");
|
|
9
|
+
function useImage(file) {
|
|
10
|
+
const [imageData, setImageData] = (0, react_1.useState)(undefined);
|
|
11
|
+
const [loading, setIsLoading] = (0, react_1.useState)(false);
|
|
12
|
+
(0, react_1.useEffect)(() => {
|
|
13
|
+
if (file && (0, helpers_1.isFileImage)(file)) {
|
|
14
|
+
const reader = new FileReader();
|
|
15
|
+
reader.onloadstart = () => {
|
|
16
|
+
setIsLoading(true);
|
|
17
|
+
};
|
|
18
|
+
reader.onloadend = () => {
|
|
19
|
+
setIsLoading(false);
|
|
20
|
+
const {
|
|
21
|
+
result
|
|
22
|
+
} = reader;
|
|
23
|
+
if (result) {
|
|
24
|
+
setImageData(result.toString());
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
reader.readAsDataURL(file);
|
|
28
|
+
} else {
|
|
29
|
+
setImageData(undefined);
|
|
30
|
+
}
|
|
31
|
+
}, [file]);
|
|
32
|
+
return {
|
|
33
|
+
imageData,
|
|
34
|
+
loading
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return m[k];
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
} : function (o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
});
|
|
19
|
+
var __exportStar = void 0 && (void 0).__exportStar || function (m, exports) {
|
|
20
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
});
|
|
25
|
+
__exportStar(require("./components"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TEST_IDS = void 0;
|
|
7
|
+
const PREFIX = 'attachment';
|
|
8
|
+
exports.TEST_IDS = {
|
|
9
|
+
icon: `${PREFIX}__icon`,
|
|
10
|
+
image: `${PREFIX}__image`,
|
|
11
|
+
loading: `${PREFIX}__loading`,
|
|
12
|
+
retryAction: `${PREFIX}__retry-action`,
|
|
13
|
+
deleteAction: `${PREFIX}__delete-action`,
|
|
14
|
+
downloadAction: `${PREFIX}__download-action`,
|
|
15
|
+
title: `${PREFIX}__title`,
|
|
16
|
+
description: `${PREFIX}__description`,
|
|
17
|
+
error: `${PREFIX}__error`
|
|
18
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { AttachmentProps } from '../../types';
|
|
2
|
+
export declare function Attachment({ file, loading, icon, title: titleProp, description: descriptionProp, error, disabled, truncateVariant, checked, onDownload, onDelete, onClick, onRetry, size, truncate, className, ...rest }: AttachmentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { AttachmentProps } from '../../../../types';
|
|
2
|
+
export type EmblemProps = {
|
|
3
|
+
imageData?: string;
|
|
4
|
+
} & Pick<AttachmentProps, 'icon' | 'loading' | 'title'>;
|
|
5
|
+
export declare function Emblem({ loading, icon, imageData, title }: EmblemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
.img{
|
|
2
|
+
overflow:hidden;
|
|
3
|
+
flex-shrink:0;
|
|
4
|
+
box-sizing:border-box;
|
|
5
|
+
-o-object-fit:cover;
|
|
6
|
+
object-fit:cover;
|
|
7
|
+
}
|
|
8
|
+
.img[data-size=s]{
|
|
9
|
+
width:var(--size-attachment-start-item-s, 32px);
|
|
10
|
+
height:var(--size-attachment-start-item-s, 32px);
|
|
11
|
+
}
|
|
12
|
+
.img[data-size=m]{
|
|
13
|
+
width:var(--size-attachment-start-item-m, 40px);
|
|
14
|
+
height:var(--size-attachment-start-item-m, 40px);
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Emblem';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Emblem';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Attachment';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
.composition{
|
|
2
|
+
overflow:hidden;
|
|
3
|
+
display:flex;
|
|
4
|
+
align-items:flex-start;
|
|
5
|
+
box-sizing:border-box;
|
|
6
|
+
width:100%;
|
|
7
|
+
margin:calc(0px - var(--dimension-050m, 4px));
|
|
8
|
+
padding:var(--dimension-050m, 4px);
|
|
9
|
+
}
|
|
10
|
+
.composition[data-size=s]{
|
|
11
|
+
gap:var(--space-attachment-composition-s-gap, 8px);
|
|
12
|
+
}
|
|
13
|
+
.composition[data-size=m]{
|
|
14
|
+
gap:var(--space-attachment-composition-m-gap, 12px);
|
|
15
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { AttachmentSquareProps } from '../../types';
|
|
2
|
+
export declare function AttachmentSquare({ file, loading, icon, title: titleProp, description: descriptionProp, error, disabled, truncateVariant, checked, onDownload, onDelete, onClick, onRetry, size, className, ...rest }: AttachmentSquareProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AttachmentProps } from '../../../../types';
|
|
2
|
+
type HoverContentProps = Pick<AttachmentProps, 'title' | 'description' | 'error' | 'className'>;
|
|
3
|
+
export declare function HoverContent({ title, description, error, className }: HoverContentProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './HoverContent';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function LoadingContent(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './LoadingContent';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AttachmentProps } from '../../../../types';
|
|
2
|
+
type MainContentProps = {
|
|
3
|
+
imageData?: string;
|
|
4
|
+
} & Pick<AttachmentProps, 'title' | 'icon' | 'className'>;
|
|
5
|
+
export declare function MainContent({ title, icon, imageData, className }: MainContentProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MainContent';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.composition{
|
|
2
|
+
gap:var(--space-attachment-composition-s-gap, 8px);
|
|
3
|
+
overflow:hidden;
|
|
4
|
+
display:flex;
|
|
5
|
+
flex-direction:column;
|
|
6
|
+
flex-shrink:0;
|
|
7
|
+
align-items:center;
|
|
8
|
+
box-sizing:content-box;
|
|
9
|
+
width:100%;
|
|
10
|
+
margin:calc(0px - var(--dimension-050m, 4px));
|
|
11
|
+
padding:var(--dimension-050m, 4px);
|
|
12
|
+
text-align:center;
|
|
13
|
+
}
|
|
14
|
+
.composition[data-size=s]{
|
|
15
|
+
gap:var(--space-attachment-composition-s-gap, 8px);
|
|
16
|
+
}
|
|
17
|
+
.composition[data-size=m]{
|
|
18
|
+
gap:var(--space-attachment-composition-m-gap, 12px);
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AttachmentSquare';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
.wrapper{
|
|
2
|
+
flex-shrink:0;
|
|
3
|
+
}
|
|
4
|
+
.wrapper.sizeS{
|
|
5
|
+
width:var(--size-attachment-container-square-s, 80px);
|
|
6
|
+
height:var(--size-attachment-container-square-s, 80px);
|
|
7
|
+
}
|
|
8
|
+
.wrapper.sizeM{
|
|
9
|
+
width:var(--size-attachment-container-square-m, 108px);
|
|
10
|
+
height:var(--size-attachment-container-square-m, 108px);
|
|
11
|
+
}
|
|
12
|
+
.wrapper .main{
|
|
13
|
+
display:flex;
|
|
14
|
+
flex-shrink:0;
|
|
15
|
+
}
|
|
16
|
+
.wrapper .hover{
|
|
17
|
+
pointer-events:none;
|
|
18
|
+
height:0;
|
|
19
|
+
opacity:0;
|
|
20
|
+
}
|
|
21
|
+
.wrapper:hover .hover, .wrapper:focus-visible .hover, .wrapper.hasFocusedActions .hover{
|
|
22
|
+
pointer-events:unset;
|
|
23
|
+
height:unset;
|
|
24
|
+
opacity:1;
|
|
25
|
+
}
|
|
26
|
+
.wrapper:hover .main, .wrapper:focus-visible .main, .wrapper.hasFocusedActions .main{
|
|
27
|
+
display:none;
|
|
28
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AttachmentProps } from './types';
|
|
2
|
+
export type AttachmentContextType = Pick<AttachmentProps, 'size' | 'file' | 'truncateVariant' | 'onDownload' | 'onDelete' | 'onRetry' | 'disabled' | 'truncate'>;
|
|
3
|
+
export declare const AttachmentContext: import("react").Context<AttachmentContextType>;
|
|
4
|
+
export declare function useAttachmentContext(): AttachmentContextType;
|
|
5
|
+
export type AttachmentFocusActionsContextType = {
|
|
6
|
+
focused: boolean;
|
|
7
|
+
setFocused(focused: boolean): void;
|
|
8
|
+
};
|
|
9
|
+
export declare const AttachmentFocusActionsContext: import("react").Context<AttachmentFocusActionsContextType>;
|
|
10
|
+
export declare function useAttachmentFocusActionsContext(): AttachmentFocusActionsContextType;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Actions';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
.actions{
|
|
2
|
+
gap:var(--space-attachment-composition-end-item-gap, 4px);
|
|
3
|
+
display:flex;
|
|
4
|
+
flex-shrink:0;
|
|
5
|
+
}
|
|
6
|
+
.actions :not([data-disabled]).retryAction svg{
|
|
7
|
+
transform:rotate(360deg);
|
|
8
|
+
transition:transform 0.5s;
|
|
9
|
+
}
|
|
10
|
+
.actions :not([data-disabled]).retryAction:active svg{
|
|
11
|
+
transform:rotate(0deg);
|
|
12
|
+
transition-duration:0s;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Text';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { AttachmentProps } from '../../types';
|
|
2
|
+
export type TextBlockProps = Pick<AttachmentProps, 'title' | 'description' | 'error' | 'className'> & {
|
|
3
|
+
align?: 'center' | 'left';
|
|
4
|
+
};
|
|
5
|
+
export declare function TextBlock({ title, description, error, className, align }: TextBlockProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './TextBlock';
|