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.
Files changed (227) hide show
  1. package/dist/Button-DQtBfU9y.js +57 -0
  2. package/dist/Button-DQtBfU9y.js.map +1 -0
  3. package/dist/{Button-DhfE69q0.js → ButtonBase-BEM8SNmT.js} +27 -56
  4. package/dist/ButtonBase-BEM8SNmT.js.map +1 -0
  5. package/dist/CarouselItem-pSHe0ufN.js +1500 -0
  6. package/dist/CarouselItem-pSHe0ufN.js.map +1 -0
  7. package/dist/CheckboxField-i_-dPpFM.js +370 -0
  8. package/dist/CheckboxField-i_-dPpFM.js.map +1 -0
  9. package/dist/Divider-C0Ss5GJT.js +47 -0
  10. package/dist/{Divider-D3NvaU8c.js.map → Divider-C0Ss5GJT.js.map} +1 -1
  11. package/dist/Field-3XJNFTql.js +78 -0
  12. package/dist/Field-3XJNFTql.js.map +1 -0
  13. package/dist/FieldLabel-CAbVan3E.js +97 -0
  14. package/dist/FieldLabel-CAbVan3E.js.map +1 -0
  15. package/dist/FormBody-4HptEjhb.js +103 -0
  16. package/dist/FormBody-4HptEjhb.js.map +1 -0
  17. package/dist/{IconButton-BUPs2kEo.js → IconButton-BkBsOIf5.js} +15 -15
  18. package/dist/{IconButton-BUPs2kEo.js.map → IconButton-BkBsOIf5.js.map} +1 -1
  19. package/dist/ImagePlaceholder-CNAKQWTh.js +45 -0
  20. package/dist/ImagePlaceholder-CNAKQWTh.js.map +1 -0
  21. package/dist/ImagePreview-DHi7A8md.js +156 -0
  22. package/dist/ImagePreview-DHi7A8md.js.map +1 -0
  23. package/dist/ImageUploader-46sxdmt5.js +123 -0
  24. package/dist/ImageUploader-46sxdmt5.js.map +1 -0
  25. package/dist/IsolatedStylesWrapper-WgaoHh7y.js +179 -0
  26. package/dist/IsolatedStylesWrapper-WgaoHh7y.js.map +1 -0
  27. package/dist/Modal-D33MSQot.js +125 -0
  28. package/dist/Modal-D33MSQot.js.map +1 -0
  29. package/dist/ScrollShadowContainer-ByNH68Kg.js +636 -0
  30. package/dist/ScrollShadowContainer-ByNH68Kg.js.map +1 -0
  31. package/dist/Toggle-7AlEmn8A.js +104 -0
  32. package/dist/Toggle-7AlEmn8A.js.map +1 -0
  33. package/dist/ToggleGroup-CT453MNp.js +200 -0
  34. package/dist/ToggleGroup-CT453MNp.js.map +1 -0
  35. package/dist/Tooltip-C4BbGF2_.js +372 -0
  36. package/dist/Tooltip-C4BbGF2_.js.map +1 -0
  37. package/dist/{bundle-mjs-D6wdQkGI.js → bundle-mjs-LhQum_e3.js} +676 -425
  38. package/dist/bundle-mjs-LhQum_e3.js.map +1 -0
  39. package/dist/check-C-TqZgvb.js.map +1 -1
  40. package/dist/chevron-right-CobOebzi.js.map +1 -1
  41. package/dist/components/badge.js +1 -1
  42. package/dist/components/button/icon-button/IconButton.stories.d.ts +330 -2
  43. package/dist/components/button/loading-button/LoadingButton.d.ts +249 -0
  44. package/dist/components/button/loading-button/LoadingButton.stories.d.ts +219 -0
  45. package/dist/components/button.js +6 -5
  46. package/dist/components/button.js.map +1 -1
  47. package/dist/components/carousel.js +65 -1532
  48. package/dist/components/carousel.js.map +1 -1
  49. package/dist/components/checkbox.js +1 -1
  50. package/dist/components/divider/content-divider/ContentDivider.d.ts +14 -0
  51. package/dist/components/divider/content-divider/ContentDivider.stories.d.ts +7 -0
  52. package/dist/components/divider/index.d.ts +1 -0
  53. package/dist/components/divider.js +45 -2
  54. package/dist/components/divider.js.map +1 -1
  55. package/dist/components/drawer/templates/drawer-footer-template/DrawerFooterTemplate.d.ts +3 -0
  56. package/dist/components/drawer.js +450 -447
  57. package/dist/components/drawer.js.map +1 -1
  58. package/dist/components/dropdown.js +37 -33
  59. package/dist/components/dropdown.js.map +1 -1
  60. package/dist/components/empty-state/EmptyState.d.ts +2 -2
  61. package/dist/components/empty-state.js +1 -1
  62. package/dist/components/empty-state.js.map +1 -1
  63. package/dist/components/field/Field.d.ts +35 -0
  64. package/dist/components/field.js +1 -1
  65. package/dist/components/form/components/form-header/FormHeader.d.ts +2 -2
  66. package/dist/components/form.js +289 -288
  67. package/dist/components/form.js.map +1 -1
  68. package/dist/components/gallery/Gallery.d.ts +21 -0
  69. package/dist/components/gallery/Gallery.stories.d.ts +26 -0
  70. package/dist/components/gallery/index.d.ts +1 -0
  71. package/dist/components/gallery.d.ts +2 -0
  72. package/dist/components/gallery.js +130 -0
  73. package/dist/components/gallery.js.map +1 -0
  74. package/dist/components/icon-tooltip/IconTooltip.d.ts +2 -1
  75. package/dist/components/image-placeholder.js +2 -42
  76. package/dist/components/image-placeholder.js.map +1 -1
  77. package/dist/components/image-preview/ImagePreview.d.ts +6 -6
  78. package/dist/components/image-preview.js +2 -136
  79. package/dist/components/image-preview.js.map +1 -1
  80. package/dist/components/image-uploader.js +2 -118
  81. package/dist/components/image-uploader.js.map +1 -1
  82. package/dist/components/input/file-input/FileInput.d.ts +3 -1
  83. package/dist/components/input-otp.js +1 -1
  84. package/dist/components/input-otp.js.map +1 -1
  85. package/dist/components/input.js +176 -195
  86. package/dist/components/input.js.map +1 -1
  87. package/dist/components/isolated-styles-wrapper/IsolatedStylesWrapper.d.ts +1 -1
  88. package/dist/components/label/Label.stories.d.ts +0 -2
  89. package/dist/components/label/field-label/FieldLabel.d.ts +11 -0
  90. package/dist/components/label/field-label/FieldLabel.stories.d.ts +1 -0
  91. package/dist/components/label/field-label/components/RequiredIcon.d.ts +5 -0
  92. package/dist/components/label.js +1 -1
  93. package/dist/components/loading/Loading.d.ts +4 -4
  94. package/dist/components/loading.js +2 -2
  95. package/dist/components/loading.js.map +1 -1
  96. package/dist/components/modal.js +12 -122
  97. package/dist/components/modal.js.map +1 -1
  98. package/dist/components/option-group.js +1 -1
  99. package/dist/components/popover.js +34 -31
  100. package/dist/components/popover.js.map +1 -1
  101. package/dist/components/scheduler.js +11 -11
  102. package/dist/components/scheduler.js.map +1 -1
  103. package/dist/components/scroll-shadow-container/ScrollShadowContainer.d.ts +1 -0
  104. package/dist/components/scroll-shadow-container.js +1 -1
  105. package/dist/components/select.js +487 -519
  106. package/dist/components/select.js.map +1 -1
  107. package/dist/components/shortcut/Shortcut.d.ts +14 -14
  108. package/dist/components/shortcut/Shortcut.stories.d.ts +7 -7
  109. package/dist/components/shortcut.js +16 -16
  110. package/dist/components/shortcut.js.map +1 -1
  111. package/dist/components/skeleton/Skeleton.d.ts +1 -0
  112. package/dist/components/skeleton/Skeleton.stories.d.ts +7 -0
  113. package/dist/components/skeleton/index.d.ts +1 -0
  114. package/dist/components/skeleton.d.ts +2 -0
  115. package/dist/components/skeleton.js +33 -0
  116. package/dist/components/skeleton.js.map +1 -0
  117. package/dist/components/switch.js +147 -126
  118. package/dist/components/switch.js.map +1 -1
  119. package/dist/components/tabs.js +9 -8
  120. package/dist/components/tabs.js.map +1 -1
  121. package/dist/components/tag.js +3 -3
  122. package/dist/components/toast.js +4 -4
  123. package/dist/components/toast.js.map +1 -1
  124. package/dist/components/toggle-group.js +1 -1
  125. package/dist/components/toggle.js +1 -1
  126. package/dist/components/tooltip/Tooltip.stories.d.ts +7 -0
  127. package/dist/components/tooltip/index.d.ts +1 -0
  128. package/dist/components/tooltip.d.ts +2 -0
  129. package/dist/components/tooltip.js +8 -0
  130. package/dist/components/tooltip.js.map +1 -0
  131. package/dist/createLucideIcon-DgrNxRV5.js.map +1 -1
  132. package/dist/design-tokens.source.json +1 -1
  133. package/dist/download-CVOGyQ0e.js.map +1 -1
  134. package/dist/downloadFile-yZV-aaO2.js +15 -0
  135. package/dist/downloadFile-yZV-aaO2.js.map +1 -0
  136. package/dist/index-B6K06mzp.js +67 -0
  137. package/dist/index-B6K06mzp.js.map +1 -0
  138. package/dist/index-BCZIl2rL.js +68 -0
  139. package/dist/index-BCZIl2rL.js.map +1 -0
  140. package/dist/index-BZPx6jYI.js.map +1 -1
  141. package/dist/index-Bj6ZBhqh.js +105 -0
  142. package/dist/index-Bj6ZBhqh.js.map +1 -0
  143. package/dist/index-ByaXH_ih.js.map +1 -1
  144. package/dist/index-CACw01gt.js +702 -0
  145. package/dist/index-CACw01gt.js.map +1 -0
  146. package/dist/index-COBL2CQB.js +14 -0
  147. package/dist/index-COBL2CQB.js.map +1 -0
  148. package/dist/index-CR-odn5-.js.map +1 -1
  149. package/dist/{index-BjbwEU_d.js → index-ClwWa5fz.js} +20 -20
  150. package/dist/index-ClwWa5fz.js.map +1 -0
  151. package/dist/{index-DwbC6luJ.js → index-Cx4x7Bv2.js} +52 -50
  152. package/dist/index-Cx4x7Bv2.js.map +1 -0
  153. package/dist/index-CzNelU6n.js +55 -0
  154. package/dist/index-CzNelU6n.js.map +1 -0
  155. package/dist/index-DBsc8nMF.js +43 -0
  156. package/dist/index-DBsc8nMF.js.map +1 -0
  157. package/dist/index-Mbnk_gHS.js +102 -0
  158. package/dist/index-Mbnk_gHS.js.map +1 -0
  159. package/dist/index-bhXb51Q1.js +215 -0
  160. package/dist/index-bhXb51Q1.js.map +1 -0
  161. package/dist/index-n71RB2rx.js +1592 -0
  162. package/dist/index-n71RB2rx.js.map +1 -0
  163. package/dist/index-rKs9bXHr.js +7 -0
  164. package/dist/index-rKs9bXHr.js.map +1 -0
  165. package/dist/lib/utils/file/downloadFile.d.ts +2 -0
  166. package/dist/lib/utils/image/imageConverter.d.ts +23 -0
  167. package/dist/styles-scoped.css +72 -18
  168. package/dist/styles.css +72 -18
  169. package/dist/{utils-DGzAmwok.js → utils-BK4mPzkB.js} +2 -2
  170. package/dist/utils-BK4mPzkB.js.map +1 -0
  171. package/dist/x-JgjNP5oH.js.map +1 -1
  172. package/package.json +1 -1
  173. package/dist/Button-DhfE69q0.js.map +0 -1
  174. package/dist/CheckboxField-CL1Tc7P4.js +0 -257
  175. package/dist/CheckboxField-CL1Tc7P4.js.map +0 -1
  176. package/dist/Divider-D3NvaU8c.js +0 -46
  177. package/dist/Field-COOo8o9f.js +0 -80
  178. package/dist/Field-COOo8o9f.js.map +0 -1
  179. package/dist/FieldLabel-BGxT_RaE.js +0 -64
  180. package/dist/FieldLabel-BGxT_RaE.js.map +0 -1
  181. package/dist/FormBody-DM52shm4.js +0 -101
  182. package/dist/FormBody-DM52shm4.js.map +0 -1
  183. package/dist/IsolatedStylesWrapper-B_Qu75eR.js +0 -555
  184. package/dist/IsolatedStylesWrapper-B_Qu75eR.js.map +0 -1
  185. package/dist/ScrollShadowContainer-DSKr3_fV.js +0 -690
  186. package/dist/ScrollShadowContainer-DSKr3_fV.js.map +0 -1
  187. package/dist/Toggle-BuYtICWv.js +0 -129
  188. package/dist/Toggle-BuYtICWv.js.map +0 -1
  189. package/dist/ToggleGroup-CMyUAz04.js +0 -467
  190. package/dist/ToggleGroup-CMyUAz04.js.map +0 -1
  191. package/dist/bundle-mjs-D6wdQkGI.js.map +0 -1
  192. package/dist/floating-ui.react-dom-CWfR7VfF.js +0 -1346
  193. package/dist/floating-ui.react-dom-CWfR7VfF.js.map +0 -1
  194. package/dist/index-0WznJ1QS.js +0 -276
  195. package/dist/index-0WznJ1QS.js.map +0 -1
  196. package/dist/index-BjbwEU_d.js.map +0 -1
  197. package/dist/index-BqriTm0o.js +0 -47
  198. package/dist/index-BqriTm0o.js.map +0 -1
  199. package/dist/index-C6bvrqL8.js +0 -563
  200. package/dist/index-C6bvrqL8.js.map +0 -1
  201. package/dist/index-C6t9z3on.js +0 -97
  202. package/dist/index-C6t9z3on.js.map +0 -1
  203. package/dist/index-CaQG3DzJ.js +0 -64
  204. package/dist/index-CaQG3DzJ.js.map +0 -1
  205. package/dist/index-ChTGHCkY.js +0 -255
  206. package/dist/index-ChTGHCkY.js.map +0 -1
  207. package/dist/index-D808y1pT.js +0 -178
  208. package/dist/index-D808y1pT.js.map +0 -1
  209. package/dist/index-DE3fiSzl.js +0 -28
  210. package/dist/index-DE3fiSzl.js.map +0 -1
  211. package/dist/index-DPws5oAn.js +0 -90
  212. package/dist/index-DPws5oAn.js.map +0 -1
  213. package/dist/index-DeUgDpdG.js +0 -80
  214. package/dist/index-DeUgDpdG.js.map +0 -1
  215. package/dist/index-DvquTpxI.js +0 -140
  216. package/dist/index-DvquTpxI.js.map +0 -1
  217. package/dist/index-DwbC6luJ.js.map +0 -1
  218. package/dist/index-Ncxt32Wo.js +0 -174
  219. package/dist/index-Ncxt32Wo.js.map +0 -1
  220. package/dist/index-U7y6nBZR.js +0 -179
  221. package/dist/index-U7y6nBZR.js.map +0 -1
  222. package/dist/index-pysSAa5G.js +0 -57
  223. package/dist/index-pysSAa5G.js.map +0 -1
  224. package/dist/tooltip-DI3_ZKNk.js +0 -365
  225. package/dist/tooltip-DI3_ZKNk.js.map +0 -1
  226. package/dist/utils-DGzAmwok.js.map +0 -1
  227. /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,2 @@
