ics-ui-kit 0.1.0-alpha.12 → 0.1.0-alpha.13
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/Button-DQtBfU9y.js +57 -0
- package/dist/Button-DQtBfU9y.js.map +1 -0
- package/dist/{Button-DhfE69q0.js → ButtonBase-BEM8SNmT.js} +27 -56
- package/dist/ButtonBase-BEM8SNmT.js.map +1 -0
- package/dist/CarouselItem-pSHe0ufN.js +1500 -0
- package/dist/CarouselItem-pSHe0ufN.js.map +1 -0
- package/dist/CheckboxField-i_-dPpFM.js +370 -0
- package/dist/CheckboxField-i_-dPpFM.js.map +1 -0
- package/dist/Divider-C0Ss5GJT.js +47 -0
- package/dist/{Divider-D3NvaU8c.js.map → Divider-C0Ss5GJT.js.map} +1 -1
- package/dist/Field-3XJNFTql.js +78 -0
- package/dist/Field-3XJNFTql.js.map +1 -0
- package/dist/FieldLabel-CAbVan3E.js +97 -0
- package/dist/FieldLabel-CAbVan3E.js.map +1 -0
- package/dist/FormBody-4HptEjhb.js +103 -0
- package/dist/FormBody-4HptEjhb.js.map +1 -0
- package/dist/{IconButton-BUPs2kEo.js → IconButton-BkBsOIf5.js} +15 -15
- package/dist/{IconButton-BUPs2kEo.js.map → IconButton-BkBsOIf5.js.map} +1 -1
- package/dist/ImagePlaceholder-CNAKQWTh.js +45 -0
- package/dist/ImagePlaceholder-CNAKQWTh.js.map +1 -0
- package/dist/ImagePreview-DHi7A8md.js +156 -0
- package/dist/ImagePreview-DHi7A8md.js.map +1 -0
- package/dist/ImageUploader-46sxdmt5.js +123 -0
- package/dist/ImageUploader-46sxdmt5.js.map +1 -0
- package/dist/IsolatedStylesWrapper-WgaoHh7y.js +179 -0
- package/dist/IsolatedStylesWrapper-WgaoHh7y.js.map +1 -0
- package/dist/Modal-D33MSQot.js +125 -0
- package/dist/Modal-D33MSQot.js.map +1 -0
- package/dist/ScrollShadowContainer-ByNH68Kg.js +636 -0
- package/dist/ScrollShadowContainer-ByNH68Kg.js.map +1 -0
- package/dist/Toggle-7AlEmn8A.js +104 -0
- package/dist/Toggle-7AlEmn8A.js.map +1 -0
- package/dist/ToggleGroup-CT453MNp.js +200 -0
- package/dist/ToggleGroup-CT453MNp.js.map +1 -0
- package/dist/Tooltip-C4BbGF2_.js +372 -0
- package/dist/Tooltip-C4BbGF2_.js.map +1 -0
- package/dist/{bundle-mjs-D6wdQkGI.js → bundle-mjs-LhQum_e3.js} +676 -425
- package/dist/bundle-mjs-LhQum_e3.js.map +1 -0
- package/dist/check-C-TqZgvb.js.map +1 -1
- package/dist/chevron-right-CobOebzi.js.map +1 -1
- package/dist/components/badge.js +1 -1
- package/dist/components/button/icon-button/IconButton.stories.d.ts +330 -2
- package/dist/components/button/loading-button/LoadingButton.d.ts +249 -0
- package/dist/components/button/loading-button/LoadingButton.stories.d.ts +219 -0
- package/dist/components/button.js +6 -5
- package/dist/components/button.js.map +1 -1
- package/dist/components/carousel.js +65 -1532
- package/dist/components/carousel.js.map +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/divider/content-divider/ContentDivider.d.ts +14 -0
- package/dist/components/divider/content-divider/ContentDivider.stories.d.ts +7 -0
- package/dist/components/divider/index.d.ts +1 -0
- package/dist/components/divider.js +45 -2
- package/dist/components/divider.js.map +1 -1
- package/dist/components/drawer/templates/drawer-footer-template/DrawerFooterTemplate.d.ts +3 -0
- package/dist/components/drawer.js +450 -447
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/dropdown.js +37 -33
- package/dist/components/dropdown.js.map +1 -1
- package/dist/components/empty-state/EmptyState.d.ts +2 -2
- package/dist/components/empty-state.js +1 -1
- package/dist/components/empty-state.js.map +1 -1
- package/dist/components/field/Field.d.ts +35 -0
- package/dist/components/field.js +1 -1
- package/dist/components/form/components/form-header/FormHeader.d.ts +2 -2
- package/dist/components/form.js +289 -288
- package/dist/components/form.js.map +1 -1
- package/dist/components/gallery/Gallery.d.ts +21 -0
- package/dist/components/gallery/Gallery.stories.d.ts +26 -0
- package/dist/components/gallery/index.d.ts +1 -0
- package/dist/components/gallery.d.ts +2 -0
- package/dist/components/gallery.js +130 -0
- package/dist/components/gallery.js.map +1 -0
- package/dist/components/icon-tooltip/IconTooltip.d.ts +2 -1
- package/dist/components/image-placeholder.js +2 -42
- package/dist/components/image-placeholder.js.map +1 -1
- package/dist/components/image-preview/ImagePreview.d.ts +6 -6
- package/dist/components/image-preview.js +2 -136
- package/dist/components/image-preview.js.map +1 -1
- package/dist/components/image-uploader.js +2 -118
- package/dist/components/image-uploader.js.map +1 -1
- package/dist/components/input/file-input/FileInput.d.ts +3 -1
- package/dist/components/input-otp.js +1 -1
- package/dist/components/input-otp.js.map +1 -1
- package/dist/components/input.js +176 -195
- package/dist/components/input.js.map +1 -1
- package/dist/components/isolated-styles-wrapper/IsolatedStylesWrapper.d.ts +1 -1
- package/dist/components/label/Label.stories.d.ts +0 -2
- package/dist/components/label/field-label/FieldLabel.d.ts +11 -0
- package/dist/components/label/field-label/FieldLabel.stories.d.ts +1 -0
- package/dist/components/label/field-label/components/RequiredIcon.d.ts +5 -0
- package/dist/components/label.js +1 -1
- package/dist/components/loading/Loading.d.ts +4 -4
- package/dist/components/loading.js +2 -2
- package/dist/components/loading.js.map +1 -1
- package/dist/components/modal.js +12 -122
- package/dist/components/modal.js.map +1 -1
- package/dist/components/option-group.js +1 -1
- package/dist/components/popover.js +34 -31
- package/dist/components/popover.js.map +1 -1
- package/dist/components/scheduler.js +11 -11
- package/dist/components/scheduler.js.map +1 -1
- package/dist/components/scroll-shadow-container/ScrollShadowContainer.d.ts +1 -0
- package/dist/components/scroll-shadow-container.js +1 -1
- package/dist/components/select.js +487 -519
- package/dist/components/select.js.map +1 -1
- package/dist/components/shortcut/Shortcut.d.ts +14 -14
- package/dist/components/shortcut/Shortcut.stories.d.ts +7 -7
- package/dist/components/shortcut.js +16 -16
- package/dist/components/shortcut.js.map +1 -1
- package/dist/components/skeleton/Skeleton.d.ts +1 -0
- package/dist/components/skeleton/Skeleton.stories.d.ts +7 -0
- package/dist/components/skeleton/index.d.ts +1 -0
- package/dist/components/skeleton.d.ts +2 -0
- package/dist/components/skeleton.js +33 -0
- package/dist/components/skeleton.js.map +1 -0
- package/dist/components/switch.js +147 -126
- package/dist/components/switch.js.map +1 -1
- package/dist/components/tabs.js +9 -8
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/tag.js +3 -3
- package/dist/components/toast.js +4 -4
- package/dist/components/toast.js.map +1 -1
- package/dist/components/toggle-group.js +1 -1
- package/dist/components/toggle.js +1 -1
- package/dist/components/tooltip/Tooltip.stories.d.ts +7 -0
- package/dist/components/tooltip/index.d.ts +1 -0
- package/dist/components/tooltip.d.ts +2 -0
- package/dist/components/tooltip.js +8 -0
- package/dist/components/tooltip.js.map +1 -0
- package/dist/createLucideIcon-DgrNxRV5.js.map +1 -1
- package/dist/design-tokens.source.json +1 -1
- package/dist/download-CVOGyQ0e.js.map +1 -1
- package/dist/downloadFile-yZV-aaO2.js +15 -0
- package/dist/downloadFile-yZV-aaO2.js.map +1 -0
- package/dist/index-B6K06mzp.js +67 -0
- package/dist/index-B6K06mzp.js.map +1 -0
- package/dist/index-BCZIl2rL.js +68 -0
- package/dist/index-BCZIl2rL.js.map +1 -0
- package/dist/index-BZPx6jYI.js.map +1 -1
- package/dist/index-Bj6ZBhqh.js +105 -0
- package/dist/index-Bj6ZBhqh.js.map +1 -0
- package/dist/index-ByaXH_ih.js.map +1 -1
- package/dist/index-CACw01gt.js +702 -0
- package/dist/index-CACw01gt.js.map +1 -0
- package/dist/index-COBL2CQB.js +14 -0
- package/dist/index-COBL2CQB.js.map +1 -0
- package/dist/index-CR-odn5-.js.map +1 -1
- package/dist/{index-BjbwEU_d.js → index-ClwWa5fz.js} +20 -20
- package/dist/index-ClwWa5fz.js.map +1 -0
- package/dist/{index-DwbC6luJ.js → index-Cx4x7Bv2.js} +52 -50
- package/dist/index-Cx4x7Bv2.js.map +1 -0
- package/dist/index-CzNelU6n.js +55 -0
- package/dist/index-CzNelU6n.js.map +1 -0
- package/dist/index-DBsc8nMF.js +43 -0
- package/dist/index-DBsc8nMF.js.map +1 -0
- package/dist/index-Mbnk_gHS.js +102 -0
- package/dist/index-Mbnk_gHS.js.map +1 -0
- package/dist/index-bhXb51Q1.js +215 -0
- package/dist/index-bhXb51Q1.js.map +1 -0
- package/dist/index-n71RB2rx.js +1592 -0
- package/dist/index-n71RB2rx.js.map +1 -0
- package/dist/index-rKs9bXHr.js +7 -0
- package/dist/index-rKs9bXHr.js.map +1 -0
- package/dist/lib/utils/file/downloadFile.d.ts +2 -0
- package/dist/lib/utils/image/imageConverter.d.ts +23 -0
- package/dist/styles-scoped.css +72 -18
- package/dist/styles.css +72 -18
- package/dist/{utils-DGzAmwok.js → utils-BK4mPzkB.js} +2 -2
- package/dist/utils-BK4mPzkB.js.map +1 -0
- package/dist/x-JgjNP5oH.js.map +1 -1
- package/package.json +1 -1
- package/dist/Button-DhfE69q0.js.map +0 -1
- package/dist/CheckboxField-CL1Tc7P4.js +0 -257
- package/dist/CheckboxField-CL1Tc7P4.js.map +0 -1
- package/dist/Divider-D3NvaU8c.js +0 -46
- package/dist/Field-COOo8o9f.js +0 -80
- package/dist/Field-COOo8o9f.js.map +0 -1
- package/dist/FieldLabel-BGxT_RaE.js +0 -64
- package/dist/FieldLabel-BGxT_RaE.js.map +0 -1
- package/dist/FormBody-DM52shm4.js +0 -101
- package/dist/FormBody-DM52shm4.js.map +0 -1
- package/dist/IsolatedStylesWrapper-B_Qu75eR.js +0 -555
- package/dist/IsolatedStylesWrapper-B_Qu75eR.js.map +0 -1
- package/dist/ScrollShadowContainer-DSKr3_fV.js +0 -690
- package/dist/ScrollShadowContainer-DSKr3_fV.js.map +0 -1
- package/dist/Toggle-BuYtICWv.js +0 -129
- package/dist/Toggle-BuYtICWv.js.map +0 -1
- package/dist/ToggleGroup-CMyUAz04.js +0 -467
- package/dist/ToggleGroup-CMyUAz04.js.map +0 -1
- package/dist/bundle-mjs-D6wdQkGI.js.map +0 -1
- package/dist/floating-ui.react-dom-CWfR7VfF.js +0 -1346
- package/dist/floating-ui.react-dom-CWfR7VfF.js.map +0 -1
- package/dist/index-0WznJ1QS.js +0 -276
- package/dist/index-0WznJ1QS.js.map +0 -1
- package/dist/index-BjbwEU_d.js.map +0 -1
- package/dist/index-BqriTm0o.js +0 -47
- package/dist/index-BqriTm0o.js.map +0 -1
- package/dist/index-C6bvrqL8.js +0 -563
- package/dist/index-C6bvrqL8.js.map +0 -1
- package/dist/index-C6t9z3on.js +0 -97
- package/dist/index-C6t9z3on.js.map +0 -1
- package/dist/index-CaQG3DzJ.js +0 -64
- package/dist/index-CaQG3DzJ.js.map +0 -1
- package/dist/index-ChTGHCkY.js +0 -255
- package/dist/index-ChTGHCkY.js.map +0 -1
- package/dist/index-D808y1pT.js +0 -178
- package/dist/index-D808y1pT.js.map +0 -1
- package/dist/index-DE3fiSzl.js +0 -28
- package/dist/index-DE3fiSzl.js.map +0 -1
- package/dist/index-DPws5oAn.js +0 -90
- package/dist/index-DPws5oAn.js.map +0 -1
- package/dist/index-DeUgDpdG.js +0 -80
- package/dist/index-DeUgDpdG.js.map +0 -1
- package/dist/index-DvquTpxI.js +0 -140
- package/dist/index-DvquTpxI.js.map +0 -1
- package/dist/index-DwbC6luJ.js.map +0 -1
- package/dist/index-Ncxt32Wo.js +0 -174
- package/dist/index-Ncxt32Wo.js.map +0 -1
- package/dist/index-U7y6nBZR.js +0 -179
- package/dist/index-U7y6nBZR.js.map +0 -1
- package/dist/index-pysSAa5G.js +0 -57
- package/dist/index-pysSAa5G.js.map +0 -1
- package/dist/tooltip-DI3_ZKNk.js +0 -365
- package/dist/tooltip-DI3_ZKNk.js.map +0 -1
- package/dist/utils-DGzAmwok.js.map +0 -1
- /package/dist/components/{ui/tooltip.d.ts → tooltip/Tooltip.d.ts} +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FileInfo } from '../input/file-input/FileInput';
|
|
3
|
+
export interface GalleryProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/** Размер галереи */
|
|
5
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
6
|
+
/** Направление галереи */
|
|
7
|
+
orientation?: "horizontal" | "vertical";
|
|
8
|
+
/** Массив изображений */
|
|
9
|
+
values?: FileInfo[];
|
|
10
|
+
/** Колбэк при изменении значений */
|
|
11
|
+
onValueChange?: (values: FileInfo[]) => void;
|
|
12
|
+
/** Колбэк при повторной попытке загрузки */
|
|
13
|
+
onImageRetry?: (id: number) => void;
|
|
14
|
+
/** Флаг только для чтения */
|
|
15
|
+
readonly?: boolean;
|
|
16
|
+
/** Количество плейсхолдеров */
|
|
17
|
+
placeholderCount?: number;
|
|
18
|
+
/** Отключает возможность скачивания изображений из галереи */
|
|
19
|
+
preventDownload?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare const Gallery: React.ForwardRefExoticComponent<GalleryProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
2
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
3
|
+
import { GalleryProps } from './Gallery';
|
|
4
|
+
declare const meta: {
|
|
5
|
+
component: ForwardRefExoticComponent< GalleryProps & RefAttributes<HTMLDivElement>>;
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: string;
|
|
8
|
+
};
|
|
9
|
+
args: {
|
|
10
|
+
size: "sm";
|
|
11
|
+
};
|
|
12
|
+
argTypes: {
|
|
13
|
+
size: {
|
|
14
|
+
control: "select";
|
|
15
|
+
options: string[];
|
|
16
|
+
};
|
|
17
|
+
readonly: {
|
|
18
|
+
control: "boolean";
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
tags: string[];
|
|
22
|
+
};
|
|
23
|
+
export default meta;
|
|
24
|
+
type Story = StoryObj<typeof meta>;
|
|
25
|
+
export declare const Default: Story;
|
|
26
|
+
export declare const GallerySubmit: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Gallery } from './Gallery';
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
var S = Object.defineProperty, T = Object.defineProperties;
|
|
2
|
+
var $ = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var h = Object.getOwnPropertySymbols;
|
|
4
|
+
var x = Object.prototype.hasOwnProperty, y = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var k = (r, t, o) => t in r ? S(r, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : r[t] = o, C = (r, t) => {
|
|
6
|
+
for (var o in t || (t = {}))
|
|
7
|
+
x.call(t, o) && k(r, o, t[o]);
|
|
8
|
+
if (h)
|
|
9
|
+
for (var o of h(t))
|
|
10
|
+
y.call(t, o) && k(r, o, t[o]);
|
|
11
|
+
return r;
|
|
12
|
+
}, D = (r, t) => T(r, $(t));
|
|
13
|
+
var N = (r, t) => {
|
|
14
|
+
var o = {};
|
|
15
|
+
for (var l in r)
|
|
16
|
+
x.call(r, l) && t.indexOf(l) < 0 && (o[l] = r[l]);
|
|
17
|
+
if (r != null && h)
|
|
18
|
+
for (var l of h(r))
|
|
19
|
+
t.indexOf(l) < 0 && y.call(r, l) && (o[l] = r[l]);
|
|
20
|
+
return o;
|
|
21
|
+
};
|
|
22
|
+
var _ = (r, t, o) => new Promise((l, m) => {
|
|
23
|
+
var i = (s) => {
|
|
24
|
+
try {
|
|
25
|
+
n(o.next(s));
|
|
26
|
+
} catch (p) {
|
|
27
|
+
m(p);
|
|
28
|
+
}
|
|
29
|
+
}, w = (s) => {
|
|
30
|
+
try {
|
|
31
|
+
n(o.throw(s));
|
|
32
|
+
} catch (p) {
|
|
33
|
+
m(p);
|
|
34
|
+
}
|
|
35
|
+
}, n = (s) => s.done ? l(s.value) : Promise.resolve(s.value).then(i, w);
|
|
36
|
+
n((o = o.apply(r, t)).next());
|
|
37
|
+
});
|
|
38
|
+
import { jsxs as M, jsx as a } from "react/jsx-runtime";
|
|
39
|
+
import A, { useState as H, useCallback as I } from "react";
|
|
40
|
+
import { C as q, a as B, b } from "../CarouselItem-pSHe0ufN.js";
|
|
41
|
+
import { I as E } from "../ImageUploader-46sxdmt5.js";
|
|
42
|
+
import { I as J } from "../ImagePlaceholder-CNAKQWTh.js";
|
|
43
|
+
import { I as K } from "../ImagePreview-DHi7A8md.js";
|
|
44
|
+
import { c as Q } from "../index-CR-odn5-.js";
|
|
45
|
+
import { M as W, b as X, d as Y, i as Z } from "../Modal-D33MSQot.js";
|
|
46
|
+
import { d as z } from "../downloadFile-yZV-aaO2.js";
|
|
47
|
+
const u = (r) => {
|
|
48
|
+
const t = URL.createObjectURL(r);
|
|
49
|
+
return {
|
|
50
|
+
id: Math.random(),
|
|
51
|
+
url: t,
|
|
52
|
+
name: r.name
|
|
53
|
+
};
|
|
54
|
+
}, v = Q({
|
|
55
|
+
base: "w-full",
|
|
56
|
+
slots: {
|
|
57
|
+
carouselContent: "p-0.5"
|
|
58
|
+
}
|
|
59
|
+
}), V = A.forwardRef(
|
|
60
|
+
(rr, F) => {
|
|
61
|
+
var g = rr, {
|
|
62
|
+
size: r = "md",
|
|
63
|
+
orientation: t = "horizontal",
|
|
64
|
+
values: o = [],
|
|
65
|
+
onValueChange: l,
|
|
66
|
+
onImageRetry: m,
|
|
67
|
+
readonly: i = !1,
|
|
68
|
+
placeholderCount: w = 10,
|
|
69
|
+
className: n,
|
|
70
|
+
preventDownload: s
|
|
71
|
+
} = g, p = N(g, [
|
|
72
|
+
"size",
|
|
73
|
+
"orientation",
|
|
74
|
+
"values",
|
|
75
|
+
"onValueChange",
|
|
76
|
+
"onImageRetry",
|
|
77
|
+
"readonly",
|
|
78
|
+
"placeholderCount",
|
|
79
|
+
"className",
|
|
80
|
+
"preventDownload"
|
|
81
|
+
]);
|
|
82
|
+
const U = v(), [d, j] = H(null), G = I(
|
|
83
|
+
(e) => _(void 0, null, function* () {
|
|
84
|
+
var f;
|
|
85
|
+
const c = (f = e.target.files) == null ? void 0 : f[0];
|
|
86
|
+
if (c) {
|
|
87
|
+
const R = u(c);
|
|
88
|
+
l == null || l([R, ...o]);
|
|
89
|
+
}
|
|
90
|
+
}),
|
|
91
|
+
[l, o]
|
|
92
|
+
), L = I(
|
|
93
|
+
(e) => {
|
|
94
|
+
const c = o.filter((f) => f.id !== e);
|
|
95
|
+
l == null || l(c);
|
|
96
|
+
},
|
|
97
|
+
[l, o]
|
|
98
|
+
), O = I((e) => {
|
|
99
|
+
j(e);
|
|
100
|
+
}, []), P = I((e) => z(e), []);
|
|
101
|
+
return /* @__PURE__ */ M("div", D(C({ ref: F, className: U.base({ className: n }) }, p), { children: [
|
|
102
|
+
/* @__PURE__ */ a(q, { size: r, orientation: t, opts: { watchDrag: !!o.length }, children: /* @__PURE__ */ M(B, { className: U.carouselContent(), children: [
|
|
103
|
+
!i && /* @__PURE__ */ a(b, { children: /* @__PURE__ */ a(E, { size: r, onChange: G, readonly: i }) }, "uploader"),
|
|
104
|
+
o.map((e, c) => /* @__PURE__ */ a(b, { children: /* @__PURE__ */ a(
|
|
105
|
+
K,
|
|
106
|
+
{
|
|
107
|
+
size: r,
|
|
108
|
+
url: e.url,
|
|
109
|
+
alt: `Image ${e.id}`,
|
|
110
|
+
readonly: i,
|
|
111
|
+
onImageClick: () => O(e),
|
|
112
|
+
onDownload: s ? void 0 : () => P(e),
|
|
113
|
+
onClear: () => L(e.id),
|
|
114
|
+
onRetry: () => m == null ? void 0 : m(e.id)
|
|
115
|
+
}
|
|
116
|
+
) }, c)),
|
|
117
|
+
Array.from({ length: w - o.length }).map((e, c) => /* @__PURE__ */ a(b, { children: /* @__PURE__ */ a(J, { size: r }) }, `placeholder-${c}`))
|
|
118
|
+
] }) }),
|
|
119
|
+
/* @__PURE__ */ a(W, { open: !!d, onOpenChange: (e) => !e && j(null), children: /* @__PURE__ */ M(X, { children: [
|
|
120
|
+
/* @__PURE__ */ a(Y, { children: /* @__PURE__ */ a(Z, { children: d == null ? void 0 : d.name }) }),
|
|
121
|
+
d && /* @__PURE__ */ a("img", { src: d.url, alt: d.name })
|
|
122
|
+
] }) })
|
|
123
|
+
] }));
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
V.displayName = "Gallery";
|
|
127
|
+
export {
|
|
128
|
+
V as Gallery
|
|
129
|
+
};
|
|
130
|
+
//# sourceMappingURL=gallery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gallery.js","sources":["../../src/lib/utils/image/imageConverter.ts","../../src/components/gallery/Gallery.tsx"],"sourcesContent":["import { FileInfo } from \"@/components/input/file-input/FileInput\";\r\n\r\n/**\r\n * Конвертирует URL изображения в base64\r\n */\r\nexport const urlToBase64 = async (url: string): Promise<string> => {\r\n\tconst response = await fetch(url);\r\n\tconst blob = await response.blob();\r\n\treturn new Promise((resolve) => {\r\n\t\tconst reader = new FileReader();\r\n\t\treader.onloadend = () => resolve(reader.result as string);\r\n\t\treader.readAsDataURL(blob);\r\n\t});\r\n};\r\n\r\n/**\r\n * Конвертирует FileInfo в base64\r\n */\r\nexport const fileInfoToBase64 = async (fileInfo: FileInfo): Promise<{ id: number; url: string }> => {\r\n\tconst base64 = await urlToBase64(fileInfo.url);\r\n\treturn { id: fileInfo.id, url: base64 };\r\n};\r\n\r\n/**\r\n * Конвертирует массив FileInfo в массив объектов с base64\r\n */\r\nexport const fileInfoArrayToBase64 = async (fileInfos: FileInfo[]): Promise<Array<{ id: number; url: string }>> => {\r\n\treturn Promise.all(fileInfos.map(fileInfoToBase64));\r\n};\r\n\r\n/**\r\n * Конвертирует File в FileInfo\r\n */\r\nexport const fileToFileInfo = (file: File): FileInfo => {\r\n\tconst url = URL.createObjectURL(file);\r\n\treturn {\r\n\t\tid: Math.random(),\r\n\t\turl,\r\n\t\tname: file.name\r\n\t};\r\n};\r\n","import React, { useCallback, useState } from \"react\";\r\nimport { Carousel, CarouselContent } from \"../carousel/Carousel\";\r\nimport { ImageUploader } from \"../image-uploader/ImageUploader\";\r\nimport { ImagePlaceholder } from \"../image-placeholder/ImagePlaceholder\";\r\nimport { ImagePreview } from \"../image-preview/ImagePreview\";\r\nimport { tv } from \"tailwind-variants\";\r\nimport { FileInfo } from \"../input/file-input/FileInput\";\r\nimport { CarouselItem } from \"../carousel\";\r\nimport { Modal, ModalContent, ModalHeader, ModalTitle } from \"../modal/Modal\";\r\nimport { downloadFile } from \"@/lib/utils/file/downloadFile\";\r\nimport { fileToFileInfo } from \"@/lib/utils/image/imageConverter\";\r\n\r\nconst galleryStyles = tv({\r\n\tbase: \"w-full\",\r\n\tslots: {\r\n\t\tcarouselContent: \"p-0.5\"\r\n\t}\r\n});\r\n\r\nexport interface GalleryProps extends React.HTMLAttributes<HTMLDivElement> {\r\n\t/** Размер галереи */\r\n\tsize?: \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\r\n\t/** Направление галереи */\r\n\torientation?: \"horizontal\" | \"vertical\";\r\n\t/** Массив изображений */\r\n\tvalues?: FileInfo[];\r\n\t/** Колбэк при изменении значений */\r\n\tonValueChange?: (values: FileInfo[]) => void;\r\n\t/** Колбэк при повторной попытке загрузки */\r\n\tonImageRetry?: (id: number) => void;\r\n\t/** Флаг только для чтения */\r\n\treadonly?: boolean;\r\n\t/** Количество плейсхолдеров */\r\n\tplaceholderCount?: number;\r\n\t/** Отключает возможность скачивания изображений из галереи */\r\n\tpreventDownload?: boolean;\r\n}\r\n\r\nexport const Gallery = React.forwardRef<HTMLDivElement, GalleryProps>(\r\n\t(\r\n\t\t{\r\n\t\t\tsize = \"md\",\r\n\t\t\torientation = \"horizontal\",\r\n\t\t\tvalues = [],\r\n\t\t\tonValueChange,\r\n\t\t\tonImageRetry,\r\n\t\t\treadonly = false,\r\n\t\t\tplaceholderCount = 10,\r\n\t\t\tclassName,\r\n\t\t\tpreventDownload,\r\n\t\t\t...props\r\n\t\t},\r\n\t\tref\r\n\t) => {\r\n\t\tconst styles = galleryStyles();\r\n\t\tconst [modalImage, setModalImage] = useState<FileInfo | null>(null);\r\n\r\n\t\tconst handleImageUpload = useCallback(\r\n\t\t\tasync (event: React.ChangeEvent<HTMLInputElement>) => {\r\n\t\t\t\tconst file = event.target.files?.[0];\r\n\t\t\t\tif (file) {\r\n\t\t\t\t\tconst newImage = fileToFileInfo(file);\r\n\t\t\t\t\tonValueChange?.([newImage, ...values]);\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t[onValueChange, values]\r\n\t\t);\r\n\r\n\t\tconst handleImageRemove = useCallback(\r\n\t\t\t(id: number) => {\r\n\t\t\t\tconst newValues = values.filter((value) => value.id !== id);\r\n\t\t\t\tonValueChange?.(newValues);\r\n\t\t\t},\r\n\t\t\t[onValueChange, values]\r\n\t\t);\r\n\r\n\t\tconst handleImageClick = useCallback((image: FileInfo) => {\r\n\t\t\tsetModalImage(image);\r\n\t\t}, []);\r\n\r\n\t\tconst handleImageDownload = useCallback((image: FileInfo) => downloadFile(image), []);\r\n\r\n\t\treturn (\r\n\t\t\t<div ref={ref} className={styles.base({ className })} {...props}>\r\n\t\t\t\t<Carousel size={size} orientation={orientation} opts={{ watchDrag: !!values.length }}>\r\n\t\t\t\t\t<CarouselContent className={styles.carouselContent()}>\r\n\t\t\t\t\t\t{!readonly && (\r\n\t\t\t\t\t\t\t<CarouselItem key=\"uploader\">\r\n\t\t\t\t\t\t\t\t<ImageUploader size={size} onChange={handleImageUpload} readonly={readonly} />\r\n\t\t\t\t\t\t\t</CarouselItem>\r\n\t\t\t\t\t\t)}\r\n\r\n\t\t\t\t\t\t{values.map((value, index) => (\r\n\t\t\t\t\t\t\t<CarouselItem key={index}>\r\n\t\t\t\t\t\t\t\t<ImagePreview\r\n\t\t\t\t\t\t\t\t\tsize={size}\r\n\t\t\t\t\t\t\t\t\turl={value.url}\r\n\t\t\t\t\t\t\t\t\talt={`Image ${value.id}`}\r\n\t\t\t\t\t\t\t\t\treadonly={readonly}\r\n\t\t\t\t\t\t\t\t\tonImageClick={() => handleImageClick(value)}\r\n\t\t\t\t\t\t\t\t\tonDownload={preventDownload ? undefined : () => handleImageDownload(value)}\r\n\t\t\t\t\t\t\t\t\tonClear={() => handleImageRemove(value.id)}\r\n\t\t\t\t\t\t\t\t\tonRetry={() => onImageRetry?.(value.id)}\r\n\t\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\t</CarouselItem>\r\n\t\t\t\t\t\t))}\r\n\r\n\t\t\t\t\t\t{Array.from({ length: placeholderCount - values.length }).map((_, index) => (\r\n\t\t\t\t\t\t\t<CarouselItem key={`placeholder-${index}`}>\r\n\t\t\t\t\t\t\t\t<ImagePlaceholder size={size} />\r\n\t\t\t\t\t\t\t</CarouselItem>\r\n\t\t\t\t\t\t))}\r\n\t\t\t\t\t</CarouselContent>\r\n\t\t\t\t</Carousel>\r\n\r\n\t\t\t\t<Modal open={!!modalImage} onOpenChange={(open) => !open && setModalImage(null)}>\r\n\t\t\t\t\t<ModalContent>\r\n\t\t\t\t\t\t<ModalHeader>\r\n\t\t\t\t\t\t\t<ModalTitle>{modalImage?.name}</ModalTitle>\r\n\t\t\t\t\t\t</ModalHeader>\r\n\t\t\t\t\t\t{modalImage && <img src={modalImage.url} alt={modalImage.name} />}\r\n\t\t\t\t\t</ModalContent>\r\n\t\t\t\t</Modal>\r\n\t\t\t</div>\r\n\t\t);\r\n\t}\r\n);\r\n\r\nGallery.displayName = \"Gallery\";\r\n"],"names":["fileToFileInfo","file","url","galleryStyles","tv","Gallery","React","_a","ref","_b","size","orientation","values","onValueChange","onImageRetry","readonly","placeholderCount","className","preventDownload","props","__objRest","styles","modalImage","setModalImage","useState","handleImageUpload","useCallback","event","__async","newImage","handleImageRemove","id","newValues","value","handleImageClick","image","handleImageDownload","downloadFile","jsxs","__spreadProps","__spreadValues","jsx","Carousel","CarouselContent","CarouselItem","ImageUploader","index","ImagePreview","_","ImagePlaceholder","Modal","open","ModalContent","ModalHeader","ModalTitle"],"mappings":";;;;;;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IAAI,CAACoC,GAAGF,MACjE,gBAAAL,EAACG,KACA,UAAC,gBAAAH,EAAAQ,GAAA,EAAiB,MAAAvC,EAAY,CAAA,KADZ,eAAeoC,CAAK,EAEvC,CACA;AAAA,MAAA,EAAA,CACF,EACD,CAAA;AAAA,MAEC,gBAAAL,EAAAS,GAAA,EAAM,MAAM,CAAC,CAAC5B,GAAY,cAAc,CAAC6B,MAAS,CAACA,KAAQ5B,EAAc,IAAI,GAC7E,4BAAC6B,GACA,EAAA,UAAA;AAAA,QAAA,gBAAAX,EAACY,GACA,EAAA,UAAA,gBAAAZ,EAACa,GAAY,EAAA,UAAAhC,KAAA,gBAAAA,EAAY,KAAK,CAAA,GAC/B;AAAA,QACCA,uBAAe,OAAI,EAAA,KAAKA,EAAW,KAAK,KAAKA,EAAW,KAAM,CAAA;AAAA,MAAA,EAAA,CAChE,EACD,CAAA;AAAA,IAAA,IACD;AAAA,EAAA;AAGH;AAEAjB,EAAQ,cAAc;"}
|
|
@@ -3,7 +3,8 @@ import * as React from "react";
|
|
|
3
3
|
interface IconTooltipProps {
|
|
4
4
|
content: React.ReactNode;
|
|
5
5
|
icon: LucideIcon;
|
|
6
|
+
iconSize?: "sm" | "md" | "lg";
|
|
6
7
|
className?: string;
|
|
7
8
|
}
|
|
8
|
-
export declare const IconTooltip: ({ content, icon, className }: IconTooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const IconTooltip: ({ content, icon, className, iconSize }: IconTooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
export {};
|
|
@@ -1,45 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
var o = Object.getOwnPropertySymbols;
|
|
3
|
-
var l = Object.prototype.hasOwnProperty, t = Object.prototype.propertyIsEnumerable;
|
|
4
|
-
var s = (e, a, r) => a in e ? i(e, a, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[a] = r, c = (e, a) => {
|
|
5
|
-
for (var r in a || (a = {}))
|
|
6
|
-
l.call(a, r) && s(e, r, a[r]);
|
|
7
|
-
if (o)
|
|
8
|
-
for (var r of o(a))
|
|
9
|
-
t.call(a, r) && s(e, r, a[r]);
|
|
10
|
-
return e;
|
|
11
|
-
};
|
|
12
|
-
var h = (e, a) => {
|
|
13
|
-
var r = {};
|
|
14
|
-
for (var m in e)
|
|
15
|
-
l.call(e, m) && a.indexOf(m) < 0 && (r[m] = e[m]);
|
|
16
|
-
if (e != null && o)
|
|
17
|
-
for (var m of o(e))
|
|
18
|
-
a.indexOf(m) < 0 && t.call(e, m) && (r[m] = e[m]);
|
|
19
|
-
return r;
|
|
20
|
-
};
|
|
21
|
-
import { jsx as p } from "react/jsx-runtime";
|
|
22
|
-
import f from "react";
|
|
23
|
-
import { c as w } from "../index-CR-odn5-.js";
|
|
24
|
-
const b = w({
|
|
25
|
-
base: "aspect-square rounded-xl border border-dashed border-primary-border",
|
|
26
|
-
variants: {
|
|
27
|
-
size: {
|
|
28
|
-
xs: "h-[3.75rem] w-[3.75rem]",
|
|
29
|
-
sm: "h-20 w-20",
|
|
30
|
-
md: "h-[7.5rem] w-[7.5rem]",
|
|
31
|
-
lg: "h-[11.5rem] w-[11.5rem]",
|
|
32
|
-
xl: "h-96 w-96"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}), n = f.forwardRef(
|
|
36
|
-
(x, m) => {
|
|
37
|
-
var d = x, { className: e, size: a } = d, r = h(d, ["className", "size"]);
|
|
38
|
-
return /* @__PURE__ */ p("div", c({ ref: m, className: b({ className: e, size: a }) }, r));
|
|
39
|
-
}
|
|
40
|
-
);
|
|
41
|
-
n.displayName = "ImagePlaceholder";
|
|
1
|
+
import { I as o } from "../ImagePlaceholder-CNAKQWTh.js";
|
|
42
2
|
export {
|
|
43
|
-
|
|
3
|
+
o as ImagePlaceholder
|
|
44
4
|
};
|
|
45
5
|
//# sourceMappingURL=image-placeholder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-placeholder.js","sources":[
|
|
1
|
+
{"version":3,"file":"image-placeholder.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
1
|
+
import { default as React, KeyboardEvent } from 'react';
|
|
2
2
|
import { VariantProps, TVReturnType } from 'tailwind-variants';
|
|
3
3
|
import { TVConfig } from 'tailwind-variants/dist/config.js';
|
|
4
4
|
declare const imagePreviewStyles: TVReturnType<{
|
|
@@ -181,16 +181,16 @@ declare const imagePreviewStyles: TVReturnType<{
|
|
|
181
181
|
};
|
|
182
182
|
};
|
|
183
183
|
}>, unknown, unknown, undefined>>;
|
|
184
|
-
export type ImagePreviewProps = React.
|
|
184
|
+
export type ImagePreviewProps = Omit<React.HTMLAttributes<HTMLDivElement>, "onClick"> & VariantProps<typeof imagePreviewStyles> & {
|
|
185
185
|
url: string;
|
|
186
186
|
alt: string;
|
|
187
187
|
readonly?: boolean;
|
|
188
|
-
onImageClick?: (e: React.MouseEvent<
|
|
188
|
+
onImageClick?: (e: React.MouseEvent<HTMLDivElement> | KeyboardEvent<HTMLDivElement>) => void;
|
|
189
189
|
onDownload?: (url: string) => void;
|
|
190
190
|
onRetry?: () => void;
|
|
191
191
|
onClear?: () => void;
|
|
192
192
|
};
|
|
193
|
-
export declare const ImagePreview: React.ForwardRefExoticComponent<React.
|
|
193
|
+
export declare const ImagePreview: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLDivElement>, "onClick"> & VariantProps< TVReturnType<{
|
|
194
194
|
error: {
|
|
195
195
|
true: {
|
|
196
196
|
container: string;
|
|
@@ -373,9 +373,9 @@ export declare const ImagePreview: React.ForwardRefExoticComponent<React.ButtonH
|
|
|
373
373
|
url: string;
|
|
374
374
|
alt: string;
|
|
375
375
|
readonly?: boolean;
|
|
376
|
-
onImageClick?: (e: React.MouseEvent<
|
|
376
|
+
onImageClick?: (e: React.MouseEvent<HTMLDivElement> | KeyboardEvent<HTMLDivElement>) => void;
|
|
377
377
|
onDownload?: (url: string) => void;
|
|
378
378
|
onRetry?: () => void;
|
|
379
379
|
onClear?: () => void;
|
|
380
|
-
} & React.RefAttributes<
|
|
380
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
381
381
|
export {};
|
|
@@ -1,139 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
var S = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var u = Object.getOwnPropertySymbols;
|
|
4
|
-
var x = Object.prototype.hasOwnProperty, k = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var v = (t, e, r) => e in t ? L(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, d = (t, e) => {
|
|
6
|
-
for (var r in e || (e = {}))
|
|
7
|
-
x.call(e, r) && v(t, r, e[r]);
|
|
8
|
-
if (u)
|
|
9
|
-
for (var r of u(e))
|
|
10
|
-
k.call(e, r) && v(t, r, e[r]);
|
|
11
|
-
return t;
|
|
12
|
-
}, f = (t, e) => O(t, S(e));
|
|
13
|
-
var h = (t, e) => {
|
|
14
|
-
var r = {};
|
|
15
|
-
for (var a in t)
|
|
16
|
-
x.call(t, a) && e.indexOf(a) < 0 && (r[a] = t[a]);
|
|
17
|
-
if (t != null && u)
|
|
18
|
-
for (var a of u(t))
|
|
19
|
-
e.indexOf(a) < 0 && k.call(t, a) && (r[a] = t[a]);
|
|
20
|
-
return r;
|
|
21
|
-
};
|
|
22
|
-
import { jsx as s, jsxs as w } from "react/jsx-runtime";
|
|
23
|
-
import I, { useCallback as b } from "react";
|
|
24
|
-
import { c as N } from "../index-CR-odn5-.js";
|
|
25
|
-
import { B as W } from "../Button-DhfE69q0.js";
|
|
26
|
-
import { I as P } from "../Icon-CSPBHL_x.js";
|
|
27
|
-
import { c as j } from "../createLucideIcon-DgrNxRV5.js";
|
|
28
|
-
import { D as _ } from "../download-CVOGyQ0e.js";
|
|
29
|
-
import { X as A } from "../x-JgjNP5oH.js";
|
|
30
|
-
/**
|
|
31
|
-
* @license lucide-react v0.460.0 - ISC
|
|
32
|
-
*
|
|
33
|
-
* This source code is licensed under the ISC license.
|
|
34
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
35
|
-
*/
|
|
36
|
-
const H = j("ImageOff", [
|
|
37
|
-
["line", { x1: "2", x2: "22", y1: "2", y2: "22", key: "a6p6uj" }],
|
|
38
|
-
["path", { d: "M10.41 10.41a2 2 0 1 1-2.83-2.83", key: "1bzlo9" }],
|
|
39
|
-
["line", { x1: "13.5", x2: "6", y1: "13.5", y2: "21", key: "1q0aeu" }],
|
|
40
|
-
["line", { x1: "18", x2: "21", y1: "12", y2: "15", key: "5mozeu" }],
|
|
41
|
-
[
|
|
42
|
-
"path",
|
|
43
|
-
{
|
|
44
|
-
d: "M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",
|
|
45
|
-
key: "mmje98"
|
|
46
|
-
}
|
|
47
|
-
],
|
|
48
|
-
["path", { d: "M21 15V5a2 2 0 0 0-2-2H9", key: "43el77" }]
|
|
49
|
-
]);
|
|
50
|
-
/**
|
|
51
|
-
* @license lucide-react v0.460.0 - ISC
|
|
52
|
-
*
|
|
53
|
-
* This source code is licensed under the ISC license.
|
|
54
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
55
|
-
*/
|
|
56
|
-
const V = j("RotateCw", [
|
|
57
|
-
["path", { d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8", key: "1p45f6" }],
|
|
58
|
-
["path", { d: "M21 3v5h-5", key: "1q7to0" }]
|
|
59
|
-
]), X = N({
|
|
60
|
-
slots: {
|
|
61
|
-
container: "h-4 w-4 rounded-full border border-muted bg-primary-bg p-1",
|
|
62
|
-
icon: "h-2 w-2 text-muted"
|
|
63
|
-
}
|
|
64
|
-
}), p = I.forwardRef(
|
|
65
|
-
(g, i) => {
|
|
66
|
-
var c = g, { className: t, onClick: e, icon: r } = c, a = h(c, ["className", "onClick", "icon"]);
|
|
67
|
-
const l = X();
|
|
68
|
-
return /* @__PURE__ */ s(
|
|
69
|
-
W,
|
|
70
|
-
f(d({
|
|
71
|
-
variant: "outline",
|
|
72
|
-
ref: i,
|
|
73
|
-
className: l.container({ className: t }),
|
|
74
|
-
onClick: e
|
|
75
|
-
}, a), {
|
|
76
|
-
children: /* @__PURE__ */ s(P, { className: l.icon(), icon: r })
|
|
77
|
-
})
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
);
|
|
81
|
-
p.displayName = "ImageUploaderButton";
|
|
82
|
-
const D = N({
|
|
83
|
-
slots: {
|
|
84
|
-
container: "group relative flex aspect-square cursor-pointer items-center justify-center rounded-xl outline-none focus-visible:shadow-focus",
|
|
85
|
-
image: "aspect-square h-full rounded-xl",
|
|
86
|
-
buttonWrapper: "absolute right-1 top-1 flex gap-1",
|
|
87
|
-
icon: "h-8 w-8 text-muted",
|
|
88
|
-
overlay: "absolute inset-0 rounded-xl group-hover:bg-slate-900/20"
|
|
89
|
-
},
|
|
90
|
-
variants: {
|
|
91
|
-
error: {
|
|
92
|
-
true: {
|
|
93
|
-
container: "border border-status-error-secondary-border hover:border-status-error-primary-border hover:bg-status-error-bg focus-visible:border-status-error-secondary-border focus-visible:shadow-focus-error"
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
size: {
|
|
97
|
-
xs: { container: "h-[3.75rem] w-[3.75rem]" },
|
|
98
|
-
sm: { container: "h-20 w-20" },
|
|
99
|
-
md: { container: "h-[7.5rem] w-[7.5rem]" },
|
|
100
|
-
lg: { container: "h-[11.5rem] w-[11.5rem]" },
|
|
101
|
-
xl: { container: "h-96 w-96" }
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}), E = I.forwardRef(
|
|
105
|
-
(F, q) => {
|
|
106
|
-
var y = F, { className: t, error: e, readonly: r, onClear: a, onRetry: i, size: g, url: c, alt: l, onImageClick: B, onDownload: n } = y, M = h(y, ["className", "error", "readonly", "onClear", "onRetry", "size", "url", "alt", "onImageClick", "onDownload"]);
|
|
107
|
-
const m = D({ className: t, size: g, error: e }), z = b(
|
|
108
|
-
(o) => {
|
|
109
|
-
o.preventDefault(), o.stopPropagation(), n == null || n(c);
|
|
110
|
-
},
|
|
111
|
-
[n, c]
|
|
112
|
-
), U = b(
|
|
113
|
-
(o) => {
|
|
114
|
-
o.preventDefault(), o.stopPropagation(), a == null || a();
|
|
115
|
-
},
|
|
116
|
-
[a]
|
|
117
|
-
), C = b(
|
|
118
|
-
(o) => {
|
|
119
|
-
o.preventDefault(), o.stopPropagation(), i == null || i();
|
|
120
|
-
},
|
|
121
|
-
[i]
|
|
122
|
-
);
|
|
123
|
-
return /* @__PURE__ */ w("button", f(d({ ref: q, className: m.container(), onClick: B }, M), { children: [
|
|
124
|
-
!e && /* @__PURE__ */ s("img", { src: c, alt: l, className: m.image() }),
|
|
125
|
-
!e && /* @__PURE__ */ s("div", { className: m.overlay() }),
|
|
126
|
-
e && /* @__PURE__ */ s(P, { icon: H, className: m.icon() }),
|
|
127
|
-
/* @__PURE__ */ w("div", { className: m.buttonWrapper(), children: [
|
|
128
|
-
!e && n && /* @__PURE__ */ s(p, { icon: _, onClick: z }),
|
|
129
|
-
e && i && /* @__PURE__ */ s(p, { icon: V, onClick: C }),
|
|
130
|
-
!r && a && /* @__PURE__ */ s(p, { icon: A, onClick: U })
|
|
131
|
-
] })
|
|
132
|
-
] }));
|
|
133
|
-
}
|
|
134
|
-
);
|
|
135
|
-
E.displayName = "ImagePreview";
|
|
1
|
+
import { I as a } from "../ImagePreview-DHi7A8md.js";
|
|
136
2
|
export {
|
|
137
|
-
|
|
3
|
+
a as ImagePreview
|
|
138
4
|
};
|
|
139
5
|
//# sourceMappingURL=image-preview.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-preview.js","sources":["../../node_modules/.pnpm/lucide-react@0.460.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/image-off.js","../../node_modules/.pnpm/lucide-react@0.460.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/rotate-cw.js","../../src/components/image-uploader/components/ImageUploaderButton.tsx","../../src/components/image-preview/ImagePreview.tsx"],"sourcesContent":["/**\n * @license lucide-react v0.460.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst ImageOff = createLucideIcon(\"ImageOff\", [\n [\"line\", { x1: \"2\", x2: \"22\", y1: \"2\", y2: \"22\", key: \"a6p6uj\" }],\n [\"path\", { d: \"M10.41 10.41a2 2 0 1 1-2.83-2.83\", key: \"1bzlo9\" }],\n [\"line\", { x1: \"13.5\", x2: \"6\", y1: \"13.5\", y2: \"21\", key: \"1q0aeu\" }],\n [\"line\", { x1: \"18\", x2: \"21\", y1: \"12\", y2: \"15\", key: \"5mozeu\" }],\n [\n \"path\",\n {\n d: \"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59\",\n key: \"mmje98\"\n }\n ],\n [\"path\", { d: \"M21 15V5a2 2 0 0 0-2-2H9\", key: \"43el77\" }]\n]);\n\nexport { ImageOff as default };\n//# sourceMappingURL=image-off.js.map\n","/**\n * @license lucide-react v0.460.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst RotateCw = createLucideIcon(\"RotateCw\", [\n [\"path\", { d: \"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8\", key: \"1p45f6\" }],\n [\"path\", { d: \"M21 3v5h-5\", key: \"1q7to0\" }]\n]);\n\nexport { RotateCw as default };\n//# sourceMappingURL=rotate-cw.js.map\n","import { Button } from \"@/components/button\";\r\nimport { Icon } from \"@/components/icon\";\r\nimport { LucideIcon } from \"lucide-react\";\r\nimport React from \"react\";\r\nimport { tv, VariantProps } from \"tailwind-variants\";\r\n\r\nconst imageUploaderButtonStyles = tv({\r\n\tslots: {\r\n\t\tcontainer: \"h-4 w-4 rounded-full border border-muted bg-primary-bg p-1\",\r\n\t\ticon: \"h-2 w-2 text-muted\"\r\n\t}\r\n});\r\n\r\nexport type ImageUploaderButtonProps = React.HTMLAttributes<HTMLButtonElement> &\r\n\tVariantProps<typeof imageUploaderButtonStyles> & {\r\n\t\ticon: LucideIcon;\r\n\t};\r\n\r\nexport const ImageUploaderButton = React.forwardRef<HTMLButtonElement, ImageUploaderButtonProps>(\r\n\t({ className, onClick, icon, ...props }, ref) => {\r\n\t\tconst styles = imageUploaderButtonStyles();\r\n\r\n\t\treturn (\r\n\t\t\t<Button\r\n\t\t\t\tvariant=\"outline\"\r\n\t\t\t\tref={ref}\r\n\t\t\t\tclassName={styles.container({ className })}\r\n\t\t\t\tonClick={onClick}\r\n\t\t\t\t{...props}\r\n\t\t\t>\r\n\t\t\t\t<Icon className={styles.icon()} icon={icon} />\r\n\t\t\t</Button>\r\n\t\t);\r\n\t}\r\n);\r\n\r\nImageUploaderButton.displayName = \"ImageUploaderButton\";\r\n","import React, { useCallback } from \"react\";\r\nimport { tv, VariantProps } from \"tailwind-variants\";\r\nimport { ImageUploaderButton } from \"../image-uploader/components/ImageUploaderButton\";\r\nimport { Download, ImageOff, RotateCw, X } from \"lucide-react\";\r\nimport { Icon } from \"../icon\";\r\n\r\nconst imagePreviewStyles = tv({\r\n\tslots: {\r\n\t\tcontainer:\r\n\t\t\t\"group relative flex aspect-square cursor-pointer items-center justify-center rounded-xl outline-none focus-visible:shadow-focus\",\r\n\t\timage: \"aspect-square h-full rounded-xl\",\r\n\t\tbuttonWrapper: \"absolute right-1 top-1 flex gap-1\",\r\n\t\ticon: \"h-8 w-8 text-muted\",\r\n\t\toverlay: \"absolute inset-0 rounded-xl group-hover:bg-slate-900/20\"\r\n\t},\r\n\tvariants: {\r\n\t\terror: {\r\n\t\t\ttrue: {\r\n\t\t\t\tcontainer:\r\n\t\t\t\t\t\"border border-status-error-secondary-border hover:border-status-error-primary-border hover:bg-status-error-bg focus-visible:border-status-error-secondary-border focus-visible:shadow-focus-error\"\r\n\t\t\t}\r\n\t\t},\r\n\t\tsize: {\r\n\t\t\txs: { container: \"h-[3.75rem] w-[3.75rem]\" },\r\n\t\t\tsm: { container: \"h-20 w-20\" },\r\n\t\t\tmd: { container: \"h-[7.5rem] w-[7.5rem]\" },\r\n\t\t\tlg: { container: \"h-[11.5rem] w-[11.5rem]\" },\r\n\t\t\txl: { container: \"h-96 w-96\" }\r\n\t\t}\r\n\t}\r\n});\r\n\r\nexport type ImagePreviewProps = React.ButtonHTMLAttributes<HTMLButtonElement> &\r\n\tVariantProps<typeof imagePreviewStyles> & {\r\n\t\turl: string;\r\n\t\talt: string;\r\n\t\treadonly?: boolean;\r\n\t\tonImageClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;\r\n\t\tonDownload?: (url: string) => void;\r\n\t\tonRetry?: () => void;\r\n\t\tonClear?: () => void;\r\n\t};\r\n\r\nexport const ImagePreview = React.forwardRef<HTMLButtonElement, ImagePreviewProps>(\r\n\t({ className, error, readonly, onClear, onRetry, size, url, alt, onImageClick, onDownload, ...props }, ref) => {\r\n\t\tconst styles = imagePreviewStyles({ className, size, error });\r\n\r\n\t\tconst handleDownload = useCallback(\r\n\t\t\t(e: React.MouseEvent<HTMLButtonElement>) => {\r\n\t\t\t\te.preventDefault();\r\n\t\t\t\te.stopPropagation();\r\n\t\t\t\tonDownload?.(url);\r\n\t\t\t},\r\n\t\t\t[onDownload, url]\r\n\t\t);\r\n\r\n\t\tconst handleClear = useCallback(\r\n\t\t\t(e: React.MouseEvent<HTMLButtonElement>) => {\r\n\t\t\t\te.preventDefault();\r\n\t\t\t\te.stopPropagation();\r\n\t\t\t\tonClear?.();\r\n\t\t\t},\r\n\t\t\t[onClear]\r\n\t\t);\r\n\r\n\t\tconst handleRetry = useCallback(\r\n\t\t\t(e: React.MouseEvent<HTMLButtonElement>) => {\r\n\t\t\t\te.preventDefault();\r\n\t\t\t\te.stopPropagation();\r\n\t\t\t\tonRetry?.();\r\n\t\t\t},\r\n\t\t\t[onRetry]\r\n\t\t);\r\n\r\n\t\treturn (\r\n\t\t\t<button ref={ref} className={styles.container()} onClick={onImageClick} {...props}>\r\n\t\t\t\t{!error && <img src={url} alt={alt} className={styles.image()} />}\r\n\t\t\t\t{!error && <div className={styles.overlay()} />}\r\n\r\n\t\t\t\t{error && <Icon icon={ImageOff} className={styles.icon()} />}\r\n\r\n\t\t\t\t<div className={styles.buttonWrapper()}>\r\n\t\t\t\t\t{!error && onDownload && <ImageUploaderButton icon={Download} onClick={handleDownload} />}\r\n\t\t\t\t\t{error && onRetry && <ImageUploaderButton icon={RotateCw} onClick={handleRetry} />}\r\n\t\t\t\t\t{!readonly && onClear && <ImageUploaderButton icon={X} onClick={handleClear} />}\r\n\t\t\t\t</div>\r\n\t\t\t</button>\r\n\t\t);\r\n\t}\r\n);\r\n\r\nImagePreview.displayName = \"ImagePreview\";\r\n"],"names":["ImageOff","createLucideIcon","RotateCw","imageUploaderButtonStyles","tv","ImageUploaderButton","React","_a","ref","_b","className","onClick","icon","props","__objRest","styles","jsx","Button","__spreadProps","__spreadValues","Icon","imagePreviewStyles","ImagePreview","error","readonly","onClear","onRetry","size","url","alt","onImageClick","onDownload","handleDownload","useCallback","e","handleClear","handleRetry","jsxs","Download","X"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,IAAWC,EAAiB,YAAY;AAAA,EAC5C,CAAC,QAAQ,EAAE,IAAI,KAAK,IAAI,MAAM,IAAI,KAAK,IAAI,MAAM,KAAK,SAAQ,CAAE;AAAA,EAChE,CAAC,QAAQ,EAAE,GAAG,oCAAoC,KAAK,SAAQ,CAAE;AAAA,EACjE,CAAC,QAAQ,EAAE,IAAI,QAAQ,IAAI,KAAK,IAAI,QAAQ,IAAI,MAAM,KAAK,SAAQ,CAA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AAOnB,EAAAC,EAAA,EAAA,KAAAX,GAAU,WAAWO,EAAO,aAAa,SAASe,KAAkBjB,IAApE,EACN,UAAA;AAAA,MAAC,CAAAU,uBAAU,OAAI,EAAA,KAAKK,GAAK,KAAAC,GAAU,WAAWd,EAAO,MAAS,EAAA,CAAA;AAAA,MAC9D,CAACQ,KAAS,gBAAAP,EAAC,SAAI,WAAWD,EAAO,WAAW;AAAA,MAE5CQ,uBAAUH,GAAK,EAAA,MAAMpB,GAAU,WAAWe,EAAO,QAAQ;AAAA,MAEzD,gBAAAsB,EAAA,OAAA,EAAI,WAAWtB,EAAO,cACrB,GAAA,UAAA;AAAA,QAAA,CAACQ,KAASQ,KAAc,gBAAAf,EAACX,KAAoB,MAAMiC,GAAU,SAASN,GAAgB;AAAA,QACtFT,KAASG,KAAW,gBAAAV,EAACX,KAAoB,MAAMH,GAAU,SAASkC,GAAa;AAAA,QAC/E,CAACZ,KAAYC,KAAW,gBAAAT,EAACX,KAAoB,MAAMkC,GAAG,SAASJ,EAAa,CAAA;AAAA,MAAA,EAC9E,CAAA;AAAA,IAAA,IACD;AAAA,EAAA;AAGH;AAEAb,EAAa,cAAc;","x_google_ignoreList":[0,1]}
|
|
1
|
+
{"version":3,"file":"image-preview.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,121 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
var y = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var c = Object.getOwnPropertySymbols;
|
|
4
|
-
var l = Object.prototype.hasOwnProperty, C = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var u = (r, o, e) => o in r ? x(r, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[o] = e, d = (r, o) => {
|
|
6
|
-
for (var e in o || (o = {}))
|
|
7
|
-
l.call(o, e) && u(r, e, o[e]);
|
|
8
|
-
if (c)
|
|
9
|
-
for (var e of c(o))
|
|
10
|
-
C.call(o, e) && u(r, e, o[e]);
|
|
11
|
-
return r;
|
|
12
|
-
}, h = (r, o) => w(r, y(o));
|
|
13
|
-
var p = (r, o) => {
|
|
14
|
-
var e = {};
|
|
15
|
-
for (var t in r)
|
|
16
|
-
l.call(r, t) && o.indexOf(t) < 0 && (e[t] = r[t]);
|
|
17
|
-
if (r != null && c)
|
|
18
|
-
for (var t of c(r))
|
|
19
|
-
o.indexOf(t) < 0 && C.call(r, t) && (e[t] = r[t]);
|
|
20
|
-
return e;
|
|
21
|
-
};
|
|
22
|
-
import { jsx as a, jsxs as H } from "react/jsx-runtime";
|
|
23
|
-
import L, { useRef as I } from "react";
|
|
24
|
-
import { c as V } from "../index-CR-odn5-.js";
|
|
25
|
-
import { B as k } from "../Button-DhfE69q0.js";
|
|
26
|
-
import { I as N } from "../Icon-CSPBHL_x.js";
|
|
27
|
-
import { c as M } from "../utils-DGzAmwok.js";
|
|
28
|
-
import { c as R } from "../createLucideIcon-DgrNxRV5.js";
|
|
29
|
-
/**
|
|
30
|
-
* @license lucide-react v0.460.0 - ISC
|
|
31
|
-
*
|
|
32
|
-
* This source code is licensed under the ISC license.
|
|
33
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
34
|
-
*/
|
|
35
|
-
const Z = R("Image", [
|
|
36
|
-
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
|
|
37
|
-
["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
|
|
38
|
-
["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
|
|
39
|
-
]), j = ({ className: r }) => /* @__PURE__ */ a(
|
|
40
|
-
"svg",
|
|
41
|
-
{
|
|
42
|
-
width: "24",
|
|
43
|
-
height: "24",
|
|
44
|
-
viewBox: "0 0 24 24",
|
|
45
|
-
fill: "none",
|
|
46
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
47
|
-
className: r,
|
|
48
|
-
children: /* @__PURE__ */ a(
|
|
49
|
-
"path",
|
|
50
|
-
{
|
|
51
|
-
d: "M19.9609 13.4961C20.375 13.4963 20.7109 13.832 20.7109 14.2461V16.6309H23.2539C23.6679 16.631 24.0038 16.9668 24.0039 17.3809C24.0037 17.7948 23.6679 18.1307 23.2539 18.1309H20.7109V20.5166C20.7106 20.9304 20.3748 21.2664 19.9609 21.2666C19.547 21.2666 19.2113 20.9305 19.2109 20.5166V18.1309H16.668C16.2539 18.1309 15.9182 17.7949 15.918 17.3809C15.9181 16.9668 16.2538 16.6309 16.668 16.6309H19.2109V14.2461C19.2109 13.8319 19.5467 13.4961 19.9609 13.4961ZM12.8369 2.00391C13.0231 2.02397 13.1967 2.11347 13.3213 2.25586L15.499 4.74316H18.04L18.2998 4.75586C18.9025 4.81284 19.4747 5.06626 19.915 5.48535C20.4195 5.96579 20.7109 6.62622 20.7109 7.32227V10.375C20.7107 10.7889 20.3748 11.1248 19.9609 11.125C19.5469 11.125 19.2112 10.789 19.2109 10.375V7.32227C19.2109 7.04851 19.0965 6.77772 18.8809 6.57227C18.6909 6.39143 18.4358 6.27523 18.1592 6.24902L18.04 6.24316H15.1582C14.9421 6.24316 14.7362 6.14977 14.5938 5.9873L12.416 3.5H8.29492L6.11719 5.9873C5.97483 6.14984 5.7688 6.24309 5.55273 6.24316H2.6709C2.34886 6.24321 2.04714 6.36568 1.83008 6.57227C1.6143 6.77775 1.5 7.04841 1.5 7.32227V15.5518C1.50013 15.8255 1.61435 16.0974 1.83008 16.3027C2.04709 16.509 2.34916 16.6308 2.6709 16.6309H12.8252L12.9023 16.6348C13.2801 16.6735 13.5751 16.9929 13.5752 17.3809C13.575 17.7688 13.2801 18.0883 12.9023 18.127L12.8252 18.1309H2.6709C1.97437 18.1308 1.29923 17.8676 0.795898 17.3887C0.291323 16.9083 0.000130854 16.2478 0 15.5518V7.32227C0 6.62613 0.291286 5.96581 0.795898 5.48535C1.29925 5.00637 1.97432 4.74321 2.6709 4.74316H5.21191L7.38965 2.25586L7.44629 2.19824C7.584 2.0715 7.765 2 7.9541 2H12.7568L12.8369 2.00391ZM10.3555 7.48633C12.3259 7.48647 13.9873 9.01692 13.9873 10.9805C13.9868 12.9436 12.3255 14.4735 10.3555 14.4736C8.38527 14.4736 6.72416 12.9437 6.72363 10.9805C6.72363 9.01682 8.38496 7.48633 10.3555 7.48633ZM10.3555 8.98633C9.14302 8.98633 8.22363 9.91391 8.22363 10.9805C8.22417 12.0466 9.14338 12.9736 10.3555 12.9736C11.5674 12.9735 12.4868 12.0466 12.4873 10.9805C12.4873 9.91399 11.5678 8.98647 10.3555 8.98633Z",
|
|
52
|
-
fill: "currentColor"
|
|
53
|
-
}
|
|
54
|
-
)
|
|
55
|
-
}
|
|
56
|
-
), B = V({
|
|
57
|
-
slots: {
|
|
58
|
-
container: "group relative flex aspect-square items-center justify-center rounded-xl p-6 focus-visible:shadow-focus focus-visible:ring-0",
|
|
59
|
-
icon: "h-8 w-8 stroke-[1.5px] text-muted group-hover:text-primary",
|
|
60
|
-
input: "hidden",
|
|
61
|
-
customIcon: "translate-x-0.5 translate-y-0.5"
|
|
62
|
-
},
|
|
63
|
-
variants: {
|
|
64
|
-
readonly: {
|
|
65
|
-
true: {
|
|
66
|
-
container: "cursor-default bg-secondary-bg-hover hover:border-secondary-border hover:shadow-sm focus-visible:bg-secondary-bg-hover",
|
|
67
|
-
icon: "group-hover:text-muted"
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
error: {
|
|
71
|
-
true: {
|
|
72
|
-
container: "border-status-error-secondary-border hover:border-status-error-primary-border hover:bg-status-error-bg focus-visible:border-status-error-secondary-border focus-visible:shadow-focus-error",
|
|
73
|
-
icon: "group-hover:text-muted"
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
size: {
|
|
77
|
-
xs: { container: "h-[3.75rem] w-[3.75rem]" },
|
|
78
|
-
sm: { container: "h-20 w-20" },
|
|
79
|
-
md: { container: "h-[7.5rem] w-[7.5rem]" },
|
|
80
|
-
lg: { container: "h-[11.5rem] w-[11.5rem]" },
|
|
81
|
-
xl: { container: "h-96 w-96" }
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}), U = L.forwardRef(
|
|
85
|
-
(S, b) => {
|
|
86
|
-
var n = S, { className: r, error: o, readonly: e, size: t, onChange: f, whiteList: g = "image/*" } = n, v = p(n, ["className", "error", "readonly", "size", "onChange", "whiteList"]);
|
|
87
|
-
const i = I(null), s = B({ className: r, readonly: e, error: o, size: t });
|
|
88
|
-
return /* @__PURE__ */ H(
|
|
89
|
-
k,
|
|
90
|
-
h(d({
|
|
91
|
-
ref: b,
|
|
92
|
-
variant: "outline",
|
|
93
|
-
className: s.container(),
|
|
94
|
-
onClick: () => {
|
|
95
|
-
var m;
|
|
96
|
-
return !e && ((m = i.current) == null ? void 0 : m.click());
|
|
97
|
-
}
|
|
98
|
-
}, v), {
|
|
99
|
-
children: [
|
|
100
|
-
/* @__PURE__ */ a(
|
|
101
|
-
"input",
|
|
102
|
-
{
|
|
103
|
-
ref: i,
|
|
104
|
-
type: "file",
|
|
105
|
-
className: s.input(),
|
|
106
|
-
onChange: f,
|
|
107
|
-
accept: g
|
|
108
|
-
}
|
|
109
|
-
),
|
|
110
|
-
e && /* @__PURE__ */ a(N, { icon: Z, className: s.icon() }),
|
|
111
|
-
!e && /* @__PURE__ */ a(j, { className: M(s.icon(), s.customIcon()) })
|
|
112
|
-
]
|
|
113
|
-
})
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
);
|
|
117
|
-
U.displayName = "ImageUploader";
|
|
1
|
+
import { I as o } from "../ImageUploader-46sxdmt5.js";
|
|
118
2
|
export {
|
|
119
|
-
|
|
3
|
+
o as ImageUploader
|
|
120
4
|
};
|
|
121
5
|
//# sourceMappingURL=image-uploader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-uploader.js","sources":[
|
|
1
|
+
{"version":3,"file":"image-uploader.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
/** Упрощенная информация о файле */
|
|
3
3
|
export interface FileInfo {
|
|
4
|
+
/** id файла */
|
|
5
|
+
id: number;
|
|
4
6
|
/** Имя файла */
|
|
5
7
|
name: string;
|
|
6
8
|
/** URL для скачивания или просмотра файла */
|
|
7
|
-
url
|
|
9
|
+
url: string;
|
|
8
10
|
/** Размер файла в байтах (опционально) */
|
|
9
11
|
size?: number;
|
|
10
12
|
/** MIME-тип файла (опционально) */
|