@cloud-ru/ds-attachment 1.0.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 +8 -0
- package/LICENSE +201 -0
- package/README.md +312 -0
- package/dist/cjs/components/Attachment/Attachment.d.ts +2 -0
- package/dist/cjs/components/Attachment/Attachment.js +29 -0
- package/dist/cjs/components/Attachment/components/Emblem/Emblem.d.ts +5 -0
- package/dist/cjs/components/Attachment/components/Emblem/Emblem.js +30 -0
- package/dist/cjs/components/Attachment/components/Emblem/index.d.ts +1 -0
- package/dist/cjs/components/Attachment/components/Emblem/index.js +17 -0
- package/dist/cjs/components/Attachment/components/Emblem/styles.module.css +32 -0
- package/dist/cjs/components/Attachment/index.d.ts +1 -0
- package/dist/cjs/components/Attachment/index.js +17 -0
- package/dist/cjs/components/Attachment/styles.module.css +23 -0
- package/dist/cjs/components/AttachmentSquare/AttachmentSquare.d.ts +2 -0
- package/dist/cjs/components/AttachmentSquare/AttachmentSquare.js +53 -0
- package/dist/cjs/components/AttachmentSquare/components/HoverContent/HoverContent.d.ts +7 -0
- package/dist/cjs/components/AttachmentSquare/components/HoverContent/HoverContent.js +19 -0
- package/dist/cjs/components/AttachmentSquare/components/HoverContent/index.d.ts +1 -0
- package/dist/cjs/components/AttachmentSquare/components/HoverContent/index.js +17 -0
- package/dist/cjs/components/AttachmentSquare/components/HoverContent/styles.module.css +20 -0
- package/dist/cjs/components/AttachmentSquare/components/LoadingContent/LoadingContent.d.ts +1 -0
- package/dist/cjs/components/AttachmentSquare/components/LoadingContent/LoadingContent.js +14 -0
- package/dist/cjs/components/AttachmentSquare/components/LoadingContent/index.d.ts +1 -0
- package/dist/cjs/components/AttachmentSquare/components/LoadingContent/index.js +17 -0
- package/dist/cjs/components/AttachmentSquare/components/LoadingContent/styles.module.css +9 -0
- package/dist/cjs/components/AttachmentSquare/components/MainContent/MainContent.d.ts +7 -0
- package/dist/cjs/components/AttachmentSquare/components/MainContent/MainContent.js +22 -0
- package/dist/cjs/components/AttachmentSquare/components/MainContent/index.d.ts +1 -0
- package/dist/cjs/components/AttachmentSquare/components/MainContent/index.js +17 -0
- package/dist/cjs/components/AttachmentSquare/components/MainContent/styles.module.css +38 -0
- package/dist/cjs/components/AttachmentSquare/index.d.ts +1 -0
- package/dist/cjs/components/AttachmentSquare/index.js +17 -0
- package/dist/cjs/components/AttachmentSquare/styles.module.css +68 -0
- package/dist/cjs/components/index.d.ts +2 -0
- package/dist/cjs/components/index.js +18 -0
- package/dist/cjs/constants.d.ts +18 -0
- package/dist/cjs/constants.js +22 -0
- package/dist/cjs/context.d.ts +10 -0
- package/dist/cjs/context.js +17 -0
- package/dist/cjs/helperComponents/Actions/Actions.d.ts +7 -0
- package/dist/cjs/helperComponents/Actions/Actions.js +38 -0
- package/dist/cjs/helperComponents/Actions/index.d.ts +1 -0
- package/dist/cjs/helperComponents/Actions/index.js +17 -0
- package/dist/cjs/helperComponents/Actions/styles.module.css +4 -0
- package/dist/cjs/helperComponents/Text/Text.d.ts +9 -0
- package/dist/cjs/helperComponents/Text/Text.js +15 -0
- package/dist/cjs/helperComponents/Text/index.d.ts +1 -0
- package/dist/cjs/helperComponents/Text/index.js +17 -0
- package/dist/cjs/helperComponents/TextBlock/TextBlock.d.ts +5 -0
- package/dist/cjs/helperComponents/TextBlock/TextBlock.js +17 -0
- package/dist/cjs/helperComponents/TextBlock/index.d.ts +1 -0
- package/dist/cjs/helperComponents/TextBlock/index.js +17 -0
- package/dist/cjs/helperComponents/TextBlock/styles.module.css +56 -0
- package/dist/cjs/helperComponents/index.d.ts +3 -0
- package/dist/cjs/helperComponents/index.js +19 -0
- package/dist/cjs/hooks.d.ts +4 -0
- package/dist/cjs/hooks.js +37 -0
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/index.js +19 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/style.css +250 -0
- package/dist/cjs/types.d.ts +70 -0
- package/dist/cjs/types.js +2 -0
- package/dist/cjs/utils.d.ts +6 -0
- package/dist/cjs/utils.js +28 -0
- package/dist/esm/components/Attachment/Attachment.d.ts +2 -0
- package/dist/esm/components/Attachment/Attachment.js +23 -0
- package/dist/esm/components/Attachment/components/Emblem/Emblem.d.ts +5 -0
- package/dist/esm/components/Attachment/components/Emblem/Emblem.js +24 -0
- package/dist/esm/components/Attachment/components/Emblem/index.d.ts +1 -0
- package/dist/esm/components/Attachment/components/Emblem/index.js +1 -0
- package/dist/esm/components/Attachment/components/Emblem/styles.module.css +32 -0
- package/dist/esm/components/Attachment/index.d.ts +1 -0
- package/dist/esm/components/Attachment/index.js +1 -0
- package/dist/esm/components/Attachment/styles.module.css +23 -0
- package/dist/esm/components/AttachmentSquare/AttachmentSquare.d.ts +2 -0
- package/dist/esm/components/AttachmentSquare/AttachmentSquare.js +47 -0
- package/dist/esm/components/AttachmentSquare/components/HoverContent/HoverContent.d.ts +7 -0
- package/dist/esm/components/AttachmentSquare/components/HoverContent/HoverContent.js +13 -0
- package/dist/esm/components/AttachmentSquare/components/HoverContent/index.d.ts +1 -0
- package/dist/esm/components/AttachmentSquare/components/HoverContent/index.js +1 -0
- package/dist/esm/components/AttachmentSquare/components/HoverContent/styles.module.css +20 -0
- package/dist/esm/components/AttachmentSquare/components/LoadingContent/LoadingContent.d.ts +1 -0
- package/dist/esm/components/AttachmentSquare/components/LoadingContent/LoadingContent.js +8 -0
- package/dist/esm/components/AttachmentSquare/components/LoadingContent/index.d.ts +1 -0
- package/dist/esm/components/AttachmentSquare/components/LoadingContent/index.js +1 -0
- package/dist/esm/components/AttachmentSquare/components/LoadingContent/styles.module.css +9 -0
- package/dist/esm/components/AttachmentSquare/components/MainContent/MainContent.d.ts +7 -0
- package/dist/esm/components/AttachmentSquare/components/MainContent/MainContent.js +16 -0
- package/dist/esm/components/AttachmentSquare/components/MainContent/index.d.ts +1 -0
- package/dist/esm/components/AttachmentSquare/components/MainContent/index.js +1 -0
- package/dist/esm/components/AttachmentSquare/components/MainContent/styles.module.css +38 -0
- package/dist/esm/components/AttachmentSquare/index.d.ts +1 -0
- package/dist/esm/components/AttachmentSquare/index.js +1 -0
- package/dist/esm/components/AttachmentSquare/styles.module.css +68 -0
- package/dist/esm/components/index.d.ts +2 -0
- package/dist/esm/components/index.js +2 -0
- package/dist/esm/constants.d.ts +18 -0
- package/dist/esm/constants.js +19 -0
- package/dist/esm/context.d.ts +10 -0
- package/dist/esm/context.js +12 -0
- package/dist/esm/helperComponents/Actions/Actions.d.ts +7 -0
- package/dist/esm/helperComponents/Actions/Actions.js +32 -0
- package/dist/esm/helperComponents/Actions/index.d.ts +1 -0
- package/dist/esm/helperComponents/Actions/index.js +1 -0
- package/dist/esm/helperComponents/Actions/styles.module.css +4 -0
- package/dist/esm/helperComponents/Text/Text.d.ts +9 -0
- package/dist/esm/helperComponents/Text/Text.js +12 -0
- package/dist/esm/helperComponents/Text/index.d.ts +1 -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/TextBlock.js +11 -0
- package/dist/esm/helperComponents/TextBlock/index.d.ts +1 -0
- package/dist/esm/helperComponents/TextBlock/index.js +1 -0
- package/dist/esm/helperComponents/TextBlock/styles.module.css +56 -0
- package/dist/esm/helperComponents/index.d.ts +3 -0
- package/dist/esm/helperComponents/index.js +3 -0
- package/dist/esm/hooks.d.ts +4 -0
- package/dist/esm/hooks.js +34 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/style.css +250 -0
- package/dist/esm/types.d.ts +70 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/utils.d.ts +6 -0
- package/dist/esm/utils.js +22 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -0
- package/package.json +50 -0
- package/src/components/Attachment/Attachment.tsx +79 -0
- package/src/components/Attachment/components/Emblem/Emblem.tsx +56 -0
- package/src/components/Attachment/components/Emblem/index.ts +1 -0
- package/src/components/Attachment/components/Emblem/styles.module.scss +34 -0
- package/src/components/Attachment/index.ts +1 -0
- package/src/components/Attachment/styles.module.scss +28 -0
- package/src/components/AttachmentSquare/AttachmentSquare.tsx +127 -0
- package/src/components/AttachmentSquare/components/HoverContent/HoverContent.tsx +34 -0
- package/src/components/AttachmentSquare/components/HoverContent/index.ts +1 -0
- package/src/components/AttachmentSquare/components/HoverContent/styles.module.scss +34 -0
- package/src/components/AttachmentSquare/components/LoadingContent/LoadingContent.tsx +14 -0
- package/src/components/AttachmentSquare/components/LoadingContent/index.ts +1 -0
- package/src/components/AttachmentSquare/components/LoadingContent/styles.module.scss +13 -0
- package/src/components/AttachmentSquare/components/MainContent/MainContent.tsx +43 -0
- package/src/components/AttachmentSquare/components/MainContent/index.ts +1 -0
- package/src/components/AttachmentSquare/components/MainContent/styles.module.scss +44 -0
- package/src/components/AttachmentSquare/index.ts +1 -0
- package/src/components/AttachmentSquare/styles.module.scss +95 -0
- package/src/components/index.ts +2 -0
- package/src/constants.ts +21 -0
- package/src/context.tsx +28 -0
- package/src/helperComponents/Actions/Actions.tsx +90 -0
- package/src/helperComponents/Actions/index.ts +1 -0
- package/src/helperComponents/Actions/styles.module.scss +4 -0
- package/src/helperComponents/Text/Text.tsx +29 -0
- package/src/helperComponents/Text/index.ts +1 -0
- package/src/helperComponents/TextBlock/TextBlock.tsx +38 -0
- package/src/helperComponents/TextBlock/index.ts +1 -0
- package/src/helperComponents/TextBlock/styles.module.scss +53 -0
- package/src/helperComponents/index.ts +3 -0
- package/src/hooks.ts +40 -0
- package/src/index.ts +3 -0
- package/src/types.ts +74 -0
- package/src/utils.ts +30 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Attachment"), exports);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.root{
|
|
2
|
+
isolation:isolate;
|
|
3
|
+
display:inline-block;
|
|
4
|
+
width:-moz-fit-content;
|
|
5
|
+
width:fit-content;
|
|
6
|
+
max-width:100%;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.composition{
|
|
10
|
+
display:flex;
|
|
11
|
+
align-items:flex-start;
|
|
12
|
+
box-sizing:border-box;
|
|
13
|
+
width:100%;
|
|
14
|
+
min-width:0;
|
|
15
|
+
}
|
|
16
|
+
.composition[data-size=s]{
|
|
17
|
+
gap:var(--sn-attachment-anatomy-size-s-container-gap, var(--sn-primitive-dimension-8, 8px));
|
|
18
|
+
padding:var(--sn-attachment-anatomy-size-s-container-content-padding, var(--sn-primitive-dimension-8, 8px));
|
|
19
|
+
}
|
|
20
|
+
.composition[data-size=m]{
|
|
21
|
+
gap:var(--sn-attachment-anatomy-size-m-container-gap, var(--sn-primitive-dimension-8, 8px));
|
|
22
|
+
padding:var(--sn-attachment-anatomy-size-m-container-content-padding, var(--sn-primitive-dimension-16, 16px));
|
|
23
|
+
}
|
|
@@ -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,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AttachmentSquare = AttachmentSquare;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const card_1 = require("@cloud-ru/ds-card");
|
|
9
|
+
const materials_1 = require("@cloud-ru/ds-materials");
|
|
10
|
+
const utils_1 = require("@cloud-ru/ds-utils");
|
|
11
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
12
|
+
const react_1 = require("react");
|
|
13
|
+
const context_1 = require("../../context");
|
|
14
|
+
const hooks_1 = require("../../hooks");
|
|
15
|
+
const utils_2 = require("../../utils");
|
|
16
|
+
const HoverContent_1 = require("./components/HoverContent");
|
|
17
|
+
const LoadingContent_1 = require("./components/LoadingContent");
|
|
18
|
+
const MainContent_1 = require("./components/MainContent");
|
|
19
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
20
|
+
function AttachmentSquare({ file, loading, icon, title: titleProp, description: descriptionProp, error, disabled, truncateVariant, checked, onDownload, onDelete, onClick, onRetry, size = 's', className, ...rest }) {
|
|
21
|
+
const { loading: loadingImage, imageData } = (0, hooks_1.useImage)(file);
|
|
22
|
+
const isLoading = loading || loadingImage;
|
|
23
|
+
const title = titleProp || (0, utils_2.getBaseFileName)(file?.name);
|
|
24
|
+
const description = descriptionProp || (0, utils_2.getFileExtension)(file?.name);
|
|
25
|
+
const [hasFocusedActions, setHasFocusedActions] = (0, react_1.useState)(false);
|
|
26
|
+
const interactive = !isLoading && !disabled && Boolean(onClick);
|
|
27
|
+
const hasError = Boolean(error);
|
|
28
|
+
const hasActions = Boolean(onDownload || onDelete || onRetry);
|
|
29
|
+
const isChecked = !loading && !error && checked;
|
|
30
|
+
const isDisabled = !loading && disabled;
|
|
31
|
+
const handleKeyDown = (event) => {
|
|
32
|
+
if (!interactive || !onClick)
|
|
33
|
+
return;
|
|
34
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
onClick(event);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
return ((0, jsx_runtime_1.jsx)(card_1.Card, { ...(0, utils_1.extractSupportProps)(rest), view: 'outline', radius: size === 's' ? 's' : 'm', backgroundPredefined: hasError ? materials_1.BACKGROUND_PREDEFINED_FILL.RedBackground : materials_1.BACKGROUND_PREDEFINED_FILL.NeutralBackground1Level, disabled: isDisabled, checked: isChecked, multiSelect: true, interactive: interactive, className: (0, classnames_1.default)(styles_module_scss_1.default.root, className), "data-attachment-error": hasError || undefined, "aria-busy": isLoading || undefined, children: (0, jsx_runtime_1.jsx)(context_1.AttachmentContext.Provider, { value: {
|
|
40
|
+
file,
|
|
41
|
+
truncateVariant,
|
|
42
|
+
onDelete,
|
|
43
|
+
onDownload,
|
|
44
|
+
onRetry,
|
|
45
|
+
disabled,
|
|
46
|
+
size,
|
|
47
|
+
truncate: { title: 1, description: 1, error: 1 },
|
|
48
|
+
}, children: (0, jsx_runtime_1.jsx)(context_1.AttachmentFocusActionsContext.Provider, { value: { focused: hasFocusedActions, setFocused: setHasFocusedActions }, children: (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.composition, {
|
|
49
|
+
[styles_module_scss_1.default.hasFocusedActions]: hasFocusedActions,
|
|
50
|
+
}), "data-size": size, "data-loading": isLoading || undefined, "data-error": hasError || undefined, "data-has-actions": hasActions || undefined, onClick: interactive ? onClick : undefined, onKeyDown: interactive ? handleKeyDown : undefined, role: interactive ? 'button' : undefined,
|
|
51
|
+
// Card-корень уже фокусируется (tabIndex={0}); внутренний wrapper забирает только обработчики.
|
|
52
|
+
tabIndex: -1, children: [!isLoading && !hasError && ((0, jsx_runtime_1.jsx)(MainContent_1.MainContent, { title: title, description: description, icon: icon, imageData: imageData, className: styles_module_scss_1.default.main })), !isLoading && !disabled && ((0, jsx_runtime_1.jsx)(HoverContent_1.HoverContent, { title: title, description: description, error: error, hasImage: Boolean(imageData), className: styles_module_scss_1.default.hover })), isLoading && (0, jsx_runtime_1.jsx)(LoadingContent_1.LoadingContent, {})] }) }) }) }));
|
|
53
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AttachmentProps } from '../../../../types';
|
|
2
|
+
type HoverContentProps = Pick<AttachmentProps, 'title' | 'description' | 'error' | 'className'> & {
|
|
3
|
+
/** image-mode → overlay даёт title/description/actions поверх `<img>`; icon-mode → только actions поверх иконки. */
|
|
4
|
+
hasImage?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare function HoverContent({ title, description, error, hasImage, className }: HoverContentProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.HoverContent = HoverContent;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
9
|
+
const context_1 = require("../../../../context");
|
|
10
|
+
const helperComponents_1 = require("../../../../helperComponents");
|
|
11
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
12
|
+
function HoverContent({ title, description, error, hasImage, className }) {
|
|
13
|
+
const { size } = (0, context_1.useAttachmentContext)();
|
|
14
|
+
const hasError = Boolean(error);
|
|
15
|
+
const showOnHoverOnly = !hasError;
|
|
16
|
+
// Дублировать TextBlock из MainContent нельзя: два absolute-слоя того же текста дают визуальный bold.
|
|
17
|
+
const showText = hasImage || hasError;
|
|
18
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.overlay, showOnHoverOnly && className), "data-size": size, "data-error": hasError || undefined, "data-mode": hasImage ? 'image' : 'icon', children: [showText && ((0, jsx_runtime_1.jsx)(helperComponents_1.TextBlock, { title: title, error: error, description: !hasError ? description : undefined, align: 'center' })), (0, jsx_runtime_1.jsx)(helperComponents_1.Actions, { hideDownload: hasError, hideRetry: !hasError })] }));
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './HoverContent';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./HoverContent"), exports);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.overlay{
|
|
2
|
+
display:flex;
|
|
3
|
+
flex-direction:column;
|
|
4
|
+
gap:0;
|
|
5
|
+
align-items:center;
|
|
6
|
+
justify-content:center;
|
|
7
|
+
width:100%;
|
|
8
|
+
height:100%;
|
|
9
|
+
color:var(--sn-theme-color-available-version-textMain, var(--sn-brand-color-text-version-main, #41424e));
|
|
10
|
+
background-color:transparent;
|
|
11
|
+
}
|
|
12
|
+
.overlay[data-mode=icon]:not([data-error]){
|
|
13
|
+
justify-content:flex-end;
|
|
14
|
+
}
|
|
15
|
+
.overlay[data-size=s]{
|
|
16
|
+
padding:var(--sn-attachment-anatomy-size-s-container-content-padding, var(--sn-primitive-dimension-8, 8px));
|
|
17
|
+
}
|
|
18
|
+
.overlay[data-size=m]{
|
|
19
|
+
padding:var(--sn-attachment-anatomy-size-m-container-content-padding, var(--sn-primitive-dimension-16, 16px));
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function LoadingContent(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.LoadingContent = LoadingContent;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const loader_1 = require("@cloud-ru/ds-loader");
|
|
9
|
+
const constants_1 = require("../../../../constants");
|
|
10
|
+
const helperComponents_1 = require("../../../../helperComponents");
|
|
11
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
12
|
+
function LoadingContent() {
|
|
13
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.composition, "data-test-id": constants_1.TEST_IDS.loadingSquare, children: [(0, jsx_runtime_1.jsx)(loader_1.Spinner, {}), (0, jsx_runtime_1.jsx)(helperComponents_1.Actions, { hideDownload: true, hideRetry: true })] }));
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './LoadingContent';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./LoadingContent"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AttachmentProps } from '../../../../types';
|
|
2
|
+
type MainContentProps = {
|
|
3
|
+
imageData?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
} & Pick<AttachmentProps, 'title' | 'icon' | 'className'>;
|
|
6
|
+
export declare function MainContent({ title, description, icon, imageData, className }: MainContentProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MainContent = MainContent;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const icon_predefined_1 = require("@cloud-ru/ds-icon-predefined");
|
|
9
|
+
const system_1 = require("@cloud-ru/ds-icons/interface/system");
|
|
10
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
11
|
+
const constants_1 = require("../../../../constants");
|
|
12
|
+
const context_1 = require("../../../../context");
|
|
13
|
+
const helperComponents_1 = require("../../../../helperComponents");
|
|
14
|
+
const utils_1 = require("../../../../utils");
|
|
15
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
16
|
+
function MainContent({ title, description, icon, imageData, className }) {
|
|
17
|
+
const { file, size = 's' } = (0, context_1.useAttachmentContext)();
|
|
18
|
+
if (imageData) {
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.composition, styles_module_scss_1.default.image, className), "data-attachment-image": '', children: (0, jsx_runtime_1.jsx)("img", { src: imageData, alt: file?.name ?? title ?? 'file', "data-test-id": constants_1.TEST_IDS.image, className: styles_module_scss_1.default.img }) }));
|
|
20
|
+
}
|
|
21
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.composition, styles_module_scss_1.default.iconMode, className), "data-size": size, children: [(0, jsx_runtime_1.jsx)(helperComponents_1.TextBlock, { title: title, description: description, align: 'center' }), (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.iconSlot, "data-attachment-icon-slot": '', children: (0, jsx_runtime_1.jsx)(icon_predefined_1.IconPredefined, { size: utils_1.EMBLEM_ICON_SIZE[size], icon: icon ?? system_1.FileSVG, background: true, appearance: 'neutral', shape: 'squared', "data-test-id": constants_1.TEST_IDS.icon }) })] }));
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MainContent';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./MainContent"), exports);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
.composition{
|
|
2
|
+
display:flex;
|
|
3
|
+
align-items:center;
|
|
4
|
+
justify-content:center;
|
|
5
|
+
width:100%;
|
|
6
|
+
height:100%;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.iconMode{
|
|
10
|
+
flex-direction:column;
|
|
11
|
+
gap:0;
|
|
12
|
+
align-items:center;
|
|
13
|
+
justify-content:center;
|
|
14
|
+
}
|
|
15
|
+
.iconMode[data-size=s]{
|
|
16
|
+
padding:var(--sn-attachment-anatomy-size-s-container-content-padding, var(--sn-primitive-dimension-8, 8px));
|
|
17
|
+
}
|
|
18
|
+
.iconMode[data-size=m]{
|
|
19
|
+
padding:var(--sn-attachment-anatomy-size-m-container-content-padding, var(--sn-primitive-dimension-16, 16px));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.iconSlot{
|
|
23
|
+
display:flex;
|
|
24
|
+
align-items:center;
|
|
25
|
+
justify-content:center;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.image{
|
|
29
|
+
padding:0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.img{
|
|
33
|
+
display:block;
|
|
34
|
+
width:100%;
|
|
35
|
+
height:100%;
|
|
36
|
+
-o-object-fit:cover;
|
|
37
|
+
object-fit:cover;
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AttachmentSquare';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./AttachmentSquare"), exports);
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
.root{
|
|
3
|
+
isolation:isolate;
|
|
4
|
+
display:inline-flex;
|
|
5
|
+
flex-direction:column;
|
|
6
|
+
}
|
|
7
|
+
.root:has(> div > [data-size=s]){
|
|
8
|
+
width:var(--sn-attachment-anatomy-size-s-container-width, var(--sn-density-size-5xl, var(--sn-primitive-dimension-104, 104px)));
|
|
9
|
+
height:var(--sn-attachment-anatomy-size-s-container-height, var(--sn-density-size-5xl, var(--sn-primitive-dimension-104, 104px)));
|
|
10
|
+
}
|
|
11
|
+
.root:has(> div > [data-size=m]){
|
|
12
|
+
width:var(--sn-attachment-anatomy-size-m-container-width, var(--sn-density-size-8xl, var(--sn-primitive-dimension-128, 128px)));
|
|
13
|
+
height:var(--sn-attachment-anatomy-size-m-container-height, var(--sn-density-size-8xl, var(--sn-primitive-dimension-128, 128px)));
|
|
14
|
+
}
|
|
15
|
+
.root > div{
|
|
16
|
+
flex:1;
|
|
17
|
+
min-height:0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.composition{
|
|
21
|
+
position:relative;
|
|
22
|
+
width:100%;
|
|
23
|
+
height:100%;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.main{
|
|
27
|
+
position:absolute;
|
|
28
|
+
inset:0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.hover{
|
|
32
|
+
pointer-events:none;
|
|
33
|
+
position:absolute;
|
|
34
|
+
inset:0;
|
|
35
|
+
opacity:0;
|
|
36
|
+
}
|
|
37
|
+
.hasFocusedActions .hover,
|
|
38
|
+
.composition:hover .hover[data-mode=image],
|
|
39
|
+
.composition[data-has-actions]:hover .hover,
|
|
40
|
+
.root:focus-visible .hover[data-mode=image],
|
|
41
|
+
.root:focus-visible .composition[data-has-actions] .hover{
|
|
42
|
+
opacity:1;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.composition[data-error] .hover{
|
|
46
|
+
opacity:1;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.hover [data-attachment-actions]{
|
|
50
|
+
pointer-events:auto;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.hover[data-mode=image],
|
|
54
|
+
.hover[data-error]{
|
|
55
|
+
pointer-events:auto;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.root:not([data-disabled]) .composition[data-has-actions]:hover [data-attachment-icon-slot],
|
|
59
|
+
.root:not([data-disabled]) .hasFocusedActions [data-attachment-icon-slot],
|
|
60
|
+
.root:not([data-disabled]):focus-visible .composition[data-has-actions] [data-attachment-icon-slot]{
|
|
61
|
+
opacity:0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.root:not([data-disabled]) .composition:hover [data-attachment-image],
|
|
65
|
+
.root:not([data-disabled]) .hasFocusedActions [data-attachment-image],
|
|
66
|
+
.root:not([data-disabled]):focus-visible .composition [data-attachment-image]{
|
|
67
|
+
display:none;
|
|
68
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Attachment"), exports);
|
|
18
|
+
__exportStar(require("./AttachmentSquare"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const SIZE: {
|
|
2
|
+
readonly S: "s";
|
|
3
|
+
readonly M: "m";
|
|
4
|
+
};
|
|
5
|
+
export declare const TEST_IDS: {
|
|
6
|
+
readonly root: "attachment";
|
|
7
|
+
readonly rootSquare: "attachment-square";
|
|
8
|
+
readonly icon: "attachment__icon";
|
|
9
|
+
readonly image: "attachment__image";
|
|
10
|
+
readonly loading: "attachment__loading";
|
|
11
|
+
readonly loadingSquare: "attachment-square__loading";
|
|
12
|
+
readonly retryAction: "attachment__retry-action";
|
|
13
|
+
readonly deleteAction: "attachment__delete-action";
|
|
14
|
+
readonly downloadAction: "attachment__download-action";
|
|
15
|
+
readonly title: "attachment__title";
|
|
16
|
+
readonly description: "attachment__description";
|
|
17
|
+
readonly error: "attachment__error";
|
|
18
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TEST_IDS = exports.SIZE = void 0;
|
|
4
|
+
exports.SIZE = {
|
|
5
|
+
S: 's',
|
|
6
|
+
M: 'm',
|
|
7
|
+
};
|
|
8
|
+
const PREFIX = 'attachment';
|
|
9
|
+
exports.TEST_IDS = {
|
|
10
|
+
root: PREFIX,
|
|
11
|
+
rootSquare: `${PREFIX}-square`,
|
|
12
|
+
icon: `${PREFIX}__icon`,
|
|
13
|
+
image: `${PREFIX}__image`,
|
|
14
|
+
loading: `${PREFIX}__loading`,
|
|
15
|
+
loadingSquare: `${PREFIX}-square__loading`,
|
|
16
|
+
retryAction: `${PREFIX}__retry-action`,
|
|
17
|
+
deleteAction: `${PREFIX}__delete-action`,
|
|
18
|
+
downloadAction: `${PREFIX}__download-action`,
|
|
19
|
+
title: `${PREFIX}__title`,
|
|
20
|
+
description: `${PREFIX}__description`,
|
|
21
|
+
error: `${PREFIX}__error`,
|
|
22
|
+
};
|
|
@@ -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,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AttachmentFocusActionsContext = exports.AttachmentContext = void 0;
|
|
4
|
+
exports.useAttachmentContext = useAttachmentContext;
|
|
5
|
+
exports.useAttachmentFocusActionsContext = useAttachmentFocusActionsContext;
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
exports.AttachmentContext = (0, react_1.createContext)({});
|
|
8
|
+
function useAttachmentContext() {
|
|
9
|
+
return (0, react_1.useContext)(exports.AttachmentContext);
|
|
10
|
+
}
|
|
11
|
+
exports.AttachmentFocusActionsContext = (0, react_1.createContext)({
|
|
12
|
+
focused: false,
|
|
13
|
+
setFocused: () => { },
|
|
14
|
+
});
|
|
15
|
+
function useAttachmentFocusActionsContext() {
|
|
16
|
+
return (0, react_1.useContext)(exports.AttachmentFocusActionsContext);
|
|
17
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Actions = Actions;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const button_1 = require("@cloud-ru/ds-button");
|
|
9
|
+
const system_1 = require("@cloud-ru/ds-icons/interface/system");
|
|
10
|
+
const constants_1 = require("../../constants");
|
|
11
|
+
const context_1 = require("../../context");
|
|
12
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
13
|
+
const noop = () => { };
|
|
14
|
+
function Actions({ hideDelete, hideDownload, hideRetry }) {
|
|
15
|
+
const { onDelete, onDownload, file, disabled, onRetry } = (0, context_1.useAttachmentContext)();
|
|
16
|
+
const { setFocused = noop } = (0, context_1.useAttachmentFocusActionsContext)();
|
|
17
|
+
const showDownload = onDownload && !hideDownload;
|
|
18
|
+
const showDelete = onDelete && !hideDelete;
|
|
19
|
+
const showRetry = onRetry && !hideRetry;
|
|
20
|
+
const handleFocus = () => setFocused(true);
|
|
21
|
+
const handleBlur = () => setFocused(false);
|
|
22
|
+
const handleRetry = (e) => {
|
|
23
|
+
onRetry?.();
|
|
24
|
+
e.stopPropagation();
|
|
25
|
+
};
|
|
26
|
+
const handleDownload = (e) => {
|
|
27
|
+
onDownload?.(file);
|
|
28
|
+
e.stopPropagation();
|
|
29
|
+
};
|
|
30
|
+
const handleDelete = (e) => {
|
|
31
|
+
onDelete?.(file);
|
|
32
|
+
e.stopPropagation();
|
|
33
|
+
};
|
|
34
|
+
if (!showDownload && !showDelete && !showRetry) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.actions, "data-attachment-actions": '', children: [showDownload && ((0, jsx_runtime_1.jsx)(button_1.Button, { disabled: disabled, view: 'function', appearance: 'neutral', size: 'm', icon: (0, jsx_runtime_1.jsx)(system_1.DownloadSVG, {}), onClick: handleDownload, onFocus: handleFocus, onBlur: handleBlur, "data-test-id": constants_1.TEST_IDS.downloadAction })), showRetry && ((0, jsx_runtime_1.jsx)(button_1.Button, { disabled: disabled, view: 'function', appearance: 'neutral', size: 'm', icon: (0, jsx_runtime_1.jsx)(system_1.UpdateSVG, {}), onClick: handleRetry, onFocus: handleFocus, onBlur: handleBlur, "data-test-id": constants_1.TEST_IDS.retryAction })), showDelete && ((0, jsx_runtime_1.jsx)(button_1.Button, { disabled: disabled, view: 'function', appearance: 'neutral', size: 'm', icon: (0, jsx_runtime_1.jsx)(system_1.TrashSVG, {}), onClick: handleDelete, onFocus: handleFocus, onBlur: handleBlur, "data-test-id": constants_1.TEST_IDS.deleteAction }))] }));
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Actions';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Actions"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type TextProps = {
|
|
2
|
+
text?: string;
|
|
3
|
+
className?: string;
|
|
4
|
+
maxLines?: number;
|
|
5
|
+
'data-test-id'?: string;
|
|
6
|
+
/** Только на wrapper-div для typography token-mapping; в TruncateString не пробрасывается. */
|
|
7
|
+
'data-size'?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function Text({ text, className, maxLines, ...rest }: TextProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Text = Text;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const truncate_string_1 = require("@cloud-ru/ds-truncate-string");
|
|
6
|
+
const utils_1 = require("@cloud-ru/ds-utils");
|
|
7
|
+
const context_1 = require("../../context");
|
|
8
|
+
function Text({ text, className, maxLines = 1, ...rest }) {
|
|
9
|
+
const { truncateVariant } = (0, context_1.useAttachmentContext)();
|
|
10
|
+
if (!text) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
const { 'data-size': dataSize, ...support } = rest;
|
|
14
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: className, "data-size": dataSize, children: (0, jsx_runtime_1.jsx)(truncate_string_1.TruncateString, { text: text, maxLines: maxLines, variant: truncateVariant, ...(0, utils_1.extractSupportProps)(support) }) }));
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Text';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Text"), exports);
|