1
+ export * from './gallery/index'
2
+ export {}
@@ -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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCa,MAAAA,IAAiB,CAACC,MAAyB;AACjD,QAAAC,IAAM,IAAI,gBAAgBD,CAAI;AAC7B,SAAA;AAAA,IACN,IAAI,KAAK,OAAO;AAAA,IAChB,KAAAC;AAAA,IACA,MAAMD,EAAK;AAAA,EACZ;AACD,GC5BME,IAAgBC,EAAG;AAAA,EACxB,MAAM;AAAA,EACN,OAAO;AAAA,IACN,iBAAiB;AAAA,EAAA;AAEnB,CAAC,GAqBYC,IAAUC,EAAM;AAAA,EAC5B,CACCC,IAYAC,MACI;AAbJ,QAAAC,IAAAF,IACC;AAAA,YAAAG,IAAO;AAAA,MACP,aAAAC,IAAc;AAAA,MACd,QAAAC,IAAS,CAAC;AAAA,MACV,eAAAC;AAAA,MACA,cAAAC;AAAA,MACA,UAAAC,IAAW;AAAA,MACX,kBAAAC,IAAmB;AAAA,MACnB,WAAAC;AAAA,MACA,iBAAAC;AAAA,QATDT,GAUIU,IAAAC,EAVJX,GAUI;AAAA,MATH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;A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" | "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
- var i = Object.defineProperty;
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
- n as ImagePlaceholder
3
+ o as ImagePlaceholder
44
4
  };
45
5
  //# sourceMappingURL=image-placeholder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"image-placeholder.js","sources":["../../src/components/image-placeholder/ImagePlaceholder.tsx"],"sourcesContent":["import React from \"react\";\r\nimport { tv, VariantProps } from \"tailwind-variants\";\r\n\r\nconst imagePlaceholderStyles = tv({\r\n\tbase: \"aspect-square rounded-xl border border-dashed border-primary-border\",\r\n\tvariants: {\r\n\t\tsize: {\r\n\t\t\txs: \"h-[3.75rem] w-[3.75rem]\",\r\n\t\t\tsm: \"h-20 w-20\",\r\n\t\t\tmd: \"h-[7.5rem] w-[7.5rem]\",\r\n\t\t\tlg: \"h-[11.5rem] w-[11.5rem]\",\r\n\t\t\txl: \"h-96 w-96\"\r\n\t\t}\r\n\t}\r\n});\r\n\r\nexport type ImagePlaceholderProps = React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof imagePlaceholderStyles>;\r\n\r\nexport const ImagePlaceholder = React.forwardRef<HTMLDivElement, ImagePlaceholderProps>(\r\n\t({ className, size, ...props }, ref) => {\r\n\t\treturn <div ref={ref} className={imagePlaceholderStyles({ className, size })} {...props} />;\r\n\t}\r\n);\r\n\r\nImagePlaceholder.displayName = \"ImagePlaceholder\";\r\n"],"names":["imagePlaceholderStyles","tv","ImagePlaceholder","React","_a","ref","_b","className","size","props","__objRest","jsx","__spreadValues"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAMA,IAAyBC,EAAG;AAAA,EACjC,MAAM;AAAA,EACN,UAAU;AAAA,IACT,MAAM;AAAA,MACL,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,IAAA;AAAA,EACL;AAEF,CAAC,GAIYC,IAAmBC,EAAM;AAAA,EACrC,CAACC,GAA+BC,MAAQ;AAAvC,QAAAC,IAAAF,GAAE,aAAAG,GAAW,MAAAC,MAAbF,GAAsBG,IAAAC,EAAtBJ,GAAsB,CAApB,aAAW;AACN,WAAA,gBAAAK,EAAC,OAAIC,EAAA,EAAA,KAAAP,GAAU,WAAWL,EAAuB,EAAE,WAAAO,GAAW,MAAAC,EAAK,CAAC,KAAOC,EAAO;AAAA,EAAA;AAE3F;AAEAP,EAAiB,cAAc;"}
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.ButtonHTMLAttributes<HTMLButtonElement> & VariantProps<typeof imagePreviewStyles> & {
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<HTMLButtonElement>) => void;
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.ButtonHTMLAttributes<HTMLButtonElement> & VariantProps< TVReturnType<{
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<HTMLButtonElement>) => void;
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<HTMLButtonElement>>;
380
+ } & React.RefAttributes<HTMLDivElement>>;
381
381
  export {};
@@ -1,139 +1,5 @@
1
- var L = Object.defineProperty, O = Object.defineProperties;
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
- E as ImagePreview
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,GAA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AA,EAAE,eAAe,GACjBA,EAAE,gBAAgB,GACRR,KAAA,QAAAA;AAAA,MACX;AAAA,MACA,CAACA,CAAO;AAAA,IACT;AAGC,WAAA,gBAAAW,EAAC,UAAOnB,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
- var x = Object.defineProperty, w = Object.defineProperties;
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
- U as ImageUploader
3
+ o as ImageUploader
120
4
  };
121
5
  //# sourceMappingURL=image-uploader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"image-uploader.js","sources":["../../node_modules/.pnpm/lucide-react@0.460.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/image.js","../../src/components/image-uploader/components/ImageCameraAddSvg.tsx","../../src/components/image-uploader/ImageUploader.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 Image = createLucideIcon(\"Image\", [\n [\"rect\", { width: \"18\", height: \"18\", x: \"3\", y: \"3\", rx: \"2\", ry: \"2\", key: \"1m3agn\" }],\n [\"circle\", { cx: \"9\", cy: \"9\", r: \"2\", key: \"af1f0g\" }],\n [\"path\", { d: \"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\", key: \"1xmnt7\" }]\n]);\n\nexport { Image as default };\n//# sourceMappingURL=image.js.map\n","interface ImageCameraAddProps {\r\n\tclassName?: string;\r\n}\r\n\r\nexport const ImageCameraAddSvg = ({ className }: ImageCameraAddProps) => {\r\n\treturn (\r\n\t\t<svg\r\n\t\t\twidth=\"24\"\r\n\t\t\theight=\"24\"\r\n\t\t\tviewBox=\"0 0 24 24\"\r\n\t\t\tfill=\"none\"\r\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\r\n\t\t\tclassName={className}\r\n\t\t>\r\n\t\t\t<path\r\n\t\t\t\td=\"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\"\r\n\t\t\t\tfill=\"currentColor\"\r\n\t\t\t/>\r\n\t\t</svg>\r\n\t);\r\n};\r\n","import React, { useRef } from \"react\";\r\nimport { tv, VariantProps } from \"tailwind-variants\";\r\nimport { ImageCameraAddSvg } from \"./components/ImageCameraAddSvg\";\r\nimport { Button } from \"../button\";\r\nimport { Image } from \"lucide-react\";\r\nimport { Icon } from \"../icon\";\r\nimport { cn } from \"@/lib/utils\";\r\n\r\nconst imageUploaderStyles = tv({\r\n\tslots: {\r\n\t\tcontainer:\r\n\t\t\t\"group relative flex aspect-square items-center justify-center rounded-xl p-6 focus-visible:shadow-focus focus-visible:ring-0\",\r\n\t\ticon: \"h-8 w-8 stroke-[1.5px] text-muted group-hover:text-primary\",\r\n\t\tinput: \"hidden\",\r\n\t\tcustomIcon: \"translate-x-0.5 translate-y-0.5\"\r\n\t},\r\n\tvariants: {\r\n\t\treadonly: {\r\n\t\t\ttrue: {\r\n\t\t\t\tcontainer:\r\n\t\t\t\t\t\"cursor-default bg-secondary-bg-hover hover:border-secondary-border hover:shadow-sm focus-visible:bg-secondary-bg-hover\",\r\n\t\t\t\ticon: \"group-hover:text-muted\"\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: {\r\n\t\t\ttrue: {\r\n\t\t\t\tcontainer:\r\n\t\t\t\t\t\"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\ticon: \"group-hover:text-muted\"\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 ImageUploaderProps = Omit<React.ComponentPropsWithoutRef<typeof Button>, \"onChange\"> &\r\n\tVariantProps<typeof imageUploaderStyles> & {\r\n\t\tonChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;\r\n\t\twhiteList?: string;\r\n\t};\r\n\r\nexport const ImageUploader = React.forwardRef<HTMLButtonElement, ImageUploaderProps>(\r\n\t({ className, error, readonly, size, onChange, whiteList = \"image/*\", ...props }, ref) => {\r\n\t\tconst fileInputRef = useRef<HTMLInputElement>(null);\r\n\t\tconst styles = imageUploaderStyles({ className, readonly, error, size });\r\n\r\n\t\treturn (\r\n\t\t\t<Button\r\n\t\t\t\tref={ref}\r\n\t\t\t\tvariant=\"outline\"\r\n\t\t\t\tclassName={styles.container()}\r\n\t\t\t\tonClick={() => !readonly && fileInputRef.current?.click()}\r\n\t\t\t\t{...props}\r\n\t\t\t>\r\n\t\t\t\t<input\r\n\t\t\t\t\tref={fileInputRef}\r\n\t\t\t\t\ttype=\"file\"\r\n\t\t\t\t\tclassName={styles.input()}\r\n\t\t\t\t\tonChange={onChange}\r\n\t\t\t\t\taccept={whiteList}\r\n\t\t\t\t/>\r\n\r\n\t\t\t\t{readonly && <Icon icon={Image} className={styles.icon()} />}\r\n\t\t\t\t{!readonly && <ImageCameraAddSvg className={cn(styles.icon(), styles.customIcon())} />}\r\n\t\t\t</Button>\r\n\t\t);\r\n\t}\r\n);\r\n\r\nImageUploader.displayName = \"ImageUploader\";\r\n"],"names":["Image","createLucideIcon","ImageCameraAddSvg","className","jsx","imageUploaderStyles","tv","ImageUploader","React","_a","ref","_b","error","readonly","size","onChange","whiteList","props","__objRest","fileInputRef","useRef","styles","jsxs","Button","__spreadProps","__spreadValues","Icon","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EF,CAAC,GAQYC,IAAgBC,EAAM;AAAA,EAClC,CAACC,GAAiFC,MAAQ;AAAzF,QAAAC,IAAAF,GAAE,aAAAN,GAAW,OAAAS,GAAO,UAAAC,GAAU,MAAAC,GAAM,UAAAC,GAAU,WAAAC,IAAY,cAA1DL,GAAwEM,IAAAC,EAAxEP,GAAwE,CAAtE,aAAW,SAAO,YAAU,QAAM,YAAU;AACxC,UAAAQ,IAAeC,EAAyB,IAAI,GAC5CC,IAAShB,EAAoB,EAAE,WAAAF,GAAW,UAAAU,GAAU,OAAAD,GAAO,MAAAE,GAAM;AAGtE,WAAA,gBAAAQ;AAAA,MAACC;AAAA,MAAAC,EAAAC,EAAA;AAAA,QACA,KAAAf;AAAA,QACA,SAAQ;AAAA,QACR,WAAWW,EAAO,UAAU;AAAA,QAC5B,SAAS,MAAA;;AAAM,kBAACR,OAAYJ,IAAAU,EAAa,YAAb,gBAAAV,EAAsB;AAAA;AAAA,SAC9CQ,IALJ;AAAA,QAOA,UAAA;AAAA,UAAA,gBAAAb;AAAA,YAAC;AAAA,YAAA;AAAA,cACA,KAAKe;AAAA,cACL,MAAK;AAAA,cACL,WAAWE,EAAO,MAAM;AAAA,cACxB,UAAAN;AAAA,cACA,QAAQC;AAAA,YAAA;AAAA,UACT;AAAA,UAECH,uBAAaa,GAAK,EAAA,MAAM1B,GAAO,WAAWqB,EAAO,QAAQ;AAAA,UACzD,CAACR,KAAa,gBAAAT,EAAAF,GAAA,EAAkB,WAAWyB,EAAGN,EAAO,KAAQ,GAAAA,EAAO,WAAY,CAAA,EAAG,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACrF;AAAA,EAAA;AAGH;AAEAd,EAAc,cAAc;","x_google_ignoreList":[0]}
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?: string;
9
+ url: string;
8
10
  /** Размер файла в байтах (опционально) */
9
11
  size?: number;
10
12
  /** MIME-тип файла (опционально) */